var Bn = Object.defineProperty;
var On = (s) => {
  throw TypeError(s);
};
var zn = (s, e, r) => e in s ? Bn(s, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : s[e] = r;
var be = (s, e, r) => zn(s, typeof e != "symbol" ? e + "" : e, r), Vn = (s, e, r) => e.has(s) || On("Cannot " + r);
var Cn = (s, e, r) => e.has(s) ? On("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, r);
var en = (s, e, r) => (Vn(s, e, "access private method"), r);
function _mergeNamespaces(s, e) {
  for (var r = 0; r < e.length; r++) {
    const o = e[r];
    if (typeof o != "string" && !Array.isArray(o)) {
      for (const m in o)
        if (m !== "default" && !(m in s)) {
          const _ = Object.getOwnPropertyDescriptor(o, m);
          _ && Object.defineProperty(s, m, _.get ? _ : {
            enumerable: !0,
            get: () => o[m]
          });
        }
    }
  }
  return Object.freeze(Object.defineProperty(s, Symbol.toStringTag, { value: "Module" }));
}
const {
  SvelteComponent: SvelteComponent$1u,
  append_hydration: append_hydration$1m,
  assign: assign$1,
  attr: attr$1s,
  binding_callbacks: binding_callbacks$5,
  children: children$1s,
  claim_element: claim_element$h,
  claim_space: claim_space$a,
  claim_svg_element: claim_svg_element$1c,
  create_slot: create_slot$6,
  detach: detach$1t,
  element: element_1,
  empty: empty$8,
  get_all_dirty_from_scope: get_all_dirty_from_scope$6,
  get_slot_changes: get_slot_changes$6,
  get_spread_update: get_spread_update$1,
  init: init$1u,
  insert_hydration: insert_hydration$1t,
  listen: listen$5,
  noop: noop$1i,
  safe_not_equal: safe_not_equal$1u,
  set_dynamic_element_data,
  set_style: set_style$8,
  space: space$a,
  svg_element: svg_element$1c,
  toggle_class: toggle_class$c,
  transition_in: transition_in$g,
  transition_out: transition_out$g,
  update_slot_base: update_slot_base$6
} = window.__gradio__svelte__internal;
function create_if_block_1$3(s) {
  let e, r, o, m, _;
  return {
    c() {
      e = svg_element$1c("svg"), r = svg_element$1c("line"), o = svg_element$1c("line"), this.h();
    },
    l(g) {
      e = claim_svg_element$1c(g, "svg", { class: !0, xmlns: !0, viewBox: !0 });
      var y = children$1s(e);
      r = claim_svg_element$1c(y, "line", {
        x1: !0,
        y1: !0,
        x2: !0,
        y2: !0,
        stroke: !0,
        "stroke-width": !0
      }), children$1s(r).forEach(detach$1t), o = claim_svg_element$1c(y, "line", {
        x1: !0,
        y1: !0,
        x2: !0,
        y2: !0,
        stroke: !0,
        "stroke-width": !0
      }), children$1s(o).forEach(detach$1t), y.forEach(detach$1t), this.h();
    },
    h() {
      attr$1s(r, "x1", "1"), attr$1s(r, "y1", "9"), attr$1s(r, "x2", "9"), attr$1s(r, "y2", "1"), attr$1s(r, "stroke", "gray"), attr$1s(r, "stroke-width", "0.5"), attr$1s(o, "x1", "5"), attr$1s(o, "y1", "9"), attr$1s(o, "x2", "9"), attr$1s(o, "y2", "5"), attr$1s(o, "stroke", "gray"), attr$1s(o, "stroke-width", "0.5"), attr$1s(e, "class", "resize-handle svelte-239wnu"), attr$1s(e, "xmlns", "http://www.w3.org/2000/svg"), attr$1s(e, "viewBox", "0 0 10 10");
    },
    m(g, y) {
      insert_hydration$1t(g, e, y), append_hydration$1m(e, r), append_hydration$1m(e, o), m || (_ = listen$5(
        e,
        "mousedown",
        /*resize*/
        s[27]
      ), m = !0);
    },
    p: noop$1i,
    d(g) {
      g && detach$1t(e), m = !1, _();
    }
  };
}
function create_dynamic_element(s) {
  var h;
  let e, r, o, m, _;
  const g = (
    /*#slots*/
    s[31].default
  ), y = create_slot$6(
    g,
    s,
    /*$$scope*/
    s[30],
    null
  );
  let E = (
    /*resizable*/
    s[19] && create_if_block_1$3(s)
  ), x = [
    { "data-testid": (
      /*test_id*/
      s[11]
    ) },
    { id: (
      /*elem_id*/
      s[6]
    ) },
    {
      class: o = "block " + /*elem_classes*/
      (((h = s[7]) == null ? void 0 : h.join(" ")) || "") + " svelte-239wnu"
    },
    {
      dir: m = /*rtl*/
      s[20] ? "rtl" : "ltr"
    }
  ], v = {};
  for (let a = 0; a < x.length; a += 1)
    v = assign$1(v, x[a]);
  return {
    c() {
      e = element_1(
        /*tag*/
        s[25]
      ), y && y.c(), r = space$a(), E && E.c(), this.h();
    },
    l(a) {
      e = claim_element$h(
        a,
        /*tag*/
        (s[25] || "null").toUpperCase(),
        {
          "data-testid": !0,
          id: !0,
          class: !0,
          dir: !0
        }
      );
      var b = children$1s(e);
      y && y.l(b), r = claim_space$a(b), E && E.l(b), b.forEach(detach$1t), this.h();
    },
    h() {
      set_dynamic_element_data(
        /*tag*/
        s[25]
      )(e, v), toggle_class$c(
        e,
        "hidden",
        /*visible*/
        s[14] === !1
      ), toggle_class$c(
        e,
        "padded",
        /*padding*/
        s[10]
      ), toggle_class$c(
        e,
        "flex",
        /*flex*/
        s[1]
      ), toggle_class$c(
        e,
        "border_focus",
        /*border_mode*/
        s[9] === "focus"
      ), toggle_class$c(
        e,
        "border_contrast",
        /*border_mode*/
        s[9] === "contrast"
      ), toggle_class$c(e, "hide-container", !/*explicit_call*/
      s[12] && !/*container*/
      s[13]), toggle_class$c(
        e,
        "fullscreen",
        /*fullscreen*/
        s[0]
      ), toggle_class$c(
        e,
        "animating",
        /*fullscreen*/
        s[0] && /*preexpansionBoundingRect*/
        s[24] !== null
      ), toggle_class$c(
        e,
        "auto-margin",
        /*scale*/
        s[17] === null
      ), set_style$8(
        e,
        "height",
        /*fullscreen*/
        s[0] ? void 0 : (
          /*get_dimension*/
          s[26](
            /*height*/
            s[2]
          )
        )
      ), set_style$8(
        e,
        "min-height",
        /*fullscreen*/
        s[0] ? void 0 : (
          /*get_dimension*/
          s[26](
            /*min_height*/
            s[3]
          )
        )
      ), set_style$8(
        e,
        "max-height",
        /*fullscreen*/
        s[0] ? void 0 : (
          /*get_dimension*/
          s[26](
            /*max_height*/
            s[4]
          )
        )
      ), set_style$8(
        e,
        "--start-top",
        /*preexpansionBoundingRect*/
        s[24] ? `${/*preexpansionBoundingRect*/
        s[24].top}px` : "0px"
      ), set_style$8(
        e,
        "--start-left",
        /*preexpansionBoundingRect*/
        s[24] ? `${/*preexpansionBoundingRect*/
        s[24].left}px` : "0px"
      ), set_style$8(
        e,
        "--start-width",
        /*preexpansionBoundingRect*/
        s[24] ? `${/*preexpansionBoundingRect*/
        s[24].width}px` : "0px"
      ), set_style$8(
        e,
        "--start-height",
        /*preexpansionBoundingRect*/
        s[24] ? `${/*preexpansionBoundingRect*/
        s[24].height}px` : "0px"
      ), set_style$8(
        e,
        "width",
        /*fullscreen*/
        s[0] ? void 0 : typeof /*width*/
        s[5] == "number" ? `calc(min(${/*width*/
        s[5]}px, 100%))` : (
          /*get_dimension*/
          s[26](
            /*width*/
            s[5]
          )
        )
      ), set_style$8(
        e,
        "border-style",
        /*variant*/
        s[8]
      ), set_style$8(
        e,
        "overflow",
        /*allow_overflow*/
        s[15] ? (
          /*overflow_behavior*/
          s[16]
        ) : "hidden"
      ), set_style$8(
        e,
        "flex-grow",
        /*scale*/
        s[17]
      ), set_style$8(e, "min-width", `calc(min(${/*min_width*/
      s[18]}px, 100%))`), set_style$8(e, "border-width", "var(--block-border-width)");
    },
    m(a, b) {
      insert_hydration$1t(a, e, b), y && y.m(e, null), append_hydration$1m(e, r), E && E.m(e, null), s[32](e), _ = !0;
    },
    p(a, b) {
      var w;
      y && y.p && (!_ || b[0] & /*$$scope*/
      1073741824) && update_slot_base$6(
        y,
        g,
        a,
        /*$$scope*/
        a[30],
        _ ? get_slot_changes$6(
          g,
          /*$$scope*/
          a[30],
          b,
          null
        ) : get_all_dirty_from_scope$6(
          /*$$scope*/
          a[30]
        ),
        null
      ), /*resizable*/
      a[19] ? E ? E.p(a, b) : (E = create_if_block_1$3(a), E.c(), E.m(e, null)) : E && (E.d(1), E = null), set_dynamic_element_data(
        /*tag*/
        a[25]
      )(e, v = get_spread_update$1(x, [
        (!_ || b[0] & /*test_id*/
        2048) && { "data-testid": (
          /*test_id*/
          a[11]
        ) },
        (!_ || b[0] & /*elem_id*/
        64) && { id: (
          /*elem_id*/
          a[6]
        ) },
        (!_ || b[0] & /*elem_classes*/
        128 && o !== (o = "block " + /*elem_classes*/
        (((w = a[7]) == null ? void 0 : w.join(" ")) || "") + " svelte-239wnu")) && { class: o },
        (!_ || b[0] & /*rtl*/
        1048576 && m !== (m = /*rtl*/
        a[20] ? "rtl" : "ltr")) && { dir: m }
      ])), toggle_class$c(
        e,
        "hidden",
        /*visible*/
        a[14] === !1
      ), toggle_class$c(
        e,
        "padded",
        /*padding*/
        a[10]
      ), toggle_class$c(
        e,
        "flex",
        /*flex*/
        a[1]
      ), toggle_class$c(
        e,
        "border_focus",
        /*border_mode*/
        a[9] === "focus"
      ), toggle_class$c(
        e,
        "border_contrast",
        /*border_mode*/
        a[9] === "contrast"
      ), toggle_class$c(e, "hide-container", !/*explicit_call*/
      a[12] && !/*container*/
      a[13]), toggle_class$c(
        e,
        "fullscreen",
        /*fullscreen*/
        a[0]
      ), toggle_class$c(
        e,
        "animating",
        /*fullscreen*/
        a[0] && /*preexpansionBoundingRect*/
        a[24] !== null
      ), toggle_class$c(
        e,
        "auto-margin",
        /*scale*/
        a[17] === null
      ), b[0] & /*fullscreen, height*/
      5 && set_style$8(
        e,
        "height",
        /*fullscreen*/
        a[0] ? void 0 : (
          /*get_dimension*/
          a[26](
            /*height*/
            a[2]
          )
        )
      ), b[0] & /*fullscreen, min_height*/
      9 && set_style$8(
        e,
        "min-height",
        /*fullscreen*/
        a[0] ? void 0 : (
          /*get_dimension*/
          a[26](
            /*min_height*/
            a[3]
          )
        )
      ), b[0] & /*fullscreen, max_height*/
      17 && set_style$8(
        e,
        "max-height",
        /*fullscreen*/
        a[0] ? void 0 : (
          /*get_dimension*/
          a[26](
            /*max_height*/
            a[4]
          )
        )
      ), b[0] & /*preexpansionBoundingRect*/
      16777216 && set_style$8(
        e,
        "--start-top",
        /*preexpansionBoundingRect*/
        a[24] ? `${/*preexpansionBoundingRect*/
        a[24].top}px` : "0px"
      ), b[0] & /*preexpansionBoundingRect*/
      16777216 && set_style$8(
        e,
        "--start-left",
        /*preexpansionBoundingRect*/
        a[24] ? `${/*preexpansionBoundingRect*/
        a[24].left}px` : "0px"
      ), b[0] & /*preexpansionBoundingRect*/
      16777216 && set_style$8(
        e,
        "--start-width",
        /*preexpansionBoundingRect*/
        a[24] ? `${/*preexpansionBoundingRect*/
        a[24].width}px` : "0px"
      ), b[0] & /*preexpansionBoundingRect*/
      16777216 && set_style$8(
        e,
        "--start-height",
        /*preexpansionBoundingRect*/
        a[24] ? `${/*preexpansionBoundingRect*/
        a[24].height}px` : "0px"
      ), b[0] & /*fullscreen, width*/
      33 && set_style$8(
        e,
        "width",
        /*fullscreen*/
        a[0] ? void 0 : typeof /*width*/
        a[5] == "number" ? `calc(min(${/*width*/
        a[5]}px, 100%))` : (
          /*get_dimension*/
          a[26](
            /*width*/
            a[5]
          )
        )
      ), b[0] & /*variant*/
      256 && set_style$8(
        e,
        "border-style",
        /*variant*/
        a[8]
      ), b[0] & /*allow_overflow, overflow_behavior*/
      98304 && set_style$8(
        e,
        "overflow",
        /*allow_overflow*/
        a[15] ? (
          /*overflow_behavior*/
          a[16]
        ) : "hidden"
      ), b[0] & /*scale*/
      131072 && set_style$8(
        e,
        "flex-grow",
        /*scale*/
        a[17]
      ), b[0] & /*min_width*/
      262144 && set_style$8(e, "min-width", `calc(min(${/*min_width*/
      a[18]}px, 100%))`);
    },
    i(a) {
      _ || (transition_in$g(y, a), _ = !0);
    },
    o(a) {
      transition_out$g(y, a), _ = !1;
    },
    d(a) {
      a && detach$1t(e), y && y.d(a), E && E.d(), s[32](null);
    }
  };
}
function create_if_block$5(s) {
  let e;
  return {
    c() {
      e = element_1("div"), this.h();
    },
    l(r) {
      e = claim_element$h(r, "DIV", { class: !0 }), children$1s(e).forEach(detach$1t), this.h();
    },
    h() {
      attr$1s(e, "class", "placeholder svelte-239wnu"), set_style$8(
        e,
        "height",
        /*placeholder_height*/
        s[22] + "px"
      ), set_style$8(
        e,
        "width",
        /*placeholder_width*/
        s[23] + "px"
      );
    },
    m(r, o) {
      insert_hydration$1t(r, e, o);
    },
    p(r, o) {
      o[0] & /*placeholder_height*/
      4194304 && set_style$8(
        e,
        "height",
        /*placeholder_height*/
        r[22] + "px"
      ), o[0] & /*placeholder_width*/
      8388608 && set_style$8(
        e,
        "width",
        /*placeholder_width*/
        r[23] + "px"
      );
    },
    d(r) {
      r && detach$1t(e);
    }
  };
}
function create_fragment$d(s) {
  let e, r, o, m = (
    /*tag*/
    s[25] && create_dynamic_element(s)
  ), _ = (
    /*fullscreen*/
    s[0] && create_if_block$5(s)
  );
  return {
    c() {
      m && m.c(), e = space$a(), _ && _.c(), r = empty$8();
    },
    l(g) {
      m && m.l(g), e = claim_space$a(g), _ && _.l(g), r = empty$8();
    },
    m(g, y) {
      m && m.m(g, y), insert_hydration$1t(g, e, y), _ && _.m(g, y), insert_hydration$1t(g, r, y), o = !0;
    },
    p(g, y) {
      /*tag*/
      g[25] && m.p(g, y), /*fullscreen*/
      g[0] ? _ ? _.p(g, y) : (_ = create_if_block$5(g), _.c(), _.m(r.parentNode, r)) : _ && (_.d(1), _ = null);
    },
    i(g) {
      o || (transition_in$g(m, g), o = !0);
    },
    o(g) {
      transition_out$g(m, g), o = !1;
    },
    d(g) {
      g && (detach$1t(e), detach$1t(r)), m && m.d(g), _ && _.d(g);
    }
  };
}
function instance$9(s, e, r) {
  let { $$slots: o = {}, $$scope: m } = e, { height: _ = void 0 } = e, { min_height: g = void 0 } = e, { max_height: y = void 0 } = e, { width: E = void 0 } = e, { elem_id: x = "" } = e, { elem_classes: v = [] } = e, { variant: h = "solid" } = e, { border_mode: a = "base" } = e, { padding: b = !0 } = e, { type: w = "normal" } = e, { test_id: k = void 0 } = e, { explicit_call: A = !1 } = e, { container: M = !0 } = e, { visible: $ = !0 } = e, { allow_overflow: O = !0 } = e, { overflow_behavior: C = "auto" } = e, { scale: P = null } = e, { min_width: I = 0 } = e, { flex: N = !1 } = e, { resizable: R = !1 } = e, { rtl: F = !1 } = e, { fullscreen: B = !1 } = e, G = B, Q, ee = w === "fieldset" ? "fieldset" : "div", Y = 0, W = 0, j = null;
  function J(oe) {
    B && oe.key === "Escape" && r(0, B = !1);
  }
  const me = (oe) => {
    if (oe !== void 0) {
      if (typeof oe == "number")
        return oe + "px";
      if (typeof oe == "string")
        return oe;
    }
  }, pe = (oe) => {
    let we = oe.clientY;
    const Se = (de) => {
      const Oe = de.clientY - we;
      we = de.clientY, r(21, Q.style.height = `${Q.offsetHeight + Oe}px`, Q);
    }, Me = () => {
      window.removeEventListener("mousemove", Se), window.removeEventListener("mouseup", Me);
    };
    window.addEventListener("mousemove", Se), window.addEventListener("mouseup", Me);
  };
  function ye(oe) {
    binding_callbacks$5[oe ? "unshift" : "push"](() => {
      Q = oe, r(21, Q);
    });
  }
  return s.$$set = (oe) => {
    "height" in oe && r(2, _ = oe.height), "min_height" in oe && r(3, g = oe.min_height), "max_height" in oe && r(4, y = oe.max_height), "width" in oe && r(5, E = oe.width), "elem_id" in oe && r(6, x = oe.elem_id), "elem_classes" in oe && r(7, v = oe.elem_classes), "variant" in oe && r(8, h = oe.variant), "border_mode" in oe && r(9, a = oe.border_mode), "padding" in oe && r(10, b = oe.padding), "type" in oe && r(28, w = oe.type), "test_id" in oe && r(11, k = oe.test_id), "explicit_call" in oe && r(12, A = oe.explicit_call), "container" in oe && r(13, M = oe.container), "visible" in oe && r(14, $ = oe.visible), "allow_overflow" in oe && r(15, O = oe.allow_overflow), "overflow_behavior" in oe && r(16, C = oe.overflow_behavior), "scale" in oe && r(17, P = oe.scale), "min_width" in oe && r(18, I = oe.min_width), "flex" in oe && r(1, N = oe.flex), "resizable" in oe && r(19, R = oe.resizable), "rtl" in oe && r(20, F = oe.rtl), "fullscreen" in oe && r(0, B = oe.fullscreen), "$$scope" in oe && r(30, m = oe.$$scope);
  }, s.$$.update = () => {
    s.$$.dirty[0] & /*fullscreen, old_fullscreen, element*/
    538968065 && B !== G && (r(29, G = B), B ? (r(24, j = Q.getBoundingClientRect()), r(22, Y = Q.offsetHeight), r(23, W = Q.offsetWidth), window.addEventListener("keydown", J)) : (r(24, j = null), window.removeEventListener("keydown", J))), s.$$.dirty[0] & /*visible*/
    16384 && ($ || r(1, N = !1));
  }, [
    B,
    N,
    _,
    g,
    y,
    E,
    x,
    v,
    h,
    a,
    b,
    k,
    A,
    M,
    $,
    O,
    C,
    P,
    I,
    R,
    F,
    Q,
    Y,
    W,
    j,
    ee,
    me,
    pe,
    w,
    G,
    m,
    o,
    ye
  ];
}
class Block extends SvelteComponent$1u {
  constructor(e) {
    super(), init$1u(
      this,
      e,
      instance$9,
      create_fragment$d,
      safe_not_equal$1u,
      {
        height: 2,
        min_height: 3,
        max_height: 4,
        width: 5,
        elem_id: 6,
        elem_classes: 7,
        variant: 8,
        border_mode: 9,
        padding: 10,
        type: 28,
        test_id: 11,
        explicit_call: 12,
        container: 13,
        visible: 14,
        allow_overflow: 15,
        overflow_behavior: 16,
        scale: 17,
        min_width: 18,
        flex: 1,
        resizable: 19,
        rtl: 20,
        fullscreen: 0
      },
      null,
      [-1, -1]
    );
  }
}
class SourceLocation {
  // The + prefix indicates that these fields aren't writeable
  // Lexer holding the input string.
  // Start offset, zero-based inclusive.
  // End offset, zero-based exclusive.
  constructor(e, r, o) {
    this.lexer = void 0, this.start = void 0, this.end = void 0, this.lexer = e, this.start = r, this.end = o;
  }
  /**
   * Merges two `SourceLocation`s from location providers, given they are
   * provided in order of appearance.
   * - Returns the first one's location if only the first is provided.
   * - Returns a merged range of the first and the last if both are provided
   *   and their lexers match.
   * - Otherwise, returns null.
   */
  static range(e, r) {
    return r ? !e || !e.loc || !r.loc || e.loc.lexer !== r.loc.lexer ? null : new SourceLocation(e.loc.lexer, e.loc.start, r.loc.end) : e && e.loc;
  }
}
let Token$1 = class Fn {
  // don't expand the token
  // used in \noexpand
  constructor(e, r) {
    this.text = void 0, this.loc = void 0, this.noexpand = void 0, this.treatAsRelax = void 0, this.text = e, this.loc = r;
  }
  /**
   * Given a pair of tokens (this and endToken), compute a `Token` encompassing
   * the whole input range enclosed by these two.
   */
  range(e, r) {
    return new Fn(r, SourceLocation.range(this, e));
  }
};
class ParseError {
  // Error start position based on passed-in Token or ParseNode.
  // Length of affected text based on passed-in Token or ParseNode.
  // The underlying error message without any context added.
  constructor(e, r) {
    this.name = void 0, this.position = void 0, this.length = void 0, this.rawMessage = void 0;
    var o = "KaTeX parse error: " + e, m, _, g = r && r.loc;
    if (g && g.start <= g.end) {
      var y = g.lexer.input;
      m = g.start, _ = g.end, m === y.length ? o += " at end of input: " : o += " at position " + (m + 1) + ": ";
      var E = y.slice(m, _).replace(/[^]/g, "$&̲"), x;
      m > 15 ? x = "…" + y.slice(m - 15, m) : x = y.slice(0, m);
      var v;
      _ + 15 < y.length ? v = y.slice(_, _ + 15) + "…" : v = y.slice(_), o += x + E + v;
    }
    var h = new Error(o);
    return h.name = "ParseError", h.__proto__ = ParseError.prototype, h.position = m, m != null && _ != null && (h.length = _ - m), h.rawMessage = e, h;
  }
}
ParseError.prototype.__proto__ = Error.prototype;
var contains = function(e, r) {
  return e.indexOf(r) !== -1;
}, deflt = function(e, r) {
  return e === void 0 ? r : e;
}, uppercase = /([A-Z])/g, hyphenate = function(e) {
  return e.replace(uppercase, "-$1").toLowerCase();
}, ESCAPE_LOOKUP = {
  "&": "&amp;",
  ">": "&gt;",
  "<": "&lt;",
  '"': "&quot;",
  "'": "&#x27;"
}, ESCAPE_REGEX = /[&><"']/g;
function escape$3(s) {
  return String(s).replace(ESCAPE_REGEX, (e) => ESCAPE_LOOKUP[e]);
}
var getBaseElem = function s(e) {
  return e.type === "ordgroup" || e.type === "color" ? e.body.length === 1 ? s(e.body[0]) : e : e.type === "font" ? s(e.body) : e;
}, isCharacterBox = function(e) {
  var r = getBaseElem(e);
  return r.type === "mathord" || r.type === "textord" || r.type === "atom";
}, assert = function(e) {
  if (!e)
    throw new Error("Expected non-null, but got " + String(e));
  return e;
}, protocolFromUrl = function(e) {
  var r = /^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);
  return r ? r[2] !== ":" || !/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(r[1]) ? null : r[1].toLowerCase() : "_relative";
}, utils = {
  contains,
  deflt,
  escape: escape$3,
  hyphenate,
  getBaseElem,
  isCharacterBox,
  protocolFromUrl
}, SETTINGS_SCHEMA = {
  displayMode: {
    type: "boolean",
    description: "Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",
    cli: "-d, --display-mode"
  },
  output: {
    type: {
      enum: ["htmlAndMathml", "html", "mathml"]
    },
    description: "Determines the markup language of the output.",
    cli: "-F, --format <type>"
  },
  leqno: {
    type: "boolean",
    description: "Render display math in leqno style (left-justified tags)."
  },
  fleqn: {
    type: "boolean",
    description: "Render display math flush left."
  },
  throwOnError: {
    type: "boolean",
    default: !0,
    cli: "-t, --no-throw-on-error",
    cliDescription: "Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."
  },
  errorColor: {
    type: "string",
    default: "#cc0000",
    cli: "-c, --error-color <color>",
    cliDescription: "A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",
    cliProcessor: (s) => "#" + s
  },
  macros: {
    type: "object",
    cli: "-m, --macro <def>",
    cliDescription: "Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",
    cliDefault: [],
    cliProcessor: (s, e) => (e.push(s), e)
  },
  minRuleThickness: {
    type: "number",
    description: "Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",
    processor: (s) => Math.max(0, s),
    cli: "--min-rule-thickness <size>",
    cliProcessor: parseFloat
  },
  colorIsTextColor: {
    type: "boolean",
    description: "Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",
    cli: "-b, --color-is-text-color"
  },
  strict: {
    type: [{
      enum: ["warn", "ignore", "error"]
    }, "boolean", "function"],
    description: "Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",
    cli: "-S, --strict",
    cliDefault: !1
  },
  trust: {
    type: ["boolean", "function"],
    description: "Trust the input, enabling all HTML features such as \\url.",
    cli: "-T, --trust"
  },
  maxSize: {
    type: "number",
    default: 1 / 0,
    description: "If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",
    processor: (s) => Math.max(0, s),
    cli: "-s, --max-size <n>",
    cliProcessor: parseInt
  },
  maxExpand: {
    type: "number",
    default: 1e3,
    description: "Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",
    processor: (s) => Math.max(0, s),
    cli: "-e, --max-expand <n>",
    cliProcessor: (s) => s === "Infinity" ? 1 / 0 : parseInt(s)
  },
  globalGroup: {
    type: "boolean",
    cli: !1
  }
};
function getDefaultValue(s) {
  if (s.default)
    return s.default;
  var e = s.type, r = Array.isArray(e) ? e[0] : e;
  if (typeof r != "string")
    return r.enum[0];
  switch (r) {
    case "boolean":
      return !1;
    case "string":
      return "";
    case "number":
      return 0;
    case "object":
      return {};
  }
}
class Settings {
  constructor(e) {
    this.displayMode = void 0, this.output = void 0, this.leqno = void 0, this.fleqn = void 0, this.throwOnError = void 0, this.errorColor = void 0, this.macros = void 0, this.minRuleThickness = void 0, this.colorIsTextColor = void 0, this.strict = void 0, this.trust = void 0, this.maxSize = void 0, this.maxExpand = void 0, this.globalGroup = void 0, e = e || {};
    for (var r in SETTINGS_SCHEMA)
      if (SETTINGS_SCHEMA.hasOwnProperty(r)) {
        var o = SETTINGS_SCHEMA[r];
        this[r] = e[r] !== void 0 ? o.processor ? o.processor(e[r]) : e[r] : getDefaultValue(o);
      }
  }
  /**
   * Report nonstrict (non-LaTeX-compatible) input.
   * Can safely not be called if `this.strict` is false in JavaScript.
   */
  reportNonstrict(e, r, o) {
    var m = this.strict;
    if (typeof m == "function" && (m = m(e, r, o)), !(!m || m === "ignore")) {
      if (m === !0 || m === "error")
        throw new ParseError("LaTeX-incompatible input and strict mode is set to 'error': " + (r + " [" + e + "]"), o);
      m === "warn" ? typeof console < "u" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (r + " [" + e + "]")) : typeof console < "u" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + m + "': " + r + " [" + e + "]"));
    }
  }
  /**
   * Check whether to apply strict (LaTeX-adhering) behavior for unusual
   * input (like `\\`).  Unlike `nonstrict`, will not throw an error;
   * instead, "error" translates to a return value of `true`, while "ignore"
   * translates to a return value of `false`.  May still print a warning:
   * "warn" prints a warning and returns `false`.
   * This is for the second category of `errorCode`s listed in the README.
   */
  useStrictBehavior(e, r, o) {
    var m = this.strict;
    if (typeof m == "function")
      try {
        m = m(e, r, o);
      } catch {
        m = "error";
      }
    return !m || m === "ignore" ? !1 : m === !0 || m === "error" ? !0 : m === "warn" ? (typeof console < "u" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (r + " [" + e + "]")), !1) : (typeof console < "u" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + m + "': " + r + " [" + e + "]")), !1);
  }
  /**
   * Check whether to test potentially dangerous input, and return
   * `true` (trusted) or `false` (untrusted).  The sole argument `context`
   * should be an object with `command` field specifying the relevant LaTeX
   * command (as a string starting with `\`), and any other arguments, etc.
   * If `context` has a `url` field, a `protocol` field will automatically
   * get added by this function (changing the specified object).
   */
  isTrusted(e) {
    if (e.url && !e.protocol) {
      var r = utils.protocolFromUrl(e.url);
      if (r == null)
        return !1;
      e.protocol = r;
    }
    var o = typeof this.trust == "function" ? this.trust(e) : this.trust;
    return !!o;
  }
}
class Style {
  constructor(e, r, o) {
    this.id = void 0, this.size = void 0, this.cramped = void 0, this.id = e, this.size = r, this.cramped = o;
  }
  /**
   * Get the style of a superscript given a base in the current style.
   */
  sup() {
    return styles[sup[this.id]];
  }
  /**
   * Get the style of a subscript given a base in the current style.
   */
  sub() {
    return styles[sub[this.id]];
  }
  /**
   * Get the style of a fraction numerator given the fraction in the current
   * style.
   */
  fracNum() {
    return styles[fracNum[this.id]];
  }
  /**
   * Get the style of a fraction denominator given the fraction in the current
   * style.
   */
  fracDen() {
    return styles[fracDen[this.id]];
  }
  /**
   * Get the cramped version of a style (in particular, cramping a cramped style
   * doesn't change the style).
   */
  cramp() {
    return styles[cramp[this.id]];
  }
  /**
   * Get a text or display version of this style.
   */
  text() {
    return styles[text$1$1[this.id]];
  }
  /**
   * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle)
   */
  isTight() {
    return this.size >= 2;
  }
}
var D = 0, Dc = 1, T = 2, Tc = 3, S = 4, Sc = 5, SS = 6, SSc = 7, styles = [new Style(D, 0, !1), new Style(Dc, 0, !0), new Style(T, 1, !1), new Style(Tc, 1, !0), new Style(S, 2, !1), new Style(Sc, 2, !0), new Style(SS, 3, !1), new Style(SSc, 3, !0)], sup = [S, Sc, S, Sc, SS, SSc, SS, SSc], sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc], fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc], fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc], cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc], text$1$1 = [D, Dc, T, Tc, T, Tc, T, Tc], Style$1 = {
  DISPLAY: styles[D],
  TEXT: styles[T],
  SCRIPT: styles[S],
  SCRIPTSCRIPT: styles[SS]
}, scriptData = [{
  // Latin characters beyond the Latin-1 characters we have metrics for.
  // Needed for Czech, Hungarian and Turkish text, for example.
  name: "latin",
  blocks: [
    [256, 591],
    // Latin Extended-A and Latin Extended-B
    [768, 879]
    // Combining Diacritical marks
  ]
}, {
  // The Cyrillic script used by Russian and related languages.
  // A Cyrillic subset used to be supported as explicitly defined
  // symbols in symbols.js
  name: "cyrillic",
  blocks: [[1024, 1279]]
}, {
  // Armenian
  name: "armenian",
  blocks: [[1328, 1423]]
}, {
  // The Brahmic scripts of South and Southeast Asia
  // Devanagari (0900–097F)
  // Bengali (0980–09FF)
  // Gurmukhi (0A00–0A7F)
  // Gujarati (0A80–0AFF)
  // Oriya (0B00–0B7F)
  // Tamil (0B80–0BFF)
  // Telugu (0C00–0C7F)
  // Kannada (0C80–0CFF)
  // Malayalam (0D00–0D7F)
  // Sinhala (0D80–0DFF)
  // Thai (0E00–0E7F)
  // Lao (0E80–0EFF)
  // Tibetan (0F00–0FFF)
  // Myanmar (1000–109F)
  name: "brahmic",
  blocks: [[2304, 4255]]
}, {
  name: "georgian",
  blocks: [[4256, 4351]]
}, {
  // Chinese and Japanese.
  // The "k" in cjk is for Korean, but we've separated Korean out
  name: "cjk",
  blocks: [
    [12288, 12543],
    // CJK symbols and punctuation, Hiragana, Katakana
    [19968, 40879],
    // CJK ideograms
    [65280, 65376]
    // Fullwidth punctuation
    // TODO: add halfwidth Katakana and Romanji glyphs
  ]
}, {
  // Korean
  name: "hangul",
  blocks: [[44032, 55215]]
}];
function scriptFromCodepoint(s) {
  for (var e = 0; e < scriptData.length; e++)
    for (var r = scriptData[e], o = 0; o < r.blocks.length; o++) {
      var m = r.blocks[o];
      if (s >= m[0] && s <= m[1])
        return r.name;
    }
  return null;
}
var allBlocks = [];
scriptData.forEach((s) => s.blocks.forEach((e) => allBlocks.push(...e)));
function supportedCodepoint(s) {
  for (var e = 0; e < allBlocks.length; e += 2)
    if (s >= allBlocks[e] && s <= allBlocks[e + 1])
      return !0;
  return !1;
}
var hLinePad = 80, sqrtMain = function(e, r) {
  return "M95," + (622 + e + r) + `
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
c69,-144,104.5,-217.7,106.5,-221
l` + e / 2.075 + " -" + e + `
c5.3,-9.3,12,-14,20,-14
H400000v` + (40 + e) + `H845.2724
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
M` + (834 + e) + " " + r + "h400000v" + (40 + e) + "h-400000z";
}, sqrtSize1 = function(e, r) {
  return "M263," + (601 + e + r) + `c0.7,0,18,39.7,52,119
c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
c340,-704.7,510.7,-1060.3,512,-1067
l` + e / 2.084 + " -" + e + `
c4.7,-7.3,11,-11,19,-11
H40000v` + (40 + e) + `H1012.3
s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232
c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1
s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26
c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z
M` + (1001 + e) + " " + r + "h400000v" + (40 + e) + "h-400000z";
}, sqrtSize2 = function(e, r) {
  return "M983 " + (10 + e + r) + `
l` + e / 3.13 + " -" + e + `
c4,-6.7,10,-10,18,-10 H400000v` + (40 + e) + `
H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744
c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
c53.7,-170.3,84.5,-266.8,92.5,-289.5z
M` + (1001 + e) + " " + r + "h400000v" + (40 + e) + "h-400000z";
}, sqrtSize3 = function(e, r) {
  return "M424," + (2398 + e + r) + `
c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514
c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20
s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121
s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081
l` + e / 4.223 + " -" + e + `c4,-6.7,10,-10,18,-10 H400000
v` + (40 + e) + `H1014.6
s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185
c-2,6,-10,9,-24,9
c-8,0,-12,-0.7,-12,-2z M` + (1001 + e) + " " + r + `
h400000v` + (40 + e) + "h-400000z";
}, sqrtSize4 = function(e, r) {
  return "M473," + (2713 + e + r) + `
c339.3,-1799.3,509.3,-2700,510,-2702 l` + e / 5.298 + " -" + e + `
c3.3,-7.3,9.3,-11,18,-11 H400000v` + (40 + e) + `H1017.7
s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9
c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200
c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26
s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,
606zM` + (1001 + e) + " " + r + "h400000v" + (40 + e) + "H1017.7z";
}, phasePath = function(e) {
  var r = e / 2;
  return "M400000 " + e + " H0 L" + r + " 0 l65 45 L145 " + (e - 80) + " H400000z";
}, sqrtTall = function(e, r, o) {
  var m = o - 54 - r - e;
  return "M702 " + (e + r) + "H400000" + (40 + e) + `
H742v` + m + `l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
219 661 l218 661zM702 ` + r + "H400000v" + (40 + e) + "H742z";
}, sqrtPath = function(e, r, o) {
  r = 1e3 * r;
  var m = "";
  switch (e) {
    case "sqrtMain":
      m = sqrtMain(r, hLinePad);
      break;
    case "sqrtSize1":
      m = sqrtSize1(r, hLinePad);
      break;
    case "sqrtSize2":
      m = sqrtSize2(r, hLinePad);
      break;
    case "sqrtSize3":
      m = sqrtSize3(r, hLinePad);
      break;
    case "sqrtSize4":
      m = sqrtSize4(r, hLinePad);
      break;
    case "sqrtTall":
      m = sqrtTall(r, hLinePad, o);
  }
  return m;
}, innerPath = function(e, r) {
  switch (e) {
    case "⎜":
      return "M291 0 H417 V" + r + " H291z M291 0 H417 V" + r + " H291z";
    case "∣":
      return "M145 0 H188 V" + r + " H145z M145 0 H188 V" + r + " H145z";
    case "∥":
      return "M145 0 H188 V" + r + " H145z M145 0 H188 V" + r + " H145z" + ("M367 0 H410 V" + r + " H367z M367 0 H410 V" + r + " H367z");
    case "⎟":
      return "M457 0 H583 V" + r + " H457z M457 0 H583 V" + r + " H457z";
    case "⎢":
      return "M319 0 H403 V" + r + " H319z M319 0 H403 V" + r + " H319z";
    case "⎥":
      return "M263 0 H347 V" + r + " H263z M263 0 H347 V" + r + " H263z";
    case "⎪":
      return "M384 0 H504 V" + r + " H384z M384 0 H504 V" + r + " H384z";
    case "⏐":
      return "M312 0 H355 V" + r + " H312z M312 0 H355 V" + r + " H312z";
    case "‖":
      return "M257 0 H300 V" + r + " H257z M257 0 H300 V" + r + " H257z" + ("M478 0 H521 V" + r + " H478z M478 0 H521 V" + r + " H478z");
    default:
      return "";
  }
}, path = {
  // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main
  doubleleftarrow: `M262 157
l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5
 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87
-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7
-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z
m8 0v40h399730v-40zm0 194v40h399730v-40z`,
  // doublerightarrow is from glyph U+21D2 in font KaTeX Main
  doublerightarrow: `M399738 392l
-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5
 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88
-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68
-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18
-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782
c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3
-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,
  // leftarrow is from glyph U+2190 in font KaTeX Main
  leftarrow: `M400000 241H110l3-3c68.7-52.7 113.7-120
 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8
-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247
c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208
 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3
 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202
 l-3-3h399890zM100 241v40h399900v-40z`,
  // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular
  leftbrace: `M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117
-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7
 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,
  leftbraceunder: `M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13
 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688
 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7
-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,
  // overgroup is from the MnSymbol package (public domain)
  leftgroup: `M400000 80
H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0
 435 0h399565z`,
  leftgroupunder: `M400000 262
H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219
 435 219h399565z`,
  // Harpoons are from glyph U+21BD in font KaTeX Main
  leftharpoon: `M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3
-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5
-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7
-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,
  leftharpoonplus: `M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5
 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3
-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7
-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z
m0 0v40h400000v-40z`,
  leftharpoondown: `M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333
 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5
 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667
-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,
  leftharpoondownplus: `M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12
 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7
-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0
v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,
  // hook is from glyph U+21A9 in font KaTeX Main
  lefthook: `M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
 71.5 23h399859zM103 281v-40h399897v40z`,
  leftlinesegment: `M40 281 V428 H0 V94 H40 V241 H400000 v40z
M40 281 V428 H0 V94 H40 V241 H400000 v40z`,
  leftmapsto: `M40 281 V448H0V74H40V241H400000v40z
M40 281 V448H0V74H40V241H400000v40z`,
  // tofrom is from glyph U+21C4 in font KaTeX AMS Regular
  leftToFrom: `M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,
  longequal: `M0 50 h400000 v40H0z m0 194h40000v40H0z
M0 50 h400000 v40H0z m0 194h40000v40H0z`,
  midbrace: `M200428 334
c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,
  midbraceunder: `M199572 214
c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14
 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3
 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0
-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,
  oiintSize1: `M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6
-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z
m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8
60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,
  oiintSize2: `M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8
-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z
m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2
c0 110 84 276 504 276s502.4-166 502.4-276z`,
  oiiintSize1: `M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6
-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z
m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0
85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,
  oiiintSize2: `M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8
-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z
m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1
c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,
  rightarrow: `M0 241v40h399891c-47.3 35.3-84 78-110 128
-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20
 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7
 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85
-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
 151.7 139 205zm0 0v40h399900v-40z`,
  rightbrace: `M400000 542l
-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5
s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1
c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,
  rightbraceunder: `M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3
 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237
-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,
  rightgroup: `M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0
 3-1 3-3v-38c-76-158-257-219-435-219H0z`,
  rightgroupunder: `M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18
 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,
  rightharpoon: `M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3
-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2
-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58
 69.2 92 94.5zm0 0v40h399900v-40z`,
  rightharpoonplus: `M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11
-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7
 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z
m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,
  rightharpoondown: `M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8
 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5
-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95
-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,
  rightharpoondownplus: `M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8
 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3
 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3
-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z
m0-194v40h400000v-40zm0 0v40h400000v-40z`,
  righthook: `M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3
 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0
-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,
  rightlinesegment: `M399960 241 V94 h40 V428 h-40 V281 H0 v-40z
M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,
  rightToFrom: `M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32
-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142
-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,
  // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular
  twoheadleftarrow: `M0 167c68 40
 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69
-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3
-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19
-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101
 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,
  twoheadrightarrow: `M400000 167
c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3
 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42
 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333
-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70
 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,
  // tilde1 is a modified version of a glyph from the MnSymbol package
  tilde1: `M200 55.538c-77 0-168 73.953-177 73.953-3 0-7
-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0
 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0
 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128
-68.267.847-113-73.952-191-73.952z`,
  // ditto tilde2, tilde3, & tilde4
  tilde2: `M344 55.266c-142 0-300.638 81.316-311.5 86.418
-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9
 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114
c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751
 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,
  tilde3: `M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457
-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0
 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697
 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696
 -338 0-409-156.573-744-156.573z`,
  tilde4: `M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345
-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409
 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9
 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409
 -175.236-744-175.236z`,
  // vec is from glyph U+20D7 in font KaTeX Main
  vec: `M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5
3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11
10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63
-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1
-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59
H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359
c-16-25.333-24-45-24-59z`,
  // widehat1 is a modified version of a glyph from the MnSymbol package
  widehat1: `M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22
c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,
  // ditto widehat2, widehat3, & widehat4
  widehat2: `M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,
  widehat3: `M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,
  widehat4: `M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,
  // widecheck paths are all inverted versions of widehat
  widecheck1: `M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,
-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,
  widecheck2: `M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,
  widecheck3: `M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,
  widecheck4: `M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,
  // The next ten paths support reaction arrows from the mhchem package.
  // Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX
  // baraboveleftarrow is mostly from glyph U+2190 in font KaTeX Main
  baraboveleftarrow: `M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202
c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5
c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130
s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47
121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6
s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11
c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z
M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,
  // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main
  rightarrowabovebar: `M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32
-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0
13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39
-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5
-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,
  // The short left harpoon has 0.5em (i.e. 500 units) kern on the left end.
  // Ref from mhchem.sty: \rlap{\raisebox{-.22ex}{$\kern0.5em
  baraboveshortleftharpoon: `M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17
c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21
c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40
c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z
M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,
  rightharpoonaboveshortbar: `M0,241 l0,40c399126,0,399993,0,399993,0
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,
  shortbaraboveleftharpoon: `M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,
1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,
-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z
M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,
  shortrightharpoonabovebar: `M53,241l0,40c398570,0,399437,0,399437,0
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`
}, tallDelim = function(e, r) {
  switch (e) {
    case "lbrack":
      return "M403 1759 V84 H666 V0 H319 V1759 v" + r + ` v1759 h347 v-84
H403z M403 1759 V0 H319 V1759 v` + r + " v1759 h84z";
    case "rbrack":
      return "M347 1759 V0 H0 V84 H263 V1759 v" + r + ` v1759 H0 v84 H347z
M347 1759 V0 H263 V1759 v` + r + " v1759 h84z";
    case "vert":
      return "M145 15 v585 v" + r + ` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v` + -r + ` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v` + r + " v585 h43z";
    case "doublevert":
      return "M145 15 v585 v" + r + ` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v` + -r + ` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v` + r + ` v585 h43z
M367 15 v585 v` + r + ` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v` + -r + ` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v` + r + " v585 h43z";
    case "lfloor":
      return "M319 602 V0 H403 V602 v" + r + ` v1715 h263 v84 H319z
MM319 602 V0 H403 V602 v` + r + " v1715 H319z";
    case "rfloor":
      return "M319 602 V0 H403 V602 v" + r + ` v1799 H0 v-84 H319z
MM319 602 V0 H403 V602 v` + r + " v1715 H319z";
    case "lceil":
      return "M403 1759 V84 H666 V0 H319 V1759 v" + r + ` v602 h84z
M403 1759 V0 H319 V1759 v` + r + " v602 h84z";
    case "rceil":
      return "M347 1759 V0 H0 V84 H263 V1759 v" + r + ` v602 h84z
M347 1759 V0 h-84 V1759 v` + r + " v602 h84z";
    case "lparen":
      return `M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1
c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,
-36,557 l0,` + (r + 84) + `c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,
949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9
c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,
-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189
l0,-` + (r + 92) + `c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,
-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;
    case "rparen":
      return `M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,
63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5
c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,` + (r + 9) + `
c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664
c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11
c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
l0,-` + (r + 144) + `c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;
    default:
      throw new Error("Unknown stretchy delimiter.");
  }
};
class DocumentFragment {
  // HtmlDomNode
  // Never used; needed for satisfying interface.
  constructor(e) {
    this.children = void 0, this.classes = void 0, this.height = void 0, this.depth = void 0, this.maxFontSize = void 0, this.style = void 0, this.children = e, this.classes = [], this.height = 0, this.depth = 0, this.maxFontSize = 0, this.style = {};
  }
  hasClass(e) {
    return utils.contains(this.classes, e);
  }
  /** Convert the fragment into a node. */
  toNode() {
    for (var e = document.createDocumentFragment(), r = 0; r < this.children.length; r++)
      e.appendChild(this.children[r].toNode());
    return e;
  }
  /** Convert the fragment into HTML markup. */
  toMarkup() {
    for (var e = "", r = 0; r < this.children.length; r++)
      e += this.children[r].toMarkup();
    return e;
  }
  /**
   * Converts the math node into a string, similar to innerText. Applies to
   * MathDomNode's only.
   */
  toText() {
    var e = (r) => r.toText();
    return this.children.map(e).join("");
  }
}
var fontMetricsData = {
  "AMS-Regular": {
    32: [0, 0, 0, 0, 0.25],
    65: [0, 0.68889, 0, 0, 0.72222],
    66: [0, 0.68889, 0, 0, 0.66667],
    67: [0, 0.68889, 0, 0, 0.72222],
    68: [0, 0.68889, 0, 0, 0.72222],
    69: [0, 0.68889, 0, 0, 0.66667],
    70: [0, 0.68889, 0, 0, 0.61111],
    71: [0, 0.68889, 0, 0, 0.77778],
    72: [0, 0.68889, 0, 0, 0.77778],
    73: [0, 0.68889, 0, 0, 0.38889],
    74: [0.16667, 0.68889, 0, 0, 0.5],
    75: [0, 0.68889, 0, 0, 0.77778],
    76: [0, 0.68889, 0, 0, 0.66667],
    77: [0, 0.68889, 0, 0, 0.94445],
    78: [0, 0.68889, 0, 0, 0.72222],
    79: [0.16667, 0.68889, 0, 0, 0.77778],
    80: [0, 0.68889, 0, 0, 0.61111],
    81: [0.16667, 0.68889, 0, 0, 0.77778],
    82: [0, 0.68889, 0, 0, 0.72222],
    83: [0, 0.68889, 0, 0, 0.55556],
    84: [0, 0.68889, 0, 0, 0.66667],
    85: [0, 0.68889, 0, 0, 0.72222],
    86: [0, 0.68889, 0, 0, 0.72222],
    87: [0, 0.68889, 0, 0, 1],
    88: [0, 0.68889, 0, 0, 0.72222],
    89: [0, 0.68889, 0, 0, 0.72222],
    90: [0, 0.68889, 0, 0, 0.66667],
    107: [0, 0.68889, 0, 0, 0.55556],
    160: [0, 0, 0, 0, 0.25],
    165: [0, 0.675, 0.025, 0, 0.75],
    174: [0.15559, 0.69224, 0, 0, 0.94666],
    240: [0, 0.68889, 0, 0, 0.55556],
    295: [0, 0.68889, 0, 0, 0.54028],
    710: [0, 0.825, 0, 0, 2.33334],
    732: [0, 0.9, 0, 0, 2.33334],
    770: [0, 0.825, 0, 0, 2.33334],
    771: [0, 0.9, 0, 0, 2.33334],
    989: [0.08167, 0.58167, 0, 0, 0.77778],
    1008: [0, 0.43056, 0.04028, 0, 0.66667],
    8245: [0, 0.54986, 0, 0, 0.275],
    8463: [0, 0.68889, 0, 0, 0.54028],
    8487: [0, 0.68889, 0, 0, 0.72222],
    8498: [0, 0.68889, 0, 0, 0.55556],
    8502: [0, 0.68889, 0, 0, 0.66667],
    8503: [0, 0.68889, 0, 0, 0.44445],
    8504: [0, 0.68889, 0, 0, 0.66667],
    8513: [0, 0.68889, 0, 0, 0.63889],
    8592: [-0.03598, 0.46402, 0, 0, 0.5],
    8594: [-0.03598, 0.46402, 0, 0, 0.5],
    8602: [-0.13313, 0.36687, 0, 0, 1],
    8603: [-0.13313, 0.36687, 0, 0, 1],
    8606: [0.01354, 0.52239, 0, 0, 1],
    8608: [0.01354, 0.52239, 0, 0, 1],
    8610: [0.01354, 0.52239, 0, 0, 1.11111],
    8611: [0.01354, 0.52239, 0, 0, 1.11111],
    8619: [0, 0.54986, 0, 0, 1],
    8620: [0, 0.54986, 0, 0, 1],
    8621: [-0.13313, 0.37788, 0, 0, 1.38889],
    8622: [-0.13313, 0.36687, 0, 0, 1],
    8624: [0, 0.69224, 0, 0, 0.5],
    8625: [0, 0.69224, 0, 0, 0.5],
    8630: [0, 0.43056, 0, 0, 1],
    8631: [0, 0.43056, 0, 0, 1],
    8634: [0.08198, 0.58198, 0, 0, 0.77778],
    8635: [0.08198, 0.58198, 0, 0, 0.77778],
    8638: [0.19444, 0.69224, 0, 0, 0.41667],
    8639: [0.19444, 0.69224, 0, 0, 0.41667],
    8642: [0.19444, 0.69224, 0, 0, 0.41667],
    8643: [0.19444, 0.69224, 0, 0, 0.41667],
    8644: [0.1808, 0.675, 0, 0, 1],
    8646: [0.1808, 0.675, 0, 0, 1],
    8647: [0.1808, 0.675, 0, 0, 1],
    8648: [0.19444, 0.69224, 0, 0, 0.83334],
    8649: [0.1808, 0.675, 0, 0, 1],
    8650: [0.19444, 0.69224, 0, 0, 0.83334],
    8651: [0.01354, 0.52239, 0, 0, 1],
    8652: [0.01354, 0.52239, 0, 0, 1],
    8653: [-0.13313, 0.36687, 0, 0, 1],
    8654: [-0.13313, 0.36687, 0, 0, 1],
    8655: [-0.13313, 0.36687, 0, 0, 1],
    8666: [0.13667, 0.63667, 0, 0, 1],
    8667: [0.13667, 0.63667, 0, 0, 1],
    8669: [-0.13313, 0.37788, 0, 0, 1],
    8672: [-0.064, 0.437, 0, 0, 1.334],
    8674: [-0.064, 0.437, 0, 0, 1.334],
    8705: [0, 0.825, 0, 0, 0.5],
    8708: [0, 0.68889, 0, 0, 0.55556],
    8709: [0.08167, 0.58167, 0, 0, 0.77778],
    8717: [0, 0.43056, 0, 0, 0.42917],
    8722: [-0.03598, 0.46402, 0, 0, 0.5],
    8724: [0.08198, 0.69224, 0, 0, 0.77778],
    8726: [0.08167, 0.58167, 0, 0, 0.77778],
    8733: [0, 0.69224, 0, 0, 0.77778],
    8736: [0, 0.69224, 0, 0, 0.72222],
    8737: [0, 0.69224, 0, 0, 0.72222],
    8738: [0.03517, 0.52239, 0, 0, 0.72222],
    8739: [0.08167, 0.58167, 0, 0, 0.22222],
    8740: [0.25142, 0.74111, 0, 0, 0.27778],
    8741: [0.08167, 0.58167, 0, 0, 0.38889],
    8742: [0.25142, 0.74111, 0, 0, 0.5],
    8756: [0, 0.69224, 0, 0, 0.66667],
    8757: [0, 0.69224, 0, 0, 0.66667],
    8764: [-0.13313, 0.36687, 0, 0, 0.77778],
    8765: [-0.13313, 0.37788, 0, 0, 0.77778],
    8769: [-0.13313, 0.36687, 0, 0, 0.77778],
    8770: [-0.03625, 0.46375, 0, 0, 0.77778],
    8774: [0.30274, 0.79383, 0, 0, 0.77778],
    8776: [-0.01688, 0.48312, 0, 0, 0.77778],
    8778: [0.08167, 0.58167, 0, 0, 0.77778],
    8782: [0.06062, 0.54986, 0, 0, 0.77778],
    8783: [0.06062, 0.54986, 0, 0, 0.77778],
    8785: [0.08198, 0.58198, 0, 0, 0.77778],
    8786: [0.08198, 0.58198, 0, 0, 0.77778],
    8787: [0.08198, 0.58198, 0, 0, 0.77778],
    8790: [0, 0.69224, 0, 0, 0.77778],
    8791: [0.22958, 0.72958, 0, 0, 0.77778],
    8796: [0.08198, 0.91667, 0, 0, 0.77778],
    8806: [0.25583, 0.75583, 0, 0, 0.77778],
    8807: [0.25583, 0.75583, 0, 0, 0.77778],
    8808: [0.25142, 0.75726, 0, 0, 0.77778],
    8809: [0.25142, 0.75726, 0, 0, 0.77778],
    8812: [0.25583, 0.75583, 0, 0, 0.5],
    8814: [0.20576, 0.70576, 0, 0, 0.77778],
    8815: [0.20576, 0.70576, 0, 0, 0.77778],
    8816: [0.30274, 0.79383, 0, 0, 0.77778],
    8817: [0.30274, 0.79383, 0, 0, 0.77778],
    8818: [0.22958, 0.72958, 0, 0, 0.77778],
    8819: [0.22958, 0.72958, 0, 0, 0.77778],
    8822: [0.1808, 0.675, 0, 0, 0.77778],
    8823: [0.1808, 0.675, 0, 0, 0.77778],
    8828: [0.13667, 0.63667, 0, 0, 0.77778],
    8829: [0.13667, 0.63667, 0, 0, 0.77778],
    8830: [0.22958, 0.72958, 0, 0, 0.77778],
    8831: [0.22958, 0.72958, 0, 0, 0.77778],
    8832: [0.20576, 0.70576, 0, 0, 0.77778],
    8833: [0.20576, 0.70576, 0, 0, 0.77778],
    8840: [0.30274, 0.79383, 0, 0, 0.77778],
    8841: [0.30274, 0.79383, 0, 0, 0.77778],
    8842: [0.13597, 0.63597, 0, 0, 0.77778],
    8843: [0.13597, 0.63597, 0, 0, 0.77778],
    8847: [0.03517, 0.54986, 0, 0, 0.77778],
    8848: [0.03517, 0.54986, 0, 0, 0.77778],
    8858: [0.08198, 0.58198, 0, 0, 0.77778],
    8859: [0.08198, 0.58198, 0, 0, 0.77778],
    8861: [0.08198, 0.58198, 0, 0, 0.77778],
    8862: [0, 0.675, 0, 0, 0.77778],
    8863: [0, 0.675, 0, 0, 0.77778],
    8864: [0, 0.675, 0, 0, 0.77778],
    8865: [0, 0.675, 0, 0, 0.77778],
    8872: [0, 0.69224, 0, 0, 0.61111],
    8873: [0, 0.69224, 0, 0, 0.72222],
    8874: [0, 0.69224, 0, 0, 0.88889],
    8876: [0, 0.68889, 0, 0, 0.61111],
    8877: [0, 0.68889, 0, 0, 0.61111],
    8878: [0, 0.68889, 0, 0, 0.72222],
    8879: [0, 0.68889, 0, 0, 0.72222],
    8882: [0.03517, 0.54986, 0, 0, 0.77778],
    8883: [0.03517, 0.54986, 0, 0, 0.77778],
    8884: [0.13667, 0.63667, 0, 0, 0.77778],
    8885: [0.13667, 0.63667, 0, 0, 0.77778],
    8888: [0, 0.54986, 0, 0, 1.11111],
    8890: [0.19444, 0.43056, 0, 0, 0.55556],
    8891: [0.19444, 0.69224, 0, 0, 0.61111],
    8892: [0.19444, 0.69224, 0, 0, 0.61111],
    8901: [0, 0.54986, 0, 0, 0.27778],
    8903: [0.08167, 0.58167, 0, 0, 0.77778],
    8905: [0.08167, 0.58167, 0, 0, 0.77778],
    8906: [0.08167, 0.58167, 0, 0, 0.77778],
    8907: [0, 0.69224, 0, 0, 0.77778],
    8908: [0, 0.69224, 0, 0, 0.77778],
    8909: [-0.03598, 0.46402, 0, 0, 0.77778],
    8910: [0, 0.54986, 0, 0, 0.76042],
    8911: [0, 0.54986, 0, 0, 0.76042],
    8912: [0.03517, 0.54986, 0, 0, 0.77778],
    8913: [0.03517, 0.54986, 0, 0, 0.77778],
    8914: [0, 0.54986, 0, 0, 0.66667],
    8915: [0, 0.54986, 0, 0, 0.66667],
    8916: [0, 0.69224, 0, 0, 0.66667],
    8918: [0.0391, 0.5391, 0, 0, 0.77778],
    8919: [0.0391, 0.5391, 0, 0, 0.77778],
    8920: [0.03517, 0.54986, 0, 0, 1.33334],
    8921: [0.03517, 0.54986, 0, 0, 1.33334],
    8922: [0.38569, 0.88569, 0, 0, 0.77778],
    8923: [0.38569, 0.88569, 0, 0, 0.77778],
    8926: [0.13667, 0.63667, 0, 0, 0.77778],
    8927: [0.13667, 0.63667, 0, 0, 0.77778],
    8928: [0.30274, 0.79383, 0, 0, 0.77778],
    8929: [0.30274, 0.79383, 0, 0, 0.77778],
    8934: [0.23222, 0.74111, 0, 0, 0.77778],
    8935: [0.23222, 0.74111, 0, 0, 0.77778],
    8936: [0.23222, 0.74111, 0, 0, 0.77778],
    8937: [0.23222, 0.74111, 0, 0, 0.77778],
    8938: [0.20576, 0.70576, 0, 0, 0.77778],
    8939: [0.20576, 0.70576, 0, 0, 0.77778],
    8940: [0.30274, 0.79383, 0, 0, 0.77778],
    8941: [0.30274, 0.79383, 0, 0, 0.77778],
    8994: [0.19444, 0.69224, 0, 0, 0.77778],
    8995: [0.19444, 0.69224, 0, 0, 0.77778],
    9416: [0.15559, 0.69224, 0, 0, 0.90222],
    9484: [0, 0.69224, 0, 0, 0.5],
    9488: [0, 0.69224, 0, 0, 0.5],
    9492: [0, 0.37788, 0, 0, 0.5],
    9496: [0, 0.37788, 0, 0, 0.5],
    9585: [0.19444, 0.68889, 0, 0, 0.88889],
    9586: [0.19444, 0.74111, 0, 0, 0.88889],
    9632: [0, 0.675, 0, 0, 0.77778],
    9633: [0, 0.675, 0, 0, 0.77778],
    9650: [0, 0.54986, 0, 0, 0.72222],
    9651: [0, 0.54986, 0, 0, 0.72222],
    9654: [0.03517, 0.54986, 0, 0, 0.77778],
    9660: [0, 0.54986, 0, 0, 0.72222],
    9661: [0, 0.54986, 0, 0, 0.72222],
    9664: [0.03517, 0.54986, 0, 0, 0.77778],
    9674: [0.11111, 0.69224, 0, 0, 0.66667],
    9733: [0.19444, 0.69224, 0, 0, 0.94445],
    10003: [0, 0.69224, 0, 0, 0.83334],
    10016: [0, 0.69224, 0, 0, 0.83334],
    10731: [0.11111, 0.69224, 0, 0, 0.66667],
    10846: [0.19444, 0.75583, 0, 0, 0.61111],
    10877: [0.13667, 0.63667, 0, 0, 0.77778],
    10878: [0.13667, 0.63667, 0, 0, 0.77778],
    10885: [0.25583, 0.75583, 0, 0, 0.77778],
    10886: [0.25583, 0.75583, 0, 0, 0.77778],
    10887: [0.13597, 0.63597, 0, 0, 0.77778],
    10888: [0.13597, 0.63597, 0, 0, 0.77778],
    10889: [0.26167, 0.75726, 0, 0, 0.77778],
    10890: [0.26167, 0.75726, 0, 0, 0.77778],
    10891: [0.48256, 0.98256, 0, 0, 0.77778],
    10892: [0.48256, 0.98256, 0, 0, 0.77778],
    10901: [0.13667, 0.63667, 0, 0, 0.77778],
    10902: [0.13667, 0.63667, 0, 0, 0.77778],
    10933: [0.25142, 0.75726, 0, 0, 0.77778],
    10934: [0.25142, 0.75726, 0, 0, 0.77778],
    10935: [0.26167, 0.75726, 0, 0, 0.77778],
    10936: [0.26167, 0.75726, 0, 0, 0.77778],
    10937: [0.26167, 0.75726, 0, 0, 0.77778],
    10938: [0.26167, 0.75726, 0, 0, 0.77778],
    10949: [0.25583, 0.75583, 0, 0, 0.77778],
    10950: [0.25583, 0.75583, 0, 0, 0.77778],
    10955: [0.28481, 0.79383, 0, 0, 0.77778],
    10956: [0.28481, 0.79383, 0, 0, 0.77778],
    57350: [0.08167, 0.58167, 0, 0, 0.22222],
    57351: [0.08167, 0.58167, 0, 0, 0.38889],
    57352: [0.08167, 0.58167, 0, 0, 0.77778],
    57353: [0, 0.43056, 0.04028, 0, 0.66667],
    57356: [0.25142, 0.75726, 0, 0, 0.77778],
    57357: [0.25142, 0.75726, 0, 0, 0.77778],
    57358: [0.41951, 0.91951, 0, 0, 0.77778],
    57359: [0.30274, 0.79383, 0, 0, 0.77778],
    57360: [0.30274, 0.79383, 0, 0, 0.77778],
    57361: [0.41951, 0.91951, 0, 0, 0.77778],
    57366: [0.25142, 0.75726, 0, 0, 0.77778],
    57367: [0.25142, 0.75726, 0, 0, 0.77778],
    57368: [0.25142, 0.75726, 0, 0, 0.77778],
    57369: [0.25142, 0.75726, 0, 0, 0.77778],
    57370: [0.13597, 0.63597, 0, 0, 0.77778],
    57371: [0.13597, 0.63597, 0, 0, 0.77778]
  },
  "Caligraphic-Regular": {
    32: [0, 0, 0, 0, 0.25],
    65: [0, 0.68333, 0, 0.19445, 0.79847],
    66: [0, 0.68333, 0.03041, 0.13889, 0.65681],
    67: [0, 0.68333, 0.05834, 0.13889, 0.52653],
    68: [0, 0.68333, 0.02778, 0.08334, 0.77139],
    69: [0, 0.68333, 0.08944, 0.11111, 0.52778],
    70: [0, 0.68333, 0.09931, 0.11111, 0.71875],
    71: [0.09722, 0.68333, 0.0593, 0.11111, 0.59487],
    72: [0, 0.68333, 965e-5, 0.11111, 0.84452],
    73: [0, 0.68333, 0.07382, 0, 0.54452],
    74: [0.09722, 0.68333, 0.18472, 0.16667, 0.67778],
    75: [0, 0.68333, 0.01445, 0.05556, 0.76195],
    76: [0, 0.68333, 0, 0.13889, 0.68972],
    77: [0, 0.68333, 0, 0.13889, 1.2009],
    78: [0, 0.68333, 0.14736, 0.08334, 0.82049],
    79: [0, 0.68333, 0.02778, 0.11111, 0.79611],
    80: [0, 0.68333, 0.08222, 0.08334, 0.69556],
    81: [0.09722, 0.68333, 0, 0.11111, 0.81667],
    82: [0, 0.68333, 0, 0.08334, 0.8475],
    83: [0, 0.68333, 0.075, 0.13889, 0.60556],
    84: [0, 0.68333, 0.25417, 0, 0.54464],
    85: [0, 0.68333, 0.09931, 0.08334, 0.62583],
    86: [0, 0.68333, 0.08222, 0, 0.61278],
    87: [0, 0.68333, 0.08222, 0.08334, 0.98778],
    88: [0, 0.68333, 0.14643, 0.13889, 0.7133],
    89: [0.09722, 0.68333, 0.08222, 0.08334, 0.66834],
    90: [0, 0.68333, 0.07944, 0.13889, 0.72473],
    160: [0, 0, 0, 0, 0.25]
  },
  "Fraktur-Regular": {
    32: [0, 0, 0, 0, 0.25],
    33: [0, 0.69141, 0, 0, 0.29574],
    34: [0, 0.69141, 0, 0, 0.21471],
    38: [0, 0.69141, 0, 0, 0.73786],
    39: [0, 0.69141, 0, 0, 0.21201],
    40: [0.24982, 0.74947, 0, 0, 0.38865],
    41: [0.24982, 0.74947, 0, 0, 0.38865],
    42: [0, 0.62119, 0, 0, 0.27764],
    43: [0.08319, 0.58283, 0, 0, 0.75623],
    44: [0, 0.10803, 0, 0, 0.27764],
    45: [0.08319, 0.58283, 0, 0, 0.75623],
    46: [0, 0.10803, 0, 0, 0.27764],
    47: [0.24982, 0.74947, 0, 0, 0.50181],
    48: [0, 0.47534, 0, 0, 0.50181],
    49: [0, 0.47534, 0, 0, 0.50181],
    50: [0, 0.47534, 0, 0, 0.50181],
    51: [0.18906, 0.47534, 0, 0, 0.50181],
    52: [0.18906, 0.47534, 0, 0, 0.50181],
    53: [0.18906, 0.47534, 0, 0, 0.50181],
    54: [0, 0.69141, 0, 0, 0.50181],
    55: [0.18906, 0.47534, 0, 0, 0.50181],
    56: [0, 0.69141, 0, 0, 0.50181],
    57: [0.18906, 0.47534, 0, 0, 0.50181],
    58: [0, 0.47534, 0, 0, 0.21606],
    59: [0.12604, 0.47534, 0, 0, 0.21606],
    61: [-0.13099, 0.36866, 0, 0, 0.75623],
    63: [0, 0.69141, 0, 0, 0.36245],
    65: [0, 0.69141, 0, 0, 0.7176],
    66: [0, 0.69141, 0, 0, 0.88397],
    67: [0, 0.69141, 0, 0, 0.61254],
    68: [0, 0.69141, 0, 0, 0.83158],
    69: [0, 0.69141, 0, 0, 0.66278],
    70: [0.12604, 0.69141, 0, 0, 0.61119],
    71: [0, 0.69141, 0, 0, 0.78539],
    72: [0.06302, 0.69141, 0, 0, 0.7203],
    73: [0, 0.69141, 0, 0, 0.55448],
    74: [0.12604, 0.69141, 0, 0, 0.55231],
    75: [0, 0.69141, 0, 0, 0.66845],
    76: [0, 0.69141, 0, 0, 0.66602],
    77: [0, 0.69141, 0, 0, 1.04953],
    78: [0, 0.69141, 0, 0, 0.83212],
    79: [0, 0.69141, 0, 0, 0.82699],
    80: [0.18906, 0.69141, 0, 0, 0.82753],
    81: [0.03781, 0.69141, 0, 0, 0.82699],
    82: [0, 0.69141, 0, 0, 0.82807],
    83: [0, 0.69141, 0, 0, 0.82861],
    84: [0, 0.69141, 0, 0, 0.66899],
    85: [0, 0.69141, 0, 0, 0.64576],
    86: [0, 0.69141, 0, 0, 0.83131],
    87: [0, 0.69141, 0, 0, 1.04602],
    88: [0, 0.69141, 0, 0, 0.71922],
    89: [0.18906, 0.69141, 0, 0, 0.83293],
    90: [0.12604, 0.69141, 0, 0, 0.60201],
    91: [0.24982, 0.74947, 0, 0, 0.27764],
    93: [0.24982, 0.74947, 0, 0, 0.27764],
    94: [0, 0.69141, 0, 0, 0.49965],
    97: [0, 0.47534, 0, 0, 0.50046],
    98: [0, 0.69141, 0, 0, 0.51315],
    99: [0, 0.47534, 0, 0, 0.38946],
    100: [0, 0.62119, 0, 0, 0.49857],
    101: [0, 0.47534, 0, 0, 0.40053],
    102: [0.18906, 0.69141, 0, 0, 0.32626],
    103: [0.18906, 0.47534, 0, 0, 0.5037],
    104: [0.18906, 0.69141, 0, 0, 0.52126],
    105: [0, 0.69141, 0, 0, 0.27899],
    106: [0, 0.69141, 0, 0, 0.28088],
    107: [0, 0.69141, 0, 0, 0.38946],
    108: [0, 0.69141, 0, 0, 0.27953],
    109: [0, 0.47534, 0, 0, 0.76676],
    110: [0, 0.47534, 0, 0, 0.52666],
    111: [0, 0.47534, 0, 0, 0.48885],
    112: [0.18906, 0.52396, 0, 0, 0.50046],
    113: [0.18906, 0.47534, 0, 0, 0.48912],
    114: [0, 0.47534, 0, 0, 0.38919],
    115: [0, 0.47534, 0, 0, 0.44266],
    116: [0, 0.62119, 0, 0, 0.33301],
    117: [0, 0.47534, 0, 0, 0.5172],
    118: [0, 0.52396, 0, 0, 0.5118],
    119: [0, 0.52396, 0, 0, 0.77351],
    120: [0.18906, 0.47534, 0, 0, 0.38865],
    121: [0.18906, 0.47534, 0, 0, 0.49884],
    122: [0.18906, 0.47534, 0, 0, 0.39054],
    160: [0, 0, 0, 0, 0.25],
    8216: [0, 0.69141, 0, 0, 0.21471],
    8217: [0, 0.69141, 0, 0, 0.21471],
    58112: [0, 0.62119, 0, 0, 0.49749],
    58113: [0, 0.62119, 0, 0, 0.4983],
    58114: [0.18906, 0.69141, 0, 0, 0.33328],
    58115: [0.18906, 0.69141, 0, 0, 0.32923],
    58116: [0.18906, 0.47534, 0, 0, 0.50343],
    58117: [0, 0.69141, 0, 0, 0.33301],
    58118: [0, 0.62119, 0, 0, 0.33409],
    58119: [0, 0.47534, 0, 0, 0.50073]
  },
  "Main-Bold": {
    32: [0, 0, 0, 0, 0.25],
    33: [0, 0.69444, 0, 0, 0.35],
    34: [0, 0.69444, 0, 0, 0.60278],
    35: [0.19444, 0.69444, 0, 0, 0.95833],
    36: [0.05556, 0.75, 0, 0, 0.575],
    37: [0.05556, 0.75, 0, 0, 0.95833],
    38: [0, 0.69444, 0, 0, 0.89444],
    39: [0, 0.69444, 0, 0, 0.31944],
    40: [0.25, 0.75, 0, 0, 0.44722],
    41: [0.25, 0.75, 0, 0, 0.44722],
    42: [0, 0.75, 0, 0, 0.575],
    43: [0.13333, 0.63333, 0, 0, 0.89444],
    44: [0.19444, 0.15556, 0, 0, 0.31944],
    45: [0, 0.44444, 0, 0, 0.38333],
    46: [0, 0.15556, 0, 0, 0.31944],
    47: [0.25, 0.75, 0, 0, 0.575],
    48: [0, 0.64444, 0, 0, 0.575],
    49: [0, 0.64444, 0, 0, 0.575],
    50: [0, 0.64444, 0, 0, 0.575],
    51: [0, 0.64444, 0, 0, 0.575],
    52: [0, 0.64444, 0, 0, 0.575],
    53: [0, 0.64444, 0, 0, 0.575],
    54: [0, 0.64444, 0, 0, 0.575],
    55: [0, 0.64444, 0, 0, 0.575],
    56: [0, 0.64444, 0, 0, 0.575],
    57: [0, 0.64444, 0, 0, 0.575],
    58: [0, 0.44444, 0, 0, 0.31944],
    59: [0.19444, 0.44444, 0, 0, 0.31944],
    60: [0.08556, 0.58556, 0, 0, 0.89444],
    61: [-0.10889, 0.39111, 0, 0, 0.89444],
    62: [0.08556, 0.58556, 0, 0, 0.89444],
    63: [0, 0.69444, 0, 0, 0.54305],
    64: [0, 0.69444, 0, 0, 0.89444],
    65: [0, 0.68611, 0, 0, 0.86944],
    66: [0, 0.68611, 0, 0, 0.81805],
    67: [0, 0.68611, 0, 0, 0.83055],
    68: [0, 0.68611, 0, 0, 0.88194],
    69: [0, 0.68611, 0, 0, 0.75555],
    70: [0, 0.68611, 0, 0, 0.72361],
    71: [0, 0.68611, 0, 0, 0.90416],
    72: [0, 0.68611, 0, 0, 0.9],
    73: [0, 0.68611, 0, 0, 0.43611],
    74: [0, 0.68611, 0, 0, 0.59444],
    75: [0, 0.68611, 0, 0, 0.90138],
    76: [0, 0.68611, 0, 0, 0.69166],
    77: [0, 0.68611, 0, 0, 1.09166],
    78: [0, 0.68611, 0, 0, 0.9],
    79: [0, 0.68611, 0, 0, 0.86388],
    80: [0, 0.68611, 0, 0, 0.78611],
    81: [0.19444, 0.68611, 0, 0, 0.86388],
    82: [0, 0.68611, 0, 0, 0.8625],
    83: [0, 0.68611, 0, 0, 0.63889],
    84: [0, 0.68611, 0, 0, 0.8],
    85: [0, 0.68611, 0, 0, 0.88472],
    86: [0, 0.68611, 0.01597, 0, 0.86944],
    87: [0, 0.68611, 0.01597, 0, 1.18888],
    88: [0, 0.68611, 0, 0, 0.86944],
    89: [0, 0.68611, 0.02875, 0, 0.86944],
    90: [0, 0.68611, 0, 0, 0.70277],
    91: [0.25, 0.75, 0, 0, 0.31944],
    92: [0.25, 0.75, 0, 0, 0.575],
    93: [0.25, 0.75, 0, 0, 0.31944],
    94: [0, 0.69444, 0, 0, 0.575],
    95: [0.31, 0.13444, 0.03194, 0, 0.575],
    97: [0, 0.44444, 0, 0, 0.55902],
    98: [0, 0.69444, 0, 0, 0.63889],
    99: [0, 0.44444, 0, 0, 0.51111],
    100: [0, 0.69444, 0, 0, 0.63889],
    101: [0, 0.44444, 0, 0, 0.52708],
    102: [0, 0.69444, 0.10903, 0, 0.35139],
    103: [0.19444, 0.44444, 0.01597, 0, 0.575],
    104: [0, 0.69444, 0, 0, 0.63889],
    105: [0, 0.69444, 0, 0, 0.31944],
    106: [0.19444, 0.69444, 0, 0, 0.35139],
    107: [0, 0.69444, 0, 0, 0.60694],
    108: [0, 0.69444, 0, 0, 0.31944],
    109: [0, 0.44444, 0, 0, 0.95833],
    110: [0, 0.44444, 0, 0, 0.63889],
    111: [0, 0.44444, 0, 0, 0.575],
    112: [0.19444, 0.44444, 0, 0, 0.63889],
    113: [0.19444, 0.44444, 0, 0, 0.60694],
    114: [0, 0.44444, 0, 0, 0.47361],
    115: [0, 0.44444, 0, 0, 0.45361],
    116: [0, 0.63492, 0, 0, 0.44722],
    117: [0, 0.44444, 0, 0, 0.63889],
    118: [0, 0.44444, 0.01597, 0, 0.60694],
    119: [0, 0.44444, 0.01597, 0, 0.83055],
    120: [0, 0.44444, 0, 0, 0.60694],
    121: [0.19444, 0.44444, 0.01597, 0, 0.60694],
    122: [0, 0.44444, 0, 0, 0.51111],
    123: [0.25, 0.75, 0, 0, 0.575],
    124: [0.25, 0.75, 0, 0, 0.31944],
    125: [0.25, 0.75, 0, 0, 0.575],
    126: [0.35, 0.34444, 0, 0, 0.575],
    160: [0, 0, 0, 0, 0.25],
    163: [0, 0.69444, 0, 0, 0.86853],
    168: [0, 0.69444, 0, 0, 0.575],
    172: [0, 0.44444, 0, 0, 0.76666],
    176: [0, 0.69444, 0, 0, 0.86944],
    177: [0.13333, 0.63333, 0, 0, 0.89444],
    184: [0.17014, 0, 0, 0, 0.51111],
    198: [0, 0.68611, 0, 0, 1.04166],
    215: [0.13333, 0.63333, 0, 0, 0.89444],
    216: [0.04861, 0.73472, 0, 0, 0.89444],
    223: [0, 0.69444, 0, 0, 0.59722],
    230: [0, 0.44444, 0, 0, 0.83055],
    247: [0.13333, 0.63333, 0, 0, 0.89444],
    248: [0.09722, 0.54167, 0, 0, 0.575],
    305: [0, 0.44444, 0, 0, 0.31944],
    338: [0, 0.68611, 0, 0, 1.16944],
    339: [0, 0.44444, 0, 0, 0.89444],
    567: [0.19444, 0.44444, 0, 0, 0.35139],
    710: [0, 0.69444, 0, 0, 0.575],
    711: [0, 0.63194, 0, 0, 0.575],
    713: [0, 0.59611, 0, 0, 0.575],
    714: [0, 0.69444, 0, 0, 0.575],
    715: [0, 0.69444, 0, 0, 0.575],
    728: [0, 0.69444, 0, 0, 0.575],
    729: [0, 0.69444, 0, 0, 0.31944],
    730: [0, 0.69444, 0, 0, 0.86944],
    732: [0, 0.69444, 0, 0, 0.575],
    733: [0, 0.69444, 0, 0, 0.575],
    915: [0, 0.68611, 0, 0, 0.69166],
    916: [0, 0.68611, 0, 0, 0.95833],
    920: [0, 0.68611, 0, 0, 0.89444],
    923: [0, 0.68611, 0, 0, 0.80555],
    926: [0, 0.68611, 0, 0, 0.76666],
    928: [0, 0.68611, 0, 0, 0.9],
    931: [0, 0.68611, 0, 0, 0.83055],
    933: [0, 0.68611, 0, 0, 0.89444],
    934: [0, 0.68611, 0, 0, 0.83055],
    936: [0, 0.68611, 0, 0, 0.89444],
    937: [0, 0.68611, 0, 0, 0.83055],
    8211: [0, 0.44444, 0.03194, 0, 0.575],
    8212: [0, 0.44444, 0.03194, 0, 1.14999],
    8216: [0, 0.69444, 0, 0, 0.31944],
    8217: [0, 0.69444, 0, 0, 0.31944],
    8220: [0, 0.69444, 0, 0, 0.60278],
    8221: [0, 0.69444, 0, 0, 0.60278],
    8224: [0.19444, 0.69444, 0, 0, 0.51111],
    8225: [0.19444, 0.69444, 0, 0, 0.51111],
    8242: [0, 0.55556, 0, 0, 0.34444],
    8407: [0, 0.72444, 0.15486, 0, 0.575],
    8463: [0, 0.69444, 0, 0, 0.66759],
    8465: [0, 0.69444, 0, 0, 0.83055],
    8467: [0, 0.69444, 0, 0, 0.47361],
    8472: [0.19444, 0.44444, 0, 0, 0.74027],
    8476: [0, 0.69444, 0, 0, 0.83055],
    8501: [0, 0.69444, 0, 0, 0.70277],
    8592: [-0.10889, 0.39111, 0, 0, 1.14999],
    8593: [0.19444, 0.69444, 0, 0, 0.575],
    8594: [-0.10889, 0.39111, 0, 0, 1.14999],
    8595: [0.19444, 0.69444, 0, 0, 0.575],
    8596: [-0.10889, 0.39111, 0, 0, 1.14999],
    8597: [0.25, 0.75, 0, 0, 0.575],
    8598: [0.19444, 0.69444, 0, 0, 1.14999],
    8599: [0.19444, 0.69444, 0, 0, 1.14999],
    8600: [0.19444, 0.69444, 0, 0, 1.14999],
    8601: [0.19444, 0.69444, 0, 0, 1.14999],
    8636: [-0.10889, 0.39111, 0, 0, 1.14999],
    8637: [-0.10889, 0.39111, 0, 0, 1.14999],
    8640: [-0.10889, 0.39111, 0, 0, 1.14999],
    8641: [-0.10889, 0.39111, 0, 0, 1.14999],
    8656: [-0.10889, 0.39111, 0, 0, 1.14999],
    8657: [0.19444, 0.69444, 0, 0, 0.70277],
    8658: [-0.10889, 0.39111, 0, 0, 1.14999],
    8659: [0.19444, 0.69444, 0, 0, 0.70277],
    8660: [-0.10889, 0.39111, 0, 0, 1.14999],
    8661: [0.25, 0.75, 0, 0, 0.70277],
    8704: [0, 0.69444, 0, 0, 0.63889],
    8706: [0, 0.69444, 0.06389, 0, 0.62847],
    8707: [0, 0.69444, 0, 0, 0.63889],
    8709: [0.05556, 0.75, 0, 0, 0.575],
    8711: [0, 0.68611, 0, 0, 0.95833],
    8712: [0.08556, 0.58556, 0, 0, 0.76666],
    8715: [0.08556, 0.58556, 0, 0, 0.76666],
    8722: [0.13333, 0.63333, 0, 0, 0.89444],
    8723: [0.13333, 0.63333, 0, 0, 0.89444],
    8725: [0.25, 0.75, 0, 0, 0.575],
    8726: [0.25, 0.75, 0, 0, 0.575],
    8727: [-0.02778, 0.47222, 0, 0, 0.575],
    8728: [-0.02639, 0.47361, 0, 0, 0.575],
    8729: [-0.02639, 0.47361, 0, 0, 0.575],
    8730: [0.18, 0.82, 0, 0, 0.95833],
    8733: [0, 0.44444, 0, 0, 0.89444],
    8734: [0, 0.44444, 0, 0, 1.14999],
    8736: [0, 0.69224, 0, 0, 0.72222],
    8739: [0.25, 0.75, 0, 0, 0.31944],
    8741: [0.25, 0.75, 0, 0, 0.575],
    8743: [0, 0.55556, 0, 0, 0.76666],
    8744: [0, 0.55556, 0, 0, 0.76666],
    8745: [0, 0.55556, 0, 0, 0.76666],
    8746: [0, 0.55556, 0, 0, 0.76666],
    8747: [0.19444, 0.69444, 0.12778, 0, 0.56875],
    8764: [-0.10889, 0.39111, 0, 0, 0.89444],
    8768: [0.19444, 0.69444, 0, 0, 0.31944],
    8771: [222e-5, 0.50222, 0, 0, 0.89444],
    8773: [0.027, 0.638, 0, 0, 0.894],
    8776: [0.02444, 0.52444, 0, 0, 0.89444],
    8781: [222e-5, 0.50222, 0, 0, 0.89444],
    8801: [222e-5, 0.50222, 0, 0, 0.89444],
    8804: [0.19667, 0.69667, 0, 0, 0.89444],
    8805: [0.19667, 0.69667, 0, 0, 0.89444],
    8810: [0.08556, 0.58556, 0, 0, 1.14999],
    8811: [0.08556, 0.58556, 0, 0, 1.14999],
    8826: [0.08556, 0.58556, 0, 0, 0.89444],
    8827: [0.08556, 0.58556, 0, 0, 0.89444],
    8834: [0.08556, 0.58556, 0, 0, 0.89444],
    8835: [0.08556, 0.58556, 0, 0, 0.89444],
    8838: [0.19667, 0.69667, 0, 0, 0.89444],
    8839: [0.19667, 0.69667, 0, 0, 0.89444],
    8846: [0, 0.55556, 0, 0, 0.76666],
    8849: [0.19667, 0.69667, 0, 0, 0.89444],
    8850: [0.19667, 0.69667, 0, 0, 0.89444],
    8851: [0, 0.55556, 0, 0, 0.76666],
    8852: [0, 0.55556, 0, 0, 0.76666],
    8853: [0.13333, 0.63333, 0, 0, 0.89444],
    8854: [0.13333, 0.63333, 0, 0, 0.89444],
    8855: [0.13333, 0.63333, 0, 0, 0.89444],
    8856: [0.13333, 0.63333, 0, 0, 0.89444],
    8857: [0.13333, 0.63333, 0, 0, 0.89444],
    8866: [0, 0.69444, 0, 0, 0.70277],
    8867: [0, 0.69444, 0, 0, 0.70277],
    8868: [0, 0.69444, 0, 0, 0.89444],
    8869: [0, 0.69444, 0, 0, 0.89444],
    8900: [-0.02639, 0.47361, 0, 0, 0.575],
    8901: [-0.02639, 0.47361, 0, 0, 0.31944],
    8902: [-0.02778, 0.47222, 0, 0, 0.575],
    8968: [0.25, 0.75, 0, 0, 0.51111],
    8969: [0.25, 0.75, 0, 0, 0.51111],
    8970: [0.25, 0.75, 0, 0, 0.51111],
    8971: [0.25, 0.75, 0, 0, 0.51111],
    8994: [-0.13889, 0.36111, 0, 0, 1.14999],
    8995: [-0.13889, 0.36111, 0, 0, 1.14999],
    9651: [0.19444, 0.69444, 0, 0, 1.02222],
    9657: [-0.02778, 0.47222, 0, 0, 0.575],
    9661: [0.19444, 0.69444, 0, 0, 1.02222],
    9667: [-0.02778, 0.47222, 0, 0, 0.575],
    9711: [0.19444, 0.69444, 0, 0, 1.14999],
    9824: [0.12963, 0.69444, 0, 0, 0.89444],
    9825: [0.12963, 0.69444, 0, 0, 0.89444],
    9826: [0.12963, 0.69444, 0, 0, 0.89444],
    9827: [0.12963, 0.69444, 0, 0, 0.89444],
    9837: [0, 0.75, 0, 0, 0.44722],
    9838: [0.19444, 0.69444, 0, 0, 0.44722],
    9839: [0.19444, 0.69444, 0, 0, 0.44722],
    10216: [0.25, 0.75, 0, 0, 0.44722],
    10217: [0.25, 0.75, 0, 0, 0.44722],
    10815: [0, 0.68611, 0, 0, 0.9],
    10927: [0.19667, 0.69667, 0, 0, 0.89444],
    10928: [0.19667, 0.69667, 0, 0, 0.89444],
    57376: [0.19444, 0.69444, 0, 0, 0]
  },
  "Main-BoldItalic": {
    32: [0, 0, 0, 0, 0.25],
    33: [0, 0.69444, 0.11417, 0, 0.38611],
    34: [0, 0.69444, 0.07939, 0, 0.62055],
    35: [0.19444, 0.69444, 0.06833, 0, 0.94444],
    37: [0.05556, 0.75, 0.12861, 0, 0.94444],
    38: [0, 0.69444, 0.08528, 0, 0.88555],
    39: [0, 0.69444, 0.12945, 0, 0.35555],
    40: [0.25, 0.75, 0.15806, 0, 0.47333],
    41: [0.25, 0.75, 0.03306, 0, 0.47333],
    42: [0, 0.75, 0.14333, 0, 0.59111],
    43: [0.10333, 0.60333, 0.03306, 0, 0.88555],
    44: [0.19444, 0.14722, 0, 0, 0.35555],
    45: [0, 0.44444, 0.02611, 0, 0.41444],
    46: [0, 0.14722, 0, 0, 0.35555],
    47: [0.25, 0.75, 0.15806, 0, 0.59111],
    48: [0, 0.64444, 0.13167, 0, 0.59111],
    49: [0, 0.64444, 0.13167, 0, 0.59111],
    50: [0, 0.64444, 0.13167, 0, 0.59111],
    51: [0, 0.64444, 0.13167, 0, 0.59111],
    52: [0.19444, 0.64444, 0.13167, 0, 0.59111],
    53: [0, 0.64444, 0.13167, 0, 0.59111],
    54: [0, 0.64444, 0.13167, 0, 0.59111],
    55: [0.19444, 0.64444, 0.13167, 0, 0.59111],
    56: [0, 0.64444, 0.13167, 0, 0.59111],
    57: [0, 0.64444, 0.13167, 0, 0.59111],
    58: [0, 0.44444, 0.06695, 0, 0.35555],
    59: [0.19444, 0.44444, 0.06695, 0, 0.35555],
    61: [-0.10889, 0.39111, 0.06833, 0, 0.88555],
    63: [0, 0.69444, 0.11472, 0, 0.59111],
    64: [0, 0.69444, 0.09208, 0, 0.88555],
    65: [0, 0.68611, 0, 0, 0.86555],
    66: [0, 0.68611, 0.0992, 0, 0.81666],
    67: [0, 0.68611, 0.14208, 0, 0.82666],
    68: [0, 0.68611, 0.09062, 0, 0.87555],
    69: [0, 0.68611, 0.11431, 0, 0.75666],
    70: [0, 0.68611, 0.12903, 0, 0.72722],
    71: [0, 0.68611, 0.07347, 0, 0.89527],
    72: [0, 0.68611, 0.17208, 0, 0.8961],
    73: [0, 0.68611, 0.15681, 0, 0.47166],
    74: [0, 0.68611, 0.145, 0, 0.61055],
    75: [0, 0.68611, 0.14208, 0, 0.89499],
    76: [0, 0.68611, 0, 0, 0.69777],
    77: [0, 0.68611, 0.17208, 0, 1.07277],
    78: [0, 0.68611, 0.17208, 0, 0.8961],
    79: [0, 0.68611, 0.09062, 0, 0.85499],
    80: [0, 0.68611, 0.0992, 0, 0.78721],
    81: [0.19444, 0.68611, 0.09062, 0, 0.85499],
    82: [0, 0.68611, 0.02559, 0, 0.85944],
    83: [0, 0.68611, 0.11264, 0, 0.64999],
    84: [0, 0.68611, 0.12903, 0, 0.7961],
    85: [0, 0.68611, 0.17208, 0, 0.88083],
    86: [0, 0.68611, 0.18625, 0, 0.86555],
    87: [0, 0.68611, 0.18625, 0, 1.15999],
    88: [0, 0.68611, 0.15681, 0, 0.86555],
    89: [0, 0.68611, 0.19803, 0, 0.86555],
    90: [0, 0.68611, 0.14208, 0, 0.70888],
    91: [0.25, 0.75, 0.1875, 0, 0.35611],
    93: [0.25, 0.75, 0.09972, 0, 0.35611],
    94: [0, 0.69444, 0.06709, 0, 0.59111],
    95: [0.31, 0.13444, 0.09811, 0, 0.59111],
    97: [0, 0.44444, 0.09426, 0, 0.59111],
    98: [0, 0.69444, 0.07861, 0, 0.53222],
    99: [0, 0.44444, 0.05222, 0, 0.53222],
    100: [0, 0.69444, 0.10861, 0, 0.59111],
    101: [0, 0.44444, 0.085, 0, 0.53222],
    102: [0.19444, 0.69444, 0.21778, 0, 0.4],
    103: [0.19444, 0.44444, 0.105, 0, 0.53222],
    104: [0, 0.69444, 0.09426, 0, 0.59111],
    105: [0, 0.69326, 0.11387, 0, 0.35555],
    106: [0.19444, 0.69326, 0.1672, 0, 0.35555],
    107: [0, 0.69444, 0.11111, 0, 0.53222],
    108: [0, 0.69444, 0.10861, 0, 0.29666],
    109: [0, 0.44444, 0.09426, 0, 0.94444],
    110: [0, 0.44444, 0.09426, 0, 0.64999],
    111: [0, 0.44444, 0.07861, 0, 0.59111],
    112: [0.19444, 0.44444, 0.07861, 0, 0.59111],
    113: [0.19444, 0.44444, 0.105, 0, 0.53222],
    114: [0, 0.44444, 0.11111, 0, 0.50167],
    115: [0, 0.44444, 0.08167, 0, 0.48694],
    116: [0, 0.63492, 0.09639, 0, 0.385],
    117: [0, 0.44444, 0.09426, 0, 0.62055],
    118: [0, 0.44444, 0.11111, 0, 0.53222],
    119: [0, 0.44444, 0.11111, 0, 0.76777],
    120: [0, 0.44444, 0.12583, 0, 0.56055],
    121: [0.19444, 0.44444, 0.105, 0, 0.56166],
    122: [0, 0.44444, 0.13889, 0, 0.49055],
    126: [0.35, 0.34444, 0.11472, 0, 0.59111],
    160: [0, 0, 0, 0, 0.25],
    168: [0, 0.69444, 0.11473, 0, 0.59111],
    176: [0, 0.69444, 0, 0, 0.94888],
    184: [0.17014, 0, 0, 0, 0.53222],
    198: [0, 0.68611, 0.11431, 0, 1.02277],
    216: [0.04861, 0.73472, 0.09062, 0, 0.88555],
    223: [0.19444, 0.69444, 0.09736, 0, 0.665],
    230: [0, 0.44444, 0.085, 0, 0.82666],
    248: [0.09722, 0.54167, 0.09458, 0, 0.59111],
    305: [0, 0.44444, 0.09426, 0, 0.35555],
    338: [0, 0.68611, 0.11431, 0, 1.14054],
    339: [0, 0.44444, 0.085, 0, 0.82666],
    567: [0.19444, 0.44444, 0.04611, 0, 0.385],
    710: [0, 0.69444, 0.06709, 0, 0.59111],
    711: [0, 0.63194, 0.08271, 0, 0.59111],
    713: [0, 0.59444, 0.10444, 0, 0.59111],
    714: [0, 0.69444, 0.08528, 0, 0.59111],
    715: [0, 0.69444, 0, 0, 0.59111],
    728: [0, 0.69444, 0.10333, 0, 0.59111],
    729: [0, 0.69444, 0.12945, 0, 0.35555],
    730: [0, 0.69444, 0, 0, 0.94888],
    732: [0, 0.69444, 0.11472, 0, 0.59111],
    733: [0, 0.69444, 0.11472, 0, 0.59111],
    915: [0, 0.68611, 0.12903, 0, 0.69777],
    916: [0, 0.68611, 0, 0, 0.94444],
    920: [0, 0.68611, 0.09062, 0, 0.88555],
    923: [0, 0.68611, 0, 0, 0.80666],
    926: [0, 0.68611, 0.15092, 0, 0.76777],
    928: [0, 0.68611, 0.17208, 0, 0.8961],
    931: [0, 0.68611, 0.11431, 0, 0.82666],
    933: [0, 0.68611, 0.10778, 0, 0.88555],
    934: [0, 0.68611, 0.05632, 0, 0.82666],
    936: [0, 0.68611, 0.10778, 0, 0.88555],
    937: [0, 0.68611, 0.0992, 0, 0.82666],
    8211: [0, 0.44444, 0.09811, 0, 0.59111],
    8212: [0, 0.44444, 0.09811, 0, 1.18221],
    8216: [0, 0.69444, 0.12945, 0, 0.35555],
    8217: [0, 0.69444, 0.12945, 0, 0.35555],
    8220: [0, 0.69444, 0.16772, 0, 0.62055],
    8221: [0, 0.69444, 0.07939, 0, 0.62055]
  },
  "Main-Italic": {
    32: [0, 0, 0, 0, 0.25],
    33: [0, 0.69444, 0.12417, 0, 0.30667],
    34: [0, 0.69444, 0.06961, 0, 0.51444],
    35: [0.19444, 0.69444, 0.06616, 0, 0.81777],
    37: [0.05556, 0.75, 0.13639, 0, 0.81777],
    38: [0, 0.69444, 0.09694, 0, 0.76666],
    39: [0, 0.69444, 0.12417, 0, 0.30667],
    40: [0.25, 0.75, 0.16194, 0, 0.40889],
    41: [0.25, 0.75, 0.03694, 0, 0.40889],
    42: [0, 0.75, 0.14917, 0, 0.51111],
    43: [0.05667, 0.56167, 0.03694, 0, 0.76666],
    44: [0.19444, 0.10556, 0, 0, 0.30667],
    45: [0, 0.43056, 0.02826, 0, 0.35778],
    46: [0, 0.10556, 0, 0, 0.30667],
    47: [0.25, 0.75, 0.16194, 0, 0.51111],
    48: [0, 0.64444, 0.13556, 0, 0.51111],
    49: [0, 0.64444, 0.13556, 0, 0.51111],
    50: [0, 0.64444, 0.13556, 0, 0.51111],
    51: [0, 0.64444, 0.13556, 0, 0.51111],
    52: [0.19444, 0.64444, 0.13556, 0, 0.51111],
    53: [0, 0.64444, 0.13556, 0, 0.51111],
    54: [0, 0.64444, 0.13556, 0, 0.51111],
    55: [0.19444, 0.64444, 0.13556, 0, 0.51111],
    56: [0, 0.64444, 0.13556, 0, 0.51111],
    57: [0, 0.64444, 0.13556, 0, 0.51111],
    58: [0, 0.43056, 0.0582, 0, 0.30667],
    59: [0.19444, 0.43056, 0.0582, 0, 0.30667],
    61: [-0.13313, 0.36687, 0.06616, 0, 0.76666],
    63: [0, 0.69444, 0.1225, 0, 0.51111],
    64: [0, 0.69444, 0.09597, 0, 0.76666],
    65: [0, 0.68333, 0, 0, 0.74333],
    66: [0, 0.68333, 0.10257, 0, 0.70389],
    67: [0, 0.68333, 0.14528, 0, 0.71555],
    68: [0, 0.68333, 0.09403, 0, 0.755],
    69: [0, 0.68333, 0.12028, 0, 0.67833],
    70: [0, 0.68333, 0.13305, 0, 0.65277],
    71: [0, 0.68333, 0.08722, 0, 0.77361],
    72: [0, 0.68333, 0.16389, 0, 0.74333],
    73: [0, 0.68333, 0.15806, 0, 0.38555],
    74: [0, 0.68333, 0.14028, 0, 0.525],
    75: [0, 0.68333, 0.14528, 0, 0.76888],
    76: [0, 0.68333, 0, 0, 0.62722],
    77: [0, 0.68333, 0.16389, 0, 0.89666],
    78: [0, 0.68333, 0.16389, 0, 0.74333],
    79: [0, 0.68333, 0.09403, 0, 0.76666],
    80: [0, 0.68333, 0.10257, 0, 0.67833],
    81: [0.19444, 0.68333, 0.09403, 0, 0.76666],
    82: [0, 0.68333, 0.03868, 0, 0.72944],
    83: [0, 0.68333, 0.11972, 0, 0.56222],
    84: [0, 0.68333, 0.13305, 0, 0.71555],
    85: [0, 0.68333, 0.16389, 0, 0.74333],
    86: [0, 0.68333, 0.18361, 0, 0.74333],
    87: [0, 0.68333, 0.18361, 0, 0.99888],
    88: [0, 0.68333, 0.15806, 0, 0.74333],
    89: [0, 0.68333, 0.19383, 0, 0.74333],
    90: [0, 0.68333, 0.14528, 0, 0.61333],
    91: [0.25, 0.75, 0.1875, 0, 0.30667],
    93: [0.25, 0.75, 0.10528, 0, 0.30667],
    94: [0, 0.69444, 0.06646, 0, 0.51111],
    95: [0.31, 0.12056, 0.09208, 0, 0.51111],
    97: [0, 0.43056, 0.07671, 0, 0.51111],
    98: [0, 0.69444, 0.06312, 0, 0.46],
    99: [0, 0.43056, 0.05653, 0, 0.46],
    100: [0, 0.69444, 0.10333, 0, 0.51111],
    101: [0, 0.43056, 0.07514, 0, 0.46],
    102: [0.19444, 0.69444, 0.21194, 0, 0.30667],
    103: [0.19444, 0.43056, 0.08847, 0, 0.46],
    104: [0, 0.69444, 0.07671, 0, 0.51111],
    105: [0, 0.65536, 0.1019, 0, 0.30667],
    106: [0.19444, 0.65536, 0.14467, 0, 0.30667],
    107: [0, 0.69444, 0.10764, 0, 0.46],
    108: [0, 0.69444, 0.10333, 0, 0.25555],
    109: [0, 0.43056, 0.07671, 0, 0.81777],
    110: [0, 0.43056, 0.07671, 0, 0.56222],
    111: [0, 0.43056, 0.06312, 0, 0.51111],
    112: [0.19444, 0.43056, 0.06312, 0, 0.51111],
    113: [0.19444, 0.43056, 0.08847, 0, 0.46],
    114: [0, 0.43056, 0.10764, 0, 0.42166],
    115: [0, 0.43056, 0.08208, 0, 0.40889],
    116: [0, 0.61508, 0.09486, 0, 0.33222],
    117: [0, 0.43056, 0.07671, 0, 0.53666],
    118: [0, 0.43056, 0.10764, 0, 0.46],
    119: [0, 0.43056, 0.10764, 0, 0.66444],
    120: [0, 0.43056, 0.12042, 0, 0.46389],
    121: [0.19444, 0.43056, 0.08847, 0, 0.48555],
    122: [0, 0.43056, 0.12292, 0, 0.40889],
    126: [0.35, 0.31786, 0.11585, 0, 0.51111],
    160: [0, 0, 0, 0, 0.25],
    168: [0, 0.66786, 0.10474, 0, 0.51111],
    176: [0, 0.69444, 0, 0, 0.83129],
    184: [0.17014, 0, 0, 0, 0.46],
    198: [0, 0.68333, 0.12028, 0, 0.88277],
    216: [0.04861, 0.73194, 0.09403, 0, 0.76666],
    223: [0.19444, 0.69444, 0.10514, 0, 0.53666],
    230: [0, 0.43056, 0.07514, 0, 0.71555],
    248: [0.09722, 0.52778, 0.09194, 0, 0.51111],
    338: [0, 0.68333, 0.12028, 0, 0.98499],
    339: [0, 0.43056, 0.07514, 0, 0.71555],
    710: [0, 0.69444, 0.06646, 0, 0.51111],
    711: [0, 0.62847, 0.08295, 0, 0.51111],
    713: [0, 0.56167, 0.10333, 0, 0.51111],
    714: [0, 0.69444, 0.09694, 0, 0.51111],
    715: [0, 0.69444, 0, 0, 0.51111],
    728: [0, 0.69444, 0.10806, 0, 0.51111],
    729: [0, 0.66786, 0.11752, 0, 0.30667],
    730: [0, 0.69444, 0, 0, 0.83129],
    732: [0, 0.66786, 0.11585, 0, 0.51111],
    733: [0, 0.69444, 0.1225, 0, 0.51111],
    915: [0, 0.68333, 0.13305, 0, 0.62722],
    916: [0, 0.68333, 0, 0, 0.81777],
    920: [0, 0.68333, 0.09403, 0, 0.76666],
    923: [0, 0.68333, 0, 0, 0.69222],
    926: [0, 0.68333, 0.15294, 0, 0.66444],
    928: [0, 0.68333, 0.16389, 0, 0.74333],
    931: [0, 0.68333, 0.12028, 0, 0.71555],
    933: [0, 0.68333, 0.11111, 0, 0.76666],
    934: [0, 0.68333, 0.05986, 0, 0.71555],
    936: [0, 0.68333, 0.11111, 0, 0.76666],
    937: [0, 0.68333, 0.10257, 0, 0.71555],
    8211: [0, 0.43056, 0.09208, 0, 0.51111],
    8212: [0, 0.43056, 0.09208, 0, 1.02222],
    8216: [0, 0.69444, 0.12417, 0, 0.30667],
    8217: [0, 0.69444, 0.12417, 0, 0.30667],
    8220: [0, 0.69444, 0.1685, 0, 0.51444],
    8221: [0, 0.69444, 0.06961, 0, 0.51444],
    8463: [0, 0.68889, 0, 0, 0.54028]
  },
  "Main-Regular": {
    32: [0, 0, 0, 0, 0.25],
    33: [0, 0.69444, 0, 0, 0.27778],
    34: [0, 0.69444, 0, 0, 0.5],
    35: [0.19444, 0.69444, 0, 0, 0.83334],
    36: [0.05556, 0.75, 0, 0, 0.5],
    37: [0.05556, 0.75, 0, 0, 0.83334],
    38: [0, 0.69444, 0, 0, 0.77778],
    39: [0, 0.69444, 0, 0, 0.27778],
    40: [0.25, 0.75, 0, 0, 0.38889],
    41: [0.25, 0.75, 0, 0, 0.38889],
    42: [0, 0.75, 0, 0, 0.5],
    43: [0.08333, 0.58333, 0, 0, 0.77778],
    44: [0.19444, 0.10556, 0, 0, 0.27778],
    45: [0, 0.43056, 0, 0, 0.33333],
    46: [0, 0.10556, 0, 0, 0.27778],
    47: [0.25, 0.75, 0, 0, 0.5],
    48: [0, 0.64444, 0, 0, 0.5],
    49: [0, 0.64444, 0, 0, 0.5],
    50: [0, 0.64444, 0, 0, 0.5],
    51: [0, 0.64444, 0, 0, 0.5],
    52: [0, 0.64444, 0, 0, 0.5],
    53: [0, 0.64444, 0, 0, 0.5],
    54: [0, 0.64444, 0, 0, 0.5],
    55: [0, 0.64444, 0, 0, 0.5],
    56: [0, 0.64444, 0, 0, 0.5],
    57: [0, 0.64444, 0, 0, 0.5],
    58: [0, 0.43056, 0, 0, 0.27778],
    59: [0.19444, 0.43056, 0, 0, 0.27778],
    60: [0.0391, 0.5391, 0, 0, 0.77778],
    61: [-0.13313, 0.36687, 0, 0, 0.77778],
    62: [0.0391, 0.5391, 0, 0, 0.77778],
    63: [0, 0.69444, 0, 0, 0.47222],
    64: [0, 0.69444, 0, 0, 0.77778],
    65: [0, 0.68333, 0, 0, 0.75],
    66: [0, 0.68333, 0, 0, 0.70834],
    67: [0, 0.68333, 0, 0, 0.72222],
    68: [0, 0.68333, 0, 0, 0.76389],
    69: [0, 0.68333, 0, 0, 0.68056],
    70: [0, 0.68333, 0, 0, 0.65278],
    71: [0, 0.68333, 0, 0, 0.78472],
    72: [0, 0.68333, 0, 0, 0.75],
    73: [0, 0.68333, 0, 0, 0.36111],
    74: [0, 0.68333, 0, 0, 0.51389],
    75: [0, 0.68333, 0, 0, 0.77778],
    76: [0, 0.68333, 0, 0, 0.625],
    77: [0, 0.68333, 0, 0, 0.91667],
    78: [0, 0.68333, 0, 0, 0.75],
    79: [0, 0.68333, 0, 0, 0.77778],
    80: [0, 0.68333, 0, 0, 0.68056],
    81: [0.19444, 0.68333, 0, 0, 0.77778],
    82: [0, 0.68333, 0, 0, 0.73611],
    83: [0, 0.68333, 0, 0, 0.55556],
    84: [0, 0.68333, 0, 0, 0.72222],
    85: [0, 0.68333, 0, 0, 0.75],
    86: [0, 0.68333, 0.01389, 0, 0.75],
    87: [0, 0.68333, 0.01389, 0, 1.02778],
    88: [0, 0.68333, 0, 0, 0.75],
    89: [0, 0.68333, 0.025, 0, 0.75],
    90: [0, 0.68333, 0, 0, 0.61111],
    91: [0.25, 0.75, 0, 0, 0.27778],
    92: [0.25, 0.75, 0, 0, 0.5],
    93: [0.25, 0.75, 0, 0, 0.27778],
    94: [0, 0.69444, 0, 0, 0.5],
    95: [0.31, 0.12056, 0.02778, 0, 0.5],
    97: [0, 0.43056, 0, 0, 0.5],
    98: [0, 0.69444, 0, 0, 0.55556],
    99: [0, 0.43056, 0, 0, 0.44445],
    100: [0, 0.69444, 0, 0, 0.55556],
    101: [0, 0.43056, 0, 0, 0.44445],
    102: [0, 0.69444, 0.07778, 0, 0.30556],
    103: [0.19444, 0.43056, 0.01389, 0, 0.5],
    104: [0, 0.69444, 0, 0, 0.55556],
    105: [0, 0.66786, 0, 0, 0.27778],
    106: [0.19444, 0.66786, 0, 0, 0.30556],
    107: [0, 0.69444, 0, 0, 0.52778],
    108: [0, 0.69444, 0, 0, 0.27778],
    109: [0, 0.43056, 0, 0, 0.83334],
    110: [0, 0.43056, 0, 0, 0.55556],
    111: [0, 0.43056, 0, 0, 0.5],
    112: [0.19444, 0.43056, 0, 0, 0.55556],
    113: [0.19444, 0.43056, 0, 0, 0.52778],
    114: [0, 0.43056, 0, 0, 0.39167],
    115: [0, 0.43056, 0, 0, 0.39445],
    116: [0, 0.61508, 0, 0, 0.38889],
    117: [0, 0.43056, 0, 0, 0.55556],
    118: [0, 0.43056, 0.01389, 0, 0.52778],
    119: [0, 0.43056, 0.01389, 0, 0.72222],
    120: [0, 0.43056, 0, 0, 0.52778],
    121: [0.19444, 0.43056, 0.01389, 0, 0.52778],
    122: [0, 0.43056, 0, 0, 0.44445],
    123: [0.25, 0.75, 0, 0, 0.5],
    124: [0.25, 0.75, 0, 0, 0.27778],
    125: [0.25, 0.75, 0, 0, 0.5],
    126: [0.35, 0.31786, 0, 0, 0.5],
    160: [0, 0, 0, 0, 0.25],
    163: [0, 0.69444, 0, 0, 0.76909],
    167: [0.19444, 0.69444, 0, 0, 0.44445],
    168: [0, 0.66786, 0, 0, 0.5],
    172: [0, 0.43056, 0, 0, 0.66667],
    176: [0, 0.69444, 0, 0, 0.75],
    177: [0.08333, 0.58333, 0, 0, 0.77778],
    182: [0.19444, 0.69444, 0, 0, 0.61111],
    184: [0.17014, 0, 0, 0, 0.44445],
    198: [0, 0.68333, 0, 0, 0.90278],
    215: [0.08333, 0.58333, 0, 0, 0.77778],
    216: [0.04861, 0.73194, 0, 0, 0.77778],
    223: [0, 0.69444, 0, 0, 0.5],
    230: [0, 0.43056, 0, 0, 0.72222],
    247: [0.08333, 0.58333, 0, 0, 0.77778],
    248: [0.09722, 0.52778, 0, 0, 0.5],
    305: [0, 0.43056, 0, 0, 0.27778],
    338: [0, 0.68333, 0, 0, 1.01389],
    339: [0, 0.43056, 0, 0, 0.77778],
    567: [0.19444, 0.43056, 0, 0, 0.30556],
    710: [0, 0.69444, 0, 0, 0.5],
    711: [0, 0.62847, 0, 0, 0.5],
    713: [0, 0.56778, 0, 0, 0.5],
    714: [0, 0.69444, 0, 0, 0.5],
    715: [0, 0.69444, 0, 0, 0.5],
    728: [0, 0.69444, 0, 0, 0.5],
    729: [0, 0.66786, 0, 0, 0.27778],
    730: [0, 0.69444, 0, 0, 0.75],
    732: [0, 0.66786, 0, 0, 0.5],
    733: [0, 0.69444, 0, 0, 0.5],
    915: [0, 0.68333, 0, 0, 0.625],
    916: [0, 0.68333, 0, 0, 0.83334],
    920: [0, 0.68333, 0, 0, 0.77778],
    923: [0, 0.68333, 0, 0, 0.69445],
    926: [0, 0.68333, 0, 0, 0.66667],
    928: [0, 0.68333, 0, 0, 0.75],
    931: [0, 0.68333, 0, 0, 0.72222],
    933: [0, 0.68333, 0, 0, 0.77778],
    934: [0, 0.68333, 0, 0, 0.72222],
    936: [0, 0.68333, 0, 0, 0.77778],
    937: [0, 0.68333, 0, 0, 0.72222],
    8211: [0, 0.43056, 0.02778, 0, 0.5],
    8212: [0, 0.43056, 0.02778, 0, 1],
    8216: [0, 0.69444, 0, 0, 0.27778],
    8217: [0, 0.69444, 0, 0, 0.27778],
    8220: [0, 0.69444, 0, 0, 0.5],
    8221: [0, 0.69444, 0, 0, 0.5],
    8224: [0.19444, 0.69444, 0, 0, 0.44445],
    8225: [0.19444, 0.69444, 0, 0, 0.44445],
    8230: [0, 0.123, 0, 0, 1.172],
    8242: [0, 0.55556, 0, 0, 0.275],
    8407: [0, 0.71444, 0.15382, 0, 0.5],
    8463: [0, 0.68889, 0, 0, 0.54028],
    8465: [0, 0.69444, 0, 0, 0.72222],
    8467: [0, 0.69444, 0, 0.11111, 0.41667],
    8472: [0.19444, 0.43056, 0, 0.11111, 0.63646],
    8476: [0, 0.69444, 0, 0, 0.72222],
    8501: [0, 0.69444, 0, 0, 0.61111],
    8592: [-0.13313, 0.36687, 0, 0, 1],
    8593: [0.19444, 0.69444, 0, 0, 0.5],
    8594: [-0.13313, 0.36687, 0, 0, 1],
    8595: [0.19444, 0.69444, 0, 0, 0.5],
    8596: [-0.13313, 0.36687, 0, 0, 1],
    8597: [0.25, 0.75, 0, 0, 0.5],
    8598: [0.19444, 0.69444, 0, 0, 1],
    8599: [0.19444, 0.69444, 0, 0, 1],
    8600: [0.19444, 0.69444, 0, 0, 1],
    8601: [0.19444, 0.69444, 0, 0, 1],
    8614: [0.011, 0.511, 0, 0, 1],
    8617: [0.011, 0.511, 0, 0, 1.126],
    8618: [0.011, 0.511, 0, 0, 1.126],
    8636: [-0.13313, 0.36687, 0, 0, 1],
    8637: [-0.13313, 0.36687, 0, 0, 1],
    8640: [-0.13313, 0.36687, 0, 0, 1],
    8641: [-0.13313, 0.36687, 0, 0, 1],
    8652: [0.011, 0.671, 0, 0, 1],
    8656: [-0.13313, 0.36687, 0, 0, 1],
    8657: [0.19444, 0.69444, 0, 0, 0.61111],
    8658: [-0.13313, 0.36687, 0, 0, 1],
    8659: [0.19444, 0.69444, 0, 0, 0.61111],
    8660: [-0.13313, 0.36687, 0, 0, 1],
    8661: [0.25, 0.75, 0, 0, 0.61111],
    8704: [0, 0.69444, 0, 0, 0.55556],
    8706: [0, 0.69444, 0.05556, 0.08334, 0.5309],
    8707: [0, 0.69444, 0, 0, 0.55556],
    8709: [0.05556, 0.75, 0, 0, 0.5],
    8711: [0, 0.68333, 0, 0, 0.83334],
    8712: [0.0391, 0.5391, 0, 0, 0.66667],
    8715: [0.0391, 0.5391, 0, 0, 0.66667],
    8722: [0.08333, 0.58333, 0, 0, 0.77778],
    8723: [0.08333, 0.58333, 0, 0, 0.77778],
    8725: [0.25, 0.75, 0, 0, 0.5],
    8726: [0.25, 0.75, 0, 0, 0.5],
    8727: [-0.03472, 0.46528, 0, 0, 0.5],
    8728: [-0.05555, 0.44445, 0, 0, 0.5],
    8729: [-0.05555, 0.44445, 0, 0, 0.5],
    8730: [0.2, 0.8, 0, 0, 0.83334],
    8733: [0, 0.43056, 0, 0, 0.77778],
    8734: [0, 0.43056, 0, 0, 1],
    8736: [0, 0.69224, 0, 0, 0.72222],
    8739: [0.25, 0.75, 0, 0, 0.27778],
    8741: [0.25, 0.75, 0, 0, 0.5],
    8743: [0, 0.55556, 0, 0, 0.66667],
    8744: [0, 0.55556, 0, 0, 0.66667],
    8745: [0, 0.55556, 0, 0, 0.66667],
    8746: [0, 0.55556, 0, 0, 0.66667],
    8747: [0.19444, 0.69444, 0.11111, 0, 0.41667],
    8764: [-0.13313, 0.36687, 0, 0, 0.77778],
    8768: [0.19444, 0.69444, 0, 0, 0.27778],
    8771: [-0.03625, 0.46375, 0, 0, 0.77778],
    8773: [-0.022, 0.589, 0, 0, 0.778],
    8776: [-0.01688, 0.48312, 0, 0, 0.77778],
    8781: [-0.03625, 0.46375, 0, 0, 0.77778],
    8784: [-0.133, 0.673, 0, 0, 0.778],
    8801: [-0.03625, 0.46375, 0, 0, 0.77778],
    8804: [0.13597, 0.63597, 0, 0, 0.77778],
    8805: [0.13597, 0.63597, 0, 0, 0.77778],
    8810: [0.0391, 0.5391, 0, 0, 1],
    8811: [0.0391, 0.5391, 0, 0, 1],
    8826: [0.0391, 0.5391, 0, 0, 0.77778],
    8827: [0.0391, 0.5391, 0, 0, 0.77778],
    8834: [0.0391, 0.5391, 0, 0, 0.77778],
    8835: [0.0391, 0.5391, 0, 0, 0.77778],
    8838: [0.13597, 0.63597, 0, 0, 0.77778],
    8839: [0.13597, 0.63597, 0, 0, 0.77778],
    8846: [0, 0.55556, 0, 0, 0.66667],
    8849: [0.13597, 0.63597, 0, 0, 0.77778],
    8850: [0.13597, 0.63597, 0, 0, 0.77778],
    8851: [0, 0.55556, 0, 0, 0.66667],
    8852: [0, 0.55556, 0, 0, 0.66667],
    8853: [0.08333, 0.58333, 0, 0, 0.77778],
    8854: [0.08333, 0.58333, 0, 0, 0.77778],
    8855: [0.08333, 0.58333, 0, 0, 0.77778],
    8856: [0.08333, 0.58333, 0, 0, 0.77778],
    8857: [0.08333, 0.58333, 0, 0, 0.77778],
    8866: [0, 0.69444, 0, 0, 0.61111],
    8867: [0, 0.69444, 0, 0, 0.61111],
    8868: [0, 0.69444, 0, 0, 0.77778],
    8869: [0, 0.69444, 0, 0, 0.77778],
    8872: [0.249, 0.75, 0, 0, 0.867],
    8900: [-0.05555, 0.44445, 0, 0, 0.5],
    8901: [-0.05555, 0.44445, 0, 0, 0.27778],
    8902: [-0.03472, 0.46528, 0, 0, 0.5],
    8904: [5e-3, 0.505, 0, 0, 0.9],
    8942: [0.03, 0.903, 0, 0, 0.278],
    8943: [-0.19, 0.313, 0, 0, 1.172],
    8945: [-0.1, 0.823, 0, 0, 1.282],
    8968: [0.25, 0.75, 0, 0, 0.44445],
    8969: [0.25, 0.75, 0, 0, 0.44445],
    8970: [0.25, 0.75, 0, 0, 0.44445],
    8971: [0.25, 0.75, 0, 0, 0.44445],
    8994: [-0.14236, 0.35764, 0, 0, 1],
    8995: [-0.14236, 0.35764, 0, 0, 1],
    9136: [0.244, 0.744, 0, 0, 0.412],
    9137: [0.244, 0.745, 0, 0, 0.412],
    9651: [0.19444, 0.69444, 0, 0, 0.88889],
    9657: [-0.03472, 0.46528, 0, 0, 0.5],
    9661: [0.19444, 0.69444, 0, 0, 0.88889],
    9667: [-0.03472, 0.46528, 0, 0, 0.5],
    9711: [0.19444, 0.69444, 0, 0, 1],
    9824: [0.12963, 0.69444, 0, 0, 0.77778],
    9825: [0.12963, 0.69444, 0, 0, 0.77778],
    9826: [0.12963, 0.69444, 0, 0, 0.77778],
    9827: [0.12963, 0.69444, 0, 0, 0.77778],
    9837: [0, 0.75, 0, 0, 0.38889],
    9838: [0.19444, 0.69444, 0, 0, 0.38889],
    9839: [0.19444, 0.69444, 0, 0, 0.38889],
    10216: [0.25, 0.75, 0, 0, 0.38889],
    10217: [0.25, 0.75, 0, 0, 0.38889],
    10222: [0.244, 0.744, 0, 0, 0.412],
    10223: [0.244, 0.745, 0, 0, 0.412],
    10229: [0.011, 0.511, 0, 0, 1.609],
    10230: [0.011, 0.511, 0, 0, 1.638],
    10231: [0.011, 0.511, 0, 0, 1.859],
    10232: [0.024, 0.525, 0, 0, 1.609],
    10233: [0.024, 0.525, 0, 0, 1.638],
    10234: [0.024, 0.525, 0, 0, 1.858],
    10236: [0.011, 0.511, 0, 0, 1.638],
    10815: [0, 0.68333, 0, 0, 0.75],
    10927: [0.13597, 0.63597, 0, 0, 0.77778],
    10928: [0.13597, 0.63597, 0, 0, 0.77778],
    57376: [0.19444, 0.69444, 0, 0, 0]
  },
  "Math-BoldItalic": {
    32: [0, 0, 0, 0, 0.25],
    48: [0, 0.44444, 0, 0, 0.575],
    49: [0, 0.44444, 0, 0, 0.575],
    50: [0, 0.44444, 0, 0, 0.575],
    51: [0.19444, 0.44444, 0, 0, 0.575],
    52: [0.19444, 0.44444, 0, 0, 0.575],
    53: [0.19444, 0.44444, 0, 0, 0.575],
    54: [0, 0.64444, 0, 0, 0.575],
    55: [0.19444, 0.44444, 0, 0, 0.575],
    56: [0, 0.64444, 0, 0, 0.575],
    57: [0.19444, 0.44444, 0, 0, 0.575],
    65: [0, 0.68611, 0, 0, 0.86944],
    66: [0, 0.68611, 0.04835, 0, 0.8664],
    67: [0, 0.68611, 0.06979, 0, 0.81694],
    68: [0, 0.68611, 0.03194, 0, 0.93812],
    69: [0, 0.68611, 0.05451, 0, 0.81007],
    70: [0, 0.68611, 0.15972, 0, 0.68889],
    71: [0, 0.68611, 0, 0, 0.88673],
    72: [0, 0.68611, 0.08229, 0, 0.98229],
    73: [0, 0.68611, 0.07778, 0, 0.51111],
    74: [0, 0.68611, 0.10069, 0, 0.63125],
    75: [0, 0.68611, 0.06979, 0, 0.97118],
    76: [0, 0.68611, 0, 0, 0.75555],
    77: [0, 0.68611, 0.11424, 0, 1.14201],
    78: [0, 0.68611, 0.11424, 0, 0.95034],
    79: [0, 0.68611, 0.03194, 0, 0.83666],
    80: [0, 0.68611, 0.15972, 0, 0.72309],
    81: [0.19444, 0.68611, 0, 0, 0.86861],
    82: [0, 0.68611, 421e-5, 0, 0.87235],
    83: [0, 0.68611, 0.05382, 0, 0.69271],
    84: [0, 0.68611, 0.15972, 0, 0.63663],
    85: [0, 0.68611, 0.11424, 0, 0.80027],
    86: [0, 0.68611, 0.25555, 0, 0.67778],
    87: [0, 0.68611, 0.15972, 0, 1.09305],
    88: [0, 0.68611, 0.07778, 0, 0.94722],
    89: [0, 0.68611, 0.25555, 0, 0.67458],
    90: [0, 0.68611, 0.06979, 0, 0.77257],
    97: [0, 0.44444, 0, 0, 0.63287],
    98: [0, 0.69444, 0, 0, 0.52083],
    99: [0, 0.44444, 0, 0, 0.51342],
    100: [0, 0.69444, 0, 0, 0.60972],
    101: [0, 0.44444, 0, 0, 0.55361],
    102: [0.19444, 0.69444, 0.11042, 0, 0.56806],
    103: [0.19444, 0.44444, 0.03704, 0, 0.5449],
    104: [0, 0.69444, 0, 0, 0.66759],
    105: [0, 0.69326, 0, 0, 0.4048],
    106: [0.19444, 0.69326, 0.0622, 0, 0.47083],
    107: [0, 0.69444, 0.01852, 0, 0.6037],
    108: [0, 0.69444, 88e-4, 0, 0.34815],
    109: [0, 0.44444, 0, 0, 1.0324],
    110: [0, 0.44444, 0, 0, 0.71296],
    111: [0, 0.44444, 0, 0, 0.58472],
    112: [0.19444, 0.44444, 0, 0, 0.60092],
    113: [0.19444, 0.44444, 0.03704, 0, 0.54213],
    114: [0, 0.44444, 0.03194, 0, 0.5287],
    115: [0, 0.44444, 0, 0, 0.53125],
    116: [0, 0.63492, 0, 0, 0.41528],
    117: [0, 0.44444, 0, 0, 0.68102],
    118: [0, 0.44444, 0.03704, 0, 0.56666],
    119: [0, 0.44444, 0.02778, 0, 0.83148],
    120: [0, 0.44444, 0, 0, 0.65903],
    121: [0.19444, 0.44444, 0.03704, 0, 0.59028],
    122: [0, 0.44444, 0.04213, 0, 0.55509],
    160: [0, 0, 0, 0, 0.25],
    915: [0, 0.68611, 0.15972, 0, 0.65694],
    916: [0, 0.68611, 0, 0, 0.95833],
    920: [0, 0.68611, 0.03194, 0, 0.86722],
    923: [0, 0.68611, 0, 0, 0.80555],
    926: [0, 0.68611, 0.07458, 0, 0.84125],
    928: [0, 0.68611, 0.08229, 0, 0.98229],
    931: [0, 0.68611, 0.05451, 0, 0.88507],
    933: [0, 0.68611, 0.15972, 0, 0.67083],
    934: [0, 0.68611, 0, 0, 0.76666],
    936: [0, 0.68611, 0.11653, 0, 0.71402],
    937: [0, 0.68611, 0.04835, 0, 0.8789],
    945: [0, 0.44444, 0, 0, 0.76064],
    946: [0.19444, 0.69444, 0.03403, 0, 0.65972],
    947: [0.19444, 0.44444, 0.06389, 0, 0.59003],
    948: [0, 0.69444, 0.03819, 0, 0.52222],
    949: [0, 0.44444, 0, 0, 0.52882],
    950: [0.19444, 0.69444, 0.06215, 0, 0.50833],
    951: [0.19444, 0.44444, 0.03704, 0, 0.6],
    952: [0, 0.69444, 0.03194, 0, 0.5618],
    953: [0, 0.44444, 0, 0, 0.41204],
    954: [0, 0.44444, 0, 0, 0.66759],
    955: [0, 0.69444, 0, 0, 0.67083],
    956: [0.19444, 0.44444, 0, 0, 0.70787],
    957: [0, 0.44444, 0.06898, 0, 0.57685],
    958: [0.19444, 0.69444, 0.03021, 0, 0.50833],
    959: [0, 0.44444, 0, 0, 0.58472],
    960: [0, 0.44444, 0.03704, 0, 0.68241],
    961: [0.19444, 0.44444, 0, 0, 0.6118],
    962: [0.09722, 0.44444, 0.07917, 0, 0.42361],
    963: [0, 0.44444, 0.03704, 0, 0.68588],
    964: [0, 0.44444, 0.13472, 0, 0.52083],
    965: [0, 0.44444, 0.03704, 0, 0.63055],
    966: [0.19444, 0.44444, 0, 0, 0.74722],
    967: [0.19444, 0.44444, 0, 0, 0.71805],
    968: [0.19444, 0.69444, 0.03704, 0, 0.75833],
    969: [0, 0.44444, 0.03704, 0, 0.71782],
    977: [0, 0.69444, 0, 0, 0.69155],
    981: [0.19444, 0.69444, 0, 0, 0.7125],
    982: [0, 0.44444, 0.03194, 0, 0.975],
    1009: [0.19444, 0.44444, 0, 0, 0.6118],
    1013: [0, 0.44444, 0, 0, 0.48333],
    57649: [0, 0.44444, 0, 0, 0.39352],
    57911: [0.19444, 0.44444, 0, 0, 0.43889]
  },
  "Math-Italic": {
    32: [0, 0, 0, 0, 0.25],
    48: [0, 0.43056, 0, 0, 0.5],
    49: [0, 0.43056, 0, 0, 0.5],
    50: [0, 0.43056, 0, 0, 0.5],
    51: [0.19444, 0.43056, 0, 0, 0.5],
    52: [0.19444, 0.43056, 0, 0, 0.5],
    53: [0.19444, 0.43056, 0, 0, 0.5],
    54: [0, 0.64444, 0, 0, 0.5],
    55: [0.19444, 0.43056, 0, 0, 0.5],
    56: [0, 0.64444, 0, 0, 0.5],
    57: [0.19444, 0.43056, 0, 0, 0.5],
    65: [0, 0.68333, 0, 0.13889, 0.75],
    66: [0, 0.68333, 0.05017, 0.08334, 0.75851],
    67: [0, 0.68333, 0.07153, 0.08334, 0.71472],
    68: [0, 0.68333, 0.02778, 0.05556, 0.82792],
    69: [0, 0.68333, 0.05764, 0.08334, 0.7382],
    70: [0, 0.68333, 0.13889, 0.08334, 0.64306],
    71: [0, 0.68333, 0, 0.08334, 0.78625],
    72: [0, 0.68333, 0.08125, 0.05556, 0.83125],
    73: [0, 0.68333, 0.07847, 0.11111, 0.43958],
    74: [0, 0.68333, 0.09618, 0.16667, 0.55451],
    75: [0, 0.68333, 0.07153, 0.05556, 0.84931],
    76: [0, 0.68333, 0, 0.02778, 0.68056],
    77: [0, 0.68333, 0.10903, 0.08334, 0.97014],
    78: [0, 0.68333, 0.10903, 0.08334, 0.80347],
    79: [0, 0.68333, 0.02778, 0.08334, 0.76278],
    80: [0, 0.68333, 0.13889, 0.08334, 0.64201],
    81: [0.19444, 0.68333, 0, 0.08334, 0.79056],
    82: [0, 0.68333, 773e-5, 0.08334, 0.75929],
    83: [0, 0.68333, 0.05764, 0.08334, 0.6132],
    84: [0, 0.68333, 0.13889, 0.08334, 0.58438],
    85: [0, 0.68333, 0.10903, 0.02778, 0.68278],
    86: [0, 0.68333, 0.22222, 0, 0.58333],
    87: [0, 0.68333, 0.13889, 0, 0.94445],
    88: [0, 0.68333, 0.07847, 0.08334, 0.82847],
    89: [0, 0.68333, 0.22222, 0, 0.58056],
    90: [0, 0.68333, 0.07153, 0.08334, 0.68264],
    97: [0, 0.43056, 0, 0, 0.52859],
    98: [0, 0.69444, 0, 0, 0.42917],
    99: [0, 0.43056, 0, 0.05556, 0.43276],
    100: [0, 0.69444, 0, 0.16667, 0.52049],
    101: [0, 0.43056, 0, 0.05556, 0.46563],
    102: [0.19444, 0.69444, 0.10764, 0.16667, 0.48959],
    103: [0.19444, 0.43056, 0.03588, 0.02778, 0.47697],
    104: [0, 0.69444, 0, 0, 0.57616],
    105: [0, 0.65952, 0, 0, 0.34451],
    106: [0.19444, 0.65952, 0.05724, 0, 0.41181],
    107: [0, 0.69444, 0.03148, 0, 0.5206],
    108: [0, 0.69444, 0.01968, 0.08334, 0.29838],
    109: [0, 0.43056, 0, 0, 0.87801],
    110: [0, 0.43056, 0, 0, 0.60023],
    111: [0, 0.43056, 0, 0.05556, 0.48472],
    112: [0.19444, 0.43056, 0, 0.08334, 0.50313],
    113: [0.19444, 0.43056, 0.03588, 0.08334, 0.44641],
    114: [0, 0.43056, 0.02778, 0.05556, 0.45116],
    115: [0, 0.43056, 0, 0.05556, 0.46875],
    116: [0, 0.61508, 0, 0.08334, 0.36111],
    117: [0, 0.43056, 0, 0.02778, 0.57246],
    118: [0, 0.43056, 0.03588, 0.02778, 0.48472],
    119: [0, 0.43056, 0.02691, 0.08334, 0.71592],
    120: [0, 0.43056, 0, 0.02778, 0.57153],
    121: [0.19444, 0.43056, 0.03588, 0.05556, 0.49028],
    122: [0, 0.43056, 0.04398, 0.05556, 0.46505],
    160: [0, 0, 0, 0, 0.25],
    915: [0, 0.68333, 0.13889, 0.08334, 0.61528],
    916: [0, 0.68333, 0, 0.16667, 0.83334],
    920: [0, 0.68333, 0.02778, 0.08334, 0.76278],
    923: [0, 0.68333, 0, 0.16667, 0.69445],
    926: [0, 0.68333, 0.07569, 0.08334, 0.74236],
    928: [0, 0.68333, 0.08125, 0.05556, 0.83125],
    931: [0, 0.68333, 0.05764, 0.08334, 0.77986],
    933: [0, 0.68333, 0.13889, 0.05556, 0.58333],
    934: [0, 0.68333, 0, 0.08334, 0.66667],
    936: [0, 0.68333, 0.11, 0.05556, 0.61222],
    937: [0, 0.68333, 0.05017, 0.08334, 0.7724],
    945: [0, 0.43056, 37e-4, 0.02778, 0.6397],
    946: [0.19444, 0.69444, 0.05278, 0.08334, 0.56563],
    947: [0.19444, 0.43056, 0.05556, 0, 0.51773],
    948: [0, 0.69444, 0.03785, 0.05556, 0.44444],
    949: [0, 0.43056, 0, 0.08334, 0.46632],
    950: [0.19444, 0.69444, 0.07378, 0.08334, 0.4375],
    951: [0.19444, 0.43056, 0.03588, 0.05556, 0.49653],
    952: [0, 0.69444, 0.02778, 0.08334, 0.46944],
    953: [0, 0.43056, 0, 0.05556, 0.35394],
    954: [0, 0.43056, 0, 0, 0.57616],
    955: [0, 0.69444, 0, 0, 0.58334],
    956: [0.19444, 0.43056, 0, 0.02778, 0.60255],
    957: [0, 0.43056, 0.06366, 0.02778, 0.49398],
    958: [0.19444, 0.69444, 0.04601, 0.11111, 0.4375],
    959: [0, 0.43056, 0, 0.05556, 0.48472],
    960: [0, 0.43056, 0.03588, 0, 0.57003],
    961: [0.19444, 0.43056, 0, 0.08334, 0.51702],
    962: [0.09722, 0.43056, 0.07986, 0.08334, 0.36285],
    963: [0, 0.43056, 0.03588, 0, 0.57141],
    964: [0, 0.43056, 0.1132, 0.02778, 0.43715],
    965: [0, 0.43056, 0.03588, 0.02778, 0.54028],
    966: [0.19444, 0.43056, 0, 0.08334, 0.65417],
    967: [0.19444, 0.43056, 0, 0.05556, 0.62569],
    968: [0.19444, 0.69444, 0.03588, 0.11111, 0.65139],
    969: [0, 0.43056, 0.03588, 0, 0.62245],
    977: [0, 0.69444, 0, 0.08334, 0.59144],
    981: [0.19444, 0.69444, 0, 0.08334, 0.59583],
    982: [0, 0.43056, 0.02778, 0, 0.82813],
    1009: [0.19444, 0.43056, 0, 0.08334, 0.51702],
    1013: [0, 0.43056, 0, 0.05556, 0.4059],
    57649: [0, 0.43056, 0, 0.02778, 0.32246],
    57911: [0.19444, 0.43056, 0, 0.08334, 0.38403]
  },
  "SansSerif-Bold": {
    32: [0, 0, 0, 0, 0.25],
    33: [0, 0.69444, 0, 0, 0.36667],
    34: [0, 0.69444, 0, 0, 0.55834],
    35: [0.19444, 0.69444, 0, 0, 0.91667],
    36: [0.05556, 0.75, 0, 0, 0.55],
    37: [0.05556, 0.75, 0, 0, 1.02912],
    38: [0, 0.69444, 0, 0, 0.83056],
    39: [0, 0.69444, 0, 0, 0.30556],
    40: [0.25, 0.75, 0, 0, 0.42778],
    41: [0.25, 0.75, 0, 0, 0.42778],
    42: [0, 0.75, 0, 0, 0.55],
    43: [0.11667, 0.61667, 0, 0, 0.85556],
    44: [0.10556, 0.13056, 0, 0, 0.30556],
    45: [0, 0.45833, 0, 0, 0.36667],
    46: [0, 0.13056, 0, 0, 0.30556],
    47: [0.25, 0.75, 0, 0, 0.55],
    48: [0, 0.69444, 0, 0, 0.55],
    49: [0, 0.69444, 0, 0, 0.55],
    50: [0, 0.69444, 0, 0, 0.55],
    51: [0, 0.69444, 0, 0, 0.55],
    52: [0, 0.69444, 0, 0, 0.55],
    53: [0, 0.69444, 0, 0, 0.55],
    54: [0, 0.69444, 0, 0, 0.55],
    55: [0, 0.69444, 0, 0, 0.55],
    56: [0, 0.69444, 0, 0, 0.55],
    57: [0, 0.69444, 0, 0, 0.55],
    58: [0, 0.45833, 0, 0, 0.30556],
    59: [0.10556, 0.45833, 0, 0, 0.30556],
    61: [-0.09375, 0.40625, 0, 0, 0.85556],
    63: [0, 0.69444, 0, 0, 0.51945],
    64: [0, 0.69444, 0, 0, 0.73334],
    65: [0, 0.69444, 0, 0, 0.73334],
    66: [0, 0.69444, 0, 0, 0.73334],
    67: [0, 0.69444, 0, 0, 0.70278],
    68: [0, 0.69444, 0, 0, 0.79445],
    69: [0, 0.69444, 0, 0, 0.64167],
    70: [0, 0.69444, 0, 0, 0.61111],
    71: [0, 0.69444, 0, 0, 0.73334],
    72: [0, 0.69444, 0, 0, 0.79445],
    73: [0, 0.69444, 0, 0, 0.33056],
    74: [0, 0.69444, 0, 0, 0.51945],
    75: [0, 0.69444, 0, 0, 0.76389],
    76: [0, 0.69444, 0, 0, 0.58056],
    77: [0, 0.69444, 0, 0, 0.97778],
    78: [0, 0.69444, 0, 0, 0.79445],
    79: [0, 0.69444, 0, 0, 0.79445],
    80: [0, 0.69444, 0, 0, 0.70278],
    81: [0.10556, 0.69444, 0, 0, 0.79445],
    82: [0, 0.69444, 0, 0, 0.70278],
    83: [0, 0.69444, 0, 0, 0.61111],
    84: [0, 0.69444, 0, 0, 0.73334],
    85: [0, 0.69444, 0, 0, 0.76389],
    86: [0, 0.69444, 0.01528, 0, 0.73334],
    87: [0, 0.69444, 0.01528, 0, 1.03889],
    88: [0, 0.69444, 0, 0, 0.73334],
    89: [0, 0.69444, 0.0275, 0, 0.73334],
    90: [0, 0.69444, 0, 0, 0.67223],
    91: [0.25, 0.75, 0, 0, 0.34306],
    93: [0.25, 0.75, 0, 0, 0.34306],
    94: [0, 0.69444, 0, 0, 0.55],
    95: [0.35, 0.10833, 0.03056, 0, 0.55],
    97: [0, 0.45833, 0, 0, 0.525],
    98: [0, 0.69444, 0, 0, 0.56111],
    99: [0, 0.45833, 0, 0, 0.48889],
    100: [0, 0.69444, 0, 0, 0.56111],
    101: [0, 0.45833, 0, 0, 0.51111],
    102: [0, 0.69444, 0.07639, 0, 0.33611],
    103: [0.19444, 0.45833, 0.01528, 0, 0.55],
    104: [0, 0.69444, 0, 0, 0.56111],
    105: [0, 0.69444, 0, 0, 0.25556],
    106: [0.19444, 0.69444, 0, 0, 0.28611],
    107: [0, 0.69444, 0, 0, 0.53056],
    108: [0, 0.69444, 0, 0, 0.25556],
    109: [0, 0.45833, 0, 0, 0.86667],
    110: [0, 0.45833, 0, 0, 0.56111],
    111: [0, 0.45833, 0, 0, 0.55],
    112: [0.19444, 0.45833, 0, 0, 0.56111],
    113: [0.19444, 0.45833, 0, 0, 0.56111],
    114: [0, 0.45833, 0.01528, 0, 0.37222],
    115: [0, 0.45833, 0, 0, 0.42167],
    116: [0, 0.58929, 0, 0, 0.40417],
    117: [0, 0.45833, 0, 0, 0.56111],
    118: [0, 0.45833, 0.01528, 0, 0.5],
    119: [0, 0.45833, 0.01528, 0, 0.74445],
    120: [0, 0.45833, 0, 0, 0.5],
    121: [0.19444, 0.45833, 0.01528, 0, 0.5],
    122: [0, 0.45833, 0, 0, 0.47639],
    126: [0.35, 0.34444, 0, 0, 0.55],
    160: [0, 0, 0, 0, 0.25],
    168: [0, 0.69444, 0, 0, 0.55],
    176: [0, 0.69444, 0, 0, 0.73334],
    180: [0, 0.69444, 0, 0, 0.55],
    184: [0.17014, 0, 0, 0, 0.48889],
    305: [0, 0.45833, 0, 0, 0.25556],
    567: [0.19444, 0.45833, 0, 0, 0.28611],
    710: [0, 0.69444, 0, 0, 0.55],
    711: [0, 0.63542, 0, 0, 0.55],
    713: [0, 0.63778, 0, 0, 0.55],
    728: [0, 0.69444, 0, 0, 0.55],
    729: [0, 0.69444, 0, 0, 0.30556],
    730: [0, 0.69444, 0, 0, 0.73334],
    732: [0, 0.69444, 0, 0, 0.55],
    733: [0, 0.69444, 0, 0, 0.55],
    915: [0, 0.69444, 0, 0, 0.58056],
    916: [0, 0.69444, 0, 0, 0.91667],
    920: [0, 0.69444, 0, 0, 0.85556],
    923: [0, 0.69444, 0, 0, 0.67223],
    926: [0, 0.69444, 0, 0, 0.73334],
    928: [0, 0.69444, 0, 0, 0.79445],
    931: [0, 0.69444, 0, 0, 0.79445],
    933: [0, 0.69444, 0, 0, 0.85556],
    934: [0, 0.69444, 0, 0, 0.79445],
    936: [0, 0.69444, 0, 0, 0.85556],
    937: [0, 0.69444, 0, 0, 0.79445],
    8211: [0, 0.45833, 0.03056, 0, 0.55],
    8212: [0, 0.45833, 0.03056, 0, 1.10001],
    8216: [0, 0.69444, 0, 0, 0.30556],
    8217: [0, 0.69444, 0, 0, 0.30556],
    8220: [0, 0.69444, 0, 0, 0.55834],
    8221: [0, 0.69444, 0, 0, 0.55834]
  },
  "SansSerif-Italic": {
    32: [0, 0, 0, 0, 0.25],
    33: [0, 0.69444, 0.05733, 0, 0.31945],
    34: [0, 0.69444, 316e-5, 0, 0.5],
    35: [0.19444, 0.69444, 0.05087, 0, 0.83334],
    36: [0.05556, 0.75, 0.11156, 0, 0.5],
    37: [0.05556, 0.75, 0.03126, 0, 0.83334],
    38: [0, 0.69444, 0.03058, 0, 0.75834],
    39: [0, 0.69444, 0.07816, 0, 0.27778],
    40: [0.25, 0.75, 0.13164, 0, 0.38889],
    41: [0.25, 0.75, 0.02536, 0, 0.38889],
    42: [0, 0.75, 0.11775, 0, 0.5],
    43: [0.08333, 0.58333, 0.02536, 0, 0.77778],
    44: [0.125, 0.08333, 0, 0, 0.27778],
    45: [0, 0.44444, 0.01946, 0, 0.33333],
    46: [0, 0.08333, 0, 0, 0.27778],
    47: [0.25, 0.75, 0.13164, 0, 0.5],
    48: [0, 0.65556, 0.11156, 0, 0.5],
    49: [0, 0.65556, 0.11156, 0, 0.5],
    50: [0, 0.65556, 0.11156, 0, 0.5],
    51: [0, 0.65556, 0.11156, 0, 0.5],
    52: [0, 0.65556, 0.11156, 0, 0.5],
    53: [0, 0.65556, 0.11156, 0, 0.5],
    54: [0, 0.65556, 0.11156, 0, 0.5],
    55: [0, 0.65556, 0.11156, 0, 0.5],
    56: [0, 0.65556, 0.11156, 0, 0.5],
    57: [0, 0.65556, 0.11156, 0, 0.5],
    58: [0, 0.44444, 0.02502, 0, 0.27778],
    59: [0.125, 0.44444, 0.02502, 0, 0.27778],
    61: [-0.13, 0.37, 0.05087, 0, 0.77778],
    63: [0, 0.69444, 0.11809, 0, 0.47222],
    64: [0, 0.69444, 0.07555, 0, 0.66667],
    65: [0, 0.69444, 0, 0, 0.66667],
    66: [0, 0.69444, 0.08293, 0, 0.66667],
    67: [0, 0.69444, 0.11983, 0, 0.63889],
    68: [0, 0.69444, 0.07555, 0, 0.72223],
    69: [0, 0.69444, 0.11983, 0, 0.59722],
    70: [0, 0.69444, 0.13372, 0, 0.56945],
    71: [0, 0.69444, 0.11983, 0, 0.66667],
    72: [0, 0.69444, 0.08094, 0, 0.70834],
    73: [0, 0.69444, 0.13372, 0, 0.27778],
    74: [0, 0.69444, 0.08094, 0, 0.47222],
    75: [0, 0.69444, 0.11983, 0, 0.69445],
    76: [0, 0.69444, 0, 0, 0.54167],
    77: [0, 0.69444, 0.08094, 0, 0.875],
    78: [0, 0.69444, 0.08094, 0, 0.70834],
    79: [0, 0.69444, 0.07555, 0, 0.73611],
    80: [0, 0.69444, 0.08293, 0, 0.63889],
    81: [0.125, 0.69444, 0.07555, 0, 0.73611],
    82: [0, 0.69444, 0.08293, 0, 0.64584],
    83: [0, 0.69444, 0.09205, 0, 0.55556],
    84: [0, 0.69444, 0.13372, 0, 0.68056],
    85: [0, 0.69444, 0.08094, 0, 0.6875],
    86: [0, 0.69444, 0.1615, 0, 0.66667],
    87: [0, 0.69444, 0.1615, 0, 0.94445],
    88: [0, 0.69444, 0.13372, 0, 0.66667],
    89: [0, 0.69444, 0.17261, 0, 0.66667],
    90: [0, 0.69444, 0.11983, 0, 0.61111],
    91: [0.25, 0.75, 0.15942, 0, 0.28889],
    93: [0.25, 0.75, 0.08719, 0, 0.28889],
    94: [0, 0.69444, 0.0799, 0, 0.5],
    95: [0.35, 0.09444, 0.08616, 0, 0.5],
    97: [0, 0.44444, 981e-5, 0, 0.48056],
    98: [0, 0.69444, 0.03057, 0, 0.51667],
    99: [0, 0.44444, 0.08336, 0, 0.44445],
    100: [0, 0.69444, 0.09483, 0, 0.51667],
    101: [0, 0.44444, 0.06778, 0, 0.44445],
    102: [0, 0.69444, 0.21705, 0, 0.30556],
    103: [0.19444, 0.44444, 0.10836, 0, 0.5],
    104: [0, 0.69444, 0.01778, 0, 0.51667],
    105: [0, 0.67937, 0.09718, 0, 0.23889],
    106: [0.19444, 0.67937, 0.09162, 0, 0.26667],
    107: [0, 0.69444, 0.08336, 0, 0.48889],
    108: [0, 0.69444, 0.09483, 0, 0.23889],
    109: [0, 0.44444, 0.01778, 0, 0.79445],
    110: [0, 0.44444, 0.01778, 0, 0.51667],
    111: [0, 0.44444, 0.06613, 0, 0.5],
    112: [0.19444, 0.44444, 0.0389, 0, 0.51667],
    113: [0.19444, 0.44444, 0.04169, 0, 0.51667],
    114: [0, 0.44444, 0.10836, 0, 0.34167],
    115: [0, 0.44444, 0.0778, 0, 0.38333],
    116: [0, 0.57143, 0.07225, 0, 0.36111],
    117: [0, 0.44444, 0.04169, 0, 0.51667],
    118: [0, 0.44444, 0.10836, 0, 0.46111],
    119: [0, 0.44444, 0.10836, 0, 0.68334],
    120: [0, 0.44444, 0.09169, 0, 0.46111],
    121: [0.19444, 0.44444, 0.10836, 0, 0.46111],
    122: [0, 0.44444, 0.08752, 0, 0.43472],
    126: [0.35, 0.32659, 0.08826, 0, 0.5],
    160: [0, 0, 0, 0, 0.25],
    168: [0, 0.67937, 0.06385, 0, 0.5],
    176: [0, 0.69444, 0, 0, 0.73752],
    184: [0.17014, 0, 0, 0, 0.44445],
    305: [0, 0.44444, 0.04169, 0, 0.23889],
    567: [0.19444, 0.44444, 0.04169, 0, 0.26667],
    710: [0, 0.69444, 0.0799, 0, 0.5],
    711: [0, 0.63194, 0.08432, 0, 0.5],
    713: [0, 0.60889, 0.08776, 0, 0.5],
    714: [0, 0.69444, 0.09205, 0, 0.5],
    715: [0, 0.69444, 0, 0, 0.5],
    728: [0, 0.69444, 0.09483, 0, 0.5],
    729: [0, 0.67937, 0.07774, 0, 0.27778],
    730: [0, 0.69444, 0, 0, 0.73752],
    732: [0, 0.67659, 0.08826, 0, 0.5],
    733: [0, 0.69444, 0.09205, 0, 0.5],
    915: [0, 0.69444, 0.13372, 0, 0.54167],
    916: [0, 0.69444, 0, 0, 0.83334],
    920: [0, 0.69444, 0.07555, 0, 0.77778],
    923: [0, 0.69444, 0, 0, 0.61111],
    926: [0, 0.69444, 0.12816, 0, 0.66667],
    928: [0, 0.69444, 0.08094, 0, 0.70834],
    931: [0, 0.69444, 0.11983, 0, 0.72222],
    933: [0, 0.69444, 0.09031, 0, 0.77778],
    934: [0, 0.69444, 0.04603, 0, 0.72222],
    936: [0, 0.69444, 0.09031, 0, 0.77778],
    937: [0, 0.69444, 0.08293, 0, 0.72222],
    8211: [0, 0.44444, 0.08616, 0, 0.5],
    8212: [0, 0.44444, 0.08616, 0, 1],
    8216: [0, 0.69444, 0.07816, 0, 0.27778],
    8217: [0, 0.69444, 0.07816, 0, 0.27778],
    8220: [0, 0.69444, 0.14205, 0, 0.5],
    8221: [0, 0.69444, 316e-5, 0, 0.5]
  },
  "SansSerif-Regular": {
    32: [0, 0, 0, 0, 0.25],
    33: [0, 0.69444, 0, 0, 0.31945],
    34: [0, 0.69444, 0, 0, 0.5],
    35: [0.19444, 0.69444, 0, 0, 0.83334],
    36: [0.05556, 0.75, 0, 0, 0.5],
    37: [0.05556, 0.75, 0, 0, 0.83334],
    38: [0, 0.69444, 0, 0, 0.75834],
    39: [0, 0.69444, 0, 0, 0.27778],
    40: [0.25, 0.75, 0, 0, 0.38889],
    41: [0.25, 0.75, 0, 0, 0.38889],
    42: [0, 0.75, 0, 0, 0.5],
    43: [0.08333, 0.58333, 0, 0, 0.77778],
    44: [0.125, 0.08333, 0, 0, 0.27778],
    45: [0, 0.44444, 0, 0, 0.33333],
    46: [0, 0.08333, 0, 0, 0.27778],
    47: [0.25, 0.75, 0, 0, 0.5],
    48: [0, 0.65556, 0, 0, 0.5],
    49: [0, 0.65556, 0, 0, 0.5],
    50: [0, 0.65556, 0, 0, 0.5],
    51: [0, 0.65556, 0, 0, 0.5],
    52: [0, 0.65556, 0, 0, 0.5],
    53: [0, 0.65556, 0, 0, 0.5],
    54: [0, 0.65556, 0, 0, 0.5],
    55: [0, 0.65556, 0, 0, 0.5],
    56: [0, 0.65556, 0, 0, 0.5],
    57: [0, 0.65556, 0, 0, 0.5],
    58: [0, 0.44444, 0, 0, 0.27778],
    59: [0.125, 0.44444, 0, 0, 0.27778],
    61: [-0.13, 0.37, 0, 0, 0.77778],
    63: [0, 0.69444, 0, 0, 0.47222],
    64: [0, 0.69444, 0, 0, 0.66667],
    65: [0, 0.69444, 0, 0, 0.66667],
    66: [0, 0.69444, 0, 0, 0.66667],
    67: [0, 0.69444, 0, 0, 0.63889],
    68: [0, 0.69444, 0, 0, 0.72223],
    69: [0, 0.69444, 0, 0, 0.59722],
    70: [0, 0.69444, 0, 0, 0.56945],
    71: [0, 0.69444, 0, 0, 0.66667],
    72: [0, 0.69444, 0, 0, 0.70834],
    73: [0, 0.69444, 0, 0, 0.27778],
    74: [0, 0.69444, 0, 0, 0.47222],
    75: [0, 0.69444, 0, 0, 0.69445],
    76: [0, 0.69444, 0, 0, 0.54167],
    77: [0, 0.69444, 0, 0, 0.875],
    78: [0, 0.69444, 0, 0, 0.70834],
    79: [0, 0.69444, 0, 0, 0.73611],
    80: [0, 0.69444, 0, 0, 0.63889],
    81: [0.125, 0.69444, 0, 0, 0.73611],
    82: [0, 0.69444, 0, 0, 0.64584],
    83: [0, 0.69444, 0, 0, 0.55556],
    84: [0, 0.69444, 0, 0, 0.68056],
    85: [0, 0.69444, 0, 0, 0.6875],
    86: [0, 0.69444, 0.01389, 0, 0.66667],
    87: [0, 0.69444, 0.01389, 0, 0.94445],
    88: [0, 0.69444, 0, 0, 0.66667],
    89: [0, 0.69444, 0.025, 0, 0.66667],
    90: [0, 0.69444, 0, 0, 0.61111],
    91: [0.25, 0.75, 0, 0, 0.28889],
    93: [0.25, 0.75, 0, 0, 0.28889],
    94: [0, 0.69444, 0, 0, 0.5],
    95: [0.35, 0.09444, 0.02778, 0, 0.5],
    97: [0, 0.44444, 0, 0, 0.48056],
    98: [0, 0.69444, 0, 0, 0.51667],
    99: [0, 0.44444, 0, 0, 0.44445],
    100: [0, 0.69444, 0, 0, 0.51667],
    101: [0, 0.44444, 0, 0, 0.44445],
    102: [0, 0.69444, 0.06944, 0, 0.30556],
    103: [0.19444, 0.44444, 0.01389, 0, 0.5],
    104: [0, 0.69444, 0, 0, 0.51667],
    105: [0, 0.67937, 0, 0, 0.23889],
    106: [0.19444, 0.67937, 0, 0, 0.26667],
    107: [0, 0.69444, 0, 0, 0.48889],
    108: [0, 0.69444, 0, 0, 0.23889],
    109: [0, 0.44444, 0, 0, 0.79445],
    110: [0, 0.44444, 0, 0, 0.51667],
    111: [0, 0.44444, 0, 0, 0.5],
    112: [0.19444, 0.44444, 0, 0, 0.51667],
    113: [0.19444, 0.44444, 0, 0, 0.51667],
    114: [0, 0.44444, 0.01389, 0, 0.34167],
    115: [0, 0.44444, 0, 0, 0.38333],
    116: [0, 0.57143, 0, 0, 0.36111],
    117: [0, 0.44444, 0, 0, 0.51667],
    118: [0, 0.44444, 0.01389, 0, 0.46111],
    119: [0, 0.44444, 0.01389, 0, 0.68334],
    120: [0, 0.44444, 0, 0, 0.46111],
    121: [0.19444, 0.44444, 0.01389, 0, 0.46111],
    122: [0, 0.44444, 0, 0, 0.43472],
    126: [0.35, 0.32659, 0, 0, 0.5],
    160: [0, 0, 0, 0, 0.25],
    168: [0, 0.67937, 0, 0, 0.5],
    176: [0, 0.69444, 0, 0, 0.66667],
    184: [0.17014, 0, 0, 0, 0.44445],
    305: [0, 0.44444, 0, 0, 0.23889],
    567: [0.19444, 0.44444, 0, 0, 0.26667],
    710: [0, 0.69444, 0, 0, 0.5],
    711: [0, 0.63194, 0, 0, 0.5],
    713: [0, 0.60889, 0, 0, 0.5],
    714: [0, 0.69444, 0, 0, 0.5],
    715: [0, 0.69444, 0, 0, 0.5],
    728: [0, 0.69444, 0, 0, 0.5],
    729: [0, 0.67937, 0, 0, 0.27778],
    730: [0, 0.69444, 0, 0, 0.66667],
    732: [0, 0.67659, 0, 0, 0.5],
    733: [0, 0.69444, 0, 0, 0.5],
    915: [0, 0.69444, 0, 0, 0.54167],
    916: [0, 0.69444, 0, 0, 0.83334],
    920: [0, 0.69444, 0, 0, 0.77778],
    923: [0, 0.69444, 0, 0, 0.61111],
    926: [0, 0.69444, 0, 0, 0.66667],
    928: [0, 0.69444, 0, 0, 0.70834],
    931: [0, 0.69444, 0, 0, 0.72222],
    933: [0, 0.69444, 0, 0, 0.77778],
    934: [0, 0.69444, 0, 0, 0.72222],
    936: [0, 0.69444, 0, 0, 0.77778],
    937: [0, 0.69444, 0, 0, 0.72222],
    8211: [0, 0.44444, 0.02778, 0, 0.5],
    8212: [0, 0.44444, 0.02778, 0, 1],
    8216: [0, 0.69444, 0, 0, 0.27778],
    8217: [0, 0.69444, 0, 0, 0.27778],
    8220: [0, 0.69444, 0, 0, 0.5],
    8221: [0, 0.69444, 0, 0, 0.5]
  },
  "Script-Regular": {
    32: [0, 0, 0, 0, 0.25],
    65: [0, 0.7, 0.22925, 0, 0.80253],
    66: [0, 0.7, 0.04087, 0, 0.90757],
    67: [0, 0.7, 0.1689, 0, 0.66619],
    68: [0, 0.7, 0.09371, 0, 0.77443],
    69: [0, 0.7, 0.18583, 0, 0.56162],
    70: [0, 0.7, 0.13634, 0, 0.89544],
    71: [0, 0.7, 0.17322, 0, 0.60961],
    72: [0, 0.7, 0.29694, 0, 0.96919],
    73: [0, 0.7, 0.19189, 0, 0.80907],
    74: [0.27778, 0.7, 0.19189, 0, 1.05159],
    75: [0, 0.7, 0.31259, 0, 0.91364],
    76: [0, 0.7, 0.19189, 0, 0.87373],
    77: [0, 0.7, 0.15981, 0, 1.08031],
    78: [0, 0.7, 0.3525, 0, 0.9015],
    79: [0, 0.7, 0.08078, 0, 0.73787],
    80: [0, 0.7, 0.08078, 0, 1.01262],
    81: [0, 0.7, 0.03305, 0, 0.88282],
    82: [0, 0.7, 0.06259, 0, 0.85],
    83: [0, 0.7, 0.19189, 0, 0.86767],
    84: [0, 0.7, 0.29087, 0, 0.74697],
    85: [0, 0.7, 0.25815, 0, 0.79996],
    86: [0, 0.7, 0.27523, 0, 0.62204],
    87: [0, 0.7, 0.27523, 0, 0.80532],
    88: [0, 0.7, 0.26006, 0, 0.94445],
    89: [0, 0.7, 0.2939, 0, 0.70961],
    90: [0, 0.7, 0.24037, 0, 0.8212],
    160: [0, 0, 0, 0, 0.25]
  },
  "Size1-Regular": {
    32: [0, 0, 0, 0, 0.25],
    40: [0.35001, 0.85, 0, 0, 0.45834],
    41: [0.35001, 0.85, 0, 0, 0.45834],
    47: [0.35001, 0.85, 0, 0, 0.57778],
    91: [0.35001, 0.85, 0, 0, 0.41667],
    92: [0.35001, 0.85, 0, 0, 0.57778],
    93: [0.35001, 0.85, 0, 0, 0.41667],
    123: [0.35001, 0.85, 0, 0, 0.58334],
    125: [0.35001, 0.85, 0, 0, 0.58334],
    160: [0, 0, 0, 0, 0.25],
    710: [0, 0.72222, 0, 0, 0.55556],
    732: [0, 0.72222, 0, 0, 0.55556],
    770: [0, 0.72222, 0, 0, 0.55556],
    771: [0, 0.72222, 0, 0, 0.55556],
    8214: [-99e-5, 0.601, 0, 0, 0.77778],
    8593: [1e-5, 0.6, 0, 0, 0.66667],
    8595: [1e-5, 0.6, 0, 0, 0.66667],
    8657: [1e-5, 0.6, 0, 0, 0.77778],
    8659: [1e-5, 0.6, 0, 0, 0.77778],
    8719: [0.25001, 0.75, 0, 0, 0.94445],
    8720: [0.25001, 0.75, 0, 0, 0.94445],
    8721: [0.25001, 0.75, 0, 0, 1.05556],
    8730: [0.35001, 0.85, 0, 0, 1],
    8739: [-599e-5, 0.606, 0, 0, 0.33333],
    8741: [-599e-5, 0.606, 0, 0, 0.55556],
    8747: [0.30612, 0.805, 0.19445, 0, 0.47222],
    8748: [0.306, 0.805, 0.19445, 0, 0.47222],
    8749: [0.306, 0.805, 0.19445, 0, 0.47222],
    8750: [0.30612, 0.805, 0.19445, 0, 0.47222],
    8896: [0.25001, 0.75, 0, 0, 0.83334],
    8897: [0.25001, 0.75, 0, 0, 0.83334],
    8898: [0.25001, 0.75, 0, 0, 0.83334],
    8899: [0.25001, 0.75, 0, 0, 0.83334],
    8968: [0.35001, 0.85, 0, 0, 0.47222],
    8969: [0.35001, 0.85, 0, 0, 0.47222],
    8970: [0.35001, 0.85, 0, 0, 0.47222],
    8971: [0.35001, 0.85, 0, 0, 0.47222],
    9168: [-99e-5, 0.601, 0, 0, 0.66667],
    10216: [0.35001, 0.85, 0, 0, 0.47222],
    10217: [0.35001, 0.85, 0, 0, 0.47222],
    10752: [0.25001, 0.75, 0, 0, 1.11111],
    10753: [0.25001, 0.75, 0, 0, 1.11111],
    10754: [0.25001, 0.75, 0, 0, 1.11111],
    10756: [0.25001, 0.75, 0, 0, 0.83334],
    10758: [0.25001, 0.75, 0, 0, 0.83334]
  },
  "Size2-Regular": {
    32: [0, 0, 0, 0, 0.25],
    40: [0.65002, 1.15, 0, 0, 0.59722],
    41: [0.65002, 1.15, 0, 0, 0.59722],
    47: [0.65002, 1.15, 0, 0, 0.81111],
    91: [0.65002, 1.15, 0, 0, 0.47222],
    92: [0.65002, 1.15, 0, 0, 0.81111],
    93: [0.65002, 1.15, 0, 0, 0.47222],
    123: [0.65002, 1.15, 0, 0, 0.66667],
    125: [0.65002, 1.15, 0, 0, 0.66667],
    160: [0, 0, 0, 0, 0.25],
    710: [0, 0.75, 0, 0, 1],
    732: [0, 0.75, 0, 0, 1],
    770: [0, 0.75, 0, 0, 1],
    771: [0, 0.75, 0, 0, 1],
    8719: [0.55001, 1.05, 0, 0, 1.27778],
    8720: [0.55001, 1.05, 0, 0, 1.27778],
    8721: [0.55001, 1.05, 0, 0, 1.44445],
    8730: [0.65002, 1.15, 0, 0, 1],
    8747: [0.86225, 1.36, 0.44445, 0, 0.55556],
    8748: [0.862, 1.36, 0.44445, 0, 0.55556],
    8749: [0.862, 1.36, 0.44445, 0, 0.55556],
    8750: [0.86225, 1.36, 0.44445, 0, 0.55556],
    8896: [0.55001, 1.05, 0, 0, 1.11111],
    8897: [0.55001, 1.05, 0, 0, 1.11111],
    8898: [0.55001, 1.05, 0, 0, 1.11111],
    8899: [0.55001, 1.05, 0, 0, 1.11111],
    8968: [0.65002, 1.15, 0, 0, 0.52778],
    8969: [0.65002, 1.15, 0, 0, 0.52778],
    8970: [0.65002, 1.15, 0, 0, 0.52778],
    8971: [0.65002, 1.15, 0, 0, 0.52778],
    10216: [0.65002, 1.15, 0, 0, 0.61111],
    10217: [0.65002, 1.15, 0, 0, 0.61111],
    10752: [0.55001, 1.05, 0, 0, 1.51112],
    10753: [0.55001, 1.05, 0, 0, 1.51112],
    10754: [0.55001, 1.05, 0, 0, 1.51112],
    10756: [0.55001, 1.05, 0, 0, 1.11111],
    10758: [0.55001, 1.05, 0, 0, 1.11111]
  },
  "Size3-Regular": {
    32: [0, 0, 0, 0, 0.25],
    40: [0.95003, 1.45, 0, 0, 0.73611],
    41: [0.95003, 1.45, 0, 0, 0.73611],
    47: [0.95003, 1.45, 0, 0, 1.04445],
    91: [0.95003, 1.45, 0, 0, 0.52778],
    92: [0.95003, 1.45, 0, 0, 1.04445],
    93: [0.95003, 1.45, 0, 0, 0.52778],
    123: [0.95003, 1.45, 0, 0, 0.75],
    125: [0.95003, 1.45, 0, 0, 0.75],
    160: [0, 0, 0, 0, 0.25],
    710: [0, 0.75, 0, 0, 1.44445],
    732: [0, 0.75, 0, 0, 1.44445],
    770: [0, 0.75, 0, 0, 1.44445],
    771: [0, 0.75, 0, 0, 1.44445],
    8730: [0.95003, 1.45, 0, 0, 1],
    8968: [0.95003, 1.45, 0, 0, 0.58334],
    8969: [0.95003, 1.45, 0, 0, 0.58334],
    8970: [0.95003, 1.45, 0, 0, 0.58334],
    8971: [0.95003, 1.45, 0, 0, 0.58334],
    10216: [0.95003, 1.45, 0, 0, 0.75],
    10217: [0.95003, 1.45, 0, 0, 0.75]
  },
  "Size4-Regular": {
    32: [0, 0, 0, 0, 0.25],
    40: [1.25003, 1.75, 0, 0, 0.79167],
    41: [1.25003, 1.75, 0, 0, 0.79167],
    47: [1.25003, 1.75, 0, 0, 1.27778],
    91: [1.25003, 1.75, 0, 0, 0.58334],
    92: [1.25003, 1.75, 0, 0, 1.27778],
    93: [1.25003, 1.75, 0, 0, 0.58334],
    123: [1.25003, 1.75, 0, 0, 0.80556],
    125: [1.25003, 1.75, 0, 0, 0.80556],
    160: [0, 0, 0, 0, 0.25],
    710: [0, 0.825, 0, 0, 1.8889],
    732: [0, 0.825, 0, 0, 1.8889],
    770: [0, 0.825, 0, 0, 1.8889],
    771: [0, 0.825, 0, 0, 1.8889],
    8730: [1.25003, 1.75, 0, 0, 1],
    8968: [1.25003, 1.75, 0, 0, 0.63889],
    8969: [1.25003, 1.75, 0, 0, 0.63889],
    8970: [1.25003, 1.75, 0, 0, 0.63889],
    8971: [1.25003, 1.75, 0, 0, 0.63889],
    9115: [0.64502, 1.155, 0, 0, 0.875],
    9116: [1e-5, 0.6, 0, 0, 0.875],
    9117: [0.64502, 1.155, 0, 0, 0.875],
    9118: [0.64502, 1.155, 0, 0, 0.875],
    9119: [1e-5, 0.6, 0, 0, 0.875],
    9120: [0.64502, 1.155, 0, 0, 0.875],
    9121: [0.64502, 1.155, 0, 0, 0.66667],
    9122: [-99e-5, 0.601, 0, 0, 0.66667],
    9123: [0.64502, 1.155, 0, 0, 0.66667],
    9124: [0.64502, 1.155, 0, 0, 0.66667],
    9125: [-99e-5, 0.601, 0, 0, 0.66667],
    9126: [0.64502, 1.155, 0, 0, 0.66667],
    9127: [1e-5, 0.9, 0, 0, 0.88889],
    9128: [0.65002, 1.15, 0, 0, 0.88889],
    9129: [0.90001, 0, 0, 0, 0.88889],
    9130: [0, 0.3, 0, 0, 0.88889],
    9131: [1e-5, 0.9, 0, 0, 0.88889],
    9132: [0.65002, 1.15, 0, 0, 0.88889],
    9133: [0.90001, 0, 0, 0, 0.88889],
    9143: [0.88502, 0.915, 0, 0, 1.05556],
    10216: [1.25003, 1.75, 0, 0, 0.80556],
    10217: [1.25003, 1.75, 0, 0, 0.80556],
    57344: [-499e-5, 0.605, 0, 0, 1.05556],
    57345: [-499e-5, 0.605, 0, 0, 1.05556],
    57680: [0, 0.12, 0, 0, 0.45],
    57681: [0, 0.12, 0, 0, 0.45],
    57682: [0, 0.12, 0, 0, 0.45],
    57683: [0, 0.12, 0, 0, 0.45]
  },
  "Typewriter-Regular": {
    32: [0, 0, 0, 0, 0.525],
    33: [0, 0.61111, 0, 0, 0.525],
    34: [0, 0.61111, 0, 0, 0.525],
    35: [0, 0.61111, 0, 0, 0.525],
    36: [0.08333, 0.69444, 0, 0, 0.525],
    37: [0.08333, 0.69444, 0, 0, 0.525],
    38: [0, 0.61111, 0, 0, 0.525],
    39: [0, 0.61111, 0, 0, 0.525],
    40: [0.08333, 0.69444, 0, 0, 0.525],
    41: [0.08333, 0.69444, 0, 0, 0.525],
    42: [0, 0.52083, 0, 0, 0.525],
    43: [-0.08056, 0.53055, 0, 0, 0.525],
    44: [0.13889, 0.125, 0, 0, 0.525],
    45: [-0.08056, 0.53055, 0, 0, 0.525],
    46: [0, 0.125, 0, 0, 0.525],
    47: [0.08333, 0.69444, 0, 0, 0.525],
    48: [0, 0.61111, 0, 0, 0.525],
    49: [0, 0.61111, 0, 0, 0.525],
    50: [0, 0.61111, 0, 0, 0.525],
    51: [0, 0.61111, 0, 0, 0.525],
    52: [0, 0.61111, 0, 0, 0.525],
    53: [0, 0.61111, 0, 0, 0.525],
    54: [0, 0.61111, 0, 0, 0.525],
    55: [0, 0.61111, 0, 0, 0.525],
    56: [0, 0.61111, 0, 0, 0.525],
    57: [0, 0.61111, 0, 0, 0.525],
    58: [0, 0.43056, 0, 0, 0.525],
    59: [0.13889, 0.43056, 0, 0, 0.525],
    60: [-0.05556, 0.55556, 0, 0, 0.525],
    61: [-0.19549, 0.41562, 0, 0, 0.525],
    62: [-0.05556, 0.55556, 0, 0, 0.525],
    63: [0, 0.61111, 0, 0, 0.525],
    64: [0, 0.61111, 0, 0, 0.525],
    65: [0, 0.61111, 0, 0, 0.525],
    66: [0, 0.61111, 0, 0, 0.525],
    67: [0, 0.61111, 0, 0, 0.525],
    68: [0, 0.61111, 0, 0, 0.525],
    69: [0, 0.61111, 0, 0, 0.525],
    70: [0, 0.61111, 0, 0, 0.525],
    71: [0, 0.61111, 0, 0, 0.525],
    72: [0, 0.61111, 0, 0, 0.525],
    73: [0, 0.61111, 0, 0, 0.525],
    74: [0, 0.61111, 0, 0, 0.525],
    75: [0, 0.61111, 0, 0, 0.525],
    76: [0, 0.61111, 0, 0, 0.525],
    77: [0, 0.61111, 0, 0, 0.525],
    78: [0, 0.61111, 0, 0, 0.525],
    79: [0, 0.61111, 0, 0, 0.525],
    80: [0, 0.61111, 0, 0, 0.525],
    81: [0.13889, 0.61111, 0, 0, 0.525],
    82: [0, 0.61111, 0, 0, 0.525],
    83: [0, 0.61111, 0, 0, 0.525],
    84: [0, 0.61111, 0, 0, 0.525],
    85: [0, 0.61111, 0, 0, 0.525],
    86: [0, 0.61111, 0, 0, 0.525],
    87: [0, 0.61111, 0, 0, 0.525],
    88: [0, 0.61111, 0, 0, 0.525],
    89: [0, 0.61111, 0, 0, 0.525],
    90: [0, 0.61111, 0, 0, 0.525],
    91: [0.08333, 0.69444, 0, 0, 0.525],
    92: [0.08333, 0.69444, 0, 0, 0.525],
    93: [0.08333, 0.69444, 0, 0, 0.525],
    94: [0, 0.61111, 0, 0, 0.525],
    95: [0.09514, 0, 0, 0, 0.525],
    96: [0, 0.61111, 0, 0, 0.525],
    97: [0, 0.43056, 0, 0, 0.525],
    98: [0, 0.61111, 0, 0, 0.525],
    99: [0, 0.43056, 0, 0, 0.525],
    100: [0, 0.61111, 0, 0, 0.525],
    101: [0, 0.43056, 0, 0, 0.525],
    102: [0, 0.61111, 0, 0, 0.525],
    103: [0.22222, 0.43056, 0, 0, 0.525],
    104: [0, 0.61111, 0, 0, 0.525],
    105: [0, 0.61111, 0, 0, 0.525],
    106: [0.22222, 0.61111, 0, 0, 0.525],
    107: [0, 0.61111, 0, 0, 0.525],
    108: [0, 0.61111, 0, 0, 0.525],
    109: [0, 0.43056, 0, 0, 0.525],
    110: [0, 0.43056, 0, 0, 0.525],
    111: [0, 0.43056, 0, 0, 0.525],
    112: [0.22222, 0.43056, 0, 0, 0.525],
    113: [0.22222, 0.43056, 0, 0, 0.525],
    114: [0, 0.43056, 0, 0, 0.525],
    115: [0, 0.43056, 0, 0, 0.525],
    116: [0, 0.55358, 0, 0, 0.525],
    117: [0, 0.43056, 0, 0, 0.525],
    118: [0, 0.43056, 0, 0, 0.525],
    119: [0, 0.43056, 0, 0, 0.525],
    120: [0, 0.43056, 0, 0, 0.525],
    121: [0.22222, 0.43056, 0, 0, 0.525],
    122: [0, 0.43056, 0, 0, 0.525],
    123: [0.08333, 0.69444, 0, 0, 0.525],
    124: [0.08333, 0.69444, 0, 0, 0.525],
    125: [0.08333, 0.69444, 0, 0, 0.525],
    126: [0, 0.61111, 0, 0, 0.525],
    127: [0, 0.61111, 0, 0, 0.525],
    160: [0, 0, 0, 0, 0.525],
    176: [0, 0.61111, 0, 0, 0.525],
    184: [0.19445, 0, 0, 0, 0.525],
    305: [0, 0.43056, 0, 0, 0.525],
    567: [0.22222, 0.43056, 0, 0, 0.525],
    711: [0, 0.56597, 0, 0, 0.525],
    713: [0, 0.56555, 0, 0, 0.525],
    714: [0, 0.61111, 0, 0, 0.525],
    715: [0, 0.61111, 0, 0, 0.525],
    728: [0, 0.61111, 0, 0, 0.525],
    730: [0, 0.61111, 0, 0, 0.525],
    770: [0, 0.61111, 0, 0, 0.525],
    771: [0, 0.61111, 0, 0, 0.525],
    776: [0, 0.61111, 0, 0, 0.525],
    915: [0, 0.61111, 0, 0, 0.525],
    916: [0, 0.61111, 0, 0, 0.525],
    920: [0, 0.61111, 0, 0, 0.525],
    923: [0, 0.61111, 0, 0, 0.525],
    926: [0, 0.61111, 0, 0, 0.525],
    928: [0, 0.61111, 0, 0, 0.525],
    931: [0, 0.61111, 0, 0, 0.525],
    933: [0, 0.61111, 0, 0, 0.525],
    934: [0, 0.61111, 0, 0, 0.525],
    936: [0, 0.61111, 0, 0, 0.525],
    937: [0, 0.61111, 0, 0, 0.525],
    8216: [0, 0.61111, 0, 0, 0.525],
    8217: [0, 0.61111, 0, 0, 0.525],
    8242: [0, 0.61111, 0, 0, 0.525],
    9251: [0.11111, 0.21944, 0, 0, 0.525]
  }
}, sigmasAndXis = {
  slant: [0.25, 0.25, 0.25],
  // sigma1
  space: [0, 0, 0],
  // sigma2
  stretch: [0, 0, 0],
  // sigma3
  shrink: [0, 0, 0],
  // sigma4
  xHeight: [0.431, 0.431, 0.431],
  // sigma5
  quad: [1, 1.171, 1.472],
  // sigma6
  extraSpace: [0, 0, 0],
  // sigma7
  num1: [0.677, 0.732, 0.925],
  // sigma8
  num2: [0.394, 0.384, 0.387],
  // sigma9
  num3: [0.444, 0.471, 0.504],
  // sigma10
  denom1: [0.686, 0.752, 1.025],
  // sigma11
  denom2: [0.345, 0.344, 0.532],
  // sigma12
  sup1: [0.413, 0.503, 0.504],
  // sigma13
  sup2: [0.363, 0.431, 0.404],
  // sigma14
  sup3: [0.289, 0.286, 0.294],
  // sigma15
  sub1: [0.15, 0.143, 0.2],
  // sigma16
  sub2: [0.247, 0.286, 0.4],
  // sigma17
  supDrop: [0.386, 0.353, 0.494],
  // sigma18
  subDrop: [0.05, 0.071, 0.1],
  // sigma19
  delim1: [2.39, 1.7, 1.98],
  // sigma20
  delim2: [1.01, 1.157, 1.42],
  // sigma21
  axisHeight: [0.25, 0.25, 0.25],
  // sigma22
  // These font metrics are extracted from TeX by using tftopl on cmex10.tfm;
  // they correspond to the font parameters of the extension fonts (family 3).
  // See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to
  // match cmex7, we'd use cmex7.tfm values for script and scriptscript
  // values.
  defaultRuleThickness: [0.04, 0.049, 0.049],
  // xi8; cmex7: 0.049
  bigOpSpacing1: [0.111, 0.111, 0.111],
  // xi9
  bigOpSpacing2: [0.166, 0.166, 0.166],
  // xi10
  bigOpSpacing3: [0.2, 0.2, 0.2],
  // xi11
  bigOpSpacing4: [0.6, 0.611, 0.611],
  // xi12; cmex7: 0.611
  bigOpSpacing5: [0.1, 0.143, 0.143],
  // xi13; cmex7: 0.143
  // The \sqrt rule width is taken from the height of the surd character.
  // Since we use the same font at all sizes, this thickness doesn't scale.
  sqrtRuleThickness: [0.04, 0.04, 0.04],
  // This value determines how large a pt is, for metrics which are defined
  // in terms of pts.
  // This value is also used in katex.scss; if you change it make sure the
  // values match.
  ptPerEm: [10, 10, 10],
  // The space between adjacent `|` columns in an array definition. From
  // `\showthe\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm.
  doubleRuleSep: [0.2, 0.2, 0.2],
  // The width of separator lines in {array} environments. From
  // `\showthe\arrayrulewidth` in LaTeX. Equals 0.4 / ptPerEm.
  arrayRuleWidth: [0.04, 0.04, 0.04],
  // Two values from LaTeX source2e:
  fboxsep: [0.3, 0.3, 0.3],
  //        3 pt / ptPerEm
  fboxrule: [0.04, 0.04, 0.04]
  // 0.4 pt / ptPerEm
}, extraCharacterMap = {
  // Latin-1
  Å: "A",
  Ð: "D",
  Þ: "o",
  å: "a",
  ð: "d",
  þ: "o",
  // Cyrillic
  А: "A",
  Б: "B",
  В: "B",
  Г: "F",
  Д: "A",
  Е: "E",
  Ж: "K",
  З: "3",
  И: "N",
  Й: "N",
  К: "K",
  Л: "N",
  М: "M",
  Н: "H",
  О: "O",
  П: "N",
  Р: "P",
  С: "C",
  Т: "T",
  У: "y",
  Ф: "O",
  Х: "X",
  Ц: "U",
  Ч: "h",
  Ш: "W",
  Щ: "W",
  Ъ: "B",
  Ы: "X",
  Ь: "B",
  Э: "3",
  Ю: "X",
  Я: "R",
  а: "a",
  б: "b",
  в: "a",
  г: "r",
  д: "y",
  е: "e",
  ж: "m",
  з: "e",
  и: "n",
  й: "n",
  к: "n",
  л: "n",
  м: "m",
  н: "n",
  о: "o",
  п: "n",
  р: "p",
  с: "c",
  т: "o",
  у: "y",
  ф: "b",
  х: "x",
  ц: "n",
  ч: "n",
  ш: "w",
  щ: "w",
  ъ: "a",
  ы: "m",
  ь: "a",
  э: "e",
  ю: "m",
  я: "r"
};
function setFontMetrics(s, e) {
  fontMetricsData[s] = e;
}
function getCharacterMetrics(s, e, r) {
  if (!fontMetricsData[e])
    throw new Error("Font metrics not found for font: " + e + ".");
  var o = s.charCodeAt(0), m = fontMetricsData[e][o];
  if (!m && s[0] in extraCharacterMap && (o = extraCharacterMap[s[0]].charCodeAt(0), m = fontMetricsData[e][o]), !m && r === "text" && supportedCodepoint(o) && (m = fontMetricsData[e][77]), m)
    return {
      depth: m[0],
      height: m[1],
      italic: m[2],
      skew: m[3],
      width: m[4]
    };
}
var fontMetricsBySizeIndex = {};
function getGlobalMetrics(s) {
  var e;
  if (s >= 5 ? e = 0 : s >= 3 ? e = 1 : e = 2, !fontMetricsBySizeIndex[e]) {
    var r = fontMetricsBySizeIndex[e] = {
      cssEmPerMu: sigmasAndXis.quad[e] / 18
    };
    for (var o in sigmasAndXis)
      sigmasAndXis.hasOwnProperty(o) && (r[o] = sigmasAndXis[o][e]);
  }
  return fontMetricsBySizeIndex[e];
}
var sizeStyleMap = [
  // Each element contains [textsize, scriptsize, scriptscriptsize].
  // The size mappings are taken from TeX with \normalsize=10pt.
  [1, 1, 1],
  // size1: [5, 5, 5]              \tiny
  [2, 1, 1],
  // size2: [6, 5, 5]
  [3, 1, 1],
  // size3: [7, 5, 5]              \scriptsize
  [4, 2, 1],
  // size4: [8, 6, 5]              \footnotesize
  [5, 2, 1],
  // size5: [9, 6, 5]              \small
  [6, 3, 1],
  // size6: [10, 7, 5]             \normalsize
  [7, 4, 2],
  // size7: [12, 8, 6]             \large
  [8, 6, 3],
  // size8: [14.4, 10, 7]          \Large
  [9, 7, 6],
  // size9: [17.28, 12, 10]        \LARGE
  [10, 8, 7],
  // size10: [20.74, 14.4, 12]     \huge
  [11, 10, 9]
  // size11: [24.88, 20.74, 17.28] \HUGE
], sizeMultipliers = [
  // fontMetrics.js:getGlobalMetrics also uses size indexes, so if
  // you change size indexes, change that function.
  0.5,
  0.6,
  0.7,
  0.8,
  0.9,
  1,
  1.2,
  1.44,
  1.728,
  2.074,
  2.488
], sizeAtStyle = function(e, r) {
  return r.size < 2 ? e : sizeStyleMap[e - 1][r.size - 1];
};
class Options {
  // A font family applies to a group of fonts (i.e. SansSerif), while a font
  // represents a specific font (i.e. SansSerif Bold).
  // See: https://tex.stackexchange.com/questions/22350/difference-between-textrm-and-mathrm
  /**
   * The base size index.
   */
  constructor(e) {
    this.style = void 0, this.color = void 0, this.size = void 0, this.textSize = void 0, this.phantom = void 0, this.font = void 0, this.fontFamily = void 0, this.fontWeight = void 0, this.fontShape = void 0, this.sizeMultiplier = void 0, this.maxSize = void 0, this.minRuleThickness = void 0, this._fontMetrics = void 0, this.style = e.style, this.color = e.color, this.size = e.size || Options.BASESIZE, this.textSize = e.textSize || this.size, this.phantom = !!e.phantom, this.font = e.font || "", this.fontFamily = e.fontFamily || "", this.fontWeight = e.fontWeight || "", this.fontShape = e.fontShape || "", this.sizeMultiplier = sizeMultipliers[this.size - 1], this.maxSize = e.maxSize, this.minRuleThickness = e.minRuleThickness, this._fontMetrics = void 0;
  }
  /**
   * Returns a new options object with the same properties as "this".  Properties
   * from "extension" will be copied to the new options object.
   */
  extend(e) {
    var r = {
      style: this.style,
      size: this.size,
      textSize: this.textSize,
      color: this.color,
      phantom: this.phantom,
      font: this.font,
      fontFamily: this.fontFamily,
      fontWeight: this.fontWeight,
      fontShape: this.fontShape,
      maxSize: this.maxSize,
      minRuleThickness: this.minRuleThickness
    };
    for (var o in e)
      e.hasOwnProperty(o) && (r[o] = e[o]);
    return new Options(r);
  }
  /**
   * Return an options object with the given style. If `this.style === style`,
   * returns `this`.
   */
  havingStyle(e) {
    return this.style === e ? this : this.extend({
      style: e,
      size: sizeAtStyle(this.textSize, e)
    });
  }
  /**
   * Return an options object with a cramped version of the current style. If
   * the current style is cramped, returns `this`.
   */
  havingCrampedStyle() {
    return this.havingStyle(this.style.cramp());
  }
  /**
   * Return an options object with the given size and in at least `\textstyle`.
   * Returns `this` if appropriate.
   */
  havingSize(e) {
    return this.size === e && this.textSize === e ? this : this.extend({
      style: this.style.text(),
      size: e,
      textSize: e,
      sizeMultiplier: sizeMultipliers[e - 1]
    });
  }
  /**
   * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted,
   * changes to at least `\textstyle`.
   */
  havingBaseStyle(e) {
    e = e || this.style.text();
    var r = sizeAtStyle(Options.BASESIZE, e);
    return this.size === r && this.textSize === Options.BASESIZE && this.style === e ? this : this.extend({
      style: e,
      size: r
    });
  }
  /**
   * Remove the effect of sizing changes such as \Huge.
   * Keep the effect of the current style, such as \scriptstyle.
   */
  havingBaseSizing() {
    var e;
    switch (this.style.id) {
      case 4:
      case 5:
        e = 3;
        break;
      case 6:
      case 7:
        e = 1;
        break;
      default:
        e = 6;
    }
    return this.extend({
      style: this.style.text(),
      size: e
    });
  }
  /**
   * Create a new options object with the given color.
   */
  withColor(e) {
    return this.extend({
      color: e
    });
  }
  /**
   * Create a new options object with "phantom" set to true.
   */
  withPhantom() {
    return this.extend({
      phantom: !0
    });
  }
  /**
   * Creates a new options object with the given math font or old text font.
   * @type {[type]}
   */
  withFont(e) {
    return this.extend({
      font: e
    });
  }
  /**
   * Create a new options objects with the given fontFamily.
   */
  withTextFontFamily(e) {
    return this.extend({
      fontFamily: e,
      font: ""
    });
  }
  /**
   * Creates a new options object with the given font weight
   */
  withTextFontWeight(e) {
    return this.extend({
      fontWeight: e,
      font: ""
    });
  }
  /**
   * Creates a new options object with the given font weight
   */
  withTextFontShape(e) {
    return this.extend({
      fontShape: e,
      font: ""
    });
  }
  /**
   * Return the CSS sizing classes required to switch from enclosing options
   * `oldOptions` to `this`. Returns an array of classes.
   */
  sizingClasses(e) {
    return e.size !== this.size ? ["sizing", "reset-size" + e.size, "size" + this.size] : [];
  }
  /**
   * Return the CSS sizing classes required to switch to the base size. Like
   * `this.havingSize(BASESIZE).sizingClasses(this)`.
   */
  baseSizingClasses() {
    return this.size !== Options.BASESIZE ? ["sizing", "reset-size" + this.size, "size" + Options.BASESIZE] : [];
  }
  /**
   * Return the font metrics for this size.
   */
  fontMetrics() {
    return this._fontMetrics || (this._fontMetrics = getGlobalMetrics(this.size)), this._fontMetrics;
  }
  /**
   * Gets the CSS color of the current options object
   */
  getColor() {
    return this.phantom ? "transparent" : this.color;
  }
}
Options.BASESIZE = 6;
var ptPerUnit = {
  // https://en.wikibooks.org/wiki/LaTeX/Lengths and
  // https://tex.stackexchange.com/a/8263
  pt: 1,
  // TeX point
  mm: 7227 / 2540,
  // millimeter
  cm: 7227 / 254,
  // centimeter
  in: 72.27,
  // inch
  bp: 803 / 800,
  // big (PostScript) points
  pc: 12,
  // pica
  dd: 1238 / 1157,
  // didot
  cc: 14856 / 1157,
  // cicero (12 didot)
  nd: 685 / 642,
  // new didot
  nc: 1370 / 107,
  // new cicero (12 new didot)
  sp: 1 / 65536,
  // scaled point (TeX's internal smallest unit)
  // https://tex.stackexchange.com/a/41371
  px: 803 / 800
  // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX
}, relativeUnit = {
  ex: !0,
  em: !0,
  mu: !0
}, validUnit = function(e) {
  return typeof e != "string" && (e = e.unit), e in ptPerUnit || e in relativeUnit || e === "ex";
}, calculateSize$1 = function(e, r) {
  var o;
  if (e.unit in ptPerUnit)
    o = ptPerUnit[e.unit] / r.fontMetrics().ptPerEm / r.sizeMultiplier;
  else if (e.unit === "mu")
    o = r.fontMetrics().cssEmPerMu;
  else {
    var m;
    if (r.style.isTight() ? m = r.havingStyle(r.style.text()) : m = r, e.unit === "ex")
      o = m.fontMetrics().xHeight;
    else if (e.unit === "em")
      o = m.fontMetrics().quad;
    else
      throw new ParseError("Invalid unit: '" + e.unit + "'");
    m !== r && (o *= m.sizeMultiplier / r.sizeMultiplier);
  }
  return Math.min(e.number * o, r.maxSize);
}, makeEm = function(e) {
  return +e.toFixed(4) + "em";
}, createClass = function(e) {
  return e.filter((r) => r).join(" ");
}, initNode = function(e, r, o) {
  if (this.classes = e || [], this.attributes = {}, this.height = 0, this.depth = 0, this.maxFontSize = 0, this.style = o || {}, r) {
    r.style.isTight() && this.classes.push("mtight");
    var m = r.getColor();
    m && (this.style.color = m);
  }
}, toNode = function(e) {
  var r = document.createElement(e);
  r.className = createClass(this.classes);
  for (var o in this.style)
    this.style.hasOwnProperty(o) && (r.style[o] = this.style[o]);
  for (var m in this.attributes)
    this.attributes.hasOwnProperty(m) && r.setAttribute(m, this.attributes[m]);
  for (var _ = 0; _ < this.children.length; _++)
    r.appendChild(this.children[_].toNode());
  return r;
}, invalidAttributeNameRegex = /[\s"'>/=\x00-\x1f]/, toMarkup = function(e) {
  var r = "<" + e;
  this.classes.length && (r += ' class="' + utils.escape(createClass(this.classes)) + '"');
  var o = "";
  for (var m in this.style)
    this.style.hasOwnProperty(m) && (o += utils.hyphenate(m) + ":" + this.style[m] + ";");
  o && (r += ' style="' + utils.escape(o) + '"');
  for (var _ in this.attributes)
    if (this.attributes.hasOwnProperty(_)) {
      if (invalidAttributeNameRegex.test(_))
        throw new ParseError("Invalid attribute name '" + _ + "'");
      r += " " + _ + '="' + utils.escape(this.attributes[_]) + '"';
    }
  r += ">";
  for (var g = 0; g < this.children.length; g++)
    r += this.children[g].toMarkup();
  return r += "</" + e + ">", r;
};
class Span {
  constructor(e, r, o, m) {
    this.children = void 0, this.attributes = void 0, this.classes = void 0, this.height = void 0, this.depth = void 0, this.width = void 0, this.maxFontSize = void 0, this.style = void 0, initNode.call(this, e, o, m), this.children = r || [];
  }
  /**
   * Sets an arbitrary attribute on the span. Warning: use this wisely. Not
   * all browsers support attributes the same, and having too many custom
   * attributes is probably bad.
   */
  setAttribute(e, r) {
    this.attributes[e] = r;
  }
  hasClass(e) {
    return utils.contains(this.classes, e);
  }
  toNode() {
    return toNode.call(this, "span");
  }
  toMarkup() {
    return toMarkup.call(this, "span");
  }
}
class Anchor {
  constructor(e, r, o, m) {
    this.children = void 0, this.attributes = void 0, this.classes = void 0, this.height = void 0, this.depth = void 0, this.maxFontSize = void 0, this.style = void 0, initNode.call(this, r, m), this.children = o || [], this.setAttribute("href", e);
  }
  setAttribute(e, r) {
    this.attributes[e] = r;
  }
  hasClass(e) {
    return utils.contains(this.classes, e);
  }
  toNode() {
    return toNode.call(this, "a");
  }
  toMarkup() {
    return toMarkup.call(this, "a");
  }
}
class Img {
  constructor(e, r, o) {
    this.src = void 0, this.alt = void 0, this.classes = void 0, this.height = void 0, this.depth = void 0, this.maxFontSize = void 0, this.style = void 0, this.alt = r, this.src = e, this.classes = ["mord"], this.style = o;
  }
  hasClass(e) {
    return utils.contains(this.classes, e);
  }
  toNode() {
    var e = document.createElement("img");
    e.src = this.src, e.alt = this.alt, e.className = "mord";
    for (var r in this.style)
      this.style.hasOwnProperty(r) && (e.style[r] = this.style[r]);
    return e;
  }
  toMarkup() {
    var e = '<img src="' + utils.escape(this.src) + '"' + (' alt="' + utils.escape(this.alt) + '"'), r = "";
    for (var o in this.style)
      this.style.hasOwnProperty(o) && (r += utils.hyphenate(o) + ":" + this.style[o] + ";");
    return r && (e += ' style="' + utils.escape(r) + '"'), e += "'/>", e;
  }
}
var iCombinations = {
  î: "ı̂",
  ï: "ı̈",
  í: "ı́",
  // 'ī': '\u0131\u0304', // enable when we add Extended Latin
  ì: "ı̀"
};
class SymbolNode {
  constructor(e, r, o, m, _, g, y, E) {
    this.text = void 0, this.height = void 0, this.depth = void 0, this.italic = void 0, this.skew = void 0, this.width = void 0, this.maxFontSize = void 0, this.classes = void 0, this.style = void 0, this.text = e, this.height = r || 0, this.depth = o || 0, this.italic = m || 0, this.skew = _ || 0, this.width = g || 0, this.classes = y || [], this.style = E || {}, this.maxFontSize = 0;
    var x = scriptFromCodepoint(this.text.charCodeAt(0));
    x && this.classes.push(x + "_fallback"), /[îïíì]/.test(this.text) && (this.text = iCombinations[this.text]);
  }
  hasClass(e) {
    return utils.contains(this.classes, e);
  }
  /**
   * Creates a text node or span from a symbol node. Note that a span is only
   * created if it is needed.
   */
  toNode() {
    var e = document.createTextNode(this.text), r = null;
    this.italic > 0 && (r = document.createElement("span"), r.style.marginRight = makeEm(this.italic)), this.classes.length > 0 && (r = r || document.createElement("span"), r.className = createClass(this.classes));
    for (var o in this.style)
      this.style.hasOwnProperty(o) && (r = r || document.createElement("span"), r.style[o] = this.style[o]);
    return r ? (r.appendChild(e), r) : e;
  }
  /**
   * Creates markup for a symbol node.
   */
  toMarkup() {
    var e = !1, r = "<span";
    this.classes.length && (e = !0, r += ' class="', r += utils.escape(createClass(this.classes)), r += '"');
    var o = "";
    this.italic > 0 && (o += "margin-right:" + this.italic + "em;");
    for (var m in this.style)
      this.style.hasOwnProperty(m) && (o += utils.hyphenate(m) + ":" + this.style[m] + ";");
    o && (e = !0, r += ' style="' + utils.escape(o) + '"');
    var _ = utils.escape(this.text);
    return e ? (r += ">", r += _, r += "</span>", r) : _;
  }
}
class SvgNode {
  constructor(e, r) {
    this.children = void 0, this.attributes = void 0, this.children = e || [], this.attributes = r || {};
  }
  toNode() {
    var e = "http://www.w3.org/2000/svg", r = document.createElementNS(e, "svg");
    for (var o in this.attributes)
      Object.prototype.hasOwnProperty.call(this.attributes, o) && r.setAttribute(o, this.attributes[o]);
    for (var m = 0; m < this.children.length; m++)
      r.appendChild(this.children[m].toNode());
    return r;
  }
  toMarkup() {
    var e = '<svg xmlns="http://www.w3.org/2000/svg"';
    for (var r in this.attributes)
      Object.prototype.hasOwnProperty.call(this.attributes, r) && (e += " " + r + '="' + utils.escape(this.attributes[r]) + '"');
    e += ">";
    for (var o = 0; o < this.children.length; o++)
      e += this.children[o].toMarkup();
    return e += "</svg>", e;
  }
}
class PathNode {
  constructor(e, r) {
    this.pathName = void 0, this.alternate = void 0, this.pathName = e, this.alternate = r;
  }
  toNode() {
    var e = "http://www.w3.org/2000/svg", r = document.createElementNS(e, "path");
    return this.alternate ? r.setAttribute("d", this.alternate) : r.setAttribute("d", path[this.pathName]), r;
  }
  toMarkup() {
    return this.alternate ? '<path d="' + utils.escape(this.alternate) + '"/>' : '<path d="' + utils.escape(path[this.pathName]) + '"/>';
  }
}
class LineNode {
  constructor(e) {
    this.attributes = void 0, this.attributes = e || {};
  }
  toNode() {
    var e = "http://www.w3.org/2000/svg", r = document.createElementNS(e, "line");
    for (var o in this.attributes)
      Object.prototype.hasOwnProperty.call(this.attributes, o) && r.setAttribute(o, this.attributes[o]);
    return r;
  }
  toMarkup() {
    var e = "<line";
    for (var r in this.attributes)
      Object.prototype.hasOwnProperty.call(this.attributes, r) && (e += " " + r + '="' + utils.escape(this.attributes[r]) + '"');
    return e += "/>", e;
  }
}
function assertSymbolDomNode(s) {
  if (s instanceof SymbolNode)
    return s;
  throw new Error("Expected symbolNode but got " + String(s) + ".");
}
function assertSpan(s) {
  if (s instanceof Span)
    return s;
  throw new Error("Expected span<HtmlDomNode> but got " + String(s) + ".");
}
var ATOMS = {
  bin: 1,
  close: 1,
  inner: 1,
  open: 1,
  punct: 1,
  rel: 1
}, NON_ATOMS = {
  "accent-token": 1,
  mathord: 1,
  "op-token": 1,
  spacing: 1,
  textord: 1
}, symbols = {
  math: {},
  text: {}
};
function defineSymbol(s, e, r, o, m, _) {
  symbols[s][m] = {
    font: e,
    group: r,
    replace: o
  }, _ && o && (symbols[s][o] = symbols[s][m]);
}
var math = "math", text$c = "text", main = "main", ams = "ams", accent = "accent-token", bin = "bin", close = "close", inner = "inner", mathord = "mathord", op = "op-token", open = "open", punct = "punct", rel = "rel", spacing = "spacing", textord = "textord";
defineSymbol(math, main, rel, "≡", "\\equiv", !0);
defineSymbol(math, main, rel, "≺", "\\prec", !0);
defineSymbol(math, main, rel, "≻", "\\succ", !0);
defineSymbol(math, main, rel, "∼", "\\sim", !0);
defineSymbol(math, main, rel, "⊥", "\\perp");
defineSymbol(math, main, rel, "⪯", "\\preceq", !0);
defineSymbol(math, main, rel, "⪰", "\\succeq", !0);
defineSymbol(math, main, rel, "≃", "\\simeq", !0);
defineSymbol(math, main, rel, "∣", "\\mid", !0);
defineSymbol(math, main, rel, "≪", "\\ll", !0);
defineSymbol(math, main, rel, "≫", "\\gg", !0);
defineSymbol(math, main, rel, "≍", "\\asymp", !0);
defineSymbol(math, main, rel, "∥", "\\parallel");
defineSymbol(math, main, rel, "⋈", "\\bowtie", !0);
defineSymbol(math, main, rel, "⌣", "\\smile", !0);
defineSymbol(math, main, rel, "⊑", "\\sqsubseteq", !0);
defineSymbol(math, main, rel, "⊒", "\\sqsupseteq", !0);
defineSymbol(math, main, rel, "≐", "\\doteq", !0);
defineSymbol(math, main, rel, "⌢", "\\frown", !0);
defineSymbol(math, main, rel, "∋", "\\ni", !0);
defineSymbol(math, main, rel, "∝", "\\propto", !0);
defineSymbol(math, main, rel, "⊢", "\\vdash", !0);
defineSymbol(math, main, rel, "⊣", "\\dashv", !0);
defineSymbol(math, main, rel, "∋", "\\owns");
defineSymbol(math, main, punct, ".", "\\ldotp");
defineSymbol(math, main, punct, "⋅", "\\cdotp");
defineSymbol(math, main, textord, "#", "\\#");
defineSymbol(text$c, main, textord, "#", "\\#");
defineSymbol(math, main, textord, "&", "\\&");
defineSymbol(text$c, main, textord, "&", "\\&");
defineSymbol(math, main, textord, "ℵ", "\\aleph", !0);
defineSymbol(math, main, textord, "∀", "\\forall", !0);
defineSymbol(math, main, textord, "ℏ", "\\hbar", !0);
defineSymbol(math, main, textord, "∃", "\\exists", !0);
defineSymbol(math, main, textord, "∇", "\\nabla", !0);
defineSymbol(math, main, textord, "♭", "\\flat", !0);
defineSymbol(math, main, textord, "ℓ", "\\ell", !0);
defineSymbol(math, main, textord, "♮", "\\natural", !0);
defineSymbol(math, main, textord, "♣", "\\clubsuit", !0);
defineSymbol(math, main, textord, "℘", "\\wp", !0);
defineSymbol(math, main, textord, "♯", "\\sharp", !0);
defineSymbol(math, main, textord, "♢", "\\diamondsuit", !0);
defineSymbol(math, main, textord, "ℜ", "\\Re", !0);
defineSymbol(math, main, textord, "♡", "\\heartsuit", !0);
defineSymbol(math, main, textord, "ℑ", "\\Im", !0);
defineSymbol(math, main, textord, "♠", "\\spadesuit", !0);
defineSymbol(math, main, textord, "§", "\\S", !0);
defineSymbol(text$c, main, textord, "§", "\\S");
defineSymbol(math, main, textord, "¶", "\\P", !0);
defineSymbol(text$c, main, textord, "¶", "\\P");
defineSymbol(math, main, textord, "†", "\\dag");
defineSymbol(text$c, main, textord, "†", "\\dag");
defineSymbol(text$c, main, textord, "†", "\\textdagger");
defineSymbol(math, main, textord, "‡", "\\ddag");
defineSymbol(text$c, main, textord, "‡", "\\ddag");
defineSymbol(text$c, main, textord, "‡", "\\textdaggerdbl");
defineSymbol(math, main, close, "⎱", "\\rmoustache", !0);
defineSymbol(math, main, open, "⎰", "\\lmoustache", !0);
defineSymbol(math, main, close, "⟯", "\\rgroup", !0);
defineSymbol(math, main, open, "⟮", "\\lgroup", !0);
defineSymbol(math, main, bin, "∓", "\\mp", !0);
defineSymbol(math, main, bin, "⊖", "\\ominus", !0);
defineSymbol(math, main, bin, "⊎", "\\uplus", !0);
defineSymbol(math, main, bin, "⊓", "\\sqcap", !0);
defineSymbol(math, main, bin, "∗", "\\ast");
defineSymbol(math, main, bin, "⊔", "\\sqcup", !0);
defineSymbol(math, main, bin, "◯", "\\bigcirc", !0);
defineSymbol(math, main, bin, "∙", "\\bullet", !0);
defineSymbol(math, main, bin, "‡", "\\ddagger");
defineSymbol(math, main, bin, "≀", "\\wr", !0);
defineSymbol(math, main, bin, "⨿", "\\amalg");
defineSymbol(math, main, bin, "&", "\\And");
defineSymbol(math, main, rel, "⟵", "\\longleftarrow", !0);
defineSymbol(math, main, rel, "⇐", "\\Leftarrow", !0);
defineSymbol(math, main, rel, "⟸", "\\Longleftarrow", !0);
defineSymbol(math, main, rel, "⟶", "\\longrightarrow", !0);
defineSymbol(math, main, rel, "⇒", "\\Rightarrow", !0);
defineSymbol(math, main, rel, "⟹", "\\Longrightarrow", !0);
defineSymbol(math, main, rel, "↔", "\\leftrightarrow", !0);
defineSymbol(math, main, rel, "⟷", "\\longleftrightarrow", !0);
defineSymbol(math, main, rel, "⇔", "\\Leftrightarrow", !0);
defineSymbol(math, main, rel, "⟺", "\\Longleftrightarrow", !0);
defineSymbol(math, main, rel, "↦", "\\mapsto", !0);
defineSymbol(math, main, rel, "⟼", "\\longmapsto", !0);
defineSymbol(math, main, rel, "↗", "\\nearrow", !0);
defineSymbol(math, main, rel, "↩", "\\hookleftarrow", !0);
defineSymbol(math, main, rel, "↪", "\\hookrightarrow", !0);
defineSymbol(math, main, rel, "↘", "\\searrow", !0);
defineSymbol(math, main, rel, "↼", "\\leftharpoonup", !0);
defineSymbol(math, main, rel, "⇀", "\\rightharpoonup", !0);
defineSymbol(math, main, rel, "↙", "\\swarrow", !0);
defineSymbol(math, main, rel, "↽", "\\leftharpoondown", !0);
defineSymbol(math, main, rel, "⇁", "\\rightharpoondown", !0);
defineSymbol(math, main, rel, "↖", "\\nwarrow", !0);
defineSymbol(math, main, rel, "⇌", "\\rightleftharpoons", !0);
defineSymbol(math, ams, rel, "≮", "\\nless", !0);
defineSymbol(math, ams, rel, "", "\\@nleqslant");
defineSymbol(math, ams, rel, "", "\\@nleqq");
defineSymbol(math, ams, rel, "⪇", "\\lneq", !0);
defineSymbol(math, ams, rel, "≨", "\\lneqq", !0);
defineSymbol(math, ams, rel, "", "\\@lvertneqq");
defineSymbol(math, ams, rel, "⋦", "\\lnsim", !0);
defineSymbol(math, ams, rel, "⪉", "\\lnapprox", !0);
defineSymbol(math, ams, rel, "⊀", "\\nprec", !0);
defineSymbol(math, ams, rel, "⋠", "\\npreceq", !0);
defineSymbol(math, ams, rel, "⋨", "\\precnsim", !0);
defineSymbol(math, ams, rel, "⪹", "\\precnapprox", !0);
defineSymbol(math, ams, rel, "≁", "\\nsim", !0);
defineSymbol(math, ams, rel, "", "\\@nshortmid");
defineSymbol(math, ams, rel, "∤", "\\nmid", !0);
defineSymbol(math, ams, rel, "⊬", "\\nvdash", !0);
defineSymbol(math, ams, rel, "⊭", "\\nvDash", !0);
defineSymbol(math, ams, rel, "⋪", "\\ntriangleleft");
defineSymbol(math, ams, rel, "⋬", "\\ntrianglelefteq", !0);
defineSymbol(math, ams, rel, "⊊", "\\subsetneq", !0);
defineSymbol(math, ams, rel, "", "\\@varsubsetneq");
defineSymbol(math, ams, rel, "⫋", "\\subsetneqq", !0);
defineSymbol(math, ams, rel, "", "\\@varsubsetneqq");
defineSymbol(math, ams, rel, "≯", "\\ngtr", !0);
defineSymbol(math, ams, rel, "", "\\@ngeqslant");
defineSymbol(math, ams, rel, "", "\\@ngeqq");
defineSymbol(math, ams, rel, "⪈", "\\gneq", !0);
defineSymbol(math, ams, rel, "≩", "\\gneqq", !0);
defineSymbol(math, ams, rel, "", "\\@gvertneqq");
defineSymbol(math, ams, rel, "⋧", "\\gnsim", !0);
defineSymbol(math, ams, rel, "⪊", "\\gnapprox", !0);
defineSymbol(math, ams, rel, "⊁", "\\nsucc", !0);
defineSymbol(math, ams, rel, "⋡", "\\nsucceq", !0);
defineSymbol(math, ams, rel, "⋩", "\\succnsim", !0);
defineSymbol(math, ams, rel, "⪺", "\\succnapprox", !0);
defineSymbol(math, ams, rel, "≆", "\\ncong", !0);
defineSymbol(math, ams, rel, "", "\\@nshortparallel");
defineSymbol(math, ams, rel, "∦", "\\nparallel", !0);
defineSymbol(math, ams, rel, "⊯", "\\nVDash", !0);
defineSymbol(math, ams, rel, "⋫", "\\ntriangleright");
defineSymbol(math, ams, rel, "⋭", "\\ntrianglerighteq", !0);
defineSymbol(math, ams, rel, "", "\\@nsupseteqq");
defineSymbol(math, ams, rel, "⊋", "\\supsetneq", !0);
defineSymbol(math, ams, rel, "", "\\@varsupsetneq");
defineSymbol(math, ams, rel, "⫌", "\\supsetneqq", !0);
defineSymbol(math, ams, rel, "", "\\@varsupsetneqq");
defineSymbol(math, ams, rel, "⊮", "\\nVdash", !0);
defineSymbol(math, ams, rel, "⪵", "\\precneqq", !0);
defineSymbol(math, ams, rel, "⪶", "\\succneqq", !0);
defineSymbol(math, ams, rel, "", "\\@nsubseteqq");
defineSymbol(math, ams, bin, "⊴", "\\unlhd");
defineSymbol(math, ams, bin, "⊵", "\\unrhd");
defineSymbol(math, ams, rel, "↚", "\\nleftarrow", !0);
defineSymbol(math, ams, rel, "↛", "\\nrightarrow", !0);
defineSymbol(math, ams, rel, "⇍", "\\nLeftarrow", !0);
defineSymbol(math, ams, rel, "⇏", "\\nRightarrow", !0);
defineSymbol(math, ams, rel, "↮", "\\nleftrightarrow", !0);
defineSymbol(math, ams, rel, "⇎", "\\nLeftrightarrow", !0);
defineSymbol(math, ams, rel, "△", "\\vartriangle");
defineSymbol(math, ams, textord, "ℏ", "\\hslash");
defineSymbol(math, ams, textord, "▽", "\\triangledown");
defineSymbol(math, ams, textord, "◊", "\\lozenge");
defineSymbol(math, ams, textord, "Ⓢ", "\\circledS");
defineSymbol(math, ams, textord, "®", "\\circledR");
defineSymbol(text$c, ams, textord, "®", "\\circledR");
defineSymbol(math, ams, textord, "∡", "\\measuredangle", !0);
defineSymbol(math, ams, textord, "∄", "\\nexists");
defineSymbol(math, ams, textord, "℧", "\\mho");
defineSymbol(math, ams, textord, "Ⅎ", "\\Finv", !0);
defineSymbol(math, ams, textord, "⅁", "\\Game", !0);
defineSymbol(math, ams, textord, "‵", "\\backprime");
defineSymbol(math, ams, textord, "▲", "\\blacktriangle");
defineSymbol(math, ams, textord, "▼", "\\blacktriangledown");
defineSymbol(math, ams, textord, "■", "\\blacksquare");
defineSymbol(math, ams, textord, "⧫", "\\blacklozenge");
defineSymbol(math, ams, textord, "★", "\\bigstar");
defineSymbol(math, ams, textord, "∢", "\\sphericalangle", !0);
defineSymbol(math, ams, textord, "∁", "\\complement", !0);
defineSymbol(math, ams, textord, "ð", "\\eth", !0);
defineSymbol(text$c, main, textord, "ð", "ð");
defineSymbol(math, ams, textord, "╱", "\\diagup");
defineSymbol(math, ams, textord, "╲", "\\diagdown");
defineSymbol(math, ams, textord, "□", "\\square");
defineSymbol(math, ams, textord, "□", "\\Box");
defineSymbol(math, ams, textord, "◊", "\\Diamond");
defineSymbol(math, ams, textord, "¥", "\\yen", !0);
defineSymbol(text$c, ams, textord, "¥", "\\yen", !0);
defineSymbol(math, ams, textord, "✓", "\\checkmark", !0);
defineSymbol(text$c, ams, textord, "✓", "\\checkmark");
defineSymbol(math, ams, textord, "ℶ", "\\beth", !0);
defineSymbol(math, ams, textord, "ℸ", "\\daleth", !0);
defineSymbol(math, ams, textord, "ℷ", "\\gimel", !0);
defineSymbol(math, ams, textord, "ϝ", "\\digamma", !0);
defineSymbol(math, ams, textord, "ϰ", "\\varkappa");
defineSymbol(math, ams, open, "┌", "\\@ulcorner", !0);
defineSymbol(math, ams, close, "┐", "\\@urcorner", !0);
defineSymbol(math, ams, open, "└", "\\@llcorner", !0);
defineSymbol(math, ams, close, "┘", "\\@lrcorner", !0);
defineSymbol(math, ams, rel, "≦", "\\leqq", !0);
defineSymbol(math, ams, rel, "⩽", "\\leqslant", !0);
defineSymbol(math, ams, rel, "⪕", "\\eqslantless", !0);
defineSymbol(math, ams, rel, "≲", "\\lesssim", !0);
defineSymbol(math, ams, rel, "⪅", "\\lessapprox", !0);
defineSymbol(math, ams, rel, "≊", "\\approxeq", !0);
defineSymbol(math, ams, bin, "⋖", "\\lessdot");
defineSymbol(math, ams, rel, "⋘", "\\lll", !0);
defineSymbol(math, ams, rel, "≶", "\\lessgtr", !0);
defineSymbol(math, ams, rel, "⋚", "\\lesseqgtr", !0);
defineSymbol(math, ams, rel, "⪋", "\\lesseqqgtr", !0);
defineSymbol(math, ams, rel, "≑", "\\doteqdot");
defineSymbol(math, ams, rel, "≓", "\\risingdotseq", !0);
defineSymbol(math, ams, rel, "≒", "\\fallingdotseq", !0);
defineSymbol(math, ams, rel, "∽", "\\backsim", !0);
defineSymbol(math, ams, rel, "⋍", "\\backsimeq", !0);
defineSymbol(math, ams, rel, "⫅", "\\subseteqq", !0);
defineSymbol(math, ams, rel, "⋐", "\\Subset", !0);
defineSymbol(math, ams, rel, "⊏", "\\sqsubset", !0);
defineSymbol(math, ams, rel, "≼", "\\preccurlyeq", !0);
defineSymbol(math, ams, rel, "⋞", "\\curlyeqprec", !0);
defineSymbol(math, ams, rel, "≾", "\\precsim", !0);
defineSymbol(math, ams, rel, "⪷", "\\precapprox", !0);
defineSymbol(math, ams, rel, "⊲", "\\vartriangleleft");
defineSymbol(math, ams, rel, "⊴", "\\trianglelefteq");
defineSymbol(math, ams, rel, "⊨", "\\vDash", !0);
defineSymbol(math, ams, rel, "⊪", "\\Vvdash", !0);
defineSymbol(math, ams, rel, "⌣", "\\smallsmile");
defineSymbol(math, ams, rel, "⌢", "\\smallfrown");
defineSymbol(math, ams, rel, "≏", "\\bumpeq", !0);
defineSymbol(math, ams, rel, "≎", "\\Bumpeq", !0);
defineSymbol(math, ams, rel, "≧", "\\geqq", !0);
defineSymbol(math, ams, rel, "⩾", "\\geqslant", !0);
defineSymbol(math, ams, rel, "⪖", "\\eqslantgtr", !0);
defineSymbol(math, ams, rel, "≳", "\\gtrsim", !0);
defineSymbol(math, ams, rel, "⪆", "\\gtrapprox", !0);
defineSymbol(math, ams, bin, "⋗", "\\gtrdot");
defineSymbol(math, ams, rel, "⋙", "\\ggg", !0);
defineSymbol(math, ams, rel, "≷", "\\gtrless", !0);
defineSymbol(math, ams, rel, "⋛", "\\gtreqless", !0);
defineSymbol(math, ams, rel, "⪌", "\\gtreqqless", !0);
defineSymbol(math, ams, rel, "≖", "\\eqcirc", !0);
defineSymbol(math, ams, rel, "≗", "\\circeq", !0);
defineSymbol(math, ams, rel, "≜", "\\triangleq", !0);
defineSymbol(math, ams, rel, "∼", "\\thicksim");
defineSymbol(math, ams, rel, "≈", "\\thickapprox");
defineSymbol(math, ams, rel, "⫆", "\\supseteqq", !0);
defineSymbol(math, ams, rel, "⋑", "\\Supset", !0);
defineSymbol(math, ams, rel, "⊐", "\\sqsupset", !0);
defineSymbol(math, ams, rel, "≽", "\\succcurlyeq", !0);
defineSymbol(math, ams, rel, "⋟", "\\curlyeqsucc", !0);
defineSymbol(math, ams, rel, "≿", "\\succsim", !0);
defineSymbol(math, ams, rel, "⪸", "\\succapprox", !0);
defineSymbol(math, ams, rel, "⊳", "\\vartriangleright");
defineSymbol(math, ams, rel, "⊵", "\\trianglerighteq");
defineSymbol(math, ams, rel, "⊩", "\\Vdash", !0);
defineSymbol(math, ams, rel, "∣", "\\shortmid");
defineSymbol(math, ams, rel, "∥", "\\shortparallel");
defineSymbol(math, ams, rel, "≬", "\\between", !0);
defineSymbol(math, ams, rel, "⋔", "\\pitchfork", !0);
defineSymbol(math, ams, rel, "∝", "\\varpropto");
defineSymbol(math, ams, rel, "◀", "\\blacktriangleleft");
defineSymbol(math, ams, rel, "∴", "\\therefore", !0);
defineSymbol(math, ams, rel, "∍", "\\backepsilon");
defineSymbol(math, ams, rel, "▶", "\\blacktriangleright");
defineSymbol(math, ams, rel, "∵", "\\because", !0);
defineSymbol(math, ams, rel, "⋘", "\\llless");
defineSymbol(math, ams, rel, "⋙", "\\gggtr");
defineSymbol(math, ams, bin, "⊲", "\\lhd");
defineSymbol(math, ams, bin, "⊳", "\\rhd");
defineSymbol(math, ams, rel, "≂", "\\eqsim", !0);
defineSymbol(math, main, rel, "⋈", "\\Join");
defineSymbol(math, ams, rel, "≑", "\\Doteq", !0);
defineSymbol(math, ams, bin, "∔", "\\dotplus", !0);
defineSymbol(math, ams, bin, "∖", "\\smallsetminus");
defineSymbol(math, ams, bin, "⋒", "\\Cap", !0);
defineSymbol(math, ams, bin, "⋓", "\\Cup", !0);
defineSymbol(math, ams, bin, "⩞", "\\doublebarwedge", !0);
defineSymbol(math, ams, bin, "⊟", "\\boxminus", !0);
defineSymbol(math, ams, bin, "⊞", "\\boxplus", !0);
defineSymbol(math, ams, bin, "⋇", "\\divideontimes", !0);
defineSymbol(math, ams, bin, "⋉", "\\ltimes", !0);
defineSymbol(math, ams, bin, "⋊", "\\rtimes", !0);
defineSymbol(math, ams, bin, "⋋", "\\leftthreetimes", !0);
defineSymbol(math, ams, bin, "⋌", "\\rightthreetimes", !0);
defineSymbol(math, ams, bin, "⋏", "\\curlywedge", !0);
defineSymbol(math, ams, bin, "⋎", "\\curlyvee", !0);
defineSymbol(math, ams, bin, "⊝", "\\circleddash", !0);
defineSymbol(math, ams, bin, "⊛", "\\circledast", !0);
defineSymbol(math, ams, bin, "⋅", "\\centerdot");
defineSymbol(math, ams, bin, "⊺", "\\intercal", !0);
defineSymbol(math, ams, bin, "⋒", "\\doublecap");
defineSymbol(math, ams, bin, "⋓", "\\doublecup");
defineSymbol(math, ams, bin, "⊠", "\\boxtimes", !0);
defineSymbol(math, ams, rel, "⇢", "\\dashrightarrow", !0);
defineSymbol(math, ams, rel, "⇠", "\\dashleftarrow", !0);
defineSymbol(math, ams, rel, "⇇", "\\leftleftarrows", !0);
defineSymbol(math, ams, rel, "⇆", "\\leftrightarrows", !0);
defineSymbol(math, ams, rel, "⇚", "\\Lleftarrow", !0);
defineSymbol(math, ams, rel, "↞", "\\twoheadleftarrow", !0);
defineSymbol(math, ams, rel, "↢", "\\leftarrowtail", !0);
defineSymbol(math, ams, rel, "↫", "\\looparrowleft", !0);
defineSymbol(math, ams, rel, "⇋", "\\leftrightharpoons", !0);
defineSymbol(math, ams, rel, "↶", "\\curvearrowleft", !0);
defineSymbol(math, ams, rel, "↺", "\\circlearrowleft", !0);
defineSymbol(math, ams, rel, "↰", "\\Lsh", !0);
defineSymbol(math, ams, rel, "⇈", "\\upuparrows", !0);
defineSymbol(math, ams, rel, "↿", "\\upharpoonleft", !0);
defineSymbol(math, ams, rel, "⇃", "\\downharpoonleft", !0);
defineSymbol(math, main, rel, "⊶", "\\origof", !0);
defineSymbol(math, main, rel, "⊷", "\\imageof", !0);
defineSymbol(math, ams, rel, "⊸", "\\multimap", !0);
defineSymbol(math, ams, rel, "↭", "\\leftrightsquigarrow", !0);
defineSymbol(math, ams, rel, "⇉", "\\rightrightarrows", !0);
defineSymbol(math, ams, rel, "⇄", "\\rightleftarrows", !0);
defineSymbol(math, ams, rel, "↠", "\\twoheadrightarrow", !0);
defineSymbol(math, ams, rel, "↣", "\\rightarrowtail", !0);
defineSymbol(math, ams, rel, "↬", "\\looparrowright", !0);
defineSymbol(math, ams, rel, "↷", "\\curvearrowright", !0);
defineSymbol(math, ams, rel, "↻", "\\circlearrowright", !0);
defineSymbol(math, ams, rel, "↱", "\\Rsh", !0);
defineSymbol(math, ams, rel, "⇊", "\\downdownarrows", !0);
defineSymbol(math, ams, rel, "↾", "\\upharpoonright", !0);
defineSymbol(math, ams, rel, "⇂", "\\downharpoonright", !0);
defineSymbol(math, ams, rel, "⇝", "\\rightsquigarrow", !0);
defineSymbol(math, ams, rel, "⇝", "\\leadsto");
defineSymbol(math, ams, rel, "⇛", "\\Rrightarrow", !0);
defineSymbol(math, ams, rel, "↾", "\\restriction");
defineSymbol(math, main, textord, "‘", "`");
defineSymbol(math, main, textord, "$", "\\$");
defineSymbol(text$c, main, textord, "$", "\\$");
defineSymbol(text$c, main, textord, "$", "\\textdollar");
defineSymbol(math, main, textord, "%", "\\%");
defineSymbol(text$c, main, textord, "%", "\\%");
defineSymbol(math, main, textord, "_", "\\_");
defineSymbol(text$c, main, textord, "_", "\\_");
defineSymbol(text$c, main, textord, "_", "\\textunderscore");
defineSymbol(math, main, textord, "∠", "\\angle", !0);
defineSymbol(math, main, textord, "∞", "\\infty", !0);
defineSymbol(math, main, textord, "′", "\\prime");
defineSymbol(math, main, textord, "△", "\\triangle");
defineSymbol(math, main, textord, "Γ", "\\Gamma", !0);
defineSymbol(math, main, textord, "Δ", "\\Delta", !0);
defineSymbol(math, main, textord, "Θ", "\\Theta", !0);
defineSymbol(math, main, textord, "Λ", "\\Lambda", !0);
defineSymbol(math, main, textord, "Ξ", "\\Xi", !0);
defineSymbol(math, main, textord, "Π", "\\Pi", !0);
defineSymbol(math, main, textord, "Σ", "\\Sigma", !0);
defineSymbol(math, main, textord, "Υ", "\\Upsilon", !0);
defineSymbol(math, main, textord, "Φ", "\\Phi", !0);
defineSymbol(math, main, textord, "Ψ", "\\Psi", !0);
defineSymbol(math, main, textord, "Ω", "\\Omega", !0);
defineSymbol(math, main, textord, "A", "Α");
defineSymbol(math, main, textord, "B", "Β");
defineSymbol(math, main, textord, "E", "Ε");
defineSymbol(math, main, textord, "Z", "Ζ");
defineSymbol(math, main, textord, "H", "Η");
defineSymbol(math, main, textord, "I", "Ι");
defineSymbol(math, main, textord, "K", "Κ");
defineSymbol(math, main, textord, "M", "Μ");
defineSymbol(math, main, textord, "N", "Ν");
defineSymbol(math, main, textord, "O", "Ο");
defineSymbol(math, main, textord, "P", "Ρ");
defineSymbol(math, main, textord, "T", "Τ");
defineSymbol(math, main, textord, "X", "Χ");
defineSymbol(math, main, textord, "¬", "\\neg", !0);
defineSymbol(math, main, textord, "¬", "\\lnot");
defineSymbol(math, main, textord, "⊤", "\\top");
defineSymbol(math, main, textord, "⊥", "\\bot");
defineSymbol(math, main, textord, "∅", "\\emptyset");
defineSymbol(math, ams, textord, "∅", "\\varnothing");
defineSymbol(math, main, mathord, "α", "\\alpha", !0);
defineSymbol(math, main, mathord, "β", "\\beta", !0);
defineSymbol(math, main, mathord, "γ", "\\gamma", !0);
defineSymbol(math, main, mathord, "δ", "\\delta", !0);
defineSymbol(math, main, mathord, "ϵ", "\\epsilon", !0);
defineSymbol(math, main, mathord, "ζ", "\\zeta", !0);
defineSymbol(math, main, mathord, "η", "\\eta", !0);
defineSymbol(math, main, mathord, "θ", "\\theta", !0);
defineSymbol(math, main, mathord, "ι", "\\iota", !0);
defineSymbol(math, main, mathord, "κ", "\\kappa", !0);
defineSymbol(math, main, mathord, "λ", "\\lambda", !0);
defineSymbol(math, main, mathord, "μ", "\\mu", !0);
defineSymbol(math, main, mathord, "ν", "\\nu", !0);
defineSymbol(math, main, mathord, "ξ", "\\xi", !0);
defineSymbol(math, main, mathord, "ο", "\\omicron", !0);
defineSymbol(math, main, mathord, "π", "\\pi", !0);
defineSymbol(math, main, mathord, "ρ", "\\rho", !0);
defineSymbol(math, main, mathord, "σ", "\\sigma", !0);
defineSymbol(math, main, mathord, "τ", "\\tau", !0);
defineSymbol(math, main, mathord, "υ", "\\upsilon", !0);
defineSymbol(math, main, mathord, "ϕ", "\\phi", !0);
defineSymbol(math, main, mathord, "χ", "\\chi", !0);
defineSymbol(math, main, mathord, "ψ", "\\psi", !0);
defineSymbol(math, main, mathord, "ω", "\\omega", !0);
defineSymbol(math, main, mathord, "ε", "\\varepsilon", !0);
defineSymbol(math, main, mathord, "ϑ", "\\vartheta", !0);
defineSymbol(math, main, mathord, "ϖ", "\\varpi", !0);
defineSymbol(math, main, mathord, "ϱ", "\\varrho", !0);
defineSymbol(math, main, mathord, "ς", "\\varsigma", !0);
defineSymbol(math, main, mathord, "φ", "\\varphi", !0);
defineSymbol(math, main, bin, "∗", "*", !0);
defineSymbol(math, main, bin, "+", "+");
defineSymbol(math, main, bin, "−", "-", !0);
defineSymbol(math, main, bin, "⋅", "\\cdot", !0);
defineSymbol(math, main, bin, "∘", "\\circ", !0);
defineSymbol(math, main, bin, "÷", "\\div", !0);
defineSymbol(math, main, bin, "±", "\\pm", !0);
defineSymbol(math, main, bin, "×", "\\times", !0);
defineSymbol(math, main, bin, "∩", "\\cap", !0);
defineSymbol(math, main, bin, "∪", "\\cup", !0);
defineSymbol(math, main, bin, "∖", "\\setminus", !0);
defineSymbol(math, main, bin, "∧", "\\land");
defineSymbol(math, main, bin, "∨", "\\lor");
defineSymbol(math, main, bin, "∧", "\\wedge", !0);
defineSymbol(math, main, bin, "∨", "\\vee", !0);
defineSymbol(math, main, textord, "√", "\\surd");
defineSymbol(math, main, open, "⟨", "\\langle", !0);
defineSymbol(math, main, open, "∣", "\\lvert");
defineSymbol(math, main, open, "∥", "\\lVert");
defineSymbol(math, main, close, "?", "?");
defineSymbol(math, main, close, "!", "!");
defineSymbol(math, main, close, "⟩", "\\rangle", !0);
defineSymbol(math, main, close, "∣", "\\rvert");
defineSymbol(math, main, close, "∥", "\\rVert");
defineSymbol(math, main, rel, "=", "=");
defineSymbol(math, main, rel, ":", ":");
defineSymbol(math, main, rel, "≈", "\\approx", !0);
defineSymbol(math, main, rel, "≅", "\\cong", !0);
defineSymbol(math, main, rel, "≥", "\\ge");
defineSymbol(math, main, rel, "≥", "\\geq", !0);
defineSymbol(math, main, rel, "←", "\\gets");
defineSymbol(math, main, rel, ">", "\\gt", !0);
defineSymbol(math, main, rel, "∈", "\\in", !0);
defineSymbol(math, main, rel, "", "\\@not");
defineSymbol(math, main, rel, "⊂", "\\subset", !0);
defineSymbol(math, main, rel, "⊃", "\\supset", !0);
defineSymbol(math, main, rel, "⊆", "\\subseteq", !0);
defineSymbol(math, main, rel, "⊇", "\\supseteq", !0);
defineSymbol(math, ams, rel, "⊈", "\\nsubseteq", !0);
defineSymbol(math, ams, rel, "⊉", "\\nsupseteq", !0);
defineSymbol(math, main, rel, "⊨", "\\models");
defineSymbol(math, main, rel, "←", "\\leftarrow", !0);
defineSymbol(math, main, rel, "≤", "\\le");
defineSymbol(math, main, rel, "≤", "\\leq", !0);
defineSymbol(math, main, rel, "<", "\\lt", !0);
defineSymbol(math, main, rel, "→", "\\rightarrow", !0);
defineSymbol(math, main, rel, "→", "\\to");
defineSymbol(math, ams, rel, "≱", "\\ngeq", !0);
defineSymbol(math, ams, rel, "≰", "\\nleq", !0);
defineSymbol(math, main, spacing, " ", "\\ ");
defineSymbol(math, main, spacing, " ", "\\space");
defineSymbol(math, main, spacing, " ", "\\nobreakspace");
defineSymbol(text$c, main, spacing, " ", "\\ ");
defineSymbol(text$c, main, spacing, " ", " ");
defineSymbol(text$c, main, spacing, " ", "\\space");
defineSymbol(text$c, main, spacing, " ", "\\nobreakspace");
defineSymbol(math, main, spacing, null, "\\nobreak");
defineSymbol(math, main, spacing, null, "\\allowbreak");
defineSymbol(math, main, punct, ",", ",");
defineSymbol(math, main, punct, ";", ";");
defineSymbol(math, ams, bin, "⊼", "\\barwedge", !0);
defineSymbol(math, ams, bin, "⊻", "\\veebar", !0);
defineSymbol(math, main, bin, "⊙", "\\odot", !0);
defineSymbol(math, main, bin, "⊕", "\\oplus", !0);
defineSymbol(math, main, bin, "⊗", "\\otimes", !0);
defineSymbol(math, main, textord, "∂", "\\partial", !0);
defineSymbol(math, main, bin, "⊘", "\\oslash", !0);
defineSymbol(math, ams, bin, "⊚", "\\circledcirc", !0);
defineSymbol(math, ams, bin, "⊡", "\\boxdot", !0);
defineSymbol(math, main, bin, "△", "\\bigtriangleup");
defineSymbol(math, main, bin, "▽", "\\bigtriangledown");
defineSymbol(math, main, bin, "†", "\\dagger");
defineSymbol(math, main, bin, "⋄", "\\diamond");
defineSymbol(math, main, bin, "⋆", "\\star");
defineSymbol(math, main, bin, "◃", "\\triangleleft");
defineSymbol(math, main, bin, "▹", "\\triangleright");
defineSymbol(math, main, open, "{", "\\{");
defineSymbol(text$c, main, textord, "{", "\\{");
defineSymbol(text$c, main, textord, "{", "\\textbraceleft");
defineSymbol(math, main, close, "}", "\\}");
defineSymbol(text$c, main, textord, "}", "\\}");
defineSymbol(text$c, main, textord, "}", "\\textbraceright");
defineSymbol(math, main, open, "{", "\\lbrace");
defineSymbol(math, main, close, "}", "\\rbrace");
defineSymbol(math, main, open, "[", "\\lbrack", !0);
defineSymbol(text$c, main, textord, "[", "\\lbrack", !0);
defineSymbol(math, main, close, "]", "\\rbrack", !0);
defineSymbol(text$c, main, textord, "]", "\\rbrack", !0);
defineSymbol(math, main, open, "(", "\\lparen", !0);
defineSymbol(math, main, close, ")", "\\rparen", !0);
defineSymbol(text$c, main, textord, "<", "\\textless", !0);
defineSymbol(text$c, main, textord, ">", "\\textgreater", !0);
defineSymbol(math, main, open, "⌊", "\\lfloor", !0);
defineSymbol(math, main, close, "⌋", "\\rfloor", !0);
defineSymbol(math, main, open, "⌈", "\\lceil", !0);
defineSymbol(math, main, close, "⌉", "\\rceil", !0);
defineSymbol(math, main, textord, "\\", "\\backslash");
defineSymbol(math, main, textord, "∣", "|");
defineSymbol(math, main, textord, "∣", "\\vert");
defineSymbol(text$c, main, textord, "|", "\\textbar", !0);
defineSymbol(math, main, textord, "∥", "\\|");
defineSymbol(math, main, textord, "∥", "\\Vert");
defineSymbol(text$c, main, textord, "∥", "\\textbardbl");
defineSymbol(text$c, main, textord, "~", "\\textasciitilde");
defineSymbol(text$c, main, textord, "\\", "\\textbackslash");
defineSymbol(text$c, main, textord, "^", "\\textasciicircum");
defineSymbol(math, main, rel, "↑", "\\uparrow", !0);
defineSymbol(math, main, rel, "⇑", "\\Uparrow", !0);
defineSymbol(math, main, rel, "↓", "\\downarrow", !0);
defineSymbol(math, main, rel, "⇓", "\\Downarrow", !0);
defineSymbol(math, main, rel, "↕", "\\updownarrow", !0);
defineSymbol(math, main, rel, "⇕", "\\Updownarrow", !0);
defineSymbol(math, main, op, "∐", "\\coprod");
defineSymbol(math, main, op, "⋁", "\\bigvee");
defineSymbol(math, main, op, "⋀", "\\bigwedge");
defineSymbol(math, main, op, "⨄", "\\biguplus");
defineSymbol(math, main, op, "⋂", "\\bigcap");
defineSymbol(math, main, op, "⋃", "\\bigcup");
defineSymbol(math, main, op, "∫", "\\int");
defineSymbol(math, main, op, "∫", "\\intop");
defineSymbol(math, main, op, "∬", "\\iint");
defineSymbol(math, main, op, "∭", "\\iiint");
defineSymbol(math, main, op, "∏", "\\prod");
defineSymbol(math, main, op, "∑", "\\sum");
defineSymbol(math, main, op, "⨂", "\\bigotimes");
defineSymbol(math, main, op, "⨁", "\\bigoplus");
defineSymbol(math, main, op, "⨀", "\\bigodot");
defineSymbol(math, main, op, "∮", "\\oint");
defineSymbol(math, main, op, "∯", "\\oiint");
defineSymbol(math, main, op, "∰", "\\oiiint");
defineSymbol(math, main, op, "⨆", "\\bigsqcup");
defineSymbol(math, main, op, "∫", "\\smallint");
defineSymbol(text$c, main, inner, "…", "\\textellipsis");
defineSymbol(math, main, inner, "…", "\\mathellipsis");
defineSymbol(text$c, main, inner, "…", "\\ldots", !0);
defineSymbol(math, main, inner, "…", "\\ldots", !0);
defineSymbol(math, main, inner, "⋯", "\\@cdots", !0);
defineSymbol(math, main, inner, "⋱", "\\ddots", !0);
defineSymbol(math, main, textord, "⋮", "\\varvdots");
defineSymbol(text$c, main, textord, "⋮", "\\varvdots");
defineSymbol(math, main, accent, "ˊ", "\\acute");
defineSymbol(math, main, accent, "ˋ", "\\grave");
defineSymbol(math, main, accent, "¨", "\\ddot");
defineSymbol(math, main, accent, "~", "\\tilde");
defineSymbol(math, main, accent, "ˉ", "\\bar");
defineSymbol(math, main, accent, "˘", "\\breve");
defineSymbol(math, main, accent, "ˇ", "\\check");
defineSymbol(math, main, accent, "^", "\\hat");
defineSymbol(math, main, accent, "⃗", "\\vec");
defineSymbol(math, main, accent, "˙", "\\dot");
defineSymbol(math, main, accent, "˚", "\\mathring");
defineSymbol(math, main, mathord, "", "\\@imath");
defineSymbol(math, main, mathord, "", "\\@jmath");
defineSymbol(math, main, textord, "ı", "ı");
defineSymbol(math, main, textord, "ȷ", "ȷ");
defineSymbol(text$c, main, textord, "ı", "\\i", !0);
defineSymbol(text$c, main, textord, "ȷ", "\\j", !0);
defineSymbol(text$c, main, textord, "ß", "\\ss", !0);
defineSymbol(text$c, main, textord, "æ", "\\ae", !0);
defineSymbol(text$c, main, textord, "œ", "\\oe", !0);
defineSymbol(text$c, main, textord, "ø", "\\o", !0);
defineSymbol(text$c, main, textord, "Æ", "\\AE", !0);
defineSymbol(text$c, main, textord, "Œ", "\\OE", !0);
defineSymbol(text$c, main, textord, "Ø", "\\O", !0);
defineSymbol(text$c, main, accent, "ˊ", "\\'");
defineSymbol(text$c, main, accent, "ˋ", "\\`");
defineSymbol(text$c, main, accent, "ˆ", "\\^");
defineSymbol(text$c, main, accent, "˜", "\\~");
defineSymbol(text$c, main, accent, "ˉ", "\\=");
defineSymbol(text$c, main, accent, "˘", "\\u");
defineSymbol(text$c, main, accent, "˙", "\\.");
defineSymbol(text$c, main, accent, "¸", "\\c");
defineSymbol(text$c, main, accent, "˚", "\\r");
defineSymbol(text$c, main, accent, "ˇ", "\\v");
defineSymbol(text$c, main, accent, "¨", '\\"');
defineSymbol(text$c, main, accent, "˝", "\\H");
defineSymbol(text$c, main, accent, "◯", "\\textcircled");
var ligatures = {
  "--": !0,
  "---": !0,
  "``": !0,
  "''": !0
};
defineSymbol(text$c, main, textord, "–", "--", !0);
defineSymbol(text$c, main, textord, "–", "\\textendash");
defineSymbol(text$c, main, textord, "—", "---", !0);
defineSymbol(text$c, main, textord, "—", "\\textemdash");
defineSymbol(text$c, main, textord, "‘", "`", !0);
defineSymbol(text$c, main, textord, "‘", "\\textquoteleft");
defineSymbol(text$c, main, textord, "’", "'", !0);
defineSymbol(text$c, main, textord, "’", "\\textquoteright");
defineSymbol(text$c, main, textord, "“", "``", !0);
defineSymbol(text$c, main, textord, "“", "\\textquotedblleft");
defineSymbol(text$c, main, textord, "”", "''", !0);
defineSymbol(text$c, main, textord, "”", "\\textquotedblright");
defineSymbol(math, main, textord, "°", "\\degree", !0);
defineSymbol(text$c, main, textord, "°", "\\degree");
defineSymbol(text$c, main, textord, "°", "\\textdegree", !0);
defineSymbol(math, main, textord, "£", "\\pounds");
defineSymbol(math, main, textord, "£", "\\mathsterling", !0);
defineSymbol(text$c, main, textord, "£", "\\pounds");
defineSymbol(text$c, main, textord, "£", "\\textsterling", !0);
defineSymbol(math, ams, textord, "✠", "\\maltese");
defineSymbol(text$c, ams, textord, "✠", "\\maltese");
var mathTextSymbols = '0123456789/@."';
for (var i = 0; i < mathTextSymbols.length; i++) {
  var ch = mathTextSymbols.charAt(i);
  defineSymbol(math, main, textord, ch, ch);
}
var textSymbols = '0123456789!@*()-=+";:?/.,';
for (var _i = 0; _i < textSymbols.length; _i++) {
  var _ch = textSymbols.charAt(_i);
  defineSymbol(text$c, main, textord, _ch, _ch);
}
var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
for (var _i2 = 0; _i2 < letters.length; _i2++) {
  var _ch2 = letters.charAt(_i2);
  defineSymbol(math, main, mathord, _ch2, _ch2), defineSymbol(text$c, main, textord, _ch2, _ch2);
}
defineSymbol(math, ams, textord, "C", "ℂ");
defineSymbol(text$c, ams, textord, "C", "ℂ");
defineSymbol(math, ams, textord, "H", "ℍ");
defineSymbol(text$c, ams, textord, "H", "ℍ");
defineSymbol(math, ams, textord, "N", "ℕ");
defineSymbol(text$c, ams, textord, "N", "ℕ");
defineSymbol(math, ams, textord, "P", "ℙ");
defineSymbol(text$c, ams, textord, "P", "ℙ");
defineSymbol(math, ams, textord, "Q", "ℚ");
defineSymbol(text$c, ams, textord, "Q", "ℚ");
defineSymbol(math, ams, textord, "R", "ℝ");
defineSymbol(text$c, ams, textord, "R", "ℝ");
defineSymbol(math, ams, textord, "Z", "ℤ");
defineSymbol(text$c, ams, textord, "Z", "ℤ");
defineSymbol(math, main, mathord, "h", "ℎ");
defineSymbol(text$c, main, mathord, "h", "ℎ");
var wideChar = "";
for (var _i3 = 0; _i3 < letters.length; _i3++) {
  var _ch3 = letters.charAt(_i3);
  wideChar = String.fromCharCode(55349, 56320 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$c, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56372 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$c, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56424 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$c, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56580 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$c, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56684 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$c, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56736 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$c, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56788 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$c, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56840 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$c, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56944 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$c, main, textord, _ch3, wideChar), _i3 < 26 && (wideChar = String.fromCharCode(55349, 56632 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$c, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56476 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$c, main, textord, _ch3, wideChar));
}
wideChar = "𝕜";
defineSymbol(math, main, mathord, "k", wideChar);
defineSymbol(text$c, main, textord, "k", wideChar);
for (var _i4 = 0; _i4 < 10; _i4++) {
  var _ch4 = _i4.toString();
  wideChar = String.fromCharCode(55349, 57294 + _i4), defineSymbol(math, main, mathord, _ch4, wideChar), defineSymbol(text$c, main, textord, _ch4, wideChar), wideChar = String.fromCharCode(55349, 57314 + _i4), defineSymbol(math, main, mathord, _ch4, wideChar), defineSymbol(text$c, main, textord, _ch4, wideChar), wideChar = String.fromCharCode(55349, 57324 + _i4), defineSymbol(math, main, mathord, _ch4, wideChar), defineSymbol(text$c, main, textord, _ch4, wideChar), wideChar = String.fromCharCode(55349, 57334 + _i4), defineSymbol(math, main, mathord, _ch4, wideChar), defineSymbol(text$c, main, textord, _ch4, wideChar);
}
var extraLatin = "ÐÞþ";
for (var _i5 = 0; _i5 < extraLatin.length; _i5++) {
  var _ch5 = extraLatin.charAt(_i5);
  defineSymbol(math, main, mathord, _ch5, _ch5), defineSymbol(text$c, main, textord, _ch5, _ch5);
}
var wideLatinLetterData = [
  ["mathbf", "textbf", "Main-Bold"],
  // A-Z bold upright
  ["mathbf", "textbf", "Main-Bold"],
  // a-z bold upright
  ["mathnormal", "textit", "Math-Italic"],
  // A-Z italic
  ["mathnormal", "textit", "Math-Italic"],
  // a-z italic
  ["boldsymbol", "boldsymbol", "Main-BoldItalic"],
  // A-Z bold italic
  ["boldsymbol", "boldsymbol", "Main-BoldItalic"],
  // a-z bold italic
  // Map fancy A-Z letters to script, not calligraphic.
  // This aligns with unicode-math and math fonts (except Cambria Math).
  ["mathscr", "textscr", "Script-Regular"],
  // A-Z script
  ["", "", ""],
  // a-z script.  No font
  ["", "", ""],
  // A-Z bold script. No font
  ["", "", ""],
  // a-z bold script. No font
  ["mathfrak", "textfrak", "Fraktur-Regular"],
  // A-Z Fraktur
  ["mathfrak", "textfrak", "Fraktur-Regular"],
  // a-z Fraktur
  ["mathbb", "textbb", "AMS-Regular"],
  // A-Z double-struck
  ["mathbb", "textbb", "AMS-Regular"],
  // k double-struck
  // Note that we are using a bold font, but font metrics for regular Fraktur.
  ["mathboldfrak", "textboldfrak", "Fraktur-Regular"],
  // A-Z bold Fraktur
  ["mathboldfrak", "textboldfrak", "Fraktur-Regular"],
  // a-z bold Fraktur
  ["mathsf", "textsf", "SansSerif-Regular"],
  // A-Z sans-serif
  ["mathsf", "textsf", "SansSerif-Regular"],
  // a-z sans-serif
  ["mathboldsf", "textboldsf", "SansSerif-Bold"],
  // A-Z bold sans-serif
  ["mathboldsf", "textboldsf", "SansSerif-Bold"],
  // a-z bold sans-serif
  ["mathitsf", "textitsf", "SansSerif-Italic"],
  // A-Z italic sans-serif
  ["mathitsf", "textitsf", "SansSerif-Italic"],
  // a-z italic sans-serif
  ["", "", ""],
  // A-Z bold italic sans. No font
  ["", "", ""],
  // a-z bold italic sans. No font
  ["mathtt", "texttt", "Typewriter-Regular"],
  // A-Z monospace
  ["mathtt", "texttt", "Typewriter-Regular"]
  // a-z monospace
], wideNumeralData = [
  ["mathbf", "textbf", "Main-Bold"],
  // 0-9 bold
  ["", "", ""],
  // 0-9 double-struck. No KaTeX font.
  ["mathsf", "textsf", "SansSerif-Regular"],
  // 0-9 sans-serif
  ["mathboldsf", "textboldsf", "SansSerif-Bold"],
  // 0-9 bold sans-serif
  ["mathtt", "texttt", "Typewriter-Regular"]
  // 0-9 monospace
], wideCharacterFont = function(e, r) {
  var o = e.charCodeAt(0), m = e.charCodeAt(1), _ = (o - 55296) * 1024 + (m - 56320) + 65536, g = r === "math" ? 0 : 1;
  if (119808 <= _ && _ < 120484) {
    var y = Math.floor((_ - 119808) / 26);
    return [wideLatinLetterData[y][2], wideLatinLetterData[y][g]];
  } else if (120782 <= _ && _ <= 120831) {
    var E = Math.floor((_ - 120782) / 10);
    return [wideNumeralData[E][2], wideNumeralData[E][g]];
  } else {
    if (_ === 120485 || _ === 120486)
      return [wideLatinLetterData[0][2], wideLatinLetterData[0][g]];
    if (120486 < _ && _ < 120782)
      return ["", ""];
    throw new ParseError("Unsupported character: " + e);
  }
}, lookupSymbol = function(e, r, o) {
  return symbols[o][e] && symbols[o][e].replace && (e = symbols[o][e].replace), {
    value: e,
    metrics: getCharacterMetrics(e, r, o)
  };
}, makeSymbol = function(e, r, o, m, _) {
  var g = lookupSymbol(e, r, o), y = g.metrics;
  e = g.value;
  var E;
  if (y) {
    var x = y.italic;
    (o === "text" || m && m.font === "mathit") && (x = 0), E = new SymbolNode(e, y.height, y.depth, x, y.skew, y.width, _);
  } else
    typeof console < "u" && console.warn("No character metrics " + ("for '" + e + "' in style '" + r + "' and mode '" + o + "'")), E = new SymbolNode(e, 0, 0, 0, 0, 0, _);
  if (m) {
    E.maxFontSize = m.sizeMultiplier, m.style.isTight() && E.classes.push("mtight");
    var v = m.getColor();
    v && (E.style.color = v);
  }
  return E;
}, mathsym = function(e, r, o, m) {
  return m === void 0 && (m = []), o.font === "boldsymbol" && lookupSymbol(e, "Main-Bold", r).metrics ? makeSymbol(e, "Main-Bold", r, o, m.concat(["mathbf"])) : e === "\\" || symbols[r][e].font === "main" ? makeSymbol(e, "Main-Regular", r, o, m) : makeSymbol(e, "AMS-Regular", r, o, m.concat(["amsrm"]));
}, boldsymbol = function(e, r, o, m, _) {
  return _ !== "textord" && lookupSymbol(e, "Math-BoldItalic", r).metrics ? {
    fontName: "Math-BoldItalic",
    fontClass: "boldsymbol"
  } : {
    fontName: "Main-Bold",
    fontClass: "mathbf"
  };
}, makeOrd = function(e, r, o) {
  var m = e.mode, _ = e.text, g = ["mord"], y = m === "math" || m === "text" && r.font, E = y ? r.font : r.fontFamily, x = "", v = "";
  if (_.charCodeAt(0) === 55349 && ([x, v] = wideCharacterFont(_, m)), x.length > 0)
    return makeSymbol(_, x, m, r, g.concat(v));
  if (E) {
    var h, a;
    if (E === "boldsymbol") {
      var b = boldsymbol(_, m, r, g, o);
      h = b.fontName, a = [b.fontClass];
    } else y ? (h = fontMap[E].fontName, a = [E]) : (h = retrieveTextFontName(E, r.fontWeight, r.fontShape), a = [E, r.fontWeight, r.fontShape]);
    if (lookupSymbol(_, h, m).metrics)
      return makeSymbol(_, h, m, r, g.concat(a));
    if (ligatures.hasOwnProperty(_) && h.slice(0, 10) === "Typewriter") {
      for (var w = [], k = 0; k < _.length; k++)
        w.push(makeSymbol(_[k], h, m, r, g.concat(a)));
      return makeFragment(w);
    }
  }
  if (o === "mathord")
    return makeSymbol(_, "Math-Italic", m, r, g.concat(["mathnormal"]));
  if (o === "textord") {
    var A = symbols[m][_] && symbols[m][_].font;
    if (A === "ams") {
      var M = retrieveTextFontName("amsrm", r.fontWeight, r.fontShape);
      return makeSymbol(_, M, m, r, g.concat("amsrm", r.fontWeight, r.fontShape));
    } else if (A === "main" || !A) {
      var $ = retrieveTextFontName("textrm", r.fontWeight, r.fontShape);
      return makeSymbol(_, $, m, r, g.concat(r.fontWeight, r.fontShape));
    } else {
      var O = retrieveTextFontName(A, r.fontWeight, r.fontShape);
      return makeSymbol(_, O, m, r, g.concat(O, r.fontWeight, r.fontShape));
    }
  } else
    throw new Error("unexpected type: " + o + " in makeOrd");
}, canCombine = (s, e) => {
  if (createClass(s.classes) !== createClass(e.classes) || s.skew !== e.skew || s.maxFontSize !== e.maxFontSize)
    return !1;
  if (s.classes.length === 1) {
    var r = s.classes[0];
    if (r === "mbin" || r === "mord")
      return !1;
  }
  for (var o in s.style)
    if (s.style.hasOwnProperty(o) && s.style[o] !== e.style[o])
      return !1;
  for (var m in e.style)
    if (e.style.hasOwnProperty(m) && s.style[m] !== e.style[m])
      return !1;
  return !0;
}, tryCombineChars = (s) => {
  for (var e = 0; e < s.length - 1; e++) {
    var r = s[e], o = s[e + 1];
    r instanceof SymbolNode && o instanceof SymbolNode && canCombine(r, o) && (r.text += o.text, r.height = Math.max(r.height, o.height), r.depth = Math.max(r.depth, o.depth), r.italic = o.italic, s.splice(e + 1, 1), e--);
  }
  return s;
}, sizeElementFromChildren = function(e) {
  for (var r = 0, o = 0, m = 0, _ = 0; _ < e.children.length; _++) {
    var g = e.children[_];
    g.height > r && (r = g.height), g.depth > o && (o = g.depth), g.maxFontSize > m && (m = g.maxFontSize);
  }
  e.height = r, e.depth = o, e.maxFontSize = m;
}, makeSpan$2 = function(e, r, o, m) {
  var _ = new Span(e, r, o, m);
  return sizeElementFromChildren(_), _;
}, makeSvgSpan = (s, e, r, o) => new Span(s, e, r, o), makeLineSpan = function(e, r, o) {
  var m = makeSpan$2([e], [], r);
  return m.height = Math.max(o || r.fontMetrics().defaultRuleThickness, r.minRuleThickness), m.style.borderBottomWidth = makeEm(m.height), m.maxFontSize = 1, m;
}, makeAnchor = function(e, r, o, m) {
  var _ = new Anchor(e, r, o, m);
  return sizeElementFromChildren(_), _;
}, makeFragment = function(e) {
  var r = new DocumentFragment(e);
  return sizeElementFromChildren(r), r;
}, wrapFragment = function(e, r) {
  return e instanceof DocumentFragment ? makeSpan$2([], [e], r) : e;
}, getVListChildrenAndDepth = function(e) {
  if (e.positionType === "individualShift") {
    for (var r = e.children, o = [r[0]], m = -r[0].shift - r[0].elem.depth, _ = m, g = 1; g < r.length; g++) {
      var y = -r[g].shift - _ - r[g].elem.depth, E = y - (r[g - 1].elem.height + r[g - 1].elem.depth);
      _ = _ + y, o.push({
        type: "kern",
        size: E
      }), o.push(r[g]);
    }
    return {
      children: o,
      depth: m
    };
  }
  var x;
  if (e.positionType === "top") {
    for (var v = e.positionData, h = 0; h < e.children.length; h++) {
      var a = e.children[h];
      v -= a.type === "kern" ? a.size : a.elem.height + a.elem.depth;
    }
    x = v;
  } else if (e.positionType === "bottom")
    x = -e.positionData;
  else {
    var b = e.children[0];
    if (b.type !== "elem")
      throw new Error('First child must have type "elem".');
    if (e.positionType === "shift")
      x = -b.elem.depth - e.positionData;
    else if (e.positionType === "firstBaseline")
      x = -b.elem.depth;
    else
      throw new Error("Invalid positionType " + e.positionType + ".");
  }
  return {
    children: e.children,
    depth: x
  };
}, makeVList = function(e, r) {
  for (var {
    children: o,
    depth: m
  } = getVListChildrenAndDepth(e), _ = 0, g = 0; g < o.length; g++) {
    var y = o[g];
    if (y.type === "elem") {
      var E = y.elem;
      _ = Math.max(_, E.maxFontSize, E.height);
    }
  }
  _ += 2;
  var x = makeSpan$2(["pstrut"], []);
  x.style.height = makeEm(_);
  for (var v = [], h = m, a = m, b = m, w = 0; w < o.length; w++) {
    var k = o[w];
    if (k.type === "kern")
      b += k.size;
    else {
      var A = k.elem, M = k.wrapperClasses || [], $ = k.wrapperStyle || {}, O = makeSpan$2(M, [x, A], void 0, $);
      O.style.top = makeEm(-_ - b - A.depth), k.marginLeft && (O.style.marginLeft = k.marginLeft), k.marginRight && (O.style.marginRight = k.marginRight), v.push(O), b += A.height + A.depth;
    }
    h = Math.min(h, b), a = Math.max(a, b);
  }
  var C = makeSpan$2(["vlist"], v);
  C.style.height = makeEm(a);
  var P;
  if (h < 0) {
    var I = makeSpan$2([], []), N = makeSpan$2(["vlist"], [I]);
    N.style.height = makeEm(-h);
    var R = makeSpan$2(["vlist-s"], [new SymbolNode("​")]);
    P = [makeSpan$2(["vlist-r"], [C, R]), makeSpan$2(["vlist-r"], [N])];
  } else
    P = [makeSpan$2(["vlist-r"], [C])];
  var F = makeSpan$2(["vlist-t"], P);
  return P.length === 2 && F.classes.push("vlist-t2"), F.height = a, F.depth = -h, F;
}, makeGlue = (s, e) => {
  var r = makeSpan$2(["mspace"], [], e), o = calculateSize$1(s, e);
  return r.style.marginRight = makeEm(o), r;
}, retrieveTextFontName = function(e, r, o) {
  var m = "";
  switch (e) {
    case "amsrm":
      m = "AMS";
      break;
    case "textrm":
      m = "Main";
      break;
    case "textsf":
      m = "SansSerif";
      break;
    case "texttt":
      m = "Typewriter";
      break;
    default:
      m = e;
  }
  var _;
  return r === "textbf" && o === "textit" ? _ = "BoldItalic" : r === "textbf" ? _ = "Bold" : r === "textit" ? _ = "Italic" : _ = "Regular", m + "-" + _;
}, fontMap = {
  // styles
  mathbf: {
    variant: "bold",
    fontName: "Main-Bold"
  },
  mathrm: {
    variant: "normal",
    fontName: "Main-Regular"
  },
  textit: {
    variant: "italic",
    fontName: "Main-Italic"
  },
  mathit: {
    variant: "italic",
    fontName: "Main-Italic"
  },
  mathnormal: {
    variant: "italic",
    fontName: "Math-Italic"
  },
  mathsfit: {
    variant: "sans-serif-italic",
    fontName: "SansSerif-Italic"
  },
  // "boldsymbol" is missing because they require the use of multiple fonts:
  // Math-BoldItalic and Main-Bold.  This is handled by a special case in
  // makeOrd which ends up calling boldsymbol.
  // families
  mathbb: {
    variant: "double-struck",
    fontName: "AMS-Regular"
  },
  mathcal: {
    variant: "script",
    fontName: "Caligraphic-Regular"
  },
  mathfrak: {
    variant: "fraktur",
    fontName: "Fraktur-Regular"
  },
  mathscr: {
    variant: "script",
    fontName: "Script-Regular"
  },
  mathsf: {
    variant: "sans-serif",
    fontName: "SansSerif-Regular"
  },
  mathtt: {
    variant: "monospace",
    fontName: "Typewriter-Regular"
  }
}, svgData = {
  //   path, width, height
  vec: ["vec", 0.471, 0.714],
  // values from the font glyph
  oiintSize1: ["oiintSize1", 0.957, 0.499],
  // oval to overlay the integrand
  oiintSize2: ["oiintSize2", 1.472, 0.659],
  oiiintSize1: ["oiiintSize1", 1.304, 0.499],
  oiiintSize2: ["oiiintSize2", 1.98, 0.659]
}, staticSvg = function(e, r) {
  var [o, m, _] = svgData[e], g = new PathNode(o), y = new SvgNode([g], {
    width: makeEm(m),
    height: makeEm(_),
    // Override CSS rule `.katex svg { width: 100% }`
    style: "width:" + makeEm(m),
    viewBox: "0 0 " + 1e3 * m + " " + 1e3 * _,
    preserveAspectRatio: "xMinYMin"
  }), E = makeSvgSpan(["overlay"], [y], r);
  return E.height = _, E.style.height = makeEm(_), E.style.width = makeEm(m), E;
}, buildCommon = {
  fontMap,
  makeSymbol,
  mathsym,
  makeSpan: makeSpan$2,
  makeSvgSpan,
  makeLineSpan,
  makeAnchor,
  makeFragment,
  wrapFragment,
  makeVList,
  makeOrd,
  makeGlue,
  staticSvg,
  svgData,
  tryCombineChars
}, thinspace = {
  number: 3,
  unit: "mu"
}, mediumspace = {
  number: 4,
  unit: "mu"
}, thickspace = {
  number: 5,
  unit: "mu"
}, spacings = {
  mord: {
    mop: thinspace,
    mbin: mediumspace,
    mrel: thickspace,
    minner: thinspace
  },
  mop: {
    mord: thinspace,
    mop: thinspace,
    mrel: thickspace,
    minner: thinspace
  },
  mbin: {
    mord: mediumspace,
    mop: mediumspace,
    mopen: mediumspace,
    minner: mediumspace
  },
  mrel: {
    mord: thickspace,
    mop: thickspace,
    mopen: thickspace,
    minner: thickspace
  },
  mopen: {},
  mclose: {
    mop: thinspace,
    mbin: mediumspace,
    mrel: thickspace,
    minner: thinspace
  },
  mpunct: {
    mord: thinspace,
    mop: thinspace,
    mrel: thickspace,
    mopen: thinspace,
    mclose: thinspace,
    mpunct: thinspace,
    minner: thinspace
  },
  minner: {
    mord: thinspace,
    mop: thinspace,
    mbin: mediumspace,
    mrel: thickspace,
    mopen: thinspace,
    mpunct: thinspace,
    minner: thinspace
  }
}, tightSpacings = {
  mord: {
    mop: thinspace
  },
  mop: {
    mord: thinspace,
    mop: thinspace
  },
  mbin: {},
  mrel: {},
  mopen: {},
  mclose: {
    mop: thinspace
  },
  mpunct: {},
  minner: {
    mop: thinspace
  }
}, _functions = {}, _htmlGroupBuilders = {}, _mathmlGroupBuilders = {};
function defineFunction(s) {
  for (var {
    type: e,
    names: r,
    props: o,
    handler: m,
    htmlBuilder: _,
    mathmlBuilder: g
  } = s, y = {
    type: e,
    numArgs: o.numArgs,
    argTypes: o.argTypes,
    allowedInArgument: !!o.allowedInArgument,
    allowedInText: !!o.allowedInText,
    allowedInMath: o.allowedInMath === void 0 ? !0 : o.allowedInMath,
    numOptionalArgs: o.numOptionalArgs || 0,
    infix: !!o.infix,
    primitive: !!o.primitive,
    handler: m
  }, E = 0; E < r.length; ++E)
    _functions[r[E]] = y;
  e && (_ && (_htmlGroupBuilders[e] = _), g && (_mathmlGroupBuilders[e] = g));
}
function defineFunctionBuilders(s) {
  var {
    type: e,
    htmlBuilder: r,
    mathmlBuilder: o
  } = s;
  defineFunction({
    type: e,
    names: [],
    props: {
      numArgs: 0
    },
    handler() {
      throw new Error("Should never be called.");
    },
    htmlBuilder: r,
    mathmlBuilder: o
  });
}
var normalizeArgument = function(e) {
  return e.type === "ordgroup" && e.body.length === 1 ? e.body[0] : e;
}, ordargument = function(e) {
  return e.type === "ordgroup" ? e.body : [e];
}, makeSpan$1 = buildCommon.makeSpan, binLeftCanceller = ["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"], binRightCanceller = ["rightmost", "mrel", "mclose", "mpunct"], styleMap$1 = {
  display: Style$1.DISPLAY,
  text: Style$1.TEXT,
  script: Style$1.SCRIPT,
  scriptscript: Style$1.SCRIPTSCRIPT
}, DomEnum = {
  mord: "mord",
  mop: "mop",
  mbin: "mbin",
  mrel: "mrel",
  mopen: "mopen",
  mclose: "mclose",
  mpunct: "mpunct",
  minner: "minner"
}, buildExpression$1 = function(e, r, o, m) {
  m === void 0 && (m = [null, null]);
  for (var _ = [], g = 0; g < e.length; g++) {
    var y = buildGroup$1(e[g], r);
    if (y instanceof DocumentFragment) {
      var E = y.children;
      _.push(...E);
    } else
      _.push(y);
  }
  if (buildCommon.tryCombineChars(_), !o)
    return _;
  var x = r;
  if (e.length === 1) {
    var v = e[0];
    v.type === "sizing" ? x = r.havingSize(v.size) : v.type === "styling" && (x = r.havingStyle(styleMap$1[v.style]));
  }
  var h = makeSpan$1([m[0] || "leftmost"], [], r), a = makeSpan$1([m[1] || "rightmost"], [], r), b = o === "root";
  return traverseNonSpaceNodes(_, (w, k) => {
    var A = k.classes[0], M = w.classes[0];
    A === "mbin" && utils.contains(binRightCanceller, M) ? k.classes[0] = "mord" : M === "mbin" && utils.contains(binLeftCanceller, A) && (w.classes[0] = "mord");
  }, {
    node: h
  }, a, b), traverseNonSpaceNodes(_, (w, k) => {
    var A = getTypeOfDomTree(k), M = getTypeOfDomTree(w), $ = A && M ? w.hasClass("mtight") ? tightSpacings[A][M] : spacings[A][M] : null;
    if ($)
      return buildCommon.makeGlue($, x);
  }, {
    node: h
  }, a, b), _;
}, traverseNonSpaceNodes = function s(e, r, o, m, _) {
  m && e.push(m);
  for (var g = 0; g < e.length; g++) {
    var y = e[g], E = checkPartialGroup(y);
    if (E) {
      s(E.children, r, o, null, _);
      continue;
    }
    var x = !y.hasClass("mspace");
    if (x) {
      var v = r(y, o.node);
      v && (o.insertAfter ? o.insertAfter(v) : (e.unshift(v), g++));
    }
    x ? o.node = y : _ && y.hasClass("newline") && (o.node = makeSpan$1(["leftmost"])), o.insertAfter = /* @__PURE__ */ ((h) => (a) => {
      e.splice(h + 1, 0, a), g++;
    })(g);
  }
  m && e.pop();
}, checkPartialGroup = function(e) {
  return e instanceof DocumentFragment || e instanceof Anchor || e instanceof Span && e.hasClass("enclosing") ? e : null;
}, getOutermostNode = function s(e, r) {
  var o = checkPartialGroup(e);
  if (o) {
    var m = o.children;
    if (m.length) {
      if (r === "right")
        return s(m[m.length - 1], "right");
      if (r === "left")
        return s(m[0], "left");
    }
  }
  return e;
}, getTypeOfDomTree = function(e, r) {
  return e ? (r && (e = getOutermostNode(e, r)), DomEnum[e.classes[0]] || null) : null;
}, makeNullDelimiter = function(e, r) {
  var o = ["nulldelimiter"].concat(e.baseSizingClasses());
  return makeSpan$1(r.concat(o));
}, buildGroup$1 = function(e, r, o) {
  if (!e)
    return makeSpan$1();
  if (_htmlGroupBuilders[e.type]) {
    var m = _htmlGroupBuilders[e.type](e, r);
    if (o && r.size !== o.size) {
      m = makeSpan$1(r.sizingClasses(o), [m], r);
      var _ = r.sizeMultiplier / o.sizeMultiplier;
      m.height *= _, m.depth *= _;
    }
    return m;
  } else
    throw new ParseError("Got group of unknown type: '" + e.type + "'");
};
function buildHTMLUnbreakable(s, e) {
  var r = makeSpan$1(["base"], s, e), o = makeSpan$1(["strut"]);
  return o.style.height = makeEm(r.height + r.depth), r.depth && (o.style.verticalAlign = makeEm(-r.depth)), r.children.unshift(o), r;
}
function buildHTML(s, e) {
  var r = null;
  s.length === 1 && s[0].type === "tag" && (r = s[0].tag, s = s[0].body);
  var o = buildExpression$1(s, e, "root"), m;
  o.length === 2 && o[1].hasClass("tag") && (m = o.pop());
  for (var _ = [], g = [], y = 0; y < o.length; y++)
    if (g.push(o[y]), o[y].hasClass("mbin") || o[y].hasClass("mrel") || o[y].hasClass("allowbreak")) {
      for (var E = !1; y < o.length - 1 && o[y + 1].hasClass("mspace") && !o[y + 1].hasClass("newline"); )
        y++, g.push(o[y]), o[y].hasClass("nobreak") && (E = !0);
      E || (_.push(buildHTMLUnbreakable(g, e)), g = []);
    } else o[y].hasClass("newline") && (g.pop(), g.length > 0 && (_.push(buildHTMLUnbreakable(g, e)), g = []), _.push(o[y]));
  g.length > 0 && _.push(buildHTMLUnbreakable(g, e));
  var x;
  r ? (x = buildHTMLUnbreakable(buildExpression$1(r, e, !0)), x.classes = ["tag"], _.push(x)) : m && _.push(m);
  var v = makeSpan$1(["katex-html"], _);
  if (v.setAttribute("aria-hidden", "true"), x) {
    var h = x.children[0];
    h.style.height = makeEm(v.height + v.depth), v.depth && (h.style.verticalAlign = makeEm(-v.depth));
  }
  return v;
}
function newDocumentFragment(s) {
  return new DocumentFragment(s);
}
class MathNode {
  constructor(e, r, o) {
    this.type = void 0, this.attributes = void 0, this.children = void 0, this.classes = void 0, this.type = e, this.attributes = {}, this.children = r || [], this.classes = o || [];
  }
  /**
   * Sets an attribute on a MathML node. MathML depends on attributes to convey a
   * semantic content, so this is used heavily.
   */
  setAttribute(e, r) {
    this.attributes[e] = r;
  }
  /**
   * Gets an attribute on a MathML node.
   */
  getAttribute(e) {
    return this.attributes[e];
  }
  /**
   * Converts the math node into a MathML-namespaced DOM element.
   */
  toNode() {
    var e = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type);
    for (var r in this.attributes)
      Object.prototype.hasOwnProperty.call(this.attributes, r) && e.setAttribute(r, this.attributes[r]);
    this.classes.length > 0 && (e.className = createClass(this.classes));
    for (var o = 0; o < this.children.length; o++)
      if (this.children[o] instanceof TextNode && this.children[o + 1] instanceof TextNode) {
        for (var m = this.children[o].toText() + this.children[++o].toText(); this.children[o + 1] instanceof TextNode; )
          m += this.children[++o].toText();
        e.appendChild(new TextNode(m).toNode());
      } else
        e.appendChild(this.children[o].toNode());
    return e;
  }
  /**
   * Converts the math node into an HTML markup string.
   */
  toMarkup() {
    var e = "<" + this.type;
    for (var r in this.attributes)
      Object.prototype.hasOwnProperty.call(this.attributes, r) && (e += " " + r + '="', e += utils.escape(this.attributes[r]), e += '"');
    this.classes.length > 0 && (e += ' class ="' + utils.escape(createClass(this.classes)) + '"'), e += ">";
    for (var o = 0; o < this.children.length; o++)
      e += this.children[o].toMarkup();
    return e += "</" + this.type + ">", e;
  }
  /**
   * Converts the math node into a string, similar to innerText, but escaped.
   */
  toText() {
    return this.children.map((e) => e.toText()).join("");
  }
}
class TextNode {
  constructor(e) {
    this.text = void 0, this.text = e;
  }
  /**
   * Converts the text node into a DOM text node.
   */
  toNode() {
    return document.createTextNode(this.text);
  }
  /**
   * Converts the text node into escaped HTML markup
   * (representing the text itself).
   */
  toMarkup() {
    return utils.escape(this.toText());
  }
  /**
   * Converts the text node into a string
   * (representing the text itself).
   */
  toText() {
    return this.text;
  }
}
class SpaceNode {
  /**
   * Create a Space node with width given in CSS ems.
   */
  constructor(e) {
    this.width = void 0, this.character = void 0, this.width = e, e >= 0.05555 && e <= 0.05556 ? this.character = " " : e >= 0.1666 && e <= 0.1667 ? this.character = " " : e >= 0.2222 && e <= 0.2223 ? this.character = " " : e >= 0.2777 && e <= 0.2778 ? this.character = "  " : e >= -0.05556 && e <= -0.05555 ? this.character = " ⁣" : e >= -0.1667 && e <= -0.1666 ? this.character = " ⁣" : e >= -0.2223 && e <= -0.2222 ? this.character = " ⁣" : e >= -0.2778 && e <= -0.2777 ? this.character = " ⁣" : this.character = null;
  }
  /**
   * Converts the math node into a MathML-namespaced DOM element.
   */
  toNode() {
    if (this.character)
      return document.createTextNode(this.character);
    var e = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mspace");
    return e.setAttribute("width", makeEm(this.width)), e;
  }
  /**
   * Converts the math node into an HTML markup string.
   */
  toMarkup() {
    return this.character ? "<mtext>" + this.character + "</mtext>" : '<mspace width="' + makeEm(this.width) + '"/>';
  }
  /**
   * Converts the math node into a string, similar to innerText.
   */
  toText() {
    return this.character ? this.character : " ";
  }
}
var mathMLTree = {
  MathNode,
  TextNode,
  SpaceNode,
  newDocumentFragment
}, makeText = function(e, r, o) {
  return symbols[r][e] && symbols[r][e].replace && e.charCodeAt(0) !== 55349 && !(ligatures.hasOwnProperty(e) && o && (o.fontFamily && o.fontFamily.slice(4, 6) === "tt" || o.font && o.font.slice(4, 6) === "tt")) && (e = symbols[r][e].replace), new mathMLTree.TextNode(e);
}, makeRow = function(e) {
  return e.length === 1 ? e[0] : new mathMLTree.MathNode("mrow", e);
}, getVariant = function(e, r) {
  if (r.fontFamily === "texttt")
    return "monospace";
  if (r.fontFamily === "textsf")
    return r.fontShape === "textit" && r.fontWeight === "textbf" ? "sans-serif-bold-italic" : r.fontShape === "textit" ? "sans-serif-italic" : r.fontWeight === "textbf" ? "bold-sans-serif" : "sans-serif";
  if (r.fontShape === "textit" && r.fontWeight === "textbf")
    return "bold-italic";
  if (r.fontShape === "textit")
    return "italic";
  if (r.fontWeight === "textbf")
    return "bold";
  var o = r.font;
  if (!o || o === "mathnormal")
    return null;
  var m = e.mode;
  if (o === "mathit")
    return "italic";
  if (o === "boldsymbol")
    return e.type === "textord" ? "bold" : "bold-italic";
  if (o === "mathbf")
    return "bold";
  if (o === "mathbb")
    return "double-struck";
  if (o === "mathsfit")
    return "sans-serif-italic";
  if (o === "mathfrak")
    return "fraktur";
  if (o === "mathscr" || o === "mathcal")
    return "script";
  if (o === "mathsf")
    return "sans-serif";
  if (o === "mathtt")
    return "monospace";
  var _ = e.text;
  if (utils.contains(["\\imath", "\\jmath"], _))
    return null;
  symbols[m][_] && symbols[m][_].replace && (_ = symbols[m][_].replace);
  var g = buildCommon.fontMap[o].fontName;
  return getCharacterMetrics(_, g, m) ? buildCommon.fontMap[o].variant : null;
};
function isNumberPunctuation(s) {
  if (!s)
    return !1;
  if (s.type === "mi" && s.children.length === 1) {
    var e = s.children[0];
    return e instanceof TextNode && e.text === ".";
  } else if (s.type === "mo" && s.children.length === 1 && s.getAttribute("separator") === "true" && s.getAttribute("lspace") === "0em" && s.getAttribute("rspace") === "0em") {
    var r = s.children[0];
    return r instanceof TextNode && r.text === ",";
  } else
    return !1;
}
var buildExpression = function(e, r, o) {
  if (e.length === 1) {
    var m = buildGroup(e[0], r);
    return o && m instanceof MathNode && m.type === "mo" && (m.setAttribute("lspace", "0em"), m.setAttribute("rspace", "0em")), [m];
  }
  for (var _ = [], g, y = 0; y < e.length; y++) {
    var E = buildGroup(e[y], r);
    if (E instanceof MathNode && g instanceof MathNode) {
      if (E.type === "mtext" && g.type === "mtext" && E.getAttribute("mathvariant") === g.getAttribute("mathvariant")) {
        g.children.push(...E.children);
        continue;
      } else if (E.type === "mn" && g.type === "mn") {
        g.children.push(...E.children);
        continue;
      } else if (isNumberPunctuation(E) && g.type === "mn") {
        g.children.push(...E.children);
        continue;
      } else if (E.type === "mn" && isNumberPunctuation(g))
        E.children = [...g.children, ...E.children], _.pop();
      else if ((E.type === "msup" || E.type === "msub") && E.children.length >= 1 && (g.type === "mn" || isNumberPunctuation(g))) {
        var x = E.children[0];
        x instanceof MathNode && x.type === "mn" && (x.children = [...g.children, ...x.children], _.pop());
      } else if (g.type === "mi" && g.children.length === 1) {
        var v = g.children[0];
        if (v instanceof TextNode && v.text === "̸" && (E.type === "mo" || E.type === "mi" || E.type === "mn")) {
          var h = E.children[0];
          h instanceof TextNode && h.text.length > 0 && (h.text = h.text.slice(0, 1) + "̸" + h.text.slice(1), _.pop());
        }
      }
    }
    _.push(E), g = E;
  }
  return _;
}, buildExpressionRow = function(e, r, o) {
  return makeRow(buildExpression(e, r, o));
}, buildGroup = function(e, r) {
  if (!e)
    return new mathMLTree.MathNode("mrow");
  if (_mathmlGroupBuilders[e.type]) {
    var o = _mathmlGroupBuilders[e.type](e, r);
    return o;
  } else
    throw new ParseError("Got group of unknown type: '" + e.type + "'");
};
function buildMathML(s, e, r, o, m) {
  var _ = buildExpression(s, r), g;
  _.length === 1 && _[0] instanceof MathNode && utils.contains(["mrow", "mtable"], _[0].type) ? g = _[0] : g = new mathMLTree.MathNode("mrow", _);
  var y = new mathMLTree.MathNode("annotation", [new mathMLTree.TextNode(e)]);
  y.setAttribute("encoding", "application/x-tex");
  var E = new mathMLTree.MathNode("semantics", [g, y]), x = new mathMLTree.MathNode("math", [E]);
  x.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML"), o && x.setAttribute("display", "block");
  var v = m ? "katex" : "katex-mathml";
  return buildCommon.makeSpan([v], [x]);
}
var optionsFromSettings = function(e) {
  return new Options({
    style: e.displayMode ? Style$1.DISPLAY : Style$1.TEXT,
    maxSize: e.maxSize,
    minRuleThickness: e.minRuleThickness
  });
}, displayWrap = function(e, r) {
  if (r.displayMode) {
    var o = ["katex-display"];
    r.leqno && o.push("leqno"), r.fleqn && o.push("fleqn"), e = buildCommon.makeSpan(o, [e]);
  }
  return e;
}, buildTree = function(e, r, o) {
  var m = optionsFromSettings(o), _;
  if (o.output === "mathml")
    return buildMathML(e, r, m, o.displayMode, !0);
  if (o.output === "html") {
    var g = buildHTML(e, m);
    _ = buildCommon.makeSpan(["katex"], [g]);
  } else {
    var y = buildMathML(e, r, m, o.displayMode, !1), E = buildHTML(e, m);
    _ = buildCommon.makeSpan(["katex"], [y, E]);
  }
  return displayWrap(_, o);
}, buildHTMLTree = function(e, r, o) {
  var m = optionsFromSettings(o), _ = buildHTML(e, m), g = buildCommon.makeSpan(["katex"], [_]);
  return displayWrap(g, o);
}, stretchyCodePoint = {
  widehat: "^",
  widecheck: "ˇ",
  widetilde: "~",
  utilde: "~",
  overleftarrow: "←",
  underleftarrow: "←",
  xleftarrow: "←",
  overrightarrow: "→",
  underrightarrow: "→",
  xrightarrow: "→",
  underbrace: "⏟",
  overbrace: "⏞",
  overgroup: "⏠",
  undergroup: "⏡",
  overleftrightarrow: "↔",
  underleftrightarrow: "↔",
  xleftrightarrow: "↔",
  Overrightarrow: "⇒",
  xRightarrow: "⇒",
  overleftharpoon: "↼",
  xleftharpoonup: "↼",
  overrightharpoon: "⇀",
  xrightharpoonup: "⇀",
  xLeftarrow: "⇐",
  xLeftrightarrow: "⇔",
  xhookleftarrow: "↩",
  xhookrightarrow: "↪",
  xmapsto: "↦",
  xrightharpoondown: "⇁",
  xleftharpoondown: "↽",
  xrightleftharpoons: "⇌",
  xleftrightharpoons: "⇋",
  xtwoheadleftarrow: "↞",
  xtwoheadrightarrow: "↠",
  xlongequal: "=",
  xtofrom: "⇄",
  xrightleftarrows: "⇄",
  xrightequilibrium: "⇌",
  // Not a perfect match.
  xleftequilibrium: "⇋",
  // None better available.
  "\\cdrightarrow": "→",
  "\\cdleftarrow": "←",
  "\\cdlongequal": "="
}, mathMLnode = function(e) {
  var r = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(stretchyCodePoint[e.replace(/^\\/, "")])]);
  return r.setAttribute("stretchy", "true"), r;
}, katexImagesData = {
  //   path(s), minWidth, height, align
  overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"],
  overleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"],
  underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"],
  underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"],
  xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"],
  "\\cdrightarrow": [["rightarrow"], 3, 522, "xMaxYMin"],
  // CD minwwidth2.5pc
  xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"],
  "\\cdleftarrow": [["leftarrow"], 3, 522, "xMinYMin"],
  Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"],
  xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"],
  xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"],
  overleftharpoon: [["leftharpoon"], 0.888, 522, "xMinYMin"],
  xleftharpoonup: [["leftharpoon"], 0.888, 522, "xMinYMin"],
  xleftharpoondown: [["leftharpoondown"], 0.888, 522, "xMinYMin"],
  overrightharpoon: [["rightharpoon"], 0.888, 522, "xMaxYMin"],
  xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"],
  xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"],
  xlongequal: [["longequal"], 0.888, 334, "xMinYMin"],
  "\\cdlongequal": [["longequal"], 3, 334, "xMinYMin"],
  xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"],
  xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"],
  overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522],
  overbrace: [["leftbrace", "midbrace", "rightbrace"], 1.6, 548],
  underbrace: [["leftbraceunder", "midbraceunder", "rightbraceunder"], 1.6, 548],
  underleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522],
  xleftrightarrow: [["leftarrow", "rightarrow"], 1.75, 522],
  xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560],
  xrightleftharpoons: [["leftharpoondownplus", "rightharpoonplus"], 1.75, 716],
  xleftrightharpoons: [["leftharpoonplus", "rightharpoondownplus"], 1.75, 716],
  xhookleftarrow: [["leftarrow", "righthook"], 1.08, 522],
  xhookrightarrow: [["lefthook", "rightarrow"], 1.08, 522],
  overlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522],
  underlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522],
  overgroup: [["leftgroup", "rightgroup"], 0.888, 342],
  undergroup: [["leftgroupunder", "rightgroupunder"], 0.888, 342],
  xmapsto: [["leftmapsto", "rightarrow"], 1.5, 522],
  xtofrom: [["leftToFrom", "rightToFrom"], 1.75, 528],
  // The next three arrows are from the mhchem package.
  // In mhchem.sty, min-length is 2.0em. But these arrows might appear in the
  // document as \xrightarrow or \xrightleftharpoons. Those have
  // min-length = 1.75em, so we set min-length on these next three to match.
  xrightleftarrows: [["baraboveleftarrow", "rightarrowabovebar"], 1.75, 901],
  xrightequilibrium: [["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], 1.75, 716],
  xleftequilibrium: [["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], 1.75, 716]
}, groupLength = function(e) {
  return e.type === "ordgroup" ? e.body.length : 1;
}, svgSpan = function(e, r) {
  function o() {
    var y = 4e5, E = e.label.slice(1);
    if (utils.contains(["widehat", "widecheck", "widetilde", "utilde"], E)) {
      var x = e, v = groupLength(x.base), h, a, b;
      if (v > 5)
        E === "widehat" || E === "widecheck" ? (h = 420, y = 2364, b = 0.42, a = E + "4") : (h = 312, y = 2340, b = 0.34, a = "tilde4");
      else {
        var w = [1, 1, 2, 2, 3, 3][v];
        E === "widehat" || E === "widecheck" ? (y = [0, 1062, 2364, 2364, 2364][w], h = [0, 239, 300, 360, 420][w], b = [0, 0.24, 0.3, 0.3, 0.36, 0.42][w], a = E + w) : (y = [0, 600, 1033, 2339, 2340][w], h = [0, 260, 286, 306, 312][w], b = [0, 0.26, 0.286, 0.3, 0.306, 0.34][w], a = "tilde" + w);
      }
      var k = new PathNode(a), A = new SvgNode([k], {
        width: "100%",
        height: makeEm(b),
        viewBox: "0 0 " + y + " " + h,
        preserveAspectRatio: "none"
      });
      return {
        span: buildCommon.makeSvgSpan([], [A], r),
        minWidth: 0,
        height: b
      };
    } else {
      var M = [], $ = katexImagesData[E], [O, C, P] = $, I = P / 1e3, N = O.length, R, F;
      if (N === 1) {
        var B = $[3];
        R = ["hide-tail"], F = [B];
      } else if (N === 2)
        R = ["halfarrow-left", "halfarrow-right"], F = ["xMinYMin", "xMaxYMin"];
      else if (N === 3)
        R = ["brace-left", "brace-center", "brace-right"], F = ["xMinYMin", "xMidYMin", "xMaxYMin"];
      else
        throw new Error(`Correct katexImagesData or update code here to support
                    ` + N + " children.");
      for (var G = 0; G < N; G++) {
        var Q = new PathNode(O[G]), ee = new SvgNode([Q], {
          width: "400em",
          height: makeEm(I),
          viewBox: "0 0 " + y + " " + P,
          preserveAspectRatio: F[G] + " slice"
        }), Y = buildCommon.makeSvgSpan([R[G]], [ee], r);
        if (N === 1)
          return {
            span: Y,
            minWidth: C,
            height: I
          };
        Y.style.height = makeEm(I), M.push(Y);
      }
      return {
        span: buildCommon.makeSpan(["stretchy"], M, r),
        minWidth: C,
        height: I
      };
    }
  }
  var {
    span: m,
    minWidth: _,
    height: g
  } = o();
  return m.height = g, m.style.height = makeEm(g), _ > 0 && (m.style.minWidth = makeEm(_)), m;
}, encloseSpan = function(e, r, o, m, _) {
  var g, y = e.height + e.depth + o + m;
  if (/fbox|color|angl/.test(r)) {
    if (g = buildCommon.makeSpan(["stretchy", r], [], _), r === "fbox") {
      var E = _.color && _.getColor();
      E && (g.style.borderColor = E);
    }
  } else {
    var x = [];
    /^[bx]cancel$/.test(r) && x.push(new LineNode({
      x1: "0",
      y1: "0",
      x2: "100%",
      y2: "100%",
      "stroke-width": "0.046em"
    })), /^x?cancel$/.test(r) && x.push(new LineNode({
      x1: "0",
      y1: "100%",
      x2: "100%",
      y2: "0",
      "stroke-width": "0.046em"
    }));
    var v = new SvgNode(x, {
      width: "100%",
      height: makeEm(y)
    });
    g = buildCommon.makeSvgSpan([], [v], _);
  }
  return g.height = y, g.style.height = makeEm(y), g;
}, stretchy = {
  encloseSpan,
  mathMLnode,
  svgSpan
};
function assertNodeType(s, e) {
  if (!s || s.type !== e)
    throw new Error("Expected node of type " + e + ", but got " + (s ? "node of type " + s.type : String(s)));
  return s;
}
function assertSymbolNodeType(s) {
  var e = checkSymbolNodeType(s);
  if (!e)
    throw new Error("Expected node of symbol group type, but got " + (s ? "node of type " + s.type : String(s)));
  return e;
}
function checkSymbolNodeType(s) {
  return s && (s.type === "atom" || NON_ATOMS.hasOwnProperty(s.type)) ? s : null;
}
var htmlBuilder$a = (s, e) => {
  var r, o, m;
  s && s.type === "supsub" ? (o = assertNodeType(s.base, "accent"), r = o.base, s.base = r, m = assertSpan(buildGroup$1(s, e)), s.base = o) : (o = assertNodeType(s, "accent"), r = o.base);
  var _ = buildGroup$1(r, e.havingCrampedStyle()), g = o.isShifty && utils.isCharacterBox(r), y = 0;
  if (g) {
    var E = utils.getBaseElem(r), x = buildGroup$1(E, e.havingCrampedStyle());
    y = assertSymbolDomNode(x).skew;
  }
  var v = o.label === "\\c", h = v ? _.height + _.depth : Math.min(_.height, e.fontMetrics().xHeight), a;
  if (o.isStretchy)
    a = stretchy.svgSpan(o, e), a = buildCommon.makeVList({
      positionType: "firstBaseline",
      children: [{
        type: "elem",
        elem: _
      }, {
        type: "elem",
        elem: a,
        wrapperClasses: ["svg-align"],
        wrapperStyle: y > 0 ? {
          width: "calc(100% - " + makeEm(2 * y) + ")",
          marginLeft: makeEm(2 * y)
        } : void 0
      }]
    }, e);
  else {
    var b, w;
    o.label === "\\vec" ? (b = buildCommon.staticSvg("vec", e), w = buildCommon.svgData.vec[1]) : (b = buildCommon.makeOrd({
      mode: o.mode,
      text: o.label
    }, e, "textord"), b = assertSymbolDomNode(b), b.italic = 0, w = b.width, v && (h += b.depth)), a = buildCommon.makeSpan(["accent-body"], [b]);
    var k = o.label === "\\textcircled";
    k && (a.classes.push("accent-full"), h = _.height);
    var A = y;
    k || (A -= w / 2), a.style.left = makeEm(A), o.label === "\\textcircled" && (a.style.top = ".2em"), a = buildCommon.makeVList({
      positionType: "firstBaseline",
      children: [{
        type: "elem",
        elem: _
      }, {
        type: "kern",
        size: -h
      }, {
        type: "elem",
        elem: a
      }]
    }, e);
  }
  var M = buildCommon.makeSpan(["mord", "accent"], [a], e);
  return m ? (m.children[0] = M, m.height = Math.max(M.height, m.height), m.classes[0] = "mord", m) : M;
}, mathmlBuilder$9 = (s, e) => {
  var r = s.isStretchy ? stretchy.mathMLnode(s.label) : new mathMLTree.MathNode("mo", [makeText(s.label, s.mode)]), o = new mathMLTree.MathNode("mover", [buildGroup(s.base, e), r]);
  return o.setAttribute("accent", "true"), o;
}, NON_STRETCHY_ACCENT_REGEX = new RegExp(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring"].map((s) => "\\" + s).join("|"));
defineFunction({
  type: "accent",
  names: ["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring", "\\widecheck", "\\widehat", "\\widetilde", "\\overrightarrow", "\\overleftarrow", "\\Overrightarrow", "\\overleftrightarrow", "\\overgroup", "\\overlinesegment", "\\overleftharpoon", "\\overrightharpoon"],
  props: {
    numArgs: 1
  },
  handler: (s, e) => {
    var r = normalizeArgument(e[0]), o = !NON_STRETCHY_ACCENT_REGEX.test(s.funcName), m = !o || s.funcName === "\\widehat" || s.funcName === "\\widetilde" || s.funcName === "\\widecheck";
    return {
      type: "accent",
      mode: s.parser.mode,
      label: s.funcName,
      isStretchy: o,
      isShifty: m,
      base: r
    };
  },
  htmlBuilder: htmlBuilder$a,
  mathmlBuilder: mathmlBuilder$9
});
defineFunction({
  type: "accent",
  names: ["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\c", "\\r", "\\H", "\\v", "\\textcircled"],
  props: {
    numArgs: 1,
    allowedInText: !0,
    allowedInMath: !0,
    // unless in strict mode
    argTypes: ["primitive"]
  },
  handler: (s, e) => {
    var r = e[0], o = s.parser.mode;
    return o === "math" && (s.parser.settings.reportNonstrict("mathVsTextAccents", "LaTeX's accent " + s.funcName + " works only in text mode"), o = "text"), {
      type: "accent",
      mode: o,
      label: s.funcName,
      isStretchy: !1,
      isShifty: !0,
      base: r
    };
  },
  htmlBuilder: htmlBuilder$a,
  mathmlBuilder: mathmlBuilder$9
});
defineFunction({
  type: "accentUnder",
  names: ["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"],
  props: {
    numArgs: 1
  },
  handler: (s, e) => {
    var {
      parser: r,
      funcName: o
    } = s, m = e[0];
    return {
      type: "accentUnder",
      mode: r.mode,
      label: o,
      base: m
    };
  },
  htmlBuilder: (s, e) => {
    var r = buildGroup$1(s.base, e), o = stretchy.svgSpan(s, e), m = s.label === "\\utilde" ? 0.12 : 0, _ = buildCommon.makeVList({
      positionType: "top",
      positionData: r.height,
      children: [{
        type: "elem",
        elem: o,
        wrapperClasses: ["svg-align"]
      }, {
        type: "kern",
        size: m
      }, {
        type: "elem",
        elem: r
      }]
    }, e);
    return buildCommon.makeSpan(["mord", "accentunder"], [_], e);
  },
  mathmlBuilder: (s, e) => {
    var r = stretchy.mathMLnode(s.label), o = new mathMLTree.MathNode("munder", [buildGroup(s.base, e), r]);
    return o.setAttribute("accentunder", "true"), o;
  }
});
var paddedNode = (s) => {
  var e = new mathMLTree.MathNode("mpadded", s ? [s] : []);
  return e.setAttribute("width", "+0.6em"), e.setAttribute("lspace", "0.3em"), e;
};
defineFunction({
  type: "xArrow",
  names: [
    "\\xleftarrow",
    "\\xrightarrow",
    "\\xLeftarrow",
    "\\xRightarrow",
    "\\xleftrightarrow",
    "\\xLeftrightarrow",
    "\\xhookleftarrow",
    "\\xhookrightarrow",
    "\\xmapsto",
    "\\xrightharpoondown",
    "\\xrightharpoonup",
    "\\xleftharpoondown",
    "\\xleftharpoonup",
    "\\xrightleftharpoons",
    "\\xleftrightharpoons",
    "\\xlongequal",
    "\\xtwoheadrightarrow",
    "\\xtwoheadleftarrow",
    "\\xtofrom",
    // The next 3 functions are here to support the mhchem extension.
    // Direct use of these functions is discouraged and may break someday.
    "\\xrightleftarrows",
    "\\xrightequilibrium",
    "\\xleftequilibrium",
    // The next 3 functions are here only to support the {CD} environment.
    "\\\\cdrightarrow",
    "\\\\cdleftarrow",
    "\\\\cdlongequal"
  ],
  props: {
    numArgs: 1,
    numOptionalArgs: 1
  },
  handler(s, e, r) {
    var {
      parser: o,
      funcName: m
    } = s;
    return {
      type: "xArrow",
      mode: o.mode,
      label: m,
      body: e[0],
      below: r[0]
    };
  },
  // Flow is unable to correctly infer the type of `group`, even though it's
  // unambiguously determined from the passed-in `type` above.
  htmlBuilder(s, e) {
    var r = e.style, o = e.havingStyle(r.sup()), m = buildCommon.wrapFragment(buildGroup$1(s.body, o, e), e), _ = s.label.slice(0, 2) === "\\x" ? "x" : "cd";
    m.classes.push(_ + "-arrow-pad");
    var g;
    s.below && (o = e.havingStyle(r.sub()), g = buildCommon.wrapFragment(buildGroup$1(s.below, o, e), e), g.classes.push(_ + "-arrow-pad"));
    var y = stretchy.svgSpan(s, e), E = -e.fontMetrics().axisHeight + 0.5 * y.height, x = -e.fontMetrics().axisHeight - 0.5 * y.height - 0.111;
    (m.depth > 0.25 || s.label === "\\xleftequilibrium") && (x -= m.depth);
    var v;
    if (g) {
      var h = -e.fontMetrics().axisHeight + g.height + 0.5 * y.height + 0.111;
      v = buildCommon.makeVList({
        positionType: "individualShift",
        children: [{
          type: "elem",
          elem: m,
          shift: x
        }, {
          type: "elem",
          elem: y,
          shift: E
        }, {
          type: "elem",
          elem: g,
          shift: h
        }]
      }, e);
    } else
      v = buildCommon.makeVList({
        positionType: "individualShift",
        children: [{
          type: "elem",
          elem: m,
          shift: x
        }, {
          type: "elem",
          elem: y,
          shift: E
        }]
      }, e);
    return v.children[0].children[0].children[1].classes.push("svg-align"), buildCommon.makeSpan(["mrel", "x-arrow"], [v], e);
  },
  mathmlBuilder(s, e) {
    var r = stretchy.mathMLnode(s.label);
    r.setAttribute("minsize", s.label.charAt(0) === "x" ? "1.75em" : "3.0em");
    var o;
    if (s.body) {
      var m = paddedNode(buildGroup(s.body, e));
      if (s.below) {
        var _ = paddedNode(buildGroup(s.below, e));
        o = new mathMLTree.MathNode("munderover", [r, _, m]);
      } else
        o = new mathMLTree.MathNode("mover", [r, m]);
    } else if (s.below) {
      var g = paddedNode(buildGroup(s.below, e));
      o = new mathMLTree.MathNode("munder", [r, g]);
    } else
      o = paddedNode(), o = new mathMLTree.MathNode("mover", [r, o]);
    return o;
  }
});
var makeSpan = buildCommon.makeSpan;
function htmlBuilder$9(s, e) {
  var r = buildExpression$1(s.body, e, !0);
  return makeSpan([s.mclass], r, e);
}
function mathmlBuilder$8(s, e) {
  var r, o = buildExpression(s.body, e);
  return s.mclass === "minner" ? r = new mathMLTree.MathNode("mpadded", o) : s.mclass === "mord" ? s.isCharacterBox ? (r = o[0], r.type = "mi") : r = new mathMLTree.MathNode("mi", o) : (s.isCharacterBox ? (r = o[0], r.type = "mo") : r = new mathMLTree.MathNode("mo", o), s.mclass === "mbin" ? (r.attributes.lspace = "0.22em", r.attributes.rspace = "0.22em") : s.mclass === "mpunct" ? (r.attributes.lspace = "0em", r.attributes.rspace = "0.17em") : s.mclass === "mopen" || s.mclass === "mclose" ? (r.attributes.lspace = "0em", r.attributes.rspace = "0em") : s.mclass === "minner" && (r.attributes.lspace = "0.0556em", r.attributes.width = "+0.1111em")), r;
}
defineFunction({
  type: "mclass",
  names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"],
  props: {
    numArgs: 1,
    primitive: !0
  },
  handler(s, e) {
    var {
      parser: r,
      funcName: o
    } = s, m = e[0];
    return {
      type: "mclass",
      mode: r.mode,
      mclass: "m" + o.slice(5),
      // TODO(kevinb): don't prefix with 'm'
      body: ordargument(m),
      isCharacterBox: utils.isCharacterBox(m)
    };
  },
  htmlBuilder: htmlBuilder$9,
  mathmlBuilder: mathmlBuilder$8
});
var binrelClass = (s) => {
  var e = s.type === "ordgroup" && s.body.length ? s.body[0] : s;
  return e.type === "atom" && (e.family === "bin" || e.family === "rel") ? "m" + e.family : "mord";
};
defineFunction({
  type: "mclass",
  names: ["\\@binrel"],
  props: {
    numArgs: 2
  },
  handler(s, e) {
    var {
      parser: r
    } = s;
    return {
      type: "mclass",
      mode: r.mode,
      mclass: binrelClass(e[0]),
      body: ordargument(e[1]),
      isCharacterBox: utils.isCharacterBox(e[1])
    };
  }
});
defineFunction({
  type: "mclass",
  names: ["\\stackrel", "\\overset", "\\underset"],
  props: {
    numArgs: 2
  },
  handler(s, e) {
    var {
      parser: r,
      funcName: o
    } = s, m = e[1], _ = e[0], g;
    o !== "\\stackrel" ? g = binrelClass(m) : g = "mrel";
    var y = {
      type: "op",
      mode: m.mode,
      limits: !0,
      alwaysHandleSupSub: !0,
      parentIsSupSub: !1,
      symbol: !1,
      suppressBaseShift: o !== "\\stackrel",
      body: ordargument(m)
    }, E = {
      type: "supsub",
      mode: _.mode,
      base: y,
      sup: o === "\\underset" ? null : _,
      sub: o === "\\underset" ? _ : null
    };
    return {
      type: "mclass",
      mode: r.mode,
      mclass: g,
      body: [E],
      isCharacterBox: utils.isCharacterBox(E)
    };
  },
  htmlBuilder: htmlBuilder$9,
  mathmlBuilder: mathmlBuilder$8
});
defineFunction({
  type: "pmb",
  names: ["\\pmb"],
  props: {
    numArgs: 1,
    allowedInText: !0
  },
  handler(s, e) {
    var {
      parser: r
    } = s;
    return {
      type: "pmb",
      mode: r.mode,
      mclass: binrelClass(e[0]),
      body: ordargument(e[0])
    };
  },
  htmlBuilder(s, e) {
    var r = buildExpression$1(s.body, e, !0), o = buildCommon.makeSpan([s.mclass], r, e);
    return o.style.textShadow = "0.02em 0.01em 0.04px", o;
  },
  mathmlBuilder(s, e) {
    var r = buildExpression(s.body, e), o = new mathMLTree.MathNode("mstyle", r);
    return o.setAttribute("style", "text-shadow: 0.02em 0.01em 0.04px"), o;
  }
});
var cdArrowFunctionName = {
  ">": "\\\\cdrightarrow",
  "<": "\\\\cdleftarrow",
  "=": "\\\\cdlongequal",
  A: "\\uparrow",
  V: "\\downarrow",
  "|": "\\Vert",
  ".": "no arrow"
}, newCell = () => ({
  type: "styling",
  body: [],
  mode: "math",
  style: "display"
}), isStartOfArrow = (s) => s.type === "textord" && s.text === "@", isLabelEnd = (s, e) => (s.type === "mathord" || s.type === "atom") && s.text === e;
function cdArrow(s, e, r) {
  var o = cdArrowFunctionName[s];
  switch (o) {
    case "\\\\cdrightarrow":
    case "\\\\cdleftarrow":
      return r.callFunction(o, [e[0]], [e[1]]);
    case "\\uparrow":
    case "\\downarrow": {
      var m = r.callFunction("\\\\cdleft", [e[0]], []), _ = {
        type: "atom",
        text: o,
        mode: "math",
        family: "rel"
      }, g = r.callFunction("\\Big", [_], []), y = r.callFunction("\\\\cdright", [e[1]], []), E = {
        type: "ordgroup",
        mode: "math",
        body: [m, g, y]
      };
      return r.callFunction("\\\\cdparent", [E], []);
    }
    case "\\\\cdlongequal":
      return r.callFunction("\\\\cdlongequal", [], []);
    case "\\Vert": {
      var x = {
        type: "textord",
        text: "\\Vert",
        mode: "math"
      };
      return r.callFunction("\\Big", [x], []);
    }
    default:
      return {
        type: "textord",
        text: " ",
        mode: "math"
      };
  }
}
function parseCD(s) {
  var e = [];
  for (s.gullet.beginGroup(), s.gullet.macros.set("\\cr", "\\\\\\relax"), s.gullet.beginGroup(); ; ) {
    e.push(s.parseExpression(!1, "\\\\")), s.gullet.endGroup(), s.gullet.beginGroup();
    var r = s.fetch().text;
    if (r === "&" || r === "\\\\")
      s.consume();
    else if (r === "\\end") {
      e[e.length - 1].length === 0 && e.pop();
      break;
    } else
      throw new ParseError("Expected \\\\ or \\cr or \\end", s.nextToken);
  }
  for (var o = [], m = [o], _ = 0; _ < e.length; _++) {
    for (var g = e[_], y = newCell(), E = 0; E < g.length; E++)
      if (!isStartOfArrow(g[E]))
        y.body.push(g[E]);
      else {
        o.push(y), E += 1;
        var x = assertSymbolNodeType(g[E]).text, v = new Array(2);
        if (v[0] = {
          type: "ordgroup",
          mode: "math",
          body: []
        }, v[1] = {
          type: "ordgroup",
          mode: "math",
          body: []
        }, !("=|.".indexOf(x) > -1)) if ("<>AV".indexOf(x) > -1)
          for (var h = 0; h < 2; h++) {
            for (var a = !0, b = E + 1; b < g.length; b++) {
              if (isLabelEnd(g[b], x)) {
                a = !1, E = b;
                break;
              }
              if (isStartOfArrow(g[b]))
                throw new ParseError("Missing a " + x + " character to complete a CD arrow.", g[b]);
              v[h].body.push(g[b]);
            }
            if (a)
              throw new ParseError("Missing a " + x + " character to complete a CD arrow.", g[E]);
          }
        else
          throw new ParseError('Expected one of "<>AV=|." after @', g[E]);
        var w = cdArrow(x, v, s), k = {
          type: "styling",
          body: [w],
          mode: "math",
          style: "display"
          // CD is always displaystyle.
        };
        o.push(k), y = newCell();
      }
    _ % 2 === 0 ? o.push(y) : o.shift(), o = [], m.push(o);
  }
  s.gullet.endGroup(), s.gullet.endGroup();
  var A = new Array(m[0].length).fill({
    type: "align",
    align: "c",
    pregap: 0.25,
    // CD package sets \enskip between columns.
    postgap: 0.25
    // So pre and post each get half an \enskip, i.e. 0.25em.
  });
  return {
    type: "array",
    mode: "math",
    body: m,
    arraystretch: 1,
    addJot: !0,
    rowGaps: [null],
    cols: A,
    colSeparationType: "CD",
    hLinesBeforeRow: new Array(m.length + 1).fill([])
  };
}
defineFunction({
  type: "cdlabel",
  names: ["\\\\cdleft", "\\\\cdright"],
  props: {
    numArgs: 1
  },
  handler(s, e) {
    var {
      parser: r,
      funcName: o
    } = s;
    return {
      type: "cdlabel",
      mode: r.mode,
      side: o.slice(4),
      label: e[0]
    };
  },
  htmlBuilder(s, e) {
    var r = e.havingStyle(e.style.sup()), o = buildCommon.wrapFragment(buildGroup$1(s.label, r, e), e);
    return o.classes.push("cd-label-" + s.side), o.style.bottom = makeEm(0.8 - o.depth), o.height = 0, o.depth = 0, o;
  },
  mathmlBuilder(s, e) {
    var r = new mathMLTree.MathNode("mrow", [buildGroup(s.label, e)]);
    return r = new mathMLTree.MathNode("mpadded", [r]), r.setAttribute("width", "0"), s.side === "left" && r.setAttribute("lspace", "-1width"), r.setAttribute("voffset", "0.7em"), r = new mathMLTree.MathNode("mstyle", [r]), r.setAttribute("displaystyle", "false"), r.setAttribute("scriptlevel", "1"), r;
  }
});
defineFunction({
  type: "cdlabelparent",
  names: ["\\\\cdparent"],
  props: {
    numArgs: 1
  },
  handler(s, e) {
    var {
      parser: r
    } = s;
    return {
      type: "cdlabelparent",
      mode: r.mode,
      fragment: e[0]
    };
  },
  htmlBuilder(s, e) {
    var r = buildCommon.wrapFragment(buildGroup$1(s.fragment, e), e);
    return r.classes.push("cd-vert-arrow"), r;
  },
  mathmlBuilder(s, e) {
    return new mathMLTree.MathNode("mrow", [buildGroup(s.fragment, e)]);
  }
});
defineFunction({
  type: "textord",
  names: ["\\@char"],
  props: {
    numArgs: 1,
    allowedInText: !0
  },
  handler(s, e) {
    for (var {
      parser: r
    } = s, o = assertNodeType(e[0], "ordgroup"), m = o.body, _ = "", g = 0; g < m.length; g++) {
      var y = assertNodeType(m[g], "textord");
      _ += y.text;
    }
    var E = parseInt(_), x;
    if (isNaN(E))
      throw new ParseError("\\@char has non-numeric argument " + _);
    if (E < 0 || E >= 1114111)
      throw new ParseError("\\@char with invalid code point " + _);
    return E <= 65535 ? x = String.fromCharCode(E) : (E -= 65536, x = String.fromCharCode((E >> 10) + 55296, (E & 1023) + 56320)), {
      type: "textord",
      mode: r.mode,
      text: x
    };
  }
});
var htmlBuilder$8 = (s, e) => {
  var r = buildExpression$1(s.body, e.withColor(s.color), !1);
  return buildCommon.makeFragment(r);
}, mathmlBuilder$7 = (s, e) => {
  var r = buildExpression(s.body, e.withColor(s.color)), o = new mathMLTree.MathNode("mstyle", r);
  return o.setAttribute("mathcolor", s.color), o;
};
defineFunction({
  type: "color",
  names: ["\\textcolor"],
  props: {
    numArgs: 2,
    allowedInText: !0,
    argTypes: ["color", "original"]
  },
  handler(s, e) {
    var {
      parser: r
    } = s, o = assertNodeType(e[0], "color-token").color, m = e[1];
    return {
      type: "color",
      mode: r.mode,
      color: o,
      body: ordargument(m)
    };
  },
  htmlBuilder: htmlBuilder$8,
  mathmlBuilder: mathmlBuilder$7
});
defineFunction({
  type: "color",
  names: ["\\color"],
  props: {
    numArgs: 1,
    allowedInText: !0,
    argTypes: ["color"]
  },
  handler(s, e) {
    var {
      parser: r,
      breakOnTokenText: o
    } = s, m = assertNodeType(e[0], "color-token").color;
    r.gullet.macros.set("\\current@color", m);
    var _ = r.parseExpression(!0, o);
    return {
      type: "color",
      mode: r.mode,
      color: m,
      body: _
    };
  },
  htmlBuilder: htmlBuilder$8,
  mathmlBuilder: mathmlBuilder$7
});
defineFunction({
  type: "cr",
  names: ["\\\\"],
  props: {
    numArgs: 0,
    numOptionalArgs: 0,
    allowedInText: !0
  },
  handler(s, e, r) {
    var {
      parser: o
    } = s, m = o.gullet.future().text === "[" ? o.parseSizeGroup(!0) : null, _ = !o.settings.displayMode || !o.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline does nothing in display mode");
    return {
      type: "cr",
      mode: o.mode,
      newLine: _,
      size: m && assertNodeType(m, "size").value
    };
  },
  // The following builders are called only at the top level,
  // not within tabular/array environments.
  htmlBuilder(s, e) {
    var r = buildCommon.makeSpan(["mspace"], [], e);
    return s.newLine && (r.classes.push("newline"), s.size && (r.style.marginTop = makeEm(calculateSize$1(s.size, e)))), r;
  },
  mathmlBuilder(s, e) {
    var r = new mathMLTree.MathNode("mspace");
    return s.newLine && (r.setAttribute("linebreak", "newline"), s.size && r.setAttribute("height", makeEm(calculateSize$1(s.size, e)))), r;
  }
});
var globalMap = {
  "\\global": "\\global",
  "\\long": "\\\\globallong",
  "\\\\globallong": "\\\\globallong",
  "\\def": "\\gdef",
  "\\gdef": "\\gdef",
  "\\edef": "\\xdef",
  "\\xdef": "\\xdef",
  "\\let": "\\\\globallet",
  "\\futurelet": "\\\\globalfuture"
}, checkControlSequence = (s) => {
  var e = s.text;
  if (/^(?:[\\{}$&#^_]|EOF)$/.test(e))
    throw new ParseError("Expected a control sequence", s);
  return e;
}, getRHS = (s) => {
  var e = s.gullet.popToken();
  return e.text === "=" && (e = s.gullet.popToken(), e.text === " " && (e = s.gullet.popToken())), e;
}, letCommand = (s, e, r, o) => {
  var m = s.gullet.macros.get(r.text);
  m == null && (r.noexpand = !0, m = {
    tokens: [r],
    numArgs: 0,
    // reproduce the same behavior in expansion
    unexpandable: !s.gullet.isExpandable(r.text)
  }), s.gullet.macros.set(e, m, o);
};
defineFunction({
  type: "internal",
  names: [
    "\\global",
    "\\long",
    "\\\\globallong"
    // can’t be entered directly
  ],
  props: {
    numArgs: 0,
    allowedInText: !0
  },
  handler(s) {
    var {
      parser: e,
      funcName: r
    } = s;
    e.consumeSpaces();
    var o = e.fetch();
    if (globalMap[o.text])
      return (r === "\\global" || r === "\\\\globallong") && (o.text = globalMap[o.text]), assertNodeType(e.parseFunction(), "internal");
    throw new ParseError("Invalid token after macro prefix", o);
  }
});
defineFunction({
  type: "internal",
  names: ["\\def", "\\gdef", "\\edef", "\\xdef"],
  props: {
    numArgs: 0,
    allowedInText: !0,
    primitive: !0
  },
  handler(s) {
    var {
      parser: e,
      funcName: r
    } = s, o = e.gullet.popToken(), m = o.text;
    if (/^(?:[\\{}$&#^_]|EOF)$/.test(m))
      throw new ParseError("Expected a control sequence", o);
    for (var _ = 0, g, y = [[]]; e.gullet.future().text !== "{"; )
      if (o = e.gullet.popToken(), o.text === "#") {
        if (e.gullet.future().text === "{") {
          g = e.gullet.future(), y[_].push("{");
          break;
        }
        if (o = e.gullet.popToken(), !/^[1-9]$/.test(o.text))
          throw new ParseError('Invalid argument number "' + o.text + '"');
        if (parseInt(o.text) !== _ + 1)
          throw new ParseError('Argument number "' + o.text + '" out of order');
        _++, y.push([]);
      } else {
        if (o.text === "EOF")
          throw new ParseError("Expected a macro definition");
        y[_].push(o.text);
      }
    var {
      tokens: E
    } = e.gullet.consumeArg();
    return g && E.unshift(g), (r === "\\edef" || r === "\\xdef") && (E = e.gullet.expandTokens(E), E.reverse()), e.gullet.macros.set(m, {
      tokens: E,
      numArgs: _,
      delimiters: y
    }, r === globalMap[r]), {
      type: "internal",
      mode: e.mode
    };
  }
});
defineFunction({
  type: "internal",
  names: [
    "\\let",
    "\\\\globallet"
    // can’t be entered directly
  ],
  props: {
    numArgs: 0,
    allowedInText: !0,
    primitive: !0
  },
  handler(s) {
    var {
      parser: e,
      funcName: r
    } = s, o = checkControlSequence(e.gullet.popToken());
    e.gullet.consumeSpaces();
    var m = getRHS(e);
    return letCommand(e, o, m, r === "\\\\globallet"), {
      type: "internal",
      mode: e.mode
    };
  }
});
defineFunction({
  type: "internal",
  names: [
    "\\futurelet",
    "\\\\globalfuture"
    // can’t be entered directly
  ],
  props: {
    numArgs: 0,
    allowedInText: !0,
    primitive: !0
  },
  handler(s) {
    var {
      parser: e,
      funcName: r
    } = s, o = checkControlSequence(e.gullet.popToken()), m = e.gullet.popToken(), _ = e.gullet.popToken();
    return letCommand(e, o, _, r === "\\\\globalfuture"), e.gullet.pushToken(_), e.gullet.pushToken(m), {
      type: "internal",
      mode: e.mode
    };
  }
});
var getMetrics = function(e, r, o) {
  var m = symbols.math[e] && symbols.math[e].replace, _ = getCharacterMetrics(m || e, r, o);
  if (!_)
    throw new Error("Unsupported symbol " + e + " and font size " + r + ".");
  return _;
}, styleWrap = function(e, r, o, m) {
  var _ = o.havingBaseStyle(r), g = buildCommon.makeSpan(m.concat(_.sizingClasses(o)), [e], o), y = _.sizeMultiplier / o.sizeMultiplier;
  return g.height *= y, g.depth *= y, g.maxFontSize = _.sizeMultiplier, g;
}, centerSpan = function(e, r, o) {
  var m = r.havingBaseStyle(o), _ = (1 - r.sizeMultiplier / m.sizeMultiplier) * r.fontMetrics().axisHeight;
  e.classes.push("delimcenter"), e.style.top = makeEm(_), e.height -= _, e.depth += _;
}, makeSmallDelim = function(e, r, o, m, _, g) {
  var y = buildCommon.makeSymbol(e, "Main-Regular", _, m), E = styleWrap(y, r, m, g);
  return o && centerSpan(E, m, r), E;
}, mathrmSize = function(e, r, o, m) {
  return buildCommon.makeSymbol(e, "Size" + r + "-Regular", o, m);
}, makeLargeDelim = function(e, r, o, m, _, g) {
  var y = mathrmSize(e, r, _, m), E = styleWrap(buildCommon.makeSpan(["delimsizing", "size" + r], [y], m), Style$1.TEXT, m, g);
  return o && centerSpan(E, m, Style$1.TEXT), E;
}, makeGlyphSpan = function(e, r, o) {
  var m;
  r === "Size1-Regular" ? m = "delim-size1" : m = "delim-size4";
  var _ = buildCommon.makeSpan(["delimsizinginner", m], [buildCommon.makeSpan([], [buildCommon.makeSymbol(e, r, o)])]);
  return {
    type: "elem",
    elem: _
  };
}, makeInner = function(e, r, o) {
  var m = fontMetricsData["Size4-Regular"][e.charCodeAt(0)] ? fontMetricsData["Size4-Regular"][e.charCodeAt(0)][4] : fontMetricsData["Size1-Regular"][e.charCodeAt(0)][4], _ = new PathNode("inner", innerPath(e, Math.round(1e3 * r))), g = new SvgNode([_], {
    width: makeEm(m),
    height: makeEm(r),
    // Override CSS rule `.katex svg { width: 100% }`
    style: "width:" + makeEm(m),
    viewBox: "0 0 " + 1e3 * m + " " + Math.round(1e3 * r),
    preserveAspectRatio: "xMinYMin"
  }), y = buildCommon.makeSvgSpan([], [g], o);
  return y.height = r, y.style.height = makeEm(r), y.style.width = makeEm(m), {
    type: "elem",
    elem: y
  };
}, lapInEms = 8e-3, lap = {
  type: "kern",
  size: -1 * lapInEms
}, verts = ["|", "\\lvert", "\\rvert", "\\vert"], doubleVerts = ["\\|", "\\lVert", "\\rVert", "\\Vert"], makeStackedDelim = function(e, r, o, m, _, g) {
  var y, E, x, v, h = "", a = 0;
  y = x = v = e, E = null;
  var b = "Size1-Regular";
  e === "\\uparrow" ? x = v = "⏐" : e === "\\Uparrow" ? x = v = "‖" : e === "\\downarrow" ? y = x = "⏐" : e === "\\Downarrow" ? y = x = "‖" : e === "\\updownarrow" ? (y = "\\uparrow", x = "⏐", v = "\\downarrow") : e === "\\Updownarrow" ? (y = "\\Uparrow", x = "‖", v = "\\Downarrow") : utils.contains(verts, e) ? (x = "∣", h = "vert", a = 333) : utils.contains(doubleVerts, e) ? (x = "∥", h = "doublevert", a = 556) : e === "[" || e === "\\lbrack" ? (y = "⎡", x = "⎢", v = "⎣", b = "Size4-Regular", h = "lbrack", a = 667) : e === "]" || e === "\\rbrack" ? (y = "⎤", x = "⎥", v = "⎦", b = "Size4-Regular", h = "rbrack", a = 667) : e === "\\lfloor" || e === "⌊" ? (x = y = "⎢", v = "⎣", b = "Size4-Regular", h = "lfloor", a = 667) : e === "\\lceil" || e === "⌈" ? (y = "⎡", x = v = "⎢", b = "Size4-Regular", h = "lceil", a = 667) : e === "\\rfloor" || e === "⌋" ? (x = y = "⎥", v = "⎦", b = "Size4-Regular", h = "rfloor", a = 667) : e === "\\rceil" || e === "⌉" ? (y = "⎤", x = v = "⎥", b = "Size4-Regular", h = "rceil", a = 667) : e === "(" || e === "\\lparen" ? (y = "⎛", x = "⎜", v = "⎝", b = "Size4-Regular", h = "lparen", a = 875) : e === ")" || e === "\\rparen" ? (y = "⎞", x = "⎟", v = "⎠", b = "Size4-Regular", h = "rparen", a = 875) : e === "\\{" || e === "\\lbrace" ? (y = "⎧", E = "⎨", v = "⎩", x = "⎪", b = "Size4-Regular") : e === "\\}" || e === "\\rbrace" ? (y = "⎫", E = "⎬", v = "⎭", x = "⎪", b = "Size4-Regular") : e === "\\lgroup" || e === "⟮" ? (y = "⎧", v = "⎩", x = "⎪", b = "Size4-Regular") : e === "\\rgroup" || e === "⟯" ? (y = "⎫", v = "⎭", x = "⎪", b = "Size4-Regular") : e === "\\lmoustache" || e === "⎰" ? (y = "⎧", v = "⎭", x = "⎪", b = "Size4-Regular") : (e === "\\rmoustache" || e === "⎱") && (y = "⎫", v = "⎩", x = "⎪", b = "Size4-Regular");
  var w = getMetrics(y, b, _), k = w.height + w.depth, A = getMetrics(x, b, _), M = A.height + A.depth, $ = getMetrics(v, b, _), O = $.height + $.depth, C = 0, P = 1;
  if (E !== null) {
    var I = getMetrics(E, b, _);
    C = I.height + I.depth, P = 2;
  }
  var N = k + O + C, R = Math.max(0, Math.ceil((r - N) / (P * M))), F = N + R * P * M, B = m.fontMetrics().axisHeight;
  o && (B *= m.sizeMultiplier);
  var G = F / 2 - B, Q = [];
  if (h.length > 0) {
    var ee = F - k - O, Y = Math.round(F * 1e3), W = tallDelim(h, Math.round(ee * 1e3)), j = new PathNode(h, W), J = (a / 1e3).toFixed(3) + "em", me = (Y / 1e3).toFixed(3) + "em", pe = new SvgNode([j], {
      width: J,
      height: me,
      viewBox: "0 0 " + a + " " + Y
    }), ye = buildCommon.makeSvgSpan([], [pe], m);
    ye.height = Y / 1e3, ye.style.width = J, ye.style.height = me, Q.push({
      type: "elem",
      elem: ye
    });
  } else {
    if (Q.push(makeGlyphSpan(v, b, _)), Q.push(lap), E === null) {
      var oe = F - k - O + 2 * lapInEms;
      Q.push(makeInner(x, oe, m));
    } else {
      var we = (F - k - O - C) / 2 + 2 * lapInEms;
      Q.push(makeInner(x, we, m)), Q.push(lap), Q.push(makeGlyphSpan(E, b, _)), Q.push(lap), Q.push(makeInner(x, we, m));
    }
    Q.push(lap), Q.push(makeGlyphSpan(y, b, _));
  }
  var Se = m.havingBaseStyle(Style$1.TEXT), Me = buildCommon.makeVList({
    positionType: "bottom",
    positionData: G,
    children: Q
  }, Se);
  return styleWrap(buildCommon.makeSpan(["delimsizing", "mult"], [Me], Se), Style$1.TEXT, m, g);
}, vbPad = 80, emPad = 0.08, sqrtSvg = function(e, r, o, m, _) {
  var g = sqrtPath(e, m, o), y = new PathNode(e, g), E = new SvgNode([y], {
    // Note: 1000:1 ratio of viewBox to document em width.
    width: "400em",
    height: makeEm(r),
    viewBox: "0 0 400000 " + o,
    preserveAspectRatio: "xMinYMin slice"
  });
  return buildCommon.makeSvgSpan(["hide-tail"], [E], _);
}, makeSqrtImage = function(e, r) {
  var o = r.havingBaseSizing(), m = traverseSequence("\\surd", e * o.sizeMultiplier, stackLargeDelimiterSequence, o), _ = o.sizeMultiplier, g = Math.max(0, r.minRuleThickness - r.fontMetrics().sqrtRuleThickness), y, E = 0, x = 0, v = 0, h;
  return m.type === "small" ? (v = 1e3 + 1e3 * g + vbPad, e < 1 ? _ = 1 : e < 1.4 && (_ = 0.7), E = (1 + g + emPad) / _, x = (1 + g) / _, y = sqrtSvg("sqrtMain", E, v, g, r), y.style.minWidth = "0.853em", h = 0.833 / _) : m.type === "large" ? (v = (1e3 + vbPad) * sizeToMaxHeight[m.size], x = (sizeToMaxHeight[m.size] + g) / _, E = (sizeToMaxHeight[m.size] + g + emPad) / _, y = sqrtSvg("sqrtSize" + m.size, E, v, g, r), y.style.minWidth = "1.02em", h = 1 / _) : (E = e + g + emPad, x = e + g, v = Math.floor(1e3 * e + g) + vbPad, y = sqrtSvg("sqrtTall", E, v, g, r), y.style.minWidth = "0.742em", h = 1.056), y.height = x, y.style.height = makeEm(E), {
    span: y,
    advanceWidth: h,
    // Calculate the actual line width.
    // This actually should depend on the chosen font -- e.g. \boldmath
    // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and
    // have thicker rules.
    ruleWidth: (r.fontMetrics().sqrtRuleThickness + g) * _
  };
}, stackLargeDelimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "⌊", "⌋", "\\lceil", "\\rceil", "⌈", "⌉", "\\surd"], stackAlwaysDelimiters = ["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "⟮", "⟯", "\\lmoustache", "\\rmoustache", "⎰", "⎱"], stackNeverDelimiters = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"], sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3], makeSizedDelim = function(e, r, o, m, _) {
  if (e === "<" || e === "\\lt" || e === "⟨" ? e = "\\langle" : (e === ">" || e === "\\gt" || e === "⟩") && (e = "\\rangle"), utils.contains(stackLargeDelimiters, e) || utils.contains(stackNeverDelimiters, e))
    return makeLargeDelim(e, r, !1, o, m, _);
  if (utils.contains(stackAlwaysDelimiters, e))
    return makeStackedDelim(e, sizeToMaxHeight[r], !1, o, m, _);
  throw new ParseError("Illegal delimiter: '" + e + "'");
}, stackNeverDelimiterSequence = [{
  type: "small",
  style: Style$1.SCRIPTSCRIPT
}, {
  type: "small",
  style: Style$1.SCRIPT
}, {
  type: "small",
  style: Style$1.TEXT
}, {
  type: "large",
  size: 1
}, {
  type: "large",
  size: 2
}, {
  type: "large",
  size: 3
}, {
  type: "large",
  size: 4
}], stackAlwaysDelimiterSequence = [{
  type: "small",
  style: Style$1.SCRIPTSCRIPT
}, {
  type: "small",
  style: Style$1.SCRIPT
}, {
  type: "small",
  style: Style$1.TEXT
}, {
  type: "stack"
}], stackLargeDelimiterSequence = [{
  type: "small",
  style: Style$1.SCRIPTSCRIPT
}, {
  type: "small",
  style: Style$1.SCRIPT
}, {
  type: "small",
  style: Style$1.TEXT
}, {
  type: "large",
  size: 1
}, {
  type: "large",
  size: 2
}, {
  type: "large",
  size: 3
}, {
  type: "large",
  size: 4
}, {
  type: "stack"
}], delimTypeToFont = function(e) {
  if (e.type === "small")
    return "Main-Regular";
  if (e.type === "large")
    return "Size" + e.size + "-Regular";
  if (e.type === "stack")
    return "Size4-Regular";
  throw new Error("Add support for delim type '" + e.type + "' here.");
}, traverseSequence = function(e, r, o, m) {
  for (var _ = Math.min(2, 3 - m.style.size), g = _; g < o.length && o[g].type !== "stack"; g++) {
    var y = getMetrics(e, delimTypeToFont(o[g]), "math"), E = y.height + y.depth;
    if (o[g].type === "small") {
      var x = m.havingBaseStyle(o[g].style);
      E *= x.sizeMultiplier;
    }
    if (E > r)
      return o[g];
  }
  return o[o.length - 1];
}, makeCustomSizedDelim = function(e, r, o, m, _, g) {
  e === "<" || e === "\\lt" || e === "⟨" ? e = "\\langle" : (e === ">" || e === "\\gt" || e === "⟩") && (e = "\\rangle");
  var y;
  utils.contains(stackNeverDelimiters, e) ? y = stackNeverDelimiterSequence : utils.contains(stackLargeDelimiters, e) ? y = stackLargeDelimiterSequence : y = stackAlwaysDelimiterSequence;
  var E = traverseSequence(e, r, y, m);
  return E.type === "small" ? makeSmallDelim(e, E.style, o, m, _, g) : E.type === "large" ? makeLargeDelim(e, E.size, o, m, _, g) : makeStackedDelim(e, r, o, m, _, g);
}, makeLeftRightDelim = function(e, r, o, m, _, g) {
  var y = m.fontMetrics().axisHeight * m.sizeMultiplier, E = 901, x = 5 / m.fontMetrics().ptPerEm, v = Math.max(r - y, o + y), h = Math.max(
    // In real TeX, calculations are done using integral values which are
    // 65536 per pt, or 655360 per em. So, the division here truncates in
    // TeX but doesn't here, producing different results. If we wanted to
    // exactly match TeX's calculation, we could do
    //   Math.floor(655360 * maxDistFromAxis / 500) *
    //    delimiterFactor / 655360
    // (To see the difference, compare
    //    x^{x^{\left(\rule{0.1em}{0.68em}\right)}}
    // in TeX and KaTeX)
    v / 500 * E,
    2 * v - x
  );
  return makeCustomSizedDelim(e, h, !0, m, _, g);
}, delimiter = {
  sqrtImage: makeSqrtImage,
  sizedDelim: makeSizedDelim,
  sizeToMaxHeight,
  customSizedDelim: makeCustomSizedDelim,
  leftRightDelim: makeLeftRightDelim
}, delimiterSizes = {
  "\\bigl": {
    mclass: "mopen",
    size: 1
  },
  "\\Bigl": {
    mclass: "mopen",
    size: 2
  },
  "\\biggl": {
    mclass: "mopen",
    size: 3
  },
  "\\Biggl": {
    mclass: "mopen",
    size: 4
  },
  "\\bigr": {
    mclass: "mclose",
    size: 1
  },
  "\\Bigr": {
    mclass: "mclose",
    size: 2
  },
  "\\biggr": {
    mclass: "mclose",
    size: 3
  },
  "\\Biggr": {
    mclass: "mclose",
    size: 4
  },
  "\\bigm": {
    mclass: "mrel",
    size: 1
  },
  "\\Bigm": {
    mclass: "mrel",
    size: 2
  },
  "\\biggm": {
    mclass: "mrel",
    size: 3
  },
  "\\Biggm": {
    mclass: "mrel",
    size: 4
  },
  "\\big": {
    mclass: "mord",
    size: 1
  },
  "\\Big": {
    mclass: "mord",
    size: 2
  },
  "\\bigg": {
    mclass: "mord",
    size: 3
  },
  "\\Bigg": {
    mclass: "mord",
    size: 4
  }
}, delimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "⌊", "⌋", "\\lceil", "\\rceil", "⌈", "⌉", "<", ">", "\\langle", "⟨", "\\rangle", "⟩", "\\lt", "\\gt", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "⟮", "⟯", "\\lmoustache", "\\rmoustache", "⎰", "⎱", "/", "\\backslash", "|", "\\vert", "\\|", "\\Vert", "\\uparrow", "\\Uparrow", "\\downarrow", "\\Downarrow", "\\updownarrow", "\\Updownarrow", "."];
function checkDelimiter(s, e) {
  var r = checkSymbolNodeType(s);
  if (r && utils.contains(delimiters, r.text))
    return r;
  throw r ? new ParseError("Invalid delimiter '" + r.text + "' after '" + e.funcName + "'", s) : new ParseError("Invalid delimiter type '" + s.type + "'", s);
}
defineFunction({
  type: "delimsizing",
  names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"],
  props: {
    numArgs: 1,
    argTypes: ["primitive"]
  },
  handler: (s, e) => {
    var r = checkDelimiter(e[0], s);
    return {
      type: "delimsizing",
      mode: s.parser.mode,
      size: delimiterSizes[s.funcName].size,
      mclass: delimiterSizes[s.funcName].mclass,
      delim: r.text
    };
  },
  htmlBuilder: (s, e) => s.delim === "." ? buildCommon.makeSpan([s.mclass]) : delimiter.sizedDelim(s.delim, s.size, e, s.mode, [s.mclass]),
  mathmlBuilder: (s) => {
    var e = [];
    s.delim !== "." && e.push(makeText(s.delim, s.mode));
    var r = new mathMLTree.MathNode("mo", e);
    s.mclass === "mopen" || s.mclass === "mclose" ? r.setAttribute("fence", "true") : r.setAttribute("fence", "false"), r.setAttribute("stretchy", "true");
    var o = makeEm(delimiter.sizeToMaxHeight[s.size]);
    return r.setAttribute("minsize", o), r.setAttribute("maxsize", o), r;
  }
});
function assertParsed(s) {
  if (!s.body)
    throw new Error("Bug: The leftright ParseNode wasn't fully parsed.");
}
defineFunction({
  type: "leftright-right",
  names: ["\\right"],
  props: {
    numArgs: 1,
    primitive: !0
  },
  handler: (s, e) => {
    var r = s.parser.gullet.macros.get("\\current@color");
    if (r && typeof r != "string")
      throw new ParseError("\\current@color set to non-string in \\right");
    return {
      type: "leftright-right",
      mode: s.parser.mode,
      delim: checkDelimiter(e[0], s).text,
      color: r
      // undefined if not set via \color
    };
  }
});
defineFunction({
  type: "leftright",
  names: ["\\left"],
  props: {
    numArgs: 1,
    primitive: !0
  },
  handler: (s, e) => {
    var r = checkDelimiter(e[0], s), o = s.parser;
    ++o.leftrightDepth;
    var m = o.parseExpression(!1);
    --o.leftrightDepth, o.expect("\\right", !1);
    var _ = assertNodeType(o.parseFunction(), "leftright-right");
    return {
      type: "leftright",
      mode: o.mode,
      body: m,
      left: r.text,
      right: _.delim,
      rightColor: _.color
    };
  },
  htmlBuilder: (s, e) => {
    assertParsed(s);
    for (var r = buildExpression$1(s.body, e, !0, ["mopen", "mclose"]), o = 0, m = 0, _ = !1, g = 0; g < r.length; g++)
      r[g].isMiddle ? _ = !0 : (o = Math.max(r[g].height, o), m = Math.max(r[g].depth, m));
    o *= e.sizeMultiplier, m *= e.sizeMultiplier;
    var y;
    if (s.left === "." ? y = makeNullDelimiter(e, ["mopen"]) : y = delimiter.leftRightDelim(s.left, o, m, e, s.mode, ["mopen"]), r.unshift(y), _)
      for (var E = 1; E < r.length; E++) {
        var x = r[E], v = x.isMiddle;
        v && (r[E] = delimiter.leftRightDelim(v.delim, o, m, v.options, s.mode, []));
      }
    var h;
    if (s.right === ".")
      h = makeNullDelimiter(e, ["mclose"]);
    else {
      var a = s.rightColor ? e.withColor(s.rightColor) : e;
      h = delimiter.leftRightDelim(s.right, o, m, a, s.mode, ["mclose"]);
    }
    return r.push(h), buildCommon.makeSpan(["minner"], r, e);
  },
  mathmlBuilder: (s, e) => {
    assertParsed(s);
    var r = buildExpression(s.body, e);
    if (s.left !== ".") {
      var o = new mathMLTree.MathNode("mo", [makeText(s.left, s.mode)]);
      o.setAttribute("fence", "true"), r.unshift(o);
    }
    if (s.right !== ".") {
      var m = new mathMLTree.MathNode("mo", [makeText(s.right, s.mode)]);
      m.setAttribute("fence", "true"), s.rightColor && m.setAttribute("mathcolor", s.rightColor), r.push(m);
    }
    return makeRow(r);
  }
});
defineFunction({
  type: "middle",
  names: ["\\middle"],
  props: {
    numArgs: 1,
    primitive: !0
  },
  handler: (s, e) => {
    var r = checkDelimiter(e[0], s);
    if (!s.parser.leftrightDepth)
      throw new ParseError("\\middle without preceding \\left", r);
    return {
      type: "middle",
      mode: s.parser.mode,
      delim: r.text
    };
  },
  htmlBuilder: (s, e) => {
    var r;
    if (s.delim === ".")
      r = makeNullDelimiter(e, []);
    else {
      r = delimiter.sizedDelim(s.delim, 1, e, s.mode, []);
      var o = {
        delim: s.delim,
        options: e
      };
      r.isMiddle = o;
    }
    return r;
  },
  mathmlBuilder: (s, e) => {
    var r = s.delim === "\\vert" || s.delim === "|" ? makeText("|", "text") : makeText(s.delim, s.mode), o = new mathMLTree.MathNode("mo", [r]);
    return o.setAttribute("fence", "true"), o.setAttribute("lspace", "0.05em"), o.setAttribute("rspace", "0.05em"), o;
  }
});
var htmlBuilder$7 = (s, e) => {
  var r = buildCommon.wrapFragment(buildGroup$1(s.body, e), e), o = s.label.slice(1), m = e.sizeMultiplier, _, g = 0, y = utils.isCharacterBox(s.body);
  if (o === "sout")
    _ = buildCommon.makeSpan(["stretchy", "sout"]), _.height = e.fontMetrics().defaultRuleThickness / m, g = -0.5 * e.fontMetrics().xHeight;
  else if (o === "phase") {
    var E = calculateSize$1({
      number: 0.6,
      unit: "pt"
    }, e), x = calculateSize$1({
      number: 0.35,
      unit: "ex"
    }, e), v = e.havingBaseSizing();
    m = m / v.sizeMultiplier;
    var h = r.height + r.depth + E + x;
    r.style.paddingLeft = makeEm(h / 2 + E);
    var a = Math.floor(1e3 * h * m), b = phasePath(a), w = new SvgNode([new PathNode("phase", b)], {
      width: "400em",
      height: makeEm(a / 1e3),
      viewBox: "0 0 400000 " + a,
      preserveAspectRatio: "xMinYMin slice"
    });
    _ = buildCommon.makeSvgSpan(["hide-tail"], [w], e), _.style.height = makeEm(h), g = r.depth + E + x;
  } else {
    /cancel/.test(o) ? y || r.classes.push("cancel-pad") : o === "angl" ? r.classes.push("anglpad") : r.classes.push("boxpad");
    var k = 0, A = 0, M = 0;
    /box/.test(o) ? (M = Math.max(
      e.fontMetrics().fboxrule,
      // default
      e.minRuleThickness
      // User override.
    ), k = e.fontMetrics().fboxsep + (o === "colorbox" ? 0 : M), A = k) : o === "angl" ? (M = Math.max(e.fontMetrics().defaultRuleThickness, e.minRuleThickness), k = 4 * M, A = Math.max(0, 0.25 - r.depth)) : (k = y ? 0.2 : 0, A = k), _ = stretchy.encloseSpan(r, o, k, A, e), /fbox|boxed|fcolorbox/.test(o) ? (_.style.borderStyle = "solid", _.style.borderWidth = makeEm(M)) : o === "angl" && M !== 0.049 && (_.style.borderTopWidth = makeEm(M), _.style.borderRightWidth = makeEm(M)), g = r.depth + A, s.backgroundColor && (_.style.backgroundColor = s.backgroundColor, s.borderColor && (_.style.borderColor = s.borderColor));
  }
  var $;
  if (s.backgroundColor)
    $ = buildCommon.makeVList({
      positionType: "individualShift",
      children: [
        // Put the color background behind inner;
        {
          type: "elem",
          elem: _,
          shift: g
        },
        {
          type: "elem",
          elem: r,
          shift: 0
        }
      ]
    }, e);
  else {
    var O = /cancel|phase/.test(o) ? ["svg-align"] : [];
    $ = buildCommon.makeVList({
      positionType: "individualShift",
      children: [
        // Write the \cancel stroke on top of inner.
        {
          type: "elem",
          elem: r,
          shift: 0
        },
        {
          type: "elem",
          elem: _,
          shift: g,
          wrapperClasses: O
        }
      ]
    }, e);
  }
  return /cancel/.test(o) && ($.height = r.height, $.depth = r.depth), /cancel/.test(o) && !y ? buildCommon.makeSpan(["mord", "cancel-lap"], [$], e) : buildCommon.makeSpan(["mord"], [$], e);
}, mathmlBuilder$6 = (s, e) => {
  var r = 0, o = new mathMLTree.MathNode(s.label.indexOf("colorbox") > -1 ? "mpadded" : "menclose", [buildGroup(s.body, e)]);
  switch (s.label) {
    case "\\cancel":
      o.setAttribute("notation", "updiagonalstrike");
      break;
    case "\\bcancel":
      o.setAttribute("notation", "downdiagonalstrike");
      break;
    case "\\phase":
      o.setAttribute("notation", "phasorangle");
      break;
    case "\\sout":
      o.setAttribute("notation", "horizontalstrike");
      break;
    case "\\fbox":
      o.setAttribute("notation", "box");
      break;
    case "\\angl":
      o.setAttribute("notation", "actuarial");
      break;
    case "\\fcolorbox":
    case "\\colorbox":
      if (r = e.fontMetrics().fboxsep * e.fontMetrics().ptPerEm, o.setAttribute("width", "+" + 2 * r + "pt"), o.setAttribute("height", "+" + 2 * r + "pt"), o.setAttribute("lspace", r + "pt"), o.setAttribute("voffset", r + "pt"), s.label === "\\fcolorbox") {
        var m = Math.max(
          e.fontMetrics().fboxrule,
          // default
          e.minRuleThickness
          // user override
        );
        o.setAttribute("style", "border: " + m + "em solid " + String(s.borderColor));
      }
      break;
    case "\\xcancel":
      o.setAttribute("notation", "updiagonalstrike downdiagonalstrike");
      break;
  }
  return s.backgroundColor && o.setAttribute("mathbackground", s.backgroundColor), o;
};
defineFunction({
  type: "enclose",
  names: ["\\colorbox"],
  props: {
    numArgs: 2,
    allowedInText: !0,
    argTypes: ["color", "text"]
  },
  handler(s, e, r) {
    var {
      parser: o,
      funcName: m
    } = s, _ = assertNodeType(e[0], "color-token").color, g = e[1];
    return {
      type: "enclose",
      mode: o.mode,
      label: m,
      backgroundColor: _,
      body: g
    };
  },
  htmlBuilder: htmlBuilder$7,
  mathmlBuilder: mathmlBuilder$6
});
defineFunction({
  type: "enclose",
  names: ["\\fcolorbox"],
  props: {
    numArgs: 3,
    allowedInText: !0,
    argTypes: ["color", "color", "text"]
  },
  handler(s, e, r) {
    var {
      parser: o,
      funcName: m
    } = s, _ = assertNodeType(e[0], "color-token").color, g = assertNodeType(e[1], "color-token").color, y = e[2];
    return {
      type: "enclose",
      mode: o.mode,
      label: m,
      backgroundColor: g,
      borderColor: _,
      body: y
    };
  },
  htmlBuilder: htmlBuilder$7,
  mathmlBuilder: mathmlBuilder$6
});
defineFunction({
  type: "enclose",
  names: ["\\fbox"],
  props: {
    numArgs: 1,
    argTypes: ["hbox"],
    allowedInText: !0
  },
  handler(s, e) {
    var {
      parser: r
    } = s;
    return {
      type: "enclose",
      mode: r.mode,
      label: "\\fbox",
      body: e[0]
    };
  }
});
defineFunction({
  type: "enclose",
  names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\phase"],
  props: {
    numArgs: 1
  },
  handler(s, e) {
    var {
      parser: r,
      funcName: o
    } = s, m = e[0];
    return {
      type: "enclose",
      mode: r.mode,
      label: o,
      body: m
    };
  },
  htmlBuilder: htmlBuilder$7,
  mathmlBuilder: mathmlBuilder$6
});
defineFunction({
  type: "enclose",
  names: ["\\angl"],
  props: {
    numArgs: 1,
    argTypes: ["hbox"],
    allowedInText: !1
  },
  handler(s, e) {
    var {
      parser: r
    } = s;
    return {
      type: "enclose",
      mode: r.mode,
      label: "\\angl",
      body: e[0]
    };
  }
});
var _environments = {};
function defineEnvironment(s) {
  for (var {
    type: e,
    names: r,
    props: o,
    handler: m,
    htmlBuilder: _,
    mathmlBuilder: g
  } = s, y = {
    type: e,
    numArgs: o.numArgs || 0,
    allowedInText: !1,
    numOptionalArgs: 0,
    handler: m
  }, E = 0; E < r.length; ++E)
    _environments[r[E]] = y;
  _ && (_htmlGroupBuilders[e] = _), g && (_mathmlGroupBuilders[e] = g);
}
var _macros = {};
function defineMacro(s, e) {
  _macros[s] = e;
}
function getHLines(s) {
  var e = [];
  s.consumeSpaces();
  var r = s.fetch().text;
  for (r === "\\relax" && (s.consume(), s.consumeSpaces(), r = s.fetch().text); r === "\\hline" || r === "\\hdashline"; )
    s.consume(), e.push(r === "\\hdashline"), s.consumeSpaces(), r = s.fetch().text;
  return e;
}
var validateAmsEnvironmentContext = (s) => {
  var e = s.parser.settings;
  if (!e.displayMode)
    throw new ParseError("{" + s.envName + "} can be used only in display mode.");
};
function getAutoTag(s) {
  if (s.indexOf("ed") === -1)
    return s.indexOf("*") === -1;
}
function parseArray(s, e, r) {
  var {
    hskipBeforeAndAfter: o,
    addJot: m,
    cols: _,
    arraystretch: g,
    colSeparationType: y,
    autoTag: E,
    singleRow: x,
    emptySingleRow: v,
    maxNumCols: h,
    leqno: a
  } = e;
  if (s.gullet.beginGroup(), x || s.gullet.macros.set("\\cr", "\\\\\\relax"), !g) {
    var b = s.gullet.expandMacroAsText("\\arraystretch");
    if (b == null)
      g = 1;
    else if (g = parseFloat(b), !g || g < 0)
      throw new ParseError("Invalid \\arraystretch: " + b);
  }
  s.gullet.beginGroup();
  var w = [], k = [w], A = [], M = [], $ = E != null ? [] : void 0;
  function O() {
    E && s.gullet.macros.set("\\@eqnsw", "1", !0);
  }
  function C() {
    $ && (s.gullet.macros.get("\\df@tag") ? ($.push(s.subparse([new Token$1("\\df@tag")])), s.gullet.macros.set("\\df@tag", void 0, !0)) : $.push(!!E && s.gullet.macros.get("\\@eqnsw") === "1"));
  }
  for (O(), M.push(getHLines(s)); ; ) {
    var P = s.parseExpression(!1, x ? "\\end" : "\\\\");
    s.gullet.endGroup(), s.gullet.beginGroup(), P = {
      type: "ordgroup",
      mode: s.mode,
      body: P
    }, r && (P = {
      type: "styling",
      mode: s.mode,
      style: r,
      body: [P]
    }), w.push(P);
    var I = s.fetch().text;
    if (I === "&") {
      if (h && w.length === h) {
        if (x || y)
          throw new ParseError("Too many tab characters: &", s.nextToken);
        s.settings.reportNonstrict("textEnv", "Too few columns specified in the {array} column argument.");
      }
      s.consume();
    } else if (I === "\\end") {
      C(), w.length === 1 && P.type === "styling" && P.body[0].body.length === 0 && (k.length > 1 || !v) && k.pop(), M.length < k.length + 1 && M.push([]);
      break;
    } else if (I === "\\\\") {
      s.consume();
      var N = void 0;
      s.gullet.future().text !== " " && (N = s.parseSizeGroup(!0)), A.push(N ? N.value : null), C(), M.push(getHLines(s)), w = [], k.push(w), O();
    } else
      throw new ParseError("Expected & or \\\\ or \\cr or \\end", s.nextToken);
  }
  return s.gullet.endGroup(), s.gullet.endGroup(), {
    type: "array",
    mode: s.mode,
    addJot: m,
    arraystretch: g,
    body: k,
    cols: _,
    rowGaps: A,
    hskipBeforeAndAfter: o,
    hLinesBeforeRow: M,
    colSeparationType: y,
    tags: $,
    leqno: a
  };
}
function dCellStyle(s) {
  return s.slice(0, 1) === "d" ? "display" : "text";
}
var htmlBuilder$6 = function(e, r) {
  var o, m, _ = e.body.length, g = e.hLinesBeforeRow, y = 0, E = new Array(_), x = [], v = Math.max(
    // From LaTeX \showthe\arrayrulewidth. Equals 0.04 em.
    r.fontMetrics().arrayRuleWidth,
    r.minRuleThickness
    // User override.
  ), h = 1 / r.fontMetrics().ptPerEm, a = 5 * h;
  if (e.colSeparationType && e.colSeparationType === "small") {
    var b = r.havingStyle(Style$1.SCRIPT).sizeMultiplier;
    a = 0.2778 * (b / r.sizeMultiplier);
  }
  var w = e.colSeparationType === "CD" ? calculateSize$1({
    number: 3,
    unit: "ex"
  }, r) : 12 * h, k = 3 * h, A = e.arraystretch * w, M = 0.7 * A, $ = 0.3 * A, O = 0;
  function C(Ze) {
    for (var at = 0; at < Ze.length; ++at)
      at > 0 && (O += 0.25), x.push({
        pos: O,
        isDashed: Ze[at]
      });
  }
  for (C(g[0]), o = 0; o < e.body.length; ++o) {
    var P = e.body[o], I = M, N = $;
    y < P.length && (y = P.length);
    var R = new Array(P.length);
    for (m = 0; m < P.length; ++m) {
      var F = buildGroup$1(P[m], r);
      N < F.depth && (N = F.depth), I < F.height && (I = F.height), R[m] = F;
    }
    var B = e.rowGaps[o], G = 0;
    B && (G = calculateSize$1(B, r), G > 0 && (G += $, N < G && (N = G), G = 0)), e.addJot && (N += k), R.height = I, R.depth = N, O += I, R.pos = O, O += N + G, E[o] = R, C(g[o + 1]);
  }
  var Q = O / 2 + r.fontMetrics().axisHeight, ee = e.cols || [], Y = [], W, j, J = [];
  if (e.tags && e.tags.some((Ze) => Ze))
    for (o = 0; o < _; ++o) {
      var me = E[o], pe = me.pos - Q, ye = e.tags[o], oe = void 0;
      ye === !0 ? oe = buildCommon.makeSpan(["eqn-num"], [], r) : ye === !1 ? oe = buildCommon.makeSpan([], [], r) : oe = buildCommon.makeSpan([], buildExpression$1(ye, r, !0), r), oe.depth = me.depth, oe.height = me.height, J.push({
        type: "elem",
        elem: oe,
        shift: pe
      });
    }
  for (
    m = 0, j = 0;
    // Continue while either there are more columns or more column
    // descriptions, so trailing separators don't get lost.
    m < y || j < ee.length;
    ++m, ++j
  ) {
    for (var we = ee[j] || {}, Se = !0; we.type === "separator"; ) {
      if (Se || (W = buildCommon.makeSpan(["arraycolsep"], []), W.style.width = makeEm(r.fontMetrics().doubleRuleSep), Y.push(W)), we.separator === "|" || we.separator === ":") {
        var Me = we.separator === "|" ? "solid" : "dashed", de = buildCommon.makeSpan(["vertical-separator"], [], r);
        de.style.height = makeEm(O), de.style.borderRightWidth = makeEm(v), de.style.borderRightStyle = Me, de.style.margin = "0 " + makeEm(-v / 2);
        var Oe = O - Q;
        Oe && (de.style.verticalAlign = makeEm(-Oe)), Y.push(de);
      } else
        throw new ParseError("Invalid separator type: " + we.separator);
      j++, we = ee[j] || {}, Se = !1;
    }
    if (!(m >= y)) {
      var $e = void 0;
      (m > 0 || e.hskipBeforeAndAfter) && ($e = utils.deflt(we.pregap, a), $e !== 0 && (W = buildCommon.makeSpan(["arraycolsep"], []), W.style.width = makeEm($e), Y.push(W)));
      var ge = [];
      for (o = 0; o < _; ++o) {
        var Ye = E[o], Ie = Ye[m];
        if (Ie) {
          var Ge = Ye.pos - Q;
          Ie.depth = Ye.depth, Ie.height = Ye.height, ge.push({
            type: "elem",
            elem: Ie,
            shift: Ge
          });
        }
      }
      ge = buildCommon.makeVList({
        positionType: "individualShift",
        children: ge
      }, r), ge = buildCommon.makeSpan(["col-align-" + (we.align || "c")], [ge]), Y.push(ge), (m < y - 1 || e.hskipBeforeAndAfter) && ($e = utils.deflt(we.postgap, a), $e !== 0 && (W = buildCommon.makeSpan(["arraycolsep"], []), W.style.width = makeEm($e), Y.push(W)));
    }
  }
  if (E = buildCommon.makeSpan(["mtable"], Y), x.length > 0) {
    for (var Ke = buildCommon.makeLineSpan("hline", r, v), Ne = buildCommon.makeLineSpan("hdashline", r, v), Ce = [{
      type: "elem",
      elem: E,
      shift: 0
    }]; x.length > 0; ) {
      var lt = x.pop(), ut = lt.pos - Q;
      lt.isDashed ? Ce.push({
        type: "elem",
        elem: Ne,
        shift: ut
      }) : Ce.push({
        type: "elem",
        elem: Ke,
        shift: ut
      });
    }
    E = buildCommon.makeVList({
      positionType: "individualShift",
      children: Ce
    }, r);
  }
  if (J.length === 0)
    return buildCommon.makeSpan(["mord"], [E], r);
  var Je = buildCommon.makeVList({
    positionType: "individualShift",
    children: J
  }, r);
  return Je = buildCommon.makeSpan(["tag"], [Je], r), buildCommon.makeFragment([E, Je]);
}, alignMap = {
  c: "center ",
  l: "left ",
  r: "right "
}, mathmlBuilder$5 = function(e, r) {
  for (var o = [], m = new mathMLTree.MathNode("mtd", [], ["mtr-glue"]), _ = new mathMLTree.MathNode("mtd", [], ["mml-eqn-num"]), g = 0; g < e.body.length; g++) {
    for (var y = e.body[g], E = [], x = 0; x < y.length; x++)
      E.push(new mathMLTree.MathNode("mtd", [buildGroup(y[x], r)]));
    e.tags && e.tags[g] && (E.unshift(m), E.push(m), e.leqno ? E.unshift(_) : E.push(_)), o.push(new mathMLTree.MathNode("mtr", E));
  }
  var v = new mathMLTree.MathNode("mtable", o), h = e.arraystretch === 0.5 ? 0.1 : 0.16 + e.arraystretch - 1 + (e.addJot ? 0.09 : 0);
  v.setAttribute("rowspacing", makeEm(h));
  var a = "", b = "";
  if (e.cols && e.cols.length > 0) {
    var w = e.cols, k = "", A = !1, M = 0, $ = w.length;
    w[0].type === "separator" && (a += "top ", M = 1), w[w.length - 1].type === "separator" && (a += "bottom ", $ -= 1);
    for (var O = M; O < $; O++)
      w[O].type === "align" ? (b += alignMap[w[O].align], A && (k += "none "), A = !0) : w[O].type === "separator" && A && (k += w[O].separator === "|" ? "solid " : "dashed ", A = !1);
    v.setAttribute("columnalign", b.trim()), /[sd]/.test(k) && v.setAttribute("columnlines", k.trim());
  }
  if (e.colSeparationType === "align") {
    for (var C = e.cols || [], P = "", I = 1; I < C.length; I++)
      P += I % 2 ? "0em " : "1em ";
    v.setAttribute("columnspacing", P.trim());
  } else e.colSeparationType === "alignat" || e.colSeparationType === "gather" ? v.setAttribute("columnspacing", "0em") : e.colSeparationType === "small" ? v.setAttribute("columnspacing", "0.2778em") : e.colSeparationType === "CD" ? v.setAttribute("columnspacing", "0.5em") : v.setAttribute("columnspacing", "1em");
  var N = "", R = e.hLinesBeforeRow;
  a += R[0].length > 0 ? "left " : "", a += R[R.length - 1].length > 0 ? "right " : "";
  for (var F = 1; F < R.length - 1; F++)
    N += R[F].length === 0 ? "none " : R[F][0] ? "dashed " : "solid ";
  return /[sd]/.test(N) && v.setAttribute("rowlines", N.trim()), a !== "" && (v = new mathMLTree.MathNode("menclose", [v]), v.setAttribute("notation", a.trim())), e.arraystretch && e.arraystretch < 1 && (v = new mathMLTree.MathNode("mstyle", [v]), v.setAttribute("scriptlevel", "1")), v;
}, alignedHandler = function(e, r) {
  e.envName.indexOf("ed") === -1 && validateAmsEnvironmentContext(e);
  var o = [], m = e.envName.indexOf("at") > -1 ? "alignat" : "align", _ = e.envName === "split", g = parseArray(e.parser, {
    cols: o,
    addJot: !0,
    autoTag: _ ? void 0 : getAutoTag(e.envName),
    emptySingleRow: !0,
    colSeparationType: m,
    maxNumCols: _ ? 2 : void 0,
    leqno: e.parser.settings.leqno
  }, "display"), y, E = 0, x = {
    type: "ordgroup",
    mode: e.mode,
    body: []
  };
  if (r[0] && r[0].type === "ordgroup") {
    for (var v = "", h = 0; h < r[0].body.length; h++) {
      var a = assertNodeType(r[0].body[h], "textord");
      v += a.text;
    }
    y = Number(v), E = y * 2;
  }
  var b = !E;
  g.body.forEach(function(M) {
    for (var $ = 1; $ < M.length; $ += 2) {
      var O = assertNodeType(M[$], "styling"), C = assertNodeType(O.body[0], "ordgroup");
      C.body.unshift(x);
    }
    if (b)
      E < M.length && (E = M.length);
    else {
      var P = M.length / 2;
      if (y < P)
        throw new ParseError("Too many math in a row: " + ("expected " + y + ", but got " + P), M[0]);
    }
  });
  for (var w = 0; w < E; ++w) {
    var k = "r", A = 0;
    w % 2 === 1 ? k = "l" : w > 0 && b && (A = 1), o[w] = {
      type: "align",
      align: k,
      pregap: A,
      postgap: 0
    };
  }
  return g.colSeparationType = b ? "align" : "alignat", g;
};
defineEnvironment({
  type: "array",
  names: ["array", "darray"],
  props: {
    numArgs: 1
  },
  handler(s, e) {
    var r = checkSymbolNodeType(e[0]), o = r ? [e[0]] : assertNodeType(e[0], "ordgroup").body, m = o.map(function(g) {
      var y = assertSymbolNodeType(g), E = y.text;
      if ("lcr".indexOf(E) !== -1)
        return {
          type: "align",
          align: E
        };
      if (E === "|")
        return {
          type: "separator",
          separator: "|"
        };
      if (E === ":")
        return {
          type: "separator",
          separator: ":"
        };
      throw new ParseError("Unknown column alignment: " + E, g);
    }), _ = {
      cols: m,
      hskipBeforeAndAfter: !0,
      // \@preamble in lttab.dtx
      maxNumCols: m.length
    };
    return parseArray(s.parser, _, dCellStyle(s.envName));
  },
  htmlBuilder: htmlBuilder$6,
  mathmlBuilder: mathmlBuilder$5
});
defineEnvironment({
  type: "array",
  names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix", "matrix*", "pmatrix*", "bmatrix*", "Bmatrix*", "vmatrix*", "Vmatrix*"],
  props: {
    numArgs: 0
  },
  handler(s) {
    var e = {
      matrix: null,
      pmatrix: ["(", ")"],
      bmatrix: ["[", "]"],
      Bmatrix: ["\\{", "\\}"],
      vmatrix: ["|", "|"],
      Vmatrix: ["\\Vert", "\\Vert"]
    }[s.envName.replace("*", "")], r = "c", o = {
      hskipBeforeAndAfter: !1,
      cols: [{
        type: "align",
        align: r
      }]
    };
    if (s.envName.charAt(s.envName.length - 1) === "*") {
      var m = s.parser;
      if (m.consumeSpaces(), m.fetch().text === "[") {
        if (m.consume(), m.consumeSpaces(), r = m.fetch().text, "lcr".indexOf(r) === -1)
          throw new ParseError("Expected l or c or r", m.nextToken);
        m.consume(), m.consumeSpaces(), m.expect("]"), m.consume(), o.cols = [{
          type: "align",
          align: r
        }];
      }
    }
    var _ = parseArray(s.parser, o, dCellStyle(s.envName)), g = Math.max(0, ..._.body.map((y) => y.length));
    return _.cols = new Array(g).fill({
      type: "align",
      align: r
    }), e ? {
      type: "leftright",
      mode: s.mode,
      body: [_],
      left: e[0],
      right: e[1],
      rightColor: void 0
      // \right uninfluenced by \color in array
    } : _;
  },
  htmlBuilder: htmlBuilder$6,
  mathmlBuilder: mathmlBuilder$5
});
defineEnvironment({
  type: "array",
  names: ["smallmatrix"],
  props: {
    numArgs: 0
  },
  handler(s) {
    var e = {
      arraystretch: 0.5
    }, r = parseArray(s.parser, e, "script");
    return r.colSeparationType = "small", r;
  },
  htmlBuilder: htmlBuilder$6,
  mathmlBuilder: mathmlBuilder$5
});
defineEnvironment({
  type: "array",
  names: ["subarray"],
  props: {
    numArgs: 1
  },
  handler(s, e) {
    var r = checkSymbolNodeType(e[0]), o = r ? [e[0]] : assertNodeType(e[0], "ordgroup").body, m = o.map(function(g) {
      var y = assertSymbolNodeType(g), E = y.text;
      if ("lc".indexOf(E) !== -1)
        return {
          type: "align",
          align: E
        };
      throw new ParseError("Unknown column alignment: " + E, g);
    });
    if (m.length > 1)
      throw new ParseError("{subarray} can contain only one column");
    var _ = {
      cols: m,
      hskipBeforeAndAfter: !1,
      arraystretch: 0.5
    };
    if (_ = parseArray(s.parser, _, "script"), _.body.length > 0 && _.body[0].length > 1)
      throw new ParseError("{subarray} can contain only one column");
    return _;
  },
  htmlBuilder: htmlBuilder$6,
  mathmlBuilder: mathmlBuilder$5
});
defineEnvironment({
  type: "array",
  names: ["cases", "dcases", "rcases", "drcases"],
  props: {
    numArgs: 0
  },
  handler(s) {
    var e = {
      arraystretch: 1.2,
      cols: [{
        type: "align",
        align: "l",
        pregap: 0,
        // TODO(kevinb) get the current style.
        // For now we use the metrics for TEXT style which is what we were
        // doing before.  Before attempting to get the current style we
        // should look at TeX's behavior especially for \over and matrices.
        postgap: 1
        /* 1em quad */
      }, {
        type: "align",
        align: "l",
        pregap: 0,
        postgap: 0
      }]
    }, r = parseArray(s.parser, e, dCellStyle(s.envName));
    return {
      type: "leftright",
      mode: s.mode,
      body: [r],
      left: s.envName.indexOf("r") > -1 ? "." : "\\{",
      right: s.envName.indexOf("r") > -1 ? "\\}" : ".",
      rightColor: void 0
    };
  },
  htmlBuilder: htmlBuilder$6,
  mathmlBuilder: mathmlBuilder$5
});
defineEnvironment({
  type: "array",
  names: ["align", "align*", "aligned", "split"],
  props: {
    numArgs: 0
  },
  handler: alignedHandler,
  htmlBuilder: htmlBuilder$6,
  mathmlBuilder: mathmlBuilder$5
});
defineEnvironment({
  type: "array",
  names: ["gathered", "gather", "gather*"],
  props: {
    numArgs: 0
  },
  handler(s) {
    utils.contains(["gather", "gather*"], s.envName) && validateAmsEnvironmentContext(s);
    var e = {
      cols: [{
        type: "align",
        align: "c"
      }],
      addJot: !0,
      colSeparationType: "gather",
      autoTag: getAutoTag(s.envName),
      emptySingleRow: !0,
      leqno: s.parser.settings.leqno
    };
    return parseArray(s.parser, e, "display");
  },
  htmlBuilder: htmlBuilder$6,
  mathmlBuilder: mathmlBuilder$5
});
defineEnvironment({
  type: "array",
  names: ["alignat", "alignat*", "alignedat"],
  props: {
    numArgs: 1
  },
  handler: alignedHandler,
  htmlBuilder: htmlBuilder$6,
  mathmlBuilder: mathmlBuilder$5
});
defineEnvironment({
  type: "array",
  names: ["equation", "equation*"],
  props: {
    numArgs: 0
  },
  handler(s) {
    validateAmsEnvironmentContext(s);
    var e = {
      autoTag: getAutoTag(s.envName),
      emptySingleRow: !0,
      singleRow: !0,
      maxNumCols: 1,
      leqno: s.parser.settings.leqno
    };
    return parseArray(s.parser, e, "display");
  },
  htmlBuilder: htmlBuilder$6,
  mathmlBuilder: mathmlBuilder$5
});
defineEnvironment({
  type: "array",
  names: ["CD"],
  props: {
    numArgs: 0
  },
  handler(s) {
    return validateAmsEnvironmentContext(s), parseCD(s.parser);
  },
  htmlBuilder: htmlBuilder$6,
  mathmlBuilder: mathmlBuilder$5
});
defineMacro("\\nonumber", "\\gdef\\@eqnsw{0}");
defineMacro("\\notag", "\\nonumber");
defineFunction({
  type: "text",
  // Doesn't matter what this is.
  names: ["\\hline", "\\hdashline"],
  props: {
    numArgs: 0,
    allowedInText: !0,
    allowedInMath: !0
  },
  handler(s, e) {
    throw new ParseError(s.funcName + " valid only within array environment");
  }
});
var environments = _environments;
defineFunction({
  type: "environment",
  names: ["\\begin", "\\end"],
  props: {
    numArgs: 1,
    argTypes: ["text"]
  },
  handler(s, e) {
    var {
      parser: r,
      funcName: o
    } = s, m = e[0];
    if (m.type !== "ordgroup")
      throw new ParseError("Invalid environment name", m);
    for (var _ = "", g = 0; g < m.body.length; ++g)
      _ += assertNodeType(m.body[g], "textord").text;
    if (o === "\\begin") {
      if (!environments.hasOwnProperty(_))
        throw new ParseError("No such environment: " + _, m);
      var y = environments[_], {
        args: E,
        optArgs: x
      } = r.parseArguments("\\begin{" + _ + "}", y), v = {
        mode: r.mode,
        envName: _,
        parser: r
      }, h = y.handler(v, E, x);
      r.expect("\\end", !1);
      var a = r.nextToken, b = assertNodeType(r.parseFunction(), "environment");
      if (b.name !== _)
        throw new ParseError("Mismatch: \\begin{" + _ + "} matched by \\end{" + b.name + "}", a);
      return h;
    }
    return {
      type: "environment",
      mode: r.mode,
      name: _,
      nameGroup: m
    };
  }
});
var htmlBuilder$5 = (s, e) => {
  var r = s.font, o = e.withFont(r);
  return buildGroup$1(s.body, o);
}, mathmlBuilder$4 = (s, e) => {
  var r = s.font, o = e.withFont(r);
  return buildGroup(s.body, o);
}, fontAliases = {
  "\\Bbb": "\\mathbb",
  "\\bold": "\\mathbf",
  "\\frak": "\\mathfrak",
  "\\bm": "\\boldsymbol"
};
defineFunction({
  type: "font",
  names: [
    // styles, except \boldsymbol defined below
    "\\mathrm",
    "\\mathit",
    "\\mathbf",
    "\\mathnormal",
    "\\mathsfit",
    // families
    "\\mathbb",
    "\\mathcal",
    "\\mathfrak",
    "\\mathscr",
    "\\mathsf",
    "\\mathtt",
    // aliases, except \bm defined below
    "\\Bbb",
    "\\bold",
    "\\frak"
  ],
  props: {
    numArgs: 1,
    allowedInArgument: !0
  },
  handler: (s, e) => {
    var {
      parser: r,
      funcName: o
    } = s, m = normalizeArgument(e[0]), _ = o;
    return _ in fontAliases && (_ = fontAliases[_]), {
      type: "font",
      mode: r.mode,
      font: _.slice(1),
      body: m
    };
  },
  htmlBuilder: htmlBuilder$5,
  mathmlBuilder: mathmlBuilder$4
});
defineFunction({
  type: "mclass",
  names: ["\\boldsymbol", "\\bm"],
  props: {
    numArgs: 1
  },
  handler: (s, e) => {
    var {
      parser: r
    } = s, o = e[0], m = utils.isCharacterBox(o);
    return {
      type: "mclass",
      mode: r.mode,
      mclass: binrelClass(o),
      body: [{
        type: "font",
        mode: r.mode,
        font: "boldsymbol",
        body: o
      }],
      isCharacterBox: m
    };
  }
});
defineFunction({
  type: "font",
  names: ["\\rm", "\\sf", "\\tt", "\\bf", "\\it", "\\cal"],
  props: {
    numArgs: 0,
    allowedInText: !0
  },
  handler: (s, e) => {
    var {
      parser: r,
      funcName: o,
      breakOnTokenText: m
    } = s, {
      mode: _
    } = r, g = r.parseExpression(!0, m), y = "math" + o.slice(1);
    return {
      type: "font",
      mode: _,
      font: y,
      body: {
        type: "ordgroup",
        mode: r.mode,
        body: g
      }
    };
  },
  htmlBuilder: htmlBuilder$5,
  mathmlBuilder: mathmlBuilder$4
});
var adjustStyle = (s, e) => {
  var r = e;
  return s === "display" ? r = r.id >= Style$1.SCRIPT.id ? r.text() : Style$1.DISPLAY : s === "text" && r.size === Style$1.DISPLAY.size ? r = Style$1.TEXT : s === "script" ? r = Style$1.SCRIPT : s === "scriptscript" && (r = Style$1.SCRIPTSCRIPT), r;
}, htmlBuilder$4 = (s, e) => {
  var r = adjustStyle(s.size, e.style), o = r.fracNum(), m = r.fracDen(), _;
  _ = e.havingStyle(o);
  var g = buildGroup$1(s.numer, _, e);
  if (s.continued) {
    var y = 8.5 / e.fontMetrics().ptPerEm, E = 3.5 / e.fontMetrics().ptPerEm;
    g.height = g.height < y ? y : g.height, g.depth = g.depth < E ? E : g.depth;
  }
  _ = e.havingStyle(m);
  var x = buildGroup$1(s.denom, _, e), v, h, a;
  s.hasBarLine ? (s.barSize ? (h = calculateSize$1(s.barSize, e), v = buildCommon.makeLineSpan("frac-line", e, h)) : v = buildCommon.makeLineSpan("frac-line", e), h = v.height, a = v.height) : (v = null, h = 0, a = e.fontMetrics().defaultRuleThickness);
  var b, w, k;
  r.size === Style$1.DISPLAY.size || s.size === "display" ? (b = e.fontMetrics().num1, h > 0 ? w = 3 * a : w = 7 * a, k = e.fontMetrics().denom1) : (h > 0 ? (b = e.fontMetrics().num2, w = a) : (b = e.fontMetrics().num3, w = 3 * a), k = e.fontMetrics().denom2);
  var A;
  if (v) {
    var $ = e.fontMetrics().axisHeight;
    b - g.depth - ($ + 0.5 * h) < w && (b += w - (b - g.depth - ($ + 0.5 * h))), $ - 0.5 * h - (x.height - k) < w && (k += w - ($ - 0.5 * h - (x.height - k)));
    var O = -($ - 0.5 * h);
    A = buildCommon.makeVList({
      positionType: "individualShift",
      children: [{
        type: "elem",
        elem: x,
        shift: k
      }, {
        type: "elem",
        elem: v,
        shift: O
      }, {
        type: "elem",
        elem: g,
        shift: -b
      }]
    }, e);
  } else {
    var M = b - g.depth - (x.height - k);
    M < w && (b += 0.5 * (w - M), k += 0.5 * (w - M)), A = buildCommon.makeVList({
      positionType: "individualShift",
      children: [{
        type: "elem",
        elem: x,
        shift: k
      }, {
        type: "elem",
        elem: g,
        shift: -b
      }]
    }, e);
  }
  _ = e.havingStyle(r), A.height *= _.sizeMultiplier / e.sizeMultiplier, A.depth *= _.sizeMultiplier / e.sizeMultiplier;
  var C;
  r.size === Style$1.DISPLAY.size ? C = e.fontMetrics().delim1 : r.size === Style$1.SCRIPTSCRIPT.size ? C = e.havingStyle(Style$1.SCRIPT).fontMetrics().delim2 : C = e.fontMetrics().delim2;
  var P, I;
  return s.leftDelim == null ? P = makeNullDelimiter(e, ["mopen"]) : P = delimiter.customSizedDelim(s.leftDelim, C, !0, e.havingStyle(r), s.mode, ["mopen"]), s.continued ? I = buildCommon.makeSpan([]) : s.rightDelim == null ? I = makeNullDelimiter(e, ["mclose"]) : I = delimiter.customSizedDelim(s.rightDelim, C, !0, e.havingStyle(r), s.mode, ["mclose"]), buildCommon.makeSpan(["mord"].concat(_.sizingClasses(e)), [P, buildCommon.makeSpan(["mfrac"], [A]), I], e);
}, mathmlBuilder$3 = (s, e) => {
  var r = new mathMLTree.MathNode("mfrac", [buildGroup(s.numer, e), buildGroup(s.denom, e)]);
  if (!s.hasBarLine)
    r.setAttribute("linethickness", "0px");
  else if (s.barSize) {
    var o = calculateSize$1(s.barSize, e);
    r.setAttribute("linethickness", makeEm(o));
  }
  var m = adjustStyle(s.size, e.style);
  if (m.size !== e.style.size) {
    r = new mathMLTree.MathNode("mstyle", [r]);
    var _ = m.size === Style$1.DISPLAY.size ? "true" : "false";
    r.setAttribute("displaystyle", _), r.setAttribute("scriptlevel", "0");
  }
  if (s.leftDelim != null || s.rightDelim != null) {
    var g = [];
    if (s.leftDelim != null) {
      var y = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(s.leftDelim.replace("\\", ""))]);
      y.setAttribute("fence", "true"), g.push(y);
    }
    if (g.push(r), s.rightDelim != null) {
      var E = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(s.rightDelim.replace("\\", ""))]);
      E.setAttribute("fence", "true"), g.push(E);
    }
    return makeRow(g);
  }
  return r;
};
defineFunction({
  type: "genfrac",
  names: [
    "\\dfrac",
    "\\frac",
    "\\tfrac",
    "\\dbinom",
    "\\binom",
    "\\tbinom",
    "\\\\atopfrac",
    // can’t be entered directly
    "\\\\bracefrac",
    "\\\\brackfrac"
    // ditto
  ],
  props: {
    numArgs: 2,
    allowedInArgument: !0
  },
  handler: (s, e) => {
    var {
      parser: r,
      funcName: o
    } = s, m = e[0], _ = e[1], g, y = null, E = null, x = "auto";
    switch (o) {
      case "\\dfrac":
      case "\\frac":
      case "\\tfrac":
        g = !0;
        break;
      case "\\\\atopfrac":
        g = !1;
        break;
      case "\\dbinom":
      case "\\binom":
      case "\\tbinom":
        g = !1, y = "(", E = ")";
        break;
      case "\\\\bracefrac":
        g = !1, y = "\\{", E = "\\}";
        break;
      case "\\\\brackfrac":
        g = !1, y = "[", E = "]";
        break;
      default:
        throw new Error("Unrecognized genfrac command");
    }
    switch (o) {
      case "\\dfrac":
      case "\\dbinom":
        x = "display";
        break;
      case "\\tfrac":
      case "\\tbinom":
        x = "text";
        break;
    }
    return {
      type: "genfrac",
      mode: r.mode,
      continued: !1,
      numer: m,
      denom: _,
      hasBarLine: g,
      leftDelim: y,
      rightDelim: E,
      size: x,
      barSize: null
    };
  },
  htmlBuilder: htmlBuilder$4,
  mathmlBuilder: mathmlBuilder$3
});
defineFunction({
  type: "genfrac",
  names: ["\\cfrac"],
  props: {
    numArgs: 2
  },
  handler: (s, e) => {
    var {
      parser: r,
      funcName: o
    } = s, m = e[0], _ = e[1];
    return {
      type: "genfrac",
      mode: r.mode,
      continued: !0,
      numer: m,
      denom: _,
      hasBarLine: !0,
      leftDelim: null,
      rightDelim: null,
      size: "display",
      barSize: null
    };
  }
});
defineFunction({
  type: "infix",
  names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"],
  props: {
    numArgs: 0,
    infix: !0
  },
  handler(s) {
    var {
      parser: e,
      funcName: r,
      token: o
    } = s, m;
    switch (r) {
      case "\\over":
        m = "\\frac";
        break;
      case "\\choose":
        m = "\\binom";
        break;
      case "\\atop":
        m = "\\\\atopfrac";
        break;
      case "\\brace":
        m = "\\\\bracefrac";
        break;
      case "\\brack":
        m = "\\\\brackfrac";
        break;
      default:
        throw new Error("Unrecognized infix genfrac command");
    }
    return {
      type: "infix",
      mode: e.mode,
      replaceWith: m,
      token: o
    };
  }
});
var stylArray = ["display", "text", "script", "scriptscript"], delimFromValue = function(e) {
  var r = null;
  return e.length > 0 && (r = e, r = r === "." ? null : r), r;
};
defineFunction({
  type: "genfrac",
  names: ["\\genfrac"],
  props: {
    numArgs: 6,
    allowedInArgument: !0,
    argTypes: ["math", "math", "size", "text", "math", "math"]
  },
  handler(s, e) {
    var {
      parser: r
    } = s, o = e[4], m = e[5], _ = normalizeArgument(e[0]), g = _.type === "atom" && _.family === "open" ? delimFromValue(_.text) : null, y = normalizeArgument(e[1]), E = y.type === "atom" && y.family === "close" ? delimFromValue(y.text) : null, x = assertNodeType(e[2], "size"), v, h = null;
    x.isBlank ? v = !0 : (h = x.value, v = h.number > 0);
    var a = "auto", b = e[3];
    if (b.type === "ordgroup") {
      if (b.body.length > 0) {
        var w = assertNodeType(b.body[0], "textord");
        a = stylArray[Number(w.text)];
      }
    } else
      b = assertNodeType(b, "textord"), a = stylArray[Number(b.text)];
    return {
      type: "genfrac",
      mode: r.mode,
      numer: o,
      denom: m,
      continued: !1,
      hasBarLine: v,
      barSize: h,
      leftDelim: g,
      rightDelim: E,
      size: a
    };
  },
  htmlBuilder: htmlBuilder$4,
  mathmlBuilder: mathmlBuilder$3
});
defineFunction({
  type: "infix",
  names: ["\\above"],
  props: {
    numArgs: 1,
    argTypes: ["size"],
    infix: !0
  },
  handler(s, e) {
    var {
      parser: r,
      funcName: o,
      token: m
    } = s;
    return {
      type: "infix",
      mode: r.mode,
      replaceWith: "\\\\abovefrac",
      size: assertNodeType(e[0], "size").value,
      token: m
    };
  }
});
defineFunction({
  type: "genfrac",
  names: ["\\\\abovefrac"],
  props: {
    numArgs: 3,
    argTypes: ["math", "size", "math"]
  },
  handler: (s, e) => {
    var {
      parser: r,
      funcName: o
    } = s, m = e[0], _ = assert(assertNodeType(e[1], "infix").size), g = e[2], y = _.number > 0;
    return {
      type: "genfrac",
      mode: r.mode,
      numer: m,
      denom: g,
      continued: !1,
      hasBarLine: y,
      barSize: _,
      leftDelim: null,
      rightDelim: null,
      size: "auto"
    };
  },
  htmlBuilder: htmlBuilder$4,
  mathmlBuilder: mathmlBuilder$3
});
var htmlBuilder$3 = (s, e) => {
  var r = e.style, o, m;
  s.type === "supsub" ? (o = s.sup ? buildGroup$1(s.sup, e.havingStyle(r.sup()), e) : buildGroup$1(s.sub, e.havingStyle(r.sub()), e), m = assertNodeType(s.base, "horizBrace")) : m = assertNodeType(s, "horizBrace");
  var _ = buildGroup$1(m.base, e.havingBaseStyle(Style$1.DISPLAY)), g = stretchy.svgSpan(m, e), y;
  if (m.isOver ? (y = buildCommon.makeVList({
    positionType: "firstBaseline",
    children: [{
      type: "elem",
      elem: _
    }, {
      type: "kern",
      size: 0.1
    }, {
      type: "elem",
      elem: g
    }]
  }, e), y.children[0].children[0].children[1].classes.push("svg-align")) : (y = buildCommon.makeVList({
    positionType: "bottom",
    positionData: _.depth + 0.1 + g.height,
    children: [{
      type: "elem",
      elem: g
    }, {
      type: "kern",
      size: 0.1
    }, {
      type: "elem",
      elem: _
    }]
  }, e), y.children[0].children[0].children[0].classes.push("svg-align")), o) {
    var E = buildCommon.makeSpan(["mord", m.isOver ? "mover" : "munder"], [y], e);
    m.isOver ? y = buildCommon.makeVList({
      positionType: "firstBaseline",
      children: [{
        type: "elem",
        elem: E
      }, {
        type: "kern",
        size: 0.2
      }, {
        type: "elem",
        elem: o
      }]
    }, e) : y = buildCommon.makeVList({
      positionType: "bottom",
      positionData: E.depth + 0.2 + o.height + o.depth,
      children: [{
        type: "elem",
        elem: o
      }, {
        type: "kern",
        size: 0.2
      }, {
        type: "elem",
        elem: E
      }]
    }, e);
  }
  return buildCommon.makeSpan(["mord", m.isOver ? "mover" : "munder"], [y], e);
}, mathmlBuilder$2 = (s, e) => {
  var r = stretchy.mathMLnode(s.label);
  return new mathMLTree.MathNode(s.isOver ? "mover" : "munder", [buildGroup(s.base, e), r]);
};
defineFunction({
  type: "horizBrace",
  names: ["\\overbrace", "\\underbrace"],
  props: {
    numArgs: 1
  },
  handler(s, e) {
    var {
      parser: r,
      funcName: o
    } = s;
    return {
      type: "horizBrace",
      mode: r.mode,
      label: o,
      isOver: /^\\over/.test(o),
      base: e[0]
    };
  },
  htmlBuilder: htmlBuilder$3,
  mathmlBuilder: mathmlBuilder$2
});
defineFunction({
  type: "href",
  names: ["\\href"],
  props: {
    numArgs: 2,
    argTypes: ["url", "original"],
    allowedInText: !0
  },
  handler: (s, e) => {
    var {
      parser: r
    } = s, o = e[1], m = assertNodeType(e[0], "url").url;
    return r.settings.isTrusted({
      command: "\\href",
      url: m
    }) ? {
      type: "href",
      mode: r.mode,
      href: m,
      body: ordargument(o)
    } : r.formatUnsupportedCmd("\\href");
  },
  htmlBuilder: (s, e) => {
    var r = buildExpression$1(s.body, e, !1);
    return buildCommon.makeAnchor(s.href, [], r, e);
  },
  mathmlBuilder: (s, e) => {
    var r = buildExpressionRow(s.body, e);
    return r instanceof MathNode || (r = new MathNode("mrow", [r])), r.setAttribute("href", s.href), r;
  }
});
defineFunction({
  type: "href",
  names: ["\\url"],
  props: {
    numArgs: 1,
    argTypes: ["url"],
    allowedInText: !0
  },
  handler: (s, e) => {
    var {
      parser: r
    } = s, o = assertNodeType(e[0], "url").url;
    if (!r.settings.isTrusted({
      command: "\\url",
      url: o
    }))
      return r.formatUnsupportedCmd("\\url");
    for (var m = [], _ = 0; _ < o.length; _++) {
      var g = o[_];
      g === "~" && (g = "\\textasciitilde"), m.push({
        type: "textord",
        mode: "text",
        text: g
      });
    }
    var y = {
      type: "text",
      mode: r.mode,
      font: "\\texttt",
      body: m
    };
    return {
      type: "href",
      mode: r.mode,
      href: o,
      body: ordargument(y)
    };
  }
});
defineFunction({
  type: "hbox",
  names: ["\\hbox"],
  props: {
    numArgs: 1,
    argTypes: ["text"],
    allowedInText: !0,
    primitive: !0
  },
  handler(s, e) {
    var {
      parser: r
    } = s;
    return {
      type: "hbox",
      mode: r.mode,
      body: ordargument(e[0])
    };
  },
  htmlBuilder(s, e) {
    var r = buildExpression$1(s.body, e, !1);
    return buildCommon.makeFragment(r);
  },
  mathmlBuilder(s, e) {
    return new mathMLTree.MathNode("mrow", buildExpression(s.body, e));
  }
});
defineFunction({
  type: "html",
  names: ["\\htmlClass", "\\htmlId", "\\htmlStyle", "\\htmlData"],
  props: {
    numArgs: 2,
    argTypes: ["raw", "original"],
    allowedInText: !0
  },
  handler: (s, e) => {
    var {
      parser: r,
      funcName: o,
      token: m
    } = s, _ = assertNodeType(e[0], "raw").string, g = e[1];
    r.settings.strict && r.settings.reportNonstrict("htmlExtension", "HTML extension is disabled on strict mode");
    var y, E = {};
    switch (o) {
      case "\\htmlClass":
        E.class = _, y = {
          command: "\\htmlClass",
          class: _
        };
        break;
      case "\\htmlId":
        E.id = _, y = {
          command: "\\htmlId",
          id: _
        };
        break;
      case "\\htmlStyle":
        E.style = _, y = {
          command: "\\htmlStyle",
          style: _
        };
        break;
      case "\\htmlData": {
        for (var x = _.split(","), v = 0; v < x.length; v++) {
          var h = x[v].split("=");
          if (h.length !== 2)
            throw new ParseError("Error parsing key-value for \\htmlData");
          E["data-" + h[0].trim()] = h[1].trim();
        }
        y = {
          command: "\\htmlData",
          attributes: E
        };
        break;
      }
      default:
        throw new Error("Unrecognized html command");
    }
    return r.settings.isTrusted(y) ? {
      type: "html",
      mode: r.mode,
      attributes: E,
      body: ordargument(g)
    } : r.formatUnsupportedCmd(o);
  },
  htmlBuilder: (s, e) => {
    var r = buildExpression$1(s.body, e, !1), o = ["enclosing"];
    s.attributes.class && o.push(...s.attributes.class.trim().split(/\s+/));
    var m = buildCommon.makeSpan(o, r, e);
    for (var _ in s.attributes)
      _ !== "class" && s.attributes.hasOwnProperty(_) && m.setAttribute(_, s.attributes[_]);
    return m;
  },
  mathmlBuilder: (s, e) => buildExpressionRow(s.body, e)
});
defineFunction({
  type: "htmlmathml",
  names: ["\\html@mathml"],
  props: {
    numArgs: 2,
    allowedInText: !0
  },
  handler: (s, e) => {
    var {
      parser: r
    } = s;
    return {
      type: "htmlmathml",
      mode: r.mode,
      html: ordargument(e[0]),
      mathml: ordargument(e[1])
    };
  },
  htmlBuilder: (s, e) => {
    var r = buildExpression$1(s.html, e, !1);
    return buildCommon.makeFragment(r);
  },
  mathmlBuilder: (s, e) => buildExpressionRow(s.mathml, e)
});
var sizeData = function(e) {
  if (/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))
    return {
      number: +e,
      unit: "bp"
    };
  var r = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);
  if (!r)
    throw new ParseError("Invalid size: '" + e + "' in \\includegraphics");
  var o = {
    number: +(r[1] + r[2]),
    // sign + magnitude, cast to number
    unit: r[3]
  };
  if (!validUnit(o))
    throw new ParseError("Invalid unit: '" + o.unit + "' in \\includegraphics.");
  return o;
};
defineFunction({
  type: "includegraphics",
  names: ["\\includegraphics"],
  props: {
    numArgs: 1,
    numOptionalArgs: 1,
    argTypes: ["raw", "url"],
    allowedInText: !1
  },
  handler: (s, e, r) => {
    var {
      parser: o
    } = s, m = {
      number: 0,
      unit: "em"
    }, _ = {
      number: 0.9,
      unit: "em"
    }, g = {
      number: 0,
      unit: "em"
    }, y = "";
    if (r[0])
      for (var E = assertNodeType(r[0], "raw").string, x = E.split(","), v = 0; v < x.length; v++) {
        var h = x[v].split("=");
        if (h.length === 2) {
          var a = h[1].trim();
          switch (h[0].trim()) {
            case "alt":
              y = a;
              break;
            case "width":
              m = sizeData(a);
              break;
            case "height":
              _ = sizeData(a);
              break;
            case "totalheight":
              g = sizeData(a);
              break;
            default:
              throw new ParseError("Invalid key: '" + h[0] + "' in \\includegraphics.");
          }
        }
      }
    var b = assertNodeType(e[0], "url").url;
    return y === "" && (y = b, y = y.replace(/^.*[\\/]/, ""), y = y.substring(0, y.lastIndexOf("."))), o.settings.isTrusted({
      command: "\\includegraphics",
      url: b
    }) ? {
      type: "includegraphics",
      mode: o.mode,
      alt: y,
      width: m,
      height: _,
      totalheight: g,
      src: b
    } : o.formatUnsupportedCmd("\\includegraphics");
  },
  htmlBuilder: (s, e) => {
    var r = calculateSize$1(s.height, e), o = 0;
    s.totalheight.number > 0 && (o = calculateSize$1(s.totalheight, e) - r);
    var m = 0;
    s.width.number > 0 && (m = calculateSize$1(s.width, e));
    var _ = {
      height: makeEm(r + o)
    };
    m > 0 && (_.width = makeEm(m)), o > 0 && (_.verticalAlign = makeEm(-o));
    var g = new Img(s.src, s.alt, _);
    return g.height = r, g.depth = o, g;
  },
  mathmlBuilder: (s, e) => {
    var r = new mathMLTree.MathNode("mglyph", []);
    r.setAttribute("alt", s.alt);
    var o = calculateSize$1(s.height, e), m = 0;
    if (s.totalheight.number > 0 && (m = calculateSize$1(s.totalheight, e) - o, r.setAttribute("valign", makeEm(-m))), r.setAttribute("height", makeEm(o + m)), s.width.number > 0) {
      var _ = calculateSize$1(s.width, e);
      r.setAttribute("width", makeEm(_));
    }
    return r.setAttribute("src", s.src), r;
  }
});
defineFunction({
  type: "kern",
  names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"],
  props: {
    numArgs: 1,
    argTypes: ["size"],
    primitive: !0,
    allowedInText: !0
  },
  handler(s, e) {
    var {
      parser: r,
      funcName: o
    } = s, m = assertNodeType(e[0], "size");
    if (r.settings.strict) {
      var _ = o[1] === "m", g = m.value.unit === "mu";
      _ ? (g || r.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + o + " supports only mu units, " + ("not " + m.value.unit + " units")), r.mode !== "math" && r.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + o + " works only in math mode")) : g && r.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + o + " doesn't support mu units");
    }
    return {
      type: "kern",
      mode: r.mode,
      dimension: m.value
    };
  },
  htmlBuilder(s, e) {
    return buildCommon.makeGlue(s.dimension, e);
  },
  mathmlBuilder(s, e) {
    var r = calculateSize$1(s.dimension, e);
    return new mathMLTree.SpaceNode(r);
  }
});
defineFunction({
  type: "lap",
  names: ["\\mathllap", "\\mathrlap", "\\mathclap"],
  props: {
    numArgs: 1,
    allowedInText: !0
  },
  handler: (s, e) => {
    var {
      parser: r,
      funcName: o
    } = s, m = e[0];
    return {
      type: "lap",
      mode: r.mode,
      alignment: o.slice(5),
      body: m
    };
  },
  htmlBuilder: (s, e) => {
    var r;
    s.alignment === "clap" ? (r = buildCommon.makeSpan([], [buildGroup$1(s.body, e)]), r = buildCommon.makeSpan(["inner"], [r], e)) : r = buildCommon.makeSpan(["inner"], [buildGroup$1(s.body, e)]);
    var o = buildCommon.makeSpan(["fix"], []), m = buildCommon.makeSpan([s.alignment], [r, o], e), _ = buildCommon.makeSpan(["strut"]);
    return _.style.height = makeEm(m.height + m.depth), m.depth && (_.style.verticalAlign = makeEm(-m.depth)), m.children.unshift(_), m = buildCommon.makeSpan(["thinbox"], [m], e), buildCommon.makeSpan(["mord", "vbox"], [m], e);
  },
  mathmlBuilder: (s, e) => {
    var r = new mathMLTree.MathNode("mpadded", [buildGroup(s.body, e)]);
    if (s.alignment !== "rlap") {
      var o = s.alignment === "llap" ? "-1" : "-0.5";
      r.setAttribute("lspace", o + "width");
    }
    return r.setAttribute("width", "0px"), r;
  }
});
defineFunction({
  type: "styling",
  names: ["\\(", "$"],
  props: {
    numArgs: 0,
    allowedInText: !0,
    allowedInMath: !1
  },
  handler(s, e) {
    var {
      funcName: r,
      parser: o
    } = s, m = o.mode;
    o.switchMode("math");
    var _ = r === "\\(" ? "\\)" : "$", g = o.parseExpression(!1, _);
    return o.expect(_), o.switchMode(m), {
      type: "styling",
      mode: o.mode,
      style: "text",
      body: g
    };
  }
});
defineFunction({
  type: "text",
  // Doesn't matter what this is.
  names: ["\\)", "\\]"],
  props: {
    numArgs: 0,
    allowedInText: !0,
    allowedInMath: !1
  },
  handler(s, e) {
    throw new ParseError("Mismatched " + s.funcName);
  }
});
var chooseMathStyle = (s, e) => {
  switch (e.style.size) {
    case Style$1.DISPLAY.size:
      return s.display;
    case Style$1.TEXT.size:
      return s.text;
    case Style$1.SCRIPT.size:
      return s.script;
    case Style$1.SCRIPTSCRIPT.size:
      return s.scriptscript;
    default:
      return s.text;
  }
};
defineFunction({
  type: "mathchoice",
  names: ["\\mathchoice"],
  props: {
    numArgs: 4,
    primitive: !0
  },
  handler: (s, e) => {
    var {
      parser: r
    } = s;
    return {
      type: "mathchoice",
      mode: r.mode,
      display: ordargument(e[0]),
      text: ordargument(e[1]),
      script: ordargument(e[2]),
      scriptscript: ordargument(e[3])
    };
  },
  htmlBuilder: (s, e) => {
    var r = chooseMathStyle(s, e), o = buildExpression$1(r, e, !1);
    return buildCommon.makeFragment(o);
  },
  mathmlBuilder: (s, e) => {
    var r = chooseMathStyle(s, e);
    return buildExpressionRow(r, e);
  }
});
var assembleSupSub = (s, e, r, o, m, _, g) => {
  s = buildCommon.makeSpan([], [s]);
  var y = r && utils.isCharacterBox(r), E, x;
  if (e) {
    var v = buildGroup$1(e, o.havingStyle(m.sup()), o);
    x = {
      elem: v,
      kern: Math.max(o.fontMetrics().bigOpSpacing1, o.fontMetrics().bigOpSpacing3 - v.depth)
    };
  }
  if (r) {
    var h = buildGroup$1(r, o.havingStyle(m.sub()), o);
    E = {
      elem: h,
      kern: Math.max(o.fontMetrics().bigOpSpacing2, o.fontMetrics().bigOpSpacing4 - h.height)
    };
  }
  var a;
  if (x && E) {
    var b = o.fontMetrics().bigOpSpacing5 + E.elem.height + E.elem.depth + E.kern + s.depth + g;
    a = buildCommon.makeVList({
      positionType: "bottom",
      positionData: b,
      children: [{
        type: "kern",
        size: o.fontMetrics().bigOpSpacing5
      }, {
        type: "elem",
        elem: E.elem,
        marginLeft: makeEm(-_)
      }, {
        type: "kern",
        size: E.kern
      }, {
        type: "elem",
        elem: s
      }, {
        type: "kern",
        size: x.kern
      }, {
        type: "elem",
        elem: x.elem,
        marginLeft: makeEm(_)
      }, {
        type: "kern",
        size: o.fontMetrics().bigOpSpacing5
      }]
    }, o);
  } else if (E) {
    var w = s.height - g;
    a = buildCommon.makeVList({
      positionType: "top",
      positionData: w,
      children: [{
        type: "kern",
        size: o.fontMetrics().bigOpSpacing5
      }, {
        type: "elem",
        elem: E.elem,
        marginLeft: makeEm(-_)
      }, {
        type: "kern",
        size: E.kern
      }, {
        type: "elem",
        elem: s
      }]
    }, o);
  } else if (x) {
    var k = s.depth + g;
    a = buildCommon.makeVList({
      positionType: "bottom",
      positionData: k,
      children: [{
        type: "elem",
        elem: s
      }, {
        type: "kern",
        size: x.kern
      }, {
        type: "elem",
        elem: x.elem,
        marginLeft: makeEm(_)
      }, {
        type: "kern",
        size: o.fontMetrics().bigOpSpacing5
      }]
    }, o);
  } else
    return s;
  var A = [a];
  if (E && _ !== 0 && !y) {
    var M = buildCommon.makeSpan(["mspace"], [], o);
    M.style.marginRight = makeEm(_), A.unshift(M);
  }
  return buildCommon.makeSpan(["mop", "op-limits"], A, o);
}, noSuccessor = ["\\smallint"], htmlBuilder$2 = (s, e) => {
  var r, o, m = !1, _;
  s.type === "supsub" ? (r = s.sup, o = s.sub, _ = assertNodeType(s.base, "op"), m = !0) : _ = assertNodeType(s, "op");
  var g = e.style, y = !1;
  g.size === Style$1.DISPLAY.size && _.symbol && !utils.contains(noSuccessor, _.name) && (y = !0);
  var E;
  if (_.symbol) {
    var x = y ? "Size2-Regular" : "Size1-Regular", v = "";
    if ((_.name === "\\oiint" || _.name === "\\oiiint") && (v = _.name.slice(1), _.name = v === "oiint" ? "\\iint" : "\\iiint"), E = buildCommon.makeSymbol(_.name, x, "math", e, ["mop", "op-symbol", y ? "large-op" : "small-op"]), v.length > 0) {
      var h = E.italic, a = buildCommon.staticSvg(v + "Size" + (y ? "2" : "1"), e);
      E = buildCommon.makeVList({
        positionType: "individualShift",
        children: [{
          type: "elem",
          elem: E,
          shift: 0
        }, {
          type: "elem",
          elem: a,
          shift: y ? 0.08 : 0
        }]
      }, e), _.name = "\\" + v, E.classes.unshift("mop"), E.italic = h;
    }
  } else if (_.body) {
    var b = buildExpression$1(_.body, e, !0);
    b.length === 1 && b[0] instanceof SymbolNode ? (E = b[0], E.classes[0] = "mop") : E = buildCommon.makeSpan(["mop"], b, e);
  } else {
    for (var w = [], k = 1; k < _.name.length; k++)
      w.push(buildCommon.mathsym(_.name[k], _.mode, e));
    E = buildCommon.makeSpan(["mop"], w, e);
  }
  var A = 0, M = 0;
  return (E instanceof SymbolNode || _.name === "\\oiint" || _.name === "\\oiiint") && !_.suppressBaseShift && (A = (E.height - E.depth) / 2 - e.fontMetrics().axisHeight, M = E.italic), m ? assembleSupSub(E, r, o, e, g, M, A) : (A && (E.style.position = "relative", E.style.top = makeEm(A)), E);
}, mathmlBuilder$1 = (s, e) => {
  var r;
  if (s.symbol)
    r = new MathNode("mo", [makeText(s.name, s.mode)]), utils.contains(noSuccessor, s.name) && r.setAttribute("largeop", "false");
  else if (s.body)
    r = new MathNode("mo", buildExpression(s.body, e));
  else {
    r = new MathNode("mi", [new TextNode(s.name.slice(1))]);
    var o = new MathNode("mo", [makeText("⁡", "text")]);
    s.parentIsSupSub ? r = new MathNode("mrow", [r, o]) : r = newDocumentFragment([r, o]);
  }
  return r;
}, singleCharBigOps = {
  "∏": "\\prod",
  "∐": "\\coprod",
  "∑": "\\sum",
  "⋀": "\\bigwedge",
  "⋁": "\\bigvee",
  "⋂": "\\bigcap",
  "⋃": "\\bigcup",
  "⨀": "\\bigodot",
  "⨁": "\\bigoplus",
  "⨂": "\\bigotimes",
  "⨄": "\\biguplus",
  "⨆": "\\bigsqcup"
};
defineFunction({
  type: "op",
  names: ["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", "∏", "∐", "∑", "⋀", "⋁", "⋂", "⋃", "⨀", "⨁", "⨂", "⨄", "⨆"],
  props: {
    numArgs: 0
  },
  handler: (s, e) => {
    var {
      parser: r,
      funcName: o
    } = s, m = o;
    return m.length === 1 && (m = singleCharBigOps[m]), {
      type: "op",
      mode: r.mode,
      limits: !0,
      parentIsSupSub: !1,
      symbol: !0,
      name: m
    };
  },
  htmlBuilder: htmlBuilder$2,
  mathmlBuilder: mathmlBuilder$1
});
defineFunction({
  type: "op",
  names: ["\\mathop"],
  props: {
    numArgs: 1,
    primitive: !0
  },
  handler: (s, e) => {
    var {
      parser: r
    } = s, o = e[0];
    return {
      type: "op",
      mode: r.mode,
      limits: !1,
      parentIsSupSub: !1,
      symbol: !1,
      body: ordargument(o)
    };
  },
  htmlBuilder: htmlBuilder$2,
  mathmlBuilder: mathmlBuilder$1
});
var singleCharIntegrals = {
  "∫": "\\int",
  "∬": "\\iint",
  "∭": "\\iiint",
  "∮": "\\oint",
  "∯": "\\oiint",
  "∰": "\\oiiint"
};
defineFunction({
  type: "op",
  names: ["\\arcsin", "\\arccos", "\\arctan", "\\arctg", "\\arcctg", "\\arg", "\\ch", "\\cos", "\\cosec", "\\cosh", "\\cot", "\\cotg", "\\coth", "\\csc", "\\ctg", "\\cth", "\\deg", "\\dim", "\\exp", "\\hom", "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\sh", "\\tan", "\\tanh", "\\tg", "\\th"],
  props: {
    numArgs: 0
  },
  handler(s) {
    var {
      parser: e,
      funcName: r
    } = s;
    return {
      type: "op",
      mode: e.mode,
      limits: !1,
      parentIsSupSub: !1,
      symbol: !1,
      name: r
    };
  },
  htmlBuilder: htmlBuilder$2,
  mathmlBuilder: mathmlBuilder$1
});
defineFunction({
  type: "op",
  names: ["\\det", "\\gcd", "\\inf", "\\lim", "\\max", "\\min", "\\Pr", "\\sup"],
  props: {
    numArgs: 0
  },
  handler(s) {
    var {
      parser: e,
      funcName: r
    } = s;
    return {
      type: "op",
      mode: e.mode,
      limits: !0,
      parentIsSupSub: !1,
      symbol: !1,
      name: r
    };
  },
  htmlBuilder: htmlBuilder$2,
  mathmlBuilder: mathmlBuilder$1
});
defineFunction({
  type: "op",
  names: ["\\int", "\\iint", "\\iiint", "\\oint", "\\oiint", "\\oiiint", "∫", "∬", "∭", "∮", "∯", "∰"],
  props: {
    numArgs: 0
  },
  handler(s) {
    var {
      parser: e,
      funcName: r
    } = s, o = r;
    return o.length === 1 && (o = singleCharIntegrals[o]), {
      type: "op",
      mode: e.mode,
      limits: !1,
      parentIsSupSub: !1,
      symbol: !0,
      name: o
    };
  },
  htmlBuilder: htmlBuilder$2,
  mathmlBuilder: mathmlBuilder$1
});
var htmlBuilder$1 = (s, e) => {
  var r, o, m = !1, _;
  s.type === "supsub" ? (r = s.sup, o = s.sub, _ = assertNodeType(s.base, "operatorname"), m = !0) : _ = assertNodeType(s, "operatorname");
  var g;
  if (_.body.length > 0) {
    for (var y = _.body.map((h) => {
      var a = h.text;
      return typeof a == "string" ? {
        type: "textord",
        mode: h.mode,
        text: a
      } : h;
    }), E = buildExpression$1(y, e.withFont("mathrm"), !0), x = 0; x < E.length; x++) {
      var v = E[x];
      v instanceof SymbolNode && (v.text = v.text.replace(/\u2212/, "-").replace(/\u2217/, "*"));
    }
    g = buildCommon.makeSpan(["mop"], E, e);
  } else
    g = buildCommon.makeSpan(["mop"], [], e);
  return m ? assembleSupSub(g, r, o, e, e.style, 0, 0) : g;
}, mathmlBuilder = (s, e) => {
  for (var r = buildExpression(s.body, e.withFont("mathrm")), o = !0, m = 0; m < r.length; m++) {
    var _ = r[m];
    if (!(_ instanceof mathMLTree.SpaceNode)) if (_ instanceof mathMLTree.MathNode)
      switch (_.type) {
        case "mi":
        case "mn":
        case "ms":
        case "mspace":
        case "mtext":
          break;
        case "mo": {
          var g = _.children[0];
          _.children.length === 1 && g instanceof mathMLTree.TextNode ? g.text = g.text.replace(/\u2212/, "-").replace(/\u2217/, "*") : o = !1;
          break;
        }
        default:
          o = !1;
      }
    else
      o = !1;
  }
  if (o) {
    var y = r.map((v) => v.toText()).join("");
    r = [new mathMLTree.TextNode(y)];
  }
  var E = new mathMLTree.MathNode("mi", r);
  E.setAttribute("mathvariant", "normal");
  var x = new mathMLTree.MathNode("mo", [makeText("⁡", "text")]);
  return s.parentIsSupSub ? new mathMLTree.MathNode("mrow", [E, x]) : mathMLTree.newDocumentFragment([E, x]);
};
defineFunction({
  type: "operatorname",
  names: ["\\operatorname@", "\\operatornamewithlimits"],
  props: {
    numArgs: 1
  },
  handler: (s, e) => {
    var {
      parser: r,
      funcName: o
    } = s, m = e[0];
    return {
      type: "operatorname",
      mode: r.mode,
      body: ordargument(m),
      alwaysHandleSupSub: o === "\\operatornamewithlimits",
      limits: !1,
      parentIsSupSub: !1
    };
  },
  htmlBuilder: htmlBuilder$1,
  mathmlBuilder
});
defineMacro("\\operatorname", "\\@ifstar\\operatornamewithlimits\\operatorname@");
defineFunctionBuilders({
  type: "ordgroup",
  htmlBuilder(s, e) {
    return s.semisimple ? buildCommon.makeFragment(buildExpression$1(s.body, e, !1)) : buildCommon.makeSpan(["mord"], buildExpression$1(s.body, e, !0), e);
  },
  mathmlBuilder(s, e) {
    return buildExpressionRow(s.body, e, !0);
  }
});
defineFunction({
  type: "overline",
  names: ["\\overline"],
  props: {
    numArgs: 1
  },
  handler(s, e) {
    var {
      parser: r
    } = s, o = e[0];
    return {
      type: "overline",
      mode: r.mode,
      body: o
    };
  },
  htmlBuilder(s, e) {
    var r = buildGroup$1(s.body, e.havingCrampedStyle()), o = buildCommon.makeLineSpan("overline-line", e), m = e.fontMetrics().defaultRuleThickness, _ = buildCommon.makeVList({
      positionType: "firstBaseline",
      children: [{
        type: "elem",
        elem: r
      }, {
        type: "kern",
        size: 3 * m
      }, {
        type: "elem",
        elem: o
      }, {
        type: "kern",
        size: m
      }]
    }, e);
    return buildCommon.makeSpan(["mord", "overline"], [_], e);
  },
  mathmlBuilder(s, e) {
    var r = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("‾")]);
    r.setAttribute("stretchy", "true");
    var o = new mathMLTree.MathNode("mover", [buildGroup(s.body, e), r]);
    return o.setAttribute("accent", "true"), o;
  }
});
defineFunction({
  type: "phantom",
  names: ["\\phantom"],
  props: {
    numArgs: 1,
    allowedInText: !0
  },
  handler: (s, e) => {
    var {
      parser: r
    } = s, o = e[0];
    return {
      type: "phantom",
      mode: r.mode,
      body: ordargument(o)
    };
  },
  htmlBuilder: (s, e) => {
    var r = buildExpression$1(s.body, e.withPhantom(), !1);
    return buildCommon.makeFragment(r);
  },
  mathmlBuilder: (s, e) => {
    var r = buildExpression(s.body, e);
    return new mathMLTree.MathNode("mphantom", r);
  }
});
defineFunction({
  type: "hphantom",
  names: ["\\hphantom"],
  props: {
    numArgs: 1,
    allowedInText: !0
  },
  handler: (s, e) => {
    var {
      parser: r
    } = s, o = e[0];
    return {
      type: "hphantom",
      mode: r.mode,
      body: o
    };
  },
  htmlBuilder: (s, e) => {
    var r = buildCommon.makeSpan([], [buildGroup$1(s.body, e.withPhantom())]);
    if (r.height = 0, r.depth = 0, r.children)
      for (var o = 0; o < r.children.length; o++)
        r.children[o].height = 0, r.children[o].depth = 0;
    return r = buildCommon.makeVList({
      positionType: "firstBaseline",
      children: [{
        type: "elem",
        elem: r
      }]
    }, e), buildCommon.makeSpan(["mord"], [r], e);
  },
  mathmlBuilder: (s, e) => {
    var r = buildExpression(ordargument(s.body), e), o = new mathMLTree.MathNode("mphantom", r), m = new mathMLTree.MathNode("mpadded", [o]);
    return m.setAttribute("height", "0px"), m.setAttribute("depth", "0px"), m;
  }
});
defineFunction({
  type: "vphantom",
  names: ["\\vphantom"],
  props: {
    numArgs: 1,
    allowedInText: !0
  },
  handler: (s, e) => {
    var {
      parser: r
    } = s, o = e[0];
    return {
      type: "vphantom",
      mode: r.mode,
      body: o
    };
  },
  htmlBuilder: (s, e) => {
    var r = buildCommon.makeSpan(["inner"], [buildGroup$1(s.body, e.withPhantom())]), o = buildCommon.makeSpan(["fix"], []);
    return buildCommon.makeSpan(["mord", "rlap"], [r, o], e);
  },
  mathmlBuilder: (s, e) => {
    var r = buildExpression(ordargument(s.body), e), o = new mathMLTree.MathNode("mphantom", r), m = new mathMLTree.MathNode("mpadded", [o]);
    return m.setAttribute("width", "0px"), m;
  }
});
defineFunction({
  type: "raisebox",
  names: ["\\raisebox"],
  props: {
    numArgs: 2,
    argTypes: ["size", "hbox"],
    allowedInText: !0
  },
  handler(s, e) {
    var {
      parser: r
    } = s, o = assertNodeType(e[0], "size").value, m = e[1];
    return {
      type: "raisebox",
      mode: r.mode,
      dy: o,
      body: m
    };
  },
  htmlBuilder(s, e) {
    var r = buildGroup$1(s.body, e), o = calculateSize$1(s.dy, e);
    return buildCommon.makeVList({
      positionType: "shift",
      positionData: -o,
      children: [{
        type: "elem",
        elem: r
      }]
    }, e);
  },
  mathmlBuilder(s, e) {
    var r = new mathMLTree.MathNode("mpadded", [buildGroup(s.body, e)]), o = s.dy.number + s.dy.unit;
    return r.setAttribute("voffset", o), r;
  }
});
defineFunction({
  type: "internal",
  names: ["\\relax"],
  props: {
    numArgs: 0,
    allowedInText: !0,
    allowedInArgument: !0
  },
  handler(s) {
    var {
      parser: e
    } = s;
    return {
      type: "internal",
      mode: e.mode
    };
  }
});
defineFunction({
  type: "rule",
  names: ["\\rule"],
  props: {
    numArgs: 2,
    numOptionalArgs: 1,
    allowedInText: !0,
    allowedInMath: !0,
    argTypes: ["size", "size", "size"]
  },
  handler(s, e, r) {
    var {
      parser: o
    } = s, m = r[0], _ = assertNodeType(e[0], "size"), g = assertNodeType(e[1], "size");
    return {
      type: "rule",
      mode: o.mode,
      shift: m && assertNodeType(m, "size").value,
      width: _.value,
      height: g.value
    };
  },
  htmlBuilder(s, e) {
    var r = buildCommon.makeSpan(["mord", "rule"], [], e), o = calculateSize$1(s.width, e), m = calculateSize$1(s.height, e), _ = s.shift ? calculateSize$1(s.shift, e) : 0;
    return r.style.borderRightWidth = makeEm(o), r.style.borderTopWidth = makeEm(m), r.style.bottom = makeEm(_), r.width = o, r.height = m + _, r.depth = -_, r.maxFontSize = m * 1.125 * e.sizeMultiplier, r;
  },
  mathmlBuilder(s, e) {
    var r = calculateSize$1(s.width, e), o = calculateSize$1(s.height, e), m = s.shift ? calculateSize$1(s.shift, e) : 0, _ = e.color && e.getColor() || "black", g = new mathMLTree.MathNode("mspace");
    g.setAttribute("mathbackground", _), g.setAttribute("width", makeEm(r)), g.setAttribute("height", makeEm(o));
    var y = new mathMLTree.MathNode("mpadded", [g]);
    return m >= 0 ? y.setAttribute("height", makeEm(m)) : (y.setAttribute("height", makeEm(m)), y.setAttribute("depth", makeEm(-m))), y.setAttribute("voffset", makeEm(m)), y;
  }
});
function sizingGroup(s, e, r) {
  for (var o = buildExpression$1(s, e, !1), m = e.sizeMultiplier / r.sizeMultiplier, _ = 0; _ < o.length; _++) {
    var g = o[_].classes.indexOf("sizing");
    g < 0 ? Array.prototype.push.apply(o[_].classes, e.sizingClasses(r)) : o[_].classes[g + 1] === "reset-size" + e.size && (o[_].classes[g + 1] = "reset-size" + r.size), o[_].height *= m, o[_].depth *= m;
  }
  return buildCommon.makeFragment(o);
}
var sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"], htmlBuilder = (s, e) => {
  var r = e.havingSize(s.size);
  return sizingGroup(s.body, r, e);
};
defineFunction({
  type: "sizing",
  names: sizeFuncs,
  props: {
    numArgs: 0,
    allowedInText: !0
  },
  handler: (s, e) => {
    var {
      breakOnTokenText: r,
      funcName: o,
      parser: m
    } = s, _ = m.parseExpression(!1, r);
    return {
      type: "sizing",
      mode: m.mode,
      // Figure out what size to use based on the list of functions above
      size: sizeFuncs.indexOf(o) + 1,
      body: _
    };
  },
  htmlBuilder,
  mathmlBuilder: (s, e) => {
    var r = e.havingSize(s.size), o = buildExpression(s.body, r), m = new mathMLTree.MathNode("mstyle", o);
    return m.setAttribute("mathsize", makeEm(r.sizeMultiplier)), m;
  }
});
defineFunction({
  type: "smash",
  names: ["\\smash"],
  props: {
    numArgs: 1,
    numOptionalArgs: 1,
    allowedInText: !0
  },
  handler: (s, e, r) => {
    var {
      parser: o
    } = s, m = !1, _ = !1, g = r[0] && assertNodeType(r[0], "ordgroup");
    if (g)
      for (var y = "", E = 0; E < g.body.length; ++E) {
        var x = g.body[E];
        if (y = x.text, y === "t")
          m = !0;
        else if (y === "b")
          _ = !0;
        else {
          m = !1, _ = !1;
          break;
        }
      }
    else
      m = !0, _ = !0;
    var v = e[0];
    return {
      type: "smash",
      mode: o.mode,
      body: v,
      smashHeight: m,
      smashDepth: _
    };
  },
  htmlBuilder: (s, e) => {
    var r = buildCommon.makeSpan([], [buildGroup$1(s.body, e)]);
    if (!s.smashHeight && !s.smashDepth)
      return r;
    if (s.smashHeight && (r.height = 0, r.children))
      for (var o = 0; o < r.children.length; o++)
        r.children[o].height = 0;
    if (s.smashDepth && (r.depth = 0, r.children))
      for (var m = 0; m < r.children.length; m++)
        r.children[m].depth = 0;
    var _ = buildCommon.makeVList({
      positionType: "firstBaseline",
      children: [{
        type: "elem",
        elem: r
      }]
    }, e);
    return buildCommon.makeSpan(["mord"], [_], e);
  },
  mathmlBuilder: (s, e) => {
    var r = new mathMLTree.MathNode("mpadded", [buildGroup(s.body, e)]);
    return s.smashHeight && r.setAttribute("height", "0px"), s.smashDepth && r.setAttribute("depth", "0px"), r;
  }
});
defineFunction({
  type: "sqrt",
  names: ["\\sqrt"],
  props: {
    numArgs: 1,
    numOptionalArgs: 1
  },
  handler(s, e, r) {
    var {
      parser: o
    } = s, m = r[0], _ = e[0];
    return {
      type: "sqrt",
      mode: o.mode,
      body: _,
      index: m
    };
  },
  htmlBuilder(s, e) {
    var r = buildGroup$1(s.body, e.havingCrampedStyle());
    r.height === 0 && (r.height = e.fontMetrics().xHeight), r = buildCommon.wrapFragment(r, e);
    var o = e.fontMetrics(), m = o.defaultRuleThickness, _ = m;
    e.style.id < Style$1.TEXT.id && (_ = e.fontMetrics().xHeight);
    var g = m + _ / 4, y = r.height + r.depth + g + m, {
      span: E,
      ruleWidth: x,
      advanceWidth: v
    } = delimiter.sqrtImage(y, e), h = E.height - x;
    h > r.height + r.depth + g && (g = (g + h - r.height - r.depth) / 2);
    var a = E.height - r.height - g - x;
    r.style.paddingLeft = makeEm(v);
    var b = buildCommon.makeVList({
      positionType: "firstBaseline",
      children: [{
        type: "elem",
        elem: r,
        wrapperClasses: ["svg-align"]
      }, {
        type: "kern",
        size: -(r.height + a)
      }, {
        type: "elem",
        elem: E
      }, {
        type: "kern",
        size: x
      }]
    }, e);
    if (s.index) {
      var w = e.havingStyle(Style$1.SCRIPTSCRIPT), k = buildGroup$1(s.index, w, e), A = 0.6 * (b.height - b.depth), M = buildCommon.makeVList({
        positionType: "shift",
        positionData: -A,
        children: [{
          type: "elem",
          elem: k
        }]
      }, e), $ = buildCommon.makeSpan(["root"], [M]);
      return buildCommon.makeSpan(["mord", "sqrt"], [$, b], e);
    } else
      return buildCommon.makeSpan(["mord", "sqrt"], [b], e);
  },
  mathmlBuilder(s, e) {
    var {
      body: r,
      index: o
    } = s;
    return o ? new mathMLTree.MathNode("mroot", [buildGroup(r, e), buildGroup(o, e)]) : new mathMLTree.MathNode("msqrt", [buildGroup(r, e)]);
  }
});
var styleMap = {
  display: Style$1.DISPLAY,
  text: Style$1.TEXT,
  script: Style$1.SCRIPT,
  scriptscript: Style$1.SCRIPTSCRIPT
};
defineFunction({
  type: "styling",
  names: ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"],
  props: {
    numArgs: 0,
    allowedInText: !0,
    primitive: !0
  },
  handler(s, e) {
    var {
      breakOnTokenText: r,
      funcName: o,
      parser: m
    } = s, _ = m.parseExpression(!0, r), g = o.slice(1, o.length - 5);
    return {
      type: "styling",
      mode: m.mode,
      // Figure out what style to use by pulling out the style from
      // the function name
      style: g,
      body: _
    };
  },
  htmlBuilder(s, e) {
    var r = styleMap[s.style], o = e.havingStyle(r).withFont("");
    return sizingGroup(s.body, o, e);
  },
  mathmlBuilder(s, e) {
    var r = styleMap[s.style], o = e.havingStyle(r), m = buildExpression(s.body, o), _ = new mathMLTree.MathNode("mstyle", m), g = {
      display: ["0", "true"],
      text: ["0", "false"],
      script: ["1", "false"],
      scriptscript: ["2", "false"]
    }, y = g[s.style];
    return _.setAttribute("scriptlevel", y[0]), _.setAttribute("displaystyle", y[1]), _;
  }
});
var htmlBuilderDelegate = function(e, r) {
  var o = e.base;
  if (o)
    if (o.type === "op") {
      var m = o.limits && (r.style.size === Style$1.DISPLAY.size || o.alwaysHandleSupSub);
      return m ? htmlBuilder$2 : null;
    } else if (o.type === "operatorname") {
      var _ = o.alwaysHandleSupSub && (r.style.size === Style$1.DISPLAY.size || o.limits);
      return _ ? htmlBuilder$1 : null;
    } else {
      if (o.type === "accent")
        return utils.isCharacterBox(o.base) ? htmlBuilder$a : null;
      if (o.type === "horizBrace") {
        var g = !e.sub;
        return g === o.isOver ? htmlBuilder$3 : null;
      } else
        return null;
    }
  else return null;
};
defineFunctionBuilders({
  type: "supsub",
  htmlBuilder(s, e) {
    var r = htmlBuilderDelegate(s, e);
    if (r)
      return r(s, e);
    var {
      base: o,
      sup: m,
      sub: _
    } = s, g = buildGroup$1(o, e), y, E, x = e.fontMetrics(), v = 0, h = 0, a = o && utils.isCharacterBox(o);
    if (m) {
      var b = e.havingStyle(e.style.sup());
      y = buildGroup$1(m, b, e), a || (v = g.height - b.fontMetrics().supDrop * b.sizeMultiplier / e.sizeMultiplier);
    }
    if (_) {
      var w = e.havingStyle(e.style.sub());
      E = buildGroup$1(_, w, e), a || (h = g.depth + w.fontMetrics().subDrop * w.sizeMultiplier / e.sizeMultiplier);
    }
    var k;
    e.style === Style$1.DISPLAY ? k = x.sup1 : e.style.cramped ? k = x.sup3 : k = x.sup2;
    var A = e.sizeMultiplier, M = makeEm(0.5 / x.ptPerEm / A), $ = null;
    if (E) {
      var O = s.base && s.base.type === "op" && s.base.name && (s.base.name === "\\oiint" || s.base.name === "\\oiiint");
      (g instanceof SymbolNode || O) && ($ = makeEm(-g.italic));
    }
    var C;
    if (y && E) {
      v = Math.max(v, k, y.depth + 0.25 * x.xHeight), h = Math.max(h, x.sub2);
      var P = x.defaultRuleThickness, I = 4 * P;
      if (v - y.depth - (E.height - h) < I) {
        h = I - (v - y.depth) + E.height;
        var N = 0.8 * x.xHeight - (v - y.depth);
        N > 0 && (v += N, h -= N);
      }
      var R = [{
        type: "elem",
        elem: E,
        shift: h,
        marginRight: M,
        marginLeft: $
      }, {
        type: "elem",
        elem: y,
        shift: -v,
        marginRight: M
      }];
      C = buildCommon.makeVList({
        positionType: "individualShift",
        children: R
      }, e);
    } else if (E) {
      h = Math.max(h, x.sub1, E.height - 0.8 * x.xHeight);
      var F = [{
        type: "elem",
        elem: E,
        marginLeft: $,
        marginRight: M
      }];
      C = buildCommon.makeVList({
        positionType: "shift",
        positionData: h,
        children: F
      }, e);
    } else if (y)
      v = Math.max(v, k, y.depth + 0.25 * x.xHeight), C = buildCommon.makeVList({
        positionType: "shift",
        positionData: -v,
        children: [{
          type: "elem",
          elem: y,
          marginRight: M
        }]
      }, e);
    else
      throw new Error("supsub must have either sup or sub.");
    var B = getTypeOfDomTree(g, "right") || "mord";
    return buildCommon.makeSpan([B], [g, buildCommon.makeSpan(["msupsub"], [C])], e);
  },
  mathmlBuilder(s, e) {
    var r = !1, o, m;
    s.base && s.base.type === "horizBrace" && (m = !!s.sup, m === s.base.isOver && (r = !0, o = s.base.isOver)), s.base && (s.base.type === "op" || s.base.type === "operatorname") && (s.base.parentIsSupSub = !0);
    var _ = [buildGroup(s.base, e)];
    s.sub && _.push(buildGroup(s.sub, e)), s.sup && _.push(buildGroup(s.sup, e));
    var g;
    if (r)
      g = o ? "mover" : "munder";
    else if (s.sub)
      if (s.sup) {
        var x = s.base;
        x && x.type === "op" && x.limits && e.style === Style$1.DISPLAY || x && x.type === "operatorname" && x.alwaysHandleSupSub && (e.style === Style$1.DISPLAY || x.limits) ? g = "munderover" : g = "msubsup";
      } else {
        var E = s.base;
        E && E.type === "op" && E.limits && (e.style === Style$1.DISPLAY || E.alwaysHandleSupSub) || E && E.type === "operatorname" && E.alwaysHandleSupSub && (E.limits || e.style === Style$1.DISPLAY) ? g = "munder" : g = "msub";
      }
    else {
      var y = s.base;
      y && y.type === "op" && y.limits && (e.style === Style$1.DISPLAY || y.alwaysHandleSupSub) || y && y.type === "operatorname" && y.alwaysHandleSupSub && (y.limits || e.style === Style$1.DISPLAY) ? g = "mover" : g = "msup";
    }
    return new mathMLTree.MathNode(g, _);
  }
});
defineFunctionBuilders({
  type: "atom",
  htmlBuilder(s, e) {
    return buildCommon.mathsym(s.text, s.mode, e, ["m" + s.family]);
  },
  mathmlBuilder(s, e) {
    var r = new mathMLTree.MathNode("mo", [makeText(s.text, s.mode)]);
    if (s.family === "bin") {
      var o = getVariant(s, e);
      o === "bold-italic" && r.setAttribute("mathvariant", o);
    } else s.family === "punct" ? r.setAttribute("separator", "true") : (s.family === "open" || s.family === "close") && r.setAttribute("stretchy", "false");
    return r;
  }
});
var defaultVariant = {
  mi: "italic",
  mn: "normal",
  mtext: "normal"
};
defineFunctionBuilders({
  type: "mathord",
  htmlBuilder(s, e) {
    return buildCommon.makeOrd(s, e, "mathord");
  },
  mathmlBuilder(s, e) {
    var r = new mathMLTree.MathNode("mi", [makeText(s.text, s.mode, e)]), o = getVariant(s, e) || "italic";
    return o !== defaultVariant[r.type] && r.setAttribute("mathvariant", o), r;
  }
});
defineFunctionBuilders({
  type: "textord",
  htmlBuilder(s, e) {
    return buildCommon.makeOrd(s, e, "textord");
  },
  mathmlBuilder(s, e) {
    var r = makeText(s.text, s.mode, e), o = getVariant(s, e) || "normal", m;
    return s.mode === "text" ? m = new mathMLTree.MathNode("mtext", [r]) : /[0-9]/.test(s.text) ? m = new mathMLTree.MathNode("mn", [r]) : s.text === "\\prime" ? m = new mathMLTree.MathNode("mo", [r]) : m = new mathMLTree.MathNode("mi", [r]), o !== defaultVariant[m.type] && m.setAttribute("mathvariant", o), m;
  }
});
var cssSpace = {
  "\\nobreak": "nobreak",
  "\\allowbreak": "allowbreak"
}, regularSpace = {
  " ": {},
  "\\ ": {},
  "~": {
    className: "nobreak"
  },
  "\\space": {},
  "\\nobreakspace": {
    className: "nobreak"
  }
};
defineFunctionBuilders({
  type: "spacing",
  htmlBuilder(s, e) {
    if (regularSpace.hasOwnProperty(s.text)) {
      var r = regularSpace[s.text].className || "";
      if (s.mode === "text") {
        var o = buildCommon.makeOrd(s, e, "textord");
        return o.classes.push(r), o;
      } else
        return buildCommon.makeSpan(["mspace", r], [buildCommon.mathsym(s.text, s.mode, e)], e);
    } else {
      if (cssSpace.hasOwnProperty(s.text))
        return buildCommon.makeSpan(["mspace", cssSpace[s.text]], [], e);
      throw new ParseError('Unknown type of space "' + s.text + '"');
    }
  },
  mathmlBuilder(s, e) {
    var r;
    if (regularSpace.hasOwnProperty(s.text))
      r = new mathMLTree.MathNode("mtext", [new mathMLTree.TextNode(" ")]);
    else {
      if (cssSpace.hasOwnProperty(s.text))
        return new mathMLTree.MathNode("mspace");
      throw new ParseError('Unknown type of space "' + s.text + '"');
    }
    return r;
  }
});
var pad = () => {
  var s = new mathMLTree.MathNode("mtd", []);
  return s.setAttribute("width", "50%"), s;
};
defineFunctionBuilders({
  type: "tag",
  mathmlBuilder(s, e) {
    var r = new mathMLTree.MathNode("mtable", [new mathMLTree.MathNode("mtr", [pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(s.body, e)]), pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(s.tag, e)])])]);
    return r.setAttribute("width", "100%"), r;
  }
});
var textFontFamilies = {
  "\\text": void 0,
  "\\textrm": "textrm",
  "\\textsf": "textsf",
  "\\texttt": "texttt",
  "\\textnormal": "textrm"
}, textFontWeights = {
  "\\textbf": "textbf",
  "\\textmd": "textmd"
}, textFontShapes = {
  "\\textit": "textit",
  "\\textup": "textup"
}, optionsWithFont = (s, e) => {
  var r = s.font;
  if (r) {
    if (textFontFamilies[r])
      return e.withTextFontFamily(textFontFamilies[r]);
    if (textFontWeights[r])
      return e.withTextFontWeight(textFontWeights[r]);
    if (r === "\\emph")
      return e.fontShape === "textit" ? e.withTextFontShape("textup") : e.withTextFontShape("textit");
  } else return e;
  return e.withTextFontShape(textFontShapes[r]);
};
defineFunction({
  type: "text",
  names: [
    // Font families
    "\\text",
    "\\textrm",
    "\\textsf",
    "\\texttt",
    "\\textnormal",
    // Font weights
    "\\textbf",
    "\\textmd",
    // Font Shapes
    "\\textit",
    "\\textup",
    "\\emph"
  ],
  props: {
    numArgs: 1,
    argTypes: ["text"],
    allowedInArgument: !0,
    allowedInText: !0
  },
  handler(s, e) {
    var {
      parser: r,
      funcName: o
    } = s, m = e[0];
    return {
      type: "text",
      mode: r.mode,
      body: ordargument(m),
      font: o
    };
  },
  htmlBuilder(s, e) {
    var r = optionsWithFont(s, e), o = buildExpression$1(s.body, r, !0);
    return buildCommon.makeSpan(["mord", "text"], o, r);
  },
  mathmlBuilder(s, e) {
    var r = optionsWithFont(s, e);
    return buildExpressionRow(s.body, r);
  }
});
defineFunction({
  type: "underline",
  names: ["\\underline"],
  props: {
    numArgs: 1,
    allowedInText: !0
  },
  handler(s, e) {
    var {
      parser: r
    } = s;
    return {
      type: "underline",
      mode: r.mode,
      body: e[0]
    };
  },
  htmlBuilder(s, e) {
    var r = buildGroup$1(s.body, e), o = buildCommon.makeLineSpan("underline-line", e), m = e.fontMetrics().defaultRuleThickness, _ = buildCommon.makeVList({
      positionType: "top",
      positionData: r.height,
      children: [{
        type: "kern",
        size: m
      }, {
        type: "elem",
        elem: o
      }, {
        type: "kern",
        size: 3 * m
      }, {
        type: "elem",
        elem: r
      }]
    }, e);
    return buildCommon.makeSpan(["mord", "underline"], [_], e);
  },
  mathmlBuilder(s, e) {
    var r = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("‾")]);
    r.setAttribute("stretchy", "true");
    var o = new mathMLTree.MathNode("munder", [buildGroup(s.body, e), r]);
    return o.setAttribute("accentunder", "true"), o;
  }
});
defineFunction({
  type: "vcenter",
  names: ["\\vcenter"],
  props: {
    numArgs: 1,
    argTypes: ["original"],
    // In LaTeX, \vcenter can act only on a box.
    allowedInText: !1
  },
  handler(s, e) {
    var {
      parser: r
    } = s;
    return {
      type: "vcenter",
      mode: r.mode,
      body: e[0]
    };
  },
  htmlBuilder(s, e) {
    var r = buildGroup$1(s.body, e), o = e.fontMetrics().axisHeight, m = 0.5 * (r.height - o - (r.depth + o));
    return buildCommon.makeVList({
      positionType: "shift",
      positionData: m,
      children: [{
        type: "elem",
        elem: r
      }]
    }, e);
  },
  mathmlBuilder(s, e) {
    return new mathMLTree.MathNode("mpadded", [buildGroup(s.body, e)], ["vcenter"]);
  }
});
defineFunction({
  type: "verb",
  names: ["\\verb"],
  props: {
    numArgs: 0,
    allowedInText: !0
  },
  handler(s, e, r) {
    throw new ParseError("\\verb ended by end of line instead of matching delimiter");
  },
  htmlBuilder(s, e) {
    for (var r = makeVerb(s), o = [], m = e.havingStyle(e.style.text()), _ = 0; _ < r.length; _++) {
      var g = r[_];
      g === "~" && (g = "\\textasciitilde"), o.push(buildCommon.makeSymbol(g, "Typewriter-Regular", s.mode, m, ["mord", "texttt"]));
    }
    return buildCommon.makeSpan(["mord", "text"].concat(m.sizingClasses(e)), buildCommon.tryCombineChars(o), m);
  },
  mathmlBuilder(s, e) {
    var r = new mathMLTree.TextNode(makeVerb(s)), o = new mathMLTree.MathNode("mtext", [r]);
    return o.setAttribute("mathvariant", "monospace"), o;
  }
});
var makeVerb = (s) => s.body.replace(/ /g, s.star ? "␣" : " "), functions = _functions, spaceRegexString = `[ \r
	]`, controlWordRegexString = "\\\\[a-zA-Z@]+", controlSymbolRegexString = "\\\\[^\uD800-\uDFFF]", controlWordWhitespaceRegexString = "(" + controlWordRegexString + ")" + spaceRegexString + "*", controlSpaceRegexString = `\\\\(
|[ \r	]+
?)[ \r	]*`, combiningDiacriticalMarkString = "[̀-ͯ]", combiningDiacriticalMarksEndRegex = new RegExp(combiningDiacriticalMarkString + "+$"), tokenRegexString = "(" + spaceRegexString + "+)|" + // whitespace
(controlSpaceRegexString + "|") + // \whitespace
"([!-\\[\\]-‧‪-퟿豈-]" + // single codepoint
(combiningDiacriticalMarkString + "*") + // ...plus accents
"|[\uD800-\uDBFF][\uDC00-\uDFFF]" + // surrogate pair
(combiningDiacriticalMarkString + "*") + // ...plus accents
"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5" + // \verb unstarred
("|" + controlWordWhitespaceRegexString) + // \macroName + spaces
("|" + controlSymbolRegexString + ")");
class Lexer {
  // Category codes. The lexer only supports comment characters (14) for now.
  // MacroExpander additionally distinguishes active (13).
  constructor(e, r) {
    this.input = void 0, this.settings = void 0, this.tokenRegex = void 0, this.catcodes = void 0, this.input = e, this.settings = r, this.tokenRegex = new RegExp(tokenRegexString, "g"), this.catcodes = {
      "%": 14,
      // comment character
      "~": 13
      // active character
    };
  }
  setCatcode(e, r) {
    this.catcodes[e] = r;
  }
  /**
   * This function lexes a single token.
   */
  lex() {
    var e = this.input, r = this.tokenRegex.lastIndex;
    if (r === e.length)
      return new Token$1("EOF", new SourceLocation(this, r, r));
    var o = this.tokenRegex.exec(e);
    if (o === null || o.index !== r)
      throw new ParseError("Unexpected character: '" + e[r] + "'", new Token$1(e[r], new SourceLocation(this, r, r + 1)));
    var m = o[6] || o[3] || (o[2] ? "\\ " : " ");
    if (this.catcodes[m] === 14) {
      var _ = e.indexOf(`
`, this.tokenRegex.lastIndex);
      return _ === -1 ? (this.tokenRegex.lastIndex = e.length, this.settings.reportNonstrict("commentAtEnd", "% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")) : this.tokenRegex.lastIndex = _ + 1, this.lex();
    }
    return new Token$1(m, new SourceLocation(this, r, this.tokenRegex.lastIndex));
  }
}
class Namespace {
  /**
   * Both arguments are optional.  The first argument is an object of
   * built-in mappings which never change.  The second argument is an object
   * of initial (global-level) mappings, which will constantly change
   * according to any global/top-level `set`s done.
   */
  constructor(e, r) {
    e === void 0 && (e = {}), r === void 0 && (r = {}), this.current = void 0, this.builtins = void 0, this.undefStack = void 0, this.current = r, this.builtins = e, this.undefStack = [];
  }
  /**
   * Start a new nested group, affecting future local `set`s.
   */
  beginGroup() {
    this.undefStack.push({});
  }
  /**
   * End current nested group, restoring values before the group began.
   */
  endGroup() {
    if (this.undefStack.length === 0)
      throw new ParseError("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");
    var e = this.undefStack.pop();
    for (var r in e)
      e.hasOwnProperty(r) && (e[r] == null ? delete this.current[r] : this.current[r] = e[r]);
  }
  /**
   * Ends all currently nested groups (if any), restoring values before the
   * groups began.  Useful in case of an error in the middle of parsing.
   */
  endGroups() {
    for (; this.undefStack.length > 0; )
      this.endGroup();
  }
  /**
   * Detect whether `name` has a definition.  Equivalent to
   * `get(name) != null`.
   */
  has(e) {
    return this.current.hasOwnProperty(e) || this.builtins.hasOwnProperty(e);
  }
  /**
   * Get the current value of a name, or `undefined` if there is no value.
   *
   * Note: Do not use `if (namespace.get(...))` to detect whether a macro
   * is defined, as the definition may be the empty string which evaluates
   * to `false` in JavaScript.  Use `if (namespace.get(...) != null)` or
   * `if (namespace.has(...))`.
   */
  get(e) {
    return this.current.hasOwnProperty(e) ? this.current[e] : this.builtins[e];
  }
  /**
   * Set the current value of a name, and optionally set it globally too.
   * Local set() sets the current value and (when appropriate) adds an undo
   * operation to the undo stack.  Global set() may change the undo
   * operation at every level, so takes time linear in their number.
   * A value of undefined means to delete existing definitions.
   */
  set(e, r, o) {
    if (o === void 0 && (o = !1), o) {
      for (var m = 0; m < this.undefStack.length; m++)
        delete this.undefStack[m][e];
      this.undefStack.length > 0 && (this.undefStack[this.undefStack.length - 1][e] = r);
    } else {
      var _ = this.undefStack[this.undefStack.length - 1];
      _ && !_.hasOwnProperty(e) && (_[e] = this.current[e]);
    }
    r == null ? delete this.current[e] : this.current[e] = r;
  }
}
var macros = _macros;
defineMacro("\\noexpand", function(s) {
  var e = s.popToken();
  return s.isExpandable(e.text) && (e.noexpand = !0, e.treatAsRelax = !0), {
    tokens: [e],
    numArgs: 0
  };
});
defineMacro("\\expandafter", function(s) {
  var e = s.popToken();
  return s.expandOnce(!0), {
    tokens: [e],
    numArgs: 0
  };
});
defineMacro("\\@firstoftwo", function(s) {
  var e = s.consumeArgs(2);
  return {
    tokens: e[0],
    numArgs: 0
  };
});
defineMacro("\\@secondoftwo", function(s) {
  var e = s.consumeArgs(2);
  return {
    tokens: e[1],
    numArgs: 0
  };
});
defineMacro("\\@ifnextchar", function(s) {
  var e = s.consumeArgs(3);
  s.consumeSpaces();
  var r = s.future();
  return e[0].length === 1 && e[0][0].text === r.text ? {
    tokens: e[1],
    numArgs: 0
  } : {
    tokens: e[2],
    numArgs: 0
  };
});
defineMacro("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}");
defineMacro("\\TextOrMath", function(s) {
  var e = s.consumeArgs(2);
  return s.mode === "text" ? {
    tokens: e[0],
    numArgs: 0
  } : {
    tokens: e[1],
    numArgs: 0
  };
});
var digitToNumber = {
  0: 0,
  1: 1,
  2: 2,
  3: 3,
  4: 4,
  5: 5,
  6: 6,
  7: 7,
  8: 8,
  9: 9,
  a: 10,
  A: 10,
  b: 11,
  B: 11,
  c: 12,
  C: 12,
  d: 13,
  D: 13,
  e: 14,
  E: 14,
  f: 15,
  F: 15
};
defineMacro("\\char", function(s) {
  var e = s.popToken(), r, o = "";
  if (e.text === "'")
    r = 8, e = s.popToken();
  else if (e.text === '"')
    r = 16, e = s.popToken();
  else if (e.text === "`")
    if (e = s.popToken(), e.text[0] === "\\")
      o = e.text.charCodeAt(1);
    else {
      if (e.text === "EOF")
        throw new ParseError("\\char` missing argument");
      o = e.text.charCodeAt(0);
    }
  else
    r = 10;
  if (r) {
    if (o = digitToNumber[e.text], o == null || o >= r)
      throw new ParseError("Invalid base-" + r + " digit " + e.text);
    for (var m; (m = digitToNumber[s.future().text]) != null && m < r; )
      o *= r, o += m, s.popToken();
  }
  return "\\@char{" + o + "}";
});
var newcommand = (s, e, r, o) => {
  var m = s.consumeArg().tokens;
  if (m.length !== 1)
    throw new ParseError("\\newcommand's first argument must be a macro name");
  var _ = m[0].text, g = s.isDefined(_);
  if (g && !e)
    throw new ParseError("\\newcommand{" + _ + "} attempting to redefine " + (_ + "; use \\renewcommand"));
  if (!g && !r)
    throw new ParseError("\\renewcommand{" + _ + "} when command " + _ + " does not yet exist; use \\newcommand");
  var y = 0;
  if (m = s.consumeArg().tokens, m.length === 1 && m[0].text === "[") {
    for (var E = "", x = s.expandNextToken(); x.text !== "]" && x.text !== "EOF"; )
      E += x.text, x = s.expandNextToken();
    if (!E.match(/^\s*[0-9]+\s*$/))
      throw new ParseError("Invalid number of arguments: " + E);
    y = parseInt(E), m = s.consumeArg().tokens;
  }
  return g && o || s.macros.set(_, {
    tokens: m,
    numArgs: y
  }), "";
};
defineMacro("\\newcommand", (s) => newcommand(s, !1, !0, !1));
defineMacro("\\renewcommand", (s) => newcommand(s, !0, !1, !1));
defineMacro("\\providecommand", (s) => newcommand(s, !0, !0, !0));
defineMacro("\\message", (s) => {
  var e = s.consumeArgs(1)[0];
  return console.log(e.reverse().map((r) => r.text).join("")), "";
});
defineMacro("\\errmessage", (s) => {
  var e = s.consumeArgs(1)[0];
  return console.error(e.reverse().map((r) => r.text).join("")), "";
});
defineMacro("\\show", (s) => {
  var e = s.popToken(), r = e.text;
  return console.log(e, s.macros.get(r), functions[r], symbols.math[r], symbols.text[r]), "";
});
defineMacro("\\bgroup", "{");
defineMacro("\\egroup", "}");
defineMacro("~", "\\nobreakspace");
defineMacro("\\lq", "`");
defineMacro("\\rq", "'");
defineMacro("\\aa", "\\r a");
defineMacro("\\AA", "\\r A");
defineMacro("\\textcopyright", "\\html@mathml{\\textcircled{c}}{\\char`©}");
defineMacro("\\copyright", "\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");
defineMacro("\\textregistered", "\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");
defineMacro("ℬ", "\\mathscr{B}");
defineMacro("ℰ", "\\mathscr{E}");
defineMacro("ℱ", "\\mathscr{F}");
defineMacro("ℋ", "\\mathscr{H}");
defineMacro("ℐ", "\\mathscr{I}");
defineMacro("ℒ", "\\mathscr{L}");
defineMacro("ℳ", "\\mathscr{M}");
defineMacro("ℛ", "\\mathscr{R}");
defineMacro("ℭ", "\\mathfrak{C}");
defineMacro("ℌ", "\\mathfrak{H}");
defineMacro("ℨ", "\\mathfrak{Z}");
defineMacro("\\Bbbk", "\\Bbb{k}");
defineMacro("·", "\\cdotp");
defineMacro("\\llap", "\\mathllap{\\textrm{#1}}");
defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}");
defineMacro("\\clap", "\\mathclap{\\textrm{#1}}");
defineMacro("\\mathstrut", "\\vphantom{(}");
defineMacro("\\underbar", "\\underline{\\text{#1}}");
defineMacro("\\not", '\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');
defineMacro("\\neq", "\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");
defineMacro("\\ne", "\\neq");
defineMacro("≠", "\\neq");
defineMacro("\\notin", "\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");
defineMacro("∉", "\\notin");
defineMacro("≘", "\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");
defineMacro("≙", "\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");
defineMacro("≚", "\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");
defineMacro("≛", "\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");
defineMacro("≝", "\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");
defineMacro("≞", "\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");
defineMacro("≟", "\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");
defineMacro("⟂", "\\perp");
defineMacro("‼", "\\mathclose{!\\mkern-0.8mu!}");
defineMacro("∌", "\\notni");
defineMacro("⌜", "\\ulcorner");
defineMacro("⌝", "\\urcorner");
defineMacro("⌞", "\\llcorner");
defineMacro("⌟", "\\lrcorner");
defineMacro("©", "\\copyright");
defineMacro("®", "\\textregistered");
defineMacro("️", "\\textregistered");
defineMacro("\\ulcorner", '\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');
defineMacro("\\urcorner", '\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');
defineMacro("\\llcorner", '\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');
defineMacro("\\lrcorner", '\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');
defineMacro("\\vdots", "{\\varvdots\\rule{0pt}{15pt}}");
defineMacro("⋮", "\\vdots");
defineMacro("\\varGamma", "\\mathit{\\Gamma}");
defineMacro("\\varDelta", "\\mathit{\\Delta}");
defineMacro("\\varTheta", "\\mathit{\\Theta}");
defineMacro("\\varLambda", "\\mathit{\\Lambda}");
defineMacro("\\varXi", "\\mathit{\\Xi}");
defineMacro("\\varPi", "\\mathit{\\Pi}");
defineMacro("\\varSigma", "\\mathit{\\Sigma}");
defineMacro("\\varUpsilon", "\\mathit{\\Upsilon}");
defineMacro("\\varPhi", "\\mathit{\\Phi}");
defineMacro("\\varPsi", "\\mathit{\\Psi}");
defineMacro("\\varOmega", "\\mathit{\\Omega}");
defineMacro("\\substack", "\\begin{subarray}{c}#1\\end{subarray}");
defineMacro("\\colon", "\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");
defineMacro("\\boxed", "\\fbox{$\\displaystyle{#1}$}");
defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;");
defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;");
defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;");
defineMacro("\\dddot", "{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");
defineMacro("\\ddddot", "{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");
var dotsByToken = {
  ",": "\\dotsc",
  "\\not": "\\dotsb",
  // \keybin@ checks for the following:
  "+": "\\dotsb",
  "=": "\\dotsb",
  "<": "\\dotsb",
  ">": "\\dotsb",
  "-": "\\dotsb",
  "*": "\\dotsb",
  ":": "\\dotsb",
  // Symbols whose definition starts with \DOTSB:
  "\\DOTSB": "\\dotsb",
  "\\coprod": "\\dotsb",
  "\\bigvee": "\\dotsb",
  "\\bigwedge": "\\dotsb",
  "\\biguplus": "\\dotsb",
  "\\bigcap": "\\dotsb",
  "\\bigcup": "\\dotsb",
  "\\prod": "\\dotsb",
  "\\sum": "\\dotsb",
  "\\bigotimes": "\\dotsb",
  "\\bigoplus": "\\dotsb",
  "\\bigodot": "\\dotsb",
  "\\bigsqcup": "\\dotsb",
  "\\And": "\\dotsb",
  "\\longrightarrow": "\\dotsb",
  "\\Longrightarrow": "\\dotsb",
  "\\longleftarrow": "\\dotsb",
  "\\Longleftarrow": "\\dotsb",
  "\\longleftrightarrow": "\\dotsb",
  "\\Longleftrightarrow": "\\dotsb",
  "\\mapsto": "\\dotsb",
  "\\longmapsto": "\\dotsb",
  "\\hookrightarrow": "\\dotsb",
  "\\doteq": "\\dotsb",
  // Symbols whose definition starts with \mathbin:
  "\\mathbin": "\\dotsb",
  // Symbols whose definition starts with \mathrel:
  "\\mathrel": "\\dotsb",
  "\\relbar": "\\dotsb",
  "\\Relbar": "\\dotsb",
  "\\xrightarrow": "\\dotsb",
  "\\xleftarrow": "\\dotsb",
  // Symbols whose definition starts with \DOTSI:
  "\\DOTSI": "\\dotsi",
  "\\int": "\\dotsi",
  "\\oint": "\\dotsi",
  "\\iint": "\\dotsi",
  "\\iiint": "\\dotsi",
  "\\iiiint": "\\dotsi",
  "\\idotsint": "\\dotsi",
  // Symbols whose definition starts with \DOTSX:
  "\\DOTSX": "\\dotsx"
};
defineMacro("\\dots", function(s) {
  var e = "\\dotso", r = s.expandAfterFuture().text;
  return r in dotsByToken ? e = dotsByToken[r] : (r.slice(0, 4) === "\\not" || r in symbols.math && utils.contains(["bin", "rel"], symbols.math[r].group)) && (e = "\\dotsb"), e;
});
var spaceAfterDots = {
  // \rightdelim@ checks for the following:
  ")": !0,
  "]": !0,
  "\\rbrack": !0,
  "\\}": !0,
  "\\rbrace": !0,
  "\\rangle": !0,
  "\\rceil": !0,
  "\\rfloor": !0,
  "\\rgroup": !0,
  "\\rmoustache": !0,
  "\\right": !0,
  "\\bigr": !0,
  "\\biggr": !0,
  "\\Bigr": !0,
  "\\Biggr": !0,
  // \extra@ also tests for the following:
  $: !0,
  // \extrap@ checks for the following:
  ";": !0,
  ".": !0,
  ",": !0
};
defineMacro("\\dotso", function(s) {
  var e = s.future().text;
  return e in spaceAfterDots ? "\\ldots\\," : "\\ldots";
});
defineMacro("\\dotsc", function(s) {
  var e = s.future().text;
  return e in spaceAfterDots && e !== "," ? "\\ldots\\," : "\\ldots";
});
defineMacro("\\cdots", function(s) {
  var e = s.future().text;
  return e in spaceAfterDots ? "\\@cdots\\," : "\\@cdots";
});
defineMacro("\\dotsb", "\\cdots");
defineMacro("\\dotsm", "\\cdots");
defineMacro("\\dotsi", "\\!\\cdots");
defineMacro("\\dotsx", "\\ldots\\,");
defineMacro("\\DOTSI", "\\relax");
defineMacro("\\DOTSB", "\\relax");
defineMacro("\\DOTSX", "\\relax");
defineMacro("\\tmspace", "\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");
defineMacro("\\,", "\\tmspace+{3mu}{.1667em}");
defineMacro("\\thinspace", "\\,");
defineMacro("\\>", "\\mskip{4mu}");
defineMacro("\\:", "\\tmspace+{4mu}{.2222em}");
defineMacro("\\medspace", "\\:");
defineMacro("\\;", "\\tmspace+{5mu}{.2777em}");
defineMacro("\\thickspace", "\\;");
defineMacro("\\!", "\\tmspace-{3mu}{.1667em}");
defineMacro("\\negthinspace", "\\!");
defineMacro("\\negmedspace", "\\tmspace-{4mu}{.2222em}");
defineMacro("\\negthickspace", "\\tmspace-{5mu}{.277em}");
defineMacro("\\enspace", "\\kern.5em ");
defineMacro("\\enskip", "\\hskip.5em\\relax");
defineMacro("\\quad", "\\hskip1em\\relax");
defineMacro("\\qquad", "\\hskip2em\\relax");
defineMacro("\\tag", "\\@ifstar\\tag@literal\\tag@paren");
defineMacro("\\tag@paren", "\\tag@literal{({#1})}");
defineMacro("\\tag@literal", (s) => {
  if (s.macros.get("\\df@tag"))
    throw new ParseError("Multiple \\tag");
  return "\\gdef\\df@tag{\\text{#1}}";
});
defineMacro("\\bmod", "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");
defineMacro("\\pod", "\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");
defineMacro("\\pmod", "\\pod{{\\rm mod}\\mkern6mu#1}");
defineMacro("\\mod", "\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");
defineMacro("\\newline", "\\\\\\relax");
defineMacro("\\TeX", "\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");
var latexRaiseA = makeEm(fontMetricsData["Main-Regular"][84][1] - 0.7 * fontMetricsData["Main-Regular"][65][1]);
defineMacro("\\LaTeX", "\\textrm{\\html@mathml{" + ("L\\kern-.36em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{LaTeX}}");
defineMacro("\\KaTeX", "\\textrm{\\html@mathml{" + ("K\\kern-.17em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{KaTeX}}");
defineMacro("\\hspace", "\\@ifstar\\@hspacer\\@hspace");
defineMacro("\\@hspace", "\\hskip #1\\relax");
defineMacro("\\@hspacer", "\\rule{0pt}{0pt}\\hskip #1\\relax");
defineMacro("\\ordinarycolon", ":");
defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}");
defineMacro("\\dblcolon", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');
defineMacro("\\coloneqq", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');
defineMacro("\\Coloneqq", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');
defineMacro("\\coloneq", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');
defineMacro("\\Coloneq", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');
defineMacro("\\eqqcolon", '\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');
defineMacro("\\Eqqcolon", '\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');
defineMacro("\\eqcolon", '\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');
defineMacro("\\Eqcolon", '\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');
defineMacro("\\colonapprox", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');
defineMacro("\\Colonapprox", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');
defineMacro("\\colonsim", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');
defineMacro("\\Colonsim", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');
defineMacro("∷", "\\dblcolon");
defineMacro("∹", "\\eqcolon");
defineMacro("≔", "\\coloneqq");
defineMacro("≕", "\\eqqcolon");
defineMacro("⩴", "\\Coloneqq");
defineMacro("\\ratio", "\\vcentcolon");
defineMacro("\\coloncolon", "\\dblcolon");
defineMacro("\\colonequals", "\\coloneqq");
defineMacro("\\coloncolonequals", "\\Coloneqq");
defineMacro("\\equalscolon", "\\eqqcolon");
defineMacro("\\equalscoloncolon", "\\Eqqcolon");
defineMacro("\\colonminus", "\\coloneq");
defineMacro("\\coloncolonminus", "\\Coloneq");
defineMacro("\\minuscolon", "\\eqcolon");
defineMacro("\\minuscoloncolon", "\\Eqcolon");
defineMacro("\\coloncolonapprox", "\\Colonapprox");
defineMacro("\\coloncolonsim", "\\Colonsim");
defineMacro("\\simcolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");
defineMacro("\\simcoloncolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");
defineMacro("\\approxcolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");
defineMacro("\\approxcoloncolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");
defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");
defineMacro("\\limsup", "\\DOTSB\\operatorname*{lim\\,sup}");
defineMacro("\\liminf", "\\DOTSB\\operatorname*{lim\\,inf}");
defineMacro("\\injlim", "\\DOTSB\\operatorname*{inj\\,lim}");
defineMacro("\\projlim", "\\DOTSB\\operatorname*{proj\\,lim}");
defineMacro("\\varlimsup", "\\DOTSB\\operatorname*{\\overline{lim}}");
defineMacro("\\varliminf", "\\DOTSB\\operatorname*{\\underline{lim}}");
defineMacro("\\varinjlim", "\\DOTSB\\operatorname*{\\underrightarrow{lim}}");
defineMacro("\\varprojlim", "\\DOTSB\\operatorname*{\\underleftarrow{lim}}");
defineMacro("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{≩}");
defineMacro("\\lvertneqq", "\\html@mathml{\\@lvertneqq}{≨}");
defineMacro("\\ngeqq", "\\html@mathml{\\@ngeqq}{≱}");
defineMacro("\\ngeqslant", "\\html@mathml{\\@ngeqslant}{≱}");
defineMacro("\\nleqq", "\\html@mathml{\\@nleqq}{≰}");
defineMacro("\\nleqslant", "\\html@mathml{\\@nleqslant}{≰}");
defineMacro("\\nshortmid", "\\html@mathml{\\@nshortmid}{∤}");
defineMacro("\\nshortparallel", "\\html@mathml{\\@nshortparallel}{∦}");
defineMacro("\\nsubseteqq", "\\html@mathml{\\@nsubseteqq}{⊈}");
defineMacro("\\nsupseteqq", "\\html@mathml{\\@nsupseteqq}{⊉}");
defineMacro("\\varsubsetneq", "\\html@mathml{\\@varsubsetneq}{⊊}");
defineMacro("\\varsubsetneqq", "\\html@mathml{\\@varsubsetneqq}{⫋}");
defineMacro("\\varsupsetneq", "\\html@mathml{\\@varsupsetneq}{⊋}");
defineMacro("\\varsupsetneqq", "\\html@mathml{\\@varsupsetneqq}{⫌}");
defineMacro("\\imath", "\\html@mathml{\\@imath}{ı}");
defineMacro("\\jmath", "\\html@mathml{\\@jmath}{ȷ}");
defineMacro("\\llbracket", "\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");
defineMacro("\\rrbracket", "\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");
defineMacro("⟦", "\\llbracket");
defineMacro("⟧", "\\rrbracket");
defineMacro("\\lBrace", "\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");
defineMacro("\\rBrace", "\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");
defineMacro("⦃", "\\lBrace");
defineMacro("⦄", "\\rBrace");
defineMacro("\\minuso", "\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");
defineMacro("⦵", "\\minuso");
defineMacro("\\darr", "\\downarrow");
defineMacro("\\dArr", "\\Downarrow");
defineMacro("\\Darr", "\\Downarrow");
defineMacro("\\lang", "\\langle");
defineMacro("\\rang", "\\rangle");
defineMacro("\\uarr", "\\uparrow");
defineMacro("\\uArr", "\\Uparrow");
defineMacro("\\Uarr", "\\Uparrow");
defineMacro("\\N", "\\mathbb{N}");
defineMacro("\\R", "\\mathbb{R}");
defineMacro("\\Z", "\\mathbb{Z}");
defineMacro("\\alef", "\\aleph");
defineMacro("\\alefsym", "\\aleph");
defineMacro("\\Alpha", "\\mathrm{A}");
defineMacro("\\Beta", "\\mathrm{B}");
defineMacro("\\bull", "\\bullet");
defineMacro("\\Chi", "\\mathrm{X}");
defineMacro("\\clubs", "\\clubsuit");
defineMacro("\\cnums", "\\mathbb{C}");
defineMacro("\\Complex", "\\mathbb{C}");
defineMacro("\\Dagger", "\\ddagger");
defineMacro("\\diamonds", "\\diamondsuit");
defineMacro("\\empty", "\\emptyset");
defineMacro("\\Epsilon", "\\mathrm{E}");
defineMacro("\\Eta", "\\mathrm{H}");
defineMacro("\\exist", "\\exists");
defineMacro("\\harr", "\\leftrightarrow");
defineMacro("\\hArr", "\\Leftrightarrow");
defineMacro("\\Harr", "\\Leftrightarrow");
defineMacro("\\hearts", "\\heartsuit");
defineMacro("\\image", "\\Im");
defineMacro("\\infin", "\\infty");
defineMacro("\\Iota", "\\mathrm{I}");
defineMacro("\\isin", "\\in");
defineMacro("\\Kappa", "\\mathrm{K}");
defineMacro("\\larr", "\\leftarrow");
defineMacro("\\lArr", "\\Leftarrow");
defineMacro("\\Larr", "\\Leftarrow");
defineMacro("\\lrarr", "\\leftrightarrow");
defineMacro("\\lrArr", "\\Leftrightarrow");
defineMacro("\\Lrarr", "\\Leftrightarrow");
defineMacro("\\Mu", "\\mathrm{M}");
defineMacro("\\natnums", "\\mathbb{N}");
defineMacro("\\Nu", "\\mathrm{N}");
defineMacro("\\Omicron", "\\mathrm{O}");
defineMacro("\\plusmn", "\\pm");
defineMacro("\\rarr", "\\rightarrow");
defineMacro("\\rArr", "\\Rightarrow");
defineMacro("\\Rarr", "\\Rightarrow");
defineMacro("\\real", "\\Re");
defineMacro("\\reals", "\\mathbb{R}");
defineMacro("\\Reals", "\\mathbb{R}");
defineMacro("\\Rho", "\\mathrm{P}");
defineMacro("\\sdot", "\\cdot");
defineMacro("\\sect", "\\S");
defineMacro("\\spades", "\\spadesuit");
defineMacro("\\sub", "\\subset");
defineMacro("\\sube", "\\subseteq");
defineMacro("\\supe", "\\supseteq");
defineMacro("\\Tau", "\\mathrm{T}");
defineMacro("\\thetasym", "\\vartheta");
defineMacro("\\weierp", "\\wp");
defineMacro("\\Zeta", "\\mathrm{Z}");
defineMacro("\\argmin", "\\DOTSB\\operatorname*{arg\\,min}");
defineMacro("\\argmax", "\\DOTSB\\operatorname*{arg\\,max}");
defineMacro("\\plim", "\\DOTSB\\mathop{\\operatorname{plim}}\\limits");
defineMacro("\\bra", "\\mathinner{\\langle{#1}|}");
defineMacro("\\ket", "\\mathinner{|{#1}\\rangle}");
defineMacro("\\braket", "\\mathinner{\\langle{#1}\\rangle}");
defineMacro("\\Bra", "\\left\\langle#1\\right|");
defineMacro("\\Ket", "\\left|#1\\right\\rangle");
var braketHelper = (s) => (e) => {
  var r = e.consumeArg().tokens, o = e.consumeArg().tokens, m = e.consumeArg().tokens, _ = e.consumeArg().tokens, g = e.macros.get("|"), y = e.macros.get("\\|");
  e.macros.beginGroup();
  var E = (h) => (a) => {
    s && (a.macros.set("|", g), m.length && a.macros.set("\\|", y));
    var b = h;
    if (!h && m.length) {
      var w = a.future();
      w.text === "|" && (a.popToken(), b = !0);
    }
    return {
      tokens: b ? m : o,
      numArgs: 0
    };
  };
  e.macros.set("|", E(!1)), m.length && e.macros.set("\\|", E(!0));
  var x = e.consumeArg().tokens, v = e.expandTokens([
    ..._,
    ...x,
    ...r
    // reversed
  ]);
  return e.macros.endGroup(), {
    tokens: v.reverse(),
    numArgs: 0
  };
};
defineMacro("\\bra@ket", braketHelper(!1));
defineMacro("\\bra@set", braketHelper(!0));
defineMacro("\\Braket", "\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");
defineMacro("\\Set", "\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");
defineMacro("\\set", "\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");
defineMacro("\\angln", "{\\angl n}");
defineMacro("\\blue", "\\textcolor{##6495ed}{#1}");
defineMacro("\\orange", "\\textcolor{##ffa500}{#1}");
defineMacro("\\pink", "\\textcolor{##ff00af}{#1}");
defineMacro("\\red", "\\textcolor{##df0030}{#1}");
defineMacro("\\green", "\\textcolor{##28ae7b}{#1}");
defineMacro("\\gray", "\\textcolor{gray}{#1}");
defineMacro("\\purple", "\\textcolor{##9d38bd}{#1}");
defineMacro("\\blueA", "\\textcolor{##ccfaff}{#1}");
defineMacro("\\blueB", "\\textcolor{##80f6ff}{#1}");
defineMacro("\\blueC", "\\textcolor{##63d9ea}{#1}");
defineMacro("\\blueD", "\\textcolor{##11accd}{#1}");
defineMacro("\\blueE", "\\textcolor{##0c7f99}{#1}");
defineMacro("\\tealA", "\\textcolor{##94fff5}{#1}");
defineMacro("\\tealB", "\\textcolor{##26edd5}{#1}");
defineMacro("\\tealC", "\\textcolor{##01d1c1}{#1}");
defineMacro("\\tealD", "\\textcolor{##01a995}{#1}");
defineMacro("\\tealE", "\\textcolor{##208170}{#1}");
defineMacro("\\greenA", "\\textcolor{##b6ffb0}{#1}");
defineMacro("\\greenB", "\\textcolor{##8af281}{#1}");
defineMacro("\\greenC", "\\textcolor{##74cf70}{#1}");
defineMacro("\\greenD", "\\textcolor{##1fab54}{#1}");
defineMacro("\\greenE", "\\textcolor{##0d923f}{#1}");
defineMacro("\\goldA", "\\textcolor{##ffd0a9}{#1}");
defineMacro("\\goldB", "\\textcolor{##ffbb71}{#1}");
defineMacro("\\goldC", "\\textcolor{##ff9c39}{#1}");
defineMacro("\\goldD", "\\textcolor{##e07d10}{#1}");
defineMacro("\\goldE", "\\textcolor{##a75a05}{#1}");
defineMacro("\\redA", "\\textcolor{##fca9a9}{#1}");
defineMacro("\\redB", "\\textcolor{##ff8482}{#1}");
defineMacro("\\redC", "\\textcolor{##f9685d}{#1}");
defineMacro("\\redD", "\\textcolor{##e84d39}{#1}");
defineMacro("\\redE", "\\textcolor{##bc2612}{#1}");
defineMacro("\\maroonA", "\\textcolor{##ffbde0}{#1}");
defineMacro("\\maroonB", "\\textcolor{##ff92c6}{#1}");
defineMacro("\\maroonC", "\\textcolor{##ed5fa6}{#1}");
defineMacro("\\maroonD", "\\textcolor{##ca337c}{#1}");
defineMacro("\\maroonE", "\\textcolor{##9e034e}{#1}");
defineMacro("\\purpleA", "\\textcolor{##ddd7ff}{#1}");
defineMacro("\\purpleB", "\\textcolor{##c6b9fc}{#1}");
defineMacro("\\purpleC", "\\textcolor{##aa87ff}{#1}");
defineMacro("\\purpleD", "\\textcolor{##7854ab}{#1}");
defineMacro("\\purpleE", "\\textcolor{##543b78}{#1}");
defineMacro("\\mintA", "\\textcolor{##f5f9e8}{#1}");
defineMacro("\\mintB", "\\textcolor{##edf2df}{#1}");
defineMacro("\\mintC", "\\textcolor{##e0e5cc}{#1}");
defineMacro("\\grayA", "\\textcolor{##f6f7f7}{#1}");
defineMacro("\\grayB", "\\textcolor{##f0f1f2}{#1}");
defineMacro("\\grayC", "\\textcolor{##e3e5e6}{#1}");
defineMacro("\\grayD", "\\textcolor{##d6d8da}{#1}");
defineMacro("\\grayE", "\\textcolor{##babec2}{#1}");
defineMacro("\\grayF", "\\textcolor{##888d93}{#1}");
defineMacro("\\grayG", "\\textcolor{##626569}{#1}");
defineMacro("\\grayH", "\\textcolor{##3b3e40}{#1}");
defineMacro("\\grayI", "\\textcolor{##21242c}{#1}");
defineMacro("\\kaBlue", "\\textcolor{##314453}{#1}");
defineMacro("\\kaGreen", "\\textcolor{##71B307}{#1}");
var implicitCommands = {
  "^": !0,
  // Parser.js
  _: !0,
  // Parser.js
  "\\limits": !0,
  // Parser.js
  "\\nolimits": !0
  // Parser.js
};
class MacroExpander {
  constructor(e, r, o) {
    this.settings = void 0, this.expansionCount = void 0, this.lexer = void 0, this.macros = void 0, this.stack = void 0, this.mode = void 0, this.settings = r, this.expansionCount = 0, this.feed(e), this.macros = new Namespace(macros, r.macros), this.mode = o, this.stack = [];
  }
  /**
   * Feed a new input string to the same MacroExpander
   * (with existing macros etc.).
   */
  feed(e) {
    this.lexer = new Lexer(e, this.settings);
  }
  /**
   * Switches between "text" and "math" modes.
   */
  switchMode(e) {
    this.mode = e;
  }
  /**
   * Start a new group nesting within all namespaces.
   */
  beginGroup() {
    this.macros.beginGroup();
  }
  /**
   * End current group nesting within all namespaces.
   */
  endGroup() {
    this.macros.endGroup();
  }
  /**
   * Ends all currently nested groups (if any), restoring values before the
   * groups began.  Useful in case of an error in the middle of parsing.
   */
  endGroups() {
    this.macros.endGroups();
  }
  /**
   * Returns the topmost token on the stack, without expanding it.
   * Similar in behavior to TeX's `\futurelet`.
   */
  future() {
    return this.stack.length === 0 && this.pushToken(this.lexer.lex()), this.stack[this.stack.length - 1];
  }
  /**
   * Remove and return the next unexpanded token.
   */
  popToken() {
    return this.future(), this.stack.pop();
  }
  /**
   * Add a given token to the token stack.  In particular, this get be used
   * to put back a token returned from one of the other methods.
   */
  pushToken(e) {
    this.stack.push(e);
  }
  /**
   * Append an array of tokens to the token stack.
   */
  pushTokens(e) {
    this.stack.push(...e);
  }
  /**
   * Find an macro argument without expanding tokens and append the array of
   * tokens to the token stack. Uses Token as a container for the result.
   */
  scanArgument(e) {
    var r, o, m;
    if (e) {
      if (this.consumeSpaces(), this.future().text !== "[")
        return null;
      r = this.popToken(), {
        tokens: m,
        end: o
      } = this.consumeArg(["]"]);
    } else
      ({
        tokens: m,
        start: r,
        end: o
      } = this.consumeArg());
    return this.pushToken(new Token$1("EOF", o.loc)), this.pushTokens(m), r.range(o, "");
  }
  /**
   * Consume all following space tokens, without expansion.
   */
  consumeSpaces() {
    for (; ; ) {
      var e = this.future();
      if (e.text === " ")
        this.stack.pop();
      else
        break;
    }
  }
  /**
   * Consume an argument from the token stream, and return the resulting array
   * of tokens and start/end token.
   */
  consumeArg(e) {
    var r = [], o = e && e.length > 0;
    o || this.consumeSpaces();
    var m = this.future(), _, g = 0, y = 0;
    do {
      if (_ = this.popToken(), r.push(_), _.text === "{")
        ++g;
      else if (_.text === "}") {
        if (--g, g === -1)
          throw new ParseError("Extra }", _);
      } else if (_.text === "EOF")
        throw new ParseError("Unexpected end of input in a macro argument, expected '" + (e && o ? e[y] : "}") + "'", _);
      if (e && o)
        if ((g === 0 || g === 1 && e[y] === "{") && _.text === e[y]) {
          if (++y, y === e.length) {
            r.splice(-y, y);
            break;
          }
        } else
          y = 0;
    } while (g !== 0 || o);
    return m.text === "{" && r[r.length - 1].text === "}" && (r.pop(), r.shift()), r.reverse(), {
      tokens: r,
      start: m,
      end: _
    };
  }
  /**
   * Consume the specified number of (delimited) arguments from the token
   * stream and return the resulting array of arguments.
   */
  consumeArgs(e, r) {
    if (r) {
      if (r.length !== e + 1)
        throw new ParseError("The length of delimiters doesn't match the number of args!");
      for (var o = r[0], m = 0; m < o.length; m++) {
        var _ = this.popToken();
        if (o[m] !== _.text)
          throw new ParseError("Use of the macro doesn't match its definition", _);
      }
    }
    for (var g = [], y = 0; y < e; y++)
      g.push(this.consumeArg(r && r[y + 1]).tokens);
    return g;
  }
  /**
   * Increment `expansionCount` by the specified amount.
   * Throw an error if it exceeds `maxExpand`.
   */
  countExpansion(e) {
    if (this.expansionCount += e, this.expansionCount > this.settings.maxExpand)
      throw new ParseError("Too many expansions: infinite loop or need to increase maxExpand setting");
  }
  /**
   * Expand the next token only once if possible.
   *
   * If the token is expanded, the resulting tokens will be pushed onto
   * the stack in reverse order, and the number of such tokens will be
   * returned.  This number might be zero or positive.
   *
   * If not, the return value is `false`, and the next token remains at the
   * top of the stack.
   *
   * In either case, the next token will be on the top of the stack,
   * or the stack will be empty (in case of empty expansion
   * and no other tokens).
   *
   * Used to implement `expandAfterFuture` and `expandNextToken`.
   *
   * If expandableOnly, only expandable tokens are expanded and
   * an undefined control sequence results in an error.
   */
  expandOnce(e) {
    var r = this.popToken(), o = r.text, m = r.noexpand ? null : this._getExpansion(o);
    if (m == null || e && m.unexpandable) {
      if (e && m == null && o[0] === "\\" && !this.isDefined(o))
        throw new ParseError("Undefined control sequence: " + o);
      return this.pushToken(r), !1;
    }
    this.countExpansion(1);
    var _ = m.tokens, g = this.consumeArgs(m.numArgs, m.delimiters);
    if (m.numArgs) {
      _ = _.slice();
      for (var y = _.length - 1; y >= 0; --y) {
        var E = _[y];
        if (E.text === "#") {
          if (y === 0)
            throw new ParseError("Incomplete placeholder at end of macro body", E);
          if (E = _[--y], E.text === "#")
            _.splice(y + 1, 1);
          else if (/^[1-9]$/.test(E.text))
            _.splice(y, 2, ...g[+E.text - 1]);
          else
            throw new ParseError("Not a valid argument number", E);
        }
      }
    }
    return this.pushTokens(_), _.length;
  }
  /**
   * Expand the next token only once (if possible), and return the resulting
   * top token on the stack (without removing anything from the stack).
   * Similar in behavior to TeX's `\expandafter\futurelet`.
   * Equivalent to expandOnce() followed by future().
   */
  expandAfterFuture() {
    return this.expandOnce(), this.future();
  }
  /**
   * Recursively expand first token, then return first non-expandable token.
   */
  expandNextToken() {
    for (; ; )
      if (this.expandOnce() === !1) {
        var e = this.stack.pop();
        return e.treatAsRelax && (e.text = "\\relax"), e;
      }
    throw new Error();
  }
  /**
   * Fully expand the given macro name and return the resulting list of
   * tokens, or return `undefined` if no such macro is defined.
   */
  expandMacro(e) {
    return this.macros.has(e) ? this.expandTokens([new Token$1(e)]) : void 0;
  }
  /**
   * Fully expand the given token stream and return the resulting list of
   * tokens.  Note that the input tokens are in reverse order, but the
   * output tokens are in forward order.
   */
  expandTokens(e) {
    var r = [], o = this.stack.length;
    for (this.pushTokens(e); this.stack.length > o; )
      if (this.expandOnce(!0) === !1) {
        var m = this.stack.pop();
        m.treatAsRelax && (m.noexpand = !1, m.treatAsRelax = !1), r.push(m);
      }
    return this.countExpansion(r.length), r;
  }
  /**
   * Fully expand the given macro name and return the result as a string,
   * or return `undefined` if no such macro is defined.
   */
  expandMacroAsText(e) {
    var r = this.expandMacro(e);
    return r && r.map((o) => o.text).join("");
  }
  /**
   * Returns the expanded macro as a reversed array of tokens and a macro
   * argument count.  Or returns `null` if no such macro.
   */
  _getExpansion(e) {
    var r = this.macros.get(e);
    if (r == null)
      return r;
    if (e.length === 1) {
      var o = this.lexer.catcodes[e];
      if (o != null && o !== 13)
        return;
    }
    var m = typeof r == "function" ? r(this) : r;
    if (typeof m == "string") {
      var _ = 0;
      if (m.indexOf("#") !== -1)
        for (var g = m.replace(/##/g, ""); g.indexOf("#" + (_ + 1)) !== -1; )
          ++_;
      for (var y = new Lexer(m, this.settings), E = [], x = y.lex(); x.text !== "EOF"; )
        E.push(x), x = y.lex();
      E.reverse();
      var v = {
        tokens: E,
        numArgs: _
      };
      return v;
    }
    return m;
  }
  /**
   * Determine whether a command is currently "defined" (has some
   * functionality), meaning that it's a macro (in the current group),
   * a function, a symbol, or one of the special commands listed in
   * `implicitCommands`.
   */
  isDefined(e) {
    return this.macros.has(e) || functions.hasOwnProperty(e) || symbols.math.hasOwnProperty(e) || symbols.text.hasOwnProperty(e) || implicitCommands.hasOwnProperty(e);
  }
  /**
   * Determine whether a command is expandable.
   */
  isExpandable(e) {
    var r = this.macros.get(e);
    return r != null ? typeof r == "string" || typeof r == "function" || !r.unexpandable : functions.hasOwnProperty(e) && !functions[e].primitive;
  }
}
var unicodeSubRegEx = /^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/, uSubsAndSups = Object.freeze({
  "₊": "+",
  "₋": "-",
  "₌": "=",
  "₍": "(",
  "₎": ")",
  "₀": "0",
  "₁": "1",
  "₂": "2",
  "₃": "3",
  "₄": "4",
  "₅": "5",
  "₆": "6",
  "₇": "7",
  "₈": "8",
  "₉": "9",
  "ₐ": "a",
  "ₑ": "e",
  "ₕ": "h",
  "ᵢ": "i",
  "ⱼ": "j",
  "ₖ": "k",
  "ₗ": "l",
  "ₘ": "m",
  "ₙ": "n",
  "ₒ": "o",
  "ₚ": "p",
  "ᵣ": "r",
  "ₛ": "s",
  "ₜ": "t",
  "ᵤ": "u",
  "ᵥ": "v",
  "ₓ": "x",
  "ᵦ": "β",
  "ᵧ": "γ",
  "ᵨ": "ρ",
  "ᵩ": "ϕ",
  "ᵪ": "χ",
  "⁺": "+",
  "⁻": "-",
  "⁼": "=",
  "⁽": "(",
  "⁾": ")",
  "⁰": "0",
  "¹": "1",
  "²": "2",
  "³": "3",
  "⁴": "4",
  "⁵": "5",
  "⁶": "6",
  "⁷": "7",
  "⁸": "8",
  "⁹": "9",
  "ᴬ": "A",
  "ᴮ": "B",
  "ᴰ": "D",
  "ᴱ": "E",
  "ᴳ": "G",
  "ᴴ": "H",
  "ᴵ": "I",
  "ᴶ": "J",
  "ᴷ": "K",
  "ᴸ": "L",
  "ᴹ": "M",
  "ᴺ": "N",
  "ᴼ": "O",
  "ᴾ": "P",
  "ᴿ": "R",
  "ᵀ": "T",
  "ᵁ": "U",
  "ⱽ": "V",
  "ᵂ": "W",
  "ᵃ": "a",
  "ᵇ": "b",
  "ᶜ": "c",
  "ᵈ": "d",
  "ᵉ": "e",
  "ᶠ": "f",
  "ᵍ": "g",
  ʰ: "h",
  "ⁱ": "i",
  ʲ: "j",
  "ᵏ": "k",
  ˡ: "l",
  "ᵐ": "m",
  ⁿ: "n",
  "ᵒ": "o",
  "ᵖ": "p",
  ʳ: "r",
  ˢ: "s",
  "ᵗ": "t",
  "ᵘ": "u",
  "ᵛ": "v",
  ʷ: "w",
  ˣ: "x",
  ʸ: "y",
  "ᶻ": "z",
  "ᵝ": "β",
  "ᵞ": "γ",
  "ᵟ": "δ",
  "ᵠ": "ϕ",
  "ᵡ": "χ",
  "ᶿ": "θ"
}), unicodeAccents = {
  "́": {
    text: "\\'",
    math: "\\acute"
  },
  "̀": {
    text: "\\`",
    math: "\\grave"
  },
  "̈": {
    text: '\\"',
    math: "\\ddot"
  },
  "̃": {
    text: "\\~",
    math: "\\tilde"
  },
  "̄": {
    text: "\\=",
    math: "\\bar"
  },
  "̆": {
    text: "\\u",
    math: "\\breve"
  },
  "̌": {
    text: "\\v",
    math: "\\check"
  },
  "̂": {
    text: "\\^",
    math: "\\hat"
  },
  "̇": {
    text: "\\.",
    math: "\\dot"
  },
  "̊": {
    text: "\\r",
    math: "\\mathring"
  },
  "̋": {
    text: "\\H"
  },
  "̧": {
    text: "\\c"
  }
}, unicodeSymbols = {
  á: "á",
  à: "à",
  ä: "ä",
  ǟ: "ǟ",
  ã: "ã",
  ā: "ā",
  ă: "ă",
  ắ: "ắ",
  ằ: "ằ",
  ẵ: "ẵ",
  ǎ: "ǎ",
  â: "â",
  ấ: "ấ",
  ầ: "ầ",
  ẫ: "ẫ",
  ȧ: "ȧ",
  ǡ: "ǡ",
  å: "å",
  ǻ: "ǻ",
  ḃ: "ḃ",
  ć: "ć",
  ḉ: "ḉ",
  č: "č",
  ĉ: "ĉ",
  ċ: "ċ",
  ç: "ç",
  ď: "ď",
  ḋ: "ḋ",
  ḑ: "ḑ",
  é: "é",
  è: "è",
  ë: "ë",
  ẽ: "ẽ",
  ē: "ē",
  ḗ: "ḗ",
  ḕ: "ḕ",
  ĕ: "ĕ",
  ḝ: "ḝ",
  ě: "ě",
  ê: "ê",
  ế: "ế",
  ề: "ề",
  ễ: "ễ",
  ė: "ė",
  ȩ: "ȩ",
  ḟ: "ḟ",
  ǵ: "ǵ",
  ḡ: "ḡ",
  ğ: "ğ",
  ǧ: "ǧ",
  ĝ: "ĝ",
  ġ: "ġ",
  ģ: "ģ",
  ḧ: "ḧ",
  ȟ: "ȟ",
  ĥ: "ĥ",
  ḣ: "ḣ",
  ḩ: "ḩ",
  í: "í",
  ì: "ì",
  ï: "ï",
  ḯ: "ḯ",
  ĩ: "ĩ",
  ī: "ī",
  ĭ: "ĭ",
  ǐ: "ǐ",
  î: "î",
  ǰ: "ǰ",
  ĵ: "ĵ",
  ḱ: "ḱ",
  ǩ: "ǩ",
  ķ: "ķ",
  ĺ: "ĺ",
  ľ: "ľ",
  ļ: "ļ",
  ḿ: "ḿ",
  ṁ: "ṁ",
  ń: "ń",
  ǹ: "ǹ",
  ñ: "ñ",
  ň: "ň",
  ṅ: "ṅ",
  ņ: "ņ",
  ó: "ó",
  ò: "ò",
  ö: "ö",
  ȫ: "ȫ",
  õ: "õ",
  ṍ: "ṍ",
  ṏ: "ṏ",
  ȭ: "ȭ",
  ō: "ō",
  ṓ: "ṓ",
  ṑ: "ṑ",
  ŏ: "ŏ",
  ǒ: "ǒ",
  ô: "ô",
  ố: "ố",
  ồ: "ồ",
  ỗ: "ỗ",
  ȯ: "ȯ",
  ȱ: "ȱ",
  ő: "ő",
  ṕ: "ṕ",
  ṗ: "ṗ",
  ŕ: "ŕ",
  ř: "ř",
  ṙ: "ṙ",
  ŗ: "ŗ",
  ś: "ś",
  ṥ: "ṥ",
  š: "š",
  ṧ: "ṧ",
  ŝ: "ŝ",
  ṡ: "ṡ",
  ş: "ş",
  ẗ: "ẗ",
  ť: "ť",
  ṫ: "ṫ",
  ţ: "ţ",
  ú: "ú",
  ù: "ù",
  ü: "ü",
  ǘ: "ǘ",
  ǜ: "ǜ",
  ǖ: "ǖ",
  ǚ: "ǚ",
  ũ: "ũ",
  ṹ: "ṹ",
  ū: "ū",
  ṻ: "ṻ",
  ŭ: "ŭ",
  ǔ: "ǔ",
  û: "û",
  ů: "ů",
  ű: "ű",
  ṽ: "ṽ",
  ẃ: "ẃ",
  ẁ: "ẁ",
  ẅ: "ẅ",
  ŵ: "ŵ",
  ẇ: "ẇ",
  ẘ: "ẘ",
  ẍ: "ẍ",
  ẋ: "ẋ",
  ý: "ý",
  ỳ: "ỳ",
  ÿ: "ÿ",
  ỹ: "ỹ",
  ȳ: "ȳ",
  ŷ: "ŷ",
  ẏ: "ẏ",
  ẙ: "ẙ",
  ź: "ź",
  ž: "ž",
  ẑ: "ẑ",
  ż: "ż",
  Á: "Á",
  À: "À",
  Ä: "Ä",
  Ǟ: "Ǟ",
  Ã: "Ã",
  Ā: "Ā",
  Ă: "Ă",
  Ắ: "Ắ",
  Ằ: "Ằ",
  Ẵ: "Ẵ",
  Ǎ: "Ǎ",
  Â: "Â",
  Ấ: "Ấ",
  Ầ: "Ầ",
  Ẫ: "Ẫ",
  Ȧ: "Ȧ",
  Ǡ: "Ǡ",
  Å: "Å",
  Ǻ: "Ǻ",
  Ḃ: "Ḃ",
  Ć: "Ć",
  Ḉ: "Ḉ",
  Č: "Č",
  Ĉ: "Ĉ",
  Ċ: "Ċ",
  Ç: "Ç",
  Ď: "Ď",
  Ḋ: "Ḋ",
  Ḑ: "Ḑ",
  É: "É",
  È: "È",
  Ë: "Ë",
  Ẽ: "Ẽ",
  Ē: "Ē",
  Ḗ: "Ḗ",
  Ḕ: "Ḕ",
  Ĕ: "Ĕ",
  Ḝ: "Ḝ",
  Ě: "Ě",
  Ê: "Ê",
  Ế: "Ế",
  Ề: "Ề",
  Ễ: "Ễ",
  Ė: "Ė",
  Ȩ: "Ȩ",
  Ḟ: "Ḟ",
  Ǵ: "Ǵ",
  Ḡ: "Ḡ",
  Ğ: "Ğ",
  Ǧ: "Ǧ",
  Ĝ: "Ĝ",
  Ġ: "Ġ",
  Ģ: "Ģ",
  Ḧ: "Ḧ",
  Ȟ: "Ȟ",
  Ĥ: "Ĥ",
  Ḣ: "Ḣ",
  Ḩ: "Ḩ",
  Í: "Í",
  Ì: "Ì",
  Ï: "Ï",
  Ḯ: "Ḯ",
  Ĩ: "Ĩ",
  Ī: "Ī",
  Ĭ: "Ĭ",
  Ǐ: "Ǐ",
  Î: "Î",
  İ: "İ",
  Ĵ: "Ĵ",
  Ḱ: "Ḱ",
  Ǩ: "Ǩ",
  Ķ: "Ķ",
  Ĺ: "Ĺ",
  Ľ: "Ľ",
  Ļ: "Ļ",
  Ḿ: "Ḿ",
  Ṁ: "Ṁ",
  Ń: "Ń",
  Ǹ: "Ǹ",
  Ñ: "Ñ",
  Ň: "Ň",
  Ṅ: "Ṅ",
  Ņ: "Ņ",
  Ó: "Ó",
  Ò: "Ò",
  Ö: "Ö",
  Ȫ: "Ȫ",
  Õ: "Õ",
  Ṍ: "Ṍ",
  Ṏ: "Ṏ",
  Ȭ: "Ȭ",
  Ō: "Ō",
  Ṓ: "Ṓ",
  Ṑ: "Ṑ",
  Ŏ: "Ŏ",
  Ǒ: "Ǒ",
  Ô: "Ô",
  Ố: "Ố",
  Ồ: "Ồ",
  Ỗ: "Ỗ",
  Ȯ: "Ȯ",
  Ȱ: "Ȱ",
  Ő: "Ő",
  Ṕ: "Ṕ",
  Ṗ: "Ṗ",
  Ŕ: "Ŕ",
  Ř: "Ř",
  Ṙ: "Ṙ",
  Ŗ: "Ŗ",
  Ś: "Ś",
  Ṥ: "Ṥ",
  Š: "Š",
  Ṧ: "Ṧ",
  Ŝ: "Ŝ",
  Ṡ: "Ṡ",
  Ş: "Ş",
  Ť: "Ť",
  Ṫ: "Ṫ",
  Ţ: "Ţ",
  Ú: "Ú",
  Ù: "Ù",
  Ü: "Ü",
  Ǘ: "Ǘ",
  Ǜ: "Ǜ",
  Ǖ: "Ǖ",
  Ǚ: "Ǚ",
  Ũ: "Ũ",
  Ṹ: "Ṹ",
  Ū: "Ū",
  Ṻ: "Ṻ",
  Ŭ: "Ŭ",
  Ǔ: "Ǔ",
  Û: "Û",
  Ů: "Ů",
  Ű: "Ű",
  Ṽ: "Ṽ",
  Ẃ: "Ẃ",
  Ẁ: "Ẁ",
  Ẅ: "Ẅ",
  Ŵ: "Ŵ",
  Ẇ: "Ẇ",
  Ẍ: "Ẍ",
  Ẋ: "Ẋ",
  Ý: "Ý",
  Ỳ: "Ỳ",
  Ÿ: "Ÿ",
  Ỹ: "Ỹ",
  Ȳ: "Ȳ",
  Ŷ: "Ŷ",
  Ẏ: "Ẏ",
  Ź: "Ź",
  Ž: "Ž",
  Ẑ: "Ẑ",
  Ż: "Ż",
  ά: "ά",
  ὰ: "ὰ",
  ᾱ: "ᾱ",
  ᾰ: "ᾰ",
  έ: "έ",
  ὲ: "ὲ",
  ή: "ή",
  ὴ: "ὴ",
  ί: "ί",
  ὶ: "ὶ",
  ϊ: "ϊ",
  ΐ: "ΐ",
  ῒ: "ῒ",
  ῑ: "ῑ",
  ῐ: "ῐ",
  ό: "ό",
  ὸ: "ὸ",
  ύ: "ύ",
  ὺ: "ὺ",
  ϋ: "ϋ",
  ΰ: "ΰ",
  ῢ: "ῢ",
  ῡ: "ῡ",
  ῠ: "ῠ",
  ώ: "ώ",
  ὼ: "ὼ",
  Ύ: "Ύ",
  Ὺ: "Ὺ",
  Ϋ: "Ϋ",
  Ῡ: "Ῡ",
  Ῠ: "Ῠ",
  Ώ: "Ώ",
  Ὼ: "Ὼ"
};
class Parser {
  constructor(e, r) {
    this.mode = void 0, this.gullet = void 0, this.settings = void 0, this.leftrightDepth = void 0, this.nextToken = void 0, this.mode = "math", this.gullet = new MacroExpander(e, r, this.mode), this.settings = r, this.leftrightDepth = 0;
  }
  /**
   * Checks a result to make sure it has the right type, and throws an
   * appropriate error otherwise.
   */
  expect(e, r) {
    if (r === void 0 && (r = !0), this.fetch().text !== e)
      throw new ParseError("Expected '" + e + "', got '" + this.fetch().text + "'", this.fetch());
    r && this.consume();
  }
  /**
   * Discards the current lookahead token, considering it consumed.
   */
  consume() {
    this.nextToken = null;
  }
  /**
   * Return the current lookahead token, or if there isn't one (at the
   * beginning, or if the previous lookahead token was consume()d),
   * fetch the next token as the new lookahead token and return it.
   */
  fetch() {
    return this.nextToken == null && (this.nextToken = this.gullet.expandNextToken()), this.nextToken;
  }
  /**
   * Switches between "text" and "math" modes.
   */
  switchMode(e) {
    this.mode = e, this.gullet.switchMode(e);
  }
  /**
   * Main parsing function, which parses an entire input.
   */
  parse() {
    this.settings.globalGroup || this.gullet.beginGroup(), this.settings.colorIsTextColor && this.gullet.macros.set("\\color", "\\textcolor");
    try {
      var e = this.parseExpression(!1);
      return this.expect("EOF"), this.settings.globalGroup || this.gullet.endGroup(), e;
    } finally {
      this.gullet.endGroups();
    }
  }
  /**
   * Fully parse a separate sequence of tokens as a separate job.
   * Tokens should be specified in reverse order, as in a MacroDefinition.
   */
  subparse(e) {
    var r = this.nextToken;
    this.consume(), this.gullet.pushToken(new Token$1("}")), this.gullet.pushTokens(e);
    var o = this.parseExpression(!1);
    return this.expect("}"), this.nextToken = r, o;
  }
  /**
   * Parses an "expression", which is a list of atoms.
   *
   * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This
   *                 happens when functions have higher precedence han infix
   *                 nodes in implicit parses.
   *
   * `breakOnTokenText`: The text of the token that the expression should end
   *                     with, or `null` if something else should end the
   *                     expression.
   */
  parseExpression(e, r) {
    for (var o = []; ; ) {
      this.mode === "math" && this.consumeSpaces();
      var m = this.fetch();
      if (Parser.endOfExpression.indexOf(m.text) !== -1 || r && m.text === r || e && functions[m.text] && functions[m.text].infix)
        break;
      var _ = this.parseAtom(r);
      if (_) {
        if (_.type === "internal")
          continue;
      } else break;
      o.push(_);
    }
    return this.mode === "text" && this.formLigatures(o), this.handleInfixNodes(o);
  }
  /**
   * Rewrites infix operators such as \over with corresponding commands such
   * as \frac.
   *
   * There can only be one infix operator per group.  If there's more than one
   * then the expression is ambiguous.  This can be resolved by adding {}.
   */
  handleInfixNodes(e) {
    for (var r = -1, o, m = 0; m < e.length; m++)
      if (e[m].type === "infix") {
        if (r !== -1)
          throw new ParseError("only one infix operator per group", e[m].token);
        r = m, o = e[m].replaceWith;
      }
    if (r !== -1 && o) {
      var _, g, y = e.slice(0, r), E = e.slice(r + 1);
      y.length === 1 && y[0].type === "ordgroup" ? _ = y[0] : _ = {
        type: "ordgroup",
        mode: this.mode,
        body: y
      }, E.length === 1 && E[0].type === "ordgroup" ? g = E[0] : g = {
        type: "ordgroup",
        mode: this.mode,
        body: E
      };
      var x;
      return o === "\\\\abovefrac" ? x = this.callFunction(o, [_, e[r], g], []) : x = this.callFunction(o, [_, g], []), [x];
    } else
      return e;
  }
  /**
   * Handle a subscript or superscript with nice errors.
   */
  handleSupSubscript(e) {
    var r = this.fetch(), o = r.text;
    this.consume(), this.consumeSpaces();
    var m;
    do {
      var _;
      m = this.parseGroup(e);
    } while (((_ = m) == null ? void 0 : _.type) === "internal");
    if (!m)
      throw new ParseError("Expected group after '" + o + "'", r);
    return m;
  }
  /**
   * Converts the textual input of an unsupported command into a text node
   * contained within a color node whose color is determined by errorColor
   */
  formatUnsupportedCmd(e) {
    for (var r = [], o = 0; o < e.length; o++)
      r.push({
        type: "textord",
        mode: "text",
        text: e[o]
      });
    var m = {
      type: "text",
      mode: this.mode,
      body: r
    }, _ = {
      type: "color",
      mode: this.mode,
      color: this.settings.errorColor,
      body: [m]
    };
    return _;
  }
  /**
   * Parses a group with optional super/subscripts.
   */
  parseAtom(e) {
    var r = this.parseGroup("atom", e);
    if ((r == null ? void 0 : r.type) === "internal" || this.mode === "text")
      return r;
    for (var o, m; ; ) {
      this.consumeSpaces();
      var _ = this.fetch();
      if (_.text === "\\limits" || _.text === "\\nolimits") {
        if (r && r.type === "op") {
          var g = _.text === "\\limits";
          r.limits = g, r.alwaysHandleSupSub = !0;
        } else if (r && r.type === "operatorname")
          r.alwaysHandleSupSub && (r.limits = _.text === "\\limits");
        else
          throw new ParseError("Limit controls must follow a math operator", _);
        this.consume();
      } else if (_.text === "^") {
        if (o)
          throw new ParseError("Double superscript", _);
        o = this.handleSupSubscript("superscript");
      } else if (_.text === "_") {
        if (m)
          throw new ParseError("Double subscript", _);
        m = this.handleSupSubscript("subscript");
      } else if (_.text === "'") {
        if (o)
          throw new ParseError("Double superscript", _);
        var y = {
          type: "textord",
          mode: this.mode,
          text: "\\prime"
        }, E = [y];
        for (this.consume(); this.fetch().text === "'"; )
          E.push(y), this.consume();
        this.fetch().text === "^" && E.push(this.handleSupSubscript("superscript")), o = {
          type: "ordgroup",
          mode: this.mode,
          body: E
        };
      } else if (uSubsAndSups[_.text]) {
        var x = unicodeSubRegEx.test(_.text), v = [];
        for (v.push(new Token$1(uSubsAndSups[_.text])), this.consume(); ; ) {
          var h = this.fetch().text;
          if (!uSubsAndSups[h] || unicodeSubRegEx.test(h) !== x)
            break;
          v.unshift(new Token$1(uSubsAndSups[h])), this.consume();
        }
        var a = this.subparse(v);
        x ? m = {
          type: "ordgroup",
          mode: "math",
          body: a
        } : o = {
          type: "ordgroup",
          mode: "math",
          body: a
        };
      } else
        break;
    }
    return o || m ? {
      type: "supsub",
      mode: this.mode,
      base: r,
      sup: o,
      sub: m
    } : r;
  }
  /**
   * Parses an entire function, including its base and all of its arguments.
   */
  parseFunction(e, r) {
    var o = this.fetch(), m = o.text, _ = functions[m];
    if (!_)
      return null;
    if (this.consume(), r && r !== "atom" && !_.allowedInArgument)
      throw new ParseError("Got function '" + m + "' with no arguments" + (r ? " as " + r : ""), o);
    if (this.mode === "text" && !_.allowedInText)
      throw new ParseError("Can't use function '" + m + "' in text mode", o);
    if (this.mode === "math" && _.allowedInMath === !1)
      throw new ParseError("Can't use function '" + m + "' in math mode", o);
    var {
      args: g,
      optArgs: y
    } = this.parseArguments(m, _);
    return this.callFunction(m, g, y, o, e);
  }
  /**
   * Call a function handler with a suitable context and arguments.
   */
  callFunction(e, r, o, m, _) {
    var g = {
      funcName: e,
      parser: this,
      token: m,
      breakOnTokenText: _
    }, y = functions[e];
    if (y && y.handler)
      return y.handler(g, r, o);
    throw new ParseError("No function handler for " + e);
  }
  /**
   * Parses the arguments of a function or environment
   */
  parseArguments(e, r) {
    var o = r.numArgs + r.numOptionalArgs;
    if (o === 0)
      return {
        args: [],
        optArgs: []
      };
    for (var m = [], _ = [], g = 0; g < o; g++) {
      var y = r.argTypes && r.argTypes[g], E = g < r.numOptionalArgs;
      (r.primitive && y == null || // \sqrt expands into primitive if optional argument doesn't exist
      r.type === "sqrt" && g === 1 && _[0] == null) && (y = "primitive");
      var x = this.parseGroupOfType("argument to '" + e + "'", y, E);
      if (E)
        _.push(x);
      else if (x != null)
        m.push(x);
      else
        throw new ParseError("Null argument, please report this as a bug");
    }
    return {
      args: m,
      optArgs: _
    };
  }
  /**
   * Parses a group when the mode is changing.
   */
  parseGroupOfType(e, r, o) {
    switch (r) {
      case "color":
        return this.parseColorGroup(o);
      case "size":
        return this.parseSizeGroup(o);
      case "url":
        return this.parseUrlGroup(o);
      case "math":
      case "text":
        return this.parseArgumentGroup(o, r);
      case "hbox": {
        var m = this.parseArgumentGroup(o, "text");
        return m != null ? {
          type: "styling",
          mode: m.mode,
          body: [m],
          style: "text"
          // simulate \textstyle
        } : null;
      }
      case "raw": {
        var _ = this.parseStringGroup("raw", o);
        return _ != null ? {
          type: "raw",
          mode: "text",
          string: _.text
        } : null;
      }
      case "primitive": {
        if (o)
          throw new ParseError("A primitive argument cannot be optional");
        var g = this.parseGroup(e);
        if (g == null)
          throw new ParseError("Expected group as " + e, this.fetch());
        return g;
      }
      case "original":
      case null:
      case void 0:
        return this.parseArgumentGroup(o);
      default:
        throw new ParseError("Unknown group type as " + e, this.fetch());
    }
  }
  /**
   * Discard any space tokens, fetching the next non-space token.
   */
  consumeSpaces() {
    for (; this.fetch().text === " "; )
      this.consume();
  }
  /**
   * Parses a group, essentially returning the string formed by the
   * brace-enclosed tokens plus some position information.
   */
  parseStringGroup(e, r) {
    var o = this.gullet.scanArgument(r);
    if (o == null)
      return null;
    for (var m = "", _; (_ = this.fetch()).text !== "EOF"; )
      m += _.text, this.consume();
    return this.consume(), o.text = m, o;
  }
  /**
   * Parses a regex-delimited group: the largest sequence of tokens
   * whose concatenated strings match `regex`. Returns the string
   * formed by the tokens plus some position information.
   */
  parseRegexGroup(e, r) {
    for (var o = this.fetch(), m = o, _ = "", g; (g = this.fetch()).text !== "EOF" && e.test(_ + g.text); )
      m = g, _ += m.text, this.consume();
    if (_ === "")
      throw new ParseError("Invalid " + r + ": '" + o.text + "'", o);
    return o.range(m, _);
  }
  /**
   * Parses a color description.
   */
  parseColorGroup(e) {
    var r = this.parseStringGroup("color", e);
    if (r == null)
      return null;
    var o = /^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(r.text);
    if (!o)
      throw new ParseError("Invalid color: '" + r.text + "'", r);
    var m = o[0];
    return /^[0-9a-f]{6}$/i.test(m) && (m = "#" + m), {
      type: "color-token",
      mode: this.mode,
      color: m
    };
  }
  /**
   * Parses a size specification, consisting of magnitude and unit.
   */
  parseSizeGroup(e) {
    var r, o = !1;
    if (this.gullet.consumeSpaces(), !e && this.gullet.future().text !== "{" ? r = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size") : r = this.parseStringGroup("size", e), !r)
      return null;
    !e && r.text.length === 0 && (r.text = "0pt", o = !0);
    var m = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(r.text);
    if (!m)
      throw new ParseError("Invalid size: '" + r.text + "'", r);
    var _ = {
      number: +(m[1] + m[2]),
      // sign + magnitude, cast to number
      unit: m[3]
    };
    if (!validUnit(_))
      throw new ParseError("Invalid unit: '" + _.unit + "'", r);
    return {
      type: "size",
      mode: this.mode,
      value: _,
      isBlank: o
    };
  }
  /**
   * Parses an URL, checking escaped letters and allowed protocols,
   * and setting the catcode of % as an active character (as in \hyperref).
   */
  parseUrlGroup(e) {
    this.gullet.lexer.setCatcode("%", 13), this.gullet.lexer.setCatcode("~", 12);
    var r = this.parseStringGroup("url", e);
    if (this.gullet.lexer.setCatcode("%", 14), this.gullet.lexer.setCatcode("~", 13), r == null)
      return null;
    var o = r.text.replace(/\\([#$%&~_^{}])/g, "$1");
    return {
      type: "url",
      mode: this.mode,
      url: o
    };
  }
  /**
   * Parses an argument with the mode specified.
   */
  parseArgumentGroup(e, r) {
    var o = this.gullet.scanArgument(e);
    if (o == null)
      return null;
    var m = this.mode;
    r && this.switchMode(r), this.gullet.beginGroup();
    var _ = this.parseExpression(!1, "EOF");
    this.expect("EOF"), this.gullet.endGroup();
    var g = {
      type: "ordgroup",
      mode: this.mode,
      loc: o.loc,
      body: _
    };
    return r && this.switchMode(m), g;
  }
  /**
   * Parses an ordinary group, which is either a single nucleus (like "x")
   * or an expression in braces (like "{x+y}") or an implicit group, a group
   * that starts at the current position, and ends right before a higher explicit
   * group ends, or at EOF.
   */
  parseGroup(e, r) {
    var o = this.fetch(), m = o.text, _;
    if (m === "{" || m === "\\begingroup") {
      this.consume();
      var g = m === "{" ? "}" : "\\endgroup";
      this.gullet.beginGroup();
      var y = this.parseExpression(!1, g), E = this.fetch();
      this.expect(g), this.gullet.endGroup(), _ = {
        type: "ordgroup",
        mode: this.mode,
        loc: SourceLocation.range(o, E),
        body: y,
        // A group formed by \begingroup...\endgroup is a semi-simple group
        // which doesn't affect spacing in math mode, i.e., is transparent.
        // https://tex.stackexchange.com/questions/1930/when-should-one-
        // use-begingroup-instead-of-bgroup
        semisimple: m === "\\begingroup" || void 0
      };
    } else if (_ = this.parseFunction(r, e) || this.parseSymbol(), _ == null && m[0] === "\\" && !implicitCommands.hasOwnProperty(m)) {
      if (this.settings.throwOnError)
        throw new ParseError("Undefined control sequence: " + m, o);
      _ = this.formatUnsupportedCmd(m), this.consume();
    }
    return _;
  }
  /**
   * Form ligature-like combinations of characters for text mode.
   * This includes inputs like "--", "---", "``" and "''".
   * The result will simply replace multiple textord nodes with a single
   * character in each value by a single textord node having multiple
   * characters in its value.  The representation is still ASCII source.
   * The group will be modified in place.
   */
  formLigatures(e) {
    for (var r = e.length - 1, o = 0; o < r; ++o) {
      var m = e[o], _ = m.text;
      _ === "-" && e[o + 1].text === "-" && (o + 1 < r && e[o + 2].text === "-" ? (e.splice(o, 3, {
        type: "textord",
        mode: "text",
        loc: SourceLocation.range(m, e[o + 2]),
        text: "---"
      }), r -= 2) : (e.splice(o, 2, {
        type: "textord",
        mode: "text",
        loc: SourceLocation.range(m, e[o + 1]),
        text: "--"
      }), r -= 1)), (_ === "'" || _ === "`") && e[o + 1].text === _ && (e.splice(o, 2, {
        type: "textord",
        mode: "text",
        loc: SourceLocation.range(m, e[o + 1]),
        text: _ + _
      }), r -= 1);
    }
  }
  /**
   * Parse a single symbol out of the string. Here, we handle single character
   * symbols and special functions like \verb.
   */
  parseSymbol() {
    var e = this.fetch(), r = e.text;
    if (/^\\verb[^a-zA-Z]/.test(r)) {
      this.consume();
      var o = r.slice(5), m = o.charAt(0) === "*";
      if (m && (o = o.slice(1)), o.length < 2 || o.charAt(0) !== o.slice(-1))
        throw new ParseError(`\\verb assertion failed --
                    please report what input caused this bug`);
      return o = o.slice(1, -1), {
        type: "verb",
        mode: "text",
        body: o,
        star: m
      };
    }
    unicodeSymbols.hasOwnProperty(r[0]) && !symbols[this.mode][r[0]] && (this.settings.strict && this.mode === "math" && this.settings.reportNonstrict("unicodeTextInMathMode", 'Accented Unicode text character "' + r[0] + '" used in math mode', e), r = unicodeSymbols[r[0]] + r.slice(1));
    var _ = combiningDiacriticalMarksEndRegex.exec(r);
    _ && (r = r.substring(0, _.index), r === "i" ? r = "ı" : r === "j" && (r = "ȷ"));
    var g;
    if (symbols[this.mode][r]) {
      this.settings.strict && this.mode === "math" && extraLatin.indexOf(r) >= 0 && this.settings.reportNonstrict("unicodeTextInMathMode", 'Latin-1/Unicode text character "' + r[0] + '" used in math mode', e);
      var y = symbols[this.mode][r].group, E = SourceLocation.range(e), x;
      if (ATOMS.hasOwnProperty(y)) {
        var v = y;
        x = {
          type: "atom",
          mode: this.mode,
          family: v,
          loc: E,
          text: r
        };
      } else
        x = {
          type: y,
          mode: this.mode,
          loc: E,
          text: r
        };
      g = x;
    } else if (r.charCodeAt(0) >= 128)
      this.settings.strict && (supportedCodepoint(r.charCodeAt(0)) ? this.mode === "math" && this.settings.reportNonstrict("unicodeTextInMathMode", 'Unicode text character "' + r[0] + '" used in math mode', e) : this.settings.reportNonstrict("unknownSymbol", 'Unrecognized Unicode character "' + r[0] + '"' + (" (" + r.charCodeAt(0) + ")"), e)), g = {
        type: "textord",
        mode: "text",
        loc: SourceLocation.range(e),
        text: r
      };
    else
      return null;
    if (this.consume(), _)
      for (var h = 0; h < _[0].length; h++) {
        var a = _[0][h];
        if (!unicodeAccents[a])
          throw new ParseError("Unknown accent ' " + a + "'", e);
        var b = unicodeAccents[a][this.mode] || unicodeAccents[a].text;
        if (!b)
          throw new ParseError("Accent " + a + " unsupported in " + this.mode + " mode", e);
        g = {
          type: "accent",
          mode: this.mode,
          loc: SourceLocation.range(e),
          label: b,
          isStretchy: !1,
          isShifty: !0,
          // $FlowFixMe
          base: g
        };
      }
    return g;
  }
}
Parser.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"];
var parseTree = function(e, r) {
  if (!(typeof e == "string" || e instanceof String))
    throw new TypeError("KaTeX can only parse string typed expression");
  var o = new Parser(e, r);
  delete o.gullet.macros.current["\\df@tag"];
  var m = o.parse();
  if (delete o.gullet.macros.current["\\current@color"], delete o.gullet.macros.current["\\color"], o.gullet.macros.get("\\df@tag")) {
    if (!r.displayMode)
      throw new ParseError("\\tag works only in display equations");
    m = [{
      type: "tag",
      mode: "text",
      body: m,
      tag: o.subparse([new Token$1("\\df@tag")])
    }];
  }
  return m;
}, render = function(e, r, o) {
  r.textContent = "";
  var m = renderToDomTree(e, o).toNode();
  r.appendChild(m);
};
typeof document < "u" && document.compatMode !== "CSS1Compat" && (typeof console < "u" && console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."), render = function() {
  throw new ParseError("KaTeX doesn't work in quirks mode.");
});
var renderToString = function(e, r) {
  var o = renderToDomTree(e, r).toMarkup();
  return o;
}, generateParseTree = function(e, r) {
  var o = new Settings(r);
  return parseTree(e, o);
}, renderError = function(e, r, o) {
  if (o.throwOnError || !(e instanceof ParseError))
    throw e;
  var m = buildCommon.makeSpan(["katex-error"], [new SymbolNode(r)]);
  return m.setAttribute("title", e.toString()), m.setAttribute("style", "color:" + o.errorColor), m;
}, renderToDomTree = function(e, r) {
  var o = new Settings(r);
  try {
    var m = parseTree(e, o);
    return buildTree(m, e, o);
  } catch (_) {
    return renderError(_, e, o);
  }
}, renderToHTMLTree = function(e, r) {
  var o = new Settings(r);
  try {
    var m = parseTree(e, o);
    return buildHTMLTree(m, e, o);
  } catch (_) {
    return renderError(_, e, o);
  }
}, version = "0.16.22", __domTree = {
  Span,
  Anchor,
  SymbolNode,
  SvgNode,
  PathNode,
  LineNode
}, katex = {
  /**
   * Current KaTeX version
   */
  version,
  /**
   * Renders the given LaTeX into an HTML+MathML combination, and adds
   * it as a child to the specified DOM node.
   */
  render,
  /**
   * Renders the given LaTeX into an HTML+MathML combination string,
   * for sending to the client.
   */
  renderToString,
  /**
   * KaTeX error, usually during parsing.
   */
  ParseError,
  /**
   * The schema of Settings
   */
  SETTINGS_SCHEMA,
  /**
   * Parses the given LaTeX into KaTeX's internal parse tree structure,
   * without rendering to HTML or MathML.
   *
   * NOTE: This method is not currently recommended for public use.
   * The internal tree representation is unstable and is very likely
   * to change. Use at your own risk.
   */
  __parse: generateParseTree,
  /**
   * Renders the given LaTeX into an HTML+MathML internal DOM tree
   * representation, without flattening that representation to a string.
   *
   * NOTE: This method is not currently recommended for public use.
   * The internal tree representation is unstable and is very likely
   * to change. Use at your own risk.
   */
  __renderToDomTree: renderToDomTree,
  /**
   * Renders the given LaTeX into an HTML internal DOM tree representation,
   * without MathML and without flattening that representation to a string.
   *
   * NOTE: This method is not currently recommended for public use.
   * The internal tree representation is unstable and is very likely
   * to change. Use at your own risk.
   */
  __renderToHTMLTree: renderToHTMLTree,
  /**
   * extends internal font metrics object with a new object
   * each key in the new object represents a font name
  */
  __setFontMetrics: setFontMetrics,
  /**
   * adds a new symbol to builtin symbols table
   */
  __defineSymbol: defineSymbol,
  /**
   * adds a new function to builtin function list,
   * which directly produce parse tree elements
   * and have their own html/mathml builders
   */
  __defineFunction: defineFunction,
  /**
   * adds a new macro to builtin macro list
   */
  __defineMacro: defineMacro,
  /**
   * Expose the dom tree node types, which can be useful for type checking nodes.
   *
   * NOTE: These methods are not currently recommended for public use.
   * The internal tree representation is unstable and is very likely
   * to change. Use at your own risk.
   */
  __domTree
};
const katex$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  ParseError,
  SETTINGS_SCHEMA,
  __defineFunction: defineFunction,
  __defineMacro: defineMacro,
  __defineSymbol: defineSymbol,
  __domTree,
  __parse: generateParseTree,
  __renderToDomTree: renderToDomTree,
  __renderToHTMLTree: renderToHTMLTree,
  __setFontMetrics: setFontMetrics,
  default: katex,
  get render() {
    return render;
  },
  renderToString,
  version
}, Symbol.toStringTag, { value: "Module" }));
var findEndOfMath = function(e, r, o) {
  for (var m = o, _ = 0, g = e.length; m < r.length; ) {
    var y = r[m];
    if (_ <= 0 && r.slice(m, m + g) === e)
      return m;
    y === "\\" ? m++ : y === "{" ? _++ : y === "}" && _--, m++;
  }
  return -1;
}, escapeRegex = function(e) {
  return e.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
}, amsRegex = /^\\begin{/, splitAtDelimiters = function(e, r) {
  for (var o, m = [], _ = new RegExp("(" + r.map((x) => escapeRegex(x.left)).join("|") + ")"); o = e.search(_), o !== -1; ) {
    o > 0 && (m.push({
      type: "text",
      data: e.slice(0, o)
    }), e = e.slice(o));
    var g = r.findIndex((x) => e.startsWith(x.left));
    if (o = findEndOfMath(r[g].right, e, r[g].left.length), o === -1)
      break;
    var y = e.slice(0, o + r[g].right.length), E = amsRegex.test(y) ? y : e.slice(r[g].left.length, o);
    m.push({
      type: "math",
      data: E,
      rawData: y,
      display: r[g].display
    }), e = e.slice(o + r[g].right.length);
  }
  return e !== "" && m.push({
    type: "text",
    data: e
  }), m;
}, renderMathInText = function(e, r) {
  var o = splitAtDelimiters(e, r.delimiters);
  if (o.length === 1 && o[0].type === "text")
    return null;
  for (var m = document.createDocumentFragment(), _ = 0; _ < o.length; _++)
    if (o[_].type === "text")
      m.appendChild(document.createTextNode(o[_].data));
    else {
      var g = document.createElement("span"), y = o[_].data;
      r.displayMode = o[_].display;
      try {
        r.preProcess && (y = r.preProcess(y)), katex.render(y, g, r);
      } catch (E) {
        if (!(E instanceof katex.ParseError))
          throw E;
        r.errorCallback("KaTeX auto-render: Failed to parse `" + o[_].data + "` with ", E), m.appendChild(document.createTextNode(o[_].rawData));
        continue;
      }
      m.appendChild(g);
    }
  return m;
}, renderElem = function s(e, r) {
  for (var o = 0; o < e.childNodes.length; o++) {
    var m = e.childNodes[o];
    if (m.nodeType === 3) {
      for (var _ = m.textContent, g = m.nextSibling, y = 0; g && g.nodeType === Node.TEXT_NODE; )
        _ += g.textContent, g = g.nextSibling, y++;
      var E = renderMathInText(_, r);
      if (E) {
        for (var x = 0; x < y; x++)
          m.nextSibling.remove();
        o += E.childNodes.length - 1, e.replaceChild(E, m);
      } else
        o += y;
    } else m.nodeType === 1 && function() {
      var v = " " + m.className + " ", h = r.ignoredTags.indexOf(m.nodeName.toLowerCase()) === -1 && r.ignoredClasses.every((a) => v.indexOf(" " + a + " ") === -1);
      h && s(m, r);
    }();
  }
}, renderMathInElement = function(e, r) {
  if (!e)
    throw new Error("No element provided to render");
  var o = {};
  for (var m in r)
    r.hasOwnProperty(m) && (o[m] = r[m]);
  o.delimiters = o.delimiters || [
    {
      left: "$$",
      right: "$$",
      display: !0
    },
    {
      left: "\\(",
      right: "\\)",
      display: !1
    },
    // LaTeX uses $…$, but it ruins the display of normal `$` in text:
    // {left: "$", right: "$", display: false},
    // $ must come after $$
    // Render AMS environments even if outside $$…$$ delimiters.
    {
      left: "\\begin{equation}",
      right: "\\end{equation}",
      display: !0
    },
    {
      left: "\\begin{align}",
      right: "\\end{align}",
      display: !0
    },
    {
      left: "\\begin{alignat}",
      right: "\\end{alignat}",
      display: !0
    },
    {
      left: "\\begin{gather}",
      right: "\\end{gather}",
      display: !0
    },
    {
      left: "\\begin{CD}",
      right: "\\end{CD}",
      display: !0
    },
    {
      left: "\\[",
      right: "\\]",
      display: !0
    }
  ], o.ignoredTags = o.ignoredTags || ["script", "noscript", "style", "textarea", "pre", "code", "option"], o.ignoredClasses = o.ignoredClasses || [], o.errorCallback = o.errorCallback || console.error, o.macros = o.macros || {}, renderElem(e, o);
};
function _getDefaults() {
  return {
    async: !1,
    breaks: !1,
    extensions: null,
    gfm: !0,
    hooks: null,
    pedantic: !1,
    renderer: null,
    silent: !1,
    tokenizer: null,
    walkTokens: null
  };
}
let _defaults = _getDefaults();
function changeDefaults(s) {
  _defaults = s;
}
const escapeTest$1 = /[&<>"']/, escapeReplace$1 = new RegExp(escapeTest$1.source, "g"), escapeTestNoEncode$1 = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode$1 = new RegExp(escapeTestNoEncode$1.source, "g"), escapeReplacements$1 = {
  "&": "&amp;",
  "<": "&lt;",
  ">": "&gt;",
  '"': "&quot;",
  "'": "&#39;"
}, getEscapeReplacement$1 = (s) => escapeReplacements$1[s];
function escape$1$1(s, e) {
  if (e) {
    if (escapeTest$1.test(s))
      return s.replace(escapeReplace$1, getEscapeReplacement$1);
  } else if (escapeTestNoEncode$1.test(s))
    return s.replace(escapeReplaceNoEncode$1, getEscapeReplacement$1);
  return s;
}
const unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
function unescape(s) {
  return s.replace(unescapeTest, (e, r) => (r = r.toLowerCase(), r === "colon" ? ":" : r.charAt(0) === "#" ? r.charAt(1) === "x" ? String.fromCharCode(parseInt(r.substring(2), 16)) : String.fromCharCode(+r.substring(1)) : ""));
}
const caret = /(^|[^\[])\^/g;
function edit(s, e) {
  let r = typeof s == "string" ? s : s.source;
  e = e || "";
  const o = {
    replace: (m, _) => {
      let g = typeof _ == "string" ? _ : _.source;
      return g = g.replace(caret, "$1"), r = r.replace(m, g), o;
    },
    getRegex: () => new RegExp(r, e)
  };
  return o;
}
function cleanUrl(s) {
  try {
    s = encodeURI(s).replace(/%25/g, "%");
  } catch {
    return null;
  }
  return s;
}
const noopTest = { exec: () => null };
function splitCells(s, e) {
  const r = s.replace(/\|/g, (_, g, y) => {
    let E = !1, x = g;
    for (; --x >= 0 && y[x] === "\\"; )
      E = !E;
    return E ? "|" : " |";
  }), o = r.split(/ \|/);
  let m = 0;
  if (o[0].trim() || o.shift(), o.length > 0 && !o[o.length - 1].trim() && o.pop(), e)
    if (o.length > e)
      o.splice(e);
    else
      for (; o.length < e; )
        o.push("");
  for (; m < o.length; m++)
    o[m] = o[m].trim().replace(/\\\|/g, "|");
  return o;
}
function rtrim(s, e, r) {
  const o = s.length;
  if (o === 0)
    return "";
  let m = 0;
  for (; m < o && s.charAt(o - m - 1) === e; )
    m++;
  return s.slice(0, o - m);
}
function findClosingBracket(s, e) {
  if (s.indexOf(e[1]) === -1)
    return -1;
  let r = 0;
  for (let o = 0; o < s.length; o++)
    if (s[o] === "\\")
      o++;
    else if (s[o] === e[0])
      r++;
    else if (s[o] === e[1] && (r--, r < 0))
      return o;
  return -1;
}
function outputLink(s, e, r, o) {
  const m = e.href, _ = e.title ? escape$1$1(e.title) : null, g = s[1].replace(/\\([\[\]])/g, "$1");
  if (s[0].charAt(0) !== "!") {
    o.state.inLink = !0;
    const y = {
      type: "link",
      raw: r,
      href: m,
      title: _,
      text: g,
      tokens: o.inlineTokens(g)
    };
    return o.state.inLink = !1, y;
  }
  return {
    type: "image",
    raw: r,
    href: m,
    title: _,
    text: escape$1$1(g)
  };
}
function indentCodeCompensation(s, e) {
  const r = s.match(/^(\s+)(?:```)/);
  if (r === null)
    return e;
  const o = r[1];
  return e.split(`
`).map((m) => {
    const _ = m.match(/^\s+/);
    if (_ === null)
      return m;
    const [g] = _;
    return g.length >= o.length ? m.slice(o.length) : m;
  }).join(`
`);
}
class _Tokenizer {
  // set by the lexer
  constructor(e) {
    be(this, "options");
    be(this, "rules");
    // set by the lexer
    be(this, "lexer");
    this.options = e || _defaults;
  }
  space(e) {
    const r = this.rules.block.newline.exec(e);
    if (r && r[0].length > 0)
      return {
        type: "space",
        raw: r[0]
      };
  }
  code(e) {
    const r = this.rules.block.code.exec(e);
    if (r) {
      const o = r[0].replace(/^ {1,4}/gm, "");
      return {
        type: "code",
        raw: r[0],
        codeBlockStyle: "indented",
        text: this.options.pedantic ? o : rtrim(o, `
`)
      };
    }
  }
  fences(e) {
    const r = this.rules.block.fences.exec(e);
    if (r) {
      const o = r[0], m = indentCodeCompensation(o, r[3] || "");
      return {
        type: "code",
        raw: o,
        lang: r[2] ? r[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : r[2],
        text: m
      };
    }
  }
  heading(e) {
    const r = this.rules.block.heading.exec(e);
    if (r) {
      let o = r[2].trim();
      if (/#$/.test(o)) {
        const m = rtrim(o, "#");
        (this.options.pedantic || !m || / $/.test(m)) && (o = m.trim());
      }
      return {
        type: "heading",
        raw: r[0],
        depth: r[1].length,
        text: o,
        tokens: this.lexer.inline(o)
      };
    }
  }
  hr(e) {
    const r = this.rules.block.hr.exec(e);
    if (r)
      return {
        type: "hr",
        raw: r[0]
      };
  }
  blockquote(e) {
    const r = this.rules.block.blockquote.exec(e);
    if (r) {
      let o = r[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, `
    $1`);
      o = rtrim(o.replace(/^ *>[ \t]?/gm, ""), `
`);
      const m = this.lexer.state.top;
      this.lexer.state.top = !0;
      const _ = this.lexer.blockTokens(o);
      return this.lexer.state.top = m, {
        type: "blockquote",
        raw: r[0],
        tokens: _,
        text: o
      };
    }
  }
  list(e) {
    let r = this.rules.block.list.exec(e);
    if (r) {
      let o = r[1].trim();
      const m = o.length > 1, _ = {
        type: "list",
        raw: "",
        ordered: m,
        start: m ? +o.slice(0, -1) : "",
        loose: !1,
        items: []
      };
      o = m ? `\\d{1,9}\\${o.slice(-1)}` : `\\${o}`, this.options.pedantic && (o = m ? o : "[*+-]");
      const g = new RegExp(`^( {0,3}${o})((?:[	 ][^\\n]*)?(?:\\n|$))`);
      let y = "", E = "", x = !1;
      for (; e; ) {
        let v = !1;
        if (!(r = g.exec(e)) || this.rules.block.hr.test(e))
          break;
        y = r[0], e = e.substring(y.length);
        let h = r[2].split(`
`, 1)[0].replace(/^\t+/, (M) => " ".repeat(3 * M.length)), a = e.split(`
`, 1)[0], b = 0;
        this.options.pedantic ? (b = 2, E = h.trimStart()) : (b = r[2].search(/[^ ]/), b = b > 4 ? 1 : b, E = h.slice(b), b += r[1].length);
        let w = !1;
        if (!h && /^ *$/.test(a) && (y += a + `
`, e = e.substring(a.length + 1), v = !0), !v) {
          const M = new RegExp(`^ {0,${Math.min(3, b - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`), $ = new RegExp(`^ {0,${Math.min(3, b - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), O = new RegExp(`^ {0,${Math.min(3, b - 1)}}(?:\`\`\`|~~~)`), C = new RegExp(`^ {0,${Math.min(3, b - 1)}}#`);
          for (; e; ) {
            const P = e.split(`
`, 1)[0];
            if (a = P, this.options.pedantic && (a = a.replace(/^ {1,4}(?=( {4})*[^ ])/g, "  ")), O.test(a) || C.test(a) || M.test(a) || $.test(e))
              break;
            if (a.search(/[^ ]/) >= b || !a.trim())
              E += `
` + a.slice(b);
            else {
              if (w || h.search(/[^ ]/) >= 4 || O.test(h) || C.test(h) || $.test(h))
                break;
              E += `
` + a;
            }
            !w && !a.trim() && (w = !0), y += P + `
`, e = e.substring(P.length + 1), h = a.slice(b);
          }
        }
        _.loose || (x ? _.loose = !0 : /\n *\n *$/.test(y) && (x = !0));
        let k = null, A;
        this.options.gfm && (k = /^\[[ xX]\] /.exec(E), k && (A = k[0] !== "[ ] ", E = E.replace(/^\[[ xX]\] +/, ""))), _.items.push({
          type: "list_item",
          raw: y,
          task: !!k,
          checked: A,
          loose: !1,
          text: E,
          tokens: []
        }), _.raw += y;
      }
      _.items[_.items.length - 1].raw = y.trimEnd(), _.items[_.items.length - 1].text = E.trimEnd(), _.raw = _.raw.trimEnd();
      for (let v = 0; v < _.items.length; v++)
        if (this.lexer.state.top = !1, _.items[v].tokens = this.lexer.blockTokens(_.items[v].text, []), !_.loose) {
          const h = _.items[v].tokens.filter((b) => b.type === "space"), a = h.length > 0 && h.some((b) => /\n.*\n/.test(b.raw));
          _.loose = a;
        }
      if (_.loose)
        for (let v = 0; v < _.items.length; v++)
          _.items[v].loose = !0;
      return _;
    }
  }
  html(e) {
    const r = this.rules.block.html.exec(e);
    if (r)
      return {
        type: "html",
        block: !0,
        raw: r[0],
        pre: r[1] === "pre" || r[1] === "script" || r[1] === "style",
        text: r[0]
      };
  }
  def(e) {
    const r = this.rules.block.def.exec(e);
    if (r) {
      const o = r[1].toLowerCase().replace(/\s+/g, " "), m = r[2] ? r[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", _ = r[3] ? r[3].substring(1, r[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : r[3];
      return {
        type: "def",
        tag: o,
        raw: r[0],
        href: m,
        title: _
      };
    }
  }
  table(e) {
    const r = this.rules.block.table.exec(e);
    if (!r || !/[:|]/.test(r[2]))
      return;
    const o = splitCells(r[1]), m = r[2].replace(/^\||\| *$/g, "").split("|"), _ = r[3] && r[3].trim() ? r[3].replace(/\n[ \t]*$/, "").split(`
`) : [], g = {
      type: "table",
      raw: r[0],
      header: [],
      align: [],
      rows: []
    };
    if (o.length === m.length) {
      for (const y of m)
        /^ *-+: *$/.test(y) ? g.align.push("right") : /^ *:-+: *$/.test(y) ? g.align.push("center") : /^ *:-+ *$/.test(y) ? g.align.push("left") : g.align.push(null);
      for (const y of o)
        g.header.push({
          text: y,
          tokens: this.lexer.inline(y)
        });
      for (const y of _)
        g.rows.push(splitCells(y, g.header.length).map((E) => ({
          text: E,
          tokens: this.lexer.inline(E)
        })));
      return g;
    }
  }
  lheading(e) {
    const r = this.rules.block.lheading.exec(e);
    if (r)
      return {
        type: "heading",
        raw: r[0],
        depth: r[2].charAt(0) === "=" ? 1 : 2,
        text: r[1],
        tokens: this.lexer.inline(r[1])
      };
  }
  paragraph(e) {
    const r = this.rules.block.paragraph.exec(e);
    if (r) {
      const o = r[1].charAt(r[1].length - 1) === `
` ? r[1].slice(0, -1) : r[1];
      return {
        type: "paragraph",
        raw: r[0],
        text: o,
        tokens: this.lexer.inline(o)
      };
    }
  }
  text(e) {
    const r = this.rules.block.text.exec(e);
    if (r)
      return {
        type: "text",
        raw: r[0],
        text: r[0],
        tokens: this.lexer.inline(r[0])
      };
  }
  escape(e) {
    const r = this.rules.inline.escape.exec(e);
    if (r)
      return {
        type: "escape",
        raw: r[0],
        text: escape$1$1(r[1])
      };
  }
  tag(e) {
    const r = this.rules.inline.tag.exec(e);
    if (r)
      return !this.lexer.state.inLink && /^<a /i.test(r[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && /^<\/a>/i.test(r[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(r[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(r[0]) && (this.lexer.state.inRawBlock = !1), {
        type: "html",
        raw: r[0],
        inLink: this.lexer.state.inLink,
        inRawBlock: this.lexer.state.inRawBlock,
        block: !1,
        text: r[0]
      };
  }
  link(e) {
    const r = this.rules.inline.link.exec(e);
    if (r) {
      const o = r[2].trim();
      if (!this.options.pedantic && /^</.test(o)) {
        if (!/>$/.test(o))
          return;
        const g = rtrim(o.slice(0, -1), "\\");
        if ((o.length - g.length) % 2 === 0)
          return;
      } else {
        const g = findClosingBracket(r[2], "()");
        if (g > -1) {
          const E = (r[0].indexOf("!") === 0 ? 5 : 4) + r[1].length + g;
          r[2] = r[2].substring(0, g), r[0] = r[0].substring(0, E).trim(), r[3] = "";
        }
      }
      let m = r[2], _ = "";
      if (this.options.pedantic) {
        const g = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(m);
        g && (m = g[1], _ = g[3]);
      } else
        _ = r[3] ? r[3].slice(1, -1) : "";
      return m = m.trim(), /^</.test(m) && (this.options.pedantic && !/>$/.test(o) ? m = m.slice(1) : m = m.slice(1, -1)), outputLink(r, {
        href: m && m.replace(this.rules.inline.anyPunctuation, "$1"),
        title: _ && _.replace(this.rules.inline.anyPunctuation, "$1")
      }, r[0], this.lexer);
    }
  }
  reflink(e, r) {
    let o;
    if ((o = this.rules.inline.reflink.exec(e)) || (o = this.rules.inline.nolink.exec(e))) {
      const m = (o[2] || o[1]).replace(/\s+/g, " "), _ = r[m.toLowerCase()];
      if (!_) {
        const g = o[0].charAt(0);
        return {
          type: "text",
          raw: g,
          text: g
        };
      }
      return outputLink(o, _, o[0], this.lexer);
    }
  }
  emStrong(e, r, o = "") {
    let m = this.rules.inline.emStrongLDelim.exec(e);
    if (!m || m[3] && o.match(/[\p{L}\p{N}]/u))
      return;
    if (!(m[1] || m[2] || "") || !o || this.rules.inline.punctuation.exec(o)) {
      const g = [...m[0]].length - 1;
      let y, E, x = g, v = 0;
      const h = m[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
      for (h.lastIndex = 0, r = r.slice(-1 * e.length + g); (m = h.exec(r)) != null; ) {
        if (y = m[1] || m[2] || m[3] || m[4] || m[5] || m[6], !y)
          continue;
        if (E = [...y].length, m[3] || m[4]) {
          x += E;
          continue;
        } else if ((m[5] || m[6]) && g % 3 && !((g + E) % 3)) {
          v += E;
          continue;
        }
        if (x -= E, x > 0)
          continue;
        E = Math.min(E, E + x + v);
        const a = [...m[0]][0].length, b = e.slice(0, g + m.index + a + E);
        if (Math.min(g, E) % 2) {
          const k = b.slice(1, -1);
          return {
            type: "em",
            raw: b,
            text: k,
            tokens: this.lexer.inlineTokens(k)
          };
        }
        const w = b.slice(2, -2);
        return {
          type: "strong",
          raw: b,
          text: w,
          tokens: this.lexer.inlineTokens(w)
        };
      }
    }
  }
  codespan(e) {
    const r = this.rules.inline.code.exec(e);
    if (r) {
      let o = r[2].replace(/\n/g, " ");
      const m = /[^ ]/.test(o), _ = /^ /.test(o) && / $/.test(o);
      return m && _ && (o = o.substring(1, o.length - 1)), o = escape$1$1(o, !0), {
        type: "codespan",
        raw: r[0],
        text: o
      };
    }
  }
  br(e) {
    const r = this.rules.inline.br.exec(e);
    if (r)
      return {
        type: "br",
        raw: r[0]
      };
  }
  del(e) {
    const r = this.rules.inline.del.exec(e);
    if (r)
      return {
        type: "del",
        raw: r[0],
        text: r[2],
        tokens: this.lexer.inlineTokens(r[2])
      };
  }
  autolink(e) {
    const r = this.rules.inline.autolink.exec(e);
    if (r) {
      let o, m;
      return r[2] === "@" ? (o = escape$1$1(r[1]), m = "mailto:" + o) : (o = escape$1$1(r[1]), m = o), {
        type: "link",
        raw: r[0],
        text: o,
        href: m,
        tokens: [
          {
            type: "text",
            raw: o,
            text: o
          }
        ]
      };
    }
  }
  url(e) {
    var o;
    let r;
    if (r = this.rules.inline.url.exec(e)) {
      let m, _;
      if (r[2] === "@")
        m = escape$1$1(r[0]), _ = "mailto:" + m;
      else {
        let g;
        do
          g = r[0], r[0] = ((o = this.rules.inline._backpedal.exec(r[0])) == null ? void 0 : o[0]) ?? "";
        while (g !== r[0]);
        m = escape$1$1(r[0]), r[1] === "www." ? _ = "http://" + r[0] : _ = r[0];
      }
      return {
        type: "link",
        raw: r[0],
        text: m,
        href: _,
        tokens: [
          {
            type: "text",
            raw: m,
            text: m
          }
        ]
      };
    }
  }
  inlineText(e) {
    const r = this.rules.inline.text.exec(e);
    if (r) {
      let o;
      return this.lexer.state.inRawBlock ? o = r[0] : o = escape$1$1(r[0]), {
        type: "text",
        raw: r[0],
        text: o
      };
    }
  }
}
const newline = /^(?: *(?:\n|$))+/, blockCode = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/, fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, bullet = /(?:[*+-]|\d{1,9}[.)])/, lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, bullet).replace(/blockCode/g, / {4}/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).getRegex(), _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, blockText = /^[^\n]+/, _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/, def = edit(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label", _blockLabel).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet).getRegex(), _tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, html$2 = edit("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))", "i").replace("comment", _comment).replace("tag", _tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), paragraph = edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex(), blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", paragraph).getRegex(), blockNormal = {
  blockquote,
  code: blockCode,
  def,
  fences,
  heading,
  hr,
  html: html$2,
  lheading,
  list,
  newline,
  paragraph,
  table: noopTest,
  text: blockText
}, gfmTable = edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex(), blockGfm = {
  ...blockNormal,
  table: gfmTable,
  paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", gfmTable).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex()
}, blockPedantic = {
  ...blockNormal,
  html: edit(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", _comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
  def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
  heading: /^(#{1,6})(.*)(?:\n+|$)/,
  fences: noopTest,
  // fences not supported
  lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
  paragraph: edit(_paragraph).replace("hr", hr).replace("heading", ` *#{1,6} *[^
]`).replace("lheading", lheading).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
}, escape$2 = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, br = /^( {2,}|\\)\n(?!\s*$)/, inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, _punctuation = "\\p{P}\\p{S}", punctuation = edit(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, _punctuation).getRegex(), blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g, emStrongLDelim = edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, _punctuation).getRegex(), emStrongRDelimAst = edit("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, _punctuation).getRegex(), emStrongRDelimUnd = edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, _punctuation).getRegex(), anyPunctuation = edit(/\\([punct])/, "gu").replace(/punct/g, _punctuation).getRegex(), autolink = edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), _inlineComment = edit(_comment).replace("(?:-->|$)", "-->").getRegex(), tag = edit("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", _inlineComment).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, link = edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", _inlineLabel).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), reflink = edit(/^!?\[(label)\]\[(ref)\]/).replace("label", _inlineLabel).replace("ref", _blockLabel).getRegex(), nolink = edit(/^!?\[(ref)\](?:\[\])?/).replace("ref", _blockLabel).getRegex(), reflinkSearch = edit("reflink|nolink(?!\\()", "g").replace("reflink", reflink).replace("nolink", nolink).getRegex(), inlineNormal = {
  _backpedal: noopTest,
  // only used for GFM url
  anyPunctuation,
  autolink,
  blockSkip,
  br,
  code: inlineCode,
  del: noopTest,
  emStrongLDelim,
  emStrongRDelimAst,
  emStrongRDelimUnd,
  escape: escape$2,
  link,
  nolink,
  punctuation,
  reflink,
  reflinkSearch,
  tag,
  text: inlineText,
  url: noopTest
}, inlinePedantic = {
  ...inlineNormal,
  link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", _inlineLabel).getRegex(),
  reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", _inlineLabel).getRegex()
}, inlineGfm = {
  ...inlineNormal,
  escape: edit(escape$2).replace("])", "~|])").getRegex(),
  url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
  _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
  del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
  text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
}, inlineBreaks = {
  ...inlineGfm,
  br: edit(br).replace("{2,}", "*").getRegex(),
  text: edit(inlineGfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
}, block = {
  normal: blockNormal,
  gfm: blockGfm,
  pedantic: blockPedantic
}, inline = {
  normal: inlineNormal,
  gfm: inlineGfm,
  breaks: inlineBreaks,
  pedantic: inlinePedantic
};
class _Lexer {
  constructor(e) {
    be(this, "tokens");
    be(this, "options");
    be(this, "state");
    be(this, "tokenizer");
    be(this, "inlineQueue");
    this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || _defaults, this.options.tokenizer = this.options.tokenizer || new _Tokenizer(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
      inLink: !1,
      inRawBlock: !1,
      top: !0
    };
    const r = {
      block: block.normal,
      inline: inline.normal
    };
    this.options.pedantic ? (r.block = block.pedantic, r.inline = inline.pedantic) : this.options.gfm && (r.block = block.gfm, this.options.breaks ? r.inline = inline.breaks : r.inline = inline.gfm), this.tokenizer.rules = r;
  }
  /**
   * Expose Rules
   */
  static get rules() {
    return {
      block,
      inline
    };
  }
  /**
   * Static Lex Method
   */
  static lex(e, r) {
    return new _Lexer(r).lex(e);
  }
  /**
   * Static Lex Inline Method
   */
  static lexInline(e, r) {
    return new _Lexer(r).inlineTokens(e);
  }
  /**
   * Preprocessing
   */
  lex(e) {
    e = e.replace(/\r\n|\r/g, `
`), this.blockTokens(e, this.tokens);
    for (let r = 0; r < this.inlineQueue.length; r++) {
      const o = this.inlineQueue[r];
      this.inlineTokens(o.src, o.tokens);
    }
    return this.inlineQueue = [], this.tokens;
  }
  blockTokens(e, r = []) {
    this.options.pedantic ? e = e.replace(/\t/g, "    ").replace(/^ +$/gm, "") : e = e.replace(/^( *)(\t+)/gm, (y, E, x) => E + "    ".repeat(x.length));
    let o, m, _, g;
    for (; e; )
      if (!(this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((y) => (o = y.call({ lexer: this }, e, r)) ? (e = e.substring(o.raw.length), r.push(o), !0) : !1))) {
        if (o = this.tokenizer.space(e)) {
          e = e.substring(o.raw.length), o.raw.length === 1 && r.length > 0 ? r[r.length - 1].raw += `
` : r.push(o);
          continue;
        }
        if (o = this.tokenizer.code(e)) {
          e = e.substring(o.raw.length), m = r[r.length - 1], m && (m.type === "paragraph" || m.type === "text") ? (m.raw += `
` + o.raw, m.text += `
` + o.text, this.inlineQueue[this.inlineQueue.length - 1].src = m.text) : r.push(o);
          continue;
        }
        if (o = this.tokenizer.fences(e)) {
          e = e.substring(o.raw.length), r.push(o);
          continue;
        }
        if (o = this.tokenizer.heading(e)) {
          e = e.substring(o.raw.length), r.push(o);
          continue;
        }
        if (o = this.tokenizer.hr(e)) {
          e = e.substring(o.raw.length), r.push(o);
          continue;
        }
        if (o = this.tokenizer.blockquote(e)) {
          e = e.substring(o.raw.length), r.push(o);
          continue;
        }
        if (o = this.tokenizer.list(e)) {
          e = e.substring(o.raw.length), r.push(o);
          continue;
        }
        if (o = this.tokenizer.html(e)) {
          e = e.substring(o.raw.length), r.push(o);
          continue;
        }
        if (o = this.tokenizer.def(e)) {
          e = e.substring(o.raw.length), m = r[r.length - 1], m && (m.type === "paragraph" || m.type === "text") ? (m.raw += `
` + o.raw, m.text += `
` + o.raw, this.inlineQueue[this.inlineQueue.length - 1].src = m.text) : this.tokens.links[o.tag] || (this.tokens.links[o.tag] = {
            href: o.href,
            title: o.title
          });
          continue;
        }
        if (o = this.tokenizer.table(e)) {
          e = e.substring(o.raw.length), r.push(o);
          continue;
        }
        if (o = this.tokenizer.lheading(e)) {
          e = e.substring(o.raw.length), r.push(o);
          continue;
        }
        if (_ = e, this.options.extensions && this.options.extensions.startBlock) {
          let y = 1 / 0;
          const E = e.slice(1);
          let x;
          this.options.extensions.startBlock.forEach((v) => {
            x = v.call({ lexer: this }, E), typeof x == "number" && x >= 0 && (y = Math.min(y, x));
          }), y < 1 / 0 && y >= 0 && (_ = e.substring(0, y + 1));
        }
        if (this.state.top && (o = this.tokenizer.paragraph(_))) {
          m = r[r.length - 1], g && m.type === "paragraph" ? (m.raw += `
` + o.raw, m.text += `
` + o.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = m.text) : r.push(o), g = _.length !== e.length, e = e.substring(o.raw.length);
          continue;
        }
        if (o = this.tokenizer.text(e)) {
          e = e.substring(o.raw.length), m = r[r.length - 1], m && m.type === "text" ? (m.raw += `
` + o.raw, m.text += `
` + o.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = m.text) : r.push(o);
          continue;
        }
        if (e) {
          const y = "Infinite loop on byte: " + e.charCodeAt(0);
          if (this.options.silent) {
            console.error(y);
            break;
          } else
            throw new Error(y);
        }
      }
    return this.state.top = !0, r;
  }
  inline(e, r = []) {
    return this.inlineQueue.push({ src: e, tokens: r }), r;
  }
  /**
   * Lexing/Compiling
   */
  inlineTokens(e, r = []) {
    let o, m, _, g = e, y, E, x;
    if (this.tokens.links) {
      const v = Object.keys(this.tokens.links);
      if (v.length > 0)
        for (; (y = this.tokenizer.rules.inline.reflinkSearch.exec(g)) != null; )
          v.includes(y[0].slice(y[0].lastIndexOf("[") + 1, -1)) && (g = g.slice(0, y.index) + "[" + "a".repeat(y[0].length - 2) + "]" + g.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
    }
    for (; (y = this.tokenizer.rules.inline.blockSkip.exec(g)) != null; )
      g = g.slice(0, y.index) + "[" + "a".repeat(y[0].length - 2) + "]" + g.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
    for (; (y = this.tokenizer.rules.inline.anyPunctuation.exec(g)) != null; )
      g = g.slice(0, y.index) + "++" + g.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
    for (; e; )
      if (E || (x = ""), E = !1, !(this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((v) => (o = v.call({ lexer: this }, e, r)) ? (e = e.substring(o.raw.length), r.push(o), !0) : !1))) {
        if (o = this.tokenizer.escape(e)) {
          e = e.substring(o.raw.length), r.push(o);
          continue;
        }
        if (o = this.tokenizer.tag(e)) {
          e = e.substring(o.raw.length), m = r[r.length - 1], m && o.type === "text" && m.type === "text" ? (m.raw += o.raw, m.text += o.text) : r.push(o);
          continue;
        }
        if (o = this.tokenizer.link(e)) {
          e = e.substring(o.raw.length), r.push(o);
          continue;
        }
        if (o = this.tokenizer.reflink(e, this.tokens.links)) {
          e = e.substring(o.raw.length), m = r[r.length - 1], m && o.type === "text" && m.type === "text" ? (m.raw += o.raw, m.text += o.text) : r.push(o);
          continue;
        }
        if (o = this.tokenizer.emStrong(e, g, x)) {
          e = e.substring(o.raw.length), r.push(o);
          continue;
        }
        if (o = this.tokenizer.codespan(e)) {
          e = e.substring(o.raw.length), r.push(o);
          continue;
        }
        if (o = this.tokenizer.br(e)) {
          e = e.substring(o.raw.length), r.push(o);
          continue;
        }
        if (o = this.tokenizer.del(e)) {
          e = e.substring(o.raw.length), r.push(o);
          continue;
        }
        if (o = this.tokenizer.autolink(e)) {
          e = e.substring(o.raw.length), r.push(o);
          continue;
        }
        if (!this.state.inLink && (o = this.tokenizer.url(e))) {
          e = e.substring(o.raw.length), r.push(o);
          continue;
        }
        if (_ = e, this.options.extensions && this.options.extensions.startInline) {
          let v = 1 / 0;
          const h = e.slice(1);
          let a;
          this.options.extensions.startInline.forEach((b) => {
            a = b.call({ lexer: this }, h), typeof a == "number" && a >= 0 && (v = Math.min(v, a));
          }), v < 1 / 0 && v >= 0 && (_ = e.substring(0, v + 1));
        }
        if (o = this.tokenizer.inlineText(_)) {
          e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (x = o.raw.slice(-1)), E = !0, m = r[r.length - 1], m && m.type === "text" ? (m.raw += o.raw, m.text += o.text) : r.push(o);
          continue;
        }
        if (e) {
          const v = "Infinite loop on byte: " + e.charCodeAt(0);
          if (this.options.silent) {
            console.error(v);
            break;
          } else
            throw new Error(v);
        }
      }
    return r;
  }
}
class _Renderer {
  constructor(e) {
    be(this, "options");
    this.options = e || _defaults;
  }
  code(e, r, o) {
    var _;
    const m = (_ = (r || "").match(/^\S*/)) == null ? void 0 : _[0];
    return e = e.replace(/\n$/, "") + `
`, m ? '<pre><code class="language-' + escape$1$1(m) + '">' + (o ? e : escape$1$1(e, !0)) + `</code></pre>
` : "<pre><code>" + (o ? e : escape$1$1(e, !0)) + `</code></pre>
`;
  }
  blockquote(e) {
    return `<blockquote>
${e}</blockquote>
`;
  }
  html(e, r) {
    return e;
  }
  heading(e, r, o) {
    return `<h${r}>${e}</h${r}>
`;
  }
  hr() {
    return `<hr>
`;
  }
  list(e, r, o) {
    const m = r ? "ol" : "ul", _ = r && o !== 1 ? ' start="' + o + '"' : "";
    return "<" + m + _ + `>
` + e + "</" + m + `>
`;
  }
  listitem(e, r, o) {
    return `<li>${e}</li>
`;
  }
  checkbox(e) {
    return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
  }
  paragraph(e) {
    return `<p>${e}</p>
`;
  }
  table(e, r) {
    return r && (r = `<tbody>${r}</tbody>`), `<table>
<thead>
` + e + `</thead>
` + r + `</table>
`;
  }
  tablerow(e) {
    return `<tr>
${e}</tr>
`;
  }
  tablecell(e, r) {
    const o = r.header ? "th" : "td";
    return (r.align ? `<${o} align="${r.align}">` : `<${o}>`) + e + `</${o}>
`;
  }
  /**
   * span level renderer
   */
  strong(e) {
    return `<strong>${e}</strong>`;
  }
  em(e) {
    return `<em>${e}</em>`;
  }
  codespan(e) {
    return `<code>${e}</code>`;
  }
  br() {
    return "<br>";
  }
  del(e) {
    return `<del>${e}</del>`;
  }
  link(e, r, o) {
    const m = cleanUrl(e);
    if (m === null)
      return o;
    e = m;
    let _ = '<a href="' + e + '"';
    return r && (_ += ' title="' + r + '"'), _ += ">" + o + "</a>", _;
  }
  image(e, r, o) {
    const m = cleanUrl(e);
    if (m === null)
      return o;
    e = m;
    let _ = `<img src="${e}" alt="${o}"`;
    return r && (_ += ` title="${r}"`), _ += ">", _;
  }
  text(e) {
    return e;
  }
}
class _TextRenderer {
  // no need for block level renderers
  strong(e) {
    return e;
  }
  em(e) {
    return e;
  }
  codespan(e) {
    return e;
  }
  del(e) {
    return e;
  }
  html(e) {
    return e;
  }
  text(e) {
    return e;
  }
  link(e, r, o) {
    return "" + o;
  }
  image(e, r, o) {
    return "" + o;
  }
  br() {
    return "";
  }
}
class _Parser {
  constructor(e) {
    be(this, "options");
    be(this, "renderer");
    be(this, "textRenderer");
    this.options = e || _defaults, this.options.renderer = this.options.renderer || new _Renderer(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.textRenderer = new _TextRenderer();
  }
  /**
   * Static Parse Method
   */
  static parse(e, r) {
    return new _Parser(r).parse(e);
  }
  /**
   * Static Parse Inline Method
   */
  static parseInline(e, r) {
    return new _Parser(r).parseInline(e);
  }
  /**
   * Parse Loop
   */
  parse(e, r = !0) {
    let o = "";
    for (let m = 0; m < e.length; m++) {
      const _ = e[m];
      if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[_.type]) {
        const g = _, y = this.options.extensions.renderers[g.type].call({ parser: this }, g);
        if (y !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(g.type)) {
          o += y || "";
          continue;
        }
      }
      switch (_.type) {
        case "space":
          continue;
        case "hr": {
          o += this.renderer.hr();
          continue;
        }
        case "heading": {
          const g = _;
          o += this.renderer.heading(this.parseInline(g.tokens), g.depth, unescape(this.parseInline(g.tokens, this.textRenderer)));
          continue;
        }
        case "code": {
          const g = _;
          o += this.renderer.code(g.text, g.lang, !!g.escaped);
          continue;
        }
        case "table": {
          const g = _;
          let y = "", E = "";
          for (let v = 0; v < g.header.length; v++)
            E += this.renderer.tablecell(this.parseInline(g.header[v].tokens), { header: !0, align: g.align[v] });
          y += this.renderer.tablerow(E);
          let x = "";
          for (let v = 0; v < g.rows.length; v++) {
            const h = g.rows[v];
            E = "";
            for (let a = 0; a < h.length; a++)
              E += this.renderer.tablecell(this.parseInline(h[a].tokens), { header: !1, align: g.align[a] });
            x += this.renderer.tablerow(E);
          }
          o += this.renderer.table(y, x);
          continue;
        }
        case "blockquote": {
          const g = _, y = this.parse(g.tokens);
          o += this.renderer.blockquote(y);
          continue;
        }
        case "list": {
          const g = _, y = g.ordered, E = g.start, x = g.loose;
          let v = "";
          for (let h = 0; h < g.items.length; h++) {
            const a = g.items[h], b = a.checked, w = a.task;
            let k = "";
            if (a.task) {
              const A = this.renderer.checkbox(!!b);
              x ? a.tokens.length > 0 && a.tokens[0].type === "paragraph" ? (a.tokens[0].text = A + " " + a.tokens[0].text, a.tokens[0].tokens && a.tokens[0].tokens.length > 0 && a.tokens[0].tokens[0].type === "text" && (a.tokens[0].tokens[0].text = A + " " + a.tokens[0].tokens[0].text)) : a.tokens.unshift({
                type: "text",
                text: A + " "
              }) : k += A + " ";
            }
            k += this.parse(a.tokens, x), v += this.renderer.listitem(k, w, !!b);
          }
          o += this.renderer.list(v, y, E);
          continue;
        }
        case "html": {
          const g = _;
          o += this.renderer.html(g.text, g.block);
          continue;
        }
        case "paragraph": {
          const g = _;
          o += this.renderer.paragraph(this.parseInline(g.tokens));
          continue;
        }
        case "text": {
          let g = _, y = g.tokens ? this.parseInline(g.tokens) : g.text;
          for (; m + 1 < e.length && e[m + 1].type === "text"; )
            g = e[++m], y += `
` + (g.tokens ? this.parseInline(g.tokens) : g.text);
          o += r ? this.renderer.paragraph(y) : y;
          continue;
        }
        default: {
          const g = 'Token with "' + _.type + '" type was not found.';
          if (this.options.silent)
            return console.error(g), "";
          throw new Error(g);
        }
      }
    }
    return o;
  }
  /**
   * Parse Inline Tokens
   */
  parseInline(e, r) {
    r = r || this.renderer;
    let o = "";
    for (let m = 0; m < e.length; m++) {
      const _ = e[m];
      if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[_.type]) {
        const g = this.options.extensions.renderers[_.type].call({ parser: this }, _);
        if (g !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(_.type)) {
          o += g || "";
          continue;
        }
      }
      switch (_.type) {
        case "escape": {
          const g = _;
          o += r.text(g.text);
          break;
        }
        case "html": {
          const g = _;
          o += r.html(g.text);
          break;
        }
        case "link": {
          const g = _;
          o += r.link(g.href, g.title, this.parseInline(g.tokens, r));
          break;
        }
        case "image": {
          const g = _;
          o += r.image(g.href, g.title, g.text);
          break;
        }
        case "strong": {
          const g = _;
          o += r.strong(this.parseInline(g.tokens, r));
          break;
        }
        case "em": {
          const g = _;
          o += r.em(this.parseInline(g.tokens, r));
          break;
        }
        case "codespan": {
          const g = _;
          o += r.codespan(g.text);
          break;
        }
        case "br": {
          o += r.br();
          break;
        }
        case "del": {
          const g = _;
          o += r.del(this.parseInline(g.tokens, r));
          break;
        }
        case "text": {
          const g = _;
          o += r.text(g.text);
          break;
        }
        default: {
          const g = 'Token with "' + _.type + '" type was not found.';
          if (this.options.silent)
            return console.error(g), "";
          throw new Error(g);
        }
      }
    }
    return o;
  }
}
class _Hooks {
  constructor(e) {
    be(this, "options");
    this.options = e || _defaults;
  }
  /**
   * Process markdown before marked
   */
  preprocess(e) {
    return e;
  }
  /**
   * Process HTML after marked is finished
   */
  postprocess(e) {
    return e;
  }
  /**
   * Process all tokens before walk tokens
   */
  processAllTokens(e) {
    return e;
  }
}
be(_Hooks, "passThroughHooks", /* @__PURE__ */ new Set([
  "preprocess",
  "postprocess",
  "processAllTokens"
]));
var Wt, on, In;
class Marked {
  constructor(...e) {
    Cn(this, Wt);
    be(this, "defaults", _getDefaults());
    be(this, "options", this.setOptions);
    be(this, "parse", en(this, Wt, on).call(this, _Lexer.lex, _Parser.parse));
    be(this, "parseInline", en(this, Wt, on).call(this, _Lexer.lexInline, _Parser.parseInline));
    be(this, "Parser", _Parser);
    be(this, "Renderer", _Renderer);
    be(this, "TextRenderer", _TextRenderer);
    be(this, "Lexer", _Lexer);
    be(this, "Tokenizer", _Tokenizer);
    be(this, "Hooks", _Hooks);
    this.use(...e);
  }
  /**
   * Run callback for every token
   */
  walkTokens(e, r) {
    var m, _;
    let o = [];
    for (const g of e)
      switch (o = o.concat(r.call(this, g)), g.type) {
        case "table": {
          const y = g;
          for (const E of y.header)
            o = o.concat(this.walkTokens(E.tokens, r));
          for (const E of y.rows)
            for (const x of E)
              o = o.concat(this.walkTokens(x.tokens, r));
          break;
        }
        case "list": {
          const y = g;
          o = o.concat(this.walkTokens(y.items, r));
          break;
        }
        default: {
          const y = g;
          (_ = (m = this.defaults.extensions) == null ? void 0 : m.childTokens) != null && _[y.type] ? this.defaults.extensions.childTokens[y.type].forEach((E) => {
            const x = y[E].flat(1 / 0);
            o = o.concat(this.walkTokens(x, r));
          }) : y.tokens && (o = o.concat(this.walkTokens(y.tokens, r)));
        }
      }
    return o;
  }
  use(...e) {
    const r = this.defaults.extensions || { renderers: {}, childTokens: {} };
    return e.forEach((o) => {
      const m = { ...o };
      if (m.async = this.defaults.async || m.async || !1, o.extensions && (o.extensions.forEach((_) => {
        if (!_.name)
          throw new Error("extension name required");
        if ("renderer" in _) {
          const g = r.renderers[_.name];
          g ? r.renderers[_.name] = function(...y) {
            let E = _.renderer.apply(this, y);
            return E === !1 && (E = g.apply(this, y)), E;
          } : r.renderers[_.name] = _.renderer;
        }
        if ("tokenizer" in _) {
          if (!_.level || _.level !== "block" && _.level !== "inline")
            throw new Error("extension level must be 'block' or 'inline'");
          const g = r[_.level];
          g ? g.unshift(_.tokenizer) : r[_.level] = [_.tokenizer], _.start && (_.level === "block" ? r.startBlock ? r.startBlock.push(_.start) : r.startBlock = [_.start] : _.level === "inline" && (r.startInline ? r.startInline.push(_.start) : r.startInline = [_.start]));
        }
        "childTokens" in _ && _.childTokens && (r.childTokens[_.name] = _.childTokens);
      }), m.extensions = r), o.renderer) {
        const _ = this.defaults.renderer || new _Renderer(this.defaults);
        for (const g in o.renderer) {
          if (!(g in _))
            throw new Error(`renderer '${g}' does not exist`);
          if (g === "options")
            continue;
          const y = g, E = o.renderer[y], x = _[y];
          _[y] = (...v) => {
            let h = E.apply(_, v);
            return h === !1 && (h = x.apply(_, v)), h || "";
          };
        }
        m.renderer = _;
      }
      if (o.tokenizer) {
        const _ = this.defaults.tokenizer || new _Tokenizer(this.defaults);
        for (const g in o.tokenizer) {
          if (!(g in _))
            throw new Error(`tokenizer '${g}' does not exist`);
          if (["options", "rules", "lexer"].includes(g))
            continue;
          const y = g, E = o.tokenizer[y], x = _[y];
          _[y] = (...v) => {
            let h = E.apply(_, v);
            return h === !1 && (h = x.apply(_, v)), h;
          };
        }
        m.tokenizer = _;
      }
      if (o.hooks) {
        const _ = this.defaults.hooks || new _Hooks();
        for (const g in o.hooks) {
          if (!(g in _))
            throw new Error(`hook '${g}' does not exist`);
          if (g === "options")
            continue;
          const y = g, E = o.hooks[y], x = _[y];
          _Hooks.passThroughHooks.has(g) ? _[y] = (v) => {
            if (this.defaults.async)
              return Promise.resolve(E.call(_, v)).then((a) => x.call(_, a));
            const h = E.call(_, v);
            return x.call(_, h);
          } : _[y] = (...v) => {
            let h = E.apply(_, v);
            return h === !1 && (h = x.apply(_, v)), h;
          };
        }
        m.hooks = _;
      }
      if (o.walkTokens) {
        const _ = this.defaults.walkTokens, g = o.walkTokens;
        m.walkTokens = function(y) {
          let E = [];
          return E.push(g.call(this, y)), _ && (E = E.concat(_.call(this, y))), E;
        };
      }
      this.defaults = { ...this.defaults, ...m };
    }), this;
  }
  setOptions(e) {
    return this.defaults = { ...this.defaults, ...e }, this;
  }
  lexer(e, r) {
    return _Lexer.lex(e, r ?? this.defaults);
  }
  parser(e, r) {
    return _Parser.parse(e, r ?? this.defaults);
  }
}
Wt = new WeakSet(), on = function(e, r) {
  return (o, m) => {
    const _ = { ...m }, g = { ...this.defaults, ..._ };
    this.defaults.async === !0 && _.async === !1 && (g.silent || console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."), g.async = !0);
    const y = en(this, Wt, In).call(this, !!g.silent, !!g.async);
    if (typeof o > "u" || o === null)
      return y(new Error("marked(): input parameter is undefined or null"));
    if (typeof o != "string")
      return y(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(o) + ", string expected"));
    if (g.hooks && (g.hooks.options = g), g.async)
      return Promise.resolve(g.hooks ? g.hooks.preprocess(o) : o).then((E) => e(E, g)).then((E) => g.hooks ? g.hooks.processAllTokens(E) : E).then((E) => g.walkTokens ? Promise.all(this.walkTokens(E, g.walkTokens)).then(() => E) : E).then((E) => r(E, g)).then((E) => g.hooks ? g.hooks.postprocess(E) : E).catch(y);
    try {
      g.hooks && (o = g.hooks.preprocess(o));
      let E = e(o, g);
      g.hooks && (E = g.hooks.processAllTokens(E)), g.walkTokens && this.walkTokens(E, g.walkTokens);
      let x = r(E, g);
      return g.hooks && (x = g.hooks.postprocess(x)), x;
    } catch (E) {
      return y(E);
    }
  };
}, In = function(e, r) {
  return (o) => {
    if (o.message += `
Please report this to https://github.com/markedjs/marked.`, e) {
      const m = "<p>An error occurred:</p><pre>" + escape$1$1(o.message + "", !0) + "</pre>";
      return r ? Promise.resolve(m) : m;
    }
    if (r)
      return Promise.reject(o);
    throw o;
  };
};
const markedInstance = new Marked();
function marked(s, e) {
  return markedInstance.parse(s, e);
}
marked.options = marked.setOptions = function(s) {
  return markedInstance.setOptions(s), marked.defaults = markedInstance.defaults, changeDefaults(marked.defaults), marked;
};
marked.getDefaults = _getDefaults;
marked.defaults = _defaults;
marked.use = function(...s) {
  return markedInstance.use(...s), marked.defaults = markedInstance.defaults, changeDefaults(marked.defaults), marked;
};
marked.walkTokens = function(s, e) {
  return markedInstance.walkTokens(s, e);
};
marked.parseInline = markedInstance.parseInline;
marked.Parser = _Parser;
marked.parser = _Parser.parse;
marked.Renderer = _Renderer;
marked.TextRenderer = _TextRenderer;
marked.Lexer = _Lexer;
marked.lexer = _Lexer.lex;
marked.Tokenizer = _Tokenizer;
marked.Hooks = _Hooks;
marked.parse = marked;
marked.options;
marked.setOptions;
marked.use;
marked.walkTokens;
marked.parseInline;
_Parser.parse;
_Lexer.lex;
function markedHighlight(s) {
  if (typeof s == "function" && (s = {
    highlight: s
  }), !s || typeof s.highlight != "function")
    throw new Error("Must provide highlight function");
  return typeof s.langPrefix != "string" && (s.langPrefix = "language-"), typeof s.emptyLangClass != "string" && (s.emptyLangClass = ""), {
    async: !!s.async,
    walkTokens(e) {
      if (e.type !== "code")
        return;
      const r = getLang(e.lang);
      if (s.async)
        return Promise.resolve(s.highlight(e.text, r, e.lang || "")).then(updateToken(e));
      const o = s.highlight(e.text, r, e.lang || "");
      if (o instanceof Promise)
        throw new Error("markedHighlight is not set to async but the highlight function is async. Set the async option to true on markedHighlight to await the async highlight function.");
      updateToken(e)(o);
    },
    useNewRenderer: !0,
    renderer: {
      code(e, r, o) {
        typeof e == "object" && (o = e.escaped, r = e.lang, e = e.text);
        const m = getLang(r), _ = m ? s.langPrefix + escape$1(m) : s.emptyLangClass, g = _ ? ` class="${_}"` : "";
        return e = e.replace(/\n$/, ""), `<pre><code${g}>${o ? e : escape$1(e, !0)}
</code></pre>`;
      }
    }
  };
}
function getLang(s) {
  return (s || "").match(/\S*/)[0];
}
function updateToken(s) {
  return (e) => {
    typeof e == "string" && e !== s.text && (s.escaped = !0, s.text = e);
  };
}
const escapeTest = /[&<>"']/, escapeReplace = new RegExp(escapeTest.source, "g"), escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, "g"), escapeReplacements = {
  "&": "&amp;",
  "<": "&lt;",
  ">": "&gt;",
  '"': "&quot;",
  "'": "&#39;"
}, getEscapeReplacement = (s) => escapeReplacements[s];
function escape$1(s, e) {
  if (e) {
    if (escapeTest.test(s))
      return s.replace(escapeReplace, getEscapeReplacement);
  } else if (escapeTestNoEncode.test(s))
    return s.replace(escapeReplaceNoEncode, getEscapeReplacement);
  return s;
}
const regex = /[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g, own = Object.hasOwnProperty;
class BananaSlug {
  /**
   * Create a new slug class.
   */
  constructor() {
    this.occurrences, this.reset();
  }
  /**
   * Generate a unique slug.
  *
  * Tracks previously generated slugs: repeated calls with the same value
  * will result in different slugs.
  * Use the `slug` function to get same slugs.
   *
   * @param  {string} value
   *   String of text to slugify
   * @param  {boolean} [maintainCase=false]
   *   Keep the current case, otherwise make all lowercase
   * @return {string}
   *   A unique slug string
   */
  slug(e, r) {
    const o = this;
    let m = slug(e, r === !0);
    const _ = m;
    for (; own.call(o.occurrences, m); )
      o.occurrences[_]++, m = _ + "-" + o.occurrences[_];
    return o.occurrences[m] = 0, m;
  }
  /**
   * Reset - Forget all previous slugs
   *
   * @return void
   */
  reset() {
    this.occurrences = /* @__PURE__ */ Object.create(null);
  }
}
function slug(s, e) {
  return typeof s != "string" ? "" : (e || (s = s.toLowerCase()), s.replace(regex, "").replace(/ /g, "-"));
}
let slugger$1 = new BananaSlug(), headings = [];
function gfmHeadingId({ prefix: s = "", globalSlugs: e = !1 } = {}) {
  return {
    headerIds: !1,
    // prevent deprecation warning; remove this once headerIds option is removed
    hooks: {
      preprocess(r) {
        return e || resetHeadings(), r;
      }
    },
    renderer: {
      heading(r, o, m) {
        m = m.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi, "");
        const _ = `${s}${slugger$1.slug(m)}`, g = { level: o, text: r, id: _ };
        return headings.push(g), `<h${o} id="${_}">${r}</h${o}>
`;
      }
    }
  };
}
function resetHeadings() {
  headings = [], slugger$1 = new BananaSlug();
}
var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function getDefaultExportFromCjs(s) {
  return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
}
function getAugmentedNamespace(s) {
  if (s.__esModule) return s;
  var e = s.default;
  if (typeof e == "function") {
    var r = function o() {
      return this instanceof o ? Reflect.construct(e, arguments, this.constructor) : e.apply(this, arguments);
    };
    r.prototype = e.prototype;
  } else r = {};
  return Object.defineProperty(r, "__esModule", { value: !0 }), Object.keys(s).forEach(function(o) {
    var m = Object.getOwnPropertyDescriptor(s, o);
    Object.defineProperty(r, o, m.get ? m : {
      enumerable: !0,
      get: function() {
        return s[o];
      }
    });
  }), r;
}
var prism = { exports: {} };
(function(s) {
  var e = typeof window < "u" ? window : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : {};
  /**
   * Prism: Lightweight, robust, elegant syntax highlighting
   *
   * @license MIT <https://opensource.org/licenses/MIT>
   * @author Lea Verou <https://lea.verou.me>
   * @namespace
   * @public
   */
  var r = function(o) {
    var m = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i, _ = 0, g = {}, y = {
      /**
       * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
       * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
       * additional languages or plugins yourself.
       *
       * By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
       *
       * You obviously have to change this value before the automatic highlighting started. To do this, you can add an
       * empty Prism object into the global scope before loading the Prism script like this:
       *
       * ```js
       * window.Prism = window.Prism || {};
       * Prism.manual = true;
       * // add a new <script> to load Prism's script
       * ```
       *
       * @default false
       * @type {boolean}
       * @memberof Prism
       * @public
       */
      manual: o.Prism && o.Prism.manual,
      /**
       * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
       * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
       * own worker, you don't want it to do this.
       *
       * By setting this value to `true`, Prism will not add its own listeners to the worker.
       *
       * You obviously have to change this value before Prism executes. To do this, you can add an
       * empty Prism object into the global scope before loading the Prism script like this:
       *
       * ```js
       * window.Prism = window.Prism || {};
       * Prism.disableWorkerMessageHandler = true;
       * // Load Prism's script
       * ```
       *
       * @default false
       * @type {boolean}
       * @memberof Prism
       * @public
       */
      disableWorkerMessageHandler: o.Prism && o.Prism.disableWorkerMessageHandler,
      /**
       * A namespace for utility methods.
       *
       * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
       * change or disappear at any time.
       *
       * @namespace
       * @memberof Prism
       */
      util: {
        encode: function $(O) {
          return O instanceof E ? new E(O.type, $(O.content), O.alias) : Array.isArray(O) ? O.map($) : O.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ");
        },
        /**
         * Returns the name of the type of the given value.
         *
         * @param {any} o
         * @returns {string}
         * @example
         * type(null)      === 'Null'
         * type(undefined) === 'Undefined'
         * type(123)       === 'Number'
         * type('foo')     === 'String'
         * type(true)      === 'Boolean'
         * type([1, 2])    === 'Array'
         * type({})        === 'Object'
         * type(String)    === 'Function'
         * type(/abc+/)    === 'RegExp'
         */
        type: function($) {
          return Object.prototype.toString.call($).slice(8, -1);
        },
        /**
         * Returns a unique number for the given object. Later calls will still return the same number.
         *
         * @param {Object} obj
         * @returns {number}
         */
        objId: function($) {
          return $.__id || Object.defineProperty($, "__id", { value: ++_ }), $.__id;
        },
        /**
         * Creates a deep clone of the given object.
         *
         * The main intended use of this function is to clone language definitions.
         *
         * @param {T} o
         * @param {Record<number, any>} [visited]
         * @returns {T}
         * @template T
         */
        clone: function $(O, C) {
          C = C || {};
          var P, I;
          switch (y.util.type(O)) {
            case "Object":
              if (I = y.util.objId(O), C[I])
                return C[I];
              P = /** @type {Record<string, any>} */
              {}, C[I] = P;
              for (var N in O)
                O.hasOwnProperty(N) && (P[N] = $(O[N], C));
              return (
                /** @type {any} */
                P
              );
            case "Array":
              return I = y.util.objId(O), C[I] ? C[I] : (P = [], C[I] = P, /** @type {Array} */
              /** @type {any} */
              O.forEach(function(R, F) {
                P[F] = $(R, C);
              }), /** @type {any} */
              P);
            default:
              return O;
          }
        },
        /**
         * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
         *
         * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
         *
         * @param {Element} element
         * @returns {string}
         */
        getLanguage: function($) {
          for (; $; ) {
            var O = m.exec($.className);
            if (O)
              return O[1].toLowerCase();
            $ = $.parentElement;
          }
          return "none";
        },
        /**
         * Sets the Prism `language-xxxx` class of the given element.
         *
         * @param {Element} element
         * @param {string} language
         * @returns {void}
         */
        setLanguage: function($, O) {
          $.className = $.className.replace(RegExp(m, "gi"), ""), $.classList.add("language-" + O);
        },
        /**
         * Returns the script element that is currently executing.
         *
         * This does __not__ work for line script element.
         *
         * @returns {HTMLScriptElement | null}
         */
        currentScript: function() {
          if (typeof document > "u")
            return null;
          if ("currentScript" in document)
            return (
              /** @type {any} */
              document.currentScript
            );
          try {
            throw new Error();
          } catch (P) {
            var $ = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(P.stack) || [])[1];
            if ($) {
              var O = document.getElementsByTagName("script");
              for (var C in O)
                if (O[C].src == $)
                  return O[C];
            }
            return null;
          }
        },
        /**
         * Returns whether a given class is active for `element`.
         *
         * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
         * if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
         * given class is just the given class with a `no-` prefix.
         *
         * Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
         * closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
         * ancestors have the given class or the negated version of it, then the default activation will be returned.
         *
         * In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
         * version of it, the class is considered active.
         *
         * @param {Element} element
         * @param {string} className
         * @param {boolean} [defaultActivation=false]
         * @returns {boolean}
         */
        isActive: function($, O, C) {
          for (var P = "no-" + O; $; ) {
            var I = $.classList;
            if (I.contains(O))
              return !0;
            if (I.contains(P))
              return !1;
            $ = $.parentElement;
          }
          return !!C;
        }
      },
      /**
       * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
       *
       * @namespace
       * @memberof Prism
       * @public
       */
      languages: {
        /**
         * The grammar for plain, unformatted text.
         */
        plain: g,
        plaintext: g,
        text: g,
        txt: g,
        /**
         * Creates a deep copy of the language with the given id and appends the given tokens.
         *
         * If a token in `redef` also appears in the copied language, then the existing token in the copied language
         * will be overwritten at its original position.
         *
         * ## Best practices
         *
         * Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
         * doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
         * understand the language definition because, normally, the order of tokens matters in Prism grammars.
         *
         * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
         * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
         *
         * @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
         * @param {Grammar} redef The new tokens to append.
         * @returns {Grammar} The new language created.
         * @public
         * @example
         * Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
         *     // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
         *     // at its original position
         *     'comment': { ... },
         *     // CSS doesn't have a 'color' token, so this token will be appended
         *     'color': /\b(?:red|green|blue)\b/
         * });
         */
        extend: function($, O) {
          var C = y.util.clone(y.languages[$]);
          for (var P in O)
            C[P] = O[P];
          return C;
        },
        /**
         * Inserts tokens _before_ another token in a language definition or any other grammar.
         *
         * ## Usage
         *
         * This helper method makes it easy to modify existing languages. For example, the CSS language definition
         * not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
         * in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
         * appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
         * this:
         *
         * ```js
         * Prism.languages.markup.style = {
         *     // token
         * };
         * ```
         *
         * then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
         * before existing tokens. For the CSS example above, you would use it like this:
         *
         * ```js
         * Prism.languages.insertBefore('markup', 'cdata', {
         *     'style': {
         *         // token
         *     }
         * });
         * ```
         *
         * ## Special cases
         *
         * If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
         * will be ignored.
         *
         * This behavior can be used to insert tokens after `before`:
         *
         * ```js
         * Prism.languages.insertBefore('markup', 'comment', {
         *     'comment': Prism.languages.markup.comment,
         *     // tokens after 'comment'
         * });
         * ```
         *
         * ## Limitations
         *
         * The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
         * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
         * differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
         * deleting properties which is necessary to insert at arbitrary positions.
         *
         * To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
         * Instead, it will create a new object and replace all references to the target object with the new one. This
         * can be done without temporarily deleting properties, so the iteration order is well-defined.
         *
         * However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
         * you hold the target object in a variable, then the value of the variable will not change.
         *
         * ```js
         * var oldMarkup = Prism.languages.markup;
         * var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
         *
         * assert(oldMarkup !== Prism.languages.markup);
         * assert(newMarkup === Prism.languages.markup);
         * ```
         *
         * @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
         * object to be modified.
         * @param {string} before The key to insert before.
         * @param {Grammar} insert An object containing the key-value pairs to be inserted.
         * @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
         * object to be modified.
         *
         * Defaults to `Prism.languages`.
         * @returns {Grammar} The new grammar object.
         * @public
         */
        insertBefore: function($, O, C, P) {
          P = P || /** @type {any} */
          y.languages;
          var I = P[$], N = {};
          for (var R in I)
            if (I.hasOwnProperty(R)) {
              if (R == O)
                for (var F in C)
                  C.hasOwnProperty(F) && (N[F] = C[F]);
              C.hasOwnProperty(R) || (N[R] = I[R]);
            }
          var B = P[$];
          return P[$] = N, y.languages.DFS(y.languages, function(G, Q) {
            Q === B && G != $ && (this[G] = N);
          }), N;
        },
        // Traverse a language definition with Depth First Search
        DFS: function $(O, C, P, I) {
          I = I || {};
          var N = y.util.objId;
          for (var R in O)
            if (O.hasOwnProperty(R)) {
              C.call(O, R, O[R], P || R);
              var F = O[R], B = y.util.type(F);
              B === "Object" && !I[N(F)] ? (I[N(F)] = !0, $(F, C, null, I)) : B === "Array" && !I[N(F)] && (I[N(F)] = !0, $(F, C, R, I));
            }
        }
      },
      plugins: {},
      /**
       * This is the most high-level function in Prism’s API.
       * It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
       * each one of them.
       *
       * This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
       *
       * @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
       * @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
       * @memberof Prism
       * @public
       */
      highlightAll: function($, O) {
        y.highlightAllUnder(document, $, O);
      },
      /**
       * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
       * {@link Prism.highlightElement} on each one of them.
       *
       * The following hooks will be run:
       * 1. `before-highlightall`
       * 2. `before-all-elements-highlight`
       * 3. All hooks of {@link Prism.highlightElement} for each element.
       *
       * @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
       * @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
       * @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
       * @memberof Prism
       * @public
       */
      highlightAllUnder: function($, O, C) {
        var P = {
          callback: C,
          container: $,
          selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
        };
        y.hooks.run("before-highlightall", P), P.elements = Array.prototype.slice.apply(P.container.querySelectorAll(P.selector)), y.hooks.run("before-all-elements-highlight", P);
        for (var I = 0, N; N = P.elements[I++]; )
          y.highlightElement(N, O === !0, P.callback);
      },
      /**
       * Highlights the code inside a single element.
       *
       * The following hooks will be run:
       * 1. `before-sanity-check`
       * 2. `before-highlight`
       * 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
       * 4. `before-insert`
       * 5. `after-highlight`
       * 6. `complete`
       *
       * Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
       * the element's language.
       *
       * @param {Element} element The element containing the code.
       * It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
       * @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
       * to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
       * [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
       *
       * Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
       * asynchronous highlighting to work. You can build your own bundle on the
       * [Download page](https://prismjs.com/download.html).
       * @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
       * Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
       * @memberof Prism
       * @public
       */
      highlightElement: function($, O, C) {
        var P = y.util.getLanguage($), I = y.languages[P];
        y.util.setLanguage($, P);
        var N = $.parentElement;
        N && N.nodeName.toLowerCase() === "pre" && y.util.setLanguage(N, P);
        var R = $.textContent, F = {
          element: $,
          language: P,
          grammar: I,
          code: R
        };
        function B(Q) {
          F.highlightedCode = Q, y.hooks.run("before-insert", F), F.element.innerHTML = F.highlightedCode, y.hooks.run("after-highlight", F), y.hooks.run("complete", F), C && C.call(F.element);
        }
        if (y.hooks.run("before-sanity-check", F), N = F.element.parentElement, N && N.nodeName.toLowerCase() === "pre" && !N.hasAttribute("tabindex") && N.setAttribute("tabindex", "0"), !F.code) {
          y.hooks.run("complete", F), C && C.call(F.element);
          return;
        }
        if (y.hooks.run("before-highlight", F), !F.grammar) {
          B(y.util.encode(F.code));
          return;
        }
        if (O && o.Worker) {
          var G = new Worker(y.filename);
          G.onmessage = function(Q) {
            B(Q.data);
          }, G.postMessage(JSON.stringify({
            language: F.language,
            code: F.code,
            immediateClose: !0
          }));
        } else
          B(y.highlight(F.code, F.grammar, F.language));
      },
      /**
       * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
       * and the language definitions to use, and returns a string with the HTML produced.
       *
       * The following hooks will be run:
       * 1. `before-tokenize`
       * 2. `after-tokenize`
       * 3. `wrap`: On each {@link Token}.
       *
       * @param {string} text A string with the code to be highlighted.
       * @param {Grammar} grammar An object containing the tokens to use.
       *
       * Usually a language definition like `Prism.languages.markup`.
       * @param {string} language The name of the language definition passed to `grammar`.
       * @returns {string} The highlighted HTML.
       * @memberof Prism
       * @public
       * @example
       * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
       */
      highlight: function($, O, C) {
        var P = {
          code: $,
          grammar: O,
          language: C
        };
        if (y.hooks.run("before-tokenize", P), !P.grammar)
          throw new Error('The language "' + P.language + '" has no grammar.');
        return P.tokens = y.tokenize(P.code, P.grammar), y.hooks.run("after-tokenize", P), E.stringify(y.util.encode(P.tokens), P.language);
      },
      /**
       * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
       * and the language definitions to use, and returns an array with the tokenized code.
       *
       * When the language definition includes nested tokens, the function is called recursively on each of these tokens.
       *
       * This method could be useful in other contexts as well, as a very crude parser.
       *
       * @param {string} text A string with the code to be highlighted.
       * @param {Grammar} grammar An object containing the tokens to use.
       *
       * Usually a language definition like `Prism.languages.markup`.
       * @returns {TokenStream} An array of strings and tokens, a token stream.
       * @memberof Prism
       * @public
       * @example
       * let code = `var foo = 0;`;
       * let tokens = Prism.tokenize(code, Prism.languages.javascript);
       * tokens.forEach(token => {
       *     if (token instanceof Prism.Token && token.type === 'number') {
       *         console.log(`Found numeric literal: ${token.content}`);
       *     }
       * });
       */
      tokenize: function($, O) {
        var C = O.rest;
        if (C) {
          for (var P in C)
            O[P] = C[P];
          delete O.rest;
        }
        var I = new h();
        return a(I, I.head, $), v($, I, O, I.head, 0), w(I);
      },
      /**
       * @namespace
       * @memberof Prism
       * @public
       */
      hooks: {
        all: {},
        /**
         * Adds the given callback to the list of callbacks for the given hook.
         *
         * The callback will be invoked when the hook it is registered for is run.
         * Hooks are usually directly run by a highlight function but you can also run hooks yourself.
         *
         * One callback function can be registered to multiple hooks and the same hook multiple times.
         *
         * @param {string} name The name of the hook.
         * @param {HookCallback} callback The callback function which is given environment variables.
         * @public
         */
        add: function($, O) {
          var C = y.hooks.all;
          C[$] = C[$] || [], C[$].push(O);
        },
        /**
         * Runs a hook invoking all registered callbacks with the given environment variables.
         *
         * Callbacks will be invoked synchronously and in the order in which they were registered.
         *
         * @param {string} name The name of the hook.
         * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
         * @public
         */
        run: function($, O) {
          var C = y.hooks.all[$];
          if (!(!C || !C.length))
            for (var P = 0, I; I = C[P++]; )
              I(O);
        }
      },
      Token: E
    };
    o.Prism = y;
    function E($, O, C, P) {
      this.type = $, this.content = O, this.alias = C, this.length = (P || "").length | 0;
    }
    E.stringify = function $(O, C) {
      if (typeof O == "string")
        return O;
      if (Array.isArray(O)) {
        var P = "";
        return O.forEach(function(B) {
          P += $(B, C);
        }), P;
      }
      var I = {
        type: O.type,
        content: $(O.content, C),
        tag: "span",
        classes: ["token", O.type],
        attributes: {},
        language: C
      }, N = O.alias;
      N && (Array.isArray(N) ? Array.prototype.push.apply(I.classes, N) : I.classes.push(N)), y.hooks.run("wrap", I);
      var R = "";
      for (var F in I.attributes)
        R += " " + F + '="' + (I.attributes[F] || "").replace(/"/g, "&quot;") + '"';
      return "<" + I.tag + ' class="' + I.classes.join(" ") + '"' + R + ">" + I.content + "</" + I.tag + ">";
    };
    function x($, O, C, P) {
      $.lastIndex = O;
      var I = $.exec(C);
      if (I && P && I[1]) {
        var N = I[1].length;
        I.index += N, I[0] = I[0].slice(N);
      }
      return I;
    }
    function v($, O, C, P, I, N) {
      for (var R in C)
        if (!(!C.hasOwnProperty(R) || !C[R])) {
          var F = C[R];
          F = Array.isArray(F) ? F : [F];
          for (var B = 0; B < F.length; ++B) {
            if (N && N.cause == R + "," + B)
              return;
            var G = F[B], Q = G.inside, ee = !!G.lookbehind, Y = !!G.greedy, W = G.alias;
            if (Y && !G.pattern.global) {
              var j = G.pattern.toString().match(/[imsuy]*$/)[0];
              G.pattern = RegExp(G.pattern.source, j + "g");
            }
            for (var J = G.pattern || G, me = P.next, pe = I; me !== O.tail && !(N && pe >= N.reach); pe += me.value.length, me = me.next) {
              var ye = me.value;
              if (O.length > $.length)
                return;
              if (!(ye instanceof E)) {
                var oe = 1, we;
                if (Y) {
                  if (we = x(J, pe, $, ee), !we || we.index >= $.length)
                    break;
                  var Oe = we.index, Se = we.index + we[0].length, Me = pe;
                  for (Me += me.value.length; Oe >= Me; )
                    me = me.next, Me += me.value.length;
                  if (Me -= me.value.length, pe = Me, me.value instanceof E)
                    continue;
                  for (var de = me; de !== O.tail && (Me < Se || typeof de.value == "string"); de = de.next)
                    oe++, Me += de.value.length;
                  oe--, ye = $.slice(pe, Me), we.index -= pe;
                } else if (we = x(J, 0, ye, ee), !we)
                  continue;
                var Oe = we.index, $e = we[0], ge = ye.slice(0, Oe), Ye = ye.slice(Oe + $e.length), Ie = pe + ye.length;
                N && Ie > N.reach && (N.reach = Ie);
                var Ge = me.prev;
                ge && (Ge = a(O, Ge, ge), pe += ge.length), b(O, Ge, oe);
                var Ke = new E(R, Q ? y.tokenize($e, Q) : $e, W, $e);
                if (me = a(O, Ge, Ke), Ye && a(O, me, Ye), oe > 1) {
                  var Ne = {
                    cause: R + "," + B,
                    reach: Ie
                  };
                  v($, O, C, me.prev, pe, Ne), N && Ne.reach > N.reach && (N.reach = Ne.reach);
                }
              }
            }
          }
        }
    }
    function h() {
      var $ = { value: null, prev: null, next: null }, O = { value: null, prev: $, next: null };
      $.next = O, this.head = $, this.tail = O, this.length = 0;
    }
    function a($, O, C) {
      var P = O.next, I = { value: C, prev: O, next: P };
      return O.next = I, P.prev = I, $.length++, I;
    }
    function b($, O, C) {
      for (var P = O.next, I = 0; I < C && P !== $.tail; I++)
        P = P.next;
      O.next = P, P.prev = O, $.length -= I;
    }
    function w($) {
      for (var O = [], C = $.head.next; C !== $.tail; )
        O.push(C.value), C = C.next;
      return O;
    }
    if (!o.document)
      return o.addEventListener && (y.disableWorkerMessageHandler || o.addEventListener("message", function($) {
        var O = JSON.parse($.data), C = O.language, P = O.code, I = O.immediateClose;
        o.postMessage(y.highlight(P, y.languages[C], C)), I && o.close();
      }, !1)), y;
    var k = y.util.currentScript();
    k && (y.filename = k.src, k.hasAttribute("data-manual") && (y.manual = !0));
    function A() {
      y.manual || y.highlightAll();
    }
    if (!y.manual) {
      var M = document.readyState;
      M === "loading" || M === "interactive" && k && k.defer ? document.addEventListener("DOMContentLoaded", A) : window.requestAnimationFrame ? window.requestAnimationFrame(A) : window.setTimeout(A, 16);
    }
    return y;
  }(e);
  s.exports && (s.exports = r), typeof commonjsGlobal < "u" && (commonjsGlobal.Prism = r), r.languages.markup = {
    comment: {
      pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
      greedy: !0
    },
    prolog: {
      pattern: /<\?[\s\S]+?\?>/,
      greedy: !0
    },
    doctype: {
      // https://www.w3.org/TR/xml/#NT-doctypedecl
      pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
      greedy: !0,
      inside: {
        "internal-subset": {
          pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
          lookbehind: !0,
          greedy: !0,
          inside: null
          // see below
        },
        string: {
          pattern: /"[^"]*"|'[^']*'/,
          greedy: !0
        },
        punctuation: /^<!|>$|[[\]]/,
        "doctype-tag": /^DOCTYPE/i,
        name: /[^\s<>'"]+/
      }
    },
    cdata: {
      pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
      greedy: !0
    },
    tag: {
      pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
      greedy: !0,
      inside: {
        tag: {
          pattern: /^<\/?[^\s>\/]+/,
          inside: {
            punctuation: /^<\/?/,
            namespace: /^[^\s>\/:]+:/
          }
        },
        "special-attr": [],
        "attr-value": {
          pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
          inside: {
            punctuation: [
              {
                pattern: /^=/,
                alias: "attr-equals"
              },
              {
                pattern: /^(\s*)["']|["']$/,
                lookbehind: !0
              }
            ]
          }
        },
        punctuation: /\/?>/,
        "attr-name": {
          pattern: /[^\s>\/]+/,
          inside: {
            namespace: /^[^\s>\/:]+:/
          }
        }
      }
    },
    entity: [
      {
        pattern: /&[\da-z]{1,8};/i,
        alias: "named-entity"
      },
      /&#x?[\da-f]{1,8};/i
    ]
  }, r.languages.markup.tag.inside["attr-value"].inside.entity = r.languages.markup.entity, r.languages.markup.doctype.inside["internal-subset"].inside = r.languages.markup, r.hooks.add("wrap", function(o) {
    o.type === "entity" && (o.attributes.title = o.content.replace(/&amp;/, "&"));
  }), Object.defineProperty(r.languages.markup.tag, "addInlined", {
    /**
     * Adds an inlined language to markup.
     *
     * An example of an inlined language is CSS with `<style>` tags.
     *
     * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
     * case insensitive.
     * @param {string} lang The language key.
     * @example
     * addInlined('style', 'css');
     */
    value: function(m, _) {
      var g = {};
      g["language-" + _] = {
        pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
        lookbehind: !0,
        inside: r.languages[_]
      }, g.cdata = /^<!\[CDATA\[|\]\]>$/i;
      var y = {
        "included-cdata": {
          pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
          inside: g
        }
      };
      y["language-" + _] = {
        pattern: /[\s\S]+/,
        inside: r.languages[_]
      };
      var E = {};
      E[m] = {
        pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
          return m;
        }), "i"),
        lookbehind: !0,
        greedy: !0,
        inside: y
      }, r.languages.insertBefore("markup", "cdata", E);
    }
  }), Object.defineProperty(r.languages.markup.tag, "addAttribute", {
    /**
     * Adds an pattern to highlight languages embedded in HTML attributes.
     *
     * An example of an inlined language is CSS with `style` attributes.
     *
     * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
     * case insensitive.
     * @param {string} lang The language key.
     * @example
     * addAttribute('style', 'css');
     */
    value: function(o, m) {
      r.languages.markup.tag.inside["special-attr"].push({
        pattern: RegExp(
          /(^|["'\s])/.source + "(?:" + o + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
          "i"
        ),
        lookbehind: !0,
        inside: {
          "attr-name": /^[^\s=]+/,
          "attr-value": {
            pattern: /=[\s\S]+/,
            inside: {
              value: {
                pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
                lookbehind: !0,
                alias: [m, "language-" + m],
                inside: r.languages[m]
              },
              punctuation: [
                {
                  pattern: /^=/,
                  alias: "attr-equals"
                },
                /"|'/
              ]
            }
          }
        }
      });
    }
  }), r.languages.html = r.languages.markup, r.languages.mathml = r.languages.markup, r.languages.svg = r.languages.markup, r.languages.xml = r.languages.extend("markup", {}), r.languages.ssml = r.languages.xml, r.languages.atom = r.languages.xml, r.languages.rss = r.languages.xml, function(o) {
    var m = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
    o.languages.css = {
      comment: /\/\*[\s\S]*?\*\//,
      atrule: {
        pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + m.source + ")*?" + /(?:;|(?=\s*\{))/.source),
        inside: {
          rule: /^@[\w-]+/,
          "selector-function-argument": {
            pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
            lookbehind: !0,
            alias: "selector"
          },
          keyword: {
            pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
            lookbehind: !0
          }
          // See rest below
        }
      },
      url: {
        // https://drafts.csswg.org/css-values-3/#urls
        pattern: RegExp("\\burl\\((?:" + m.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
        greedy: !0,
        inside: {
          function: /^url/i,
          punctuation: /^\(|\)$/,
          string: {
            pattern: RegExp("^" + m.source + "$"),
            alias: "url"
          }
        }
      },
      selector: {
        pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` + m.source + ")*(?=\\s*\\{)"),
        lookbehind: !0
      },
      string: {
        pattern: m,
        greedy: !0
      },
      property: {
        pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
        lookbehind: !0
      },
      important: /!important\b/i,
      function: {
        pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
        lookbehind: !0
      },
      punctuation: /[(){};:,]/
    }, o.languages.css.atrule.inside.rest = o.languages.css;
    var _ = o.languages.markup;
    _ && (_.tag.addInlined("style", "css"), _.tag.addAttribute("style", "css"));
  }(r), r.languages.clike = {
    comment: [
      {
        pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
        lookbehind: !0,
        greedy: !0
      },
      {
        pattern: /(^|[^\\:])\/\/.*/,
        lookbehind: !0,
        greedy: !0
      }
    ],
    string: {
      pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
      greedy: !0
    },
    "class-name": {
      pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
      lookbehind: !0,
      inside: {
        punctuation: /[.\\]/
      }
    },
    keyword: /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
    boolean: /\b(?:false|true)\b/,
    function: /\b\w+(?=\()/,
    number: /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
    operator: /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
    punctuation: /[{}[\];(),.:]/
  }, r.languages.javascript = r.languages.extend("clike", {
    "class-name": [
      r.languages.clike["class-name"],
      {
        pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
        lookbehind: !0
      }
    ],
    keyword: [
      {
        pattern: /((?:^|\})\s*)catch\b/,
        lookbehind: !0
      },
      {
        pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
        lookbehind: !0
      }
    ],
    // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
    function: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
    number: {
      pattern: RegExp(
        /(^|[^\w$])/.source + "(?:" + // constant
        (/NaN|Infinity/.source + "|" + // binary integer
        /0[bB][01]+(?:_[01]+)*n?/.source + "|" + // octal integer
        /0[oO][0-7]+(?:_[0-7]+)*n?/.source + "|" + // hexadecimal integer
        /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + "|" + // decimal bigint
        /\d+(?:_\d+)*n/.source + "|" + // decimal number (integer or float) but no bigint
        /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ")" + /(?![\w$])/.source
      ),
      lookbehind: !0
    },
    operator: /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
  }), r.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/, r.languages.insertBefore("javascript", "keyword", {
    regex: {
      pattern: RegExp(
        // lookbehind
        // eslint-disable-next-line regexp/no-dupe-characters-character-class
        /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source + // Regex pattern:
        // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
        // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
        // with the only syntax, so we have to define 2 different regex patterns.
        /\//.source + "(?:" + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + "|" + // `v` flag syntax. This supports 3 levels of nested character classes.
        /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ")" + // lookahead
        /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
      ),
      lookbehind: !0,
      greedy: !0,
      inside: {
        "regex-source": {
          pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
          lookbehind: !0,
          alias: "language-regex",
          inside: r.languages.regex
        },
        "regex-delimiter": /^\/|\/$/,
        "regex-flags": /^[a-z]+$/
      }
    },
    // This must be declared before keyword because we use "function" inside the look-forward
    "function-variable": {
      pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
      alias: "function"
    },
    parameter: [
      {
        pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
        lookbehind: !0,
        inside: r.languages.javascript
      },
      {
        pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
        lookbehind: !0,
        inside: r.languages.javascript
      },
      {
        pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
        lookbehind: !0,
        inside: r.languages.javascript
      },
      {
        pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
        lookbehind: !0,
        inside: r.languages.javascript
      }
    ],
    constant: /\b[A-Z](?:[A-Z_]|\dx?)*\b/
  }), r.languages.insertBefore("javascript", "string", {
    hashbang: {
      pattern: /^#!.*/,
      greedy: !0,
      alias: "comment"
    },
    "template-string": {
      pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
      greedy: !0,
      inside: {
        "template-punctuation": {
          pattern: /^`|`$/,
          alias: "string"
        },
        interpolation: {
          pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
          lookbehind: !0,
          inside: {
            "interpolation-punctuation": {
              pattern: /^\$\{|\}$/,
              alias: "punctuation"
            },
            rest: r.languages.javascript
          }
        },
        string: /[\s\S]+/
      }
    },
    "string-property": {
      pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
      lookbehind: !0,
      greedy: !0,
      alias: "property"
    }
  }), r.languages.insertBefore("javascript", "operator", {
    "literal-property": {
      pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
      lookbehind: !0,
      alias: "property"
    }
  }), r.languages.markup && (r.languages.markup.tag.addInlined("script", "javascript"), r.languages.markup.tag.addAttribute(
    /on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,
    "javascript"
  )), r.languages.js = r.languages.javascript, function() {
    if (typeof r > "u" || typeof document > "u")
      return;
    Element.prototype.matches || (Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector);
    var o = "Loading…", m = function(k, A) {
      return "✖ Error " + k + " while fetching file: " + A;
    }, _ = "✖ Error: File does not exist or is empty", g = {
      js: "javascript",
      py: "python",
      rb: "ruby",
      ps1: "powershell",
      psm1: "powershell",
      sh: "bash",
      bat: "batch",
      h: "c",
      tex: "latex"
    }, y = "data-src-status", E = "loading", x = "loaded", v = "failed", h = "pre[data-src]:not([" + y + '="' + x + '"]):not([' + y + '="' + E + '"])';
    function a(k, A, M) {
      var $ = new XMLHttpRequest();
      $.open("GET", k, !0), $.onreadystatechange = function() {
        $.readyState == 4 && ($.status < 400 && $.responseText ? A($.responseText) : $.status >= 400 ? M(m($.status, $.statusText)) : M(_));
      }, $.send(null);
    }
    function b(k) {
      var A = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(k || "");
      if (A) {
        var M = Number(A[1]), $ = A[2], O = A[3];
        return $ ? O ? [M, Number(O)] : [M, void 0] : [M, M];
      }
    }
    r.hooks.add("before-highlightall", function(k) {
      k.selector += ", " + h;
    }), r.hooks.add("before-sanity-check", function(k) {
      var A = (
        /** @type {HTMLPreElement} */
        k.element
      );
      if (A.matches(h)) {
        k.code = "", A.setAttribute(y, E);
        var M = A.appendChild(document.createElement("CODE"));
        M.textContent = o;
        var $ = A.getAttribute("data-src"), O = k.language;
        if (O === "none") {
          var C = (/\.(\w+)$/.exec($) || [, "none"])[1];
          O = g[C] || C;
        }
        r.util.setLanguage(M, O), r.util.setLanguage(A, O);
        var P = r.plugins.autoloader;
        P && P.loadLanguages(O), a(
          $,
          function(I) {
            A.setAttribute(y, x);
            var N = b(A.getAttribute("data-range"));
            if (N) {
              var R = I.split(/\r\n?|\n/g), F = N[0], B = N[1] == null ? R.length : N[1];
              F < 0 && (F += R.length), F = Math.max(0, Math.min(F - 1, R.length)), B < 0 && (B += R.length), B = Math.max(0, Math.min(B, R.length)), I = R.slice(F, B).join(`
`), A.hasAttribute("data-start") || A.setAttribute("data-start", String(F + 1));
            }
            M.textContent = I, r.highlightElement(M);
          },
          function(I) {
            A.setAttribute(y, v), M.textContent = I;
          }
        );
      }
    }), r.plugins.fileHighlight = {
      /**
       * Executes the File Highlight plugin for all matching `pre` elements under the given container.
       *
       * Note: Elements which are already loaded or currently loading will not be touched by this method.
       *
       * @param {ParentNode} [container=document]
       */
      highlight: function(A) {
        for (var M = (A || document).querySelectorAll(h), $ = 0, O; O = M[$++]; )
          r.highlightElement(O);
      }
    };
    var w = !1;
    r.fileHighlight = function() {
      w || (console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."), w = !0), r.plugins.fileHighlight.highlight.apply(this, arguments);
    };
  }();
})(prism);
var prismExports = prism.exports;
Prism.languages.python = {
  comment: {
    pattern: /(^|[^\\])#.*/,
    lookbehind: !0,
    greedy: !0
  },
  "string-interpolation": {
    pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
    greedy: !0,
    inside: {
      interpolation: {
        // "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
        pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
        lookbehind: !0,
        inside: {
          "format-spec": {
            pattern: /(:)[^:(){}]+(?=\}$)/,
            lookbehind: !0
          },
          "conversion-option": {
            pattern: /![sra](?=[:}]$)/,
            alias: "punctuation"
          },
          rest: null
        }
      },
      string: /[\s\S]+/
    }
  },
  "triple-quoted-string": {
    pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
    greedy: !0,
    alias: "string"
  },
  string: {
    pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
    greedy: !0
  },
  function: {
    pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
    lookbehind: !0
  },
  "class-name": {
    pattern: /(\bclass\s+)\w+/i,
    lookbehind: !0
  },
  decorator: {
    pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
    lookbehind: !0,
    alias: ["annotation", "punctuation"],
    inside: {
      punctuation: /\./
    }
  },
  keyword: /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
  builtin: /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
  boolean: /\b(?:False|None|True)\b/,
  number: /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
  operator: /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
  punctuation: /[{}[\];(),.:]/
};
Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest = Prism.languages.python;
Prism.languages.py = Prism.languages.python;
(function(s) {
  var e = /\\(?:[^a-z()[\]]|[a-z*]+)/i, r = {
    "equation-command": {
      pattern: e,
      alias: "regex"
    }
  };
  s.languages.latex = {
    comment: /%.*/,
    // the verbatim environment prints whitespace to the document
    cdata: {
      pattern: /(\\begin\{((?:lstlisting|verbatim)\*?)\})[\s\S]*?(?=\\end\{\2\})/,
      lookbehind: !0
    },
    /*
     * equations can be between $$ $$ or $ $ or \( \) or \[ \]
     * (all are multiline)
     */
    equation: [
      {
        pattern: /\$\$(?:\\[\s\S]|[^\\$])+\$\$|\$(?:\\[\s\S]|[^\\$])+\$|\\\([\s\S]*?\\\)|\\\[[\s\S]*?\\\]/,
        inside: r,
        alias: "string"
      },
      {
        pattern: /(\\begin\{((?:align|eqnarray|equation|gather|math|multline)\*?)\})[\s\S]*?(?=\\end\{\2\})/,
        lookbehind: !0,
        inside: r,
        alias: "string"
      }
    ],
    /*
     * arguments which are keywords or references are highlighted
     * as keywords
     */
    keyword: {
      pattern: /(\\(?:begin|cite|documentclass|end|label|ref|usepackage)(?:\[[^\]]+\])?\{)[^}]+(?=\})/,
      lookbehind: !0
    },
    url: {
      pattern: /(\\url\{)[^}]+(?=\})/,
      lookbehind: !0
    },
    /*
     * section or chapter headlines are highlighted as bold so that
     * they stand out more
     */
    headline: {
      pattern: /(\\(?:chapter|frametitle|paragraph|part|section|subparagraph|subsection|subsubparagraph|subsubsection|subsubsubparagraph)\*?(?:\[[^\]]+\])?\{)[^}]+(?=\})/,
      lookbehind: !0,
      alias: "class-name"
    },
    function: {
      pattern: e,
      alias: "selector"
    },
    punctuation: /[[\]{}&]/
  }, s.languages.tex = s.languages.latex, s.languages.context = s.languages.latex;
})(Prism);
(function(s) {
  var e = "\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b", r = {
    pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
    lookbehind: !0,
    alias: "punctuation",
    // this looks reasonably well in all themes
    inside: null
    // see below
  }, o = {
    bash: r,
    environment: {
      pattern: RegExp("\\$" + e),
      alias: "constant"
    },
    variable: [
      // [0]: Arithmetic Environment
      {
        pattern: /\$?\(\([\s\S]+?\)\)/,
        greedy: !0,
        inside: {
          // If there is a $ sign at the beginning highlight $(( and )) as variable
          variable: [
            {
              pattern: /(^\$\(\([\s\S]+)\)\)/,
              lookbehind: !0
            },
            /^\$\(\(/
          ],
          number: /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
          // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
          operator: /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
          // If there is no $ sign at the beginning highlight (( and )) as punctuation
          punctuation: /\(\(?|\)\)?|,|;/
        }
      },
      // [1]: Command Substitution
      {
        pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
        greedy: !0,
        inside: {
          variable: /^\$\(|^`|\)$|`$/
        }
      },
      // [2]: Brace expansion
      {
        pattern: /\$\{[^}]+\}/,
        greedy: !0,
        inside: {
          operator: /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
          punctuation: /[\[\]]/,
          environment: {
            pattern: RegExp("(\\{)" + e),
            lookbehind: !0,
            alias: "constant"
          }
        }
      },
      /\$(?:\w+|[#?*!@$])/
    ],
    // Escape sequences from echo and printf's manuals, and escaped quotes.
    entity: /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/
  };
  s.languages.bash = {
    shebang: {
      pattern: /^#!\s*\/.*/,
      alias: "important"
    },
    comment: {
      pattern: /(^|[^"{\\$])#.*/,
      lookbehind: !0
    },
    "function-name": [
      // a) function foo {
      // b) foo() {
      // c) function foo() {
      // but not “foo {”
      {
        // a) and c)
        pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
        lookbehind: !0,
        alias: "function"
      },
      {
        // b)
        pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
        alias: "function"
      }
    ],
    // Highlight variable names as variables in for and select beginnings.
    "for-or-select": {
      pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
      alias: "variable",
      lookbehind: !0
    },
    // Highlight variable names as variables in the left-hand part
    // of assignments (“=” and “+=”).
    "assign-left": {
      pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
      inside: {
        environment: {
          pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + e),
          lookbehind: !0,
          alias: "constant"
        }
      },
      alias: "variable",
      lookbehind: !0
    },
    // Highlight parameter names as variables
    parameter: {
      pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,
      alias: "variable",
      lookbehind: !0
    },
    string: [
      // Support for Here-documents https://en.wikipedia.org/wiki/Here_document
      {
        pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
        lookbehind: !0,
        greedy: !0,
        inside: o
      },
      // Here-document with quotes around the tag
      // → No expansion (so no “inside”).
      {
        pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
        lookbehind: !0,
        greedy: !0,
        inside: {
          bash: r
        }
      },
      // “Normal” string
      {
        // https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
        pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
        lookbehind: !0,
        greedy: !0,
        inside: o
      },
      {
        // https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
        pattern: /(^|[^$\\])'[^']*'/,
        lookbehind: !0,
        greedy: !0
      },
      {
        // https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html
        pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
        greedy: !0,
        inside: {
          entity: o.entity
        }
      }
    ],
    environment: {
      pattern: RegExp("\\$?" + e),
      alias: "constant"
    },
    variable: o.variable,
    function: {
      pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
      lookbehind: !0
    },
    keyword: {
      pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
      lookbehind: !0
    },
    // https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
    builtin: {
      pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,
      lookbehind: !0,
      // Alias added to make those easier to distinguish from strings.
      alias: "class-name"
    },
    boolean: {
      pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
      lookbehind: !0
    },
    "file-descriptor": {
      pattern: /\B&\d\b/,
      alias: "important"
    },
    operator: {
      // Lots of redirections here, but not just that.
      pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
      inside: {
        "file-descriptor": {
          pattern: /^\d/,
          alias: "important"
        }
      }
    },
    punctuation: /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
    number: {
      pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
      lookbehind: !0
    }
  }, r.inside = s.languages.bash;
  for (var m = [
    "comment",
    "function-name",
    "for-or-select",
    "assign-left",
    "parameter",
    "string",
    "environment",
    "function",
    "keyword",
    "builtin",
    "boolean",
    "file-descriptor",
    "operator",
    "punctuation",
    "number"
  ], _ = o.variable[1].inside, g = 0; g < m.length; g++)
    _[m[g]] = s.languages.bash[m[g]];
  s.languages.sh = s.languages.bash, s.languages.shell = s.languages.bash;
})(Prism);
const LINK_ICON_CODE = '<svg class="md-link-icon" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true" fill="currentColor"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>', COPY_ICON_CODE = `
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15" color="currentColor" aria-hidden="true" aria-label="Copy" stroke-width="1.3" width="15" height="15">
  <path fill="currentColor" d="M12.728 4.545v8.182H4.545V4.545zm0 -0.909H4.545a0.909 0.909 0 0 0 -0.909 0.909v8.182a0.909 0.909 0 0 0 0.909 0.909h8.182a0.909 0.909 0 0 0 0.909 -0.909V4.545a0.909 0.909 0 0 0 -0.909 -0.909"/>
  <path fill="currentColor" d="M1.818 8.182H0.909V1.818a0.909 0.909 0 0 1 0.909 -0.909h6.364v0.909H1.818Z"/>
</svg>

`, CHECK_ICON_CODE = `<svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" viewBox="0 0 17 17" aria-hidden="true" aria-label="Copied" fill="none" stroke="currentColor" stroke-width="1.3">
  <path d="m13.813 4.781 -7.438 7.438 -3.188 -3.188"/>
</svg>
`, COPY_BUTTON_CODE = `<button title="copy" class="copy_code_button">
  <span class="copy-text">${COPY_ICON_CODE}</span>
  <span class="check">${CHECK_ICON_CODE}</span>
</button>`, escape_test = /[&<>"']/, escape_replace = new RegExp(escape_test.source, "g"), escape_test_no_encode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escape_replace_no_encode = new RegExp(escape_test_no_encode.source, "g"), escape_replacements = {
  "&": "&amp;",
  "<": "&lt;",
  ">": "&gt;",
  '"': "&quot;",
  "'": "&#39;"
}, get_escape_replacement = (s) => escape_replacements[s] || "";
function escape(s, e) {
  if (e) {
    if (escape_test.test(s))
      return s.replace(escape_replace, get_escape_replacement);
  } else if (escape_test_no_encode.test(s))
    return s.replace(escape_replace_no_encode, get_escape_replacement);
  return s;
}
function createLatexTokenizer(s) {
  const e = s.map((r) => ({
    start: new RegExp(r.left.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&")),
    end: new RegExp(r.right.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"))
  }));
  return {
    name: "latex",
    level: "block",
    start(r) {
      for (const o of e) {
        const m = r.match(o.start);
        if (m)
          return m.index;
      }
      return -1;
    },
    tokenizer(r, o) {
      for (const m of e) {
        const _ = new RegExp(
          `${m.start.source}([\\s\\S]+?)${m.end.source}`
        ).exec(r);
        if (_)
          return {
            type: "latex",
            raw: _[0],
            text: _[1].trim()
          };
      }
    },
    renderer(r) {
      return `<div class="latex-block">${r.text}</div>`;
    }
  };
}
function createMermaidTokenizer() {
  return {
    name: "mermaid",
    level: "block",
    start(s) {
      var e;
      return (e = s.match(/^```mermaid\s*\n/)) == null ? void 0 : e.index;
    },
    tokenizer(s) {
      const e = /^```mermaid\s*\n([\s\S]*?)```\s*(?:\n|$)/.exec(s);
      if (e)
        return {
          type: "mermaid",
          raw: e[0],
          text: e[1].trim()
        };
    },
    renderer(s) {
      return `<div class="mermaid">${s.text}</div>
`;
    }
  };
}
const renderer = {
  code(s, e, r) {
    var m;
    const o = ((m = (e ?? "").match(/\S*/)) == null ? void 0 : m[0]) ?? "";
    return s = s.replace(/\n$/, "") + `
`, !o || o === "mermaid" ? '<div class="code_wrap">' + COPY_BUTTON_CODE + "<pre><code>" + (r ? s : escape(s, !0)) + `</code></pre></div>
` : '<div class="code_wrap">' + COPY_BUTTON_CODE + '<pre><code class="language-' + escape(o) + '">' + (r ? s : escape(s, !0)) + `</code></pre></div>
`;
  }
}, slugger = new BananaSlug();
function create_marked({
  header_links: s,
  line_breaks: e,
  latex_delimiters: r
}) {
  const o = new Marked();
  o.use(
    {
      gfm: !0,
      pedantic: !1,
      breaks: e
    },
    markedHighlight({
      highlight: (g, y) => {
        var E;
        return (E = prismExports.languages) != null && E[y] ? prismExports.highlight(g, prismExports.languages[y], y) : g;
      }
    }),
    { renderer }
  ), s && (o.use(gfmHeadingId()), o.use({
    extensions: [
      {
        name: "heading",
        level: "block",
        renderer(g) {
          const y = g.raw.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi, ""), E = "h" + slugger.slug(y), x = g.depth, v = this.parser.parseInline(g.tokens);
          return `<h${x} id="${E}"><a class="md-header-anchor" href="#${E}">${LINK_ICON_CODE}</a>${v}</h${x}>
`;
        }
      }
    ]
  }));
  const m = createMermaidTokenizer(), _ = createLatexTokenizer(r);
  return o.use({
    extensions: [m, _]
  }), o;
}
const cloneDeep = (s) => JSON.parse(JSON.stringify(s)), isElement = (s) => s.nodeType === 1, isElementFunky = (s) => FUNKY_TAG_NAMES.has(s.tagName), isElementAction = (s) => "action" in s, isElementIframe = (s) => s.tagName === "IFRAME", isElementFormAction = (s) => "formAction" in s, isElementHyperlink = (s) => "protocol" in s, isScriptOrDataUrl = /* @__PURE__ */ (() => {
  const s = /^(?:\w+script|data):/i;
  return (e) => s.test(e);
})(), isScriptOrDataUrlLoose = /* @__PURE__ */ (() => {
  const s = /(?:script|data):/i;
  return (e) => s.test(e);
})(), mergeMaps = (s) => {
  const e = {};
  for (let r = 0, o = s.length; r < o; r++) {
    const m = s[r];
    for (const _ in m)
      e[_] ? e[_] = e[_].concat(m[_]) : e[_] = m[_];
  }
  return e;
}, traverseElementsBasic = (s, e) => {
  let r = s.firstChild;
  for (; r; ) {
    const o = r.nextSibling;
    isElement(r) && (e(r, s), r.parentNode && traverseElementsBasic(r, e)), r = o;
  }
}, traverseElementsIterator = (s, e) => {
  const r = document.createNodeIterator(s, NodeFilter.SHOW_ELEMENT);
  let o;
  for (; o = r.nextNode(); ) {
    const m = o.parentNode;
    m && e(o, m);
  }
}, traverseElements = (s, e) => !!globalThis.document && !!globalThis.document.createNodeIterator ? traverseElementsIterator(s, e) : traverseElementsBasic(s, e), HTML_ELEMENTS_ALLOW = [
  "a",
  "abbr",
  "acronym",
  "address",
  "area",
  "article",
  "aside",
  "audio",
  "b",
  "bdi",
  "bdo",
  "bgsound",
  "big",
  "blockquote",
  "body",
  "br",
  "button",
  "canvas",
  "caption",
  "center",
  "cite",
  "code",
  "col",
  "colgroup",
  "datalist",
  "dd",
  "del",
  "details",
  "dfn",
  "dialog",
  "dir",
  "div",
  "dl",
  "dt",
  "em",
  "fieldset",
  "figcaption",
  "figure",
  "font",
  "footer",
  "form",
  "h1",
  "h2",
  "h3",
  "h4",
  "h5",
  "h6",
  "head",
  "header",
  "hgroup",
  "hr",
  "html",
  "i",
  "img",
  "input",
  "ins",
  "kbd",
  "keygen",
  "label",
  "layer",
  "legend",
  "li",
  "link",
  "listing",
  "main",
  "map",
  "mark",
  "marquee",
  "menu",
  "meta",
  "meter",
  "nav",
  "nobr",
  "ol",
  "optgroup",
  "option",
  "output",
  "p",
  "picture",
  "popup",
  "pre",
  "progress",
  "q",
  "rb",
  "rp",
  "rt",
  "rtc",
  "ruby",
  "s",
  "samp",
  "section",
  "select",
  "selectmenu",
  "small",
  "source",
  "span",
  "strike",
  "strong",
  "style",
  "sub",
  "summary",
  "sup",
  "table",
  "tbody",
  "td",
  "tfoot",
  "th",
  "thead",
  "time",
  "tr",
  "track",
  "tt",
  "u",
  "ul",
  "var",
  "video",
  "wbr"
], HTML_ELEMENTS_DISALLOW = [
  "basefont",
  "command",
  "data",
  "iframe",
  "image",
  "plaintext",
  "portal",
  "slot",
  // 'template', //TODO: Not exactly correct to never allow this, too strict
  "textarea",
  "title",
  "xmp"
], HTML_ELEMENTS = /* @__PURE__ */ new Set([
  ...HTML_ELEMENTS_ALLOW,
  ...HTML_ELEMENTS_DISALLOW
]), SVG_ELEMENTS_ALLOW = [
  "svg",
  "a",
  "altglyph",
  "altglyphdef",
  "altglyphitem",
  "animatecolor",
  "animatemotion",
  "animatetransform",
  "circle",
  "clippath",
  "defs",
  "desc",
  "ellipse",
  "filter",
  "font",
  "g",
  "glyph",
  "glyphref",
  "hkern",
  "image",
  "line",
  "lineargradient",
  "marker",
  "mask",
  "metadata",
  "mpath",
  "path",
  "pattern",
  "polygon",
  "polyline",
  "radialgradient",
  "rect",
  "stop",
  "style",
  "switch",
  "symbol",
  "text",
  "textpath",
  "title",
  "tref",
  "tspan",
  "view",
  "vkern",
  /* FILTERS */
  "feBlend",
  "feColorMatrix",
  "feComponentTransfer",
  "feComposite",
  "feConvolveMatrix",
  "feDiffuseLighting",
  "feDisplacementMap",
  "feDistantLight",
  "feFlood",
  "feFuncA",
  "feFuncB",
  "feFuncG",
  "feFuncR",
  "feGaussianBlur",
  "feImage",
  "feMerge",
  "feMergeNode",
  "feMorphology",
  "feOffset",
  "fePointLight",
  "feSpecularLighting",
  "feSpotLight",
  "feTile",
  "feTurbulence"
], SVG_ELEMENTS_DISALLOW = [
  "animate",
  "color-profile",
  "cursor",
  "discard",
  "fedropshadow",
  "font-face",
  "font-face-format",
  "font-face-name",
  "font-face-src",
  "font-face-uri",
  "foreignobject",
  "hatch",
  "hatchpath",
  "mesh",
  "meshgradient",
  "meshpatch",
  "meshrow",
  "missing-glyph",
  "script",
  "set",
  "solidcolor",
  "unknown",
  "use"
], SVG_ELEMENTS = /* @__PURE__ */ new Set([
  ...SVG_ELEMENTS_ALLOW,
  ...SVG_ELEMENTS_DISALLOW
]), MATH_ELEMENTS_ALLOW = [
  "math",
  "menclose",
  "merror",
  "mfenced",
  "mfrac",
  "mglyph",
  "mi",
  "mlabeledtr",
  "mmultiscripts",
  "mn",
  "mo",
  "mover",
  "mpadded",
  "mphantom",
  "mroot",
  "mrow",
  "ms",
  "mspace",
  "msqrt",
  "mstyle",
  "msub",
  "msup",
  "msubsup",
  "mtable",
  "mtd",
  "mtext",
  "mtr",
  "munder",
  "munderover"
], MATH_ELEMENTS_DISALLOW = [
  "maction",
  "maligngroup",
  "malignmark",
  "mlongdiv",
  "mscarries",
  "mscarry",
  "msgroup",
  "mstack",
  "msline",
  "msrow",
  "semantics",
  "annotation",
  "annotation-xml",
  "mprescripts",
  "none"
], MATH_ELEMENTS = /* @__PURE__ */ new Set([
  ...MATH_ELEMENTS_ALLOW,
  ...MATH_ELEMENTS_DISALLOW
]), HTML_ATTRIBUTES_ALLOW = [
  "abbr",
  "accept",
  "accept-charset",
  "accesskey",
  "action",
  "align",
  "alink",
  "allow",
  "allowfullscreen",
  "alt",
  "anchor",
  "archive",
  "as",
  "async",
  "autocapitalize",
  "autocomplete",
  "autocorrect",
  "autofocus",
  "autopictureinpicture",
  "autoplay",
  "axis",
  "background",
  "behavior",
  "bgcolor",
  "border",
  "bordercolor",
  "capture",
  "cellpadding",
  "cellspacing",
  "challenge",
  "char",
  "charoff",
  "charset",
  "checked",
  "cite",
  "class",
  "classid",
  "clear",
  "code",
  "codebase",
  "codetype",
  "color",
  "cols",
  "colspan",
  "compact",
  "content",
  "contenteditable",
  "controls",
  "controlslist",
  "conversiondestination",
  "coords",
  "crossorigin",
  "csp",
  "data",
  "datetime",
  "declare",
  "decoding",
  "default",
  "defer",
  "dir",
  "direction",
  "dirname",
  "disabled",
  "disablepictureinpicture",
  "disableremoteplayback",
  "disallowdocumentaccess",
  "download",
  "draggable",
  "elementtiming",
  "enctype",
  "end",
  "enterkeyhint",
  "event",
  "exportparts",
  "face",
  "for",
  "form",
  "formaction",
  "formenctype",
  "formmethod",
  "formnovalidate",
  "formtarget",
  "frame",
  "frameborder",
  "headers",
  "height",
  "hidden",
  "high",
  "href",
  "hreflang",
  "hreftranslate",
  "hspace",
  "http-equiv",
  "id",
  "imagesizes",
  "imagesrcset",
  "importance",
  "impressiondata",
  "impressionexpiry",
  "incremental",
  "inert",
  "inputmode",
  "integrity",
  "invisible",
  "ismap",
  "keytype",
  "kind",
  "label",
  "lang",
  "language",
  "latencyhint",
  "leftmargin",
  "link",
  "list",
  "loading",
  "longdesc",
  "loop",
  "low",
  "lowsrc",
  "manifest",
  "marginheight",
  "marginwidth",
  "max",
  "maxlength",
  "mayscript",
  "media",
  "method",
  "min",
  "minlength",
  "multiple",
  "muted",
  "name",
  "nohref",
  "nomodule",
  "nonce",
  "noresize",
  "noshade",
  "novalidate",
  "nowrap",
  "object",
  "open",
  "optimum",
  "part",
  "pattern",
  "ping",
  "placeholder",
  "playsinline",
  "policy",
  "poster",
  "preload",
  "pseudo",
  "readonly",
  "referrerpolicy",
  "rel",
  "reportingorigin",
  "required",
  "resources",
  "rev",
  "reversed",
  "role",
  "rows",
  "rowspan",
  "rules",
  "sandbox",
  "scheme",
  "scope",
  "scopes",
  "scrollamount",
  "scrolldelay",
  "scrolling",
  "select",
  "selected",
  "shadowroot",
  "shadowrootdelegatesfocus",
  "shape",
  "size",
  "sizes",
  "slot",
  "span",
  "spellcheck",
  "src",
  "srclang",
  "srcset",
  "standby",
  "start",
  "step",
  "style",
  "summary",
  "tabindex",
  "target",
  "text",
  "title",
  "topmargin",
  "translate",
  "truespeed",
  "trusttoken",
  "type",
  "usemap",
  "valign",
  "value",
  "valuetype",
  "version",
  "virtualkeyboardpolicy",
  "vlink",
  "vspace",
  "webkitdirectory",
  "width",
  "wrap"
], SVG_ATTRIBUTES_ALLOW = [
  "accent-height",
  "accumulate",
  "additive",
  "alignment-baseline",
  "ascent",
  "attributename",
  "attributetype",
  "azimuth",
  "basefrequency",
  "baseline-shift",
  "begin",
  "bias",
  "by",
  "class",
  "clip",
  "clippathunits",
  "clip-path",
  "clip-rule",
  "color",
  "color-interpolation",
  "color-interpolation-filters",
  "color-profile",
  "color-rendering",
  "cx",
  "cy",
  "d",
  "dx",
  "dy",
  "diffuseconstant",
  "direction",
  "display",
  "divisor",
  "dominant-baseline",
  "dur",
  "edgemode",
  "elevation",
  "end",
  "fill",
  "fill-opacity",
  "fill-rule",
  "filter",
  "filterunits",
  "flood-color",
  "flood-opacity",
  "font-family",
  "font-size",
  "font-size-adjust",
  "font-stretch",
  "font-style",
  "font-variant",
  "font-weight",
  "fx",
  "fy",
  "g1",
  "g2",
  "glyph-name",
  "glyphref",
  "gradientunits",
  "gradienttransform",
  "height",
  "href",
  "id",
  "image-rendering",
  "in",
  "in2",
  "k",
  "k1",
  "k2",
  "k3",
  "k4",
  "kerning",
  "keypoints",
  "keysplines",
  "keytimes",
  "lang",
  "lengthadjust",
  "letter-spacing",
  "kernelmatrix",
  "kernelunitlength",
  "lighting-color",
  "local",
  "marker-end",
  "marker-mid",
  "marker-start",
  "markerheight",
  "markerunits",
  "markerwidth",
  "maskcontentunits",
  "maskunits",
  "max",
  "mask",
  "media",
  "method",
  "mode",
  "min",
  "name",
  "numoctaves",
  "offset",
  "operator",
  "opacity",
  "order",
  "orient",
  "orientation",
  "origin",
  "overflow",
  "paint-order",
  "path",
  "pathlength",
  "patterncontentunits",
  "patterntransform",
  "patternunits",
  "points",
  "preservealpha",
  "preserveaspectratio",
  "primitiveunits",
  "r",
  "rx",
  "ry",
  "radius",
  "refx",
  "refy",
  "repeatcount",
  "repeatdur",
  "restart",
  "result",
  "rotate",
  "scale",
  "seed",
  "shape-rendering",
  "specularconstant",
  "specularexponent",
  "spreadmethod",
  "startoffset",
  "stddeviation",
  "stitchtiles",
  "stop-color",
  "stop-opacity",
  "stroke-dasharray",
  "stroke-dashoffset",
  "stroke-linecap",
  "stroke-linejoin",
  "stroke-miterlimit",
  "stroke-opacity",
  "stroke",
  "stroke-width",
  "style",
  "surfacescale",
  "systemlanguage",
  "tabindex",
  "targetx",
  "targety",
  "transform",
  "transform-origin",
  "text-anchor",
  "text-decoration",
  "text-rendering",
  "textlength",
  "type",
  "u1",
  "u2",
  "unicode",
  "values",
  "viewbox",
  "visibility",
  "version",
  "vert-adv-y",
  "vert-origin-x",
  "vert-origin-y",
  "width",
  "word-spacing",
  "wrap",
  "writing-mode",
  "xchannelselector",
  "ychannelselector",
  "x",
  "x1",
  "x2",
  "xmlns",
  "y",
  "y1",
  "y2",
  "z",
  "zoomandpan"
], MATH_ATTRIBUTES_ALLOW = [
  "accent",
  "accentunder",
  "align",
  "bevelled",
  "close",
  "columnsalign",
  "columnlines",
  "columnspan",
  "denomalign",
  "depth",
  "dir",
  "display",
  "displaystyle",
  "encoding",
  "fence",
  "frame",
  "height",
  "href",
  "id",
  "largeop",
  "length",
  "linethickness",
  "lspace",
  "lquote",
  "mathbackground",
  "mathcolor",
  "mathsize",
  "mathvariant",
  "maxsize",
  "minsize",
  "movablelimits",
  "notation",
  "numalign",
  "open",
  "rowalign",
  "rowlines",
  "rowspacing",
  "rowspan",
  "rspace",
  "rquote",
  "scriptlevel",
  "scriptminsize",
  "scriptsizemultiplier",
  "selection",
  "separator",
  "separators",
  "stretchy",
  "subscriptshift",
  "supscriptshift",
  "symmetric",
  "voffset",
  "width",
  "xmlns"
], NAMESPACES = {
  HTML: "http://www.w3.org/1999/xhtml",
  SVG: "http://www.w3.org/2000/svg",
  MATH: "http://www.w3.org/1998/Math/MathML"
}, NAMESPACES_ELEMENTS = {
  [NAMESPACES.HTML]: HTML_ELEMENTS,
  [NAMESPACES.SVG]: SVG_ELEMENTS,
  [NAMESPACES.MATH]: MATH_ELEMENTS
}, NAMESPACES_ROOTS = {
  [NAMESPACES.HTML]: "html",
  [NAMESPACES.SVG]: "svg",
  [NAMESPACES.MATH]: "math"
}, NAMESPACES_PREFIXES = {
  [NAMESPACES.HTML]: "",
  [NAMESPACES.SVG]: "svg:",
  [NAMESPACES.MATH]: "math:"
}, FUNKY_TAG_NAMES = /* @__PURE__ */ new Set([
  "A",
  "AREA",
  "BUTTON",
  "FORM",
  "IFRAME",
  "INPUT"
]), DEFAULTS = {
  allowComments: !0,
  allowCustomElements: !1,
  allowUnknownMarkup: !1,
  allowElements: [
    ...HTML_ELEMENTS_ALLOW,
    ...SVG_ELEMENTS_ALLOW.map((s) => `svg:${s}`),
    ...MATH_ELEMENTS_ALLOW.map((s) => `math:${s}`)
  ],
  allowAttributes: mergeMaps([
    Object.fromEntries(HTML_ATTRIBUTES_ALLOW.map((s) => [s, ["*"]])),
    Object.fromEntries(SVG_ATTRIBUTES_ALLOW.map((s) => [s, ["svg:*"]])),
    Object.fromEntries(MATH_ATTRIBUTES_ALLOW.map((s) => [s, ["math:*"]]))
  ])
};
var __classPrivateFieldSet = function(s, e, r, o, m) {
  if (o === "m") throw new TypeError("Private method is not writable");
  if (o === "a" && !m) throw new TypeError("Private accessor was defined without a setter");
  if (typeof e == "function" ? s !== e || !m : !e.has(s)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
  return o === "a" ? m.call(s, r) : m ? m.value = r : e.set(s, r), r;
}, __classPrivateFieldGet = function(s, e, r, o) {
  if (r === "a" && !o) throw new TypeError("Private accessor was defined without a getter");
  if (typeof e == "function" ? s !== e || !o : !e.has(s)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
  return r === "m" ? o : r === "a" ? o.call(s) : o ? o.value : e.get(s);
}, _Amuchina_configuration, _Amuchina_allowElements, _Amuchina_allowAttributes;
class Amuchina {
  /* CONSTRUCTOR */
  constructor(e = {}) {
    _Amuchina_configuration.set(this, void 0), _Amuchina_allowElements.set(this, void 0), _Amuchina_allowAttributes.set(this, void 0), this.getConfiguration = () => cloneDeep(__classPrivateFieldGet(this, _Amuchina_configuration, "f")), this.sanitize = (v) => {
      const h = __classPrivateFieldGet(this, _Amuchina_allowElements, "f"), a = __classPrivateFieldGet(this, _Amuchina_allowAttributes, "f");
      return traverseElements(v, (b, w) => {
        const k = b.namespaceURI || NAMESPACES.HTML, A = w.namespaceURI || NAMESPACES.HTML, M = NAMESPACES_ELEMENTS[k], $ = NAMESPACES_ROOTS[k], O = NAMESPACES_PREFIXES[k], C = b.tagName.toLowerCase(), P = `${O}${C}`, N = `${O}*`;
        if (!M.has(C) || !h.has(P) || k !== A && C !== $)
          w.removeChild(b);
        else {
          const R = b.getAttributeNames(), F = R.length;
          if (F) {
            for (let B = 0; B < F; B++) {
              const G = R[B], Q = a[G];
              (!Q || !Q.has(N) && !Q.has(P)) && b.removeAttribute(G);
            }
            if (isElementFunky(b))
              if (isElementHyperlink(b)) {
                const B = b.getAttribute("href");
                B && isScriptOrDataUrlLoose(B) && isScriptOrDataUrl(b.protocol) && b.removeAttribute("href");
              } else isElementAction(b) ? isScriptOrDataUrl(b.action) && b.removeAttribute("action") : isElementFormAction(b) ? isScriptOrDataUrl(b.formAction) && b.removeAttribute("formaction") : isElementIframe(b) && (isScriptOrDataUrl(b.src) && b.removeAttribute("formaction"), b.setAttribute("sandbox", "allow-scripts"));
          }
        }
      }), v;
    }, this.sanitizeFor = (v, h) => {
      throw new Error('"sanitizeFor" is not implemented yet');
    };
    const { allowComments: r, allowCustomElements: o, allowUnknownMarkup: m, blockElements: _, dropElements: g, dropAttributes: y } = e;
    if (r === !1)
      throw new Error('A false "allowComments" is not supported yet');
    if (o)
      throw new Error('A true "allowCustomElements" is not supported yet');
    if (m)
      throw new Error('A true "allowUnknownMarkup" is not supported yet');
    if (_)
      throw new Error('"blockElements" is not supported yet, use "allowElements" instead');
    if (g)
      throw new Error('"dropElements" is not supported yet, use "allowElements" instead');
    if (y)
      throw new Error('"dropAttributes" is not supported yet, use "allowAttributes" instead');
    __classPrivateFieldSet(this, _Amuchina_configuration, cloneDeep(DEFAULTS), "f");
    const { allowElements: E, allowAttributes: x } = e;
    E && (__classPrivateFieldGet(this, _Amuchina_configuration, "f").allowElements = e.allowElements), x && (__classPrivateFieldGet(this, _Amuchina_configuration, "f").allowAttributes = e.allowAttributes), __classPrivateFieldSet(this, _Amuchina_allowElements, new Set(__classPrivateFieldGet(this, _Amuchina_configuration, "f").allowElements), "f"), __classPrivateFieldSet(this, _Amuchina_allowAttributes, Object.fromEntries(Object.entries(__classPrivateFieldGet(this, _Amuchina_configuration, "f").allowAttributes || {}).map(([v, h]) => [v, new Set(h)])), "f");
  }
}
_Amuchina_configuration = /* @__PURE__ */ new WeakMap(), _Amuchina_allowElements = /* @__PURE__ */ new WeakMap(), _Amuchina_allowAttributes = /* @__PURE__ */ new WeakMap();
Amuchina.getDefaultConfiguration = () => cloneDeep(DEFAULTS);
const is_external_url = (s, e) => {
  try {
    return !!s && new URL(s).origin !== new URL(e).origin;
  } catch {
    return !1;
  }
};
function sanitize(s, e) {
  const r = new Amuchina(), o = new DOMParser().parseFromString(s, "text/html");
  return walk_nodes(o.body, "A", (m) => {
    m instanceof HTMLElement && "target" in m && is_external_url(m.getAttribute("href"), e) && (m.setAttribute("target", "_blank"), m.setAttribute("rel", "noopener noreferrer"));
  }), r.sanitize(o).body.innerHTML;
}
function walk_nodes(s, e, r) {
  s && (s.nodeName === e || typeof e == "function") && r(s);
  const o = (s == null ? void 0 : s.childNodes) || [];
  for (let m = 0; m < o.length; m++)
    walk_nodes(o[m], e, r);
}
const standardHtmlTags = [
  "!--",
  "!doctype",
  "a",
  "abbr",
  "acronym",
  "address",
  "applet",
  "area",
  "article",
  "aside",
  "audio",
  "b",
  "base",
  "basefont",
  "bdi",
  "bdo",
  "big",
  "blockquote",
  "body",
  "br",
  "button",
  "canvas",
  "caption",
  "center",
  "cite",
  "code",
  "col",
  "colgroup",
  "data",
  "datalist",
  "dd",
  "del",
  "details",
  "dfn",
  "dialog",
  "dir",
  "div",
  "dl",
  "dt",
  "em",
  "embed",
  "fieldset",
  "figcaption",
  "figure",
  "font",
  "footer",
  "form",
  "frame",
  "frameset",
  "h1",
  "h2",
  "h3",
  "h4",
  "h5",
  "h6",
  "head",
  "header",
  "hgroup",
  "hr",
  "html",
  "i",
  "iframe",
  "img",
  "input",
  "ins",
  "kbd",
  "label",
  "legend",
  "li",
  "link",
  "main",
  "map",
  "mark",
  "menu",
  "meta",
  "meter",
  "nav",
  "noframes",
  "noscript",
  "object",
  "ol",
  "optgroup",
  "option",
  "output",
  "p",
  "param",
  "picture",
  "pre",
  "progress",
  "q",
  "rp",
  "rt",
  "ruby",
  "s",
  "samp",
  "script",
  "search",
  "section",
  "select",
  "small",
  "source",
  "span",
  "strike",
  "strong",
  "style",
  "sub",
  "summary",
  "sup",
  "svg",
  "table",
  "tbody",
  "td",
  "template",
  "textarea",
  "tfoot",
  "th",
  "thead",
  "time",
  "title",
  "tr",
  "track",
  "tt",
  "u",
  "ul",
  "var",
  "video",
  "wbr"
], svgTags = [
  // Base structural elements
  "g",
  "defs",
  "use",
  "symbol",
  // Shape elements
  "rect",
  "circle",
  "ellipse",
  "line",
  "polyline",
  "polygon",
  "path",
  "image",
  // Text elements
  "text",
  "tspan",
  "textPath",
  // Gradient and effects
  "linearGradient",
  "radialGradient",
  "stop",
  "pattern",
  "clipPath",
  "mask",
  "filter",
  // Filter effects
  "feBlend",
  "feColorMatrix",
  "feComponentTransfer",
  "feComposite",
  "feConvolveMatrix",
  "feDiffuseLighting",
  "feDisplacementMap",
  "feGaussianBlur",
  "feMerge",
  "feMorphology",
  "feOffset",
  "feSpecularLighting",
  "feTurbulence",
  "feMergeNode",
  "feFuncR",
  "feFuncG",
  "feFuncB",
  "feFuncA",
  "feDistantLight",
  "fePointLight",
  "feSpotLight",
  "feFlood",
  "feTile",
  // Animation elements
  "animate",
  "animateTransform",
  "animateMotion",
  "mpath",
  "set",
  // Interactive and other elements
  "view",
  "cursor",
  "foreignObject",
  "desc",
  "title",
  "metadata",
  "switch"
], standardHtmlAndSvgTags = [
  ...standardHtmlTags,
  ...svgTags.filter((s) => !standardHtmlTags.includes(s))
], {
  HtmlTagHydration: HtmlTagHydration$1,
  SvelteComponent: SvelteComponent$1t,
  attr: attr$1r,
  binding_callbacks: binding_callbacks$4,
  children: children$1r,
  claim_element: claim_element$g,
  claim_html_tag: claim_html_tag$1,
  detach: detach$1s,
  element: element$g,
  init: init$1t,
  insert_hydration: insert_hydration$1s,
  noop: noop$1h,
  safe_not_equal: safe_not_equal$1t,
  toggle_class: toggle_class$b
} = window.__gradio__svelte__internal, { afterUpdate: afterUpdate$1, tick: tick$2, onMount: onMount$3 } = window.__gradio__svelte__internal;
function create_fragment$c(s) {
  let e, r;
  return {
    c() {
      e = element$g("span"), r = new HtmlTagHydration$1(!1), this.h();
    },
    l(o) {
      e = claim_element$g(o, "SPAN", { class: !0 });
      var m = children$1r(e);
      r = claim_html_tag$1(m, !1), m.forEach(detach$1s), this.h();
    },
    h() {
      r.a = null, attr$1r(e, "class", "md svelte-1m32c2s"), toggle_class$b(
        e,
        "chatbot",
        /*chatbot*/
        s[0]
      ), toggle_class$b(
        e,
        "prose",
        /*render_markdown*/
        s[1]
      );
    },
    m(o, m) {
      insert_hydration$1s(o, e, m), r.m(
        /*html*/
        s[3],
        e
      ), s[11](e);
    },
    p(o, [m]) {
      m & /*html*/
      8 && r.p(
        /*html*/
        o[3]
      ), m & /*chatbot*/
      1 && toggle_class$b(
        e,
        "chatbot",
        /*chatbot*/
        o[0]
      ), m & /*render_markdown*/
      2 && toggle_class$b(
        e,
        "prose",
        /*render_markdown*/
        o[1]
      );
    },
    i: noop$1h,
    o: noop$1h,
    d(o) {
      o && detach$1s(e), s[11](null);
    }
  };
}
function escapeRegExp$1(s) {
  return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
function instance$8(s, e, r) {
  var o = this && this.__awaiter || function(C, P, I, N) {
    function R(F) {
      return F instanceof I ? F : new I(function(B) {
        B(F);
      });
    }
    return new (I || (I = Promise))(function(F, B) {
      function G(Y) {
        try {
          ee(N.next(Y));
        } catch (W) {
          B(W);
        }
      }
      function Q(Y) {
        try {
          ee(N.throw(Y));
        } catch (W) {
          B(W);
        }
      }
      function ee(Y) {
        Y.done ? F(Y.value) : R(Y.value).then(G, Q);
      }
      ee((N = N.apply(C, P || [])).next());
    });
  };
  let { chatbot: m = !0 } = e, { message: _ } = e, { sanitize_html: g = !0 } = e, { latex_delimiters: y = [] } = e, { render_markdown: E = !0 } = e, { line_breaks: x = !0 } = e, { header_links: v = !1 } = e, { allow_tags: h = !1 } = e, { theme_mode: a = "system" } = e, b, w;
  const k = create_marked({
    header_links: v,
    line_breaks: x,
    latex_delimiters: y || []
  });
  function A(C, P) {
    if (P === !0) {
      const I = /<\/?([a-zA-Z][a-zA-Z0-9-]*)([\s>])/g;
      return C.replace(I, (N, R, F) => standardHtmlAndSvgTags.includes(R.toLowerCase()) ? N : N.replace(/</g, "&lt;").replace(/>/g, "&gt;"));
    }
    if (Array.isArray(P)) {
      const I = P.map((R) => ({
        open: new RegExp(`<(${R})(\\s+[^>]*)?>`, "gi"),
        close: new RegExp(`</(${R})>`, "gi")
      }));
      let N = C;
      return I.forEach((R) => {
        N = N.replace(R.open, (F) => F.replace(/</g, "&lt;").replace(/>/g, "&gt;")), N = N.replace(R.close, (F) => F.replace(/</g, "&lt;").replace(/>/g, "&gt;"));
      }), N;
    }
    return C;
  }
  function M(C) {
    let P = C;
    if (E) {
      const I = [];
      y.forEach((N, R) => {
        const F = escapeRegExp$1(N.left), B = escapeRegExp$1(N.right), G = new RegExp(`${F}([\\s\\S]+?)${B}`, "g");
        P = P.replace(G, (Q, ee) => (I.push(Q), `%%%LATEX_BLOCK_${I.length - 1}%%%`));
      }), P = k.parse(P), P = P.replace(/%%%LATEX_BLOCK_(\d+)%%%/g, (N, R) => I[parseInt(R, 10)]);
    }
    return h && (P = A(P, h)), g && sanitize && (P = sanitize(P)), P;
  }
  function $(C) {
    return o(this, void 0, void 0, function* () {
      if (y.length > 0 && C && y.some((I) => C.includes(I.left) && C.includes(I.right)) && renderMathInElement(b, {
        delimiters: y,
        throwOnError: !1
      }), b) {
        const P = b.querySelectorAll(".mermaid");
        if (P.length > 0) {
          yield tick$2();
          const { default: I } = yield import("./mermaid.core-BiIw1_mh.js").then((N) => N.bz);
          I.initialize({
            startOnLoad: !1,
            theme: a === "dark" ? "dark" : "default",
            securityLevel: "antiscript"
          }), yield I.run({
            nodes: Array.from(P).map((N) => N)
          });
        }
      }
    });
  }
  afterUpdate$1(() => o(void 0, void 0, void 0, function* () {
    b && document.body.contains(b) ? yield $(_) : console.error("Element is not in the DOM");
  }));
  function O(C) {
    binding_callbacks$4[C ? "unshift" : "push"](() => {
      b = C, r(2, b);
    });
  }
  return s.$$set = (C) => {
    "chatbot" in C && r(0, m = C.chatbot), "message" in C && r(4, _ = C.message), "sanitize_html" in C && r(5, g = C.sanitize_html), "latex_delimiters" in C && r(6, y = C.latex_delimiters), "render_markdown" in C && r(1, E = C.render_markdown), "line_breaks" in C && r(7, x = C.line_breaks), "header_links" in C && r(8, v = C.header_links), "allow_tags" in C && r(9, h = C.allow_tags), "theme_mode" in C && r(10, a = C.theme_mode);
  }, s.$$.update = () => {
    s.$$.dirty & /*message*/
    16 && (_ && _.trim() ? r(3, w = M(_)) : r(3, w = ""));
  }, [
    m,
    E,
    b,
    w,
    _,
    g,
    y,
    x,
    v,
    h,
    a,
    O
  ];
}
class MarkdownCode extends SvelteComponent$1t {
  constructor(e) {
    super(), init$1t(this, e, instance$8, create_fragment$c, safe_not_equal$1t, {
      chatbot: 0,
      message: 4,
      sanitize_html: 5,
      latex_delimiters: 6,
      render_markdown: 1,
      line_breaks: 7,
      header_links: 8,
      allow_tags: 9,
      theme_mode: 10
    });
  }
}
const {
  SvelteComponent: SvelteComponent$1s,
  attr: attr$1q,
  children: children$1q,
  claim_component: claim_component$c,
  claim_element: claim_element$f,
  create_component: create_component$c,
  destroy_component: destroy_component$c,
  detach: detach$1r,
  element: element$f,
  init: init$1s,
  insert_hydration: insert_hydration$1r,
  mount_component: mount_component$c,
  safe_not_equal: safe_not_equal$1s,
  transition_in: transition_in$f,
  transition_out: transition_out$f
} = window.__gradio__svelte__internal;
function create_fragment$b(s) {
  let e, r, o;
  return r = new MarkdownCode({
    props: {
      message: (
        /*info*/
        s[0]
      ),
      sanitize_html: !0
    }
  }), {
    c() {
      e = element$f("div"), create_component$c(r.$$.fragment), this.h();
    },
    l(m) {
      e = claim_element$f(m, "DIV", { class: !0 });
      var _ = children$1q(e);
      claim_component$c(r.$$.fragment, _), _.forEach(detach$1r), this.h();
    },
    h() {
      attr$1q(e, "class", "svelte-17qq50w");
    },
    m(m, _) {
      insert_hydration$1r(m, e, _), mount_component$c(r, e, null), o = !0;
    },
    p(m, [_]) {
      const g = {};
      _ & /*info*/
      1 && (g.message = /*info*/
      m[0]), r.$set(g);
    },
    i(m) {
      o || (transition_in$f(r.$$.fragment, m), o = !0);
    },
    o(m) {
      transition_out$f(r.$$.fragment, m), o = !1;
    },
    d(m) {
      m && detach$1r(e), destroy_component$c(r);
    }
  };
}
function instance$7(s, e, r) {
  let { info: o } = e;
  return s.$$set = (m) => {
    "info" in m && r(0, o = m.info);
  }, [o];
}
class Info extends SvelteComponent$1s {
  constructor(e) {
    super(), init$1s(this, e, instance$7, create_fragment$b, safe_not_equal$1s, { info: 0 });
  }
}
const {
  SvelteComponent: SvelteComponent$1r,
  attr: attr$1p,
  check_outros: check_outros$9,
  children: children$1p,
  claim_component: claim_component$b,
  claim_element: claim_element$e,
  claim_space: claim_space$9,
  create_component: create_component$b,
  create_slot: create_slot$5,
  destroy_component: destroy_component$b,
  detach: detach$1q,
  element: element$e,
  empty: empty$7,
  get_all_dirty_from_scope: get_all_dirty_from_scope$5,
  get_slot_changes: get_slot_changes$5,
  group_outros: group_outros$9,
  init: init$1r,
  insert_hydration: insert_hydration$1q,
  mount_component: mount_component$b,
  safe_not_equal: safe_not_equal$1r,
  space: space$9,
  toggle_class: toggle_class$a,
  transition_in: transition_in$e,
  transition_out: transition_out$e,
  update_slot_base: update_slot_base$5
} = window.__gradio__svelte__internal;
function create_if_block$4(s) {
  let e, r;
  return e = new Info({ props: { info: (
    /*info*/
    s[1]
  ) } }), {
    c() {
      create_component$b(e.$$.fragment);
    },
    l(o) {
      claim_component$b(e.$$.fragment, o);
    },
    m(o, m) {
      mount_component$b(e, o, m), r = !0;
    },
    p(o, m) {
      const _ = {};
      m & /*info*/
      2 && (_.info = /*info*/
      o[1]), e.$set(_);
    },
    i(o) {
      r || (transition_in$e(e.$$.fragment, o), r = !0);
    },
    o(o) {
      transition_out$e(e.$$.fragment, o), r = !1;
    },
    d(o) {
      destroy_component$b(e, o);
    }
  };
}
function create_fragment$a(s) {
  let e, r, o, m, _;
  const g = (
    /*#slots*/
    s[4].default
  ), y = create_slot$5(
    g,
    s,
    /*$$scope*/
    s[3],
    null
  );
  let E = (
    /*info*/
    s[1] && create_if_block$4(s)
  );
  return {
    c() {
      e = element$e("span"), y && y.c(), o = space$9(), E && E.c(), m = empty$7(), this.h();
    },
    l(x) {
      e = claim_element$e(x, "SPAN", {
        "data-testid": !0,
        dir: !0,
        class: !0
      });
      var v = children$1p(e);
      y && y.l(v), v.forEach(detach$1q), o = claim_space$9(x), E && E.l(x), m = empty$7(), this.h();
    },
    h() {
      attr$1p(e, "data-testid", "block-info"), attr$1p(e, "dir", r = /*rtl*/
      s[2] ? "rtl" : "ltr"), attr$1p(e, "class", "svelte-zgrq3"), toggle_class$a(e, "sr-only", !/*show_label*/
      s[0]), toggle_class$a(e, "hide", !/*show_label*/
      s[0]), toggle_class$a(
        e,
        "has-info",
        /*info*/
        s[1] != null
      );
    },
    m(x, v) {
      insert_hydration$1q(x, e, v), y && y.m(e, null), insert_hydration$1q(x, o, v), E && E.m(x, v), insert_hydration$1q(x, m, v), _ = !0;
    },
    p(x, [v]) {
      y && y.p && (!_ || v & /*$$scope*/
      8) && update_slot_base$5(
        y,
        g,
        x,
        /*$$scope*/
        x[3],
        _ ? get_slot_changes$5(
          g,
          /*$$scope*/
          x[3],
          v,
          null
        ) : get_all_dirty_from_scope$5(
          /*$$scope*/
          x[3]
        ),
        null
      ), (!_ || v & /*rtl*/
      4 && r !== (r = /*rtl*/
      x[2] ? "rtl" : "ltr")) && attr$1p(e, "dir", r), (!_ || v & /*show_label*/
      1) && toggle_class$a(e, "sr-only", !/*show_label*/
      x[0]), (!_ || v & /*show_label*/
      1) && toggle_class$a(e, "hide", !/*show_label*/
      x[0]), (!_ || v & /*info*/
      2) && toggle_class$a(
        e,
        "has-info",
        /*info*/
        x[1] != null
      ), /*info*/
      x[1] ? E ? (E.p(x, v), v & /*info*/
      2 && transition_in$e(E, 1)) : (E = create_if_block$4(x), E.c(), transition_in$e(E, 1), E.m(m.parentNode, m)) : E && (group_outros$9(), transition_out$e(E, 1, 1, () => {
        E = null;
      }), check_outros$9());
    },
    i(x) {
      _ || (transition_in$e(y, x), transition_in$e(E), _ = !0);
    },
    o(x) {
      transition_out$e(y, x), transition_out$e(E), _ = !1;
    },
    d(x) {
      x && (detach$1q(e), detach$1q(o), detach$1q(m)), y && y.d(x), E && E.d(x);
    }
  };
}
function instance$6(s, e, r) {
  let { $$slots: o = {}, $$scope: m } = e, { show_label: _ = !0 } = e, { info: g = void 0 } = e, { rtl: y = !1 } = e;
  return s.$$set = (E) => {
    "show_label" in E && r(0, _ = E.show_label), "info" in E && r(1, g = E.info), "rtl" in E && r(2, y = E.rtl), "$$scope" in E && r(3, m = E.$$scope);
  }, [_, g, y, m, o];
}
class BlockTitle extends SvelteComponent$1r {
  constructor(e) {
    super(), init$1r(this, e, instance$6, create_fragment$a, safe_not_equal$1r, { show_label: 0, info: 1, rtl: 2 });
  }
}
const {
  SvelteComponent: SvelteComponent$1q,
  append_hydration: append_hydration$1l,
  attr: attr$1o,
  children: children$1o,
  claim_component: claim_component$a,
  claim_element: claim_element$d,
  claim_space: claim_space$8,
  claim_text: claim_text$a,
  create_component: create_component$a,
  destroy_component: destroy_component$a,
  detach: detach$1p,
  element: element$d,
  init: init$1q,
  insert_hydration: insert_hydration$1p,
  mount_component: mount_component$a,
  safe_not_equal: safe_not_equal$1q,
  set_data: set_data$6,
  space: space$8,
  text: text$b,
  toggle_class: toggle_class$9,
  transition_in: transition_in$d,
  transition_out: transition_out$d
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$1p,
  append_hydration: append_hydration$1k,
  attr: attr$1n,
  bubble: bubble$3,
  check_outros: check_outros$8,
  children: children$1n,
  claim_component: claim_component$9,
  claim_element: claim_element$c,
  claim_space: claim_space$7,
  claim_text: claim_text$9,
  construct_svelte_component,
  create_component: create_component$9,
  create_slot: create_slot$4,
  destroy_component: destroy_component$9,
  detach: detach$1o,
  element: element$c,
  get_all_dirty_from_scope: get_all_dirty_from_scope$4,
  get_slot_changes: get_slot_changes$4,
  group_outros: group_outros$8,
  init: init$1p,
  insert_hydration: insert_hydration$1o,
  listen: listen$4,
  mount_component: mount_component$9,
  safe_not_equal: safe_not_equal$1p,
  set_data: set_data$5,
  set_style: set_style$7,
  space: space$7,
  text: text$a,
  toggle_class: toggle_class$8,
  transition_in: transition_in$c,
  transition_out: transition_out$c,
  update_slot_base: update_slot_base$4
} = window.__gradio__svelte__internal;
function create_if_block$3(s) {
  let e, r;
  return {
    c() {
      e = element$c("span"), r = text$a(
        /*label*/
        s[1]
      ), this.h();
    },
    l(o) {
      e = claim_element$c(o, "SPAN", { class: !0 });
      var m = children$1n(e);
      r = claim_text$9(
        m,
        /*label*/
        s[1]
      ), m.forEach(detach$1o), this.h();
    },
    h() {
      attr$1n(e, "class", "svelte-qgco6m");
    },
    m(o, m) {
      insert_hydration$1o(o, e, m), append_hydration$1k(e, r);
    },
    p(o, m) {
      m & /*label*/
      2 && set_data$5(
        r,
        /*label*/
        o[1]
      );
    },
    d(o) {
      o && detach$1o(e);
    }
  };
}
function create_fragment$9(s) {
  let e, r, o, m, _, g, y, E, x = (
    /*show_label*/
    s[2] && create_if_block$3(s)
  );
  var v = (
    /*Icon*/
    s[0]
  );
  function h(w, k) {
    return {};
  }
  v && (m = construct_svelte_component(v, h()));
  const a = (
    /*#slots*/
    s[14].default
  ), b = create_slot$4(
    a,
    s,
    /*$$scope*/
    s[13],
    null
  );
  return {
    c() {
      e = element$c("button"), x && x.c(), r = space$7(), o = element$c("div"), m && create_component$9(m.$$.fragment), _ = space$7(), b && b.c(), this.h();
    },
    l(w) {
      e = claim_element$c(w, "BUTTON", {
        "aria-label": !0,
        "aria-haspopup": !0,
        title: !0,
        class: !0
      });
      var k = children$1n(e);
      x && x.l(k), r = claim_space$7(k), o = claim_element$c(k, "DIV", { class: !0 });
      var A = children$1n(o);
      m && claim_component$9(m.$$.fragment, A), _ = claim_space$7(A), b && b.l(A), A.forEach(detach$1o), k.forEach(detach$1o), this.h();
    },
    h() {
      attr$1n(o, "class", "svelte-qgco6m"), toggle_class$8(
        o,
        "x-small",
        /*size*/
        s[4] === "x-small"
      ), toggle_class$8(
        o,
        "small",
        /*size*/
        s[4] === "small"
      ), toggle_class$8(
        o,
        "large",
        /*size*/
        s[4] === "large"
      ), toggle_class$8(
        o,
        "medium",
        /*size*/
        s[4] === "medium"
      ), e.disabled = /*disabled*/
      s[7], attr$1n(
        e,
        "aria-label",
        /*label*/
        s[1]
      ), attr$1n(
        e,
        "aria-haspopup",
        /*hasPopup*/
        s[8]
      ), attr$1n(
        e,
        "title",
        /*label*/
        s[1]
      ), attr$1n(e, "class", "svelte-qgco6m"), toggle_class$8(
        e,
        "pending",
        /*pending*/
        s[3]
      ), toggle_class$8(
        e,
        "padded",
        /*padded*/
        s[5]
      ), toggle_class$8(
        e,
        "highlight",
        /*highlight*/
        s[6]
      ), toggle_class$8(
        e,
        "transparent",
        /*transparent*/
        s[9]
      ), set_style$7(e, "color", !/*disabled*/
      s[7] && /*_color*/
      s[11] ? (
        /*_color*/
        s[11]
      ) : "var(--block-label-text-color)"), set_style$7(e, "--bg-color", /*disabled*/
      s[7] ? "auto" : (
        /*background*/
        s[10]
      ));
    },
    m(w, k) {
      insert_hydration$1o(w, e, k), x && x.m(e, null), append_hydration$1k(e, r), append_hydration$1k(e, o), m && mount_component$9(m, o, null), append_hydration$1k(o, _), b && b.m(o, null), g = !0, y || (E = listen$4(
        e,
        "click",
        /*click_handler*/
        s[15]
      ), y = !0);
    },
    p(w, [k]) {
      if (/*show_label*/
      w[2] ? x ? x.p(w, k) : (x = create_if_block$3(w), x.c(), x.m(e, r)) : x && (x.d(1), x = null), k & /*Icon*/
      1 && v !== (v = /*Icon*/
      w[0])) {
        if (m) {
          group_outros$8();
          const A = m;
          transition_out$c(A.$$.fragment, 1, 0, () => {
            destroy_component$9(A, 1);
          }), check_outros$8();
        }
        v ? (m = construct_svelte_component(v, h()), create_component$9(m.$$.fragment), transition_in$c(m.$$.fragment, 1), mount_component$9(m, o, _)) : m = null;
      }
      b && b.p && (!g || k & /*$$scope*/
      8192) && update_slot_base$4(
        b,
        a,
        w,
        /*$$scope*/
        w[13],
        g ? get_slot_changes$4(
          a,
          /*$$scope*/
          w[13],
          k,
          null
        ) : get_all_dirty_from_scope$4(
          /*$$scope*/
          w[13]
        ),
        null
      ), (!g || k & /*size*/
      16) && toggle_class$8(
        o,
        "x-small",
        /*size*/
        w[4] === "x-small"
      ), (!g || k & /*size*/
      16) && toggle_class$8(
        o,
        "small",
        /*size*/
        w[4] === "small"
      ), (!g || k & /*size*/
      16) && toggle_class$8(
        o,
        "large",
        /*size*/
        w[4] === "large"
      ), (!g || k & /*size*/
      16) && toggle_class$8(
        o,
        "medium",
        /*size*/
        w[4] === "medium"
      ), (!g || k & /*disabled*/
      128) && (e.disabled = /*disabled*/
      w[7]), (!g || k & /*label*/
      2) && attr$1n(
        e,
        "aria-label",
        /*label*/
        w[1]
      ), (!g || k & /*hasPopup*/
      256) && attr$1n(
        e,
        "aria-haspopup",
        /*hasPopup*/
        w[8]
      ), (!g || k & /*label*/
      2) && attr$1n(
        e,
        "title",
        /*label*/
        w[1]
      ), (!g || k & /*pending*/
      8) && toggle_class$8(
        e,
        "pending",
        /*pending*/
        w[3]
      ), (!g || k & /*padded*/
      32) && toggle_class$8(
        e,
        "padded",
        /*padded*/
        w[5]
      ), (!g || k & /*highlight*/
      64) && toggle_class$8(
        e,
        "highlight",
        /*highlight*/
        w[6]
      ), (!g || k & /*transparent*/
      512) && toggle_class$8(
        e,
        "transparent",
        /*transparent*/
        w[9]
      ), k & /*disabled, _color*/
      2176 && set_style$7(e, "color", !/*disabled*/
      w[7] && /*_color*/
      w[11] ? (
        /*_color*/
        w[11]
      ) : "var(--block-label-text-color)"), k & /*disabled, background*/
      1152 && set_style$7(e, "--bg-color", /*disabled*/
      w[7] ? "auto" : (
        /*background*/
        w[10]
      ));
    },
    i(w) {
      g || (m && transition_in$c(m.$$.fragment, w), transition_in$c(b, w), g = !0);
    },
    o(w) {
      m && transition_out$c(m.$$.fragment, w), transition_out$c(b, w), g = !1;
    },
    d(w) {
      w && detach$1o(e), x && x.d(), m && destroy_component$9(m), b && b.d(w), y = !1, E();
    }
  };
}
function instance$5(s, e, r) {
  let o, { $$slots: m = {}, $$scope: _ } = e, { Icon: g } = e, { label: y = "" } = e, { show_label: E = !1 } = e, { pending: x = !1 } = e, { size: v = "small" } = e, { padded: h = !0 } = e, { highlight: a = !1 } = e, { disabled: b = !1 } = e, { hasPopup: w = !1 } = e, { color: k = "var(--block-label-text-color)" } = e, { transparent: A = !1 } = e, { background: M = "var(--block-background-fill)" } = e;
  function $(O) {
    bubble$3.call(this, s, O);
  }
  return s.$$set = (O) => {
    "Icon" in O && r(0, g = O.Icon), "label" in O && r(1, y = O.label), "show_label" in O && r(2, E = O.show_label), "pending" in O && r(3, x = O.pending), "size" in O && r(4, v = O.size), "padded" in O && r(5, h = O.padded), "highlight" in O && r(6, a = O.highlight), "disabled" in O && r(7, b = O.disabled), "hasPopup" in O && r(8, w = O.hasPopup), "color" in O && r(12, k = O.color), "transparent" in O && r(9, A = O.transparent), "background" in O && r(10, M = O.background), "$$scope" in O && r(13, _ = O.$$scope);
  }, s.$$.update = () => {
    s.$$.dirty & /*highlight, color*/
    4160 && r(11, o = a ? "var(--color-accent)" : k);
  }, [
    g,
    y,
    E,
    x,
    v,
    h,
    a,
    b,
    w,
    A,
    M,
    o,
    k,
    _,
    m,
    $
  ];
}
class IconButton extends SvelteComponent$1p {
  constructor(e) {
    super(), init$1p(this, e, instance$5, create_fragment$9, safe_not_equal$1p, {
      Icon: 0,
      label: 1,
      show_label: 2,
      pending: 3,
      size: 4,
      padded: 5,
      highlight: 6,
      disabled: 7,
      hasPopup: 8,
      color: 12,
      transparent: 9,
      background: 10
    });
  }
}
const {
  SvelteComponent: SvelteComponent$1o,
  append_hydration: append_hydration$1j,
  attr: attr$1m,
  binding_callbacks: binding_callbacks$3,
  children: children$1m,
  claim_element: claim_element$b,
  create_slot: create_slot$3,
  detach: detach$1n,
  element: element$b,
  get_all_dirty_from_scope: get_all_dirty_from_scope$3,
  get_slot_changes: get_slot_changes$3,
  init: init$1o,
  insert_hydration: insert_hydration$1n,
  safe_not_equal: safe_not_equal$1o,
  toggle_class: toggle_class$7,
  transition_in: transition_in$b,
  transition_out: transition_out$b,
  update_slot_base: update_slot_base$3
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$1n,
  append_hydration: append_hydration$1i,
  attr: attr$1l,
  children: children$1l,
  claim_svg_element: claim_svg_element$1b,
  detach: detach$1m,
  init: init$1n,
  insert_hydration: insert_hydration$1m,
  noop: noop$1g,
  safe_not_equal: safe_not_equal$1n,
  svg_element: svg_element$1b
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$1m,
  append_hydration: append_hydration$1h,
  attr: attr$1k,
  children: children$1k,
  claim_svg_element: claim_svg_element$1a,
  detach: detach$1l,
  init: init$1m,
  insert_hydration: insert_hydration$1l,
  noop: noop$1f,
  safe_not_equal: safe_not_equal$1m,
  svg_element: svg_element$1a
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$1l,
  append_hydration: append_hydration$1g,
  attr: attr$1j,
  children: children$1j,
  claim_svg_element: claim_svg_element$19,
  detach: detach$1k,
  init: init$1l,
  insert_hydration: insert_hydration$1k,
  noop: noop$1e,
  safe_not_equal: safe_not_equal$1l,
  svg_element: svg_element$19
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$1k,
  append_hydration: append_hydration$1f,
  attr: attr$1i,
  children: children$1i,
  claim_svg_element: claim_svg_element$18,
  detach: detach$1j,
  init: init$1k,
  insert_hydration: insert_hydration$1j,
  noop: noop$1d,
  safe_not_equal: safe_not_equal$1k,
  svg_element: svg_element$18
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$1j,
  append_hydration: append_hydration$1e,
  attr: attr$1h,
  children: children$1h,
  claim_svg_element: claim_svg_element$17,
  detach: detach$1i,
  init: init$1j,
  insert_hydration: insert_hydration$1i,
  noop: noop$1c,
  safe_not_equal: safe_not_equal$1j,
  svg_element: svg_element$17
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$1i,
  append_hydration: append_hydration$1d,
  attr: attr$1g,
  children: children$1g,
  claim_svg_element: claim_svg_element$16,
  detach: detach$1h,
  init: init$1i,
  insert_hydration: insert_hydration$1h,
  noop: noop$1b,
  safe_not_equal: safe_not_equal$1i,
  svg_element: svg_element$16
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$1h,
  append_hydration: append_hydration$1c,
  attr: attr$1f,
  children: children$1f,
  claim_svg_element: claim_svg_element$15,
  detach: detach$1g,
  init: init$1h,
  insert_hydration: insert_hydration$1g,
  noop: noop$1a,
  safe_not_equal: safe_not_equal$1h,
  svg_element: svg_element$15
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$1g,
  append_hydration: append_hydration$1b,
  attr: attr$1e,
  children: children$1e,
  claim_svg_element: claim_svg_element$14,
  detach: detach$1f,
  init: init$1g,
  insert_hydration: insert_hydration$1f,
  noop: noop$19,
  safe_not_equal: safe_not_equal$1g,
  svg_element: svg_element$14
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$1f,
  append_hydration: append_hydration$1a,
  attr: attr$1d,
  children: children$1d,
  claim_svg_element: claim_svg_element$13,
  detach: detach$1e,
  init: init$1f,
  insert_hydration: insert_hydration$1e,
  noop: noop$18,
  safe_not_equal: safe_not_equal$1f,
  svg_element: svg_element$13
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$1e,
  append_hydration: append_hydration$19,
  attr: attr$1c,
  children: children$1c,
  claim_svg_element: claim_svg_element$12,
  detach: detach$1d,
  init: init$1e,
  insert_hydration: insert_hydration$1d,
  noop: noop$17,
  safe_not_equal: safe_not_equal$1e,
  svg_element: svg_element$12
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$1d,
  append_hydration: append_hydration$18,
  attr: attr$1b,
  children: children$1b,
  claim_svg_element: claim_svg_element$11,
  detach: detach$1c,
  init: init$1d,
  insert_hydration: insert_hydration$1c,
  noop: noop$16,
  safe_not_equal: safe_not_equal$1d,
  svg_element: svg_element$11
} = window.__gradio__svelte__internal;
function create_fragment$8(s) {
  let e, r;
  return {
    c() {
      e = svg_element$11("svg"), r = svg_element$11("path"), this.h();
    },
    l(o) {
      e = claim_svg_element$11(o, "svg", {
        width: !0,
        height: !0,
        "stroke-width": !0,
        viewBox: !0,
        fill: !0,
        xmlns: !0,
        color: !0
      });
      var m = children$1b(e);
      r = claim_svg_element$11(m, "path", {
        d: !0,
        stroke: !0,
        "stroke-width": !0,
        "stroke-linecap": !0,
        "stroke-linejoin": !0
      }), children$1b(r).forEach(detach$1c), m.forEach(detach$1c), this.h();
    },
    h() {
      attr$1b(r, "d", "M5 13L9 17L19 7"), attr$1b(r, "stroke", "currentColor"), attr$1b(r, "stroke-width", "1.5"), attr$1b(r, "stroke-linecap", "round"), attr$1b(r, "stroke-linejoin", "round"), attr$1b(e, "width", "100%"), attr$1b(e, "height", "100%"), attr$1b(e, "stroke-width", "1.5"), attr$1b(e, "viewBox", "0 0 24 24"), attr$1b(e, "fill", "none"), attr$1b(e, "xmlns", "http://www.w3.org/2000/svg"), attr$1b(e, "color", "currentColor");
    },
    m(o, m) {
      insert_hydration$1c(o, e, m), append_hydration$18(e, r);
    },
    p: noop$16,
    i: noop$16,
    o: noop$16,
    d(o) {
      o && detach$1c(e);
    }
  };
}
class Check extends SvelteComponent$1d {
  constructor(e) {
    super(), init$1d(this, e, null, create_fragment$8, safe_not_equal$1d, {});
  }
}
const {
  SvelteComponent: SvelteComponent$1c,
  append_hydration: append_hydration$17,
  attr: attr$1a,
  children: children$1a,
  claim_svg_element: claim_svg_element$10,
  detach: detach$1b,
  init: init$1c,
  insert_hydration: insert_hydration$1b,
  noop: noop$15,
  safe_not_equal: safe_not_equal$1c,
  svg_element: svg_element$10
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$1b,
  append_hydration: append_hydration$16,
  attr: attr$19,
  children: children$19,
  claim_svg_element: claim_svg_element$$,
  detach: detach$1a,
  init: init$1b,
  insert_hydration: insert_hydration$1a,
  noop: noop$14,
  safe_not_equal: safe_not_equal$1b,
  set_style: set_style$6,
  svg_element: svg_element$$
} = window.__gradio__svelte__internal;
function create_fragment$7(s) {
  let e, r, o, m;
  return {
    c() {
      e = svg_element$$("svg"), r = svg_element$$("g"), o = svg_element$$("path"), m = svg_element$$("path"), this.h();
    },
    l(_) {
      e = claim_svg_element$$(_, "svg", {
        width: !0,
        height: !0,
        viewBox: !0,
        version: !0,
        xmlns: !0,
        "xmlns:xlink": !0,
        "xml:space": !0,
        stroke: !0,
        style: !0
      });
      var g = children$19(e);
      r = claim_svg_element$$(g, "g", { transform: !0 });
      var y = children$19(r);
      o = claim_svg_element$$(y, "path", { d: !0, style: !0 }), children$19(o).forEach(detach$1a), y.forEach(detach$1a), m = claim_svg_element$$(g, "path", { d: !0, style: !0 }), children$19(m).forEach(detach$1a), g.forEach(detach$1a), this.h();
    },
    h() {
      attr$19(o, "d", "M18,6L6.087,17.913"), set_style$6(o, "fill", "none"), set_style$6(o, "fill-rule", "nonzero"), set_style$6(o, "stroke-width", "2px"), attr$19(r, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), attr$19(m, "d", "M4.364,4.364L19.636,19.636"), set_style$6(m, "fill", "none"), set_style$6(m, "fill-rule", "nonzero"), set_style$6(m, "stroke-width", "2px"), attr$19(e, "width", "100%"), attr$19(e, "height", "100%"), attr$19(e, "viewBox", "0 0 24 24"), attr$19(e, "version", "1.1"), attr$19(e, "xmlns", "http://www.w3.org/2000/svg"), attr$19(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), attr$19(e, "xml:space", "preserve"), attr$19(e, "stroke", "currentColor"), set_style$6(e, "fill-rule", "evenodd"), set_style$6(e, "clip-rule", "evenodd"), set_style$6(e, "stroke-linecap", "round"), set_style$6(e, "stroke-linejoin", "round");
    },
    m(_, g) {
      insert_hydration$1a(_, e, g), append_hydration$16(e, r), append_hydration$16(r, o), append_hydration$16(e, m);
    },
    p: noop$14,
    i: noop$14,
    o: noop$14,
    d(_) {
      _ && detach$1a(e);
    }
  };
}
class Clear extends SvelteComponent$1b {
  constructor(e) {
    super(), init$1b(this, e, null, create_fragment$7, safe_not_equal$1b, {});
  }
}
const {
  SvelteComponent: SvelteComponent$1a,
  append_hydration: append_hydration$15,
  attr: attr$18,
  children: children$18,
  claim_svg_element: claim_svg_element$_,
  detach: detach$19,
  init: init$1a,
  insert_hydration: insert_hydration$19,
  noop: noop$13,
  safe_not_equal: safe_not_equal$1a,
  svg_element: svg_element$_
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$19,
  append_hydration: append_hydration$14,
  attr: attr$17,
  children: children$17,
  claim_svg_element: claim_svg_element$Z,
  detach: detach$18,
  init: init$19,
  insert_hydration: insert_hydration$18,
  noop: noop$12,
  safe_not_equal: safe_not_equal$19,
  svg_element: svg_element$Z
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$18,
  append_hydration: append_hydration$13,
  attr: attr$16,
  children: children$16,
  claim_svg_element: claim_svg_element$Y,
  detach: detach$17,
  init: init$18,
  insert_hydration: insert_hydration$17,
  noop: noop$11,
  safe_not_equal: safe_not_equal$18,
  svg_element: svg_element$Y
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$17,
  append_hydration: append_hydration$12,
  attr: attr$15,
  children: children$15,
  claim_svg_element: claim_svg_element$X,
  detach: detach$16,
  init: init$17,
  insert_hydration: insert_hydration$16,
  noop: noop$10,
  safe_not_equal: safe_not_equal$17,
  svg_element: svg_element$X
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$16,
  append_hydration: append_hydration$11,
  attr: attr$14,
  children: children$14,
  claim_svg_element: claim_svg_element$W,
  detach: detach$15,
  init: init$16,
  insert_hydration: insert_hydration$15,
  noop: noop$$,
  safe_not_equal: safe_not_equal$16,
  svg_element: svg_element$W
} = window.__gradio__svelte__internal;
function create_fragment$6(s) {
  let e, r, o;
  return {
    c() {
      e = svg_element$W("svg"), r = svg_element$W("path"), o = svg_element$W("path"), this.h();
    },
    l(m) {
      e = claim_svg_element$W(m, "svg", {
        xmlns: !0,
        viewBox: !0,
        color: !0,
        "aria-hidden": !0,
        width: !0,
        height: !0
      });
      var _ = children$14(e);
      r = claim_svg_element$W(_, "path", { fill: !0, d: !0 }), children$14(r).forEach(detach$15), o = claim_svg_element$W(_, "path", { fill: !0, d: !0 }), children$14(o).forEach(detach$15), _.forEach(detach$15), this.h();
    },
    h() {
      attr$14(r, "fill", "currentColor"), attr$14(r, "d", "M28 10v18H10V10h18m0-2H10a2 2 0 0 0-2 2v18a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V10a2 2 0 0 0-2-2Z"), attr$14(o, "fill", "currentColor"), attr$14(o, "d", "M4 18H2V4a2 2 0 0 1 2-2h14v2H4Z"), attr$14(e, "xmlns", "http://www.w3.org/2000/svg"), attr$14(e, "viewBox", "0 0 33 33"), attr$14(e, "color", "currentColor"), attr$14(e, "aria-hidden", "true"), attr$14(e, "width", "100%"), attr$14(e, "height", "100%");
    },
    m(m, _) {
      insert_hydration$15(m, e, _), append_hydration$11(e, r), append_hydration$11(e, o);
    },
    p: noop$$,
    i: noop$$,
    o: noop$$,
    d(m) {
      m && detach$15(e);
    }
  };
}
class Copy extends SvelteComponent$16 {
  constructor(e) {
    super(), init$16(this, e, null, create_fragment$6, safe_not_equal$16, {});
  }
}
const {
  SvelteComponent: SvelteComponent$15,
  append_hydration: append_hydration$10,
  attr: attr$13,
  children: children$13,
  claim_svg_element: claim_svg_element$V,
  detach: detach$14,
  init: init$15,
  insert_hydration: insert_hydration$14,
  noop: noop$_,
  safe_not_equal: safe_not_equal$15,
  svg_element: svg_element$V
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$14,
  append_hydration: append_hydration$$,
  attr: attr$12,
  children: children$12,
  claim_svg_element: claim_svg_element$U,
  detach: detach$13,
  init: init$14,
  insert_hydration: insert_hydration$13,
  noop: noop$Z,
  safe_not_equal: safe_not_equal$14,
  svg_element: svg_element$U
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$13,
  append_hydration: append_hydration$_,
  attr: attr$11,
  children: children$11,
  claim_svg_element: claim_svg_element$T,
  detach: detach$12,
  init: init$13,
  insert_hydration: insert_hydration$12,
  noop: noop$Y,
  safe_not_equal: safe_not_equal$13,
  svg_element: svg_element$T
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$12,
  append_hydration: append_hydration$Z,
  attr: attr$10,
  children: children$10,
  claim_svg_element: claim_svg_element$S,
  detach: detach$11,
  init: init$12,
  insert_hydration: insert_hydration$11,
  noop: noop$X,
  safe_not_equal: safe_not_equal$12,
  svg_element: svg_element$S
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$11,
  append_hydration: append_hydration$Y,
  attr: attr$$,
  children: children$$,
  claim_svg_element: claim_svg_element$R,
  detach: detach$10,
  init: init$11,
  insert_hydration: insert_hydration$10,
  noop: noop$W,
  safe_not_equal: safe_not_equal$11,
  svg_element: svg_element$R
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$10,
  append_hydration: append_hydration$X,
  attr: attr$_,
  children: children$_,
  claim_svg_element: claim_svg_element$Q,
  detach: detach$$,
  init: init$10,
  insert_hydration: insert_hydration$$,
  noop: noop$V,
  safe_not_equal: safe_not_equal$10,
  svg_element: svg_element$Q
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$$,
  append_hydration: append_hydration$W,
  attr: attr$Z,
  children: children$Z,
  claim_svg_element: claim_svg_element$P,
  detach: detach$_,
  init: init$$,
  insert_hydration: insert_hydration$_,
  noop: noop$U,
  safe_not_equal: safe_not_equal$$,
  svg_element: svg_element$P
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$_,
  append_hydration: append_hydration$V,
  attr: attr$Y,
  children: children$Y,
  claim_svg_element: claim_svg_element$O,
  detach: detach$Z,
  init: init$_,
  insert_hydration: insert_hydration$Z,
  noop: noop$T,
  safe_not_equal: safe_not_equal$_,
  svg_element: svg_element$O
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$Z,
  append_hydration: append_hydration$U,
  attr: attr$X,
  children: children$X,
  claim_svg_element: claim_svg_element$N,
  detach: detach$Y,
  init: init$Z,
  insert_hydration: insert_hydration$Y,
  noop: noop$S,
  safe_not_equal: safe_not_equal$Z,
  svg_element: svg_element$N
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$Y,
  append_hydration: append_hydration$T,
  attr: attr$W,
  children: children$W,
  claim_svg_element: claim_svg_element$M,
  detach: detach$X,
  init: init$Y,
  insert_hydration: insert_hydration$X,
  noop: noop$R,
  safe_not_equal: safe_not_equal$Y,
  svg_element: svg_element$M
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$X,
  append_hydration: append_hydration$S,
  attr: attr$V,
  children: children$V,
  claim_svg_element: claim_svg_element$L,
  detach: detach$W,
  init: init$X,
  insert_hydration: insert_hydration$W,
  noop: noop$Q,
  safe_not_equal: safe_not_equal$X,
  svg_element: svg_element$L
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$W,
  append_hydration: append_hydration$R,
  attr: attr$U,
  children: children$U,
  claim_svg_element: claim_svg_element$K,
  detach: detach$V,
  init: init$W,
  insert_hydration: insert_hydration$V,
  noop: noop$P,
  safe_not_equal: safe_not_equal$W,
  svg_element: svg_element$K
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$V,
  append_hydration: append_hydration$Q,
  attr: attr$T,
  children: children$T,
  claim_svg_element: claim_svg_element$J,
  detach: detach$U,
  init: init$V,
  insert_hydration: insert_hydration$U,
  noop: noop$O,
  safe_not_equal: safe_not_equal$V,
  svg_element: svg_element$J
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$U,
  append_hydration: append_hydration$P,
  attr: attr$S,
  children: children$S,
  claim_svg_element: claim_svg_element$I,
  detach: detach$T,
  init: init$U,
  insert_hydration: insert_hydration$T,
  noop: noop$N,
  safe_not_equal: safe_not_equal$U,
  svg_element: svg_element$I
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$T,
  append_hydration: append_hydration$O,
  attr: attr$R,
  children: children$R,
  claim_svg_element: claim_svg_element$H,
  detach: detach$S,
  init: init$T,
  insert_hydration: insert_hydration$S,
  noop: noop$M,
  safe_not_equal: safe_not_equal$T,
  svg_element: svg_element$H
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$S,
  append_hydration: append_hydration$N,
  attr: attr$Q,
  children: children$Q,
  claim_svg_element: claim_svg_element$G,
  detach: detach$R,
  init: init$S,
  insert_hydration: insert_hydration$R,
  noop: noop$L,
  safe_not_equal: safe_not_equal$S,
  svg_element: svg_element$G
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$R,
  append_hydration: append_hydration$M,
  attr: attr$P,
  children: children$P,
  claim_svg_element: claim_svg_element$F,
  detach: detach$Q,
  init: init$R,
  insert_hydration: insert_hydration$Q,
  noop: noop$K,
  safe_not_equal: safe_not_equal$R,
  svg_element: svg_element$F
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$Q,
  append_hydration: append_hydration$L,
  attr: attr$O,
  children: children$O,
  claim_svg_element: claim_svg_element$E,
  detach: detach$P,
  init: init$Q,
  insert_hydration: insert_hydration$P,
  noop: noop$J,
  safe_not_equal: safe_not_equal$Q,
  svg_element: svg_element$E
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$P,
  append_hydration: append_hydration$K,
  attr: attr$N,
  children: children$N,
  claim_svg_element: claim_svg_element$D,
  detach: detach$O,
  init: init$P,
  insert_hydration: insert_hydration$O,
  noop: noop$I,
  safe_not_equal: safe_not_equal$P,
  svg_element: svg_element$D
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$O,
  append_hydration: append_hydration$J,
  attr: attr$M,
  children: children$M,
  claim_svg_element: claim_svg_element$C,
  detach: detach$N,
  init: init$O,
  insert_hydration: insert_hydration$N,
  noop: noop$H,
  safe_not_equal: safe_not_equal$O,
  svg_element: svg_element$C
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$N,
  append_hydration: append_hydration$I,
  attr: attr$L,
  children: children$L,
  claim_svg_element: claim_svg_element$B,
  detach: detach$M,
  init: init$N,
  insert_hydration: insert_hydration$M,
  noop: noop$G,
  safe_not_equal: safe_not_equal$N,
  svg_element: svg_element$B
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$M,
  append_hydration: append_hydration$H,
  attr: attr$K,
  children: children$K,
  claim_svg_element: claim_svg_element$A,
  detach: detach$L,
  init: init$M,
  insert_hydration: insert_hydration$L,
  noop: noop$F,
  safe_not_equal: safe_not_equal$M,
  svg_element: svg_element$A
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$L,
  append_hydration: append_hydration$G,
  attr: attr$J,
  children: children$J,
  claim_svg_element: claim_svg_element$z,
  detach: detach$K,
  init: init$L,
  insert_hydration: insert_hydration$K,
  noop: noop$E,
  safe_not_equal: safe_not_equal$L,
  svg_element: svg_element$z
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$K,
  append_hydration: append_hydration$F,
  attr: attr$I,
  children: children$I,
  claim_svg_element: claim_svg_element$y,
  detach: detach$J,
  init: init$K,
  insert_hydration: insert_hydration$J,
  noop: noop$D,
  safe_not_equal: safe_not_equal$K,
  svg_element: svg_element$y
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$J,
  append_hydration: append_hydration$E,
  attr: attr$H,
  children: children$H,
  claim_svg_element: claim_svg_element$x,
  detach: detach$I,
  init: init$J,
  insert_hydration: insert_hydration$I,
  noop: noop$C,
  safe_not_equal: safe_not_equal$J,
  svg_element: svg_element$x
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$I,
  append_hydration: append_hydration$D,
  attr: attr$G,
  children: children$G,
  claim_svg_element: claim_svg_element$w,
  detach: detach$H,
  init: init$I,
  insert_hydration: insert_hydration$H,
  noop: noop$B,
  safe_not_equal: safe_not_equal$I,
  svg_element: svg_element$w
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$H,
  append_hydration: append_hydration$C,
  attr: attr$F,
  children: children$F,
  claim_svg_element: claim_svg_element$v,
  detach: detach$G,
  init: init$H,
  insert_hydration: insert_hydration$G,
  noop: noop$A,
  safe_not_equal: safe_not_equal$H,
  svg_element: svg_element$v
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$G,
  append_hydration: append_hydration$B,
  attr: attr$E,
  children: children$E,
  claim_svg_element: claim_svg_element$u,
  detach: detach$F,
  init: init$G,
  insert_hydration: insert_hydration$F,
  noop: noop$z,
  safe_not_equal: safe_not_equal$G,
  svg_element: svg_element$u
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$F,
  append_hydration: append_hydration$A,
  attr: attr$D,
  children: children$D,
  claim_svg_element: claim_svg_element$t,
  detach: detach$E,
  init: init$F,
  insert_hydration: insert_hydration$E,
  noop: noop$y,
  safe_not_equal: safe_not_equal$F,
  svg_element: svg_element$t
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$E,
  append_hydration: append_hydration$z,
  attr: attr$C,
  children: children$C,
  claim_svg_element: claim_svg_element$s,
  detach: detach$D,
  init: init$E,
  insert_hydration: insert_hydration$D,
  noop: noop$x,
  safe_not_equal: safe_not_equal$E,
  set_style: set_style$5,
  svg_element: svg_element$s
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$D,
  append_hydration: append_hydration$y,
  attr: attr$B,
  children: children$B,
  claim_svg_element: claim_svg_element$r,
  detach: detach$C,
  init: init$D,
  insert_hydration: insert_hydration$C,
  noop: noop$w,
  safe_not_equal: safe_not_equal$D,
  svg_element: svg_element$r
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$C,
  append_hydration: append_hydration$x,
  attr: attr$A,
  children: children$A,
  claim_svg_element: claim_svg_element$q,
  detach: detach$B,
  init: init$C,
  insert_hydration: insert_hydration$B,
  noop: noop$v,
  safe_not_equal: safe_not_equal$C,
  svg_element: svg_element$q
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$B,
  append_hydration: append_hydration$w,
  attr: attr$z,
  children: children$z,
  claim_svg_element: claim_svg_element$p,
  detach: detach$A,
  init: init$B,
  insert_hydration: insert_hydration$A,
  noop: noop$u,
  safe_not_equal: safe_not_equal$B,
  svg_element: svg_element$p
} = window.__gradio__svelte__internal;
function create_fragment$5(s) {
  let e, r, o, m, _;
  return {
    c() {
      e = svg_element$p("svg"), r = svg_element$p("g"), o = svg_element$p("g"), m = svg_element$p("g"), _ = svg_element$p("path"), this.h();
    },
    l(g) {
      e = claim_svg_element$p(g, "svg", {
        viewBox: !0,
        width: !0,
        height: !0,
        fill: !0,
        xmlns: !0
      });
      var y = children$z(e);
      r = claim_svg_element$p(y, "g", { id: !0, "stroke-width": !0 }), children$z(r).forEach(detach$A), o = claim_svg_element$p(y, "g", {
        id: !0,
        "stroke-linecap": !0,
        "stroke-linejoin": !0
      }), children$z(o).forEach(detach$A), m = claim_svg_element$p(y, "g", { id: !0 });
      var E = children$z(m);
      _ = claim_svg_element$p(E, "path", { d: !0, fill: !0 }), children$z(_).forEach(detach$A), E.forEach(detach$A), y.forEach(detach$A), this.h();
    },
    h() {
      attr$z(r, "id", "SVGRepo_bgCarrier"), attr$z(r, "stroke-width", "0"), attr$z(o, "id", "SVGRepo_tracerCarrier"), attr$z(o, "stroke-linecap", "round"), attr$z(o, "stroke-linejoin", "round"), attr$z(_, "d", "M19.1168 12.1484C19.474 12.3581 19.9336 12.2384 20.1432 11.8811C20.3528 11.5238 20.2331 11.0643 19.8758 10.8547L19.1168 12.1484ZM6.94331 4.13656L6.55624 4.77902L6.56378 4.78344L6.94331 4.13656ZM5.92408 4.1598L5.50816 3.5357L5.50816 3.5357L5.92408 4.1598ZM5.51031 5.09156L4.76841 5.20151C4.77575 5.25101 4.78802 5.29965 4.80505 5.34671L5.51031 5.09156ZM7.12405 11.7567C7.26496 12.1462 7.69495 12.3477 8.08446 12.2068C8.47397 12.0659 8.67549 11.6359 8.53458 11.2464L7.12405 11.7567ZM19.8758 12.1484C20.2331 11.9388 20.3528 11.4793 20.1432 11.122C19.9336 10.7648 19.474 10.6451 19.1168 10.8547L19.8758 12.1484ZM6.94331 18.8666L6.56375 18.2196L6.55627 18.2241L6.94331 18.8666ZM5.92408 18.8433L5.50815 19.4674H5.50815L5.92408 18.8433ZM5.51031 17.9116L4.80505 17.6564C4.78802 17.7035 4.77575 17.7521 4.76841 17.8016L5.51031 17.9116ZM8.53458 11.7567C8.67549 11.3672 8.47397 10.9372 8.08446 10.7963C7.69495 10.6554 7.26496 10.8569 7.12405 11.2464L8.53458 11.7567ZM19.4963 12.2516C19.9105 12.2516 20.2463 11.9158 20.2463 11.5016C20.2463 11.0873 19.9105 10.7516 19.4963 10.7516V12.2516ZM7.82931 10.7516C7.4151 10.7516 7.07931 11.0873 7.07931 11.5016C7.07931 11.9158 7.4151 12.2516 7.82931 12.2516V10.7516ZM19.8758 10.8547L7.32284 3.48968L6.56378 4.78344L19.1168 12.1484L19.8758 10.8547ZM7.33035 3.49414C6.76609 3.15419 6.05633 3.17038 5.50816 3.5357L6.34 4.78391C6.40506 4.74055 6.4893 4.73863 6.55627 4.77898L7.33035 3.49414ZM5.50816 3.5357C4.95998 3.90102 4.67184 4.54987 4.76841 5.20151L6.25221 4.98161C6.24075 4.90427 6.27494 4.82727 6.34 4.78391L5.50816 3.5357ZM4.80505 5.34671L7.12405 11.7567L8.53458 11.2464L6.21558 4.83641L4.80505 5.34671ZM19.1168 10.8547L6.56378 18.2197L7.32284 19.5134L19.8758 12.1484L19.1168 10.8547ZM6.55627 18.2241C6.4893 18.2645 6.40506 18.2626 6.34 18.2192L5.50815 19.4674C6.05633 19.8327 6.76609 19.8489 7.33035 19.509L6.55627 18.2241ZM6.34 18.2192C6.27494 18.1759 6.24075 18.0988 6.25221 18.0215L4.76841 17.8016C4.67184 18.4532 4.95998 19.1021 5.50815 19.4674L6.34 18.2192ZM6.21558 18.1667L8.53458 11.7567L7.12405 11.2464L4.80505 17.6564L6.21558 18.1667ZM19.4963 10.7516H7.82931V12.2516H19.4963V10.7516Z"), attr$z(_, "fill", "currentColor"), attr$z(m, "id", "SVGRepo_iconCarrier"), attr$z(e, "viewBox", "0 0 22 24"), attr$z(e, "width", "100%"), attr$z(e, "height", "100%"), attr$z(e, "fill", "none"), attr$z(e, "xmlns", "http://www.w3.org/2000/svg");
    },
    m(g, y) {
      insert_hydration$A(g, e, y), append_hydration$w(e, r), append_hydration$w(e, o), append_hydration$w(e, m), append_hydration$w(m, _);
    },
    p: noop$u,
    i: noop$u,
    o: noop$u,
    d(g) {
      g && detach$A(e);
    }
  };
}
class Send extends SvelteComponent$B {
  constructor(e) {
    super(), init$B(this, e, null, create_fragment$5, safe_not_equal$B, {});
  }
}
const {
  SvelteComponent: SvelteComponent$A,
  append_hydration: append_hydration$v,
  attr: attr$y,
  children: children$y,
  claim_svg_element: claim_svg_element$o,
  detach: detach$z,
  init: init$A,
  insert_hydration: insert_hydration$z,
  noop: noop$t,
  safe_not_equal: safe_not_equal$A,
  svg_element: svg_element$o
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$z,
  append_hydration: append_hydration$u,
  attr: attr$x,
  children: children$x,
  claim_svg_element: claim_svg_element$n,
  detach: detach$y,
  init: init$z,
  insert_hydration: insert_hydration$y,
  noop: noop$s,
  safe_not_equal: safe_not_equal$z,
  svg_element: svg_element$n
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$y,
  append_hydration: append_hydration$t,
  attr: attr$w,
  children: children$w,
  claim_svg_element: claim_svg_element$m,
  detach: detach$x,
  init: init$y,
  insert_hydration: insert_hydration$x,
  noop: noop$r,
  safe_not_equal: safe_not_equal$y,
  svg_element: svg_element$m
} = window.__gradio__svelte__internal;
function create_fragment$4(s) {
  let e, r, o;
  return {
    c() {
      e = svg_element$m("svg"), r = svg_element$m("rect"), this.h();
    },
    l(m) {
      e = claim_svg_element$m(m, "svg", {
        xmlns: !0,
        width: !0,
        height: !0,
        viewBox: !0,
        fill: !0,
        stroke: !0,
        "stroke-width": !0,
        "stroke-linecap": !0,
        "stroke-linejoin": !0,
        class: !0
      });
      var _ = children$w(e);
      r = claim_svg_element$m(_, "rect", {
        x: !0,
        y: !0,
        width: !0,
        height: !0,
        rx: !0,
        ry: !0
      }), children$w(r).forEach(detach$x), _.forEach(detach$x), this.h();
    },
    h() {
      attr$w(r, "x", "3"), attr$w(r, "y", "3"), attr$w(r, "width", "18"), attr$w(r, "height", "18"), attr$w(r, "rx", "2"), attr$w(r, "ry", "2"), attr$w(e, "xmlns", "http://www.w3.org/2000/svg"), attr$w(e, "width", "100%"), attr$w(e, "height", "100%"), attr$w(e, "viewBox", "0 0 24 24"), attr$w(
        e,
        "fill",
        /*fill*/
        s[0]
      ), attr$w(e, "stroke", "currentColor"), attr$w(e, "stroke-width", o = `${/*stroke_width*/
      s[1]}`), attr$w(e, "stroke-linecap", "round"), attr$w(e, "stroke-linejoin", "round"), attr$w(e, "class", "feather feather-square");
    },
    m(m, _) {
      insert_hydration$x(m, e, _), append_hydration$t(e, r);
    },
    p(m, [_]) {
      _ & /*fill*/
      1 && attr$w(
        e,
        "fill",
        /*fill*/
        m[0]
      ), _ & /*stroke_width*/
      2 && o !== (o = `${/*stroke_width*/
      m[1]}`) && attr$w(e, "stroke-width", o);
    },
    i: noop$r,
    o: noop$r,
    d(m) {
      m && detach$x(e);
    }
  };
}
function instance$4(s, e, r) {
  let { fill: o = "currentColor" } = e, { stroke_width: m = 1.5 } = e;
  return s.$$set = (_) => {
    "fill" in _ && r(0, o = _.fill), "stroke_width" in _ && r(1, m = _.stroke_width);
  }, [o, m];
}
class Square extends SvelteComponent$y {
  constructor(e) {
    super(), init$y(this, e, instance$4, create_fragment$4, safe_not_equal$y, { fill: 0, stroke_width: 1 });
  }
}
const {
  SvelteComponent: SvelteComponent$x,
  append_hydration: append_hydration$s,
  attr: attr$v,
  children: children$v,
  claim_svg_element: claim_svg_element$l,
  detach: detach$w,
  init: init$x,
  insert_hydration: insert_hydration$w,
  noop: noop$q,
  safe_not_equal: safe_not_equal$x,
  svg_element: svg_element$l
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$w,
  append_hydration: append_hydration$r,
  attr: attr$u,
  children: children$u,
  claim_svg_element: claim_svg_element$k,
  detach: detach$v,
  init: init$w,
  insert_hydration: insert_hydration$v,
  noop: noop$p,
  safe_not_equal: safe_not_equal$w,
  svg_element: svg_element$k
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$v,
  append_hydration: append_hydration$q,
  attr: attr$t,
  children: children$t,
  claim_svg_element: claim_svg_element$j,
  claim_text: claim_text$8,
  detach: detach$u,
  init: init$v,
  insert_hydration: insert_hydration$u,
  noop: noop$o,
  safe_not_equal: safe_not_equal$v,
  svg_element: svg_element$j,
  text: text$9
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$u,
  append_hydration: append_hydration$p,
  attr: attr$s,
  children: children$s,
  claim_svg_element: claim_svg_element$i,
  detach: detach$t,
  init: init$u,
  insert_hydration: insert_hydration$t,
  noop: noop$n,
  safe_not_equal: safe_not_equal$u,
  svg_element: svg_element$i
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$t,
  append_hydration: append_hydration$o,
  attr: attr$r,
  children: children$r,
  claim_svg_element: claim_svg_element$h,
  detach: detach$s,
  init: init$t,
  insert_hydration: insert_hydration$s,
  noop: noop$m,
  safe_not_equal: safe_not_equal$t,
  svg_element: svg_element$h
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$s,
  append_hydration: append_hydration$n,
  attr: attr$q,
  children: children$q,
  claim_svg_element: claim_svg_element$g,
  detach: detach$r,
  init: init$s,
  insert_hydration: insert_hydration$r,
  noop: noop$l,
  safe_not_equal: safe_not_equal$s,
  svg_element: svg_element$g
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$r,
  append_hydration: append_hydration$m,
  attr: attr$p,
  children: children$p,
  claim_svg_element: claim_svg_element$f,
  detach: detach$q,
  init: init$r,
  insert_hydration: insert_hydration$q,
  noop: noop$k,
  safe_not_equal: safe_not_equal$r,
  svg_element: svg_element$f
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$q,
  append_hydration: append_hydration$l,
  attr: attr$o,
  children: children$o,
  claim_svg_element: claim_svg_element$e,
  detach: detach$p,
  init: init$q,
  insert_hydration: insert_hydration$p,
  noop: noop$j,
  safe_not_equal: safe_not_equal$q,
  svg_element: svg_element$e
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$p,
  append_hydration: append_hydration$k,
  attr: attr$n,
  children: children$n,
  claim_svg_element: claim_svg_element$d,
  detach: detach$o,
  init: init$p,
  insert_hydration: insert_hydration$o,
  noop: noop$i,
  safe_not_equal: safe_not_equal$p,
  svg_element: svg_element$d
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$o,
  append_hydration: append_hydration$j,
  attr: attr$m,
  children: children$m,
  claim_svg_element: claim_svg_element$c,
  detach: detach$n,
  init: init$o,
  insert_hydration: insert_hydration$n,
  noop: noop$h,
  safe_not_equal: safe_not_equal$o,
  svg_element: svg_element$c
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$n,
  append_hydration: append_hydration$i,
  attr: attr$l,
  children: children$l,
  claim_svg_element: claim_svg_element$b,
  claim_text: claim_text$7,
  detach: detach$m,
  init: init$n,
  insert_hydration: insert_hydration$m,
  noop: noop$g,
  safe_not_equal: safe_not_equal$n,
  svg_element: svg_element$b,
  text: text$8
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$m,
  append_hydration: append_hydration$h,
  attr: attr$k,
  children: children$k,
  claim_svg_element: claim_svg_element$a,
  claim_text: claim_text$6,
  detach: detach$l,
  init: init$m,
  insert_hydration: insert_hydration$l,
  noop: noop$f,
  safe_not_equal: safe_not_equal$m,
  svg_element: svg_element$a,
  text: text$7
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$l,
  append_hydration: append_hydration$g,
  attr: attr$j,
  children: children$j,
  claim_svg_element: claim_svg_element$9,
  claim_text: claim_text$5,
  detach: detach$k,
  init: init$l,
  insert_hydration: insert_hydration$k,
  noop: noop$e,
  safe_not_equal: safe_not_equal$l,
  svg_element: svg_element$9,
  text: text$6
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$k,
  append_hydration: append_hydration$f,
  attr: attr$i,
  children: children$i,
  claim_svg_element: claim_svg_element$8,
  detach: detach$j,
  init: init$k,
  insert_hydration: insert_hydration$j,
  noop: noop$d,
  safe_not_equal: safe_not_equal$k,
  svg_element: svg_element$8
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$j,
  append_hydration: append_hydration$e,
  attr: attr$h,
  children: children$h,
  claim_svg_element: claim_svg_element$7,
  detach: detach$i,
  init: init$j,
  insert_hydration: insert_hydration$i,
  noop: noop$c,
  safe_not_equal: safe_not_equal$j,
  svg_element: svg_element$7
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$i,
  append_hydration: append_hydration$d,
  attr: attr$g,
  children: children$g,
  claim_svg_element: claim_svg_element$6,
  detach: detach$h,
  init: init$i,
  insert_hydration: insert_hydration$h,
  noop: noop$b,
  safe_not_equal: safe_not_equal$i,
  svg_element: svg_element$6
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$h,
  append_hydration: append_hydration$c,
  attr: attr$f,
  children: children$f,
  claim_svg_element: claim_svg_element$5,
  detach: detach$g,
  init: init$h,
  insert_hydration: insert_hydration$g,
  noop: noop$a,
  safe_not_equal: safe_not_equal$h,
  svg_element: svg_element$5
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$g,
  append_hydration: append_hydration$b,
  attr: attr$e,
  children: children$e,
  claim_svg_element: claim_svg_element$4,
  detach: detach$f,
  init: init$g,
  insert_hydration: insert_hydration$f,
  noop: noop$9,
  safe_not_equal: safe_not_equal$g,
  svg_element: svg_element$4
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$f,
  append_hydration: append_hydration$a,
  attr: attr$d,
  children: children$d,
  claim_svg_element: claim_svg_element$3,
  detach: detach$e,
  init: init$f,
  insert_hydration: insert_hydration$e,
  noop: noop$8,
  safe_not_equal: safe_not_equal$f,
  svg_element: svg_element$3
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$e,
  append_hydration: append_hydration$9,
  attr: attr$c,
  children: children$c,
  claim_svg_element: claim_svg_element$2,
  detach: detach$d,
  init: init$e,
  insert_hydration: insert_hydration$d,
  noop: noop$7,
  safe_not_equal: safe_not_equal$e,
  svg_element: svg_element$2
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$d,
  append_hydration: append_hydration$8,
  attr: attr$b,
  children: children$b,
  claim_svg_element: claim_svg_element$1,
  detach: detach$c,
  init: init$d,
  insert_hydration: insert_hydration$c,
  noop: noop$6,
  safe_not_equal: safe_not_equal$d,
  svg_element: svg_element$1
} = window.__gradio__svelte__internal, color_values = [
  { color: "red", primary: 600, secondary: 100 },
  { color: "green", primary: 600, secondary: 100 },
  { color: "blue", primary: 600, secondary: 100 },
  { color: "yellow", primary: 500, secondary: 100 },
  { color: "purple", primary: 600, secondary: 100 },
  { color: "teal", primary: 600, secondary: 100 },
  { color: "orange", primary: 600, secondary: 100 },
  { color: "cyan", primary: 600, secondary: 100 },
  { color: "lime", primary: 500, secondary: 100 },
  { color: "pink", primary: 600, secondary: 100 }
], tw_colors = {
  inherit: "inherit",
  current: "currentColor",
  transparent: "transparent",
  black: "#000",
  white: "#fff",
  slate: {
    50: "#f8fafc",
    100: "#f1f5f9",
    200: "#e2e8f0",
    300: "#cbd5e1",
    400: "#94a3b8",
    500: "#64748b",
    600: "#475569",
    700: "#334155",
    800: "#1e293b",
    900: "#0f172a",
    950: "#020617"
  },
  gray: {
    50: "#f9fafb",
    100: "#f3f4f6",
    200: "#e5e7eb",
    300: "#d1d5db",
    400: "#9ca3af",
    500: "#6b7280",
    600: "#4b5563",
    700: "#374151",
    800: "#1f2937",
    900: "#111827",
    950: "#030712"
  },
  zinc: {
    50: "#fafafa",
    100: "#f4f4f5",
    200: "#e4e4e7",
    300: "#d4d4d8",
    400: "#a1a1aa",
    500: "#71717a",
    600: "#52525b",
    700: "#3f3f46",
    800: "#27272a",
    900: "#18181b",
    950: "#09090b"
  },
  neutral: {
    50: "#fafafa",
    100: "#f5f5f5",
    200: "#e5e5e5",
    300: "#d4d4d4",
    400: "#a3a3a3",
    500: "#737373",
    600: "#525252",
    700: "#404040",
    800: "#262626",
    900: "#171717",
    950: "#0a0a0a"
  },
  stone: {
    50: "#fafaf9",
    100: "#f5f5f4",
    200: "#e7e5e4",
    300: "#d6d3d1",
    400: "#a8a29e",
    500: "#78716c",
    600: "#57534e",
    700: "#44403c",
    800: "#292524",
    900: "#1c1917",
    950: "#0c0a09"
  },
  red: {
    50: "#fef2f2",
    100: "#fee2e2",
    200: "#fecaca",
    300: "#fca5a5",
    400: "#f87171",
    500: "#ef4444",
    600: "#dc2626",
    700: "#b91c1c",
    800: "#991b1b",
    900: "#7f1d1d",
    950: "#450a0a"
  },
  orange: {
    50: "#fff7ed",
    100: "#ffedd5",
    200: "#fed7aa",
    300: "#fdba74",
    400: "#fb923c",
    500: "#f97316",
    600: "#ea580c",
    700: "#c2410c",
    800: "#9a3412",
    900: "#7c2d12",
    950: "#431407"
  },
  amber: {
    50: "#fffbeb",
    100: "#fef3c7",
    200: "#fde68a",
    300: "#fcd34d",
    400: "#fbbf24",
    500: "#f59e0b",
    600: "#d97706",
    700: "#b45309",
    800: "#92400e",
    900: "#78350f",
    950: "#451a03"
  },
  yellow: {
    50: "#fefce8",
    100: "#fef9c3",
    200: "#fef08a",
    300: "#fde047",
    400: "#facc15",
    500: "#eab308",
    600: "#ca8a04",
    700: "#a16207",
    800: "#854d0e",
    900: "#713f12",
    950: "#422006"
  },
  lime: {
    50: "#f7fee7",
    100: "#ecfccb",
    200: "#d9f99d",
    300: "#bef264",
    400: "#a3e635",
    500: "#84cc16",
    600: "#65a30d",
    700: "#4d7c0f",
    800: "#3f6212",
    900: "#365314",
    950: "#1a2e05"
  },
  green: {
    50: "#f0fdf4",
    100: "#dcfce7",
    200: "#bbf7d0",
    300: "#86efac",
    400: "#4ade80",
    500: "#22c55e",
    600: "#16a34a",
    700: "#15803d",
    800: "#166534",
    900: "#14532d",
    950: "#052e16"
  },
  emerald: {
    50: "#ecfdf5",
    100: "#d1fae5",
    200: "#a7f3d0",
    300: "#6ee7b7",
    400: "#34d399",
    500: "#10b981",
    600: "#059669",
    700: "#047857",
    800: "#065f46",
    900: "#064e3b",
    950: "#022c22"
  },
  teal: {
    50: "#f0fdfa",
    100: "#ccfbf1",
    200: "#99f6e4",
    300: "#5eead4",
    400: "#2dd4bf",
    500: "#14b8a6",
    600: "#0d9488",
    700: "#0f766e",
    800: "#115e59",
    900: "#134e4a",
    950: "#042f2e"
  },
  cyan: {
    50: "#ecfeff",
    100: "#cffafe",
    200: "#a5f3fc",
    300: "#67e8f9",
    400: "#22d3ee",
    500: "#06b6d4",
    600: "#0891b2",
    700: "#0e7490",
    800: "#155e75",
    900: "#164e63",
    950: "#083344"
  },
  sky: {
    50: "#f0f9ff",
    100: "#e0f2fe",
    200: "#bae6fd",
    300: "#7dd3fc",
    400: "#38bdf8",
    500: "#0ea5e9",
    600: "#0284c7",
    700: "#0369a1",
    800: "#075985",
    900: "#0c4a6e",
    950: "#082f49"
  },
  blue: {
    50: "#eff6ff",
    100: "#dbeafe",
    200: "#bfdbfe",
    300: "#93c5fd",
    400: "#60a5fa",
    500: "#3b82f6",
    600: "#2563eb",
    700: "#1d4ed8",
    800: "#1e40af",
    900: "#1e3a8a",
    950: "#172554"
  },
  indigo: {
    50: "#eef2ff",
    100: "#e0e7ff",
    200: "#c7d2fe",
    300: "#a5b4fc",
    400: "#818cf8",
    500: "#6366f1",
    600: "#4f46e5",
    700: "#4338ca",
    800: "#3730a3",
    900: "#312e81",
    950: "#1e1b4b"
  },
  violet: {
    50: "#f5f3ff",
    100: "#ede9fe",
    200: "#ddd6fe",
    300: "#c4b5fd",
    400: "#a78bfa",
    500: "#8b5cf6",
    600: "#7c3aed",
    700: "#6d28d9",
    800: "#5b21b6",
    900: "#4c1d95",
    950: "#2e1065"
  },
  purple: {
    50: "#faf5ff",
    100: "#f3e8ff",
    200: "#e9d5ff",
    300: "#d8b4fe",
    400: "#c084fc",
    500: "#a855f7",
    600: "#9333ea",
    700: "#7e22ce",
    800: "#6b21a8",
    900: "#581c87",
    950: "#3b0764"
  },
  fuchsia: {
    50: "#fdf4ff",
    100: "#fae8ff",
    200: "#f5d0fe",
    300: "#f0abfc",
    400: "#e879f9",
    500: "#d946ef",
    600: "#c026d3",
    700: "#a21caf",
    800: "#86198f",
    900: "#701a75",
    950: "#4a044e"
  },
  pink: {
    50: "#fdf2f8",
    100: "#fce7f3",
    200: "#fbcfe8",
    300: "#f9a8d4",
    400: "#f472b6",
    500: "#ec4899",
    600: "#db2777",
    700: "#be185d",
    800: "#9d174d",
    900: "#831843",
    950: "#500724"
  },
  rose: {
    50: "#fff1f2",
    100: "#ffe4e6",
    200: "#fecdd3",
    300: "#fda4af",
    400: "#fb7185",
    500: "#f43f5e",
    600: "#e11d48",
    700: "#be123c",
    800: "#9f1239",
    900: "#881337",
    950: "#4c0519"
  }
};
color_values.reduce(
  (s, { color: e, primary: r, secondary: o }) => ({
    ...s,
    [e]: {
      primary: tw_colors[e][r],
      secondary: tw_colors[e][o]
    }
  }),
  {}
);
const {
  SvelteComponent: SvelteComponent$c,
  claim_component: claim_component$8,
  create_component: create_component$8,
  destroy_component: destroy_component$8,
  init: init$c,
  mount_component: mount_component$8,
  safe_not_equal: safe_not_equal$c,
  transition_in: transition_in$a,
  transition_out: transition_out$a
} = window.__gradio__svelte__internal, { createEventDispatcher: createEventDispatcher$4 } = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$b,
  append_hydration: append_hydration$7,
  attr: attr$a,
  check_outros: check_outros$7,
  children: children$a,
  claim_component: claim_component$7,
  claim_element: claim_element$a,
  claim_space: claim_space$6,
  claim_text: claim_text$4,
  create_component: create_component$7,
  destroy_component: destroy_component$7,
  detach: detach$b,
  element: element$a,
  empty: empty$6,
  group_outros: group_outros$7,
  init: init$b,
  insert_hydration: insert_hydration$b,
  mount_component: mount_component$7,
  safe_not_equal: safe_not_equal$b,
  set_data: set_data$4,
  space: space$6,
  text: text$5,
  toggle_class: toggle_class$6,
  transition_in: transition_in$9,
  transition_out: transition_out$9
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$a,
  attr: attr$9,
  children: children$9,
  claim_element: claim_element$9,
  create_slot: create_slot$2,
  detach: detach$a,
  element: element$9,
  get_all_dirty_from_scope: get_all_dirty_from_scope$2,
  get_slot_changes: get_slot_changes$2,
  init: init$a,
  insert_hydration: insert_hydration$a,
  safe_not_equal: safe_not_equal$a,
  toggle_class: toggle_class$5,
  transition_in: transition_in$8,
  transition_out: transition_out$8,
  update_slot_base: update_slot_base$2
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$9,
  append_hydration: append_hydration$6,
  attr: attr$8,
  check_outros: check_outros$6,
  children: children$8,
  claim_component: claim_component$6,
  claim_element: claim_element$8,
  claim_space: claim_space$5,
  create_component: create_component$6,
  destroy_component: destroy_component$6,
  detach: detach$9,
  element: element$8,
  empty: empty$5,
  group_outros: group_outros$6,
  init: init$9,
  insert_hydration: insert_hydration$9,
  listen: listen$3,
  mount_component: mount_component$6,
  safe_not_equal: safe_not_equal$9,
  space: space$5,
  toggle_class: toggle_class$4,
  transition_in: transition_in$7,
  transition_out: transition_out$7
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$8,
  attr: attr$7,
  children: children$7,
  claim_element: claim_element$7,
  create_slot: create_slot$1,
  detach: detach$8,
  element: element$7,
  get_all_dirty_from_scope: get_all_dirty_from_scope$1,
  get_slot_changes: get_slot_changes$1,
  init: init$8,
  insert_hydration: insert_hydration$8,
  null_to_empty,
  safe_not_equal: safe_not_equal$8,
  transition_in: transition_in$6,
  transition_out: transition_out$6,
  update_slot_base: update_slot_base$1
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$7,
  check_outros: check_outros$5,
  claim_component: claim_component$5,
  create_component: create_component$5,
  destroy_component: destroy_component$5,
  detach: detach$7,
  empty: empty$4,
  group_outros: group_outros$5,
  init: init$7,
  insert_hydration: insert_hydration$7,
  mount_component: mount_component$5,
  noop: noop$5,
  safe_not_equal: safe_not_equal$7,
  transition_in: transition_in$5,
  transition_out: transition_out$5
} = window.__gradio__svelte__internal, { createEventDispatcher: createEventDispatcher$3 } = window.__gradio__svelte__internal;
function t() {
}
const n = (s) => s, u = typeof window < "u";
let c = u ? () => window.performance.now() : () => Date.now(), f = u ? (s) => requestAnimationFrame(s) : t;
const p = /* @__PURE__ */ new Set();
function l(s) {
  p.forEach((e) => {
    e.c(s) || (p.delete(e), e.f());
  }), p.size !== 0 && f(l);
}
function d(s) {
  let e;
  return p.size === 0 && f(l), { promise: new Promise((r) => {
    p.add(e = { c: s, f: r });
  }), abort() {
    p.delete(e);
  } };
}
function H(s, { delay: e = 0, duration: r = 400, easing: o = n } = {}) {
  const m = +getComputedStyle(s).opacity;
  return { delay: e, duration: r, easing: o, css: (_) => "opacity: " + _ * m };
}
const X = [];
function Z(s, e = t) {
  let r;
  const o = /* @__PURE__ */ new Set();
  function m(g) {
    if (E = g, ((y = s) != y ? E == E : y !== E || y && typeof y == "object" || typeof y == "function") && (s = g, r)) {
      const x = !X.length;
      for (const v of o) v[1](), X.push(v, s);
      if (x) {
        for (let v = 0; v < X.length; v += 2) X[v][0](X[v + 1]);
        X.length = 0;
      }
    }
    var y, E;
  }
  function _(g) {
    m(g(s));
  }
  return { set: m, update: _, subscribe: function(g, y = t) {
    const E = [g, y];
    return o.add(E), o.size === 1 && (r = e(m, _) || t), g(s), () => {
      o.delete(E), o.size === 0 && r && (r(), r = null);
    };
  } };
}
function et(s) {
  return Object.prototype.toString.call(s) === "[object Date]";
}
function rt(s, e, r, o) {
  if (typeof r == "number" || et(r)) {
    const m = o - r, _ = (r - e) / (s.dt || 1 / 60), g = (_ + (s.opts.stiffness * m - s.opts.damping * _) * s.inv_mass) * s.dt;
    return Math.abs(g) < s.opts.precision && Math.abs(m) < s.opts.precision ? o : (s.settled = !1, et(r) ? new Date(r.getTime() + g) : r + g);
  }
  if (Array.isArray(r)) return r.map((m, _) => rt(s, e[_], r[_], o[_]));
  if (typeof r == "object") {
    const m = {};
    for (const _ in r) m[_] = rt(s, e[_], r[_], o[_]);
    return m;
  }
  throw new Error(`Cannot spring ${typeof r} values`);
}
function ot(s, e = {}) {
  const r = Z(s), { stiffness: o = 0.15, damping: m = 0.8, precision: _ = 0.01 } = e;
  let g, y, E, x = s, v = s, h = 1, a = 0, b = !1;
  function w(A, M = {}) {
    v = A;
    const $ = E = {};
    return s == null || M.hard || k.stiffness >= 1 && k.damping >= 1 ? (b = !0, g = c(), x = A, r.set(s = v), Promise.resolve()) : (M.soft && (a = 1 / (60 * (M.soft === !0 ? 0.5 : +M.soft)), h = 0), y || (g = c(), b = !1, y = d((O) => {
      if (b) return b = !1, y = null, !1;
      h = Math.min(h + a, 1);
      const C = { inv_mass: h, opts: k, settled: !0, dt: 60 * (O - g) / 1e3 }, P = rt(C, x, s, v);
      return g = O, x = s, r.set(s = P), C.settled && (y = null), !C.settled;
    })), new Promise((O) => {
      y.promise.then(() => {
        $ === E && O();
      });
    }));
  }
  const k = { set: w, update: (A, M) => w(A(v, s), M), subscribe: r.subscribe, stiffness: o, damping: m, precision: _ };
  return k;
}
const {
  SvelteComponent: SvelteComponent$6,
  action_destroyer,
  add_render_callback: add_render_callback$1,
  append_hydration: append_hydration$5,
  attr: attr$6,
  binding_callbacks: binding_callbacks$2,
  bubble: bubble$2,
  check_outros: check_outros$4,
  children: children$6,
  claim_component: claim_component$4,
  claim_element: claim_element$6,
  claim_space: claim_space$4,
  claim_text: claim_text$3,
  create_component: create_component$4,
  create_in_transition: create_in_transition$1,
  destroy_component: destroy_component$4,
  detach: detach$6,
  element: element$6,
  empty: empty$3,
  group_outros: group_outros$4,
  init: init$6,
  insert_hydration: insert_hydration$6,
  is_function,
  listen: listen$2,
  mount_component: mount_component$4,
  noop: noop$4,
  run_all: run_all$1,
  safe_not_equal: safe_not_equal$6,
  set_data: set_data$3,
  set_input_value,
  space: space$4,
  text: text$4,
  toggle_class: toggle_class$3,
  transition_in: transition_in$4,
  transition_out: transition_out$4
} = window.__gradio__svelte__internal, { beforeUpdate, afterUpdate, createEventDispatcher: createEventDispatcher$2, tick: tick$1 } = window.__gradio__svelte__internal;
function create_if_block_8$1(s) {
  let e, r, o, m;
  const _ = [create_if_block_9$1, create_else_block_3], g = [];
  function y(E, x) {
    return (
      /*copied*/
      E[18] ? 0 : 1
    );
  }
  return e = y(s), r = g[e] = _[e](s), {
    c() {
      r.c(), o = empty$3();
    },
    l(E) {
      r.l(E), o = empty$3();
    },
    m(E, x) {
      g[e].m(E, x), insert_hydration$6(E, o, x), m = !0;
    },
    p(E, x) {
      let v = e;
      e = y(E), e === v ? g[e].p(E, x) : (group_outros$4(), transition_out$4(g[v], 1, 1, () => {
        g[v] = null;
      }), check_outros$4(), r = g[e], r ? r.p(E, x) : (r = g[e] = _[e](E), r.c()), transition_in$4(r, 1), r.m(o.parentNode, o));
    },
    i(E) {
      m || (transition_in$4(r), m = !0);
    },
    o(E) {
      transition_out$4(r), m = !1;
    },
    d(E) {
      E && detach$6(o), g[e].d(E);
    }
  };
}
function create_else_block_3(s) {
  let e, r, o, m, _;
  return r = new Copy({}), {
    c() {
      e = element$6("button"), create_component$4(r.$$.fragment), this.h();
    },
    l(g) {
      e = claim_element$6(g, "BUTTON", {
        class: !0,
        "aria-label": !0,
        "aria-roledescription": !0
      });
      var y = children$6(e);
      claim_component$4(r.$$.fragment, y), y.forEach(detach$6), this.h();
    },
    h() {
      attr$6(e, "class", "copy-button svelte-bj4kw9"), attr$6(e, "aria-label", "Copy"), attr$6(e, "aria-roledescription", "Copy text");
    },
    m(g, y) {
      insert_hydration$6(g, e, y), mount_component$4(r, e, null), o = !0, m || (_ = listen$2(
        e,
        "click",
        /*handle_copy*/
        s[20]
      ), m = !0);
    },
    p: noop$4,
    i(g) {
      o || (transition_in$4(r.$$.fragment, g), o = !0);
    },
    o(g) {
      transition_out$4(r.$$.fragment, g), o = !1;
    },
    d(g) {
      g && detach$6(e), destroy_component$4(r), m = !1, _();
    }
  };
}
function create_if_block_9$1(s) {
  let e, r, o, m;
  return r = new Check({}), {
    c() {
      e = element$6("button"), create_component$4(r.$$.fragment), this.h();
    },
    l(_) {
      e = claim_element$6(_, "BUTTON", {
        class: !0,
        "aria-label": !0,
        "aria-roledescription": !0
      });
      var g = children$6(e);
      claim_component$4(r.$$.fragment, g), g.forEach(detach$6), this.h();
    },
    h() {
      attr$6(e, "class", "copy-button svelte-bj4kw9"), attr$6(e, "aria-label", "Copied"), attr$6(e, "aria-roledescription", "Text copied");
    },
    m(_, g) {
      insert_hydration$6(_, e, g), mount_component$4(r, e, null), m = !0;
    },
    p: noop$4,
    i(_) {
      m || (transition_in$4(r.$$.fragment, _), _ && (o || add_render_callback$1(() => {
        o = create_in_transition$1(e, H, { duration: 300 }), o.start();
      })), m = !0);
    },
    o(_) {
      transition_out$4(r.$$.fragment, _), m = !1;
    },
    d(_) {
      _ && detach$6(e), destroy_component$4(r);
    }
  };
}
function create_default_slot$1(s) {
  let e;
  return {
    c() {
      e = text$4(
        /*label*/
        s[3]
      );
    },
    l(r) {
      e = claim_text$3(
        r,
        /*label*/
        s[3]
      );
    },
    m(r, o) {
      insert_hydration$6(r, e, o);
    },
    p(r, o) {
      o[0] & /*label*/
      8 && set_data$3(
        e,
        /*label*/
        r[3]
      );
    },
    d(r) {
      r && detach$6(e);
    }
  };
}
function create_else_block_2(s) {
  let e, r, o, m, _, g;
  return {
    c() {
      e = element$6("textarea"), this.h();
    },
    l(y) {
      e = claim_element$6(y, "TEXTAREA", {
        "data-testid": !0,
        class: !0,
        dir: !0,
        placeholder: !0,
        rows: !0,
        maxlength: !0,
        style: !0
      }), children$6(e).forEach(detach$6), this.h();
    },
    h() {
      attr$6(e, "data-testid", "textbox"), attr$6(e, "class", "scroll-hide svelte-bj4kw9"), attr$6(e, "dir", r = /*rtl*/
      s[12] ? "rtl" : "ltr"), attr$6(
        e,
        "placeholder",
        /*placeholder*/
        s[2]
      ), attr$6(
        e,
        "rows",
        /*lines*/
        s[1]
      ), e.disabled = /*disabled*/
      s[5], e.autofocus = /*autofocus*/
      s[13], attr$6(
        e,
        "maxlength",
        /*max_length*/
        s[15]
      ), attr$6(e, "style", o = /*text_align*/
      s[14] ? "text-align: " + /*text_align*/
      s[14] : ""), toggle_class$3(e, "no-label", !/*show_label*/
      s[6] && /*submit_btn*/
      (s[10] || /*stop_btn*/
      s[11]));
    },
    m(y, E) {
      insert_hydration$6(y, e, E), set_input_value(
        e,
        /*value*/
        s[0]
      ), s[45](e), /*autofocus*/
      s[13] && e.focus(), _ || (g = [
        action_destroyer(m = /*text_area_resize*/
        s[26].call(
          null,
          e,
          /*value*/
          s[0]
        )),
        listen$2(
          e,
          "input",
          /*textarea_input_handler*/
          s[44]
        ),
        listen$2(
          e,
          "keypress",
          /*handle_keypress*/
          s[22]
        ),
        listen$2(
          e,
          "blur",
          /*blur_handler_3*/
          s[36]
        ),
        listen$2(
          e,
          "select",
          /*handle_select*/
          s[21]
        ),
        listen$2(
          e,
          "focus",
          /*focus_handler_3*/
          s[37]
        ),
        listen$2(
          e,
          "scroll",
          /*handle_scroll*/
          s[23]
        )
      ], _ = !0);
    },
    p(y, E) {
      E[0] & /*rtl*/
      4096 && r !== (r = /*rtl*/
      y[12] ? "rtl" : "ltr") && attr$6(e, "dir", r), E[0] & /*placeholder*/
      4 && attr$6(
        e,
        "placeholder",
        /*placeholder*/
        y[2]
      ), E[0] & /*lines*/
      2 && attr$6(
        e,
        "rows",
        /*lines*/
        y[1]
      ), E[0] & /*disabled*/
      32 && (e.disabled = /*disabled*/
      y[5]), E[0] & /*autofocus*/
      8192 && (e.autofocus = /*autofocus*/
      y[13]), E[0] & /*max_length*/
      32768 && attr$6(
        e,
        "maxlength",
        /*max_length*/
        y[15]
      ), E[0] & /*text_align*/
      16384 && o !== (o = /*text_align*/
      y[14] ? "text-align: " + /*text_align*/
      y[14] : "") && attr$6(e, "style", o), m && is_function(m.update) && E[0] & /*value*/
      1 && m.update.call(
        null,
        /*value*/
        y[0]
      ), E[0] & /*value*/
      1 && set_input_value(
        e,
        /*value*/
        y[0]
      ), E[0] & /*show_label, submit_btn, stop_btn*/
      3136 && toggle_class$3(e, "no-label", !/*show_label*/
      y[6] && /*submit_btn*/
      (y[10] || /*stop_btn*/
      y[11]));
    },
    d(y) {
      y && detach$6(e), s[45](null), _ = !1, run_all$1(g);
    }
  };
}
function create_if_block_4$2(s) {
  let e;
  function r(_, g) {
    if (
      /*type*/
      _[8] === "text"
    ) return create_if_block_5$2;
    if (
      /*type*/
      _[8] === "password"
    ) return create_if_block_6$2;
    if (
      /*type*/
      _[8] === "email"
    ) return create_if_block_7$2;
  }
  let o = r(s), m = o && o(s);
  return {
    c() {
      m && m.c(), e = empty$3();
    },
    l(_) {
      m && m.l(_), e = empty$3();
    },
    m(_, g) {
      m && m.m(_, g), insert_hydration$6(_, e, g);
    },
    p(_, g) {
      o === (o = r(_)) && m ? m.p(_, g) : (m && m.d(1), m = o && o(_), m && (m.c(), m.m(e.parentNode, e)));
    },
    d(_) {
      _ && detach$6(e), m && m.d(_);
    }
  };
}
function create_if_block_7$2(s) {
  let e, r, o;
  return {
    c() {
      e = element$6("input"), this.h();
    },
    l(m) {
      e = claim_element$6(m, "INPUT", {
        "data-testid": !0,
        type: !0,
        class: !0,
        placeholder: !0,
        maxlength: !0,
        autocomplete: !0
      }), this.h();
    },
    h() {
      attr$6(e, "data-testid", "textbox"), attr$6(e, "type", "email"), attr$6(e, "class", "scroll-hide svelte-bj4kw9"), attr$6(
        e,
        "placeholder",
        /*placeholder*/
        s[2]
      ), e.disabled = /*disabled*/
      s[5], e.autofocus = /*autofocus*/
      s[13], attr$6(
        e,
        "maxlength",
        /*max_length*/
        s[15]
      ), attr$6(e, "autocomplete", "email");
    },
    m(m, _) {
      insert_hydration$6(m, e, _), set_input_value(
        e,
        /*value*/
        s[0]
      ), s[43](e), /*autofocus*/
      s[13] && e.focus(), r || (o = [
        listen$2(
          e,
          "input",
          /*input_input_handler_2*/
          s[42]
        ),
        listen$2(
          e,
          "keypress",
          /*handle_keypress*/
          s[22]
        ),
        listen$2(
          e,
          "blur",
          /*blur_handler_2*/
          s[34]
        ),
        listen$2(
          e,
          "select",
          /*handle_select*/
          s[21]
        ),
        listen$2(
          e,
          "focus",
          /*focus_handler_2*/
          s[35]
        )
      ], r = !0);
    },
    p(m, _) {
      _[0] & /*placeholder*/
      4 && attr$6(
        e,
        "placeholder",
        /*placeholder*/
        m[2]
      ), _[0] & /*disabled*/
      32 && (e.disabled = /*disabled*/
      m[5]), _[0] & /*autofocus*/
      8192 && (e.autofocus = /*autofocus*/
      m[13]), _[0] & /*max_length*/
      32768 && attr$6(
        e,
        "maxlength",
        /*max_length*/
        m[15]
      ), _[0] & /*value*/
      1 && e.value !== /*value*/
      m[0] && set_input_value(
        e,
        /*value*/
        m[0]
      );
    },
    d(m) {
      m && detach$6(e), s[43](null), r = !1, run_all$1(o);
    }
  };
}
function create_if_block_6$2(s) {
  let e, r, o;
  return {
    c() {
      e = element$6("input"), this.h();
    },
    l(m) {
      e = claim_element$6(m, "INPUT", {
        "data-testid": !0,
        type: !0,
        class: !0,
        placeholder: !0,
        maxlength: !0,
        autocomplete: !0
      }), this.h();
    },
    h() {
      attr$6(e, "data-testid", "password"), attr$6(e, "type", "password"), attr$6(e, "class", "scroll-hide svelte-bj4kw9"), attr$6(
        e,
        "placeholder",
        /*placeholder*/
        s[2]
      ), e.disabled = /*disabled*/
      s[5], e.autofocus = /*autofocus*/
      s[13], attr$6(
        e,
        "maxlength",
        /*max_length*/
        s[15]
      ), attr$6(e, "autocomplete", "");
    },
    m(m, _) {
      insert_hydration$6(m, e, _), set_input_value(
        e,
        /*value*/
        s[0]
      ), s[41](e), /*autofocus*/
      s[13] && e.focus(), r || (o = [
        listen$2(
          e,
          "input",
          /*input_input_handler_1*/
          s[40]
        ),
        listen$2(
          e,
          "keypress",
          /*handle_keypress*/
          s[22]
        ),
        listen$2(
          e,
          "blur",
          /*blur_handler_1*/
          s[32]
        ),
        listen$2(
          e,
          "select",
          /*handle_select*/
          s[21]
        ),
        listen$2(
          e,
          "focus",
          /*focus_handler_1*/
          s[33]
        )
      ], r = !0);
    },
    p(m, _) {
      _[0] & /*placeholder*/
      4 && attr$6(
        e,
        "placeholder",
        /*placeholder*/
        m[2]
      ), _[0] & /*disabled*/
      32 && (e.disabled = /*disabled*/
      m[5]), _[0] & /*autofocus*/
      8192 && (e.autofocus = /*autofocus*/
      m[13]), _[0] & /*max_length*/
      32768 && attr$6(
        e,
        "maxlength",
        /*max_length*/
        m[15]
      ), _[0] & /*value*/
      1 && e.value !== /*value*/
      m[0] && set_input_value(
        e,
        /*value*/
        m[0]
      );
    },
    d(m) {
      m && detach$6(e), s[41](null), r = !1, run_all$1(o);
    }
  };
}
function create_if_block_5$2(s) {
  let e, r, o, m, _;
  return {
    c() {
      e = element$6("input"), this.h();
    },
    l(g) {
      e = claim_element$6(g, "INPUT", {
        "data-testid": !0,
        type: !0,
        class: !0,
        dir: !0,
        placeholder: !0,
        maxlength: !0,
        style: !0
      }), this.h();
    },
    h() {
      attr$6(e, "data-testid", "textbox"), attr$6(e, "type", "text"), attr$6(e, "class", "scroll-hide svelte-bj4kw9"), attr$6(e, "dir", r = /*rtl*/
      s[12] ? "rtl" : "ltr"), attr$6(
        e,
        "placeholder",
        /*placeholder*/
        s[2]
      ), e.disabled = /*disabled*/
      s[5], e.autofocus = /*autofocus*/
      s[13], attr$6(
        e,
        "maxlength",
        /*max_length*/
        s[15]
      ), attr$6(e, "style", o = /*text_align*/
      s[14] ? "text-align: " + /*text_align*/
      s[14] : "");
    },
    m(g, y) {
      insert_hydration$6(g, e, y), set_input_value(
        e,
        /*value*/
        s[0]
      ), s[39](e), /*autofocus*/
      s[13] && e.focus(), m || (_ = [
        listen$2(
          e,
          "input",
          /*input_input_handler*/
          s[38]
        ),
        listen$2(
          e,
          "keypress",
          /*handle_keypress*/
          s[22]
        ),
        listen$2(
          e,
          "blur",
          /*blur_handler*/
          s[30]
        ),
        listen$2(
          e,
          "select",
          /*handle_select*/
          s[21]
        ),
        listen$2(
          e,
          "focus",
          /*focus_handler*/
          s[31]
        )
      ], m = !0);
    },
    p(g, y) {
      y[0] & /*rtl*/
      4096 && r !== (r = /*rtl*/
      g[12] ? "rtl" : "ltr") && attr$6(e, "dir", r), y[0] & /*placeholder*/
      4 && attr$6(
        e,
        "placeholder",
        /*placeholder*/
        g[2]
      ), y[0] & /*disabled*/
      32 && (e.disabled = /*disabled*/
      g[5]), y[0] & /*autofocus*/
      8192 && (e.autofocus = /*autofocus*/
      g[13]), y[0] & /*max_length*/
      32768 && attr$6(
        e,
        "maxlength",
        /*max_length*/
        g[15]
      ), y[0] & /*text_align*/
      16384 && o !== (o = /*text_align*/
      g[14] ? "text-align: " + /*text_align*/
      g[14] : "") && attr$6(e, "style", o), y[0] & /*value*/
      1 && e.value !== /*value*/
      g[0] && set_input_value(
        e,
        /*value*/
        g[0]
      );
    },
    d(g) {
      g && detach$6(e), s[39](null), m = !1, run_all$1(_);
    }
  };
}
function create_if_block_2$2(s) {
  let e, r, o, m, _, g;
  const y = [create_if_block_3$2, create_else_block_1$1], E = [];
  function x(v, h) {
    return (
      /*submit_btn*/
      v[10] === !0 ? 0 : 1
    );
  }
  return r = x(s), o = E[r] = y[r](s), {
    c() {
      e = element$6("button"), o.c(), this.h();
    },
    l(v) {
      e = claim_element$6(v, "BUTTON", { class: !0 });
      var h = children$6(e);
      o.l(h), h.forEach(detach$6), this.h();
    },
    h() {
      attr$6(e, "class", "submit-button svelte-bj4kw9"), toggle_class$3(
        e,
        "padded-button",
        /*submit_btn*/
        s[10] !== !0
      );
    },
    m(v, h) {
      insert_hydration$6(v, e, h), E[r].m(e, null), m = !0, _ || (g = listen$2(
        e,
        "click",
        /*handle_submit*/
        s[25]
      ), _ = !0);
    },
    p(v, h) {
      let a = r;
      r = x(v), r === a ? E[r].p(v, h) : (group_outros$4(), transition_out$4(E[a], 1, 1, () => {
        E[a] = null;
      }), check_outros$4(), o = E[r], o ? o.p(v, h) : (o = E[r] = y[r](v), o.c()), transition_in$4(o, 1), o.m(e, null)), (!m || h[0] & /*submit_btn*/
      1024) && toggle_class$3(
        e,
        "padded-button",
        /*submit_btn*/
        v[10] !== !0
      );
    },
    i(v) {
      m || (transition_in$4(o), m = !0);
    },
    o(v) {
      transition_out$4(o), m = !1;
    },
    d(v) {
      v && detach$6(e), E[r].d(), _ = !1, g();
    }
  };
}
function create_else_block_1$1(s) {
  let e;
  return {
    c() {
      e = text$4(
        /*submit_btn*/
        s[10]
      );
    },
    l(r) {
      e = claim_text$3(
        r,
        /*submit_btn*/
        s[10]
      );
    },
    m(r, o) {
      insert_hydration$6(r, e, o);
    },
    p(r, o) {
      o[0] & /*submit_btn*/
      1024 && set_data$3(
        e,
        /*submit_btn*/
        r[10]
      );
    },
    i: noop$4,
    o: noop$4,
    d(r) {
      r && detach$6(e);
    }
  };
}
function create_if_block_3$2(s) {
  let e, r;
  return e = new Send({}), {
    c() {
      create_component$4(e.$$.fragment);
    },
    l(o) {
      claim_component$4(e.$$.fragment, o);
    },
    m(o, m) {
      mount_component$4(e, o, m), r = !0;
    },
    p: noop$4,
    i(o) {
      r || (transition_in$4(e.$$.fragment, o), r = !0);
    },
    o(o) {
      transition_out$4(e.$$.fragment, o), r = !1;
    },
    d(o) {
      destroy_component$4(e, o);
    }
  };
}
function create_if_block$2(s) {
  let e, r, o, m, _, g;
  const y = [create_if_block_1$2, create_else_block$2], E = [];
  function x(v, h) {
    return (
      /*stop_btn*/
      v[11] === !0 ? 0 : 1
    );
  }
  return r = x(s), o = E[r] = y[r](s), {
    c() {
      e = element$6("button"), o.c(), this.h();
    },
    l(v) {
      e = claim_element$6(v, "BUTTON", { class: !0 });
      var h = children$6(e);
      o.l(h), h.forEach(detach$6), this.h();
    },
    h() {
      attr$6(e, "class", "stop-button svelte-bj4kw9"), toggle_class$3(
        e,
        "padded-button",
        /*stop_btn*/
        s[11] !== !0
      );
    },
    m(v, h) {
      insert_hydration$6(v, e, h), E[r].m(e, null), m = !0, _ || (g = listen$2(
        e,
        "click",
        /*handle_stop*/
        s[24]
      ), _ = !0);
    },
    p(v, h) {
      let a = r;
      r = x(v), r === a ? E[r].p(v, h) : (group_outros$4(), transition_out$4(E[a], 1, 1, () => {
        E[a] = null;
      }), check_outros$4(), o = E[r], o ? o.p(v, h) : (o = E[r] = y[r](v), o.c()), transition_in$4(o, 1), o.m(e, null)), (!m || h[0] & /*stop_btn*/
      2048) && toggle_class$3(
        e,
        "padded-button",
        /*stop_btn*/
        v[11] !== !0
      );
    },
    i(v) {
      m || (transition_in$4(o), m = !0);
    },
    o(v) {
      transition_out$4(o), m = !1;
    },
    d(v) {
      v && detach$6(e), E[r].d(), _ = !1, g();
    }
  };
}
function create_else_block$2(s) {
  let e;
  return {
    c() {
      e = text$4(
        /*stop_btn*/
        s[11]
      );
    },
    l(r) {
      e = claim_text$3(
        r,
        /*stop_btn*/
        s[11]
      );
    },
    m(r, o) {
      insert_hydration$6(r, e, o);
    },
    p(r, o) {
      o[0] & /*stop_btn*/
      2048 && set_data$3(
        e,
        /*stop_btn*/
        r[11]
      );
    },
    i: noop$4,
    o: noop$4,
    d(r) {
      r && detach$6(e);
    }
  };
}
function create_if_block_1$2(s) {
  let e, r;
  return e = new Square({
    props: { fill: "none", stroke_width: 2.5 }
  }), {
    c() {
      create_component$4(e.$$.fragment);
    },
    l(o) {
      claim_component$4(e.$$.fragment, o);
    },
    m(o, m) {
      mount_component$4(e, o, m), r = !0;
    },
    p: noop$4,
    i(o) {
      r || (transition_in$4(e.$$.fragment, o), r = !0);
    },
    o(o) {
      transition_out$4(e.$$.fragment, o), r = !1;
    },
    d(o) {
      destroy_component$4(e, o);
    }
  };
}
function create_fragment$3(s) {
  let e, r, o, m, _, g, y, E, x = (
    /*show_label*/
    s[6] && /*show_copy_button*/
    s[9] && create_if_block_8$1(s)
  );
  o = new BlockTitle({
    props: {
      show_label: (
        /*show_label*/
        s[6]
      ),
      info: (
        /*info*/
        s[4]
      ),
      $$slots: { default: [create_default_slot$1] },
      $$scope: { ctx: s }
    }
  });
  function v(k, A) {
    return (
      /*lines*/
      k[1] === 1 && /*_max_lines*/
      k[17] === 1 ? create_if_block_4$2 : create_else_block_2
    );
  }
  let h = v(s), a = h(s), b = (
    /*submit_btn*/
    s[10] && create_if_block_2$2(s)
  ), w = (
    /*stop_btn*/
    s[11] && create_if_block$2(s)
  );
  return {
    c() {
      e = element$6("label"), x && x.c(), r = space$4(), create_component$4(o.$$.fragment), m = space$4(), _ = element$6("div"), a.c(), g = space$4(), b && b.c(), y = space$4(), w && w.c(), this.h();
    },
    l(k) {
      e = claim_element$6(k, "LABEL", { class: !0 });
      var A = children$6(e);
      x && x.l(A), r = claim_space$4(A), claim_component$4(o.$$.fragment, A), m = claim_space$4(A), _ = claim_element$6(A, "DIV", { class: !0 });
      var M = children$6(_);
      a.l(M), g = claim_space$4(M), b && b.l(M), y = claim_space$4(M), w && w.l(M), M.forEach(detach$6), A.forEach(detach$6), this.h();
    },
    h() {
      attr$6(_, "class", "input-container svelte-bj4kw9"), attr$6(e, "class", "svelte-bj4kw9"), toggle_class$3(
        e,
        "container",
        /*container*/
        s[7]
      ), toggle_class$3(
        e,
        "show_textbox_border",
        /*show_textbox_border*/
        s[19]
      );
    },
    m(k, A) {
      insert_hydration$6(k, e, A), x && x.m(e, null), append_hydration$5(e, r), mount_component$4(o, e, null), append_hydration$5(e, m), append_hydration$5(e, _), a.m(_, null), append_hydration$5(_, g), b && b.m(_, null), append_hydration$5(_, y), w && w.m(_, null), E = !0;
    },
    p(k, A) {
      /*show_label*/
      k[6] && /*show_copy_button*/
      k[9] ? x ? (x.p(k, A), A[0] & /*show_label, show_copy_button*/
      576 && transition_in$4(x, 1)) : (x = create_if_block_8$1(k), x.c(), transition_in$4(x, 1), x.m(e, r)) : x && (group_outros$4(), transition_out$4(x, 1, 1, () => {
        x = null;
      }), check_outros$4());
      const M = {};
      A[0] & /*show_label*/
      64 && (M.show_label = /*show_label*/
      k[6]), A[0] & /*info*/
      16 && (M.info = /*info*/
      k[4]), A[0] & /*label*/
      8 | A[1] & /*$$scope*/
      33554432 && (M.$$scope = { dirty: A, ctx: k }), o.$set(M), h === (h = v(k)) && a ? a.p(k, A) : (a.d(1), a = h(k), a && (a.c(), a.m(_, g))), /*submit_btn*/
      k[10] ? b ? (b.p(k, A), A[0] & /*submit_btn*/
      1024 && transition_in$4(b, 1)) : (b = create_if_block_2$2(k), b.c(), transition_in$4(b, 1), b.m(_, y)) : b && (group_outros$4(), transition_out$4(b, 1, 1, () => {
        b = null;
      }), check_outros$4()), /*stop_btn*/
      k[11] ? w ? (w.p(k, A), A[0] & /*stop_btn*/
      2048 && transition_in$4(w, 1)) : (w = create_if_block$2(k), w.c(), transition_in$4(w, 1), w.m(_, null)) : w && (group_outros$4(), transition_out$4(w, 1, 1, () => {
        w = null;
      }), check_outros$4()), (!E || A[0] & /*container*/
      128) && toggle_class$3(
        e,
        "container",
        /*container*/
        k[7]
      );
    },
    i(k) {
      E || (transition_in$4(x), transition_in$4(o.$$.fragment, k), transition_in$4(b), transition_in$4(w), E = !0);
    },
    o(k) {
      transition_out$4(x), transition_out$4(o.$$.fragment, k), transition_out$4(b), transition_out$4(w), E = !1;
    },
    d(k) {
      k && detach$6(e), x && x.d(), destroy_component$4(o), a.d(), b && b.d(), w && w.d();
    }
  };
}
function instance$3(s, e, r) {
  var o = this && this.__awaiter || function(_e, He, ke, st) {
    function yt(gt) {
      return gt instanceof ke ? gt : new ke(function(ht) {
        ht(gt);
      });
    }
    return new (ke || (ke = Promise))(function(gt, ht) {
      function vt(ft) {
        try {
          it(st.next(ft));
        } catch (Ee) {
          ht(Ee);
        }
      }
      function _t(ft) {
        try {
          it(st.throw(ft));
        } catch (Ee) {
          ht(Ee);
        }
      }
      function it(ft) {
        ft.done ? gt(ft.value) : yt(ft.value).then(vt, _t);
      }
      it((st = st.apply(_e, He || [])).next());
    });
  };
  let { value: m = "" } = e, { value_is_output: _ = !1 } = e, { lines: g = 1 } = e, { placeholder: y = "Type here..." } = e, { label: E } = e, { info: x = void 0 } = e, { disabled: v = !1 } = e, { show_label: h = !0 } = e, { container: a = !0 } = e, { max_lines: b = void 0 } = e, { type: w = "text" } = e, { show_copy_button: k = !1 } = e, { submit_btn: A = null } = e, { stop_btn: M = null } = e, { rtl: $ = !1 } = e, { autofocus: O = !1 } = e, { text_align: C = void 0 } = e, { autoscroll: P = !0 } = e, { max_length: I = void 0 } = e, N, R = !1, F, B, G = 0, Q = !1, ee;
  const Y = !A, W = createEventDispatcher$2();
  beforeUpdate(() => {
    !Q && N && N.offsetHeight + N.scrollTop > N.scrollHeight - 100 && (B = !0);
  });
  const j = () => {
    B && P && !Q && N.scrollTo(0, N.scrollHeight);
  };
  function J() {
    W("change", m), _ || W("input");
  }
  afterUpdate(() => {
    O && N.focus(), B && P && j(), r(27, _ = !1);
  });
  function me() {
    return o(this, void 0, void 0, function* () {
      "clipboard" in navigator && (yield navigator.clipboard.writeText(m), W("copy", { value: m }), pe());
    });
  }
  function pe() {
    r(18, R = !0), F && clearTimeout(F), F = setTimeout(
      () => {
        r(18, R = !1);
      },
      1e3
    );
  }
  function ye(_e) {
    const He = _e.target, ke = He.value, st = [He.selectionStart, He.selectionEnd];
    W("select", { value: ke.substring(...st), index: st });
  }
  function oe(_e) {
    return o(this, void 0, void 0, function* () {
      yield tick$1(), (_e.key === "Enter" && _e.shiftKey && g > 1 || _e.key === "Enter" && !_e.shiftKey && g === 1 && ee >= 1) && (_e.preventDefault(), W("submit"));
    });
  }
  function we(_e) {
    const He = _e.target, ke = He.scrollTop;
    ke < G && (Q = !0), G = ke;
    const st = He.scrollHeight - He.clientHeight;
    ke >= st && (Q = !1);
  }
  function Se() {
    W("stop");
  }
  function Me() {
    W("submit");
  }
  function de(_e) {
    return o(this, void 0, void 0, function* () {
      if (yield tick$1(), g === ee) return;
      const He = _e.target, ke = window.getComputedStyle(He), st = parseFloat(ke.paddingTop), yt = parseFloat(ke.paddingBottom), gt = parseFloat(ke.lineHeight);
      let ht = ee === void 0 ? !1 : st + yt + gt * ee, vt = st + yt + g * gt;
      He.style.height = "1px";
      let _t;
      ht && He.scrollHeight > ht ? _t = ht : He.scrollHeight < vt ? _t = vt : _t = He.scrollHeight, He.style.height = `${_t}px`;
    });
  }
  function Oe(_e, He) {
    if (g !== ee && (_e.style.overflowY = "scroll", _e.addEventListener("input", de), !!He.trim()))
      return de({ target: _e }), {
        destroy: () => _e.removeEventListener("input", de)
      };
  }
  function $e(_e) {
    bubble$2.call(this, s, _e);
  }
  function ge(_e) {
    bubble$2.call(this, s, _e);
  }
  function Ye(_e) {
    bubble$2.call(this, s, _e);
  }
  function Ie(_e) {
    bubble$2.call(this, s, _e);
  }
  function Ge(_e) {
    bubble$2.call(this, s, _e);
  }
  function Ke(_e) {
    bubble$2.call(this, s, _e);
  }
  function Ne(_e) {
    bubble$2.call(this, s, _e);
  }
  function Ce(_e) {
    bubble$2.call(this, s, _e);
  }
  function lt() {
    m = this.value, r(0, m);
  }
  function ut(_e) {
    binding_callbacks$2[_e ? "unshift" : "push"](() => {
      N = _e, r(16, N);
    });
  }
  function Je() {
    m = this.value, r(0, m);
  }
  function Ze(_e) {
    binding_callbacks$2[_e ? "unshift" : "push"](() => {
      N = _e, r(16, N);
    });
  }
  function at() {
    m = this.value, r(0, m);
  }
  function mt(_e) {
    binding_callbacks$2[_e ? "unshift" : "push"](() => {
      N = _e, r(16, N);
    });
  }
  function pt() {
    m = this.value, r(0, m);
  }
  function tt(_e) {
    binding_callbacks$2[_e ? "unshift" : "push"](() => {
      N = _e, r(16, N);
    });
  }
  return s.$$set = (_e) => {
    "value" in _e && r(0, m = _e.value), "value_is_output" in _e && r(27, _ = _e.value_is_output), "lines" in _e && r(1, g = _e.lines), "placeholder" in _e && r(2, y = _e.placeholder), "label" in _e && r(3, E = _e.label), "info" in _e && r(4, x = _e.info), "disabled" in _e && r(5, v = _e.disabled), "show_label" in _e && r(6, h = _e.show_label), "container" in _e && r(7, a = _e.container), "max_lines" in _e && r(28, b = _e.max_lines), "type" in _e && r(8, w = _e.type), "show_copy_button" in _e && r(9, k = _e.show_copy_button), "submit_btn" in _e && r(10, A = _e.submit_btn), "stop_btn" in _e && r(11, M = _e.stop_btn), "rtl" in _e && r(12, $ = _e.rtl), "autofocus" in _e && r(13, O = _e.autofocus), "text_align" in _e && r(14, C = _e.text_align), "autoscroll" in _e && r(29, P = _e.autoscroll), "max_length" in _e && r(15, I = _e.max_length);
  }, s.$$.update = () => {
    s.$$.dirty[0] & /*max_lines, type, lines*/
    268435714 && (b === void 0 ? w === "text" ? r(17, ee = Math.max(g, 20)) : r(17, ee = 1) : r(17, ee = Math.max(b, g))), s.$$.dirty[0] & /*value*/
    1 && m === null && r(0, m = ""), s.$$.dirty[0] & /*value, el, lines, _max_lines*/
    196611 && N && g !== ee && de({ target: N }), s.$$.dirty[0] & /*value*/
    1 && J();
  }, [
    m,
    g,
    y,
    E,
    x,
    v,
    h,
    a,
    w,
    k,
    A,
    M,
    $,
    O,
    C,
    I,
    N,
    ee,
    R,
    Y,
    me,
    ye,
    oe,
    we,
    Se,
    Me,
    Oe,
    _,
    b,
    P,
    $e,
    ge,
    Ye,
    Ie,
    Ge,
    Ke,
    Ne,
    Ce,
    lt,
    ut,
    Je,
    Ze,
    at,
    mt,
    pt,
    tt
  ];
}
class Textbox extends SvelteComponent$6 {
  constructor(e) {
    super(), init$6(
      this,
      e,
      instance$3,
      create_fragment$3,
      safe_not_equal$6,
      {
        value: 0,
        value_is_output: 27,
        lines: 1,
        placeholder: 2,
        label: 3,
        info: 4,
        disabled: 5,
        show_label: 6,
        container: 7,
        max_lines: 28,
        type: 8,
        show_copy_button: 9,
        submit_btn: 10,
        stop_btn: 11,
        rtl: 12,
        autofocus: 13,
        text_align: 14,
        autoscroll: 29,
        max_length: 15
      },
      null,
      [-1, -1]
    );
  }
}
function pretty_si(s) {
  let e = ["", "k", "M", "G", "T", "P", "E", "Z"], r = 0;
  for (; s > 1e3 && r < e.length - 1; )
    s /= 1e3, r++;
  let o = e[r];
  return (Number.isInteger(s) ? s : s.toFixed(1)) + o;
}
const {
  SvelteComponent: SvelteComponent$5,
  append_hydration: append_hydration$4,
  attr: attr$5,
  children: children$5,
  claim_element: claim_element$5,
  claim_svg_element,
  component_subscribe,
  detach: detach$5,
  element: element$5,
  init: init$5,
  insert_hydration: insert_hydration$5,
  noop: noop$3,
  safe_not_equal: safe_not_equal$5,
  set_style: set_style$4,
  svg_element,
  toggle_class: toggle_class$2
} = window.__gradio__svelte__internal, { onMount: onMount$2 } = window.__gradio__svelte__internal;
function create_fragment$2(s) {
  let e, r, o, m, _, g, y, E, x, v, h, a;
  return {
    c() {
      e = element$5("div"), r = svg_element("svg"), o = svg_element("g"), m = svg_element("path"), _ = svg_element("path"), g = svg_element("path"), y = svg_element("path"), E = svg_element("g"), x = svg_element("path"), v = svg_element("path"), h = svg_element("path"), a = svg_element("path"), this.h();
    },
    l(b) {
      e = claim_element$5(b, "DIV", { class: !0 });
      var w = children$5(e);
      r = claim_svg_element(w, "svg", {
        viewBox: !0,
        fill: !0,
        xmlns: !0,
        class: !0
      });
      var k = children$5(r);
      o = claim_svg_element(k, "g", { style: !0 });
      var A = children$5(o);
      m = claim_svg_element(A, "path", {
        d: !0,
        fill: !0,
        "fill-opacity": !0,
        class: !0
      }), children$5(m).forEach(detach$5), _ = claim_svg_element(A, "path", { d: !0, fill: !0, class: !0 }), children$5(_).forEach(detach$5), g = claim_svg_element(A, "path", {
        d: !0,
        fill: !0,
        "fill-opacity": !0,
        class: !0
      }), children$5(g).forEach(detach$5), y = claim_svg_element(A, "path", { d: !0, fill: !0, class: !0 }), children$5(y).forEach(detach$5), A.forEach(detach$5), E = claim_svg_element(k, "g", { style: !0 });
      var M = children$5(E);
      x = claim_svg_element(M, "path", {
        d: !0,
        fill: !0,
        "fill-opacity": !0,
        class: !0
      }), children$5(x).forEach(detach$5), v = claim_svg_element(M, "path", { d: !0, fill: !0, class: !0 }), children$5(v).forEach(detach$5), h = claim_svg_element(M, "path", {
        d: !0,
        fill: !0,
        "fill-opacity": !0,
        class: !0
      }), children$5(h).forEach(detach$5), a = claim_svg_element(M, "path", { d: !0, fill: !0, class: !0 }), children$5(a).forEach(detach$5), M.forEach(detach$5), k.forEach(detach$5), w.forEach(detach$5), this.h();
    },
    h() {
      attr$5(m, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), attr$5(m, "fill", "#FF7C00"), attr$5(m, "fill-opacity", "0.4"), attr$5(m, "class", "svelte-43sxxs"), attr$5(_, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), attr$5(_, "fill", "#FF7C00"), attr$5(_, "class", "svelte-43sxxs"), attr$5(g, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), attr$5(g, "fill", "#FF7C00"), attr$5(g, "fill-opacity", "0.4"), attr$5(g, "class", "svelte-43sxxs"), attr$5(y, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), attr$5(y, "fill", "#FF7C00"), attr$5(y, "class", "svelte-43sxxs"), set_style$4(o, "transform", "translate(" + /*$top*/
      s[1][0] + "px, " + /*$top*/
      s[1][1] + "px)"), attr$5(x, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), attr$5(x, "fill", "#FF7C00"), attr$5(x, "fill-opacity", "0.4"), attr$5(x, "class", "svelte-43sxxs"), attr$5(v, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), attr$5(v, "fill", "#FF7C00"), attr$5(v, "class", "svelte-43sxxs"), attr$5(h, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), attr$5(h, "fill", "#FF7C00"), attr$5(h, "fill-opacity", "0.4"), attr$5(h, "class", "svelte-43sxxs"), attr$5(a, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), attr$5(a, "fill", "#FF7C00"), attr$5(a, "class", "svelte-43sxxs"), set_style$4(E, "transform", "translate(" + /*$bottom*/
      s[2][0] + "px, " + /*$bottom*/
      s[2][1] + "px)"), attr$5(r, "viewBox", "-1200 -1200 3000 3000"), attr$5(r, "fill", "none"), attr$5(r, "xmlns", "http://www.w3.org/2000/svg"), attr$5(r, "class", "svelte-43sxxs"), attr$5(e, "class", "svelte-43sxxs"), toggle_class$2(
        e,
        "margin",
        /*margin*/
        s[0]
      );
    },
    m(b, w) {
      insert_hydration$5(b, e, w), append_hydration$4(e, r), append_hydration$4(r, o), append_hydration$4(o, m), append_hydration$4(o, _), append_hydration$4(o, g), append_hydration$4(o, y), append_hydration$4(r, E), append_hydration$4(E, x), append_hydration$4(E, v), append_hydration$4(E, h), append_hydration$4(E, a);
    },
    p(b, [w]) {
      w & /*$top*/
      2 && set_style$4(o, "transform", "translate(" + /*$top*/
      b[1][0] + "px, " + /*$top*/
      b[1][1] + "px)"), w & /*$bottom*/
      4 && set_style$4(E, "transform", "translate(" + /*$bottom*/
      b[2][0] + "px, " + /*$bottom*/
      b[2][1] + "px)"), w & /*margin*/
      1 && toggle_class$2(
        e,
        "margin",
        /*margin*/
        b[0]
      );
    },
    i: noop$3,
    o: noop$3,
    d(b) {
      b && detach$5(e);
    }
  };
}
function instance$2(s, e, r) {
  let o, m;
  var _ = this && this.__awaiter || function(b, w, k, A) {
    function M($) {
      return $ instanceof k ? $ : new k(function(O) {
        O($);
      });
    }
    return new (k || (k = Promise))(function($, O) {
      function C(N) {
        try {
          I(A.next(N));
        } catch (R) {
          O(R);
        }
      }
      function P(N) {
        try {
          I(A.throw(N));
        } catch (R) {
          O(R);
        }
      }
      function I(N) {
        N.done ? $(N.value) : M(N.value).then(C, P);
      }
      I((A = A.apply(b, w || [])).next());
    });
  };
  let { margin: g = !0 } = e;
  const y = ot([0, 0]);
  component_subscribe(s, y, (b) => r(1, o = b));
  const E = ot([0, 0]);
  component_subscribe(s, E, (b) => r(2, m = b));
  let x;
  function v() {
    return _(this, void 0, void 0, function* () {
      yield Promise.all([y.set([125, 140]), E.set([-125, -140])]), yield Promise.all([y.set([-125, 140]), E.set([125, -140])]), yield Promise.all([y.set([-125, 0]), E.set([125, -0])]), yield Promise.all([y.set([125, 0]), E.set([-125, 0])]);
    });
  }
  function h() {
    return _(this, void 0, void 0, function* () {
      yield v(), x || h();
    });
  }
  function a() {
    return _(this, void 0, void 0, function* () {
      yield Promise.all([y.set([125, 0]), E.set([-125, 0])]), h();
    });
  }
  return onMount$2(() => (a(), () => x = !0)), s.$$set = (b) => {
    "margin" in b && r(0, g = b.margin);
  }, [g, o, m, y, E];
}
class Loader extends SvelteComponent$5 {
  constructor(e) {
    super(), init$5(this, e, instance$2, create_fragment$2, safe_not_equal$5, { margin: 0 });
  }
}
const {
  SvelteComponent: SvelteComponent$4,
  append_hydration: append_hydration$3,
  attr: attr$4,
  binding_callbacks: binding_callbacks$1,
  check_outros: check_outros$3,
  children: children$4,
  claim_component: claim_component$3,
  claim_element: claim_element$4,
  claim_space: claim_space$3,
  claim_text: claim_text$2,
  create_component: create_component$3,
  create_slot,
  destroy_component: destroy_component$3,
  destroy_each: destroy_each$1,
  detach: detach$4,
  element: element$4,
  empty: empty$2,
  ensure_array_like: ensure_array_like$2,
  get_all_dirty_from_scope,
  get_slot_changes,
  group_outros: group_outros$3,
  init: init$4,
  insert_hydration: insert_hydration$4,
  mount_component: mount_component$3,
  noop: noop$2,
  safe_not_equal: safe_not_equal$4,
  set_data: set_data$2,
  set_style: set_style$3,
  space: space$3,
  text: text$3,
  toggle_class: toggle_class$1,
  transition_in: transition_in$3,
  transition_out: transition_out$3,
  update_slot_base
} = window.__gradio__svelte__internal, { tick } = window.__gradio__svelte__internal, { onDestroy } = window.__gradio__svelte__internal, { createEventDispatcher: createEventDispatcher$1 } = window.__gradio__svelte__internal, get_error_slot_changes = (s) => ({}), get_error_slot_context = (s) => ({}), get_additional_loading_text_slot_changes = (s) => ({}), get_additional_loading_text_slot_context = (s) => ({});
function get_each_context$1(s, e, r) {
  const o = s.slice();
  return o[40] = e[r], o[42] = r, o;
}
function get_each_context_1(s, e, r) {
  const o = s.slice();
  return o[40] = e[r], o;
}
function create_if_block_17(s) {
  let e, r, o, m, _ = (
    /*i18n*/
    s[1]("common.error") + ""
  ), g, y, E;
  r = new IconButton({
    props: {
      Icon: Clear,
      label: (
        /*i18n*/
        s[1]("common.clear")
      ),
      disabled: !1
    }
  }), r.$on(
    "click",
    /*click_handler*/
    s[32]
  );
  const x = (
    /*#slots*/
    s[30].error
  ), v = create_slot(
    x,
    s,
    /*$$scope*/
    s[29],
    get_error_slot_context
  );
  return {
    c() {
      e = element$4("div"), create_component$3(r.$$.fragment), o = space$3(), m = element$4("span"), g = text$3(_), y = space$3(), v && v.c(), this.h();
    },
    l(h) {
      e = claim_element$4(h, "DIV", { class: !0 });
      var a = children$4(e);
      claim_component$3(r.$$.fragment, a), a.forEach(detach$4), o = claim_space$3(h), m = claim_element$4(h, "SPAN", { class: !0 });
      var b = children$4(m);
      g = claim_text$2(b, _), b.forEach(detach$4), y = claim_space$3(h), v && v.l(h), this.h();
    },
    h() {
      attr$4(e, "class", "clear-status svelte-17v219f"), attr$4(m, "class", "error svelte-17v219f");
    },
    m(h, a) {
      insert_hydration$4(h, e, a), mount_component$3(r, e, null), insert_hydration$4(h, o, a), insert_hydration$4(h, m, a), append_hydration$3(m, g), insert_hydration$4(h, y, a), v && v.m(h, a), E = !0;
    },
    p(h, a) {
      const b = {};
      a[0] & /*i18n*/
      2 && (b.label = /*i18n*/
      h[1]("common.clear")), r.$set(b), (!E || a[0] & /*i18n*/
      2) && _ !== (_ = /*i18n*/
      h[1]("common.error") + "") && set_data$2(g, _), v && v.p && (!E || a[0] & /*$$scope*/
      536870912) && update_slot_base(
        v,
        x,
        h,
        /*$$scope*/
        h[29],
        E ? get_slot_changes(
          x,
          /*$$scope*/
          h[29],
          a,
          get_error_slot_changes
        ) : get_all_dirty_from_scope(
          /*$$scope*/
          h[29]
        ),
        get_error_slot_context
      );
    },
    i(h) {
      E || (transition_in$3(r.$$.fragment, h), transition_in$3(v, h), E = !0);
    },
    o(h) {
      transition_out$3(r.$$.fragment, h), transition_out$3(v, h), E = !1;
    },
    d(h) {
      h && (detach$4(e), detach$4(o), detach$4(m), detach$4(y)), destroy_component$3(r), v && v.d(h);
    }
  };
}
function create_if_block$1(s) {
  let e, r, o, m, _, g, y, E, x, v = (
    /*variant*/
    s[8] === "default" && /*show_eta_bar*/
    s[18] && /*show_progress*/
    s[6] === "full" && create_if_block_16(s)
  );
  function h(O, C) {
    if (
      /*progress*/
      O[7]
    ) return create_if_block_11;
    if (
      /*queue_position*/
      O[2] !== null && /*queue_size*/
      O[3] !== void 0 && /*queue_position*/
      O[2] >= 0
    ) return create_if_block_14;
    if (
      /*queue_position*/
      O[2] === 0
    ) return create_if_block_15;
  }
  let a = h(s), b = a && a(s), w = (
    /*timer*/
    s[5] && create_if_block_10(s)
  );
  const k = [create_if_block_2$1, create_if_block_9], A = [];
  function M(O, C) {
    return (
      /*last_progress_level*/
      O[15] != null ? 0 : (
        /*show_progress*/
        O[6] === "full" ? 1 : -1
      )
    );
  }
  ~(_ = M(s)) && (g = A[_] = k[_](s));
  let $ = !/*timer*/
  s[5] && create_if_block_1$1(s);
  return {
    c() {
      v && v.c(), e = space$3(), r = element$4("div"), b && b.c(), o = space$3(), w && w.c(), m = space$3(), g && g.c(), y = space$3(), $ && $.c(), E = empty$2(), this.h();
    },
    l(O) {
      v && v.l(O), e = claim_space$3(O), r = claim_element$4(O, "DIV", { class: !0 });
      var C = children$4(r);
      b && b.l(C), o = claim_space$3(C), w && w.l(C), C.forEach(detach$4), m = claim_space$3(O), g && g.l(O), y = claim_space$3(O), $ && $.l(O), E = empty$2(), this.h();
    },
    h() {
      attr$4(r, "class", "progress-text svelte-17v219f"), toggle_class$1(
        r,
        "meta-text-center",
        /*variant*/
        s[8] === "center"
      ), toggle_class$1(
        r,
        "meta-text",
        /*variant*/
        s[8] === "default"
      );
    },
    m(O, C) {
      v && v.m(O, C), insert_hydration$4(O, e, C), insert_hydration$4(O, r, C), b && b.m(r, null), append_hydration$3(r, o), w && w.m(r, null), insert_hydration$4(O, m, C), ~_ && A[_].m(O, C), insert_hydration$4(O, y, C), $ && $.m(O, C), insert_hydration$4(O, E, C), x = !0;
    },
    p(O, C) {
      /*variant*/
      O[8] === "default" && /*show_eta_bar*/
      O[18] && /*show_progress*/
      O[6] === "full" ? v ? v.p(O, C) : (v = create_if_block_16(O), v.c(), v.m(e.parentNode, e)) : v && (v.d(1), v = null), a === (a = h(O)) && b ? b.p(O, C) : (b && b.d(1), b = a && a(O), b && (b.c(), b.m(r, o))), /*timer*/
      O[5] ? w ? w.p(O, C) : (w = create_if_block_10(O), w.c(), w.m(r, null)) : w && (w.d(1), w = null), (!x || C[0] & /*variant*/
      256) && toggle_class$1(
        r,
        "meta-text-center",
        /*variant*/
        O[8] === "center"
      ), (!x || C[0] & /*variant*/
      256) && toggle_class$1(
        r,
        "meta-text",
        /*variant*/
        O[8] === "default"
      );
      let P = _;
      _ = M(O), _ === P ? ~_ && A[_].p(O, C) : (g && (group_outros$3(), transition_out$3(A[P], 1, 1, () => {
        A[P] = null;
      }), check_outros$3()), ~_ ? (g = A[_], g ? g.p(O, C) : (g = A[_] = k[_](O), g.c()), transition_in$3(g, 1), g.m(y.parentNode, y)) : g = null), /*timer*/
      O[5] ? $ && (group_outros$3(), transition_out$3($, 1, 1, () => {
        $ = null;
      }), check_outros$3()) : $ ? ($.p(O, C), C[0] & /*timer*/
      32 && transition_in$3($, 1)) : ($ = create_if_block_1$1(O), $.c(), transition_in$3($, 1), $.m(E.parentNode, E));
    },
    i(O) {
      x || (transition_in$3(g), transition_in$3($), x = !0);
    },
    o(O) {
      transition_out$3(g), transition_out$3($), x = !1;
    },
    d(O) {
      O && (detach$4(e), detach$4(r), detach$4(m), detach$4(y), detach$4(E)), v && v.d(O), b && b.d(), w && w.d(), ~_ && A[_].d(O), $ && $.d(O);
    }
  };
}
function create_if_block_16(s) {
  let e, r = `translateX(${/*eta_level*/
  (s[17] || 0) * 100 - 100}%)`;
  return {
    c() {
      e = element$4("div"), this.h();
    },
    l(o) {
      e = claim_element$4(o, "DIV", { class: !0 }), children$4(e).forEach(detach$4), this.h();
    },
    h() {
      attr$4(e, "class", "eta-bar svelte-17v219f"), set_style$3(e, "transform", r);
    },
    m(o, m) {
      insert_hydration$4(o, e, m);
    },
    p(o, m) {
      m[0] & /*eta_level*/
      131072 && r !== (r = `translateX(${/*eta_level*/
      (o[17] || 0) * 100 - 100}%)`) && set_style$3(e, "transform", r);
    },
    d(o) {
      o && detach$4(e);
    }
  };
}
function create_if_block_15(s) {
  let e;
  return {
    c() {
      e = text$3("processing |");
    },
    l(r) {
      e = claim_text$2(r, "processing |");
    },
    m(r, o) {
      insert_hydration$4(r, e, o);
    },
    p: noop$2,
    d(r) {
      r && detach$4(e);
    }
  };
}
function create_if_block_14(s) {
  let e, r = (
    /*queue_position*/
    s[2] + 1 + ""
  ), o, m, _, g;
  return {
    c() {
      e = text$3("queue: "), o = text$3(r), m = text$3("/"), _ = text$3(
        /*queue_size*/
        s[3]
      ), g = text$3(" |");
    },
    l(y) {
      e = claim_text$2(y, "queue: "), o = claim_text$2(y, r), m = claim_text$2(y, "/"), _ = claim_text$2(
        y,
        /*queue_size*/
        s[3]
      ), g = claim_text$2(y, " |");
    },
    m(y, E) {
      insert_hydration$4(y, e, E), insert_hydration$4(y, o, E), insert_hydration$4(y, m, E), insert_hydration$4(y, _, E), insert_hydration$4(y, g, E);
    },
    p(y, E) {
      E[0] & /*queue_position*/
      4 && r !== (r = /*queue_position*/
      y[2] + 1 + "") && set_data$2(o, r), E[0] & /*queue_size*/
      8 && set_data$2(
        _,
        /*queue_size*/
        y[3]
      );
    },
    d(y) {
      y && (detach$4(e), detach$4(o), detach$4(m), detach$4(_), detach$4(g));
    }
  };
}
function create_if_block_11(s) {
  let e, r = ensure_array_like$2(
    /*progress*/
    s[7]
  ), o = [];
  for (let m = 0; m < r.length; m += 1)
    o[m] = create_each_block_1(get_each_context_1(s, r, m));
  return {
    c() {
      for (let m = 0; m < o.length; m += 1)
        o[m].c();
      e = empty$2();
    },
    l(m) {
      for (let _ = 0; _ < o.length; _ += 1)
        o[_].l(m);
      e = empty$2();
    },
    m(m, _) {
      for (let g = 0; g < o.length; g += 1)
        o[g] && o[g].m(m, _);
      insert_hydration$4(m, e, _);
    },
    p(m, _) {
      if (_[0] & /*progress*/
      128) {
        r = ensure_array_like$2(
          /*progress*/
          m[7]
        );
        let g;
        for (g = 0; g < r.length; g += 1) {
          const y = get_each_context_1(m, r, g);
          o[g] ? o[g].p(y, _) : (o[g] = create_each_block_1(y), o[g].c(), o[g].m(e.parentNode, e));
        }
        for (; g < o.length; g += 1)
          o[g].d(1);
        o.length = r.length;
      }
    },
    d(m) {
      m && detach$4(e), destroy_each$1(o, m);
    }
  };
}
function create_if_block_12(s) {
  let e, r = (
    /*p*/
    s[40].unit + ""
  ), o, m, _ = " ", g;
  function y(v, h) {
    return (
      /*p*/
      v[40].length != null ? create_if_block_13 : create_else_block$1
    );
  }
  let E = y(s), x = E(s);
  return {
    c() {
      x.c(), e = space$3(), o = text$3(r), m = text$3(" | "), g = text$3(_);
    },
    l(v) {
      x.l(v), e = claim_space$3(v), o = claim_text$2(v, r), m = claim_text$2(v, " | "), g = claim_text$2(v, _);
    },
    m(v, h) {
      x.m(v, h), insert_hydration$4(v, e, h), insert_hydration$4(v, o, h), insert_hydration$4(v, m, h), insert_hydration$4(v, g, h);
    },
    p(v, h) {
      E === (E = y(v)) && x ? x.p(v, h) : (x.d(1), x = E(v), x && (x.c(), x.m(e.parentNode, e))), h[0] & /*progress*/
      128 && r !== (r = /*p*/
      v[40].unit + "") && set_data$2(o, r);
    },
    d(v) {
      v && (detach$4(e), detach$4(o), detach$4(m), detach$4(g)), x.d(v);
    }
  };
}
function create_else_block$1(s) {
  let e = pretty_si(
    /*p*/
    s[40].index || 0
  ) + "", r;
  return {
    c() {
      r = text$3(e);
    },
    l(o) {
      r = claim_text$2(o, e);
    },
    m(o, m) {
      insert_hydration$4(o, r, m);
    },
    p(o, m) {
      m[0] & /*progress*/
      128 && e !== (e = pretty_si(
        /*p*/
        o[40].index || 0
      ) + "") && set_data$2(r, e);
    },
    d(o) {
      o && detach$4(r);
    }
  };
}
function create_if_block_13(s) {
  let e = pretty_si(
    /*p*/
    s[40].index || 0
  ) + "", r, o, m = pretty_si(
    /*p*/
    s[40].length
  ) + "", _;
  return {
    c() {
      r = text$3(e), o = text$3("/"), _ = text$3(m);
    },
    l(g) {
      r = claim_text$2(g, e), o = claim_text$2(g, "/"), _ = claim_text$2(g, m);
    },
    m(g, y) {
      insert_hydration$4(g, r, y), insert_hydration$4(g, o, y), insert_hydration$4(g, _, y);
    },
    p(g, y) {
      y[0] & /*progress*/
      128 && e !== (e = pretty_si(
        /*p*/
        g[40].index || 0
      ) + "") && set_data$2(r, e), y[0] & /*progress*/
      128 && m !== (m = pretty_si(
        /*p*/
        g[40].length
      ) + "") && set_data$2(_, m);
    },
    d(g) {
      g && (detach$4(r), detach$4(o), detach$4(_));
    }
  };
}
function create_each_block_1(s) {
  let e, r = (
    /*p*/
    s[40].index != null && create_if_block_12(s)
  );
  return {
    c() {
      r && r.c(), e = empty$2();
    },
    l(o) {
      r && r.l(o), e = empty$2();
    },
    m(o, m) {
      r && r.m(o, m), insert_hydration$4(o, e, m);
    },
    p(o, m) {
      /*p*/
      o[40].index != null ? r ? r.p(o, m) : (r = create_if_block_12(o), r.c(), r.m(e.parentNode, e)) : r && (r.d(1), r = null);
    },
    d(o) {
      o && detach$4(e), r && r.d(o);
    }
  };
}
function create_if_block_10(s) {
  let e, r = (
    /*eta*/
    s[0] ? `/${/*formatted_eta*/
    s[19]}` : ""
  ), o, m;
  return {
    c() {
      e = text$3(
        /*formatted_timer*/
        s[20]
      ), o = text$3(r), m = text$3("s");
    },
    l(_) {
      e = claim_text$2(
        _,
        /*formatted_timer*/
        s[20]
      ), o = claim_text$2(_, r), m = claim_text$2(_, "s");
    },
    m(_, g) {
      insert_hydration$4(_, e, g), insert_hydration$4(_, o, g), insert_hydration$4(_, m, g);
    },
    p(_, g) {
      g[0] & /*formatted_timer*/
      1048576 && set_data$2(
        e,
        /*formatted_timer*/
        _[20]
      ), g[0] & /*eta, formatted_eta*/
      524289 && r !== (r = /*eta*/
      _[0] ? `/${/*formatted_eta*/
      _[19]}` : "") && set_data$2(o, r);
    },
    d(_) {
      _ && (detach$4(e), detach$4(o), detach$4(m));
    }
  };
}
function create_if_block_9(s) {
  let e, r;
  return e = new Loader({
    props: { margin: (
      /*variant*/
      s[8] === "default"
    ) }
  }), {
    c() {
      create_component$3(e.$$.fragment);
    },
    l(o) {
      claim_component$3(e.$$.fragment, o);
    },
    m(o, m) {
      mount_component$3(e, o, m), r = !0;
    },
    p(o, m) {
      const _ = {};
      m[0] & /*variant*/
      256 && (_.margin = /*variant*/
      o[8] === "default"), e.$set(_);
    },
    i(o) {
      r || (transition_in$3(e.$$.fragment, o), r = !0);
    },
    o(o) {
      transition_out$3(e.$$.fragment, o), r = !1;
    },
    d(o) {
      destroy_component$3(e, o);
    }
  };
}
function create_if_block_2$1(s) {
  let e, r, o, m, _, g = `${/*last_progress_level*/
  s[15] * 100}%`, y = (
    /*progress*/
    s[7] != null && create_if_block_3$1(s)
  );
  return {
    c() {
      e = element$4("div"), r = element$4("div"), y && y.c(), o = space$3(), m = element$4("div"), _ = element$4("div"), this.h();
    },
    l(E) {
      e = claim_element$4(E, "DIV", { class: !0 });
      var x = children$4(e);
      r = claim_element$4(x, "DIV", { class: !0 });
      var v = children$4(r);
      y && y.l(v), v.forEach(detach$4), o = claim_space$3(x), m = claim_element$4(x, "DIV", { class: !0 });
      var h = children$4(m);
      _ = claim_element$4(h, "DIV", { class: !0 }), children$4(_).forEach(detach$4), h.forEach(detach$4), x.forEach(detach$4), this.h();
    },
    h() {
      attr$4(r, "class", "progress-level-inner svelte-17v219f"), attr$4(_, "class", "progress-bar svelte-17v219f"), set_style$3(_, "width", g), attr$4(m, "class", "progress-bar-wrap svelte-17v219f"), attr$4(e, "class", "progress-level svelte-17v219f");
    },
    m(E, x) {
      insert_hydration$4(E, e, x), append_hydration$3(e, r), y && y.m(r, null), append_hydration$3(e, o), append_hydration$3(e, m), append_hydration$3(m, _), s[31](_);
    },
    p(E, x) {
      /*progress*/
      E[7] != null ? y ? y.p(E, x) : (y = create_if_block_3$1(E), y.c(), y.m(r, null)) : y && (y.d(1), y = null), x[0] & /*last_progress_level*/
      32768 && g !== (g = `${/*last_progress_level*/
      E[15] * 100}%`) && set_style$3(_, "width", g);
    },
    i: noop$2,
    o: noop$2,
    d(E) {
      E && detach$4(e), y && y.d(), s[31](null);
    }
  };
}
function create_if_block_3$1(s) {
  let e, r = ensure_array_like$2(
    /*progress*/
    s[7]
  ), o = [];
  for (let m = 0; m < r.length; m += 1)
    o[m] = create_each_block$1(get_each_context$1(s, r, m));
  return {
    c() {
      for (let m = 0; m < o.length; m += 1)
        o[m].c();
      e = empty$2();
    },
    l(m) {
      for (let _ = 0; _ < o.length; _ += 1)
        o[_].l(m);
      e = empty$2();
    },
    m(m, _) {
      for (let g = 0; g < o.length; g += 1)
        o[g] && o[g].m(m, _);
      insert_hydration$4(m, e, _);
    },
    p(m, _) {
      if (_[0] & /*progress_level, progress*/
      16512) {
        r = ensure_array_like$2(
          /*progress*/
          m[7]
        );
        let g;
        for (g = 0; g < r.length; g += 1) {
          const y = get_each_context$1(m, r, g);
          o[g] ? o[g].p(y, _) : (o[g] = create_each_block$1(y), o[g].c(), o[g].m(e.parentNode, e));
        }
        for (; g < o.length; g += 1)
          o[g].d(1);
        o.length = r.length;
      }
    },
    d(m) {
      m && detach$4(e), destroy_each$1(o, m);
    }
  };
}
function create_if_block_4$1(s) {
  let e, r, o, m, _ = (
    /*i*/
    s[42] !== 0 && create_if_block_8()
  ), g = (
    /*p*/
    s[40].desc != null && create_if_block_7$1(s)
  ), y = (
    /*p*/
    s[40].desc != null && /*progress_level*/
    s[14] && /*progress_level*/
    s[14][
      /*i*/
      s[42]
    ] != null && create_if_block_6$1()
  ), E = (
    /*progress_level*/
    s[14] != null && create_if_block_5$1(s)
  );
  return {
    c() {
      _ && _.c(), e = space$3(), g && g.c(), r = space$3(), y && y.c(), o = space$3(), E && E.c(), m = empty$2();
    },
    l(x) {
      _ && _.l(x), e = claim_space$3(x), g && g.l(x), r = claim_space$3(x), y && y.l(x), o = claim_space$3(x), E && E.l(x), m = empty$2();
    },
    m(x, v) {
      _ && _.m(x, v), insert_hydration$4(x, e, v), g && g.m(x, v), insert_hydration$4(x, r, v), y && y.m(x, v), insert_hydration$4(x, o, v), E && E.m(x, v), insert_hydration$4(x, m, v);
    },
    p(x, v) {
      /*p*/
      x[40].desc != null ? g ? g.p(x, v) : (g = create_if_block_7$1(x), g.c(), g.m(r.parentNode, r)) : g && (g.d(1), g = null), /*p*/
      x[40].desc != null && /*progress_level*/
      x[14] && /*progress_level*/
      x[14][
        /*i*/
        x[42]
      ] != null ? y || (y = create_if_block_6$1(), y.c(), y.m(o.parentNode, o)) : y && (y.d(1), y = null), /*progress_level*/
      x[14] != null ? E ? E.p(x, v) : (E = create_if_block_5$1(x), E.c(), E.m(m.parentNode, m)) : E && (E.d(1), E = null);
    },
    d(x) {
      x && (detach$4(e), detach$4(r), detach$4(o), detach$4(m)), _ && _.d(x), g && g.d(x), y && y.d(x), E && E.d(x);
    }
  };
}
function create_if_block_8(s) {
  let e;
  return {
    c() {
      e = text$3(" /");
    },
    l(r) {
      e = claim_text$2(r, " /");
    },
    m(r, o) {
      insert_hydration$4(r, e, o);
    },
    d(r) {
      r && detach$4(e);
    }
  };
}
function create_if_block_7$1(s) {
  let e = (
    /*p*/
    s[40].desc + ""
  ), r;
  return {
    c() {
      r = text$3(e);
    },
    l(o) {
      r = claim_text$2(o, e);
    },
    m(o, m) {
      insert_hydration$4(o, r, m);
    },
    p(o, m) {
      m[0] & /*progress*/
      128 && e !== (e = /*p*/
      o[40].desc + "") && set_data$2(r, e);
    },
    d(o) {
      o && detach$4(r);
    }
  };
}
function create_if_block_6$1(s) {
  let e;
  return {
    c() {
      e = text$3("-");
    },
    l(r) {
      e = claim_text$2(r, "-");
    },
    m(r, o) {
      insert_hydration$4(r, e, o);
    },
    d(r) {
      r && detach$4(e);
    }
  };
}
function create_if_block_5$1(s) {
  let e = (100 * /*progress_level*/
  (s[14][
    /*i*/
    s[42]
  ] || 0)).toFixed(1) + "", r, o;
  return {
    c() {
      r = text$3(e), o = text$3("%");
    },
    l(m) {
      r = claim_text$2(m, e), o = claim_text$2(m, "%");
    },
    m(m, _) {
      insert_hydration$4(m, r, _), insert_hydration$4(m, o, _);
    },
    p(m, _) {
      _[0] & /*progress_level*/
      16384 && e !== (e = (100 * /*progress_level*/
      (m[14][
        /*i*/
        m[42]
      ] || 0)).toFixed(1) + "") && set_data$2(r, e);
    },
    d(m) {
      m && (detach$4(r), detach$4(o));
    }
  };
}
function create_each_block$1(s) {
  let e, r = (
    /*p*/
    (s[40].desc != null || /*progress_level*/
    s[14] && /*progress_level*/
    s[14][
      /*i*/
      s[42]
    ] != null) && create_if_block_4$1(s)
  );
  return {
    c() {
      r && r.c(), e = empty$2();
    },
    l(o) {
      r && r.l(o), e = empty$2();
    },
    m(o, m) {
      r && r.m(o, m), insert_hydration$4(o, e, m);
    },
    p(o, m) {
      /*p*/
      o[40].desc != null || /*progress_level*/
      o[14] && /*progress_level*/
      o[14][
        /*i*/
        o[42]
      ] != null ? r ? r.p(o, m) : (r = create_if_block_4$1(o), r.c(), r.m(e.parentNode, e)) : r && (r.d(1), r = null);
    },
    d(o) {
      o && detach$4(e), r && r.d(o);
    }
  };
}
function create_if_block_1$1(s) {
  let e, r, o, m;
  const _ = (
    /*#slots*/
    s[30]["additional-loading-text"]
  ), g = create_slot(
    _,
    s,
    /*$$scope*/
    s[29],
    get_additional_loading_text_slot_context
  );
  return {
    c() {
      e = element$4("p"), r = text$3(
        /*loading_text*/
        s[9]
      ), o = space$3(), g && g.c(), this.h();
    },
    l(y) {
      e = claim_element$4(y, "P", { class: !0 });
      var E = children$4(e);
      r = claim_text$2(
        E,
        /*loading_text*/
        s[9]
      ), E.forEach(detach$4), o = claim_space$3(y), g && g.l(y), this.h();
    },
    h() {
      attr$4(e, "class", "loading svelte-17v219f");
    },
    m(y, E) {
      insert_hydration$4(y, e, E), append_hydration$3(e, r), insert_hydration$4(y, o, E), g && g.m(y, E), m = !0;
    },
    p(y, E) {
      (!m || E[0] & /*loading_text*/
      512) && set_data$2(
        r,
        /*loading_text*/
        y[9]
      ), g && g.p && (!m || E[0] & /*$$scope*/
      536870912) && update_slot_base(
        g,
        _,
        y,
        /*$$scope*/
        y[29],
        m ? get_slot_changes(
          _,
          /*$$scope*/
          y[29],
          E,
          get_additional_loading_text_slot_changes
        ) : get_all_dirty_from_scope(
          /*$$scope*/
          y[29]
        ),
        get_additional_loading_text_slot_context
      );
    },
    i(y) {
      m || (transition_in$3(g, y), m = !0);
    },
    o(y) {
      transition_out$3(g, y), m = !1;
    },
    d(y) {
      y && (detach$4(e), detach$4(o)), g && g.d(y);
    }
  };
}
function create_fragment$1(s) {
  let e, r, o, m, _;
  const g = [create_if_block$1, create_if_block_17], y = [];
  function E(x, v) {
    return (
      /*status*/
      x[4] === "pending" ? 0 : (
        /*status*/
        x[4] === "error" ? 1 : -1
      )
    );
  }
  return ~(r = E(s)) && (o = y[r] = g[r](s)), {
    c() {
      e = element$4("div"), o && o.c(), this.h();
    },
    l(x) {
      e = claim_element$4(x, "DIV", { class: !0 });
      var v = children$4(e);
      o && o.l(v), v.forEach(detach$4), this.h();
    },
    h() {
      attr$4(e, "class", m = "wrap " + /*variant*/
      s[8] + " " + /*show_progress*/
      s[6] + " svelte-17v219f"), toggle_class$1(e, "hide", !/*status*/
      s[4] || /*status*/
      s[4] === "complete" || /*show_progress*/
      s[6] === "hidden" || /*status*/
      s[4] == "streaming"), toggle_class$1(
        e,
        "translucent",
        /*variant*/
        s[8] === "center" && /*status*/
        (s[4] === "pending" || /*status*/
        s[4] === "error") || /*translucent*/
        s[11] || /*show_progress*/
        s[6] === "minimal"
      ), toggle_class$1(
        e,
        "generating",
        /*status*/
        s[4] === "generating" && /*show_progress*/
        s[6] === "full"
      ), toggle_class$1(
        e,
        "border",
        /*border*/
        s[12]
      ), set_style$3(
        e,
        "position",
        /*absolute*/
        s[10] ? "absolute" : "static"
      ), set_style$3(
        e,
        "padding",
        /*absolute*/
        s[10] ? "0" : "var(--size-8) 0"
      );
    },
    m(x, v) {
      insert_hydration$4(x, e, v), ~r && y[r].m(e, null), s[33](e), _ = !0;
    },
    p(x, v) {
      let h = r;
      r = E(x), r === h ? ~r && y[r].p(x, v) : (o && (group_outros$3(), transition_out$3(y[h], 1, 1, () => {
        y[h] = null;
      }), check_outros$3()), ~r ? (o = y[r], o ? o.p(x, v) : (o = y[r] = g[r](x), o.c()), transition_in$3(o, 1), o.m(e, null)) : o = null), (!_ || v[0] & /*variant, show_progress*/
      320 && m !== (m = "wrap " + /*variant*/
      x[8] + " " + /*show_progress*/
      x[6] + " svelte-17v219f")) && attr$4(e, "class", m), (!_ || v[0] & /*variant, show_progress, status, show_progress*/
      336) && toggle_class$1(e, "hide", !/*status*/
      x[4] || /*status*/
      x[4] === "complete" || /*show_progress*/
      x[6] === "hidden" || /*status*/
      x[4] == "streaming"), (!_ || v[0] & /*variant, show_progress, variant, status, translucent, show_progress*/
      2384) && toggle_class$1(
        e,
        "translucent",
        /*variant*/
        x[8] === "center" && /*status*/
        (x[4] === "pending" || /*status*/
        x[4] === "error") || /*translucent*/
        x[11] || /*show_progress*/
        x[6] === "minimal"
      ), (!_ || v[0] & /*variant, show_progress, status, show_progress*/
      336) && toggle_class$1(
        e,
        "generating",
        /*status*/
        x[4] === "generating" && /*show_progress*/
        x[6] === "full"
      ), (!_ || v[0] & /*variant, show_progress, border*/
      4416) && toggle_class$1(
        e,
        "border",
        /*border*/
        x[12]
      ), v[0] & /*absolute*/
      1024 && set_style$3(
        e,
        "position",
        /*absolute*/
        x[10] ? "absolute" : "static"
      ), v[0] & /*absolute*/
      1024 && set_style$3(
        e,
        "padding",
        /*absolute*/
        x[10] ? "0" : "var(--size-8) 0"
      );
    },
    i(x) {
      _ || (transition_in$3(o), _ = !0);
    },
    o(x) {
      transition_out$3(o), _ = !1;
    },
    d(x) {
      x && detach$4(e), ~r && y[r].d(), s[33](null);
    }
  };
}
var __awaiter = function(s, e, r, o) {
  function m(_) {
    return _ instanceof r ? _ : new r(function(g) {
      g(_);
    });
  }
  return new (r || (r = Promise))(function(_, g) {
    function y(v) {
      try {
        x(o.next(v));
      } catch (h) {
        g(h);
      }
    }
    function E(v) {
      try {
        x(o.throw(v));
      } catch (h) {
        g(h);
      }
    }
    function x(v) {
      v.done ? _(v.value) : m(v.value).then(y, E);
    }
    x((o = o.apply(s, e || [])).next());
  });
};
let items = [], called = !1;
const is_browser = typeof window < "u", raf = is_browser ? window.requestAnimationFrame : (s) => {
};
function scroll_into_view(s) {
  return __awaiter(this, arguments, void 0, function* (e, r = !0) {
    if (!(window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && r !== !0)) {
      if (items.push(e), !called) called = !0;
      else return;
      yield tick(), raf(() => {
        let o = [0, 0];
        for (let m = 0; m < items.length; m++) {
          const g = items[m].getBoundingClientRect();
          (m === 0 || g.top + window.scrollY <= o[0]) && (o[0] = g.top + window.scrollY, o[1] = m);
        }
        window.scrollTo({ top: o[0] - 20, behavior: "smooth" }), called = !1, items = [];
      });
    }
  });
}
function instance$1(s, e, r) {
  let o, { $$slots: m = {}, $$scope: _ } = e;
  const g = createEventDispatcher$1();
  let { i18n: y } = e, { eta: E = null } = e, { queue_position: x } = e, { queue_size: v } = e, { status: h } = e, { scroll_to_output: a = !1 } = e, { timer: b = !0 } = e, { show_progress: w = "full" } = e, { message: k = null } = e, { progress: A = null } = e, { variant: M = "default" } = e, { loading_text: $ = "Loading..." } = e, { absolute: O = !0 } = e, { translucent: C = !1 } = e, { border: P = !1 } = e, { autoscroll: I } = e, N, R = !1, F = 0, B = 0, G = null, Q = null, ee = 0, Y = null, W, j = null, J = !0;
  const me = () => {
    r(0, E = r(27, G = r(19, oe = null))), r(25, F = performance.now()), r(26, B = 0), R = !0, pe();
  };
  function pe() {
    raf(() => {
      r(26, B = (performance.now() - F) / 1e3), R && pe();
    });
  }
  function ye() {
    r(26, B = 0), r(0, E = r(27, G = r(19, oe = null))), R && (R = !1);
  }
  onDestroy(() => {
    R && ye();
  });
  let oe = null;
  function we(de) {
    binding_callbacks$1[de ? "unshift" : "push"](() => {
      j = de, r(16, j), r(7, A), r(14, Y), r(15, W);
    });
  }
  const Se = () => {
    g("clear_status");
  };
  function Me(de) {
    binding_callbacks$1[de ? "unshift" : "push"](() => {
      N = de, r(13, N);
    });
  }
  return s.$$set = (de) => {
    "i18n" in de && r(1, y = de.i18n), "eta" in de && r(0, E = de.eta), "queue_position" in de && r(2, x = de.queue_position), "queue_size" in de && r(3, v = de.queue_size), "status" in de && r(4, h = de.status), "scroll_to_output" in de && r(22, a = de.scroll_to_output), "timer" in de && r(5, b = de.timer), "show_progress" in de && r(6, w = de.show_progress), "message" in de && r(23, k = de.message), "progress" in de && r(7, A = de.progress), "variant" in de && r(8, M = de.variant), "loading_text" in de && r(9, $ = de.loading_text), "absolute" in de && r(10, O = de.absolute), "translucent" in de && r(11, C = de.translucent), "border" in de && r(12, P = de.border), "autoscroll" in de && r(24, I = de.autoscroll), "$$scope" in de && r(29, _ = de.$$scope);
  }, s.$$.update = () => {
    s.$$.dirty[0] & /*eta, old_eta, timer_start, eta_from_start*/
    436207617 && (E === null && r(0, E = G), E != null && G !== E && (r(28, Q = (performance.now() - F) / 1e3 + E), r(19, oe = Q.toFixed(1)), r(27, G = E))), s.$$.dirty[0] & /*eta_from_start, timer_diff*/
    335544320 && r(17, ee = Q === null || Q <= 0 || !B ? null : Math.min(B / Q, 1)), s.$$.dirty[0] & /*progress*/
    128 && A != null && r(18, J = !1), s.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/
    114816 && (A != null ? r(14, Y = A.map((de) => {
      if (de.index != null && de.length != null)
        return de.index / de.length;
      if (de.progress != null)
        return de.progress;
    })) : r(14, Y = null), Y ? (r(15, W = Y[Y.length - 1]), j && (W === 0 ? r(16, j.style.transition = "0", j) : r(16, j.style.transition = "150ms", j))) : r(15, W = void 0)), s.$$.dirty[0] & /*status*/
    16 && (h === "pending" ? me() : ye()), s.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/
    20979728 && N && a && (h === "pending" || h === "complete") && scroll_into_view(N, I), s.$$.dirty[0] & /*status, message*/
    8388624, s.$$.dirty[0] & /*timer_diff*/
    67108864 && r(20, o = B.toFixed(1));
  }, [
    E,
    y,
    x,
    v,
    h,
    b,
    w,
    A,
    M,
    $,
    O,
    C,
    P,
    N,
    Y,
    W,
    j,
    ee,
    J,
    oe,
    o,
    g,
    a,
    k,
    I,
    F,
    B,
    G,
    Q,
    _,
    m,
    we,
    Se,
    Me
  ];
}
class Static extends SvelteComponent$4 {
  constructor(e) {
    super(), init$4(
      this,
      e,
      instance$1,
      create_fragment$1,
      safe_not_equal$4,
      {
        i18n: 1,
        eta: 0,
        queue_position: 2,
        queue_size: 3,
        status: 4,
        scroll_to_output: 22,
        timer: 5,
        show_progress: 6,
        message: 23,
        progress: 7,
        variant: 8,
        loading_text: 9,
        absolute: 10,
        translucent: 11,
        border: 12,
        autoscroll: 24
      },
      null,
      [-1, -1]
    );
  }
}
/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */
const {
  entries,
  setPrototypeOf,
  isFrozen,
  getPrototypeOf,
  getOwnPropertyDescriptor
} = Object;
let {
  freeze,
  seal,
  create
} = Object, {
  apply,
  construct
} = typeof Reflect < "u" && Reflect;
freeze || (freeze = function(e) {
  return e;
});
seal || (seal = function(e) {
  return e;
});
apply || (apply = function(e, r, o) {
  return e.apply(r, o);
});
construct || (construct = function(e, r) {
  return new e(...r);
});
const arrayForEach = unapply(Array.prototype.forEach), arrayLastIndexOf = unapply(Array.prototype.lastIndexOf), arrayPop = unapply(Array.prototype.pop), arrayPush = unapply(Array.prototype.push), arraySplice = unapply(Array.prototype.splice), stringToLowerCase = unapply(String.prototype.toLowerCase), stringToString = unapply(String.prototype.toString), stringMatch = unapply(String.prototype.match), stringReplace = unapply(String.prototype.replace), stringIndexOf = unapply(String.prototype.indexOf), stringTrim = unapply(String.prototype.trim), objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty), regExpTest = unapply(RegExp.prototype.test), typeErrorCreate = unconstruct(TypeError);
function unapply(s) {
  return function(e) {
    e instanceof RegExp && (e.lastIndex = 0);
    for (var r = arguments.length, o = new Array(r > 1 ? r - 1 : 0), m = 1; m < r; m++)
      o[m - 1] = arguments[m];
    return apply(s, e, o);
  };
}
function unconstruct(s) {
  return function() {
    for (var e = arguments.length, r = new Array(e), o = 0; o < e; o++)
      r[o] = arguments[o];
    return construct(s, r);
  };
}
function addToSet(s, e) {
  let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
  setPrototypeOf && setPrototypeOf(s, null);
  let o = e.length;
  for (; o--; ) {
    let m = e[o];
    if (typeof m == "string") {
      const _ = r(m);
      _ !== m && (isFrozen(e) || (e[o] = _), m = _);
    }
    s[m] = !0;
  }
  return s;
}
function cleanArray(s) {
  for (let e = 0; e < s.length; e++)
    objectHasOwnProperty(s, e) || (s[e] = null);
  return s;
}
function clone(s) {
  const e = create(null);
  for (const [r, o] of entries(s))
    objectHasOwnProperty(s, r) && (Array.isArray(o) ? e[r] = cleanArray(o) : o && typeof o == "object" && o.constructor === Object ? e[r] = clone(o) : e[r] = o);
  return e;
}
function lookupGetter(s, e) {
  for (; s !== null; ) {
    const o = getOwnPropertyDescriptor(s, e);
    if (o) {
      if (o.get)
        return unapply(o.get);
      if (typeof o.value == "function")
        return unapply(o.value);
    }
    s = getPrototypeOf(s);
  }
  function r() {
    return null;
  }
  return r;
}
const html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), text$2 = freeze(["#text"]), html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm), ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm), TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm), DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/), ARIA_ATTR = seal(/^aria-[\-\w]+$/), IS_ALLOWED_URI = seal(
  /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
  // eslint-disable-line no-useless-escape
), IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i), ATTR_WHITESPACE = seal(
  /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
  // eslint-disable-line no-control-regex
), DOCTYPE_NAME = seal(/^html$/i), CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
var EXPRESSIONS = /* @__PURE__ */ Object.freeze({
  __proto__: null,
  ARIA_ATTR,
  ATTR_WHITESPACE,
  CUSTOM_ELEMENT,
  DATA_ATTR,
  DOCTYPE_NAME,
  ERB_EXPR,
  IS_ALLOWED_URI,
  IS_SCRIPT_OR_DATA,
  MUSTACHE_EXPR,
  TMPLIT_EXPR
});
const NODE_TYPE = {
  element: 1,
  text: 3,
  // Deprecated
  progressingInstruction: 7,
  comment: 8,
  document: 9
}, getGlobal = function() {
  return typeof window > "u" ? null : window;
}, _createTrustedTypesPolicy = function(e, r) {
  if (typeof e != "object" || typeof e.createPolicy != "function")
    return null;
  let o = null;
  const m = "data-tt-policy-suffix";
  r && r.hasAttribute(m) && (o = r.getAttribute(m));
  const _ = "dompurify" + (o ? "#" + o : "");
  try {
    return e.createPolicy(_, {
      createHTML(g) {
        return g;
      },
      createScriptURL(g) {
        return g;
      }
    });
  } catch {
    return console.warn("TrustedTypes policy " + _ + " could not be created."), null;
  }
}, _createHooksMap = function() {
  return {
    afterSanitizeAttributes: [],
    afterSanitizeElements: [],
    afterSanitizeShadowDOM: [],
    beforeSanitizeAttributes: [],
    beforeSanitizeElements: [],
    beforeSanitizeShadowDOM: [],
    uponSanitizeAttribute: [],
    uponSanitizeElement: [],
    uponSanitizeShadowNode: []
  };
};
function createDOMPurify() {
  let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
  const e = (re) => createDOMPurify(re);
  if (e.version = "3.2.6", e.removed = [], !s || !s.document || s.document.nodeType !== NODE_TYPE.document || !s.Element)
    return e.isSupported = !1, e;
  let {
    document: r
  } = s;
  const o = r, m = o.currentScript, {
    DocumentFragment: _,
    HTMLTemplateElement: g,
    Node: y,
    Element: E,
    NodeFilter: x,
    NamedNodeMap: v = s.NamedNodeMap || s.MozNamedAttrMap,
    HTMLFormElement: h,
    DOMParser: a,
    trustedTypes: b
  } = s, w = E.prototype, k = lookupGetter(w, "cloneNode"), A = lookupGetter(w, "remove"), M = lookupGetter(w, "nextSibling"), $ = lookupGetter(w, "childNodes"), O = lookupGetter(w, "parentNode");
  if (typeof g == "function") {
    const re = r.createElement("template");
    re.content && re.content.ownerDocument && (r = re.content.ownerDocument);
  }
  let C, P = "";
  const {
    implementation: I,
    createNodeIterator: N,
    createDocumentFragment: R,
    getElementsByTagName: F
  } = r, {
    importNode: B
  } = o;
  let G = _createHooksMap();
  e.isSupported = typeof entries == "function" && typeof O == "function" && I && I.createHTMLDocument !== void 0;
  const {
    MUSTACHE_EXPR: Q,
    ERB_EXPR: ee,
    TMPLIT_EXPR: Y,
    DATA_ATTR: W,
    ARIA_ATTR: j,
    IS_SCRIPT_OR_DATA: J,
    ATTR_WHITESPACE: me,
    CUSTOM_ELEMENT: pe
  } = EXPRESSIONS;
  let {
    IS_ALLOWED_URI: ye
  } = EXPRESSIONS, oe = null;
  const we = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text$2]);
  let Se = null;
  const Me = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
  let de = Object.seal(create(null, {
    tagNameCheck: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: null
    },
    attributeNameCheck: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: null
    },
    allowCustomizedBuiltInElements: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: !1
    }
  })), Oe = null, $e = null, ge = !0, Ye = !0, Ie = !1, Ge = !0, Ke = !1, Ne = !0, Ce = !1, lt = !1, ut = !1, Je = !1, Ze = !1, at = !1, mt = !0, pt = !1;
  const tt = "user-content-";
  let _e = !0, He = !1, ke = {}, st = null;
  const yt = addToSet({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
  let gt = null;
  const ht = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
  let vt = null;
  const _t = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), it = "http://www.w3.org/1998/Math/MathML", ft = "http://www.w3.org/2000/svg", Ee = "http://www.w3.org/1999/xhtml";
  let wt = Ee, Nt = !1, Lt = null;
  const Dt = addToSet({}, [it, ft, Ee], stringToString);
  let Ue = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]), Et = addToSet({}, ["annotation-xml"]);
  const qt = addToSet({}, ["title", "style", "font", "a", "script"]);
  let St = null;
  const Fe = ["application/xhtml+xml", "text/html"], De = "text/html";
  let Te = null, kt = null;
  const Ct = r.createElement("form"), Rt = function(q) {
    return q instanceof RegExp || q instanceof Function;
  }, Pt = function() {
    let q = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    if (!(kt && kt === q)) {
      if ((!q || typeof q != "object") && (q = {}), q = clone(q), St = // eslint-disable-next-line unicorn/prefer-includes
      Fe.indexOf(q.PARSER_MEDIA_TYPE) === -1 ? De : q.PARSER_MEDIA_TYPE, Te = St === "application/xhtml+xml" ? stringToString : stringToLowerCase, oe = objectHasOwnProperty(q, "ALLOWED_TAGS") ? addToSet({}, q.ALLOWED_TAGS, Te) : we, Se = objectHasOwnProperty(q, "ALLOWED_ATTR") ? addToSet({}, q.ALLOWED_ATTR, Te) : Me, Lt = objectHasOwnProperty(q, "ALLOWED_NAMESPACES") ? addToSet({}, q.ALLOWED_NAMESPACES, stringToString) : Dt, vt = objectHasOwnProperty(q, "ADD_URI_SAFE_ATTR") ? addToSet(clone(_t), q.ADD_URI_SAFE_ATTR, Te) : _t, gt = objectHasOwnProperty(q, "ADD_DATA_URI_TAGS") ? addToSet(clone(ht), q.ADD_DATA_URI_TAGS, Te) : ht, st = objectHasOwnProperty(q, "FORBID_CONTENTS") ? addToSet({}, q.FORBID_CONTENTS, Te) : yt, Oe = objectHasOwnProperty(q, "FORBID_TAGS") ? addToSet({}, q.FORBID_TAGS, Te) : clone({}), $e = objectHasOwnProperty(q, "FORBID_ATTR") ? addToSet({}, q.FORBID_ATTR, Te) : clone({}), ke = objectHasOwnProperty(q, "USE_PROFILES") ? q.USE_PROFILES : !1, ge = q.ALLOW_ARIA_ATTR !== !1, Ye = q.ALLOW_DATA_ATTR !== !1, Ie = q.ALLOW_UNKNOWN_PROTOCOLS || !1, Ge = q.ALLOW_SELF_CLOSE_IN_ATTR !== !1, Ke = q.SAFE_FOR_TEMPLATES || !1, Ne = q.SAFE_FOR_XML !== !1, Ce = q.WHOLE_DOCUMENT || !1, Je = q.RETURN_DOM || !1, Ze = q.RETURN_DOM_FRAGMENT || !1, at = q.RETURN_TRUSTED_TYPE || !1, ut = q.FORCE_BODY || !1, mt = q.SANITIZE_DOM !== !1, pt = q.SANITIZE_NAMED_PROPS || !1, _e = q.KEEP_CONTENT !== !1, He = q.IN_PLACE || !1, ye = q.ALLOWED_URI_REGEXP || IS_ALLOWED_URI, wt = q.NAMESPACE || Ee, Ue = q.MATHML_TEXT_INTEGRATION_POINTS || Ue, Et = q.HTML_INTEGRATION_POINTS || Et, de = q.CUSTOM_ELEMENT_HANDLING || {}, q.CUSTOM_ELEMENT_HANDLING && Rt(q.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (de.tagNameCheck = q.CUSTOM_ELEMENT_HANDLING.tagNameCheck), q.CUSTOM_ELEMENT_HANDLING && Rt(q.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (de.attributeNameCheck = q.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), q.CUSTOM_ELEMENT_HANDLING && typeof q.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (de.allowCustomizedBuiltInElements = q.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), Ke && (Ye = !1), Ze && (Je = !0), ke && (oe = addToSet({}, text$2), Se = [], ke.html === !0 && (addToSet(oe, html$1), addToSet(Se, html)), ke.svg === !0 && (addToSet(oe, svg$1), addToSet(Se, svg), addToSet(Se, xml)), ke.svgFilters === !0 && (addToSet(oe, svgFilters), addToSet(Se, svg), addToSet(Se, xml)), ke.mathMl === !0 && (addToSet(oe, mathMl$1), addToSet(Se, mathMl), addToSet(Se, xml))), q.ADD_TAGS && (oe === we && (oe = clone(oe)), addToSet(oe, q.ADD_TAGS, Te)), q.ADD_ATTR && (Se === Me && (Se = clone(Se)), addToSet(Se, q.ADD_ATTR, Te)), q.ADD_URI_SAFE_ATTR && addToSet(vt, q.ADD_URI_SAFE_ATTR, Te), q.FORBID_CONTENTS && (st === yt && (st = clone(st)), addToSet(st, q.FORBID_CONTENTS, Te)), _e && (oe["#text"] = !0), Ce && addToSet(oe, ["html", "head", "body"]), oe.table && (addToSet(oe, ["tbody"]), delete Oe.tbody), q.TRUSTED_TYPES_POLICY) {
        if (typeof q.TRUSTED_TYPES_POLICY.createHTML != "function")
          throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
        if (typeof q.TRUSTED_TYPES_POLICY.createScriptURL != "function")
          throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
        C = q.TRUSTED_TYPES_POLICY, P = C.createHTML("");
      } else
        C === void 0 && (C = _createTrustedTypesPolicy(b, m)), C !== null && typeof P == "string" && (P = C.createHTML(""));
      freeze && freeze(q), kt = q;
    }
  }, Bt = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]), zt = addToSet({}, [...mathMl$1, ...mathMlDisallowed]), Gt = function(q) {
    let le = O(q);
    (!le || !le.tagName) && (le = {
      namespaceURI: wt,
      tagName: "template"
    });
    const fe = stringToLowerCase(q.tagName), xe = stringToLowerCase(le.tagName);
    return Lt[q.namespaceURI] ? q.namespaceURI === ft ? le.namespaceURI === Ee ? fe === "svg" : le.namespaceURI === it ? fe === "svg" && (xe === "annotation-xml" || Ue[xe]) : !!Bt[fe] : q.namespaceURI === it ? le.namespaceURI === Ee ? fe === "math" : le.namespaceURI === ft ? fe === "math" && Et[xe] : !!zt[fe] : q.namespaceURI === Ee ? le.namespaceURI === ft && !Et[xe] || le.namespaceURI === it && !Ue[xe] ? !1 : !zt[fe] && (qt[fe] || !Bt[fe]) : !!(St === "application/xhtml+xml" && Lt[q.namespaceURI]) : !1;
  }, bt = function(q) {
    arrayPush(e.removed, {
      element: q
    });
    try {
      O(q).removeChild(q);
    } catch {
      A(q);
    }
  }, At = function(q, le) {
    try {
      arrayPush(e.removed, {
        attribute: le.getAttributeNode(q),
        from: le
      });
    } catch {
      arrayPush(e.removed, {
        attribute: null,
        from: le
      });
    }
    if (le.removeAttribute(q), q === "is")
      if (Je || Ze)
        try {
          bt(le);
        } catch {
        }
      else
        try {
          le.setAttribute(q, "");
        } catch {
        }
  }, Vt = function(q) {
    let le = null, fe = null;
    if (ut)
      q = "<remove></remove>" + q;
    else {
      const ze = stringMatch(q, /^[\r\n\t ]+/);
      fe = ze && ze[0];
    }
    St === "application/xhtml+xml" && wt === Ee && (q = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + q + "</body></html>");
    const xe = C ? C.createHTML(q) : q;
    if (wt === Ee)
      try {
        le = new a().parseFromString(xe, St);
      } catch {
      }
    if (!le || !le.documentElement) {
      le = I.createDocument(wt, "template", null);
      try {
        le.documentElement.innerHTML = Nt ? P : xe;
      } catch {
      }
    }
    const Pe = le.body || le.documentElement;
    return q && fe && Pe.insertBefore(r.createTextNode(fe), Pe.childNodes[0] || null), wt === Ee ? F.call(le, Ce ? "html" : "body")[0] : Ce ? le.documentElement : Pe;
  }, jt = function(q) {
    return N.call(
      q.ownerDocument || q,
      q,
      // eslint-disable-next-line no-bitwise
      x.SHOW_ELEMENT | x.SHOW_COMMENT | x.SHOW_TEXT | x.SHOW_PROCESSING_INSTRUCTION | x.SHOW_CDATA_SECTION,
      null
    );
  }, Ft = function(q) {
    return q instanceof h && (typeof q.nodeName != "string" || typeof q.textContent != "string" || typeof q.removeChild != "function" || !(q.attributes instanceof v) || typeof q.removeAttribute != "function" || typeof q.setAttribute != "function" || typeof q.namespaceURI != "string" || typeof q.insertBefore != "function" || typeof q.hasChildNodes != "function");
  }, Ut = function(q) {
    return typeof y == "function" && q instanceof y;
  };
  function xt(re, q, le) {
    arrayForEach(re, (fe) => {
      fe.call(e, q, le, kt);
    });
  }
  const V = function(q) {
    let le = null;
    if (xt(G.beforeSanitizeElements, q, null), Ft(q))
      return bt(q), !0;
    const fe = Te(q.nodeName);
    if (xt(G.uponSanitizeElement, q, {
      tagName: fe,
      allowedTags: oe
    }), Ne && q.hasChildNodes() && !Ut(q.firstElementChild) && regExpTest(/<[/\w!]/g, q.innerHTML) && regExpTest(/<[/\w!]/g, q.textContent) || q.nodeType === NODE_TYPE.progressingInstruction || Ne && q.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, q.data))
      return bt(q), !0;
    if (!oe[fe] || Oe[fe]) {
      if (!Oe[fe] && ne(fe) && (de.tagNameCheck instanceof RegExp && regExpTest(de.tagNameCheck, fe) || de.tagNameCheck instanceof Function && de.tagNameCheck(fe)))
        return !1;
      if (_e && !st[fe]) {
        const xe = O(q) || q.parentNode, Pe = $(q) || q.childNodes;
        if (Pe && xe) {
          const ze = Pe.length;
          for (let Xe = ze - 1; Xe >= 0; --Xe) {
            const ue = k(Pe[Xe], !0);
            ue.__removalCount = (q.__removalCount || 0) + 1, xe.insertBefore(ue, M(q));
          }
        }
      }
      return bt(q), !0;
    }
    return q instanceof E && !Gt(q) || (fe === "noscript" || fe === "noembed" || fe === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, q.innerHTML) ? (bt(q), !0) : (Ke && q.nodeType === NODE_TYPE.text && (le = q.textContent, arrayForEach([Q, ee, Y], (xe) => {
      le = stringReplace(le, xe, " ");
    }), q.textContent !== le && (arrayPush(e.removed, {
      element: q.cloneNode()
    }), q.textContent = le)), xt(G.afterSanitizeElements, q, null), !1);
  }, K = function(q, le, fe) {
    if (mt && (le === "id" || le === "name") && (fe in r || fe in Ct))
      return !1;
    if (!(Ye && !$e[le] && regExpTest(W, le))) {
      if (!(ge && regExpTest(j, le))) {
        if (!Se[le] || $e[le]) {
          if (
            // First condition does a very basic check if a) it's basically a valid custom element tagname AND
            // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
            // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
            !(ne(q) && (de.tagNameCheck instanceof RegExp && regExpTest(de.tagNameCheck, q) || de.tagNameCheck instanceof Function && de.tagNameCheck(q)) && (de.attributeNameCheck instanceof RegExp && regExpTest(de.attributeNameCheck, le) || de.attributeNameCheck instanceof Function && de.attributeNameCheck(le)) || // Alternative, second condition checks if it's an `is`-attribute, AND
            // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
            le === "is" && de.allowCustomizedBuiltInElements && (de.tagNameCheck instanceof RegExp && regExpTest(de.tagNameCheck, fe) || de.tagNameCheck instanceof Function && de.tagNameCheck(fe)))
          ) return !1;
        } else if (!vt[le]) {
          if (!regExpTest(ye, stringReplace(fe, me, ""))) {
            if (!((le === "src" || le === "xlink:href" || le === "href") && q !== "script" && stringIndexOf(fe, "data:") === 0 && gt[q])) {
              if (!(Ie && !regExpTest(J, stringReplace(fe, me, "")))) {
                if (fe)
                  return !1;
              }
            }
          }
        }
      }
    }
    return !0;
  }, ne = function(q) {
    return q !== "annotation-xml" && stringMatch(q, pe);
  }, ie = function(q) {
    xt(G.beforeSanitizeAttributes, q, null);
    const {
      attributes: le
    } = q;
    if (!le || Ft(q))
      return;
    const fe = {
      attrName: "",
      attrValue: "",
      keepAttr: !0,
      allowedAttributes: Se,
      forceKeepAttr: void 0
    };
    let xe = le.length;
    for (; xe--; ) {
      const Pe = le[xe], {
        name: ze,
        namespaceURI: Xe,
        value: ue
      } = Pe, Le = Te(ze), Qe = ue;
      let nt = ze === "value" ? Qe : stringTrim(Qe);
      if (fe.attrName = Le, fe.attrValue = nt, fe.keepAttr = !0, fe.forceKeepAttr = void 0, xt(G.uponSanitizeAttribute, q, fe), nt = fe.attrValue, pt && (Le === "id" || Le === "name") && (At(ze, q), nt = tt + nt), Ne && regExpTest(/((--!?|])>)|<\/(style|title)/i, nt)) {
        At(ze, q);
        continue;
      }
      if (fe.forceKeepAttr)
        continue;
      if (!fe.keepAttr) {
        At(ze, q);
        continue;
      }
      if (!Ge && regExpTest(/\/>/i, nt)) {
        At(ze, q);
        continue;
      }
      Ke && arrayForEach([Q, ee, Y], (Yt) => {
        nt = stringReplace(nt, Yt, " ");
      });
      const Mt = Te(q.nodeName);
      if (!K(Mt, Le, nt)) {
        At(ze, q);
        continue;
      }
      if (C && typeof b == "object" && typeof b.getAttributeType == "function" && !Xe)
        switch (b.getAttributeType(Mt, Le)) {
          case "TrustedHTML": {
            nt = C.createHTML(nt);
            break;
          }
          case "TrustedScriptURL": {
            nt = C.createScriptURL(nt);
            break;
          }
        }
      if (nt !== Qe)
        try {
          Xe ? q.setAttributeNS(Xe, ze, nt) : q.setAttribute(ze, nt), Ft(q) ? bt(q) : arrayPop(e.removed);
        } catch {
          At(ze, q);
        }
    }
    xt(G.afterSanitizeAttributes, q, null);
  }, se = function re(q) {
    let le = null;
    const fe = jt(q);
    for (xt(G.beforeSanitizeShadowDOM, q, null); le = fe.nextNode(); )
      xt(G.uponSanitizeShadowNode, le, null), V(le), ie(le), le.content instanceof _ && re(le.content);
    xt(G.afterSanitizeShadowDOM, q, null);
  };
  return e.sanitize = function(re) {
    let q = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, le = null, fe = null, xe = null, Pe = null;
    if (Nt = !re, Nt && (re = "<!-->"), typeof re != "string" && !Ut(re))
      if (typeof re.toString == "function") {
        if (re = re.toString(), typeof re != "string")
          throw typeErrorCreate("dirty is not a string, aborting");
      } else
        throw typeErrorCreate("toString is not a function");
    if (!e.isSupported)
      return re;
    if (lt || Pt(q), e.removed = [], typeof re == "string" && (He = !1), He) {
      if (re.nodeName) {
        const ue = Te(re.nodeName);
        if (!oe[ue] || Oe[ue])
          throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
      }
    } else if (re instanceof y)
      le = Vt("<!---->"), fe = le.ownerDocument.importNode(re, !0), fe.nodeType === NODE_TYPE.element && fe.nodeName === "BODY" || fe.nodeName === "HTML" ? le = fe : le.appendChild(fe);
    else {
      if (!Je && !Ke && !Ce && // eslint-disable-next-line unicorn/prefer-includes
      re.indexOf("<") === -1)
        return C && at ? C.createHTML(re) : re;
      if (le = Vt(re), !le)
        return Je ? null : at ? P : "";
    }
    le && ut && bt(le.firstChild);
    const ze = jt(He ? re : le);
    for (; xe = ze.nextNode(); )
      V(xe), ie(xe), xe.content instanceof _ && se(xe.content);
    if (He)
      return re;
    if (Je) {
      if (Ze)
        for (Pe = R.call(le.ownerDocument); le.firstChild; )
          Pe.appendChild(le.firstChild);
      else
        Pe = le;
      return (Se.shadowroot || Se.shadowrootmode) && (Pe = B.call(o, Pe, !0)), Pe;
    }
    let Xe = Ce ? le.outerHTML : le.innerHTML;
    return Ce && oe["!doctype"] && le.ownerDocument && le.ownerDocument.doctype && le.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, le.ownerDocument.doctype.name) && (Xe = "<!DOCTYPE " + le.ownerDocument.doctype.name + `>
` + Xe), Ke && arrayForEach([Q, ee, Y], (ue) => {
      Xe = stringReplace(Xe, ue, " ");
    }), C && at ? C.createHTML(Xe) : Xe;
  }, e.setConfig = function() {
    let re = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    Pt(re), lt = !0;
  }, e.clearConfig = function() {
    kt = null, lt = !1;
  }, e.isValidAttribute = function(re, q, le) {
    kt || Pt({});
    const fe = Te(re), xe = Te(q);
    return K(fe, xe, le);
  }, e.addHook = function(re, q) {
    typeof q == "function" && arrayPush(G[re], q);
  }, e.removeHook = function(re, q) {
    if (q !== void 0) {
      const le = arrayLastIndexOf(G[re], q);
      return le === -1 ? void 0 : arraySplice(G[re], le, 1)[0];
    }
    return arrayPop(G[re]);
  }, e.removeHooks = function(re) {
    G[re] = [];
  }, e.removeAllHooks = function() {
    G = _createHooksMap();
  }, e;
}
var purify = createDOMPurify();
const {
  HtmlTagHydration,
  SvelteComponent: SvelteComponent$3,
  add_render_callback,
  append_hydration: append_hydration$2,
  attr: attr$3,
  bubble: bubble$1,
  check_outros: check_outros$2,
  children: children$3,
  claim_component: claim_component$2,
  claim_element: claim_element$3,
  claim_html_tag,
  claim_space: claim_space$2,
  claim_text: claim_text$1,
  create_component: create_component$2,
  create_in_transition,
  create_out_transition,
  destroy_component: destroy_component$2,
  detach: detach$3,
  element: element$3,
  get_svelte_dataset,
  group_outros: group_outros$2,
  init: init$3,
  insert_hydration: insert_hydration$3,
  listen: listen$1,
  mount_component: mount_component$2,
  run_all,
  safe_not_equal: safe_not_equal$3,
  set_data: set_data$1,
  space: space$2,
  stop_propagation,
  text: text$1,
  toggle_class,
  transition_in: transition_in$2,
  transition_out: transition_out$2
} = window.__gradio__svelte__internal, { createEventDispatcher, onMount: onMount$1 } = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$2,
  append_hydration: append_hydration$1,
  attr: attr$2,
  bubble,
  check_outros: check_outros$1,
  children: children$2,
  claim_component: claim_component$1,
  claim_element: claim_element$2,
  claim_space: claim_space$1,
  create_animation,
  create_component: create_component$1,
  destroy_component: destroy_component$1,
  detach: detach$2,
  element: element$2,
  ensure_array_like: ensure_array_like$1,
  fix_and_outro_and_destroy_block,
  fix_position,
  group_outros: group_outros$1,
  init: init$2,
  insert_hydration: insert_hydration$2,
  mount_component: mount_component$1,
  noop: noop$1,
  safe_not_equal: safe_not_equal$2,
  set_style: set_style$2,
  space: space$1,
  transition_in: transition_in$1,
  transition_out: transition_out$1,
  update_keyed_each
} = window.__gradio__svelte__internal, {
  SvelteComponent: SvelteComponent$1,
  attr: attr$1,
  children: children$1,
  claim_element: claim_element$1,
  detach: detach$1,
  element: element$1,
  empty: empty$1,
  init: init$1,
  insert_hydration: insert_hydration$1,
  noop,
  safe_not_equal: safe_not_equal$1,
  set_style: set_style$1
} = window.__gradio__svelte__internal;
function dispatchCallback(s, e) {
  s && s(e);
}
function reverseDictionary(s) {
  return Object.fromEntries(Object.entries(s).map(([e, r]) => [r, e]));
}
function escapeRegExp(s) {
  return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
const Callable = (
  /** @type {any} */
  class {
    /**
    * Creates a new instance of the Callable class.
    */
    constructor() {
      let s = function(...e) {
        return s._call(...e);
      };
      return Object.setPrototypeOf(s, new.target.prototype);
    }
    /**
     * This method should be implemented in subclasses to provide the
     * functionality of the callable object.
     *
     * @param {any[]} args
     * @throws {Error} If the subclass does not implement the `_call` method.
     */
    _call(...s) {
      throw Error("Must implement _call method in subclass");
    }
  }
);
function isTypedArray(s) {
  var e, r, o;
  return ((o = (r = (e = s == null ? void 0 : s.prototype) == null ? void 0 : e.__proto__) == null ? void 0 : r.constructor) == null ? void 0 : o.name) === "TypedArray";
}
function isIntegralNumber(s) {
  return Number.isInteger(s) || typeof s == "bigint";
}
function exists(s) {
  return s != null;
}
function mergeArrays(...s) {
  return Array.prototype.concat.apply([], s);
}
const sharp = {}, ONNX_NODE = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: sharp
}, Symbol.toStringTag, { value: "Module" }));
var ortWeb_min$1 = { exports: {} };
const backends = {}, backendsSortedByPriority = [], registerBackend = (s, e, r) => {
  if (e && typeof e.init == "function" && typeof e.createSessionHandler == "function") {
    const o = backends[s];
    if (o === void 0)
      backends[s] = { backend: e, priority: r };
    else {
      if (o.priority > r)
        return;
      if (o.priority === r && o.backend !== e)
        throw new Error(`cannot register backend "${s}" using priority ${r}`);
    }
    if (r >= 0) {
      const m = backendsSortedByPriority.indexOf(s);
      m !== -1 && backendsSortedByPriority.splice(m, 1);
      for (let _ = 0; _ < backendsSortedByPriority.length; _++)
        if (backends[backendsSortedByPriority[_]].priority <= r) {
          backendsSortedByPriority.splice(_, 0, s);
          return;
        }
      backendsSortedByPriority.push(s);
    }
    return;
  }
  throw new TypeError("not a valid backend");
}, resolveBackend = async (s) => {
  const e = s.length === 0 ? backendsSortedByPriority : s, r = [];
  for (const o of e) {
    const m = backends[o];
    if (m) {
      if (m.initialized)
        return m.backend;
      if (m.aborted)
        continue;
      const _ = !!m.initPromise;
      try {
        return _ || (m.initPromise = m.backend.init()), await m.initPromise, m.initialized = !0, m.backend;
      } catch (g) {
        _ || r.push({ name: o, err: g }), m.aborted = !0;
      } finally {
        delete m.initPromise;
      }
    }
  }
  throw new Error(`no available backend found. ERR: ${r.map((o) => `[${o.name}] ${o.err}`).join(", ")}`);
};
class EnvImpl {
  constructor() {
    this.wasm = {}, this.webgl = {}, this.logLevelInternal = "warning";
  }
  // TODO standadize the getter and setter convention in env for other fields.
  set logLevel(e) {
    if (e !== void 0) {
      if (typeof e != "string" || ["verbose", "info", "warning", "error", "fatal"].indexOf(e) === -1)
        throw new Error(`Unsupported logging level: ${e}`);
      this.logLevelInternal = e;
    }
  }
  get logLevel() {
    return this.logLevelInternal;
  }
}
const env$2 = new EnvImpl(), isBigInt64ArrayAvailable = typeof BigInt64Array < "u" && typeof BigInt64Array.from == "function", isBigUint64ArrayAvailable = typeof BigUint64Array < "u" && typeof BigUint64Array.from == "function", NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP = /* @__PURE__ */ new Map([
  ["float32", Float32Array],
  ["uint8", Uint8Array],
  ["int8", Int8Array],
  ["uint16", Uint16Array],
  ["int16", Int16Array],
  ["int32", Int32Array],
  ["bool", Uint8Array],
  ["float64", Float64Array],
  ["uint32", Uint32Array]
]), NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP = /* @__PURE__ */ new Map([
  [Float32Array, "float32"],
  [Uint8Array, "uint8"],
  [Int8Array, "int8"],
  [Uint16Array, "uint16"],
  [Int16Array, "int16"],
  [Int32Array, "int32"],
  [Float64Array, "float64"],
  [Uint32Array, "uint32"]
]);
isBigInt64ArrayAvailable && (NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set("int64", BigInt64Array), NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(BigInt64Array, "int64"));
isBigUint64ArrayAvailable && (NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set("uint64", BigUint64Array), NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(BigUint64Array, "uint64"));
const calculateSize = (s) => {
  let e = 1;
  for (let r = 0; r < s.length; r++) {
    const o = s[r];
    if (typeof o != "number" || !Number.isSafeInteger(o))
      throw new TypeError(`dims[${r}] must be an integer, got: ${o}`);
    if (o < 0)
      throw new RangeError(`dims[${r}] must be a non-negative integer, got: ${o}`);
    e *= o;
  }
  return e;
};
let Tensor$2 = class Ht {
  constructor(e, r, o) {
    let m, _, g;
    if (typeof e == "string")
      if (m = e, g = o, e === "string") {
        if (!Array.isArray(r))
          throw new TypeError("A string tensor's data must be a string array.");
        _ = r;
      } else {
        const E = NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.get(e);
        if (E === void 0)
          throw new TypeError(`Unsupported tensor type: ${e}.`);
        if (Array.isArray(r))
          _ = E.from(r);
        else if (r instanceof E)
          _ = r;
        else
          throw new TypeError(`A ${m} tensor's data must be type of ${E}`);
      }
    else if (g = r, Array.isArray(e)) {
      if (e.length === 0)
        throw new TypeError("Tensor type cannot be inferred from an empty array.");
      const E = typeof e[0];
      if (E === "string")
        m = "string", _ = e;
      else if (E === "boolean")
        m = "bool", _ = Uint8Array.from(e);
      else
        throw new TypeError(`Invalid element type of data array: ${E}.`);
    } else {
      const E = NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.get(e.constructor);
      if (E === void 0)
        throw new TypeError(`Unsupported type for tensor data: ${e.constructor}.`);
      m = E, _ = e;
    }
    if (g === void 0)
      g = [_.length];
    else if (!Array.isArray(g))
      throw new TypeError("A tensor's dims must be a number array");
    const y = calculateSize(g);
    if (y !== _.length)
      throw new Error(`Tensor's size(${y}) does not match data length(${_.length}).`);
    this.dims = g, this.type = m, this.data = _, this.size = y;
  }
  // #endregion
  /**
   * Create a new tensor object from image object
   *
   * @param buffer - Extracted image buffer data - assuming RGBA format
   * @param imageFormat - input image configuration - required configurations height, width, format
   * @param tensorFormat - output tensor configuration - Default is RGB format
   */
  static bufferToTensor(e, r) {
    if (e === void 0)
      throw new Error("Image buffer must be defined");
    if (r.height === void 0 || r.width === void 0)
      throw new Error("Image height and width must be defined");
    const { height: o, width: m } = r, _ = r.norm;
    let g, y;
    _ === void 0 || _.mean === void 0 ? g = 255 : g = _.mean, _ === void 0 || _.bias === void 0 ? y = 0 : y = _.bias;
    const E = r.bitmapFormat !== void 0 ? r.bitmapFormat : "RGBA", x = r.tensorFormat !== void 0 && r.tensorFormat !== void 0 ? r.tensorFormat : "RGB", v = o * m, h = x === "RGBA" ? new Float32Array(v * 4) : new Float32Array(v * 3);
    let a = 4, b = 0, w = 1, k = 2, A = 3, M = 0, $ = v, O = v * 2, C = -1;
    E === "RGB" && (a = 3, b = 0, w = 1, k = 2, A = -1), x === "RGBA" ? C = v * 3 : x === "RBG" ? (M = 0, O = v, $ = v * 2) : x === "BGR" && (O = 0, $ = v, M = v * 2);
    for (let I = 0; I < v; I++, b += a, k += a, w += a, A += a)
      h[M++] = (e[b] + y) / g, h[$++] = (e[w] + y) / g, h[O++] = (e[k] + y) / g, C !== -1 && A !== -1 && (h[C++] = (e[A] + y) / g);
    return x === "RGBA" ? new Ht("float32", h, [1, 4, o, m]) : new Ht("float32", h, [1, 3, o, m]);
  }
  static async fromImage(e, r) {
    const o = typeof HTMLImageElement < "u" && e instanceof HTMLImageElement, m = typeof ImageData < "u" && e instanceof ImageData, _ = typeof ImageBitmap < "u" && e instanceof ImageBitmap, g = typeof String < "u" && (e instanceof String || typeof e == "string");
    let y, E = {};
    if (o) {
      const x = document.createElement("canvas"), v = x.getContext("2d");
      if (v != null) {
        let h = e.naturalHeight, a = e.naturalWidth;
        if (r !== void 0 && r.resizedHeight !== void 0 && r.resizedWidth !== void 0 && (h = r.resizedHeight, a = r.resizedWidth), r !== void 0) {
          if (E = r, r.tensorFormat !== void 0)
            throw new Error("Image input config format must be RGBA for HTMLImageElement");
          if (E.tensorFormat = "RGBA", r.height !== void 0 && r.height !== h)
            throw new Error("Image input config height doesn't match HTMLImageElement height");
          if (E.height = h, r.width !== void 0 && r.width !== a)
            throw new Error("Image input config width doesn't match HTMLImageElement width");
          E.width = a;
        } else
          E.tensorFormat = "RGBA", E.height = h, E.width = a;
        x.width = a, x.height = h, v.drawImage(e, 0, 0, a, h), y = v.getImageData(0, 0, a, h).data;
      } else
        throw new Error("Can not access image data");
    } else if (m) {
      const x = "RGBA";
      let v, h;
      if (r !== void 0 && r.resizedWidth !== void 0 && r.resizedHeight !== void 0 ? (v = r.resizedHeight, h = r.resizedWidth) : (v = e.height, h = e.width), r !== void 0) {
        if (E = r, r.bitmapFormat !== void 0 && r.bitmapFormat !== x)
          throw new Error("Image input config format must be RGBA for ImageData");
        E.bitmapFormat = "RGBA";
      } else
        E.bitmapFormat = "RGBA";
      if (E.height = v, E.width = h, r !== void 0) {
        const a = document.createElement("canvas");
        a.width = h, a.height = v;
        const b = a.getContext("2d");
        if (b != null)
          b.putImageData(e, 0, 0), y = b.getImageData(0, 0, h, v).data;
        else
          throw new Error("Can not access image data");
      } else
        y = e.data;
    } else if (_) {
      if (r === void 0)
        throw new Error("Please provide image config with format for Imagebitmap");
      if (r.bitmapFormat !== void 0)
        throw new Error("Image input config format must be defined for ImageBitmap");
      const x = document.createElement("canvas").getContext("2d");
      if (x != null) {
        const v = e.height, h = e.width;
        if (x.drawImage(e, 0, 0, h, v), y = x.getImageData(0, 0, h, v).data, r !== void 0) {
          if (r.height !== void 0 && r.height !== v)
            throw new Error("Image input config height doesn't match ImageBitmap height");
          if (E.height = v, r.width !== void 0 && r.width !== h)
            throw new Error("Image input config width doesn't match ImageBitmap width");
          E.width = h;
        } else
          E.height = v, E.width = h;
        return Ht.bufferToTensor(y, E);
      } else
        throw new Error("Can not access image data");
    } else {
      if (g)
        return new Promise((x, v) => {
          const h = document.createElement("canvas"), a = h.getContext("2d");
          if (!e || !a)
            return v();
          const b = new Image();
          b.crossOrigin = "Anonymous", b.src = e, b.onload = () => {
            h.width = b.width, h.height = b.height, a.drawImage(b, 0, 0, h.width, h.height);
            const w = a.getImageData(0, 0, h.width, h.height);
            if (r !== void 0) {
              if (r.height !== void 0 && r.height !== h.height)
                throw new Error("Image input config height doesn't match ImageBitmap height");
              if (E.height = h.height, r.width !== void 0 && r.width !== h.width)
                throw new Error("Image input config width doesn't match ImageBitmap width");
              E.width = h.width;
            } else
              E.height = h.height, E.width = h.width;
            x(Ht.bufferToTensor(w.data, E));
          };
        });
      throw new Error("Input data provided is not supported - aborted tensor creation");
    }
    if (y !== void 0)
      return Ht.bufferToTensor(y, E);
    throw new Error("Input data provided is not supported - aborted tensor creation");
  }
  toImageData(e) {
    var r, o;
    const m = document.createElement("canvas").getContext("2d");
    let _;
    if (m != null) {
      const g = this.dims[3], y = this.dims[2], E = this.dims[1], x = e !== void 0 && e.format !== void 0 ? e.format : "RGB", v = e !== void 0 && ((r = e.norm) === null || r === void 0 ? void 0 : r.mean) !== void 0 ? e.norm.mean : 255, h = e !== void 0 && ((o = e.norm) === null || o === void 0 ? void 0 : o.bias) !== void 0 ? e.norm.bias : 0, a = y * g;
      if (e !== void 0) {
        if (e.height !== void 0 && e.height !== y)
          throw new Error("Image output config height doesn't match tensor height");
        if (e.width !== void 0 && e.width !== g)
          throw new Error("Image output config width doesn't match tensor width");
        if (e.format !== void 0 && E === 4 && e.format !== "RGBA" || E === 3 && e.format !== "RGB" && e.format !== "BGR")
          throw new Error("Tensor format doesn't match input tensor dims");
      }
      const b = 4;
      let w = 0, k = 1, A = 2, M = 3, $ = 0, O = a, C = a * 2, P = -1;
      x === "RGBA" ? ($ = 0, O = a, C = a * 2, P = a * 3) : x === "RGB" ? ($ = 0, O = a, C = a * 2) : x === "RBG" && ($ = 0, C = a, O = a * 2), _ = m.createImageData(g, y);
      for (let I = 0; I < y * g; w += b, k += b, A += b, M += b, I++)
        _.data[w] = (this.data[$++] - h) * v, _.data[k] = (this.data[O++] - h) * v, _.data[A] = (this.data[C++] - h) * v, _.data[M] = P === -1 ? 255 : (this.data[P++] - h) * v;
    } else
      throw new Error("Can not access image data");
    return _;
  }
  // #endregion
  // #region tensor utilities
  reshape(e) {
    return new Ht(this.type, this.data, e);
  }
};
const Tensor$1 = Tensor$2;
let InferenceSession$2 = class Nn {
  constructor(e) {
    this.handler = e;
  }
  async run(e, r, o) {
    const m = {};
    let _ = {};
    if (typeof e != "object" || e === null || e instanceof Tensor$1 || Array.isArray(e))
      throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");
    let g = !0;
    if (typeof r == "object") {
      if (r === null)
        throw new TypeError("Unexpected argument[1]: cannot be null.");
      if (r instanceof Tensor$1)
        throw new TypeError("'fetches' cannot be a Tensor");
      if (Array.isArray(r)) {
        if (r.length === 0)
          throw new TypeError("'fetches' cannot be an empty array.");
        g = !1;
        for (const x of r) {
          if (typeof x != "string")
            throw new TypeError("'fetches' must be a string array or an object.");
          if (this.outputNames.indexOf(x) === -1)
            throw new RangeError(`'fetches' contains invalid output name: ${x}.`);
          m[x] = null;
        }
        if (typeof o == "object" && o !== null)
          _ = o;
        else if (typeof o < "u")
          throw new TypeError("'options' must be an object.");
      } else {
        let x = !1;
        const v = Object.getOwnPropertyNames(r);
        for (const h of this.outputNames)
          if (v.indexOf(h) !== -1) {
            const a = r[h];
            (a === null || a instanceof Tensor$1) && (x = !0, g = !1, m[h] = a);
          }
        if (x) {
          if (typeof o == "object" && o !== null)
            _ = o;
          else if (typeof o < "u")
            throw new TypeError("'options' must be an object.");
        } else
          _ = r;
      }
    } else if (typeof r < "u")
      throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");
    for (const x of this.inputNames)
      if (typeof e[x] > "u")
        throw new Error(`input '${x}' is missing in 'feeds'.`);
    if (g)
      for (const x of this.outputNames)
        m[x] = null;
    const y = await this.handler.run(e, m, _), E = {};
    for (const x in y)
      Object.hasOwnProperty.call(y, x) && (E[x] = new Tensor$1(y[x].type, y[x].data, y[x].dims));
    return E;
  }
  static async create(e, r, o, m) {
    let _, g = {};
    if (typeof e == "string") {
      if (_ = e, typeof r == "object" && r !== null)
        g = r;
      else if (typeof r < "u")
        throw new TypeError("'options' must be an object.");
    } else if (e instanceof Uint8Array) {
      if (_ = e, typeof r == "object" && r !== null)
        g = r;
      else if (typeof r < "u")
        throw new TypeError("'options' must be an object.");
    } else if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) {
      const h = e;
      let a = 0, b = e.byteLength;
      if (typeof r == "object" && r !== null)
        g = r;
      else if (typeof r == "number") {
        if (a = r, !Number.isSafeInteger(a))
          throw new RangeError("'byteOffset' must be an integer.");
        if (a < 0 || a >= h.byteLength)
          throw new RangeError(`'byteOffset' is out of range [0, ${h.byteLength}).`);
        if (b = e.byteLength - a, typeof o == "number") {
          if (b = o, !Number.isSafeInteger(b))
            throw new RangeError("'byteLength' must be an integer.");
          if (b <= 0 || a + b > h.byteLength)
            throw new RangeError(`'byteLength' is out of range (0, ${h.byteLength - a}].`);
          if (typeof m == "object" && m !== null)
            g = m;
          else if (typeof m < "u")
            throw new TypeError("'options' must be an object.");
        } else if (typeof o < "u")
          throw new TypeError("'byteLength' must be a number.");
      } else if (typeof r < "u")
        throw new TypeError("'options' must be an object.");
      _ = new Uint8Array(h, a, b);
    } else
      throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");
    const E = (g.executionProviders || []).map((h) => typeof h == "string" ? h : h.name), v = await (await resolveBackend(E)).createSessionHandler(_, g);
    return new Nn(v);
  }
  startProfiling() {
    this.handler.startProfiling();
  }
  endProfiling() {
    this.handler.endProfiling();
  }
  get inputNames() {
    return this.handler.inputNames;
  }
  get outputNames() {
    return this.handler.outputNames;
  }
};
const InferenceSession$1 = InferenceSession$2, lib = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  InferenceSession: InferenceSession$1,
  Tensor: Tensor$1,
  env: env$2,
  registerBackend
}, Symbol.toStringTag, { value: "Module" })), require$$0 = /* @__PURE__ */ getAugmentedNamespace(lib);
/*!
* ONNX Runtime Web v1.14.0
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
(function(module, exports) {
  (function(s, e) {
    module.exports = e(require$$0);
  })(self, (__WEBPACK_EXTERNAL_MODULE__1670__) => (() => {
    var __webpack_modules__ = { 3474: (s, e, r) => {
      var o, m = (o = (o = typeof document < "u" && document.currentScript ? document.currentScript.src : void 0) || "/index.js", function(_) {
        function g() {
          return pe.buffer != oe && Ne(pe.buffer), we;
        }
        function y() {
          return pe.buffer != oe && Ne(pe.buffer), Se;
        }
        function E() {
          return pe.buffer != oe && Ne(pe.buffer), Me;
        }
        function x() {
          return pe.buffer != oe && Ne(pe.buffer), de;
        }
        function v() {
          return pe.buffer != oe && Ne(pe.buffer), Oe;
        }
        var h, a, b;
        _ = _ || {}, h || (h = _ !== void 0 ? _ : {}), h.ready = new Promise(function(L, z) {
          a = L, b = z;
        });
        var w, k, A, M, $, O, C = Object.assign({}, h), P = "./this.program", I = (L, z) => {
          throw z;
        }, N = typeof window == "object", R = typeof importScripts == "function", F = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string", B = h.ENVIRONMENT_IS_PTHREAD || !1, G = "";
        function Q(L) {
          return h.locateFile ? h.locateFile(L, G) : G + L;
        }
        if (F) {
          let L;
          G = R ? r(908).dirname(G) + "/" : "//", O = () => {
            $ || (M = r(1384), $ = r(908));
          }, w = function(z, U) {
            return O(), z = $.normalize(z), M.readFileSync(z, U ? void 0 : "utf8");
          }, A = (z) => ((z = w(z, !0)).buffer || (z = new Uint8Array(z)), z), k = (z, U, te) => {
            O(), z = $.normalize(z), M.readFile(z, function(ae, ce) {
              ae ? te(ae) : U(ce.buffer);
            });
          }, 1 < process.argv.length && (P = process.argv[1].replace(/\\/g, "/")), process.argv.slice(2), process.on("uncaughtException", function(z) {
            if (!(z instanceof ht)) throw z;
          }), process.on("unhandledRejection", function(z) {
            throw z;
          }), I = (z, U) => {
            if (mt()) throw process.exitCode = z, U;
            U instanceof ht || J("exiting due to exception: " + U), process.exit(z);
          }, h.inspect = function() {
            return "[Emscripten Module object]";
          };
          try {
            L = r(9925);
          } catch (z) {
            throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'), z;
          }
          r.g.Worker = L.Worker;
        } else (N || R) && (R ? G = self.location.href : typeof document < "u" && document.currentScript && (G = document.currentScript.src), o && (G = o), G = G.indexOf("blob:") !== 0 ? G.substr(0, G.replace(/[?#].*/, "").lastIndexOf("/") + 1) : "", F || (w = (L) => {
          var z = new XMLHttpRequest();
          return z.open("GET", L, !1), z.send(null), z.responseText;
        }, R && (A = (L) => {
          var z = new XMLHttpRequest();
          return z.open("GET", L, !1), z.responseType = "arraybuffer", z.send(null), new Uint8Array(z.response);
        }), k = (L, z, U) => {
          var te = new XMLHttpRequest();
          te.open("GET", L, !0), te.responseType = "arraybuffer", te.onload = () => {
            te.status == 200 || te.status == 0 && te.response ? z(te.response) : U();
          }, te.onerror = U, te.send(null);
        }));
        F && typeof performance > "u" && (r.g.performance = r(6953).performance);
        var ee = console.log.bind(console), Y = console.warn.bind(console);
        F && (O(), ee = (L) => M.writeSync(1, L + `
`), Y = (L) => M.writeSync(2, L + `
`));
        var W, j = h.print || ee, J = h.printErr || Y;
        Object.assign(h, C), C = null, h.thisProgram && (P = h.thisProgram), h.quit && (I = h.quit), h.wasmBinary && (W = h.wasmBinary);
        var me = h.noExitRuntime || !1;
        typeof WebAssembly != "object" && ke("no native wasm support detected");
        var pe, ye, oe, we, Se, Me, de, Oe, $e = !1, ge = typeof TextDecoder < "u" ? new TextDecoder("utf8") : void 0;
        function Ye(L, z, U) {
          var te = (z >>>= 0) + U;
          for (U = z; L[U] && !(U >= te); ) ++U;
          if (16 < U - z && L.buffer && ge) return ge.decode(L.buffer instanceof SharedArrayBuffer ? L.slice(z, U) : L.subarray(z, U));
          for (te = ""; z < U; ) {
            var ae = L[z++];
            if (128 & ae) {
              var ce = 63 & L[z++];
              if ((224 & ae) == 192) te += String.fromCharCode((31 & ae) << 6 | ce);
              else {
                var ve = 63 & L[z++];
                65536 > (ae = (240 & ae) == 224 ? (15 & ae) << 12 | ce << 6 | ve : (7 & ae) << 18 | ce << 12 | ve << 6 | 63 & L[z++]) ? te += String.fromCharCode(ae) : (ae -= 65536, te += String.fromCharCode(55296 | ae >> 10, 56320 | 1023 & ae));
              }
            } else te += String.fromCharCode(ae);
          }
          return te;
        }
        function Ie(L, z) {
          return (L >>>= 0) ? Ye(y(), L, z) : "";
        }
        function Ge(L, z, U, te) {
          if (!(0 < te)) return 0;
          var ae = U >>>= 0;
          te = U + te - 1;
          for (var ce = 0; ce < L.length; ++ce) {
            var ve = L.charCodeAt(ce);
            if (55296 <= ve && 57343 >= ve && (ve = 65536 + ((1023 & ve) << 10) | 1023 & L.charCodeAt(++ce)), 127 >= ve) {
              if (U >= te) break;
              z[U++ >>> 0] = ve;
            } else {
              if (2047 >= ve) {
                if (U + 1 >= te) break;
                z[U++ >>> 0] = 192 | ve >> 6;
              } else {
                if (65535 >= ve) {
                  if (U + 2 >= te) break;
                  z[U++ >>> 0] = 224 | ve >> 12;
                } else {
                  if (U + 3 >= te) break;
                  z[U++ >>> 0] = 240 | ve >> 18, z[U++ >>> 0] = 128 | ve >> 12 & 63;
                }
                z[U++ >>> 0] = 128 | ve >> 6 & 63;
              }
              z[U++ >>> 0] = 128 | 63 & ve;
            }
          }
          return z[U >>> 0] = 0, U - ae;
        }
        function Ke(L) {
          for (var z = 0, U = 0; U < L.length; ++U) {
            var te = L.charCodeAt(U);
            127 >= te ? z++ : 2047 >= te ? z += 2 : 55296 <= te && 57343 >= te ? (z += 4, ++U) : z += 3;
          }
          return z;
        }
        function Ne(L) {
          oe = L, h.HEAP8 = we = new Int8Array(L), h.HEAP16 = new Int16Array(L), h.HEAP32 = Me = new Int32Array(L), h.HEAPU8 = Se = new Uint8Array(L), h.HEAPU16 = new Uint16Array(L), h.HEAPU32 = de = new Uint32Array(L), h.HEAPF32 = new Float32Array(L), h.HEAPF64 = Oe = new Float64Array(L);
        }
        B && (oe = h.buffer);
        var Ce = h.INITIAL_MEMORY || 16777216;
        if (B) pe = h.wasmMemory, oe = h.buffer;
        else if (h.wasmMemory) pe = h.wasmMemory;
        else if (!((pe = new WebAssembly.Memory({ initial: Ce / 65536, maximum: 65536, shared: !0 })).buffer instanceof SharedArrayBuffer)) throw J("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"), F && console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"), Error("bad memory");
        pe && (oe = pe.buffer), Ce = oe.byteLength, Ne(oe);
        var lt, ut = [], Je = [], Ze = [], at = [];
        function mt() {
          return me || !1;
        }
        function pt() {
          var L = h.preRun.shift();
          ut.unshift(L);
        }
        var tt, _e = 0, He = null;
        function ke(L) {
          throw B ? postMessage({ cmd: "onAbort", arg: L }) : h.onAbort && h.onAbort(L), J(L = "Aborted(" + L + ")"), $e = !0, L = new WebAssembly.RuntimeError(L + ". Build with -sASSERTIONS for more info."), b(L), L;
        }
        function st() {
          return tt.startsWith("data:application/octet-stream;base64,");
        }
        function yt() {
          var L = tt;
          try {
            if (L == tt && W) return new Uint8Array(W);
            if (A) return A(L);
            throw "both async and sync fetching of the wasm failed";
          } catch (z) {
            ke(z);
          }
        }
        tt = "ort-wasm-threaded.wasm", st() || (tt = Q(tt));
        var gt = {};
        function ht(L) {
          this.name = "ExitStatus", this.message = "Program terminated with exit(" + L + ")", this.status = L;
        }
        function vt(L) {
          (L = Ee.Vb[L]) || ke(), Ee.mc(L);
        }
        function _t(L) {
          var z = Ee.Cc();
          if (!z) return 6;
          Ee.ac.push(z), Ee.Vb[L.Ub] = z, z.Ub = L.Ub;
          var U = { cmd: "run", start_routine: L.Ic, arg: L.zc, pthread_ptr: L.Ub };
          return z.$b = () => {
            U.time = performance.now(), z.postMessage(U, L.Nc);
          }, z.loaded && (z.$b(), delete z.$b), 0;
        }
        function it(L) {
          if (B) return fe(1, 1, L);
          mt() || (Ee.oc(), h.onExit && h.onExit(L), $e = !0), I(L, new ht(L));
        }
        function ft(L, z) {
          if (!z && B) throw Lt(L), "unwind";
          mt() || B || (fn(), wt(Ze), hn(0), Yt[1].length && tn(1, 10), Yt[2].length && tn(2, 10), Ee.oc()), it(L);
        }
        var Ee = { Yb: [], ac: [], qc: [], Vb: {}, fc: function() {
          B && Ee.Ec();
        }, Pc: function() {
        }, Ec: function() {
          Ee.receiveObjectTransfer = Ee.Gc, Ee.threadInitTLS = Ee.pc, Ee.setExitStatus = Ee.nc, me = !1;
        }, nc: function() {
        }, oc: function() {
          for (var L of Object.values(Ee.Vb)) Ee.mc(L);
          for (L of Ee.Yb) L.terminate();
          Ee.Yb = [];
        }, mc: function(L) {
          var z = L.Ub;
          delete Ee.Vb[z], Ee.Yb.push(L), Ee.ac.splice(Ee.ac.indexOf(L), 1), L.Ub = 0, rn(z);
        }, Gc: function() {
        }, pc: function() {
          Ee.qc.forEach((L) => L());
        }, Fc: function(L, z) {
          L.onmessage = (U) => {
            var te = (U = U.data).cmd;
            if (L.Ub && (Ee.Bc = L.Ub), U.targetThread && U.targetThread != Zt()) {
              var ae = Ee.Vb[U.Qc];
              ae ? ae.postMessage(U, U.transferList) : J('Internal error! Worker sent a message "' + te + '" to target pthread ' + U.targetThread + ", but that thread no longer exists!");
            } else te === "processProxyingQueue" ? ne(U.queue) : te === "spawnThread" ? _t(U) : te === "cleanupThread" ? vt(U.thread) : te === "killThread" ? (U = U.thread, te = Ee.Vb[U], delete Ee.Vb[U], te.terminate(), rn(U), Ee.ac.splice(Ee.ac.indexOf(te), 1), te.Ub = 0) : te === "cancelThread" ? Ee.Vb[U.thread].postMessage({ cmd: "cancel" }) : te === "loaded" ? (L.loaded = !0, z && z(L), L.$b && (L.$b(), delete L.$b)) : te === "print" ? j("Thread " + U.threadId + ": " + U.text) : te === "printErr" ? J("Thread " + U.threadId + ": " + U.text) : te === "alert" ? alert("Thread " + U.threadId + ": " + U.text) : U.target === "setimmediate" ? L.postMessage(U) : te === "onAbort" ? h.onAbort && h.onAbort(U.arg) : te && J("worker sent an unknown command " + te);
            Ee.Bc = void 0;
          }, L.onerror = (U) => {
            throw J("worker sent an error! " + U.filename + ":" + U.lineno + ": " + U.message), U;
          }, F && (L.on("message", function(U) {
            L.onmessage({ data: U });
          }), L.on("error", function(U) {
            L.onerror(U);
          }), L.on("detachedExit", function() {
          })), L.postMessage({ cmd: "load", urlOrBlob: h.mainScriptUrlOrBlob || o, wasmMemory: pe, wasmModule: ye });
        }, yc: function() {
          var L = Q("ort-wasm-threaded.worker.js");
          Ee.Yb.push(new Worker(L));
        }, Cc: function() {
          return Ee.Yb.length == 0 && (Ee.yc(), Ee.Fc(Ee.Yb[0])), Ee.Yb.pop();
        } };
        function wt(L) {
          for (; 0 < L.length; ) L.shift()(h);
        }
        function Nt(L) {
          var z = Be();
          return L = L(), Re(z), L;
        }
        function Lt(L) {
          if (B) return fe(2, 0, L);
          try {
            ft(L);
          } catch (z) {
            z instanceof ht || z == "unwind" || I(1, z);
          }
        }
        h.PThread = Ee, h.establishStackSpace = function() {
          var L = Zt(), z = E()[L + 44 >> 2 >>> 0];
          L = E()[L + 48 >> 2 >>> 0], bn(z, z - L), Re(z);
        };
        var Dt = [];
        function Ue(L) {
          var z = Dt[L];
          return z || (L >= Dt.length && (Dt.length = L + 1), Dt[L] = z = lt.get(L)), z;
        }
        h.invokeEntryPoint = function(L, z) {
          L = Ue(L)(z), mt() ? Ee.nc(L) : _n(L);
        };
        var Et, qt, St = [], Fe = 0, De = 0;
        function Te(L) {
          this.Zb = L, this.Sb = L - 24, this.xc = function(z) {
            x()[this.Sb + 4 >> 2 >>> 0] = z;
          }, this.bc = function() {
            return x()[this.Sb + 4 >> 2 >>> 0];
          }, this.wc = function(z) {
            x()[this.Sb + 8 >> 2 >>> 0] = z;
          }, this.Dc = function() {
            return x()[this.Sb + 8 >> 2 >>> 0];
          }, this.rc = function() {
            E()[this.Sb >> 2 >>> 0] = 0;
          }, this.hc = function(z) {
            z = z ? 1 : 0, g()[this.Sb + 12 >> 0 >>> 0] = z;
          }, this.uc = function() {
            return g()[this.Sb + 12 >> 0 >>> 0] != 0;
          }, this.ic = function(z) {
            z = z ? 1 : 0, g()[this.Sb + 13 >> 0 >>> 0] = z;
          }, this.kc = function() {
            return g()[this.Sb + 13 >> 0 >>> 0] != 0;
          }, this.fc = function(z, U) {
            this.cc(0), this.xc(z), this.wc(U), this.rc(), this.hc(!1), this.ic(!1);
          }, this.sc = function() {
            Atomics.add(E(), this.Sb >> 2, 1);
          }, this.Hc = function() {
            return Atomics.sub(E(), this.Sb >> 2, 1) === 1;
          }, this.cc = function(z) {
            x()[this.Sb + 16 >> 2 >>> 0] = z;
          }, this.tc = function() {
            return x()[this.Sb + 16 >> 2 >>> 0];
          }, this.vc = function() {
            if (yn(this.bc())) return x()[this.Zb >> 2 >>> 0];
            var z = this.tc();
            return z !== 0 ? z : this.Zb;
          };
        }
        function kt(L) {
          return dn(new Te(L).Sb);
        }
        function Ct(L, z, U, te) {
          return B ? fe(3, 1, L, z, U, te) : Rt(L, z, U, te);
        }
        function Rt(L, z, U, te) {
          if (typeof SharedArrayBuffer > "u") return J("Current environment does not support SharedArrayBuffer, pthreads are not available!"), 6;
          var ae = [];
          return B && ae.length === 0 ? Ct(L, z, U, te) : (L = { Ic: U, Ub: L, zc: te, Nc: ae }, B ? (L.Oc = "spawnThread", postMessage(L, ae), 0) : _t(L));
        }
        function Pt(L, z, U) {
          return B ? fe(4, 1, L, z, U) : 0;
        }
        function Bt(L, z) {
          if (B) return fe(5, 1, L, z);
        }
        function zt(L, z) {
          if (B) return fe(6, 1, L, z);
        }
        function Gt(L, z, U) {
          if (B) return fe(7, 1, L, z, U);
        }
        function bt(L, z, U) {
          return B ? fe(8, 1, L, z, U) : 0;
        }
        function At(L, z) {
          if (B) return fe(9, 1, L, z);
        }
        function Vt(L, z, U) {
          if (B) return fe(10, 1, L, z, U);
        }
        function jt(L, z, U, te) {
          if (B) return fe(11, 1, L, z, U, te);
        }
        function Ft(L, z, U, te) {
          if (B) return fe(12, 1, L, z, U, te);
        }
        function Ut(L, z, U, te) {
          if (B) return fe(13, 1, L, z, U, te);
        }
        function xt(L) {
          if (B) return fe(14, 1, L);
        }
        function V(L, z) {
          if (B) return fe(15, 1, L, z);
        }
        function K(L, z, U) {
          if (B) return fe(16, 1, L, z, U);
        }
        function ne(L) {
          Atomics.store(E(), L >> 2, 1), Zt() && gn(L), Atomics.compareExchange(E(), L >> 2, 1, 0);
        }
        function ie(L) {
          return x()[L >>> 2] + 4294967296 * E()[L + 4 >>> 2];
        }
        function se(L, z, U, te, ae, ce) {
          return B ? fe(17, 1, L, z, U, te, ae, ce) : -52;
        }
        function re(L, z, U, te, ae, ce) {
          if (B) return fe(18, 1, L, z, U, te, ae, ce);
        }
        function q(L) {
          var z = Ke(L) + 1, U = nn(z);
          return U && Ge(L, g(), U, z), U;
        }
        function le(L, z, U) {
          function te(qe) {
            return (qe = qe.toTimeString().match(/\(([A-Za-z ]+)\)$/)) ? qe[1] : "GMT";
          }
          if (B) return fe(19, 1, L, z, U);
          var ae = (/* @__PURE__ */ new Date()).getFullYear(), ce = new Date(ae, 0, 1), ve = new Date(ae, 6, 1);
          ae = ce.getTimezoneOffset();
          var Ae = ve.getTimezoneOffset(), je = Math.max(ae, Ae);
          E()[L >> 2 >>> 0] = 60 * je, E()[z >> 2 >>> 0] = +(ae != Ae), L = te(ce), z = te(ve), L = q(L), z = q(z), Ae < ae ? (x()[U >> 2 >>> 0] = L, x()[U + 4 >> 2 >>> 0] = z) : (x()[U >> 2 >>> 0] = z, x()[U + 4 >> 2 >>> 0] = L);
        }
        function fe(L, z) {
          var U = arguments.length - 2, te = arguments;
          return Nt(() => {
            for (var ae = an(8 * U), ce = ae >> 3, ve = 0; ve < U; ve++) {
              var Ae = te[2 + ve];
              v()[ce + ve >>> 0] = Ae;
            }
            return mn(L, U, ae, z);
          });
        }
        h.executeNotifiedProxyingQueue = ne, qt = F ? () => {
          var L = process.hrtime();
          return 1e3 * L[0] + L[1] / 1e6;
        } : B ? () => performance.now() - h.__performance_now_clock_drift : () => performance.now();
        var xe, Pe = [], ze = {};
        function Xe() {
          if (!xe) {
            var L, z = { USER: "web_user", LOGNAME: "web_user", PATH: "/", PWD: "/", HOME: "/home/web_user", LANG: (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8", _: P || "./this.program" };
            for (L in ze) ze[L] === void 0 ? delete z[L] : z[L] = ze[L];
            var U = [];
            for (L in z) U.push(L + "=" + z[L]);
            xe = U;
          }
          return xe;
        }
        function ue(L, z) {
          if (B) return fe(20, 1, L, z);
          var U = 0;
          return Xe().forEach(function(te, ae) {
            var ce = z + U;
            for (ae = x()[L + 4 * ae >> 2 >>> 0] = ce, ce = 0; ce < te.length; ++ce) g()[ae++ >> 0 >>> 0] = te.charCodeAt(ce);
            g()[ae >> 0 >>> 0] = 0, U += te.length + 1;
          }), 0;
        }
        function Le(L, z) {
          if (B) return fe(21, 1, L, z);
          var U = Xe();
          x()[L >> 2 >>> 0] = U.length;
          var te = 0;
          return U.forEach(function(ae) {
            te += ae.length + 1;
          }), x()[z >> 2 >>> 0] = te, 0;
        }
        function Qe(L) {
          return B ? fe(22, 1, L) : 52;
        }
        function nt(L, z, U, te) {
          return B ? fe(23, 1, L, z, U, te) : 52;
        }
        function Mt(L, z, U, te, ae) {
          return B ? fe(24, 1, L, z, U, te, ae) : 70;
        }
        var Yt = [null, [], []];
        function tn(L, z) {
          var U = Yt[L];
          z === 0 || z === 10 ? ((L === 1 ? j : J)(Ye(U, 0)), U.length = 0) : U.push(z);
        }
        function sn(L, z, U, te) {
          if (B) return fe(25, 1, L, z, U, te);
          for (var ae = 0, ce = 0; ce < U; ce++) {
            var ve = x()[z >> 2 >>> 0], Ae = x()[z + 4 >> 2 >>> 0];
            z += 8;
            for (var je = 0; je < Ae; je++) tn(L, y()[ve + je >>> 0]);
            ae += Ae;
          }
          return x()[te >> 2 >>> 0] = ae, 0;
        }
        var Tt = 0;
        function Kt(L) {
          return L % 4 == 0 && (L % 100 != 0 || L % 400 == 0);
        }
        var ln = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], un = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
        function cn(L, z, U, te) {
          function ae(he, We, ct) {
            for (he = typeof he == "number" ? he.toString() : he || ""; he.length < We; ) he = ct[0] + he;
            return he;
          }
          function ce(he, We) {
            return ae(he, We, "0");
          }
          function ve(he, We) {
            function ct(Xt) {
              return 0 > Xt ? -1 : 0 < Xt ? 1 : 0;
            }
            var It;
            return (It = ct(he.getFullYear() - We.getFullYear())) === 0 && (It = ct(he.getMonth() - We.getMonth())) === 0 && (It = ct(he.getDate() - We.getDate())), It;
          }
          function Ae(he) {
            switch (he.getDay()) {
              case 0:
                return new Date(he.getFullYear() - 1, 11, 29);
              case 1:
                return he;
              case 2:
                return new Date(he.getFullYear(), 0, 3);
              case 3:
                return new Date(he.getFullYear(), 0, 2);
              case 4:
                return new Date(he.getFullYear(), 0, 1);
              case 5:
                return new Date(he.getFullYear() - 1, 11, 31);
              case 6:
                return new Date(he.getFullYear() - 1, 11, 30);
            }
          }
          function je(he) {
            var We = he.Wb;
            for (he = new Date(new Date(he.Xb + 1900, 0, 1).getTime()); 0 < We; ) {
              var ct = he.getMonth(), It = (Kt(he.getFullYear()) ? ln : un)[ct];
              if (!(We > It - he.getDate())) {
                he.setDate(he.getDate() + We);
                break;
              }
              We -= It - he.getDate() + 1, he.setDate(1), 11 > ct ? he.setMonth(ct + 1) : (he.setMonth(0), he.setFullYear(he.getFullYear() + 1));
            }
            return ct = new Date(he.getFullYear() + 1, 0, 4), We = Ae(new Date(he.getFullYear(), 0, 4)), ct = Ae(ct), 0 >= ve(We, he) ? 0 >= ve(ct, he) ? he.getFullYear() + 1 : he.getFullYear() : he.getFullYear() - 1;
          }
          var qe = E()[te + 40 >> 2 >>> 0];
          for (var dt in te = { Lc: E()[te >> 2 >>> 0], Kc: E()[te + 4 >> 2 >>> 0], dc: E()[te + 8 >> 2 >>> 0], jc: E()[te + 12 >> 2 >>> 0], ec: E()[te + 16 >> 2 >>> 0], Xb: E()[te + 20 >> 2 >>> 0], Tb: E()[te + 24 >> 2 >>> 0], Wb: E()[te + 28 >> 2 >>> 0], Rc: E()[te + 32 >> 2 >>> 0], Jc: E()[te + 36 >> 2 >>> 0], Mc: qe ? Ie(qe) : "" }, U = Ie(U), qe = { "%c": "%a %b %d %H:%M:%S %Y", "%D": "%m/%d/%y", "%F": "%Y-%m-%d", "%h": "%b", "%r": "%I:%M:%S %p", "%R": "%H:%M", "%T": "%H:%M:%S", "%x": "%m/%d/%y", "%X": "%H:%M:%S", "%Ec": "%c", "%EC": "%C", "%Ex": "%m/%d/%y", "%EX": "%H:%M:%S", "%Ey": "%y", "%EY": "%Y", "%Od": "%d", "%Oe": "%e", "%OH": "%H", "%OI": "%I", "%Om": "%m", "%OM": "%M", "%OS": "%S", "%Ou": "%u", "%OU": "%U", "%OV": "%V", "%Ow": "%w", "%OW": "%W", "%Oy": "%y" }) U = U.replace(new RegExp(dt, "g"), qe[dt]);
          var Ot = "Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "), $t = "January February March April May June July August September October November December".split(" ");
          for (dt in qe = { "%a": function(he) {
            return Ot[he.Tb].substring(0, 3);
          }, "%A": function(he) {
            return Ot[he.Tb];
          }, "%b": function(he) {
            return $t[he.ec].substring(0, 3);
          }, "%B": function(he) {
            return $t[he.ec];
          }, "%C": function(he) {
            return ce((he.Xb + 1900) / 100 | 0, 2);
          }, "%d": function(he) {
            return ce(he.jc, 2);
          }, "%e": function(he) {
            return ae(he.jc, 2, " ");
          }, "%g": function(he) {
            return je(he).toString().substring(2);
          }, "%G": function(he) {
            return je(he);
          }, "%H": function(he) {
            return ce(he.dc, 2);
          }, "%I": function(he) {
            return (he = he.dc) == 0 ? he = 12 : 12 < he && (he -= 12), ce(he, 2);
          }, "%j": function(he) {
            for (var We = 0, ct = 0; ct <= he.ec - 1; We += (Kt(he.Xb + 1900) ? ln : un)[ct++]) ;
            return ce(he.jc + We, 3);
          }, "%m": function(he) {
            return ce(he.ec + 1, 2);
          }, "%M": function(he) {
            return ce(he.Kc, 2);
          }, "%n": function() {
            return `
`;
          }, "%p": function(he) {
            return 0 <= he.dc && 12 > he.dc ? "AM" : "PM";
          }, "%S": function(he) {
            return ce(he.Lc, 2);
          }, "%t": function() {
            return "	";
          }, "%u": function(he) {
            return he.Tb || 7;
          }, "%U": function(he) {
            return ce(Math.floor((he.Wb + 7 - he.Tb) / 7), 2);
          }, "%V": function(he) {
            var We = Math.floor((he.Wb + 7 - (he.Tb + 6) % 7) / 7);
            if (2 >= (he.Tb + 371 - he.Wb - 2) % 7 && We++, We) We == 53 && ((ct = (he.Tb + 371 - he.Wb) % 7) == 4 || ct == 3 && Kt(he.Xb) || (We = 1));
            else {
              We = 52;
              var ct = (he.Tb + 7 - he.Wb - 1) % 7;
              (ct == 4 || ct == 5 && Kt(he.Xb % 400 - 1)) && We++;
            }
            return ce(We, 2);
          }, "%w": function(he) {
            return he.Tb;
          }, "%W": function(he) {
            return ce(Math.floor((he.Wb + 7 - (he.Tb + 6) % 7) / 7), 2);
          }, "%y": function(he) {
            return (he.Xb + 1900).toString().substring(2);
          }, "%Y": function(he) {
            return he.Xb + 1900;
          }, "%z": function(he) {
            var We = 0 <= (he = he.Jc);
            return he = Math.abs(he) / 60, (We ? "+" : "-") + ("0000" + (he / 60 * 100 + he % 60)).slice(-4);
          }, "%Z": function(he) {
            return he.Mc;
          }, "%%": function() {
            return "%";
          } }, U = U.replace(/%%/g, "\0\0"), qe) U.includes(dt) && (U = U.replace(new RegExp(dt, "g"), qe[dt](te)));
          return dt = function(he) {
            var We = Array(Ke(he) + 1);
            return Ge(he, We, 0, We.length), We;
          }(U = U.replace(/\0\0/g, "%")), dt.length > z ? 0 : (function(he, We) {
            g().set(he, We >>> 0);
          }(dt, L), dt.length - 1);
        }
        Ee.fc();
        var Ln = [null, it, Lt, Ct, Pt, Bt, zt, Gt, bt, At, Vt, jt, Ft, Ut, xt, V, K, se, re, le, ue, Le, Qe, nt, Mt, sn], Rn = { b: function(L) {
          return nn(L + 24) + 24;
        }, n: function(L) {
          return (L = new Te(L)).uc() || (L.hc(!0), Fe--), L.ic(!1), St.push(L), L.sc(), L.vc();
        }, ma: function(L) {
          throw J("Unexpected exception thrown, this is not properly supported - aborting"), $e = !0, L;
        }, x: function() {
          Ve(0);
          var L = St.pop();
          if (L.Hc() && !L.kc()) {
            var z = L.Dc();
            z && Ue(z)(L.Zb), kt(L.Zb);
          }
          De = 0;
        }, e: function() {
          var L = De;
          if (!L) return Tt = 0;
          var z = new Te(L);
          z.cc(L);
          var U = z.bc();
          if (!U) return Tt = 0, L;
          for (var te = Array.prototype.slice.call(arguments), ae = 0; ae < te.length; ae++) {
            var ce = te[ae];
            if (ce === 0 || ce === U) break;
            if (Jt(ce, U, z.Sb + 16)) return Tt = ce, L;
          }
          return Tt = U, L;
        }, l: function() {
          var L = De;
          if (!L) return Tt = 0;
          var z = new Te(L);
          z.cc(L);
          var U = z.bc();
          if (!U) return Tt = 0, L;
          for (var te = Array.prototype.slice.call(arguments), ae = 0; ae < te.length; ae++) {
            var ce = te[ae];
            if (ce === 0 || ce === U) break;
            if (Jt(ce, U, z.Sb + 16)) return Tt = ce, L;
          }
          return Tt = U, L;
        }, h: function() {
          var L = De;
          if (!L) return Tt = 0;
          var z = new Te(L);
          z.cc(L);
          var U = z.bc();
          if (!U) return Tt = 0, L;
          for (var te = Array.prototype.slice.call(arguments), ae = 0; ae < te.length; ae++) {
            var ce = te[ae];
            if (ce === 0 || ce === U) break;
            if (Jt(ce, U, z.Sb + 16)) return Tt = ce, L;
          }
          return Tt = U, L;
        }, t: kt, M: function() {
          var L = St.pop();
          L || ke("no exception to throw");
          var z = L.Zb;
          throw L.kc() || (St.push(L), L.ic(!0), L.hc(!1), Fe++), De = z, z;
        }, c: function(L, z, U) {
          throw new Te(L).fc(z, U), De = L, Fe++, L;
        }, pa: function() {
          return Fe;
        }, Fa: function(L) {
          pn(L, !R, 1, !N), Ee.pc();
        }, T: function(L) {
          B ? postMessage({ cmd: "cleanupThread", thread: L }) : vt(L);
        }, xa: Rt, j: function(L) {
          throw De || (De = L), L;
        }, H: Pt, Ma: Bt, ua: zt, wa: Gt, oa: bt, Ka: At, Ca: Vt, Ja: jt, V: Ft, va: Ut, sa: xt, La: V, ta: K, Ta: function() {
        }, X: function() {
          ke("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking");
        }, Ua: function() {
          ke("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking");
        }, W: function() {
          return Date.now();
        }, ya: function() {
          return 2097152;
        }, Oa: function() {
          return !0;
        }, za: function(L, z, U, te) {
          if (L == z) setTimeout(() => ne(te));
          else if (B) postMessage({ targetThread: L, cmd: "processProxyingQueue", queue: te });
          else {
            if (!(L = Ee.Vb[L])) return;
            L.postMessage({ cmd: "processProxyingQueue", queue: te });
          }
          return 1;
        }, Ea: function() {
          return -1;
        }, Pa: function(L, z) {
          L = new Date(1e3 * ie(L)), E()[z >> 2 >>> 0] = L.getUTCSeconds(), E()[z + 4 >> 2 >>> 0] = L.getUTCMinutes(), E()[z + 8 >> 2 >>> 0] = L.getUTCHours(), E()[z + 12 >> 2 >>> 0] = L.getUTCDate(), E()[z + 16 >> 2 >>> 0] = L.getUTCMonth(), E()[z + 20 >> 2 >>> 0] = L.getUTCFullYear() - 1900, E()[z + 24 >> 2 >>> 0] = L.getUTCDay(), L = (L.getTime() - Date.UTC(L.getUTCFullYear(), 0, 1, 0, 0, 0, 0)) / 864e5 | 0, E()[z + 28 >> 2 >>> 0] = L;
        }, Qa: function(L, z) {
          L = new Date(1e3 * ie(L)), E()[z >> 2 >>> 0] = L.getSeconds(), E()[z + 4 >> 2 >>> 0] = L.getMinutes(), E()[z + 8 >> 2 >>> 0] = L.getHours(), E()[z + 12 >> 2 >>> 0] = L.getDate(), E()[z + 16 >> 2 >>> 0] = L.getMonth(), E()[z + 20 >> 2 >>> 0] = L.getFullYear() - 1900, E()[z + 24 >> 2 >>> 0] = L.getDay();
          var U = new Date(L.getFullYear(), 0, 1), te = (L.getTime() - U.getTime()) / 864e5 | 0;
          E()[z + 28 >> 2 >>> 0] = te, E()[z + 36 >> 2 >>> 0] = -60 * L.getTimezoneOffset(), te = new Date(L.getFullYear(), 6, 1).getTimezoneOffset(), L = 0 | (te != (U = U.getTimezoneOffset()) && L.getTimezoneOffset() == Math.min(U, te)), E()[z + 32 >> 2 >>> 0] = L;
        }, Ra: function(L) {
          var z = new Date(E()[L + 20 >> 2 >>> 0] + 1900, E()[L + 16 >> 2 >>> 0], E()[L + 12 >> 2 >>> 0], E()[L + 8 >> 2 >>> 0], E()[L + 4 >> 2 >>> 0], E()[L >> 2 >>> 0], 0), U = E()[L + 32 >> 2 >>> 0], te = z.getTimezoneOffset(), ae = new Date(z.getFullYear(), 0, 1), ce = new Date(z.getFullYear(), 6, 1).getTimezoneOffset(), ve = ae.getTimezoneOffset(), Ae = Math.min(ve, ce);
          return 0 > U ? E()[L + 32 >> 2 >>> 0] = +(ce != ve && Ae == te) : 0 < U != (Ae == te) && (ce = Math.max(ve, ce), z.setTime(z.getTime() + 6e4 * ((0 < U ? Ae : ce) - te))), E()[L + 24 >> 2 >>> 0] = z.getDay(), U = (z.getTime() - ae.getTime()) / 864e5 | 0, E()[L + 28 >> 2 >>> 0] = U, E()[L >> 2 >>> 0] = z.getSeconds(), E()[L + 4 >> 2 >>> 0] = z.getMinutes(), E()[L + 8 >> 2 >>> 0] = z.getHours(), E()[L + 12 >> 2 >>> 0] = z.getDate(), E()[L + 16 >> 2 >>> 0] = z.getMonth(), z.getTime() / 1e3 | 0;
        }, Aa: se, Ba: re, Sa: function L(z, U, te) {
          L.Ac || (L.Ac = !0, le(z, U, te));
        }, y: function() {
          ke("");
        }, U: function() {
          if (!F && !R) {
            var L = "Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";
            Et || (Et = {}), Et[L] || (Et[L] = 1, F && (L = "warning: " + L), J(L));
          }
        }, ra: function() {
          return 4294901760;
        }, B: qt, Ia: function(L, z, U) {
          y().copyWithin(L >>> 0, z >>> 0, z + U >>> 0);
        }, F: function() {
          return F ? r(3993).cpus().length : navigator.hardwareConcurrency;
        }, Da: function(L, z, U) {
          Pe.length = z, U >>= 3;
          for (var te = 0; te < z; te++) Pe[te] = v()[U + te >>> 0];
          return (0 > L ? gt[-L - 1] : Ln[L]).apply(null, Pe);
        }, qa: function(L) {
          var z = y().length;
          if ((L >>>= 0) <= z || 4294901760 < L) return !1;
          for (var U = 1; 4 >= U; U *= 2) {
            var te = z * (1 + 0.2 / U);
            te = Math.min(te, L + 100663296);
            var ae = Math;
            te = Math.max(L, te), ae = ae.min.call(ae, 4294901760, te + (65536 - te % 65536) % 65536);
            e: {
              try {
                pe.grow(ae - oe.byteLength + 65535 >>> 16), Ne(pe.buffer);
                var ce = 1;
                break e;
              } catch {
              }
              ce = void 0;
            }
            if (ce) return !0;
          }
          return !1;
        }, Na: function() {
          throw "unwind";
        }, Ga: ue, Ha: Le, J: ft, I: Qe, S: nt, ga: Mt, R: sn, d: function() {
          return Tt;
        }, na: function L(z, U) {
          L.lc || (L.lc = function() {
            if (typeof crypto == "object" && typeof crypto.getRandomValues == "function") {
              var ae = new Uint8Array(1);
              return () => (crypto.getRandomValues(ae), ae[0]);
            }
            if (F) try {
              var ce = r(Object(function() {
                var ve = new Error("Cannot find module 'crypto'");
                throw ve.code = "MODULE_NOT_FOUND", ve;
              }()));
              return () => ce.randomBytes(1)[0];
            } catch {
            }
            return () => ke("randomDevice");
          }());
          for (var te = 0; te < U; te++) g()[z + te >> 0 >>> 0] = L.lc();
          return 0;
        }, ia: function(L, z, U) {
          var te = Be();
          try {
            return Ue(L)(z, U);
          } catch (ae) {
            if (Re(te), ae !== ae + 0) throw ae;
            Ve(1, 0);
          }
        }, ja: function(L, z, U) {
          var te = Be();
          try {
            return Ue(L)(z, U);
          } catch (ae) {
            if (Re(te), ae !== ae + 0) throw ae;
            Ve(1, 0);
          }
        }, K: function(L) {
          var z = Be();
          try {
            return Ue(L)();
          } catch (U) {
            if (Re(z), U !== U + 0) throw U;
            Ve(1, 0);
          }
        }, f: function(L, z) {
          var U = Be();
          try {
            return Ue(L)(z);
          } catch (te) {
            if (Re(U), te !== te + 0) throw te;
            Ve(1, 0);
          }
        }, P: function(L, z, U) {
          var te = Be();
          try {
            return Ue(L)(z, U);
          } catch (ae) {
            if (Re(te), ae !== ae + 0) throw ae;
            Ve(1, 0);
          }
        }, Q: function(L, z, U) {
          var te = Be();
          try {
            return Ue(L)(z, U);
          } catch (ae) {
            if (Re(te), ae !== ae + 0) throw ae;
            Ve(1, 0);
          }
        }, k: function(L, z, U) {
          var te = Be();
          try {
            return Ue(L)(z, U);
          } catch (ae) {
            if (Re(te), ae !== ae + 0) throw ae;
            Ve(1, 0);
          }
        }, p: function(L, z, U, te) {
          var ae = Be();
          try {
            return Ue(L)(z, U, te);
          } catch (ce) {
            if (Re(ae), ce !== ce + 0) throw ce;
            Ve(1, 0);
          }
        }, q: function(L, z, U, te, ae) {
          var ce = Be();
          try {
            return Ue(L)(z, U, te, ae);
          } catch (ve) {
            if (Re(ce), ve !== ve + 0) throw ve;
            Ve(1, 0);
          }
        }, N: function(L, z, U, te, ae, ce) {
          var ve = Be();
          try {
            return Ue(L)(z, U, te, ae, ce);
          } catch (Ae) {
            if (Re(ve), Ae !== Ae + 0) throw Ae;
            Ve(1, 0);
          }
        }, s: function(L, z, U, te, ae, ce) {
          var ve = Be();
          try {
            return Ue(L)(z, U, te, ae, ce);
          } catch (Ae) {
            if (Re(ve), Ae !== Ae + 0) throw Ae;
            Ve(1, 0);
          }
        }, w: function(L, z, U, te, ae, ce, ve) {
          var Ae = Be();
          try {
            return Ue(L)(z, U, te, ae, ce, ve);
          } catch (je) {
            if (Re(Ae), je !== je + 0) throw je;
            Ve(1, 0);
          }
        }, L: function(L, z, U, te, ae, ce, ve, Ae) {
          var je = Be();
          try {
            return Ue(L)(z, U, te, ae, ce, ve, Ae);
          } catch (qe) {
            if (Re(je), qe !== qe + 0) throw qe;
            Ve(1, 0);
          }
        }, E: function(L, z, U, te, ae, ce, ve, Ae, je, qe, dt, Ot) {
          var $t = Be();
          try {
            return Ue(L)(z, U, te, ae, ce, ve, Ae, je, qe, dt, Ot);
          } catch (he) {
            if (Re($t), he !== he + 0) throw he;
            Ve(1, 0);
          }
        }, aa: function(L, z, U, te, ae, ce, ve, Ae) {
          var je = Be();
          try {
            return Mn(L, z, U, te, ae, ce, ve, Ae);
          } catch (qe) {
            if (Re(je), qe !== qe + 0) throw qe;
            Ve(1, 0);
          }
        }, _: function(L, z, U, te, ae, ce, ve) {
          var Ae = Be();
          try {
            return wn(L, z, U, te, ae, ce, ve);
          } catch (je) {
            if (Re(Ae), je !== je + 0) throw je;
            Ve(1, 0);
          }
        }, Z: function(L, z, U, te, ae) {
          var ce = Be();
          try {
            return $n(L, z, U, te, ae);
          } catch (ve) {
            if (Re(ce), ve !== ve + 0) throw ve;
            Ve(1, 0);
          }
        }, ca: function(L, z, U, te) {
          var ae = Be();
          try {
            return kn(L, z, U, te);
          } catch (ce) {
            if (Re(ae), ce !== ce + 0) throw ce;
            Ve(1, 0);
          }
        }, $: function(L) {
          var z = Be();
          try {
            return vn(L);
          } catch (U) {
            if (Re(z), U !== U + 0) throw U;
            Ve(1, 0);
          }
        }, ba: function(L, z) {
          var U = Be();
          try {
            return An(L, z);
          } catch (te) {
            if (Re(U), te !== te + 0) throw te;
            Ve(1, 0);
          }
        }, Y: function(L, z, U) {
          var te = Be();
          try {
            return xn(L, z, U);
          } catch (ae) {
            if (Re(te), ae !== ae + 0) throw ae;
            Ve(1, 0);
          }
        }, g: function(L) {
          var z = Be();
          try {
            Ue(L)();
          } catch (U) {
            if (Re(z), U !== U + 0) throw U;
            Ve(1, 0);
          }
        }, r: function(L, z) {
          var U = Be();
          try {
            Ue(L)(z);
          } catch (te) {
            if (Re(U), te !== te + 0) throw te;
            Ve(1, 0);
          }
        }, i: function(L, z, U) {
          var te = Be();
          try {
            Ue(L)(z, U);
          } catch (ae) {
            if (Re(te), ae !== ae + 0) throw ae;
            Ve(1, 0);
          }
        }, ha: function(L, z, U, te) {
          var ae = Be();
          try {
            Ue(L)(z, U, te);
          } catch (ce) {
            if (Re(ae), ce !== ce + 0) throw ce;
            Ve(1, 0);
          }
        }, m: function(L, z, U, te) {
          var ae = Be();
          try {
            Ue(L)(z, U, te);
          } catch (ce) {
            if (Re(ae), ce !== ce + 0) throw ce;
            Ve(1, 0);
          }
        }, v: function(L, z, U, te, ae) {
          var ce = Be();
          try {
            Ue(L)(z, U, te, ae);
          } catch (ve) {
            if (Re(ce), ve !== ve + 0) throw ve;
            Ve(1, 0);
          }
        }, u: function(L, z, U, te, ae, ce) {
          var ve = Be();
          try {
            Ue(L)(z, U, te, ae, ce);
          } catch (Ae) {
            if (Re(ve), Ae !== Ae + 0) throw Ae;
            Ve(1, 0);
          }
        }, O: function(L, z, U, te, ae, ce, ve) {
          var Ae = Be();
          try {
            Ue(L)(z, U, te, ae, ce, ve);
          } catch (je) {
            if (Re(Ae), je !== je + 0) throw je;
            Ve(1, 0);
          }
        }, A: function(L, z, U, te, ae, ce, ve, Ae) {
          var je = Be();
          try {
            Ue(L)(z, U, te, ae, ce, ve, Ae);
          } catch (qe) {
            if (Re(je), qe !== qe + 0) throw qe;
            Ve(1, 0);
          }
        }, ka: function(L, z, U, te, ae, ce, ve, Ae, je) {
          var qe = Be();
          try {
            Ue(L)(z, U, te, ae, ce, ve, Ae, je);
          } catch (dt) {
            if (Re(qe), dt !== dt + 0) throw dt;
            Ve(1, 0);
          }
        }, C: function(L, z, U, te, ae, ce, ve, Ae, je, qe, dt) {
          var Ot = Be();
          try {
            Ue(L)(z, U, te, ae, ce, ve, Ae, je, qe, dt);
          } catch ($t) {
            if (Re(Ot), $t !== $t + 0) throw $t;
            Ve(1, 0);
          }
        }, D: function(L, z, U, te, ae, ce, ve, Ae, je, qe, dt, Ot, $t, he, We, ct) {
          var It = Be();
          try {
            Ue(L)(z, U, te, ae, ce, ve, Ae, je, qe, dt, Ot, $t, he, We, ct);
          } catch (Xt) {
            if (Re(It), Xt !== Xt + 0) throw Xt;
            Ve(1, 0);
          }
        }, fa: function(L, z, U, te, ae, ce, ve, Ae) {
          var je = Be();
          try {
            Tn(L, z, U, te, ae, ce, ve, Ae);
          } catch (qe) {
            if (Re(je), qe !== qe + 0) throw qe;
            Ve(1, 0);
          }
        }, da: function(L, z, U, te, ae, ce, ve, Ae, je, qe, dt, Ot) {
          var $t = Be();
          try {
            En(L, z, U, te, ae, ce, ve, Ae, je, qe, dt, Ot);
          } catch (he) {
            if (Re($t), he !== he + 0) throw he;
            Ve(1, 0);
          }
        }, ea: function(L, z, U, te, ae, ce) {
          var ve = Be();
          try {
            Sn(L, z, U, te, ae, ce);
          } catch (Ae) {
            if (Re(ve), Ae !== Ae + 0) throw Ae;
            Ve(1, 0);
          }
        }, o: function(L) {
          return L;
        }, a: pe || h.wasmMemory, G: function(L) {
          Tt = L;
        }, la: cn, z: function(L, z, U, te) {
          return cn(L, z, U, te);
        } };
        (function() {
          function L(ae, ce) {
            h.asm = ae.exports, Ee.qc.push(h.asm.sb), lt = h.asm.ub, Je.unshift(h.asm.Va), ye = ce, B || (_e--, h.monitorRunDependencies && h.monitorRunDependencies(_e), _e == 0 && He && (ae = He, He = null, ae()));
          }
          function z(ae) {
            L(ae.instance, ae.module);
          }
          function U(ae) {
            return function() {
              if (!W && (N || R)) {
                if (typeof fetch == "function" && !tt.startsWith("file://")) return fetch(tt, { credentials: "same-origin" }).then(function(ce) {
                  if (!ce.ok) throw "failed to load wasm binary file at '" + tt + "'";
                  return ce.arrayBuffer();
                }).catch(function() {
                  return yt();
                });
                if (k) return new Promise(function(ce, ve) {
                  k(tt, function(Ae) {
                    ce(new Uint8Array(Ae));
                  }, ve);
                });
              }
              return Promise.resolve().then(function() {
                return yt();
              });
            }().then(function(ce) {
              return WebAssembly.instantiate(ce, te);
            }).then(function(ce) {
              return ce;
            }).then(ae, function(ce) {
              J("failed to asynchronously prepare wasm: " + ce), ke(ce);
            });
          }
          var te = { a: Rn };
          if (B || (_e++, h.monitorRunDependencies && h.monitorRunDependencies(_e)), h.instantiateWasm) try {
            return h.instantiateWasm(te, L);
          } catch (ae) {
            return J("Module.instantiateWasm callback failed with error: " + ae), !1;
          }
          (W || typeof WebAssembly.instantiateStreaming != "function" || st() || tt.startsWith("file://") || F || typeof fetch != "function" ? U(z) : fetch(tt, { credentials: "same-origin" }).then(function(ae) {
            return WebAssembly.instantiateStreaming(ae, te).then(z, function(ce) {
              return J("wasm streaming compile failed: " + ce), J("falling back to ArrayBuffer instantiation"), U(z);
            });
          })).catch(b);
        })(), h.___wasm_call_ctors = function() {
          return (h.___wasm_call_ctors = h.asm.Va).apply(null, arguments);
        }, h._OrtInit = function() {
          return (h._OrtInit = h.asm.Wa).apply(null, arguments);
        }, h._OrtCreateSessionOptions = function() {
          return (h._OrtCreateSessionOptions = h.asm.Xa).apply(null, arguments);
        }, h._OrtAppendExecutionProvider = function() {
          return (h._OrtAppendExecutionProvider = h.asm.Ya).apply(null, arguments);
        }, h._OrtAddSessionConfigEntry = function() {
          return (h._OrtAddSessionConfigEntry = h.asm.Za).apply(null, arguments);
        }, h._OrtReleaseSessionOptions = function() {
          return (h._OrtReleaseSessionOptions = h.asm._a).apply(null, arguments);
        }, h._OrtCreateSession = function() {
          return (h._OrtCreateSession = h.asm.$a).apply(null, arguments);
        }, h._OrtReleaseSession = function() {
          return (h._OrtReleaseSession = h.asm.ab).apply(null, arguments);
        }, h._OrtGetInputCount = function() {
          return (h._OrtGetInputCount = h.asm.bb).apply(null, arguments);
        }, h._OrtGetOutputCount = function() {
          return (h._OrtGetOutputCount = h.asm.cb).apply(null, arguments);
        }, h._OrtGetInputName = function() {
          return (h._OrtGetInputName = h.asm.db).apply(null, arguments);
        }, h._OrtGetOutputName = function() {
          return (h._OrtGetOutputName = h.asm.eb).apply(null, arguments);
        }, h._OrtFree = function() {
          return (h._OrtFree = h.asm.fb).apply(null, arguments);
        }, h._OrtCreateTensor = function() {
          return (h._OrtCreateTensor = h.asm.gb).apply(null, arguments);
        }, h._OrtGetTensorData = function() {
          return (h._OrtGetTensorData = h.asm.hb).apply(null, arguments);
        }, h._OrtReleaseTensor = function() {
          return (h._OrtReleaseTensor = h.asm.ib).apply(null, arguments);
        }, h._OrtCreateRunOptions = function() {
          return (h._OrtCreateRunOptions = h.asm.jb).apply(null, arguments);
        }, h._OrtAddRunConfigEntry = function() {
          return (h._OrtAddRunConfigEntry = h.asm.kb).apply(null, arguments);
        }, h._OrtReleaseRunOptions = function() {
          return (h._OrtReleaseRunOptions = h.asm.lb).apply(null, arguments);
        }, h._OrtRun = function() {
          return (h._OrtRun = h.asm.mb).apply(null, arguments);
        }, h._OrtEndProfiling = function() {
          return (h._OrtEndProfiling = h.asm.nb).apply(null, arguments);
        };
        var Zt = h._pthread_self = function() {
          return (Zt = h._pthread_self = h.asm.ob).apply(null, arguments);
        }, nn = h._malloc = function() {
          return (nn = h._malloc = h.asm.pb).apply(null, arguments);
        }, dn = h._free = function() {
          return (dn = h._free = h.asm.qb).apply(null, arguments);
        }, hn = h._fflush = function() {
          return (hn = h._fflush = h.asm.rb).apply(null, arguments);
        };
        h.__emscripten_tls_init = function() {
          return (h.__emscripten_tls_init = h.asm.sb).apply(null, arguments);
        };
        var fn = h.___funcs_on_exit = function() {
          return (fn = h.___funcs_on_exit = h.asm.tb).apply(null, arguments);
        }, pn = h.__emscripten_thread_init = function() {
          return (pn = h.__emscripten_thread_init = h.asm.vb).apply(null, arguments);
        };
        h.__emscripten_thread_crashed = function() {
          return (h.__emscripten_thread_crashed = h.asm.wb).apply(null, arguments);
        };
        var Qt, mn = h._emscripten_run_in_main_runtime_thread_js = function() {
          return (mn = h._emscripten_run_in_main_runtime_thread_js = h.asm.xb).apply(null, arguments);
        }, gn = h.__emscripten_proxy_execute_task_queue = function() {
          return (gn = h.__emscripten_proxy_execute_task_queue = h.asm.yb).apply(null, arguments);
        }, rn = h.__emscripten_thread_free_data = function() {
          return (rn = h.__emscripten_thread_free_data = h.asm.zb).apply(null, arguments);
        }, _n = h.__emscripten_thread_exit = function() {
          return (_n = h.__emscripten_thread_exit = h.asm.Ab).apply(null, arguments);
        }, Ve = h._setThrew = function() {
          return (Ve = h._setThrew = h.asm.Bb).apply(null, arguments);
        }, bn = h._emscripten_stack_set_limits = function() {
          return (bn = h._emscripten_stack_set_limits = h.asm.Cb).apply(null, arguments);
        }, Be = h.stackSave = function() {
          return (Be = h.stackSave = h.asm.Db).apply(null, arguments);
        }, Re = h.stackRestore = function() {
          return (Re = h.stackRestore = h.asm.Eb).apply(null, arguments);
        }, an = h.stackAlloc = function() {
          return (an = h.stackAlloc = h.asm.Fb).apply(null, arguments);
        }, Jt = h.___cxa_can_catch = function() {
          return (Jt = h.___cxa_can_catch = h.asm.Gb).apply(null, arguments);
        }, yn = h.___cxa_is_pointer_type = function() {
          return (yn = h.___cxa_is_pointer_type = h.asm.Hb).apply(null, arguments);
        }, vn = h.dynCall_j = function() {
          return (vn = h.dynCall_j = h.asm.Ib).apply(null, arguments);
        }, wn = h.dynCall_iiiiij = function() {
          return (wn = h.dynCall_iiiiij = h.asm.Jb).apply(null, arguments);
        }, xn = h.dynCall_jii = function() {
          return (xn = h.dynCall_jii = h.asm.Kb).apply(null, arguments);
        }, Tn = h.dynCall_viiiiij = function() {
          return (Tn = h.dynCall_viiiiij = h.asm.Lb).apply(null, arguments);
        }, Sn = h.dynCall_vjji = function() {
          return (Sn = h.dynCall_vjji = h.asm.Mb).apply(null, arguments);
        }, En = h.dynCall_viiijjjii = function() {
          return (En = h.dynCall_viiijjjii = h.asm.Nb).apply(null, arguments);
        }, kn = h.dynCall_iij = function() {
          return (kn = h.dynCall_iij = h.asm.Ob).apply(null, arguments);
        }, An = h.dynCall_ji = function() {
          return (An = h.dynCall_ji = h.asm.Pb).apply(null, arguments);
        }, Mn = h.dynCall_iiiiiij = function() {
          return (Mn = h.dynCall_iiiiiij = h.asm.Qb).apply(null, arguments);
        }, $n = h.dynCall_iiij = function() {
          return ($n = h.dynCall_iiij = h.asm.Rb).apply(null, arguments);
        };
        function Dn() {
          function L() {
            if (!Qt && (Qt = !0, h.calledRun = !0, !$e) && (B || wt(Je), a(h), h.onRuntimeInitialized && h.onRuntimeInitialized(), !B)) {
              if (h.postRun) for (typeof h.postRun == "function" && (h.postRun = [h.postRun]); h.postRun.length; ) {
                var z = h.postRun.shift();
                at.unshift(z);
              }
              wt(at);
            }
          }
          if (!(0 < _e)) if (B) a(h), B || wt(Je), postMessage({ cmd: "loaded" });
          else {
            if (h.preRun) for (typeof h.preRun == "function" && (h.preRun = [h.preRun]); h.preRun.length; ) pt();
            wt(ut), 0 < _e || (h.setStatus ? (h.setStatus("Running..."), setTimeout(function() {
              setTimeout(function() {
                h.setStatus("");
              }, 1), L();
            }, 1)) : L());
          }
        }
        if (h.UTF8ToString = Ie, h.stringToUTF8 = function(L, z, U) {
          return Ge(L, y(), z, U);
        }, h.lengthBytesUTF8 = Ke, h.keepRuntimeAlive = mt, h.wasmMemory = pe, h.stackSave = Be, h.stackRestore = Re, h.stackAlloc = an, h.ExitStatus = ht, h.PThread = Ee, He = function L() {
          Qt || Dn(), Qt || (He = L);
        }, h.preInit) for (typeof h.preInit == "function" && (h.preInit = [h.preInit]); 0 < h.preInit.length; ) h.preInit.pop()();
        return Dn(), _.ready;
      });
      s.exports = m;
    }, 932: (s, e, r) => {
      var o, m = (o = (o = typeof document < "u" && document.currentScript ? document.currentScript.src : void 0) || "/index.js", function(_) {
        var g, y, E;
        _ = _ || {}, g || (g = _ !== void 0 ? _ : {}), g.ready = new Promise(function(V, K) {
          y = V, E = K;
        });
        var x, v, h, a, b, w, k = Object.assign({}, g), A = "./this.program", M = (V, K) => {
          throw K;
        }, $ = typeof window == "object", O = typeof importScripts == "function", C = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string", P = "";
        C ? (P = O ? r(908).dirname(P) + "/" : "//", w = () => {
          b || (a = r(1384), b = r(908));
        }, x = function(V, K) {
          return w(), V = b.normalize(V), a.readFileSync(V, K ? void 0 : "utf8");
        }, h = (V) => ((V = x(V, !0)).buffer || (V = new Uint8Array(V)), V), v = (V, K, ne) => {
          w(), V = b.normalize(V), a.readFile(V, function(ie, se) {
            ie ? ne(ie) : K(se.buffer);
          });
        }, 1 < process.argv.length && (A = process.argv[1].replace(/\\/g, "/")), process.argv.slice(2), process.on("uncaughtException", function(V) {
          if (!(V instanceof Je)) throw V;
        }), process.on("unhandledRejection", function(V) {
          throw V;
        }), M = (V, K) => {
          if (F || 0 < ge) throw process.exitCode = V, K;
          K instanceof Je || R("exiting due to exception: " + K), process.exit(V);
        }, g.inspect = function() {
          return "[Emscripten Module object]";
        }) : ($ || O) && (O ? P = self.location.href : typeof document < "u" && document.currentScript && (P = document.currentScript.src), o && (P = o), P = P.indexOf("blob:") !== 0 ? P.substr(0, P.replace(/[?#].*/, "").lastIndexOf("/") + 1) : "", x = (V) => {
          var K = new XMLHttpRequest();
          return K.open("GET", V, !1), K.send(null), K.responseText;
        }, O && (h = (V) => {
          var K = new XMLHttpRequest();
          return K.open("GET", V, !1), K.responseType = "arraybuffer", K.send(null), new Uint8Array(K.response);
        }), v = (V, K, ne) => {
          var ie = new XMLHttpRequest();
          ie.open("GET", V, !0), ie.responseType = "arraybuffer", ie.onload = () => {
            ie.status == 200 || ie.status == 0 && ie.response ? K(ie.response) : ne();
          }, ie.onerror = ne, ie.send(null);
        });
        var I, N = g.print || console.log.bind(console), R = g.printErr || console.warn.bind(console);
        Object.assign(g, k), k = null, g.thisProgram && (A = g.thisProgram), g.quit && (M = g.quit), g.wasmBinary && (I = g.wasmBinary);
        var F = g.noExitRuntime || !1;
        typeof WebAssembly != "object" && Ne("no native wasm support detected");
        var B, G, Q, ee, Y, W, j = !1, J = typeof TextDecoder < "u" ? new TextDecoder("utf8") : void 0;
        function me(V, K, ne) {
          var ie = (K >>>= 0) + ne;
          for (ne = K; V[ne] && !(ne >= ie); ) ++ne;
          if (16 < ne - K && V.buffer && J) return J.decode(V.subarray(K, ne));
          for (ie = ""; K < ne; ) {
            var se = V[K++];
            if (128 & se) {
              var re = 63 & V[K++];
              if ((224 & se) == 192) ie += String.fromCharCode((31 & se) << 6 | re);
              else {
                var q = 63 & V[K++];
                65536 > (se = (240 & se) == 224 ? (15 & se) << 12 | re << 6 | q : (7 & se) << 18 | re << 12 | q << 6 | 63 & V[K++]) ? ie += String.fromCharCode(se) : (se -= 65536, ie += String.fromCharCode(55296 | se >> 10, 56320 | 1023 & se));
              }
            } else ie += String.fromCharCode(se);
          }
          return ie;
        }
        function pe(V, K) {
          return (V >>>= 0) ? me(ee, V, K) : "";
        }
        function ye(V, K, ne, ie) {
          if (!(0 < ie)) return 0;
          var se = ne >>>= 0;
          ie = ne + ie - 1;
          for (var re = 0; re < V.length; ++re) {
            var q = V.charCodeAt(re);
            if (55296 <= q && 57343 >= q && (q = 65536 + ((1023 & q) << 10) | 1023 & V.charCodeAt(++re)), 127 >= q) {
              if (ne >= ie) break;
              K[ne++ >>> 0] = q;
            } else {
              if (2047 >= q) {
                if (ne + 1 >= ie) break;
                K[ne++ >>> 0] = 192 | q >> 6;
              } else {
                if (65535 >= q) {
                  if (ne + 2 >= ie) break;
                  K[ne++ >>> 0] = 224 | q >> 12;
                } else {
                  if (ne + 3 >= ie) break;
                  K[ne++ >>> 0] = 240 | q >> 18, K[ne++ >>> 0] = 128 | q >> 12 & 63;
                }
                K[ne++ >>> 0] = 128 | q >> 6 & 63;
              }
              K[ne++ >>> 0] = 128 | 63 & q;
            }
          }
          return K[ne >>> 0] = 0, ne - se;
        }
        function oe(V) {
          for (var K = 0, ne = 0; ne < V.length; ++ne) {
            var ie = V.charCodeAt(ne);
            127 >= ie ? K++ : 2047 >= ie ? K += 2 : 55296 <= ie && 57343 >= ie ? (K += 4, ++ne) : K += 3;
          }
          return K;
        }
        function we() {
          var V = B.buffer;
          G = V, g.HEAP8 = Q = new Int8Array(V), g.HEAP16 = new Int16Array(V), g.HEAP32 = Y = new Int32Array(V), g.HEAPU8 = ee = new Uint8Array(V), g.HEAPU16 = new Uint16Array(V), g.HEAPU32 = W = new Uint32Array(V), g.HEAPF32 = new Float32Array(V), g.HEAPF64 = new Float64Array(V);
        }
        var Se, Me = [], de = [], Oe = [], $e = [], ge = 0;
        function Ye() {
          var V = g.preRun.shift();
          Me.unshift(V);
        }
        var Ie, Ge = 0, Ke = null;
        function Ne(V) {
          throw g.onAbort && g.onAbort(V), R(V = "Aborted(" + V + ")"), j = !0, V = new WebAssembly.RuntimeError(V + ". Build with -sASSERTIONS for more info."), E(V), V;
        }
        function Ce() {
          return Ie.startsWith("data:application/octet-stream;base64,");
        }
        if (Ie = "ort-wasm.wasm", !Ce()) {
          var lt = Ie;
          Ie = g.locateFile ? g.locateFile(lt, P) : P + lt;
        }
        function ut() {
          var V = Ie;
          try {
            if (V == Ie && I) return new Uint8Array(I);
            if (h) return h(V);
            throw "both async and sync fetching of the wasm failed";
          } catch (K) {
            Ne(K);
          }
        }
        function Je(V) {
          this.name = "ExitStatus", this.message = "Program terminated with exit(" + V + ")", this.status = V;
        }
        function Ze(V) {
          for (; 0 < V.length; ) V.shift()(g);
        }
        var at = [], mt = 0, pt = 0;
        function tt(V) {
          this.Db = V, this.zb = V - 24, this.Ub = function(K) {
            W[this.zb + 4 >> 2 >>> 0] = K;
          }, this.Eb = function() {
            return W[this.zb + 4 >> 2 >>> 0];
          }, this.Sb = function(K) {
            W[this.zb + 8 >> 2 >>> 0] = K;
          }, this.Wb = function() {
            return W[this.zb + 8 >> 2 >>> 0];
          }, this.Tb = function() {
            Y[this.zb >> 2 >>> 0] = 0;
          }, this.Ib = function(K) {
            Q[this.zb + 12 >> 0 >>> 0] = K ? 1 : 0;
          }, this.Pb = function() {
            return Q[this.zb + 12 >> 0 >>> 0] != 0;
          }, this.Jb = function(K) {
            Q[this.zb + 13 >> 0 >>> 0] = K ? 1 : 0;
          }, this.Lb = function() {
            return Q[this.zb + 13 >> 0 >>> 0] != 0;
          }, this.Rb = function(K, ne) {
            this.Fb(0), this.Ub(K), this.Sb(ne), this.Tb(), this.Ib(!1), this.Jb(!1);
          }, this.Nb = function() {
            Y[this.zb >> 2 >>> 0] += 1;
          }, this.Xb = function() {
            var K = Y[this.zb >> 2 >>> 0];
            return Y[this.zb >> 2 >>> 0] = K - 1, K === 1;
          }, this.Fb = function(K) {
            W[this.zb + 16 >> 2 >>> 0] = K;
          }, this.Ob = function() {
            return W[this.zb + 16 >> 2 >>> 0];
          }, this.Qb = function() {
            if (Rt(this.Eb())) return W[this.Db >> 2 >>> 0];
            var K = this.Ob();
            return K !== 0 ? K : this.Db;
          };
        }
        function _e(V) {
          return Et(new tt(V).zb);
        }
        var He = [];
        function ke(V) {
          var K = He[V];
          return K || (V >= He.length && (He.length = V + 1), He[V] = K = Se.get(V)), K;
        }
        function st(V) {
          var K = oe(V) + 1, ne = Ue(K);
          return ne && ye(V, Q, ne, K), ne;
        }
        var yt = {};
        function gt() {
          if (!ht) {
            var V, K = { USER: "web_user", LOGNAME: "web_user", PATH: "/", PWD: "/", HOME: "/home/web_user", LANG: (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8", _: A || "./this.program" };
            for (V in yt) yt[V] === void 0 ? delete K[V] : K[V] = yt[V];
            var ne = [];
            for (V in K) ne.push(V + "=" + K[V]);
            ht = ne;
          }
          return ht;
        }
        var ht, vt = [null, [], []];
        function _t(V, K) {
          var ne = vt[V];
          K === 0 || K === 10 ? ((V === 1 ? N : R)(me(ne, 0)), ne.length = 0) : ne.push(K);
        }
        var it = 0;
        function ft(V) {
          return V % 4 == 0 && (V % 100 != 0 || V % 400 == 0);
        }
        var Ee = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], wt = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
        function Nt(V, K, ne, ie) {
          function se(ue, Le, Qe) {
            for (ue = typeof ue == "number" ? ue.toString() : ue || ""; ue.length < Le; ) ue = Qe[0] + ue;
            return ue;
          }
          function re(ue, Le) {
            return se(ue, Le, "0");
          }
          function q(ue, Le) {
            function Qe(Mt) {
              return 0 > Mt ? -1 : 0 < Mt ? 1 : 0;
            }
            var nt;
            return (nt = Qe(ue.getFullYear() - Le.getFullYear())) === 0 && (nt = Qe(ue.getMonth() - Le.getMonth())) === 0 && (nt = Qe(ue.getDate() - Le.getDate())), nt;
          }
          function le(ue) {
            switch (ue.getDay()) {
              case 0:
                return new Date(ue.getFullYear() - 1, 11, 29);
              case 1:
                return ue;
              case 2:
                return new Date(ue.getFullYear(), 0, 3);
              case 3:
                return new Date(ue.getFullYear(), 0, 2);
              case 4:
                return new Date(ue.getFullYear(), 0, 1);
              case 5:
                return new Date(ue.getFullYear() - 1, 11, 31);
              case 6:
                return new Date(ue.getFullYear() - 1, 11, 30);
            }
          }
          function fe(ue) {
            var Le = ue.Bb;
            for (ue = new Date(new Date(ue.Cb + 1900, 0, 1).getTime()); 0 < Le; ) {
              var Qe = ue.getMonth(), nt = (ft(ue.getFullYear()) ? Ee : wt)[Qe];
              if (!(Le > nt - ue.getDate())) {
                ue.setDate(ue.getDate() + Le);
                break;
              }
              Le -= nt - ue.getDate() + 1, ue.setDate(1), 11 > Qe ? ue.setMonth(Qe + 1) : (ue.setMonth(0), ue.setFullYear(ue.getFullYear() + 1));
            }
            return Qe = new Date(ue.getFullYear() + 1, 0, 4), Le = le(new Date(ue.getFullYear(), 0, 4)), Qe = le(Qe), 0 >= q(Le, ue) ? 0 >= q(Qe, ue) ? ue.getFullYear() + 1 : ue.getFullYear() : ue.getFullYear() - 1;
          }
          var xe = Y[ie + 40 >> 2 >>> 0];
          for (var Pe in ie = { $b: Y[ie >> 2 >>> 0], Zb: Y[ie + 4 >> 2 >>> 0], Gb: Y[ie + 8 >> 2 >>> 0], Kb: Y[ie + 12 >> 2 >>> 0], Hb: Y[ie + 16 >> 2 >>> 0], Cb: Y[ie + 20 >> 2 >>> 0], Ab: Y[ie + 24 >> 2 >>> 0], Bb: Y[ie + 28 >> 2 >>> 0], bc: Y[ie + 32 >> 2 >>> 0], Yb: Y[ie + 36 >> 2 >>> 0], ac: xe ? pe(xe) : "" }, ne = pe(ne), xe = { "%c": "%a %b %d %H:%M:%S %Y", "%D": "%m/%d/%y", "%F": "%Y-%m-%d", "%h": "%b", "%r": "%I:%M:%S %p", "%R": "%H:%M", "%T": "%H:%M:%S", "%x": "%m/%d/%y", "%X": "%H:%M:%S", "%Ec": "%c", "%EC": "%C", "%Ex": "%m/%d/%y", "%EX": "%H:%M:%S", "%Ey": "%y", "%EY": "%Y", "%Od": "%d", "%Oe": "%e", "%OH": "%H", "%OI": "%I", "%Om": "%m", "%OM": "%M", "%OS": "%S", "%Ou": "%u", "%OU": "%U", "%OV": "%V", "%Ow": "%w", "%OW": "%W", "%Oy": "%y" }) ne = ne.replace(new RegExp(Pe, "g"), xe[Pe]);
          var ze = "Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "), Xe = "January February March April May June July August September October November December".split(" ");
          for (Pe in xe = { "%a": function(ue) {
            return ze[ue.Ab].substring(0, 3);
          }, "%A": function(ue) {
            return ze[ue.Ab];
          }, "%b": function(ue) {
            return Xe[ue.Hb].substring(0, 3);
          }, "%B": function(ue) {
            return Xe[ue.Hb];
          }, "%C": function(ue) {
            return re((ue.Cb + 1900) / 100 | 0, 2);
          }, "%d": function(ue) {
            return re(ue.Kb, 2);
          }, "%e": function(ue) {
            return se(ue.Kb, 2, " ");
          }, "%g": function(ue) {
            return fe(ue).toString().substring(2);
          }, "%G": function(ue) {
            return fe(ue);
          }, "%H": function(ue) {
            return re(ue.Gb, 2);
          }, "%I": function(ue) {
            return (ue = ue.Gb) == 0 ? ue = 12 : 12 < ue && (ue -= 12), re(ue, 2);
          }, "%j": function(ue) {
            for (var Le = 0, Qe = 0; Qe <= ue.Hb - 1; Le += (ft(ue.Cb + 1900) ? Ee : wt)[Qe++]) ;
            return re(ue.Kb + Le, 3);
          }, "%m": function(ue) {
            return re(ue.Hb + 1, 2);
          }, "%M": function(ue) {
            return re(ue.Zb, 2);
          }, "%n": function() {
            return `
`;
          }, "%p": function(ue) {
            return 0 <= ue.Gb && 12 > ue.Gb ? "AM" : "PM";
          }, "%S": function(ue) {
            return re(ue.$b, 2);
          }, "%t": function() {
            return "	";
          }, "%u": function(ue) {
            return ue.Ab || 7;
          }, "%U": function(ue) {
            return re(Math.floor((ue.Bb + 7 - ue.Ab) / 7), 2);
          }, "%V": function(ue) {
            var Le = Math.floor((ue.Bb + 7 - (ue.Ab + 6) % 7) / 7);
            if (2 >= (ue.Ab + 371 - ue.Bb - 2) % 7 && Le++, Le) Le == 53 && ((Qe = (ue.Ab + 371 - ue.Bb) % 7) == 4 || Qe == 3 && ft(ue.Cb) || (Le = 1));
            else {
              Le = 52;
              var Qe = (ue.Ab + 7 - ue.Bb - 1) % 7;
              (Qe == 4 || Qe == 5 && ft(ue.Cb % 400 - 1)) && Le++;
            }
            return re(Le, 2);
          }, "%w": function(ue) {
            return ue.Ab;
          }, "%W": function(ue) {
            return re(Math.floor((ue.Bb + 7 - (ue.Ab + 6) % 7) / 7), 2);
          }, "%y": function(ue) {
            return (ue.Cb + 1900).toString().substring(2);
          }, "%Y": function(ue) {
            return ue.Cb + 1900;
          }, "%z": function(ue) {
            var Le = 0 <= (ue = ue.Yb);
            return ue = Math.abs(ue) / 60, (Le ? "+" : "-") + ("0000" + (ue / 60 * 100 + ue % 60)).slice(-4);
          }, "%Z": function(ue) {
            return ue.ac;
          }, "%%": function() {
            return "%";
          } }, ne = ne.replace(/%%/g, "\0\0"), xe) ne.includes(Pe) && (ne = ne.replace(new RegExp(Pe, "g"), xe[Pe](ie)));
          return Pe = function(ue) {
            var Le = Array(oe(ue) + 1);
            return ye(ue, Le, 0, Le.length), Le;
          }(ne = ne.replace(/\0\0/g, "%")), Pe.length > K ? 0 : (Q.set(Pe, V >>> 0), Pe.length - 1);
        }
        var Lt = { a: function(V) {
          return Ue(V + 24) + 24;
        }, m: function(V) {
          return (V = new tt(V)).Pb() || (V.Ib(!0), mt--), V.Jb(!1), at.push(V), V.Nb(), V.Qb();
        }, ia: function(V) {
          throw R("Unexpected exception thrown, this is not properly supported - aborting"), j = !0, V;
        }, w: function() {
          Fe(0);
          var V = at.pop();
          if (V.Xb() && !V.Lb()) {
            var K = V.Wb();
            K && ke(K)(V.Db), _e(V.Db);
          }
          pt = 0;
        }, d: function() {
          var V = pt;
          if (!V) return it = 0;
          var K = new tt(V);
          K.Fb(V);
          var ne = K.Eb();
          if (!ne) return it = 0, V;
          for (var ie = Array.prototype.slice.call(arguments), se = 0; se < ie.length; se++) {
            var re = ie[se];
            if (re === 0 || re === ne) break;
            if (Ct(re, ne, K.zb + 16)) return it = re, V;
          }
          return it = ne, V;
        }, k: function() {
          var V = pt;
          if (!V) return it = 0;
          var K = new tt(V);
          K.Fb(V);
          var ne = K.Eb();
          if (!ne) return it = 0, V;
          for (var ie = Array.prototype.slice.call(arguments), se = 0; se < ie.length; se++) {
            var re = ie[se];
            if (re === 0 || re === ne) break;
            if (Ct(re, ne, K.zb + 16)) return it = re, V;
          }
          return it = ne, V;
        }, g: function() {
          var V = pt;
          if (!V) return it = 0;
          var K = new tt(V);
          K.Fb(V);
          var ne = K.Eb();
          if (!ne) return it = 0, V;
          for (var ie = Array.prototype.slice.call(arguments), se = 0; se < ie.length; se++) {
            var re = ie[se];
            if (re === 0 || re === ne) break;
            if (Ct(re, ne, K.zb + 16)) return it = re, V;
          }
          return it = ne, V;
        }, s: _e, L: function() {
          var V = at.pop();
          V || Ne("no exception to throw");
          var K = V.Db;
          throw V.Lb() || (at.push(V), V.Jb(!0), V.Ib(!1), mt++), pt = K, K;
        }, b: function(V, K, ne) {
          throw new tt(V).Rb(K, ne), pt = V, mt++, V;
        }, la: function() {
          return mt;
        }, i: function(V) {
          throw pt || (pt = V), V;
        }, H: function() {
          return 0;
        }, Ba: function() {
        }, pa: function() {
        }, ra: function() {
        }, ka: function() {
          return 0;
        }, za: function() {
        }, ua: function() {
        }, ya: function() {
        }, R: function() {
        }, qa: function() {
        }, na: function() {
        }, Aa: function() {
        }, oa: function() {
        }, Ha: function() {
        }, Ja: function() {
          Ne("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking");
        }, Ia: function() {
          Ne("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking");
        }, S: function() {
          return Date.now();
        }, Ca: function() {
          return !0;
        }, Da: function(V, K) {
          V = new Date(1e3 * (W[V >>> 2] + 4294967296 * Y[V + 4 >>> 2])), Y[K >> 2 >>> 0] = V.getUTCSeconds(), Y[K + 4 >> 2 >>> 0] = V.getUTCMinutes(), Y[K + 8 >> 2 >>> 0] = V.getUTCHours(), Y[K + 12 >> 2 >>> 0] = V.getUTCDate(), Y[K + 16 >> 2 >>> 0] = V.getUTCMonth(), Y[K + 20 >> 2 >>> 0] = V.getUTCFullYear() - 1900, Y[K + 24 >> 2 >>> 0] = V.getUTCDay(), Y[K + 28 >> 2 >>> 0] = (V.getTime() - Date.UTC(V.getUTCFullYear(), 0, 1, 0, 0, 0, 0)) / 864e5 | 0;
        }, Ea: function(V, K) {
          V = new Date(1e3 * (W[V >>> 2] + 4294967296 * Y[V + 4 >>> 2])), Y[K >> 2 >>> 0] = V.getSeconds(), Y[K + 4 >> 2 >>> 0] = V.getMinutes(), Y[K + 8 >> 2 >>> 0] = V.getHours(), Y[K + 12 >> 2 >>> 0] = V.getDate(), Y[K + 16 >> 2 >>> 0] = V.getMonth(), Y[K + 20 >> 2 >>> 0] = V.getFullYear() - 1900, Y[K + 24 >> 2 >>> 0] = V.getDay();
          var ne = new Date(V.getFullYear(), 0, 1);
          Y[K + 28 >> 2 >>> 0] = (V.getTime() - ne.getTime()) / 864e5 | 0, Y[K + 36 >> 2 >>> 0] = -60 * V.getTimezoneOffset();
          var ie = new Date(V.getFullYear(), 6, 1).getTimezoneOffset();
          ne = ne.getTimezoneOffset(), Y[K + 32 >> 2 >>> 0] = 0 | (ie != ne && V.getTimezoneOffset() == Math.min(ne, ie));
        }, Fa: function(V) {
          var K = new Date(Y[V + 20 >> 2 >>> 0] + 1900, Y[V + 16 >> 2 >>> 0], Y[V + 12 >> 2 >>> 0], Y[V + 8 >> 2 >>> 0], Y[V + 4 >> 2 >>> 0], Y[V >> 2 >>> 0], 0), ne = Y[V + 32 >> 2 >>> 0], ie = K.getTimezoneOffset(), se = new Date(K.getFullYear(), 0, 1), re = new Date(K.getFullYear(), 6, 1).getTimezoneOffset(), q = se.getTimezoneOffset(), le = Math.min(q, re);
          return 0 > ne ? Y[V + 32 >> 2 >>> 0] = +(re != q && le == ie) : 0 < ne != (le == ie) && (re = Math.max(q, re), K.setTime(K.getTime() + 6e4 * ((0 < ne ? le : re) - ie))), Y[V + 24 >> 2 >>> 0] = K.getDay(), Y[V + 28 >> 2 >>> 0] = (K.getTime() - se.getTime()) / 864e5 | 0, Y[V >> 2 >>> 0] = K.getSeconds(), Y[V + 4 >> 2 >>> 0] = K.getMinutes(), Y[V + 8 >> 2 >>> 0] = K.getHours(), Y[V + 12 >> 2 >>> 0] = K.getDate(), Y[V + 16 >> 2 >>> 0] = K.getMonth(), K.getTime() / 1e3 | 0;
        }, sa: function() {
          return -52;
        }, ta: function() {
        }, Ga: function V(K, ne, ie) {
          V.Vb || (V.Vb = !0, function(se, re, q) {
            function le(Xe) {
              return (Xe = Xe.toTimeString().match(/\(([A-Za-z ]+)\)$/)) ? Xe[1] : "GMT";
            }
            var fe = (/* @__PURE__ */ new Date()).getFullYear(), xe = new Date(fe, 0, 1), Pe = new Date(fe, 6, 1);
            fe = xe.getTimezoneOffset();
            var ze = Pe.getTimezoneOffset();
            Y[se >> 2 >>> 0] = 60 * Math.max(fe, ze), Y[re >> 2 >>> 0] = +(fe != ze), se = le(xe), re = le(Pe), se = st(se), re = st(re), ze < fe ? (W[q >> 2 >>> 0] = se, W[q + 4 >> 2 >>> 0] = re) : (W[q >> 2 >>> 0] = re, W[q + 4 >> 2 >>> 0] = se);
          }(K, ne, ie));
        }, B: function() {
          Ne("");
        }, ma: function() {
          return 4294901760;
        }, I: C ? () => {
          var V = process.hrtime();
          return 1e3 * V[0] + V[1] / 1e6;
        } : () => performance.now(), xa: function(V, K, ne) {
          ee.copyWithin(V >>> 0, K >>> 0, K + ne >>> 0);
        }, G: function(V) {
          var K = ee.length;
          if (4294901760 < (V >>>= 0)) return !1;
          for (var ne = 1; 4 >= ne; ne *= 2) {
            var ie = K * (1 + 0.2 / ne);
            ie = Math.min(ie, V + 100663296);
            var se = Math;
            ie = Math.max(V, ie), se = se.min.call(se, 4294901760, ie + (65536 - ie % 65536) % 65536);
            e: {
              try {
                B.grow(se - G.byteLength + 65535 >>> 16), we();
                var re = 1;
                break e;
              } catch {
              }
              re = void 0;
            }
            if (re) return !0;
          }
          return !1;
        }, va: function(V, K) {
          var ne = 0;
          return gt().forEach(function(ie, se) {
            var re = K + ne;
            for (se = W[V + 4 * se >> 2 >>> 0] = re, re = 0; re < ie.length; ++re) Q[se++ >> 0 >>> 0] = ie.charCodeAt(re);
            Q[se >> 0 >>> 0] = 0, ne += ie.length + 1;
          }), 0;
        }, wa: function(V, K) {
          var ne = gt();
          W[V >> 2 >>> 0] = ne.length;
          var ie = 0;
          return ne.forEach(function(se) {
            ie += se.length + 1;
          }), W[K >> 2 >>> 0] = ie, 0;
        }, ba: function(V) {
          F || 0 < ge || (St(), Ze(Oe), qt(0), vt[1].length && _t(1, 10), vt[2].length && _t(2, 10)), F || 0 < ge || (g.onExit && g.onExit(V), j = !0), M(V, new Je(V));
        }, E: function() {
          return 52;
        }, Q: function() {
          return 52;
        }, ca: function() {
          return 70;
        }, P: function(V, K, ne, ie) {
          for (var se = 0, re = 0; re < ne; re++) {
            var q = W[K >> 2 >>> 0], le = W[K + 4 >> 2 >>> 0];
            K += 8;
            for (var fe = 0; fe < le; fe++) _t(V, ee[q + fe >>> 0]);
            se += le;
          }
          return W[ie >> 2 >>> 0] = se, 0;
        }, c: function() {
          return it;
        }, ja: function V(K, ne) {
          V.Mb || (V.Mb = function() {
            if (typeof crypto == "object" && typeof crypto.getRandomValues == "function") {
              var se = new Uint8Array(1);
              return () => (crypto.getRandomValues(se), se[0]);
            }
            if (C) try {
              var re = r(Object(function() {
                var q = new Error("Cannot find module 'crypto'");
                throw q.code = "MODULE_NOT_FOUND", q;
              }()));
              return () => re.randomBytes(1)[0];
            } catch {
            }
            return () => Ne("randomDevice");
          }());
          for (var ie = 0; ie < ne; ie++) Q[K + ie >> 0 >>> 0] = V.Mb();
          return 0;
        }, ea: function(V, K, ne) {
          var ie = De();
          try {
            return ke(V)(K, ne);
          } catch (se) {
            if (Te(ie), se !== se + 0) throw se;
            Fe(1, 0);
          }
        }, fa: function(V, K, ne) {
          var ie = De();
          try {
            return ke(V)(K, ne);
          } catch (se) {
            if (Te(ie), se !== se + 0) throw se;
            Fe(1, 0);
          }
        }, J: function(V) {
          var K = De();
          try {
            return ke(V)();
          } catch (ne) {
            if (Te(K), ne !== ne + 0) throw ne;
            Fe(1, 0);
          }
        }, e: function(V, K) {
          var ne = De();
          try {
            return ke(V)(K);
          } catch (ie) {
            if (Te(ne), ie !== ie + 0) throw ie;
            Fe(1, 0);
          }
        }, N: function(V, K, ne) {
          var ie = De();
          try {
            return ke(V)(K, ne);
          } catch (se) {
            if (Te(ie), se !== se + 0) throw se;
            Fe(1, 0);
          }
        }, O: function(V, K, ne) {
          var ie = De();
          try {
            return ke(V)(K, ne);
          } catch (se) {
            if (Te(ie), se !== se + 0) throw se;
            Fe(1, 0);
          }
        }, j: function(V, K, ne) {
          var ie = De();
          try {
            return ke(V)(K, ne);
          } catch (se) {
            if (Te(ie), se !== se + 0) throw se;
            Fe(1, 0);
          }
        }, o: function(V, K, ne, ie) {
          var se = De();
          try {
            return ke(V)(K, ne, ie);
          } catch (re) {
            if (Te(se), re !== re + 0) throw re;
            Fe(1, 0);
          }
        }, p: function(V, K, ne, ie, se) {
          var re = De();
          try {
            return ke(V)(K, ne, ie, se);
          } catch (q) {
            if (Te(re), q !== q + 0) throw q;
            Fe(1, 0);
          }
        }, M: function(V, K, ne, ie, se, re) {
          var q = De();
          try {
            return ke(V)(K, ne, ie, se, re);
          } catch (le) {
            if (Te(q), le !== le + 0) throw le;
            Fe(1, 0);
          }
        }, r: function(V, K, ne, ie, se, re) {
          var q = De();
          try {
            return ke(V)(K, ne, ie, se, re);
          } catch (le) {
            if (Te(q), le !== le + 0) throw le;
            Fe(1, 0);
          }
        }, v: function(V, K, ne, ie, se, re, q) {
          var le = De();
          try {
            return ke(V)(K, ne, ie, se, re, q);
          } catch (fe) {
            if (Te(le), fe !== fe + 0) throw fe;
            Fe(1, 0);
          }
        }, K: function(V, K, ne, ie, se, re, q, le) {
          var fe = De();
          try {
            return ke(V)(K, ne, ie, se, re, q, le);
          } catch (xe) {
            if (Te(fe), xe !== xe + 0) throw xe;
            Fe(1, 0);
          }
        }, D: function(V, K, ne, ie, se, re, q, le, fe, xe, Pe, ze) {
          var Xe = De();
          try {
            return ke(V)(K, ne, ie, se, re, q, le, fe, xe, Pe, ze);
          } catch (ue) {
            if (Te(Xe), ue !== ue + 0) throw ue;
            Fe(1, 0);
          }
        }, X: function(V, K, ne, ie, se, re, q, le) {
          var fe = De();
          try {
            return Ft(V, K, ne, ie, se, re, q, le);
          } catch (xe) {
            if (Te(fe), xe !== xe + 0) throw xe;
            Fe(1, 0);
          }
        }, V: function(V, K, ne, ie, se, re, q) {
          var le = De();
          try {
            return Bt(V, K, ne, ie, se, re, q);
          } catch (fe) {
            if (Te(le), fe !== fe + 0) throw fe;
            Fe(1, 0);
          }
        }, U: function(V, K, ne, ie, se) {
          var re = De();
          try {
            return Ut(V, K, ne, ie, se);
          } catch (q) {
            if (Te(re), q !== q + 0) throw q;
            Fe(1, 0);
          }
        }, Z: function(V, K, ne, ie) {
          var se = De();
          try {
            return Vt(V, K, ne, ie);
          } catch (re) {
            if (Te(se), re !== re + 0) throw re;
            Fe(1, 0);
          }
        }, W: function(V) {
          var K = De();
          try {
            return Pt(V);
          } catch (ne) {
            if (Te(K), ne !== ne + 0) throw ne;
            Fe(1, 0);
          }
        }, Y: function(V, K) {
          var ne = De();
          try {
            return jt(V, K);
          } catch (ie) {
            if (Te(ne), ie !== ie + 0) throw ie;
            Fe(1, 0);
          }
        }, T: function(V, K, ne) {
          var ie = De();
          try {
            return zt(V, K, ne);
          } catch (se) {
            if (Te(ie), se !== se + 0) throw se;
            Fe(1, 0);
          }
        }, f: function(V) {
          var K = De();
          try {
            ke(V)();
          } catch (ne) {
            if (Te(K), ne !== ne + 0) throw ne;
            Fe(1, 0);
          }
        }, q: function(V, K) {
          var ne = De();
          try {
            ke(V)(K);
          } catch (ie) {
            if (Te(ne), ie !== ie + 0) throw ie;
            Fe(1, 0);
          }
        }, h: function(V, K, ne) {
          var ie = De();
          try {
            ke(V)(K, ne);
          } catch (se) {
            if (Te(ie), se !== se + 0) throw se;
            Fe(1, 0);
          }
        }, da: function(V, K, ne, ie) {
          var se = De();
          try {
            ke(V)(K, ne, ie);
          } catch (re) {
            if (Te(se), re !== re + 0) throw re;
            Fe(1, 0);
          }
        }, l: function(V, K, ne, ie) {
          var se = De();
          try {
            ke(V)(K, ne, ie);
          } catch (re) {
            if (Te(se), re !== re + 0) throw re;
            Fe(1, 0);
          }
        }, t: function(V, K, ne, ie, se) {
          var re = De();
          try {
            ke(V)(K, ne, ie, se);
          } catch (q) {
            if (Te(re), q !== q + 0) throw q;
            Fe(1, 0);
          }
        }, u: function(V, K, ne, ie, se, re) {
          var q = De();
          try {
            ke(V)(K, ne, ie, se, re);
          } catch (le) {
            if (Te(q), le !== le + 0) throw le;
            Fe(1, 0);
          }
        }, x: function(V, K, ne, ie, se, re, q) {
          var le = De();
          try {
            ke(V)(K, ne, ie, se, re, q);
          } catch (fe) {
            if (Te(le), fe !== fe + 0) throw fe;
            Fe(1, 0);
          }
        }, z: function(V, K, ne, ie, se, re, q, le) {
          var fe = De();
          try {
            ke(V)(K, ne, ie, se, re, q, le);
          } catch (xe) {
            if (Te(fe), xe !== xe + 0) throw xe;
            Fe(1, 0);
          }
        }, ga: function(V, K, ne, ie, se, re, q, le, fe) {
          var xe = De();
          try {
            ke(V)(K, ne, ie, se, re, q, le, fe);
          } catch (Pe) {
            if (Te(xe), Pe !== Pe + 0) throw Pe;
            Fe(1, 0);
          }
        }, A: function(V, K, ne, ie, se, re, q, le, fe, xe, Pe) {
          var ze = De();
          try {
            ke(V)(K, ne, ie, se, re, q, le, fe, xe, Pe);
          } catch (Xe) {
            if (Te(ze), Xe !== Xe + 0) throw Xe;
            Fe(1, 0);
          }
        }, C: function(V, K, ne, ie, se, re, q, le, fe, xe, Pe, ze, Xe, ue, Le, Qe) {
          var nt = De();
          try {
            ke(V)(K, ne, ie, se, re, q, le, fe, xe, Pe, ze, Xe, ue, Le, Qe);
          } catch (Mt) {
            if (Te(nt), Mt !== Mt + 0) throw Mt;
            Fe(1, 0);
          }
        }, aa: function(V, K, ne, ie, se, re, q, le) {
          var fe = De();
          try {
            Gt(V, K, ne, ie, se, re, q, le);
          } catch (xe) {
            if (Te(fe), xe !== xe + 0) throw xe;
            Fe(1, 0);
          }
        }, _: function(V, K, ne, ie, se, re, q, le, fe, xe, Pe, ze) {
          var Xe = De();
          try {
            At(V, K, ne, ie, se, re, q, le, fe, xe, Pe, ze);
          } catch (ue) {
            if (Te(Xe), ue !== ue + 0) throw ue;
            Fe(1, 0);
          }
        }, $: function(V, K, ne, ie, se, re) {
          var q = De();
          try {
            bt(V, K, ne, ie, se, re);
          } catch (le) {
            if (Te(q), le !== le + 0) throw le;
            Fe(1, 0);
          }
        }, n: function(V) {
          return V;
        }, F: function(V) {
          it = V;
        }, ha: Nt, y: function(V, K, ne, ie) {
          return Nt(V, K, ne, ie);
        } };
        (function() {
          function V(se) {
            g.asm = se.exports, B = g.asm.Ka, we(), Se = g.asm.ib, de.unshift(g.asm.La), Ge--, g.monitorRunDependencies && g.monitorRunDependencies(Ge), Ge == 0 && Ke && (se = Ke, Ke = null, se());
          }
          function K(se) {
            V(se.instance);
          }
          function ne(se) {
            return function() {
              if (!I && ($ || O)) {
                if (typeof fetch == "function" && !Ie.startsWith("file://")) return fetch(Ie, { credentials: "same-origin" }).then(function(re) {
                  if (!re.ok) throw "failed to load wasm binary file at '" + Ie + "'";
                  return re.arrayBuffer();
                }).catch(function() {
                  return ut();
                });
                if (v) return new Promise(function(re, q) {
                  v(Ie, function(le) {
                    re(new Uint8Array(le));
                  }, q);
                });
              }
              return Promise.resolve().then(function() {
                return ut();
              });
            }().then(function(re) {
              return WebAssembly.instantiate(re, ie);
            }).then(function(re) {
              return re;
            }).then(se, function(re) {
              R("failed to asynchronously prepare wasm: " + re), Ne(re);
            });
          }
          var ie = { a: Lt };
          if (Ge++, g.monitorRunDependencies && g.monitorRunDependencies(Ge), g.instantiateWasm) try {
            return g.instantiateWasm(ie, V);
          } catch (se) {
            return R("Module.instantiateWasm callback failed with error: " + se), !1;
          }
          (I || typeof WebAssembly.instantiateStreaming != "function" || Ce() || Ie.startsWith("file://") || C || typeof fetch != "function" ? ne(K) : fetch(Ie, { credentials: "same-origin" }).then(function(se) {
            return WebAssembly.instantiateStreaming(se, ie).then(K, function(re) {
              return R("wasm streaming compile failed: " + re), R("falling back to ArrayBuffer instantiation"), ne(K);
            });
          })).catch(E);
        })(), g.___wasm_call_ctors = function() {
          return (g.___wasm_call_ctors = g.asm.La).apply(null, arguments);
        }, g._OrtInit = function() {
          return (g._OrtInit = g.asm.Ma).apply(null, arguments);
        }, g._OrtCreateSessionOptions = function() {
          return (g._OrtCreateSessionOptions = g.asm.Na).apply(null, arguments);
        }, g._OrtAppendExecutionProvider = function() {
          return (g._OrtAppendExecutionProvider = g.asm.Oa).apply(null, arguments);
        }, g._OrtAddSessionConfigEntry = function() {
          return (g._OrtAddSessionConfigEntry = g.asm.Pa).apply(null, arguments);
        }, g._OrtReleaseSessionOptions = function() {
          return (g._OrtReleaseSessionOptions = g.asm.Qa).apply(null, arguments);
        }, g._OrtCreateSession = function() {
          return (g._OrtCreateSession = g.asm.Ra).apply(null, arguments);
        }, g._OrtReleaseSession = function() {
          return (g._OrtReleaseSession = g.asm.Sa).apply(null, arguments);
        }, g._OrtGetInputCount = function() {
          return (g._OrtGetInputCount = g.asm.Ta).apply(null, arguments);
        }, g._OrtGetOutputCount = function() {
          return (g._OrtGetOutputCount = g.asm.Ua).apply(null, arguments);
        }, g._OrtGetInputName = function() {
          return (g._OrtGetInputName = g.asm.Va).apply(null, arguments);
        }, g._OrtGetOutputName = function() {
          return (g._OrtGetOutputName = g.asm.Wa).apply(null, arguments);
        }, g._OrtFree = function() {
          return (g._OrtFree = g.asm.Xa).apply(null, arguments);
        }, g._OrtCreateTensor = function() {
          return (g._OrtCreateTensor = g.asm.Ya).apply(null, arguments);
        }, g._OrtGetTensorData = function() {
          return (g._OrtGetTensorData = g.asm.Za).apply(null, arguments);
        }, g._OrtReleaseTensor = function() {
          return (g._OrtReleaseTensor = g.asm._a).apply(null, arguments);
        }, g._OrtCreateRunOptions = function() {
          return (g._OrtCreateRunOptions = g.asm.$a).apply(null, arguments);
        }, g._OrtAddRunConfigEntry = function() {
          return (g._OrtAddRunConfigEntry = g.asm.ab).apply(null, arguments);
        }, g._OrtReleaseRunOptions = function() {
          return (g._OrtReleaseRunOptions = g.asm.bb).apply(null, arguments);
        }, g._OrtRun = function() {
          return (g._OrtRun = g.asm.cb).apply(null, arguments);
        }, g._OrtEndProfiling = function() {
          return (g._OrtEndProfiling = g.asm.db).apply(null, arguments);
        };
        var Dt, Ue = g._malloc = function() {
          return (Ue = g._malloc = g.asm.eb).apply(null, arguments);
        }, Et = g._free = function() {
          return (Et = g._free = g.asm.fb).apply(null, arguments);
        }, qt = g._fflush = function() {
          return (qt = g._fflush = g.asm.gb).apply(null, arguments);
        }, St = g.___funcs_on_exit = function() {
          return (St = g.___funcs_on_exit = g.asm.hb).apply(null, arguments);
        }, Fe = g._setThrew = function() {
          return (Fe = g._setThrew = g.asm.jb).apply(null, arguments);
        }, De = g.stackSave = function() {
          return (De = g.stackSave = g.asm.kb).apply(null, arguments);
        }, Te = g.stackRestore = function() {
          return (Te = g.stackRestore = g.asm.lb).apply(null, arguments);
        }, kt = g.stackAlloc = function() {
          return (kt = g.stackAlloc = g.asm.mb).apply(null, arguments);
        }, Ct = g.___cxa_can_catch = function() {
          return (Ct = g.___cxa_can_catch = g.asm.nb).apply(null, arguments);
        }, Rt = g.___cxa_is_pointer_type = function() {
          return (Rt = g.___cxa_is_pointer_type = g.asm.ob).apply(null, arguments);
        }, Pt = g.dynCall_j = function() {
          return (Pt = g.dynCall_j = g.asm.pb).apply(null, arguments);
        }, Bt = g.dynCall_iiiiij = function() {
          return (Bt = g.dynCall_iiiiij = g.asm.qb).apply(null, arguments);
        }, zt = g.dynCall_jii = function() {
          return (zt = g.dynCall_jii = g.asm.rb).apply(null, arguments);
        }, Gt = g.dynCall_viiiiij = function() {
          return (Gt = g.dynCall_viiiiij = g.asm.sb).apply(null, arguments);
        }, bt = g.dynCall_vjji = function() {
          return (bt = g.dynCall_vjji = g.asm.tb).apply(null, arguments);
        }, At = g.dynCall_viiijjjii = function() {
          return (At = g.dynCall_viiijjjii = g.asm.ub).apply(null, arguments);
        }, Vt = g.dynCall_iij = function() {
          return (Vt = g.dynCall_iij = g.asm.vb).apply(null, arguments);
        }, jt = g.dynCall_ji = function() {
          return (jt = g.dynCall_ji = g.asm.wb).apply(null, arguments);
        }, Ft = g.dynCall_iiiiiij = function() {
          return (Ft = g.dynCall_iiiiiij = g.asm.xb).apply(null, arguments);
        }, Ut = g.dynCall_iiij = function() {
          return (Ut = g.dynCall_iiij = g.asm.yb).apply(null, arguments);
        };
        function xt() {
          function V() {
            if (!Dt && (Dt = !0, g.calledRun = !0, !j)) {
              if (Ze(de), y(g), g.onRuntimeInitialized && g.onRuntimeInitialized(), g.postRun) for (typeof g.postRun == "function" && (g.postRun = [g.postRun]); g.postRun.length; ) {
                var K = g.postRun.shift();
                $e.unshift(K);
              }
              Ze($e);
            }
          }
          if (!(0 < Ge)) {
            if (g.preRun) for (typeof g.preRun == "function" && (g.preRun = [g.preRun]); g.preRun.length; ) Ye();
            Ze(Me), 0 < Ge || (g.setStatus ? (g.setStatus("Running..."), setTimeout(function() {
              setTimeout(function() {
                g.setStatus("");
              }, 1), V();
            }, 1)) : V());
          }
        }
        if (g.UTF8ToString = pe, g.stringToUTF8 = function(V, K, ne) {
          return ye(V, ee, K, ne);
        }, g.lengthBytesUTF8 = oe, g.stackSave = De, g.stackRestore = Te, g.stackAlloc = kt, Ke = function V() {
          Dt || xt(), Dt || (Ke = V);
        }, g.preInit) for (typeof g.preInit == "function" && (g.preInit = [g.preInit]); 0 < g.preInit.length; ) g.preInit.pop()();
        return xt(), _.ready;
      });
      s.exports = m;
    }, 4537: (s) => {
      s.exports = function(e, r) {
        for (var o = new Array(arguments.length - 1), m = 0, _ = 2, g = !0; _ < arguments.length; ) o[m++] = arguments[_++];
        return new Promise(function(y, E) {
          o[m] = function(x) {
            if (g) if (g = !1, x) E(x);
            else {
              for (var v = new Array(arguments.length - 1), h = 0; h < v.length; ) v[h++] = arguments[h];
              y.apply(null, v);
            }
          };
          try {
            e.apply(r || null, o);
          } catch (x) {
            g && (g = !1, E(x));
          }
        });
      };
    }, 7419: (s, e) => {
      var r = e;
      r.length = function(y) {
        var E = y.length;
        if (!E) return 0;
        for (var x = 0; --E % 4 > 1 && y.charAt(E) === "="; ) ++x;
        return Math.ceil(3 * y.length) / 4 - x;
      };
      for (var o = new Array(64), m = new Array(123), _ = 0; _ < 64; ) m[o[_] = _ < 26 ? _ + 65 : _ < 52 ? _ + 71 : _ < 62 ? _ - 4 : _ - 59 | 43] = _++;
      r.encode = function(y, E, x) {
        for (var v, h = null, a = [], b = 0, w = 0; E < x; ) {
          var k = y[E++];
          switch (w) {
            case 0:
              a[b++] = o[k >> 2], v = (3 & k) << 4, w = 1;
              break;
            case 1:
              a[b++] = o[v | k >> 4], v = (15 & k) << 2, w = 2;
              break;
            case 2:
              a[b++] = o[v | k >> 6], a[b++] = o[63 & k], w = 0;
          }
          b > 8191 && ((h || (h = [])).push(String.fromCharCode.apply(String, a)), b = 0);
        }
        return w && (a[b++] = o[v], a[b++] = 61, w === 1 && (a[b++] = 61)), h ? (b && h.push(String.fromCharCode.apply(String, a.slice(0, b))), h.join("")) : String.fromCharCode.apply(String, a.slice(0, b));
      };
      var g = "invalid encoding";
      r.decode = function(y, E, x) {
        for (var v, h = x, a = 0, b = 0; b < y.length; ) {
          var w = y.charCodeAt(b++);
          if (w === 61 && a > 1) break;
          if ((w = m[w]) === void 0) throw Error(g);
          switch (a) {
            case 0:
              v = w, a = 1;
              break;
            case 1:
              E[x++] = v << 2 | (48 & w) >> 4, v = w, a = 2;
              break;
            case 2:
              E[x++] = (15 & v) << 4 | (60 & w) >> 2, v = w, a = 3;
              break;
            case 3:
              E[x++] = (3 & v) << 6 | w, a = 0;
          }
        }
        if (a === 1) throw Error(g);
        return x - h;
      }, r.test = function(y) {
        return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(y);
      };
    }, 9211: (s) => {
      function e() {
        this._listeners = {};
      }
      s.exports = e, e.prototype.on = function(r, o, m) {
        return (this._listeners[r] || (this._listeners[r] = [])).push({ fn: o, ctx: m || this }), this;
      }, e.prototype.off = function(r, o) {
        if (r === void 0) this._listeners = {};
        else if (o === void 0) this._listeners[r] = [];
        else for (var m = this._listeners[r], _ = 0; _ < m.length; ) m[_].fn === o ? m.splice(_, 1) : ++_;
        return this;
      }, e.prototype.emit = function(r) {
        var o = this._listeners[r];
        if (o) {
          for (var m = [], _ = 1; _ < arguments.length; ) m.push(arguments[_++]);
          for (_ = 0; _ < o.length; ) o[_].fn.apply(o[_++].ctx, m);
        }
        return this;
      };
    }, 945: (s) => {
      function e(g) {
        return typeof Float32Array < "u" ? function() {
          var y = new Float32Array([-0]), E = new Uint8Array(y.buffer), x = E[3] === 128;
          function v(w, k, A) {
            y[0] = w, k[A] = E[0], k[A + 1] = E[1], k[A + 2] = E[2], k[A + 3] = E[3];
          }
          function h(w, k, A) {
            y[0] = w, k[A] = E[3], k[A + 1] = E[2], k[A + 2] = E[1], k[A + 3] = E[0];
          }
          function a(w, k) {
            return E[0] = w[k], E[1] = w[k + 1], E[2] = w[k + 2], E[3] = w[k + 3], y[0];
          }
          function b(w, k) {
            return E[3] = w[k], E[2] = w[k + 1], E[1] = w[k + 2], E[0] = w[k + 3], y[0];
          }
          g.writeFloatLE = x ? v : h, g.writeFloatBE = x ? h : v, g.readFloatLE = x ? a : b, g.readFloatBE = x ? b : a;
        }() : function() {
          function y(x, v, h, a) {
            var b = v < 0 ? 1 : 0;
            if (b && (v = -v), v === 0) x(1 / v > 0 ? 0 : 2147483648, h, a);
            else if (isNaN(v)) x(2143289344, h, a);
            else if (v > 34028234663852886e22) x((b << 31 | 2139095040) >>> 0, h, a);
            else if (v < 11754943508222875e-54) x((b << 31 | Math.round(v / 1401298464324817e-60)) >>> 0, h, a);
            else {
              var w = Math.floor(Math.log(v) / Math.LN2);
              x((b << 31 | w + 127 << 23 | 8388607 & Math.round(v * Math.pow(2, -w) * 8388608)) >>> 0, h, a);
            }
          }
          function E(x, v, h) {
            var a = x(v, h), b = 2 * (a >> 31) + 1, w = a >>> 23 & 255, k = 8388607 & a;
            return w === 255 ? k ? NaN : b * (1 / 0) : w === 0 ? 1401298464324817e-60 * b * k : b * Math.pow(2, w - 150) * (k + 8388608);
          }
          g.writeFloatLE = y.bind(null, r), g.writeFloatBE = y.bind(null, o), g.readFloatLE = E.bind(null, m), g.readFloatBE = E.bind(null, _);
        }(), typeof Float64Array < "u" ? function() {
          var y = new Float64Array([-0]), E = new Uint8Array(y.buffer), x = E[7] === 128;
          function v(w, k, A) {
            y[0] = w, k[A] = E[0], k[A + 1] = E[1], k[A + 2] = E[2], k[A + 3] = E[3], k[A + 4] = E[4], k[A + 5] = E[5], k[A + 6] = E[6], k[A + 7] = E[7];
          }
          function h(w, k, A) {
            y[0] = w, k[A] = E[7], k[A + 1] = E[6], k[A + 2] = E[5], k[A + 3] = E[4], k[A + 4] = E[3], k[A + 5] = E[2], k[A + 6] = E[1], k[A + 7] = E[0];
          }
          function a(w, k) {
            return E[0] = w[k], E[1] = w[k + 1], E[2] = w[k + 2], E[3] = w[k + 3], E[4] = w[k + 4], E[5] = w[k + 5], E[6] = w[k + 6], E[7] = w[k + 7], y[0];
          }
          function b(w, k) {
            return E[7] = w[k], E[6] = w[k + 1], E[5] = w[k + 2], E[4] = w[k + 3], E[3] = w[k + 4], E[2] = w[k + 5], E[1] = w[k + 6], E[0] = w[k + 7], y[0];
          }
          g.writeDoubleLE = x ? v : h, g.writeDoubleBE = x ? h : v, g.readDoubleLE = x ? a : b, g.readDoubleBE = x ? b : a;
        }() : function() {
          function y(x, v, h, a, b, w) {
            var k = a < 0 ? 1 : 0;
            if (k && (a = -a), a === 0) x(0, b, w + v), x(1 / a > 0 ? 0 : 2147483648, b, w + h);
            else if (isNaN(a)) x(0, b, w + v), x(2146959360, b, w + h);
            else if (a > 17976931348623157e292) x(0, b, w + v), x((k << 31 | 2146435072) >>> 0, b, w + h);
            else {
              var A;
              if (a < 22250738585072014e-324) x((A = a / 5e-324) >>> 0, b, w + v), x((k << 31 | A / 4294967296) >>> 0, b, w + h);
              else {
                var M = Math.floor(Math.log(a) / Math.LN2);
                M === 1024 && (M = 1023), x(4503599627370496 * (A = a * Math.pow(2, -M)) >>> 0, b, w + v), x((k << 31 | M + 1023 << 20 | 1048576 * A & 1048575) >>> 0, b, w + h);
              }
            }
          }
          function E(x, v, h, a, b) {
            var w = x(a, b + v), k = x(a, b + h), A = 2 * (k >> 31) + 1, M = k >>> 20 & 2047, $ = 4294967296 * (1048575 & k) + w;
            return M === 2047 ? $ ? NaN : A * (1 / 0) : M === 0 ? 5e-324 * A * $ : A * Math.pow(2, M - 1075) * ($ + 4503599627370496);
          }
          g.writeDoubleLE = y.bind(null, r, 0, 4), g.writeDoubleBE = y.bind(null, o, 4, 0), g.readDoubleLE = E.bind(null, m, 0, 4), g.readDoubleBE = E.bind(null, _, 4, 0);
        }(), g;
      }
      function r(g, y, E) {
        y[E] = 255 & g, y[E + 1] = g >>> 8 & 255, y[E + 2] = g >>> 16 & 255, y[E + 3] = g >>> 24;
      }
      function o(g, y, E) {
        y[E] = g >>> 24, y[E + 1] = g >>> 16 & 255, y[E + 2] = g >>> 8 & 255, y[E + 3] = 255 & g;
      }
      function m(g, y) {
        return (g[y] | g[y + 1] << 8 | g[y + 2] << 16 | g[y + 3] << 24) >>> 0;
      }
      function _(g, y) {
        return (g[y] << 24 | g[y + 1] << 16 | g[y + 2] << 8 | g[y + 3]) >>> 0;
      }
      s.exports = e(e);
    }, 7199: (module) => {
      function inquire(moduleName) {
        try {
          var mod = eval("quire".replace(/^/, "re"))(moduleName);
          if (mod && (mod.length || Object.keys(mod).length)) return mod;
        } catch (s) {
        }
        return null;
      }
      module.exports = inquire;
    }, 6662: (s) => {
      s.exports = function(e, r, o) {
        var m = o || 8192, _ = m >>> 1, g = null, y = m;
        return function(E) {
          if (E < 1 || E > _) return e(E);
          y + E > m && (g = e(m), y = 0);
          var x = r.call(g, y, y += E);
          return 7 & y && (y = 1 + (7 | y)), x;
        };
      };
    }, 4997: (s, e) => {
      var r = e;
      r.length = function(o) {
        for (var m = 0, _ = 0, g = 0; g < o.length; ++g) (_ = o.charCodeAt(g)) < 128 ? m += 1 : _ < 2048 ? m += 2 : (64512 & _) == 55296 && (64512 & o.charCodeAt(g + 1)) == 56320 ? (++g, m += 4) : m += 3;
        return m;
      }, r.read = function(o, m, _) {
        if (_ - m < 1) return "";
        for (var g, y = null, E = [], x = 0; m < _; ) (g = o[m++]) < 128 ? E[x++] = g : g > 191 && g < 224 ? E[x++] = (31 & g) << 6 | 63 & o[m++] : g > 239 && g < 365 ? (g = ((7 & g) << 18 | (63 & o[m++]) << 12 | (63 & o[m++]) << 6 | 63 & o[m++]) - 65536, E[x++] = 55296 + (g >> 10), E[x++] = 56320 + (1023 & g)) : E[x++] = (15 & g) << 12 | (63 & o[m++]) << 6 | 63 & o[m++], x > 8191 && ((y || (y = [])).push(String.fromCharCode.apply(String, E)), x = 0);
        return y ? (x && y.push(String.fromCharCode.apply(String, E.slice(0, x))), y.join("")) : String.fromCharCode.apply(String, E.slice(0, x));
      }, r.write = function(o, m, _) {
        for (var g, y, E = _, x = 0; x < o.length; ++x) (g = o.charCodeAt(x)) < 128 ? m[_++] = g : g < 2048 ? (m[_++] = g >> 6 | 192, m[_++] = 63 & g | 128) : (64512 & g) == 55296 && (64512 & (y = o.charCodeAt(x + 1))) == 56320 ? (g = 65536 + ((1023 & g) << 10) + (1023 & y), ++x, m[_++] = g >> 18 | 240, m[_++] = g >> 12 & 63 | 128, m[_++] = g >> 6 & 63 | 128, m[_++] = 63 & g | 128) : (m[_++] = g >> 12 | 224, m[_++] = g >> 6 & 63 | 128, m[_++] = 63 & g | 128);
        return _ - E;
      };
    }, 3442: (s, e) => {
      e.__esModule = !0;
      var r = function() {
        function o(m) {
          if (!m) throw new TypeError("Invalid argument; `value` has no value.");
          this.value = o.EMPTY, m && o.isGuid(m) && (this.value = m);
        }
        return o.isGuid = function(m) {
          var _ = m.toString();
          return m && (m instanceof o || o.validator.test(_));
        }, o.create = function() {
          return new o([o.gen(2), o.gen(1), o.gen(1), o.gen(1), o.gen(3)].join("-"));
        }, o.createEmpty = function() {
          return new o("emptyguid");
        }, o.parse = function(m) {
          return new o(m);
        }, o.raw = function() {
          return [o.gen(2), o.gen(1), o.gen(1), o.gen(1), o.gen(3)].join("-");
        }, o.gen = function(m) {
          for (var _ = "", g = 0; g < m; g++) _ += (65536 * (1 + Math.random()) | 0).toString(16).substring(1);
          return _;
        }, o.prototype.equals = function(m) {
          return o.isGuid(m) && this.value === m.toString();
        }, o.prototype.isEmpty = function() {
          return this.value === o.EMPTY;
        }, o.prototype.toString = function() {
          return this.value;
        }, o.prototype.toJSON = function() {
          return { value: this.value };
        }, o.validator = new RegExp("^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$", "i"), o.EMPTY = "00000000-0000-0000-0000-000000000000", o;
      }();
      e.Guid = r;
    }, 3720: (s) => {
      s.exports = r;
      var e = null;
      try {
        e = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11])), {}).exports;
      } catch {
      }
      function r(F, B, G) {
        this.low = 0 | F, this.high = 0 | B, this.unsigned = !!G;
      }
      function o(F) {
        return (F && F.__isLong__) === !0;
      }
      r.prototype.__isLong__, Object.defineProperty(r.prototype, "__isLong__", { value: !0 }), r.isLong = o;
      var m = {}, _ = {};
      function g(F, B) {
        var G, Q, ee;
        return B ? (ee = 0 <= (F >>>= 0) && F < 256) && (Q = _[F]) ? Q : (G = E(F, (0 | F) < 0 ? -1 : 0, !0), ee && (_[F] = G), G) : (ee = -128 <= (F |= 0) && F < 128) && (Q = m[F]) ? Q : (G = E(F, F < 0 ? -1 : 0, !1), ee && (m[F] = G), G);
      }
      function y(F, B) {
        if (isNaN(F)) return B ? M : A;
        if (B) {
          if (F < 0) return M;
          if (F >= b) return I;
        } else {
          if (F <= -w) return N;
          if (F + 1 >= w) return P;
        }
        return F < 0 ? y(-F, B).neg() : E(F % a | 0, F / a | 0, B);
      }
      function E(F, B, G) {
        return new r(F, B, G);
      }
      r.fromInt = g, r.fromNumber = y, r.fromBits = E;
      var x = Math.pow;
      function v(F, B, G) {
        if (F.length === 0) throw Error("empty string");
        if (F === "NaN" || F === "Infinity" || F === "+Infinity" || F === "-Infinity") return A;
        if (typeof B == "number" ? (G = B, B = !1) : B = !!B, (G = G || 10) < 2 || 36 < G) throw RangeError("radix");
        var Q;
        if ((Q = F.indexOf("-")) > 0) throw Error("interior hyphen");
        if (Q === 0) return v(F.substring(1), B, G).neg();
        for (var ee = y(x(G, 8)), Y = A, W = 0; W < F.length; W += 8) {
          var j = Math.min(8, F.length - W), J = parseInt(F.substring(W, W + j), G);
          if (j < 8) {
            var me = y(x(G, j));
            Y = Y.mul(me).add(y(J));
          } else Y = (Y = Y.mul(ee)).add(y(J));
        }
        return Y.unsigned = B, Y;
      }
      function h(F, B) {
        return typeof F == "number" ? y(F, B) : typeof F == "string" ? v(F, B) : E(F.low, F.high, typeof B == "boolean" ? B : F.unsigned);
      }
      r.fromString = v, r.fromValue = h;
      var a = 4294967296, b = a * a, w = b / 2, k = g(1 << 24), A = g(0);
      r.ZERO = A;
      var M = g(0, !0);
      r.UZERO = M;
      var $ = g(1);
      r.ONE = $;
      var O = g(1, !0);
      r.UONE = O;
      var C = g(-1);
      r.NEG_ONE = C;
      var P = E(-1, 2147483647, !1);
      r.MAX_VALUE = P;
      var I = E(-1, -1, !0);
      r.MAX_UNSIGNED_VALUE = I;
      var N = E(0, -2147483648, !1);
      r.MIN_VALUE = N;
      var R = r.prototype;
      R.toInt = function() {
        return this.unsigned ? this.low >>> 0 : this.low;
      }, R.toNumber = function() {
        return this.unsigned ? (this.high >>> 0) * a + (this.low >>> 0) : this.high * a + (this.low >>> 0);
      }, R.toString = function(F) {
        if ((F = F || 10) < 2 || 36 < F) throw RangeError("radix");
        if (this.isZero()) return "0";
        if (this.isNegative()) {
          if (this.eq(N)) {
            var B = y(F), G = this.div(B), Q = G.mul(B).sub(this);
            return G.toString(F) + Q.toInt().toString(F);
          }
          return "-" + this.neg().toString(F);
        }
        for (var ee = y(x(F, 6), this.unsigned), Y = this, W = ""; ; ) {
          var j = Y.div(ee), J = (Y.sub(j.mul(ee)).toInt() >>> 0).toString(F);
          if ((Y = j).isZero()) return J + W;
          for (; J.length < 6; ) J = "0" + J;
          W = "" + J + W;
        }
      }, R.getHighBits = function() {
        return this.high;
      }, R.getHighBitsUnsigned = function() {
        return this.high >>> 0;
      }, R.getLowBits = function() {
        return this.low;
      }, R.getLowBitsUnsigned = function() {
        return this.low >>> 0;
      }, R.getNumBitsAbs = function() {
        if (this.isNegative()) return this.eq(N) ? 64 : this.neg().getNumBitsAbs();
        for (var F = this.high != 0 ? this.high : this.low, B = 31; B > 0 && !(F & 1 << B); B--) ;
        return this.high != 0 ? B + 33 : B + 1;
      }, R.isZero = function() {
        return this.high === 0 && this.low === 0;
      }, R.eqz = R.isZero, R.isNegative = function() {
        return !this.unsigned && this.high < 0;
      }, R.isPositive = function() {
        return this.unsigned || this.high >= 0;
      }, R.isOdd = function() {
        return (1 & this.low) == 1;
      }, R.isEven = function() {
        return (1 & this.low) == 0;
      }, R.equals = function(F) {
        return o(F) || (F = h(F)), (this.unsigned === F.unsigned || this.high >>> 31 != 1 || F.high >>> 31 != 1) && this.high === F.high && this.low === F.low;
      }, R.eq = R.equals, R.notEquals = function(F) {
        return !this.eq(F);
      }, R.neq = R.notEquals, R.ne = R.notEquals, R.lessThan = function(F) {
        return this.comp(F) < 0;
      }, R.lt = R.lessThan, R.lessThanOrEqual = function(F) {
        return this.comp(F) <= 0;
      }, R.lte = R.lessThanOrEqual, R.le = R.lessThanOrEqual, R.greaterThan = function(F) {
        return this.comp(F) > 0;
      }, R.gt = R.greaterThan, R.greaterThanOrEqual = function(F) {
        return this.comp(F) >= 0;
      }, R.gte = R.greaterThanOrEqual, R.ge = R.greaterThanOrEqual, R.compare = function(F) {
        if (o(F) || (F = h(F)), this.eq(F)) return 0;
        var B = this.isNegative(), G = F.isNegative();
        return B && !G ? -1 : !B && G ? 1 : this.unsigned ? F.high >>> 0 > this.high >>> 0 || F.high === this.high && F.low >>> 0 > this.low >>> 0 ? -1 : 1 : this.sub(F).isNegative() ? -1 : 1;
      }, R.comp = R.compare, R.negate = function() {
        return !this.unsigned && this.eq(N) ? N : this.not().add($);
      }, R.neg = R.negate, R.add = function(F) {
        o(F) || (F = h(F));
        var B = this.high >>> 16, G = 65535 & this.high, Q = this.low >>> 16, ee = 65535 & this.low, Y = F.high >>> 16, W = 65535 & F.high, j = F.low >>> 16, J = 0, me = 0, pe = 0, ye = 0;
        return pe += (ye += ee + (65535 & F.low)) >>> 16, me += (pe += Q + j) >>> 16, J += (me += G + W) >>> 16, J += B + Y, E((pe &= 65535) << 16 | (ye &= 65535), (J &= 65535) << 16 | (me &= 65535), this.unsigned);
      }, R.subtract = function(F) {
        return o(F) || (F = h(F)), this.add(F.neg());
      }, R.sub = R.subtract, R.multiply = function(F) {
        if (this.isZero()) return A;
        if (o(F) || (F = h(F)), e) return E(e.mul(this.low, this.high, F.low, F.high), e.get_high(), this.unsigned);
        if (F.isZero()) return A;
        if (this.eq(N)) return F.isOdd() ? N : A;
        if (F.eq(N)) return this.isOdd() ? N : A;
        if (this.isNegative()) return F.isNegative() ? this.neg().mul(F.neg()) : this.neg().mul(F).neg();
        if (F.isNegative()) return this.mul(F.neg()).neg();
        if (this.lt(k) && F.lt(k)) return y(this.toNumber() * F.toNumber(), this.unsigned);
        var B = this.high >>> 16, G = 65535 & this.high, Q = this.low >>> 16, ee = 65535 & this.low, Y = F.high >>> 16, W = 65535 & F.high, j = F.low >>> 16, J = 65535 & F.low, me = 0, pe = 0, ye = 0, oe = 0;
        return ye += (oe += ee * J) >>> 16, pe += (ye += Q * J) >>> 16, ye &= 65535, pe += (ye += ee * j) >>> 16, me += (pe += G * J) >>> 16, pe &= 65535, me += (pe += Q * j) >>> 16, pe &= 65535, me += (pe += ee * W) >>> 16, me += B * J + G * j + Q * W + ee * Y, E((ye &= 65535) << 16 | (oe &= 65535), (me &= 65535) << 16 | (pe &= 65535), this.unsigned);
      }, R.mul = R.multiply, R.divide = function(F) {
        if (o(F) || (F = h(F)), F.isZero()) throw Error("division by zero");
        var B, G, Q;
        if (e) return this.unsigned || this.high !== -2147483648 || F.low !== -1 || F.high !== -1 ? E((this.unsigned ? e.div_u : e.div_s)(this.low, this.high, F.low, F.high), e.get_high(), this.unsigned) : this;
        if (this.isZero()) return this.unsigned ? M : A;
        if (this.unsigned) {
          if (F.unsigned || (F = F.toUnsigned()), F.gt(this)) return M;
          if (F.gt(this.shru(1))) return O;
          Q = M;
        } else {
          if (this.eq(N)) return F.eq($) || F.eq(C) ? N : F.eq(N) ? $ : (B = this.shr(1).div(F).shl(1)).eq(A) ? F.isNegative() ? $ : C : (G = this.sub(F.mul(B)), Q = B.add(G.div(F)));
          if (F.eq(N)) return this.unsigned ? M : A;
          if (this.isNegative()) return F.isNegative() ? this.neg().div(F.neg()) : this.neg().div(F).neg();
          if (F.isNegative()) return this.div(F.neg()).neg();
          Q = A;
        }
        for (G = this; G.gte(F); ) {
          B = Math.max(1, Math.floor(G.toNumber() / F.toNumber()));
          for (var ee = Math.ceil(Math.log(B) / Math.LN2), Y = ee <= 48 ? 1 : x(2, ee - 48), W = y(B), j = W.mul(F); j.isNegative() || j.gt(G); ) j = (W = y(B -= Y, this.unsigned)).mul(F);
          W.isZero() && (W = $), Q = Q.add(W), G = G.sub(j);
        }
        return Q;
      }, R.div = R.divide, R.modulo = function(F) {
        return o(F) || (F = h(F)), e ? E((this.unsigned ? e.rem_u : e.rem_s)(this.low, this.high, F.low, F.high), e.get_high(), this.unsigned) : this.sub(this.div(F).mul(F));
      }, R.mod = R.modulo, R.rem = R.modulo, R.not = function() {
        return E(~this.low, ~this.high, this.unsigned);
      }, R.and = function(F) {
        return o(F) || (F = h(F)), E(this.low & F.low, this.high & F.high, this.unsigned);
      }, R.or = function(F) {
        return o(F) || (F = h(F)), E(this.low | F.low, this.high | F.high, this.unsigned);
      }, R.xor = function(F) {
        return o(F) || (F = h(F)), E(this.low ^ F.low, this.high ^ F.high, this.unsigned);
      }, R.shiftLeft = function(F) {
        return o(F) && (F = F.toInt()), (F &= 63) == 0 ? this : F < 32 ? E(this.low << F, this.high << F | this.low >>> 32 - F, this.unsigned) : E(0, this.low << F - 32, this.unsigned);
      }, R.shl = R.shiftLeft, R.shiftRight = function(F) {
        return o(F) && (F = F.toInt()), (F &= 63) == 0 ? this : F < 32 ? E(this.low >>> F | this.high << 32 - F, this.high >> F, this.unsigned) : E(this.high >> F - 32, this.high >= 0 ? 0 : -1, this.unsigned);
      }, R.shr = R.shiftRight, R.shiftRightUnsigned = function(F) {
        if (o(F) && (F = F.toInt()), (F &= 63) == 0) return this;
        var B = this.high;
        return F < 32 ? E(this.low >>> F | B << 32 - F, B >>> F, this.unsigned) : E(F === 32 ? B : B >>> F - 32, 0, this.unsigned);
      }, R.shru = R.shiftRightUnsigned, R.shr_u = R.shiftRightUnsigned, R.toSigned = function() {
        return this.unsigned ? E(this.low, this.high, !1) : this;
      }, R.toUnsigned = function() {
        return this.unsigned ? this : E(this.low, this.high, !0);
      }, R.toBytes = function(F) {
        return F ? this.toBytesLE() : this.toBytesBE();
      }, R.toBytesLE = function() {
        var F = this.high, B = this.low;
        return [255 & B, B >>> 8 & 255, B >>> 16 & 255, B >>> 24, 255 & F, F >>> 8 & 255, F >>> 16 & 255, F >>> 24];
      }, R.toBytesBE = function() {
        var F = this.high, B = this.low;
        return [F >>> 24, F >>> 16 & 255, F >>> 8 & 255, 255 & F, B >>> 24, B >>> 16 & 255, B >>> 8 & 255, 255 & B];
      }, r.fromBytes = function(F, B, G) {
        return G ? r.fromBytesLE(F, B) : r.fromBytesBE(F, B);
      }, r.fromBytesLE = function(F, B) {
        return new r(F[0] | F[1] << 8 | F[2] << 16 | F[3] << 24, F[4] | F[5] << 8 | F[6] << 16 | F[7] << 24, B);
      }, r.fromBytesBE = function(F, B) {
        return new r(F[4] << 24 | F[5] << 16 | F[6] << 8 | F[7], F[0] << 24 | F[1] << 16 | F[2] << 8 | F[3], B);
      };
    }, 1446: (s, e, r) => {
      var o, m, _, g = r(2100), y = g.Reader, E = g.Writer, x = g.util, v = g.roots.default || (g.roots.default = {});
      v.onnx = ((_ = {}).Version = (o = {}, (m = Object.create(o))[o[0] = "_START_VERSION"] = 0, m[o[1] = "IR_VERSION_2017_10_10"] = 1, m[o[2] = "IR_VERSION_2017_10_30"] = 2, m[o[3] = "IR_VERSION_2017_11_3"] = 3, m[o[4] = "IR_VERSION_2019_1_22"] = 4, m[o[5] = "IR_VERSION"] = 5, m), _.AttributeProto = function() {
        function h(a) {
          if (this.floats = [], this.ints = [], this.strings = [], this.tensors = [], this.graphs = [], a) for (var b = Object.keys(a), w = 0; w < b.length; ++w) a[b[w]] != null && (this[b[w]] = a[b[w]]);
        }
        return h.prototype.name = "", h.prototype.refAttrName = "", h.prototype.docString = "", h.prototype.type = 0, h.prototype.f = 0, h.prototype.i = x.Long ? x.Long.fromBits(0, 0, !1) : 0, h.prototype.s = x.newBuffer([]), h.prototype.t = null, h.prototype.g = null, h.prototype.floats = x.emptyArray, h.prototype.ints = x.emptyArray, h.prototype.strings = x.emptyArray, h.prototype.tensors = x.emptyArray, h.prototype.graphs = x.emptyArray, h.create = function(a) {
          return new h(a);
        }, h.encode = function(a, b) {
          if (b || (b = E.create()), a.name != null && a.hasOwnProperty("name") && b.uint32(10).string(a.name), a.f != null && a.hasOwnProperty("f") && b.uint32(21).float(a.f), a.i != null && a.hasOwnProperty("i") && b.uint32(24).int64(a.i), a.s != null && a.hasOwnProperty("s") && b.uint32(34).bytes(a.s), a.t != null && a.hasOwnProperty("t") && v.onnx.TensorProto.encode(a.t, b.uint32(42).fork()).ldelim(), a.g != null && a.hasOwnProperty("g") && v.onnx.GraphProto.encode(a.g, b.uint32(50).fork()).ldelim(), a.floats != null && a.floats.length) {
            b.uint32(58).fork();
            for (var w = 0; w < a.floats.length; ++w) b.float(a.floats[w]);
            b.ldelim();
          }
          if (a.ints != null && a.ints.length) {
            for (b.uint32(66).fork(), w = 0; w < a.ints.length; ++w) b.int64(a.ints[w]);
            b.ldelim();
          }
          if (a.strings != null && a.strings.length) for (w = 0; w < a.strings.length; ++w) b.uint32(74).bytes(a.strings[w]);
          if (a.tensors != null && a.tensors.length) for (w = 0; w < a.tensors.length; ++w) v.onnx.TensorProto.encode(a.tensors[w], b.uint32(82).fork()).ldelim();
          if (a.graphs != null && a.graphs.length) for (w = 0; w < a.graphs.length; ++w) v.onnx.GraphProto.encode(a.graphs[w], b.uint32(90).fork()).ldelim();
          return a.docString != null && a.hasOwnProperty("docString") && b.uint32(106).string(a.docString), a.type != null && a.hasOwnProperty("type") && b.uint32(160).int32(a.type), a.refAttrName != null && a.hasOwnProperty("refAttrName") && b.uint32(170).string(a.refAttrName), b;
        }, h.encodeDelimited = function(a, b) {
          return this.encode(a, b).ldelim();
        }, h.decode = function(a, b) {
          a instanceof y || (a = y.create(a));
          for (var w = b === void 0 ? a.len : a.pos + b, k = new v.onnx.AttributeProto(); a.pos < w; ) {
            var A = a.uint32();
            switch (A >>> 3) {
              case 1:
                k.name = a.string();
                break;
              case 21:
                k.refAttrName = a.string();
                break;
              case 13:
                k.docString = a.string();
                break;
              case 20:
                k.type = a.int32();
                break;
              case 2:
                k.f = a.float();
                break;
              case 3:
                k.i = a.int64();
                break;
              case 4:
                k.s = a.bytes();
                break;
              case 5:
                k.t = v.onnx.TensorProto.decode(a, a.uint32());
                break;
              case 6:
                k.g = v.onnx.GraphProto.decode(a, a.uint32());
                break;
              case 7:
                if (k.floats && k.floats.length || (k.floats = []), (7 & A) == 2) for (var M = a.uint32() + a.pos; a.pos < M; ) k.floats.push(a.float());
                else k.floats.push(a.float());
                break;
              case 8:
                if (k.ints && k.ints.length || (k.ints = []), (7 & A) == 2) for (M = a.uint32() + a.pos; a.pos < M; ) k.ints.push(a.int64());
                else k.ints.push(a.int64());
                break;
              case 9:
                k.strings && k.strings.length || (k.strings = []), k.strings.push(a.bytes());
                break;
              case 10:
                k.tensors && k.tensors.length || (k.tensors = []), k.tensors.push(v.onnx.TensorProto.decode(a, a.uint32()));
                break;
              case 11:
                k.graphs && k.graphs.length || (k.graphs = []), k.graphs.push(v.onnx.GraphProto.decode(a, a.uint32()));
                break;
              default:
                a.skipType(7 & A);
            }
          }
          return k;
        }, h.decodeDelimited = function(a) {
          return a instanceof y || (a = new y(a)), this.decode(a, a.uint32());
        }, h.verify = function(a) {
          if (typeof a != "object" || a === null) return "object expected";
          if (a.name != null && a.hasOwnProperty("name") && !x.isString(a.name)) return "name: string expected";
          if (a.refAttrName != null && a.hasOwnProperty("refAttrName") && !x.isString(a.refAttrName)) return "refAttrName: string expected";
          if (a.docString != null && a.hasOwnProperty("docString") && !x.isString(a.docString)) return "docString: string expected";
          if (a.type != null && a.hasOwnProperty("type")) switch (a.type) {
            default:
              return "type: enum value expected";
            case 0:
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
            case 10:
          }
          if (a.f != null && a.hasOwnProperty("f") && typeof a.f != "number") return "f: number expected";
          if (a.i != null && a.hasOwnProperty("i") && !(x.isInteger(a.i) || a.i && x.isInteger(a.i.low) && x.isInteger(a.i.high))) return "i: integer|Long expected";
          if (a.s != null && a.hasOwnProperty("s") && !(a.s && typeof a.s.length == "number" || x.isString(a.s))) return "s: buffer expected";
          if (a.t != null && a.hasOwnProperty("t") && (w = v.onnx.TensorProto.verify(a.t))) return "t." + w;
          if (a.g != null && a.hasOwnProperty("g") && (w = v.onnx.GraphProto.verify(a.g))) return "g." + w;
          if (a.floats != null && a.hasOwnProperty("floats")) {
            if (!Array.isArray(a.floats)) return "floats: array expected";
            for (var b = 0; b < a.floats.length; ++b) if (typeof a.floats[b] != "number") return "floats: number[] expected";
          }
          if (a.ints != null && a.hasOwnProperty("ints")) {
            if (!Array.isArray(a.ints)) return "ints: array expected";
            for (b = 0; b < a.ints.length; ++b) if (!(x.isInteger(a.ints[b]) || a.ints[b] && x.isInteger(a.ints[b].low) && x.isInteger(a.ints[b].high))) return "ints: integer|Long[] expected";
          }
          if (a.strings != null && a.hasOwnProperty("strings")) {
            if (!Array.isArray(a.strings)) return "strings: array expected";
            for (b = 0; b < a.strings.length; ++b) if (!(a.strings[b] && typeof a.strings[b].length == "number" || x.isString(a.strings[b]))) return "strings: buffer[] expected";
          }
          if (a.tensors != null && a.hasOwnProperty("tensors")) {
            if (!Array.isArray(a.tensors)) return "tensors: array expected";
            for (b = 0; b < a.tensors.length; ++b) if (w = v.onnx.TensorProto.verify(a.tensors[b])) return "tensors." + w;
          }
          if (a.graphs != null && a.hasOwnProperty("graphs")) {
            if (!Array.isArray(a.graphs)) return "graphs: array expected";
            for (b = 0; b < a.graphs.length; ++b) {
              var w;
              if (w = v.onnx.GraphProto.verify(a.graphs[b])) return "graphs." + w;
            }
          }
          return null;
        }, h.fromObject = function(a) {
          if (a instanceof v.onnx.AttributeProto) return a;
          var b = new v.onnx.AttributeProto();
          switch (a.name != null && (b.name = String(a.name)), a.refAttrName != null && (b.refAttrName = String(a.refAttrName)), a.docString != null && (b.docString = String(a.docString)), a.type) {
            case "UNDEFINED":
            case 0:
              b.type = 0;
              break;
            case "FLOAT":
            case 1:
              b.type = 1;
              break;
            case "INT":
            case 2:
              b.type = 2;
              break;
            case "STRING":
            case 3:
              b.type = 3;
              break;
            case "TENSOR":
            case 4:
              b.type = 4;
              break;
            case "GRAPH":
            case 5:
              b.type = 5;
              break;
            case "FLOATS":
            case 6:
              b.type = 6;
              break;
            case "INTS":
            case 7:
              b.type = 7;
              break;
            case "STRINGS":
            case 8:
              b.type = 8;
              break;
            case "TENSORS":
            case 9:
              b.type = 9;
              break;
            case "GRAPHS":
            case 10:
              b.type = 10;
          }
          if (a.f != null && (b.f = Number(a.f)), a.i != null && (x.Long ? (b.i = x.Long.fromValue(a.i)).unsigned = !1 : typeof a.i == "string" ? b.i = parseInt(a.i, 10) : typeof a.i == "number" ? b.i = a.i : typeof a.i == "object" && (b.i = new x.LongBits(a.i.low >>> 0, a.i.high >>> 0).toNumber())), a.s != null && (typeof a.s == "string" ? x.base64.decode(a.s, b.s = x.newBuffer(x.base64.length(a.s)), 0) : a.s.length && (b.s = a.s)), a.t != null) {
            if (typeof a.t != "object") throw TypeError(".onnx.AttributeProto.t: object expected");
            b.t = v.onnx.TensorProto.fromObject(a.t);
          }
          if (a.g != null) {
            if (typeof a.g != "object") throw TypeError(".onnx.AttributeProto.g: object expected");
            b.g = v.onnx.GraphProto.fromObject(a.g);
          }
          if (a.floats) {
            if (!Array.isArray(a.floats)) throw TypeError(".onnx.AttributeProto.floats: array expected");
            b.floats = [];
            for (var w = 0; w < a.floats.length; ++w) b.floats[w] = Number(a.floats[w]);
          }
          if (a.ints) {
            if (!Array.isArray(a.ints)) throw TypeError(".onnx.AttributeProto.ints: array expected");
            for (b.ints = [], w = 0; w < a.ints.length; ++w) x.Long ? (b.ints[w] = x.Long.fromValue(a.ints[w])).unsigned = !1 : typeof a.ints[w] == "string" ? b.ints[w] = parseInt(a.ints[w], 10) : typeof a.ints[w] == "number" ? b.ints[w] = a.ints[w] : typeof a.ints[w] == "object" && (b.ints[w] = new x.LongBits(a.ints[w].low >>> 0, a.ints[w].high >>> 0).toNumber());
          }
          if (a.strings) {
            if (!Array.isArray(a.strings)) throw TypeError(".onnx.AttributeProto.strings: array expected");
            for (b.strings = [], w = 0; w < a.strings.length; ++w) typeof a.strings[w] == "string" ? x.base64.decode(a.strings[w], b.strings[w] = x.newBuffer(x.base64.length(a.strings[w])), 0) : a.strings[w].length && (b.strings[w] = a.strings[w]);
          }
          if (a.tensors) {
            if (!Array.isArray(a.tensors)) throw TypeError(".onnx.AttributeProto.tensors: array expected");
            for (b.tensors = [], w = 0; w < a.tensors.length; ++w) {
              if (typeof a.tensors[w] != "object") throw TypeError(".onnx.AttributeProto.tensors: object expected");
              b.tensors[w] = v.onnx.TensorProto.fromObject(a.tensors[w]);
            }
          }
          if (a.graphs) {
            if (!Array.isArray(a.graphs)) throw TypeError(".onnx.AttributeProto.graphs: array expected");
            for (b.graphs = [], w = 0; w < a.graphs.length; ++w) {
              if (typeof a.graphs[w] != "object") throw TypeError(".onnx.AttributeProto.graphs: object expected");
              b.graphs[w] = v.onnx.GraphProto.fromObject(a.graphs[w]);
            }
          }
          return b;
        }, h.toObject = function(a, b) {
          b || (b = {});
          var w = {};
          if ((b.arrays || b.defaults) && (w.floats = [], w.ints = [], w.strings = [], w.tensors = [], w.graphs = []), b.defaults) {
            if (w.name = "", w.f = 0, x.Long) {
              var k = new x.Long(0, 0, !1);
              w.i = b.longs === String ? k.toString() : b.longs === Number ? k.toNumber() : k;
            } else w.i = b.longs === String ? "0" : 0;
            b.bytes === String ? w.s = "" : (w.s = [], b.bytes !== Array && (w.s = x.newBuffer(w.s))), w.t = null, w.g = null, w.docString = "", w.type = b.enums === String ? "UNDEFINED" : 0, w.refAttrName = "";
          }
          if (a.name != null && a.hasOwnProperty("name") && (w.name = a.name), a.f != null && a.hasOwnProperty("f") && (w.f = b.json && !isFinite(a.f) ? String(a.f) : a.f), a.i != null && a.hasOwnProperty("i") && (typeof a.i == "number" ? w.i = b.longs === String ? String(a.i) : a.i : w.i = b.longs === String ? x.Long.prototype.toString.call(a.i) : b.longs === Number ? new x.LongBits(a.i.low >>> 0, a.i.high >>> 0).toNumber() : a.i), a.s != null && a.hasOwnProperty("s") && (w.s = b.bytes === String ? x.base64.encode(a.s, 0, a.s.length) : b.bytes === Array ? Array.prototype.slice.call(a.s) : a.s), a.t != null && a.hasOwnProperty("t") && (w.t = v.onnx.TensorProto.toObject(a.t, b)), a.g != null && a.hasOwnProperty("g") && (w.g = v.onnx.GraphProto.toObject(a.g, b)), a.floats && a.floats.length) {
            w.floats = [];
            for (var A = 0; A < a.floats.length; ++A) w.floats[A] = b.json && !isFinite(a.floats[A]) ? String(a.floats[A]) : a.floats[A];
          }
          if (a.ints && a.ints.length) for (w.ints = [], A = 0; A < a.ints.length; ++A) typeof a.ints[A] == "number" ? w.ints[A] = b.longs === String ? String(a.ints[A]) : a.ints[A] : w.ints[A] = b.longs === String ? x.Long.prototype.toString.call(a.ints[A]) : b.longs === Number ? new x.LongBits(a.ints[A].low >>> 0, a.ints[A].high >>> 0).toNumber() : a.ints[A];
          if (a.strings && a.strings.length) for (w.strings = [], A = 0; A < a.strings.length; ++A) w.strings[A] = b.bytes === String ? x.base64.encode(a.strings[A], 0, a.strings[A].length) : b.bytes === Array ? Array.prototype.slice.call(a.strings[A]) : a.strings[A];
          if (a.tensors && a.tensors.length) for (w.tensors = [], A = 0; A < a.tensors.length; ++A) w.tensors[A] = v.onnx.TensorProto.toObject(a.tensors[A], b);
          if (a.graphs && a.graphs.length) for (w.graphs = [], A = 0; A < a.graphs.length; ++A) w.graphs[A] = v.onnx.GraphProto.toObject(a.graphs[A], b);
          return a.docString != null && a.hasOwnProperty("docString") && (w.docString = a.docString), a.type != null && a.hasOwnProperty("type") && (w.type = b.enums === String ? v.onnx.AttributeProto.AttributeType[a.type] : a.type), a.refAttrName != null && a.hasOwnProperty("refAttrName") && (w.refAttrName = a.refAttrName), w;
        }, h.prototype.toJSON = function() {
          return this.constructor.toObject(this, g.util.toJSONOptions);
        }, h.AttributeType = function() {
          var a = {}, b = Object.create(a);
          return b[a[0] = "UNDEFINED"] = 0, b[a[1] = "FLOAT"] = 1, b[a[2] = "INT"] = 2, b[a[3] = "STRING"] = 3, b[a[4] = "TENSOR"] = 4, b[a[5] = "GRAPH"] = 5, b[a[6] = "FLOATS"] = 6, b[a[7] = "INTS"] = 7, b[a[8] = "STRINGS"] = 8, b[a[9] = "TENSORS"] = 9, b[a[10] = "GRAPHS"] = 10, b;
        }(), h;
      }(), _.ValueInfoProto = function() {
        function h(a) {
          if (a) for (var b = Object.keys(a), w = 0; w < b.length; ++w) a[b[w]] != null && (this[b[w]] = a[b[w]]);
        }
        return h.prototype.name = "", h.prototype.type = null, h.prototype.docString = "", h.create = function(a) {
          return new h(a);
        }, h.encode = function(a, b) {
          return b || (b = E.create()), a.name != null && a.hasOwnProperty("name") && b.uint32(10).string(a.name), a.type != null && a.hasOwnProperty("type") && v.onnx.TypeProto.encode(a.type, b.uint32(18).fork()).ldelim(), a.docString != null && a.hasOwnProperty("docString") && b.uint32(26).string(a.docString), b;
        }, h.encodeDelimited = function(a, b) {
          return this.encode(a, b).ldelim();
        }, h.decode = function(a, b) {
          a instanceof y || (a = y.create(a));
          for (var w = b === void 0 ? a.len : a.pos + b, k = new v.onnx.ValueInfoProto(); a.pos < w; ) {
            var A = a.uint32();
            switch (A >>> 3) {
              case 1:
                k.name = a.string();
                break;
              case 2:
                k.type = v.onnx.TypeProto.decode(a, a.uint32());
                break;
              case 3:
                k.docString = a.string();
                break;
              default:
                a.skipType(7 & A);
            }
          }
          return k;
        }, h.decodeDelimited = function(a) {
          return a instanceof y || (a = new y(a)), this.decode(a, a.uint32());
        }, h.verify = function(a) {
          if (typeof a != "object" || a === null) return "object expected";
          if (a.name != null && a.hasOwnProperty("name") && !x.isString(a.name)) return "name: string expected";
          if (a.type != null && a.hasOwnProperty("type")) {
            var b = v.onnx.TypeProto.verify(a.type);
            if (b) return "type." + b;
          }
          return a.docString != null && a.hasOwnProperty("docString") && !x.isString(a.docString) ? "docString: string expected" : null;
        }, h.fromObject = function(a) {
          if (a instanceof v.onnx.ValueInfoProto) return a;
          var b = new v.onnx.ValueInfoProto();
          if (a.name != null && (b.name = String(a.name)), a.type != null) {
            if (typeof a.type != "object") throw TypeError(".onnx.ValueInfoProto.type: object expected");
            b.type = v.onnx.TypeProto.fromObject(a.type);
          }
          return a.docString != null && (b.docString = String(a.docString)), b;
        }, h.toObject = function(a, b) {
          b || (b = {});
          var w = {};
          return b.defaults && (w.name = "", w.type = null, w.docString = ""), a.name != null && a.hasOwnProperty("name") && (w.name = a.name), a.type != null && a.hasOwnProperty("type") && (w.type = v.onnx.TypeProto.toObject(a.type, b)), a.docString != null && a.hasOwnProperty("docString") && (w.docString = a.docString), w;
        }, h.prototype.toJSON = function() {
          return this.constructor.toObject(this, g.util.toJSONOptions);
        }, h;
      }(), _.NodeProto = function() {
        function h(a) {
          if (this.input = [], this.output = [], this.attribute = [], a) for (var b = Object.keys(a), w = 0; w < b.length; ++w) a[b[w]] != null && (this[b[w]] = a[b[w]]);
        }
        return h.prototype.input = x.emptyArray, h.prototype.output = x.emptyArray, h.prototype.name = "", h.prototype.opType = "", h.prototype.domain = "", h.prototype.attribute = x.emptyArray, h.prototype.docString = "", h.create = function(a) {
          return new h(a);
        }, h.encode = function(a, b) {
          if (b || (b = E.create()), a.input != null && a.input.length) for (var w = 0; w < a.input.length; ++w) b.uint32(10).string(a.input[w]);
          if (a.output != null && a.output.length) for (w = 0; w < a.output.length; ++w) b.uint32(18).string(a.output[w]);
          if (a.name != null && a.hasOwnProperty("name") && b.uint32(26).string(a.name), a.opType != null && a.hasOwnProperty("opType") && b.uint32(34).string(a.opType), a.attribute != null && a.attribute.length) for (w = 0; w < a.attribute.length; ++w) v.onnx.AttributeProto.encode(a.attribute[w], b.uint32(42).fork()).ldelim();
          return a.docString != null && a.hasOwnProperty("docString") && b.uint32(50).string(a.docString), a.domain != null && a.hasOwnProperty("domain") && b.uint32(58).string(a.domain), b;
        }, h.encodeDelimited = function(a, b) {
          return this.encode(a, b).ldelim();
        }, h.decode = function(a, b) {
          a instanceof y || (a = y.create(a));
          for (var w = b === void 0 ? a.len : a.pos + b, k = new v.onnx.NodeProto(); a.pos < w; ) {
            var A = a.uint32();
            switch (A >>> 3) {
              case 1:
                k.input && k.input.length || (k.input = []), k.input.push(a.string());
                break;
              case 2:
                k.output && k.output.length || (k.output = []), k.output.push(a.string());
                break;
              case 3:
                k.name = a.string();
                break;
              case 4:
                k.opType = a.string();
                break;
              case 7:
                k.domain = a.string();
                break;
              case 5:
                k.attribute && k.attribute.length || (k.attribute = []), k.attribute.push(v.onnx.AttributeProto.decode(a, a.uint32()));
                break;
              case 6:
                k.docString = a.string();
                break;
              default:
                a.skipType(7 & A);
            }
          }
          return k;
        }, h.decodeDelimited = function(a) {
          return a instanceof y || (a = new y(a)), this.decode(a, a.uint32());
        }, h.verify = function(a) {
          if (typeof a != "object" || a === null) return "object expected";
          if (a.input != null && a.hasOwnProperty("input")) {
            if (!Array.isArray(a.input)) return "input: array expected";
            for (var b = 0; b < a.input.length; ++b) if (!x.isString(a.input[b])) return "input: string[] expected";
          }
          if (a.output != null && a.hasOwnProperty("output")) {
            if (!Array.isArray(a.output)) return "output: array expected";
            for (b = 0; b < a.output.length; ++b) if (!x.isString(a.output[b])) return "output: string[] expected";
          }
          if (a.name != null && a.hasOwnProperty("name") && !x.isString(a.name)) return "name: string expected";
          if (a.opType != null && a.hasOwnProperty("opType") && !x.isString(a.opType)) return "opType: string expected";
          if (a.domain != null && a.hasOwnProperty("domain") && !x.isString(a.domain)) return "domain: string expected";
          if (a.attribute != null && a.hasOwnProperty("attribute")) {
            if (!Array.isArray(a.attribute)) return "attribute: array expected";
            for (b = 0; b < a.attribute.length; ++b) {
              var w = v.onnx.AttributeProto.verify(a.attribute[b]);
              if (w) return "attribute." + w;
            }
          }
          return a.docString != null && a.hasOwnProperty("docString") && !x.isString(a.docString) ? "docString: string expected" : null;
        }, h.fromObject = function(a) {
          if (a instanceof v.onnx.NodeProto) return a;
          var b = new v.onnx.NodeProto();
          if (a.input) {
            if (!Array.isArray(a.input)) throw TypeError(".onnx.NodeProto.input: array expected");
            b.input = [];
            for (var w = 0; w < a.input.length; ++w) b.input[w] = String(a.input[w]);
          }
          if (a.output) {
            if (!Array.isArray(a.output)) throw TypeError(".onnx.NodeProto.output: array expected");
            for (b.output = [], w = 0; w < a.output.length; ++w) b.output[w] = String(a.output[w]);
          }
          if (a.name != null && (b.name = String(a.name)), a.opType != null && (b.opType = String(a.opType)), a.domain != null && (b.domain = String(a.domain)), a.attribute) {
            if (!Array.isArray(a.attribute)) throw TypeError(".onnx.NodeProto.attribute: array expected");
            for (b.attribute = [], w = 0; w < a.attribute.length; ++w) {
              if (typeof a.attribute[w] != "object") throw TypeError(".onnx.NodeProto.attribute: object expected");
              b.attribute[w] = v.onnx.AttributeProto.fromObject(a.attribute[w]);
            }
          }
          return a.docString != null && (b.docString = String(a.docString)), b;
        }, h.toObject = function(a, b) {
          b || (b = {});
          var w = {};
          if ((b.arrays || b.defaults) && (w.input = [], w.output = [], w.attribute = []), b.defaults && (w.name = "", w.opType = "", w.docString = "", w.domain = ""), a.input && a.input.length) {
            w.input = [];
            for (var k = 0; k < a.input.length; ++k) w.input[k] = a.input[k];
          }
          if (a.output && a.output.length) for (w.output = [], k = 0; k < a.output.length; ++k) w.output[k] = a.output[k];
          if (a.name != null && a.hasOwnProperty("name") && (w.name = a.name), a.opType != null && a.hasOwnProperty("opType") && (w.opType = a.opType), a.attribute && a.attribute.length) for (w.attribute = [], k = 0; k < a.attribute.length; ++k) w.attribute[k] = v.onnx.AttributeProto.toObject(a.attribute[k], b);
          return a.docString != null && a.hasOwnProperty("docString") && (w.docString = a.docString), a.domain != null && a.hasOwnProperty("domain") && (w.domain = a.domain), w;
        }, h.prototype.toJSON = function() {
          return this.constructor.toObject(this, g.util.toJSONOptions);
        }, h;
      }(), _.ModelProto = function() {
        function h(a) {
          if (this.opsetImport = [], this.metadataProps = [], a) for (var b = Object.keys(a), w = 0; w < b.length; ++w) a[b[w]] != null && (this[b[w]] = a[b[w]]);
        }
        return h.prototype.irVersion = x.Long ? x.Long.fromBits(0, 0, !1) : 0, h.prototype.opsetImport = x.emptyArray, h.prototype.producerName = "", h.prototype.producerVersion = "", h.prototype.domain = "", h.prototype.modelVersion = x.Long ? x.Long.fromBits(0, 0, !1) : 0, h.prototype.docString = "", h.prototype.graph = null, h.prototype.metadataProps = x.emptyArray, h.create = function(a) {
          return new h(a);
        }, h.encode = function(a, b) {
          if (b || (b = E.create()), a.irVersion != null && a.hasOwnProperty("irVersion") && b.uint32(8).int64(a.irVersion), a.producerName != null && a.hasOwnProperty("producerName") && b.uint32(18).string(a.producerName), a.producerVersion != null && a.hasOwnProperty("producerVersion") && b.uint32(26).string(a.producerVersion), a.domain != null && a.hasOwnProperty("domain") && b.uint32(34).string(a.domain), a.modelVersion != null && a.hasOwnProperty("modelVersion") && b.uint32(40).int64(a.modelVersion), a.docString != null && a.hasOwnProperty("docString") && b.uint32(50).string(a.docString), a.graph != null && a.hasOwnProperty("graph") && v.onnx.GraphProto.encode(a.graph, b.uint32(58).fork()).ldelim(), a.opsetImport != null && a.opsetImport.length) for (var w = 0; w < a.opsetImport.length; ++w) v.onnx.OperatorSetIdProto.encode(a.opsetImport[w], b.uint32(66).fork()).ldelim();
          if (a.metadataProps != null && a.metadataProps.length) for (w = 0; w < a.metadataProps.length; ++w) v.onnx.StringStringEntryProto.encode(a.metadataProps[w], b.uint32(114).fork()).ldelim();
          return b;
        }, h.encodeDelimited = function(a, b) {
          return this.encode(a, b).ldelim();
        }, h.decode = function(a, b) {
          a instanceof y || (a = y.create(a));
          for (var w = b === void 0 ? a.len : a.pos + b, k = new v.onnx.ModelProto(); a.pos < w; ) {
            var A = a.uint32();
            switch (A >>> 3) {
              case 1:
                k.irVersion = a.int64();
                break;
              case 8:
                k.opsetImport && k.opsetImport.length || (k.opsetImport = []), k.opsetImport.push(v.onnx.OperatorSetIdProto.decode(a, a.uint32()));
                break;
              case 2:
                k.producerName = a.string();
                break;
              case 3:
                k.producerVersion = a.string();
                break;
              case 4:
                k.domain = a.string();
                break;
              case 5:
                k.modelVersion = a.int64();
                break;
              case 6:
                k.docString = a.string();
                break;
              case 7:
                k.graph = v.onnx.GraphProto.decode(a, a.uint32());
                break;
              case 14:
                k.metadataProps && k.metadataProps.length || (k.metadataProps = []), k.metadataProps.push(v.onnx.StringStringEntryProto.decode(a, a.uint32()));
                break;
              default:
                a.skipType(7 & A);
            }
          }
          return k;
        }, h.decodeDelimited = function(a) {
          return a instanceof y || (a = new y(a)), this.decode(a, a.uint32());
        }, h.verify = function(a) {
          if (typeof a != "object" || a === null) return "object expected";
          if (a.irVersion != null && a.hasOwnProperty("irVersion") && !(x.isInteger(a.irVersion) || a.irVersion && x.isInteger(a.irVersion.low) && x.isInteger(a.irVersion.high))) return "irVersion: integer|Long expected";
          if (a.opsetImport != null && a.hasOwnProperty("opsetImport")) {
            if (!Array.isArray(a.opsetImport)) return "opsetImport: array expected";
            for (var b = 0; b < a.opsetImport.length; ++b) if (w = v.onnx.OperatorSetIdProto.verify(a.opsetImport[b])) return "opsetImport." + w;
          }
          if (a.producerName != null && a.hasOwnProperty("producerName") && !x.isString(a.producerName)) return "producerName: string expected";
          if (a.producerVersion != null && a.hasOwnProperty("producerVersion") && !x.isString(a.producerVersion)) return "producerVersion: string expected";
          if (a.domain != null && a.hasOwnProperty("domain") && !x.isString(a.domain)) return "domain: string expected";
          if (a.modelVersion != null && a.hasOwnProperty("modelVersion") && !(x.isInteger(a.modelVersion) || a.modelVersion && x.isInteger(a.modelVersion.low) && x.isInteger(a.modelVersion.high))) return "modelVersion: integer|Long expected";
          if (a.docString != null && a.hasOwnProperty("docString") && !x.isString(a.docString)) return "docString: string expected";
          if (a.graph != null && a.hasOwnProperty("graph") && (w = v.onnx.GraphProto.verify(a.graph))) return "graph." + w;
          if (a.metadataProps != null && a.hasOwnProperty("metadataProps")) {
            if (!Array.isArray(a.metadataProps)) return "metadataProps: array expected";
            for (b = 0; b < a.metadataProps.length; ++b) {
              var w;
              if (w = v.onnx.StringStringEntryProto.verify(a.metadataProps[b])) return "metadataProps." + w;
            }
          }
          return null;
        }, h.fromObject = function(a) {
          if (a instanceof v.onnx.ModelProto) return a;
          var b = new v.onnx.ModelProto();
          if (a.irVersion != null && (x.Long ? (b.irVersion = x.Long.fromValue(a.irVersion)).unsigned = !1 : typeof a.irVersion == "string" ? b.irVersion = parseInt(a.irVersion, 10) : typeof a.irVersion == "number" ? b.irVersion = a.irVersion : typeof a.irVersion == "object" && (b.irVersion = new x.LongBits(a.irVersion.low >>> 0, a.irVersion.high >>> 0).toNumber())), a.opsetImport) {
            if (!Array.isArray(a.opsetImport)) throw TypeError(".onnx.ModelProto.opsetImport: array expected");
            b.opsetImport = [];
            for (var w = 0; w < a.opsetImport.length; ++w) {
              if (typeof a.opsetImport[w] != "object") throw TypeError(".onnx.ModelProto.opsetImport: object expected");
              b.opsetImport[w] = v.onnx.OperatorSetIdProto.fromObject(a.opsetImport[w]);
            }
          }
          if (a.producerName != null && (b.producerName = String(a.producerName)), a.producerVersion != null && (b.producerVersion = String(a.producerVersion)), a.domain != null && (b.domain = String(a.domain)), a.modelVersion != null && (x.Long ? (b.modelVersion = x.Long.fromValue(a.modelVersion)).unsigned = !1 : typeof a.modelVersion == "string" ? b.modelVersion = parseInt(a.modelVersion, 10) : typeof a.modelVersion == "number" ? b.modelVersion = a.modelVersion : typeof a.modelVersion == "object" && (b.modelVersion = new x.LongBits(a.modelVersion.low >>> 0, a.modelVersion.high >>> 0).toNumber())), a.docString != null && (b.docString = String(a.docString)), a.graph != null) {
            if (typeof a.graph != "object") throw TypeError(".onnx.ModelProto.graph: object expected");
            b.graph = v.onnx.GraphProto.fromObject(a.graph);
          }
          if (a.metadataProps) {
            if (!Array.isArray(a.metadataProps)) throw TypeError(".onnx.ModelProto.metadataProps: array expected");
            for (b.metadataProps = [], w = 0; w < a.metadataProps.length; ++w) {
              if (typeof a.metadataProps[w] != "object") throw TypeError(".onnx.ModelProto.metadataProps: object expected");
              b.metadataProps[w] = v.onnx.StringStringEntryProto.fromObject(a.metadataProps[w]);
            }
          }
          return b;
        }, h.toObject = function(a, b) {
          b || (b = {});
          var w = {};
          if ((b.arrays || b.defaults) && (w.opsetImport = [], w.metadataProps = []), b.defaults) {
            if (x.Long) {
              var k = new x.Long(0, 0, !1);
              w.irVersion = b.longs === String ? k.toString() : b.longs === Number ? k.toNumber() : k;
            } else w.irVersion = b.longs === String ? "0" : 0;
            w.producerName = "", w.producerVersion = "", w.domain = "", x.Long ? (k = new x.Long(0, 0, !1), w.modelVersion = b.longs === String ? k.toString() : b.longs === Number ? k.toNumber() : k) : w.modelVersion = b.longs === String ? "0" : 0, w.docString = "", w.graph = null;
          }
          if (a.irVersion != null && a.hasOwnProperty("irVersion") && (typeof a.irVersion == "number" ? w.irVersion = b.longs === String ? String(a.irVersion) : a.irVersion : w.irVersion = b.longs === String ? x.Long.prototype.toString.call(a.irVersion) : b.longs === Number ? new x.LongBits(a.irVersion.low >>> 0, a.irVersion.high >>> 0).toNumber() : a.irVersion), a.producerName != null && a.hasOwnProperty("producerName") && (w.producerName = a.producerName), a.producerVersion != null && a.hasOwnProperty("producerVersion") && (w.producerVersion = a.producerVersion), a.domain != null && a.hasOwnProperty("domain") && (w.domain = a.domain), a.modelVersion != null && a.hasOwnProperty("modelVersion") && (typeof a.modelVersion == "number" ? w.modelVersion = b.longs === String ? String(a.modelVersion) : a.modelVersion : w.modelVersion = b.longs === String ? x.Long.prototype.toString.call(a.modelVersion) : b.longs === Number ? new x.LongBits(a.modelVersion.low >>> 0, a.modelVersion.high >>> 0).toNumber() : a.modelVersion), a.docString != null && a.hasOwnProperty("docString") && (w.docString = a.docString), a.graph != null && a.hasOwnProperty("graph") && (w.graph = v.onnx.GraphProto.toObject(a.graph, b)), a.opsetImport && a.opsetImport.length) {
            w.opsetImport = [];
            for (var A = 0; A < a.opsetImport.length; ++A) w.opsetImport[A] = v.onnx.OperatorSetIdProto.toObject(a.opsetImport[A], b);
          }
          if (a.metadataProps && a.metadataProps.length) for (w.metadataProps = [], A = 0; A < a.metadataProps.length; ++A) w.metadataProps[A] = v.onnx.StringStringEntryProto.toObject(a.metadataProps[A], b);
          return w;
        }, h.prototype.toJSON = function() {
          return this.constructor.toObject(this, g.util.toJSONOptions);
        }, h;
      }(), _.StringStringEntryProto = function() {
        function h(a) {
          if (a) for (var b = Object.keys(a), w = 0; w < b.length; ++w) a[b[w]] != null && (this[b[w]] = a[b[w]]);
        }
        return h.prototype.key = "", h.prototype.value = "", h.create = function(a) {
          return new h(a);
        }, h.encode = function(a, b) {
          return b || (b = E.create()), a.key != null && a.hasOwnProperty("key") && b.uint32(10).string(a.key), a.value != null && a.hasOwnProperty("value") && b.uint32(18).string(a.value), b;
        }, h.encodeDelimited = function(a, b) {
          return this.encode(a, b).ldelim();
        }, h.decode = function(a, b) {
          a instanceof y || (a = y.create(a));
          for (var w = b === void 0 ? a.len : a.pos + b, k = new v.onnx.StringStringEntryProto(); a.pos < w; ) {
            var A = a.uint32();
            switch (A >>> 3) {
              case 1:
                k.key = a.string();
                break;
              case 2:
                k.value = a.string();
                break;
              default:
                a.skipType(7 & A);
            }
          }
          return k;
        }, h.decodeDelimited = function(a) {
          return a instanceof y || (a = new y(a)), this.decode(a, a.uint32());
        }, h.verify = function(a) {
          return typeof a != "object" || a === null ? "object expected" : a.key != null && a.hasOwnProperty("key") && !x.isString(a.key) ? "key: string expected" : a.value != null && a.hasOwnProperty("value") && !x.isString(a.value) ? "value: string expected" : null;
        }, h.fromObject = function(a) {
          if (a instanceof v.onnx.StringStringEntryProto) return a;
          var b = new v.onnx.StringStringEntryProto();
          return a.key != null && (b.key = String(a.key)), a.value != null && (b.value = String(a.value)), b;
        }, h.toObject = function(a, b) {
          b || (b = {});
          var w = {};
          return b.defaults && (w.key = "", w.value = ""), a.key != null && a.hasOwnProperty("key") && (w.key = a.key), a.value != null && a.hasOwnProperty("value") && (w.value = a.value), w;
        }, h.prototype.toJSON = function() {
          return this.constructor.toObject(this, g.util.toJSONOptions);
        }, h;
      }(), _.TensorAnnotation = function() {
        function h(a) {
          if (this.quantParameterTensorNames = [], a) for (var b = Object.keys(a), w = 0; w < b.length; ++w) a[b[w]] != null && (this[b[w]] = a[b[w]]);
        }
        return h.prototype.tensorName = "", h.prototype.quantParameterTensorNames = x.emptyArray, h.create = function(a) {
          return new h(a);
        }, h.encode = function(a, b) {
          if (b || (b = E.create()), a.tensorName != null && a.hasOwnProperty("tensorName") && b.uint32(10).string(a.tensorName), a.quantParameterTensorNames != null && a.quantParameterTensorNames.length) for (var w = 0; w < a.quantParameterTensorNames.length; ++w) v.onnx.StringStringEntryProto.encode(a.quantParameterTensorNames[w], b.uint32(18).fork()).ldelim();
          return b;
        }, h.encodeDelimited = function(a, b) {
          return this.encode(a, b).ldelim();
        }, h.decode = function(a, b) {
          a instanceof y || (a = y.create(a));
          for (var w = b === void 0 ? a.len : a.pos + b, k = new v.onnx.TensorAnnotation(); a.pos < w; ) {
            var A = a.uint32();
            switch (A >>> 3) {
              case 1:
                k.tensorName = a.string();
                break;
              case 2:
                k.quantParameterTensorNames && k.quantParameterTensorNames.length || (k.quantParameterTensorNames = []), k.quantParameterTensorNames.push(v.onnx.StringStringEntryProto.decode(a, a.uint32()));
                break;
              default:
                a.skipType(7 & A);
            }
          }
          return k;
        }, h.decodeDelimited = function(a) {
          return a instanceof y || (a = new y(a)), this.decode(a, a.uint32());
        }, h.verify = function(a) {
          if (typeof a != "object" || a === null) return "object expected";
          if (a.tensorName != null && a.hasOwnProperty("tensorName") && !x.isString(a.tensorName)) return "tensorName: string expected";
          if (a.quantParameterTensorNames != null && a.hasOwnProperty("quantParameterTensorNames")) {
            if (!Array.isArray(a.quantParameterTensorNames)) return "quantParameterTensorNames: array expected";
            for (var b = 0; b < a.quantParameterTensorNames.length; ++b) {
              var w = v.onnx.StringStringEntryProto.verify(a.quantParameterTensorNames[b]);
              if (w) return "quantParameterTensorNames." + w;
            }
          }
          return null;
        }, h.fromObject = function(a) {
          if (a instanceof v.onnx.TensorAnnotation) return a;
          var b = new v.onnx.TensorAnnotation();
          if (a.tensorName != null && (b.tensorName = String(a.tensorName)), a.quantParameterTensorNames) {
            if (!Array.isArray(a.quantParameterTensorNames)) throw TypeError(".onnx.TensorAnnotation.quantParameterTensorNames: array expected");
            b.quantParameterTensorNames = [];
            for (var w = 0; w < a.quantParameterTensorNames.length; ++w) {
              if (typeof a.quantParameterTensorNames[w] != "object") throw TypeError(".onnx.TensorAnnotation.quantParameterTensorNames: object expected");
              b.quantParameterTensorNames[w] = v.onnx.StringStringEntryProto.fromObject(a.quantParameterTensorNames[w]);
            }
          }
          return b;
        }, h.toObject = function(a, b) {
          b || (b = {});
          var w = {};
          if ((b.arrays || b.defaults) && (w.quantParameterTensorNames = []), b.defaults && (w.tensorName = ""), a.tensorName != null && a.hasOwnProperty("tensorName") && (w.tensorName = a.tensorName), a.quantParameterTensorNames && a.quantParameterTensorNames.length) {
            w.quantParameterTensorNames = [];
            for (var k = 0; k < a.quantParameterTensorNames.length; ++k) w.quantParameterTensorNames[k] = v.onnx.StringStringEntryProto.toObject(a.quantParameterTensorNames[k], b);
          }
          return w;
        }, h.prototype.toJSON = function() {
          return this.constructor.toObject(this, g.util.toJSONOptions);
        }, h;
      }(), _.GraphProto = function() {
        function h(a) {
          if (this.node = [], this.initializer = [], this.input = [], this.output = [], this.valueInfo = [], this.quantizationAnnotation = [], a) for (var b = Object.keys(a), w = 0; w < b.length; ++w) a[b[w]] != null && (this[b[w]] = a[b[w]]);
        }
        return h.prototype.node = x.emptyArray, h.prototype.name = "", h.prototype.initializer = x.emptyArray, h.prototype.docString = "", h.prototype.input = x.emptyArray, h.prototype.output = x.emptyArray, h.prototype.valueInfo = x.emptyArray, h.prototype.quantizationAnnotation = x.emptyArray, h.create = function(a) {
          return new h(a);
        }, h.encode = function(a, b) {
          if (b || (b = E.create()), a.node != null && a.node.length) for (var w = 0; w < a.node.length; ++w) v.onnx.NodeProto.encode(a.node[w], b.uint32(10).fork()).ldelim();
          if (a.name != null && a.hasOwnProperty("name") && b.uint32(18).string(a.name), a.initializer != null && a.initializer.length) for (w = 0; w < a.initializer.length; ++w) v.onnx.TensorProto.encode(a.initializer[w], b.uint32(42).fork()).ldelim();
          if (a.docString != null && a.hasOwnProperty("docString") && b.uint32(82).string(a.docString), a.input != null && a.input.length) for (w = 0; w < a.input.length; ++w) v.onnx.ValueInfoProto.encode(a.input[w], b.uint32(90).fork()).ldelim();
          if (a.output != null && a.output.length) for (w = 0; w < a.output.length; ++w) v.onnx.ValueInfoProto.encode(a.output[w], b.uint32(98).fork()).ldelim();
          if (a.valueInfo != null && a.valueInfo.length) for (w = 0; w < a.valueInfo.length; ++w) v.onnx.ValueInfoProto.encode(a.valueInfo[w], b.uint32(106).fork()).ldelim();
          if (a.quantizationAnnotation != null && a.quantizationAnnotation.length) for (w = 0; w < a.quantizationAnnotation.length; ++w) v.onnx.TensorAnnotation.encode(a.quantizationAnnotation[w], b.uint32(114).fork()).ldelim();
          return b;
        }, h.encodeDelimited = function(a, b) {
          return this.encode(a, b).ldelim();
        }, h.decode = function(a, b) {
          a instanceof y || (a = y.create(a));
          for (var w = b === void 0 ? a.len : a.pos + b, k = new v.onnx.GraphProto(); a.pos < w; ) {
            var A = a.uint32();
            switch (A >>> 3) {
              case 1:
                k.node && k.node.length || (k.node = []), k.node.push(v.onnx.NodeProto.decode(a, a.uint32()));
                break;
              case 2:
                k.name = a.string();
                break;
              case 5:
                k.initializer && k.initializer.length || (k.initializer = []), k.initializer.push(v.onnx.TensorProto.decode(a, a.uint32()));
                break;
              case 10:
                k.docString = a.string();
                break;
              case 11:
                k.input && k.input.length || (k.input = []), k.input.push(v.onnx.ValueInfoProto.decode(a, a.uint32()));
                break;
              case 12:
                k.output && k.output.length || (k.output = []), k.output.push(v.onnx.ValueInfoProto.decode(a, a.uint32()));
                break;
              case 13:
                k.valueInfo && k.valueInfo.length || (k.valueInfo = []), k.valueInfo.push(v.onnx.ValueInfoProto.decode(a, a.uint32()));
                break;
              case 14:
                k.quantizationAnnotation && k.quantizationAnnotation.length || (k.quantizationAnnotation = []), k.quantizationAnnotation.push(v.onnx.TensorAnnotation.decode(a, a.uint32()));
                break;
              default:
                a.skipType(7 & A);
            }
          }
          return k;
        }, h.decodeDelimited = function(a) {
          return a instanceof y || (a = new y(a)), this.decode(a, a.uint32());
        }, h.verify = function(a) {
          if (typeof a != "object" || a === null) return "object expected";
          if (a.node != null && a.hasOwnProperty("node")) {
            if (!Array.isArray(a.node)) return "node: array expected";
            for (var b = 0; b < a.node.length; ++b) if (w = v.onnx.NodeProto.verify(a.node[b])) return "node." + w;
          }
          if (a.name != null && a.hasOwnProperty("name") && !x.isString(a.name)) return "name: string expected";
          if (a.initializer != null && a.hasOwnProperty("initializer")) {
            if (!Array.isArray(a.initializer)) return "initializer: array expected";
            for (b = 0; b < a.initializer.length; ++b) if (w = v.onnx.TensorProto.verify(a.initializer[b])) return "initializer." + w;
          }
          if (a.docString != null && a.hasOwnProperty("docString") && !x.isString(a.docString)) return "docString: string expected";
          if (a.input != null && a.hasOwnProperty("input")) {
            if (!Array.isArray(a.input)) return "input: array expected";
            for (b = 0; b < a.input.length; ++b) if (w = v.onnx.ValueInfoProto.verify(a.input[b])) return "input." + w;
          }
          if (a.output != null && a.hasOwnProperty("output")) {
            if (!Array.isArray(a.output)) return "output: array expected";
            for (b = 0; b < a.output.length; ++b) if (w = v.onnx.ValueInfoProto.verify(a.output[b])) return "output." + w;
          }
          if (a.valueInfo != null && a.hasOwnProperty("valueInfo")) {
            if (!Array.isArray(a.valueInfo)) return "valueInfo: array expected";
            for (b = 0; b < a.valueInfo.length; ++b) if (w = v.onnx.ValueInfoProto.verify(a.valueInfo[b])) return "valueInfo." + w;
          }
          if (a.quantizationAnnotation != null && a.hasOwnProperty("quantizationAnnotation")) {
            if (!Array.isArray(a.quantizationAnnotation)) return "quantizationAnnotation: array expected";
            for (b = 0; b < a.quantizationAnnotation.length; ++b) {
              var w;
              if (w = v.onnx.TensorAnnotation.verify(a.quantizationAnnotation[b])) return "quantizationAnnotation." + w;
            }
          }
          return null;
        }, h.fromObject = function(a) {
          if (a instanceof v.onnx.GraphProto) return a;
          var b = new v.onnx.GraphProto();
          if (a.node) {
            if (!Array.isArray(a.node)) throw TypeError(".onnx.GraphProto.node: array expected");
            b.node = [];
            for (var w = 0; w < a.node.length; ++w) {
              if (typeof a.node[w] != "object") throw TypeError(".onnx.GraphProto.node: object expected");
              b.node[w] = v.onnx.NodeProto.fromObject(a.node[w]);
            }
          }
          if (a.name != null && (b.name = String(a.name)), a.initializer) {
            if (!Array.isArray(a.initializer)) throw TypeError(".onnx.GraphProto.initializer: array expected");
            for (b.initializer = [], w = 0; w < a.initializer.length; ++w) {
              if (typeof a.initializer[w] != "object") throw TypeError(".onnx.GraphProto.initializer: object expected");
              b.initializer[w] = v.onnx.TensorProto.fromObject(a.initializer[w]);
            }
          }
          if (a.docString != null && (b.docString = String(a.docString)), a.input) {
            if (!Array.isArray(a.input)) throw TypeError(".onnx.GraphProto.input: array expected");
            for (b.input = [], w = 0; w < a.input.length; ++w) {
              if (typeof a.input[w] != "object") throw TypeError(".onnx.GraphProto.input: object expected");
              b.input[w] = v.onnx.ValueInfoProto.fromObject(a.input[w]);
            }
          }
          if (a.output) {
            if (!Array.isArray(a.output)) throw TypeError(".onnx.GraphProto.output: array expected");
            for (b.output = [], w = 0; w < a.output.length; ++w) {
              if (typeof a.output[w] != "object") throw TypeError(".onnx.GraphProto.output: object expected");
              b.output[w] = v.onnx.ValueInfoProto.fromObject(a.output[w]);
            }
          }
          if (a.valueInfo) {
            if (!Array.isArray(a.valueInfo)) throw TypeError(".onnx.GraphProto.valueInfo: array expected");
            for (b.valueInfo = [], w = 0; w < a.valueInfo.length; ++w) {
              if (typeof a.valueInfo[w] != "object") throw TypeError(".onnx.GraphProto.valueInfo: object expected");
              b.valueInfo[w] = v.onnx.ValueInfoProto.fromObject(a.valueInfo[w]);
            }
          }
          if (a.quantizationAnnotation) {
            if (!Array.isArray(a.quantizationAnnotation)) throw TypeError(".onnx.GraphProto.quantizationAnnotation: array expected");
            for (b.quantizationAnnotation = [], w = 0; w < a.quantizationAnnotation.length; ++w) {
              if (typeof a.quantizationAnnotation[w] != "object") throw TypeError(".onnx.GraphProto.quantizationAnnotation: object expected");
              b.quantizationAnnotation[w] = v.onnx.TensorAnnotation.fromObject(a.quantizationAnnotation[w]);
            }
          }
          return b;
        }, h.toObject = function(a, b) {
          b || (b = {});
          var w = {};
          if ((b.arrays || b.defaults) && (w.node = [], w.initializer = [], w.input = [], w.output = [], w.valueInfo = [], w.quantizationAnnotation = []), b.defaults && (w.name = "", w.docString = ""), a.node && a.node.length) {
            w.node = [];
            for (var k = 0; k < a.node.length; ++k) w.node[k] = v.onnx.NodeProto.toObject(a.node[k], b);
          }
          if (a.name != null && a.hasOwnProperty("name") && (w.name = a.name), a.initializer && a.initializer.length) for (w.initializer = [], k = 0; k < a.initializer.length; ++k) w.initializer[k] = v.onnx.TensorProto.toObject(a.initializer[k], b);
          if (a.docString != null && a.hasOwnProperty("docString") && (w.docString = a.docString), a.input && a.input.length) for (w.input = [], k = 0; k < a.input.length; ++k) w.input[k] = v.onnx.ValueInfoProto.toObject(a.input[k], b);
          if (a.output && a.output.length) for (w.output = [], k = 0; k < a.output.length; ++k) w.output[k] = v.onnx.ValueInfoProto.toObject(a.output[k], b);
          if (a.valueInfo && a.valueInfo.length) for (w.valueInfo = [], k = 0; k < a.valueInfo.length; ++k) w.valueInfo[k] = v.onnx.ValueInfoProto.toObject(a.valueInfo[k], b);
          if (a.quantizationAnnotation && a.quantizationAnnotation.length) for (w.quantizationAnnotation = [], k = 0; k < a.quantizationAnnotation.length; ++k) w.quantizationAnnotation[k] = v.onnx.TensorAnnotation.toObject(a.quantizationAnnotation[k], b);
          return w;
        }, h.prototype.toJSON = function() {
          return this.constructor.toObject(this, g.util.toJSONOptions);
        }, h;
      }(), _.TensorProto = function() {
        function h(a) {
          if (this.dims = [], this.floatData = [], this.int32Data = [], this.stringData = [], this.int64Data = [], this.externalData = [], this.doubleData = [], this.uint64Data = [], a) for (var b = Object.keys(a), w = 0; w < b.length; ++w) a[b[w]] != null && (this[b[w]] = a[b[w]]);
        }
        return h.prototype.dims = x.emptyArray, h.prototype.dataType = 0, h.prototype.segment = null, h.prototype.floatData = x.emptyArray, h.prototype.int32Data = x.emptyArray, h.prototype.stringData = x.emptyArray, h.prototype.int64Data = x.emptyArray, h.prototype.name = "", h.prototype.docString = "", h.prototype.rawData = x.newBuffer([]), h.prototype.externalData = x.emptyArray, h.prototype.dataLocation = 0, h.prototype.doubleData = x.emptyArray, h.prototype.uint64Data = x.emptyArray, h.create = function(a) {
          return new h(a);
        }, h.encode = function(a, b) {
          if (b || (b = E.create()), a.dims != null && a.dims.length) {
            b.uint32(10).fork();
            for (var w = 0; w < a.dims.length; ++w) b.int64(a.dims[w]);
            b.ldelim();
          }
          if (a.dataType != null && a.hasOwnProperty("dataType") && b.uint32(16).int32(a.dataType), a.segment != null && a.hasOwnProperty("segment") && v.onnx.TensorProto.Segment.encode(a.segment, b.uint32(26).fork()).ldelim(), a.floatData != null && a.floatData.length) {
            for (b.uint32(34).fork(), w = 0; w < a.floatData.length; ++w) b.float(a.floatData[w]);
            b.ldelim();
          }
          if (a.int32Data != null && a.int32Data.length) {
            for (b.uint32(42).fork(), w = 0; w < a.int32Data.length; ++w) b.int32(a.int32Data[w]);
            b.ldelim();
          }
          if (a.stringData != null && a.stringData.length) for (w = 0; w < a.stringData.length; ++w) b.uint32(50).bytes(a.stringData[w]);
          if (a.int64Data != null && a.int64Data.length) {
            for (b.uint32(58).fork(), w = 0; w < a.int64Data.length; ++w) b.int64(a.int64Data[w]);
            b.ldelim();
          }
          if (a.name != null && a.hasOwnProperty("name") && b.uint32(66).string(a.name), a.rawData != null && a.hasOwnProperty("rawData") && b.uint32(74).bytes(a.rawData), a.doubleData != null && a.doubleData.length) {
            for (b.uint32(82).fork(), w = 0; w < a.doubleData.length; ++w) b.double(a.doubleData[w]);
            b.ldelim();
          }
          if (a.uint64Data != null && a.uint64Data.length) {
            for (b.uint32(90).fork(), w = 0; w < a.uint64Data.length; ++w) b.uint64(a.uint64Data[w]);
            b.ldelim();
          }
          if (a.docString != null && a.hasOwnProperty("docString") && b.uint32(98).string(a.docString), a.externalData != null && a.externalData.length) for (w = 0; w < a.externalData.length; ++w) v.onnx.StringStringEntryProto.encode(a.externalData[w], b.uint32(106).fork()).ldelim();
          return a.dataLocation != null && a.hasOwnProperty("dataLocation") && b.uint32(112).int32(a.dataLocation), b;
        }, h.encodeDelimited = function(a, b) {
          return this.encode(a, b).ldelim();
        }, h.decode = function(a, b) {
          a instanceof y || (a = y.create(a));
          for (var w = b === void 0 ? a.len : a.pos + b, k = new v.onnx.TensorProto(); a.pos < w; ) {
            var A = a.uint32();
            switch (A >>> 3) {
              case 1:
                if (k.dims && k.dims.length || (k.dims = []), (7 & A) == 2) for (var M = a.uint32() + a.pos; a.pos < M; ) k.dims.push(a.int64());
                else k.dims.push(a.int64());
                break;
              case 2:
                k.dataType = a.int32();
                break;
              case 3:
                k.segment = v.onnx.TensorProto.Segment.decode(a, a.uint32());
                break;
              case 4:
                if (k.floatData && k.floatData.length || (k.floatData = []), (7 & A) == 2) for (M = a.uint32() + a.pos; a.pos < M; ) k.floatData.push(a.float());
                else k.floatData.push(a.float());
                break;
              case 5:
                if (k.int32Data && k.int32Data.length || (k.int32Data = []), (7 & A) == 2) for (M = a.uint32() + a.pos; a.pos < M; ) k.int32Data.push(a.int32());
                else k.int32Data.push(a.int32());
                break;
              case 6:
                k.stringData && k.stringData.length || (k.stringData = []), k.stringData.push(a.bytes());
                break;
              case 7:
                if (k.int64Data && k.int64Data.length || (k.int64Data = []), (7 & A) == 2) for (M = a.uint32() + a.pos; a.pos < M; ) k.int64Data.push(a.int64());
                else k.int64Data.push(a.int64());
                break;
              case 8:
                k.name = a.string();
                break;
              case 12:
                k.docString = a.string();
                break;
              case 9:
                k.rawData = a.bytes();
                break;
              case 13:
                k.externalData && k.externalData.length || (k.externalData = []), k.externalData.push(v.onnx.StringStringEntryProto.decode(a, a.uint32()));
                break;
              case 14:
                k.dataLocation = a.int32();
                break;
              case 10:
                if (k.doubleData && k.doubleData.length || (k.doubleData = []), (7 & A) == 2) for (M = a.uint32() + a.pos; a.pos < M; ) k.doubleData.push(a.double());
                else k.doubleData.push(a.double());
                break;
              case 11:
                if (k.uint64Data && k.uint64Data.length || (k.uint64Data = []), (7 & A) == 2) for (M = a.uint32() + a.pos; a.pos < M; ) k.uint64Data.push(a.uint64());
                else k.uint64Data.push(a.uint64());
                break;
              default:
                a.skipType(7 & A);
            }
          }
          return k;
        }, h.decodeDelimited = function(a) {
          return a instanceof y || (a = new y(a)), this.decode(a, a.uint32());
        }, h.verify = function(a) {
          if (typeof a != "object" || a === null) return "object expected";
          if (a.dims != null && a.hasOwnProperty("dims")) {
            if (!Array.isArray(a.dims)) return "dims: array expected";
            for (var b = 0; b < a.dims.length; ++b) if (!(x.isInteger(a.dims[b]) || a.dims[b] && x.isInteger(a.dims[b].low) && x.isInteger(a.dims[b].high))) return "dims: integer|Long[] expected";
          }
          if (a.dataType != null && a.hasOwnProperty("dataType") && !x.isInteger(a.dataType)) return "dataType: integer expected";
          if (a.segment != null && a.hasOwnProperty("segment") && (w = v.onnx.TensorProto.Segment.verify(a.segment))) return "segment." + w;
          if (a.floatData != null && a.hasOwnProperty("floatData")) {
            if (!Array.isArray(a.floatData)) return "floatData: array expected";
            for (b = 0; b < a.floatData.length; ++b) if (typeof a.floatData[b] != "number") return "floatData: number[] expected";
          }
          if (a.int32Data != null && a.hasOwnProperty("int32Data")) {
            if (!Array.isArray(a.int32Data)) return "int32Data: array expected";
            for (b = 0; b < a.int32Data.length; ++b) if (!x.isInteger(a.int32Data[b])) return "int32Data: integer[] expected";
          }
          if (a.stringData != null && a.hasOwnProperty("stringData")) {
            if (!Array.isArray(a.stringData)) return "stringData: array expected";
            for (b = 0; b < a.stringData.length; ++b) if (!(a.stringData[b] && typeof a.stringData[b].length == "number" || x.isString(a.stringData[b]))) return "stringData: buffer[] expected";
          }
          if (a.int64Data != null && a.hasOwnProperty("int64Data")) {
            if (!Array.isArray(a.int64Data)) return "int64Data: array expected";
            for (b = 0; b < a.int64Data.length; ++b) if (!(x.isInteger(a.int64Data[b]) || a.int64Data[b] && x.isInteger(a.int64Data[b].low) && x.isInteger(a.int64Data[b].high))) return "int64Data: integer|Long[] expected";
          }
          if (a.name != null && a.hasOwnProperty("name") && !x.isString(a.name)) return "name: string expected";
          if (a.docString != null && a.hasOwnProperty("docString") && !x.isString(a.docString)) return "docString: string expected";
          if (a.rawData != null && a.hasOwnProperty("rawData") && !(a.rawData && typeof a.rawData.length == "number" || x.isString(a.rawData))) return "rawData: buffer expected";
          if (a.externalData != null && a.hasOwnProperty("externalData")) {
            if (!Array.isArray(a.externalData)) return "externalData: array expected";
            for (b = 0; b < a.externalData.length; ++b) {
              var w;
              if (w = v.onnx.StringStringEntryProto.verify(a.externalData[b])) return "externalData." + w;
            }
          }
          if (a.dataLocation != null && a.hasOwnProperty("dataLocation")) switch (a.dataLocation) {
            default:
              return "dataLocation: enum value expected";
            case 0:
            case 1:
          }
          if (a.doubleData != null && a.hasOwnProperty("doubleData")) {
            if (!Array.isArray(a.doubleData)) return "doubleData: array expected";
            for (b = 0; b < a.doubleData.length; ++b) if (typeof a.doubleData[b] != "number") return "doubleData: number[] expected";
          }
          if (a.uint64Data != null && a.hasOwnProperty("uint64Data")) {
            if (!Array.isArray(a.uint64Data)) return "uint64Data: array expected";
            for (b = 0; b < a.uint64Data.length; ++b) if (!(x.isInteger(a.uint64Data[b]) || a.uint64Data[b] && x.isInteger(a.uint64Data[b].low) && x.isInteger(a.uint64Data[b].high))) return "uint64Data: integer|Long[] expected";
          }
          return null;
        }, h.fromObject = function(a) {
          if (a instanceof v.onnx.TensorProto) return a;
          var b = new v.onnx.TensorProto();
          if (a.dims) {
            if (!Array.isArray(a.dims)) throw TypeError(".onnx.TensorProto.dims: array expected");
            b.dims = [];
            for (var w = 0; w < a.dims.length; ++w) x.Long ? (b.dims[w] = x.Long.fromValue(a.dims[w])).unsigned = !1 : typeof a.dims[w] == "string" ? b.dims[w] = parseInt(a.dims[w], 10) : typeof a.dims[w] == "number" ? b.dims[w] = a.dims[w] : typeof a.dims[w] == "object" && (b.dims[w] = new x.LongBits(a.dims[w].low >>> 0, a.dims[w].high >>> 0).toNumber());
          }
          if (a.dataType != null && (b.dataType = 0 | a.dataType), a.segment != null) {
            if (typeof a.segment != "object") throw TypeError(".onnx.TensorProto.segment: object expected");
            b.segment = v.onnx.TensorProto.Segment.fromObject(a.segment);
          }
          if (a.floatData) {
            if (!Array.isArray(a.floatData)) throw TypeError(".onnx.TensorProto.floatData: array expected");
            for (b.floatData = [], w = 0; w < a.floatData.length; ++w) b.floatData[w] = Number(a.floatData[w]);
          }
          if (a.int32Data) {
            if (!Array.isArray(a.int32Data)) throw TypeError(".onnx.TensorProto.int32Data: array expected");
            for (b.int32Data = [], w = 0; w < a.int32Data.length; ++w) b.int32Data[w] = 0 | a.int32Data[w];
          }
          if (a.stringData) {
            if (!Array.isArray(a.stringData)) throw TypeError(".onnx.TensorProto.stringData: array expected");
            for (b.stringData = [], w = 0; w < a.stringData.length; ++w) typeof a.stringData[w] == "string" ? x.base64.decode(a.stringData[w], b.stringData[w] = x.newBuffer(x.base64.length(a.stringData[w])), 0) : a.stringData[w].length && (b.stringData[w] = a.stringData[w]);
          }
          if (a.int64Data) {
            if (!Array.isArray(a.int64Data)) throw TypeError(".onnx.TensorProto.int64Data: array expected");
            for (b.int64Data = [], w = 0; w < a.int64Data.length; ++w) x.Long ? (b.int64Data[w] = x.Long.fromValue(a.int64Data[w])).unsigned = !1 : typeof a.int64Data[w] == "string" ? b.int64Data[w] = parseInt(a.int64Data[w], 10) : typeof a.int64Data[w] == "number" ? b.int64Data[w] = a.int64Data[w] : typeof a.int64Data[w] == "object" && (b.int64Data[w] = new x.LongBits(a.int64Data[w].low >>> 0, a.int64Data[w].high >>> 0).toNumber());
          }
          if (a.name != null && (b.name = String(a.name)), a.docString != null && (b.docString = String(a.docString)), a.rawData != null && (typeof a.rawData == "string" ? x.base64.decode(a.rawData, b.rawData = x.newBuffer(x.base64.length(a.rawData)), 0) : a.rawData.length && (b.rawData = a.rawData)), a.externalData) {
            if (!Array.isArray(a.externalData)) throw TypeError(".onnx.TensorProto.externalData: array expected");
            for (b.externalData = [], w = 0; w < a.externalData.length; ++w) {
              if (typeof a.externalData[w] != "object") throw TypeError(".onnx.TensorProto.externalData: object expected");
              b.externalData[w] = v.onnx.StringStringEntryProto.fromObject(a.externalData[w]);
            }
          }
          switch (a.dataLocation) {
            case "DEFAULT":
            case 0:
              b.dataLocation = 0;
              break;
            case "EXTERNAL":
            case 1:
              b.dataLocation = 1;
          }
          if (a.doubleData) {
            if (!Array.isArray(a.doubleData)) throw TypeError(".onnx.TensorProto.doubleData: array expected");
            for (b.doubleData = [], w = 0; w < a.doubleData.length; ++w) b.doubleData[w] = Number(a.doubleData[w]);
          }
          if (a.uint64Data) {
            if (!Array.isArray(a.uint64Data)) throw TypeError(".onnx.TensorProto.uint64Data: array expected");
            for (b.uint64Data = [], w = 0; w < a.uint64Data.length; ++w) x.Long ? (b.uint64Data[w] = x.Long.fromValue(a.uint64Data[w])).unsigned = !0 : typeof a.uint64Data[w] == "string" ? b.uint64Data[w] = parseInt(a.uint64Data[w], 10) : typeof a.uint64Data[w] == "number" ? b.uint64Data[w] = a.uint64Data[w] : typeof a.uint64Data[w] == "object" && (b.uint64Data[w] = new x.LongBits(a.uint64Data[w].low >>> 0, a.uint64Data[w].high >>> 0).toNumber(!0));
          }
          return b;
        }, h.toObject = function(a, b) {
          b || (b = {});
          var w = {};
          if ((b.arrays || b.defaults) && (w.dims = [], w.floatData = [], w.int32Data = [], w.stringData = [], w.int64Data = [], w.doubleData = [], w.uint64Data = [], w.externalData = []), b.defaults && (w.dataType = 0, w.segment = null, w.name = "", b.bytes === String ? w.rawData = "" : (w.rawData = [], b.bytes !== Array && (w.rawData = x.newBuffer(w.rawData))), w.docString = "", w.dataLocation = b.enums === String ? "DEFAULT" : 0), a.dims && a.dims.length) {
            w.dims = [];
            for (var k = 0; k < a.dims.length; ++k) typeof a.dims[k] == "number" ? w.dims[k] = b.longs === String ? String(a.dims[k]) : a.dims[k] : w.dims[k] = b.longs === String ? x.Long.prototype.toString.call(a.dims[k]) : b.longs === Number ? new x.LongBits(a.dims[k].low >>> 0, a.dims[k].high >>> 0).toNumber() : a.dims[k];
          }
          if (a.dataType != null && a.hasOwnProperty("dataType") && (w.dataType = a.dataType), a.segment != null && a.hasOwnProperty("segment") && (w.segment = v.onnx.TensorProto.Segment.toObject(a.segment, b)), a.floatData && a.floatData.length) for (w.floatData = [], k = 0; k < a.floatData.length; ++k) w.floatData[k] = b.json && !isFinite(a.floatData[k]) ? String(a.floatData[k]) : a.floatData[k];
          if (a.int32Data && a.int32Data.length) for (w.int32Data = [], k = 0; k < a.int32Data.length; ++k) w.int32Data[k] = a.int32Data[k];
          if (a.stringData && a.stringData.length) for (w.stringData = [], k = 0; k < a.stringData.length; ++k) w.stringData[k] = b.bytes === String ? x.base64.encode(a.stringData[k], 0, a.stringData[k].length) : b.bytes === Array ? Array.prototype.slice.call(a.stringData[k]) : a.stringData[k];
          if (a.int64Data && a.int64Data.length) for (w.int64Data = [], k = 0; k < a.int64Data.length; ++k) typeof a.int64Data[k] == "number" ? w.int64Data[k] = b.longs === String ? String(a.int64Data[k]) : a.int64Data[k] : w.int64Data[k] = b.longs === String ? x.Long.prototype.toString.call(a.int64Data[k]) : b.longs === Number ? new x.LongBits(a.int64Data[k].low >>> 0, a.int64Data[k].high >>> 0).toNumber() : a.int64Data[k];
          if (a.name != null && a.hasOwnProperty("name") && (w.name = a.name), a.rawData != null && a.hasOwnProperty("rawData") && (w.rawData = b.bytes === String ? x.base64.encode(a.rawData, 0, a.rawData.length) : b.bytes === Array ? Array.prototype.slice.call(a.rawData) : a.rawData), a.doubleData && a.doubleData.length) for (w.doubleData = [], k = 0; k < a.doubleData.length; ++k) w.doubleData[k] = b.json && !isFinite(a.doubleData[k]) ? String(a.doubleData[k]) : a.doubleData[k];
          if (a.uint64Data && a.uint64Data.length) for (w.uint64Data = [], k = 0; k < a.uint64Data.length; ++k) typeof a.uint64Data[k] == "number" ? w.uint64Data[k] = b.longs === String ? String(a.uint64Data[k]) : a.uint64Data[k] : w.uint64Data[k] = b.longs === String ? x.Long.prototype.toString.call(a.uint64Data[k]) : b.longs === Number ? new x.LongBits(a.uint64Data[k].low >>> 0, a.uint64Data[k].high >>> 0).toNumber(!0) : a.uint64Data[k];
          if (a.docString != null && a.hasOwnProperty("docString") && (w.docString = a.docString), a.externalData && a.externalData.length) for (w.externalData = [], k = 0; k < a.externalData.length; ++k) w.externalData[k] = v.onnx.StringStringEntryProto.toObject(a.externalData[k], b);
          return a.dataLocation != null && a.hasOwnProperty("dataLocation") && (w.dataLocation = b.enums === String ? v.onnx.TensorProto.DataLocation[a.dataLocation] : a.dataLocation), w;
        }, h.prototype.toJSON = function() {
          return this.constructor.toObject(this, g.util.toJSONOptions);
        }, h.DataType = function() {
          var a = {}, b = Object.create(a);
          return b[a[0] = "UNDEFINED"] = 0, b[a[1] = "FLOAT"] = 1, b[a[2] = "UINT8"] = 2, b[a[3] = "INT8"] = 3, b[a[4] = "UINT16"] = 4, b[a[5] = "INT16"] = 5, b[a[6] = "INT32"] = 6, b[a[7] = "INT64"] = 7, b[a[8] = "STRING"] = 8, b[a[9] = "BOOL"] = 9, b[a[10] = "FLOAT16"] = 10, b[a[11] = "DOUBLE"] = 11, b[a[12] = "UINT32"] = 12, b[a[13] = "UINT64"] = 13, b[a[14] = "COMPLEX64"] = 14, b[a[15] = "COMPLEX128"] = 15, b[a[16] = "BFLOAT16"] = 16, b;
        }(), h.Segment = function() {
          function a(b) {
            if (b) for (var w = Object.keys(b), k = 0; k < w.length; ++k) b[w[k]] != null && (this[w[k]] = b[w[k]]);
          }
          return a.prototype.begin = x.Long ? x.Long.fromBits(0, 0, !1) : 0, a.prototype.end = x.Long ? x.Long.fromBits(0, 0, !1) : 0, a.create = function(b) {
            return new a(b);
          }, a.encode = function(b, w) {
            return w || (w = E.create()), b.begin != null && b.hasOwnProperty("begin") && w.uint32(8).int64(b.begin), b.end != null && b.hasOwnProperty("end") && w.uint32(16).int64(b.end), w;
          }, a.encodeDelimited = function(b, w) {
            return this.encode(b, w).ldelim();
          }, a.decode = function(b, w) {
            b instanceof y || (b = y.create(b));
            for (var k = w === void 0 ? b.len : b.pos + w, A = new v.onnx.TensorProto.Segment(); b.pos < k; ) {
              var M = b.uint32();
              switch (M >>> 3) {
                case 1:
                  A.begin = b.int64();
                  break;
                case 2:
                  A.end = b.int64();
                  break;
                default:
                  b.skipType(7 & M);
              }
            }
            return A;
          }, a.decodeDelimited = function(b) {
            return b instanceof y || (b = new y(b)), this.decode(b, b.uint32());
          }, a.verify = function(b) {
            return typeof b != "object" || b === null ? "object expected" : b.begin != null && b.hasOwnProperty("begin") && !(x.isInteger(b.begin) || b.begin && x.isInteger(b.begin.low) && x.isInteger(b.begin.high)) ? "begin: integer|Long expected" : b.end != null && b.hasOwnProperty("end") && !(x.isInteger(b.end) || b.end && x.isInteger(b.end.low) && x.isInteger(b.end.high)) ? "end: integer|Long expected" : null;
          }, a.fromObject = function(b) {
            if (b instanceof v.onnx.TensorProto.Segment) return b;
            var w = new v.onnx.TensorProto.Segment();
            return b.begin != null && (x.Long ? (w.begin = x.Long.fromValue(b.begin)).unsigned = !1 : typeof b.begin == "string" ? w.begin = parseInt(b.begin, 10) : typeof b.begin == "number" ? w.begin = b.begin : typeof b.begin == "object" && (w.begin = new x.LongBits(b.begin.low >>> 0, b.begin.high >>> 0).toNumber())), b.end != null && (x.Long ? (w.end = x.Long.fromValue(b.end)).unsigned = !1 : typeof b.end == "string" ? w.end = parseInt(b.end, 10) : typeof b.end == "number" ? w.end = b.end : typeof b.end == "object" && (w.end = new x.LongBits(b.end.low >>> 0, b.end.high >>> 0).toNumber())), w;
          }, a.toObject = function(b, w) {
            w || (w = {});
            var k = {};
            if (w.defaults) {
              if (x.Long) {
                var A = new x.Long(0, 0, !1);
                k.begin = w.longs === String ? A.toString() : w.longs === Number ? A.toNumber() : A;
              } else k.begin = w.longs === String ? "0" : 0;
              x.Long ? (A = new x.Long(0, 0, !1), k.end = w.longs === String ? A.toString() : w.longs === Number ? A.toNumber() : A) : k.end = w.longs === String ? "0" : 0;
            }
            return b.begin != null && b.hasOwnProperty("begin") && (typeof b.begin == "number" ? k.begin = w.longs === String ? String(b.begin) : b.begin : k.begin = w.longs === String ? x.Long.prototype.toString.call(b.begin) : w.longs === Number ? new x.LongBits(b.begin.low >>> 0, b.begin.high >>> 0).toNumber() : b.begin), b.end != null && b.hasOwnProperty("end") && (typeof b.end == "number" ? k.end = w.longs === String ? String(b.end) : b.end : k.end = w.longs === String ? x.Long.prototype.toString.call(b.end) : w.longs === Number ? new x.LongBits(b.end.low >>> 0, b.end.high >>> 0).toNumber() : b.end), k;
          }, a.prototype.toJSON = function() {
            return this.constructor.toObject(this, g.util.toJSONOptions);
          }, a;
        }(), h.DataLocation = function() {
          var a = {}, b = Object.create(a);
          return b[a[0] = "DEFAULT"] = 0, b[a[1] = "EXTERNAL"] = 1, b;
        }(), h;
      }(), _.TensorShapeProto = function() {
        function h(a) {
          if (this.dim = [], a) for (var b = Object.keys(a), w = 0; w < b.length; ++w) a[b[w]] != null && (this[b[w]] = a[b[w]]);
        }
        return h.prototype.dim = x.emptyArray, h.create = function(a) {
          return new h(a);
        }, h.encode = function(a, b) {
          if (b || (b = E.create()), a.dim != null && a.dim.length) for (var w = 0; w < a.dim.length; ++w) v.onnx.TensorShapeProto.Dimension.encode(a.dim[w], b.uint32(10).fork()).ldelim();
          return b;
        }, h.encodeDelimited = function(a, b) {
          return this.encode(a, b).ldelim();
        }, h.decode = function(a, b) {
          a instanceof y || (a = y.create(a));
          for (var w = b === void 0 ? a.len : a.pos + b, k = new v.onnx.TensorShapeProto(); a.pos < w; ) {
            var A = a.uint32();
            A >>> 3 == 1 ? (k.dim && k.dim.length || (k.dim = []), k.dim.push(v.onnx.TensorShapeProto.Dimension.decode(a, a.uint32()))) : a.skipType(7 & A);
          }
          return k;
        }, h.decodeDelimited = function(a) {
          return a instanceof y || (a = new y(a)), this.decode(a, a.uint32());
        }, h.verify = function(a) {
          if (typeof a != "object" || a === null) return "object expected";
          if (a.dim != null && a.hasOwnProperty("dim")) {
            if (!Array.isArray(a.dim)) return "dim: array expected";
            for (var b = 0; b < a.dim.length; ++b) {
              var w = v.onnx.TensorShapeProto.Dimension.verify(a.dim[b]);
              if (w) return "dim." + w;
            }
          }
          return null;
        }, h.fromObject = function(a) {
          if (a instanceof v.onnx.TensorShapeProto) return a;
          var b = new v.onnx.TensorShapeProto();
          if (a.dim) {
            if (!Array.isArray(a.dim)) throw TypeError(".onnx.TensorShapeProto.dim: array expected");
            b.dim = [];
            for (var w = 0; w < a.dim.length; ++w) {
              if (typeof a.dim[w] != "object") throw TypeError(".onnx.TensorShapeProto.dim: object expected");
              b.dim[w] = v.onnx.TensorShapeProto.Dimension.fromObject(a.dim[w]);
            }
          }
          return b;
        }, h.toObject = function(a, b) {
          b || (b = {});
          var w = {};
          if ((b.arrays || b.defaults) && (w.dim = []), a.dim && a.dim.length) {
            w.dim = [];
            for (var k = 0; k < a.dim.length; ++k) w.dim[k] = v.onnx.TensorShapeProto.Dimension.toObject(a.dim[k], b);
          }
          return w;
        }, h.prototype.toJSON = function() {
          return this.constructor.toObject(this, g.util.toJSONOptions);
        }, h.Dimension = function() {
          function a(w) {
            if (w) for (var k = Object.keys(w), A = 0; A < k.length; ++A) w[k[A]] != null && (this[k[A]] = w[k[A]]);
          }
          var b;
          return a.prototype.dimValue = x.Long ? x.Long.fromBits(0, 0, !1) : 0, a.prototype.dimParam = "", a.prototype.denotation = "", Object.defineProperty(a.prototype, "value", { get: x.oneOfGetter(b = ["dimValue", "dimParam"]), set: x.oneOfSetter(b) }), a.create = function(w) {
            return new a(w);
          }, a.encode = function(w, k) {
            return k || (k = E.create()), w.dimValue != null && w.hasOwnProperty("dimValue") && k.uint32(8).int64(w.dimValue), w.dimParam != null && w.hasOwnProperty("dimParam") && k.uint32(18).string(w.dimParam), w.denotation != null && w.hasOwnProperty("denotation") && k.uint32(26).string(w.denotation), k;
          }, a.encodeDelimited = function(w, k) {
            return this.encode(w, k).ldelim();
          }, a.decode = function(w, k) {
            w instanceof y || (w = y.create(w));
            for (var A = k === void 0 ? w.len : w.pos + k, M = new v.onnx.TensorShapeProto.Dimension(); w.pos < A; ) {
              var $ = w.uint32();
              switch ($ >>> 3) {
                case 1:
                  M.dimValue = w.int64();
                  break;
                case 2:
                  M.dimParam = w.string();
                  break;
                case 3:
                  M.denotation = w.string();
                  break;
                default:
                  w.skipType(7 & $);
              }
            }
            return M;
          }, a.decodeDelimited = function(w) {
            return w instanceof y || (w = new y(w)), this.decode(w, w.uint32());
          }, a.verify = function(w) {
            if (typeof w != "object" || w === null) return "object expected";
            var k = {};
            if (w.dimValue != null && w.hasOwnProperty("dimValue") && (k.value = 1, !(x.isInteger(w.dimValue) || w.dimValue && x.isInteger(w.dimValue.low) && x.isInteger(w.dimValue.high)))) return "dimValue: integer|Long expected";
            if (w.dimParam != null && w.hasOwnProperty("dimParam")) {
              if (k.value === 1) return "value: multiple values";
              if (k.value = 1, !x.isString(w.dimParam)) return "dimParam: string expected";
            }
            return w.denotation != null && w.hasOwnProperty("denotation") && !x.isString(w.denotation) ? "denotation: string expected" : null;
          }, a.fromObject = function(w) {
            if (w instanceof v.onnx.TensorShapeProto.Dimension) return w;
            var k = new v.onnx.TensorShapeProto.Dimension();
            return w.dimValue != null && (x.Long ? (k.dimValue = x.Long.fromValue(w.dimValue)).unsigned = !1 : typeof w.dimValue == "string" ? k.dimValue = parseInt(w.dimValue, 10) : typeof w.dimValue == "number" ? k.dimValue = w.dimValue : typeof w.dimValue == "object" && (k.dimValue = new x.LongBits(w.dimValue.low >>> 0, w.dimValue.high >>> 0).toNumber())), w.dimParam != null && (k.dimParam = String(w.dimParam)), w.denotation != null && (k.denotation = String(w.denotation)), k;
          }, a.toObject = function(w, k) {
            k || (k = {});
            var A = {};
            return k.defaults && (A.denotation = ""), w.dimValue != null && w.hasOwnProperty("dimValue") && (typeof w.dimValue == "number" ? A.dimValue = k.longs === String ? String(w.dimValue) : w.dimValue : A.dimValue = k.longs === String ? x.Long.prototype.toString.call(w.dimValue) : k.longs === Number ? new x.LongBits(w.dimValue.low >>> 0, w.dimValue.high >>> 0).toNumber() : w.dimValue, k.oneofs && (A.value = "dimValue")), w.dimParam != null && w.hasOwnProperty("dimParam") && (A.dimParam = w.dimParam, k.oneofs && (A.value = "dimParam")), w.denotation != null && w.hasOwnProperty("denotation") && (A.denotation = w.denotation), A;
          }, a.prototype.toJSON = function() {
            return this.constructor.toObject(this, g.util.toJSONOptions);
          }, a;
        }(), h;
      }(), _.TypeProto = function() {
        function h(b) {
          if (b) for (var w = Object.keys(b), k = 0; k < w.length; ++k) b[w[k]] != null && (this[w[k]] = b[w[k]]);
        }
        var a;
        return h.prototype.tensorType = null, h.prototype.denotation = "", Object.defineProperty(h.prototype, "value", { get: x.oneOfGetter(a = ["tensorType"]), set: x.oneOfSetter(a) }), h.create = function(b) {
          return new h(b);
        }, h.encode = function(b, w) {
          return w || (w = E.create()), b.tensorType != null && b.hasOwnProperty("tensorType") && v.onnx.TypeProto.Tensor.encode(b.tensorType, w.uint32(10).fork()).ldelim(), b.denotation != null && b.hasOwnProperty("denotation") && w.uint32(50).string(b.denotation), w;
        }, h.encodeDelimited = function(b, w) {
          return this.encode(b, w).ldelim();
        }, h.decode = function(b, w) {
          b instanceof y || (b = y.create(b));
          for (var k = w === void 0 ? b.len : b.pos + w, A = new v.onnx.TypeProto(); b.pos < k; ) {
            var M = b.uint32();
            switch (M >>> 3) {
              case 1:
                A.tensorType = v.onnx.TypeProto.Tensor.decode(b, b.uint32());
                break;
              case 6:
                A.denotation = b.string();
                break;
              default:
                b.skipType(7 & M);
            }
          }
          return A;
        }, h.decodeDelimited = function(b) {
          return b instanceof y || (b = new y(b)), this.decode(b, b.uint32());
        }, h.verify = function(b) {
          if (typeof b != "object" || b === null) return "object expected";
          if (b.tensorType != null && b.hasOwnProperty("tensorType")) {
            var w = v.onnx.TypeProto.Tensor.verify(b.tensorType);
            if (w) return "tensorType." + w;
          }
          return b.denotation != null && b.hasOwnProperty("denotation") && !x.isString(b.denotation) ? "denotation: string expected" : null;
        }, h.fromObject = function(b) {
          if (b instanceof v.onnx.TypeProto) return b;
          var w = new v.onnx.TypeProto();
          if (b.tensorType != null) {
            if (typeof b.tensorType != "object") throw TypeError(".onnx.TypeProto.tensorType: object expected");
            w.tensorType = v.onnx.TypeProto.Tensor.fromObject(b.tensorType);
          }
          return b.denotation != null && (w.denotation = String(b.denotation)), w;
        }, h.toObject = function(b, w) {
          w || (w = {});
          var k = {};
          return w.defaults && (k.denotation = ""), b.tensorType != null && b.hasOwnProperty("tensorType") && (k.tensorType = v.onnx.TypeProto.Tensor.toObject(b.tensorType, w), w.oneofs && (k.value = "tensorType")), b.denotation != null && b.hasOwnProperty("denotation") && (k.denotation = b.denotation), k;
        }, h.prototype.toJSON = function() {
          return this.constructor.toObject(this, g.util.toJSONOptions);
        }, h.Tensor = function() {
          function b(w) {
            if (w) for (var k = Object.keys(w), A = 0; A < k.length; ++A) w[k[A]] != null && (this[k[A]] = w[k[A]]);
          }
          return b.prototype.elemType = 0, b.prototype.shape = null, b.create = function(w) {
            return new b(w);
          }, b.encode = function(w, k) {
            return k || (k = E.create()), w.elemType != null && w.hasOwnProperty("elemType") && k.uint32(8).int32(w.elemType), w.shape != null && w.hasOwnProperty("shape") && v.onnx.TensorShapeProto.encode(w.shape, k.uint32(18).fork()).ldelim(), k;
          }, b.encodeDelimited = function(w, k) {
            return this.encode(w, k).ldelim();
          }, b.decode = function(w, k) {
            w instanceof y || (w = y.create(w));
            for (var A = k === void 0 ? w.len : w.pos + k, M = new v.onnx.TypeProto.Tensor(); w.pos < A; ) {
              var $ = w.uint32();
              switch ($ >>> 3) {
                case 1:
                  M.elemType = w.int32();
                  break;
                case 2:
                  M.shape = v.onnx.TensorShapeProto.decode(w, w.uint32());
                  break;
                default:
                  w.skipType(7 & $);
              }
            }
            return M;
          }, b.decodeDelimited = function(w) {
            return w instanceof y || (w = new y(w)), this.decode(w, w.uint32());
          }, b.verify = function(w) {
            if (typeof w != "object" || w === null) return "object expected";
            if (w.elemType != null && w.hasOwnProperty("elemType") && !x.isInteger(w.elemType)) return "elemType: integer expected";
            if (w.shape != null && w.hasOwnProperty("shape")) {
              var k = v.onnx.TensorShapeProto.verify(w.shape);
              if (k) return "shape." + k;
            }
            return null;
          }, b.fromObject = function(w) {
            if (w instanceof v.onnx.TypeProto.Tensor) return w;
            var k = new v.onnx.TypeProto.Tensor();
            if (w.elemType != null && (k.elemType = 0 | w.elemType), w.shape != null) {
              if (typeof w.shape != "object") throw TypeError(".onnx.TypeProto.Tensor.shape: object expected");
              k.shape = v.onnx.TensorShapeProto.fromObject(w.shape);
            }
            return k;
          }, b.toObject = function(w, k) {
            k || (k = {});
            var A = {};
            return k.defaults && (A.elemType = 0, A.shape = null), w.elemType != null && w.hasOwnProperty("elemType") && (A.elemType = w.elemType), w.shape != null && w.hasOwnProperty("shape") && (A.shape = v.onnx.TensorShapeProto.toObject(w.shape, k)), A;
          }, b.prototype.toJSON = function() {
            return this.constructor.toObject(this, g.util.toJSONOptions);
          }, b;
        }(), h;
      }(), _.OperatorSetIdProto = function() {
        function h(a) {
          if (a) for (var b = Object.keys(a), w = 0; w < b.length; ++w) a[b[w]] != null && (this[b[w]] = a[b[w]]);
        }
        return h.prototype.domain = "", h.prototype.version = x.Long ? x.Long.fromBits(0, 0, !1) : 0, h.create = function(a) {
          return new h(a);
        }, h.encode = function(a, b) {
          return b || (b = E.create()), a.domain != null && a.hasOwnProperty("domain") && b.uint32(10).string(a.domain), a.version != null && a.hasOwnProperty("version") && b.uint32(16).int64(a.version), b;
        }, h.encodeDelimited = function(a, b) {
          return this.encode(a, b).ldelim();
        }, h.decode = function(a, b) {
          a instanceof y || (a = y.create(a));
          for (var w = b === void 0 ? a.len : a.pos + b, k = new v.onnx.OperatorSetIdProto(); a.pos < w; ) {
            var A = a.uint32();
            switch (A >>> 3) {
              case 1:
                k.domain = a.string();
                break;
              case 2:
                k.version = a.int64();
                break;
              default:
                a.skipType(7 & A);
            }
          }
          return k;
        }, h.decodeDelimited = function(a) {
          return a instanceof y || (a = new y(a)), this.decode(a, a.uint32());
        }, h.verify = function(a) {
          return typeof a != "object" || a === null ? "object expected" : a.domain != null && a.hasOwnProperty("domain") && !x.isString(a.domain) ? "domain: string expected" : a.version != null && a.hasOwnProperty("version") && !(x.isInteger(a.version) || a.version && x.isInteger(a.version.low) && x.isInteger(a.version.high)) ? "version: integer|Long expected" : null;
        }, h.fromObject = function(a) {
          if (a instanceof v.onnx.OperatorSetIdProto) return a;
          var b = new v.onnx.OperatorSetIdProto();
          return a.domain != null && (b.domain = String(a.domain)), a.version != null && (x.Long ? (b.version = x.Long.fromValue(a.version)).unsigned = !1 : typeof a.version == "string" ? b.version = parseInt(a.version, 10) : typeof a.version == "number" ? b.version = a.version : typeof a.version == "object" && (b.version = new x.LongBits(a.version.low >>> 0, a.version.high >>> 0).toNumber())), b;
        }, h.toObject = function(a, b) {
          b || (b = {});
          var w = {};
          if (b.defaults) if (w.domain = "", x.Long) {
            var k = new x.Long(0, 0, !1);
            w.version = b.longs === String ? k.toString() : b.longs === Number ? k.toNumber() : k;
          } else w.version = b.longs === String ? "0" : 0;
          return a.domain != null && a.hasOwnProperty("domain") && (w.domain = a.domain), a.version != null && a.hasOwnProperty("version") && (typeof a.version == "number" ? w.version = b.longs === String ? String(a.version) : a.version : w.version = b.longs === String ? x.Long.prototype.toString.call(a.version) : b.longs === Number ? new x.LongBits(a.version.low >>> 0, a.version.high >>> 0).toNumber() : a.version), w;
        }, h.prototype.toJSON = function() {
          return this.constructor.toObject(this, g.util.toJSONOptions);
        }, h;
      }(), _), s.exports = v;
    }, 2100: (s, e, r) => {
      s.exports = r(9482);
    }, 9482: (s, e, r) => {
      var o = e;
      function m() {
        o.util._configure(), o.Writer._configure(o.BufferWriter), o.Reader._configure(o.BufferReader);
      }
      o.build = "minimal", o.Writer = r(1173), o.BufferWriter = r(3155), o.Reader = r(1408), o.BufferReader = r(593), o.util = r(9693), o.rpc = r(5994), o.roots = r(5054), o.configure = m, m();
    }, 1408: (s, e, r) => {
      s.exports = E;
      var o, m = r(9693), _ = m.LongBits, g = m.utf8;
      function y(k, A) {
        return RangeError("index out of range: " + k.pos + " + " + (A || 1) + " > " + k.len);
      }
      function E(k) {
        this.buf = k, this.pos = 0, this.len = k.length;
      }
      var x, v = typeof Uint8Array < "u" ? function(k) {
        if (k instanceof Uint8Array || Array.isArray(k)) return new E(k);
        throw Error("illegal buffer");
      } : function(k) {
        if (Array.isArray(k)) return new E(k);
        throw Error("illegal buffer");
      }, h = function() {
        return m.Buffer ? function(k) {
          return (E.create = function(A) {
            return m.Buffer.isBuffer(A) ? new o(A) : v(A);
          })(k);
        } : v;
      };
      function a() {
        var k = new _(0, 0), A = 0;
        if (!(this.len - this.pos > 4)) {
          for (; A < 3; ++A) {
            if (this.pos >= this.len) throw y(this);
            if (k.lo = (k.lo | (127 & this.buf[this.pos]) << 7 * A) >>> 0, this.buf[this.pos++] < 128) return k;
          }
          return k.lo = (k.lo | (127 & this.buf[this.pos++]) << 7 * A) >>> 0, k;
        }
        for (; A < 4; ++A) if (k.lo = (k.lo | (127 & this.buf[this.pos]) << 7 * A) >>> 0, this.buf[this.pos++] < 128) return k;
        if (k.lo = (k.lo | (127 & this.buf[this.pos]) << 28) >>> 0, k.hi = (k.hi | (127 & this.buf[this.pos]) >> 4) >>> 0, this.buf[this.pos++] < 128) return k;
        if (A = 0, this.len - this.pos > 4) {
          for (; A < 5; ++A) if (k.hi = (k.hi | (127 & this.buf[this.pos]) << 7 * A + 3) >>> 0, this.buf[this.pos++] < 128) return k;
        } else for (; A < 5; ++A) {
          if (this.pos >= this.len) throw y(this);
          if (k.hi = (k.hi | (127 & this.buf[this.pos]) << 7 * A + 3) >>> 0, this.buf[this.pos++] < 128) return k;
        }
        throw Error("invalid varint encoding");
      }
      function b(k, A) {
        return (k[A - 4] | k[A - 3] << 8 | k[A - 2] << 16 | k[A - 1] << 24) >>> 0;
      }
      function w() {
        if (this.pos + 8 > this.len) throw y(this, 8);
        return new _(b(this.buf, this.pos += 4), b(this.buf, this.pos += 4));
      }
      E.create = h(), E.prototype._slice = m.Array.prototype.subarray || m.Array.prototype.slice, E.prototype.uint32 = (x = 4294967295, function() {
        if (x = (127 & this.buf[this.pos]) >>> 0, this.buf[this.pos++] < 128 || (x = (x | (127 & this.buf[this.pos]) << 7) >>> 0, this.buf[this.pos++] < 128) || (x = (x | (127 & this.buf[this.pos]) << 14) >>> 0, this.buf[this.pos++] < 128) || (x = (x | (127 & this.buf[this.pos]) << 21) >>> 0, this.buf[this.pos++] < 128) || (x = (x | (15 & this.buf[this.pos]) << 28) >>> 0, this.buf[this.pos++] < 128)) return x;
        if ((this.pos += 5) > this.len) throw this.pos = this.len, y(this, 10);
        return x;
      }), E.prototype.int32 = function() {
        return 0 | this.uint32();
      }, E.prototype.sint32 = function() {
        var k = this.uint32();
        return k >>> 1 ^ -(1 & k) | 0;
      }, E.prototype.bool = function() {
        return this.uint32() !== 0;
      }, E.prototype.fixed32 = function() {
        if (this.pos + 4 > this.len) throw y(this, 4);
        return b(this.buf, this.pos += 4);
      }, E.prototype.sfixed32 = function() {
        if (this.pos + 4 > this.len) throw y(this, 4);
        return 0 | b(this.buf, this.pos += 4);
      }, E.prototype.float = function() {
        if (this.pos + 4 > this.len) throw y(this, 4);
        var k = m.float.readFloatLE(this.buf, this.pos);
        return this.pos += 4, k;
      }, E.prototype.double = function() {
        if (this.pos + 8 > this.len) throw y(this, 4);
        var k = m.float.readDoubleLE(this.buf, this.pos);
        return this.pos += 8, k;
      }, E.prototype.bytes = function() {
        var k = this.uint32(), A = this.pos, M = this.pos + k;
        if (M > this.len) throw y(this, k);
        return this.pos += k, Array.isArray(this.buf) ? this.buf.slice(A, M) : A === M ? new this.buf.constructor(0) : this._slice.call(this.buf, A, M);
      }, E.prototype.string = function() {
        var k = this.bytes();
        return g.read(k, 0, k.length);
      }, E.prototype.skip = function(k) {
        if (typeof k == "number") {
          if (this.pos + k > this.len) throw y(this, k);
          this.pos += k;
        } else do
          if (this.pos >= this.len) throw y(this);
        while (128 & this.buf[this.pos++]);
        return this;
      }, E.prototype.skipType = function(k) {
        switch (k) {
          case 0:
            this.skip();
            break;
          case 1:
            this.skip(8);
            break;
          case 2:
            this.skip(this.uint32());
            break;
          case 3:
            for (; (k = 7 & this.uint32()) != 4; ) this.skipType(k);
            break;
          case 5:
            this.skip(4);
            break;
          default:
            throw Error("invalid wire type " + k + " at offset " + this.pos);
        }
        return this;
      }, E._configure = function(k) {
        o = k, E.create = h(), o._configure();
        var A = m.Long ? "toLong" : "toNumber";
        m.merge(E.prototype, { int64: function() {
          return a.call(this)[A](!1);
        }, uint64: function() {
          return a.call(this)[A](!0);
        }, sint64: function() {
          return a.call(this).zzDecode()[A](!1);
        }, fixed64: function() {
          return w.call(this)[A](!0);
        }, sfixed64: function() {
          return w.call(this)[A](!1);
        } });
      };
    }, 593: (s, e, r) => {
      s.exports = _;
      var o = r(1408);
      (_.prototype = Object.create(o.prototype)).constructor = _;
      var m = r(9693);
      function _(g) {
        o.call(this, g);
      }
      _._configure = function() {
        m.Buffer && (_.prototype._slice = m.Buffer.prototype.slice);
      }, _.prototype.string = function() {
        var g = this.uint32();
        return this.buf.utf8Slice ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + g, this.len)) : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + g, this.len));
      }, _._configure();
    }, 5054: (s) => {
      s.exports = {};
    }, 5994: (s, e, r) => {
      e.Service = r(7948);
    }, 7948: (s, e, r) => {
      s.exports = m;
      var o = r(9693);
      function m(_, g, y) {
        if (typeof _ != "function") throw TypeError("rpcImpl must be a function");
        o.EventEmitter.call(this), this.rpcImpl = _, this.requestDelimited = !!g, this.responseDelimited = !!y;
      }
      (m.prototype = Object.create(o.EventEmitter.prototype)).constructor = m, m.prototype.rpcCall = function _(g, y, E, x, v) {
        if (!x) throw TypeError("request must be specified");
        var h = this;
        if (!v) return o.asPromise(_, h, g, y, E, x);
        if (h.rpcImpl) try {
          return h.rpcImpl(g, y[h.requestDelimited ? "encodeDelimited" : "encode"](x).finish(), function(a, b) {
            if (a) return h.emit("error", a, g), v(a);
            if (b !== null) {
              if (!(b instanceof E)) try {
                b = E[h.responseDelimited ? "decodeDelimited" : "decode"](b);
              } catch (w) {
                return h.emit("error", w, g), v(w);
              }
              return h.emit("data", b, g), v(null, b);
            }
            h.end(!0);
          });
        } catch (a) {
          return h.emit("error", a, g), void setTimeout(function() {
            v(a);
          }, 0);
        }
        else setTimeout(function() {
          v(Error("already ended"));
        }, 0);
      }, m.prototype.end = function(_) {
        return this.rpcImpl && (_ || this.rpcImpl(null, null, null), this.rpcImpl = null, this.emit("end").off()), this;
      };
    }, 1945: (s, e, r) => {
      s.exports = m;
      var o = r(9693);
      function m(E, x) {
        this.lo = E >>> 0, this.hi = x >>> 0;
      }
      var _ = m.zero = new m(0, 0);
      _.toNumber = function() {
        return 0;
      }, _.zzEncode = _.zzDecode = function() {
        return this;
      }, _.length = function() {
        return 1;
      };
      var g = m.zeroHash = "\0\0\0\0\0\0\0\0";
      m.fromNumber = function(E) {
        if (E === 0) return _;
        var x = E < 0;
        x && (E = -E);
        var v = E >>> 0, h = (E - v) / 4294967296 >>> 0;
        return x && (h = ~h >>> 0, v = ~v >>> 0, ++v > 4294967295 && (v = 0, ++h > 4294967295 && (h = 0))), new m(v, h);
      }, m.from = function(E) {
        if (typeof E == "number") return m.fromNumber(E);
        if (o.isString(E)) {
          if (!o.Long) return m.fromNumber(parseInt(E, 10));
          E = o.Long.fromString(E);
        }
        return E.low || E.high ? new m(E.low >>> 0, E.high >>> 0) : _;
      }, m.prototype.toNumber = function(E) {
        if (!E && this.hi >>> 31) {
          var x = 1 + ~this.lo >>> 0, v = ~this.hi >>> 0;
          return x || (v = v + 1 >>> 0), -(x + 4294967296 * v);
        }
        return this.lo + 4294967296 * this.hi;
      }, m.prototype.toLong = function(E) {
        return o.Long ? new o.Long(0 | this.lo, 0 | this.hi, !!E) : { low: 0 | this.lo, high: 0 | this.hi, unsigned: !!E };
      };
      var y = String.prototype.charCodeAt;
      m.fromHash = function(E) {
        return E === g ? _ : new m((y.call(E, 0) | y.call(E, 1) << 8 | y.call(E, 2) << 16 | y.call(E, 3) << 24) >>> 0, (y.call(E, 4) | y.call(E, 5) << 8 | y.call(E, 6) << 16 | y.call(E, 7) << 24) >>> 0);
      }, m.prototype.toHash = function() {
        return String.fromCharCode(255 & this.lo, this.lo >>> 8 & 255, this.lo >>> 16 & 255, this.lo >>> 24, 255 & this.hi, this.hi >>> 8 & 255, this.hi >>> 16 & 255, this.hi >>> 24);
      }, m.prototype.zzEncode = function() {
        var E = this.hi >> 31;
        return this.hi = ((this.hi << 1 | this.lo >>> 31) ^ E) >>> 0, this.lo = (this.lo << 1 ^ E) >>> 0, this;
      }, m.prototype.zzDecode = function() {
        var E = -(1 & this.lo);
        return this.lo = ((this.lo >>> 1 | this.hi << 31) ^ E) >>> 0, this.hi = (this.hi >>> 1 ^ E) >>> 0, this;
      }, m.prototype.length = function() {
        var E = this.lo, x = (this.lo >>> 28 | this.hi << 4) >>> 0, v = this.hi >>> 24;
        return v === 0 ? x === 0 ? E < 16384 ? E < 128 ? 1 : 2 : E < 2097152 ? 3 : 4 : x < 16384 ? x < 128 ? 5 : 6 : x < 2097152 ? 7 : 8 : v < 128 ? 9 : 10;
      };
    }, 9693: function(s, e, r) {
      var o = e;
      function m(g, y, E) {
        for (var x = Object.keys(y), v = 0; v < x.length; ++v) g[x[v]] !== void 0 && E || (g[x[v]] = y[x[v]]);
        return g;
      }
      function _(g) {
        function y(E, x) {
          if (!(this instanceof y)) return new y(E, x);
          Object.defineProperty(this, "message", { get: function() {
            return E;
          } }), Error.captureStackTrace ? Error.captureStackTrace(this, y) : Object.defineProperty(this, "stack", { value: new Error().stack || "" }), x && m(this, x);
        }
        return (y.prototype = Object.create(Error.prototype)).constructor = y, Object.defineProperty(y.prototype, "name", { get: function() {
          return g;
        } }), y.prototype.toString = function() {
          return this.name + ": " + this.message;
        }, y;
      }
      o.asPromise = r(4537), o.base64 = r(7419), o.EventEmitter = r(9211), o.float = r(945), o.inquire = r(7199), o.utf8 = r(4997), o.pool = r(6662), o.LongBits = r(1945), o.isNode = !!(r.g !== void 0 && r.g && r.g.process && r.g.process.versions && r.g.process.versions.node), o.global = o.isNode && r.g || typeof window < "u" && window || typeof self < "u" && self || this, o.emptyArray = Object.freeze ? Object.freeze([]) : [], o.emptyObject = Object.freeze ? Object.freeze({}) : {}, o.isInteger = Number.isInteger || function(g) {
        return typeof g == "number" && isFinite(g) && Math.floor(g) === g;
      }, o.isString = function(g) {
        return typeof g == "string" || g instanceof String;
      }, o.isObject = function(g) {
        return g && typeof g == "object";
      }, o.isset = o.isSet = function(g, y) {
        var E = g[y];
        return !(E == null || !g.hasOwnProperty(y)) && (typeof E != "object" || (Array.isArray(E) ? E.length : Object.keys(E).length) > 0);
      }, o.Buffer = function() {
        try {
          var g = o.inquire("buffer").Buffer;
          return g.prototype.utf8Write ? g : null;
        } catch {
          return null;
        }
      }(), o._Buffer_from = null, o._Buffer_allocUnsafe = null, o.newBuffer = function(g) {
        return typeof g == "number" ? o.Buffer ? o._Buffer_allocUnsafe(g) : new o.Array(g) : o.Buffer ? o._Buffer_from(g) : typeof Uint8Array > "u" ? g : new Uint8Array(g);
      }, o.Array = typeof Uint8Array < "u" ? Uint8Array : Array, o.Long = o.global.dcodeIO && o.global.dcodeIO.Long || o.global.Long || o.inquire("long"), o.key2Re = /^true|false|0|1$/, o.key32Re = /^-?(?:0|[1-9][0-9]*)$/, o.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/, o.longToHash = function(g) {
        return g ? o.LongBits.from(g).toHash() : o.LongBits.zeroHash;
      }, o.longFromHash = function(g, y) {
        var E = o.LongBits.fromHash(g);
        return o.Long ? o.Long.fromBits(E.lo, E.hi, y) : E.toNumber(!!y);
      }, o.merge = m, o.lcFirst = function(g) {
        return g.charAt(0).toLowerCase() + g.substring(1);
      }, o.newError = _, o.ProtocolError = _("ProtocolError"), o.oneOfGetter = function(g) {
        for (var y = {}, E = 0; E < g.length; ++E) y[g[E]] = 1;
        return function() {
          for (var x = Object.keys(this), v = x.length - 1; v > -1; --v) if (y[x[v]] === 1 && this[x[v]] !== void 0 && this[x[v]] !== null) return x[v];
        };
      }, o.oneOfSetter = function(g) {
        return function(y) {
          for (var E = 0; E < g.length; ++E) g[E] !== y && delete this[g[E]];
        };
      }, o.toJSONOptions = { longs: String, enums: String, bytes: String, json: !0 }, o._configure = function() {
        var g = o.Buffer;
        g ? (o._Buffer_from = g.from !== Uint8Array.from && g.from || function(y, E) {
          return new g(y, E);
        }, o._Buffer_allocUnsafe = g.allocUnsafe || function(y) {
          return new g(y);
        }) : o._Buffer_from = o._Buffer_allocUnsafe = null;
      };
    }, 1173: (s, e, r) => {
      s.exports = h;
      var o, m = r(9693), _ = m.LongBits, g = m.base64, y = m.utf8;
      function E($, O, C) {
        this.fn = $, this.len = O, this.next = void 0, this.val = C;
      }
      function x() {
      }
      function v($) {
        this.head = $.head, this.tail = $.tail, this.len = $.len, this.next = $.states;
      }
      function h() {
        this.len = 0, this.head = new E(x, 0, 0), this.tail = this.head, this.states = null;
      }
      var a = function() {
        return m.Buffer ? function() {
          return (h.create = function() {
            return new o();
          })();
        } : function() {
          return new h();
        };
      };
      function b($, O, C) {
        O[C] = 255 & $;
      }
      function w($, O) {
        this.len = $, this.next = void 0, this.val = O;
      }
      function k($, O, C) {
        for (; $.hi; ) O[C++] = 127 & $.lo | 128, $.lo = ($.lo >>> 7 | $.hi << 25) >>> 0, $.hi >>>= 7;
        for (; $.lo > 127; ) O[C++] = 127 & $.lo | 128, $.lo = $.lo >>> 7;
        O[C++] = $.lo;
      }
      function A($, O, C) {
        O[C] = 255 & $, O[C + 1] = $ >>> 8 & 255, O[C + 2] = $ >>> 16 & 255, O[C + 3] = $ >>> 24;
      }
      h.create = a(), h.alloc = function($) {
        return new m.Array($);
      }, m.Array !== Array && (h.alloc = m.pool(h.alloc, m.Array.prototype.subarray)), h.prototype._push = function($, O, C) {
        return this.tail = this.tail.next = new E($, O, C), this.len += O, this;
      }, w.prototype = Object.create(E.prototype), w.prototype.fn = function($, O, C) {
        for (; $ > 127; ) O[C++] = 127 & $ | 128, $ >>>= 7;
        O[C] = $;
      }, h.prototype.uint32 = function($) {
        return this.len += (this.tail = this.tail.next = new w(($ >>>= 0) < 128 ? 1 : $ < 16384 ? 2 : $ < 2097152 ? 3 : $ < 268435456 ? 4 : 5, $)).len, this;
      }, h.prototype.int32 = function($) {
        return $ < 0 ? this._push(k, 10, _.fromNumber($)) : this.uint32($);
      }, h.prototype.sint32 = function($) {
        return this.uint32(($ << 1 ^ $ >> 31) >>> 0);
      }, h.prototype.uint64 = function($) {
        var O = _.from($);
        return this._push(k, O.length(), O);
      }, h.prototype.int64 = h.prototype.uint64, h.prototype.sint64 = function($) {
        var O = _.from($).zzEncode();
        return this._push(k, O.length(), O);
      }, h.prototype.bool = function($) {
        return this._push(b, 1, $ ? 1 : 0);
      }, h.prototype.fixed32 = function($) {
        return this._push(A, 4, $ >>> 0);
      }, h.prototype.sfixed32 = h.prototype.fixed32, h.prototype.fixed64 = function($) {
        var O = _.from($);
        return this._push(A, 4, O.lo)._push(A, 4, O.hi);
      }, h.prototype.sfixed64 = h.prototype.fixed64, h.prototype.float = function($) {
        return this._push(m.float.writeFloatLE, 4, $);
      }, h.prototype.double = function($) {
        return this._push(m.float.writeDoubleLE, 8, $);
      };
      var M = m.Array.prototype.set ? function($, O, C) {
        O.set($, C);
      } : function($, O, C) {
        for (var P = 0; P < $.length; ++P) O[C + P] = $[P];
      };
      h.prototype.bytes = function($) {
        var O = $.length >>> 0;
        if (!O) return this._push(b, 1, 0);
        if (m.isString($)) {
          var C = h.alloc(O = g.length($));
          g.decode($, C, 0), $ = C;
        }
        return this.uint32(O)._push(M, O, $);
      }, h.prototype.string = function($) {
        var O = y.length($);
        return O ? this.uint32(O)._push(y.write, O, $) : this._push(b, 1, 0);
      }, h.prototype.fork = function() {
        return this.states = new v(this), this.head = this.tail = new E(x, 0, 0), this.len = 0, this;
      }, h.prototype.reset = function() {
        return this.states ? (this.head = this.states.head, this.tail = this.states.tail, this.len = this.states.len, this.states = this.states.next) : (this.head = this.tail = new E(x, 0, 0), this.len = 0), this;
      }, h.prototype.ldelim = function() {
        var $ = this.head, O = this.tail, C = this.len;
        return this.reset().uint32(C), C && (this.tail.next = $.next, this.tail = O, this.len += C), this;
      }, h.prototype.finish = function() {
        for (var $ = this.head.next, O = this.constructor.alloc(this.len), C = 0; $; ) $.fn($.val, O, C), C += $.len, $ = $.next;
        return O;
      }, h._configure = function($) {
        o = $, h.create = a(), o._configure();
      };
    }, 3155: (s, e, r) => {
      s.exports = _;
      var o = r(1173);
      (_.prototype = Object.create(o.prototype)).constructor = _;
      var m = r(9693);
      function _() {
        o.call(this);
      }
      function g(y, E, x) {
        y.length < 40 ? m.utf8.write(y, E, x) : E.utf8Write ? E.utf8Write(y, x) : E.write(y, x);
      }
      _._configure = function() {
        _.alloc = m._Buffer_allocUnsafe, _.writeBytesBuffer = m.Buffer && m.Buffer.prototype instanceof Uint8Array && m.Buffer.prototype.set.name === "set" ? function(y, E, x) {
          E.set(y, x);
        } : function(y, E, x) {
          if (y.copy) y.copy(E, x, 0, y.length);
          else for (var v = 0; v < y.length; ) E[x++] = y[v++];
        };
      }, _.prototype.bytes = function(y) {
        m.isString(y) && (y = m._Buffer_from(y, "base64"));
        var E = y.length >>> 0;
        return this.uint32(E), E && this._push(_.writeBytesBuffer, E, y), this;
      }, _.prototype.string = function(y) {
        var E = m.Buffer.byteLength(y);
        return this.uint32(E), E && this._push(g, E, y), this;
      }, _._configure();
    }, 7714: (s, e, r) => {
      e.R = void 0;
      const o = r(6919), m = r(7448);
      e.R = new class {
        async init() {
        }
        async createSessionHandler(_, g) {
          const y = new o.Session(g);
          return await y.loadModel(_), new m.OnnxjsSessionHandler(y);
        }
      }();
    }, 4200: (s, e, r) => {
      e.c8 = e.rX = void 0;
      const o = r(1670), m = r(5381), _ = r(2157), g = r(2306);
      e.rX = () => {
        if ((typeof o.env.wasm.initTimeout != "number" || o.env.wasm.initTimeout < 0) && (o.env.wasm.initTimeout = 0), typeof o.env.wasm.simd != "boolean" && (o.env.wasm.simd = !0), typeof o.env.wasm.proxy != "boolean" && (o.env.wasm.proxy = !1), typeof o.env.wasm.numThreads != "number" || !Number.isInteger(o.env.wasm.numThreads) || o.env.wasm.numThreads <= 0) {
          const y = typeof navigator > "u" ? (0, m.cpus)().length : navigator.hardwareConcurrency;
          o.env.wasm.numThreads = Math.min(4, Math.ceil((y || 1) / 2));
        }
      }, e.c8 = new class {
        async init() {
          (0, e.rX)(), await (0, _.initWasm)();
        }
        async createSessionHandler(y, E) {
          const x = new g.OnnxruntimeWebAssemblySessionHandler();
          return await x.loadModel(y, E), Promise.resolve(x);
        }
      }();
    }, 6018: function(s, e, r) {
      var o = this && this.__createBinding || (Object.create ? function(g, y, E, x) {
        x === void 0 && (x = E);
        var v = Object.getOwnPropertyDescriptor(y, E);
        v && !("get" in v ? !y.__esModule : v.writable || v.configurable) || (v = { enumerable: !0, get: function() {
          return y[E];
        } }), Object.defineProperty(g, x, v);
      } : function(g, y, E, x) {
        x === void 0 && (x = E), g[x] = y[E];
      }), m = this && this.__exportStar || function(g, y) {
        for (var E in g) E === "default" || Object.prototype.hasOwnProperty.call(y, E) || o(y, g, E);
      };
      Object.defineProperty(e, "__esModule", { value: !0 }), m(r(1670), e);
      const _ = r(1670);
      {
        const g = r(7714).R;
        (0, _.registerBackend)("webgl", g, -10);
      }
      {
        const g = r(4200).c8;
        (0, _.registerBackend)("cpu", g, 10), (0, _.registerBackend)("wasm", g, 10), (0, _.registerBackend)("xnnpack", g, 9);
      }
    }, 246: (s, e) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.createAttributeWithCacheKey = void 0;
      class r {
        constructor(m) {
          Object.assign(this, m);
        }
        get cacheKey() {
          return this._cacheKey || (this._cacheKey = Object.getOwnPropertyNames(this).sort().map((m) => `${this[m]}`).join(";")), this._cacheKey;
        }
      }
      e.createAttributeWithCacheKey = (o) => new r(o);
    }, 7778: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.Attribute = void 0;
      const o = r(1446), m = r(9395), _ = r(9162), g = r(2517);
      var y = m.onnxruntime.experimental.fbs;
      class E {
        constructor(v) {
          if (this._attributes = /* @__PURE__ */ new Map(), v != null) {
            for (const h of v) h instanceof o.onnx.AttributeProto ? this._attributes.set(h.name, [E.getValue(h), E.getType(h)]) : h instanceof y.Attribute && this._attributes.set(h.name(), [E.getValue(h), E.getType(h)]);
            if (this._attributes.size < v.length) throw new Error("duplicated attribute names");
          }
        }
        set(v, h, a) {
          this._attributes.set(v, [a, h]);
        }
        delete(v) {
          this._attributes.delete(v);
        }
        getFloat(v, h) {
          return this.get(v, "float", h);
        }
        getInt(v, h) {
          return this.get(v, "int", h);
        }
        getString(v, h) {
          return this.get(v, "string", h);
        }
        getTensor(v, h) {
          return this.get(v, "tensor", h);
        }
        getFloats(v, h) {
          return this.get(v, "floats", h);
        }
        getInts(v, h) {
          return this.get(v, "ints", h);
        }
        getStrings(v, h) {
          return this.get(v, "strings", h);
        }
        getTensors(v, h) {
          return this.get(v, "tensors", h);
        }
        get(v, h, a) {
          const b = this._attributes.get(v);
          if (b === void 0) {
            if (a !== void 0) return a;
            throw new Error(`required attribute not found: ${v}`);
          }
          if (b[1] !== h) throw new Error(`type mismatch: expected ${h} but got ${b[1]}`);
          return b[0];
        }
        static getType(v) {
          const h = v instanceof o.onnx.AttributeProto ? v.type : v.type();
          switch (h) {
            case o.onnx.AttributeProto.AttributeType.FLOAT:
              return "float";
            case o.onnx.AttributeProto.AttributeType.INT:
              return "int";
            case o.onnx.AttributeProto.AttributeType.STRING:
              return "string";
            case o.onnx.AttributeProto.AttributeType.TENSOR:
              return "tensor";
            case o.onnx.AttributeProto.AttributeType.FLOATS:
              return "floats";
            case o.onnx.AttributeProto.AttributeType.INTS:
              return "ints";
            case o.onnx.AttributeProto.AttributeType.STRINGS:
              return "strings";
            case o.onnx.AttributeProto.AttributeType.TENSORS:
              return "tensors";
            default:
              throw new Error(`attribute type is not supported yet: ${o.onnx.AttributeProto.AttributeType[h]}`);
          }
        }
        static getValue(v) {
          const h = v instanceof o.onnx.AttributeProto ? v.type : v.type();
          if (h === o.onnx.AttributeProto.AttributeType.GRAPH || h === o.onnx.AttributeProto.AttributeType.GRAPHS) throw new Error("graph attribute is not supported yet");
          const a = this.getValueNoCheck(v);
          if (h === o.onnx.AttributeProto.AttributeType.INT && g.LongUtil.isLong(a)) return g.LongUtil.longToNumber(a);
          if (h === o.onnx.AttributeProto.AttributeType.INTS) {
            const b = a, w = new Array(b.length);
            for (let k = 0; k < b.length; k++) {
              const A = b[k];
              w[k] = g.LongUtil.longToNumber(A);
            }
            return w;
          }
          if (h === o.onnx.AttributeProto.AttributeType.TENSOR) return v instanceof o.onnx.AttributeProto ? _.Tensor.fromProto(a) : _.Tensor.fromOrtTensor(a);
          if (h === o.onnx.AttributeProto.AttributeType.TENSORS) {
            if (v instanceof o.onnx.AttributeProto) return a.map((b) => _.Tensor.fromProto(b));
            if (v instanceof y.Attribute) return a.map((b) => _.Tensor.fromOrtTensor(b));
          }
          if (h === o.onnx.AttributeProto.AttributeType.STRING && v instanceof o.onnx.AttributeProto) {
            const b = a;
            return (0, g.decodeUtf8String)(b);
          }
          return h === o.onnx.AttributeProto.AttributeType.STRINGS && v instanceof o.onnx.AttributeProto ? a.map(g.decodeUtf8String) : a;
        }
        static getValueNoCheck(v) {
          return v instanceof o.onnx.AttributeProto ? this.getValueNoCheckFromOnnxFormat(v) : this.getValueNoCheckFromOrtFormat(v);
        }
        static getValueNoCheckFromOnnxFormat(v) {
          switch (v.type) {
            case o.onnx.AttributeProto.AttributeType.FLOAT:
              return v.f;
            case o.onnx.AttributeProto.AttributeType.INT:
              return v.i;
            case o.onnx.AttributeProto.AttributeType.STRING:
              return v.s;
            case o.onnx.AttributeProto.AttributeType.TENSOR:
              return v.t;
            case o.onnx.AttributeProto.AttributeType.GRAPH:
              return v.g;
            case o.onnx.AttributeProto.AttributeType.FLOATS:
              return v.floats;
            case o.onnx.AttributeProto.AttributeType.INTS:
              return v.ints;
            case o.onnx.AttributeProto.AttributeType.STRINGS:
              return v.strings;
            case o.onnx.AttributeProto.AttributeType.TENSORS:
              return v.tensors;
            case o.onnx.AttributeProto.AttributeType.GRAPHS:
              return v.graphs;
            default:
              throw new Error(`unsupported attribute type: ${o.onnx.AttributeProto.AttributeType[v.type]}`);
          }
        }
        static getValueNoCheckFromOrtFormat(v) {
          switch (v.type()) {
            case y.AttributeType.FLOAT:
              return v.f();
            case y.AttributeType.INT:
              return v.i();
            case y.AttributeType.STRING:
              return v.s();
            case y.AttributeType.TENSOR:
              return v.t();
            case y.AttributeType.GRAPH:
              return v.g();
            case y.AttributeType.FLOATS:
              return v.floatsArray();
            case y.AttributeType.INTS: {
              const h = [];
              for (let a = 0; a < v.intsLength(); a++) h.push(v.ints(a));
              return h;
            }
            case y.AttributeType.STRINGS: {
              const h = [];
              for (let a = 0; a < v.stringsLength(); a++) h.push(v.strings(a));
              return h;
            }
            case y.AttributeType.TENSORS: {
              const h = [];
              for (let a = 0; a < v.tensorsLength(); a++) h.push(v.tensors(a));
              return h;
            }
            default:
              throw new Error(`unsupported attribute type: ${y.AttributeType[v.type()]}`);
          }
        }
      }
      e.Attribute = E;
    }, 7091: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.resolveBackend = e.backend = void 0;
      const o = r(5038), m = /* @__PURE__ */ new Map();
      async function _(g) {
        const y = e.backend;
        if (y[g] !== void 0 && function(E) {
          const x = E;
          return "initialize" in x && typeof x.initialize == "function" && "createSessionHandler" in x && typeof x.createSessionHandler == "function" && "dispose" in x && typeof x.dispose == "function";
        }(y[g])) {
          const E = y[g];
          let x = E.initialize();
          if (typeof x == "object" && "then" in x && (x = await x), x) return m.set(g, E), E;
        }
      }
      e.backend = { webgl: new o.WebGLBackend() }, e.resolveBackend = async function g(y) {
        if (!y) return g(["webgl"]);
        {
          const E = typeof y == "string" ? [y] : y;
          for (const x of E) {
            const v = m.get(x);
            if (v) return v;
            const h = await _(x);
            if (h) return h;
          }
        }
        throw new Error("no available backend to use");
      };
    }, 5038: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.WebGLBackend = void 0;
      const o = r(1670), m = r(6231), _ = r(6416), g = r(7305);
      e.WebGLBackend = class {
        get contextId() {
          return o.env.webgl.contextId;
        }
        set contextId(y) {
          o.env.webgl.contextId = y;
        }
        get matmulMaxBatchSize() {
          return o.env.webgl.matmulMaxBatchSize;
        }
        set matmulMaxBatchSize(y) {
          o.env.webgl.matmulMaxBatchSize = y;
        }
        get textureCacheMode() {
          return o.env.webgl.textureCacheMode;
        }
        set textureCacheMode(y) {
          o.env.webgl.textureCacheMode = y;
        }
        get pack() {
          return o.env.webgl.pack;
        }
        set pack(y) {
          o.env.webgl.pack = y;
        }
        get async() {
          return o.env.webgl.async;
        }
        set async(y) {
          o.env.webgl.async = y;
        }
        initialize() {
          try {
            return this.glContext = (0, g.createWebGLContext)(this.contextId), typeof this.matmulMaxBatchSize != "number" && (this.matmulMaxBatchSize = 16), typeof this.textureCacheMode != "string" && (this.textureCacheMode = "full"), typeof this.pack != "boolean" && (this.pack = !1), typeof this.async != "boolean" && (this.async = !1), m.Logger.setWithEnv(o.env), m.Logger.verbose("WebGLBackend", `Created WebGLContext: ${typeof this.glContext} with matmulMaxBatchSize: ${this.matmulMaxBatchSize}; textureCacheMode: ${this.textureCacheMode}; pack: ${this.pack}; async: ${this.async}.`), !0;
          } catch (y) {
            return m.Logger.warning("WebGLBackend", `Unable to initialize WebGLBackend. ${y}`), !1;
          }
        }
        createSessionHandler(y) {
          return new _.WebGLSessionHandler(this, y);
        }
        dispose() {
          this.glContext.dispose();
        }
      };
    }, 5107: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.CoordsGlslLib = void 0;
      const o = r(2517), m = r(8520), _ = r(5060), g = r(7859), y = r(9390);
      class E extends m.GlslLib {
        constructor(v) {
          super(v);
        }
        getFunctions() {
          return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, this.offsetToCoords()), this.coordsToOffset()), this.toVec()), this.valueFrom()), this.getCommonUtilFuncs()), this.getInputsSamplingSnippets()), this.getOutputSamplingSnippet());
        }
        getCustomTypes() {
          return {};
        }
        offsetToCoords() {
          return { offsetToCoords: new m.GlslLibRoutine(`
      vec2 offsetToCoords(int offset, int width, int height) {
        int t = offset / width;
        int s = offset - t*width;
        vec2 coords = (vec2(s,t) + vec2(0.5,0.5)) / vec2(width, height);
        return coords;
      }
      `) };
        }
        coordsToOffset() {
          return { coordsToOffset: new m.GlslLibRoutine(`
      int coordsToOffset(vec2 coords, int width, int height) {
        float s = coords.s * float(width);
        float t = coords.t * float(height);
        int offset = int(t) * width + int(s);
        return offset;
      }
      `) };
        }
        getOutputSamplingSnippet() {
          const v = this.context.outputTextureLayout;
          return v.isPacked ? this.getPackedOutputSamplingSnippet(v) : this.getUnpackedOutputSamplingSnippet(v);
        }
        getPackedOutputSamplingSnippet(v) {
          const h = v.unpackedShape, a = [v.width, v.height], b = {}, w = "getOutputCoords";
          switch (h.length) {
            case 0:
              b[w] = this.getOutputScalarCoords();
              break;
            case 1:
              b[w] = this.getOutputPacked1DCoords(h, a);
              break;
            case 2:
              b[w] = this.getOutputPacked2DCoords(h, a);
              break;
            case 3:
              b[w] = this.getOutputPacked3DCoords(h, a);
              break;
            default:
              b[w] = this.getOutputPackedNDCoords(h, a);
          }
          const k = `
      void setOutput(vec4 val) {
        ${(0, _.getGlsl)(this.context.glContext.version).output} = val;
      }
    `;
          return b.floatTextureSetRGBA = new m.GlslLibRoutine(k), b;
        }
        getUnpackedOutputSamplingSnippet(v) {
          const h = v.unpackedShape, a = [v.width, v.height], b = {}, w = "getOutputCoords";
          switch (h.length) {
            case 0:
              b[w] = this.getOutputScalarCoords();
              break;
            case 1:
              b[w] = this.getOutputUnpacked1DCoords(h, a);
              break;
            case 2:
              b[w] = this.getOutputUnpacked2DCoords(h, a);
              break;
            case 3:
              b[w] = this.getOutputUnpacked3DCoords(h, a);
              break;
            case 4:
              b[w] = this.getOutputUnpacked4DCoords(h, a);
              break;
            case 5:
              b[w] = this.getOutputUnpacked5DCoords(h, a);
              break;
            case 6:
              b[w] = this.getOutputUnpacked6DCoords(h, a);
              break;
            default:
              throw new Error(`Unsupported output dimensionality: ${h.length}`);
          }
          const k = `
        void setOutput(float val) {
          ${(0, _.getGlsl)(this.context.glContext.version).output} = vec4(val, 0, 0, 0);
        }
    `;
          return b.floatTextureSetR = new m.GlslLibRoutine(k), b;
        }
        getOutputScalarCoords() {
          return new m.GlslLibRoutine(`
      int getOutputCoords() {
        return 0;
      }
    `);
        }
        getOutputPacked1DCoords(v, h) {
          const a = h;
          let b = "";
          return a[0] === 1 ? (b = `
          int getOutputCoords() {
            return 2 * int(TexCoords.y * ${a[1]}.0);
          }
        `, new m.GlslLibRoutine(b)) : a[1] === 1 ? (b = `
          int getOutputCoords() {
            return 2 * int(TexCoords.x * ${a[0]}.0);
          }
        `, new m.GlslLibRoutine(b)) : (b = `
        int getOutputCoords() {
          ivec2 resTexRC = ivec2(TexCoords.xy *
                                 vec2(${a[0]}, ${a[1]}));
          return 2 * (resTexRC.y * ${a[0]} + resTexRC.x);
        }
      `, new m.GlslLibRoutine(b));
        }
        getOutputPacked2DCoords(v, h) {
          let a = "";
          if (o.ArrayUtil.arraysEqual(v, h)) return a = `
        ivec2 getOutputCoords() {
          return 2 * ivec2(TexCoords.xy * vec2(${h[0]}, ${h[1]}));
        }
      `, new m.GlslLibRoutine(a);
          const b = h, w = Math.ceil(v[1] / 2);
          return a = `
        ivec2 getOutputCoords() {
          ivec2 resTexRC = ivec2(TexCoords.xy *
                                vec2(${b[0]}, ${b[1]}));

          int index = resTexRC.y * ${b[0]} + resTexRC.x;

          // reverse r and c order for packed texture
          int r = imod(index, ${w}) * 2;
          int c = 2 * (index / ${w});

          return ivec2(r, c);
        }
      `, new m.GlslLibRoutine(a);
        }
        getOutputPacked3DCoords(v, h) {
          const a = [h[0], h[1]], b = Math.ceil(v[2] / 2), w = b * Math.ceil(v[1] / 2), k = `
        ivec3 getOutputCoords() {
          ivec2 resTexRC = ivec2(TexCoords.xy *
                                vec2(${a[0]}, ${a[1]}));
          int index = resTexRC.y * ${a[0]} + resTexRC.x;

          int b = index / ${w};
          index -= b * ${w};

          // reverse r and c order for packed texture
          int r = imod(index, ${b}) * 2;
          int c = 2 * (index / ${b});

          return ivec3(b, r, c);
        }
      `;
          return new m.GlslLibRoutine(k);
        }
        getOutputPackedNDCoords(v, h) {
          const a = [h[0], h[1]], b = Math.ceil(v[v.length - 1] / 2), w = b * Math.ceil(v[v.length - 2] / 2);
          let k = w, A = "", M = "b, r, c";
          for (let O = 2; O < v.length - 1; O++) k *= v[v.length - O - 1], A = `
      int b${O} = index / ${k};
      index -= b${O} * ${k};
    ` + A, M = `b${O}, ` + M;
          const $ = `
      ivec${v.length} getOutputCoords() {
        ivec2 resTexRC = ivec2(TexCoords.xy *
                              vec2(${a[0]}, ${a[1]}));
        int index = resTexRC.y * ${a[0]} + resTexRC.x;

        ${A}

        int b = index / ${w};
        index -= b * ${w};

        // reverse r and c order for packed texture
        int r = imod(index, ${b}) * 2;
        int c = 2 * (index / ${b});

        return ivec${v.length}(${M});
      }
    `;
          return new m.GlslLibRoutine($);
        }
        getOutputUnpacked1DCoords(v, h) {
          const a = `
        int getOutputCoords() {
          ivec2 resTexRC = ivec2(TexCoords.xy *
                                vec2(${h[0]}, ${h[1]}));
          return resTexRC.y * ${h[0]} + resTexRC.x;
        }
      `;
          return new m.GlslLibRoutine(a);
        }
        getOutputUnpacked2DCoords(v, h) {
          const a = `
        ivec2 getOutputCoords() {
          ivec2 resTexRC = ivec2(TexCoords.xy *
                                vec2(${h[0]}, ${h[1]}));
          int index = resTexRC.y * ${h[0]} + resTexRC.x;
          int r = index / ${v[1]};
          int c = index - r * ${v[1]};
          return ivec2(r, c);
        }
      `;
          return new m.GlslLibRoutine(a);
        }
        getOutputUnpacked3DCoords(v, h) {
          let a = "";
          const b = v.length;
          let w = null;
          b < 2 && (w = []), w = new Array(b - 1), w[b - 2] = v[b - 1];
          for (let M = b - 3; M >= 0; --M) w[M] = w[M + 1] * v[M + 1];
          const k = ["r", "c", "d"], A = w.map((M, $) => `int ${k[$]} = index / ${M}; ${$ === w.length - 1 ? `int ${k[$ + 1]} = index - ${k[$]} * ${M}` : `index -= ${k[$]} * ${M}`};`).join("");
          return a = `
        ivec3 getOutputCoords() {
          ivec2 resTexRC = ivec2(TexCoords.xy *
                                vec2(${h[0]}, ${h[1]}));
          int index = resTexRC.y * ${h[0]} + resTexRC.x;
          ${A}
          return ivec3(r, c, d);
        }
      `, new m.GlslLibRoutine(a);
        }
        getOutputUnpacked4DCoords(v, h) {
          let a = "";
          const b = v.length;
          let w = null;
          b < 2 && (w = []), w = new Array(b - 1), w[b - 2] = v[b - 1];
          for (let M = b - 3; M >= 0; --M) w[M] = w[M + 1] * v[M + 1];
          const k = ["r", "c", "d", "d2"], A = w.map((M, $) => `int ${k[$]} = index / ${M}; ${$ === w.length - 1 ? `int ${k[$ + 1]} = index - ${k[$]} * ${M}` : `index -= ${k[$]} * ${M}`};`).join("");
          return a = `
      ivec4 getOutputCoords() {
          ivec2 resTexRC = ivec2(TexCoords.xy *
                                vec2(${h[0]}, ${h[1]}));
          int index = resTexRC.y * ${h[0]} + resTexRC.x;
          ${A}
          return ivec4(r, c, d, d2);
        }
      `, new m.GlslLibRoutine(a);
        }
        getOutputUnpacked5DCoords(v, h) {
          let a = "";
          const b = v.length;
          let w = null;
          b < 2 && (w = []), w = new Array(b - 1), w[b - 2] = v[b - 1];
          for (let M = b - 3; M >= 0; --M) w[M] = w[M + 1] * v[M + 1];
          const k = ["r", "c", "d", "d2", "d3"], A = w.map((M, $) => `int ${k[$]} = index / ${M}; ${$ === w.length - 1 ? `int ${k[$ + 1]} = index - ${k[$]} * ${M}` : `index -= ${k[$]} * ${M}`};`).join("");
          return a = `
      ivec5 getOutputCoords() {
          ivec2 resTexRC = ivec2(TexCoords.xy *
                                vec2(${h[0]}, ${h[1]}));
          int index = resTexRC.y * ${h[0]} + resTexRC.x;
          ${A}
          return ivec5(r, c, d, d2, d3);
        }
      `, new m.GlslLibRoutine(a);
        }
        getOutputUnpacked6DCoords(v, h) {
          let a = "";
          const b = v.length;
          let w = null;
          b < 2 && (w = []), w = new Array(b - 1), w[b - 2] = v[b - 1];
          for (let M = b - 3; M >= 0; --M) w[M] = w[M + 1] * v[M + 1];
          const k = ["r", "c", "d", "d2", "d3", "d4"], A = w.map((M, $) => `int ${k[$]} = index / ${M}; ${$ === w.length - 1 ? `int ${k[$ + 1]} = index - ${k[$]} * ${M}` : `index -= ${k[$]} * ${M}`};`).join("");
          return a = `
     ivec6 getOutputCoords() {
         ivec2 resTexRC = ivec2(TexCoords.xy *
                               vec2(${h[0]}, ${h[1]}));
         int index = resTexRC.y * ${h[0]} + resTexRC.x;
         ${A}
         return ivec6(r, c, d, d2, d3, d4);
       }
     `, new m.GlslLibRoutine(a);
        }
        getCommonUtilFuncs() {
          const v = {};
          let h = "uvFromFlat";
          v[h] = new m.GlslLibRoutine(`
    vec2 uvFromFlat(int texNumR, int texNumC, int index) {
      int texC = index / texNumR;
      int texR = index - texC * texNumR;
      // TODO: swap texR, texC order in following function so row is corresponding to u and column is corresponding to
      //       v.
      return (vec2(texR, texC) + halfCR) / vec2(texNumR, texNumC);
    }
    `), h = "packedUVfrom1D", v[h] = new m.GlslLibRoutine(`
      vec2 packedUVfrom1D(int texNumR, int texNumC, int index) {
        int texelIndex = index / 2;
        int texR = texelIndex / texNumC;
        int texC = texelIndex - texR * texNumC;
        return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
      }
      `), h = "packedUVfrom2D", v[h] = new m.GlslLibRoutine(`
      vec2 packedUVfrom2D(int texNumR, int texNumC, int texelsInLogicalRow, int row, int col) {
        int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);
        int texR = texelIndex / texNumC;
        int texC = texelIndex - texR * texNumC;
        return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
      }
      `), h = "packedUVfrom3D", v[h] = new m.GlslLibRoutine(`
      vec2 packedUVfrom3D(int texNumR, int texNumC,
          int texelsInBatch, int texelsInLogicalRow, int b,
          int row, int col) {
        int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2);
        int texR = index / texNumC;
        int texC = index - texR * texNumC;
        return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
      }
      `), h = "sampleTexture";
          const a = (0, _.getGlsl)(this.context.glContext.version);
          return v[h] = new m.GlslLibRoutine(`
        float sampleTexture(sampler2D textureSampler, vec2 uv) {
            return ${a.texture2D}(textureSampler, uv).r;
        }`), v;
        }
        getInputsSamplingSnippets() {
          const v = {}, h = this.context.outputTextureLayout;
          return this.context.programInfo.inputNames.forEach((a, b) => {
            const w = this.context.inputTextureLayouts[b], k = (0, y.generateShaderFuncNameFromInputSamplerName)(a);
            w.isPacked ? v[k] = this.getPackedSamplerFromInput(k, a, w) : v[k] = this.getUnpackedSamplerFromInput(k, a, w);
            const A = (0, y.generateShaderFuncNameFromInputSamplerNameAtOutCoords)(a);
            w.unpackedShape.length <= h.unpackedShape.length && (w.isPacked ? v[A] = this.getPackedSamplerAtOutputCoords(A, w, h, a) : v[A] = this.getUnpackedSamplerAtOutputCoords(A, w, h, a));
          }), v;
        }
        getPackedSamplerAtOutputCoords(v, h, a, b) {
          const w = h.unpackedShape, k = a.unpackedShape, A = b, M = (0, y.generateShaderFuncNameFromInputSamplerName)(A), $ = w.length, O = k.length, C = o.BroadcastUtil.getBroadcastDims(w, k), P = (0, y.getCoordsDataType)(O), I = O - $;
          let N;
          const R = (0, y.getGlChannels)();
          N = $ === 0 ? "" : O < 2 && C.length >= 1 ? "coords = 0;" : C.map((Y) => `coords.${R[Y + I]} = 0;`).join(`
`);
          let F = "";
          F = O < 2 && $ > 0 ? "coords" : w.map((Y, W) => `coords.${R[W + I]}`).join(", ");
          let B = "return outputValue;";
          const G = o.ShapeUtil.size(w) === 1, Q = o.ShapeUtil.size(k) === 1;
          if ($ !== 1 || G || Q) {
            if (G && !Q) B = O === 1 ? `
          return vec4(outputValue.x, outputValue.x, 0., 0.);
        ` : `
          return vec4(outputValue.x);
        `;
            else if (C.length) {
              const Y = $ - 2, W = $ - 1;
              C.indexOf(Y) > -1 && C.indexOf(W) > -1 ? B = "return vec4(outputValue.x);" : C.indexOf(Y) > -1 ? B = "return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);" : C.indexOf(W) > -1 && (B = "return vec4(outputValue.xx, outputValue.zz);");
            }
          } else B = `
        return vec4(outputValue.xy, outputValue.xy);
      `;
          const ee = `
      vec4 ${v}() {
        ${P} coords = getOutputCoords();
        
        int lastDim = coords.${R[O - 1]};
        coords.${R[O - 1]} = coords.${R[O - 2]};
        coords.${R[O - 2]} = lastDim;
      
        ${N}
        vec4 outputValue = ${M}(${F});
        ${B}
      }
    `;
          return new m.GlslLibRoutine(ee, ["coordinates.getOutputCoords"]);
        }
        getUnpackedSamplerAtOutputCoords(v, h, a, b) {
          const w = [a.width, a.height], k = [h.width, h.height], A = h.unpackedShape.length, M = a.unpackedShape.length, $ = h.unpackedShape, O = a.unpackedShape, C = (0, y.generateShaderFuncNameFromInputSamplerName)(b);
          if (A === M && o.ArrayUtil.arraysEqual(k, w)) {
            const Q = `
          float ${v}() {
            return sampleTexture(${b}, TexCoords);
          }
        `;
            return new m.GlslLibRoutine(Q, ["coordinates.sampleTexture"]);
          }
          const P = (0, y.getCoordsDataType)(M), I = o.BroadcastUtil.getBroadcastDims($, O), N = M - A;
          let R;
          const F = (0, y.getGlChannels)();
          R = A === 0 ? "" : M < 2 && I.length >= 1 ? "coords = 0;" : I.map((Q) => `coords.${F[Q + N]} = 0;`).join(`
`);
          let B = "";
          B = M < 2 && A > 0 ? "coords" : h.unpackedShape.map((Q, ee) => `coords.${F[ee + N]}`).join(", ");
          const G = `
        float ${v}() {
          ${P} coords = getOutputCoords();
          ${R}
          return ${C}(${B});
        }
      `;
          return new m.GlslLibRoutine(G, ["coordinates.getOutputCoords"]);
        }
        getPackedSamplerFromInput(v, h, a) {
          switch (a.unpackedShape.length) {
            case 0:
              return this.getPackedSamplerScalar(v, h);
            case 1:
              return this.getPackedSampler1D(v, h, a);
            case 2:
              return this.getPackedSampler2D(v, h, a);
            case 3:
              return this.getPackedSampler3D(v, h, a);
            default:
              return this.getPackedSamplerND(v, h, a);
          }
        }
        getUnpackedSamplerFromInput(v, h, a) {
          const b = a.unpackedShape;
          switch (b.length) {
            case 0:
              return this.getUnpackedSamplerScalar(v, h, a);
            case 1:
              return this.getUnpackedSampler1D(v, h, a);
            case 2:
              return this.getUnpackedSampler2D(v, h, a);
            case 3:
              return this.getUnpackedSampler3D(v, h, a);
            case 4:
              return this.getUnpackedSampler4D(v, h, a);
            case 5:
              return this.getUnpackedSampler5D(v, h, a);
            case 6:
              return this.getUnpackedSampler6D(v, h, a);
            default:
              throw new Error(`Unsupported dimension ${b.length}-D`);
          }
        }
        getPackedSamplerScalar(v, h) {
          const a = `
          vec4 ${v}() {
            return ${(0, _.getGlsl)(this.context.glContext.version).texture2D}(${h}, halfCR);
          }
        `;
          return new m.GlslLibRoutine(a);
        }
        getPackedSampler1D(v, h, a) {
          const b = [a.width, a.height], w = [b[1], b[0]], k = (0, _.getGlsl)(this.context.glContext.version), A = `vec4 ${v}(int index) {
      vec2 uv = packedUVfrom1D(
      ${w[0]}, ${w[1]}, index);
      return ${k.texture2D}(${h}, uv);
    }`;
          return new m.GlslLibRoutine(A, ["coordinates.packedUVfrom1D"]);
        }
        getPackedSampler2D(v, h, a) {
          const b = a.unpackedShape, w = [a.width, a.height], k = (0, _.getGlsl)(this.context.glContext.version), A = w[0], M = w[1];
          if (w != null && o.ArrayUtil.arraysEqual(b, w)) {
            const P = `vec4 ${v}(int row, int col) {
        vec2 uv = (vec2(col, row) + halfCR) / vec2(${M}.0, ${A}.0);
        return ${k.texture2D}(${h}, uv);
      }`;
            return new m.GlslLibRoutine(P);
          }
          const $ = w, O = Math.ceil(b[1] / 2), C = `vec4 ${v}(int row, int col) {
      vec2 uv = packedUVfrom2D(${$[1]}, ${$[0]}, ${O}, row, col);
      return ${k.texture2D}(${h}, uv);
    }`;
          return new m.GlslLibRoutine(C, ["coordinates.packedUVfrom2D"]);
        }
        getPackedSampler3D(v, h, a) {
          const b = a.unpackedShape, w = [a.width, a.height], k = [w[0], w[1]], A = (0, _.getGlsl)(this.context.glContext.version);
          if (b[0] === 1) {
            const P = b.slice(1), I = [1, 2], N = (0, y.squeezeInputShape)(b, P), R = ["b", "row", "col"], F = JSON.parse(JSON.stringify(a));
            F.unpackedShape = N;
            const B = this.getPackedSamplerFromInput(v, h, F), G = `${B.routineBody}
      vec4 ${v}(int b, int row, int col) {
        return ${v}(${(0, y.getSqueezedParams)(R, I)});
      } `;
            return new m.GlslLibRoutine(G, B.dependencies);
          }
          const M = k[0], $ = k[1], O = Math.ceil(b[2] / 2), C = `vec4 ${v}(int b, int row, int col) {
      vec2 uv = packedUVfrom3D(
        ${$}, ${M}, ${O * Math.ceil(b[1] / 2)}, ${O}, b, row, col);
      return ${A.texture2D}(${h}, uv);}`;
          return new m.GlslLibRoutine(C, ["coordinates.packedUVfrom3D"]);
        }
        getPackedSamplerND(v, h, a) {
          const b = a.unpackedShape, w = b.length, k = [a.width, a.height], A = (0, _.getGlsl)(this.context.glContext.version), M = [k[0], k[1]], $ = M[1], O = M[0], C = Math.ceil(b[w - 1] / 2);
          let P = C * Math.ceil(b[w - 2] / 2), I = "int b, int row, int col", N = `b * ${P} + (row / 2) * ${C} + (col / 2)`;
          for (let F = 2; F < w - 1; F++) I = `int b${F}, ` + I, P *= b[w - F - 1], N = `b${F} * ${P} + ` + N;
          const R = `vec4 ${v}(${I}) {
      int index = ${N};
      int texR = index / ${O};
      int texC = index - texR * ${O};
      vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${O}, ${$});
      return ${A.texture2D}(${h}, uv);
    }`;
          return new m.GlslLibRoutine(R);
        }
        getUnpackedSamplerScalar(v, h, a) {
          const [b, w] = [a.width, a.height];
          if (b === 1 && w === 1) {
            const A = `
          float ${v}() {
            return sampleTexture(${h}, halfCR);
          }
        `;
            return new m.GlslLibRoutine(A, ["coordinates.sampleTexture"]);
          }
          const k = `
        float ${v}() {
          int offset_${h} = coordsToOffset(TexCoords, ${b}, ${w});
          vec2 uv = uvFromFlat(${b}, ${w}, offset_${h});
          return sampleTexture(${h}, uv);
        }
      `;
          return new m.GlslLibRoutine(k, ["coordinates.uvFromFlat", "coordinates.sampleTexture", "coordinates.coordsToOffset"]);
        }
        getUnpackedSampler1D(v, h, a) {
          const b = a.width, w = a.height;
          if (w === 1 && b === 1) {
            const A = `
        float ${v}(int index) {
          return sampleTexture(${h}, halfCR);
        }
      `;
            return new m.GlslLibRoutine(A, ["coordinates.sampleTexture"]);
          }
          if (w === 1) {
            const A = `
          float ${v}(int index) {
            vec2 uv = vec2((float(index) + 0.5) / ${b}.0, 0.5);
            return sampleTexture(${h}, uv);
          }
        `;
            return new m.GlslLibRoutine(A, ["coordinates.sampleTexture"]);
          }
          if (b === 1) {
            const A = `
          float ${v}(int index) {
            vec2 uv = vec2(0.5, (float(index) + 0.5) / ${w}.0);
            return sampleTexture(${h}, uv);
          }
        `;
            return new m.GlslLibRoutine(A, ["coordinates.sampleTexture"]);
          }
          const k = `
        float ${v}(int index) {
          vec2 uv = uvFromFlat(${b}, ${w}, index);
          return sampleTexture(${h}, uv);
        }
      `;
          return new m.GlslLibRoutine(k, ["coordinates.uvFromFlat", "coordinates.sampleTexture"]);
        }
        getUnpackedSampler2D(v, h, a) {
          const b = a.unpackedShape, w = [a.height, a.width];
          if (w != null && o.ArrayUtil.arraysEqual(b, w)) {
            const P = `
          float ${v}(int row, int col) {
            vec2 uv = (vec2(row, col) + halfCR) / vec2(${w[1]}.0, ${w[0]}.0);
            return sampleTexture(${h}, uv);
          }
        `;
            return new m.GlslLibRoutine(P, ["coordinates.sampleTexture"]);
          }
          const { newShape: k, keptDims: A } = (0, g.squeezeShape)(b), M = k;
          if (M.length < b.length) {
            const P = (0, y.squeezeInputShape)(b, M), I = JSON.parse(JSON.stringify(a));
            I.unpackedShape = P;
            const N = ["col", "row"], R = `
          ${this.getUnpackedSamplerFromInput(v, h, I).routineBody}
          float ${v}(int row, int col) {
            return ${v}(${(0, y.getSqueezedParams)(N, A)});
          }
        `;
            return new m.GlslLibRoutine(R, ["coordinates.sampleTexture"]);
          }
          const $ = w[1], O = w[0];
          if (O === 1) {
            const P = `
          float ${v}(int row, int col) {
            int offset_${h} = coordsToOffset(TexCoords, ${$}, ${O});
            float index = dot(vec3(row, col, offset_${h}), vec3(${b[1]}, 1, 1));
            vec2 uv = vec2(0.5, (index + 0.5) / ${$}.0);
            return sampleTexture(${h}, uv);
          }
        `;
            return new m.GlslLibRoutine(P, ["coordinates.sampleTexture", "coordinates.coordsToOffset"]);
          }
          if ($ === 1) {
            const P = `
          float ${v}(int row, int col) {
            int offset_${h} = coordsToOffset(TexCoords, ${$}, ${O});
            float index = dot(vec3(row, col, offset_${h}), vec3(${b[1]}, 1, 1));
            vec2 uv = vec2((index + 0.5) / ${O}.0, 0.5);
            return sampleTexture(${h}, uv);
          }
        `;
            return new m.GlslLibRoutine(P, ["coordinates.sampleTexture", "coordinates.coordsToOffset"]);
          }
          const C = `
        float ${v}(int row, int col) {
          int index = col * ${b[1]} + row;
          vec2 uv = uvFromFlat(${$}, ${O}, index);
          return sampleTexture(${h}, uv);
        }
      `;
          return new m.GlslLibRoutine(C, ["coordinates.uvFromFlat", "coordinates.sampleTexture", "coordinates.coordsToOffset"]);
        }
        getUnpackedSampler3D(v, h, a) {
          const b = a.unpackedShape, w = b[1] * b[2], k = b[2], { newShape: A, keptDims: M } = (0, g.squeezeShape)(b), $ = A;
          if ($.length < b.length) {
            const C = (0, y.squeezeInputShape)(b, $), P = ["batch", "col", "row"], I = JSON.parse(JSON.stringify(a));
            I.unpackedShape = C;
            const N = this.getUnpackedSamplerFromInput(v, h, I), R = M.reverse(), F = `
          ${N.routineBody}
          float ${v}(int batch, int row, int col) {
            return ${v}(${(0, y.getSqueezedParams)(P, R)});
          }
        `;
            return new m.GlslLibRoutine(F, N.dependencies);
          }
          const O = `
          float ${v}(int depth, int row, int col) {
            // Explicitly use integer operations as dot() only works on floats.
            int index = depth * ${w} + col * ${k} + row;
            vec2 uv = uvFromFlat(${a.width}, ${a.height}, index);
            return sampleTexture(${h}, uv);
          }
      `;
          return new m.GlslLibRoutine(O, ["coordinates.uvFromFlat", "coordinates.sampleTexture", "coordinates.coordsToOffset"]);
        }
        getUnpackedSampler4D(v, h, a) {
          const b = a.unpackedShape, w = b[3], k = b[2] * w, A = `
        float ${v}(int row, int col, int depth, int depth2) {
          int index = row * ${b[1] * k} + col * ${k} +
              depth2 * ${w} + depth;
          vec2 uv = uvFromFlat(${a.width}, ${a.height}, index);
          return sampleTexture(${h}, uv);
        }
      `;
          return new m.GlslLibRoutine(A, ["coordinates.uvFromFlat", "coordinates.sampleTexture"]);
        }
        getUnpackedSampler5D(v, h, a) {
          const b = a.unpackedShape, w = b[4], k = b[3] * w, A = b[2] * k, M = b[1] * A, { newShape: $, keptDims: O } = (0, g.squeezeShape)(b);
          if ($.length < b.length) {
            const P = (0, y.squeezeInputShape)(b, $), I = ["row", "col", "depth", "depth2", "depth3"], N = JSON.parse(JSON.stringify(a));
            N.unpackedShape = P;
            const R = `
          ${this.getUnpackedSamplerFromInput(v, h, N).routineBody}
          float ${v}(int row, int col, int depth, int depth2, int depth3) {
            return ${v}(${(0, y.getSqueezedParams)(I, O)});
          }
        `;
            return new m.GlslLibRoutine(R, ["coordinates.sampleTexture", "coordinates.uvFromFlat"]);
          }
          const C = `
        float ${v}(int row, int col, int depth, int depth2, int depth3) {
          int index = row * ${M} + col * ${A} + depth * ${k} +
          depth3 * ${w} + depth2;
          vec2 uv = uvFromFlat(${a.width}, ${a.height}, index);
          return sampleTexture(${h}, uv);
        }
      `;
          return new m.GlslLibRoutine(C, ["coordinates.sampleTexture", "coordinates.uvFromFlat"]);
        }
        getUnpackedSampler6D(v, h, a) {
          const b = a.unpackedShape, w = b[5], k = b[4] * w, A = b[3] * k, M = b[2] * A, $ = b[1] * M, { newShape: O, keptDims: C } = (0, g.squeezeShape)(b);
          if (O.length < b.length) {
            const I = (0, y.squeezeInputShape)(b, O), N = ["row", "col", "depth", "depth2", "depth3", "depth4"], R = JSON.parse(JSON.stringify(a));
            R.unpackedShape = I;
            const F = `
            ${this.getUnpackedSamplerFromInput(v, h, R).routineBody}
            float ${v}(int row, int col, int depth,
              int depth2, int depth3, int depth4) {
              return ${v}(${(0, y.getSqueezedParams)(N, C)});
            }
          `;
            return new m.GlslLibRoutine(F, ["coordinates.sampleTexture", "coordinates.uvFromFlat"]);
          }
          const P = `
          float ${v}(int row, int col, int depth,
            int depth2, int depth3, int depth4) {
            int index = row * ${$} + col * ${M} + depth * ${A} +
            depth2 * ${k} + depth3 * ${w} + depth4;
            vec2 uv = uvFromFlat(${a.width}, ${a.height}, index);
            return sampleTexture(${h}, uv);
          }
        `;
          return new m.GlslLibRoutine(P, ["coordinates.uvFromFlat", "coordinates.sampleTexture", "coordinates.coordsToOffset"]);
        }
        toVec() {
          const v = this.context.outputTextureLayout, h = v.shape.length, a = v.strides, b = v.width, w = v.height, k = [];
          for (let M = 0; M < h - 1; ++M) k.push(`
        c[${M}] = offset / ${a[M]};`), k.push(`
        offset -= c[${M}] * ${a[M]};`);
          k.push(`
        c[${h - 1}] = offset;`);
          const A = `
      void toVec(vec2 texCoords, out int c[${h}]) {
        int offset = coordsToOffset(texCoords, ${b}, ${w});
        ${k.join("")}
      }
      void toVec(int offset, out int c[${h}]) {
        ${k.join("")}
      }
    `;
          return { toVec: new m.GlslLibRoutine(A, ["coordinates.coordsToOffset"]) };
        }
        valueFrom() {
          const v = {};
          return this.context.programInfo.inputNames.forEach((h, a) => {
            const b = this.context.inputTextureLayouts[a], w = (b.unpackedShape.length > 0 ? b.unpackedShape : b.shape).length;
            let k = `_${h}`;
            v[k] = new m.GlslLibRoutine(this.getValueFromSingle(h, w, b.width, b.height, !1), [`shapeUtils.indicesToOffset${k}`, "coordinates.offsetToCoords", "fragcolor.getColorAsFloat"]), k += "_T", v[k] = new m.GlslLibRoutine(this.getValueFromSingle(h, w, b.width, b.height, !0), [`shapeUtils.indicesToOffset${k}`, "coordinates.offsetToCoords", "fragcolor.getColorAsFloat"]);
          }), v;
        }
        getValueFromSingle(v, h, a, b, w) {
          let k = `_${v}`;
          return w && (k += "_T"), `
        float ${k}(int m[${h}]) {
          int offset = indicesToOffset${k}(m);
          vec2 coords = offsetToCoords(offset, ${a}, ${b});
          float value = getColorAsFloat(${(0, _.getGlsl)(this.context.glContext.version).texture2D}(${v}, coords));
          return value;
        }
        `;
        }
        getPackedValueFrom(v, h, a, b, w) {
          let k = `_${v}_Pack`;
          return w && (k += "_T"), `
        vec4 ${k}(int m[${h}]) {
          int offset = indicesToOffset_${v}(m);
          vec2 coords = offsetToCoords(offset, ${a}, ${b});
          return ${(0, _.getGlsl)(this.context.glContext.version).texture2D}(${v}, coords);
        }
        `;
        }
      }
      e.CoordsGlslLib = E;
    }, 8520: (s, e) => {
      var r;
      Object.defineProperty(e, "__esModule", { value: !0 }), e.TopologicalSortGlslRoutines = e.GlslLibRoutineNode = e.GlslLibRoutine = e.GlslLib = e.GlslContext = e.FunctionType = void 0, (r = e.FunctionType || (e.FunctionType = {}))[r.ValueBased = 0] = "ValueBased", r[r.Positional = 1] = "Positional", e.GlslContext = class {
        constructor(o, m, _, g) {
          this.glContext = o, this.programInfo = m, this.inputTextureLayouts = _, this.outputTextureLayout = g;
        }
      }, e.GlslLib = class {
        constructor(o) {
          this.context = o;
        }
      }, e.GlslLibRoutine = class {
        constructor(o, m) {
          this.routineBody = o, this.dependencies = m;
        }
      }, e.GlslLibRoutineNode = class {
        constructor(o, m, _) {
          this.name = o, this.dependencies = _ || [], m && (this.routineBody = m);
        }
        addDependency(o) {
          o && this.dependencies.push(o);
        }
      }, e.TopologicalSortGlslRoutines = class {
        static returnOrderedNodes(o) {
          if (!o || o.length === 0) return [];
          if (o.length === 1) return o;
          const m = /* @__PURE__ */ new Set(), _ = /* @__PURE__ */ new Set(), g = new Array();
          return this.createOrderedNodes(o, m, _, g), g;
        }
        static createOrderedNodes(o, m, _, g) {
          for (let y = 0; y < o.length; ++y) this.dfsTraverse(o[y], m, _, g);
        }
        static dfsTraverse(o, m, _, g) {
          if (!o || _.has(o.name)) return;
          if (m.has(o.name)) throw new Error("Cyclic dependency detected. Can't topologically sort routines needed for shader.");
          m.add(o.name);
          const y = o.dependencies;
          if (y && y.length > 0) for (let E = 0; E < y.length; ++E) this.dfsTraverse(y[E], m, _, g);
          g.push(o), _.add(o.name), m.delete(o.name);
        }
      };
    }, 7341: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.EncodingGlslLib = void 0;
      const o = r(8520);
      class m extends o.GlslLib {
        constructor(g) {
          super(g);
        }
        getFunctions() {
          return Object.assign(Object.assign({}, this.encodeFloat32()), this.decodeFloat32());
        }
        getCustomTypes() {
          return {};
        }
        encodeFloat32() {
          return { encode: new o.GlslLibRoutine(`highp vec4 encode(highp float f) {
        return vec4(f, 0.0, 0.0, 0.0);
      }
        `) };
        }
        decodeFloat32() {
          return { decode: new o.GlslLibRoutine(`highp float decode(highp vec4 rgba) {
        return rgba.r;
      }
        `) };
        }
        encodeUint8() {
          const g = m.isLittleEndian() ? "rgba.rgba=rgba.abgr;" : "";
          return { encode: new o.GlslLibRoutine(`
      highp vec4 encode(highp float f) {
        highp float F = abs(f);
        highp float Sign = step(0.0,-f);
        highp float Exponent = floor(log2(F));
        highp float Mantissa = (exp2(- Exponent) * F);
        Exponent = floor(log2(F) + 127.0) + floor(log2(Mantissa));
        highp vec4 rgba;
        rgba[0] = 128.0 * Sign  + floor(Exponent*exp2(-1.0));
        rgba[1] = 128.0 * mod(Exponent,2.0) + mod(floor(Mantissa*128.0),128.0);
        rgba[2] = floor(mod(floor(Mantissa*exp2(23.0 -8.0)),exp2(8.0)));
        rgba[3] = floor(exp2(23.0)*mod(Mantissa,exp2(-15.0)));
        ${g}
        rgba = rgba / 255.0; // values need to be normalized to [0,1]
        return rgba;
    }
        `) };
        }
        decodeUint8() {
          const g = m.isLittleEndian() ? "rgba.rgba=rgba.abgr;" : "";
          return { decode: new o.GlslLibRoutine(`
        highp float decode(highp vec4 rgba) {
          rgba = rgba * 255.0; // values need to be de-normalized from [0,1] to [0,255]
          ${g}
          highp float Sign = 1.0 - step(128.0,rgba[0])*2.0;
          highp float Exponent = 2.0 * mod(rgba[0],128.0) + step(128.0,rgba[1]) - 127.0;
          highp float Mantissa = mod(rgba[1],128.0)*65536.0 + rgba[2]*256.0 +rgba[3] + float(0x800000);
          highp float Result =  Sign * exp2(Exponent) * (Mantissa * exp2(-23.0 ));
          return Result;
      }
        `) };
        }
        static isLittleEndian() {
          const g = new ArrayBuffer(4), y = new Uint32Array(g), E = new Uint8Array(g);
          if (y[0] = 3735928559, E[0] === 239) return !0;
          if (E[0] === 222) return !1;
          throw new Error("unknown endianness");
        }
      }
      e.EncodingGlslLib = m;
    }, 9894: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.FragColorGlslLib = void 0;
      const o = r(8520), m = r(5060);
      class _ extends o.GlslLib {
        constructor(y) {
          super(y);
        }
        getFunctions() {
          return Object.assign(Object.assign({}, this.setFragColor()), this.getColorAsFloat());
        }
        getCustomTypes() {
          return {};
        }
        setFragColor() {
          const y = (0, m.getGlsl)(this.context.glContext.version);
          return { setFragColor: new o.GlslLibRoutine(`
        void setFragColor(float value) {
            ${y.output} = encode(value);
        }
        `, ["encoding.encode"]) };
        }
        getColorAsFloat() {
          return { getColorAsFloat: new o.GlslLibRoutine(`
        float getColorAsFloat(vec4 color) {
            return decode(color);
        }
        `, ["encoding.decode"]) };
        }
      }
      e.FragColorGlslLib = _;
    }, 2848: (s, e) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.replaceInlines = void 0;
      const r = /@inline[\s\n\r]+(\w+)[\s\n\r]+([0-9a-zA-Z_]+)\s*\(([^)]*)\)\s*{(([^}]|[\n\r])*)}/gm;
      e.replaceInlines = function(o) {
        const m = {};
        let _;
        for (; (_ = r.exec(o)) !== null; ) {
          const g = _[3].split(",").map((y) => {
            const E = y.trim().split(" ");
            return E && E.length === 2 ? { type: E[0], name: E[1] } : null;
          }).filter((y) => y !== null);
          m[_[2]] = { params: g, body: _[4] };
        }
        for (const g in m) {
          const y = "(\\w+)?\\s+([_0-9a-zA-Z]+)\\s+=\\s+__FUNC__\\((.*)\\)\\s*;".replace("__FUNC__", g), E = new RegExp(y, "gm");
          for (; (_ = E.exec(o)) !== null; ) {
            const x = _[1], v = _[2], h = _[3].split(","), a = x ? `${x} ${v};` : "";
            let b = m[g].body, w = "";
            m[g].params.forEach((A, M) => {
              A && (w += `${A.type} ${A.name} = ${h[M]};
`);
            }), b = `${w}
 ${b}`, b = b.replace("return", `${v} = `);
            const k = `
      ${a}
      {
        ${b}
      }
      `;
            o = o.replace(_[0], k);
          }
        }
        return o.replace(r, "");
      };
    }, 8879: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.GlslPreprocessor = void 0;
      const o = r(8520), m = r(2848), _ = r(5483), g = r(5060);
      e.GlslPreprocessor = class {
        constructor(y, E, x, v) {
          this.libs = {}, this.glslLibRoutineDependencyGraph = {}, this.context = new o.GlslContext(y, E, x, v), Object.keys(_.glslRegistry).forEach((a) => {
            const b = new _.glslRegistry[a](this.context);
            this.libs[a] = b;
          });
          const h = this.glslLibRoutineDependencyGraph;
          for (const a in this.libs) {
            const b = this.libs[a].getFunctions();
            for (const w in b) {
              const k = a + "." + w;
              let A;
              h[k] ? (A = h[k], A.routineBody = b[w].routineBody) : (A = new o.GlslLibRoutineNode(k, b[w].routineBody), h[k] = A);
              const M = b[w].dependencies;
              if (M) for (let $ = 0; $ < M.length; ++$) if (h[M[$]]) A.addDependency(h[M[$]]);
              else {
                const O = new o.GlslLibRoutineNode(M[$]);
                h[M[$]] = O, A.addDependency(O);
              }
            }
          }
        }
        preprocess() {
          const y = this.context.programInfo;
          let E = y.shaderSource;
          return this.context.programInfo.hasMain || (E = `${E}
      ${(0, g.getDefaultFragShaderMain)(this.context.glContext.version, this.context.outputTextureLayout.shape.length)}`), E = (0, m.replaceInlines)(E), `${(0, g.getFragShaderPreamble)(this.context.glContext.version)}
    ${this.getUniforms(y.inputNames, y.variables)}
    ${this.getImports(E)}
    ${E}`;
        }
        getImports(y) {
          const E = this.selectGlslLibRoutinesToBeIncluded(y);
          if (E.length === 0) return "";
          let x = "";
          for (let v = 0; v < E.length; ++v) {
            if (!E[v].routineBody) throw new Error(`Missing body for the Glsl Library routine: ${E[v].name}`);
            x += E[v].routineBody + `
`;
          }
          return x;
        }
        selectGlslLibRoutinesToBeIncluded(y) {
          const E = [];
          return Object.keys(this.glslLibRoutineDependencyGraph).forEach((x) => {
            const v = x.split(".")[1];
            y.indexOf(v) !== -1 && E.push(this.glslLibRoutineDependencyGraph[x]);
          }), o.TopologicalSortGlslRoutines.returnOrderedNodes(E);
        }
        getUniforms(y, E) {
          const x = [];
          if (y) for (const v of y) x.push(`uniform sampler2D ${v};`);
          if (E) for (const v of E) x.push(`uniform ${v.type} ${v.name}${v.arrayLength ? `[${v.arrayLength}]` : ""};`);
          return x.join(`
`);
        }
      };
    }, 5483: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.glslRegistry = void 0;
      const o = r(5107), m = r(7341), _ = r(9894), g = r(2655), y = r(3891);
      e.glslRegistry = { encoding: m.EncodingGlslLib, fragcolor: _.FragColorGlslLib, vec: y.VecGlslLib, shapeUtils: g.ShapeUtilsGlslLib, coordinates: o.CoordsGlslLib };
    }, 2655: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.ShapeUtilsGlslLib = void 0;
      const o = r(8520);
      class m extends o.GlslLib {
        constructor(g) {
          super(g);
        }
        getFunctions() {
          return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, this.bcastIndex()), this.bcastMatmulIndex()), this.offsetToIndices()), this.indicesToOffset()), this.incrementIndices());
        }
        getCustomTypes() {
          return {};
        }
        bcastIndex() {
          const g = this.context.outputTextureLayout.shape.length, y = {};
          return this.context.programInfo.inputNames.forEach((E, x) => {
            const v = this.context.inputTextureLayouts[x].unpackedShape;
            if (v.length <= g) {
              const h = v.length, a = g - h, b = `bcastIndices_${E}`;
              let w = "";
              for (let A = 0; A < h; ++A) w += `
          realIndices[${A}] = int( mod(float(bcastedIndices[${a + A}]), ${v[A]}.0) );
          `;
              const k = `
        void ${b} (int bcastedIndices[${g}], out int realIndices[${h}]) {
          ${w}
        }
        `;
              y[b] = new o.GlslLibRoutine(k);
            }
          }), y;
        }
        bcastMatmulIndex() {
          const g = this.context.outputTextureLayout.shape.length, y = {};
          return this.context.programInfo.inputNames.forEach((E, x) => {
            const v = this.context.inputTextureLayouts[x].shape;
            if (!(v.length < 2 || v.length > g)) {
              const h = v.length, a = g - h, b = `bcastMatmulIndices_${E}`;
              let w = "";
              for (let A = 0; A < h - 2; ++A) w += `
          realIndices[${A}] = int( mod(float(bcastedIndices[${a + A}]), ${v[A]}.0) );
          `;
              const k = `
        void ${b}(int bcastedIndices[${g}], out int realIndices[${h}]) {
          ${w}
          realIndices[${h - 1}] = bcastedIndices[${g - 1}];
          realIndices[${h - 2}] = bcastedIndices[${g - 2}];
        }
        `;
              y[b] = new o.GlslLibRoutine(k);
            }
          }), y;
        }
        indicesToOffset() {
          const g = {};
          return this.context.programInfo.inputNames.forEach((y, E) => {
            const x = this.context.inputTextureLayouts[E].shape, v = this.context.inputTextureLayouts[E].strides, h = x.length;
            let a = `indicesToOffset_${y}`;
            g[a] = new o.GlslLibRoutine(m.indexToOffsetSingle(a, h, v)), a = `indicesToOffset_${y}_T`, g[a] = new o.GlslLibRoutine(m.indexToOffsetSingle(a, h, v.slice().reverse()));
          }), g;
        }
        static indexToOffsetSingle(g, y, E) {
          let x = "";
          for (let v = y - 1; v >= 0; --v) x += `
        offset += indices[${v}] * ${E[v]};
        `;
          return `
      int ${g}(int indices[${y}]) {
        int offset = 0;
        ${x}
        return offset;
      }
      `;
        }
        offsetToIndices() {
          const g = {};
          return this.context.programInfo.inputNames.forEach((y, E) => {
            const x = this.context.inputTextureLayouts[E].shape, v = this.context.inputTextureLayouts[E].strides, h = x.length;
            let a = `offsetToIndices_${y}`;
            g[a] = new o.GlslLibRoutine(m.offsetToIndicesSingle(a, h, v)), a = `offsetToIndices_${y}_T`, g[a] = new o.GlslLibRoutine(m.offsetToIndicesSingle(a, h, v.slice().reverse()));
          }), g;
        }
        static offsetToIndicesSingle(g, y, E) {
          const x = [];
          for (let v = 0; v < y - 1; ++v) x.push(`
      indices[${v}] = offset / ${E[v]};`), x.push(`
        offset -= indices[${v}] * ${E[v]};`);
          return x.push(`
      indices[${y - 1}] = offset;`), `
      void ${g}(int offset, out int indices[${y}]) {
        ${x.join("")}
      }
      `;
        }
        incrementIndices() {
          const g = {};
          return this.context.programInfo.inputNames.forEach((y, E) => {
            const x = this.context.inputTextureLayouts[E].shape, v = x.length, h = `incrementIndices_${y}`;
            let a = "";
            for (let w = 0; w < v; ++w) a += `
        shape[${w}] = ${x[w]};`;
            const b = `
        void ${h}(int axis, out int indices[${v}]) {
          int shape[${v}];
          ${a};
          for(int i = ${v} -1 ; i >= 0; --i) {
            if(i > axis) continue;
            indices[i] += 1;
            if(indices[i] < shape[i]) {
              break;
            }
            indices[i] = 0;
          }
        }
        `;
            g[h] = new o.GlslLibRoutine(b);
          }), g;
        }
      }
      e.ShapeUtilsGlslLib = m;
    }, 5060: (s, e) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.getDefaultFragShaderMain = e.getFragShaderPreamble = e.getVertexShaderSource = e.getGlsl = void 0;
      const r = { version: "", attribute: "attribute", varyingVertex: "varying", varyingFrag: "varying", texture2D: "texture2D", output: "gl_FragColor", outputDeclaration: "" }, o = { version: "#version 300 es", attribute: "in", varyingVertex: "out", varyingFrag: "in", texture2D: "texture", output: "outputColor", outputDeclaration: "out vec4 outputColor;" };
      function m(_) {
        return _ === 1 ? r : o;
      }
      e.getGlsl = m, e.getVertexShaderSource = function(_) {
        const g = m(_);
        return `${g.version}
      precision highp float;
      ${g.attribute} vec3 position;
      ${g.attribute} vec2 textureCoord;

      ${g.varyingVertex} vec2 TexCoords;

      void main()
      {
          gl_Position = vec4(position, 1.0);
          TexCoords = textureCoord;
      }`;
      }, e.getFragShaderPreamble = function(_) {
        const g = m(_);
        return `${g.version}
    precision highp float;
    precision highp int;
    precision highp sampler2D;
    ${g.varyingFrag} vec2 TexCoords;
    ${g.outputDeclaration}
    const vec2 halfCR = vec2(0.5, 0.5);

    // Custom vector types to handle higher dimenalities.
    struct ivec5
    {
      int x;
      int y;
      int z;
      int w;
      int u;
    };

    struct ivec6
    {
      int x;
      int y;
      int z;
      int w;
      int u;
      int v;
    };

    int imod(int x, int y) {
      return x - y * (x / y);
    }

    `;
      }, e.getDefaultFragShaderMain = function(_, g) {
        return `
  void main() {
    int indices[${g}];
    toVec(TexCoords, indices);
    vec4 result = vec4(process(indices));
    ${m(_).output} = result;
  }
  `;
      };
    }, 3891: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.VecGlslLib = void 0;
      const o = r(8520);
      class m extends o.GlslLib {
        constructor(g) {
          super(g);
        }
        getCustomTypes() {
          return {};
        }
        getFunctions() {
          return Object.assign(Object.assign(Object.assign(Object.assign({}, this.binaryVecFunctions()), this.copyVec()), this.setVecItem()), this.getVecItem());
        }
        binaryVecFunctions() {
          const g = this.context.outputTextureLayout.shape.length, y = { add: "+=", sub: "-=", mul: "*=", div: "/=" }, E = {};
          for (const x in y) {
            const v = `${x}Vec`;
            let h = "";
            for (let b = 0; b < g; ++b) h += `
          dest[${b}] ${y[x]} src[${b}];
          `;
            const a = `
        void ${v}(int src[${g}], out int dest[${g}]) {
          ${h}
        }
        `;
            E[v] = new o.GlslLibRoutine(a);
          }
          return E;
        }
        copyVec() {
          const g = this.context.outputTextureLayout.shape.length;
          let y = "";
          for (let x = 0; x < g; ++x) y += `
        dest[${x}] = src[${x}];
        `;
          const E = `
      void copyVec(int src[${g}], out int dest[${g}]) {
        ${y}
      }
      `;
          return { copyVec: new o.GlslLibRoutine(E) };
        }
        setVecItem() {
          const g = this.context.outputTextureLayout.shape.length;
          let y = `
        if(index < 0)
            index =${g} + index;
        if (index == 0)
            m[0] = value;
        `;
          for (let x = 1; x < g - 1; ++x) y += `
        else if (index == ${x})
            m[${x}] = value;
            `;
          y += `
        else
            m[${g - 1}] = value;
        `;
          const E = `
      void setVecItem(out int m[${g}], int index, int value) {
        ${y}
      }
        `;
          return { setVecItem: new o.GlslLibRoutine(E) };
        }
        getVecItem() {
          const g = this.context.outputTextureLayout.shape.length;
          let y = `
        if(index < 0)
            index = ${g} + index;
        if (index == 0)
            return m[0];
      `;
          for (let x = 1; x < g - 1; ++x) y += `
        else if (index == ${x})
            return m[${x}];
      `;
          y += `
        else
            return m[${g - 1}];
        `;
          const E = `
      int getVecItem(int m[${g}], int index) {
        ${y}
      }
    `;
          return { getVecItem: new o.GlslLibRoutine(E) };
        }
      }
      e.VecGlslLib = m;
    }, 8316: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.WebGLInferenceHandler = void 0;
      const o = r(6231), m = r(9162), _ = r(2517), g = r(2403), y = r(7019), E = r(8710), x = r(5611), v = r(4057), h = r(2039);
      e.WebGLInferenceHandler = class {
        constructor(a) {
          this.session = a, this.packedTextureDataCache = /* @__PURE__ */ new Map(), this.unpackedTextureDataCache = /* @__PURE__ */ new Map();
        }
        calculateTextureWidthAndHeight(a, b) {
          return (0, v.calculateTextureWidthAndHeight)(this.session.layoutStrategy, a, b);
        }
        executeProgram(a, b) {
          if (b.length < a.inputNames.length) throw new Error(`Input size mustn't be less than ${a.inputNames.length}.`);
          if (a.inputNames.length !== a.inputTypes.length) throw new Error("input names size does not match input types");
          const w = [];
          for (let C = 0; C < a.inputNames.length; ++C) w[C] = this.getOrCreateTextureData(b[C], a.inputTypes[C]);
          const k = ((C, P) => {
            const I = P.map((R) => `${R.unpackedShape.join(",")};${R.width}x${R.height}`).join("_");
            let N = C.name;
            return C.cacheHint && (N += "[" + C.cacheHint + "]"), N += ":" + I, N;
          })(a, w);
          let A = this.session.programManager.getArtifact(k);
          const M = A ? A.programInfo : typeof a.get == "function" ? a.get() : a, $ = (0, v.createTextureLayoutFromTextureType)(this.session.layoutStrategy, M.output.dims, M.output.textureType), O = this.createTextureData($, M.output.type);
          return A || (A = this.session.programManager.build(M, w, O), this.session.programManager.setArtifact(k, A)), this.runProgram(A, w, O), O;
        }
        run(a, b) {
          return this.executeProgram(a, b).tensor;
        }
        runProgram(a, b, w) {
          for (let k = 0; k < b.length; ++k) if (!!b[k].isPacked != (a.programInfo.inputTypes[k] === h.TextureType.packed)) throw new Error(`input[${k}] property packed inconsistent`);
          if (!!w.isPacked != (a.programInfo.output.textureType === h.TextureType.packed)) throw new Error("output property packed inconsistent");
          this.session.programManager.run(a, b, w);
        }
        getOrCreateTextureData(a, b) {
          let w = this.getTextureData(a.dataId, b === h.TextureType.packed);
          if (!w && (w = this.getTextureData(a.dataId, b !== h.TextureType.packed), w)) return b === h.TextureType.packed ? this.pack(w) : this.unpack(w);
          if (!w) {
            const k = (0, v.createTextureLayoutFromTextureType)(this.session.layoutStrategy, a.dims, b);
            if (b === h.TextureType.packedLastDimension) {
              const $ = a.dims;
              if ($.length === 4) {
                const O = [$[0], Math.ceil($[1] * $[2] * $[3] / 4)], C = (0, v.createTextureLayoutFromTextureType)(this.session.layoutStrategy, O, b);
                let P = a.numberData;
                if ($[1] * $[2] * $[3] % 4 != 0) {
                  const I = $[0], N = $[1] * $[2] * $[3], R = Math.ceil(N * 1 / 4) * 4;
                  P = new Float32Array(I * R);
                  for (let F = 0; F < I; ++F) {
                    const B = F * N, G = F * R + F % 1 * N;
                    P.set(a.numberData.subarray(B, B + N), G);
                  }
                }
                return this.createTextureData(C, a.type, P, a, 1);
              }
            }
            if (b === h.TextureType.packed) {
              const A = (0, v.createTextureLayoutFromShape)(this.session.layoutStrategy, a.dims, 1, [], { reverseWH: !0 }), M = this.createTextureData(A, a.type, a.numberData, a, 1);
              w = this.pack(M);
            } else w = this.createTextureData(k, a.type, a.numberData, a, 1);
          }
          return w;
        }
        createTextureDataFromLayoutBindTensor(a, b, w, k) {
          return this.createTextureData(a, b, w, k, 1);
        }
        createTextureData(a, b, w, k, A) {
          o.Logger.verbose("InferenceHandler", `Creating TextureData: layout:[${JSON.stringify(a)}]`);
          const M = this.session.textureManager.createTextureFromLayout(b, a, w, A);
          return this.createTextureDataFromTexture(a, b, M, k);
        }
        reshapeUnpacked(a, b) {
          const w = this.getOrCreateTextureData(a, h.TextureType.unpacked), k = { channels: w.channels, height: w.height, width: w.width, shape: b.length !== 0 ? b : [1], strides: _.ShapeUtil.computeStrides(b), unpackedShape: b };
          return this.createTextureDataFromTexture(k, a.type, w.texture).tensor;
        }
        reshapePacked(a, b) {
          const w = this.getOrCreateTextureData(a, h.TextureType.packed);
          if ((0, y.isReshapeCheap)(a.dims, b)) {
            const O = { channels: w.channels, height: w.height, width: w.width, shape: b.length !== 0 ? b : [1], strides: _.ShapeUtil.computeStrides(b), unpackedShape: b, isPacked: !0 };
            return this.createTextureDataFromTexture(O, a.type, w.texture).tensor;
          }
          const k = (0, y.processDims3D)(a.dims), A = (0, y.processDims3D)(b), M = this.reshapePacked(a, k), $ = this.run((0, y.createPackedReshape3DProgramInfoLoader)(this, M, A), [M]);
          return this.reshapePacked($, b);
        }
        cast(a, b) {
          const w = this.getOrCreateTextureData(a, h.TextureType.unpacked);
          return this.createTextureDataFromTexture(w, b, w.texture).tensor;
        }
        createTextureDataFromTexture(a, b, w, k, A) {
          const M = Object.assign(Object.assign({}, a), { tensor: k || new m.Tensor(a.unpackedShape, b, ($) => this.readTexture(M), async ($) => this.readTextureAsync(M), void 0, A), texture: w });
          return this.setTextureData(M.tensor.dataId, M, a.isPacked), M;
        }
        getTextureData(a, b = !1) {
          return this.session.isInitializer(a) ? this.session.getTextureData(a, b) : b ? this.packedTextureDataCache.get(a) : this.unpackedTextureDataCache.get(a);
        }
        setTextureData(a, b, w = !1) {
          this.session.isInitializer(a) ? this.session.setTextureData(a, b, w) : (w ? this.packedTextureDataCache : this.unpackedTextureDataCache).set(a, b);
        }
        isTextureLayoutCached(a, b = !1) {
          return !!this.getTextureData(a.dataId, b);
        }
        dispose() {
          this.session.textureManager.clearActiveTextures(), this.packedTextureDataCache.forEach((a) => this.session.textureManager.releaseTexture(a)), this.packedTextureDataCache = /* @__PURE__ */ new Map(), this.unpackedTextureDataCache.forEach((a) => this.session.textureManager.releaseTexture(a)), this.unpackedTextureDataCache = /* @__PURE__ */ new Map();
        }
        readTexture(a) {
          return a.isPacked ? this.readTexture(this.unpack(a)) : this.session.backend.glContext.isFloat32DownloadSupported ? this.session.textureManager.readTexture(a, a.tensor.type, a.channels) : this.session.textureManager.readUint8TextureAsFloat((0, E.encodeAsUint8)(this, a));
        }
        async readTextureAsync(a) {
          return a.isPacked ? this.readTextureAsync(this.unpack(a)) : this.session.backend.glContext.isFloat32DownloadSupported ? this.session.textureManager.readTextureAsync(a, a.tensor.type, a.channels) : this.session.textureManager.readUint8TextureAsFloat((0, E.encodeAsUint8)(this, a));
        }
        pack(a) {
          return this.executeProgram((0, g.createPackProgramInfoLoader)(this, a.tensor), [a.tensor]);
        }
        unpack(a) {
          return this.executeProgram((0, x.createUnpackProgramInfoLoader)(this, a.tensor), [a.tensor]);
        }
      };
    }, 1640: function(s, e, r) {
      var o = this && this.__createBinding || (Object.create ? function(pe, ye, oe, we) {
        we === void 0 && (we = oe);
        var Se = Object.getOwnPropertyDescriptor(ye, oe);
        Se && !("get" in Se ? !ye.__esModule : Se.writable || Se.configurable) || (Se = { enumerable: !0, get: function() {
          return ye[oe];
        } }), Object.defineProperty(pe, we, Se);
      } : function(pe, ye, oe, we) {
        we === void 0 && (we = oe), pe[we] = ye[oe];
      }), m = this && this.__setModuleDefault || (Object.create ? function(pe, ye) {
        Object.defineProperty(pe, "default", { enumerable: !0, value: ye });
      } : function(pe, ye) {
        pe.default = ye;
      }), _ = this && this.__importStar || function(pe) {
        if (pe && pe.__esModule) return pe;
        var ye = {};
        if (pe != null) for (var oe in pe) oe !== "default" && Object.prototype.hasOwnProperty.call(pe, oe) && o(ye, pe, oe);
        return m(ye, pe), ye;
      };
      Object.defineProperty(e, "__esModule", { value: !0 }), e.WEBGL_OP_RESOLVE_RULES = void 0;
      const g = r(2898), y = _(r(7839)), E = r(4196), x = r(2069), v = r(8138), h = r(9663), a = r(5193), b = r(7992), w = r(1253), k = r(4776), A = r(6572), M = r(3346), $ = r(5623), O = r(2870), C = r(2143), P = r(4939), I = r(718), N = r(2268), R = r(8117), F = r(2278), B = r(5524), G = r(5975), Q = r(3933), ee = r(6558), Y = r(5723), W = r(3738), j = _(r(4909)), J = r(8428), me = r(9793);
      e.WEBGL_OP_RESOLVE_RULES = [["Abs", "", "6+", j.abs], ["Acos", "", "7+", j.acos], ["Add", "", "7+", y.add], ["And", "", "7+", y.and], ["Asin", "", "7+", j.asin], ["Atan", "", "7+", j.atan], ["AveragePool", "", "7+", C.averagePool, C.parseAveragePoolAttributes], ["BatchNormalization", "", "7+", g.batchNormalization, g.parseBatchNormalizationAttributes], ["Cast", "", "6+", E.cast, E.parseCastAttributes], ["Ceil", "", "6+", j.ceil], ["Clip", "", "6-10", j.clip, j.parseClipAttributes], ["Clip", "", "11+", j.clipV11], ["Concat", "", "4+", x.concat, x.parseConcatAttributes], ["Conv", "", "1+", v.conv, v.parseConvAttributes], ["ConvTranspose", "", "1+", h.convTranspose, h.parseConvTransposeAttributes], ["Cos", "", "7+", j.cos], ["Div", "", "7+", y.div], ["Dropout", "", "7+", j.identity], ["DepthToSpace", "", "1+", a.depthToSpace, a.parseDepthToSpaceAttributes], ["Equal", "", "7+", y.equal], ["Elu", "", "6+", j.elu, j.parseEluAttributes], ["Exp", "", "6+", j.exp], ["Flatten", "", "1+", b.flatten, b.parseFlattenAttributes], ["Floor", "", "6+", j.floor], ["FusedConv", "com.microsoft", "1+", v.conv, v.parseConvAttributes], ["Gather", "", "1+", w.gather, w.parseGatherAttributes], ["Gemm", "", "7-10", k.gemm, k.parseGemmAttributesV7], ["Gemm", "", "11+", k.gemm, k.parseGemmAttributesV11], ["GlobalAveragePool", "", "1+", C.globalAveragePool, C.parseGlobalAveragePoolAttributes], ["GlobalMaxPool", "", "1+", C.globalMaxPool], ["Greater", "", "7+", y.greater], ["Identity", "", "1+", j.identity], ["ImageScaler", "", "1+", A.imageScaler, A.parseImageScalerAttributes], ["InstanceNormalization", "", "6+", M.instanceNormalization, M.parseInstanceNormalizationAttributes], ["LeakyRelu", "", "6+", j.leakyRelu, j.parseLeakyReluAttributes], ["Less", "", "7+", y.less], ["Log", "", "6+", j.log], ["MatMul", "", "1+", $.matMul, $.parseMatMulAttributes], ["MaxPool", "", "1+", C.maxPool, C.parseMaxPoolAttributes], ["Mul", "", "7+", y.mul], ["Neg", "", "6+", j.neg], ["Not", "", "1+", j.not], ["Or", "", "7+", y.or], ["Pad", "", "2-10", O.padV2, O.parsePadAttributesV2], ["Pad", "", "11+", O.padV11, O.parsePadAttributesV11], ["Pow", "", "7+", y.pow], ["PRelu", "", "7+", y.pRelu], ["ReduceLogSum", "", "1+", P.reduceLogSum, P.parseReduceAttributes], ["ReduceMax", "", "1+", P.reduceMax, P.parseReduceAttributes], ["ReduceMean", "", "1+", P.reduceMean, P.parseReduceAttributes], ["ReduceMin", "", "1+", P.reduceMin, P.parseReduceAttributes], ["ReduceProd", "", "1+", P.reduceProd, P.parseReduceAttributes], ["ReduceSum", "", "1-12", P.reduceSum, P.parseReduceAttributes], ["ReduceSumSquare", "", "1+", P.reduceLogSumSquare, P.parseReduceAttributes], ["Relu", "", "6+", j.relu], ["Reshape", "", "5+", I.reshape], ["Resize", "", "10", N.resize, N.parseResizeAttributesV10], ["Resize", "", "11+", N.resize, N.parseResizeAttributesV11], ["Shape", "", "1+", R.shape], ["Sigmoid", "", "6+", j.sigmoid], ["Sin", "", "7+", j.sin], ["Slice", "", "10+", F.sliceV10], ["Slice", "", "1-9", F.slice, F.parseSliceAttributes], ["Softmax", "", "1-12", B.softmax, B.parseSoftmaxAttributes], ["Softmax", "", "13+", B.softmaxV13, B.parseSoftmaxAttributesV13], ["Split", "", "2-12", G.split, G.parseSplitAttributes], ["Sqrt", "", "6+", j.sqrt], ["Squeeze", "", "1-12", Q.squeeze, Q.parseSqueezeAttributes], ["Squeeze", "", "13+", Q.squeezeV13], ["Sub", "", "7+", y.sub], ["Sum", "", "6+", ee.sum], ["Tan", "", "7+", j.tan], ["Tanh", "", "6+", j.tanh], ["Tile", "", "6+", Y.tile], ["Transpose", "", "1+", W.transpose, W.parseTransposeAttributes], ["Upsample", "", "7-8", me.upsample, me.parseUpsampleAttributesV7], ["Upsample", "", "9", me.upsample, me.parseUpsampleAttributesV9], ["Unsqueeze", "", "1-12", J.unsqueeze, J.parseUnsqueezeAttributes], ["Unsqueeze", "", "13+", J.unsqueezeV13], ["Xor", "", "7+", y.xor]];
    }, 2898: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.parseBatchNormalizationAttributes = e.batchNormalization = void 0;
      const o = r(246), m = r(5060), _ = r(2039), g = { name: "BatchNormalization", inputNames: ["A", "Scale", "B", "Mean", "Variance"], inputTypes: [_.TextureType.unpacked, _.TextureType.unpacked, _.TextureType.unpacked, _.TextureType.unpacked, _.TextureType.unpacked] };
      e.batchNormalization = (x, v, h) => (E(v), [x.run(Object.assign(Object.assign({}, g), { cacheHint: h.cacheKey, get: () => y(x, v, h) }), v)]), e.parseBatchNormalizationAttributes = (x) => {
        const v = x.attributes.getFloat("epsilon", 1e-5), h = x.attributes.getFloat("momentum", 0.9), a = x.attributes.getInt("spatial", 1);
        return (0, o.createAttributeWithCacheKey)({ epsilon: v, momentum: h, spatial: a });
      };
      const y = (x, v, h) => {
        const a = (0, m.getGlsl)(x.session.backend.glContext.version), b = v[0].dims.length, [w, k] = x.calculateTextureWidthAndHeight(v[1].dims, _.TextureType.unpacked), A = `
  float process(int[${b}] indices) {
    vec2 position = offsetToCoords(indices[1], ${w}, ${k});
    float scale = getColorAsFloat(${a.texture2D}(Scale, position));
    float mean = getColorAsFloat(${a.texture2D}(Mean, position));
    float variance = getColorAsFloat(${a.texture2D}(Variance, position));
    float b = getColorAsFloat(${a.texture2D}(B, position));

    return scale * ( (_A(indices) - mean) / sqrt(variance + float(${h.epsilon})) ) + b;
  }`;
        return Object.assign(Object.assign({}, g), { output: { dims: v[0].dims, type: v[0].type, textureType: _.TextureType.unpacked }, shaderSource: A });
      }, E = (x) => {
        if (!x || x.length !== 5) throw new Error("BatchNormalization requires 5 inputs.");
        const v = x[0], h = x[1], a = x[2], b = x[3], w = x[4];
        if (v.dims.length < 3 || h.dims.length !== 1 || a.dims.length !== 1 || b.dims.length !== 1 || w.dims.length !== 1) throw new Error("invalid input shape.");
        if (h.dims[0] !== v.dims[1] || a.dims[0] !== v.dims[1] || b.dims[0] !== v.dims[1] || w.dims[0] !== v.dims[1]) throw new Error("invalid input shape.");
        if (v.type !== "float32" && v.type !== "float64" || h.type !== "float32" && h.type !== "float64" || a.type !== "float32" && a.type !== "float64" || b.type !== "float32" && b.type !== "float64" || w.type !== "float32" && w.type !== "float64") throw new Error("invalid input tensor types.");
      };
    }, 7839: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.xor = e.sub = e.pRelu = e.pow = e.or = e.mul = e.less = e.greater = e.equal = e.div = e.and = e.add = e.glslPRelu = e.glslPow = e.glslXor = e.glslOr = e.glslAnd = e.glslLess = e.glslGreater = e.glslEqual = e.glslSub = e.glslMul = e.glslDiv = e.glslAdd = void 0;
      const o = r(2517), m = r(8520), _ = r(5060), g = r(2039);
      function y() {
        const P = "add_";
        return { body: `
  float ${P}(float a, float b) {
    return a + b;
  }
  vec4 ${P}(vec4 v1, vec4 v2) {
    return v1 + v2;
  }
  `, name: P, type: m.FunctionType.ValueBased };
      }
      function E() {
        const P = "div_";
        return { body: `
  float ${P}(float a, float b) {
    return a / b;
  }
  vec4 ${P}(vec4 v1, vec4 v2) {
    return v1 / v2;
  }
  `, name: P, type: m.FunctionType.ValueBased };
      }
      function x() {
        const P = "mul_";
        return { body: `
  float ${P}(float a, float b) {
    return a * b;
  }
  vec4 ${P}(vec4 v1, vec4 v2) {
    return v1 * v2;
  }
  `, name: P, type: m.FunctionType.ValueBased };
      }
      function v() {
        const P = "sub_";
        return { body: `
  float ${P}(float a, float b) {
    return a - b;
  }
  vec4 ${P}(vec4 v1, vec4 v2) {
    return v1 - v2;
  }
  `, name: P, type: m.FunctionType.ValueBased };
      }
      function h() {
        const P = "equal_";
        return { body: `
  float ${P}(float a, float b) {
    return float(a == b);
  }
  vec4 ${P}(vec4 v1, vec4 v2) {
    return vec4(equal(v1, v2));
  }
  `, name: P, type: m.FunctionType.ValueBased };
      }
      function a() {
        const P = "greater_";
        return { body: `
  float ${P}(float a, float b) {
    return float(a > b);
  }
  vec4 ${P}(vec4 v1, vec4 v2) {
    return vec4( v1.r > v2.r ,
      v1.g > v2.g,
      v1.b > v2.b,
      v1.a > v2.a );
  }
  `, name: P, type: m.FunctionType.ValueBased };
      }
      function b() {
        const P = "less_";
        return { body: `
  float ${P}(float a, float b) {
    return float(a < b);
  }
  vec4 ${P}(vec4 v1, vec4 v2) {
    return vec4( v1.r < v2.r ,
                v1.g < v2.g,
                v1.b < v2.b,
                v1.a < v2.a );
  }
  `, name: P, type: m.FunctionType.ValueBased };
      }
      function w() {
        const P = "and_";
        return { body: `
  float ${P}(float a, float b) {
    return float( bool(a) && bool(b) );
  }
  vec4 ${P}(vec4 v1, vec4 v2) {
    bvec4 b1 = bvec4(v1);
    bvec4 b2 = bvec4(v2);
    return vec4( b1.r && b2.r ,
                b1.g && b2.g,
                b1.b && b2.b,
                b1.a && b2.a );
  }
  `, name: P, type: m.FunctionType.ValueBased };
      }
      function k() {
        const P = "or_";
        return { body: `
  float ${P}(float a, float b) {
    return float( bool(a) || bool(b) );
  }
  vec4 ${P}(vec4 v1, vec4 v2) {
    bvec4 b1 = bvec4(v1);
    bvec4 b2 = bvec4(v2);
    return vec4( b1.r || b2.r ,
                b1.g || b2.g,
                b1.b || b2.b,
                b1.a || b2.a );
  }
  `, name: P, type: m.FunctionType.ValueBased };
      }
      function A() {
        const P = "xor_";
        return { body: `
  float ${P}(float a, float b) {
    return float( bool(a) ^^ bool(b) );
  }
  vec4 ${P}(vec4 v1, vec4 v2) {
    bvec4 b1 = bvec4(v1);
    bvec4 b2 = bvec4(v2);
    return vec4( b1.r ^^ b2.r ,
                b1.g ^^ b2.g,
                b1.b ^^ b2.b,
                b1.a ^^ b2.a );
  }
  `, name: P, type: m.FunctionType.ValueBased };
      }
      function M() {
        return function(P) {
          const I = `${P}_`;
          return { body: `
  float ${I}(float a, float b) {
    return ${P}(a, b);
  }
  vec4 ${I}(vec4 v1, vec4 v2) {
    return ${P}(v1, v2);
  }
  `, name: I, type: m.FunctionType.ValueBased };
        }("pow");
      }
      function $() {
        const P = "prelu_";
        return { body: `
  float ${P}(float a, float b) {
    return a < 0.0 ? a * b: a;
  }
  vec4 ${P}(vec4 v1, vec4 v2) {
    return vec4(
      v1.r < 0.0 ? v1.r * v2.r: v1.r,
      v1.g < 0.0 ? v1.g * v2.g: v1.g,
      v1.b < 0.0 ? v1.b * v2.b: v1.b,
      v1.a < 0.0 ? v1.a * v2.a: v1.a
      );
  }
  `, name: P, type: m.FunctionType.ValueBased };
      }
      e.glslAdd = y, e.glslDiv = E, e.glslMul = x, e.glslSub = v, e.glslEqual = h, e.glslGreater = a, e.glslLess = b, e.glslAnd = w, e.glslOr = k, e.glslXor = A, e.glslPow = M, e.glslPRelu = $;
      const O = (P, I, N, R = I[0].type, F) => {
        const B = P.session.pack ? g.TextureType.packed : g.TextureType.unpacked;
        return { name: N.name, inputNames: ["A", "B"], inputTypes: [B, B], cacheHint: F, get: () => C(P, I, N, R) };
      }, C = (P, I, N, R = I[0].type) => {
        const F = P.session.pack ? g.TextureType.packed : g.TextureType.unpacked, B = !o.ShapeUtil.areEqual(I[0].dims, I[1].dims);
        let G = I[0].dims;
        const Q = P.session.pack;
        if (B) {
          const W = o.BroadcastUtil.calcShape(I[0].dims, I[1].dims, !1);
          if (!W) throw new Error("Can't perform binary op on the given tensors");
          G = W;
          const j = G.length, J = I[0].dims.length !== 0 ? I[0].dims.length : 1, me = I[1].dims.length !== 0 ? I[1].dims.length : 1, pe = I[0].dims.length !== 0 ? "bcastIndices_A(indices, aindices);" : "aindices[0] = 0;", ye = I[1].dims.length !== 0 ? "bcastIndices_B(indices, bindices);" : "bindices[0] = 0;", oe = (0, _.getGlsl)(P.session.backend.glContext.version), we = Q ? `
      ${N.body}
      void main() {
        vec4 a = getAAtOutCoords();
        vec4 b = getBAtOutCoords();
        vec4 result = ${N.name}(a, b);
        ${oe.output} = result;
      }` : `
      ${N.body}
      float process(int indices[${j}]) {
        int aindices[${J}];
        int bindices[${me}];
        ${pe}
        ${ye}
        return ${N.name}(_A(aindices), _B(bindices));
      }`;
          return { name: N.name, inputNames: ["A", "B"], inputTypes: [F, F], output: { dims: G, type: R, textureType: F }, shaderSource: we, hasMain: Q };
        }
        const ee = (0, _.getGlsl)(P.session.backend.glContext.version), Y = `
    ${N.body}
    void main() {
      vec4 v1 = ${ee.texture2D}(A, TexCoords);
      vec4 v2 = ${ee.texture2D}(B, TexCoords);
      vec4 result = ${N.name}(v1, v2);
      ${ee.output} = result;
    }
    `;
        return { name: N.name, inputNames: ["A", "B"], inputTypes: [F, F], output: { dims: I[0].dims, type: R, textureType: F }, shaderSource: Y, hasMain: !0 };
      };
      e.add = (P, I) => [P.run(O(P, I, y()), I)], e.and = (P, I) => [P.run(O(P, I, w(), "bool"), I)], e.div = (P, I) => [P.run(O(P, I, E()), I)], e.equal = (P, I) => [P.run(O(P, I, h(), "bool"), I)], e.greater = (P, I) => [P.run(O(P, I, a(), "bool"), I)], e.less = (P, I) => [P.run(O(P, I, b(), "bool"), I)], e.mul = (P, I) => [P.run(O(P, I, x()), I)], e.or = (P, I) => [P.run(O(P, I, k(), "bool"), I)], e.pow = (P, I) => [P.run(O(P, I, M()), I)], e.pRelu = (P, I) => [P.run(O(P, I, $()), I)], e.sub = (P, I) => [P.run(O(P, I, v()), I)], e.xor = (P, I) => [P.run(O(P, I, A(), "bool"), I)];
    }, 4196: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.parseCastAttributes = e.cast = void 0;
      const o = r(2517);
      e.cast = (_, g, y) => (m(g), [_.cast(g[0], y)]), e.parseCastAttributes = (_) => o.ProtoUtil.tensorDataTypeFromProto(_.attributes.getInt("to"));
      const m = (_) => {
        if (!_ || _.length !== 1) throw new Error("Cast requires 1 input.");
        if (_[0].type === "string") throw new Error("Invalid input type.");
      };
    }, 1163: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.createPackedConcatProgramInfoLoader = void 0;
      const o = r(5060), m = r(2039), _ = r(9390), g = r(2827);
      e.createPackedConcatProgramInfoLoader = (E, x, v) => {
        const h = (a = x.length, b = v.cacheKey, { name: "Concat (packed)", inputNames: Array.from({ length: a }, (w, k) => `X${k}`), inputTypes: Array(a).fill(m.TextureType.packed), cacheHint: b });
        var a, b;
        return Object.assign(Object.assign({}, h), { get: () => ((w, k, A, M) => {
          const $ = A[0].dims.slice();
          if (M >= $.length || M < -1 * $.length) throw new Error("axis specified for concat doesn't match input dimensionality");
          M < 0 && (M = $.length + M);
          const O = $.slice(0);
          for (let pe = 1; pe < A.length; pe++) {
            const ye = A[pe].dims.slice();
            for (let oe = 0; oe < $.length; oe++) if (oe === M) O[M] += ye[oe];
            else if ($[oe] !== ye[oe]) throw new Error("non concat dimensions must match");
          }
          const C = O.length, P = (0, g.getChannels)("coords", C), I = (0, _.getCoordsDataType)(C), N = (0, g.unpackFromChannel)(), R = A.map((pe) => pe.dims), F = (0, _.getGlChannels)(C), B = new Array(R.length - 1);
          B[0] = R[0][M];
          for (let pe = 1; pe < B.length; pe++) B[pe] = B[pe - 1] + R[pe][M];
          const G = F[M], Q = F.slice(-2), ee = F.join();
          let Y = `if (${G} < ${B[0]}) {
        return getChannel(
            getX0(${ee}), vec2(${Q.join()}));
        }`;
          for (let pe = 1; pe < B.length; pe++) {
            const ye = B[pe - 1];
            Y += `
            if (${G} < ${B[pe]}  && ${G} >= ${B[pe - 1]}) {
              return getChannel(
                getX${pe}(${y(F, G, ye)}),
                vec2(${y(Q, G, ye)}));
            }`;
          }
          const W = B.length, j = B[B.length - 1];
          Y += `
            return getChannel(
              getX${W}(${y(F, G, j)}),
              vec2(${y(Q, G, j)}));`;
          const J = (0, o.getGlsl)(w.session.backend.glContext.version), me = `
          ${N}
          float getValue(${F.map((pe) => "int " + pe)}) {
            ${Y}
          }

          void main() {
            ${I} coords = getOutputCoords();
            int lastDim = coords.${F[C - 1]};
            coords.${F[C - 1]} = coords.${F[C - 2]};
            coords.${F[C - 2]} = lastDim;

            vec4 result = vec4(getValue(${P}), 0., 0., 0.);

            ${P[C - 1]} = ${P[C - 1]} + 1;
            if (${P[C - 1]} < ${O[C - 1]}) {
              result.g = getValue(${P});
            }

            ${P[C - 2]} = ${P[C - 2]} + 1;
            if (${P[C - 2]} < ${O[C - 2]}) {
              result.a = getValue(${P});
            }

            ${P[C - 1]} = ${P[C - 1]} - 1;
            if (${P[C - 2]} < ${O[C - 2]} &&
                ${P[C - 1]} < ${O[C - 1]}) {
              result.b = getValue(${P});
            }
            ${J.output} = result;
          }
        `;
          return Object.assign(Object.assign({}, k), { output: { dims: O, type: A[0].type, textureType: m.TextureType.packed }, shaderSource: me, hasMain: !0 });
        })(E, h, x, v.axis) });
      };
      const y = (E, x, v) => {
        const h = E.indexOf(x);
        return E.map((a, b) => b === h ? `${a} - ${v}` : a).join();
      };
    }, 2069: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.parseConcatAttributes = e.concat = void 0;
      const o = r(246), m = r(2039), _ = r(1163);
      e.concat = (a, b, w) => (h(b), a.session.pack && b[0].dims.length > 1 ? [a.run((0, _.createPackedConcatProgramInfoLoader)(a, b, w), b)] : [a.run(g(a, b, w), b)]);
      const g = (a, b, w) => {
        const k = (A = b.length, M = w.cacheKey, { name: "Concat", inputNames: Array.from({ length: A }, ($, O) => `X${O}`), inputTypes: Array(A).fill(m.TextureType.unpacked), cacheHint: M });
        var A, M;
        return Object.assign(Object.assign({}, k), { get: () => (($, O, C, P) => {
          const I = C[0].dims.slice();
          if (P >= I.length || P < -1 * I.length) throw new Error("axis specified for concat doesn't match input dimensionality");
          P < 0 && (P = I.length + P);
          const N = I.slice(0);
          for (let ee = 1; ee < C.length; ee++) {
            const Y = C[ee].dims.slice();
            for (let W = 0; W < I.length; W++) if (W === P) N[P] += Y[W];
            else if (I[W] !== Y[W]) throw new Error("non concat dimensions must match");
          }
          const R = N.length, F = new Array(C.length);
          let B = 0;
          for (let ee = 0; ee < F.length; ++ee) B += C[ee].dims[P], F[ee] = B;
          let G = "";
          G = C.length < 5 ? y(F) : E(F);
          const Q = `
        ${x(C.length, R)}
        ${v(F)}
        ${G}
        float process(int indices[${R}]) {
          int textureIndex = getTextureWhereDataResides (indices[${P}]);

          if(textureIndex != 0) {
            indices[${P}] = indices[${P}] - int(getSizeInConcatAxisValueFromIndex(textureIndex-int(1)));
          }

          return fetchDataFromCorrectTexture(textureIndex, indices);
        }`;
          return Object.assign(Object.assign({}, O), { output: { dims: N, type: C[0].type, textureType: m.TextureType.unpacked }, shaderSource: Q });
        })(0, k, b, w.axis) });
      }, y = (a) => `int getTextureWhereDataResides(int index) {
      ${a.map((b, w) => `if(index<${b}) {return ${w};}
`).join("")}
    }`, E = (a) => y(a), x = (a, b) => {
        const w = [`float fetchDataFromCorrectTexture(int textureIndex, int indices[${b}]) {`];
        for (let k = 0; k < a; ++k) k === 0 ? w.push(`	if (textureIndex == ${k}) { return _X${k}(indices); }`) : k === a - 1 ? w.push(`	else { return _X${k}(indices); }`) : w.push(`	else if (textureIndex == ${k}) { return _X${k}(indices); }`);
        return w.push("	}"), w.join(`
`);
      }, v = (a) => {
        const b = ["int getSizeInConcatAxisValueFromIndex(int index) {"];
        for (let w = 0; w < a.length; ++w) w === 0 ? b.push(`	if (index == ${w}) { return ${a[w]}; }`) : w === a.length - 1 ? b.push(`	else { return ${a[w]}; }`) : b.push(`	else if (index == ${w}) { return ${a[w]}; }`);
        return b.push("	}"), b.join(`
`);
      };
      e.parseConcatAttributes = (a) => (0, o.createAttributeWithCacheKey)({ axis: a.attributes.getInt("axis") });
      const h = (a) => {
        if (!a || a.length < 1) throw new Error("too few inputs");
        const b = a[0].type, w = a[0].dims.length;
        if (b === "string") throw new Error("string tensor is not supported yet");
        for (const k of a) {
          if (k.type !== b) throw new Error("input tensors should be one type");
          if (k.dims.length !== w) throw new Error("input tensors should have the same shape");
        }
      };
    }, 4770: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.createUnpackedGroupedConvProgramInfoLoader = void 0;
      const o = r(6231), m = r(5060), _ = r(2039), g = r(8138), y = r(2823);
      e.createUnpackedGroupedConvProgramInfoLoader = (E, x, v) => {
        const h = (a = x.length > 2, b = v.cacheKey, { name: "GroupedConv", inputNames: a ? ["X", "W", "Bias"] : ["X", "W"], inputTypes: a ? [_.TextureType.unpacked, _.TextureType.unpacked, _.TextureType.unpacked] : [_.TextureType.unpacked, _.TextureType.unpacked], cacheHint: b });
        var a, b;
        return Object.assign(Object.assign({}, h), { get: () => ((w, k, A, M) => {
          const $ = k.length > 2 ? "value += getBias(output_channel);" : "", O = k[0].dims.slice(), C = k[1].dims.slice(), P = C[0] / M.group;
          o.Logger.verbose("GroupedConv", `autpPad:${M.autoPad}, dilations:${M.dilations}, group:${M.group}, kernelShape:${M.kernelShape}, pads:${M.pads}, strides:${M.strides}`);
          const I = (0, g.calculateOutputShape)(O, C, M.dilations, M.pads, M.strides), N = (0, m.getGlsl)(w.session.backend.glContext.version), { activationFunction: R, applyActivation: F } = (0, y.getActivationSnippet)(M), B = `
  const ivec2 strides = ivec2(${M.strides[0]}, ${M.strides[1]});
  const ivec2 pads = ivec2(${M.pads[0]}, ${M.pads[1]});
  ${R}
  void main() {
    ivec4 coords = getOutputCoords();
    int batch = coords.x;
    int output_channel = coords.y;
    ivec2 xRCCorner = coords.zw * strides - pads;
    int group_id = output_channel / ${P};

    float value = 0.0;
    for (int wInChannel = 0; wInChannel < ${C[1]}; wInChannel++) {
      int input_channel = group_id * ${C[1]} + wInChannel;
      for (int wHeight = 0; wHeight < ${C[2]}; wHeight++) {
        int xHeight = xRCCorner.x + wHeight * ${M.dilations[0]};

        if (xHeight < 0 || xHeight >= ${O[2]}) {
          continue;
        }

        for (int wWidth = 0; wWidth < ${C[3]}; wWidth++) {
          int xWidth = xRCCorner.y + wWidth * ${M.dilations[1]};
          if (xWidth < 0 || xWidth >= ${O[3]}) {
            continue;
          }

          float xVal = getX(batch, input_channel, xWidth, xHeight);
          float wVal = getW(output_channel, wInChannel, wWidth, wHeight);
          value += xVal*wVal;
        }
      }
    }
    ${$}
    ${F}
    ${N.output} = vec4(value, .0, .0, .0);
  }
`;
          return Object.assign(Object.assign({}, A), { output: { dims: I, type: k[0].type, textureType: _.TextureType.unpacked }, shaderSource: B, hasMain: !0 });
        })(E, x, h, v) });
      };
    }, 1386: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.conv2DPacked = e.conv2DPackedPointwise = void 0;
      const o = r(8138), m = r(8555), _ = r(708);
      e.conv2DPackedPointwise = (g, y, E) => {
        const x = y[0].dims, v = y[1].dims, h = (0, o.calculateOutputShape)(x, v, E.dilations, E.pads, E.strides), a = g.reshapePacked(y[0], [x[1], x[2] * x[3]]), b = g.reshapePacked(y[1], [v[0], v[1]]), w = y.length > 2 ? [b, a, y[2]] : [b, a], k = g.run((0, _.createPackedMatmulProgramInfoLoader)(g, w, E), w);
        return g.reshapePacked(k, h);
      }, e.conv2DPacked = (g, y, E) => {
        const x = y[0].dims, v = y[1].dims, h = (0, o.calculateOutputShape)(x, v, E.dilations, E.pads, E.strides), a = g.run((0, m.createPackedIm2ColProgramInfoLoader)(g, y[0], y[1], h, E), [y[0]]), b = g.reshapePacked(y[1], [v[0], v[1] * v[2] * v[3]]), w = y.length === 3 ? [b, a, y[2]] : [b, a], k = g.run((0, _.createPackedMatmulProgramInfoLoader)(g, w, E), w);
        return g.reshapePacked(k, h);
      };
    }, 9663: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.parseConvTransposeAttributes = e.convTranspose = void 0;
      const o = r(246), m = r(5060), _ = r(2039), g = r(2823), y = (b, w, k, A, M, $) => (b - 1) * w + k + (A - 1) * M + 1 - $, E = (b, w, k, A, M) => {
        const $ = Math.floor(b / 2);
        w === "SAME_UPPER" ? (k[A] = $, k[M] = b - $) : w === "SAME_LOWER" && (k[A] = b - $, k[M] = $);
      };
      e.convTranspose = (b, w, k) => (a(w, k), x(b, w, k));
      const x = (b, w, k) => {
        const A = h(k, w);
        return [v(b, w, A)];
      }, v = (b, w, k) => b.run(((A, M, $) => {
        const O = (C = M.length > 2, P = $.cacheKey, { name: "ConvTranspose", inputNames: C ? ["X", "W", "B"] : ["X", "W"], inputTypes: C ? [_.TextureType.unpacked, _.TextureType.unpacked, _.TextureType.unpacked] : [_.TextureType.unpacked, _.TextureType.unpacked], cacheHint: P });
        var C, P;
        return Object.assign(Object.assign({}, O), { get: () => ((I, N, R, F) => {
          const B = N.length > 2 ? "getB(output_channel)" : "0.0", G = N[0].dims, Q = N[1].dims, ee = Q[1], Y = Q[0] / F.group, W = [N[0].dims[0], N[1].dims[1] * F.group, ...F.outputShape], j = (0, m.getGlsl)(I.session.backend.glContext.version), { activationFunction: J, applyActivation: me } = (0, g.getActivationSnippet)(F), pe = `
  const ivec2 strides = ivec2(${F.strides[0]}, ${F.strides[1]});
  const ivec2 pads = ivec2(${F.pads[0]}, ${F.pads[1]});
  ${J}
  void main() {
    ivec4 coords = getOutputCoords();
    int batch = coords.x;
    int output_channel = coords.y;

    ivec2 loc = coords.zw + pads;

    int group_id = output_channel / ${ee};
    int wOutChannel = output_channel - group_id * ${ee};

    float value = ${B};
    for (int inChannelOffset = 0; inChannelOffset < ${Y}; inChannelOffset++) {
      int input_channel = group_id * ${Y} + inChannelOffset;
      for (int wWOff = 0; wWOff < ${Q[2]}; wWOff++) {
        for (int wHOff = 0; wHOff < ${Q[3]}; wHOff++) {
          ivec2 wOff = ivec2(wWOff * ${F.dilations[0]}, wHOff * ${F.dilations[1]});
          ivec2 wLoc = loc - wOff;
          ivec2 wLocIn = wLoc / strides;
          if (
            wLocIn * strides == wLoc &&
            wLocIn.x >= 0 && wLocIn.x < ${G[2]} &&
            wLocIn.y >= 0 && wLocIn.y < ${G[3]}
          ) {
            float xVal = getX(batch, input_channel, wLocIn.y, wLocIn.x);
            float wVal = getW(input_channel, wOutChannel, wHOff, wWOff);
            value += xVal * wVal;
          }
        }
      }
    }
    ${me}
    ${j.output} = vec4(value, .0, .0, .0);
  }
`;
          return Object.assign(Object.assign({}, R), { output: { dims: W, type: N[0].type, textureType: _.TextureType.unpacked }, shaderSource: pe, hasMain: !0 });
        })(A, M, O, $) });
      })(b, w, k), w), h = (b, w) => {
        const k = b.kernelShape.slice();
        if (b.kernelShape.length === 0) for (let O = 2; O < w[1].dims.length; ++O) k.push(w[1].dims[O]);
        const A = b.pads.slice(), M = b.outputShape.slice();
        ((O, C, P, I, N, R, F, B) => {
          const G = O.length - 2, Q = B.length === 0;
          for (let ee = 0; ee < G; ++ee) {
            const Y = Q ? O[ee + 2] * R[ee] : B[ee], W = y(O[ee + 2], R[ee], N[ee], C[ee], P[ee], Y);
            E(W, I, N, ee, ee + G), Q && B.push(R[ee] * (O[ee + 2] - 1) + F[ee] + (C[ee] - 1) * P[ee] + 1 - N[ee] - N[ee + G]);
          }
        })(w[0].dims, k, b.dilations, b.autoPad, A, b.strides, b.outputPadding, M);
        const $ = Object.assign({}, b);
        return Object.assign($, { kernelShape: k, pads: A, outputShape: M, cacheKey: b.cacheKey }), $;
      };
      e.parseConvTransposeAttributes = (b) => {
        const w = b.attributes, k = (0, g.parseInternalActivationAttributes)(w), A = w.getString("auto_pad", "NOTSET"), M = w.getInts("dilations", [1, 1]), $ = w.getInt("group", 1), O = w.getInts("kernel_shape", []), C = w.getInts("output_padding", [0, 0]), P = w.getInts("output_shape", []), I = w.getInts("pads", [0, 0, 0, 0]), N = w.getInts("strides", [1, 1]);
        return (0, o.createAttributeWithCacheKey)(Object.assign({ autoPad: A, dilations: M, group: $, kernelShape: O, outputPadding: C, outputShape: P, pads: I, strides: N }, k));
      };
      const a = (b, w) => {
        if (!b || b.length !== 2 && b.length !== 3) throw new Error("Conv requires 2 or 3 inputs");
        if (b[0].dims.length !== 4 || b[1].dims.length !== 4) throw new Error("currently only support 2-dimensional conv");
        if (b[0].dims[1] !== b[1].dims[0]) throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");
        const k = b[1].dims[1] * w.group;
        if (b.length === 3 && (b[2].dims.length !== 1 || b[2].dims[0] !== k)) throw new Error("invalid bias");
        const A = b[0].dims.length - 2;
        if (w.dilations.length !== A) throw new Error(`dilations should be ${A}D`);
        if (w.strides.length !== A) throw new Error(`strides should be ${A}D`);
        if (w.pads.length !== 2 * A) throw new Error(`pads should be ${2 * A}D`);
        if (w.outputPadding.length !== A) throw new Error(`output_padding should be ${A}D`);
        if (w.kernelShape.length !== 0 && w.kernelShape.length !== b[1].dims.length - 2) throw new Error("invalid kernel shape");
        if (w.outputShape.length !== 0 && w.outputShape.length !== b[0].dims.length - 2) throw new Error("invalid output shape");
        if (b[0].type !== "float32" || b[1].type !== "float32") throw new Error("ConvTranspose input(X,W) should be float tensor");
        if (b.length === 3 && b[2].type !== "float32") throw new Error("ConvTranspose input(bias) should be float tensor");
      };
    }, 8138: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.parseConvAttributes = e.conv = e.calculateOutputShape = void 0;
      const o = r(246), m = r(2517), _ = r(4770), g = r(1386), y = r(9828), E = r(2823), x = r(3248), v = r(5623);
      e.calculateOutputShape = (A, M, $, O, C) => {
        const P = A[0], I = A.slice(2), N = I.length, R = M[0], F = M.slice(2).map((G, Q) => G + (G - 1) * ($[Q] - 1)), B = I.map((G, Q) => G + O[Q] + O[Q + N]).map((G, Q) => Math.floor((G - F[Q] + C[Q]) / C[Q]));
        return [P, R].concat(...B);
      }, e.conv = (A, M, $) => (k(M, $), h(A, M, $));
      const h = (A, M, $) => {
        const O = w($, M), C = A.session.pack, P = O.kernelShape[0] === 1 && O.kernelShape[1] === 1;
        return O.group > 1 ? [A.run((0, _.createUnpackedGroupedConvProgramInfoLoader)(A, M, O), M)] : P && C ? [a(A, M, O)] : C && M[0].dims.length === 4 && M[0].dims[0] === 1 && !P ? [(0, g.conv2DPacked)(A, M, O)] : [b(A, M, O)];
      }, a = (A, M, $) => {
        const O = M[0].dims, C = M[1].dims, P = (0, e.calculateOutputShape)(O, C, $.dilations, $.pads, $.strides), I = A.reshapeUnpacked(M[0], [O[1], O[2] * O[3]]), N = A.reshapeUnpacked(M[1], [C[0], C[1]]), R = M.length > 2 ? [N, I, M[2]] : [N, I], F = A.run((0, v.createMatmulProgramInfoLoader)(R, $), R);
        return A.reshapeUnpacked(F, P);
      }, b = (A, M, $) => {
        const O = M[0].dims, C = M[1].dims, P = (0, e.calculateOutputShape)(O, C, $.dilations, $.pads, $.strides), I = A.run((0, x.createIm2ColProgramInfoLoader)(A, M[0], M[1], P, $), [M[0]]), N = M.length === 3 ? [I, M[1], M[2]] : [I, M[1]];
        return A.run((0, y.createDotProductProgramInfoLoader)(A, M, P, $), N);
      }, w = (A, M) => {
        const $ = A.kernelShape.slice();
        if (A.kernelShape.length === 0) for (let P = 2; P < M[1].dims.length; ++P) $.push(M[1].dims[P]);
        const O = A.pads.slice();
        m.PoolConvUtil.adjustPadsBasedOnAutoPad(M[0].dims, A.strides, A.dilations, $, O, A.autoPad);
        const C = Object.assign({}, A);
        return Object.assign(C, { kernelShape: $, pads: O, cacheKey: A.cacheKey }), C;
      };
      e.parseConvAttributes = (A) => {
        const M = A.attributes, $ = (0, E.parseInternalActivationAttributes)(M), O = M.getString("auto_pad", "NOTSET"), C = M.getInts("dilations", [1, 1]), P = M.getInt("group", 1), I = M.getInts("kernel_shape", []), N = M.getInts("pads", [0, 0, 0, 0]), R = M.getInts("strides", [1, 1]);
        return (0, o.createAttributeWithCacheKey)(Object.assign({ autoPad: O, dilations: C, group: P, kernelShape: I, pads: N, strides: R }, $));
      };
      const k = (A, M) => {
        if (!A || A.length !== 2 && A.length !== 3) throw new Error("Conv requires 2 or 3 inputs");
        if (A[0].dims.length !== 4 || A[1].dims.length !== 4) throw new Error("currently only support 2-dimensional conv");
        if (A[0].dims[1] !== A[1].dims[1] * M.group) throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");
        if (A.length === 3 && (A[2].dims.length !== 1 || A[1].dims[0] !== A[2].dims[0])) throw new Error("invalid bias");
        const $ = A[0].dims.length - 2;
        if (M.dilations.length !== $) throw new Error(`dilations should be ${$}D`);
        if (M.strides.length !== $) throw new Error(`strides should be ${$}D`);
        if (M.pads.length !== 2 * $) throw new Error(`pads should be ${2 * $}D`);
        if (M.kernelShape.length !== 0 && M.kernelShape.length !== A[1].dims.length - 2) throw new Error("invalid kernel shape");
        if (A[0].type !== "float32" || A[1].type !== "float32") throw new Error("Conv input(X,W) should be float tensor");
        if (A.length === 3 && A[2].type !== "float32") throw new Error("Conv input(bias) should be float tensor");
      };
    }, 5193: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.parseDepthToSpaceAttributes = e.depthToSpace = void 0;
      const o = r(3738);
      e.depthToSpace = (_, g, y) => {
        m(g);
        const E = y.blocksize, x = E * E, v = y.mode === "DCR" ? [0, 3, 4, 1, 5, 2] : [0, 1, 4, 2, 5, 3], h = y.mode === "DCR" ? [g[0].dims[0], E, E, g[0].dims[1] / x, g[0].dims[2], g[0].dims[3]] : [g[0].dims[0], g[0].dims[1] / x, E, E, g[0].dims[2], g[0].dims[3]], a = _.reshapeUnpacked(g[0], h), b = { perm: v, cacheKey: `${v}` }, [w] = (0, o.transpose)(_, [a], b), k = [g[0].dims[0], g[0].dims[1] / x, g[0].dims[2] * E, g[0].dims[3] * E];
        return [_.reshapeUnpacked(w, k)];
      }, e.parseDepthToSpaceAttributes = (_) => {
        const g = _.attributes.getInt("blocksize");
        if (g < 1) throw new Error(`blocksize must be >= 1, but got : ${g} for DepthToSpace`);
        const y = _.attributes.getString("mode", "DCR");
        if (y !== "DCR" && y !== "CRD") throw new Error(`unrecognized mode: ${y} for DepthToSpace`);
        return { mode: y, blocksize: g };
      };
      const m = (_) => {
        if (_.length !== 1) throw new Error(`DepthToSpace expect 1 inputs, but got ${_.length}`);
        if (_[0].type === "string" || _[0].dims.length !== 4) throw new TypeError("DepthToSpace input should be a 4-D numeric tensor");
      };
    }, 9828: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.createDotProductProgramInfoLoader = void 0;
      const o = r(2517), m = r(5060), _ = r(2039), g = r(2823), y = r(3248);
      e.createDotProductProgramInfoLoader = (E, x, v, h) => {
        const a = ((b, w) => ({ name: "ConvDotProduct", inputNames: b ? ["Im2Col", "K", "B"] : ["Im2Col", "K"], inputTypes: b ? [_.TextureType.unpacked, _.TextureType.packedLastDimension, _.TextureType.unpacked] : [_.TextureType.unpacked, _.TextureType.packedLastDimension], cacheKey: w.activationCacheKey }))(x.length > 2, h);
        return Object.assign(Object.assign({}, a), { get: () => ((b, w, k, A, M) => {
          const $ = k[0].dims, O = k[1].dims, C = [O[0], Math.ceil($[1] * O[2] * O[3] / 4)], P = (0, y.calculateIm2ColDims)($, O, A), [I, N] = b.calculateTextureWidthAndHeight(C, _.TextureType.packedLastDimension), R = o.ShapeUtil.computeStrides(P), [F, B] = b.calculateTextureWidthAndHeight(P, _.TextureType.packedLastDimension), G = A.length, Q = k.length < 3 ? "0.0" : "_B(b)", ee = Math.ceil($[1] * O[2] * O[3] / 4), { activationFunction: Y, applyActivation: W } = (0, g.getActivationSnippet)(M), j = (0, m.getGlsl)(b.session.backend.glContext.version), J = `
${Y}
float process(int indices[${G}]) {
  int b[1];
  b[0] = indices[1];
  int im2col[4];
  im2col[0] = indices[0];
  im2col[1] = indices[2];
  im2col[2] = indices[3];
  int im2colOffset = im2col[0] * ${R[0]} + im2col[1] * ${R[1]} + im2col[2] * ${R[2]};
  int kernelOffset = indices[1] * ${C[1]};
  float value = ${Q};
  for (int i = 0; i < ${ee}; ++i) {
    vec2 im2colCoords = offsetToCoords(im2colOffset, ${F}, ${B});
    vec2 kernelCoords = offsetToCoords(kernelOffset, ${I}, ${N});
    value += dot(${j.texture2D}(Im2Col, im2colCoords), ${j.texture2D}(K, kernelCoords));
    ++im2colOffset;
    ++kernelOffset;
  }
  ${W}
  return value;
}`;
          return Object.assign(Object.assign({}, w), { output: { dims: A, type: k[0].type, textureType: _.TextureType.unpacked }, shaderSource: J });
        })(E, a, x, v, h) });
      };
    }, 7992: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.parseFlattenAttributes = e.flatten = void 0;
      const o = r(2517);
      e.flatten = (_, g, y) => {
        m(g, y);
        const E = o.ShapeUtil.flattenShape(g[0].dims, y);
        return [_.reshapeUnpacked(g[0], E)];
      }, e.parseFlattenAttributes = (_) => _.attributes.getInt("axis", 1);
      const m = (_, g) => {
        if (!_ || _.length !== 1) throw new Error("Flatten requires 1 input.");
        const y = _[0].dims.length;
        if (y === 0) throw new Error("scalar tensor is not supported.");
        if (g < -y || g > y) throw new Error("Invalid axis");
        if (_[0].type === "string") throw new Error("string tensor is not supported.");
      };
    }, 2823: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.parseInternalActivationAttributes = e.getActivationSnippet = void 0;
      const o = r(2517), m = r(4909);
      e.getActivationSnippet = function(_) {
        let g;
        switch (_.activation) {
          case "Relu":
            g = (0, m.glslRelu)();
            break;
          case "Sigmoid":
            g = (0, m.glslSigmoid)();
            break;
          case "Clip":
            g = (0, m.glslClip)(_.clipMin, _.clipMax);
            break;
          default:
            return { activationFunction: "", applyActivation: "" };
        }
        const y = g.name;
        return { activationFunction: g.body, applyActivation: `value = ${y}_(value);` };
      }, e.parseInternalActivationAttributes = (_) => {
        const g = _.getString("activation", "");
        if (g === "Clip") {
          const [y, E] = _.getFloats("activation_params", [o.MIN_CLIP, o.MAX_CLIP]);
          return { activation: g, clipMax: E, clipMin: y, activationCacheKey: `${g}:${y},${E}` };
        }
        return { activation: g, activationCacheKey: g };
      };
    }, 1253: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.parseGatherAttributes = e.gather = void 0;
      const o = r(246), m = r(782), _ = r(2517), g = r(2039);
      e.gather = (v, h, a) => (x(h, a.axis), [v.run(E(v, h, a), h)]), e.parseGatherAttributes = (v) => (0, o.createAttributeWithCacheKey)({ axis: v.attributes.getInt("axis", 0) });
      const y = { name: "Gather", inputNames: ["A", "B"], inputTypes: [g.TextureType.unpacked, g.TextureType.unpacked] }, E = (v, h, a) => {
        const b = Object.assign(Object.assign({}, y), { cacheHint: a.cacheKey });
        return Object.assign(Object.assign({}, b), { get: () => ((w, k, A, M) => {
          const $ = A[0].dims.slice(), O = A[1].dims.slice(), C = new Array($.length + O.length - 1);
          M = _.ShapeUtil.normalizeAxis(M, $.length);
          const P = [];
          for (let N = 0; N < C.length; N++) N < M ? (C[N] = $[N], P.push(`inputIdx[${N}] = outputIdx[${N}];`)) : N < M + O.length ? (C[N] = O[N - M], P.push(`indexDataIdx[${N - M}] = outputIdx[${N}];`)) : (C[N] = $[N - O.length + 1], P.push(`inputIdx[${N - O.length + 1}] = outputIdx[${N}];`));
          const I = `
      float process(int outputIdx[${C.length || 1}]) {
        int inputIdx[${$.length}];
        int indexDataIdx[${O.length || 1}];
        indexDataIdx[0] = 0;
        ${P.join(`
        `)}
        int idx = int(_B(indexDataIdx));
        inputIdx[${M}] = idx < 0 ? idx + ${$[M]} : idx;
        return _A(inputIdx);
      }`;
          return Object.assign(Object.assign({}, k), { output: { dims: C, type: A[0].type, textureType: g.TextureType.unpacked }, shaderSource: I });
        })(0, b, h, a.axis) });
      }, x = (v, h) => {
        if (!v || v.length !== 2) throw new Error("Gather requires 2 inputs.");
        const a = v[0].dims.length;
        if (a < 1) throw new Error("Invalid input shape.");
        if (h < -a || h > a - 1) throw new Error("Invalid axis.");
        if (m.NUMBER_TYPES.indexOf(v[0].type) === -1) throw new Error("Invaid input type.");
        if (v[1].type !== "int32" && v[1].type !== "int16") throw new Error("Invaid input type.");
      };
    }, 4776: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.parseGemmAttributesV11 = e.parseGemmAttributesV7 = e.gemm = void 0;
      const o = r(246), m = r(2517), _ = r(2039);
      e.gemm = (v, h, a) => (x(h, a), [v.run(y(h, a), h)]);
      const g = (v, h) => {
        const a = v.attributes.getInt("transA", 0) !== 0, b = v.attributes.getInt("transB", 0) !== 0, w = v.attributes.getFloat("alpha", 1), k = v.attributes.getFloat("beta", 1);
        return (0, o.createAttributeWithCacheKey)({ transA: a, transB: b, alpha: w, beta: k, isOptionalC: h });
      };
      e.parseGemmAttributesV7 = (v) => g(v, !1), e.parseGemmAttributesV11 = (v) => g(v, !0);
      const y = (v, h) => {
        const a = { name: "Gemm", inputNames: v.length === 3 ? ["A", "B", "C"] : ["A", "B"], inputTypes: v.length === 3 ? [_.TextureType.unpacked, _.TextureType.unpacked, _.TextureType.unpacked] : [_.TextureType.unpacked, _.TextureType.unpacked], key: h.cacheKey };
        return Object.assign(Object.assign({}, a), { get: () => E(a, v, h) });
      }, E = (v, h, a) => {
        const b = h[0].dims.slice(), w = h[1].dims.slice(), [k, A] = m.GemmUtil.getShapeOfGemmResult(b, a.transA, w, a.transB, h.length === 3 ? h[2].dims : void 0), M = [k, A];
        if (!M) throw new Error("Can't use gemm on the given tensors");
        let $ = b[b.length - 1], O = "";
        a.transA && ($ = b[0]), a.transA && a.transB ? O = "value += _A_T(a) * _B_T(b);" : a.transA && !a.transB ? O = "value += _A_T(a) * _B(b);" : !a.transA && a.transB ? O = "value += _A(a) * _B_T(b);" : a.transA || a.transB || (O = "value += _A(a) * _B(b);");
        const C = M.length, P = `
      float process(int indices[${C}]) {
          int a[${C}];
          int b[${C}];
          ${h.length === 3 ? `int c[${h[2].dims.length}];` : ""}

          copyVec(indices, a);
          copyVec(indices, b);
          ${h.length === 3 ? "bcastIndices_C(indices, c);" : ""}

          float value = 0.0;
          for (int k=0; k<${$}; ++k) {
              a[${C - 1}] = k;
              b[${C - 2}] = k;
              ${O}
          }

          value = value * alpha;
          ${h.length === 3 ? "value += beta * _C(c);" : ""}
          return value;
      }`;
        return Object.assign(Object.assign({}, v), { output: { dims: M, type: h[0].type, textureType: _.TextureType.unpacked }, variables: [{ name: "alpha", type: "float", data: a.alpha }, { name: "beta", type: "float", data: a.beta }], shaderSource: P });
      }, x = (v, h) => {
        if (!v) throw new Error("Input is missing");
        if (h.isOptionalC && (v.length < 2 || v.length > 3)) throw new Error("Invaid input shape.");
        if (!h.isOptionalC && v.length !== 3) throw new Error("Gemm requires 3 inputs");
        if (v.length === 3 && v[2].dims.length !== 1 && v[2].dims.length !== 2) throw new Error("Invalid input shape of C");
        if (v[0].type !== "float32" && v[0].type !== "float64" || v[1].type !== "float32" && v[1].type !== "float64" || v.length === 3 && v[2].type !== "float32" && v[2].type !== "float64") throw new Error("Invalid input type.");
        if (v[0].type !== v[1].type || v.length === 3 && v[0].type !== v[2].type) throw new Error("Input types are mismatched");
      };
    }, 8555: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.createPackedIm2ColProgramInfoLoader = void 0;
      const o = r(5060), m = r(2039), _ = r(2827);
      e.createPackedIm2ColProgramInfoLoader = (g, y, E, x, v) => {
        const h = (a = v.cacheKey, { name: "Im2Col (packed)", inputNames: ["A"], inputTypes: [m.TextureType.packed], cacheHint: a });
        var a;
        return Object.assign(Object.assign({}, h), { get: () => ((b, w, k, A, M, $) => {
          const O = k.dims, C = A.dims, P = M.length, I = [C[1] * C[2] * C[3], M[2] * M[3]], N = C[2] * C[3], R = (0, _.unpackFromChannel)(), F = (0, o.getGlsl)(b.session.backend.glContext.version);
          let B = "";
          for (let Q = 0; Q <= 1; Q++) for (let ee = 0; ee <= 1; ee++) B += `
            blockIndex = rc.x + ${ee};
            pos = rc.y + ${Q};

            if(blockIndex < ${I[1]} && pos < ${I[0]}) {
              offsetY = int(blockIndex / (${M[P - 1]})) * ${$.strides[0]} -
                ${$.pads[0]};
              d0 = offsetY + ${$.dilations[0]} * (imod(pos, ${N}) / ${C[2]});

              if(d0 < ${O[2]} && d0 >= 0) {
                offsetX = imod(blockIndex, ${M[P - 1]}) * ${$.strides[1]} -
                  ${$.pads[1]};
                d1 = offsetX + ${$.dilations[1]} * imod(imod(pos, ${N}), ${C[2]});

                if(d1 < ${O[3]} && d1 >= 0) {

                  ch = int(float(pos)/ ${N}.);
                    innerDims = vec2(d0, d1);
                    result[${2 * Q + ee}] = getChannel(
                      getA(0, ch, int(innerDims.x),
                      int(innerDims.y)), innerDims);
                }
              }
            }

          `;
          const G = `
      ${R}

      void main() {
        ivec2 rc = getOutputCoords();
          vec4 result = vec4(0.0);
          int blockIndex, pos, offsetY, d0, offsetX, d1, ch;
          vec2 innerDims;
          ${B}
          ${F.output} = result;
      }
            `;
          return Object.assign(Object.assign({}, w), { output: { dims: I, type: k.type, textureType: m.TextureType.packed }, shaderSource: G, hasMain: !0 });
        })(g, h, y, E, x, v) });
      };
    }, 3248: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.calculateIm2ColDims = e.createIm2ColProgramInfoLoader = void 0;
      const o = r(2039);
      e.createIm2ColProgramInfoLoader = (m, _, g, y, E) => {
        const x = (v = E.cacheKey, { name: "Im2Col", inputNames: ["X"], inputTypes: [o.TextureType.unpacked], cacheHint: v });
        var v;
        return Object.assign(Object.assign({}, x), { get: () => ((h, a, b, w, k, A) => {
          const M = b.dims, $ = w.dims, O = k.length, C = (0, e.calculateIm2ColDims)(M, $, k, 4), P = `
        const int XC = ${M[1]};
        const int XH = ${M[2]};
        const int XW = ${M[3]};
        const int KH = ${A.kernelShape[0]};
        const int KW = ${A.kernelShape[1]};
        const int dilationH = ${A.dilations[0]};
        const int dilationW = ${A.dilations[1]};
        const int strideH = ${A.strides[0]};
        const int strideW = ${A.strides[1]};
        const int padH = ${A.pads[0]};
        const int padW = ${A.pads[1]};
        const int KHKW = KH*KW;
        const int XCKHKW = XC * KHKW;
        const int outputChannels = 4;
        vec4 process(int indices[${O}]) {
          int b  = indices[0]; // batch size
          int oh = indices[1] * strideH - padH; //output height
          int ow = indices[2] * strideW - padW; //output width
          int p = indices[3] * outputChannels; //patch
          vec4 value = vec4(0.0);
          for(int i=0; i < outputChannels; ++i) {
            if(p < XCKHKW) {
              int patchC = p / KHKW;
              int patchH = (p - patchC*KHKW) / KW;
              int patchW = (p - patchC*KHKW) - patchH * KW;
              int xh2 = oh + patchH * dilationH;
              int xw2 = ow + patchW * dilationW;
              int x[${M.length}];
              x[0] = b;
              x[1] = patchC;
              x[2] = xh2;
              x[3] = xw2;
              if(xh2 >= 0 &&
                  xh2 < XH &&
                  xw2 >= 0 &&
                  xw2 < XW) {
                value[i] = _X(x);
              }
            }
            ++p;
          }
          return value;
        }
        `;
          return Object.assign(Object.assign({}, a), { output: { dims: C, type: b.type, textureType: o.TextureType.packedLastDimension }, shaderSource: P });
        })(0, x, _, g, y, E) });
      }, e.calculateIm2ColDims = (m, _, g, y = 4) => [g[0], g[2], g[3], Math.ceil(m[1] * _[2] * _[3] / y)];
    }, 6572: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.parseImageScalerAttributes = e.imageScaler = void 0;
      const o = r(246), m = r(2039);
      e.imageScaler = (x, v, h) => (E(v), [x.run(g(x, v, h), v)]), e.parseImageScalerAttributes = (x) => {
        const v = x.attributes.getFloat("scale"), h = x.attributes.getFloats("bias");
        return (0, o.createAttributeWithCacheKey)({ scale: v, bias: h });
      };
      const _ = { name: "ImageScaler", inputNames: ["X"], inputTypes: [m.TextureType.unpacked] }, g = (x, v, h) => {
        const a = Object.assign(Object.assign({}, _), { cacheHint: h.cacheKey });
        return Object.assign(Object.assign({}, a), { get: () => ((b, w, k, A) => {
          const M = k[0].dims.slice(), $ = M.length, O = `
      ${y(A.bias.length)}
      float process(int indices[${$}]) {
        return _X(indices) * scale + getBias(bias, indices[1]);
      }`;
          return Object.assign(Object.assign({}, w), { output: { dims: M, type: k[0].type, textureType: m.TextureType.unpacked }, variables: [{ name: "bias", type: "float", arrayLength: A.bias.length, data: A.bias }, { name: "scale", type: "float", data: A.scale }], shaderSource: O });
        })(0, a, v, h) });
      }, y = (x) => {
        const v = [`float getBias(float bias[${x}], int channel) {`];
        for (let h = 0; h < x; ++h) h === 0 ? v.push(`	if (channel == ${h}) { return bias[${h}]; }`) : h === x - 1 ? v.push(`	else { return bias[${h}]; }`) : v.push(`	else if (channel == ${h}) { return bias[${h}]; }`);
        return v.push("	}"), v.join(`
`);
      }, E = (x) => {
        if (!x || x.length !== 1) throw new Error("ImageScaler requires 1 input.");
        if (x[0].dims.length !== 4) throw new Error("Invalid input shape.");
        if (x[0].type !== "float32" && x[0].type !== "float64") throw new Error("Invalid input type.");
      };
    }, 3346: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.parseInstanceNormalizationAttributes = e.instanceNormalization = void 0;
      const o = r(5060), m = r(2039);
      e.instanceNormalization = (v, h, a) => {
        x(h);
        const b = v.run(g(h[0]), h);
        return [v.run(E(v, h[0], a, b.dims), [h[0], b, h[1], h[2]])];
      }, e.parseInstanceNormalizationAttributes = (v) => v.attributes.getFloat("epsilon", 1e-5);
      const _ = { name: "InstanceNormalization_MeanAndVariance", inputNames: ["X"], inputTypes: [m.TextureType.unpacked] }, g = (v) => Object.assign(Object.assign({}, _), { get: () => ((h, a) => {
        const b = a.dims.slice(), w = b[1], k = b[2] * b[3], A = [b[0], w], M = `
      vec4 process(int[2] indices) {
        vec4 v = vec4(0.0);
        int a[4];
        a[0] = indices[0];
        a[1] = indices[1];
        float temp = 0.0;
        for(int a2=0; a2<${b[2]}; a2++) {
          a[2] = a2;
          for(int a3=0; a3<${b[3]}; a3++) {
            a[3] = a3;
            float x = _X(a);
            temp += x;
          }
        }
        float mean = temp / float(${k});
        temp = 0.0;
        for(int a2=0; a2<${b[2]}; a2++) {
          a[2] = a2;
          for(int a3=0; a3<${b[3]}; a3++) {
            a[3] = a3;
            float x = _X(a);
            temp += (x - mean) * (x - mean);
          }
        }
        v.r = mean;
        v.g = temp / float(${k});

        return v;
      }`;
        return Object.assign(Object.assign({}, h), { output: { dims: A, type: a.type, textureType: m.TextureType.packedLastDimension }, shaderSource: M });
      })(_, v) }), y = { name: "InstanceNormalization_ComputeOutput", inputNames: ["X", "MeanAndVariance", "Scale", "B"], inputTypes: [m.TextureType.unpacked, m.TextureType.packedLastDimension, m.TextureType.unpacked, m.TextureType.unpacked] }, E = (v, h, a, b) => {
        const w = Object.assign(Object.assign({}, y), { cacheHint: `${a}` });
        return Object.assign(Object.assign({}, w), { get: () => ((k, A, M, $, O) => {
          const C = (0, o.getGlsl)(k.session.backend.glContext.version), [P, I] = k.calculateTextureWidthAndHeight(O, m.TextureType.packedLastDimension), [N, R] = [P / 4, I], F = `
      vec4 get_MeanAndVariance(int[2] mv) {
        int offset = indicesToOffset_MeanAndVariance(mv);
        vec2 coords = offsetToCoords(offset, ${N}, ${R});
        return ${C.texture2D}(MeanAndVariance, coords);
      }

      float process(int[4] indices) {
        int mv[2];
        mv[0] = indices[0];
        mv[1] = indices[1];
        vec4 mean_and_variance = get_MeanAndVariance(mv);
        float mean = mean_and_variance.r;
        float variance = mean_and_variance.g;

        int sb[1];
        sb[0] = indices[1];
        float scale = _Scale(sb);
        float b = _B(sb);

        return scale * (_X(indices) - mean) / sqrt(variance + epsilon) + b;
      }`;
          return Object.assign(Object.assign({}, A), { output: { dims: M.dims, type: M.type, textureType: m.TextureType.unpacked }, variables: [{ name: "epsilon", type: "float", data: $ }], shaderSource: F });
        })(v, w, h, a, b) });
      }, x = (v) => {
        if (!v || v.length !== 3) throw new Error("InstanceNormalization requires 3 inputs.");
        const h = v[0], a = v[1], b = v[2];
        if (h.dims.length < 3 || a.dims.length !== 1 || b.dims.length !== 1) throw new Error("Invalid input shape.");
        if (a.dims[0] !== h.dims[1] || b.dims[0] !== h.dims[1]) throw new Error("Input shapes are mismatched.");
        if (h.type !== "float32" && h.type !== "float64" || a.type !== "float32" && a.type !== "float64" || b.type !== "float32" && b.type !== "float64") throw new Error("Invalid input type.");
        if (v[0].dims.length !== 4) throw new Error("Only support 4-D input shape.");
      };
    }, 708: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.createPackedMatmulProgramInfoLoader = void 0;
      const o = r(2517), m = r(5060), _ = r(2039), g = r(9390), y = r(2823), E = r(5623);
      e.createPackedMatmulProgramInfoLoader = (x, v, h) => {
        const a = (b = v.length > 2, w = h.activationCacheKey, { name: "MatMul (packed)", inputNames: b ? ["A", "B", "Bias"] : ["A", "B"], inputTypes: b ? [_.TextureType.packed, _.TextureType.packed, _.TextureType.packed] : [_.TextureType.packed, _.TextureType.packed], cacheHint: w });
        var b, w;
        return Object.assign(Object.assign({}, a), { get: () => ((k, A, M, $) => {
          const O = M.length > 2, C = O ? "value += getBiasForMatmul();" : "", P = M[0].dims, I = M[1].dims, N = o.BroadcastUtil.calcShape(P, I, !0), R = !o.ShapeUtil.areEqual(M[0].dims, M[1].dims);
          if (!N) throw new Error("Can't use matmul on the given tensors");
          const F = P[P.length - 1], B = Math.ceil(F / 2), G = P.length, Q = I.length, ee = (0, m.getGlsl)(k.session.backend.glContext.version), Y = (0, g.getCoordsDataType)(N.length), W = N.length, j = (0, g.getGlChannels)(), { activationFunction: J, applyActivation: me } = (0, y.getActivationSnippet)($), pe = O ? `${(0, E.getBiasForMatmul)(Y, j, M[2].dims, N, !0)}` : "", ye = R ? `${function(Me, de, Oe, $e) {
            let ge = [], Ye = [];
            const Ie = Oe[0].dims, Ge = Oe[1].dims, Ke = Ie.length, Ne = Ge.length, Ce = $e.length, lt = Ce - Ke, ut = Ce - Ne;
            ge = Ie.map((tt, _e) => `coords.${de[_e + lt]}`), ge[Ke - 1] = "i*2", ge.join(", "), Ye = Ge.map((tt, _e) => `coords.${de[_e + ut]}`), Ye[Ne - 2] = "i*2", Ye.join(", ");
            const Je = o.BroadcastUtil.getBroadcastDims(Ie, $e), Ze = o.BroadcastUtil.getBroadcastDims(Ge, $e), at = Je.map((tt) => `coords.${de[tt + lt]} = 0;`).join(`
`), mt = Ze.map((tt) => `coords.${de[tt + ut]} = 0;`).join(`
`), pt = `int lastDim = coords.${de[Ce - 1]};
  coords.${de[Ce - 1]} = coords.${de[Ce - 2]};
  coords.${de[Ce - 2]} = lastDim;`;
            return `
vec4 getAAtOutCoordsMatmul(int i) {
  ${Me} coords = getOutputCoords();
  ${pt}
  ${at}
  vec4 outputValue = getA(${ge});
  return outputValue;
}

vec4 getBAtOutCoordsMatmul(int i) {
  ${Me} coords = getOutputCoords();
  ${pt}
  ${mt}
  vec4 outputValue = getB(${Ye});
  return outputValue;
}`;
          }(Y, j, M, N)}` : "", oe = R ? "getAAtOutCoordsMatmul(i)" : `getA(${function(Me, de) {
            let Oe = "";
            for (let $e = 0; $e < de - 2; $e++) Oe += `rc.${Me[$e]}, `;
            return Oe += `rc.${Me[de - 2]}, i*2`, Oe;
          }(j, G)})`, we = R ? "getBAtOutCoordsMatmul(i)" : `getB(${function(Me, de) {
            let Oe = "";
            for (let $e = 0; $e < de - 2; $e++) Oe += `rc.${Me[$e]}, `;
            return Oe += `i*2, rc.${Me[de - 1]}`, Oe;
          }(j, Q)})`, Se = `
            ${ye}
            ${pe}
            ${J}
            void main() {
              ${R ? "" : `${Y} rc =
          getOutputCoords(); int lastDim = rc.${j[W - 1]}; rc.${j[W - 1]} =
          rc.${j[W - 2]}; rc.${j[W - 2]} = lastDim;
      `}

              vec4 value = vec4(0);
              for (int i = 0; i < ${B}; i++) {
                vec4 a = ${oe};
                vec4 b = ${we};

                value += (a.rrbb * b.rgrg);
                value += (a.ggaa * b.baba);
              }
              ${C}
              ${me}
              ${ee.output} = value;
            }`;
          return Object.assign(Object.assign({}, A), { output: { dims: N, type: M[0].type, textureType: _.TextureType.packed }, shaderSource: Se, hasMain: !0 });
        })(x, a, v, h) });
      };
    }, 5623: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.getBiasForMatmul = e.createMatmulProgramInfoLoader = e.parseMatMulAttributes = e.matMul = void 0;
      const o = r(2517), m = r(2039), _ = r(9390), g = r(2823), y = r(708);
      function E(h, a) {
        const b = (w = h.length > 2, k = a.activationCacheKey, { name: "MatMul", inputNames: w ? ["A", "B", "Bias"] : ["A", "B"], inputTypes: w ? [m.TextureType.unpacked, m.TextureType.unpacked, m.TextureType.unpacked] : [m.TextureType.unpacked, m.TextureType.unpacked], cacheHint: k });
        var w, k;
        return Object.assign(Object.assign({}, b), { get: () => function(A, M, $) {
          const O = M[0].dims, C = M[1].dims, P = o.BroadcastUtil.calcShape(O, C, !0);
          if (!P) throw new Error("Can't use matmul on the given tensors");
          const I = (0, _.getCoordsDataType)(P.length), N = (0, _.getGlChannels)(), { activationFunction: R, applyActivation: F } = (0, g.getActivationSnippet)($), B = M.length > 2, G = B ? "value += getBiasForMatmul();" : "", Q = B ? `${v(I, N, M[2].dims, P, !1)}` : "", ee = P.length, Y = O.length, W = C.length, j = `
    ${R}
    ${Q}
    float process(int indices[${ee}]) {
        int a[${Y}];
        int b[${W}];
        bcastMatmulIndices_A(indices, a);
        bcastMatmulIndices_B(indices, b);

        float value;
        for (int k=0; k<${O[O.length - 1]}; ++k) {
            a[${Y - 1}] = k;
            b[${W - 2}] = k;
            value += _A(a) * _B(b);
        }
        ${G}
        ${F}
        return value;
    }`;
          return Object.assign(Object.assign({}, A), { output: { dims: P, type: M[0].type, textureType: m.TextureType.unpacked }, shaderSource: j });
        }(b, h, a) });
      }
      e.matMul = (h, a, b) => (x(a), h.session.pack ? [h.run((0, y.createPackedMatmulProgramInfoLoader)(h, a, b), a)] : [h.run(E(a, b), a)]), e.parseMatMulAttributes = (h) => (0, g.parseInternalActivationAttributes)(h.attributes), e.createMatmulProgramInfoLoader = E;
      const x = (h) => {
        if (!h || h.length !== 2) throw new Error("MatMul requires 2 inputs.");
        if (h[0].dims[h[0].dims.length - 1] !== h[1].dims[h[1].dims.length - 2]) throw new Error("shared dimension does not match.");
        if (h[0].type !== "float32" && h[0].type !== "float64" || h[1].type !== "float32" && h[1].type !== "float64") throw new Error("inputs should be float type");
        if (h[0].type !== h[1].type) throw new Error("inputs types should match");
      };
      function v(h, a, b, w, k) {
        let A = "";
        const M = b.length, $ = w.length, O = $ - M;
        A = $ < 2 && M > 0 ? "coords" : b.map((I, N) => `coords.${a[N + O]}`).join(", ");
        const C = o.BroadcastUtil.getBroadcastDims(b, w).map((I) => `coords.${a[I + O]} = 0;`).join(`
`);
        let P = "vec4(outputValue.xx, outputValue.yy)";
        return o.ShapeUtil.size(b) === 1 && (P = "vec4(outputValue.x)"), k ? `
vec4 getBiasForMatmul() {
  ${h} coords = getOutputCoords();
  ${C}
  vec4 outputValue = getBias(${A});
  return ${P};
}` : `
float getBiasForMatmul() {
  ${h} coords = getOutputCoords();
  ${C}
  return getBias(coords.x);
}`;
      }
      e.getBiasForMatmul = v;
    }, 2403: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.createPackProgramInfoLoader = void 0;
      const o = r(5060), m = r(2039), _ = r(9390), g = r(2827), y = { name: "pack", inputNames: ["A"], inputTypes: [m.TextureType.unpackedReversed] };
      e.createPackProgramInfoLoader = (E, x) => Object.assign(Object.assign({}, y), { get: () => ((v, h) => {
        const a = (0, o.getGlsl)(v.session.backend.glContext.version), b = h.dims, w = b.length, k = h.dims.length, A = (0, _.getCoordsDataType)(k), M = (0, g.getChannels)("rc", k), $ = (O = k, C = M, P = b[b.length - 2], I = b[b.length - 1], O === 0 || O === 1 ? "" : `
    int r = ${C[O - 2]};
    int c = ${C[O - 1]};
    int rp1 = ${C[O - 2]} + 1;
    int cp1 = ${C[O - 1]} + 1;
    bool rEdge = rp1 >= ${I};
    bool cEdge = cp1 >= ${P};
    `);
        var O, C, P, I;
        let N;
        N = w === 0 ? [1, 1] : w === 1 ? [b[0], 1] : [b[k - 1], b[k - 2]];
        const R = function(G, Q, ee) {
          if (G === 0) return "false";
          if (G === 1) return `rc > ${Q[0]}`;
          let Y = "";
          for (let W = G - 2; W < G; W++) Y += `${ee[W]} >= ${Q[W - G + 2]}`, W < G - 1 && (Y += "||");
          return Y;
        }(k, N, M), F = function(G, Q) {
          const ee = G.length;
          if (ee === 0) return "getA(), 0, 0, 0";
          if (ee === 1) return `getA(rc),
            rc + 1 >= ${G[0]} ? 0. : getA(rc + 1),
            0, 0`;
          let Y = "";
          if (ee > 2) for (let W = 0; W < ee - 2; ++W) Y += `${Q[W]},`;
          return `getA(${Y}r, c),
          rEdge ? 0. : getA(${Y}rp1, c),
          cEdge ? 0. : getA(${Y}r, cp1),
          rEdge || cEdge ? 0. : getA(${Y}rp1, cp1)`;
        }(b, M), B = `
        void main() {
          ${A} rc = getOutputCoords();

          if(${R}) {
            ${a.output} = vec4(0);
          } else {
            ${$}

            ${a.output} = vec4(${F});
          }
        }
      `;
        return Object.assign(Object.assign({}, y), { hasMain: !0, output: { dims: h.dims, type: h.type, textureType: m.TextureType.packed }, shaderSource: B });
      })(E, x) });
    }, 2827: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.unpackFromChannel = e.getChannels = e.getVecChannels = void 0;
      const o = r(9390);
      function m(_, g) {
        return (0, o.getGlChannels)(g).map((y) => `${_}.${y}`);
      }
      e.getVecChannels = m, e.getChannels = function(_, g) {
        return g === 1 ? [_] : m(_, g);
      }, e.unpackFromChannel = function() {
        return `
    float getChannel(vec4 frag, int dim) {
      int modCoord = imod(dim, 2);
      return modCoord == 0 ? frag.r : frag.g;
    }

    float getChannel(vec4 frag, vec2 innerDims) {
      vec2 modCoord = mod(innerDims, 2.);
      return modCoord.x == 0. ?
        (modCoord.y == 0. ? frag.r : frag.g) :
        (modCoord.y == 0. ? frag.b : frag.a);
    }
  `;
      };
    }, 2870: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.parsePadAttributesV11 = e.padV11 = e.parsePadAttributesV2 = e.padV2 = void 0;
      const o = r(246), m = r(2517), _ = r(5060), g = r(2039), y = { name: "Pad", inputNames: ["A"], inputTypes: [g.TextureType.unpacked] };
      e.padV2 = (A, M, $) => (v(M), [A.run(Object.assign(Object.assign({}, y), { cacheHint: $.cacheKey, get: () => x(A, M[0], $) }), M)]), e.parsePadAttributesV2 = (A) => {
        const M = A.attributes.getString("mode", "constant"), $ = A.attributes.getFloat("value", 0), O = A.attributes.getInts("pads");
        return (0, o.createAttributeWithCacheKey)({ mode: M, value: $, pads: O });
      }, e.padV11 = (A, M, $) => {
        h(M);
        const O = E(A, M, $);
        return (0, e.padV2)(A, [M[0]], O);
      }, e.parsePadAttributesV11 = (A) => A.attributes.getString("mode", "constant");
      const E = (A, M, $) => {
        if (!A.session.isInitializer(M[1].dataId) || M.length >= 3 && !A.session.isInitializer(M[2].dataId)) throw new Error("dynamic pad attributes are not allowed");
        const O = Array.from(M[1].integerData), C = M.length >= 3 ? M[2].floatData[0] : 0;
        return (0, o.createAttributeWithCacheKey)({ mode: $, pads: O, value: C });
      }, x = (A, M, $) => {
        const O = m.ShapeUtil.padShape(M.dims.slice(), $.pads), C = O.length, P = `
      ${a(A, M, $)}
      float process(int[${C}] indices) {
          return padA(indices);
      }`;
        return { name: "Pad", inputNames: ["A"], inputTypes: [g.TextureType.unpacked], output: { dims: O, type: M.type, textureType: g.TextureType.unpacked }, shaderSource: P };
      }, v = (A) => {
        if (!A || A.length !== 1) throw new Error("Pad requires 1 input");
        if (A[0].type !== "float32" && A[0].type !== "float64") throw new Error("Invalid input type.");
      }, h = (A) => {
        if (!A || A.length !== 2 && A.length !== 3) throw new Error("Pad requires 2 or 3 inputs");
        if (A[1].type !== "int32") throw new Error("Invalid input type.");
        if (A.length >= 3 && A[2].type === "string") throw new Error("Invalid input type.");
      }, a = (A, M, $) => {
        const O = (0, _.getGlsl)(A.session.backend.glContext.version), [C, P] = A.calculateTextureWidthAndHeight(M.dims, g.TextureType.unpacked), I = m.ShapeUtil.computeStrides(M.dims);
        switch ($.mode) {
          case "constant":
            return b(O, M.dims, I, C, P, $.pads, $.value);
          case "reflect":
            return w(O, M.dims, I, C, P, $.pads);
          case "edge":
            return k(O, M.dims, I, C, P, $.pads);
          default:
            throw new Error("Invalid mode");
        }
      }, b = (A, M, $, O, C, P, I) => {
        const N = M.length;
        let R = "";
        for (let F = N - 1; F >= 0; --F) R += `
        k = m[${F}] - ${P[F]};
        if (k < 0)  return constant;
        if (k >= ${M[F]}) return constant;
        offset += k * ${$[F]};
        `;
        return `
      float padA(int m[${N}]) {
        const float constant = float(${I});
        int offset = 0;
        int k = 0;
        ${R}
        vec2 coords = offsetToCoords(offset, ${O}, ${C});
        float value = getColorAsFloat(${A.texture2D}(A, coords));
        return value;
      }
      `;
      }, w = (A, M, $, O, C, P) => {
        const I = M.length;
        let N = "";
        for (let R = I - 1; R >= 0; --R) N += `
        k = m[${R}] - ${P[R]};
        if (k < 0) { k = -k; }
        {
          const int _2n_1 = ${2 * (M[R] - 1)};
          k = int( mod( float(k), float(_2n_1) ) ) ;
          if(k >= ${M[R]}) { k = _2n_1 - k; }
        }
        offset += k * ${$[R]};
        `;
        return `
      float padA(int m[${I}]) {
        int offset = 0;
        int k = 0;
        ${N}
        vec2 coords = offsetToCoords(offset, ${O}, ${C});
        float value = getColorAsFloat(${A.texture2D}(A, coords));
        return value;
      }
      `;
      }, k = (A, M, $, O, C, P) => {
        const I = M.length;
        let N = "";
        for (let R = I - 1; R >= 0; --R) N += `
        k = m[${R}] - ${P[R]};
        if (k < 0)  k = 0;
        if (k >= ${M[R]}) k = ${M[R] - 1};
        offset += k * ${$[R]};
      `;
        return `
      float padA(int m[${I}]) {
        int offset = 0;
        int k = 0;
        ${N}
        vec2 coords = offsetToCoords(offset, ${O}, ${C});
        float value = getColorAsFloat(${A.texture2D}(A, coords));
        return value;
      }
      `;
      };
    }, 2143: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.globalMaxPool = e.parseMaxPoolAttributes = e.maxPool = e.parseGlobalAveragePoolAttributes = e.globalAveragePool = e.parseAveragePoolAttributes = e.averagePool = void 0;
      const o = r(246), m = r(2517), _ = r(2039);
      e.averagePool = (k, A, M) => {
        h(A);
        const $ = { name: "AveragePool", inputNames: ["X"], inputTypes: [_.TextureType.unpacked], cacheHint: M.cacheKey };
        return [k.run(Object.assign(Object.assign({}, $), { get: () => g(A, $, !1, M) }), A)];
      }, e.parseAveragePoolAttributes = (k) => {
        const A = k.attributes.getString("auto_pad", "NOTSET"), M = k.attributes.getInt("ceil_mode", 0), $ = k.attributes.getInt("count_include_pad", 0) !== 0, O = k.attributes.getInts("kernel_shape"), C = k.attributes.getInts("strides", []), P = k.attributes.getInts("pads", []);
        if (M !== 0) throw new Error("using ceil() in shape computation is not yet supported for AveragePool");
        return (0, o.createAttributeWithCacheKey)({ autoPad: A, ceilMode: M, countIncludePad: $, kernelShape: O, strides: C, pads: P });
      };
      const g = (k, A, M, $) => {
        const [O, C] = E(k, $, M), P = m.ShapeUtil.size(O.kernelShape);
        let I = "";
        O.countIncludePad ? I += `value /= float(${P});` : I += `value /= float(${P} - pad);`;
        const N = `
        ${a(k[0].dims, O, "value += _X(x);", I, "0.0")}
      `;
        return Object.assign(Object.assign({}, A), { output: { dims: C, type: k[0].type, textureType: _.TextureType.unpacked }, shaderSource: N });
      };
      e.globalAveragePool = (k, A, M) => {
        h(A);
        const $ = { name: "GlobalAveragePool", inputNames: ["X"], inputTypes: [_.TextureType.unpacked], cacheHint: `${M.countIncludePad}` };
        return [k.run(Object.assign(Object.assign({}, $), { get: () => g(A, $, !0, M) }), A)];
      }, e.parseGlobalAveragePoolAttributes = (k) => {
        const A = k.attributes.getInt("count_include_pad", 0) !== 0;
        return (0, o.createAttributeWithCacheKey)({ autoPad: "", ceilMode: 0, countIncludePad: A, kernelShape: [], strides: [], pads: [] });
      }, e.maxPool = (k, A, M) => {
        h(A);
        const $ = { name: "MaxPool", inputNames: ["X"], inputTypes: [_.TextureType.unpacked], cacheHint: M.cacheKey };
        return [k.run(Object.assign(Object.assign({}, $), { get: () => y(A, $, !1, M) }), A)];
      }, e.parseMaxPoolAttributes = (k) => {
        const A = k.attributes.getString("auto_pad", "NOTSET"), M = k.attributes.getInt("ceil_mode", 0), $ = k.attributes.getInts("kernel_shape"), O = k.attributes.getInts("strides", []), C = k.attributes.getInts("pads", []), P = k.attributes.getInt("storage_order", 0), I = k.attributes.getInts("dilations", []);
        if (P !== 0) throw new Error("column major storage order is not yet supported for MaxPool");
        if (M !== 0) throw new Error("using ceil() in shape computation is not yet supported for MaxPool");
        return (0, o.createAttributeWithCacheKey)({ autoPad: A, ceilMode: M, countIncludePad: !1, kernelShape: $, strides: O, pads: C, storageOrder: P, dilations: I });
      };
      const y = (k, A, M, $) => {
        const [O, C] = E(k, $, M), P = `
      ${a(k[0].dims, O, `
      value = max(_X(x), value);
    `, "", "-1e5")}
    `;
        return Object.assign(Object.assign({}, A), { output: { dims: C, type: k[0].type, textureType: _.TextureType.unpacked }, shaderSource: P });
      }, E = (k, A, M) => {
        const $ = k[0].dims.slice(), O = Object.hasOwnProperty.call(A, "dilations"), C = A.kernelShape.slice(), P = A.strides.slice(), I = O ? A.dilations.slice() : [], N = A.pads.slice();
        m.PoolConvUtil.adjustPoolAttributes(M, $, C, P, I, N);
        const R = m.PoolConvUtil.computePoolOutputShape(M, $, P, I, C, N, A.autoPad), F = Object.assign({}, A);
        return O ? Object.assign(F, { kernelShape: C, strides: P, pads: N, dilations: I, cacheKey: A.cacheKey }) : Object.assign(F, { kernelShape: C, strides: P, pads: N, cacheKey: A.cacheKey }), [F, R];
      }, x = { autoPad: "", ceilMode: 0, countIncludePad: !1, kernelShape: [], strides: [], pads: [], storageOrder: 0, dilations: [], cacheKey: "" }, v = { name: "GlobalMaxPool", inputNames: ["X"], inputTypes: [_.TextureType.unpacked] };
      e.globalMaxPool = (k, A) => (h(A), [k.run(Object.assign(Object.assign({}, v), { get: () => y(A, v, !0, x) }), A)]);
      const h = (k) => {
        if (!k || k.length !== 1) throw new Error("Pool ops requires 1 input.");
        if (k[0].type !== "float32" && k[0].type !== "float64") throw new Error("Invalid input type.");
      }, a = (k, A, M, $, O) => {
        const C = k.length;
        if (A.kernelShape.length <= 2) {
          const P = A.kernelShape[A.kernelShape.length - 1], I = A.strides[A.strides.length - 1], N = A.pads[A.pads.length / 2 - 1], R = A.pads[A.pads.length - 1], F = k[C - 1];
          let B = "", G = "", Q = "";
          if (B = N + R !== 0 ? `
          for (int i = 0; i < ${P}; i++) {
            x[${C} - 1] = indices[${C} - 1] * ${I} - ${N} + i;
            if (x[${C} - 1] < 0 || x[${C} - 1] >= ${F}) {
              pad++;
              continue;
            }
            ${M}
          }` : `
          for (int i = 0; i < ${P}; i++) {
            x[${C} - 1] = indices[${C} - 1] * ${I} - ${N} + i;
            ${M}
          }`, A.kernelShape.length === 2) {
            const ee = A.kernelShape[A.kernelShape.length - 2], Y = A.strides[A.strides.length - 2], W = A.pads[A.pads.length / 2 - 2], j = A.pads[A.pads.length - 2], J = k[C - 2];
            G = W + j !== 0 ? `
            for (int j = 0; j < ${ee}; j++) {
              x[${C} - 2] = indices[${C} - 2] * ${Y} - ${W} + j;
              if (x[${C} - 2] < 0 || x[${C} - 2] >= ${J}) {
                pad+= ${P};
                continue;
              }
          ` : `
            for (int j = 0; j < ${ee}; j++) {
              x[${C} - 2] = indices[${C} - 2] * ${Y} - ${W} + j;
            `, Q = `
          }
        `;
          }
          return `
        float process(int indices[${C}]) {
          int x[${C}];
          copyVec(indices, x);

          float value = ${O};
          int pad = 0;
          ${G}
          ${B}
          ${Q}
          ${$}
          return value;
        }
      `;
        }
        {
          const P = m.ShapeUtil.size(A.kernelShape), I = m.ShapeUtil.computeStrides(A.kernelShape), N = I.length, R = A.pads.length, F = w(N), B = b(k, "inputDims"), G = b(A.pads, "pads"), Q = b(I, "kernelStrides"), ee = b(A.strides, "strides");
          let Y = "";
          return Y = A.pads.reduce((W, j) => W + j) ? `
            if (x[j] >= inputDims[j] || x[j] < 0) {
              pad++;
              isPad = true;
              break;
            }
          }
          if (!isPad) {
            ${M}
          }` : `
          }
          ${M}
        `, `
        ${F}
        float process(int indices[${C}]) {
          int x[${C}];
          copyVec(indices, x);
          int offset[${N}];
          int pads[${R}];
          int inputDims[${C}];
          int kernelStrides[${N}];
          int strides[${N}];
          ${G}
          ${B}
          ${ee}
          ${Q}

          float value = ${O};
          int pad = 0;
          bool isPad = false;
          for (int i = 0; i < ${P}; i++) {
            offsetToIndices(i, kernelStrides, offset);
            isPad = false;
            for (int j = ${C} - ${N}; j < ${C}; j++) {
              x[j] = indices[j] * strides[j - ${C} + ${N}]
                + offset[j - ${C} + ${N}] - pads[j - 2];
              ${Y}
          }
          ${$}

          return value;
        }
      `;
        }
      }, b = (k, A) => {
        let M = "";
        for (let $ = 0; $ < k.length; $++) M += `
      ${A}[${$}] = ${k[$]};
    `;
        return M;
      }, w = (k) => `
  void offsetToIndices(int offset, int[${k}] strides, out int[${k}] indices) {
    if (${k} == 0) {
      return;
    }
    for (int i = 0; i < ${k} - 1; ++i) {
      indices[i] = offset / strides[i];
      offset -= indices[i] * strides[i];
    }
    indices[${k} - 1] = offset;
  }`;
    }, 4939: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.reduceLogSumSquare = e.reduceLogSum = e.reduceProd = e.reduceMin = e.reduceMax = e.reduceMean = e.reduceSum = e.parseReduceAttributes = void 0;
      const o = r(246), m = r(782), _ = r(2517), g = r(2039), y = (v, h, a, b, w) => {
        x(h);
        const k = { name: b, inputNames: ["A"], inputTypes: [g.TextureType.unpacked] };
        return [v.run(Object.assign(Object.assign({}, k), { cacheHint: a.cacheKey, get: () => E(v, h, a, b, w, k) }), h)];
      };
      e.parseReduceAttributes = (v) => {
        const h = v.attributes.getInts("axes", []), a = v.attributes.getInt("keepdims", 1) === 1;
        return (0, o.createAttributeWithCacheKey)({ axes: h, keepDims: a });
      };
      const E = (v, h, a, b, w, k) => {
        const A = [], M = h[0].dims.length || 1, $ = [], O = _.ShapeUtil.normalizeAxes(a.axes, h[0].dims.length), C = w(h, O);
        let P = C[1];
        for (let N = 0; N < h[0].dims.length; N++) O.indexOf(N) >= 0 || O.length === 0 ? (a.keepDims && A.push(1), P = `
          for(int j${N} = 0; j${N} < ${h[0].dims[N]}; j${N}++) {
            inputIdx[${N}] = j${N};
            ${P}
          }`) : ($.push(`inputIdx[${N}] = outputIdx[${A.length}];`), A.push(h[0].dims[N]));
        const I = `
      float process(int outputIdx[${A.length || 1}]) {
        float value;                 // final result
        int inputIdx[${M}];      // addressing input data
        ${$.join(`
`)}
        ${C[0]}       // init ops for reduce max/min
        ${P}
        ${C[2]}       // final computation for reduce mean
        return value;
      }`;
        return Object.assign(Object.assign({}, k), { output: { dims: A, type: h[0].type, textureType: g.TextureType.unpacked }, shaderSource: I });
      }, x = (v) => {
        if (!v || v.length !== 1) throw new Error("Reduce op requires 1 input.");
        if (m.NUMBER_TYPES.indexOf(v[0].type) === -1) throw new Error("Invalid input type.");
      };
      e.reduceSum = (v, h, a) => y(v, h, a, "ReduceSum", () => ["value = 0.0;", "value += _A(inputIdx);", ""]), e.reduceMean = (v, h, a) => y(v, h, a, "ReduceMean", (b, w) => {
        let k = 1;
        for (let A = 0; A < b[0].dims.length; A++) (w.indexOf(A) >= 0 || w.length === 0) && (k *= b[0].dims[A]);
        return ["value = 0.0;", "value += _A(inputIdx);", `value /= ${k}.;`];
      }), e.reduceMax = (v, h, a) => y(v, h, a, "ReduceMax", (b, w) => {
        const k = [];
        for (let A = 0; A < b[0].dims.length; A++) (w.indexOf(A) >= 0 || w.length === 0) && k.push(`inputIdx[${A}] = 0;`);
        return [`${k.join(`
`)}
value = _A(inputIdx);`, "value = max(value, _A(inputIdx));", ""];
      }), e.reduceMin = (v, h, a) => y(v, h, a, "ReduceMin", (b, w) => {
        const k = [];
        for (let A = 0; A < b[0].dims.length; A++) (w.indexOf(A) >= 0 || w.length === 0) && k.push(`inputIdx[${A}] = 0;`);
        return [`${k.join(`
`)}
value = _A(inputIdx);`, "value = min(value, _A(inputIdx));", ""];
      }), e.reduceProd = (v, h, a) => y(v, h, a, "ReduceProd", () => ["value = 1.0;", "value *= _A(inputIdx);", ""]), e.reduceLogSum = (v, h, a) => y(v, h, a, "ReduceLogSum", () => ["value = 0.0;", "value += _A(inputIdx);", "value = log(value);"]), e.reduceLogSumSquare = (v, h, a) => y(v, h, a, "ReduceLogSumSquare", () => ["float t; value = 0.0;", "t = _A(inputIdx); value += t * t;", ""]);
    }, 7019: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.isReshapeCheap = e.processDims3D = e.createPackedReshape3DProgramInfoLoader = void 0;
      const o = r(2517), m = r(5060), _ = r(2039), g = r(2827);
      e.createPackedReshape3DProgramInfoLoader = (y, E, x) => {
        const v = ((h) => ({ name: "Reshape (packed)", inputTypes: [_.TextureType.packed], inputNames: ["A"], cacheHint: `${h}` }))(x);
        return Object.assign(Object.assign({}, v), { get: () => ((h, a, b, w) => {
          const k = a.dims, A = w;
          let M = "";
          for (let C = 0; C < 4; C++) {
            let P = "";
            switch (C) {
              case 0:
                P = "outputCoords = rc;";
                break;
              case 1:
                P = "outputCoords = ivec3(rc.x, rc.y+1, rc.z);";
                break;
              case 2:
                P = "outputCoords = ivec3(rc.x, rc.y, rc.z+1);";
                break;
              case 3:
                P = "outputCoords = ivec3(rc.x, rc.y+1, rc.z+1);";
                break;
              default:
                throw new Error();
            }
            M += `
        ${P}
        ${C > 0 ? "if(outputCoords.y < rows && outputCoords.z < cols){" : ""}
          int flattenedIndex = getFlattenedIndex(outputCoords);

          ivec3 inputRC = inputCoordsFromReshapedOutCoords(flattenedIndex);
          vec2 innerDims = vec2(float(inputRC.y),float(inputRC.z));

          result[${C}] = getChannel(getA(inputRC.x, inputRC.y, inputRC.z), innerDims);

        ${C > 0 ? "}" : ""}
      `;
          }
          const $ = (0, m.getGlsl)(h.session.backend.glContext.version), O = `
      ${function(C) {
            const P = o.ShapeUtil.computeStrides(C), I = ["b", "r", "c"], N = "index";
            return `
    ivec3 inputCoordsFromReshapedOutCoords(int index) {
      ${P.map((R, F) => `int ${I[F]} = ${N} / ${R}; ${F === P.length - 1 ? `int ${I[F + 1]} = ${N} - ${I[F]} * ${R}` : `index -= ${I[F]} * ${R}`};`).join("")}
      return ivec3(b, r, c);
    }
  `;
          }(k)}
      ${function(C) {
            const P = o.ShapeUtil.computeStrides(C);
            return `
  int getFlattenedIndex(ivec3 coords) {
    // reverse y, z order
    return coords.x * ${P[0]} + coords.z * ${P[1]} + coords.y;
  }
`;
          }(A)}
      ${(0, g.unpackFromChannel)()}

      void main() {
        ivec3 rc = getOutputCoords();

        vec4 result = vec4(0.0);

        ivec3 outputCoords;
        int rows = ${A[2]};
        int cols = ${A[1]};

        ${M}
        ${$.output} = result;
      }
    `;
          return Object.assign(Object.assign({}, b), { output: { dims: A, type: a.type, textureType: _.TextureType.packed }, shaderSource: O, hasMain: !0 });
        })(y, E, v, x) });
      }, e.processDims3D = function(y) {
        if (y.length === 0) return [1, 1, 1];
        let E = 1;
        for (let x = 0; x < y.length - 2; ++x) E *= y[x];
        return [E, y.length > 1 ? y[y.length - 2] : 1, y[y.length - 1]];
      }, e.isReshapeCheap = function(y, E) {
        let x = !1;
        return x = y.length === 0 || E.length === 0 || (y.length < 2 || E.length < 2 ? y[y.length - 1] === E[E.length - 1] : y[y.length - 1] === E[E.length - 1] && y[y.length - 2] === E[E.length - 2]), x;
      };
    }, 718: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.reshape = void 0;
      const o = r(2517);
      e.reshape = (m, _) => {
        const g = o.ShapeUtil.calculateReshapedDims(_[0].dims, _[1].integerData);
        return m.session.pack ? [m.reshapePacked(_[0], g)] : [m.reshapeUnpacked(_[0], g)];
      };
    }, 2268: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.parseResizeAttributesV11 = e.parseResizeAttributesV10 = e.resize = void 0;
      const o = r(5060), m = r(2039), _ = r(9390), g = r(2827), y = r(9793), E = { name: "Resize", inputNames: ["A"], inputTypes: [m.TextureType.packed] };
      e.resize = (b, w, k) => ((0, y.validateInputs)(w, k), [b.run(Object.assign(Object.assign({}, E), { cacheHint: k.cacheKey, get: () => x(b, w, k) }), w)]), e.parseResizeAttributesV10 = (b) => (0, y.parseUpsampleAttributes)(b, 10), e.parseResizeAttributesV11 = (b) => (0, y.parseUpsampleAttributes)(b, 11);
      const x = (b, w, k) => {
        const A = (0, o.getGlsl)(b.session.backend.glContext.version), [M, $] = v(w, k);
        if (M.every((Y) => Y === 1) && k.coordinateTransformMode !== "tf_crop_and_resize") return Object.assign(Object.assign({}, E), { output: { dims: $, type: w[0].type, textureType: m.TextureType.packed }, hasMain: !0, shaderSource: `void main() {
                    vec4 v = ${A.texture2D}(X, TexCoords);
                    ${A.output} = v;
                }` });
        const O = $.length;
        if (O < 2) throw new Error(`output dimension should be at least 2, but got ${O}`);
        const C = $[O - 2], P = $[O - 1], I = w[0].dims;
        if (O !== I.length) throw new Error(`output dimension should match input ${I.length}, but got ${O}`);
        const N = I[O - 2], R = I[O - 1], F = M[O - 2], B = M[O - 1];
        let G = "";
        if (k.mode !== "linear") throw new Error(`resize (packed) does not support mode: '${k.mode}'`);
        switch (k.coordinateTransformMode) {
          case "asymmetric":
            G = `
                    vec4 getSourceFracIndex(ivec4 coords) {
                        return vec4(coords) / scaleWHWH;
                    }
                `;
            break;
          case "half_pixel":
            G = `
                    vec4 getSourceFracIndex(ivec4 coords) {
                        return (vec4(coords) + 0.5) / scaleWHWH - 0.5;
                    }
                `;
            break;
          case "pytorch_half_pixel":
            G = `
                    vec4 getSourceFracIndex(ivec4 coords) {
                        vec4 fcoords = vec4(coords);
                        return vec4(
                            ${P}.0 > 1.0 ? (fcoords.x + 0.5) / scaleWHWH.x - 0.5 : 0.0,
                            ${C}.0 > 1.0 ? (fcoords.y + 0.5) / scaleWHWH.y - 0.5 : 0.0,
                            ${P}.0 > 1.0 ? (fcoords.z + 0.5) / scaleWHWH.z - 0.5 : 0.0,
                            ${C}.0 > 1.0 ? (fcoords.w + 0.5) / scaleWHWH.w - 0.5 : 0.0
                          );
                    }
                `;
            break;
          case "align_corners":
            G = `
                    vec4 getSourceFracIndex(ivec4 coords) {
                        vec4 resized = vec4(${P}.0 - 1.0, ${C}.0 - 1.0, ${P}.0 - 1.0,
                            ${C}.0 - 1.0);
                        vec4 original = vec4(${R}.0 - 1.0, ${N}.0 - 1.0, ${R}.0 - 1.0,
                            ${N}.0 - 1.0);
                        vec4 new_scale = original / resized;
                        return vec4(coords) * new_scale;
                    }
                `;
            break;
          default:
            throw new Error(`resize (packed) does not support coordinateTransformMode:                                 '${k.coordinateTransformMode}'`);
        }
        const Q = (0, _.getCoordsDataType)(O), ee = `
            const vec2 inputWH = vec2(${N}.0, ${R}.0);
            const vec4 scaleWHWH = vec4(float(${F}), float(${B}), float(${F}), float(${B}));
            ${(0, g.unpackFromChannel)()}
            ${G}
            float getAValue(int x10, int r, int c, int d) {
                return getChannel(getA(x10, r, c, d), vec2(c, d));
            }
            void main() {
                ${Q} rc = getOutputCoords();

                int batch = rc[0];
                int depth = rc[1];

                // retrieve the 4 coordinates that is used in the 4 packed output values.
                ivec4 coords = ivec4(rc.wz, rc.w + 1, rc.z + 1);

                // calculate the source index in fraction
                vec4 sourceFrac = getSourceFracIndex(coords);

                // get the lower and upper bound of the 4 values that will be packed into one texel.
                ivec4 x00 = ivec4(max(sourceFrac.xy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xy)));
                ivec4 x01 = ivec4(max(sourceFrac.xw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xw)));
                ivec4 x10 = ivec4(max(sourceFrac.zy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zy)));
                ivec4 x11 = ivec4(max(sourceFrac.zw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zw)));

                bool hasNextRow = rc.w < ${C - 1};
                bool hasNextCol = rc.z < ${P - 1};

                // pack x00, x01, x10, x11's top-left corner into one vec4 structure
                vec4 topLeft = vec4(
                    getAValue(batch, depth, x00.x, x00.y),
                    hasNextCol ? getAValue(batch, depth, x01.x, x01.y) : 0.0,
                    hasNextRow ? getAValue(batch, depth, x10.x, x10.y) : 0.0,
                    (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.y) : 0.0);

                // pack x00, x01, x10, x11's top-right corner into one vec4 structure
                vec4 topRight = vec4(
                    getAValue(batch, depth, x00.x, x00.w),
                    hasNextCol ? getAValue(batch, depth, x01.x, x01.w) : 0.0,
                    hasNextRow ? getAValue(batch, depth, x10.x, x10.w) : 0.0,
                    (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.w) : 0.0);

                // pack x00, x01, x10, x11's bottom-left corner into one vec4 structure
                vec4 bottomLeft = vec4(
                    getAValue(batch, depth, x00.z, x00.y),
                    hasNextCol ? getAValue(batch, depth, x01.z, x01.y) : 0.0,
                    hasNextRow ? getAValue(batch, depth, x10.z, x10.y) : 0.0,
                    (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.y) : 0.0);

                // pack x00, x01, x10, x11's bottom-right corner into one vec4 structure
                vec4 bottomRight = vec4(
                    getAValue(batch, depth, x00.z, x00.w),
                    hasNextCol ? getAValue(batch, depth, x01.z, x01.w) : 0.0,
                    hasNextRow ? getAValue(batch, depth, x10.z, x10.w) : 0.0,
                    (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.w) : 0.0);

                // calculate the interpolation fraction on u and v direction
                vec4 frac = vec4(sourceFrac) - floor(sourceFrac);
                vec4 clampFrac = clamp(frac, vec4(0.0), vec4(1.0));

                vec4 top = mix(topLeft, topRight, clampFrac.ywyw);
                vec4 bottom = mix(bottomLeft, bottomRight, clampFrac.ywyw);
                vec4 newValue = mix(top, bottom, clampFrac.xxzz);

                ${A.output} = vec4(newValue);
            }
        `;
        return Object.assign(Object.assign({}, E), { output: { dims: $, type: w[0].type, textureType: m.TextureType.packed }, hasMain: !0, shaderSource: ee });
      }, v = (b, w) => {
        const k = b[0].dims;
        let A, M = w.scales;
        if (M.length === 0) {
          const O = b[w.scalesInputIdx];
          if (O && O.size !== 0) {
            if (b[w.sizesInputIdx]) throw new Error("Only one of scales or sizes must be provided as input.");
            M = h(O, w.mode, w.isResize);
          } else {
            const C = b[w.sizesInputIdx];
            if (!C || C.size === 0) throw new Error("Either scales or sizes MUST be provided as input.");
            A = Array.from(C.integerData), M = a(A, k, w.mode, w.isResize);
          }
        } else if (b[w.sizesInputIdx]) throw new Error("Only one of scales or sizes must be provided as input.");
        const $ = A || k.map((O, C) => Math.floor(O * M[C]));
        return [M, $];
      }, h = (b, w, k) => {
        const A = Array.from(b.floatData);
        return (0, y.scalesValidation)(A, w, k), A;
      }, a = (b, w, k, A) => {
        const M = w.length, $ = new Array(M);
        for (let O = 0, C = M; O < C; O++) if (w[O] === 0) {
          if (b[O] !== 0) throw new Error("Input dim is zero but required output dim is non-zero.");
          $[O] = 1;
        } else $[O] = b[O] / w[O];
        return (0, y.scalesValidation)($, k, A), $;
      };
    }, 8117: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.shape = void 0;
      const o = r(9162);
      e.shape = (_, g) => (m(g), [new o.Tensor([g[0].dims.length], "int32", void 0, void 0, new Int32Array(g[0].dims))]);
      const m = (_) => {
        if (!_ || _.length !== 1) throw new Error("Shape requires 1 input.");
      };
    }, 2278: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.sliceV10 = e.parseSliceAttributes = e.slice = void 0;
      const o = r(246), m = r(782), _ = r(2517), g = r(2039), y = { name: "Slice", inputNames: ["A"], inputTypes: [g.TextureType.unpacked] };
      e.slice = (a, b, w) => (x(b), [a.run(Object.assign(Object.assign({}, y), { cacheHint: w.cacheKey, get: () => E(a, b[0], w) }), b)]), e.parseSliceAttributes = (a) => {
        const b = a.attributes.getInts("starts"), w = a.attributes.getInts("ends"), k = a.attributes.getInts("axes", []);
        return (0, o.createAttributeWithCacheKey)({ starts: b, ends: w, axes: k });
      };
      const E = (a, b, w) => {
        const k = w.axes.length === 0 ? b.dims.slice(0).map((I, N) => N) : w.axes, A = _.ShapeUtil.normalizeAxes(k, b.dims.length), M = w.starts.map((I, N) => I > b.dims[A[N]] - 1 ? b.dims[A[N]] : _.ShapeUtil.normalizeAxis(I, b.dims[A[N]])), $ = w.ends.map((I, N) => I > b.dims[A[N]] - 1 ? b.dims[A[N]] : _.ShapeUtil.normalizeAxis(I, b.dims[A[N]])), O = b.dims.slice(), C = [];
        for (let I = 0; I < A.length; I++) O[A[I]] = $[I] - M[I], M[I] > 0 && C.push(`outputIdx[${A[I]}] += ${M[I]};`);
        const P = `
      float process(int outputIdx[${O.length}]) {
        ${C.join(`
      `)}
        return _A(outputIdx);
      }`;
        return Object.assign(Object.assign({}, y), { output: { dims: O, type: b.type, textureType: g.TextureType.unpacked }, shaderSource: P });
      }, x = (a) => {
        if (!a || a.length !== 1) throw new Error("Slice requires 1 input.");
        if (m.NUMBER_TYPES.indexOf(a[0].type) === -1) throw new Error("Invalid input type.");
      };
      e.sliceV10 = (a, b) => {
        h(b);
        const w = v(a, b);
        return [a.run(Object.assign(Object.assign({}, y), { cacheHint: w.cacheKey, get: () => E(a, b[0], w) }), [b[0]])];
      };
      const v = (a, b) => {
        if (!a.session.isInitializer(b[1].dataId) || !a.session.isInitializer(b[2].dataId) || b.length >= 4 && !a.session.isInitializer(b[3].dataId) || b.length >= 5 && !a.session.isInitializer(b[4].dataId)) throw new Error("dynamic slice attributes are not allowed");
        if (b.length >= 5 && b[4].integerData.some((M) => M !== 1)) throw new Error("currently non-1 steps is not supported for Slice");
        const w = Array.from(b[1].integerData), k = Array.from(b[2].integerData), A = b.length >= 4 ? Array.from(b[3].integerData) : [];
        return { starts: w, ends: k, axes: A, cacheKey: `${A};${w};${k}` };
      }, h = (a) => {
        if (!a || a.length < 3 || a.length > 5) throw new Error("Invalid input number.");
        if (a[1].type !== "int32" || a[1].dims.length !== 1) throw new Error("Invalid input type.");
        if (a[2].type !== "int32" || a[2].dims.length !== 1) throw new Error("Invalid input type.");
        if (a.length >= 4 && (a[3].type !== "int32" || a[3].dims.length !== 1)) throw new Error("Invalid input type.");
        if (a.length >= 5 && (a[4].type !== "int32" || a[4].dims.length !== 1)) throw new Error("Invalid input type.");
      };
    }, 5524: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.softmaxV13 = e.parseSoftmaxAttributesV13 = e.parseSoftmaxAttributes = e.softmax = void 0;
      const o = r(246), m = r(2517), _ = r(5060), g = r(2039), y = r(3738), E = { name: "SoftmaxComputeMax", inputNames: ["A"], inputTypes: [g.TextureType.unpacked] }, x = { name: "SoftmaxComputeScale", inputNames: ["A", "Max"], inputTypes: [g.TextureType.unpacked, g.TextureType.unpacked] }, v = { name: "SoftMax", inputNames: ["A", "Max", "Norm"], inputTypes: [g.TextureType.unpacked, g.TextureType.unpacked, g.TextureType.unpacked] };
      e.softmax = (A, M, $) => {
        k(M);
        const O = M[0].dims.slice(), C = m.ShapeUtil.normalizeAxis($.axis, O.length), P = m.ShapeUtil.sizeToDimension(O, C), I = m.ShapeUtil.sizeFromDimension(O, C);
        return h(A, M, $, P, I);
      }, e.parseSoftmaxAttributes = (A) => (0, o.createAttributeWithCacheKey)({ axis: A.attributes.getInt("axis", 1) }), e.parseSoftmaxAttributesV13 = (A) => (0, o.createAttributeWithCacheKey)({ axis: A.attributes.getInt("axis", -1) }), e.softmaxV13 = (A, M, $) => {
        k(M);
        const O = M[0].dims.slice(), C = m.ShapeUtil.normalizeAxis($.axis, O.length), P = O.length, I = C !== P - 1, N = [];
        let R, F = [], B = [];
        I && (F = Array.from({ length: P }).map((Y, W) => W), F[C] = P - 1, F[P - 1] = C, F.map((Y) => N.push(O[Y])), R = (0, o.createAttributeWithCacheKey)({ perm: F }), B = (0, y.transpose)(A, M, R));
        const G = I ? m.ShapeUtil.sizeToDimension(N, P - 1) : m.ShapeUtil.sizeToDimension(O, P - 1), Q = I ? m.ShapeUtil.sizeFromDimension(N, P - 1) : m.ShapeUtil.sizeFromDimension(O, P - 1), ee = h(A, I ? B : M, $, G, Q);
        return I ? (0, y.transpose)(A, ee, R) : ee;
      };
      const h = (A, M, $, O, C) => {
        const P = a(A, M[0], O, C, [O]), I = A.run(Object.assign(Object.assign({}, E), { cacheHint: $.cacheKey, get: () => P }), M), N = b(A, M[0], O, C, P.output.dims, [O]), R = A.run(Object.assign(Object.assign({}, x), { cacheHint: $.cacheKey, get: () => N }), [M[0], I]), F = w(A, M[0], O, C, P.output.dims, N.output.dims);
        return [A.run(Object.assign(Object.assign({}, v), { cacheHint: $.cacheKey, get: () => F }), [M[0], I, R])];
      }, a = (A, M, $, O, C) => {
        const [P, I] = A.calculateTextureWidthAndHeight(M.dims, g.TextureType.unpacked), N = C.length;
        if ($ < 1 || O < 1) throw new Error("Logical row count N and feature count D must be greater than or equal to 1");
        if (C.length !== 1) throw new Error("Dimensionality of the output should be 1");
        if (C[0] !== $) throw new Error("Shape of the output should be equal to logical row count");
        const R = (0, _.getGlsl)(A.session.backend.glContext.version), F = `
      float process(int[${N}] indices) {
        int logical_row_start_offset = indices[0] * ${O};

        float max = getColorAsFloat(${R.texture2D}(A, offsetToCoords(logical_row_start_offset, ${P},
        ${I} )));
        for(int i=1; i<${O}; ++i)
        {
          float current = getColorAsFloat(${R.texture2D}(A, offsetToCoords(logical_row_start_offset + i,
            ${P}, ${I})));
          if(current > max)
          max = current;
        }

        return max;
      }`;
        return Object.assign(Object.assign({}, E), { output: { dims: C, type: M.type, textureType: g.TextureType.unpacked }, shaderSource: F });
      }, b = (A, M, $, O, C, P) => {
        const [I, N] = A.calculateTextureWidthAndHeight(M.dims, g.TextureType.unpacked), R = P.length;
        if ($ < 1 || O < 1) throw new Error("Logical row count N and feature count D must be greater than or equal to 1");
        if (P.length !== 1) throw new Error("Dimensionality of the output should be 1");
        if (P[0] !== $) throw new Error("Shape of the output should be equal to logical row count");
        if (C.length !== 1) throw new Error("Dimensionality of the intermediate results should be 1");
        if (C[0] !== $) throw new Error("Shape of the intermediate results should be equal to logical row count");
        const F = `
      float process(int[${R}] indices) {
        int logical_row_start_offset = indices[0] * ${O};

        float norm_factor = 0.0;
        float max = _Max(indices);
        for(int i=0; i<${O}; ++i)
        {
          norm_factor += exp(getColorAsFloat(${(0, _.getGlsl)(A.session.backend.glContext.version).texture2D}(A, offsetToCoords(logical_row_start_offset + i,
            ${I}, ${N}))) - max);
        }

        return norm_factor;
      }`;
        return Object.assign(Object.assign({}, x), { output: { dims: P, type: M.type, textureType: g.TextureType.unpacked }, shaderSource: F });
      }, w = (A, M, $, O, C, P) => {
        const [I, N] = A.calculateTextureWidthAndHeight(M.dims, g.TextureType.unpacked), R = M.dims.length;
        if ($ < 1 || O < 1) throw new Error("Logical row count N and feature count D must be greater than or equal to 1");
        if (C.length !== 1 || P.length !== 1) throw new Error("Dimensionality of the intermediate results should be 1");
        if (C[0] !== $ || P[0] !== $) throw new Error("Shape of the intermediate results should be equal to logical row count");
        const F = `
      float process(int[${R}] indices) {

      // get offset of current logical tensor index from the 2-D texture coordinates (TexCoords)
      int offset = coordsToOffset(TexCoords, ${I}, ${N});

      //determine the logical row for this index
      int logical_row_index[1];
      logical_row_index[0] = offset / ${O};

      float norm_factor = _Norm(logical_row_index);

      // avoid possible division by 0
      // if norm_facor is 0, all elements are zero
      // if so, return 0
      if(norm_factor == 0.0)
        return 0.0;

      return exp(_A(indices) - _Max(logical_row_index)) / norm_factor;
    }`;
        return Object.assign(Object.assign({}, v), { output: { dims: M.dims, type: M.type, textureType: g.TextureType.unpacked }, shaderSource: F });
      }, k = (A) => {
        if (!A || A.length !== 1) throw new Error("Softmax requires 1 input.");
        if (A[0].type !== "float32" && A[0].type !== "float64") throw new Error("Invalid input type");
      };
    }, 5975: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.parseSplitAttributes = e.split = void 0;
      const o = r(246), m = r(2517), _ = r(2039), g = { name: "Split", inputNames: ["A"], inputTypes: [_.TextureType.unpacked] };
      e.split = (v, h, a) => {
        x(h);
        const b = m.ShapeUtil.normalizeAxis(a.axis, h[0].dims.length), w = y(v, h, b, a), k = [];
        for (let A = 0; A < w; ++A) k.push(v.run(Object.assign(Object.assign({}, g), { cacheHint: `${a.cacheKey};${A}`, get: () => E(v, h[0], a, b, A) }), h));
        return k;
      }, e.parseSplitAttributes = (v) => {
        const h = v.attributes.getInt("axis", 0), a = v.attributes.getInts("split", []), b = v.outputs.length;
        return (0, o.createAttributeWithCacheKey)({ axis: h, split: a, numOutputs: b });
      };
      const y = (v, h, a, b) => {
        const [, w] = m.SplitUtil.splitShape(h[0].dims, a, b.split, b.numOutputs);
        return w.length;
      }, E = (v, h, a, b, w) => {
        const [k, A] = m.SplitUtil.splitShape(h.dims, b, a.split, a.numOutputs), M = A[w], $ = k[w], O = `
      float process(int indices[${$.length}]) {
        indices[${b}] += ${M};
        return _A(indices);
      }
    `;
        return Object.assign(Object.assign({}, g), { cacheHint: `${a.cacheKey}:${w}`, output: { dims: $, type: h.type, textureType: _.TextureType.unpacked }, shaderSource: O });
      }, x = (v) => {
        if (!v || v.length !== 1) throw new Error("Split requires one input.");
        if (v[0].type !== "int8" && v[0].type !== "uint8" && v[0].type !== "int16" && v[0].type !== "uint16" && v[0].type !== "int32" && v[0].type !== "uint32" && v[0].type !== "float32" && v[0].type !== "float64" && v[0].type !== "bool") throw new Error("Invalid input type.");
      };
    }, 3933: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.parseSqueezeAttributes = e.squeezeV13 = e.squeeze = void 0;
      const o = r(2517);
      e.squeeze = (g, y, E) => {
        m(y);
        const x = o.ShapeUtil.squeezeShape(y[0].dims, E);
        return [g.reshapeUnpacked(y[0], x)];
      }, e.squeezeV13 = (g, y) => (_(y), (0, e.squeeze)(g, [y[0]], Array.from(y[1].integerData))), e.parseSqueezeAttributes = (g) => g.attributes.getInts("axes");
      const m = (g) => {
        if (!g || g.length !== 1) throw new Error("Squeeze requires 1 input.");
        if (g[0].type === "string") throw new Error("invalid input tensor types.");
      }, _ = (g) => {
        if (!g || g.length !== 2) throw new Error("Squeeze requires 2 inputs.");
        if (g[1].type !== "int32") throw new Error("Invalid input type.");
      };
    }, 6558: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.sum = void 0;
      const o = r(5060), m = r(2039);
      e.sum = (y, E) => {
        g(E);
        const x = { name: "Sum", inputNames: E.map((v, h) => `X${h}`), inputTypes: new Array(E.length).fill(m.TextureType.unpacked) };
        return [y.run(Object.assign(Object.assign({}, x), { get: () => _(y, E, x) }), E)];
      };
      const _ = (y, E, x) => {
        const v = (0, o.getGlsl)(y.session.backend.glContext.version), h = E[0].dims.slice(), a = `
      void main() {
        vec4 result = ${E.map((b, w) => `${v.texture2D}(X${w},TexCoords)`).join(" + ")};
        ${v.output} = result;
      }
    `;
        return Object.assign(Object.assign({}, x), { output: { dims: h, type: E[0].type, textureType: m.TextureType.unpacked }, hasMain: !0, shaderSource: a });
      }, g = (y) => {
        if (!y || y.length === 0) throw new Error("Sum requires inputs.");
        const E = y[0].dims.length;
        for (let x = 1; x < y.length; x++) {
          if (E !== y[x].dims.length) throw new Error("Input shapes are mismatched.");
          for (let v = 0; v < E; v++) if (y[0].dims[v] !== y[x].dims[v]) throw new Error("Input shapes are not matched.");
        }
        if (y[0].type !== "float32" && y[0].type !== "float64") throw new Error("Invalid input type.");
        for (let x = 1; x < y.length; x++) if (y[0].type !== y[x].type) throw new Error("Input types are not matched.");
      };
    }, 5723: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.tile = void 0;
      const o = r(782), m = r(2039);
      e.tile = (y, E) => {
        g(E);
        const x = { name: "Tile", inputNames: ["A"], inputTypes: [m.TextureType.unpacked] };
        return [y.run(Object.assign(Object.assign({}, x), { get: () => _(y, E, x) }), E)];
      };
      const _ = (y, E, x) => {
        const v = E[0].dims.slice(), h = new Array(v.length), a = [];
        for (let k = 0; k < v.length; k++) h[k] = v[k] * E[1].numberData[k], a.push(`inputIdx[${k}] = int(mod(float(outputIdx[${k}]), ${v[k]}.));`);
        const b = h.length, w = `
      float process(int outputIdx[${b}]) {
        int inputIdx[${b}];
        ${a.join(`
`)}
        return _A(inputIdx);
      }
    `;
        return Object.assign(Object.assign({}, x), { output: { dims: h, type: E[0].type, textureType: m.TextureType.unpacked }, shaderSource: w });
      }, g = (y) => {
        if (!y || y.length !== 2) throw new Error("Tile requires 2 input.");
        if (y[1].dims.length !== 1) throw new Error("The second input shape must 1 dimension.");
        if (y[1].dims[0] !== y[0].dims.length) throw new Error("Invalid input shape.");
        if (o.NUMBER_TYPES.indexOf(y[0].type) === -1) throw new Error("Invalid input type.");
        if (y[1].type !== "int32" && y[1].type !== "int16") throw new Error("Invalid repeat type.");
      };
    }, 3738: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.parseTransposeAttributes = e.transpose = void 0;
      const o = r(246), m = r(2517), _ = r(2039), g = { name: "Transpose", inputNames: ["A"], inputTypes: [_.TextureType.unpacked] };
      e.transpose = (a, b, w) => (h(b), [a.run(Object.assign(Object.assign({}, g), { cacheHint: w.cacheKey, get: () => y(a, b[0], w.perm) }), b)]), e.parseTransposeAttributes = (a) => (0, o.createAttributeWithCacheKey)({ perm: a.attributes.getInts("perm", []) });
      const y = (a, b, w) => {
        const k = b.dims;
        w = E(k, w);
        const A = x(k, w), M = k.length, $ = `
      ${v("perm", w, M)}
      float process(int indices[${M}]) {
        int a[${M}];
        perm(a, indices);
        return _A(a);
      }`;
        return Object.assign(Object.assign({}, g), { output: { dims: A, type: b.type, textureType: _.TextureType.unpacked }, shaderSource: $ });
      }, E = (a, b) => (b && b.length !== a.length && (b = [...a.keys()].reverse()), b), x = (a, b) => (b = E(a, b), m.ShapeUtil.sortBasedOnPerm(a, b)), v = (a, b, w) => {
        const k = [];
        k.push(`void ${a}(out int a[${w}], int src[${w}]) {`);
        for (let A = 0; A < w; ++A) k.push(`	a[${b[A]}]=src[${A}];`);
        return k.push("	}"), k.join(`
`);
      }, h = (a) => {
        if (!a || a.length !== 1) throw new Error("Transpose requires 1 input.");
        if (a[0].type !== "float32" && a[0].type !== "float64") throw new Error("input should be float tensor");
      };
    }, 8710: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.encodeAsUint8 = void 0;
      const o = r(5060), m = r(2039);
      e.encodeAsUint8 = (_, g) => {
        const y = g.shape, E = (0, o.getGlsl)(_.session.backend.glContext.version), x = `
    const float FLOAT_MAX = 1.70141184e38;
    const float FLOAT_MIN = 1.17549435e-38;

    bool isNaN(float val) {
      return (val < 1.0 || 0.0 < val || val == 0.0) ? false : true;
    }

    highp vec4 encodeAsUint8(highp float v) {
      if (isNaN(v)) {
        return vec4(255, 255, 255, 255);
      }

      highp float av = abs(v);

      if(av < FLOAT_MIN) {
        return vec4(0.0, 0.0, 0.0, 0.0);
      } else if(v > FLOAT_MAX) {
        return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;
      } else if(v < -FLOAT_MAX) {
        return vec4(0.0, 0.0,  128.0, 255.0) / 255.0;
      }

      highp vec4 c = vec4(0,0,0,0);

      highp float e = floor(log2(av));
      highp float m = exp2(fract(log2(av))) - 1.0;

      c[2] = floor(128.0 * m);
      m -= c[2] / 128.0;
      c[1] = floor(32768.0 * m);
      m -= c[1] / 32768.0;
      c[0] = floor(8388608.0 * m);

      highp float ebias = e + 127.0;
      c[3] = floor(ebias / 2.0);
      ebias -= c[3] * 2.0;
      c[2] += floor(ebias) * 128.0;

      c[3] += 128.0 * step(0.0, -v);

      return c / 255.0;
    }

    void main() {
      float value = ${E.texture2D}(X,TexCoords).r;
      ${E.output} = encodeAsUint8(value);
    }`, v = { name: "Uint8Encode", inputTypes: [m.TextureType.unpacked], inputNames: ["X"], output: { dims: y, type: g.tensor.type, textureType: m.TextureType.downloadUint8AsFloat }, shaderSource: x, hasMain: !0 };
        return _.executeProgram(v, [g.tensor]);
      };
    }, 4909: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.tanh = e.tan = e.sqrt = e.sin = e.sigmoid = e.relu = e.not = e.neg = e.log = e.parseLeakyReluAttributes = e.leakyRelu = e.identity = e.floor = e.exp = e.parseEluAttributes = e.elu = e.cos = e.ceil = e.clipV11 = e.parseClipAttributes = e.clip = e.atan = e.asin = e.acos = e.abs = e.glslTanh = e.glslTan = e.glslSqrt = e.glslSigmoid = e.glslRelu = e.glslSin = e.glslNot = e.glslNeg = e.glslLog = e.glslLeakyRelu = e.glslIdentity = e.glslClip = e.glslFloor = e.glslExp = e.glslElu = e.glslCos = e.glslCeil = e.glslAtan = e.glslAsin = e.glslAcos = e.glslAbs = void 0;
      const o = r(246), m = r(2517), _ = r(8520), g = r(5060), y = r(2039);
      function E() {
        return ee("abs");
      }
      function x() {
        return ee("acos");
      }
      function v() {
        return ee("asin");
      }
      function h() {
        return ee("atan");
      }
      function a() {
        return ee("ceil");
      }
      function b() {
        return ee("cos");
      }
      function w(j) {
        const J = "elu";
        return { body: `
  const float alpha = float(${j});

  float ${J}_(float a) {
    return a >= 0.0 ? a: (exp(a) - 1.0) * alpha;
  }
  vec4 ${J}_(vec4 v) {
    return vec4(${J}_(v.x), ${J}_(v.y), ${J}_(v.z), ${J}_(v.w));
  }
  `, name: J, type: _.FunctionType.ValueBased };
      }
      function k() {
        return ee("exp");
      }
      function A() {
        return ee("floor");
      }
      function M(j, J) {
        const me = "clip";
        return { body: `
  const float min = float(${j});
  const float max = float(${J});

  float ${me}_(float a) {
    return clamp(a, min, max);
  }
  vec4 ${me}_(vec4 v) {
    return clamp(v, min, max);
  }
  `, name: me, type: _.FunctionType.ValueBased };
      }
      function $() {
        const j = "indentity";
        return { body: `
  float ${j}_(float a) {
    return a;
  }
  vec4 ${j}_(vec4 v) {
    return v;
  }
  `, name: j, type: _.FunctionType.ValueBased };
      }
      function O(j) {
        const J = "leakyRelu";
        return { body: `
  const float alpha = float(${j});

  float ${J}_(float a) {
    return a < 0.0 ? a * alpha : a;
  }
  vec4 ${J}_(vec4 v) {
    return vec4(${J}_(v.x), ${J}_(v.y), ${J}_(v.z), ${J}_(v.w));
  }
  `, name: J, type: _.FunctionType.ValueBased };
      }
      function C() {
        return ee("log");
      }
      function P() {
        const j = "neg";
        return { body: `
  float ${j}_(float a) {
    return -a;
  }
  vec4 ${j}_(vec4 v) {
    return -v;
  }
  `, name: j, type: _.FunctionType.ValueBased };
      }
      function I() {
        const j = "not";
        return { body: `
  float ${j}_(float a) {
    return float( ! bool(a) );
  }
  bool ${j}_(bool a) {
    return !a;
  }
  vec4 ${j}_(vec4 v) {
    return vec4(!bool(v.x), !bool(v.y), !bool(v.z), !bool(v.w));
  }
  bvec4 ${j}_(bvec4 v) {
    return bvec4(!v.x, !v.y, !v.z, !v.w);
  }
  `, name: j, type: _.FunctionType.ValueBased };
      }
      function N() {
        return ee("sin");
      }
      function R() {
        const j = "relu";
        return { body: `
  float ${j}_(float a) {
    return max( a, 0.0 );
  }
  vec4 ${j}_(vec4 v) {
    return max( v, 0.0 );
  }
  `, name: j, type: _.FunctionType.ValueBased };
      }
      function F() {
        const j = "sigmoid";
        return { body: `
  float ${j}_(float a) {
    return 1.0 / (1.0 + exp(-a));
  }
  vec4 ${j}_(vec4 v) {
    return 1.0 / (1.0 + exp(-v));
  }
  `, name: j, type: _.FunctionType.ValueBased };
      }
      function B() {
        return ee("sqrt");
      }
      function G() {
        return ee("tan");
      }
      function Q() {
        const j = "tanh";
        return { body: `
  float ${j}_(float a) {
    a = clamp(a, -10., 10.);
    a = exp(2.*a);
    return (a - 1.) / (a + 1.);
  }
  vec4 ${j}_(vec4 v) {
    v = clamp(v, -10., 10.);
    v = exp(2.*v);
    return (v - 1.) / (v + 1.);
  }
  `, name: j, type: _.FunctionType.ValueBased };
      }
      function ee(j) {
        return { body: `
  float ${j}_(float a) {
    return ${j}(a);
  }
  vec4 ${j}_(vec4 v) {
    return ${j}(v);
  }
  `, name: j, type: _.FunctionType.ValueBased };
      }
      e.glslAbs = E, e.glslAcos = x, e.glslAsin = v, e.glslAtan = h, e.glslCeil = a, e.glslCos = b, e.glslElu = w, e.glslExp = k, e.glslFloor = A, e.glslClip = M, e.glslIdentity = $, e.glslLeakyRelu = O, e.glslLog = C, e.glslNeg = P, e.glslNot = I, e.glslSin = N, e.glslRelu = R, e.glslSigmoid = F, e.glslSqrt = B, e.glslTan = G, e.glslTanh = Q;
      const Y = (j, J, me, pe) => {
        const ye = j.session.pack ? y.TextureType.packed : y.TextureType.unpacked, oe = { name: me.name, inputTypes: [ye], inputNames: ["A"], cacheHint: pe };
        return Object.assign(Object.assign({}, oe), { get: () => ((we, Se, Me, de) => {
          const Oe = we.session.pack ? y.TextureType.packed : y.TextureType.unpacked, $e = (0, g.getGlsl)(we.session.backend.glContext.version);
          return Object.assign(Object.assign({}, Se), { output: { dims: Me.dims, type: Me.type, textureType: Oe }, shaderSource: `
     ${de.body}
     void main() {
       vec4 v = ${$e.texture2D}(A, TexCoords);
       v = ${de.name}_(v);
       ${$e.output} = v;
     }
     `, hasMain: !0 });
        })(j, oe, J, me) });
      };
      e.abs = (j, J) => [j.run(Y(j, J[0], E()), J)], e.acos = (j, J) => [j.run(Y(j, J[0], x()), J)], e.asin = (j, J) => [j.run(Y(j, J[0], v()), J)], e.atan = (j, J) => [j.run(Y(j, J[0], h()), J)], e.clip = (j, J, me) => [j.run(Y(j, J[0], M(me.min, me.max), me.cacheKey), J)], e.parseClipAttributes = (j) => (0, o.createAttributeWithCacheKey)({ min: j.attributes.getFloat("min", m.MIN_CLIP), max: j.attributes.getFloat("max", m.MAX_CLIP) }), e.clipV11 = (j, J) => {
        const me = W(j, J);
        return (0, e.clip)(j, [J[0]], me);
      };
      const W = (j, J) => {
        if (J.length >= 3 && (!j.session.isInitializer(J[1].dataId) || !j.session.isInitializer(J[2].dataId))) throw new Error("dynamic clip attributes are not allowed");
        const me = J.length >= 3 ? J[1].numberData[0] : m.MIN_CLIP, pe = J.length >= 3 ? J[2].numberData[0] : m.MAX_CLIP;
        return (0, o.createAttributeWithCacheKey)({ min: me, max: pe });
      };
      e.ceil = (j, J) => [j.run(Y(j, J[0], a()), J)], e.cos = (j, J) => [j.run(Y(j, J[0], b()), J)], e.elu = (j, J, me) => [j.run(Y(j, J[0], w(me.alpha), me.cacheKey), J)], e.parseEluAttributes = (j) => (0, o.createAttributeWithCacheKey)({ alpha: j.attributes.getFloat("alpha", 1) }), e.exp = (j, J) => [j.run(Y(j, J[0], k()), J)], e.floor = (j, J) => [j.run(Y(j, J[0], A()), J)], e.identity = (j, J) => [j.run(Y(j, J[0], $()), J)], e.leakyRelu = (j, J, me) => [j.run(Y(j, J[0], O(me.alpha), me.cacheKey), J)], e.parseLeakyReluAttributes = (j) => (0, o.createAttributeWithCacheKey)({ alpha: j.attributes.getFloat("alpha", 0.01) }), e.log = (j, J) => [j.run(Y(j, J[0], C()), J)], e.neg = (j, J) => [j.run(Y(j, J[0], P()), J)], e.not = (j, J) => [j.run(Y(j, J[0], I()), J)], e.relu = (j, J) => [j.run(Y(j, J[0], R()), J)], e.sigmoid = (j, J) => [j.run(Y(j, J[0], F()), J)], e.sin = (j, J) => [j.run(Y(j, J[0], N()), J)], e.sqrt = (j, J) => [j.run(Y(j, J[0], B()), J)], e.tan = (j, J) => [j.run(Y(j, J[0], G()), J)], e.tanh = (j, J) => [j.run(Y(j, J[0], Q()), J)];
    }, 5611: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.createUnpackProgramInfoLoader = e.createUnpackProgramInfo = void 0;
      const o = r(5060), m = r(2039), _ = r(9390), g = r(2827), y = { name: "unpack", inputNames: ["A"], inputTypes: [m.TextureType.packed] };
      e.createUnpackProgramInfo = (E, x) => {
        const v = x.dims.length, h = (0, g.getChannels)("rc", v), a = h.slice(-2), b = (0, _.getCoordsDataType)(v), w = (0, g.unpackFromChannel)(), k = x.dims.length === 0 ? "" : function($, O) {
          if ($ === 1) return "rc";
          let C = "";
          for (let P = 0; P < $; P++) C += O[P], P < $ - 1 && (C += ",");
          return C;
        }(v, h), A = v <= 1 ? "rc" : `vec2(${a.join(",")})`, M = `
    ${w}
    void main() {
      ${b} rc = getOutputCoords();

       // Sample the texture with the coords to get the rgba channel value.
       vec4 packedInput = getA(${k});

       ${(0, o.getGlsl)(E.session.backend.glContext.version).output} = vec4(getChannel(packedInput, ${A}), 0, 0, 0);
     }
   `;
        return Object.assign(Object.assign({}, y), { hasMain: !0, output: { dims: x.dims, type: x.type, textureType: m.TextureType.unpacked }, shaderSource: M });
      }, e.createUnpackProgramInfoLoader = (E, x) => Object.assign(Object.assign({}, y), { get: () => (0, e.createUnpackProgramInfo)(E, x) });
    }, 8428: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.parseUnsqueezeAttributes = e.unsqueezeV13 = e.unsqueeze = void 0;
      const o = r(2517);
      e.unsqueeze = (g, y, E) => {
        m(y);
        const x = o.ShapeUtil.unsqueezeShape(y[0].dims, E);
        return [g.reshapeUnpacked(y[0], x)];
      }, e.unsqueezeV13 = (g, y) => (_(y), (0, e.unsqueeze)(g, [y[0]], Array.from(y[1].integerData))), e.parseUnsqueezeAttributes = (g) => g.attributes.getInts("axes");
      const m = (g) => {
        if (!g || g.length !== 1) throw new Error("Unsqueeze requires 1 input.");
        if (g[0].type === "string") throw new Error("invalid input tensor types.");
      }, _ = (g) => {
        if (!g || g.length !== 2) throw new Error("Unsqueeze requires 2 inputs.");
        if (g[1].type !== "int32") throw new Error("Invalid input type.");
      };
    }, 9793: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.scalesValidation = e.validateInputs = e.parseUpsampleAttributes = e.parseUpsampleAttributesV9 = e.parseUpsampleAttributesV7 = e.upsample = void 0;
      const o = r(246), m = r(5060), _ = r(2039), g = { name: "Upsample", inputNames: ["X"], inputTypes: [_.TextureType.unpacked] };
      e.upsample = (E, x, v) => ((0, e.validateInputs)(x, v), [E.run(Object.assign(Object.assign({}, g), { cacheHint: v.cacheKey, get: () => y(E, x, v) }), x)]), e.parseUpsampleAttributesV7 = (E) => (0, e.parseUpsampleAttributes)(E, 7), e.parseUpsampleAttributesV9 = (E) => (0, e.parseUpsampleAttributes)(E, 9), e.parseUpsampleAttributes = (E, x) => {
        const v = x >= 10, h = E.attributes.getString("mode", "nearest");
        if (h !== "nearest" && h !== "linear" && (x < 11 || h !== "cubic")) throw new Error(`unrecognized mode: ${h}`);
        let a = [];
        x < 9 && (a = E.attributes.getFloats("scales"), (0, e.scalesValidation)(a, h, v));
        const b = E.attributes.getFloat("extrapolation_value", 0), w = x > 10 ? E.attributes.getString("coordinate_transformation_mode", "half_pixel") : "asymmetric";
        if (["asymmetric", "pytorch_half_pixel", "tf_half_pixel_for_nn", "align_corners", "tf_crop_and_resize", "half_pixel"].indexOf(w) === -1) throw new Error(`coordinate_transform_mode '${w}' is not supported`);
        const k = w === "tf_crop_and_resize", A = k, M = h === "nearest" && x >= 11 ? E.attributes.getString("nearest_mode", "round_prefer_floor") : "";
        if (["round_prefer_floor", "round_prefer_ceil", "floor", "ceil", ""].indexOf(M) === -1) throw new Error(`nearest_mode '${M}' is not supported`);
        const $ = E.attributes.getFloat("cubic_coeff_a", -0.75), O = E.attributes.getInt("exclude_outside", 0) !== 0;
        if (O && h !== "cubic") throw new Error("exclude_outside can be set to 1 only when mode is CUBIC.");
        const C = x < 11 || h === "nearest" && w === "asymmetric" && M === "floor";
        let P = 0, I = 0, N = 0;
        return x > 10 ? E.inputs.length > 2 ? (P = 1, I = 2, N = 3) : (I = 1, N = 2) : x === 9 && (I = 1), (0, o.createAttributeWithCacheKey)({ opset: x, isResize: v, mode: h, scales: a, extrapolationValue: b, coordinateTransformMode: w, useExtrapolation: A, needRoiInput: k, nearestMode: M, cubicCoefficientA: $, excludeOutside: O, useNearest2xOptimization: C, roiInputIdx: P, scalesInputIdx: I, sizesInputIdx: N });
      };
      const y = (E, x, v) => {
        const h = (0, m.getGlsl)(E.session.backend.glContext.version), [a, b] = E.calculateTextureWidthAndHeight(x[0].dims, _.TextureType.unpacked), w = x[0].dims.map((N, R) => Math.floor(N * v.scales[R])), [k, A] = E.calculateTextureWidthAndHeight(w, _.TextureType.unpacked), M = w.length, $ = new Array(M), O = new Array(M);
        let C = `
      int output_pitches[${M}];
      int input_pitches[${M}];
      `;
        for (let N = M - 1; N >= 0; N--) $[N] = N === M - 1 ? 1 : $[N + 1] * w[N + 1], O[N] = N === M - 1 ? 1 : O[N + 1] * x[0].dims[N + 1], C += `
        output_pitches[${N}] = ${$[N]};
        input_pitches[${N}] = ${O[N]};
        `;
        const P = `
      float getInputFloat(int index) {
        vec2 coords = offsetToCoords(index, ${a}, ${b});
        float value = getColorAsFloat(${h.texture2D}(X, coords));
        return value;
      }
      `, I = v.mode === "nearest" ? `
    ${P}
    float process(int indices[${M}]) {
      int input_index = 0;
      int output_index = coordsToOffset(TexCoords, ${k}, ${A});

      ${C}

      int d, m;
      for (int dim = 0; dim < ${M}; ++dim) {
        d = output_index / output_pitches[dim];
        m = output_index - d * output_pitches[dim];
        output_index = m;

        if (scales[dim] != 1 && d > 0) {
          int d2 = d / scales[dim];
          m = d - d2 * scales[dim];
          d = d2;
        }
        input_index += input_pitches[dim] * d;
      }

      return getInputFloat(input_index);
    }` : M === 4 ? `
    ${P}
    float process(int indices[4]) {
      int input_index = 0;
      int output_index = coordsToOffset(TexCoords, ${k}, ${A});

      ${C}

      int m;
      int index_of_dim0, index_of_dim1, index_of_dim2, index_of_dim3;
      index_of_dim0 = output_index / output_pitches[0];
      m = output_index - index_of_dim0 * output_pitches[0];
      index_of_dim1 = m / output_pitches[1];
      m = m - index_of_dim1 * output_pitches[1];
      index_of_dim2 = m / output_pitches[2];
      m = m - index_of_dim2 * output_pitches[2];
      index_of_dim3 = m;

      int index_of_input_dim2, index_of_input_dim3, x_offset, y_offset;
      index_of_input_dim2 = index_of_dim2 / scales[2];
      y_offset = index_of_dim2 - index_of_input_dim2 * scales[2];
      index_of_input_dim3 = index_of_dim3 / scales[3];
      x_offset = index_of_dim3 - index_of_input_dim3 * scales[3];

      input_index = index_of_dim0 * input_pitches[0] +
            index_of_dim1 * input_pitches[1] +
            index_of_input_dim2 * input_pitches[2] +
            index_of_input_dim3;

      float x00 = getInputFloat(input_index);
      float x10, x01, x11;

      bool end_of_dim2 = false;
      if (index_of_input_dim2 == (${x[0].dims[2]} - 1)) {
        // It's the end in dimension 2
        x01 = x00;
        end_of_dim2 = true;
      } else {
        x01 = getInputFloat(input_index + input_pitches[2]);
      }

      if (index_of_input_dim3 == (input_pitches[2] - 1)) {
        // It's the end in dimension 3
        x10 = x00;
        x11 = x01;
      }
      else {
        x10 = getInputFloat(input_index + 1);
        x11 = end_of_dim2 ? x10 : getInputFloat(input_index + input_pitches[2] + 1);
      }

      float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[2]);
      float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[2]);
      return y0 + float(x_offset) * (y1 - y0) / float(scales[3]);
    }` : `
    ${P}
    float process(int indices[2]) {
      int input_index = 0;
      int output_index = coordsToOffset(TexCoords, ${k}, ${A});

      ${C}

      int m;
      int index_of_dim0, index_of_dim1;
      index_of_dim0 = output_index / output_pitches[0];
      m = output_index - index_of_dim0 * output_pitches[0];
      index_of_dim1 = m;

      int index_of_input_dim0, index_of_input_dim1, x_offset, y_offset;
      index_of_input_dim0 = index_of_dim0 / scales[0];
      y_offset = index_of_dim0 - index_of_input_dim0 * scales[0];
      index_of_input_dim1 = index_of_dim1 / scales[1];
      x_offset = index_of_dim1 - index_of_input_dim1 * scales[1];

      input_index = index_of_input_dim0 * input_pitches[0] + index_of_input_dim1;

      float x00 = getInputFloat(input_index);
      float x10, x01, x11;

      bool end_of_dim0 = false;
      if (index_of_input_dim0 == (${x[0].dims[0]} - 1)) {
        // It's the end in dimension 0
        x01 = x00;
        end_of_dim0 = true;
      } else {
        x01 = getInputFloat(input_index + input_pitches[0]);
      }

      if (index_of_input_dim1 == (input_pitches[0] - 1)) {
        // It's the end in dimension 1
        x10 = x00;
        x11 = x01;
      }
      else {
        x10 = getInputFloat(input_index + 1);
        x11 = end_of_dim0 ? x10 : getInputFloat(input_index + input_pitches[0] + 1);
      }

      float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[0]);
      float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[0]);
      return y0 + float(x_offset) * (y1 - y0) / float(scales[1]);
    }`;
        return Object.assign(Object.assign({}, g), { output: { dims: w, type: x[0].type, textureType: _.TextureType.unpacked }, shaderSource: I, variables: [{ name: "scales", type: "int", arrayLength: v.scales.length, data: v.scales.map((N) => Math.ceil(N)) }] });
      };
      e.validateInputs = (E, x) => {
        if (!E || x.opset < 9 && E.length !== 1 || x.opset >= 9 && x.opset < 11 && E.length !== 2 || x.opset >= 11 && E.length < 2) throw new Error("invalid inputs.");
        if (x.scales.length > 0 && E[0].dims.length !== x.scales.length) throw new Error("Invalid input shape.");
        if (E[0].type === "string") throw new Error("Invalid input tensor types.");
      }, e.scalesValidation = (E, x, v) => {
        if (v) {
          for (const h of E) if (h <= 0) throw new Error("Scale value should be greater than 0.");
        } else for (const h of E) if (h < 1) throw new Error("Scale value should be greater than or equal to 1.");
        if (!(x !== "linear" && x !== "cubic" || E.length === 2 || E.length === 4 && E[0] === 1 && E[1] === 1)) throw new Error(`'Linear' mode and 'Cubic' mode only support 2-D inputs ('Bilinear', 'Bicubic')         or 4-D inputs with the corresponding outermost 2 scale values being 1         in the ${v ? "Resize" : "Upsample"} opeartor.`);
      };
    }, 1958: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.ProgramManager = void 0;
      const o = r(1670), m = r(6231), _ = r(8879), g = r(5060);
      e.ProgramManager = class {
        constructor(y, E, x) {
          this.profiler = y, this.glContext = E, this.textureLayoutStrategy = x, this.repo = /* @__PURE__ */ new Map(), this.attributesBound = !1;
        }
        getArtifact(y) {
          return this.repo.get(y);
        }
        setArtifact(y, E) {
          this.repo.set(y, E);
        }
        run(y, E, x) {
          var v;
          this.profiler.event("op", `ProgramManager.run ${(v = y.programInfo.name) !== null && v !== void 0 ? v : "unknown kernel"}`, () => {
            var h;
            const a = this.glContext.gl, b = y.program;
            a.useProgram(b);
            try {
              this.bindOutput(x), this.attributesBound || this.bindAttributes(y.attribLocations), this.bindUniforms(y.uniformLocations, (h = y.programInfo.variables) !== null && h !== void 0 ? h : [], E);
            } catch (w) {
              throw m.Logger.error("ProgramManager", y.programInfo.shaderSource), w;
            }
            this.profiler.event("backend", "GlContext.draw()", () => {
              this.glContext.draw();
            });
          }, this.glContext);
        }
        dispose() {
          this.vertexShader && this.glContext.deleteShader(this.vertexShader), this.repo.forEach((y) => this.glContext.deleteProgram(y.program));
        }
        build(y, E, x) {
          return this.profiler.event("backend", "ProgramManager.build", () => {
            const v = new _.GlslPreprocessor(this.glContext, y, E, x), h = v.preprocess(), a = this.compile(h);
            return { programInfo: y, program: a, uniformLocations: this.getUniformLocations(a, v.context.programInfo.inputNames, v.context.programInfo.variables), attribLocations: this.getAttribLocations(a) };
          });
        }
        compile(y) {
          if (!this.vertexShader) {
            m.Logger.verbose("ProrgramManager", "Compiling and caching Vertex shader for the first time");
            const v = (0, g.getVertexShaderSource)(this.glContext.version);
            this.vertexShader = this.glContext.compileShader(v, this.glContext.gl.VERTEX_SHADER);
          }
          o.env.debug && m.Logger.verbose("ProrgramManager", `FragShader:
${y}
`);
          const E = this.glContext.compileShader(y, this.glContext.gl.FRAGMENT_SHADER), x = this.glContext.createProgram(this.vertexShader, E);
          return this.glContext.deleteShader(E), x;
        }
        bindOutput(y) {
          const E = y.width, x = y.height;
          m.Logger.verbose("ProrgramManager", `Binding output texture to Framebuffer: w/h=${E}/${x}, shape=${y.shape}, type=${y.tensor.type}`), this.glContext.attachFramebuffer(y.texture, E, x);
        }
        bindAttributes(y) {
          const E = y.position, x = y.textureCoord;
          this.glContext.setVertexAttributes(E, x), this.attributesBound = !0;
        }
        bindUniforms(y, E, x) {
          var v;
          const h = this.glContext.gl;
          let a = 0;
          for (const { name: b, type: w, location: k, arrayLength: A } of y) {
            const M = (v = E.find(($) => $.name === b)) === null || v === void 0 ? void 0 : v.data;
            if (w !== "sampler2D" && !M) throw new Error(`variable '${b}' does not have data defined in program info`);
            switch (w) {
              case "sampler2D":
                this.bindTexture(x[a], k, a), a++;
                break;
              case "float":
                A ? h.uniform1fv(k, M) : h.uniform1f(k, M);
                break;
              case "int":
                A ? h.uniform1iv(k, M) : h.uniform1i(k, M);
                break;
              default:
                throw new Error(`Uniform not implemented: ${w}`);
            }
          }
        }
        bindTexture(y, E, x) {
          this.glContext.bindTextureToUniform(y.texture, x, E);
        }
        getAttribLocations(y) {
          return { position: this.getAttribLocation(y, "position"), textureCoord: this.getAttribLocation(y, "textureCoord") };
        }
        getUniformLocations(y, E, x) {
          const v = [];
          if (E) for (const h of E) v.push({ name: h, type: "sampler2D", location: this.getUniformLocation(y, h) });
          if (x) for (const h of x) v.push(Object.assign(Object.assign({}, h), { location: this.getUniformLocation(y, h.name) }));
          return v;
        }
        getUniformLocation(y, E) {
          const x = this.glContext.gl.getUniformLocation(y, E);
          if (x === null) throw new Error(`Uniform ${E} not found.`);
          return x;
        }
        getAttribLocation(y, E) {
          return this.glContext.gl.getAttribLocation(y, E);
        }
      };
    }, 6416: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.WebGLSessionHandler = void 0;
      const o = r(6231), m = r(1047), _ = r(8316), g = r(1640), y = r(1958), E = r(7859), x = r(5702);
      e.WebGLSessionHandler = class {
        constructor(v, h) {
          this.backend = v, this.context = h, this.layoutStrategy = new E.PreferLogicalStrategy(v.glContext.maxTextureSize), this.programManager = new y.ProgramManager(this.context.profiler, v.glContext, this.layoutStrategy), this.textureManager = new x.TextureManager(v.glContext, this.layoutStrategy, this.context.profiler, { reuseTextures: v.textureCacheMode === "full" }), this.packedTextureDataCache = /* @__PURE__ */ new Map(), this.unpackedTextureDataCache = /* @__PURE__ */ new Map(), this.pack = v.pack, this.pack2unpackMap = /* @__PURE__ */ new Map(), this.unpack2packMap = /* @__PURE__ */ new Map();
        }
        createInferenceHandler() {
          return new _.WebGLInferenceHandler(this);
        }
        onGraphInitialized(v) {
          const h = v.getValues().filter((a) => a.from === -1 && a.tensor).map((a) => a.tensor.dataId);
          this.initializers = new Set(h);
        }
        isInitializer(v) {
          return !!this.initializers && this.initializers.has(v);
        }
        addInitializer(v) {
          this.initializers.add(v);
        }
        getTextureData(v, h) {
          return h ? this.packedTextureDataCache.get(v) : this.unpackedTextureDataCache.get(v);
        }
        setTextureData(v, h, a = !1) {
          o.Logger.verbose("WebGLSessionHandler", "Storing Texture data in cache"), a ? this.packedTextureDataCache.set(v, h) : this.unpackedTextureDataCache.set(v, h);
        }
        dispose() {
          this.programManager.dispose(), this.textureManager.clearActiveTextures(), this.packedTextureDataCache.forEach((v) => this.textureManager.releaseTexture(v, !0)), this.packedTextureDataCache = /* @__PURE__ */ new Map(), this.unpackedTextureDataCache.forEach((v) => this.textureManager.releaseTexture(v, !0)), this.unpackedTextureDataCache = /* @__PURE__ */ new Map();
        }
        resolve(v, h, a) {
          const b = (0, m.resolveOperator)(v, h, g.WEBGL_OP_RESOLVE_RULES);
          return { impl: b.opImpl, context: b.opInit ? b.opInit(v, a) : v };
        }
      };
    }, 7769: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.Uint8DataEncoder = e.RGBAFloatDataEncoder = e.RedFloat32DataEncoder = void 0;
      const o = r(6231);
      e.RedFloat32DataEncoder = class {
        constructor(m, _ = 1) {
          if (_ === 1) this.internalFormat = m.R32F, this.format = m.RED, this.textureType = m.FLOAT, this.channelSize = _;
          else {
            if (_ !== 4) throw new Error(`Invalid number of channels: ${_}`);
            this.internalFormat = m.RGBA32F, this.format = m.RGBA, this.textureType = m.FLOAT, this.channelSize = _;
          }
        }
        encode(m, _) {
          let g, y;
          return m.constructor !== Float32Array && (o.Logger.warning("Encoder", "data was not of type Float32; creating new Float32Array"), y = new Float32Array(m)), _ * this.channelSize > m.length ? (o.Logger.warning("Encoder", "Source data too small. Allocating larger array"), y = m, g = this.allocate(_ * this.channelSize), y.forEach((E, x) => g[x] = E)) : (y = m, g = y), g;
        }
        allocate(m) {
          return new Float32Array(4 * m);
        }
        decode(m, _) {
          return this.channelSize === 1 ? m.filter((g, y) => y % 4 == 0).subarray(0, _) : m.subarray(0, _);
        }
      }, e.RGBAFloatDataEncoder = class {
        constructor(m, _ = 1, g) {
          if (_ !== 1 && _ !== 4) throw new Error(`Invalid number of channels: ${_}`);
          this.internalFormat = m.RGBA, this.format = m.RGBA, this.channelSize = _, this.textureType = g || m.FLOAT;
        }
        encode(m, _) {
          let g = m;
          return this.channelSize === 1 && (o.Logger.verbose("Encoder", "Exploding into a larger array"), g = this.allocate(_), m.forEach((y, E) => g[4 * E] = y)), g;
        }
        allocate(m) {
          return new Float32Array(4 * m);
        }
        decode(m, _) {
          return this.channelSize === 1 ? m.filter((g, y) => y % 4 == 0).subarray(0, _) : m.subarray(0, _);
        }
      }, e.Uint8DataEncoder = class {
        constructor(m, _ = 1) {
          if (this.channelSize = 4, _ === 1) this.internalFormat = m.ALPHA, this.format = m.ALPHA, this.textureType = m.UNSIGNED_BYTE, this.channelSize = _;
          else {
            if (_ !== 4) throw new Error(`Invalid number of channels: ${_}`);
            this.internalFormat = m.RGBA, this.format = m.RGBA, this.textureType = m.UNSIGNED_BYTE, this.channelSize = _;
          }
        }
        encode(m, _) {
          return new Uint8Array(m.buffer, m.byteOffset, m.byteLength);
        }
        allocate(m) {
          return new Uint8Array(m * this.channelSize);
        }
        decode(m, _) {
          if (m instanceof Uint8Array) return m.subarray(0, _);
          throw new Error(`Invalid array type: ${m.constructor}`);
        }
      };
    }, 7859: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.getBatchDim = e.sizeToSquarishShape = e.getRowsCols = e.sizeFromShape = e.isInt = e.parseAxisParam = e.squeezeShape = e.PreferLogicalStrategy = e.AlwaysKeepOriginalSizeStrategy = void 0;
      const o = r(6231), m = r(2517);
      function _(v, h) {
        const a = [], b = [], w = h != null && Array.isArray(h) && h.length === 0, k = h == null || w ? null : g(h, v).sort();
        let A = 0;
        for (let M = 0; M < v.length; ++M) {
          if (k != null) {
            if (k[A] === M && v[M] !== 1) throw new Error(`Can't squeeze axis ${M} since its dim '${v[M]}' is not 1`);
            (k[A] == null || k[A] > M) && v[M] === 1 && (a.push(v[M]), b.push(M)), k[A] <= M && A++;
          }
          v[M] !== 1 && (a.push(v[M]), b.push(M));
        }
        return { newShape: a, keptDims: b };
      }
      function g(v, h) {
        const a = h.length;
        return v = v == null ? h.map((b, w) => w) : [].concat(v), (0, m.assert)(v.every((b) => b >= -a && b < a), () => `All values in axis param must be in range [-${a}, ${a}) but got axis ${v}`), (0, m.assert)(v.every(y), () => `All values in axis param must be integers but got axis ${v}`), v.map((b) => b < 0 ? a + b : b);
      }
      function y(v) {
        return v % 1 == 0;
      }
      function E(v) {
        if (v.length === 0) return 1;
        let h = v[0];
        for (let a = 1; a < v.length; a++) h *= v[a];
        return h;
      }
      function x(v) {
        const h = Math.ceil(Math.sqrt(v));
        return [h, Math.ceil(v / h)];
      }
      e.AlwaysKeepOriginalSizeStrategy = class {
        constructor(v) {
          this.maxTextureSize = v;
        }
        computeTextureWH(v, h) {
          if (v.length === 0) return [1, 1];
          const a = this.maxTextureSize;
          if (h && h.breakAxis !== void 0) {
            const k = h.breakAxis >= v.length ? 1 : v.slice(h.breakAxis).reduce((M, $) => M * $), A = h.breakAxis <= 0 ? 1 : v.slice(0, h.breakAxis).reduce((M, $) => M * $);
            if (!(k > a || A > a)) return [k, A];
            o.Logger.verbose("TextureLayout", `Given width/height preferences were unattainable: shape:${v}, breakAxis:${h.breakAxis}`);
          }
          const b = v.reduce((k, A) => k * A);
          let w = Math.floor(Math.sqrt(b));
          for (; w < a && w < b && b % w != 0; w++) ;
          if (w >= a || b % w != 0) throw new Error(`The given dimensions are outside this GPU's boundaries: ${v}`);
          return [w, b / w];
        }
      }, e.PreferLogicalStrategy = class {
        constructor(v) {
          this.maxTextureSize = v;
        }
        computeTextureWH(v, h) {
          const a = this.computeTexture(v, h);
          return h && h.isPacked && (a[0] /= 2, a[1] /= 2), h && h.reverseWH ? [a[1], a[0]] : a;
        }
        computeTexture(v, h) {
          const a = h && h.isPacked;
          if (v.length === 0) return a ? [2, 2] : [1, 1];
          let b = this.maxTextureSize;
          if (h && h.breakAxis !== void 0) {
            const A = h.breakAxis >= v.length ? 1 : v.slice(h.breakAxis).reduce(($, O) => $ * O), M = h.breakAxis <= 0 ? 1 : v.slice(0, h.breakAxis).reduce(($, O) => $ * O);
            if (!(A > b || M > b)) return [A, M];
            o.Logger.verbose("TextureLayout", `Given width/height preferences were unattainable: shape:${v}, breakAxis:${h.breakAxis}`);
          }
          let w = v.slice(0);
          a && (b *= 2, w = w.map((A, M) => M >= w.length - 2 ? w[M] % 2 == 0 ? w[M] : w[M] + 1 : w[M]), w.length === 1 && (w = [2, w[0]])), w.length !== 2 && (w = _(w).newShape);
          const k = E(w);
          return w.length <= 1 && k <= b ? [1, k] : w.length === 2 && w[0] <= b && w[1] <= b ? w : w.length === 3 && w[0] * w[1] <= b && w[2] <= b ? [w[0] * w[1], w[2]] : w.length === 3 && w[0] <= b && w[1] * w[2] <= b ? [w[0], w[1] * w[2]] : w.length === 4 && w[0] * w[1] * w[2] <= b && w[3] <= b ? [w[0] * w[1] * w[2], w[3]] : w.length === 4 && w[0] <= b && w[1] * w[2] * w[3] <= b ? [w[0], w[1] * w[2] * w[3]] : a ? x(k / 4).map((A) => 2 * A) : x(k);
        }
      }, e.squeezeShape = _, e.parseAxisParam = g, e.isInt = y, e.sizeFromShape = E, e.getRowsCols = function(v) {
        if (v.length === 0) throw Error("Cannot get rows and columns of an empty shape array.");
        return [v.length > 1 ? v[v.length - 2] : 1, v[v.length - 1]];
      }, e.sizeToSquarishShape = x, e.getBatchDim = function(v, h = 2) {
        return E(v.slice(0, v.length - h));
      };
    }, 4057: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.createTextureLayoutFromShape = e.calculateTextureWidthAndHeight = e.createTextureLayoutFromTextureType = void 0;
      const o = r(2517), m = r(2039);
      e.createTextureLayoutFromTextureType = (_, g, y) => {
        const E = y === m.TextureType.unpacked || y === m.TextureType.unpackedReversed ? 1 : 4, x = y === m.TextureType.packed, v = y === m.TextureType.unpackedReversed || y === m.TextureType.packed, h = y === m.TextureType.packedLastDimension ? g.length - 1 : void 0, a = y === m.TextureType.packedLastDimension ? g.map((b, w) => w === g.length - 1 ? 4 * b : b) : void 0;
        return (0, e.createTextureLayoutFromShape)(_, g, E, a, { isPacked: x, reverseWH: v, breakAxis: h });
      }, e.calculateTextureWidthAndHeight = (_, g, y) => {
        const E = (0, e.createTextureLayoutFromTextureType)(_, g, y);
        return [E.width, E.height];
      }, e.createTextureLayoutFromShape = (_, g, y = 1, E, x) => {
        const v = !(!x || !x.isPacked), [h, a] = _.computeTextureWH(v && E || g, x), b = g.length;
        let w = g.slice(0);
        if (b === 0 && (w = [1]), y === 1) E = g;
        else if (v) {
          if (y !== 4) throw new Error("a packed texture must be 4-channel");
          E = g, b > 0 && (w[b - 1] = Math.ceil(w[b - 1] / 2)), b > 1 && (w[b - 2] = Math.ceil(w[b - 2] / 2));
        } else if (!E) throw new Error("Unpacked shape is needed when using channels > 1");
        return { width: h, height: a, channels: y, isPacked: v, shape: w, strides: o.ShapeUtil.computeStrides(w), unpackedShape: E, reversedWH: x && x.reverseWH };
      };
    }, 5702: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.TextureManager = void 0;
      const o = r(6231);
      e.TextureManager = class {
        constructor(m, _, g, y) {
          this.glContext = m, this.layoutStrategy = _, this.profiler = g, this.config = y, this.pendingRead = /* @__PURE__ */ new Map(), y.reuseTextures && (this.inUseTextures = /* @__PURE__ */ new Map(), this.idleTextures = /* @__PURE__ */ new Map(), this.textureLookup = /* @__PURE__ */ new Map());
        }
        createTextureFromLayout(m, _, g, y) {
          const E = this.toEncoderType(m), x = this.glContext.getEncoder(E, _.channels || 1, y);
          if (_.isPacked && y === 1) throw new Error("not implemented");
          const v = _.width, h = _.height;
          let a, b;
          if (this.config.reuseTextures) {
            a = `${v}x${h}_${x.format}_${x.internalFormat}_${x.textureType}`, b = this.inUseTextures.get(a), b || (b = [], this.inUseTextures.set(a, b));
            const k = this.idleTextures.get(a);
            if (k && k.length > 0) {
              const A = k.pop();
              return b.push(A), y === 1 && this.glContext.updateTexture(A, v, h, x, this.toTextureData(m, g)), A;
            }
          }
          o.Logger.verbose("TextureManager", `Creating new texture of size ${_.width}x${_.height}`);
          const w = this.glContext.allocateTexture(v, h, x, this.toTextureData(m, g));
          return this.config.reuseTextures && (b.push(w), this.textureLookup.set(w, a)), w;
        }
        readTexture(m, _, g) {
          return g || (g = 1), this.profiler.event("backend", "TextureManager.readTexture", () => {
            const y = m.shape.reduce((x, v) => x * v) * g, E = this.glContext.readTexture(m.texture, m.width, m.height, y, this.toEncoderType(_), g);
            return this.toTensorData(_, E);
          });
        }
        async readTextureAsync(m, _, g) {
          const y = m.tensor.dataId;
          if (g || (g = 1), this.pendingRead.has(y)) {
            const E = this.pendingRead.get(y);
            return new Promise((x) => E == null ? void 0 : E.push(x));
          }
          return this.profiler.event("backend", "TextureManager.readTextureAsync", async () => {
            this.pendingRead.set(y, []);
            const E = m.shape.reduce((a, b) => a * b) * g;
            await this.glContext.createAndWaitForFence();
            const x = this.glContext.readTexture(m.texture, m.width, m.height, E, this.toEncoderType(_), g), v = this.toTensorData(_, x), h = this.pendingRead.get(y);
            return this.pendingRead.delete(y), h == null || h.forEach((a) => a(v)), v;
          });
        }
        readUint8TextureAsFloat(m) {
          return this.profiler.event("backend", "TextureManager.readUint8TextureAsFloat", () => {
            const _ = m.shape.reduce((y, E) => y * E), g = this.glContext.readTexture(m.texture, m.width, m.height, 4 * _, "byte", 4);
            return new Float32Array(g.buffer, g.byteOffset, _);
          });
        }
        releaseTexture(m, _) {
          let g;
          if (this.config.reuseTextures && (g = this.textureLookup.get(m.texture), g)) {
            _ && this.textureLookup.delete(g);
            const y = this.inUseTextures.get(g);
            if (y) {
              const E = y.indexOf(m.texture);
              if (E !== -1) {
                y.splice(E, 1);
                let x = this.idleTextures.get(g);
                x || (x = [], this.idleTextures.set(g, x)), x.push(m.texture);
              }
            }
          }
          g && !_ || (o.Logger.verbose("TextureManager", `Deleting texture of size ${m.width}x${m.height}`), this.glContext.deleteTexture(m.texture));
        }
        toTensorData(m, _) {
          switch (m) {
            case "int16":
              return _ instanceof Int16Array ? _ : Int16Array.from(_);
            case "int32":
              return _ instanceof Int32Array ? _ : Int32Array.from(_);
            case "int8":
              return _ instanceof Int8Array ? _ : Int8Array.from(_);
            case "uint16":
              return _ instanceof Uint16Array ? _ : Uint16Array.from(_);
            case "uint32":
              return _ instanceof Uint32Array ? _ : Uint32Array.from(_);
            case "uint8":
            case "bool":
              return _ instanceof Uint8Array ? _ : Uint8Array.from(_);
            case "float32":
              return _ instanceof Float32Array ? _ : Float32Array.from(_);
            case "float64":
              return _ instanceof Float64Array ? _ : Float64Array.from(_);
            default:
              throw new Error(`TensorData type ${m} is not supported`);
          }
        }
        toTextureData(m, _) {
          if (_) return _ instanceof Float32Array ? _ : new Float32Array(_);
        }
        toEncoderType(m) {
          return "float";
        }
        clearActiveTextures() {
          this.glContext.clearActiveTextures();
        }
      };
    }, 2039: (s, e) => {
      var r;
      Object.defineProperty(e, "__esModule", { value: !0 }), e.TextureType = void 0, (r = e.TextureType || (e.TextureType = {}))[r.unpacked = 0] = "unpacked", r[r.unpackedReversed = 1] = "unpackedReversed", r[r.packed = 2] = "packed", r[r.downloadUint8AsFloat = 3] = "downloadUint8AsFloat", r[r.packedLastDimension = 4] = "packedLastDimension";
    }, 9390: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.getGlChannels = e.getCoordsDataType = e.getSqueezedParams = e.squeezeInputShape = e.generateShaderFuncNameFromInputSamplerNameAtOutCoords = e.generateShaderFuncNameFromInputSamplerName = e.repeatedTry = e.getPackedShape = void 0;
      const o = r(2517);
      e.getPackedShape = function(m) {
        const _ = m.length;
        return m.slice(0, _ - 1).concat(m[_ - 1] / 4);
      }, e.repeatedTry = async function(m, _ = (y) => 0, g) {
        return new Promise((y, E) => {
          let x = 0;
          const v = () => {
            if (m()) return void y();
            x++;
            const h = _(x);
            g != null && x >= g ? E() : setTimeout(v, h);
          };
          v();
        });
      }, e.generateShaderFuncNameFromInputSamplerName = function(m) {
        return (0, o.assert)(m !== void 0 && m.length !== 0, () => "empty string found for sampler name"), "get" + m.charAt(0).toUpperCase() + m.slice(1);
      }, e.generateShaderFuncNameFromInputSamplerNameAtOutCoords = function(m) {
        return (0, o.assert)(m !== void 0 && m.length !== 0, () => "empty string found for sampler name"), "get" + m.charAt(0).toUpperCase() + m.slice(1) + "AtOutCoords";
      }, e.squeezeInputShape = function(m, _) {
        let g = JSON.parse(JSON.stringify(m));
        return g = _, g;
      }, e.getSqueezedParams = function(m, _) {
        return _.map((g) => m[g]).join(", ");
      }, e.getCoordsDataType = function(m) {
        if (m <= 1) return "int";
        if (m === 2) return "ivec2";
        if (m === 3) return "ivec3";
        if (m === 4) return "ivec4";
        if (m === 5) return "ivec5";
        if (m === 6) return "ivec6";
        throw Error(`GPU for rank ${m} is not yet supported`);
      }, e.getGlChannels = function(m = 6) {
        return ["x", "y", "z", "w", "u", "v"].slice(0, m);
      };
    }, 7305: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.createNewWebGLContext = e.createWebGLContext = void 0;
      const o = r(6231), m = r(1713), _ = {};
      function g(y) {
        const E = function() {
          if (typeof document > "u") {
            if (typeof OffscreenCanvas > "u") throw new TypeError("failed to create canvas: OffscreenCanvas is not supported");
            return new OffscreenCanvas(1, 1);
          }
          const h = document.createElement("canvas");
          return h.width = 1, h.height = 1, h;
        }();
        let x;
        const v = { alpha: !1, depth: !1, antialias: !1, stencil: !1, preserveDrawingBuffer: !1, premultipliedAlpha: !1, failIfMajorPerformanceCaveat: !1 };
        if ((!y || y === "webgl2") && (x = E.getContext("webgl2", v), x)) try {
          return new m.WebGLContext(x, 2);
        } catch (h) {
          o.Logger.warning("GlContextFactory", `failed to create WebGLContext using contextId 'webgl2'. Error: ${h}`);
        }
        if ((!y || y === "webgl") && (x = E.getContext("webgl", v) || E.getContext("experimental-webgl", v), x)) try {
          return new m.WebGLContext(x, 1);
        } catch (h) {
          o.Logger.warning("GlContextFactory", `failed to create WebGLContext using contextId 'webgl' or 'experimental-webgl'. Error: ${h}`);
        }
        throw new Error("WebGL is not supported");
      }
      e.createWebGLContext = function y(E) {
        let x;
        E && E !== "webgl2" || !("webgl2" in _) ? E && E !== "webgl" || !("webgl" in _) || (x = _.webgl) : x = _.webgl2, x = x || g(E), E = E || x.version === 1 ? "webgl" : "webgl2";
        const v = x.gl;
        return _[E] = x, v.isContextLost() ? (delete _[E], y(E)) : (v.disable(v.DEPTH_TEST), v.disable(v.STENCIL_TEST), v.disable(v.BLEND), v.disable(v.DITHER), v.disable(v.POLYGON_OFFSET_FILL), v.disable(v.SAMPLE_COVERAGE), v.enable(v.SCISSOR_TEST), v.enable(v.CULL_FACE), v.cullFace(v.BACK), x);
      }, e.createNewWebGLContext = g;
    }, 1713: function(s, e, r) {
      var o = this && this.__createBinding || (Object.create ? function(v, h, a, b) {
        b === void 0 && (b = a);
        var w = Object.getOwnPropertyDescriptor(h, a);
        w && !("get" in w ? !h.__esModule : w.writable || w.configurable) || (w = { enumerable: !0, get: function() {
          return h[a];
        } }), Object.defineProperty(v, b, w);
      } : function(v, h, a, b) {
        b === void 0 && (b = a), v[b] = h[a];
      }), m = this && this.__setModuleDefault || (Object.create ? function(v, h) {
        Object.defineProperty(v, "default", { enumerable: !0, value: h });
      } : function(v, h) {
        v.default = h;
      }), _ = this && this.__importStar || function(v) {
        if (v && v.__esModule) return v;
        var h = {};
        if (v != null) for (var a in v) a !== "default" && Object.prototype.hasOwnProperty.call(v, a) && o(h, v, a);
        return m(h, v), h;
      };
      Object.defineProperty(e, "__esModule", { value: !0 }), e.WebGLContext = e.linearSearchLastTrue = void 0;
      const g = r(1670), y = _(r(7769)), E = r(9390);
      function x(v) {
        let h = 0;
        for (; h < v.length && v[h](); ++h) ;
        return h - 1;
      }
      e.linearSearchLastTrue = x, e.WebGLContext = class {
        constructor(v, h) {
          this.frameBufferBound = !1, this.itemsToPoll = [], this.gl = v, this.version = h, this.getExtensions(), this.vertexbuffer = this.createVertexbuffer(), this.framebuffer = this.createFramebuffer(), this.queryVitalParameters();
        }
        allocateTexture(v, h, a, b) {
          const w = this.gl, k = w.createTexture();
          w.bindTexture(w.TEXTURE_2D, k), w.texParameteri(w.TEXTURE_2D, w.TEXTURE_MIN_FILTER, w.NEAREST), w.texParameteri(w.TEXTURE_2D, w.TEXTURE_MAG_FILTER, w.NEAREST), w.texParameteri(w.TEXTURE_2D, w.TEXTURE_WRAP_S, w.CLAMP_TO_EDGE), w.texParameteri(w.TEXTURE_2D, w.TEXTURE_WRAP_T, w.CLAMP_TO_EDGE);
          const A = b ? a.encode(b, v * h) : null;
          return w.texImage2D(w.TEXTURE_2D, 0, a.internalFormat, v, h, 0, a.format, a.textureType, A), this.checkError(), k;
        }
        updateTexture(v, h, a, b, w) {
          const k = this.gl;
          k.bindTexture(k.TEXTURE_2D, v);
          const A = b.encode(w, h * a);
          k.texSubImage2D(k.TEXTURE_2D, 0, 0, 0, h, a, b.format, b.textureType, A), this.checkError();
        }
        attachFramebuffer(v, h, a) {
          const b = this.gl;
          b.bindTexture(b.TEXTURE_2D, v), b.bindFramebuffer(b.FRAMEBUFFER, this.framebuffer), b.framebufferTexture2D(b.FRAMEBUFFER, b.COLOR_ATTACHMENT0, b.TEXTURE_2D, v, 0), this.checkError(), b.viewport(0, 0, h, a), b.scissor(0, 0, h, a);
        }
        readTexture(v, h, a, b, w, k) {
          const A = this.gl;
          k || (k = 1), this.frameBufferBound || this.attachFramebuffer(v, h, a);
          const M = this.getEncoder(w, k), $ = M.allocate(h * a);
          return A.bindTexture(A.TEXTURE_2D, v), A.framebufferTexture2D(A.FRAMEBUFFER, A.COLOR_ATTACHMENT0, A.TEXTURE_2D, v, 0), A.readPixels(0, 0, h, a, A.RGBA, M.textureType, $), this.checkError(), M.decode($, b);
        }
        isFramebufferReady() {
          return !0;
        }
        getActiveTexture() {
          const v = this.gl;
          return "TEXTURE" + (v.getParameter(this.gl.ACTIVE_TEXTURE) - v.TEXTURE0);
        }
        getTextureBinding() {
          return this.gl.getParameter(this.gl.TEXTURE_BINDING_2D);
        }
        getFramebufferBinding() {
          return this.gl.getParameter(this.gl.FRAMEBUFFER_BINDING);
        }
        setVertexAttributes(v, h) {
          const a = this.gl;
          a.vertexAttribPointer(v, 3, a.FLOAT, !1, 20, 0), a.enableVertexAttribArray(v), h !== -1 && (a.vertexAttribPointer(h, 2, a.FLOAT, !1, 20, 12), a.enableVertexAttribArray(h)), this.checkError();
        }
        createProgram(v, h) {
          const a = this.gl, b = a.createProgram();
          return a.attachShader(b, v), a.attachShader(b, h), a.linkProgram(b), b;
        }
        compileShader(v, h) {
          const a = this.gl, b = a.createShader(h);
          if (!b) throw new Error(`createShader() returned null with type ${h}`);
          if (a.shaderSource(b, v), a.compileShader(b), a.getShaderParameter(b, a.COMPILE_STATUS) === !1) throw new Error(`Failed to compile shader: ${a.getShaderInfoLog(b)}
Shader source:
${v}`);
          return b;
        }
        deleteShader(v) {
          this.gl.deleteShader(v);
        }
        bindTextureToUniform(v, h, a) {
          const b = this.gl;
          b.activeTexture(b.TEXTURE0 + h), this.checkError(), b.bindTexture(b.TEXTURE_2D, v), this.checkError(), b.uniform1i(a, h), this.checkError();
        }
        draw() {
          this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, 4), this.checkError();
        }
        checkError() {
          if (g.env.debug) {
            const v = this.gl, h = v.getError();
            let a = "";
            switch (h) {
              case v.NO_ERROR:
                return;
              case v.INVALID_ENUM:
                a = "INVALID_ENUM";
                break;
              case v.INVALID_VALUE:
                a = "INVALID_VALUE";
                break;
              case v.INVALID_OPERATION:
                a = "INVALID_OPERATION";
                break;
              case v.INVALID_FRAMEBUFFER_OPERATION:
                a = "INVALID_FRAMEBUFFER_OPERATION";
                break;
              case v.OUT_OF_MEMORY:
                a = "OUT_OF_MEMORY";
                break;
              case v.CONTEXT_LOST_WEBGL:
                a = "CONTEXT_LOST_WEBGL";
                break;
              default:
                a = `Unknown WebGL Error: ${h.toString(16)}`;
            }
            throw new Error(a);
          }
        }
        deleteTexture(v) {
          this.gl.deleteTexture(v);
        }
        deleteProgram(v) {
          this.gl.deleteProgram(v);
        }
        getEncoder(v, h, a = 0) {
          if (this.version === 2) return new y.RedFloat32DataEncoder(this.gl, h);
          switch (v) {
            case "float":
              return a === 1 || this.isRenderFloat32Supported ? new y.RGBAFloatDataEncoder(this.gl, h) : new y.RGBAFloatDataEncoder(this.gl, h, this.textureHalfFloatExtension.HALF_FLOAT_OES);
            case "int":
              throw new Error("not implemented");
            case "byte":
              return new y.Uint8DataEncoder(this.gl, h);
            default:
              throw new Error(`Invalid dataType: ${v}`);
          }
        }
        clearActiveTextures() {
          const v = this.gl;
          for (let h = 0; h < this.maxTextureImageUnits; ++h) v.activeTexture(v.TEXTURE0 + h), v.bindTexture(v.TEXTURE_2D, null);
        }
        dispose() {
          if (this.disposed) return;
          const v = this.gl;
          v.bindFramebuffer(v.FRAMEBUFFER, null), v.deleteFramebuffer(this.framebuffer), v.bindBuffer(v.ARRAY_BUFFER, null), v.deleteBuffer(this.vertexbuffer), v.bindBuffer(v.ELEMENT_ARRAY_BUFFER, null), v.finish(), this.disposed = !0;
        }
        createDefaultGeometry() {
          return new Float32Array([-1, 1, 0, 0, 1, -1, -1, 0, 0, 0, 1, 1, 0, 1, 1, 1, -1, 0, 1, 0]);
        }
        createVertexbuffer() {
          const v = this.gl, h = v.createBuffer();
          if (!h) throw new Error("createBuffer() returned null");
          const a = this.createDefaultGeometry();
          return v.bindBuffer(v.ARRAY_BUFFER, h), v.bufferData(v.ARRAY_BUFFER, a, v.STATIC_DRAW), this.checkError(), h;
        }
        createFramebuffer() {
          const v = this.gl.createFramebuffer();
          if (!v) throw new Error("createFramebuffer returned null");
          return v;
        }
        queryVitalParameters() {
          const v = this.gl;
          if (this.isFloatTextureAttachableToFrameBuffer = this.checkFloatTextureAttachableToFrameBuffer(), this.isRenderFloat32Supported = this.checkRenderFloat32(), this.isFloat32DownloadSupported = this.checkFloat32Download(), this.version === 1 && !this.textureHalfFloatExtension && !this.isRenderFloat32Supported) throw new Error("both float32 and float16 TextureType are not supported");
          this.isBlendSupported = !this.isRenderFloat32Supported || this.checkFloat32Blend(), this.maxTextureSize = v.getParameter(v.MAX_TEXTURE_SIZE), this.maxTextureImageUnits = v.getParameter(v.MAX_TEXTURE_IMAGE_UNITS), this.version;
        }
        getExtensions() {
          this.version === 2 ? (this.colorBufferFloatExtension = this.gl.getExtension("EXT_color_buffer_float"), this.disjointTimerQueryWebgl2Extension = this.gl.getExtension("EXT_disjoint_timer_query_webgl2")) : (this.textureFloatExtension = this.gl.getExtension("OES_texture_float"), this.textureHalfFloatExtension = this.gl.getExtension("OES_texture_half_float"));
        }
        checkFloatTextureAttachableToFrameBuffer() {
          const v = this.gl, h = v.createTexture();
          v.bindTexture(v.TEXTURE_2D, h);
          const a = this.version === 2 ? v.RGBA32F : v.RGBA;
          v.texImage2D(v.TEXTURE_2D, 0, a, 1, 1, 0, v.RGBA, v.FLOAT, null);
          const b = v.createFramebuffer();
          v.bindFramebuffer(v.FRAMEBUFFER, b), v.framebufferTexture2D(v.FRAMEBUFFER, v.COLOR_ATTACHMENT0, v.TEXTURE_2D, h, 0);
          const w = v.checkFramebufferStatus(v.FRAMEBUFFER) === v.FRAMEBUFFER_COMPLETE;
          return v.bindTexture(v.TEXTURE_2D, null), v.bindFramebuffer(v.FRAMEBUFFER, null), v.deleteTexture(h), v.deleteFramebuffer(b), w;
        }
        checkRenderFloat32() {
          if (this.version === 2) {
            if (!this.colorBufferFloatExtension) return !1;
          } else if (!this.textureFloatExtension) return !1;
          return this.isFloatTextureAttachableToFrameBuffer;
        }
        checkFloat32Download() {
          if (this.version === 2) {
            if (!this.colorBufferFloatExtension) return !1;
          } else if (!this.textureFloatExtension || !this.gl.getExtension("WEBGL_color_buffer_float")) return !1;
          return this.isFloatTextureAttachableToFrameBuffer;
        }
        checkFloat32Blend() {
          const v = this.gl;
          let h, a, b, w, k;
          try {
            h = v.createTexture(), a = v.createFramebuffer(), v.bindTexture(v.TEXTURE_2D, h);
            const A = this.version === 2 ? v.RGBA32F : v.RGBA;
            return v.texImage2D(v.TEXTURE_2D, 0, A, 1, 1, 0, v.RGBA, v.FLOAT, null), v.bindFramebuffer(v.FRAMEBUFFER, a), v.framebufferTexture2D(v.FRAMEBUFFER, v.COLOR_ATTACHMENT0, v.TEXTURE_2D, h, 0), v.enable(v.BLEND), b = v.createShader(v.VERTEX_SHADER), !!b && (v.shaderSource(b, "void main(){}"), v.compileShader(b), w = v.createShader(v.FRAGMENT_SHADER), !!w && (v.shaderSource(w, "precision highp float;void main(){gl_FragColor=vec4(0.5);}"), v.compileShader(w), k = v.createProgram(), !!k && (v.attachShader(k, b), v.attachShader(k, w), v.linkProgram(k), v.useProgram(k), v.drawArrays(v.POINTS, 0, 1), v.getError() === v.NO_ERROR)));
          } finally {
            v.disable(v.BLEND), k && v.deleteProgram(k), b && v.deleteShader(b), w && v.deleteShader(w), a && (v.bindFramebuffer(v.FRAMEBUFFER, null), v.deleteFramebuffer(a)), h && (v.bindTexture(v.TEXTURE_2D, null), v.deleteTexture(h));
          }
        }
        beginTimer() {
          if (this.version === 2 && this.disjointTimerQueryWebgl2Extension) {
            const v = this.gl, h = this.disjointTimerQueryWebgl2Extension, a = v.createQuery();
            return v.beginQuery(h.TIME_ELAPSED_EXT, a), a;
          }
          throw new Error("WebGL1 profiling currently not supported.");
        }
        endTimer() {
          if (this.version !== 2 || !this.disjointTimerQueryWebgl2Extension) throw new Error("WebGL1 profiling currently not supported");
          {
            const v = this.gl, h = this.disjointTimerQueryWebgl2Extension;
            v.endQuery(h.TIME_ELAPSED_EXT);
          }
        }
        isTimerResultAvailable(v) {
          let h = !1, a = !1;
          if (this.version !== 2 || !this.disjointTimerQueryWebgl2Extension) throw new Error("WebGL1 profiling currently not supported");
          {
            const b = this.gl, w = this.disjointTimerQueryWebgl2Extension;
            h = b.getQueryParameter(v, b.QUERY_RESULT_AVAILABLE), a = b.getParameter(w.GPU_DISJOINT_EXT);
          }
          return h && !a;
        }
        getTimerResult(v) {
          let h = 0;
          if (this.version !== 2) throw new Error("WebGL1 profiling currently not supported");
          {
            const a = this.gl;
            h = a.getQueryParameter(v, a.QUERY_RESULT), a.deleteQuery(v);
          }
          return h / 1e6;
        }
        async waitForQueryAndGetTime(v) {
          return await (0, E.repeatedTry)(() => this.isTimerResultAvailable(v)), this.getTimerResult(v);
        }
        async createAndWaitForFence() {
          const v = this.createFence(this.gl);
          return this.pollFence(v);
        }
        createFence(v) {
          let h;
          const a = v, b = a.fenceSync(a.SYNC_GPU_COMMANDS_COMPLETE, 0);
          return v.flush(), h = b === null ? () => !0 : () => {
            const w = a.clientWaitSync(b, 0, 0);
            return w === a.ALREADY_SIGNALED || w === a.CONDITION_SATISFIED;
          }, { query: b, isFencePassed: h };
        }
        async pollFence(v) {
          return new Promise((h) => {
            this.addItemToPoll(() => v.isFencePassed(), () => h());
          });
        }
        pollItems() {
          const v = x(this.itemsToPoll.map((h) => h.isDoneFn));
          for (let h = 0; h <= v; ++h) {
            const { resolveFn: a } = this.itemsToPoll[h];
            a();
          }
          this.itemsToPoll = this.itemsToPoll.slice(v + 1);
        }
        async addItemToPoll(v, h) {
          this.itemsToPoll.push({ isDoneFn: v, resolveFn: h }), this.itemsToPoll.length > 1 || await (0, E.repeatedTry)(() => (this.pollItems(), this.itemsToPoll.length === 0));
        }
      };
    }, 1036: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.ExecutionPlan = void 0;
      const o = r(6231);
      class m {
        constructor(g, y) {
          this.op = g, this.node = y;
        }
      }
      e.ExecutionPlan = class {
        constructor(_, g, y) {
          this.graph = _, this.profiler = y, this.initialize(g);
        }
        initialize(_) {
          this.profiler.event("session", "ExecutionPlan.initialize", () => {
            const g = this.graph.getNodes();
            if (g.length !== _.length) throw new Error("The size of nodes and OPs do not match.");
            this._ops = _.map((y, E) => new m(y, g[E])), this.reset(), this._starter = [], this._ops.forEach((y, E) => {
              let x = !0;
              for (const v of y.node.inputs) if (!this._values[v] && this.graph.getInputIndices().indexOf(v) === -1) {
                x = !1;
                break;
              }
              x && this._starter.push(E);
            });
          });
        }
        reset() {
          this._values = this.graph.getValues().map((_) => _.tensor);
        }
        async execute(_, g) {
          return this.profiler.event("session", "ExecutionPlan.execute", async () => {
            this.reset();
            const y = _.createInferenceHandler(), E = this.graph.getInputIndices();
            if (g.length !== E.length) throw new Error(`number of input tensors don't match the number of inputs to the model: actual: ${g.length} expected: ${E.length}`);
            g.forEach((w, k) => {
              const A = E[k];
              this._values[A] = w;
            });
            const x = this._starter.slice(0), v = this.graph.getValues(), h = this.graph.getNodes();
            let a = 0;
            for (; a < x.length; ) {
              const w = x[a++], k = this._ops[w], A = k.node.inputs.map((C) => this._values[C]);
              if (A.indexOf(void 0) !== -1) throw new Error(`unresolved input detected: op: ${k.node}`);
              const M = A;
              o.Logger.verbose("ExecPlan", `Runing op:${k.node.name} (${M.map((C, P) => `'${k.node.inputs[P]}': ${C.type}[${C.dims.join(",")}]`).join(", ")})`);
              const $ = await this.profiler.event("node", k.node.name, async () => k.op.impl(y, M, k.op.context));
              if ($.length !== k.node.outputs.length) throw new Error("the size of output does not match model definition.");
              $.forEach((C, P) => {
                const I = k.node.outputs[P];
                if (this._values[I]) throw new Error(`output [${I}] already has value: op:${k.node.name}`);
                this._values[I] = C;
              });
              const O = /* @__PURE__ */ new Set();
              $.forEach((C, P) => {
                const I = k.node.outputs[P];
                for (const N of v[I].to) {
                  const R = h[N];
                  let F = !0;
                  for (const B of R.inputs) if (!this._values[B]) {
                    F = !1;
                    break;
                  }
                  F && O.add(N);
                }
              }), x.push(...O);
            }
            const b = [];
            for (let w = 0; w < this.graph.getOutputIndices().length; w++) {
              const k = this.graph.getOutputIndices()[w], A = this._values[k];
              if (A === void 0) throw new Error(`required output [${k}] does not have value`);
              k === 0 ? await A.getData() : A.data, b.push(A);
            }
            return o.Logger.verbose("ExecPlan", "disposing of inferenceHandler"), y.dispose(), b;
          });
        }
      };
    }, 7070: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.Graph = void 0;
      const o = r(1446), m = r(7778), _ = r(9395), g = r(9162), y = r(2517);
      var E = _.onnxruntime.experimental.fbs;
      e.Graph = { from: (a, b) => new h(a, b) };
      class x {
        constructor(b) {
          this._from = void 0, this._to = [], this.tensor = void 0, this.type = void 0, b && (this.type = y.ProtoUtil.tensorValueTypeFromProto(b.type.tensorType));
        }
        get from() {
          return this._from;
        }
        get to() {
          return this._to;
        }
      }
      class v {
        constructor(b, w) {
          b instanceof o.onnx.NodeProto ? (this.name = b.name, this.opType = b.opType, this.attributes = new m.Attribute(b.attribute)) : b instanceof E.Node && (this.name = w ?? b.name(), this.opType = b.opType(), this.attributes = new m.Attribute(y.ProtoUtil.tensorAttributesFromORTFormat(b))), this.inputs = [], this.outputs = [], this.executeNode = !0;
        }
      }
      class h {
        constructor(b, w) {
          if (!b) throw new TypeError("graph is empty");
          this.buildGraph(b), this.transformGraph(w), this.checkIsAcyclic();
        }
        getInputIndices() {
          return this._allInputIndices;
        }
        getInputNames() {
          return this._allInputNames;
        }
        getOutputIndices() {
          return this._allOutputIndices;
        }
        getOutputNames() {
          return this._allOutputNames;
        }
        getValues() {
          return this._allData;
        }
        getNodes() {
          return this._nodes;
        }
        buildGraph(b) {
          if (b instanceof o.onnx.GraphProto) this.buildGraphFromOnnxFormat(b);
          else {
            if (!(b instanceof E.Graph)) throw new TypeError("Graph type is not supported.");
            this.buildGraphFromOrtFormat(b);
          }
        }
        buildGraphFromOnnxFormat(b) {
          const w = /* @__PURE__ */ new Map();
          this._allData = [], this._allInputIndices = [], this._allInputNames = [], this._allOutputIndices = [], this._allOutputNames = [], this._nodes = [];
          const k = /* @__PURE__ */ new Map();
          if (!b.input) throw new Error("missing information in graph: input");
          const A = [];
          for (const M of b.input) {
            if (w.has(M.name)) throw new Error(`duplicated input name: ${M.name}`);
            const $ = this._allData.push(new x(M)) - 1;
            w.set(M.name, $), A.push(M.name);
          }
          if (!b.initializer) throw new Error("missing information in graph: initializer");
          for (const M of b.initializer) {
            let $ = w.get(M.name);
            if ($ === void 0) {
              const O = new x();
              O.type = { shape: { dims: y.ProtoUtil.tensorDimsFromProto(M.dims) }, tensorType: y.ProtoUtil.tensorDataTypeFromProto(M.dataType) }, $ = this._allData.push(O) - 1, w.set(M.name, $);
            }
            this._allData[$]._from = -1, this._allData[$].tensor = g.Tensor.fromProto(M);
          }
          for (let M = 0; M < this._allData.length; M++) this._allData[M].tensor || (this._allInputIndices.push(M), this._allInputNames.push(A[M]));
          if (!b.output) throw new Error("missing information in graph: output");
          for (const M of b.output) {
            if (w.has(M.name)) throw new Error(`duplicated output name: ${M.name}`);
            const $ = this._allData.push(new x(M)) - 1;
            w.set(M.name, $), this._allOutputIndices.push($), this._allOutputNames.push(M.name);
          }
          if (!b.node) throw new Error("missing information in graph: node");
          for (const M of b.node) {
            if (!M.name) for (let O = 0; ; O++) {
              const C = `unnamed_${M.opType}_${O}`;
              if (!k.has(C)) {
                M.name = C;
                break;
              }
            }
            if (k.has(M.name)) throw new Error(`duplicated node name: ${M.name}`);
            const $ = this._nodes.push(new v(M)) - 1;
            k.set(M.name, $);
          }
          for (let M = 0; M < this._nodes.length; M++) {
            const $ = this._nodes[M], O = b.node[M];
            if (!O.output) throw new Error(`missing output for node: ${O.name}`);
            for (const C of O.output) {
              let P = w.get(C);
              if (P === void 0 && (P = this._allData.push(new x()) - 1, w.set(C, P)), $.outputs.push(P), this._allData[P]._from !== void 0) throw new Error(`multiple nodes output to one data value: ${P}`);
              if (this._allData[P]._from = M, O.opType === "Constant") {
                if (!O.attribute || O.attribute.length !== 1 || !O.attribute[0].t) throw new Error("missing attributes or missing tensor value in attributes for this Constant operator");
                if (!O.output || O.output.length !== 1) throw new Error("missing output or incorrect number of outputs for this Constant operator");
                $.outputs.pop(), $.executeNode = !1, this._allData[P]._from = -1, this._allData[P].tensor = g.Tensor.fromProto(O.attribute[0].t);
              }
            }
          }
          for (let M = 0; M < this._nodes.length; M++) {
            const $ = this._nodes[M], O = b.node[M];
            if (!O.input) throw new Error(`missing input for node: ${O.name}`);
            for (const C of O.input) {
              const P = w.get(C);
              if (P === void 0) {
                if (C === "" && O.input.length === 3 && O.opType === "Resize") continue;
                throw new Error(`unrecognized input '${C}' for node: ${O.name}`);
              }
              $.inputs.push(P), this._allData[P]._to.push(M);
            }
          }
          return !0;
        }
        buildGraphFromOrtFormat(b) {
          var w, k, A;
          const M = /* @__PURE__ */ new Map();
          this._allData = [], this._allInputIndices = [], this._allInputNames = [], this._allOutputIndices = [], this._allOutputNames = [], this._nodes = [];
          const $ = /* @__PURE__ */ new Map(), O = [];
          for (let C = 0; C < b.inputsLength(); C++) {
            const P = b.inputs(C);
            if (M.has(P)) throw new Error(`duplicated input name: ${P}`);
            for (let I = 0; I < b.nodeArgsLength(); I++) if (((w = b.nodeArgs(I)) === null || w === void 0 ? void 0 : w.name()) === P) {
              const N = new x();
              if (((A = (k = b.nodeArgs(I)) === null || k === void 0 ? void 0 : k.type()) === null || A === void 0 ? void 0 : A.valueType()) !== E.TypeInfoValue.tensor_type) throw new Error("Unexpected value type for the nodeArg.");
              const R = b.nodeArgs(I).type().value(new E.TensorTypeAndShape()), F = y.ProtoUtil.tensorDataTypeFromProto(R.elemType()), B = R.shape(), G = [];
              for (let ee = 0; ee < B.dimLength(); ee++) G.push(y.LongUtil.longToNumber(B.dim(ee).value().dimValue()));
              N.type = { shape: { dims: G }, tensorType: F };
              const Q = this._allData.push(N) - 1;
              M.set(P, Q), O.push(P);
            }
          }
          for (let C = 0; C < b.initializersLength(); C++) {
            const P = b.initializers(C);
            let I = M.get(P.name());
            if (I === void 0) {
              const N = new x(), R = y.ProtoUtil.tensorDimsFromORTFormat(P), F = y.ProtoUtil.tensorDataTypeFromProto(P.dataType());
              N.type = { shape: { dims: R }, tensorType: F }, I = this._allData.push(N) - 1, M.set(P.name(), I);
            }
            this._allData[I]._from = -1, this._allData[I].tensor = g.Tensor.fromOrtTensor(P);
          }
          for (let C = 0; C < this._allData.length; C++) this._allData[C].tensor || (this._allInputIndices.push(C), this._allInputNames.push(O[C]));
          for (let C = 0; C < b.outputsLength(); C++) {
            const P = b.outputs(C);
            if (M.has(P)) throw new Error(`duplicated output name: ${P}`);
            const I = this._allData.push(new x()) - 1;
            M.set(P, I), this._allOutputIndices.push(I), this._allOutputNames.push(P);
          }
          if (!b.nodes) throw new Error("missing information in graph: node");
          for (let C = 0; C < b.nodesLength(); C++) {
            const P = b.nodes(C);
            let I = P.name();
            if (!I) for (let R = 0; I = `unnamed_${P.opType()}_${R}`, $.has(I); R++) ;
            if ($.has(I)) throw new Error(`duplicated node name: ${I}`);
            const N = this._nodes.push(new v(P, I)) - 1;
            $.set(I, N);
          }
          for (let C = 0; C < this._nodes.length; C++) {
            const P = this._nodes[C], I = b.nodes(C);
            if (I == null) throw new Error(`No node exists at index ${C}`);
            if ((I == null ? void 0 : I.outputsLength()) === 0) throw new Error(`missing output for node: ${I.name}`);
            for (let N = 0; N < (I == null ? void 0 : I.outputsLength()); N++) {
              const R = I == null ? void 0 : I.outputs(N);
              let F = M.get(R);
              if (F === void 0 && (F = this._allData.push(new x()) - 1, M.set(R, F)), P.outputs.push(F), this._allData[F]._from !== void 0) throw new Error(`multiple nodes output to one data value: ${F}`);
              if (this._allData[F]._from = C, I.opType() === "Constant") {
                if (I.attributesLength() !== 1 || !I.attributes(0).t()) throw new Error("missing attributes or missing tensor value in attributes for this Constant operator");
                if (I.outputsLength() !== 1) throw new Error("missing output or incorrect number of outputs for this Constant operator");
                P.outputs.pop(), P.executeNode = !1, this._allData[F]._from = -1, this._allData[F].tensor = g.Tensor.fromOrtTensor(I.attributes(0).t());
              }
            }
          }
          for (let C = 0; C < this._nodes.length; C++) {
            const P = this._nodes[C], I = b.nodes(C);
            if (I.inputsLength() === 0) throw new Error(`missing input for node: ${I.name}`);
            for (let N = 0; N < I.inputsLength(); N++) {
              const R = I.inputs(N), F = M.get(R);
              if (F === void 0) throw new Error(`unrecognized input '${R}' for node: ${I.name()}`);
              P.inputs.push(F), this._allData[F]._to.push(C);
            }
          }
        }
        checkIsAcyclic() {
          const b = /* @__PURE__ */ new Set();
          this._allInputIndices.forEach((A) => {
            this._allData[A]._to.forEach((M) => {
              b.add(M);
            });
          });
          const w = Array.from(b), k = new Array(this._nodes.length).fill("white");
          for (; w.length > 0; ) {
            const A = w.pop();
            k[A] === "gray" ? k[A] = "black" : (w.push(A), k[A] = "gray", this._nodes[A].outputs.forEach((M) => {
              const $ = this._allData[M];
              if ($.tensor !== void 0) throw new Error("node outputs should not be initialized");
              if ($._from !== A) throw new Error("from property of the Value object doesn't match index of Node being processed");
              $._to.forEach((O) => {
                if (k[O] === "gray") throw new Error("model graph is cyclic");
                k[O] === "white" && w.push(O);
              });
            }));
          }
        }
        transformGraph(b) {
          this.removeAllIdentityNodes(), this.removeAllDropoutNodes(), this.fuseConvActivationNodes(), b && b.transformGraph(this), this.finalizeGraph();
        }
        finalizeGraph() {
          let b = 0;
          for (let w = 0; w < this._nodes.length; w++) this._nodes[w].executeNode ? b > 0 && (this._nodes[w].inputs.forEach((k) => {
            const A = this._allData[k]._to.indexOf(w + b);
            A !== -1 && (this._allData[k]._to[A] = w);
          }), this._nodes[w].outputs.forEach((k) => {
            this._allData[k]._from && this._allData[k]._from === w + b && (this._allData[k]._from = w);
          })) : (b++, this._nodes[w].outputs.forEach((k) => {
            this._allData[k]._from = -2;
          }), this._nodes.splice(w, 1), w--);
          b = 0;
          for (let w = 0; w < this._allData.length; w++) if (this._allData[w].from !== -2 || this._allOutputIndices.indexOf(w + b) !== -1) {
            if (b > 0) {
              let k = -1;
              this._allData[w].from !== void 0 && this._allData[w].from !== -1 ? (k = this._nodes[this._allData[w].from].outputs.indexOf(w + b), k !== -1 && (this._nodes[this._allData[w].from].outputs[k] = w)) : (k = this._allInputIndices.indexOf(w + b), k !== -1 && (this._allInputIndices[k] = w)), this._allData[w].to.forEach((A) => {
                k = this._nodes[A].inputs.indexOf(w + b), k !== -1 && (this._nodes[A].inputs[k] = w);
              }), this._allData[w].to.length === 0 && (k = this._allOutputIndices.indexOf(w + b), k !== -1 && (this._allOutputIndices[k] = w));
            }
          } else b++, this._allData.splice(w, 1), w--;
        }
        deleteNode(b) {
          const w = this._nodes[b];
          if (w.outputs.length > 1) {
            for (let C = 1; C < w.outputs.length; C++) if (this._allData[w.outputs[C]].to.length > 0) throw new Error("Node deletion with more than one output connected to other nodes is not supported. ");
          }
          w.executeNode = !1;
          const k = w.inputs[0], A = w.outputs[0], M = this._allData[A].to, $ = this._allData[k].to.indexOf(b);
          if ($ === -1) throw new Error("The Value object doesn't have the current Node in it's 'to' property ");
          this._allData[k].to.splice($, 1), this._allData[A]._to = [];
          const O = this._allOutputIndices.indexOf(A);
          if (O !== -1 && (this._allOutputIndices[O] = k), M && M.length > 0) for (const C of M) {
            const P = this._nodes[C].inputs.indexOf(A);
            if (P === -1) throw new Error("The Node object doesn't have the output Value in it's 'inputs' property ");
            this._nodes[C].inputs[P] = k, this._allData[k].to.push(C);
          }
        }
        removeAllDropoutNodes() {
          let b = 0;
          for (const w of this._nodes) {
            if (w.opType === "Dropout") {
              if (w.inputs.length !== 1) throw new Error("Dropout nodes should only contain one input. ");
              if (w.outputs.length !== 1 && w.outputs.length !== 2) throw new Error("Dropout nodes should contain either 1 or 2 output(s)");
              if (w.outputs.length === 2 && this._allData[w.outputs[1]]._to.length !== 0) throw new Error("Dropout nodes's second output should not be referenced by other nodes");
              this.deleteNode(b);
            }
            b++;
          }
        }
        removeAllIdentityNodes() {
          let b = 0;
          for (const w of this._nodes) w.opType === "Identity" && this.deleteNode(b), b++;
        }
        isActivation(b) {
          switch (b.opType) {
            case "Relu":
            case "Sigmoid":
            case "Clip":
              return !0;
            default:
              return !1;
          }
        }
        fuseConvActivationNodes() {
          for (const b of this._nodes) if (b.opType === "Conv") {
            const w = this._allData[b.outputs[0]]._to;
            if (w.length === 1 && this.isActivation(this._nodes[w[0]])) {
              const k = this._nodes[w[0]];
              if (k.opType === "Clip") if (k.inputs.length === 1) try {
                b.attributes.set("activation_params", "floats", [k.attributes.getFloat("min"), k.attributes.getFloat("max")]);
              } catch {
                b.attributes.set("activation_params", "floats", [y.MIN_CLIP, y.MAX_CLIP]);
              }
              else {
                if (!(k.inputs.length >= 3 && this._allData[k.inputs[1]].tensor !== void 0 && this._allData[k.inputs[2]].tensor !== void 0)) continue;
                b.attributes.set("activation_params", "floats", [this._allData[k.inputs[1]].tensor.floatData[0], this._allData[k.inputs[2]].tensor.floatData[0]]);
              }
              b.attributes.set("activation", "string", k.opType), this.deleteNode(w[0]);
            }
          }
        }
      }
    }, 6231: (s, e) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.now = e.Profiler = e.Logger = void 0;
      const r = { verbose: 1e3, info: 2e3, warning: 4e3, error: 5e3, fatal: 6e3 }, o = { none: new class {
        log(v, h, a) {
        }
      }(), console: new class {
        log(v, h, a) {
          console.log(`${this.color(v)} ${a ? "\x1B[35m" + a + "\x1B[0m " : ""}${h}`);
        }
        color(v) {
          switch (v) {
            case "verbose":
              return "\x1B[34;40mv\x1B[0m";
            case "info":
              return "\x1B[32mi\x1B[0m";
            case "warning":
              return "\x1B[30;43mw\x1B[0m";
            case "error":
              return "\x1B[31;40me\x1B[0m";
            case "fatal":
              return "\x1B[101mf\x1B[0m";
            default:
              throw new Error(`unsupported severity: ${v}`);
          }
        }
      }() }, m = { provider: "console", minimalSeverity: "warning", logDateTime: !0, logSourceLocation: !1 };
      let _ = { "": m };
      function g(v, h, a, b) {
        if (h === void 0) return w = v, { verbose: g.verbose.bind(null, w), info: g.info.bind(null, w), warning: g.warning.bind(null, w), error: g.error.bind(null, w), fatal: g.fatal.bind(null, w) };
        if (a === void 0) y(v, h);
        else if (typeof a == "number" && b === void 0) y(v, h);
        else if (typeof a == "string" && b === void 0) y(v, a, 0, h);
        else {
          if (typeof a != "string" || typeof b != "number") throw new TypeError("input is valid");
          y(v, a, 0, h);
        }
        var w;
      }
      function y(v, h, a, b) {
        const w = _[b || ""] || _[""];
        r[v] < r[w.minimalSeverity] || (w.logDateTime && (h = `${(/* @__PURE__ */ new Date()).toISOString()}|${h}`), w.logSourceLocation, o[w.provider].log(v, h, b));
      }
      (function(v) {
        function h(b) {
          _ = {}, a("", b || {});
        }
        function a(b, w) {
          if (b === "*") h(w);
          else {
            const k = _[b] || m;
            _[b] = { provider: w.provider || k.provider, minimalSeverity: w.minimalSeverity || k.minimalSeverity, logDateTime: w.logDateTime === void 0 ? k.logDateTime : w.logDateTime, logSourceLocation: w.logSourceLocation === void 0 ? k.logSourceLocation : w.logSourceLocation };
          }
        }
        v.verbose = function(b, w) {
          v("verbose", b, w);
        }, v.info = function(b, w) {
          v("info", b, w);
        }, v.warning = function(b, w) {
          v("warning", b, w);
        }, v.error = function(b, w) {
          v("error", b, w);
        }, v.fatal = function(b, w) {
          v("fatal", b, w);
        }, v.reset = h, v.set = a, v.setWithEnv = function(b) {
          const w = {};
          b.logLevel && (w.minimalSeverity = b.logLevel), a("", w);
        };
      })(g || (g = {})), e.Logger = g;
      class E {
        constructor(h, a, b, w, k, A) {
          this.category = h, this.name = a, this.startTime = b, this.endCallback = w, this.timer = k, this.ctx = A;
        }
        end() {
          return this.endCallback(this);
        }
        async checkTimer() {
          if (this.ctx === void 0 || this.timer === void 0) throw new Error("No webgl timer found");
          return this.ctx.endTimer(), this.ctx.waitForQueryAndGetTime(this.timer);
        }
      }
      class x {
        constructor(h, a, b, w) {
          this.category = h, this.name = a, this.startTime = b, this.endTime = w;
        }
      }
      e.Profiler = class {
        static create(v) {
          return v === void 0 ? new this() : new this(v.maxNumberEvents, v.flushBatchSize, v.flushIntervalInMilliseconds);
        }
        constructor(v, h, a) {
          this._started = !1, this._flushPointer = 0, this._started = !1, this._maxNumberEvents = v === void 0 ? 1e4 : v, this._flushBatchSize = h === void 0 ? 10 : h, this._flushIntervalInMilliseconds = a === void 0 ? 5e3 : a;
        }
        start() {
          this._started = !0, this._timingEvents = [], this._flushTime = (0, e.now)(), this._flushPointer = 0;
        }
        stop() {
          for (this._started = !1; this._flushPointer < this._timingEvents.length; this._flushPointer++) this.logOneEvent(this._timingEvents[this._flushPointer]);
        }
        event(v, h, a, b) {
          const w = this._started ? this.begin(v, h, b) : void 0;
          let k = !1;
          const A = a();
          if (A && typeof A.then == "function") return k = !0, new Promise((M, $) => {
            A.then(async (O) => {
              w && await w.end(), M(O);
            }, async (O) => {
              w && await w.end(), $(O);
            });
          });
          if (!k && w) {
            const M = w.end();
            if (M && typeof M.then == "function") return new Promise(($, O) => {
              M.then(() => {
                $(A);
              }, (C) => {
                O(C);
              });
            });
          }
          return A;
        }
        begin(v, h, a) {
          if (!this._started) throw new Error("profiler is not started yet");
          if (a === void 0) {
            const b = (0, e.now)();
            return this.flush(b), new E(v, h, b, (w) => this.endSync(w));
          }
          {
            const b = a.beginTimer();
            return new E(v, h, 0, async (w) => this.end(w), b, a);
          }
        }
        async end(v) {
          const h = await v.checkTimer();
          this._timingEvents.length < this._maxNumberEvents && (this._timingEvents.push(new x(v.category, v.name, v.startTime, h)), this.flush(h));
        }
        endSync(v) {
          const h = (0, e.now)();
          this._timingEvents.length < this._maxNumberEvents && (this._timingEvents.push(new x(v.category, v.name, v.startTime, h)), this.flush(h));
        }
        logOneEvent(v) {
          e.Logger.verbose(`Profiler.${v.category}`, `${(v.endTime - v.startTime).toFixed(2)}ms on event '${v.name}' at ${v.endTime.toFixed(2)}`);
        }
        flush(v) {
          if (this._timingEvents.length - this._flushPointer >= this._flushBatchSize || v - this._flushTime >= this._flushIntervalInMilliseconds) {
            for (const h = this._flushPointer; this._flushPointer < h + this._flushBatchSize && this._flushPointer < this._timingEvents.length; this._flushPointer++) this.logOneEvent(this._timingEvents[this._flushPointer]);
            this._flushTime = (0, e.now)();
          }
        }
        get started() {
          return this._started;
        }
      }, e.now = typeof performance < "u" && performance.now ? () => performance.now() : Date.now;
    }, 2644: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.Model = void 0;
      const o = r(5686), m = r(1446), _ = r(7070), g = r(9395), y = r(2517);
      var E = g.onnxruntime.experimental.fbs;
      e.Model = class {
        constructor() {
        }
        load(x, v, h) {
          if (!h) try {
            return void this.loadFromOnnxFormat(x, v);
          } catch (a) {
            if (h !== void 0) throw a;
          }
          this.loadFromOrtFormat(x, v);
        }
        loadFromOnnxFormat(x, v) {
          const h = m.onnx.ModelProto.decode(x);
          if (y.LongUtil.longToNumber(h.irVersion) < 3) throw new Error("only support ONNX model with IR_VERSION>=3");
          this._opsets = h.opsetImport.map((a) => ({ domain: a.domain, version: y.LongUtil.longToNumber(a.version) })), this._graph = _.Graph.from(h.graph, v);
        }
        loadFromOrtFormat(x, v) {
          const h = new o.flatbuffers.ByteBuffer(x), a = E.InferenceSession.getRootAsInferenceSession(h).model();
          if (y.LongUtil.longToNumber(a.irVersion()) < 3) throw new Error("only support ONNX model with IR_VERSION>=3");
          this._opsets = [];
          for (let b = 0; b < a.opsetImportLength(); b++) {
            const w = a.opsetImport(b);
            this._opsets.push({ domain: w == null ? void 0 : w.domain(), version: y.LongUtil.longToNumber(w.version()) });
          }
          this._graph = _.Graph.from(a.graph(), v);
        }
        get graph() {
          return this._graph;
        }
        get opsets() {
          return this._opsets;
        }
      };
    }, 782: (s, e) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.FLOAT_TYPES = e.INT_TYPES = e.NUMBER_TYPES = void 0, e.NUMBER_TYPES = ["float32", "float64", "int32", "int16", "int8", "uint16", "uint32", "uint8"], e.INT_TYPES = ["int32", "int16", "int8", "uint16", "uint32", "uint8"], e.FLOAT_TYPES = ["float32", "float64"];
    }, 1047: (s, e) => {
      function r(o, m) {
        if (m.endsWith("+")) {
          const _ = Number.parseInt(m.substring(0, m.length - 1), 10);
          return !isNaN(_) && _ <= o;
        }
        if (m.split("-").length === 2) {
          const _ = m.split("-"), g = Number.parseInt(_[0], 10), y = Number.parseInt(_[1], 10);
          return !isNaN(g) && !isNaN(y) && g <= o && o <= y;
        }
        return Number.parseInt(m, 10) === o;
      }
      Object.defineProperty(e, "__esModule", { value: !0 }), e.resolveOperator = void 0, e.resolveOperator = function(o, m, _) {
        for (const g of _) {
          const y = g[0], E = g[1], x = g[2], v = g[3], h = g[4];
          if (o.opType === y) {
            for (const a of m) if ((a.domain === E || a.domain === "ai.onnx" && E === "") && r(a.version, x)) return { opImpl: v, opInit: h };
          }
        }
        throw new TypeError(`cannot resolve operator '${o.opType}' with opsets: ${m.map((g) => `${g.domain || "ai.onnx"} v${g.version}`).join(", ")}`);
      };
    }, 9395: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.onnxruntime = void 0;
      const o = r(5686);
      var m, _;
      m = e.onnxruntime || (e.onnxruntime = {}), function(g) {
        (function(y) {
          y[y.UNDEFINED = 0] = "UNDEFINED", y[y.FLOAT = 1] = "FLOAT", y[y.INT = 2] = "INT", y[y.STRING = 3] = "STRING", y[y.TENSOR = 4] = "TENSOR", y[y.GRAPH = 5] = "GRAPH", y[y.FLOATS = 6] = "FLOATS", y[y.INTS = 7] = "INTS", y[y.STRINGS = 8] = "STRINGS", y[y.TENSORS = 9] = "TENSORS", y[y.GRAPHS = 10] = "GRAPHS", y[y.SPARSE_TENSOR = 11] = "SPARSE_TENSOR", y[y.SPARSE_TENSORS = 12] = "SPARSE_TENSORS";
        })(g.AttributeType || (g.AttributeType = {}));
      }((_ = m.experimental || (m.experimental = {})).fbs || (_.fbs = {})), function(g) {
        (function(y) {
          (function(E) {
            (function(x) {
              x[x.UNKNOWN = 0] = "UNKNOWN", x[x.VALUE = 1] = "VALUE", x[x.PARAM = 2] = "PARAM";
            })(E.DimensionValueType || (E.DimensionValueType = {}));
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            (function(x) {
              x[x.UNDEFINED = 0] = "UNDEFINED", x[x.FLOAT = 1] = "FLOAT", x[x.UINT8 = 2] = "UINT8", x[x.INT8 = 3] = "INT8", x[x.UINT16 = 4] = "UINT16", x[x.INT16 = 5] = "INT16", x[x.INT32 = 6] = "INT32", x[x.INT64 = 7] = "INT64", x[x.STRING = 8] = "STRING", x[x.BOOL = 9] = "BOOL", x[x.FLOAT16 = 10] = "FLOAT16", x[x.DOUBLE = 11] = "DOUBLE", x[x.UINT32 = 12] = "UINT32", x[x.UINT64 = 13] = "UINT64", x[x.COMPLEX64 = 14] = "COMPLEX64", x[x.COMPLEX128 = 15] = "COMPLEX128", x[x.BFLOAT16 = 16] = "BFLOAT16";
            })(E.TensorDataType || (E.TensorDataType = {}));
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            (function(x) {
              x[x.Primitive = 0] = "Primitive", x[x.Fused = 1] = "Fused";
            })(E.NodeType || (E.NodeType = {}));
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            (function(x) {
              x[x.NONE = 0] = "NONE", x[x.tensor_type = 1] = "tensor_type", x[x.sequence_type = 2] = "sequence_type", x[x.map_type = 3] = "map_type";
            })(E.TypeInfoValue || (E.TypeInfoValue = {}));
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            class x {
              constructor() {
                this.bb = null, this.bb_pos = 0;
              }
              __init(h, a) {
                return this.bb_pos = h, this.bb = a, this;
              }
              static getRootAsShape(h, a) {
                return (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              static getSizePrefixedRootAsShape(h, a) {
                return h.setPosition(h.position() + o.flatbuffers.SIZE_PREFIX_LENGTH), (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              dim(h, a) {
                let b = this.bb.__offset(this.bb_pos, 4);
                return b ? (a || new g.experimental.fbs.Dimension()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + b) + 4 * h), this.bb) : null;
              }
              dimLength() {
                let h = this.bb.__offset(this.bb_pos, 4);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              static startShape(h) {
                h.startObject(1);
              }
              static addDim(h, a) {
                h.addFieldOffset(0, a, 0);
              }
              static createDimVector(h, a) {
                h.startVector(4, a.length, 4);
                for (let b = a.length - 1; b >= 0; b--) h.addOffset(a[b]);
                return h.endVector();
              }
              static startDimVector(h, a) {
                h.startVector(4, a, 4);
              }
              static endShape(h) {
                return h.endObject();
              }
              static createShape(h, a) {
                return x.startShape(h), x.addDim(h, a), x.endShape(h);
              }
            }
            E.Shape = x;
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            class x {
              constructor() {
                this.bb = null, this.bb_pos = 0;
              }
              __init(h, a) {
                return this.bb_pos = h, this.bb = a, this;
              }
              static getRootAsDimension(h, a) {
                return (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              static getSizePrefixedRootAsDimension(h, a) {
                return h.setPosition(h.position() + o.flatbuffers.SIZE_PREFIX_LENGTH), (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              value(h) {
                let a = this.bb.__offset(this.bb_pos, 4);
                return a ? (h || new g.experimental.fbs.DimensionValue()).__init(this.bb.__indirect(this.bb_pos + a), this.bb) : null;
              }
              denotation(h) {
                let a = this.bb.__offset(this.bb_pos, 6);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              static startDimension(h) {
                h.startObject(2);
              }
              static addValue(h, a) {
                h.addFieldOffset(0, a, 0);
              }
              static addDenotation(h, a) {
                h.addFieldOffset(1, a, 0);
              }
              static endDimension(h) {
                return h.endObject();
              }
              static createDimension(h, a, b) {
                return x.startDimension(h), x.addValue(h, a), x.addDenotation(h, b), x.endDimension(h);
              }
            }
            E.Dimension = x;
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            class x {
              constructor() {
                this.bb = null, this.bb_pos = 0;
              }
              __init(h, a) {
                return this.bb_pos = h, this.bb = a, this;
              }
              static getRootAsDimensionValue(h, a) {
                return (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              static getSizePrefixedRootAsDimensionValue(h, a) {
                return h.setPosition(h.position() + o.flatbuffers.SIZE_PREFIX_LENGTH), (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              dimType() {
                let h = this.bb.__offset(this.bb_pos, 4);
                return h ? this.bb.readInt8(this.bb_pos + h) : g.experimental.fbs.DimensionValueType.UNKNOWN;
              }
              dimValue() {
                let h = this.bb.__offset(this.bb_pos, 6);
                return h ? this.bb.readInt64(this.bb_pos + h) : this.bb.createLong(0, 0);
              }
              dimParam(h) {
                let a = this.bb.__offset(this.bb_pos, 8);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              static startDimensionValue(h) {
                h.startObject(3);
              }
              static addDimType(h, a) {
                h.addFieldInt8(0, a, g.experimental.fbs.DimensionValueType.UNKNOWN);
              }
              static addDimValue(h, a) {
                h.addFieldInt64(1, a, h.createLong(0, 0));
              }
              static addDimParam(h, a) {
                h.addFieldOffset(2, a, 0);
              }
              static endDimensionValue(h) {
                return h.endObject();
              }
              static createDimensionValue(h, a, b, w) {
                return x.startDimensionValue(h), x.addDimType(h, a), x.addDimValue(h, b), x.addDimParam(h, w), x.endDimensionValue(h);
              }
            }
            E.DimensionValue = x;
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            class x {
              constructor() {
                this.bb = null, this.bb_pos = 0;
              }
              __init(h, a) {
                return this.bb_pos = h, this.bb = a, this;
              }
              static getRootAsTensorTypeAndShape(h, a) {
                return (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              static getSizePrefixedRootAsTensorTypeAndShape(h, a) {
                return h.setPosition(h.position() + o.flatbuffers.SIZE_PREFIX_LENGTH), (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              elemType() {
                let h = this.bb.__offset(this.bb_pos, 4);
                return h ? this.bb.readInt32(this.bb_pos + h) : g.experimental.fbs.TensorDataType.UNDEFINED;
              }
              shape(h) {
                let a = this.bb.__offset(this.bb_pos, 6);
                return a ? (h || new g.experimental.fbs.Shape()).__init(this.bb.__indirect(this.bb_pos + a), this.bb) : null;
              }
              static startTensorTypeAndShape(h) {
                h.startObject(2);
              }
              static addElemType(h, a) {
                h.addFieldInt32(0, a, g.experimental.fbs.TensorDataType.UNDEFINED);
              }
              static addShape(h, a) {
                h.addFieldOffset(1, a, 0);
              }
              static endTensorTypeAndShape(h) {
                return h.endObject();
              }
              static createTensorTypeAndShape(h, a, b) {
                return x.startTensorTypeAndShape(h), x.addElemType(h, a), x.addShape(h, b), x.endTensorTypeAndShape(h);
              }
            }
            E.TensorTypeAndShape = x;
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            class x {
              constructor() {
                this.bb = null, this.bb_pos = 0;
              }
              __init(h, a) {
                return this.bb_pos = h, this.bb = a, this;
              }
              static getRootAsMapType(h, a) {
                return (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              static getSizePrefixedRootAsMapType(h, a) {
                return h.setPosition(h.position() + o.flatbuffers.SIZE_PREFIX_LENGTH), (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              keyType() {
                let h = this.bb.__offset(this.bb_pos, 4);
                return h ? this.bb.readInt32(this.bb_pos + h) : g.experimental.fbs.TensorDataType.UNDEFINED;
              }
              valueType(h) {
                let a = this.bb.__offset(this.bb_pos, 6);
                return a ? (h || new g.experimental.fbs.TypeInfo()).__init(this.bb.__indirect(this.bb_pos + a), this.bb) : null;
              }
              static startMapType(h) {
                h.startObject(2);
              }
              static addKeyType(h, a) {
                h.addFieldInt32(0, a, g.experimental.fbs.TensorDataType.UNDEFINED);
              }
              static addValueType(h, a) {
                h.addFieldOffset(1, a, 0);
              }
              static endMapType(h) {
                return h.endObject();
              }
              static createMapType(h, a, b) {
                return x.startMapType(h), x.addKeyType(h, a), x.addValueType(h, b), x.endMapType(h);
              }
            }
            E.MapType = x;
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            class x {
              constructor() {
                this.bb = null, this.bb_pos = 0;
              }
              __init(h, a) {
                return this.bb_pos = h, this.bb = a, this;
              }
              static getRootAsSequenceType(h, a) {
                return (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              static getSizePrefixedRootAsSequenceType(h, a) {
                return h.setPosition(h.position() + o.flatbuffers.SIZE_PREFIX_LENGTH), (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              elemType(h) {
                let a = this.bb.__offset(this.bb_pos, 4);
                return a ? (h || new g.experimental.fbs.TypeInfo()).__init(this.bb.__indirect(this.bb_pos + a), this.bb) : null;
              }
              static startSequenceType(h) {
                h.startObject(1);
              }
              static addElemType(h, a) {
                h.addFieldOffset(0, a, 0);
              }
              static endSequenceType(h) {
                return h.endObject();
              }
              static createSequenceType(h, a) {
                return x.startSequenceType(h), x.addElemType(h, a), x.endSequenceType(h);
              }
            }
            E.SequenceType = x;
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (y.fbs || (y.fbs = {})).EdgeEnd = class {
            constructor() {
              this.bb = null, this.bb_pos = 0;
            }
            __init(E, x) {
              return this.bb_pos = E, this.bb = x, this;
            }
            nodeIndex() {
              return this.bb.readUint32(this.bb_pos);
            }
            srcArgIndex() {
              return this.bb.readInt32(this.bb_pos + 4);
            }
            dstArgIndex() {
              return this.bb.readInt32(this.bb_pos + 8);
            }
            static createEdgeEnd(E, x, v, h) {
              return E.prep(4, 12), E.writeInt32(h), E.writeInt32(v), E.writeInt32(x), E.offset();
            }
          };
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            class x {
              constructor() {
                this.bb = null, this.bb_pos = 0;
              }
              __init(h, a) {
                return this.bb_pos = h, this.bb = a, this;
              }
              static getRootAsNodeEdge(h, a) {
                return (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              static getSizePrefixedRootAsNodeEdge(h, a) {
                return h.setPosition(h.position() + o.flatbuffers.SIZE_PREFIX_LENGTH), (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              nodeIndex() {
                let h = this.bb.__offset(this.bb_pos, 4);
                return h ? this.bb.readUint32(this.bb_pos + h) : 0;
              }
              inputEdges(h, a) {
                let b = this.bb.__offset(this.bb_pos, 6);
                return b ? (a || new g.experimental.fbs.EdgeEnd()).__init(this.bb.__vector(this.bb_pos + b) + 12 * h, this.bb) : null;
              }
              inputEdgesLength() {
                let h = this.bb.__offset(this.bb_pos, 6);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              outputEdges(h, a) {
                let b = this.bb.__offset(this.bb_pos, 8);
                return b ? (a || new g.experimental.fbs.EdgeEnd()).__init(this.bb.__vector(this.bb_pos + b) + 12 * h, this.bb) : null;
              }
              outputEdgesLength() {
                let h = this.bb.__offset(this.bb_pos, 8);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              static startNodeEdge(h) {
                h.startObject(3);
              }
              static addNodeIndex(h, a) {
                h.addFieldInt32(0, a, 0);
              }
              static addInputEdges(h, a) {
                h.addFieldOffset(1, a, 0);
              }
              static startInputEdgesVector(h, a) {
                h.startVector(12, a, 4);
              }
              static addOutputEdges(h, a) {
                h.addFieldOffset(2, a, 0);
              }
              static startOutputEdgesVector(h, a) {
                h.startVector(12, a, 4);
              }
              static endNodeEdge(h) {
                return h.endObject();
              }
              static createNodeEdge(h, a, b, w) {
                return x.startNodeEdge(h), x.addNodeIndex(h, a), x.addInputEdges(h, b), x.addOutputEdges(h, w), x.endNodeEdge(h);
              }
            }
            E.NodeEdge = x;
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            class x {
              constructor() {
                this.bb = null, this.bb_pos = 0;
              }
              __init(h, a) {
                return this.bb_pos = h, this.bb = a, this;
              }
              static getRootAsNode(h, a) {
                return (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              static getSizePrefixedRootAsNode(h, a) {
                return h.setPosition(h.position() + o.flatbuffers.SIZE_PREFIX_LENGTH), (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              name(h) {
                let a = this.bb.__offset(this.bb_pos, 4);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              docString(h) {
                let a = this.bb.__offset(this.bb_pos, 6);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              domain(h) {
                let a = this.bb.__offset(this.bb_pos, 8);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              sinceVersion() {
                let h = this.bb.__offset(this.bb_pos, 10);
                return h ? this.bb.readInt32(this.bb_pos + h) : 0;
              }
              index() {
                let h = this.bb.__offset(this.bb_pos, 12);
                return h ? this.bb.readUint32(this.bb_pos + h) : 0;
              }
              opType(h) {
                let a = this.bb.__offset(this.bb_pos, 14);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              type() {
                let h = this.bb.__offset(this.bb_pos, 16);
                return h ? this.bb.readInt32(this.bb_pos + h) : g.experimental.fbs.NodeType.Primitive;
              }
              executionProviderType(h) {
                let a = this.bb.__offset(this.bb_pos, 18);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              inputs(h, a) {
                let b = this.bb.__offset(this.bb_pos, 20);
                return b ? this.bb.__string(this.bb.__vector(this.bb_pos + b) + 4 * h, a) : null;
              }
              inputsLength() {
                let h = this.bb.__offset(this.bb_pos, 20);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              outputs(h, a) {
                let b = this.bb.__offset(this.bb_pos, 22);
                return b ? this.bb.__string(this.bb.__vector(this.bb_pos + b) + 4 * h, a) : null;
              }
              outputsLength() {
                let h = this.bb.__offset(this.bb_pos, 22);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              attributes(h, a) {
                let b = this.bb.__offset(this.bb_pos, 24);
                return b ? (a || new g.experimental.fbs.Attribute()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + b) + 4 * h), this.bb) : null;
              }
              attributesLength() {
                let h = this.bb.__offset(this.bb_pos, 24);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              inputArgCounts(h) {
                let a = this.bb.__offset(this.bb_pos, 26);
                return a ? this.bb.readInt32(this.bb.__vector(this.bb_pos + a) + 4 * h) : 0;
              }
              inputArgCountsLength() {
                let h = this.bb.__offset(this.bb_pos, 26);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              inputArgCountsArray() {
                let h = this.bb.__offset(this.bb_pos, 26);
                return h ? new Int32Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + h), this.bb.__vector_len(this.bb_pos + h)) : null;
              }
              implicitInputs(h, a) {
                let b = this.bb.__offset(this.bb_pos, 28);
                return b ? this.bb.__string(this.bb.__vector(this.bb_pos + b) + 4 * h, a) : null;
              }
              implicitInputsLength() {
                let h = this.bb.__offset(this.bb_pos, 28);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              static startNode(h) {
                h.startObject(13);
              }
              static addName(h, a) {
                h.addFieldOffset(0, a, 0);
              }
              static addDocString(h, a) {
                h.addFieldOffset(1, a, 0);
              }
              static addDomain(h, a) {
                h.addFieldOffset(2, a, 0);
              }
              static addSinceVersion(h, a) {
                h.addFieldInt32(3, a, 0);
              }
              static addIndex(h, a) {
                h.addFieldInt32(4, a, 0);
              }
              static addOpType(h, a) {
                h.addFieldOffset(5, a, 0);
              }
              static addType(h, a) {
                h.addFieldInt32(6, a, g.experimental.fbs.NodeType.Primitive);
              }
              static addExecutionProviderType(h, a) {
                h.addFieldOffset(7, a, 0);
              }
              static addInputs(h, a) {
                h.addFieldOffset(8, a, 0);
              }
              static createInputsVector(h, a) {
                h.startVector(4, a.length, 4);
                for (let b = a.length - 1; b >= 0; b--) h.addOffset(a[b]);
                return h.endVector();
              }
              static startInputsVector(h, a) {
                h.startVector(4, a, 4);
              }
              static addOutputs(h, a) {
                h.addFieldOffset(9, a, 0);
              }
              static createOutputsVector(h, a) {
                h.startVector(4, a.length, 4);
                for (let b = a.length - 1; b >= 0; b--) h.addOffset(a[b]);
                return h.endVector();
              }
              static startOutputsVector(h, a) {
                h.startVector(4, a, 4);
              }
              static addAttributes(h, a) {
                h.addFieldOffset(10, a, 0);
              }
              static createAttributesVector(h, a) {
                h.startVector(4, a.length, 4);
                for (let b = a.length - 1; b >= 0; b--) h.addOffset(a[b]);
                return h.endVector();
              }
              static startAttributesVector(h, a) {
                h.startVector(4, a, 4);
              }
              static addInputArgCounts(h, a) {
                h.addFieldOffset(11, a, 0);
              }
              static createInputArgCountsVector(h, a) {
                h.startVector(4, a.length, 4);
                for (let b = a.length - 1; b >= 0; b--) h.addInt32(a[b]);
                return h.endVector();
              }
              static startInputArgCountsVector(h, a) {
                h.startVector(4, a, 4);
              }
              static addImplicitInputs(h, a) {
                h.addFieldOffset(12, a, 0);
              }
              static createImplicitInputsVector(h, a) {
                h.startVector(4, a.length, 4);
                for (let b = a.length - 1; b >= 0; b--) h.addOffset(a[b]);
                return h.endVector();
              }
              static startImplicitInputsVector(h, a) {
                h.startVector(4, a, 4);
              }
              static endNode(h) {
                return h.endObject();
              }
              static createNode(h, a, b, w, k, A, M, $, O, C, P, I, N, R) {
                return x.startNode(h), x.addName(h, a), x.addDocString(h, b), x.addDomain(h, w), x.addSinceVersion(h, k), x.addIndex(h, A), x.addOpType(h, M), x.addType(h, $), x.addExecutionProviderType(h, O), x.addInputs(h, C), x.addOutputs(h, P), x.addAttributes(h, I), x.addInputArgCounts(h, N), x.addImplicitInputs(h, R), x.endNode(h);
              }
            }
            E.Node = x;
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            class x {
              constructor() {
                this.bb = null, this.bb_pos = 0;
              }
              __init(h, a) {
                return this.bb_pos = h, this.bb = a, this;
              }
              static getRootAsValueInfo(h, a) {
                return (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              static getSizePrefixedRootAsValueInfo(h, a) {
                return h.setPosition(h.position() + o.flatbuffers.SIZE_PREFIX_LENGTH), (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              name(h) {
                let a = this.bb.__offset(this.bb_pos, 4);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              docString(h) {
                let a = this.bb.__offset(this.bb_pos, 6);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              type(h) {
                let a = this.bb.__offset(this.bb_pos, 8);
                return a ? (h || new g.experimental.fbs.TypeInfo()).__init(this.bb.__indirect(this.bb_pos + a), this.bb) : null;
              }
              static startValueInfo(h) {
                h.startObject(3);
              }
              static addName(h, a) {
                h.addFieldOffset(0, a, 0);
              }
              static addDocString(h, a) {
                h.addFieldOffset(1, a, 0);
              }
              static addType(h, a) {
                h.addFieldOffset(2, a, 0);
              }
              static endValueInfo(h) {
                return h.endObject();
              }
              static createValueInfo(h, a, b, w) {
                return x.startValueInfo(h), x.addName(h, a), x.addDocString(h, b), x.addType(h, w), x.endValueInfo(h);
              }
            }
            E.ValueInfo = x;
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            class x {
              constructor() {
                this.bb = null, this.bb_pos = 0;
              }
              __init(h, a) {
                return this.bb_pos = h, this.bb = a, this;
              }
              static getRootAsTypeInfo(h, a) {
                return (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              static getSizePrefixedRootAsTypeInfo(h, a) {
                return h.setPosition(h.position() + o.flatbuffers.SIZE_PREFIX_LENGTH), (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              denotation(h) {
                let a = this.bb.__offset(this.bb_pos, 4);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              valueType() {
                let h = this.bb.__offset(this.bb_pos, 6);
                return h ? this.bb.readUint8(this.bb_pos + h) : g.experimental.fbs.TypeInfoValue.NONE;
              }
              value(h) {
                let a = this.bb.__offset(this.bb_pos, 8);
                return a ? this.bb.__union(h, this.bb_pos + a) : null;
              }
              static startTypeInfo(h) {
                h.startObject(3);
              }
              static addDenotation(h, a) {
                h.addFieldOffset(0, a, 0);
              }
              static addValueType(h, a) {
                h.addFieldInt8(1, a, g.experimental.fbs.TypeInfoValue.NONE);
              }
              static addValue(h, a) {
                h.addFieldOffset(2, a, 0);
              }
              static endTypeInfo(h) {
                return h.endObject();
              }
              static createTypeInfo(h, a, b, w) {
                return x.startTypeInfo(h), x.addDenotation(h, a), x.addValueType(h, b), x.addValue(h, w), x.endTypeInfo(h);
              }
            }
            E.TypeInfo = x;
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            class x {
              constructor() {
                this.bb = null, this.bb_pos = 0;
              }
              __init(h, a) {
                return this.bb_pos = h, this.bb = a, this;
              }
              static getRootAsOperatorSetId(h, a) {
                return (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              static getSizePrefixedRootAsOperatorSetId(h, a) {
                return h.setPosition(h.position() + o.flatbuffers.SIZE_PREFIX_LENGTH), (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              domain(h) {
                let a = this.bb.__offset(this.bb_pos, 4);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              version() {
                let h = this.bb.__offset(this.bb_pos, 6);
                return h ? this.bb.readInt64(this.bb_pos + h) : this.bb.createLong(0, 0);
              }
              static startOperatorSetId(h) {
                h.startObject(2);
              }
              static addDomain(h, a) {
                h.addFieldOffset(0, a, 0);
              }
              static addVersion(h, a) {
                h.addFieldInt64(1, a, h.createLong(0, 0));
              }
              static endOperatorSetId(h) {
                return h.endObject();
              }
              static createOperatorSetId(h, a, b) {
                return x.startOperatorSetId(h), x.addDomain(h, a), x.addVersion(h, b), x.endOperatorSetId(h);
              }
            }
            E.OperatorSetId = x;
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            class x {
              constructor() {
                this.bb = null, this.bb_pos = 0;
              }
              __init(h, a) {
                return this.bb_pos = h, this.bb = a, this;
              }
              static getRootAsTensor(h, a) {
                return (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              static getSizePrefixedRootAsTensor(h, a) {
                return h.setPosition(h.position() + o.flatbuffers.SIZE_PREFIX_LENGTH), (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              name(h) {
                let a = this.bb.__offset(this.bb_pos, 4);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              docString(h) {
                let a = this.bb.__offset(this.bb_pos, 6);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              dims(h) {
                let a = this.bb.__offset(this.bb_pos, 8);
                return a ? this.bb.readInt64(this.bb.__vector(this.bb_pos + a) + 8 * h) : this.bb.createLong(0, 0);
              }
              dimsLength() {
                let h = this.bb.__offset(this.bb_pos, 8);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              dataType() {
                let h = this.bb.__offset(this.bb_pos, 10);
                return h ? this.bb.readInt32(this.bb_pos + h) : g.experimental.fbs.TensorDataType.UNDEFINED;
              }
              rawData(h) {
                let a = this.bb.__offset(this.bb_pos, 12);
                return a ? this.bb.readUint8(this.bb.__vector(this.bb_pos + a) + h) : 0;
              }
              rawDataLength() {
                let h = this.bb.__offset(this.bb_pos, 12);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              rawDataArray() {
                let h = this.bb.__offset(this.bb_pos, 12);
                return h ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + h), this.bb.__vector_len(this.bb_pos + h)) : null;
              }
              stringData(h, a) {
                let b = this.bb.__offset(this.bb_pos, 14);
                return b ? this.bb.__string(this.bb.__vector(this.bb_pos + b) + 4 * h, a) : null;
              }
              stringDataLength() {
                let h = this.bb.__offset(this.bb_pos, 14);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              static startTensor(h) {
                h.startObject(6);
              }
              static addName(h, a) {
                h.addFieldOffset(0, a, 0);
              }
              static addDocString(h, a) {
                h.addFieldOffset(1, a, 0);
              }
              static addDims(h, a) {
                h.addFieldOffset(2, a, 0);
              }
              static createDimsVector(h, a) {
                h.startVector(8, a.length, 8);
                for (let b = a.length - 1; b >= 0; b--) h.addInt64(a[b]);
                return h.endVector();
              }
              static startDimsVector(h, a) {
                h.startVector(8, a, 8);
              }
              static addDataType(h, a) {
                h.addFieldInt32(3, a, g.experimental.fbs.TensorDataType.UNDEFINED);
              }
              static addRawData(h, a) {
                h.addFieldOffset(4, a, 0);
              }
              static createRawDataVector(h, a) {
                h.startVector(1, a.length, 1);
                for (let b = a.length - 1; b >= 0; b--) h.addInt8(a[b]);
                return h.endVector();
              }
              static startRawDataVector(h, a) {
                h.startVector(1, a, 1);
              }
              static addStringData(h, a) {
                h.addFieldOffset(5, a, 0);
              }
              static createStringDataVector(h, a) {
                h.startVector(4, a.length, 4);
                for (let b = a.length - 1; b >= 0; b--) h.addOffset(a[b]);
                return h.endVector();
              }
              static startStringDataVector(h, a) {
                h.startVector(4, a, 4);
              }
              static endTensor(h) {
                return h.endObject();
              }
              static createTensor(h, a, b, w, k, A, M) {
                return x.startTensor(h), x.addName(h, a), x.addDocString(h, b), x.addDims(h, w), x.addDataType(h, k), x.addRawData(h, A), x.addStringData(h, M), x.endTensor(h);
              }
            }
            E.Tensor = x;
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            class x {
              constructor() {
                this.bb = null, this.bb_pos = 0;
              }
              __init(h, a) {
                return this.bb_pos = h, this.bb = a, this;
              }
              static getRootAsSparseTensor(h, a) {
                return (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              static getSizePrefixedRootAsSparseTensor(h, a) {
                return h.setPosition(h.position() + o.flatbuffers.SIZE_PREFIX_LENGTH), (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              values(h) {
                let a = this.bb.__offset(this.bb_pos, 4);
                return a ? (h || new g.experimental.fbs.Tensor()).__init(this.bb.__indirect(this.bb_pos + a), this.bb) : null;
              }
              indices(h) {
                let a = this.bb.__offset(this.bb_pos, 6);
                return a ? (h || new g.experimental.fbs.Tensor()).__init(this.bb.__indirect(this.bb_pos + a), this.bb) : null;
              }
              dims(h) {
                let a = this.bb.__offset(this.bb_pos, 8);
                return a ? this.bb.readInt64(this.bb.__vector(this.bb_pos + a) + 8 * h) : this.bb.createLong(0, 0);
              }
              dimsLength() {
                let h = this.bb.__offset(this.bb_pos, 8);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              static startSparseTensor(h) {
                h.startObject(3);
              }
              static addValues(h, a) {
                h.addFieldOffset(0, a, 0);
              }
              static addIndices(h, a) {
                h.addFieldOffset(1, a, 0);
              }
              static addDims(h, a) {
                h.addFieldOffset(2, a, 0);
              }
              static createDimsVector(h, a) {
                h.startVector(8, a.length, 8);
                for (let b = a.length - 1; b >= 0; b--) h.addInt64(a[b]);
                return h.endVector();
              }
              static startDimsVector(h, a) {
                h.startVector(8, a, 8);
              }
              static endSparseTensor(h) {
                return h.endObject();
              }
              static createSparseTensor(h, a, b, w) {
                return x.startSparseTensor(h), x.addValues(h, a), x.addIndices(h, b), x.addDims(h, w), x.endSparseTensor(h);
              }
            }
            E.SparseTensor = x;
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            class x {
              constructor() {
                this.bb = null, this.bb_pos = 0;
              }
              __init(h, a) {
                return this.bb_pos = h, this.bb = a, this;
              }
              static getRootAsAttribute(h, a) {
                return (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              static getSizePrefixedRootAsAttribute(h, a) {
                return h.setPosition(h.position() + o.flatbuffers.SIZE_PREFIX_LENGTH), (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              name(h) {
                let a = this.bb.__offset(this.bb_pos, 4);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              docString(h) {
                let a = this.bb.__offset(this.bb_pos, 6);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              type() {
                let h = this.bb.__offset(this.bb_pos, 8);
                return h ? this.bb.readInt32(this.bb_pos + h) : g.experimental.fbs.AttributeType.UNDEFINED;
              }
              f() {
                let h = this.bb.__offset(this.bb_pos, 10);
                return h ? this.bb.readFloat32(this.bb_pos + h) : 0;
              }
              i() {
                let h = this.bb.__offset(this.bb_pos, 12);
                return h ? this.bb.readInt64(this.bb_pos + h) : this.bb.createLong(0, 0);
              }
              s(h) {
                let a = this.bb.__offset(this.bb_pos, 14);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              t(h) {
                let a = this.bb.__offset(this.bb_pos, 16);
                return a ? (h || new g.experimental.fbs.Tensor()).__init(this.bb.__indirect(this.bb_pos + a), this.bb) : null;
              }
              g(h) {
                let a = this.bb.__offset(this.bb_pos, 18);
                return a ? (h || new g.experimental.fbs.Graph()).__init(this.bb.__indirect(this.bb_pos + a), this.bb) : null;
              }
              floats(h) {
                let a = this.bb.__offset(this.bb_pos, 20);
                return a ? this.bb.readFloat32(this.bb.__vector(this.bb_pos + a) + 4 * h) : 0;
              }
              floatsLength() {
                let h = this.bb.__offset(this.bb_pos, 20);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              floatsArray() {
                let h = this.bb.__offset(this.bb_pos, 20);
                return h ? new Float32Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + h), this.bb.__vector_len(this.bb_pos + h)) : null;
              }
              ints(h) {
                let a = this.bb.__offset(this.bb_pos, 22);
                return a ? this.bb.readInt64(this.bb.__vector(this.bb_pos + a) + 8 * h) : this.bb.createLong(0, 0);
              }
              intsLength() {
                let h = this.bb.__offset(this.bb_pos, 22);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              strings(h, a) {
                let b = this.bb.__offset(this.bb_pos, 24);
                return b ? this.bb.__string(this.bb.__vector(this.bb_pos + b) + 4 * h, a) : null;
              }
              stringsLength() {
                let h = this.bb.__offset(this.bb_pos, 24);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              tensors(h, a) {
                let b = this.bb.__offset(this.bb_pos, 26);
                return b ? (a || new g.experimental.fbs.Tensor()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + b) + 4 * h), this.bb) : null;
              }
              tensorsLength() {
                let h = this.bb.__offset(this.bb_pos, 26);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              graphs(h, a) {
                let b = this.bb.__offset(this.bb_pos, 28);
                return b ? (a || new g.experimental.fbs.Graph()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + b) + 4 * h), this.bb) : null;
              }
              graphsLength() {
                let h = this.bb.__offset(this.bb_pos, 28);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              static startAttribute(h) {
                h.startObject(13);
              }
              static addName(h, a) {
                h.addFieldOffset(0, a, 0);
              }
              static addDocString(h, a) {
                h.addFieldOffset(1, a, 0);
              }
              static addType(h, a) {
                h.addFieldInt32(2, a, g.experimental.fbs.AttributeType.UNDEFINED);
              }
              static addF(h, a) {
                h.addFieldFloat32(3, a, 0);
              }
              static addI(h, a) {
                h.addFieldInt64(4, a, h.createLong(0, 0));
              }
              static addS(h, a) {
                h.addFieldOffset(5, a, 0);
              }
              static addT(h, a) {
                h.addFieldOffset(6, a, 0);
              }
              static addG(h, a) {
                h.addFieldOffset(7, a, 0);
              }
              static addFloats(h, a) {
                h.addFieldOffset(8, a, 0);
              }
              static createFloatsVector(h, a) {
                h.startVector(4, a.length, 4);
                for (let b = a.length - 1; b >= 0; b--) h.addFloat32(a[b]);
                return h.endVector();
              }
              static startFloatsVector(h, a) {
                h.startVector(4, a, 4);
              }
              static addInts(h, a) {
                h.addFieldOffset(9, a, 0);
              }
              static createIntsVector(h, a) {
                h.startVector(8, a.length, 8);
                for (let b = a.length - 1; b >= 0; b--) h.addInt64(a[b]);
                return h.endVector();
              }
              static startIntsVector(h, a) {
                h.startVector(8, a, 8);
              }
              static addStrings(h, a) {
                h.addFieldOffset(10, a, 0);
              }
              static createStringsVector(h, a) {
                h.startVector(4, a.length, 4);
                for (let b = a.length - 1; b >= 0; b--) h.addOffset(a[b]);
                return h.endVector();
              }
              static startStringsVector(h, a) {
                h.startVector(4, a, 4);
              }
              static addTensors(h, a) {
                h.addFieldOffset(11, a, 0);
              }
              static createTensorsVector(h, a) {
                h.startVector(4, a.length, 4);
                for (let b = a.length - 1; b >= 0; b--) h.addOffset(a[b]);
                return h.endVector();
              }
              static startTensorsVector(h, a) {
                h.startVector(4, a, 4);
              }
              static addGraphs(h, a) {
                h.addFieldOffset(12, a, 0);
              }
              static createGraphsVector(h, a) {
                h.startVector(4, a.length, 4);
                for (let b = a.length - 1; b >= 0; b--) h.addOffset(a[b]);
                return h.endVector();
              }
              static startGraphsVector(h, a) {
                h.startVector(4, a, 4);
              }
              static endAttribute(h) {
                return h.endObject();
              }
              static createAttribute(h, a, b, w, k, A, M, $, O, C, P, I, N, R) {
                return x.startAttribute(h), x.addName(h, a), x.addDocString(h, b), x.addType(h, w), x.addF(h, k), x.addI(h, A), x.addS(h, M), x.addT(h, $), x.addG(h, O), x.addFloats(h, C), x.addInts(h, P), x.addStrings(h, I), x.addTensors(h, N), x.addGraphs(h, R), x.endAttribute(h);
              }
            }
            E.Attribute = x;
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            class x {
              constructor() {
                this.bb = null, this.bb_pos = 0;
              }
              __init(h, a) {
                return this.bb_pos = h, this.bb = a, this;
              }
              static getRootAsGraph(h, a) {
                return (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              static getSizePrefixedRootAsGraph(h, a) {
                return h.setPosition(h.position() + o.flatbuffers.SIZE_PREFIX_LENGTH), (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              initializers(h, a) {
                let b = this.bb.__offset(this.bb_pos, 4);
                return b ? (a || new g.experimental.fbs.Tensor()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + b) + 4 * h), this.bb) : null;
              }
              initializersLength() {
                let h = this.bb.__offset(this.bb_pos, 4);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              nodeArgs(h, a) {
                let b = this.bb.__offset(this.bb_pos, 6);
                return b ? (a || new g.experimental.fbs.ValueInfo()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + b) + 4 * h), this.bb) : null;
              }
              nodeArgsLength() {
                let h = this.bb.__offset(this.bb_pos, 6);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              nodes(h, a) {
                let b = this.bb.__offset(this.bb_pos, 8);
                return b ? (a || new g.experimental.fbs.Node()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + b) + 4 * h), this.bb) : null;
              }
              nodesLength() {
                let h = this.bb.__offset(this.bb_pos, 8);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              maxNodeIndex() {
                let h = this.bb.__offset(this.bb_pos, 10);
                return h ? this.bb.readUint32(this.bb_pos + h) : 0;
              }
              nodeEdges(h, a) {
                let b = this.bb.__offset(this.bb_pos, 12);
                return b ? (a || new g.experimental.fbs.NodeEdge()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + b) + 4 * h), this.bb) : null;
              }
              nodeEdgesLength() {
                let h = this.bb.__offset(this.bb_pos, 12);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              inputs(h, a) {
                let b = this.bb.__offset(this.bb_pos, 14);
                return b ? this.bb.__string(this.bb.__vector(this.bb_pos + b) + 4 * h, a) : null;
              }
              inputsLength() {
                let h = this.bb.__offset(this.bb_pos, 14);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              outputs(h, a) {
                let b = this.bb.__offset(this.bb_pos, 16);
                return b ? this.bb.__string(this.bb.__vector(this.bb_pos + b) + 4 * h, a) : null;
              }
              outputsLength() {
                let h = this.bb.__offset(this.bb_pos, 16);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              sparseInitializers(h, a) {
                let b = this.bb.__offset(this.bb_pos, 18);
                return b ? (a || new g.experimental.fbs.SparseTensor()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + b) + 4 * h), this.bb) : null;
              }
              sparseInitializersLength() {
                let h = this.bb.__offset(this.bb_pos, 18);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              static startGraph(h) {
                h.startObject(8);
              }
              static addInitializers(h, a) {
                h.addFieldOffset(0, a, 0);
              }
              static createInitializersVector(h, a) {
                h.startVector(4, a.length, 4);
                for (let b = a.length - 1; b >= 0; b--) h.addOffset(a[b]);
                return h.endVector();
              }
              static startInitializersVector(h, a) {
                h.startVector(4, a, 4);
              }
              static addNodeArgs(h, a) {
                h.addFieldOffset(1, a, 0);
              }
              static createNodeArgsVector(h, a) {
                h.startVector(4, a.length, 4);
                for (let b = a.length - 1; b >= 0; b--) h.addOffset(a[b]);
                return h.endVector();
              }
              static startNodeArgsVector(h, a) {
                h.startVector(4, a, 4);
              }
              static addNodes(h, a) {
                h.addFieldOffset(2, a, 0);
              }
              static createNodesVector(h, a) {
                h.startVector(4, a.length, 4);
                for (let b = a.length - 1; b >= 0; b--) h.addOffset(a[b]);
                return h.endVector();
              }
              static startNodesVector(h, a) {
                h.startVector(4, a, 4);
              }
              static addMaxNodeIndex(h, a) {
                h.addFieldInt32(3, a, 0);
              }
              static addNodeEdges(h, a) {
                h.addFieldOffset(4, a, 0);
              }
              static createNodeEdgesVector(h, a) {
                h.startVector(4, a.length, 4);
                for (let b = a.length - 1; b >= 0; b--) h.addOffset(a[b]);
                return h.endVector();
              }
              static startNodeEdgesVector(h, a) {
                h.startVector(4, a, 4);
              }
              static addInputs(h, a) {
                h.addFieldOffset(5, a, 0);
              }
              static createInputsVector(h, a) {
                h.startVector(4, a.length, 4);
                for (let b = a.length - 1; b >= 0; b--) h.addOffset(a[b]);
                return h.endVector();
              }
              static startInputsVector(h, a) {
                h.startVector(4, a, 4);
              }
              static addOutputs(h, a) {
                h.addFieldOffset(6, a, 0);
              }
              static createOutputsVector(h, a) {
                h.startVector(4, a.length, 4);
                for (let b = a.length - 1; b >= 0; b--) h.addOffset(a[b]);
                return h.endVector();
              }
              static startOutputsVector(h, a) {
                h.startVector(4, a, 4);
              }
              static addSparseInitializers(h, a) {
                h.addFieldOffset(7, a, 0);
              }
              static createSparseInitializersVector(h, a) {
                h.startVector(4, a.length, 4);
                for (let b = a.length - 1; b >= 0; b--) h.addOffset(a[b]);
                return h.endVector();
              }
              static startSparseInitializersVector(h, a) {
                h.startVector(4, a, 4);
              }
              static endGraph(h) {
                return h.endObject();
              }
              static createGraph(h, a, b, w, k, A, M, $, O) {
                return x.startGraph(h), x.addInitializers(h, a), x.addNodeArgs(h, b), x.addNodes(h, w), x.addMaxNodeIndex(h, k), x.addNodeEdges(h, A), x.addInputs(h, M), x.addOutputs(h, $), x.addSparseInitializers(h, O), x.endGraph(h);
              }
            }
            E.Graph = x;
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            class x {
              constructor() {
                this.bb = null, this.bb_pos = 0;
              }
              __init(h, a) {
                return this.bb_pos = h, this.bb = a, this;
              }
              static getRootAsModel(h, a) {
                return (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              static getSizePrefixedRootAsModel(h, a) {
                return h.setPosition(h.position() + o.flatbuffers.SIZE_PREFIX_LENGTH), (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              irVersion() {
                let h = this.bb.__offset(this.bb_pos, 4);
                return h ? this.bb.readInt64(this.bb_pos + h) : this.bb.createLong(0, 0);
              }
              opsetImport(h, a) {
                let b = this.bb.__offset(this.bb_pos, 6);
                return b ? (a || new g.experimental.fbs.OperatorSetId()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + b) + 4 * h), this.bb) : null;
              }
              opsetImportLength() {
                let h = this.bb.__offset(this.bb_pos, 6);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              producerName(h) {
                let a = this.bb.__offset(this.bb_pos, 8);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              producerVersion(h) {
                let a = this.bb.__offset(this.bb_pos, 10);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              domain(h) {
                let a = this.bb.__offset(this.bb_pos, 12);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              modelVersion() {
                let h = this.bb.__offset(this.bb_pos, 14);
                return h ? this.bb.readInt64(this.bb_pos + h) : this.bb.createLong(0, 0);
              }
              docString(h) {
                let a = this.bb.__offset(this.bb_pos, 16);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              graph(h) {
                let a = this.bb.__offset(this.bb_pos, 18);
                return a ? (h || new g.experimental.fbs.Graph()).__init(this.bb.__indirect(this.bb_pos + a), this.bb) : null;
              }
              graphDocString(h) {
                let a = this.bb.__offset(this.bb_pos, 20);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              static startModel(h) {
                h.startObject(9);
              }
              static addIrVersion(h, a) {
                h.addFieldInt64(0, a, h.createLong(0, 0));
              }
              static addOpsetImport(h, a) {
                h.addFieldOffset(1, a, 0);
              }
              static createOpsetImportVector(h, a) {
                h.startVector(4, a.length, 4);
                for (let b = a.length - 1; b >= 0; b--) h.addOffset(a[b]);
                return h.endVector();
              }
              static startOpsetImportVector(h, a) {
                h.startVector(4, a, 4);
              }
              static addProducerName(h, a) {
                h.addFieldOffset(2, a, 0);
              }
              static addProducerVersion(h, a) {
                h.addFieldOffset(3, a, 0);
              }
              static addDomain(h, a) {
                h.addFieldOffset(4, a, 0);
              }
              static addModelVersion(h, a) {
                h.addFieldInt64(5, a, h.createLong(0, 0));
              }
              static addDocString(h, a) {
                h.addFieldOffset(6, a, 0);
              }
              static addGraph(h, a) {
                h.addFieldOffset(7, a, 0);
              }
              static addGraphDocString(h, a) {
                h.addFieldOffset(8, a, 0);
              }
              static endModel(h) {
                return h.endObject();
              }
              static createModel(h, a, b, w, k, A, M, $, O, C) {
                return x.startModel(h), x.addIrVersion(h, a), x.addOpsetImport(h, b), x.addProducerName(h, w), x.addProducerVersion(h, k), x.addDomain(h, A), x.addModelVersion(h, M), x.addDocString(h, $), x.addGraph(h, O), x.addGraphDocString(h, C), x.endModel(h);
              }
            }
            E.Model = x;
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            class x {
              constructor() {
                this.bb = null, this.bb_pos = 0;
              }
              __init(h, a) {
                return this.bb_pos = h, this.bb = a, this;
              }
              static getRootAsKernelCreateInfos(h, a) {
                return (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              static getSizePrefixedRootAsKernelCreateInfos(h, a) {
                return h.setPosition(h.position() + o.flatbuffers.SIZE_PREFIX_LENGTH), (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              nodeIndices(h) {
                let a = this.bb.__offset(this.bb_pos, 4);
                return a ? this.bb.readUint32(this.bb.__vector(this.bb_pos + a) + 4 * h) : 0;
              }
              nodeIndicesLength() {
                let h = this.bb.__offset(this.bb_pos, 4);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              nodeIndicesArray() {
                let h = this.bb.__offset(this.bb_pos, 4);
                return h ? new Uint32Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + h), this.bb.__vector_len(this.bb_pos + h)) : null;
              }
              kernelDefHashes(h) {
                let a = this.bb.__offset(this.bb_pos, 6);
                return a ? this.bb.readUint64(this.bb.__vector(this.bb_pos + a) + 8 * h) : this.bb.createLong(0, 0);
              }
              kernelDefHashesLength() {
                let h = this.bb.__offset(this.bb_pos, 6);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              static startKernelCreateInfos(h) {
                h.startObject(2);
              }
              static addNodeIndices(h, a) {
                h.addFieldOffset(0, a, 0);
              }
              static createNodeIndicesVector(h, a) {
                h.startVector(4, a.length, 4);
                for (let b = a.length - 1; b >= 0; b--) h.addInt32(a[b]);
                return h.endVector();
              }
              static startNodeIndicesVector(h, a) {
                h.startVector(4, a, 4);
              }
              static addKernelDefHashes(h, a) {
                h.addFieldOffset(1, a, 0);
              }
              static createKernelDefHashesVector(h, a) {
                h.startVector(8, a.length, 8);
                for (let b = a.length - 1; b >= 0; b--) h.addInt64(a[b]);
                return h.endVector();
              }
              static startKernelDefHashesVector(h, a) {
                h.startVector(8, a, 8);
              }
              static endKernelCreateInfos(h) {
                return h.endObject();
              }
              static createKernelCreateInfos(h, a, b) {
                return x.startKernelCreateInfos(h), x.addNodeIndices(h, a), x.addKernelDefHashes(h, b), x.endKernelCreateInfos(h);
              }
            }
            E.KernelCreateInfos = x;
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            class x {
              constructor() {
                this.bb = null, this.bb_pos = 0;
              }
              __init(h, a) {
                return this.bb_pos = h, this.bb = a, this;
              }
              static getRootAsSubGraphSessionState(h, a) {
                return (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              static getSizePrefixedRootAsSubGraphSessionState(h, a) {
                return h.setPosition(h.position() + o.flatbuffers.SIZE_PREFIX_LENGTH), (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              graphId(h) {
                let a = this.bb.__offset(this.bb_pos, 4);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              sessionState(h) {
                let a = this.bb.__offset(this.bb_pos, 6);
                return a ? (h || new g.experimental.fbs.SessionState()).__init(this.bb.__indirect(this.bb_pos + a), this.bb) : null;
              }
              static startSubGraphSessionState(h) {
                h.startObject(2);
              }
              static addGraphId(h, a) {
                h.addFieldOffset(0, a, 0);
              }
              static addSessionState(h, a) {
                h.addFieldOffset(1, a, 0);
              }
              static endSubGraphSessionState(h) {
                let a = h.endObject();
                return h.requiredField(a, 4), a;
              }
              static createSubGraphSessionState(h, a, b) {
                return x.startSubGraphSessionState(h), x.addGraphId(h, a), x.addSessionState(h, b), x.endSubGraphSessionState(h);
              }
            }
            E.SubGraphSessionState = x;
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            class x {
              constructor() {
                this.bb = null, this.bb_pos = 0;
              }
              __init(h, a) {
                return this.bb_pos = h, this.bb = a, this;
              }
              static getRootAsSessionState(h, a) {
                return (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              static getSizePrefixedRootAsSessionState(h, a) {
                return h.setPosition(h.position() + o.flatbuffers.SIZE_PREFIX_LENGTH), (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              kernels(h) {
                let a = this.bb.__offset(this.bb_pos, 4);
                return a ? (h || new g.experimental.fbs.KernelCreateInfos()).__init(this.bb.__indirect(this.bb_pos + a), this.bb) : null;
              }
              subGraphSessionStates(h, a) {
                let b = this.bb.__offset(this.bb_pos, 6);
                return b ? (a || new g.experimental.fbs.SubGraphSessionState()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + b) + 4 * h), this.bb) : null;
              }
              subGraphSessionStatesLength() {
                let h = this.bb.__offset(this.bb_pos, 6);
                return h ? this.bb.__vector_len(this.bb_pos + h) : 0;
              }
              static startSessionState(h) {
                h.startObject(2);
              }
              static addKernels(h, a) {
                h.addFieldOffset(0, a, 0);
              }
              static addSubGraphSessionStates(h, a) {
                h.addFieldOffset(1, a, 0);
              }
              static createSubGraphSessionStatesVector(h, a) {
                h.startVector(4, a.length, 4);
                for (let b = a.length - 1; b >= 0; b--) h.addOffset(a[b]);
                return h.endVector();
              }
              static startSubGraphSessionStatesVector(h, a) {
                h.startVector(4, a, 4);
              }
              static endSessionState(h) {
                return h.endObject();
              }
              static createSessionState(h, a, b) {
                return x.startSessionState(h), x.addKernels(h, a), x.addSubGraphSessionStates(h, b), x.endSessionState(h);
              }
            }
            E.SessionState = x;
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {})), function(g) {
        (function(y) {
          (function(E) {
            class x {
              constructor() {
                this.bb = null, this.bb_pos = 0;
              }
              __init(h, a) {
                return this.bb_pos = h, this.bb = a, this;
              }
              static getRootAsInferenceSession(h, a) {
                return (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              static getSizePrefixedRootAsInferenceSession(h, a) {
                return h.setPosition(h.position() + o.flatbuffers.SIZE_PREFIX_LENGTH), (a || new x()).__init(h.readInt32(h.position()) + h.position(), h);
              }
              static bufferHasIdentifier(h) {
                return h.__has_identifier("ORTM");
              }
              ortVersion(h) {
                let a = this.bb.__offset(this.bb_pos, 4);
                return a ? this.bb.__string(this.bb_pos + a, h) : null;
              }
              model(h) {
                let a = this.bb.__offset(this.bb_pos, 6);
                return a ? (h || new g.experimental.fbs.Model()).__init(this.bb.__indirect(this.bb_pos + a), this.bb) : null;
              }
              sessionState(h) {
                let a = this.bb.__offset(this.bb_pos, 8);
                return a ? (h || new g.experimental.fbs.SessionState()).__init(this.bb.__indirect(this.bb_pos + a), this.bb) : null;
              }
              static startInferenceSession(h) {
                h.startObject(3);
              }
              static addOrtVersion(h, a) {
                h.addFieldOffset(0, a, 0);
              }
              static addModel(h, a) {
                h.addFieldOffset(1, a, 0);
              }
              static addSessionState(h, a) {
                h.addFieldOffset(2, a, 0);
              }
              static endInferenceSession(h) {
                return h.endObject();
              }
              static finishInferenceSessionBuffer(h, a) {
                h.finish(a, "ORTM");
              }
              static finishSizePrefixedInferenceSessionBuffer(h, a) {
                h.finish(a, "ORTM", !0);
              }
              static createInferenceSession(h, a, b, w) {
                return x.startInferenceSession(h), x.addOrtVersion(h, a), x.addModel(h, b), x.addSessionState(h, w), x.endInferenceSession(h);
              }
            }
            E.InferenceSession = x;
          })(y.fbs || (y.fbs = {}));
        })(g.experimental || (g.experimental = {}));
      }(e.onnxruntime || (e.onnxruntime = {}));
    }, 7448: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.OnnxjsSessionHandler = void 0;
      const o = r(1670), m = r(9162);
      e.OnnxjsSessionHandler = class {
        constructor(_) {
          this.session = _, this.inputNames = this.session.inputNames, this.outputNames = this.session.outputNames;
        }
        async dispose() {
        }
        async run(_, g, y) {
          const E = /* @__PURE__ */ new Map();
          for (const h in _) if (Object.hasOwnProperty.call(_, h)) {
            const a = _[h];
            E.set(h, new m.Tensor(a.dims, a.type, void 0, void 0, a.data));
          }
          const x = await this.session.run(E), v = {};
          return x.forEach((h, a) => {
            v[a] = new o.Tensor(h.type, h.data, h.dims);
          }), v;
        }
        startProfiling() {
          this.session.startProfiling();
        }
        endProfiling() {
          this.session.endProfiling();
        }
      };
    }, 6919: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.Session = void 0;
      const o = r(7067), m = r(1296), _ = r(7091), g = r(1036), y = r(6231), E = r(2644);
      e.Session = class {
        constructor(x = {}) {
          this._initialized = !1, this.backendHint = x.backendHint, this.profiler = y.Profiler.create(x.profiler), this.context = { profiler: this.profiler, graphInputTypes: [], graphInputDims: [] };
        }
        get inputNames() {
          return this._model.graph.getInputNames();
        }
        get outputNames() {
          return this._model.graph.getOutputNames();
        }
        startProfiling() {
          this.profiler.start();
        }
        endProfiling() {
          this.profiler.stop();
        }
        async loadModel(x, v, h) {
          await this.profiler.event("session", "Session.loadModel", async () => {
            const a = await (0, _.resolveBackend)(this.backendHint);
            if (this.sessionHandler = a.createSessionHandler(this.context), this._model = new E.Model(), typeof x == "string") {
              const b = x.endsWith(".ort");
              if (typeof fetch > "u") {
                const w = await (0, m.promisify)(o.readFile)(x);
                this.initialize(w, b);
              } else {
                const w = await fetch(x), k = await w.arrayBuffer();
                this.initialize(new Uint8Array(k), b);
              }
            } else if (ArrayBuffer.isView(x)) this.initialize(x);
            else {
              const b = new Uint8Array(x, v || 0, h || x.byteLength);
              this.initialize(b);
            }
          });
        }
        initialize(x, v) {
          if (this._initialized) throw new Error("already initialized");
          this.profiler.event("session", "Session.initialize", () => {
            const h = this.sessionHandler.transformGraph ? this.sessionHandler : void 0;
            this._model.load(x, h, v), this.sessionHandler.onGraphInitialized && this.sessionHandler.onGraphInitialized(this._model.graph), this.initializeOps(this._model.graph), this._executionPlan = new g.ExecutionPlan(this._model.graph, this._ops, this.profiler);
          }), this._initialized = !0;
        }
        async run(x) {
          if (!this._initialized) throw new Error("session not initialized yet");
          return this.profiler.event("session", "Session.run", async () => {
            const v = this.normalizeAndValidateInputs(x), h = await this._executionPlan.execute(this.sessionHandler, v);
            return this.createOutput(h);
          });
        }
        normalizeAndValidateInputs(x) {
          const v = this._model.graph.getInputNames();
          if (Array.isArray(x)) {
            if (x.length !== v.length) throw new Error(`incorrect input array length: expected ${v.length} but got ${x.length}`);
          } else {
            if (x.size !== v.length) throw new Error(`incorrect input map size: expected ${v.length} but got ${x.size}`);
            const h = new Array(x.size);
            let a = 0;
            for (let b = 0; b < v.length; ++b) {
              const w = x.get(v[b]);
              if (!w) throw new Error(`missing input tensor for: '${name}'`);
              h[a++] = w;
            }
            x = h;
          }
          if (this.context.graphInputTypes && this.context.graphInputTypes.length !== 0 && this.context.graphInputDims && this.context.graphInputDims.length !== 0) this.validateInputTensorDims(this.context.graphInputDims, x, !1);
          else {
            const h = this._model.graph.getInputIndices(), a = this._model.graph.getValues(), b = new Array(h.length);
            for (let w = 0; w < h.length; ++w) {
              const k = a[h[w]];
              b[w] = k.type.shape.dims, this.context.graphInputTypes.push(k.type.tensorType), this.context.graphInputDims.push(x[w].dims);
            }
            this.validateInputTensorDims(b, x, !0);
          }
          return this.validateInputTensorTypes(this.context.graphInputTypes, x), x;
        }
        validateInputTensorTypes(x, v) {
          for (let h = 0; h < v.length; h++) {
            const a = x[h], b = v[h].type;
            if (a !== b) throw new Error(`input tensor[${h}] check failed: expected type '${a}' but got ${b}`);
          }
        }
        validateInputTensorDims(x, v, h) {
          for (let a = 0; a < v.length; a++) {
            const b = x[a], w = v[a].dims;
            if (!this.compareTensorDims(b, w, h)) throw new Error(`input tensor[${a}] check failed: expected shape '[${b.join(",")}]' but got [${w.join(",")}]`);
          }
        }
        compareTensorDims(x, v, h) {
          if (x.length !== v.length) return !1;
          for (let a = 0; a < x.length; ++a) if (x[a] !== v[a] && (!h || x[a] !== 0)) return !1;
          return !0;
        }
        createOutput(x) {
          const v = this._model.graph.getOutputNames();
          if (x.length !== v.length) throw new Error("expected number of outputs do not match number of generated outputs");
          const h = /* @__PURE__ */ new Map();
          for (let a = 0; a < v.length; ++a) h.set(v[a], x[a]);
          return h;
        }
        initializeOps(x) {
          const v = x.getNodes();
          this._ops = new Array(v.length);
          for (let h = 0; h < v.length; h++) this._ops[h] = this.sessionHandler.resolve(v[h], this._model.opsets, x);
        }
      };
    }, 9162: function(s, e, r) {
      var o = this && this.__importDefault || function(k) {
        return k && k.__esModule ? k : { default: k };
      };
      Object.defineProperty(e, "__esModule", { value: !0 }), e.Tensor = void 0;
      const m = r(3442), _ = o(r(3720)), g = r(1446), y = r(9395), E = r(2517);
      var x = y.onnxruntime.experimental.fbs;
      class v {
        get data() {
          if (this.cache === void 0) {
            const A = this.dataProvider(this.dataId);
            if (A.length !== this.size) throw new Error("Length of data provided by the Data Provider is inconsistent with the dims of this Tensor.");
            this.cache = A;
          }
          return this.cache;
        }
        get stringData() {
          if (this.type !== "string") throw new TypeError("data type is not string");
          return this.data;
        }
        get integerData() {
          switch (this.type) {
            case "uint8":
            case "int8":
            case "uint16":
            case "int16":
            case "int32":
            case "uint32":
            case "bool":
              return this.data;
            default:
              throw new TypeError("data type is not integer (uint8, int8, uint16, int16, int32, uint32, bool)");
          }
        }
        get floatData() {
          switch (this.type) {
            case "float32":
            case "float64":
              return this.data;
            default:
              throw new TypeError("data type is not float (float32, float64)");
          }
        }
        get numberData() {
          if (this.type !== "string") return this.data;
          throw new TypeError("type cannot be non-number (string)");
        }
        get(A) {
          return this.data[E.ShapeUtil.indicesToOffset(A, this.strides)];
        }
        set(A, M) {
          this.data[E.ShapeUtil.indicesToOffset(A, this.strides)] = M;
        }
        async getData() {
          return this.cache === void 0 && (this.cache = await this.asyncDataProvider(this.dataId)), this.cache;
        }
        get strides() {
          return this._strides || (this._strides = E.ShapeUtil.computeStrides(this.dims)), this._strides;
        }
        constructor(A, M, $, O, C, P = m.Guid.create()) {
          this.dims = A, this.type = M, this.dataProvider = $, this.asyncDataProvider = O, this.cache = C, this.dataId = P, this.size = E.ShapeUtil.validateDimsAndCalcSize(A);
          const I = this.size, N = $ === void 0 && O === void 0 && C === void 0;
          if (C !== void 0 && C.length !== I) throw new RangeError("Input dims doesn't match data length.");
          if (M === "string") {
            if (!(C === void 0 || Array.isArray(C) && C.every((R) => typeof R == "string"))) throw new TypeError("cache should be a string array");
            N && (this.cache = new Array(I));
          } else {
            if (C !== void 0) {
              const R = a(M);
              if (!(C instanceof R)) throw new TypeError(`cache should be type ${R.name}`);
            }
            if (N) {
              const R = new ArrayBuffer(I * function(F) {
                switch (F) {
                  case "bool":
                  case "int8":
                  case "uint8":
                    return 1;
                  case "int16":
                  case "uint16":
                    return 2;
                  case "int32":
                  case "uint32":
                  case "float32":
                    return 4;
                  case "float64":
                    return 8;
                  default:
                    throw new Error(`cannot calculate sizeof() on type ${F}`);
                }
              }(M));
              this.cache = function(F, B) {
                return new (a(B))(F);
              }(R, M);
            }
          }
        }
        static fromProto(A) {
          if (!A) throw new Error("cannot construct Value from an empty tensor");
          const M = E.ProtoUtil.tensorDataTypeFromProto(A.dataType), $ = E.ProtoUtil.tensorDimsFromProto(A.dims), O = new v($, M);
          if (M === "string") A.stringData.forEach((C, P) => {
            O.data[P] = (0, E.decodeUtf8String)(C);
          });
          else if (A.rawData && typeof A.rawData.byteLength == "number" && A.rawData.byteLength > 0) {
            const C = O.data, P = new DataView(A.rawData.buffer, A.rawData.byteOffset, A.rawData.byteLength), I = h(A.dataType), N = A.rawData.byteLength / I;
            if (A.rawData.byteLength % I != 0) throw new Error("invalid buffer length");
            if (C.length !== N) throw new Error("buffer length mismatch");
            for (let R = 0; R < N; R++) {
              const F = w(P, A.dataType, R * I);
              C[R] = F;
            }
          } else {
            let C;
            switch (A.dataType) {
              case g.onnx.TensorProto.DataType.FLOAT:
                C = A.floatData;
                break;
              case g.onnx.TensorProto.DataType.INT32:
              case g.onnx.TensorProto.DataType.INT16:
              case g.onnx.TensorProto.DataType.UINT16:
              case g.onnx.TensorProto.DataType.INT8:
              case g.onnx.TensorProto.DataType.UINT8:
              case g.onnx.TensorProto.DataType.BOOL:
                C = A.int32Data;
                break;
              case g.onnx.TensorProto.DataType.INT64:
                C = A.int64Data;
                break;
              case g.onnx.TensorProto.DataType.DOUBLE:
                C = A.doubleData;
                break;
              case g.onnx.TensorProto.DataType.UINT32:
              case g.onnx.TensorProto.DataType.UINT64:
                C = A.uint64Data;
                break;
              default:
                throw new Error("unspecific error");
            }
            if (C == null) throw new Error("failed to populate data from a tensorproto value");
            const P = O.data;
            if (P.length !== C.length) throw new Error("array length mismatch");
            for (let I = 0; I < C.length; I++) {
              const N = C[I];
              _.default.isLong(N) ? P[I] = b(N, A.dataType) : P[I] = N;
            }
          }
          return O;
        }
        static fromData(A, M, $) {
          return new v(M, $, void 0, void 0, A);
        }
        static fromOrtTensor(A) {
          if (!A) throw new Error("cannot construct Value from an empty tensor");
          const M = E.ProtoUtil.tensorDimsFromORTFormat(A), $ = E.ProtoUtil.tensorDataTypeFromProto(A.dataType()), O = new v(M, $);
          if ($ === "string") for (let C = 0; C < A.stringDataLength(); C++) O.data[C] = A.stringData(C);
          else if (A.rawDataArray() && typeof A.rawDataLength() == "number" && A.rawDataLength() > 0) {
            const C = O.data, P = new DataView(A.rawDataArray().buffer, A.rawDataArray().byteOffset, A.rawDataLength()), I = h(A.dataType()), N = A.rawDataLength() / I;
            if (A.rawDataLength() % I != 0) throw new Error("invalid buffer length");
            if (C.length !== N) throw new Error("buffer length mismatch");
            for (let R = 0; R < N; R++) {
              const F = w(P, A.dataType(), R * I);
              C[R] = F;
            }
          }
          return O;
        }
      }
      function h(k) {
        switch (k) {
          case g.onnx.TensorProto.DataType.UINT8:
          case g.onnx.TensorProto.DataType.INT8:
          case g.onnx.TensorProto.DataType.BOOL:
            return 1;
          case g.onnx.TensorProto.DataType.UINT16:
          case g.onnx.TensorProto.DataType.INT16:
            return 2;
          case g.onnx.TensorProto.DataType.FLOAT:
          case g.onnx.TensorProto.DataType.INT32:
          case g.onnx.TensorProto.DataType.UINT32:
            return 4;
          case g.onnx.TensorProto.DataType.INT64:
          case g.onnx.TensorProto.DataType.DOUBLE:
          case g.onnx.TensorProto.DataType.UINT64:
            return 8;
          default:
            throw new Error(`cannot calculate sizeof() on type ${g.onnx.TensorProto.DataType[k]}`);
        }
      }
      function a(k) {
        switch (k) {
          case "bool":
          case "uint8":
            return Uint8Array;
          case "int8":
            return Int8Array;
          case "int16":
            return Int16Array;
          case "uint16":
            return Uint16Array;
          case "int32":
            return Int32Array;
          case "uint32":
            return Uint32Array;
          case "float32":
            return Float32Array;
          case "float64":
            return Float64Array;
          default:
            throw new Error("unspecified error");
        }
      }
      function b(k, A) {
        if (A === g.onnx.TensorProto.DataType.INT64 || A === x.TensorDataType.INT64) {
          if (k.greaterThanOrEqual(2147483648) || k.lessThan(-2147483648)) throw new TypeError("int64 is not supported");
        } else {
          if (A !== g.onnx.TensorProto.DataType.UINT32 && A !== x.TensorDataType.UINT32 && A !== g.onnx.TensorProto.DataType.UINT64 && A !== x.TensorDataType.UINT64) throw new TypeError(`not a LONG type: ${g.onnx.TensorProto.DataType[A]}`);
          if (k.greaterThanOrEqual(4294967296) || k.lessThan(0)) throw new TypeError("uint64 is not supported");
        }
        return k.toNumber();
      }
      function w(k, A, M) {
        switch (A) {
          case g.onnx.TensorProto.DataType.BOOL:
          case g.onnx.TensorProto.DataType.UINT8:
            return k.getUint8(M);
          case g.onnx.TensorProto.DataType.INT8:
            return k.getInt8(M);
          case g.onnx.TensorProto.DataType.UINT16:
            return k.getUint16(M, !0);
          case g.onnx.TensorProto.DataType.INT16:
            return k.getInt16(M, !0);
          case g.onnx.TensorProto.DataType.FLOAT:
            return k.getFloat32(M, !0);
          case g.onnx.TensorProto.DataType.INT32:
            return k.getInt32(M, !0);
          case g.onnx.TensorProto.DataType.UINT32:
            return k.getUint32(M, !0);
          case g.onnx.TensorProto.DataType.INT64:
            return b(_.default.fromBits(k.getUint32(M, !0), k.getUint32(M + 4, !0), !1), A);
          case g.onnx.TensorProto.DataType.DOUBLE:
            return k.getFloat64(M, !0);
          case g.onnx.TensorProto.DataType.UINT64:
            return b(_.default.fromBits(k.getUint32(M, !0), k.getUint32(M + 4, !0), !0), A);
          default:
            throw new Error(`cannot read from DataView for type ${g.onnx.TensorProto.DataType[A]}`);
        }
      }
      e.Tensor = v;
    }, 2517: function(s, e, r) {
      var o = this && this.__importDefault || function(A) {
        return A && A.__esModule ? A : { default: A };
      };
      Object.defineProperty(e, "__esModule", { value: !0 }), e.decodeUtf8String = e.MAX_CLIP = e.MIN_CLIP = e.PoolConvUtil = e.ReduceUtil = e.SplitUtil = e.MathUtil = e.ShapeUtil = e.LongUtil = e.ProtoUtil = e.GemmUtil = e.arrayCopyHelper = e.BroadcastUtil = e.MatMulUtil = e.ArrayUtil = e.assert = e.checkInputsShape = void 0;
      const m = r(5686), _ = o(r(3720)), g = r(1446), y = r(9162);
      e.checkInputsShape = function(A, ...M) {
        if (!A || A.length !== M.length) return !1;
        for (let $ = 0; $ < A.length; $++) if (!A[$].dims || A[$].dims.length !== M[$]) return !1;
        return !0;
      }, e.assert = function(A, M) {
        if (!A) throw new Error(typeof M == "string" ? M : M());
      }, e.ArrayUtil = class {
        static arraysEqual(A, M) {
          if (A.length !== M.length) return !1;
          for (let $ = 0; $ < A.length; $++) if (A[$] !== M[$]) return !1;
          return !0;
        }
      };
      class E {
        static preprocessInputShapes(M, $) {
          return [M.length === 1 ? [1, M[0]] : M, $.length === 1 ? [$[0], 1] : $];
        }
        static postprocessOutputShape(M, $, O) {
          $ === 1 && M.splice(M.length - 2, 1), O === 1 && M.pop();
        }
        static calcMatMulShape(M, $) {
          return M[1] !== $[0] ? void 0 : [M[0], $[1]];
        }
      }
      e.MatMulUtil = E;
      class x {
        static calcShape(M, $, O = !1) {
          const C = M.length, P = $.length;
          if (C === 0) return $;
          if (P === 0) return M;
          const I = Math.max(M.length, $.length), N = new Array(I);
          if (O) {
            if (C < 2 || P < 2) return;
            const R = E.calcMatMulShape([M[C - 2], M[C - 1]], [$[P - 2], $[P - 1]]);
            if (R === void 0) return;
            [N[I - 2], N[I - 1]] = R;
          }
          for (let R = O ? 3 : 1; R <= I; R++) {
            const F = C - R < 0 ? 1 : M[C - R], B = P - R < 0 ? 1 : $[P - R];
            if (F !== B && F > 1 && B > 1) return;
            N[I - R] = Math.max(F, B);
          }
          return N;
        }
        static index(M, $) {
          const O = new Array($.length);
          return x.fillIndex(M, $, O), O;
        }
        static fillIndex(M, $, O) {
          const C = M.length - $.length;
          for (let P = 0; P < $.length; P++) O[P] = M[C + P] % $[P];
        }
        static calc(M, $, O, C, P) {
          const I = x.calcShape(M.dims, $.dims);
          if (I) {
            if (C && !a.areEqual(I, M.dims)) return;
            const N = a.size(I), R = C ? M : new y.Tensor(I, P || M.type);
            if (I.length === 0) R.set([], O(M.get([]), $.get([])));
            else {
              const F = new Array(I.length), B = new Array(M.dims.length), G = new Array($.dims.length);
              let Q, ee = 0, Y = 0, W = !1, j = !1;
              M.dims.length === 0 && (ee = M.get([]), W = !0), $.dims.length === 0 && (Y = $.get([]), j = !0);
              for (let J = 0; J < N; J++) {
                Q = J;
                for (let me = I.length - 1; me >= 0; me--) F[me] = Q % I[me], Q = Math.floor(Q / I[me]);
                W || (x.fillIndex(F, M.dims, B), ee = M.get(B)), j || (x.fillIndex(F, $.dims, G), Y = $.get(G)), R.set(F, O(ee, Y));
              }
            }
            return R;
          }
        }
        static isValidBroadcast(M, $) {
          const O = M.length, C = $.length;
          if (O > C) return !1;
          for (let P = 1; P <= O; P++) if (M[O - P] !== 1 && M[O - P] !== $[C - P]) return !1;
          return !0;
        }
        static getBroadcastDims(M, $) {
          const O = M.length, C = [];
          for (let P = 0; P < O; P++) {
            const I = O - 1 - P, N = M[I] || 1;
            ($[$.length - 1 - P] || 1) > 1 && N === 1 && C.unshift(I);
          }
          return C;
        }
      }
      e.BroadcastUtil = x, e.arrayCopyHelper = function(A, M, $, O, C) {
        if (O < 0 || O >= M.length) throw new Error("sourceIndex out of bounds");
        if ($ < 0 || $ >= A.length) throw new Error("targetIndex out of bounds");
        if (O + C > M.length) throw new Error("source indices to be copied are outside bounds");
        if ($ + C > A.length) throw new Error("target array is too small to hold result");
        for (let P = 0; P < C; P++) A[$ + P] = M[O + P];
      }, e.GemmUtil = class {
        static getShapeOfGemmResult(A, M, $, O, C) {
          if (A.length !== 2 || $.length !== 2) throw new Error("shape need to be of size 2");
          let P, I, N;
          M ? (P = A[1], I = A[0]) : (P = A[0], I = A[1]);
          let R = -1;
          if (O ? (N = $[0], R = 1) : (N = $[1], R = 0), $[R] !== I) throw new Error("dimension mismatch");
          if (P <= 0 || N <= 0 || I <= 0) throw new Error("invalid shape specified");
          if (C && !x.isValidBroadcast(C, [P, N])) throw new Error("gemm: invalid bias shape for broadcast");
          return [P, N, I];
        }
      };
      class v {
        static tensorDataTypeFromProto(M) {
          switch (M) {
            case g.onnx.TensorProto.DataType.INT8:
              return "int8";
            case g.onnx.TensorProto.DataType.UINT8:
              return "uint8";
            case g.onnx.TensorProto.DataType.BOOL:
              return "bool";
            case g.onnx.TensorProto.DataType.INT16:
              return "int16";
            case g.onnx.TensorProto.DataType.UINT16:
              return "uint16";
            case g.onnx.TensorProto.DataType.INT32:
              return "int32";
            case g.onnx.TensorProto.DataType.UINT32:
              return "uint32";
            case g.onnx.TensorProto.DataType.FLOAT:
              return "float32";
            case g.onnx.TensorProto.DataType.DOUBLE:
              return "float64";
            case g.onnx.TensorProto.DataType.STRING:
              return "string";
            case g.onnx.TensorProto.DataType.INT64:
              return "int32";
            case g.onnx.TensorProto.DataType.UINT64:
              return "uint32";
            default:
              throw new Error(`unsupported data type: ${g.onnx.TensorProto.DataType[M]}`);
          }
        }
        static tensorDataTypeStringToEnum(M) {
          switch (M) {
            case "int8":
              return g.onnx.TensorProto.DataType.INT8;
            case "uint8":
              return g.onnx.TensorProto.DataType.UINT8;
            case "bool":
              return g.onnx.TensorProto.DataType.BOOL;
            case "int16":
              return g.onnx.TensorProto.DataType.INT16;
            case "uint16":
              return g.onnx.TensorProto.DataType.UINT16;
            case "int32":
              return g.onnx.TensorProto.DataType.INT32;
            case "uint32":
              return g.onnx.TensorProto.DataType.UINT32;
            case "float32":
              return g.onnx.TensorProto.DataType.FLOAT;
            case "float64":
              return g.onnx.TensorProto.DataType.DOUBLE;
            case "string":
              return g.onnx.TensorProto.DataType.STRING;
            case "int64":
              return g.onnx.TensorProto.DataType.INT64;
            case "uint64":
              return g.onnx.TensorProto.DataType.UINT64;
            default:
              throw new Error(`unsupported data type: ${M}`);
          }
        }
        static tensorDimsFromProto(M) {
          return M.map(($) => _.default.isLong($) ? $.toNumber() : $);
        }
        static tensorValueTypeFromProto(M) {
          return { tensorType: v.tensorDataTypeFromProto(M.elemType), shape: { dims: v.tensorDimsFromProto(M.shape.dim.map(($) => $.dimValue)) } };
        }
        static tensorDimsFromORTFormat(M) {
          const $ = [];
          for (let O = 0; O < M.dimsLength(); O++) $.push(h.longToNumber(M.dims(O)));
          return $;
        }
        static tensorAttributesFromORTFormat(M) {
          const $ = [];
          for (let O = 0; O < M.attributesLength(); O++) $.push(M.attributes(O));
          return $;
        }
      }
      e.ProtoUtil = v;
      class h {
        static longToNumber(M, $) {
          return _.default.isLong(M) ? M.toNumber() : M instanceof m.flatbuffers.Long ? _.default.fromValue({ low: M.low, high: M.high, unsigned: $ != null && $ }).toNumber() : M;
        }
        static isLong(M) {
          return _.default.isLong(M) || M instanceof m.flatbuffers.Long;
        }
      }
      e.LongUtil = h;
      class a {
        static size(M) {
          return a.getSizeFromDimensionRange(M, 0, M.length);
        }
        static sizeFromDimension(M, $) {
          if ($ < 0 || $ > M.length) throw new Error(`invalid dimension of ${$} for sizeFromDimension as Tensor has ${M.length} dimensions.`);
          return a.getSizeFromDimensionRange(M, $, M.length);
        }
        static sizeToDimension(M, $) {
          if ($ < 0 || $ > M.length) throw new Error(`invalid dimension of ${$} for sizeToDimension as Tensor has ${M.length} dimensions.`);
          return a.getSizeFromDimensionRange(M, 0, $);
        }
        static getSizeFromDimensionRange(M, $, O) {
          let C = 1;
          for (let P = $; P < O; P++) {
            if (M[P] <= 0) throw new Error("cannot get valid size from specified dimension range. Most likely the range contains 0 or negative values in them.");
            C *= M[P];
          }
          return C;
        }
        static computeStrides(M) {
          const $ = M.length;
          if ($ === 0) return [];
          if ($ === 1) return [1];
          const O = new Array($);
          O[$ - 1] = 1, O[$ - 2] = M[$ - 1];
          for (let C = $ - 3; C >= 0; --C) O[C] = O[C + 1] * M[C + 1];
          return O;
        }
        static transpose(M) {
          return M.slice().reverse();
        }
        static indicesToOffset(M, $, O) {
          O === void 0 && (O = M.length);
          let C = 0;
          for (let P = 0; P < O; ++P) C += $[P] * M[P];
          return C;
        }
        static offsetToIndices(M, $) {
          const O = $.length;
          if (O === 0) return [];
          if (O === 1) return [M * $[0]];
          const C = new Array($.length);
          for (let P = 0; P < C.length - 1; ++P) C[P] = Math.floor(M / $[P]), M -= C[P] * $[P];
          return C[C.length - 1] = M, C;
        }
        static normalizeAxis(M, $) {
          if (M < -$ && M >= $) throw new Error("unsupported axis for this operation.");
          return M < 0 ? M + $ : M;
        }
        static normalizeAxes(M, $) {
          return M.map((O) => this.normalizeAxis(O, $));
        }
        static incrementIndex(M, $, O) {
          if ($.length === 0 || M.length === 0) throw new Error("Index incrementing unsupported for scalar Tensor");
          if (O === void 0) O = $.length;
          else if (O <= 0 || O > $.length) throw new Error("Incorrect axis to increment on");
          for (let C = O - 1; C >= 0 && (M[C]++, !(M[C] < $[C])); --C) M[C] = 0;
        }
        static calculateReshapedDims(M, $) {
          if ($.length === 0) {
            if (M.length === 0 || a.size(M) === 1) return [];
            throw new Error("cannot reshape to a scalar Tensor");
          }
          const O = $.length, C = new Array(O);
          let P = -1, I = 1;
          for (let R = 0; R < O; R++) {
            if ($[R] < -1) throw new Error("a dimension in shape hints cannot be less than -1");
            if ($[R] === -1) {
              if (P !== -1) throw new Error("at most one dimension in shape hints can be -1");
              P = R;
            } else {
              if ($[R] === 0) {
                if (R >= M.length) throw new Error("the dimension with value zero exceeds the dimension size of the input tensor");
                C[R] = M[R];
              } else C[R] = $[R];
              I *= C[R];
            }
          }
          const N = a.size(M);
          if (P !== -1) {
            if (N % I != 0) throw new Error(`the input tensor cannot be reshaped to the requested shape. Input shape: [${M}] Output shape: [${$}]`);
            C[P] = N / I;
          } else if (I !== N) throw new Error("reshapedDims and originalDims don't have matching sizes");
          return C;
        }
        static sortBasedOnPerm(M, $) {
          return $ ? $.map((O) => M[O]) : M.slice().reverse();
        }
        static padShape(M, $) {
          const O = M.length;
          return M.map((C, P) => C + $[P] + $[P + O]);
        }
        static areEqual(M, $) {
          return M.length === $.length && M.every((O, C) => O === $[C]);
        }
        static validateDimsAndCalcSize(M) {
          if (M.length > 6) throw new TypeError("Only rank 0 to 6 is supported for tensor shape.");
          let $ = 1;
          for (const O of M) {
            if (!Number.isInteger(O)) throw new TypeError(`Invalid shape: ${O} is not an integer`);
            if (O < 0 || O > 2147483647) throw new TypeError(`Invalid shape: length ${O} is not allowed`);
            $ *= O;
          }
          return $;
        }
        static flattenShape(M, $) {
          $ < 0 && ($ += M.length);
          const O = M.reduce((P, I) => P * I, 1), C = M.slice($).reduce((P, I) => P * I, 1);
          return [O / C, C];
        }
        static squeezeShape(M, $) {
          const O = new Array();
          $ = a.normalizeAxes($, M.length);
          for (let C = 0; C < M.length; C++) {
            const P = $.indexOf(C) >= 0;
            if (P && M[C] !== 1) throw new Error("squeeze an axis of size different than 1");
            ($.length === 0 && M[C] > 1 || $.length > 0 && !P) && O.push(M[C]);
          }
          return O;
        }
        static unsqueezeShape(M, $) {
          const O = new Array(M.length + $.length);
          O.fill(0);
          for (let P = 0; P < $.length; P++) {
            const I = a.normalizeAxis($[P], O.length);
            if (I >= O.length) throw new Error("'axes' has an out of range axis");
            if (O[I] !== 0) throw new Error("'axes' has a duplicate axis");
            O[I] = 1;
          }
          let C = 0;
          for (let P = 0; P < O.length; P++) O[P] === 0 && (O[P] = M[C++]);
          if (C !== M.length) throw new Error("the unsqueezed dimension could not be established");
          return O;
        }
      }
      e.ShapeUtil = a, e.MathUtil = class {
        static sqr(A, M, $, O, C) {
          if (O < 0 || O >= M.length) throw new Error("sourceIndex out of bounds");
          if ($ < 0 || $ >= A.length) throw new Error("targetIndex out of bounds");
          if (O + C > M.length) throw new Error("source indices to be copied are outside bounds");
          if ($ + C > A.length) throw new Error("target array is too small to hold result");
          for (let P = 0; P < C; P++) A[$ + P] += Math.pow(M[O + P], 2);
        }
        static axpy(A, M, $, O, C, P) {
          if (O < 0 || O >= M.length) throw new Error("sourceIndex out of bounds");
          if ($ < 0 || $ >= A.length) throw new Error("targetIndex out of bounds");
          if (O + C > M.length) throw new Error("source indices to be copied are outside bounds");
          if ($ + C > A.length) throw new Error("target array is too small to hold result");
          for (let I = 0; I < C; I++) A[$ + I] += P * M[O + I];
        }
        static powx(A, M, $, O, C, P) {
          if (O < 0 || O >= M.length) throw new Error("sourceIndex out of bounds");
          if ($ < 0 || $ >= A.length) throw new Error("targetIndex out of bounds");
          if (O + C > M.length) throw new Error("source indices to be copied are outside bounds");
          if ($ + C > A.length) throw new Error("target array is too small to hold result");
          for (let I = 0; I < C; I++) A[$ + I] = Math.pow(M[O + I], P);
        }
        static mul(A, M, $, O, C) {
          if (O < 0 || O >= M.length) throw new Error("sourceIndex out of bounds");
          if ($ < 0 || $ >= A.length) throw new Error("targetIndex out of bounds");
          if (O + C > M.length) throw new Error("source indices to be copied are outside bounds");
          if ($ + C > A.length) throw new Error("target array is too small to hold result");
          for (let P = 0; P < C; P++) A[$ + P] = M[O + P] * A[$ + P];
        }
      };
      class b {
        static splitShape(M, $, O, C) {
          if (O.length === 0) {
            if (!C) throw new Error("need to know number of outputs when the 'split' attribute is not specified");
            b.determineSplit(M[$], C, O);
          }
          const P = [], I = [0];
          for (let N = 0; N < O.length; ++N) {
            N !== 0 && I.push(I[N - 1] + O[N - 1]);
            const R = M.slice();
            R[$] = O[N], P.push(R);
          }
          return [P, I];
        }
        static determineSplit(M, $, O) {
          if (M % $ != 0) throw new Error("cannot split tensor to equal sized parts");
          for (let C = 0; C < $; ++C) O.push(M / $);
        }
      }
      e.SplitUtil = b;
      class w {
        static calcReduce(M, $, O, C, P) {
          const I = M.dims.slice(0);
          $.length === 0 && I.forEach((ee, Y) => $.push(Y));
          const N = w.calcReduceShape(I, $, !0), R = a.size(N), F = new y.Tensor(N, M.type), B = a.computeStrides(N), G = a.computeStrides(I), Q = new Array(I.length);
          for (let ee = 0; ee < R; ee++) {
            const Y = a.offsetToIndices(ee, B);
            x.fillIndex(Y, I, Q), F.set(Y, w.calcReduceByAxis(M.numberData, $, I, 0, a.indicesToOffset(Q, G), C, P));
          }
          return O ? F : new y.Tensor(w.calcReduceShape(I, $, O), F.type, void 0, void 0, F.data, F.dataId);
        }
        static calcReduceByAxis(M, $, O, C, P, I, N) {
          let R = 0;
          if (C >= $.length) return I(M[P]);
          const F = $[C], B = F >= O.length ? 1 : a.size(O.slice(F + 1));
          for (let G = 0; G < O[F]; G++) R = G === 0 ? w.calcReduceByAxis(M, $, O, C + 1, P, I, N) : N(R, w.calcReduceByAxis(M, $, O, C + 1, P, I, N)), P += B;
          return R;
        }
        static calcReduceShape(M, $, O) {
          const C = M.slice();
          for (let P = 0; P < $.length; P++) C[$[P]] = O ? 1 : 0;
          return C.filter((P) => P !== 0);
        }
      }
      e.ReduceUtil = w;
      class k {
        static adjustPoolAttributes(M, $, O, C, P, I) {
          if (!M && O.length !== $.length - 2) throw new Error("length of specified kernel shapes should be 2 less than length of input dimensions");
          if (M) for (let N = 0; N < $.length - 2; N++) N >= O.length ? O.push($[N + 2]) : O[N] = $[N + 2];
          for (let N = 0; N < O.length; N++) if (N < C.length) {
            if (C[N] < 0) throw new Error("strides should be greater than or equal to 1");
          } else C.push(1);
          for (let N = 0; N < O.length; N++) if (N < P.length) {
            if (P[N] < 0) throw new Error("dilations should be greater than or equal to 1");
          } else P.push(1);
          for (let N = 0; N < 2 * O.length; N++) if (N < I.length) {
            if (I[N] < 0) throw new Error("pad should be greater than or equal to 1");
          } else I.push(0);
          for (let N = 0; N < O.length; N++) {
            if (O[N] <= 0) throw new Error("kernel shapes need to be greater than 0");
            if (I[N] >= O[N] || I[N + O.length] >= O[N]) throw new Error("pads should be smaller than kernel");
          }
        }
        static adjustPadsBasedOnAutoPad(M, $, O, C, P, I) {
          if (I) {
            if (P.length !== 2 * (M.length - 2)) throw new Error("length of pads should be twice the length of data dimensions");
            if ($.length !== M.length - 2) throw new Error("length of strides should be the length of data dimensions");
            if (C.length !== M.length - 2) throw new Error("length of kernel shapes should be the length of data dimensions");
            for (let N = 0; N < M.length - 2; N++) k.adjustPadAndReturnShape(M[N + 2], $[N], O[N], C[N], P, N, N + M.length - 2, I);
          }
        }
        static computePoolOutputShape(M, $, O, C, P, I, N) {
          if ($.length <= 0) throw new Error("input shape must be of size greater than 0");
          const R = [$[0], $[1]];
          return k.computeShapeHelper(M, $, R, O, C, P, I, N), R;
        }
        static computeConvOutputShape(M, $, O, C, P, I, N) {
          if (M.length <= 0 || $.length <= 0) throw new Error("invalid input tensor dims or invalid filter tensor dims");
          const R = [M[0], $[0]];
          return k.computeShapeHelper(!1, M, R, O, C, P, I, N), R;
        }
        static computeShapeHelper(M, $, O, C, P, I, N, R) {
          if (M) for (let F = 0; F < $.length - 2; F++) O.push(1);
          else for (let F = 0; F < $.length - 2; F++) O.push(k.adjustPadAndReturnShape($[F + 2], C[F], P[F], I[F], N, F, F + $.length - 2, R));
        }
        static adjustPadAndReturnShape(M, $, O, C, P, I, N, R) {
          const F = O * (C - 1) + 1;
          if (!R || R === "NOTSET") return Math.floor((M + P[I] + P[N] - F) / $ + 1);
          switch (R) {
            case "VALID":
              return P[I] = 0, P[N] = 0, Math.floor((M - F) / $ + 1);
            case "SAME_LOWER":
            case "SAME_UPPER":
              if (O !== 1) throw new Error("Dilation not supported for SAME_UPPER or SAME_LOWER");
              {
                const B = ((M + $ - 1) / $ - 1) * $ + C - M;
                return P[I] = Math.floor(R === "SAME_LOWER" ? (B + 1) / 2 : B / 2), P[N] = B - P[I], Math.floor((M + B - C) / $ + 1);
              }
            default:
              throw new Error("Unsupported AutoPad type");
          }
        }
      }
      e.PoolConvUtil = k, e.MIN_CLIP = -34028234663852886e22, e.MAX_CLIP = 34028234663852886e22, e.decodeUtf8String = function(A) {
        return new TextDecoder().decode(A);
      };
    }, 7967: (s, e) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.iterateExtraOptions = void 0, e.iterateExtraOptions = (r, o, m, _) => {
        if (typeof r == "object" && r !== null) {
          if (m.has(r)) throw new Error("Circular reference in options");
          m.add(r);
        }
        Object.entries(r).forEach(([g, y]) => {
          const E = o ? o + g : g;
          if (typeof y == "object") (0, e.iterateExtraOptions)(y, E + ".", m, _);
          else if (typeof y == "string" || typeof y == "number") _(E, y.toString());
          else {
            if (typeof y != "boolean") throw new Error("Can't handle extra config type: " + typeof y);
            _(E, y ? "1" : "0");
          }
        });
      };
    }, 2157: function(s, e, r) {
      var o, m = this && this.__createBinding || (Object.create ? function(B, G, Q, ee) {
        ee === void 0 && (ee = Q);
        var Y = Object.getOwnPropertyDescriptor(G, Q);
        Y && !("get" in Y ? !G.__esModule : Y.writable || Y.configurable) || (Y = { enumerable: !0, get: function() {
          return G[Q];
        } }), Object.defineProperty(B, ee, Y);
      } : function(B, G, Q, ee) {
        ee === void 0 && (ee = Q), B[ee] = G[Q];
      }), _ = this && this.__setModuleDefault || (Object.create ? function(B, G) {
        Object.defineProperty(B, "default", { enumerable: !0, value: G });
      } : function(B, G) {
        B.default = G;
      }), g = this && this.__importStar || function(B) {
        if (B && B.__esModule) return B;
        var G = {};
        if (B != null) for (var Q in B) Q !== "default" && Object.prototype.hasOwnProperty.call(B, Q) && m(G, B, Q);
        return _(G, B), G;
      };
      Object.defineProperty(e, "__esModule", { value: !0 }), e.endProfiling = e.run = e.releaseSession = e.createSession = e.createSessionFinalize = e.createSessionAllocate = e.initOrt = e.initWasm = void 0;
      const y = r(1670), E = g(r(349)), x = r(6361), v = () => !!y.env.wasm.proxy && typeof document < "u";
      let h, a, b, w = !1, k = !1, A = !1;
      const M = [], $ = [], O = [], C = [], P = [], I = [], N = () => {
        if (w || !k || A || !h) throw new Error("worker not ready");
      }, R = (B) => {
        switch (B.data.type) {
          case "init-wasm":
            w = !1, B.data.err ? (A = !0, a[1](B.data.err)) : (k = !0, a[0]());
            break;
          case "init-ort":
            B.data.err ? b[1](B.data.err) : b[0]();
            break;
          case "create_allocate":
            B.data.err ? M.shift()[1](B.data.err) : M.shift()[0](B.data.out);
            break;
          case "create_finalize":
            B.data.err ? $.shift()[1](B.data.err) : $.shift()[0](B.data.out);
            break;
          case "create":
            B.data.err ? O.shift()[1](B.data.err) : O.shift()[0](B.data.out);
            break;
          case "release":
            B.data.err ? C.shift()[1](B.data.err) : C.shift()[0]();
            break;
          case "run":
            B.data.err ? P.shift()[1](B.data.err) : P.shift()[0](B.data.out);
            break;
          case "end-profiling":
            B.data.err ? I.shift()[1](B.data.err) : I.shift()[0]();
        }
      }, F = typeof document < "u" ? (o = document == null ? void 0 : document.currentScript) === null || o === void 0 ? void 0 : o.src : void 0;
      e.initWasm = async () => {
        if (v()) {
          if (k) return;
          if (w) throw new Error("multiple calls to 'initWasm()' detected.");
          if (A) throw new Error("previous call to 'initWasm()' failed.");
          return w = !0, y.env.wasm.wasmPaths === void 0 && F && F.indexOf("blob:") !== 0 && (y.env.wasm.wasmPaths = F.substr(0, +F.lastIndexOf("/") + 1)), new Promise((B, G) => {
            h == null || h.terminate(), h = r(9710).Z(), h.onmessage = R, a = [B, G];
            const Q = { type: "init-wasm", in: y.env.wasm };
            h.postMessage(Q);
          });
        }
        return (0, x.initializeWebAssembly)(y.env.wasm);
      }, e.initOrt = async (B, G) => {
        if (v()) return N(), new Promise((Q, ee) => {
          b = [Q, ee];
          const Y = { type: "init-ort", in: { numThreads: B, loggingLevel: G } };
          h.postMessage(Y);
        });
        E.initOrt(B, G);
      }, e.createSessionAllocate = async (B) => v() ? (N(), new Promise((G, Q) => {
        M.push([G, Q]);
        const ee = { type: "create_allocate", in: { model: B } };
        h.postMessage(ee, [B.buffer]);
      })) : E.createSessionAllocate(B), e.createSessionFinalize = async (B, G) => v() ? (N(), new Promise((Q, ee) => {
        $.push([Q, ee]);
        const Y = { type: "create_finalize", in: { modeldata: B, options: G } };
        h.postMessage(Y);
      })) : E.createSessionFinalize(B, G), e.createSession = async (B, G) => v() ? (N(), new Promise((Q, ee) => {
        O.push([Q, ee]);
        const Y = { type: "create", in: { model: B, options: G } };
        h.postMessage(Y, [B.buffer]);
      })) : E.createSession(B, G), e.releaseSession = async (B) => {
        if (v()) return N(), new Promise((G, Q) => {
          C.push([G, Q]);
          const ee = { type: "release", in: B };
          h.postMessage(ee);
        });
        E.releaseSession(B);
      }, e.run = async (B, G, Q, ee, Y) => v() ? (N(), new Promise((W, j) => {
        P.push([W, j]);
        const J = { type: "run", in: { sessionId: B, inputIndices: G, inputs: Q, outputIndices: ee, options: Y } };
        h.postMessage(J, E.extractTransferableBuffers(Q));
      })) : E.run(B, G, Q, ee, Y), e.endProfiling = async (B) => {
        if (v()) return N(), new Promise((G, Q) => {
          I.push([G, Q]);
          const ee = { type: "end-profiling", in: B };
          h.postMessage(ee);
        });
        E.endProfiling(B);
      };
    }, 586: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.setRunOptions = void 0;
      const o = r(7967), m = r(4983), _ = r(6361);
      e.setRunOptions = (g) => {
        const y = (0, _.getInstance)();
        let E = 0;
        const x = [], v = g || {};
        try {
          if ((g == null ? void 0 : g.logSeverityLevel) === void 0) v.logSeverityLevel = 2;
          else if (typeof g.logSeverityLevel != "number" || !Number.isInteger(g.logSeverityLevel) || g.logSeverityLevel < 0 || g.logSeverityLevel > 4) throw new Error(`log serverity level is not valid: ${g.logSeverityLevel}`);
          if ((g == null ? void 0 : g.logVerbosityLevel) === void 0) v.logVerbosityLevel = 0;
          else if (typeof g.logVerbosityLevel != "number" || !Number.isInteger(g.logVerbosityLevel)) throw new Error(`log verbosity level is not valid: ${g.logVerbosityLevel}`);
          (g == null ? void 0 : g.terminate) === void 0 && (v.terminate = !1);
          let h = 0;
          if ((g == null ? void 0 : g.tag) !== void 0 && (h = (0, m.allocWasmString)(g.tag, x)), E = y._OrtCreateRunOptions(v.logSeverityLevel, v.logVerbosityLevel, !!v.terminate, h), E === 0) throw new Error("Can't create run options");
          return (g == null ? void 0 : g.extra) !== void 0 && (0, o.iterateExtraOptions)(g.extra, "", /* @__PURE__ */ new WeakSet(), (a, b) => {
            const w = (0, m.allocWasmString)(a, x), k = (0, m.allocWasmString)(b, x);
            if (y._OrtAddRunConfigEntry(E, w, k) !== 0) throw new Error(`Can't set a run config entry: ${a} - ${b}`);
          }), [E, x];
        } catch (h) {
          throw E !== 0 && y._OrtReleaseRunOptions(E), x.forEach(y._free), h;
        }
      };
    }, 2306: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.OnnxruntimeWebAssemblySessionHandler = void 0;
      const o = r(2806), m = r(1670), _ = r(2850), g = r(2157);
      let y;
      e.OnnxruntimeWebAssemblySessionHandler = class {
        async createSessionAllocate(E) {
          const x = await fetch(E), v = await x.arrayBuffer();
          return (0, g.createSessionAllocate)(new Uint8Array(v));
        }
        async loadModel(E, x) {
          if (y || (await (0, g.initOrt)(m.env.wasm.numThreads, ((v) => {
            switch (v) {
              case "verbose":
                return 0;
              case "info":
                return 1;
              case "warning":
                return 2;
              case "error":
                return 3;
              case "fatal":
                return 4;
              default:
                throw new Error(`unsupported logging level: ${v}`);
            }
          })(m.env.logLevel)), y = !0), typeof E == "string") if (typeof fetch > "u") {
            const v = await (0, _.promisify)(o.readFile)(E);
            [this.sessionId, this.inputNames, this.outputNames] = await (0, g.createSession)(v, x);
          } else {
            const v = await this.createSessionAllocate(E);
            [this.sessionId, this.inputNames, this.outputNames] = await (0, g.createSessionFinalize)(v, x);
          }
          else [this.sessionId, this.inputNames, this.outputNames] = await (0, g.createSession)(E, x);
        }
        async dispose() {
          return (0, g.releaseSession)(this.sessionId);
        }
        async run(E, x, v) {
          const h = [], a = [];
          Object.entries(E).forEach((A) => {
            const M = A[0], $ = A[1], O = this.inputNames.indexOf(M);
            if (O === -1) throw new Error(`invalid input '${M}'`);
            h.push($), a.push(O);
          });
          const b = [];
          Object.entries(x).forEach((A) => {
            const M = A[0], $ = this.outputNames.indexOf(M);
            if ($ === -1) throw new Error(`invalid output '${M}'`);
            b.push($);
          });
          const w = await (0, g.run)(this.sessionId, a, h.map((A) => [A.type, A.dims, A.data]), b, v), k = {};
          for (let A = 0; A < w.length; A++) k[this.outputNames[b[A]]] = new m.Tensor(w[A][0], w[A][2], w[A][1]);
          return k;
        }
        startProfiling() {
        }
        endProfiling() {
          (0, g.endProfiling)(this.sessionId);
        }
      };
    }, 4919: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.setSessionOptions = void 0;
      const o = r(7967), m = r(4983), _ = r(6361);
      e.setSessionOptions = (g) => {
        const y = (0, _.getInstance)();
        let E = 0;
        const x = [], v = g || {};
        ((h) => {
          h.extra || (h.extra = {}), h.extra.session || (h.extra.session = {});
          const a = h.extra.session;
          a.use_ort_model_bytes_directly || (a.use_ort_model_bytes_directly = "1");
        })(v);
        try {
          (g == null ? void 0 : g.graphOptimizationLevel) === void 0 && (v.graphOptimizationLevel = "all");
          const h = ((w) => {
            switch (w) {
              case "disabled":
                return 0;
              case "basic":
                return 1;
              case "extended":
                return 2;
              case "all":
                return 99;
              default:
                throw new Error(`unsupported graph optimization level: ${w}`);
            }
          })(v.graphOptimizationLevel);
          (g == null ? void 0 : g.enableCpuMemArena) === void 0 && (v.enableCpuMemArena = !0), (g == null ? void 0 : g.enableMemPattern) === void 0 && (v.enableMemPattern = !0), (g == null ? void 0 : g.executionMode) === void 0 && (v.executionMode = "sequential");
          const a = ((w) => {
            switch (w) {
              case "sequential":
                return 0;
              case "parallel":
                return 1;
              default:
                throw new Error(`unsupported execution mode: ${w}`);
            }
          })(v.executionMode);
          let b = 0;
          if ((g == null ? void 0 : g.logId) !== void 0 && (b = (0, m.allocWasmString)(g.logId, x)), (g == null ? void 0 : g.logSeverityLevel) === void 0) v.logSeverityLevel = 2;
          else if (typeof g.logSeverityLevel != "number" || !Number.isInteger(g.logSeverityLevel) || g.logSeverityLevel < 0 || g.logSeverityLevel > 4) throw new Error(`log serverity level is not valid: ${g.logSeverityLevel}`);
          if ((g == null ? void 0 : g.logVerbosityLevel) === void 0) v.logVerbosityLevel = 0;
          else if (typeof g.logVerbosityLevel != "number" || !Number.isInteger(g.logVerbosityLevel)) throw new Error(`log verbosity level is not valid: ${g.logVerbosityLevel}`);
          if ((g == null ? void 0 : g.enableProfiling) === void 0 && (v.enableProfiling = !1), E = y._OrtCreateSessionOptions(h, !!v.enableCpuMemArena, !!v.enableMemPattern, a, !!v.enableProfiling, 0, b, v.logSeverityLevel, v.logVerbosityLevel), E === 0) throw new Error("Can't create session options");
          return g != null && g.executionProviders && ((w, k, A) => {
            for (const M of k) {
              let $ = typeof M == "string" ? M : M.name;
              switch ($) {
                case "xnnpack":
                  $ = "XNNPACK";
                  break;
                case "wasm":
                case "cpu":
                  continue;
                default:
                  throw new Error(`not supported EP: ${$}`);
              }
              const O = (0, m.allocWasmString)($, A);
              if ((0, _.getInstance)()._OrtAppendExecutionProvider(w, O) !== 0) throw new Error(`Can't append execution provider: ${$}`);
            }
          })(E, g.executionProviders, x), (g == null ? void 0 : g.extra) !== void 0 && (0, o.iterateExtraOptions)(g.extra, "", /* @__PURE__ */ new WeakSet(), (w, k) => {
            const A = (0, m.allocWasmString)(w, x), M = (0, m.allocWasmString)(k, x);
            if (y._OrtAddSessionConfigEntry(E, A, M) !== 0) throw new Error(`Can't set a session config entry: ${w} - ${k}`);
          }), [E, x];
        } catch (h) {
          throw E !== 0 && y._OrtReleaseSessionOptions(E), x.forEach(y._free), h;
        }
      };
    }, 4983: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.allocWasmString = void 0;
      const o = r(6361);
      e.allocWasmString = (m, _) => {
        const g = (0, o.getInstance)(), y = g.lengthBytesUTF8(m) + 1, E = g._malloc(y);
        return g.stringToUTF8(m, E, y), _.push(E), E;
      };
    }, 349: (s, e, r) => {
      Object.defineProperty(e, "__esModule", { value: !0 }), e.extractTransferableBuffers = e.endProfiling = e.run = e.releaseSession = e.createSession = e.createSessionFinalize = e.createSessionAllocate = e.initOrt = void 0;
      const o = r(586), m = r(4919), _ = r(4983), g = r(6361);
      e.initOrt = (h, a) => {
        const b = (0, g.getInstance)()._OrtInit(h, a);
        if (b !== 0) throw new Error(`Can't initialize onnxruntime. error code = ${b}`);
      };
      const y = /* @__PURE__ */ new Map();
      e.createSessionAllocate = (h) => {
        const a = (0, g.getInstance)(), b = a._malloc(h.byteLength);
        return a.HEAPU8.set(h, b), [b, h.byteLength];
      }, e.createSessionFinalize = (h, a) => {
        const b = (0, g.getInstance)();
        let w = 0, k = 0, A = [];
        try {
          if ([k, A] = (0, m.setSessionOptions)(a), w = b._OrtCreateSession(h[0], h[1], k), w === 0) throw new Error("Can't create a session");
        } finally {
          b._free(h[0]), b._OrtReleaseSessionOptions(k), A.forEach(b._free);
        }
        const M = b._OrtGetInputCount(w), $ = b._OrtGetOutputCount(w), O = [], C = [], P = [], I = [];
        for (let N = 0; N < M; N++) {
          const R = b._OrtGetInputName(w, N);
          if (R === 0) throw new Error("Can't get an input name");
          C.push(R), O.push(b.UTF8ToString(R));
        }
        for (let N = 0; N < $; N++) {
          const R = b._OrtGetOutputName(w, N);
          if (R === 0) throw new Error("Can't get an output name");
          I.push(R), P.push(b.UTF8ToString(R));
        }
        return y.set(w, [w, C, I]), [w, O, P];
      }, e.createSession = (h, a) => {
        const b = (0, e.createSessionAllocate)(h);
        return (0, e.createSessionFinalize)(b, a);
      }, e.releaseSession = (h) => {
        const a = (0, g.getInstance)(), b = y.get(h);
        if (!b) throw new Error("invalid session id");
        const w = b[0], k = b[1], A = b[2];
        k.forEach(a._OrtFree), A.forEach(a._OrtFree), a._OrtReleaseSession(w), y.delete(h);
      };
      const E = (h) => {
        switch (h) {
          case "int8":
            return 3;
          case "uint8":
            return 2;
          case "bool":
            return 9;
          case "int16":
            return 5;
          case "uint16":
            return 4;
          case "int32":
            return 6;
          case "uint32":
            return 12;
          case "float32":
            return 1;
          case "float64":
            return 11;
          case "string":
            return 8;
          case "int64":
            return 7;
          case "uint64":
            return 13;
          default:
            throw new Error(`unsupported data type: ${h}`);
        }
      }, x = (h) => {
        switch (h) {
          case 3:
            return "int8";
          case 2:
            return "uint8";
          case 9:
            return "bool";
          case 5:
            return "int16";
          case 4:
            return "uint16";
          case 6:
            return "int32";
          case 12:
            return "uint32";
          case 1:
            return "float32";
          case 11:
            return "float64";
          case 8:
            return "string";
          case 7:
            return "int64";
          case 13:
            return "uint64";
          default:
            throw new Error(`unsupported data type: ${h}`);
        }
      }, v = (h) => {
        switch (h) {
          case "float32":
            return Float32Array;
          case "uint8":
          case "bool":
            return Uint8Array;
          case "int8":
            return Int8Array;
          case "uint16":
            return Uint16Array;
          case "int16":
            return Int16Array;
          case "int32":
            return Int32Array;
          case "float64":
            return Float64Array;
          case "uint32":
            return Uint32Array;
          case "int64":
            return BigInt64Array;
          case "uint64":
            return BigUint64Array;
          default:
            throw new Error(`unsupported type: ${h}`);
        }
      };
      e.run = (h, a, b, w, k) => {
        const A = (0, g.getInstance)(), M = y.get(h);
        if (!M) throw new Error("invalid session id");
        const $ = M[0], O = M[1], C = M[2], P = a.length, I = w.length;
        let N = 0, R = [];
        const F = [], B = [];
        try {
          [N, R] = (0, o.setRunOptions)(k);
          for (let j = 0; j < P; j++) {
            const J = b[j][0], me = b[j][1], pe = b[j][2];
            let ye, oe;
            if (Array.isArray(pe)) {
              oe = 4 * pe.length, ye = A._malloc(oe), B.push(ye);
              let Me = ye / 4;
              for (let de = 0; de < pe.length; de++) {
                if (typeof pe[de] != "string") throw new TypeError(`tensor data at index ${de} is not a string`);
                A.HEAPU32[Me++] = (0, _.allocWasmString)(pe[de], B);
              }
            } else oe = pe.byteLength, ye = A._malloc(oe), B.push(ye), A.HEAPU8.set(new Uint8Array(pe.buffer, pe.byteOffset, oe), ye);
            const we = A.stackSave(), Se = A.stackAlloc(4 * me.length);
            try {
              let Me = Se / 4;
              me.forEach((Oe) => A.HEAP32[Me++] = Oe);
              const de = A._OrtCreateTensor(E(J), ye, oe, Se, me.length);
              if (de === 0) throw new Error("Can't create a tensor");
              F.push(de);
            } finally {
              A.stackRestore(we);
            }
          }
          const G = A.stackSave(), Q = A.stackAlloc(4 * P), ee = A.stackAlloc(4 * P), Y = A.stackAlloc(4 * I), W = A.stackAlloc(4 * I);
          try {
            let j = Q / 4, J = ee / 4, me = Y / 4, pe = W / 4;
            for (let we = 0; we < P; we++) A.HEAPU32[j++] = F[we], A.HEAPU32[J++] = O[a[we]];
            for (let we = 0; we < I; we++) A.HEAPU32[me++] = 0, A.HEAPU32[pe++] = C[w[we]];
            let ye = A._OrtRun($, ee, Q, P, W, I, Y, N);
            const oe = [];
            if (ye === 0) for (let we = 0; we < I; we++) {
              const Se = A.HEAPU32[Y / 4 + we], Me = A.stackSave(), de = A.stackAlloc(16);
              let Oe, $e = 0;
              try {
                if (ye = A._OrtGetTensorData(Se, de, de + 4, de + 8, de + 12), ye !== 0) throw new Error(`Can't access output tensor data. error code = ${ye}`);
                let ge = de / 4;
                const Ye = A.HEAPU32[ge++];
                $e = A.HEAPU32[ge++];
                const Ie = A.HEAPU32[ge++], Ge = A.HEAPU32[ge++], Ke = [];
                for (let Ce = 0; Ce < Ge; Ce++) Ke.push(A.HEAPU32[Ie / 4 + Ce]);
                A._OrtFree(Ie);
                const Ne = Ke.length === 0 ? 1 : Ke.reduce((Ce, lt) => Ce * lt);
                if (Oe = x(Ye), Oe === "string") {
                  const Ce = [];
                  let lt = $e / 4;
                  for (let ut = 0; ut < Ne; ut++) {
                    const Je = A.HEAPU32[lt++], Ze = ut === Ne - 1 ? void 0 : A.HEAPU32[lt] - Je;
                    Ce.push(A.UTF8ToString(Je, Ze));
                  }
                  oe.push([Oe, Ke, Ce]);
                } else {
                  const Ce = new (v(Oe))(Ne);
                  new Uint8Array(Ce.buffer, Ce.byteOffset, Ce.byteLength).set(A.HEAPU8.subarray($e, $e + Ce.byteLength)), oe.push([Oe, Ke, Ce]);
                }
              } finally {
                A.stackRestore(Me), Oe === "string" && $e && A._free($e), A._OrtReleaseTensor(Se);
              }
            }
            if (ye === 0) return oe;
            throw new Error(`failed to call OrtRun(). error code = ${ye}.`);
          } finally {
            A.stackRestore(G);
          }
        } finally {
          F.forEach(A._OrtReleaseTensor), B.forEach(A._free), A._OrtReleaseRunOptions(N), R.forEach(A._free);
        }
      }, e.endProfiling = (h) => {
        const a = (0, g.getInstance)(), b = y.get(h);
        if (!b) throw new Error("invalid session id");
        const w = b[0], k = a._OrtEndProfiling(w);
        if (k === 0) throw new Error("Can't get an profile file name");
        a._OrtFree(k);
      }, e.extractTransferableBuffers = (h) => {
        const a = [];
        for (const b of h) {
          const w = b[2];
          !Array.isArray(w) && w.buffer && a.push(w.buffer);
        }
        return a;
      };
    }, 6361: function(s, e, r) {
      var o = this && this.__createBinding || (Object.create ? function(k, A, M, $) {
        $ === void 0 && ($ = M);
        var O = Object.getOwnPropertyDescriptor(A, M);
        O && !("get" in O ? !A.__esModule : O.writable || O.configurable) || (O = { enumerable: !0, get: function() {
          return A[M];
        } }), Object.defineProperty(k, $, O);
      } : function(k, A, M, $) {
        $ === void 0 && ($ = M), k[$] = A[M];
      }), m = this && this.__setModuleDefault || (Object.create ? function(k, A) {
        Object.defineProperty(k, "default", { enumerable: !0, value: A });
      } : function(k, A) {
        k.default = A;
      }), _ = this && this.__importStar || function(k) {
        if (k && k.__esModule) return k;
        var A = {};
        if (k != null) for (var M in k) M !== "default" && Object.prototype.hasOwnProperty.call(k, M) && o(A, k, M);
        return m(A, k), A;
      }, g = this && this.__importDefault || function(k) {
        return k && k.__esModule ? k : { default: k };
      };
      Object.defineProperty(e, "__esModule", { value: !0 }), e.dispose = e.getInstance = e.initializeWebAssembly = void 0;
      const y = _(r(6449)), E = g(r(932)), x = r(3474);
      let v, h = !1, a = !1, b = !1;
      const w = (k, A) => A ? k ? "ort-wasm-simd-threaded.wasm" : "ort-wasm-threaded.wasm" : k ? "ort-wasm-simd.wasm" : "ort-wasm.wasm";
      e.initializeWebAssembly = async (k) => {
        if (h) return Promise.resolve();
        if (a) throw new Error("multiple calls to 'initializeWebAssembly()' detected.");
        if (b) throw new Error("previous call to 'initializeWebAssembly()' failed.");
        a = !0;
        const A = k.initTimeout, M = k.numThreads, $ = k.simd, O = M > 1 && (() => {
          try {
            return typeof SharedArrayBuffer < "u" && (typeof MessageChannel < "u" && new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)), WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 4, 1, 3, 1, 1, 10, 11, 1, 9, 0, 65, 0, 254, 16, 2, 0, 26, 11])));
          } catch {
            return !1;
          }
        })(), C = $ && (() => {
          try {
            return WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 30, 1, 28, 0, 65, 0, 253, 15, 253, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 253, 186, 1, 26, 11]));
          } catch {
            return !1;
          }
        })(), P = typeof k.wasmPaths == "string" ? k.wasmPaths : void 0, I = w(!1, O), N = w(C, O), R = typeof k.wasmPaths == "object" ? k.wasmPaths[N] : void 0;
        let F = !1;
        const B = [];
        if (A > 0 && B.push(new Promise((G) => {
          setTimeout(() => {
            F = !0, G();
          }, A);
        })), B.push(new Promise((G, Q) => {
          const ee = O ? x : E.default, Y = { locateFile: (W, j) => O && W.endsWith(".worker.js") && typeof Blob < "u" ? URL.createObjectURL(new Blob([r(4154)], { type: "text/javascript" })) : W === I ? R ?? (P ?? j) + N : j + W };
          if (O) if (typeof Blob > "u") Y.mainScriptUrlOrBlob = y.join("/", "ort-wasm-threaded.js");
          else {
            const W = `var ortWasmThreaded=(function(){var _scriptDir;return ${ee.toString()}})();`;
            Y.mainScriptUrlOrBlob = new Blob([W], { type: "text/javascript" });
          }
          ee(Y).then((W) => {
            a = !1, h = !0, v = W, G();
          }, (W) => {
            a = !1, b = !0, Q(W);
          });
        })), await Promise.race(B), F) throw new Error(`WebAssembly backend initializing failed due to timeout: ${A}ms`);
      }, e.getInstance = () => {
        if (h && v) return v;
        throw new Error("WebAssembly is not initialized yet.");
      }, e.dispose = () => {
        var k;
        !h || a || b || (a = !0, (k = v.PThread) === null || k === void 0 || k.terminateAllThreads(), v = void 0, a = !1, h = !1, b = !0);
      };
    }, 9710: (s, e, r) => {
      r.d(e, { Z: () => _ });
      var o = r(477), m = r.n(o);
      function _() {
        return m()('/*!\n* ONNX Runtime Web v1.14.0\n* Copyright (c) Microsoft Corporation. All rights reserved.\n* Licensed under the MIT License.\n*/\n(()=>{var t={474:(t,e,n)=>{var _scriptDir,r=(_scriptDir=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){function e(){return j.buffer!=D&&N(j.buffer),P}function r(){return j.buffer!=D&&N(j.buffer),U}function a(){return j.buffer!=D&&N(j.buffer),F}function i(){return j.buffer!=D&&N(j.buffer),I}function o(){return j.buffer!=D&&N(j.buffer),W}var u,c,s;t=t||{},u||(u=void 0!==t?t:{}),u.ready=new Promise((function(t,e){c=t,s=e}));var l,f,p,h,d,y,b=Object.assign({},u),m="./this.program",g=(t,e)=>{throw e},v="object"==typeof window,w="function"==typeof importScripts,_="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,O=u.ENVIRONMENT_IS_PTHREAD||!1,A="";function S(t){return u.locateFile?u.locateFile(t,A):A+t}if(_){let e;A=w?n(908).dirname(A)+"/":"//",y=()=>{d||(h=n(384),d=n(908))},l=function(t,e){return y(),t=d.normalize(t),h.readFileSync(t,e?void 0:"utf8")},p=t=>((t=l(t,!0)).buffer||(t=new Uint8Array(t)),t),f=(t,e,n)=>{y(),t=d.normalize(t),h.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1<process.argv.length&&(m=process.argv[1].replace(/\\\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",(function(t){if(!(t instanceof ct))throw t})),process.on("unhandledRejection",(function(t){throw t})),g=(t,e)=>{if(Q())throw process.exitCode=t,e;e instanceof ct||x("exiting due to exception: "+e),process.exit(t)},u.inspect=function(){return"[Emscripten Module object]"};try{e=n(925)}catch(t){throw console.error(\'The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?\'),t}n.g.Worker=e.Worker}else(v||w)&&(w?A=self.location.href:"undefined"!=typeof document&&document.currentScript&&(A=document.currentScript.src),_scriptDir&&(A=_scriptDir),A=0!==A.indexOf("blob:")?A.substr(0,A.replace(/[?#].*/,"").lastIndexOf("/")+1):"",_||(l=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},w&&(p=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),f=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)}));_&&"undefined"==typeof performance&&(n.g.performance=n(953).performance);var T=console.log.bind(console),E=console.warn.bind(console);_&&(y(),T=t=>h.writeSync(1,t+"\\n"),E=t=>h.writeSync(2,t+"\\n"));var M,C=u.print||T,x=u.printErr||E;Object.assign(u,b),b=null,u.thisProgram&&(m=u.thisProgram),u.quit&&(g=u.quit),u.wasmBinary&&(M=u.wasmBinary);var R=u.noExitRuntime||!1;"object"!=typeof WebAssembly&&at("no native wasm support detected");var j,k,D,P,U,F,I,W,H=!1,L="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function z(t,e,n){var r=(e>>>=0)+n;for(n=e;t[n]&&!(n>=r);)++n;if(16<n-e&&t.buffer&&L)return L.decode(t.buffer instanceof SharedArrayBuffer?t.slice(e,n):t.subarray(e,n));for(r="";e<n;){var a=t[e++];if(128&a){var i=63&t[e++];if(192==(224&a))r+=String.fromCharCode((31&a)<<6|i);else{var o=63&t[e++];65536>(a=224==(240&a)?(15&a)<<12|i<<6|o:(7&a)<<18|i<<12|o<<6|63&t[e++])?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else r+=String.fromCharCode(a)}return r}function Y(t,e){return(t>>>=0)?z(r(),t,e):""}function B(t,e,n,r){if(!(0<r))return 0;var a=n>>>=0;r=n+r-1;for(var i=0;i<t.length;++i){var o=t.charCodeAt(i);if(55296<=o&&57343>=o&&(o=65536+((1023&o)<<10)|1023&t.charCodeAt(++i)),127>=o){if(n>=r)break;e[n++>>>0]=o}else{if(2047>=o){if(n+1>=r)break;e[n++>>>0]=192|o>>6}else{if(65535>=o){if(n+2>=r)break;e[n++>>>0]=224|o>>12}else{if(n+3>=r)break;e[n++>>>0]=240|o>>18,e[n++>>>0]=128|o>>12&63}e[n++>>>0]=128|o>>6&63}e[n++>>>0]=128|63&o}}return e[n>>>0]=0,n-a}function G(t){for(var e=0,n=0;n<t.length;++n){var r=t.charCodeAt(n);127>=r?e++:2047>=r?e+=2:55296<=r&&57343>=r?(e+=4,++n):e+=3}return e}function N(t){D=t,u.HEAP8=P=new Int8Array(t),u.HEAP16=new Int16Array(t),u.HEAP32=F=new Int32Array(t),u.HEAPU8=U=new Uint8Array(t),u.HEAPU16=new Uint16Array(t),u.HEAPU32=I=new Uint32Array(t),u.HEAPF32=new Float32Array(t),u.HEAPF64=W=new Float64Array(t)}O&&(D=u.buffer);var V=u.INITIAL_MEMORY||16777216;if(O)j=u.wasmMemory,D=u.buffer;else if(u.wasmMemory)j=u.wasmMemory;else if(!((j=new WebAssembly.Memory({initial:V/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw x("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),_&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");j&&(D=j.buffer),V=D.byteLength,N(D);var $,q=[],X=[],J=[],Z=[];function Q(){return R||!1}function K(){var t=u.preRun.shift();q.unshift(t)}var tt,et=0,nt=null,rt=null;function at(t){throw O?postMessage({cmd:"onAbort",arg:t}):u.onAbort&&u.onAbort(t),x(t="Aborted("+t+")"),H=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),s(t),t}function it(){return tt.startsWith("data:application/octet-stream;base64,")}function ot(){var t=tt;try{if(t==tt&&M)return new Uint8Array(M);if(p)return p(t);throw"both async and sync fetching of the wasm failed"}catch(t){at(t)}}tt="ort-wasm-threaded.wasm",it()||(tt=S(tt));var ut={};function ct(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function st(t){(t=ht.Vb[t])||at(),ht.mc(t)}function lt(t){var e=ht.Cc();if(!e)return 6;ht.ac.push(e),ht.Vb[t.Ub]=e,e.Ub=t.Ub;var n={cmd:"run",start_routine:t.Ic,arg:t.zc,pthread_ptr:t.Ub};return e.$b=()=>{n.time=performance.now(),e.postMessage(n,t.Nc)},e.loaded&&(e.$b(),delete e.$b),0}function ft(t){if(O)return $t(1,1,t);Q()||(ht.oc(),u.onExit&&u.onExit(t),H=!0),g(t,new ct(t))}function pt(t,e){if(!e&&O)throw bt(t),"unwind";Q()||O||(me(),dt(J),be(0),re[1].length&&ae(1,10),re[2].length&&ae(2,10),ht.oc()),ft(t)}var ht={Yb:[],ac:[],qc:[],Vb:{},fc:function(){O&&ht.Ec()},Pc:function(){},Ec:function(){ht.receiveObjectTransfer=ht.Gc,ht.threadInitTLS=ht.pc,ht.setExitStatus=ht.nc,R=!1},nc:function(){},oc:function(){for(var t of Object.values(ht.Vb))ht.mc(t);for(t of ht.Yb)t.terminate();ht.Yb=[]},mc:function(t){var e=t.Ub;delete ht.Vb[e],ht.Yb.push(t),ht.ac.splice(ht.ac.indexOf(t),1),t.Ub=0,Oe(e)},Gc:function(){},pc:function(){ht.qc.forEach((t=>t()))},Fc:function(t,e){t.onmessage=n=>{var r=(n=n.data).cmd;if(t.Ub&&(ht.Bc=t.Ub),n.targetThread&&n.targetThread!=he()){var a=ht.Vb[n.Qc];a?a.postMessage(n,n.transferList):x(\'Internal error! Worker sent a message "\'+r+\'" to target pthread \'+n.targetThread+", but that thread no longer exists!")}else"processProxyingQueue"===r?zt(n.queue):"spawnThread"===r?lt(n):"cleanupThread"===r?st(n.thread):"killThread"===r?(n=n.thread,r=ht.Vb[n],delete ht.Vb[n],r.terminate(),Oe(n),ht.ac.splice(ht.ac.indexOf(r),1),r.Ub=0):"cancelThread"===r?ht.Vb[n.thread].postMessage({cmd:"cancel"}):"loaded"===r?(t.loaded=!0,e&&e(t),t.$b&&(t.$b(),delete t.$b)):"print"===r?C("Thread "+n.threadId+": "+n.text):"printErr"===r?x("Thread "+n.threadId+": "+n.text):"alert"===r?alert("Thread "+n.threadId+": "+n.text):"setimmediate"===n.target?t.postMessage(n):"onAbort"===r?u.onAbort&&u.onAbort(n.arg):r&&x("worker sent an unknown command "+r);ht.Bc=void 0},t.onerror=t=>{throw x("worker sent an error! "+t.filename+":"+t.lineno+": "+t.message),t},_&&(t.on("message",(function(e){t.onmessage({data:e})})),t.on("error",(function(e){t.onerror(e)})),t.on("detachedExit",(function(){}))),t.postMessage({cmd:"load",urlOrBlob:u.mainScriptUrlOrBlob||_scriptDir,wasmMemory:j,wasmModule:k})},yc:function(){var t=S("ort-wasm-threaded.worker.js");ht.Yb.push(new Worker(t))},Cc:function(){return 0==ht.Yb.length&&(ht.yc(),ht.Fc(ht.Yb[0])),ht.Yb.pop()}};function dt(t){for(;0<t.length;)t.shift()(u)}function yt(t){var e=Ee();return t=t(),Me(e),t}function bt(t){if(O)return $t(2,0,t);try{pt(t)}catch(t){t instanceof ct||"unwind"==t||g(1,t)}}u.PThread=ht,u.establishStackSpace=function(){var t=he(),e=a()[t+44>>2>>>0];t=a()[t+48>>2>>>0],Te(e,e-t),Me(e)};var mt=[];function gt(t){var e=mt[t];return e||(t>=mt.length&&(mt.length=t+1),mt[t]=e=$.get(t)),e}u.invokeEntryPoint=function(t,e){t=gt(t)(e),Q()?ht.nc(t):Ae(t)};var vt,wt,_t=[],Ot=0,At=0;function St(t){this.Zb=t,this.Sb=t-24,this.xc=function(t){i()[this.Sb+4>>2>>>0]=t},this.bc=function(){return i()[this.Sb+4>>2>>>0]},this.wc=function(t){i()[this.Sb+8>>2>>>0]=t},this.Dc=function(){return i()[this.Sb+8>>2>>>0]},this.rc=function(){a()[this.Sb>>2>>>0]=0},this.hc=function(t){t=t?1:0,e()[this.Sb+12>>0>>>0]=t},this.uc=function(){return 0!=e()[this.Sb+12>>0>>>0]},this.ic=function(t){t=t?1:0,e()[this.Sb+13>>0>>>0]=t},this.kc=function(){return 0!=e()[this.Sb+13>>0>>>0]},this.fc=function(t,e){this.cc(0),this.xc(t),this.wc(e),this.rc(),this.hc(!1),this.ic(!1)},this.sc=function(){Atomics.add(a(),this.Sb>>2,1)},this.Hc=function(){return 1===Atomics.sub(a(),this.Sb>>2,1)},this.cc=function(t){i()[this.Sb+16>>2>>>0]=t},this.tc=function(){return i()[this.Sb+16>>2>>>0]},this.vc=function(){if(Re(this.bc()))return i()[this.Zb>>2>>>0];var t=this.tc();return 0!==t?t:this.Zb}}function Tt(t){return ye(new St(t).Sb)}function Et(t,e,n,r){return O?$t(3,1,t,e,n,r):Mt(t,e,n,r)}function Mt(t,e,n,r){if("undefined"==typeof SharedArrayBuffer)return x("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var a=[];return O&&0===a.length?Et(t,e,n,r):(t={Ic:n,Ub:t,zc:r,Nc:a},O?(t.Oc="spawnThread",postMessage(t,a),0):lt(t))}function Ct(t,e,n){return O?$t(4,1,t,e,n):0}function xt(t,e){if(O)return $t(5,1,t,e)}function Rt(t,e){if(O)return $t(6,1,t,e)}function jt(t,e,n){if(O)return $t(7,1,t,e,n)}function kt(t,e,n){return O?$t(8,1,t,e,n):0}function Dt(t,e){if(O)return $t(9,1,t,e)}function Pt(t,e,n){if(O)return $t(10,1,t,e,n)}function Ut(t,e,n,r){if(O)return $t(11,1,t,e,n,r)}function Ft(t,e,n,r){if(O)return $t(12,1,t,e,n,r)}function It(t,e,n,r){if(O)return $t(13,1,t,e,n,r)}function Wt(t){if(O)return $t(14,1,t)}function Ht(t,e){if(O)return $t(15,1,t,e)}function Lt(t,e,n){if(O)return $t(16,1,t,e,n)}function zt(t){Atomics.store(a(),t>>2,1),he()&&_e(t),Atomics.compareExchange(a(),t>>2,1,0)}function Yt(t){return i()[t>>>2]+4294967296*a()[t+4>>>2]}function Bt(t,e,n,r,a,i){return O?$t(17,1,t,e,n,r,a,i):-52}function Gt(t,e,n,r,a,i){if(O)return $t(18,1,t,e,n,r,a,i)}function Nt(t){var n=G(t)+1,r=de(n);return r&&B(t,e(),r,n),r}function Vt(t,e,n){function r(t){return(t=t.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?t[1]:"GMT"}if(O)return $t(19,1,t,e,n);var o=(new Date).getFullYear(),u=new Date(o,0,1),c=new Date(o,6,1);o=u.getTimezoneOffset();var s=c.getTimezoneOffset(),l=Math.max(o,s);a()[t>>2>>>0]=60*l,a()[e>>2>>>0]=Number(o!=s),t=r(u),e=r(c),t=Nt(t),e=Nt(e),s<o?(i()[n>>2>>>0]=t,i()[n+4>>2>>>0]=e):(i()[n>>2>>>0]=e,i()[n+4>>2>>>0]=t)}function $t(t,e){var n=arguments.length-2,r=arguments;return yt((()=>{for(var a=Ce(8*n),i=a>>3,u=0;u<n;u++){var c=r[2+u];o()[i+u>>>0]=c}return we(t,n,a,e)}))}u.executeNotifiedProxyingQueue=zt,wt=_?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:O?()=>performance.now()-u.__performance_now_clock_drift:()=>performance.now();var qt,Xt=[],Jt={};function Zt(){if(!qt){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:m||"./this.program"};for(t in Jt)void 0===Jt[t]?delete e[t]:e[t]=Jt[t];var n=[];for(t in e)n.push(t+"="+e[t]);qt=n}return qt}function Qt(t,n){if(O)return $t(20,1,t,n);var r=0;return Zt().forEach((function(a,o){var u=n+r;for(o=i()[t+4*o>>2>>>0]=u,u=0;u<a.length;++u)e()[o++>>0>>>0]=a.charCodeAt(u);e()[o>>0>>>0]=0,r+=a.length+1})),0}function Kt(t,e){if(O)return $t(21,1,t,e);var n=Zt();i()[t>>2>>>0]=n.length;var r=0;return n.forEach((function(t){r+=t.length+1})),i()[e>>2>>>0]=r,0}function te(t){return O?$t(22,1,t):52}function ee(t,e,n,r){return O?$t(23,1,t,e,n,r):52}function ne(t,e,n,r,a){return O?$t(24,1,t,e,n,r,a):70}var re=[null,[],[]];function ae(t,e){var n=re[t];0===e||10===e?((1===t?C:x)(z(n,0)),n.length=0):n.push(e)}function ie(t,e,n,a){if(O)return $t(25,1,t,e,n,a);for(var o=0,u=0;u<n;u++){var c=i()[e>>2>>>0],s=i()[e+4>>2>>>0];e+=8;for(var l=0;l<s;l++)ae(t,r()[c+l>>>0]);o+=s}return i()[a>>2>>>0]=o,0}var oe=0;function ue(t){return 0==t%4&&(0!=t%100||0==t%400)}var ce=[31,29,31,30,31,30,31,31,30,31,30,31],se=[31,28,31,30,31,30,31,31,30,31,30,31];function le(t,n,r,i){function o(t,e,n){for(t="number"==typeof t?t.toString():t||"";t.length<e;)t=n[0]+t;return t}function u(t,e){return o(t,e,"0")}function c(t,e){function n(t){return 0>t?-1:0<t?1:0}var r;return 0===(r=n(t.getFullYear()-e.getFullYear()))&&0===(r=n(t.getMonth()-e.getMonth()))&&(r=n(t.getDate()-e.getDate())),r}function s(t){switch(t.getDay()){case 0:return new Date(t.getFullYear()-1,11,29);case 1:return t;case 2:return new Date(t.getFullYear(),0,3);case 3:return new Date(t.getFullYear(),0,2);case 4:return new Date(t.getFullYear(),0,1);case 5:return new Date(t.getFullYear()-1,11,31);case 6:return new Date(t.getFullYear()-1,11,30)}}function l(t){var e=t.Wb;for(t=new Date(new Date(t.Xb+1900,0,1).getTime());0<e;){var n=t.getMonth(),r=(ue(t.getFullYear())?ce:se)[n];if(!(e>r-t.getDate())){t.setDate(t.getDate()+e);break}e-=r-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return n=new Date(t.getFullYear()+1,0,4),e=s(new Date(t.getFullYear(),0,4)),n=s(n),0>=c(e,t)?0>=c(n,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var f=a()[i+40>>2>>>0];for(var p in i={Lc:a()[i>>2>>>0],Kc:a()[i+4>>2>>>0],dc:a()[i+8>>2>>>0],jc:a()[i+12>>2>>>0],ec:a()[i+16>>2>>>0],Xb:a()[i+20>>2>>>0],Tb:a()[i+24>>2>>>0],Wb:a()[i+28>>2>>>0],Rc:a()[i+32>>2>>>0],Jc:a()[i+36>>2>>>0],Mc:f?Y(f):""},r=Y(r),f={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})r=r.replace(new RegExp(p,"g"),f[p]);var h="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),d="January February March April May June July August September October November December".split(" ");for(p in f={"%a":function(t){return h[t.Tb].substring(0,3)},"%A":function(t){return h[t.Tb]},"%b":function(t){return d[t.ec].substring(0,3)},"%B":function(t){return d[t.ec]},"%C":function(t){return u((t.Xb+1900)/100|0,2)},"%d":function(t){return u(t.jc,2)},"%e":function(t){return o(t.jc,2," ")},"%g":function(t){return l(t).toString().substring(2)},"%G":function(t){return l(t)},"%H":function(t){return u(t.dc,2)},"%I":function(t){return 0==(t=t.dc)?t=12:12<t&&(t-=12),u(t,2)},"%j":function(t){for(var e=0,n=0;n<=t.ec-1;e+=(ue(t.Xb+1900)?ce:se)[n++]);return u(t.jc+e,3)},"%m":function(t){return u(t.ec+1,2)},"%M":function(t){return u(t.Kc,2)},"%n":function(){return"\\n"},"%p":function(t){return 0<=t.dc&&12>t.dc?"AM":"PM"},"%S":function(t){return u(t.Lc,2)},"%t":function(){return"\\t"},"%u":function(t){return t.Tb||7},"%U":function(t){return u(Math.floor((t.Wb+7-t.Tb)/7),2)},"%V":function(t){var e=Math.floor((t.Wb+7-(t.Tb+6)%7)/7);if(2>=(t.Tb+371-t.Wb-2)%7&&e++,e)53==e&&(4==(n=(t.Tb+371-t.Wb)%7)||3==n&&ue(t.Xb)||(e=1));else{e=52;var n=(t.Tb+7-t.Wb-1)%7;(4==n||5==n&&ue(t.Xb%400-1))&&e++}return u(e,2)},"%w":function(t){return t.Tb},"%W":function(t){return u(Math.floor((t.Wb+7-(t.Tb+6)%7)/7),2)},"%y":function(t){return(t.Xb+1900).toString().substring(2)},"%Y":function(t){return t.Xb+1900},"%z":function(t){var e=0<=(t=t.Jc);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.Mc},"%%":function(){return"%"}},r=r.replace(/%%/g,"\\0\\0"),f)r.includes(p)&&(r=r.replace(new RegExp(p,"g"),f[p](i)));return p=function(t){var e=Array(G(t)+1);return B(t,e,0,e.length),e}(r=r.replace(/\\0\\0/g,"%")),p.length>n?0:(function(t,n){e().set(t,n>>>0)}(p,t),p.length-1)}ht.fc();var fe=[null,ft,bt,Et,Ct,xt,Rt,jt,kt,Dt,Pt,Ut,Ft,It,Wt,Ht,Lt,Bt,Gt,Vt,Qt,Kt,te,ee,ne,ie],pe={b:function(t){return de(t+24)+24},n:function(t){return(t=new St(t)).uc()||(t.hc(!0),Ot--),t.ic(!1),_t.push(t),t.sc(),t.vc()},ma:function(t){throw x("Unexpected exception thrown, this is not properly supported - aborting"),H=!0,t},x:function(){Se(0);var t=_t.pop();if(t.Hc()&&!t.kc()){var e=t.Dc();e&&gt(e)(t.Zb),Tt(t.Zb)}At=0},e:function(){var t=At;if(!t)return oe=0;var e=new St(t);e.cc(t);var n=e.bc();if(!n)return oe=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;a<r.length;a++){var i=r[a];if(0===i||i===n)break;if(xe(i,n,e.Sb+16))return oe=i,t}return oe=n,t},l:function(){var t=At;if(!t)return oe=0;var e=new St(t);e.cc(t);var n=e.bc();if(!n)return oe=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;a<r.length;a++){var i=r[a];if(0===i||i===n)break;if(xe(i,n,e.Sb+16))return oe=i,t}return oe=n,t},h:function(){var t=At;if(!t)return oe=0;var e=new St(t);e.cc(t);var n=e.bc();if(!n)return oe=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;a<r.length;a++){var i=r[a];if(0===i||i===n)break;if(xe(i,n,e.Sb+16))return oe=i,t}return oe=n,t},t:Tt,M:function(){var t=_t.pop();t||at("no exception to throw");var e=t.Zb;throw t.kc()||(_t.push(t),t.ic(!0),t.hc(!1),Ot++),At=e,e},c:function(t,e,n){throw new St(t).fc(e,n),At=t,Ot++,t},pa:function(){return Ot},Fa:function(t){ge(t,!w,1,!v),ht.pc()},T:function(t){O?postMessage({cmd:"cleanupThread",thread:t}):st(t)},xa:Mt,j:function(t){throw At||(At=t),t},H:Ct,Ma:xt,ua:Rt,wa:jt,oa:kt,Ka:Dt,Ca:Pt,Ja:Ut,V:Ft,va:It,sa:Wt,La:Ht,ta:Lt,Ta:function(){},X:function(){at("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},Ua:function(){at("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},W:function(){return Date.now()},ya:function(){return 2097152},Oa:function(){return!0},za:function(t,e,n,r){if(t==e)setTimeout((()=>zt(r)));else if(O)postMessage({targetThread:t,cmd:"processProxyingQueue",queue:r});else{if(!(t=ht.Vb[t]))return;t.postMessage({cmd:"processProxyingQueue",queue:r})}return 1},Ea:function(){return-1},Pa:function(t,e){t=new Date(1e3*Yt(t)),a()[e>>2>>>0]=t.getUTCSeconds(),a()[e+4>>2>>>0]=t.getUTCMinutes(),a()[e+8>>2>>>0]=t.getUTCHours(),a()[e+12>>2>>>0]=t.getUTCDate(),a()[e+16>>2>>>0]=t.getUTCMonth(),a()[e+20>>2>>>0]=t.getUTCFullYear()-1900,a()[e+24>>2>>>0]=t.getUTCDay(),t=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,a()[e+28>>2>>>0]=t},Qa:function(t,e){t=new Date(1e3*Yt(t)),a()[e>>2>>>0]=t.getSeconds(),a()[e+4>>2>>>0]=t.getMinutes(),a()[e+8>>2>>>0]=t.getHours(),a()[e+12>>2>>>0]=t.getDate(),a()[e+16>>2>>>0]=t.getMonth(),a()[e+20>>2>>>0]=t.getFullYear()-1900,a()[e+24>>2>>>0]=t.getDay();var n=new Date(t.getFullYear(),0,1),r=(t.getTime()-n.getTime())/864e5|0;a()[e+28>>2>>>0]=r,a()[e+36>>2>>>0]=-60*t.getTimezoneOffset(),r=new Date(t.getFullYear(),6,1).getTimezoneOffset(),t=0|(r!=(n=n.getTimezoneOffset())&&t.getTimezoneOffset()==Math.min(n,r)),a()[e+32>>2>>>0]=t},Ra:function(t){var e=new Date(a()[t+20>>2>>>0]+1900,a()[t+16>>2>>>0],a()[t+12>>2>>>0],a()[t+8>>2>>>0],a()[t+4>>2>>>0],a()[t>>2>>>0],0),n=a()[t+32>>2>>>0],r=e.getTimezoneOffset(),i=new Date(e.getFullYear(),0,1),o=new Date(e.getFullYear(),6,1).getTimezoneOffset(),u=i.getTimezoneOffset(),c=Math.min(u,o);return 0>n?a()[t+32>>2>>>0]=Number(o!=u&&c==r):0<n!=(c==r)&&(o=Math.max(u,o),e.setTime(e.getTime()+6e4*((0<n?c:o)-r))),a()[t+24>>2>>>0]=e.getDay(),n=(e.getTime()-i.getTime())/864e5|0,a()[t+28>>2>>>0]=n,a()[t>>2>>>0]=e.getSeconds(),a()[t+4>>2>>>0]=e.getMinutes(),a()[t+8>>2>>>0]=e.getHours(),a()[t+12>>2>>>0]=e.getDate(),a()[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},Aa:Bt,Ba:Gt,Sa:function t(e,n,r){t.Ac||(t.Ac=!0,Vt(e,n,r))},y:function(){at("")},U:function(){if(!_&&!w){var t="Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";vt||(vt={}),vt[t]||(vt[t]=1,_&&(t="warning: "+t),x(t))}},ra:function(){return 4294901760},B:wt,Ia:function(t,e,n){r().copyWithin(t>>>0,e>>>0,e+n>>>0)},F:function(){return _?n(993).cpus().length:navigator.hardwareConcurrency},Da:function(t,e,n){Xt.length=e,n>>=3;for(var r=0;r<e;r++)Xt[r]=o()[n+r>>>0];return(0>t?ut[-t-1]:fe[t]).apply(null,Xt)},qa:function(t){var e=r().length;if((t>>>=0)<=e||4294901760<t)return!1;for(var n=1;4>=n;n*=2){var a=e*(1+.2/n);a=Math.min(a,t+100663296);var i=Math;a=Math.max(t,a),i=i.min.call(i,4294901760,a+(65536-a%65536)%65536);t:{try{j.grow(i-D.byteLength+65535>>>16),N(j.buffer);var o=1;break t}catch(t){}o=void 0}if(o)return!0}return!1},Na:function(){throw"unwind"},Ga:Qt,Ha:Kt,J:pt,I:te,S:ee,ga:ne,R:ie,d:function(){return oe},na:function t(r,a){t.lc||(t.lc=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return()=>(crypto.getRandomValues(t),t[0])}if(_)try{var e=n(Object(function(){var t=new Error("Cannot find module \'crypto\'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>at("randomDevice")}());for(var i=0;i<a;i++)e()[r+i>>0>>>0]=t.lc();return 0},ia:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},ja:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},K:function(t){var e=Ee();try{return gt(t)()}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},f:function(t,e){var n=Ee();try{return gt(t)(e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},P:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},Q:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},k:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},p:function(t,e,n,r){var a=Ee();try{return gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},q:function(t,e,n,r,a){var i=Ee();try{return gt(t)(e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},N:function(t,e,n,r,a,i){var o=Ee();try{return gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},s:function(t,e,n,r,a,i){var o=Ee();try{return gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},w:function(t,e,n,r,a,i,o){var u=Ee();try{return gt(t)(e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},L:function(t,e,n,r,a,i,o,u){var c=Ee();try{return gt(t)(e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},E:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=Ee();try{return gt(t)(e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(Me(p),t!==t+0)throw t;Se(1,0)}},aa:function(t,e,n,r,a,i,o,u){var c=Ee();try{return He(t,e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},_:function(t,e,n,r,a,i,o){var u=Ee();try{return ke(t,e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},Z:function(t,e,n,r,a){var i=Ee();try{return Le(t,e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},ca:function(t,e,n,r){var a=Ee();try{return Ie(t,e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},$:function(t){var e=Ee();try{return je(t)}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},ba:function(t,e){var n=Ee();try{return We(t,e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},Y:function(t,e,n){var r=Ee();try{return De(t,e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},g:function(t){var e=Ee();try{gt(t)()}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},r:function(t,e){var n=Ee();try{gt(t)(e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},i:function(t,e,n){var r=Ee();try{gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},ha:function(t,e,n,r){var a=Ee();try{gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},m:function(t,e,n,r){var a=Ee();try{gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},v:function(t,e,n,r,a){var i=Ee();try{gt(t)(e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},u:function(t,e,n,r,a,i){var o=Ee();try{gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},O:function(t,e,n,r,a,i,o){var u=Ee();try{gt(t)(e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},A:function(t,e,n,r,a,i,o,u){var c=Ee();try{gt(t)(e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},ka:function(t,e,n,r,a,i,o,u,c){var s=Ee();try{gt(t)(e,n,r,a,i,o,u,c)}catch(t){if(Me(s),t!==t+0)throw t;Se(1,0)}},C:function(t,e,n,r,a,i,o,u,c,s,l){var f=Ee();try{gt(t)(e,n,r,a,i,o,u,c,s,l)}catch(t){if(Me(f),t!==t+0)throw t;Se(1,0)}},D:function(t,e,n,r,a,i,o,u,c,s,l,f,p,h,d,y){var b=Ee();try{gt(t)(e,n,r,a,i,o,u,c,s,l,f,p,h,d,y)}catch(t){if(Me(b),t!==t+0)throw t;Se(1,0)}},fa:function(t,e,n,r,a,i,o,u){var c=Ee();try{Pe(t,e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},da:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=Ee();try{Fe(t,e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(Me(p),t!==t+0)throw t;Se(1,0)}},ea:function(t,e,n,r,a,i){var o=Ee();try{Ue(t,e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},o:function(t){return t},a:j||u.wasmMemory,G:function(t){oe=t},la:le,z:function(t,e,n,r){return le(t,e,n,r)}};!function(){function t(t,e){u.asm=t.exports,ht.qc.push(u.asm.sb),$=u.asm.ub,X.unshift(u.asm.Va),k=e,O||(et--,u.monitorRunDependencies&&u.monitorRunDependencies(et),0==et&&(null!==nt&&(clearInterval(nt),nt=null),rt&&(t=rt,rt=null,t())))}function e(e){t(e.instance,e.module)}function n(t){return function(){if(!M&&(v||w)){if("function"==typeof fetch&&!tt.startsWith("file://"))return fetch(tt,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at \'"+tt+"\'";return t.arrayBuffer()})).catch((function(){return ot()}));if(f)return new Promise((function(t,e){f(tt,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return ot()}))}().then((function(t){return WebAssembly.instantiate(t,r)})).then((function(t){return t})).then(t,(function(t){x("failed to asynchronously prepare wasm: "+t),at(t)}))}var r={a:pe};if(O||(et++,u.monitorRunDependencies&&u.monitorRunDependencies(et)),u.instantiateWasm)try{return u.instantiateWasm(r,t)}catch(t){return x("Module.instantiateWasm callback failed with error: "+t),!1}(M||"function"!=typeof WebAssembly.instantiateStreaming||it()||tt.startsWith("file://")||_||"function"!=typeof fetch?n(e):fetch(tt,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,r).then(e,(function(t){return x("wasm streaming compile failed: "+t),x("falling back to ArrayBuffer instantiation"),n(e)}))}))).catch(s)}(),u.___wasm_call_ctors=function(){return(u.___wasm_call_ctors=u.asm.Va).apply(null,arguments)},u._OrtInit=function(){return(u._OrtInit=u.asm.Wa).apply(null,arguments)},u._OrtCreateSessionOptions=function(){return(u._OrtCreateSessionOptions=u.asm.Xa).apply(null,arguments)},u._OrtAppendExecutionProvider=function(){return(u._OrtAppendExecutionProvider=u.asm.Ya).apply(null,arguments)},u._OrtAddSessionConfigEntry=function(){return(u._OrtAddSessionConfigEntry=u.asm.Za).apply(null,arguments)},u._OrtReleaseSessionOptions=function(){return(u._OrtReleaseSessionOptions=u.asm._a).apply(null,arguments)},u._OrtCreateSession=function(){return(u._OrtCreateSession=u.asm.$a).apply(null,arguments)},u._OrtReleaseSession=function(){return(u._OrtReleaseSession=u.asm.ab).apply(null,arguments)},u._OrtGetInputCount=function(){return(u._OrtGetInputCount=u.asm.bb).apply(null,arguments)},u._OrtGetOutputCount=function(){return(u._OrtGetOutputCount=u.asm.cb).apply(null,arguments)},u._OrtGetInputName=function(){return(u._OrtGetInputName=u.asm.db).apply(null,arguments)},u._OrtGetOutputName=function(){return(u._OrtGetOutputName=u.asm.eb).apply(null,arguments)},u._OrtFree=function(){return(u._OrtFree=u.asm.fb).apply(null,arguments)},u._OrtCreateTensor=function(){return(u._OrtCreateTensor=u.asm.gb).apply(null,arguments)},u._OrtGetTensorData=function(){return(u._OrtGetTensorData=u.asm.hb).apply(null,arguments)},u._OrtReleaseTensor=function(){return(u._OrtReleaseTensor=u.asm.ib).apply(null,arguments)},u._OrtCreateRunOptions=function(){return(u._OrtCreateRunOptions=u.asm.jb).apply(null,arguments)},u._OrtAddRunConfigEntry=function(){return(u._OrtAddRunConfigEntry=u.asm.kb).apply(null,arguments)},u._OrtReleaseRunOptions=function(){return(u._OrtReleaseRunOptions=u.asm.lb).apply(null,arguments)},u._OrtRun=function(){return(u._OrtRun=u.asm.mb).apply(null,arguments)},u._OrtEndProfiling=function(){return(u._OrtEndProfiling=u.asm.nb).apply(null,arguments)};var he=u._pthread_self=function(){return(he=u._pthread_self=u.asm.ob).apply(null,arguments)},de=u._malloc=function(){return(de=u._malloc=u.asm.pb).apply(null,arguments)},ye=u._free=function(){return(ye=u._free=u.asm.qb).apply(null,arguments)},be=u._fflush=function(){return(be=u._fflush=u.asm.rb).apply(null,arguments)};u.__emscripten_tls_init=function(){return(u.__emscripten_tls_init=u.asm.sb).apply(null,arguments)};var me=u.___funcs_on_exit=function(){return(me=u.___funcs_on_exit=u.asm.tb).apply(null,arguments)},ge=u.__emscripten_thread_init=function(){return(ge=u.__emscripten_thread_init=u.asm.vb).apply(null,arguments)};u.__emscripten_thread_crashed=function(){return(u.__emscripten_thread_crashed=u.asm.wb).apply(null,arguments)};var ve,we=u._emscripten_run_in_main_runtime_thread_js=function(){return(we=u._emscripten_run_in_main_runtime_thread_js=u.asm.xb).apply(null,arguments)},_e=u.__emscripten_proxy_execute_task_queue=function(){return(_e=u.__emscripten_proxy_execute_task_queue=u.asm.yb).apply(null,arguments)},Oe=u.__emscripten_thread_free_data=function(){return(Oe=u.__emscripten_thread_free_data=u.asm.zb).apply(null,arguments)},Ae=u.__emscripten_thread_exit=function(){return(Ae=u.__emscripten_thread_exit=u.asm.Ab).apply(null,arguments)},Se=u._setThrew=function(){return(Se=u._setThrew=u.asm.Bb).apply(null,arguments)},Te=u._emscripten_stack_set_limits=function(){return(Te=u._emscripten_stack_set_limits=u.asm.Cb).apply(null,arguments)},Ee=u.stackSave=function(){return(Ee=u.stackSave=u.asm.Db).apply(null,arguments)},Me=u.stackRestore=function(){return(Me=u.stackRestore=u.asm.Eb).apply(null,arguments)},Ce=u.stackAlloc=function(){return(Ce=u.stackAlloc=u.asm.Fb).apply(null,arguments)},xe=u.___cxa_can_catch=function(){return(xe=u.___cxa_can_catch=u.asm.Gb).apply(null,arguments)},Re=u.___cxa_is_pointer_type=function(){return(Re=u.___cxa_is_pointer_type=u.asm.Hb).apply(null,arguments)},je=u.dynCall_j=function(){return(je=u.dynCall_j=u.asm.Ib).apply(null,arguments)},ke=u.dynCall_iiiiij=function(){return(ke=u.dynCall_iiiiij=u.asm.Jb).apply(null,arguments)},De=u.dynCall_jii=function(){return(De=u.dynCall_jii=u.asm.Kb).apply(null,arguments)},Pe=u.dynCall_viiiiij=function(){return(Pe=u.dynCall_viiiiij=u.asm.Lb).apply(null,arguments)},Ue=u.dynCall_vjji=function(){return(Ue=u.dynCall_vjji=u.asm.Mb).apply(null,arguments)},Fe=u.dynCall_viiijjjii=function(){return(Fe=u.dynCall_viiijjjii=u.asm.Nb).apply(null,arguments)},Ie=u.dynCall_iij=function(){return(Ie=u.dynCall_iij=u.asm.Ob).apply(null,arguments)},We=u.dynCall_ji=function(){return(We=u.dynCall_ji=u.asm.Pb).apply(null,arguments)},He=u.dynCall_iiiiiij=function(){return(He=u.dynCall_iiiiiij=u.asm.Qb).apply(null,arguments)},Le=u.dynCall_iiij=function(){return(Le=u.dynCall_iiij=u.asm.Rb).apply(null,arguments)};function ze(){function t(){if(!ve&&(ve=!0,u.calledRun=!0,!H)&&(O||dt(X),c(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),!O)){if(u.postRun)for("function"==typeof u.postRun&&(u.postRun=[u.postRun]);u.postRun.length;){var t=u.postRun.shift();Z.unshift(t)}dt(Z)}}if(!(0<et))if(O)c(u),O||dt(X),postMessage({cmd:"loaded"});else{if(u.preRun)for("function"==typeof u.preRun&&(u.preRun=[u.preRun]);u.preRun.length;)K();dt(q),0<et||(u.setStatus?(u.setStatus("Running..."),setTimeout((function(){setTimeout((function(){u.setStatus("")}),1),t()}),1)):t())}}if(u.UTF8ToString=Y,u.stringToUTF8=function(t,e,n){return B(t,r(),e,n)},u.lengthBytesUTF8=G,u.keepRuntimeAlive=Q,u.wasmMemory=j,u.stackSave=Ee,u.stackRestore=Me,u.stackAlloc=Ce,u.ExitStatus=ct,u.PThread=ht,rt=function t(){ve||ze(),ve||(rt=t)},u.preInit)for("function"==typeof u.preInit&&(u.preInit=[u.preInit]);0<u.preInit.length;)u.preInit.pop()();return ze(),t.ready});t.exports=r},932:(t,e,n)=>{var _scriptDir,r=(_scriptDir=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){var e,r,a;t=t||{},e||(e=void 0!==t?t:{}),e.ready=new Promise((function(t,e){r=t,a=e}));var i,o,u,c,s,l,f=Object.assign({},e),p="./this.program",h=(t,e)=>{throw e},d="object"==typeof window,y="function"==typeof importScripts,b="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,m="";b?(m=y?n(908).dirname(m)+"/":"//",l=()=>{s||(c=n(384),s=n(908))},i=function(t,e){return l(),t=s.normalize(t),c.readFileSync(t,e?void 0:"utf8")},u=t=>((t=i(t,!0)).buffer||(t=new Uint8Array(t)),t),o=(t,e,n)=>{l(),t=s.normalize(t),c.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1<process.argv.length&&(p=process.argv[1].replace(/\\\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",(function(t){if(!(t instanceof J))throw t})),process.on("unhandledRejection",(function(t){throw t})),h=(t,e)=>{if(_||0<L)throw process.exitCode=t,e;e instanceof J||w("exiting due to exception: "+e),process.exit(t)},e.inspect=function(){return"[Emscripten Module object]"}):(d||y)&&(y?m=self.location.href:"undefined"!=typeof document&&document.currentScript&&(m=document.currentScript.src),_scriptDir&&(m=_scriptDir),m=0!==m.indexOf("blob:")?m.substr(0,m.replace(/[?#].*/,"").lastIndexOf("/")+1):"",i=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},y&&(u=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),o=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)});var g,v=e.print||console.log.bind(console),w=e.printErr||console.warn.bind(console);Object.assign(e,f),f=null,e.thisProgram&&(p=e.thisProgram),e.quit&&(h=e.quit),e.wasmBinary&&(g=e.wasmBinary);var _=e.noExitRuntime||!1;"object"!=typeof WebAssembly&&V("no native wasm support detected");var O,A,S,T,E,M,C=!1,x="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function R(t,e,n){var r=(e>>>=0)+n;for(n=e;t[n]&&!(n>=r);)++n;if(16<n-e&&t.buffer&&x)return x.decode(t.subarray(e,n));for(r="";e<n;){var a=t[e++];if(128&a){var i=63&t[e++];if(192==(224&a))r+=String.fromCharCode((31&a)<<6|i);else{var o=63&t[e++];65536>(a=224==(240&a)?(15&a)<<12|i<<6|o:(7&a)<<18|i<<12|o<<6|63&t[e++])?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else r+=String.fromCharCode(a)}return r}function j(t,e){return(t>>>=0)?R(T,t,e):""}function k(t,e,n,r){if(!(0<r))return 0;var a=n>>>=0;r=n+r-1;for(var i=0;i<t.length;++i){var o=t.charCodeAt(i);if(55296<=o&&57343>=o&&(o=65536+((1023&o)<<10)|1023&t.charCodeAt(++i)),127>=o){if(n>=r)break;e[n++>>>0]=o}else{if(2047>=o){if(n+1>=r)break;e[n++>>>0]=192|o>>6}else{if(65535>=o){if(n+2>=r)break;e[n++>>>0]=224|o>>12}else{if(n+3>=r)break;e[n++>>>0]=240|o>>18,e[n++>>>0]=128|o>>12&63}e[n++>>>0]=128|o>>6&63}e[n++>>>0]=128|63&o}}return e[n>>>0]=0,n-a}function D(t){for(var e=0,n=0;n<t.length;++n){var r=t.charCodeAt(n);127>=r?e++:2047>=r?e+=2:55296<=r&&57343>=r?(e+=4,++n):e+=3}return e}function P(){var t=O.buffer;A=t,e.HEAP8=S=new Int8Array(t),e.HEAP16=new Int16Array(t),e.HEAP32=E=new Int32Array(t),e.HEAPU8=T=new Uint8Array(t),e.HEAPU16=new Uint16Array(t),e.HEAPU32=M=new Uint32Array(t),e.HEAPF32=new Float32Array(t),e.HEAPF64=new Float64Array(t)}var U,F=[],I=[],W=[],H=[],L=0;function z(){var t=e.preRun.shift();F.unshift(t)}var Y,B=0,G=null,N=null;function V(t){throw e.onAbort&&e.onAbort(t),w(t="Aborted("+t+")"),C=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),a(t),t}function $(){return Y.startsWith("data:application/octet-stream;base64,")}if(Y="ort-wasm.wasm",!$()){var q=Y;Y=e.locateFile?e.locateFile(q,m):m+q}function X(){var t=Y;try{if(t==Y&&g)return new Uint8Array(g);if(u)return u(t);throw"both async and sync fetching of the wasm failed"}catch(t){V(t)}}function J(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function Z(t){for(;0<t.length;)t.shift()(e)}var Q=[],K=0,tt=0;function et(t){this.Db=t,this.zb=t-24,this.Ub=function(t){M[this.zb+4>>2>>>0]=t},this.Eb=function(){return M[this.zb+4>>2>>>0]},this.Sb=function(t){M[this.zb+8>>2>>>0]=t},this.Wb=function(){return M[this.zb+8>>2>>>0]},this.Tb=function(){E[this.zb>>2>>>0]=0},this.Ib=function(t){S[this.zb+12>>0>>>0]=t?1:0},this.Pb=function(){return 0!=S[this.zb+12>>0>>>0]},this.Jb=function(t){S[this.zb+13>>0>>>0]=t?1:0},this.Lb=function(){return 0!=S[this.zb+13>>0>>>0]},this.Rb=function(t,e){this.Fb(0),this.Ub(t),this.Sb(e),this.Tb(),this.Ib(!1),this.Jb(!1)},this.Nb=function(){E[this.zb>>2>>>0]+=1},this.Xb=function(){var t=E[this.zb>>2>>>0];return E[this.zb>>2>>>0]=t-1,1===t},this.Fb=function(t){M[this.zb+16>>2>>>0]=t},this.Ob=function(){return M[this.zb+16>>2>>>0]},this.Qb=function(){if(Mt(this.Eb()))return M[this.Db>>2>>>0];var t=this.Ob();return 0!==t?t:this.Db}}function nt(t){return vt(new et(t).zb)}var rt=[];function at(t){var e=rt[t];return e||(t>=rt.length&&(rt.length=t+1),rt[t]=e=U.get(t)),e}function it(t){var e=D(t)+1,n=gt(e);return n&&k(t,S,n,e),n}var ot={};function ut(){if(!ct){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:p||"./this.program"};for(t in ot)void 0===ot[t]?delete e[t]:e[t]=ot[t];var n=[];for(t in e)n.push(t+"="+e[t]);ct=n}return ct}var ct,st=[null,[],[]];function lt(t,e){var n=st[t];0===e||10===e?((1===t?v:w)(R(n,0)),n.length=0):n.push(e)}var ft=0;function pt(t){return 0==t%4&&(0!=t%100||0==t%400)}var ht=[31,29,31,30,31,30,31,31,30,31,30,31],dt=[31,28,31,30,31,30,31,31,30,31,30,31];function yt(t,e,n,r){function a(t,e,n){for(t="number"==typeof t?t.toString():t||"";t.length<e;)t=n[0]+t;return t}function i(t,e){return a(t,e,"0")}function o(t,e){function n(t){return 0>t?-1:0<t?1:0}var r;return 0===(r=n(t.getFullYear()-e.getFullYear()))&&0===(r=n(t.getMonth()-e.getMonth()))&&(r=n(t.getDate()-e.getDate())),r}function u(t){switch(t.getDay()){case 0:return new Date(t.getFullYear()-1,11,29);case 1:return t;case 2:return new Date(t.getFullYear(),0,3);case 3:return new Date(t.getFullYear(),0,2);case 4:return new Date(t.getFullYear(),0,1);case 5:return new Date(t.getFullYear()-1,11,31);case 6:return new Date(t.getFullYear()-1,11,30)}}function c(t){var e=t.Bb;for(t=new Date(new Date(t.Cb+1900,0,1).getTime());0<e;){var n=t.getMonth(),r=(pt(t.getFullYear())?ht:dt)[n];if(!(e>r-t.getDate())){t.setDate(t.getDate()+e);break}e-=r-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return n=new Date(t.getFullYear()+1,0,4),e=u(new Date(t.getFullYear(),0,4)),n=u(n),0>=o(e,t)?0>=o(n,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var s=E[r+40>>2>>>0];for(var l in r={$b:E[r>>2>>>0],Zb:E[r+4>>2>>>0],Gb:E[r+8>>2>>>0],Kb:E[r+12>>2>>>0],Hb:E[r+16>>2>>>0],Cb:E[r+20>>2>>>0],Ab:E[r+24>>2>>>0],Bb:E[r+28>>2>>>0],bc:E[r+32>>2>>>0],Yb:E[r+36>>2>>>0],ac:s?j(s):""},n=j(n),s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})n=n.replace(new RegExp(l,"g"),s[l]);var f="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),p="January February March April May June July August September October November December".split(" ");for(l in s={"%a":function(t){return f[t.Ab].substring(0,3)},"%A":function(t){return f[t.Ab]},"%b":function(t){return p[t.Hb].substring(0,3)},"%B":function(t){return p[t.Hb]},"%C":function(t){return i((t.Cb+1900)/100|0,2)},"%d":function(t){return i(t.Kb,2)},"%e":function(t){return a(t.Kb,2," ")},"%g":function(t){return c(t).toString().substring(2)},"%G":function(t){return c(t)},"%H":function(t){return i(t.Gb,2)},"%I":function(t){return 0==(t=t.Gb)?t=12:12<t&&(t-=12),i(t,2)},"%j":function(t){for(var e=0,n=0;n<=t.Hb-1;e+=(pt(t.Cb+1900)?ht:dt)[n++]);return i(t.Kb+e,3)},"%m":function(t){return i(t.Hb+1,2)},"%M":function(t){return i(t.Zb,2)},"%n":function(){return"\\n"},"%p":function(t){return 0<=t.Gb&&12>t.Gb?"AM":"PM"},"%S":function(t){return i(t.$b,2)},"%t":function(){return"\\t"},"%u":function(t){return t.Ab||7},"%U":function(t){return i(Math.floor((t.Bb+7-t.Ab)/7),2)},"%V":function(t){var e=Math.floor((t.Bb+7-(t.Ab+6)%7)/7);if(2>=(t.Ab+371-t.Bb-2)%7&&e++,e)53==e&&(4==(n=(t.Ab+371-t.Bb)%7)||3==n&&pt(t.Cb)||(e=1));else{e=52;var n=(t.Ab+7-t.Bb-1)%7;(4==n||5==n&&pt(t.Cb%400-1))&&e++}return i(e,2)},"%w":function(t){return t.Ab},"%W":function(t){return i(Math.floor((t.Bb+7-(t.Ab+6)%7)/7),2)},"%y":function(t){return(t.Cb+1900).toString().substring(2)},"%Y":function(t){return t.Cb+1900},"%z":function(t){var e=0<=(t=t.Yb);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.ac},"%%":function(){return"%"}},n=n.replace(/%%/g,"\\0\\0"),s)n.includes(l)&&(n=n.replace(new RegExp(l,"g"),s[l](r)));return l=function(t){var e=Array(D(t)+1);return k(t,e,0,e.length),e}(n=n.replace(/\\0\\0/g,"%")),l.length>e?0:(S.set(l,t>>>0),l.length-1)}var bt={a:function(t){return gt(t+24)+24},m:function(t){return(t=new et(t)).Pb()||(t.Ib(!0),K--),t.Jb(!1),Q.push(t),t.Nb(),t.Qb()},ia:function(t){throw w("Unexpected exception thrown, this is not properly supported - aborting"),C=!0,t},w:function(){Ot(0);var t=Q.pop();if(t.Xb()&&!t.Lb()){var e=t.Wb();e&&at(e)(t.Db),nt(t.Db)}tt=0},d:function(){var t=tt;if(!t)return ft=0;var e=new et(t);e.Fb(t);var n=e.Eb();if(!n)return ft=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;a<r.length;a++){var i=r[a];if(0===i||i===n)break;if(Et(i,n,e.zb+16))return ft=i,t}return ft=n,t},k:function(){var t=tt;if(!t)return ft=0;var e=new et(t);e.Fb(t);var n=e.Eb();if(!n)return ft=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;a<r.length;a++){var i=r[a];if(0===i||i===n)break;if(Et(i,n,e.zb+16))return ft=i,t}return ft=n,t},g:function(){var t=tt;if(!t)return ft=0;var e=new et(t);e.Fb(t);var n=e.Eb();if(!n)return ft=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;a<r.length;a++){var i=r[a];if(0===i||i===n)break;if(Et(i,n,e.zb+16))return ft=i,t}return ft=n,t},s:nt,L:function(){var t=Q.pop();t||V("no exception to throw");var e=t.Db;throw t.Lb()||(Q.push(t),t.Jb(!0),t.Ib(!1),K++),tt=e,e},b:function(t,e,n){throw new et(t).Rb(e,n),tt=t,K++,t},la:function(){return K},i:function(t){throw tt||(tt=t),t},H:function(){return 0},Ba:function(){},pa:function(){},ra:function(){},ka:function(){return 0},za:function(){},ua:function(){},ya:function(){},R:function(){},qa:function(){},na:function(){},Aa:function(){},oa:function(){},Ha:function(){},Ja:function(){V("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},Ia:function(){V("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},S:function(){return Date.now()},Ca:function(){return!0},Da:function(t,e){t=new Date(1e3*(M[t>>>2]+4294967296*E[t+4>>>2])),E[e>>2>>>0]=t.getUTCSeconds(),E[e+4>>2>>>0]=t.getUTCMinutes(),E[e+8>>2>>>0]=t.getUTCHours(),E[e+12>>2>>>0]=t.getUTCDate(),E[e+16>>2>>>0]=t.getUTCMonth(),E[e+20>>2>>>0]=t.getUTCFullYear()-1900,E[e+24>>2>>>0]=t.getUTCDay(),E[e+28>>2>>>0]=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},Ea:function(t,e){t=new Date(1e3*(M[t>>>2]+4294967296*E[t+4>>>2])),E[e>>2>>>0]=t.getSeconds(),E[e+4>>2>>>0]=t.getMinutes(),E[e+8>>2>>>0]=t.getHours(),E[e+12>>2>>>0]=t.getDate(),E[e+16>>2>>>0]=t.getMonth(),E[e+20>>2>>>0]=t.getFullYear()-1900,E[e+24>>2>>>0]=t.getDay();var n=new Date(t.getFullYear(),0,1);E[e+28>>2>>>0]=(t.getTime()-n.getTime())/864e5|0,E[e+36>>2>>>0]=-60*t.getTimezoneOffset();var r=new Date(t.getFullYear(),6,1).getTimezoneOffset();n=n.getTimezoneOffset(),E[e+32>>2>>>0]=0|(r!=n&&t.getTimezoneOffset()==Math.min(n,r))},Fa:function(t){var e=new Date(E[t+20>>2>>>0]+1900,E[t+16>>2>>>0],E[t+12>>2>>>0],E[t+8>>2>>>0],E[t+4>>2>>>0],E[t>>2>>>0],0),n=E[t+32>>2>>>0],r=e.getTimezoneOffset(),a=new Date(e.getFullYear(),0,1),i=new Date(e.getFullYear(),6,1).getTimezoneOffset(),o=a.getTimezoneOffset(),u=Math.min(o,i);return 0>n?E[t+32>>2>>>0]=Number(i!=o&&u==r):0<n!=(u==r)&&(i=Math.max(o,i),e.setTime(e.getTime()+6e4*((0<n?u:i)-r))),E[t+24>>2>>>0]=e.getDay(),E[t+28>>2>>>0]=(e.getTime()-a.getTime())/864e5|0,E[t>>2>>>0]=e.getSeconds(),E[t+4>>2>>>0]=e.getMinutes(),E[t+8>>2>>>0]=e.getHours(),E[t+12>>2>>>0]=e.getDate(),E[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},sa:function(){return-52},ta:function(){},Ga:function t(e,n,r){t.Vb||(t.Vb=!0,function(t,e,n){function r(t){return(t=t.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?t[1]:"GMT"}var a=(new Date).getFullYear(),i=new Date(a,0,1),o=new Date(a,6,1);a=i.getTimezoneOffset();var u=o.getTimezoneOffset();E[t>>2>>>0]=60*Math.max(a,u),E[e>>2>>>0]=Number(a!=u),t=r(i),e=r(o),t=it(t),e=it(e),u<a?(M[n>>2>>>0]=t,M[n+4>>2>>>0]=e):(M[n>>2>>>0]=e,M[n+4>>2>>>0]=t)}(e,n,r))},B:function(){V("")},ma:function(){return 4294901760},I:b?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:()=>performance.now(),xa:function(t,e,n){T.copyWithin(t>>>0,e>>>0,e+n>>>0)},G:function(t){var e=T.length;if(4294901760<(t>>>=0))return!1;for(var n=1;4>=n;n*=2){var r=e*(1+.2/n);r=Math.min(r,t+100663296);var a=Math;r=Math.max(t,r),a=a.min.call(a,4294901760,r+(65536-r%65536)%65536);t:{try{O.grow(a-A.byteLength+65535>>>16),P();var i=1;break t}catch(t){}i=void 0}if(i)return!0}return!1},va:function(t,e){var n=0;return ut().forEach((function(r,a){var i=e+n;for(a=M[t+4*a>>2>>>0]=i,i=0;i<r.length;++i)S[a++>>0>>>0]=r.charCodeAt(i);S[a>>0>>>0]=0,n+=r.length+1})),0},wa:function(t,e){var n=ut();M[t>>2>>>0]=n.length;var r=0;return n.forEach((function(t){r+=t.length+1})),M[e>>2>>>0]=r,0},ba:function(t){_||0<L||(_t(),Z(W),wt(0),st[1].length&&lt(1,10),st[2].length&&lt(2,10)),_||0<L||(e.onExit&&e.onExit(t),C=!0),h(t,new J(t))},E:function(){return 52},Q:function(){return 52},ca:function(){return 70},P:function(t,e,n,r){for(var a=0,i=0;i<n;i++){var o=M[e>>2>>>0],u=M[e+4>>2>>>0];e+=8;for(var c=0;c<u;c++)lt(t,T[o+c>>>0]);a+=u}return M[r>>2>>>0]=a,0},c:function(){return ft},ja:function t(e,r){t.Mb||(t.Mb=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return()=>(crypto.getRandomValues(t),t[0])}if(b)try{var e=n(Object(function(){var t=new Error("Cannot find module \'crypto\'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>V("randomDevice")}());for(var a=0;a<r;a++)S[e+a>>0>>>0]=t.Mb();return 0},ea:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},fa:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},J:function(t){var e=At();try{return at(t)()}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},e:function(t,e){var n=At();try{return at(t)(e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},N:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},O:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},j:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},o:function(t,e,n,r){var a=At();try{return at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},p:function(t,e,n,r,a){var i=At();try{return at(t)(e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},M:function(t,e,n,r,a,i){var o=At();try{return at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},r:function(t,e,n,r,a,i){var o=At();try{return at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},v:function(t,e,n,r,a,i,o){var u=At();try{return at(t)(e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},K:function(t,e,n,r,a,i,o,u){var c=At();try{return at(t)(e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},D:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=At();try{return at(t)(e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(St(p),t!==t+0)throw t;Ot(1,0)}},X:function(t,e,n,r,a,i,o,u){var c=At();try{return Ft(t,e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},V:function(t,e,n,r,a,i,o){var u=At();try{return xt(t,e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},U:function(t,e,n,r,a){var i=At();try{return It(t,e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},Z:function(t,e,n,r){var a=At();try{return Pt(t,e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},W:function(t){var e=At();try{return Ct(t)}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},Y:function(t,e){var n=At();try{return Ut(t,e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},T:function(t,e,n){var r=At();try{return Rt(t,e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},f:function(t){var e=At();try{at(t)()}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},q:function(t,e){var n=At();try{at(t)(e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},h:function(t,e,n){var r=At();try{at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},da:function(t,e,n,r){var a=At();try{at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},l:function(t,e,n,r){var a=At();try{at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},t:function(t,e,n,r,a){var i=At();try{at(t)(e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},u:function(t,e,n,r,a,i){var o=At();try{at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},x:function(t,e,n,r,a,i,o){var u=At();try{at(t)(e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},z:function(t,e,n,r,a,i,o,u){var c=At();try{at(t)(e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},ga:function(t,e,n,r,a,i,o,u,c){var s=At();try{at(t)(e,n,r,a,i,o,u,c)}catch(t){if(St(s),t!==t+0)throw t;Ot(1,0)}},A:function(t,e,n,r,a,i,o,u,c,s,l){var f=At();try{at(t)(e,n,r,a,i,o,u,c,s,l)}catch(t){if(St(f),t!==t+0)throw t;Ot(1,0)}},C:function(t,e,n,r,a,i,o,u,c,s,l,f,p,h,d,y){var b=At();try{at(t)(e,n,r,a,i,o,u,c,s,l,f,p,h,d,y)}catch(t){if(St(b),t!==t+0)throw t;Ot(1,0)}},aa:function(t,e,n,r,a,i,o,u){var c=At();try{jt(t,e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},_:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=At();try{Dt(t,e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(St(p),t!==t+0)throw t;Ot(1,0)}},$:function(t,e,n,r,a,i){var o=At();try{kt(t,e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},n:function(t){return t},F:function(t){ft=t},ha:yt,y:function(t,e,n,r){return yt(t,e,n,r)}};!function(){function t(t){e.asm=t.exports,O=e.asm.Ka,P(),U=e.asm.ib,I.unshift(e.asm.La),B--,e.monitorRunDependencies&&e.monitorRunDependencies(B),0==B&&(null!==G&&(clearInterval(G),G=null),N&&(t=N,N=null,t()))}function n(e){t(e.instance)}function r(t){return function(){if(!g&&(d||y)){if("function"==typeof fetch&&!Y.startsWith("file://"))return fetch(Y,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at \'"+Y+"\'";return t.arrayBuffer()})).catch((function(){return X()}));if(o)return new Promise((function(t,e){o(Y,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return X()}))}().then((function(t){return WebAssembly.instantiate(t,i)})).then((function(t){return t})).then(t,(function(t){w("failed to asynchronously prepare wasm: "+t),V(t)}))}var i={a:bt};if(B++,e.monitorRunDependencies&&e.monitorRunDependencies(B),e.instantiateWasm)try{return e.instantiateWasm(i,t)}catch(t){return w("Module.instantiateWasm callback failed with error: "+t),!1}(g||"function"!=typeof WebAssembly.instantiateStreaming||$()||Y.startsWith("file://")||b||"function"!=typeof fetch?r(n):fetch(Y,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,i).then(n,(function(t){return w("wasm streaming compile failed: "+t),w("falling back to ArrayBuffer instantiation"),r(n)}))}))).catch(a)}(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.La).apply(null,arguments)},e._OrtInit=function(){return(e._OrtInit=e.asm.Ma).apply(null,arguments)},e._OrtCreateSessionOptions=function(){return(e._OrtCreateSessionOptions=e.asm.Na).apply(null,arguments)},e._OrtAppendExecutionProvider=function(){return(e._OrtAppendExecutionProvider=e.asm.Oa).apply(null,arguments)},e._OrtAddSessionConfigEntry=function(){return(e._OrtAddSessionConfigEntry=e.asm.Pa).apply(null,arguments)},e._OrtReleaseSessionOptions=function(){return(e._OrtReleaseSessionOptions=e.asm.Qa).apply(null,arguments)},e._OrtCreateSession=function(){return(e._OrtCreateSession=e.asm.Ra).apply(null,arguments)},e._OrtReleaseSession=function(){return(e._OrtReleaseSession=e.asm.Sa).apply(null,arguments)},e._OrtGetInputCount=function(){return(e._OrtGetInputCount=e.asm.Ta).apply(null,arguments)},e._OrtGetOutputCount=function(){return(e._OrtGetOutputCount=e.asm.Ua).apply(null,arguments)},e._OrtGetInputName=function(){return(e._OrtGetInputName=e.asm.Va).apply(null,arguments)},e._OrtGetOutputName=function(){return(e._OrtGetOutputName=e.asm.Wa).apply(null,arguments)},e._OrtFree=function(){return(e._OrtFree=e.asm.Xa).apply(null,arguments)},e._OrtCreateTensor=function(){return(e._OrtCreateTensor=e.asm.Ya).apply(null,arguments)},e._OrtGetTensorData=function(){return(e._OrtGetTensorData=e.asm.Za).apply(null,arguments)},e._OrtReleaseTensor=function(){return(e._OrtReleaseTensor=e.asm._a).apply(null,arguments)},e._OrtCreateRunOptions=function(){return(e._OrtCreateRunOptions=e.asm.$a).apply(null,arguments)},e._OrtAddRunConfigEntry=function(){return(e._OrtAddRunConfigEntry=e.asm.ab).apply(null,arguments)},e._OrtReleaseRunOptions=function(){return(e._OrtReleaseRunOptions=e.asm.bb).apply(null,arguments)},e._OrtRun=function(){return(e._OrtRun=e.asm.cb).apply(null,arguments)},e._OrtEndProfiling=function(){return(e._OrtEndProfiling=e.asm.db).apply(null,arguments)};var mt,gt=e._malloc=function(){return(gt=e._malloc=e.asm.eb).apply(null,arguments)},vt=e._free=function(){return(vt=e._free=e.asm.fb).apply(null,arguments)},wt=e._fflush=function(){return(wt=e._fflush=e.asm.gb).apply(null,arguments)},_t=e.___funcs_on_exit=function(){return(_t=e.___funcs_on_exit=e.asm.hb).apply(null,arguments)},Ot=e._setThrew=function(){return(Ot=e._setThrew=e.asm.jb).apply(null,arguments)},At=e.stackSave=function(){return(At=e.stackSave=e.asm.kb).apply(null,arguments)},St=e.stackRestore=function(){return(St=e.stackRestore=e.asm.lb).apply(null,arguments)},Tt=e.stackAlloc=function(){return(Tt=e.stackAlloc=e.asm.mb).apply(null,arguments)},Et=e.___cxa_can_catch=function(){return(Et=e.___cxa_can_catch=e.asm.nb).apply(null,arguments)},Mt=e.___cxa_is_pointer_type=function(){return(Mt=e.___cxa_is_pointer_type=e.asm.ob).apply(null,arguments)},Ct=e.dynCall_j=function(){return(Ct=e.dynCall_j=e.asm.pb).apply(null,arguments)},xt=e.dynCall_iiiiij=function(){return(xt=e.dynCall_iiiiij=e.asm.qb).apply(null,arguments)},Rt=e.dynCall_jii=function(){return(Rt=e.dynCall_jii=e.asm.rb).apply(null,arguments)},jt=e.dynCall_viiiiij=function(){return(jt=e.dynCall_viiiiij=e.asm.sb).apply(null,arguments)},kt=e.dynCall_vjji=function(){return(kt=e.dynCall_vjji=e.asm.tb).apply(null,arguments)},Dt=e.dynCall_viiijjjii=function(){return(Dt=e.dynCall_viiijjjii=e.asm.ub).apply(null,arguments)},Pt=e.dynCall_iij=function(){return(Pt=e.dynCall_iij=e.asm.vb).apply(null,arguments)},Ut=e.dynCall_ji=function(){return(Ut=e.dynCall_ji=e.asm.wb).apply(null,arguments)},Ft=e.dynCall_iiiiiij=function(){return(Ft=e.dynCall_iiiiiij=e.asm.xb).apply(null,arguments)},It=e.dynCall_iiij=function(){return(It=e.dynCall_iiij=e.asm.yb).apply(null,arguments)};function Wt(){function t(){if(!mt&&(mt=!0,e.calledRun=!0,!C)){if(Z(I),r(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var t=e.postRun.shift();H.unshift(t)}Z(H)}}if(!(0<B)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)z();Z(F),0<B||(e.setStatus?(e.setStatus("Running..."),setTimeout((function(){setTimeout((function(){e.setStatus("")}),1),t()}),1)):t())}}if(e.UTF8ToString=j,e.stringToUTF8=function(t,e,n){return k(t,T,e,n)},e.lengthBytesUTF8=D,e.stackSave=At,e.stackRestore=St,e.stackAlloc=Tt,N=function t(){mt||Wt(),mt||(N=t)},e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();return Wt(),t.ready});t.exports=r},967:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.iterateExtraOptions=void 0,e.iterateExtraOptions=(t,n,r,a)=>{if("object"==typeof t&&null!==t){if(r.has(t))throw new Error("Circular reference in options");r.add(t)}Object.entries(t).forEach((([t,i])=>{const o=n?n+t:t;if("object"==typeof i)(0,e.iterateExtraOptions)(i,o+".",r,a);else if("string"==typeof i||"number"==typeof i)a(o,i.toString());else{if("boolean"!=typeof i)throw new Error("Can\'t handle extra config type: "+typeof i);a(o,i?"1":"0")}}))}},586:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRunOptions=void 0;const r=n(967),a=n(983),i=n(361);e.setRunOptions=t=>{const e=(0,i.getInstance)();let n=0;const o=[],u=t||{};try{if(void 0===(null==t?void 0:t.logSeverityLevel))u.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))u.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);void 0===(null==t?void 0:t.terminate)&&(u.terminate=!1);let i=0;if(void 0!==(null==t?void 0:t.tag)&&(i=(0,a.allocWasmString)(t.tag,o)),n=e._OrtCreateRunOptions(u.logSeverityLevel,u.logVerbosityLevel,!!u.terminate,i),0===n)throw new Error("Can\'t create run options");return void 0!==(null==t?void 0:t.extra)&&(0,r.iterateExtraOptions)(t.extra,"",new WeakSet,((t,r)=>{const i=(0,a.allocWasmString)(t,o),u=(0,a.allocWasmString)(r,o);if(0!==e._OrtAddRunConfigEntry(n,i,u))throw new Error(`Can\'t set a run config entry: ${t} - ${r}`)})),[n,o]}catch(t){throw 0!==n&&e._OrtReleaseRunOptions(n),o.forEach(e._free),t}}},919:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setSessionOptions=void 0;const r=n(967),a=n(983),i=n(361);e.setSessionOptions=t=>{const e=(0,i.getInstance)();let n=0;const o=[],u=t||{};(t=>{t.extra||(t.extra={}),t.extra.session||(t.extra.session={});const e=t.extra.session;e.use_ort_model_bytes_directly||(e.use_ort_model_bytes_directly="1")})(u);try{void 0===(null==t?void 0:t.graphOptimizationLevel)&&(u.graphOptimizationLevel="all");const c=(t=>{switch(t){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${t}`)}})(u.graphOptimizationLevel);void 0===(null==t?void 0:t.enableCpuMemArena)&&(u.enableCpuMemArena=!0),void 0===(null==t?void 0:t.enableMemPattern)&&(u.enableMemPattern=!0),void 0===(null==t?void 0:t.executionMode)&&(u.executionMode="sequential");const s=(t=>{switch(t){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${t}`)}})(u.executionMode);let l=0;if(void 0!==(null==t?void 0:t.logId)&&(l=(0,a.allocWasmString)(t.logId,o)),void 0===(null==t?void 0:t.logSeverityLevel))u.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))u.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);if(void 0===(null==t?void 0:t.enableProfiling)&&(u.enableProfiling=!1),n=e._OrtCreateSessionOptions(c,!!u.enableCpuMemArena,!!u.enableMemPattern,s,!!u.enableProfiling,0,l,u.logSeverityLevel,u.logVerbosityLevel),0===n)throw new Error("Can\'t create session options");return(null==t?void 0:t.executionProviders)&&((t,e,n)=>{for(const r of e){let e="string"==typeof r?r:r.name;switch(e){case"xnnpack":e="XNNPACK";break;case"wasm":case"cpu":continue;default:throw new Error(`not supported EP: ${e}`)}const o=(0,a.allocWasmString)(e,n);if(0!==(0,i.getInstance)()._OrtAppendExecutionProvider(t,o))throw new Error(`Can\'t append execution provider: ${e}`)}})(n,t.executionProviders,o),void 0!==(null==t?void 0:t.extra)&&(0,r.iterateExtraOptions)(t.extra,"",new WeakSet,((t,r)=>{const i=(0,a.allocWasmString)(t,o),u=(0,a.allocWasmString)(r,o);if(0!==e._OrtAddSessionConfigEntry(n,i,u))throw new Error(`Can\'t set a session config entry: ${t} - ${r}`)})),[n,o]}catch(t){throw 0!==n&&e._OrtReleaseSessionOptions(n),o.forEach(e._free),t}}},983:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.allocWasmString=void 0;const r=n(361);e.allocWasmString=(t,e)=>{const n=(0,r.getInstance)(),a=n.lengthBytesUTF8(t)+1,i=n._malloc(a);return n.stringToUTF8(t,i,a),e.push(i),i}},349:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.extractTransferableBuffers=e.endProfiling=e.run=e.releaseSession=e.createSession=e.createSessionFinalize=e.createSessionAllocate=e.initOrt=void 0;const r=n(586),a=n(919),i=n(983),o=n(361);e.initOrt=(t,e)=>{const n=(0,o.getInstance)()._OrtInit(t,e);if(0!==n)throw new Error(`Can\'t initialize onnxruntime. error code = ${n}`)};const u=new Map;e.createSessionAllocate=t=>{const e=(0,o.getInstance)(),n=e._malloc(t.byteLength);return e.HEAPU8.set(t,n),[n,t.byteLength]},e.createSessionFinalize=(t,e)=>{const n=(0,o.getInstance)();let r=0,i=0,c=[];try{if([i,c]=(0,a.setSessionOptions)(e),r=n._OrtCreateSession(t[0],t[1],i),0===r)throw new Error("Can\'t create a session")}finally{n._free(t[0]),n._OrtReleaseSessionOptions(i),c.forEach(n._free)}const s=n._OrtGetInputCount(r),l=n._OrtGetOutputCount(r),f=[],p=[],h=[],d=[];for(let t=0;t<s;t++){const e=n._OrtGetInputName(r,t);if(0===e)throw new Error("Can\'t get an input name");p.push(e),f.push(n.UTF8ToString(e))}for(let t=0;t<l;t++){const e=n._OrtGetOutputName(r,t);if(0===e)throw new Error("Can\'t get an output name");d.push(e),h.push(n.UTF8ToString(e))}return u.set(r,[r,p,d]),[r,f,h]},e.createSession=(t,n)=>{const r=(0,e.createSessionAllocate)(t);return(0,e.createSessionFinalize)(r,n)},e.releaseSession=t=>{const e=(0,o.getInstance)(),n=u.get(t);if(!n)throw new Error("invalid session id");const r=n[0],a=n[1],i=n[2];a.forEach(e._OrtFree),i.forEach(e._OrtFree),e._OrtReleaseSession(r),u.delete(t)};const c=t=>{switch(t){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;default:throw new Error(`unsupported data type: ${t}`)}},s=t=>{switch(t){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw new Error(`unsupported data type: ${t}`)}},l=t=>{switch(t){case"float32":return Float32Array;case"uint8":case"bool":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${t}`)}};e.run=(t,e,n,a,f)=>{const p=(0,o.getInstance)(),h=u.get(t);if(!h)throw new Error("invalid session id");const d=h[0],y=h[1],b=h[2],m=e.length,g=a.length;let v=0,w=[];const _=[],O=[];try{[v,w]=(0,r.setRunOptions)(f);for(let t=0;t<m;t++){const e=n[t][0],r=n[t][1],a=n[t][2];let o,u;if(Array.isArray(a)){u=4*a.length,o=p._malloc(u),O.push(o);let t=o/4;for(let e=0;e<a.length;e++){if("string"!=typeof a[e])throw new TypeError(`tensor data at index ${e} is not a string`);p.HEAPU32[t++]=(0,i.allocWasmString)(a[e],O)}}else u=a.byteLength,o=p._malloc(u),O.push(o),p.HEAPU8.set(new Uint8Array(a.buffer,a.byteOffset,u),o);const s=p.stackSave(),l=p.stackAlloc(4*r.length);try{let t=l/4;r.forEach((e=>p.HEAP32[t++]=e));const n=p._OrtCreateTensor(c(e),o,u,l,r.length);if(0===n)throw new Error("Can\'t create a tensor");_.push(n)}finally{p.stackRestore(s)}}const t=p.stackSave(),o=p.stackAlloc(4*m),u=p.stackAlloc(4*m),h=p.stackAlloc(4*g),A=p.stackAlloc(4*g);try{let n=o/4,r=u/4,i=h/4,c=A/4;for(let t=0;t<m;t++)p.HEAPU32[n++]=_[t],p.HEAPU32[r++]=y[e[t]];for(let t=0;t<g;t++)p.HEAPU32[i++]=0,p.HEAPU32[c++]=b[a[t]];let f=p._OrtRun(d,u,o,m,A,g,h,v);const w=[];if(0===f)for(let t=0;t<g;t++){const e=p.HEAPU32[h/4+t],n=p.stackSave(),r=p.stackAlloc(16);let a,i=0;try{if(f=p._OrtGetTensorData(e,r,r+4,r+8,r+12),0!==f)throw new Error(`Can\'t access output tensor data. error code = ${f}`);let t=r/4;const o=p.HEAPU32[t++];i=p.HEAPU32[t++];const u=p.HEAPU32[t++],c=p.HEAPU32[t++],h=[];for(let t=0;t<c;t++)h.push(p.HEAPU32[u/4+t]);p._OrtFree(u);const d=0===h.length?1:h.reduce(((t,e)=>t*e));if(a=s(o),"string"===a){const t=[];let e=i/4;for(let n=0;n<d;n++){const r=p.HEAPU32[e++],a=n===d-1?void 0:p.HEAPU32[e]-r;t.push(p.UTF8ToString(r,a))}w.push([a,h,t])}else{const t=new(l(a))(d);new Uint8Array(t.buffer,t.byteOffset,t.byteLength).set(p.HEAPU8.subarray(i,i+t.byteLength)),w.push([a,h,t])}}finally{p.stackRestore(n),"string"===a&&i&&p._free(i),p._OrtReleaseTensor(e)}}if(0===f)return w;throw new Error(`failed to call OrtRun(). error code = ${f}.`)}finally{p.stackRestore(t)}}finally{_.forEach(p._OrtReleaseTensor),O.forEach(p._free),p._OrtReleaseRunOptions(v),w.forEach(p._free)}},e.endProfiling=t=>{const e=(0,o.getInstance)(),n=u.get(t);if(!n)throw new Error("invalid session id");const r=n[0],a=e._OrtEndProfiling(r);if(0===a)throw new Error("Can\'t get an profile file name");e._OrtFree(a)},e.extractTransferableBuffers=t=>{const e=[];for(const n of t){const t=n[2];!Array.isArray(t)&&t.buffer&&e.push(t.buffer)}return e}},361:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var a=Object.getOwnPropertyDescriptor(e,n);a&&!("get"in a?!e.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,a)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),a=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return a(e,t),e},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.dispose=e.getInstance=e.initializeWebAssembly=void 0;const u=i(n(449)),c=o(n(932)),s=n(474);let l,f=!1,p=!1,h=!1;const d=(t,e)=>e?t?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":t?"ort-wasm-simd.wasm":"ort-wasm.wasm";e.initializeWebAssembly=async t=>{if(f)return Promise.resolve();if(p)throw new Error("multiple calls to \'initializeWebAssembly()\' detected.");if(h)throw new Error("previous call to \'initializeWebAssembly()\' failed.");p=!0;const e=t.initTimeout,r=t.numThreads,a=t.simd,i=r>1&&(()=>{try{return"undefined"!=typeof SharedArrayBuffer&&("undefined"!=typeof MessageChannel&&(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])))}catch(t){return!1}})(),o=a&&(()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch(t){return!1}})(),y="string"==typeof t.wasmPaths?t.wasmPaths:void 0,b=d(!1,i),m=d(o,i),g="object"==typeof t.wasmPaths?t.wasmPaths[m]:void 0;let v=!1;const w=[];if(e>0&&w.push(new Promise((t=>{setTimeout((()=>{v=!0,t()}),e)}))),w.push(new Promise(((t,e)=>{const r=i?s:c.default,a={locateFile:(t,e)=>i&&t.endsWith(".worker.js")&&"undefined"!=typeof Blob?URL.createObjectURL(new Blob([n(154)],{type:"text/javascript"})):t===b?null!=g?g:(null!=y?y:e)+m:e+t};if(i)if("undefined"==typeof Blob)a.mainScriptUrlOrBlob=u.join("/","ort-wasm-threaded.js");else{const t=`var ortWasmThreaded=(function(){var _scriptDir;return ${r.toString()}})();`;a.mainScriptUrlOrBlob=new Blob([t],{type:"text/javascript"})}r(a).then((e=>{p=!1,f=!0,l=e,t()}),(t=>{p=!1,h=!0,e(t)}))}))),await Promise.race(w),v)throw new Error(`WebAssembly backend initializing failed due to timeout: ${e}ms`)},e.getInstance=()=>{if(f&&l)return l;throw new Error("WebAssembly is not initialized yet.")},e.dispose=()=>{var t;!f||p||h||(p=!0,null===(t=l.PThread)||void 0===t||t.terminateAllThreads(),l=void 0,p=!1,f=!1,h=!0)}},154:t=>{"use strict";t.exports=\'"use strict";var e={},t="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(t){var r=require("worker_threads"),a=r.parentPort;a.on("message",(e=>onmessage({data:e})));var o=require("fs");Object.assign(global,{self:global,require:require,Module:e,location:{href:__filename},Worker:r.Worker,importScripts:function(e){(0,eval)(o.readFileSync(e,"utf8"))},postMessage:function(e){a.postMessage(e)},performance:global.performance||{now:function(){return Date.now()}}})}var s=!1,n=[],i=function(){var e=Array.prototype.slice.call(arguments).join(" ");t?o.writeSync(2,e+"\\\\n"):console.error(e)};self.alert=function(){var t=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:t,threadId:e._pthread_self()})},e.instantiateWasm=(t,r)=>{var a=new WebAssembly.Instance(e.wasmModule,t);return r(a),e.wasmModule=null,a.exports},self.onunhandledrejection=e=>{throw e.reason??e},self.onmessage=t=>{try{if("load"===t.data.cmd){if(e.wasmModule=t.data.wasmModule,e.wasmMemory=t.data.wasmMemory,e.buffer=e.wasmMemory.buffer,e.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof t.data.urlOrBlob)importScripts(t.data.urlOrBlob);else{var r=URL.createObjectURL(t.data.urlOrBlob);importScripts(r),URL.revokeObjectURL(r)}ortWasmThreaded(e).then((function(t){e=t}))}else if("run"===t.data.cmd){e.__performance_now_clock_drift=performance.now()-t.data.time,e.__emscripten_thread_init(t.data.pthread_ptr,0,0,1),e.establishStackSpace(),e.PThread.receiveObjectTransfer(t.data),e.PThread.threadInitTLS(),s||(n.forEach((t=>{e.executeNotifiedProxyingQueue(t)})),n=[],s=!0);try{e.invokeEntryPoint(t.data.start_routine,t.data.arg)}catch(t){if("unwind"!=t){if(!(t instanceof e.ExitStatus))throw t;e.keepRuntimeAlive()||e.__emscripten_thread_exit(t.status)}}}else"cancel"===t.data.cmd?e._pthread_self()&&e.__emscripten_thread_exit(-1):"setimmediate"===t.data.target||("processProxyingQueue"===t.data.cmd?s?e.executeNotifiedProxyingQueue(t.data.queue):n.push(t.data.queue):(i("worker.js received unknown command "+t.data.cmd),i(t.data)))}catch(t){throw i("worker.js onmessage() captured an uncaught exception: "+t),t&&t.stack&&i(t.stack),e.__emscripten_thread_crashed&&e.__emscripten_thread_crashed(),t}};\\n\'},384:()=>{},993:()=>{},908:()=>{},953:()=>{},925:()=>{},449:()=>{}},e={};function n(r){var a=e[r];if(void 0!==a)return a.exports;var i=e[r]={exports:{}};return t[r].call(i.exports,i,i.exports,n),i.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),(()=>{"use strict";const t=n(349),e=n(361);self.onmessage=n=>{switch(n.data.type){case"init-wasm":(0,e.initializeWebAssembly)(n.data.in).then((()=>postMessage({type:"init-wasm"})),(t=>postMessage({type:"init-wasm",err:t})));break;case"init-ort":try{const{numThreads:e,loggingLevel:r}=n.data.in;(0,t.initOrt)(e,r),postMessage({type:"init-ort"})}catch(t){postMessage({type:"init-ort",err:t})}break;case"create_allocate":try{const{model:e}=n.data.in,r=(0,t.createSessionAllocate)(e);postMessage({type:"create_allocate",out:r})}catch(t){postMessage({type:"create_allocate",err:t})}break;case"create_finalize":try{const{modeldata:e,options:r}=n.data.in,a=(0,t.createSessionFinalize)(e,r);postMessage({type:"create_finalize",out:a})}catch(t){postMessage({type:"create_finalize",err:t})}break;case"create":try{const{model:e,options:r}=n.data.in,a=(0,t.createSession)(e,r);postMessage({type:"create",out:a})}catch(t){postMessage({type:"create",err:t})}break;case"release":try{const e=n.data.in;(0,t.releaseSession)(e),postMessage({type:"release"})}catch(t){postMessage({type:"release",err:t})}break;case"run":try{const{sessionId:e,inputIndices:r,inputs:a,outputIndices:i,options:o}=n.data.in,u=(0,t.run)(e,r,a,i,o);postMessage({type:"run",out:u},(0,t.extractTransferableBuffers)(u))}catch(t){postMessage({type:"run",err:t})}break;case"end-profiling":try{const e=n.data.in;(0,t.endProfiling)(e),postMessage({type:"end-profiling"})}catch(t){postMessage({type:"end-profiling",err:t})}}}})()})();\n', "Worker", void 0, void 0);
      }
    }, 477: (s) => {
      s.exports = function(e, r, o, m) {
        var _ = self || window;
        try {
          try {
            var g;
            try {
              g = new _.Blob([e]);
            } catch {
              (g = new (_.BlobBuilder || _.WebKitBlobBuilder || _.MozBlobBuilder || _.MSBlobBuilder)()).append(e), g = g.getBlob();
            }
            var y = _.URL || _.webkitURL, E = y.createObjectURL(g), x = new _[r](E, o);
            return y.revokeObjectURL(E), x;
          } catch {
            return new _[r]("data:application/javascript,".concat(encodeURIComponent(e)), o);
          }
        } catch {
          if (!m) throw Error("Inline worker is not supported");
          return new _[r](m, o);
        }
      };
    }, 4154: (s) => {
      s.exports = `"use strict";var e={},t="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(t){var r=require("worker_threads"),a=r.parentPort;a.on("message",(e=>onmessage({data:e})));var o=require("fs");Object.assign(global,{self:global,require:require,Module:e,location:{href:__filename},Worker:r.Worker,importScripts:function(e){(0,eval)(o.readFileSync(e,"utf8"))},postMessage:function(e){a.postMessage(e)},performance:global.performance||{now:function(){return Date.now()}}})}var s=!1,n=[],i=function(){var e=Array.prototype.slice.call(arguments).join(" ");t?o.writeSync(2,e+"\\n"):console.error(e)};self.alert=function(){var t=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:t,threadId:e._pthread_self()})},e.instantiateWasm=(t,r)=>{var a=new WebAssembly.Instance(e.wasmModule,t);return r(a),e.wasmModule=null,a.exports},self.onunhandledrejection=e=>{throw e.reason??e},self.onmessage=t=>{try{if("load"===t.data.cmd){if(e.wasmModule=t.data.wasmModule,e.wasmMemory=t.data.wasmMemory,e.buffer=e.wasmMemory.buffer,e.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof t.data.urlOrBlob)importScripts(t.data.urlOrBlob);else{var r=URL.createObjectURL(t.data.urlOrBlob);importScripts(r),URL.revokeObjectURL(r)}ortWasmThreaded(e).then((function(t){e=t}))}else if("run"===t.data.cmd){e.__performance_now_clock_drift=performance.now()-t.data.time,e.__emscripten_thread_init(t.data.pthread_ptr,0,0,1),e.establishStackSpace(),e.PThread.receiveObjectTransfer(t.data),e.PThread.threadInitTLS(),s||(n.forEach((t=>{e.executeNotifiedProxyingQueue(t)})),n=[],s=!0);try{e.invokeEntryPoint(t.data.start_routine,t.data.arg)}catch(t){if("unwind"!=t){if(!(t instanceof e.ExitStatus))throw t;e.keepRuntimeAlive()||e.__emscripten_thread_exit(t.status)}}}else"cancel"===t.data.cmd?e._pthread_self()&&e.__emscripten_thread_exit(-1):"setimmediate"===t.data.target||("processProxyingQueue"===t.data.cmd?s?e.executeNotifiedProxyingQueue(t.data.queue):n.push(t.data.queue):(i("worker.js received unknown command "+t.data.cmd),i(t.data)))}catch(t){throw i("worker.js onmessage() captured an uncaught exception: "+t),t&&t.stack&&i(t.stack),e.__emscripten_thread_crashed&&e.__emscripten_thread_crashed(),t}};
`;
    }, 1670: (s) => {
      s.exports = __WEBPACK_EXTERNAL_MODULE__1670__;
    }, 7067: () => {
    }, 1296: () => {
    }, 1384: () => {
    }, 3993: () => {
    }, 908: () => {
    }, 6953: () => {
    }, 9925: () => {
    }, 2806: () => {
    }, 6449: () => {
    }, 2850: () => {
    }, 5381: () => {
    }, 5686: (s, e, r) => {
      r.r(e), r.d(e, { flatbuffers: () => o });
      var o = {};
      o.Offset, o.Table, o.SIZEOF_SHORT = 2, o.SIZEOF_INT = 4, o.FILE_IDENTIFIER_LENGTH = 4, o.SIZE_PREFIX_LENGTH = 4, o.Encoding = { UTF8_BYTES: 1, UTF16_STRING: 2 }, o.int32 = new Int32Array(2), o.float32 = new Float32Array(o.int32.buffer), o.float64 = new Float64Array(o.int32.buffer), o.isLittleEndian = new Uint16Array(new Uint8Array([1, 0]).buffer)[0] === 1, o.Long = function(m, _) {
        this.low = 0 | m, this.high = 0 | _;
      }, o.Long.create = function(m, _) {
        return m == 0 && _ == 0 ? o.Long.ZERO : new o.Long(m, _);
      }, o.Long.prototype.toFloat64 = function() {
        return (this.low >>> 0) + 4294967296 * this.high;
      }, o.Long.prototype.equals = function(m) {
        return this.low == m.low && this.high == m.high;
      }, o.Long.ZERO = new o.Long(0, 0), o.Builder = function(m) {
        if (m) _ = m;
        else var _ = 1024;
        this.bb = o.ByteBuffer.allocate(_), this.space = _, this.minalign = 1, this.vtable = null, this.vtable_in_use = 0, this.isNested = !1, this.object_start = 0, this.vtables = [], this.vector_num_elems = 0, this.force_defaults = !1;
      }, o.Builder.prototype.clear = function() {
        this.bb.clear(), this.space = this.bb.capacity(), this.minalign = 1, this.vtable = null, this.vtable_in_use = 0, this.isNested = !1, this.object_start = 0, this.vtables = [], this.vector_num_elems = 0, this.force_defaults = !1;
      }, o.Builder.prototype.forceDefaults = function(m) {
        this.force_defaults = m;
      }, o.Builder.prototype.dataBuffer = function() {
        return this.bb;
      }, o.Builder.prototype.asUint8Array = function() {
        return this.bb.bytes().subarray(this.bb.position(), this.bb.position() + this.offset());
      }, o.Builder.prototype.prep = function(m, _) {
        m > this.minalign && (this.minalign = m);
        for (var g = 1 + ~(this.bb.capacity() - this.space + _) & m - 1; this.space < g + m + _; ) {
          var y = this.bb.capacity();
          this.bb = o.Builder.growByteBuffer(this.bb), this.space += this.bb.capacity() - y;
        }
        this.pad(g);
      }, o.Builder.prototype.pad = function(m) {
        for (var _ = 0; _ < m; _++) this.bb.writeInt8(--this.space, 0);
      }, o.Builder.prototype.writeInt8 = function(m) {
        this.bb.writeInt8(this.space -= 1, m);
      }, o.Builder.prototype.writeInt16 = function(m) {
        this.bb.writeInt16(this.space -= 2, m);
      }, o.Builder.prototype.writeInt32 = function(m) {
        this.bb.writeInt32(this.space -= 4, m);
      }, o.Builder.prototype.writeInt64 = function(m) {
        this.bb.writeInt64(this.space -= 8, m);
      }, o.Builder.prototype.writeFloat32 = function(m) {
        this.bb.writeFloat32(this.space -= 4, m);
      }, o.Builder.prototype.writeFloat64 = function(m) {
        this.bb.writeFloat64(this.space -= 8, m);
      }, o.Builder.prototype.addInt8 = function(m) {
        this.prep(1, 0), this.writeInt8(m);
      }, o.Builder.prototype.addInt16 = function(m) {
        this.prep(2, 0), this.writeInt16(m);
      }, o.Builder.prototype.addInt32 = function(m) {
        this.prep(4, 0), this.writeInt32(m);
      }, o.Builder.prototype.addInt64 = function(m) {
        this.prep(8, 0), this.writeInt64(m);
      }, o.Builder.prototype.addFloat32 = function(m) {
        this.prep(4, 0), this.writeFloat32(m);
      }, o.Builder.prototype.addFloat64 = function(m) {
        this.prep(8, 0), this.writeFloat64(m);
      }, o.Builder.prototype.addFieldInt8 = function(m, _, g) {
        (this.force_defaults || _ != g) && (this.addInt8(_), this.slot(m));
      }, o.Builder.prototype.addFieldInt16 = function(m, _, g) {
        (this.force_defaults || _ != g) && (this.addInt16(_), this.slot(m));
      }, o.Builder.prototype.addFieldInt32 = function(m, _, g) {
        (this.force_defaults || _ != g) && (this.addInt32(_), this.slot(m));
      }, o.Builder.prototype.addFieldInt64 = function(m, _, g) {
        !this.force_defaults && _.equals(g) || (this.addInt64(_), this.slot(m));
      }, o.Builder.prototype.addFieldFloat32 = function(m, _, g) {
        (this.force_defaults || _ != g) && (this.addFloat32(_), this.slot(m));
      }, o.Builder.prototype.addFieldFloat64 = function(m, _, g) {
        (this.force_defaults || _ != g) && (this.addFloat64(_), this.slot(m));
      }, o.Builder.prototype.addFieldOffset = function(m, _, g) {
        (this.force_defaults || _ != g) && (this.addOffset(_), this.slot(m));
      }, o.Builder.prototype.addFieldStruct = function(m, _, g) {
        _ != g && (this.nested(_), this.slot(m));
      }, o.Builder.prototype.nested = function(m) {
        if (m != this.offset()) throw new Error("FlatBuffers: struct must be serialized inline.");
      }, o.Builder.prototype.notNested = function() {
        if (this.isNested) throw new Error("FlatBuffers: object serialization must not be nested.");
      }, o.Builder.prototype.slot = function(m) {
        this.vtable[m] = this.offset();
      }, o.Builder.prototype.offset = function() {
        return this.bb.capacity() - this.space;
      }, o.Builder.growByteBuffer = function(m) {
        var _ = m.capacity();
        if (3221225472 & _) throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");
        var g = _ << 1, y = o.ByteBuffer.allocate(g);
        return y.setPosition(g - _), y.bytes().set(m.bytes(), g - _), y;
      }, o.Builder.prototype.addOffset = function(m) {
        this.prep(o.SIZEOF_INT, 0), this.writeInt32(this.offset() - m + o.SIZEOF_INT);
      }, o.Builder.prototype.startObject = function(m) {
        this.notNested(), this.vtable == null && (this.vtable = []), this.vtable_in_use = m;
        for (var _ = 0; _ < m; _++) this.vtable[_] = 0;
        this.isNested = !0, this.object_start = this.offset();
      }, o.Builder.prototype.endObject = function() {
        if (this.vtable == null || !this.isNested) throw new Error("FlatBuffers: endObject called without startObject");
        this.addInt32(0);
        for (var m = this.offset(), _ = this.vtable_in_use - 1; _ >= 0 && this.vtable[_] == 0; _--) ;
        for (var g = _ + 1; _ >= 0; _--) this.addInt16(this.vtable[_] != 0 ? m - this.vtable[_] : 0);
        this.addInt16(m - this.object_start);
        var y = (g + 2) * o.SIZEOF_SHORT;
        this.addInt16(y);
        var E = 0, x = this.space;
        e: for (_ = 0; _ < this.vtables.length; _++) {
          var v = this.bb.capacity() - this.vtables[_];
          if (y == this.bb.readInt16(v)) {
            for (var h = o.SIZEOF_SHORT; h < y; h += o.SIZEOF_SHORT) if (this.bb.readInt16(x + h) != this.bb.readInt16(v + h)) continue e;
            E = this.vtables[_];
            break;
          }
        }
        return E ? (this.space = this.bb.capacity() - m, this.bb.writeInt32(this.space, E - m)) : (this.vtables.push(this.offset()), this.bb.writeInt32(this.bb.capacity() - m, this.offset() - m)), this.isNested = !1, m;
      }, o.Builder.prototype.finish = function(m, _, g) {
        var y = g ? o.SIZE_PREFIX_LENGTH : 0;
        if (_) {
          var E = _;
          if (this.prep(this.minalign, o.SIZEOF_INT + o.FILE_IDENTIFIER_LENGTH + y), E.length != o.FILE_IDENTIFIER_LENGTH) throw new Error("FlatBuffers: file identifier must be length " + o.FILE_IDENTIFIER_LENGTH);
          for (var x = o.FILE_IDENTIFIER_LENGTH - 1; x >= 0; x--) this.writeInt8(E.charCodeAt(x));
        }
        this.prep(this.minalign, o.SIZEOF_INT + y), this.addOffset(m), y && this.addInt32(this.bb.capacity() - this.space), this.bb.setPosition(this.space);
      }, o.Builder.prototype.finishSizePrefixed = function(m, _) {
        this.finish(m, _, !0);
      }, o.Builder.prototype.requiredField = function(m, _) {
        var g = this.bb.capacity() - m, y = g - this.bb.readInt32(g);
        if (this.bb.readInt16(y + _) == 0) throw new Error("FlatBuffers: field " + _ + " must be set");
      }, o.Builder.prototype.startVector = function(m, _, g) {
        this.notNested(), this.vector_num_elems = _, this.prep(o.SIZEOF_INT, m * _), this.prep(g, m * _);
      }, o.Builder.prototype.endVector = function() {
        return this.writeInt32(this.vector_num_elems), this.offset();
      }, o.Builder.prototype.createString = function(m) {
        if (m instanceof Uint8Array) var _ = m;
        else {
          _ = [];
          for (var g = 0; g < m.length; ) {
            var y, E = m.charCodeAt(g++);
            (y = E < 55296 || E >= 56320 ? E : (E << 10) + m.charCodeAt(g++) + -56613888) < 128 ? _.push(y) : (y < 2048 ? _.push(y >> 6 & 31 | 192) : (y < 65536 ? _.push(y >> 12 & 15 | 224) : _.push(y >> 18 & 7 | 240, y >> 12 & 63 | 128), _.push(y >> 6 & 63 | 128)), _.push(63 & y | 128));
          }
        }
        this.addInt8(0), this.startVector(1, _.length, 1), this.bb.setPosition(this.space -= _.length), g = 0;
        for (var x = this.space, v = this.bb.bytes(); g < _.length; g++) v[x++] = _[g];
        return this.endVector();
      }, o.Builder.prototype.createLong = function(m, _) {
        return o.Long.create(m, _);
      }, o.ByteBuffer = function(m) {
        this.bytes_ = m, this.position_ = 0;
      }, o.ByteBuffer.allocate = function(m) {
        return new o.ByteBuffer(new Uint8Array(m));
      }, o.ByteBuffer.prototype.clear = function() {
        this.position_ = 0;
      }, o.ByteBuffer.prototype.bytes = function() {
        return this.bytes_;
      }, o.ByteBuffer.prototype.position = function() {
        return this.position_;
      }, o.ByteBuffer.prototype.setPosition = function(m) {
        this.position_ = m;
      }, o.ByteBuffer.prototype.capacity = function() {
        return this.bytes_.length;
      }, o.ByteBuffer.prototype.readInt8 = function(m) {
        return this.readUint8(m) << 24 >> 24;
      }, o.ByteBuffer.prototype.readUint8 = function(m) {
        return this.bytes_[m];
      }, o.ByteBuffer.prototype.readInt16 = function(m) {
        return this.readUint16(m) << 16 >> 16;
      }, o.ByteBuffer.prototype.readUint16 = function(m) {
        return this.bytes_[m] | this.bytes_[m + 1] << 8;
      }, o.ByteBuffer.prototype.readInt32 = function(m) {
        return this.bytes_[m] | this.bytes_[m + 1] << 8 | this.bytes_[m + 2] << 16 | this.bytes_[m + 3] << 24;
      }, o.ByteBuffer.prototype.readUint32 = function(m) {
        return this.readInt32(m) >>> 0;
      }, o.ByteBuffer.prototype.readInt64 = function(m) {
        return new o.Long(this.readInt32(m), this.readInt32(m + 4));
      }, o.ByteBuffer.prototype.readUint64 = function(m) {
        return new o.Long(this.readUint32(m), this.readUint32(m + 4));
      }, o.ByteBuffer.prototype.readFloat32 = function(m) {
        return o.int32[0] = this.readInt32(m), o.float32[0];
      }, o.ByteBuffer.prototype.readFloat64 = function(m) {
        return o.int32[o.isLittleEndian ? 0 : 1] = this.readInt32(m), o.int32[o.isLittleEndian ? 1 : 0] = this.readInt32(m + 4), o.float64[0];
      }, o.ByteBuffer.prototype.writeInt8 = function(m, _) {
        this.bytes_[m] = _;
      }, o.ByteBuffer.prototype.writeUint8 = function(m, _) {
        this.bytes_[m] = _;
      }, o.ByteBuffer.prototype.writeInt16 = function(m, _) {
        this.bytes_[m] = _, this.bytes_[m + 1] = _ >> 8;
      }, o.ByteBuffer.prototype.writeUint16 = function(m, _) {
        this.bytes_[m] = _, this.bytes_[m + 1] = _ >> 8;
      }, o.ByteBuffer.prototype.writeInt32 = function(m, _) {
        this.bytes_[m] = _, this.bytes_[m + 1] = _ >> 8, this.bytes_[m + 2] = _ >> 16, this.bytes_[m + 3] = _ >> 24;
      }, o.ByteBuffer.prototype.writeUint32 = function(m, _) {
        this.bytes_[m] = _, this.bytes_[m + 1] = _ >> 8, this.bytes_[m + 2] = _ >> 16, this.bytes_[m + 3] = _ >> 24;
      }, o.ByteBuffer.prototype.writeInt64 = function(m, _) {
        this.writeInt32(m, _.low), this.writeInt32(m + 4, _.high);
      }, o.ByteBuffer.prototype.writeUint64 = function(m, _) {
        this.writeUint32(m, _.low), this.writeUint32(m + 4, _.high);
      }, o.ByteBuffer.prototype.writeFloat32 = function(m, _) {
        o.float32[0] = _, this.writeInt32(m, o.int32[0]);
      }, o.ByteBuffer.prototype.writeFloat64 = function(m, _) {
        o.float64[0] = _, this.writeInt32(m, o.int32[o.isLittleEndian ? 0 : 1]), this.writeInt32(m + 4, o.int32[o.isLittleEndian ? 1 : 0]);
      }, o.ByteBuffer.prototype.getBufferIdentifier = function() {
        if (this.bytes_.length < this.position_ + o.SIZEOF_INT + o.FILE_IDENTIFIER_LENGTH) throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");
        for (var m = "", _ = 0; _ < o.FILE_IDENTIFIER_LENGTH; _++) m += String.fromCharCode(this.readInt8(this.position_ + o.SIZEOF_INT + _));
        return m;
      }, o.ByteBuffer.prototype.__offset = function(m, _) {
        var g = m - this.readInt32(m);
        return _ < this.readInt16(g) ? this.readInt16(g + _) : 0;
      }, o.ByteBuffer.prototype.__union = function(m, _) {
        return m.bb_pos = _ + this.readInt32(_), m.bb = this, m;
      }, o.ByteBuffer.prototype.__string = function(m, _) {
        m += this.readInt32(m);
        var g = this.readInt32(m), y = "", E = 0;
        if (m += o.SIZEOF_INT, _ === o.Encoding.UTF8_BYTES) return this.bytes_.subarray(m, m + g);
        for (; E < g; ) {
          var x, v = this.readUint8(m + E++);
          if (v < 192) x = v;
          else {
            var h = this.readUint8(m + E++);
            if (v < 224) x = (31 & v) << 6 | 63 & h;
            else {
              var a = this.readUint8(m + E++);
              x = v < 240 ? (15 & v) << 12 | (63 & h) << 6 | 63 & a : (7 & v) << 18 | (63 & h) << 12 | (63 & a) << 6 | 63 & this.readUint8(m + E++);
            }
          }
          x < 65536 ? y += String.fromCharCode(x) : (x -= 65536, y += String.fromCharCode(55296 + (x >> 10), 56320 + (1023 & x)));
        }
        return y;
      }, o.ByteBuffer.prototype.__indirect = function(m) {
        return m + this.readInt32(m);
      }, o.ByteBuffer.prototype.__vector = function(m) {
        return m + this.readInt32(m) + o.SIZEOF_INT;
      }, o.ByteBuffer.prototype.__vector_len = function(m) {
        return this.readInt32(m + this.readInt32(m));
      }, o.ByteBuffer.prototype.__has_identifier = function(m) {
        if (m.length != o.FILE_IDENTIFIER_LENGTH) throw new Error("FlatBuffers: file identifier must be length " + o.FILE_IDENTIFIER_LENGTH);
        for (var _ = 0; _ < o.FILE_IDENTIFIER_LENGTH; _++) if (m.charCodeAt(_) != this.readInt8(this.position_ + o.SIZEOF_INT + _)) return !1;
        return !0;
      }, o.ByteBuffer.prototype.createLong = function(m, _) {
        return o.Long.create(m, _);
      };
    } }, __webpack_module_cache__ = {};
    function __webpack_require__(s) {
      var e = __webpack_module_cache__[s];
      if (e !== void 0) return e.exports;
      var r = __webpack_module_cache__[s] = { exports: {} };
      return __webpack_modules__[s].call(r.exports, r, r.exports, __webpack_require__), r.exports;
    }
    __webpack_require__.n = (s) => {
      var e = s && s.__esModule ? () => s.default : () => s;
      return __webpack_require__.d(e, { a: e }), e;
    }, __webpack_require__.d = (s, e) => {
      for (var r in e) __webpack_require__.o(e, r) && !__webpack_require__.o(s, r) && Object.defineProperty(s, r, { enumerable: !0, get: e[r] });
    }, __webpack_require__.g = function() {
      if (typeof globalThis == "object") return globalThis;
      try {
        return this || new Function("return this")();
      } catch {
        if (typeof window == "object") return window;
      }
    }(), __webpack_require__.o = (s, e) => Object.prototype.hasOwnProperty.call(s, e), __webpack_require__.r = (s) => {
      typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(s, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(s, "__esModule", { value: !0 });
    };
    var __webpack_exports__ = __webpack_require__(6018);
    return __webpack_exports__;
  })());
})(ortWeb_min$1);
var ortWeb_minExports = ortWeb_min$1.exports;
const ortWeb_min = /* @__PURE__ */ getDefaultExportFromCjs(ortWeb_minExports), ONNX_WEB = /* @__PURE__ */ _mergeNamespaces({
  __proto__: null,
  default: ortWeb_min
}, [ortWeb_minExports]);
let ONNX;
const executionProviders = [
  // 'webgpu',
  "wasm"
];
var Pn;
typeof process < "u" && ((Pn = process == null ? void 0 : process.release) == null ? void 0 : Pn.name) === "node" ? (ONNX = sharp ?? ONNX_NODE, executionProviders.unshift("cpu")) : (ONNX = ortWeb_min ?? ONNX_WEB, typeof navigator < "u" && /iP(hone|od|ad).+16_4.+AppleWebKit/.test(navigator.userAgent) && (ONNX.env.wasm.simd = !1));
const { env: onnx_env } = ONNX, VERSION = "2.17.2", WEB_CACHE_AVAILABLE = typeof self < "u" && "caches" in self, FS_AVAILABLE = !isEmpty(sharp), PATH_AVAILABLE = !isEmpty(sharp), RUNNING_LOCALLY = FS_AVAILABLE && PATH_AVAILABLE, __dirname = RUNNING_LOCALLY ? sharp.dirname(sharp.dirname(sharp.fileURLToPath(import.meta.url))) : "./", DEFAULT_CACHE_DIR = RUNNING_LOCALLY ? sharp.join(__dirname, "/.cache/") : null, DEFAULT_LOCAL_MODEL_PATH = "/models/", localModelPath = RUNNING_LOCALLY ? sharp.join(__dirname, DEFAULT_LOCAL_MODEL_PATH) : DEFAULT_LOCAL_MODEL_PATH;
onnx_env != null && onnx_env.wasm && (onnx_env.wasm.wasmPaths = RUNNING_LOCALLY ? sharp.join(__dirname, "/dist/") : `https://cdn.jsdelivr.net/npm/@xenova/transformers@${VERSION}/dist/`);
const env$1 = {
  version: VERSION,
  remoteHost: "https://huggingface.co/",
  remotePathTemplate: "{model}/resolve/{revision}/",
  allowLocalModels: !0,
  localModelPath,
  useFS: FS_AVAILABLE,
  /////////////////// Cache settings ///////////////////
  useBrowserCache: WEB_CACHE_AVAILABLE,
  useFSCache: FS_AVAILABLE,
  cacheDir: DEFAULT_CACHE_DIR
};
function isEmpty(s) {
  return Object.keys(s).length === 0;
}
class FileResponse {
  /**
   * Creates a new `FileResponse` object.
   * @param {string|URL} filePath
   */
  constructor(e) {
    /**
     * Mapping from file extensions to MIME types.
     */
    be(this, "_CONTENT_TYPE_MAP", {
      txt: "text/plain",
      html: "text/html",
      css: "text/css",
      js: "text/javascript",
      json: "application/json",
      png: "image/png",
      jpg: "image/jpeg",
      jpeg: "image/jpeg",
      gif: "image/gif"
    });
    if (this.filePath = e, this.headers = new Headers(), this.exists = sharp.existsSync(e), this.exists) {
      this.status = 200, this.statusText = "OK";
      let r = sharp.statSync(e);
      this.headers.set("content-length", r.size.toString()), this.updateContentType();
      let o = this;
      this.body = new ReadableStream({
        start(m) {
          o.arrayBuffer().then((_) => {
            m.enqueue(new Uint8Array(_)), m.close();
          });
        }
      });
    } else
      this.status = 404, this.statusText = "Not Found", this.body = null;
  }
  /**
   * Updates the 'content-type' header property of the response based on the extension of
   * the file specified by the filePath property of the current object.
   * @returns {void}
   */
  updateContentType() {
    const e = this.filePath.toString().split(".").pop().toLowerCase();
    this.headers.set("content-type", this._CONTENT_TYPE_MAP[e] ?? "application/octet-stream");
  }
  /**
   * Clone the current FileResponse object.
   * @returns {FileResponse} A new FileResponse object with the same properties as the current object.
   */
  clone() {
    let e = new FileResponse(this.filePath);
    return e.exists = this.exists, e.status = this.status, e.statusText = this.statusText, e.headers = new Headers(this.headers), e;
  }
  /**
   * Reads the contents of the file specified by the filePath property and returns a Promise that
   * resolves with an ArrayBuffer containing the file's contents.
   * @returns {Promise<ArrayBuffer>} A Promise that resolves with an ArrayBuffer containing the file's contents.
   * @throws {Error} If the file cannot be read.
   */
  async arrayBuffer() {
    return (await sharp.promises.readFile(this.filePath)).buffer;
  }
  /**
   * Reads the contents of the file specified by the filePath property and returns a Promise that
   * resolves with a Blob containing the file's contents.
   * @returns {Promise<Blob>} A Promise that resolves with a Blob containing the file's contents.
   * @throws {Error} If the file cannot be read.
   */
  async blob() {
    const e = await sharp.promises.readFile(this.filePath);
    return new Blob([e], { type: this.headers.get("content-type") });
  }
  /**
   * Reads the contents of the file specified by the filePath property and returns a Promise that
   * resolves with a string containing the file's contents.
   * @returns {Promise<string>} A Promise that resolves with a string containing the file's contents.
   * @throws {Error} If the file cannot be read.
   */
  async text() {
    return await sharp.promises.readFile(this.filePath, "utf8");
  }
  /**
   * Reads the contents of the file specified by the filePath property and returns a Promise that
   * resolves with a parsed JavaScript object containing the file's contents.
   * 
   * @returns {Promise<Object>} A Promise that resolves with a parsed JavaScript object containing the file's contents.
   * @throws {Error} If the file cannot be read.
   */
  async json() {
    return JSON.parse(await this.text());
  }
}
function isValidUrl(s, e = null, r = null) {
  let o;
  try {
    o = new URL(s);
  } catch {
    return !1;
  }
  return !(e && !e.includes(o.protocol) || r && !r.includes(o.hostname));
}
async function getFile(s) {
  var e, r, o, m;
  if (env$1.useFS && !isValidUrl(s, ["http:", "https:", "blob:"]))
    return new FileResponse(s);
  if (typeof process < "u" && ((e = process == null ? void 0 : process.release) == null ? void 0 : e.name) === "node") {
    const _ = !!((r = process.env) != null && r.TESTING_REMOTELY), g = env$1.version, y = new Headers();
    if (y.set("User-Agent", `transformers.js/${g}; is_ci/${_};`), isValidUrl(s, ["http:", "https:"], ["huggingface.co", "hf.co"])) {
      const x = ((o = process.env) == null ? void 0 : o.HF_TOKEN) ?? ((m = process.env) == null ? void 0 : m.HF_ACCESS_TOKEN);
      x && y.set("Authorization", `Bearer ${x}`);
    }
    return fetch(s, { headers: y });
  } else
    return fetch(s);
}
const ERROR_MAPPING = {
  // 4xx errors (https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses)
  400: "Bad request error occurred while trying to load file",
  401: "Unauthorized access to file",
  403: "Forbidden access to file",
  404: "Could not locate file",
  408: "Request timeout error occurred while trying to load file",
  // 5xx errors (https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses)
  500: "Internal server error error occurred while trying to load file",
  502: "Bad gateway error occurred while trying to load file",
  503: "Service unavailable error occurred while trying to load file",
  504: "Gateway timeout error occurred while trying to load file"
};
function handleError(s, e, r) {
  if (!r)
    return null;
  const o = ERROR_MAPPING[s] ?? `Error (${s}) occurred while trying to load file`;
  throw Error(`${o}: "${e}".`);
}
class FileCache {
  /**
   * Instantiate a `FileCache` object.
   * @param {string} path 
   */
  constructor(e) {
    this.path = e;
  }
  /**
   * Checks whether the given request is in the cache.
   * @param {string} request 
   * @returns {Promise<FileResponse | undefined>}
   */
  async match(e) {
    let r = sharp.join(this.path, e), o = new FileResponse(r);
    if (o.exists)
      return o;
  }
  /**
   * Adds the given response to the cache.
   * @param {string} request 
   * @param {Response|FileResponse} response 
   * @returns {Promise<void>}
   */
  async put(e, r) {
    const o = Buffer.from(await r.arrayBuffer());
    let m = sharp.join(this.path, e);
    try {
      await sharp.promises.mkdir(sharp.dirname(m), { recursive: !0 }), await sharp.promises.writeFile(m, o);
    } catch (_) {
      console.warn("An error occurred while writing the file to cache:", _);
    }
  }
  // TODO add the rest?
  // addAll(requests: RequestInfo[]): Promise<void>;
  // delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<boolean>;
  // keys(request?: RequestInfo | URL, options?: CacheQueryOptions): Promise<ReadonlyArray<Request>>;
  // match(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<Response | undefined>;
  // matchAll(request?: RequestInfo | URL, options?: CacheQueryOptions): Promise<ReadonlyArray<Response>>;
}
async function tryCache(s, ...e) {
  for (let r of e)
    try {
      let o = await s.match(r);
      if (o) return o;
    } catch {
      continue;
    }
}
async function getModelFile(s, e, r = !0, o = {}) {
  if (!env$1.allowLocalModels && o.local_files_only)
    throw Error("Invalid configuration detected: local models are disabled (`env.allowLocalModels=false`) but you have requested to only use local models (`local_files_only=true`).");
  dispatchCallback(o.progress_callback, {
    status: "initiate",
    name: s,
    file: e
  });
  let m;
  if (!m && env$1.useBrowserCache) {
    if (typeof caches > "u")
      throw Error("Browser cache is not available in this environment.");
    try {
      m = await caches.open("transformers-cache");
    } catch (M) {
      console.warn("An error occurred while opening the browser cache:", M);
    }
  }
  !m && env$1.useFSCache && (m = new FileCache(o.cache_dir ?? env$1.cacheDir));
  const _ = o.revision ?? "main";
  let g = pathJoin(s, e), y = pathJoin(env$1.localModelPath, g), E = pathJoin(
    env$1.remoteHost,
    env$1.remotePathTemplate.replaceAll("{model}", s).replaceAll("{revision}", encodeURIComponent(_)),
    e
  ), x = _ === "main" ? g : pathJoin(s, _, e), v, h = m instanceof FileCache ? x : E, a = !1, b;
  m && (b = await tryCache(m, y, h));
  const w = b !== void 0;
  if (b === void 0) {
    if (env$1.allowLocalModels)
      if (isValidUrl(g, ["http:", "https:"])) {
        if (o.local_files_only)
          throw new Error(`\`local_files_only=true\`, but attempted to load a remote file from: ${g}.`);
      } else try {
        b = await getFile(y), v = y;
      } catch ($) {
        console.warn(`Unable to load from local path "${y}": "${$}"`);
      }
    if (b === void 0 || b.status === 404) {
      if (o.local_files_only) {
        if (r)
          throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${y}".`);
        return null;
      }
      if (b = await getFile(E), b.status !== 200)
        return handleError(b.status, E, r);
      v = h;
    }
    a = m && typeof Response < "u" && b instanceof Response && b.status === 200;
  }
  dispatchCallback(o.progress_callback, {
    status: "download",
    name: s,
    file: e
  });
  const k = {
    status: "progress",
    name: s,
    file: e
  };
  let A;
  return o.progress_callback ? w && typeof navigator < "u" && /firefox/i.test(navigator.userAgent) ? (A = new Uint8Array(await b.arrayBuffer()), dispatchCallback(o.progress_callback, {
    ...k,
    progress: 100,
    loaded: A.length,
    total: A.length
  })) : A = await readResponse(b, (M) => {
    dispatchCallback(o.progress_callback, {
      ...k,
      ...M
    });
  }) : A = new Uint8Array(await b.arrayBuffer()), // Only cache web responses
  // i.e., do not cache FileResponses (prevents duplication)
  a && v && // Check again whether request is in cache. If not, we add the response to the cache
  await m.match(v) === void 0 && await m.put(v, new Response(A, {
    headers: b.headers
  })).catch((M) => {
    console.warn(`Unable to add response to browser cache: ${M}.`);
  }), dispatchCallback(o.progress_callback, {
    status: "done",
    name: s,
    file: e
  }), A;
}
async function getModelJSON(s, e, r = !0, o = {}) {
  let m = await getModelFile(s, e, r, o);
  if (m === null)
    return {};
  let g = new TextDecoder("utf-8").decode(m);
  return JSON.parse(g);
}
async function readResponse(s, e) {
  const r = s.headers.get("Content-Length");
  r === null && console.warn("Unable to determine content-length from response headers. Will expand buffer when needed.");
  let o = parseInt(r ?? "0"), m = new Uint8Array(o), _ = 0;
  const g = s.body.getReader();
  async function y() {
    const { done: E, value: x } = await g.read();
    if (E) return;
    let v = _ + x.length;
    if (v > o) {
      o = v;
      let a = new Uint8Array(o);
      a.set(m), m = a;
    }
    m.set(x, _), _ = v;
    const h = _ / o * 100;
    return e({
      progress: h,
      loaded: _,
      total: o
    }), y();
  }
  return await y(), m;
}
function pathJoin(...s) {
  return s = s.map((e, r) => (r && (e = e.replace(new RegExp("^/"), "")), r !== s.length - 1 && (e = e.replace(new RegExp("/$"), "")), e)), s.join("/");
}
function permute_data(s, e, r) {
  const o = new Array(r.length), m = new Array(r.length);
  for (let y = r.length - 1, E = 1; y >= 0; --y)
    m[y] = E, o[y] = e[r[y]], E *= o[y];
  const _ = r.map((y, E) => m[r.indexOf(E)]), g = new s.constructor(s.length);
  for (let y = 0; y < s.length; ++y) {
    let E = 0;
    for (let x = e.length - 1, v = y; x >= 0; --x)
      E += v % e[x] * _[x], v = Math.floor(v / e[x]);
    g[E] = s[y];
  }
  return [g, o];
}
function softmax(s) {
  const e = max(s)[0], r = s.map((_) => Math.exp(_ - e)), o = r.reduce((_, g) => _ + g, 0);
  return r.map((_) => _ / o);
}
function log_softmax(s) {
  return softmax(s).map((o) => Math.log(o));
}
function getTopItems(s, e = 0) {
  return s = Array.from(s).map((r, o) => [o, r]).sort((r, o) => o[1] - r[1]), e !== null && e > 0 && (s = s.slice(0, e)), s;
}
function min(s) {
  if (s.length === 0) throw Error("Array must not be empty");
  let e = s[0], r = 0;
  for (let o = 1; o < s.length; ++o)
    s[o] < e && (e = s[o], r = o);
  return [e, r];
}
function max(s) {
  if (s.length === 0) throw Error("Array must not be empty");
  let e = s[0], r = 0;
  for (let o = 1; o < s.length; ++o)
    s[o] > e && (e = s[o], r = o);
  return [Number(e), r];
}
function medianFilter(s, e) {
  if (e % 2 === 0 || e <= 0)
    throw new Error("Window size must be a positive odd number");
  const r = new s.constructor(s.length), o = new s.constructor(e), m = Math.floor(e / 2);
  for (let _ = 0; _ < s.length; ++_) {
    let g = 0;
    for (let y = -m; y <= m; ++y) {
      let E = _ + y;
      E < 0 ? E = Math.abs(E) : E >= s.length && (E = 2 * (s.length - 1) - E), o[g++] = s[E];
    }
    o.sort(), r[_] = o[m];
  }
  return r;
}
function round(s, e) {
  const r = Math.pow(10, e);
  return Math.round(s * r) / r;
}
const DataTypeMap = Object.freeze({
  float32: Float32Array,
  float64: Float64Array,
  string: Array,
  // string[]
  int8: Int8Array,
  uint8: Uint8Array,
  int16: Int16Array,
  uint16: Uint16Array,
  int32: Int32Array,
  uint32: Uint32Array,
  int64: BigInt64Array,
  uint64: BigUint64Array,
  bool: Uint8Array
}), ONNXTensor$1 = ONNX.Tensor;
class Tensor {
  /**
   * Create a new Tensor or copy an existing Tensor.
   * @param {[DataType, DataArray, number[]]|[import('onnxruntime-common').Tensor]} args
   */
  constructor(...e) {
    /** @type {number[]} Dimensions of the tensor. */
    be(this, "dims");
    /** @type {DataType} Type of the tensor. */
    be(this, "type");
    /** @type {DataArray} The data stored in the tensor. */
    be(this, "data");
    /** @type {number} The number of elements in the tensor. */
    be(this, "size");
    return e[0] instanceof ONNXTensor$1 ? Object.assign(this, e[0]) : Object.assign(this, new ONNXTensor$1(
      /** @type {DataType} */
      e[0],
      /** @type {Exclude<import('./maths.js').AnyTypedArray, Uint8ClampedArray>} */
      e[1],
      e[2]
    )), new Proxy(this, {
      get: (r, o) => {
        if (typeof o == "string") {
          let m = Number(o);
          if (Number.isInteger(m))
            return r._getitem(m);
        }
        return r[o];
      },
      set: (r, o, m) => r[o] = m
    });
  }
  /**
   * Returns an iterator object for iterating over the tensor data in row-major order.
   * If the tensor has more than one dimension, the iterator will yield subarrays.
   * @returns {Iterator} An iterator object for iterating over the tensor data in row-major order.
   */
  *[Symbol.iterator]() {
    const [e, ...r] = this.dims;
    if (r.length > 0) {
      const o = r.reduce((m, _) => m * _);
      for (let m = 0; m < e; ++m)
        yield this._subarray(m, o, r);
    } else
      yield* this.data;
  }
  /**
   * Index into a Tensor object.
   * @param {number} index The index to access.
   * @returns {Tensor} The data at the specified index.
   */
  _getitem(e) {
    const [r, ...o] = this.dims;
    if (e = safeIndex(e, r), o.length > 0) {
      const m = o.reduce((_, g) => _ * g);
      return this._subarray(e, m, o);
    } else
      return new Tensor(this.type, [this.data[e]], o);
  }
  /**
   * @param {number|bigint} item The item to search for in the tensor
   * @returns {number} The index of the first occurrence of item in the tensor data.
   */
  indexOf(e) {
    for (let r = 0; r < this.data.length; ++r)
      if (this.data[r] == e)
        return r;
    return -1;
  }
  /**
   * @param {number} index 
   * @param {number} iterSize 
   * @param {any} iterDims 
   * @returns {Tensor}
   */
  _subarray(e, r, o) {
    const m = e * r, _ = (e + 1) * r, g = "subarray" in this.data ? this.data.subarray(m, _) : this.data.slice(m, _);
    return new Tensor(this.type, g, o);
  }
  /**
   * Returns the value of this tensor as a standard JavaScript Number. This only works
   * for tensors with one element. For other cases, see `Tensor.tolist()`.
   * @returns {number|bigint} The value of this tensor as a standard JavaScript Number.
   * @throws {Error} If the tensor has more than one element.
   */
  item() {
    if (this.data.length !== 1)
      throw new Error(`a Tensor with ${this.data.length} elements cannot be converted to Scalar`);
    return this.data[0];
  }
  /**
   * Convert tensor data to a n-dimensional JS list
   * @returns {Array}
   */
  tolist() {
    return reshape(this.data, this.dims);
  }
  /**
   * Return a new Tensor with the sigmoid function applied to each element.
   * @returns {Tensor} The tensor with the sigmoid function applied.
   */
  sigmoid() {
    return this.clone().sigmoid_();
  }
  /**
   * Applies the sigmoid function to the tensor in place.
   * @returns {Tensor} Returns `this`.
   */
  sigmoid_() {
    for (let e = 0; e < this.data.length; ++e)
      this.data[e] = 1 / (1 + Math.exp(-this.data[e]));
    return this;
  }
  /**
   * Return a new Tensor with every element multiplied by a constant.
   * @param {number} val The value to multiply by.
   * @returns {Tensor} The new tensor.
   */
  mul(e) {
    return this.clone().mul_(e);
  }
  /**
   * Multiply the tensor by a constant in place.
   * @param {number} val The value to multiply by.
   * @returns {Tensor} Returns `this`.
   */
  mul_(e) {
    for (let r = 0; r < this.data.length; ++r)
      this.data[r] *= e;
    return this;
  }
  /**
   * Return a new Tensor with every element added by a constant.
   * @param {number} val The value to add by.
   * @returns {Tensor} The new tensor.
   */
  add(e) {
    return this.clone().add_(e);
  }
  /**
   * Add the tensor by a constant in place.
   * @param {number} val The value to add by.
   * @returns {Tensor} Returns `this`.
   */
  add_(e) {
    for (let r = 0; r < this.data.length; ++r)
      this.data[r] += e;
    return this;
  }
  clone() {
    return new Tensor(this.type, this.data.slice(), this.dims.slice());
  }
  slice(...e) {
    let r = [], o = [];
    for (let E = 0; E < this.dims.length; ++E) {
      let x = e[E];
      if (x == null)
        o.push([0, this.dims[E]]), r.push(this.dims[E]);
      else if (typeof x == "number")
        x = safeIndex(x, this.dims[E], E), o.push([x, x + 1]);
      else if (Array.isArray(x) && x.length === 2) {
        if (x[0] > x[1])
          throw new Error(`Invalid slice: ${x}`);
        let v = [
          Math.max(x[0], 0),
          Math.min(x[1], this.dims[E])
        ];
        o.push(v), r.push(v[1] - v[0]);
      } else
        throw new Error(`Invalid slice: ${x}`);
    }
    let m = o.map(([E, x]) => x - E), _ = m.reduce((E, x) => E * x), g = new this.data.constructor(_);
    const y = this.stride();
    for (let E = 0; E < _; ++E) {
      let x = 0;
      for (let v = m.length - 1, h = E; v >= 0; --v) {
        const a = m[v];
        x += (h % a + o[v][0]) * y[v], h = Math.floor(h / a);
      }
      g[E] = this.data[x];
    }
    return new Tensor(this.type, g, r);
  }
  /**
   * Return a permuted version of this Tensor, according to the provided dimensions.
   * @param  {...number} dims Dimensions to permute.
   * @returns {Tensor} The permuted tensor.
   */
  permute(...e) {
    return permute(this, e);
  }
  // TODO: implement transpose. For now (backwards compatibility), it's just an alias for permute()
  transpose(...e) {
    return this.permute(...e);
  }
  // TODO add .max() and .min() methods
  /**
   * Returns the sum of each row of the input tensor in the given dimension dim.
   * 
   * @param {number} [dim=null] The dimension or dimensions to reduce. If `null`, all dimensions are reduced.
   * @param {boolean} keepdim Whether the output tensor has `dim` retained or not.
   * @returns The summed tensor
   */
  sum(e = null, r = !1) {
    return this.norm(1, e, r);
  }
  /**
   * Returns the matrix norm or vector norm of a given tensor.
   * @param {number|string} [p='fro'] The order of norm
   * @param {number} [dim=null] Specifies which dimension of the tensor to calculate the norm across.
   * If dim is None, the norm will be calculated across all dimensions of input.
   * @param {boolean} [keepdim=false] Whether the output tensors have dim retained or not.
   * @returns {Tensor} The norm of the tensor.
   */
  norm(e = "fro", r = null, o = !1) {
    if (e === "fro")
      e = 2;
    else if (typeof e == "string")
      throw Error(`Unsupported norm: ${e}`);
    if (r === null) {
      let g = this.data.reduce((y, E) => y + E ** e, 0) ** (1 / e);
      return new Tensor(this.type, [g], []);
    }
    r = safeIndex(r, this.dims.length);
    const m = this.dims.slice();
    m[r] = 1;
    const _ = new this.data.constructor(this.data.length / this.dims[r]);
    for (let g = 0; g < this.data.length; ++g) {
      let y = 0;
      for (let E = this.dims.length - 1, x = g, v = 1; E >= 0; --E) {
        const h = this.dims[E];
        if (E !== r) {
          const a = x % h;
          y += a * v, v *= m[E];
        }
        x = Math.floor(x / h);
      }
      _[y] += this.data[g] ** e;
    }
    if (e !== 1)
      for (let g = 0; g < _.length; ++g)
        _[g] = _[g] ** (1 / e);
    return o || m.splice(r, 1), new Tensor(this.type, _, m);
  }
  /**
   * Performs `L_p` normalization of inputs over specified dimension. Operates in place.
   * @param {number} [p=2] The exponent value in the norm formulation
   * @param {number} [dim=1] The dimension to reduce
   * @returns {Tensor} `this` for operation chaining.
   */
  normalize_(e = 2, r = 1) {
    r = safeIndex(r, this.dims.length);
    const o = this.norm(e, r, !0);
    for (let m = 0; m < this.data.length; ++m) {
      let _ = 0;
      for (let g = this.dims.length - 1, y = m, E = 1; g >= 0; --g) {
        const x = this.dims[g];
        if (g !== r) {
          const v = y % x;
          _ += v * E, E *= this.dims[g];
        }
        y = Math.floor(y / x);
      }
      this.data[m] /= o.data[_];
    }
    return this;
  }
  /**
   * Performs `L_p` normalization of inputs over specified dimension.
   * @param {number} [p=2] The exponent value in the norm formulation
   * @param {number} [dim=1] The dimension to reduce
   * @returns {Tensor} The normalized tensor.
   */
  normalize(e = 2, r = 1) {
    return this.clone().normalize_(e, r);
  }
  /**
   * Compute and return the stride of this tensor.
   * Stride is the jump necessary to go from one element to the next one in the specified dimension dim.
   * @returns {number[]} The stride of this tensor.
   */
  stride() {
    return dimsToStride(this.dims);
  }
  /**
   * Returns a tensor with all specified dimensions of input of size 1 removed.
   * 
   * NOTE: The returned tensor shares the storage with the input tensor, so changing the contents of one will change the contents of the other.
   * If you would like a copy, use `tensor.clone()` before squeezing.
   * 
   * @param {number} [dim=null] If given, the input will be squeezed only in the specified dimensions.
   * @returns The squeezed tensor
   */
  squeeze(e = null) {
    return new Tensor(
      this.type,
      this.data,
      calc_squeeze_dims(this.dims, e)
    );
  }
  /**
   * In-place version of @see {@link Tensor.squeeze}
   */
  squeeze_(e = null) {
    return this.dims = calc_squeeze_dims(this.dims, e), this;
  }
  /**
   * Returns a new tensor with a dimension of size one inserted at the specified position.
   * 
   * NOTE: The returned tensor shares the same underlying data with this tensor.
   * 
   * @param {number} dim The index at which to insert the singleton dimension
   * @returns The unsqueezed tensor
   */
  unsqueeze(e = null) {
    return new Tensor(
      this.type,
      this.data,
      calc_unsqueeze_dims(this.dims, e)
    );
  }
  /**
   * In-place version of @see {@link Tensor.unsqueeze}
   */
  unsqueeze_(e = null) {
    return this.dims = calc_unsqueeze_dims(this.dims, e), this;
  }
  /**
   * In-place version of @see {@link Tensor.flatten}
   */
  flatten_(e = 0, r = -1) {
    r = (r + this.dims.length) % this.dims.length;
    let o = this.dims.slice(0, e), m = this.dims.slice(e, r + 1), _ = this.dims.slice(r + 1);
    return this.dims = [...o, m.reduce((g, y) => g * y, 1), ..._], this;
  }
  /**
   * Flattens input by reshaping it into a one-dimensional tensor.
   * If `start_dim` or `end_dim` are passed, only dimensions starting with `start_dim`
   * and ending with `end_dim` are flattened. The order of elements in input is unchanged.
   * @param {number} start_dim the first dim to flatten
   * @param {number} end_dim the last dim to flatten
   * @returns The flattened tensor.
   */
  flatten(e = 0, r = -1) {
    return this.clone().flatten_(e, r);
  }
  /**
   * Returns a new tensor with the same data as the `self` tensor but of a different `shape`.
   * @param  {...number} dims the desired size
   * @returns {Tensor} The tensor with the same data but different shape
   */
  view(...e) {
    let r = -1;
    for (let o = 0; o < e.length; ++o)
      if (e[o] === -1) {
        if (r !== -1)
          throw new Error("Only one dimension can be inferred");
        r = o;
      }
    if (r !== -1) {
      const o = e.reduce((m, _, g) => g !== r ? m * _ : m, 1);
      e[r] = this.data.length / o;
    }
    return new Tensor(this.type, this.data, e);
  }
  neg_() {
    for (let e = 0; e < this.data.length; ++e)
      this.data[e] = -this.data[e];
    return this;
  }
  neg() {
    return this.clone().neg_();
  }
  /**
   * In-place version of @see {@link Tensor.clamp}
   */
  clamp_(e, r) {
    for (let o = 0; o < this.data.length; ++o)
      this.data[o] = Math.min(Math.max(this.data[o], e), r);
    return this;
  }
  /**
   * Clamps all elements in input into the range [ min, max ]
   * @param {number} min lower-bound of the range to be clamped to
   * @param {number} max upper-bound of the range to be clamped to
   * @returns the output tensor.
   */
  clamp(e, r) {
    return this.clone().clamp_(e, r);
  }
  /**
   * In-place version of @see {@link Tensor.round}
   */
  round_() {
    for (let e = 0; e < this.data.length; ++e)
      this.data[e] = Math.round(this.data[e]);
    return this;
  }
  /**
   * Rounds elements of input to the nearest integer.
   * @returns the output tensor.
   */
  round() {
    return this.clone().round_();
  }
  /**
   * Performs Tensor dtype conversion.
   * @param {DataType} type The desired data type.
   * @returns {Tensor} The converted tensor.
   */
  to(e) {
    if (this.type === e) return this;
    if (!DataTypeMap.hasOwnProperty(e))
      throw new Error(`Unsupported type: ${e}`);
    return new Tensor(e, DataTypeMap[e].from(this.data), this.dims);
  }
}
function reshape(s, e) {
  const r = s.length, o = e.reduce((_, g) => _ * g);
  if (r !== o)
    throw Error(`cannot reshape array of size ${r} into shape (${e})`);
  let m = s;
  for (let _ = e.length - 1; _ >= 0; _--)
    m = m.reduce((g, y) => {
      let E = g[g.length - 1];
      return E.length < e[_] ? E.push(y) : g.push([y]), g;
    }, [[]]);
  return m[0];
}
function permute(s, e) {
  const [r, o] = permute_data(s.data, s.dims, e);
  return new Tensor(s.type, r, o);
}
function calc_squeeze_dims(s, e) {
  return s = s.slice(), e === null ? s = s.filter((r) => r !== 1) : typeof e == "number" ? s[e] === 1 && s.splice(e, 1) : Array.isArray(e) && (s = s.filter((r, o) => r !== 1 || !e.includes(o))), s;
}
function calc_unsqueeze_dims(s, e) {
  return e = safeIndex(e, s.length + 1), s = s.slice(), s.splice(e, 0, 1), s;
}
function safeIndex(s, e, r = null) {
  if (s < -e || s >= e)
    throw new Error(`IndexError: index ${s} is out of bounds for dimension${r === null ? "" : " " + r} with size ${e}`);
  return s < 0 && (s = (s % e + e) % e), s;
}
function cat(s, e = 0) {
  e = safeIndex(e, s[0].dims.length);
  const r = s[0].dims.slice();
  r[e] = s.reduce((g, y) => g + y.dims[e], 0);
  const o = r.reduce((g, y) => g * y, 1), m = new s[0].data.constructor(o), _ = s[0].type;
  if (e === 0) {
    let g = 0;
    for (let y of s)
      m.set(y.data, g), g += y.data.length;
  } else {
    let g = 0;
    for (let y = 0; y < s.length; ++y) {
      let E = s[y];
      for (let x = 0; x < E.data.length; ++x) {
        let v = 0;
        for (let h = E.dims.length - 1, a = x, b = 1; h >= 0; --h) {
          const w = E.dims[h];
          let k = a % w;
          h === e && (k += g), v += k * b, b *= r[h], a = Math.floor(a / w);
        }
        m[v] = E.data[x];
      }
      g += E.dims[e];
    }
  }
  return new Tensor(_, m, r);
}
function stack(s, e = 0) {
  return cat(s.map((r) => r.unsqueeze(e)), e);
}
function std_mean(s, e = null, r = 1, o = !1) {
  if (e === null) {
    const x = s.data.reduce((b, w) => b + w, 0) / s.data.length, v = Math.sqrt(s.data.reduce((b, w) => b + (w - x) ** 2, 0) / (s.data.length - r)), h = new Tensor(s.type, [x], [
      /* scalar */
    ]);
    return [new Tensor(s.type, [v], [
      /* scalar */
    ]), h];
  }
  e = safeIndex(e, s.dims.length);
  const m = mean(s, e, o), _ = s.dims.slice();
  _[e] = 1;
  const g = new s.data.constructor(s.data.length / s.dims[e]);
  for (let E = 0; E < s.data.length; ++E) {
    let x = 0;
    for (let v = s.dims.length - 1, h = E, a = 1; v >= 0; --v) {
      const b = s.dims[v];
      if (v !== e) {
        const w = h % b;
        x += w * a, a *= _[v];
      }
      h = Math.floor(h / b);
    }
    g[x] += (s.data[E] - m.data[x]) ** 2;
  }
  for (let E = 0; E < g.length; ++E)
    g[E] = Math.sqrt(g[E] / (s.dims[e] - r));
  return o || _.splice(e, 1), [new Tensor(s.type, g, _), m];
}
function mean(s, e = null, r = !1) {
  if (e === null) {
    let _ = s.data.reduce((g, y) => g + y, 0);
    return new Tensor(s.type, [_ / s.data.length], [
      /* scalar */
    ]);
  }
  e = safeIndex(e, s.dims.length);
  const o = s.dims.slice();
  o[e] = 1;
  const m = new s.data.constructor(s.data.length / s.dims[e]);
  for (let _ = 0; _ < s.data.length; ++_) {
    let g = 0;
    for (let y = s.dims.length - 1, E = _, x = 1; y >= 0; --y) {
      const v = s.dims[y];
      if (y !== e) {
        const h = E % v;
        g += h * x, x *= o[y];
      }
      E = Math.floor(E / v);
    }
    m[g] += s.data[_];
  }
  if (s.dims[e] !== 1)
    for (let _ = 0; _ < m.length; ++_)
      m[_] = m[_] / s.dims[e];
  return r || o.splice(e, 1), new Tensor(s.type, m, o);
}
function dynamicTimeWarping(s) {
  const [e, r] = s.dims, o = [e + 1, r + 1], m = new Tensor(
    "float32",
    new Float32Array(o[0] * o[1]).fill(1 / 0),
    o
  ), _ = new Tensor(
    "float32",
    new Float32Array(o[0] * o[1]).fill(-1),
    o
  );
  m[0].data[0] = 0;
  for (let v = 1; v < r + 1; ++v)
    for (let h = 1; h < e + 1; ++h) {
      const a = m[h - 1][v - 1].item(), b = m[h - 1][v].item(), w = m[h][v - 1].item();
      let k, A;
      a < b && a < w ? (k = a, A = 0) : b < a && b < w ? (k = b, A = 1) : (k = w, A = 2), m[h].data[v] = s[h - 1][v - 1].item() + k, _[h].data[v] = A;
    }
  let g = e, y = r;
  _.data.fill(2, 0, o[1]);
  for (let v = 0; v < o[0]; ++v)
    _[v].data[0] = 1;
  let E = [], x = [];
  for (; g > 0 || y > 0; )
    switch (E.push(g - 1), x.push(y - 1), _[g][y].item()) {
      case 0:
        --g, --y;
        break;
      case 1:
        --g;
        break;
      case 2:
        --y;
        break;
      default:
        throw new Error(
          `Internal error in dynamic time warping. Unexpected trace[${g}, ${y}]. Please file a bug report.`
        );
    }
  return E.reverse(), x.reverse(), [E, x];
}
function dimsToStride(s) {
  const e = new Array(s.length);
  for (let r = s.length - 1, o = 1; r >= 0; --r)
    e[r] = o, o *= s[r];
  return e;
}
function ones(s) {
  const e = s.reduce((r, o) => r * o, 1);
  return new Tensor(
    "int64",
    new BigInt64Array(e).fill(1n),
    s
  );
}
function ones_like(s) {
  return ones(s.dims);
}
class PriorityQueue {
  /**
   * Create a new PriorityQueue.
   * @param {Function} comparator Comparator function to determine priority. Defaults to a MaxHeap.
   */
  constructor(e = (r, o) => r > o) {
    this._heap = [], this._comparator = e;
  }
  /**
   * The size of the queue
   */
  get size() {
    return this._heap.length;
  }
  /**
   * Check if the queue is empty.
   * @returns {boolean} `true` if the queue is empty, `false` otherwise.
   */
  isEmpty() {
    return this.size === 0;
  }
  /**
   * Return the element with the highest priority in the queue.
   * @returns {any} The highest priority element in the queue.
   */
  peek() {
    return this._heap[0];
  }
  /**
   * Add one or more elements to the queue.
   * @param  {...any} values The values to push into the queue.
   * @returns {number} The new size of the queue.
   */
  push(...e) {
    return this.extend(e);
  }
  /**
   * Add multiple elements to the queue.
   * @param {any[]} values The values to push into the queue.
   * @returns {number} The new size of the queue.
   */
  extend(e) {
    for (const r of e)
      this._heap.push(r), this._siftUp();
    return this.size;
  }
  /**
   * Remove and return the element with the highest priority in the queue.
   * @returns {any} The element with the highest priority in the queue.
   */
  pop() {
    const e = this.peek(), r = this.size - 1;
    return r > 0 && this._swap(0, r), this._heap.pop(), this._siftDown(), e;
  }
  /**
   * Replace the element with the highest priority in the queue with a new value.
   * @param {*} value The new value.
   * @returns {*} The replaced value.
   */
  replace(e) {
    const r = this.peek();
    return this._heap[0] = e, this._siftDown(), r;
  }
  /**
   * Compute the index for the parent of the node at index `i`.
   * @param {number} i The index of the node to get the parent of.
   * @returns {number} The index of the parent node.
   * @private
   */
  _parent(e) {
    return (e + 1 >>> 1) - 1;
  }
  /**
   * Compute the index for the left child of the node at index `i`.
   * @param {number} i The index of the node to get the left child of.
   * @returns {number} The index of the left child.
   * @private
   */
  _left(e) {
    return (e << 1) + 1;
  }
  /**
   * Compute the index for the right child of the node at index `i`.
   * @param {number} i The index of the node to get the right child of.
   * @returns {number} The index of the right child.
   * @private
   */
  _right(e) {
    return e + 1 << 1;
  }
  /**
   * Check if the element at index `i` is greater than the element at index `j`.
   * @param {number} i The index of the first element to compare.
   * @param {number} j The index of the second element to compare.
   * @returns {boolean} `true` if the element at index `i` is greater than the element at index `j`, `false` otherwise.
   * @private
   */
  _greater(e, r) {
    return this._comparator(this._heap[e], this._heap[r]);
  }
  /**
   * Swap the elements at indices `i` and `j`.
   * @param {number} i The index of the first element to swap.
   * @param {number} j The index of the second element to swap.
   * @private
   */
  _swap(e, r) {
    const o = this._heap[e];
    this._heap[e] = this._heap[r], this._heap[r] = o;
  }
  /**
   * Maintain the heap property by updating positions in the heap,
   * starting at the last element and moving up the heap.
   * @private
   */
  _siftUp() {
    let e = this.size - 1;
    for (; e > 0 && this._greater(e, this._parent(e)); )
      this._swap(e, this._parent(e)), e = this._parent(e);
  }
  /**
   * Maintain the heap property by updating positions in the heap,
   * starting at the first element and moving down the heap.
   * @private
   */
  _siftDown() {
    let e = 0;
    for (; this._left(e) < this.size && this._greater(this._left(e), e) || this._right(e) < this.size && this._greater(this._right(e), e); ) {
      const r = this._right(e) < this.size && this._greater(this._right(e), this._left(e)) ? this._right(e) : this._left(e);
      this._swap(e, r), e = r;
    }
  }
}
class CharTrie {
  constructor() {
    this.root = CharTrieNode.default();
  }
  /**
   * Adds one or more `texts` to the trie.
   * @param {string[]} texts The strings to add to the trie.
   */
  extend(e) {
    for (let r of e)
      this.push(r);
  }
  /**
   * Adds text to the trie.
   * @param {string} text The string to add to the trie.
   */
  push(e) {
    let r = this.root;
    for (let o of e) {
      let m = r.children.get(o);
      m === void 0 && (m = CharTrieNode.default(), r.children.set(o, m)), r = m;
    }
    r.isLeaf = !0;
  }
  /**
   * Searches the trie for all strings with a common prefix of `text`.
   * @param {string} text The common prefix to search for.
   * @yields {string} Each string in the trie that has `text` as a prefix.
   */
  *commonPrefixSearch(e) {
    let r = this.root, o = "";
    for (let m = 0; m < e.length && r !== void 0; ++m) {
      const _ = e[m];
      o += _, r = r.children.get(_), r !== void 0 && r.isLeaf && (yield o);
    }
  }
}
class CharTrieNode {
  /**
   * Create a new CharTrieNode.
   * @param {boolean} isLeaf Whether the node is a leaf node or not.
   * @param {Map<string, CharTrieNode>} children A map containing the node's children, where the key is a character and the value is a `CharTrieNode`.
   */
  constructor(e, r) {
    this.isLeaf = e, this.children = r;
  }
  /**
   * Returns a new `CharTrieNode` instance with default values.
   * @returns {CharTrieNode} A new `CharTrieNode` instance with `isLeaf` set to `false` and an empty `children` map.
   */
  static default() {
    return new CharTrieNode(!1, /* @__PURE__ */ new Map());
  }
}
class TokenLattice {
  /**
   * Creates a new TokenLattice instance.
   *
   * @param {string} sentence The input sentence to be tokenized.
   * @param {number} bosTokenId The beginning-of-sequence token ID.
   * @param {number} eosTokenId The end-of-sequence token ID.
   */
  constructor(e, r, o) {
    this.sentence = e, this.len = e.length, this.bosTokenId = r, this.eosTokenId = o, this.nodes = [], this.beginNodes = Array.from({ length: this.len + 1 }, () => []), this.endNodes = Array.from({ length: this.len + 1 }, () => []);
    const m = new TokenLatticeNode(this.bosTokenId, 0, 0, 0, 0), _ = new TokenLatticeNode(this.eosTokenId, 1, this.len, 0, 0);
    this.nodes.push(m.clone()), this.nodes.push(_.clone()), this.beginNodes[this.len].push(_), this.endNodes[0].push(m);
  }
  /**
   * Inserts a new token node into the token lattice.
   *
   * @param {number} pos The starting position of the token.
   * @param {number} length The length of the token.
   * @param {number} score The score of the token.
   * @param {number} tokenId The token ID of the token.
   */
  insert(e, r, o, m) {
    const _ = this.nodes.length, g = new TokenLatticeNode(m, _, e, r, o);
    this.beginNodes[e].push(g), this.endNodes[e + r].push(g), this.nodes.push(g);
  }
  /**
   * Implements the Viterbi algorithm to compute the most likely sequence of tokens.
   *
   * @returns {TokenLatticeNode[]} The array of nodes representing the most likely sequence of tokens.
   */
  viterbi() {
    const e = this.len;
    let r = 0;
    for (; r <= e; ) {
      if (this.beginNodes[r].length == 0)
        return [];
      for (let y of this.beginNodes[r]) {
        y.prev = null;
        let E = 0, x = null;
        for (let v of this.endNodes[r]) {
          const h = v.backtraceScore + y.score;
          (x === null || h > E) && (x = v.clone(), E = h);
        }
        if (x !== null)
          y.prev = x, y.backtraceScore = E;
        else
          return [];
      }
      ++r;
    }
    const o = [], _ = this.beginNodes[e][0].prev;
    if (_ === null)
      return [];
    let g = _.clone();
    for (; g.prev !== null; )
      o.push(g.clone()), g = g.clone().prev.clone();
    return o.reverse(), o;
  }
  /**
   * @param {TokenLatticeNode} node
   * @returns {string} The array of nodes representing the most likely sequence of tokens.
   */
  piece(e) {
    return this.sentence.slice(e.pos, e.pos + e.length);
  }
  /**
   * @returns {Array} The array of nodes representing the most likely sequence of tokens.
   */
  tokens() {
    return this.viterbi().map((r) => this.piece(r));
  }
  /**
   * @returns {Array} The array of nodes representing the most likely sequence of tokens.
   */
  tokenIds() {
    return this.viterbi().map((r) => r.tokenId);
  }
}
class TokenLatticeNode {
  /**
   * Represents a node in a token lattice for a given sentence.
   * @param {number} tokenId The ID of the token associated with this node.
   * @param {number} nodeId The ID of this node.
   * @param {number} pos The starting position of the token in the sentence.
   * @param {number} length The length of the token.
   * @param {number} score The score associated with the token.
   */
  constructor(e, r, o, m, _) {
    this.tokenId = e, this.nodeId = r, this.pos = o, this.length = m, this.score = _, this.prev = null, this.backtraceScore = 0;
  }
  /**
   * Returns a clone of this node.
   * @returns {TokenLatticeNode} A clone of this node.
   */
  clone() {
    const e = new TokenLatticeNode(this.tokenId, this.nodeId, this.pos, this.length, this.score);
    return e.prev = this.prev, e.backtraceScore = this.backtraceScore, e;
  }
}
var TOKEN_TYPES = Object.freeze({
  Text: "Text",
  // The text between Jinja statements or expressions
  NumericLiteral: "NumericLiteral",
  // e.g., 123
  BooleanLiteral: "BooleanLiteral",
  // true or false
  StringLiteral: "StringLiteral",
  // 'string'
  Identifier: "Identifier",
  // Variables, functions, etc.
  Equals: "Equals",
  // =
  OpenParen: "OpenParen",
  // (
  CloseParen: "CloseParen",
  // )
  OpenStatement: "OpenStatement",
  // {%
  CloseStatement: "CloseStatement",
  // %}
  OpenExpression: "OpenExpression",
  // {{
  CloseExpression: "CloseExpression",
  // }}
  OpenSquareBracket: "OpenSquareBracket",
  // [
  CloseSquareBracket: "CloseSquareBracket",
  // ]
  OpenCurlyBracket: "OpenCurlyBracket",
  // {
  CloseCurlyBracket: "CloseCurlyBracket",
  // }
  Comma: "Comma",
  // ,
  Dot: "Dot",
  // .
  Colon: "Colon",
  // :
  Pipe: "Pipe",
  // |
  CallOperator: "CallOperator",
  // ()
  AdditiveBinaryOperator: "AdditiveBinaryOperator",
  // + -
  MultiplicativeBinaryOperator: "MultiplicativeBinaryOperator",
  // * / %
  ComparisonBinaryOperator: "ComparisonBinaryOperator",
  // < > <= >= == !=
  UnaryOperator: "UnaryOperator",
  // ! - +
  // Keywords
  Set: "Set",
  If: "If",
  For: "For",
  In: "In",
  Is: "Is",
  NotIn: "NotIn",
  Else: "Else",
  EndIf: "EndIf",
  ElseIf: "ElseIf",
  EndFor: "EndFor",
  And: "And",
  Or: "Or",
  Not: "UnaryOperator"
}), KEYWORDS = Object.freeze({
  set: TOKEN_TYPES.Set,
  for: TOKEN_TYPES.For,
  in: TOKEN_TYPES.In,
  is: TOKEN_TYPES.Is,
  if: TOKEN_TYPES.If,
  else: TOKEN_TYPES.Else,
  endif: TOKEN_TYPES.EndIf,
  elif: TOKEN_TYPES.ElseIf,
  endfor: TOKEN_TYPES.EndFor,
  and: TOKEN_TYPES.And,
  or: TOKEN_TYPES.Or,
  not: TOKEN_TYPES.Not,
  "not in": TOKEN_TYPES.NotIn,
  // Literals
  true: TOKEN_TYPES.BooleanLiteral,
  false: TOKEN_TYPES.BooleanLiteral
}), Token = class {
  /**
   * Constructs a new Token.
   * @param {string} value The raw value as seen inside the source code.
   * @param {TokenType} type The type of token.
   */
  constructor(s, e) {
    this.value = s, this.type = e;
  }
};
function isWord(s) {
  return /\w/.test(s);
}
function isInteger(s) {
  return /[0-9]/.test(s);
}
var ORDERED_MAPPING_TABLE = [
  // Control sequences
  ["{%", TOKEN_TYPES.OpenStatement],
  ["%}", TOKEN_TYPES.CloseStatement],
  ["{{", TOKEN_TYPES.OpenExpression],
  ["}}", TOKEN_TYPES.CloseExpression],
  // Single character tokens
  ["(", TOKEN_TYPES.OpenParen],
  [")", TOKEN_TYPES.CloseParen],
  ["{", TOKEN_TYPES.OpenCurlyBracket],
  ["}", TOKEN_TYPES.CloseCurlyBracket],
  ["[", TOKEN_TYPES.OpenSquareBracket],
  ["]", TOKEN_TYPES.CloseSquareBracket],
  [",", TOKEN_TYPES.Comma],
  [".", TOKEN_TYPES.Dot],
  [":", TOKEN_TYPES.Colon],
  ["|", TOKEN_TYPES.Pipe],
  // Comparison operators
  ["<=", TOKEN_TYPES.ComparisonBinaryOperator],
  [">=", TOKEN_TYPES.ComparisonBinaryOperator],
  ["==", TOKEN_TYPES.ComparisonBinaryOperator],
  ["!=", TOKEN_TYPES.ComparisonBinaryOperator],
  ["<", TOKEN_TYPES.ComparisonBinaryOperator],
  [">", TOKEN_TYPES.ComparisonBinaryOperator],
  // Arithmetic operators
  ["+", TOKEN_TYPES.AdditiveBinaryOperator],
  ["-", TOKEN_TYPES.AdditiveBinaryOperator],
  ["*", TOKEN_TYPES.MultiplicativeBinaryOperator],
  ["/", TOKEN_TYPES.MultiplicativeBinaryOperator],
  ["%", TOKEN_TYPES.MultiplicativeBinaryOperator],
  // Assignment operator
  ["=", TOKEN_TYPES.Equals]
], ESCAPE_CHARACTERS = /* @__PURE__ */ new Map([
  ["n", `
`],
  // New line
  ["t", "	"],
  // Horizontal tab
  ["r", "\r"],
  // Carriage return
  ["b", "\b"],
  // Backspace
  ["f", "\f"],
  // Form feed
  ["v", "\v"],
  // Vertical tab
  ["'", "'"],
  // Single quote
  ['"', '"'],
  // Double quote
  ["\\", "\\"]
  // Backslash
]);
function preprocess(s, e = {}) {
  return s.endsWith(`
`) && (s = s.slice(0, -1)), s = s.replace(/{#.*?#}/gs, "{##}"), e.lstrip_blocks && (s = s.replace(/^[ \t]*({[#%])/gm, "$1")), e.trim_blocks && (s = s.replace(/([#%]})\n/g, "$1")), s.replace(/{##}/g, "").replace(/-%}\s*/g, "%}").replace(/\s*{%-/g, "{%").replace(/-}}\s*/g, "}}").replace(/\s*{{-/g, "{{");
}
function tokenize(s, e = {}) {
  var g, y, E;
  const r = [], o = preprocess(s, e);
  let m = 0;
  const _ = (x) => {
    let v = "";
    for (; x(o[m]); ) {
      if (o[m] === "\\") {
        if (++m, m >= o.length)
          throw new SyntaxError("Unexpected end of input");
        const h = o[m++], a = ESCAPE_CHARACTERS.get(h);
        if (a === void 0)
          throw new SyntaxError(`Unexpected escaped character: ${h}`);
        v += a;
        continue;
      }
      if (v += o[m++], m >= o.length)
        throw new SyntaxError("Unexpected end of input");
    }
    return v;
  };
  e:
    for (; m < o.length; ) {
      const x = (g = r.at(-1)) == null ? void 0 : g.type;
      if (x === void 0 || x === TOKEN_TYPES.CloseStatement || x === TOKEN_TYPES.CloseExpression) {
        let h = "";
        for (; m < o.length && // Keep going until we hit the next Jinja statement or expression
        !(o[m] === "{" && (o[m + 1] === "%" || o[m + 1] === "{")); )
          h += o[m++];
        if (h.length > 0) {
          r.push(new Token(h, TOKEN_TYPES.Text));
          continue;
        }
      }
      _((h) => /\s/.test(h));
      const v = o[m];
      if (v === "-" || v === "+") {
        const h = (y = r.at(-1)) == null ? void 0 : y.type;
        if (h === TOKEN_TYPES.Text || h === void 0)
          throw new SyntaxError(`Unexpected character: ${v}`);
        switch (h) {
          case TOKEN_TYPES.Identifier:
          case TOKEN_TYPES.NumericLiteral:
          case TOKEN_TYPES.BooleanLiteral:
          case TOKEN_TYPES.StringLiteral:
          case TOKEN_TYPES.CloseParen:
          case TOKEN_TYPES.CloseSquareBracket:
            break;
          default: {
            ++m;
            const a = _(isInteger);
            r.push(
              new Token(`${v}${a}`, a.length > 0 ? TOKEN_TYPES.NumericLiteral : TOKEN_TYPES.UnaryOperator)
            );
            continue;
          }
        }
      }
      for (const [h, a] of ORDERED_MAPPING_TABLE)
        if (o.slice(m, m + h.length) === h) {
          r.push(new Token(h, a)), m += h.length;
          continue e;
        }
      if (v === "'" || v === '"') {
        ++m;
        const h = _((a) => a !== v);
        r.push(new Token(h, TOKEN_TYPES.StringLiteral)), ++m;
        continue;
      }
      if (isInteger(v)) {
        const h = _(isInteger);
        r.push(new Token(h, TOKEN_TYPES.NumericLiteral));
        continue;
      }
      if (isWord(v)) {
        const h = _(isWord), a = Object.hasOwn(KEYWORDS, h) ? KEYWORDS[h] : TOKEN_TYPES.Identifier;
        a === TOKEN_TYPES.In && ((E = r.at(-1)) == null ? void 0 : E.type) === TOKEN_TYPES.Not ? (r.pop(), r.push(new Token("not in", TOKEN_TYPES.NotIn))) : r.push(new Token(h, a));
        continue;
      }
      throw new SyntaxError(`Unexpected character: ${v}`);
    }
  return r;
}
var Statement = class {
  constructor() {
    be(this, "type", "Statement");
  }
}, Program = class extends Statement {
  constructor(e) {
    super();
    be(this, "type", "Program");
    this.body = e;
  }
}, If = class extends Statement {
  constructor(e, r, o) {
    super();
    be(this, "type", "If");
    this.test = e, this.body = r, this.alternate = o;
  }
}, For = class extends Statement {
  constructor(e, r, o) {
    super();
    be(this, "type", "For");
    this.loopvar = e, this.iterable = r, this.body = o;
  }
}, SetStatement = class extends Statement {
  constructor(e, r) {
    super();
    be(this, "type", "Set");
    this.assignee = e, this.value = r;
  }
}, Expression = class extends Statement {
  constructor() {
    super(...arguments);
    be(this, "type", "Expression");
  }
}, MemberExpression = class extends Expression {
  constructor(e, r, o) {
    super();
    be(this, "type", "MemberExpression");
    this.object = e, this.property = r, this.computed = o;
  }
}, CallExpression = class extends Expression {
  constructor(e, r) {
    super();
    be(this, "type", "CallExpression");
    this.callee = e, this.args = r;
  }
}, Identifier = class extends Expression {
  /**
   * @param {string} value The name of the identifier
   */
  constructor(e) {
    super();
    be(this, "type", "Identifier");
    this.value = e;
  }
}, Literal = class extends Expression {
  constructor(e) {
    super();
    be(this, "type", "Literal");
    this.value = e;
  }
}, NumericLiteral = class extends Literal {
  constructor() {
    super(...arguments);
    be(this, "type", "NumericLiteral");
  }
}, StringLiteral = class extends Literal {
  constructor() {
    super(...arguments);
    be(this, "type", "StringLiteral");
  }
}, BooleanLiteral = class extends Literal {
  constructor() {
    super(...arguments);
    be(this, "type", "BooleanLiteral");
  }
}, ArrayLiteral = class extends Literal {
  constructor() {
    super(...arguments);
    be(this, "type", "ArrayLiteral");
  }
}, TupleLiteral = class extends Literal {
  constructor() {
    super(...arguments);
    be(this, "type", "TupleLiteral");
  }
}, ObjectLiteral = class extends Literal {
  constructor() {
    super(...arguments);
    be(this, "type", "ObjectLiteral");
  }
}, BinaryExpression = class extends Expression {
  constructor(e, r, o) {
    super();
    be(this, "type", "BinaryExpression");
    this.operator = e, this.left = r, this.right = o;
  }
}, FilterExpression = class extends Expression {
  constructor(e, r) {
    super();
    be(this, "type", "FilterExpression");
    this.operand = e, this.filter = r;
  }
}, TestExpression = class extends Expression {
  constructor(e, r, o) {
    super();
    be(this, "type", "TestExpression");
    this.operand = e, this.negate = r, this.test = o;
  }
}, UnaryExpression = class extends Expression {
  constructor(e, r) {
    super();
    be(this, "type", "UnaryExpression");
    this.operator = e, this.argument = r;
  }
}, SliceExpression = class extends Expression {
  constructor(e = void 0, r = void 0, o = void 0) {
    super();
    be(this, "type", "SliceExpression");
    this.start = e, this.stop = r, this.step = o;
  }
}, KeywordArgumentExpression = class extends Expression {
  constructor(e, r) {
    super();
    be(this, "type", "KeywordArgumentExpression");
    this.key = e, this.value = r;
  }
};
function parse(s) {
  const e = new Program([]);
  let r = 0;
  function o(W, j) {
    const J = s[r++];
    if (!J || J.type !== W)
      throw new Error(`Parser Error: ${j}. ${J.type} !== ${W}.`);
    return J;
  }
  function m() {
    switch (s[r].type) {
      case TOKEN_TYPES.Text:
        return y();
      case TOKEN_TYPES.OpenStatement:
        return E();
      case TOKEN_TYPES.OpenExpression:
        return x();
      default:
        throw new SyntaxError(`Unexpected token type: ${s[r].type}`);
    }
  }
  function _(...W) {
    return r + W.length <= s.length && W.some((j, J) => j !== s[r + J].type);
  }
  function g(...W) {
    return r + W.length <= s.length && W.every((j, J) => j === s[r + J].type);
  }
  function y() {
    return new StringLiteral(o(TOKEN_TYPES.Text, "Expected text token").value);
  }
  function E() {
    o(TOKEN_TYPES.OpenStatement, "Expected opening statement token");
    let W;
    switch (s[r].type) {
      case TOKEN_TYPES.Set:
        ++r, W = v(), o(TOKEN_TYPES.CloseStatement, "Expected closing statement token");
        break;
      case TOKEN_TYPES.If:
        ++r, W = h(), o(TOKEN_TYPES.OpenStatement, "Expected {% token"), o(TOKEN_TYPES.EndIf, "Expected endif token"), o(TOKEN_TYPES.CloseStatement, "Expected %} token");
        break;
      case TOKEN_TYPES.For:
        ++r, W = b(), o(TOKEN_TYPES.OpenStatement, "Expected {% token"), o(TOKEN_TYPES.EndFor, "Expected endfor token"), o(TOKEN_TYPES.CloseStatement, "Expected %} token");
        break;
      default:
        throw new SyntaxError(`Unknown statement type: ${s[r].type}`);
    }
    return W;
  }
  function x() {
    o(TOKEN_TYPES.OpenExpression, "Expected opening expression token");
    const W = w();
    return o(TOKEN_TYPES.CloseExpression, "Expected closing expression token"), W;
  }
  function v() {
    const W = w();
    if (g(TOKEN_TYPES.Equals)) {
      ++r;
      const j = v();
      return new SetStatement(W, j);
    }
    return W;
  }
  function h() {
    var me, pe, ye, oe, we, Se, Me, de;
    const W = w();
    o(TOKEN_TYPES.CloseStatement, "Expected closing statement token");
    const j = [], J = [];
    for (; !(((me = s[r]) == null ? void 0 : me.type) === TOKEN_TYPES.OpenStatement && (((pe = s[r + 1]) == null ? void 0 : pe.type) === TOKEN_TYPES.ElseIf || ((ye = s[r + 1]) == null ? void 0 : ye.type) === TOKEN_TYPES.Else || ((oe = s[r + 1]) == null ? void 0 : oe.type) === TOKEN_TYPES.EndIf)); )
      j.push(m());
    if (((we = s[r]) == null ? void 0 : we.type) === TOKEN_TYPES.OpenStatement && ((Se = s[r + 1]) == null ? void 0 : Se.type) !== TOKEN_TYPES.EndIf)
      if (++r, g(TOKEN_TYPES.ElseIf))
        o(TOKEN_TYPES.ElseIf, "Expected elseif token"), J.push(h());
      else
        for (o(TOKEN_TYPES.Else, "Expected else token"), o(TOKEN_TYPES.CloseStatement, "Expected closing statement token"); !(((Me = s[r]) == null ? void 0 : Me.type) === TOKEN_TYPES.OpenStatement && ((de = s[r + 1]) == null ? void 0 : de.type) === TOKEN_TYPES.EndIf); )
          J.push(m());
    return new If(W, j, J);
  }
  function a(W = !1) {
    const j = W ? Y : w, J = [j()], me = g(TOKEN_TYPES.Comma);
    for (; me && (++r, J.push(j()), !!g(TOKEN_TYPES.Comma)); )
      ;
    return me ? new TupleLiteral(J) : J[0];
  }
  function b() {
    const W = a(!0);
    if (!(W instanceof Identifier || W instanceof TupleLiteral))
      throw new SyntaxError(`Expected identifier/tuple for the loop variable, got ${W.type} instead`);
    o(TOKEN_TYPES.In, "Expected `in` keyword following loop variable");
    const j = w();
    o(TOKEN_TYPES.CloseStatement, "Expected closing statement token");
    const J = [];
    for (; _(TOKEN_TYPES.OpenStatement, TOKEN_TYPES.EndFor); )
      J.push(m());
    return new For(W, j, J);
  }
  function w() {
    return k();
  }
  function k() {
    const W = A();
    if (g(TOKEN_TYPES.If)) {
      ++r;
      const j = A();
      o(TOKEN_TYPES.Else, "Expected else token");
      const J = A();
      return new If(j, [W], [J]);
    }
    return W;
  }
  function A() {
    let W = M();
    for (; g(TOKEN_TYPES.Or); ) {
      const j = s[r];
      ++r;
      const J = M();
      W = new BinaryExpression(j, W, J);
    }
    return W;
  }
  function M() {
    let W = $();
    for (; g(TOKEN_TYPES.And); ) {
      const j = s[r];
      ++r;
      const J = $();
      W = new BinaryExpression(j, W, J);
    }
    return W;
  }
  function $() {
    let W;
    for (; g(TOKEN_TYPES.Not); ) {
      const j = s[r];
      ++r;
      const J = $();
      W = new UnaryExpression(j, J);
    }
    return W ?? O();
  }
  function O() {
    let W = C();
    for (; g(TOKEN_TYPES.ComparisonBinaryOperator) || g(TOKEN_TYPES.In) || g(TOKEN_TYPES.NotIn); ) {
      const j = s[r];
      ++r;
      const J = C();
      W = new BinaryExpression(j, W, J);
    }
    return W;
  }
  function C() {
    let W = G();
    for (; g(TOKEN_TYPES.AdditiveBinaryOperator); ) {
      const j = s[r];
      ++r;
      const J = G();
      W = new BinaryExpression(j, W, J);
    }
    return W;
  }
  function P() {
    const W = B();
    return g(TOKEN_TYPES.OpenParen) ? I(W) : W;
  }
  function I(W) {
    let j = new CallExpression(W, N());
    return g(TOKEN_TYPES.OpenParen) && (j = I(j)), j;
  }
  function N() {
    o(TOKEN_TYPES.OpenParen, "Expected opening parenthesis for arguments list");
    const W = R();
    return o(TOKEN_TYPES.CloseParen, "Expected closing parenthesis for arguments list"), W;
  }
  function R() {
    const W = [];
    for (; !g(TOKEN_TYPES.CloseParen); ) {
      let j = w();
      if (g(TOKEN_TYPES.Equals)) {
        if (++r, !(j instanceof Identifier))
          throw new SyntaxError("Expected identifier for keyword argument");
        const J = w();
        j = new KeywordArgumentExpression(j, J);
      }
      W.push(j), g(TOKEN_TYPES.Comma) && ++r;
    }
    return W;
  }
  function F() {
    const W = [];
    let j = !1;
    for (; !g(TOKEN_TYPES.CloseSquareBracket); )
      g(TOKEN_TYPES.Colon) ? (W.push(void 0), ++r, j = !0) : (W.push(w()), g(TOKEN_TYPES.Colon) && (++r, j = !0));
    if (W.length === 0)
      throw new SyntaxError("Expected at least one argument for member/slice expression");
    if (j) {
      if (W.length > 3)
        throw new SyntaxError("Expected 0-3 arguments for slice expression");
      return new SliceExpression(...W);
    }
    return W[0];
  }
  function B() {
    let W = Y();
    for (; g(TOKEN_TYPES.Dot) || g(TOKEN_TYPES.OpenSquareBracket); ) {
      const j = s[r];
      ++r;
      let J;
      const me = j.type !== TOKEN_TYPES.Dot;
      if (me)
        J = F(), o(TOKEN_TYPES.CloseSquareBracket, "Expected closing square bracket");
      else if (J = Y(), J.type !== "Identifier")
        throw new SyntaxError("Expected identifier following dot operator");
      W = new MemberExpression(W, J, me);
    }
    return W;
  }
  function G() {
    let W = Q();
    for (; g(TOKEN_TYPES.MultiplicativeBinaryOperator); ) {
      const j = s[r];
      ++r;
      const J = Q();
      W = new BinaryExpression(j, W, J);
    }
    return W;
  }
  function Q() {
    let W = ee();
    for (; g(TOKEN_TYPES.Is); ) {
      ++r;
      const j = g(TOKEN_TYPES.Not);
      j && ++r;
      let J = Y();
      if (J instanceof BooleanLiteral && (J = new Identifier(J.value.toString())), !(J instanceof Identifier))
        throw new SyntaxError("Expected identifier for the test");
      W = new TestExpression(W, j, J);
    }
    return W;
  }
  function ee() {
    let W = P();
    for (; g(TOKEN_TYPES.Pipe); ) {
      ++r;
      let j = Y();
      if (!(j instanceof Identifier))
        throw new SyntaxError("Expected identifier for the filter");
      g(TOKEN_TYPES.OpenParen) && (j = I(j)), W = new FilterExpression(W, j);
    }
    return W;
  }
  function Y() {
    const W = s[r];
    switch (W.type) {
      case TOKEN_TYPES.NumericLiteral:
        return ++r, new NumericLiteral(Number(W.value));
      case TOKEN_TYPES.StringLiteral:
        return ++r, new StringLiteral(W.value);
      case TOKEN_TYPES.BooleanLiteral:
        return ++r, new BooleanLiteral(W.value === "true");
      case TOKEN_TYPES.Identifier:
        return ++r, new Identifier(W.value);
      case TOKEN_TYPES.OpenParen: {
        ++r;
        const j = a();
        if (s[r].type !== TOKEN_TYPES.CloseParen)
          throw new SyntaxError(`Expected closing parenthesis, got ${s[r].type} instead`);
        return ++r, j;
      }
      case TOKEN_TYPES.OpenSquareBracket: {
        ++r;
        const j = [];
        for (; !g(TOKEN_TYPES.CloseSquareBracket); )
          j.push(w()), g(TOKEN_TYPES.Comma) && ++r;
        return ++r, new ArrayLiteral(j);
      }
      case TOKEN_TYPES.OpenCurlyBracket: {
        ++r;
        const j = /* @__PURE__ */ new Map();
        for (; !g(TOKEN_TYPES.CloseCurlyBracket); ) {
          const J = w();
          o(TOKEN_TYPES.Colon, "Expected colon between key and value in object literal");
          const me = w();
          j.set(J, me), g(TOKEN_TYPES.Comma) && ++r;
        }
        return ++r, new ObjectLiteral(j);
      }
      default:
        throw new SyntaxError(`Unexpected token: ${W.type}`);
    }
  }
  for (; r < s.length; )
    e.body.push(m());
  return e;
}
function range(s, e, r = 1) {
  e === void 0 && (e = s, s = 0);
  const o = [];
  for (let m = s; m < e; m += r)
    o.push(m);
  return o;
}
function slice(s, e, r, o = 1) {
  const m = Math.sign(o);
  m >= 0 ? (e = (e ?? (e = 0)) < 0 ? Math.max(s.length + e, 0) : Math.min(e, s.length), r = (r ?? (r = s.length)) < 0 ? Math.max(s.length + r, 0) : Math.min(r, s.length)) : (e = (e ?? (e = s.length - 1)) < 0 ? Math.max(s.length + e, -1) : Math.min(e, s.length - 1), r = (r ?? (r = -1)) < -1 ? Math.max(s.length + r, -1) : Math.min(r, s.length - 1));
  const _ = [];
  for (let g = e; m * g < m * r; g += o)
    _.push(s[g]);
  return _;
}
function titleCase(s) {
  return s.replace(/\b\w/g, (e) => e.toUpperCase());
}
var RuntimeValue = class {
  /**
   * Creates a new RuntimeValue.
   */
  constructor(s = void 0) {
    be(this, "type", "RuntimeValue");
    be(this, "value");
    /**
     * A collection of built-in functions for this type.
     */
    be(this, "builtins", /* @__PURE__ */ new Map());
    this.value = s;
  }
  /**
   * Determines truthiness or falsiness of the runtime value.
   * This function should be overridden by subclasses if it has custom truthiness criteria.
   * @returns {BooleanValue} BooleanValue(true) if the value is truthy, BooleanValue(false) otherwise.
   */
  __bool__() {
    return new BooleanValue(!!this.value);
  }
}, NumericValue = class extends RuntimeValue {
  constructor() {
    super(...arguments);
    be(this, "type", "NumericValue");
  }
}, StringValue = class extends RuntimeValue {
  constructor() {
    super(...arguments);
    be(this, "type", "StringValue");
    be(this, "builtins", /* @__PURE__ */ new Map([
      [
        "upper",
        new FunctionValue(() => new StringValue(this.value.toUpperCase()))
      ],
      [
        "lower",
        new FunctionValue(() => new StringValue(this.value.toLowerCase()))
      ],
      [
        "strip",
        new FunctionValue(() => new StringValue(this.value.trim()))
      ],
      [
        "title",
        new FunctionValue(() => new StringValue(titleCase(this.value)))
      ],
      ["length", new NumericValue(this.value.length)]
    ]));
  }
}, BooleanValue = class extends RuntimeValue {
  constructor() {
    super(...arguments);
    be(this, "type", "BooleanValue");
  }
}, ObjectValue = class extends RuntimeValue {
  constructor() {
    super(...arguments);
    be(this, "type", "ObjectValue");
    be(this, "builtins", /* @__PURE__ */ new Map([
      [
        "get",
        new FunctionValue(([e, r]) => {
          if (!(e instanceof StringValue))
            throw new Error(`Object key must be a string: got ${e.type}`);
          return this.value.get(e.value) ?? r ?? new NullValue();
        })
      ],
      [
        "items",
        new FunctionValue(() => new ArrayValue(
          Array.from(this.value.entries()).map(([e, r]) => new ArrayValue([new StringValue(e), r]))
        ))
      ]
    ]));
  }
  /**
   * NOTE: necessary to override since all JavaScript arrays are considered truthy,
   * while only non-empty Python arrays are consider truthy.
   *
   * e.g.,
   *  - JavaScript:  {} && 5 -> 5
   *  - Python:      {} and 5 -> {}
   */
  __bool__() {
    return new BooleanValue(this.value.size > 0);
  }
}, ArrayValue = class extends RuntimeValue {
  constructor() {
    super(...arguments);
    be(this, "type", "ArrayValue");
    be(this, "builtins", /* @__PURE__ */ new Map([["length", new NumericValue(this.value.length)]]));
  }
  /**
   * NOTE: necessary to override since all JavaScript arrays are considered truthy,
   * while only non-empty Python arrays are consider truthy.
   *
   * e.g.,
   *  - JavaScript:  [] && 5 -> 5
   *  - Python:      [] and 5 -> []
   */
  __bool__() {
    return new BooleanValue(this.value.length > 0);
  }
}, TupleValue = class extends ArrayValue {
  constructor() {
    super(...arguments);
    be(this, "type", "TupleValue");
  }
}, FunctionValue = class extends RuntimeValue {
  constructor() {
    super(...arguments);
    be(this, "type", "FunctionValue");
  }
}, NullValue = class extends RuntimeValue {
  constructor() {
    super(...arguments);
    be(this, "type", "NullValue");
  }
}, UndefinedValue = class extends RuntimeValue {
  constructor() {
    super(...arguments);
    be(this, "type", "UndefinedValue");
  }
}, Environment = class {
  constructor(s) {
    /**
     * The variables declared in this environment.
     */
    be(this, "variables", /* @__PURE__ */ new Map([
      [
        "namespace",
        new FunctionValue((s) => {
          if (s.length === 0)
            return new ObjectValue(/* @__PURE__ */ new Map());
          if (s.length !== 1 || !(s[0] instanceof ObjectValue))
            throw new Error("`namespace` expects either zero arguments or a single object argument");
          return s[0];
        })
      ]
    ]));
    /**
     * The tests available in this environment.
     */
    be(this, "tests", /* @__PURE__ */ new Map([
      ["boolean", (s) => s.type === "BooleanValue"],
      ["callable", (s) => s instanceof FunctionValue],
      [
        "odd",
        (s) => {
          if (s.type !== "NumericValue")
            throw new Error(`Cannot apply test "odd" to type: ${s.type}`);
          return s.value % 2 !== 0;
        }
      ],
      [
        "even",
        (s) => {
          if (s.type !== "NumericValue")
            throw new Error(`Cannot apply test "even" to type: ${s.type}`);
          return s.value % 2 === 0;
        }
      ],
      ["false", (s) => s.type === "BooleanValue" && !s.value],
      ["true", (s) => s.type === "BooleanValue" && s.value],
      ["number", (s) => s.type === "NumericValue"],
      ["integer", (s) => s.type === "NumericValue" && Number.isInteger(s.value)],
      ["iterable", (s) => s instanceof ArrayValue || s instanceof StringValue],
      [
        "lower",
        (s) => {
          const e = s.value;
          return s.type === "StringValue" && e === e.toLowerCase();
        }
      ],
      [
        "upper",
        (s) => {
          const e = s.value;
          return s.type === "StringValue" && e === e.toUpperCase();
        }
      ],
      ["none", (s) => s.type === "NullValue"],
      ["defined", (s) => s.type !== "UndefinedValue"],
      ["undefined", (s) => s.type === "UndefinedValue"],
      ["equalto", (s, e) => s.value === e.value]
    ]));
    this.parent = s;
  }
  /**
   * Set the value of a variable in the current environment.
   */
  set(s, e) {
    return this.declareVariable(s, convertToRuntimeValues(e));
  }
  declareVariable(s, e) {
    if (this.variables.has(s))
      throw new SyntaxError(`Variable already declared: ${s}`);
    return this.variables.set(s, e), e;
  }
  // private assignVariable(name: string, value: AnyRuntimeValue): AnyRuntimeValue {
  // 	const env = this.resolve(name);
  // 	env.variables.set(name, value);
  // 	return value;
  // }
  /**
   * Set variable in the current scope.
   * See https://jinja.palletsprojects.com/en/3.0.x/templates/#assignments for more information.
   */
  setVariable(s, e) {
    return this.variables.set(s, e), e;
  }
  /**
   * Resolve the environment in which the variable is declared.
   * @param {string} name The name of the variable.
   * @returns {Environment} The environment in which the variable is declared.
   */
  resolve(s) {
    if (this.variables.has(s))
      return this;
    if (this.parent)
      return this.parent.resolve(s);
    throw new Error(`Unknown variable: ${s}`);
  }
  lookupVariable(s) {
    try {
      return this.resolve(s).variables.get(s) ?? new UndefinedValue();
    } catch {
      return new UndefinedValue();
    }
  }
}, Interpreter = class {
  constructor(s) {
    be(this, "global");
    this.global = s ?? new Environment();
  }
  /**
   * Run the program.
   */
  run(s) {
    return this.evaluate(s, this.global);
  }
  /**
   * Evaluates expressions following the binary operation type.
   */
  evaluateBinaryExpression(s, e) {
    const r = this.evaluate(s.left, e);
    switch (s.operator.value) {
      case "and":
        return r.__bool__().value ? this.evaluate(s.right, e) : r;
      case "or":
        return r.__bool__().value ? r : this.evaluate(s.right, e);
    }
    const o = this.evaluate(s.right, e);
    switch (s.operator.value) {
      case "==":
        return new BooleanValue(r.value == o.value);
      case "!=":
        return new BooleanValue(r.value != o.value);
    }
    if (r instanceof UndefinedValue || o instanceof UndefinedValue)
      throw new Error("Cannot perform operation on undefined values");
    if (r instanceof NullValue || o instanceof NullValue)
      throw new Error("Cannot perform operation on null values");
    if (r instanceof NumericValue && o instanceof NumericValue)
      switch (s.operator.value) {
        case "+":
          return new NumericValue(r.value + o.value);
        case "-":
          return new NumericValue(r.value - o.value);
        case "*":
          return new NumericValue(r.value * o.value);
        case "/":
          return new NumericValue(r.value / o.value);
        case "%":
          return new NumericValue(r.value % o.value);
        case "<":
          return new BooleanValue(r.value < o.value);
        case ">":
          return new BooleanValue(r.value > o.value);
        case ">=":
          return new BooleanValue(r.value >= o.value);
        case "<=":
          return new BooleanValue(r.value <= o.value);
      }
    else if (r instanceof ArrayValue && o instanceof ArrayValue)
      switch (s.operator.value) {
        case "+":
          return new ArrayValue(r.value.concat(o.value));
      }
    else if (o instanceof ArrayValue) {
      const m = o.value.find((_) => _.value === r.value) !== void 0;
      switch (s.operator.value) {
        case "in":
          return new BooleanValue(m);
        case "not in":
          return new BooleanValue(!m);
      }
    }
    if (r instanceof StringValue || o instanceof StringValue)
      switch (s.operator.value) {
        case "+":
          return new StringValue(r.value.toString() + o.value.toString());
      }
    if (r instanceof StringValue && o instanceof StringValue)
      switch (s.operator.value) {
        case "in":
          return new BooleanValue(o.value.includes(r.value));
        case "not in":
          return new BooleanValue(!o.value.includes(r.value));
      }
    if (r instanceof StringValue && o instanceof ObjectValue)
      switch (s.operator.value) {
        case "in":
          return new BooleanValue(o.value.has(r.value));
        case "not in":
          return new BooleanValue(!o.value.has(r.value));
      }
    throw new SyntaxError(`Unknown operator "${s.operator.value}" between ${r.type} and ${o.type}`);
  }
  /**
   * Evaluates expressions following the filter operation type.
   */
  evaluateFilterExpression(s, e) {
    const r = this.evaluate(s.operand, e);
    if (s.filter.type === "Identifier") {
      const o = s.filter;
      if (r instanceof ArrayValue)
        switch (o.value) {
          case "list":
            return r;
          case "first":
            return r.value[0];
          case "last":
            return r.value[r.value.length - 1];
          case "length":
            return new NumericValue(r.value.length);
          case "reverse":
            return new ArrayValue(r.value.reverse());
          case "sort":
            return new ArrayValue(
              r.value.sort((m, _) => {
                if (m.type !== _.type)
                  throw new Error(`Cannot compare different types: ${m.type} and ${_.type}`);
                switch (m.type) {
                  case "NumericValue":
                    return m.value - _.value;
                  case "StringValue":
                    return m.value.localeCompare(_.value);
                  default:
                    throw new Error(`Cannot compare type: ${m.type}`);
                }
              })
            );
          default:
            throw new Error(`Unknown ArrayValue filter: ${o.value}`);
        }
      else if (r instanceof StringValue)
        switch (o.value) {
          case "length":
            return new NumericValue(r.value.length);
          case "upper":
            return new StringValue(r.value.toUpperCase());
          case "lower":
            return new StringValue(r.value.toLowerCase());
          case "title":
            return new StringValue(titleCase(r.value));
          case "capitalize":
            return new StringValue(r.value.charAt(0).toUpperCase() + r.value.slice(1));
          case "trim":
            return new StringValue(r.value.trim());
          default:
            throw new Error(`Unknown StringValue filter: ${o.value}`);
        }
      else if (r instanceof NumericValue)
        switch (o.value) {
          case "abs":
            return new NumericValue(Math.abs(r.value));
          default:
            throw new Error(`Unknown NumericValue filter: ${o.value}`);
        }
      else if (r instanceof ObjectValue)
        switch (o.value) {
          case "items":
            return new ArrayValue(
              Array.from(r.value.entries()).map(([m, _]) => new ArrayValue([new StringValue(m), _]))
            );
          case "length":
            return new NumericValue(r.value.size);
          default:
            throw new Error(`Unknown ObjectValue filter: ${o.value}`);
        }
      throw new Error(`Cannot apply filter "${o.value}" to type: ${r.type}`);
    } else if (s.filter.type === "CallExpression") {
      const o = s.filter;
      if (o.callee.type !== "Identifier")
        throw new Error(`Unknown filter: ${o.callee.type}`);
      const m = o.callee.value;
      if (r instanceof ArrayValue) {
        switch (m) {
          case "selectattr": {
            if (r.value.some((v) => !(v instanceof ObjectValue)))
              throw new Error("`selectattr` can only be applied to array of objects");
            if (o.args.some((v) => v.type !== "StringLiteral"))
              throw new Error("arguments of `selectattr` must be strings");
            const [_, g, y] = o.args.map((v) => this.evaluate(v, e));
            let E;
            if (g) {
              const v = e.tests.get(g.value);
              if (!v)
                throw new Error(`Unknown test: ${g.value}`);
              E = v;
            } else
              E = (...v) => v[0].__bool__().value;
            const x = r.value.filter((v) => {
              const h = v.value.get(_.value);
              return h ? E(h, y) : !1;
            });
            return new ArrayValue(x);
          }
        }
        throw new Error(`Unknown ArrayValue filter: ${m}`);
      } else
        throw new Error(`Cannot apply filter "${m}" to type: ${r.type}`);
    }
    throw new Error(`Unknown filter: ${s.filter.type}`);
  }
  /**
   * Evaluates expressions following the test operation type.
   */
  evaluateTestExpression(s, e) {
    const r = this.evaluate(s.operand, e), o = e.tests.get(s.test.value);
    if (!o)
      throw new Error(`Unknown test: ${s.test.value}`);
    const m = o(r);
    return new BooleanValue(s.negate ? !m : m);
  }
  /**
   * Evaluates expressions following the unary operation type.
   */
  evaluateUnaryExpression(s, e) {
    const r = this.evaluate(s.argument, e);
    switch (s.operator.value) {
      case "not":
        return new BooleanValue(!r.value);
      default:
        throw new SyntaxError(`Unknown operator: ${s.operator.value}`);
    }
  }
  evalProgram(s, e) {
    return this.evaluateBlock(s.body, e);
  }
  evaluateBlock(s, e) {
    let r = "";
    for (const o of s) {
      const m = this.evaluate(o, e);
      m.type !== "NullValue" && m.type !== "UndefinedValue" && (r += m.value);
    }
    return new StringValue(r);
  }
  evaluateIdentifier(s, e) {
    return e.lookupVariable(s.value);
  }
  evaluateCallExpression(s, e) {
    const r = [], o = /* @__PURE__ */ new Map();
    for (const _ of s.args)
      if (_.type === "KeywordArgumentExpression") {
        const g = _;
        o.set(g.key.value, this.evaluate(g.value, e));
      } else
        r.push(this.evaluate(_, e));
    o.size > 0 && r.push(new ObjectValue(o));
    const m = this.evaluate(s.callee, e);
    if (m.type !== "FunctionValue")
      throw new Error(`Cannot call something that is not a function: got ${m.type}`);
    return m.value(r, e);
  }
  evaluateSliceExpression(s, e, r) {
    if (!(s instanceof ArrayValue || s instanceof StringValue))
      throw new Error("Slice object must be an array or string");
    const o = this.evaluate(e.start, r), m = this.evaluate(e.stop, r), _ = this.evaluate(e.step, r);
    if (!(o instanceof NumericValue || o instanceof UndefinedValue))
      throw new Error("Slice start must be numeric or undefined");
    if (!(m instanceof NumericValue || m instanceof UndefinedValue))
      throw new Error("Slice stop must be numeric or undefined");
    if (!(_ instanceof NumericValue || _ instanceof UndefinedValue))
      throw new Error("Slice step must be numeric or undefined");
    return s instanceof ArrayValue ? new ArrayValue(slice(s.value, o.value, m.value, _.value)) : new StringValue(slice(Array.from(s.value), o.value, m.value, _.value).join(""));
  }
  evaluateMemberExpression(s, e) {
    const r = this.evaluate(s.object, e);
    let o;
    if (s.computed) {
      if (s.property.type === "SliceExpression")
        return this.evaluateSliceExpression(r, s.property, e);
      o = this.evaluate(s.property, e);
    } else
      o = new StringValue(s.property.value);
    let m;
    if (r instanceof ObjectValue) {
      if (!(o instanceof StringValue))
        throw new Error(`Cannot access property with non-string: got ${o.type}`);
      m = r.value.get(o.value) ?? r.builtins.get(o.value);
    } else if (r instanceof ArrayValue || r instanceof StringValue)
      if (o instanceof NumericValue)
        m = r.value.at(o.value), r instanceof StringValue && (m = new StringValue(r.value.at(o.value)));
      else if (o instanceof StringValue)
        m = r.builtins.get(o.value);
      else
        throw new Error(`Cannot access property with non-string/non-number: got ${o.type}`);
    else {
      if (!(o instanceof StringValue))
        throw new Error(`Cannot access property with non-string: got ${o.type}`);
      m = r.builtins.get(o.value);
    }
    return m instanceof RuntimeValue ? m : new UndefinedValue();
  }
  evaluateSet(s, e) {
    const r = this.evaluate(s.value, e);
    if (s.assignee.type === "Identifier") {
      const o = s.assignee.value;
      e.setVariable(o, r);
    } else if (s.assignee.type === "MemberExpression") {
      const o = s.assignee, m = this.evaluate(o.object, e);
      if (!(m instanceof ObjectValue))
        throw new Error("Cannot assign to member of non-object");
      if (o.property.type !== "Identifier")
        throw new Error("Cannot assign to member with non-identifier property");
      m.value.set(o.property.value, r);
    } else
      throw new Error(`Invalid LHS inside assignment expression: ${JSON.stringify(s.assignee)}`);
    return new NullValue();
  }
  evaluateIf(s, e) {
    const r = this.evaluate(s.test, e);
    return this.evaluateBlock(r.__bool__().value ? s.body : s.alternate, e);
  }
  evaluateFor(s, e) {
    const r = new Environment(e), o = this.evaluate(s.iterable, r);
    if (!(o instanceof ArrayValue))
      throw new Error(`Expected iterable type in for loop: got ${o.type}`);
    let m = "";
    for (let _ = 0; _ < o.value.length; ++_) {
      const g = /* @__PURE__ */ new Map([
        ["index", new NumericValue(_ + 1)],
        ["index0", new NumericValue(_)],
        ["revindex", new NumericValue(o.value.length - _)],
        ["revindex0", new NumericValue(o.value.length - _ - 1)],
        ["first", new BooleanValue(_ === 0)],
        ["last", new BooleanValue(_ === o.value.length - 1)],
        ["length", new NumericValue(o.value.length)],
        ["previtem", _ > 0 ? o.value[_ - 1] : new UndefinedValue()],
        ["nextitem", _ < o.value.length - 1 ? o.value[_ + 1] : new UndefinedValue()]
      ]);
      r.setVariable("loop", new ObjectValue(g));
      const y = o.value[_];
      if (s.loopvar.type === "Identifier")
        r.setVariable(s.loopvar.value, y);
      else if (s.loopvar.type === "TupleLiteral") {
        const x = s.loopvar;
        if (y.type !== "ArrayValue")
          throw new Error(`Cannot unpack non-iterable type: ${y.type}`);
        const v = y;
        if (x.value.length !== v.value.length)
          throw new Error(`Too ${x.value.length > v.value.length ? "few" : "many"} items to unpack`);
        for (let h = 0; h < x.value.length; ++h) {
          if (x.value[h].type !== "Identifier")
            throw new Error(`Cannot unpack non-identifier type: ${x.value[h].type}`);
          r.setVariable(x.value[h].value, v.value[h]);
        }
      }
      const E = this.evaluateBlock(s.body, r);
      m += E.value;
    }
    return new StringValue(m);
  }
  evaluate(s, e) {
    if (s === void 0)
      return new UndefinedValue();
    switch (s.type) {
      case "Program":
        return this.evalProgram(s, e);
      case "Set":
        return this.evaluateSet(s, e);
      case "If":
        return this.evaluateIf(s, e);
      case "For":
        return this.evaluateFor(s, e);
      case "NumericLiteral":
        return new NumericValue(Number(s.value));
      case "StringLiteral":
        return new StringValue(s.value);
      case "BooleanLiteral":
        return new BooleanValue(s.value);
      case "ArrayLiteral":
        return new ArrayValue(s.value.map((r) => this.evaluate(r, e)));
      case "TupleLiteral":
        return new TupleValue(s.value.map((r) => this.evaluate(r, e)));
      case "ObjectLiteral": {
        const r = /* @__PURE__ */ new Map();
        for (const [o, m] of s.value) {
          const _ = this.evaluate(o, e);
          if (!(_ instanceof StringValue))
            throw new Error(`Object keys must be strings: got ${_.type}`);
          r.set(_.value, this.evaluate(m, e));
        }
        return new ObjectValue(r);
      }
      case "Identifier":
        return this.evaluateIdentifier(s, e);
      case "CallExpression":
        return this.evaluateCallExpression(s, e);
      case "MemberExpression":
        return this.evaluateMemberExpression(s, e);
      case "UnaryExpression":
        return this.evaluateUnaryExpression(s, e);
      case "BinaryExpression":
        return this.evaluateBinaryExpression(s, e);
      case "FilterExpression":
        return this.evaluateFilterExpression(s, e);
      case "TestExpression":
        return this.evaluateTestExpression(s, e);
      default:
        throw new SyntaxError(`Unknown node type: ${s.type}`);
    }
  }
};
function convertToRuntimeValues(s) {
  switch (typeof s) {
    case "number":
      return new NumericValue(s);
    case "string":
      return new StringValue(s);
    case "boolean":
      return new BooleanValue(s);
    case "object":
      return s === null ? new NullValue() : Array.isArray(s) ? new ArrayValue(s.map(convertToRuntimeValues)) : new ObjectValue(
        new Map(Object.entries(s).map(([e, r]) => [e, convertToRuntimeValues(r)]))
      );
    case "function":
      return new FunctionValue((e, r) => {
        const o = s(...e.map((m) => m.value)) ?? null;
        return convertToRuntimeValues(o);
      });
    default:
      throw new Error(`Cannot convert to runtime value: ${s}`);
  }
}
var Template = class {
  /**
   * @param {string} template The template string
   */
  constructor(s) {
    be(this, "parsed");
    const e = tokenize(s, {
      lstrip_blocks: !0,
      trim_blocks: !0
    });
    this.parsed = parse(e);
  }
  render(s) {
    const e = new Environment();
    e.set("false", !1), e.set("true", !0), e.set("raise_exception", (m) => {
      throw new Error(m);
    }), e.set("range", range);
    for (const [m, _] of Object.entries(s))
      e.set(m, _);
    return new Interpreter(e).run(this.parsed).value;
  }
};
async function loadTokenizer(s, e) {
  const r = await Promise.all([
    getModelJSON(s, "tokenizer.json", !0, e),
    getModelJSON(s, "tokenizer_config.json", !0, e)
  ]);
  return e.legacy !== null && (r[1].legacy = e.legacy), r;
}
function regexSplit(s, e) {
  const r = [];
  let o = 0;
  for (const m of s.matchAll(e)) {
    const _ = m[0];
    o < m.index && r.push(s.slice(o, m.index)), _.length > 0 && r.push(_), o = m.index + _.length;
  }
  return o < s.length && r.push(s.slice(o)), r;
}
function createPattern(s, e = !0) {
  if (s.Regex !== void 0) {
    let r = s.Regex.replace(/\\([#&~])/g, "$1");
    for (const [o, m] of PROBLEMATIC_REGEX_MAP)
      r = r.replaceAll(o, m);
    return new RegExp(r, "gu");
  } else if (s.String !== void 0) {
    const r = escapeRegExp(s.String);
    return new RegExp(e ? r : `(${r})`, "gu");
  } else
    return console.warn("Unknown pattern type:", s), null;
}
function objectToMap(s) {
  return new Map(Object.entries(s));
}
function prepareTensorForDecode(s) {
  const e = s.dims;
  switch (e.length) {
    case 1:
      return s.tolist();
    case 2:
      if (e[0] !== 1)
        throw new Error("Unable to decode tensor with `batch size !== 1`. Use `tokenizer.batch_decode(...)` for batched inputs.");
      return s.tolist()[0];
    default:
      throw new Error(`Expected tensor to have 1-2 dimensions, got ${e.length}.`);
  }
}
function clean_up_tokenization(s) {
  return s.replace(/ \./g, ".").replace(/ \?/g, "?").replace(/ \!/g, "!").replace(/ ,/g, ",").replace(/ \' /g, "'").replace(/ n\'t/g, "n't").replace(/ \'m/g, "'m").replace(/ \'s/g, "'s").replace(/ \'ve/g, "'ve").replace(/ \'re/g, "'re");
}
function remove_accents(s) {
  return s.replace(/[\u0300-\u036f]/g, "");
}
function lowercase_and_remove_accent(s) {
  return remove_accents(s.toLowerCase());
}
function fuse(s, e, r) {
  const o = [];
  let m = 0;
  for (; m < s.length; ) {
    if (o.push(s[m]), (r.get(s[m]) ?? e) !== e) {
      ++m;
      continue;
    }
    for (; m < s.length && (r.get(s[m]) ?? e) === e; )
      ++m;
  }
  return o;
}
function whitespace_split(s) {
  return s.match(/\S+/g) || [];
}
const PUNCTUATION_REGEX = "\\p{P}\\u0021-\\u002F\\u003A-\\u0040\\u005B-\\u0060\\u007B-\\u007E", PROBLEMATIC_REGEX_MAP = /* @__PURE__ */ new Map([
  // This uses the case insensitive group modifier, which is not supported in JavaScript.
  // When parsing the regex, an "Invalid group" error is thrown.
  ["(?i:'s|'t|'re|'ve|'m|'ll|'d)", "(?:'([sS]|[tT]|[rR][eE]|[vV][eE]|[mM]|[lL][lL]|[dD]))"]
]);
class AddedToken {
  /**
   * Creates a new instance of AddedToken.
   * @param {Object} config Added token configuration object.
   * @param {string} config.content The content of the added token.
   * @param {number} config.id The id of the added token.
   * @param {boolean} [config.single_word=false] Whether this token must be a single word or can break words.
   * @param {boolean} [config.lstrip=false] Whether this token should strip whitespaces on its left.
   * @param {boolean} [config.rstrip=false] Whether this token should strip whitespaces on its right.
   * @param {boolean} [config.normalized=false] Whether this token should be normalized.
   * @param {boolean} [config.special=false] Whether this token is special.
   */
  constructor(e) {
    this.content = e.content, this.id = e.id, this.single_word = e.single_word ?? !1, this.lstrip = e.lstrip ?? !1, this.rstrip = e.rstrip ?? !1, this.special = e.special ?? !1, this.normalized = e.normalized ?? null;
  }
}
class TokenizerModel extends Callable {
  /**
   * Creates a new instance of TokenizerModel.
   * @param {Object} config The configuration object for the TokenizerModel.
   */
  constructor(e) {
    super(), this.config = e, this.vocab = [], this.tokens_to_ids = /* @__PURE__ */ new Map(), this.unk_token_id = void 0, this.unk_token = void 0, this.end_of_word_suffix = void 0, this.fuse_unk = this.config.fuse_unk ?? !1;
  }
  /**
   * Instantiates a new TokenizerModel instance based on the configuration object provided.
   * @param {Object} config The configuration object for the TokenizerModel.
   * @param {...*} args Optional arguments to pass to the specific TokenizerModel constructor.
   * @returns {TokenizerModel} A new instance of a TokenizerModel.
   * @throws Will throw an error if the TokenizerModel type in the config is not recognized.
   */
  static fromConfig(e, ...r) {
    switch (e.type) {
      case "WordPiece":
        return new WordPieceTokenizer(e);
      case "Unigram":
        return new Unigram(e, ...r);
      case "BPE":
        return new BPE(e);
      default:
        if (e.vocab)
          return new LegacyTokenizerModel(e, ...r);
        throw new Error(`Unknown TokenizerModel type: ${e.type}`);
    }
  }
  /**
   * Internal function to call the TokenizerModel instance.
   * @param {string[]} tokens The tokens to encode.
   * @returns {string[]} The encoded token IDs.
   */
  _call(e) {
    let r = this.encode(e);
    return this.fuse_unk && (r = fuse(r, this.unk_token_id, this.tokens_to_ids)), r;
  }
  /**
   * Encodes a list of tokens into a list of token IDs.
   * @param {string[]} tokens The tokens to encode.
   * @returns {string[]} The encoded tokens.
   * @throws Will throw an error if not implemented in a subclass.
   */
  encode(e) {
    throw Error("encode should be implemented in subclass.");
  }
  /**
   * Converts a list of tokens into a list of token IDs.
   * @param {string[]} tokens The tokens to convert.
   * @returns {number[]} The converted token IDs.
   */
  convert_tokens_to_ids(e) {
    return e.map((r) => this.tokens_to_ids.get(r) ?? this.unk_token_id);
  }
  /**
   * Converts a list of token IDs into a list of tokens.
   * @param {number[]} ids The token IDs to convert.
   * @returns {string[]} The converted tokens.
   */
  convert_ids_to_tokens(e) {
    return e.map((r) => this.vocab[r] ?? this.unk_token);
  }
}
class WordPieceTokenizer extends TokenizerModel {
  /**
   * @param {Object} config The configuration object.
   * @param {Object} config.vocab A mapping of tokens to ids.
   * @param {string} config.unk_token The unknown token string.
   * @param {string} config.continuing_subword_prefix The prefix to use for continuing subwords.
   * @param {number} [config.max_input_chars_per_word=100] The maximum number of characters per word.
   */
  constructor(e) {
    super(e), this.tokens_to_ids = objectToMap(e.vocab), this.unk_token_id = this.tokens_to_ids.get(e.unk_token), this.unk_token = e.unk_token, this.max_input_chars_per_word = e.max_input_chars_per_word ?? 100, this.vocab = new Array(this.tokens_to_ids.size);
    for (const [r, o] of this.tokens_to_ids)
      this.vocab[o] = r;
  }
  /**
   * Encodes an array of tokens using WordPiece encoding.
   * @param {string[]} tokens The tokens to encode.
   * @returns {string[]} An array of encoded tokens.
   */
  encode(e) {
    const r = [];
    for (const o of e) {
      const m = [...o];
      if (m.length > this.max_input_chars_per_word) {
        r.push(this.unk_token);
        continue;
      }
      let _ = !1, g = 0;
      const y = [];
      for (; g < m.length; ) {
        let E = m.length, x = null;
        for (; g < E; ) {
          let v = m.slice(g, E).join("");
          if (g > 0 && (v = this.config.continuing_subword_prefix + v), this.tokens_to_ids.has(v)) {
            x = v;
            break;
          }
          --E;
        }
        if (x === null) {
          _ = !0;
          break;
        }
        y.push(x), g = E;
      }
      _ ? r.push(this.unk_token) : r.push(...y);
    }
    return r;
  }
}
class Unigram extends TokenizerModel {
  /**
   * Create a new Unigram tokenizer model.
   * @param {Object} config The configuration object for the Unigram model.
   * @param {number} config.unk_id The ID of the unknown token
   * @param {any[][]} config.vocab A 2D array representing a mapping of tokens to scores.
   * @param {Object} moreConfig Additional configuration object for the Unigram model.
   */
  constructor(e, r) {
    super(e);
    const o = e.vocab.length;
    this.vocab = new Array(o), this.scores = new Array(o);
    for (let m = 0; m < o; ++m) {
      const _ = e.vocab[m];
      this.vocab[m] = _[0], this.scores[m] = _[1];
    }
    this.unk_token_id = e.unk_id, this.unk_token = this.vocab[e.unk_id], this.tokens_to_ids = new Map(this.vocab.map((m, _) => [m, _])), this.bosToken = " ", this.bosTokenId = this.tokens_to_ids.get(this.bosToken), this.eosToken = r.eos_token, this.eosTokenId = this.tokens_to_ids.get(this.eosToken), this.unkToken = this.vocab[this.unk_token_id], this.minScore = min(this.scores)[0], this.unkScore = this.minScore - 10, this.scores[this.unk_token_id] = this.unkScore, this.trie = new CharTrie(), this.trie.extend(this.vocab), this.fuse_unk = !0;
  }
  /**
   * Populates lattice nodes.
   * @param {TokenLattice} lattice The token lattice to populate with nodes.
   */
  populateNodes(e) {
    const r = e.sentence, o = r.length;
    let m = 0;
    for (; m < o; ) {
      let g = !1;
      for (let y of this.trie.commonPrefixSearch(r.slice(m))) {
        const E = this.tokens_to_ids.get(y), x = this.scores[E], v = y.length;
        e.insert(m, v, x, E), !g && v === 1 && (g = !0);
      }
      g || e.insert(m, 1, this.unkScore, this.unk_token_id), m += 1;
    }
  }
  /**
   * Encodes an array of tokens into an array of subtokens using the unigram model.
   *
   * @param {string} normalized The normalized string.
   * @returns {string[]} An array of subtokens obtained by encoding the input tokens using the unigram model.
   */
  tokenize(e) {
    const r = new TokenLattice(e, this.bosTokenId, this.eosTokenId);
    return this.populateNodes(r), r.tokens();
  }
  /**
   * Encodes an array of tokens using Unigram encoding.
   * @param {string[]} tokens The tokens to encode.
   * @returns {string[]} An array of encoded tokens.
   */
  encode(e) {
    const r = [];
    for (const o of e) {
      const m = this.tokenize(o);
      r.push(...m);
    }
    return r;
  }
}
const BYTES_TO_UNICODE = (() => {
  const s = [
    ...Array.from({ length: 94 }, (m, _) => _ + 33),
    ...Array.from({ length: 12 }, (m, _) => _ + 161),
    ...Array.from({ length: 82 }, (m, _) => _ + 174)
  ], e = s.slice();
  let r = 0;
  for (let m = 0; m < 256; ++m)
    s.includes(m) || (s.push(m), e.push(256 + r), r += 1);
  const o = e.map((m) => String.fromCharCode(m));
  return Object.fromEntries(s.map((m, _) => [m, o[_]]));
})(), UNICODE_TO_BYTES = reverseDictionary(BYTES_TO_UNICODE);
class BPE extends TokenizerModel {
  /**
   * Create a BPE instance.
   * @param {Object} config The configuration object for BPE.
   * @param {Object} config.vocab A mapping of tokens to ids.
   * @param {string[]} config.merges An array of BPE merges as strings.
   * @param {string} config.unk_token The unknown token used for out of vocabulary words.
   * @param {string} config.end_of_word_suffix The suffix to place at the end of each word.
   * @param {string} [config.continuing_subword_suffix] The suffix to insert between words.
   * @param {boolean} [config.byte_fallback=false] Whether to use spm byte-fallback trick (defaults to False)
   * @param {boolean} [config.ignore_merges=false] Whether or not to match tokens with the vocab before using merges.
   */
  constructor(e) {
    super(e), this.BPE_SPLIT_TOKEN = " ", this.tokens_to_ids = objectToMap(e.vocab), this.unk_token_id = this.tokens_to_ids.get(e.unk_token), this.unk_token = e.unk_token, this.vocab = new Array(this.tokens_to_ids.size);
    for (const [r, o] of this.tokens_to_ids)
      this.vocab[o] = r;
    this.bpe_ranks = new Map(e.merges.map((r, o) => [r, o])), this.merges = e.merges.map((r) => r.split(this.BPE_SPLIT_TOKEN)), this.end_of_word_suffix = e.end_of_word_suffix, this.continuing_subword_suffix = e.continuing_subword_suffix ?? null, this.byte_fallback = this.config.byte_fallback ?? !1, this.byte_fallback && (this.text_encoder = new TextEncoder()), this.ignore_merges = this.config.ignore_merges ?? !1, this.cache = /* @__PURE__ */ new Map();
  }
  /**
   * Apply Byte-Pair-Encoding (BPE) to a given token. Efficient heap-based priority
   * queue implementation adapted from https://github.com/belladoreai/llama-tokenizer-js.
   * @param {string} token The token to encode.
   * @returns {string[]} The BPE encoded tokens.
   */
  bpe(e) {
    if (e.length === 0)
      return [];
    const r = this.cache.get(e);
    if (r !== void 0)
      return r;
    const o = Array.from(e);
    this.end_of_word_suffix && (o[o.length - 1] += this.end_of_word_suffix);
    let m = [];
    if (o.length > 1) {
      const _ = new PriorityQueue((E, x) => E.score < x.score);
      let g = {
        token: o[0],
        bias: 0,
        prev: null,
        next: null
      }, y = g;
      for (let E = 1; E < o.length; ++E) {
        const x = {
          bias: E / o.length,
          // Add fractional component to break ties
          token: o[E],
          prev: y,
          next: null
        };
        y.next = x, this._add_node(_, y), y = x;
      }
      for (; !_.isEmpty(); ) {
        const E = _.pop();
        if (E.deleted || !E.next || E.next.deleted) continue;
        if (E.deleted = !0, E.next.deleted = !0, E.prev) {
          const v = { ...E.prev };
          E.prev.deleted = !0, E.prev = v, v.prev ? v.prev.next = v : g = v;
        }
        const x = {
          token: E.token + E.next.token,
          bias: E.bias,
          prev: E.prev,
          next: E.next.next
        };
        x.prev ? (x.prev.next = x, this._add_node(_, x.prev)) : g = x, x.next && (x.next.prev = x, this._add_node(_, x));
      }
      for (let E = g; E !== null; E = E.next)
        m.push(E.token);
    } else
      m = o;
    if (this.continuing_subword_suffix)
      for (let _ = 0; _ < m.length - 1; ++_)
        m[_] += this.continuing_subword_suffix;
    return this.cache.set(e, m), m;
  }
  /**
   * Helper function to add a node to the priority queue.
   * @param {PriorityQueue} queue 
   * @param {BPENode} node
   * @private
   */
  _add_node(e, r) {
    const o = this.bpe_ranks.get(r.token + this.BPE_SPLIT_TOKEN + r.next.token);
    o !== void 0 && (r.score = o + r.bias, e.push(r));
  }
  /**
   * Encodes the input sequence of tokens using the BPE algorithm and returns the resulting subword tokens.
   * @param {string[]} tokens The input sequence of tokens to encode.
   * @returns {string[]} The resulting subword tokens after applying the BPE algorithm to the input sequence of tokens.
   */
  encode(e) {
    const r = [];
    for (const o of e) {
      if (this.ignore_merges && this.tokens_to_ids.has(o)) {
        r.push(o);
        continue;
      }
      const m = this.bpe(o);
      for (const _ of m)
        this.tokens_to_ids.has(_) ? r.push(_) : this.byte_fallback ? r.push(
          ...Array.from(this.text_encoder.encode(_)).map((g) => `<0x${g.toString(16).toUpperCase().padStart(2, "0")}>`)
        ) : r.push(this.unk_token);
    }
    return r;
  }
}
class LegacyTokenizerModel extends TokenizerModel {
  /**
   * Create a LegacyTokenizerModel instance.
   * @param {Object} config The configuration object for LegacyTokenizerModel.
   * @param {Object} config.vocab A (possibly nested) mapping of tokens to ids.
   * @param {Object} moreConfig Additional configuration object for the LegacyTokenizerModel model.
   */
  constructor(e, r) {
    super(e), this.tokens_to_ids = objectToMap(
      r.target_lang ? e.vocab[r.target_lang] : e.vocab
    ), this.bos_token = r.bos_token, this.bos_token_id = this.tokens_to_ids.get(this.bos_token), this.eos_token = r.eos_token, this.eos_token_id = this.tokens_to_ids.get(this.eos_token), this.pad_token = r.pad_token, this.pad_token_id = this.tokens_to_ids.get(this.pad_token), this.unk_token = r.unk_token, this.unk_token_id = this.tokens_to_ids.get(this.unk_token), this.vocab = new Array(this.tokens_to_ids.size);
    for (const [o, m] of this.tokens_to_ids)
      this.vocab[m] = o;
  }
  encode(e) {
    return e;
  }
}
class Normalizer extends Callable {
  /**
   * @param {Object} config The configuration object for the normalizer.
   */
  constructor(e) {
    super(), this.config = e;
  }
  /**
   * Factory method for creating normalizers from config objects.
   * @static
   * @param {Object} config The configuration object for the normalizer.
   * @returns {Normalizer} A Normalizer object.
   * @throws {Error} If an unknown Normalizer type is specified in the config.
   */
  static fromConfig(e) {
    if (e === null) return null;
    switch (e.type) {
      case "BertNormalizer":
        return new BertNormalizer(e);
      case "Precompiled":
        return new Precompiled(e);
      case "Sequence":
        return new NormalizerSequence(e);
      case "Replace":
        return new Replace(e);
      case "NFC":
        return new NFC(e);
      case "NFKC":
        return new NFKC(e);
      case "NFKD":
        return new NFKD(e);
      case "Strip":
        return new StripNormalizer(e);
      case "StripAccents":
        return new StripAccents(e);
      case "Lowercase":
        return new Lowercase(e);
      case "Prepend":
        return new Prepend(e);
      default:
        throw new Error(`Unknown Normalizer type: ${e.type}`);
    }
  }
  /**
   * Normalize the input text.
   * @abstract
   * @param {string} text The text to normalize.
   * @returns {string} The normalized text.
   * @throws {Error} If this method is not implemented in a subclass.
   */
  normalize(e) {
    throw Error("normalize should be implemented in subclass.");
  }
  /**
   * Alias for {@link Normalizer#normalize}.
   * @param {string} text The text to normalize.
   * @returns {string} The normalized text.
   */
  _call(e) {
    return this.normalize(e);
  }
}
class Replace extends Normalizer {
  /**
   * Normalize the input text by replacing the pattern with the content.
   * @param {string} text The input text to be normalized.
   * @returns {string} The normalized text after replacing the pattern with the content.
   */
  normalize(e) {
    const r = createPattern(this.config.pattern);
    return r === null ? e : e.replaceAll(r, this.config.content);
  }
}
class NFC extends Normalizer {
  /**
   * Normalize the input text by applying Unicode normalization form C (NFC).
   * @param {string} text The input text to be normalized.
   * @returns {string} The normalized text.
   */
  normalize(e) {
    return e = e.normalize("NFC"), e;
  }
}
class NFKC extends Normalizer {
  /**
   * Normalize text using NFKC normalization.
   * @param {string} text The text to be normalized.
   * @returns {string} The normalized text.
   */
  normalize(e) {
    return e = e.normalize("NFKC"), e;
  }
}
class NFKD extends Normalizer {
  /**
   * Normalize text using NFKD normalization.
   * @param {string} text The text to be normalized.
   * @returns {string} The normalized text.
   */
  normalize(e) {
    return e = e.normalize("NFKD"), e;
  }
}
class StripNormalizer extends Normalizer {
  /**
   * Strip leading and/or trailing whitespace from the input text.
   * @param {string} text The input text.
   * @returns {string} The normalized text.
   */
  normalize(e) {
    return this.config.strip_left && this.config.strip_right ? e = e.trim() : (this.config.strip_left && (e = e.trimStart()), this.config.strip_right && (e = e.trimEnd())), e;
  }
}
class StripAccents extends Normalizer {
  /**
   * Remove all accents from the text.
   * @param {string} text The input text.
   * @returns {string} The normalized text without accents.
   */
  normalize(e) {
    return e = remove_accents(e), e;
  }
}
class Lowercase extends Normalizer {
  /**
   * Lowercases the input string.
   * @param {string} text The text to normalize.
   * @returns {string} The normalized text.
   */
  normalize(e) {
    return e = e.toLowerCase(), e;
  }
}
class Prepend extends Normalizer {
  /**
   * Prepends the input string.
   * @param {string} text The text to normalize.
   * @returns {string} The normalized text.
   */
  normalize(e) {
    return e = this.config.prepend + e, e;
  }
}
class NormalizerSequence extends Normalizer {
  /**
  * Create a new instance of NormalizerSequence.
  * @param {Object} config The configuration object.
  * @param {Object[]} config.normalizers An array of Normalizer configuration objects.
  */
  constructor(e) {
    super(e), this.normalizers = e.normalizers.map((r) => Normalizer.fromConfig(r));
  }
  /**
  * Apply a sequence of Normalizers to the input text.
  * @param {string} text The text to normalize.
  * @returns {string} The normalized text.
  */
  normalize(e) {
    return this.normalizers.reduce((r, o) => o.normalize(r), e);
  }
}
class BertNormalizer extends Normalizer {
  /**
   * Adds whitespace around any CJK (Chinese, Japanese, or Korean) character in the input text.
   *
   * @param {string} text The input text to tokenize.
   * @returns {string} The tokenized text with whitespace added around CJK characters.
   */
  _tokenize_chinese_chars(e) {
    const r = [];
    for (let o = 0; o < e.length; ++o) {
      const m = e[o], _ = m.charCodeAt(0);
      this._is_chinese_char(_) ? (r.push(" "), r.push(m), r.push(" ")) : r.push(m);
    }
    return r.join("");
  }
  /**
   * Checks whether the given Unicode codepoint represents a CJK (Chinese, Japanese, or Korean) character.
   *
   * A "chinese character" is defined as anything in the CJK Unicode block:
   * https://en.wikipedia.org/wiki/CJK_Unified_Ideographs_(Unicode_block)
   *
   * Note that the CJK Unicode block is NOT all Japanese and Korean characters, despite its name.
   * The modern Korean Hangul alphabet is a different block, as is Japanese Hiragana and Katakana.
   * Those alphabets are used to write space-separated words, so they are not treated specially
   * and are handled like all other languages.
   *
   * @param {number} cp The Unicode codepoint to check.
   * @returns {boolean} True if the codepoint represents a CJK character, false otherwise.
   */
  _is_chinese_char(e) {
    return e >= 19968 && e <= 40959 || e >= 13312 && e <= 19903 || e >= 131072 && e <= 173791 || e >= 173824 && e <= 177983 || e >= 177984 && e <= 178207 || e >= 178208 && e <= 183983 || e >= 63744 && e <= 64255 || e >= 194560 && e <= 195103;
  }
  /**
   * Strips accents from the given text.
   * @param {string} text The text to strip accents from.
   * @returns {string} The text with accents removed.
   */
  stripAccents(e) {
    return e.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
  }
  /**
   * Checks whether `char` is a control character.
   * @param {string} char The character to check.
   * @returns {boolean} Whether `char` is a control character.
   * @private
   */
  _is_control(e) {
    switch (e) {
      case "	":
      case `
`:
      case "\r":
        return !1;
      default:
        return new RegExp("^\\p{Cc}|\\p{Cf}|\\p{Co}|\\p{Cs}$", "u").test(e);
    }
  }
  /**
   * Performs invalid character removal and whitespace cleanup on text.
   * @param {string} text The text to clean.
   * @returns {string} The cleaned text.
   * @private
   */
  _clean_text(e) {
    const r = [];
    for (const o of e) {
      const m = o.charCodeAt(0);
      m === 0 || m === 65533 || this._is_control(o) || (/^\s$/.test(o) ? r.push(" ") : r.push(o));
    }
    return r.join("");
  }
  /**
   * Normalizes the given text based on the configuration.
   * @param {string} text The text to normalize.
   * @returns {string} The normalized text.
   */
  normalize(e) {
    return this.config.clean_text && (e = this._clean_text(e)), this.config.handle_chinese_chars && (e = this._tokenize_chinese_chars(e)), this.config.lowercase ? (e = e.toLowerCase(), this.config.strip_accents !== !1 && (e = this.stripAccents(e))) : this.config.strip_accents && (e = this.stripAccents(e)), e;
  }
}
class PreTokenizer extends Callable {
  /**
  * Factory method that returns an instance of a subclass of `PreTokenizer` based on the provided configuration.
  *
  * @static
  * @param {Object} config A configuration object for the pre-tokenizer.
  * @returns {PreTokenizer} An instance of a subclass of `PreTokenizer`.
  * @throws {Error} If the provided configuration object does not correspond to any known pre-tokenizer.
  */
  static fromConfig(e) {
    if (e === null) return null;
    switch (e.type) {
      case "BertPreTokenizer":
        return new BertPreTokenizer(e);
      case "Sequence":
        return new PreTokenizerSequence(e);
      case "Whitespace":
        return new WhitespacePreTokenizer(e);
      case "WhitespaceSplit":
        return new WhitespaceSplit(e);
      case "Metaspace":
        return new MetaspacePreTokenizer(e);
      case "ByteLevel":
        return new ByteLevelPreTokenizer(e);
      case "Split":
        return new SplitPreTokenizer(e);
      case "Punctuation":
        return new PunctuationPreTokenizer(e);
      case "Digits":
        return new DigitsPreTokenizer(e);
      case "Replace":
        return new ReplacePreTokenizer(e);
      default:
        throw new Error(`Unknown PreTokenizer type: ${e.type}`);
    }
  }
  /**
   * Method that should be implemented by subclasses to define the specific pre-tokenization logic.
   *
   * @abstract
   * @param {string} text The text to pre-tokenize.
   * @param {Object} [options] Additional options for the pre-tokenization logic.
   * @returns {string[]} The pre-tokenized text.
   * @throws {Error} If the method is not implemented in the subclass.
   */
  pre_tokenize_text(e, r) {
    throw Error("pre_tokenize_text should be implemented in subclass.");
  }
  /**
   * Tokenizes the given text into pre-tokens.
   * @param {string|string[]} text The text or array of texts to pre-tokenize.
   * @param {Object} [options] Additional options for the pre-tokenization logic.
   * @returns {string[]} An array of pre-tokens.
   */
  pre_tokenize(e, r) {
    return (Array.isArray(e) ? e.map((o) => this.pre_tokenize_text(o, r)) : this.pre_tokenize_text(e, r)).flat();
  }
  /**
   * Alias for {@link PreTokenizer#pre_tokenize}.
   * @param {string|string[]} text The text or array of texts to pre-tokenize.
   * @param {Object} [options] Additional options for the pre-tokenization logic.
   * @returns {string[]} An array of pre-tokens.
   */
  _call(e, r) {
    return this.pre_tokenize(e, r);
  }
}
class BertPreTokenizer extends PreTokenizer {
  /**
   * A PreTokenizer that splits text into wordpieces using a basic tokenization scheme
   * similar to that used in the original implementation of BERT.
   * 
   * @param {Object} config The configuration object.
   */
  constructor(e) {
    super(), this.pattern = new RegExp(`[^\\s${PUNCTUATION_REGEX}]+|[${PUNCTUATION_REGEX}]`, "gu");
  }
  /**
   * Tokenizes a single text using the BERT pre-tokenization scheme.
   * 
   * @param {string} text The text to tokenize.
   * @param {Object} [options] Additional options for the pre-tokenization logic.
   * @returns {string[]} An array of tokens.
   */
  pre_tokenize_text(e, r) {
    return e.trim().match(this.pattern) || [];
  }
}
class ByteLevelPreTokenizer extends PreTokenizer {
  /**
   * Creates a new instance of the `ByteLevelPreTokenizer` class.
   * @param {Object} config The configuration object.
   */
  constructor(e) {
    super(), this.config = e, this.add_prefix_space = this.config.add_prefix_space, this.trim_offsets = this.config.trim_offsets, this.use_regex = this.config.use_regex ?? !0, this.pattern = new RegExp("'s|'t|'re|'ve|'m|'ll|'d| ?\\p{L}+| ?\\p{N}+| ?[^\\s\\p{L}\\p{N}]+|\\s+(?!\\S)|\\s+", "gu"), this.byte_encoder = BYTES_TO_UNICODE, this.text_encoder = new TextEncoder();
  }
  /**
   * Tokenizes a single piece of text using byte-level tokenization.
   * @param {string} text The text to tokenize.
   * @param {Object} [options] Additional options for the pre-tokenization logic.
   * @returns {string[]} An array of tokens.
   */
  pre_tokenize_text(e, r) {
    return this.add_prefix_space && !e.startsWith(" ") && (e = " " + e), (this.use_regex ? e.match(this.pattern) || [] : [e]).map(
      (m) => Array.from(this.text_encoder.encode(m), (_) => this.byte_encoder[_]).join("")
    );
  }
}
class SplitPreTokenizer extends PreTokenizer {
  /**
   * @param {Object} config The configuration options for the pre-tokenizer.
   * @param {Object} config.pattern The pattern used to split the text. Can be a string or a regex object.
   * @param {string|undefined} config.pattern.String The string to use for splitting. Only defined if the pattern is a string.
   * @param {string|undefined} config.pattern.Regex The regex to use for splitting. Only defined if the pattern is a regex.
   * @param {SplitDelimiterBehavior} config.behavior The behavior to use when splitting.
   * @param {boolean} config.invert Whether to split (invert=false) or match (invert=true) the pattern.
   */
  constructor(e) {
    super(), this.config = e, this.pattern = createPattern(this.config.pattern, this.config.invert);
  }
  /**
   * Tokenizes text by splitting it using the given pattern.
   * @param {string} text The text to tokenize.
   * @param {Object} [options] Additional options for the pre-tokenization logic.
   * @returns {string[]} An array of tokens.
   */
  pre_tokenize_text(e, r) {
    return this.pattern === null ? [] : this.config.invert ? e.match(this.pattern) || [] : regexSplit(e, this.pattern);
  }
}
class PunctuationPreTokenizer extends PreTokenizer {
  /**
   * @param {Object} config The configuration options for the pre-tokenizer.
   * @param {SplitDelimiterBehavior} config.behavior The behavior to use when splitting.
   */
  constructor(e) {
    super(), this.config = e, this.pattern = new RegExp(`[^${PUNCTUATION_REGEX}]+|[${PUNCTUATION_REGEX}]+`, "gu");
  }
  /**
   * Tokenizes text by splitting it using the given pattern.
   * @param {string} text The text to tokenize.
   * @param {Object} [options] Additional options for the pre-tokenization logic.
   * @returns {string[]} An array of tokens.
   */
  pre_tokenize_text(e, r) {
    return e.match(this.pattern) || [];
  }
}
class DigitsPreTokenizer extends PreTokenizer {
  /**
   * @param {Object} config The configuration options for the pre-tokenizer.
   * @param {boolean} config.individual_digits Whether to split on individual digits.
   */
  constructor(e) {
    super(), this.config = e;
    const r = `[^\\d]+|\\d${this.config.individual_digits ? "" : "+"}`;
    this.pattern = new RegExp(r, "gu");
  }
  /**
   * Tokenizes text by splitting it using the given pattern.
   * @param {string} text The text to tokenize.
   * @param {Object} [options] Additional options for the pre-tokenization logic.
   * @returns {string[]} An array of tokens.
   */
  pre_tokenize_text(e, r) {
    return e.match(this.pattern) || [];
  }
}
class PostProcessor extends Callable {
  /**
   * @param {Object} config The configuration for the post-processor.
   */
  constructor(e) {
    super(), this.config = e;
  }
  /**
   * Factory method to create a PostProcessor object from a configuration object.
   *
   * @param {Object} config Configuration object representing a PostProcessor.
   * @returns {PostProcessor} A PostProcessor object created from the given configuration.
   * @throws {Error} If an unknown PostProcessor type is encountered.
   */
  static fromConfig(e) {
    if (e === null) return null;
    switch (e.type) {
      case "TemplateProcessing":
        return new TemplateProcessing(e);
      case "ByteLevel":
        return new ByteLevelPostProcessor(e);
      case "RobertaProcessing":
        return new RobertaProcessing(e);
      case "BertProcessing":
        return new BertProcessing(e);
      case "Sequence":
        return new PostProcessorSequence(e);
      default:
        throw new Error(`Unknown PostProcessor type: ${e.type}`);
    }
  }
  /**
   * Method to be implemented in subclass to apply post-processing on the given tokens.
   *
   * @param {Array} tokens The input tokens to be post-processed.
   * @param {...*} args Additional arguments required by the post-processing logic.
   * @returns {PostProcessedOutput} The post-processed tokens.
   * @throws {Error} If the method is not implemented in subclass.
   */
  post_process(e, ...r) {
    throw Error("post_process should be implemented in subclass.");
  }
  /**
   * Alias for {@link PostProcessor#post_process}.
   * @param {Array} tokens The text or array of texts to post-process.
   * @param {...*} args Additional arguments required by the post-processing logic.
   * @returns {PostProcessedOutput} The post-processed tokens.
   */
  _call(e, ...r) {
    return this.post_process(e, ...r);
  }
}
class BertProcessing extends PostProcessor {
  /**
   * @param {Object} config The configuration for the post-processor.
   * @param {string[]} config.cls The special tokens to add to the beginning of the input.
   * @param {string[]} config.sep The special tokens to add to the end of the input.
   */
  constructor(e) {
    super(e), this.cls = e.cls[0], this.sep = e.sep[0];
  }
  /**
   * Adds the special tokens to the beginning and end of the input.
   * @param {string[]} tokens The input tokens.
   * @param {string[]} [tokens_pair=null] An optional second set of input tokens.
   * @returns {PostProcessedOutput} The post-processed tokens with the special tokens added to the beginning and end.
   */
  post_process(e, r = null, {
    add_special_tokens: o = !0
  } = {}) {
    o && (e = mergeArrays([this.cls], e, [this.sep]));
    let m = new Array(e.length).fill(0);
    if (r !== null) {
      const _ = o && this instanceof RobertaProcessing ? [this.sep] : [], g = o ? [this.sep] : [];
      e = mergeArrays(e, _, r, g), m = mergeArrays(m, new Array(r.length + _.length + g.length).fill(1));
    }
    return { tokens: e, token_type_ids: m };
  }
}
class RobertaProcessing extends BertProcessing {
}
class TemplateProcessing extends PostProcessor {
  /**
   * Creates a new instance of `TemplateProcessing`.
   * @param {Object} config The configuration options for the post processor.
   * @param {Array} config.single The template for a single sequence of tokens.
   * @param {Array} config.pair The template for a pair of sequences of tokens.
   */
  constructor(e) {
    super(e), this.single = e.single, this.pair = e.pair;
  }
  /**
   * Replaces special tokens in the template with actual tokens.
   * @param {string[]} tokens The list of tokens for the first sequence.
   * @param {string[]} [tokens_pair=null] The list of tokens for the second sequence (optional).
   * @returns {PostProcessedOutput} An object containing the list of tokens with the special tokens replaced with actual tokens.
   */
  post_process(e, r = null, {
    add_special_tokens: o = !0
  } = {}) {
    const m = r === null ? this.single : this.pair;
    let _ = [], g = [];
    for (const y of m)
      "SpecialToken" in y ? o && (_.push(y.SpecialToken.id), g.push(y.SpecialToken.type_id)) : "Sequence" in y && (y.Sequence.id === "A" ? (_ = mergeArrays(_, e), g = mergeArrays(g, new Array(e.length).fill(y.Sequence.type_id))) : y.Sequence.id === "B" && (_ = mergeArrays(_, r), g = mergeArrays(g, new Array(r.length).fill(y.Sequence.type_id))));
    return { tokens: _, token_type_ids: g };
  }
}
class ByteLevelPostProcessor extends PostProcessor {
  /**
   * Post process the given tokens.
   * @param {string[]} tokens The list of tokens for the first sequence.
   * @param {string[]} [tokens_pair=null] The list of tokens for the second sequence (optional).
   * @returns {PostProcessedOutput} An object containing the post-processed tokens.
   */
  post_process(e, r = null) {
    return r && (e = mergeArrays(e, r)), { tokens: e };
  }
}
class PostProcessorSequence extends PostProcessor {
  /**
   * Creates a new instance of PostProcessorSequence.
   * @param {Object} config The configuration object.
   * @param {Object[]} config.processors The list of post-processors to apply.
   */
  constructor(e) {
    super(e), this.processors = e.processors.map((r) => PostProcessor.fromConfig(r));
  }
  /**
   * Post process the given tokens.
   * @param {string[]} tokens The list of tokens for the first sequence.
   * @param {string[]} [tokens_pair=null] The list of tokens for the second sequence (optional).
   * @returns {PostProcessedOutput} An object containing the post-processed tokens.
   */
  post_process(e, r = null, o = {}) {
    let m;
    for (const _ of this.processors)
      if (_ instanceof ByteLevelPostProcessor)
        e = _.post_process(e).tokens, r && (r = _.post_process(r).tokens);
      else {
        const g = _.post_process(e, r, o);
        e = g.tokens, m = g.token_type_ids;
      }
    return { tokens: e, token_type_ids: m };
  }
}
class Decoder extends Callable {
  /**
  * Creates an instance of `Decoder`.
  *
  * @param {Object} config The configuration object.
  */
  constructor(e) {
    super(), this.config = e, this.added_tokens = [], this.end_of_word_suffix = null, this.trim_offsets = e.trim_offsets;
  }
  /**
  * Creates a decoder instance based on the provided configuration.
  *
  * @param {Object} config The configuration object.
  * @returns {Decoder} A decoder instance.
  * @throws {Error} If an unknown decoder type is provided.
  */
  static fromConfig(e) {
    if (e === null) return null;
    switch (e.type) {
      case "WordPiece":
        return new WordPieceDecoder(e);
      case "Metaspace":
        return new MetaspaceDecoder(e);
      case "ByteLevel":
        return new ByteLevelDecoder(e);
      case "Replace":
        return new ReplaceDecoder(e);
      case "ByteFallback":
        return new ByteFallback(e);
      case "Fuse":
        return new FuseDecoder(e);
      case "Strip":
        return new StripDecoder(e);
      case "Sequence":
        return new DecoderSequence(e);
      case "CTC":
        return new CTCDecoder(e);
      case "BPEDecoder":
        return new BPEDecoder(e);
      default:
        throw new Error(`Unknown Decoder type: ${e.type}`);
    }
  }
  /**
  * Calls the `decode` method.
  *
  * @param {string[]} tokens The list of tokens.
  * @returns {string} The decoded string.
  */
  _call(e) {
    return this.decode(e);
  }
  /**
  * Decodes a list of tokens.
  * @param {string[]} tokens The list of tokens.
  * @returns {string} The decoded string.
  */
  decode(e) {
    return this.decode_chain(e).join("");
  }
  /**
   * Apply the decoder to a list of tokens.
   * 
   * @param {string[]} tokens The list of tokens.
   * @returns {string[]} The decoded list of tokens.
   * @throws {Error} If the `decode_chain` method is not implemented in the subclass.
   */
  decode_chain(e) {
    throw Error("`decode_chain` should be implemented in subclass.");
  }
}
class ReplaceDecoder extends Decoder {
  /** @type {Decoder['decode_chain']} */
  decode_chain(e) {
    const r = createPattern(this.config.pattern);
    return r === null ? e : e.map((o) => o.replaceAll(r, this.config.content));
  }
}
class ByteFallback extends Decoder {
  constructor(e) {
    super(e), this.text_decoder = new TextDecoder();
  }
  /** @type {Decoder['decode_chain']} */
  decode_chain(e) {
    const r = [];
    let o = [];
    for (const m of e) {
      let _ = null;
      if (m.length === 6 && m.startsWith("<0x") && m.endsWith(">")) {
        const g = parseInt(m.slice(3, 5), 16);
        isNaN(g) || (_ = g);
      }
      if (_ !== null)
        o.push(_);
      else {
        if (o.length > 0) {
          const g = this.text_decoder.decode(Uint8Array.from(o));
          r.push(g), o = [];
        }
        r.push(m);
      }
    }
    if (o.length > 0) {
      const m = this.text_decoder.decode(Uint8Array.from(o));
      r.push(m), o = [];
    }
    return r;
  }
}
class FuseDecoder extends Decoder {
  /** @type {Decoder['decode_chain']} */
  decode_chain(e) {
    return [e.join("")];
  }
}
class StripDecoder extends Decoder {
  constructor(e) {
    super(e), this.content = this.config.content, this.start = this.config.start, this.stop = this.config.stop;
  }
  /** @type {Decoder['decode_chain']} */
  decode_chain(e) {
    return e.map((r) => {
      let o = 0;
      for (let _ = 0; _ < this.start && r[_] === this.content; ++_) {
        o = _ + 1;
        continue;
      }
      let m = r.length;
      for (let _ = 0; _ < this.stop; ++_) {
        const g = r.length - _ - 1;
        if (r[g] === this.content) {
          m = g;
          continue;
        } else
          break;
      }
      return r.slice(o, m);
    });
  }
}
class WordPieceDecoder extends Decoder {
  /**
   * Creates a new instance of WordPieceDecoder.
   * @param {Object} config The configuration object.
   * @param {string} config.prefix The prefix used for WordPiece encoding.
   * @param {boolean} config.cleanup Whether to cleanup the decoded string.
   */
  constructor(e) {
    super(e), this.cleanup = e.cleanup;
  }
  /** @type {Decoder['decode_chain']} */
  decode_chain(e) {
    return e.map((r, o) => (o !== 0 && (r.startsWith(this.config.prefix) ? r = r.replace(this.config.prefix, "") : r = " " + r), this.cleanup && (r = clean_up_tokenization(r)), r));
  }
}
class ByteLevelDecoder extends Decoder {
  /**
   * Create a `ByteLevelDecoder` object.
   * @param {Object} config Configuration object.
   */
  constructor(e) {
    super(e), this.byte_decoder = UNICODE_TO_BYTES, this.text_decoder = new TextDecoder("utf-8", {
      fatal: !1,
      ignoreBOM: !0
    }), this.end_of_word_suffix = null;
  }
  /**
   * Convert an array of tokens to string by decoding each byte.
   * @param {string[]} tokens Array of tokens to be decoded.
   * @returns {string} The decoded string.
   */
  convert_tokens_to_string(e) {
    const r = e.join(""), o = new Uint8Array([...r].map((_) => this.byte_decoder[_]));
    return this.text_decoder.decode(o);
  }
  /** @type {Decoder['decode_chain']} */
  decode_chain(e) {
    const r = [];
    let o = [];
    for (const m of e)
      this.added_tokens.find((_) => _.content === m) !== void 0 ? (o.length > 0 && (r.push(this.convert_tokens_to_string(o)), o = []), r.push(m)) : o.push(m);
    return o.length > 0 && r.push(this.convert_tokens_to_string(o)), r;
  }
}
class CTCDecoder extends Decoder {
  constructor(e) {
    super(e), this.pad_token = this.config.pad_token, this.word_delimiter_token = this.config.word_delimiter_token, this.cleanup = this.config.cleanup;
  }
  /**
   * Converts a connectionist-temporal-classification (CTC) output tokens into a single string.
   * @param {string[]} tokens Array of tokens to be decoded.
   * @returns {string} The decoded string.
   */
  convert_tokens_to_string(e) {
    if (e.length === 0) return "";
    const r = [e[0]];
    for (let _ = 1; _ < e.length; ++_)
      e[_] !== r.at(-1) && r.push(e[_]);
    let m = r.filter((_) => _ !== this.pad_token).join("");
    return this.cleanup && (m = clean_up_tokenization(m).replaceAll(this.word_delimiter_token, " ").trim()), m;
  }
  /** @type {Decoder['decode_chain']} */
  decode_chain(e) {
    return [this.convert_tokens_to_string(e)];
  }
}
class DecoderSequence extends Decoder {
  /**
   * Creates a new instance of DecoderSequence.
   * @param {Object} config The configuration object.
   * @param {Object[]} config.decoders The list of decoders to apply.
   */
  constructor(e) {
    super(e), this.decoders = e.decoders.map((r) => Decoder.fromConfig(r));
  }
  /** @type {Decoder['decode_chain']} */
  decode_chain(e) {
    return this.decoders.reduce((r, o) => o.decode_chain(r), e);
  }
}
class BPEDecoder extends Decoder {
  constructor(e) {
    super(e), this.suffix = this.config.suffix;
  }
  /** @type {Decoder['decode_chain']} */
  decode_chain(e) {
    return e.map((r, o) => r.replaceAll(this.suffix, o === e.length - 1 ? "" : " "));
  }
}
class VitsDecoder extends Decoder {
  /** @type {Decoder['decode_chain']} */
  decode_chain(e) {
    let r = "";
    for (let o = 1; o < e.length; o += 2)
      r += e[o];
    return [r];
  }
}
class MetaspacePreTokenizer extends PreTokenizer {
  /**
   * @param {Object} config The configuration object for the MetaspacePreTokenizer.
   * @param {boolean} config.add_prefix_space Whether to add a prefix space to the first token.
   * @param {string} config.replacement The character to replace spaces with.
   * @param {string} [config.str_rep=config.replacement] An optional string representation of the replacement character.
   * @param {'first'|'never'|'always'} [config.prepend_scheme='always'] The metaspace prepending scheme.
   */
  constructor(e) {
    super(), this.addPrefixSpace = e.add_prefix_space, this.replacement = e.replacement, this.strRep = e.str_rep || this.replacement, this.prepend_scheme = e.prepend_scheme ?? "always";
  }
  /**
   * This method takes a string, replaces spaces with the replacement character,
   * adds a prefix space if requested, and returns a new list of tokens.
   * @param {string} text The text to pre-tokenize.
   * @param {Object} [options] The options for the pre-tokenization.
   * @param {number} [options.section_index] The index of the section to pre-tokenize.
   * @returns {string[]} A new list of pre-tokenized tokens.
   */
  pre_tokenize_text(e, {
    section_index: r = void 0
  } = {}) {
    let o = e.replaceAll(" ", this.strRep);
    return (
      // We add a prefix space if:
      //  (1) The addPrefixSpace option is enabled and the normalized
      //      token does not already start with the replacement character.
      this.addPrefixSpace && !o.startsWith(this.replacement) && (this.prepend_scheme === "always" || this.prepend_scheme === "first" && r === 0) && (o = this.strRep + o), [o]
    );
  }
}
class MetaspaceDecoder extends Decoder {
  /**
   * Constructs a new MetaspaceDecoder object.
   * @param {Object} config The configuration object for the MetaspaceDecoder.
   * @param {boolean} config.add_prefix_space Whether to add a prefix space to the decoded string.
   * @param {string} config.replacement The string to replace spaces with.
   */
  constructor(e) {
    super(e), this.addPrefixSpace = e.add_prefix_space, this.replacement = e.replacement;
  }
  /** @type {Decoder['decode_chain']} */
  decode_chain(e) {
    const r = [];
    for (let o = 0; o < e.length; ++o) {
      let m = e[o].replaceAll(this.replacement, " ");
      this.addPrefixSpace && o == 0 && m.startsWith(" ") && (m = m.substring(1)), r.push(m);
    }
    return r;
  }
}
class Precompiled extends Normalizer {
  /**
   * Create a new instance of Precompiled normalizer.
   * @param {Object} config The configuration object.
   * @param {any} config.precompiled_charsmap Precompiled chars mapping.
   */
  constructor(e) {
    super(e), this.charsmap = e.precompiled_charsmap;
  }
  /**
   * Normalizes the given text by applying the precompiled charsmap.
   * @param {string} text The text to normalize.
   * @returns {string} The normalized text.
   */
  normalize(e) {
    return e = e.replace(/[\u0001-\u0008\u000B\u000E-\u001F\u007F\u008F\u009F]/gm, ""), e = e.replace(/[\u0009\u000A\u000C\u000D\u1680\u200B\u200C\u200E\u200F\u2028\u2029\u2581\uFEFF\uFFFD]/gm, " "), e.includes("～") ? e = e.split("～").map((o) => o.normalize("NFKC")).join("～") : e = e.normalize("NFKC"), e;
  }
}
class PreTokenizerSequence extends PreTokenizer {
  /**
   * Creates an instance of PreTokenizerSequence.
   * @param {Object} config The configuration object for the pre-tokenizer sequence.
   * @param {Object[]} config.pretokenizers An array of pre-tokenizer configurations.
   */
  constructor(e) {
    super(), this.tokenizers = e.pretokenizers.map((r) => PreTokenizer.fromConfig(r));
  }
  /**
   * Applies each pre-tokenizer in the sequence to the input text in turn.
   * @param {string} text The text to pre-tokenize.
   * @param {Object} [options] Additional options for the pre-tokenization logic.
   * @returns {string[]} The pre-tokenized text.
   */
  pre_tokenize_text(e, r) {
    return this.tokenizers.reduce((o, m) => m.pre_tokenize(o, r), [e]);
  }
}
class WhitespacePreTokenizer extends PreTokenizer {
  /**
   * Creates an instance of WhitespacePreTokenizer.
   * @param {Object} config The configuration object for the pre-tokenizer.
   */
  constructor(e) {
    super();
  }
  /**
   * Pre-tokenizes the input text by splitting it on word boundaries.
   * @param {string} text The text to be pre-tokenized.
   * @param {Object} [options] Additional options for the pre-tokenization logic.
   * @returns {string[]} An array of tokens produced by splitting the input text on whitespace.
   */
  pre_tokenize_text(e, r) {
    return e.match(/\w+|[^\w\s]+/g) || [];
  }
}
class WhitespaceSplit extends PreTokenizer {
  /**
   * Creates an instance of WhitespaceSplit.
   * @param {Object} config The configuration object for the pre-tokenizer.
   */
  constructor(e) {
    super();
  }
  /**
   * Pre-tokenizes the input text by splitting it on whitespace characters.
   * @param {string} text The text to be pre-tokenized.
   * @param {Object} [options] Additional options for the pre-tokenization logic.
   * @returns {string[]} An array of tokens produced by splitting the input text on whitespace.
   */
  pre_tokenize_text(e, r) {
    return whitespace_split(e);
  }
}
class ReplacePreTokenizer extends PreTokenizer {
  /**
   * @param {Object} config The configuration options for the pre-tokenizer.
   * @param {Object} config.pattern The pattern used to split the text. Can be a string or a regex object.
   * @param {string} config.content What to replace the pattern with.
   */
  constructor(e) {
    super(), this.config = e, this.pattern = createPattern(this.config.pattern), this.content = this.config.content;
  }
  /**
   * Pre-tokenizes the input text by replacing certain characters.
   * @param {string} text The text to be pre-tokenized.
   * @param {Object} [options] Additional options for the pre-tokenization logic.
   * @returns {string[]} An array of tokens produced by replacing certain characters.
   */
  pre_tokenize_text(e, r) {
    return this.pattern === null ? [e] : [e.replaceAll(this.pattern, this.config.content)];
  }
}
const SPECIAL_TOKEN_ATTRIBUTES = [
  "bos_token",
  "eos_token",
  "unk_token",
  "sep_token",
  "pad_token",
  "cls_token",
  "mask_token"
  // additional_special_tokens (TODO)
];
function padHelper(s, e, r, o) {
  for (const m of Object.keys(s)) {
    const _ = e - s[m].length, g = r(m), y = new Array(_).fill(g);
    s[m] = o === "right" ? mergeArrays(s[m], y) : mergeArrays(y, s[m]);
  }
}
function truncateHelper(s, e) {
  for (const r of Object.keys(s))
    s[r].length = e;
}
class PreTrainedTokenizer extends Callable {
  /**
   * Create a new PreTrainedTokenizer instance.
   * @param {Object} tokenizerJSON The JSON of the tokenizer.
   * @param {Object} tokenizerConfig The config of the tokenizer.
   */
  constructor(r, o) {
    super();
    be(this, "return_token_type_ids", !1);
    be(this, "_default_chat_template", `{% for message in messages %}{{'<|im_start|>' + message['role'] + '
' + message['content'] + '<|im_end|>' + '
'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant
' }}{% endif %}`);
    this._tokenizer_config = o, this.normalizer = Normalizer.fromConfig(r.normalizer), this.pre_tokenizer = PreTokenizer.fromConfig(r.pre_tokenizer), this.model = TokenizerModel.fromConfig(r.model, o), this.post_processor = PostProcessor.fromConfig(r.post_processor), this.decoder = Decoder.fromConfig(r.decoder), this.special_tokens = [], this.all_special_ids = [], this.added_tokens = [];
    for (const m of r.added_tokens) {
      const _ = new AddedToken(m);
      this.added_tokens.push(_), this.model.tokens_to_ids.set(_.content, _.id), this.model.vocab[_.id] = _.content, _.special && (this.special_tokens.push(_.content), this.all_special_ids.push(_.id));
    }
    if (this.additional_special_tokens = o.additional_special_tokens ?? [], this.special_tokens.push(...this.additional_special_tokens), this.special_tokens = [...new Set(this.special_tokens)], this.decoder && (this.decoder.added_tokens = this.added_tokens, this.decoder.end_of_word_suffix = this.model.end_of_word_suffix), this.added_tokens_regex = this.added_tokens.length > 0 ? new RegExp(
      this.added_tokens.map((m) => `${m.lstrip ? "\\s*" : ""}(${escapeRegExp(m.content)})${m.rstrip ? "\\s*" : ""}`).join("|")
    ) : null, this.mask_token = this.getToken("mask_token"), this.mask_token_id = this.model.tokens_to_ids.get(this.mask_token), this.pad_token = this.getToken("pad_token", "eos_token"), this.pad_token_id = this.model.tokens_to_ids.get(this.pad_token), this.sep_token = this.getToken("sep_token"), this.sep_token_id = this.model.tokens_to_ids.get(this.sep_token), this.unk_token = this.getToken("unk_token"), this.unk_token_id = this.model.tokens_to_ids.get(this.unk_token), this.model_max_length = o.model_max_length, this.remove_space = o.remove_space, this.clean_up_tokenization_spaces = o.clean_up_tokenization_spaces ?? !0, this.do_lowercase_and_remove_accent = o.do_lowercase_and_remove_accent ?? !1, this.padding_side = "right", this.legacy = !1, this.chat_template = o.chat_template ?? null, Array.isArray(this.chat_template)) {
      const m = /* @__PURE__ */ Object.create(null);
      for (const { name: _, template: g } of this.chat_template) {
        if (typeof _ != "string" || typeof g != "string")
          throw new Error('Chat template must be a list of objects with "name" and "template" properties');
        m[_] = g;
      }
      this.chat_template = m;
    }
    this._compiled_template_cache = /* @__PURE__ */ new Map();
  }
  /**
   * Returns the value of the first matching key in the tokenizer config object.
   * @param {...string} keys One or more keys to search for in the tokenizer config object.
   * @returns {string|null} The value associated with the first matching key, or null if no match is found.
   * @throws {Error} If an object is found for a matching key and its __type property is not "AddedToken".
   */
  getToken(...r) {
    for (const o of r) {
      const m = this._tokenizer_config[o];
      if (m)
        if (typeof m == "object") {
          if (m.__type === "AddedToken")
            return m.content;
          throw Error(`Unknown token: ${m}`);
        } else
          return m;
    }
    return null;
  }
  /**
   * Loads a pre-trained tokenizer from the given `pretrained_model_name_or_path`. 
   * 
   * @param {string} pretrained_model_name_or_path The path to the pre-trained tokenizer.
   * @param {PretrainedTokenizerOptions} options Additional options for loading the tokenizer.
   * 
   * @throws {Error} Throws an error if the tokenizer.json or tokenizer_config.json files are not found in the `pretrained_model_name_or_path`.
   * @returns {Promise<PreTrainedTokenizer>} A new instance of the `PreTrainedTokenizer` class.
   */
  static async from_pretrained(r, {
    progress_callback: o = null,
    config: m = null,
    cache_dir: _ = null,
    local_files_only: g = !1,
    revision: y = "main",
    legacy: E = null
  } = {}) {
    const x = await loadTokenizer(r, {
      progress_callback: o,
      cache_dir: _,
      local_files_only: g,
      revision: y,
      legacy: E
    });
    return new this(...x);
  }
  /**
   * @typedef {number[]|number[][]|Tensor} BatchEncodingItem
   * 
   * @typedef {Object} BatchEncoding Holds the output of the tokenizer's call function.
   * @property {BatchEncodingItem} input_ids List of token ids to be fed to a model.
   * @property {BatchEncodingItem} attention_mask List of indices specifying which tokens should be attended to by the model.
   * @property {BatchEncodingItem} [token_type_ids] List of token type ids to be fed to a model.
   */
  /**
   * Encode/tokenize the given text(s).
   * @param {string|string[]} text The text to tokenize.
   * @param {Object} options An optional object containing the following properties:
   * @param {string|string[]} [options.text_pair=null] Optional second sequence to be encoded. If set, must be the same type as text.
   * @param {boolean|'max_length'} [options.padding=false] Whether to pad the input sequences.
   * @param {boolean} [options.add_special_tokens=true] Whether or not to add the special tokens associated with the corresponding model.
   * @param {boolean} [options.truncation=null] Whether to truncate the input sequences.
   * @param {number} [options.max_length=null] Maximum length of the returned list and optionally padding length.
   * @param {boolean} [options.return_tensor=true] Whether to return the results as Tensors or arrays.
   * @param {boolean} [options.return_token_type_ids=null] Whether to return the token type ids.
   * @returns {BatchEncoding} Object to be passed to the model.
   */
  _call(r, {
    text_pair: o = null,
    add_special_tokens: m = !0,
    padding: _ = !1,
    truncation: g = null,
    max_length: y = null,
    return_tensor: E = !0,
    // Different to HF
    return_token_type_ids: x = null
  } = {}) {
    const v = Array.isArray(r);
    let h;
    if (v) {
      if (r.length === 0)
        throw Error("text array must be non-empty");
      if (o !== null) {
        if (Array.isArray(o)) {
          if (r.length !== o.length)
            throw Error("text and text_pair must have the same length");
        } else throw Error("text_pair must also be an array");
        h = r.map(
          (b, w) => this._encode_plus(b, o[w], { add_special_tokens: m, return_token_type_ids: x })
        );
      } else
        h = r.map((b) => this._encode_plus(b, null, { add_special_tokens: m, return_token_type_ids: x }));
    } else {
      if (r == null)
        throw Error("text may not be null or undefined");
      if (Array.isArray(o))
        throw Error("When specifying `text_pair`, since `text` is a string, `text_pair` must also be a string (i.e., not an array).");
      h = [this._encode_plus(r, o, { add_special_tokens: m, return_token_type_ids: x })];
    }
    if (y === null ? _ === "max_length" ? y = this.model_max_length : y = max(h.map((b) => b.input_ids.length))[0] : g || console.warn("Truncation was not explicitly activated but `max_length` is provided a specific value, please use `truncation=true` to explicitly truncate examples to max length."), y = Math.min(y, this.model_max_length), _ || g)
      for (let b = 0; b < h.length; ++b)
        h[b].input_ids.length !== y && (h[b].input_ids.length > y ? g && truncateHelper(h[b], y) : _ && padHelper(
          h[b],
          y,
          (w) => w === "input_ids" ? this.pad_token_id : 0,
          this.padding_side
        ));
    const a = {};
    if (E) {
      if (!(_ && g) && h.some((w) => {
        var k;
        for (const A of Object.keys(w))
          if (w[A].length !== ((k = h[0][A]) == null ? void 0 : k.length))
            return !0;
        return !1;
      }))
        throw Error(
          "Unable to create tensor, you should probably activate truncation and/or padding with 'padding=true' and 'truncation=true' to have batched tensors with the same length."
        );
      const b = [h.length, h[0].input_ids.length];
      for (const w of Object.keys(h[0]))
        a[w] = new Tensor(
          "int64",
          BigInt64Array.from(h.flatMap((k) => k[w]).map(BigInt)),
          b
        );
    } else {
      for (const b of Object.keys(h[0]))
        a[b] = h.map((w) => w[b]);
      if (!v)
        for (const b of Object.keys(a))
          a[b] = a[b][0];
    }
    return (
      /** @type {BatchEncoding} */
      a
    );
  }
  /**
   * Encodes a single text using the preprocessor pipeline of the tokenizer.
   *
   * @param {string|null} text The text to encode.
   * @returns {string[]|null} The encoded tokens.
   */
  _encode_text(r) {
    return r === null ? null : (this.added_tokens_regex ? r.split(this.added_tokens_regex).filter((_) => _) : [r]).map((_, g) => {
      if (this.added_tokens.find((E) => E.content === _) !== void 0)
        return _;
      {
        if (this.remove_space === !0 && (_ = _.trim().split(/\s+/).join(" ")), this.do_lowercase_and_remove_accent && (_ = lowercase_and_remove_accent(_)), this.normalizer !== null && (_ = this.normalizer(_)), _.length === 0)
          return [];
        const E = this.pre_tokenizer !== null ? this.pre_tokenizer(_, {
          section_index: g
        }) : [_];
        return this.model(E);
      }
    }).flat();
  }
  /**
   * Encodes a single text or a pair of texts using the model's tokenizer.
   *
   * @param {string} text The text to encode.
   * @param {string|null} text_pair The optional second text to encode.
   * @param {Object} options An optional object containing the following properties:
   * @param {boolean} [options.add_special_tokens=true] Whether or not to add the special tokens associated with the corresponding model.
   * @param {boolean} [options.return_token_type_ids=null] Whether to return token_type_ids.
   * @returns {EncodingSingle} An object containing the encoded text.
   * @private
   */
  _encode_plus(r, o = null, {
    add_special_tokens: m = !0,
    return_token_type_ids: _ = null
  } = {}) {
    const g = this._encode_text(r), y = this._encode_text(o), E = this.post_processor ? this.post_processor(g, y, { add_special_tokens: m }) : { tokens: mergeArrays(g ?? [], y ?? []) }, x = this.model.convert_tokens_to_ids(E.tokens), v = {
      input_ids: x,
      attention_mask: new Array(x.length).fill(1)
    };
    return (_ ?? this.return_token_type_ids) && E.token_type_ids && (v.token_type_ids = E.token_type_ids), v;
  }
  /**
   * Encodes a single text or a pair of texts using the model's tokenizer.
   *
   * @param {string} text The text to encode.
   * @param {string|null} text_pair The optional second text to encode.
   * @param {Object} options An optional object containing the following properties:
   * @param {boolean} [options.add_special_tokens=true] Whether or not to add the special tokens associated with the corresponding model.
   * @param {boolean} [options.return_token_type_ids=null] Whether to return token_type_ids.
   * @returns {number[]} An array of token IDs representing the encoded text(s).
   */
  encode(r, o = null, {
    add_special_tokens: m = !0,
    return_token_type_ids: _ = null
  } = {}) {
    const { input_ids: g } = this._encode_plus(r, o, {
      add_special_tokens: m,
      return_token_type_ids: _
    });
    return g;
  }
  /**
   * Decode a batch of tokenized sequences.
   * @param {number[][]|Tensor} batch List/Tensor of tokenized input sequences.
   * @param {Object} decode_args (Optional) Object with decoding arguments.
   * @returns {string[]} List of decoded sequences.
   */
  batch_decode(r, o = {}) {
    return r instanceof Tensor && (r = r.tolist()), r.map((m) => this.decode(m, o));
  }
  /**
   * Decodes a sequence of token IDs back to a string.
   *
   * @param {number[]|Tensor} token_ids List/Tensor of token IDs to decode.
   * @param {Object} [decode_args={}]
   * @param {boolean} [decode_args.skip_special_tokens=false] If true, special tokens are removed from the output string.
   * @param {boolean} [decode_args.clean_up_tokenization_spaces=true] If true, spaces before punctuations and abbreviated forms are removed.
   *
   * @returns {string} The decoded string.
   * @throws {Error} If `token_ids` is not a non-empty array of integers.
   */
  decode(r, o = {}) {
    if (r instanceof Tensor && (r = prepareTensorForDecode(r)), !Array.isArray(r) || r.length === 0 || !isIntegralNumber(r[0]))
      throw Error("token_ids must be a non-empty array of integers.");
    return this.decode_single(r, o);
  }
  /**
   * Decode a single list of token ids to a string.
   * @param {number[]} token_ids List of token ids to decode
   * @param {Object} decode_args Optional arguments for decoding
   * @param {boolean} [decode_args.skip_special_tokens=false] Whether to skip special tokens during decoding
   * @param {boolean} [decode_args.clean_up_tokenization_spaces=null] Whether to clean up tokenization spaces during decoding.
   * If null, the value is set to `this.decoder.cleanup` if it exists, falling back to `this.clean_up_tokenization_spaces` if it exists, falling back to `true`.
   * @returns {string} The decoded string
   */
  decode_single(r, {
    skip_special_tokens: o = !1,
    clean_up_tokenization_spaces: m = null
  }) {
    let _ = this.model.convert_ids_to_tokens(r);
    o && (_ = _.filter((y) => !this.special_tokens.includes(y)));
    let g = this.decoder ? this.decoder(_) : _.join(" ");
    return this.decoder && this.decoder.end_of_word_suffix && (g = g.replaceAll(this.decoder.end_of_word_suffix, " "), o && (g = g.trim())), (m ?? this.clean_up_tokenization_spaces) && (g = clean_up_tokenization(g)), g;
  }
  get default_chat_template() {
    return this._warned_about_chat_template || (console.warn(
      "No chat template is defined for this tokenizer - using a default chat template that implements the ChatML format. If the default is not appropriate for your model, please set `tokenizer.chat_template` to an appropriate template. See https://huggingface.co/docs/transformers/main/chat_templating for more information."
    ), this._warned_about_chat_template = !0), this._default_chat_template;
  }
  /**
   * Converts a list of message objects with `"role"` and `"content"` keys to a list of token
   * ids. This method is intended for use with chat models, and will read the tokenizer's chat_template attribute to
   * determine the format and control tokens to use when converting. When chat_template is None, it will fall back
   * to the default_chat_template specified at the class level.
   * 
   * See [here](https://huggingface.co/docs/transformers/chat_templating) for more information.
   * 
   * **Example:** Applying a chat template to a conversation.
   * 
   * ```javascript
   * import { AutoTokenizer } from "@xenova/transformers";
   * 
   * const tokenizer = await AutoTokenizer.from_pretrained("Xenova/mistral-tokenizer-v1");
   * 
   * const chat = [
   *   { "role": "user", "content": "Hello, how are you?" },
   *   { "role": "assistant", "content": "I'm doing great. How can I help you today?" },
   *   { "role": "user", "content": "I'd like to show off how chat templating works!" },
   * ]
   * 
   * const text = tokenizer.apply_chat_template(chat, { tokenize: false });
   * // "<s>[INST] Hello, how are you? [/INST]I'm doing great. How can I help you today?</s> [INST] I'd like to show off how chat templating works! [/INST]"
   * 
   * const input_ids = tokenizer.apply_chat_template(chat, { tokenize: true, return_tensor: false });
   * // [1, 733, 16289, 28793, 22557, 28725, 910, 460, 368, 28804, 733, 28748, 16289, 28793, 28737, 28742, 28719, 2548, 1598, 28723, 1602, 541, 315, 1316, 368, 3154, 28804, 2, 28705, 733, 16289, 28793, 315, 28742, 28715, 737, 298, 1347, 805, 910, 10706, 5752, 1077, 3791, 28808, 733, 28748, 16289, 28793]
   * ```
   * 
   * @param {Message[]} conversation A list of message objects with `"role"` and `"content"` keys.
   * @param {Object} options An optional object containing the following properties:
   * @param {string} [options.chat_template=null] A Jinja template to use for this conversion. If
   * this is not passed, the model's default chat template will be used instead.
   * @param {boolean} [options.add_generation_prompt=false] Whether to end the prompt with the token(s) that indicate
   * the start of an assistant message. This is useful when you want to generate a response from the model.
   * Note that this argument will be passed to the chat template, and so it must be supported in the
   * template for this argument to have any effect.
   * @param {boolean} [options.tokenize=true] Whether to tokenize the output. If false, the output will be a string.
   * @param {boolean} [options.padding=false] Whether to pad sequences to the maximum length. Has no effect if tokenize is false.
   * @param {boolean} [options.truncation=false] Whether to truncate sequences to the maximum length. Has no effect if tokenize is false.
   * @param {number} [options.max_length=null] Maximum length (in tokens) to use for padding or truncation. Has no effect if tokenize is false.
   * If not specified, the tokenizer's `max_length` attribute will be used as a default.
   * @param {boolean} [options.return_tensor=true] Whether to return the output as a Tensor or an Array. Has no effect if tokenize is false.
   * @param {Object} [options.tokenizer_kwargs={}] Additional options to pass to the tokenizer.
   * @returns {string | Tensor | number[]| number[][]} The tokenized output.
   */
  apply_chat_template(r, {
    chat_template: o = null,
    add_generation_prompt: m = !1,
    tokenize: _ = !0,
    padding: g = !1,
    truncation: y = !1,
    max_length: E = null,
    return_tensor: x = !0,
    tokenizer_kwargs: v = {},
    ...h
  } = {}) {
    if (this.chat_template && typeof this.chat_template == "object" || this.chat_template === null && this.default_chat_template && typeof this.default_chat_template == "object") {
      const k = this.chat_template ?? this.default_chat_template;
      if (o !== null && Object.hasOwn(k, o))
        o = k[o];
      else if (o === null && "default" in k)
        o = k.default;
      else if (o === null)
        throw Error(
          `This model has multiple chat templates with no default specified! Please either pass a chat template or the name of the template you wish to use to the 'chat_template' argument. Available template names are ${Object.keys(k).sort()}.`
        );
    } else
      o ?? (o = this.chat_template ?? this.default_chat_template);
    if (typeof o != "string")
      throw Error(`chat_template must be a string, but got ${typeof o}`);
    let a = this._compiled_template_cache.get(o);
    a === void 0 && (a = new Template(o), this._compiled_template_cache.set(o, a));
    const b = /* @__PURE__ */ Object.create(null);
    for (const k of SPECIAL_TOKEN_ATTRIBUTES) {
      const A = this.getToken(k);
      A && (b[k] = A);
    }
    const w = a.render({
      messages: r,
      add_generation_prompt: m,
      ...b,
      ...h
    });
    return _ ? this._call(w, {
      add_special_tokens: !1,
      padding: g,
      truncation: y,
      max_length: E,
      return_tensor: x,
      ...v
    }).input_ids : w;
  }
}
class BertTokenizer extends PreTrainedTokenizer {
  constructor() {
    super(...arguments);
    be(this, "return_token_type_ids", !0);
  }
}
class AlbertTokenizer extends PreTrainedTokenizer {
  constructor() {
    super(...arguments);
    be(this, "return_token_type_ids", !0);
  }
}
class MobileBertTokenizer extends PreTrainedTokenizer {
  constructor() {
    super(...arguments);
    be(this, "return_token_type_ids", !0);
  }
}
class SqueezeBertTokenizer extends PreTrainedTokenizer {
  constructor() {
    super(...arguments);
    be(this, "return_token_type_ids", !0);
  }
}
class DebertaTokenizer extends PreTrainedTokenizer {
  constructor() {
    super(...arguments);
    be(this, "return_token_type_ids", !0);
  }
}
class DebertaV2Tokenizer extends PreTrainedTokenizer {
  constructor() {
    super(...arguments);
    be(this, "return_token_type_ids", !0);
  }
}
class HerbertTokenizer extends PreTrainedTokenizer {
  constructor() {
    super(...arguments);
    be(this, "return_token_type_ids", !0);
  }
}
class ConvBertTokenizer extends PreTrainedTokenizer {
  constructor() {
    super(...arguments);
    be(this, "return_token_type_ids", !0);
  }
}
class RoFormerTokenizer extends PreTrainedTokenizer {
  constructor() {
    super(...arguments);
    be(this, "return_token_type_ids", !0);
  }
}
class DistilBertTokenizer extends PreTrainedTokenizer {
}
class CamembertTokenizer extends PreTrainedTokenizer {
}
class XLMTokenizer extends PreTrainedTokenizer {
  constructor(r, o) {
    super(r, o);
    be(this, "return_token_type_ids", !0);
    console.warn('WARNING: `XLMTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.');
  }
}
class ElectraTokenizer extends PreTrainedTokenizer {
  constructor() {
    super(...arguments);
    be(this, "return_token_type_ids", !0);
  }
}
class T5Tokenizer extends PreTrainedTokenizer {
}
class GPT2Tokenizer extends PreTrainedTokenizer {
  constructor() {
    super(...arguments);
    be(this, "_default_chat_template", '{% for message in messages %}" "{{ message.content }}{{ eos_token }}" "{% endfor %}');
  }
}
class BartTokenizer extends PreTrainedTokenizer {
}
class MBartTokenizer extends PreTrainedTokenizer {
  constructor(e, r) {
    super(e, r), this.languageRegex = /^[a-z]{2}_[A-Z]{2}$/, this.language_codes = this.special_tokens.filter((o) => this.languageRegex.test(o)), this.lang_to_token = (o) => o;
  }
  /**
   * Helper function to build translation inputs for an `MBartTokenizer`.
   * @param {string|string[]} raw_inputs The text to tokenize.
   * @param {Object} tokenizer_options Options to be sent to the tokenizer
   * @param {Object} generate_kwargs Generation options.
   * @returns {Object} Object to be passed to the model.
   */
  _build_translation_inputs(e, r, o) {
    return _build_translation_inputs(this, e, r, o);
  }
}
class MBart50Tokenizer extends MBartTokenizer {
}
class RobertaTokenizer extends PreTrainedTokenizer {
}
class BloomTokenizer extends GPT2Tokenizer {
  // NOTE: `GPT2Tokenizer` to get the correct chat template
  constructor(e, r) {
    var _, g;
    const o = ".,!?…。，、।۔،", m = (g = (_ = e.pre_tokenizer) == null ? void 0 : _.pretokenizers[0]) == null ? void 0 : g.pattern;
    m && m.Regex === ` ?[^(\\s|[${o}])]+` && (m.Regex = ` ?[^\\s${o}]+`), super(e, r);
  }
}
const SPIECE_UNDERLINE = "▁";
class LlamaTokenizer extends PreTrainedTokenizer {
  constructor(r, o) {
    super(r, o);
    be(this, "_default_chat_template", `{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% elif USE_DEFAULT_PROMPT == true and not '<<SYS>>' in messages[0]['content'] %}{% set loop_messages = messages %}{% set system_message = 'DEFAULT_SYSTEM_MESSAGE' %}{% else %}{% set loop_messages = messages %}{% set system_message = false %}{% endif %}{% for message in loop_messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if loop.index0 == 0 and system_message != false %}{% set content = '<<SYS>>
' + system_message + '
<</SYS>>

' + message['content'] %}{% else %}{% set content = message['content'] %}{% endif %}{% if message['role'] == 'user' %}{{ bos_token + '[INST] ' + content.strip() + ' [/INST]' }}{% elif message['role'] == 'system' %}{{ '<<SYS>>
' + content.strip() + '
<</SYS>>

' }}{% elif message['role'] == 'assistant' %}{{ ' '  + content.strip() + ' ' + eos_token }}{% endif %}{% endfor %}`);
    be(this, "DEFAULT_SYSTEM_PROMPT", `You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.

If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.`);
    this.use_default_system_prompt = o.use_default_system_prompt ?? !1, this.legacy = o.legacy ?? !0, this.legacy || (this.normalizer = null, this.pre_tokenizer = new MetaspacePreTokenizer({
      replacement: SPIECE_UNDERLINE,
      add_prefix_space: !0,
      prepend_scheme: "first"
    }));
  }
  /**
   * Helper function to handle legacy encoding of SPM tokenizers.
   * Adapted from https://github.com/huggingface/transformers/blob/e6dcf8abd6f65bb4b6dfc1831b20d9ba49ce00e2/src/transformers/models/t5/tokenization_t5.py#L374-L387
   * @param {string} text The text to encode.
   * @returns {string[]} The encoded tokens.
   */
  _encode_text(r) {
    if (r === null) return null;
    if (this.legacy || r.length === 0)
      return super._encode_text(r);
    let o = super._encode_text(SPIECE_UNDERLINE + r.replaceAll(SPIECE_UNDERLINE, " "));
    return o.length > 1 && o[0] === SPIECE_UNDERLINE && this.special_tokens.includes(o[1]) && (o = o.slice(1)), o;
  }
  get default_chat_template() {
    return super.default_chat_template.replaceAll("USE_DEFAULT_PROMPT", this.use_default_system_prompt ? "true" : "false").replaceAll("DEFAULT_SYSTEM_MESSAGE", this.DEFAULT_SYSTEM_PROMPT.replaceAll(`
`, "\\n").replaceAll("'", "\\'"));
  }
}
class CodeLlamaTokenizer extends LlamaTokenizer {
}
class XLMRobertaTokenizer extends PreTrainedTokenizer {
}
class MPNetTokenizer extends PreTrainedTokenizer {
}
class FalconTokenizer extends PreTrainedTokenizer {
}
class GPTNeoXTokenizer extends PreTrainedTokenizer {
}
class EsmTokenizer extends PreTrainedTokenizer {
}
class Qwen2Tokenizer extends PreTrainedTokenizer {
}
class GemmaTokenizer extends PreTrainedTokenizer {
  constructor() {
    super(...arguments);
    be(this, "_default_chat_template", `{% if messages[0]['role'] == 'system' %}{{ raise_exception('System role not supported') }}{% endif %}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if (message['role'] == 'assistant') %}{% set role = 'model' %}{% else %}{% set role = message['role'] %}{% endif %}{{ '<start_of_turn>' + role + '
' + message['content'] | trim + '<end_of_turn>
' }}{% endfor %}{% if add_generation_prompt %}{{'<start_of_turn>model
'}}{% endif %}`);
  }
}
class Grok1Tokenizer extends PreTrainedTokenizer {
}
function _build_translation_inputs(s, e, r, o) {
  if (!("language_codes" in s) || !Array.isArray(s.language_codes))
    throw new Error("Tokenizer must have `language_codes` attribute set and it should be an array of language ids.");
  if (!("languageRegex" in s) || !(s.languageRegex instanceof RegExp))
    throw new Error("Tokenizer must have `languageRegex` attribute set and it should be a regular expression.");
  if (!("lang_to_token" in s) || typeof s.lang_to_token != "function")
    throw new Error("Tokenizer must have `lang_to_token` attribute set and it should be a function.");
  const m = o.src_lang, _ = o.tgt_lang;
  if (!s.language_codes.includes(_))
    throw new Error(`Target language code "${_}" is not valid. Must be one of: {${s.language_codes.join(", ")}}`);
  if (m !== void 0) {
    if (!s.language_codes.includes(m))
      throw new Error(`Source language code "${m}" is not valid. Must be one of: {${s.language_codes.join(", ")}}`);
    for (const g of s.post_processor.config.single)
      if ("SpecialToken" in g && s.languageRegex.test(g.SpecialToken.id)) {
        g.SpecialToken.id = s.lang_to_token(m);
        break;
      }
  }
  return o.forced_bos_token_id = s.model.convert_tokens_to_ids([s.lang_to_token(_)])[0], s._call(e, r);
}
class NllbTokenizer extends PreTrainedTokenizer {
  constructor(e, r) {
    super(e, r), this.languageRegex = /^[a-z]{3}_[A-Z][a-z]{3}$/, this.language_codes = this.special_tokens.filter((o) => this.languageRegex.test(o)), this.lang_to_token = (o) => o;
  }
  /**
   * Helper function to build translation inputs for an `NllbTokenizer`.
   * @param {string|string[]} raw_inputs The text to tokenize.
   * @param {Object} tokenizer_options Options to be sent to the tokenizer
   * @param {Object} generate_kwargs Generation options.
   * @returns {Object} Object to be passed to the model.
   */
  _build_translation_inputs(e, r, o) {
    return _build_translation_inputs(this, e, r, o);
  }
}
class M2M100Tokenizer extends PreTrainedTokenizer {
  constructor(e, r) {
    super(e, r), this.languageRegex = /^__[a-z]{2,3}__$/, this.language_codes = this.special_tokens.filter((o) => this.languageRegex.test(o)).map((o) => o.slice(2, -2)), this.lang_to_token = (o) => `__${o}__`;
  }
  /**
   * Helper function to build translation inputs for an `M2M100Tokenizer`.
   * @param {string|string[]} raw_inputs The text to tokenize.
   * @param {Object} tokenizer_options Options to be sent to the tokenizer
   * @param {Object} generate_kwargs Generation options.
   * @returns {Object} Object to be passed to the model.
   */
  _build_translation_inputs(e, r, o) {
    return _build_translation_inputs(this, e, r, o);
  }
}
const WHISPER_LANGUAGES = [
  ["en", "english"],
  ["zh", "chinese"],
  ["de", "german"],
  ["es", "spanish"],
  ["ru", "russian"],
  ["ko", "korean"],
  ["fr", "french"],
  ["ja", "japanese"],
  ["pt", "portuguese"],
  ["tr", "turkish"],
  ["pl", "polish"],
  ["ca", "catalan"],
  ["nl", "dutch"],
  ["ar", "arabic"],
  ["sv", "swedish"],
  ["it", "italian"],
  ["id", "indonesian"],
  ["hi", "hindi"],
  ["fi", "finnish"],
  ["vi", "vietnamese"],
  ["he", "hebrew"],
  ["uk", "ukrainian"],
  ["el", "greek"],
  ["ms", "malay"],
  ["cs", "czech"],
  ["ro", "romanian"],
  ["da", "danish"],
  ["hu", "hungarian"],
  ["ta", "tamil"],
  ["no", "norwegian"],
  ["th", "thai"],
  ["ur", "urdu"],
  ["hr", "croatian"],
  ["bg", "bulgarian"],
  ["lt", "lithuanian"],
  ["la", "latin"],
  ["mi", "maori"],
  ["ml", "malayalam"],
  ["cy", "welsh"],
  ["sk", "slovak"],
  ["te", "telugu"],
  ["fa", "persian"],
  ["lv", "latvian"],
  ["bn", "bengali"],
  ["sr", "serbian"],
  ["az", "azerbaijani"],
  ["sl", "slovenian"],
  ["kn", "kannada"],
  ["et", "estonian"],
  ["mk", "macedonian"],
  ["br", "breton"],
  ["eu", "basque"],
  ["is", "icelandic"],
  ["hy", "armenian"],
  ["ne", "nepali"],
  ["mn", "mongolian"],
  ["bs", "bosnian"],
  ["kk", "kazakh"],
  ["sq", "albanian"],
  ["sw", "swahili"],
  ["gl", "galician"],
  ["mr", "marathi"],
  ["pa", "punjabi"],
  ["si", "sinhala"],
  ["km", "khmer"],
  ["sn", "shona"],
  ["yo", "yoruba"],
  ["so", "somali"],
  ["af", "afrikaans"],
  ["oc", "occitan"],
  ["ka", "georgian"],
  ["be", "belarusian"],
  ["tg", "tajik"],
  ["sd", "sindhi"],
  ["gu", "gujarati"],
  ["am", "amharic"],
  ["yi", "yiddish"],
  ["lo", "lao"],
  ["uz", "uzbek"],
  ["fo", "faroese"],
  ["ht", "haitian creole"],
  ["ps", "pashto"],
  ["tk", "turkmen"],
  ["nn", "nynorsk"],
  ["mt", "maltese"],
  ["sa", "sanskrit"],
  ["lb", "luxembourgish"],
  ["my", "myanmar"],
  ["bo", "tibetan"],
  ["tl", "tagalog"],
  ["mg", "malagasy"],
  ["as", "assamese"],
  ["tt", "tatar"],
  ["haw", "hawaiian"],
  ["ln", "lingala"],
  ["ha", "hausa"],
  ["ba", "bashkir"],
  ["jw", "javanese"],
  ["su", "sundanese"]
], WHISPER_LANGUAGE_MAPPING = new Map(WHISPER_LANGUAGES), WHISPER_TO_LANGUAGE_CODE_MAPPING = new Map([
  ...WHISPER_LANGUAGES.map(([s, e]) => [e, s]),
  ["burmese", "my"],
  ["valencian", "ca"],
  ["flemish", "nl"],
  ["haitian", "ht"],
  ["letzeburgesch", "lb"],
  ["pushto", "ps"],
  ["panjabi", "pa"],
  ["moldavian", "ro"],
  ["moldovan", "ro"],
  ["sinhalese", "si"],
  ["castilian", "es"]
]);
class WhisperTokenizer extends PreTrainedTokenizer {
  constructor() {
    super(...arguments);
    be(this, "_default_chat_template", '{% for message in messages %}" "{{ message.content }}{{ eos_token }}" "{% endfor %}');
  }
  /**
   * Decodes automatic speech recognition (ASR) sequences.
   * @param {Array<{tokens: number[], token_timestamps?: number[], stride: number[]}>} sequences The sequences to decode.
   * @param {Object} options The options to use for decoding.
   * @returns {Array<string|{chunks?: undefined|Array<{language: string|null, timestamp: Array<number|null>, text: string}>}>} The decoded sequences.
   */
  _decode_asr(r, {
    return_timestamps: o = !1,
    return_language: m = !1,
    time_precision: _ = null,
    force_full_sequences: g = !0
  } = {}) {
    if (_ === null)
      throw Error("Must specify time_precision");
    let y = null;
    const E = o === "word";
    function x() {
      return { language: y, timestamp: [null, null], text: "" };
    }
    const v = [];
    let h = x(), a = 0;
    const b = this.model.convert_tokens_to_ids(["<|notimestamps|>"])[0] + 1;
    let w = [], k = [], A = !1, M = null;
    const $ = new Set(this.all_special_ids);
    for (const P of r) {
      const I = P.tokens, N = E ? P.token_timestamps : null;
      let R = null, F = b;
      if ("stride" in P) {
        const [Q, ee, Y] = P.stride;
        if (a -= ee, M = Q - Y, ee && (F = ee / _ + b), Y)
          for (let W = I.length - 1; W >= 0; --W) {
            const j = I[W];
            if (j >= b) {
              if (R !== null && (j - b) * _ < M)
                break;
              R = j;
            }
          }
      }
      let B = [], G = [];
      for (let Q = 0; Q < I.length; ++Q) {
        const ee = I[Q];
        if ($.has(ee)) {
          const Y = this.decode([ee]), W = WHISPER_LANGUAGE_MAPPING.get(Y.slice(2, -2));
          if (W !== void 0) {
            if (y !== null && W !== y && !o) {
              w.push(B);
              const j = this.findLongestCommonSequence(w)[0], J = this.decode(j);
              h.text = J, v.push(h), w = [], B = [], h = x();
            }
            y = h.language = W;
          }
        } else if (ee >= b) {
          const Y = (ee - b) * _ + a, W = round(Y, 2);
          if (R !== null && ee >= R)
            A = !0;
          else if (A || w.length > 0 && ee < F)
            A = !1;
          else if (h.timestamp[0] === null)
            h.timestamp[0] = W;
          else if (W !== h.timestamp[0]) {
            h.timestamp[1] = W, w.push(B), E && k.push(G);
            const [j, J] = this.findLongestCommonSequence(
              w,
              k
            ), me = this.decode(j);
            h.text = me, E && (h.words = this.collateWordTimestamps(
              j,
              J,
              y
            )), v.push(h), w = [], B = [], k = [], G = [], h = x();
          }
        } else if (B.push(ee), E) {
          let Y = round(N[Q] + a, 2), W;
          Q + 1 < N.length ? W = round(N[Q + 1] + a, 2) : W = null, G.push([Y, W]);
        }
      }
      if ("stride" in P) {
        const [Q, ee, Y] = P.stride;
        a += Q - Y;
      }
      B.length > 0 ? (w.push(B), E && k.push(G)) : w.every((Q) => Q.length === 0) && (h = x(), w = [], B = [], k = [], G = []);
    }
    if (w.length > 0) {
      if (g && o)
        throw new Error(
          "Whisper did not predict an ending timestamp, which can happen if audio is cut off in the middle of a word. Also make sure WhisperTimeStampLogitsProcessor was used during generation."
        );
      const [P, I] = this.findLongestCommonSequence(w, k), N = this.decode(P);
      h.text = N, E && (h.words = this.collateWordTimestamps(
        P,
        I,
        y
      )), v.push(h);
    }
    let O = /* @__PURE__ */ Object.create(null);
    const C = v.map((P) => P.text).join("");
    if (o || m) {
      for (let P = 0; P < v.length; ++P) {
        const I = v[P];
        o || delete I.timestamp, m || delete I.language;
      }
      if (E) {
        const P = [];
        for (const I of v)
          for (const N of I.words)
            P.push(N);
        O = { chunks: P };
      } else
        O = { chunks: v };
    }
    return [C, O];
  }
  /**
   * Finds the longest common sequence among the provided sequences.
   * @param {number[][]} sequences An array of sequences of token ids to compare.
   * @returns {number[][]} The longest common sequence found.
   * @throws {Error} If there is a bug within the function.
   * @private
   */
  findLongestCommonSequence(r, o = null) {
    let m = r[0], _ = m.length, g = [];
    const y = Array.isArray(o) && o.length > 0;
    let E = y ? [] : null, x = y ? o[0] : null;
    for (let v = 1; v < r.length; ++v) {
      const h = r[v];
      let a = 0, b = [_, _, 0, 0];
      const w = h.length;
      for (let P = 1; P < _ + w; ++P) {
        const I = P / 1e4, N = Math.max(0, _ - P), R = Math.min(_, _ + w - P), F = m.slice(N, R), B = Math.max(0, P - _), G = Math.min(w, P), Q = h.slice(B, G);
        if (F.length !== Q.length)
          throw new Error("There is a bug within whisper `decode_asr` function, please report it. Dropping to prevent bad inference.");
        const ee = F.filter((W, j) => W === Q[j]).length, Y = ee / P + I;
        ee > 1 && Y > a && (a = Y, b = [N, R, B, G]);
      }
      const [k, A, M, $] = b, O = Math.floor((A + k) / 2), C = Math.floor(($ + M) / 2);
      g.push(...m.slice(0, O)), m = h.slice(C), _ = m.length, y && (E.push(...x.slice(0, O)), x = o[v].slice(C));
    }
    return g.push(...m), y ? (E.push(...x), [g, E]) : [g, []];
  }
  /** @private */
  collateWordTimestamps(r, o, m) {
    const [_, g, y] = this.combineTokensIntoWords(r, m), E = [];
    for (let x = 0; x < _.length; ++x) {
      const v = y[x];
      E.push({
        text: _[x],
        timestamp: [
          o[v.at(0)][0],
          o[v.at(-1)][1]
        ]
      });
    }
    return E;
  }
  /**
   * Groups tokens by word. Returns a tuple containing a list of strings with the words,
   * and a list of `token_id` sequences with the tokens making up each word.
   * @param {number[]} tokens 
   * @param {string} [language] 
   * @param {string} prepend_punctionations 
   * @param {string} append_punctuations 
   * 
   * @private
   */
  combineTokensIntoWords(r, o, m = `"'“¡¿([{-`, _ = `"'.。,，!！?？:：”)]}、`) {
    o = o ?? "english";
    let g, y, E;
    return ["chinese", "japanese", "thai", "lao", "myanmar"].includes(o) ? [g, y, E] = this.splitTokensOnUnicode(r) : [g, y, E] = this.splitTokensOnSpaces(r), this.mergePunctuations(g, y, E, m, _);
  }
  /** @type {PreTrainedTokenizer['decode']} */
  decode(r, o) {
    let m;
    return o && o.decode_with_timestamps ? (r instanceof Tensor && (r = prepareTensorForDecode(r)), m = this.decodeWithTimestamps(r, o)) : m = super.decode(r, o), m;
  }
  /**
   * @param {number[]} token_ids List of token IDs to decode.
   * @param {Object} decode_args Optional arguments for decoding
   * @private
   */
  decodeWithTimestamps(r, o) {
    const m = (o == null ? void 0 : o.time_precision) ?? 0.02, _ = Array.from(this.all_special_ids).at(-1) + 1;
    let g = [[]];
    for (const y of r)
      if (y >= _) {
        const E = round((y - _) * m, 2);
        g.push(`<|${E}|>`), g.push([]);
      } else
        g[g.length - 1].push(y);
    return g = g.map(
      (y) => typeof y == "string" ? y : super.decode(y, o)
    ), g.join("");
  }
  /**
   * Combine tokens into words by splitting at any position where the tokens are decoded as valid unicode points.
   * @param {number[]} tokens 
   * @returns {*}
   * @private
   */
  splitTokensOnUnicode(r) {
    const o = this.decode(r, {
      // @ts-ignore
      decode_with_timestamps: !0
    }), m = "�", _ = [], g = [], y = [];
    let E = [], x = [], v = 0;
    for (let h = 0; h < r.length; ++h) {
      const a = r[h];
      E.push(a), x.push(h);
      const b = this.decode(E, {
        // @ts-ignore
        decode_with_timestamps: !0
      });
      (!b.includes(m) || o[v + b.indexOf(m)] === m) && (_.push(b), g.push(E), y.push(x), E = [], x = [], v += b.length);
    }
    return [_, g, y];
  }
  /**
   * Combine tokens into words by splitting at whitespace and punctuation tokens.
   * @param {number[]} tokens 
   * @private
   */
  splitTokensOnSpaces(r) {
    const [o, m, _] = this.splitTokensOnUnicode(r), g = [], y = [], E = [], x = new RegExp(`^[${PUNCTUATION_REGEX}]$`, "gu");
    for (let v = 0; v < o.length; ++v) {
      const h = o[v], a = m[v], b = _[v], w = a[0] >= this.model.tokens_to_ids.get("<|endoftext|>"), k = h.startsWith(" "), A = h.trim(), M = x.test(A);
      if (w || k || M || g.length === 0)
        g.push(h), y.push(a), E.push(b);
      else {
        const $ = g.length - 1;
        g[$] += h, y[$].push(...a), E[$].push(...b);
      }
    }
    return [g, y, E];
  }
  /**
   * Merges punctuation tokens with neighboring words.
   * @param {string[]} words 
   * @param {number[][]} tokens 
   * @param {number[][]} indices 
   * @param {string} prepended 
   * @param {string} appended 
   * @private
   */
  mergePunctuations(r, o, m, _, g) {
    const y = structuredClone(r), E = structuredClone(o), x = structuredClone(m);
    let v = y.length - 2, h = y.length - 1;
    for (; v >= 0; )
      y[v].startsWith(" ") && _.includes(y[v].trim()) ? (y[h] = y[v] + y[h], E[h] = mergeArrays(E[v], E[h]), x[h] = mergeArrays(x[v], x[h]), y[v] = "", E[v] = [], x[v] = []) : h = v, --v;
    for (v = 0, h = 1; h < y.length; )
      !y[v].endsWith(" ") && g.includes(y[h]) ? (y[v] += y[h], E[v] = mergeArrays(E[v], E[h]), x[v] = mergeArrays(x[v], x[h]), y[h] = "", E[h] = [], x[h] = []) : v = h, ++h;
    return [
      y.filter((a) => a),
      E.filter((a) => a.length > 0),
      x.filter((a) => a.length > 0)
    ];
  }
  /**
   * Helper function to build translation inputs for a `WhisperTokenizer`,
   * depending on the language, task, and whether to predict timestamp tokens.
   * 
   * Used to override the prefix tokens appended to the start of the label sequence.
   * 
   * **Example: Get ids for a language**
   * ```javascript
   * // instantiate the tokenizer and set the prefix token to Spanish
   * const tokenizer = await WhisperTokenizer.from_pretrained('Xenova/whisper-tiny');
   * const forced_decoder_ids = tokenizer.get_decoder_prompt_ids({ language: 'spanish' });
   * // [(1, 50262), (2, 50363)]
   * ```
   * 
   * @param {Object} options Options to generate the decoder prompt.
   * @param {string} [options.language] The language of the transcription text.
   * The corresponding language id token is appended to the start of the sequence for multilingual
   * speech recognition and speech translation tasks, e.g. for "Spanish" the token "<|es|>" is appended
   * to the start of sequence.
   * @param {string} [options.task] Task identifier to append at the start of sequence (if any).
   * This should be used for mulitlingual fine-tuning, with "transcribe" for speech recognition and
   * "translate" for speech translation.
   * @param {boolean} [options.no_timestamps] Whether to add the <|notimestamps|> token at the start of the sequence.
   * @returns {number[][]} The decoder prompt ids.
   */
  get_decoder_prompt_ids({
    language: r = null,
    task: o = null,
    no_timestamps: m = !0
  } = {}) {
    const _ = [];
    if (r) {
      r = r.toLowerCase();
      let g = WHISPER_TO_LANGUAGE_CODE_MAPPING.get(r);
      if (g === void 0)
        if (WHISPER_LANGUAGE_MAPPING.has(r))
          g = r;
        else {
          const x = r.length === 2 ? WHISPER_LANGUAGE_MAPPING.keys() : WHISPER_LANGUAGE_MAPPING.values();
          throw new Error(`Language "${r}" is not supported. Must be one of: ${JSON.stringify(x)}`);
        }
      const y = this.model.tokens_to_ids.get(`<|${g}|>`);
      if (y === void 0)
        throw new Error(`Unable to find language "${g}" in model vocabulary. Please report this issue at https://github.com/xenova/transformers.js/issues/new/choose.`);
      _.push(y);
    } else
      _.push(null);
    if (o) {
      if (o = o.toLowerCase(), o !== "transcribe" && o !== "translate")
        throw new Error(`Task "${o}" is not supported. Must be one of: ["transcribe", "translate"]`);
      const g = this.model.tokens_to_ids.get(`<|${o}|>`);
      if (g === void 0)
        throw new Error(`Unable to find task "${o}" in model vocabulary. Please report this issue at https://github.com/xenova/transformers.js/issues/new/choose.`);
      _.push(g);
    } else
      _.push(null);
    if (m) {
      const g = this.model.tokens_to_ids.get("<|notimestamps|>");
      if (g === void 0)
        throw new Error('Unable to find "<|notimestamps|>" in model vocabulary. Please report this issue at https://github.com/xenova/transformers.js/issues/new/choose.');
      _.push(g);
    }
    return _.map((g, y) => [y + 1, g]).filter((g) => g[1] !== null);
  }
}
class CodeGenTokenizer extends PreTrainedTokenizer {
}
class CLIPTokenizer extends PreTrainedTokenizer {
}
class SiglipTokenizer extends PreTrainedTokenizer {
}
class MarianTokenizer extends PreTrainedTokenizer {
  /**
   * Create a new MarianTokenizer instance.
   * @param {Object} tokenizerJSON The JSON of the tokenizer.
   * @param {Object} tokenizerConfig The config of the tokenizer.
   */
  constructor(e, r) {
    super(e, r), this.languageRegex = /^(>>\w+<<)\s*/g, this.supported_language_codes = this.model.vocab.filter(
      (o) => this.languageRegex.test(o)
    ), console.warn('WARNING: `MarianTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.');
  }
  /**
   * Encodes a single text. Overriding this method is necessary since the language codes
   * must be removed before encoding with sentencepiece model.
   * @see https://github.com/huggingface/transformers/blob/12d51db243a00726a548a43cc333390ebae731e3/src/transformers/models/marian/tokenization_marian.py#L204-L213
   *
   * @param {string|null} text The text to encode.
   * @returns {Array} The encoded tokens.
   */
  _encode_text(e) {
    if (e === null) return null;
    const [r, ...o] = e.trim().split(this.languageRegex);
    if (o.length === 0)
      return super._encode_text(r);
    if (o.length === 2) {
      const [m, _] = o;
      return this.supported_language_codes.includes(m) || console.warn(`Unsupported language code "${m}" detected, which may lead to unexpected behavior. Should be one of: ${JSON.stringify(this.supported_language_codes)}`), mergeArrays([m], super._encode_text(_));
    }
  }
}
class Wav2Vec2CTCTokenizer extends PreTrainedTokenizer {
}
class BlenderbotTokenizer extends PreTrainedTokenizer {
  constructor() {
    super(...arguments);
    be(this, "_default_chat_template", "{% for message in messages %}{% if message['role'] == 'user' %}{{ ' ' }}{% endif %}{{ message['content'] }}{% if not loop.last %}{{ '  ' }}{% endif %}{% endfor %}{{ eos_token }}");
  }
}
class BlenderbotSmallTokenizer extends BlenderbotTokenizer {
}
class SpeechT5Tokenizer extends PreTrainedTokenizer {
}
class NougatTokenizer extends PreTrainedTokenizer {
}
class VitsTokenizer extends PreTrainedTokenizer {
  constructor(e, r) {
    super(e, r), this.decoder = new VitsDecoder({});
  }
}
class CohereTokenizer extends PreTrainedTokenizer {
}
class AutoTokenizer {
  /**
   * Instantiate one of the tokenizer classes of the library from a pretrained model.
   * 
   * The tokenizer class to instantiate is selected based on the `tokenizer_class` property of the config object
   * (either passed as an argument or loaded from `pretrained_model_name_or_path` if possible)
   * 
   * @param {string} pretrained_model_name_or_path The name or path of the pretrained model. Can be either:
   * - A string, the *model id* of a pretrained tokenizer hosted inside a model repo on huggingface.co.
   *   Valid model ids can be located at the root-level, like `bert-base-uncased`, or namespaced under a
   *   user or organization name, like `dbmdz/bert-base-german-cased`.
   * - A path to a *directory* containing tokenizer files, e.g., `./my_model_directory/`.
   * @param {PretrainedTokenizerOptions} options Additional options for loading the tokenizer.
   * 
   * @returns {Promise<PreTrainedTokenizer>} A new instance of the PreTrainedTokenizer class.
   */
  static async from_pretrained(e, {
    quantized: r = !0,
    progress_callback: o = null,
    config: m = null,
    cache_dir: _ = null,
    local_files_only: g = !1,
    revision: y = "main",
    legacy: E = null
  } = {}) {
    var b;
    const [x, v] = await loadTokenizer(e, {
      progress_callback: o,
      cache_dir: _,
      local_files_only: g,
      revision: y,
      legacy: E
    }), h = ((b = v.tokenizer_class) == null ? void 0 : b.replace(/Fast$/, "")) ?? "PreTrainedTokenizer";
    let a = this.TOKENIZER_CLASS_MAPPING[h];
    return a || (console.warn(`Unknown tokenizer class "${h}", attempting to construct from base class.`), a = PreTrainedTokenizer), new a(x, v);
  }
}
be(AutoTokenizer, "TOKENIZER_CLASS_MAPPING", {
  T5Tokenizer,
  DistilBertTokenizer,
  CamembertTokenizer,
  DebertaTokenizer,
  DebertaV2Tokenizer,
  BertTokenizer,
  HerbertTokenizer,
  ConvBertTokenizer,
  RoFormerTokenizer,
  XLMTokenizer,
  ElectraTokenizer,
  MobileBertTokenizer,
  SqueezeBertTokenizer,
  AlbertTokenizer,
  GPT2Tokenizer,
  BartTokenizer,
  MBartTokenizer,
  MBart50Tokenizer,
  RobertaTokenizer,
  WhisperTokenizer,
  CodeGenTokenizer,
  CLIPTokenizer,
  SiglipTokenizer,
  MarianTokenizer,
  BloomTokenizer,
  NllbTokenizer,
  M2M100Tokenizer,
  LlamaTokenizer,
  CodeLlamaTokenizer,
  XLMRobertaTokenizer,
  MPNetTokenizer,
  FalconTokenizer,
  GPTNeoXTokenizer,
  EsmTokenizer,
  Wav2Vec2CTCTokenizer,
  BlenderbotTokenizer,
  BlenderbotSmallTokenizer,
  SpeechT5Tokenizer,
  NougatTokenizer,
  VitsTokenizer,
  Qwen2Tokenizer,
  GemmaTokenizer,
  Grok1Tokenizer,
  CohereTokenizer,
  // Base case:
  PreTrainedTokenizer
});
async function loadConfig(s, e) {
  return await getModelJSON(s, "config.json", !0, e);
}
class PretrainedConfig {
  // NOTE: Typo in original
  /**
   * Create a new PreTrainedTokenizer instance.
   * @param {Object} configJSON The JSON of the config.
   */
  constructor(e) {
    this.model_type = null, this.is_encoder_decoder = !1, Object.assign(this, e);
  }
  /**
   * Loads a pre-trained config from the given `pretrained_model_name_or_path`. 
   * 
   * @param {string} pretrained_model_name_or_path The path to the pre-trained config.
   * @param {PretrainedOptions} options Additional options for loading the config.
   * @throws {Error} Throws an error if the config.json is not found in the `pretrained_model_name_or_path`.
   * 
   * @returns {Promise<PretrainedConfig>} A new instance of the `PretrainedConfig` class.
   */
  static async from_pretrained(e, {
    progress_callback: r = null,
    config: o = null,
    cache_dir: m = null,
    local_files_only: _ = !1,
    revision: g = "main"
  } = {}) {
    let y = o ?? await loadConfig(e, {
      progress_callback: r,
      cache_dir: m,
      local_files_only: _,
      revision: g
    });
    return new this(y);
  }
}
class AutoConfig {
  /** @type {PretrainedConfig.from_pretrained} */
  static async from_pretrained(...e) {
    return PretrainedConfig.from_pretrained(...e);
  }
}
class LogitsProcessorList extends Callable {
  /**
   * Constructs a new instance of `LogitsProcessorList`.
   */
  constructor() {
    super(), this.processors = [];
  }
  /**
   * Adds a new logits processor to the list.
   *
   * @param {LogitsProcessor} item The logits processor function to add.
   */
  push(e) {
    this.processors.push(e);
  }
  /**
   * Adds multiple logits processors to the list.
   *
   * @param {LogitsProcessor[]} items The logits processor functions to add.
   */
  extend(e) {
    this.processors.push(...e);
  }
  /**
   * Applies all logits processors in the list to a batch of logits, modifying them in-place.
   *
   * @param {number[]} input_ids The input IDs for the language model.
   * @param {number[][]} batchedLogits A 2D array of logits, where each row corresponds to a single
   *                                                input sequence in the batch.
   */
  _call(e, r) {
    for (let o of r)
      this.processors.forEach(
        (m) => m(e, o)
      );
  }
  [Symbol.iterator]() {
    return this.processors.values();
  }
}
class LogitsProcessor extends Callable {
  /**
   * Apply the processor to the input logits.
   *
   * @abstract
   * @param {Array} input_ids The input ids.
   * @param {Tensor} logits The logits to process.
   * @throws {Error} Throws an error if `_call` is not implemented in the subclass.
   */
  _call(e, r) {
    throw Error("`_call` should be implemented in a subclass");
  }
}
class ForceTokensLogitsProcessor extends LogitsProcessor {
  /**
   * Constructs a new instance of `ForceTokensLogitsProcessor`.
   * 
   * @param {Array} forced_decoder_ids The ids of tokens that should be forced.
   */
  constructor(e) {
    super(), this.force_token_map = Object.fromEntries(e ?? []);
  }
  /**
   * Apply the processor to the input logits.
   *
   * @param {Array} input_ids The input ids.
   * @param {Tensor} logits The logits to process.
   * @returns {Tensor} The processed logits.
   */
  _call(e, r) {
    let o = this.force_token_map[e.length];
    return exists(o) && (r.data.fill(-1 / 0), r.data[o] = 0), r;
  }
}
class ForcedBOSTokenLogitsProcessor extends LogitsProcessor {
  /**
   * Create a ForcedBOSTokenLogitsProcessor.
   * @param {number} bos_token_id The ID of the beginning-of-sequence token to be forced.
   */
  constructor(e) {
    super(), this.bos_token_id = e;
  }
  /**
   * Apply the BOS token forcing to the logits.
   * @param {Array} input_ids The input IDs.
   * @param {Object} logits The logits.
   * @returns {Object} The logits with BOS token forcing.
   */
  _call(e, r) {
    return e.length === 1 && (r.data.fill(-1 / 0), r.data[this.bos_token_id] = 0), r;
  }
}
class ForcedEOSTokenLogitsProcessor extends LogitsProcessor {
  /**
   * Create a ForcedEOSTokenLogitsProcessor.
   * @param {number} max_length Max length of the sequence.
   * @param {number|number[]} forced_eos_token_id The ID of the end-of-sequence token to be forced.
   */
  constructor(e, r) {
    super(), this.max_length = e, this.forced_eos_token_id = r;
  }
  /**
   * Apply the processor to input_ids and logits.
   * 
   * @param {number[]} input_ids The input ids.
   * @param {Tensor} logits The logits tensor.
   */
  _call(e, r) {
  }
}
class SuppressTokensAtBeginLogitsProcessor extends LogitsProcessor {
  /**
   * Create a SuppressTokensAtBeginLogitsProcessor.
   * @param {number[]} begin_suppress_tokens The IDs of the tokens to suppress.
   * @param {number} begin_index The number of tokens to generate before suppressing tokens.
   */
  constructor(e, r) {
    super(), this.begin_suppress_tokens = e, this.begin_index = r;
  }
  /**
   * Apply the BOS token forcing to the logits.
   * @param {Array} input_ids The input IDs.
   * @param {Object} logits The logits.
   * @returns {Object} The logits with BOS token forcing.
   */
  _call(e, r) {
    if (e.length === this.begin_index)
      for (let o of this.begin_suppress_tokens)
        r.data[o] = -1 / 0;
    return r;
  }
}
class WhisperTimeStampLogitsProcessor extends LogitsProcessor {
  /**
   * Constructs a new WhisperTimeStampLogitsProcessor.
   * @param {Object} generate_config The config object passed to the `generate()` method of a transformer model.
   * @param {number} generate_config.eos_token_id The ID of the end-of-sequence token.
   * @param {number} generate_config.no_timestamps_token_id The ID of the token used to indicate that a token should not have a timestamp.
   * @param {number[][]} [generate_config.forced_decoder_ids] An array of two-element arrays representing decoder IDs that are forced to appear in the output. The second element of each array indicates whether the token is a timestamp.
   * @param {number} [generate_config.max_initial_timestamp_index] The maximum index at which an initial timestamp can appear.
   */
  constructor(e) {
    super(), this.eos_token_id = e.eos_token_id, this.no_timestamps_token_id = e.no_timestamps_token_id, this.timestamp_begin = this.no_timestamps_token_id + 1, this.begin_index = (e.forced_decoder_ids || []).length + 2, e.forced_decoder_ids.slice(-1)[0][1] === this.no_timestamps_token_id && (this.begin_index -= 1), this.max_initial_timestamp_index = e.max_initial_timestamp_index;
  }
  /**
   * Modify the logits to handle timestamp tokens.
   * @param {Array} input_ids The input sequence of tokens.
   * @param {Tensor} logits The logits output by the model.
   * @returns {Tensor} The modified logits.
   */
  _call(e, r) {
    const o = (
      /** @type {Float32Array} */
      r.data
    );
    if (o[this.no_timestamps_token_id] = -1 / 0, e.length === this.begin_index - 1)
      return o.fill(-1 / 0), o[this.timestamp_begin] = 0, r;
    const m = e.slice(this.begin_index), _ = m.length >= 1 && m[m.length - 1] >= this.timestamp_begin, g = m.length < 2 || m[m.length - 2] >= this.timestamp_begin;
    if (_ && (g ? o.subarray(this.timestamp_begin).fill(-1 / 0) : o.subarray(0, this.eos_token_id).fill(-1 / 0)), e.length === this.begin_index && this.max_initial_timestamp_index !== null) {
      const v = this.timestamp_begin + this.max_initial_timestamp_index;
      o.subarray(v + 1).fill(-1 / 0);
    }
    const y = log_softmax(o), E = Math.log(y.subarray(this.timestamp_begin).map(Math.exp).reduce((v, h) => v + h)), x = max(y.subarray(0, this.timestamp_begin))[0];
    return E > x && o.subarray(0, this.timestamp_begin).fill(-1 / 0), r;
  }
}
class NoRepeatNGramLogitsProcessor extends LogitsProcessor {
  /**
   * Create a NoRepeatNGramLogitsProcessor.
   * @param {number} no_repeat_ngram_size The no-repeat-ngram size. All ngrams of this size can only occur once.
   */
  constructor(e) {
    super(), this.no_repeat_ngram_size = e;
  }
  /**
   * Generate n-grams from a sequence of token ids.
   * @param {number[]} prevInputIds List of previous input ids
   * @returns {Map<string, number[]>} Map of generated n-grams
   */
  getNgrams(e) {
    const r = e.length, o = [];
    for (let _ = 0; _ < r + 1 - this.no_repeat_ngram_size; ++_) {
      const g = [];
      for (let y = 0; y < this.no_repeat_ngram_size; ++y)
        g.push(e[_ + y]);
      o.push(g);
    }
    const m = /* @__PURE__ */ new Map();
    for (const _ of o) {
      const g = _.slice(0, _.length - 1), y = JSON.stringify(g), E = m.get(y) ?? [];
      E.push(_[_.length - 1]), m.set(y, E);
    }
    return m;
  }
  /**
   * Generate n-grams from a sequence of token ids.
   * @param {Map<string, number[]>} bannedNgrams Map of banned n-grams
   * @param {number[]} prevInputIds List of previous input ids
   * @returns {number[]} Map of generated n-grams
   */
  getGeneratedNgrams(e, r) {
    const o = r.slice(r.length + 1 - this.no_repeat_ngram_size, r.length);
    return e.get(JSON.stringify(o)) ?? [];
  }
  /**
   * Calculate banned n-gram tokens
   * @param {number[]} prevInputIds List of previous input ids
   * @returns {number[]} Map of generated n-grams
   */
  calcBannedNgramTokens(e) {
    const r = [];
    if (e.length + 1 < this.no_repeat_ngram_size)
      return r;
    {
      const o = this.getNgrams(e);
      return this.getGeneratedNgrams(o, e);
    }
  }
  /**
   * Apply the no-repeat-ngram processor to the logits.
   * @param {Array} input_ids The input IDs.
   * @param {Object} logits The logits.
   * @returns {Object} The logits with no-repeat-ngram processing.
   */
  _call(e, r) {
    const o = this.calcBannedNgramTokens(e);
    for (const m of o)
      r.data[m] = -1 / 0;
    return r;
  }
}
class RepetitionPenaltyLogitsProcessor extends LogitsProcessor {
  /**
   * Create a RepetitionPenaltyLogitsProcessor.
   * @param {number} penalty The penalty to apply for repeated tokens.
   */
  constructor(e) {
    super(), this.penalty = e;
  }
  /**
   * Apply the repetition penalty to the logits.
   * @param {Array} input_ids The input IDs.
   * @param {Object} logits The logits.
   * @returns {Object} The logits with repetition penalty processing.
   */
  _call(e, r) {
    for (const o of e)
      r.data[o] < 0 ? r.data[o] *= this.penalty : r.data[o] /= this.penalty;
    return r;
  }
}
class MinLengthLogitsProcessor extends LogitsProcessor {
  /**
   * Create a MinLengthLogitsProcessor.
   * @param {number} min_length The minimum length below which the score of `eos_token_id` is set to negative infinity.
   * @param {number|number[]} eos_token_id The ID/IDs of the end-of-sequence token.
   */
  constructor(e, r) {
    super(), this.min_length = e, this.eos_token_id = Array.isArray(r) ? r : [r];
  }
  /**
   * Apply logit processor.
   * @param {Array} input_ids The input IDs.
   * @param {Object} logits The logits.
   * @returns {Object} The processed logits.
   */
  _call(e, r) {
    if (e.length < this.min_length)
      for (const o of this.eos_token_id)
        r.data[o] = -1 / 0;
    return r;
  }
}
class MinNewTokensLengthLogitsProcessor extends LogitsProcessor {
  /**
   * Create a MinNewTokensLengthLogitsProcessor.
   * @param {number} prompt_length_to_skip The input tokens length.
   * @param {number} min_new_tokens The minimum *new* tokens length below which the score of `eos_token_id` is set to negative infinity.
   * @param {number|number[]} eos_token_id The ID/IDs of the end-of-sequence token.
   */
  constructor(e, r, o) {
    super(), this.prompt_length_to_skip = e, this.min_new_tokens = r, this.eos_token_id = Array.isArray(o) ? o : [o];
  }
  /**
   * Apply logit processor.
   * @param {Array} input_ids The input IDs.
   * @param {Object} logits The logits.
   * @returns {Object} The processed logits.
   */
  _call(e, r) {
    if (e.length - this.prompt_length_to_skip < this.min_new_tokens)
      for (const m of this.eos_token_id)
        r.data[m] = -1 / 0;
    return r;
  }
}
class NoBadWordsLogitsProcessor extends LogitsProcessor {
  /**
   * Create a `NoBadWordsLogitsProcessor`.
   * @param {number[][]} bad_words_ids List of list of token ids that are not allowed to be generated.
   * @param {number|number[]} eos_token_id The id of the *end-of-sequence* token. Optionally, use a list to set multiple *end-of-sequence* tokens.
   */
  constructor(e, r) {
    super(), this.bad_words_ids = e, this.eos_token_id = Array.isArray(r) ? r : [r];
  }
  /**
   * Apply logit processor.
   * @param {Array} input_ids The input IDs.
   * @param {Object} logits The logits.
   * @returns {Object} The processed logits.
   */
  _call(e, r) {
    for (const o of this.bad_words_ids) {
      let m = !0;
      for (let _ = 1; _ <= o.length - 1 && o.length < e.length; ++_)
        if (o.at(-_ - 1) !== e.at(-_)) {
          m = !1;
          break;
        }
      m && (r.data[o.at(-1)] = -1 / 0);
    }
    return r;
  }
}
const GenerationConfig = (
  /** @type {any} */
  class {
    /**
     * Create a new GenerationConfig object.
     * @param {GenerationConfigType} kwargs 
     */
    constructor(s = {}) {
      this.max_length = s.max_length ?? 20, this.max_new_tokens = s.max_new_tokens ?? null, this.min_length = s.min_length ?? 0, this.min_new_tokens = s.min_new_tokens ?? null, this.early_stopping = s.early_stopping ?? !1, this.max_time = s.max_time ?? null, this.do_sample = s.do_sample ?? !1, this.num_beams = s.num_beams ?? 1, this.num_beam_groups = s.num_beam_groups ?? 1, this.penalty_alpha = s.penalty_alpha ?? null, this.use_cache = s.use_cache ?? !0, this.temperature = s.temperature ?? 1, this.top_k = s.top_k ?? 50, this.top_p = s.top_p ?? 1, this.typical_p = s.typical_p ?? 1, this.epsilon_cutoff = s.epsilon_cutoff ?? 0, this.eta_cutoff = s.eta_cutoff ?? 0, this.diversity_penalty = s.diversity_penalty ?? 0, this.repetition_penalty = s.repetition_penalty ?? 1, this.encoder_repetition_penalty = s.encoder_repetition_penalty ?? 1, this.length_penalty = s.length_penalty ?? 1, this.no_repeat_ngram_size = s.no_repeat_ngram_size ?? 0, this.bad_words_ids = s.bad_words_ids ?? null, this.force_words_ids = s.force_words_ids ?? null, this.renormalize_logits = s.renormalize_logits ?? !1, this.constraints = s.constraints ?? null, this.forced_bos_token_id = s.forced_bos_token_id ?? null, this.forced_eos_token_id = s.forced_eos_token_id ?? null, this.remove_invalid_values = s.remove_invalid_values ?? !1, this.exponential_decay_length_penalty = s.exponential_decay_length_penalty ?? null, this.suppress_tokens = s.suppress_tokens ?? null, this.begin_suppress_tokens = s.begin_suppress_tokens ?? null, this.forced_decoder_ids = s.forced_decoder_ids ?? null, this.num_return_sequences = s.num_return_sequences ?? 1, this.output_attentions = s.output_attentions ?? !1, this.output_hidden_states = s.output_hidden_states ?? !1, this.output_scores = s.output_scores ?? !1, this.return_dict_in_generate = s.return_dict_in_generate ?? !1, this.pad_token_id = s.pad_token_id ?? null, this.bos_token_id = s.bos_token_id ?? null, this.eos_token_id = s.eos_token_id ?? null, this.encoder_no_repeat_ngram_size = s.encoder_no_repeat_ngram_size ?? 0, this.decoder_start_token_id = s.decoder_start_token_id ?? null, this.generation_kwargs = s.generation_kwargs ?? {};
    }
  }
);
class Sampler extends Callable {
  /**
   * Creates a new Sampler object with the specified generation config.
   * @param {GenerationConfigType} generation_config The generation config.
   */
  constructor(e) {
    super(), this.generation_config = e;
  }
  /**
   * Executes the sampler, using the specified logits.
   * @param {Tensor} logits
   * @param {number} index
   * @returns {void}
   */
  _call(e, r = -1) {
    return this.sample(e, r);
  }
  /**
   * Abstract method for sampling the logits.
   * @param {Tensor} logits
   * @param {number} index
   * @throws {Error}
   */
  sample(e, r) {
    throw Error("sample should be implemented in subclasses.");
  }
  /**
   * Returns the specified logits as an array, with temperature applied.
   * @param {Tensor} logits
   * @param {number} index
   * @returns {Float32Array}
   */
  getLogits(e, r) {
    let o = e.dims.at(-1), m = (
      /** @type {Float32Array} */
      e.data
    );
    if (r === -1)
      m = m.slice(-o);
    else {
      let _ = r * o;
      m = m.slice(_, _ + o);
    }
    return this.generation_config.temperature > 0 && (m = m.map((_) => _ / this.generation_config.temperature)), m;
  }
  /**
   * Selects an item randomly based on the specified probabilities.
   * @param {Array} probabilities An array of probabilities to use for selection.
   * @returns {number} The index of the selected item.
   */
  randomSelect(e) {
    let r = e.reduce((m, _) => m + _, 0), o = Math.random() * r;
    for (let m = 0; m < e.length; ++m)
      if (o -= e[m], o <= 0)
        return m;
    return 0;
  }
  /**
   * Returns a Sampler object based on the specified options.
   * @param {GenerationConfigType} generation_config An object containing options for the sampler.
   * @returns {Sampler} A Sampler object.
   */
  static getSampler(e) {
    if (e.do_sample)
      return new MultinomialSampler(e);
    if (e.num_beams > 1)
      return new BeamSearchSampler(e);
    if (e.num_return_sequences > 1)
      throw Error(`num_return_sequences has to be 1 when doing greedy search, but is ${e.num_return_sequences}.`);
    return new GreedySampler(e);
  }
}
class GreedySampler extends Sampler {
  /**
   * Sample the maximum probability of a given logits tensor.
   * @param {Tensor} logits
   * @param {number} [index=-1]
   * @returns {Array} An array with a single tuple, containing the index of the maximum value and a meaningless score (since this is a greedy search).
   */
  sample(e, r = -1) {
    let o = this.getLogits(e, r);
    return [
      [max(o)[1], 0]
    ];
  }
}
class MultinomialSampler extends Sampler {
  /**
   * Sample from the logits.
   * @param {Tensor} logits
   * @param {number} index
   * @returns {Array}
   */
  sample(e, r = -1) {
    let o = e.dims.at(-1);
    this.generation_config.top_k > 0 && (o = Math.min(this.generation_config.top_k, o));
    const m = this.getLogits(e, r), _ = getTopItems(m, o), g = softmax(_.map((y) => y[1]));
    return Array.from({ length: this.generation_config.num_beams }, () => {
      const y = this.randomSelect(g);
      return [
        _[y][0],
        // token id
        Math.log(g[y])
        // score
      ];
    });
  }
}
class BeamSearchSampler extends Sampler {
  /**
   * Sample from the logits.
   * @param {Tensor} logits
   * @param {number} index
   * @returns {Array}
   */
  sample(e, r = -1) {
    let o = e.dims.at(-1);
    this.generation_config.top_k > 0 && (o = Math.min(this.generation_config.top_k, o));
    const m = this.getLogits(e, r), _ = getTopItems(m, o), g = softmax(_.map((y) => y[1]));
    return Array.from({ length: this.generation_config.num_beams }, (y, E) => [
      _[E][0],
      // token id
      Math.log(g[E])
      // score
    ]);
  }
}
const { InferenceSession, Tensor: ONNXTensor, env } = ONNX, MODEL_TYPES = {
  EncoderOnly: 0,
  EncoderDecoder: 1,
  Seq2Seq: 2,
  Vision2Seq: 3,
  DecoderOnly: 4,
  MaskGeneration: 5
}, MODEL_TYPE_MAPPING = /* @__PURE__ */ new Map(), MODEL_NAME_TO_CLASS_MAPPING = /* @__PURE__ */ new Map(), MODEL_CLASS_TO_NAME_MAPPING = /* @__PURE__ */ new Map();
async function constructSession(s, e, r) {
  let o = `onnx/${e}${r.quantized ? "_quantized" : ""}.onnx`, m = await getModelFile(s, o, !0, r);
  try {
    return await InferenceSession.create(m, {
      executionProviders
    });
  } catch (_) {
    if (executionProviders.length === 1 && executionProviders[0] === "wasm")
      throw _;
    return console.warn(_), console.warn(
      "Something went wrong during model construction (most likely a missing operation). Using `wasm` as a fallback. "
    ), await InferenceSession.create(m, {
      executionProviders: ["wasm"]
    });
  }
}
function validateInputs(s, e) {
  const r = /* @__PURE__ */ Object.create(null), o = [];
  for (const g of s.inputNames) {
    const y = e[g];
    if (!(y instanceof Tensor)) {
      o.push(g);
      continue;
    }
    r[g] = env.wasm.proxy ? y.clone() : y;
  }
  if (o.length > 0)
    throw new Error(
      `An error occurred during model execution: "Missing the following inputs: ${o.join(", ")}.`
    );
  const m = Object.keys(e).length, _ = s.inputNames.length;
  if (m > _) {
    let g = Object.keys(e).filter((y) => !s.inputNames.includes(y));
    console.warn(`WARNING: Too many inputs were provided (${m} > ${_}). The following inputs will be ignored: "${g.join(", ")}".`);
  }
  return r;
}
async function sessionRun(s, e) {
  const r = validateInputs(s, e);
  try {
    let o = await s.run(r);
    return o = replaceTensors(o), o;
  } catch (o) {
    throw console.error(`An error occurred during model execution: "${o}".`), console.error("Inputs given to model:", r), o;
  }
}
function replaceTensors(s) {
  for (let e in s)
    s[e] instanceof ONNXTensor ? s[e] = new Tensor(s[e]) : typeof s[e] == "object" && replaceTensors(s[e]);
  return s;
}
function toI64Tensor(s) {
  if (s instanceof Tensor)
    return s;
  if (s.length === 0)
    throw Error("items must be non-empty");
  if (Array.isArray(s[0])) {
    if (s.some((e) => e.length !== s[0].length))
      throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=True' and/or 'truncation=True' to have batched tensors with the same length.");
    return new Tensor(
      "int64",
      BigInt64Array.from(s.flat().map((e) => BigInt(e))),
      [s.length, s[0].length]
    );
  } else
    return new Tensor(
      "int64",
      BigInt64Array.from(s.map((e) => BigInt(e))),
      [1, s.length]
    );
}
function prepareAttentionMask(s, e) {
  let r = s.config.pad_token_id ?? null, o = s.config.eos_token_id ?? null;
  isIntegralNumber(o) && (o = [o]);
  let m = e.indexOf(r) !== -1, _ = o === null || !o.includes(r);
  if (m && _) {
    let g = BigInt64Array.from(
      // Note: != so that int matches bigint
      // @ts-ignore
      e.data.map((y) => y != r)
    );
    return new Tensor("int64", g, e.dims);
  } else
    return ones_like(e);
}
function preparePositionIds(s, e, r) {
  if (!s.inputNames.includes("position_ids")) return;
  const o = new BigInt64Array(e.attention_mask.data.length);
  for (let m = 0; m < e.attention_mask.dims[0]; ++m) {
    let _ = m * e.attention_mask.dims[1], g = BigInt(0);
    for (let y = 0; y < e.attention_mask.dims[1]; ++y) {
      const E = _ + y;
      e.attention_mask.data[E] === 0n ? o[E] = BigInt(1) : (o[E] = g, g += e.attention_mask.data[E]);
    }
  }
  e.position_ids = new Tensor("int64", o, e.attention_mask.dims), r && (e.position_ids = e.position_ids.slice(null, -1).unsqueeze_(-1));
}
function boolTensor(s) {
  return new Tensor("bool", [s], [1]);
}
async function seq2seqForward(s, e) {
  let { encoder_outputs: r, past_key_values: o } = e;
  r || (r = (await encoderForward(s, e)).last_hidden_state);
  let m = {
    input_ids: e.decoder_input_ids,
    encoder_hidden_states: r
  };
  const _ = !!o;
  s.decoder_merged_session.inputNames.includes("use_cache_branch") && (m.use_cache_branch = boolTensor(_)), s.decoder_merged_session.inputNames.includes("encoder_attention_mask") && (m.encoder_attention_mask = e.attention_mask), preparePositionIds(s.decoder_merged_session, m, _), s.addPastKeyValues(m, o);
  const g = await sessionRun(s.decoder_merged_session, m);
  let y = g.logits;
  o = s.getPastKeyValues(g, o);
  const E = s.getAttentions(g);
  return new Seq2SeqLMOutput({ logits: y, past_key_values: o, encoder_outputs: r, ...E });
}
function seq2seqStartBeams(s, e, r, o) {
  let m = [], _ = 0;
  const g = s.requires_attention_mask ?? !0;
  let y = r.decoder_input_ids ?? r.decoder_start_token_id ?? r.bos_token_id ?? r.eos_token_id;
  y instanceof Tensor ? y = y.tolist().flat() : Array.isArray(y) || (y = [y]);
  for (let E of e) {
    E.dims = [1, ...E.dims];
    let x = {
      inputs: E,
      encoder_outputs: null,
      prev_model_outputs: null,
      output_token_ids: y,
      done: !1,
      score: 0,
      id: _++
      // assign unique id to beams
    };
    g && (x.attention_mask = prepareAttentionMask(s, E)), m.push(x);
  }
  return m;
}
async function seq2seqRunBeam(s, e) {
  var g;
  const r = s.main_input_name;
  let o = e.output_token_ids;
  e.prev_model_outputs && (o = o.slice(-1));
  let m = {
    [r]: e.inputs,
    decoder_input_ids: toI64Tensor(o),
    encoder_outputs: e.encoder_outputs,
    past_key_values: (g = e.prev_model_outputs) == null ? void 0 : g.past_key_values
  };
  e.attention_mask && (m.attention_mask = e.attention_mask);
  let _ = await s.forward(m);
  return e.prev_model_outputs = _, e.encoder_outputs = _.encoder_outputs, _;
}
function seq2seqUpdatebeam(s, e) {
  s.output_token_ids = [...s.output_token_ids, e];
}
async function encoderForward(s, e) {
  const r = /* @__PURE__ */ Object.create(null);
  for (const o of s.session.inputNames)
    r[o] = e[o];
  return s.session.inputNames.includes("token_type_ids") && !r.token_type_ids && (r.token_type_ids = new Tensor(
    "int64",
    new BigInt64Array(r.input_ids.data.length),
    r.input_ids.dims
  )), await sessionRun(s.session, r);
}
async function decoderForward(s, e) {
  let { input_ids: r, past_key_values: o, attention_mask: m } = e, _ = {
    input_ids: r,
    attention_mask: m ?? prepareAttentionMask(s, r)
  };
  const g = !!o;
  s.session.inputNames.includes("use_cache_branch") && (_.use_cache_branch = boolTensor(g)), preparePositionIds(s.session, _, g), s.addPastKeyValues(_, o);
  let y = await sessionRun(s.session, _), E = y.logits;
  return o = s.getPastKeyValues(y, o), { logits: E, past_key_values: o };
}
function decoderStartBeams(s, e, r, o, m) {
  let _ = [], g = 0;
  for (let y of e) {
    let E = y.tolist().map(Number);
    y.dims = [1, ...y.dims];
    let x;
    m ? (x = m[g], x.dims = [1, ...x.dims]) : x = prepareAttentionMask(s, y);
    let v = {
      input: y,
      model_input_ids: y,
      attention_mask: x,
      prev_model_outputs: null,
      output_token_ids: E,
      num_output_tokens: o,
      done: !1,
      score: 0,
      id: g++
      // assign unique id to beams
    };
    _.push(v);
  }
  return _;
}
async function decoderRunBeam(s, e) {
  var _;
  let r = new BigInt64Array(e.output_token_ids.length).fill(1n), o = {
    input_ids: e.model_input_ids,
    attention_mask: new Tensor(
      "int64",
      r,
      [1, r.length]
    ),
    past_key_values: (_ = e.prev_model_outputs) == null ? void 0 : _.past_key_values
  }, m = await s.forward(o);
  return e.prev_model_outputs = m, m;
}
function decoderUpdatebeam(s, e) {
  s.output_token_ids = [...s.output_token_ids, e], s.model_input_ids = new Tensor("int64", [BigInt(e)], [1, 1]);
}
class PreTrainedModel extends Callable {
  /**
   * Creates a new instance of the `PreTrainedModel` class.
   * @param {Object} config The model configuration.
   * @param {any} session session for the model.
   */
  constructor(r, o) {
    super();
    be(this, "main_input_name", "input_ids");
    this.config = r, this.session = o;
    const m = MODEL_CLASS_TO_NAME_MAPPING.get(this.constructor), _ = MODEL_TYPE_MAPPING.get(m);
    this.can_generate = !1, this._runBeam = null, this._getStartBeams = null, this._updateBeam = null, this._forward = null, _ === MODEL_TYPES.DecoderOnly ? (this.can_generate = !0, this._runBeam = decoderRunBeam, this._getStartBeams = decoderStartBeams, this._updateBeam = decoderUpdatebeam, this._forward = decoderForward) : _ === MODEL_TYPES.Seq2Seq || _ === MODEL_TYPES.Vision2Seq ? (this.can_generate = !0, this._runBeam = seq2seqRunBeam, this._getStartBeams = seq2seqStartBeams, this._updateBeam = seq2seqUpdatebeam, this._forward = seq2seqForward) : _ === MODEL_TYPES.EncoderDecoder ? this._forward = encoderForward : this._forward = encoderForward;
  }
  /**
  * Disposes of all the ONNX sessions that were created during inference.
  * @returns {Promise<unknown[]>} An array of promises, one for each ONNX session that is being disposed.
  * @todo Use https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
  */
  async dispose() {
    const r = [];
    for (let o of Object.keys(this)) {
      const m = this[o];
      m instanceof InferenceSession && r.push(m.handler.dispose());
    }
    return await Promise.all(r);
  }
  /**
   * Instantiate one of the model classes of the library from a pretrained model.
   * 
   * The model class to instantiate is selected based on the `model_type` property of the config object
   * (either passed as an argument or loaded from `pretrained_model_name_or_path` if possible)
   * 
   * @param {string} pretrained_model_name_or_path The name or path of the pretrained model. Can be either:
   * - A string, the *model id* of a pretrained model hosted inside a model repo on huggingface.co.
   *   Valid model ids can be located at the root-level, like `bert-base-uncased`, or namespaced under a
   *   user or organization name, like `dbmdz/bert-base-german-cased`.
   * - A path to a *directory* containing model weights, e.g., `./my_model_directory/`.
   * @param {import('./utils/hub.js').PretrainedOptions} options Additional options for loading the model.
   * 
   * @returns {Promise<PreTrainedModel>} A new instance of the `PreTrainedModel` class.
   */
  static async from_pretrained(r, {
    quantized: o = !0,
    progress_callback: m = null,
    config: _ = null,
    cache_dir: g = null,
    local_files_only: y = !1,
    revision: E = "main",
    model_file_name: x = null
  } = {}) {
    let v = {
      quantized: o,
      progress_callback: m,
      config: _,
      cache_dir: g,
      local_files_only: y,
      revision: E,
      model_file_name: x
    };
    const h = MODEL_CLASS_TO_NAME_MAPPING.get(this), a = MODEL_TYPE_MAPPING.get(h);
    let b;
    return a === MODEL_TYPES.DecoderOnly ? b = await Promise.all([
      AutoConfig.from_pretrained(r, v),
      constructSession(r, v.model_file_name ?? "decoder_model_merged", v),
      getModelJSON(r, "generation_config.json", !1, v)
    ]) : a === MODEL_TYPES.Seq2Seq || a === MODEL_TYPES.Vision2Seq ? b = await Promise.all([
      AutoConfig.from_pretrained(r, v),
      constructSession(r, "encoder_model", v),
      constructSession(r, "decoder_model_merged", v),
      getModelJSON(r, "generation_config.json", !1, v)
    ]) : a === MODEL_TYPES.MaskGeneration ? b = await Promise.all([
      AutoConfig.from_pretrained(r, v),
      constructSession(r, "vision_encoder", v),
      constructSession(r, "prompt_encoder_mask_decoder", v)
    ]) : a === MODEL_TYPES.EncoderDecoder ? b = await Promise.all([
      AutoConfig.from_pretrained(r, v),
      constructSession(r, "encoder_model", v),
      constructSession(r, "decoder_model_merged", v)
    ]) : (a !== MODEL_TYPES.EncoderOnly && console.warn(`Model type for '${h ?? (_ == null ? void 0 : _.model_type)}' not found, assuming encoder-only architecture. Please report this at https://github.com/xenova/transformers.js/issues/new/choose.`), b = await Promise.all([
      AutoConfig.from_pretrained(r, v),
      constructSession(r, v.model_file_name ?? "model", v)
    ])), new this(...b);
  }
  /**
   * Runs the model with the provided inputs
   * @param {Object} model_inputs Object containing input tensors
   * @returns {Promise<Object>} Object containing output tensors
   */
  async _call(r) {
    return await this.forward(r);
  }
  /**
   * Forward method for a pretrained model. If not overridden by a subclass, the correct forward method
   * will be chosen based on the model type.
   * @param {Object} model_inputs The input data to the model in the format specified in the ONNX model.
   * @returns {Promise<Object>} The output data from the model in the format specified in the ONNX model.
   * @throws {Error} This method must be implemented in subclasses.
   */
  async forward(r) {
    return await this._forward(this, r);
  }
  /**
   * @param {import('./utils/generation.js').GenerationConfigType} generation_config 
   * @param {number} input_ids_seq_length The starting sequence length for the input ids.
   * @returns {LogitsProcessorList}
   * @private
   */
  _get_logits_processor(r, o, m = null) {
    const _ = new LogitsProcessorList();
    if (r.repetition_penalty !== null && r.repetition_penalty !== 1 && _.push(new RepetitionPenaltyLogitsProcessor(r.repetition_penalty)), r.no_repeat_ngram_size !== null && r.no_repeat_ngram_size > 0 && _.push(new NoRepeatNGramLogitsProcessor(r.no_repeat_ngram_size)), r.bad_words_ids !== null && _.push(new NoBadWordsLogitsProcessor(r.bad_words_ids, r.eos_token_id)), r.min_length !== null && r.eos_token_id !== null && r.min_length > 0 && _.push(new MinLengthLogitsProcessor(r.min_length, r.eos_token_id)), r.min_new_tokens !== null && r.eos_token_id !== null && r.min_new_tokens > 0 && _.push(new MinNewTokensLengthLogitsProcessor(
      o,
      r.min_new_tokens,
      r.eos_token_id
    )), r.forced_bos_token_id !== null && _.push(new ForcedBOSTokenLogitsProcessor(r.forced_bos_token_id)), r.forced_eos_token_id !== null && _.push(new ForcedEOSTokenLogitsProcessor(
      r.max_length,
      r.forced_eos_token_id
    )), r.begin_suppress_tokens !== null) {
      let g = o > 1 || r.forced_bos_token_id === null ? o : o + 1;
      r.forced_decoder_ids !== null && (g += r.forced_decoder_ids[r.forced_decoder_ids.length - 1][0]), _.push(new SuppressTokensAtBeginLogitsProcessor(r.begin_suppress_tokens, g));
    }
    return r.forced_decoder_ids !== null && _.push(new ForceTokensLogitsProcessor(r.forced_decoder_ids)), m !== null && _.extend(m), _;
  }
  /**
   * This function merges multiple generation configs together to form a final generation config to be used by the model for text generation.
   * It first creates an empty `GenerationConfig` object, then it applies the model's own `generation_config` property to it. Finally, if a `generation_config` object was passed in the arguments, it overwrites the corresponding properties in the final config with those of the passed config object.
   * @param {import('./utils/generation.js').GenerationConfigType} generation_config A `GenerationConfig` object containing generation parameters.
   * @returns {import('./utils/generation.js').GenerationConfigType} The final generation config object to be used by the model for text generation.
   */
  _get_generation_config(r) {
    let o = new GenerationConfig(this.config);
    return "generation_config" in this && Object.assign(o, this.generation_config), r !== null && Object.assign(o, r), o;
  }
  /**
   * @typedef {import('./utils/maths.js').TypedArray} TypedArray
   */
  /**
   * @typedef {{ sequences: Tensor, decoder_attentions: Tensor, cross_attentions: Tensor }} EncoderDecoderOutput
   * @typedef {Object} DecoderOutput
   * 
   * Generates text based on the given inputs and generation configuration using the model.
   * @param {Tensor|Array|TypedArray} inputs An array of input token IDs.
   * @param {Object|GenerationConfig|null} generation_config The generation configuration to use. If null, default configuration will be used.
   * @param {Object|null} logits_processor An optional logits processor to use. If null, a new LogitsProcessorList instance will be created.
   * @param {Object} options options
   * @param {Object} [options.inputs_attention_mask=null] An optional attention mask for the inputs.
   * @returns {Promise<number[][]|EncoderDecoderOutput|DecoderOutput>} An array of generated output sequences, where each sequence is an array of token IDs.
   * @throws {Error} Throws an error if the inputs array is empty.
   */
  async generate(r, o = null, m = null, {
    inputs_attention_mask: _ = null
  } = {}) {
    if (!this.can_generate) {
      let M = `The current model class (${MODEL_CLASS_TO_NAME_MAPPING.get(this.constructor)}) is not compatible with \`.generate()\`, as it doesn't have a language model head.`;
      const $ = this.config.model_type, O = MODEL_WITH_LM_HEAD_MAPPING_NAMES.get($) ?? MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES.get($) ?? MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES.get($) ?? MODEL_FOR_VISION_2_SEQ_MAPPING_NAMES.get($);
      throw O && (M += ` Please use the following class instead: '${O[0]}'`), Error(M);
    }
    if (!(r instanceof Tensor) && !isTypedArray(r) && !Array.isArray(r))
      throw Error(`\`inputs\` must be a Tensor, TypedArray, or Array, but is "${r.constructor.name}".`);
    let g;
    if (this.config.is_encoder_decoder)
      g = 0;
    else if (g = r instanceof Tensor ? r.dims.at(-1) : r.length, g === 0)
      throw Error("Must supply a non-empty array of input token ids.");
    o = this._get_generation_config(o), m = m ?? new LogitsProcessorList(), m = this._get_logits_processor(
      o,
      g,
      m
    );
    let y = o.eos_token_id;
    y !== null && !Array.isArray(y) && (y = [y]);
    let E = 1;
    const x = E + (o.max_new_tokens ?? 1 / 0), v = Number.isInteger(o.max_length) && (o.max_new_tokens ?? null) === null;
    let h = Sampler.getSampler(o), a = this.getStartBeams(r, o, E, _);
    for (; a.some((A) => !A.done) && E < x; ) {
      let A = [];
      for (let M of a) {
        if (M.done) {
          A.push(M);
          continue;
        }
        if (v && M.output_token_ids.length >= o.max_length) {
          M.done = !0, A.push(M);
          continue;
        }
        let $ = await this.runBeam(M);
        o.output_attentions && this.addAttentionsToBeam(M, $), o.output_scores;
        let O = $.logits.slice(null, -1, null);
        m(M.output_token_ids, O);
        let C = h(O);
        for (let [P, I] of C) {
          let N = { ...M };
          this.updateBeam(N, P), N.score += I, y && y.includes(P) && (N.done = !0), A.push(N);
        }
      }
      ++E, A = this.groupBeams(A).map(
        (M) => M.sort(($, O) => O.score - $.score).slice(0, o.num_beams)
        // remove outside beam width
      ), a = A.flat(), o.callback_function && o.callback_function(a);
    }
    const b = this.groupBeams(a), w = (A) => b.map(
      (M) => o.num_return_sequences > 1 ? M.slice(0, o.num_return_sequences).map(($) => $[A]) : [M[0][A]]
    ).flat(), k = w("output_token_ids");
    if (o.return_dict_in_generate) {
      const A = w("decoder_attentions"), M = w("cross_attentions");
      return {
        sequences: k,
        decoder_attentions: A,
        cross_attentions: M
      };
    } else
      return k;
  }
  /**
   * Helper function to add attentions to beam
   * @param {Object} beam 
   * @param {Object} output
   * @private 
   */
  addAttentionsToBeam(r, o) {
    if (this.config.is_encoder_decoder) {
      if (!o.cross_attentions || o.cross_attentions.length === 0)
        throw Error(
          "`output_attentions` is true, but the model did not produce cross-attentions. This is most likely because the model was not exported with `output_attentions=True`."
        );
      r.cross_attentions || (r.cross_attentions = []), r.cross_attentions.push(o.cross_attentions);
    }
    if (!o.decoder_attentions || o.decoder_attentions.length === 0)
      throw Error(
        "`output_attentions` is true, but the model did not produce decoder-attentions. This is most likely because the model was not exported with `output_attentions=True`."
      );
    r.decoder_attentions || (r.decoder_attentions = []), r.decoder_attentions.push(o.decoder_attentions);
  }
  /**
   * Groups an array of beam objects by their ids.
   *
   * @param {Array} beams The array of beam objects to group.
   * @returns {Array} An array of arrays, where each inner array contains beam objects with the same id.
   */
  groupBeams(r) {
    const o = /* @__PURE__ */ Object.create(null);
    for (const m of r)
      o[m.id] === void 0 ? o[m.id] = [m] : o[m.id].push(m);
    return Object.values(o);
  }
  /**
   * Returns an object containing past key values from the given decoder results object.
   *
   * @param {Object} decoderResults The decoder results object.
   * @param {Object} pastKeyValues The previous past key values.
   * @returns {Object} An object containing past key values.
   */
  getPastKeyValues(r, o) {
    const m = /* @__PURE__ */ Object.create(null);
    for (const _ in r)
      if (_.startsWith("present")) {
        let g = _.replace("present", "past_key_values");
        o && _.includes("encoder") ? m[g] = o[g] : m[g] = r[_];
      }
    return m;
  }
  /**
   * Returns an object containing attentions from the given decoder results object.
   *
   * @param {Object} decoderResults The decoder results object.
   * @returns {Object} An object containing attentions.
   */
  getAttentions(r) {
    const o = /* @__PURE__ */ Object.create(null);
    for (const m of ["cross_attentions", "decoder_attentions"]) {
      const _ = [];
      for (const g in r)
        if (g.startsWith(m)) {
          const y = g.split(".").pop();
          _[y] = r[g];
        }
      o[m] = _;
    }
    return o;
  }
  /**
   * Adds past key values to the decoder feeds object. If pastKeyValues is null, creates new tensors for past key values.
   *
   * @param {Object} decoderFeeds The decoder feeds object to add past key values to.
   * @param {Object} pastKeyValues An object containing past key values.
   */
  addPastKeyValues(r, o) {
    if (o)
      Object.assign(r, o);
    else if (this.config.is_encoder_decoder && (this.add_encoder_pkv ?? !0)) {
      let _ = [1, this.num_encoder_heads, 0, this.encoder_dim_kv], g = [1, this.num_decoder_heads, 0, this.decoder_dim_kv];
      for (let y = 0; y < this.num_decoder_layers; ++y)
        r[`past_key_values.${y}.encoder.key`] = new Tensor("float32", [], _), r[`past_key_values.${y}.encoder.value`] = new Tensor("float32", [], _), r[`past_key_values.${y}.decoder.key`] = new Tensor("float32", [], g), r[`past_key_values.${y}.decoder.value`] = new Tensor("float32", [], g);
    } else if (this.config.model_type === "falcon") {
      let _ = [1 * this.num_heads, 0, this.dim_kv];
      for (let g = 0; g < this.num_layers; ++g)
        r[`past_key_values.${g}.key`] = new Tensor("float32", [], _), r[`past_key_values.${g}.value`] = new Tensor("float32", [], _);
    } else if (this.config.multi_query) {
      let _ = [1 * this.num_heads, 0, 2 * this.dim_kv];
      for (let g = 0; g < this.num_layers; ++g)
        r[`past_key_values.${g}.key_value`] = new Tensor("float32", [], _);
    } else if (this.config.model_type === "bloom") {
      let _ = [1 * this.num_heads, this.dim_kv, 0], g = [1 * this.num_heads, 0, this.dim_kv];
      for (let y = 0; y < this.num_layers; ++y)
        r[`past_key_values.${y}.key`] = new Tensor("float32", [], _), r[`past_key_values.${y}.value`] = new Tensor("float32", [], g);
    } else {
      let _ = [1, this.num_heads, 0, this.dim_kv];
      for (let g = 0; g < this.num_layers; ++g)
        r[`past_key_values.${g}.key`] = new Tensor("float32", [], _), r[`past_key_values.${g}.value`] = new Tensor("float32", [], _);
    }
  }
  /**
   * Initializes and returns the beam for text generation task
   * @param {Tensor} inputTokenIds The input token ids.
   * @param {Object} generation_config The generation config.
   * @param {number} numOutputTokens The number of tokens to be generated.
   * @param {Tensor} inputs_attention_mask Optional input attention mask.
   * @returns {any} A Beam object representing the initialized beam.
   * @private
   */
  getStartBeams(r, o, m, _) {
    return this._getStartBeams(this, r, o, m, _);
  }
  /**
   * Runs a single step of the beam search generation algorithm.
   * @param {any} beam The current beam being generated.
   * @returns {Promise<any>} The updated beam after a single generation step.
   * @private
   */
  async runBeam(r) {
    return await this._runBeam(this, r);
  }
  /**
   * Update a beam with a new token ID.
   * @param {Object} beam The beam to update.
   * @param {number} newTokenId The new token ID to add to the beam's output.
   * @private
   */
  updateBeam(r, o) {
    return this._updateBeam(r, o);
  }
}
class ModelOutput {
}
class BertPreTrainedModel extends PreTrainedModel {
}
class BertModel extends BertPreTrainedModel {
}
class BertForMaskedLM extends BertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<MaskedLMOutput>} An object containing the model's output logits for masked language modeling.
   */
  async _call(e) {
    return new MaskedLMOutput(await super._call(e));
  }
}
class BertForSequenceClassification extends BertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class BertForTokenClassification extends BertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
   */
  async _call(e) {
    return new TokenClassifierOutput(await super._call(e));
  }
}
class BertForQuestionAnswering extends BertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<QuestionAnsweringModelOutput>} An object containing the model's output logits for question answering.
   */
  async _call(e) {
    return new QuestionAnsweringModelOutput(await super._call(e));
  }
}
class NomicBertPreTrainedModel extends PreTrainedModel {
}
class NomicBertModel extends NomicBertPreTrainedModel {
}
class RoFormerPreTrainedModel extends PreTrainedModel {
}
class RoFormerModel extends RoFormerPreTrainedModel {
}
class RoFormerForMaskedLM extends RoFormerPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<MaskedLMOutput>} An object containing the model's output logits for masked language modeling.
   */
  async _call(e) {
    return new MaskedLMOutput(await super._call(e));
  }
}
class RoFormerForSequenceClassification extends RoFormerPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class RoFormerForTokenClassification extends RoFormerPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
   */
  async _call(e) {
    return new TokenClassifierOutput(await super._call(e));
  }
}
class RoFormerForQuestionAnswering extends RoFormerPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<QuestionAnsweringModelOutput>} An object containing the model's output logits for question answering.
   */
  async _call(e) {
    return new QuestionAnsweringModelOutput(await super._call(e));
  }
}
class ConvBertPreTrainedModel extends PreTrainedModel {
}
class ConvBertModel extends ConvBertPreTrainedModel {
}
class ConvBertForMaskedLM extends ConvBertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<MaskedLMOutput>} An object containing the model's output logits for masked language modeling.
   */
  async _call(e) {
    return new MaskedLMOutput(await super._call(e));
  }
}
class ConvBertForSequenceClassification extends ConvBertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class ConvBertForTokenClassification extends ConvBertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
   */
  async _call(e) {
    return new TokenClassifierOutput(await super._call(e));
  }
}
class ConvBertForQuestionAnswering extends ConvBertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<QuestionAnsweringModelOutput>} An object containing the model's output logits for question answering.
   */
  async _call(e) {
    return new QuestionAnsweringModelOutput(await super._call(e));
  }
}
class ElectraPreTrainedModel extends PreTrainedModel {
}
class ElectraModel extends ElectraPreTrainedModel {
}
class ElectraForMaskedLM extends ElectraPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<MaskedLMOutput>} An object containing the model's output logits for masked language modeling.
   */
  async _call(e) {
    return new MaskedLMOutput(await super._call(e));
  }
}
class ElectraForSequenceClassification extends ElectraPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class ElectraForTokenClassification extends ElectraPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
   */
  async _call(e) {
    return new TokenClassifierOutput(await super._call(e));
  }
}
class ElectraForQuestionAnswering extends ElectraPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<QuestionAnsweringModelOutput>} An object containing the model's output logits for question answering.
   */
  async _call(e) {
    return new QuestionAnsweringModelOutput(await super._call(e));
  }
}
class CamembertPreTrainedModel extends PreTrainedModel {
}
class CamembertModel extends CamembertPreTrainedModel {
}
class CamembertForMaskedLM extends CamembertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<MaskedLMOutput>} An object containing the model's output logits for masked language modeling.
   */
  async _call(e) {
    return new MaskedLMOutput(await super._call(e));
  }
}
class CamembertForSequenceClassification extends CamembertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class CamembertForTokenClassification extends CamembertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
   */
  async _call(e) {
    return new TokenClassifierOutput(await super._call(e));
  }
}
class CamembertForQuestionAnswering extends CamembertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<QuestionAnsweringModelOutput>} An object containing the model's output logits for question answering.
   */
  async _call(e) {
    return new QuestionAnsweringModelOutput(await super._call(e));
  }
}
class DebertaPreTrainedModel extends PreTrainedModel {
}
class DebertaModel extends DebertaPreTrainedModel {
}
class DebertaForMaskedLM extends DebertaPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<MaskedLMOutput>} An object containing the model's output logits for masked language modeling.
   */
  async _call(e) {
    return new MaskedLMOutput(await super._call(e));
  }
}
class DebertaForSequenceClassification extends DebertaPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class DebertaForTokenClassification extends DebertaPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
   */
  async _call(e) {
    return new TokenClassifierOutput(await super._call(e));
  }
}
class DebertaForQuestionAnswering extends DebertaPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<QuestionAnsweringModelOutput>} An object containing the model's output logits for question answering.
   */
  async _call(e) {
    return new QuestionAnsweringModelOutput(await super._call(e));
  }
}
class DebertaV2PreTrainedModel extends PreTrainedModel {
}
class DebertaV2Model extends DebertaV2PreTrainedModel {
}
class DebertaV2ForMaskedLM extends DebertaV2PreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<MaskedLMOutput>} An object containing the model's output logits for masked language modeling.
   */
  async _call(e) {
    return new MaskedLMOutput(await super._call(e));
  }
}
class DebertaV2ForSequenceClassification extends DebertaV2PreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class DebertaV2ForTokenClassification extends DebertaV2PreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
   */
  async _call(e) {
    return new TokenClassifierOutput(await super._call(e));
  }
}
class DebertaV2ForQuestionAnswering extends DebertaV2PreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<QuestionAnsweringModelOutput>} An object containing the model's output logits for question answering.
   */
  async _call(e) {
    return new QuestionAnsweringModelOutput(await super._call(e));
  }
}
class DistilBertPreTrainedModel extends PreTrainedModel {
}
class DistilBertModel extends DistilBertPreTrainedModel {
}
class DistilBertForSequenceClassification extends DistilBertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class DistilBertForTokenClassification extends DistilBertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
   */
  async _call(e) {
    return new TokenClassifierOutput(await super._call(e));
  }
}
class DistilBertForQuestionAnswering extends DistilBertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<QuestionAnsweringModelOutput>} An object containing the model's output logits for question answering.
   */
  async _call(e) {
    return new QuestionAnsweringModelOutput(await super._call(e));
  }
}
class DistilBertForMaskedLM extends DistilBertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<MaskedLMOutput>} returned object
   */
  async _call(e) {
    return new MaskedLMOutput(await super._call(e));
  }
}
class EsmPreTrainedModel extends PreTrainedModel {
}
class EsmModel extends EsmPreTrainedModel {
}
class EsmForMaskedLM extends EsmPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<MaskedLMOutput>} An object containing the model's output logits for masked language modeling.
   */
  async _call(e) {
    return new MaskedLMOutput(await super._call(e));
  }
}
class EsmForSequenceClassification extends EsmPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class EsmForTokenClassification extends EsmPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
   */
  async _call(e) {
    return new TokenClassifierOutput(await super._call(e));
  }
}
class MobileBertPreTrainedModel extends PreTrainedModel {
}
class MobileBertModel extends MobileBertPreTrainedModel {
}
class MobileBertForMaskedLM extends MobileBertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<MaskedLMOutput>} returned object
   */
  async _call(e) {
    return new MaskedLMOutput(await super._call(e));
  }
}
class MobileBertForSequenceClassification extends MobileBertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} returned object
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class MobileBertForQuestionAnswering extends MobileBertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<QuestionAnsweringModelOutput>} returned object
   */
  async _call(e) {
    return new QuestionAnsweringModelOutput(await super._call(e));
  }
}
class MPNetPreTrainedModel extends PreTrainedModel {
}
class MPNetModel extends MPNetPreTrainedModel {
}
class MPNetForMaskedLM extends MPNetPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<MaskedLMOutput>} An object containing the model's output logits for masked language modeling.
   */
  async _call(e) {
    return new MaskedLMOutput(await super._call(e));
  }
}
class MPNetForSequenceClassification extends MPNetPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class MPNetForTokenClassification extends MPNetPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
   */
  async _call(e) {
    return new TokenClassifierOutput(await super._call(e));
  }
}
class MPNetForQuestionAnswering extends MPNetPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<QuestionAnsweringModelOutput>} An object containing the model's output logits for question answering.
   */
  async _call(e) {
    return new QuestionAnsweringModelOutput(await super._call(e));
  }
}
class SqueezeBertPreTrainedModel extends PreTrainedModel {
}
class SqueezeBertModel extends SqueezeBertPreTrainedModel {
}
class SqueezeBertForMaskedLM extends SqueezeBertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<MaskedLMOutput>} returned object
   */
  async _call(e) {
    return new MaskedLMOutput(await super._call(e));
  }
}
class SqueezeBertForSequenceClassification extends SqueezeBertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} returned object
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class SqueezeBertForQuestionAnswering extends SqueezeBertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<QuestionAnsweringModelOutput>} returned object
   */
  async _call(e) {
    return new QuestionAnsweringModelOutput(await super._call(e));
  }
}
class AlbertPreTrainedModel extends PreTrainedModel {
}
class AlbertModel extends AlbertPreTrainedModel {
}
class AlbertForSequenceClassification extends AlbertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} returned object
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class AlbertForQuestionAnswering extends AlbertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<QuestionAnsweringModelOutput>} returned object
   */
  async _call(e) {
    return new QuestionAnsweringModelOutput(await super._call(e));
  }
}
class AlbertForMaskedLM extends AlbertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<MaskedLMOutput>} returned object
   */
  async _call(e) {
    return new MaskedLMOutput(await super._call(e));
  }
}
class T5PreTrainedModel extends PreTrainedModel {
}
class T5Model extends T5PreTrainedModel {
}
class T5ForConditionalGeneration extends T5PreTrainedModel {
  /**
   * Creates a new instance of the `T5ForConditionalGeneration` class.
   * @param {Object} config The model configuration.
   * @param {any} session session for the model.
   * @param {any} decoder_merged_session session for the decoder.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o, m) {
    super(e, r), this.decoder_merged_session = o, this.generation_config = m, this.num_decoder_layers = this.config.num_decoder_layers, this.num_decoder_heads = this.config.num_heads, this.decoder_dim_kv = this.config.d_kv, this.num_encoder_layers = this.config.num_layers, this.num_encoder_heads = this.config.num_heads, this.encoder_dim_kv = this.config.d_kv;
  }
}
class LongT5PreTrainedModel extends PreTrainedModel {
}
class LongT5Model extends LongT5PreTrainedModel {
}
class LongT5ForConditionalGeneration extends LongT5PreTrainedModel {
  /**
   * Creates a new instance of the `LongT5ForConditionalGeneration` class.
   * @param {Object} config The model configuration.
   * @param {any} session session for the model.
   * @param {any} decoder_merged_session session for the decoder.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o, m) {
    super(e, r), this.decoder_merged_session = o, this.generation_config = m, this.num_decoder_layers = this.config.num_decoder_layers, this.num_decoder_heads = this.config.num_heads, this.decoder_dim_kv = this.config.d_kv, this.num_encoder_layers = this.config.num_layers, this.num_encoder_heads = this.config.num_heads, this.encoder_dim_kv = this.config.d_kv;
  }
}
class MT5PreTrainedModel extends PreTrainedModel {
}
class MT5Model extends MT5PreTrainedModel {
}
class MT5ForConditionalGeneration extends MT5PreTrainedModel {
  /**
   * Creates a new instance of the `MT5ForConditionalGeneration` class.
   * @param {any} config The model configuration.
   * @param {any} session The ONNX session containing the encoder weights.
   * @param {any} decoder_merged_session The ONNX session containing the merged decoder weights.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o, m) {
    super(e, r), this.decoder_merged_session = o, this.generation_config = m, this.num_decoder_layers = this.config.num_decoder_layers, this.num_decoder_heads = this.config.num_heads, this.decoder_dim_kv = this.config.d_kv, this.num_encoder_layers = this.config.num_layers, this.num_encoder_heads = this.config.num_heads, this.encoder_dim_kv = this.config.d_kv;
  }
}
class BartPretrainedModel extends PreTrainedModel {
}
class BartModel extends BartPretrainedModel {
}
class BartForConditionalGeneration extends BartPretrainedModel {
  /**
   * Creates a new instance of the `BartForConditionalGeneration` class.
   * @param {Object} config The configuration object for the Bart model.
   * @param {Object} session The ONNX session used to execute the model.
   * @param {Object} decoder_merged_session The ONNX session used to execute the decoder.
   * @param {Object} generation_config The generation configuration object.
   */
  constructor(e, r, o, m) {
    super(e, r), this.decoder_merged_session = o, this.generation_config = m, this.num_decoder_layers = this.config.decoder_layers, this.num_decoder_heads = this.config.decoder_attention_heads, this.decoder_dim_kv = this.config.d_model / this.num_decoder_heads, this.num_encoder_layers = this.config.encoder_layers, this.num_encoder_heads = this.config.encoder_attention_heads, this.encoder_dim_kv = this.config.d_model / this.num_encoder_heads;
  }
}
class BartForSequenceClassification extends BartPretrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class MBartPreTrainedModel extends PreTrainedModel {
}
class MBartModel extends MBartPreTrainedModel {
}
class MBartForConditionalGeneration extends MBartPreTrainedModel {
  /**
   * Creates a new instance of the `MBartForConditionalGeneration` class.
   * @param {Object} config The configuration object for the Bart model.
   * @param {Object} session The ONNX session used to execute the model.
   * @param {Object} decoder_merged_session The ONNX session used to execute the decoder.
   * @param {Object} generation_config The generation configuration object.
   */
  constructor(e, r, o, m) {
    super(e, r), this.decoder_merged_session = o, this.generation_config = m, this.num_decoder_layers = this.config.decoder_layers, this.num_decoder_heads = this.config.decoder_attention_heads, this.decoder_dim_kv = this.config.d_model / this.num_decoder_heads, this.num_encoder_layers = this.config.encoder_layers, this.num_encoder_heads = this.config.encoder_attention_heads, this.encoder_dim_kv = this.config.d_model / this.num_encoder_heads;
  }
}
class MBartForSequenceClassification extends MBartPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class MBartForCausalLM extends MBartPreTrainedModel {
  /**
   * Creates a new instance of the `MBartForCausalLM` class.
   * @param {Object} config Configuration object for the model.
   * @param {Object} decoder_merged_session ONNX Session object for the decoder.
   * @param {Object} generation_config Configuration object for the generation process.
   */
  constructor(e, r, o) {
    super(e, r), this.generation_config = o, this.num_decoder_layers = this.config.decoder_layers, this.num_decoder_heads = this.config.decoder_attention_heads, this.decoder_dim_kv = this.config.d_model / this.num_decoder_heads, this.num_encoder_layers = this.config.encoder_layers, this.num_encoder_heads = this.config.encoder_attention_heads, this.encoder_dim_kv = this.config.d_model / this.num_encoder_heads;
  }
}
class BlenderbotPreTrainedModel extends PreTrainedModel {
}
class BlenderbotModel extends BlenderbotPreTrainedModel {
}
class BlenderbotForConditionalGeneration extends BlenderbotPreTrainedModel {
  /**
   * Creates a new instance of the `BlenderbotForConditionalGeneration` class.
   * @param {any} config The model configuration.
   * @param {any} session The ONNX session containing the encoder weights.
   * @param {any} decoder_merged_session The ONNX session containing the merged decoder weights.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o, m) {
    super(e, r), this.decoder_merged_session = o, this.generation_config = m, this.num_decoder_layers = this.config.decoder_layers, this.num_decoder_heads = this.config.decoder_attention_heads, this.decoder_dim_kv = this.config.d_model / this.num_decoder_heads, this.num_encoder_layers = this.config.encoder_layers, this.num_encoder_heads = this.config.encoder_attention_heads, this.encoder_dim_kv = this.config.d_model / this.num_encoder_heads;
  }
}
class BlenderbotSmallPreTrainedModel extends PreTrainedModel {
}
class BlenderbotSmallModel extends BlenderbotSmallPreTrainedModel {
}
class BlenderbotSmallForConditionalGeneration extends BlenderbotSmallPreTrainedModel {
  /**
   * Creates a new instance of the `BlenderbotForConditionalGeneration` class.
   * @param {any} config The model configuration.
   * @param {any} session The ONNX session containing the encoder weights.
   * @param {any} decoder_merged_session The ONNX session containing the merged decoder weights.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o, m) {
    super(e, r), this.decoder_merged_session = o, this.generation_config = m, this.num_decoder_layers = this.config.decoder_layers, this.num_decoder_heads = this.config.decoder_attention_heads, this.decoder_dim_kv = this.config.d_model / this.num_decoder_heads, this.num_encoder_layers = this.config.encoder_layers, this.num_encoder_heads = this.config.encoder_attention_heads, this.encoder_dim_kv = this.config.d_model / this.num_encoder_heads;
  }
}
class RobertaPreTrainedModel extends PreTrainedModel {
}
class RobertaModel extends RobertaPreTrainedModel {
}
class RobertaForMaskedLM extends RobertaPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<MaskedLMOutput>} returned object
   */
  async _call(e) {
    return new MaskedLMOutput(await super._call(e));
  }
}
class RobertaForSequenceClassification extends RobertaPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} returned object
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class RobertaForTokenClassification extends RobertaPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
   */
  async _call(e) {
    return new TokenClassifierOutput(await super._call(e));
  }
}
class RobertaForQuestionAnswering extends RobertaPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<QuestionAnsweringModelOutput>} returned object
   */
  async _call(e) {
    return new QuestionAnsweringModelOutput(await super._call(e));
  }
}
class XLMPreTrainedModel extends PreTrainedModel {
}
class XLMModel extends XLMPreTrainedModel {
}
class XLMWithLMHeadModel extends XLMPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<MaskedLMOutput>} returned object
   */
  async _call(e) {
    return new MaskedLMOutput(await super._call(e));
  }
}
class XLMForSequenceClassification extends XLMPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} returned object
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class XLMForTokenClassification extends XLMPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
   */
  async _call(e) {
    return new TokenClassifierOutput(await super._call(e));
  }
}
class XLMForQuestionAnswering extends XLMPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<QuestionAnsweringModelOutput>} returned object
   */
  async _call(e) {
    return new QuestionAnsweringModelOutput(await super._call(e));
  }
}
class XLMRobertaPreTrainedModel extends PreTrainedModel {
}
class XLMRobertaModel extends XLMRobertaPreTrainedModel {
}
class XLMRobertaForMaskedLM extends XLMRobertaPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<MaskedLMOutput>} returned object
   */
  async _call(e) {
    return new MaskedLMOutput(await super._call(e));
  }
}
class XLMRobertaForSequenceClassification extends XLMRobertaPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} returned object
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class XLMRobertaForTokenClassification extends XLMRobertaPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
   */
  async _call(e) {
    return new TokenClassifierOutput(await super._call(e));
  }
}
class XLMRobertaForQuestionAnswering extends XLMRobertaPreTrainedModel {
  /**
   * Calls the model on new inputs.
   *
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<QuestionAnsweringModelOutput>} returned object
   */
  async _call(e) {
    return new QuestionAnsweringModelOutput(await super._call(e));
  }
}
class ASTPreTrainedModel extends PreTrainedModel {
}
class ASTModel extends ASTPreTrainedModel {
}
class ASTForAudioClassification extends ASTPreTrainedModel {
}
class WhisperPreTrainedModel extends PreTrainedModel {
}
class WhisperModel extends WhisperPreTrainedModel {
}
class WhisperForConditionalGeneration extends WhisperPreTrainedModel {
  /**
   * Creates a new instance of the `WhisperForConditionalGeneration` class.
   * @param {Object} config Configuration object for the model.
   * @param {Object} session ONNX Session object for the model.
   * @param {Object} decoder_merged_session ONNX Session object for the decoder.
   * @param {Object} generation_config Configuration object for the generation process.
   */
  constructor(r, o, m, _) {
    super(r, o);
    be(this, "requires_attention_mask", !1);
    be(this, "main_input_name", "input_features");
    this.decoder_merged_session = m, this.generation_config = _, this.num_decoder_layers = this.config.decoder_layers, this.num_decoder_heads = this.config.decoder_attention_heads, this.decoder_dim_kv = this.config.d_model / this.num_decoder_heads, this.num_encoder_layers = this.config.encoder_layers, this.num_encoder_heads = this.config.encoder_attention_heads, this.encoder_dim_kv = this.config.d_model / this.num_encoder_heads;
  }
  /**
   * @typedef {Object} WhisperGenerationConfig
   * @extends GenerationConfig
   * @property {boolean} [return_timestamps=null] Whether to return the timestamps with the text. This enables the `WhisperTimestampsLogitsProcessor`.
   * @property {boolean} [return_token_timestamps=null] Whether to return token-level timestamps
   * with the text. This can be used with or without the `return_timestamps` option. To get word-level
   * timestamps, use the tokenizer to group the tokens into words.
   * @property {number} [num_frames=null]  The number of audio frames available in this chunk. This is only used generating word-level timestamps.
   */
  /**
   * Generates outputs based on input and generation configuration.
   * @param {Object} inputs Input data for the model.
   * @param {WhisperGenerationConfig} generation_config Configuration object for the generation process.
   * @param {Object} logits_processor Optional logits processor object.
   * @returns {Promise<Object>} Promise object represents the generated outputs.
   */
  async generate(r, o = null, m = null) {
    if (o = this._get_generation_config(o), o.return_timestamps ?? (o.return_timestamps = !1), o.return_timestamps && (m = [new WhisperTimeStampLogitsProcessor(o)]), o.return_token_timestamps && (o.output_attentions = !0, o.return_dict_in_generate = !0, o.task === "translate" && console.warn("Token-level timestamps may not be reliable for task 'translate'."), !o.alignment_heads))
      throw new Error(
        "Model generation config has no `alignment_heads`, token-level timestamps not available. See https://gist.github.com/hollance/42e32852f24243b748ae6bc1f985b13a on how to add this property to the generation config."
      );
    const _ = await super.generate(r, o, m);
    return o.return_token_timestamps && o.alignment_heads && (_.token_timestamps = this._extract_token_timestamps(
      _,
      o.alignment_heads,
      o.num_frames
    )), _;
  }
  /**
   * Calculates token-level timestamps using the encoder-decoder cross-attentions and
   * dynamic time-warping (DTW) to map each output token to a position in the input audio.
   * @param {Object} generate_outputs Outputs generated by the model
   * @param {Tensor[][][]} generate_outputs.cross_attentions The cross attentions output by the model
   * @param {Tensor[][][]} generate_outputs.decoder_attentions The decoder attentions output by the model
   * @param {number[][]} generate_outputs.sequences The sequences output by the model
   * @param {number[][]} alignment_heads Alignment heads of the model
   * @param {number} [num_frames=null] Number of frames in the input audio.
   * @param {number} [time_precision=0.02] Precision of the timestamps in seconds
   * @returns {Tensor} tensor containing the timestamps in seconds for each predicted token
   */
  _extract_token_timestamps(r, o, m = null, _ = 0.02) {
    if (!r.cross_attentions)
      throw new Error(
        "Model outputs must contain cross attentions to extract timestamps. This is most likely because the model was not exported with `output_attentions=True`."
      );
    let g = this.config.median_filter_width;
    g === void 0 && (console.warn("Model config has no `median_filter_width`, using default value of 7."), g = 7);
    const y = r.cross_attentions.map((v) => {
      let h = Array.from(
        { length: this.config.decoder_layers },
        (M, $) => cat(v.map((O) => O[$]), 2)
      ), a = stack(o.map(([M, $]) => m ? h[M].slice(null, $, null, [0, m]) : h[M].slice(null, $)));
      a = a.transpose(1, 0, 2, 3);
      let [b, w] = std_mean(a, -2, 0, !0), k = a.clone();
      for (let M = 0; M < k.dims[0]; ++M) {
        let $ = k[M];
        for (let O = 0; O < $.dims[0]; ++O) {
          let C = $[O];
          const P = b[M][O][0], I = w[M][O][0];
          for (let N = 0; N < C.dims[0]; ++N) {
            let R = C[N];
            for (let F = 0; F < R.data.length; ++F)
              R.data[F] = (R.data[F] - I.data[F]) / P.data[F];
            R.data.set(medianFilter(R.data, g));
          }
        }
      }
      return mean(k, 1);
    }), E = [r.sequences.length, r.sequences[0].length], x = new Tensor(
      "float32",
      new Float32Array(E[0] * E[1]),
      E
    );
    for (let v = 0; v < E[0]; ++v) {
      const h = y[v].neg().squeeze_(0);
      let [a, b] = dynamicTimeWarping(h), w = Array.from({ length: a.length - 1 }, (M, $) => a[$ + 1] - a[$]), k = mergeArrays([1], w).map((M) => !!M), A = [];
      for (let M = 0; M < k.length; ++M)
        k[M] && A.push(b[M] * _);
      x[v].data.set(A, 1);
    }
    return x;
  }
}
class VisionEncoderDecoderModel extends PreTrainedModel {
  /**
   * Creates a new instance of the `VisionEncoderDecoderModel` class.
   * @param {Object} config The configuration object specifying the hyperparameters and other model settings.
   * @param {Object} session The ONNX session containing the encoder model.
   * @param {any} decoder_merged_session The ONNX session containing the merged decoder model.
   * @param {Object} generation_config Configuration object for the generation process.
   */
  constructor(r, o, m, _) {
    super(r, o);
    be(this, "main_input_name", "pixel_values");
    this.decoder_merged_session = m, this.generation_config = _;
    const g = this.config.encoder, y = this.config.decoder, E = g.model_type;
    (MODEL_MAPPING_NAMES_ENCODER_ONLY.get(E) ?? MODEL_MAPPING_NAMES_ENCODER_DECODER.get(E)) || console.warn(`Model type for encoder '${E}' not found, assuming encoder-only architecture. Please report this at https://github.com/xenova/transformers.js/issues/new/choose.`);
    const v = MODEL_WITH_LM_HEAD_MAPPING_NAMES.get(y.model_type);
    if (!v)
      throw new Error(`Unable to construct \`VisionEncoderDecoder\` due to unsupported decoder: "${this.config.decoder.model_type}"`);
    const h = v[1], a = new h(y, m, _);
    this.add_encoder_pkv = "num_decoder_layers" in a, this.add_encoder_pkv ? (this.num_decoder_layers = a.num_decoder_layers, this.num_decoder_heads = a.num_decoder_heads, this.decoder_dim_kv = a.decoder_dim_kv, this.num_encoder_layers = a.num_encoder_layers, this.num_encoder_heads = a.num_encoder_heads, this.encoder_dim_kv = a.encoder_dim_kv) : (this.num_layers = a.num_layers, this.num_heads = a.num_heads, this.dim_kv = a.dim_kv);
  }
}
class CLIPPreTrainedModel extends PreTrainedModel {
}
class CLIPModel extends CLIPPreTrainedModel {
}
class CLIPTextModelWithProjection extends CLIPPreTrainedModel {
  /** @type {PreTrainedModel.from_pretrained} */
  static async from_pretrained(e, r = {}) {
    return r.model_file_name ?? (r.model_file_name = "text_model"), super.from_pretrained(e, r);
  }
}
class CLIPVisionModelWithProjection extends CLIPPreTrainedModel {
  /** @type {PreTrainedModel.from_pretrained} */
  static async from_pretrained(e, r = {}) {
    return r.model_file_name ?? (r.model_file_name = "vision_model"), super.from_pretrained(e, r);
  }
}
class SiglipPreTrainedModel extends PreTrainedModel {
}
class SiglipModel extends SiglipPreTrainedModel {
}
class SiglipTextModel extends SiglipPreTrainedModel {
  /** @type {PreTrainedModel.from_pretrained} */
  static async from_pretrained(e, r = {}) {
    return r.model_file_name ?? (r.model_file_name = "text_model"), super.from_pretrained(e, r);
  }
}
class SiglipVisionModel extends CLIPPreTrainedModel {
  /** @type {PreTrainedModel.from_pretrained} */
  static async from_pretrained(e, r = {}) {
    return r.model_file_name ?? (r.model_file_name = "vision_model"), super.from_pretrained(e, r);
  }
}
class ChineseCLIPPreTrainedModel extends PreTrainedModel {
}
class ChineseCLIPModel extends ChineseCLIPPreTrainedModel {
}
class CLIPSegPreTrainedModel extends PreTrainedModel {
}
class CLIPSegModel extends CLIPSegPreTrainedModel {
}
class CLIPSegForImageSegmentation extends CLIPSegPreTrainedModel {
}
class GPT2PreTrainedModel extends PreTrainedModel {
  /**
   * Creates a new instance of the `GPT2PreTrainedModel` class.
   * @param {Object} config The configuration of the model.
   * @param {any} session The ONNX session containing the model weights.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o) {
    super(e, r), this.generation_config = o, this.config.pad_token_id = this.config.eos_token_id, this.num_heads = this.config.n_head, this.num_layers = this.config.n_layer, this.dim_kv = this.config.n_embd / this.num_heads;
  }
}
class GPT2Model extends GPT2PreTrainedModel {
}
class GPT2LMHeadModel extends GPT2PreTrainedModel {
}
class GPTNeoPreTrainedModel extends PreTrainedModel {
  /**
   * Creates a new instance of the `GPTNeoPreTrainedModel` class.
   * @param {Object} config The configuration of the model.
   * @param {any} session The ONNX session containing the model weights.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o) {
    super(e, r), this.generation_config = o, this.config.pad_token_id = this.config.eos_token_id, this.num_heads = this.config.num_heads, this.num_layers = this.config.num_layers, this.dim_kv = this.config.hidden_size / this.num_heads;
  }
}
class GPTNeoModel extends GPTNeoPreTrainedModel {
}
class GPTNeoForCausalLM extends GPTNeoPreTrainedModel {
}
class GPTNeoXPreTrainedModel extends PreTrainedModel {
  /**
   * Creates a new instance of the `GPTNeoXPreTrainedModel` class.
   * @param {Object} config The configuration of the model.
   * @param {any} session The ONNX session containing the model weights.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o) {
    super(e, r), this.generation_config = o, this.config.pad_token_id = this.config.eos_token_id, this.num_heads = this.config.num_attention_heads, this.num_layers = this.config.num_hidden_layers, this.dim_kv = this.config.hidden_size / this.num_heads;
  }
}
class GPTNeoXModel extends GPTNeoXPreTrainedModel {
}
class GPTNeoXForCausalLM extends GPTNeoXPreTrainedModel {
}
class GPTJPreTrainedModel extends PreTrainedModel {
  /**
   * Creates a new instance of the `GPTJPreTrainedModel` class.
   * @param {Object} config The configuration of the model.
   * @param {any} session The ONNX session containing the model weights.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o) {
    super(e, r), this.generation_config = o, this.config.pad_token_id = this.config.eos_token_id, this.num_heads = this.config.n_head, this.num_layers = this.config.n_layer, this.dim_kv = this.config.n_embd / this.num_heads;
  }
}
class GPTJModel extends GPTJPreTrainedModel {
}
class GPTJForCausalLM extends GPTJPreTrainedModel {
}
class GPTBigCodePreTrainedModel extends PreTrainedModel {
  /**
   * Creates a new instance of the `GPTBigCodePreTrainedModel` class.
   * @param {Object} config The configuration of the model.
   * @param {any} session The ONNX session containing the model weights.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o) {
    super(e, r), this.generation_config = o, this.config.pad_token_id = this.config.eos_token_id, this.num_heads = this.config.n_head, this.num_layers = this.config.n_layer, this.dim_kv = this.config.n_embd / this.num_heads;
  }
}
class GPTBigCodeModel extends GPTBigCodePreTrainedModel {
}
class GPTBigCodeForCausalLM extends GPTBigCodePreTrainedModel {
}
class CodeGenPreTrainedModel extends PreTrainedModel {
  /**
   * Creates a new instance of the `CodeGenPreTrainedModel` class.
   * @param {Object} config The model configuration object.
   * @param {Object} session The ONNX session object.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o) {
    super(e, r), this.generation_config = o, this.config.pad_token_id = this.config.eos_token_id, this.num_heads = this.config.n_head, this.num_layers = this.config.n_layer, this.dim_kv = this.config.n_embd / this.num_heads;
  }
}
class CodeGenModel extends CodeGenPreTrainedModel {
}
class CodeGenForCausalLM extends CodeGenPreTrainedModel {
}
class LlamaPreTrainedModel extends PreTrainedModel {
  /**
   * Creates a new instance of the `LlamaPreTrainedModel` class.
   * @param {Object} config The model configuration object.
   * @param {Object} session The ONNX session object.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o) {
    super(e, r), this.generation_config = o, this.config.pad_token_id = this.config.eos_token_id, this.num_heads = this.config.num_key_value_heads ?? this.config.num_attention_heads, this.num_layers = this.config.num_hidden_layers, this.dim_kv = this.config.hidden_size / this.config.num_attention_heads;
  }
}
class LlamaModel extends LlamaPreTrainedModel {
}
class LlamaForCausalLM extends LlamaPreTrainedModel {
}
class Qwen2PreTrainedModel extends PreTrainedModel {
  /**
   * Creates a new instance of the `Qwen2PreTrainedModel` class.
   * @param {Object} config The model configuration object.
   * @param {Object} session The ONNX session object.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o) {
    super(e, r), this.generation_config = o, this.config.pad_token_id = this.config.eos_token_id, this.num_heads = this.config.num_key_value_heads ?? this.config.num_attention_heads, this.num_layers = this.config.num_hidden_layers, this.dim_kv = this.config.hidden_size / this.config.num_attention_heads;
  }
}
class Qwen2Model extends Qwen2PreTrainedModel {
}
class Qwen2ForCausalLM extends Qwen2PreTrainedModel {
}
class PhiPreTrainedModel extends PreTrainedModel {
  /**
   * Creates a new instance of the `PhiPreTrainedModel` class.
   * @param {Object} config The model configuration object.
   * @param {Object} session The ONNX session object.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o) {
    super(e, r), this.generation_config = o, this.config.pad_token_id = this.config.eos_token_id, this.num_heads = this.config.num_attention_heads, this.num_layers = this.config.num_hidden_layers, this.dim_kv = this.config.hidden_size / this.num_heads;
  }
}
class PhiModel extends PhiPreTrainedModel {
}
class PhiForCausalLM extends PhiPreTrainedModel {
}
class BloomPreTrainedModel extends PreTrainedModel {
  /**
   * Creates a new instance of the `BloomPreTrainedModel` class.
   * @param {Object} config The configuration of the model.
   * @param {any} session The ONNX session containing the model weights.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o) {
    super(e, r), this.generation_config = o, this.config.pad_token_id = this.config.eos_token_id, this.num_heads = this.config.n_head, this.num_layers = this.config.n_layer, this.dim_kv = this.config.hidden_size / this.num_heads;
  }
}
class BloomModel extends BloomPreTrainedModel {
}
class BloomForCausalLM extends BloomPreTrainedModel {
}
class MptPreTrainedModel extends PreTrainedModel {
  /**
   * Creates a new instance of the `MptPreTrainedModel` class.
   * @param {Object} config The model configuration object.
   * @param {Object} session The ONNX session object.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o) {
    super(e, r), this.generation_config = o, this.config.pad_token_id = this.config.eos_token_id, this.num_heads = this.config.n_heads, this.num_layers = this.config.n_layers, this.dim_kv = this.config.d_model / this.num_heads;
  }
}
class MptModel extends MptPreTrainedModel {
}
class MptForCausalLM extends MptPreTrainedModel {
}
class OPTPreTrainedModel extends PreTrainedModel {
  /**
   * Creates a new instance of the `OPTPreTrainedModel` class.
   * @param {Object} config The model configuration object.
   * @param {Object} session The ONNX session object.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o) {
    super(e, r), this.generation_config = o, this.config.pad_token_id = this.config.eos_token_id, this.num_heads = this.config.num_attention_heads, this.num_layers = this.config.num_hidden_layers, this.dim_kv = this.config.hidden_size / this.num_heads;
  }
}
class OPTModel extends OPTPreTrainedModel {
}
class OPTForCausalLM extends OPTPreTrainedModel {
}
class ViTPreTrainedModel extends PreTrainedModel {
}
class ViTModel extends ViTPreTrainedModel {
}
class ViTForImageClassification extends ViTPreTrainedModel {
  /**
   * @param {any} model_inputs
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class FastViTPreTrainedModel extends PreTrainedModel {
}
class FastViTModel extends FastViTPreTrainedModel {
}
class FastViTForImageClassification extends FastViTPreTrainedModel {
  /**
   * @param {any} model_inputs
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class VitMattePreTrainedModel extends PreTrainedModel {
}
class VitMatteForImageMatting extends VitMattePreTrainedModel {
  /**
   * @param {any} model_inputs
   */
  async _call(e) {
    return new ImageMattingOutput(await super._call(e));
  }
}
class MobileViTPreTrainedModel extends PreTrainedModel {
}
class MobileViTModel extends MobileViTPreTrainedModel {
}
class MobileViTForImageClassification extends MobileViTPreTrainedModel {
  /**
   * @param {any} model_inputs
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class MobileViTV2PreTrainedModel extends PreTrainedModel {
}
class MobileViTV2Model extends MobileViTV2PreTrainedModel {
}
class MobileViTV2ForImageClassification extends MobileViTV2PreTrainedModel {
  /**
   * @param {any} model_inputs
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class OwlViTPreTrainedModel extends PreTrainedModel {
}
class OwlViTModel extends OwlViTPreTrainedModel {
}
class OwlViTForObjectDetection extends OwlViTPreTrainedModel {
}
class Owlv2PreTrainedModel extends PreTrainedModel {
}
class Owlv2Model extends Owlv2PreTrainedModel {
}
class Owlv2ForObjectDetection extends Owlv2PreTrainedModel {
}
class BeitPreTrainedModel extends PreTrainedModel {
}
class BeitModel extends BeitPreTrainedModel {
}
class BeitForImageClassification extends BeitPreTrainedModel {
  /**
   * @param {any} model_inputs
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class DetrPreTrainedModel extends PreTrainedModel {
}
class DetrModel extends DetrPreTrainedModel {
}
class DetrForObjectDetection extends DetrPreTrainedModel {
  /**
   * @param {any} model_inputs
   */
  async _call(e) {
    return new DetrObjectDetectionOutput(await super._call(e));
  }
}
class DetrForSegmentation extends DetrPreTrainedModel {
  /**
   * Runs the model with the provided inputs
   * @param {Object} model_inputs Model inputs
   * @returns {Promise<DetrSegmentationOutput>} Object containing segmentation outputs
   */
  async _call(e) {
    return new DetrSegmentationOutput(await super._call(e));
  }
}
class DetrObjectDetectionOutput extends ModelOutput {
  /**
   * @param {Object} output The output of the model.
   * @param {Tensor} output.logits Classification logits (including no-object) for all queries.
   * @param {Tensor} output.pred_boxes Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height).
   * These values are normalized in [0, 1], relative to the size of each individual image in the batch (disregarding possible padding).
   */
  constructor({ logits: e, pred_boxes: r }) {
    super(), this.logits = e, this.pred_boxes = r;
  }
}
class DetrSegmentationOutput extends ModelOutput {
  /**
   * @param {Object} output The output of the model.
   * @param {Tensor} output.logits The output logits of the model.
   * @param {Tensor} output.pred_boxes Predicted boxes.
   * @param {Tensor} output.pred_masks Predicted masks.
   */
  constructor({ logits: e, pred_boxes: r, pred_masks: o }) {
    super(), this.logits = e, this.pred_boxes = r, this.pred_masks = o;
  }
}
class TableTransformerPreTrainedModel extends PreTrainedModel {
}
class TableTransformerModel extends TableTransformerPreTrainedModel {
}
class TableTransformerForObjectDetection extends TableTransformerPreTrainedModel {
  /**
   * @param {any} model_inputs
   */
  async _call(e) {
    return new TableTransformerObjectDetectionOutput(await super._call(e));
  }
}
class TableTransformerObjectDetectionOutput extends DetrObjectDetectionOutput {
}
class DeiTPreTrainedModel extends PreTrainedModel {
}
class DeiTModel extends DeiTPreTrainedModel {
}
class DeiTForImageClassification extends DeiTPreTrainedModel {
  /**
   * @param {any} model_inputs
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class ResNetPreTrainedModel extends PreTrainedModel {
}
class ResNetModel extends ResNetPreTrainedModel {
}
class ResNetForImageClassification extends ResNetPreTrainedModel {
  /**
   * @param {any} model_inputs
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class SwinPreTrainedModel extends PreTrainedModel {
}
class SwinModel extends SwinPreTrainedModel {
}
class SwinForImageClassification extends SwinPreTrainedModel {
  /**
   * @param {any} model_inputs
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class Swin2SRPreTrainedModel extends PreTrainedModel {
}
class Swin2SRModel extends Swin2SRPreTrainedModel {
}
class Swin2SRForImageSuperResolution extends Swin2SRPreTrainedModel {
}
class DPTPreTrainedModel extends PreTrainedModel {
}
class DPTModel extends DPTPreTrainedModel {
}
class DPTForDepthEstimation extends DPTPreTrainedModel {
}
class DepthAnythingPreTrainedModel extends PreTrainedModel {
}
class DepthAnythingForDepthEstimation extends DepthAnythingPreTrainedModel {
}
class GLPNPreTrainedModel extends PreTrainedModel {
}
class GLPNModel extends GLPNPreTrainedModel {
}
class GLPNForDepthEstimation extends GLPNPreTrainedModel {
}
class DonutSwinPreTrainedModel extends PreTrainedModel {
}
class DonutSwinModel extends DonutSwinPreTrainedModel {
}
class ConvNextPreTrainedModel extends PreTrainedModel {
}
class ConvNextModel extends ConvNextPreTrainedModel {
}
class ConvNextForImageClassification extends ConvNextPreTrainedModel {
  /**
   * @param {any} model_inputs
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class ConvNextV2PreTrainedModel extends PreTrainedModel {
}
class ConvNextV2Model extends ConvNextV2PreTrainedModel {
}
class ConvNextV2ForImageClassification extends ConvNextV2PreTrainedModel {
  /**
   * @param {any} model_inputs
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class Dinov2PreTrainedModel extends PreTrainedModel {
}
class Dinov2Model extends Dinov2PreTrainedModel {
}
class Dinov2ForImageClassification extends Dinov2PreTrainedModel {
  /**
   * @param {any} model_inputs
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class YolosPreTrainedModel extends PreTrainedModel {
}
class YolosModel extends YolosPreTrainedModel {
}
class YolosForObjectDetection extends YolosPreTrainedModel {
  /**
   * @param {any} model_inputs
   */
  async _call(e) {
    return new YolosObjectDetectionOutput(await super._call(e));
  }
}
class YolosObjectDetectionOutput extends ModelOutput {
  /**
   * @param {Object} output The output of the model.
   * @param {Tensor} output.logits Classification logits (including no-object) for all queries.
   * @param {Tensor} output.pred_boxes Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height).
   * These values are normalized in [0, 1], relative to the size of each individual image in the batch (disregarding possible padding).
   */
  constructor({ logits: e, pred_boxes: r }) {
    super(), this.logits = e, this.pred_boxes = r;
  }
}
class SamPreTrainedModel extends PreTrainedModel {
}
class SamModel extends SamPreTrainedModel {
  /**
   * Creates a new instance of the `SamModel` class.
   * @param {Object} config The configuration object specifying the hyperparameters and other model settings.
   * @param {Object} vision_encoder The ONNX session containing the vision encoder model.
   * @param {any} prompt_encoder_mask_decoder The ONNX session containing the prompt encoder and mask decoder model.
   */
  constructor(e, r, o) {
    super(e, r), this.prompt_encoder_mask_decoder = o;
  }
  /**
   * Compute image embeddings and positional image embeddings, given the pixel values of an image.
   * @param {Object} model_inputs Object containing the model inputs.
   * @param {Tensor} model_inputs.pixel_values Pixel values obtained using a `SamProcessor`.
   * @returns {Promise<{ image_embeddings: Tensor, image_positional_embeddings: Tensor }>} The image embeddings and positional image embeddings.
   */
  async get_image_embeddings({ pixel_values: e }) {
    return await encoderForward(this, { pixel_values: e });
  }
  /**
   * @typedef {Object} SamModelInputs Object containing the model inputs.
   * @property {Tensor} pixel_values Pixel values as a Tensor with shape `(batch_size, num_channels, height, width)`.
   * These can be obtained using a `SamProcessor`.
   * @property {Tensor} input_points Input 2D spatial points with shape `(batch_size, num_points, 2)`.
   * This is used by the prompt encoder to encode the prompt.
   * @property {Tensor} [input_labels] Input labels for the points, as a Tensor of shape `(batch_size, point_batch_size, num_points)`.
   * This is used by the prompt encoder to encode the prompt. There are 4 types of labels:
   *  - `1`: the point is a point that contains the object of interest
   *  - `0`: the point is a point that does not contain the object of interest
   *  - `-1`: the point corresponds to the background
   *  - `-10`: the point is a padding point, thus should be ignored by the prompt encoder
   * @property {Tensor} [image_embeddings] Image embeddings used by the mask decoder.
   * @property {Tensor} [image_positional_embeddings] Image positional embeddings used by the mask decoder.
   */
  /**
   * @param {SamModelInputs} model_inputs Object containing the model inputs.
   * @returns {Promise<Object>} The output of the model.
   */
  async forward(e) {
    if ((!e.image_embeddings || !e.image_positional_embeddings) && (e = {
      ...e,
      ...await this.get_image_embeddings(e)
    }), !e.input_labels) {
      const r = e.input_points.dims.slice(0, -1), o = r.reduce((m, _) => m * _, 1);
      e.input_labels = new Tensor(
        "int64",
        new BigInt64Array(o).fill(1n),
        r
      );
    }
    return await sessionRun(this.prompt_encoder_mask_decoder, {
      input_points: e.input_points,
      input_labels: e.input_labels,
      image_embeddings: e.image_embeddings,
      image_positional_embeddings: e.image_positional_embeddings
    });
  }
  /**
   * Runs the model with the provided inputs
   * @param {Object} model_inputs Model inputs
   * @returns {Promise<SamImageSegmentationOutput>} Object containing segmentation outputs
   */
  async _call(e) {
    return new SamImageSegmentationOutput(await super._call(e));
  }
}
class SamImageSegmentationOutput extends ModelOutput {
  /**
   * @param {Object} output The output of the model.
   * @param {Tensor} output.iou_scores The output logits of the model.
   * @param {Tensor} output.pred_masks Predicted boxes.
   */
  constructor({ iou_scores: e, pred_masks: r }) {
    super(), this.iou_scores = e, this.pred_masks = r;
  }
}
class MarianPreTrainedModel extends PreTrainedModel {
}
class MarianModel extends MarianPreTrainedModel {
}
class MarianMTModel extends MarianPreTrainedModel {
  /**
   * Creates a new instance of the `MarianMTModel` class.
  * @param {Object} config The model configuration object.
  * @param {Object} session The ONNX session object.
  * @param {any} decoder_merged_session 
  * @param {any} generation_config 
  */
  constructor(e, r, o, m) {
    super(e, r), this.decoder_merged_session = o, this.generation_config = m, this.num_decoder_layers = this.config.decoder_layers, this.num_decoder_heads = this.config.decoder_attention_heads, this.decoder_dim_kv = this.config.d_model / this.num_decoder_heads, this.num_encoder_layers = this.config.encoder_layers, this.num_encoder_heads = this.config.encoder_attention_heads, this.encoder_dim_kv = this.config.d_model / this.num_encoder_heads;
  }
}
class M2M100PreTrainedModel extends PreTrainedModel {
}
class M2M100Model extends M2M100PreTrainedModel {
}
class M2M100ForConditionalGeneration extends M2M100PreTrainedModel {
  /**
   * Creates a new instance of the `M2M100ForConditionalGeneration` class.
  * @param {Object} config The model configuration object.
  * @param {Object} session The ONNX session object.
  * @param {any} decoder_merged_session 
  * @param {any} generation_config 
  */
  constructor(e, r, o, m) {
    super(e, r), this.decoder_merged_session = o, this.generation_config = m, this.num_decoder_layers = this.config.decoder_layers, this.num_decoder_heads = this.config.decoder_attention_heads, this.decoder_dim_kv = this.config.d_model / this.num_decoder_heads, this.num_encoder_layers = this.config.encoder_layers, this.num_encoder_heads = this.config.encoder_attention_heads, this.encoder_dim_kv = this.config.d_model / this.num_encoder_heads;
  }
}
class Wav2Vec2PreTrainedModel extends PreTrainedModel {
}
class Wav2Vec2Model extends Wav2Vec2PreTrainedModel {
}
class Wav2Vec2ForCTC extends Wav2Vec2PreTrainedModel {
  /**
   * @param {Object} model_inputs
   * @param {Tensor} model_inputs.input_values Float values of input raw speech waveform.
   * @param {Tensor} model_inputs.attention_mask Mask to avoid performing convolution and attention on padding token indices. Mask values selected in [0, 1]
   */
  async _call(e) {
    return new CausalLMOutput(await super._call(e));
  }
}
class Wav2Vec2ForSequenceClassification extends Wav2Vec2PreTrainedModel {
  /**
   * Calls the model on new inputs.
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class Wav2Vec2ForAudioFrameClassification extends Wav2Vec2PreTrainedModel {
  /**
   * Calls the model on new inputs.
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for sequence classification.
   */
  async _call(e) {
    return new TokenClassifierOutput(await super._call(e));
  }
}
class UniSpeechPreTrainedModel extends PreTrainedModel {
}
class UniSpeechModel extends UniSpeechPreTrainedModel {
}
class UniSpeechForCTC extends UniSpeechPreTrainedModel {
  /**
   * @param {Object} model_inputs
   * @param {Tensor} model_inputs.input_values Float values of input raw speech waveform.
   * @param {Tensor} model_inputs.attention_mask Mask to avoid performing convolution and attention on padding token indices. Mask values selected in [0, 1]
   */
  async _call(e) {
    return new CausalLMOutput(await super._call(e));
  }
}
class UniSpeechForSequenceClassification extends UniSpeechPreTrainedModel {
  /**
   * Calls the model on new inputs.
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class UniSpeechSatPreTrainedModel extends PreTrainedModel {
}
class UniSpeechSatModel extends UniSpeechSatPreTrainedModel {
}
class UniSpeechSatForCTC extends UniSpeechSatPreTrainedModel {
  /**
   * @param {Object} model_inputs
   * @param {Tensor} model_inputs.input_values Float values of input raw speech waveform.
   * @param {Tensor} model_inputs.attention_mask Mask to avoid performing convolution and attention on padding token indices. Mask values selected in [0, 1]
   */
  async _call(e) {
    return new CausalLMOutput(await super._call(e));
  }
}
class UniSpeechSatForSequenceClassification extends UniSpeechSatPreTrainedModel {
  /**
   * Calls the model on new inputs.
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class UniSpeechSatForAudioFrameClassification extends UniSpeechSatPreTrainedModel {
  /**
   * Calls the model on new inputs.
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for sequence classification.
   */
  async _call(e) {
    return new TokenClassifierOutput(await super._call(e));
  }
}
class Wav2Vec2BertPreTrainedModel extends PreTrainedModel {
}
class Wav2Vec2BertModel extends Wav2Vec2BertPreTrainedModel {
}
class Wav2Vec2BertForCTC extends Wav2Vec2BertPreTrainedModel {
  /**
   * @param {Object} model_inputs
   * @param {Tensor} model_inputs.input_features Float values of input mel-spectrogram.
   * @param {Tensor} model_inputs.attention_mask Mask to avoid performing convolution and attention on padding token indices. Mask values selected in [0, 1]
   */
  async _call(e) {
    return new CausalLMOutput(await super._call(e));
  }
}
class Wav2Vec2BertForSequenceClassification extends Wav2Vec2BertPreTrainedModel {
  /**
   * Calls the model on new inputs.
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class HubertModel extends Wav2Vec2PreTrainedModel {
}
class HubertForCTC extends Wav2Vec2PreTrainedModel {
  /**
   * @param {Object} model_inputs
   * @param {Tensor} model_inputs.input_values Float values of input raw speech waveform.
   * @param {Tensor} model_inputs.attention_mask Mask to avoid performing convolution and attention on padding token indices. Mask values selected in [0, 1]
   */
  async _call(e) {
    return new CausalLMOutput(await super._call(e));
  }
}
class HubertForSequenceClassification extends Wav2Vec2PreTrainedModel {
  /**
   * Calls the model on new inputs.
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class WavLMPreTrainedModel extends PreTrainedModel {
}
class WavLMModel extends WavLMPreTrainedModel {
}
class WavLMForCTC extends WavLMPreTrainedModel {
  /**
   * @param {Object} model_inputs
   * @param {Tensor} model_inputs.input_values Float values of input raw speech waveform.
   * @param {Tensor} model_inputs.attention_mask Mask to avoid performing convolution and attention on padding token indices. Mask values selected in [0, 1]
   */
  async _call(e) {
    return new CausalLMOutput(await super._call(e));
  }
}
class WavLMForSequenceClassification extends WavLMPreTrainedModel {
  /**
   * Calls the model on new inputs.
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class WavLMForXVector extends WavLMPreTrainedModel {
  /**
   * Calls the model on new inputs.
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<XVectorOutput>} An object containing the model's output logits and speaker embeddings.
   */
  async _call(e) {
    return new XVectorOutput(await super._call(e));
  }
}
class WavLMForAudioFrameClassification extends WavLMPreTrainedModel {
  /**
   * Calls the model on new inputs.
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for sequence classification.
   */
  async _call(e) {
    return new TokenClassifierOutput(await super._call(e));
  }
}
class SpeechT5PreTrainedModel extends PreTrainedModel {
}
class SpeechT5ForSpeechToText extends SpeechT5PreTrainedModel {
}
class SpeechT5ForTextToSpeech extends SpeechT5PreTrainedModel {
  /**
   * Creates a new instance of the `SpeechT5ForTextToSpeech` class.
   * @param {Object} config The model configuration.
   * @param {any} session session for the model.
   * @param {any} decoder_merged_session session for the decoder.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o, m) {
    super(e, r), this.decoder_merged_session = o, this.generation_config = m, this.num_decoder_layers = this.config.decoder_layers, this.num_decoder_heads = this.config.decoder_attention_heads, this.decoder_dim_kv = this.config.hidden_size / this.num_decoder_heads, this.num_encoder_layers = this.config.encoder_layers, this.num_encoder_heads = this.config.encoder_attention_heads, this.encoder_dim_kv = this.config.hidden_size / this.num_encoder_heads;
  }
  /**
   * @typedef {Object} SpeechOutput
   * @property {Tensor} [spectrogram] The predicted log-mel spectrogram of shape
   * `(output_sequence_length, config.num_mel_bins)`. Returned when no `vocoder` is provided
   * @property {Tensor} [waveform] The predicted waveform of shape `(num_frames,)`. Returned when a `vocoder` is provided.
   * @property {Tensor} [cross_attentions] The outputs of the decoder's cross-attention layers of shape
   * `(config.decoder_layers, config.decoder_attention_heads, output_sequence_length, input_sequence_length)`. returned when `output_cross_attentions` is `true`.
   */
  /**
   * Converts a sequence of input tokens into a sequence of mel spectrograms, which are subsequently turned into a speech waveform using a vocoder.
   * @param {Tensor} input_values Indices of input sequence tokens in the vocabulary.
   * @param {Tensor} speaker_embeddings Tensor containing the speaker embeddings.
   * @param {Object} options Optional parameters for generating speech.
   * @param {number} [options.threshold=0.5] The generated sequence ends when the predicted stop token probability exceeds this value.
   * @param {number} [options.minlenratio=0.0] Used to calculate the minimum required length for the output sequence.
   * @param {number} [options.maxlenratio=20.0] Used to calculate the maximum allowed length for the output sequence.
   * @param {Object} [options.vocoder=null] The vocoder that converts the mel spectrogram into a speech waveform. If `null`, the output is the mel spectrogram.
   * @param {boolean} [options.output_cross_attentions=false] Whether or not to return the attentions tensors of the decoder's cross-attention layers.
   * @returns {Promise<SpeechOutput>} A promise which resolves to an object containing the spectrogram, waveform, and cross-attention tensors.
   */
  async generate_speech(e, r, {
    threshold: o = 0.5,
    minlenratio: m = 0,
    maxlenratio: _ = 20,
    vocoder: g = null
    // output_cross_attentions = false, // TODO add
  } = {}) {
    const y = {
      input_ids: e
    }, { encoder_outputs: E, encoder_attention_mask: x } = await encoderForward(this, y), v = E.dims[1] / this.config.reduction_factor, h = Math.floor(v * _), a = Math.floor(v * m), b = this.config.num_mel_bins;
    let w = [], k = null, A = null, M = 0;
    for (; ; ) {
      ++M;
      const C = boolTensor(!!A);
      let P;
      A ? P = A.output_sequence_out : P = new Tensor(
        "float32",
        new Float32Array(b),
        [1, 1, b]
      );
      let I = {
        use_cache_branch: C,
        output_sequence: P,
        encoder_attention_mask: x,
        speaker_embeddings: r,
        encoder_hidden_states: E
      };
      this.addPastKeyValues(I, k), A = await sessionRun(this.decoder_merged_session, I), k = this.getPastKeyValues(A, k);
      const { prob: N, spectrum: R } = A;
      if (w.push(R), M >= a && // Finished when stop token or maximum length is reached.
      (Array.from(N.data).filter((F) => F >= o).length > 0 || M >= h))
        break;
    }
    const $ = cat(w), { waveform: O } = await sessionRun(g.session, { spectrogram: $ });
    return {
      spectrogram: $,
      waveform: O
      // cross_attentions: null, // TODO add
    };
  }
}
class SpeechT5HifiGan extends PreTrainedModel {
  constructor() {
    super(...arguments);
    be(this, "main_input_name", "spectrogram");
  }
}
class TrOCRPreTrainedModel extends PreTrainedModel {
  /**
   * Creates a new instance of the `TrOCRPreTrainedModel` class.
   * @param {Object} config The configuration of the model.
   * @param {any} session The ONNX session containing the model weights.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o) {
    super(e, r), this.generation_config = o, this.config.pad_token_id = this.config.eos_token_id, this.num_encoder_layers = this.num_decoder_layers = this.config.decoder_layers, this.num_encoder_heads = this.num_decoder_heads = this.config.decoder_attention_heads, this.encoder_dim_kv = this.decoder_dim_kv = this.config.d_model / this.num_decoder_heads;
  }
}
class TrOCRForCausalLM extends TrOCRPreTrainedModel {
}
class MistralPreTrainedModel extends PreTrainedModel {
  /**
   * Creates a new instance of the `MistralPreTrainedModel` class.
   * @param {Object} config The configuration of the model.
   * @param {any} session The ONNX session containing the model weights.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o) {
    super(e, r), this.generation_config = o, this.config.pad_token_id = this.config.eos_token_id, this.num_heads = this.config.num_key_value_heads, this.num_layers = this.config.num_hidden_layers, this.dim_kv = this.config.hidden_size / this.config.num_attention_heads;
  }
}
class MistralModel extends MistralPreTrainedModel {
}
class MistralForCausalLM extends MistralPreTrainedModel {
}
class Starcoder2PreTrainedModel extends PreTrainedModel {
  /**
   * Creates a new instance of the `Starcoder2PreTrainedModel` class.
   * @param {Object} config The configuration of the model.
   * @param {any} session The ONNX session containing the model weights.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o) {
    super(e, r), this.generation_config = o, this.config.pad_token_id = this.config.eos_token_id, this.num_heads = this.config.num_key_value_heads, this.num_layers = this.config.num_hidden_layers, this.dim_kv = this.config.hidden_size / this.config.num_attention_heads;
  }
}
class Starcoder2Model extends Starcoder2PreTrainedModel {
}
class Starcoder2ForCausalLM extends Starcoder2PreTrainedModel {
}
class FalconPreTrainedModel extends PreTrainedModel {
  /**
   * Creates a new instance of the `FalconPreTrainedModel` class.
   * @param {Object} config The configuration of the model.
   * @param {any} session The ONNX session containing the model weights.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o) {
    super(e, r), this.generation_config = o, this.config.pad_token_id = this.config.eos_token_id, this.num_heads = this.config.num_attention_heads, this.num_layers = this.config.num_hidden_layers, this.dim_kv = this.config.hidden_size / this.config.num_attention_heads;
  }
}
class FalconModel extends FalconPreTrainedModel {
}
class FalconForCausalLM extends FalconPreTrainedModel {
}
class ClapPreTrainedModel extends PreTrainedModel {
}
class ClapModel extends ClapPreTrainedModel {
}
class ClapTextModelWithProjection extends ClapPreTrainedModel {
  /** @type {PreTrainedModel.from_pretrained} */
  static async from_pretrained(e, r = {}) {
    return r.model_file_name ?? (r.model_file_name = "text_model"), super.from_pretrained(e, r);
  }
}
class ClapAudioModelWithProjection extends ClapPreTrainedModel {
  /** @type {PreTrainedModel.from_pretrained} */
  static async from_pretrained(e, r = {}) {
    return r.model_file_name ?? (r.model_file_name = "audio_model"), super.from_pretrained(e, r);
  }
}
class VitsPreTrainedModel extends PreTrainedModel {
}
class VitsModel extends VitsPreTrainedModel {
  /**
   * Calls the model on new inputs.
   * @param {Object} model_inputs The inputs to the model.
   * @returns {Promise<VitsModelOutput>} The outputs for the VITS model.
   */
  async _call(e) {
    return new VitsModelOutput(await super._call(e));
  }
}
class SegformerPreTrainedModel extends PreTrainedModel {
}
class SegformerForImageClassification extends SegformerPreTrainedModel {
}
class SegformerForSemanticSegmentation extends SegformerPreTrainedModel {
}
class StableLmPreTrainedModel extends PreTrainedModel {
  /**
   * Creates a new instance of the `StableLmPreTrainedModel` class.
   * @param {Object} config The configuration of the model.
   * @param {any} session The ONNX session containing the model weights.
   * @param {GenerationConfig} generation_config The generation configuration.
   */
  constructor(e, r, o) {
    super(e, r), this.generation_config = o, this.config.pad_token_id = this.config.eos_token_id, this.num_heads = this.config.num_attention_heads, this.num_layers = this.config.num_hidden_layers, this.dim_kv = this.config.hidden_size / this.num_heads;
  }
}
class StableLmForCausalLM extends StableLmPreTrainedModel {
}
class EfficientNetPreTrainedModel extends PreTrainedModel {
}
class EfficientNetModel extends EfficientNetPreTrainedModel {
}
class EfficientNetForImageClassification extends EfficientNetPreTrainedModel {
  /**
   * @param {any} model_inputs
   */
  async _call(e) {
    return new SequenceClassifierOutput(await super._call(e));
  }
}
class PretrainedMixin {
  /** @type {PreTrainedModel.from_pretrained} */
  static async from_pretrained(e, {
    quantized: r = !0,
    progress_callback: o = null,
    config: m = null,
    cache_dir: _ = null,
    local_files_only: g = !1,
    revision: y = "main",
    model_file_name: E = null
  } = {}) {
    let x = {
      quantized: r,
      progress_callback: o,
      config: m,
      cache_dir: _,
      local_files_only: g,
      revision: y,
      model_file_name: E
    };
    if (m = await AutoConfig.from_pretrained(e, x), x.config || (x.config = m), !this.MODEL_CLASS_MAPPINGS)
      throw new Error("`MODEL_CLASS_MAPPINGS` not implemented for this type of `AutoClass`: " + this.name);
    for (let v of this.MODEL_CLASS_MAPPINGS) {
      const h = v.get(m.model_type);
      if (h)
        return await h[1].from_pretrained(e, x);
    }
    if (this.BASE_IF_FAIL)
      return console.warn(`Unknown model class "${m.model_type}", attempting to construct from base class.`), await PreTrainedModel.from_pretrained(e, x);
    throw Error(`Unsupported model type: ${m.model_type}`);
  }
}
/**
 * Mapping from model type to model class.
 * @type {Map<string, Object>[]}
 */
be(PretrainedMixin, "MODEL_CLASS_MAPPINGS", null), /**
 * Whether to attempt to instantiate the base class (`PretrainedModel`) if 
 * the model type is not found in the mapping.
 */
be(PretrainedMixin, "BASE_IF_FAIL", !1);
const MODEL_MAPPING_NAMES_ENCODER_ONLY = /* @__PURE__ */ new Map([
  ["bert", ["BertModel", BertModel]],
  ["nomic_bert", ["NomicBertModel", NomicBertModel]],
  ["roformer", ["RoFormerModel", RoFormerModel]],
  ["electra", ["ElectraModel", ElectraModel]],
  ["esm", ["EsmModel", EsmModel]],
  ["convbert", ["ConvBertModel", ConvBertModel]],
  ["camembert", ["CamembertModel", CamembertModel]],
  ["deberta", ["DebertaModel", DebertaModel]],
  ["deberta-v2", ["DebertaV2Model", DebertaV2Model]],
  ["mpnet", ["MPNetModel", MPNetModel]],
  ["albert", ["AlbertModel", AlbertModel]],
  ["distilbert", ["DistilBertModel", DistilBertModel]],
  ["roberta", ["RobertaModel", RobertaModel]],
  ["xlm", ["XLMModel", XLMModel]],
  ["xlm-roberta", ["XLMRobertaModel", XLMRobertaModel]],
  ["clap", ["ClapModel", ClapModel]],
  ["clip", ["CLIPModel", CLIPModel]],
  ["clipseg", ["CLIPSegModel", CLIPSegModel]],
  ["chinese_clip", ["ChineseCLIPModel", ChineseCLIPModel]],
  ["siglip", ["SiglipModel", SiglipModel]],
  ["mobilebert", ["MobileBertModel", MobileBertModel]],
  ["squeezebert", ["SqueezeBertModel", SqueezeBertModel]],
  ["wav2vec2", ["Wav2Vec2Model", Wav2Vec2Model]],
  ["wav2vec2-bert", ["Wav2Vec2BertModel", Wav2Vec2BertModel]],
  ["unispeech", ["UniSpeechModel", UniSpeechModel]],
  ["unispeech-sat", ["UniSpeechSatModel", UniSpeechSatModel]],
  ["hubert", ["HubertModel", HubertModel]],
  ["wavlm", ["WavLMModel", WavLMModel]],
  ["audio-spectrogram-transformer", ["ASTModel", ASTModel]],
  ["vits", ["VitsModel", VitsModel]],
  ["detr", ["DetrModel", DetrModel]],
  ["table-transformer", ["TableTransformerModel", TableTransformerModel]],
  ["vit", ["ViTModel", ViTModel]],
  ["fastvit", ["FastViTModel", FastViTModel]],
  ["mobilevit", ["MobileViTModel", MobileViTModel]],
  ["mobilevitv2", ["MobileViTV2Model", MobileViTV2Model]],
  ["owlvit", ["OwlViTModel", OwlViTModel]],
  ["owlv2", ["Owlv2Model", Owlv2Model]],
  ["beit", ["BeitModel", BeitModel]],
  ["deit", ["DeiTModel", DeiTModel]],
  ["convnext", ["ConvNextModel", ConvNextModel]],
  ["convnextv2", ["ConvNextV2Model", ConvNextV2Model]],
  ["dinov2", ["Dinov2Model", Dinov2Model]],
  ["resnet", ["ResNetModel", ResNetModel]],
  ["swin", ["SwinModel", SwinModel]],
  ["swin2sr", ["Swin2SRModel", Swin2SRModel]],
  ["donut-swin", ["DonutSwinModel", DonutSwinModel]],
  ["yolos", ["YolosModel", YolosModel]],
  ["dpt", ["DPTModel", DPTModel]],
  ["glpn", ["GLPNModel", GLPNModel]],
  ["hifigan", ["SpeechT5HifiGan", SpeechT5HifiGan]],
  ["efficientnet", ["EfficientNetModel", EfficientNetModel]]
]), MODEL_MAPPING_NAMES_ENCODER_DECODER = /* @__PURE__ */ new Map([
  ["t5", ["T5Model", T5Model]],
  ["longt5", ["LongT5Model", LongT5Model]],
  ["mt5", ["MT5Model", MT5Model]],
  ["bart", ["BartModel", BartModel]],
  ["mbart", ["MBartModel", MBartModel]],
  ["marian", ["MarianModel", MarianModel]],
  ["whisper", ["WhisperModel", WhisperModel]],
  ["m2m_100", ["M2M100Model", M2M100Model]],
  ["blenderbot", ["BlenderbotModel", BlenderbotModel]],
  ["blenderbot-small", ["BlenderbotSmallModel", BlenderbotSmallModel]]
]), MODEL_MAPPING_NAMES_DECODER_ONLY = /* @__PURE__ */ new Map([
  ["bloom", ["BloomModel", BloomModel]],
  ["gpt2", ["GPT2Model", GPT2Model]],
  ["gptj", ["GPTJModel", GPTJModel]],
  ["gpt_bigcode", ["GPTBigCodeModel", GPTBigCodeModel]],
  ["gpt_neo", ["GPTNeoModel", GPTNeoModel]],
  ["gpt_neox", ["GPTNeoXModel", GPTNeoXModel]],
  ["codegen", ["CodeGenModel", CodeGenModel]],
  ["llama", ["LlamaModel", LlamaModel]],
  ["qwen2", ["Qwen2Model", Qwen2Model]],
  ["phi", ["PhiModel", PhiModel]],
  ["mpt", ["MptModel", MptModel]],
  ["opt", ["OPTModel", OPTModel]],
  ["mistral", ["MistralModel", MistralModel]],
  ["starcoder2", ["Starcoder2Model", Starcoder2Model]],
  ["falcon", ["FalconModel", FalconModel]]
]), MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["speecht5", ["SpeechT5ForSpeechToText", SpeechT5ForSpeechToText]],
  ["whisper", ["WhisperForConditionalGeneration", WhisperForConditionalGeneration]]
]), MODEL_FOR_TEXT_TO_SPECTROGRAM_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["speecht5", ["SpeechT5ForTextToSpeech", SpeechT5ForTextToSpeech]]
]), MODEL_FOR_TEXT_TO_WAVEFORM_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["vits", ["VitsModel", VitsModel]]
]), MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["bert", ["BertForSequenceClassification", BertForSequenceClassification]],
  ["roformer", ["RoFormerForSequenceClassification", RoFormerForSequenceClassification]],
  ["electra", ["ElectraForSequenceClassification", ElectraForSequenceClassification]],
  ["esm", ["EsmForSequenceClassification", EsmForSequenceClassification]],
  ["convbert", ["ConvBertForSequenceClassification", ConvBertForSequenceClassification]],
  ["camembert", ["CamembertForSequenceClassification", CamembertForSequenceClassification]],
  ["deberta", ["DebertaForSequenceClassification", DebertaForSequenceClassification]],
  ["deberta-v2", ["DebertaV2ForSequenceClassification", DebertaV2ForSequenceClassification]],
  ["mpnet", ["MPNetForSequenceClassification", MPNetForSequenceClassification]],
  ["albert", ["AlbertForSequenceClassification", AlbertForSequenceClassification]],
  ["distilbert", ["DistilBertForSequenceClassification", DistilBertForSequenceClassification]],
  ["roberta", ["RobertaForSequenceClassification", RobertaForSequenceClassification]],
  ["xlm", ["XLMForSequenceClassification", XLMForSequenceClassification]],
  ["xlm-roberta", ["XLMRobertaForSequenceClassification", XLMRobertaForSequenceClassification]],
  ["bart", ["BartForSequenceClassification", BartForSequenceClassification]],
  ["mbart", ["MBartForSequenceClassification", MBartForSequenceClassification]],
  ["mobilebert", ["MobileBertForSequenceClassification", MobileBertForSequenceClassification]],
  ["squeezebert", ["SqueezeBertForSequenceClassification", SqueezeBertForSequenceClassification]]
]), MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["bert", ["BertForTokenClassification", BertForTokenClassification]],
  ["roformer", ["RoFormerForTokenClassification", RoFormerForTokenClassification]],
  ["electra", ["ElectraForTokenClassification", ElectraForTokenClassification]],
  ["esm", ["EsmForTokenClassification", EsmForTokenClassification]],
  ["convbert", ["ConvBertForTokenClassification", ConvBertForTokenClassification]],
  ["camembert", ["CamembertForTokenClassification", CamembertForTokenClassification]],
  ["deberta", ["DebertaForTokenClassification", DebertaForTokenClassification]],
  ["deberta-v2", ["DebertaV2ForTokenClassification", DebertaV2ForTokenClassification]],
  ["mpnet", ["MPNetForTokenClassification", MPNetForTokenClassification]],
  ["distilbert", ["DistilBertForTokenClassification", DistilBertForTokenClassification]],
  ["roberta", ["RobertaForTokenClassification", RobertaForTokenClassification]],
  ["xlm", ["XLMForTokenClassification", XLMForTokenClassification]],
  ["xlm-roberta", ["XLMRobertaForTokenClassification", XLMRobertaForTokenClassification]]
]), MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["t5", ["T5ForConditionalGeneration", T5ForConditionalGeneration]],
  ["longt5", ["LongT5ForConditionalGeneration", LongT5ForConditionalGeneration]],
  ["mt5", ["MT5ForConditionalGeneration", MT5ForConditionalGeneration]],
  ["bart", ["BartForConditionalGeneration", BartForConditionalGeneration]],
  ["mbart", ["MBartForConditionalGeneration", MBartForConditionalGeneration]],
  ["marian", ["MarianMTModel", MarianMTModel]],
  ["m2m_100", ["M2M100ForConditionalGeneration", M2M100ForConditionalGeneration]],
  ["blenderbot", ["BlenderbotForConditionalGeneration", BlenderbotForConditionalGeneration]],
  ["blenderbot-small", ["BlenderbotSmallForConditionalGeneration", BlenderbotSmallForConditionalGeneration]]
]), MODEL_WITH_LM_HEAD_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["bloom", ["BloomForCausalLM", BloomForCausalLM]],
  ["gpt2", ["GPT2LMHeadModel", GPT2LMHeadModel]],
  ["gptj", ["GPTJForCausalLM", GPTJForCausalLM]],
  ["gpt_bigcode", ["GPTBigCodeForCausalLM", GPTBigCodeForCausalLM]],
  ["gpt_neo", ["GPTNeoForCausalLM", GPTNeoForCausalLM]],
  ["gpt_neox", ["GPTNeoXForCausalLM", GPTNeoXForCausalLM]],
  ["codegen", ["CodeGenForCausalLM", CodeGenForCausalLM]],
  ["llama", ["LlamaForCausalLM", LlamaForCausalLM]],
  ["qwen2", ["Qwen2ForCausalLM", Qwen2ForCausalLM]],
  ["phi", ["PhiForCausalLM", PhiForCausalLM]],
  ["mpt", ["MptForCausalLM", MptForCausalLM]],
  ["opt", ["OPTForCausalLM", OPTForCausalLM]],
  ["mbart", ["MBartForCausalLM", MBartForCausalLM]],
  ["mistral", ["MistralForCausalLM", MistralForCausalLM]],
  ["starcoder2", ["Starcoder2ForCausalLM", Starcoder2ForCausalLM]],
  ["falcon", ["FalconForCausalLM", FalconForCausalLM]],
  ["trocr", ["TrOCRForCausalLM", TrOCRForCausalLM]],
  ["stablelm", ["StableLmForCausalLM", StableLmForCausalLM]]
]), MODEL_FOR_MASKED_LM_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["bert", ["BertForMaskedLM", BertForMaskedLM]],
  ["roformer", ["RoFormerForMaskedLM", RoFormerForMaskedLM]],
  ["electra", ["ElectraForMaskedLM", ElectraForMaskedLM]],
  ["esm", ["EsmForMaskedLM", EsmForMaskedLM]],
  ["convbert", ["ConvBertForMaskedLM", ConvBertForMaskedLM]],
  ["camembert", ["CamembertForMaskedLM", CamembertForMaskedLM]],
  ["deberta", ["DebertaForMaskedLM", DebertaForMaskedLM]],
  ["deberta-v2", ["DebertaV2ForMaskedLM", DebertaV2ForMaskedLM]],
  ["mpnet", ["MPNetForMaskedLM", MPNetForMaskedLM]],
  ["albert", ["AlbertForMaskedLM", AlbertForMaskedLM]],
  ["distilbert", ["DistilBertForMaskedLM", DistilBertForMaskedLM]],
  ["roberta", ["RobertaForMaskedLM", RobertaForMaskedLM]],
  ["xlm", ["XLMWithLMHeadModel", XLMWithLMHeadModel]],
  ["xlm-roberta", ["XLMRobertaForMaskedLM", XLMRobertaForMaskedLM]],
  ["mobilebert", ["MobileBertForMaskedLM", MobileBertForMaskedLM]],
  ["squeezebert", ["SqueezeBertForMaskedLM", SqueezeBertForMaskedLM]]
]), MODEL_FOR_QUESTION_ANSWERING_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["bert", ["BertForQuestionAnswering", BertForQuestionAnswering]],
  ["roformer", ["RoFormerForQuestionAnswering", RoFormerForQuestionAnswering]],
  ["electra", ["ElectraForQuestionAnswering", ElectraForQuestionAnswering]],
  ["convbert", ["ConvBertForQuestionAnswering", ConvBertForQuestionAnswering]],
  ["camembert", ["CamembertForQuestionAnswering", CamembertForQuestionAnswering]],
  ["deberta", ["DebertaForQuestionAnswering", DebertaForQuestionAnswering]],
  ["deberta-v2", ["DebertaV2ForQuestionAnswering", DebertaV2ForQuestionAnswering]],
  ["mpnet", ["MPNetForQuestionAnswering", MPNetForQuestionAnswering]],
  ["albert", ["AlbertForQuestionAnswering", AlbertForQuestionAnswering]],
  ["distilbert", ["DistilBertForQuestionAnswering", DistilBertForQuestionAnswering]],
  ["roberta", ["RobertaForQuestionAnswering", RobertaForQuestionAnswering]],
  ["xlm", ["XLMForQuestionAnswering", XLMForQuestionAnswering]],
  ["xlm-roberta", ["XLMRobertaForQuestionAnswering", XLMRobertaForQuestionAnswering]],
  ["mobilebert", ["MobileBertForQuestionAnswering", MobileBertForQuestionAnswering]],
  ["squeezebert", ["SqueezeBertForQuestionAnswering", SqueezeBertForQuestionAnswering]]
]), MODEL_FOR_VISION_2_SEQ_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["vision-encoder-decoder", ["VisionEncoderDecoderModel", VisionEncoderDecoderModel]]
]), MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["vit", ["ViTForImageClassification", ViTForImageClassification]],
  ["fastvit", ["FastViTForImageClassification", FastViTForImageClassification]],
  ["mobilevit", ["MobileViTForImageClassification", MobileViTForImageClassification]],
  ["mobilevitv2", ["MobileViTV2ForImageClassification", MobileViTV2ForImageClassification]],
  ["beit", ["BeitForImageClassification", BeitForImageClassification]],
  ["deit", ["DeiTForImageClassification", DeiTForImageClassification]],
  ["convnext", ["ConvNextForImageClassification", ConvNextForImageClassification]],
  ["convnextv2", ["ConvNextV2ForImageClassification", ConvNextV2ForImageClassification]],
  ["dinov2", ["Dinov2ForImageClassification", Dinov2ForImageClassification]],
  ["resnet", ["ResNetForImageClassification", ResNetForImageClassification]],
  ["swin", ["SwinForImageClassification", SwinForImageClassification]],
  ["segformer", ["SegformerForImageClassification", SegformerForImageClassification]],
  ["efficientnet", ["EfficientNetForImageClassification", EfficientNetForImageClassification]]
]), MODEL_FOR_OBJECT_DETECTION_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["detr", ["DetrForObjectDetection", DetrForObjectDetection]],
  ["table-transformer", ["TableTransformerForObjectDetection", TableTransformerForObjectDetection]],
  ["yolos", ["YolosForObjectDetection", YolosForObjectDetection]]
]), MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["owlvit", ["OwlViTForObjectDetection", OwlViTForObjectDetection]],
  ["owlv2", ["Owlv2ForObjectDetection", Owlv2ForObjectDetection]]
]), MODEL_FOR_IMAGE_SEGMENTATION_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["detr", ["DetrForSegmentation", DetrForSegmentation]],
  ["clipseg", ["CLIPSegForImageSegmentation", CLIPSegForImageSegmentation]]
]), MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["segformer", ["SegformerForSemanticSegmentation", SegformerForSemanticSegmentation]]
]), MODEL_FOR_MASK_GENERATION_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["sam", ["SamModel", SamModel]]
]), MODEL_FOR_CTC_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["wav2vec2", ["Wav2Vec2ForCTC", Wav2Vec2ForCTC]],
  ["wav2vec2-bert", ["Wav2Vec2BertForCTC", Wav2Vec2BertForCTC]],
  ["unispeech", ["UniSpeechForCTC", UniSpeechForCTC]],
  ["unispeech-sat", ["UniSpeechSatForCTC", UniSpeechSatForCTC]],
  ["wavlm", ["WavLMForCTC", WavLMForCTC]],
  ["hubert", ["HubertForCTC", HubertForCTC]]
]), MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["wav2vec2", ["Wav2Vec2ForSequenceClassification", Wav2Vec2ForSequenceClassification]],
  ["wav2vec2-bert", ["Wav2Vec2BertForSequenceClassification", Wav2Vec2BertForSequenceClassification]],
  ["unispeech", ["UniSpeechForSequenceClassification", UniSpeechForSequenceClassification]],
  ["unispeech-sat", ["UniSpeechSatForSequenceClassification", UniSpeechSatForSequenceClassification]],
  ["wavlm", ["WavLMForSequenceClassification", WavLMForSequenceClassification]],
  ["hubert", ["HubertForSequenceClassification", HubertForSequenceClassification]],
  ["audio-spectrogram-transformer", ["ASTForAudioClassification", ASTForAudioClassification]]
]), MODEL_FOR_AUDIO_XVECTOR_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["wavlm", ["WavLMForXVector", WavLMForXVector]]
]), MODEL_FOR_AUDIO_FRAME_CLASSIFICATION_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["unispeech-sat", ["UniSpeechSatForAudioFrameClassification", UniSpeechSatForAudioFrameClassification]],
  ["wavlm", ["WavLMForAudioFrameClassification", WavLMForAudioFrameClassification]],
  ["wav2vec2", ["Wav2Vec2ForAudioFrameClassification", Wav2Vec2ForAudioFrameClassification]]
]), MODEL_FOR_IMAGE_MATTING_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["vitmatte", ["VitMatteForImageMatting", VitMatteForImageMatting]]
]), MODEL_FOR_IMAGE_TO_IMAGE_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["swin2sr", ["Swin2SRForImageSuperResolution", Swin2SRForImageSuperResolution]]
]), MODEL_FOR_DEPTH_ESTIMATION_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["dpt", ["DPTForDepthEstimation", DPTForDepthEstimation]],
  ["depth_anything", ["DepthAnythingForDepthEstimation", DepthAnythingForDepthEstimation]],
  ["glpn", ["GLPNForDepthEstimation", GLPNForDepthEstimation]]
]), MODEL_FOR_IMAGE_FEATURE_EXTRACTION_MAPPING_NAMES = /* @__PURE__ */ new Map([
  ["clip", ["CLIPVisionModelWithProjection", CLIPVisionModelWithProjection]],
  ["siglip", ["SiglipVisionModel", SiglipVisionModel]]
]), MODEL_CLASS_TYPE_MAPPING = [
  [MODEL_MAPPING_NAMES_ENCODER_ONLY, MODEL_TYPES.EncoderOnly],
  [MODEL_MAPPING_NAMES_ENCODER_DECODER, MODEL_TYPES.EncoderDecoder],
  [MODEL_MAPPING_NAMES_DECODER_ONLY, MODEL_TYPES.DecoderOnly],
  [MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
  [MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
  [MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES, MODEL_TYPES.Seq2Seq],
  [MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES, MODEL_TYPES.Seq2Seq],
  [MODEL_WITH_LM_HEAD_MAPPING_NAMES, MODEL_TYPES.DecoderOnly],
  [MODEL_FOR_MASKED_LM_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
  [MODEL_FOR_QUESTION_ANSWERING_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
  [MODEL_FOR_VISION_2_SEQ_MAPPING_NAMES, MODEL_TYPES.Vision2Seq],
  [MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
  [MODEL_FOR_IMAGE_SEGMENTATION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
  [MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
  [MODEL_FOR_IMAGE_MATTING_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
  [MODEL_FOR_IMAGE_TO_IMAGE_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
  [MODEL_FOR_DEPTH_ESTIMATION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
  [MODEL_FOR_OBJECT_DETECTION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
  [MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
  [MODEL_FOR_MASK_GENERATION_MAPPING_NAMES, MODEL_TYPES.MaskGeneration],
  [MODEL_FOR_CTC_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
  [MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
  [MODEL_FOR_TEXT_TO_SPECTROGRAM_MAPPING_NAMES, MODEL_TYPES.Seq2Seq],
  [MODEL_FOR_TEXT_TO_WAVEFORM_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
  [MODEL_FOR_AUDIO_XVECTOR_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
  [MODEL_FOR_AUDIO_FRAME_CLASSIFICATION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
  // Custom:
  [MODEL_FOR_IMAGE_FEATURE_EXTRACTION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly]
];
for (const [s, e] of MODEL_CLASS_TYPE_MAPPING)
  for (const [r, o] of s.values())
    MODEL_TYPE_MAPPING.set(r, e), MODEL_CLASS_TO_NAME_MAPPING.set(o, r), MODEL_NAME_TO_CLASS_MAPPING.set(r, o);
const CUSTOM_MAPPING = [
  ["CLIPTextModelWithProjection", CLIPTextModelWithProjection, MODEL_TYPES.EncoderOnly],
  ["SiglipTextModel", SiglipTextModel, MODEL_TYPES.EncoderOnly],
  ["ClapTextModelWithProjection", ClapTextModelWithProjection, MODEL_TYPES.EncoderOnly],
  ["ClapAudioModelWithProjection", ClapAudioModelWithProjection, MODEL_TYPES.EncoderOnly]
];
for (const [s, e, r] of CUSTOM_MAPPING)
  MODEL_TYPE_MAPPING.set(s, r), MODEL_CLASS_TO_NAME_MAPPING.set(e, s), MODEL_NAME_TO_CLASS_MAPPING.set(s, e);
class AutoModel extends PretrainedMixin {
}
/** @type {Map<string, Object>[]} */
// @ts-ignore
be(AutoModel, "MODEL_CLASS_MAPPINGS", MODEL_CLASS_TYPE_MAPPING.map((e) => e[0])), be(AutoModel, "BASE_IF_FAIL", !0);
class Seq2SeqLMOutput extends ModelOutput {
  /**
   * @param {Object} output The output of the model.
   * @param {Tensor} output.logits The output logits of the model.
   * @param {Tensor} output.past_key_values An tensor of key/value pairs that represent the previous state of the model.
   * @param {Tensor} output.encoder_outputs The output of the encoder in a sequence-to-sequence model.
   * @param {Tensor} [output.decoder_attentions] Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the self-attention heads.
   * @param {Tensor} [output.cross_attentions] Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the weighted average in the cross-attention heads.
   */
  constructor({ logits: e, past_key_values: r, encoder_outputs: o, decoder_attentions: m = null, cross_attentions: _ = null }) {
    super(), this.logits = e, this.past_key_values = r, this.encoder_outputs = o, this.decoder_attentions = m, this.cross_attentions = _;
  }
}
class SequenceClassifierOutput extends ModelOutput {
  /**
   * @param {Object} output The output of the model.
   * @param {Tensor} output.logits classification (or regression if config.num_labels==1) scores (before SoftMax).
   */
  constructor({ logits: e }) {
    super(), this.logits = e;
  }
}
class XVectorOutput extends ModelOutput {
  /**
   * @param {Object} output The output of the model.
   * @param {Tensor} output.logits Classification hidden states before AMSoftmax, of shape `(batch_size, config.xvector_output_dim)`.
   * @param {Tensor} output.embeddings Utterance embeddings used for vector similarity-based retrieval, of shape `(batch_size, config.xvector_output_dim)`.
   */
  constructor({ logits: e, embeddings: r }) {
    super(), this.logits = e, this.embeddings = r;
  }
}
class TokenClassifierOutput extends ModelOutput {
  /**
   * @param {Object} output The output of the model.
   * @param {Tensor} output.logits Classification scores (before SoftMax).
   */
  constructor({ logits: e }) {
    super(), this.logits = e;
  }
}
class MaskedLMOutput extends ModelOutput {
  /**
   * @param {Object} output The output of the model.
   * @param {Tensor} output.logits Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
   */
  constructor({ logits: e }) {
    super(), this.logits = e;
  }
}
class QuestionAnsweringModelOutput extends ModelOutput {
  /**
   * @param {Object} output The output of the model.
   * @param {Tensor} output.start_logits Span-start scores (before SoftMax).
   * @param {Tensor} output.end_logits Span-end scores (before SoftMax).
   */
  constructor({ start_logits: e, end_logits: r }) {
    super(), this.start_logits = e, this.end_logits = r;
  }
}
class CausalLMOutput extends ModelOutput {
  /**
   * @param {Object} output The output of the model.
   * @param {Tensor} output.logits Prediction scores of the language modeling head (scores for each vocabulary token before softmax).
   */
  constructor({ logits: e }) {
    super(), this.logits = e;
  }
}
class ImageMattingOutput extends ModelOutput {
  /**
   * @param {Object} output The output of the model.
   * @param {Tensor} output.alphas Estimated alpha values, of shape `(batch_size, num_channels, height, width)`.
   */
  constructor({ alphas: e }) {
    super(), this.alphas = e;
  }
}
class VitsModelOutput extends ModelOutput {
  /**
   * @param {Object} output The output of the model.
   * @param {Tensor} output.waveform The final audio waveform predicted by the model, of shape `(batch_size, sequence_length)`.
   * @param {Tensor} output.spectrogram The log-mel spectrogram predicted at the output of the flow model.
   * This spectrogram is passed to the Hi-Fi GAN decoder model to obtain the final audio waveform.
   */
  constructor({ waveform: e, spectrogram: r }) {
    super(), this.waveform = e, this.spectrogram = r;
  }
}
const BROWSER_ENV = typeof self < "u";
if (!BROWSER_ENV) {
  if (!sharp) throw new Error("Unable to load image processing library.");
}
const {
  SvelteComponent,
  add_flush_callback,
  append_hydration,
  assign,
  attr,
  bind,
  binding_callbacks,
  check_outros,
  children,
  claim_component,
  claim_element,
  claim_space,
  claim_text,
  create_component,
  destroy_component,
  destroy_each,
  detach,
  element,
  empty,
  ensure_array_like,
  flush,
  get_spread_object,
  get_spread_update,
  group_outros,
  init,
  insert_hydration,
  listen,
  mount_component,
  safe_not_equal,
  set_data,
  set_style,
  space,
  text,
  transition_in,
  transition_out
} = window.__gradio__svelte__internal, { onMount } = window.__gradio__svelte__internal;
function get_each_context(s, e, r) {
  const o = s.slice();
  return o[42] = e[r], o[44] = r, o;
}
function create_if_block_7(s) {
  let e, r;
  const o = [
    /*loading_status*/
    s[20]
  ];
  let m = {};
  for (let _ = 0; _ < o.length; _ += 1)
    m = assign(m, o[_]);
  return e = new Static({ props: m }), e.$on(
    "clear_status",
    /*clear_status_handler*/
    s[32]
  ), {
    c() {
      create_component(e.$$.fragment);
    },
    l(_) {
      claim_component(e.$$.fragment, _);
    },
    m(_, g) {
      mount_component(e, _, g), r = !0;
    },
    p(_, g) {
      const y = g[0] & /*loading_status*/
      1048576 ? get_spread_update(o, [get_spread_object(
        /*loading_status*/
        _[20]
      )]) : {};
      e.$set(y);
    },
    i(_) {
      r || (transition_in(e.$$.fragment, _), r = !0);
    },
    o(_) {
      transition_out(e.$$.fragment, _), r = !1;
    },
    d(_) {
      destroy_component(e, _);
    }
  };
}
function create_if_block_6(s) {
  var P, I, N, R;
  let e, r, o, m, _, g, y, E, x, v, h, a = (
    /*value*/
    (((I = (P = s[0]) == null ? void 0 : P.tokens) == null ? void 0 : I.length) || 0) + ""
  ), b, w, k, A, M = (
    /*value*/
    (((R = (N = s[0]) == null ? void 0 : N.text) == null ? void 0 : R.length) || 0) + ""
  ), $, O, C;
  return {
    c() {
      e = element("div"), r = element("input"), m = space(), _ = element("label"), g = text("Preview tokens"), E = space(), x = element("div"), v = element("span"), h = text("Tokens: "), b = text(a), w = space(), k = element("span"), A = text("Characters: "), $ = text(M), this.h();
    },
    l(F) {
      e = claim_element(F, "DIV", { class: !0 });
      var B = children(e);
      r = claim_element(B, "INPUT", { type: !0, id: !0, class: !0 }), m = claim_space(B), _ = claim_element(B, "LABEL", { for: !0, class: !0 });
      var G = children(_);
      g = claim_text(G, "Preview tokens"), G.forEach(detach), B.forEach(detach), E = claim_space(F), x = claim_element(F, "DIV", { class: !0 });
      var Q = children(x);
      v = claim_element(Q, "SPAN", {});
      var ee = children(v);
      h = claim_text(ee, "Tokens: "), b = claim_text(ee, a), ee.forEach(detach), w = claim_space(Q), k = claim_element(Q, "SPAN", {});
      var Y = children(k);
      A = claim_text(Y, "Characters: "), $ = claim_text(Y, M), Y.forEach(detach), Q.forEach(detach), this.h();
    },
    h() {
      attr(r, "type", "checkbox"), attr(r, "id", o = "show-viz-" + /*elem_id*/
      s[6]), attr(r, "class", "svelte-13mo6bi"), attr(_, "for", y = "show-viz-" + /*elem_id*/
      s[6]), attr(_, "class", "svelte-13mo6bi"), attr(e, "class", "visualization-toggle svelte-13mo6bi"), attr(x, "class", "counters svelte-13mo6bi");
    },
    m(F, B) {
      insert_hydration(F, e, B), append_hydration(e, r), r.checked = /*showVisualization*/
      s[28], append_hydration(e, m), append_hydration(e, _), append_hydration(_, g), insert_hydration(F, E, B), insert_hydration(F, x, B), append_hydration(x, v), append_hydration(v, h), append_hydration(v, b), append_hydration(x, w), append_hydration(x, k), append_hydration(k, A), append_hydration(k, $), O || (C = listen(
        r,
        "change",
        /*input_change_handler*/
        s[33]
      ), O = !0);
    },
    p(F, B) {
      var G, Q, ee, Y;
      B[0] & /*elem_id*/
      64 && o !== (o = "show-viz-" + /*elem_id*/
      F[6]) && attr(r, "id", o), B[0] & /*showVisualization*/
      268435456 && (r.checked = /*showVisualization*/
      F[28]), B[0] & /*elem_id*/
      64 && y !== (y = "show-viz-" + /*elem_id*/
      F[6]) && attr(_, "for", y), B[0] & /*value*/
      1 && a !== (a = /*value*/
      (((Q = (G = F[0]) == null ? void 0 : G.tokens) == null ? void 0 : Q.length) || 0) + "") && set_data(b, a), B[0] & /*value*/
      1 && M !== (M = /*value*/
      (((Y = (ee = F[0]) == null ? void 0 : ee.text) == null ? void 0 : Y.length) || 0) + "") && set_data($, M);
    },
    d(F) {
      F && (detach(e), detach(E), detach(x)), O = !1, C();
    }
  };
}
function create_if_block_5(s) {
  let e, r, o;
  function m(g) {
    s[34](g);
  }
  let _ = {
    label: (
      /*label*/
      s[4]
    ),
    info: (
      /*info*/
      s[5]
    ),
    lines: (
      /*lines*/
      s[9]
    ),
    placeholder: (
      /*placeholder*/
      s[10]
    ),
    show_label: (
      /*show_label*/
      s[11]
    ),
    max_lines: (
      /*max_lines*/
      s[12]
    ),
    type: (
      /*type*/
      s[13]
    ),
    container: (
      /*container*/
      s[14]
    ),
    submit_btn: (
      /*submit_btn*/
      s[17]
    ),
    stop_btn: (
      /*stop_btn*/
      s[18]
    ),
    show_copy_button: (
      /*show_copy_button*/
      s[19]
    ),
    rtl: (
      /*rtl*/
      s[21]
    ),
    text_align: (
      /*text_align*/
      s[22]
    ),
    autofocus: (
      /*autofocus*/
      s[23]
    ),
    autoscroll: (
      /*autoscroll*/
      s[24]
    ),
    max_length: (
      /*max_length*/
      s[26]
    ),
    disabled: !/*interactive*/
    s[25]
  };
  return (
    /*value*/
    s[0].text !== void 0 && (_.value = /*value*/
    s[0].text), e = new Textbox({ props: _ }), binding_callbacks.push(() => bind(e, "value", m)), e.$on(
      "change",
      /*change_handler*/
      s[35]
    ), {
      c() {
        create_component(e.$$.fragment);
      },
      l(g) {
        claim_component(e.$$.fragment, g);
      },
      m(g, y) {
        mount_component(e, g, y), o = !0;
      },
      p(g, y) {
        const E = {};
        y[0] & /*label*/
        16 && (E.label = /*label*/
        g[4]), y[0] & /*info*/
        32 && (E.info = /*info*/
        g[5]), y[0] & /*lines*/
        512 && (E.lines = /*lines*/
        g[9]), y[0] & /*placeholder*/
        1024 && (E.placeholder = /*placeholder*/
        g[10]), y[0] & /*show_label*/
        2048 && (E.show_label = /*show_label*/
        g[11]), y[0] & /*max_lines*/
        4096 && (E.max_lines = /*max_lines*/
        g[12]), y[0] & /*type*/
        8192 && (E.type = /*type*/
        g[13]), y[0] & /*container*/
        16384 && (E.container = /*container*/
        g[14]), y[0] & /*submit_btn*/
        131072 && (E.submit_btn = /*submit_btn*/
        g[17]), y[0] & /*stop_btn*/
        262144 && (E.stop_btn = /*stop_btn*/
        g[18]), y[0] & /*show_copy_button*/
        524288 && (E.show_copy_button = /*show_copy_button*/
        g[19]), y[0] & /*rtl*/
        2097152 && (E.rtl = /*rtl*/
        g[21]), y[0] & /*text_align*/
        4194304 && (E.text_align = /*text_align*/
        g[22]), y[0] & /*autofocus*/
        8388608 && (E.autofocus = /*autofocus*/
        g[23]), y[0] & /*autoscroll*/
        16777216 && (E.autoscroll = /*autoscroll*/
        g[24]), y[0] & /*max_length*/
        67108864 && (E.max_length = /*max_length*/
        g[26]), y[0] & /*interactive*/
        33554432 && (E.disabled = !/*interactive*/
        g[25]), !r && y[0] & /*value*/
        1 && (r = !0, E.value = /*value*/
        g[0].text, add_flush_callback(() => r = !1)), e.$set(E);
      },
      i(g) {
        o || (transition_in(e.$$.fragment, g), o = !0);
      },
      o(g) {
        transition_out(e.$$.fragment, g), o = !1;
      },
      d(g) {
        destroy_component(e, g);
      }
    }
  );
}
function create_if_block(s) {
  let e;
  function r(_, g) {
    if (
      /*display_mode*/
      _[3] === "text"
    ) return create_if_block_1;
    if (
      /*display_mode*/
      _[3] === "token_ids"
    ) return create_if_block_3;
  }
  let o = r(s), m = o && o(s);
  return {
    c() {
      e = element("div"), m && m.c(), this.h();
    },
    l(_) {
      e = claim_element(_, "DIV", { class: !0 });
      var g = children(e);
      m && m.l(g), g.forEach(detach), this.h();
    },
    h() {
      attr(e, "class", "token-visualization-container svelte-13mo6bi");
    },
    m(_, g) {
      insert_hydration(_, e, g), m && m.m(e, null);
    },
    p(_, g) {
      o === (o = r(_)) && m ? m.p(_, g) : (m && m.d(1), m = o && o(_), m && (m.c(), m.m(e, null)));
    },
    d(_) {
      _ && detach(e), m && m.d();
    }
  };
}
function create_if_block_3(s) {
  let e;
  function r(_, g) {
    var y, E;
    return (
      /*value*/
      ((E = (y = _[0]) == null ? void 0 : y.token_ids) == null ? void 0 : E.length) > 0 ? create_if_block_4 : create_else_block_1
    );
  }
  let o = r(s), m = o(s);
  return {
    c() {
      e = element("div"), m.c(), this.h();
    },
    l(_) {
      e = claim_element(_, "DIV", { class: !0 });
      var g = children(e);
      m.l(g), g.forEach(detach), this.h();
    },
    h() {
      attr(e, "class", "token-display token-ids svelte-13mo6bi");
    },
    m(_, g) {
      insert_hydration(_, e, g), m.m(e, null);
    },
    p(_, g) {
      o === (o = r(_)) && m ? m.p(_, g) : (m.d(1), m = o(_), m && (m.c(), m.m(e, null)));
    },
    d(_) {
      _ && detach(e), m.d();
    }
  };
}
function create_if_block_1(s) {
  let e;
  function r(_, g) {
    var y, E;
    return (
      /*value*/
      ((E = (y = _[0]) == null ? void 0 : y.tokens) == null ? void 0 : E.length) > 0 ? create_if_block_2 : create_else_block
    );
  }
  let o = r(s), m = o(s);
  return {
    c() {
      e = element("div"), m.c(), this.h();
    },
    l(_) {
      e = claim_element(_, "DIV", { class: !0 });
      var g = children(e);
      m.l(g), g.forEach(detach), this.h();
    },
    h() {
      attr(e, "class", "token-display svelte-13mo6bi");
    },
    m(_, g) {
      insert_hydration(_, e, g), m.m(e, null);
    },
    p(_, g) {
      o === (o = r(_)) && m ? m.p(_, g) : (m.d(1), m = o(_), m && (m.c(), m.m(e, null)));
    },
    d(_) {
      _ && detach(e), m.d();
    }
  };
}
function create_else_block_1(s) {
  let e, r;
  return {
    c() {
      e = element("span"), r = text(
        /*status*/
        s[27]
      ), this.h();
    },
    l(o) {
      e = claim_element(o, "SPAN", { class: !0 });
      var m = children(e);
      r = claim_text(
        m,
        /*status*/
        s[27]
      ), m.forEach(detach), this.h();
    },
    h() {
      attr(e, "class", "status");
    },
    m(o, m) {
      insert_hydration(o, e, m), append_hydration(e, r);
    },
    p(o, m) {
      m[0] & /*status*/
      134217728 && set_data(
        r,
        /*status*/
        o[27]
      );
    },
    d(o) {
      o && detach(e);
    }
  };
}
function create_if_block_4(s) {
  let e, r = (
    /*value*/
    s[0].token_ids.join(", ") + ""
  ), o, m;
  return {
    c() {
      e = text("["), o = text(r), m = text("]");
    },
    l(_) {
      e = claim_text(_, "["), o = claim_text(_, r), m = claim_text(_, "]");
    },
    m(_, g) {
      insert_hydration(_, e, g), insert_hydration(_, o, g), insert_hydration(_, m, g);
    },
    p(_, g) {
      g[0] & /*value*/
      1 && r !== (r = /*value*/
      _[0].token_ids.join(", ") + "") && set_data(o, r);
    },
    d(_) {
      _ && (detach(e), detach(o), detach(m));
    }
  };
}
function create_else_block(s) {
  let e, r;
  return {
    c() {
      e = element("span"), r = text(
        /*status*/
        s[27]
      ), this.h();
    },
    l(o) {
      e = claim_element(o, "SPAN", { class: !0 });
      var m = children(e);
      r = claim_text(
        m,
        /*status*/
        s[27]
      ), m.forEach(detach), this.h();
    },
    h() {
      attr(e, "class", "status");
    },
    m(o, m) {
      insert_hydration(o, e, m), append_hydration(e, r);
    },
    p(o, m) {
      m[0] & /*status*/
      134217728 && set_data(
        r,
        /*status*/
        o[27]
      );
    },
    d(o) {
      o && detach(e);
    }
  };
}
function create_if_block_2(s) {
  let e, r = ensure_array_like(
    /*value*/
    s[0].tokens
  ), o = [];
  for (let m = 0; m < r.length; m += 1)
    o[m] = create_each_block(get_each_context(s, r, m));
  return {
    c() {
      for (let m = 0; m < o.length; m += 1)
        o[m].c();
      e = empty();
    },
    l(m) {
      for (let _ = 0; _ < o.length; _ += 1)
        o[_].l(m);
      e = empty();
    },
    m(m, _) {
      for (let g = 0; g < o.length; g += 1)
        o[g] && o[g].m(m, _);
      insert_hydration(m, e, _);
    },
    p(m, _) {
      if (_[0] & /*colors, value*/
      536870913) {
        r = ensure_array_like(
          /*value*/
          m[0].tokens
        );
        let g;
        for (g = 0; g < r.length; g += 1) {
          const y = get_each_context(m, r, g);
          o[g] ? o[g].p(y, _) : (o[g] = create_each_block(y), o[g].c(), o[g].m(e.parentNode, e));
        }
        for (; g < o.length; g += 1)
          o[g].d(1);
        o.length = r.length;
      }
    },
    d(m) {
      m && detach(e), destroy_each(o, m);
    }
  };
}
function create_each_block(s) {
  let e, r = (
    /*token*/
    s[42].replace(/ /g, " ") + ""
  ), o, m;
  return {
    c() {
      e = element("span"), o = text(r), m = space(), this.h();
    },
    l(_) {
      e = claim_element(_, "SPAN", { class: !0, style: !0 });
      var g = children(e);
      o = claim_text(g, r), m = claim_space(g), g.forEach(detach), this.h();
    },
    h() {
      attr(e, "class", "token svelte-13mo6bi"), set_style(
        e,
        "background-color",
        /*colors*/
        s[29][
          /*i*/
          s[44] % /*colors*/
          s[29].length
        ]
      );
    },
    m(_, g) {
      insert_hydration(_, e, g), append_hydration(e, o), append_hydration(e, m);
    },
    p(_, g) {
      g[0] & /*value*/
      1 && r !== (r = /*token*/
      _[42].replace(/ /g, " ") + "") && set_data(o, r);
    },
    d(_) {
      _ && detach(e);
    }
  };
}
function create_default_slot(s) {
  let e, r, o, m, _, g, y = (
    /*loading_status*/
    s[20] && create_if_block_7(s)
  ), E = (
    /*display_mode*/
    s[3] !== "hidden" && create_if_block_6(s)
  ), x = !/*hide_input*/
  s[2] && create_if_block_5(s), v = (
    /*showVisualization*/
    s[28] && /*display_mode*/
    s[3] !== "hidden" && create_if_block(s)
  );
  return {
    c() {
      y && y.c(), e = space(), r = element("div"), E && E.c(), o = space(), x && x.c(), m = space(), v && v.c(), _ = empty(), this.h();
    },
    l(h) {
      y && y.l(h), e = claim_space(h), r = claim_element(h, "DIV", { class: !0 });
      var a = children(r);
      E && E.l(a), a.forEach(detach), o = claim_space(h), x && x.l(h), m = claim_space(h), v && v.l(h), _ = empty(), this.h();
    },
    h() {
      attr(r, "class", "component-header svelte-13mo6bi");
    },
    m(h, a) {
      y && y.m(h, a), insert_hydration(h, e, a), insert_hydration(h, r, a), E && E.m(r, null), insert_hydration(h, o, a), x && x.m(h, a), insert_hydration(h, m, a), v && v.m(h, a), insert_hydration(h, _, a), g = !0;
    },
    p(h, a) {
      /*loading_status*/
      h[20] ? y ? (y.p(h, a), a[0] & /*loading_status*/
      1048576 && transition_in(y, 1)) : (y = create_if_block_7(h), y.c(), transition_in(y, 1), y.m(e.parentNode, e)) : y && (group_outros(), transition_out(y, 1, 1, () => {
        y = null;
      }), check_outros()), /*display_mode*/
      h[3] !== "hidden" ? E ? E.p(h, a) : (E = create_if_block_6(h), E.c(), E.m(r, null)) : E && (E.d(1), E = null), /*hide_input*/
      h[2] ? x && (group_outros(), transition_out(x, 1, 1, () => {
        x = null;
      }), check_outros()) : x ? (x.p(h, a), a[0] & /*hide_input*/
      4 && transition_in(x, 1)) : (x = create_if_block_5(h), x.c(), transition_in(x, 1), x.m(m.parentNode, m)), /*showVisualization*/
      h[28] && /*display_mode*/
      h[3] !== "hidden" ? v ? v.p(h, a) : (v = create_if_block(h), v.c(), v.m(_.parentNode, _)) : v && (v.d(1), v = null);
    },
    i(h) {
      g || (transition_in(y), transition_in(x), g = !0);
    },
    o(h) {
      transition_out(y), transition_out(x), g = !1;
    },
    d(h) {
      h && (detach(e), detach(r), detach(o), detach(m), detach(_)), y && y.d(h), E && E.d(), x && x.d(h), v && v.d(h);
    }
  };
}
function create_fragment(s) {
  let e, r, o;
  return e = new Block({
    props: {
      visible: (
        /*visible*/
        s[8]
      ),
      elem_id: (
        /*elem_id*/
        s[6]
      ),
      elem_classes: (
        /*elem_classes*/
        s[7]
      ),
      scale: (
        /*scale*/
        s[15]
      ),
      min_width: (
        /*min_width*/
        s[16]
      ),
      allow_overflow: !1,
      padding: (
        /*container*/
        s[14]
      ),
      $$slots: { default: [create_default_slot] },
      $$scope: { ctx: s }
    }
  }), {
    c() {
      create_component(e.$$.fragment), r = text(`


Use code with caution.`);
    },
    l(m) {
      claim_component(e.$$.fragment, m), r = claim_text(m, `


Use code with caution.`);
    },
    m(m, _) {
      mount_component(e, m, _), insert_hydration(m, r, _), o = !0;
    },
    p(m, _) {
      const g = {};
      _[0] & /*visible*/
      256 && (g.visible = /*visible*/
      m[8]), _[0] & /*elem_id*/
      64 && (g.elem_id = /*elem_id*/
      m[6]), _[0] & /*elem_classes*/
      128 && (g.elem_classes = /*elem_classes*/
      m[7]), _[0] & /*scale*/
      32768 && (g.scale = /*scale*/
      m[15]), _[0] & /*min_width*/
      65536 && (g.min_width = /*min_width*/
      m[16]), _[0] & /*container*/
      16384 && (g.padding = /*container*/
      m[14]), _[0] & /*value, status, display_mode, showVisualization, label, info, lines, placeholder, show_label, max_lines, type, container, submit_btn, stop_btn, show_copy_button, rtl, text_align, autofocus, autoscroll, max_length, interactive, gradio, hide_input, elem_id, loading_status*/
      536772223 | _[1] & /*$$scope*/
      16384 && (g.$$scope = { dirty: _, ctx: m }), e.$set(g);
    },
    i(m) {
      o || (transition_in(e.$$.fragment, m), o = !0);
    },
    o(m) {
      transition_out(e.$$.fragment, m), o = !1;
    },
    d(m) {
      m && detach(r), destroy_component(e, m);
    }
  };
}
function instance(s, e, r) {
  var o = this && this.__awaiter || function(ge, Ye, Ie, Ge) {
    function Ke(Ne) {
      return Ne instanceof Ie ? Ne : new Ie(function(Ce) {
        Ce(Ne);
      });
    }
    return new (Ie || (Ie = Promise))(function(Ne, Ce) {
      function lt(Ze) {
        try {
          Je(Ge.next(Ze));
        } catch (at) {
          Ce(at);
        }
      }
      function ut(Ze) {
        try {
          Je(Ge.throw(Ze));
        } catch (at) {
          Ce(at);
        }
      }
      function Je(Ze) {
        Ze.done ? Ne(Ze.value) : Ke(Ze.value).then(lt, ut);
      }
      Je((Ge = Ge.apply(ge, Ye || [])).next());
    });
  };
  env$1.allowLocalModels = !1;
  let { gradio: m } = e, { value: _ = { text: "", tokens: [], token_ids: [] } } = e, { hide_input: g = !1 } = e, { model: y } = e, { display_mode: E } = e, { label: x } = e, { info: v } = e, { elem_id: h } = e, { elem_classes: a } = e, { visible: b } = e, { lines: w } = e, { placeholder: k } = e, { show_label: A } = e, { max_lines: M } = e, { type: $ } = e, { container: O } = e, { scale: C } = e, { min_width: P } = e, { submit_btn: I } = e, { stop_btn: N } = e, { show_copy_button: R } = e, { loading_status: F } = e, { rtl: B } = e, { text_align: G } = e, { autofocus: Q } = e, { autoscroll: ee } = e, { interactive: Y } = e, { max_length: W } = e, j = null, J = "Initializing...", me = !0;
  const pe = ["#d8b4fe", "#bbf7d0", "#fde047", "#fca5a5", "#93c5fd"];
  let ye = "", oe = null;
  function we(ge) {
    return o(this, void 0, void 0, function* () {
      if (!(!j || ge === oe)) {
        oe = ge;
        try {
          const Ye = j.encode(ge), Ie = Ye.map((Ge) => j.decode([Ge]));
          r(0, _ = {
            text: ge,
            tokens: Ie,
            token_ids: Ye
          }), m.dispatch("change");
        } catch (Ye) {
          r(27, J = `Tokenization error: ${Ye.message}`);
        }
      }
    });
  }
  function Se(ge) {
    return o(this, void 0, void 0, function* () {
      if (!(ye === ge && j)) {
        r(27, J = `Loading tokenizer: ${ge}...`), r(31, ye = ge), j = null;
        try {
          j = yield AutoTokenizer.from_pretrained(ge), r(27, J = `Tokenizer "${ge}" loaded.`), oe = null, yield we(_.text);
        } catch (Ye) {
          r(27, J = `Error loading model: ${Ye.message}`);
        }
      }
    });
  }
  onMount(() => {
    Se(y);
  });
  const Me = () => m.dispatch("clear_status", F);
  function de() {
    me = this.checked, r(28, me);
  }
  function Oe(ge) {
    s.$$.not_equal(_.text, ge) && (_.text = ge, r(0, _));
  }
  const $e = () => m.dispatch("change");
  return s.$$set = (ge) => {
    "gradio" in ge && r(1, m = ge.gradio), "value" in ge && r(0, _ = ge.value), "hide_input" in ge && r(2, g = ge.hide_input), "model" in ge && r(30, y = ge.model), "display_mode" in ge && r(3, E = ge.display_mode), "label" in ge && r(4, x = ge.label), "info" in ge && r(5, v = ge.info), "elem_id" in ge && r(6, h = ge.elem_id), "elem_classes" in ge && r(7, a = ge.elem_classes), "visible" in ge && r(8, b = ge.visible), "lines" in ge && r(9, w = ge.lines), "placeholder" in ge && r(10, k = ge.placeholder), "show_label" in ge && r(11, A = ge.show_label), "max_lines" in ge && r(12, M = ge.max_lines), "type" in ge && r(13, $ = ge.type), "container" in ge && r(14, O = ge.container), "scale" in ge && r(15, C = ge.scale), "min_width" in ge && r(16, P = ge.min_width), "submit_btn" in ge && r(17, I = ge.submit_btn), "stop_btn" in ge && r(18, N = ge.stop_btn), "show_copy_button" in ge && r(19, R = ge.show_copy_button), "loading_status" in ge && r(20, F = ge.loading_status), "rtl" in ge && r(21, B = ge.rtl), "text_align" in ge && r(22, G = ge.text_align), "autofocus" in ge && r(23, Q = ge.autofocus), "autoscroll" in ge && r(24, ee = ge.autoscroll), "interactive" in ge && r(25, Y = ge.interactive), "max_length" in ge && r(26, W = ge.max_length);
  }, s.$$.update = () => {
    s.$$.dirty[0] & /*value*/
    1 && _ && _.text !== void 0 && we(_.text), s.$$.dirty[0] & /*model*/
    1073741824 | s.$$.dirty[1] & /*currentModel*/
    1 && y && y !== ye && Se(y);
  }, [
    _,
    m,
    g,
    E,
    x,
    v,
    h,
    a,
    b,
    w,
    k,
    A,
    M,
    $,
    O,
    C,
    P,
    I,
    N,
    R,
    F,
    B,
    G,
    Q,
    ee,
    Y,
    W,
    J,
    me,
    pe,
    y,
    ye,
    Me,
    de,
    Oe,
    $e
  ];
}
class Index extends SvelteComponent {
  constructor(e) {
    super(), init(
      this,
      e,
      instance,
      create_fragment,
      safe_not_equal,
      {
        gradio: 1,
        value: 0,
        hide_input: 2,
        model: 30,
        display_mode: 3,
        label: 4,
        info: 5,
        elem_id: 6,
        elem_classes: 7,
        visible: 8,
        lines: 9,
        placeholder: 10,
        show_label: 11,
        max_lines: 12,
        type: 13,
        container: 14,
        scale: 15,
        min_width: 16,
        submit_btn: 17,
        stop_btn: 18,
        show_copy_button: 19,
        loading_status: 20,
        rtl: 21,
        text_align: 22,
        autofocus: 23,
        autoscroll: 24,
        interactive: 25,
        max_length: 26
      },
      null,
      [-1, -1]
    );
  }
  get gradio() {
    return this.$$.ctx[1];
  }
  set gradio(e) {
    this.$$set({ gradio: e }), flush();
  }
  get value() {
    return this.$$.ctx[0];
  }
  set value(e) {
    this.$$set({ value: e }), flush();
  }
  get hide_input() {
    return this.$$.ctx[2];
  }
  set hide_input(e) {
    this.$$set({ hide_input: e }), flush();
  }
  get model() {
    return this.$$.ctx[30];
  }
  set model(e) {
    this.$$set({ model: e }), flush();
  }
  get display_mode() {
    return this.$$.ctx[3];
  }
  set display_mode(e) {
    this.$$set({ display_mode: e }), flush();
  }
  get label() {
    return this.$$.ctx[4];
  }
  set label(e) {
    this.$$set({ label: e }), flush();
  }
  get info() {
    return this.$$.ctx[5];
  }
  set info(e) {
    this.$$set({ info: e }), flush();
  }
  get elem_id() {
    return this.$$.ctx[6];
  }
  set elem_id(e) {
    this.$$set({ elem_id: e }), flush();
  }
  get elem_classes() {
    return this.$$.ctx[7];
  }
  set elem_classes(e) {
    this.$$set({ elem_classes: e }), flush();
  }
  get visible() {
    return this.$$.ctx[8];
  }
  set visible(e) {
    this.$$set({ visible: e }), flush();
  }
  get lines() {
    return this.$$.ctx[9];
  }
  set lines(e) {
    this.$$set({ lines: e }), flush();
  }
  get placeholder() {
    return this.$$.ctx[10];
  }
  set placeholder(e) {
    this.$$set({ placeholder: e }), flush();
  }
  get show_label() {
    return this.$$.ctx[11];
  }
  set show_label(e) {
    this.$$set({ show_label: e }), flush();
  }
  get max_lines() {
    return this.$$.ctx[12];
  }
  set max_lines(e) {
    this.$$set({ max_lines: e }), flush();
  }
  get type() {
    return this.$$.ctx[13];
  }
  set type(e) {
    this.$$set({ type: e }), flush();
  }
  get container() {
    return this.$$.ctx[14];
  }
  set container(e) {
    this.$$set({ container: e }), flush();
  }
  get scale() {
    return this.$$.ctx[15];
  }
  set scale(e) {
    this.$$set({ scale: e }), flush();
  }
  get min_width() {
    return this.$$.ctx[16];
  }
  set min_width(e) {
    this.$$set({ min_width: e }), flush();
  }
  get submit_btn() {
    return this.$$.ctx[17];
  }
  set submit_btn(e) {
    this.$$set({ submit_btn: e }), flush();
  }
  get stop_btn() {
    return this.$$.ctx[18];
  }
  set stop_btn(e) {
    this.$$set({ stop_btn: e }), flush();
  }
  get show_copy_button() {
    return this.$$.ctx[19];
  }
  set show_copy_button(e) {
    this.$$set({ show_copy_button: e }), flush();
  }
  get loading_status() {
    return this.$$.ctx[20];
  }
  set loading_status(e) {
    this.$$set({ loading_status: e }), flush();
  }
  get rtl() {
    return this.$$.ctx[21];
  }
  set rtl(e) {
    this.$$set({ rtl: e }), flush();
  }
  get text_align() {
    return this.$$.ctx[22];
  }
  set text_align(e) {
    this.$$set({ text_align: e }), flush();
  }
  get autofocus() {
    return this.$$.ctx[23];
  }
  set autofocus(e) {
    this.$$set({ autofocus: e }), flush();
  }
  get autoscroll() {
    return this.$$.ctx[24];
  }
  set autoscroll(e) {
    this.$$set({ autoscroll: e }), flush();
  }
  get interactive() {
    return this.$$.ctx[25];
  }
  set interactive(e) {
    this.$$set({ interactive: e }), flush();
  }
  get max_length() {
    return this.$$.ctx[26];
  }
  set max_length(e) {
    this.$$set({ max_length: e }), flush();
  }
}
export {
  Index as I,
  commonjsGlobal as c,
  getDefaultExportFromCjs as g,
  katex$1 as k,
  purify as p
};
