const {
  SvelteComponent: na,
  append: es,
  attr: re,
  detach: sa,
  init: ra,
  insert: aa,
  noop: an,
  safe_not_equal: oa,
  svg_element: on
} = window.__gradio__svelte__internal;
function la(d) {
  let t, n, e;
  return {
    c() {
      t = on("svg"), n = on("path"), e = on("polyline"), re(n, "d", "M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"), re(e, "points", "13 2 13 9 20 9"), re(t, "xmlns", "http://www.w3.org/2000/svg"), re(t, "width", "100%"), re(t, "height", "100%"), re(t, "viewBox", "0 0 24 24"), re(t, "fill", "none"), re(t, "stroke", "currentColor"), re(t, "stroke-width", "1.5"), re(t, "stroke-linecap", "round"), re(t, "stroke-linejoin", "round"), re(t, "class", "feather feather-file");
    },
    m(u, f) {
      aa(u, t, f), es(t, n), es(t, e);
    },
    p: an,
    i: an,
    o: an,
    d(u) {
      u && sa(t);
    }
  };
}
let ca = class extends na {
  constructor(t) {
    super(), ra(this, t, null, la, oa, {});
  }
};
const {
  SvelteComponent: ha,
  append: ln,
  attr: Bt,
  detach: da,
  init: ua,
  insert: fa,
  noop: cn,
  safe_not_equal: pa,
  svg_element: Pi
} = window.__gradio__svelte__internal;
function ga(d) {
  let t, n, e, u;
  return {
    c() {
      t = Pi("svg"), n = Pi("path"), e = Pi("polyline"), u = Pi("line"), Bt(n, "d", "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"), Bt(e, "points", "17 8 12 3 7 8"), Bt(u, "x1", "12"), Bt(u, "y1", "3"), Bt(u, "x2", "12"), Bt(u, "y2", "15"), Bt(t, "xmlns", "http://www.w3.org/2000/svg"), Bt(t, "width", "90%"), Bt(t, "height", "90%"), Bt(t, "viewBox", "0 0 24 24"), Bt(t, "fill", "none"), Bt(t, "stroke", "currentColor"), Bt(t, "stroke-width", "2"), Bt(t, "stroke-linecap", "round"), Bt(t, "stroke-linejoin", "round"), Bt(t, "class", "feather feather-upload");
    },
    m(f, k) {
      fa(f, t, k), ln(t, n), ln(t, e), ln(t, u);
    },
    p: cn,
    i: cn,
    o: cn,
    d(f) {
      f && da(t);
    }
  };
}
let ma = class extends ha {
  constructor(t) {
    super(), ua(this, t, null, ga, pa, {});
  }
};
const {
  SvelteComponent: ba,
  append: Ni,
  attr: hn,
  create_component: Aa,
  destroy_component: va,
  detach: ya,
  element: dn,
  init: wa,
  insert: _a,
  mount_component: Sa,
  safe_not_equal: Ea,
  text: is,
  toggle_class: ns,
  transition_in: Ta,
  transition_out: Ca
} = window.__gradio__svelte__internal;
function ka(d) {
  let t, n, e, u, f, k, m;
  return e = new ma({}), {
    c() {
      t = dn("div"), n = dn("span"), Aa(e.$$.fragment), u = is(`
    Drop PDF
    `), f = dn("span"), f.textContent = "- or -", k = is(`
    Click to Upload`), hn(n, "class", "icon-wrap svelte-kzcjhc"), ns(
        n,
        "hovered",
        /*hovered*/
        d[0]
      ), hn(f, "class", "or svelte-kzcjhc"), hn(t, "class", "wrap svelte-kzcjhc");
    },
    m(o, l) {
      _a(o, t, l), Ni(t, n), Sa(e, n, null), Ni(t, u), Ni(t, f), Ni(t, k), m = !0;
    },
    p(o, [l]) {
      (!m || l & /*hovered*/
      1) && ns(
        n,
        "hovered",
        /*hovered*/
        o[0]
      );
    },
    i(o) {
      m || (Ta(e.$$.fragment, o), m = !0);
    },
    o(o) {
      Ca(e.$$.fragment, o), m = !1;
    },
    d(o) {
      o && ya(t), va(e);
    }
  };
}
function Ra(d, t, n) {
  let { hovered: e = !1 } = t;
  return d.$$set = (u) => {
    "hovered" in u && n(0, e = u.hovered);
  }, [e];
}
class xa extends ba {
  constructor(t) {
    super(), wa(this, t, Ra, ka, Ea, { hovered: 0 });
  }
}
const {
  SvelteComponent: La,
  assign: Fa,
  create_slot: Ma,
  detach: Ia,
  element: Pa,
  get_all_dirty_from_scope: Na,
  get_slot_changes: Da,
  get_spread_update: Oa,
  init: Ha,
  insert: za,
  safe_not_equal: Ba,
  set_dynamic_element_data: ss,
  set_style: $t,
  toggle_class: ze,
  transition_in: hr,
  transition_out: dr,
  update_slot_base: Ua
} = window.__gradio__svelte__internal;
function Ga(d) {
  let t, n, e;
  const u = (
    /*#slots*/
    d[17].default
  ), f = Ma(
    u,
    d,
    /*$$scope*/
    d[16],
    null
  );
  let k = [
    { "data-testid": (
      /*test_id*/
      d[7]
    ) },
    { id: (
      /*elem_id*/
      d[2]
    ) },
    {
      class: n = "block " + /*elem_classes*/
      d[3].join(" ") + " svelte-1t38q2d"
    }
  ], m = {};
  for (let o = 0; o < k.length; o += 1)
    m = Fa(m, k[o]);
  return {
    c() {
      t = Pa(
        /*tag*/
        d[14]
      ), f && f.c(), ss(
        /*tag*/
        d[14]
      )(t, m), ze(
        t,
        "hidden",
        /*visible*/
        d[10] === !1
      ), ze(
        t,
        "padded",
        /*padding*/
        d[6]
      ), ze(
        t,
        "border_focus",
        /*border_mode*/
        d[5] === "focus"
      ), ze(t, "hide-container", !/*explicit_call*/
      d[8] && !/*container*/
      d[9]), $t(t, "height", typeof /*height*/
      d[0] == "number" ? (
        /*height*/
        d[0] + "px"
      ) : void 0), $t(t, "width", typeof /*width*/
      d[1] == "number" ? `calc(min(${/*width*/
      d[1]}px, 100%))` : void 0), $t(
        t,
        "border-style",
        /*variant*/
        d[4]
      ), $t(
        t,
        "overflow",
        /*allow_overflow*/
        d[11] ? "visible" : "hidden"
      ), $t(
        t,
        "flex-grow",
        /*scale*/
        d[12]
      ), $t(t, "min-width", `calc(min(${/*min_width*/
      d[13]}px, 100%))`), $t(t, "border-width", "var(--block-border-width)");
    },
    m(o, l) {
      za(o, t, l), f && f.m(t, null), e = !0;
    },
    p(o, l) {
      f && f.p && (!e || l & /*$$scope*/
      65536) && Ua(
        f,
        u,
        o,
        /*$$scope*/
        o[16],
        e ? Da(
          u,
          /*$$scope*/
          o[16],
          l,
          null
        ) : Na(
          /*$$scope*/
          o[16]
        ),
        null
      ), ss(
        /*tag*/
        o[14]
      )(t, m = Oa(k, [
        (!e || l & /*test_id*/
        128) && { "data-testid": (
          /*test_id*/
          o[7]
        ) },
        (!e || l & /*elem_id*/
        4) && { id: (
          /*elem_id*/
          o[2]
        ) },
        (!e || l & /*elem_classes*/
        8 && n !== (n = "block " + /*elem_classes*/
        o[3].join(" ") + " svelte-1t38q2d")) && { class: n }
      ])), ze(
        t,
        "hidden",
        /*visible*/
        o[10] === !1
      ), ze(
        t,
        "padded",
        /*padding*/
        o[6]
      ), ze(
        t,
        "border_focus",
        /*border_mode*/
        o[5] === "focus"
      ), ze(t, "hide-container", !/*explicit_call*/
      o[8] && !/*container*/
      o[9]), l & /*height*/
      1 && $t(t, "height", typeof /*height*/
      o[0] == "number" ? (
        /*height*/
        o[0] + "px"
      ) : void 0), l & /*width*/
      2 && $t(t, "width", typeof /*width*/
      o[1] == "number" ? `calc(min(${/*width*/
      o[1]}px, 100%))` : void 0), l & /*variant*/
      16 && $t(
        t,
        "border-style",
        /*variant*/
        o[4]
      ), l & /*allow_overflow*/
      2048 && $t(
        t,
        "overflow",
        /*allow_overflow*/
        o[11] ? "visible" : "hidden"
      ), l & /*scale*/
      4096 && $t(
        t,
        "flex-grow",
        /*scale*/
        o[12]
      ), l & /*min_width*/
      8192 && $t(t, "min-width", `calc(min(${/*min_width*/
      o[13]}px, 100%))`);
    },
    i(o) {
      e || (hr(f, o), e = !0);
    },
    o(o) {
      dr(f, o), e = !1;
    },
    d(o) {
      o && Ia(t), f && f.d(o);
    }
  };
}
function Va(d) {
  let t, n = (
    /*tag*/
    d[14] && Ga(d)
  );
  return {
    c() {
      n && n.c();
    },
    m(e, u) {
      n && n.m(e, u), t = !0;
    },
    p(e, [u]) {
      /*tag*/
      e[14] && n.p(e, u);
    },
    i(e) {
      t || (hr(n, e), t = !0);
    },
    o(e) {
      dr(n, e), t = !1;
    },
    d(e) {
      n && n.d(e);
    }
  };
}
function Xa(d, t, n) {
  let { $$slots: e = {}, $$scope: u } = t, { height: f = void 0 } = t, { width: k = void 0 } = t, { elem_id: m = "" } = t, { elem_classes: o = [] } = t, { variant: l = "solid" } = t, { border_mode: c = "base" } = t, { padding: s = !0 } = t, { type: p = "normal" } = t, { test_id: b = void 0 } = t, { explicit_call: S = !1 } = t, { container: a = !0 } = t, { visible: E = !0 } = t, { allow_overflow: i = !0 } = t, { scale: r = null } = t, { min_width: v = 0 } = t, y = p === "fieldset" ? "fieldset" : "div";
  return d.$$set = (R) => {
    "height" in R && n(0, f = R.height), "width" in R && n(1, k = R.width), "elem_id" in R && n(2, m = R.elem_id), "elem_classes" in R && n(3, o = R.elem_classes), "variant" in R && n(4, l = R.variant), "border_mode" in R && n(5, c = R.border_mode), "padding" in R && n(6, s = R.padding), "type" in R && n(15, p = R.type), "test_id" in R && n(7, b = R.test_id), "explicit_call" in R && n(8, S = R.explicit_call), "container" in R && n(9, a = R.container), "visible" in R && n(10, E = R.visible), "allow_overflow" in R && n(11, i = R.allow_overflow), "scale" in R && n(12, r = R.scale), "min_width" in R && n(13, v = R.min_width), "$$scope" in R && n(16, u = R.$$scope);
  }, [
    f,
    k,
    m,
    o,
    l,
    c,
    s,
    b,
    S,
    a,
    E,
    i,
    r,
    v,
    y,
    p,
    u,
    e
  ];
}
class ja extends La {
  constructor(t) {
    super(), Ha(this, t, Xa, Va, Ba, {
      height: 0,
      width: 1,
      elem_id: 2,
      elem_classes: 3,
      variant: 4,
      border_mode: 5,
      padding: 6,
      type: 15,
      test_id: 7,
      explicit_call: 8,
      container: 9,
      visible: 10,
      allow_overflow: 11,
      scale: 12,
      min_width: 13
    });
  }
}
const {
  SvelteComponent: Wa,
  append: un,
  attr: Di,
  create_component: qa,
  destroy_component: Ya,
  detach: Ka,
  element: rs,
  init: Ja,
  insert: Qa,
  mount_component: Za,
  safe_not_equal: $a,
  set_data: to,
  space: eo,
  text: io,
  toggle_class: Be,
  transition_in: no,
  transition_out: so
} = window.__gradio__svelte__internal;
function ro(d) {
  let t, n, e, u, f, k;
  return e = new /*Icon*/
  d[1]({}), {
    c() {
      t = rs("label"), n = rs("span"), qa(e.$$.fragment), u = eo(), f = io(
        /*label*/
        d[0]
      ), Di(n, "class", "svelte-9gxdi0"), Di(t, "for", ""), Di(t, "data-testid", "block-label"), Di(t, "class", "svelte-9gxdi0"), Be(t, "hide", !/*show_label*/
      d[2]), Be(t, "sr-only", !/*show_label*/
      d[2]), Be(
        t,
        "float",
        /*float*/
        d[4]
      ), Be(
        t,
        "hide-label",
        /*disable*/
        d[3]
      );
    },
    m(m, o) {
      Qa(m, t, o), un(t, n), Za(e, n, null), un(t, u), un(t, f), k = !0;
    },
    p(m, [o]) {
      (!k || o & /*label*/
      1) && to(
        f,
        /*label*/
        m[0]
      ), (!k || o & /*show_label*/
      4) && Be(t, "hide", !/*show_label*/
      m[2]), (!k || o & /*show_label*/
      4) && Be(t, "sr-only", !/*show_label*/
      m[2]), (!k || o & /*float*/
      16) && Be(
        t,
        "float",
        /*float*/
        m[4]
      ), (!k || o & /*disable*/
      8) && Be(
        t,
        "hide-label",
        /*disable*/
        m[3]
      );
    },
    i(m) {
      k || (no(e.$$.fragment, m), k = !0);
    },
    o(m) {
      so(e.$$.fragment, m), k = !1;
    },
    d(m) {
      m && Ka(t), Ya(e);
    }
  };
}
function ao(d, t, n) {
  let { label: e = null } = t, { Icon: u } = t, { show_label: f = !0 } = t, { disable: k = !1 } = t, { float: m = !0 } = t;
  return d.$$set = (o) => {
    "label" in o && n(0, e = o.label), "Icon" in o && n(1, u = o.Icon), "show_label" in o && n(2, f = o.show_label), "disable" in o && n(3, k = o.disable), "float" in o && n(4, m = o.float);
  }, [e, u, f, k, m];
}
class oo extends Wa {
  constructor(t) {
    super(), Ja(this, t, ao, ro, $a, {
      label: 0,
      Icon: 1,
      show_label: 2,
      disable: 3,
      float: 4
    });
  }
}
const lo = [
  { 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 }
], as = {
  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"
  }
};
lo.reduce(
  (d, { color: t, primary: n, secondary: e }) => ({
    ...d,
    [t]: {
      primary: as[t][n],
      secondary: as[t][e]
    }
  }),
  {}
);
new Intl.Collator(0, { numeric: 1 }).compare;
function co(d) {
  try {
    const t = new URL(d);
    return t.protocol === "http:" || t.protocol === "https:";
  } catch {
    return !1;
  }
}
function ho(d, t, n) {
  return d == null ? n ? `/proxy=${n}file=` : `${t}/file=` : co(d) ? d : n ? `/proxy=${n}file=${d}` : `${t}/file=${d}`;
}
const {
  SvelteComponent: uo,
  append: ur,
  attr: Lt,
  bubble: fo,
  check_outros: po,
  create_slot: fr,
  detach: xi,
  element: Zi,
  empty: go,
  get_all_dirty_from_scope: pr,
  get_slot_changes: gr,
  group_outros: mo,
  init: bo,
  insert: Li,
  listen: Ao,
  safe_not_equal: vo,
  set_style: Qt,
  space: mr,
  src_url_equal: ji,
  toggle_class: mi,
  transition_in: Wi,
  transition_out: qi,
  update_slot_base: br
} = window.__gradio__svelte__internal;
function yo(d) {
  let t, n, e, u, f, k, m = (
    /*icon*/
    d[7] && os(d)
  );
  const o = (
    /*#slots*/
    d[15].default
  ), l = fr(
    o,
    d,
    /*$$scope*/
    d[14],
    null
  );
  return {
    c() {
      t = Zi("button"), m && m.c(), n = mr(), l && l.c(), Lt(t, "class", e = /*size*/
      d[4] + " " + /*variant*/
      d[3] + " " + /*elem_classes*/
      d[1].join(" ") + " svelte-8huxfn"), Lt(
        t,
        "id",
        /*elem_id*/
        d[0]
      ), t.disabled = /*disabled*/
      d[8], mi(t, "hidden", !/*visible*/
      d[2]), Qt(
        t,
        "flex-grow",
        /*scale*/
        d[9]
      ), Qt(
        t,
        "width",
        /*scale*/
        d[9] === 0 ? "fit-content" : null
      ), Qt(t, "min-width", typeof /*min_width*/
      d[10] == "number" ? `calc(min(${/*min_width*/
      d[10]}px, 100%))` : null);
    },
    m(c, s) {
      Li(c, t, s), m && m.m(t, null), ur(t, n), l && l.m(t, null), u = !0, f || (k = Ao(
        t,
        "click",
        /*click_handler*/
        d[16]
      ), f = !0);
    },
    p(c, s) {
      /*icon*/
      c[7] ? m ? m.p(c, s) : (m = os(c), m.c(), m.m(t, n)) : m && (m.d(1), m = null), l && l.p && (!u || s & /*$$scope*/
      16384) && br(
        l,
        o,
        c,
        /*$$scope*/
        c[14],
        u ? gr(
          o,
          /*$$scope*/
          c[14],
          s,
          null
        ) : pr(
          /*$$scope*/
          c[14]
        ),
        null
      ), (!u || s & /*size, variant, elem_classes*/
      26 && e !== (e = /*size*/
      c[4] + " " + /*variant*/
      c[3] + " " + /*elem_classes*/
      c[1].join(" ") + " svelte-8huxfn")) && Lt(t, "class", e), (!u || s & /*elem_id*/
      1) && Lt(
        t,
        "id",
        /*elem_id*/
        c[0]
      ), (!u || s & /*disabled*/
      256) && (t.disabled = /*disabled*/
      c[8]), (!u || s & /*size, variant, elem_classes, visible*/
      30) && mi(t, "hidden", !/*visible*/
      c[2]), s & /*scale*/
      512 && Qt(
        t,
        "flex-grow",
        /*scale*/
        c[9]
      ), s & /*scale*/
      512 && Qt(
        t,
        "width",
        /*scale*/
        c[9] === 0 ? "fit-content" : null
      ), s & /*min_width*/
      1024 && Qt(t, "min-width", typeof /*min_width*/
      c[10] == "number" ? `calc(min(${/*min_width*/
      c[10]}px, 100%))` : null);
    },
    i(c) {
      u || (Wi(l, c), u = !0);
    },
    o(c) {
      qi(l, c), u = !1;
    },
    d(c) {
      c && xi(t), m && m.d(), l && l.d(c), f = !1, k();
    }
  };
}
function wo(d) {
  let t, n, e, u, f = (
    /*icon*/
    d[7] && ls(d)
  );
  const k = (
    /*#slots*/
    d[15].default
  ), m = fr(
    k,
    d,
    /*$$scope*/
    d[14],
    null
  );
  return {
    c() {
      t = Zi("a"), f && f.c(), n = mr(), m && m.c(), Lt(
        t,
        "href",
        /*link*/
        d[6]
      ), Lt(t, "rel", "noopener noreferrer"), Lt(
        t,
        "aria-disabled",
        /*disabled*/
        d[8]
      ), Lt(t, "class", e = /*size*/
      d[4] + " " + /*variant*/
      d[3] + " " + /*elem_classes*/
      d[1].join(" ") + " svelte-8huxfn"), Lt(
        t,
        "id",
        /*elem_id*/
        d[0]
      ), mi(t, "hidden", !/*visible*/
      d[2]), mi(
        t,
        "disabled",
        /*disabled*/
        d[8]
      ), Qt(
        t,
        "flex-grow",
        /*scale*/
        d[9]
      ), Qt(
        t,
        "pointer-events",
        /*disabled*/
        d[8] ? "none" : null
      ), Qt(
        t,
        "width",
        /*scale*/
        d[9] === 0 ? "fit-content" : null
      ), Qt(t, "min-width", typeof /*min_width*/
      d[10] == "number" ? `calc(min(${/*min_width*/
      d[10]}px, 100%))` : null);
    },
    m(o, l) {
      Li(o, t, l), f && f.m(t, null), ur(t, n), m && m.m(t, null), u = !0;
    },
    p(o, l) {
      /*icon*/
      o[7] ? f ? f.p(o, l) : (f = ls(o), f.c(), f.m(t, n)) : f && (f.d(1), f = null), m && m.p && (!u || l & /*$$scope*/
      16384) && br(
        m,
        k,
        o,
        /*$$scope*/
        o[14],
        u ? gr(
          k,
          /*$$scope*/
          o[14],
          l,
          null
        ) : pr(
          /*$$scope*/
          o[14]
        ),
        null
      ), (!u || l & /*link*/
      64) && Lt(
        t,
        "href",
        /*link*/
        o[6]
      ), (!u || l & /*disabled*/
      256) && Lt(
        t,
        "aria-disabled",
        /*disabled*/
        o[8]
      ), (!u || l & /*size, variant, elem_classes*/
      26 && e !== (e = /*size*/
      o[4] + " " + /*variant*/
      o[3] + " " + /*elem_classes*/
      o[1].join(" ") + " svelte-8huxfn")) && Lt(t, "class", e), (!u || l & /*elem_id*/
      1) && Lt(
        t,
        "id",
        /*elem_id*/
        o[0]
      ), (!u || l & /*size, variant, elem_classes, visible*/
      30) && mi(t, "hidden", !/*visible*/
      o[2]), (!u || l & /*size, variant, elem_classes, disabled*/
      282) && mi(
        t,
        "disabled",
        /*disabled*/
        o[8]
      ), l & /*scale*/
      512 && Qt(
        t,
        "flex-grow",
        /*scale*/
        o[9]
      ), l & /*disabled*/
      256 && Qt(
        t,
        "pointer-events",
        /*disabled*/
        o[8] ? "none" : null
      ), l & /*scale*/
      512 && Qt(
        t,
        "width",
        /*scale*/
        o[9] === 0 ? "fit-content" : null
      ), l & /*min_width*/
      1024 && Qt(t, "min-width", typeof /*min_width*/
      o[10] == "number" ? `calc(min(${/*min_width*/
      o[10]}px, 100%))` : null);
    },
    i(o) {
      u || (Wi(m, o), u = !0);
    },
    o(o) {
      qi(m, o), u = !1;
    },
    d(o) {
      o && xi(t), f && f.d(), m && m.d(o);
    }
  };
}
function os(d) {
  let t, n, e;
  return {
    c() {
      t = Zi("img"), Lt(t, "class", "button-icon svelte-8huxfn"), ji(t.src, n = /*icon_path*/
      d[11]) || Lt(t, "src", n), Lt(t, "alt", e = `${/*value*/
      d[5]} icon`);
    },
    m(u, f) {
      Li(u, t, f);
    },
    p(u, f) {
      f & /*icon_path*/
      2048 && !ji(t.src, n = /*icon_path*/
      u[11]) && Lt(t, "src", n), f & /*value*/
      32 && e !== (e = `${/*value*/
      u[5]} icon`) && Lt(t, "alt", e);
    },
    d(u) {
      u && xi(t);
    }
  };
}
function ls(d) {
  let t, n, e;
  return {
    c() {
      t = Zi("img"), Lt(t, "class", "button-icon svelte-8huxfn"), ji(t.src, n = /*icon_path*/
      d[11]) || Lt(t, "src", n), Lt(t, "alt", e = `${/*value*/
      d[5]} icon`);
    },
    m(u, f) {
      Li(u, t, f);
    },
    p(u, f) {
      f & /*icon_path*/
      2048 && !ji(t.src, n = /*icon_path*/
      u[11]) && Lt(t, "src", n), f & /*value*/
      32 && e !== (e = `${/*value*/
      u[5]} icon`) && Lt(t, "alt", e);
    },
    d(u) {
      u && xi(t);
    }
  };
}
function _o(d) {
  let t, n, e, u;
  const f = [wo, yo], k = [];
  function m(o, l) {
    return (
      /*link*/
      o[6] && /*link*/
      o[6].length > 0 ? 0 : 1
    );
  }
  return t = m(d), n = k[t] = f[t](d), {
    c() {
      n.c(), e = go();
    },
    m(o, l) {
      k[t].m(o, l), Li(o, e, l), u = !0;
    },
    p(o, [l]) {
      let c = t;
      t = m(o), t === c ? k[t].p(o, l) : (mo(), qi(k[c], 1, 1, () => {
        k[c] = null;
      }), po(), n = k[t], n ? n.p(o, l) : (n = k[t] = f[t](o), n.c()), Wi(n, 1), n.m(e.parentNode, e));
    },
    i(o) {
      u || (Wi(n), u = !0);
    },
    o(o) {
      qi(n), u = !1;
    },
    d(o) {
      o && xi(e), k[t].d(o);
    }
  };
}
function So(d, t, n) {
  let e, { $$slots: u = {}, $$scope: f } = t, { elem_id: k = "" } = t, { elem_classes: m = [] } = t, { visible: o = !0 } = t, { variant: l = "secondary" } = t, { size: c = "lg" } = t, { value: s = null } = t, { link: p = null } = t, { icon: b = null } = t, { disabled: S = !1 } = t, { scale: a = null } = t, { min_width: E = void 0 } = t, { root: i = "" } = t, { proxy_url: r = null } = t;
  function v(y) {
    fo.call(this, d, y);
  }
  return d.$$set = (y) => {
    "elem_id" in y && n(0, k = y.elem_id), "elem_classes" in y && n(1, m = y.elem_classes), "visible" in y && n(2, o = y.visible), "variant" in y && n(3, l = y.variant), "size" in y && n(4, c = y.size), "value" in y && n(5, s = y.value), "link" in y && n(6, p = y.link), "icon" in y && n(7, b = y.icon), "disabled" in y && n(8, S = y.disabled), "scale" in y && n(9, a = y.scale), "min_width" in y && n(10, E = y.min_width), "root" in y && n(12, i = y.root), "proxy_url" in y && n(13, r = y.proxy_url), "$$scope" in y && n(14, f = y.$$scope);
  }, d.$$.update = () => {
    d.$$.dirty & /*icon, root, proxy_url*/
    12416 && n(11, e = ho(b, i, r));
  }, [
    k,
    m,
    o,
    l,
    c,
    s,
    p,
    b,
    S,
    a,
    E,
    e,
    i,
    r,
    f,
    u,
    v
  ];
}
class cs extends uo {
  constructor(t) {
    super(), bo(this, t, So, _o, vo, {
      elem_id: 0,
      elem_classes: 1,
      visible: 2,
      variant: 3,
      size: 4,
      value: 5,
      link: 6,
      icon: 7,
      disabled: 8,
      scale: 9,
      min_width: 10,
      root: 12,
      proxy_url: 13
    });
  }
}
function bi(d) {
  let t = ["", "k", "M", "G", "T", "P", "E", "Z"], n = 0;
  for (; d > 1e3 && n < t.length - 1; )
    d /= 1e3, n++;
  let e = t[n];
  return (Number.isInteger(d) ? d : d.toFixed(1)) + e;
}
function Vi() {
}
function Eo(d, t) {
  return d != d ? t == t : d !== t || d && typeof d == "object" || typeof d == "function";
}
const Ar = typeof window < "u";
let hs = Ar ? () => window.performance.now() : () => Date.now(), vr = Ar ? (d) => requestAnimationFrame(d) : Vi;
const vi = /* @__PURE__ */ new Set();
function yr(d) {
  vi.forEach((t) => {
    t.c(d) || (vi.delete(t), t.f());
  }), vi.size !== 0 && vr(yr);
}
function To(d) {
  let t;
  return vi.size === 0 && vr(yr), {
    promise: new Promise((n) => {
      vi.add(t = { c: d, f: n });
    }),
    abort() {
      vi.delete(t);
    }
  };
}
const ui = [];
function Co(d, t = Vi) {
  let n;
  const e = /* @__PURE__ */ new Set();
  function u(m) {
    if (Eo(d, m) && (d = m, n)) {
      const o = !ui.length;
      for (const l of e)
        l[1](), ui.push(l, d);
      if (o) {
        for (let l = 0; l < ui.length; l += 2)
          ui[l][0](ui[l + 1]);
        ui.length = 0;
      }
    }
  }
  function f(m) {
    u(m(d));
  }
  function k(m, o = Vi) {
    const l = [m, o];
    return e.add(l), e.size === 1 && (n = t(u, f) || Vi), m(d), () => {
      e.delete(l), e.size === 0 && n && (n(), n = null);
    };
  }
  return { set: u, update: f, subscribe: k };
}
function ds(d) {
  return Object.prototype.toString.call(d) === "[object Date]";
}
function Mn(d, t, n, e) {
  if (typeof n == "number" || ds(n)) {
    const u = e - n, f = (n - t) / (d.dt || 1 / 60), k = d.opts.stiffness * u, m = d.opts.damping * f, o = (k - m) * d.inv_mass, l = (f + o) * d.dt;
    return Math.abs(l) < d.opts.precision && Math.abs(u) < d.opts.precision ? e : (d.settled = !1, ds(n) ? new Date(n.getTime() + l) : n + l);
  } else {
    if (Array.isArray(n))
      return n.map(
        (u, f) => Mn(d, t[f], n[f], e[f])
      );
    if (typeof n == "object") {
      const u = {};
      for (const f in n)
        u[f] = Mn(d, t[f], n[f], e[f]);
      return u;
    } else
      throw new Error(`Cannot spring ${typeof n} values`);
  }
}
function us(d, t = {}) {
  const n = Co(d), { stiffness: e = 0.15, damping: u = 0.8, precision: f = 0.01 } = t;
  let k, m, o, l = d, c = d, s = 1, p = 0, b = !1;
  function S(E, i = {}) {
    c = E;
    const r = o = {};
    return d == null || i.hard || a.stiffness >= 1 && a.damping >= 1 ? (b = !0, k = hs(), l = E, n.set(d = c), Promise.resolve()) : (i.soft && (p = 1 / ((i.soft === !0 ? 0.5 : +i.soft) * 60), s = 0), m || (k = hs(), b = !1, m = To((v) => {
      if (b)
        return b = !1, m = null, !1;
      s = Math.min(s + p, 1);
      const y = {
        inv_mass: s,
        opts: a,
        settled: !0,
        dt: (v - k) * 60 / 1e3
      }, R = Mn(y, l, d, c);
      return k = v, l = d, n.set(d = R), y.settled && (m = null), !y.settled;
    })), new Promise((v) => {
      m.promise.then(() => {
        r === o && v();
      });
    }));
  }
  const a = {
    set: S,
    update: (E, i) => S(E(c, d), i),
    subscribe: n.subscribe,
    stiffness: e,
    damping: u,
    precision: f
  };
  return a;
}
const {
  SvelteComponent: ko,
  append: pe,
  attr: Ct,
  component_subscribe: fs,
  detach: Ro,
  element: xo,
  init: Lo,
  insert: Fo,
  noop: ps,
  safe_not_equal: Mo,
  set_style: Oi,
  svg_element: ge,
  toggle_class: gs
} = window.__gradio__svelte__internal, { onMount: Io } = window.__gradio__svelte__internal;
function Po(d) {
  let t, n, e, u, f, k, m, o, l, c, s, p;
  return {
    c() {
      t = xo("div"), n = ge("svg"), e = ge("g"), u = ge("path"), f = ge("path"), k = ge("path"), m = ge("path"), o = ge("g"), l = ge("path"), c = ge("path"), s = ge("path"), p = ge("path"), Ct(u, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), Ct(u, "fill", "#FF7C00"), Ct(u, "fill-opacity", "0.4"), Ct(u, "class", "svelte-43sxxs"), Ct(f, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), Ct(f, "fill", "#FF7C00"), Ct(f, "class", "svelte-43sxxs"), Ct(k, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), Ct(k, "fill", "#FF7C00"), Ct(k, "fill-opacity", "0.4"), Ct(k, "class", "svelte-43sxxs"), Ct(m, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), Ct(m, "fill", "#FF7C00"), Ct(m, "class", "svelte-43sxxs"), Oi(e, "transform", "translate(" + /*$top*/
      d[1][0] + "px, " + /*$top*/
      d[1][1] + "px)"), Ct(l, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), Ct(l, "fill", "#FF7C00"), Ct(l, "fill-opacity", "0.4"), Ct(l, "class", "svelte-43sxxs"), Ct(c, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), Ct(c, "fill", "#FF7C00"), Ct(c, "class", "svelte-43sxxs"), Ct(s, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), Ct(s, "fill", "#FF7C00"), Ct(s, "fill-opacity", "0.4"), Ct(s, "class", "svelte-43sxxs"), Ct(p, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), Ct(p, "fill", "#FF7C00"), Ct(p, "class", "svelte-43sxxs"), Oi(o, "transform", "translate(" + /*$bottom*/
      d[2][0] + "px, " + /*$bottom*/
      d[2][1] + "px)"), Ct(n, "viewBox", "-1200 -1200 3000 3000"), Ct(n, "fill", "none"), Ct(n, "xmlns", "http://www.w3.org/2000/svg"), Ct(n, "class", "svelte-43sxxs"), Ct(t, "class", "svelte-43sxxs"), gs(
        t,
        "margin",
        /*margin*/
        d[0]
      );
    },
    m(b, S) {
      Fo(b, t, S), pe(t, n), pe(n, e), pe(e, u), pe(e, f), pe(e, k), pe(e, m), pe(n, o), pe(o, l), pe(o, c), pe(o, s), pe(o, p);
    },
    p(b, [S]) {
      S & /*$top*/
      2 && Oi(e, "transform", "translate(" + /*$top*/
      b[1][0] + "px, " + /*$top*/
      b[1][1] + "px)"), S & /*$bottom*/
      4 && Oi(o, "transform", "translate(" + /*$bottom*/
      b[2][0] + "px, " + /*$bottom*/
      b[2][1] + "px)"), S & /*margin*/
      1 && gs(
        t,
        "margin",
        /*margin*/
        b[0]
      );
    },
    i: ps,
    o: ps,
    d(b) {
      b && Ro(t);
    }
  };
}
function No(d, t, n) {
  let e, u;
  var f = this && this.__awaiter || function(b, S, a, E) {
    function i(r) {
      return r instanceof a ? r : new a(function(v) {
        v(r);
      });
    }
    return new (a || (a = Promise))(function(r, v) {
      function y(I) {
        try {
          F(E.next(I));
        } catch (H) {
          v(H);
        }
      }
      function R(I) {
        try {
          F(E.throw(I));
        } catch (H) {
          v(H);
        }
      }
      function F(I) {
        I.done ? r(I.value) : i(I.value).then(y, R);
      }
      F((E = E.apply(b, S || [])).next());
    });
  };
  let { margin: k = !0 } = t;
  const m = us([0, 0]);
  fs(d, m, (b) => n(1, e = b));
  const o = us([0, 0]);
  fs(d, o, (b) => n(2, u = b));
  let l;
  function c() {
    return f(this, void 0, void 0, function* () {
      yield Promise.all([m.set([125, 140]), o.set([-125, -140])]), yield Promise.all([m.set([-125, 140]), o.set([125, -140])]), yield Promise.all([m.set([-125, 0]), o.set([125, -0])]), yield Promise.all([m.set([125, 0]), o.set([-125, 0])]);
    });
  }
  function s() {
    return f(this, void 0, void 0, function* () {
      yield c(), l || s();
    });
  }
  function p() {
    return f(this, void 0, void 0, function* () {
      yield Promise.all([m.set([125, 0]), o.set([-125, 0])]), s();
    });
  }
  return Io(() => (p(), () => l = !0)), d.$$set = (b) => {
    "margin" in b && n(0, k = b.margin);
  }, [k, e, u, m, o];
}
class Do extends ko {
  constructor(t) {
    super(), Lo(this, t, No, Po, Mo, { margin: 0 });
  }
}
const {
  SvelteComponent: Oo,
  append: In,
  attr: Ie,
  bubble: Ho,
  create_component: zo,
  destroy_component: Bo,
  detach: wr,
  element: Pn,
  init: Uo,
  insert: _r,
  listen: Go,
  mount_component: Vo,
  safe_not_equal: Xo,
  set_data: jo,
  set_style: fi,
  space: Wo,
  text: qo,
  toggle_class: Yt,
  transition_in: Yo,
  transition_out: Ko
} = window.__gradio__svelte__internal;
function ms(d) {
  let t, n;
  return {
    c() {
      t = Pn("span"), n = qo(
        /*label*/
        d[1]
      ), Ie(t, "class", "svelte-1lrphxw");
    },
    m(e, u) {
      _r(e, t, u), In(t, n);
    },
    p(e, u) {
      u & /*label*/
      2 && jo(
        n,
        /*label*/
        e[1]
      );
    },
    d(e) {
      e && wr(t);
    }
  };
}
function Jo(d) {
  let t, n, e, u, f, k, m, o = (
    /*show_label*/
    d[2] && ms(d)
  );
  return u = new /*Icon*/
  d[0]({}), {
    c() {
      t = Pn("button"), o && o.c(), n = Wo(), e = Pn("div"), zo(u.$$.fragment), Ie(e, "class", "svelte-1lrphxw"), Yt(
        e,
        "small",
        /*size*/
        d[4] === "small"
      ), Yt(
        e,
        "large",
        /*size*/
        d[4] === "large"
      ), Yt(
        e,
        "medium",
        /*size*/
        d[4] === "medium"
      ), t.disabled = /*disabled*/
      d[7], Ie(
        t,
        "aria-label",
        /*label*/
        d[1]
      ), Ie(
        t,
        "aria-haspopup",
        /*hasPopup*/
        d[8]
      ), Ie(
        t,
        "title",
        /*label*/
        d[1]
      ), Ie(t, "class", "svelte-1lrphxw"), Yt(
        t,
        "pending",
        /*pending*/
        d[3]
      ), Yt(
        t,
        "padded",
        /*padded*/
        d[5]
      ), Yt(
        t,
        "highlight",
        /*highlight*/
        d[6]
      ), Yt(
        t,
        "transparent",
        /*transparent*/
        d[9]
      ), fi(t, "color", !/*disabled*/
      d[7] && /*_color*/
      d[12] ? (
        /*_color*/
        d[12]
      ) : "var(--block-label-text-color)"), fi(t, "--bg-color", /*disabled*/
      d[7] ? "auto" : (
        /*background*/
        d[10]
      )), fi(
        t,
        "margin-left",
        /*offset*/
        d[11] + "px"
      );
    },
    m(l, c) {
      _r(l, t, c), o && o.m(t, null), In(t, n), In(t, e), Vo(u, e, null), f = !0, k || (m = Go(
        t,
        "click",
        /*click_handler*/
        d[14]
      ), k = !0);
    },
    p(l, [c]) {
      /*show_label*/
      l[2] ? o ? o.p(l, c) : (o = ms(l), o.c(), o.m(t, n)) : o && (o.d(1), o = null), (!f || c & /*size*/
      16) && Yt(
        e,
        "small",
        /*size*/
        l[4] === "small"
      ), (!f || c & /*size*/
      16) && Yt(
        e,
        "large",
        /*size*/
        l[4] === "large"
      ), (!f || c & /*size*/
      16) && Yt(
        e,
        "medium",
        /*size*/
        l[4] === "medium"
      ), (!f || c & /*disabled*/
      128) && (t.disabled = /*disabled*/
      l[7]), (!f || c & /*label*/
      2) && Ie(
        t,
        "aria-label",
        /*label*/
        l[1]
      ), (!f || c & /*hasPopup*/
      256) && Ie(
        t,
        "aria-haspopup",
        /*hasPopup*/
        l[8]
      ), (!f || c & /*label*/
      2) && Ie(
        t,
        "title",
        /*label*/
        l[1]
      ), (!f || c & /*pending*/
      8) && Yt(
        t,
        "pending",
        /*pending*/
        l[3]
      ), (!f || c & /*padded*/
      32) && Yt(
        t,
        "padded",
        /*padded*/
        l[5]
      ), (!f || c & /*highlight*/
      64) && Yt(
        t,
        "highlight",
        /*highlight*/
        l[6]
      ), (!f || c & /*transparent*/
      512) && Yt(
        t,
        "transparent",
        /*transparent*/
        l[9]
      ), c & /*disabled, _color*/
      4224 && fi(t, "color", !/*disabled*/
      l[7] && /*_color*/
      l[12] ? (
        /*_color*/
        l[12]
      ) : "var(--block-label-text-color)"), c & /*disabled, background*/
      1152 && fi(t, "--bg-color", /*disabled*/
      l[7] ? "auto" : (
        /*background*/
        l[10]
      )), c & /*offset*/
      2048 && fi(
        t,
        "margin-left",
        /*offset*/
        l[11] + "px"
      );
    },
    i(l) {
      f || (Yo(u.$$.fragment, l), f = !0);
    },
    o(l) {
      Ko(u.$$.fragment, l), f = !1;
    },
    d(l) {
      l && wr(t), o && o.d(), Bo(u), k = !1, m();
    }
  };
}
function Qo(d, t, n) {
  let e, { Icon: u } = t, { label: f = "" } = t, { show_label: k = !1 } = t, { pending: m = !1 } = t, { size: o = "small" } = t, { padded: l = !0 } = t, { highlight: c = !1 } = t, { disabled: s = !1 } = t, { hasPopup: p = !1 } = t, { color: b = "var(--block-label-text-color)" } = t, { transparent: S = !1 } = t, { background: a = "var(--background-fill-primary)" } = t, { offset: E = 0 } = t;
  function i(r) {
    Ho.call(this, d, r);
  }
  return d.$$set = (r) => {
    "Icon" in r && n(0, u = r.Icon), "label" in r && n(1, f = r.label), "show_label" in r && n(2, k = r.show_label), "pending" in r && n(3, m = r.pending), "size" in r && n(4, o = r.size), "padded" in r && n(5, l = r.padded), "highlight" in r && n(6, c = r.highlight), "disabled" in r && n(7, s = r.disabled), "hasPopup" in r && n(8, p = r.hasPopup), "color" in r && n(13, b = r.color), "transparent" in r && n(9, S = r.transparent), "background" in r && n(10, a = r.background), "offset" in r && n(11, E = r.offset);
  }, d.$$.update = () => {
    d.$$.dirty & /*highlight, color*/
    8256 && n(12, e = c ? "var(--color-accent)" : b);
  }, [
    u,
    f,
    k,
    m,
    o,
    l,
    c,
    s,
    p,
    S,
    a,
    E,
    e,
    b,
    i
  ];
}
let Zo = class extends Oo {
  constructor(t) {
    super(), Uo(this, t, Qo, Jo, Xo, {
      Icon: 0,
      label: 1,
      show_label: 2,
      pending: 3,
      size: 4,
      padded: 5,
      highlight: 6,
      disabled: 7,
      hasPopup: 8,
      color: 13,
      transparent: 9,
      background: 10,
      offset: 11
    });
  }
};
const {
  SvelteComponent: $o,
  append: fn,
  attr: me,
  detach: tl,
  init: el,
  insert: il,
  noop: pn,
  safe_not_equal: nl,
  set_style: Ee,
  svg_element: Hi
} = window.__gradio__svelte__internal;
function sl(d) {
  let t, n, e, u;
  return {
    c() {
      t = Hi("svg"), n = Hi("g"), e = Hi("path"), u = Hi("path"), me(e, "d", "M18,6L6.087,17.913"), Ee(e, "fill", "none"), Ee(e, "fill-rule", "nonzero"), Ee(e, "stroke-width", "2px"), me(n, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), me(u, "d", "M4.364,4.364L19.636,19.636"), Ee(u, "fill", "none"), Ee(u, "fill-rule", "nonzero"), Ee(u, "stroke-width", "2px"), me(t, "width", "100%"), me(t, "height", "100%"), me(t, "viewBox", "0 0 24 24"), me(t, "version", "1.1"), me(t, "xmlns", "http://www.w3.org/2000/svg"), me(t, "xmlns:xlink", "http://www.w3.org/1999/xlink"), me(t, "xml:space", "preserve"), me(t, "stroke", "currentColor"), Ee(t, "fill-rule", "evenodd"), Ee(t, "clip-rule", "evenodd"), Ee(t, "stroke-linecap", "round"), Ee(t, "stroke-linejoin", "round");
    },
    m(f, k) {
      il(f, t, k), fn(t, n), fn(n, e), fn(t, u);
    },
    p: pn,
    i: pn,
    o: pn,
    d(f) {
      f && tl(t);
    }
  };
}
let rl = class extends $o {
  constructor(t) {
    super(), el(this, t, null, sl, nl, {});
  }
};
const {
  SvelteComponent: al,
  append: ri,
  attr: _e,
  binding_callbacks: bs,
  check_outros: Nn,
  create_component: Sr,
  create_slot: Er,
  destroy_component: Tr,
  destroy_each: Cr,
  detach: vt,
  element: ke,
  empty: yi,
  ensure_array_like: Yi,
  get_all_dirty_from_scope: kr,
  get_slot_changes: Rr,
  group_outros: Dn,
  init: ol,
  insert: yt,
  mount_component: xr,
  noop: On,
  safe_not_equal: ll,
  set_data: he,
  set_style: Xe,
  space: ce,
  text: Ft,
  toggle_class: oe,
  transition_in: we,
  transition_out: Re,
  update_slot_base: Lr
} = window.__gradio__svelte__internal, { tick: cl } = window.__gradio__svelte__internal, { onDestroy: hl } = window.__gradio__svelte__internal, { createEventDispatcher: dl } = window.__gradio__svelte__internal, ul = (d) => ({}), As = (d) => ({}), fl = (d) => ({}), vs = (d) => ({});
function ys(d, t, n) {
  const e = d.slice();
  return e[41] = t[n], e[43] = n, e;
}
function ws(d, t, n) {
  const e = d.slice();
  return e[41] = t[n], e;
}
function pl(d) {
  let t, n, e, u, f = (
    /*i18n*/
    d[1]("common.error") + ""
  ), k, m, o;
  n = new Zo({
    props: {
      Icon: rl,
      label: (
        /*i18n*/
        d[1]("common.clear")
      ),
      disabled: !1
    }
  }), n.$on(
    "click",
    /*click_handler*/
    d[32]
  );
  const l = (
    /*#slots*/
    d[30].error
  ), c = Er(
    l,
    d,
    /*$$scope*/
    d[29],
    As
  );
  return {
    c() {
      t = ke("div"), Sr(n.$$.fragment), e = ce(), u = ke("span"), k = Ft(f), m = ce(), c && c.c(), _e(t, "class", "clear-status svelte-v0wucf"), _e(u, "class", "error svelte-v0wucf");
    },
    m(s, p) {
      yt(s, t, p), xr(n, t, null), yt(s, e, p), yt(s, u, p), ri(u, k), yt(s, m, p), c && c.m(s, p), o = !0;
    },
    p(s, p) {
      const b = {};
      p[0] & /*i18n*/
      2 && (b.label = /*i18n*/
      s[1]("common.clear")), n.$set(b), (!o || p[0] & /*i18n*/
      2) && f !== (f = /*i18n*/
      s[1]("common.error") + "") && he(k, f), c && c.p && (!o || p[0] & /*$$scope*/
      536870912) && Lr(
        c,
        l,
        s,
        /*$$scope*/
        s[29],
        o ? Rr(
          l,
          /*$$scope*/
          s[29],
          p,
          ul
        ) : kr(
          /*$$scope*/
          s[29]
        ),
        As
      );
    },
    i(s) {
      o || (we(n.$$.fragment, s), we(c, s), o = !0);
    },
    o(s) {
      Re(n.$$.fragment, s), Re(c, s), o = !1;
    },
    d(s) {
      s && (vt(t), vt(e), vt(u), vt(m)), Tr(n), c && c.d(s);
    }
  };
}
function gl(d) {
  let t, n, e, u, f, k, m, o, l, c = (
    /*variant*/
    d[8] === "default" && /*show_eta_bar*/
    d[18] && /*show_progress*/
    d[6] === "full" && _s(d)
  );
  function s(v, y) {
    if (
      /*progress*/
      v[7]
    )
      return Al;
    if (
      /*queue_position*/
      v[2] !== null && /*queue_size*/
      v[3] !== void 0 && /*queue_position*/
      v[2] >= 0
    )
      return bl;
    if (
      /*queue_position*/
      v[2] === 0
    )
      return ml;
  }
  let p = s(d), b = p && p(d), S = (
    /*timer*/
    d[5] && Ts(d)
  );
  const a = [_l, wl], E = [];
  function i(v, y) {
    return (
      /*last_progress_level*/
      v[15] != null ? 0 : (
        /*show_progress*/
        v[6] === "full" ? 1 : -1
      )
    );
  }
  ~(f = i(d)) && (k = E[f] = a[f](d));
  let r = !/*timer*/
  d[5] && Ms(d);
  return {
    c() {
      c && c.c(), t = ce(), n = ke("div"), b && b.c(), e = ce(), S && S.c(), u = ce(), k && k.c(), m = ce(), r && r.c(), o = yi(), _e(n, "class", "progress-text svelte-v0wucf"), oe(
        n,
        "meta-text-center",
        /*variant*/
        d[8] === "center"
      ), oe(
        n,
        "meta-text",
        /*variant*/
        d[8] === "default"
      );
    },
    m(v, y) {
      c && c.m(v, y), yt(v, t, y), yt(v, n, y), b && b.m(n, null), ri(n, e), S && S.m(n, null), yt(v, u, y), ~f && E[f].m(v, y), yt(v, m, y), r && r.m(v, y), yt(v, o, y), l = !0;
    },
    p(v, y) {
      /*variant*/
      v[8] === "default" && /*show_eta_bar*/
      v[18] && /*show_progress*/
      v[6] === "full" ? c ? c.p(v, y) : (c = _s(v), c.c(), c.m(t.parentNode, t)) : c && (c.d(1), c = null), p === (p = s(v)) && b ? b.p(v, y) : (b && b.d(1), b = p && p(v), b && (b.c(), b.m(n, e))), /*timer*/
      v[5] ? S ? S.p(v, y) : (S = Ts(v), S.c(), S.m(n, null)) : S && (S.d(1), S = null), (!l || y[0] & /*variant*/
      256) && oe(
        n,
        "meta-text-center",
        /*variant*/
        v[8] === "center"
      ), (!l || y[0] & /*variant*/
      256) && oe(
        n,
        "meta-text",
        /*variant*/
        v[8] === "default"
      );
      let R = f;
      f = i(v), f === R ? ~f && E[f].p(v, y) : (k && (Dn(), Re(E[R], 1, 1, () => {
        E[R] = null;
      }), Nn()), ~f ? (k = E[f], k ? k.p(v, y) : (k = E[f] = a[f](v), k.c()), we(k, 1), k.m(m.parentNode, m)) : k = null), /*timer*/
      v[5] ? r && (Dn(), Re(r, 1, 1, () => {
        r = null;
      }), Nn()) : r ? (r.p(v, y), y[0] & /*timer*/
      32 && we(r, 1)) : (r = Ms(v), r.c(), we(r, 1), r.m(o.parentNode, o));
    },
    i(v) {
      l || (we(k), we(r), l = !0);
    },
    o(v) {
      Re(k), Re(r), l = !1;
    },
    d(v) {
      v && (vt(t), vt(n), vt(u), vt(m), vt(o)), c && c.d(v), b && b.d(), S && S.d(), ~f && E[f].d(v), r && r.d(v);
    }
  };
}
function _s(d) {
  let t, n = `translateX(${/*eta_level*/
  (d[17] || 0) * 100 - 100}%)`;
  return {
    c() {
      t = ke("div"), _e(t, "class", "eta-bar svelte-v0wucf"), Xe(t, "transform", n);
    },
    m(e, u) {
      yt(e, t, u);
    },
    p(e, u) {
      u[0] & /*eta_level*/
      131072 && n !== (n = `translateX(${/*eta_level*/
      (e[17] || 0) * 100 - 100}%)`) && Xe(t, "transform", n);
    },
    d(e) {
      e && vt(t);
    }
  };
}
function ml(d) {
  let t;
  return {
    c() {
      t = Ft("processing |");
    },
    m(n, e) {
      yt(n, t, e);
    },
    p: On,
    d(n) {
      n && vt(t);
    }
  };
}
function bl(d) {
  let t, n = (
    /*queue_position*/
    d[2] + 1 + ""
  ), e, u, f, k;
  return {
    c() {
      t = Ft("queue: "), e = Ft(n), u = Ft("/"), f = Ft(
        /*queue_size*/
        d[3]
      ), k = Ft(" |");
    },
    m(m, o) {
      yt(m, t, o), yt(m, e, o), yt(m, u, o), yt(m, f, o), yt(m, k, o);
    },
    p(m, o) {
      o[0] & /*queue_position*/
      4 && n !== (n = /*queue_position*/
      m[2] + 1 + "") && he(e, n), o[0] & /*queue_size*/
      8 && he(
        f,
        /*queue_size*/
        m[3]
      );
    },
    d(m) {
      m && (vt(t), vt(e), vt(u), vt(f), vt(k));
    }
  };
}
function Al(d) {
  let t, n = Yi(
    /*progress*/
    d[7]
  ), e = [];
  for (let u = 0; u < n.length; u += 1)
    e[u] = Es(ws(d, n, u));
  return {
    c() {
      for (let u = 0; u < e.length; u += 1)
        e[u].c();
      t = yi();
    },
    m(u, f) {
      for (let k = 0; k < e.length; k += 1)
        e[k] && e[k].m(u, f);
      yt(u, t, f);
    },
    p(u, f) {
      if (f[0] & /*progress*/
      128) {
        n = Yi(
          /*progress*/
          u[7]
        );
        let k;
        for (k = 0; k < n.length; k += 1) {
          const m = ws(u, n, k);
          e[k] ? e[k].p(m, f) : (e[k] = Es(m), e[k].c(), e[k].m(t.parentNode, t));
        }
        for (; k < e.length; k += 1)
          e[k].d(1);
        e.length = n.length;
      }
    },
    d(u) {
      u && vt(t), Cr(e, u);
    }
  };
}
function Ss(d) {
  let t, n = (
    /*p*/
    d[41].unit + ""
  ), e, u, f = " ", k;
  function m(c, s) {
    return (
      /*p*/
      c[41].length != null ? yl : vl
    );
  }
  let o = m(d), l = o(d);
  return {
    c() {
      l.c(), t = ce(), e = Ft(n), u = Ft(" | "), k = Ft(f);
    },
    m(c, s) {
      l.m(c, s), yt(c, t, s), yt(c, e, s), yt(c, u, s), yt(c, k, s);
    },
    p(c, s) {
      o === (o = m(c)) && l ? l.p(c, s) : (l.d(1), l = o(c), l && (l.c(), l.m(t.parentNode, t))), s[0] & /*progress*/
      128 && n !== (n = /*p*/
      c[41].unit + "") && he(e, n);
    },
    d(c) {
      c && (vt(t), vt(e), vt(u), vt(k)), l.d(c);
    }
  };
}
function vl(d) {
  let t = bi(
    /*p*/
    d[41].index || 0
  ) + "", n;
  return {
    c() {
      n = Ft(t);
    },
    m(e, u) {
      yt(e, n, u);
    },
    p(e, u) {
      u[0] & /*progress*/
      128 && t !== (t = bi(
        /*p*/
        e[41].index || 0
      ) + "") && he(n, t);
    },
    d(e) {
      e && vt(n);
    }
  };
}
function yl(d) {
  let t = bi(
    /*p*/
    d[41].index || 0
  ) + "", n, e, u = bi(
    /*p*/
    d[41].length
  ) + "", f;
  return {
    c() {
      n = Ft(t), e = Ft("/"), f = Ft(u);
    },
    m(k, m) {
      yt(k, n, m), yt(k, e, m), yt(k, f, m);
    },
    p(k, m) {
      m[0] & /*progress*/
      128 && t !== (t = bi(
        /*p*/
        k[41].index || 0
      ) + "") && he(n, t), m[0] & /*progress*/
      128 && u !== (u = bi(
        /*p*/
        k[41].length
      ) + "") && he(f, u);
    },
    d(k) {
      k && (vt(n), vt(e), vt(f));
    }
  };
}
function Es(d) {
  let t, n = (
    /*p*/
    d[41].index != null && Ss(d)
  );
  return {
    c() {
      n && n.c(), t = yi();
    },
    m(e, u) {
      n && n.m(e, u), yt(e, t, u);
    },
    p(e, u) {
      /*p*/
      e[41].index != null ? n ? n.p(e, u) : (n = Ss(e), n.c(), n.m(t.parentNode, t)) : n && (n.d(1), n = null);
    },
    d(e) {
      e && vt(t), n && n.d(e);
    }
  };
}
function Ts(d) {
  let t, n = (
    /*eta*/
    d[0] ? `/${/*formatted_eta*/
    d[19]}` : ""
  ), e, u;
  return {
    c() {
      t = Ft(
        /*formatted_timer*/
        d[20]
      ), e = Ft(n), u = Ft("s");
    },
    m(f, k) {
      yt(f, t, k), yt(f, e, k), yt(f, u, k);
    },
    p(f, k) {
      k[0] & /*formatted_timer*/
      1048576 && he(
        t,
        /*formatted_timer*/
        f[20]
      ), k[0] & /*eta, formatted_eta*/
      524289 && n !== (n = /*eta*/
      f[0] ? `/${/*formatted_eta*/
      f[19]}` : "") && he(e, n);
    },
    d(f) {
      f && (vt(t), vt(e), vt(u));
    }
  };
}
function wl(d) {
  let t, n;
  return t = new Do({
    props: { margin: (
      /*variant*/
      d[8] === "default"
    ) }
  }), {
    c() {
      Sr(t.$$.fragment);
    },
    m(e, u) {
      xr(t, e, u), n = !0;
    },
    p(e, u) {
      const f = {};
      u[0] & /*variant*/
      256 && (f.margin = /*variant*/
      e[8] === "default"), t.$set(f);
    },
    i(e) {
      n || (we(t.$$.fragment, e), n = !0);
    },
    o(e) {
      Re(t.$$.fragment, e), n = !1;
    },
    d(e) {
      Tr(t, e);
    }
  };
}
function _l(d) {
  let t, n, e, u, f, k = `${/*last_progress_level*/
  d[15] * 100}%`, m = (
    /*progress*/
    d[7] != null && Cs(d)
  );
  return {
    c() {
      t = ke("div"), n = ke("div"), m && m.c(), e = ce(), u = ke("div"), f = ke("div"), _e(n, "class", "progress-level-inner svelte-v0wucf"), _e(f, "class", "progress-bar svelte-v0wucf"), Xe(f, "width", k), _e(u, "class", "progress-bar-wrap svelte-v0wucf"), _e(t, "class", "progress-level svelte-v0wucf");
    },
    m(o, l) {
      yt(o, t, l), ri(t, n), m && m.m(n, null), ri(t, e), ri(t, u), ri(u, f), d[31](f);
    },
    p(o, l) {
      /*progress*/
      o[7] != null ? m ? m.p(o, l) : (m = Cs(o), m.c(), m.m(n, null)) : m && (m.d(1), m = null), l[0] & /*last_progress_level*/
      32768 && k !== (k = `${/*last_progress_level*/
      o[15] * 100}%`) && Xe(f, "width", k);
    },
    i: On,
    o: On,
    d(o) {
      o && vt(t), m && m.d(), d[31](null);
    }
  };
}
function Cs(d) {
  let t, n = Yi(
    /*progress*/
    d[7]
  ), e = [];
  for (let u = 0; u < n.length; u += 1)
    e[u] = Fs(ys(d, n, u));
  return {
    c() {
      for (let u = 0; u < e.length; u += 1)
        e[u].c();
      t = yi();
    },
    m(u, f) {
      for (let k = 0; k < e.length; k += 1)
        e[k] && e[k].m(u, f);
      yt(u, t, f);
    },
    p(u, f) {
      if (f[0] & /*progress_level, progress*/
      16512) {
        n = Yi(
          /*progress*/
          u[7]
        );
        let k;
        for (k = 0; k < n.length; k += 1) {
          const m = ys(u, n, k);
          e[k] ? e[k].p(m, f) : (e[k] = Fs(m), e[k].c(), e[k].m(t.parentNode, t));
        }
        for (; k < e.length; k += 1)
          e[k].d(1);
        e.length = n.length;
      }
    },
    d(u) {
      u && vt(t), Cr(e, u);
    }
  };
}
function ks(d) {
  let t, n, e, u, f = (
    /*i*/
    d[43] !== 0 && Sl()
  ), k = (
    /*p*/
    d[41].desc != null && Rs(d)
  ), m = (
    /*p*/
    d[41].desc != null && /*progress_level*/
    d[14] && /*progress_level*/
    d[14][
      /*i*/
      d[43]
    ] != null && xs()
  ), o = (
    /*progress_level*/
    d[14] != null && Ls(d)
  );
  return {
    c() {
      f && f.c(), t = ce(), k && k.c(), n = ce(), m && m.c(), e = ce(), o && o.c(), u = yi();
    },
    m(l, c) {
      f && f.m(l, c), yt(l, t, c), k && k.m(l, c), yt(l, n, c), m && m.m(l, c), yt(l, e, c), o && o.m(l, c), yt(l, u, c);
    },
    p(l, c) {
      /*p*/
      l[41].desc != null ? k ? k.p(l, c) : (k = Rs(l), k.c(), k.m(n.parentNode, n)) : k && (k.d(1), k = null), /*p*/
      l[41].desc != null && /*progress_level*/
      l[14] && /*progress_level*/
      l[14][
        /*i*/
        l[43]
      ] != null ? m || (m = xs(), m.c(), m.m(e.parentNode, e)) : m && (m.d(1), m = null), /*progress_level*/
      l[14] != null ? o ? o.p(l, c) : (o = Ls(l), o.c(), o.m(u.parentNode, u)) : o && (o.d(1), o = null);
    },
    d(l) {
      l && (vt(t), vt(n), vt(e), vt(u)), f && f.d(l), k && k.d(l), m && m.d(l), o && o.d(l);
    }
  };
}
function Sl(d) {
  let t;
  return {
    c() {
      t = Ft(" /");
    },
    m(n, e) {
      yt(n, t, e);
    },
    d(n) {
      n && vt(t);
    }
  };
}
function Rs(d) {
  let t = (
    /*p*/
    d[41].desc + ""
  ), n;
  return {
    c() {
      n = Ft(t);
    },
    m(e, u) {
      yt(e, n, u);
    },
    p(e, u) {
      u[0] & /*progress*/
      128 && t !== (t = /*p*/
      e[41].desc + "") && he(n, t);
    },
    d(e) {
      e && vt(n);
    }
  };
}
function xs(d) {
  let t;
  return {
    c() {
      t = Ft("-");
    },
    m(n, e) {
      yt(n, t, e);
    },
    d(n) {
      n && vt(t);
    }
  };
}
function Ls(d) {
  let t = (100 * /*progress_level*/
  (d[14][
    /*i*/
    d[43]
  ] || 0)).toFixed(1) + "", n, e;
  return {
    c() {
      n = Ft(t), e = Ft("%");
    },
    m(u, f) {
      yt(u, n, f), yt(u, e, f);
    },
    p(u, f) {
      f[0] & /*progress_level*/
      16384 && t !== (t = (100 * /*progress_level*/
      (u[14][
        /*i*/
        u[43]
      ] || 0)).toFixed(1) + "") && he(n, t);
    },
    d(u) {
      u && (vt(n), vt(e));
    }
  };
}
function Fs(d) {
  let t, n = (
    /*p*/
    (d[41].desc != null || /*progress_level*/
    d[14] && /*progress_level*/
    d[14][
      /*i*/
      d[43]
    ] != null) && ks(d)
  );
  return {
    c() {
      n && n.c(), t = yi();
    },
    m(e, u) {
      n && n.m(e, u), yt(e, t, u);
    },
    p(e, u) {
      /*p*/
      e[41].desc != null || /*progress_level*/
      e[14] && /*progress_level*/
      e[14][
        /*i*/
        e[43]
      ] != null ? n ? n.p(e, u) : (n = ks(e), n.c(), n.m(t.parentNode, t)) : n && (n.d(1), n = null);
    },
    d(e) {
      e && vt(t), n && n.d(e);
    }
  };
}
function Ms(d) {
  let t, n, e, u;
  const f = (
    /*#slots*/
    d[30]["additional-loading-text"]
  ), k = Er(
    f,
    d,
    /*$$scope*/
    d[29],
    vs
  );
  return {
    c() {
      t = ke("p"), n = Ft(
        /*loading_text*/
        d[9]
      ), e = ce(), k && k.c(), _e(t, "class", "loading svelte-v0wucf");
    },
    m(m, o) {
      yt(m, t, o), ri(t, n), yt(m, e, o), k && k.m(m, o), u = !0;
    },
    p(m, o) {
      (!u || o[0] & /*loading_text*/
      512) && he(
        n,
        /*loading_text*/
        m[9]
      ), k && k.p && (!u || o[0] & /*$$scope*/
      536870912) && Lr(
        k,
        f,
        m,
        /*$$scope*/
        m[29],
        u ? Rr(
          f,
          /*$$scope*/
          m[29],
          o,
          fl
        ) : kr(
          /*$$scope*/
          m[29]
        ),
        vs
      );
    },
    i(m) {
      u || (we(k, m), u = !0);
    },
    o(m) {
      Re(k, m), u = !1;
    },
    d(m) {
      m && (vt(t), vt(e)), k && k.d(m);
    }
  };
}
function El(d) {
  let t, n, e, u, f;
  const k = [gl, pl], m = [];
  function o(l, c) {
    return (
      /*status*/
      l[4] === "pending" ? 0 : (
        /*status*/
        l[4] === "error" ? 1 : -1
      )
    );
  }
  return ~(n = o(d)) && (e = m[n] = k[n](d)), {
    c() {
      t = ke("div"), e && e.c(), _e(t, "class", u = "wrap " + /*variant*/
      d[8] + " " + /*show_progress*/
      d[6] + " svelte-v0wucf"), oe(t, "hide", !/*status*/
      d[4] || /*status*/
      d[4] === "complete" || /*show_progress*/
      d[6] === "hidden"), oe(
        t,
        "translucent",
        /*variant*/
        d[8] === "center" && /*status*/
        (d[4] === "pending" || /*status*/
        d[4] === "error") || /*translucent*/
        d[11] || /*show_progress*/
        d[6] === "minimal"
      ), oe(
        t,
        "generating",
        /*status*/
        d[4] === "generating" && /*show_progress*/
        d[6] === "full"
      ), oe(
        t,
        "border",
        /*border*/
        d[12]
      ), Xe(
        t,
        "position",
        /*absolute*/
        d[10] ? "absolute" : "static"
      ), Xe(
        t,
        "padding",
        /*absolute*/
        d[10] ? "0" : "var(--size-8) 0"
      );
    },
    m(l, c) {
      yt(l, t, c), ~n && m[n].m(t, null), d[33](t), f = !0;
    },
    p(l, c) {
      let s = n;
      n = o(l), n === s ? ~n && m[n].p(l, c) : (e && (Dn(), Re(m[s], 1, 1, () => {
        m[s] = null;
      }), Nn()), ~n ? (e = m[n], e ? e.p(l, c) : (e = m[n] = k[n](l), e.c()), we(e, 1), e.m(t, null)) : e = null), (!f || c[0] & /*variant, show_progress*/
      320 && u !== (u = "wrap " + /*variant*/
      l[8] + " " + /*show_progress*/
      l[6] + " svelte-v0wucf")) && _e(t, "class", u), (!f || c[0] & /*variant, show_progress, status, show_progress*/
      336) && oe(t, "hide", !/*status*/
      l[4] || /*status*/
      l[4] === "complete" || /*show_progress*/
      l[6] === "hidden"), (!f || c[0] & /*variant, show_progress, variant, status, translucent, show_progress*/
      2384) && oe(
        t,
        "translucent",
        /*variant*/
        l[8] === "center" && /*status*/
        (l[4] === "pending" || /*status*/
        l[4] === "error") || /*translucent*/
        l[11] || /*show_progress*/
        l[6] === "minimal"
      ), (!f || c[0] & /*variant, show_progress, status, show_progress*/
      336) && oe(
        t,
        "generating",
        /*status*/
        l[4] === "generating" && /*show_progress*/
        l[6] === "full"
      ), (!f || c[0] & /*variant, show_progress, border*/
      4416) && oe(
        t,
        "border",
        /*border*/
        l[12]
      ), c[0] & /*absolute*/
      1024 && Xe(
        t,
        "position",
        /*absolute*/
        l[10] ? "absolute" : "static"
      ), c[0] & /*absolute*/
      1024 && Xe(
        t,
        "padding",
        /*absolute*/
        l[10] ? "0" : "var(--size-8) 0"
      );
    },
    i(l) {
      f || (we(e), f = !0);
    },
    o(l) {
      Re(e), f = !1;
    },
    d(l) {
      l && vt(t), ~n && m[n].d(), d[33](null);
    }
  };
}
var Tl = function(d, t, n, e) {
  function u(f) {
    return f instanceof n ? f : new n(function(k) {
      k(f);
    });
  }
  return new (n || (n = Promise))(function(f, k) {
    function m(c) {
      try {
        l(e.next(c));
      } catch (s) {
        k(s);
      }
    }
    function o(c) {
      try {
        l(e.throw(c));
      } catch (s) {
        k(s);
      }
    }
    function l(c) {
      c.done ? f(c.value) : u(c.value).then(m, o);
    }
    l((e = e.apply(d, t || [])).next());
  });
};
let zi = [], gn = !1;
function Cl(d) {
  return Tl(this, arguments, void 0, function* (t, n = !0) {
    if (!(window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && n !== !0)) {
      if (zi.push(t), !gn)
        gn = !0;
      else
        return;
      yield cl(), requestAnimationFrame(() => {
        let e = [0, 0];
        for (let u = 0; u < zi.length; u++) {
          const k = zi[u].getBoundingClientRect();
          (u === 0 || k.top + window.scrollY <= e[0]) && (e[0] = k.top + window.scrollY, e[1] = u);
        }
        window.scrollTo({ top: e[0] - 20, behavior: "smooth" }), gn = !1, zi = [];
      });
    }
  });
}
function kl(d, t, n) {
  let e, { $$slots: u = {}, $$scope: f } = t;
  this && this.__awaiter;
  const k = dl();
  let { i18n: m } = t, { eta: o = null } = t, { queue_position: l } = t, { queue_size: c } = t, { status: s } = t, { scroll_to_output: p = !1 } = t, { timer: b = !0 } = t, { show_progress: S = "full" } = t, { message: a = null } = t, { progress: E = null } = t, { variant: i = "default" } = t, { loading_text: r = "Loading..." } = t, { absolute: v = !0 } = t, { translucent: y = !1 } = t, { border: R = !1 } = t, { autoscroll: F } = t, I, H = !1, B = 0, U = 0, X = null, Z = null, lt = 0, Y = null, V, j = null, $ = !0;
  const st = () => {
    n(0, o = n(27, X = n(19, rt = null))), n(25, B = performance.now()), n(26, U = 0), H = !0, J();
  };
  function J() {
    requestAnimationFrame(() => {
      n(26, U = (performance.now() - B) / 1e3), H && J();
    });
  }
  function ht() {
    n(26, U = 0), n(0, o = n(27, X = n(19, rt = null))), H && (H = !1);
  }
  hl(() => {
    H && ht();
  });
  let rt = null;
  function pt(Q) {
    bs[Q ? "unshift" : "push"](() => {
      j = Q, n(16, j), n(7, E), n(14, Y), n(15, V);
    });
  }
  const dt = () => {
    k("clear_status");
  };
  function ut(Q) {
    bs[Q ? "unshift" : "push"](() => {
      I = Q, n(13, I);
    });
  }
  return d.$$set = (Q) => {
    "i18n" in Q && n(1, m = Q.i18n), "eta" in Q && n(0, o = Q.eta), "queue_position" in Q && n(2, l = Q.queue_position), "queue_size" in Q && n(3, c = Q.queue_size), "status" in Q && n(4, s = Q.status), "scroll_to_output" in Q && n(22, p = Q.scroll_to_output), "timer" in Q && n(5, b = Q.timer), "show_progress" in Q && n(6, S = Q.show_progress), "message" in Q && n(23, a = Q.message), "progress" in Q && n(7, E = Q.progress), "variant" in Q && n(8, i = Q.variant), "loading_text" in Q && n(9, r = Q.loading_text), "absolute" in Q && n(10, v = Q.absolute), "translucent" in Q && n(11, y = Q.translucent), "border" in Q && n(12, R = Q.border), "autoscroll" in Q && n(24, F = Q.autoscroll), "$$scope" in Q && n(29, f = Q.$$scope);
  }, d.$$.update = () => {
    d.$$.dirty[0] & /*eta, old_eta, timer_start, eta_from_start*/
    436207617 && (o === null && n(0, o = X), o != null && X !== o && (n(28, Z = (performance.now() - B) / 1e3 + o), n(19, rt = Z.toFixed(1)), n(27, X = o))), d.$$.dirty[0] & /*eta_from_start, timer_diff*/
    335544320 && n(17, lt = Z === null || Z <= 0 || !U ? null : Math.min(U / Z, 1)), d.$$.dirty[0] & /*progress*/
    128 && E != null && n(18, $ = !1), d.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/
    114816 && (E != null ? n(14, Y = E.map((Q) => {
      if (Q.index != null && Q.length != null)
        return Q.index / Q.length;
      if (Q.progress != null)
        return Q.progress;
    })) : n(14, Y = null), Y ? (n(15, V = Y[Y.length - 1]), j && (V === 0 ? n(16, j.style.transition = "0", j) : n(16, j.style.transition = "150ms", j))) : n(15, V = void 0)), d.$$.dirty[0] & /*status*/
    16 && (s === "pending" ? st() : ht()), d.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/
    20979728 && I && p && (s === "pending" || s === "complete") && Cl(I, F), d.$$.dirty[0] & /*status, message*/
    8388624, d.$$.dirty[0] & /*timer_diff*/
    67108864 && n(20, e = U.toFixed(1));
  }, [
    o,
    m,
    l,
    c,
    s,
    b,
    S,
    E,
    i,
    r,
    v,
    y,
    R,
    I,
    Y,
    V,
    j,
    lt,
    $,
    rt,
    e,
    k,
    p,
    a,
    F,
    B,
    U,
    X,
    Z,
    f,
    u,
    pt,
    dt,
    ut
  ];
}
class Rl extends al {
  constructor(t) {
    super(), ol(
      this,
      t,
      kl,
      El,
      ll,
      {
        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.1.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.1.6/LICENSE */
const {
  entries: Fr,
  setPrototypeOf: Is,
  isFrozen: xl,
  getPrototypeOf: Ll,
  getOwnPropertyDescriptor: Fl
} = Object;
let {
  freeze: Xt,
  seal: de,
  create: Mr
} = Object, {
  apply: Hn,
  construct: zn
} = typeof Reflect < "u" && Reflect;
Xt || (Xt = function(t) {
  return t;
});
de || (de = function(t) {
  return t;
});
Hn || (Hn = function(t, n, e) {
  return t.apply(n, e);
});
zn || (zn = function(t, n) {
  return new t(...n);
});
const Bi = ie(Array.prototype.forEach), Ps = ie(Array.prototype.pop), _i = ie(Array.prototype.push), Xi = ie(String.prototype.toLowerCase), mn = ie(String.prototype.toString), Ns = ie(String.prototype.match), Si = ie(String.prototype.replace), Ml = ie(String.prototype.indexOf), Il = ie(String.prototype.trim), ve = ie(Object.prototype.hasOwnProperty), Vt = ie(RegExp.prototype.test), Ei = Pl(TypeError);
function ie(d) {
  return function(t) {
    for (var n = arguments.length, e = new Array(n > 1 ? n - 1 : 0), u = 1; u < n; u++)
      e[u - 1] = arguments[u];
    return Hn(d, t, e);
  };
}
function Pl(d) {
  return function() {
    for (var t = arguments.length, n = new Array(t), e = 0; e < t; e++)
      n[e] = arguments[e];
    return zn(d, n);
  };
}
function St(d, t) {
  let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Xi;
  Is && Is(d, null);
  let e = t.length;
  for (; e--; ) {
    let u = t[e];
    if (typeof u == "string") {
      const f = n(u);
      f !== u && (xl(t) || (t[e] = f), u = f);
    }
    d[u] = !0;
  }
  return d;
}
function Nl(d) {
  for (let t = 0; t < d.length; t++)
    ve(d, t) || (d[t] = null);
  return d;
}
function ii(d) {
  const t = Mr(null);
  for (const [n, e] of Fr(d))
    ve(d, n) && (Array.isArray(e) ? t[n] = Nl(e) : e && typeof e == "object" && e.constructor === Object ? t[n] = ii(e) : t[n] = e);
  return t;
}
function Ti(d, t) {
  for (; d !== null; ) {
    const e = Fl(d, t);
    if (e) {
      if (e.get)
        return ie(e.get);
      if (typeof e.value == "function")
        return ie(e.value);
    }
    d = Ll(d);
  }
  function n() {
    return null;
  }
  return n;
}
const Ds = Xt(["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"]), bn = Xt(["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"]), An = Xt(["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"]), Dl = Xt(["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"]), vn = Xt(["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"]), Ol = Xt(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Os = Xt(["#text"]), Hs = Xt(["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"]), yn = Xt(["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", "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"]), zs = Xt(["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"]), Ui = Xt(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Hl = de(/\{\{[\w\W]*|[\w\W]*\}\}/gm), zl = de(/<%[\w\W]*|[\w\W]*%>/gm), Bl = de(/\${[\w\W]*}/gm), Ul = de(/^data-[\-\w.\u00B7-\uFFFF]/), Gl = de(/^aria-[\-\w]+$/), Ir = de(
  /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
  // eslint-disable-line no-useless-escape
), Vl = de(/^(?:\w+script|data):/i), Xl = de(
  /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
  // eslint-disable-line no-control-regex
), Pr = de(/^html$/i), jl = de(/^[a-z][.\w]*(-[.\w]+)+$/i);
var Bs = /* @__PURE__ */ Object.freeze({
  __proto__: null,
  MUSTACHE_EXPR: Hl,
  ERB_EXPR: zl,
  TMPLIT_EXPR: Bl,
  DATA_ATTR: Ul,
  ARIA_ATTR: Gl,
  IS_ALLOWED_URI: Ir,
  IS_SCRIPT_OR_DATA: Vl,
  ATTR_WHITESPACE: Xl,
  DOCTYPE_NAME: Pr,
  CUSTOM_ELEMENT: jl
});
const Ci = {
  element: 1,
  attribute: 2,
  text: 3,
  cdataSection: 4,
  entityReference: 5,
  // Deprecated
  entityNode: 6,
  // Deprecated
  progressingInstruction: 7,
  comment: 8,
  document: 9,
  documentType: 10,
  documentFragment: 11,
  notation: 12
  // Deprecated
}, Wl = function() {
  return typeof window > "u" ? null : window;
}, ql = function(t, n) {
  if (typeof t != "object" || typeof t.createPolicy != "function")
    return null;
  let e = null;
  const u = "data-tt-policy-suffix";
  n && n.hasAttribute(u) && (e = n.getAttribute(u));
  const f = "dompurify" + (e ? "#" + e : "");
  try {
    return t.createPolicy(f, {
      createHTML(k) {
        return k;
      },
      createScriptURL(k) {
        return k;
      }
    });
  } catch {
    return console.warn("TrustedTypes policy " + f + " could not be created."), null;
  }
};
function Nr() {
  let d = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Wl();
  const t = (bt) => Nr(bt);
  if (t.version = "3.1.6", t.removed = [], !d || !d.document || d.document.nodeType !== Ci.document)
    return t.isSupported = !1, t;
  let {
    document: n
  } = d;
  const e = n, u = e.currentScript, {
    DocumentFragment: f,
    HTMLTemplateElement: k,
    Node: m,
    Element: o,
    NodeFilter: l,
    NamedNodeMap: c = d.NamedNodeMap || d.MozNamedAttrMap,
    HTMLFormElement: s,
    DOMParser: p,
    trustedTypes: b
  } = d, S = o.prototype, a = Ti(S, "cloneNode"), E = Ti(S, "remove"), i = Ti(S, "nextSibling"), r = Ti(S, "childNodes"), v = Ti(S, "parentNode");
  if (typeof k == "function") {
    const bt = n.createElement("template");
    bt.content && bt.content.ownerDocument && (n = bt.content.ownerDocument);
  }
  let y, R = "";
  const {
    implementation: F,
    createNodeIterator: I,
    createDocumentFragment: H,
    getElementsByTagName: B
  } = n, {
    importNode: U
  } = e;
  let X = {};
  t.isSupported = typeof Fr == "function" && typeof v == "function" && F && F.createHTMLDocument !== void 0;
  const {
    MUSTACHE_EXPR: Z,
    ERB_EXPR: lt,
    TMPLIT_EXPR: Y,
    DATA_ATTR: V,
    ARIA_ATTR: j,
    IS_SCRIPT_OR_DATA: $,
    ATTR_WHITESPACE: st,
    CUSTOM_ELEMENT: J
  } = Bs;
  let {
    IS_ALLOWED_URI: ht
  } = Bs, rt = null;
  const pt = St({}, [...Ds, ...bn, ...An, ...vn, ...Os]);
  let dt = null;
  const ut = St({}, [...Hs, ...yn, ...zs, ...Ui]);
  let Q = Object.seal(Mr(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
    }
  })), it = null, x = null, C = !0, h = !0, g = !1, w = !0, _ = !1, A = !0, T = !1, L = !1, M = !1, N = !1, D = !1, G = !1, z = !0, O = !1;
  const P = "user-content-";
  let q = !0, et = !1, K = {}, tt = null;
  const ft = St({}, ["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 at = null;
  const nt = St({}, ["audio", "video", "img", "source", "image", "track"]);
  let ct = null;
  const mt = St({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), wt = "http://www.w3.org/1998/Math/MathML", Et = "http://www.w3.org/2000/svg", Tt = "http://www.w3.org/1999/xhtml";
  let _t = Tt, jt = !1, Pt = null;
  const Wt = St({}, [wt, Et, Tt], mn);
  let Rt = null;
  const Ht = ["application/xhtml+xml", "text/html"], ue = "text/html";
  let xt = null, ne = null;
  const hi = n.createElement("form"), xe = function(W) {
    return W instanceof RegExp || W instanceof Function;
  }, Dt = function() {
    let W = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    if (!(ne && ne === W)) {
      if ((!W || typeof W != "object") && (W = {}), W = ii(W), Rt = // eslint-disable-next-line unicorn/prefer-includes
      Ht.indexOf(W.PARSER_MEDIA_TYPE) === -1 ? ue : W.PARSER_MEDIA_TYPE, xt = Rt === "application/xhtml+xml" ? mn : Xi, rt = ve(W, "ALLOWED_TAGS") ? St({}, W.ALLOWED_TAGS, xt) : pt, dt = ve(W, "ALLOWED_ATTR") ? St({}, W.ALLOWED_ATTR, xt) : ut, Pt = ve(W, "ALLOWED_NAMESPACES") ? St({}, W.ALLOWED_NAMESPACES, mn) : Wt, ct = ve(W, "ADD_URI_SAFE_ATTR") ? St(
        ii(mt),
        // eslint-disable-line indent
        W.ADD_URI_SAFE_ATTR,
        // eslint-disable-line indent
        xt
        // eslint-disable-line indent
      ) : mt, at = ve(W, "ADD_DATA_URI_TAGS") ? St(
        ii(nt),
        // eslint-disable-line indent
        W.ADD_DATA_URI_TAGS,
        // eslint-disable-line indent
        xt
        // eslint-disable-line indent
      ) : nt, tt = ve(W, "FORBID_CONTENTS") ? St({}, W.FORBID_CONTENTS, xt) : ft, it = ve(W, "FORBID_TAGS") ? St({}, W.FORBID_TAGS, xt) : {}, x = ve(W, "FORBID_ATTR") ? St({}, W.FORBID_ATTR, xt) : {}, K = ve(W, "USE_PROFILES") ? W.USE_PROFILES : !1, C = W.ALLOW_ARIA_ATTR !== !1, h = W.ALLOW_DATA_ATTR !== !1, g = W.ALLOW_UNKNOWN_PROTOCOLS || !1, w = W.ALLOW_SELF_CLOSE_IN_ATTR !== !1, _ = W.SAFE_FOR_TEMPLATES || !1, A = W.SAFE_FOR_XML !== !1, T = W.WHOLE_DOCUMENT || !1, N = W.RETURN_DOM || !1, D = W.RETURN_DOM_FRAGMENT || !1, G = W.RETURN_TRUSTED_TYPE || !1, M = W.FORCE_BODY || !1, z = W.SANITIZE_DOM !== !1, O = W.SANITIZE_NAMED_PROPS || !1, q = W.KEEP_CONTENT !== !1, et = W.IN_PLACE || !1, ht = W.ALLOWED_URI_REGEXP || Ir, _t = W.NAMESPACE || Tt, Q = W.CUSTOM_ELEMENT_HANDLING || {}, W.CUSTOM_ELEMENT_HANDLING && xe(W.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (Q.tagNameCheck = W.CUSTOM_ELEMENT_HANDLING.tagNameCheck), W.CUSTOM_ELEMENT_HANDLING && xe(W.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (Q.attributeNameCheck = W.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), W.CUSTOM_ELEMENT_HANDLING && typeof W.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (Q.allowCustomizedBuiltInElements = W.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), _ && (h = !1), D && (N = !0), K && (rt = St({}, Os), dt = [], K.html === !0 && (St(rt, Ds), St(dt, Hs)), K.svg === !0 && (St(rt, bn), St(dt, yn), St(dt, Ui)), K.svgFilters === !0 && (St(rt, An), St(dt, yn), St(dt, Ui)), K.mathMl === !0 && (St(rt, vn), St(dt, zs), St(dt, Ui))), W.ADD_TAGS && (rt === pt && (rt = ii(rt)), St(rt, W.ADD_TAGS, xt)), W.ADD_ATTR && (dt === ut && (dt = ii(dt)), St(dt, W.ADD_ATTR, xt)), W.ADD_URI_SAFE_ATTR && St(ct, W.ADD_URI_SAFE_ATTR, xt), W.FORBID_CONTENTS && (tt === ft && (tt = ii(tt)), St(tt, W.FORBID_CONTENTS, xt)), q && (rt["#text"] = !0), T && St(rt, ["html", "head", "body"]), rt.table && (St(rt, ["tbody"]), delete it.tbody), W.TRUSTED_TYPES_POLICY) {
        if (typeof W.TRUSTED_TYPES_POLICY.createHTML != "function")
          throw Ei('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
        if (typeof W.TRUSTED_TYPES_POLICY.createScriptURL != "function")
          throw Ei('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
        y = W.TRUSTED_TYPES_POLICY, R = y.createHTML("");
      } else
        y === void 0 && (y = ql(b, u)), y !== null && typeof R == "string" && (R = y.createHTML(""));
      Xt && Xt(W), ne = W;
    }
  }, It = St({}, ["mi", "mo", "mn", "ms", "mtext"]), Ke = St({}, ["foreignobject", "annotation-xml"]), Je = St({}, ["title", "style", "font", "a", "script"]), Le = St({}, [...bn, ...An, ...Dl]), Mt = St({}, [...vn, ...Ol]), Qe = function(W) {
    let ot = v(W);
    (!ot || !ot.tagName) && (ot = {
      namespaceURI: _t,
      tagName: "template"
    });
    const gt = Xi(W.tagName), kt = Xi(ot.tagName);
    return Pt[W.namespaceURI] ? W.namespaceURI === Et ? ot.namespaceURI === Tt ? gt === "svg" : ot.namespaceURI === wt ? gt === "svg" && (kt === "annotation-xml" || It[kt]) : !!Le[gt] : W.namespaceURI === wt ? ot.namespaceURI === Tt ? gt === "math" : ot.namespaceURI === Et ? gt === "math" && Ke[kt] : !!Mt[gt] : W.namespaceURI === Tt ? ot.namespaceURI === Et && !Ke[kt] || ot.namespaceURI === wt && !It[kt] ? !1 : !Mt[gt] && (Je[gt] || !Le[gt]) : !!(Rt === "application/xhtml+xml" && Pt[W.namespaceURI]) : !1;
  }, se = function(W) {
    _i(t.removed, {
      element: W
    });
    try {
      v(W).removeChild(W);
    } catch {
      E(W);
    }
  }, Oe = function(W, ot) {
    try {
      _i(t.removed, {
        attribute: ot.getAttributeNode(W),
        from: ot
      });
    } catch {
      _i(t.removed, {
        attribute: null,
        from: ot
      });
    }
    if (ot.removeAttribute(W), W === "is" && !dt[W])
      if (N || D)
        try {
          se(ot);
        } catch {
        }
      else
        try {
          ot.setAttribute(W, "");
        } catch {
        }
  }, He = function(W) {
    let ot = null, gt = null;
    if (M)
      W = "<remove></remove>" + W;
    else {
      const Ot = Ns(W, /^[\r\n\t ]+/);
      gt = Ot && Ot[0];
    }
    Rt === "application/xhtml+xml" && _t === Tt && (W = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + W + "</body></html>");
    const kt = y ? y.createHTML(W) : W;
    if (_t === Tt)
      try {
        ot = new p().parseFromString(kt, Rt);
      } catch {
      }
    if (!ot || !ot.documentElement) {
      ot = F.createDocument(_t, "template", null);
      try {
        ot.documentElement.innerHTML = jt ? R : kt;
      } catch {
      }
    }
    const zt = ot.body || ot.documentElement;
    return W && gt && zt.insertBefore(n.createTextNode(gt), zt.childNodes[0] || null), _t === Tt ? B.call(ot, T ? "html" : "body")[0] : T ? ot.documentElement : zt;
  }, di = function(W) {
    return I.call(
      W.ownerDocument || W,
      W,
      // eslint-disable-next-line no-bitwise
      l.SHOW_ELEMENT | l.SHOW_COMMENT | l.SHOW_TEXT | l.SHOW_PROCESSING_INSTRUCTION | l.SHOW_CDATA_SECTION,
      null
    );
  }, fe = function(W) {
    return W instanceof s && (typeof W.nodeName != "string" || typeof W.textContent != "string" || typeof W.removeChild != "function" || !(W.attributes instanceof c) || typeof W.removeAttribute != "function" || typeof W.setAttribute != "function" || typeof W.namespaceURI != "string" || typeof W.insertBefore != "function" || typeof W.hasChildNodes != "function");
  }, rn = function(W) {
    return typeof m == "function" && W instanceof m;
  }, Fe = function(W, ot, gt) {
    X[W] && Bi(X[W], (kt) => {
      kt.call(t, ot, gt, ne);
    });
  }, Kn = function(W) {
    let ot = null;
    if (Fe("beforeSanitizeElements", W, null), fe(W))
      return se(W), !0;
    const gt = xt(W.nodeName);
    if (Fe("uponSanitizeElement", W, {
      tagName: gt,
      allowedTags: rt
    }), W.hasChildNodes() && !rn(W.firstElementChild) && Vt(/<[/\w]/g, W.innerHTML) && Vt(/<[/\w]/g, W.textContent) || W.nodeType === Ci.progressingInstruction || A && W.nodeType === Ci.comment && Vt(/<[/\w]/g, W.data))
      return se(W), !0;
    if (!rt[gt] || it[gt]) {
      if (!it[gt] && Qn(gt) && (Q.tagNameCheck instanceof RegExp && Vt(Q.tagNameCheck, gt) || Q.tagNameCheck instanceof Function && Q.tagNameCheck(gt)))
        return !1;
      if (q && !tt[gt]) {
        const kt = v(W) || W.parentNode, zt = r(W) || W.childNodes;
        if (zt && kt) {
          const Ot = zt.length;
          for (let qt = Ot - 1; qt >= 0; --qt) {
            const Se = a(zt[qt], !0);
            Se.__removalCount = (W.__removalCount || 0) + 1, kt.insertBefore(Se, i(W));
          }
        }
      }
      return se(W), !0;
    }
    return W instanceof o && !Qe(W) || (gt === "noscript" || gt === "noembed" || gt === "noframes") && Vt(/<\/no(script|embed|frames)/i, W.innerHTML) ? (se(W), !0) : (_ && W.nodeType === Ci.text && (ot = W.textContent, Bi([Z, lt, Y], (kt) => {
      ot = Si(ot, kt, " ");
    }), W.textContent !== ot && (_i(t.removed, {
      element: W.cloneNode()
    }), W.textContent = ot)), Fe("afterSanitizeElements", W, null), !1);
  }, Jn = function(W, ot, gt) {
    if (z && (ot === "id" || ot === "name") && (gt in n || gt in hi))
      return !1;
    if (!(h && !x[ot] && Vt(V, ot))) {
      if (!(C && Vt(j, ot))) {
        if (!dt[ot] || x[ot]) {
          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
            !(Qn(W) && (Q.tagNameCheck instanceof RegExp && Vt(Q.tagNameCheck, W) || Q.tagNameCheck instanceof Function && Q.tagNameCheck(W)) && (Q.attributeNameCheck instanceof RegExp && Vt(Q.attributeNameCheck, ot) || Q.attributeNameCheck instanceof Function && Q.attributeNameCheck(ot)) || // Alternative, second condition checks if it's an `is`-attribute, AND
            // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
            ot === "is" && Q.allowCustomizedBuiltInElements && (Q.tagNameCheck instanceof RegExp && Vt(Q.tagNameCheck, gt) || Q.tagNameCheck instanceof Function && Q.tagNameCheck(gt)))
          )
            return !1;
        } else if (!ct[ot]) {
          if (!Vt(ht, Si(gt, st, ""))) {
            if (!((ot === "src" || ot === "xlink:href" || ot === "href") && W !== "script" && Ml(gt, "data:") === 0 && at[W])) {
              if (!(g && !Vt($, Si(gt, st, "")))) {
                if (gt)
                  return !1;
              }
            }
          }
        }
      }
    }
    return !0;
  }, Qn = function(W) {
    return W !== "annotation-xml" && Ns(W, J);
  }, Zn = function(W) {
    Fe("beforeSanitizeAttributes", W, null);
    const {
      attributes: ot
    } = W;
    if (!ot)
      return;
    const gt = {
      attrName: "",
      attrValue: "",
      keepAttr: !0,
      allowedAttributes: dt
    };
    let kt = ot.length;
    for (; kt--; ) {
      const zt = ot[kt], {
        name: Ot,
        namespaceURI: qt,
        value: Se
      } = zt, wi = xt(Ot);
      let Gt = Ot === "value" ? Se : Il(Se);
      if (gt.attrName = wi, gt.attrValue = Gt, gt.keepAttr = !0, gt.forceKeepAttr = void 0, Fe("uponSanitizeAttribute", W, gt), Gt = gt.attrValue, A && Vt(/((--!?|])>)|<\/(style|title)/i, Gt)) {
        Oe(Ot, W);
        continue;
      }
      if (gt.forceKeepAttr || (Oe(Ot, W), !gt.keepAttr))
        continue;
      if (!w && Vt(/\/>/i, Gt)) {
        Oe(Ot, W);
        continue;
      }
      _ && Bi([Z, lt, Y], (ts) => {
        Gt = Si(Gt, ts, " ");
      });
      const $n = xt(W.nodeName);
      if (Jn($n, wi, Gt)) {
        if (O && (wi === "id" || wi === "name") && (Oe(Ot, W), Gt = P + Gt), y && typeof b == "object" && typeof b.getAttributeType == "function" && !qt)
          switch (b.getAttributeType($n, wi)) {
            case "TrustedHTML": {
              Gt = y.createHTML(Gt);
              break;
            }
            case "TrustedScriptURL": {
              Gt = y.createScriptURL(Gt);
              break;
            }
          }
        try {
          qt ? W.setAttributeNS(qt, Ot, Gt) : W.setAttribute(Ot, Gt), fe(W) ? se(W) : Ps(t.removed);
        } catch {
        }
      }
    }
    Fe("afterSanitizeAttributes", W, null);
  }, ia = function bt(W) {
    let ot = null;
    const gt = di(W);
    for (Fe("beforeSanitizeShadowDOM", W, null); ot = gt.nextNode(); )
      Fe("uponSanitizeShadowNode", ot, null), !Kn(ot) && (ot.content instanceof f && bt(ot.content), Zn(ot));
    Fe("afterSanitizeShadowDOM", W, null);
  };
  return t.sanitize = function(bt) {
    let W = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, ot = null, gt = null, kt = null, zt = null;
    if (jt = !bt, jt && (bt = "<!-->"), typeof bt != "string" && !rn(bt))
      if (typeof bt.toString == "function") {
        if (bt = bt.toString(), typeof bt != "string")
          throw Ei("dirty is not a string, aborting");
      } else
        throw Ei("toString is not a function");
    if (!t.isSupported)
      return bt;
    if (L || Dt(W), t.removed = [], typeof bt == "string" && (et = !1), et) {
      if (bt.nodeName) {
        const Se = xt(bt.nodeName);
        if (!rt[Se] || it[Se])
          throw Ei("root node is forbidden and cannot be sanitized in-place");
      }
    } else if (bt instanceof m)
      ot = He("<!---->"), gt = ot.ownerDocument.importNode(bt, !0), gt.nodeType === Ci.element && gt.nodeName === "BODY" || gt.nodeName === "HTML" ? ot = gt : ot.appendChild(gt);
    else {
      if (!N && !_ && !T && // eslint-disable-next-line unicorn/prefer-includes
      bt.indexOf("<") === -1)
        return y && G ? y.createHTML(bt) : bt;
      if (ot = He(bt), !ot)
        return N ? null : G ? R : "";
    }
    ot && M && se(ot.firstChild);
    const Ot = di(et ? bt : ot);
    for (; kt = Ot.nextNode(); )
      Kn(kt) || (kt.content instanceof f && ia(kt.content), Zn(kt));
    if (et)
      return bt;
    if (N) {
      if (D)
        for (zt = H.call(ot.ownerDocument); ot.firstChild; )
          zt.appendChild(ot.firstChild);
      else
        zt = ot;
      return (dt.shadowroot || dt.shadowrootmode) && (zt = U.call(e, zt, !0)), zt;
    }
    let qt = T ? ot.outerHTML : ot.innerHTML;
    return T && rt["!doctype"] && ot.ownerDocument && ot.ownerDocument.doctype && ot.ownerDocument.doctype.name && Vt(Pr, ot.ownerDocument.doctype.name) && (qt = "<!DOCTYPE " + ot.ownerDocument.doctype.name + `>
` + qt), _ && Bi([Z, lt, Y], (Se) => {
      qt = Si(qt, Se, " ");
    }), y && G ? y.createHTML(qt) : qt;
  }, t.setConfig = function() {
    let bt = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    Dt(bt), L = !0;
  }, t.clearConfig = function() {
    ne = null, L = !1;
  }, t.isValidAttribute = function(bt, W, ot) {
    ne || Dt({});
    const gt = xt(bt), kt = xt(W);
    return Jn(gt, kt, ot);
  }, t.addHook = function(bt, W) {
    typeof W == "function" && (X[bt] = X[bt] || [], _i(X[bt], W));
  }, t.removeHook = function(bt) {
    if (X[bt])
      return Ps(X[bt]);
  }, t.removeHooks = function(bt) {
    X[bt] && (X[bt] = []);
  }, t.removeAllHooks = function() {
    X = {};
  }, t;
}
Nr();
var Yl = Object.defineProperty, Kl = (d, t, n) => t in d ? Yl(d, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : d[t] = n, Me = (d, t, n) => (Kl(d, typeof t != "symbol" ? t + "" : t, n), n), Dr = (d, t, n) => {
  if (!t.has(d))
    throw TypeError("Cannot " + n);
}, ki = (d, t, n) => (Dr(d, t, "read from private field"), n ? n.call(d) : t.get(d)), Jl = (d, t, n) => {
  if (t.has(d))
    throw TypeError("Cannot add the same private member more than once");
  t instanceof WeakSet ? t.add(d) : t.set(d, n);
}, Ql = (d, t, n, e) => (Dr(d, t, "write to private field"), t.set(d, n), n), Ge;
new Intl.Collator(0, { numeric: 1 }).compare;
async function Zl(d, t) {
  return d.map(
    (n) => new $l({
      path: n.name,
      orig_name: n.name,
      blob: n,
      size: n.size,
      mime_type: n.type,
      is_stream: t
    })
  );
}
class $l {
  constructor({
    path: t,
    url: n,
    orig_name: e,
    size: u,
    blob: f,
    is_stream: k,
    mime_type: m,
    alt_text: o
  }) {
    Me(this, "path"), Me(this, "url"), Me(this, "orig_name"), Me(this, "size"), Me(this, "blob"), Me(this, "is_stream"), Me(this, "mime_type"), Me(this, "alt_text"), Me(this, "meta", { _type: "gradio.FileData" }), this.path = t, this.url = n, this.orig_name = e, this.size = u, this.blob = n ? void 0 : f, this.is_stream = k, this.mime_type = m, this.alt_text = o;
  }
}
typeof process < "u" && process.versions && process.versions.node;
class Sd extends TransformStream {
  /** Constructs a new instance. */
  constructor(t = { allowCR: !1 }) {
    super({
      transform: (n, e) => {
        for (n = ki(this, Ge) + n; ; ) {
          const u = n.indexOf(`
`), f = t.allowCR ? n.indexOf("\r") : -1;
          if (f !== -1 && f !== n.length - 1 && (u === -1 || u - 1 > f)) {
            e.enqueue(n.slice(0, f)), n = n.slice(f + 1);
            continue;
          }
          if (u === -1)
            break;
          const k = n[u - 1] === "\r" ? u - 1 : u;
          e.enqueue(n.slice(0, k)), n = n.slice(u + 1);
        }
        Ql(this, Ge, n);
      },
      flush: (n) => {
        if (ki(this, Ge) === "")
          return;
        const e = t.allowCR && ki(this, Ge).endsWith("\r") ? ki(this, Ge).slice(0, -1) : ki(this, Ge);
        n.enqueue(e);
      }
    }), Jl(this, Ge, "");
  }
}
Ge = /* @__PURE__ */ new WeakMap();
const {
  SvelteComponent: tc,
  append: Zt,
  attr: ni,
  detach: Or,
  element: si,
  init: ec,
  insert: Hr,
  noop: Us,
  safe_not_equal: ic,
  set_data: Ki,
  set_style: wn,
  space: Bn,
  text: Ai,
  toggle_class: Gs
} = window.__gradio__svelte__internal, { onMount: nc, createEventDispatcher: sc, onDestroy: rc } = window.__gradio__svelte__internal;
function Vs(d) {
  let t, n, e, u, f = Ri(
    /*file_to_display*/
    d[2]
  ) + "", k, m, o, l, c = (
    /*file_to_display*/
    d[2].orig_name + ""
  ), s;
  return {
    c() {
      t = si("div"), n = si("span"), e = si("div"), u = si("progress"), k = Ai(f), o = Bn(), l = si("span"), s = Ai(c), wn(u, "visibility", "hidden"), wn(u, "height", "0"), wn(u, "width", "0"), u.value = m = Ri(
        /*file_to_display*/
        d[2]
      ), ni(u, "max", "100"), ni(u, "class", "svelte-cr2edf"), ni(e, "class", "progress-bar svelte-cr2edf"), ni(l, "class", "file-name svelte-cr2edf"), ni(t, "class", "file svelte-cr2edf");
    },
    m(p, b) {
      Hr(p, t, b), Zt(t, n), Zt(n, e), Zt(e, u), Zt(u, k), Zt(t, o), Zt(t, l), Zt(l, s);
    },
    p(p, b) {
      b & /*file_to_display*/
      4 && f !== (f = Ri(
        /*file_to_display*/
        p[2]
      ) + "") && Ki(k, f), b & /*file_to_display*/
      4 && m !== (m = Ri(
        /*file_to_display*/
        p[2]
      )) && (u.value = m), b & /*file_to_display*/
      4 && c !== (c = /*file_to_display*/
      p[2].orig_name + "") && Ki(s, c);
    },
    d(p) {
      p && Or(t);
    }
  };
}
function ac(d) {
  let t, n, e, u = (
    /*files_with_progress*/
    d[0].length + ""
  ), f, k, m = (
    /*files_with_progress*/
    d[0].length > 1 ? "files" : "file"
  ), o, l, c, s = (
    /*file_to_display*/
    d[2] && Vs(d)
  );
  return {
    c() {
      t = si("div"), n = si("span"), e = Ai("Uploading "), f = Ai(u), k = Bn(), o = Ai(m), l = Ai("..."), c = Bn(), s && s.c(), ni(n, "class", "uploading svelte-cr2edf"), ni(t, "class", "wrap svelte-cr2edf"), Gs(
        t,
        "progress",
        /*progress*/
        d[1]
      );
    },
    m(p, b) {
      Hr(p, t, b), Zt(t, n), Zt(n, e), Zt(n, f), Zt(n, k), Zt(n, o), Zt(n, l), Zt(t, c), s && s.m(t, null);
    },
    p(p, [b]) {
      b & /*files_with_progress*/
      1 && u !== (u = /*files_with_progress*/
      p[0].length + "") && Ki(f, u), b & /*files_with_progress*/
      1 && m !== (m = /*files_with_progress*/
      p[0].length > 1 ? "files" : "file") && Ki(o, m), /*file_to_display*/
      p[2] ? s ? s.p(p, b) : (s = Vs(p), s.c(), s.m(t, null)) : s && (s.d(1), s = null), b & /*progress*/
      2 && Gs(
        t,
        "progress",
        /*progress*/
        p[1]
      );
    },
    i: Us,
    o: Us,
    d(p) {
      p && Or(t), s && s.d();
    }
  };
}
function Ri(d) {
  return d.progress * 100 / (d.size || 0) || 0;
}
function oc(d) {
  let t = 0;
  return d.forEach((n) => {
    t += Ri(n);
  }), document.documentElement.style.setProperty("--upload-progress-width", (t / d.length).toFixed(2) + "%"), t / d.length;
}
function lc(d, t, n) {
  var e = this && this.__awaiter || function(a, E, i, r) {
    function v(y) {
      return y instanceof i ? y : new i(function(R) {
        R(y);
      });
    }
    return new (i || (i = Promise))(function(y, R) {
      function F(B) {
        try {
          H(r.next(B));
        } catch (U) {
          R(U);
        }
      }
      function I(B) {
        try {
          H(r.throw(B));
        } catch (U) {
          R(U);
        }
      }
      function H(B) {
        B.done ? y(B.value) : v(B.value).then(F, I);
      }
      H((r = r.apply(a, E || [])).next());
    });
  };
  let { upload_id: u } = t, { root: f } = t, { files: k } = t, { stream_handler: m } = t, o, l = !1, c, s, p = k.map((a) => Object.assign(Object.assign({}, a), { progress: 0 }));
  const b = sc();
  function S(a, E) {
    n(0, p = p.map((i) => (i.orig_name === a && (i.progress += E), i)));
  }
  return nc(() => e(void 0, void 0, void 0, function* () {
    if (o = yield m(new URL(`${f}/upload_progress?upload_id=${u}`)), o == null)
      throw new Error("Event source is not defined");
    o.onmessage = function(a) {
      return e(this, void 0, void 0, function* () {
        const E = JSON.parse(a.data);
        l || n(1, l = !0), E.msg === "done" ? (o?.close(), b("done")) : (n(7, c = E), S(E.orig_name, E.chunk_size));
      });
    };
  })), rc(() => {
    (o != null || o != null) && o.close();
  }), d.$$set = (a) => {
    "upload_id" in a && n(3, u = a.upload_id), "root" in a && n(4, f = a.root), "files" in a && n(5, k = a.files), "stream_handler" in a && n(6, m = a.stream_handler);
  }, d.$$.update = () => {
    d.$$.dirty & /*files_with_progress*/
    1 && oc(p), d.$$.dirty & /*current_file_upload, files_with_progress*/
    129 && n(2, s = c || p[0]);
  }, [
    p,
    l,
    s,
    u,
    f,
    k,
    m,
    c
  ];
}
class cc extends tc {
  constructor(t) {
    super(), ec(this, t, lc, ac, ic, {
      upload_id: 3,
      root: 4,
      files: 5,
      stream_handler: 6
    });
  }
}
const {
  SvelteComponent: hc,
  append: Xs,
  attr: Ut,
  binding_callbacks: dc,
  bubble: Ze,
  check_outros: zr,
  create_component: uc,
  create_slot: Br,
  destroy_component: fc,
  detach: $i,
  element: Un,
  empty: Ur,
  get_all_dirty_from_scope: Gr,
  get_slot_changes: Vr,
  group_outros: Xr,
  init: pc,
  insert: tn,
  listen: te,
  mount_component: gc,
  prevent_default: $e,
  run_all: mc,
  safe_not_equal: bc,
  set_style: jr,
  space: Ac,
  stop_propagation: ti,
  toggle_class: Nt,
  transition_in: je,
  transition_out: oi,
  update_slot_base: Wr
} = window.__gradio__svelte__internal, { createEventDispatcher: vc, tick: yc } = window.__gradio__svelte__internal;
function wc(d) {
  let t, n, e, u, f, k, m, o, l, c, s;
  const p = (
    /*#slots*/
    d[27].default
  ), b = Br(
    p,
    d,
    /*$$scope*/
    d[26],
    null
  );
  return {
    c() {
      t = Un("button"), b && b.c(), n = Ac(), e = Un("input"), Ut(e, "aria-label", "file upload"), Ut(e, "data-testid", "file-upload"), Ut(e, "type", "file"), Ut(e, "accept", u = /*accept_file_types*/
      d[16] || void 0), e.multiple = f = /*file_count*/
      d[6] === "multiple" || void 0, Ut(e, "webkitdirectory", k = /*file_count*/
      d[6] === "directory" || void 0), Ut(e, "mozdirectory", m = /*file_count*/
      d[6] === "directory" || void 0), Ut(e, "class", "svelte-1mceliw"), Ut(t, "tabindex", o = /*hidden*/
      d[9] ? -1 : 0), Ut(t, "class", "svelte-1mceliw"), Nt(
        t,
        "hidden",
        /*hidden*/
        d[9]
      ), Nt(
        t,
        "center",
        /*center*/
        d[4]
      ), Nt(
        t,
        "boundedheight",
        /*boundedheight*/
        d[3]
      ), Nt(
        t,
        "flex",
        /*flex*/
        d[5]
      ), Nt(
        t,
        "disable_click",
        /*disable_click*/
        d[7]
      ), jr(t, "height", "100%");
    },
    m(S, a) {
      tn(S, t, a), b && b.m(t, null), Xs(t, n), Xs(t, e), d[35](e), l = !0, c || (s = [
        te(
          e,
          "change",
          /*load_files_from_upload*/
          d[18]
        ),
        te(t, "drag", ti($e(
          /*drag_handler*/
          d[28]
        ))),
        te(t, "dragstart", ti($e(
          /*dragstart_handler*/
          d[29]
        ))),
        te(t, "dragend", ti($e(
          /*dragend_handler*/
          d[30]
        ))),
        te(t, "dragover", ti($e(
          /*dragover_handler*/
          d[31]
        ))),
        te(t, "dragenter", ti($e(
          /*dragenter_handler*/
          d[32]
        ))),
        te(t, "dragleave", ti($e(
          /*dragleave_handler*/
          d[33]
        ))),
        te(t, "drop", ti($e(
          /*drop_handler*/
          d[34]
        ))),
        te(
          t,
          "click",
          /*open_file_upload*/
          d[13]
        ),
        te(
          t,
          "drop",
          /*loadFilesFromDrop*/
          d[19]
        ),
        te(
          t,
          "dragenter",
          /*updateDragging*/
          d[17]
        ),
        te(
          t,
          "dragleave",
          /*updateDragging*/
          d[17]
        )
      ], c = !0);
    },
    p(S, a) {
      b && b.p && (!l || a[0] & /*$$scope*/
      67108864) && Wr(
        b,
        p,
        S,
        /*$$scope*/
        S[26],
        l ? Vr(
          p,
          /*$$scope*/
          S[26],
          a,
          null
        ) : Gr(
          /*$$scope*/
          S[26]
        ),
        null
      ), (!l || a[0] & /*accept_file_types*/
      65536 && u !== (u = /*accept_file_types*/
      S[16] || void 0)) && Ut(e, "accept", u), (!l || a[0] & /*file_count*/
      64 && f !== (f = /*file_count*/
      S[6] === "multiple" || void 0)) && (e.multiple = f), (!l || a[0] & /*file_count*/
      64 && k !== (k = /*file_count*/
      S[6] === "directory" || void 0)) && Ut(e, "webkitdirectory", k), (!l || a[0] & /*file_count*/
      64 && m !== (m = /*file_count*/
      S[6] === "directory" || void 0)) && Ut(e, "mozdirectory", m), (!l || a[0] & /*hidden*/
      512 && o !== (o = /*hidden*/
      S[9] ? -1 : 0)) && Ut(t, "tabindex", o), (!l || a[0] & /*hidden*/
      512) && Nt(
        t,
        "hidden",
        /*hidden*/
        S[9]
      ), (!l || a[0] & /*center*/
      16) && Nt(
        t,
        "center",
        /*center*/
        S[4]
      ), (!l || a[0] & /*boundedheight*/
      8) && Nt(
        t,
        "boundedheight",
        /*boundedheight*/
        S[3]
      ), (!l || a[0] & /*flex*/
      32) && Nt(
        t,
        "flex",
        /*flex*/
        S[5]
      ), (!l || a[0] & /*disable_click*/
      128) && Nt(
        t,
        "disable_click",
        /*disable_click*/
        S[7]
      );
    },
    i(S) {
      l || (je(b, S), l = !0);
    },
    o(S) {
      oi(b, S), l = !1;
    },
    d(S) {
      S && $i(t), b && b.d(S), d[35](null), c = !1, mc(s);
    }
  };
}
function _c(d) {
  let t, n, e = !/*hidden*/
  d[9] && js(d);
  return {
    c() {
      e && e.c(), t = Ur();
    },
    m(u, f) {
      e && e.m(u, f), tn(u, t, f), n = !0;
    },
    p(u, f) {
      /*hidden*/
      u[9] ? e && (Xr(), oi(e, 1, 1, () => {
        e = null;
      }), zr()) : e ? (e.p(u, f), f[0] & /*hidden*/
      512 && je(e, 1)) : (e = js(u), e.c(), je(e, 1), e.m(t.parentNode, t));
    },
    i(u) {
      n || (je(e), n = !0);
    },
    o(u) {
      oi(e), n = !1;
    },
    d(u) {
      u && $i(t), e && e.d(u);
    }
  };
}
function Sc(d) {
  let t, n, e, u, f;
  const k = (
    /*#slots*/
    d[27].default
  ), m = Br(
    k,
    d,
    /*$$scope*/
    d[26],
    null
  );
  return {
    c() {
      t = Un("button"), m && m.c(), Ut(t, "tabindex", n = /*hidden*/
      d[9] ? -1 : 0), Ut(t, "class", "svelte-1mceliw"), Nt(
        t,
        "hidden",
        /*hidden*/
        d[9]
      ), Nt(
        t,
        "center",
        /*center*/
        d[4]
      ), Nt(
        t,
        "boundedheight",
        /*boundedheight*/
        d[3]
      ), Nt(
        t,
        "flex",
        /*flex*/
        d[5]
      ), jr(t, "height", "100%");
    },
    m(o, l) {
      tn(o, t, l), m && m.m(t, null), e = !0, u || (f = te(
        t,
        "click",
        /*paste_clipboard*/
        d[12]
      ), u = !0);
    },
    p(o, l) {
      m && m.p && (!e || l[0] & /*$$scope*/
      67108864) && Wr(
        m,
        k,
        o,
        /*$$scope*/
        o[26],
        e ? Vr(
          k,
          /*$$scope*/
          o[26],
          l,
          null
        ) : Gr(
          /*$$scope*/
          o[26]
        ),
        null
      ), (!e || l[0] & /*hidden*/
      512 && n !== (n = /*hidden*/
      o[9] ? -1 : 0)) && Ut(t, "tabindex", n), (!e || l[0] & /*hidden*/
      512) && Nt(
        t,
        "hidden",
        /*hidden*/
        o[9]
      ), (!e || l[0] & /*center*/
      16) && Nt(
        t,
        "center",
        /*center*/
        o[4]
      ), (!e || l[0] & /*boundedheight*/
      8) && Nt(
        t,
        "boundedheight",
        /*boundedheight*/
        o[3]
      ), (!e || l[0] & /*flex*/
      32) && Nt(
        t,
        "flex",
        /*flex*/
        o[5]
      );
    },
    i(o) {
      e || (je(m, o), e = !0);
    },
    o(o) {
      oi(m, o), e = !1;
    },
    d(o) {
      o && $i(t), m && m.d(o), u = !1, f();
    }
  };
}
function js(d) {
  let t, n;
  return t = new cc({
    props: {
      root: (
        /*root*/
        d[8]
      ),
      upload_id: (
        /*upload_id*/
        d[14]
      ),
      files: (
        /*file_data*/
        d[15]
      ),
      stream_handler: (
        /*stream_handler*/
        d[11]
      )
    }
  }), {
    c() {
      uc(t.$$.fragment);
    },
    m(e, u) {
      gc(t, e, u), n = !0;
    },
    p(e, u) {
      const f = {};
      u[0] & /*root*/
      256 && (f.root = /*root*/
      e[8]), u[0] & /*upload_id*/
      16384 && (f.upload_id = /*upload_id*/
      e[14]), u[0] & /*file_data*/
      32768 && (f.files = /*file_data*/
      e[15]), u[0] & /*stream_handler*/
      2048 && (f.stream_handler = /*stream_handler*/
      e[11]), t.$set(f);
    },
    i(e) {
      n || (je(t.$$.fragment, e), n = !0);
    },
    o(e) {
      oi(t.$$.fragment, e), n = !1;
    },
    d(e) {
      fc(t, e);
    }
  };
}
function Ec(d) {
  let t, n, e, u;
  const f = [Sc, _c, wc], k = [];
  function m(o, l) {
    return (
      /*filetype*/
      o[0] === "clipboard" ? 0 : (
        /*uploading*/
        o[1] && /*show_progress*/
        o[10] ? 1 : 2
      )
    );
  }
  return t = m(d), n = k[t] = f[t](d), {
    c() {
      n.c(), e = Ur();
    },
    m(o, l) {
      k[t].m(o, l), tn(o, e, l), u = !0;
    },
    p(o, l) {
      let c = t;
      t = m(o), t === c ? k[t].p(o, l) : (Xr(), oi(k[c], 1, 1, () => {
        k[c] = null;
      }), zr(), n = k[t], n ? n.p(o, l) : (n = k[t] = f[t](o), n.c()), je(n, 1), n.m(e.parentNode, e));
    },
    i(o) {
      u || (je(n), u = !0);
    },
    o(o) {
      oi(n), u = !1;
    },
    d(o) {
      o && $i(e), k[t].d(o);
    }
  };
}
function Tc(d, t, n) {
  if (!d || d === "*" || d === "file/*" || Array.isArray(d) && d.some((u) => u === "*" || u === "file/*"))
    return !0;
  let e;
  if (typeof d == "string")
    e = d.split(",").map((u) => u.trim());
  else if (Array.isArray(d))
    e = d;
  else
    return !1;
  return e.includes(t) || e.some((u) => {
    const [f] = u.split("/").map((k) => k.trim());
    return u.endsWith("/*") && n.startsWith(f + "/");
  });
}
function Cc(d, t, n) {
  let e, { $$slots: u = {}, $$scope: f } = t;
  var k = this && this.__awaiter || function(w, _, A, T) {
    function L(M) {
      return M instanceof A ? M : new A(function(N) {
        N(M);
      });
    }
    return new (A || (A = Promise))(function(M, N) {
      function D(O) {
        try {
          z(T.next(O));
        } catch (P) {
          N(P);
        }
      }
      function G(O) {
        try {
          z(T.throw(O));
        } catch (P) {
          N(P);
        }
      }
      function z(O) {
        O.done ? M(O.value) : L(O.value).then(D, G);
      }
      z((T = T.apply(w, _ || [])).next());
    });
  };
  let { filetype: m = null } = t, { dragging: o = !1 } = t, { boundedheight: l = !0 } = t, { center: c = !0 } = t, { flex: s = !0 } = t, { file_count: p = "single" } = t, { disable_click: b = !1 } = t, { root: S } = t, { hidden: a = !1 } = t, { format: E = "file" } = t, { uploading: i = !1 } = t, { hidden_upload: r = null } = t, { show_progress: v = !0 } = t, { max_file_size: y = null } = t, { upload: R } = t, { stream_handler: F } = t, I, H, B, U = null;
  const X = () => {
    if (typeof navigator < "u") {
      const w = navigator.userAgent.toLowerCase();
      return w.indexOf("iphone") > -1 || w.indexOf("ipad") > -1;
    }
    return !1;
  }, Z = vc(), lt = ["image", "video", "audio", "text", "file"], Y = (w) => e && w.startsWith(".") ? (U = !0, w) : e && w.includes("file/*") ? "*" : w.startsWith(".") || w.endsWith("/*") ? w : lt.includes(w) ? w + "/*" : "." + w;
  function V() {
    n(20, o = !o);
  }
  function j() {
    navigator.clipboard.read().then((w) => k(this, void 0, void 0, function* () {
      for (let _ = 0; _ < w.length; _++) {
        const A = w[_].types.find((T) => T.startsWith("image/"));
        if (A) {
          w[_].getType(A).then((T) => k(this, void 0, void 0, function* () {
            const L = new File([T], `clipboard.${A.replace("image/", "")}`);
            yield J([L]);
          }));
          break;
        }
      }
    }));
  }
  function $() {
    b || r && (n(2, r.value = "", r), r.click());
  }
  function st(w) {
    return k(this, void 0, void 0, function* () {
      yield yc(), n(14, I = Math.random().toString(36).substring(2, 15)), n(1, i = !0);
      try {
        const _ = yield R(w, S, I, y ?? 1 / 0);
        return Z("load", p === "single" ? _?.[0] : _), n(1, i = !1), _ || [];
      } catch (_) {
        return Z("error", _.message), n(1, i = !1), [];
      }
    });
  }
  function J(w) {
    return k(this, void 0, void 0, function* () {
      if (!w.length)
        return;
      let _ = w.map((A) => new File([A], A instanceof File ? A.name : "file", { type: A.type }));
      return e && U && (_ = _.filter((A) => ht(A) ? !0 : (Z("error", `Invalid file type: ${A.name}. Only ${m} allowed.`), !1)), _.length === 0) ? [] : (n(15, H = yield Zl(_)), yield st(H));
    });
  }
  function ht(w) {
    return m ? (Array.isArray(m) ? m : [m]).some((A) => {
      const T = Y(A);
      if (T.startsWith("."))
        return w.name.toLowerCase().endsWith(T.toLowerCase());
      if (T === "*")
        return !0;
      if (T.endsWith("/*")) {
        const [L] = T.split("/");
        return w.type.startsWith(L + "/");
      }
      return w.type === T;
    }) : !0;
  }
  function rt(w) {
    return k(this, void 0, void 0, function* () {
      const _ = w.target;
      if (_.files)
        if (E != "blob")
          yield J(Array.from(_.files));
        else {
          if (p === "single") {
            Z("load", _.files[0]);
            return;
          }
          Z("load", _.files);
        }
    });
  }
  function pt(w) {
    return k(this, void 0, void 0, function* () {
      var _;
      if (n(20, o = !1), !(!((_ = w.dataTransfer) === null || _ === void 0) && _.files))
        return;
      const A = Array.from(w.dataTransfer.files).filter((T) => {
        const L = "." + T.name.split(".").pop();
        return L && Tc(B, L, T.type) || (L && Array.isArray(m) ? m.includes(L) : L === m) ? !0 : (Z("error", `Invalid file type only ${m} allowed.`), !1);
      });
      if (E != "blob")
        yield J(A);
      else {
        if (p === "single") {
          Z("load", A[0]);
          return;
        }
        Z("load", A);
      }
    });
  }
  function dt(w) {
    Ze.call(this, d, w);
  }
  function ut(w) {
    Ze.call(this, d, w);
  }
  function Q(w) {
    Ze.call(this, d, w);
  }
  function it(w) {
    Ze.call(this, d, w);
  }
  function x(w) {
    Ze.call(this, d, w);
  }
  function C(w) {
    Ze.call(this, d, w);
  }
  function h(w) {
    Ze.call(this, d, w);
  }
  function g(w) {
    dc[w ? "unshift" : "push"](() => {
      r = w, n(2, r);
    });
  }
  return d.$$set = (w) => {
    "filetype" in w && n(0, m = w.filetype), "dragging" in w && n(20, o = w.dragging), "boundedheight" in w && n(3, l = w.boundedheight), "center" in w && n(4, c = w.center), "flex" in w && n(5, s = w.flex), "file_count" in w && n(6, p = w.file_count), "disable_click" in w && n(7, b = w.disable_click), "root" in w && n(8, S = w.root), "hidden" in w && n(9, a = w.hidden), "format" in w && n(21, E = w.format), "uploading" in w && n(1, i = w.uploading), "hidden_upload" in w && n(2, r = w.hidden_upload), "show_progress" in w && n(10, v = w.show_progress), "max_file_size" in w && n(22, y = w.max_file_size), "upload" in w && n(23, R = w.upload), "stream_handler" in w && n(11, F = w.stream_handler), "$$scope" in w && n(26, f = w.$$scope);
  }, d.$$.update = () => {
    d.$$.dirty[0] & /*filetype, ios*/
    33554433 && (m == null ? n(16, B = null) : typeof m == "string" ? n(16, B = Y(m)) : e && m.includes("file/*") ? n(16, B = "*") : (n(0, m = m.map(Y)), n(16, B = m.join(", "))));
  }, n(25, e = X()), [
    m,
    i,
    r,
    l,
    c,
    s,
    p,
    b,
    S,
    a,
    v,
    F,
    j,
    $,
    I,
    H,
    B,
    V,
    rt,
    pt,
    o,
    E,
    y,
    R,
    J,
    e,
    f,
    u,
    dt,
    ut,
    Q,
    it,
    x,
    C,
    h,
    g
  ];
}
class kc extends hc {
  constructor(t) {
    super(), pc(
      this,
      t,
      Cc,
      Ec,
      bc,
      {
        filetype: 0,
        dragging: 20,
        boundedheight: 3,
        center: 4,
        flex: 5,
        file_count: 6,
        disable_click: 7,
        root: 8,
        hidden: 9,
        format: 21,
        uploading: 1,
        hidden_upload: 2,
        show_progress: 10,
        max_file_size: 22,
        upload: 23,
        stream_handler: 11,
        paste_clipboard: 12,
        open_file_upload: 13,
        load_files: 24
      },
      null,
      [-1, -1]
    );
  }
  get paste_clipboard() {
    return this.$$.ctx[12];
  }
  get open_file_upload() {
    return this.$$.ctx[13];
  }
  get load_files() {
    return this.$$.ctx[24];
  }
}
const {
  SvelteComponent: Rc,
  append: Gn,
  attr: Pe,
  bubble: xc,
  create_component: Lc,
  destroy_component: Fc,
  detach: qr,
  element: Vn,
  init: Mc,
  insert: Yr,
  listen: Ic,
  mount_component: Pc,
  safe_not_equal: Nc,
  set_data: Dc,
  set_style: pi,
  space: Oc,
  text: Hc,
  toggle_class: Kt,
  transition_in: zc,
  transition_out: Bc
} = window.__gradio__svelte__internal;
function Ws(d) {
  let t, n;
  return {
    c() {
      t = Vn("span"), n = Hc(
        /*label*/
        d[1]
      ), Pe(t, "class", "svelte-1lrphxw");
    },
    m(e, u) {
      Yr(e, t, u), Gn(t, n);
    },
    p(e, u) {
      u & /*label*/
      2 && Dc(
        n,
        /*label*/
        e[1]
      );
    },
    d(e) {
      e && qr(t);
    }
  };
}
function Uc(d) {
  let t, n, e, u, f, k, m, o = (
    /*show_label*/
    d[2] && Ws(d)
  );
  return u = new /*Icon*/
  d[0]({}), {
    c() {
      t = Vn("button"), o && o.c(), n = Oc(), e = Vn("div"), Lc(u.$$.fragment), Pe(e, "class", "svelte-1lrphxw"), Kt(
        e,
        "small",
        /*size*/
        d[4] === "small"
      ), Kt(
        e,
        "large",
        /*size*/
        d[4] === "large"
      ), Kt(
        e,
        "medium",
        /*size*/
        d[4] === "medium"
      ), t.disabled = /*disabled*/
      d[7], Pe(
        t,
        "aria-label",
        /*label*/
        d[1]
      ), Pe(
        t,
        "aria-haspopup",
        /*hasPopup*/
        d[8]
      ), Pe(
        t,
        "title",
        /*label*/
        d[1]
      ), Pe(t, "class", "svelte-1lrphxw"), Kt(
        t,
        "pending",
        /*pending*/
        d[3]
      ), Kt(
        t,
        "padded",
        /*padded*/
        d[5]
      ), Kt(
        t,
        "highlight",
        /*highlight*/
        d[6]
      ), Kt(
        t,
        "transparent",
        /*transparent*/
        d[9]
      ), pi(t, "color", !/*disabled*/
      d[7] && /*_color*/
      d[12] ? (
        /*_color*/
        d[12]
      ) : "var(--block-label-text-color)"), pi(t, "--bg-color", /*disabled*/
      d[7] ? "auto" : (
        /*background*/
        d[10]
      )), pi(
        t,
        "margin-left",
        /*offset*/
        d[11] + "px"
      );
    },
    m(l, c) {
      Yr(l, t, c), o && o.m(t, null), Gn(t, n), Gn(t, e), Pc(u, e, null), f = !0, k || (m = Ic(
        t,
        "click",
        /*click_handler*/
        d[14]
      ), k = !0);
    },
    p(l, [c]) {
      /*show_label*/
      l[2] ? o ? o.p(l, c) : (o = Ws(l), o.c(), o.m(t, n)) : o && (o.d(1), o = null), (!f || c & /*size*/
      16) && Kt(
        e,
        "small",
        /*size*/
        l[4] === "small"
      ), (!f || c & /*size*/
      16) && Kt(
        e,
        "large",
        /*size*/
        l[4] === "large"
      ), (!f || c & /*size*/
      16) && Kt(
        e,
        "medium",
        /*size*/
        l[4] === "medium"
      ), (!f || c & /*disabled*/
      128) && (t.disabled = /*disabled*/
      l[7]), (!f || c & /*label*/
      2) && Pe(
        t,
        "aria-label",
        /*label*/
        l[1]
      ), (!f || c & /*hasPopup*/
      256) && Pe(
        t,
        "aria-haspopup",
        /*hasPopup*/
        l[8]
      ), (!f || c & /*label*/
      2) && Pe(
        t,
        "title",
        /*label*/
        l[1]
      ), (!f || c & /*pending*/
      8) && Kt(
        t,
        "pending",
        /*pending*/
        l[3]
      ), (!f || c & /*padded*/
      32) && Kt(
        t,
        "padded",
        /*padded*/
        l[5]
      ), (!f || c & /*highlight*/
      64) && Kt(
        t,
        "highlight",
        /*highlight*/
        l[6]
      ), (!f || c & /*transparent*/
      512) && Kt(
        t,
        "transparent",
        /*transparent*/
        l[9]
      ), c & /*disabled, _color*/
      4224 && pi(t, "color", !/*disabled*/
      l[7] && /*_color*/
      l[12] ? (
        /*_color*/
        l[12]
      ) : "var(--block-label-text-color)"), c & /*disabled, background*/
      1152 && pi(t, "--bg-color", /*disabled*/
      l[7] ? "auto" : (
        /*background*/
        l[10]
      )), c & /*offset*/
      2048 && pi(
        t,
        "margin-left",
        /*offset*/
        l[11] + "px"
      );
    },
    i(l) {
      f || (zc(u.$$.fragment, l), f = !0);
    },
    o(l) {
      Bc(u.$$.fragment, l), f = !1;
    },
    d(l) {
      l && qr(t), o && o.d(), Fc(u), k = !1, m();
    }
  };
}
function Gc(d, t, n) {
  let e, { Icon: u } = t, { label: f = "" } = t, { show_label: k = !1 } = t, { pending: m = !1 } = t, { size: o = "small" } = t, { padded: l = !0 } = t, { highlight: c = !1 } = t, { disabled: s = !1 } = t, { hasPopup: p = !1 } = t, { color: b = "var(--block-label-text-color)" } = t, { transparent: S = !1 } = t, { background: a = "var(--background-fill-primary)" } = t, { offset: E = 0 } = t;
  function i(r) {
    xc.call(this, d, r);
  }
  return d.$$set = (r) => {
    "Icon" in r && n(0, u = r.Icon), "label" in r && n(1, f = r.label), "show_label" in r && n(2, k = r.show_label), "pending" in r && n(3, m = r.pending), "size" in r && n(4, o = r.size), "padded" in r && n(5, l = r.padded), "highlight" in r && n(6, c = r.highlight), "disabled" in r && n(7, s = r.disabled), "hasPopup" in r && n(8, p = r.hasPopup), "color" in r && n(13, b = r.color), "transparent" in r && n(9, S = r.transparent), "background" in r && n(10, a = r.background), "offset" in r && n(11, E = r.offset);
  }, d.$$.update = () => {
    d.$$.dirty & /*highlight, color*/
    8256 && n(12, e = c ? "var(--color-accent)" : b);
  }, [
    u,
    f,
    k,
    m,
    o,
    l,
    c,
    s,
    p,
    S,
    a,
    E,
    e,
    b,
    i
  ];
}
class en extends Rc {
  constructor(t) {
    super(), Mc(this, t, Gc, Uc, Nc, {
      Icon: 0,
      label: 1,
      show_label: 2,
      pending: 3,
      size: 4,
      padded: 5,
      highlight: 6,
      disabled: 7,
      hasPopup: 8,
      color: 13,
      transparent: 9,
      background: 10,
      offset: 11
    });
  }
}
const {
  SvelteComponent: Vc,
  append: _n,
  attr: be,
  detach: Xc,
  init: jc,
  insert: Wc,
  noop: Sn,
  safe_not_equal: qc,
  set_style: Te,
  svg_element: Gi
} = window.__gradio__svelte__internal;
function Yc(d) {
  let t, n, e, u;
  return {
    c() {
      t = Gi("svg"), n = Gi("g"), e = Gi("path"), u = Gi("path"), be(e, "d", "M18,6L6.087,17.913"), Te(e, "fill", "none"), Te(e, "fill-rule", "nonzero"), Te(e, "stroke-width", "2px"), be(n, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), be(u, "d", "M4.364,4.364L19.636,19.636"), Te(u, "fill", "none"), Te(u, "fill-rule", "nonzero"), Te(u, "stroke-width", "2px"), be(t, "width", "100%"), be(t, "height", "100%"), be(t, "viewBox", "0 0 24 24"), be(t, "version", "1.1"), be(t, "xmlns", "http://www.w3.org/2000/svg"), be(t, "xmlns:xlink", "http://www.w3.org/1999/xlink"), be(t, "xml:space", "preserve"), be(t, "stroke", "currentColor"), Te(t, "fill-rule", "evenodd"), Te(t, "clip-rule", "evenodd"), Te(t, "stroke-linecap", "round"), Te(t, "stroke-linejoin", "round");
    },
    m(f, k) {
      Wc(f, t, k), _n(t, n), _n(n, e), _n(t, u);
    },
    p: Sn,
    i: Sn,
    o: Sn,
    d(f) {
      f && Xc(t);
    }
  };
}
class Kc extends Vc {
  constructor(t) {
    super(), jc(this, t, null, Yc, qc, {});
  }
}
const {
  SvelteComponent: Jc,
  append: Qc,
  attr: gi,
  detach: Zc,
  init: $c,
  insert: th,
  noop: En,
  safe_not_equal: eh,
  svg_element: qs
} = window.__gradio__svelte__internal;
function ih(d) {
  let t, n;
  return {
    c() {
      t = qs("svg"), n = qs("path"), gi(n, "fill", "currentColor"), gi(n, "d", "M26 24v4H6v-4H4v4a2 2 0 0 0 2 2h20a2 2 0 0 0 2-2v-4zm0-10l-1.41-1.41L17 20.17V2h-2v18.17l-7.59-7.58L6 14l10 10l10-10z"), gi(t, "xmlns", "http://www.w3.org/2000/svg"), gi(t, "width", "100%"), gi(t, "height", "100%"), gi(t, "viewBox", "0 0 32 32");
    },
    m(e, u) {
      th(e, t, u), Qc(t, n);
    },
    p: En,
    i: En,
    o: En,
    d(e) {
      e && Zc(t);
    }
  };
}
class nh extends Jc {
  constructor(t) {
    super(), $c(this, t, null, ih, eh, {});
  }
}
const {
  SvelteComponent: sh,
  append: rh,
  attr: Ae,
  detach: ah,
  init: oh,
  insert: lh,
  noop: Tn,
  safe_not_equal: ch,
  svg_element: Ys
} = window.__gradio__svelte__internal;
function hh(d) {
  let t, n;
  return {
    c() {
      t = Ys("svg"), n = Ys("path"), Ae(n, "d", "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"), Ae(t, "xmlns", "http://www.w3.org/2000/svg"), Ae(t, "width", "100%"), Ae(t, "height", "100%"), Ae(t, "viewBox", "0 0 24 24"), Ae(t, "fill", "none"), Ae(t, "stroke", "currentColor"), Ae(t, "stroke-width", "1.5"), Ae(t, "stroke-linecap", "round"), Ae(t, "stroke-linejoin", "round"), Ae(t, "class", "feather feather-edit-2");
    },
    m(e, u) {
      lh(e, t, u), rh(t, n);
    },
    p: Tn,
    i: Tn,
    o: Tn,
    d(e) {
      e && ah(t);
    }
  };
}
class dh extends sh {
  constructor(t) {
    super(), oh(this, t, null, hh, ch, {});
  }
}
const {
  SvelteComponent: uh,
  append: Ks,
  attr: ae,
  detach: fh,
  init: ph,
  insert: gh,
  noop: Cn,
  safe_not_equal: mh,
  svg_element: kn
} = window.__gradio__svelte__internal;
function bh(d) {
  let t, n, e;
  return {
    c() {
      t = kn("svg"), n = kn("polyline"), e = kn("path"), ae(n, "points", "1 4 1 10 7 10"), ae(e, "d", "M3.51 15a9 9 0 1 0 2.13-9.36L1 10"), ae(t, "xmlns", "http://www.w3.org/2000/svg"), ae(t, "width", "100%"), ae(t, "height", "100%"), ae(t, "viewBox", "0 0 24 24"), ae(t, "fill", "none"), ae(t, "stroke", "currentColor"), ae(t, "stroke-width", "2"), ae(t, "stroke-linecap", "round"), ae(t, "stroke-linejoin", "round"), ae(t, "class", "feather feather-rotate-ccw");
    },
    m(u, f) {
      gh(u, t, f), Ks(t, n), Ks(t, e);
    },
    p: Cn,
    i: Cn,
    o: Cn,
    d(u) {
      u && fh(t);
    }
  };
}
class Ah extends uh {
  constructor(t) {
    super(), ph(this, t, null, bh, mh, {});
  }
}
const { setContext: Ed, getContext: vh } = window.__gradio__svelte__internal, yh = "WORKER_PROXY_CONTEXT_KEY";
function wh() {
  return vh(yh);
}
const _h = "lite.local";
function Sh(d) {
  return d.host === window.location.host || d.host === "localhost:7860" || d.host === "127.0.0.1:7860" || // Ref: https://github.com/gradio-app/gradio/blob/v3.32.0/js/app/src/Index.svelte#L194
  d.host === _h;
}
function Eh(d, t) {
  const n = t.toLowerCase();
  for (const [e, u] of Object.entries(d))
    if (e.toLowerCase() === n)
      return u;
}
function Th(d) {
  if (d == null)
    return !1;
  const t = new URL(d, window.location.href);
  return !(!Sh(t) || t.protocol !== "http:" && t.protocol !== "https:");
}
const {
  SvelteComponent: Ch,
  assign: Ji,
  check_outros: Kr,
  compute_rest_props: Js,
  create_slot: Xn,
  detach: nn,
  element: Jr,
  empty: Qr,
  exclude_internal_props: kh,
  get_all_dirty_from_scope: jn,
  get_slot_changes: Wn,
  get_spread_update: Zr,
  group_outros: $r,
  init: Rh,
  insert: sn,
  listen: ta,
  prevent_default: xh,
  safe_not_equal: Lh,
  set_attributes: Qi,
  transition_in: li,
  transition_out: ci,
  update_slot_base: qn
} = window.__gradio__svelte__internal, { createEventDispatcher: Fh } = window.__gradio__svelte__internal;
function Mh(d) {
  let t, n, e, u, f;
  const k = (
    /*#slots*/
    d[8].default
  ), m = Xn(
    k,
    d,
    /*$$scope*/
    d[7],
    null
  );
  let o = [
    { href: (
      /*href*/
      d[0]
    ) },
    {
      target: n = typeof window < "u" && window.__is_colab__ ? "_blank" : null
    },
    { rel: "noopener noreferrer" },
    { download: (
      /*download*/
      d[1]
    ) },
    /*$$restProps*/
    d[6]
  ], l = {};
  for (let c = 0; c < o.length; c += 1)
    l = Ji(l, o[c]);
  return {
    c() {
      t = Jr("a"), m && m.c(), Qi(t, l);
    },
    m(c, s) {
      sn(c, t, s), m && m.m(t, null), e = !0, u || (f = ta(
        t,
        "click",
        /*dispatch*/
        d[3].bind(null, "click")
      ), u = !0);
    },
    p(c, s) {
      m && m.p && (!e || s & /*$$scope*/
      128) && qn(
        m,
        k,
        c,
        /*$$scope*/
        c[7],
        e ? Wn(
          k,
          /*$$scope*/
          c[7],
          s,
          null
        ) : jn(
          /*$$scope*/
          c[7]
        ),
        null
      ), Qi(t, l = Zr(o, [
        (!e || s & /*href*/
        1) && { href: (
          /*href*/
          c[0]
        ) },
        { target: n },
        { rel: "noopener noreferrer" },
        (!e || s & /*download*/
        2) && { download: (
          /*download*/
          c[1]
        ) },
        s & /*$$restProps*/
        64 && /*$$restProps*/
        c[6]
      ]));
    },
    i(c) {
      e || (li(m, c), e = !0);
    },
    o(c) {
      ci(m, c), e = !1;
    },
    d(c) {
      c && nn(t), m && m.d(c), u = !1, f();
    }
  };
}
function Ih(d) {
  let t, n, e, u;
  const f = [Nh, Ph], k = [];
  function m(o, l) {
    return (
      /*is_downloading*/
      o[2] ? 0 : 1
    );
  }
  return t = m(d), n = k[t] = f[t](d), {
    c() {
      n.c(), e = Qr();
    },
    m(o, l) {
      k[t].m(o, l), sn(o, e, l), u = !0;
    },
    p(o, l) {
      let c = t;
      t = m(o), t === c ? k[t].p(o, l) : ($r(), ci(k[c], 1, 1, () => {
        k[c] = null;
      }), Kr(), n = k[t], n ? n.p(o, l) : (n = k[t] = f[t](o), n.c()), li(n, 1), n.m(e.parentNode, e));
    },
    i(o) {
      u || (li(n), u = !0);
    },
    o(o) {
      ci(n), u = !1;
    },
    d(o) {
      o && nn(e), k[t].d(o);
    }
  };
}
function Ph(d) {
  let t, n, e, u;
  const f = (
    /*#slots*/
    d[8].default
  ), k = Xn(
    f,
    d,
    /*$$scope*/
    d[7],
    null
  );
  let m = [
    /*$$restProps*/
    d[6],
    { href: (
      /*href*/
      d[0]
    ) }
  ], o = {};
  for (let l = 0; l < m.length; l += 1)
    o = Ji(o, m[l]);
  return {
    c() {
      t = Jr("a"), k && k.c(), Qi(t, o);
    },
    m(l, c) {
      sn(l, t, c), k && k.m(t, null), n = !0, e || (u = ta(t, "click", xh(
        /*wasm_click_handler*/
        d[5]
      )), e = !0);
    },
    p(l, c) {
      k && k.p && (!n || c & /*$$scope*/
      128) && qn(
        k,
        f,
        l,
        /*$$scope*/
        l[7],
        n ? Wn(
          f,
          /*$$scope*/
          l[7],
          c,
          null
        ) : jn(
          /*$$scope*/
          l[7]
        ),
        null
      ), Qi(t, o = Zr(m, [
        c & /*$$restProps*/
        64 && /*$$restProps*/
        l[6],
        (!n || c & /*href*/
        1) && { href: (
          /*href*/
          l[0]
        ) }
      ]));
    },
    i(l) {
      n || (li(k, l), n = !0);
    },
    o(l) {
      ci(k, l), n = !1;
    },
    d(l) {
      l && nn(t), k && k.d(l), e = !1, u();
    }
  };
}
function Nh(d) {
  let t;
  const n = (
    /*#slots*/
    d[8].default
  ), e = Xn(
    n,
    d,
    /*$$scope*/
    d[7],
    null
  );
  return {
    c() {
      e && e.c();
    },
    m(u, f) {
      e && e.m(u, f), t = !0;
    },
    p(u, f) {
      e && e.p && (!t || f & /*$$scope*/
      128) && qn(
        e,
        n,
        u,
        /*$$scope*/
        u[7],
        t ? Wn(
          n,
          /*$$scope*/
          u[7],
          f,
          null
        ) : jn(
          /*$$scope*/
          u[7]
        ),
        null
      );
    },
    i(u) {
      t || (li(e, u), t = !0);
    },
    o(u) {
      ci(e, u), t = !1;
    },
    d(u) {
      e && e.d(u);
    }
  };
}
function Dh(d) {
  let t, n, e, u, f;
  const k = [Ih, Mh], m = [];
  function o(l, c) {
    return c & /*href*/
    1 && (t = null), t == null && (t = !!/*worker_proxy*/
    (l[4] && Th(
      /*href*/
      l[0]
    ))), t ? 0 : 1;
  }
  return n = o(d, -1), e = m[n] = k[n](d), {
    c() {
      e.c(), u = Qr();
    },
    m(l, c) {
      m[n].m(l, c), sn(l, u, c), f = !0;
    },
    p(l, [c]) {
      let s = n;
      n = o(l, c), n === s ? m[n].p(l, c) : ($r(), ci(m[s], 1, 1, () => {
        m[s] = null;
      }), Kr(), e = m[n], e ? e.p(l, c) : (e = m[n] = k[n](l), e.c()), li(e, 1), e.m(u.parentNode, u));
    },
    i(l) {
      f || (li(e), f = !0);
    },
    o(l) {
      ci(e), f = !1;
    },
    d(l) {
      l && nn(u), m[n].d(l);
    }
  };
}
function Oh(d, t, n) {
  const e = ["href", "download"];
  let u = Js(t, e), { $$slots: f = {}, $$scope: k } = t;
  var m = this && this.__awaiter || function(S, a, E, i) {
    function r(v) {
      return v instanceof E ? v : new E(function(y) {
        y(v);
      });
    }
    return new (E || (E = Promise))(function(v, y) {
      function R(H) {
        try {
          I(i.next(H));
        } catch (B) {
          y(B);
        }
      }
      function F(H) {
        try {
          I(i.throw(H));
        } catch (B) {
          y(B);
        }
      }
      function I(H) {
        H.done ? v(H.value) : r(H.value).then(R, F);
      }
      I((i = i.apply(S, a || [])).next());
    });
  };
  let { href: o = void 0 } = t, { download: l } = t;
  const c = Fh();
  let s = !1;
  const p = wh();
  function b() {
    return m(this, void 0, void 0, function* () {
      if (s)
        return;
      if (c("click"), o == null)
        throw new Error("href is not defined.");
      if (p == null)
        throw new Error("Wasm worker proxy is not available.");
      const a = new URL(o, window.location.href).pathname;
      n(2, s = !0), p.httpRequest({
        method: "GET",
        path: a,
        headers: {},
        query_string: ""
      }).then((E) => {
        if (E.status !== 200)
          throw new Error(`Failed to get file ${a} from the Wasm worker.`);
        const i = new Blob(
          [E.body],
          {
            type: Eh(E.headers, "content-type")
          }
        ), r = URL.createObjectURL(i), v = document.createElement("a");
        v.href = r, v.download = l, v.click(), URL.revokeObjectURL(r);
      }).finally(() => {
        n(2, s = !1);
      });
    });
  }
  return d.$$set = (S) => {
    t = Ji(Ji({}, t), kh(S)), n(6, u = Js(t, e)), "href" in S && n(0, o = S.href), "download" in S && n(1, l = S.download), "$$scope" in S && n(7, k = S.$$scope);
  }, [
    o,
    l,
    s,
    c,
    p,
    b,
    u,
    k,
    f
  ];
}
class Hh extends Ch {
  constructor(t) {
    super(), Rh(this, t, Oh, Dh, Lh, { href: 0, download: 1 });
  }
}
const {
  SvelteComponent: zh,
  append: Rn,
  attr: Bh,
  check_outros: xn,
  create_component: Fi,
  destroy_component: Mi,
  detach: Uh,
  element: Gh,
  group_outros: Ln,
  init: Vh,
  insert: Xh,
  mount_component: Ii,
  safe_not_equal: jh,
  set_style: Qs,
  space: Fn,
  toggle_class: Zs,
  transition_in: Jt,
  transition_out: ye
} = window.__gradio__svelte__internal, { createEventDispatcher: Wh } = window.__gradio__svelte__internal;
function $s(d) {
  let t, n;
  return t = new en({
    props: {
      Icon: dh,
      label: (
        /*i18n*/
        d[4]("common.edit")
      )
    }
  }), t.$on(
    "click",
    /*click_handler*/
    d[6]
  ), {
    c() {
      Fi(t.$$.fragment);
    },
    m(e, u) {
      Ii(t, e, u), n = !0;
    },
    p(e, u) {
      const f = {};
      u & /*i18n*/
      16 && (f.label = /*i18n*/
      e[4]("common.edit")), t.$set(f);
    },
    i(e) {
      n || (Jt(t.$$.fragment, e), n = !0);
    },
    o(e) {
      ye(t.$$.fragment, e), n = !1;
    },
    d(e) {
      Mi(t, e);
    }
  };
}
function tr(d) {
  let t, n;
  return t = new en({
    props: {
      Icon: Ah,
      label: (
        /*i18n*/
        d[4]("common.undo")
      )
    }
  }), t.$on(
    "click",
    /*click_handler_1*/
    d[7]
  ), {
    c() {
      Fi(t.$$.fragment);
    },
    m(e, u) {
      Ii(t, e, u), n = !0;
    },
    p(e, u) {
      const f = {};
      u & /*i18n*/
      16 && (f.label = /*i18n*/
      e[4]("common.undo")), t.$set(f);
    },
    i(e) {
      n || (Jt(t.$$.fragment, e), n = !0);
    },
    o(e) {
      ye(t.$$.fragment, e), n = !1;
    },
    d(e) {
      Mi(t, e);
    }
  };
}
function er(d) {
  let t, n;
  return t = new Hh({
    props: {
      href: (
        /*download*/
        d[2]
      ),
      download: !0,
      $$slots: { default: [qh] },
      $$scope: { ctx: d }
    }
  }), {
    c() {
      Fi(t.$$.fragment);
    },
    m(e, u) {
      Ii(t, e, u), n = !0;
    },
    p(e, u) {
      const f = {};
      u & /*download*/
      4 && (f.href = /*download*/
      e[2]), u & /*$$scope, i18n*/
      528 && (f.$$scope = { dirty: u, ctx: e }), t.$set(f);
    },
    i(e) {
      n || (Jt(t.$$.fragment, e), n = !0);
    },
    o(e) {
      ye(t.$$.fragment, e), n = !1;
    },
    d(e) {
      Mi(t, e);
    }
  };
}
function qh(d) {
  let t, n;
  return t = new en({
    props: {
      Icon: nh,
      label: (
        /*i18n*/
        d[4]("common.download")
      )
    }
  }), {
    c() {
      Fi(t.$$.fragment);
    },
    m(e, u) {
      Ii(t, e, u), n = !0;
    },
    p(e, u) {
      const f = {};
      u & /*i18n*/
      16 && (f.label = /*i18n*/
      e[4]("common.download")), t.$set(f);
    },
    i(e) {
      n || (Jt(t.$$.fragment, e), n = !0);
    },
    o(e) {
      ye(t.$$.fragment, e), n = !1;
    },
    d(e) {
      Mi(t, e);
    }
  };
}
function Yh(d) {
  let t, n, e, u, f, k, m = (
    /*editable*/
    d[0] && $s(d)
  ), o = (
    /*undoable*/
    d[1] && tr(d)
  ), l = (
    /*download*/
    d[2] && er(d)
  );
  return f = new en({
    props: {
      Icon: Kc,
      label: (
        /*i18n*/
        d[4]("common.clear")
      )
    }
  }), f.$on(
    "click",
    /*click_handler_2*/
    d[8]
  ), {
    c() {
      t = Gh("div"), m && m.c(), n = Fn(), o && o.c(), e = Fn(), l && l.c(), u = Fn(), Fi(f.$$.fragment), Bh(t, "class", "svelte-1wj0ocy"), Zs(t, "not-absolute", !/*absolute*/
      d[3]), Qs(
        t,
        "position",
        /*absolute*/
        d[3] ? "absolute" : "static"
      );
    },
    m(c, s) {
      Xh(c, t, s), m && m.m(t, null), Rn(t, n), o && o.m(t, null), Rn(t, e), l && l.m(t, null), Rn(t, u), Ii(f, t, null), k = !0;
    },
    p(c, [s]) {
      /*editable*/
      c[0] ? m ? (m.p(c, s), s & /*editable*/
      1 && Jt(m, 1)) : (m = $s(c), m.c(), Jt(m, 1), m.m(t, n)) : m && (Ln(), ye(m, 1, 1, () => {
        m = null;
      }), xn()), /*undoable*/
      c[1] ? o ? (o.p(c, s), s & /*undoable*/
      2 && Jt(o, 1)) : (o = tr(c), o.c(), Jt(o, 1), o.m(t, e)) : o && (Ln(), ye(o, 1, 1, () => {
        o = null;
      }), xn()), /*download*/
      c[2] ? l ? (l.p(c, s), s & /*download*/
      4 && Jt(l, 1)) : (l = er(c), l.c(), Jt(l, 1), l.m(t, u)) : l && (Ln(), ye(l, 1, 1, () => {
        l = null;
      }), xn());
      const p = {};
      s & /*i18n*/
      16 && (p.label = /*i18n*/
      c[4]("common.clear")), f.$set(p), (!k || s & /*absolute*/
      8) && Zs(t, "not-absolute", !/*absolute*/
      c[3]), s & /*absolute*/
      8 && Qs(
        t,
        "position",
        /*absolute*/
        c[3] ? "absolute" : "static"
      );
    },
    i(c) {
      k || (Jt(m), Jt(o), Jt(l), Jt(f.$$.fragment, c), k = !0);
    },
    o(c) {
      ye(m), ye(o), ye(l), ye(f.$$.fragment, c), k = !1;
    },
    d(c) {
      c && Uh(t), m && m.d(), o && o.d(), l && l.d(), Mi(f);
    }
  };
}
function Kh(d, t, n) {
  let { editable: e = !1 } = t, { undoable: u = !1 } = t, { download: f = null } = t, { absolute: k = !0 } = t, { i18n: m } = t;
  const o = Wh(), l = () => o("edit"), c = () => o("undo"), s = (p) => {
    o("clear"), p.stopPropagation();
  };
  return d.$$set = (p) => {
    "editable" in p && n(0, e = p.editable), "undoable" in p && n(1, u = p.undoable), "download" in p && n(2, f = p.download), "absolute" in p && n(3, k = p.absolute), "i18n" in p && n(4, m = p.i18n);
  }, [
    e,
    u,
    f,
    k,
    m,
    o,
    l,
    c,
    s
  ];
}
class Jh extends zh {
  constructor(t) {
    super(), Vh(this, t, Kh, Yh, jh, {
      editable: 0,
      undoable: 1,
      download: 2,
      absolute: 3,
      i18n: 4
    });
  }
}
var Qh = {
  /***/
  976: (
    /***/
    (d, t, n) => {
      n.d(t, {
        AnnotationLayer: () => (
          /* binding */
          Q
        ),
        FreeTextAnnotationElement: () => (
          /* binding */
          X
        ),
        InkAnnotationElement: () => (
          /* binding */
          st
        ),
        StampAnnotationElement: () => (
          /* binding */
          dt
        )
      });
      var e = n(292), u = n(419), f = n(792);
      function k(it) {
        return Math.floor(Math.max(0, Math.min(1, it)) * 255).toString(16).padStart(2, "0");
      }
      function m(it) {
        return Math.max(0, Math.min(255, 255 * it));
      }
      class o {
        static CMYK_G([x, C, h, g]) {
          return ["G", 1 - Math.min(1, 0.3 * x + 0.59 * h + 0.11 * C + g)];
        }
        static G_CMYK([x]) {
          return ["CMYK", 0, 0, 0, 1 - x];
        }
        static G_RGB([x]) {
          return ["RGB", x, x, x];
        }
        static G_rgb([x]) {
          return x = m(x), [x, x, x];
        }
        static G_HTML([x]) {
          const C = k(x);
          return `#${C}${C}${C}`;
        }
        static RGB_G([x, C, h]) {
          return ["G", 0.3 * x + 0.59 * C + 0.11 * h];
        }
        static RGB_rgb(x) {
          return x.map(m);
        }
        static RGB_HTML(x) {
          return `#${x.map(k).join("")}`;
        }
        static T_HTML() {
          return "#00000000";
        }
        static T_rgb() {
          return [null];
        }
        static CMYK_RGB([x, C, h, g]) {
          return ["RGB", 1 - Math.min(1, x + g), 1 - Math.min(1, h + g), 1 - Math.min(1, C + g)];
        }
        static CMYK_rgb([x, C, h, g]) {
          return [m(1 - Math.min(1, x + g)), m(1 - Math.min(1, h + g)), m(1 - Math.min(1, C + g))];
        }
        static CMYK_HTML(x) {
          const C = this.CMYK_RGB(x).slice(1);
          return this.RGB_HTML(C);
        }
        static RGB_CMYK([x, C, h]) {
          const g = 1 - x, w = 1 - C, _ = 1 - h, A = Math.min(g, w, _);
          return ["CMYK", g, w, _, A];
        }
      }
      var l = n(284);
      const c = 1e3, s = 9, p = /* @__PURE__ */ new WeakSet();
      function b(it) {
        return {
          width: it[2] - it[0],
          height: it[3] - it[1]
        };
      }
      class S {
        static create(x) {
          switch (x.data.annotationType) {
            case e.AnnotationType.LINK:
              return new E(x);
            case e.AnnotationType.TEXT:
              return new i(x);
            case e.AnnotationType.WIDGET:
              switch (x.data.fieldType) {
                case "Tx":
                  return new v(x);
                case "Btn":
                  return x.data.radioButton ? new F(x) : x.data.checkBox ? new R(x) : new I(x);
                case "Ch":
                  return new H(x);
                case "Sig":
                  return new y(x);
              }
              return new r(x);
            case e.AnnotationType.POPUP:
              return new B(x);
            case e.AnnotationType.FREETEXT:
              return new X(x);
            case e.AnnotationType.LINE:
              return new Z(x);
            case e.AnnotationType.SQUARE:
              return new lt(x);
            case e.AnnotationType.CIRCLE:
              return new Y(x);
            case e.AnnotationType.POLYLINE:
              return new V(x);
            case e.AnnotationType.CARET:
              return new $(x);
            case e.AnnotationType.INK:
              return new st(x);
            case e.AnnotationType.POLYGON:
              return new j(x);
            case e.AnnotationType.HIGHLIGHT:
              return new J(x);
            case e.AnnotationType.UNDERLINE:
              return new ht(x);
            case e.AnnotationType.SQUIGGLY:
              return new rt(x);
            case e.AnnotationType.STRIKEOUT:
              return new pt(x);
            case e.AnnotationType.STAMP:
              return new dt(x);
            case e.AnnotationType.FILEATTACHMENT:
              return new ut(x);
            default:
              return new a(x);
          }
        }
      }
      class a {
        #t = null;
        #e = !1;
        constructor(x, {
          isRenderable: C = !1,
          ignoreBorder: h = !1,
          createQuadrilaterals: g = !1
        } = {}) {
          this.isRenderable = C, this.data = x.data, this.layer = x.layer, this.linkService = x.linkService, this.downloadManager = x.downloadManager, this.imageResourcesPath = x.imageResourcesPath, this.renderForms = x.renderForms, this.svgFactory = x.svgFactory, this.annotationStorage = x.annotationStorage, this.enableScripting = x.enableScripting, this.hasJSActions = x.hasJSActions, this._fieldObjects = x.fieldObjects, this.parent = x.parent, C && (this.container = this._createContainer(h)), g && this._createQuadrilaterals();
        }
        static _hasPopupData({
          titleObj: x,
          contentsObj: C,
          richText: h
        }) {
          return !!(x?.str || C?.str || h?.str);
        }
        get hasPopupData() {
          return a._hasPopupData(this.data);
        }
        updateEdited(x) {
          if (!this.container)
            return;
          this.#t ||= {
            rect: this.data.rect.slice(0)
          };
          const {
            rect: C
          } = x;
          C && this.#i(C);
        }
        resetEdited() {
          this.#t && (this.#i(this.#t.rect), this.#t = null);
        }
        #i(x) {
          const {
            container: {
              style: C
            },
            data: {
              rect: h,
              rotation: g
            },
            parent: {
              viewport: {
                rawDims: {
                  pageWidth: w,
                  pageHeight: _,
                  pageX: A,
                  pageY: T
                }
              }
            }
          } = this;
          h?.splice(0, 4, ...x);
          const {
            width: L,
            height: M
          } = b(x);
          C.left = `${100 * (x[0] - A) / w}%`, C.top = `${100 * (_ - x[3] + T) / _}%`, g === 0 ? (C.width = `${100 * L / w}%`, C.height = `${100 * M / _}%`) : this.setRotation(g);
        }
        _createContainer(x) {
          const {
            data: C,
            parent: {
              page: h,
              viewport: g
            }
          } = this, w = document.createElement("section");
          w.setAttribute("data-annotation-id", C.id), this instanceof r || (w.tabIndex = c);
          const {
            style: _
          } = w;
          if (_.zIndex = this.parent.zIndex++, C.popupRef && w.setAttribute("aria-haspopup", "dialog"), C.alternativeText && (w.title = C.alternativeText), C.noRotate && w.classList.add("norotate"), !C.rect || this instanceof B) {
            const {
              rotation: O
            } = C;
            return !C.hasOwnCanvas && O !== 0 && this.setRotation(O, w), w;
          }
          const {
            width: A,
            height: T
          } = b(C.rect);
          if (!x && C.borderStyle.width > 0) {
            _.borderWidth = `${C.borderStyle.width}px`;
            const O = C.borderStyle.horizontalCornerRadius, P = C.borderStyle.verticalCornerRadius;
            if (O > 0 || P > 0) {
              const et = `calc(${O}px * var(--scale-factor)) / calc(${P}px * var(--scale-factor))`;
              _.borderRadius = et;
            } else if (this instanceof F) {
              const et = `calc(${A}px * var(--scale-factor)) / calc(${T}px * var(--scale-factor))`;
              _.borderRadius = et;
            }
            switch (C.borderStyle.style) {
              case e.AnnotationBorderStyleType.SOLID:
                _.borderStyle = "solid";
                break;
              case e.AnnotationBorderStyleType.DASHED:
                _.borderStyle = "dashed";
                break;
              case e.AnnotationBorderStyleType.BEVELED:
                (0, e.warn)("Unimplemented border style: beveled");
                break;
              case e.AnnotationBorderStyleType.INSET:
                (0, e.warn)("Unimplemented border style: inset");
                break;
              case e.AnnotationBorderStyleType.UNDERLINE:
                _.borderBottomStyle = "solid";
                break;
            }
            const q = C.borderColor || null;
            q ? (this.#e = !0, _.borderColor = e.Util.makeHexColor(q[0] | 0, q[1] | 0, q[2] | 0)) : _.borderWidth = 0;
          }
          const L = e.Util.normalizeRect([C.rect[0], h.view[3] - C.rect[1] + h.view[1], C.rect[2], h.view[3] - C.rect[3] + h.view[1]]), {
            pageWidth: M,
            pageHeight: N,
            pageX: D,
            pageY: G
          } = g.rawDims;
          _.left = `${100 * (L[0] - D) / M}%`, _.top = `${100 * (L[1] - G) / N}%`;
          const {
            rotation: z
          } = C;
          return C.hasOwnCanvas || z === 0 ? (_.width = `${100 * A / M}%`, _.height = `${100 * T / N}%`) : this.setRotation(z, w), w;
        }
        setRotation(x, C = this.container) {
          if (!this.data.rect)
            return;
          const {
            pageWidth: h,
            pageHeight: g
          } = this.parent.viewport.rawDims, {
            width: w,
            height: _
          } = b(this.data.rect);
          let A, T;
          x % 180 === 0 ? (A = 100 * w / h, T = 100 * _ / g) : (A = 100 * _ / h, T = 100 * w / g), C.style.width = `${A}%`, C.style.height = `${T}%`, C.setAttribute("data-main-rotation", (360 - x) % 360);
        }
        get _commonActions() {
          const x = (C, h, g) => {
            const w = g.detail[C], _ = w[0], A = w.slice(1);
            g.target.style[h] = o[`${_}_HTML`](A), this.annotationStorage.setValue(this.data.id, {
              [h]: o[`${_}_rgb`](A)
            });
          };
          return (0, e.shadow)(this, "_commonActions", {
            display: (C) => {
              const {
                display: h
              } = C.detail, g = h % 2 === 1;
              this.container.style.visibility = g ? "hidden" : "visible", this.annotationStorage.setValue(this.data.id, {
                noView: g,
                noPrint: h === 1 || h === 2
              });
            },
            print: (C) => {
              this.annotationStorage.setValue(this.data.id, {
                noPrint: !C.detail.print
              });
            },
            hidden: (C) => {
              const {
                hidden: h
              } = C.detail;
              this.container.style.visibility = h ? "hidden" : "visible", this.annotationStorage.setValue(this.data.id, {
                noPrint: h,
                noView: h
              });
            },
            focus: (C) => {
              setTimeout(() => C.target.focus({
                preventScroll: !1
              }), 0);
            },
            userName: (C) => {
              C.target.title = C.detail.userName;
            },
            readonly: (C) => {
              C.target.disabled = C.detail.readonly;
            },
            required: (C) => {
              this._setRequired(C.target, C.detail.required);
            },
            bgColor: (C) => {
              x("bgColor", "backgroundColor", C);
            },
            fillColor: (C) => {
              x("fillColor", "backgroundColor", C);
            },
            fgColor: (C) => {
              x("fgColor", "color", C);
            },
            textColor: (C) => {
              x("textColor", "color", C);
            },
            borderColor: (C) => {
              x("borderColor", "borderColor", C);
            },
            strokeColor: (C) => {
              x("strokeColor", "borderColor", C);
            },
            rotation: (C) => {
              const h = C.detail.rotation;
              this.setRotation(h), this.annotationStorage.setValue(this.data.id, {
                rotation: h
              });
            }
          });
        }
        _dispatchEventFromSandbox(x, C) {
          const h = this._commonActions;
          for (const g of Object.keys(C.detail))
            (x[g] || h[g])?.(C);
        }
        _setDefaultPropertiesFromJS(x) {
          if (!this.enableScripting)
            return;
          const C = this.annotationStorage.getRawValue(this.data.id);
          if (!C)
            return;
          const h = this._commonActions;
          for (const [g, w] of Object.entries(C)) {
            const _ = h[g];
            if (_) {
              const A = {
                detail: {
                  [g]: w
                },
                target: x
              };
              _(A), delete C[g];
            }
          }
        }
        _createQuadrilaterals() {
          if (!this.container)
            return;
          const {
            quadPoints: x
          } = this.data;
          if (!x)
            return;
          const [C, h, g, w] = this.data.rect;
          if (x.length === 1) {
            const [, {
              x: O,
              y: P
            }, {
              x: q,
              y: et
            }] = x[0];
            if (g === O && w === P && C === q && h === et)
              return;
          }
          const {
            style: _
          } = this.container;
          let A;
          if (this.#e) {
            const {
              borderColor: O,
              borderWidth: P
            } = _;
            _.borderWidth = 0, A = ["url('data:image/svg+xml;utf8,", '<svg xmlns="http://www.w3.org/2000/svg"', ' preserveAspectRatio="none" viewBox="0 0 1 1">', `<g fill="transparent" stroke="${O}" stroke-width="${P}">`], this.container.classList.add("hasBorder");
          }
          const T = g - C, L = w - h, {
            svgFactory: M
          } = this, N = M.createElement("svg");
          N.classList.add("quadrilateralsContainer"), N.setAttribute("width", 0), N.setAttribute("height", 0);
          const D = M.createElement("defs");
          N.append(D);
          const G = M.createElement("clipPath"), z = `clippath_${this.data.id}`;
          G.setAttribute("id", z), G.setAttribute("clipPathUnits", "objectBoundingBox"), D.append(G);
          for (const [, {
            x: O,
            y: P
          }, {
            x: q,
            y: et
          }] of x) {
            const K = M.createElement("rect"), tt = (q - C) / T, ft = (w - P) / L, at = (O - q) / T, nt = (P - et) / L;
            K.setAttribute("x", tt), K.setAttribute("y", ft), K.setAttribute("width", at), K.setAttribute("height", nt), G.append(K), A?.push(`<rect vector-effect="non-scaling-stroke" x="${tt}" y="${ft}" width="${at}" height="${nt}"/>`);
          }
          this.#e && (A.push("</g></svg>')"), _.backgroundImage = A.join("")), this.container.append(N), this.container.style.clipPath = `url(#${z})`;
        }
        _createPopup() {
          const {
            container: x,
            data: C
          } = this;
          x.setAttribute("aria-haspopup", "dialog");
          const h = new B({
            data: {
              color: C.color,
              titleObj: C.titleObj,
              modificationDate: C.modificationDate,
              contentsObj: C.contentsObj,
              richText: C.richText,
              parentRect: C.rect,
              borderStyle: 0,
              id: `popup_${C.id}`,
              rotation: C.rotation
            },
            parent: this.parent,
            elements: [this]
          });
          this.parent.div.append(h.render());
        }
        render() {
          (0, e.unreachable)("Abstract method `AnnotationElement.render` called");
        }
        _getElementsByName(x, C = null) {
          const h = [];
          if (this._fieldObjects) {
            const g = this._fieldObjects[x];
            if (g)
              for (const {
                page: w,
                id: _,
                exportValues: A
              } of g) {
                if (w === -1 || _ === C)
                  continue;
                const T = typeof A == "string" ? A : null, L = document.querySelector(`[data-element-id="${_}"]`);
                if (L && !p.has(L)) {
                  (0, e.warn)(`_getElementsByName - element not allowed: ${_}`);
                  continue;
                }
                h.push({
                  id: _,
                  exportValue: T,
                  domElement: L
                });
              }
            return h;
          }
          for (const g of document.getElementsByName(x)) {
            const {
              exportValue: w
            } = g, _ = g.getAttribute("data-element-id");
            _ !== C && p.has(g) && h.push({
              id: _,
              exportValue: w,
              domElement: g
            });
          }
          return h;
        }
        show() {
          this.container && (this.container.hidden = !1), this.popup?.maybeShow();
        }
        hide() {
          this.container && (this.container.hidden = !0), this.popup?.forceHide();
        }
        getElementsToTriggerPopup() {
          return this.container;
        }
        addHighlightArea() {
          const x = this.getElementsToTriggerPopup();
          if (Array.isArray(x))
            for (const C of x)
              C.classList.add("highlightArea");
          else
            x.classList.add("highlightArea");
        }
        get _isEditable() {
          return !1;
        }
        _editOnDoubleClick() {
          if (!this._isEditable)
            return;
          const {
            annotationEditorType: x,
            data: {
              id: C
            }
          } = this;
          this.container.addEventListener("dblclick", () => {
            this.linkService.eventBus?.dispatch("switchannotationeditormode", {
              source: this,
              mode: x,
              editId: C
            });
          });
        }
      }
      class E extends a {
        constructor(x, C = null) {
          super(x, {
            isRenderable: !0,
            ignoreBorder: !!C?.ignoreBorder,
            createQuadrilaterals: !0
          }), this.isTooltipOnly = x.data.isTooltipOnly;
        }
        render() {
          const {
            data: x,
            linkService: C
          } = this, h = document.createElement("a");
          h.setAttribute("data-element-id", x.id);
          let g = !1;
          return x.url ? (C.addLinkAttributes(h, x.url, x.newWindow), g = !0) : x.action ? (this._bindNamedAction(h, x.action), g = !0) : x.attachment ? (this.#e(h, x.attachment, x.attachmentDest), g = !0) : x.setOCGState ? (this.#i(h, x.setOCGState), g = !0) : x.dest ? (this._bindLink(h, x.dest), g = !0) : (x.actions && (x.actions.Action || x.actions["Mouse Up"] || x.actions["Mouse Down"]) && this.enableScripting && this.hasJSActions && (this._bindJSAction(h, x), g = !0), x.resetForm ? (this._bindResetFormAction(h, x.resetForm), g = !0) : this.isTooltipOnly && !g && (this._bindLink(h, ""), g = !0)), this.container.classList.add("linkAnnotation"), g && this.container.append(h), this.container;
        }
        #t() {
          this.container.setAttribute("data-internal-link", "");
        }
        _bindLink(x, C) {
          x.href = this.linkService.getDestinationHash(C), x.onclick = () => (C && this.linkService.goToDestination(C), !1), (C || C === "") && this.#t();
        }
        _bindNamedAction(x, C) {
          x.href = this.linkService.getAnchorUrl(""), x.onclick = () => (this.linkService.executeNamedAction(C), !1), this.#t();
        }
        #e(x, C, h = null) {
          x.href = this.linkService.getAnchorUrl(""), x.onclick = () => (this.downloadManager?.openOrDownloadData(C.content, C.filename, h), !1), this.#t();
        }
        #i(x, C) {
          x.href = this.linkService.getAnchorUrl(""), x.onclick = () => (this.linkService.executeSetOCGState(C), !1), this.#t();
        }
        _bindJSAction(x, C) {
          x.href = this.linkService.getAnchorUrl("");
          const h = /* @__PURE__ */ new Map([["Action", "onclick"], ["Mouse Up", "onmouseup"], ["Mouse Down", "onmousedown"]]);
          for (const g of Object.keys(C.actions)) {
            const w = h.get(g);
            w && (x[w] = () => (this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
              source: this,
              detail: {
                id: C.id,
                name: g
              }
            }), !1));
          }
          x.onclick || (x.onclick = () => !1), this.#t();
        }
        _bindResetFormAction(x, C) {
          const h = x.onclick;
          if (h || (x.href = this.linkService.getAnchorUrl("")), this.#t(), !this._fieldObjects) {
            (0, e.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'), h || (x.onclick = () => !1);
            return;
          }
          x.onclick = () => {
            h?.();
            const {
              fields: g,
              refs: w,
              include: _
            } = C, A = [];
            if (g.length !== 0 || w.length !== 0) {
              const M = new Set(w);
              for (const N of g) {
                const D = this._fieldObjects[N] || [];
                for (const {
                  id: G
                } of D)
                  M.add(G);
              }
              for (const N of Object.values(this._fieldObjects))
                for (const D of N)
                  M.has(D.id) === _ && A.push(D);
            } else
              for (const M of Object.values(this._fieldObjects))
                A.push(...M);
            const T = this.annotationStorage, L = [];
            for (const M of A) {
              const {
                id: N
              } = M;
              switch (L.push(N), M.type) {
                case "text": {
                  const G = M.defaultValue || "";
                  T.setValue(N, {
                    value: G
                  });
                  break;
                }
                case "checkbox":
                case "radiobutton": {
                  const G = M.defaultValue === M.exportValues;
                  T.setValue(N, {
                    value: G
                  });
                  break;
                }
                case "combobox":
                case "listbox": {
                  const G = M.defaultValue || "";
                  T.setValue(N, {
                    value: G
                  });
                  break;
                }
                default:
                  continue;
              }
              const D = document.querySelector(`[data-element-id="${N}"]`);
              if (D) {
                if (!p.has(D)) {
                  (0, e.warn)(`_bindResetFormAction - element not allowed: ${N}`);
                  continue;
                }
              } else
                continue;
              D.dispatchEvent(new Event("resetform"));
            }
            return this.enableScripting && this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
              source: this,
              detail: {
                id: "app",
                ids: L,
                name: "ResetForm"
              }
            }), !1;
          };
        }
      }
      class i extends a {
        constructor(x) {
          super(x, {
            isRenderable: !0
          });
        }
        render() {
          this.container.classList.add("textAnnotation");
          const x = document.createElement("img");
          return x.src = this.imageResourcesPath + "annotation-" + this.data.name.toLowerCase() + ".svg", x.setAttribute("data-l10n-id", "pdfjs-text-annotation-type"), x.setAttribute("data-l10n-args", JSON.stringify({
            type: this.data.name
          })), !this.data.popupRef && this.hasPopupData && this._createPopup(), this.container.append(x), this.container;
        }
      }
      class r extends a {
        render() {
          return this.container;
        }
        showElementAndHideCanvas(x) {
          this.data.hasOwnCanvas && (x.previousSibling?.nodeName === "CANVAS" && (x.previousSibling.hidden = !0), x.hidden = !1);
        }
        _getKeyModifier(x) {
          return e.FeatureTest.platform.isMac ? x.metaKey : x.ctrlKey;
        }
        _setEventListener(x, C, h, g, w) {
          h.includes("mouse") ? x.addEventListener(h, (_) => {
            this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
              source: this,
              detail: {
                id: this.data.id,
                name: g,
                value: w(_),
                shift: _.shiftKey,
                modifier: this._getKeyModifier(_)
              }
            });
          }) : x.addEventListener(h, (_) => {
            if (h === "blur") {
              if (!C.focused || !_.relatedTarget)
                return;
              C.focused = !1;
            } else if (h === "focus") {
              if (C.focused)
                return;
              C.focused = !0;
            }
            w && this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
              source: this,
              detail: {
                id: this.data.id,
                name: g,
                value: w(_)
              }
            });
          });
        }
        _setEventListeners(x, C, h, g) {
          for (const [w, _] of h)
            (_ === "Action" || this.data.actions?.[_]) && ((_ === "Focus" || _ === "Blur") && (C ||= {
              focused: !1
            }), this._setEventListener(x, C, w, _, g), _ === "Focus" && !this.data.actions?.Blur ? this._setEventListener(x, C, "blur", "Blur", null) : _ === "Blur" && !this.data.actions?.Focus && this._setEventListener(x, C, "focus", "Focus", null));
        }
        _setBackgroundColor(x) {
          const C = this.data.backgroundColor || null;
          x.style.backgroundColor = C === null ? "transparent" : e.Util.makeHexColor(C[0], C[1], C[2]);
        }
        _setTextStyle(x) {
          const C = ["left", "center", "right"], {
            fontColor: h
          } = this.data.defaultAppearanceData, g = this.data.defaultAppearanceData.fontSize || s, w = x.style;
          let _;
          const A = 2, T = (L) => Math.round(10 * L) / 10;
          if (this.data.multiLine) {
            const L = Math.abs(this.data.rect[3] - this.data.rect[1] - A), M = Math.round(L / (e.LINE_FACTOR * g)) || 1, N = L / M;
            _ = Math.min(g, T(N / e.LINE_FACTOR));
          } else {
            const L = Math.abs(this.data.rect[3] - this.data.rect[1] - A);
            _ = Math.min(g, T(L / e.LINE_FACTOR));
          }
          w.fontSize = `calc(${_}px * var(--scale-factor))`, w.color = e.Util.makeHexColor(h[0], h[1], h[2]), this.data.textAlignment !== null && (w.textAlign = C[this.data.textAlignment]);
        }
        _setRequired(x, C) {
          C ? x.setAttribute("required", !0) : x.removeAttribute("required"), x.setAttribute("aria-required", C);
        }
      }
      class v extends r {
        constructor(x) {
          const C = x.renderForms || x.data.hasOwnCanvas || !x.data.hasAppearance && !!x.data.fieldValue;
          super(x, {
            isRenderable: C
          });
        }
        setPropertyOnSiblings(x, C, h, g) {
          const w = this.annotationStorage;
          for (const _ of this._getElementsByName(x.name, x.id))
            _.domElement && (_.domElement[C] = h), w.setValue(_.id, {
              [g]: h
            });
        }
        render() {
          const x = this.annotationStorage, C = this.data.id;
          this.container.classList.add("textWidgetAnnotation");
          let h = null;
          if (this.renderForms) {
            const g = x.getValue(C, {
              value: this.data.fieldValue
            });
            let w = g.value || "";
            const _ = x.getValue(C, {
              charLimit: this.data.maxLen
            }).charLimit;
            _ && w.length > _ && (w = w.slice(0, _));
            let A = g.formattedValue || this.data.textContent?.join(`
`) || null;
            A && this.data.comb && (A = A.replaceAll(/\s+/g, ""));
            const T = {
              userValue: w,
              formattedValue: A,
              lastCommittedValue: null,
              commitKey: 1,
              focused: !1
            };
            this.data.multiLine ? (h = document.createElement("textarea"), h.textContent = A ?? w, this.data.doNotScroll && (h.style.overflowY = "hidden")) : (h = document.createElement("input"), h.type = "text", h.setAttribute("value", A ?? w), this.data.doNotScroll && (h.style.overflowX = "hidden")), this.data.hasOwnCanvas && (h.hidden = !0), p.add(h), h.setAttribute("data-element-id", C), h.disabled = this.data.readOnly, h.name = this.data.fieldName, h.tabIndex = c, this._setRequired(h, this.data.required), _ && (h.maxLength = _), h.addEventListener("input", (M) => {
              x.setValue(C, {
                value: M.target.value
              }), this.setPropertyOnSiblings(h, "value", M.target.value, "value"), T.formattedValue = null;
            }), h.addEventListener("resetform", (M) => {
              const N = this.data.defaultFieldValue ?? "";
              h.value = T.userValue = N, T.formattedValue = null;
            });
            let L = (M) => {
              const {
                formattedValue: N
              } = T;
              N != null && (M.target.value = N), M.target.scrollLeft = 0;
            };
            if (this.enableScripting && this.hasJSActions) {
              h.addEventListener("focus", (N) => {
                if (T.focused)
                  return;
                const {
                  target: D
                } = N;
                T.userValue && (D.value = T.userValue), T.lastCommittedValue = D.value, T.commitKey = 1, this.data.actions?.Focus || (T.focused = !0);
              }), h.addEventListener("updatefromsandbox", (N) => {
                this.showElementAndHideCanvas(N.target);
                const D = {
                  value(G) {
                    T.userValue = G.detail.value ?? "", x.setValue(C, {
                      value: T.userValue.toString()
                    }), G.target.value = T.userValue;
                  },
                  formattedValue(G) {
                    const {
                      formattedValue: z
                    } = G.detail;
                    T.formattedValue = z, z != null && G.target !== document.activeElement && (G.target.value = z), x.setValue(C, {
                      formattedValue: z
                    });
                  },
                  selRange(G) {
                    G.target.setSelectionRange(...G.detail.selRange);
                  },
                  charLimit: (G) => {
                    const {
                      charLimit: z
                    } = G.detail, {
                      target: O
                    } = G;
                    if (z === 0) {
                      O.removeAttribute("maxLength");
                      return;
                    }
                    O.setAttribute("maxLength", z);
                    let P = T.userValue;
                    !P || P.length <= z || (P = P.slice(0, z), O.value = T.userValue = P, x.setValue(C, {
                      value: P
                    }), this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
                      source: this,
                      detail: {
                        id: C,
                        name: "Keystroke",
                        value: P,
                        willCommit: !0,
                        commitKey: 1,
                        selStart: O.selectionStart,
                        selEnd: O.selectionEnd
                      }
                    }));
                  }
                };
                this._dispatchEventFromSandbox(D, N);
              }), h.addEventListener("keydown", (N) => {
                T.commitKey = 1;
                let D = -1;
                if (N.key === "Escape" ? D = 0 : N.key === "Enter" && !this.data.multiLine ? D = 2 : N.key === "Tab" && (T.commitKey = 3), D === -1)
                  return;
                const {
                  value: G
                } = N.target;
                T.lastCommittedValue !== G && (T.lastCommittedValue = G, T.userValue = G, this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
                  source: this,
                  detail: {
                    id: C,
                    name: "Keystroke",
                    value: G,
                    willCommit: !0,
                    commitKey: D,
                    selStart: N.target.selectionStart,
                    selEnd: N.target.selectionEnd
                  }
                }));
              });
              const M = L;
              L = null, h.addEventListener("blur", (N) => {
                if (!T.focused || !N.relatedTarget)
                  return;
                this.data.actions?.Blur || (T.focused = !1);
                const {
                  value: D
                } = N.target;
                T.userValue = D, T.lastCommittedValue !== D && this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
                  source: this,
                  detail: {
                    id: C,
                    name: "Keystroke",
                    value: D,
                    willCommit: !0,
                    commitKey: T.commitKey,
                    selStart: N.target.selectionStart,
                    selEnd: N.target.selectionEnd
                  }
                }), M(N);
              }), this.data.actions?.Keystroke && h.addEventListener("beforeinput", (N) => {
                T.lastCommittedValue = null;
                const {
                  data: D,
                  target: G
                } = N, {
                  value: z,
                  selectionStart: O,
                  selectionEnd: P
                } = G;
                let q = O, et = P;
                switch (N.inputType) {
                  case "deleteWordBackward": {
                    const K = z.substring(0, O).match(/\w*[^\w]*$/);
                    K && (q -= K[0].length);
                    break;
                  }
                  case "deleteWordForward": {
                    const K = z.substring(O).match(/^[^\w]*\w*/);
                    K && (et += K[0].length);
                    break;
                  }
                  case "deleteContentBackward":
                    O === P && (q -= 1);
                    break;
                  case "deleteContentForward":
                    O === P && (et += 1);
                    break;
                }
                N.preventDefault(), this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
                  source: this,
                  detail: {
                    id: C,
                    name: "Keystroke",
                    value: z,
                    change: D || "",
                    willCommit: !1,
                    selStart: q,
                    selEnd: et
                  }
                });
              }), this._setEventListeners(h, T, [["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], (N) => N.target.value);
            }
            if (L && h.addEventListener("blur", L), this.data.comb) {
              const N = (this.data.rect[2] - this.data.rect[0]) / _;
              h.classList.add("comb"), h.style.letterSpacing = `calc(${N}px * var(--scale-factor) - 1ch)`;
            }
          } else
            h = document.createElement("div"), h.textContent = this.data.fieldValue, h.style.verticalAlign = "middle", h.style.display = "table-cell", this.data.hasOwnCanvas && (h.hidden = !0);
          return this._setTextStyle(h), this._setBackgroundColor(h), this._setDefaultPropertiesFromJS(h), this.container.append(h), this.container;
        }
      }
      class y extends r {
        constructor(x) {
          super(x, {
            isRenderable: !!x.data.hasOwnCanvas
          });
        }
      }
      class R extends r {
        constructor(x) {
          super(x, {
            isRenderable: x.renderForms
          });
        }
        render() {
          const x = this.annotationStorage, C = this.data, h = C.id;
          let g = x.getValue(h, {
            value: C.exportValue === C.fieldValue
          }).value;
          typeof g == "string" && (g = g !== "Off", x.setValue(h, {
            value: g
          })), this.container.classList.add("buttonWidgetAnnotation", "checkBox");
          const w = document.createElement("input");
          return p.add(w), w.setAttribute("data-element-id", h), w.disabled = C.readOnly, this._setRequired(w, this.data.required), w.type = "checkbox", w.name = C.fieldName, g && w.setAttribute("checked", !0), w.setAttribute("exportValue", C.exportValue), w.tabIndex = c, w.addEventListener("change", (_) => {
            const {
              name: A,
              checked: T
            } = _.target;
            for (const L of this._getElementsByName(A, h)) {
              const M = T && L.exportValue === C.exportValue;
              L.domElement && (L.domElement.checked = M), x.setValue(L.id, {
                value: M
              });
            }
            x.setValue(h, {
              value: T
            });
          }), w.addEventListener("resetform", (_) => {
            const A = C.defaultFieldValue || "Off";
            _.target.checked = A === C.exportValue;
          }), this.enableScripting && this.hasJSActions && (w.addEventListener("updatefromsandbox", (_) => {
            const A = {
              value(T) {
                T.target.checked = T.detail.value !== "Off", x.setValue(h, {
                  value: T.target.checked
                });
              }
            };
            this._dispatchEventFromSandbox(A, _);
          }), this._setEventListeners(w, null, [["change", "Validate"], ["change", "Action"], ["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], (_) => _.target.checked)), this._setBackgroundColor(w), this._setDefaultPropertiesFromJS(w), this.container.append(w), this.container;
        }
      }
      class F extends r {
        constructor(x) {
          super(x, {
            isRenderable: x.renderForms
          });
        }
        render() {
          this.container.classList.add("buttonWidgetAnnotation", "radioButton");
          const x = this.annotationStorage, C = this.data, h = C.id;
          let g = x.getValue(h, {
            value: C.fieldValue === C.buttonValue
          }).value;
          if (typeof g == "string" && (g = g !== C.buttonValue, x.setValue(h, {
            value: g
          })), g)
            for (const _ of this._getElementsByName(C.fieldName, h))
              x.setValue(_.id, {
                value: !1
              });
          const w = document.createElement("input");
          if (p.add(w), w.setAttribute("data-element-id", h), w.disabled = C.readOnly, this._setRequired(w, this.data.required), w.type = "radio", w.name = C.fieldName, g && w.setAttribute("checked", !0), w.tabIndex = c, w.addEventListener("change", (_) => {
            const {
              name: A,
              checked: T
            } = _.target;
            for (const L of this._getElementsByName(A, h))
              x.setValue(L.id, {
                value: !1
              });
            x.setValue(h, {
              value: T
            });
          }), w.addEventListener("resetform", (_) => {
            const A = C.defaultFieldValue;
            _.target.checked = A != null && A === C.buttonValue;
          }), this.enableScripting && this.hasJSActions) {
            const _ = C.buttonValue;
            w.addEventListener("updatefromsandbox", (A) => {
              const T = {
                value: (L) => {
                  const M = _ === L.detail.value;
                  for (const N of this._getElementsByName(L.target.name)) {
                    const D = M && N.id === h;
                    N.domElement && (N.domElement.checked = D), x.setValue(N.id, {
                      value: D
                    });
                  }
                }
              };
              this._dispatchEventFromSandbox(T, A);
            }), this._setEventListeners(w, null, [["change", "Validate"], ["change", "Action"], ["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], (A) => A.target.checked);
          }
          return this._setBackgroundColor(w), this._setDefaultPropertiesFromJS(w), this.container.append(w), this.container;
        }
      }
      class I extends E {
        constructor(x) {
          super(x, {
            ignoreBorder: x.data.hasAppearance
          });
        }
        render() {
          const x = super.render();
          x.classList.add("buttonWidgetAnnotation", "pushButton");
          const C = x.lastChild;
          return this.enableScripting && this.hasJSActions && C && (this._setDefaultPropertiesFromJS(C), C.addEventListener("updatefromsandbox", (h) => {
            this._dispatchEventFromSandbox({}, h);
          })), x;
        }
      }
      class H extends r {
        constructor(x) {
          super(x, {
            isRenderable: x.renderForms
          });
        }
        render() {
          this.container.classList.add("choiceWidgetAnnotation");
          const x = this.annotationStorage, C = this.data.id, h = x.getValue(C, {
            value: this.data.fieldValue
          }), g = document.createElement("select");
          p.add(g), g.setAttribute("data-element-id", C), g.disabled = this.data.readOnly, this._setRequired(g, this.data.required), g.name = this.data.fieldName, g.tabIndex = c;
          let w = this.data.combo && this.data.options.length > 0;
          this.data.combo || (g.size = this.data.options.length, this.data.multiSelect && (g.multiple = !0)), g.addEventListener("resetform", (M) => {
            const N = this.data.defaultFieldValue;
            for (const D of g.options)
              D.selected = D.value === N;
          });
          for (const M of this.data.options) {
            const N = document.createElement("option");
            N.textContent = M.displayValue, N.value = M.exportValue, h.value.includes(M.exportValue) && (N.setAttribute("selected", !0), w = !1), g.append(N);
          }
          let _ = null;
          if (w) {
            const M = document.createElement("option");
            M.value = " ", M.setAttribute("hidden", !0), M.setAttribute("selected", !0), g.prepend(M), _ = () => {
              M.remove(), g.removeEventListener("input", _), _ = null;
            }, g.addEventListener("input", _);
          }
          const A = (M) => {
            const N = M ? "value" : "textContent", {
              options: D,
              multiple: G
            } = g;
            return G ? Array.prototype.filter.call(D, (z) => z.selected).map((z) => z[N]) : D.selectedIndex === -1 ? null : D[D.selectedIndex][N];
          };
          let T = A(!1);
          const L = (M) => {
            const N = M.target.options;
            return Array.prototype.map.call(N, (D) => ({
              displayValue: D.textContent,
              exportValue: D.value
            }));
          };
          return this.enableScripting && this.hasJSActions ? (g.addEventListener("updatefromsandbox", (M) => {
            const N = {
              value(D) {
                _?.();
                const G = D.detail.value, z = new Set(Array.isArray(G) ? G : [G]);
                for (const O of g.options)
                  O.selected = z.has(O.value);
                x.setValue(C, {
                  value: A(!0)
                }), T = A(!1);
              },
              multipleSelection(D) {
                g.multiple = !0;
              },
              remove(D) {
                const G = g.options, z = D.detail.remove;
                G[z].selected = !1, g.remove(z), G.length > 0 && Array.prototype.findIndex.call(G, (P) => P.selected) === -1 && (G[0].selected = !0), x.setValue(C, {
                  value: A(!0),
                  items: L(D)
                }), T = A(!1);
              },
              clear(D) {
                for (; g.length !== 0; )
                  g.remove(0);
                x.setValue(C, {
                  value: null,
                  items: []
                }), T = A(!1);
              },
              insert(D) {
                const {
                  index: G,
                  displayValue: z,
                  exportValue: O
                } = D.detail.insert, P = g.children[G], q = document.createElement("option");
                q.textContent = z, q.value = O, P ? P.before(q) : g.append(q), x.setValue(C, {
                  value: A(!0),
                  items: L(D)
                }), T = A(!1);
              },
              items(D) {
                const {
                  items: G
                } = D.detail;
                for (; g.length !== 0; )
                  g.remove(0);
                for (const z of G) {
                  const {
                    displayValue: O,
                    exportValue: P
                  } = z, q = document.createElement("option");
                  q.textContent = O, q.value = P, g.append(q);
                }
                g.options.length > 0 && (g.options[0].selected = !0), x.setValue(C, {
                  value: A(!0),
                  items: L(D)
                }), T = A(!1);
              },
              indices(D) {
                const G = new Set(D.detail.indices);
                for (const z of D.target.options)
                  z.selected = G.has(z.index);
                x.setValue(C, {
                  value: A(!0)
                }), T = A(!1);
              },
              editable(D) {
                D.target.disabled = !D.detail.editable;
              }
            };
            this._dispatchEventFromSandbox(N, M);
          }), g.addEventListener("input", (M) => {
            const N = A(!0), D = A(!1);
            x.setValue(C, {
              value: N
            }), M.preventDefault(), this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
              source: this,
              detail: {
                id: C,
                name: "Keystroke",
                value: T,
                change: D,
                changeEx: N,
                willCommit: !1,
                commitKey: 1,
                keyDown: !1
              }
            });
          }), this._setEventListeners(g, null, [["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"], ["input", "Action"], ["input", "Validate"]], (M) => M.target.value)) : g.addEventListener("input", function(M) {
            x.setValue(C, {
              value: A(!0)
            });
          }), this.data.combo && this._setTextStyle(g), this._setBackgroundColor(g), this._setDefaultPropertiesFromJS(g), this.container.append(g), this.container;
        }
      }
      class B extends a {
        constructor(x) {
          const {
            data: C,
            elements: h
          } = x;
          super(x, {
            isRenderable: a._hasPopupData(C)
          }), this.elements = h;
        }
        render() {
          this.container.classList.add("popupAnnotation");
          const x = new U({
            container: this.container,
            color: this.data.color,
            titleObj: this.data.titleObj,
            modificationDate: this.data.modificationDate,
            contentsObj: this.data.contentsObj,
            richText: this.data.richText,
            rect: this.data.rect,
            parentRect: this.data.parentRect || null,
            parent: this.parent,
            elements: this.elements,
            open: this.data.open
          }), C = [];
          for (const h of this.elements)
            h.popup = x, C.push(h.data.id), h.addHighlightArea();
          return this.container.setAttribute("aria-controls", C.map((h) => `${e.AnnotationPrefix}${h}`).join(",")), this.container;
        }
      }
      class U {
        #t = this.#m.bind(this);
        #e = this.#C.bind(this);
        #i = this.#w.bind(this);
        #s = this.#v.bind(this);
        #r = null;
        #n = null;
        #a = null;
        #c = null;
        #l = null;
        #d = null;
        #u = null;
        #h = !1;
        #o = null;
        #p = null;
        #g = null;
        #f = null;
        #A = !1;
        constructor({
          container: x,
          color: C,
          elements: h,
          titleObj: g,
          modificationDate: w,
          contentsObj: _,
          richText: A,
          parent: T,
          rect: L,
          parentRect: M,
          open: N
        }) {
          this.#n = x, this.#f = g, this.#a = _, this.#g = A, this.#d = T, this.#r = C, this.#p = L, this.#u = M, this.#l = h, this.#c = u.PDFDateString.toDateObject(w), this.trigger = h.flatMap((D) => D.getElementsToTriggerPopup());
          for (const D of this.trigger)
            D.addEventListener("click", this.#s), D.addEventListener("mouseenter", this.#i), D.addEventListener("mouseleave", this.#e), D.classList.add("popupTriggerArea");
          for (const D of h)
            D.container?.addEventListener("keydown", this.#t);
          this.#n.hidden = !0, N && this.#v();
        }
        render() {
          if (this.#o)
            return;
          const {
            page: {
              view: x
            },
            viewport: {
              rawDims: {
                pageWidth: C,
                pageHeight: h,
                pageX: g,
                pageY: w
              }
            }
          } = this.#d, _ = this.#o = document.createElement("div");
          if (_.className = "popup", this.#r) {
            const K = _.style.outlineColor = e.Util.makeHexColor(...this.#r);
            CSS.supports("background-color", "color-mix(in srgb, red 30%, white)") ? _.style.backgroundColor = `color-mix(in srgb, ${K} 30%, white)` : _.style.backgroundColor = e.Util.makeHexColor(...this.#r.map((ft) => Math.floor(0.7 * (255 - ft) + ft)));
          }
          const A = document.createElement("span");
          A.className = "header";
          const T = document.createElement("h1");
          if (A.append(T), {
            dir: T.dir,
            str: T.textContent
          } = this.#f, _.append(A), this.#c) {
            const K = document.createElement("span");
            K.classList.add("popupDate"), K.setAttribute("data-l10n-id", "pdfjs-annotation-date-string"), K.setAttribute("data-l10n-args", JSON.stringify({
              date: this.#c.toLocaleDateString(),
              time: this.#c.toLocaleTimeString()
            })), A.append(K);
          }
          const L = this.#a, M = this.#g;
          if (M?.str && (!L?.str || L.str === M.str))
            l.XfaLayer.render({
              xfaHtml: M.html,
              intent: "richText",
              div: _
            }), _.lastChild.classList.add("richText", "popupContent");
          else {
            const K = this._formatContents(L);
            _.append(K);
          }
          let N = !!this.#u, D = N ? this.#u : this.#p;
          for (const K of this.#l)
            if (!D || e.Util.intersect(K.data.rect, D) !== null) {
              D = K.data.rect, N = !0;
              break;
            }
          const G = e.Util.normalizeRect([D[0], x[3] - D[1] + x[1], D[2], x[3] - D[3] + x[1]]), O = N ? D[2] - D[0] + 5 : 0, P = G[0] + O, q = G[1], {
            style: et
          } = this.#n;
          et.left = `${100 * (P - g) / C}%`, et.top = `${100 * (q - w) / h}%`, this.#n.append(_);
        }
        _formatContents({
          str: x,
          dir: C
        }) {
          const h = document.createElement("p");
          h.classList.add("popupContent"), h.dir = C;
          const g = x.split(/(?:\r\n?|\n)/);
          for (let w = 0, _ = g.length; w < _; ++w) {
            const A = g[w];
            h.append(document.createTextNode(A)), w < _ - 1 && h.append(document.createElement("br"));
          }
          return h;
        }
        #m(x) {
          x.altKey || x.shiftKey || x.ctrlKey || x.metaKey || (x.key === "Enter" || x.key === "Escape" && this.#h) && this.#v();
        }
        #v() {
          this.#h = !this.#h, this.#h ? (this.#w(), this.#n.addEventListener("click", this.#s), this.#n.addEventListener("keydown", this.#t)) : (this.#C(), this.#n.removeEventListener("click", this.#s), this.#n.removeEventListener("keydown", this.#t));
        }
        #w() {
          this.#o || this.render(), this.isVisible ? this.#h && this.#n.classList.add("focused") : (this.#n.hidden = !1, this.#n.style.zIndex = parseInt(this.#n.style.zIndex) + 1e3);
        }
        #C() {
          this.#n.classList.remove("focused"), !(this.#h || !this.isVisible) && (this.#n.hidden = !0, this.#n.style.zIndex = parseInt(this.#n.style.zIndex) - 1e3);
        }
        forceHide() {
          this.#A = this.isVisible, this.#A && (this.#n.hidden = !0);
        }
        maybeShow() {
          this.#A && (this.#A = !1, this.#n.hidden = !1);
        }
        get isVisible() {
          return this.#n.hidden === !1;
        }
      }
      class X extends a {
        constructor(x) {
          super(x, {
            isRenderable: !0,
            ignoreBorder: !0
          }), this.textContent = x.data.textContent, this.textPosition = x.data.textPosition, this.annotationEditorType = e.AnnotationEditorType.FREETEXT;
        }
        render() {
          if (this.container.classList.add("freeTextAnnotation"), this.textContent) {
            const x = document.createElement("div");
            x.classList.add("annotationTextContent"), x.setAttribute("role", "comment");
            for (const C of this.textContent) {
              const h = document.createElement("span");
              h.textContent = C, x.append(h);
            }
            this.container.append(x);
          }
          return !this.data.popupRef && this.hasPopupData && this._createPopup(), this._editOnDoubleClick(), this.container;
        }
        get _isEditable() {
          return this.data.hasOwnCanvas;
        }
      }
      class Z extends a {
        #t = null;
        constructor(x) {
          super(x, {
            isRenderable: !0,
            ignoreBorder: !0
          });
        }
        render() {
          this.container.classList.add("lineAnnotation");
          const x = this.data, {
            width: C,
            height: h
          } = b(x.rect), g = this.svgFactory.create(C, h, !0), w = this.#t = this.svgFactory.createElement("svg:line");
          return w.setAttribute("x1", x.rect[2] - x.lineCoordinates[0]), w.setAttribute("y1", x.rect[3] - x.lineCoordinates[1]), w.setAttribute("x2", x.rect[2] - x.lineCoordinates[2]), w.setAttribute("y2", x.rect[3] - x.lineCoordinates[3]), w.setAttribute("stroke-width", x.borderStyle.width || 1), w.setAttribute("stroke", "transparent"), w.setAttribute("fill", "transparent"), g.append(w), this.container.append(g), !x.popupRef && this.hasPopupData && this._createPopup(), this.container;
        }
        getElementsToTriggerPopup() {
          return this.#t;
        }
        addHighlightArea() {
          this.container.classList.add("highlightArea");
        }
      }
      class lt extends a {
        #t = null;
        constructor(x) {
          super(x, {
            isRenderable: !0,
            ignoreBorder: !0
          });
        }
        render() {
          this.container.classList.add("squareAnnotation");
          const x = this.data, {
            width: C,
            height: h
          } = b(x.rect), g = this.svgFactory.create(C, h, !0), w = x.borderStyle.width, _ = this.#t = this.svgFactory.createElement("svg:rect");
          return _.setAttribute("x", w / 2), _.setAttribute("y", w / 2), _.setAttribute("width", C - w), _.setAttribute("height", h - w), _.setAttribute("stroke-width", w || 1), _.setAttribute("stroke", "transparent"), _.setAttribute("fill", "transparent"), g.append(_), this.container.append(g), !x.popupRef && this.hasPopupData && this._createPopup(), this.container;
        }
        getElementsToTriggerPopup() {
          return this.#t;
        }
        addHighlightArea() {
          this.container.classList.add("highlightArea");
        }
      }
      class Y extends a {
        #t = null;
        constructor(x) {
          super(x, {
            isRenderable: !0,
            ignoreBorder: !0
          });
        }
        render() {
          this.container.classList.add("circleAnnotation");
          const x = this.data, {
            width: C,
            height: h
          } = b(x.rect), g = this.svgFactory.create(C, h, !0), w = x.borderStyle.width, _ = this.#t = this.svgFactory.createElement("svg:ellipse");
          return _.setAttribute("cx", C / 2), _.setAttribute("cy", h / 2), _.setAttribute("rx", C / 2 - w / 2), _.setAttribute("ry", h / 2 - w / 2), _.setAttribute("stroke-width", w || 1), _.setAttribute("stroke", "transparent"), _.setAttribute("fill", "transparent"), g.append(_), this.container.append(g), !x.popupRef && this.hasPopupData && this._createPopup(), this.container;
        }
        getElementsToTriggerPopup() {
          return this.#t;
        }
        addHighlightArea() {
          this.container.classList.add("highlightArea");
        }
      }
      class V extends a {
        #t = null;
        constructor(x) {
          super(x, {
            isRenderable: !0,
            ignoreBorder: !0
          }), this.containerClassName = "polylineAnnotation", this.svgElementName = "svg:polyline";
        }
        render() {
          this.container.classList.add(this.containerClassName);
          const x = this.data, {
            width: C,
            height: h
          } = b(x.rect), g = this.svgFactory.create(C, h, !0);
          let w = [];
          for (const A of x.vertices) {
            const T = A.x - x.rect[0], L = x.rect[3] - A.y;
            w.push(T + "," + L);
          }
          w = w.join(" ");
          const _ = this.#t = this.svgFactory.createElement(this.svgElementName);
          return _.setAttribute("points", w), _.setAttribute("stroke-width", x.borderStyle.width || 1), _.setAttribute("stroke", "transparent"), _.setAttribute("fill", "transparent"), g.append(_), this.container.append(g), !x.popupRef && this.hasPopupData && this._createPopup(), this.container;
        }
        getElementsToTriggerPopup() {
          return this.#t;
        }
        addHighlightArea() {
          this.container.classList.add("highlightArea");
        }
      }
      class j extends V {
        constructor(x) {
          super(x), this.containerClassName = "polygonAnnotation", this.svgElementName = "svg:polygon";
        }
      }
      class $ extends a {
        constructor(x) {
          super(x, {
            isRenderable: !0,
            ignoreBorder: !0
          });
        }
        render() {
          return this.container.classList.add("caretAnnotation"), !this.data.popupRef && this.hasPopupData && this._createPopup(), this.container;
        }
      }
      class st extends a {
        #t = [];
        constructor(x) {
          super(x, {
            isRenderable: !0,
            ignoreBorder: !0
          }), this.containerClassName = "inkAnnotation", this.svgElementName = "svg:polyline", this.annotationEditorType = e.AnnotationEditorType.INK;
        }
        render() {
          this.container.classList.add(this.containerClassName);
          const x = this.data, {
            width: C,
            height: h
          } = b(x.rect), g = this.svgFactory.create(C, h, !0);
          for (const w of x.inkLists) {
            let _ = [];
            for (const T of w) {
              const L = T.x - x.rect[0], M = x.rect[3] - T.y;
              _.push(`${L},${M}`);
            }
            _ = _.join(" ");
            const A = this.svgFactory.createElement(this.svgElementName);
            this.#t.push(A), A.setAttribute("points", _), A.setAttribute("stroke-width", x.borderStyle.width || 1), A.setAttribute("stroke", "transparent"), A.setAttribute("fill", "transparent"), !x.popupRef && this.hasPopupData && this._createPopup(), g.append(A);
          }
          return this.container.append(g), this.container;
        }
        getElementsToTriggerPopup() {
          return this.#t;
        }
        addHighlightArea() {
          this.container.classList.add("highlightArea");
        }
      }
      class J extends a {
        constructor(x) {
          super(x, {
            isRenderable: !0,
            ignoreBorder: !0,
            createQuadrilaterals: !0
          });
        }
        render() {
          return !this.data.popupRef && this.hasPopupData && this._createPopup(), this.container.classList.add("highlightAnnotation"), this.container;
        }
      }
      class ht extends a {
        constructor(x) {
          super(x, {
            isRenderable: !0,
            ignoreBorder: !0,
            createQuadrilaterals: !0
          });
        }
        render() {
          return !this.data.popupRef && this.hasPopupData && this._createPopup(), this.container.classList.add("underlineAnnotation"), this.container;
        }
      }
      class rt extends a {
        constructor(x) {
          super(x, {
            isRenderable: !0,
            ignoreBorder: !0,
            createQuadrilaterals: !0
          });
        }
        render() {
          return !this.data.popupRef && this.hasPopupData && this._createPopup(), this.container.classList.add("squigglyAnnotation"), this.container;
        }
      }
      class pt extends a {
        constructor(x) {
          super(x, {
            isRenderable: !0,
            ignoreBorder: !0,
            createQuadrilaterals: !0
          });
        }
        render() {
          return !this.data.popupRef && this.hasPopupData && this._createPopup(), this.container.classList.add("strikeoutAnnotation"), this.container;
        }
      }
      class dt extends a {
        constructor(x) {
          super(x, {
            isRenderable: !0,
            ignoreBorder: !0
          });
        }
        render() {
          return this.container.classList.add("stampAnnotation"), !this.data.popupRef && this.hasPopupData && this._createPopup(), this.container;
        }
      }
      class ut extends a {
        #t = null;
        constructor(x) {
          super(x, {
            isRenderable: !0
          });
          const {
            filename: C,
            content: h
          } = this.data.file;
          this.filename = (0, u.getFilenameFromUrl)(C, !0), this.content = h, this.linkService.eventBus?.dispatch("fileattachmentannotation", {
            source: this,
            filename: C,
            content: h
          });
        }
        render() {
          this.container.classList.add("fileAttachmentAnnotation");
          const {
            container: x,
            data: C
          } = this;
          let h;
          C.hasAppearance || C.fillAlpha === 0 ? h = document.createElement("div") : (h = document.createElement("img"), h.src = `${this.imageResourcesPath}annotation-${/paperclip/i.test(C.name) ? "paperclip" : "pushpin"}.svg`, C.fillAlpha && C.fillAlpha < 1 && (h.style = `filter: opacity(${Math.round(C.fillAlpha * 100)}%);`)), h.addEventListener("dblclick", this.#e.bind(this)), this.#t = h;
          const {
            isMac: g
          } = e.FeatureTest.platform;
          return x.addEventListener("keydown", (w) => {
            w.key === "Enter" && (g ? w.metaKey : w.ctrlKey) && this.#e();
          }), !C.popupRef && this.hasPopupData ? this._createPopup() : h.classList.add("popupTriggerArea"), x.append(h), x;
        }
        getElementsToTriggerPopup() {
          return this.#t;
        }
        addHighlightArea() {
          this.container.classList.add("highlightArea");
        }
        #e() {
          this.downloadManager?.openOrDownloadData(this.content, this.filename);
        }
      }
      class Q {
        #t = null;
        #e = null;
        #i = /* @__PURE__ */ new Map();
        constructor({
          div: x,
          accessibilityManager: C,
          annotationCanvasMap: h,
          annotationEditorUIManager: g,
          page: w,
          viewport: _
        }) {
          this.div = x, this.#t = C, this.#e = h, this.page = w, this.viewport = _, this.zIndex = 0, this._annotationEditorUIManager = g;
        }
        #s(x, C) {
          const h = x.firstChild || x;
          h.id = `${e.AnnotationPrefix}${C}`, this.div.append(x), this.#t?.moveElementInDOM(this.div, x, h, !1);
        }
        async render(x) {
          const {
            annotations: C
          } = x, h = this.div;
          (0, u.setLayerDimensions)(h, this.viewport);
          const g = /* @__PURE__ */ new Map(), w = {
            data: null,
            layer: h,
            linkService: x.linkService,
            downloadManager: x.downloadManager,
            imageResourcesPath: x.imageResourcesPath || "",
            renderForms: x.renderForms !== !1,
            svgFactory: new u.DOMSVGFactory(),
            annotationStorage: x.annotationStorage || new f.AnnotationStorage(),
            enableScripting: x.enableScripting === !0,
            hasJSActions: x.hasJSActions,
            fieldObjects: x.fieldObjects,
            parent: this,
            elements: null
          };
          for (const _ of C) {
            if (_.noHTML)
              continue;
            const A = _.annotationType === e.AnnotationType.POPUP;
            if (A) {
              const M = g.get(_.id);
              if (!M)
                continue;
              w.elements = M;
            } else {
              const {
                width: M,
                height: N
              } = b(_.rect);
              if (M <= 0 || N <= 0)
                continue;
            }
            w.data = _;
            const T = S.create(w);
            if (!T.isRenderable)
              continue;
            if (!A && _.popupRef) {
              const M = g.get(_.popupRef);
              M ? M.push(T) : g.set(_.popupRef, [T]);
            }
            const L = T.render();
            _.hidden && (L.style.visibility = "hidden"), this.#s(L, _.id), T.annotationEditorType > 0 && (this.#i.set(T.data.id, T), this._annotationEditorUIManager?.renderAnnotationElement(T));
          }
          this.#r();
        }
        update({
          viewport: x
        }) {
          const C = this.div;
          this.viewport = x, (0, u.setLayerDimensions)(C, {
            rotation: x.rotation
          }), this.#r(), C.hidden = !1;
        }
        #r() {
          if (!this.#e)
            return;
          const x = this.div;
          for (const [C, h] of this.#e) {
            const g = x.querySelector(`[data-annotation-id="${C}"]`);
            if (!g)
              continue;
            h.className = "annotationContent";
            const {
              firstChild: w
            } = g;
            w ? w.nodeName === "CANVAS" ? w.replaceWith(h) : w.classList.contains("annotationContent") ? w.after(h) : w.before(h) : g.append(h);
          }
          this.#e.clear();
        }
        getEditableAnnotations() {
          return Array.from(this.#i.values());
        }
        getEditableAnnotation(x) {
          return this.#i.get(x);
        }
      }
    }
  ),
  /***/
  792: (
    /***/
    (d, t, n) => {
      n.d(t, {
        /* harmony export */
        AnnotationStorage: () => (
          /* binding */
          m
        ),
        /* harmony export */
        PrintAnnotationStorage: () => (
          /* binding */
          o
        ),
        /* harmony export */
        SerializableEmpty: () => (
          /* binding */
          k
        )
        /* harmony export */
      });
      var e = n(292), u = n(310), f = n(651);
      const k = Object.freeze({
        map: null,
        hash: "",
        transfer: void 0
      });
      class m {
        #t = !1;
        #e = /* @__PURE__ */ new Map();
        constructor() {
          this.onSetModified = null, this.onResetModified = null, this.onAnnotationEditor = null;
        }
        getValue(c, s) {
          const p = this.#e.get(c);
          return p === void 0 ? s : Object.assign(s, p);
        }
        getRawValue(c) {
          return this.#e.get(c);
        }
        remove(c) {
          if (this.#e.delete(c), this.#e.size === 0 && this.resetModified(), typeof this.onAnnotationEditor == "function") {
            for (const s of this.#e.values())
              if (s instanceof u.AnnotationEditor)
                return;
            this.onAnnotationEditor(null);
          }
        }
        setValue(c, s) {
          const p = this.#e.get(c);
          let b = !1;
          if (p !== void 0)
            for (const [S, a] of Object.entries(s))
              p[S] !== a && (b = !0, p[S] = a);
          else
            b = !0, this.#e.set(c, s);
          b && this.#i(), s instanceof u.AnnotationEditor && typeof this.onAnnotationEditor == "function" && this.onAnnotationEditor(s.constructor._type);
        }
        has(c) {
          return this.#e.has(c);
        }
        getAll() {
          return this.#e.size > 0 ? (0, e.objectFromMap)(this.#e) : null;
        }
        setAll(c) {
          for (const [s, p] of Object.entries(c))
            this.setValue(s, p);
        }
        get size() {
          return this.#e.size;
        }
        #i() {
          this.#t || (this.#t = !0, typeof this.onSetModified == "function" && this.onSetModified());
        }
        resetModified() {
          this.#t && (this.#t = !1, typeof this.onResetModified == "function" && this.onResetModified());
        }
        get print() {
          return new o(this);
        }
        get serializable() {
          if (this.#e.size === 0)
            return k;
          const c = /* @__PURE__ */ new Map(), s = new f.MurmurHash3_64(), p = [], b = /* @__PURE__ */ Object.create(null);
          let S = !1;
          for (const [a, E] of this.#e) {
            const i = E instanceof u.AnnotationEditor ? E.serialize(!1, b) : E;
            i && (c.set(a, i), s.update(`${a}:${JSON.stringify(i)}`), S ||= !!i.bitmap);
          }
          if (S)
            for (const a of c.values())
              a.bitmap && p.push(a.bitmap);
          return c.size > 0 ? {
            map: c,
            hash: s.hexdigest(),
            transfer: p
          } : k;
        }
        get editorStats() {
          let c = null;
          const s = /* @__PURE__ */ new Map();
          for (const p of this.#e.values()) {
            if (!(p instanceof u.AnnotationEditor))
              continue;
            const b = p.telemetryFinalData;
            if (!b)
              continue;
            const {
              type: S
            } = b;
            s.has(S) || s.set(S, Object.getPrototypeOf(p).constructor), c ||= /* @__PURE__ */ Object.create(null);
            const a = c[S] ||= /* @__PURE__ */ new Map();
            for (const [E, i] of Object.entries(b)) {
              if (E === "type")
                continue;
              let r = a.get(E);
              r || (r = /* @__PURE__ */ new Map(), a.set(E, r));
              const v = r.get(i) ?? 0;
              r.set(i, v + 1);
            }
          }
          for (const [p, b] of s)
            c[p] = b.computeTelemetryFinalData(c[p]);
          return c;
        }
      }
      class o extends m {
        #t;
        constructor(c) {
          super();
          const {
            map: s,
            hash: p,
            transfer: b
          } = c.serializable, S = structuredClone(s, b ? {
            transfer: b
          } : null);
          this.#t = {
            map: S,
            hash: p,
            transfer: b
          };
        }
        get print() {
          (0, e.unreachable)("Should not call PrintAnnotationStorage.print");
        }
        get serializable() {
          return this.#t;
        }
      }
    }
  ),
  /***/
  831: (
    /***/
    (d, t, n) => {
      n.a(d, async (e, u) => {
        try {
          let lt = function(_) {
            if (typeof _ == "string" || _ instanceof URL ? _ = {
              url: _
            } : (_ instanceof ArrayBuffer || ArrayBuffer.isView(_)) && (_ = {
              data: _
            }), typeof _ != "object")
              throw new Error("Invalid parameter in getDocument, need parameter object.");
            if (!_.url && !_.data && !_.range)
              throw new Error("Invalid parameter object: need either .data, .range or .url");
            const A = new st(), {
              docId: T
            } = A, L = _.url ? V(_.url) : null, M = _.data ? j(_.data) : null, N = _.httpHeaders || null, D = _.withCredentials === !0, G = _.password ?? null, z = _.range instanceof J ? _.range : null, O = Number.isInteger(_.rangeChunkSize) && _.rangeChunkSize > 0 ? _.rangeChunkSize : F;
            let P = _.worker instanceof ut ? _.worker : null;
            const q = _.verbosity, et = typeof _.docBaseUrl == "string" && !(0, m.isDataScheme)(_.docBaseUrl) ? _.docBaseUrl : null, K = typeof _.cMapUrl == "string" ? _.cMapUrl : null, tt = _.cMapPacked !== !1, ft = _.CMapReaderFactory || U, at = typeof _.standardFontDataUrl == "string" ? _.standardFontDataUrl : null, nt = _.StandardFontDataFactory || Z, ct = _.stopAtErrors !== !0, mt = Number.isInteger(_.maxImageSize) && _.maxImageSize > -1 ? _.maxImageSize : -1, wt = _.isEvalSupported !== !1, Et = typeof _.isOffscreenCanvasSupported == "boolean" ? _.isOffscreenCanvasSupported : !f.isNodeJS, Tt = Number.isInteger(_.canvasMaxAreaInBytes) ? _.canvasMaxAreaInBytes : -1, _t = typeof _.disableFontFace == "boolean" ? _.disableFontFace : f.isNodeJS, jt = _.fontExtraProperties === !0, Pt = _.enableXfa === !0, Wt = _.ownerDocument || globalThis.document, Rt = _.disableRange === !0, Ht = _.disableStream === !0, ue = _.disableAutoFetch === !0, xt = _.pdfBug === !0, ne = z ? z.length : _.length ?? NaN, hi = typeof _.useSystemFonts == "boolean" ? _.useSystemFonts : !f.isNodeJS && !_t, xe = typeof _.useWorkerFetch == "boolean" ? _.useWorkerFetch : ft === m.DOMCMapReaderFactory && nt === m.DOMStandardFontDataFactory && K && at && (0, m.isValidFetchUrl)(K, document.baseURI) && (0, m.isValidFetchUrl)(at, document.baseURI), Dt = _.canvasFactory || new B({
              ownerDocument: Wt
            }), It = _.filterFactory || new X({
              docId: T,
              ownerDocument: Wt
            }), Ke = null;
            (0, f.setVerbosityLevel)(q);
            const Je = {
              canvasFactory: Dt,
              filterFactory: It
            };
            if (xe || (Je.cMapReaderFactory = new ft({
              baseUrl: K,
              isCompressed: tt
            }), Je.standardFontDataFactory = new nt({
              baseUrl: at
            })), !P) {
              const Qe = {
                verbosity: q,
                port: p.GlobalWorkerOptions.workerPort
              };
              P = Qe.port ? ut.fromPort(Qe) : new ut(Qe), A._worker = P;
            }
            const Le = {
              docId: T,
              apiVersion: "4.2.67",
              data: M,
              password: G,
              disableAutoFetch: ue,
              rangeChunkSize: O,
              length: ne,
              docBaseUrl: et,
              enableXfa: Pt,
              evaluatorOptions: {
                maxImageSize: mt,
                disableFontFace: _t,
                ignoreErrors: ct,
                isEvalSupported: wt,
                isOffscreenCanvasSupported: Et,
                canvasMaxAreaInBytes: Tt,
                fontExtraProperties: jt,
                useSystemFonts: hi,
                cMapUrl: xe ? K : null,
                standardFontDataUrl: xe ? at : null
              }
            }, Mt = {
              ignoreErrors: ct,
              disableFontFace: _t,
              fontExtraProperties: jt,
              enableXfa: Pt,
              ownerDocument: Wt,
              disableAutoFetch: ue,
              pdfBug: xt,
              styleElement: Ke
            };
            return P.promise.then(function() {
              if (A.destroyed)
                throw new Error("Loading aborted");
              const Qe = Y(P, Le), se = new Promise(function(Oe) {
                let He;
                z ? He = new E.PDFDataTransportStream(z, {
                  disableRange: Rt,
                  disableStream: Ht
                }) : M || (He = ((fe) => f.isNodeJS ? function() {
                  return typeof fetch < "u" && typeof Response < "u" && "body" in Response.prototype;
                }() && (0, m.isValidFetchUrl)(fe.url) ? new i.PDFFetchStream(fe) : new v.PDFNodeStream(fe) : (0, m.isValidFetchUrl)(fe.url) ? new i.PDFFetchStream(fe) : new r.PDFNetworkStream(fe))({
                  url: L,
                  length: ne,
                  httpHeaders: N,
                  withCredentials: D,
                  rangeChunkSize: O,
                  disableRange: Rt,
                  disableStream: Ht
                })), Oe(He);
              });
              return Promise.all([Qe, se]).then(function([Oe, He]) {
                if (A.destroyed)
                  throw new Error("Loading aborted");
                const di = new b.MessageHandler(T, Oe, P.port), fe = new Q(di, A, He, Mt, Je);
                A._transport = fe, di.send("Ready", null);
              });
            }).catch(A._capability.reject), A;
          }, V = function(_) {
            if (_ instanceof URL)
              return _.href;
            try {
              return new URL(_, window.location).href;
            } catch {
              if (f.isNodeJS && typeof _ == "string")
                return _;
            }
            throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.");
          }, j = function(_) {
            if (f.isNodeJS && typeof Buffer < "u" && _ instanceof Buffer)
              throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");
            if (_ instanceof Uint8Array && _.byteLength === _.buffer.byteLength)
              return _;
            if (typeof _ == "string")
              return (0, f.stringToBytes)(_);
            if (_ instanceof ArrayBuffer || ArrayBuffer.isView(_) || typeof _ == "object" && !isNaN(_?.length))
              return new Uint8Array(_);
            throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.");
          }, $ = function(_) {
            return typeof _ == "object" && Number.isInteger(_?.num) && _.num >= 0 && Number.isInteger(_?.gen) && _.gen >= 0;
          };
          n.d(t, {
            /* harmony export */
            PDFDataRangeTransport: () => (
              /* binding */
              J
            ),
            /* harmony export */
            PDFWorker: () => (
              /* binding */
              ut
            ),
            /* harmony export */
            build: () => (
              /* binding */
              w
            ),
            /* harmony export */
            getDocument: () => (
              /* binding */
              lt
            ),
            /* harmony export */
            version: () => (
              /* binding */
              g
            )
            /* harmony export */
          });
          var f = n(292), k = n(792), m = n(419), o = n(10), l = n(573), c = n(923), s = n(814), p = n(164), b = n(178), S = n(62), a = n(626), E = n(585), i = n(94), r = n(457), v = n(786), y = n(50), R = e([l, v]);
          [l, v] = R.then ? (await R)() : R;
          const F = 65536, I = 100, H = 5e3, B = f.isNodeJS ? l.NodeCanvasFactory : m.DOMCanvasFactory, U = f.isNodeJS ? l.NodeCMapReaderFactory : m.DOMCMapReaderFactory, X = f.isNodeJS ? l.NodeFilterFactory : m.DOMFilterFactory, Z = f.isNodeJS ? l.NodeStandardFontDataFactory : m.DOMStandardFontDataFactory;
          async function Y(_, A) {
            if (_.destroyed)
              throw new Error("Worker was destroyed");
            const T = await _.messageHandler.sendWithPromise("GetDocRequest", A, A.data ? [A.data.buffer] : null);
            if (_.destroyed)
              throw new Error("Worker was destroyed");
            return T;
          }
          class st {
            static #t = 0;
            constructor() {
              this._capability = Promise.withResolvers(), this._transport = null, this._worker = null, this.docId = `d${st.#t++}`, this.destroyed = !1, this.onPassword = null, this.onProgress = null;
            }
            get promise() {
              return this._capability.promise;
            }
            async destroy() {
              this.destroyed = !0;
              try {
                this._worker?.port && (this._worker._pendingDestroy = !0), await this._transport?.destroy();
              } catch (A) {
                throw this._worker?.port && delete this._worker._pendingDestroy, A;
              }
              this._transport = null, this._worker && (this._worker.destroy(), this._worker = null);
            }
          }
          class J {
            constructor(A, T, L = !1, M = null) {
              this.length = A, this.initialData = T, this.progressiveDone = L, this.contentDispositionFilename = M, this._rangeListeners = [], this._progressListeners = [], this._progressiveReadListeners = [], this._progressiveDoneListeners = [], this._readyCapability = Promise.withResolvers();
            }
            addRangeListener(A) {
              this._rangeListeners.push(A);
            }
            addProgressListener(A) {
              this._progressListeners.push(A);
            }
            addProgressiveReadListener(A) {
              this._progressiveReadListeners.push(A);
            }
            addProgressiveDoneListener(A) {
              this._progressiveDoneListeners.push(A);
            }
            onDataRange(A, T) {
              for (const L of this._rangeListeners)
                L(A, T);
            }
            onDataProgress(A, T) {
              this._readyCapability.promise.then(() => {
                for (const L of this._progressListeners)
                  L(A, T);
              });
            }
            onDataProgressiveRead(A) {
              this._readyCapability.promise.then(() => {
                for (const T of this._progressiveReadListeners)
                  T(A);
              });
            }
            onDataProgressiveDone() {
              this._readyCapability.promise.then(() => {
                for (const A of this._progressiveDoneListeners)
                  A();
              });
            }
            transportReady() {
              this._readyCapability.resolve();
            }
            requestDataRange(A, T) {
              (0, f.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange");
            }
            abort() {
            }
          }
          class ht {
            constructor(A, T) {
              this._pdfInfo = A, this._transport = T;
            }
            get annotationStorage() {
              return this._transport.annotationStorage;
            }
            get filterFactory() {
              return this._transport.filterFactory;
            }
            get numPages() {
              return this._pdfInfo.numPages;
            }
            get fingerprints() {
              return this._pdfInfo.fingerprints;
            }
            get isPureXfa() {
              return (0, f.shadow)(this, "isPureXfa", !!this._transport._htmlForXfa);
            }
            get allXfaHtml() {
              return this._transport._htmlForXfa;
            }
            getPage(A) {
              return this._transport.getPage(A);
            }
            getPageIndex(A) {
              return this._transport.getPageIndex(A);
            }
            getDestinations() {
              return this._transport.getDestinations();
            }
            getDestination(A) {
              return this._transport.getDestination(A);
            }
            getPageLabels() {
              return this._transport.getPageLabels();
            }
            getPageLayout() {
              return this._transport.getPageLayout();
            }
            getPageMode() {
              return this._transport.getPageMode();
            }
            getViewerPreferences() {
              return this._transport.getViewerPreferences();
            }
            getOpenAction() {
              return this._transport.getOpenAction();
            }
            getAttachments() {
              return this._transport.getAttachments();
            }
            getJSActions() {
              return this._transport.getDocJSActions();
            }
            getOutline() {
              return this._transport.getOutline();
            }
            getOptionalContentConfig({
              intent: A = "display"
            } = {}) {
              const {
                renderingIntent: T
              } = this._transport.getRenderingIntent(A);
              return this._transport.getOptionalContentConfig(T);
            }
            getPermissions() {
              return this._transport.getPermissions();
            }
            getMetadata() {
              return this._transport.getMetadata();
            }
            getMarkInfo() {
              return this._transport.getMarkInfo();
            }
            getData() {
              return this._transport.getData();
            }
            saveDocument() {
              return this._transport.saveDocument();
            }
            getDownloadInfo() {
              return this._transport.downloadInfoCapability.promise;
            }
            cleanup(A = !1) {
              return this._transport.startCleanup(A || this.isPureXfa);
            }
            destroy() {
              return this.loadingTask.destroy();
            }
            cachedPageNumber(A) {
              return this._transport.cachedPageNumber(A);
            }
            get loadingParams() {
              return this._transport.loadingParams;
            }
            get loadingTask() {
              return this._transport.loadingTask;
            }
            getFieldObjects() {
              return this._transport.getFieldObjects();
            }
            hasJSActions() {
              return this._transport.hasJSActions();
            }
            getCalculationOrderIds() {
              return this._transport.getCalculationOrderIds();
            }
          }
          class rt {
            #t = null;
            #e = !1;
            constructor(A, T, L, M = !1) {
              this._pageIndex = A, this._pageInfo = T, this._transport = L, this._stats = M ? new m.StatTimer() : null, this._pdfBug = M, this.commonObjs = L.commonObjs, this.objs = new x(), this._maybeCleanupAfterRender = !1, this._intentStates = /* @__PURE__ */ new Map(), this.destroyed = !1;
            }
            get pageNumber() {
              return this._pageIndex + 1;
            }
            get rotate() {
              return this._pageInfo.rotate;
            }
            get ref() {
              return this._pageInfo.ref;
            }
            get userUnit() {
              return this._pageInfo.userUnit;
            }
            get view() {
              return this._pageInfo.view;
            }
            getViewport({
              scale: A,
              rotation: T = this.rotate,
              offsetX: L = 0,
              offsetY: M = 0,
              dontFlip: N = !1
            } = {}) {
              return new m.PageViewport({
                viewBox: this.view,
                scale: A,
                rotation: T,
                offsetX: L,
                offsetY: M,
                dontFlip: N
              });
            }
            getAnnotations({
              intent: A = "display"
            } = {}) {
              const {
                renderingIntent: T
              } = this._transport.getRenderingIntent(A);
              return this._transport.getAnnotations(this._pageIndex, T);
            }
            getJSActions() {
              return this._transport.getPageJSActions(this._pageIndex);
            }
            get filterFactory() {
              return this._transport.filterFactory;
            }
            get isPureXfa() {
              return (0, f.shadow)(this, "isPureXfa", !!this._transport._htmlForXfa);
            }
            async getXfa() {
              return this._transport._htmlForXfa?.children[this._pageIndex] || null;
            }
            render({
              canvasContext: A,
              viewport: T,
              intent: L = "display",
              annotationMode: M = f.AnnotationMode.ENABLE,
              transform: N = null,
              background: D = null,
              optionalContentConfigPromise: G = null,
              annotationCanvasMap: z = null,
              pageColors: O = null,
              printAnnotationStorage: P = null
            }) {
              this._stats?.time("Overall");
              const q = this._transport.getRenderingIntent(L, M, P), {
                renderingIntent: et,
                cacheKey: K
              } = q;
              this.#e = !1, this.#s(), G ||= this._transport.getOptionalContentConfig(et);
              let tt = this._intentStates.get(K);
              tt || (tt = /* @__PURE__ */ Object.create(null), this._intentStates.set(K, tt)), tt.streamReaderCancelTimeout && (clearTimeout(tt.streamReaderCancelTimeout), tt.streamReaderCancelTimeout = null);
              const ft = !!(et & f.RenderingIntentFlag.PRINT);
              tt.displayReadyCapability || (tt.displayReadyCapability = Promise.withResolvers(), tt.operatorList = {
                fnArray: [],
                argsArray: [],
                lastChunk: !1,
                separateAnnots: null
              }, this._stats?.time("Page Request"), this._pumpOperatorList(q));
              const at = (mt) => {
                tt.renderTasks.delete(nt), (this._maybeCleanupAfterRender || ft) && (this.#e = !0), this.#i(!ft), mt ? (nt.capability.reject(mt), this._abortOperatorList({
                  intentState: tt,
                  reason: mt instanceof Error ? mt : new Error(mt)
                })) : nt.capability.resolve(), this._stats?.timeEnd("Rendering"), this._stats?.timeEnd("Overall");
              }, nt = new h({
                callback: at,
                params: {
                  canvasContext: A,
                  viewport: T,
                  transform: N,
                  background: D
                },
                objs: this.objs,
                commonObjs: this.commonObjs,
                annotationCanvasMap: z,
                operatorList: tt.operatorList,
                pageIndex: this._pageIndex,
                canvasFactory: this._transport.canvasFactory,
                filterFactory: this._transport.filterFactory,
                useRequestAnimationFrame: !ft,
                pdfBug: this._pdfBug,
                pageColors: O
              });
              (tt.renderTasks ||= /* @__PURE__ */ new Set()).add(nt);
              const ct = nt.task;
              return Promise.all([tt.displayReadyCapability.promise, G]).then(([mt, wt]) => {
                if (this.destroyed) {
                  at();
                  return;
                }
                if (this._stats?.time("Rendering"), !(wt.renderingIntent & et))
                  throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");
                nt.initializeGraphics({
                  transparency: mt,
                  optionalContentConfig: wt
                }), nt.operatorListChanged();
              }).catch(at), ct;
            }
            getOperatorList({
              intent: A = "display",
              annotationMode: T = f.AnnotationMode.ENABLE,
              printAnnotationStorage: L = null
            } = {}) {
              function M() {
                D.operatorList.lastChunk && (D.opListReadCapability.resolve(D.operatorList), D.renderTasks.delete(G));
              }
              const N = this._transport.getRenderingIntent(A, T, L, !0);
              let D = this._intentStates.get(N.cacheKey);
              D || (D = /* @__PURE__ */ Object.create(null), this._intentStates.set(N.cacheKey, D));
              let G;
              return D.opListReadCapability || (G = /* @__PURE__ */ Object.create(null), G.operatorListChanged = M, D.opListReadCapability = Promise.withResolvers(), (D.renderTasks ||= /* @__PURE__ */ new Set()).add(G), D.operatorList = {
                fnArray: [],
                argsArray: [],
                lastChunk: !1,
                separateAnnots: null
              }, this._stats?.time("Page Request"), this._pumpOperatorList(N)), D.opListReadCapability.promise;
            }
            streamTextContent({
              includeMarkedContent: A = !1,
              disableNormalization: T = !1
            } = {}) {
              return this._transport.messageHandler.sendWithStream("GetTextContent", {
                pageIndex: this._pageIndex,
                includeMarkedContent: A === !0,
                disableNormalization: T === !0
              }, {
                highWaterMark: 100,
                size(M) {
                  return M.items.length;
                }
              });
            }
            getTextContent(A = {}) {
              if (this._transport._htmlForXfa)
                return this.getXfa().then((L) => y.XfaText.textContent(L));
              const T = this.streamTextContent(A);
              return new Promise(function(L, M) {
                function N() {
                  D.read().then(function({
                    value: z,
                    done: O
                  }) {
                    if (O) {
                      L(G);
                      return;
                    }
                    Object.assign(G.styles, z.styles), G.items.push(...z.items), N();
                  }, M);
                }
                const D = T.getReader(), G = {
                  items: [],
                  styles: /* @__PURE__ */ Object.create(null)
                };
                N();
              });
            }
            getStructTree() {
              return this._transport.getStructTree(this._pageIndex);
            }
            _destroy() {
              this.destroyed = !0;
              const A = [];
              for (const T of this._intentStates.values())
                if (this._abortOperatorList({
                  intentState: T,
                  reason: new Error("Page was destroyed."),
                  force: !0
                }), !T.opListReadCapability)
                  for (const L of T.renderTasks)
                    A.push(L.completed), L.cancel();
              return this.objs.clear(), this.#e = !1, this.#s(), Promise.all(A);
            }
            cleanup(A = !1) {
              this.#e = !0;
              const T = this.#i(!1);
              return A && T && (this._stats &&= new m.StatTimer()), T;
            }
            #i(A = !1) {
              if (this.#s(), !this.#e || this.destroyed)
                return !1;
              if (A)
                return this.#t = setTimeout(() => {
                  this.#t = null, this.#i(!1);
                }, H), !1;
              for (const {
                renderTasks: T,
                operatorList: L
              } of this._intentStates.values())
                if (T.size > 0 || !L.lastChunk)
                  return !1;
              return this._intentStates.clear(), this.objs.clear(), this.#e = !1, !0;
            }
            #s() {
              this.#t && (clearTimeout(this.#t), this.#t = null);
            }
            _startRenderPage(A, T) {
              const L = this._intentStates.get(T);
              L && (this._stats?.timeEnd("Page Request"), L.displayReadyCapability?.resolve(A));
            }
            _renderPageChunk(A, T) {
              for (let L = 0, M = A.length; L < M; L++)
                T.operatorList.fnArray.push(A.fnArray[L]), T.operatorList.argsArray.push(A.argsArray[L]);
              T.operatorList.lastChunk = A.lastChunk, T.operatorList.separateAnnots = A.separateAnnots;
              for (const L of T.renderTasks)
                L.operatorListChanged();
              A.lastChunk && this.#i(!0);
            }
            _pumpOperatorList({
              renderingIntent: A,
              cacheKey: T,
              annotationStorageSerializable: L
            }) {
              const {
                map: M,
                transfer: N
              } = L, G = this._transport.messageHandler.sendWithStream("GetOperatorList", {
                pageIndex: this._pageIndex,
                intent: A,
                cacheKey: T,
                annotationStorage: M
              }, N).getReader(), z = this._intentStates.get(T);
              z.streamReader = G;
              const O = () => {
                G.read().then(({
                  value: P,
                  done: q
                }) => {
                  if (q) {
                    z.streamReader = null;
                    return;
                  }
                  this._transport.destroyed || (this._renderPageChunk(P, z), O());
                }, (P) => {
                  if (z.streamReader = null, !this._transport.destroyed) {
                    if (z.operatorList) {
                      z.operatorList.lastChunk = !0;
                      for (const q of z.renderTasks)
                        q.operatorListChanged();
                      this.#i(!0);
                    }
                    if (z.displayReadyCapability)
                      z.displayReadyCapability.reject(P);
                    else if (z.opListReadCapability)
                      z.opListReadCapability.reject(P);
                    else
                      throw P;
                  }
                });
              };
              O();
            }
            _abortOperatorList({
              intentState: A,
              reason: T,
              force: L = !1
            }) {
              if (A.streamReader) {
                if (A.streamReaderCancelTimeout && (clearTimeout(A.streamReaderCancelTimeout), A.streamReaderCancelTimeout = null), !L) {
                  if (A.renderTasks.size > 0)
                    return;
                  if (T instanceof m.RenderingCancelledException) {
                    let M = I;
                    T.extraDelay > 0 && T.extraDelay < 1e3 && (M += T.extraDelay), A.streamReaderCancelTimeout = setTimeout(() => {
                      A.streamReaderCancelTimeout = null, this._abortOperatorList({
                        intentState: A,
                        reason: T,
                        force: !0
                      });
                    }, M);
                    return;
                  }
                }
                if (A.streamReader.cancel(new f.AbortException(T.message)).catch(() => {
                }), A.streamReader = null, !this._transport.destroyed) {
                  for (const [M, N] of this._intentStates)
                    if (N === A) {
                      this._intentStates.delete(M);
                      break;
                    }
                  this.cleanup();
                }
              }
            }
            get stats() {
              return this._stats;
            }
          }
          class pt {
            #t = /* @__PURE__ */ new Set();
            #e = Promise.resolve();
            postMessage(A, T) {
              const L = {
                data: structuredClone(A, T ? {
                  transfer: T
                } : null)
              };
              this.#e.then(() => {
                for (const M of this.#t)
                  M.call(this, L);
              });
            }
            addEventListener(A, T) {
              this.#t.add(T);
            }
            removeEventListener(A, T) {
              this.#t.delete(T);
            }
            terminate() {
              this.#t.clear();
            }
          }
          const dt = {
            isWorkerDisabled: !1,
            fakeWorkerId: 0
          };
          f.isNodeJS && (dt.isWorkerDisabled = !0, p.GlobalWorkerOptions.workerSrc ||= "./pdf.worker.mjs"), dt.isSameOrigin = function(_, A) {
            let T;
            try {
              if (T = new URL(_), !T.origin || T.origin === "null")
                return !1;
            } catch {
              return !1;
            }
            const L = new URL(A, T);
            return T.origin === L.origin;
          }, dt.createCDNWrapper = function(_) {
            const A = `await import("${_}");`;
            return URL.createObjectURL(new Blob([A], {
              type: "text/javascript"
            }));
          };
          class ut {
            static #t;
            constructor({
              name: A = null,
              port: T = null,
              verbosity: L = (0, f.getVerbosityLevel)()
            } = {}) {
              if (this.name = A, this.destroyed = !1, this.verbosity = L, this._readyCapability = Promise.withResolvers(), this._port = null, this._webWorker = null, this._messageHandler = null, T) {
                if (ut.#t?.has(T))
                  throw new Error("Cannot use more than one PDFWorker per port.");
                (ut.#t ||= /* @__PURE__ */ new WeakMap()).set(T, this), this._initializeFromPort(T);
                return;
              }
              this._initialize();
            }
            get promise() {
              return this._readyCapability.promise;
            }
            get port() {
              return this._port;
            }
            get messageHandler() {
              return this._messageHandler;
            }
            _initializeFromPort(A) {
              this._port = A, this._messageHandler = new b.MessageHandler("main", "worker", A), this._messageHandler.on("ready", function() {
              }), this._readyCapability.resolve(), this._messageHandler.send("configure", {
                verbosity: this.verbosity
              });
            }
            _initialize() {
              if (!dt.isWorkerDisabled && !ut.#e) {
                let {
                  workerSrc: A
                } = ut;
                try {
                  dt.isSameOrigin(window.location.href, A) || (A = dt.createCDNWrapper(new URL(A, window.location).href));
                  const T = new Worker(A, {
                    type: "module"
                  }), L = new b.MessageHandler("main", "worker", T), M = () => {
                    T.removeEventListener("error", N), L.destroy(), T.terminate(), this.destroyed ? this._readyCapability.reject(new Error("Worker was destroyed")) : this._setupFakeWorker();
                  }, N = () => {
                    this._webWorker || M();
                  };
                  T.addEventListener("error", N), L.on("test", (G) => {
                    if (T.removeEventListener("error", N), this.destroyed) {
                      M();
                      return;
                    }
                    G ? (this._messageHandler = L, this._port = T, this._webWorker = T, this._readyCapability.resolve(), L.send("configure", {
                      verbosity: this.verbosity
                    })) : (this._setupFakeWorker(), L.destroy(), T.terminate());
                  }), L.on("ready", (G) => {
                    if (T.removeEventListener("error", N), this.destroyed) {
                      M();
                      return;
                    }
                    try {
                      D();
                    } catch {
                      this._setupFakeWorker();
                    }
                  });
                  const D = () => {
                    const G = new Uint8Array();
                    L.send("test", G, [G.buffer]);
                  };
                  D();
                  return;
                } catch {
                  (0, f.info)("The worker has been disabled.");
                }
              }
              this._setupFakeWorker();
            }
            _setupFakeWorker() {
              dt.isWorkerDisabled || ((0, f.warn)("Setting up fake worker."), dt.isWorkerDisabled = !0), ut._setupFakeWorkerGlobal.then((A) => {
                if (this.destroyed) {
                  this._readyCapability.reject(new Error("Worker was destroyed"));
                  return;
                }
                const T = new pt();
                this._port = T;
                const L = `fake${dt.fakeWorkerId++}`, M = new b.MessageHandler(L + "_worker", L, T);
                A.setup(M, T);
                const N = new b.MessageHandler(L, L + "_worker", T);
                this._messageHandler = N, this._readyCapability.resolve(), N.send("configure", {
                  verbosity: this.verbosity
                });
              }).catch((A) => {
                this._readyCapability.reject(new Error(`Setting up fake worker failed: "${A.message}".`));
              });
            }
            destroy() {
              this.destroyed = !0, this._webWorker && (this._webWorker.terminate(), this._webWorker = null), ut.#t?.delete(this._port), this._port = null, this._messageHandler && (this._messageHandler.destroy(), this._messageHandler = null);
            }
            static fromPort(A) {
              if (!A?.port)
                throw new Error("PDFWorker.fromPort - invalid method signature.");
              const T = this.#t?.get(A.port);
              if (T) {
                if (T._pendingDestroy)
                  throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");
                return T;
              }
              return new ut(A);
            }
            static get workerSrc() {
              if (p.GlobalWorkerOptions.workerSrc)
                return p.GlobalWorkerOptions.workerSrc;
              throw new Error('No "GlobalWorkerOptions.workerSrc" specified.');
            }
            static get #e() {
              try {
                return globalThis.pdfjsWorker?.WorkerMessageHandler || null;
              } catch {
                return null;
              }
            }
            static get _setupFakeWorkerGlobal() {
              const A = async () => this.#e ? this.#e : (await import(
                /*webpackIgnore: true*/
                this.workerSrc
              )).WorkerMessageHandler;
              return (0, f.shadow)(this, "_setupFakeWorkerGlobal", A());
            }
          }
          class Q {
            #t = /* @__PURE__ */ new Map();
            #e = /* @__PURE__ */ new Map();
            #i = /* @__PURE__ */ new Map();
            #s = /* @__PURE__ */ new Map();
            #r = null;
            constructor(A, T, L, M, N) {
              this.messageHandler = A, this.loadingTask = T, this.commonObjs = new x(), this.fontLoader = new o.FontLoader({
                ownerDocument: M.ownerDocument,
                styleElement: M.styleElement
              }), this._params = M, this.canvasFactory = N.canvasFactory, this.filterFactory = N.filterFactory, this.cMapReaderFactory = N.cMapReaderFactory, this.standardFontDataFactory = N.standardFontDataFactory, this.destroyed = !1, this.destroyCapability = null, this._networkStream = L, this._fullReader = null, this._lastProgress = null, this.downloadInfoCapability = Promise.withResolvers(), this.setupMessageHandler();
            }
            #n(A, T = null) {
              const L = this.#t.get(A);
              if (L)
                return L;
              const M = this.messageHandler.sendWithPromise(A, T);
              return this.#t.set(A, M), M;
            }
            get annotationStorage() {
              return (0, f.shadow)(this, "annotationStorage", new k.AnnotationStorage());
            }
            getRenderingIntent(A, T = f.AnnotationMode.ENABLE, L = null, M = !1) {
              let N = f.RenderingIntentFlag.DISPLAY, D = k.SerializableEmpty;
              switch (A) {
                case "any":
                  N = f.RenderingIntentFlag.ANY;
                  break;
                case "display":
                  break;
                case "print":
                  N = f.RenderingIntentFlag.PRINT;
                  break;
                default:
                  (0, f.warn)(`getRenderingIntent - invalid intent: ${A}`);
              }
              switch (T) {
                case f.AnnotationMode.DISABLE:
                  N += f.RenderingIntentFlag.ANNOTATIONS_DISABLE;
                  break;
                case f.AnnotationMode.ENABLE:
                  break;
                case f.AnnotationMode.ENABLE_FORMS:
                  N += f.RenderingIntentFlag.ANNOTATIONS_FORMS;
                  break;
                case f.AnnotationMode.ENABLE_STORAGE:
                  N += f.RenderingIntentFlag.ANNOTATIONS_STORAGE, D = (N & f.RenderingIntentFlag.PRINT && L instanceof k.PrintAnnotationStorage ? L : this.annotationStorage).serializable;
                  break;
                default:
                  (0, f.warn)(`getRenderingIntent - invalid annotationMode: ${T}`);
              }
              return M && (N += f.RenderingIntentFlag.OPLIST), {
                renderingIntent: N,
                cacheKey: `${N}_${D.hash}`,
                annotationStorageSerializable: D
              };
            }
            destroy() {
              if (this.destroyCapability)
                return this.destroyCapability.promise;
              this.destroyed = !0, this.destroyCapability = Promise.withResolvers(), this.#r?.reject(new Error("Worker was destroyed during onPassword callback"));
              const A = [];
              for (const L of this.#e.values())
                A.push(L._destroy());
              this.#e.clear(), this.#i.clear(), this.#s.clear(), this.hasOwnProperty("annotationStorage") && this.annotationStorage.resetModified();
              const T = this.messageHandler.sendWithPromise("Terminate", null);
              return A.push(T), Promise.all(A).then(() => {
                this.commonObjs.clear(), this.fontLoader.clear(), this.#t.clear(), this.filterFactory.destroy(), (0, s.cleanupTextLayer)(), this._networkStream?.cancelAllRequests(new f.AbortException("Worker was terminated.")), this.messageHandler && (this.messageHandler.destroy(), this.messageHandler = null), this.destroyCapability.resolve();
              }, this.destroyCapability.reject), this.destroyCapability.promise;
            }
            setupMessageHandler() {
              const {
                messageHandler: A,
                loadingTask: T
              } = this;
              A.on("GetReader", (L, M) => {
                (0, f.assert)(this._networkStream, "GetReader - no `IPDFStream` instance available."), this._fullReader = this._networkStream.getFullReader(), this._fullReader.onProgress = (N) => {
                  this._lastProgress = {
                    loaded: N.loaded,
                    total: N.total
                  };
                }, M.onPull = () => {
                  this._fullReader.read().then(function({
                    value: N,
                    done: D
                  }) {
                    if (D) {
                      M.close();
                      return;
                    }
                    (0, f.assert)(N instanceof ArrayBuffer, "GetReader - expected an ArrayBuffer."), M.enqueue(new Uint8Array(N), 1, [N]);
                  }).catch((N) => {
                    M.error(N);
                  });
                }, M.onCancel = (N) => {
                  this._fullReader.cancel(N), M.ready.catch((D) => {
                    if (!this.destroyed)
                      throw D;
                  });
                };
              }), A.on("ReaderHeadersReady", (L) => {
                const M = Promise.withResolvers(), N = this._fullReader;
                return N.headersReady.then(() => {
                  (!N.isStreamingSupported || !N.isRangeSupported) && (this._lastProgress && T.onProgress?.(this._lastProgress), N.onProgress = (D) => {
                    T.onProgress?.({
                      loaded: D.loaded,
                      total: D.total
                    });
                  }), M.resolve({
                    isStreamingSupported: N.isStreamingSupported,
                    isRangeSupported: N.isRangeSupported,
                    contentLength: N.contentLength
                  });
                }, M.reject), M.promise;
              }), A.on("GetRangeReader", (L, M) => {
                (0, f.assert)(this._networkStream, "GetRangeReader - no `IPDFStream` instance available.");
                const N = this._networkStream.getRangeReader(L.begin, L.end);
                if (!N) {
                  M.close();
                  return;
                }
                M.onPull = () => {
                  N.read().then(function({
                    value: D,
                    done: G
                  }) {
                    if (G) {
                      M.close();
                      return;
                    }
                    (0, f.assert)(D instanceof ArrayBuffer, "GetRangeReader - expected an ArrayBuffer."), M.enqueue(new Uint8Array(D), 1, [D]);
                  }).catch((D) => {
                    M.error(D);
                  });
                }, M.onCancel = (D) => {
                  N.cancel(D), M.ready.catch((G) => {
                    if (!this.destroyed)
                      throw G;
                  });
                };
              }), A.on("GetDoc", ({
                pdfInfo: L
              }) => {
                this._numPages = L.numPages, this._htmlForXfa = L.htmlForXfa, delete L.htmlForXfa, T._capability.resolve(new ht(L, this));
              }), A.on("DocException", function(L) {
                let M;
                switch (L.name) {
                  case "PasswordException":
                    M = new f.PasswordException(L.message, L.code);
                    break;
                  case "InvalidPDFException":
                    M = new f.InvalidPDFException(L.message);
                    break;
                  case "MissingPDFException":
                    M = new f.MissingPDFException(L.message);
                    break;
                  case "UnexpectedResponseException":
                    M = new f.UnexpectedResponseException(L.message, L.status);
                    break;
                  case "UnknownErrorException":
                    M = new f.UnknownErrorException(L.message, L.details);
                    break;
                  default:
                    (0, f.unreachable)("DocException - expected a valid Error.");
                }
                T._capability.reject(M);
              }), A.on("PasswordRequest", (L) => {
                if (this.#r = Promise.withResolvers(), T.onPassword) {
                  const M = (N) => {
                    N instanceof Error ? this.#r.reject(N) : this.#r.resolve({
                      password: N
                    });
                  };
                  try {
                    T.onPassword(M, L.code);
                  } catch (N) {
                    this.#r.reject(N);
                  }
                } else
                  this.#r.reject(new f.PasswordException(L.message, L.code));
                return this.#r.promise;
              }), A.on("DataLoaded", (L) => {
                T.onProgress?.({
                  loaded: L.length,
                  total: L.length
                }), this.downloadInfoCapability.resolve(L);
              }), A.on("StartRenderPage", (L) => {
                if (this.destroyed)
                  return;
                this.#e.get(L.pageIndex)._startRenderPage(L.transparency, L.cacheKey);
              }), A.on("commonobj", ([L, M, N]) => {
                if (this.destroyed || this.commonObjs.has(L))
                  return null;
                switch (M) {
                  case "Font":
                    const D = this._params;
                    if ("error" in N) {
                      const P = N.error;
                      (0, f.warn)(`Error during font loading: ${P}`), this.commonObjs.resolve(L, P);
                      break;
                    }
                    const G = D.pdfBug && globalThis.FontInspector?.enabled ? (P, q) => globalThis.FontInspector.fontAdded(P, q) : null, z = new o.FontFaceObject(N, {
                      disableFontFace: D.disableFontFace,
                      ignoreErrors: D.ignoreErrors,
                      inspectFont: G
                    });
                    this.fontLoader.bind(z).catch(() => A.sendWithPromise("FontFallback", {
                      id: L
                    })).finally(() => {
                      !D.fontExtraProperties && z.data && (z.data = null), this.commonObjs.resolve(L, z);
                    });
                    break;
                  case "CopyLocalImage":
                    const {
                      imageRef: O
                    } = N;
                    (0, f.assert)(O, "The imageRef must be defined.");
                    for (const P of this.#e.values())
                      for (const [, q] of P.objs)
                        if (q.ref === O)
                          return q.dataLen ? (this.commonObjs.resolve(L, structuredClone(q)), q.dataLen) : null;
                    break;
                  case "FontPath":
                  case "Image":
                  case "Pattern":
                    this.commonObjs.resolve(L, N);
                    break;
                  default:
                    throw new Error(`Got unknown common object type ${M}`);
                }
                return null;
              }), A.on("obj", ([L, M, N, D]) => {
                if (this.destroyed)
                  return;
                const G = this.#e.get(M);
                if (!G.objs.has(L)) {
                  if (G._intentStates.size === 0) {
                    D?.bitmap?.close();
                    return;
                  }
                  switch (N) {
                    case "Image":
                      G.objs.resolve(L, D), D?.dataLen > f.MAX_IMAGE_SIZE_TO_CACHE && (G._maybeCleanupAfterRender = !0);
                      break;
                    case "Pattern":
                      G.objs.resolve(L, D);
                      break;
                    default:
                      throw new Error(`Got unknown object type ${N}`);
                  }
                }
              }), A.on("DocProgress", (L) => {
                this.destroyed || T.onProgress?.({
                  loaded: L.loaded,
                  total: L.total
                });
              }), A.on("FetchBuiltInCMap", (L) => this.destroyed ? Promise.reject(new Error("Worker was destroyed.")) : this.cMapReaderFactory ? this.cMapReaderFactory.fetch(L) : Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))), A.on("FetchStandardFontData", (L) => this.destroyed ? Promise.reject(new Error("Worker was destroyed.")) : this.standardFontDataFactory ? this.standardFontDataFactory.fetch(L) : Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")));
            }
            getData() {
              return this.messageHandler.sendWithPromise("GetData", null);
            }
            saveDocument() {
              this.annotationStorage.size <= 0 && (0, f.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");
              const {
                map: A,
                transfer: T
              } = this.annotationStorage.serializable;
              return this.messageHandler.sendWithPromise("SaveDocument", {
                isPureXfa: !!this._htmlForXfa,
                numPages: this._numPages,
                annotationStorage: A,
                filename: this._fullReader?.filename ?? null
              }, T).finally(() => {
                this.annotationStorage.resetModified();
              });
            }
            getPage(A) {
              if (!Number.isInteger(A) || A <= 0 || A > this._numPages)
                return Promise.reject(new Error("Invalid page request."));
              const T = A - 1, L = this.#i.get(T);
              if (L)
                return L;
              const M = this.messageHandler.sendWithPromise("GetPage", {
                pageIndex: T
              }).then((N) => {
                if (this.destroyed)
                  throw new Error("Transport destroyed");
                N.refStr && this.#s.set(N.refStr, A);
                const D = new rt(T, N, this, this._params.pdfBug);
                return this.#e.set(T, D), D;
              });
              return this.#i.set(T, M), M;
            }
            getPageIndex(A) {
              return $(A) ? this.messageHandler.sendWithPromise("GetPageIndex", {
                num: A.num,
                gen: A.gen
              }) : Promise.reject(new Error("Invalid pageIndex request."));
            }
            getAnnotations(A, T) {
              return this.messageHandler.sendWithPromise("GetAnnotations", {
                pageIndex: A,
                intent: T
              });
            }
            getFieldObjects() {
              return this.#n("GetFieldObjects");
            }
            hasJSActions() {
              return this.#n("HasJSActions");
            }
            getCalculationOrderIds() {
              return this.messageHandler.sendWithPromise("GetCalculationOrderIds", null);
            }
            getDestinations() {
              return this.messageHandler.sendWithPromise("GetDestinations", null);
            }
            getDestination(A) {
              return typeof A != "string" ? Promise.reject(new Error("Invalid destination request.")) : this.messageHandler.sendWithPromise("GetDestination", {
                id: A
              });
            }
            getPageLabels() {
              return this.messageHandler.sendWithPromise("GetPageLabels", null);
            }
            getPageLayout() {
              return this.messageHandler.sendWithPromise("GetPageLayout", null);
            }
            getPageMode() {
              return this.messageHandler.sendWithPromise("GetPageMode", null);
            }
            getViewerPreferences() {
              return this.messageHandler.sendWithPromise("GetViewerPreferences", null);
            }
            getOpenAction() {
              return this.messageHandler.sendWithPromise("GetOpenAction", null);
            }
            getAttachments() {
              return this.messageHandler.sendWithPromise("GetAttachments", null);
            }
            getDocJSActions() {
              return this.#n("GetDocJSActions");
            }
            getPageJSActions(A) {
              return this.messageHandler.sendWithPromise("GetPageJSActions", {
                pageIndex: A
              });
            }
            getStructTree(A) {
              return this.messageHandler.sendWithPromise("GetStructTree", {
                pageIndex: A
              });
            }
            getOutline() {
              return this.messageHandler.sendWithPromise("GetOutline", null);
            }
            getOptionalContentConfig(A) {
              return this.#n("GetOptionalContentConfig").then((T) => new a.OptionalContentConfig(T, A));
            }
            getPermissions() {
              return this.messageHandler.sendWithPromise("GetPermissions", null);
            }
            getMetadata() {
              const A = "GetMetadata", T = this.#t.get(A);
              if (T)
                return T;
              const L = this.messageHandler.sendWithPromise(A, null).then((M) => ({
                info: M[0],
                metadata: M[1] ? new S.Metadata(M[1]) : null,
                contentDispositionFilename: this._fullReader?.filename ?? null,
                contentLength: this._fullReader?.contentLength ?? null
              }));
              return this.#t.set(A, L), L;
            }
            getMarkInfo() {
              return this.messageHandler.sendWithPromise("GetMarkInfo", null);
            }
            async startCleanup(A = !1) {
              if (!this.destroyed) {
                await this.messageHandler.sendWithPromise("Cleanup", null);
                for (const T of this.#e.values())
                  if (!T.cleanup())
                    throw new Error(`startCleanup: Page ${T.pageNumber} is currently rendering.`);
                this.commonObjs.clear(), A || this.fontLoader.clear(), this.#t.clear(), this.filterFactory.destroy(!0), (0, s.cleanupTextLayer)();
              }
            }
            cachedPageNumber(A) {
              if (!$(A))
                return null;
              const T = A.gen === 0 ? `${A.num}R` : `${A.num}R${A.gen}`;
              return this.#s.get(T) ?? null;
            }
            get loadingParams() {
              const {
                disableAutoFetch: A,
                enableXfa: T
              } = this._params;
              return (0, f.shadow)(this, "loadingParams", {
                disableAutoFetch: A,
                enableXfa: T
              });
            }
          }
          const it = Symbol("INITIAL_DATA");
          class x {
            #t = /* @__PURE__ */ Object.create(null);
            #e(A) {
              return this.#t[A] ||= {
                ...Promise.withResolvers(),
                data: it
              };
            }
            get(A, T = null) {
              if (T) {
                const M = this.#e(A);
                return M.promise.then(() => T(M.data)), null;
              }
              const L = this.#t[A];
              if (!L || L.data === it)
                throw new Error(`Requesting object that isn't resolved yet ${A}.`);
              return L.data;
            }
            has(A) {
              const T = this.#t[A];
              return !!T && T.data !== it;
            }
            resolve(A, T = null) {
              const L = this.#e(A);
              L.data = T, L.resolve();
            }
            clear() {
              for (const A in this.#t) {
                const {
                  data: T
                } = this.#t[A];
                T?.bitmap?.close();
              }
              this.#t = /* @__PURE__ */ Object.create(null);
            }
            *[Symbol.iterator]() {
              for (const A in this.#t) {
                const {
                  data: T
                } = this.#t[A];
                T !== it && (yield [A, T]);
              }
            }
          }
          class C {
            #t = null;
            constructor(A) {
              this.#t = A, this.onContinue = null;
            }
            get promise() {
              return this.#t.capability.promise;
            }
            cancel(A = 0) {
              this.#t.cancel(null, A);
            }
            get separateAnnots() {
              const {
                separateAnnots: A
              } = this.#t.operatorList;
              if (!A)
                return !1;
              const {
                annotationCanvasMap: T
              } = this.#t;
              return A.form || A.canvas && T?.size > 0;
            }
          }
          class h {
            static #t = /* @__PURE__ */ new WeakSet();
            constructor({
              callback: A,
              params: T,
              objs: L,
              commonObjs: M,
              annotationCanvasMap: N,
              operatorList: D,
              pageIndex: G,
              canvasFactory: z,
              filterFactory: O,
              useRequestAnimationFrame: P = !1,
              pdfBug: q = !1,
              pageColors: et = null
            }) {
              this.callback = A, this.params = T, this.objs = L, this.commonObjs = M, this.annotationCanvasMap = N, this.operatorListIdx = null, this.operatorList = D, this._pageIndex = G, this.canvasFactory = z, this.filterFactory = O, this._pdfBug = q, this.pageColors = et, this.running = !1, this.graphicsReadyCallback = null, this.graphicsReady = !1, this._useRequestAnimationFrame = P === !0 && typeof window < "u", this.cancelled = !1, this.capability = Promise.withResolvers(), this.task = new C(this), this._cancelBound = this.cancel.bind(this), this._continueBound = this._continue.bind(this), this._scheduleNextBound = this._scheduleNext.bind(this), this._nextBound = this._next.bind(this), this._canvas = T.canvasContext.canvas;
            }
            get completed() {
              return this.capability.promise.catch(function() {
              });
            }
            initializeGraphics({
              transparency: A = !1,
              optionalContentConfig: T
            }) {
              if (this.cancelled)
                return;
              if (this._canvas) {
                if (h.#t.has(this._canvas))
                  throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");
                h.#t.add(this._canvas);
              }
              this._pdfBug && globalThis.StepperManager?.enabled && (this.stepper = globalThis.StepperManager.create(this._pageIndex), this.stepper.init(this.operatorList), this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint());
              const {
                canvasContext: L,
                viewport: M,
                transform: N,
                background: D
              } = this.params;
              this.gfx = new c.CanvasGraphics(L, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, {
                optionalContentConfig: T
              }, this.annotationCanvasMap, this.pageColors), this.gfx.beginDrawing({
                transform: N,
                viewport: M,
                transparency: A,
                background: D
              }), this.operatorListIdx = 0, this.graphicsReady = !0, this.graphicsReadyCallback?.();
            }
            cancel(A = null, T = 0) {
              this.running = !1, this.cancelled = !0, this.gfx?.endDrawing(), h.#t.delete(this._canvas), this.callback(A || new m.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex + 1}`, T));
            }
            operatorListChanged() {
              if (!this.graphicsReady) {
                this.graphicsReadyCallback ||= this._continueBound;
                return;
              }
              this.stepper?.updateOperatorList(this.operatorList), !this.running && this._continue();
            }
            _continue() {
              this.running = !0, !this.cancelled && (this.task.onContinue ? this.task.onContinue(this._scheduleNextBound) : this._scheduleNext());
            }
            _scheduleNext() {
              this._useRequestAnimationFrame ? window.requestAnimationFrame(() => {
                this._nextBound().catch(this._cancelBound);
              }) : Promise.resolve().then(this._nextBound).catch(this._cancelBound);
            }
            async _next() {
              this.cancelled || (this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList, this.operatorListIdx, this._continueBound, this.stepper), this.operatorListIdx === this.operatorList.argsArray.length && (this.running = !1, this.operatorList.lastChunk && (this.gfx.endDrawing(), h.#t.delete(this._canvas), this.callback())));
            }
          }
          const g = "4.2.67", w = "49b388101";
          u();
        } catch (F) {
          u(F);
        }
      });
    }
  ),
  /***/
  583: (
    /***/
    (d, t, n) => {
      n.d(t, {
        /* harmony export */
        BaseCMapReaderFactory: () => (
          /* binding */
          k
        ),
        /* harmony export */
        BaseCanvasFactory: () => (
          /* binding */
          f
        ),
        /* harmony export */
        BaseFilterFactory: () => (
          /* binding */
          u
        ),
        /* harmony export */
        BaseSVGFactory: () => (
          /* binding */
          o
        ),
        /* harmony export */
        BaseStandardFontDataFactory: () => (
          /* binding */
          m
        )
        /* harmony export */
      });
      var e = n(292);
      class u {
        constructor() {
          this.constructor === u && (0, e.unreachable)("Cannot initialize BaseFilterFactory.");
        }
        addFilter(c) {
          return "none";
        }
        addHCMFilter(c, s) {
          return "none";
        }
        addHighlightHCMFilter(c, s, p, b, S) {
          return "none";
        }
        destroy(c = !1) {
        }
      }
      class f {
        constructor() {
          this.constructor === f && (0, e.unreachable)("Cannot initialize BaseCanvasFactory.");
        }
        create(c, s) {
          if (c <= 0 || s <= 0)
            throw new Error("Invalid canvas size");
          const p = this._createCanvas(c, s);
          return {
            canvas: p,
            context: p.getContext("2d")
          };
        }
        reset(c, s, p) {
          if (!c.canvas)
            throw new Error("Canvas is not specified");
          if (s <= 0 || p <= 0)
            throw new Error("Invalid canvas size");
          c.canvas.width = s, c.canvas.height = p;
        }
        destroy(c) {
          if (!c.canvas)
            throw new Error("Canvas is not specified");
          c.canvas.width = 0, c.canvas.height = 0, c.canvas = null, c.context = null;
        }
        _createCanvas(c, s) {
          (0, e.unreachable)("Abstract method `_createCanvas` called.");
        }
      }
      class k {
        constructor({
          baseUrl: c = null,
          isCompressed: s = !0
        }) {
          this.constructor === k && (0, e.unreachable)("Cannot initialize BaseCMapReaderFactory."), this.baseUrl = c, this.isCompressed = s;
        }
        async fetch({
          name: c
        }) {
          if (!this.baseUrl)
            throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');
          if (!c)
            throw new Error("CMap name must be specified.");
          const s = this.baseUrl + c + (this.isCompressed ? ".bcmap" : ""), p = this.isCompressed ? e.CMapCompressionType.BINARY : e.CMapCompressionType.NONE;
          return this._fetchData(s, p).catch((b) => {
            throw new Error(`Unable to load ${this.isCompressed ? "binary " : ""}CMap at: ${s}`);
          });
        }
        _fetchData(c, s) {
          (0, e.unreachable)("Abstract method `_fetchData` called.");
        }
      }
      class m {
        constructor({
          baseUrl: c = null
        }) {
          this.constructor === m && (0, e.unreachable)("Cannot initialize BaseStandardFontDataFactory."), this.baseUrl = c;
        }
        async fetch({
          filename: c
        }) {
          if (!this.baseUrl)
            throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');
          if (!c)
            throw new Error("Font filename must be specified.");
          const s = `${this.baseUrl}${c}`;
          return this._fetchData(s).catch((p) => {
            throw new Error(`Unable to load font data at: ${s}`);
          });
        }
        _fetchData(c) {
          (0, e.unreachable)("Abstract method `_fetchData` called.");
        }
      }
      class o {
        constructor() {
          this.constructor === o && (0, e.unreachable)("Cannot initialize BaseSVGFactory.");
        }
        create(c, s, p = !1) {
          if (c <= 0 || s <= 0)
            throw new Error("Invalid SVG dimensions");
          const b = this._createSVG("svg:svg");
          return b.setAttribute("version", "1.1"), p || (b.setAttribute("width", `${c}px`), b.setAttribute("height", `${s}px`)), b.setAttribute("preserveAspectRatio", "none"), b.setAttribute("viewBox", `0 0 ${c} ${s}`), b;
        }
        createElement(c) {
          if (typeof c != "string")
            throw new Error("Invalid SVG element type");
          return this._createSVG(c);
        }
        _createSVG(c) {
          (0, e.unreachable)("Abstract method `_createSVG` called.");
        }
      }
    }
  ),
  /***/
  923: (
    /***/
    (d, t, n) => {
      n.d(t, {
        CanvasGraphics: () => (
          /* binding */
          x
        )
      });
      var e = n(292), u = n(419);
      const f = {
        FILL: "Fill",
        STROKE: "Stroke",
        SHADING: "Shading"
      };
      function k(C, h) {
        if (!h)
          return;
        const g = h[2] - h[0], w = h[3] - h[1], _ = new Path2D();
        _.rect(h[0], h[1], g, w), C.clip(_);
      }
      class m {
        constructor() {
          this.constructor === m && (0, e.unreachable)("Cannot initialize BaseShadingPattern.");
        }
        getPattern() {
          (0, e.unreachable)("Abstract method `getPattern` called.");
        }
      }
      class o extends m {
        constructor(h) {
          super(), this._type = h[1], this._bbox = h[2], this._colorStops = h[3], this._p0 = h[4], this._p1 = h[5], this._r0 = h[6], this._r1 = h[7], this.matrix = null;
        }
        _createGradient(h) {
          let g;
          this._type === "axial" ? g = h.createLinearGradient(this._p0[0], this._p0[1], this._p1[0], this._p1[1]) : this._type === "radial" && (g = h.createRadialGradient(this._p0[0], this._p0[1], this._r0, this._p1[0], this._p1[1], this._r1));
          for (const w of this._colorStops)
            g.addColorStop(w[0], w[1]);
          return g;
        }
        getPattern(h, g, w, _) {
          let A;
          if (_ === f.STROKE || _ === f.FILL) {
            const T = g.current.getClippedPathBoundingBox(_, (0, u.getCurrentTransform)(h)) || [0, 0, 0, 0], L = Math.ceil(T[2] - T[0]) || 1, M = Math.ceil(T[3] - T[1]) || 1, N = g.cachedCanvases.getCanvas("pattern", L, M, !0), D = N.context;
            D.clearRect(0, 0, D.canvas.width, D.canvas.height), D.beginPath(), D.rect(0, 0, D.canvas.width, D.canvas.height), D.translate(-T[0], -T[1]), w = e.Util.transform(w, [1, 0, 0, 1, T[0], T[1]]), D.transform(...g.baseTransform), this.matrix && D.transform(...this.matrix), k(D, this._bbox), D.fillStyle = this._createGradient(D), D.fill(), A = h.createPattern(N.canvas, "no-repeat");
            const G = new DOMMatrix(w);
            A.setTransform(G);
          } else
            k(h, this._bbox), A = this._createGradient(h);
          return A;
        }
      }
      function l(C, h, g, w, _, A, T, L) {
        const M = h.coords, N = h.colors, D = C.data, G = C.width * 4;
        let z;
        M[g + 1] > M[w + 1] && (z = g, g = w, w = z, z = A, A = T, T = z), M[w + 1] > M[_ + 1] && (z = w, w = _, _ = z, z = T, T = L, L = z), M[g + 1] > M[w + 1] && (z = g, g = w, w = z, z = A, A = T, T = z);
        const O = (M[g] + h.offsetX) * h.scaleX, P = (M[g + 1] + h.offsetY) * h.scaleY, q = (M[w] + h.offsetX) * h.scaleX, et = (M[w + 1] + h.offsetY) * h.scaleY, K = (M[_] + h.offsetX) * h.scaleX, tt = (M[_ + 1] + h.offsetY) * h.scaleY;
        if (P >= tt)
          return;
        const ft = N[A], at = N[A + 1], nt = N[A + 2], ct = N[T], mt = N[T + 1], wt = N[T + 2], Et = N[L], Tt = N[L + 1], _t = N[L + 2], jt = Math.round(P), Pt = Math.round(tt);
        let Wt, Rt, Ht, ue, xt, ne, hi, xe;
        for (let Dt = jt; Dt <= Pt; Dt++) {
          if (Dt < et) {
            const Mt = Dt < P ? 0 : (P - Dt) / (P - et);
            Wt = O - (O - q) * Mt, Rt = ft - (ft - ct) * Mt, Ht = at - (at - mt) * Mt, ue = nt - (nt - wt) * Mt;
          } else {
            let Mt;
            Dt > tt ? Mt = 1 : et === tt ? Mt = 0 : Mt = (et - Dt) / (et - tt), Wt = q - (q - K) * Mt, Rt = ct - (ct - Et) * Mt, Ht = mt - (mt - Tt) * Mt, ue = wt - (wt - _t) * Mt;
          }
          let It;
          Dt < P ? It = 0 : Dt > tt ? It = 1 : It = (P - Dt) / (P - tt), xt = O - (O - K) * It, ne = ft - (ft - Et) * It, hi = at - (at - Tt) * It, xe = nt - (nt - _t) * It;
          const Ke = Math.round(Math.min(Wt, xt)), Je = Math.round(Math.max(Wt, xt));
          let Le = G * Dt + Ke * 4;
          for (let Mt = Ke; Mt <= Je; Mt++)
            It = (Wt - Mt) / (Wt - xt), It < 0 ? It = 0 : It > 1 && (It = 1), D[Le++] = Rt - (Rt - ne) * It | 0, D[Le++] = Ht - (Ht - hi) * It | 0, D[Le++] = ue - (ue - xe) * It | 0, D[Le++] = 255;
        }
      }
      function c(C, h, g) {
        const w = h.coords, _ = h.colors;
        let A, T;
        switch (h.type) {
          case "lattice":
            const L = h.verticesPerRow, M = Math.floor(w.length / L) - 1, N = L - 1;
            for (A = 0; A < M; A++) {
              let D = A * L;
              for (let G = 0; G < N; G++, D++)
                l(C, g, w[D], w[D + 1], w[D + L], _[D], _[D + 1], _[D + L]), l(C, g, w[D + L + 1], w[D + 1], w[D + L], _[D + L + 1], _[D + 1], _[D + L]);
            }
            break;
          case "triangles":
            for (A = 0, T = w.length; A < T; A += 3)
              l(C, g, w[A], w[A + 1], w[A + 2], _[A], _[A + 1], _[A + 2]);
            break;
          default:
            throw new Error("illegal figure");
        }
      }
      class s extends m {
        constructor(h) {
          super(), this._coords = h[2], this._colors = h[3], this._figures = h[4], this._bounds = h[5], this._bbox = h[7], this._background = h[8], this.matrix = null;
        }
        _createMeshCanvas(h, g, w) {
          const L = Math.floor(this._bounds[0]), M = Math.floor(this._bounds[1]), N = Math.ceil(this._bounds[2]) - L, D = Math.ceil(this._bounds[3]) - M, G = Math.min(Math.ceil(Math.abs(N * h[0] * 1.1)), 3e3), z = Math.min(Math.ceil(Math.abs(D * h[1] * 1.1)), 3e3), O = N / G, P = D / z, q = {
            coords: this._coords,
            colors: this._colors,
            offsetX: -L,
            offsetY: -M,
            scaleX: 1 / O,
            scaleY: 1 / P
          }, et = G + 2 * 2, K = z + 2 * 2, tt = w.getCanvas("mesh", et, K, !1), ft = tt.context, at = ft.createImageData(G, z);
          if (g) {
            const ct = at.data;
            for (let mt = 0, wt = ct.length; mt < wt; mt += 4)
              ct[mt] = g[0], ct[mt + 1] = g[1], ct[mt + 2] = g[2], ct[mt + 3] = 255;
          }
          for (const ct of this._figures)
            c(at, ct, q);
          return ft.putImageData(at, 2, 2), {
            canvas: tt.canvas,
            offsetX: L - 2 * O,
            offsetY: M - 2 * P,
            scaleX: O,
            scaleY: P
          };
        }
        getPattern(h, g, w, _) {
          k(h, this._bbox);
          let A;
          if (_ === f.SHADING)
            A = e.Util.singularValueDecompose2dScale((0, u.getCurrentTransform)(h));
          else if (A = e.Util.singularValueDecompose2dScale(g.baseTransform), this.matrix) {
            const L = e.Util.singularValueDecompose2dScale(this.matrix);
            A = [A[0] * L[0], A[1] * L[1]];
          }
          const T = this._createMeshCanvas(A, _ === f.SHADING ? null : this._background, g.cachedCanvases);
          return _ !== f.SHADING && (h.setTransform(...g.baseTransform), this.matrix && h.transform(...this.matrix)), h.translate(T.offsetX, T.offsetY), h.scale(T.scaleX, T.scaleY), h.createPattern(T.canvas, "no-repeat");
        }
      }
      class p extends m {
        getPattern() {
          return "hotpink";
        }
      }
      function b(C) {
        switch (C[0]) {
          case "RadialAxial":
            return new o(C);
          case "Mesh":
            return new s(C);
          case "Dummy":
            return new p();
        }
        throw new Error(`Unknown IR type: ${C[0]}`);
      }
      const S = {
        COLORED: 1,
        UNCOLORED: 2
      };
      class a {
        static MAX_PATTERN_SIZE = 3e3;
        constructor(h, g, w, _, A) {
          this.operatorList = h[2], this.matrix = h[3] || [1, 0, 0, 1, 0, 0], this.bbox = h[4], this.xstep = h[5], this.ystep = h[6], this.paintType = h[7], this.tilingType = h[8], this.color = g, this.ctx = w, this.canvasGraphicsFactory = _, this.baseTransform = A;
        }
        createPatternCanvas(h) {
          const g = this.operatorList, w = this.bbox, _ = this.xstep, A = this.ystep, T = this.paintType, L = this.tilingType, M = this.color, N = this.canvasGraphicsFactory;
          (0, e.info)("TilingType: " + L);
          const D = w[0], G = w[1], z = w[2], O = w[3], P = e.Util.singularValueDecompose2dScale(this.matrix), q = e.Util.singularValueDecompose2dScale(this.baseTransform), et = [P[0] * q[0], P[1] * q[1]], K = this.getSizeAndScale(_, this.ctx.canvas.width, et[0]), tt = this.getSizeAndScale(A, this.ctx.canvas.height, et[1]), ft = h.cachedCanvases.getCanvas("pattern", K.size, tt.size, !0), at = ft.context, nt = N.createCanvasGraphics(at);
          nt.groupLevel = h.groupLevel, this.setFillAndStrokeStyleToContext(nt, T, M);
          let ct = D, mt = G, wt = z, Et = O;
          return D < 0 && (ct = 0, wt += Math.abs(D)), G < 0 && (mt = 0, Et += Math.abs(G)), at.translate(-(K.scale * ct), -(tt.scale * mt)), nt.transform(K.scale, 0, 0, tt.scale, 0, 0), at.save(), this.clipBbox(nt, ct, mt, wt, Et), nt.baseTransform = (0, u.getCurrentTransform)(nt.ctx), nt.executeOperatorList(g), nt.endDrawing(), {
            canvas: ft.canvas,
            scaleX: K.scale,
            scaleY: tt.scale,
            offsetX: ct,
            offsetY: mt
          };
        }
        getSizeAndScale(h, g, w) {
          h = Math.abs(h);
          const _ = Math.max(a.MAX_PATTERN_SIZE, g);
          let A = Math.ceil(h * w);
          return A >= _ ? A = _ : w = A / h, {
            scale: w,
            size: A
          };
        }
        clipBbox(h, g, w, _, A) {
          const T = _ - g, L = A - w;
          h.ctx.rect(g, w, T, L), h.current.updateRectMinMax((0, u.getCurrentTransform)(h.ctx), [g, w, _, A]), h.clip(), h.endPath();
        }
        setFillAndStrokeStyleToContext(h, g, w) {
          const _ = h.ctx, A = h.current;
          switch (g) {
            case S.COLORED:
              const T = this.ctx;
              _.fillStyle = T.fillStyle, _.strokeStyle = T.strokeStyle, A.fillColor = T.fillStyle, A.strokeColor = T.strokeStyle;
              break;
            case S.UNCOLORED:
              const L = e.Util.makeHexColor(w[0], w[1], w[2]);
              _.fillStyle = L, _.strokeStyle = L, A.fillColor = L, A.strokeColor = L;
              break;
            default:
              throw new e.FormatError(`Unsupported paint type: ${g}`);
          }
        }
        getPattern(h, g, w, _) {
          let A = w;
          _ !== f.SHADING && (A = e.Util.transform(A, g.baseTransform), this.matrix && (A = e.Util.transform(A, this.matrix)));
          const T = this.createPatternCanvas(g);
          let L = new DOMMatrix(A);
          L = L.translate(T.offsetX, T.offsetY), L = L.scale(1 / T.scaleX, 1 / T.scaleY);
          const M = h.createPattern(T.canvas, "repeat");
          return M.setTransform(L), M;
        }
      }
      function E({
        src: C,
        srcPos: h = 0,
        dest: g,
        width: w,
        height: _,
        nonBlackColor: A = 4294967295,
        inverseDecode: T = !1
      }) {
        const L = e.FeatureTest.isLittleEndian ? 4278190080 : 255, [M, N] = T ? [A, L] : [L, A], D = w >> 3, G = w & 7, z = C.length;
        g = new Uint32Array(g.buffer);
        let O = 0;
        for (let P = 0; P < _; P++) {
          for (const et = h + D; h < et; h++) {
            const K = h < z ? C[h] : 255;
            g[O++] = K & 128 ? N : M, g[O++] = K & 64 ? N : M, g[O++] = K & 32 ? N : M, g[O++] = K & 16 ? N : M, g[O++] = K & 8 ? N : M, g[O++] = K & 4 ? N : M, g[O++] = K & 2 ? N : M, g[O++] = K & 1 ? N : M;
          }
          if (G === 0)
            continue;
          const q = h < z ? C[h++] : 255;
          for (let et = 0; et < G; et++)
            g[O++] = q & 1 << 7 - et ? N : M;
        }
        return {
          srcPos: h,
          destPos: O
        };
      }
      const i = 16, r = 100, v = 4096, y = 15, R = 10, F = 1e3, I = 16;
      function H(C, h) {
        if (C._removeMirroring)
          throw new Error("Context is already forwarding operations.");
        C.__originalSave = C.save, C.__originalRestore = C.restore, C.__originalRotate = C.rotate, C.__originalScale = C.scale, C.__originalTranslate = C.translate, C.__originalTransform = C.transform, C.__originalSetTransform = C.setTransform, C.__originalResetTransform = C.resetTransform, C.__originalClip = C.clip, C.__originalMoveTo = C.moveTo, C.__originalLineTo = C.lineTo, C.__originalBezierCurveTo = C.bezierCurveTo, C.__originalRect = C.rect, C.__originalClosePath = C.closePath, C.__originalBeginPath = C.beginPath, C._removeMirroring = () => {
          C.save = C.__originalSave, C.restore = C.__originalRestore, C.rotate = C.__originalRotate, C.scale = C.__originalScale, C.translate = C.__originalTranslate, C.transform = C.__originalTransform, C.setTransform = C.__originalSetTransform, C.resetTransform = C.__originalResetTransform, C.clip = C.__originalClip, C.moveTo = C.__originalMoveTo, C.lineTo = C.__originalLineTo, C.bezierCurveTo = C.__originalBezierCurveTo, C.rect = C.__originalRect, C.closePath = C.__originalClosePath, C.beginPath = C.__originalBeginPath, delete C._removeMirroring;
        }, C.save = function() {
          h.save(), this.__originalSave();
        }, C.restore = function() {
          h.restore(), this.__originalRestore();
        }, C.translate = function(w, _) {
          h.translate(w, _), this.__originalTranslate(w, _);
        }, C.scale = function(w, _) {
          h.scale(w, _), this.__originalScale(w, _);
        }, C.transform = function(w, _, A, T, L, M) {
          h.transform(w, _, A, T, L, M), this.__originalTransform(w, _, A, T, L, M);
        }, C.setTransform = function(w, _, A, T, L, M) {
          h.setTransform(w, _, A, T, L, M), this.__originalSetTransform(w, _, A, T, L, M);
        }, C.resetTransform = function() {
          h.resetTransform(), this.__originalResetTransform();
        }, C.rotate = function(w) {
          h.rotate(w), this.__originalRotate(w);
        }, C.clip = function(w) {
          h.clip(w), this.__originalClip(w);
        }, C.moveTo = function(g, w) {
          h.moveTo(g, w), this.__originalMoveTo(g, w);
        }, C.lineTo = function(g, w) {
          h.lineTo(g, w), this.__originalLineTo(g, w);
        }, C.bezierCurveTo = function(g, w, _, A, T, L) {
          h.bezierCurveTo(g, w, _, A, T, L), this.__originalBezierCurveTo(g, w, _, A, T, L);
        }, C.rect = function(g, w, _, A) {
          h.rect(g, w, _, A), this.__originalRect(g, w, _, A);
        }, C.closePath = function() {
          h.closePath(), this.__originalClosePath();
        }, C.beginPath = function() {
          h.beginPath(), this.__originalBeginPath();
        };
      }
      class B {
        constructor(h) {
          this.canvasFactory = h, this.cache = /* @__PURE__ */ Object.create(null);
        }
        getCanvas(h, g, w) {
          let _;
          return this.cache[h] !== void 0 ? (_ = this.cache[h], this.canvasFactory.reset(_, g, w)) : (_ = this.canvasFactory.create(g, w), this.cache[h] = _), _;
        }
        delete(h) {
          delete this.cache[h];
        }
        clear() {
          for (const h in this.cache) {
            const g = this.cache[h];
            this.canvasFactory.destroy(g), delete this.cache[h];
          }
        }
      }
      function U(C, h, g, w, _, A, T, L, M, N) {
        const [D, G, z, O, P, q] = (0, u.getCurrentTransform)(C);
        if (G === 0 && z === 0) {
          const tt = T * D + P, ft = Math.round(tt), at = L * O + q, nt = Math.round(at), ct = (T + M) * D + P, mt = Math.abs(Math.round(ct) - ft) || 1, wt = (L + N) * O + q, Et = Math.abs(Math.round(wt) - nt) || 1;
          return C.setTransform(Math.sign(D), 0, 0, Math.sign(O), ft, nt), C.drawImage(h, g, w, _, A, 0, 0, mt, Et), C.setTransform(D, G, z, O, P, q), [mt, Et];
        }
        if (D === 0 && O === 0) {
          const tt = L * z + P, ft = Math.round(tt), at = T * G + q, nt = Math.round(at), ct = (L + N) * z + P, mt = Math.abs(Math.round(ct) - ft) || 1, wt = (T + M) * G + q, Et = Math.abs(Math.round(wt) - nt) || 1;
          return C.setTransform(0, Math.sign(G), Math.sign(z), 0, ft, nt), C.drawImage(h, g, w, _, A, 0, 0, Et, mt), C.setTransform(D, G, z, O, P, q), [Et, mt];
        }
        C.drawImage(h, g, w, _, A, T, L, M, N);
        const et = Math.hypot(D, G), K = Math.hypot(z, O);
        return [et * M, K * N];
      }
      function X(C) {
        const {
          width: h,
          height: g
        } = C;
        if (h > F || g > F)
          return null;
        const w = 1e3, _ = new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]), A = h + 1;
        let T = new Uint8Array(A * (g + 1)), L, M, N;
        const D = h + 7 & -8;
        let G = new Uint8Array(D * g), z = 0;
        for (const K of C.data) {
          let tt = 128;
          for (; tt > 0; )
            G[z++] = K & tt ? 0 : 255, tt >>= 1;
        }
        let O = 0;
        for (z = 0, G[z] !== 0 && (T[0] = 1, ++O), M = 1; M < h; M++)
          G[z] !== G[z + 1] && (T[M] = G[z] ? 2 : 1, ++O), z++;
        for (G[z] !== 0 && (T[M] = 2, ++O), L = 1; L < g; L++) {
          z = L * D, N = L * A, G[z - D] !== G[z] && (T[N] = G[z] ? 1 : 8, ++O);
          let K = (G[z] ? 4 : 0) + (G[z - D] ? 8 : 0);
          for (M = 1; M < h; M++)
            K = (K >> 2) + (G[z + 1] ? 4 : 0) + (G[z - D + 1] ? 8 : 0), _[K] && (T[N + M] = _[K], ++O), z++;
          if (G[z - D] !== G[z] && (T[N + M] = G[z] ? 2 : 4, ++O), O > w)
            return null;
        }
        for (z = D * (g - 1), N = L * A, G[z] !== 0 && (T[N] = 8, ++O), M = 1; M < h; M++)
          G[z] !== G[z + 1] && (T[N + M] = G[z] ? 4 : 8, ++O), z++;
        if (G[z] !== 0 && (T[N + M] = 4, ++O), O > w)
          return null;
        const P = new Int32Array([0, A, -1, 0, -A, 0, 0, 0, 1]), q = new Path2D();
        for (L = 0; O && L <= g; L++) {
          let K = L * A;
          const tt = K + h;
          for (; K < tt && !T[K]; )
            K++;
          if (K === tt)
            continue;
          q.moveTo(K % A, L);
          const ft = K;
          let at = T[K];
          do {
            const nt = P[at];
            do
              K += nt;
            while (!T[K]);
            const ct = T[K];
            ct !== 5 && ct !== 10 ? (at = ct, T[K] = 0) : (at = ct & 51 * at >> 4, T[K] &= at >> 2 | at << 2), q.lineTo(K % A, K / A | 0), T[K] || --O;
          } while (ft !== K);
          --L;
        }
        return G = null, T = null, function(K) {
          K.save(), K.scale(1 / h, -1 / g), K.translate(0, -g), K.fill(q), K.beginPath(), K.restore();
        };
      }
      class Z {
        constructor(h, g) {
          this.alphaIsShape = !1, this.fontSize = 0, this.fontSizeScale = 1, this.textMatrix = e.IDENTITY_MATRIX, this.textMatrixScale = 1, this.fontMatrix = e.FONT_IDENTITY_MATRIX, this.leading = 0, this.x = 0, this.y = 0, this.lineX = 0, this.lineY = 0, this.charSpacing = 0, this.wordSpacing = 0, this.textHScale = 1, this.textRenderingMode = e.TextRenderingMode.FILL, this.textRise = 0, this.fillColor = "#000000", this.strokeColor = "#000000", this.patternFill = !1, this.fillAlpha = 1, this.strokeAlpha = 1, this.lineWidth = 1, this.activeSMask = null, this.transferMaps = "none", this.startNewPathAndClipBox([0, 0, h, g]);
        }
        clone() {
          const h = Object.create(this);
          return h.clipBox = this.clipBox.slice(), h;
        }
        setCurrentPoint(h, g) {
          this.x = h, this.y = g;
        }
        updatePathMinMax(h, g, w) {
          [g, w] = e.Util.applyTransform([g, w], h), this.minX = Math.min(this.minX, g), this.minY = Math.min(this.minY, w), this.maxX = Math.max(this.maxX, g), this.maxY = Math.max(this.maxY, w);
        }
        updateRectMinMax(h, g) {
          const w = e.Util.applyTransform(g, h), _ = e.Util.applyTransform(g.slice(2), h), A = e.Util.applyTransform([g[0], g[3]], h), T = e.Util.applyTransform([g[2], g[1]], h);
          this.minX = Math.min(this.minX, w[0], _[0], A[0], T[0]), this.minY = Math.min(this.minY, w[1], _[1], A[1], T[1]), this.maxX = Math.max(this.maxX, w[0], _[0], A[0], T[0]), this.maxY = Math.max(this.maxY, w[1], _[1], A[1], T[1]);
        }
        updateScalingPathMinMax(h, g) {
          e.Util.scaleMinMax(h, g), this.minX = Math.min(this.minX, g[0]), this.minY = Math.min(this.minY, g[1]), this.maxX = Math.max(this.maxX, g[2]), this.maxY = Math.max(this.maxY, g[3]);
        }
        updateCurvePathMinMax(h, g, w, _, A, T, L, M, N, D) {
          const G = e.Util.bezierBoundingBox(g, w, _, A, T, L, M, N, D);
          D || this.updateRectMinMax(h, G);
        }
        getPathBoundingBox(h = f.FILL, g = null) {
          const w = [this.minX, this.minY, this.maxX, this.maxY];
          if (h === f.STROKE) {
            g || (0, e.unreachable)("Stroke bounding box must include transform.");
            const _ = e.Util.singularValueDecompose2dScale(g), A = _[0] * this.lineWidth / 2, T = _[1] * this.lineWidth / 2;
            w[0] -= A, w[1] -= T, w[2] += A, w[3] += T;
          }
          return w;
        }
        updateClipFromPath() {
          const h = e.Util.intersect(this.clipBox, this.getPathBoundingBox());
          this.startNewPathAndClipBox(h || [0, 0, 0, 0]);
        }
        isEmptyClip() {
          return this.minX === 1 / 0;
        }
        startNewPathAndClipBox(h) {
          this.clipBox = h, this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = 0, this.maxY = 0;
        }
        getClippedPathBoundingBox(h = f.FILL, g = null) {
          return e.Util.intersect(this.clipBox, this.getPathBoundingBox(h, g));
        }
      }
      function lt(C, h) {
        if (typeof ImageData < "u" && h instanceof ImageData) {
          C.putImageData(h, 0, 0);
          return;
        }
        const g = h.height, w = h.width, _ = g % I, A = (g - _) / I, T = _ === 0 ? A : A + 1, L = C.createImageData(w, I);
        let M = 0, N;
        const D = h.data, G = L.data;
        let z, O, P, q;
        if (h.kind === e.ImageKind.GRAYSCALE_1BPP) {
          const et = D.byteLength, K = new Uint32Array(G.buffer, 0, G.byteLength >> 2), tt = K.length, ft = w + 7 >> 3, at = 4294967295, nt = e.FeatureTest.isLittleEndian ? 4278190080 : 255;
          for (z = 0; z < T; z++) {
            for (P = z < A ? I : _, N = 0, O = 0; O < P; O++) {
              const ct = et - M;
              let mt = 0;
              const wt = ct > ft ? w : ct * 8 - 7, Et = wt & -8;
              let Tt = 0, _t = 0;
              for (; mt < Et; mt += 8)
                _t = D[M++], K[N++] = _t & 128 ? at : nt, K[N++] = _t & 64 ? at : nt, K[N++] = _t & 32 ? at : nt, K[N++] = _t & 16 ? at : nt, K[N++] = _t & 8 ? at : nt, K[N++] = _t & 4 ? at : nt, K[N++] = _t & 2 ? at : nt, K[N++] = _t & 1 ? at : nt;
              for (; mt < wt; mt++)
                Tt === 0 && (_t = D[M++], Tt = 128), K[N++] = _t & Tt ? at : nt, Tt >>= 1;
            }
            for (; N < tt; )
              K[N++] = 0;
            C.putImageData(L, 0, z * I);
          }
        } else if (h.kind === e.ImageKind.RGBA_32BPP) {
          for (O = 0, q = w * I * 4, z = 0; z < A; z++)
            G.set(D.subarray(M, M + q)), M += q, C.putImageData(L, 0, O), O += I;
          z < T && (q = w * _ * 4, G.set(D.subarray(M, M + q)), C.putImageData(L, 0, O));
        } else if (h.kind === e.ImageKind.RGB_24BPP)
          for (P = I, q = w * P, z = 0; z < T; z++) {
            for (z >= A && (P = _, q = w * P), N = 0, O = q; O--; )
              G[N++] = D[M++], G[N++] = D[M++], G[N++] = D[M++], G[N++] = 255;
            C.putImageData(L, 0, z * I);
          }
        else
          throw new Error(`bad image kind: ${h.kind}`);
      }
      function Y(C, h) {
        if (h.bitmap) {
          C.drawImage(h.bitmap, 0, 0);
          return;
        }
        const g = h.height, w = h.width, _ = g % I, A = (g - _) / I, T = _ === 0 ? A : A + 1, L = C.createImageData(w, I);
        let M = 0;
        const N = h.data, D = L.data;
        for (let G = 0; G < T; G++) {
          const z = G < A ? I : _;
          ({
            srcPos: M
          } = E({
            src: N,
            srcPos: M,
            dest: D,
            width: w,
            height: z,
            nonBlackColor: 0
          })), C.putImageData(L, 0, G * I);
        }
      }
      function V(C, h) {
        const g = ["strokeStyle", "fillStyle", "fillRule", "globalAlpha", "lineWidth", "lineCap", "lineJoin", "miterLimit", "globalCompositeOperation", "font", "filter"];
        for (const w of g)
          C[w] !== void 0 && (h[w] = C[w]);
        C.setLineDash !== void 0 && (h.setLineDash(C.getLineDash()), h.lineDashOffset = C.lineDashOffset);
      }
      function j(C) {
        if (C.strokeStyle = C.fillStyle = "#000000", C.fillRule = "nonzero", C.globalAlpha = 1, C.lineWidth = 1, C.lineCap = "butt", C.lineJoin = "miter", C.miterLimit = 10, C.globalCompositeOperation = "source-over", C.font = "10px sans-serif", C.setLineDash !== void 0 && (C.setLineDash([]), C.lineDashOffset = 0), !e.isNodeJS) {
          const {
            filter: h
          } = C;
          h !== "none" && h !== "" && (C.filter = "none");
        }
      }
      function $(C, h, g, w) {
        const _ = C.length;
        for (let A = 3; A < _; A += 4) {
          const T = C[A];
          if (T === 0)
            C[A - 3] = h, C[A - 2] = g, C[A - 1] = w;
          else if (T < 255) {
            const L = 255 - T;
            C[A - 3] = C[A - 3] * T + h * L >> 8, C[A - 2] = C[A - 2] * T + g * L >> 8, C[A - 1] = C[A - 1] * T + w * L >> 8;
          }
        }
      }
      function st(C, h, g) {
        const w = C.length, _ = 1 / 255;
        for (let A = 3; A < w; A += 4) {
          const T = g ? g[C[A]] : C[A];
          h[A] = h[A] * T * _ | 0;
        }
      }
      function J(C, h, g) {
        const w = C.length;
        for (let _ = 3; _ < w; _ += 4) {
          const A = C[_ - 3] * 77 + C[_ - 2] * 152 + C[_ - 1] * 28;
          h[_] = g ? h[_] * g[A >> 8] >> 8 : h[_] * A >> 16;
        }
      }
      function ht(C, h, g, w, _, A, T, L, M, N, D) {
        const G = !!A, z = G ? A[0] : 0, O = G ? A[1] : 0, P = G ? A[2] : 0, q = _ === "Luminosity" ? J : st, K = Math.min(w, Math.ceil(1048576 / g));
        for (let tt = 0; tt < w; tt += K) {
          const ft = Math.min(K, w - tt), at = C.getImageData(L - N, tt + (M - D), g, ft), nt = h.getImageData(L, tt + M, g, ft);
          G && $(at.data, z, O, P), q(at.data, nt.data, T), h.putImageData(nt, L, tt + M);
        }
      }
      function rt(C, h, g, w) {
        const _ = w[0], A = w[1], T = w[2] - _, L = w[3] - A;
        T === 0 || L === 0 || (ht(h.context, g, T, L, h.subtype, h.backdrop, h.transferMap, _, A, h.offsetX, h.offsetY), C.save(), C.globalAlpha = 1, C.globalCompositeOperation = "source-over", C.setTransform(1, 0, 0, 1, 0, 0), C.drawImage(g.canvas, 0, 0), C.restore());
      }
      function pt(C, h) {
        if (h)
          return !0;
        const g = e.Util.singularValueDecompose2dScale(C);
        g[0] = Math.fround(g[0]), g[1] = Math.fround(g[1]);
        const w = Math.fround((globalThis.devicePixelRatio || 1) * u.PixelsPerInch.PDF_TO_CSS_UNITS);
        return g[0] <= w && g[1] <= w;
      }
      const dt = ["butt", "round", "square"], ut = ["miter", "round", "bevel"], Q = {}, it = {};
      class x {
        constructor(h, g, w, _, A, {
          optionalContentConfig: T,
          markedContentStack: L = null
        }, M, N) {
          this.ctx = h, this.current = new Z(this.ctx.canvas.width, this.ctx.canvas.height), this.stateStack = [], this.pendingClip = null, this.pendingEOFill = !1, this.res = null, this.xobjs = null, this.commonObjs = g, this.objs = w, this.canvasFactory = _, this.filterFactory = A, this.groupStack = [], this.processingType3 = null, this.baseTransform = null, this.baseTransformStack = [], this.groupLevel = 0, this.smaskStack = [], this.smaskCounter = 0, this.tempSMask = null, this.suspendedCtx = null, this.contentVisible = !0, this.markedContentStack = L || [], this.optionalContentConfig = T, this.cachedCanvases = new B(this.canvasFactory), this.cachedPatterns = /* @__PURE__ */ new Map(), this.annotationCanvasMap = M, this.viewportScale = 1, this.outputScaleX = 1, this.outputScaleY = 1, this.pageColors = N, this._cachedScaleForStroking = [-1, 0], this._cachedGetSinglePixelWidth = null, this._cachedBitmapsMap = /* @__PURE__ */ new Map();
        }
        getObject(h, g = null) {
          return typeof h == "string" ? h.startsWith("g_") ? this.commonObjs.get(h) : this.objs.get(h) : g;
        }
        beginDrawing({
          transform: h,
          viewport: g,
          transparency: w = !1,
          background: _ = null
        }) {
          const A = this.ctx.canvas.width, T = this.ctx.canvas.height, L = this.ctx.fillStyle;
          if (this.ctx.fillStyle = _ || "#ffffff", this.ctx.fillRect(0, 0, A, T), this.ctx.fillStyle = L, w) {
            const M = this.cachedCanvases.getCanvas("transparent", A, T);
            this.compositeCtx = this.ctx, this.transparentCanvas = M.canvas, this.ctx = M.context, this.ctx.save(), this.ctx.transform(...(0, u.getCurrentTransform)(this.compositeCtx));
          }
          this.ctx.save(), j(this.ctx), h && (this.ctx.transform(...h), this.outputScaleX = h[0], this.outputScaleY = h[0]), this.ctx.transform(...g.transform), this.viewportScale = g.scale, this.baseTransform = (0, u.getCurrentTransform)(this.ctx);
        }
        executeOperatorList(h, g, w, _) {
          const A = h.argsArray, T = h.fnArray;
          let L = g || 0;
          const M = A.length;
          if (M === L)
            return L;
          const N = M - L > R && typeof w == "function", D = N ? Date.now() + y : 0;
          let G = 0;
          const z = this.commonObjs, O = this.objs;
          let P;
          for (; ; ) {
            if (_ !== void 0 && L === _.nextBreakPoint)
              return _.breakIt(L, w), L;
            if (P = T[L], P !== e.OPS.dependency)
              this[P].apply(this, A[L]);
            else
              for (const q of A[L]) {
                const et = q.startsWith("g_") ? z : O;
                if (!et.has(q))
                  return et.get(q, w), L;
              }
            if (L++, L === M)
              return L;
            if (N && ++G > R) {
              if (Date.now() > D)
                return w(), L;
              G = 0;
            }
          }
        }
        #t() {
          for (; this.stateStack.length || this.inSMaskMode; )
            this.restore();
          this.ctx.restore(), this.transparentCanvas && (this.ctx = this.compositeCtx, this.ctx.save(), this.ctx.setTransform(1, 0, 0, 1, 0, 0), this.ctx.drawImage(this.transparentCanvas, 0, 0), this.ctx.restore(), this.transparentCanvas = null);
        }
        endDrawing() {
          this.#t(), this.cachedCanvases.clear(), this.cachedPatterns.clear();
          for (const h of this._cachedBitmapsMap.values()) {
            for (const g of h.values())
              typeof HTMLCanvasElement < "u" && g instanceof HTMLCanvasElement && (g.width = g.height = 0);
            h.clear();
          }
          this._cachedBitmapsMap.clear(), this.#e();
        }
        #e() {
          if (this.pageColors) {
            const h = this.filterFactory.addHCMFilter(this.pageColors.foreground, this.pageColors.background);
            if (h !== "none") {
              const g = this.ctx.filter;
              this.ctx.filter = h, this.ctx.drawImage(this.ctx.canvas, 0, 0), this.ctx.filter = g;
            }
          }
        }
        _scaleImage(h, g) {
          const w = h.width, _ = h.height;
          let A = Math.max(Math.hypot(g[0], g[1]), 1), T = Math.max(Math.hypot(g[2], g[3]), 1), L = w, M = _, N = "prescale1", D, G;
          for (; A > 2 && L > 1 || T > 2 && M > 1; ) {
            let z = L, O = M;
            A > 2 && L > 1 && (z = L >= 16384 ? Math.floor(L / 2) - 1 || 1 : Math.ceil(L / 2), A /= L / z), T > 2 && M > 1 && (O = M >= 16384 ? Math.floor(M / 2) - 1 || 1 : Math.ceil(M) / 2, T /= M / O), D = this.cachedCanvases.getCanvas(N, z, O), G = D.context, G.clearRect(0, 0, z, O), G.drawImage(h, 0, 0, L, M, 0, 0, z, O), h = D.canvas, L = z, M = O, N = N === "prescale1" ? "prescale2" : "prescale1";
          }
          return {
            img: h,
            paintWidth: L,
            paintHeight: M
          };
        }
        _createMaskCanvas(h) {
          const g = this.ctx, {
            width: w,
            height: _
          } = h, A = this.current.fillColor, T = this.current.patternFill, L = (0, u.getCurrentTransform)(g);
          let M, N, D, G;
          if ((h.bitmap || h.data) && h.count > 1) {
            const wt = h.bitmap || h.data.buffer;
            N = JSON.stringify(T ? L : [L.slice(0, 4), A]), M = this._cachedBitmapsMap.get(wt), M || (M = /* @__PURE__ */ new Map(), this._cachedBitmapsMap.set(wt, M));
            const Et = M.get(N);
            if (Et && !T) {
              const Tt = Math.round(Math.min(L[0], L[2]) + L[4]), _t = Math.round(Math.min(L[1], L[3]) + L[5]);
              return {
                canvas: Et,
                offsetX: Tt,
                offsetY: _t
              };
            }
            D = Et;
          }
          D || (G = this.cachedCanvases.getCanvas("maskCanvas", w, _), Y(G.context, h));
          let z = e.Util.transform(L, [1 / w, 0, 0, -1 / _, 0, 0]);
          z = e.Util.transform(z, [1, 0, 0, 1, 0, -_]);
          const [O, P, q, et] = e.Util.getAxialAlignedBoundingBox([0, 0, w, _], z), K = Math.round(q - O) || 1, tt = Math.round(et - P) || 1, ft = this.cachedCanvases.getCanvas("fillCanvas", K, tt), at = ft.context, nt = O, ct = P;
          at.translate(-nt, -ct), at.transform(...z), D || (D = this._scaleImage(G.canvas, (0, u.getCurrentTransformInverse)(at)), D = D.img, M && T && M.set(N, D)), at.imageSmoothingEnabled = pt((0, u.getCurrentTransform)(at), h.interpolate), U(at, D, 0, 0, D.width, D.height, 0, 0, w, _), at.globalCompositeOperation = "source-in";
          const mt = e.Util.transform((0, u.getCurrentTransformInverse)(at), [1, 0, 0, 1, -nt, -ct]);
          return at.fillStyle = T ? A.getPattern(g, this, mt, f.FILL) : A, at.fillRect(0, 0, w, _), M && !T && (this.cachedCanvases.delete("fillCanvas"), M.set(N, ft.canvas)), {
            canvas: ft.canvas,
            offsetX: Math.round(nt),
            offsetY: Math.round(ct)
          };
        }
        setLineWidth(h) {
          h !== this.current.lineWidth && (this._cachedScaleForStroking[0] = -1), this.current.lineWidth = h, this.ctx.lineWidth = h;
        }
        setLineCap(h) {
          this.ctx.lineCap = dt[h];
        }
        setLineJoin(h) {
          this.ctx.lineJoin = ut[h];
        }
        setMiterLimit(h) {
          this.ctx.miterLimit = h;
        }
        setDash(h, g) {
          const w = this.ctx;
          w.setLineDash !== void 0 && (w.setLineDash(h), w.lineDashOffset = g);
        }
        setRenderingIntent(h) {
        }
        setFlatness(h) {
        }
        setGState(h) {
          for (const [g, w] of h)
            switch (g) {
              case "LW":
                this.setLineWidth(w);
                break;
              case "LC":
                this.setLineCap(w);
                break;
              case "LJ":
                this.setLineJoin(w);
                break;
              case "ML":
                this.setMiterLimit(w);
                break;
              case "D":
                this.setDash(w[0], w[1]);
                break;
              case "RI":
                this.setRenderingIntent(w);
                break;
              case "FL":
                this.setFlatness(w);
                break;
              case "Font":
                this.setFont(w[0], w[1]);
                break;
              case "CA":
                this.current.strokeAlpha = w;
                break;
              case "ca":
                this.current.fillAlpha = w, this.ctx.globalAlpha = w;
                break;
              case "BM":
                this.ctx.globalCompositeOperation = w;
                break;
              case "SMask":
                this.current.activeSMask = w ? this.tempSMask : null, this.tempSMask = null, this.checkSMaskState();
                break;
              case "TR":
                this.ctx.filter = this.current.transferMaps = this.filterFactory.addFilter(w);
                break;
            }
        }
        get inSMaskMode() {
          return !!this.suspendedCtx;
        }
        checkSMaskState() {
          const h = this.inSMaskMode;
          this.current.activeSMask && !h ? this.beginSMaskMode() : !this.current.activeSMask && h && this.endSMaskMode();
        }
        beginSMaskMode() {
          if (this.inSMaskMode)
            throw new Error("beginSMaskMode called while already in smask mode");
          const h = this.ctx.canvas.width, g = this.ctx.canvas.height, w = "smaskGroupAt" + this.groupLevel, _ = this.cachedCanvases.getCanvas(w, h, g);
          this.suspendedCtx = this.ctx, this.ctx = _.context;
          const A = this.ctx;
          A.setTransform(...(0, u.getCurrentTransform)(this.suspendedCtx)), V(this.suspendedCtx, A), H(A, this.suspendedCtx), this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]);
        }
        endSMaskMode() {
          if (!this.inSMaskMode)
            throw new Error("endSMaskMode called while not in smask mode");
          this.ctx._removeMirroring(), V(this.ctx, this.suspendedCtx), this.ctx = this.suspendedCtx, this.suspendedCtx = null;
        }
        compose(h) {
          if (!this.current.activeSMask)
            return;
          h ? (h[0] = Math.floor(h[0]), h[1] = Math.floor(h[1]), h[2] = Math.ceil(h[2]), h[3] = Math.ceil(h[3])) : h = [0, 0, this.ctx.canvas.width, this.ctx.canvas.height];
          const g = this.current.activeSMask, w = this.suspendedCtx;
          rt(w, g, this.ctx, h), this.ctx.save(), this.ctx.setTransform(1, 0, 0, 1, 0, 0), this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height), this.ctx.restore();
        }
        save() {
          this.inSMaskMode ? (V(this.ctx, this.suspendedCtx), this.suspendedCtx.save()) : this.ctx.save();
          const h = this.current;
          this.stateStack.push(h), this.current = h.clone();
        }
        restore() {
          this.stateStack.length === 0 && this.inSMaskMode && this.endSMaskMode(), this.stateStack.length !== 0 && (this.current = this.stateStack.pop(), this.inSMaskMode ? (this.suspendedCtx.restore(), V(this.suspendedCtx, this.ctx)) : this.ctx.restore(), this.checkSMaskState(), this.pendingClip = null, this._cachedScaleForStroking[0] = -1, this._cachedGetSinglePixelWidth = null);
        }
        transform(h, g, w, _, A, T) {
          this.ctx.transform(h, g, w, _, A, T), this._cachedScaleForStroking[0] = -1, this._cachedGetSinglePixelWidth = null;
        }
        constructPath(h, g, w) {
          const _ = this.ctx, A = this.current;
          let T = A.x, L = A.y, M, N;
          const D = (0, u.getCurrentTransform)(_), G = D[0] === 0 && D[3] === 0 || D[1] === 0 && D[2] === 0, z = G ? w.slice(0) : null;
          for (let O = 0, P = 0, q = h.length; O < q; O++)
            switch (h[O] | 0) {
              case e.OPS.rectangle:
                T = g[P++], L = g[P++];
                const et = g[P++], K = g[P++], tt = T + et, ft = L + K;
                _.moveTo(T, L), et === 0 || K === 0 ? _.lineTo(tt, ft) : (_.lineTo(tt, L), _.lineTo(tt, ft), _.lineTo(T, ft)), G || A.updateRectMinMax(D, [T, L, tt, ft]), _.closePath();
                break;
              case e.OPS.moveTo:
                T = g[P++], L = g[P++], _.moveTo(T, L), G || A.updatePathMinMax(D, T, L);
                break;
              case e.OPS.lineTo:
                T = g[P++], L = g[P++], _.lineTo(T, L), G || A.updatePathMinMax(D, T, L);
                break;
              case e.OPS.curveTo:
                M = T, N = L, T = g[P + 4], L = g[P + 5], _.bezierCurveTo(g[P], g[P + 1], g[P + 2], g[P + 3], T, L), A.updateCurvePathMinMax(D, M, N, g[P], g[P + 1], g[P + 2], g[P + 3], T, L, z), P += 6;
                break;
              case e.OPS.curveTo2:
                M = T, N = L, _.bezierCurveTo(T, L, g[P], g[P + 1], g[P + 2], g[P + 3]), A.updateCurvePathMinMax(D, M, N, T, L, g[P], g[P + 1], g[P + 2], g[P + 3], z), T = g[P + 2], L = g[P + 3], P += 4;
                break;
              case e.OPS.curveTo3:
                M = T, N = L, T = g[P + 2], L = g[P + 3], _.bezierCurveTo(g[P], g[P + 1], T, L, T, L), A.updateCurvePathMinMax(D, M, N, g[P], g[P + 1], T, L, T, L, z), P += 4;
                break;
              case e.OPS.closePath:
                _.closePath();
                break;
            }
          G && A.updateScalingPathMinMax(D, z), A.setCurrentPoint(T, L);
        }
        closePath() {
          this.ctx.closePath();
        }
        stroke(h = !0) {
          const g = this.ctx, w = this.current.strokeColor;
          g.globalAlpha = this.current.strokeAlpha, this.contentVisible && (typeof w == "object" && w?.getPattern ? (g.save(), g.strokeStyle = w.getPattern(g, this, (0, u.getCurrentTransformInverse)(g), f.STROKE), this.rescaleAndStroke(!1), g.restore()) : this.rescaleAndStroke(!0)), h && this.consumePath(this.current.getClippedPathBoundingBox()), g.globalAlpha = this.current.fillAlpha;
        }
        closeStroke() {
          this.closePath(), this.stroke();
        }
        fill(h = !0) {
          const g = this.ctx, w = this.current.fillColor, _ = this.current.patternFill;
          let A = !1;
          _ && (g.save(), g.fillStyle = w.getPattern(g, this, (0, u.getCurrentTransformInverse)(g), f.FILL), A = !0);
          const T = this.current.getClippedPathBoundingBox();
          this.contentVisible && T !== null && (this.pendingEOFill ? (g.fill("evenodd"), this.pendingEOFill = !1) : g.fill()), A && g.restore(), h && this.consumePath(T);
        }
        eoFill() {
          this.pendingEOFill = !0, this.fill();
        }
        fillStroke() {
          this.fill(!1), this.stroke(!1), this.consumePath();
        }
        eoFillStroke() {
          this.pendingEOFill = !0, this.fillStroke();
        }
        closeFillStroke() {
          this.closePath(), this.fillStroke();
        }
        closeEOFillStroke() {
          this.pendingEOFill = !0, this.closePath(), this.fillStroke();
        }
        endPath() {
          this.consumePath();
        }
        clip() {
          this.pendingClip = Q;
        }
        eoClip() {
          this.pendingClip = it;
        }
        beginText() {
          this.current.textMatrix = e.IDENTITY_MATRIX, this.current.textMatrixScale = 1, this.current.x = this.current.lineX = 0, this.current.y = this.current.lineY = 0;
        }
        endText() {
          const h = this.pendingTextPaths, g = this.ctx;
          if (h === void 0) {
            g.beginPath();
            return;
          }
          g.save(), g.beginPath();
          for (const w of h)
            g.setTransform(...w.transform), g.translate(w.x, w.y), w.addToPath(g, w.fontSize);
          g.restore(), g.clip(), g.beginPath(), delete this.pendingTextPaths;
        }
        setCharSpacing(h) {
          this.current.charSpacing = h;
        }
        setWordSpacing(h) {
          this.current.wordSpacing = h;
        }
        setHScale(h) {
          this.current.textHScale = h / 100;
        }
        setLeading(h) {
          this.current.leading = -h;
        }
        setFont(h, g) {
          const w = this.commonObjs.get(h), _ = this.current;
          if (!w)
            throw new Error(`Can't find font for ${h}`);
          if (_.fontMatrix = w.fontMatrix || e.FONT_IDENTITY_MATRIX, (_.fontMatrix[0] === 0 || _.fontMatrix[3] === 0) && (0, e.warn)("Invalid font matrix for font " + h), g < 0 ? (g = -g, _.fontDirection = -1) : _.fontDirection = 1, this.current.font = w, this.current.fontSize = g, w.isType3Font)
            return;
          const A = w.loadedName || "sans-serif", T = w.systemFontInfo?.css || `"${A}", ${w.fallbackName}`;
          let L = "normal";
          w.black ? L = "900" : w.bold && (L = "bold");
          const M = w.italic ? "italic" : "normal";
          let N = g;
          g < i ? N = i : g > r && (N = r), this.current.fontSizeScale = g / N, this.ctx.font = `${M} ${L} ${N}px ${T}`;
        }
        setTextRenderingMode(h) {
          this.current.textRenderingMode = h;
        }
        setTextRise(h) {
          this.current.textRise = h;
        }
        moveText(h, g) {
          this.current.x = this.current.lineX += h, this.current.y = this.current.lineY += g;
        }
        setLeadingMoveText(h, g) {
          this.setLeading(-g), this.moveText(h, g);
        }
        setTextMatrix(h, g, w, _, A, T) {
          this.current.textMatrix = [h, g, w, _, A, T], this.current.textMatrixScale = Math.hypot(h, g), this.current.x = this.current.lineX = 0, this.current.y = this.current.lineY = 0;
        }
        nextLine() {
          this.moveText(0, this.current.leading);
        }
        paintChar(h, g, w, _) {
          const A = this.ctx, T = this.current, L = T.font, M = T.textRenderingMode, N = T.fontSize / T.fontSizeScale, D = M & e.TextRenderingMode.FILL_STROKE_MASK, G = !!(M & e.TextRenderingMode.ADD_TO_PATH_FLAG), z = T.patternFill && !L.missingFile;
          let O;
          (L.disableFontFace || G || z) && (O = L.getPathGenerator(this.commonObjs, h)), L.disableFontFace || z ? (A.save(), A.translate(g, w), A.beginPath(), O(A, N), _ && A.setTransform(..._), (D === e.TextRenderingMode.FILL || D === e.TextRenderingMode.FILL_STROKE) && A.fill(), (D === e.TextRenderingMode.STROKE || D === e.TextRenderingMode.FILL_STROKE) && A.stroke(), A.restore()) : ((D === e.TextRenderingMode.FILL || D === e.TextRenderingMode.FILL_STROKE) && A.fillText(h, g, w), (D === e.TextRenderingMode.STROKE || D === e.TextRenderingMode.FILL_STROKE) && A.strokeText(h, g, w)), G && (this.pendingTextPaths ||= []).push({
            transform: (0, u.getCurrentTransform)(A),
            x: g,
            y: w,
            fontSize: N,
            addToPath: O
          });
        }
        get isFontSubpixelAAEnabled() {
          const {
            context: h
          } = this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled", 10, 10);
          h.scale(1.5, 1), h.fillText("I", 0, 10);
          const g = h.getImageData(0, 0, 10, 10).data;
          let w = !1;
          for (let _ = 3; _ < g.length; _ += 4)
            if (g[_] > 0 && g[_] < 255) {
              w = !0;
              break;
            }
          return (0, e.shadow)(this, "isFontSubpixelAAEnabled", w);
        }
        showText(h) {
          const g = this.current, w = g.font;
          if (w.isType3Font)
            return this.showType3Text(h);
          const _ = g.fontSize;
          if (_ === 0)
            return;
          const A = this.ctx, T = g.fontSizeScale, L = g.charSpacing, M = g.wordSpacing, N = g.fontDirection, D = g.textHScale * N, G = h.length, z = w.vertical, O = z ? 1 : -1, P = w.defaultVMetrics, q = _ * g.fontMatrix[0], et = g.textRenderingMode === e.TextRenderingMode.FILL && !w.disableFontFace && !g.patternFill;
          A.save(), A.transform(...g.textMatrix), A.translate(g.x, g.y + g.textRise), N > 0 ? A.scale(D, -1) : A.scale(D, 1);
          let K;
          if (g.patternFill) {
            A.save();
            const ct = g.fillColor.getPattern(A, this, (0, u.getCurrentTransformInverse)(A), f.FILL);
            K = (0, u.getCurrentTransform)(A), A.restore(), A.fillStyle = ct;
          }
          let tt = g.lineWidth;
          const ft = g.textMatrixScale;
          if (ft === 0 || tt === 0) {
            const ct = g.textRenderingMode & e.TextRenderingMode.FILL_STROKE_MASK;
            (ct === e.TextRenderingMode.STROKE || ct === e.TextRenderingMode.FILL_STROKE) && (tt = this.getSinglePixelWidth());
          } else
            tt /= ft;
          if (T !== 1 && (A.scale(T, T), tt /= T), A.lineWidth = tt, w.isInvalidPDFjsFont) {
            const ct = [];
            let mt = 0;
            for (const wt of h)
              ct.push(wt.unicode), mt += wt.width;
            A.fillText(ct.join(""), 0, 0), g.x += mt * q * D, A.restore(), this.compose();
            return;
          }
          let at = 0, nt;
          for (nt = 0; nt < G; ++nt) {
            const ct = h[nt];
            if (typeof ct == "number") {
              at += O * ct * _ / 1e3;
              continue;
            }
            let mt = !1;
            const wt = (ct.isSpace ? M : 0) + L, Et = ct.fontChar, Tt = ct.accent;
            let _t, jt, Pt = ct.width;
            if (z) {
              const Rt = ct.vmetric || P, Ht = -(ct.vmetric ? Rt[1] : Pt * 0.5) * q, ue = Rt[2] * q;
              Pt = Rt ? -Rt[0] : Pt, _t = Ht / T, jt = (at + ue) / T;
            } else
              _t = at / T, jt = 0;
            if (w.remeasure && Pt > 0) {
              const Rt = A.measureText(Et).width * 1e3 / _ * T;
              if (Pt < Rt && this.isFontSubpixelAAEnabled) {
                const Ht = Pt / Rt;
                mt = !0, A.save(), A.scale(Ht, 1), _t /= Ht;
              } else
                Pt !== Rt && (_t += (Pt - Rt) / 2e3 * _ / T);
            }
            if (this.contentVisible && (ct.isInFont || w.missingFile)) {
              if (et && !Tt)
                A.fillText(Et, _t, jt);
              else if (this.paintChar(Et, _t, jt, K), Tt) {
                const Rt = _t + _ * Tt.offset.x / T, Ht = jt - _ * Tt.offset.y / T;
                this.paintChar(Tt.fontChar, Rt, Ht, K);
              }
            }
            const Wt = z ? Pt * q - wt * N : Pt * q + wt * N;
            at += Wt, mt && A.restore();
          }
          z ? g.y -= at : g.x += at * D, A.restore(), this.compose();
        }
        showType3Text(h) {
          const g = this.ctx, w = this.current, _ = w.font, A = w.fontSize, T = w.fontDirection, L = _.vertical ? 1 : -1, M = w.charSpacing, N = w.wordSpacing, D = w.textHScale * T, G = w.fontMatrix || e.FONT_IDENTITY_MATRIX, z = h.length, O = w.textRenderingMode === e.TextRenderingMode.INVISIBLE;
          let P, q, et, K;
          if (!(O || A === 0)) {
            for (this._cachedScaleForStroking[0] = -1, this._cachedGetSinglePixelWidth = null, g.save(), g.transform(...w.textMatrix), g.translate(w.x, w.y), g.scale(D, T), P = 0; P < z; ++P) {
              if (q = h[P], typeof q == "number") {
                K = L * q * A / 1e3, this.ctx.translate(K, 0), w.x += K * D;
                continue;
              }
              const tt = (q.isSpace ? N : 0) + M, ft = _.charProcOperatorList[q.operatorListId];
              if (!ft) {
                (0, e.warn)(`Type3 character "${q.operatorListId}" is not available.`);
                continue;
              }
              this.contentVisible && (this.processingType3 = q, this.save(), g.scale(A, A), g.transform(...G), this.executeOperatorList(ft), this.restore()), et = e.Util.applyTransform([q.width, 0], G)[0] * A + tt, g.translate(et, 0), w.x += et * D;
            }
            g.restore(), this.processingType3 = null;
          }
        }
        setCharWidth(h, g) {
        }
        setCharWidthAndBounds(h, g, w, _, A, T) {
          this.ctx.rect(w, _, A - w, T - _), this.ctx.clip(), this.endPath();
        }
        getColorN_Pattern(h) {
          let g;
          if (h[0] === "TilingPattern") {
            const w = h[1], _ = this.baseTransform || (0, u.getCurrentTransform)(this.ctx), A = {
              createCanvasGraphics: (T) => new x(T, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, {
                optionalContentConfig: this.optionalContentConfig,
                markedContentStack: this.markedContentStack
              })
            };
            g = new a(h, w, this.ctx, A, _);
          } else
            g = this._getPattern(h[1], h[2]);
          return g;
        }
        setStrokeColorN() {
          this.current.strokeColor = this.getColorN_Pattern(arguments);
        }
        setFillColorN() {
          this.current.fillColor = this.getColorN_Pattern(arguments), this.current.patternFill = !0;
        }
        setStrokeRGBColor(h, g, w) {
          const _ = e.Util.makeHexColor(h, g, w);
          this.ctx.strokeStyle = _, this.current.strokeColor = _;
        }
        setFillRGBColor(h, g, w) {
          const _ = e.Util.makeHexColor(h, g, w);
          this.ctx.fillStyle = _, this.current.fillColor = _, this.current.patternFill = !1;
        }
        _getPattern(h, g = null) {
          let w;
          return this.cachedPatterns.has(h) ? w = this.cachedPatterns.get(h) : (w = b(this.getObject(h)), this.cachedPatterns.set(h, w)), g && (w.matrix = g), w;
        }
        shadingFill(h) {
          if (!this.contentVisible)
            return;
          const g = this.ctx;
          this.save();
          const w = this._getPattern(h);
          g.fillStyle = w.getPattern(g, this, (0, u.getCurrentTransformInverse)(g), f.SHADING);
          const _ = (0, u.getCurrentTransformInverse)(g);
          if (_) {
            const {
              width: A,
              height: T
            } = g.canvas, [L, M, N, D] = e.Util.getAxialAlignedBoundingBox([0, 0, A, T], _);
            this.ctx.fillRect(L, M, N - L, D - M);
          } else
            this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10);
          this.compose(this.current.getClippedPathBoundingBox()), this.restore();
        }
        beginInlineImage() {
          (0, e.unreachable)("Should not call beginInlineImage");
        }
        beginImageData() {
          (0, e.unreachable)("Should not call beginImageData");
        }
        paintFormXObjectBegin(h, g) {
          if (this.contentVisible && (this.save(), this.baseTransformStack.push(this.baseTransform), Array.isArray(h) && h.length === 6 && this.transform(...h), this.baseTransform = (0, u.getCurrentTransform)(this.ctx), g)) {
            const w = g[2] - g[0], _ = g[3] - g[1];
            this.ctx.rect(g[0], g[1], w, _), this.current.updateRectMinMax((0, u.getCurrentTransform)(this.ctx), g), this.clip(), this.endPath();
          }
        }
        paintFormXObjectEnd() {
          this.contentVisible && (this.restore(), this.baseTransform = this.baseTransformStack.pop());
        }
        beginGroup(h) {
          if (!this.contentVisible)
            return;
          this.save(), this.inSMaskMode && (this.endSMaskMode(), this.current.activeSMask = null);
          const g = this.ctx;
          h.isolated || (0, e.info)("TODO: Support non-isolated groups."), h.knockout && (0, e.warn)("Knockout groups not supported.");
          const w = (0, u.getCurrentTransform)(g);
          if (h.matrix && g.transform(...h.matrix), !h.bbox)
            throw new Error("Bounding box is required.");
          let _ = e.Util.getAxialAlignedBoundingBox(h.bbox, (0, u.getCurrentTransform)(g));
          const A = [0, 0, g.canvas.width, g.canvas.height];
          _ = e.Util.intersect(_, A) || [0, 0, 0, 0];
          const T = Math.floor(_[0]), L = Math.floor(_[1]);
          let M = Math.max(Math.ceil(_[2]) - T, 1), N = Math.max(Math.ceil(_[3]) - L, 1), D = 1, G = 1;
          M > v && (D = M / v, M = v), N > v && (G = N / v, N = v), this.current.startNewPathAndClipBox([0, 0, M, N]);
          let z = "groupAt" + this.groupLevel;
          h.smask && (z += "_smask_" + this.smaskCounter++ % 2);
          const O = this.cachedCanvases.getCanvas(z, M, N), P = O.context;
          P.scale(1 / D, 1 / G), P.translate(-T, -L), P.transform(...w), h.smask ? this.smaskStack.push({
            canvas: O.canvas,
            context: P,
            offsetX: T,
            offsetY: L,
            scaleX: D,
            scaleY: G,
            subtype: h.smask.subtype,
            backdrop: h.smask.backdrop,
            transferMap: h.smask.transferMap || null,
            startTransformInverse: null
          }) : (g.setTransform(1, 0, 0, 1, 0, 0), g.translate(T, L), g.scale(D, G), g.save()), V(g, P), this.ctx = P, this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]), this.groupStack.push(g), this.groupLevel++;
        }
        endGroup(h) {
          if (!this.contentVisible)
            return;
          this.groupLevel--;
          const g = this.ctx, w = this.groupStack.pop();
          if (this.ctx = w, this.ctx.imageSmoothingEnabled = !1, h.smask)
            this.tempSMask = this.smaskStack.pop(), this.restore();
          else {
            this.ctx.restore();
            const _ = (0, u.getCurrentTransform)(this.ctx);
            this.restore(), this.ctx.save(), this.ctx.setTransform(..._);
            const A = e.Util.getAxialAlignedBoundingBox([0, 0, g.canvas.width, g.canvas.height], _);
            this.ctx.drawImage(g.canvas, 0, 0), this.ctx.restore(), this.compose(A);
          }
        }
        beginAnnotation(h, g, w, _, A) {
          if (this.#t(), j(this.ctx), this.ctx.save(), this.save(), this.baseTransform && this.ctx.setTransform(...this.baseTransform), Array.isArray(g) && g.length === 4) {
            const T = g[2] - g[0], L = g[3] - g[1];
            if (A && this.annotationCanvasMap) {
              w = w.slice(), w[4] -= g[0], w[5] -= g[1], g = g.slice(), g[0] = g[1] = 0, g[2] = T, g[3] = L;
              const [M, N] = e.Util.singularValueDecompose2dScale((0, u.getCurrentTransform)(this.ctx)), {
                viewportScale: D
              } = this, G = Math.ceil(T * this.outputScaleX * D), z = Math.ceil(L * this.outputScaleY * D);
              this.annotationCanvas = this.canvasFactory.create(G, z);
              const {
                canvas: O,
                context: P
              } = this.annotationCanvas;
              this.annotationCanvasMap.set(h, O), this.annotationCanvas.savedCtx = this.ctx, this.ctx = P, this.ctx.save(), this.ctx.setTransform(M, 0, 0, -N, 0, L * N), j(this.ctx);
            } else
              j(this.ctx), this.ctx.rect(g[0], g[1], T, L), this.ctx.clip(), this.endPath();
          }
          this.current = new Z(this.ctx.canvas.width, this.ctx.canvas.height), this.transform(...w), this.transform(..._);
        }
        endAnnotation() {
          this.annotationCanvas && (this.ctx.restore(), this.#e(), this.ctx = this.annotationCanvas.savedCtx, delete this.annotationCanvas.savedCtx, delete this.annotationCanvas);
        }
        paintImageMaskXObject(h) {
          if (!this.contentVisible)
            return;
          const g = h.count;
          h = this.getObject(h.data, h), h.count = g;
          const w = this.ctx, _ = this.processingType3;
          if (_ && (_.compiled === void 0 && (_.compiled = X(h)), _.compiled)) {
            _.compiled(w);
            return;
          }
          const A = this._createMaskCanvas(h), T = A.canvas;
          w.save(), w.setTransform(1, 0, 0, 1, 0, 0), w.drawImage(T, A.offsetX, A.offsetY), w.restore(), this.compose();
        }
        paintImageMaskXObjectRepeat(h, g, w = 0, _ = 0, A, T) {
          if (!this.contentVisible)
            return;
          h = this.getObject(h.data, h);
          const L = this.ctx;
          L.save();
          const M = (0, u.getCurrentTransform)(L);
          L.transform(g, w, _, A, 0, 0);
          const N = this._createMaskCanvas(h);
          L.setTransform(1, 0, 0, 1, N.offsetX - M[4], N.offsetY - M[5]);
          for (let D = 0, G = T.length; D < G; D += 2) {
            const z = e.Util.transform(M, [g, w, _, A, T[D], T[D + 1]]), [O, P] = e.Util.applyTransform([0, 0], z);
            L.drawImage(N.canvas, O, P);
          }
          L.restore(), this.compose();
        }
        paintImageMaskXObjectGroup(h) {
          if (!this.contentVisible)
            return;
          const g = this.ctx, w = this.current.fillColor, _ = this.current.patternFill;
          for (const A of h) {
            const {
              data: T,
              width: L,
              height: M,
              transform: N
            } = A, D = this.cachedCanvases.getCanvas("maskCanvas", L, M), G = D.context;
            G.save();
            const z = this.getObject(T, A);
            Y(G, z), G.globalCompositeOperation = "source-in", G.fillStyle = _ ? w.getPattern(G, this, (0, u.getCurrentTransformInverse)(g), f.FILL) : w, G.fillRect(0, 0, L, M), G.restore(), g.save(), g.transform(...N), g.scale(1, -1), U(g, D.canvas, 0, 0, L, M, 0, -1, 1, 1), g.restore();
          }
          this.compose();
        }
        paintImageXObject(h) {
          if (!this.contentVisible)
            return;
          const g = this.getObject(h);
          if (!g) {
            (0, e.warn)("Dependent image isn't ready yet");
            return;
          }
          this.paintInlineImageXObject(g);
        }
        paintImageXObjectRepeat(h, g, w, _) {
          if (!this.contentVisible)
            return;
          const A = this.getObject(h);
          if (!A) {
            (0, e.warn)("Dependent image isn't ready yet");
            return;
          }
          const T = A.width, L = A.height, M = [];
          for (let N = 0, D = _.length; N < D; N += 2)
            M.push({
              transform: [g, 0, 0, w, _[N], _[N + 1]],
              x: 0,
              y: 0,
              w: T,
              h: L
            });
          this.paintInlineImageXObjectGroup(A, M);
        }
        applyTransferMapsToCanvas(h) {
          return this.current.transferMaps !== "none" && (h.filter = this.current.transferMaps, h.drawImage(h.canvas, 0, 0), h.filter = "none"), h.canvas;
        }
        applyTransferMapsToBitmap(h) {
          if (this.current.transferMaps === "none")
            return h.bitmap;
          const {
            bitmap: g,
            width: w,
            height: _
          } = h, A = this.cachedCanvases.getCanvas("inlineImage", w, _), T = A.context;
          return T.filter = this.current.transferMaps, T.drawImage(g, 0, 0), T.filter = "none", A.canvas;
        }
        paintInlineImageXObject(h) {
          if (!this.contentVisible)
            return;
          const g = h.width, w = h.height, _ = this.ctx;
          if (this.save(), !e.isNodeJS) {
            const {
              filter: L
            } = _;
            L !== "none" && L !== "" && (_.filter = "none");
          }
          _.scale(1 / g, -1 / w);
          let A;
          if (h.bitmap)
            A = this.applyTransferMapsToBitmap(h);
          else if (typeof HTMLElement == "function" && h instanceof HTMLElement || !h.data)
            A = h;
          else {
            const M = this.cachedCanvases.getCanvas("inlineImage", g, w).context;
            lt(M, h), A = this.applyTransferMapsToCanvas(M);
          }
          const T = this._scaleImage(A, (0, u.getCurrentTransformInverse)(_));
          _.imageSmoothingEnabled = pt((0, u.getCurrentTransform)(_), h.interpolate), U(_, T.img, 0, 0, T.paintWidth, T.paintHeight, 0, -w, g, w), this.compose(), this.restore();
        }
        paintInlineImageXObjectGroup(h, g) {
          if (!this.contentVisible)
            return;
          const w = this.ctx;
          let _;
          if (h.bitmap)
            _ = h.bitmap;
          else {
            const A = h.width, T = h.height, M = this.cachedCanvases.getCanvas("inlineImage", A, T).context;
            lt(M, h), _ = this.applyTransferMapsToCanvas(M);
          }
          for (const A of g)
            w.save(), w.transform(...A.transform), w.scale(1, -1), U(w, _, A.x, A.y, A.w, A.h, 0, -1, 1, 1), w.restore();
          this.compose();
        }
        paintSolidColorImageMask() {
          this.contentVisible && (this.ctx.fillRect(0, 0, 1, 1), this.compose());
        }
        markPoint(h) {
        }
        markPointProps(h, g) {
        }
        beginMarkedContent(h) {
          this.markedContentStack.push({
            visible: !0
          });
        }
        beginMarkedContentProps(h, g) {
          h === "OC" ? this.markedContentStack.push({
            visible: this.optionalContentConfig.isVisible(g)
          }) : this.markedContentStack.push({
            visible: !0
          }), this.contentVisible = this.isContentVisible();
        }
        endMarkedContent() {
          this.markedContentStack.pop(), this.contentVisible = this.isContentVisible();
        }
        beginCompat() {
        }
        endCompat() {
        }
        consumePath(h) {
          const g = this.current.isEmptyClip();
          this.pendingClip && this.current.updateClipFromPath(), this.pendingClip || this.compose(h);
          const w = this.ctx;
          this.pendingClip && (g || (this.pendingClip === it ? w.clip("evenodd") : w.clip()), this.pendingClip = null), this.current.startNewPathAndClipBox(this.current.clipBox), w.beginPath();
        }
        getSinglePixelWidth() {
          if (!this._cachedGetSinglePixelWidth) {
            const h = (0, u.getCurrentTransform)(this.ctx);
            if (h[1] === 0 && h[2] === 0)
              this._cachedGetSinglePixelWidth = 1 / Math.min(Math.abs(h[0]), Math.abs(h[3]));
            else {
              const g = Math.abs(h[0] * h[3] - h[2] * h[1]), w = Math.hypot(h[0], h[2]), _ = Math.hypot(h[1], h[3]);
              this._cachedGetSinglePixelWidth = Math.max(w, _) / g;
            }
          }
          return this._cachedGetSinglePixelWidth;
        }
        getScaleForStroking() {
          if (this._cachedScaleForStroking[0] === -1) {
            const {
              lineWidth: h
            } = this.current, {
              a: g,
              b: w,
              c: _,
              d: A
            } = this.ctx.getTransform();
            let T, L;
            if (w === 0 && _ === 0) {
              const M = Math.abs(g), N = Math.abs(A);
              if (M === N)
                if (h === 0)
                  T = L = 1 / M;
                else {
                  const D = M * h;
                  T = L = D < 1 ? 1 / D : 1;
                }
              else if (h === 0)
                T = 1 / M, L = 1 / N;
              else {
                const D = M * h, G = N * h;
                T = D < 1 ? 1 / D : 1, L = G < 1 ? 1 / G : 1;
              }
            } else {
              const M = Math.abs(g * A - w * _), N = Math.hypot(g, w), D = Math.hypot(_, A);
              if (h === 0)
                T = D / M, L = N / M;
              else {
                const G = h * M;
                T = D > G ? D / G : 1, L = N > G ? N / G : 1;
              }
            }
            this._cachedScaleForStroking[0] = T, this._cachedScaleForStroking[1] = L;
          }
          return this._cachedScaleForStroking;
        }
        rescaleAndStroke(h) {
          const {
            ctx: g
          } = this, {
            lineWidth: w
          } = this.current, [_, A] = this.getScaleForStroking();
          if (g.lineWidth = w || 1, _ === 1 && A === 1) {
            g.stroke();
            return;
          }
          const T = g.getLineDash();
          if (h && g.save(), g.scale(_, A), T.length > 0) {
            const L = Math.max(_, A);
            g.setLineDash(T.map((M) => M / L)), g.lineDashOffset /= L;
          }
          g.stroke(), h && g.restore();
        }
        isContentVisible() {
          for (let h = this.markedContentStack.length - 1; h >= 0; h--)
            if (!this.markedContentStack[h].visible)
              return !1;
          return !0;
        }
      }
      for (const C in e.OPS)
        x.prototype[C] !== void 0 && (x.prototype[e.OPS[C]] = x.prototype[C]);
    }
  ),
  /***/
  419: (
    /***/
    (d, t, n) => {
      n.d(t, {
        /* harmony export */
        DOMCMapReaderFactory: () => (
          /* binding */
          c
        ),
        /* harmony export */
        DOMCanvasFactory: () => (
          /* binding */
          o
        ),
        /* harmony export */
        DOMFilterFactory: () => (
          /* binding */
          m
        ),
        /* harmony export */
        DOMSVGFactory: () => (
          /* binding */
          p
        ),
        /* harmony export */
        DOMStandardFontDataFactory: () => (
          /* binding */
          s
        ),
        /* harmony export */
        PDFDateString: () => (
          /* binding */
          I
        ),
        /* harmony export */
        PageViewport: () => (
          /* binding */
          b
        ),
        /* harmony export */
        PixelsPerInch: () => (
          /* binding */
          k
        ),
        /* harmony export */
        RenderingCancelledException: () => (
          /* binding */
          S
        ),
        /* harmony export */
        StatTimer: () => (
          /* binding */
          v
        ),
        /* harmony export */
        fetchData: () => (
          /* binding */
          l
        ),
        /* harmony export */
        getColorValues: () => (
          /* binding */
          U
        ),
        /* harmony export */
        getCurrentTransform: () => (
          /* binding */
          X
        ),
        /* harmony export */
        getCurrentTransformInverse: () => (
          /* binding */
          Z
        ),
        /* harmony export */
        getFilenameFromUrl: () => (
          /* binding */
          i
        ),
        /* harmony export */
        getPdfFilenameFromUrl: () => (
          /* binding */
          r
        ),
        /* harmony export */
        getRGB: () => (
          /* binding */
          B
        ),
        /* harmony export */
        getXfaPageViewport: () => (
          /* binding */
          H
        ),
        /* harmony export */
        isDataScheme: () => (
          /* binding */
          a
        ),
        /* harmony export */
        isPdfFile: () => (
          /* binding */
          E
        ),
        /* harmony export */
        isValidFetchUrl: () => (
          /* binding */
          y
        ),
        /* harmony export */
        noContextMenu: () => (
          /* binding */
          R
        ),
        /* harmony export */
        setLayerDimensions: () => (
          /* binding */
          lt
        )
        /* harmony export */
      });
      var e = n(583), u = n(292);
      const f = "http://www.w3.org/2000/svg";
      class k {
        static CSS = 96;
        static PDF = 72;
        static PDF_TO_CSS_UNITS = this.CSS / this.PDF;
      }
      class m extends e.BaseFilterFactory {
        #t;
        #e;
        #i;
        #s;
        #r;
        #n = 0;
        constructor({
          docId: V,
          ownerDocument: j = globalThis.document
        } = {}) {
          super(), this.#i = V, this.#s = j;
        }
        get #a() {
          return this.#t ||= /* @__PURE__ */ new Map();
        }
        get #c() {
          return this.#r ||= /* @__PURE__ */ new Map();
        }
        get #l() {
          if (!this.#e) {
            const V = this.#s.createElement("div"), {
              style: j
            } = V;
            j.visibility = "hidden", j.contain = "strict", j.width = j.height = 0, j.position = "absolute", j.top = j.left = 0, j.zIndex = -1;
            const $ = this.#s.createElementNS(f, "svg");
            $.setAttribute("width", 0), $.setAttribute("height", 0), this.#e = this.#s.createElementNS(f, "defs"), V.append($), $.append(this.#e), this.#s.body.append(V);
          }
          return this.#e;
        }
        addFilter(V) {
          if (!V)
            return "none";
          let j = this.#a.get(V);
          if (j)
            return j;
          let $, st, J, ht;
          if (V.length === 1) {
            const ut = V[0], Q = new Array(256);
            for (let it = 0; it < 256; it++)
              Q[it] = ut[it] / 255;
            ht = $ = st = J = Q.join(",");
          } else {
            const [ut, Q, it] = V, x = new Array(256), C = new Array(256), h = new Array(256);
            for (let g = 0; g < 256; g++)
              x[g] = ut[g] / 255, C[g] = Q[g] / 255, h[g] = it[g] / 255;
            $ = x.join(","), st = C.join(","), J = h.join(","), ht = `${$}${st}${J}`;
          }
          if (j = this.#a.get(ht), j)
            return this.#a.set(V, j), j;
          const rt = `g_${this.#i}_transfer_map_${this.#n++}`, pt = `url(#${rt})`;
          this.#a.set(V, pt), this.#a.set(ht, pt);
          const dt = this.#u(rt);
          return this.#o($, st, J, dt), pt;
        }
        addHCMFilter(V, j) {
          const $ = `${V}-${j}`, st = "base";
          let J = this.#c.get(st);
          if (J?.key === $ || (J ? (J.filter?.remove(), J.key = $, J.url = "none", J.filter = null) : (J = {
            key: $,
            url: "none",
            filter: null
          }, this.#c.set(st, J)), !V || !j))
            return J.url;
          const ht = this.#p(V);
          V = u.Util.makeHexColor(...ht);
          const rt = this.#p(j);
          if (j = u.Util.makeHexColor(...rt), this.#l.style.color = "", V === "#000000" && j === "#ffffff" || V === j)
            return J.url;
          const pt = new Array(256);
          for (let x = 0; x <= 255; x++) {
            const C = x / 255;
            pt[x] = C <= 0.03928 ? C / 12.92 : ((C + 0.055) / 1.055) ** 2.4;
          }
          const dt = pt.join(","), ut = `g_${this.#i}_hcm_filter`, Q = J.filter = this.#u(ut);
          this.#o(dt, dt, dt, Q), this.#d(Q);
          const it = (x, C) => {
            const h = ht[x] / 255, g = rt[x] / 255, w = new Array(C + 1);
            for (let _ = 0; _ <= C; _++)
              w[_] = h + _ / C * (g - h);
            return w.join(",");
          };
          return this.#o(it(0, 5), it(1, 5), it(2, 5), Q), J.url = `url(#${ut})`, J.url;
        }
        addHighlightHCMFilter(V, j, $, st, J) {
          const ht = `${j}-${$}-${st}-${J}`;
          let rt = this.#c.get(V);
          if (rt?.key === ht || (rt ? (rt.filter?.remove(), rt.key = ht, rt.url = "none", rt.filter = null) : (rt = {
            key: ht,
            url: "none",
            filter: null
          }, this.#c.set(V, rt)), !j || !$))
            return rt.url;
          const [pt, dt] = [j, $].map(this.#p.bind(this));
          let ut = Math.round(0.2126 * pt[0] + 0.7152 * pt[1] + 0.0722 * pt[2]), Q = Math.round(0.2126 * dt[0] + 0.7152 * dt[1] + 0.0722 * dt[2]), [it, x] = [st, J].map(this.#p.bind(this));
          Q < ut && ([ut, Q, it, x] = [Q, ut, x, it]), this.#l.style.color = "";
          const C = (w, _, A) => {
            const T = new Array(256), L = (Q - ut) / A, M = w / 255, N = (_ - w) / (255 * A);
            let D = 0;
            for (let G = 0; G <= A; G++) {
              const z = Math.round(ut + G * L), O = M + G * N;
              for (let P = D; P <= z; P++)
                T[P] = O;
              D = z + 1;
            }
            for (let G = D; G < 256; G++)
              T[G] = T[D - 1];
            return T.join(",");
          }, h = `g_${this.#i}_hcm_${V}_filter`, g = rt.filter = this.#u(h);
          return this.#d(g), this.#o(C(it[0], x[0], 5), C(it[1], x[1], 5), C(it[2], x[2], 5), g), rt.url = `url(#${h})`, rt.url;
        }
        destroy(V = !1) {
          V && this.#c.size !== 0 || (this.#e && (this.#e.parentNode.parentNode.remove(), this.#e = null), this.#t && (this.#t.clear(), this.#t = null), this.#n = 0);
        }
        #d(V) {
          const j = this.#s.createElementNS(f, "feColorMatrix");
          j.setAttribute("type", "matrix"), j.setAttribute("values", "0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"), V.append(j);
        }
        #u(V) {
          const j = this.#s.createElementNS(f, "filter");
          return j.setAttribute("color-interpolation-filters", "sRGB"), j.setAttribute("id", V), this.#l.append(j), j;
        }
        #h(V, j, $) {
          const st = this.#s.createElementNS(f, j);
          st.setAttribute("type", "discrete"), st.setAttribute("tableValues", $), V.append(st);
        }
        #o(V, j, $, st) {
          const J = this.#s.createElementNS(f, "feComponentTransfer");
          st.append(J), this.#h(J, "feFuncR", V), this.#h(J, "feFuncG", j), this.#h(J, "feFuncB", $);
        }
        #p(V) {
          return this.#l.style.color = V, B(getComputedStyle(this.#l).getPropertyValue("color"));
        }
      }
      class o extends e.BaseCanvasFactory {
        constructor({
          ownerDocument: V = globalThis.document
        } = {}) {
          super(), this._document = V;
        }
        _createCanvas(V, j) {
          const $ = this._document.createElement("canvas");
          return $.width = V, $.height = j, $;
        }
      }
      async function l(Y, V = "text") {
        if (y(Y, document.baseURI)) {
          const j = await fetch(Y);
          if (!j.ok)
            throw new Error(j.statusText);
          switch (V) {
            case "arraybuffer":
              return j.arrayBuffer();
            case "blob":
              return j.blob();
            case "json":
              return j.json();
          }
          return j.text();
        }
        return new Promise((j, $) => {
          const st = new XMLHttpRequest();
          st.open("GET", Y, !0), st.responseType = V, st.onreadystatechange = () => {
            if (st.readyState === XMLHttpRequest.DONE) {
              if (st.status === 200 || st.status === 0) {
                switch (V) {
                  case "arraybuffer":
                  case "blob":
                  case "json":
                    j(st.response);
                    return;
                }
                j(st.responseText);
                return;
              }
              $(new Error(st.statusText));
            }
          }, st.send(null);
        });
      }
      class c extends e.BaseCMapReaderFactory {
        _fetchData(V, j) {
          return l(V, this.isCompressed ? "arraybuffer" : "text").then(($) => ({
            cMapData: $ instanceof ArrayBuffer ? new Uint8Array($) : (0, u.stringToBytes)($),
            compressionType: j
          }));
        }
      }
      class s extends e.BaseStandardFontDataFactory {
        _fetchData(V) {
          return l(V, "arraybuffer").then((j) => new Uint8Array(j));
        }
      }
      class p extends e.BaseSVGFactory {
        _createSVG(V) {
          return document.createElementNS(f, V);
        }
      }
      class b {
        constructor({
          viewBox: V,
          scale: j,
          rotation: $,
          offsetX: st = 0,
          offsetY: J = 0,
          dontFlip: ht = !1
        }) {
          this.viewBox = V, this.scale = j, this.rotation = $, this.offsetX = st, this.offsetY = J;
          const rt = (V[2] + V[0]) / 2, pt = (V[3] + V[1]) / 2;
          let dt, ut, Q, it;
          switch ($ %= 360, $ < 0 && ($ += 360), $) {
            case 180:
              dt = -1, ut = 0, Q = 0, it = 1;
              break;
            case 90:
              dt = 0, ut = 1, Q = 1, it = 0;
              break;
            case 270:
              dt = 0, ut = -1, Q = -1, it = 0;
              break;
            case 0:
              dt = 1, ut = 0, Q = 0, it = -1;
              break;
            default:
              throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.");
          }
          ht && (Q = -Q, it = -it);
          let x, C, h, g;
          dt === 0 ? (x = Math.abs(pt - V[1]) * j + st, C = Math.abs(rt - V[0]) * j + J, h = (V[3] - V[1]) * j, g = (V[2] - V[0]) * j) : (x = Math.abs(rt - V[0]) * j + st, C = Math.abs(pt - V[1]) * j + J, h = (V[2] - V[0]) * j, g = (V[3] - V[1]) * j), this.transform = [dt * j, ut * j, Q * j, it * j, x - dt * j * rt - Q * j * pt, C - ut * j * rt - it * j * pt], this.width = h, this.height = g;
        }
        get rawDims() {
          const {
            viewBox: V
          } = this;
          return (0, u.shadow)(this, "rawDims", {
            pageWidth: V[2] - V[0],
            pageHeight: V[3] - V[1],
            pageX: V[0],
            pageY: V[1]
          });
        }
        clone({
          scale: V = this.scale,
          rotation: j = this.rotation,
          offsetX: $ = this.offsetX,
          offsetY: st = this.offsetY,
          dontFlip: J = !1
        } = {}) {
          return new b({
            viewBox: this.viewBox.slice(),
            scale: V,
            rotation: j,
            offsetX: $,
            offsetY: st,
            dontFlip: J
          });
        }
        convertToViewportPoint(V, j) {
          return u.Util.applyTransform([V, j], this.transform);
        }
        convertToViewportRectangle(V) {
          const j = u.Util.applyTransform([V[0], V[1]], this.transform), $ = u.Util.applyTransform([V[2], V[3]], this.transform);
          return [j[0], j[1], $[0], $[1]];
        }
        convertToPdfPoint(V, j) {
          return u.Util.applyInverseTransform([V, j], this.transform);
        }
      }
      class S extends u.BaseException {
        constructor(V, j = 0) {
          super(V, "RenderingCancelledException"), this.extraDelay = j;
        }
      }
      function a(Y) {
        const V = Y.length;
        let j = 0;
        for (; j < V && Y[j].trim() === ""; )
          j++;
        return Y.substring(j, j + 5).toLowerCase() === "data:";
      }
      function E(Y) {
        return typeof Y == "string" && /\.pdf$/i.test(Y);
      }
      function i(Y, V = !1) {
        return V || ([Y] = Y.split(/[#?]/, 1)), Y.substring(Y.lastIndexOf("/") + 1);
      }
      function r(Y, V = "document.pdf") {
        if (typeof Y != "string")
          return V;
        if (a(Y))
          return (0, u.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'), V;
        const j = /^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/, $ = /[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i, st = j.exec(Y);
        let J = $.exec(st[1]) || $.exec(st[2]) || $.exec(st[3]);
        if (J && (J = J[0], J.includes("%")))
          try {
            J = $.exec(decodeURIComponent(J))[0];
          } catch {
          }
        return J || V;
      }
      class v {
        started = /* @__PURE__ */ Object.create(null);
        times = [];
        time(V) {
          V in this.started && (0, u.warn)(`Timer is already running for ${V}`), this.started[V] = Date.now();
        }
        timeEnd(V) {
          V in this.started || (0, u.warn)(`Timer has not been started for ${V}`), this.times.push({
            name: V,
            start: this.started[V],
            end: Date.now()
          }), delete this.started[V];
        }
        toString() {
          const V = [];
          let j = 0;
          for (const {
            name: $
          } of this.times)
            j = Math.max($.length, j);
          for (const {
            name: $,
            start: st,
            end: J
          } of this.times)
            V.push(`${$.padEnd(j)} ${J - st}ms
`);
          return V.join("");
        }
      }
      function y(Y, V) {
        try {
          const {
            protocol: j
          } = V ? new URL(Y, V) : new URL(Y);
          return j === "http:" || j === "https:";
        } catch {
          return !1;
        }
      }
      function R(Y) {
        Y.preventDefault();
      }
      let F;
      class I {
        static toDateObject(V) {
          if (!V || typeof V != "string")
            return null;
          F ||= new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");
          const j = F.exec(V);
          if (!j)
            return null;
          const $ = parseInt(j[1], 10);
          let st = parseInt(j[2], 10);
          st = st >= 1 && st <= 12 ? st - 1 : 0;
          let J = parseInt(j[3], 10);
          J = J >= 1 && J <= 31 ? J : 1;
          let ht = parseInt(j[4], 10);
          ht = ht >= 0 && ht <= 23 ? ht : 0;
          let rt = parseInt(j[5], 10);
          rt = rt >= 0 && rt <= 59 ? rt : 0;
          let pt = parseInt(j[6], 10);
          pt = pt >= 0 && pt <= 59 ? pt : 0;
          const dt = j[7] || "Z";
          let ut = parseInt(j[8], 10);
          ut = ut >= 0 && ut <= 23 ? ut : 0;
          let Q = parseInt(j[9], 10) || 0;
          return Q = Q >= 0 && Q <= 59 ? Q : 0, dt === "-" ? (ht += ut, rt += Q) : dt === "+" && (ht -= ut, rt -= Q), new Date(Date.UTC($, st, J, ht, rt, pt));
        }
      }
      function H(Y, {
        scale: V = 1,
        rotation: j = 0
      }) {
        const {
          width: $,
          height: st
        } = Y.attributes.style, J = [0, 0, parseInt($), parseInt(st)];
        return new b({
          viewBox: J,
          scale: V,
          rotation: j
        });
      }
      function B(Y) {
        if (Y.startsWith("#")) {
          const V = parseInt(Y.slice(1), 16);
          return [(V & 16711680) >> 16, (V & 65280) >> 8, V & 255];
        }
        return Y.startsWith("rgb(") ? Y.slice(4, -1).split(",").map((V) => parseInt(V)) : Y.startsWith("rgba(") ? Y.slice(5, -1).split(",").map((V) => parseInt(V)).slice(0, 3) : ((0, u.warn)(`Not a valid color format: "${Y}"`), [0, 0, 0]);
      }
      function U(Y) {
        const V = document.createElement("span");
        V.style.visibility = "hidden", document.body.append(V);
        for (const j of Y.keys()) {
          V.style.color = j;
          const $ = window.getComputedStyle(V).color;
          Y.set(j, B($));
        }
        V.remove();
      }
      function X(Y) {
        const {
          a: V,
          b: j,
          c: $,
          d: st,
          e: J,
          f: ht
        } = Y.getTransform();
        return [V, j, $, st, J, ht];
      }
      function Z(Y) {
        const {
          a: V,
          b: j,
          c: $,
          d: st,
          e: J,
          f: ht
        } = Y.getTransform().invertSelf();
        return [V, j, $, st, J, ht];
      }
      function lt(Y, V, j = !1, $ = !0) {
        if (V instanceof b) {
          const {
            pageWidth: st,
            pageHeight: J
          } = V.rawDims, {
            style: ht
          } = Y, rt = u.FeatureTest.isCSSRoundSupported, pt = `var(--scale-factor) * ${st}px`, dt = `var(--scale-factor) * ${J}px`, ut = rt ? `round(${pt}, 1px)` : `calc(${pt})`, Q = rt ? `round(${dt}, 1px)` : `calc(${dt})`;
          !j || V.rotation % 180 === 0 ? (ht.width = ut, ht.height = Q) : (ht.width = Q, ht.height = ut);
        }
        $ && Y.setAttribute("data-main-rotation", V.rotation);
      }
    }
  ),
  /***/
  47: (
    /***/
    (d, t, n) => {
      n.d(t, {
        /* harmony export */
        DrawLayer: () => (
          /* binding */
          f
        )
        /* harmony export */
      });
      var e = n(419), u = n(292);
      class f {
        #t = null;
        #e = 0;
        #i = /* @__PURE__ */ new Map();
        #s = /* @__PURE__ */ new Map();
        constructor({
          pageIndex: m
        }) {
          this.pageIndex = m;
        }
        setParent(m) {
          if (!this.#t) {
            this.#t = m;
            return;
          }
          if (this.#t !== m) {
            if (this.#i.size > 0)
              for (const o of this.#i.values())
                o.remove(), m.append(o);
            this.#t = m;
          }
        }
        static get _svgFactory() {
          return (0, u.shadow)(this, "_svgFactory", new e.DOMSVGFactory());
        }
        static #r(m, {
          x: o = 0,
          y: l = 0,
          width: c = 1,
          height: s = 1
        } = {}) {
          const {
            style: p
          } = m;
          p.top = `${100 * l}%`, p.left = `${100 * o}%`, p.width = `${100 * c}%`, p.height = `${100 * s}%`;
        }
        #n(m) {
          const o = f._svgFactory.create(1, 1, !0);
          return this.#t.append(o), o.setAttribute("aria-hidden", !0), f.#r(o, m), o;
        }
        #a(m, o) {
          const l = f._svgFactory.createElement("clipPath");
          m.append(l);
          const c = `clip_${o}`;
          l.setAttribute("id", c), l.setAttribute("clipPathUnits", "objectBoundingBox");
          const s = f._svgFactory.createElement("use");
          return l.append(s), s.setAttribute("href", `#${o}`), s.classList.add("clip"), c;
        }
        highlight(m, o, l, c = !1) {
          const s = this.#e++, p = this.#n(m.box);
          p.classList.add("highlight"), m.free && p.classList.add("free");
          const b = f._svgFactory.createElement("defs");
          p.append(b);
          const S = f._svgFactory.createElement("path");
          b.append(S);
          const a = `path_p${this.pageIndex}_${s}`;
          S.setAttribute("id", a), S.setAttribute("d", m.toSVGPath()), c && this.#s.set(s, S);
          const E = this.#a(b, a), i = f._svgFactory.createElement("use");
          return p.append(i), p.setAttribute("fill", o), p.setAttribute("fill-opacity", l), i.setAttribute("href", `#${a}`), this.#i.set(s, p), {
            id: s,
            clipPathId: `url(#${E})`
          };
        }
        highlightOutline(m) {
          const o = this.#e++, l = this.#n(m.box);
          l.classList.add("highlightOutline");
          const c = f._svgFactory.createElement("defs");
          l.append(c);
          const s = f._svgFactory.createElement("path");
          c.append(s);
          const p = `path_p${this.pageIndex}_${o}`;
          s.setAttribute("id", p), s.setAttribute("d", m.toSVGPath()), s.setAttribute("vector-effect", "non-scaling-stroke");
          let b;
          if (m.free) {
            l.classList.add("free");
            const E = f._svgFactory.createElement("mask");
            c.append(E), b = `mask_p${this.pageIndex}_${o}`, E.setAttribute("id", b), E.setAttribute("maskUnits", "objectBoundingBox");
            const i = f._svgFactory.createElement("rect");
            E.append(i), i.setAttribute("width", "1"), i.setAttribute("height", "1"), i.setAttribute("fill", "white");
            const r = f._svgFactory.createElement("use");
            E.append(r), r.setAttribute("href", `#${p}`), r.setAttribute("stroke", "none"), r.setAttribute("fill", "black"), r.setAttribute("fill-rule", "nonzero"), r.classList.add("mask");
          }
          const S = f._svgFactory.createElement("use");
          l.append(S), S.setAttribute("href", `#${p}`), b && S.setAttribute("mask", `url(#${b})`);
          const a = S.cloneNode();
          return l.append(a), S.classList.add("mainOutline"), a.classList.add("secondaryOutline"), this.#i.set(o, l), o;
        }
        finalizeLine(m, o) {
          const l = this.#s.get(m);
          this.#s.delete(m), this.updateBox(m, o.box), l.setAttribute("d", o.toSVGPath());
        }
        updateLine(m, o) {
          this.#i.get(m).firstChild.firstChild.setAttribute("d", o.toSVGPath());
        }
        removeFreeHighlight(m) {
          this.remove(m), this.#s.delete(m);
        }
        updatePath(m, o) {
          this.#s.get(m).setAttribute("d", o.toSVGPath());
        }
        updateBox(m, o) {
          f.#r(this.#i.get(m), o);
        }
        show(m, o) {
          this.#i.get(m).classList.toggle("hidden", !o);
        }
        rotate(m, o) {
          this.#i.get(m).setAttribute("data-main-rotation", o);
        }
        changeColor(m, o) {
          this.#i.get(m).setAttribute("fill", o);
        }
        changeOpacity(m, o) {
          this.#i.get(m).setAttribute("fill-opacity", o);
        }
        addClass(m, o) {
          this.#i.get(m).classList.add(o);
        }
        removeClass(m, o) {
          this.#i.get(m).classList.remove(o);
        }
        remove(m) {
          this.#t !== null && (this.#i.get(m).remove(), this.#i.delete(m));
        }
        destroy() {
          this.#t = null;
          for (const m of this.#i.values())
            m.remove();
          this.#i.clear();
        }
      }
    }
  ),
  /***/
  731: (
    /***/
    (d, t, n) => {
      n.d(t, {
        AnnotationEditorLayer: () => (
          /* binding */
          a
        )
      });
      var e = n(292), u = n(310), f = n(830), k = n(976);
      const m = /\r\n?|\n/g;
      class o extends u.AnnotationEditor {
        #t = this.editorDivBlur.bind(this);
        #e = this.editorDivFocus.bind(this);
        #i = this.editorDivInput.bind(this);
        #s = this.editorDivKeydown.bind(this);
        #r = this.editorDivPaste.bind(this);
        #n;
        #a = "";
        #c = `${this.id}-editor`;
        #l;
        #d = null;
        static _freeTextDefaultContent = "";
        static _internalPadding = 0;
        static _defaultColor = null;
        static _defaultFontSize = 10;
        static get _keyboardManager() {
          const i = o.prototype, r = (R) => R.isEmpty(), v = f.AnnotationEditorUIManager.TRANSLATE_SMALL, y = f.AnnotationEditorUIManager.TRANSLATE_BIG;
          return (0, e.shadow)(this, "_keyboardManager", new f.KeyboardManager([[["ctrl+s", "mac+meta+s", "ctrl+p", "mac+meta+p"], i.commitOrRemove, {
            bubbles: !0
          }], [["ctrl+Enter", "mac+meta+Enter", "Escape", "mac+Escape"], i.commitOrRemove], [["ArrowLeft", "mac+ArrowLeft"], i._translateEmpty, {
            args: [-v, 0],
            checker: r
          }], [["ctrl+ArrowLeft", "mac+shift+ArrowLeft"], i._translateEmpty, {
            args: [-y, 0],
            checker: r
          }], [["ArrowRight", "mac+ArrowRight"], i._translateEmpty, {
            args: [v, 0],
            checker: r
          }], [["ctrl+ArrowRight", "mac+shift+ArrowRight"], i._translateEmpty, {
            args: [y, 0],
            checker: r
          }], [["ArrowUp", "mac+ArrowUp"], i._translateEmpty, {
            args: [0, -v],
            checker: r
          }], [["ctrl+ArrowUp", "mac+shift+ArrowUp"], i._translateEmpty, {
            args: [0, -y],
            checker: r
          }], [["ArrowDown", "mac+ArrowDown"], i._translateEmpty, {
            args: [0, v],
            checker: r
          }], [["ctrl+ArrowDown", "mac+shift+ArrowDown"], i._translateEmpty, {
            args: [0, y],
            checker: r
          }]]));
        }
        static _type = "freetext";
        static _editorType = e.AnnotationEditorType.FREETEXT;
        constructor(i) {
          super({
            ...i,
            name: "freeTextEditor"
          }), this.#n = i.color || o._defaultColor || u.AnnotationEditor._defaultLineColor, this.#l = i.fontSize || o._defaultFontSize;
        }
        static initialize(i, r) {
          u.AnnotationEditor.initialize(i, r, {
            strings: ["pdfjs-free-text-default-content"]
          });
          const v = getComputedStyle(document.documentElement);
          this._internalPadding = parseFloat(v.getPropertyValue("--freetext-padding"));
        }
        static updateDefaultParams(i, r) {
          switch (i) {
            case e.AnnotationEditorParamsType.FREETEXT_SIZE:
              o._defaultFontSize = r;
              break;
            case e.AnnotationEditorParamsType.FREETEXT_COLOR:
              o._defaultColor = r;
              break;
          }
        }
        updateParams(i, r) {
          switch (i) {
            case e.AnnotationEditorParamsType.FREETEXT_SIZE:
              this.#u(r);
              break;
            case e.AnnotationEditorParamsType.FREETEXT_COLOR:
              this.#h(r);
              break;
          }
        }
        static get defaultPropertiesToUpdate() {
          return [[e.AnnotationEditorParamsType.FREETEXT_SIZE, o._defaultFontSize], [e.AnnotationEditorParamsType.FREETEXT_COLOR, o._defaultColor || u.AnnotationEditor._defaultLineColor]];
        }
        get propertiesToUpdate() {
          return [[e.AnnotationEditorParamsType.FREETEXT_SIZE, this.#l], [e.AnnotationEditorParamsType.FREETEXT_COLOR, this.#n]];
        }
        #u(i) {
          const r = (y) => {
            this.editorDiv.style.fontSize = `calc(${y}px * var(--scale-factor))`, this.translate(0, -(y - this.#l) * this.parentScale), this.#l = y, this.#p();
          }, v = this.#l;
          this.addCommands({
            cmd: r.bind(this, i),
            undo: r.bind(this, v),
            post: this._uiManager.updateUI.bind(this._uiManager, this),
            mustExec: !0,
            type: e.AnnotationEditorParamsType.FREETEXT_SIZE,
            overwriteIfSameType: !0,
            keepUndo: !0
          });
        }
        #h(i) {
          const r = (y) => {
            this.#n = this.editorDiv.style.color = y;
          }, v = this.#n;
          this.addCommands({
            cmd: r.bind(this, i),
            undo: r.bind(this, v),
            post: this._uiManager.updateUI.bind(this._uiManager, this),
            mustExec: !0,
            type: e.AnnotationEditorParamsType.FREETEXT_COLOR,
            overwriteIfSameType: !0,
            keepUndo: !0
          });
        }
        _translateEmpty(i, r) {
          this._uiManager.translateSelectedEditors(i, r, !0);
        }
        getInitialTranslation() {
          const i = this.parentScale;
          return [-o._internalPadding * i, -(o._internalPadding + this.#l) * i];
        }
        rebuild() {
          this.parent && (super.rebuild(), this.div !== null && (this.isAttachedToDOM || this.parent.add(this)));
        }
        enableEditMode() {
          this.isInEditMode() || (this.parent.setEditingState(!1), this.parent.updateToolbar(e.AnnotationEditorType.FREETEXT), super.enableEditMode(), this.overlayDiv.classList.remove("enabled"), this.editorDiv.contentEditable = !0, this._isDraggable = !1, this.div.removeAttribute("aria-activedescendant"), this.editorDiv.addEventListener("keydown", this.#s), this.editorDiv.addEventListener("focus", this.#e), this.editorDiv.addEventListener("blur", this.#t), this.editorDiv.addEventListener("input", this.#i), this.editorDiv.addEventListener("paste", this.#r));
        }
        disableEditMode() {
          this.isInEditMode() && (this.parent.setEditingState(!0), super.disableEditMode(), this.overlayDiv.classList.add("enabled"), this.editorDiv.contentEditable = !1, this.div.setAttribute("aria-activedescendant", this.#c), this._isDraggable = !0, this.editorDiv.removeEventListener("keydown", this.#s), this.editorDiv.removeEventListener("focus", this.#e), this.editorDiv.removeEventListener("blur", this.#t), this.editorDiv.removeEventListener("input", this.#i), this.editorDiv.removeEventListener("paste", this.#r), this.div.focus({
            preventScroll: !0
          }), this.isEditing = !1, this.parent.div.classList.add("freetextEditing"));
        }
        focusin(i) {
          this._focusEventsAllowed && (super.focusin(i), i.target !== this.editorDiv && this.editorDiv.focus());
        }
        onceAdded() {
          this.width || (this.enableEditMode(), this.editorDiv.focus(), this._initialOptions?.isCentered && this.center(), this._initialOptions = null);
        }
        isEmpty() {
          return !this.editorDiv || this.editorDiv.innerText.trim() === "";
        }
        remove() {
          this.isEditing = !1, this.parent && (this.parent.setEditingState(!0), this.parent.div.classList.add("freetextEditing")), super.remove();
        }
        #o() {
          const i = [];
          this.editorDiv.normalize();
          for (const r of this.editorDiv.childNodes)
            i.push(o.#g(r));
          return i.join(`
`);
        }
        #p() {
          const [i, r] = this.parentDimensions;
          let v;
          if (this.isAttachedToDOM)
            v = this.div.getBoundingClientRect();
          else {
            const {
              currentLayer: y,
              div: R
            } = this, F = R.style.display, I = R.classList.contains("hidden");
            R.classList.remove("hidden"), R.style.display = "hidden", y.div.append(this.div), v = R.getBoundingClientRect(), R.remove(), R.style.display = F, R.classList.toggle("hidden", I);
          }
          this.rotation % 180 === this.parentRotation % 180 ? (this.width = v.width / i, this.height = v.height / r) : (this.width = v.height / i, this.height = v.width / r), this.fixAndSetPosition();
        }
        commit() {
          if (!this.isInEditMode())
            return;
          super.commit(), this.disableEditMode();
          const i = this.#a, r = this.#a = this.#o().trimEnd();
          if (i === r)
            return;
          const v = (y) => {
            if (this.#a = y, !y) {
              this.remove();
              return;
            }
            this.#f(), this._uiManager.rebuild(this), this.#p();
          };
          this.addCommands({
            cmd: () => {
              v(r);
            },
            undo: () => {
              v(i);
            },
            mustExec: !1
          }), this.#p();
        }
        shouldGetKeyboardEvents() {
          return this.isInEditMode();
        }
        enterInEditMode() {
          this.enableEditMode(), this.editorDiv.focus();
        }
        dblclick(i) {
          this.enterInEditMode();
        }
        keydown(i) {
          i.target === this.div && i.key === "Enter" && (this.enterInEditMode(), i.preventDefault());
        }
        editorDivKeydown(i) {
          o._keyboardManager.exec(this, i);
        }
        editorDivFocus(i) {
          this.isEditing = !0;
        }
        editorDivBlur(i) {
          this.isEditing = !1;
        }
        editorDivInput(i) {
          this.parent.div.classList.toggle("freetextEditing", this.isEmpty());
        }
        disableEditing() {
          this.editorDiv.setAttribute("role", "comment"), this.editorDiv.removeAttribute("aria-multiline");
        }
        enableEditing() {
          this.editorDiv.setAttribute("role", "textbox"), this.editorDiv.setAttribute("aria-multiline", !0);
        }
        render() {
          if (this.div)
            return this.div;
          let i, r;
          this.width && (i = this.x, r = this.y), super.render(), this.editorDiv = document.createElement("div"), this.editorDiv.className = "internal", this.editorDiv.setAttribute("id", this.#c), this.editorDiv.setAttribute("data-l10n-id", "pdfjs-free-text"), this.enableEditing(), u.AnnotationEditor._l10nPromise.get("pdfjs-free-text-default-content").then((y) => this.editorDiv?.setAttribute("default-content", y)), this.editorDiv.contentEditable = !0;
          const {
            style: v
          } = this.editorDiv;
          if (v.fontSize = `calc(${this.#l}px * var(--scale-factor))`, v.color = this.#n, this.div.append(this.editorDiv), this.overlayDiv = document.createElement("div"), this.overlayDiv.classList.add("overlay", "enabled"), this.div.append(this.overlayDiv), (0, f.bindEvents)(this, this.div, ["dblclick", "keydown"]), this.width) {
            const [y, R] = this.parentDimensions;
            if (this.annotationElementId) {
              const {
                position: F
              } = this.#d;
              let [I, H] = this.getInitialTranslation();
              [I, H] = this.pageTranslationToScreen(I, H);
              const [B, U] = this.pageDimensions, [X, Z] = this.pageTranslation;
              let lt, Y;
              switch (this.rotation) {
                case 0:
                  lt = i + (F[0] - X) / B, Y = r + this.height - (F[1] - Z) / U;
                  break;
                case 90:
                  lt = i + (F[0] - X) / B, Y = r - (F[1] - Z) / U, [I, H] = [H, -I];
                  break;
                case 180:
                  lt = i - this.width + (F[0] - X) / B, Y = r - (F[1] - Z) / U, [I, H] = [-I, -H];
                  break;
                case 270:
                  lt = i + (F[0] - X - this.height * U) / B, Y = r + (F[1] - Z - this.width * B) / U, [I, H] = [-H, I];
                  break;
              }
              this.setAt(lt * y, Y * R, I, H);
            } else
              this.setAt(i * y, r * R, this.width * y, this.height * R);
            this.#f(), this._isDraggable = !0, this.editorDiv.contentEditable = !1;
          } else
            this._isDraggable = !1, this.editorDiv.contentEditable = !0;
          return this.div;
        }
        static #g(i) {
          return (i.nodeType === Node.TEXT_NODE ? i.nodeValue : i.innerText).replaceAll(m, "");
        }
        editorDivPaste(i) {
          const r = i.clipboardData || window.clipboardData, {
            types: v
          } = r;
          if (v.length === 1 && v[0] === "text/plain")
            return;
          i.preventDefault();
          const y = o.#m(r.getData("text") || "").replaceAll(m, `
`);
          if (!y)
            return;
          const R = window.getSelection();
          if (!R.rangeCount)
            return;
          this.editorDiv.normalize(), R.deleteFromDocument();
          const F = R.getRangeAt(0);
          if (!y.includes(`
`)) {
            F.insertNode(document.createTextNode(y)), this.editorDiv.normalize(), R.collapseToStart();
            return;
          }
          const {
            startContainer: I,
            startOffset: H
          } = F, B = [], U = [];
          if (I.nodeType === Node.TEXT_NODE) {
            const lt = I.parentElement;
            if (U.push(I.nodeValue.slice(H).replaceAll(m, "")), lt !== this.editorDiv) {
              let Y = B;
              for (const V of this.editorDiv.childNodes) {
                if (V === lt) {
                  Y = U;
                  continue;
                }
                Y.push(o.#g(V));
              }
            }
            B.push(I.nodeValue.slice(0, H).replaceAll(m, ""));
          } else if (I === this.editorDiv) {
            let lt = B, Y = 0;
            for (const V of this.editorDiv.childNodes)
              Y++ === H && (lt = U), lt.push(o.#g(V));
          }
          this.#a = `${B.join(`
`)}${y}${U.join(`
`)}`, this.#f();
          const X = new Range();
          let Z = B.reduce((lt, Y) => lt + Y.length, 0);
          for (const {
            firstChild: lt
          } of this.editorDiv.childNodes)
            if (lt.nodeType === Node.TEXT_NODE) {
              const Y = lt.nodeValue.length;
              if (Z <= Y) {
                X.setStart(lt, Z), X.setEnd(lt, Z);
                break;
              }
              Z -= Y;
            }
          R.removeAllRanges(), R.addRange(X);
        }
        #f() {
          if (this.editorDiv.replaceChildren(), !!this.#a)
            for (const i of this.#a.split(`
`)) {
              const r = document.createElement("div");
              r.append(i ? document.createTextNode(i) : document.createElement("br")), this.editorDiv.append(r);
            }
        }
        #A() {
          return this.#a.replaceAll(" ", " ");
        }
        static #m(i) {
          return i.replaceAll(" ", " ");
        }
        get contentDiv() {
          return this.editorDiv;
        }
        static deserialize(i, r, v) {
          let y = null;
          if (i instanceof k.FreeTextAnnotationElement) {
            const {
              data: {
                defaultAppearanceData: {
                  fontSize: F,
                  fontColor: I
                },
                rect: H,
                rotation: B,
                id: U
              },
              textContent: X,
              textPosition: Z,
              parent: {
                page: {
                  pageNumber: lt
                }
              }
            } = i;
            if (!X || X.length === 0)
              return null;
            y = i = {
              annotationType: e.AnnotationEditorType.FREETEXT,
              color: Array.from(I),
              fontSize: F,
              value: X.join(`
`),
              position: Z,
              pageIndex: lt - 1,
              rect: H.slice(0),
              rotation: B,
              id: U,
              deleted: !1
            };
          }
          const R = super.deserialize(i, r, v);
          return R.#l = i.fontSize, R.#n = e.Util.makeHexColor(...i.color), R.#a = o.#m(i.value), R.annotationElementId = i.id || null, R.#d = y, R;
        }
        serialize(i = !1) {
          if (this.isEmpty())
            return null;
          if (this.deleted)
            return {
              pageIndex: this.pageIndex,
              id: this.annotationElementId,
              deleted: !0
            };
          const r = o._internalPadding * this.parentScale, v = this.getRect(r, r), y = u.AnnotationEditor._colorManager.convert(this.isAttachedToDOM ? getComputedStyle(this.editorDiv).color : this.#n), R = {
            annotationType: e.AnnotationEditorType.FREETEXT,
            color: y,
            fontSize: this.#l,
            value: this.#A(),
            pageIndex: this.pageIndex,
            rect: v,
            rotation: this.rotation,
            structTreeParentId: this._structTreeParentId
          };
          return i ? R : this.annotationElementId && !this.#v(R) ? null : (R.id = this.annotationElementId, R);
        }
        #v(i) {
          const {
            value: r,
            fontSize: v,
            color: y,
            pageIndex: R
          } = this.#d;
          return this._hasBeenMoved || i.value !== r || i.fontSize !== v || i.color.some((F, I) => F !== y[I]) || i.pageIndex !== R;
        }
        renderAnnotationElement(i) {
          const r = super.renderAnnotationElement(i);
          if (this.deleted)
            return r;
          const {
            style: v
          } = r;
          v.fontSize = `calc(${this.#l}px * var(--scale-factor))`, v.color = this.#n, r.replaceChildren();
          for (const R of this.#a.split(`
`)) {
            const F = document.createElement("div");
            F.append(R ? document.createTextNode(R) : document.createElement("br")), r.append(F);
          }
          const y = o._internalPadding * this.parentScale;
          return i.updateEdited({
            rect: this.getRect(y, y)
          }), r;
        }
        resetAnnotationElement(i) {
          super.resetAnnotationElement(i), i.resetEdited();
        }
      }
      var l = n(61), c = n(259), s = n(419);
      class p extends u.AnnotationEditor {
        #t = null;
        #e = 0;
        #i;
        #s = null;
        #r = null;
        #n = null;
        #a = null;
        #c = 0;
        #l = null;
        #d = null;
        #u = null;
        #h = !1;
        #o = this.#S.bind(this);
        #p = null;
        #g;
        #f = null;
        #A = "";
        #m;
        #v = "";
        static _defaultColor = null;
        static _defaultOpacity = 1;
        static _defaultThickness = 12;
        static _l10nPromise;
        static _type = "highlight";
        static _editorType = e.AnnotationEditorType.HIGHLIGHT;
        static _freeHighlightId = -1;
        static _freeHighlight = null;
        static _freeHighlightClipId = "";
        static get _keyboardManager() {
          const i = p.prototype;
          return (0, e.shadow)(this, "_keyboardManager", new f.KeyboardManager([[["ArrowLeft", "mac+ArrowLeft"], i._moveCaret, {
            args: [0]
          }], [["ArrowRight", "mac+ArrowRight"], i._moveCaret, {
            args: [1]
          }], [["ArrowUp", "mac+ArrowUp"], i._moveCaret, {
            args: [2]
          }], [["ArrowDown", "mac+ArrowDown"], i._moveCaret, {
            args: [3]
          }]]));
        }
        constructor(i) {
          super({
            ...i,
            name: "highlightEditor"
          }), this.color = i.color || p._defaultColor, this.#m = i.thickness || p._defaultThickness, this.#g = i.opacity || p._defaultOpacity, this.#i = i.boxes || null, this.#v = i.methodOfCreation || "", this.#A = i.text || "", this._isDraggable = !1, i.highlightId > -1 ? (this.#h = !0, this.#C(i), this.#b()) : (this.#t = i.anchorNode, this.#e = i.anchorOffset, this.#a = i.focusNode, this.#c = i.focusOffset, this.#w(), this.#b(), this.rotate(this.rotation));
        }
        get telemetryInitialData() {
          return {
            action: "added",
            type: this.#h ? "free_highlight" : "highlight",
            color: this._uiManager.highlightColorNames.get(this.color),
            thickness: this.#m,
            methodOfCreation: this.#v
          };
        }
        get telemetryFinalData() {
          return {
            type: "highlight",
            color: this._uiManager.highlightColorNames.get(this.color)
          };
        }
        static computeTelemetryFinalData(i) {
          return {
            numberOfColors: i.get("color").size
          };
        }
        #w() {
          const i = new l.Outliner(this.#i, 1e-3);
          this.#d = i.getOutlines(), {
            x: this.x,
            y: this.y,
            width: this.width,
            height: this.height
          } = this.#d.box;
          const r = new l.Outliner(this.#i, 25e-4, 1e-3, this._uiManager.direction === "ltr");
          this.#n = r.getOutlines();
          const {
            lastPoint: v
          } = this.#n.box;
          this.#p = [(v[0] - this.x) / this.width, (v[1] - this.y) / this.height];
        }
        #C({
          highlightOutlines: i,
          highlightId: r,
          clipPathId: v
        }) {
          this.#d = i;
          const y = 1.5;
          if (this.#n = i.getNewOutline(this.#m / 2 + y, 25e-4), r >= 0)
            this.#u = r, this.#s = v, this.parent.drawLayer.finalizeLine(r, i), this.#f = this.parent.drawLayer.highlightOutline(this.#n);
          else if (this.parent) {
            const U = this.parent.viewport.rotation;
            this.parent.drawLayer.updateLine(this.#u, i), this.parent.drawLayer.updateBox(this.#u, p.#_(this.#d.box, (U - this.rotation + 360) % 360)), this.parent.drawLayer.updateLine(this.#f, this.#n), this.parent.drawLayer.updateBox(this.#f, p.#_(this.#n.box, U));
          }
          const {
            x: R,
            y: F,
            width: I,
            height: H
          } = i.box;
          switch (this.rotation) {
            case 0:
              this.x = R, this.y = F, this.width = I, this.height = H;
              break;
            case 90: {
              const [U, X] = this.parentDimensions;
              this.x = F, this.y = 1 - R, this.width = I * X / U, this.height = H * U / X;
              break;
            }
            case 180:
              this.x = 1 - R, this.y = 1 - F, this.width = I, this.height = H;
              break;
            case 270: {
              const [U, X] = this.parentDimensions;
              this.x = 1 - F, this.y = R, this.width = I * X / U, this.height = H * U / X;
              break;
            }
          }
          const {
            lastPoint: B
          } = this.#n.box;
          this.#p = [(B[0] - R) / I, (B[1] - F) / H];
        }
        static initialize(i, r) {
          u.AnnotationEditor.initialize(i, r), p._defaultColor ||= r.highlightColors?.values().next().value || "#fff066";
        }
        static updateDefaultParams(i, r) {
          switch (i) {
            case e.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:
              p._defaultColor = r;
              break;
            case e.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:
              p._defaultThickness = r;
              break;
          }
        }
        translateInPage(i, r) {
        }
        get toolbarPosition() {
          return this.#p;
        }
        updateParams(i, r) {
          switch (i) {
            case e.AnnotationEditorParamsType.HIGHLIGHT_COLOR:
              this.#k(r);
              break;
            case e.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:
              this.#I(r);
              break;
          }
        }
        static get defaultPropertiesToUpdate() {
          return [[e.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR, p._defaultColor], [e.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS, p._defaultThickness]];
        }
        get propertiesToUpdate() {
          return [[e.AnnotationEditorParamsType.HIGHLIGHT_COLOR, this.color || p._defaultColor], [e.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS, this.#m || p._defaultThickness], [e.AnnotationEditorParamsType.HIGHLIGHT_FREE, this.#h]];
        }
        #k(i) {
          const r = (y) => {
            this.color = y, this.parent?.drawLayer.changeColor(this.#u, y), this.#r?.updateColor(y);
          }, v = this.color;
          this.addCommands({
            cmd: r.bind(this, i),
            undo: r.bind(this, v),
            post: this._uiManager.updateUI.bind(this._uiManager, this),
            mustExec: !0,
            type: e.AnnotationEditorParamsType.HIGHLIGHT_COLOR,
            overwriteIfSameType: !0,
            keepUndo: !0
          }), this._reportTelemetry({
            action: "color_changed",
            color: this._uiManager.highlightColorNames.get(i)
          }, !0);
        }
        #I(i) {
          const r = this.#m, v = (y) => {
            this.#m = y, this.#F(y);
          };
          this.addCommands({
            cmd: v.bind(this, i),
            undo: v.bind(this, r),
            post: this._uiManager.updateUI.bind(this._uiManager, this),
            mustExec: !0,
            type: e.AnnotationEditorParamsType.INK_THICKNESS,
            overwriteIfSameType: !0,
            keepUndo: !0
          }), this._reportTelemetry({
            action: "thickness_changed",
            thickness: i
          }, !0);
        }
        async addEditToolbar() {
          const i = await super.addEditToolbar();
          return i ? (this._uiManager.highlightColors && (this.#r = new c.ColorPicker({
            editor: this
          }), i.addColorPicker(this.#r)), i) : null;
        }
        disableEditing() {
          super.disableEditing(), this.div.classList.toggle("disabled", !0);
        }
        enableEditing() {
          super.enableEditing(), this.div.classList.toggle("disabled", !1);
        }
        fixAndSetPosition() {
          return super.fixAndSetPosition(this.#T());
        }
        getBaseTranslation() {
          return [0, 0];
        }
        getRect(i, r) {
          return super.getRect(i, r, this.#T());
        }
        onceAdded() {
          this.parent.addUndoableEditor(this), this.div.focus();
        }
        remove() {
          this.#y(), this._reportTelemetry({
            action: "deleted"
          }), super.remove();
        }
        rebuild() {
          this.parent && (super.rebuild(), this.div !== null && (this.#b(), this.isAttachedToDOM || this.parent.add(this)));
        }
        setParent(i) {
          let r = !1;
          this.parent && !i ? this.#y() : i && (this.#b(i), r = !this.parent && this.div?.classList.contains("selectedEditor")), super.setParent(i), this.show(this._isVisible), r && this.select();
        }
        #F(i) {
          if (!this.#h)
            return;
          this.#C({
            highlightOutlines: this.#d.getNewOutline(i / 2)
          }), this.fixAndSetPosition();
          const [r, v] = this.parentDimensions;
          this.setDims(this.width * r, this.height * v);
        }
        #y() {
          this.#u === null || !this.parent || (this.parent.drawLayer.remove(this.#u), this.#u = null, this.parent.drawLayer.remove(this.#f), this.#f = null);
        }
        #b(i = this.parent) {
          this.#u === null && ({
            id: this.#u,
            clipPathId: this.#s
          } = i.drawLayer.highlight(this.#d, this.color, this.#g), this.#f = i.drawLayer.highlightOutline(this.#n), this.#l && (this.#l.style.clipPath = this.#s));
        }
        static #_({
          x: i,
          y: r,
          width: v,
          height: y
        }, R) {
          switch (R) {
            case 90:
              return {
                x: 1 - r - y,
                y: i,
                width: y,
                height: v
              };
            case 180:
              return {
                x: 1 - i - v,
                y: 1 - r - y,
                width: v,
                height: y
              };
            case 270:
              return {
                x: r,
                y: 1 - i - v,
                width: y,
                height: v
              };
          }
          return {
            x: i,
            y: r,
            width: v,
            height: y
          };
        }
        rotate(i) {
          const {
            drawLayer: r
          } = this.parent;
          let v;
          this.#h ? (i = (i - this.rotation + 360) % 360, v = p.#_(this.#d.box, i)) : v = p.#_(this, i), r.rotate(this.#u, i), r.rotate(this.#f, i), r.updateBox(this.#u, v), r.updateBox(this.#f, p.#_(this.#n.box, i));
        }
        render() {
          if (this.div)
            return this.div;
          const i = super.render();
          this.#A && (i.setAttribute("aria-label", this.#A), i.setAttribute("role", "mark")), this.#h ? i.classList.add("free") : this.div.addEventListener("keydown", this.#o);
          const r = this.#l = document.createElement("div");
          i.append(r), r.setAttribute("aria-hidden", "true"), r.className = "internal", r.style.clipPath = this.#s;
          const [v, y] = this.parentDimensions;
          return this.setDims(this.width * v, this.height * y), (0, f.bindEvents)(this, this.#l, ["pointerover", "pointerleave"]), this.enableEditing(), i;
        }
        pointerover() {
          this.parent.drawLayer.addClass(this.#f, "hovered");
        }
        pointerleave() {
          this.parent.drawLayer.removeClass(this.#f, "hovered");
        }
        #S(i) {
          p._keyboardManager.exec(this, i);
        }
        _moveCaret(i) {
          switch (this.parent.unselect(this), i) {
            case 0:
            case 2:
              this.#R(!0);
              break;
            case 1:
            case 3:
              this.#R(!1);
              break;
          }
        }
        #R(i) {
          if (!this.#t)
            return;
          const r = window.getSelection();
          i ? r.setPosition(this.#t, this.#e) : r.setPosition(this.#a, this.#c);
        }
        select() {
          super.select(), this.#f && (this.parent?.drawLayer.removeClass(this.#f, "hovered"), this.parent?.drawLayer.addClass(this.#f, "selected"));
        }
        unselect() {
          super.unselect(), this.#f && (this.parent?.drawLayer.removeClass(this.#f, "selected"), this.#h || this.#R(!1));
        }
        get _mustFixPosition() {
          return !this.#h;
        }
        show(i = this._isVisible) {
          super.show(i), this.parent && (this.parent.drawLayer.show(this.#u, i), this.parent.drawLayer.show(this.#f, i));
        }
        #T() {
          return this.#h ? this.rotation : 0;
        }
        #M() {
          if (this.#h)
            return null;
          const [i, r] = this.pageDimensions, v = this.#i, y = new Array(v.length * 8);
          let R = 0;
          for (const {
            x: F,
            y: I,
            width: H,
            height: B
          } of v) {
            const U = F * i, X = (1 - I - B) * r;
            y[R] = y[R + 4] = U, y[R + 1] = y[R + 3] = X, y[R + 2] = y[R + 6] = U + H * i, y[R + 5] = y[R + 7] = X + B * r, R += 8;
          }
          return y;
        }
        #x(i) {
          return this.#d.serialize(i, this.#T());
        }
        static startHighlighting(i, r, {
          target: v,
          x: y,
          y: R
        }) {
          const {
            x: F,
            y: I,
            width: H,
            height: B
          } = v.getBoundingClientRect(), U = (Y) => {
            this.#P(i, Y);
          }, X = {
            capture: !0,
            passive: !1
          }, Z = (Y) => {
            Y.preventDefault(), Y.stopPropagation();
          }, lt = (Y) => {
            v.removeEventListener("pointermove", U), window.removeEventListener("blur", lt), window.removeEventListener("pointerup", lt), window.removeEventListener("pointerdown", Z, X), window.removeEventListener("contextmenu", s.noContextMenu), this.#L(i, Y);
          };
          window.addEventListener("blur", lt), window.addEventListener("pointerup", lt), window.addEventListener("pointerdown", Z, X), window.addEventListener("contextmenu", s.noContextMenu), v.addEventListener("pointermove", U), this._freeHighlight = new l.FreeOutliner({
            x: y,
            y: R
          }, [F, I, H, B], i.scale, this._defaultThickness / 2, r, 1e-3), {
            id: this._freeHighlightId,
            clipPathId: this._freeHighlightClipId
          } = i.drawLayer.highlight(this._freeHighlight, this._defaultColor, this._defaultOpacity, !0);
        }
        static #P(i, r) {
          this._freeHighlight.add(r) && i.drawLayer.updatePath(this._freeHighlightId, this._freeHighlight);
        }
        static #L(i, r) {
          this._freeHighlight.isEmpty() ? i.drawLayer.removeFreeHighlight(this._freeHighlightId) : i.createAndAddNewEditor(r, !1, {
            highlightId: this._freeHighlightId,
            highlightOutlines: this._freeHighlight.getOutlines(),
            clipPathId: this._freeHighlightClipId,
            methodOfCreation: "main_toolbar"
          }), this._freeHighlightId = -1, this._freeHighlight = null, this._freeHighlightClipId = "";
        }
        static deserialize(i, r, v) {
          const y = super.deserialize(i, r, v), {
            rect: [R, F, I, H],
            color: B,
            quadPoints: U
          } = i;
          y.color = e.Util.makeHexColor(...B), y.#g = i.opacity;
          const [X, Z] = y.pageDimensions;
          y.width = (I - R) / X, y.height = (H - F) / Z;
          const lt = y.#i = [];
          for (let Y = 0; Y < U.length; Y += 8)
            lt.push({
              x: (U[4] - I) / X,
              y: (H - (1 - U[Y + 5])) / Z,
              width: (U[Y + 2] - U[Y]) / X,
              height: (U[Y + 5] - U[Y + 1]) / Z
            });
          return y.#w(), y;
        }
        serialize(i = !1) {
          if (this.isEmpty() || i)
            return null;
          const r = this.getRect(0, 0), v = u.AnnotationEditor._colorManager.convert(this.color);
          return {
            annotationType: e.AnnotationEditorType.HIGHLIGHT,
            color: v,
            opacity: this.#g,
            thickness: this.#m,
            quadPoints: this.#M(),
            outlines: this.#x(r),
            pageIndex: this.pageIndex,
            rect: r,
            rotation: this.#T(),
            structTreeParentId: this._structTreeParentId
          };
        }
        static canCreateNewEmptyEditor() {
          return !1;
        }
      }
      class b extends u.AnnotationEditor {
        #t = 0;
        #e = 0;
        #i = this.canvasPointermove.bind(this);
        #s = this.canvasPointerleave.bind(this);
        #r = this.canvasPointerup.bind(this);
        #n = this.canvasPointerdown.bind(this);
        #a = null;
        #c = new Path2D();
        #l = !1;
        #d = !1;
        #u = !1;
        #h = null;
        #o = 0;
        #p = 0;
        #g = null;
        static _defaultColor = null;
        static _defaultOpacity = 1;
        static _defaultThickness = 1;
        static _type = "ink";
        static _editorType = e.AnnotationEditorType.INK;
        constructor(i) {
          super({
            ...i,
            name: "inkEditor"
          }), this.color = i.color || null, this.thickness = i.thickness || null, this.opacity = i.opacity || null, this.paths = [], this.bezierPath2D = [], this.allRawPaths = [], this.currentPath = [], this.scaleFactor = 1, this.translationX = this.translationY = 0, this.x = 0, this.y = 0, this._willKeepAspectRatio = !0;
        }
        static initialize(i, r) {
          u.AnnotationEditor.initialize(i, r);
        }
        static updateDefaultParams(i, r) {
          switch (i) {
            case e.AnnotationEditorParamsType.INK_THICKNESS:
              b._defaultThickness = r;
              break;
            case e.AnnotationEditorParamsType.INK_COLOR:
              b._defaultColor = r;
              break;
            case e.AnnotationEditorParamsType.INK_OPACITY:
              b._defaultOpacity = r / 100;
              break;
          }
        }
        updateParams(i, r) {
          switch (i) {
            case e.AnnotationEditorParamsType.INK_THICKNESS:
              this.#f(r);
              break;
            case e.AnnotationEditorParamsType.INK_COLOR:
              this.#A(r);
              break;
            case e.AnnotationEditorParamsType.INK_OPACITY:
              this.#m(r);
              break;
          }
        }
        static get defaultPropertiesToUpdate() {
          return [[e.AnnotationEditorParamsType.INK_THICKNESS, b._defaultThickness], [e.AnnotationEditorParamsType.INK_COLOR, b._defaultColor || u.AnnotationEditor._defaultLineColor], [e.AnnotationEditorParamsType.INK_OPACITY, Math.round(b._defaultOpacity * 100)]];
        }
        get propertiesToUpdate() {
          return [[e.AnnotationEditorParamsType.INK_THICKNESS, this.thickness || b._defaultThickness], [e.AnnotationEditorParamsType.INK_COLOR, this.color || b._defaultColor || u.AnnotationEditor._defaultLineColor], [e.AnnotationEditorParamsType.INK_OPACITY, Math.round(100 * (this.opacity ?? b._defaultOpacity))]];
        }
        #f(i) {
          const r = (y) => {
            this.thickness = y, this.#D();
          }, v = this.thickness;
          this.addCommands({
            cmd: r.bind(this, i),
            undo: r.bind(this, v),
            post: this._uiManager.updateUI.bind(this._uiManager, this),
            mustExec: !0,
            type: e.AnnotationEditorParamsType.INK_THICKNESS,
            overwriteIfSameType: !0,
            keepUndo: !0
          });
        }
        #A(i) {
          const r = (y) => {
            this.color = y, this.#S();
          }, v = this.color;
          this.addCommands({
            cmd: r.bind(this, i),
            undo: r.bind(this, v),
            post: this._uiManager.updateUI.bind(this._uiManager, this),
            mustExec: !0,
            type: e.AnnotationEditorParamsType.INK_COLOR,
            overwriteIfSameType: !0,
            keepUndo: !0
          });
        }
        #m(i) {
          const r = (y) => {
            this.opacity = y, this.#S();
          };
          i /= 100;
          const v = this.opacity;
          this.addCommands({
            cmd: r.bind(this, i),
            undo: r.bind(this, v),
            post: this._uiManager.updateUI.bind(this._uiManager, this),
            mustExec: !0,
            type: e.AnnotationEditorParamsType.INK_OPACITY,
            overwriteIfSameType: !0,
            keepUndo: !0
          });
        }
        rebuild() {
          this.parent && (super.rebuild(), this.div !== null && (this.canvas || (this.#T(), this.#M()), this.isAttachedToDOM || (this.parent.add(this), this.#x()), this.#D()));
        }
        remove() {
          this.canvas !== null && (this.isEmpty() || this.commit(), this.canvas.width = this.canvas.height = 0, this.canvas.remove(), this.canvas = null, this.#a && (clearTimeout(this.#a), this.#a = null), this.#h.disconnect(), this.#h = null, super.remove());
        }
        setParent(i) {
          !this.parent && i ? this._uiManager.removeShouldRescale(this) : this.parent && i === null && this._uiManager.addShouldRescale(this), super.setParent(i);
        }
        onScaleChanging() {
          const [i, r] = this.parentDimensions, v = this.width * i, y = this.height * r;
          this.setDimensions(v, y);
        }
        enableEditMode() {
          this.#l || this.canvas === null || (super.enableEditMode(), this._isDraggable = !1, this.canvas.addEventListener("pointerdown", this.#n));
        }
        disableEditMode() {
          !this.isInEditMode() || this.canvas === null || (super.disableEditMode(), this._isDraggable = !this.isEmpty(), this.div.classList.remove("editing"), this.canvas.removeEventListener("pointerdown", this.#n));
        }
        onceAdded() {
          this._isDraggable = !this.isEmpty();
        }
        isEmpty() {
          return this.paths.length === 0 || this.paths.length === 1 && this.paths[0].length === 0;
        }
        #v() {
          const {
            parentRotation: i,
            parentDimensions: [r, v]
          } = this;
          switch (i) {
            case 90:
              return [0, v, v, r];
            case 180:
              return [r, v, r, v];
            case 270:
              return [r, 0, v, r];
            default:
              return [0, 0, r, v];
          }
        }
        #w() {
          const {
            ctx: i,
            color: r,
            opacity: v,
            thickness: y,
            parentScale: R,
            scaleFactor: F
          } = this;
          i.lineWidth = y * R / F, i.lineCap = "round", i.lineJoin = "round", i.miterLimit = 10, i.strokeStyle = `${r}${(0, f.opacityToHex)(v)}`;
        }
        #C(i, r) {
          this.canvas.addEventListener("contextmenu", s.noContextMenu), this.canvas.addEventListener("pointerleave", this.#s), this.canvas.addEventListener("pointermove", this.#i), this.canvas.addEventListener("pointerup", this.#r), this.canvas.removeEventListener("pointerdown", this.#n), this.isEditing = !0, this.#u || (this.#u = !0, this.#x(), this.thickness ||= b._defaultThickness, this.color ||= b._defaultColor || u.AnnotationEditor._defaultLineColor, this.opacity ??= b._defaultOpacity), this.currentPath.push([i, r]), this.#d = !1, this.#w(), this.#g = () => {
            this.#y(), this.#g && window.requestAnimationFrame(this.#g);
          }, window.requestAnimationFrame(this.#g);
        }
        #k(i, r) {
          const [v, y] = this.currentPath.at(-1);
          if (this.currentPath.length > 1 && i === v && r === y)
            return;
          const R = this.currentPath;
          let F = this.#c;
          if (R.push([i, r]), this.#d = !0, R.length <= 2) {
            F.moveTo(...R[0]), F.lineTo(i, r);
            return;
          }
          R.length === 3 && (this.#c = F = new Path2D(), F.moveTo(...R[0])), this.#b(F, ...R.at(-3), ...R.at(-2), i, r);
        }
        #I() {
          if (this.currentPath.length === 0)
            return;
          const i = this.currentPath.at(-1);
          this.#c.lineTo(...i);
        }
        #F(i, r) {
          this.#g = null, i = Math.min(Math.max(i, 0), this.canvas.width), r = Math.min(Math.max(r, 0), this.canvas.height), this.#k(i, r), this.#I();
          let v;
          if (this.currentPath.length !== 1)
            v = this.#_();
          else {
            const H = [i, r];
            v = [[H, H.slice(), H.slice(), H]];
          }
          const y = this.#c, R = this.currentPath;
          this.currentPath = [], this.#c = new Path2D();
          const F = () => {
            this.allRawPaths.push(R), this.paths.push(v), this.bezierPath2D.push(y), this._uiManager.rebuild(this);
          }, I = () => {
            this.allRawPaths.pop(), this.paths.pop(), this.bezierPath2D.pop(), this.paths.length === 0 ? this.remove() : (this.canvas || (this.#T(), this.#M()), this.#D());
          };
          this.addCommands({
            cmd: F,
            undo: I,
            mustExec: !0
          });
        }
        #y() {
          if (!this.#d)
            return;
          this.#d = !1;
          const i = Math.ceil(this.thickness * this.parentScale), r = this.currentPath.slice(-3), v = r.map((F) => F[0]), y = r.map((F) => F[1]);
          Math.min(...v) - i, Math.max(...v) + i, Math.min(...y) - i, Math.max(...y) + i;
          const {
            ctx: R
          } = this;
          R.save(), R.clearRect(0, 0, this.canvas.width, this.canvas.height);
          for (const F of this.bezierPath2D)
            R.stroke(F);
          R.stroke(this.#c), R.restore();
        }
        #b(i, r, v, y, R, F, I) {
          const H = (r + y) / 2, B = (v + R) / 2, U = (y + F) / 2, X = (R + I) / 2;
          i.bezierCurveTo(H + 2 * (y - H) / 3, B + 2 * (R - B) / 3, U + 2 * (y - U) / 3, X + 2 * (R - X) / 3, U, X);
        }
        #_() {
          const i = this.currentPath;
          if (i.length <= 2)
            return [[i[0], i[0], i.at(-1), i.at(-1)]];
          const r = [];
          let v, [y, R] = i[0];
          for (v = 1; v < i.length - 2; v++) {
            const [Z, lt] = i[v], [Y, V] = i[v + 1], j = (Z + Y) / 2, $ = (lt + V) / 2, st = [y + 2 * (Z - y) / 3, R + 2 * (lt - R) / 3], J = [j + 2 * (Z - j) / 3, $ + 2 * (lt - $) / 3];
            r.push([[y, R], st, J, [j, $]]), [y, R] = [j, $];
          }
          const [F, I] = i[v], [H, B] = i[v + 1], U = [y + 2 * (F - y) / 3, R + 2 * (I - R) / 3], X = [H + 2 * (F - H) / 3, B + 2 * (I - B) / 3];
          return r.push([[y, R], U, X, [H, B]]), r;
        }
        #S() {
          if (this.isEmpty()) {
            this.#L();
            return;
          }
          this.#w();
          const {
            canvas: i,
            ctx: r
          } = this;
          r.setTransform(1, 0, 0, 1, 0, 0), r.clearRect(0, 0, i.width, i.height), this.#L();
          for (const v of this.bezierPath2D)
            r.stroke(v);
        }
        commit() {
          this.#l || (super.commit(), this.isEditing = !1, this.disableEditMode(), this.setInForeground(), this.#l = !0, this.div.classList.add("disabled"), this.#D(!0), this.select(), this.parent.addInkEditorIfNeeded(!0), this.moveInDOM(), this.div.focus({
            preventScroll: !0
          }));
        }
        focusin(i) {
          this._focusEventsAllowed && (super.focusin(i), this.enableEditMode());
        }
        canvasPointerdown(i) {
          i.button !== 0 || !this.isInEditMode() || this.#l || (this.setInForeground(), i.preventDefault(), this.div.contains(document.activeElement) || this.div.focus({
            preventScroll: !0
          }), this.#C(i.offsetX, i.offsetY));
        }
        canvasPointermove(i) {
          i.preventDefault(), this.#k(i.offsetX, i.offsetY);
        }
        canvasPointerup(i) {
          i.preventDefault(), this.#R(i);
        }
        canvasPointerleave(i) {
          this.#R(i);
        }
        #R(i) {
          this.canvas.removeEventListener("pointerleave", this.#s), this.canvas.removeEventListener("pointermove", this.#i), this.canvas.removeEventListener("pointerup", this.#r), this.canvas.addEventListener("pointerdown", this.#n), this.#a && clearTimeout(this.#a), this.#a = setTimeout(() => {
            this.#a = null, this.canvas.removeEventListener("contextmenu", s.noContextMenu);
          }, 10), this.#F(i.offsetX, i.offsetY), this.addToAnnotationStorage(), this.setInBackground();
        }
        #T() {
          this.canvas = document.createElement("canvas"), this.canvas.width = this.canvas.height = 0, this.canvas.className = "inkEditorCanvas", this.canvas.setAttribute("data-l10n-id", "pdfjs-ink-canvas"), this.div.append(this.canvas), this.ctx = this.canvas.getContext("2d");
        }
        #M() {
          this.#h = new ResizeObserver((i) => {
            const r = i[0].contentRect;
            r.width && r.height && this.setDimensions(r.width, r.height);
          }), this.#h.observe(this.div);
        }
        get isResizable() {
          return !this.isEmpty() && this.#l;
        }
        render() {
          if (this.div)
            return this.div;
          let i, r;
          this.width && (i = this.x, r = this.y), super.render(), this.div.setAttribute("data-l10n-id", "pdfjs-ink");
          const [v, y, R, F] = this.#v();
          if (this.setAt(v, y, 0, 0), this.setDims(R, F), this.#T(), this.width) {
            const [I, H] = this.parentDimensions;
            this.setAspectRatio(this.width * I, this.height * H), this.setAt(i * I, r * H, this.width * I, this.height * H), this.#u = !0, this.#x(), this.setDims(this.width * I, this.height * H), this.#S(), this.div.classList.add("disabled");
          } else
            this.div.classList.add("editing"), this.enableEditMode();
          return this.#M(), this.div;
        }
        #x() {
          if (!this.#u)
            return;
          const [i, r] = this.parentDimensions;
          this.canvas.width = Math.ceil(this.width * i), this.canvas.height = Math.ceil(this.height * r), this.#L();
        }
        setDimensions(i, r) {
          const v = Math.round(i), y = Math.round(r);
          if (this.#o === v && this.#p === y)
            return;
          this.#o = v, this.#p = y, this.canvas.style.visibility = "hidden";
          const [R, F] = this.parentDimensions;
          this.width = i / R, this.height = r / F, this.fixAndSetPosition(), this.#l && this.#P(i, r), this.#x(), this.#S(), this.canvas.style.visibility = "visible", this.fixDims();
        }
        #P(i, r) {
          const v = this.#z(), y = (i - v) / this.#e, R = (r - v) / this.#t;
          this.scaleFactor = Math.min(y, R);
        }
        #L() {
          const i = this.#z() / 2;
          this.ctx.setTransform(this.scaleFactor, 0, 0, this.scaleFactor, this.translationX * this.scaleFactor + i, this.translationY * this.scaleFactor + i);
        }
        static #N(i) {
          const r = new Path2D();
          for (let v = 0, y = i.length; v < y; v++) {
            const [R, F, I, H] = i[v];
            v === 0 && r.moveTo(...R), r.bezierCurveTo(F[0], F[1], I[0], I[1], H[0], H[1]);
          }
          return r;
        }
        static #U(i, r, v) {
          const [y, R, F, I] = r;
          switch (v) {
            case 0:
              for (let H = 0, B = i.length; H < B; H += 2)
                i[H] += y, i[H + 1] = I - i[H + 1];
              break;
            case 90:
              for (let H = 0, B = i.length; H < B; H += 2) {
                const U = i[H];
                i[H] = i[H + 1] + y, i[H + 1] = U + R;
              }
              break;
            case 180:
              for (let H = 0, B = i.length; H < B; H += 2)
                i[H] = F - i[H], i[H + 1] += R;
              break;
            case 270:
              for (let H = 0, B = i.length; H < B; H += 2) {
                const U = i[H];
                i[H] = F - i[H + 1], i[H + 1] = I - U;
              }
              break;
            default:
              throw new Error("Invalid rotation");
          }
          return i;
        }
        static #X(i, r, v) {
          const [y, R, F, I] = r;
          switch (v) {
            case 0:
              for (let H = 0, B = i.length; H < B; H += 2)
                i[H] -= y, i[H + 1] = I - i[H + 1];
              break;
            case 90:
              for (let H = 0, B = i.length; H < B; H += 2) {
                const U = i[H];
                i[H] = i[H + 1] - R, i[H + 1] = U - y;
              }
              break;
            case 180:
              for (let H = 0, B = i.length; H < B; H += 2)
                i[H] = F - i[H], i[H + 1] -= R;
              break;
            case 270:
              for (let H = 0, B = i.length; H < B; H += 2) {
                const U = i[H];
                i[H] = I - i[H + 1], i[H + 1] = F - U;
              }
              break;
            default:
              throw new Error("Invalid rotation");
          }
          return i;
        }
        #j(i, r, v, y) {
          const R = [], F = this.thickness / 2, I = i * r + F, H = i * v + F;
          for (const B of this.paths) {
            const U = [], X = [];
            for (let Z = 0, lt = B.length; Z < lt; Z++) {
              const [Y, V, j, $] = B[Z];
              if (Y[0] === $[0] && Y[1] === $[1] && lt === 1) {
                const it = i * Y[0] + I, x = i * Y[1] + H;
                U.push(it, x), X.push(it, x);
                break;
              }
              const st = i * Y[0] + I, J = i * Y[1] + H, ht = i * V[0] + I, rt = i * V[1] + H, pt = i * j[0] + I, dt = i * j[1] + H, ut = i * $[0] + I, Q = i * $[1] + H;
              Z === 0 && (U.push(st, J), X.push(st, J)), U.push(ht, rt, pt, dt, ut, Q), X.push(ht, rt), Z === lt - 1 && X.push(ut, Q);
            }
            R.push({
              bezier: b.#U(U, y, this.rotation),
              points: b.#U(X, y, this.rotation)
            });
          }
          return R;
        }
        #G() {
          let i = 1 / 0, r = -1 / 0, v = 1 / 0, y = -1 / 0;
          for (const R of this.paths)
            for (const [F, I, H, B] of R) {
              const U = e.Util.bezierBoundingBox(...F, ...I, ...H, ...B);
              i = Math.min(i, U[0]), v = Math.min(v, U[1]), r = Math.max(r, U[2]), y = Math.max(y, U[3]);
            }
          return [i, v, r, y];
        }
        #z() {
          return this.#l ? Math.ceil(this.thickness * this.parentScale) : 0;
        }
        #D(i = !1) {
          if (this.isEmpty())
            return;
          if (!this.#l) {
            this.#S();
            return;
          }
          const r = this.#G(), v = this.#z();
          this.#e = Math.max(u.AnnotationEditor.MIN_SIZE, r[2] - r[0]), this.#t = Math.max(u.AnnotationEditor.MIN_SIZE, r[3] - r[1]);
          const y = Math.ceil(v + this.#e * this.scaleFactor), R = Math.ceil(v + this.#t * this.scaleFactor), [F, I] = this.parentDimensions;
          this.width = y / F, this.height = R / I, this.setAspectRatio(y, R);
          const H = this.translationX, B = this.translationY;
          this.translationX = -r[0], this.translationY = -r[1], this.#x(), this.#S(), this.#o = y, this.#p = R, this.setDims(y, R);
          const U = i ? v / this.scaleFactor / 2 : 0;
          this.translate(H - this.translationX - U, B - this.translationY - U);
        }
        static deserialize(i, r, v) {
          if (i instanceof k.InkAnnotationElement)
            return null;
          const y = super.deserialize(i, r, v);
          y.thickness = i.thickness, y.color = e.Util.makeHexColor(...i.color), y.opacity = i.opacity;
          const [R, F] = y.pageDimensions, I = y.width * R, H = y.height * F, B = y.parentScale, U = i.thickness / 2;
          y.#l = !0, y.#o = Math.round(I), y.#p = Math.round(H);
          const {
            paths: X,
            rect: Z,
            rotation: lt
          } = i;
          for (let {
            bezier: V
          } of X) {
            V = b.#X(V, Z, lt);
            const j = [];
            y.paths.push(j);
            let $ = B * (V[0] - U), st = B * (V[1] - U);
            for (let ht = 2, rt = V.length; ht < rt; ht += 6) {
              const pt = B * (V[ht] - U), dt = B * (V[ht + 1] - U), ut = B * (V[ht + 2] - U), Q = B * (V[ht + 3] - U), it = B * (V[ht + 4] - U), x = B * (V[ht + 5] - U);
              j.push([[$, st], [pt, dt], [ut, Q], [it, x]]), $ = it, st = x;
            }
            const J = this.#N(j);
            y.bezierPath2D.push(J);
          }
          const Y = y.#G();
          return y.#e = Math.max(u.AnnotationEditor.MIN_SIZE, Y[2] - Y[0]), y.#t = Math.max(u.AnnotationEditor.MIN_SIZE, Y[3] - Y[1]), y.#P(I, H), y;
        }
        serialize() {
          if (this.isEmpty())
            return null;
          const i = this.getRect(0, 0), r = u.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);
          return {
            annotationType: e.AnnotationEditorType.INK,
            color: r,
            thickness: this.thickness,
            opacity: this.opacity,
            paths: this.#j(this.scaleFactor / this.parentScale, this.translationX, this.translationY, i),
            pageIndex: this.pageIndex,
            rect: i,
            rotation: this.rotation,
            structTreeParentId: this._structTreeParentId
          };
        }
      }
      class S extends u.AnnotationEditor {
        #t = null;
        #e = null;
        #i = null;
        #s = null;
        #r = null;
        #n = "";
        #a = null;
        #c = null;
        #l = null;
        #d = !1;
        #u = !1;
        static _type = "stamp";
        static _editorType = e.AnnotationEditorType.STAMP;
        constructor(i) {
          super({
            ...i,
            name: "stampEditor"
          }), this.#s = i.bitmapUrl, this.#r = i.bitmapFile;
        }
        static initialize(i, r) {
          u.AnnotationEditor.initialize(i, r);
        }
        static get supportedTypes() {
          const i = ["apng", "avif", "bmp", "gif", "jpeg", "png", "svg+xml", "webp", "x-icon"];
          return (0, e.shadow)(this, "supportedTypes", i.map((r) => `image/${r}`));
        }
        static get supportedTypesStr() {
          return (0, e.shadow)(this, "supportedTypesStr", this.supportedTypes.join(","));
        }
        static isHandlingMimeForPasting(i) {
          return this.supportedTypes.includes(i);
        }
        static paste(i, r) {
          r.pasteEditor(e.AnnotationEditorType.STAMP, {
            bitmapFile: i.getAsFile()
          });
        }
        #h(i, r = !1) {
          if (!i) {
            this.remove();
            return;
          }
          this.#t = i.bitmap, r || (this.#e = i.id, this.#d = i.isSvg), i.file && (this.#n = i.file.name), this.#g();
        }
        #o() {
          this.#i = null, this._uiManager.enableWaiting(!1), this.#a && this.div.focus();
        }
        #p() {
          if (this.#e) {
            this._uiManager.enableWaiting(!0), this._uiManager.imageManager.getFromId(this.#e).then((r) => this.#h(r, !0)).finally(() => this.#o());
            return;
          }
          if (this.#s) {
            const r = this.#s;
            this.#s = null, this._uiManager.enableWaiting(!0), this.#i = this._uiManager.imageManager.getFromUrl(r).then((v) => this.#h(v)).finally(() => this.#o());
            return;
          }
          if (this.#r) {
            const r = this.#r;
            this.#r = null, this._uiManager.enableWaiting(!0), this.#i = this._uiManager.imageManager.getFromFile(r).then((v) => this.#h(v)).finally(() => this.#o());
            return;
          }
          const i = document.createElement("input");
          i.type = "file", i.accept = S.supportedTypesStr, this.#i = new Promise((r) => {
            i.addEventListener("change", async () => {
              if (!i.files || i.files.length === 0)
                this.remove();
              else {
                this._uiManager.enableWaiting(!0);
                const v = await this._uiManager.imageManager.getFromFile(i.files[0]);
                this.#h(v);
              }
              r();
            }), i.addEventListener("cancel", () => {
              this.remove(), r();
            });
          }).finally(() => this.#o()), i.click();
        }
        remove() {
          this.#e && (this.#t = null, this._uiManager.imageManager.deleteId(this.#e), this.#a?.remove(), this.#a = null, this.#c?.disconnect(), this.#c = null, this.#l && (clearTimeout(this.#l), this.#l = null)), super.remove();
        }
        rebuild() {
          if (!this.parent) {
            this.#e && this.#p();
            return;
          }
          super.rebuild(), this.div !== null && (this.#e && this.#a === null && this.#p(), this.isAttachedToDOM || this.parent.add(this));
        }
        onceAdded() {
          this._isDraggable = !0, this.div.focus();
        }
        isEmpty() {
          return !(this.#i || this.#t || this.#s || this.#r || this.#e);
        }
        get isResizable() {
          return !0;
        }
        render() {
          if (this.div)
            return this.div;
          let i, r;
          if (this.width && (i = this.x, r = this.y), super.render(), this.div.hidden = !0, this.addAltTextButton(), this.#t ? this.#g() : this.#p(), this.width) {
            const [v, y] = this.parentDimensions;
            this.setAt(i * v, r * y, this.width * v, this.height * y);
          }
          return this.div;
        }
        #g() {
          const {
            div: i
          } = this;
          let {
            width: r,
            height: v
          } = this.#t;
          const [y, R] = this.pageDimensions, F = 0.75;
          if (this.width)
            r = this.width * y, v = this.height * R;
          else if (r > F * y || v > F * R) {
            const U = Math.min(F * y / r, F * R / v);
            r *= U, v *= U;
          }
          const [I, H] = this.parentDimensions;
          this.setDims(r * I / y, v * H / R), this._uiManager.enableWaiting(!1);
          const B = this.#a = document.createElement("canvas");
          i.append(B), i.hidden = !1, this.#m(r, v), this.#w(), this.#u || (this.parent.addUndoableEditor(this), this.#u = !0), this._reportTelemetry({
            action: "inserted_image"
          }), this.#n && B.setAttribute("aria-label", this.#n);
        }
        #f(i, r) {
          const [v, y] = this.parentDimensions;
          this.width = i / v, this.height = r / y, this.setDims(i, r), this._initialOptions?.isCentered ? this.center() : this.fixAndSetPosition(), this._initialOptions = null, this.#l !== null && clearTimeout(this.#l);
          const R = 200;
          this.#l = setTimeout(() => {
            this.#l = null, this.#m(i, r);
          }, R);
        }
        #A(i, r) {
          const {
            width: v,
            height: y
          } = this.#t;
          let R = v, F = y, I = this.#t;
          for (; R > 2 * i || F > 2 * r; ) {
            const H = R, B = F;
            R > 2 * i && (R = R >= 16384 ? Math.floor(R / 2) - 1 : Math.ceil(R / 2)), F > 2 * r && (F = F >= 16384 ? Math.floor(F / 2) - 1 : Math.ceil(F / 2));
            const U = new OffscreenCanvas(R, F);
            U.getContext("2d").drawImage(I, 0, 0, H, B, 0, 0, R, F), I = U.transferToImageBitmap();
          }
          return I;
        }
        #m(i, r) {
          i = Math.ceil(i), r = Math.ceil(r);
          const v = this.#a;
          if (!v || v.width === i && v.height === r)
            return;
          v.width = i, v.height = r;
          const y = this.#d ? this.#t : this.#A(i, r);
          if (this._uiManager.hasMLManager && !this.hasAltText()) {
            const F = new OffscreenCanvas(i, r);
            F.getContext("2d").drawImage(y, 0, 0, y.width, y.height, 0, 0, i, r), F.convertToBlob().then((H) => {
              const B = new FileReader();
              B.onload = () => {
                const U = B.result;
                this._uiManager.mlGuess({
                  service: "image-to-text",
                  request: {
                    imageData: U
                  }
                }).then((X) => {
                  const Z = X?.output || "";
                  this.parent && Z && !this.hasAltText() && (this.altTextData = {
                    altText: Z,
                    decorative: !1
                  });
                });
              }, B.readAsDataURL(H);
            });
          }
          const R = v.getContext("2d");
          R.filter = this._uiManager.hcmFilter, R.drawImage(y, 0, 0, y.width, y.height, 0, 0, i, r);
        }
        getImageForAltText() {
          return this.#a;
        }
        #v(i) {
          if (i) {
            if (this.#d) {
              const y = this._uiManager.imageManager.getSvgUrl(this.#e);
              if (y)
                return y;
            }
            const r = document.createElement("canvas");
            return {
              width: r.width,
              height: r.height
            } = this.#t, r.getContext("2d").drawImage(this.#t, 0, 0), r.toDataURL();
          }
          if (this.#d) {
            const [r, v] = this.pageDimensions, y = Math.round(this.width * r * s.PixelsPerInch.PDF_TO_CSS_UNITS), R = Math.round(this.height * v * s.PixelsPerInch.PDF_TO_CSS_UNITS), F = new OffscreenCanvas(y, R);
            return F.getContext("2d").drawImage(this.#t, 0, 0, this.#t.width, this.#t.height, 0, 0, y, R), F.transferToImageBitmap();
          }
          return structuredClone(this.#t);
        }
        #w() {
          this.#c = new ResizeObserver((i) => {
            const r = i[0].contentRect;
            r.width && r.height && this.#f(r.width, r.height);
          }), this.#c.observe(this.div);
        }
        static deserialize(i, r, v) {
          if (i instanceof k.StampAnnotationElement)
            return null;
          const y = super.deserialize(i, r, v), {
            rect: R,
            bitmapUrl: F,
            bitmapId: I,
            isSvg: H,
            accessibilityData: B
          } = i;
          I && v.imageManager.isValidId(I) ? y.#e = I : y.#s = F, y.#d = H;
          const [U, X] = y.pageDimensions;
          return y.width = (R[2] - R[0]) / U, y.height = (R[3] - R[1]) / X, B && (y.altTextData = B), y;
        }
        serialize(i = !1, r = null) {
          if (this.isEmpty())
            return null;
          const v = {
            annotationType: e.AnnotationEditorType.STAMP,
            bitmapId: this.#e,
            pageIndex: this.pageIndex,
            rect: this.getRect(0, 0),
            rotation: this.rotation,
            isSvg: this.#d,
            structTreeParentId: this._structTreeParentId
          };
          if (i)
            return v.bitmapUrl = this.#v(!0), v.accessibilityData = this.altTextData, v;
          const {
            decorative: y,
            altText: R
          } = this.altTextData;
          if (!y && R && (v.accessibilityData = {
            type: "Figure",
            alt: R
          }), r === null)
            return v;
          r.stamps ||= /* @__PURE__ */ new Map();
          const F = this.#d ? (v.rect[2] - v.rect[0]) * (v.rect[3] - v.rect[1]) : null;
          if (!r.stamps.has(this.#e))
            r.stamps.set(this.#e, {
              area: F,
              serialized: v
            }), v.bitmap = this.#v(!1);
          else if (this.#d) {
            const I = r.stamps.get(this.#e);
            F > I.area && (I.area = F, I.serialized.bitmap.close(), I.serialized.bitmap = this.#v(!1));
          }
          return v;
        }
      }
      class a {
        #t;
        #e = !1;
        #i = null;
        #s = null;
        #r = null;
        #n = null;
        #a = null;
        #c = /* @__PURE__ */ new Map();
        #l = !1;
        #d = !1;
        #u = !1;
        #h = null;
        #o;
        static _initialized = !1;
        static #p = new Map([o, b, S, p].map((i) => [i._editorType, i]));
        constructor({
          uiManager: i,
          pageIndex: r,
          div: v,
          accessibilityManager: y,
          annotationLayer: R,
          drawLayer: F,
          textLayer: I,
          viewport: H,
          l10n: B
        }) {
          const U = [...a.#p.values()];
          if (!a._initialized) {
            a._initialized = !0;
            for (const X of U)
              X.initialize(B, i);
          }
          i.registerEditorTypes(U), this.#o = i, this.pageIndex = r, this.div = v, this.#t = y, this.#i = R, this.viewport = H, this.#h = I, this.drawLayer = F, this.#o.addLayer(this);
        }
        get isEmpty() {
          return this.#c.size === 0;
        }
        get isInvisible() {
          return this.isEmpty && this.#o.getMode() === e.AnnotationEditorType.NONE;
        }
        updateToolbar(i) {
          this.#o.updateToolbar(i);
        }
        updateMode(i = this.#o.getMode()) {
          switch (this.#v(), i) {
            case e.AnnotationEditorType.NONE:
              this.disableTextSelection(), this.togglePointerEvents(!1), this.toggleAnnotationLayerPointerEvents(!0), this.disableClick();
              return;
            case e.AnnotationEditorType.INK:
              this.addInkEditorIfNeeded(!1), this.disableTextSelection(), this.togglePointerEvents(!0), this.disableClick();
              break;
            case e.AnnotationEditorType.HIGHLIGHT:
              this.enableTextSelection(), this.togglePointerEvents(!1), this.disableClick();
              break;
            default:
              this.disableTextSelection(), this.togglePointerEvents(!0), this.enableClick();
          }
          this.toggleAnnotationLayerPointerEvents(!1);
          const {
            classList: r
          } = this.div;
          for (const v of a.#p.values())
            r.toggle(`${v._type}Editing`, i === v._editorType);
          this.div.hidden = !1;
        }
        hasTextLayer(i) {
          return i === this.#h?.div;
        }
        addInkEditorIfNeeded(i) {
          if (this.#o.getMode() !== e.AnnotationEditorType.INK)
            return;
          if (!i) {
            for (const v of this.#c.values())
              if (v.isEmpty()) {
                v.setInBackground();
                return;
              }
          }
          this.createAndAddNewEditor({
            offsetX: 0,
            offsetY: 0
          }, !1).setInBackground();
        }
        setEditingState(i) {
          this.#o.setEditingState(i);
        }
        addCommands(i) {
          this.#o.addCommands(i);
        }
        togglePointerEvents(i = !1) {
          this.div.classList.toggle("disabled", !i);
        }
        toggleAnnotationLayerPointerEvents(i = !1) {
          this.#i?.div.classList.toggle("disabled", !i);
        }
        enable() {
          this.div.tabIndex = 0, this.togglePointerEvents(!0);
          const i = /* @__PURE__ */ new Set();
          for (const v of this.#c.values())
            v.enableEditing(), v.show(!0), v.annotationElementId && (this.#o.removeChangedExistingAnnotation(v), i.add(v.annotationElementId));
          if (!this.#i)
            return;
          const r = this.#i.getEditableAnnotations();
          for (const v of r) {
            if (v.hide(), this.#o.isDeletedAnnotationElement(v.data.id) || i.has(v.data.id))
              continue;
            const y = this.deserialize(v);
            y && (this.addOrRebuild(y), y.enableEditing());
          }
        }
        disable() {
          this.#u = !0, this.div.tabIndex = -1, this.togglePointerEvents(!1);
          const i = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
          for (const y of this.#c.values())
            if (y.disableEditing(), !!y.annotationElementId) {
              if (y.serialize() !== null) {
                i.set(y.annotationElementId, y);
                continue;
              } else
                r.set(y.annotationElementId, y);
              this.getEditableAnnotation(y.annotationElementId)?.show(), y.remove();
            }
          if (this.#i) {
            const y = this.#i.getEditableAnnotations();
            for (const R of y) {
              const {
                id: F
              } = R.data;
              if (this.#o.isDeletedAnnotationElement(F))
                continue;
              let I = r.get(F);
              if (I) {
                I.resetAnnotationElement(R), I.show(!1), R.show();
                continue;
              }
              I = i.get(F), I && (this.#o.addChangedExistingAnnotation(I), I.renderAnnotationElement(R), I.show(!1)), R.show();
            }
          }
          this.#v(), this.isEmpty && (this.div.hidden = !0);
          const {
            classList: v
          } = this.div;
          for (const y of a.#p.values())
            v.remove(`${y._type}Editing`);
          this.disableTextSelection(), this.toggleAnnotationLayerPointerEvents(!0), this.#u = !1;
        }
        getEditableAnnotation(i) {
          return this.#i?.getEditableAnnotation(i) || null;
        }
        setActiveEditor(i) {
          this.#o.getActive() !== i && this.#o.setActiveEditor(i);
        }
        enableTextSelection() {
          this.div.tabIndex = -1, this.#h?.div && !this.#n && (this.#n = this.#g.bind(this), this.#h.div.addEventListener("pointerdown", this.#n), this.#h.div.classList.add("highlighting"));
        }
        disableTextSelection() {
          this.div.tabIndex = 0, this.#h?.div && this.#n && (this.#h.div.removeEventListener("pointerdown", this.#n), this.#n = null, this.#h.div.classList.remove("highlighting"));
        }
        #g(i) {
          if (this.#o.unselectAll(), i.target === this.#h.div) {
            const {
              isMac: r
            } = e.FeatureTest.platform;
            if (i.button !== 0 || i.ctrlKey && r)
              return;
            this.#o.showAllEditors("highlight", !0, !0), this.#h.div.classList.add("free"), p.startHighlighting(this, this.#o.direction === "ltr", i), this.#h.div.addEventListener("pointerup", () => {
              this.#h.div.classList.remove("free");
            }, {
              once: !0
            }), i.preventDefault();
          }
        }
        enableClick() {
          this.#r || (this.#r = this.pointerdown.bind(this), this.#s = this.pointerup.bind(this), this.div.addEventListener("pointerdown", this.#r), this.div.addEventListener("pointerup", this.#s));
        }
        disableClick() {
          this.#r && (this.div.removeEventListener("pointerdown", this.#r), this.div.removeEventListener("pointerup", this.#s), this.#r = null, this.#s = null);
        }
        attach(i) {
          this.#c.set(i.id, i);
          const {
            annotationElementId: r
          } = i;
          r && this.#o.isDeletedAnnotationElement(r) && this.#o.removeDeletedAnnotationElement(i);
        }
        detach(i) {
          this.#c.delete(i.id), this.#t?.removePointerInTextLayer(i.contentDiv), !this.#u && i.annotationElementId && this.#o.addDeletedAnnotationElement(i);
        }
        remove(i) {
          this.detach(i), this.#o.removeEditor(i), i.div.remove(), i.isAttachedToDOM = !1, this.#d || this.addInkEditorIfNeeded(!1);
        }
        changeParent(i) {
          i.parent !== this && (i.parent && i.annotationElementId && (this.#o.addDeletedAnnotationElement(i.annotationElementId), u.AnnotationEditor.deleteAnnotationElement(i), i.annotationElementId = null), this.attach(i), i.parent?.detach(i), i.setParent(this), i.div && i.isAttachedToDOM && (i.div.remove(), this.div.append(i.div)));
        }
        add(i) {
          if (!(i.parent === this && i.isAttachedToDOM)) {
            if (this.changeParent(i), this.#o.addEditor(i), this.attach(i), !i.isAttachedToDOM) {
              const r = i.render();
              this.div.append(r), i.isAttachedToDOM = !0;
            }
            i.fixAndSetPosition(), i.onceAdded(), this.#o.addToAnnotationStorage(i), i._reportTelemetry(i.telemetryInitialData);
          }
        }
        moveEditorInDOM(i) {
          if (!i.isAttachedToDOM)
            return;
          const {
            activeElement: r
          } = document;
          i.div.contains(r) && !this.#a && (i._focusEventsAllowed = !1, this.#a = setTimeout(() => {
            this.#a = null, i.div.contains(document.activeElement) ? i._focusEventsAllowed = !0 : (i.div.addEventListener("focusin", () => {
              i._focusEventsAllowed = !0;
            }, {
              once: !0
            }), r.focus());
          }, 0)), i._structTreeParentId = this.#t?.moveElementInDOM(this.div, i.div, i.contentDiv, !0);
        }
        addOrRebuild(i) {
          i.needsToBeRebuilt() ? (i.parent ||= this, i.rebuild(), i.show()) : this.add(i);
        }
        addUndoableEditor(i) {
          const r = () => i._uiManager.rebuild(i), v = () => {
            i.remove();
          };
          this.addCommands({
            cmd: r,
            undo: v,
            mustExec: !1
          });
        }
        getNextId() {
          return this.#o.getId();
        }
        get #f() {
          return a.#p.get(this.#o.getMode());
        }
        #A(i) {
          const r = this.#f;
          return r ? new r.prototype.constructor(i) : null;
        }
        canCreateNewEmptyEditor() {
          return this.#f?.canCreateNewEmptyEditor();
        }
        pasteEditor(i, r) {
          this.#o.updateToolbar(i), this.#o.updateMode(i);
          const {
            offsetX: v,
            offsetY: y
          } = this.#m(), R = this.getNextId(), F = this.#A({
            parent: this,
            id: R,
            x: v,
            y,
            uiManager: this.#o,
            isCentered: !0,
            ...r
          });
          F && this.add(F);
        }
        deserialize(i) {
          return a.#p.get(i.annotationType ?? i.annotationEditorType)?.deserialize(i, this, this.#o) || null;
        }
        createAndAddNewEditor(i, r, v = {}) {
          const y = this.getNextId(), R = this.#A({
            parent: this,
            id: y,
            x: i.offsetX,
            y: i.offsetY,
            uiManager: this.#o,
            isCentered: r,
            ...v
          });
          return R && this.add(R), R;
        }
        #m() {
          const {
            x: i,
            y: r,
            width: v,
            height: y
          } = this.div.getBoundingClientRect(), R = Math.max(0, i), F = Math.max(0, r), I = Math.min(window.innerWidth, i + v), H = Math.min(window.innerHeight, r + y), B = (R + I) / 2 - i, U = (F + H) / 2 - r, [X, Z] = this.viewport.rotation % 180 === 0 ? [B, U] : [U, B];
          return {
            offsetX: X,
            offsetY: Z
          };
        }
        addNewEditor() {
          this.createAndAddNewEditor(this.#m(), !0);
        }
        setSelected(i) {
          this.#o.setSelected(i);
        }
        toggleSelected(i) {
          this.#o.toggleSelected(i);
        }
        isSelected(i) {
          return this.#o.isSelected(i);
        }
        unselect(i) {
          this.#o.unselect(i);
        }
        pointerup(i) {
          const {
            isMac: r
          } = e.FeatureTest.platform;
          if (!(i.button !== 0 || i.ctrlKey && r) && i.target === this.div && this.#l) {
            if (this.#l = !1, !this.#e) {
              this.#e = !0;
              return;
            }
            if (this.#o.getMode() === e.AnnotationEditorType.STAMP) {
              this.#o.unselectAll();
              return;
            }
            this.createAndAddNewEditor(i, !1);
          }
        }
        pointerdown(i) {
          if (this.#o.getMode() === e.AnnotationEditorType.HIGHLIGHT && this.enableTextSelection(), this.#l) {
            this.#l = !1;
            return;
          }
          const {
            isMac: r
          } = e.FeatureTest.platform;
          if (i.button !== 0 || i.ctrlKey && r || i.target !== this.div)
            return;
          this.#l = !0;
          const v = this.#o.getActive();
          this.#e = !v || v.isEmpty();
        }
        findNewParent(i, r, v) {
          const y = this.#o.findParent(r, v);
          return y === null || y === this ? !1 : (y.changeParent(i), !0);
        }
        destroy() {
          this.#o.getActive()?.parent === this && (this.#o.commitOrRemove(), this.#o.setActiveEditor(null)), this.#a && (clearTimeout(this.#a), this.#a = null);
          for (const i of this.#c.values())
            this.#t?.removePointerInTextLayer(i.contentDiv), i.setParent(null), i.isAttachedToDOM = !1, i.div.remove();
          this.div = null, this.#c.clear(), this.#o.removeLayer(this);
        }
        #v() {
          this.#d = !0;
          for (const i of this.#c.values())
            i.isEmpty() && i.remove();
          this.#d = !1;
        }
        render({
          viewport: i
        }) {
          this.viewport = i, (0, s.setLayerDimensions)(this.div, i);
          for (const r of this.#o.getEditors(this.pageIndex))
            this.add(r), r.rebuild();
          this.updateMode();
        }
        update({
          viewport: i
        }) {
          this.#o.commitOrRemove(), this.#v();
          const r = this.viewport.rotation, v = i.rotation;
          if (this.viewport = i, (0, s.setLayerDimensions)(this.div, {
            rotation: v
          }), r !== v)
            for (const y of this.#c.values())
              y.rotate(v);
          this.addInkEditorIfNeeded(!1);
        }
        get pageDimensions() {
          const {
            pageWidth: i,
            pageHeight: r
          } = this.viewport.rawDims;
          return [i, r];
        }
        get scale() {
          return this.#o.viewParameters.realScale;
        }
      }
    }
  ),
  /***/
  259: (
    /***/
    (d, t, n) => {
      n.d(t, {
        /* harmony export */
        ColorPicker: () => (
          /* binding */
          k
        )
        /* harmony export */
      });
      var e = n(292), u = n(830), f = n(419);
      class k {
        #t = this.#g.bind(this);
        #e = this.#A.bind(this);
        #i = null;
        #s = null;
        #r;
        #n = null;
        #a = !1;
        #c = !1;
        #l = null;
        #d;
        #u = null;
        #h;
        static get _keyboardManager() {
          return (0, e.shadow)(this, "_keyboardManager", new u.KeyboardManager([[["Escape", "mac+Escape"], k.prototype._hideDropdownFromKeyboard], [[" ", "mac+ "], k.prototype._colorSelectFromKeyboard], [["ArrowDown", "ArrowRight", "mac+ArrowDown", "mac+ArrowRight"], k.prototype._moveToNext], [["ArrowUp", "ArrowLeft", "mac+ArrowUp", "mac+ArrowLeft"], k.prototype._moveToPrevious], [["Home", "mac+Home"], k.prototype._moveToBeginning], [["End", "mac+End"], k.prototype._moveToEnd]]));
        }
        constructor({
          editor: o = null,
          uiManager: l = null
        }) {
          o ? (this.#c = !1, this.#h = e.AnnotationEditorParamsType.HIGHLIGHT_COLOR, this.#l = o) : (this.#c = !0, this.#h = e.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR), this.#u = o?._uiManager || l, this.#d = this.#u._eventBus, this.#r = o?.color || this.#u?.highlightColors.values().next().value || "#FFFF98";
        }
        renderButton() {
          const o = this.#i = document.createElement("button");
          o.className = "colorPicker", o.tabIndex = "0", o.setAttribute("data-l10n-id", "pdfjs-editor-colorpicker-button"), o.setAttribute("aria-haspopup", !0), o.addEventListener("click", this.#f.bind(this)), o.addEventListener("keydown", this.#t);
          const l = this.#s = document.createElement("span");
          return l.className = "swatch", l.setAttribute("aria-hidden", !0), l.style.backgroundColor = this.#r, o.append(l), o;
        }
        renderMainDropdown() {
          const o = this.#n = this.#o();
          return o.setAttribute("aria-orientation", "horizontal"), o.setAttribute("aria-labelledby", "highlightColorPickerLabel"), o;
        }
        #o() {
          const o = document.createElement("div");
          o.addEventListener("contextmenu", f.noContextMenu), o.className = "dropdown", o.role = "listbox", o.setAttribute("aria-multiselectable", !1), o.setAttribute("aria-orientation", "vertical"), o.setAttribute("data-l10n-id", "pdfjs-editor-colorpicker-dropdown");
          for (const [l, c] of this.#u.highlightColors) {
            const s = document.createElement("button");
            s.tabIndex = "0", s.role = "option", s.setAttribute("data-color", c), s.title = l, s.setAttribute("data-l10n-id", `pdfjs-editor-colorpicker-${l}`);
            const p = document.createElement("span");
            s.append(p), p.className = "swatch", p.style.backgroundColor = c, s.setAttribute("aria-selected", c === this.#r), s.addEventListener("click", this.#p.bind(this, c)), o.append(s);
          }
          return o.addEventListener("keydown", this.#t), o;
        }
        #p(o, l) {
          l.stopPropagation(), this.#d.dispatch("switchannotationeditorparams", {
            source: this,
            type: this.#h,
            value: o
          });
        }
        _colorSelectFromKeyboard(o) {
          if (o.target === this.#i) {
            this.#f(o);
            return;
          }
          const l = o.target.getAttribute("data-color");
          l && this.#p(l, o);
        }
        _moveToNext(o) {
          if (!this.#m) {
            this.#f(o);
            return;
          }
          if (o.target === this.#i) {
            this.#n.firstChild?.focus();
            return;
          }
          o.target.nextSibling?.focus();
        }
        _moveToPrevious(o) {
          if (o.target === this.#n?.firstChild || o.target === this.#i) {
            this.#m && this._hideDropdownFromKeyboard();
            return;
          }
          this.#m || this.#f(o), o.target.previousSibling?.focus();
        }
        _moveToBeginning(o) {
          if (!this.#m) {
            this.#f(o);
            return;
          }
          this.#n.firstChild?.focus();
        }
        _moveToEnd(o) {
          if (!this.#m) {
            this.#f(o);
            return;
          }
          this.#n.lastChild?.focus();
        }
        #g(o) {
          k._keyboardManager.exec(this, o);
        }
        #f(o) {
          if (this.#m) {
            this.hideDropdown();
            return;
          }
          if (this.#a = o.detail === 0, window.addEventListener("pointerdown", this.#e), this.#n) {
            this.#n.classList.remove("hidden");
            return;
          }
          const l = this.#n = this.#o();
          this.#i.append(l);
        }
        #A(o) {
          this.#n?.contains(o.target) || this.hideDropdown();
        }
        hideDropdown() {
          this.#n?.classList.add("hidden"), window.removeEventListener("pointerdown", this.#e);
        }
        get #m() {
          return this.#n && !this.#n.classList.contains("hidden");
        }
        _hideDropdownFromKeyboard() {
          if (!this.#c) {
            if (!this.#m) {
              this.#l?.unselect();
              return;
            }
            this.hideDropdown(), this.#i.focus({
              preventScroll: !0,
              focusVisible: this.#a
            });
          }
        }
        updateColor(o) {
          if (this.#s && (this.#s.style.backgroundColor = o), !this.#n)
            return;
          const l = this.#u.highlightColors.values();
          for (const c of this.#n.children)
            c.setAttribute("aria-selected", l.next().value === o);
        }
        destroy() {
          this.#i?.remove(), this.#i = null, this.#s = null, this.#n?.remove(), this.#n = null;
        }
      }
    }
  ),
  /***/
  310: (
    /***/
    (d, t, n) => {
      n.d(t, {
        AnnotationEditor: () => (
          /* binding */
          o
        )
      });
      var e = n(830), u = n(292), f = n(419);
      class k {
        #t = "";
        #e = !1;
        #i = null;
        #s = null;
        #r = null;
        #n = !1;
        #a = null;
        static _l10nPromise = null;
        constructor(s) {
          this.#a = s;
        }
        static initialize(s) {
          k._l10nPromise ||= s;
        }
        async render() {
          const s = this.#i = document.createElement("button");
          s.className = "altText";
          const p = await k._l10nPromise.get("pdfjs-editor-alt-text-button-label");
          s.textContent = p, s.setAttribute("aria-label", p), s.tabIndex = "0", s.addEventListener("contextmenu", f.noContextMenu), s.addEventListener("pointerdown", (S) => S.stopPropagation());
          const b = (S) => {
            S.preventDefault(), this.#a._uiManager.editAltText(this.#a);
          };
          return s.addEventListener("click", b, {
            capture: !0
          }), s.addEventListener("keydown", (S) => {
            S.target === s && S.key === "Enter" && (this.#n = !0, b(S));
          }), await this.#c(), s;
        }
        finish() {
          this.#i && (this.#i.focus({
            focusVisible: this.#n
          }), this.#n = !1);
        }
        isEmpty() {
          return !this.#t && !this.#e;
        }
        get data() {
          return {
            altText: this.#t,
            decorative: this.#e
          };
        }
        set data({
          altText: s,
          decorative: p
        }) {
          this.#t === s && this.#e === p || (this.#t = s, this.#e = p, this.#c());
        }
        toggle(s = !1) {
          this.#i && (!s && this.#r && (clearTimeout(this.#r), this.#r = null), this.#i.disabled = !s);
        }
        destroy() {
          this.#i?.remove(), this.#i = null, this.#s = null;
        }
        async #c() {
          const s = this.#i;
          if (!s)
            return;
          if (!this.#t && !this.#e) {
            s.classList.remove("done"), this.#s?.remove();
            return;
          }
          s.classList.add("done"), k._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then((S) => {
            s.setAttribute("aria-label", S);
          });
          let p = this.#s;
          if (!p) {
            this.#s = p = document.createElement("span"), p.className = "tooltip", p.setAttribute("role", "tooltip");
            const S = p.id = `alt-text-tooltip-${this.#a.id}`;
            s.setAttribute("aria-describedby", S);
            const a = 100;
            s.addEventListener("mouseenter", () => {
              this.#r = setTimeout(() => {
                this.#r = null, this.#s.classList.add("show"), this.#a._reportTelemetry({
                  action: "alt_text_tooltip"
                });
              }, a);
            }), s.addEventListener("mouseleave", () => {
              this.#r && (clearTimeout(this.#r), this.#r = null), this.#s?.classList.remove("show");
            });
          }
          p.innerText = this.#e ? await k._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip") : this.#t, p.parentNode || s.append(p), this.#a.getImageForAltText()?.setAttribute("aria-describedby", p.id);
        }
      }
      var m = n(362);
      class o {
        #t = null;
        #e = null;
        #i = !1;
        #s = !1;
        #r = null;
        #n = null;
        #a = this.focusin.bind(this);
        #c = this.focusout.bind(this);
        #l = null;
        #d = "";
        #u = !1;
        #h = null;
        #o = !1;
        #p = !1;
        #g = !1;
        #f = null;
        #A = 0;
        #m = 0;
        #v = null;
        _initialOptions = /* @__PURE__ */ Object.create(null);
        _isVisible = !0;
        _uiManager = null;
        _focusEventsAllowed = !0;
        _l10nPromise = null;
        #w = !1;
        #C = o._zIndex++;
        static _borderLineWidth = -1;
        static _colorManager = new e.ColorManager();
        static _zIndex = 1;
        static _telemetryTimeout = 1e3;
        static get _resizerKeyboardManager() {
          const s = o.prototype._resizeWithKeyboard, p = e.AnnotationEditorUIManager.TRANSLATE_SMALL, b = e.AnnotationEditorUIManager.TRANSLATE_BIG;
          return (0, u.shadow)(this, "_resizerKeyboardManager", new e.KeyboardManager([[["ArrowLeft", "mac+ArrowLeft"], s, {
            args: [-p, 0]
          }], [["ctrl+ArrowLeft", "mac+shift+ArrowLeft"], s, {
            args: [-b, 0]
          }], [["ArrowRight", "mac+ArrowRight"], s, {
            args: [p, 0]
          }], [["ctrl+ArrowRight", "mac+shift+ArrowRight"], s, {
            args: [b, 0]
          }], [["ArrowUp", "mac+ArrowUp"], s, {
            args: [0, -p]
          }], [["ctrl+ArrowUp", "mac+shift+ArrowUp"], s, {
            args: [0, -b]
          }], [["ArrowDown", "mac+ArrowDown"], s, {
            args: [0, p]
          }], [["ctrl+ArrowDown", "mac+shift+ArrowDown"], s, {
            args: [0, b]
          }], [["Escape", "mac+Escape"], o.prototype._stopResizingWithKeyboard]]));
        }
        constructor(s) {
          this.constructor === o && (0, u.unreachable)("Cannot initialize AnnotationEditor."), this.parent = s.parent, this.id = s.id, this.width = this.height = null, this.pageIndex = s.parent.pageIndex, this.name = s.name, this.div = null, this._uiManager = s.uiManager, this.annotationElementId = null, this._willKeepAspectRatio = !1, this._initialOptions.isCentered = s.isCentered, this._structTreeParentId = null;
          const {
            rotation: p,
            rawDims: {
              pageWidth: b,
              pageHeight: S,
              pageX: a,
              pageY: E
            }
          } = this.parent.viewport;
          this.rotation = p, this.pageRotation = (360 + p - this._uiManager.viewParameters.rotation) % 360, this.pageDimensions = [b, S], this.pageTranslation = [a, E];
          const [i, r] = this.parentDimensions;
          this.x = s.x / i, this.y = s.y / r, this.isAttachedToDOM = !1, this.deleted = !1;
        }
        get editorType() {
          return Object.getPrototypeOf(this).constructor._type;
        }
        static get _defaultLineColor() {
          return (0, u.shadow)(this, "_defaultLineColor", this._colorManager.getHexCode("CanvasText"));
        }
        static deleteAnnotationElement(s) {
          const p = new l({
            id: s.parent.getNextId(),
            parent: s.parent,
            uiManager: s._uiManager
          });
          p.annotationElementId = s.annotationElementId, p.deleted = !0, p._uiManager.addToAnnotationStorage(p);
        }
        static initialize(s, p, b) {
          if (o._l10nPromise ||= new Map(["pdfjs-editor-alt-text-button-label", "pdfjs-editor-alt-text-edit-button-label", "pdfjs-editor-alt-text-decorative-tooltip", "pdfjs-editor-resizer-label-topLeft", "pdfjs-editor-resizer-label-topMiddle", "pdfjs-editor-resizer-label-topRight", "pdfjs-editor-resizer-label-middleRight", "pdfjs-editor-resizer-label-bottomRight", "pdfjs-editor-resizer-label-bottomMiddle", "pdfjs-editor-resizer-label-bottomLeft", "pdfjs-editor-resizer-label-middleLeft"].map((a) => [a, s.get(a.replaceAll(/([A-Z])/g, (E) => `-${E.toLowerCase()}`))])), b?.strings)
            for (const a of b.strings)
              o._l10nPromise.set(a, s.get(a));
          if (o._borderLineWidth !== -1)
            return;
          const S = getComputedStyle(document.documentElement);
          o._borderLineWidth = parseFloat(S.getPropertyValue("--outline-width")) || 0;
        }
        static updateDefaultParams(s, p) {
        }
        static get defaultPropertiesToUpdate() {
          return [];
        }
        static isHandlingMimeForPasting(s) {
          return !1;
        }
        static paste(s, p) {
          (0, u.unreachable)("Not implemented");
        }
        get propertiesToUpdate() {
          return [];
        }
        get _isDraggable() {
          return this.#w;
        }
        set _isDraggable(s) {
          this.#w = s, this.div?.classList.toggle("draggable", s);
        }
        get isEnterHandled() {
          return !0;
        }
        center() {
          const [s, p] = this.pageDimensions;
          switch (this.parentRotation) {
            case 90:
              this.x -= this.height * p / (s * 2), this.y += this.width * s / (p * 2);
              break;
            case 180:
              this.x += this.width / 2, this.y += this.height / 2;
              break;
            case 270:
              this.x += this.height * p / (s * 2), this.y -= this.width * s / (p * 2);
              break;
            default:
              this.x -= this.width / 2, this.y -= this.height / 2;
              break;
          }
          this.fixAndSetPosition();
        }
        addCommands(s) {
          this._uiManager.addCommands(s);
        }
        get currentLayer() {
          return this._uiManager.currentLayer;
        }
        setInBackground() {
          this.div.style.zIndex = 0;
        }
        setInForeground() {
          this.div.style.zIndex = this.#C;
        }
        setParent(s) {
          s !== null ? (this.pageIndex = s.pageIndex, this.pageDimensions = s.pageDimensions) : this.#N(), this.parent = s;
        }
        focusin(s) {
          this._focusEventsAllowed && (this.#u ? this.#u = !1 : this.parent.setSelected(this));
        }
        focusout(s) {
          !this._focusEventsAllowed || !this.isAttachedToDOM || s.relatedTarget?.closest(`#${this.id}`) || (s.preventDefault(), this.parent?.isMultipleSelection || this.commitOrRemove());
        }
        commitOrRemove() {
          this.isEmpty() ? this.remove() : this.commit();
        }
        commit() {
          this.addToAnnotationStorage();
        }
        addToAnnotationStorage() {
          this._uiManager.addToAnnotationStorage(this);
        }
        setAt(s, p, b, S) {
          const [a, E] = this.parentDimensions;
          [b, S] = this.screenToPageTranslation(b, S), this.x = (s + b) / a, this.y = (p + S) / E, this.fixAndSetPosition();
        }
        #k([s, p], b, S) {
          [b, S] = this.screenToPageTranslation(b, S), this.x += b / s, this.y += S / p, this.fixAndSetPosition();
        }
        translate(s, p) {
          this.#k(this.parentDimensions, s, p);
        }
        translateInPage(s, p) {
          this.#h ||= [this.x, this.y], this.#k(this.pageDimensions, s, p), this.div.scrollIntoView({
            block: "nearest"
          });
        }
        drag(s, p) {
          this.#h ||= [this.x, this.y];
          const [b, S] = this.parentDimensions;
          if (this.x += s / b, this.y += p / S, this.parent && (this.x < 0 || this.x > 1 || this.y < 0 || this.y > 1)) {
            const {
              x: v,
              y
            } = this.div.getBoundingClientRect();
            this.parent.findNewParent(this, v, y) && (this.x -= Math.floor(this.x), this.y -= Math.floor(this.y));
          }
          let {
            x: a,
            y: E
          } = this;
          const [i, r] = this.getBaseTranslation();
          a += i, E += r, this.div.style.left = `${(100 * a).toFixed(2)}%`, this.div.style.top = `${(100 * E).toFixed(2)}%`, this.div.scrollIntoView({
            block: "nearest"
          });
        }
        get _hasBeenMoved() {
          return !!this.#h && (this.#h[0] !== this.x || this.#h[1] !== this.y);
        }
        getBaseTranslation() {
          const [s, p] = this.parentDimensions, {
            _borderLineWidth: b
          } = o, S = b / s, a = b / p;
          switch (this.rotation) {
            case 90:
              return [-S, a];
            case 180:
              return [S, a];
            case 270:
              return [S, -a];
            default:
              return [-S, -a];
          }
        }
        get _mustFixPosition() {
          return !0;
        }
        fixAndSetPosition(s = this.rotation) {
          const [p, b] = this.pageDimensions;
          let {
            x: S,
            y: a,
            width: E,
            height: i
          } = this;
          if (E *= p, i *= b, S *= p, a *= b, this._mustFixPosition)
            switch (s) {
              case 0:
                S = Math.max(0, Math.min(p - E, S)), a = Math.max(0, Math.min(b - i, a));
                break;
              case 90:
                S = Math.max(0, Math.min(p - i, S)), a = Math.min(b, Math.max(E, a));
                break;
              case 180:
                S = Math.min(p, Math.max(E, S)), a = Math.min(b, Math.max(i, a));
                break;
              case 270:
                S = Math.min(p, Math.max(i, S)), a = Math.max(0, Math.min(b - E, a));
                break;
            }
          this.x = S /= p, this.y = a /= b;
          const [r, v] = this.getBaseTranslation();
          S += r, a += v;
          const {
            style: y
          } = this.div;
          y.left = `${(100 * S).toFixed(2)}%`, y.top = `${(100 * a).toFixed(2)}%`, this.moveInDOM();
        }
        static #I(s, p, b) {
          switch (b) {
            case 90:
              return [p, -s];
            case 180:
              return [-s, -p];
            case 270:
              return [-p, s];
            default:
              return [s, p];
          }
        }
        screenToPageTranslation(s, p) {
          return o.#I(s, p, this.parentRotation);
        }
        pageTranslationToScreen(s, p) {
          return o.#I(s, p, 360 - this.parentRotation);
        }
        #F(s) {
          switch (s) {
            case 90: {
              const [p, b] = this.pageDimensions;
              return [0, -p / b, b / p, 0];
            }
            case 180:
              return [-1, 0, 0, -1];
            case 270: {
              const [p, b] = this.pageDimensions;
              return [0, p / b, -b / p, 0];
            }
            default:
              return [1, 0, 0, 1];
          }
        }
        get parentScale() {
          return this._uiManager.viewParameters.realScale;
        }
        get parentRotation() {
          return (this._uiManager.viewParameters.rotation + this.pageRotation) % 360;
        }
        get parentDimensions() {
          const {
            parentScale: s,
            pageDimensions: [p, b]
          } = this, S = p * s, a = b * s;
          return u.FeatureTest.isCSSRoundSupported ? [Math.round(S), Math.round(a)] : [S, a];
        }
        setDims(s, p) {
          const [b, S] = this.parentDimensions;
          this.div.style.width = `${(100 * s / b).toFixed(2)}%`, this.#s || (this.div.style.height = `${(100 * p / S).toFixed(2)}%`);
        }
        fixDims() {
          const {
            style: s
          } = this.div, {
            height: p,
            width: b
          } = s, S = b.endsWith("%"), a = !this.#s && p.endsWith("%");
          if (S && a)
            return;
          const [E, i] = this.parentDimensions;
          S || (s.width = `${(100 * parseFloat(b) / E).toFixed(2)}%`), !this.#s && !a && (s.height = `${(100 * parseFloat(p) / i).toFixed(2)}%`);
        }
        getInitialTranslation() {
          return [0, 0];
        }
        #y() {
          if (this.#r)
            return;
          this.#r = document.createElement("div"), this.#r.classList.add("resizers");
          const s = this._willKeepAspectRatio ? ["topLeft", "topRight", "bottomRight", "bottomLeft"] : ["topLeft", "topMiddle", "topRight", "middleRight", "bottomRight", "bottomMiddle", "bottomLeft", "middleLeft"];
          for (const p of s) {
            const b = document.createElement("div");
            this.#r.append(b), b.classList.add("resizer", p), b.setAttribute("data-resizer-name", p), b.addEventListener("pointerdown", this.#b.bind(this, p)), b.addEventListener("contextmenu", f.noContextMenu), b.tabIndex = -1;
          }
          this.div.prepend(this.#r);
        }
        #b(s, p) {
          p.preventDefault();
          const {
            isMac: b
          } = u.FeatureTest.platform;
          if (p.button !== 0 || p.ctrlKey && b)
            return;
          this.#e?.toggle(!1);
          const S = this.#S.bind(this, s), a = this._isDraggable;
          this._isDraggable = !1;
          const E = {
            passive: !0,
            capture: !0
          };
          this.parent.togglePointerEvents(!1), window.addEventListener("pointermove", S, E), window.addEventListener("contextmenu", f.noContextMenu);
          const i = this.x, r = this.y, v = this.width, y = this.height, R = this.parent.div.style.cursor, F = this.div.style.cursor;
          this.div.style.cursor = this.parent.div.style.cursor = window.getComputedStyle(p.target).cursor;
          const I = () => {
            this.parent.togglePointerEvents(!0), this.#e?.toggle(!0), this._isDraggable = a, window.removeEventListener("pointerup", I), window.removeEventListener("blur", I), window.removeEventListener("pointermove", S, E), window.removeEventListener("contextmenu", f.noContextMenu), this.parent.div.style.cursor = R, this.div.style.cursor = F, this.#_(i, r, v, y);
          };
          window.addEventListener("pointerup", I), window.addEventListener("blur", I);
        }
        #_(s, p, b, S) {
          const a = this.x, E = this.y, i = this.width, r = this.height;
          a === s && E === p && i === b && r === S || this.addCommands({
            cmd: () => {
              this.width = i, this.height = r, this.x = a, this.y = E;
              const [v, y] = this.parentDimensions;
              this.setDims(v * i, y * r), this.fixAndSetPosition();
            },
            undo: () => {
              this.width = b, this.height = S, this.x = s, this.y = p;
              const [v, y] = this.parentDimensions;
              this.setDims(v * b, y * S), this.fixAndSetPosition();
            },
            mustExec: !0
          });
        }
        #S(s, p) {
          const [b, S] = this.parentDimensions, a = this.x, E = this.y, i = this.width, r = this.height, v = o.MIN_SIZE / b, y = o.MIN_SIZE / S, R = (x) => Math.round(x * 1e4) / 1e4, F = this.#F(this.rotation), I = (x, C) => [F[0] * x + F[2] * C, F[1] * x + F[3] * C], H = this.#F(360 - this.rotation), B = (x, C) => [H[0] * x + H[2] * C, H[1] * x + H[3] * C];
          let U, X, Z = !1, lt = !1;
          switch (s) {
            case "topLeft":
              Z = !0, U = (x, C) => [0, 0], X = (x, C) => [x, C];
              break;
            case "topMiddle":
              U = (x, C) => [x / 2, 0], X = (x, C) => [x / 2, C];
              break;
            case "topRight":
              Z = !0, U = (x, C) => [x, 0], X = (x, C) => [0, C];
              break;
            case "middleRight":
              lt = !0, U = (x, C) => [x, C / 2], X = (x, C) => [0, C / 2];
              break;
            case "bottomRight":
              Z = !0, U = (x, C) => [x, C], X = (x, C) => [0, 0];
              break;
            case "bottomMiddle":
              U = (x, C) => [x / 2, C], X = (x, C) => [x / 2, 0];
              break;
            case "bottomLeft":
              Z = !0, U = (x, C) => [0, C], X = (x, C) => [x, 0];
              break;
            case "middleLeft":
              lt = !0, U = (x, C) => [0, C / 2], X = (x, C) => [x, C / 2];
              break;
          }
          const Y = U(i, r), V = X(i, r);
          let j = I(...V);
          const $ = R(a + j[0]), st = R(E + j[1]);
          let J = 1, ht = 1, [rt, pt] = this.screenToPageTranslation(p.movementX, p.movementY);
          if ([rt, pt] = B(rt / b, pt / S), Z) {
            const x = Math.hypot(i, r);
            J = ht = Math.max(Math.min(Math.hypot(V[0] - Y[0] - rt, V[1] - Y[1] - pt) / x, 1 / i, 1 / r), v / i, y / r);
          } else
            lt ? J = Math.max(v, Math.min(1, Math.abs(V[0] - Y[0] - rt))) / i : ht = Math.max(y, Math.min(1, Math.abs(V[1] - Y[1] - pt))) / r;
          const dt = R(i * J), ut = R(r * ht);
          j = I(...X(dt, ut));
          const Q = $ - j[0], it = st - j[1];
          this.width = dt, this.height = ut, this.x = Q, this.y = it, this.setDims(b * dt, S * ut), this.fixAndSetPosition();
        }
        altTextFinish() {
          this.#e?.finish();
        }
        async addEditToolbar() {
          return this.#l || this.#p ? this.#l : (this.#l = new m.EditorToolbar(this), this.div.append(this.#l.render()), this.#e && this.#l.addAltTextButton(await this.#e.render()), this.#l);
        }
        removeEditToolbar() {
          this.#l && (this.#l.remove(), this.#l = null, this.#e?.destroy());
        }
        getClientDimensions() {
          return this.div.getBoundingClientRect();
        }
        async addAltTextButton() {
          this.#e || (k.initialize(o._l10nPromise), this.#e = new k(this), await this.addEditToolbar());
        }
        get altTextData() {
          return this.#e?.data;
        }
        set altTextData(s) {
          this.#e && (this.#e.data = s);
        }
        hasAltText() {
          return !this.#e?.isEmpty();
        }
        render() {
          this.div = document.createElement("div"), this.div.setAttribute("data-editor-rotation", (360 - this.rotation) % 360), this.div.className = this.name, this.div.setAttribute("id", this.id), this.div.tabIndex = this.#i ? -1 : 0, this._isVisible || this.div.classList.add("hidden"), this.setInForeground(), this.div.addEventListener("focusin", this.#a), this.div.addEventListener("focusout", this.#c);
          const [s, p] = this.parentDimensions;
          this.parentRotation % 180 !== 0 && (this.div.style.maxWidth = `${(100 * p / s).toFixed(2)}%`, this.div.style.maxHeight = `${(100 * s / p).toFixed(2)}%`);
          const [b, S] = this.getInitialTranslation();
          return this.translate(b, S), (0, e.bindEvents)(this, this.div, ["pointerdown"]), this.div;
        }
        pointerdown(s) {
          const {
            isMac: p
          } = u.FeatureTest.platform;
          if (s.button !== 0 || s.ctrlKey && p) {
            s.preventDefault();
            return;
          }
          if (this.#u = !0, this._isDraggable) {
            this.#T(s);
            return;
          }
          this.#R(s);
        }
        #R(s) {
          const {
            isMac: p
          } = u.FeatureTest.platform;
          s.ctrlKey && !p || s.shiftKey || s.metaKey && p ? this.parent.toggleSelected(this) : this.parent.setSelected(this);
        }
        #T(s) {
          const p = this._uiManager.isSelected(this);
          this._uiManager.setUpDragSession();
          let b, S;
          p && (this.div.classList.add("moving"), b = {
            passive: !0,
            capture: !0
          }, this.#A = s.clientX, this.#m = s.clientY, S = (E) => {
            const {
              clientX: i,
              clientY: r
            } = E, [v, y] = this.screenToPageTranslation(i - this.#A, r - this.#m);
            this.#A = i, this.#m = r, this._uiManager.dragSelectedEditors(v, y);
          }, window.addEventListener("pointermove", S, b));
          const a = () => {
            window.removeEventListener("pointerup", a), window.removeEventListener("blur", a), p && (this.div.classList.remove("moving"), window.removeEventListener("pointermove", S, b)), this.#u = !1, this._uiManager.endDragSession() || this.#R(s);
          };
          window.addEventListener("pointerup", a), window.addEventListener("blur", a);
        }
        moveInDOM() {
          this.#f && clearTimeout(this.#f), this.#f = setTimeout(() => {
            this.#f = null, this.parent?.moveEditorInDOM(this);
          }, 0);
        }
        _setParentAndPosition(s, p, b) {
          s.changeParent(this), this.x = p, this.y = b, this.fixAndSetPosition();
        }
        getRect(s, p, b = this.rotation) {
          const S = this.parentScale, [a, E] = this.pageDimensions, [i, r] = this.pageTranslation, v = s / S, y = p / S, R = this.x * a, F = this.y * E, I = this.width * a, H = this.height * E;
          switch (b) {
            case 0:
              return [R + v + i, E - F - y - H + r, R + v + I + i, E - F - y + r];
            case 90:
              return [R + y + i, E - F + v + r, R + y + H + i, E - F + v + I + r];
            case 180:
              return [R - v - I + i, E - F + y + r, R - v + i, E - F + y + H + r];
            case 270:
              return [R - y - H + i, E - F - v - I + r, R - y + i, E - F - v + r];
            default:
              throw new Error("Invalid rotation");
          }
        }
        getRectInCurrentCoords(s, p) {
          const [b, S, a, E] = s, i = a - b, r = E - S;
          switch (this.rotation) {
            case 0:
              return [b, p - E, i, r];
            case 90:
              return [b, p - S, r, i];
            case 180:
              return [a, p - S, i, r];
            case 270:
              return [a, p - E, r, i];
            default:
              throw new Error("Invalid rotation");
          }
        }
        onceAdded() {
        }
        isEmpty() {
          return !1;
        }
        enableEditMode() {
          this.#p = !0;
        }
        disableEditMode() {
          this.#p = !1;
        }
        isInEditMode() {
          return this.#p;
        }
        shouldGetKeyboardEvents() {
          return this.#g;
        }
        needsToBeRebuilt() {
          return this.div && !this.isAttachedToDOM;
        }
        rebuild() {
          this.div?.addEventListener("focusin", this.#a), this.div?.addEventListener("focusout", this.#c);
        }
        rotate(s) {
        }
        serialize(s = !1, p = null) {
          (0, u.unreachable)("An editor must be serializable");
        }
        static deserialize(s, p, b) {
          const S = new this.prototype.constructor({
            parent: p,
            id: p.getNextId(),
            uiManager: b
          });
          S.rotation = s.rotation;
          const [a, E] = S.pageDimensions, [i, r, v, y] = S.getRectInCurrentCoords(s.rect, E);
          return S.x = i / a, S.y = r / E, S.width = v / a, S.height = y / E, S;
        }
        get hasBeenModified() {
          return !!this.annotationElementId && (this.deleted || this.serialize() !== null);
        }
        remove() {
          if (this.div.removeEventListener("focusin", this.#a), this.div.removeEventListener("focusout", this.#c), this.isEmpty() || this.commit(), this.parent ? this.parent.remove(this) : this._uiManager.removeEditor(this), this.#f && (clearTimeout(this.#f), this.#f = null), this.#N(), this.removeEditToolbar(), this.#v) {
            for (const s of this.#v.values())
              clearTimeout(s);
            this.#v = null;
          }
          this.parent = null;
        }
        get isResizable() {
          return !1;
        }
        makeResizable() {
          this.isResizable && (this.#y(), this.#r.classList.remove("hidden"), (0, e.bindEvents)(this, this.div, ["keydown"]));
        }
        get toolbarPosition() {
          return null;
        }
        keydown(s) {
          if (!this.isResizable || s.target !== this.div || s.key !== "Enter")
            return;
          this._uiManager.setSelected(this), this.#n = {
            savedX: this.x,
            savedY: this.y,
            savedWidth: this.width,
            savedHeight: this.height
          };
          const p = this.#r.children;
          if (!this.#t) {
            this.#t = Array.from(p);
            const E = this.#M.bind(this), i = this.#x.bind(this);
            for (const r of this.#t) {
              const v = r.getAttribute("data-resizer-name");
              r.setAttribute("role", "spinbutton"), r.addEventListener("keydown", E), r.addEventListener("blur", i), r.addEventListener("focus", this.#P.bind(this, v)), o._l10nPromise.get(`pdfjs-editor-resizer-label-${v}`).then((y) => r.setAttribute("aria-label", y));
            }
          }
          const b = this.#t[0];
          let S = 0;
          for (const E of p) {
            if (E === b)
              break;
            S++;
          }
          const a = (360 - this.rotation + this.parentRotation) % 360 / 90 * (this.#t.length / 4);
          if (a !== S) {
            if (a < S)
              for (let i = 0; i < S - a; i++)
                this.#r.append(this.#r.firstChild);
            else if (a > S)
              for (let i = 0; i < a - S; i++)
                this.#r.firstChild.before(this.#r.lastChild);
            let E = 0;
            for (const i of p) {
              const v = this.#t[E++].getAttribute("data-resizer-name");
              o._l10nPromise.get(`pdfjs-editor-resizer-label-${v}`).then((y) => i.setAttribute("aria-label", y));
            }
          }
          this.#L(0), this.#g = !0, this.#r.firstChild.focus({
            focusVisible: !0
          }), s.preventDefault(), s.stopImmediatePropagation();
        }
        #M(s) {
          o._resizerKeyboardManager.exec(this, s);
        }
        #x(s) {
          this.#g && s.relatedTarget?.parentNode !== this.#r && this.#N();
        }
        #P(s) {
          this.#d = this.#g ? s : "";
        }
        #L(s) {
          if (this.#t)
            for (const p of this.#t)
              p.tabIndex = s;
        }
        _resizeWithKeyboard(s, p) {
          this.#g && this.#S(this.#d, {
            movementX: s,
            movementY: p
          });
        }
        #N() {
          if (this.#g = !1, this.#L(-1), this.#n) {
            const {
              savedX: s,
              savedY: p,
              savedWidth: b,
              savedHeight: S
            } = this.#n;
            this.#_(s, p, b, S), this.#n = null;
          }
        }
        _stopResizingWithKeyboard() {
          this.#N(), this.div.focus();
        }
        select() {
          if (this.makeResizable(), this.div?.classList.add("selectedEditor"), !this.#l) {
            this.addEditToolbar().then(() => {
              this.div?.classList.contains("selectedEditor") && this.#l?.show();
            });
            return;
          }
          this.#l?.show();
        }
        unselect() {
          this.#r?.classList.add("hidden"), this.div?.classList.remove("selectedEditor"), this.div?.contains(document.activeElement) && this._uiManager.currentLayer.div.focus({
            preventScroll: !0
          }), this.#l?.hide();
        }
        updateParams(s, p) {
        }
        disableEditing() {
        }
        enableEditing() {
        }
        enterInEditMode() {
        }
        getImageForAltText() {
          return null;
        }
        get contentDiv() {
          return this.div;
        }
        get isEditing() {
          return this.#o;
        }
        set isEditing(s) {
          this.#o = s, this.parent && (s ? (this.parent.setSelected(this), this.parent.setActiveEditor(this)) : this.parent.setActiveEditor(null));
        }
        setAspectRatio(s, p) {
          this.#s = !0;
          const b = s / p, {
            style: S
          } = this.div;
          S.aspectRatio = b, S.height = "auto";
        }
        static get MIN_SIZE() {
          return 16;
        }
        static canCreateNewEmptyEditor() {
          return !0;
        }
        get telemetryInitialData() {
          return {
            action: "added"
          };
        }
        get telemetryFinalData() {
          return null;
        }
        _reportTelemetry(s, p = !1) {
          if (p) {
            this.#v ||= /* @__PURE__ */ new Map();
            const {
              action: b
            } = s;
            let S = this.#v.get(b);
            S && clearTimeout(S), S = setTimeout(() => {
              this._reportTelemetry(s), this.#v.delete(b), this.#v.size === 0 && (this.#v = null);
            }, o._telemetryTimeout), this.#v.set(b, S);
            return;
          }
          s.type ||= this.editorType, this._uiManager._eventBus.dispatch("reporttelemetry", {
            source: this,
            details: {
              type: "editing",
              data: s
            }
          });
        }
        show(s = this._isVisible) {
          this.div.classList.toggle("hidden", !s), this._isVisible = s;
        }
        enable() {
          this.div && (this.div.tabIndex = 0), this.#i = !1;
        }
        disable() {
          this.div && (this.div.tabIndex = -1), this.#i = !0;
        }
        renderAnnotationElement(s) {
          let p = s.container.querySelector(".annotationContent");
          if (!p)
            p = document.createElement("div"), p.classList.add("annotationContent", this.editorType), s.container.prepend(p);
          else if (p.nodeName === "CANVAS") {
            const b = p;
            p = document.createElement("div"), p.classList.add("annotationContent", this.editorType), b.before(p);
          }
          return p;
        }
        resetAnnotationElement(s) {
          const {
            firstChild: p
          } = s.container;
          p.nodeName === "DIV" && p.classList.contains("annotationContent") && p.remove();
        }
      }
      class l extends o {
        constructor(s) {
          super(s), this.annotationElementId = s.annotationElementId, this.deleted = !0;
        }
        serialize() {
          return {
            id: this.annotationElementId,
            deleted: !0,
            pageIndex: this.pageIndex
          };
        }
      }
    }
  ),
  /***/
  61: (
    /***/
    (d, t, n) => {
      n.d(t, {
        /* harmony export */
        FreeOutliner: () => (
          /* binding */
          m
        ),
        /* harmony export */
        Outliner: () => (
          /* binding */
          u
        )
        /* harmony export */
      });
      var e = n(292);
      class u {
        #t;
        #e = [];
        #i = [];
        constructor(c, s = 0, p = 0, b = !0) {
          let S = 1 / 0, a = -1 / 0, E = 1 / 0, i = -1 / 0;
          const v = 10 ** -4;
          for (const {
            x: U,
            y: X,
            width: Z,
            height: lt
          } of c) {
            const Y = Math.floor((U - s) / v) * v, V = Math.ceil((U + Z + s) / v) * v, j = Math.floor((X - s) / v) * v, $ = Math.ceil((X + lt + s) / v) * v, st = [Y, j, $, !0], J = [V, j, $, !1];
            this.#e.push(st, J), S = Math.min(S, Y), a = Math.max(a, V), E = Math.min(E, j), i = Math.max(i, $);
          }
          const y = a - S + 2 * p, R = i - E + 2 * p, F = S - p, I = E - p, H = this.#e.at(b ? -1 : -2), B = [H[0], H[2]];
          for (const U of this.#e) {
            const [X, Z, lt] = U;
            U[0] = (X - F) / y, U[1] = (Z - I) / R, U[2] = (lt - I) / R;
          }
          this.#t = {
            x: F,
            y: I,
            width: y,
            height: R,
            lastPoint: B
          };
        }
        getOutlines() {
          this.#e.sort((s, p) => s[0] - p[0] || s[1] - p[1] || s[2] - p[2]);
          const c = [];
          for (const s of this.#e)
            s[3] ? (c.push(...this.#c(s)), this.#n(s)) : (this.#a(s), c.push(...this.#c(s)));
          return this.#s(c);
        }
        #s(c) {
          const s = [], p = /* @__PURE__ */ new Set();
          for (const a of c) {
            const [E, i, r] = a;
            s.push([E, i, a], [E, r, a]);
          }
          s.sort((a, E) => a[1] - E[1] || a[0] - E[0]);
          for (let a = 0, E = s.length; a < E; a += 2) {
            const i = s[a][2], r = s[a + 1][2];
            i.push(r), r.push(i), p.add(i), p.add(r);
          }
          const b = [];
          let S;
          for (; p.size > 0; ) {
            const a = p.values().next().value;
            let [E, i, r, v, y] = a;
            p.delete(a);
            let R = E, F = i;
            for (S = [E, r], b.push(S); ; ) {
              let I;
              if (p.has(v))
                I = v;
              else if (p.has(y))
                I = y;
              else
                break;
              p.delete(I), [E, i, r, v, y] = I, R !== E && (S.push(R, F, E, F === i ? i : r), R = E), F = F === i ? r : i;
            }
            S.push(R, F);
          }
          return new k(b, this.#t);
        }
        #r(c) {
          const s = this.#i;
          let p = 0, b = s.length - 1;
          for (; p <= b; ) {
            const S = p + b >> 1, a = s[S][0];
            if (a === c)
              return S;
            a < c ? p = S + 1 : b = S - 1;
          }
          return b + 1;
        }
        #n([, c, s]) {
          const p = this.#r(c);
          this.#i.splice(p, 0, [c, s]);
        }
        #a([, c, s]) {
          const p = this.#r(c);
          for (let b = p; b < this.#i.length; b++) {
            const [S, a] = this.#i[b];
            if (S !== c)
              break;
            if (S === c && a === s) {
              this.#i.splice(b, 1);
              return;
            }
          }
          for (let b = p - 1; b >= 0; b--) {
            const [S, a] = this.#i[b];
            if (S !== c)
              break;
            if (S === c && a === s) {
              this.#i.splice(b, 1);
              return;
            }
          }
        }
        #c(c) {
          const [s, p, b] = c, S = [[s, p, b]], a = this.#r(b);
          for (let E = 0; E < a; E++) {
            const [i, r] = this.#i[E];
            for (let v = 0, y = S.length; v < y; v++) {
              const [, R, F] = S[v];
              if (!(r <= R || F <= i)) {
                if (R >= i) {
                  if (F > r)
                    S[v][1] = r;
                  else {
                    if (y === 1)
                      return [];
                    S.splice(v, 1), v--, y--;
                  }
                  continue;
                }
                S[v][2] = i, F > r && S.push([s, r, F]);
              }
            }
          }
          return S;
        }
      }
      class f {
        toSVGPath() {
          throw new Error("Abstract method `toSVGPath` must be implemented.");
        }
        get box() {
          throw new Error("Abstract getter `box` must be implemented.");
        }
        serialize(c, s) {
          throw new Error("Abstract method `serialize` must be implemented.");
        }
        get free() {
          return this instanceof o;
        }
      }
      class k extends f {
        #t;
        #e;
        constructor(c, s) {
          super(), this.#e = c, this.#t = s;
        }
        toSVGPath() {
          const c = [];
          for (const s of this.#e) {
            let [p, b] = s;
            c.push(`M${p} ${b}`);
            for (let S = 2; S < s.length; S += 2) {
              const a = s[S], E = s[S + 1];
              a === p ? (c.push(`V${E}`), b = E) : E === b && (c.push(`H${a}`), p = a);
            }
            c.push("Z");
          }
          return c.join(" ");
        }
        serialize([c, s, p, b], S) {
          const a = [], E = p - c, i = b - s;
          for (const r of this.#e) {
            const v = new Array(r.length);
            for (let y = 0; y < r.length; y += 2)
              v[y] = c + r[y] * E, v[y + 1] = b - r[y + 1] * i;
            a.push(v);
          }
          return a;
        }
        get box() {
          return this.#t;
        }
      }
      class m {
        #t;
        #e = [];
        #i;
        #s;
        #r = [];
        #n = new Float64Array(18);
        #a;
        #c;
        #l;
        #d;
        #u;
        #h;
        #o = [];
        static #p = 8;
        static #g = 2;
        static #f = m.#p + m.#g;
        constructor({
          x: c,
          y: s
        }, p, b, S, a, E = 0) {
          this.#t = p, this.#h = S * b, this.#s = a, this.#n.set([NaN, NaN, NaN, NaN, c, s], 6), this.#i = E, this.#d = m.#p * b, this.#l = m.#f * b, this.#u = b, this.#o.push(c, s);
        }
        get free() {
          return !0;
        }
        isEmpty() {
          return isNaN(this.#n[8]);
        }
        #A() {
          const c = this.#n.subarray(4, 6), s = this.#n.subarray(16, 18), [p, b, S, a] = this.#t;
          return [(this.#a + (c[0] - s[0]) / 2 - p) / S, (this.#c + (c[1] - s[1]) / 2 - b) / a, (this.#a + (s[0] - c[0]) / 2 - p) / S, (this.#c + (s[1] - c[1]) / 2 - b) / a];
        }
        add({
          x: c,
          y: s
        }) {
          this.#a = c, this.#c = s;
          const [p, b, S, a] = this.#t;
          let [E, i, r, v] = this.#n.subarray(8, 12);
          const y = c - r, R = s - v, F = Math.hypot(y, R);
          if (F < this.#l)
            return !1;
          const I = F - this.#d, H = I / F, B = H * y, U = H * R;
          let X = E, Z = i;
          E = r, i = v, r += B, v += U, this.#o?.push(c, s);
          const lt = -U / I, Y = B / I, V = lt * this.#h, j = Y * this.#h;
          return this.#n.set(this.#n.subarray(2, 8), 0), this.#n.set([r + V, v + j], 4), this.#n.set(this.#n.subarray(14, 18), 12), this.#n.set([r - V, v - j], 16), isNaN(this.#n[6]) ? (this.#r.length === 0 && (this.#n.set([E + V, i + j], 2), this.#r.push(NaN, NaN, NaN, NaN, (E + V - p) / S, (i + j - b) / a), this.#n.set([E - V, i - j], 14), this.#e.push(NaN, NaN, NaN, NaN, (E - V - p) / S, (i - j - b) / a)), this.#n.set([X, Z, E, i, r, v], 6), !this.isEmpty()) : (this.#n.set([X, Z, E, i, r, v], 6), Math.abs(Math.atan2(Z - i, X - E) - Math.atan2(U, B)) < Math.PI / 2 ? ([E, i, r, v] = this.#n.subarray(2, 6), this.#r.push(NaN, NaN, NaN, NaN, ((E + r) / 2 - p) / S, ((i + v) / 2 - b) / a), [E, i, X, Z] = this.#n.subarray(14, 18), this.#e.push(NaN, NaN, NaN, NaN, ((X + E) / 2 - p) / S, ((Z + i) / 2 - b) / a), !0) : ([X, Z, E, i, r, v] = this.#n.subarray(0, 6), this.#r.push(((X + 5 * E) / 6 - p) / S, ((Z + 5 * i) / 6 - b) / a, ((5 * E + r) / 6 - p) / S, ((5 * i + v) / 6 - b) / a, ((E + r) / 2 - p) / S, ((i + v) / 2 - b) / a), [r, v, E, i, X, Z] = this.#n.subarray(12, 18), this.#e.push(((X + 5 * E) / 6 - p) / S, ((Z + 5 * i) / 6 - b) / a, ((5 * E + r) / 6 - p) / S, ((5 * i + v) / 6 - b) / a, ((E + r) / 2 - p) / S, ((i + v) / 2 - b) / a), !0));
        }
        toSVGPath() {
          if (this.isEmpty())
            return "";
          const c = this.#r, s = this.#e, p = this.#n.subarray(4, 6), b = this.#n.subarray(16, 18), [S, a, E, i] = this.#t, [r, v, y, R] = this.#A();
          if (isNaN(this.#n[6]) && !this.isEmpty())
            return `M${(this.#n[2] - S) / E} ${(this.#n[3] - a) / i} L${(this.#n[4] - S) / E} ${(this.#n[5] - a) / i} L${r} ${v} L${y} ${R} L${(this.#n[16] - S) / E} ${(this.#n[17] - a) / i} L${(this.#n[14] - S) / E} ${(this.#n[15] - a) / i} Z`;
          const F = [];
          F.push(`M${c[4]} ${c[5]}`);
          for (let I = 6; I < c.length; I += 6)
            isNaN(c[I]) ? F.push(`L${c[I + 4]} ${c[I + 5]}`) : F.push(`C${c[I]} ${c[I + 1]} ${c[I + 2]} ${c[I + 3]} ${c[I + 4]} ${c[I + 5]}`);
          F.push(`L${(p[0] - S) / E} ${(p[1] - a) / i} L${r} ${v} L${y} ${R} L${(b[0] - S) / E} ${(b[1] - a) / i}`);
          for (let I = s.length - 6; I >= 6; I -= 6)
            isNaN(s[I]) ? F.push(`L${s[I + 4]} ${s[I + 5]}`) : F.push(`C${s[I]} ${s[I + 1]} ${s[I + 2]} ${s[I + 3]} ${s[I + 4]} ${s[I + 5]}`);
          return F.push(`L${s[4]} ${s[5]} Z`), F.join(" ");
        }
        getOutlines() {
          const c = this.#r, s = this.#e, p = this.#n, b = p.subarray(4, 6), S = p.subarray(16, 18), [a, E, i, r] = this.#t, v = new Float64Array((this.#o?.length ?? 0) + 2);
          for (let U = 0, X = v.length - 2; U < X; U += 2)
            v[U] = (this.#o[U] - a) / i, v[U + 1] = (this.#o[U + 1] - E) / r;
          v[v.length - 2] = (this.#a - a) / i, v[v.length - 1] = (this.#c - E) / r;
          const [y, R, F, I] = this.#A();
          if (isNaN(p[6]) && !this.isEmpty()) {
            const U = new Float64Array(36);
            return U.set([NaN, NaN, NaN, NaN, (p[2] - a) / i, (p[3] - E) / r, NaN, NaN, NaN, NaN, (p[4] - a) / i, (p[5] - E) / r, NaN, NaN, NaN, NaN, y, R, NaN, NaN, NaN, NaN, F, I, NaN, NaN, NaN, NaN, (p[16] - a) / i, (p[17] - E) / r, NaN, NaN, NaN, NaN, (p[14] - a) / i, (p[15] - E) / r], 0), new o(U, v, this.#t, this.#u, this.#i, this.#s);
          }
          const H = new Float64Array(this.#r.length + 24 + this.#e.length);
          let B = c.length;
          for (let U = 0; U < B; U += 2) {
            if (isNaN(c[U])) {
              H[U] = H[U + 1] = NaN;
              continue;
            }
            H[U] = c[U], H[U + 1] = c[U + 1];
          }
          H.set([NaN, NaN, NaN, NaN, (b[0] - a) / i, (b[1] - E) / r, NaN, NaN, NaN, NaN, y, R, NaN, NaN, NaN, NaN, F, I, NaN, NaN, NaN, NaN, (S[0] - a) / i, (S[1] - E) / r], B), B += 24;
          for (let U = s.length - 6; U >= 6; U -= 6)
            for (let X = 0; X < 6; X += 2) {
              if (isNaN(s[U + X])) {
                H[B] = H[B + 1] = NaN, B += 2;
                continue;
              }
              H[B] = s[U + X], H[B + 1] = s[U + X + 1], B += 2;
            }
          return H.set([NaN, NaN, NaN, NaN, s[4], s[5]], B), new o(H, v, this.#t, this.#u, this.#i, this.#s);
        }
      }
      class o extends f {
        #t;
        #e = null;
        #i;
        #s;
        #r;
        #n;
        #a;
        constructor(c, s, p, b, S, a) {
          super(), this.#a = c, this.#r = s, this.#t = p, this.#n = b, this.#i = S, this.#s = a, this.#d(a);
          const {
            x: E,
            y: i,
            width: r,
            height: v
          } = this.#e;
          for (let y = 0, R = c.length; y < R; y += 2)
            c[y] = (c[y] - E) / r, c[y + 1] = (c[y + 1] - i) / v;
          for (let y = 0, R = s.length; y < R; y += 2)
            s[y] = (s[y] - E) / r, s[y + 1] = (s[y + 1] - i) / v;
        }
        toSVGPath() {
          const c = [`M${this.#a[4]} ${this.#a[5]}`];
          for (let s = 6, p = this.#a.length; s < p; s += 6) {
            if (isNaN(this.#a[s])) {
              c.push(`L${this.#a[s + 4]} ${this.#a[s + 5]}`);
              continue;
            }
            c.push(`C${this.#a[s]} ${this.#a[s + 1]} ${this.#a[s + 2]} ${this.#a[s + 3]} ${this.#a[s + 4]} ${this.#a[s + 5]}`);
          }
          return c.push("Z"), c.join(" ");
        }
        serialize([c, s, p, b], S) {
          const a = p - c, E = b - s;
          let i, r;
          switch (S) {
            case 0:
              i = this.#c(this.#a, c, b, a, -E), r = this.#c(this.#r, c, b, a, -E);
              break;
            case 90:
              i = this.#l(this.#a, c, s, a, E), r = this.#l(this.#r, c, s, a, E);
              break;
            case 180:
              i = this.#c(this.#a, p, s, -a, E), r = this.#c(this.#r, p, s, -a, E);
              break;
            case 270:
              i = this.#l(this.#a, p, b, -a, -E), r = this.#l(this.#r, p, b, -a, -E);
              break;
          }
          return {
            outline: Array.from(i),
            points: [Array.from(r)]
          };
        }
        #c(c, s, p, b, S) {
          const a = new Float64Array(c.length);
          for (let E = 0, i = c.length; E < i; E += 2)
            a[E] = s + c[E] * b, a[E + 1] = p + c[E + 1] * S;
          return a;
        }
        #l(c, s, p, b, S) {
          const a = new Float64Array(c.length);
          for (let E = 0, i = c.length; E < i; E += 2)
            a[E] = s + c[E + 1] * b, a[E + 1] = p + c[E] * S;
          return a;
        }
        #d(c) {
          const s = this.#a;
          let p = s[4], b = s[5], S = p, a = b, E = p, i = b, r = p, v = b;
          const y = c ? Math.max : Math.min;
          for (let B = 6, U = s.length; B < U; B += 6) {
            if (isNaN(s[B]))
              S = Math.min(S, s[B + 4]), a = Math.min(a, s[B + 5]), E = Math.max(E, s[B + 4]), i = Math.max(i, s[B + 5]), v < s[B + 5] ? (r = s[B + 4], v = s[B + 5]) : v === s[B + 5] && (r = y(r, s[B + 4]));
            else {
              const X = e.Util.bezierBoundingBox(p, b, ...s.slice(B, B + 6));
              S = Math.min(S, X[0]), a = Math.min(a, X[1]), E = Math.max(E, X[2]), i = Math.max(i, X[3]), v < X[3] ? (r = X[2], v = X[3]) : v === X[3] && (r = y(r, X[2]));
            }
            p = s[B + 4], b = s[B + 5];
          }
          const R = S - this.#i, F = a - this.#i, I = E - S + 2 * this.#i, H = i - a + 2 * this.#i;
          this.#e = {
            x: R,
            y: F,
            width: I,
            height: H,
            lastPoint: [r, v]
          };
        }
        get box() {
          return this.#e;
        }
        getNewOutline(c, s) {
          const {
            x: p,
            y: b,
            width: S,
            height: a
          } = this.#e, [E, i, r, v] = this.#t, y = S * r, R = a * v, F = p * r + E, I = b * v + i, H = new m({
            x: this.#r[0] * y + F,
            y: this.#r[1] * R + I
          }, this.#t, this.#n, c, this.#s, s ?? this.#i);
          for (let B = 2; B < this.#r.length; B += 2)
            H.add({
              x: this.#r[B] * y + F,
              y: this.#r[B + 1] * R + I
            });
          return H.getOutlines();
        }
      }
    }
  ),
  /***/
  362: (
    /***/
    (d, t, n) => {
      n.d(t, {
        /* harmony export */
        EditorToolbar: () => (
          /* binding */
          u
        ),
        /* harmony export */
        HighlightToolbar: () => (
          /* binding */
          f
        )
        /* harmony export */
      });
      var e = n(419);
      class u {
        #t = null;
        #e = null;
        #i;
        #s = null;
        constructor(m) {
          this.#i = m;
        }
        render() {
          const m = this.#t = document.createElement("div");
          m.className = "editToolbar", m.setAttribute("role", "toolbar"), m.addEventListener("contextmenu", e.noContextMenu), m.addEventListener("pointerdown", u.#r);
          const o = this.#s = document.createElement("div");
          o.className = "buttons", m.append(o);
          const l = this.#i.toolbarPosition;
          if (l) {
            const {
              style: c
            } = m, s = this.#i._uiManager.direction === "ltr" ? 1 - l[0] : l[0];
            c.insetInlineEnd = `${100 * s}%`, c.top = `calc(${100 * l[1]}% + var(--editor-toolbar-vert-offset))`;
          }
          return this.#l(), m;
        }
        static #r(m) {
          m.stopPropagation();
        }
        #n(m) {
          this.#i._focusEventsAllowed = !1, m.preventDefault(), m.stopPropagation();
        }
        #a(m) {
          this.#i._focusEventsAllowed = !0, m.preventDefault(), m.stopPropagation();
        }
        #c(m) {
          m.addEventListener("focusin", this.#n.bind(this), {
            capture: !0
          }), m.addEventListener("focusout", this.#a.bind(this), {
            capture: !0
          }), m.addEventListener("contextmenu", e.noContextMenu);
        }
        hide() {
          this.#t.classList.add("hidden"), this.#e?.hideDropdown();
        }
        show() {
          this.#t.classList.remove("hidden");
        }
        #l() {
          const m = document.createElement("button");
          m.className = "delete", m.tabIndex = 0, m.setAttribute("data-l10n-id", `pdfjs-editor-remove-${this.#i.editorType}-button`), this.#c(m), m.addEventListener("click", (o) => {
            this.#i._uiManager.delete();
          }), this.#s.append(m);
        }
        get #d() {
          const m = document.createElement("div");
          return m.className = "divider", m;
        }
        addAltTextButton(m) {
          this.#c(m), this.#s.prepend(m, this.#d);
        }
        addColorPicker(m) {
          this.#e = m;
          const o = m.renderButton();
          this.#c(o), this.#s.prepend(o, this.#d);
        }
        remove() {
          this.#t.remove(), this.#e?.destroy(), this.#e = null;
        }
      }
      class f {
        #t = null;
        #e = null;
        #i;
        constructor(m) {
          this.#i = m;
        }
        #s() {
          const m = this.#e = document.createElement("div");
          m.className = "editToolbar", m.setAttribute("role", "toolbar"), m.addEventListener("contextmenu", e.noContextMenu);
          const o = this.#t = document.createElement("div");
          return o.className = "buttons", m.append(o), this.#n(), m;
        }
        #r(m, o) {
          let l = 0, c = 0;
          for (const s of m) {
            const p = s.y + s.height;
            if (p < l)
              continue;
            const b = s.x + (o ? s.width : 0);
            if (p > l) {
              c = b, l = p;
              continue;
            }
            o ? b > c && (c = b) : b < c && (c = b);
          }
          return [o ? 1 - c : c, l];
        }
        show(m, o, l) {
          const [c, s] = this.#r(o, l), {
            style: p
          } = this.#e ||= this.#s();
          m.append(this.#e), p.insetInlineEnd = `${100 * c}%`, p.top = `calc(${100 * s}% + var(--editor-toolbar-vert-offset))`;
        }
        hide() {
          this.#e.remove();
        }
        #n() {
          const m = document.createElement("button");
          m.className = "highlightButton", m.tabIndex = 0, m.setAttribute("data-l10n-id", "pdfjs-highlight-floating-button1");
          const o = document.createElement("span");
          m.append(o), o.className = "visuallyHidden", o.setAttribute("data-l10n-id", "pdfjs-highlight-floating-button-label"), m.addEventListener("contextmenu", e.noContextMenu), m.addEventListener("click", () => {
            this.#i.highlightSelection("floating_button");
          }), this.#t.append(m);
        }
      }
    }
  ),
  /***/
  830: (
    /***/
    (d, t, n) => {
      n.d(t, {
        /* harmony export */
        AnnotationEditorUIManager: () => (
          /* binding */
          b
        ),
        /* harmony export */
        ColorManager: () => (
          /* binding */
          p
        ),
        /* harmony export */
        KeyboardManager: () => (
          /* binding */
          s
        ),
        /* harmony export */
        bindEvents: () => (
          /* binding */
          k
        ),
        /* harmony export */
        opacityToHex: () => (
          /* binding */
          m
        )
        /* harmony export */
      });
      var e = n(292), u = n(419), f = n(362);
      function k(S, a, E) {
        for (const i of E)
          a.addEventListener(i, S[i].bind(S));
      }
      function m(S) {
        return Math.round(Math.min(255, Math.max(1, 255 * S))).toString(16).padStart(2, "0");
      }
      class o {
        #t = 0;
        constructor() {
        }
        get id() {
          return `${e.AnnotationEditorPrefix}${this.#t++}`;
        }
      }
      class l {
        #t = (0, e.getUuid)();
        #e = 0;
        #i = null;
        static get _isSVGFittingCanvas() {
          const a = 'data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>', i = new OffscreenCanvas(1, 3).getContext("2d"), r = new Image();
          r.src = a;
          const v = r.decode().then(() => (i.drawImage(r, 0, 0, 1, 1, 0, 0, 1, 3), new Uint32Array(i.getImageData(0, 0, 1, 1).data.buffer)[0] === 0));
          return (0, e.shadow)(this, "_isSVGFittingCanvas", v);
        }
        async #s(a, E) {
          this.#i ||= /* @__PURE__ */ new Map();
          let i = this.#i.get(a);
          if (i === null)
            return null;
          if (i?.bitmap)
            return i.refCounter += 1, i;
          try {
            i ||= {
              bitmap: null,
              id: `image_${this.#t}_${this.#e++}`,
              refCounter: 0,
              isSvg: !1
            };
            let r;
            if (typeof E == "string" ? (i.url = E, r = await (0, u.fetchData)(E, "blob")) : r = i.file = E, r.type === "image/svg+xml") {
              const v = l._isSVGFittingCanvas, y = new FileReader(), R = new Image(), F = new Promise((I, H) => {
                R.onload = () => {
                  i.bitmap = R, i.isSvg = !0, I();
                }, y.onload = async () => {
                  const B = i.svgUrl = y.result;
                  R.src = await v ? `${B}#svgView(preserveAspectRatio(none))` : B;
                }, R.onerror = y.onerror = H;
              });
              y.readAsDataURL(r), await F;
            } else
              i.bitmap = await createImageBitmap(r);
            i.refCounter = 1;
          } catch (r) {
            console.error(r), i = null;
          }
          return this.#i.set(a, i), i && this.#i.set(i.id, i), i;
        }
        async getFromFile(a) {
          const {
            lastModified: E,
            name: i,
            size: r,
            type: v
          } = a;
          return this.#s(`${E}_${i}_${r}_${v}`, a);
        }
        async getFromUrl(a) {
          return this.#s(a, a);
        }
        async getFromId(a) {
          this.#i ||= /* @__PURE__ */ new Map();
          const E = this.#i.get(a);
          return E ? E.bitmap ? (E.refCounter += 1, E) : E.file ? this.getFromFile(E.file) : this.getFromUrl(E.url) : null;
        }
        getSvgUrl(a) {
          const E = this.#i.get(a);
          return E?.isSvg ? E.svgUrl : null;
        }
        deleteId(a) {
          this.#i ||= /* @__PURE__ */ new Map();
          const E = this.#i.get(a);
          E && (E.refCounter -= 1, E.refCounter === 0 && (E.bitmap = null));
        }
        isValidId(a) {
          return a.startsWith(`image_${this.#t}_`);
        }
      }
      class c {
        #t = [];
        #e = !1;
        #i;
        #s = -1;
        constructor(a = 128) {
          this.#i = a;
        }
        add({
          cmd: a,
          undo: E,
          post: i,
          mustExec: r,
          type: v = NaN,
          overwriteIfSameType: y = !1,
          keepUndo: R = !1
        }) {
          if (r && a(), this.#e)
            return;
          const F = {
            cmd: a,
            undo: E,
            post: i,
            type: v
          };
          if (this.#s === -1) {
            this.#t.length > 0 && (this.#t.length = 0), this.#s = 0, this.#t.push(F);
            return;
          }
          if (y && this.#t[this.#s].type === v) {
            R && (F.undo = this.#t[this.#s].undo), this.#t[this.#s] = F;
            return;
          }
          const I = this.#s + 1;
          I === this.#i ? this.#t.splice(0, 1) : (this.#s = I, I < this.#t.length && this.#t.splice(I)), this.#t.push(F);
        }
        undo() {
          if (this.#s === -1)
            return;
          this.#e = !0;
          const {
            undo: a,
            post: E
          } = this.#t[this.#s];
          a(), E?.(), this.#e = !1, this.#s -= 1;
        }
        redo() {
          if (this.#s < this.#t.length - 1) {
            this.#s += 1, this.#e = !0;
            const {
              cmd: a,
              post: E
            } = this.#t[this.#s];
            a(), E?.(), this.#e = !1;
          }
        }
        hasSomethingToUndo() {
          return this.#s !== -1;
        }
        hasSomethingToRedo() {
          return this.#s < this.#t.length - 1;
        }
        destroy() {
          this.#t = null;
        }
      }
      class s {
        constructor(a) {
          this.buffer = [], this.callbacks = /* @__PURE__ */ new Map(), this.allKeys = /* @__PURE__ */ new Set();
          const {
            isMac: E
          } = e.FeatureTest.platform;
          for (const [i, r, v = {}] of a)
            for (const y of i) {
              const R = y.startsWith("mac+");
              E && R ? (this.callbacks.set(y.slice(4), {
                callback: r,
                options: v
              }), this.allKeys.add(y.split("+").at(-1))) : !E && !R && (this.callbacks.set(y, {
                callback: r,
                options: v
              }), this.allKeys.add(y.split("+").at(-1)));
            }
        }
        #t(a) {
          a.altKey && this.buffer.push("alt"), a.ctrlKey && this.buffer.push("ctrl"), a.metaKey && this.buffer.push("meta"), a.shiftKey && this.buffer.push("shift"), this.buffer.push(a.key);
          const E = this.buffer.join("+");
          return this.buffer.length = 0, E;
        }
        exec(a, E) {
          if (!this.allKeys.has(E.key))
            return;
          const i = this.callbacks.get(this.#t(E));
          if (!i)
            return;
          const {
            callback: r,
            options: {
              bubbles: v = !1,
              args: y = [],
              checker: R = null
            }
          } = i;
          R && !R(a, E) || (r.bind(a, ...y, E)(), v || (E.stopPropagation(), E.preventDefault()));
        }
      }
      class p {
        static _colorsMapping = /* @__PURE__ */ new Map([["CanvasText", [0, 0, 0]], ["Canvas", [255, 255, 255]]]);
        get _colors() {
          const a = /* @__PURE__ */ new Map([["CanvasText", null], ["Canvas", null]]);
          return (0, u.getColorValues)(a), (0, e.shadow)(this, "_colors", a);
        }
        convert(a) {
          const E = (0, u.getRGB)(a);
          if (!window.matchMedia("(forced-colors: active)").matches)
            return E;
          for (const [i, r] of this._colors)
            if (r.every((v, y) => v === E[y]))
              return p._colorsMapping.get(i);
          return E;
        }
        getHexCode(a) {
          const E = this._colors.get(a);
          return E ? e.Util.makeHexColor(...E) : a;
        }
      }
      class b {
        #t = null;
        #e = /* @__PURE__ */ new Map();
        #i = /* @__PURE__ */ new Map();
        #s = null;
        #r = null;
        #n = null;
        #a = new c();
        #c = 0;
        #l = /* @__PURE__ */ new Set();
        #d = null;
        #u = null;
        #h = /* @__PURE__ */ new Set();
        #o = !1;
        #p = null;
        #g = null;
        #f = null;
        #A = !1;
        #m = null;
        #v = new o();
        #w = !1;
        #C = !1;
        #k = null;
        #I = null;
        #F = null;
        #y = e.AnnotationEditorType.NONE;
        #b = /* @__PURE__ */ new Set();
        #_ = null;
        #S = null;
        #R = null;
        #T = this.blur.bind(this);
        #M = this.focus.bind(this);
        #x = this.copy.bind(this);
        #P = this.cut.bind(this);
        #L = this.paste.bind(this);
        #N = this.keydown.bind(this);
        #U = this.keyup.bind(this);
        #X = this.onEditingAction.bind(this);
        #j = this.onPageChanging.bind(this);
        #G = this.onScaleChanging.bind(this);
        #z = this.#rt.bind(this);
        #D = this.onRotationChanging.bind(this);
        #K = {
          isEditing: !1,
          isEmpty: !0,
          hasSomethingToUndo: !1,
          hasSomethingToRedo: !1,
          hasSelectedEditor: !1,
          hasSelectedText: !1
        };
        #V = [0, 0];
        #O = null;
        #B = null;
        #J = null;
        static TRANSLATE_SMALL = 1;
        static TRANSLATE_BIG = 10;
        static get _keyboardManager() {
          const a = b.prototype, E = (y) => y.#B.contains(document.activeElement) && document.activeElement.tagName !== "BUTTON" && y.hasSomethingToControl(), i = (y, {
            target: R
          }) => {
            if (R instanceof HTMLInputElement) {
              const {
                type: F
              } = R;
              return F !== "text" && F !== "number";
            }
            return !0;
          }, r = this.TRANSLATE_SMALL, v = this.TRANSLATE_BIG;
          return (0, e.shadow)(this, "_keyboardManager", new s([[["ctrl+a", "mac+meta+a"], a.selectAll, {
            checker: i
          }], [["ctrl+z", "mac+meta+z"], a.undo, {
            checker: i
          }], [["ctrl+y", "ctrl+shift+z", "mac+meta+shift+z", "ctrl+shift+Z", "mac+meta+shift+Z"], a.redo, {
            checker: i
          }], [["Backspace", "alt+Backspace", "ctrl+Backspace", "shift+Backspace", "mac+Backspace", "mac+alt+Backspace", "mac+ctrl+Backspace", "Delete", "ctrl+Delete", "shift+Delete", "mac+Delete"], a.delete, {
            checker: i
          }], [["Enter", "mac+Enter"], a.addNewEditorFromKeyboard, {
            checker: (y, {
              target: R
            }) => !(R instanceof HTMLButtonElement) && y.#B.contains(R) && !y.isEnterHandled
          }], [[" ", "mac+ "], a.addNewEditorFromKeyboard, {
            checker: (y, {
              target: R
            }) => !(R instanceof HTMLButtonElement) && y.#B.contains(document.activeElement)
          }], [["Escape", "mac+Escape"], a.unselectAll], [["ArrowLeft", "mac+ArrowLeft"], a.translateSelectedEditors, {
            args: [-r, 0],
            checker: E
          }], [["ctrl+ArrowLeft", "mac+shift+ArrowLeft"], a.translateSelectedEditors, {
            args: [-v, 0],
            checker: E
          }], [["ArrowRight", "mac+ArrowRight"], a.translateSelectedEditors, {
            args: [r, 0],
            checker: E
          }], [["ctrl+ArrowRight", "mac+shift+ArrowRight"], a.translateSelectedEditors, {
            args: [v, 0],
            checker: E
          }], [["ArrowUp", "mac+ArrowUp"], a.translateSelectedEditors, {
            args: [0, -r],
            checker: E
          }], [["ctrl+ArrowUp", "mac+shift+ArrowUp"], a.translateSelectedEditors, {
            args: [0, -v],
            checker: E
          }], [["ArrowDown", "mac+ArrowDown"], a.translateSelectedEditors, {
            args: [0, r],
            checker: E
          }], [["ctrl+ArrowDown", "mac+shift+ArrowDown"], a.translateSelectedEditors, {
            args: [0, v],
            checker: E
          }]]));
        }
        constructor(a, E, i, r, v, y, R, F, I) {
          this.#B = a, this.#J = E, this.#s = i, this._eventBus = r, this._eventBus._on("editingaction", this.#X), this._eventBus._on("pagechanging", this.#j), this._eventBus._on("scalechanging", this.#G), this._eventBus._on("rotationchanging", this.#D), this.#at(), this.#Z(), this.#r = v.annotationStorage, this.#p = v.filterFactory, this.#S = y, this.#f = R || null, this.#o = F, this.#F = I || null, this.viewParameters = {
            realScale: u.PixelsPerInch.PDF_TO_CSS_UNITS,
            rotation: 0
          }, this.isShiftKeyDown = !1;
        }
        destroy() {
          this.#$(), this.#Q(), this._eventBus._off("editingaction", this.#X), this._eventBus._off("pagechanging", this.#j), this._eventBus._off("scalechanging", this.#G), this._eventBus._off("rotationchanging", this.#D);
          for (const a of this.#i.values())
            a.destroy();
          this.#i.clear(), this.#e.clear(), this.#h.clear(), this.#t = null, this.#b.clear(), this.#a.destroy(), this.#s?.destroy(), this.#m?.hide(), this.#m = null, this.#g && (clearTimeout(this.#g), this.#g = null), this.#O && (clearTimeout(this.#O), this.#O = null), this.#ot();
        }
        async mlGuess(a) {
          return this.#F?.guess(a) || null;
        }
        get hasMLManager() {
          return !!this.#F;
        }
        get hcmFilter() {
          return (0, e.shadow)(this, "hcmFilter", this.#S ? this.#p.addHCMFilter(this.#S.foreground, this.#S.background) : "none");
        }
        get direction() {
          return (0, e.shadow)(this, "direction", getComputedStyle(this.#B).direction);
        }
        get highlightColors() {
          return (0, e.shadow)(this, "highlightColors", this.#f ? new Map(this.#f.split(",").map((a) => a.split("=").map((E) => E.trim()))) : null);
        }
        get highlightColorNames() {
          return (0, e.shadow)(this, "highlightColorNames", this.highlightColors ? new Map(Array.from(this.highlightColors, (a) => a.reverse())) : null);
        }
        setMainHighlightColorPicker(a) {
          this.#I = a;
        }
        editAltText(a) {
          this.#s?.editAltText(this, a);
        }
        onPageChanging({
          pageNumber: a
        }) {
          this.#c = a - 1;
        }
        focusMainContainer() {
          this.#B.focus();
        }
        findParent(a, E) {
          for (const i of this.#i.values()) {
            const {
              x: r,
              y: v,
              width: y,
              height: R
            } = i.div.getBoundingClientRect();
            if (a >= r && a <= r + y && E >= v && E <= v + R)
              return i;
          }
          return null;
        }
        disableUserSelect(a = !1) {
          this.#J.classList.toggle("noUserSelect", a);
        }
        addShouldRescale(a) {
          this.#h.add(a);
        }
        removeShouldRescale(a) {
          this.#h.delete(a);
        }
        onScaleChanging({
          scale: a
        }) {
          this.commitOrRemove(), this.viewParameters.realScale = a * u.PixelsPerInch.PDF_TO_CSS_UNITS;
          for (const E of this.#h)
            E.onScaleChanging();
        }
        onRotationChanging({
          pagesRotation: a
        }) {
          this.commitOrRemove(), this.viewParameters.rotation = a;
        }
        #q({
          anchorNode: a
        }) {
          return a.nodeType === Node.TEXT_NODE ? a.parentElement : a;
        }
        highlightSelection(a = "") {
          const E = document.getSelection();
          if (!E || E.isCollapsed)
            return;
          const {
            anchorNode: i,
            anchorOffset: r,
            focusNode: v,
            focusOffset: y
          } = E, R = E.toString(), I = this.#q(E).closest(".textLayer"), H = this.getSelectionBoxes(I);
          if (H) {
            E.empty(), this.#y === e.AnnotationEditorType.NONE && (this._eventBus.dispatch("showannotationeditorui", {
              source: this,
              mode: e.AnnotationEditorType.HIGHLIGHT
            }), this.showAllEditors("highlight", !0, !0));
            for (const B of this.#i.values())
              if (B.hasTextLayer(I)) {
                B.createAndAddNewEditor({
                  x: 0,
                  y: 0
                }, !1, {
                  methodOfCreation: a,
                  boxes: H,
                  anchorNode: i,
                  anchorOffset: r,
                  focusNode: v,
                  focusOffset: y,
                  text: R
                });
                break;
              }
          }
        }
        #st() {
          const a = document.getSelection();
          if (!a || a.isCollapsed)
            return;
          const i = this.#q(a).closest(".textLayer"), r = this.getSelectionBoxes(i);
          r && (this.#m ||= new f.HighlightToolbar(this), this.#m.show(i, r, this.direction === "ltr"));
        }
        addToAnnotationStorage(a) {
          !a.isEmpty() && this.#r && !this.#r.has(a.id) && this.#r.setValue(a.id, a);
        }
        #rt() {
          const a = document.getSelection();
          if (!a || a.isCollapsed) {
            this.#_ && (this.#m?.hide(), this.#_ = null, this.#E({
              hasSelectedText: !1
            }));
            return;
          }
          const {
            anchorNode: E
          } = a;
          if (E === this.#_)
            return;
          if (!this.#q(a).closest(".textLayer")) {
            this.#_ && (this.#m?.hide(), this.#_ = null, this.#E({
              hasSelectedText: !1
            }));
            return;
          }
          if (this.#m?.hide(), this.#_ = E, this.#E({
            hasSelectedText: !0
          }), !(this.#y !== e.AnnotationEditorType.HIGHLIGHT && this.#y !== e.AnnotationEditorType.NONE) && (this.#y === e.AnnotationEditorType.HIGHLIGHT && this.showAllEditors("highlight", !0, !0), this.#A = this.isShiftKeyDown, !this.isShiftKeyDown)) {
            const v = (y) => {
              y.type === "pointerup" && y.button !== 0 || (window.removeEventListener("pointerup", v), window.removeEventListener("blur", v), y.type === "pointerup" && this.#Y("main_toolbar"));
            };
            window.addEventListener("pointerup", v), window.addEventListener("blur", v);
          }
        }
        #Y(a = "") {
          this.#y === e.AnnotationEditorType.HIGHLIGHT ? this.highlightSelection(a) : this.#o && this.#st();
        }
        #at() {
          document.addEventListener("selectionchange", this.#z);
        }
        #ot() {
          document.removeEventListener("selectionchange", this.#z);
        }
        #lt() {
          window.addEventListener("focus", this.#M), window.addEventListener("blur", this.#T);
        }
        #Q() {
          window.removeEventListener("focus", this.#M), window.removeEventListener("blur", this.#T);
        }
        blur() {
          if (this.isShiftKeyDown = !1, this.#A && (this.#A = !1, this.#Y("main_toolbar")), !this.hasSelection)
            return;
          const {
            activeElement: a
          } = document;
          for (const E of this.#b)
            if (E.div.contains(a)) {
              this.#k = [E, a], E._focusEventsAllowed = !1;
              break;
            }
        }
        focus() {
          if (!this.#k)
            return;
          const [a, E] = this.#k;
          this.#k = null, E.addEventListener("focusin", () => {
            a._focusEventsAllowed = !0;
          }, {
            once: !0
          }), E.focus();
        }
        #Z() {
          window.addEventListener("keydown", this.#N), window.addEventListener("keyup", this.#U);
        }
        #$() {
          window.removeEventListener("keydown", this.#N), window.removeEventListener("keyup", this.#U);
        }
        #tt() {
          document.addEventListener("copy", this.#x), document.addEventListener("cut", this.#P), document.addEventListener("paste", this.#L);
        }
        #et() {
          document.removeEventListener("copy", this.#x), document.removeEventListener("cut", this.#P), document.removeEventListener("paste", this.#L);
        }
        addEditListeners() {
          this.#Z(), this.#tt();
        }
        removeEditListeners() {
          this.#$(), this.#et();
        }
        copy(a) {
          if (a.preventDefault(), this.#t?.commitOrRemove(), !this.hasSelection)
            return;
          const E = [];
          for (const i of this.#b) {
            const r = i.serialize(!0);
            r && E.push(r);
          }
          E.length !== 0 && a.clipboardData.setData("application/pdfjs", JSON.stringify(E));
        }
        cut(a) {
          this.copy(a), this.delete();
        }
        paste(a) {
          a.preventDefault();
          const {
            clipboardData: E
          } = a;
          for (const v of E.items)
            for (const y of this.#u)
              if (y.isHandlingMimeForPasting(v.type)) {
                y.paste(v, this.currentLayer);
                return;
              }
          let i = E.getData("application/pdfjs");
          if (!i)
            return;
          try {
            i = JSON.parse(i);
          } catch (v) {
            (0, e.warn)(`paste: "${v.message}".`);
            return;
          }
          if (!Array.isArray(i))
            return;
          this.unselectAll();
          const r = this.currentLayer;
          try {
            const v = [];
            for (const F of i) {
              const I = r.deserialize(F);
              if (!I)
                return;
              v.push(I);
            }
            const y = () => {
              for (const F of v)
                this.#it(F);
              this.#nt(v);
            }, R = () => {
              for (const F of v)
                F.remove();
            };
            this.addCommands({
              cmd: y,
              undo: R,
              mustExec: !0
            });
          } catch (v) {
            (0, e.warn)(`paste: "${v.message}".`);
          }
        }
        keydown(a) {
          !this.isShiftKeyDown && a.key === "Shift" && (this.isShiftKeyDown = !0), this.#y !== e.AnnotationEditorType.NONE && !this.isEditorHandlingKeyboard && b._keyboardManager.exec(this, a);
        }
        keyup(a) {
          this.isShiftKeyDown && a.key === "Shift" && (this.isShiftKeyDown = !1, this.#A && (this.#A = !1, this.#Y("main_toolbar")));
        }
        onEditingAction({
          name: a
        }) {
          switch (a) {
            case "undo":
            case "redo":
            case "delete":
            case "selectAll":
              this[a]();
              break;
            case "highlightSelection":
              this.highlightSelection("context_menu");
              break;
          }
        }
        #E(a) {
          Object.entries(a).some(([i, r]) => this.#K[i] !== r) && (this._eventBus.dispatch("annotationeditorstateschanged", {
            source: this,
            details: Object.assign(this.#K, a)
          }), this.#y === e.AnnotationEditorType.HIGHLIGHT && a.hasSelectedEditor === !1 && this.#H([[e.AnnotationEditorParamsType.HIGHLIGHT_FREE, !0]]));
        }
        #H(a) {
          this._eventBus.dispatch("annotationeditorparamschanged", {
            source: this,
            details: a
          });
        }
        setEditingState(a) {
          a ? (this.#lt(), this.#tt(), this.#E({
            isEditing: this.#y !== e.AnnotationEditorType.NONE,
            isEmpty: this.#W(),
            hasSomethingToUndo: this.#a.hasSomethingToUndo(),
            hasSomethingToRedo: this.#a.hasSomethingToRedo(),
            hasSelectedEditor: !1
          })) : (this.#Q(), this.#et(), this.#E({
            isEditing: !1
          }), this.disableUserSelect(!1));
        }
        registerEditorTypes(a) {
          if (!this.#u) {
            this.#u = a;
            for (const E of this.#u)
              this.#H(E.defaultPropertiesToUpdate);
          }
        }
        getId() {
          return this.#v.id;
        }
        get currentLayer() {
          return this.#i.get(this.#c);
        }
        getLayer(a) {
          return this.#i.get(a);
        }
        get currentPageIndex() {
          return this.#c;
        }
        addLayer(a) {
          this.#i.set(a.pageIndex, a), this.#w ? a.enable() : a.disable();
        }
        removeLayer(a) {
          this.#i.delete(a.pageIndex);
        }
        updateMode(a, E = null, i = !1) {
          if (this.#y !== a) {
            if (this.#y = a, a === e.AnnotationEditorType.NONE) {
              this.setEditingState(!1), this.#ht();
              return;
            }
            this.setEditingState(!0), this.#ct(), this.unselectAll();
            for (const r of this.#i.values())
              r.updateMode(a);
            if (!E && i) {
              this.addNewEditorFromKeyboard();
              return;
            }
            if (E) {
              for (const r of this.#e.values())
                if (r.annotationElementId === E) {
                  this.setSelected(r), r.enterInEditMode();
                  break;
                }
            }
          }
        }
        addNewEditorFromKeyboard() {
          this.currentLayer.canCreateNewEmptyEditor() && this.currentLayer.addNewEditor();
        }
        updateToolbar(a) {
          a !== this.#y && this._eventBus.dispatch("switchannotationeditormode", {
            source: this,
            mode: a
          });
        }
        updateParams(a, E) {
          if (this.#u) {
            switch (a) {
              case e.AnnotationEditorParamsType.CREATE:
                this.currentLayer.addNewEditor();
                return;
              case e.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:
                this.#I?.updateColor(E);
                break;
              case e.AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL:
                this._eventBus.dispatch("reporttelemetry", {
                  source: this,
                  details: {
                    type: "editing",
                    data: {
                      type: "highlight",
                      action: "toggle_visibility"
                    }
                  }
                }), (this.#R ||= /* @__PURE__ */ new Map()).set(a, E), this.showAllEditors("highlight", E);
                break;
            }
            for (const i of this.#b)
              i.updateParams(a, E);
            for (const i of this.#u)
              i.updateDefaultParams(a, E);
          }
        }
        showAllEditors(a, E, i = !1) {
          for (const v of this.#e.values())
            v.editorType === a && v.show(E);
          (this.#R?.get(e.AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL) ?? !0) !== E && this.#H([[e.AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL, E]]);
        }
        enableWaiting(a = !1) {
          if (this.#C !== a) {
            this.#C = a;
            for (const E of this.#i.values())
              a ? E.disableClick() : E.enableClick(), E.div.classList.toggle("waiting", a);
          }
        }
        #ct() {
          if (!this.#w) {
            this.#w = !0;
            for (const a of this.#i.values())
              a.enable();
            for (const a of this.#e.values())
              a.enable();
          }
        }
        #ht() {
          if (this.unselectAll(), this.#w) {
            this.#w = !1;
            for (const a of this.#i.values())
              a.disable();
            for (const a of this.#e.values())
              a.disable();
          }
        }
        getEditors(a) {
          const E = [];
          for (const i of this.#e.values())
            i.pageIndex === a && E.push(i);
          return E;
        }
        getEditor(a) {
          return this.#e.get(a);
        }
        addEditor(a) {
          this.#e.set(a.id, a);
        }
        removeEditor(a) {
          a.div.contains(document.activeElement) && (this.#g && clearTimeout(this.#g), this.#g = setTimeout(() => {
            this.focusMainContainer(), this.#g = null;
          }, 0)), this.#e.delete(a.id), this.unselect(a), (!a.annotationElementId || !this.#l.has(a.annotationElementId)) && this.#r?.remove(a.id);
        }
        addDeletedAnnotationElement(a) {
          this.#l.add(a.annotationElementId), this.addChangedExistingAnnotation(a), a.deleted = !0;
        }
        isDeletedAnnotationElement(a) {
          return this.#l.has(a);
        }
        removeDeletedAnnotationElement(a) {
          this.#l.delete(a.annotationElementId), this.removeChangedExistingAnnotation(a), a.deleted = !1;
        }
        #it(a) {
          const E = this.#i.get(a.pageIndex);
          E ? E.addOrRebuild(a) : (this.addEditor(a), this.addToAnnotationStorage(a));
        }
        setActiveEditor(a) {
          this.#t !== a && (this.#t = a, a && this.#H(a.propertiesToUpdate));
        }
        get #dt() {
          let a = null;
          for (a of this.#b)
            ;
          return a;
        }
        updateUI(a) {
          this.#dt === a && this.#H(a.propertiesToUpdate);
        }
        toggleSelected(a) {
          if (this.#b.has(a)) {
            this.#b.delete(a), a.unselect(), this.#E({
              hasSelectedEditor: this.hasSelection
            });
            return;
          }
          this.#b.add(a), a.select(), this.#H(a.propertiesToUpdate), this.#E({
            hasSelectedEditor: !0
          });
        }
        setSelected(a) {
          for (const E of this.#b)
            E !== a && E.unselect();
          this.#b.clear(), this.#b.add(a), a.select(), this.#H(a.propertiesToUpdate), this.#E({
            hasSelectedEditor: !0
          });
        }
        isSelected(a) {
          return this.#b.has(a);
        }
        get firstSelectedEditor() {
          return this.#b.values().next().value;
        }
        unselect(a) {
          a.unselect(), this.#b.delete(a), this.#E({
            hasSelectedEditor: this.hasSelection
          });
        }
        get hasSelection() {
          return this.#b.size !== 0;
        }
        get isEnterHandled() {
          return this.#b.size === 1 && this.firstSelectedEditor.isEnterHandled;
        }
        undo() {
          this.#a.undo(), this.#E({
            hasSomethingToUndo: this.#a.hasSomethingToUndo(),
            hasSomethingToRedo: !0,
            isEmpty: this.#W()
          });
        }
        redo() {
          this.#a.redo(), this.#E({
            hasSomethingToUndo: !0,
            hasSomethingToRedo: this.#a.hasSomethingToRedo(),
            isEmpty: this.#W()
          });
        }
        addCommands(a) {
          this.#a.add(a), this.#E({
            hasSomethingToUndo: !0,
            hasSomethingToRedo: !1,
            isEmpty: this.#W()
          });
        }
        #W() {
          if (this.#e.size === 0)
            return !0;
          if (this.#e.size === 1)
            for (const a of this.#e.values())
              return a.isEmpty();
          return !1;
        }
        delete() {
          if (this.commitOrRemove(), !this.hasSelection)
            return;
          const a = [...this.#b], E = () => {
            for (const r of a)
              r.remove();
          }, i = () => {
            for (const r of a)
              this.#it(r);
          };
          this.addCommands({
            cmd: E,
            undo: i,
            mustExec: !0
          });
        }
        commitOrRemove() {
          this.#t?.commitOrRemove();
        }
        hasSomethingToControl() {
          return this.#t || this.hasSelection;
        }
        #nt(a) {
          for (const E of this.#b)
            E.unselect();
          this.#b.clear();
          for (const E of a)
            E.isEmpty() || (this.#b.add(E), E.select());
          this.#E({
            hasSelectedEditor: this.hasSelection
          });
        }
        selectAll() {
          for (const a of this.#b)
            a.commit();
          this.#nt(this.#e.values());
        }
        unselectAll() {
          if (!(this.#t && (this.#t.commitOrRemove(), this.#y !== e.AnnotationEditorType.NONE)) && this.hasSelection) {
            for (const a of this.#b)
              a.unselect();
            this.#b.clear(), this.#E({
              hasSelectedEditor: !1
            });
          }
        }
        translateSelectedEditors(a, E, i = !1) {
          if (i || this.commitOrRemove(), !this.hasSelection)
            return;
          this.#V[0] += a, this.#V[1] += E;
          const [r, v] = this.#V, y = [...this.#b], R = 1e3;
          this.#O && clearTimeout(this.#O), this.#O = setTimeout(() => {
            this.#O = null, this.#V[0] = this.#V[1] = 0, this.addCommands({
              cmd: () => {
                for (const F of y)
                  this.#e.has(F.id) && F.translateInPage(r, v);
              },
              undo: () => {
                for (const F of y)
                  this.#e.has(F.id) && F.translateInPage(-r, -v);
              },
              mustExec: !1
            });
          }, R);
          for (const F of y)
            F.translateInPage(a, E);
        }
        setUpDragSession() {
          if (this.hasSelection) {
            this.disableUserSelect(!0), this.#d = /* @__PURE__ */ new Map();
            for (const a of this.#b)
              this.#d.set(a, {
                savedX: a.x,
                savedY: a.y,
                savedPageIndex: a.pageIndex,
                newX: 0,
                newY: 0,
                newPageIndex: -1
              });
          }
        }
        endDragSession() {
          if (!this.#d)
            return !1;
          this.disableUserSelect(!1);
          const a = this.#d;
          this.#d = null;
          let E = !1;
          for (const [{
            x: r,
            y: v,
            pageIndex: y
          }, R] of a)
            R.newX = r, R.newY = v, R.newPageIndex = y, E ||= r !== R.savedX || v !== R.savedY || y !== R.savedPageIndex;
          if (!E)
            return !1;
          const i = (r, v, y, R) => {
            if (this.#e.has(r.id)) {
              const F = this.#i.get(R);
              F ? r._setParentAndPosition(F, v, y) : (r.pageIndex = R, r.x = v, r.y = y);
            }
          };
          return this.addCommands({
            cmd: () => {
              for (const [r, {
                newX: v,
                newY: y,
                newPageIndex: R
              }] of a)
                i(r, v, y, R);
            },
            undo: () => {
              for (const [r, {
                savedX: v,
                savedY: y,
                savedPageIndex: R
              }] of a)
                i(r, v, y, R);
            },
            mustExec: !0
          }), !0;
        }
        dragSelectedEditors(a, E) {
          if (this.#d)
            for (const i of this.#d.keys())
              i.drag(a, E);
        }
        rebuild(a) {
          if (a.parent === null) {
            const E = this.getLayer(a.pageIndex);
            E ? (E.changeParent(a), E.addOrRebuild(a)) : (this.addEditor(a), this.addToAnnotationStorage(a), a.rebuild());
          } else
            a.parent.addOrRebuild(a);
        }
        get isEditorHandlingKeyboard() {
          return this.getActive()?.shouldGetKeyboardEvents() || this.#b.size === 1 && this.firstSelectedEditor.shouldGetKeyboardEvents();
        }
        isActive(a) {
          return this.#t === a;
        }
        getActive() {
          return this.#t;
        }
        getMode() {
          return this.#y;
        }
        get imageManager() {
          return (0, e.shadow)(this, "imageManager", new l());
        }
        getSelectionBoxes(a) {
          if (!a)
            return null;
          const E = document.getSelection();
          for (let I = 0, H = E.rangeCount; I < H; I++)
            if (!a.contains(E.getRangeAt(I).commonAncestorContainer))
              return null;
          const {
            x: i,
            y: r,
            width: v,
            height: y
          } = a.getBoundingClientRect();
          let R;
          switch (a.getAttribute("data-main-rotation")) {
            case "90":
              R = (I, H, B, U) => ({
                x: (H - r) / y,
                y: 1 - (I + B - i) / v,
                width: U / y,
                height: B / v
              });
              break;
            case "180":
              R = (I, H, B, U) => ({
                x: 1 - (I + B - i) / v,
                y: 1 - (H + U - r) / y,
                width: B / v,
                height: U / y
              });
              break;
            case "270":
              R = (I, H, B, U) => ({
                x: 1 - (H + U - r) / y,
                y: (I - i) / v,
                width: U / y,
                height: B / v
              });
              break;
            default:
              R = (I, H, B, U) => ({
                x: (I - i) / v,
                y: (H - r) / y,
                width: B / v,
                height: U / y
              });
              break;
          }
          const F = [];
          for (let I = 0, H = E.rangeCount; I < H; I++) {
            const B = E.getRangeAt(I);
            if (!B.collapsed)
              for (const {
                x: U,
                y: X,
                width: Z,
                height: lt
              } of B.getClientRects())
                Z === 0 || lt === 0 || F.push(R(U, X, Z, lt));
          }
          return F.length === 0 ? null : F;
        }
        addChangedExistingAnnotation({
          annotationElementId: a,
          id: E
        }) {
          (this.#n ||= /* @__PURE__ */ new Map()).set(a, E);
        }
        removeChangedExistingAnnotation({
          annotationElementId: a
        }) {
          this.#n?.delete(a);
        }
        renderAnnotationElement(a) {
          const E = this.#n?.get(a.data.id);
          if (!E)
            return;
          const i = this.#r.getRawValue(E);
          i && (this.#y === e.AnnotationEditorType.NONE && !i.hasBeenModified || i.renderAnnotationElement(a));
        }
      }
    }
  ),
  /***/
  94: (
    /***/
    (d, t, n) => {
      n.d(t, {
        /* harmony export */
        PDFFetchStream: () => (
          /* binding */
          o
        )
        /* harmony export */
      });
      var e = n(292), u = n(490);
      function f(s, p, b) {
        return {
          method: "GET",
          headers: s,
          signal: b.signal,
          mode: "cors",
          credentials: p ? "include" : "same-origin",
          redirect: "follow"
        };
      }
      function k(s) {
        const p = new Headers();
        for (const b in s) {
          const S = s[b];
          S !== void 0 && p.append(b, S);
        }
        return p;
      }
      function m(s) {
        return s instanceof Uint8Array ? s.buffer : s instanceof ArrayBuffer ? s : ((0, e.warn)(`getArrayBuffer - unexpected data format: ${s}`), new Uint8Array(s).buffer);
      }
      class o {
        constructor(p) {
          this.source = p, this.isHttp = /^https?:/i.test(p.url), this.httpHeaders = this.isHttp && p.httpHeaders || {}, this._fullRequestReader = null, this._rangeRequestReaders = [];
        }
        get _progressiveDataLength() {
          return this._fullRequestReader?._loaded ?? 0;
        }
        getFullReader() {
          return (0, e.assert)(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once."), this._fullRequestReader = new l(this), this._fullRequestReader;
        }
        getRangeReader(p, b) {
          if (b <= this._progressiveDataLength)
            return null;
          const S = new c(this, p, b);
          return this._rangeRequestReaders.push(S), S;
        }
        cancelAllRequests(p) {
          this._fullRequestReader?.cancel(p);
          for (const b of this._rangeRequestReaders.slice(0))
            b.cancel(p);
        }
      }
      class l {
        constructor(p) {
          this._stream = p, this._reader = null, this._loaded = 0, this._filename = null;
          const b = p.source;
          this._withCredentials = b.withCredentials || !1, this._contentLength = b.length, this._headersCapability = Promise.withResolvers(), this._disableRange = b.disableRange || !1, this._rangeChunkSize = b.rangeChunkSize, !this._rangeChunkSize && !this._disableRange && (this._disableRange = !0), this._abortController = new AbortController(), this._isStreamingSupported = !b.disableStream, this._isRangeSupported = !b.disableRange, this._headers = k(this._stream.httpHeaders);
          const S = b.url;
          fetch(S, f(this._headers, this._withCredentials, this._abortController)).then((a) => {
            if (!(0, u.validateResponseStatus)(a.status))
              throw (0, u.createResponseStatusError)(a.status, S);
            this._reader = a.body.getReader(), this._headersCapability.resolve();
            const E = (v) => a.headers.get(v), {
              allowRangeRequests: i,
              suggestedLength: r
            } = (0, u.validateRangeRequestCapabilities)({
              getResponseHeader: E,
              isHttp: this._stream.isHttp,
              rangeChunkSize: this._rangeChunkSize,
              disableRange: this._disableRange
            });
            this._isRangeSupported = i, this._contentLength = r || this._contentLength, this._filename = (0, u.extractFilenameFromHeader)(E), !this._isStreamingSupported && this._isRangeSupported && this.cancel(new e.AbortException("Streaming is disabled."));
          }).catch(this._headersCapability.reject), this.onProgress = null;
        }
        get headersReady() {
          return this._headersCapability.promise;
        }
        get filename() {
          return this._filename;
        }
        get contentLength() {
          return this._contentLength;
        }
        get isRangeSupported() {
          return this._isRangeSupported;
        }
        get isStreamingSupported() {
          return this._isStreamingSupported;
        }
        async read() {
          await this._headersCapability.promise;
          const {
            value: p,
            done: b
          } = await this._reader.read();
          return b ? {
            value: p,
            done: b
          } : (this._loaded += p.byteLength, this.onProgress?.({
            loaded: this._loaded,
            total: this._contentLength
          }), {
            value: m(p),
            done: !1
          });
        }
        cancel(p) {
          this._reader?.cancel(p), this._abortController.abort();
        }
      }
      class c {
        constructor(p, b, S) {
          this._stream = p, this._reader = null, this._loaded = 0;
          const a = p.source;
          this._withCredentials = a.withCredentials || !1, this._readCapability = Promise.withResolvers(), this._isStreamingSupported = !a.disableStream, this._abortController = new AbortController(), this._headers = k(this._stream.httpHeaders), this._headers.append("Range", `bytes=${b}-${S - 1}`);
          const E = a.url;
          fetch(E, f(this._headers, this._withCredentials, this._abortController)).then((i) => {
            if (!(0, u.validateResponseStatus)(i.status))
              throw (0, u.createResponseStatusError)(i.status, E);
            this._readCapability.resolve(), this._reader = i.body.getReader();
          }).catch(this._readCapability.reject), this.onProgress = null;
        }
        get isStreamingSupported() {
          return this._isStreamingSupported;
        }
        async read() {
          await this._readCapability.promise;
          const {
            value: p,
            done: b
          } = await this._reader.read();
          return b ? {
            value: p,
            done: b
          } : (this._loaded += p.byteLength, this.onProgress?.({
            loaded: this._loaded
          }), {
            value: m(p),
            done: !1
          });
        }
        cancel(p) {
          this._reader?.cancel(p), this._abortController.abort();
        }
      }
    }
  ),
  /***/
  10: (
    /***/
    (d, t, n) => {
      n.d(t, {
        /* harmony export */
        FontFaceObject: () => (
          /* binding */
          f
        ),
        /* harmony export */
        FontLoader: () => (
          /* binding */
          u
        )
        /* harmony export */
      });
      var e = n(292);
      class u {
        #t = /* @__PURE__ */ new Set();
        constructor({
          ownerDocument: m = globalThis.document,
          styleElement: o = null
        }) {
          this._document = m, this.nativeFontFaces = /* @__PURE__ */ new Set(), this.styleElement = null, this.loadingRequests = [], this.loadTestFontId = 0;
        }
        addNativeFontFace(m) {
          this.nativeFontFaces.add(m), this._document.fonts.add(m);
        }
        removeNativeFontFace(m) {
          this.nativeFontFaces.delete(m), this._document.fonts.delete(m);
        }
        insertRule(m) {
          this.styleElement || (this.styleElement = this._document.createElement("style"), this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));
          const o = this.styleElement.sheet;
          o.insertRule(m, o.cssRules.length);
        }
        clear() {
          for (const m of this.nativeFontFaces)
            this._document.fonts.delete(m);
          this.nativeFontFaces.clear(), this.#t.clear(), this.styleElement && (this.styleElement.remove(), this.styleElement = null);
        }
        async loadSystemFont({
          systemFontInfo: m,
          _inspectFont: o
        }) {
          if (!(!m || this.#t.has(m.loadedName))) {
            if ((0, e.assert)(!this.disableFontFace, "loadSystemFont shouldn't be called when `disableFontFace` is set."), this.isFontLoadingAPISupported) {
              const {
                loadedName: l,
                src: c,
                style: s
              } = m, p = new FontFace(l, c, s);
              this.addNativeFontFace(p);
              try {
                await p.load(), this.#t.add(l), o?.(m);
              } catch {
                (0, e.warn)(`Cannot load system font: ${m.baseFontName}, installing it could help to improve PDF rendering.`), this.removeNativeFontFace(p);
              }
              return;
            }
            (0, e.unreachable)("Not implemented: loadSystemFont without the Font Loading API.");
          }
        }
        async bind(m) {
          if (m.attached || m.missingFile && !m.systemFontInfo)
            return;
          if (m.attached = !0, m.systemFontInfo) {
            await this.loadSystemFont(m);
            return;
          }
          if (this.isFontLoadingAPISupported) {
            const l = m.createNativeFontFace();
            if (l) {
              this.addNativeFontFace(l);
              try {
                await l.loaded;
              } catch (c) {
                throw (0, e.warn)(`Failed to load font '${l.family}': '${c}'.`), m.disableFontFace = !0, c;
              }
            }
            return;
          }
          const o = m.createFontFaceRule();
          if (o) {
            if (this.insertRule(o), this.isSyncFontLoadingSupported)
              return;
            await new Promise((l) => {
              const c = this._queueLoadingCallback(l);
              this._prepareFontLoadEvent(m, c);
            });
          }
        }
        get isFontLoadingAPISupported() {
          const m = !!this._document?.fonts;
          return (0, e.shadow)(this, "isFontLoadingAPISupported", m);
        }
        get isSyncFontLoadingSupported() {
          let m = !1;
          return (e.isNodeJS || typeof navigator < "u" && typeof navigator?.userAgent == "string" && /Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent)) && (m = !0), (0, e.shadow)(this, "isSyncFontLoadingSupported", m);
        }
        _queueLoadingCallback(m) {
          function o() {
            for ((0, e.assert)(!c.done, "completeRequest() cannot be called twice."), c.done = !0; l.length > 0 && l[0].done; ) {
              const s = l.shift();
              setTimeout(s.callback, 0);
            }
          }
          const {
            loadingRequests: l
          } = this, c = {
            done: !1,
            complete: o,
            callback: m
          };
          return l.push(c), c;
        }
        get _loadTestFont() {
          const m = atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");
          return (0, e.shadow)(this, "_loadTestFont", m);
        }
        _prepareFontLoadEvent(m, o) {
          function l(U, X) {
            return U.charCodeAt(X) << 24 | U.charCodeAt(X + 1) << 16 | U.charCodeAt(X + 2) << 8 | U.charCodeAt(X + 3) & 255;
          }
          function c(U, X, Z, lt) {
            const Y = U.substring(0, X), V = U.substring(X + Z);
            return Y + lt + V;
          }
          let s, p;
          const b = this._document.createElement("canvas");
          b.width = 1, b.height = 1;
          const S = b.getContext("2d");
          let a = 0;
          function E(U, X) {
            if (++a > 30) {
              (0, e.warn)("Load test font never loaded."), X();
              return;
            }
            if (S.font = "30px " + U, S.fillText(".", 0, 20), S.getImageData(0, 0, 1, 1).data[3] > 0) {
              X();
              return;
            }
            setTimeout(E.bind(null, U, X));
          }
          const i = `lt${Date.now()}${this.loadTestFontId++}`;
          let r = this._loadTestFont;
          r = c(r, 976, i.length, i);
          const y = 16, R = 1482184792;
          let F = l(r, y);
          for (s = 0, p = i.length - 3; s < p; s += 4)
            F = F - R + l(i, s) | 0;
          s < i.length && (F = F - R + l(i + "XXX", s) | 0), r = c(r, y, 4, (0, e.string32)(F));
          const I = `url(data:font/opentype;base64,${btoa(r)});`, H = `@font-face {font-family:"${i}";src:${I}}`;
          this.insertRule(H);
          const B = this._document.createElement("div");
          B.style.visibility = "hidden", B.style.width = B.style.height = "10px", B.style.position = "absolute", B.style.top = B.style.left = "0px";
          for (const U of [m.loadedName, i]) {
            const X = this._document.createElement("span");
            X.textContent = "Hi", X.style.fontFamily = U, B.append(X);
          }
          this._document.body.append(B), E(i, () => {
            B.remove(), o.complete();
          });
        }
      }
      class f {
        constructor(m, {
          disableFontFace: o = !1,
          ignoreErrors: l = !1,
          inspectFont: c = null
        }) {
          this.compiledGlyphs = /* @__PURE__ */ Object.create(null);
          for (const s in m)
            this[s] = m[s];
          this.disableFontFace = o === !0, this.ignoreErrors = l === !0, this._inspectFont = c;
        }
        createNativeFontFace() {
          if (!this.data || this.disableFontFace)
            return null;
          let m;
          if (!this.cssFontInfo)
            m = new FontFace(this.loadedName, this.data, {});
          else {
            const o = {
              weight: this.cssFontInfo.fontWeight
            };
            this.cssFontInfo.italicAngle && (o.style = `oblique ${this.cssFontInfo.italicAngle}deg`), m = new FontFace(this.cssFontInfo.fontFamily, this.data, o);
          }
          return this._inspectFont?.(this), m;
        }
        createFontFaceRule() {
          if (!this.data || this.disableFontFace)
            return null;
          const m = (0, e.bytesToString)(this.data), o = `url(data:${this.mimetype};base64,${btoa(m)});`;
          let l;
          if (!this.cssFontInfo)
            l = `@font-face {font-family:"${this.loadedName}";src:${o}}`;
          else {
            let c = `font-weight: ${this.cssFontInfo.fontWeight};`;
            this.cssFontInfo.italicAngle && (c += `font-style: oblique ${this.cssFontInfo.italicAngle}deg;`), l = `@font-face {font-family:"${this.cssFontInfo.fontFamily}";${c}src:${o}}`;
          }
          return this._inspectFont?.(this, o), l;
        }
        getPathGenerator(m, o) {
          if (this.compiledGlyphs[o] !== void 0)
            return this.compiledGlyphs[o];
          let l;
          try {
            l = m.get(this.loadedName + "_path_" + o);
          } catch (s) {
            if (!this.ignoreErrors)
              throw s;
            (0, e.warn)(`getPathGenerator - ignoring character: "${s}".`);
          }
          if (!Array.isArray(l) || l.length === 0)
            return this.compiledGlyphs[o] = function(s, p) {
            };
          const c = [];
          for (let s = 0, p = l.length; s < p; )
            switch (l[s++]) {
              case e.FontRenderOps.BEZIER_CURVE_TO:
                {
                  const [b, S, a, E, i, r] = l.slice(s, s + 6);
                  c.push((v) => v.bezierCurveTo(b, S, a, E, i, r)), s += 6;
                }
                break;
              case e.FontRenderOps.MOVE_TO:
                {
                  const [b, S] = l.slice(s, s + 2);
                  c.push((a) => a.moveTo(b, S)), s += 2;
                }
                break;
              case e.FontRenderOps.LINE_TO:
                {
                  const [b, S] = l.slice(s, s + 2);
                  c.push((a) => a.lineTo(b, S)), s += 2;
                }
                break;
              case e.FontRenderOps.QUADRATIC_CURVE_TO:
                {
                  const [b, S, a, E] = l.slice(s, s + 4);
                  c.push((i) => i.quadraticCurveTo(b, S, a, E)), s += 4;
                }
                break;
              case e.FontRenderOps.RESTORE:
                c.push((b) => b.restore());
                break;
              case e.FontRenderOps.SAVE:
                c.push((b) => b.save());
                break;
              case e.FontRenderOps.SCALE:
                (0, e.assert)(c.length === 2, "Scale command is only valid at the third position.");
                break;
              case e.FontRenderOps.TRANSFORM:
                {
                  const [b, S, a, E, i, r] = l.slice(s, s + 6);
                  c.push((v) => v.transform(b, S, a, E, i, r)), s += 6;
                }
                break;
              case e.FontRenderOps.TRANSLATE:
                {
                  const [b, S] = l.slice(s, s + 2);
                  c.push((a) => a.translate(b, S)), s += 2;
                }
                break;
            }
          return this.compiledGlyphs[o] = function(p, b) {
            c[0](p), c[1](p), p.scale(b, -b);
            for (let S = 2, a = c.length; S < a; S++)
              c[S](p);
          };
        }
      }
    }
  ),
  /***/
  62: (
    /***/
    (d, t, n) => {
      n.d(t, {
        /* harmony export */
        Metadata: () => (
          /* binding */
          u
        )
        /* harmony export */
      });
      var e = n(292);
      class u {
        #t;
        #e;
        constructor({
          parsedData: k,
          rawData: m
        }) {
          this.#t = k, this.#e = m;
        }
        getRaw() {
          return this.#e;
        }
        get(k) {
          return this.#t.get(k) ?? null;
        }
        getAll() {
          return (0, e.objectFromMap)(this.#t);
        }
        has(k) {
          return this.#t.has(k);
        }
      }
    }
  ),
  /***/
  457: (
    /***/
    (d, t, n) => {
      n.d(t, {
        /* harmony export */
        PDFNetworkStream: () => (
          /* binding */
          l
        )
        /* harmony export */
      });
      var e = n(292), u = n(490);
      const f = 200, k = 206;
      function m(p) {
        const b = p.response;
        return typeof b != "string" ? b : (0, e.stringToBytes)(b).buffer;
      }
      class o {
        constructor(b, S = {}) {
          this.url = b, this.isHttp = /^https?:/i.test(b), this.httpHeaders = this.isHttp && S.httpHeaders || /* @__PURE__ */ Object.create(null), this.withCredentials = S.withCredentials || !1, this.currXhrId = 0, this.pendingRequests = /* @__PURE__ */ Object.create(null);
        }
        requestRange(b, S, a) {
          const E = {
            begin: b,
            end: S
          };
          for (const i in a)
            E[i] = a[i];
          return this.request(E);
        }
        requestFull(b) {
          return this.request(b);
        }
        request(b) {
          const S = new XMLHttpRequest(), a = this.currXhrId++, E = this.pendingRequests[a] = {
            xhr: S
          };
          S.open("GET", this.url), S.withCredentials = this.withCredentials;
          for (const i in this.httpHeaders) {
            const r = this.httpHeaders[i];
            r !== void 0 && S.setRequestHeader(i, r);
          }
          return this.isHttp && "begin" in b && "end" in b ? (S.setRequestHeader("Range", `bytes=${b.begin}-${b.end - 1}`), E.expectedStatus = k) : E.expectedStatus = f, S.responseType = "arraybuffer", b.onError && (S.onerror = function(i) {
            b.onError(S.status);
          }), S.onreadystatechange = this.onStateChange.bind(this, a), S.onprogress = this.onProgress.bind(this, a), E.onHeadersReceived = b.onHeadersReceived, E.onDone = b.onDone, E.onError = b.onError, E.onProgress = b.onProgress, S.send(null), a;
        }
        onProgress(b, S) {
          const a = this.pendingRequests[b];
          a && a.onProgress?.(S);
        }
        onStateChange(b, S) {
          const a = this.pendingRequests[b];
          if (!a)
            return;
          const E = a.xhr;
          if (E.readyState >= 2 && a.onHeadersReceived && (a.onHeadersReceived(), delete a.onHeadersReceived), E.readyState !== 4 || !(b in this.pendingRequests))
            return;
          if (delete this.pendingRequests[b], E.status === 0 && this.isHttp) {
            a.onError?.(E.status);
            return;
          }
          const i = E.status || f;
          if (!(i === f && a.expectedStatus === k) && i !== a.expectedStatus) {
            a.onError?.(E.status);
            return;
          }
          const v = m(E);
          if (i === k) {
            const y = E.getResponseHeader("Content-Range"), R = /bytes (\d+)-(\d+)\/(\d+)/.exec(y);
            a.onDone({
              begin: parseInt(R[1], 10),
              chunk: v
            });
          } else
            v ? a.onDone({
              begin: 0,
              chunk: v
            }) : a.onError?.(E.status);
        }
        getRequestXhr(b) {
          return this.pendingRequests[b].xhr;
        }
        isPendingRequest(b) {
          return b in this.pendingRequests;
        }
        abortRequest(b) {
          const S = this.pendingRequests[b].xhr;
          delete this.pendingRequests[b], S.abort();
        }
      }
      class l {
        constructor(b) {
          this._source = b, this._manager = new o(b.url, {
            httpHeaders: b.httpHeaders,
            withCredentials: b.withCredentials
          }), this._rangeChunkSize = b.rangeChunkSize, this._fullRequestReader = null, this._rangeRequestReaders = [];
        }
        _onRangeRequestReaderClosed(b) {
          const S = this._rangeRequestReaders.indexOf(b);
          S >= 0 && this._rangeRequestReaders.splice(S, 1);
        }
        getFullReader() {
          return (0, e.assert)(!this._fullRequestReader, "PDFNetworkStream.getFullReader can only be called once."), this._fullRequestReader = new c(this._manager, this._source), this._fullRequestReader;
        }
        getRangeReader(b, S) {
          const a = new s(this._manager, b, S);
          return a.onClosed = this._onRangeRequestReaderClosed.bind(this), this._rangeRequestReaders.push(a), a;
        }
        cancelAllRequests(b) {
          this._fullRequestReader?.cancel(b);
          for (const S of this._rangeRequestReaders.slice(0))
            S.cancel(b);
        }
      }
      class c {
        constructor(b, S) {
          this._manager = b;
          const a = {
            onHeadersReceived: this._onHeadersReceived.bind(this),
            onDone: this._onDone.bind(this),
            onError: this._onError.bind(this),
            onProgress: this._onProgress.bind(this)
          };
          this._url = S.url, this._fullRequestId = b.requestFull(a), this._headersReceivedCapability = Promise.withResolvers(), this._disableRange = S.disableRange || !1, this._contentLength = S.length, this._rangeChunkSize = S.rangeChunkSize, !this._rangeChunkSize && !this._disableRange && (this._disableRange = !0), this._isStreamingSupported = !1, this._isRangeSupported = !1, this._cachedChunks = [], this._requests = [], this._done = !1, this._storedError = void 0, this._filename = null, this.onProgress = null;
        }
        _onHeadersReceived() {
          const b = this._fullRequestId, S = this._manager.getRequestXhr(b), a = (r) => S.getResponseHeader(r), {
            allowRangeRequests: E,
            suggestedLength: i
          } = (0, u.validateRangeRequestCapabilities)({
            getResponseHeader: a,
            isHttp: this._manager.isHttp,
            rangeChunkSize: this._rangeChunkSize,
            disableRange: this._disableRange
          });
          E && (this._isRangeSupported = !0), this._contentLength = i || this._contentLength, this._filename = (0, u.extractFilenameFromHeader)(a), this._isRangeSupported && this._manager.abortRequest(b), this._headersReceivedCapability.resolve();
        }
        _onDone(b) {
          if (b && (this._requests.length > 0 ? this._requests.shift().resolve({
            value: b.chunk,
            done: !1
          }) : this._cachedChunks.push(b.chunk)), this._done = !0, !(this._cachedChunks.length > 0)) {
            for (const S of this._requests)
              S.resolve({
                value: void 0,
                done: !0
              });
            this._requests.length = 0;
          }
        }
        _onError(b) {
          this._storedError = (0, u.createResponseStatusError)(b, this._url), this._headersReceivedCapability.reject(this._storedError);
          for (const S of this._requests)
            S.reject(this._storedError);
          this._requests.length = 0, this._cachedChunks.length = 0;
        }
        _onProgress(b) {
          this.onProgress?.({
            loaded: b.loaded,
            total: b.lengthComputable ? b.total : this._contentLength
          });
        }
        get filename() {
          return this._filename;
        }
        get isRangeSupported() {
          return this._isRangeSupported;
        }
        get isStreamingSupported() {
          return this._isStreamingSupported;
        }
        get contentLength() {
          return this._contentLength;
        }
        get headersReady() {
          return this._headersReceivedCapability.promise;
        }
        async read() {
          if (this._storedError)
            throw this._storedError;
          if (this._cachedChunks.length > 0)
            return {
              value: this._cachedChunks.shift(),
              done: !1
            };
          if (this._done)
            return {
              value: void 0,
              done: !0
            };
          const b = Promise.withResolvers();
          return this._requests.push(b), b.promise;
        }
        cancel(b) {
          this._done = !0, this._headersReceivedCapability.reject(b);
          for (const S of this._requests)
            S.resolve({
              value: void 0,
              done: !0
            });
          this._requests.length = 0, this._manager.isPendingRequest(this._fullRequestId) && this._manager.abortRequest(this._fullRequestId), this._fullRequestReader = null;
        }
      }
      class s {
        constructor(b, S, a) {
          this._manager = b;
          const E = {
            onDone: this._onDone.bind(this),
            onError: this._onError.bind(this),
            onProgress: this._onProgress.bind(this)
          };
          this._url = b.url, this._requestId = b.requestRange(S, a, E), this._requests = [], this._queuedChunk = null, this._done = !1, this._storedError = void 0, this.onProgress = null, this.onClosed = null;
        }
        _close() {
          this.onClosed?.(this);
        }
        _onDone(b) {
          const S = b.chunk;
          this._requests.length > 0 ? this._requests.shift().resolve({
            value: S,
            done: !1
          }) : this._queuedChunk = S, this._done = !0;
          for (const a of this._requests)
            a.resolve({
              value: void 0,
              done: !0
            });
          this._requests.length = 0, this._close();
        }
        _onError(b) {
          this._storedError = (0, u.createResponseStatusError)(b, this._url);
          for (const S of this._requests)
            S.reject(this._storedError);
          this._requests.length = 0, this._queuedChunk = null;
        }
        _onProgress(b) {
          this.isStreamingSupported || this.onProgress?.({
            loaded: b.loaded
          });
        }
        get isStreamingSupported() {
          return !1;
        }
        async read() {
          if (this._storedError)
            throw this._storedError;
          if (this._queuedChunk !== null) {
            const S = this._queuedChunk;
            return this._queuedChunk = null, {
              value: S,
              done: !1
            };
          }
          if (this._done)
            return {
              value: void 0,
              done: !0
            };
          const b = Promise.withResolvers();
          return this._requests.push(b), b.promise;
        }
        cancel(b) {
          this._done = !0;
          for (const S of this._requests)
            S.resolve({
              value: void 0,
              done: !0
            });
          this._requests.length = 0, this._manager.isPendingRequest(this._requestId) && this._manager.abortRequest(this._requestId), this._close();
        }
      }
    }
  ),
  /***/
  490: (
    /***/
    (d, t, n) => {
      n.d(t, {
        createResponseStatusError: () => (
          /* binding */
          o
        ),
        extractFilenameFromHeader: () => (
          /* binding */
          m
        ),
        validateRangeRequestCapabilities: () => (
          /* binding */
          k
        ),
        validateResponseStatus: () => (
          /* binding */
          l
        )
      });
      var e = n(292);
      function u(c) {
        let s = !0, p = b("filename\\*", "i").exec(c);
        if (p) {
          p = p[1];
          let y = i(p);
          return y = unescape(y), y = r(y), y = v(y), a(y);
        }
        if (p = E(c), p) {
          const y = v(p);
          return a(y);
        }
        if (p = b("filename", "i").exec(c), p) {
          p = p[1];
          let y = i(p);
          return y = v(y), a(y);
        }
        function b(y, R) {
          return new RegExp("(?:^|;)\\s*" + y + '\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)', R);
        }
        function S(y, R) {
          if (y) {
            if (!/^[\x00-\xFF]+$/.test(R))
              return R;
            try {
              const F = new TextDecoder(y, {
                fatal: !0
              }), I = (0, e.stringToBytes)(R);
              R = F.decode(I), s = !1;
            } catch {
            }
          }
          return R;
        }
        function a(y) {
          return s && /[\x80-\xff]/.test(y) && (y = S("utf-8", y), s && (y = S("iso-8859-1", y))), y;
        }
        function E(y) {
          const R = [];
          let F;
          const I = b("filename\\*((?!0\\d)\\d+)(\\*?)", "ig");
          for (; (F = I.exec(y)) !== null; ) {
            let [, B, U, X] = F;
            if (B = parseInt(B, 10), B in R) {
              if (B === 0)
                break;
              continue;
            }
            R[B] = [U, X];
          }
          const H = [];
          for (let B = 0; B < R.length && B in R; ++B) {
            let [U, X] = R[B];
            X = i(X), U && (X = unescape(X), B === 0 && (X = r(X))), H.push(X);
          }
          return H.join("");
        }
        function i(y) {
          if (y.startsWith('"')) {
            const R = y.slice(1).split('\\"');
            for (let F = 0; F < R.length; ++F) {
              const I = R[F].indexOf('"');
              I !== -1 && (R[F] = R[F].slice(0, I), R.length = F + 1), R[F] = R[F].replaceAll(/\\(.)/g, "$1");
            }
            y = R.join('"');
          }
          return y;
        }
        function r(y) {
          const R = y.indexOf("'");
          if (R === -1)
            return y;
          const F = y.slice(0, R), H = y.slice(R + 1).replace(/^[^']*'/, "");
          return S(F, H);
        }
        function v(y) {
          return !y.startsWith("=?") || /[\x00-\x19\x80-\xff]/.test(y) ? y : y.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g, function(R, F, I, H) {
            if (I === "q" || I === "Q")
              return H = H.replaceAll("_", " "), H = H.replaceAll(/=([0-9a-fA-F]{2})/g, function(B, U) {
                return String.fromCharCode(parseInt(U, 16));
              }), S(F, H);
            try {
              H = atob(H);
            } catch {
            }
            return S(F, H);
          });
        }
        return "";
      }
      var f = n(419);
      function k({
        getResponseHeader: c,
        isHttp: s,
        rangeChunkSize: p,
        disableRange: b
      }) {
        const S = {
          allowRangeRequests: !1,
          suggestedLength: void 0
        }, a = parseInt(c("Content-Length"), 10);
        return !Number.isInteger(a) || (S.suggestedLength = a, a <= 2 * p) || b || !s || c("Accept-Ranges") !== "bytes" || (c("Content-Encoding") || "identity") !== "identity" || (S.allowRangeRequests = !0), S;
      }
      function m(c) {
        const s = c("Content-Disposition");
        if (s) {
          let p = u(s);
          if (p.includes("%"))
            try {
              p = decodeURIComponent(p);
            } catch {
            }
          if ((0, f.isPdfFile)(p))
            return p;
        }
        return null;
      }
      function o(c, s) {
        return c === 404 || c === 0 && s.startsWith("file:") ? new e.MissingPDFException('Missing PDF "' + s + '".') : new e.UnexpectedResponseException(`Unexpected server response (${c}) while retrieving PDF "${s}".`, c);
      }
      function l(c) {
        return c === 200 || c === 206;
      }
    }
  ),
  /***/
  786: (
    /***/
    (d, t, n) => {
      n.a(d, async (e, u) => {
        try {
          let p = function(R) {
            const F = c.parse(R);
            return F.protocol === "file:" || F.host ? F : /^[a-z]:[/\\]/i.test(R) ? c.parse(`file:///${R}`) : (F.host || (F.protocol = "file:"), F);
          }, E = function(R, F) {
            return {
              protocol: R.protocol,
              auth: R.auth,
              host: R.hostname,
              port: R.port,
              path: R.path,
              method: "GET",
              headers: F
            };
          };
          n.d(t, {
            /* harmony export */
            PDFNodeStream: () => (
              /* binding */
              b
            )
            /* harmony export */
          });
          var f = n(292), k = n(490);
          let m, o, l, c;
          f.isNodeJS && (m = await import(
            /*webpackIgnore: true*/
            "./__vite-browser-external-DYxpcVy9.js"
          ), o = await import(
            /*webpackIgnore: true*/
            "./__vite-browser-external-DYxpcVy9.js"
          ), l = await import(
            /*webpackIgnore: true*/
            "./__vite-browser-external-DYxpcVy9.js"
          ), c = await import(
            /*webpackIgnore: true*/
            "./__vite-browser-external-DYxpcVy9.js"
          ));
          const s = /^file:\/\/\/[a-zA-Z]:\//;
          class b {
            constructor(F) {
              this.source = F, this.url = p(F.url), this.isHttp = this.url.protocol === "http:" || this.url.protocol === "https:", this.isFsUrl = this.url.protocol === "file:", this.httpHeaders = this.isHttp && F.httpHeaders || {}, this._fullRequestReader = null, this._rangeRequestReaders = [];
            }
            get _progressiveDataLength() {
              return this._fullRequestReader?._loaded ?? 0;
            }
            getFullReader() {
              return (0, f.assert)(!this._fullRequestReader, "PDFNodeStream.getFullReader can only be called once."), this._fullRequestReader = this.isFsUrl ? new v(this) : new i(this), this._fullRequestReader;
            }
            getRangeReader(F, I) {
              if (I <= this._progressiveDataLength)
                return null;
              const H = this.isFsUrl ? new y(this, F, I) : new r(this, F, I);
              return this._rangeRequestReaders.push(H), H;
            }
            cancelAllRequests(F) {
              this._fullRequestReader?.cancel(F);
              for (const I of this._rangeRequestReaders.slice(0))
                I.cancel(F);
            }
          }
          class S {
            constructor(F) {
              this._url = F.url, this._done = !1, this._storedError = null, this.onProgress = null;
              const I = F.source;
              this._contentLength = I.length, this._loaded = 0, this._filename = null, this._disableRange = I.disableRange || !1, this._rangeChunkSize = I.rangeChunkSize, !this._rangeChunkSize && !this._disableRange && (this._disableRange = !0), this._isStreamingSupported = !I.disableStream, this._isRangeSupported = !I.disableRange, this._readableStream = null, this._readCapability = Promise.withResolvers(), this._headersCapability = Promise.withResolvers();
            }
            get headersReady() {
              return this._headersCapability.promise;
            }
            get filename() {
              return this._filename;
            }
            get contentLength() {
              return this._contentLength;
            }
            get isRangeSupported() {
              return this._isRangeSupported;
            }
            get isStreamingSupported() {
              return this._isStreamingSupported;
            }
            async read() {
              if (await this._readCapability.promise, this._done)
                return {
                  value: void 0,
                  done: !0
                };
              if (this._storedError)
                throw this._storedError;
              const F = this._readableStream.read();
              return F === null ? (this._readCapability = Promise.withResolvers(), this.read()) : (this._loaded += F.length, this.onProgress?.({
                loaded: this._loaded,
                total: this._contentLength
              }), {
                value: new Uint8Array(F).buffer,
                done: !1
              });
            }
            cancel(F) {
              if (!this._readableStream) {
                this._error(F);
                return;
              }
              this._readableStream.destroy(F);
            }
            _error(F) {
              this._storedError = F, this._readCapability.resolve();
            }
            _setReadableStream(F) {
              this._readableStream = F, F.on("readable", () => {
                this._readCapability.resolve();
              }), F.on("end", () => {
                F.destroy(), this._done = !0, this._readCapability.resolve();
              }), F.on("error", (I) => {
                this._error(I);
              }), !this._isStreamingSupported && this._isRangeSupported && this._error(new f.AbortException("streaming is disabled")), this._storedError && this._readableStream.destroy(this._storedError);
            }
          }
          class a {
            constructor(F) {
              this._url = F.url, this._done = !1, this._storedError = null, this.onProgress = null, this._loaded = 0, this._readableStream = null, this._readCapability = Promise.withResolvers();
              const I = F.source;
              this._isStreamingSupported = !I.disableStream;
            }
            get isStreamingSupported() {
              return this._isStreamingSupported;
            }
            async read() {
              if (await this._readCapability.promise, this._done)
                return {
                  value: void 0,
                  done: !0
                };
              if (this._storedError)
                throw this._storedError;
              const F = this._readableStream.read();
              return F === null ? (this._readCapability = Promise.withResolvers(), this.read()) : (this._loaded += F.length, this.onProgress?.({
                loaded: this._loaded
              }), {
                value: new Uint8Array(F).buffer,
                done: !1
              });
            }
            cancel(F) {
              if (!this._readableStream) {
                this._error(F);
                return;
              }
              this._readableStream.destroy(F);
            }
            _error(F) {
              this._storedError = F, this._readCapability.resolve();
            }
            _setReadableStream(F) {
              this._readableStream = F, F.on("readable", () => {
                this._readCapability.resolve();
              }), F.on("end", () => {
                F.destroy(), this._done = !0, this._readCapability.resolve();
              }), F.on("error", (I) => {
                this._error(I);
              }), this._storedError && this._readableStream.destroy(this._storedError);
            }
          }
          class i extends S {
            constructor(F) {
              super(F);
              const I = (H) => {
                if (H.statusCode === 404) {
                  const Z = new f.MissingPDFException(`Missing PDF "${this._url}".`);
                  this._storedError = Z, this._headersCapability.reject(Z);
                  return;
                }
                this._headersCapability.resolve(), this._setReadableStream(H);
                const B = (Z) => this._readableStream.headers[Z.toLowerCase()], {
                  allowRangeRequests: U,
                  suggestedLength: X
                } = (0, k.validateRangeRequestCapabilities)({
                  getResponseHeader: B,
                  isHttp: F.isHttp,
                  rangeChunkSize: this._rangeChunkSize,
                  disableRange: this._disableRange
                });
                this._isRangeSupported = U, this._contentLength = X || this._contentLength, this._filename = (0, k.extractFilenameFromHeader)(B);
              };
              this._request = null, this._url.protocol === "http:" ? this._request = o.request(E(this._url, F.httpHeaders), I) : this._request = l.request(E(this._url, F.httpHeaders), I), this._request.on("error", (H) => {
                this._storedError = H, this._headersCapability.reject(H);
              }), this._request.end();
            }
          }
          class r extends a {
            constructor(F, I, H) {
              super(F), this._httpHeaders = {};
              for (const U in F.httpHeaders) {
                const X = F.httpHeaders[U];
                X !== void 0 && (this._httpHeaders[U] = X);
              }
              this._httpHeaders.Range = `bytes=${I}-${H - 1}`;
              const B = (U) => {
                if (U.statusCode === 404) {
                  const X = new f.MissingPDFException(`Missing PDF "${this._url}".`);
                  this._storedError = X;
                  return;
                }
                this._setReadableStream(U);
              };
              this._request = null, this._url.protocol === "http:" ? this._request = o.request(E(this._url, this._httpHeaders), B) : this._request = l.request(E(this._url, this._httpHeaders), B), this._request.on("error", (U) => {
                this._storedError = U;
              }), this._request.end();
            }
          }
          class v extends S {
            constructor(F) {
              super(F);
              let I = decodeURIComponent(this._url.path);
              s.test(this._url.href) && (I = I.replace(/^\//, "")), m.promises.lstat(I).then((H) => {
                this._contentLength = H.size, this._setReadableStream(m.createReadStream(I)), this._headersCapability.resolve();
              }, (H) => {
                H.code === "ENOENT" && (H = new f.MissingPDFException(`Missing PDF "${I}".`)), this._storedError = H, this._headersCapability.reject(H);
              });
            }
          }
          class y extends a {
            constructor(F, I, H) {
              super(F);
              let B = decodeURIComponent(this._url.path);
              s.test(this._url.href) && (B = B.replace(/^\//, "")), this._setReadableStream(m.createReadStream(B, {
                start: I,
                end: H - 1
              }));
            }
          }
          u();
        } catch (m) {
          u(m);
        }
      }, 1);
    }
  ),
  /***/
  573: (
    /***/
    (d, t, n) => {
      n.a(d, async (e, u) => {
        try {
          n.d(t, {
            /* harmony export */
            NodeCMapReaderFactory: () => (
              /* binding */
              b
            ),
            /* harmony export */
            NodeCanvasFactory: () => (
              /* binding */
              p
            ),
            /* harmony export */
            NodeFilterFactory: () => (
              /* binding */
              s
            ),
            /* harmony export */
            NodeStandardFontDataFactory: () => (
              /* binding */
              S
            )
            /* harmony export */
          });
          var f = n(583), k = n(292);
          let m, o, l;
          if (k.isNodeJS) {
            m = await import(
              /*webpackIgnore: true*/
              "./__vite-browser-external-DYxpcVy9.js"
            );
            try {
              o = await import(
                /*webpackIgnore: true*/
                "./__vite-browser-external-DYxpcVy9.js"
              );
            } catch {
            }
            try {
              l = await import(
                /*webpackIgnore: true*/
                "./index-V38oYatP.js"
              );
            } catch {
            }
          }
          const c = function(a) {
            return m.promises.readFile(a).then((E) => new Uint8Array(E));
          };
          class s extends f.BaseFilterFactory {
          }
          class p extends f.BaseCanvasFactory {
            _createCanvas(E, i) {
              return o.createCanvas(E, i);
            }
          }
          class b extends f.BaseCMapReaderFactory {
            _fetchData(E, i) {
              return c(E).then((r) => ({
                cMapData: r,
                compressionType: i
              }));
            }
          }
          class S extends f.BaseStandardFontDataFactory {
            _fetchData(E) {
              return c(E);
            }
          }
          u();
        } catch (m) {
          u(m);
        }
      }, 1);
    }
  ),
  /***/
  626: (
    /***/
    (d, t, n) => {
      n.d(t, {
        /* harmony export */
        OptionalContentConfig: () => (
          /* binding */
          m
        )
        /* harmony export */
      });
      var e = n(292), u = n(651);
      const f = Symbol("INTERNAL");
      class k {
        #t = !1;
        #e = !1;
        #i = !1;
        #s = !0;
        constructor(l, {
          name: c,
          intent: s,
          usage: p
        }) {
          this.#t = !!(l & e.RenderingIntentFlag.DISPLAY), this.#e = !!(l & e.RenderingIntentFlag.PRINT), this.name = c, this.intent = s, this.usage = p;
        }
        get visible() {
          if (this.#i)
            return this.#s;
          if (!this.#s)
            return !1;
          const {
            print: l,
            view: c
          } = this.usage;
          return this.#t ? c?.viewState !== "OFF" : this.#e ? l?.printState !== "OFF" : !0;
        }
        _setVisible(l, c, s = !1) {
          l !== f && (0, e.unreachable)("Internal method `_setVisible` called."), this.#i = s, this.#s = c;
        }
      }
      class m {
        #t = null;
        #e = /* @__PURE__ */ new Map();
        #i = null;
        #s = null;
        constructor(l, c = e.RenderingIntentFlag.DISPLAY) {
          if (this.renderingIntent = c, this.name = null, this.creator = null, l !== null) {
            this.name = l.name, this.creator = l.creator, this.#s = l.order;
            for (const s of l.groups)
              this.#e.set(s.id, new k(c, s));
            if (l.baseState === "OFF")
              for (const s of this.#e.values())
                s._setVisible(f, !1);
            for (const s of l.on)
              this.#e.get(s)._setVisible(f, !0);
            for (const s of l.off)
              this.#e.get(s)._setVisible(f, !1);
            this.#i = this.getHash();
          }
        }
        #r(l) {
          const c = l.length;
          if (c < 2)
            return !0;
          const s = l[0];
          for (let p = 1; p < c; p++) {
            const b = l[p];
            let S;
            if (Array.isArray(b))
              S = this.#r(b);
            else if (this.#e.has(b))
              S = this.#e.get(b).visible;
            else
              return (0, e.warn)(`Optional content group not found: ${b}`), !0;
            switch (s) {
              case "And":
                if (!S)
                  return !1;
                break;
              case "Or":
                if (S)
                  return !0;
                break;
              case "Not":
                return !S;
              default:
                return !0;
            }
          }
          return s === "And";
        }
        isVisible(l) {
          if (this.#e.size === 0)
            return !0;
          if (!l)
            return (0, e.info)("Optional content group not defined."), !0;
          if (l.type === "OCG")
            return this.#e.has(l.id) ? this.#e.get(l.id).visible : ((0, e.warn)(`Optional content group not found: ${l.id}`), !0);
          if (l.type === "OCMD") {
            if (l.expression)
              return this.#r(l.expression);
            if (!l.policy || l.policy === "AnyOn") {
              for (const c of l.ids) {
                if (!this.#e.has(c))
                  return (0, e.warn)(`Optional content group not found: ${c}`), !0;
                if (this.#e.get(c).visible)
                  return !0;
              }
              return !1;
            } else if (l.policy === "AllOn") {
              for (const c of l.ids) {
                if (!this.#e.has(c))
                  return (0, e.warn)(`Optional content group not found: ${c}`), !0;
                if (!this.#e.get(c).visible)
                  return !1;
              }
              return !0;
            } else if (l.policy === "AnyOff") {
              for (const c of l.ids) {
                if (!this.#e.has(c))
                  return (0, e.warn)(`Optional content group not found: ${c}`), !0;
                if (!this.#e.get(c).visible)
                  return !0;
              }
              return !1;
            } else if (l.policy === "AllOff") {
              for (const c of l.ids) {
                if (!this.#e.has(c))
                  return (0, e.warn)(`Optional content group not found: ${c}`), !0;
                if (this.#e.get(c).visible)
                  return !1;
              }
              return !0;
            }
            return (0, e.warn)(`Unknown optional content policy ${l.policy}.`), !0;
          }
          return (0, e.warn)(`Unknown group type ${l.type}.`), !0;
        }
        setVisibility(l, c = !0) {
          const s = this.#e.get(l);
          if (!s) {
            (0, e.warn)(`Optional content group not found: ${l}`);
            return;
          }
          s._setVisible(f, !!c, !0), this.#t = null;
        }
        setOCGState({
          state: l,
          preserveRB: c
        }) {
          let s;
          for (const p of l) {
            switch (p) {
              case "ON":
              case "OFF":
              case "Toggle":
                s = p;
                continue;
            }
            const b = this.#e.get(p);
            if (b)
              switch (s) {
                case "ON":
                  b._setVisible(f, !0);
                  break;
                case "OFF":
                  b._setVisible(f, !1);
                  break;
                case "Toggle":
                  b._setVisible(f, !b.visible);
                  break;
              }
          }
          this.#t = null;
        }
        get hasInitialVisibility() {
          return this.#i === null || this.getHash() === this.#i;
        }
        getOrder() {
          return this.#e.size ? this.#s ? this.#s.slice() : [...this.#e.keys()] : null;
        }
        getGroups() {
          return this.#e.size > 0 ? (0, e.objectFromMap)(this.#e) : null;
        }
        getGroup(l) {
          return this.#e.get(l) || null;
        }
        getHash() {
          if (this.#t !== null)
            return this.#t;
          const l = new u.MurmurHash3_64();
          for (const [c, s] of this.#e)
            l.update(`${c}:${s.visible}`);
          return this.#t = l.hexdigest();
        }
      }
    }
  ),
  /***/
  814: (
    /***/
    (d, t, n) => {
      n.d(t, {
        /* harmony export */
        cleanupTextLayer: () => (
          /* binding */
          s
        ),
        /* harmony export */
        renderTextLayer: () => (
          /* binding */
          i
        ),
        /* harmony export */
        updateTextLayer: () => (
          /* binding */
          r
        )
        /* harmony export */
      });
      var e = n(292), u = n(419);
      const f = 1e5, k = 30, m = 0.8, o = /* @__PURE__ */ new Map();
      let l = null;
      function c() {
        if (!l) {
          const v = document.createElement("canvas");
          v.className = "hiddenCanvasElement", document.body.append(v), l = v.getContext("2d", {
            alpha: !1
          });
        }
        return l;
      }
      function s() {
        l?.canvas.remove(), l = null;
      }
      function p(v) {
        const y = o.get(v);
        if (y)
          return y;
        const R = c(), F = R.font;
        R.canvas.width = R.canvas.height = k, R.font = `${k}px ${v}`;
        const I = R.measureText("");
        let H = I.fontBoundingBoxAscent, B = Math.abs(I.fontBoundingBoxDescent);
        if (H) {
          const X = H / (H + B);
          return o.set(v, X), R.canvas.width = R.canvas.height = 0, R.font = F, X;
        }
        R.strokeStyle = "red", R.clearRect(0, 0, k, k), R.strokeText("g", 0, 0);
        let U = R.getImageData(0, 0, k, k).data;
        B = 0;
        for (let X = U.length - 1 - 3; X >= 0; X -= 4)
          if (U[X] > 0) {
            B = Math.ceil(X / 4 / k);
            break;
          }
        R.clearRect(0, 0, k, k), R.strokeText("A", 0, k), U = R.getImageData(0, 0, k, k).data, H = 0;
        for (let X = 0, Z = U.length; X < Z; X += 4)
          if (U[X] > 0) {
            H = k - Math.floor(X / 4 / k);
            break;
          }
        if (R.canvas.width = R.canvas.height = 0, R.font = F, H) {
          const X = H / (H + B);
          return o.set(v, X), X;
        }
        return o.set(v, m), m;
      }
      function b(v, y, R) {
        const F = document.createElement("span"), I = {
          angle: 0,
          canvasWidth: 0,
          hasText: y.str !== "",
          hasEOL: y.hasEOL,
          fontSize: 0
        };
        v._textDivs.push(F);
        const H = e.Util.transform(v._transform, y.transform);
        let B = Math.atan2(H[1], H[0]);
        const U = R[y.fontName];
        U.vertical && (B += Math.PI / 2);
        const X = v._fontInspectorEnabled && U.fontSubstitution || U.fontFamily, Z = Math.hypot(H[2], H[3]), lt = Z * p(X);
        let Y, V;
        B === 0 ? (Y = H[4], V = H[5] - lt) : (Y = H[4] + lt * Math.sin(B), V = H[5] - lt * Math.cos(B));
        const j = "calc(var(--scale-factor)*", $ = F.style;
        v._container === v._rootContainer ? ($.left = `${(100 * Y / v._pageWidth).toFixed(2)}%`, $.top = `${(100 * V / v._pageHeight).toFixed(2)}%`) : ($.left = `${j}${Y.toFixed(2)}px)`, $.top = `${j}${V.toFixed(2)}px)`), $.fontSize = `${j}${Z.toFixed(2)}px)`, $.fontFamily = X, I.fontSize = Z, F.setAttribute("role", "presentation"), F.textContent = y.str, F.dir = y.dir, v._fontInspectorEnabled && (F.dataset.fontName = U.fontSubstitutionLoadedName || y.fontName), B !== 0 && (I.angle = B * (180 / Math.PI));
        let st = !1;
        if (y.str.length > 1)
          st = !0;
        else if (y.str !== " " && y.transform[0] !== y.transform[3]) {
          const J = Math.abs(y.transform[0]), ht = Math.abs(y.transform[3]);
          J !== ht && Math.max(J, ht) / Math.min(J, ht) > 1.5 && (st = !0);
        }
        st && (I.canvasWidth = U.vertical ? y.height : y.width), v._textDivProperties.set(F, I), v._isReadableStream && v._layoutText(F);
      }
      function S(v) {
        const {
          div: y,
          scale: R,
          properties: F,
          ctx: I,
          prevFontSize: H,
          prevFontFamily: B
        } = v, {
          style: U
        } = y;
        let X = "";
        if (F.canvasWidth !== 0 && F.hasText) {
          const {
            fontFamily: Z
          } = U, {
            canvasWidth: lt,
            fontSize: Y
          } = F;
          (H !== Y || B !== Z) && (I.font = `${Y * R}px ${Z}`, v.prevFontSize = Y, v.prevFontFamily = Z);
          const {
            width: V
          } = I.measureText(y.textContent);
          V > 0 && (X = `scaleX(${lt * R / V})`);
        }
        F.angle !== 0 && (X = `rotate(${F.angle}deg) ${X}`), X.length > 0 && (U.transform = X);
      }
      function a(v) {
        if (v._canceled)
          return;
        const y = v._textDivs, R = v._capability;
        if (y.length > f) {
          R.resolve();
          return;
        }
        if (!v._isReadableStream)
          for (const I of y)
            v._layoutText(I);
        R.resolve();
      }
      class E {
        constructor({
          textContentSource: y,
          container: R,
          viewport: F,
          textDivs: I,
          textDivProperties: H,
          textContentItemsStr: B
        }) {
          this._textContentSource = y, this._isReadableStream = y instanceof ReadableStream, this._container = this._rootContainer = R, this._textDivs = I || [], this._textContentItemsStr = B || [], this._fontInspectorEnabled = !!globalThis.FontInspector?.enabled, this._reader = null, this._textDivProperties = H || /* @__PURE__ */ new WeakMap(), this._canceled = !1, this._capability = Promise.withResolvers(), this._layoutTextParams = {
            prevFontSize: null,
            prevFontFamily: null,
            div: null,
            scale: F.scale * (globalThis.devicePixelRatio || 1),
            properties: null,
            ctx: c()
          };
          const {
            pageWidth: U,
            pageHeight: X,
            pageX: Z,
            pageY: lt
          } = F.rawDims;
          this._transform = [1, 0, 0, -1, -Z, lt + X], this._pageWidth = U, this._pageHeight = X, (0, u.setLayerDimensions)(R, F), this._capability.promise.finally(() => {
            this._layoutTextParams = null;
          }).catch(() => {
          });
        }
        get promise() {
          return this._capability.promise;
        }
        cancel() {
          this._canceled = !0, this._reader && (this._reader.cancel(new e.AbortException("TextLayer task cancelled.")).catch(() => {
          }), this._reader = null), this._capability.reject(new e.AbortException("TextLayer task cancelled."));
        }
        _processItems(y, R) {
          for (const F of y) {
            if (F.str === void 0) {
              if (F.type === "beginMarkedContentProps" || F.type === "beginMarkedContent") {
                const I = this._container;
                this._container = document.createElement("span"), this._container.classList.add("markedContent"), F.id !== null && this._container.setAttribute("id", `${F.id}`), I.append(this._container);
              } else
                F.type === "endMarkedContent" && (this._container = this._container.parentNode);
              continue;
            }
            this._textContentItemsStr.push(F.str), b(this, F, R);
          }
        }
        _layoutText(y) {
          const R = this._layoutTextParams.properties = this._textDivProperties.get(y);
          if (this._layoutTextParams.div = y, S(this._layoutTextParams), R.hasText && this._container.append(y), R.hasEOL) {
            const F = document.createElement("br");
            F.setAttribute("role", "presentation"), this._container.append(F);
          }
        }
        _render() {
          const {
            promise: y,
            resolve: R,
            reject: F
          } = Promise.withResolvers();
          let I = /* @__PURE__ */ Object.create(null);
          if (this._isReadableStream) {
            const H = () => {
              this._reader.read().then(({
                value: B,
                done: U
              }) => {
                if (U) {
                  R();
                  return;
                }
                Object.assign(I, B.styles), this._processItems(B.items, I), H();
              }, F);
            };
            this._reader = this._textContentSource.getReader(), H();
          } else if (this._textContentSource) {
            const {
              items: H,
              styles: B
            } = this._textContentSource;
            this._processItems(H, B), R();
          } else
            throw new Error('No "textContentSource" parameter specified.');
          y.then(() => {
            I = null, a(this);
          }, this._capability.reject);
        }
      }
      function i(v) {
        const y = new E(v);
        return y._render(), y;
      }
      function r({
        container: v,
        viewport: y,
        textDivs: R,
        textDivProperties: F,
        mustRotate: I = !0,
        mustRescale: H = !0
      }) {
        if (I && (0, u.setLayerDimensions)(v, {
          rotation: y.rotation
        }), H) {
          const B = c(), X = {
            prevFontSize: null,
            prevFontFamily: null,
            div: null,
            scale: y.scale * (globalThis.devicePixelRatio || 1),
            properties: null,
            ctx: B
          };
          for (const Z of R)
            X.properties = F.get(Z), X.div = Z, S(X);
        }
      }
    }
  ),
  /***/
  585: (
    /***/
    (d, t, n) => {
      n.d(t, {
        /* harmony export */
        PDFDataTransportStream: () => (
          /* binding */
          f
        )
        /* harmony export */
      });
      var e = n(292), u = n(419);
      class f {
        constructor(l, {
          disableRange: c = !1,
          disableStream: s = !1
        }) {
          (0, e.assert)(l, 'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');
          const {
            length: p,
            initialData: b,
            progressiveDone: S,
            contentDispositionFilename: a
          } = l;
          if (this._queuedChunks = [], this._progressiveDone = S, this._contentDispositionFilename = a, b?.length > 0) {
            const E = b instanceof Uint8Array && b.byteLength === b.buffer.byteLength ? b.buffer : new Uint8Array(b).buffer;
            this._queuedChunks.push(E);
          }
          this._pdfDataRangeTransport = l, this._isStreamingSupported = !s, this._isRangeSupported = !c, this._contentLength = p, this._fullRequestReader = null, this._rangeReaders = [], l.addRangeListener((E, i) => {
            this._onReceiveData({
              begin: E,
              chunk: i
            });
          }), l.addProgressListener((E, i) => {
            this._onProgress({
              loaded: E,
              total: i
            });
          }), l.addProgressiveReadListener((E) => {
            this._onReceiveData({
              chunk: E
            });
          }), l.addProgressiveDoneListener(() => {
            this._onProgressiveDone();
          }), l.transportReady();
        }
        _onReceiveData({
          begin: l,
          chunk: c
        }) {
          const s = c instanceof Uint8Array && c.byteLength === c.buffer.byteLength ? c.buffer : new Uint8Array(c).buffer;
          if (l === void 0)
            this._fullRequestReader ? this._fullRequestReader._enqueue(s) : this._queuedChunks.push(s);
          else {
            const p = this._rangeReaders.some(function(b) {
              return b._begin !== l ? !1 : (b._enqueue(s), !0);
            });
            (0, e.assert)(p, "_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.");
          }
        }
        get _progressiveDataLength() {
          return this._fullRequestReader?._loaded ?? 0;
        }
        _onProgress(l) {
          l.total === void 0 ? this._rangeReaders[0]?.onProgress?.({
            loaded: l.loaded
          }) : this._fullRequestReader?.onProgress?.({
            loaded: l.loaded,
            total: l.total
          });
        }
        _onProgressiveDone() {
          this._fullRequestReader?.progressiveDone(), this._progressiveDone = !0;
        }
        _removeRangeReader(l) {
          const c = this._rangeReaders.indexOf(l);
          c >= 0 && this._rangeReaders.splice(c, 1);
        }
        getFullReader() {
          (0, e.assert)(!this._fullRequestReader, "PDFDataTransportStream.getFullReader can only be called once.");
          const l = this._queuedChunks;
          return this._queuedChunks = null, new k(this, l, this._progressiveDone, this._contentDispositionFilename);
        }
        getRangeReader(l, c) {
          if (c <= this._progressiveDataLength)
            return null;
          const s = new m(this, l, c);
          return this._pdfDataRangeTransport.requestDataRange(l, c), this._rangeReaders.push(s), s;
        }
        cancelAllRequests(l) {
          this._fullRequestReader?.cancel(l);
          for (const c of this._rangeReaders.slice(0))
            c.cancel(l);
          this._pdfDataRangeTransport.abort();
        }
      }
      class k {
        constructor(l, c, s = !1, p = null) {
          this._stream = l, this._done = s || !1, this._filename = (0, u.isPdfFile)(p) ? p : null, this._queuedChunks = c || [], this._loaded = 0;
          for (const b of this._queuedChunks)
            this._loaded += b.byteLength;
          this._requests = [], this._headersReady = Promise.resolve(), l._fullRequestReader = this, this.onProgress = null;
        }
        _enqueue(l) {
          this._done || (this._requests.length > 0 ? this._requests.shift().resolve({
            value: l,
            done: !1
          }) : this._queuedChunks.push(l), this._loaded += l.byteLength);
        }
        get headersReady() {
          return this._headersReady;
        }
        get filename() {
          return this._filename;
        }
        get isRangeSupported() {
          return this._stream._isRangeSupported;
        }
        get isStreamingSupported() {
          return this._stream._isStreamingSupported;
        }
        get contentLength() {
          return this._stream._contentLength;
        }
        async read() {
          if (this._queuedChunks.length > 0)
            return {
              value: this._queuedChunks.shift(),
              done: !1
            };
          if (this._done)
            return {
              value: void 0,
              done: !0
            };
          const l = Promise.withResolvers();
          return this._requests.push(l), l.promise;
        }
        cancel(l) {
          this._done = !0;
          for (const c of this._requests)
            c.resolve({
              value: void 0,
              done: !0
            });
          this._requests.length = 0;
        }
        progressiveDone() {
          this._done || (this._done = !0);
        }
      }
      class m {
        constructor(l, c, s) {
          this._stream = l, this._begin = c, this._end = s, this._queuedChunk = null, this._requests = [], this._done = !1, this.onProgress = null;
        }
        _enqueue(l) {
          if (!this._done) {
            if (this._requests.length === 0)
              this._queuedChunk = l;
            else {
              this._requests.shift().resolve({
                value: l,
                done: !1
              });
              for (const s of this._requests)
                s.resolve({
                  value: void 0,
                  done: !0
                });
              this._requests.length = 0;
            }
            this._done = !0, this._stream._removeRangeReader(this);
          }
        }
        get isStreamingSupported() {
          return !1;
        }
        async read() {
          if (this._queuedChunk) {
            const c = this._queuedChunk;
            return this._queuedChunk = null, {
              value: c,
              done: !1
            };
          }
          if (this._done)
            return {
              value: void 0,
              done: !0
            };
          const l = Promise.withResolvers();
          return this._requests.push(l), l.promise;
        }
        cancel(l) {
          this._done = !0;
          for (const c of this._requests)
            c.resolve({
              value: void 0,
              done: !0
            });
          this._requests.length = 0, this._stream._removeRangeReader(this);
        }
      }
    }
  ),
  /***/
  164: (
    /***/
    (d, t, n) => {
      n.d(t, {
        /* harmony export */
        GlobalWorkerOptions: () => (
          /* binding */
          e
        )
        /* harmony export */
      });
      class e {
        static #t = null;
        static #e = "";
        static get workerPort() {
          return this.#t;
        }
        static set workerPort(f) {
          if (!(typeof Worker < "u" && f instanceof Worker) && f !== null)
            throw new Error("Invalid `workerPort` type.");
          this.#t = f;
        }
        static get workerSrc() {
          return this.#e;
        }
        static set workerSrc(f) {
          if (typeof f != "string")
            throw new Error("Invalid `workerSrc` type.");
          this.#e = f;
        }
      }
    }
  ),
  /***/
  284: (
    /***/
    (d, t, n) => {
      n.d(t, {
        /* harmony export */
        XfaLayer: () => (
          /* binding */
          u
        )
        /* harmony export */
      });
      var e = n(50);
      class u {
        static setupStorage(k, m, o, l, c) {
          const s = l.getValue(m, {
            value: null
          });
          switch (o.name) {
            case "textarea":
              if (s.value !== null && (k.textContent = s.value), c === "print")
                break;
              k.addEventListener("input", (p) => {
                l.setValue(m, {
                  value: p.target.value
                });
              });
              break;
            case "input":
              if (o.attributes.type === "radio" || o.attributes.type === "checkbox") {
                if (s.value === o.attributes.xfaOn ? k.setAttribute("checked", !0) : s.value === o.attributes.xfaOff && k.removeAttribute("checked"), c === "print")
                  break;
                k.addEventListener("change", (p) => {
                  l.setValue(m, {
                    value: p.target.checked ? p.target.getAttribute("xfaOn") : p.target.getAttribute("xfaOff")
                  });
                });
              } else {
                if (s.value !== null && k.setAttribute("value", s.value), c === "print")
                  break;
                k.addEventListener("input", (p) => {
                  l.setValue(m, {
                    value: p.target.value
                  });
                });
              }
              break;
            case "select":
              if (s.value !== null) {
                k.setAttribute("value", s.value);
                for (const p of o.children)
                  p.attributes.value === s.value ? p.attributes.selected = !0 : p.attributes.hasOwnProperty("selected") && delete p.attributes.selected;
              }
              k.addEventListener("input", (p) => {
                const b = p.target.options, S = b.selectedIndex === -1 ? "" : b[b.selectedIndex].value;
                l.setValue(m, {
                  value: S
                });
              });
              break;
          }
        }
        static setAttributes({
          html: k,
          element: m,
          storage: o = null,
          intent: l,
          linkService: c
        }) {
          const {
            attributes: s
          } = m, p = k instanceof HTMLAnchorElement;
          s.type === "radio" && (s.name = `${s.name}-${l}`);
          for (const [b, S] of Object.entries(s))
            if (S != null)
              switch (b) {
                case "class":
                  S.length && k.setAttribute(b, S.join(" "));
                  break;
                case "dataId":
                  break;
                case "id":
                  k.setAttribute("data-element-id", S);
                  break;
                case "style":
                  Object.assign(k.style, S);
                  break;
                case "textContent":
                  k.textContent = S;
                  break;
                default:
                  (!p || b !== "href" && b !== "newWindow") && k.setAttribute(b, S);
              }
          p && c.addLinkAttributes(k, s.href, s.newWindow), o && s.dataId && this.setupStorage(k, s.dataId, m, o);
        }
        static render(k) {
          const m = k.annotationStorage, o = k.linkService, l = k.xfaHtml, c = k.intent || "display", s = document.createElement(l.name);
          l.attributes && this.setAttributes({
            html: s,
            element: l,
            intent: c,
            linkService: o
          });
          const p = c !== "richText", b = k.div;
          if (b.append(s), k.viewport) {
            const E = `matrix(${k.viewport.transform.join(",")})`;
            b.style.transform = E;
          }
          p && b.setAttribute("class", "xfaLayer xfaFont");
          const S = [];
          if (l.children.length === 0) {
            if (l.value) {
              const E = document.createTextNode(l.value);
              s.append(E), p && e.XfaText.shouldBuildText(l.name) && S.push(E);
            }
            return {
              textDivs: S
            };
          }
          const a = [[l, -1, s]];
          for (; a.length > 0; ) {
            const [E, i, r] = a.at(-1);
            if (i + 1 === E.children.length) {
              a.pop();
              continue;
            }
            const v = E.children[++a.at(-1)[1]];
            if (v === null)
              continue;
            const {
              name: y
            } = v;
            if (y === "#text") {
              const F = document.createTextNode(v.value);
              S.push(F), r.append(F);
              continue;
            }
            const R = v?.attributes?.xmlns ? document.createElementNS(v.attributes.xmlns, y) : document.createElement(y);
            if (r.append(R), v.attributes && this.setAttributes({
              html: R,
              element: v,
              storage: m,
              intent: c,
              linkService: o
            }), v.children?.length > 0)
              a.push([v, -1, R]);
            else if (v.value) {
              const F = document.createTextNode(v.value);
              p && e.XfaText.shouldBuildText(y) && S.push(F), R.append(F);
            }
          }
          for (const E of b.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))
            E.setAttribute("readOnly", !0);
          return {
            textDivs: S
          };
        }
        static update(k) {
          const m = `matrix(${k.viewport.transform.join(",")})`;
          k.div.style.transform = m, k.div.hidden = !1;
        }
      }
    }
  ),
  /***/
  50: (
    /***/
    (d, t, n) => {
      n.d(t, {
        /* harmony export */
        XfaText: () => (
          /* binding */
          e
        )
        /* harmony export */
      });
      class e {
        static textContent(f) {
          const k = [], m = {
            items: k,
            styles: /* @__PURE__ */ Object.create(null)
          };
          function o(l) {
            if (!l)
              return;
            let c = null;
            const s = l.name;
            if (s === "#text")
              c = l.value;
            else if (e.shouldBuildText(s))
              l?.attributes?.textContent ? c = l.attributes.textContent : l.value && (c = l.value);
            else
              return;
            if (c !== null && k.push({
              str: c
            }), !!l.children)
              for (const p of l.children)
                o(p);
          }
          return o(f), m;
        }
        static shouldBuildText(f) {
          return !(f === "textarea" || f === "input" || f === "option" || f === "select");
        }
      }
    }
  ),
  /***/
  228: (
    /***/
    (d, t, n) => {
      n.a(d, async (e, u) => {
        try {
          n.d(t, {
            /* harmony export */
            AbortException: () => (
              /* reexport safe */
              f.AbortException
            ),
            /* harmony export */
            AnnotationEditorLayer: () => (
              /* reexport safe */
              l.AnnotationEditorLayer
            ),
            /* harmony export */
            AnnotationEditorParamsType: () => (
              /* reexport safe */
              f.AnnotationEditorParamsType
            ),
            /* harmony export */
            AnnotationEditorType: () => (
              /* reexport safe */
              f.AnnotationEditorType
            ),
            /* harmony export */
            AnnotationEditorUIManager: () => (
              /* reexport safe */
              c.AnnotationEditorUIManager
            ),
            /* harmony export */
            AnnotationLayer: () => (
              /* reexport safe */
              s.AnnotationLayer
            ),
            /* harmony export */
            AnnotationMode: () => (
              /* reexport safe */
              f.AnnotationMode
            ),
            /* harmony export */
            CMapCompressionType: () => (
              /* reexport safe */
              f.CMapCompressionType
            ),
            /* harmony export */
            ColorPicker: () => (
              /* reexport safe */
              p.ColorPicker
            ),
            /* harmony export */
            DOMSVGFactory: () => (
              /* reexport safe */
              m.DOMSVGFactory
            ),
            /* harmony export */
            DrawLayer: () => (
              /* reexport safe */
              b.DrawLayer
            ),
            /* harmony export */
            FeatureTest: () => (
              /* reexport safe */
              f.FeatureTest
            ),
            /* harmony export */
            GlobalWorkerOptions: () => (
              /* reexport safe */
              S.GlobalWorkerOptions
            ),
            /* harmony export */
            ImageKind: () => (
              /* reexport safe */
              f.ImageKind
            ),
            /* harmony export */
            InvalidPDFException: () => (
              /* reexport safe */
              f.InvalidPDFException
            ),
            /* harmony export */
            MissingPDFException: () => (
              /* reexport safe */
              f.MissingPDFException
            ),
            /* harmony export */
            OPS: () => (
              /* reexport safe */
              f.OPS
            ),
            /* harmony export */
            Outliner: () => (
              /* reexport safe */
              a.Outliner
            ),
            /* harmony export */
            PDFDataRangeTransport: () => (
              /* reexport safe */
              k.PDFDataRangeTransport
            ),
            /* harmony export */
            PDFDateString: () => (
              /* reexport safe */
              m.PDFDateString
            ),
            /* harmony export */
            PDFWorker: () => (
              /* reexport safe */
              k.PDFWorker
            ),
            /* harmony export */
            PasswordResponses: () => (
              /* reexport safe */
              f.PasswordResponses
            ),
            /* harmony export */
            PermissionFlag: () => (
              /* reexport safe */
              f.PermissionFlag
            ),
            /* harmony export */
            PixelsPerInch: () => (
              /* reexport safe */
              m.PixelsPerInch
            ),
            /* harmony export */
            RenderingCancelledException: () => (
              /* reexport safe */
              m.RenderingCancelledException
            ),
            /* harmony export */
            UnexpectedResponseException: () => (
              /* reexport safe */
              f.UnexpectedResponseException
            ),
            /* harmony export */
            Util: () => (
              /* reexport safe */
              f.Util
            ),
            /* harmony export */
            VerbosityLevel: () => (
              /* reexport safe */
              f.VerbosityLevel
            ),
            /* harmony export */
            XfaLayer: () => (
              /* reexport safe */
              E.XfaLayer
            ),
            /* harmony export */
            build: () => (
              /* reexport safe */
              k.build
            ),
            /* harmony export */
            createValidAbsoluteUrl: () => (
              /* reexport safe */
              f.createValidAbsoluteUrl
            ),
            /* harmony export */
            fetchData: () => (
              /* reexport safe */
              m.fetchData
            ),
            /* harmony export */
            getDocument: () => (
              /* reexport safe */
              k.getDocument
            ),
            /* harmony export */
            getFilenameFromUrl: () => (
              /* reexport safe */
              m.getFilenameFromUrl
            ),
            /* harmony export */
            getPdfFilenameFromUrl: () => (
              /* reexport safe */
              m.getPdfFilenameFromUrl
            ),
            /* harmony export */
            getXfaPageViewport: () => (
              /* reexport safe */
              m.getXfaPageViewport
            ),
            /* harmony export */
            isDataScheme: () => (
              /* reexport safe */
              m.isDataScheme
            ),
            /* harmony export */
            isPdfFile: () => (
              /* reexport safe */
              m.isPdfFile
            ),
            /* harmony export */
            noContextMenu: () => (
              /* reexport safe */
              m.noContextMenu
            ),
            /* harmony export */
            normalizeUnicode: () => (
              /* reexport safe */
              f.normalizeUnicode
            ),
            /* harmony export */
            renderTextLayer: () => (
              /* reexport safe */
              o.renderTextLayer
            ),
            /* harmony export */
            setLayerDimensions: () => (
              /* reexport safe */
              m.setLayerDimensions
            ),
            /* harmony export */
            shadow: () => (
              /* reexport safe */
              f.shadow
            ),
            /* harmony export */
            updateTextLayer: () => (
              /* reexport safe */
              o.updateTextLayer
            ),
            /* harmony export */
            version: () => (
              /* reexport safe */
              k.version
            )
            /* harmony export */
          });
          var f = n(292), k = n(831), m = n(419), o = n(814), l = n(731), c = n(830), s = n(976), p = n(259), b = n(47), S = n(164), a = n(61), E = n(284), i = e([k]);
          k = (i.then ? (await i)() : i)[0];
          const r = "4.2.67", v = "49b388101";
          u();
        } catch (r) {
          u(r);
        }
      });
    }
  ),
  /***/
  178: (
    /***/
    (d, t, n) => {
      n.d(t, {
        /* harmony export */
        MessageHandler: () => (
          /* binding */
          m
        )
        /* harmony export */
      });
      var e = n(292);
      const u = {
        UNKNOWN: 0,
        DATA: 1,
        ERROR: 2
      }, f = {
        UNKNOWN: 0,
        CANCEL: 1,
        CANCEL_COMPLETE: 2,
        CLOSE: 3,
        ENQUEUE: 4,
        ERROR: 5,
        PULL: 6,
        PULL_COMPLETE: 7,
        START_COMPLETE: 8
      };
      function k(o) {
        switch (o instanceof Error || typeof o == "object" && o !== null || (0, e.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'), o.name) {
          case "AbortException":
            return new e.AbortException(o.message);
          case "MissingPDFException":
            return new e.MissingPDFException(o.message);
          case "PasswordException":
            return new e.PasswordException(o.message, o.code);
          case "UnexpectedResponseException":
            return new e.UnexpectedResponseException(o.message, o.status);
          case "UnknownErrorException":
            return new e.UnknownErrorException(o.message, o.details);
          default:
            return new e.UnknownErrorException(o.message, o.toString());
        }
      }
      class m {
        constructor(l, c, s) {
          this.sourceName = l, this.targetName = c, this.comObj = s, this.callbackId = 1, this.streamId = 1, this.streamSinks = /* @__PURE__ */ Object.create(null), this.streamControllers = /* @__PURE__ */ Object.create(null), this.callbackCapabilities = /* @__PURE__ */ Object.create(null), this.actionHandler = /* @__PURE__ */ Object.create(null), this._onComObjOnMessage = (p) => {
            const b = p.data;
            if (b.targetName !== this.sourceName)
              return;
            if (b.stream) {
              this.#e(b);
              return;
            }
            if (b.callback) {
              const a = b.callbackId, E = this.callbackCapabilities[a];
              if (!E)
                throw new Error(`Cannot resolve callback ${a}`);
              if (delete this.callbackCapabilities[a], b.callback === u.DATA)
                E.resolve(b.data);
              else if (b.callback === u.ERROR)
                E.reject(k(b.reason));
              else
                throw new Error("Unexpected callback case");
              return;
            }
            const S = this.actionHandler[b.action];
            if (!S)
              throw new Error(`Unknown action from worker: ${b.action}`);
            if (b.callbackId) {
              const a = this.sourceName, E = b.sourceName;
              new Promise(function(i) {
                i(S(b.data));
              }).then(function(i) {
                s.postMessage({
                  sourceName: a,
                  targetName: E,
                  callback: u.DATA,
                  callbackId: b.callbackId,
                  data: i
                });
              }, function(i) {
                s.postMessage({
                  sourceName: a,
                  targetName: E,
                  callback: u.ERROR,
                  callbackId: b.callbackId,
                  reason: k(i)
                });
              });
              return;
            }
            if (b.streamId) {
              this.#t(b);
              return;
            }
            S(b.data);
          }, s.addEventListener("message", this._onComObjOnMessage);
        }
        on(l, c) {
          const s = this.actionHandler;
          if (s[l])
            throw new Error(`There is already an actionName called "${l}"`);
          s[l] = c;
        }
        send(l, c, s) {
          this.comObj.postMessage({
            sourceName: this.sourceName,
            targetName: this.targetName,
            action: l,
            data: c
          }, s);
        }
        sendWithPromise(l, c, s) {
          const p = this.callbackId++, b = Promise.withResolvers();
          this.callbackCapabilities[p] = b;
          try {
            this.comObj.postMessage({
              sourceName: this.sourceName,
              targetName: this.targetName,
              action: l,
              callbackId: p,
              data: c
            }, s);
          } catch (S) {
            b.reject(S);
          }
          return b.promise;
        }
        sendWithStream(l, c, s, p) {
          const b = this.streamId++, S = this.sourceName, a = this.targetName, E = this.comObj;
          return new ReadableStream({
            start: (i) => {
              const r = Promise.withResolvers();
              return this.streamControllers[b] = {
                controller: i,
                startCall: r,
                pullCall: null,
                cancelCall: null,
                isClosed: !1
              }, E.postMessage({
                sourceName: S,
                targetName: a,
                action: l,
                streamId: b,
                data: c,
                desiredSize: i.desiredSize
              }, p), r.promise;
            },
            pull: (i) => {
              const r = Promise.withResolvers();
              return this.streamControllers[b].pullCall = r, E.postMessage({
                sourceName: S,
                targetName: a,
                stream: f.PULL,
                streamId: b,
                desiredSize: i.desiredSize
              }), r.promise;
            },
            cancel: (i) => {
              (0, e.assert)(i instanceof Error, "cancel must have a valid reason");
              const r = Promise.withResolvers();
              return this.streamControllers[b].cancelCall = r, this.streamControllers[b].isClosed = !0, E.postMessage({
                sourceName: S,
                targetName: a,
                stream: f.CANCEL,
                streamId: b,
                reason: k(i)
              }), r.promise;
            }
          }, s);
        }
        #t(l) {
          const c = l.streamId, s = this.sourceName, p = l.sourceName, b = this.comObj, S = this, a = this.actionHandler[l.action], E = {
            enqueue(i, r = 1, v) {
              if (this.isCancelled)
                return;
              const y = this.desiredSize;
              this.desiredSize -= r, y > 0 && this.desiredSize <= 0 && (this.sinkCapability = Promise.withResolvers(), this.ready = this.sinkCapability.promise), b.postMessage({
                sourceName: s,
                targetName: p,
                stream: f.ENQUEUE,
                streamId: c,
                chunk: i
              }, v);
            },
            close() {
              this.isCancelled || (this.isCancelled = !0, b.postMessage({
                sourceName: s,
                targetName: p,
                stream: f.CLOSE,
                streamId: c
              }), delete S.streamSinks[c]);
            },
            error(i) {
              (0, e.assert)(i instanceof Error, "error must have a valid reason"), !this.isCancelled && (this.isCancelled = !0, b.postMessage({
                sourceName: s,
                targetName: p,
                stream: f.ERROR,
                streamId: c,
                reason: k(i)
              }));
            },
            sinkCapability: Promise.withResolvers(),
            onPull: null,
            onCancel: null,
            isCancelled: !1,
            desiredSize: l.desiredSize,
            ready: null
          };
          E.sinkCapability.resolve(), E.ready = E.sinkCapability.promise, this.streamSinks[c] = E, new Promise(function(i) {
            i(a(l.data, E));
          }).then(function() {
            b.postMessage({
              sourceName: s,
              targetName: p,
              stream: f.START_COMPLETE,
              streamId: c,
              success: !0
            });
          }, function(i) {
            b.postMessage({
              sourceName: s,
              targetName: p,
              stream: f.START_COMPLETE,
              streamId: c,
              reason: k(i)
            });
          });
        }
        #e(l) {
          const c = l.streamId, s = this.sourceName, p = l.sourceName, b = this.comObj, S = this.streamControllers[c], a = this.streamSinks[c];
          switch (l.stream) {
            case f.START_COMPLETE:
              l.success ? S.startCall.resolve() : S.startCall.reject(k(l.reason));
              break;
            case f.PULL_COMPLETE:
              l.success ? S.pullCall.resolve() : S.pullCall.reject(k(l.reason));
              break;
            case f.PULL:
              if (!a) {
                b.postMessage({
                  sourceName: s,
                  targetName: p,
                  stream: f.PULL_COMPLETE,
                  streamId: c,
                  success: !0
                });
                break;
              }
              a.desiredSize <= 0 && l.desiredSize > 0 && a.sinkCapability.resolve(), a.desiredSize = l.desiredSize, new Promise(function(E) {
                E(a.onPull?.());
              }).then(function() {
                b.postMessage({
                  sourceName: s,
                  targetName: p,
                  stream: f.PULL_COMPLETE,
                  streamId: c,
                  success: !0
                });
              }, function(E) {
                b.postMessage({
                  sourceName: s,
                  targetName: p,
                  stream: f.PULL_COMPLETE,
                  streamId: c,
                  reason: k(E)
                });
              });
              break;
            case f.ENQUEUE:
              if ((0, e.assert)(S, "enqueue should have stream controller"), S.isClosed)
                break;
              S.controller.enqueue(l.chunk);
              break;
            case f.CLOSE:
              if ((0, e.assert)(S, "close should have stream controller"), S.isClosed)
                break;
              S.isClosed = !0, S.controller.close(), this.#i(S, c);
              break;
            case f.ERROR:
              (0, e.assert)(S, "error should have stream controller"), S.controller.error(k(l.reason)), this.#i(S, c);
              break;
            case f.CANCEL_COMPLETE:
              l.success ? S.cancelCall.resolve() : S.cancelCall.reject(k(l.reason)), this.#i(S, c);
              break;
            case f.CANCEL:
              if (!a)
                break;
              new Promise(function(E) {
                E(a.onCancel?.(k(l.reason)));
              }).then(function() {
                b.postMessage({
                  sourceName: s,
                  targetName: p,
                  stream: f.CANCEL_COMPLETE,
                  streamId: c,
                  success: !0
                });
              }, function(E) {
                b.postMessage({
                  sourceName: s,
                  targetName: p,
                  stream: f.CANCEL_COMPLETE,
                  streamId: c,
                  reason: k(E)
                });
              }), a.sinkCapability.reject(k(l.reason)), a.isCancelled = !0, delete this.streamSinks[c];
              break;
            default:
              throw new Error("Unexpected stream case");
          }
        }
        async #i(l, c) {
          await Promise.allSettled([l.startCall?.promise, l.pullCall?.promise, l.cancelCall?.promise]), delete this.streamControllers[c];
        }
        destroy() {
          this.comObj.removeEventListener("message", this._onComObjOnMessage);
        }
      }
    }
  ),
  /***/
  651: (
    /***/
    (d, t, n) => {
      n.d(t, {
        /* harmony export */
        MurmurHash3_64: () => (
          /* binding */
          k
        )
        /* harmony export */
      });
      const e = 3285377520, u = 4294901760, f = 65535;
      class k {
        constructor(o) {
          this.h1 = o ? o & 4294967295 : e, this.h2 = o ? o & 4294967295 : e;
        }
        update(o) {
          let l, c;
          if (typeof o == "string") {
            l = new Uint8Array(o.length * 2), c = 0;
            for (let F = 0, I = o.length; F < I; F++) {
              const H = o.charCodeAt(F);
              H <= 255 ? l[c++] = H : (l[c++] = H >>> 8, l[c++] = H & 255);
            }
          } else if (ArrayBuffer.isView(o))
            l = o.slice(), c = l.byteLength;
          else
            throw new Error("Invalid data format, must be a string or TypedArray.");
          const s = c >> 2, p = c - s * 4, b = new Uint32Array(l.buffer, 0, s);
          let S = 0, a = 0, E = this.h1, i = this.h2;
          const r = 3432918353, v = 461845907, y = r & f, R = v & f;
          for (let F = 0; F < s; F++)
            F & 1 ? (S = b[F], S = S * r & u | S * y & f, S = S << 15 | S >>> 17, S = S * v & u | S * R & f, E ^= S, E = E << 13 | E >>> 19, E = E * 5 + 3864292196) : (a = b[F], a = a * r & u | a * y & f, a = a << 15 | a >>> 17, a = a * v & u | a * R & f, i ^= a, i = i << 13 | i >>> 19, i = i * 5 + 3864292196);
          switch (S = 0, p) {
            case 3:
              S ^= l[s * 4 + 2] << 16;
            case 2:
              S ^= l[s * 4 + 1] << 8;
            case 1:
              S ^= l[s * 4], S = S * r & u | S * y & f, S = S << 15 | S >>> 17, S = S * v & u | S * R & f, s & 1 ? E ^= S : i ^= S;
          }
          this.h1 = E, this.h2 = i;
        }
        hexdigest() {
          let o = this.h1, l = this.h2;
          return o ^= l >>> 1, o = o * 3981806797 & u | o * 36045 & f, l = l * 4283543511 & u | ((l << 16 | o >>> 16) * 2950163797 & u) >>> 16, o ^= l >>> 1, o = o * 444984403 & u | o * 60499 & f, l = l * 3301882366 & u | ((l << 16 | o >>> 16) * 3120437893 & u) >>> 16, o ^= l >>> 1, (o >>> 0).toString(16).padStart(8, "0") + (l >>> 0).toString(16).padStart(8, "0");
        }
      }
    }
  ),
  /***/
  292: (
    /***/
    (d, t, n) => {
      n.d(t, {
        /* harmony export */
        AbortException: () => (
          /* binding */
          dt
        ),
        /* harmony export */
        AnnotationBorderStyleType: () => (
          /* binding */
          i
        ),
        /* harmony export */
        AnnotationEditorParamsType: () => (
          /* binding */
          p
        ),
        /* harmony export */
        AnnotationEditorPrefix: () => (
          /* binding */
          c
        ),
        /* harmony export */
        AnnotationEditorType: () => (
          /* binding */
          s
        ),
        /* harmony export */
        AnnotationMode: () => (
          /* binding */
          l
        ),
        /* harmony export */
        AnnotationPrefix: () => (
          /* binding */
          D
        ),
        /* harmony export */
        AnnotationType: () => (
          /* binding */
          E
        ),
        /* harmony export */
        BaseException: () => (
          /* binding */
          j
        ),
        /* harmony export */
        CMapCompressionType: () => (
          /* binding */
          v
        ),
        /* harmony export */
        FONT_IDENTITY_MATRIX: () => (
          /* binding */
          f
        ),
        /* harmony export */
        FeatureTest: () => (
          /* binding */
          g
        ),
        /* harmony export */
        FontRenderOps: () => (
          /* binding */
          G
        ),
        /* harmony export */
        FormatError: () => (
          /* binding */
          pt
        ),
        /* harmony export */
        IDENTITY_MATRIX: () => (
          /* binding */
          u
        ),
        /* harmony export */
        ImageKind: () => (
          /* binding */
          a
        ),
        /* harmony export */
        InvalidPDFException: () => (
          /* binding */
          J
        ),
        /* harmony export */
        LINE_FACTOR: () => (
          /* binding */
          m
        ),
        /* harmony export */
        MAX_IMAGE_SIZE_TO_CACHE: () => (
          /* binding */
          k
        ),
        /* harmony export */
        MissingPDFException: () => (
          /* binding */
          ht
        ),
        /* harmony export */
        OPS: () => (
          /* binding */
          y
        ),
        /* harmony export */
        PasswordException: () => (
          /* binding */
          $
        ),
        /* harmony export */
        PasswordResponses: () => (
          /* binding */
          R
        ),
        /* harmony export */
        PermissionFlag: () => (
          /* binding */
          b
        ),
        /* harmony export */
        RenderingIntentFlag: () => (
          /* binding */
          o
        ),
        /* harmony export */
        TextRenderingMode: () => (
          /* binding */
          S
        ),
        /* harmony export */
        UnexpectedResponseException: () => (
          /* binding */
          rt
        ),
        /* harmony export */
        UnknownErrorException: () => (
          /* binding */
          st
        ),
        /* harmony export */
        Util: () => (
          /* binding */
          _
        ),
        /* harmony export */
        VerbosityLevel: () => (
          /* binding */
          r
        ),
        /* harmony export */
        assert: () => (
          /* binding */
          Z
        ),
        /* harmony export */
        bytesToString: () => (
          /* binding */
          ut
        ),
        /* harmony export */
        createValidAbsoluteUrl: () => (
          /* binding */
          Y
        ),
        /* harmony export */
        getUuid: () => (
          /* binding */
          N
        ),
        /* harmony export */
        getVerbosityLevel: () => (
          /* binding */
          H
        ),
        /* harmony export */
        info: () => (
          /* binding */
          B
        ),
        /* harmony export */
        isNodeJS: () => (
          /* binding */
          e
        ),
        /* harmony export */
        normalizeUnicode: () => (
          /* binding */
          M
        ),
        /* harmony export */
        objectFromMap: () => (
          /* binding */
          x
        ),
        /* harmony export */
        setVerbosityLevel: () => (
          /* binding */
          I
        ),
        /* harmony export */
        shadow: () => (
          /* binding */
          V
        ),
        /* harmony export */
        string32: () => (
          /* binding */
          it
        ),
        /* harmony export */
        stringToBytes: () => (
          /* binding */
          Q
        ),
        /* harmony export */
        unreachable: () => (
          /* binding */
          X
        ),
        /* harmony export */
        warn: () => (
          /* binding */
          U
        )
        /* harmony export */
      });
      const e = typeof process == "object" && process + "" == "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser"), u = [1, 0, 0, 1, 0, 0], f = [1e-3, 0, 0, 1e-3, 0, 0], k = 1e7, m = 1.35, o = {
        ANY: 1,
        DISPLAY: 2,
        PRINT: 4,
        SAVE: 8,
        ANNOTATIONS_FORMS: 16,
        ANNOTATIONS_STORAGE: 32,
        ANNOTATIONS_DISABLE: 64,
        OPLIST: 256
      }, l = {
        DISABLE: 0,
        ENABLE: 1,
        ENABLE_FORMS: 2,
        ENABLE_STORAGE: 3
      }, c = "pdfjs_internal_editor_", s = {
        DISABLE: -1,
        NONE: 0,
        FREETEXT: 3,
        HIGHLIGHT: 9,
        STAMP: 13,
        INK: 15
      }, p = {
        RESIZE: 1,
        CREATE: 2,
        FREETEXT_SIZE: 11,
        FREETEXT_COLOR: 12,
        FREETEXT_OPACITY: 13,
        INK_COLOR: 21,
        INK_THICKNESS: 22,
        INK_OPACITY: 23,
        HIGHLIGHT_COLOR: 31,
        HIGHLIGHT_DEFAULT_COLOR: 32,
        HIGHLIGHT_THICKNESS: 33,
        HIGHLIGHT_FREE: 34,
        HIGHLIGHT_SHOW_ALL: 35
      }, b = {
        PRINT: 4,
        MODIFY_CONTENTS: 8,
        COPY: 16,
        MODIFY_ANNOTATIONS: 32,
        FILL_INTERACTIVE_FORMS: 256,
        COPY_FOR_ACCESSIBILITY: 512,
        ASSEMBLE: 1024,
        PRINT_HIGH_QUALITY: 2048
      }, S = {
        FILL: 0,
        STROKE: 1,
        FILL_STROKE: 2,
        INVISIBLE: 3,
        FILL_ADD_TO_PATH: 4,
        STROKE_ADD_TO_PATH: 5,
        FILL_STROKE_ADD_TO_PATH: 6,
        ADD_TO_PATH: 7,
        FILL_STROKE_MASK: 3,
        ADD_TO_PATH_FLAG: 4
      }, a = {
        GRAYSCALE_1BPP: 1,
        RGB_24BPP: 2,
        RGBA_32BPP: 3
      }, E = {
        TEXT: 1,
        LINK: 2,
        FREETEXT: 3,
        LINE: 4,
        SQUARE: 5,
        CIRCLE: 6,
        POLYGON: 7,
        POLYLINE: 8,
        HIGHLIGHT: 9,
        UNDERLINE: 10,
        SQUIGGLY: 11,
        STRIKEOUT: 12,
        STAMP: 13,
        CARET: 14,
        INK: 15,
        POPUP: 16,
        FILEATTACHMENT: 17,
        SOUND: 18,
        MOVIE: 19,
        WIDGET: 20,
        SCREEN: 21,
        PRINTERMARK: 22,
        TRAPNET: 23,
        WATERMARK: 24,
        THREED: 25,
        REDACT: 26
      }, i = {
        SOLID: 1,
        DASHED: 2,
        BEVELED: 3,
        INSET: 4,
        UNDERLINE: 5
      }, r = {
        ERRORS: 0,
        WARNINGS: 1,
        INFOS: 5
      }, v = {
        NONE: 0,
        BINARY: 1
      }, y = {
        dependency: 1,
        setLineWidth: 2,
        setLineCap: 3,
        setLineJoin: 4,
        setMiterLimit: 5,
        setDash: 6,
        setRenderingIntent: 7,
        setFlatness: 8,
        setGState: 9,
        save: 10,
        restore: 11,
        transform: 12,
        moveTo: 13,
        lineTo: 14,
        curveTo: 15,
        curveTo2: 16,
        curveTo3: 17,
        closePath: 18,
        rectangle: 19,
        stroke: 20,
        closeStroke: 21,
        fill: 22,
        eoFill: 23,
        fillStroke: 24,
        eoFillStroke: 25,
        closeFillStroke: 26,
        closeEOFillStroke: 27,
        endPath: 28,
        clip: 29,
        eoClip: 30,
        beginText: 31,
        endText: 32,
        setCharSpacing: 33,
        setWordSpacing: 34,
        setHScale: 35,
        setLeading: 36,
        setFont: 37,
        setTextRenderingMode: 38,
        setTextRise: 39,
        moveText: 40,
        setLeadingMoveText: 41,
        setTextMatrix: 42,
        nextLine: 43,
        showText: 44,
        showSpacedText: 45,
        nextLineShowText: 46,
        nextLineSetSpacingShowText: 47,
        setCharWidth: 48,
        setCharWidthAndBounds: 49,
        setStrokeColorSpace: 50,
        setFillColorSpace: 51,
        setStrokeColor: 52,
        setStrokeColorN: 53,
        setFillColor: 54,
        setFillColorN: 55,
        setStrokeGray: 56,
        setFillGray: 57,
        setStrokeRGBColor: 58,
        setFillRGBColor: 59,
        setStrokeCMYKColor: 60,
        setFillCMYKColor: 61,
        shadingFill: 62,
        beginInlineImage: 63,
        beginImageData: 64,
        endInlineImage: 65,
        paintXObject: 66,
        markPoint: 67,
        markPointProps: 68,
        beginMarkedContent: 69,
        beginMarkedContentProps: 70,
        endMarkedContent: 71,
        beginCompat: 72,
        endCompat: 73,
        paintFormXObjectBegin: 74,
        paintFormXObjectEnd: 75,
        beginGroup: 76,
        endGroup: 77,
        beginAnnotation: 80,
        endAnnotation: 81,
        paintImageMaskXObject: 83,
        paintImageMaskXObjectGroup: 84,
        paintImageXObject: 85,
        paintInlineImageXObject: 86,
        paintInlineImageXObjectGroup: 87,
        paintImageXObjectRepeat: 88,
        paintImageMaskXObjectRepeat: 89,
        paintSolidColorImageMask: 90,
        constructPath: 91
      }, R = {
        NEED_PASSWORD: 1,
        INCORRECT_PASSWORD: 2
      };
      let F = r.WARNINGS;
      function I(z) {
        Number.isInteger(z) && (F = z);
      }
      function H() {
        return F;
      }
      function B(z) {
        F >= r.INFOS && console.log(`Info: ${z}`);
      }
      function U(z) {
        F >= r.WARNINGS && console.log(`Warning: ${z}`);
      }
      function X(z) {
        throw new Error(z);
      }
      function Z(z, O) {
        z || X(O);
      }
      function lt(z) {
        switch (z?.protocol) {
          case "http:":
          case "https:":
          case "ftp:":
          case "mailto:":
          case "tel:":
            return !0;
          default:
            return !1;
        }
      }
      function Y(z, O = null, P = null) {
        if (!z)
          return null;
        try {
          if (P && typeof z == "string" && (P.addDefaultProtocol && z.startsWith("www.") && z.match(/\./g)?.length >= 2 && (z = `http://${z}`), P.tryConvertEncoding))
            try {
              z = A(z);
            } catch {
            }
          const q = O ? new URL(z, O) : new URL(z);
          if (lt(q))
            return q;
        } catch {
        }
        return null;
      }
      function V(z, O, P, q = !1) {
        return Object.defineProperty(z, O, {
          value: P,
          enumerable: !q,
          configurable: !0,
          writable: !1
        }), P;
      }
      const j = function() {
        function O(P, q) {
          this.constructor === O && X("Cannot initialize BaseException."), this.message = P, this.name = q;
        }
        return O.prototype = new Error(), O.constructor = O, O;
      }();
      class $ extends j {
        constructor(O, P) {
          super(O, "PasswordException"), this.code = P;
        }
      }
      class st extends j {
        constructor(O, P) {
          super(O, "UnknownErrorException"), this.details = P;
        }
      }
      class J extends j {
        constructor(O) {
          super(O, "InvalidPDFException");
        }
      }
      class ht extends j {
        constructor(O) {
          super(O, "MissingPDFException");
        }
      }
      class rt extends j {
        constructor(O, P) {
          super(O, "UnexpectedResponseException"), this.status = P;
        }
      }
      class pt extends j {
        constructor(O) {
          super(O, "FormatError");
        }
      }
      class dt extends j {
        constructor(O) {
          super(O, "AbortException");
        }
      }
      function ut(z) {
        (typeof z != "object" || z?.length === void 0) && X("Invalid argument for bytesToString");
        const O = z.length, P = 8192;
        if (O < P)
          return String.fromCharCode.apply(null, z);
        const q = [];
        for (let et = 0; et < O; et += P) {
          const K = Math.min(et + P, O), tt = z.subarray(et, K);
          q.push(String.fromCharCode.apply(null, tt));
        }
        return q.join("");
      }
      function Q(z) {
        typeof z != "string" && X("Invalid argument for stringToBytes");
        const O = z.length, P = new Uint8Array(O);
        for (let q = 0; q < O; ++q)
          P[q] = z.charCodeAt(q) & 255;
        return P;
      }
      function it(z) {
        return String.fromCharCode(z >> 24 & 255, z >> 16 & 255, z >> 8 & 255, z & 255);
      }
      function x(z) {
        const O = /* @__PURE__ */ Object.create(null);
        for (const [P, q] of z)
          O[P] = q;
        return O;
      }
      function C() {
        const z = new Uint8Array(4);
        return z[0] = 1, new Uint32Array(z.buffer, 0, 1)[0] === 1;
      }
      function h() {
        try {
          return new Function(""), !0;
        } catch {
          return !1;
        }
      }
      class g {
        static get isLittleEndian() {
          return V(this, "isLittleEndian", C());
        }
        static get isEvalSupported() {
          return V(this, "isEvalSupported", h());
        }
        static get isOffscreenCanvasSupported() {
          return V(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas < "u");
        }
        static get platform() {
          return typeof navigator < "u" && typeof navigator?.platform == "string" ? V(this, "platform", {
            isMac: navigator.platform.includes("Mac")
          }) : V(this, "platform", {
            isMac: !1
          });
        }
        static get isCSSRoundSupported() {
          return V(this, "isCSSRoundSupported", globalThis.CSS?.supports?.("width: round(1.5px, 1px)"));
        }
      }
      const w = Array.from(Array(256).keys(), (z) => z.toString(16).padStart(2, "0"));
      class _ {
        static makeHexColor(O, P, q) {
          return `#${w[O]}${w[P]}${w[q]}`;
        }
        static scaleMinMax(O, P) {
          let q;
          O[0] ? (O[0] < 0 && (q = P[0], P[0] = P[2], P[2] = q), P[0] *= O[0], P[2] *= O[0], O[3] < 0 && (q = P[1], P[1] = P[3], P[3] = q), P[1] *= O[3], P[3] *= O[3]) : (q = P[0], P[0] = P[1], P[1] = q, q = P[2], P[2] = P[3], P[3] = q, O[1] < 0 && (q = P[1], P[1] = P[3], P[3] = q), P[1] *= O[1], P[3] *= O[1], O[2] < 0 && (q = P[0], P[0] = P[2], P[2] = q), P[0] *= O[2], P[2] *= O[2]), P[0] += O[4], P[1] += O[5], P[2] += O[4], P[3] += O[5];
        }
        static transform(O, P) {
          return [O[0] * P[0] + O[2] * P[1], O[1] * P[0] + O[3] * P[1], O[0] * P[2] + O[2] * P[3], O[1] * P[2] + O[3] * P[3], O[0] * P[4] + O[2] * P[5] + O[4], O[1] * P[4] + O[3] * P[5] + O[5]];
        }
        static applyTransform(O, P) {
          const q = O[0] * P[0] + O[1] * P[2] + P[4], et = O[0] * P[1] + O[1] * P[3] + P[5];
          return [q, et];
        }
        static applyInverseTransform(O, P) {
          const q = P[0] * P[3] - P[1] * P[2], et = (O[0] * P[3] - O[1] * P[2] + P[2] * P[5] - P[4] * P[3]) / q, K = (-O[0] * P[1] + O[1] * P[0] + P[4] * P[1] - P[5] * P[0]) / q;
          return [et, K];
        }
        static getAxialAlignedBoundingBox(O, P) {
          const q = this.applyTransform(O, P), et = this.applyTransform(O.slice(2, 4), P), K = this.applyTransform([O[0], O[3]], P), tt = this.applyTransform([O[2], O[1]], P);
          return [Math.min(q[0], et[0], K[0], tt[0]), Math.min(q[1], et[1], K[1], tt[1]), Math.max(q[0], et[0], K[0], tt[0]), Math.max(q[1], et[1], K[1], tt[1])];
        }
        static inverseTransform(O) {
          const P = O[0] * O[3] - O[1] * O[2];
          return [O[3] / P, -O[1] / P, -O[2] / P, O[0] / P, (O[2] * O[5] - O[4] * O[3]) / P, (O[4] * O[1] - O[5] * O[0]) / P];
        }
        static singularValueDecompose2dScale(O) {
          const P = [O[0], O[2], O[1], O[3]], q = O[0] * P[0] + O[1] * P[2], et = O[0] * P[1] + O[1] * P[3], K = O[2] * P[0] + O[3] * P[2], tt = O[2] * P[1] + O[3] * P[3], ft = (q + tt) / 2, at = Math.sqrt((q + tt) ** 2 - 4 * (q * tt - K * et)) / 2, nt = ft + at || 1, ct = ft - at || 1;
          return [Math.sqrt(nt), Math.sqrt(ct)];
        }
        static normalizeRect(O) {
          const P = O.slice(0);
          return O[0] > O[2] && (P[0] = O[2], P[2] = O[0]), O[1] > O[3] && (P[1] = O[3], P[3] = O[1]), P;
        }
        static intersect(O, P) {
          const q = Math.max(Math.min(O[0], O[2]), Math.min(P[0], P[2])), et = Math.min(Math.max(O[0], O[2]), Math.max(P[0], P[2]));
          if (q > et)
            return null;
          const K = Math.max(Math.min(O[1], O[3]), Math.min(P[1], P[3])), tt = Math.min(Math.max(O[1], O[3]), Math.max(P[1], P[3]));
          return K > tt ? null : [q, K, et, tt];
        }
        static #t(O, P, q, et, K, tt, ft, at, nt, ct) {
          if (nt <= 0 || nt >= 1)
            return;
          const mt = 1 - nt, wt = nt * nt, Et = wt * nt, Tt = mt * (mt * (mt * O + 3 * nt * P) + 3 * wt * q) + Et * et, _t = mt * (mt * (mt * K + 3 * nt * tt) + 3 * wt * ft) + Et * at;
          ct[0] = Math.min(ct[0], Tt), ct[1] = Math.min(ct[1], _t), ct[2] = Math.max(ct[2], Tt), ct[3] = Math.max(ct[3], _t);
        }
        static #e(O, P, q, et, K, tt, ft, at, nt, ct, mt, wt) {
          if (Math.abs(nt) < 1e-12) {
            Math.abs(ct) >= 1e-12 && this.#t(O, P, q, et, K, tt, ft, at, -mt / ct, wt);
            return;
          }
          const Et = ct ** 2 - 4 * mt * nt;
          if (Et < 0)
            return;
          const Tt = Math.sqrt(Et), _t = 2 * nt;
          this.#t(O, P, q, et, K, tt, ft, at, (-ct + Tt) / _t, wt), this.#t(O, P, q, et, K, tt, ft, at, (-ct - Tt) / _t, wt);
        }
        static bezierBoundingBox(O, P, q, et, K, tt, ft, at, nt) {
          return nt ? (nt[0] = Math.min(nt[0], O, ft), nt[1] = Math.min(nt[1], P, at), nt[2] = Math.max(nt[2], O, ft), nt[3] = Math.max(nt[3], P, at)) : nt = [Math.min(O, ft), Math.min(P, at), Math.max(O, ft), Math.max(P, at)], this.#e(O, q, K, ft, P, et, tt, at, 3 * (-O + 3 * (q - K) + ft), 6 * (O - 2 * q + K), 3 * (q - O), nt), this.#e(O, q, K, ft, P, et, tt, at, 3 * (-P + 3 * (et - tt) + at), 6 * (P - 2 * et + tt), 3 * (et - P), nt), nt;
        }
      }
      function A(z) {
        return decodeURIComponent(escape(z));
      }
      let T = null, L = null;
      function M(z) {
        return T || (T = /([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu, L = /* @__PURE__ */ new Map([["ﬅ", "ſt"]])), z.replaceAll(T, (O, P, q) => P ? P.normalize("NFKC") : L.get(q));
      }
      function N() {
        if (typeof crypto < "u" && typeof crypto?.randomUUID == "function")
          return crypto.randomUUID();
        const z = new Uint8Array(32);
        if (typeof crypto < "u" && typeof crypto?.getRandomValues == "function")
          crypto.getRandomValues(z);
        else
          for (let O = 0; O < 32; O++)
            z[O] = Math.floor(Math.random() * 255);
        return ut(z);
      }
      const D = "pdfjs_internal_id_", G = {
        BEZIER_CURVE_TO: 0,
        MOVE_TO: 1,
        LINE_TO: 2,
        QUADRATIC_CURVE_TO: 3,
        RESTORE: 4,
        SAVE: 5,
        SCALE: 6,
        TRANSFORM: 7,
        TRANSLATE: 8
      };
    }
  )
  /******/
}, ir = {};
function ai(d) {
  var t = ir[d];
  if (t !== void 0)
    return t.exports;
  var n = ir[d] = {
    /******/
    // no module.id needed
    /******/
    // no module.loaded needed
    /******/
    exports: {}
    /******/
  };
  return Qh[d](n, n.exports, ai), n.exports;
}
(() => {
  var d = typeof Symbol == "function" ? Symbol("webpack queues") : "__webpack_queues__", t = typeof Symbol == "function" ? Symbol("webpack exports") : "__webpack_exports__", n = typeof Symbol == "function" ? Symbol("webpack error") : "__webpack_error__", e = (f) => {
    f && f.d < 1 && (f.d = 1, f.forEach((k) => k.r--), f.forEach((k) => k.r-- ? k.r++ : k()));
  }, u = (f) => f.map((k) => {
    if (k !== null && typeof k == "object") {
      if (k[d])
        return k;
      if (k.then) {
        var m = [];
        m.d = 0, k.then((c) => {
          o[t] = c, e(m);
        }, (c) => {
          o[n] = c, e(m);
        });
        var o = {};
        return o[d] = (c) => c(m), o;
      }
    }
    var l = {};
    return l[d] = (c) => {
    }, l[t] = k, l;
  });
  ai.a = (f, k, m) => {
    var o;
    m && ((o = []).d = -1);
    var l = /* @__PURE__ */ new Set(), c = f.exports, s, p, b, S = new Promise((a, E) => {
      b = E, p = a;
    });
    S[t] = c, S[d] = (a) => (o && a(o), l.forEach(a), S.catch((E) => {
    })), f.exports = S, k((a) => {
      s = u(a);
      var E, i = () => s.map((v) => {
        if (v[n])
          throw v[n];
        return v[t];
      }), r = new Promise((v) => {
        E = () => v(i), E.r = 0;
        var y = (R) => R !== o && !l.has(R) && (l.add(R), R && !R.d && (E.r++, R.push(E)));
        s.map((R) => R[d](y));
      });
      return E.r ? r : i();
    }, (a) => (a ? b(S[n] = a) : p(c), e(o))), o && o.d < 0 && (o.d = 0);
  };
})();
ai.d = (d, t) => {
  for (var n in t)
    ai.o(t, n) && !ai.o(d, n) && Object.defineProperty(d, n, { enumerable: !0, get: t[n] });
};
ai.o = (d, t) => Object.prototype.hasOwnProperty.call(d, t);
var At = ai(228);
At = globalThis.pdfjsLib = await (globalThis.pdfjsLibPromise = At);
At.AbortException;
At.AnnotationEditorLayer;
At.AnnotationEditorParamsType;
At.AnnotationEditorType;
At.AnnotationEditorUIManager;
At.AnnotationLayer;
At.AnnotationMode;
At.CMapCompressionType;
At.ColorPicker;
At.DOMSVGFactory;
At.DrawLayer;
At.FeatureTest;
var Zh = At.GlobalWorkerOptions;
At.ImageKind;
At.InvalidPDFException;
At.MissingPDFException;
At.OPS;
At.Outliner;
At.PDFDataRangeTransport;
At.PDFDateString;
At.PDFWorker;
At.PasswordResponses;
At.PermissionFlag;
At.PixelsPerInch;
At.RenderingCancelledException;
At.UnexpectedResponseException;
At.Util;
At.VerbosityLevel;
At.XfaLayer;
At.build;
At.createValidAbsoluteUrl;
At.fetchData;
var $h = At.getDocument;
At.getFilenameFromUrl;
At.getPdfFilenameFromUrl;
At.getXfaPageViewport;
At.isDataScheme;
At.isPdfFile;
At.noContextMenu;
At.normalizeUnicode;
At.renderTextLayer;
At.setLayerDimensions;
At.shadow;
At.updateTextLayer;
At.version;
const {
  SvelteComponent: td,
  append: Ce,
  assign: ed,
  attr: Ue,
  binding_callbacks: id,
  check_outros: nr,
  create_component: We,
  destroy_component: qe,
  detach: Ne,
  element: ei,
  empty: nd,
  get_spread_object: sd,
  get_spread_update: rd,
  group_outros: sr,
  init: ad,
  insert: De,
  listen: rr,
  mount_component: Ye,
  run_all: od,
  safe_not_equal: ld,
  set_data: cd,
  set_input_value: ar,
  set_style: or,
  space: Ve,
  text: Yn,
  to_number: ea,
  transition_in: ee,
  transition_out: le
} = window.__gradio__svelte__internal, { tick: lr } = window.__gradio__svelte__internal;
function cr(d) {
  let t, n;
  const e = [
    {
      autoscroll: (
        /*gradio*/
        d[10].autoscroll
      )
    },
    { i18n: (
      /*gradio*/
      d[10].i18n
    ) },
    /*loading_status*/
    d[1]
  ];
  let u = {};
  for (let f = 0; f < e.length; f += 1)
    u = ed(u, e[f]);
  return t = new Rl({ props: u }), t.$on(
    "clear_status",
    /*clear_status_handler*/
    d[24]
  ), {
    c() {
      We(t.$$.fragment);
    },
    m(f, k) {
      Ye(t, f, k), n = !0;
    },
    p(f, k) {
      const m = k[0] & /*gradio, loading_status*/
      1026 ? rd(e, [
        k[0] & /*gradio*/
        1024 && {
          autoscroll: (
            /*gradio*/
            f[10].autoscroll
          )
        },
        k[0] & /*gradio*/
        1024 && { i18n: (
          /*gradio*/
          f[10].i18n
        ) },
        k[0] & /*loading_status*/
        2 && sd(
          /*loading_status*/
          f[1]
        )
      ]) : {};
      t.$set(m);
    },
    i(f) {
      n || (ee(t.$$.fragment, f), n = !0);
    },
    o(f) {
      le(t.$$.fragment, f), n = !1;
    },
    d(f) {
      qe(t, f);
    }
  };
}
function hd(d) {
  let t, n;
  return t = new kc({
    props: {
      filetype: ".pdf",
      file_count: "single",
      root: (
        /*root*/
        d[7]
      ),
      max_file_size: (
        /*gradio*/
        d[10].max_file_size
      ),
      upload: (
        /*gradio*/
        d[10].client.upload
      ),
      stream_handler: (
        /*gradio*/
        d[10].client.stream
      ),
      $$slots: { default: [ud] },
      $$scope: { ctx: d }
    }
  }), t.$on(
    "load",
    /*handle_upload*/
    d[16]
  ), t.$on(
    "error",
    /*error_handler*/
    d[27]
  ), {
    c() {
      We(t.$$.fragment);
    },
    m(e, u) {
      Ye(t, e, u), n = !0;
    },
    p(e, u) {
      const f = {};
      u[0] & /*root*/
      128 && (f.root = /*root*/
      e[7]), u[0] & /*gradio*/
      1024 && (f.max_file_size = /*gradio*/
      e[10].max_file_size), u[0] & /*gradio*/
      1024 && (f.upload = /*gradio*/
      e[10].client.upload), u[0] & /*gradio*/
      1024 && (f.stream_handler = /*gradio*/
      e[10].client.stream), u[1] & /*$$scope*/
      4 && (f.$$scope = { dirty: u, ctx: e }), t.$set(f);
    },
    i(e) {
      n || (ee(t.$$.fragment, e), n = !0);
    },
    o(e) {
      le(t.$$.fragment, e), n = !1;
    },
    d(e) {
      qe(t, e);
    }
  };
}
function dd(d) {
  let t, n, e, u, f, k, m, o, l, c, s, p, b, S, a, E, i, r, v, y;
  return t = new Jh({
    props: {
      i18n: (
        /*gradio*/
        d[10].i18n
      ),
      absolute: !0
    }
  }), t.$on(
    "clear",
    /*handle_clear*/
    d[15]
  ), m = new cs({
    props: {
      $$slots: { default: [fd] },
      $$scope: { ctx: d }
    }
  }), m.$on(
    "click",
    /*prev_page*/
    d[18]
  ), i = new cs({
    props: {
      $$slots: { default: [pd] },
      $$scope: { ctx: d }
    }
  }), i.$on(
    "click",
    /*next_page*/
    d[17]
  ), {
    c() {
      We(t.$$.fragment), n = Ve(), e = ei("div"), u = ei("canvas"), f = Ve(), k = ei("div"), We(m.$$.fragment), o = Ve(), l = ei("div"), c = ei("input"), s = Ve(), p = ei("span"), p.textContent = "/", b = Ve(), S = ei("span"), a = Yn(
        /*numPages*/
        d[12]
      ), E = Ve(), We(i.$$.fragment), Ue(e, "class", "pdf-canvas svelte-qxb5i6"), Ue(c, "type", "number"), Ue(c, "min", 1), Ue(
        c,
        "max",
        /*numPages*/
        d[12]
      ), Ue(c, "class", "svelte-qxb5i6"), or(p, "width", "var(--size-6)"), or(S, "width", "var(--size-6)"), Ue(l, "class", "page-count svelte-qxb5i6"), Ue(k, "class", "button-row svelte-qxb5i6");
    },
    m(R, F) {
      Ye(t, R, F), De(R, n, F), De(R, e, F), Ce(e, u), d[25](u), De(R, f, F), De(R, k, F), Ye(m, k, null), Ce(k, o), Ce(k, l), Ce(l, c), ar(
        c,
        /*currentPage*/
        d[14]
      ), Ce(l, s), Ce(l, p), Ce(l, b), Ce(l, S), Ce(S, a), Ce(k, E), Ye(i, k, null), r = !0, v || (y = [
        rr(
          c,
          "input",
          /*input_input_handler*/
          d[26]
        ),
        rr(
          c,
          "change",
          /*handle_page_change*/
          d[19]
        )
      ], v = !0);
    },
    p(R, F) {
      const I = {};
      F[0] & /*gradio*/
      1024 && (I.i18n = /*gradio*/
      R[10].i18n), t.$set(I);
      const H = {};
      F[1] & /*$$scope*/
      4 && (H.$$scope = { dirty: F, ctx: R }), m.$set(H), (!r || F[0] & /*numPages*/
      4096) && Ue(
        c,
        "max",
        /*numPages*/
        R[12]
      ), F[0] & /*currentPage*/
      16384 && ea(c.value) !== /*currentPage*/
      R[14] && ar(
        c,
        /*currentPage*/
        R[14]
      ), (!r || F[0] & /*numPages*/
      4096) && cd(
        a,
        /*numPages*/
        R[12]
      );
      const B = {};
      F[1] & /*$$scope*/
      4 && (B.$$scope = { dirty: F, ctx: R }), i.$set(B);
    },
    i(R) {
      r || (ee(t.$$.fragment, R), ee(m.$$.fragment, R), ee(i.$$.fragment, R), r = !0);
    },
    o(R) {
      le(t.$$.fragment, R), le(m.$$.fragment, R), le(i.$$.fragment, R), r = !1;
    },
    d(R) {
      R && (Ne(n), Ne(e), Ne(f), Ne(k)), qe(t, R), d[25](null), qe(m), qe(i), v = !1, od(y);
    }
  };
}
function ud(d) {
  let t, n;
  return t = new xa({}), {
    c() {
      We(t.$$.fragment);
    },
    m(e, u) {
      Ye(t, e, u), n = !0;
    },
    i(e) {
      n || (ee(t.$$.fragment, e), n = !0);
    },
    o(e) {
      le(t.$$.fragment, e), n = !1;
    },
    d(e) {
      qe(t, e);
    }
  };
}
function fd(d) {
  let t;
  return {
    c() {
      t = Yn("⬅️");
    },
    m(n, e) {
      De(n, t, e);
    },
    d(n) {
      n && Ne(t);
    }
  };
}
function pd(d) {
  let t;
  return {
    c() {
      t = Yn("➡️");
    },
    m(n, e) {
      De(n, t, e);
    },
    d(n) {
      n && Ne(t);
    }
  };
}
function gd(d) {
  let t, n, e, u, f, k, m, o = (
    /*loading_status*/
    d[1] && cr(d)
  );
  n = new oo({
    props: {
      show_label: (
        /*label*/
        d[8] !== null
      ),
      Icon: ca,
      float: (
        /*value*/
        d[0] === null
      ),
      label: (
        /*label*/
        d[8] || "File"
      )
    }
  });
  const l = [dd, hd], c = [];
  function s(p, b) {
    return (
      /*_value*/
      p[11] ? 0 : 1
    );
  }
  return u = s(d), f = c[u] = l[u](d), {
    c() {
      o && o.c(), t = Ve(), We(n.$$.fragment), e = Ve(), f.c(), k = nd();
    },
    m(p, b) {
      o && o.m(p, b), De(p, t, b), Ye(n, p, b), De(p, e, b), c[u].m(p, b), De(p, k, b), m = !0;
    },
    p(p, b) {
      /*loading_status*/
      p[1] ? o ? (o.p(p, b), b[0] & /*loading_status*/
      2 && ee(o, 1)) : (o = cr(p), o.c(), ee(o, 1), o.m(t.parentNode, t)) : o && (sr(), le(o, 1, 1, () => {
        o = null;
      }), nr());
      const S = {};
      b[0] & /*label*/
      256 && (S.show_label = /*label*/
      p[8] !== null), b[0] & /*value*/
      1 && (S.float = /*value*/
      p[0] === null), b[0] & /*label*/
      256 && (S.label = /*label*/
      p[8] || "File"), n.$set(S);
      let a = u;
      u = s(p), u === a ? c[u].p(p, b) : (sr(), le(c[a], 1, 1, () => {
        c[a] = null;
      }), nr(), f = c[u], f ? f.p(p, b) : (f = c[u] = l[u](p), f.c()), ee(f, 1), f.m(k.parentNode, k));
    },
    i(p) {
      m || (ee(o), ee(n.$$.fragment, p), ee(f), m = !0);
    },
    o(p) {
      le(o), le(n.$$.fragment, p), le(f), m = !1;
    },
    d(p) {
      p && (Ne(t), Ne(e), Ne(k)), o && o.d(p), qe(n, p), c[u].d(p);
    }
  };
}
function md(d) {
  let t, n;
  return t = new ja({
    props: {
      visible: (
        /*visible*/
        d[4]
      ),
      elem_id: (
        /*elem_id*/
        d[2]
      ),
      elem_classes: (
        /*elem_classes*/
        d[3]
      ),
      container: (
        /*container*/
        d[5]
      ),
      scale: (
        /*scale*/
        d[6]
      ),
      min_width: (
        /*min_width*/
        d[9]
      ),
      $$slots: { default: [gd] },
      $$scope: { ctx: d }
    }
  }), {
    c() {
      We(t.$$.fragment);
    },
    m(e, u) {
      Ye(t, e, u), n = !0;
    },
    p(e, u) {
      const f = {};
      u[0] & /*visible*/
      16 && (f.visible = /*visible*/
      e[4]), u[0] & /*elem_id*/
      4 && (f.elem_id = /*elem_id*/
      e[2]), u[0] & /*elem_classes*/
      8 && (f.elem_classes = /*elem_classes*/
      e[3]), u[0] & /*container*/
      32 && (f.container = /*container*/
      e[5]), u[0] & /*scale*/
      64 && (f.scale = /*scale*/
      e[6]), u[0] & /*min_width*/
      512 && (f.min_width = /*min_width*/
      e[9]), u[0] & /*numPages, currentPage, canvasRef, gradio, _value, root, loading_status, label, value*/
      32131 | u[1] & /*$$scope*/
      4 && (f.$$scope = { dirty: u, ctx: e }), t.$set(f);
    },
    i(e) {
      n || (ee(t.$$.fragment, e), n = !0);
    },
    o(e) {
      le(t.$$.fragment, e), n = !1;
    },
    d(e) {
      qe(t, e);
    }
  };
}
function bd(d, t, n) {
  return d;
}
function Ad(d, t, n) {
  let e;
  var u = this && this.__awaiter || function(J, ht, rt, pt) {
    function dt(ut) {
      return ut instanceof rt ? ut : new rt(function(Q) {
        Q(ut);
      });
    }
    return new (rt || (rt = Promise))(function(ut, Q) {
      function it(h) {
        try {
          C(pt.next(h));
        } catch (g) {
          Q(g);
        }
      }
      function x(h) {
        try {
          C(pt.throw(h));
        } catch (g) {
          Q(g);
        }
      }
      function C(h) {
        h.done ? ut(h.value) : dt(h.value).then(it, x);
      }
      C((pt = pt.apply(J, ht || [])).next());
    });
  };
  let { elem_id: f = "" } = t, { elem_classes: k = [] } = t, { visible: m = !0 } = t, { value: o = null } = t, { container: l = !0 } = t, { scale: c = null } = t, { root: s } = t, { height: p = null } = t, { starting_page: b } = t, { label: S } = t, { proxy_url: a } = t, { min_width: E = void 0 } = t, { loading_status: i } = t, { gradio: r } = t;
  Zh.workerSrc = "https://cdn.jsdelivr.net/gh/freddyaboulton/gradio-pdf@main/pdf.worker.min.mjs";
  let v, y, R, F = 1, I;
  function H() {
    return u(this, void 0, void 0, function* () {
      n(11, v = null), yield lr(), r.dispatch("change");
    });
  }
  function B(J) {
    return u(this, arguments, void 0, function* ({ detail: ht }) {
      n(0, o = ht), console.log("value", o), yield lr(), r.dispatch("change"), r.dispatch("upload");
    });
  }
  function U(J) {
    return u(this, void 0, void 0, function* () {
      R = yield $h(J.url).promise, n(12, F = R.numPages), n(14, e = Math.min(Math.max(b, 1), F)), X(e);
    });
  }
  function X(J) {
    R.getPage(J).then((ht) => {
      const rt = I.getContext("2d");
      rt.clearRect(0, 0, I.width, I.height);
      let pt = ht.getViewport({ scale: 1 });
      console.log("height", p), p && (pt = ht.getViewport({ scale: p / pt.height }));
      const dt = { canvasContext: rt, viewport: pt };
      n(13, I.width = pt.width, I), n(13, I.height = pt.height, I), ht.render(dt);
    });
  }
  function Z() {
    e >= F || (n(14, e++, e), X(e));
  }
  function lt() {
    e != 1 && (n(14, e--, e), X(e));
  }
  function Y() {
    e < 1 || e > F || X(e);
  }
  const V = () => r.dispatch("clear_status", i);
  function j(J) {
    id[J ? "unshift" : "push"](() => {
      I = J, n(13, I);
    });
  }
  function $() {
    e = ea(this.value), n(14, e), n(21, b), n(12, F);
  }
  const st = ({ detail: J }) => {
    n(1, i = i || {}), n(1, i.status = "error", i), r.dispatch("error", J);
  };
  return d.$$set = (J) => {
    "elem_id" in J && n(2, f = J.elem_id), "elem_classes" in J && n(3, k = J.elem_classes), "visible" in J && n(4, m = J.visible), "value" in J && n(0, o = J.value), "container" in J && n(5, l = J.container), "scale" in J && n(6, c = J.scale), "root" in J && n(7, s = J.root), "height" in J && n(20, p = J.height), "starting_page" in J && n(21, b = J.starting_page), "label" in J && n(8, S = J.label), "proxy_url" in J && n(22, a = J.proxy_url), "min_width" in J && n(9, E = J.min_width), "loading_status" in J && n(1, i = J.loading_status), "gradio" in J && n(10, r = J.gradio);
  }, d.$$.update = () => {
    d.$$.dirty[0] & /*starting_page, numPages*/
    2101248 && n(14, e = Math.min(Math.max(b, 1), F)), d.$$.dirty[0] & /*value, root, proxy_url*/
    4194433 && n(11, v = bd(o)), d.$$.dirty[0] & /*old_value, _value, gradio*/
    8391680 && JSON.stringify(y) != JSON.stringify(v) && (v && U(v), n(23, y = v), r.dispatch("change"));
  }, [
    o,
    i,
    f,
    k,
    m,
    l,
    c,
    s,
    S,
    E,
    r,
    v,
    F,
    I,
    e,
    H,
    B,
    Z,
    lt,
    Y,
    p,
    b,
    a,
    y,
    V,
    j,
    $,
    st
  ];
}
class Td extends td {
  constructor(t) {
    super(), ad(
      this,
      t,
      Ad,
      md,
      ld,
      {
        elem_id: 2,
        elem_classes: 3,
        visible: 4,
        value: 0,
        container: 5,
        scale: 6,
        root: 7,
        height: 20,
        starting_page: 21,
        label: 8,
        proxy_url: 22,
        min_width: 9,
        loading_status: 1,
        gradio: 10
      },
      null,
      [-1, -1]
    );
  }
}
export {
  Td as default
};
