var Oo = new Intl.Collator(0, { numeric: 1 }).compare;
function ws(t, e, n) {
  return t = t.split("."), e = e.split("."), Oo(t[0], e[0]) || Oo(t[1], e[1]) || (e[2] = e.slice(2).join("."), n = /[.-]/.test(t[2] = t.slice(2).join(".")), n == /[.-]/.test(e[2]) ? Oo(t[2], e[2]) : n ? -1 : 1);
}
function Ra(t, e, n) {
  return e.startsWith("http://") || e.startsWith("https://") ? n ? t : e : t + e;
}
function Ho(t) {
  if (t.startsWith("http")) {
    const { protocol: e, host: n } = new URL(t);
    return n.endsWith("hf.space") ? {
      ws_protocol: "wss",
      host: n,
      http_protocol: e
    } : {
      ws_protocol: e === "https:" ? "wss" : "ws",
      http_protocol: e,
      host: n
    };
  } else if (t.startsWith("file:"))
    return {
      ws_protocol: "ws",
      http_protocol: "http:",
      host: "lite.local"
      // Special fake hostname only used for this case. This matches the hostname allowed in `is_self_host()` in `js/wasm/network/host.ts`.
    };
  return {
    ws_protocol: "wss",
    http_protocol: "https:",
    host: t
  };
}
const Ba = /^[^\/]*\/[^\/]*$/, Cc = /.*hf\.space\/{0,1}$/;
async function Sc(t, e) {
  const n = {};
  e && (n.Authorization = `Bearer ${e}`);
  const i = t.trim();
  if (Ba.test(i))
    try {
      const o = await fetch(
        `https://huggingface.co/api/spaces/${i}/host`,
        { headers: n }
      );
      if (o.status !== 200)
        throw new Error("Space metadata could not be loaded.");
      const r = (await o.json()).host;
      return {
        space_id: t,
        ...Ho(r)
      };
    } catch (o) {
      throw new Error("Space metadata could not be loaded." + o.message);
    }
  if (Cc.test(i)) {
    const { ws_protocol: o, http_protocol: r, host: s } = Ho(i);
    return {
      space_id: s.replace(".hf.space", ""),
      ws_protocol: o,
      http_protocol: r,
      host: s
    };
  }
  return {
    space_id: !1,
    ...Ho(i)
  };
}
function Ac(t) {
  let e = {};
  return t.forEach(({ api_name: n }, i) => {
    n && (e[n] = i);
  }), e;
}
const Tc = /^(?=[^]*\b[dD]iscussions{0,1}\b)(?=[^]*\b[dD]isabled\b)[^]*$/;
async function ys(t) {
  try {
    const n = (await fetch(
      `https://huggingface.co/api/spaces/${t}/discussions`,
      {
        method: "HEAD"
      }
    )).headers.get("x-error-message");
    return !(n && Tc.test(n));
  } catch {
    return !1;
  }
}
function Lc(t, e, n, i) {
  if (e.length === 0) {
    if (n === "replace")
      return i;
    if (n === "append")
      return t + i;
    throw new Error(`Unsupported action: ${n}`);
  }
  let o = t;
  for (let s = 0; s < e.length - 1; s++)
    o = o[e[s]];
  const r = e[e.length - 1];
  switch (n) {
    case "replace":
      o[r] = i;
      break;
    case "append":
      o[r] += i;
      break;
    case "add":
      Array.isArray(o) ? o.splice(Number(r), 0, i) : o[r] = i;
      break;
    case "delete":
      Array.isArray(o) ? o.splice(Number(r), 1) : delete o[r];
      break;
    default:
      throw new Error(`Unknown action: ${n}`);
  }
  return t;
}
function Pc(t, e) {
  return e.forEach(([n, i, o]) => {
    t = Lc(t, i, n, o);
  }), t;
}
async function Ma(t, e, n, i = Bc) {
  let o = (Array.isArray(t) ? t : [t]).map(
    (r) => r.blob
  );
  return await Promise.all(
    await i(e, o, void 0, n).then(
      async (r) => {
        if (r.error)
          throw new Error(r.error);
        return r.files ? r.files.map((s, a) => new _o({
          ...t[a],
          path: s,
          url: e + "/file=" + s
        })) : [];
      }
    )
  );
}
async function Da(t, e) {
  return t.map(
    (n, i) => new _o({
      path: n.name,
      orig_name: n.name,
      blob: n,
      size: n.size,
      mime_type: n.type,
      is_stream: e
    })
  );
}
class _o {
  constructor({
    path: e,
    url: n,
    orig_name: i,
    size: o,
    blob: r,
    is_stream: s,
    mime_type: a,
    alt_text: l
  }) {
    this.meta = { _type: "gradio.FileData" }, this.path = e, this.url = n, this.orig_name = i, this.size = o, this.blob = n ? void 0 : r, this.is_stream = s, this.mime_type = a, this.alt_text = l;
  }
}
const Oa = "This application is too busy. Keep trying!", Vt = "Connection errored out.";
let Ha;
function Rc(t, e) {
  return { post_data: n, upload_files: i, client: o, handle_blob: r };
  async function n(s, a, l) {
    const u = { "Content-Type": "application/json" };
    l && (u.Authorization = `Bearer ${l}`);
    try {
      var c = await t(s, {
        method: "POST",
        body: JSON.stringify(a),
        headers: u
      });
    } catch {
      return [{ error: Vt }, 500];
    }
    let f, h;
    try {
      f = await c.json(), h = c.status;
    } catch (d) {
      f = { error: `Could not parse server response: ${d}` }, h = 500;
    }
    return [f, h];
  }
  async function i(s, a, l, u) {
    const c = {};
    l && (c.Authorization = `Bearer ${l}`);
    const f = 1e3, h = [];
    for (let _ = 0; _ < a.length; _ += f) {
      const m = a.slice(_, _ + f), v = new FormData();
      m.forEach((k) => {
        v.append("files", k);
      });
      try {
        const k = u ? `${s}/upload?upload_id=${u}` : `${s}/upload`;
        var d = await t(k, {
          method: "POST",
          body: v,
          headers: c
        });
      } catch {
        return { error: Vt };
      }
      const p = await d.json();
      h.push(...p);
    }
    return { files: h };
  }
  async function o(s, a = {}) {
    return new Promise(async (l) => {
      const { status_callback: u, hf_token: c } = a, f = {
        predict: J,
        submit: E,
        view_api: ee,
        component_server: U
      };
      if ((typeof window > "u" || !("WebSocket" in window)) && !global.Websocket) {
        const H = await import("./wrapper-6f348d45-19fa94bf.js");
        Ha = (await import("./__vite-browser-external-2447137e.js")).Blob, global.WebSocket = H.WebSocket;
      }
      const { ws_protocol: h, http_protocol: d, host: _, space_id: m } = await Sc(s, c), v = Math.random().toString(36).substring(2), p = {};
      let k = !1, w = {}, C = {}, T = null;
      const y = {}, O = /* @__PURE__ */ new Set();
      let P, A = {}, R = !1;
      c && m && (R = await Dc(m, c));
      async function z(H) {
        if (P = H, window.location.protocol === "https:" && (P.root = P.root.replace("http://", "https://")), A = Ac((H == null ? void 0 : H.dependencies) || []), P.auth_required)
          return {
            config: P,
            ...f
          };
        try {
          X = await ee(P);
        } catch (Y) {
          console.error(`Could not get api details: ${Y.message}`);
        }
        return {
          config: P,
          ...f
        };
      }
      let X;
      async function F(H) {
        if (u && u(H), H.status === "running")
          try {
            P = await Ss(
              t,
              `${d}//${_}`,
              c
            );
            const Y = await z(P);
            l(Y);
          } catch (Y) {
            console.error(Y), u && u({
              status: "error",
              message: "Could not load this space.",
              load_status: "error",
              detail: "NOT_FOUND"
            });
          }
      }
      try {
        P = await Ss(
          t,
          `${d}//${_}`,
          c
        );
        const H = await z(P);
        l(H);
      } catch (H) {
        console.error(H), m ? Rr(
          m,
          Ba.test(m) ? "space_name" : "subdomain",
          F
        ) : u && u({
          status: "error",
          message: "Could not load this space.",
          load_status: "error",
          detail: "NOT_FOUND"
        });
      }
      function J(H, Y, se) {
        let g = !1, L = !1, G;
        if (typeof H == "number")
          G = P.dependencies[H];
        else {
          const W = H.replace(/^\//, "");
          G = P.dependencies[A[W]];
        }
        if (G.types.continuous)
          throw new Error(
            "Cannot call predict on this function as it may run forever. Use submit instead"
          );
        return new Promise((W, de) => {
          const he = E(H, Y, se);
          let q;
          he.on("data", (ve) => {
            L && (he.destroy(), W(ve)), g = !0, q = ve;
          }).on("status", (ve) => {
            ve.stage === "error" && de(ve), ve.stage === "complete" && (L = !0, g && (he.destroy(), W(q)));
          });
        });
      }
      function E(H, Y, se, g = null) {
        let L, G;
        if (typeof H == "number")
          L = H, G = X.unnamed_endpoints[L];
        else {
          const le = H.replace(/^\//, "");
          L = A[le], G = X.named_endpoints[H.trim()];
        }
        if (typeof L != "number")
          throw new Error(
            "There is no endpoint matching that name of fn_index matching that number."
          );
        let W, de, he = P.protocol ?? "ws";
        const q = typeof H == "number" ? "/predict" : H;
        let ve, M = null, B = !1;
        const ue = {};
        let Ce = "";
        typeof window < "u" && (Ce = new URLSearchParams(window.location.search).toString()), r(`${P.root}`, Y, G, c).then(
          (le) => {
            if (ve = {
              data: le || [],
              event_data: se,
              fn_index: L,
              trigger_id: g
            }, Oc(L, P))
              Q({
                type: "status",
                endpoint: q,
                stage: "pending",
                queue: !1,
                fn_index: L,
                time: /* @__PURE__ */ new Date()
              }), n(
                `${P.root}/run${q.startsWith("/") ? q : `/${q}`}${Ce ? "?" + Ce : ""}`,
                {
                  ...ve,
                  session_hash: v
                },
                c
              ).then(([b, S]) => {
                const D = b.data;
                S == 200 ? (Q({
                  type: "data",
                  endpoint: q,
                  fn_index: L,
                  data: D,
                  time: /* @__PURE__ */ new Date()
                }), Q({
                  type: "status",
                  endpoint: q,
                  fn_index: L,
                  stage: "complete",
                  eta: b.average_duration,
                  queue: !1,
                  time: /* @__PURE__ */ new Date()
                })) : Q({
                  type: "status",
                  stage: "error",
                  endpoint: q,
                  fn_index: L,
                  message: b.error,
                  queue: !1,
                  time: /* @__PURE__ */ new Date()
                });
              }).catch((b) => {
                Q({
                  type: "status",
                  stage: "error",
                  message: b.message,
                  endpoint: q,
                  fn_index: L,
                  queue: !1,
                  time: /* @__PURE__ */ new Date()
                });
              });
            else if (he == "ws") {
              Q({
                type: "status",
                stage: "pending",
                queue: !0,
                endpoint: q,
                fn_index: L,
                time: /* @__PURE__ */ new Date()
              });
              let b = new URL(`${h}://${Ra(
                _,
                P.path,
                !0
              )}
							/queue/join${Ce ? "?" + Ce : ""}`);
              R && b.searchParams.set("__sign", R), W = new WebSocket(b), W.onclose = (S) => {
                S.wasClean || Q({
                  type: "status",
                  stage: "error",
                  broken: !0,
                  message: Vt,
                  queue: !0,
                  endpoint: q,
                  fn_index: L,
                  time: /* @__PURE__ */ new Date()
                });
              }, W.onmessage = function(S) {
                const D = JSON.parse(S.data), { type: I, status: j, data: K } = No(
                  D,
                  p[L]
                );
                if (I === "update" && j && !B)
                  Q({
                    type: "status",
                    endpoint: q,
                    fn_index: L,
                    time: /* @__PURE__ */ new Date(),
                    ...j
                  }), j.stage === "error" && W.close();
                else if (I === "hash") {
                  W.send(JSON.stringify({ fn_index: L, session_hash: v }));
                  return;
                } else
                  I === "data" ? W.send(JSON.stringify({ ...ve, session_hash: v })) : I === "complete" ? B = j : I === "log" ? Q({
                    type: "log",
                    log: K.log,
                    level: K.level,
                    endpoint: q,
                    fn_index: L
                  }) : I === "generating" && Q({
                    type: "status",
                    time: /* @__PURE__ */ new Date(),
                    ...j,
                    stage: j == null ? void 0 : j.stage,
                    queue: !0,
                    endpoint: q,
                    fn_index: L
                  });
                K && (Q({
                  type: "data",
                  time: /* @__PURE__ */ new Date(),
                  data: K.data,
                  endpoint: q,
                  fn_index: L
                }), B && (Q({
                  type: "status",
                  time: /* @__PURE__ */ new Date(),
                  ...B,
                  stage: j == null ? void 0 : j.stage,
                  queue: !0,
                  endpoint: q,
                  fn_index: L
                }), W.close()));
              }, ws(P.version || "2.0.0", "3.6") < 0 && addEventListener(
                "open",
                () => W.send(JSON.stringify({ hash: v }))
              );
            } else if (he == "sse") {
              Q({
                type: "status",
                stage: "pending",
                queue: !0,
                endpoint: q,
                fn_index: L,
                time: /* @__PURE__ */ new Date()
              });
              var Se = new URLSearchParams({
                fn_index: L.toString(),
                session_hash: v
              }).toString();
              let b = new URL(
                `${P.root}/queue/join?${Ce ? Ce + "&" : ""}${Se}`
              );
              de = e(b), de.onmessage = async function(S) {
                const D = JSON.parse(S.data), { type: I, status: j, data: K } = No(
                  D,
                  p[L]
                );
                if (I === "update" && j && !B)
                  Q({
                    type: "status",
                    endpoint: q,
                    fn_index: L,
                    time: /* @__PURE__ */ new Date(),
                    ...j
                  }), j.stage === "error" && de.close();
                else if (I === "data") {
                  M = D.event_id;
                  let [Wt, Ec] = await n(
                    `${P.root}/queue/data`,
                    {
                      ...ve,
                      session_hash: v,
                      event_id: M
                    },
                    c
                  );
                  Ec !== 200 && (Q({
                    type: "status",
                    stage: "error",
                    message: Vt,
                    queue: !0,
                    endpoint: q,
                    fn_index: L,
                    time: /* @__PURE__ */ new Date()
                  }), de.close());
                } else
                  I === "complete" ? B = j : I === "log" ? Q({
                    type: "log",
                    log: K.log,
                    level: K.level,
                    endpoint: q,
                    fn_index: L
                  }) : I === "generating" && Q({
                    type: "status",
                    time: /* @__PURE__ */ new Date(),
                    ...j,
                    stage: j == null ? void 0 : j.stage,
                    queue: !0,
                    endpoint: q,
                    fn_index: L
                  });
                K && (Q({
                  type: "data",
                  time: /* @__PURE__ */ new Date(),
                  data: K.data,
                  endpoint: q,
                  fn_index: L
                }), B && (Q({
                  type: "status",
                  time: /* @__PURE__ */ new Date(),
                  ...B,
                  stage: j == null ? void 0 : j.stage,
                  queue: !0,
                  endpoint: q,
                  fn_index: L
                }), de.close()));
              };
            } else
              (he == "sse_v1" || he == "sse_v2" || he == "sse_v2.1" || he == "sse_v3") && (Q({
                type: "status",
                stage: "pending",
                queue: !0,
                endpoint: q,
                fn_index: L,
                time: /* @__PURE__ */ new Date()
              }), n(
                `${P.root}/queue/join?${Ce}`,
                {
                  ...ve,
                  session_hash: v
                },
                c
              ).then(([b, S]) => {
                if (S === 503)
                  Q({
                    type: "status",
                    stage: "error",
                    message: Oa,
                    queue: !0,
                    endpoint: q,
                    fn_index: L,
                    time: /* @__PURE__ */ new Date()
                  });
                else if (S !== 200)
                  Q({
                    type: "status",
                    stage: "error",
                    message: Vt,
                    queue: !0,
                    endpoint: q,
                    fn_index: L,
                    time: /* @__PURE__ */ new Date()
                  });
                else {
                  M = b.event_id;
                  let D = async function(I) {
                    try {
                      const { type: j, status: K, data: Wt } = No(
                        I,
                        p[L]
                      );
                      if (j == "heartbeat")
                        return;
                      if (j === "update" && K && !B)
                        Q({
                          type: "status",
                          endpoint: q,
                          fn_index: L,
                          time: /* @__PURE__ */ new Date(),
                          ...K
                        });
                      else if (j === "complete")
                        B = K;
                      else if (j == "unexpected_error")
                        console.error("Unexpected error", K == null ? void 0 : K.message), Q({
                          type: "status",
                          stage: "error",
                          message: (K == null ? void 0 : K.message) || "An Unexpected Error Occurred!",
                          queue: !0,
                          endpoint: q,
                          fn_index: L,
                          time: /* @__PURE__ */ new Date()
                        });
                      else if (j === "log") {
                        Q({
                          type: "log",
                          log: Wt.log,
                          level: Wt.level,
                          endpoint: q,
                          fn_index: L
                        });
                        return;
                      } else
                        j === "generating" && (Q({
                          type: "status",
                          time: /* @__PURE__ */ new Date(),
                          ...K,
                          stage: K == null ? void 0 : K.stage,
                          queue: !0,
                          endpoint: q,
                          fn_index: L
                        }), Wt && ["sse_v2", "sse_v2.1", "sse_v3"].includes(he) && wt(M, Wt));
                      Wt && (Q({
                        type: "data",
                        time: /* @__PURE__ */ new Date(),
                        data: Wt.data,
                        endpoint: q,
                        fn_index: L
                      }), B && Q({
                        type: "status",
                        time: /* @__PURE__ */ new Date(),
                        ...B,
                        stage: K == null ? void 0 : K.stage,
                        queue: !0,
                        endpoint: q,
                        fn_index: L
                      })), ((K == null ? void 0 : K.stage) === "complete" || (K == null ? void 0 : K.stage) === "error") && (y[M] && delete y[M], M in C && delete C[M]);
                    } catch (j) {
                      console.error("Unexpected client exception", j), Q({
                        type: "status",
                        stage: "error",
                        message: "An Unexpected Error Occurred!",
                        queue: !0,
                        endpoint: q,
                        fn_index: L,
                        time: /* @__PURE__ */ new Date()
                      }), ["sse_v2", "sse_v2.1"].includes(he) && N();
                    }
                  };
                  M in w && (w[M].forEach(
                    (I) => D(I)
                  ), delete w[M]), y[M] = D, O.add(M), k || V();
                }
              }));
          }
        );
        function wt(le, Se) {
          !C[le] ? (C[le] = [], Se.data.forEach((S, D) => {
            C[le][D] = S;
          })) : Se.data.forEach((S, D) => {
            let I = Pc(
              C[le][D],
              S
            );
            C[le][D] = I, Se.data[D] = I;
          });
        }
        function Q(le) {
          const b = ue[le.type] || [];
          b == null || b.forEach((S) => S(le));
        }
        function yt(le, Se) {
          const b = ue, S = b[le] || [];
          return b[le] = S, S == null || S.push(Se), { on: yt, off: yn, cancel: ti, destroy: ni };
        }
        function yn(le, Se) {
          const b = ue;
          let S = b[le] || [];
          return S = S == null ? void 0 : S.filter((D) => D !== Se), b[le] = S, { on: yt, off: yn, cancel: ti, destroy: ni };
        }
        async function ti() {
          const le = {
            stage: "complete",
            queue: !1,
            time: /* @__PURE__ */ new Date()
          };
          B = le, Q({
            ...le,
            type: "status",
            endpoint: q,
            fn_index: L
          });
          let Se = {};
          he === "ws" ? (W && W.readyState === 0 ? W.addEventListener("open", () => {
            W.close();
          }) : W.close(), Se = { fn_index: L, session_hash: v }) : (de.close(), Se = { event_id: M });
          try {
            await t(`${P.root}/reset`, {
              headers: { "Content-Type": "application/json" },
              method: "POST",
              body: JSON.stringify(Se)
            });
          } catch {
            console.warn(
              "The `/reset` endpoint could not be called. Subsequent endpoint results may be unreliable."
            );
          }
        }
        function ni() {
          for (const le in ue)
            ue[le].forEach((Se) => {
              yn(le, Se);
            });
        }
        return {
          on: yt,
          off: yn,
          cancel: ti,
          destroy: ni
        };
      }
      function V() {
        k = !0;
        let H = new URLSearchParams({
          session_hash: v
        }).toString(), Y = new URL(`${P.root}/queue/data?${H}`);
        T = e(Y), T.onmessage = async function(se) {
          let g = JSON.parse(se.data);
          const L = g.event_id;
          if (!L)
            await Promise.all(
              Object.keys(y).map(
                (G) => y[G](g)
              )
            );
          else if (y[L]) {
            g.msg === "process_completed" && ["sse", "sse_v1", "sse_v2", "sse_v2.1"].includes(P.protocol) && (O.delete(L), O.size === 0 && N());
            let G = y[L];
            window.setTimeout(G, 0, g);
          } else
            w[L] || (w[L] = []), w[L].push(g);
          g.msg === "close_stream" && N();
        }, T.onerror = async function(se) {
          await Promise.all(
            Object.keys(y).map(
              (g) => y[g]({
                msg: "unexpected_error",
                message: Vt
              })
            )
          ), N();
        };
      }
      function N() {
        k = !1, T == null || T.close();
      }
      async function U(H, Y, se) {
        var g;
        const L = { "Content-Type": "application/json" };
        c && (L.Authorization = `Bearer ${c}`);
        let G, W = P.components.find(
          (q) => q.id === H
        );
        (g = W == null ? void 0 : W.props) != null && g.root_url ? G = W.props.root_url : G = P.root;
        const de = await t(
          `${G}/component_server/`,
          {
            method: "POST",
            body: JSON.stringify({
              data: se,
              component_id: H,
              fn_name: Y,
              session_hash: v
            }),
            headers: L
          }
        );
        if (!de.ok)
          throw new Error(
            "Could not connect to component server: " + de.statusText
          );
        return await de.json();
      }
      async function ee(H) {
        if (X)
          return X;
        const Y = { "Content-Type": "application/json" };
        c && (Y.Authorization = `Bearer ${c}`);
        let se;
        if (ws(H.version || "2.0.0", "3.30") < 0 ? se = await t(
          "https://gradio-space-api-fetcher-v2.hf.space/api",
          {
            method: "POST",
            body: JSON.stringify({
              serialize: !1,
              config: JSON.stringify(H)
            }),
            headers: Y
          }
        ) : se = await t(`${H.root}/info`, {
          headers: Y
        }), !se.ok)
          throw new Error(Vt);
        let g = await se.json();
        return "api" in g && (g = g.api), g.named_endpoints["/predict"] && !g.unnamed_endpoints[0] && (g.unnamed_endpoints[0] = g.named_endpoints["/predict"]), Mc(g, H, A);
      }
    });
  }
  async function r(s, a, l, u) {
    const c = await Pr(
      a,
      void 0,
      [],
      !0,
      l
    );
    return Promise.all(
      c.map(async ({ path: f, blob: h, type: d }) => {
        if (h) {
          const _ = (await i(s, [h], u)).files[0];
          return { path: f, file_url: _, type: d, name: h == null ? void 0 : h.name };
        }
        return { path: f, type: d };
      })
    ).then((f) => (f.forEach(({ path: h, file_url: d, type: _, name: m }) => {
      if (_ === "Gallery")
        Cs(a, d, h);
      else if (d) {
        const v = new _o({ path: d, orig_name: m });
        Cs(a, v, h);
      }
    }), a));
  }
}
const { post_data: z2, upload_files: Bc, client: G2, handle_blob: W2 } = Rc(
  fetch,
  (...t) => new EventSource(...t)
);
function ks(t, e, n, i) {
  switch (t.type) {
    case "string":
      return "string";
    case "boolean":
      return "boolean";
    case "number":
      return "number";
  }
  if (n === "JSONSerializable" || n === "StringSerializable")
    return "any";
  if (n === "ListStringSerializable")
    return "string[]";
  if (e === "Image")
    return i === "parameter" ? "Blob | File | Buffer" : "string";
  if (n === "FileSerializable")
    return (t == null ? void 0 : t.type) === "array" ? i === "parameter" ? "(Blob | File | Buffer)[]" : "{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}[]" : i === "parameter" ? "Blob | File | Buffer" : "{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}";
  if (n === "GallerySerializable")
    return i === "parameter" ? "[(Blob | File | Buffer), (string | null)][]" : "[{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}, (string | null))][]";
}
function Es(t, e) {
  return e === "GallerySerializable" ? "array of [file, label] tuples" : e === "ListStringSerializable" ? "array of strings" : e === "FileSerializable" ? "array of files or single file" : t.description;
}
function Mc(t, e, n) {
  const i = {
    named_endpoints: {},
    unnamed_endpoints: {}
  };
  for (const o in t) {
    const r = t[o];
    for (const s in r) {
      const a = e.dependencies[s] ? s : n[s.replace("/", "")], l = r[s];
      i[o][s] = {}, i[o][s].parameters = {}, i[o][s].returns = {}, i[o][s].type = e.dependencies[a].types, i[o][s].parameters = l.parameters.map(
        ({ label: u, component: c, type: f, serializer: h }) => ({
          label: u,
          component: c,
          type: ks(f, c, h, "parameter"),
          description: Es(f, h)
        })
      ), i[o][s].returns = l.returns.map(
        ({ label: u, component: c, type: f, serializer: h }) => ({
          label: u,
          component: c,
          type: ks(f, c, h, "return"),
          description: Es(f, h)
        })
      );
    }
  }
  return i;
}
async function Dc(t, e) {
  try {
    return (await (await fetch(`https://huggingface.co/api/spaces/${t}/jwt`, {
      headers: {
        Authorization: `Bearer ${e}`
      }
    })).json()).token || !1;
  } catch (n) {
    return console.error(n), !1;
  }
}
function Cs(t, e, n) {
  for (; n.length > 1; )
    t = t[n.shift()];
  t[n.shift()] = e;
}
async function Pr(t, e = void 0, n = [], i = !1, o = void 0) {
  if (Array.isArray(t)) {
    let r = [];
    return await Promise.all(
      t.map(async (s, a) => {
        var l;
        let u = n.slice();
        u.push(a);
        const c = await Pr(
          t[a],
          i ? ((l = o == null ? void 0 : o.parameters[a]) == null ? void 0 : l.component) || void 0 : e,
          u,
          !1,
          o
        );
        r = r.concat(c);
      })
    ), r;
  } else {
    if (globalThis.Buffer && t instanceof globalThis.Buffer)
      return [
        {
          path: n,
          blob: e === "Image" ? !1 : new Ha([t]),
          type: e
        }
      ];
    if (typeof t == "object") {
      let r = [];
      for (let s in t)
        if (t.hasOwnProperty(s)) {
          let a = n.slice();
          a.push(s), r = r.concat(
            await Pr(
              t[s],
              void 0,
              a,
              !1,
              o
            )
          );
        }
      return r;
    }
  }
  return [];
}
function Oc(t, e) {
  var n, i, o, r;
  return !(((i = (n = e == null ? void 0 : e.dependencies) == null ? void 0 : n[t]) == null ? void 0 : i.queue) === null ? e.enable_queue : (r = (o = e == null ? void 0 : e.dependencies) == null ? void 0 : o[t]) != null && r.queue) || !1;
}
async function Ss(t, e, n) {
  const i = {};
  if (n && (i.Authorization = `Bearer ${n}`), typeof window < "u" && window.gradio_config && location.origin !== "http://localhost:9876" && !window.gradio_config.dev_mode) {
    const o = window.gradio_config.root, r = window.gradio_config;
    return r.root = Ra(e, r.root, !1), { ...r, path: o };
  } else if (e) {
    let o = await t(`${e}/config`, {
      headers: i
    });
    if (o.status === 200) {
      const r = await o.json();
      return r.path = r.path ?? "", r.root = e, r;
    }
    throw new Error("Could not get config.");
  }
  throw new Error("No config or app endpoint found");
}
async function Rr(t, e, n) {
  let i = e === "subdomain" ? `https://huggingface.co/api/spaces/by-subdomain/${t}` : `https://huggingface.co/api/spaces/${t}`, o, r;
  try {
    if (o = await fetch(i), r = o.status, r !== 200)
      throw new Error();
    o = await o.json();
  } catch {
    n({
      status: "error",
      load_status: "error",
      message: "Could not get space status",
      detail: "NOT_FOUND"
    });
    return;
  }
  if (!o || r !== 200)
    return;
  const {
    runtime: { stage: s },
    id: a
  } = o;
  switch (s) {
    case "STOPPED":
    case "SLEEPING":
      n({
        status: "sleeping",
        load_status: "pending",
        message: "Space is asleep. Waking it up...",
        detail: s
      }), setTimeout(() => {
        Rr(t, e, n);
      }, 1e3);
      break;
    case "PAUSED":
      n({
        status: "paused",
        load_status: "error",
        message: "This space has been paused by the author. If you would like to try this demo, consider duplicating the space.",
        detail: s,
        discussions_enabled: await ys(a)
      });
      break;
    case "RUNNING":
    case "RUNNING_BUILDING":
      n({
        status: "running",
        load_status: "complete",
        message: "",
        detail: s
      });
      break;
    case "BUILDING":
      n({
        status: "building",
        load_status: "pending",
        message: "Space is building...",
        detail: s
      }), setTimeout(() => {
        Rr(t, e, n);
      }, 1e3);
      break;
    default:
      n({
        status: "space_error",
        load_status: "error",
        message: "This space is experiencing an issue.",
        detail: s,
        discussions_enabled: await ys(a)
      });
      break;
  }
}
function No(t, e) {
  switch (t.msg) {
    case "send_data":
      return { type: "data" };
    case "send_hash":
      return { type: "hash" };
    case "queue_full":
      return {
        type: "update",
        status: {
          queue: !0,
          message: Oa,
          stage: "error",
          code: t.code,
          success: t.success
        }
      };
    case "heartbeat":
      return {
        type: "heartbeat"
      };
    case "unexpected_error":
      return {
        type: "unexpected_error",
        status: {
          queue: !0,
          message: t.message,
          stage: "error",
          success: !1
        }
      };
    case "estimation":
      return {
        type: "update",
        status: {
          queue: !0,
          stage: e || "pending",
          code: t.code,
          size: t.queue_size,
          position: t.rank,
          eta: t.rank_eta,
          success: t.success
        }
      };
    case "progress":
      return {
        type: "update",
        status: {
          queue: !0,
          stage: "pending",
          code: t.code,
          progress_data: t.progress_data,
          success: t.success
        }
      };
    case "log":
      return { type: "log", data: t };
    case "process_generating":
      return {
        type: "generating",
        status: {
          queue: !0,
          message: t.success ? null : t.output.error,
          stage: t.success ? "generating" : "error",
          code: t.code,
          progress_data: t.progress_data,
          eta: t.average_duration
        },
        data: t.success ? t.output : null
      };
    case "process_completed":
      return "error" in t.output ? {
        type: "update",
        status: {
          queue: !0,
          message: t.output.error,
          stage: "error",
          code: t.code,
          success: t.success
        }
      } : {
        type: "complete",
        status: {
          queue: !0,
          message: t.success ? void 0 : t.output.error,
          stage: t.success ? "complete" : "error",
          code: t.code,
          progress_data: t.progress_data
        },
        data: t.success ? t.output : null
      };
    case "process_starts":
      return {
        type: "update",
        status: {
          queue: !0,
          stage: "pending",
          code: t.code,
          size: t.rank,
          position: 0,
          success: t.success,
          eta: t.eta
        }
      };
  }
  return { type: "none", status: { stage: "error", queue: !0 } };
}
class As {
  constructor({
    path: e,
    url: n,
    orig_name: i,
    size: o,
    blob: r,
    is_stream: s,
    mime_type: a,
    alt_text: l
  }) {
    this.file_data = new _o({ path: e, url: n, orig_name: i, size: o, blob: r, is_stream: s, mime_type: a, alt_text: l }), this.annotations = null;
  }
}
const Hc = [
  { 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 }
], Ts = {
  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"
  }
};
Hc.reduce(
  (t, { color: e, primary: n, secondary: i }) => ({
    ...t,
    [e]: {
      primary: Ts[e][n],
      secondary: Ts[e][i]
    }
  }),
  {}
);
function Nc(t) {
  let e, n = t[0], i = 1;
  for (; i < t.length; ) {
    const o = t[i], r = t[i + 1];
    if (i += 2, (o === "optionalAccess" || o === "optionalCall") && n == null)
      return;
    o === "access" || o === "optionalAccess" ? (e = n, n = r(n)) : (o === "call" || o === "optionalCall") && (n = r((...s) => n.call(e, ...s)), e = void 0);
  }
  return n;
}
class Io extends Error {
  constructor(e) {
    super(e), this.name = "ShareError";
  }
}
async function Ic(t, e) {
  if (window.__gradio_space__ == null)
    throw new Io("Must be on Spaces to share.");
  let n, i, o;
  if (e === "url") {
    const l = await fetch(t);
    n = await l.blob(), i = l.headers.get("content-type") || "", o = l.headers.get("content-disposition") || "";
  } else
    n = Uc(t), i = t.split(";")[0].split(":")[1], o = "file" + i.split("/")[1];
  const r = new File([n], o, { type: i }), s = await fetch("https://huggingface.co/uploads", {
    method: "POST",
    body: r,
    headers: {
      "Content-Type": r.type,
      "X-Requested-With": "XMLHttpRequest"
    }
  });
  if (!s.ok) {
    if (Nc([s, "access", (l) => l.headers, "access", (l) => l.get, "call", (l) => l("content-type"), "optionalAccess", (l) => l.includes, "call", (l) => l("application/json")])) {
      const l = await s.json();
      throw new Io(`Upload failed: ${l.error}`);
    }
    throw new Io("Upload failed.");
  }
  return await s.text();
}
function Uc(t) {
  for (var e = t.split(","), n = e[0].match(/:(.*?);/)[1], i = atob(e[1]), o = i.length, r = new Uint8Array(o); o--; )
    r[o] = i.charCodeAt(o);
  return new Blob([r], { type: n });
}
const cn = (t) => {
  const e = Math.floor(t / 3600), n = Math.floor(t % 3600 / 60), i = Math.round(t) % 60, o = `${n < 10 ? "0" : ""}${n}`, r = `${i < 10 ? "0" : ""}${i}`;
  return e > 0 ? `${e}:${o}:${r}` : `${n}:${r}`;
};
const {
  SvelteComponent: jc,
  assign: Fc,
  create_slot: qc,
  detach: zc,
  element: Gc,
  get_all_dirty_from_scope: Wc,
  get_slot_changes: Vc,
  get_spread_update: Xc,
  init: Zc,
  insert: xc,
  safe_not_equal: Jc,
  set_dynamic_element_data: Ls,
  set_style: qe,
  toggle_class: dt,
  transition_in: Na,
  transition_out: Ia,
  update_slot_base: Yc
} = window.__gradio__svelte__internal;
function Qc(t) {
  let e, n, i;
  const o = (
    /*#slots*/
    t[18].default
  ), r = qc(
    o,
    t,
    /*$$scope*/
    t[17],
    null
  );
  let s = [
    { "data-testid": (
      /*test_id*/
      t[7]
    ) },
    { id: (
      /*elem_id*/
      t[2]
    ) },
    {
      class: n = "block " + /*elem_classes*/
      t[3].join(" ") + " svelte-nl1om8"
    }
  ], a = {};
  for (let l = 0; l < s.length; l += 1)
    a = Fc(a, s[l]);
  return {
    c() {
      e = Gc(
        /*tag*/
        t[14]
      ), r && r.c(), Ls(
        /*tag*/
        t[14]
      )(e, a), dt(
        e,
        "hidden",
        /*visible*/
        t[10] === !1
      ), dt(
        e,
        "padded",
        /*padding*/
        t[6]
      ), dt(
        e,
        "border_focus",
        /*border_mode*/
        t[5] === "focus"
      ), dt(
        e,
        "border_contrast",
        /*border_mode*/
        t[5] === "contrast"
      ), dt(e, "hide-container", !/*explicit_call*/
      t[8] && !/*container*/
      t[9]), qe(
        e,
        "height",
        /*get_dimension*/
        t[15](
          /*height*/
          t[0]
        )
      ), qe(e, "width", typeof /*width*/
      t[1] == "number" ? `calc(min(${/*width*/
      t[1]}px, 100%))` : (
        /*get_dimension*/
        t[15](
          /*width*/
          t[1]
        )
      )), qe(
        e,
        "border-style",
        /*variant*/
        t[4]
      ), qe(
        e,
        "overflow",
        /*allow_overflow*/
        t[11] ? "visible" : "hidden"
      ), qe(
        e,
        "flex-grow",
        /*scale*/
        t[12]
      ), qe(e, "min-width", `calc(min(${/*min_width*/
      t[13]}px, 100%))`), qe(e, "border-width", "var(--block-border-width)");
    },
    m(l, u) {
      xc(l, e, u), r && r.m(e, null), i = !0;
    },
    p(l, u) {
      r && r.p && (!i || u & /*$$scope*/
      131072) && Yc(
        r,
        o,
        l,
        /*$$scope*/
        l[17],
        i ? Vc(
          o,
          /*$$scope*/
          l[17],
          u,
          null
        ) : Wc(
          /*$$scope*/
          l[17]
        ),
        null
      ), Ls(
        /*tag*/
        l[14]
      )(e, a = Xc(s, [
        (!i || u & /*test_id*/
        128) && { "data-testid": (
          /*test_id*/
          l[7]
        ) },
        (!i || u & /*elem_id*/
        4) && { id: (
          /*elem_id*/
          l[2]
        ) },
        (!i || u & /*elem_classes*/
        8 && n !== (n = "block " + /*elem_classes*/
        l[3].join(" ") + " svelte-nl1om8")) && { class: n }
      ])), dt(
        e,
        "hidden",
        /*visible*/
        l[10] === !1
      ), dt(
        e,
        "padded",
        /*padding*/
        l[6]
      ), dt(
        e,
        "border_focus",
        /*border_mode*/
        l[5] === "focus"
      ), dt(
        e,
        "border_contrast",
        /*border_mode*/
        l[5] === "contrast"
      ), dt(e, "hide-container", !/*explicit_call*/
      l[8] && !/*container*/
      l[9]), u & /*height*/
      1 && qe(
        e,
        "height",
        /*get_dimension*/
        l[15](
          /*height*/
          l[0]
        )
      ), u & /*width*/
      2 && qe(e, "width", typeof /*width*/
      l[1] == "number" ? `calc(min(${/*width*/
      l[1]}px, 100%))` : (
        /*get_dimension*/
        l[15](
          /*width*/
          l[1]
        )
      )), u & /*variant*/
      16 && qe(
        e,
        "border-style",
        /*variant*/
        l[4]
      ), u & /*allow_overflow*/
      2048 && qe(
        e,
        "overflow",
        /*allow_overflow*/
        l[11] ? "visible" : "hidden"
      ), u & /*scale*/
      4096 && qe(
        e,
        "flex-grow",
        /*scale*/
        l[12]
      ), u & /*min_width*/
      8192 && qe(e, "min-width", `calc(min(${/*min_width*/
      l[13]}px, 100%))`);
    },
    i(l) {
      i || (Na(r, l), i = !0);
    },
    o(l) {
      Ia(r, l), i = !1;
    },
    d(l) {
      l && zc(e), r && r.d(l);
    }
  };
}
function Kc(t) {
  let e, n = (
    /*tag*/
    t[14] && Qc(t)
  );
  return {
    c() {
      n && n.c();
    },
    m(i, o) {
      n && n.m(i, o), e = !0;
    },
    p(i, [o]) {
      /*tag*/
      i[14] && n.p(i, o);
    },
    i(i) {
      e || (Na(n, i), e = !0);
    },
    o(i) {
      Ia(n, i), e = !1;
    },
    d(i) {
      n && n.d(i);
    }
  };
}
function $c(t, e, n) {
  let { $$slots: i = {}, $$scope: o } = e, { height: r = void 0 } = e, { width: s = void 0 } = e, { elem_id: a = "" } = e, { elem_classes: l = [] } = e, { variant: u = "solid" } = e, { border_mode: c = "base" } = e, { padding: f = !0 } = e, { type: h = "normal" } = e, { test_id: d = void 0 } = e, { explicit_call: _ = !1 } = e, { container: m = !0 } = e, { visible: v = !0 } = e, { allow_overflow: p = !0 } = e, { scale: k = null } = e, { min_width: w = 0 } = e, C = h === "fieldset" ? "fieldset" : "div";
  const T = (y) => {
    if (y !== void 0) {
      if (typeof y == "number")
        return y + "px";
      if (typeof y == "string")
        return y;
    }
  };
  return t.$$set = (y) => {
    "height" in y && n(0, r = y.height), "width" in y && n(1, s = y.width), "elem_id" in y && n(2, a = y.elem_id), "elem_classes" in y && n(3, l = y.elem_classes), "variant" in y && n(4, u = y.variant), "border_mode" in y && n(5, c = y.border_mode), "padding" in y && n(6, f = y.padding), "type" in y && n(16, h = y.type), "test_id" in y && n(7, d = y.test_id), "explicit_call" in y && n(8, _ = y.explicit_call), "container" in y && n(9, m = y.container), "visible" in y && n(10, v = y.visible), "allow_overflow" in y && n(11, p = y.allow_overflow), "scale" in y && n(12, k = y.scale), "min_width" in y && n(13, w = y.min_width), "$$scope" in y && n(17, o = y.$$scope);
  }, [
    r,
    s,
    a,
    l,
    u,
    c,
    f,
    d,
    _,
    m,
    v,
    p,
    k,
    w,
    C,
    T,
    h,
    o,
    i
  ];
}
class Ua extends jc {
  constructor(e) {
    super(), Zc(this, e, $c, Kc, Jc, {
      height: 0,
      width: 1,
      elem_id: 2,
      elem_classes: 3,
      variant: 4,
      border_mode: 5,
      padding: 6,
      type: 16,
      test_id: 7,
      explicit_call: 8,
      container: 9,
      visible: 10,
      allow_overflow: 11,
      scale: 12,
      min_width: 13
    });
  }
}
const {
  SvelteComponent: ef,
  append: Uo,
  attr: Ii,
  create_component: tf,
  destroy_component: nf,
  detach: of,
  element: Ps,
  init: rf,
  insert: sf,
  mount_component: lf,
  safe_not_equal: af,
  set_data: uf,
  space: cf,
  text: ff,
  toggle_class: Pt,
  transition_in: df,
  transition_out: hf
} = window.__gradio__svelte__internal;
function _f(t) {
  let e, n, i, o, r, s;
  return i = new /*Icon*/
  t[1]({}), {
    c() {
      e = Ps("label"), n = Ps("span"), tf(i.$$.fragment), o = cf(), r = ff(
        /*label*/
        t[0]
      ), Ii(n, "class", "svelte-9gxdi0"), Ii(e, "for", ""), Ii(e, "data-testid", "block-label"), Ii(e, "class", "svelte-9gxdi0"), Pt(e, "hide", !/*show_label*/
      t[2]), Pt(e, "sr-only", !/*show_label*/
      t[2]), Pt(
        e,
        "float",
        /*float*/
        t[4]
      ), Pt(
        e,
        "hide-label",
        /*disable*/
        t[3]
      );
    },
    m(a, l) {
      sf(a, e, l), Uo(e, n), lf(i, n, null), Uo(e, o), Uo(e, r), s = !0;
    },
    p(a, [l]) {
      (!s || l & /*label*/
      1) && uf(
        r,
        /*label*/
        a[0]
      ), (!s || l & /*show_label*/
      4) && Pt(e, "hide", !/*show_label*/
      a[2]), (!s || l & /*show_label*/
      4) && Pt(e, "sr-only", !/*show_label*/
      a[2]), (!s || l & /*float*/
      16) && Pt(
        e,
        "float",
        /*float*/
        a[4]
      ), (!s || l & /*disable*/
      8) && Pt(
        e,
        "hide-label",
        /*disable*/
        a[3]
      );
    },
    i(a) {
      s || (df(i.$$.fragment, a), s = !0);
    },
    o(a) {
      hf(i.$$.fragment, a), s = !1;
    },
    d(a) {
      a && of(e), nf(i);
    }
  };
}
function mf(t, e, n) {
  let { label: i = null } = e, { Icon: o } = e, { show_label: r = !0 } = e, { disable: s = !1 } = e, { float: a = !0 } = e;
  return t.$$set = (l) => {
    "label" in l && n(0, i = l.label), "Icon" in l && n(1, o = l.Icon), "show_label" in l && n(2, r = l.show_label), "disable" in l && n(3, s = l.disable), "float" in l && n(4, a = l.float);
  }, [i, o, r, s, a];
}
class ja extends ef {
  constructor(e) {
    super(), rf(this, e, mf, _f, af, {
      label: 0,
      Icon: 1,
      show_label: 2,
      disable: 3,
      float: 4
    });
  }
}
const {
  SvelteComponent: pf,
  append: Br,
  attr: Et,
  bubble: gf,
  create_component: bf,
  destroy_component: vf,
  detach: Fa,
  element: Mr,
  init: wf,
  insert: qa,
  listen: yf,
  mount_component: kf,
  safe_not_equal: Ef,
  set_data: Cf,
  set_style: Ui,
  space: Sf,
  text: Af,
  toggle_class: Ge,
  transition_in: Tf,
  transition_out: Lf
} = window.__gradio__svelte__internal;
function Rs(t) {
  let e, n;
  return {
    c() {
      e = Mr("span"), n = Af(
        /*label*/
        t[1]
      ), Et(e, "class", "svelte-lpi64a");
    },
    m(i, o) {
      qa(i, e, o), Br(e, n);
    },
    p(i, o) {
      o & /*label*/
      2 && Cf(
        n,
        /*label*/
        i[1]
      );
    },
    d(i) {
      i && Fa(e);
    }
  };
}
function Pf(t) {
  let e, n, i, o, r, s, a, l = (
    /*show_label*/
    t[2] && Rs(t)
  );
  return o = new /*Icon*/
  t[0]({}), {
    c() {
      e = Mr("button"), l && l.c(), n = Sf(), i = Mr("div"), bf(o.$$.fragment), Et(i, "class", "svelte-lpi64a"), Ge(
        i,
        "small",
        /*size*/
        t[4] === "small"
      ), Ge(
        i,
        "large",
        /*size*/
        t[4] === "large"
      ), e.disabled = /*disabled*/
      t[7], Et(
        e,
        "aria-label",
        /*label*/
        t[1]
      ), Et(
        e,
        "aria-haspopup",
        /*hasPopup*/
        t[8]
      ), Et(
        e,
        "title",
        /*label*/
        t[1]
      ), Et(e, "class", "svelte-lpi64a"), Ge(
        e,
        "pending",
        /*pending*/
        t[3]
      ), Ge(
        e,
        "padded",
        /*padded*/
        t[5]
      ), Ge(
        e,
        "highlight",
        /*highlight*/
        t[6]
      ), Ge(
        e,
        "transparent",
        /*transparent*/
        t[9]
      ), Ui(e, "color", !/*disabled*/
      t[7] && /*_color*/
      t[11] ? (
        /*_color*/
        t[11]
      ) : "var(--block-label-text-color)"), Ui(e, "--bg-color", /*disabled*/
      t[7] ? "auto" : (
        /*background*/
        t[10]
      ));
    },
    m(u, c) {
      qa(u, e, c), l && l.m(e, null), Br(e, n), Br(e, i), kf(o, i, null), r = !0, s || (a = yf(
        e,
        "click",
        /*click_handler*/
        t[13]
      ), s = !0);
    },
    p(u, [c]) {
      /*show_label*/
      u[2] ? l ? l.p(u, c) : (l = Rs(u), l.c(), l.m(e, n)) : l && (l.d(1), l = null), (!r || c & /*size*/
      16) && Ge(
        i,
        "small",
        /*size*/
        u[4] === "small"
      ), (!r || c & /*size*/
      16) && Ge(
        i,
        "large",
        /*size*/
        u[4] === "large"
      ), (!r || c & /*disabled*/
      128) && (e.disabled = /*disabled*/
      u[7]), (!r || c & /*label*/
      2) && Et(
        e,
        "aria-label",
        /*label*/
        u[1]
      ), (!r || c & /*hasPopup*/
      256) && Et(
        e,
        "aria-haspopup",
        /*hasPopup*/
        u[8]
      ), (!r || c & /*label*/
      2) && Et(
        e,
        "title",
        /*label*/
        u[1]
      ), (!r || c & /*pending*/
      8) && Ge(
        e,
        "pending",
        /*pending*/
        u[3]
      ), (!r || c & /*padded*/
      32) && Ge(
        e,
        "padded",
        /*padded*/
        u[5]
      ), (!r || c & /*highlight*/
      64) && Ge(
        e,
        "highlight",
        /*highlight*/
        u[6]
      ), (!r || c & /*transparent*/
      512) && Ge(
        e,
        "transparent",
        /*transparent*/
        u[9]
      ), c & /*disabled, _color*/
      2176 && Ui(e, "color", !/*disabled*/
      u[7] && /*_color*/
      u[11] ? (
        /*_color*/
        u[11]
      ) : "var(--block-label-text-color)"), c & /*disabled, background*/
      1152 && Ui(e, "--bg-color", /*disabled*/
      u[7] ? "auto" : (
        /*background*/
        u[10]
      ));
    },
    i(u) {
      r || (Tf(o.$$.fragment, u), r = !0);
    },
    o(u) {
      Lf(o.$$.fragment, u), r = !1;
    },
    d(u) {
      u && Fa(e), l && l.d(), vf(o), s = !1, a();
    }
  };
}
function Rf(t, e, n) {
  let i, { Icon: o } = e, { label: r = "" } = e, { show_label: s = !1 } = e, { pending: a = !1 } = e, { size: l = "small" } = e, { padded: u = !0 } = e, { highlight: c = !1 } = e, { disabled: f = !1 } = e, { hasPopup: h = !1 } = e, { color: d = "var(--block-label-text-color)" } = e, { transparent: _ = !1 } = e, { background: m = "var(--background-fill-primary)" } = e;
  function v(p) {
    gf.call(this, t, p);
  }
  return t.$$set = (p) => {
    "Icon" in p && n(0, o = p.Icon), "label" in p && n(1, r = p.label), "show_label" in p && n(2, s = p.show_label), "pending" in p && n(3, a = p.pending), "size" in p && n(4, l = p.size), "padded" in p && n(5, u = p.padded), "highlight" in p && n(6, c = p.highlight), "disabled" in p && n(7, f = p.disabled), "hasPopup" in p && n(8, h = p.hasPopup), "color" in p && n(12, d = p.color), "transparent" in p && n(9, _ = p.transparent), "background" in p && n(10, m = p.background);
  }, t.$$.update = () => {
    t.$$.dirty & /*highlight, color*/
    4160 && n(11, i = c ? "var(--color-accent)" : d);
  }, [
    o,
    r,
    s,
    a,
    l,
    u,
    c,
    f,
    h,
    _,
    m,
    i,
    d,
    v
  ];
}
class Ei extends pf {
  constructor(e) {
    super(), wf(this, e, Rf, Pf, Ef, {
      Icon: 0,
      label: 1,
      show_label: 2,
      pending: 3,
      size: 4,
      padded: 5,
      highlight: 6,
      disabled: 7,
      hasPopup: 8,
      color: 12,
      transparent: 9,
      background: 10
    });
  }
}
const {
  SvelteComponent: Bf,
  append: Mf,
  attr: jo,
  binding_callbacks: Df,
  create_slot: Of,
  detach: Hf,
  element: Bs,
  get_all_dirty_from_scope: Nf,
  get_slot_changes: If,
  init: Uf,
  insert: jf,
  safe_not_equal: Ff,
  toggle_class: Rt,
  transition_in: qf,
  transition_out: zf,
  update_slot_base: Gf
} = window.__gradio__svelte__internal;
function Wf(t) {
  let e, n, i;
  const o = (
    /*#slots*/
    t[5].default
  ), r = Of(
    o,
    t,
    /*$$scope*/
    t[4],
    null
  );
  return {
    c() {
      e = Bs("div"), n = Bs("div"), r && r.c(), jo(n, "class", "icon svelte-3w3rth"), jo(e, "class", "empty svelte-3w3rth"), jo(e, "aria-label", "Empty value"), Rt(
        e,
        "small",
        /*size*/
        t[0] === "small"
      ), Rt(
        e,
        "large",
        /*size*/
        t[0] === "large"
      ), Rt(
        e,
        "unpadded_box",
        /*unpadded_box*/
        t[1]
      ), Rt(
        e,
        "small_parent",
        /*parent_height*/
        t[3]
      );
    },
    m(s, a) {
      jf(s, e, a), Mf(e, n), r && r.m(n, null), t[6](e), i = !0;
    },
    p(s, [a]) {
      r && r.p && (!i || a & /*$$scope*/
      16) && Gf(
        r,
        o,
        s,
        /*$$scope*/
        s[4],
        i ? If(
          o,
          /*$$scope*/
          s[4],
          a,
          null
        ) : Nf(
          /*$$scope*/
          s[4]
        ),
        null
      ), (!i || a & /*size*/
      1) && Rt(
        e,
        "small",
        /*size*/
        s[0] === "small"
      ), (!i || a & /*size*/
      1) && Rt(
        e,
        "large",
        /*size*/
        s[0] === "large"
      ), (!i || a & /*unpadded_box*/
      2) && Rt(
        e,
        "unpadded_box",
        /*unpadded_box*/
        s[1]
      ), (!i || a & /*parent_height*/
      8) && Rt(
        e,
        "small_parent",
        /*parent_height*/
        s[3]
      );
    },
    i(s) {
      i || (qf(r, s), i = !0);
    },
    o(s) {
      zf(r, s), i = !1;
    },
    d(s) {
      s && Hf(e), r && r.d(s), t[6](null);
    }
  };
}
function Vf(t) {
  let e, n = t[0], i = 1;
  for (; i < t.length; ) {
    const o = t[i], r = t[i + 1];
    if (i += 2, (o === "optionalAccess" || o === "optionalCall") && n == null)
      return;
    o === "access" || o === "optionalAccess" ? (e = n, n = r(n)) : (o === "call" || o === "optionalCall") && (n = r((...s) => n.call(e, ...s)), e = void 0);
  }
  return n;
}
function Xf(t, e, n) {
  let i, { $$slots: o = {}, $$scope: r } = e, { size: s = "small" } = e, { unpadded_box: a = !1 } = e, l;
  function u(f) {
    if (!f)
      return !1;
    const { height: h } = f.getBoundingClientRect(), { height: d } = Vf([
      f,
      "access",
      (_) => _.parentElement,
      "optionalAccess",
      (_) => _.getBoundingClientRect,
      "call",
      (_) => _()
    ]) || { height: h };
    return h > d + 2;
  }
  function c(f) {
    Df[f ? "unshift" : "push"](() => {
      l = f, n(2, l);
    });
  }
  return t.$$set = (f) => {
    "size" in f && n(0, s = f.size), "unpadded_box" in f && n(1, a = f.unpadded_box), "$$scope" in f && n(4, r = f.$$scope);
  }, t.$$.update = () => {
    t.$$.dirty & /*el*/
    4 && n(3, i = u(l));
  }, [s, a, l, i, r, o, c];
}
class za extends Bf {
  constructor(e) {
    super(), Uf(this, e, Xf, Wf, Ff, { size: 0, unpadded_box: 1 });
  }
}
const {
  SvelteComponent: Zf,
  append: xf,
  attr: We,
  detach: Jf,
  init: Yf,
  insert: Qf,
  noop: Fo,
  safe_not_equal: Kf,
  svg_element: Ms
} = window.__gradio__svelte__internal;
function $f(t) {
  let e, n;
  return {
    c() {
      e = Ms("svg"), n = Ms("path"), We(n, "stroke", "currentColor"), We(n, "stroke-width", "1.5"), We(n, "stroke-linecap", "round"), We(n, "stroke-linejoin", "round"), We(n, "d", "M21.044 5.704a.6.6 0 0 1 .956.483v11.626a.6.6 0 0 1-.956.483l-7.889-5.813a.6.6 0 0 1 0-.966l7.89-5.813ZM10.044 5.704a.6.6 0 0 1 .956.483v11.626a.6.6 0 0 1-.956.483l-7.888-5.813a.6.6 0 0 1 0-.966l7.888-5.813Z"), We(e, "xmlns", "http://www.w3.org/2000/svg"), We(e, "width", "24px"), We(e, "height", "24px"), We(e, "fill", "currentColor"), We(e, "stroke-width", "1.5"), We(e, "viewBox", "0 0 24 24"), We(e, "color", "currentColor");
    },
    m(i, o) {
      Qf(i, e, o), xf(e, n);
    },
    p: Fo,
    i: Fo,
    o: Fo,
    d(i) {
      i && Jf(e);
    }
  };
}
class ed extends Zf {
  constructor(e) {
    super(), Yf(this, e, null, $f, Kf, {});
  }
}
const {
  SvelteComponent: td,
  append: qo,
  attr: et,
  detach: nd,
  init: id,
  insert: od,
  noop: zo,
  safe_not_equal: rd,
  set_style: ht,
  svg_element: ji
} = window.__gradio__svelte__internal;
function sd(t) {
  let e, n, i, o;
  return {
    c() {
      e = ji("svg"), n = ji("g"), i = ji("path"), o = ji("path"), et(i, "d", "M18,6L6.087,17.913"), ht(i, "fill", "none"), ht(i, "fill-rule", "nonzero"), ht(i, "stroke-width", "2px"), et(n, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), et(o, "d", "M4.364,4.364L19.636,19.636"), ht(o, "fill", "none"), ht(o, "fill-rule", "nonzero"), ht(o, "stroke-width", "2px"), et(e, "width", "100%"), et(e, "height", "100%"), et(e, "viewBox", "0 0 24 24"), et(e, "version", "1.1"), et(e, "xmlns", "http://www.w3.org/2000/svg"), et(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), et(e, "xml:space", "preserve"), et(e, "stroke", "currentColor"), ht(e, "fill-rule", "evenodd"), ht(e, "clip-rule", "evenodd"), ht(e, "stroke-linecap", "round"), ht(e, "stroke-linejoin", "round");
    },
    m(r, s) {
      od(r, e, s), qo(e, n), qo(n, i), qo(e, o);
    },
    p: zo,
    i: zo,
    o: zo,
    d(r) {
      r && nd(e);
    }
  };
}
class ld extends td {
  constructor(e) {
    super(), id(this, e, null, sd, rd, {});
  }
}
const {
  SvelteComponent: ad,
  append: ud,
  attr: kn,
  detach: cd,
  init: fd,
  insert: dd,
  noop: Go,
  safe_not_equal: hd,
  svg_element: Ds
} = window.__gradio__svelte__internal;
function _d(t) {
  let e, n;
  return {
    c() {
      e = Ds("svg"), n = Ds("path"), kn(n, "fill", "currentColor"), kn(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"), kn(e, "xmlns", "http://www.w3.org/2000/svg"), kn(e, "width", "100%"), kn(e, "height", "100%"), kn(e, "viewBox", "0 0 32 32");
    },
    m(i, o) {
      dd(i, e, o), ud(e, n);
    },
    p: Go,
    i: Go,
    o: Go,
    d(i) {
      i && cd(e);
    }
  };
}
class Ga extends ad {
  constructor(e) {
    super(), fd(this, e, null, _d, hd, {});
  }
}
const {
  SvelteComponent: md,
  append: pd,
  attr: tt,
  detach: gd,
  init: bd,
  insert: vd,
  noop: Wo,
  safe_not_equal: wd,
  svg_element: Os
} = window.__gradio__svelte__internal;
function yd(t) {
  let e, n;
  return {
    c() {
      e = Os("svg"), n = Os("path"), tt(n, "d", "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"), tt(e, "xmlns", "http://www.w3.org/2000/svg"), tt(e, "width", "100%"), tt(e, "height", "100%"), tt(e, "viewBox", "0 0 24 24"), tt(e, "fill", "none"), tt(e, "stroke", "currentColor"), tt(e, "stroke-width", "1.5"), tt(e, "stroke-linecap", "round"), tt(e, "stroke-linejoin", "round"), tt(e, "class", "feather feather-edit-2");
    },
    m(i, o) {
      vd(i, e, o), pd(e, n);
    },
    p: Wo,
    i: Wo,
    o: Wo,
    d(i) {
      i && gd(e);
    }
  };
}
class kd extends md {
  constructor(e) {
    super(), bd(this, e, null, yd, wd, {});
  }
}
const {
  SvelteComponent: Ed,
  append: Cd,
  attr: Ve,
  detach: Sd,
  init: Ad,
  insert: Td,
  noop: Vo,
  safe_not_equal: Ld,
  svg_element: Hs
} = window.__gradio__svelte__internal;
function Pd(t) {
  let e, n;
  return {
    c() {
      e = Hs("svg"), n = Hs("path"), Ve(n, "stroke", "currentColor"), Ve(n, "stroke-width", "1.5"), Ve(n, "stroke-linecap", "round"), Ve(n, "stroke-linejoin", "round"), Ve(n, "d", "M2.956 5.704A.6.6 0 0 0 2 6.187v11.626a.6.6 0 0 0 .956.483l7.889-5.813a.6.6 0 0 0 0-.966l-7.89-5.813ZM13.956 5.704a.6.6 0 0 0-.956.483v11.626a.6.6 0 0 0 .956.483l7.889-5.813a.6.6 0 0 0 0-.966l-7.89-5.813Z"), Ve(e, "xmlns", "http://www.w3.org/2000/svg"), Ve(e, "width", "24px"), Ve(e, "height", "24px"), Ve(e, "fill", "currentColor"), Ve(e, "stroke-width", "1.5"), Ve(e, "viewBox", "0 0 24 24"), Ve(e, "color", "currentColor");
    },
    m(i, o) {
      Td(i, e, o), Cd(e, n);
    },
    p: Vo,
    i: Vo,
    o: Vo,
    d(i) {
      i && Sd(e);
    }
  };
}
class Rd extends Ed {
  constructor(e) {
    super(), Ad(this, e, null, Pd, Ld, {});
  }
}
const {
  SvelteComponent: Bd,
  append: Md,
  attr: En,
  detach: Dd,
  init: Od,
  insert: Hd,
  noop: Xo,
  safe_not_equal: Nd,
  svg_element: Ns
} = window.__gradio__svelte__internal;
function Id(t) {
  let e, n;
  return {
    c() {
      e = Ns("svg"), n = Ns("path"), En(n, "fill", "currentColor"), En(n, "d", "M13.75 2a2.25 2.25 0 0 1 2.236 2.002V4h1.764A2.25 2.25 0 0 1 20 6.25V11h-1.5V6.25a.75.75 0 0 0-.75-.75h-2.129c-.404.603-1.091 1-1.871 1h-3.5c-.78 0-1.467-.397-1.871-1H6.25a.75.75 0 0 0-.75.75v13.5c0 .414.336.75.75.75h4.78a3.99 3.99 0 0 0 .505 1.5H6.25A2.25 2.25 0 0 1 4 19.75V6.25A2.25 2.25 0 0 1 6.25 4h1.764a2.25 2.25 0 0 1 2.236-2h3.5Zm2.245 2.096L16 4.25c0-.052-.002-.103-.005-.154ZM13.75 3.5h-3.5a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5ZM15 12a3 3 0 0 0-3 3v5c0 .556.151 1.077.415 1.524l3.494-3.494a2.25 2.25 0 0 1 3.182 0l3.494 3.494c.264-.447.415-.968.415-1.524v-5a3 3 0 0 0-3-3h-5Zm0 11a2.985 2.985 0 0 1-1.524-.415l3.494-3.494a.75.75 0 0 1 1.06 0l3.494 3.494A2.985 2.985 0 0 1 20 23h-5Zm5-7a1 1 0 1 1 0-2a1 1 0 0 1 0 2Z"), En(e, "xmlns", "http://www.w3.org/2000/svg"), En(e, "width", "100%"), En(e, "height", "100%"), En(e, "viewBox", "0 0 24 24");
    },
    m(i, o) {
      Hd(i, e, o), Md(e, n);
    },
    p: Xo,
    i: Xo,
    o: Xo,
    d(i) {
      i && Dd(e);
    }
  };
}
class Wa extends Bd {
  constructor(e) {
    super(), Od(this, e, null, Id, Nd, {});
  }
}
const {
  SvelteComponent: Ud,
  append: Fi,
  attr: _e,
  detach: jd,
  init: Fd,
  insert: qd,
  noop: Zo,
  safe_not_equal: zd,
  svg_element: ii
} = window.__gradio__svelte__internal;
function Gd(t) {
  let e, n, i, o, r;
  return {
    c() {
      e = ii("svg"), n = ii("path"), i = ii("path"), o = ii("line"), r = ii("line"), _e(n, "d", "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"), _e(i, "d", "M19 10v2a7 7 0 0 1-14 0v-2"), _e(o, "x1", "12"), _e(o, "y1", "19"), _e(o, "x2", "12"), _e(o, "y2", "23"), _e(r, "x1", "8"), _e(r, "y1", "23"), _e(r, "x2", "16"), _e(r, "y2", "23"), _e(e, "xmlns", "http://www.w3.org/2000/svg"), _e(e, "width", "100%"), _e(e, "height", "100%"), _e(e, "viewBox", "0 0 24 24"), _e(e, "fill", "none"), _e(e, "stroke", "currentColor"), _e(e, "stroke-width", "2"), _e(e, "stroke-linecap", "round"), _e(e, "stroke-linejoin", "round"), _e(e, "class", "feather feather-mic");
    },
    m(s, a) {
      qd(s, e, a), Fi(e, n), Fi(e, i), Fi(e, o), Fi(e, r);
    },
    p: Zo,
    i: Zo,
    o: Zo,
    d(s) {
      s && jd(e);
    }
  };
}
class Wd extends Ud {
  constructor(e) {
    super(), Fd(this, e, null, Gd, zd, {});
  }
}
const {
  SvelteComponent: Vd,
  append: xo,
  attr: Le,
  detach: Xd,
  init: Zd,
  insert: xd,
  noop: Jo,
  safe_not_equal: Jd,
  svg_element: qi
} = window.__gradio__svelte__internal;
function Yd(t) {
  let e, n, i, o;
  return {
    c() {
      e = qi("svg"), n = qi("path"), i = qi("circle"), o = qi("circle"), Le(n, "d", "M9 18V5l12-2v13"), Le(i, "cx", "6"), Le(i, "cy", "18"), Le(i, "r", "3"), Le(o, "cx", "18"), Le(o, "cy", "16"), Le(o, "r", "3"), Le(e, "xmlns", "http://www.w3.org/2000/svg"), Le(e, "width", "100%"), Le(e, "height", "100%"), Le(e, "viewBox", "0 0 24 24"), Le(e, "fill", "none"), Le(e, "stroke", "currentColor"), Le(e, "stroke-width", "1.5"), Le(e, "stroke-linecap", "round"), Le(e, "stroke-linejoin", "round"), Le(e, "class", "feather feather-music");
    },
    m(r, s) {
      xd(r, e, s), xo(e, n), xo(e, i), xo(e, o);
    },
    p: Jo,
    i: Jo,
    o: Jo,
    d(r) {
      r && Xd(e);
    }
  };
}
class mo extends Vd {
  constructor(e) {
    super(), Zd(this, e, null, Yd, Jd, {});
  }
}
const {
  SvelteComponent: Qd,
  append: Is,
  attr: Pe,
  detach: Kd,
  init: $d,
  insert: eh,
  noop: Yo,
  safe_not_equal: th,
  svg_element: Qo
} = window.__gradio__svelte__internal;
function nh(t) {
  let e, n, i;
  return {
    c() {
      e = Qo("svg"), n = Qo("rect"), i = Qo("rect"), Pe(n, "x", "6"), Pe(n, "y", "4"), Pe(n, "width", "4"), Pe(n, "height", "16"), Pe(i, "x", "14"), Pe(i, "y", "4"), Pe(i, "width", "4"), Pe(i, "height", "16"), Pe(e, "xmlns", "http://www.w3.org/2000/svg"), Pe(e, "width", "100%"), Pe(e, "height", "100%"), Pe(e, "viewBox", "0 0 24 24"), Pe(e, "fill", "currentColor"), Pe(e, "stroke", "currentColor"), Pe(e, "stroke-width", "1.5"), Pe(e, "stroke-linecap", "round"), Pe(e, "stroke-linejoin", "round");
    },
    m(o, r) {
      eh(o, e, r), Is(e, n), Is(e, i);
    },
    p: Yo,
    i: Yo,
    o: Yo,
    d(o) {
      o && Kd(e);
    }
  };
}
class Va extends Qd {
  constructor(e) {
    super(), $d(this, e, null, nh, th, {});
  }
}
const {
  SvelteComponent: ih,
  append: oh,
  attr: _t,
  detach: rh,
  init: sh,
  insert: lh,
  noop: Ko,
  safe_not_equal: ah,
  svg_element: Us
} = window.__gradio__svelte__internal;
function uh(t) {
  let e, n;
  return {
    c() {
      e = Us("svg"), n = Us("polygon"), _t(n, "points", "5 3 19 12 5 21 5 3"), _t(e, "xmlns", "http://www.w3.org/2000/svg"), _t(e, "width", "100%"), _t(e, "height", "100%"), _t(e, "viewBox", "0 0 24 24"), _t(e, "fill", "currentColor"), _t(e, "stroke", "currentColor"), _t(e, "stroke-width", "1.5"), _t(e, "stroke-linecap", "round"), _t(e, "stroke-linejoin", "round");
    },
    m(i, o) {
      lh(i, e, o), oh(e, n);
    },
    p: Ko,
    i: Ko,
    o: Ko,
    d(i) {
      i && rh(e);
    }
  };
}
class ch extends ih {
  constructor(e) {
    super(), sh(this, e, null, uh, ah, {});
  }
}
const {
  SvelteComponent: fh,
  append: oi,
  attr: re,
  detach: dh,
  init: hh,
  insert: _h,
  noop: $o,
  safe_not_equal: mh,
  svg_element: Cn
} = window.__gradio__svelte__internal;
function ph(t) {
  let e, n, i, o, r, s;
  return {
    c() {
      e = Cn("svg"), n = Cn("circle"), i = Cn("circle"), o = Cn("line"), r = Cn("line"), s = Cn("line"), re(n, "cx", "6"), re(n, "cy", "6"), re(n, "r", "3"), re(i, "cx", "6"), re(i, "cy", "18"), re(i, "r", "3"), re(o, "x1", "20"), re(o, "y1", "4"), re(o, "x2", "8.12"), re(o, "y2", "15.88"), re(r, "x1", "14.47"), re(r, "y1", "14.48"), re(r, "x2", "20"), re(r, "y2", "20"), re(s, "x1", "8.12"), re(s, "y1", "8.12"), re(s, "x2", "12"), re(s, "y2", "12"), re(e, "xmlns", "http://www.w3.org/2000/svg"), re(e, "width", "100%"), re(e, "height", "100%"), re(e, "viewBox", "0 0 24 24"), re(e, "fill", "none"), re(e, "stroke", "currentColor"), re(e, "stroke-width", "2"), re(e, "stroke-linecap", "round"), re(e, "stroke-linejoin", "round"), re(e, "class", "feather feather-scissors");
    },
    m(a, l) {
      _h(a, e, l), oi(e, n), oi(e, i), oi(e, o), oi(e, r), oi(e, s);
    },
    p: $o,
    i: $o,
    o: $o,
    d(a) {
      a && dh(e);
    }
  };
}
class gh extends fh {
  constructor(e) {
    super(), hh(this, e, null, ph, mh, {});
  }
}
const {
  SvelteComponent: bh,
  append: js,
  attr: Xe,
  detach: vh,
  init: wh,
  insert: yh,
  noop: er,
  safe_not_equal: kh,
  svg_element: tr
} = window.__gradio__svelte__internal;
function Eh(t) {
  let e, n, i;
  return {
    c() {
      e = tr("svg"), n = tr("polyline"), i = tr("path"), Xe(n, "points", "1 4 1 10 7 10"), Xe(i, "d", "M3.51 15a9 9 0 1 0 2.13-9.36L1 10"), Xe(e, "xmlns", "http://www.w3.org/2000/svg"), Xe(e, "width", "100%"), Xe(e, "height", "100%"), Xe(e, "viewBox", "0 0 24 24"), Xe(e, "fill", "none"), Xe(e, "stroke", "currentColor"), Xe(e, "stroke-width", "2"), Xe(e, "stroke-linecap", "round"), Xe(e, "stroke-linejoin", "round"), Xe(e, "class", "feather feather-rotate-ccw");
    },
    m(o, r) {
      yh(o, e, r), js(e, n), js(e, i);
    },
    p: er,
    i: er,
    o: er,
    d(o) {
      o && vh(e);
    }
  };
}
class Xa extends bh {
  constructor(e) {
    super(), wh(this, e, null, Eh, kh, {});
  }
}
const {
  SvelteComponent: Ch,
  append: nr,
  attr: Re,
  detach: Sh,
  init: Ah,
  insert: Th,
  noop: ir,
  safe_not_equal: Lh,
  svg_element: zi
} = window.__gradio__svelte__internal;
function Ph(t) {
  let e, n, i, o;
  return {
    c() {
      e = zi("svg"), n = zi("path"), i = zi("polyline"), o = zi("line"), Re(n, "d", "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"), Re(i, "points", "17 8 12 3 7 8"), Re(o, "x1", "12"), Re(o, "y1", "3"), Re(o, "x2", "12"), Re(o, "y2", "15"), Re(e, "xmlns", "http://www.w3.org/2000/svg"), Re(e, "width", "90%"), Re(e, "height", "90%"), Re(e, "viewBox", "0 0 24 24"), Re(e, "fill", "none"), Re(e, "stroke", "currentColor"), Re(e, "stroke-width", "2"), Re(e, "stroke-linecap", "round"), Re(e, "stroke-linejoin", "round"), Re(e, "class", "feather feather-upload");
    },
    m(r, s) {
      Th(r, e, s), nr(e, n), nr(e, i), nr(e, o);
    },
    p: ir,
    i: ir,
    o: ir,
    d(r) {
      r && Sh(e);
    }
  };
}
let Za = class extends Ch {
  constructor(e) {
    super(), Ah(this, e, null, Ph, Lh, {});
  }
};
const {
  SvelteComponent: Rh,
  append: Gi,
  attr: Ne,
  detach: Bh,
  init: Mh,
  insert: Dh,
  noop: or,
  safe_not_equal: Oh,
  svg_element: Wi,
  text: Hh
} = window.__gradio__svelte__internal;
function Nh(t) {
  let e, n, i, o, r;
  return {
    c() {
      e = Wi("svg"), n = Wi("title"), i = Hh("Low volume"), o = Wi("path"), r = Wi("path"), Ne(o, "d", "M19.5 7.5C19.5 7.5 21 9 21 11.5C21 14 19.5 15.5 19.5 15.5"), Ne(o, "stroke-width", "1.5"), Ne(o, "stroke-linecap", "round"), Ne(o, "stroke-linejoin", "round"), Ne(r, "d", "M2 13.8571V10.1429C2 9.03829 2.89543 8.14286 4 8.14286H6.9C7.09569 8.14286 7.28708 8.08544 7.45046 7.97772L13.4495 4.02228C14.1144 3.5839 15 4.06075 15 4.85714V19.1429C15 19.9392 14.1144 20.4161 13.4495 19.9777L7.45046 16.0223C7.28708 15.9146 7.09569 15.8571 6.9 15.8571H4C2.89543 15.8571 2 14.9617 2 13.8571Z"), Ne(r, "stroke-width", "1.5"), Ne(e, "width", "100%"), Ne(e, "height", "100%"), Ne(e, "viewBox", "0 0 24 24"), Ne(e, "stroke-width", "1.5"), Ne(e, "fill", "none"), Ne(e, "xmlns", "http://www.w3.org/2000/svg"), Ne(e, "stroke", "currentColor"), Ne(e, "color", "currentColor");
    },
    m(s, a) {
      Dh(s, e, a), Gi(e, n), Gi(n, i), Gi(e, o), Gi(e, r);
    },
    p: or,
    i: or,
    o: or,
    d(s) {
      s && Bh(e);
    }
  };
}
class Ih extends Rh {
  constructor(e) {
    super(), Mh(this, e, null, Nh, Oh, {});
  }
}
const {
  SvelteComponent: Uh,
  append: ri,
  attr: Ae,
  detach: jh,
  init: Fh,
  insert: qh,
  noop: rr,
  safe_not_equal: zh,
  svg_element: si,
  text: Gh
} = window.__gradio__svelte__internal;
function Wh(t) {
  let e, n, i, o, r, s;
  return {
    c() {
      e = si("svg"), n = si("title"), i = Gh("High volume"), o = si("path"), r = si("path"), s = si("path"), Ae(o, "d", "M1 13.8571V10.1429C1 9.03829 1.89543 8.14286 3 8.14286H5.9C6.09569 8.14286 6.28708 8.08544 6.45046 7.97772L12.4495 4.02228C13.1144 3.5839 14 4.06075 14 4.85714V19.1429C14 19.9392 13.1144 20.4161 12.4495 19.9777L6.45046 16.0223C6.28708 15.9146 6.09569 15.8571 5.9 15.8571H3C1.89543 15.8571 1 14.9617 1 13.8571Z"), Ae(o, "stroke-width", "1.5"), Ae(r, "d", "M17.5 7.5C17.5 7.5 19 9 19 11.5C19 14 17.5 15.5 17.5 15.5"), Ae(r, "stroke-width", "1.5"), Ae(r, "stroke-linecap", "round"), Ae(r, "stroke-linejoin", "round"), Ae(s, "d", "M20.5 4.5C20.5 4.5 23 7 23 11.5C23 16 20.5 18.5 20.5 18.5"), Ae(s, "stroke-width", "1.5"), Ae(s, "stroke-linecap", "round"), Ae(s, "stroke-linejoin", "round"), Ae(e, "width", "100%"), Ae(e, "height", "100%"), Ae(e, "viewBox", "0 0 24 24"), Ae(e, "stroke-width", "1.5"), Ae(e, "fill", "none"), Ae(e, "stroke", "currentColor"), Ae(e, "xmlns", "http://www.w3.org/2000/svg"), Ae(e, "color", "currentColor");
    },
    m(a, l) {
      qh(a, e, l), ri(e, n), ri(n, i), ri(e, o), ri(e, r), ri(e, s);
    },
    p: rr,
    i: rr,
    o: rr,
    d(a) {
      a && jh(e);
    }
  };
}
class Vh extends Uh {
  constructor(e) {
    super(), Fh(this, e, null, Wh, zh, {});
  }
}
const {
  SvelteComponent: Xh,
  append: Bt,
  attr: we,
  detach: Zh,
  init: xh,
  insert: Jh,
  noop: sr,
  safe_not_equal: Yh,
  svg_element: Mt,
  text: Qh
} = window.__gradio__svelte__internal;
function Kh(t) {
  let e, n, i, o, r, s, a, l, u;
  return {
    c() {
      e = Mt("svg"), n = Mt("title"), i = Qh("Muted volume"), o = Mt("g"), r = Mt("path"), s = Mt("path"), a = Mt("defs"), l = Mt("clipPath"), u = Mt("rect"), we(r, "d", "M18 14L20.0005 12M22 10L20.0005 12M20.0005 12L18 10M20.0005 12L22 14"), we(r, "stroke-width", "1.5"), we(r, "stroke-linecap", "round"), we(r, "stroke-linejoin", "round"), we(s, "d", "M2 13.8571V10.1429C2 9.03829 2.89543 8.14286 4 8.14286H6.9C7.09569 8.14286 7.28708 8.08544 7.45046 7.97772L13.4495 4.02228C14.1144 3.5839 15 4.06075 15 4.85714V19.1429C15 19.9392 14.1144 20.4161 13.4495 19.9777L7.45046 16.0223C7.28708 15.9146 7.09569 15.8571 6.9 15.8571H4C2.89543 15.8571 2 14.9617 2 13.8571Z"), we(s, "stroke-width", "1.5"), we(o, "clip-path", "url(#clip0_3173_16686)"), we(u, "width", "24"), we(u, "height", "24"), we(u, "fill", "white"), we(l, "id", "clip0_3173_16686"), we(e, "width", "100%"), we(e, "height", "100%"), we(e, "viewBox", "0 0 24 24"), we(e, "stroke-width", "1.5"), we(e, "fill", "none"), we(e, "xmlns", "http://www.w3.org/2000/svg"), we(e, "stroke", "currentColor"), we(e, "color", "currentColor");
    },
    m(c, f) {
      Jh(c, e, f), Bt(e, n), Bt(n, i), Bt(e, o), Bt(o, r), Bt(o, s), Bt(e, a), Bt(a, l), Bt(l, u);
    },
    p: sr,
    i: sr,
    o: sr,
    d(c) {
      c && Zh(e);
    }
  };
}
class $h extends Xh {
  constructor(e) {
    super(), xh(this, e, null, Kh, Yh, {});
  }
}
const {
  SvelteComponent: e_,
  append: Fs,
  attr: Dt,
  detach: t_,
  init: n_,
  insert: i_,
  noop: lr,
  safe_not_equal: o_,
  svg_element: ar
} = window.__gradio__svelte__internal;
function r_(t) {
  let e, n, i;
  return {
    c() {
      e = ar("svg"), n = ar("path"), i = ar("path"), Dt(n, "fill", "currentColor"), Dt(n, "d", "M12 2c-4.963 0-9 4.038-9 9c0 3.328 1.82 6.232 4.513 7.79l-2.067 1.378A1 1 0 0 0 6 22h12a1 1 0 0 0 .555-1.832l-2.067-1.378C19.18 17.232 21 14.328 21 11c0-4.962-4.037-9-9-9zm0 16c-3.859 0-7-3.141-7-7c0-3.86 3.141-7 7-7s7 3.14 7 7c0 3.859-3.141 7-7 7z"), Dt(i, "fill", "currentColor"), Dt(i, "d", "M12 6c-2.757 0-5 2.243-5 5s2.243 5 5 5s5-2.243 5-5s-2.243-5-5-5zm0 8c-1.654 0-3-1.346-3-3s1.346-3 3-3s3 1.346 3 3s-1.346 3-3 3z"), Dt(e, "xmlns", "http://www.w3.org/2000/svg"), Dt(e, "width", "100%"), Dt(e, "height", "100%"), Dt(e, "viewBox", "0 0 24 24");
    },
    m(o, r) {
      i_(o, e, r), Fs(e, n), Fs(e, i);
    },
    p: lr,
    i: lr,
    o: lr,
    d(o) {
      o && t_(e);
    }
  };
}
class s_ extends e_ {
  constructor(e) {
    super(), n_(this, e, null, r_, o_, {});
  }
}
const {
  SvelteComponent: l_,
  append: Kt,
  attr: Dr,
  check_outros: a_,
  create_component: xa,
  destroy_component: Ja,
  detach: Qi,
  element: Or,
  group_outros: u_,
  init: c_,
  insert: Ki,
  mount_component: Ya,
  safe_not_equal: f_,
  set_data: Hr,
  space: Nr,
  text: di,
  toggle_class: qs,
  transition_in: no,
  transition_out: io
} = window.__gradio__svelte__internal;
function d_(t) {
  let e, n;
  return e = new Za({}), {
    c() {
      xa(e.$$.fragment);
    },
    m(i, o) {
      Ya(e, i, o), n = !0;
    },
    i(i) {
      n || (no(e.$$.fragment, i), n = !0);
    },
    o(i) {
      io(e.$$.fragment, i), n = !1;
    },
    d(i) {
      Ja(e, i);
    }
  };
}
function h_(t) {
  let e, n;
  return e = new Wa({}), {
    c() {
      xa(e.$$.fragment);
    },
    m(i, o) {
      Ya(e, i, o), n = !0;
    },
    i(i) {
      n || (no(e.$$.fragment, i), n = !0);
    },
    o(i) {
      io(e.$$.fragment, i), n = !1;
    },
    d(i) {
      Ja(e, i);
    }
  };
}
function zs(t) {
  let e, n, i = (
    /*i18n*/
    t[1]("common.or") + ""
  ), o, r, s, a = (
    /*message*/
    (t[2] || /*i18n*/
    t[1]("upload_text.click_to_upload")) + ""
  ), l;
  return {
    c() {
      e = Or("span"), n = di("- "), o = di(i), r = di(" -"), s = Nr(), l = di(a), Dr(e, "class", "or svelte-kzcjhc");
    },
    m(u, c) {
      Ki(u, e, c), Kt(e, n), Kt(e, o), Kt(e, r), Ki(u, s, c), Ki(u, l, c);
    },
    p(u, c) {
      c & /*i18n*/
      2 && i !== (i = /*i18n*/
      u[1]("common.or") + "") && Hr(o, i), c & /*message, i18n*/
      6 && a !== (a = /*message*/
      (u[2] || /*i18n*/
      u[1]("upload_text.click_to_upload")) + "") && Hr(l, a);
    },
    d(u) {
      u && (Qi(e), Qi(s), Qi(l));
    }
  };
}
function __(t) {
  let e, n, i, o, r, s = (
    /*i18n*/
    t[1](
      /*defs*/
      t[5][
        /*type*/
        t[0]
      ] || /*defs*/
      t[5].file
    ) + ""
  ), a, l, u;
  const c = [h_, d_], f = [];
  function h(_, m) {
    return (
      /*type*/
      _[0] === "clipboard" ? 0 : 1
    );
  }
  i = h(t), o = f[i] = c[i](t);
  let d = (
    /*mode*/
    t[3] !== "short" && zs(t)
  );
  return {
    c() {
      e = Or("div"), n = Or("span"), o.c(), r = Nr(), a = di(s), l = Nr(), d && d.c(), Dr(n, "class", "icon-wrap svelte-kzcjhc"), qs(
        n,
        "hovered",
        /*hovered*/
        t[4]
      ), Dr(e, "class", "wrap svelte-kzcjhc");
    },
    m(_, m) {
      Ki(_, e, m), Kt(e, n), f[i].m(n, null), Kt(e, r), Kt(e, a), Kt(e, l), d && d.m(e, null), u = !0;
    },
    p(_, [m]) {
      let v = i;
      i = h(_), i !== v && (u_(), io(f[v], 1, 1, () => {
        f[v] = null;
      }), a_(), o = f[i], o || (o = f[i] = c[i](_), o.c()), no(o, 1), o.m(n, null)), (!u || m & /*hovered*/
      16) && qs(
        n,
        "hovered",
        /*hovered*/
        _[4]
      ), (!u || m & /*i18n, type*/
      3) && s !== (s = /*i18n*/
      _[1](
        /*defs*/
        _[5][
          /*type*/
          _[0]
        ] || /*defs*/
        _[5].file
      ) + "") && Hr(a, s), /*mode*/
      _[3] !== "short" ? d ? d.p(_, m) : (d = zs(_), d.c(), d.m(e, null)) : d && (d.d(1), d = null);
    },
    i(_) {
      u || (no(o), u = !0);
    },
    o(_) {
      io(o), u = !1;
    },
    d(_) {
      _ && Qi(e), f[i].d(), d && d.d();
    }
  };
}
function m_(t, e, n) {
  let { type: i = "file" } = e, { i18n: o } = e, { message: r = void 0 } = e, { mode: s = "full" } = e, { hovered: a = !1 } = e;
  const l = {
    image: "upload_text.drop_image",
    video: "upload_text.drop_video",
    audio: "upload_text.drop_audio",
    file: "upload_text.drop_file",
    csv: "upload_text.drop_csv",
    gallery: "upload_text.drop_gallery",
    clipboard: "upload_text.paste_clipboard"
  };
  return t.$$set = (u) => {
    "type" in u && n(0, i = u.type), "i18n" in u && n(1, o = u.i18n), "message" in u && n(2, r = u.message), "mode" in u && n(3, s = u.mode), "hovered" in u && n(4, a = u.hovered);
  }, [i, o, r, s, a, l];
}
class p_ extends l_ {
  constructor(e) {
    super(), c_(this, e, m_, __, f_, {
      type: 0,
      i18n: 1,
      message: 2,
      mode: 3,
      hovered: 4
    });
  }
}
const {
  SvelteComponent: g_,
  append: ur,
  attr: vt,
  check_outros: hi,
  create_component: po,
  destroy_component: go,
  detach: Zn,
  element: Ci,
  empty: b_,
  group_outros: _i,
  init: v_,
  insert: xn,
  listen: bo,
  mount_component: vo,
  safe_not_equal: w_,
  space: cr,
  toggle_class: jt,
  transition_in: ke,
  transition_out: Ue
} = window.__gradio__svelte__internal;
function Gs(t) {
  let e, n = (
    /*sources*/
    t[1].includes("upload")
  ), i, o = (
    /*sources*/
    t[1].includes("microphone")
  ), r, s = (
    /*sources*/
    t[1].includes("webcam")
  ), a, l = (
    /*sources*/
    t[1].includes("clipboard")
  ), u, c = n && Ws(t), f = o && Vs(t), h = s && Xs(t), d = l && Zs(t);
  return {
    c() {
      e = Ci("span"), c && c.c(), i = cr(), f && f.c(), r = cr(), h && h.c(), a = cr(), d && d.c(), vt(e, "class", "source-selection svelte-1jp3vgd"), vt(e, "data-testid", "source-select");
    },
    m(_, m) {
      xn(_, e, m), c && c.m(e, null), ur(e, i), f && f.m(e, null), ur(e, r), h && h.m(e, null), ur(e, a), d && d.m(e, null), u = !0;
    },
    p(_, m) {
      m & /*sources*/
      2 && (n = /*sources*/
      _[1].includes("upload")), n ? c ? (c.p(_, m), m & /*sources*/
      2 && ke(c, 1)) : (c = Ws(_), c.c(), ke(c, 1), c.m(e, i)) : c && (_i(), Ue(c, 1, 1, () => {
        c = null;
      }), hi()), m & /*sources*/
      2 && (o = /*sources*/
      _[1].includes("microphone")), o ? f ? (f.p(_, m), m & /*sources*/
      2 && ke(f, 1)) : (f = Vs(_), f.c(), ke(f, 1), f.m(e, r)) : f && (_i(), Ue(f, 1, 1, () => {
        f = null;
      }), hi()), m & /*sources*/
      2 && (s = /*sources*/
      _[1].includes("webcam")), s ? h ? (h.p(_, m), m & /*sources*/
      2 && ke(h, 1)) : (h = Xs(_), h.c(), ke(h, 1), h.m(e, a)) : h && (_i(), Ue(h, 1, 1, () => {
        h = null;
      }), hi()), m & /*sources*/
      2 && (l = /*sources*/
      _[1].includes("clipboard")), l ? d ? (d.p(_, m), m & /*sources*/
      2 && ke(d, 1)) : (d = Zs(_), d.c(), ke(d, 1), d.m(e, null)) : d && (_i(), Ue(d, 1, 1, () => {
        d = null;
      }), hi());
    },
    i(_) {
      u || (ke(c), ke(f), ke(h), ke(d), u = !0);
    },
    o(_) {
      Ue(c), Ue(f), Ue(h), Ue(d), u = !1;
    },
    d(_) {
      _ && Zn(e), c && c.d(), f && f.d(), h && h.d(), d && d.d();
    }
  };
}
function Ws(t) {
  let e, n, i, o, r;
  return n = new Za({}), {
    c() {
      e = Ci("button"), po(n.$$.fragment), vt(e, "class", "icon svelte-1jp3vgd"), vt(e, "aria-label", "Upload file"), jt(
        e,
        "selected",
        /*active_source*/
        t[0] === "upload" || !/*active_source*/
        t[0]
      );
    },
    m(s, a) {
      xn(s, e, a), vo(n, e, null), i = !0, o || (r = bo(
        e,
        "click",
        /*click_handler*/
        t[6]
      ), o = !0);
    },
    p(s, a) {
      (!i || a & /*active_source*/
      1) && jt(
        e,
        "selected",
        /*active_source*/
        s[0] === "upload" || !/*active_source*/
        s[0]
      );
    },
    i(s) {
      i || (ke(n.$$.fragment, s), i = !0);
    },
    o(s) {
      Ue(n.$$.fragment, s), i = !1;
    },
    d(s) {
      s && Zn(e), go(n), o = !1, r();
    }
  };
}
function Vs(t) {
  let e, n, i, o, r;
  return n = new Wd({}), {
    c() {
      e = Ci("button"), po(n.$$.fragment), vt(e, "class", "icon svelte-1jp3vgd"), vt(e, "aria-label", "Record audio"), jt(
        e,
        "selected",
        /*active_source*/
        t[0] === "microphone"
      );
    },
    m(s, a) {
      xn(s, e, a), vo(n, e, null), i = !0, o || (r = bo(
        e,
        "click",
        /*click_handler_1*/
        t[7]
      ), o = !0);
    },
    p(s, a) {
      (!i || a & /*active_source*/
      1) && jt(
        e,
        "selected",
        /*active_source*/
        s[0] === "microphone"
      );
    },
    i(s) {
      i || (ke(n.$$.fragment, s), i = !0);
    },
    o(s) {
      Ue(n.$$.fragment, s), i = !1;
    },
    d(s) {
      s && Zn(e), go(n), o = !1, r();
    }
  };
}
function Xs(t) {
  let e, n, i, o, r;
  return n = new s_({}), {
    c() {
      e = Ci("button"), po(n.$$.fragment), vt(e, "class", "icon svelte-1jp3vgd"), vt(e, "aria-label", "Capture from camera"), jt(
        e,
        "selected",
        /*active_source*/
        t[0] === "webcam"
      );
    },
    m(s, a) {
      xn(s, e, a), vo(n, e, null), i = !0, o || (r = bo(
        e,
        "click",
        /*click_handler_2*/
        t[8]
      ), o = !0);
    },
    p(s, a) {
      (!i || a & /*active_source*/
      1) && jt(
        e,
        "selected",
        /*active_source*/
        s[0] === "webcam"
      );
    },
    i(s) {
      i || (ke(n.$$.fragment, s), i = !0);
    },
    o(s) {
      Ue(n.$$.fragment, s), i = !1;
    },
    d(s) {
      s && Zn(e), go(n), o = !1, r();
    }
  };
}
function Zs(t) {
  let e, n, i, o, r;
  return n = new Wa({}), {
    c() {
      e = Ci("button"), po(n.$$.fragment), vt(e, "class", "icon svelte-1jp3vgd"), vt(e, "aria-label", "Paste from clipboard"), jt(
        e,
        "selected",
        /*active_source*/
        t[0] === "clipboard"
      );
    },
    m(s, a) {
      xn(s, e, a), vo(n, e, null), i = !0, o || (r = bo(
        e,
        "click",
        /*click_handler_3*/
        t[9]
      ), o = !0);
    },
    p(s, a) {
      (!i || a & /*active_source*/
      1) && jt(
        e,
        "selected",
        /*active_source*/
        s[0] === "clipboard"
      );
    },
    i(s) {
      i || (ke(n.$$.fragment, s), i = !0);
    },
    o(s) {
      Ue(n.$$.fragment, s), i = !1;
    },
    d(s) {
      s && Zn(e), go(n), o = !1, r();
    }
  };
}
function y_(t) {
  let e, n, i = (
    /*unique_sources*/
    t[2].length > 1 && Gs(t)
  );
  return {
    c() {
      i && i.c(), e = b_();
    },
    m(o, r) {
      i && i.m(o, r), xn(o, e, r), n = !0;
    },
    p(o, [r]) {
      /*unique_sources*/
      o[2].length > 1 ? i ? (i.p(o, r), r & /*unique_sources*/
      4 && ke(i, 1)) : (i = Gs(o), i.c(), ke(i, 1), i.m(e.parentNode, e)) : i && (_i(), Ue(i, 1, 1, () => {
        i = null;
      }), hi());
    },
    i(o) {
      n || (ke(i), n = !0);
    },
    o(o) {
      Ue(i), n = !1;
    },
    d(o) {
      o && Zn(e), i && i.d(o);
    }
  };
}
function k_(t, e, n) {
  let i, { sources: o } = e, { active_source: r } = e, { handle_clear: s = () => {
  } } = e, { handle_select: a = () => {
  } } = e;
  async function l(d) {
    s(), n(0, r = d), a(d);
  }
  const u = () => l("upload"), c = () => l("microphone"), f = () => l("webcam"), h = () => l("clipboard");
  return t.$$set = (d) => {
    "sources" in d && n(1, o = d.sources), "active_source" in d && n(0, r = d.active_source), "handle_clear" in d && n(4, s = d.handle_clear), "handle_select" in d && n(5, a = d.handle_select);
  }, t.$$.update = () => {
    t.$$.dirty & /*sources*/
    2 && n(2, i = [...new Set(o)]);
  }, [
    r,
    o,
    i,
    l,
    s,
    a,
    u,
    c,
    f,
    h
  ];
}
class E_ extends g_ {
  constructor(e) {
    super(), v_(this, e, k_, y_, w_, {
      sources: 1,
      active_source: 0,
      handle_clear: 4,
      handle_select: 5
    });
  }
}
const {
  SvelteComponent: C_,
  append: li,
  attr: nt,
  detach: S_,
  init: A_,
  insert: T_,
  noop: fr,
  safe_not_equal: L_,
  svg_element: Sn
} = window.__gradio__svelte__internal;
function P_(t) {
  let e, n, i, o, r, s;
  return {
    c() {
      e = Sn("svg"), n = Sn("g"), i = Sn("g"), o = Sn("path"), r = Sn("path"), s = Sn("polygon"), nt(o, "d", `M348.994,102.946L250.04,3.993c-5.323-5.323-13.954-5.324-19.277,0l-153.7,153.701l118.23,118.23l153.701-153.7\r
			C354.317,116.902,354.317,108.271,348.994,102.946z`), nt(r, "d", `M52.646,182.11l-41.64,41.64c-5.324,5.322-5.324,13.953,0,19.275l98.954,98.957c5.323,5.322,13.954,5.32,19.277,0\r
			l41.639-41.641L52.646,182.11z`), nt(s, "points", "150.133,360 341.767,360 341.767,331.949 182.806,331.949"), nt(e, "version", "1.1"), nt(e, "id", "Capa_1"), nt(e, "xmlns", "http://www.w3.org/2000/svg"), nt(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), nt(e, "width", "100%"), nt(e, "height", "100%"), nt(e, "viewBox", "0 0 360 360"), nt(e, "color", "#9CA3AF");
    },
    m(a, l) {
      T_(a, e, l), li(e, n), li(n, i), li(i, o), li(i, r), li(i, s);
    },
    p: fr,
    i: fr,
    o: fr,
    d(a) {
      a && S_(e);
    }
  };
}
class R_ extends C_ {
  constructor(e) {
    super(), A_(this, e, null, P_, L_, {});
  }
}
function be(t, e, n, i) {
  return new (n || (n = Promise))(function(o, r) {
    function s(u) {
      try {
        l(i.next(u));
      } catch (c) {
        r(c);
      }
    }
    function a(u) {
      try {
        l(i.throw(u));
      } catch (c) {
        r(c);
      }
    }
    function l(u) {
      var c;
      u.done ? o(u.value) : (c = u.value, c instanceof n ? c : new n(function(f) {
        f(c);
      })).then(s, a);
    }
    l((i = i.apply(t, e || [])).next());
  });
}
let Si = class {
  constructor() {
    this.listeners = {};
  }
  on(e, n, i) {
    if (this.listeners[e] || (this.listeners[e] = /* @__PURE__ */ new Set()), this.listeners[e].add(n), i == null ? void 0 : i.once) {
      const o = () => {
        this.un(e, o), this.un(e, n);
      };
      return this.on(e, o), o;
    }
    return () => this.un(e, n);
  }
  un(e, n) {
    var i;
    (i = this.listeners[e]) === null || i === void 0 || i.delete(n);
  }
  once(e, n) {
    return this.on(e, n, { once: !0 });
  }
  unAll() {
    this.listeners = {};
  }
  emit(e, ...n) {
    this.listeners[e] && this.listeners[e].forEach((i) => i(...n));
  }
};
const xs = { decode: function(t, e) {
  return be(this, void 0, void 0, function* () {
    const n = new AudioContext({ sampleRate: e });
    return n.decodeAudioData(t).finally(() => n.close());
  });
}, createBuffer: function(t, e) {
  return typeof t[0] == "number" && (t = [t]), function(n) {
    const i = n[0];
    if (i.some((o) => o > 1 || o < -1)) {
      const o = i.length;
      let r = 0;
      for (let s = 0; s < o; s++) {
        const a = Math.abs(i[s]);
        a > r && (r = a);
      }
      for (const s of n)
        for (let a = 0; a < o; a++)
          s[a] /= r;
    }
  }(t), { duration: e, length: t[0].length, sampleRate: t[0].length / e, numberOfChannels: t.length, getChannelData: (n) => t == null ? void 0 : t[n], copyFromChannel: AudioBuffer.prototype.copyFromChannel, copyToChannel: AudioBuffer.prototype.copyToChannel };
} };
function Qa(t, e) {
  const n = e.xmlns ? document.createElementNS(e.xmlns, t) : document.createElement(t);
  for (const [i, o] of Object.entries(e))
    if (i === "children")
      for (const [r, s] of Object.entries(e))
        typeof s == "string" ? n.appendChild(document.createTextNode(s)) : n.appendChild(Qa(r, s));
    else
      i === "style" ? Object.assign(n.style, o) : i === "textContent" ? n.textContent = o : n.setAttribute(i, o.toString());
  return n;
}
function Js(t, e, n) {
  const i = Qa(t, e || {});
  return n == null || n.appendChild(i), i;
}
var B_ = Object.freeze({ __proto__: null, createElement: Js, default: Js });
const M_ = { fetchBlob: function(t, e, n) {
  return be(this, void 0, void 0, function* () {
    const i = yield fetch(t, n);
    if (i.status >= 400)
      throw new Error(`Failed to fetch ${t}: ${i.status} (${i.statusText})`);
    return function(o, r) {
      be(this, void 0, void 0, function* () {
        if (!o.body || !o.headers)
          return;
        const s = o.body.getReader(), a = Number(o.headers.get("Content-Length")) || 0;
        let l = 0;
        const u = (f) => be(this, void 0, void 0, function* () {
          l += (f == null ? void 0 : f.length) || 0;
          const h = Math.round(l / a * 100);
          r(h);
        }), c = () => be(this, void 0, void 0, function* () {
          let f;
          try {
            f = yield s.read();
          } catch {
            return;
          }
          f.done || (u(f.value), yield c());
        });
        c();
      });
    }(i.clone(), e), i.blob();
  });
} };
class D_ extends Si {
  constructor(e) {
    super(), this.isExternalMedia = !1, e.media ? (this.media = e.media, this.isExternalMedia = !0) : this.media = document.createElement("audio"), e.mediaControls && (this.media.controls = !0), e.autoplay && (this.media.autoplay = !0), e.playbackRate != null && this.onMediaEvent("canplay", () => {
      e.playbackRate != null && (this.media.playbackRate = e.playbackRate);
    }, { once: !0 });
  }
  onMediaEvent(e, n, i) {
    return this.media.addEventListener(e, n, i), () => this.media.removeEventListener(e, n, i);
  }
  getSrc() {
    return this.media.currentSrc || this.media.src || "";
  }
  revokeSrc() {
    const e = this.getSrc();
    e.startsWith("blob:") && URL.revokeObjectURL(e);
  }
  canPlayType(e) {
    return this.media.canPlayType(e) !== "";
  }
  setSrc(e, n) {
    if (this.getSrc() === e)
      return;
    this.revokeSrc();
    const i = n instanceof Blob && this.canPlayType(n.type) ? URL.createObjectURL(n) : e;
    this.media.src = i;
  }
  destroy() {
    this.media.pause(), this.isExternalMedia || (this.media.remove(), this.revokeSrc(), this.media.src = "", this.media.load());
  }
  setMediaElement(e) {
    this.media = e;
  }
  play() {
    return be(this, void 0, void 0, function* () {
      return this.media.play();
    });
  }
  pause() {
    this.media.pause();
  }
  isPlaying() {
    return !this.media.paused && !this.media.ended;
  }
  setTime(e) {
    this.media.currentTime = e;
  }
  getDuration() {
    return this.media.duration;
  }
  getCurrentTime() {
    return this.media.currentTime;
  }
  getVolume() {
    return this.media.volume;
  }
  setVolume(e) {
    this.media.volume = e;
  }
  getMuted() {
    return this.media.muted;
  }
  setMuted(e) {
    this.media.muted = e;
  }
  getPlaybackRate() {
    return this.media.playbackRate;
  }
  isSeeking() {
    return this.media.seeking;
  }
  setPlaybackRate(e, n) {
    n != null && (this.media.preservesPitch = n), this.media.playbackRate = e;
  }
  getMediaElement() {
    return this.media;
  }
  setSinkId(e) {
    return this.media.setSinkId(e);
  }
}
class wo extends Si {
  constructor(e, n) {
    super(), this.timeouts = [], this.isScrollable = !1, this.audioData = null, this.resizeObserver = null, this.lastContainerWidth = 0, this.isDragging = !1, this.subscriptions = [], this.subscriptions = [], this.options = e;
    const i = this.parentFromOptionsContainer(e.container);
    this.parent = i;
    const [o, r] = this.initHtml();
    i.appendChild(o), this.container = o, this.scrollContainer = r.querySelector(".scroll"), this.wrapper = r.querySelector(".wrapper"), this.canvasWrapper = r.querySelector(".canvases"), this.progressWrapper = r.querySelector(".progress"), this.cursor = r.querySelector(".cursor"), n && r.appendChild(n), this.initEvents();
  }
  parentFromOptionsContainer(e) {
    let n;
    if (typeof e == "string" ? n = document.querySelector(e) : e instanceof HTMLElement && (n = e), !n)
      throw new Error("Container not found");
    return n;
  }
  initEvents() {
    const e = (i) => {
      const o = this.wrapper.getBoundingClientRect(), r = i.clientX - o.left, s = i.clientY - o.top;
      return [r / o.width, s / o.height];
    };
    this.wrapper.addEventListener("click", (i) => {
      const [o, r] = e(i);
      this.emit("click", o, r);
    }), this.wrapper.addEventListener("dblclick", (i) => {
      const [o, r] = e(i);
      this.emit("dblclick", o, r);
    }), this.options.dragToSeek !== !0 && typeof this.options.dragToSeek != "object" || this.initDrag(), this.scrollContainer.addEventListener("scroll", () => {
      const { scrollLeft: i, scrollWidth: o, clientWidth: r } = this.scrollContainer, s = i / o, a = (i + r) / o;
      this.emit("scroll", s, a);
    });
    const n = this.createDelay(100);
    this.resizeObserver = new ResizeObserver(() => {
      n().then(() => this.onContainerResize()).catch(() => {
      });
    }), this.resizeObserver.observe(this.scrollContainer);
  }
  onContainerResize() {
    const e = this.parent.clientWidth;
    e === this.lastContainerWidth && this.options.height !== "auto" || (this.lastContainerWidth = e, this.reRender());
  }
  initDrag() {
    this.subscriptions.push(function(e, n, i, o, r = 3, s = 0, a = 100) {
      if (!e)
        return () => {
        };
      const l = matchMedia("(pointer: coarse)").matches;
      let u = () => {
      };
      const c = (f) => {
        if (f.button !== s)
          return;
        f.preventDefault(), f.stopPropagation();
        let h = f.clientX, d = f.clientY, _ = !1;
        const m = Date.now(), v = (T) => {
          if (T.preventDefault(), T.stopPropagation(), l && Date.now() - m < a)
            return;
          const y = T.clientX, O = T.clientY, P = y - h, A = O - d;
          if (_ || Math.abs(P) > r || Math.abs(A) > r) {
            const R = e.getBoundingClientRect(), { left: z, top: X } = R;
            _ || (i == null || i(h - z, d - X), _ = !0), n(P, A, y - z, O - X), h = y, d = O;
          }
        }, p = (T) => {
          if (_) {
            const y = T.clientX, O = T.clientY, P = e.getBoundingClientRect(), { left: A, top: R } = P;
            o == null || o(y - A, O - R);
          }
          u();
        }, k = (T) => {
          T.relatedTarget && T.relatedTarget !== document.documentElement || p(T);
        }, w = (T) => {
          _ && (T.stopPropagation(), T.preventDefault());
        }, C = (T) => {
          _ && T.preventDefault();
        };
        document.addEventListener("pointermove", v), document.addEventListener("pointerup", p), document.addEventListener("pointerout", k), document.addEventListener("pointercancel", k), document.addEventListener("touchmove", C, { passive: !1 }), document.addEventListener("click", w, { capture: !0 }), u = () => {
          document.removeEventListener("pointermove", v), document.removeEventListener("pointerup", p), document.removeEventListener("pointerout", k), document.removeEventListener("pointercancel", k), document.removeEventListener("touchmove", C), setTimeout(() => {
            document.removeEventListener("click", w, { capture: !0 });
          }, 10);
        };
      };
      return e.addEventListener("pointerdown", c), () => {
        u(), e.removeEventListener("pointerdown", c);
      };
    }(this.wrapper, (e, n, i) => {
      this.emit("drag", Math.max(0, Math.min(1, i / this.wrapper.getBoundingClientRect().width)));
    }, (e) => {
      this.isDragging = !0, this.emit("dragstart", Math.max(0, Math.min(1, e / this.wrapper.getBoundingClientRect().width)));
    }, (e) => {
      this.isDragging = !1, this.emit("dragend", Math.max(0, Math.min(1, e / this.wrapper.getBoundingClientRect().width)));
    }));
  }
  getHeight(e, n) {
    var i;
    const o = ((i = this.audioData) === null || i === void 0 ? void 0 : i.numberOfChannels) || 1;
    if (e == null)
      return 128;
    if (!isNaN(Number(e)))
      return Number(e);
    if (e === "auto") {
      const r = this.parent.clientHeight || 128;
      return n != null && n.every((s) => !s.overlay) ? r / o : r;
    }
    return 128;
  }
  initHtml() {
    const e = document.createElement("div"), n = e.attachShadow({ mode: "open" });
    return n.innerHTML = `
      <style>
        :host {
          user-select: none;
          min-width: 1px;
        }
        :host audio {
          display: block;
          width: 100%;
        }
        :host .scroll {
          overflow-x: auto;
          overflow-y: hidden;
          width: 100%;
          position: relative;
        }
        :host .noScrollbar {
          scrollbar-color: transparent;
          scrollbar-width: none;
        }
        :host .noScrollbar::-webkit-scrollbar {
          display: none;
          -webkit-appearance: none;
        }
        :host .wrapper {
          position: relative;
          overflow: visible;
          z-index: 2;
        }
        :host .canvases {
          min-height: ${this.getHeight(this.options.height, this.options.splitChannels)}px;
        }
        :host .canvases > div {
          position: relative;
        }
        :host canvas {
          display: block;
          position: absolute;
          top: 0;
          image-rendering: pixelated;
        }
        :host .progress {
          pointer-events: none;
          position: absolute;
          z-index: 2;
          top: 0;
          left: 0;
          width: 0;
          height: 100%;
          overflow: hidden;
        }
        :host .progress > div {
          position: relative;
        }
        :host .cursor {
          pointer-events: none;
          position: absolute;
          z-index: 5;
          top: 0;
          left: 0;
          height: 100%;
          border-radius: 2px;
        }
      </style>

      <div class="scroll" part="scroll">
        <div class="wrapper" part="wrapper">
          <div class="canvases" part="canvases"></div>
          <div class="progress" part="progress"></div>
          <div class="cursor" part="cursor"></div>
        </div>
      </div>
    `, [e, n];
  }
  setOptions(e) {
    if (this.options.container !== e.container) {
      const n = this.parentFromOptionsContainer(e.container);
      n.appendChild(this.container), this.parent = n;
    }
    e.dragToSeek !== !0 && typeof this.options.dragToSeek != "object" || this.initDrag(), this.options = e, this.reRender();
  }
  getWrapper() {
    return this.wrapper;
  }
  getScroll() {
    return this.scrollContainer.scrollLeft;
  }
  setScroll(e) {
    this.scrollContainer.scrollLeft = e;
  }
  setScrollPercentage(e) {
    const { scrollWidth: n } = this.scrollContainer, i = n * e;
    this.setScroll(i);
  }
  destroy() {
    var e;
    this.subscriptions.forEach((n) => n()), this.container.remove(), (e = this.resizeObserver) === null || e === void 0 || e.disconnect();
  }
  createDelay(e = 10) {
    let n, i;
    const o = () => {
      n && clearTimeout(n), i && i();
    };
    return this.timeouts.push(o), () => new Promise((r, s) => {
      o(), i = s, n = setTimeout(() => {
        n = void 0, i = void 0, r();
      }, e);
    });
  }
  convertColorValues(e) {
    if (!Array.isArray(e))
      return e || "";
    if (e.length < 2)
      return e[0] || "";
    const n = document.createElement("canvas"), i = n.getContext("2d"), o = n.height * (window.devicePixelRatio || 1), r = i.createLinearGradient(0, 0, 0, o), s = 1 / (e.length - 1);
    return e.forEach((a, l) => {
      const u = l * s;
      r.addColorStop(u, a);
    }), r;
  }
  renderBarWaveform(e, n, i, o) {
    const r = e[0], s = e[1] || e[0], a = r.length, { width: l, height: u } = i.canvas, c = u / 2, f = window.devicePixelRatio || 1, h = n.barWidth ? n.barWidth * f : 1, d = n.barGap ? n.barGap * f : n.barWidth ? h / 2 : 0, _ = n.barRadius || 0, m = l / (h + d) / a, v = _ && "roundRect" in i ? "roundRect" : "rect";
    i.beginPath();
    let p = 0, k = 0, w = 0;
    for (let C = 0; C <= a; C++) {
      const T = Math.round(C * m);
      if (T > p) {
        const P = Math.round(k * c * o), A = P + Math.round(w * c * o) || 1;
        let R = c - P;
        n.barAlign === "top" ? R = 0 : n.barAlign === "bottom" && (R = u - A), i[v](p * (h + d), R, h, A, _), p = T, k = 0, w = 0;
      }
      const y = Math.abs(r[C] || 0), O = Math.abs(s[C] || 0);
      y > k && (k = y), O > w && (w = O);
    }
    i.fill(), i.closePath();
  }
  renderLineWaveform(e, n, i, o) {
    const r = (s) => {
      const a = e[s] || e[0], l = a.length, { height: u } = i.canvas, c = u / 2, f = i.canvas.width / l;
      i.moveTo(0, c);
      let h = 0, d = 0;
      for (let _ = 0; _ <= l; _++) {
        const m = Math.round(_ * f);
        if (m > h) {
          const p = c + (Math.round(d * c * o) || 1) * (s === 0 ? -1 : 1);
          i.lineTo(h, p), h = m, d = 0;
        }
        const v = Math.abs(a[_] || 0);
        v > d && (d = v);
      }
      i.lineTo(h, c);
    };
    i.beginPath(), r(0), r(1), i.fill(), i.closePath();
  }
  renderWaveform(e, n, i) {
    if (i.fillStyle = this.convertColorValues(n.waveColor), n.renderFunction)
      return void n.renderFunction(e, i);
    let o = n.barHeight || 1;
    if (n.normalize) {
      const r = Array.from(e[0]).reduce((s, a) => Math.max(s, Math.abs(a)), 0);
      o = r ? 1 / r : 1;
    }
    n.barWidth || n.barGap || n.barAlign ? this.renderBarWaveform(e, n, i, o) : this.renderLineWaveform(e, n, i, o);
  }
  renderSingleCanvas(e, n, i, o, r, s, a) {
    const l = window.devicePixelRatio || 1, u = document.createElement("canvas");
    u.width = Math.round(i * l), u.height = Math.round(o * l), u.style.width = `${i}px`, u.style.height = `${o}px`, u.style.left = `${Math.round(r)}px`, s.appendChild(u);
    const c = u.getContext("2d");
    if (this.renderWaveform(e, n, c), u.width > 0 && u.height > 0) {
      const f = u.cloneNode(), h = f.getContext("2d");
      h.drawImage(u, 0, 0), h.globalCompositeOperation = "source-in", h.fillStyle = this.convertColorValues(n.progressColor), h.fillRect(0, 0, u.width, u.height), a.appendChild(f);
    }
  }
  renderMultiCanvas(e, n, i, o, r, s) {
    return be(this, void 0, void 0, function* () {
      const a = window.devicePixelRatio || 1, l = i / a;
      let u = Math.min(wo.MAX_CANVAS_WIDTH, this.scrollContainer.clientWidth);
      if (n.barWidth || n.barGap) {
        const _ = n.barWidth || 0.5, m = _ + (n.barGap || _ / 2);
        u % m != 0 && (u = Math.floor(u / m) * m);
      }
      const c = (_) => {
        const m = _ * u, v = Math.min(l - m, u), p = e.map((k) => {
          const w = Math.floor(m / l * k.length), C = Math.floor((m + v) / l * k.length);
          return k.slice(w, C);
        });
        this.renderSingleCanvas(p, n, v, o, m, r, s);
      }, f = Math.ceil(l / u);
      if (f === 1)
        return void c(0);
      const h = this.scrollContainer.scrollLeft / l, d = Math.floor(h * f);
      c(d), c(d + 1), yield Promise.all([be(this, void 0, void 0, function* () {
        const _ = this.createDelay();
        for (let m = d - 1; m >= 0; m--)
          yield _(), c(m);
      }), be(this, void 0, void 0, function* () {
        const _ = this.createDelay();
        for (let m = d + 2; m < f; m++)
          yield _(), c(m);
      })]);
    });
  }
  renderChannel(e, n, i, o) {
    return be(this, void 0, void 0, function* () {
      var { overlay: r } = n, s = function(c, f) {
        var h = {};
        for (var d in c)
          Object.prototype.hasOwnProperty.call(c, d) && f.indexOf(d) < 0 && (h[d] = c[d]);
        if (c != null && typeof Object.getOwnPropertySymbols == "function") {
          var _ = 0;
          for (d = Object.getOwnPropertySymbols(c); _ < d.length; _++)
            f.indexOf(d[_]) < 0 && Object.prototype.propertyIsEnumerable.call(c, d[_]) && (h[d[_]] = c[d[_]]);
        }
        return h;
      }(n, ["overlay"]);
      const a = document.createElement("div"), l = this.getHeight(s.height, s.splitChannels);
      a.style.height = `${l}px`, r && o > 0 && (a.style.marginTop = `-${l}px`), this.canvasWrapper.style.minHeight = `${l}px`, this.canvasWrapper.appendChild(a);
      const u = a.cloneNode();
      this.progressWrapper.appendChild(u), yield this.renderMultiCanvas(e, s, i, l, a, u);
    });
  }
  render(e) {
    return be(this, void 0, void 0, function* () {
      this.timeouts.forEach((a) => a()), this.timeouts = [], this.canvasWrapper.innerHTML = "", this.progressWrapper.innerHTML = "", this.options.width != null && (this.scrollContainer.style.width = typeof this.options.width == "number" ? `${this.options.width}px` : this.options.width);
      const n = window.devicePixelRatio || 1, i = this.scrollContainer.clientWidth, o = Math.ceil(e.duration * (this.options.minPxPerSec || 0));
      this.isScrollable = o > i;
      const r = this.options.fillParent && !this.isScrollable, s = (r ? i : o) * n;
      this.wrapper.style.width = r ? "100%" : `${o}px`, this.scrollContainer.style.overflowX = this.isScrollable ? "auto" : "hidden", this.scrollContainer.classList.toggle("noScrollbar", !!this.options.hideScrollbar), this.cursor.style.backgroundColor = `${this.options.cursorColor || this.options.progressColor}`, this.cursor.style.width = `${this.options.cursorWidth}px`, this.audioData = e, this.emit("render");
      try {
        if (this.options.splitChannels)
          yield Promise.all(Array.from({ length: e.numberOfChannels }).map((a, l) => {
            var u;
            const c = Object.assign(Object.assign({}, this.options), (u = this.options.splitChannels) === null || u === void 0 ? void 0 : u[l]);
            return this.renderChannel([e.getChannelData(l)], c, s, l);
          }));
        else {
          const a = [e.getChannelData(0)];
          e.numberOfChannels > 1 && a.push(e.getChannelData(1)), yield this.renderChannel(a, this.options, s, 0);
        }
      } catch {
        return;
      }
      this.emit("rendered");
    });
  }
  reRender() {
    if (!this.audioData)
      return;
    const { scrollWidth: e } = this.scrollContainer, { right: n } = this.progressWrapper.getBoundingClientRect();
    if (this.render(this.audioData), this.isScrollable && e !== this.scrollContainer.scrollWidth) {
      const { right: i } = this.progressWrapper.getBoundingClientRect();
      let o = i - n;
      o *= 2, o = o < 0 ? Math.floor(o) : Math.ceil(o), o /= 2, this.scrollContainer.scrollLeft += o;
    }
  }
  zoom(e) {
    this.options.minPxPerSec = e, this.reRender();
  }
  scrollIntoView(e, n = !1) {
    const { scrollLeft: i, scrollWidth: o, clientWidth: r } = this.scrollContainer, s = e * o, a = i, l = i + r, u = r / 2;
    if (this.isDragging)
      s + 30 > l ? this.scrollContainer.scrollLeft += 30 : s - 30 < a && (this.scrollContainer.scrollLeft -= 30);
    else {
      (s < a || s > l) && (this.scrollContainer.scrollLeft = s - (this.options.autoCenter ? u : 0));
      const c = s - i - u;
      n && this.options.autoCenter && c > 0 && (this.scrollContainer.scrollLeft += Math.min(c, 10));
    }
    {
      const c = this.scrollContainer.scrollLeft, f = c / o, h = (c + r) / o;
      this.emit("scroll", f, h);
    }
  }
  renderProgress(e, n) {
    if (isNaN(e))
      return;
    const i = 100 * e;
    this.canvasWrapper.style.clipPath = `polygon(${i}% 0, 100% 0, 100% 100%, ${i}% 100%)`, this.progressWrapper.style.width = `${i}%`, this.cursor.style.left = `${i}%`, this.cursor.style.transform = `translateX(-${Math.round(i) === 100 ? this.options.cursorWidth : 0}px)`, this.isScrollable && this.options.autoScroll && this.scrollIntoView(e, n);
  }
  exportImage(e, n, i) {
    return be(this, void 0, void 0, function* () {
      const o = this.canvasWrapper.querySelectorAll("canvas");
      if (!o.length)
        throw new Error("No waveform data");
      if (i === "dataURL") {
        const r = Array.from(o).map((s) => s.toDataURL(e, n));
        return Promise.resolve(r);
      }
      return Promise.all(Array.from(o).map((r) => new Promise((s, a) => {
        r.toBlob((l) => {
          l ? s(l) : a(new Error("Could not export image"));
        }, e, n);
      })));
    });
  }
}
wo.MAX_CANVAS_WIDTH = 4e3;
class O_ extends Si {
  constructor() {
    super(...arguments), this.unsubscribe = () => {
    };
  }
  start() {
    this.unsubscribe = this.on("tick", () => {
      requestAnimationFrame(() => {
        this.emit("tick");
      });
    }), this.emit("tick");
  }
  stop() {
    this.unsubscribe();
  }
  destroy() {
    this.unsubscribe();
  }
}
class Ys extends Si {
  constructor(e = new AudioContext()) {
    super(), this.bufferNode = null, this.playStartTime = 0, this.playedDuration = 0, this._muted = !1, this._playbackRate = 1, this._duration = void 0, this.buffer = null, this.currentSrc = "", this.paused = !0, this.crossOrigin = null, this.seeking = !1, this.autoplay = !1, this.addEventListener = this.on, this.removeEventListener = this.un, this.audioContext = e, this.gainNode = this.audioContext.createGain(), this.gainNode.connect(this.audioContext.destination);
  }
  load() {
    return be(this, void 0, void 0, function* () {
    });
  }
  get src() {
    return this.currentSrc;
  }
  set src(e) {
    if (this.currentSrc = e, this._duration = void 0, !e)
      return this.buffer = null, void this.emit("emptied");
    fetch(e).then((n) => {
      if (n.status >= 400)
        throw new Error(`Failed to fetch ${e}: ${n.status} (${n.statusText})`);
      return n.arrayBuffer();
    }).then((n) => this.currentSrc !== e ? null : this.audioContext.decodeAudioData(n)).then((n) => {
      this.currentSrc === e && (this.buffer = n, this.emit("loadedmetadata"), this.emit("canplay"), this.autoplay && this.play());
    });
  }
  _play() {
    var e;
    if (!this.paused)
      return;
    this.paused = !1, (e = this.bufferNode) === null || e === void 0 || e.disconnect(), this.bufferNode = this.audioContext.createBufferSource(), this.buffer && (this.bufferNode.buffer = this.buffer), this.bufferNode.playbackRate.value = this._playbackRate, this.bufferNode.connect(this.gainNode);
    let n = this.playedDuration * this._playbackRate;
    n >= this.duration && (n = 0, this.playedDuration = 0), this.bufferNode.start(this.audioContext.currentTime, n), this.playStartTime = this.audioContext.currentTime, this.bufferNode.onended = () => {
      this.currentTime >= this.duration && (this.pause(), this.emit("ended"));
    };
  }
  _pause() {
    var e;
    this.paused = !0, (e = this.bufferNode) === null || e === void 0 || e.stop(), this.playedDuration += this.audioContext.currentTime - this.playStartTime;
  }
  play() {
    return be(this, void 0, void 0, function* () {
      this.paused && (this._play(), this.emit("play"));
    });
  }
  pause() {
    this.paused || (this._pause(), this.emit("pause"));
  }
  stopAt(e) {
    var n, i;
    const o = e - this.currentTime;
    (n = this.bufferNode) === null || n === void 0 || n.stop(this.audioContext.currentTime + o), (i = this.bufferNode) === null || i === void 0 || i.addEventListener("ended", () => {
      this.bufferNode = null, this.pause();
    }, { once: !0 });
  }
  setSinkId(e) {
    return be(this, void 0, void 0, function* () {
      return this.audioContext.setSinkId(e);
    });
  }
  get playbackRate() {
    return this._playbackRate;
  }
  set playbackRate(e) {
    this._playbackRate = e, this.bufferNode && (this.bufferNode.playbackRate.value = e);
  }
  get currentTime() {
    return (this.paused ? this.playedDuration : this.playedDuration + (this.audioContext.currentTime - this.playStartTime)) * this._playbackRate;
  }
  set currentTime(e) {
    const n = !this.paused;
    n && this._pause(), this.playedDuration = e / this._playbackRate, n && this._play(), this.emit("seeking"), this.emit("timeupdate");
  }
  get duration() {
    var e, n;
    return (e = this._duration) !== null && e !== void 0 ? e : ((n = this.buffer) === null || n === void 0 ? void 0 : n.duration) || 0;
  }
  set duration(e) {
    this._duration = e;
  }
  get volume() {
    return this.gainNode.gain.value;
  }
  set volume(e) {
    this.gainNode.gain.value = e, this.emit("volumechange");
  }
  get muted() {
    return this._muted;
  }
  set muted(e) {
    this._muted !== e && (this._muted = e, this._muted ? this.gainNode.disconnect() : this.gainNode.connect(this.audioContext.destination));
  }
  canPlayType(e) {
    return /^(audio|video)\//.test(e);
  }
  getGainNode() {
    return this.gainNode;
  }
  getChannelData() {
    const e = [];
    if (!this.buffer)
      return e;
    const n = this.buffer.numberOfChannels;
    for (let i = 0; i < n; i++)
      e.push(this.buffer.getChannelData(i));
    return e;
  }
}
const H_ = { waveColor: "#999", progressColor: "#555", cursorWidth: 1, minPxPerSec: 0, fillParent: !0, interact: !0, dragToSeek: !1, autoScroll: !0, autoCenter: !0, sampleRate: 8e3 };
class Ft extends D_ {
  static create(e) {
    return new Ft(e);
  }
  constructor(e) {
    const n = e.media || (e.backend === "WebAudio" ? new Ys() : void 0);
    super({ media: n, mediaControls: e.mediaControls, autoplay: e.autoplay, playbackRate: e.audioRate }), this.plugins = [], this.decodedData = null, this.subscriptions = [], this.mediaSubscriptions = [], this.abortController = null, this.options = Object.assign({}, H_, e), this.timer = new O_();
    const i = n ? void 0 : this.getMediaElement();
    this.renderer = new wo(this.options, i), this.initPlayerEvents(), this.initRendererEvents(), this.initTimerEvents(), this.initPlugins();
    const o = this.options.url || this.getSrc() || "";
    Promise.resolve().then(() => {
      this.emit("init");
      const { peaks: r, duration: s } = this.options;
      (o || r && s) && this.load(o, r, s).catch(() => null);
    });
  }
  updateProgress(e = this.getCurrentTime()) {
    return this.renderer.renderProgress(e / this.getDuration(), this.isPlaying()), e;
  }
  initTimerEvents() {
    this.subscriptions.push(this.timer.on("tick", () => {
      if (!this.isSeeking()) {
        const e = this.updateProgress();
        this.emit("timeupdate", e), this.emit("audioprocess", e);
      }
    }));
  }
  initPlayerEvents() {
    this.isPlaying() && (this.emit("play"), this.timer.start()), this.mediaSubscriptions.push(this.onMediaEvent("timeupdate", () => {
      const e = this.updateProgress();
      this.emit("timeupdate", e);
    }), this.onMediaEvent("play", () => {
      this.emit("play"), this.timer.start();
    }), this.onMediaEvent("pause", () => {
      this.emit("pause"), this.timer.stop();
    }), this.onMediaEvent("emptied", () => {
      this.timer.stop();
    }), this.onMediaEvent("ended", () => {
      this.emit("finish");
    }), this.onMediaEvent("seeking", () => {
      this.emit("seeking", this.getCurrentTime());
    }), this.onMediaEvent("error", (e) => {
      this.emit("error", e.error);
    }));
  }
  initRendererEvents() {
    this.subscriptions.push(this.renderer.on("click", (e, n) => {
      this.options.interact && (this.seekTo(e), this.emit("interaction", e * this.getDuration()), this.emit("click", e, n));
    }), this.renderer.on("dblclick", (e, n) => {
      this.emit("dblclick", e, n);
    }), this.renderer.on("scroll", (e, n) => {
      const i = this.getDuration();
      this.emit("scroll", e * i, n * i);
    }), this.renderer.on("render", () => {
      this.emit("redraw");
    }), this.renderer.on("rendered", () => {
      this.emit("redrawcomplete");
    }), this.renderer.on("dragstart", (e) => {
      this.emit("dragstart", e);
    }), this.renderer.on("dragend", (e) => {
      this.emit("dragend", e);
    }));
    {
      let e;
      this.subscriptions.push(this.renderer.on("drag", (n) => {
        if (!this.options.interact)
          return;
        let i;
        this.renderer.renderProgress(n), clearTimeout(e), this.isPlaying() ? i = 0 : this.options.dragToSeek === !0 ? i = 200 : typeof this.options.dragToSeek == "object" && this.options.dragToSeek !== void 0 && (i = this.options.dragToSeek.debounceTime), e = setTimeout(() => {
          this.seekTo(n);
        }, i), this.emit("interaction", n * this.getDuration()), this.emit("drag", n);
      }));
    }
  }
  initPlugins() {
    var e;
    !((e = this.options.plugins) === null || e === void 0) && e.length && this.options.plugins.forEach((n) => {
      this.registerPlugin(n);
    });
  }
  unsubscribePlayerEvents() {
    this.mediaSubscriptions.forEach((e) => e()), this.mediaSubscriptions = [];
  }
  setOptions(e) {
    this.options = Object.assign({}, this.options, e), this.renderer.setOptions(this.options), e.audioRate && this.setPlaybackRate(e.audioRate), e.mediaControls != null && (this.getMediaElement().controls = e.mediaControls);
  }
  registerPlugin(e) {
    return e._init(this), this.plugins.push(e), this.subscriptions.push(e.once("destroy", () => {
      this.plugins = this.plugins.filter((n) => n !== e);
    })), e;
  }
  getWrapper() {
    return this.renderer.getWrapper();
  }
  getScroll() {
    return this.renderer.getScroll();
  }
  setScroll(e) {
    return this.renderer.setScroll(e);
  }
  setScrollTime(e) {
    const n = e / this.getDuration();
    this.renderer.setScrollPercentage(n);
  }
  getActivePlugins() {
    return this.plugins;
  }
  loadAudio(e, n, i, o) {
    return be(this, void 0, void 0, function* () {
      var r;
      if (this.emit("load", e), !this.options.media && this.isPlaying() && this.pause(), this.decodedData = null, !n && !i) {
        const a = this.options.fetchParams || {};
        window.AbortController && !a.signal && (this.abortController = new AbortController(), a.signal = (r = this.abortController) === null || r === void 0 ? void 0 : r.signal);
        const l = (u) => this.emit("loading", u);
        n = yield M_.fetchBlob(e, l, a);
      }
      this.setSrc(e, n);
      const s = o || this.getDuration() || (yield new Promise((a) => {
        this.onMediaEvent("loadedmetadata", () => a(this.getDuration()), { once: !0 });
      }));
      if (!e && !n) {
        const a = this.getMediaElement();
        a instanceof Ys && (a.duration = s);
      }
      if (i)
        this.decodedData = xs.createBuffer(i, s || 0);
      else if (n) {
        const a = yield n.arrayBuffer();
        this.decodedData = yield xs.decode(a, this.options.sampleRate);
      }
      this.decodedData && (this.emit("decode", this.getDuration()), this.renderer.render(this.decodedData)), this.emit("ready", this.getDuration());
    });
  }
  load(e, n, i) {
    return be(this, void 0, void 0, function* () {
      try {
        return yield this.loadAudio(e, void 0, n, i);
      } catch (o) {
        throw this.emit("error", o), o;
      }
    });
  }
  loadBlob(e, n, i) {
    return be(this, void 0, void 0, function* () {
      try {
        return yield this.loadAudio("blob", e, n, i);
      } catch (o) {
        throw this.emit("error", o), o;
      }
    });
  }
  zoom(e) {
    if (!this.decodedData)
      throw new Error("No audio loaded");
    this.renderer.zoom(e), this.emit("zoom", e);
  }
  getDecodedData() {
    return this.decodedData;
  }
  exportPeaks({ channels: e = 2, maxLength: n = 8e3, precision: i = 1e4 } = {}) {
    if (!this.decodedData)
      throw new Error("The audio has not been decoded yet");
    const o = Math.min(e, this.decodedData.numberOfChannels), r = [];
    for (let s = 0; s < o; s++) {
      const a = this.decodedData.getChannelData(s), l = [], u = a.length / n;
      for (let c = 0; c < n; c++) {
        const f = a.slice(Math.floor(c * u), Math.ceil((c + 1) * u));
        let h = 0;
        for (let d = 0; d < f.length; d++) {
          const _ = f[d];
          Math.abs(_) > Math.abs(h) && (h = _);
        }
        l.push(Math.round(h * i) / i);
      }
      r.push(l);
    }
    return r;
  }
  getDuration() {
    let e = super.getDuration() || 0;
    return e !== 0 && e !== 1 / 0 || !this.decodedData || (e = this.decodedData.duration), e;
  }
  toggleInteraction(e) {
    this.options.interact = e;
  }
  setTime(e) {
    super.setTime(e), this.updateProgress(e), this.emit("timeupdate", e);
  }
  seekTo(e) {
    const n = this.getDuration() * e;
    this.setTime(n);
  }
  playPause() {
    return be(this, void 0, void 0, function* () {
      return this.isPlaying() ? this.pause() : this.play();
    });
  }
  stop() {
    this.pause(), this.setTime(0);
  }
  skip(e) {
    this.setTime(this.getCurrentTime() + e);
  }
  empty() {
    this.load("", [[0]], 1e-3);
  }
  setMediaElement(e) {
    this.unsubscribePlayerEvents(), super.setMediaElement(e), this.initPlayerEvents();
  }
  exportImage() {
    return be(this, arguments, void 0, function* (e = "image/png", n = 1, i = "dataURL") {
      return this.renderer.exportImage(e, n, i);
    });
  }
  destroy() {
    var e;
    this.emit("destroy"), (e = this.abortController) === null || e === void 0 || e.abort(), this.plugins.forEach((n) => n.destroy()), this.subscriptions.forEach((n) => n()), this.unsubscribePlayerEvents(), this.timer.destroy(), this.renderer.destroy(), super.destroy();
  }
}
Ft.BasePlugin = class extends Si {
  constructor(t) {
    super(), this.subscriptions = [], this.options = t;
  }
  onInit() {
  }
  _init(t) {
    this.wavesurfer = t, this.onInit();
  }
  destroy() {
    this.emit("destroy"), this.subscriptions.forEach((t) => t());
  }
}, Ft.dom = B_;
let Ka = class {
  constructor() {
    this.listeners = {};
  }
  on(e, n, i) {
    if (this.listeners[e] || (this.listeners[e] = /* @__PURE__ */ new Set()), this.listeners[e].add(n), i == null ? void 0 : i.once) {
      const o = () => {
        this.un(e, o), this.un(e, n);
      };
      return this.on(e, o), o;
    }
    return () => this.un(e, n);
  }
  un(e, n) {
    var i;
    (i = this.listeners[e]) === null || i === void 0 || i.delete(n);
  }
  once(e, n) {
    return this.on(e, n, { once: !0 });
  }
  unAll() {
    this.listeners = {};
  }
  emit(e, ...n) {
    this.listeners[e] && this.listeners[e].forEach((i) => i(...n));
  }
}, N_ = class extends Ka {
  constructor(e) {
    super(), this.subscriptions = [], this.options = e;
  }
  onInit() {
  }
  _init(e) {
    this.wavesurfer = e, this.onInit();
  }
  destroy() {
    this.emit("destroy"), this.subscriptions.forEach((e) => e());
  }
};
function $i(t, e, n, i, o = 3, r = 0, s = 100) {
  if (!t)
    return () => {
    };
  const a = matchMedia("(pointer: coarse)").matches;
  let l = () => {
  };
  const u = (c) => {
    if (c.button !== r)
      return;
    c.preventDefault(), c.stopPropagation();
    let f = c.clientX, h = c.clientY, d = !1;
    const _ = Date.now(), m = (C) => {
      if (C.preventDefault(), C.stopPropagation(), a && Date.now() - _ < s)
        return;
      const T = C.clientX, y = C.clientY, O = T - f, P = y - h;
      if (d || Math.abs(O) > o || Math.abs(P) > o) {
        const A = t.getBoundingClientRect(), { left: R, top: z } = A;
        d || (n == null || n(f - R, h - z), d = !0), e(O, P, T - R, y - z), f = T, h = y;
      }
    }, v = (C) => {
      if (d) {
        const T = C.clientX, y = C.clientY, O = t.getBoundingClientRect(), { left: P, top: A } = O;
        i == null || i(T - P, y - A);
      }
      l();
    }, p = (C) => {
      C.relatedTarget && C.relatedTarget !== document.documentElement || v(C);
    }, k = (C) => {
      d && (C.stopPropagation(), C.preventDefault());
    }, w = (C) => {
      d && C.preventDefault();
    };
    document.addEventListener("pointermove", m), document.addEventListener("pointerup", v), document.addEventListener("pointerout", p), document.addEventListener("pointercancel", p), document.addEventListener("touchmove", w, { passive: !1 }), document.addEventListener("click", k, { capture: !0 }), l = () => {
      document.removeEventListener("pointermove", m), document.removeEventListener("pointerup", v), document.removeEventListener("pointerout", p), document.removeEventListener("pointercancel", p), document.removeEventListener("touchmove", w), setTimeout(() => {
        document.removeEventListener("click", k, { capture: !0 });
      }, 10);
    };
  };
  return t.addEventListener("pointerdown", u), () => {
    l(), t.removeEventListener("pointerdown", u);
  };
}
function $a(t, e) {
  const n = e.xmlns ? document.createElementNS(e.xmlns, t) : document.createElement(t);
  for (const [i, o] of Object.entries(e))
    if (i === "children")
      for (const [r, s] of Object.entries(e))
        typeof s == "string" ? n.appendChild(document.createTextNode(s)) : n.appendChild($a(r, s));
    else
      i === "style" ? Object.assign(n.style, o) : i === "textContent" ? n.textContent = o : n.setAttribute(i, o.toString());
  return n;
}
function mi(t, e, n) {
  const i = $a(t, e || {});
  return n == null || n.appendChild(i), i;
}
let Qs = class extends Ka {
  constructor(e, n, i = 0) {
    var o, r, s, a, l, u, c, f;
    super(), this.totalDuration = n, this.numberOfChannels = i, this.minLength = 0, this.maxLength = 1 / 0, this.contentEditable = !1, this.subscriptions = [], this.subscriptions = [], this.id = e.id || `region-${Math.random().toString(32).slice(2)}`, this.start = this.clampPosition(e.start), this.end = this.clampPosition((o = e.end) !== null && o !== void 0 ? o : e.start), this.drag = (r = e.drag) === null || r === void 0 || r, this.resize = (s = e.resize) === null || s === void 0 || s, this.color = (a = e.color) !== null && a !== void 0 ? a : "rgba(0, 0, 0, 0.1)", this.minLength = (l = e.minLength) !== null && l !== void 0 ? l : this.minLength, this.maxLength = (u = e.maxLength) !== null && u !== void 0 ? u : this.maxLength, this.channelIdx = (c = e.channelIdx) !== null && c !== void 0 ? c : -1, this.contentEditable = (f = e.contentEditable) !== null && f !== void 0 ? f : this.contentEditable, this.element = this.initElement(), this.setContent(e.content), this.setPart(), this.renderPosition(), this.initMouseEvents();
  }
  clampPosition(e) {
    return Math.max(0, Math.min(this.totalDuration, e));
  }
  setPart() {
    const e = this.start === this.end;
    this.element.setAttribute("part", `${e ? "marker" : "region"} ${this.id}`);
  }
  addResizeHandles(e) {
    const n = { position: "absolute", zIndex: "2", width: "6px", height: "100%", top: "0", cursor: "ew-resize", wordBreak: "keep-all" }, i = mi("div", { part: "region-handle region-handle-left", style: Object.assign(Object.assign({}, n), { left: "0", borderLeft: "2px solid rgba(0, 0, 0, 0.5)", borderRadius: "2px 0 0 2px" }) }, e), o = mi("div", { part: "region-handle region-handle-right", style: Object.assign(Object.assign({}, n), { right: "0", borderRight: "2px solid rgba(0, 0, 0, 0.5)", borderRadius: "0 2px 2px 0" }) }, e);
    this.subscriptions.push($i(i, (r) => this.onResize(r, "start"), () => null, () => this.onEndResizing(), 1), $i(o, (r) => this.onResize(r, "end"), () => null, () => this.onEndResizing(), 1));
  }
  removeResizeHandles(e) {
    const n = e.querySelector('[part*="region-handle-left"]'), i = e.querySelector('[part*="region-handle-right"]');
    n && e.removeChild(n), i && e.removeChild(i);
  }
  initElement() {
    const e = this.start === this.end;
    let n = 0, i = 100;
    this.channelIdx >= 0 && this.channelIdx < this.numberOfChannels && (i = 100 / this.numberOfChannels, n = i * this.channelIdx);
    const o = mi("div", { style: { position: "absolute", top: `${n}%`, height: `${i}%`, backgroundColor: e ? "none" : this.color, borderLeft: e ? "2px solid " + this.color : "none", borderRadius: "2px", boxSizing: "border-box", transition: "background-color 0.2s ease", cursor: this.drag ? "grab" : "default", pointerEvents: "all" } });
    return !e && this.resize && this.addResizeHandles(o), o;
  }
  renderPosition() {
    const e = this.start / this.totalDuration, n = (this.totalDuration - this.end) / this.totalDuration;
    this.element.style.left = 100 * e + "%", this.element.style.right = 100 * n + "%";
  }
  toggleCursor(e) {
    var n;
    this.drag && (!((n = this.element) === null || n === void 0) && n.style) && (this.element.style.cursor = e ? "grabbing" : "grab");
  }
  initMouseEvents() {
    const { element: e } = this;
    e && (e.addEventListener("click", (n) => this.emit("click", n)), e.addEventListener("mouseenter", (n) => this.emit("over", n)), e.addEventListener("mouseleave", (n) => this.emit("leave", n)), e.addEventListener("dblclick", (n) => this.emit("dblclick", n)), e.addEventListener("pointerdown", () => this.toggleCursor(!0)), e.addEventListener("pointerup", () => this.toggleCursor(!1)), this.subscriptions.push($i(e, (n) => this.onMove(n), () => this.toggleCursor(!0), () => {
      this.toggleCursor(!1), this.drag && this.emit("update-end");
    })), this.contentEditable && this.content && (this.content.addEventListener("click", (n) => this.onContentClick(n)), this.content.addEventListener("blur", () => this.onContentBlur())));
  }
  _onUpdate(e, n) {
    if (!this.element.parentElement)
      return;
    const { width: i } = this.element.parentElement.getBoundingClientRect(), o = e / i * this.totalDuration, r = n && n !== "start" ? this.start : this.start + o, s = n && n !== "end" ? this.end : this.end + o, a = s - r;
    r >= 0 && s <= this.totalDuration && r <= s && a >= this.minLength && a <= this.maxLength && (this.start = r, this.end = s, this.renderPosition(), this.emit("update", n));
  }
  onMove(e) {
    this.drag && this._onUpdate(e);
  }
  onResize(e, n) {
    this.resize && this._onUpdate(e, n);
  }
  onEndResizing() {
    this.resize && this.emit("update-end");
  }
  onContentClick(e) {
    e.stopPropagation(), e.target.focus(), this.emit("click", e);
  }
  onContentBlur() {
    this.emit("update-end");
  }
  _setTotalDuration(e) {
    this.totalDuration = e, this.renderPosition();
  }
  play() {
    this.emit("play");
  }
  setContent(e) {
    var n;
    if ((n = this.content) === null || n === void 0 || n.remove(), e) {
      if (typeof e == "string") {
        const i = this.start === this.end;
        this.content = mi("div", { style: { padding: `0.2em ${i ? 0.2 : 0.4}em`, display: "inline-block" }, textContent: e });
      } else
        this.content = e;
      this.contentEditable && (this.content.contentEditable = "true"), this.content.setAttribute("part", "region-content"), this.element.appendChild(this.content);
    } else
      this.content = void 0;
  }
  setOptions(e) {
    var n, i;
    if (e.color && (this.color = e.color, this.element.style.backgroundColor = this.color), e.drag !== void 0 && (this.drag = e.drag, this.element.style.cursor = this.drag ? "grab" : "default"), e.start !== void 0 || e.end !== void 0) {
      const o = this.start === this.end;
      this.start = this.clampPosition((n = e.start) !== null && n !== void 0 ? n : this.start), this.end = this.clampPosition((i = e.end) !== null && i !== void 0 ? i : o ? this.start : this.end), this.renderPosition(), this.setPart();
    }
    if (e.content && this.setContent(e.content), e.id && (this.id = e.id, this.setPart()), e.resize !== void 0 && e.resize !== this.resize) {
      const o = this.start === this.end;
      this.resize = e.resize, this.resize && !o ? this.addResizeHandles(this.element) : this.removeResizeHandles(this.element);
    }
  }
  remove() {
    this.emit("remove"), this.subscriptions.forEach((e) => e()), this.element.remove(), this.element = null;
  }
}, I_ = class eu extends N_ {
  constructor(e) {
    super(e), this.regions = [], this.regionsContainer = this.initRegionsContainer();
  }
  static create(e) {
    return new eu(e);
  }
  onInit() {
    if (!this.wavesurfer)
      throw Error("WaveSurfer is not initialized");
    this.wavesurfer.getWrapper().appendChild(this.regionsContainer);
    let e = [];
    this.subscriptions.push(this.wavesurfer.on("timeupdate", (n) => {
      const i = this.regions.filter((o) => o.start <= n && (o.end === o.start ? o.start + 0.05 : o.end) >= n);
      i.forEach((o) => {
        e.includes(o) || this.emit("region-in", o);
      }), e.forEach((o) => {
        i.includes(o) || this.emit("region-out", o);
      }), e = i;
    }));
  }
  initRegionsContainer() {
    return mi("div", { style: { position: "absolute", top: "0", left: "0", width: "100%", height: "100%", zIndex: "3", pointerEvents: "none" } });
  }
  getRegions() {
    return this.regions;
  }
  avoidOverlapping(e) {
    e.content && setTimeout(() => {
      const n = e.content, i = n.getBoundingClientRect(), o = this.regions.map((r) => {
        if (r === e || !r.content)
          return 0;
        const s = r.content.getBoundingClientRect();
        return i.left < s.left + s.width && s.left < i.left + i.width ? s.height : 0;
      }).reduce((r, s) => r + s, 0);
      n.style.marginTop = `${o}px`;
    }, 10);
  }
  adjustScroll(e) {
    var n, i;
    const o = (i = (n = this.wavesurfer) === null || n === void 0 ? void 0 : n.getWrapper()) === null || i === void 0 ? void 0 : i.parentElement;
    if (!o)
      return;
    const { clientWidth: r, scrollWidth: s } = o;
    if (s <= r)
      return;
    const a = o.getBoundingClientRect(), l = e.element.getBoundingClientRect(), u = l.left - a.left, c = l.right - a.left;
    u < 0 ? o.scrollLeft += u : c > r && (o.scrollLeft += c - r);
  }
  saveRegion(e) {
    this.regionsContainer.appendChild(e.element), this.avoidOverlapping(e), this.regions.push(e);
    const n = [e.on("update", (i) => {
      i || this.adjustScroll(e);
    }), e.on("update-end", () => {
      this.avoidOverlapping(e), this.emit("region-updated", e);
    }), e.on("play", () => {
      var i, o;
      (i = this.wavesurfer) === null || i === void 0 || i.play(), (o = this.wavesurfer) === null || o === void 0 || o.setTime(e.start);
    }), e.on("click", (i) => {
      this.emit("region-clicked", e, i);
    }), e.on("dblclick", (i) => {
      this.emit("region-double-clicked", e, i);
    }), e.once("remove", () => {
      n.forEach((i) => i()), this.regions = this.regions.filter((i) => i !== e), this.emit("region-removed", e);
    })];
    this.subscriptions.push(...n), this.emit("region-created", e);
  }
  addRegion(e) {
    var n, i;
    if (!this.wavesurfer)
      throw Error("WaveSurfer is not initialized");
    const o = this.wavesurfer.getDuration(), r = (i = (n = this.wavesurfer) === null || n === void 0 ? void 0 : n.getDecodedData()) === null || i === void 0 ? void 0 : i.numberOfChannels, s = new Qs(e, o, r);
    return o ? this.saveRegion(s) : this.subscriptions.push(this.wavesurfer.once("ready", (a) => {
      s._setTotalDuration(a), this.saveRegion(s);
    })), s;
  }
  enableDragSelection(e, n = 3) {
    var i;
    const o = (i = this.wavesurfer) === null || i === void 0 ? void 0 : i.getWrapper();
    if (!(o && o instanceof HTMLElement))
      return () => {
      };
    let r = null, s = 0;
    return $i(o, (a, l, u) => {
      r && r._onUpdate(a, u > s ? "end" : "start");
    }, (a) => {
      var l, u;
      if (s = a, !this.wavesurfer)
        return;
      const c = this.wavesurfer.getDuration(), f = (u = (l = this.wavesurfer) === null || l === void 0 ? void 0 : l.getDecodedData()) === null || u === void 0 ? void 0 : u.numberOfChannels, { width: h } = this.wavesurfer.getWrapper().getBoundingClientRect(), d = a / h * c, _ = (a + 5) / h * c;
      r = new Qs(Object.assign(Object.assign({}, e), { start: d, end: _ }), c, f), this.regionsContainer.appendChild(r.element);
    }, () => {
      r && (this.saveRegion(r), r = null);
    }, n);
  }
  clearRegions() {
    this.regions.forEach((e) => e.remove());
  }
  destroy() {
    this.clearRegions(), super.destroy(), this.regionsContainer.remove();
  }
};
const {
  SvelteComponent: U_,
  append: j_,
  attr: Ot,
  detach: F_,
  init: q_,
  insert: z_,
  noop: dr,
  safe_not_equal: G_,
  svg_element: Ks
} = window.__gradio__svelte__internal;
function W_(t) {
  let e, n;
  return {
    c() {
      e = Ks("svg"), n = Ks("path"), Ot(n, "d", "m17.545 15.467-3.779-3.779a6.15 6.15 0 0 0 .898-3.21c0-3.417-2.961-6.377-6.378-6.377A6.185 6.185 0 0 0 2.1 8.287c0 3.416 2.961 6.377 6.377 6.377a6.15 6.15 0 0 0 3.115-.844l3.799 3.801a.953.953 0 0 0 1.346 0l.943-.943c.371-.371.236-.84-.135-1.211zM4.004 8.287a4.282 4.282 0 0 1 4.282-4.283c2.366 0 4.474 2.107 4.474 4.474a4.284 4.284 0 0 1-4.283 4.283c-2.366-.001-4.473-2.109-4.473-4.474z"), Ot(e, "version", "1.0"), Ot(e, "xmlns", "http://www.w3.org/2000/svg"), Ot(e, "viewBox", "0 0 20 20"), Ot(e, "id", "magnifier"), Ot(e, "width", "100%"), Ot(e, "height", "100%"), Ot(e, "color", "currentColor");
    },
    m(i, o) {
      z_(i, e, o), j_(e, n);
    },
    p: dr,
    i: dr,
    o: dr,
    d(i) {
      i && F_(e);
    }
  };
}
class V_ extends U_ {
  constructor(e) {
    super(), q_(this, e, null, W_, G_, {});
  }
}
function X_(t) {
  const e = t.numberOfChannels, n = t.length * e * 2 + 44, i = new ArrayBuffer(n), o = new DataView(i);
  let r = 0;
  const s = function(a, l, u) {
    for (let c = 0; c < u.length; c++)
      a.setUint8(l + c, u.charCodeAt(c));
  };
  s(o, r, "RIFF"), r += 4, o.setUint32(r, n - 8, !0), r += 4, s(o, r, "WAVE"), r += 4, s(o, r, "fmt "), r += 4, o.setUint32(r, 16, !0), r += 4, o.setUint16(r, 1, !0), r += 2, o.setUint16(r, e, !0), r += 2, o.setUint32(r, t.sampleRate, !0), r += 4, o.setUint32(r, t.sampleRate * 2 * e, !0), r += 4, o.setUint16(r, e * 2, !0), r += 2, o.setUint16(r, 16, !0), r += 2, s(o, r, "data"), r += 4, o.setUint32(r, t.length * e * 2, !0), r += 4;
  for (let a = 0; a < t.length; a++)
    for (let l = 0; l < e; l++) {
      const u = Math.max(
        -1,
        Math.min(1, t.getChannelData(l)[a])
      );
      o.setInt16(r, u * 32767, !0), r += 2;
    }
  return new Uint8Array(i);
}
const Z_ = async (t, e, n) => {
  const i = new AudioContext(), o = t.numberOfChannels, r = t.sampleRate;
  let s = t.length, a = 0;
  e && n && (a = Math.round(e * r), s = Math.round(n * r) - a);
  const l = i.createBuffer(
    o,
    s,
    r
  );
  for (let u = 0; u < o; u++) {
    const c = t.getChannelData(u), f = l.getChannelData(u);
    for (let h = 0; h < s; h++)
      f[h] = c[a + h];
  }
  return X_(l);
}, $s = (t, e) => {
  t && t.skip(e);
}, Rn = (t, e) => (e || (e = 5), t / 100 * e || 5), {
  SvelteComponent: x_,
  check_outros: J_,
  create_component: os,
  destroy_component: rs,
  detach: Y_,
  empty: Q_,
  group_outros: K_,
  init: $_,
  insert: e0,
  mount_component: ss,
  safe_not_equal: t0,
  transition_in: gi,
  transition_out: bi
} = window.__gradio__svelte__internal;
function n0(t) {
  let e, n;
  return e = new Vh({}), {
    c() {
      os(e.$$.fragment);
    },
    m(i, o) {
      ss(e, i, o), n = !0;
    },
    i(i) {
      n || (gi(e.$$.fragment, i), n = !0);
    },
    o(i) {
      bi(e.$$.fragment, i), n = !1;
    },
    d(i) {
      rs(e, i);
    }
  };
}
function i0(t) {
  let e, n;
  return e = new Ih({}), {
    c() {
      os(e.$$.fragment);
    },
    m(i, o) {
      ss(e, i, o), n = !0;
    },
    i(i) {
      n || (gi(e.$$.fragment, i), n = !0);
    },
    o(i) {
      bi(e.$$.fragment, i), n = !1;
    },
    d(i) {
      rs(e, i);
    }
  };
}
function o0(t) {
  let e, n;
  return e = new $h({}), {
    c() {
      os(e.$$.fragment);
    },
    m(i, o) {
      ss(e, i, o), n = !0;
    },
    i(i) {
      n || (gi(e.$$.fragment, i), n = !0);
    },
    o(i) {
      bi(e.$$.fragment, i), n = !1;
    },
    d(i) {
      rs(e, i);
    }
  };
}
function r0(t) {
  let e, n, i, o;
  const r = [o0, i0, n0], s = [];
  function a(l, u) {
    return (
      /*currentVolume*/
      l[0] == 0 ? 0 : (
        /*currentVolume*/
        l[0] < 0.5 ? 1 : (
          /*currentVolume*/
          l[0] >= 0.5 ? 2 : -1
        )
      )
    );
  }
  return ~(e = a(t)) && (n = s[e] = r[e](t)), {
    c() {
      n && n.c(), i = Q_();
    },
    m(l, u) {
      ~e && s[e].m(l, u), e0(l, i, u), o = !0;
    },
    p(l, [u]) {
      let c = e;
      e = a(l), e !== c && (n && (K_(), bi(s[c], 1, 1, () => {
        s[c] = null;
      }), J_()), ~e ? (n = s[e], n || (n = s[e] = r[e](l), n.c()), gi(n, 1), n.m(i.parentNode, i)) : n = null);
    },
    i(l) {
      o || (gi(n), o = !0);
    },
    o(l) {
      bi(n), o = !1;
    },
    d(l) {
      l && Y_(i), ~e && s[e].d(l);
    }
  };
}
function s0(t, e, n) {
  let { currentVolume: i } = e;
  return t.$$set = (o) => {
    "currentVolume" in o && n(0, i = o.currentVolume);
  }, [i];
}
class l0 extends x_ {
  constructor(e) {
    super(), $_(this, e, s0, r0, t0, { currentVolume: 0 });
  }
}
const {
  SvelteComponent: a0,
  attr: An,
  binding_callbacks: u0,
  detach: c0,
  element: f0,
  init: d0,
  insert: h0,
  listen: el,
  noop: tl,
  run_all: _0,
  safe_not_equal: m0
} = window.__gradio__svelte__internal, { onMount: p0 } = window.__gradio__svelte__internal;
function g0(t) {
  let e, n, i;
  return {
    c() {
      e = f0("input"), An(e, "id", "volume"), An(e, "class", "volume-slider svelte-1xy0951"), An(e, "type", "range"), An(e, "min", "0"), An(e, "max", "1"), An(e, "step", "0.01"), e.value = /*currentVolume*/
      t[0];
    },
    m(o, r) {
      h0(o, e, r), t[4](e), n || (i = [
        el(
          e,
          "focusout",
          /*focusout_handler*/
          t[5]
        ),
        el(
          e,
          "input",
          /*input_handler*/
          t[6]
        )
      ], n = !0);
    },
    p(o, [r]) {
      r & /*currentVolume*/
      1 && (e.value = /*currentVolume*/
      o[0]);
    },
    i: tl,
    o: tl,
    d(o) {
      o && c0(e), t[4](null), n = !1, _0(i);
    }
  };
}
function b0(t, e, n) {
  let { currentVolume: i = 1 } = e, { show_volume_slider: o = !1 } = e, { waveform: r } = e, s;
  p0(() => {
    a();
  });
  const a = () => {
    let f = s;
    f && (f.style.background = `linear-gradient(to right, var(--color-accent) ${i * 100}%, var(--neutral-400) ${i * 100}%)`);
  };
  function l(f) {
    u0[f ? "unshift" : "push"](() => {
      s = f, n(3, s);
    });
  }
  const u = () => n(1, o = !1), c = (f) => {
    f.target instanceof HTMLInputElement && (n(0, i = parseFloat(f.target.value)), r.setVolume(i));
  };
  return t.$$set = (f) => {
    "currentVolume" in f && n(0, i = f.currentVolume), "show_volume_slider" in f && n(1, o = f.show_volume_slider), "waveform" in f && n(2, r = f.waveform);
  }, t.$$.update = () => {
    t.$$.dirty & /*currentVolume*/
    1 && a();
  }, [
    i,
    o,
    r,
    s,
    l,
    u,
    c
  ];
}
class v0 extends a0 {
  constructor(e) {
    super(), d0(this, e, b0, g0, m0, {
      currentVolume: 0,
      show_volume_slider: 1,
      waveform: 2
    });
  }
}
const {
  SvelteComponent: w0,
  add_flush_callback: nl,
  append: ye,
  attr: ae,
  bind: il,
  binding_callbacks: ol,
  check_outros: rl,
  create_component: $t,
  destroy_component: en,
  detach: tu,
  element: Ze,
  group_outros: sl,
  init: y0,
  insert: nu,
  listen: pt,
  mount_component: tn,
  run_all: iu,
  safe_not_equal: k0,
  set_data: E0,
  set_input_value: ll,
  space: Xt,
  text: al,
  to_number: C0,
  toggle_class: ul,
  transition_in: Je,
  transition_out: rt
} = window.__gradio__svelte__internal, { onMount: S0 } = window.__gradio__svelte__internal;
function cl(t) {
  let e, n, i, o;
  function r(l) {
    t[13](l);
  }
  function s(l) {
    t[14](l);
  }
  let a = { waveform: (
    /*waveform*/
    t[2]
  ) };
  return (
    /*currentVolume*/
    t[8] !== void 0 && (a.currentVolume = /*currentVolume*/
    t[8]), /*show_volume_slider*/
    t[0] !== void 0 && (a.show_volume_slider = /*show_volume_slider*/
    t[0]), e = new v0({ props: a }), ol.push(() => il(e, "currentVolume", r)), ol.push(() => il(e, "show_volume_slider", s)), {
      c() {
        $t(e.$$.fragment);
      },
      m(l, u) {
        tn(e, l, u), o = !0;
      },
      p(l, u) {
        const c = {};
        u & /*waveform*/
        4 && (c.waveform = /*waveform*/
        l[2]), !n && u & /*currentVolume*/
        256 && (n = !0, c.currentVolume = /*currentVolume*/
        l[8], nl(() => n = !1)), !i && u & /*show_volume_slider*/
        1 && (i = !0, c.show_volume_slider = /*show_volume_slider*/
        l[0], nl(() => i = !1)), e.$set(c);
      },
      i(l) {
        o || (Je(e.$$.fragment, l), o = !0);
      },
      o(l) {
        rt(e.$$.fragment, l), o = !1;
      },
      d(l) {
        en(e, l);
      }
    }
  );
}
function fl(t) {
  let e, n, i;
  return {
    c() {
      e = Ze("input"), ae(e, "type", "range"), ae(e, "min", Ir), ae(e, "max", Ur), ae(e, "class", "svelte-sgfovr");
    },
    m(o, r) {
      nu(o, e, r), ll(
        e,
        /*currentZoom*/
        t[9]
      ), n || (i = [
        pt(
          e,
          "change",
          /*input_change_input_handler*/
          t[17]
        ),
        pt(
          e,
          "input",
          /*input_change_input_handler*/
          t[17]
        ),
        pt(
          e,
          "input",
          /*input_handler*/
          t[18]
        ),
        pt(
          e,
          "focusout",
          /*focusout_handler*/
          t[19]
        )
      ], n = !0);
    },
    p(o, r) {
      r & /*currentZoom*/
      512 && ll(
        e,
        /*currentZoom*/
        o[9]
      );
    },
    d(o) {
      o && tu(e), n = !1, iu(i);
    }
  };
}
function A0(t) {
  let e, n;
  return e = new ch({}), {
    c() {
      $t(e.$$.fragment);
    },
    m(i, o) {
      tn(e, i, o), n = !0;
    },
    i(i) {
      n || (Je(e.$$.fragment, i), n = !0);
    },
    o(i) {
      rt(e.$$.fragment, i), n = !1;
    },
    d(i) {
      en(e, i);
    }
  };
}
function T0(t) {
  let e, n;
  return e = new Va({}), {
    c() {
      $t(e.$$.fragment);
    },
    m(i, o) {
      tn(e, i, o), n = !0;
    },
    i(i) {
      n || (Je(e.$$.fragment, i), n = !0);
    },
    o(i) {
      rt(e.$$.fragment, i), n = !1;
    },
    d(i) {
      en(e, i);
    }
  };
}
function L0(t) {
  let e, n, i, o, r, s, a, l, u, c, f, h, d, _, m, v, p, k, w, C, T, y, O, P, A, R, z, X, F, J, E, V, N;
  o = new l0({
    props: { currentVolume: (
      /*currentVolume*/
      t[8]
    ) }
  });
  let U = (
    /*show_volume_slider*/
    t[0] && cl(t)
  );
  m = new V_({});
  let ee = (
    /*showZoomSlider*/
    t[1] && fl(t)
  );
  C = new ed({});
  const H = [T0, A0], Y = [];
  function se(g, L) {
    return (
      /*playing*/
      g[5] ? 0 : 1
    );
  }
  return P = se(t), A = Y[P] = H[P](t), F = new Rd({}), {
    c() {
      e = Ze("div"), n = Ze("div"), i = Ze("button"), $t(o.$$.fragment), r = Xt(), U && U.c(), s = Xt(), a = Ze("button"), l = Ze("span"), u = al(
        /*playbackSpeed*/
        t[7]
      ), c = al("x"), h = Xt(), d = Ze("div"), _ = Ze("button"), $t(m.$$.fragment), v = Xt(), ee && ee.c(), p = Xt(), k = Ze("div"), w = Ze("button"), $t(C.$$.fragment), y = Xt(), O = Ze("button"), A.c(), z = Xt(), X = Ze("button"), $t(F.$$.fragment), ae(i, "class", "action icon volume svelte-sgfovr"), ae(i, "aria-label", "Adjust volume"), ae(l, "class", "svelte-sgfovr"), ae(a, "class", "playback icon svelte-sgfovr"), ae(a, "aria-label", f = `Adjust playback speed to ${/*playbackSpeeds*/
      t[10][
        /*playbackSpeeds*/
        (t[10].indexOf(
          /*playbackSpeed*/
          t[7]
        ) + 1) % /*playbackSpeeds*/
        t[10].length
      ]}x`), ul(
        a,
        "hidden",
        /*show_volume_slider*/
        t[0]
      ), ae(_, "class", "zoom-button icon svelte-sgfovr"), ae(d, "class", "zoom-wrapper svelte-sgfovr"), ae(n, "class", "control-wrapper svelte-sgfovr"), ae(w, "class", "rewind icon svelte-sgfovr"), ae(w, "aria-label", T = `Skip backwards by ${Rn(
        /*audio_duration*/
        t[3],
        /*waveform_options*/
        t[6].skip_length
      )} seconds`), ae(O, "class", "play-pause-button icon svelte-sgfovr"), ae(O, "aria-label", R = /*playing*/
      t[5] ? (
        /*i18n*/
        t[4]("audio.pause")
      ) : (
        /*i18n*/
        t[4]("audio.play")
      )), ae(X, "class", "skip icon svelte-sgfovr"), ae(X, "aria-label", J = "Skip forward by " + Rn(
        /*audio_duration*/
        t[3],
        /*waveform_options*/
        t[6].skip_length
      ) + " seconds"), ae(k, "class", "play-pause-wrapper svelte-sgfovr"), ae(e, "class", "controls svelte-sgfovr"), ae(e, "data-testid", "waveform-controls");
    },
    m(g, L) {
      nu(g, e, L), ye(e, n), ye(n, i), tn(o, i, null), ye(n, r), U && U.m(n, null), ye(n, s), ye(n, a), ye(a, l), ye(l, u), ye(l, c), ye(n, h), ye(n, d), ye(d, _), tn(m, _, null), ye(d, v), ee && ee.m(d, null), ye(e, p), ye(e, k), ye(k, w), tn(C, w, null), ye(k, y), ye(k, O), Y[P].m(O, null), ye(k, z), ye(k, X), tn(F, X, null), E = !0, V || (N = [
        pt(
          i,
          "click",
          /*click_handler*/
          t[12]
        ),
        pt(
          a,
          "click",
          /*click_handler_1*/
          t[15]
        ),
        pt(
          _,
          "click",
          /*click_handler_2*/
          t[16]
        ),
        pt(
          w,
          "click",
          /*click_handler_3*/
          t[20]
        ),
        pt(
          O,
          "click",
          /*click_handler_4*/
          t[21]
        ),
        pt(
          X,
          "click",
          /*click_handler_5*/
          t[22]
        )
      ], V = !0);
    },
    p(g, [L]) {
      const G = {};
      L & /*currentVolume*/
      256 && (G.currentVolume = /*currentVolume*/
      g[8]), o.$set(G), /*show_volume_slider*/
      g[0] ? U ? (U.p(g, L), L & /*show_volume_slider*/
      1 && Je(U, 1)) : (U = cl(g), U.c(), Je(U, 1), U.m(n, s)) : U && (sl(), rt(U, 1, 1, () => {
        U = null;
      }), rl()), (!E || L & /*playbackSpeed*/
      128) && E0(
        u,
        /*playbackSpeed*/
        g[7]
      ), (!E || L & /*playbackSpeed*/
      128 && f !== (f = `Adjust playback speed to ${/*playbackSpeeds*/
      g[10][
        /*playbackSpeeds*/
        (g[10].indexOf(
          /*playbackSpeed*/
          g[7]
        ) + 1) % /*playbackSpeeds*/
        g[10].length
      ]}x`)) && ae(a, "aria-label", f), (!E || L & /*show_volume_slider*/
      1) && ul(
        a,
        "hidden",
        /*show_volume_slider*/
        g[0]
      ), /*showZoomSlider*/
      g[1] ? ee ? ee.p(g, L) : (ee = fl(g), ee.c(), ee.m(d, null)) : ee && (ee.d(1), ee = null), (!E || L & /*audio_duration, waveform_options*/
      72 && T !== (T = `Skip backwards by ${Rn(
        /*audio_duration*/
        g[3],
        /*waveform_options*/
        g[6].skip_length
      )} seconds`)) && ae(w, "aria-label", T);
      let W = P;
      P = se(g), P !== W && (sl(), rt(Y[W], 1, 1, () => {
        Y[W] = null;
      }), rl(), A = Y[P], A || (A = Y[P] = H[P](g), A.c()), Je(A, 1), A.m(O, null)), (!E || L & /*playing, i18n*/
      48 && R !== (R = /*playing*/
      g[5] ? (
        /*i18n*/
        g[4]("audio.pause")
      ) : (
        /*i18n*/
        g[4]("audio.play")
      ))) && ae(O, "aria-label", R), (!E || L & /*audio_duration, waveform_options*/
      72 && J !== (J = "Skip forward by " + Rn(
        /*audio_duration*/
        g[3],
        /*waveform_options*/
        g[6].skip_length
      ) + " seconds")) && ae(X, "aria-label", J);
    },
    i(g) {
      E || (Je(o.$$.fragment, g), Je(U), Je(m.$$.fragment, g), Je(C.$$.fragment, g), Je(A), Je(F.$$.fragment, g), E = !0);
    },
    o(g) {
      rt(o.$$.fragment, g), rt(U), rt(m.$$.fragment, g), rt(C.$$.fragment, g), rt(A), rt(F.$$.fragment, g), E = !1;
    },
    d(g) {
      g && tu(e), en(o), U && U.d(), en(m), ee && ee.d(), en(C), Y[P].d(), en(F), V = !1, iu(N);
    }
  };
}
let Ir = 10, Ur = 1e4, dl = 100;
function P0(t, e, n) {
  let { waveform: i } = e, { audio_duration: o } = e, { i18n: r } = e, { playing: s } = e, { waveform_options: a = {} } = e, { show_volume_slider: l = !1 } = e, { showZoomSlider: u = !1 } = e, c = [0.5, 1, 1.5, 2], f = c[1], h = 1, d = 10;
  function _(R) {
    n(9, d = R), d < Ir ? n(9, d = Ir) : d > Ur && n(9, d = Ur), i.zoom(d);
  }
  S0(() => {
    window.addEventListener("keydown", (R) => {
      switch (R.key) {
        case " ":
          i.playPause(), R.preventDefault();
          break;
        case "ArrowUp":
          R.preventDefault(), _(d + dl);
          break;
        case "ArrowDown":
          R.preventDefault(), _(d - dl);
          break;
      }
    });
  });
  const m = () => n(0, l = !l);
  function v(R) {
    h = R, n(8, h);
  }
  function p(R) {
    l = R, n(0, l);
  }
  const k = () => {
    n(7, f = c[(c.indexOf(f) + 1) % c.length]), i.setPlaybackRate(f);
  }, w = () => n(1, u = !u);
  function C() {
    d = C0(this.value), n(9, d);
  }
  const T = (R) => _(R.target.value), y = () => n(1, u = !1), O = () => i.skip(Rn(o, a.skip_length) * -1), P = () => i.playPause(), A = () => i.skip(Rn(o, a.skip_length));
  return t.$$set = (R) => {
    "waveform" in R && n(2, i = R.waveform), "audio_duration" in R && n(3, o = R.audio_duration), "i18n" in R && n(4, r = R.i18n), "playing" in R && n(5, s = R.playing), "waveform_options" in R && n(6, a = R.waveform_options), "show_volume_slider" in R && n(0, l = R.show_volume_slider), "showZoomSlider" in R && n(1, u = R.showZoomSlider);
  }, [
    l,
    u,
    i,
    o,
    r,
    s,
    a,
    f,
    h,
    d,
    c,
    _,
    m,
    v,
    p,
    k,
    w,
    C,
    T,
    y,
    O,
    P,
    A
  ];
}
class ou extends w0 {
  constructor(e) {
    super(), y0(this, e, P0, L0, k0, {
      waveform: 2,
      audio_duration: 3,
      i18n: 4,
      playing: 5,
      waveform_options: 6,
      show_volume_slider: 0,
      showZoomSlider: 1
    });
  }
}
const { setContext: Y2, getContext: R0 } = window.__gradio__svelte__internal, B0 = "WORKER_PROXY_CONTEXT_KEY";
function ru() {
  return R0(B0);
}
function M0(t) {
  return t.host === window.location.host || t.host === "localhost:7860" || t.host === "127.0.0.1:7860" || // Ref: https://github.com/gradio-app/gradio/blob/v3.32.0/js/app/src/Index.svelte#L194
  t.host === "lite.local";
}
function su(t, e) {
  const n = e.toLowerCase();
  for (const [i, o] of Object.entries(t))
    if (i.toLowerCase() === n)
      return o;
}
function lu(t) {
  if (t == null)
    return !1;
  const e = new URL(t, window.location.href);
  return !(!M0(e) || e.protocol !== "http:" && e.protocol !== "https:");
}
async function hl(t) {
  if (t == null || !lu(t))
    return t;
  const e = ru();
  if (e == null)
    return t;
  const i = new URL(t, window.location.href).pathname;
  return e.httpRequest({
    method: "GET",
    path: i,
    headers: {},
    query_string: ""
  }).then((o) => {
    if (o.status !== 200)
      throw new Error(`Failed to get file ${i} from the Wasm worker.`);
    const r = new Blob([o.body], {
      type: su(o.headers, "content-type")
    });
    return URL.createObjectURL(r);
  });
}
const {
  SvelteComponent: D0,
  assign: oo,
  check_outros: au,
  compute_rest_props: _l,
  create_slot: ls,
  detach: yo,
  element: uu,
  empty: cu,
  exclude_internal_props: O0,
  get_all_dirty_from_scope: as,
  get_slot_changes: us,
  get_spread_update: fu,
  group_outros: du,
  init: H0,
  insert: ko,
  listen: hu,
  prevent_default: N0,
  safe_not_equal: I0,
  set_attributes: ro,
  transition_in: fn,
  transition_out: dn,
  update_slot_base: cs
} = window.__gradio__svelte__internal, { createEventDispatcher: U0 } = window.__gradio__svelte__internal;
function j0(t) {
  let e, n, i, o, r;
  const s = (
    /*#slots*/
    t[8].default
  ), a = ls(
    s,
    t,
    /*$$scope*/
    t[7],
    null
  );
  let l = [
    { href: (
      /*href*/
      t[0]
    ) },
    {
      target: n = typeof window < "u" && window.__is_colab__ ? "_blank" : null
    },
    { rel: "noopener noreferrer" },
    { download: (
      /*download*/
      t[1]
    ) },
    /*$$restProps*/
    t[6]
  ], u = {};
  for (let c = 0; c < l.length; c += 1)
    u = oo(u, l[c]);
  return {
    c() {
      e = uu("a"), a && a.c(), ro(e, u);
    },
    m(c, f) {
      ko(c, e, f), a && a.m(e, null), i = !0, o || (r = hu(
        e,
        "click",
        /*dispatch*/
        t[3].bind(null, "click")
      ), o = !0);
    },
    p(c, f) {
      a && a.p && (!i || f & /*$$scope*/
      128) && cs(
        a,
        s,
        c,
        /*$$scope*/
        c[7],
        i ? us(
          s,
          /*$$scope*/
          c[7],
          f,
          null
        ) : as(
          /*$$scope*/
          c[7]
        ),
        null
      ), ro(e, u = fu(l, [
        (!i || f & /*href*/
        1) && { href: (
          /*href*/
          c[0]
        ) },
        { target: n },
        { rel: "noopener noreferrer" },
        (!i || f & /*download*/
        2) && { download: (
          /*download*/
          c[1]
        ) },
        f & /*$$restProps*/
        64 && /*$$restProps*/
        c[6]
      ]));
    },
    i(c) {
      i || (fn(a, c), i = !0);
    },
    o(c) {
      dn(a, c), i = !1;
    },
    d(c) {
      c && yo(e), a && a.d(c), o = !1, r();
    }
  };
}
function F0(t) {
  let e, n, i, o;
  const r = [z0, q0], s = [];
  function a(l, u) {
    return (
      /*is_downloading*/
      l[2] ? 0 : 1
    );
  }
  return e = a(t), n = s[e] = r[e](t), {
    c() {
      n.c(), i = cu();
    },
    m(l, u) {
      s[e].m(l, u), ko(l, i, u), o = !0;
    },
    p(l, u) {
      let c = e;
      e = a(l), e === c ? s[e].p(l, u) : (du(), dn(s[c], 1, 1, () => {
        s[c] = null;
      }), au(), n = s[e], n ? n.p(l, u) : (n = s[e] = r[e](l), n.c()), fn(n, 1), n.m(i.parentNode, i));
    },
    i(l) {
      o || (fn(n), o = !0);
    },
    o(l) {
      dn(n), o = !1;
    },
    d(l) {
      l && yo(i), s[e].d(l);
    }
  };
}
function q0(t) {
  let e, n, i, o;
  const r = (
    /*#slots*/
    t[8].default
  ), s = ls(
    r,
    t,
    /*$$scope*/
    t[7],
    null
  );
  let a = [
    /*$$restProps*/
    t[6],
    { href: (
      /*href*/
      t[0]
    ) }
  ], l = {};
  for (let u = 0; u < a.length; u += 1)
    l = oo(l, a[u]);
  return {
    c() {
      e = uu("a"), s && s.c(), ro(e, l);
    },
    m(u, c) {
      ko(u, e, c), s && s.m(e, null), n = !0, i || (o = hu(e, "click", N0(
        /*wasm_click_handler*/
        t[5]
      )), i = !0);
    },
    p(u, c) {
      s && s.p && (!n || c & /*$$scope*/
      128) && cs(
        s,
        r,
        u,
        /*$$scope*/
        u[7],
        n ? us(
          r,
          /*$$scope*/
          u[7],
          c,
          null
        ) : as(
          /*$$scope*/
          u[7]
        ),
        null
      ), ro(e, l = fu(a, [
        c & /*$$restProps*/
        64 && /*$$restProps*/
        u[6],
        (!n || c & /*href*/
        1) && { href: (
          /*href*/
          u[0]
        ) }
      ]));
    },
    i(u) {
      n || (fn(s, u), n = !0);
    },
    o(u) {
      dn(s, u), n = !1;
    },
    d(u) {
      u && yo(e), s && s.d(u), i = !1, o();
    }
  };
}
function z0(t) {
  let e;
  const n = (
    /*#slots*/
    t[8].default
  ), i = ls(
    n,
    t,
    /*$$scope*/
    t[7],
    null
  );
  return {
    c() {
      i && i.c();
    },
    m(o, r) {
      i && i.m(o, r), e = !0;
    },
    p(o, r) {
      i && i.p && (!e || r & /*$$scope*/
      128) && cs(
        i,
        n,
        o,
        /*$$scope*/
        o[7],
        e ? us(
          n,
          /*$$scope*/
          o[7],
          r,
          null
        ) : as(
          /*$$scope*/
          o[7]
        ),
        null
      );
    },
    i(o) {
      e || (fn(i, o), e = !0);
    },
    o(o) {
      dn(i, o), e = !1;
    },
    d(o) {
      i && i.d(o);
    }
  };
}
function G0(t) {
  let e, n, i, o, r;
  const s = [F0, j0], a = [];
  function l(u, c) {
    return c & /*href*/
    1 && (e = null), e == null && (e = !!/*worker_proxy*/
    (u[4] && lu(
      /*href*/
      u[0]
    ))), e ? 0 : 1;
  }
  return n = l(t, -1), i = a[n] = s[n](t), {
    c() {
      i.c(), o = cu();
    },
    m(u, c) {
      a[n].m(u, c), ko(u, o, c), r = !0;
    },
    p(u, [c]) {
      let f = n;
      n = l(u, c), n === f ? a[n].p(u, c) : (du(), dn(a[f], 1, 1, () => {
        a[f] = null;
      }), au(), i = a[n], i ? i.p(u, c) : (i = a[n] = s[n](u), i.c()), fn(i, 1), i.m(o.parentNode, o));
    },
    i(u) {
      r || (fn(i), r = !0);
    },
    o(u) {
      dn(i), r = !1;
    },
    d(u) {
      u && yo(o), a[n].d(u);
    }
  };
}
function W0(t, e, n) {
  const i = ["href", "download"];
  let o = _l(e, i), { $$slots: r = {}, $$scope: s } = e, { href: a = void 0 } = e, { download: l } = e;
  const u = U0();
  let c = !1;
  const f = ru();
  async function h() {
    if (c)
      return;
    if (u("click"), a == null)
      throw new Error("href is not defined.");
    if (f == null)
      throw new Error("Wasm worker proxy is not available.");
    const _ = new URL(a, window.location.href).pathname;
    n(2, c = !0), f.httpRequest({
      method: "GET",
      path: _,
      headers: {},
      query_string: ""
    }).then((m) => {
      if (m.status !== 200)
        throw new Error(`Failed to get file ${_} from the Wasm worker.`);
      const v = new Blob(
        [m.body],
        {
          type: su(m.headers, "content-type")
        }
      ), p = URL.createObjectURL(v), k = document.createElement("a");
      k.href = p, k.download = l, k.click(), URL.revokeObjectURL(p);
    }).finally(() => {
      n(2, c = !1);
    });
  }
  return t.$$set = (d) => {
    e = oo(oo({}, e), O0(d)), n(6, o = _l(e, i)), "href" in d && n(0, a = d.href), "download" in d && n(1, l = d.download), "$$scope" in d && n(7, s = d.$$scope);
  }, [
    a,
    l,
    c,
    u,
    f,
    h,
    o,
    s,
    r
  ];
}
class _u extends D0 {
  constructor(e) {
    super(), H0(this, e, W0, G0, I0, { href: 0, download: 1 });
  }
}
const {
  SvelteComponent: V0,
  append: ml,
  attr: kt,
  detach: X0,
  init: Z0,
  insert: x0,
  noop: hr,
  safe_not_equal: J0,
  svg_element: _r
} = window.__gradio__svelte__internal;
function Y0(t) {
  let e, n, i;
  return {
    c() {
      e = _r("svg"), n = _r("g"), i = _r("path"), kt(i, "d", `M41.267,18.557H26.832V4.134C26.832,1.851,24.99,0,22.707,0c-2.283,0-4.124,1.851-4.124,4.135v14.432H4.141\r
		c-2.283,0-4.139,1.851-4.138,4.135c-0.001,1.141,0.46,2.187,1.207,2.934c0.748,0.749,1.78,1.222,2.92,1.222h14.453V41.27\r
		c0,1.142,0.453,2.176,1.201,2.922c0.748,0.748,1.777,1.211,2.919,1.211c2.282,0,4.129-1.851,4.129-4.133V26.857h14.435\r
		c2.283,0,4.134-1.867,4.133-4.15C45.399,20.425,43.548,18.557,41.267,18.557z`), kt(e, "version", "1.1"), kt(e, "id", "Capa_1"), kt(e, "xmlns", "http://www.w3.org/2000/svg"), kt(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), kt(e, "width", "100%"), kt(e, "height", "100%"), kt(e, "viewBox", "0 10 45.402 45.402	"), kt(e, "xml:space", "preserve");
    },
    m(o, r) {
      x0(o, e, r), ml(e, n), ml(n, i);
    },
    p: hr,
    i: hr,
    o: hr,
    d(o) {
      o && X0(e);
    }
  };
}
class Q0 extends V0 {
  constructor(e) {
    super(), Z0(this, e, null, Y0, J0, {});
  }
}
const {
  SvelteComponent: K0,
  append: Vi,
  attr: Xi,
  binding_callbacks: $0,
  create_component: em,
  destroy_component: tm,
  detach: nm,
  element: Zi,
  init: im,
  insert: om,
  listen: rm,
  mount_component: sm,
  noop: lm,
  safe_not_equal: am,
  space: um,
  transition_in: cm,
  transition_out: fm
} = window.__gradio__svelte__internal, { createEventDispatcher: dm, onMount: hm } = window.__gradio__svelte__internal;
function _m(t) {
  let e, n, i, o, r, s, a, l, u;
  return s = new Q0({}), {
    c() {
      e = Zi("div"), n = Zi("div"), i = um(), o = Zi("div"), r = Zi("button"), em(s.$$.fragment), Xi(n, "class", "caption svelte-43he0g"), Xi(r, "class", "create-label svelte-43he0g"), Xi(o, "class", "action-buttons svelte-43he0g"), Xi(e, "class", "caption-container svelte-43he0g");
    },
    m(c, f) {
      om(c, e, f), Vi(e, n), t[7](n), Vi(e, i), Vi(e, o), Vi(o, r), sm(s, r, null), a = !0, l || (u = rm(
        r,
        "click",
        /*click_handler*/
        t[8]
      ), l = !0);
    },
    p: lm,
    i(c) {
      a || (cm(s.$$.fragment, c), a = !0);
    },
    o(c) {
      fm(s.$$.fragment, c), a = !1;
    },
    d(c) {
      c && nm(e), t[7](null), tm(s), l = !1, u();
    }
  };
}
function mm(t, e, n) {
  let { defaultLabel: i = null } = e, { activeLabel: o = null } = e, r, s = [], a = 0;
  const l = [
    "rgba(255, 215, 0, 0.5)",
    "rgba(0, 0, 255, 0.5)",
    "rgba(255, 0, 0, 0.5)",
    "rgba(0, 255, 0, 0.5)"
  ], u = dm();
  function c(p) {
    const k = document.createElement("button");
    k.style.backgroundColor = p.color, k.classList.add("captionLabel"), k.id = p.shortcut, k.innerHTML = '<span style="font-weight: bold;">' + p.shortcut + "</span>: " + p.speaker, k.addEventListener("focusin", () => {
      _(p.shortcut);
    }), k.addEventListener("focusout", () => {
      _("Escape");
    }), r.appendChild(k);
  }
  function f(p, k, w) {
    if (s.length === 26)
      return;
    if (p || (p = "LABEL_" + a.toString().padStart(2, "0")), h(p))
      return h(p);
    if (k || (k = l[a % l.length]), !w)
      for (w = "A"; s.some((T) => T.shortcut === w) && w !== "Z"; )
        w = String.fromCharCode(w.charCodeAt(0) + 1);
    const C = { speaker: p, color: k, shortcut: w };
    return s.push(C), c(C), a++, n(6, s = s.sort((T, y) => T.shortcut.localeCompare(y.shortcut))), C;
  }
  function h(p) {
    return s.find((k) => k.speaker === p);
  }
  function d(p) {
    o && document.getElementById(o.shortcut).classList.remove("active-button"), n(4, o = p), o && document.getElementById(o.shortcut).classList.add("active-button"), u("select", o);
  }
  function _(p) {
    let k = null;
    p !== "Escape" && (k = s.find((w) => w.shortcut === p.toUpperCase()), k || (k = f(void 0, void 0, p.toUpperCase()))), d(k);
  }
  hm(() => {
    window.addEventListener("keydown", (p) => {
      (p.key.match(/^[a-zA-Z]$/) || p.key === "Escape") && _(p.key);
    });
  });
  function m(p) {
    $0[p ? "unshift" : "push"](() => {
      r = p, n(1, r);
    });
  }
  const v = () => {
    const p = f();
    d(p);
  };
  return t.$$set = (p) => {
    "defaultLabel" in p && n(3, i = p.defaultLabel), "activeLabel" in p && n(4, o = p.activeLabel);
  }, t.$$.update = () => {
    t.$$.dirty & /*labels*/
    64 && s.length > 0 && n(3, i = s[0]);
  }, [
    f,
    r,
    d,
    i,
    o,
    h,
    s,
    m,
    v
  ];
}
class pm extends K0 {
  constructor(e) {
    super(), im(this, e, mm, _m, am, {
      defaultLabel: 3,
      activeLabel: 4,
      createLabel: 0,
      getLabel: 5
    });
  }
  get createLabel() {
    return this.$$.ctx[0];
  }
  get getLabel() {
    return this.$$.ctx[5];
  }
}
const {
  SvelteComponent: gm,
  add_flush_callback: jr,
  append: Ye,
  attr: oe,
  bind: Fr,
  binding_callbacks: nn,
  check_outros: so,
  create_component: hn,
  destroy_component: _n,
  detach: ut,
  element: je,
  empty: mu,
  group_outros: lo,
  init: bm,
  insert: ct,
  listen: qr,
  mount_component: mn,
  noop: pl,
  run_all: vm,
  safe_not_equal: wm,
  space: ln,
  src_url_equal: gl,
  transition_in: Ee,
  transition_out: Me
} = window.__gradio__svelte__internal, { onMount: ym } = window.__gradio__svelte__internal, { createEventDispatcher: km } = window.__gradio__svelte__internal;
function Em(t) {
  let e, n, i, o, r, s, a, l, u, c, f, h, d = (
    /*waveform*/
    t[9] && bl(t)
  );
  return {
    c() {
      e = je("div"), n = je("div"), i = je("div"), o = ln(), r = je("div"), s = je("time"), s.textContent = "0:00", a = ln(), l = je("div"), u = je("time"), u.textContent = "0:00", c = ln(), d && d.c(), oe(i, "id", "waveform"), oe(i, "class", "svelte-15fy58k"), oe(n, "class", "waveform-container svelte-15fy58k"), oe(s, "id", "time"), oe(s, "class", "svelte-15fy58k"), oe(u, "id", "duration"), oe(u, "class", "svelte-15fy58k"), oe(r, "class", "timestamps svelte-15fy58k"), oe(e, "class", "component-wrapper svelte-15fy58k"), oe(e, "data-testid", f = /*label*/
      t[2] ? "waveform-" + /*label*/
      t[2] : "unlabelled-audio");
    },
    m(_, m) {
      ct(_, e, m), Ye(e, n), Ye(n, i), t[26](i), Ye(e, o), Ye(e, r), Ye(r, s), t[27](s), Ye(r, a), Ye(r, l), Ye(l, u), t[28](u), Ye(e, c), d && d.m(e, null), h = !0;
    },
    p(_, m) {
      /*waveform*/
      _[9] ? d ? (d.p(_, m), m[0] & /*waveform*/
      512 && Ee(d, 1)) : (d = bl(_), d.c(), Ee(d, 1), d.m(e, null)) : d && (lo(), Me(d, 1, 1, () => {
        d = null;
      }), so()), (!h || m[0] & /*label*/
      4 && f !== (f = /*label*/
      _[2] ? "waveform-" + /*label*/
      _[2] : "unlabelled-audio")) && oe(e, "data-testid", f);
    },
    i(_) {
      h || (Ee(d), h = !0);
    },
    o(_) {
      Me(d), h = !1;
    },
    d(_) {
      _ && ut(e), t[26](null), t[27](null), t[28](null), d && d.d();
    }
  };
}
function Cm(t) {
  let e, n, i;
  return {
    c() {
      e = je("audio"), oe(e, "class", "standard-player svelte-15fy58k"), gl(e.src, n = /*value*/
      t[0].file_data.url) || oe(e, "src", n), e.controls = !0, e.autoplay = i = /*waveform_settings*/
      t[6].autoplay;
    },
    m(o, r) {
      ct(o, e, r);
    },
    p(o, r) {
      r[0] & /*value*/
      1 && !gl(e.src, n = /*value*/
      o[0].file_data.url) && oe(e, "src", n), r[0] & /*waveform_settings*/
      64 && i !== (i = /*waveform_settings*/
      o[6].autoplay) && (e.autoplay = i);
    },
    i: pl,
    o: pl,
    d(o) {
      o && ut(e);
    }
  };
}
function Sm(t) {
  let e, n;
  return e = new za({
    props: {
      size: "small",
      $$slots: { default: [Tm] },
      $$scope: { ctx: t }
    }
  }), {
    c() {
      hn(e.$$.fragment);
    },
    m(i, o) {
      mn(e, i, o), n = !0;
    },
    p(i, o) {
      const r = {};
      o[1] & /*$$scope*/
      67108864 && (r.$$scope = { dirty: o, ctx: i }), e.$set(r);
    },
    i(i) {
      n || (Ee(e.$$.fragment, i), n = !0);
    },
    o(i) {
      Me(e.$$.fragment, i), n = !1;
    },
    d(i) {
      _n(e, i);
    }
  };
}
function bl(t) {
  let e, n, i, o, r, s, a, l, u;
  function c(_) {
    t[29](_);
  }
  let f = {
    waveform: (
      /*waveform*/
      t[9]
    ),
    playing: (
      /*playing*/
      t[13]
    ),
    audio_duration: (
      /*audio_duration*/
      t[12]
    ),
    i18n: (
      /*i18n*/
      t[3]
    ),
    waveform_options: (
      /*waveform_options*/
      t[7]
    )
  };
  /*show_volume_slider*/
  t[14] !== void 0 && (f.show_volume_slider = /*show_volume_slider*/
  t[14]), i = new ou({ props: f }), nn.push(() => Fr(i, "show_volume_slider", c));
  let h = (
    /*editable*/
    t[5] && /*interactive*/
    t[4] && /*value*/
    t[0] && vl(t)
  ), d = (
    /*value*/
    t[0] && wl(t)
  );
  return {
    c() {
      e = je("div"), n = je("div"), hn(i.$$.fragment), r = ln(), s = je("div"), h && h.c(), a = ln(), d && d.c(), l = mu(), oe(n, "class", "waveform-controls svelte-15fy58k"), oe(s, "class", "regions-actions svelte-15fy58k"), oe(e, "class", "commands svelte-15fy58k");
    },
    m(_, m) {
      ct(_, e, m), Ye(e, n), mn(i, n, null), Ye(e, r), Ye(e, s), h && h.m(s, null), ct(_, a, m), d && d.m(_, m), ct(_, l, m), u = !0;
    },
    p(_, m) {
      const v = {};
      m[0] & /*waveform*/
      512 && (v.waveform = /*waveform*/
      _[9]), m[0] & /*playing*/
      8192 && (v.playing = /*playing*/
      _[13]), m[0] & /*audio_duration*/
      4096 && (v.audio_duration = /*audio_duration*/
      _[12]), m[0] & /*i18n*/
      8 && (v.i18n = /*i18n*/
      _[3]), m[0] & /*waveform_options*/
      128 && (v.waveform_options = /*waveform_options*/
      _[7]), !o && m[0] & /*show_volume_slider*/
      16384 && (o = !0, v.show_volume_slider = /*show_volume_slider*/
      _[14], jr(() => o = !1)), i.$set(v), /*editable*/
      _[5] && /*interactive*/
      _[4] && /*value*/
      _[0] ? h ? (h.p(_, m), m[0] & /*editable, interactive, value*/
      49 && Ee(h, 1)) : (h = vl(_), h.c(), Ee(h, 1), h.m(s, null)) : h && (lo(), Me(h, 1, 1, () => {
        h = null;
      }), so()), /*value*/
      _[0] ? d ? (d.p(_, m), m[0] & /*value*/
      1 && Ee(d, 1)) : (d = wl(_), d.c(), Ee(d, 1), d.m(l.parentNode, l)) : d && (lo(), Me(d, 1, 1, () => {
        d = null;
      }), so());
    },
    i(_) {
      u || (Ee(i.$$.fragment, _), Ee(h), Ee(d), u = !0);
    },
    o(_) {
      Me(i.$$.fragment, _), Me(h), Me(d), u = !1;
    },
    d(_) {
      _ && (ut(e), ut(a), ut(l)), _n(i), h && h.d(), d && d.d(_);
    }
  };
}
function vl(t) {
  let e, n, i, o, r, s, a, l, u, c, f, h = (
    /*showRedo*/
    t[18] && Am(t)
  );
  return i = new R_({}), a = new gh({}), {
    c() {
      h && h.c(), e = ln(), n = je("button"), hn(i.$$.fragment), r = ln(), s = je("button"), hn(a.$$.fragment), oe(n, "class", "action icon remove-button svelte-15fy58k"), oe(n, "aria-label", "Remove an annotation"), oe(n, "title", o = /*i18n*/
      t[3]("Remove an annotation")), oe(s, "class", "action icon trim-button svelte-15fy58k"), oe(s, "aria-label", "Split an annotation"), oe(s, "title", l = /*i18n*/
      t[3]("Split an annotation"));
    },
    m(d, _) {
      h && h.m(d, _), ct(d, e, _), ct(d, n, _), mn(i, n, null), ct(d, r, _), ct(d, s, _), mn(a, s, null), u = !0, c || (f = [
        qr(
          n,
          "click",
          /*click_handler*/
          t[30]
        ),
        qr(
          s,
          "click",
          /*click_handler_1*/
          t[31]
        )
      ], c = !0);
    },
    p(d, _) {
      /*showRedo*/
      d[18] && h.p(d, _), (!u || _[0] & /*i18n*/
      8 && o !== (o = /*i18n*/
      d[3]("Remove an annotation"))) && oe(n, "title", o), (!u || _[0] & /*i18n*/
      8 && l !== (l = /*i18n*/
      d[3]("Split an annotation"))) && oe(s, "title", l);
    },
    i(d) {
      u || (Ee(h), Ee(i.$$.fragment, d), Ee(a.$$.fragment, d), u = !0);
    },
    o(d) {
      Me(h), Me(i.$$.fragment, d), Me(a.$$.fragment, d), u = !1;
    },
    d(d) {
      d && (ut(e), ut(n), ut(r), ut(s)), h && h.d(d), _n(i), _n(a), c = !1, vm(f);
    }
  };
}
function Am(t) {
  let e, n, i, o, r, s;
  return n = new Xa({}), {
    c() {
      e = je("button"), hn(n.$$.fragment), oe(e, "class", "action icon svelte-15fy58k"), oe(e, "aria-label", "Reset annotations"), oe(e, "title", i = /*i18n*/
      t[3]("Reset annotations"));
    },
    m(a, l) {
      ct(a, e, l), mn(n, e, null), o = !0, r || (s = qr(
        e,
        "click",
        /*resetRegions*/
        t[19]
      ), r = !0);
    },
    p(a, l) {
      (!o || l[0] & /*i18n*/
      8 && i !== (i = /*i18n*/
      a[3]("Reset annotations"))) && oe(e, "title", i);
    },
    i(a) {
      o || (Ee(n.$$.fragment, a), o = !0);
    },
    o(a) {
      Me(n.$$.fragment, a), o = !1;
    },
    d(a) {
      a && ut(e), _n(n), r = !1, s();
    }
  };
}
function wl(t) {
  let e, n, i, o;
  function r(l) {
    t[33](l);
  }
  function s(l) {
    t[34](l);
  }
  let a = {};
  return (
    /*defaultLabel*/
    t[16] !== void 0 && (a.defaultLabel = /*defaultLabel*/
    t[16]), /*activeLabel*/
    t[17] !== void 0 && (a.activeLabel = /*activeLabel*/
    t[17]), e = new pm({ props: a }), t[32](e), nn.push(() => Fr(e, "defaultLabel", r)), nn.push(() => Fr(e, "activeLabel", s)), e.$on(
      "select",
      /*select_handler*/
      t[35]
    ), e.$on(
      "select",
      /*select_handler_1*/
      t[36]
    ), {
      c() {
        hn(e.$$.fragment);
      },
      m(l, u) {
        mn(e, l, u), o = !0;
      },
      p(l, u) {
        const c = {};
        !n && u[0] & /*defaultLabel*/
        65536 && (n = !0, c.defaultLabel = /*defaultLabel*/
        l[16], jr(() => n = !1)), !i && u[0] & /*activeLabel*/
        131072 && (i = !0, c.activeLabel = /*activeLabel*/
        l[17], jr(() => i = !1)), e.$set(c);
      },
      i(l) {
        o || (Ee(e.$$.fragment, l), o = !0);
      },
      o(l) {
        Me(e.$$.fragment, l), o = !1;
      },
      d(l) {
        t[32](null), _n(e, l);
      }
    }
  );
}
function Tm(t) {
  let e, n;
  return e = new mo({}), {
    c() {
      hn(e.$$.fragment);
    },
    m(i, o) {
      mn(e, i, o), n = !0;
    },
    i(i) {
      n || (Ee(e.$$.fragment, i), n = !0);
    },
    o(i) {
      Me(e.$$.fragment, i), n = !1;
    },
    d(i) {
      _n(e, i);
    }
  };
}
function Lm(t) {
  let e, n, i, o;
  const r = [Sm, Cm, Em], s = [];
  function a(l, u) {
    return (
      /*value*/
      l[0] === null ? 0 : (
        /*value*/
        l[0].file_data.is_stream ? 1 : 2
      )
    );
  }
  return e = a(t), n = s[e] = r[e](t), {
    c() {
      n.c(), i = mu();
    },
    m(l, u) {
      s[e].m(l, u), ct(l, i, u), o = !0;
    },
    p(l, u) {
      let c = e;
      e = a(l), e === c ? s[e].p(l, u) : (lo(), Me(s[c], 1, 1, () => {
        s[c] = null;
      }), so(), n = s[e], n ? n.p(l, u) : (n = s[e] = r[e](l), n.c()), Ee(n, 1), n.m(i.parentNode, i));
    },
    i(l) {
      o || (Ee(n), o = !0);
    },
    o(l) {
      Me(n), o = !1;
    },
    d(l) {
      l && ut(i), s[e].d(l);
    }
  };
}
function me(t) {
  let e, n = t[0], i = 1;
  for (; i < t.length; ) {
    const o = t[i], r = t[i + 1];
    if (i += 2, (o === "optionalAccess" || o === "optionalCall") && n == null)
      return;
    o === "access" || o === "optionalAccess" ? (e = n, n = r(n)) : (o === "call" || o === "optionalCall") && (n = r((...s) => n.call(e, ...s)), e = void 0);
  }
  return n;
}
function yl(t) {
  const e = Math.floor(t / 60), i = `0${Math.round(t) % 60}`.slice(-2);
  return `${e}:${i}`;
}
function Pm(t, e, n) {
  let i, { value: o = null } = e, { label: r } = e, { i18n: s } = e, { interactive: a = !0 } = e, { editable: l = !0 } = e, { waveform_settings: u } = e, { waveform_options: c } = e, { mode: f = "" } = e, h, d, _, m = null, v, p, k, w, C, T = !1, y = !1, O = a, P = null, A = /* @__PURE__ */ new Map(), R, z = null, X = null;
  const F = km();
  function J() {
    n(9, d = Ft.create({ container: h, ...u })), hl(me([o, "access", (b) => b.file_data, "optionalAccess", (b) => b.url])).then((b) => {
      if (b && d)
        return d.load(b);
    }), d.on("dblclick", () => {
      U(d.getCurrentTime());
    });
  }
  function E(b) {
    if (P || (P = [...b]), b.length === 0)
      return;
    const S = Array.from(A.values());
    b = b.filter((D) => !S.some((I) => D.start === I.start && D.end === I.end && D.speaker === I.speaker)), b.forEach((D) => {
      let I = R.createLabel(D.speaker), j = N(
        {
          start: D.start,
          end: D.end,
          color: I.color,
          drag: !0,
          resize: !0
        },
        D.speaker
      );
      j.element.style.top = (D.level * 10).toString() + "%", j.element.style.height = (100 - (D.numLevels + 1) * 10).toString() + "%";
    });
  }
  function V() {
    n(0, o.annotations = Array.from(A.values()), o), F("edit", o);
  }
  function N(b, S) {
    let D = _.addRegion(b);
    const I = {
      start: D.start,
      end: D.end,
      speaker: S,
      color: D.color
    };
    return A.set(D.id, I), P || (P = [I]), V(), D;
  }
  function U(b) {
    let S = X || z;
    S || (S = R.createLabel());
    let D = N(
      {
        start: b - 1,
        end: b + 1,
        color: S.color,
        drag: !0,
        resize: !0
      },
      S.speaker
    );
    g(D);
  }
  function ee(b) {
    b === m && g(null), A.delete(b.id), b.remove(), V();
  }
  function H(b, S) {
    if (!m)
      return;
    let D = _.getRegions().find((I) => I.id === m.id);
    b === "Delete" || b == "Backspace" && S ? G(!1) : G(!0), ee(D);
  }
  function Y() {
    se(), P.forEach((b) => o.annotations.push(Object.assign({}, b))), E(o.annotations), F("edit", o);
  }
  function se() {
    g(null), me([_, "optionalAccess", (b) => b.clearRegions, "call", (b) => b()]), n(0, o.annotations = [], o), A.clear();
  }
  function g(b) {
    m && n(22, m.element.style.background = m.color, m), n(22, m = b), m && n(22, m.element.style.background = "repeating-linear-gradient(45deg," + b.color + " ," + b.color + " 10px, #ffffff 10px ,#ffffff 15px)", m);
  }
  function L(b) {
    if (m !== null) {
      m.setOptions({
        start: m.start,
        end: m.end,
        color: b.color,
        drag: !0,
        resize: !0
      }), n(22, m.element.style.background = "repeating-linear-gradient(45deg," + m.color + " ," + m.color + " 10px, #ffffff 10px ,#ffffff 15px)", m);
      let S = A.get(m.id);
      S.speaker = b.speaker, V();
    }
  }
  function G(b) {
    var S = b ? -1 : 1, D = _.getRegions().sort((j, K) => j.start > K.start ? 1 : -1);
    if (m === null)
      g(D[0]);
    else {
      var I = D.indexOf(m);
      g(D.at((I + S) % D.length));
    }
  }
  function W(b, S) {
    if (S < b.start || S > b.end)
      throw new RangeError("split time out of region bounds");
    let D = A.get(b.id).speaker;
    N(
      {
        start: b.start,
        end: S,
        color: b.color,
        drag: b.drag,
        resize: b.resize
      },
      D
    );
    let I = N(
      {
        start: S,
        end: b.end,
        color: b.color,
        drag: b.drag,
        resize: b.resize
      },
      D
    );
    g(I), ee(b);
  }
  function de(b) {
    let S = _.getRegions().find((D) => D.start < b && D.end > b);
    if (S === void 0) {
      if (m === null)
        return;
      S = m, b = S.start + (S.end - S.start) / 2;
    }
    W(S, b);
  }
  function he(b, S, D) {
    let I, j, K = 0.05;
    S && (K = K * 4), D ? b === "ArrowLeft" ? (I = m.start, j = m.end - K) : (I = m.start, j = m.end + K) : b === "ArrowLeft" ? (I = m.start - K, j = m.end) : (I = m.start + K, j = m.end), I > m.end && (I = m.end - 0.1), j < m.start && (j = m.start + 0.1), m.setOptions({ start: I, end: j });
  }
  function q(b, S) {
    let D = d.getCurrentTime(), I, j = 0.05;
    S && (j = j * 4), b === "ArrowLeft" ? I = D - j : I = D + j, d.setTime(I);
  }
  function ve(b, S, D) {
    if (m) {
      he(b, S, D);
      return;
    }
    q(b, S);
  }
  async function M(b) {
    await hl(b).then((S) => {
      if (!(!S || me([
        o,
        "access",
        (D) => D.file_data,
        "optionalAccess",
        (D) => D.is_stream
      ])))
        return me([
          d,
          "optionalAccess",
          (D) => D.load,
          "call",
          (D) => D(S)
        ]);
    });
  }
  ym(() => {
    window.addEventListener("keydown", (b) => {
      switch (b.key) {
        case "ArrowLeft":
          ve("ArrowLeft", b.shiftKey, b.altKey);
          break;
        case "ArrowRight":
          ve("ArrowRight", b.shiftKey, b.altKey);
          break;
        case "Escape":
          g(null);
          break;
        case "Tab":
          b.preventDefault(), G(b.shiftKey);
          break;
        case "Delete":
          H("Delete", b.shiftKey);
          break;
        case "Backspace":
          H("Backspace", b.shiftKey);
          break;
        case "Enter":
          b.preventDefault(), b.shiftKey ? de(d.getCurrentTime()) : U(d.getCurrentTime());
          break;
      }
    });
  });
  function B(b) {
    nn[b ? "unshift" : "push"](() => {
      h = b, n(8, h), n(9, d);
    });
  }
  function ue(b) {
    nn[b ? "unshift" : "push"](() => {
      k = b, n(10, k), n(9, d);
    });
  }
  function Ce(b) {
    nn[b ? "unshift" : "push"](() => {
      w = b, n(11, w), n(9, d);
    });
  }
  function wt(b) {
    y = b, n(14, y);
  }
  const Q = () => n(1, f = "remove"), yt = () => n(1, f = "split");
  function yn(b) {
    nn[b ? "unshift" : "push"](() => {
      R = b, n(15, R);
    });
  }
  function ti(b) {
    z = b, n(16, z);
  }
  function ni(b) {
    X = b, n(17, X);
  }
  const le = (b) => L(b.detail), Se = (b) => n(17, X = b.detail);
  return t.$$set = (b) => {
    "value" in b && n(0, o = b.value), "label" in b && n(2, r = b.label), "i18n" in b && n(3, s = b.i18n), "interactive" in b && n(4, a = b.interactive), "editable" in b && n(5, l = b.editable), "waveform_settings" in b && n(6, u = b.waveform_settings), "waveform_options" in b && n(7, c = b.waveform_options), "mode" in b && n(1, f = b.mode);
  }, t.$$.update = () => {
    if (t.$$.dirty[0] & /*value*/
    1 && n(25, i = me([o, "access", (b) => b.file_data, "optionalAccess", (b) => b.url])), t.$$.dirty[0] & /*container, waveform*/
    768 && h !== void 0 && (d !== void 0 && d.destroy(), n(8, h.innerHTML = "", h), J(), n(13, T = !1)), t.$$.dirty[0] & /*waveform, wsRegions, mode, waveform_settings*/
    2097730 && me([
      d,
      "optionalAccess",
      (b) => b.on,
      "call",
      (b) => b("ready", () => {
        _ === void 0 && (n(21, _ = d.registerPlugin(I_.create())), me([
          _,
          "optionalAccess",
          (S) => S.on,
          "call",
          (S) => S("region-clicked", (D, I) => {
            switch (f) {
              case "remove":
                ee(D);
                break;
              case "split":
                W(D, D.start + (D.end - D.start) / 2);
                break;
              default:
                g(D), D.play();
            }
            n(1, f = "");
          })
        ]), me([
          _,
          "optionalAccess",
          (S) => S.on,
          "call",
          (S) => S("region-updated", (D) => {
            var I = A.get(D.id);
            I.start = D.start, I.end = D.end, V();
          })
        ])), u.autoplay ? me([d, "optionalAccess", (S) => S.play, "call", (S) => S()]) : me([d, "optionalAccess", (S) => S.stop, "call", (S) => S()]);
      })
    ]), t.$$.dirty[0] & /*value, wsRegions*/
    2097153 && me([o, "optionalAccess", (b) => b.annotations]) !== null && _ && E(o.annotations), t.$$.dirty[0] & /*waveform, durationRef*/
    2560 && me([
      d,
      "optionalAccess",
      (b) => b.on,
      "call",
      (b) => b("decode", (S) => {
        n(12, C = S), w && n(11, w.textContent = yl(S), w);
      })
    ]), t.$$.dirty[0] & /*waveform, timeRef*/
    1536 && me([
      d,
      "optionalAccess",
      (b) => b.on,
      "call",
      (b) => b("timeupdate", (S) => k && n(10, k.textContent = yl(S), k))
    ]), t.$$.dirty[0] & /*waveform*/
    512 && me([
      d,
      "optionalAccess",
      (b) => b.on,
      "call",
      (b) => b("finish", () => {
        n(13, T = !1), F("stop");
      })
    ]), t.$$.dirty[0] & /*waveform*/
    512 && me([
      d,
      "optionalAccess",
      (b) => b.on,
      "call",
      (b) => b("pause", () => {
        n(13, T = !1), F("pause");
      })
    ]), t.$$.dirty[0] & /*waveform*/
    512 && me([
      d,
      "optionalAccess",
      (b) => b.on,
      "call",
      (b) => b("play", () => {
        n(13, T = !0), F("play");
      })
    ]), t.$$.dirty[0] & /*activeRegion, container, leftRegionHandle, rightRegionHandle, wsRegions*/
    31457536 && m) {
      const b = h.children[0].shadowRoot;
      n(24, p = b.querySelector('[data-resize="right"]')), n(23, v = b.querySelector('[data-resize="left"]')), v && p && (v.setAttribute("role", "button"), p.setAttribute("role", "button"), me([
        v,
        "optionalAccess",
        (S) => S.setAttribute,
        "call",
        (S) => S("aria-label", "Drag to adjust start time")
      ]), me([
        p,
        "optionalAccess",
        (S) => S.setAttribute,
        "call",
        (S) => S("aria-label", "Drag to adjust end time")
      ]), me([
        v,
        "optionalAccess",
        (S) => S.setAttribute,
        "call",
        (S) => S("tabindex", "0")
      ]), me([
        p,
        "optionalAccess",
        (S) => S.setAttribute,
        "call",
        (S) => S("tabindex", "0")
      ]), v.addEventListener("focus", () => {
      }), p.addEventListener("focus", () => {
      }));
    }
    t.$$.dirty[0] & /*url*/
    33554432 && i && M(i);
  }, [
    o,
    f,
    r,
    s,
    a,
    l,
    u,
    c,
    h,
    d,
    k,
    w,
    C,
    T,
    y,
    R,
    z,
    X,
    O,
    Y,
    L,
    _,
    m,
    v,
    p,
    i,
    B,
    ue,
    Ce,
    wt,
    Q,
    yt,
    yn,
    ti,
    ni,
    le,
    Se
  ];
}
class pu extends gm {
  constructor(e) {
    super(), bm(
      this,
      e,
      Pm,
      Lm,
      wm,
      {
        value: 0,
        label: 2,
        i18n: 3,
        interactive: 4,
        editable: 5,
        waveform_settings: 6,
        waveform_options: 7,
        mode: 1
      },
      null,
      [-1, -1]
    );
  }
}
const {
  SvelteComponent: Rm,
  append: Bm,
  attr: gu,
  bubble: ai,
  check_outros: bu,
  create_component: Jn,
  destroy_component: Yn,
  detach: vi,
  element: vu,
  empty: Mm,
  group_outros: wu,
  init: Dm,
  insert: wi,
  mount_component: Qn,
  safe_not_equal: Om,
  space: zr,
  transition_in: Ke,
  transition_out: ft
} = window.__gradio__svelte__internal, { createEventDispatcher: Hm } = window.__gradio__svelte__internal;
function Nm(t) {
  let e, n;
  return e = new za({
    props: {
      size: "small",
      $$slots: { default: [Um] },
      $$scope: { ctx: t }
    }
  }), {
    c() {
      Jn(e.$$.fragment);
    },
    m(i, o) {
      Qn(e, i, o), n = !0;
    },
    p(i, o) {
      const r = {};
      o & /*$$scope*/
      16384 && (r.$$scope = { dirty: o, ctx: i }), e.$set(r);
    },
    i(i) {
      n || (Ke(e.$$.fragment, i), n = !0);
    },
    o(i) {
      ft(e.$$.fragment, i), n = !1;
    },
    d(i) {
      Yn(e, i);
    }
  };
}
function Im(t) {
  let e, n, i, o, r, s = (
    /*show_download_button*/
    t[3] && /*value*/
    t[0].file_data !== null && kl(t)
  ), a = qm;
  return o = new pu({
    props: {
      value: (
        /*value*/
        t[0]
      ),
      interactive: !1,
      label: (
        /*label*/
        t[1]
      ),
      i18n: (
        /*i18n*/
        t[4]
      ),
      waveform_settings: (
        /*waveform_settings*/
        t[5]
      ),
      waveform_options: (
        /*waveform_options*/
        t[6]
      )
    }
  }), o.$on(
    "pause",
    /*pause_handler*/
    t[10]
  ), o.$on(
    "play",
    /*play_handler*/
    t[11]
  ), o.$on(
    "stop",
    /*stop_handler*/
    t[12]
  ), {
    c() {
      e = vu("div"), s && s.c(), n = zr(), i = zr(), Jn(o.$$.fragment), gu(e, "class", "icon-buttons svelte-1mrvp2o");
    },
    m(l, u) {
      wi(l, e, u), s && s.m(e, null), Bm(e, n), wi(l, i, u), Qn(o, l, u), r = !0;
    },
    p(l, u) {
      /*show_download_button*/
      l[3] && /*value*/
      l[0].file_data !== null ? s ? (s.p(l, u), u & /*show_download_button, value*/
      9 && Ke(s, 1)) : (s = kl(l), s.c(), Ke(s, 1), s.m(e, n)) : s && (wu(), ft(s, 1, 1, () => {
        s = null;
      }), bu());
      const c = {};
      u & /*value*/
      1 && (c.value = /*value*/
      l[0]), u & /*label*/
      2 && (c.label = /*label*/
      l[1]), u & /*i18n*/
      16 && (c.i18n = /*i18n*/
      l[4]), u & /*waveform_settings*/
      32 && (c.waveform_settings = /*waveform_settings*/
      l[5]), u & /*waveform_options*/
      64 && (c.waveform_options = /*waveform_options*/
      l[6]), o.$set(c);
    },
    i(l) {
      r || (Ke(s), Ke(a), Ke(o.$$.fragment, l), r = !0);
    },
    o(l) {
      ft(s), ft(a), ft(o.$$.fragment, l), r = !1;
    },
    d(l) {
      l && (vi(e), vi(i)), s && s.d(), Yn(o, l);
    }
  };
}
function Um(t) {
  let e, n;
  return e = new mo({}), {
    c() {
      Jn(e.$$.fragment);
    },
    m(i, o) {
      Qn(e, i, o), n = !0;
    },
    i(i) {
      n || (Ke(e.$$.fragment, i), n = !0);
    },
    o(i) {
      ft(e.$$.fragment, i), n = !1;
    },
    d(i) {
      Yn(e, i);
    }
  };
}
function kl(t) {
  let e, n, i;
  return n = new _u({
    props: {
      href: (
        /*value*/
        t[0].file_data.url
      ),
      download: (
        /*value*/
        t[0].file_data.orig_name || /*value*/
        t[0].file_data.path
      ),
      $$slots: { default: [jm] },
      $$scope: { ctx: t }
    }
  }), {
    c() {
      e = vu("div"), Jn(n.$$.fragment), gu(e, "class", "download-button");
    },
    m(o, r) {
      wi(o, e, r), Qn(n, e, null), i = !0;
    },
    p(o, r) {
      const s = {};
      r & /*value*/
      1 && (s.href = /*value*/
      o[0].file_data.url), r & /*value*/
      1 && (s.download = /*value*/
      o[0].file_data.orig_name || /*value*/
      o[0].file_data.path), r & /*$$scope, i18n*/
      16400 && (s.$$scope = { dirty: r, ctx: o }), n.$set(s);
    },
    i(o) {
      i || (Ke(n.$$.fragment, o), i = !0);
    },
    o(o) {
      ft(n.$$.fragment, o), i = !1;
    },
    d(o) {
      o && vi(e), Yn(n);
    }
  };
}
function jm(t) {
  let e, n;
  return e = new Ei({
    props: {
      Icon: Ga,
      label: (
        /*i18n*/
        t[4]("common.download")
      )
    }
  }), {
    c() {
      Jn(e.$$.fragment);
    },
    m(i, o) {
      Qn(e, i, o), n = !0;
    },
    p(i, o) {
      const r = {};
      o & /*i18n*/
      16 && (r.label = /*i18n*/
      i[4]("common.download")), e.$set(r);
    },
    i(i) {
      n || (Ke(e.$$.fragment, i), n = !0);
    },
    o(i) {
      ft(e.$$.fragment, i), n = !1;
    },
    d(i) {
      Yn(e, i);
    }
  };
}
function Fm(t) {
  let e, n, i, o, r, s;
  e = new ja({
    props: {
      show_label: (
        /*show_label*/
        t[2]
      ),
      Icon: mo,
      float: !1,
      label: (
        /*label*/
        t[1] || /*i18n*/
        t[4]("audio.audio")
      )
    }
  });
  const a = [Im, Nm], l = [];
  function u(c, f) {
    return (
      /*value*/
      c[0] !== null ? 0 : 1
    );
  }
  return i = u(t), o = l[i] = a[i](t), {
    c() {
      Jn(e.$$.fragment), n = zr(), o.c(), r = Mm();
    },
    m(c, f) {
      Qn(e, c, f), wi(c, n, f), l[i].m(c, f), wi(c, r, f), s = !0;
    },
    p(c, [f]) {
      const h = {};
      f & /*show_label*/
      4 && (h.show_label = /*show_label*/
      c[2]), f & /*label, i18n*/
      18 && (h.label = /*label*/
      c[1] || /*i18n*/
      c[4]("audio.audio")), e.$set(h);
      let d = i;
      i = u(c), i === d ? l[i].p(c, f) : (wu(), ft(l[d], 1, 1, () => {
        l[d] = null;
      }), bu(), o = l[i], o ? o.p(c, f) : (o = l[i] = a[i](c), o.c()), Ke(o, 1), o.m(r.parentNode, r));
    },
    i(c) {
      s || (Ke(e.$$.fragment, c), Ke(o), s = !0);
    },
    o(c) {
      ft(e.$$.fragment, c), ft(o), s = !1;
    },
    d(c) {
      c && (vi(n), vi(r)), Yn(e, c), l[i].d(c);
    }
  };
}
let qm = !1;
function zm(t, e, n) {
  let { value: i = null } = e, { label: o } = e, { show_label: r = !0 } = e, { show_download_button: s = !0 } = e, { i18n: a } = e, { waveform_settings: l } = e, { waveform_options: u } = e;
  const c = Hm(), f = async (p) => p ? `<audio controls src="${await Ic(p.url, "url")}"></audio>` : "";
  function h(p) {
    ai.call(this, t, p);
  }
  function d(p) {
    ai.call(this, t, p);
  }
  function _(p) {
    ai.call(this, t, p);
  }
  function m(p) {
    ai.call(this, t, p);
  }
  function v(p) {
    ai.call(this, t, p);
  }
  return t.$$set = (p) => {
    "value" in p && n(0, i = p.value), "label" in p && n(1, o = p.label), "show_label" in p && n(2, r = p.show_label), "show_download_button" in p && n(3, s = p.show_download_button), "i18n" in p && n(4, a = p.i18n), "waveform_settings" in p && n(5, l = p.waveform_settings), "waveform_options" in p && n(6, u = p.waveform_options);
  }, t.$$.update = () => {
    t.$$.dirty & /*value*/
    1 && i && c("change", i);
  }, [
    i,
    o,
    r,
    s,
    a,
    l,
    u,
    f,
    h,
    d,
    _,
    m,
    v
  ];
}
class Gm extends Rm {
  constructor(e) {
    super(), Dm(this, e, zm, Fm, Om, {
      value: 0,
      label: 1,
      show_label: 2,
      show_download_button: 3,
      i18n: 4,
      waveform_settings: 5,
      waveform_options: 6
    });
  }
}
function an() {
}
function Wm(t) {
  return t();
}
function Vm(t) {
  t.forEach(Wm);
}
function Xm(t) {
  return typeof t == "function";
}
function Zm(t, e) {
  return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
}
function xm(t, ...e) {
  if (t == null) {
    for (const i of e)
      i(void 0);
    return an;
  }
  const n = t.subscribe(...e);
  return n.unsubscribe ? () => n.unsubscribe() : n;
}
const yu = typeof window < "u";
let El = yu ? () => window.performance.now() : () => Date.now(), ku = yu ? (t) => requestAnimationFrame(t) : an;
const Nn = /* @__PURE__ */ new Set();
function Eu(t) {
  Nn.forEach((e) => {
    e.c(t) || (Nn.delete(e), e.f());
  }), Nn.size !== 0 && ku(Eu);
}
function Jm(t) {
  let e;
  return Nn.size === 0 && ku(Eu), {
    promise: new Promise((n) => {
      Nn.add(e = { c: t, f: n });
    }),
    abort() {
      Nn.delete(e);
    }
  };
}
const Tn = [];
function Ym(t, e) {
  return {
    subscribe: Ai(t, e).subscribe
  };
}
function Ai(t, e = an) {
  let n;
  const i = /* @__PURE__ */ new Set();
  function o(a) {
    if (Zm(t, a) && (t = a, n)) {
      const l = !Tn.length;
      for (const u of i)
        u[1](), Tn.push(u, t);
      if (l) {
        for (let u = 0; u < Tn.length; u += 2)
          Tn[u][0](Tn[u + 1]);
        Tn.length = 0;
      }
    }
  }
  function r(a) {
    o(a(t));
  }
  function s(a, l = an) {
    const u = [a, l];
    return i.add(u), i.size === 1 && (n = e(o, r) || an), a(t), () => {
      i.delete(u), i.size === 0 && n && (n(), n = null);
    };
  }
  return { set: o, update: r, subscribe: s };
}
function Kn(t, e, n) {
  const i = !Array.isArray(t), o = i ? [t] : t;
  if (!o.every(Boolean))
    throw new Error("derived() expects stores as input, got a falsy value");
  const r = e.length < 2;
  return Ym(n, (s, a) => {
    let l = !1;
    const u = [];
    let c = 0, f = an;
    const h = () => {
      if (c)
        return;
      f();
      const _ = e(i ? u[0] : u, s, a);
      r ? s(_) : f = Xm(_) ? _ : an;
    }, d = o.map(
      (_, m) => xm(
        _,
        (v) => {
          u[m] = v, c &= ~(1 << m), l && h();
        },
        () => {
          c |= 1 << m;
        }
      )
    );
    return l = !0, h(), function() {
      Vm(d), f(), l = !1;
    };
  });
}
function Cl(t) {
  return Object.prototype.toString.call(t) === "[object Date]";
}
function Gr(t, e, n, i) {
  if (typeof n == "number" || Cl(n)) {
    const o = i - n, r = (n - e) / (t.dt || 1 / 60), s = t.opts.stiffness * o, a = t.opts.damping * r, l = (s - a) * t.inv_mass, u = (r + l) * t.dt;
    return Math.abs(u) < t.opts.precision && Math.abs(o) < t.opts.precision ? i : (t.settled = !1, Cl(n) ? new Date(n.getTime() + u) : n + u);
  } else {
    if (Array.isArray(n))
      return n.map(
        (o, r) => Gr(t, e[r], n[r], i[r])
      );
    if (typeof n == "object") {
      const o = {};
      for (const r in n)
        o[r] = Gr(t, e[r], n[r], i[r]);
      return o;
    } else
      throw new Error(`Cannot spring ${typeof n} values`);
  }
}
function Sl(t, e = {}) {
  const n = Ai(t), { stiffness: i = 0.15, damping: o = 0.8, precision: r = 0.01 } = e;
  let s, a, l, u = t, c = t, f = 1, h = 0, d = !1;
  function _(v, p = {}) {
    c = v;
    const k = l = {};
    return t == null || p.hard || m.stiffness >= 1 && m.damping >= 1 ? (d = !0, s = El(), u = v, n.set(t = c), Promise.resolve()) : (p.soft && (h = 1 / ((p.soft === !0 ? 0.5 : +p.soft) * 60), f = 0), a || (s = El(), d = !1, a = Jm((w) => {
      if (d)
        return d = !1, a = null, !1;
      f = Math.min(f + h, 1);
      const C = {
        inv_mass: f,
        opts: m,
        settled: !0,
        dt: (w - s) * 60 / 1e3
      }, T = Gr(C, u, t, c);
      return s = w, u = t, n.set(t = T), C.settled && (a = null), !C.settled;
    })), new Promise((w) => {
      a.promise.then(() => {
        k === l && w();
      });
    }));
  }
  const m = {
    set: _,
    update: (v, p) => _(v(c, t), p),
    subscribe: n.subscribe,
    stiffness: i,
    damping: o,
    precision: r
  };
  return m;
}
function Qm(t) {
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
}
var Km = function(e) {
  return $m(e) && !ep(e);
};
function $m(t) {
  return !!t && typeof t == "object";
}
function ep(t) {
  var e = Object.prototype.toString.call(t);
  return e === "[object RegExp]" || e === "[object Date]" || ip(t);
}
var tp = typeof Symbol == "function" && Symbol.for, np = tp ? Symbol.for("react.element") : 60103;
function ip(t) {
  return t.$$typeof === np;
}
function op(t) {
  return Array.isArray(t) ? [] : {};
}
function yi(t, e) {
  return e.clone !== !1 && e.isMergeableObject(t) ? Un(op(t), t, e) : t;
}
function rp(t, e, n) {
  return t.concat(e).map(function(i) {
    return yi(i, n);
  });
}
function sp(t, e) {
  if (!e.customMerge)
    return Un;
  var n = e.customMerge(t);
  return typeof n == "function" ? n : Un;
}
function lp(t) {
  return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(t).filter(function(e) {
    return Object.propertyIsEnumerable.call(t, e);
  }) : [];
}
function Al(t) {
  return Object.keys(t).concat(lp(t));
}
function Cu(t, e) {
  try {
    return e in t;
  } catch {
    return !1;
  }
}
function ap(t, e) {
  return Cu(t, e) && !(Object.hasOwnProperty.call(t, e) && Object.propertyIsEnumerable.call(t, e));
}
function up(t, e, n) {
  var i = {};
  return n.isMergeableObject(t) && Al(t).forEach(function(o) {
    i[o] = yi(t[o], n);
  }), Al(e).forEach(function(o) {
    ap(t, o) || (Cu(t, o) && n.isMergeableObject(e[o]) ? i[o] = sp(o, n)(t[o], e[o], n) : i[o] = yi(e[o], n));
  }), i;
}
function Un(t, e, n) {
  n = n || {}, n.arrayMerge = n.arrayMerge || rp, n.isMergeableObject = n.isMergeableObject || Km, n.cloneUnlessOtherwiseSpecified = yi;
  var i = Array.isArray(e), o = Array.isArray(t), r = i === o;
  return r ? i ? n.arrayMerge(t, e, n) : up(t, e, n) : yi(e, n);
}
Un.all = function(e, n) {
  if (!Array.isArray(e))
    throw new Error("first argument should be an array");
  return e.reduce(function(i, o) {
    return Un(i, o, n);
  }, {});
};
var cp = Un, fp = cp;
const dp = /* @__PURE__ */ Qm(fp);
var Wr = function(t, e) {
  return Wr = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
    n.__proto__ = i;
  } || function(n, i) {
    for (var o in i)
      Object.prototype.hasOwnProperty.call(i, o) && (n[o] = i[o]);
  }, Wr(t, e);
};
function Eo(t, e) {
  if (typeof e != "function" && e !== null)
    throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
  Wr(t, e);
  function n() {
    this.constructor = t;
  }
  t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
}
var ie = function() {
  return ie = Object.assign || function(e) {
    for (var n, i = 1, o = arguments.length; i < o; i++) {
      n = arguments[i];
      for (var r in n)
        Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
    }
    return e;
  }, ie.apply(this, arguments);
};
function mr(t, e, n) {
  if (n || arguments.length === 2)
    for (var i = 0, o = e.length, r; i < o; i++)
      (r || !(i in e)) && (r || (r = Array.prototype.slice.call(e, 0, i)), r[i] = e[i]);
  return t.concat(r || Array.prototype.slice.call(e));
}
var $;
(function(t) {
  t[t.EXPECT_ARGUMENT_CLOSING_BRACE = 1] = "EXPECT_ARGUMENT_CLOSING_BRACE", t[t.EMPTY_ARGUMENT = 2] = "EMPTY_ARGUMENT", t[t.MALFORMED_ARGUMENT = 3] = "MALFORMED_ARGUMENT", t[t.EXPECT_ARGUMENT_TYPE = 4] = "EXPECT_ARGUMENT_TYPE", t[t.INVALID_ARGUMENT_TYPE = 5] = "INVALID_ARGUMENT_TYPE", t[t.EXPECT_ARGUMENT_STYLE = 6] = "EXPECT_ARGUMENT_STYLE", t[t.INVALID_NUMBER_SKELETON = 7] = "INVALID_NUMBER_SKELETON", t[t.INVALID_DATE_TIME_SKELETON = 8] = "INVALID_DATE_TIME_SKELETON", t[t.EXPECT_NUMBER_SKELETON = 9] = "EXPECT_NUMBER_SKELETON", t[t.EXPECT_DATE_TIME_SKELETON = 10] = "EXPECT_DATE_TIME_SKELETON", t[t.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE = 11] = "UNCLOSED_QUOTE_IN_ARGUMENT_STYLE", t[t.EXPECT_SELECT_ARGUMENT_OPTIONS = 12] = "EXPECT_SELECT_ARGUMENT_OPTIONS", t[t.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE = 13] = "EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE", t[t.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE = 14] = "INVALID_PLURAL_ARGUMENT_OFFSET_VALUE", t[t.EXPECT_SELECT_ARGUMENT_SELECTOR = 15] = "EXPECT_SELECT_ARGUMENT_SELECTOR", t[t.EXPECT_PLURAL_ARGUMENT_SELECTOR = 16] = "EXPECT_PLURAL_ARGUMENT_SELECTOR", t[t.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT = 17] = "EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT", t[t.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT = 18] = "EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT", t[t.INVALID_PLURAL_ARGUMENT_SELECTOR = 19] = "INVALID_PLURAL_ARGUMENT_SELECTOR", t[t.DUPLICATE_PLURAL_ARGUMENT_SELECTOR = 20] = "DUPLICATE_PLURAL_ARGUMENT_SELECTOR", t[t.DUPLICATE_SELECT_ARGUMENT_SELECTOR = 21] = "DUPLICATE_SELECT_ARGUMENT_SELECTOR", t[t.MISSING_OTHER_CLAUSE = 22] = "MISSING_OTHER_CLAUSE", t[t.INVALID_TAG = 23] = "INVALID_TAG", t[t.INVALID_TAG_NAME = 25] = "INVALID_TAG_NAME", t[t.UNMATCHED_CLOSING_TAG = 26] = "UNMATCHED_CLOSING_TAG", t[t.UNCLOSED_TAG = 27] = "UNCLOSED_TAG";
})($ || ($ = {}));
var ce;
(function(t) {
  t[t.literal = 0] = "literal", t[t.argument = 1] = "argument", t[t.number = 2] = "number", t[t.date = 3] = "date", t[t.time = 4] = "time", t[t.select = 5] = "select", t[t.plural = 6] = "plural", t[t.pound = 7] = "pound", t[t.tag = 8] = "tag";
})(ce || (ce = {}));
var jn;
(function(t) {
  t[t.number = 0] = "number", t[t.dateTime = 1] = "dateTime";
})(jn || (jn = {}));
function Tl(t) {
  return t.type === ce.literal;
}
function hp(t) {
  return t.type === ce.argument;
}
function Su(t) {
  return t.type === ce.number;
}
function Au(t) {
  return t.type === ce.date;
}
function Tu(t) {
  return t.type === ce.time;
}
function Lu(t) {
  return t.type === ce.select;
}
function Pu(t) {
  return t.type === ce.plural;
}
function _p(t) {
  return t.type === ce.pound;
}
function Ru(t) {
  return t.type === ce.tag;
}
function Bu(t) {
  return !!(t && typeof t == "object" && t.type === jn.number);
}
function Vr(t) {
  return !!(t && typeof t == "object" && t.type === jn.dateTime);
}
var Mu = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/, mp = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;
function pp(t) {
  var e = {};
  return t.replace(mp, function(n) {
    var i = n.length;
    switch (n[0]) {
      case "G":
        e.era = i === 4 ? "long" : i === 5 ? "narrow" : "short";
        break;
      case "y":
        e.year = i === 2 ? "2-digit" : "numeric";
        break;
      case "Y":
      case "u":
      case "U":
      case "r":
        throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");
      case "q":
      case "Q":
        throw new RangeError("`q/Q` (quarter) patterns are not supported");
      case "M":
      case "L":
        e.month = ["numeric", "2-digit", "short", "long", "narrow"][i - 1];
        break;
      case "w":
      case "W":
        throw new RangeError("`w/W` (week) patterns are not supported");
      case "d":
        e.day = ["numeric", "2-digit"][i - 1];
        break;
      case "D":
      case "F":
      case "g":
        throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");
      case "E":
        e.weekday = i === 4 ? "short" : i === 5 ? "narrow" : "short";
        break;
      case "e":
        if (i < 4)
          throw new RangeError("`e..eee` (weekday) patterns are not supported");
        e.weekday = ["short", "long", "narrow", "short"][i - 4];
        break;
      case "c":
        if (i < 4)
          throw new RangeError("`c..ccc` (weekday) patterns are not supported");
        e.weekday = ["short", "long", "narrow", "short"][i - 4];
        break;
      case "a":
        e.hour12 = !0;
        break;
      case "b":
      case "B":
        throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");
      case "h":
        e.hourCycle = "h12", e.hour = ["numeric", "2-digit"][i - 1];
        break;
      case "H":
        e.hourCycle = "h23", e.hour = ["numeric", "2-digit"][i - 1];
        break;
      case "K":
        e.hourCycle = "h11", e.hour = ["numeric", "2-digit"][i - 1];
        break;
      case "k":
        e.hourCycle = "h24", e.hour = ["numeric", "2-digit"][i - 1];
        break;
      case "j":
      case "J":
      case "C":
        throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");
      case "m":
        e.minute = ["numeric", "2-digit"][i - 1];
        break;
      case "s":
        e.second = ["numeric", "2-digit"][i - 1];
        break;
      case "S":
      case "A":
        throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");
      case "z":
        e.timeZoneName = i < 4 ? "short" : "long";
        break;
      case "Z":
      case "O":
      case "v":
      case "V":
      case "X":
      case "x":
        throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead");
    }
    return "";
  }), e;
}
var gp = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i;
function bp(t) {
  if (t.length === 0)
    throw new Error("Number skeleton cannot be empty");
  for (var e = t.split(gp).filter(function(h) {
    return h.length > 0;
  }), n = [], i = 0, o = e; i < o.length; i++) {
    var r = o[i], s = r.split("/");
    if (s.length === 0)
      throw new Error("Invalid number skeleton");
    for (var a = s[0], l = s.slice(1), u = 0, c = l; u < c.length; u++) {
      var f = c[u];
      if (f.length === 0)
        throw new Error("Invalid number skeleton");
    }
    n.push({ stem: a, options: l });
  }
  return n;
}
function vp(t) {
  return t.replace(/^(.*?)-/, "");
}
var Ll = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g, Du = /^(@+)?(\+|#+)?[rs]?$/g, wp = /(\*)(0+)|(#+)(0+)|(0+)/g, Ou = /^(0+)$/;
function Pl(t) {
  var e = {};
  return t[t.length - 1] === "r" ? e.roundingPriority = "morePrecision" : t[t.length - 1] === "s" && (e.roundingPriority = "lessPrecision"), t.replace(Du, function(n, i, o) {
    return typeof o != "string" ? (e.minimumSignificantDigits = i.length, e.maximumSignificantDigits = i.length) : o === "+" ? e.minimumSignificantDigits = i.length : i[0] === "#" ? e.maximumSignificantDigits = i.length : (e.minimumSignificantDigits = i.length, e.maximumSignificantDigits = i.length + (typeof o == "string" ? o.length : 0)), "";
  }), e;
}
function Hu(t) {
  switch (t) {
    case "sign-auto":
      return {
        signDisplay: "auto"
      };
    case "sign-accounting":
    case "()":
      return {
        currencySign: "accounting"
      };
    case "sign-always":
    case "+!":
      return {
        signDisplay: "always"
      };
    case "sign-accounting-always":
    case "()!":
      return {
        signDisplay: "always",
        currencySign: "accounting"
      };
    case "sign-except-zero":
    case "+?":
      return {
        signDisplay: "exceptZero"
      };
    case "sign-accounting-except-zero":
    case "()?":
      return {
        signDisplay: "exceptZero",
        currencySign: "accounting"
      };
    case "sign-never":
    case "+_":
      return {
        signDisplay: "never"
      };
  }
}
function yp(t) {
  var e;
  if (t[0] === "E" && t[1] === "E" ? (e = {
    notation: "engineering"
  }, t = t.slice(2)) : t[0] === "E" && (e = {
    notation: "scientific"
  }, t = t.slice(1)), e) {
    var n = t.slice(0, 2);
    if (n === "+!" ? (e.signDisplay = "always", t = t.slice(2)) : n === "+?" && (e.signDisplay = "exceptZero", t = t.slice(2)), !Ou.test(t))
      throw new Error("Malformed concise eng/scientific notation");
    e.minimumIntegerDigits = t.length;
  }
  return e;
}
function Rl(t) {
  var e = {}, n = Hu(t);
  return n || e;
}
function kp(t) {
  for (var e = {}, n = 0, i = t; n < i.length; n++) {
    var o = i[n];
    switch (o.stem) {
      case "percent":
      case "%":
        e.style = "percent";
        continue;
      case "%x100":
        e.style = "percent", e.scale = 100;
        continue;
      case "currency":
        e.style = "currency", e.currency = o.options[0];
        continue;
      case "group-off":
      case ",_":
        e.useGrouping = !1;
        continue;
      case "precision-integer":
      case ".":
        e.maximumFractionDigits = 0;
        continue;
      case "measure-unit":
      case "unit":
        e.style = "unit", e.unit = vp(o.options[0]);
        continue;
      case "compact-short":
      case "K":
        e.notation = "compact", e.compactDisplay = "short";
        continue;
      case "compact-long":
      case "KK":
        e.notation = "compact", e.compactDisplay = "long";
        continue;
      case "scientific":
        e = ie(ie(ie({}, e), { notation: "scientific" }), o.options.reduce(function(l, u) {
          return ie(ie({}, l), Rl(u));
        }, {}));
        continue;
      case "engineering":
        e = ie(ie(ie({}, e), { notation: "engineering" }), o.options.reduce(function(l, u) {
          return ie(ie({}, l), Rl(u));
        }, {}));
        continue;
      case "notation-simple":
        e.notation = "standard";
        continue;
      case "unit-width-narrow":
        e.currencyDisplay = "narrowSymbol", e.unitDisplay = "narrow";
        continue;
      case "unit-width-short":
        e.currencyDisplay = "code", e.unitDisplay = "short";
        continue;
      case "unit-width-full-name":
        e.currencyDisplay = "name", e.unitDisplay = "long";
        continue;
      case "unit-width-iso-code":
        e.currencyDisplay = "symbol";
        continue;
      case "scale":
        e.scale = parseFloat(o.options[0]);
        continue;
      case "integer-width":
        if (o.options.length > 1)
          throw new RangeError("integer-width stems only accept a single optional option");
        o.options[0].replace(wp, function(l, u, c, f, h, d) {
          if (u)
            e.minimumIntegerDigits = c.length;
          else {
            if (f && h)
              throw new Error("We currently do not support maximum integer digits");
            if (d)
              throw new Error("We currently do not support exact integer digits");
          }
          return "";
        });
        continue;
    }
    if (Ou.test(o.stem)) {
      e.minimumIntegerDigits = o.stem.length;
      continue;
    }
    if (Ll.test(o.stem)) {
      if (o.options.length > 1)
        throw new RangeError("Fraction-precision stems only accept a single optional option");
      o.stem.replace(Ll, function(l, u, c, f, h, d) {
        return c === "*" ? e.minimumFractionDigits = u.length : f && f[0] === "#" ? e.maximumFractionDigits = f.length : h && d ? (e.minimumFractionDigits = h.length, e.maximumFractionDigits = h.length + d.length) : (e.minimumFractionDigits = u.length, e.maximumFractionDigits = u.length), "";
      });
      var r = o.options[0];
      r === "w" ? e = ie(ie({}, e), { trailingZeroDisplay: "stripIfInteger" }) : r && (e = ie(ie({}, e), Pl(r)));
      continue;
    }
    if (Du.test(o.stem)) {
      e = ie(ie({}, e), Pl(o.stem));
      continue;
    }
    var s = Hu(o.stem);
    s && (e = ie(ie({}, e), s));
    var a = yp(o.stem);
    a && (e = ie(ie({}, e), a));
  }
  return e;
}
var xi = {
  AX: [
    "H"
  ],
  BQ: [
    "H"
  ],
  CP: [
    "H"
  ],
  CZ: [
    "H"
  ],
  DK: [
    "H"
  ],
  FI: [
    "H"
  ],
  ID: [
    "H"
  ],
  IS: [
    "H"
  ],
  ML: [
    "H"
  ],
  NE: [
    "H"
  ],
  RU: [
    "H"
  ],
  SE: [
    "H"
  ],
  SJ: [
    "H"
  ],
  SK: [
    "H"
  ],
  AS: [
    "h",
    "H"
  ],
  BT: [
    "h",
    "H"
  ],
  DJ: [
    "h",
    "H"
  ],
  ER: [
    "h",
    "H"
  ],
  GH: [
    "h",
    "H"
  ],
  IN: [
    "h",
    "H"
  ],
  LS: [
    "h",
    "H"
  ],
  PG: [
    "h",
    "H"
  ],
  PW: [
    "h",
    "H"
  ],
  SO: [
    "h",
    "H"
  ],
  TO: [
    "h",
    "H"
  ],
  VU: [
    "h",
    "H"
  ],
  WS: [
    "h",
    "H"
  ],
  "001": [
    "H",
    "h"
  ],
  AL: [
    "h",
    "H",
    "hB"
  ],
  TD: [
    "h",
    "H",
    "hB"
  ],
  "ca-ES": [
    "H",
    "h",
    "hB"
  ],
  CF: [
    "H",
    "h",
    "hB"
  ],
  CM: [
    "H",
    "h",
    "hB"
  ],
  "fr-CA": [
    "H",
    "h",
    "hB"
  ],
  "gl-ES": [
    "H",
    "h",
    "hB"
  ],
  "it-CH": [
    "H",
    "h",
    "hB"
  ],
  "it-IT": [
    "H",
    "h",
    "hB"
  ],
  LU: [
    "H",
    "h",
    "hB"
  ],
  NP: [
    "H",
    "h",
    "hB"
  ],
  PF: [
    "H",
    "h",
    "hB"
  ],
  SC: [
    "H",
    "h",
    "hB"
  ],
  SM: [
    "H",
    "h",
    "hB"
  ],
  SN: [
    "H",
    "h",
    "hB"
  ],
  TF: [
    "H",
    "h",
    "hB"
  ],
  VA: [
    "H",
    "h",
    "hB"
  ],
  CY: [
    "h",
    "H",
    "hb",
    "hB"
  ],
  GR: [
    "h",
    "H",
    "hb",
    "hB"
  ],
  CO: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  DO: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  KP: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  KR: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  NA: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  PA: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  PR: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  VE: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  AC: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  AI: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  BW: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  BZ: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  CC: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  CK: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  CX: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  DG: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  FK: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  GB: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  GG: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  GI: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  IE: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  IM: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  IO: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  JE: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  LT: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  MK: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  MN: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  MS: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  NF: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  NG: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  NR: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  NU: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  PN: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  SH: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  SX: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  TA: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  ZA: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  "af-ZA": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  AR: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  CL: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  CR: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  CU: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  EA: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-BO": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-BR": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-EC": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-ES": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-GQ": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-PE": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  GT: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  HN: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  IC: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  KG: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  KM: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  LK: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  MA: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  MX: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  NI: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  PY: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  SV: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  UY: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  JP: [
    "H",
    "h",
    "K"
  ],
  AD: [
    "H",
    "hB"
  ],
  AM: [
    "H",
    "hB"
  ],
  AO: [
    "H",
    "hB"
  ],
  AT: [
    "H",
    "hB"
  ],
  AW: [
    "H",
    "hB"
  ],
  BE: [
    "H",
    "hB"
  ],
  BF: [
    "H",
    "hB"
  ],
  BJ: [
    "H",
    "hB"
  ],
  BL: [
    "H",
    "hB"
  ],
  BR: [
    "H",
    "hB"
  ],
  CG: [
    "H",
    "hB"
  ],
  CI: [
    "H",
    "hB"
  ],
  CV: [
    "H",
    "hB"
  ],
  DE: [
    "H",
    "hB"
  ],
  EE: [
    "H",
    "hB"
  ],
  FR: [
    "H",
    "hB"
  ],
  GA: [
    "H",
    "hB"
  ],
  GF: [
    "H",
    "hB"
  ],
  GN: [
    "H",
    "hB"
  ],
  GP: [
    "H",
    "hB"
  ],
  GW: [
    "H",
    "hB"
  ],
  HR: [
    "H",
    "hB"
  ],
  IL: [
    "H",
    "hB"
  ],
  IT: [
    "H",
    "hB"
  ],
  KZ: [
    "H",
    "hB"
  ],
  MC: [
    "H",
    "hB"
  ],
  MD: [
    "H",
    "hB"
  ],
  MF: [
    "H",
    "hB"
  ],
  MQ: [
    "H",
    "hB"
  ],
  MZ: [
    "H",
    "hB"
  ],
  NC: [
    "H",
    "hB"
  ],
  NL: [
    "H",
    "hB"
  ],
  PM: [
    "H",
    "hB"
  ],
  PT: [
    "H",
    "hB"
  ],
  RE: [
    "H",
    "hB"
  ],
  RO: [
    "H",
    "hB"
  ],
  SI: [
    "H",
    "hB"
  ],
  SR: [
    "H",
    "hB"
  ],
  ST: [
    "H",
    "hB"
  ],
  TG: [
    "H",
    "hB"
  ],
  TR: [
    "H",
    "hB"
  ],
  WF: [
    "H",
    "hB"
  ],
  YT: [
    "H",
    "hB"
  ],
  BD: [
    "h",
    "hB",
    "H"
  ],
  PK: [
    "h",
    "hB",
    "H"
  ],
  AZ: [
    "H",
    "hB",
    "h"
  ],
  BA: [
    "H",
    "hB",
    "h"
  ],
  BG: [
    "H",
    "hB",
    "h"
  ],
  CH: [
    "H",
    "hB",
    "h"
  ],
  GE: [
    "H",
    "hB",
    "h"
  ],
  LI: [
    "H",
    "hB",
    "h"
  ],
  ME: [
    "H",
    "hB",
    "h"
  ],
  RS: [
    "H",
    "hB",
    "h"
  ],
  UA: [
    "H",
    "hB",
    "h"
  ],
  UZ: [
    "H",
    "hB",
    "h"
  ],
  XK: [
    "H",
    "hB",
    "h"
  ],
  AG: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  AU: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  BB: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  BM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  BS: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  CA: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  DM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  "en-001": [
    "h",
    "hb",
    "H",
    "hB"
  ],
  FJ: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  FM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  GD: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  GM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  GU: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  GY: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  JM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  KI: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  KN: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  KY: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  LC: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  LR: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  MH: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  MP: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  MW: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  NZ: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  SB: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  SG: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  SL: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  SS: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  SZ: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  TC: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  TT: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  UM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  US: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  VC: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  VG: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  VI: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  ZM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  BO: [
    "H",
    "hB",
    "h",
    "hb"
  ],
  EC: [
    "H",
    "hB",
    "h",
    "hb"
  ],
  ES: [
    "H",
    "hB",
    "h",
    "hb"
  ],
  GQ: [
    "H",
    "hB",
    "h",
    "hb"
  ],
  PE: [
    "H",
    "hB",
    "h",
    "hb"
  ],
  AE: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  "ar-001": [
    "h",
    "hB",
    "hb",
    "H"
  ],
  BH: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  DZ: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  EG: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  EH: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  HK: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  IQ: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  JO: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  KW: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  LB: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  LY: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  MO: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  MR: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  OM: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  PH: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  PS: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  QA: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  SA: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  SD: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  SY: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  TN: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  YE: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  AF: [
    "H",
    "hb",
    "hB",
    "h"
  ],
  LA: [
    "H",
    "hb",
    "hB",
    "h"
  ],
  CN: [
    "H",
    "hB",
    "hb",
    "h"
  ],
  LV: [
    "H",
    "hB",
    "hb",
    "h"
  ],
  TL: [
    "H",
    "hB",
    "hb",
    "h"
  ],
  "zu-ZA": [
    "H",
    "hB",
    "hb",
    "h"
  ],
  CD: [
    "hB",
    "H"
  ],
  IR: [
    "hB",
    "H"
  ],
  "hi-IN": [
    "hB",
    "h",
    "H"
  ],
  "kn-IN": [
    "hB",
    "h",
    "H"
  ],
  "ml-IN": [
    "hB",
    "h",
    "H"
  ],
  "te-IN": [
    "hB",
    "h",
    "H"
  ],
  KH: [
    "hB",
    "h",
    "H",
    "hb"
  ],
  "ta-IN": [
    "hB",
    "h",
    "hb",
    "H"
  ],
  BN: [
    "hb",
    "hB",
    "h",
    "H"
  ],
  MY: [
    "hb",
    "hB",
    "h",
    "H"
  ],
  ET: [
    "hB",
    "hb",
    "h",
    "H"
  ],
  "gu-IN": [
    "hB",
    "hb",
    "h",
    "H"
  ],
  "mr-IN": [
    "hB",
    "hb",
    "h",
    "H"
  ],
  "pa-IN": [
    "hB",
    "hb",
    "h",
    "H"
  ],
  TW: [
    "hB",
    "hb",
    "h",
    "H"
  ],
  KE: [
    "hB",
    "hb",
    "H",
    "h"
  ],
  MM: [
    "hB",
    "hb",
    "H",
    "h"
  ],
  TZ: [
    "hB",
    "hb",
    "H",
    "h"
  ],
  UG: [
    "hB",
    "hb",
    "H",
    "h"
  ]
};
function Ep(t, e) {
  for (var n = "", i = 0; i < t.length; i++) {
    var o = t.charAt(i);
    if (o === "j") {
      for (var r = 0; i + 1 < t.length && t.charAt(i + 1) === o; )
        r++, i++;
      var s = 1 + (r & 1), a = r < 2 ? 1 : 3 + (r >> 1), l = "a", u = Cp(e);
      for ((u == "H" || u == "k") && (a = 0); a-- > 0; )
        n += l;
      for (; s-- > 0; )
        n = u + n;
    } else
      o === "J" ? n += "H" : n += o;
  }
  return n;
}
function Cp(t) {
  var e = t.hourCycle;
  if (e === void 0 && // @ts-ignore hourCycle(s) is not identified yet
  t.hourCycles && // @ts-ignore
  t.hourCycles.length && (e = t.hourCycles[0]), e)
    switch (e) {
      case "h24":
        return "k";
      case "h23":
        return "H";
      case "h12":
        return "h";
      case "h11":
        return "K";
      default:
        throw new Error("Invalid hourCycle");
    }
  var n = t.language, i;
  n !== "root" && (i = t.maximize().region);
  var o = xi[i || ""] || xi[n || ""] || xi["".concat(n, "-001")] || xi["001"];
  return o[0];
}
var pr, Sp = new RegExp("^".concat(Mu.source, "*")), Ap = new RegExp("".concat(Mu.source, "*$"));
function te(t, e) {
  return { start: t, end: e };
}
var Tp = !!String.prototype.startsWith, Lp = !!String.fromCodePoint, Pp = !!Object.fromEntries, Rp = !!String.prototype.codePointAt, Bp = !!String.prototype.trimStart, Mp = !!String.prototype.trimEnd, Dp = !!Number.isSafeInteger, Op = Dp ? Number.isSafeInteger : function(t) {
  return typeof t == "number" && isFinite(t) && Math.floor(t) === t && Math.abs(t) <= 9007199254740991;
}, Xr = !0;
try {
  var Hp = Iu("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu");
  Xr = ((pr = Hp.exec("a")) === null || pr === void 0 ? void 0 : pr[0]) === "a";
} catch {
  Xr = !1;
}
var Bl = Tp ? (
  // Native
  function(e, n, i) {
    return e.startsWith(n, i);
  }
) : (
  // For IE11
  function(e, n, i) {
    return e.slice(i, i + n.length) === n;
  }
), Zr = Lp ? String.fromCodePoint : (
  // IE11
  function() {
    for (var e = [], n = 0; n < arguments.length; n++)
      e[n] = arguments[n];
    for (var i = "", o = e.length, r = 0, s; o > r; ) {
      if (s = e[r++], s > 1114111)
        throw RangeError(s + " is not a valid code point");
      i += s < 65536 ? String.fromCharCode(s) : String.fromCharCode(((s -= 65536) >> 10) + 55296, s % 1024 + 56320);
    }
    return i;
  }
), Ml = (
  // native
  Pp ? Object.fromEntries : (
    // Ponyfill
    function(e) {
      for (var n = {}, i = 0, o = e; i < o.length; i++) {
        var r = o[i], s = r[0], a = r[1];
        n[s] = a;
      }
      return n;
    }
  )
), Nu = Rp ? (
  // Native
  function(e, n) {
    return e.codePointAt(n);
  }
) : (
  // IE 11
  function(e, n) {
    var i = e.length;
    if (!(n < 0 || n >= i)) {
      var o = e.charCodeAt(n), r;
      return o < 55296 || o > 56319 || n + 1 === i || (r = e.charCodeAt(n + 1)) < 56320 || r > 57343 ? o : (o - 55296 << 10) + (r - 56320) + 65536;
    }
  }
), Np = Bp ? (
  // Native
  function(e) {
    return e.trimStart();
  }
) : (
  // Ponyfill
  function(e) {
    return e.replace(Sp, "");
  }
), Ip = Mp ? (
  // Native
  function(e) {
    return e.trimEnd();
  }
) : (
  // Ponyfill
  function(e) {
    return e.replace(Ap, "");
  }
);
function Iu(t, e) {
  return new RegExp(t, e);
}
var xr;
if (Xr) {
  var Dl = Iu("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu");
  xr = function(e, n) {
    var i;
    Dl.lastIndex = n;
    var o = Dl.exec(e);
    return (i = o[1]) !== null && i !== void 0 ? i : "";
  };
} else
  xr = function(e, n) {
    for (var i = []; ; ) {
      var o = Nu(e, n);
      if (o === void 0 || Uu(o) || qp(o))
        break;
      i.push(o), n += o >= 65536 ? 2 : 1;
    }
    return Zr.apply(void 0, i);
  };
var Up = (
  /** @class */
  function() {
    function t(e, n) {
      n === void 0 && (n = {}), this.message = e, this.position = { offset: 0, line: 1, column: 1 }, this.ignoreTag = !!n.ignoreTag, this.locale = n.locale, this.requiresOtherClause = !!n.requiresOtherClause, this.shouldParseSkeletons = !!n.shouldParseSkeletons;
    }
    return t.prototype.parse = function() {
      if (this.offset() !== 0)
        throw Error("parser can only be used once");
      return this.parseMessage(0, "", !1);
    }, t.prototype.parseMessage = function(e, n, i) {
      for (var o = []; !this.isEOF(); ) {
        var r = this.char();
        if (r === 123) {
          var s = this.parseArgument(e, i);
          if (s.err)
            return s;
          o.push(s.val);
        } else {
          if (r === 125 && e > 0)
            break;
          if (r === 35 && (n === "plural" || n === "selectordinal")) {
            var a = this.clonePosition();
            this.bump(), o.push({
              type: ce.pound,
              location: te(a, this.clonePosition())
            });
          } else if (r === 60 && !this.ignoreTag && this.peek() === 47) {
            if (i)
              break;
            return this.error($.UNMATCHED_CLOSING_TAG, te(this.clonePosition(), this.clonePosition()));
          } else if (r === 60 && !this.ignoreTag && Jr(this.peek() || 0)) {
            var s = this.parseTag(e, n);
            if (s.err)
              return s;
            o.push(s.val);
          } else {
            var s = this.parseLiteral(e, n);
            if (s.err)
              return s;
            o.push(s.val);
          }
        }
      }
      return { val: o, err: null };
    }, t.prototype.parseTag = function(e, n) {
      var i = this.clonePosition();
      this.bump();
      var o = this.parseTagName();
      if (this.bumpSpace(), this.bumpIf("/>"))
        return {
          val: {
            type: ce.literal,
            value: "<".concat(o, "/>"),
            location: te(i, this.clonePosition())
          },
          err: null
        };
      if (this.bumpIf(">")) {
        var r = this.parseMessage(e + 1, n, !0);
        if (r.err)
          return r;
        var s = r.val, a = this.clonePosition();
        if (this.bumpIf("</")) {
          if (this.isEOF() || !Jr(this.char()))
            return this.error($.INVALID_TAG, te(a, this.clonePosition()));
          var l = this.clonePosition(), u = this.parseTagName();
          return o !== u ? this.error($.UNMATCHED_CLOSING_TAG, te(l, this.clonePosition())) : (this.bumpSpace(), this.bumpIf(">") ? {
            val: {
              type: ce.tag,
              value: o,
              children: s,
              location: te(i, this.clonePosition())
            },
            err: null
          } : this.error($.INVALID_TAG, te(a, this.clonePosition())));
        } else
          return this.error($.UNCLOSED_TAG, te(i, this.clonePosition()));
      } else
        return this.error($.INVALID_TAG, te(i, this.clonePosition()));
    }, t.prototype.parseTagName = function() {
      var e = this.offset();
      for (this.bump(); !this.isEOF() && Fp(this.char()); )
        this.bump();
      return this.message.slice(e, this.offset());
    }, t.prototype.parseLiteral = function(e, n) {
      for (var i = this.clonePosition(), o = ""; ; ) {
        var r = this.tryParseQuote(n);
        if (r) {
          o += r;
          continue;
        }
        var s = this.tryParseUnquoted(e, n);
        if (s) {
          o += s;
          continue;
        }
        var a = this.tryParseLeftAngleBracket();
        if (a) {
          o += a;
          continue;
        }
        break;
      }
      var l = te(i, this.clonePosition());
      return {
        val: { type: ce.literal, value: o, location: l },
        err: null
      };
    }, t.prototype.tryParseLeftAngleBracket = function() {
      return !this.isEOF() && this.char() === 60 && (this.ignoreTag || // If at the opening tag or closing tag position, bail.
      !jp(this.peek() || 0)) ? (this.bump(), "<") : null;
    }, t.prototype.tryParseQuote = function(e) {
      if (this.isEOF() || this.char() !== 39)
        return null;
      switch (this.peek()) {
        case 39:
          return this.bump(), this.bump(), "'";
        case 123:
        case 60:
        case 62:
        case 125:
          break;
        case 35:
          if (e === "plural" || e === "selectordinal")
            break;
          return null;
        default:
          return null;
      }
      this.bump();
      var n = [this.char()];
      for (this.bump(); !this.isEOF(); ) {
        var i = this.char();
        if (i === 39)
          if (this.peek() === 39)
            n.push(39), this.bump();
          else {
            this.bump();
            break;
          }
        else
          n.push(i);
        this.bump();
      }
      return Zr.apply(void 0, n);
    }, t.prototype.tryParseUnquoted = function(e, n) {
      if (this.isEOF())
        return null;
      var i = this.char();
      return i === 60 || i === 123 || i === 35 && (n === "plural" || n === "selectordinal") || i === 125 && e > 0 ? null : (this.bump(), Zr(i));
    }, t.prototype.parseArgument = function(e, n) {
      var i = this.clonePosition();
      if (this.bump(), this.bumpSpace(), this.isEOF())
        return this.error($.EXPECT_ARGUMENT_CLOSING_BRACE, te(i, this.clonePosition()));
      if (this.char() === 125)
        return this.bump(), this.error($.EMPTY_ARGUMENT, te(i, this.clonePosition()));
      var o = this.parseIdentifierIfPossible().value;
      if (!o)
        return this.error($.MALFORMED_ARGUMENT, te(i, this.clonePosition()));
      if (this.bumpSpace(), this.isEOF())
        return this.error($.EXPECT_ARGUMENT_CLOSING_BRACE, te(i, this.clonePosition()));
      switch (this.char()) {
        case 125:
          return this.bump(), {
            val: {
              type: ce.argument,
              // value does not include the opening and closing braces.
              value: o,
              location: te(i, this.clonePosition())
            },
            err: null
          };
        case 44:
          return this.bump(), this.bumpSpace(), this.isEOF() ? this.error($.EXPECT_ARGUMENT_CLOSING_BRACE, te(i, this.clonePosition())) : this.parseArgumentOptions(e, n, o, i);
        default:
          return this.error($.MALFORMED_ARGUMENT, te(i, this.clonePosition()));
      }
    }, t.prototype.parseIdentifierIfPossible = function() {
      var e = this.clonePosition(), n = this.offset(), i = xr(this.message, n), o = n + i.length;
      this.bumpTo(o);
      var r = this.clonePosition(), s = te(e, r);
      return { value: i, location: s };
    }, t.prototype.parseArgumentOptions = function(e, n, i, o) {
      var r, s = this.clonePosition(), a = this.parseIdentifierIfPossible().value, l = this.clonePosition();
      switch (a) {
        case "":
          return this.error($.EXPECT_ARGUMENT_TYPE, te(s, l));
        case "number":
        case "date":
        case "time": {
          this.bumpSpace();
          var u = null;
          if (this.bumpIf(",")) {
            this.bumpSpace();
            var c = this.clonePosition(), f = this.parseSimpleArgStyleIfPossible();
            if (f.err)
              return f;
            var h = Ip(f.val);
            if (h.length === 0)
              return this.error($.EXPECT_ARGUMENT_STYLE, te(this.clonePosition(), this.clonePosition()));
            var d = te(c, this.clonePosition());
            u = { style: h, styleLocation: d };
          }
          var _ = this.tryParseArgumentClose(o);
          if (_.err)
            return _;
          var m = te(o, this.clonePosition());
          if (u && Bl(u == null ? void 0 : u.style, "::", 0)) {
            var v = Np(u.style.slice(2));
            if (a === "number") {
              var f = this.parseNumberSkeletonFromString(v, u.styleLocation);
              return f.err ? f : {
                val: { type: ce.number, value: i, location: m, style: f.val },
                err: null
              };
            } else {
              if (v.length === 0)
                return this.error($.EXPECT_DATE_TIME_SKELETON, m);
              var p = v;
              this.locale && (p = Ep(v, this.locale));
              var h = {
                type: jn.dateTime,
                pattern: p,
                location: u.styleLocation,
                parsedOptions: this.shouldParseSkeletons ? pp(p) : {}
              }, k = a === "date" ? ce.date : ce.time;
              return {
                val: { type: k, value: i, location: m, style: h },
                err: null
              };
            }
          }
          return {
            val: {
              type: a === "number" ? ce.number : a === "date" ? ce.date : ce.time,
              value: i,
              location: m,
              style: (r = u == null ? void 0 : u.style) !== null && r !== void 0 ? r : null
            },
            err: null
          };
        }
        case "plural":
        case "selectordinal":
        case "select": {
          var w = this.clonePosition();
          if (this.bumpSpace(), !this.bumpIf(","))
            return this.error($.EXPECT_SELECT_ARGUMENT_OPTIONS, te(w, ie({}, w)));
          this.bumpSpace();
          var C = this.parseIdentifierIfPossible(), T = 0;
          if (a !== "select" && C.value === "offset") {
            if (!this.bumpIf(":"))
              return this.error($.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, te(this.clonePosition(), this.clonePosition()));
            this.bumpSpace();
            var f = this.tryParseDecimalInteger($.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, $.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);
            if (f.err)
              return f;
            this.bumpSpace(), C = this.parseIdentifierIfPossible(), T = f.val;
          }
          var y = this.tryParsePluralOrSelectOptions(e, a, n, C);
          if (y.err)
            return y;
          var _ = this.tryParseArgumentClose(o);
          if (_.err)
            return _;
          var O = te(o, this.clonePosition());
          return a === "select" ? {
            val: {
              type: ce.select,
              value: i,
              options: Ml(y.val),
              location: O
            },
            err: null
          } : {
            val: {
              type: ce.plural,
              value: i,
              options: Ml(y.val),
              offset: T,
              pluralType: a === "plural" ? "cardinal" : "ordinal",
              location: O
            },
            err: null
          };
        }
        default:
          return this.error($.INVALID_ARGUMENT_TYPE, te(s, l));
      }
    }, t.prototype.tryParseArgumentClose = function(e) {
      return this.isEOF() || this.char() !== 125 ? this.error($.EXPECT_ARGUMENT_CLOSING_BRACE, te(e, this.clonePosition())) : (this.bump(), { val: !0, err: null });
    }, t.prototype.parseSimpleArgStyleIfPossible = function() {
      for (var e = 0, n = this.clonePosition(); !this.isEOF(); ) {
        var i = this.char();
        switch (i) {
          case 39: {
            this.bump();
            var o = this.clonePosition();
            if (!this.bumpUntil("'"))
              return this.error($.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, te(o, this.clonePosition()));
            this.bump();
            break;
          }
          case 123: {
            e += 1, this.bump();
            break;
          }
          case 125: {
            if (e > 0)
              e -= 1;
            else
              return {
                val: this.message.slice(n.offset, this.offset()),
                err: null
              };
            break;
          }
          default:
            this.bump();
            break;
        }
      }
      return {
        val: this.message.slice(n.offset, this.offset()),
        err: null
      };
    }, t.prototype.parseNumberSkeletonFromString = function(e, n) {
      var i = [];
      try {
        i = bp(e);
      } catch {
        return this.error($.INVALID_NUMBER_SKELETON, n);
      }
      return {
        val: {
          type: jn.number,
          tokens: i,
          location: n,
          parsedOptions: this.shouldParseSkeletons ? kp(i) : {}
        },
        err: null
      };
    }, t.prototype.tryParsePluralOrSelectOptions = function(e, n, i, o) {
      for (var r, s = !1, a = [], l = /* @__PURE__ */ new Set(), u = o.value, c = o.location; ; ) {
        if (u.length === 0) {
          var f = this.clonePosition();
          if (n !== "select" && this.bumpIf("=")) {
            var h = this.tryParseDecimalInteger($.EXPECT_PLURAL_ARGUMENT_SELECTOR, $.INVALID_PLURAL_ARGUMENT_SELECTOR);
            if (h.err)
              return h;
            c = te(f, this.clonePosition()), u = this.message.slice(f.offset, this.offset());
          } else
            break;
        }
        if (l.has(u))
          return this.error(n === "select" ? $.DUPLICATE_SELECT_ARGUMENT_SELECTOR : $.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, c);
        u === "other" && (s = !0), this.bumpSpace();
        var d = this.clonePosition();
        if (!this.bumpIf("{"))
          return this.error(n === "select" ? $.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT : $.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, te(this.clonePosition(), this.clonePosition()));
        var _ = this.parseMessage(e + 1, n, i);
        if (_.err)
          return _;
        var m = this.tryParseArgumentClose(d);
        if (m.err)
          return m;
        a.push([
          u,
          {
            value: _.val,
            location: te(d, this.clonePosition())
          }
        ]), l.add(u), this.bumpSpace(), r = this.parseIdentifierIfPossible(), u = r.value, c = r.location;
      }
      return a.length === 0 ? this.error(n === "select" ? $.EXPECT_SELECT_ARGUMENT_SELECTOR : $.EXPECT_PLURAL_ARGUMENT_SELECTOR, te(this.clonePosition(), this.clonePosition())) : this.requiresOtherClause && !s ? this.error($.MISSING_OTHER_CLAUSE, te(this.clonePosition(), this.clonePosition())) : { val: a, err: null };
    }, t.prototype.tryParseDecimalInteger = function(e, n) {
      var i = 1, o = this.clonePosition();
      this.bumpIf("+") || this.bumpIf("-") && (i = -1);
      for (var r = !1, s = 0; !this.isEOF(); ) {
        var a = this.char();
        if (a >= 48 && a <= 57)
          r = !0, s = s * 10 + (a - 48), this.bump();
        else
          break;
      }
      var l = te(o, this.clonePosition());
      return r ? (s *= i, Op(s) ? { val: s, err: null } : this.error(n, l)) : this.error(e, l);
    }, t.prototype.offset = function() {
      return this.position.offset;
    }, t.prototype.isEOF = function() {
      return this.offset() === this.message.length;
    }, t.prototype.clonePosition = function() {
      return {
        offset: this.position.offset,
        line: this.position.line,
        column: this.position.column
      };
    }, t.prototype.char = function() {
      var e = this.position.offset;
      if (e >= this.message.length)
        throw Error("out of bound");
      var n = Nu(this.message, e);
      if (n === void 0)
        throw Error("Offset ".concat(e, " is at invalid UTF-16 code unit boundary"));
      return n;
    }, t.prototype.error = function(e, n) {
      return {
        val: null,
        err: {
          kind: e,
          message: this.message,
          location: n
        }
      };
    }, t.prototype.bump = function() {
      if (!this.isEOF()) {
        var e = this.char();
        e === 10 ? (this.position.line += 1, this.position.column = 1, this.position.offset += 1) : (this.position.column += 1, this.position.offset += e < 65536 ? 1 : 2);
      }
    }, t.prototype.bumpIf = function(e) {
      if (Bl(this.message, e, this.offset())) {
        for (var n = 0; n < e.length; n++)
          this.bump();
        return !0;
      }
      return !1;
    }, t.prototype.bumpUntil = function(e) {
      var n = this.offset(), i = this.message.indexOf(e, n);
      return i >= 0 ? (this.bumpTo(i), !0) : (this.bumpTo(this.message.length), !1);
    }, t.prototype.bumpTo = function(e) {
      if (this.offset() > e)
        throw Error("targetOffset ".concat(e, " must be greater than or equal to the current offset ").concat(this.offset()));
      for (e = Math.min(e, this.message.length); ; ) {
        var n = this.offset();
        if (n === e)
          break;
        if (n > e)
          throw Error("targetOffset ".concat(e, " is at invalid UTF-16 code unit boundary"));
        if (this.bump(), this.isEOF())
          break;
      }
    }, t.prototype.bumpSpace = function() {
      for (; !this.isEOF() && Uu(this.char()); )
        this.bump();
    }, t.prototype.peek = function() {
      if (this.isEOF())
        return null;
      var e = this.char(), n = this.offset(), i = this.message.charCodeAt(n + (e >= 65536 ? 2 : 1));
      return i ?? null;
    }, t;
  }()
);
function Jr(t) {
  return t >= 97 && t <= 122 || t >= 65 && t <= 90;
}
function jp(t) {
  return Jr(t) || t === 47;
}
function Fp(t) {
  return t === 45 || t === 46 || t >= 48 && t <= 57 || t === 95 || t >= 97 && t <= 122 || t >= 65 && t <= 90 || t == 183 || t >= 192 && t <= 214 || t >= 216 && t <= 246 || t >= 248 && t <= 893 || t >= 895 && t <= 8191 || t >= 8204 && t <= 8205 || t >= 8255 && t <= 8256 || t >= 8304 && t <= 8591 || t >= 11264 && t <= 12271 || t >= 12289 && t <= 55295 || t >= 63744 && t <= 64975 || t >= 65008 && t <= 65533 || t >= 65536 && t <= 983039;
}
function Uu(t) {
  return t >= 9 && t <= 13 || t === 32 || t === 133 || t >= 8206 && t <= 8207 || t === 8232 || t === 8233;
}
function qp(t) {
  return t >= 33 && t <= 35 || t === 36 || t >= 37 && t <= 39 || t === 40 || t === 41 || t === 42 || t === 43 || t === 44 || t === 45 || t >= 46 && t <= 47 || t >= 58 && t <= 59 || t >= 60 && t <= 62 || t >= 63 && t <= 64 || t === 91 || t === 92 || t === 93 || t === 94 || t === 96 || t === 123 || t === 124 || t === 125 || t === 126 || t === 161 || t >= 162 && t <= 165 || t === 166 || t === 167 || t === 169 || t === 171 || t === 172 || t === 174 || t === 176 || t === 177 || t === 182 || t === 187 || t === 191 || t === 215 || t === 247 || t >= 8208 && t <= 8213 || t >= 8214 && t <= 8215 || t === 8216 || t === 8217 || t === 8218 || t >= 8219 && t <= 8220 || t === 8221 || t === 8222 || t === 8223 || t >= 8224 && t <= 8231 || t >= 8240 && t <= 8248 || t === 8249 || t === 8250 || t >= 8251 && t <= 8254 || t >= 8257 && t <= 8259 || t === 8260 || t === 8261 || t === 8262 || t >= 8263 && t <= 8273 || t === 8274 || t === 8275 || t >= 8277 && t <= 8286 || t >= 8592 && t <= 8596 || t >= 8597 && t <= 8601 || t >= 8602 && t <= 8603 || t >= 8604 && t <= 8607 || t === 8608 || t >= 8609 && t <= 8610 || t === 8611 || t >= 8612 && t <= 8613 || t === 8614 || t >= 8615 && t <= 8621 || t === 8622 || t >= 8623 && t <= 8653 || t >= 8654 && t <= 8655 || t >= 8656 && t <= 8657 || t === 8658 || t === 8659 || t === 8660 || t >= 8661 && t <= 8691 || t >= 8692 && t <= 8959 || t >= 8960 && t <= 8967 || t === 8968 || t === 8969 || t === 8970 || t === 8971 || t >= 8972 && t <= 8991 || t >= 8992 && t <= 8993 || t >= 8994 && t <= 9e3 || t === 9001 || t === 9002 || t >= 9003 && t <= 9083 || t === 9084 || t >= 9085 && t <= 9114 || t >= 9115 && t <= 9139 || t >= 9140 && t <= 9179 || t >= 9180 && t <= 9185 || t >= 9186 && t <= 9254 || t >= 9255 && t <= 9279 || t >= 9280 && t <= 9290 || t >= 9291 && t <= 9311 || t >= 9472 && t <= 9654 || t === 9655 || t >= 9656 && t <= 9664 || t === 9665 || t >= 9666 && t <= 9719 || t >= 9720 && t <= 9727 || t >= 9728 && t <= 9838 || t === 9839 || t >= 9840 && t <= 10087 || t === 10088 || t === 10089 || t === 10090 || t === 10091 || t === 10092 || t === 10093 || t === 10094 || t === 10095 || t === 10096 || t === 10097 || t === 10098 || t === 10099 || t === 10100 || t === 10101 || t >= 10132 && t <= 10175 || t >= 10176 && t <= 10180 || t === 10181 || t === 10182 || t >= 10183 && t <= 10213 || t === 10214 || t === 10215 || t === 10216 || t === 10217 || t === 10218 || t === 10219 || t === 10220 || t === 10221 || t === 10222 || t === 10223 || t >= 10224 && t <= 10239 || t >= 10240 && t <= 10495 || t >= 10496 && t <= 10626 || t === 10627 || t === 10628 || t === 10629 || t === 10630 || t === 10631 || t === 10632 || t === 10633 || t === 10634 || t === 10635 || t === 10636 || t === 10637 || t === 10638 || t === 10639 || t === 10640 || t === 10641 || t === 10642 || t === 10643 || t === 10644 || t === 10645 || t === 10646 || t === 10647 || t === 10648 || t >= 10649 && t <= 10711 || t === 10712 || t === 10713 || t === 10714 || t === 10715 || t >= 10716 && t <= 10747 || t === 10748 || t === 10749 || t >= 10750 && t <= 11007 || t >= 11008 && t <= 11055 || t >= 11056 && t <= 11076 || t >= 11077 && t <= 11078 || t >= 11079 && t <= 11084 || t >= 11085 && t <= 11123 || t >= 11124 && t <= 11125 || t >= 11126 && t <= 11157 || t === 11158 || t >= 11159 && t <= 11263 || t >= 11776 && t <= 11777 || t === 11778 || t === 11779 || t === 11780 || t === 11781 || t >= 11782 && t <= 11784 || t === 11785 || t === 11786 || t === 11787 || t === 11788 || t === 11789 || t >= 11790 && t <= 11798 || t === 11799 || t >= 11800 && t <= 11801 || t === 11802 || t === 11803 || t === 11804 || t === 11805 || t >= 11806 && t <= 11807 || t === 11808 || t === 11809 || t === 11810 || t === 11811 || t === 11812 || t === 11813 || t === 11814 || t === 11815 || t === 11816 || t === 11817 || t >= 11818 && t <= 11822 || t === 11823 || t >= 11824 && t <= 11833 || t >= 11834 && t <= 11835 || t >= 11836 && t <= 11839 || t === 11840 || t === 11841 || t === 11842 || t >= 11843 && t <= 11855 || t >= 11856 && t <= 11857 || t === 11858 || t >= 11859 && t <= 11903 || t >= 12289 && t <= 12291 || t === 12296 || t === 12297 || t === 12298 || t === 12299 || t === 12300 || t === 12301 || t === 12302 || t === 12303 || t === 12304 || t === 12305 || t >= 12306 && t <= 12307 || t === 12308 || t === 12309 || t === 12310 || t === 12311 || t === 12312 || t === 12313 || t === 12314 || t === 12315 || t === 12316 || t === 12317 || t >= 12318 && t <= 12319 || t === 12320 || t === 12336 || t === 64830 || t === 64831 || t >= 65093 && t <= 65094;
}
function Yr(t) {
  t.forEach(function(e) {
    if (delete e.location, Lu(e) || Pu(e))
      for (var n in e.options)
        delete e.options[n].location, Yr(e.options[n].value);
    else
      Su(e) && Bu(e.style) || (Au(e) || Tu(e)) && Vr(e.style) ? delete e.style.location : Ru(e) && Yr(e.children);
  });
}
function zp(t, e) {
  e === void 0 && (e = {}), e = ie({ shouldParseSkeletons: !0, requiresOtherClause: !0 }, e);
  var n = new Up(t, e).parse();
  if (n.err) {
    var i = SyntaxError($[n.err.kind]);
    throw i.location = n.err.location, i.originalMessage = n.err.message, i;
  }
  return e != null && e.captureLocation || Yr(n.val), n.val;
}
function gr(t, e) {
  var n = e && e.cache ? e.cache : xp, i = e && e.serializer ? e.serializer : Zp, o = e && e.strategy ? e.strategy : Wp;
  return o(t, {
    cache: n,
    serializer: i
  });
}
function Gp(t) {
  return t == null || typeof t == "number" || typeof t == "boolean";
}
function ju(t, e, n, i) {
  var o = Gp(i) ? i : n(i), r = e.get(o);
  return typeof r > "u" && (r = t.call(this, i), e.set(o, r)), r;
}
function Fu(t, e, n) {
  var i = Array.prototype.slice.call(arguments, 3), o = n(i), r = e.get(o);
  return typeof r > "u" && (r = t.apply(this, i), e.set(o, r)), r;
}
function fs(t, e, n, i, o) {
  return n.bind(e, t, i, o);
}
function Wp(t, e) {
  var n = t.length === 1 ? ju : Fu;
  return fs(t, this, n, e.cache.create(), e.serializer);
}
function Vp(t, e) {
  return fs(t, this, Fu, e.cache.create(), e.serializer);
}
function Xp(t, e) {
  return fs(t, this, ju, e.cache.create(), e.serializer);
}
var Zp = function() {
  return JSON.stringify(arguments);
};
function ds() {
  this.cache = /* @__PURE__ */ Object.create(null);
}
ds.prototype.get = function(t) {
  return this.cache[t];
};
ds.prototype.set = function(t, e) {
  this.cache[t] = e;
};
var xp = {
  create: function() {
    return new ds();
  }
}, br = {
  variadic: Vp,
  monadic: Xp
}, Fn;
(function(t) {
  t.MISSING_VALUE = "MISSING_VALUE", t.INVALID_VALUE = "INVALID_VALUE", t.MISSING_INTL_API = "MISSING_INTL_API";
})(Fn || (Fn = {}));
var Co = (
  /** @class */
  function(t) {
    Eo(e, t);
    function e(n, i, o) {
      var r = t.call(this, n) || this;
      return r.code = i, r.originalMessage = o, r;
    }
    return e.prototype.toString = function() {
      return "[formatjs Error: ".concat(this.code, "] ").concat(this.message);
    }, e;
  }(Error)
), Ol = (
  /** @class */
  function(t) {
    Eo(e, t);
    function e(n, i, o, r) {
      return t.call(this, 'Invalid values for "'.concat(n, '": "').concat(i, '". Options are "').concat(Object.keys(o).join('", "'), '"'), Fn.INVALID_VALUE, r) || this;
    }
    return e;
  }(Co)
), Jp = (
  /** @class */
  function(t) {
    Eo(e, t);
    function e(n, i, o) {
      return t.call(this, 'Value for "'.concat(n, '" must be of type ').concat(i), Fn.INVALID_VALUE, o) || this;
    }
    return e;
  }(Co)
), Yp = (
  /** @class */
  function(t) {
    Eo(e, t);
    function e(n, i) {
      return t.call(this, 'The intl string context variable "'.concat(n, '" was not provided to the string "').concat(i, '"'), Fn.MISSING_VALUE, i) || this;
    }
    return e;
  }(Co)
), De;
(function(t) {
  t[t.literal = 0] = "literal", t[t.object = 1] = "object";
})(De || (De = {}));
function Qp(t) {
  return t.length < 2 ? t : t.reduce(function(e, n) {
    var i = e[e.length - 1];
    return !i || i.type !== De.literal || n.type !== De.literal ? e.push(n) : i.value += n.value, e;
  }, []);
}
function Kp(t) {
  return typeof t == "function";
}
function eo(t, e, n, i, o, r, s) {
  if (t.length === 1 && Tl(t[0]))
    return [
      {
        type: De.literal,
        value: t[0].value
      }
    ];
  for (var a = [], l = 0, u = t; l < u.length; l++) {
    var c = u[l];
    if (Tl(c)) {
      a.push({
        type: De.literal,
        value: c.value
      });
      continue;
    }
    if (_p(c)) {
      typeof r == "number" && a.push({
        type: De.literal,
        value: n.getNumberFormat(e).format(r)
      });
      continue;
    }
    var f = c.value;
    if (!(o && f in o))
      throw new Yp(f, s);
    var h = o[f];
    if (hp(c)) {
      (!h || typeof h == "string" || typeof h == "number") && (h = typeof h == "string" || typeof h == "number" ? String(h) : ""), a.push({
        type: typeof h == "string" ? De.literal : De.object,
        value: h
      });
      continue;
    }
    if (Au(c)) {
      var d = typeof c.style == "string" ? i.date[c.style] : Vr(c.style) ? c.style.parsedOptions : void 0;
      a.push({
        type: De.literal,
        value: n.getDateTimeFormat(e, d).format(h)
      });
      continue;
    }
    if (Tu(c)) {
      var d = typeof c.style == "string" ? i.time[c.style] : Vr(c.style) ? c.style.parsedOptions : i.time.medium;
      a.push({
        type: De.literal,
        value: n.getDateTimeFormat(e, d).format(h)
      });
      continue;
    }
    if (Su(c)) {
      var d = typeof c.style == "string" ? i.number[c.style] : Bu(c.style) ? c.style.parsedOptions : void 0;
      d && d.scale && (h = h * (d.scale || 1)), a.push({
        type: De.literal,
        value: n.getNumberFormat(e, d).format(h)
      });
      continue;
    }
    if (Ru(c)) {
      var _ = c.children, m = c.value, v = o[m];
      if (!Kp(v))
        throw new Jp(m, "function", s);
      var p = eo(_, e, n, i, o, r), k = v(p.map(function(T) {
        return T.value;
      }));
      Array.isArray(k) || (k = [k]), a.push.apply(a, k.map(function(T) {
        return {
          type: typeof T == "string" ? De.literal : De.object,
          value: T
        };
      }));
    }
    if (Lu(c)) {
      var w = c.options[h] || c.options.other;
      if (!w)
        throw new Ol(c.value, h, Object.keys(c.options), s);
      a.push.apply(a, eo(w.value, e, n, i, o));
      continue;
    }
    if (Pu(c)) {
      var w = c.options["=".concat(h)];
      if (!w) {
        if (!Intl.PluralRules)
          throw new Co(`Intl.PluralRules is not available in this environment.
Try polyfilling it using "@formatjs/intl-pluralrules"
`, Fn.MISSING_INTL_API, s);
        var C = n.getPluralRules(e, { type: c.pluralType }).select(h - (c.offset || 0));
        w = c.options[C] || c.options.other;
      }
      if (!w)
        throw new Ol(c.value, h, Object.keys(c.options), s);
      a.push.apply(a, eo(w.value, e, n, i, o, h - (c.offset || 0)));
      continue;
    }
  }
  return Qp(a);
}
function $p(t, e) {
  return e ? ie(ie(ie({}, t || {}), e || {}), Object.keys(t).reduce(function(n, i) {
    return n[i] = ie(ie({}, t[i]), e[i] || {}), n;
  }, {})) : t;
}
function e1(t, e) {
  return e ? Object.keys(t).reduce(function(n, i) {
    return n[i] = $p(t[i], e[i]), n;
  }, ie({}, t)) : t;
}
function vr(t) {
  return {
    create: function() {
      return {
        get: function(e) {
          return t[e];
        },
        set: function(e, n) {
          t[e] = n;
        }
      };
    }
  };
}
function t1(t) {
  return t === void 0 && (t = {
    number: {},
    dateTime: {},
    pluralRules: {}
  }), {
    getNumberFormat: gr(function() {
      for (var e, n = [], i = 0; i < arguments.length; i++)
        n[i] = arguments[i];
      return new ((e = Intl.NumberFormat).bind.apply(e, mr([void 0], n, !1)))();
    }, {
      cache: vr(t.number),
      strategy: br.variadic
    }),
    getDateTimeFormat: gr(function() {
      for (var e, n = [], i = 0; i < arguments.length; i++)
        n[i] = arguments[i];
      return new ((e = Intl.DateTimeFormat).bind.apply(e, mr([void 0], n, !1)))();
    }, {
      cache: vr(t.dateTime),
      strategy: br.variadic
    }),
    getPluralRules: gr(function() {
      for (var e, n = [], i = 0; i < arguments.length; i++)
        n[i] = arguments[i];
      return new ((e = Intl.PluralRules).bind.apply(e, mr([void 0], n, !1)))();
    }, {
      cache: vr(t.pluralRules),
      strategy: br.variadic
    })
  };
}
var n1 = (
  /** @class */
  function() {
    function t(e, n, i, o) {
      var r = this;
      if (n === void 0 && (n = t.defaultLocale), this.formatterCache = {
        number: {},
        dateTime: {},
        pluralRules: {}
      }, this.format = function(s) {
        var a = r.formatToParts(s);
        if (a.length === 1)
          return a[0].value;
        var l = a.reduce(function(u, c) {
          return !u.length || c.type !== De.literal || typeof u[u.length - 1] != "string" ? u.push(c.value) : u[u.length - 1] += c.value, u;
        }, []);
        return l.length <= 1 ? l[0] || "" : l;
      }, this.formatToParts = function(s) {
        return eo(r.ast, r.locales, r.formatters, r.formats, s, void 0, r.message);
      }, this.resolvedOptions = function() {
        return {
          locale: r.resolvedLocale.toString()
        };
      }, this.getAst = function() {
        return r.ast;
      }, this.locales = n, this.resolvedLocale = t.resolveLocale(n), typeof e == "string") {
        if (this.message = e, !t.__parse)
          throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");
        this.ast = t.__parse(e, {
          ignoreTag: o == null ? void 0 : o.ignoreTag,
          locale: this.resolvedLocale
        });
      } else
        this.ast = e;
      if (!Array.isArray(this.ast))
        throw new TypeError("A message must be provided as a String or AST.");
      this.formats = e1(t.formats, i), this.formatters = o && o.formatters || t1(this.formatterCache);
    }
    return Object.defineProperty(t, "defaultLocale", {
      get: function() {
        return t.memoizedDefaultLocale || (t.memoizedDefaultLocale = new Intl.NumberFormat().resolvedOptions().locale), t.memoizedDefaultLocale;
      },
      enumerable: !1,
      configurable: !0
    }), t.memoizedDefaultLocale = null, t.resolveLocale = function(e) {
      var n = Intl.NumberFormat.supportedLocalesOf(e);
      return n.length > 0 ? new Intl.Locale(n[0]) : new Intl.Locale(typeof e == "string" ? e : e[0]);
    }, t.__parse = zp, t.formats = {
      number: {
        integer: {
          maximumFractionDigits: 0
        },
        currency: {
          style: "currency"
        },
        percent: {
          style: "percent"
        }
      },
      date: {
        short: {
          month: "numeric",
          day: "numeric",
          year: "2-digit"
        },
        medium: {
          month: "short",
          day: "numeric",
          year: "numeric"
        },
        long: {
          month: "long",
          day: "numeric",
          year: "numeric"
        },
        full: {
          weekday: "long",
          month: "long",
          day: "numeric",
          year: "numeric"
        }
      },
      time: {
        short: {
          hour: "numeric",
          minute: "numeric"
        },
        medium: {
          hour: "numeric",
          minute: "numeric",
          second: "numeric"
        },
        long: {
          hour: "numeric",
          minute: "numeric",
          second: "numeric",
          timeZoneName: "short"
        },
        full: {
          hour: "numeric",
          minute: "numeric",
          second: "numeric",
          timeZoneName: "short"
        }
      }
    }, t;
  }()
);
function i1(t, e) {
  if (e == null)
    return;
  if (e in t)
    return t[e];
  const n = e.split(".");
  let i = t;
  for (let o = 0; o < n.length; o++)
    if (typeof i == "object") {
      if (o > 0) {
        const r = n.slice(o, n.length).join(".");
        if (r in i) {
          i = i[r];
          break;
        }
      }
      i = i[n[o]];
    } else
      i = void 0;
  return i;
}
const Nt = {}, o1 = (t, e, n) => n && (e in Nt || (Nt[e] = {}), t in Nt[e] || (Nt[e][t] = n), n), qu = (t, e) => {
  if (e == null)
    return;
  if (e in Nt && t in Nt[e])
    return Nt[e][t];
  const n = So(e);
  for (let i = 0; i < n.length; i++) {
    const o = n[i], r = s1(o, t);
    if (r)
      return o1(t, e, r);
  }
};
let hs;
const Ti = Ai({});
function r1(t) {
  return hs[t] || null;
}
function zu(t) {
  return t in hs;
}
function s1(t, e) {
  if (!zu(t))
    return null;
  const n = r1(t);
  return i1(n, e);
}
function l1(t) {
  if (t == null)
    return;
  const e = So(t);
  for (let n = 0; n < e.length; n++) {
    const i = e[n];
    if (zu(i))
      return i;
  }
}
function a1(t, ...e) {
  delete Nt[t], Ti.update((n) => (n[t] = dp.all([n[t] || {}, ...e]), n));
}
Kn(
  [Ti],
  ([t]) => Object.keys(t)
);
Ti.subscribe((t) => hs = t);
const to = {};
function u1(t, e) {
  to[t].delete(e), to[t].size === 0 && delete to[t];
}
function Gu(t) {
  return to[t];
}
function c1(t) {
  return So(t).map((e) => {
    const n = Gu(e);
    return [e, n ? [...n] : []];
  }).filter(([, e]) => e.length > 0);
}
function Qr(t) {
  return t == null ? !1 : So(t).some(
    (e) => {
      var n;
      return (n = Gu(e)) == null ? void 0 : n.size;
    }
  );
}
function f1(t, e) {
  return Promise.all(
    e.map((i) => (u1(t, i), i().then((o) => o.default || o)))
  ).then((i) => a1(t, ...i));
}
const ui = {};
function Wu(t) {
  if (!Qr(t))
    return t in ui ? ui[t] : Promise.resolve();
  const e = c1(t);
  return ui[t] = Promise.all(
    e.map(
      ([n, i]) => f1(n, i)
    )
  ).then(() => {
    if (Qr(t))
      return Wu(t);
    delete ui[t];
  }), ui[t];
}
const d1 = {
  number: {
    scientific: { notation: "scientific" },
    engineering: { notation: "engineering" },
    compactLong: { notation: "compact", compactDisplay: "long" },
    compactShort: { notation: "compact", compactDisplay: "short" }
  },
  date: {
    short: { month: "numeric", day: "numeric", year: "2-digit" },
    medium: { month: "short", day: "numeric", year: "numeric" },
    long: { month: "long", day: "numeric", year: "numeric" },
    full: { weekday: "long", month: "long", day: "numeric", year: "numeric" }
  },
  time: {
    short: { hour: "numeric", minute: "numeric" },
    medium: { hour: "numeric", minute: "numeric", second: "numeric" },
    long: {
      hour: "numeric",
      minute: "numeric",
      second: "numeric",
      timeZoneName: "short"
    },
    full: {
      hour: "numeric",
      minute: "numeric",
      second: "numeric",
      timeZoneName: "short"
    }
  }
}, h1 = {
  fallbackLocale: null,
  loadingDelay: 200,
  formats: d1,
  warnOnMissingMessages: !0,
  handleMissingMessage: void 0,
  ignoreTag: !0
}, _1 = h1;
function qn() {
  return _1;
}
const wr = Ai(!1);
var m1 = Object.defineProperty, p1 = Object.defineProperties, g1 = Object.getOwnPropertyDescriptors, Hl = Object.getOwnPropertySymbols, b1 = Object.prototype.hasOwnProperty, v1 = Object.prototype.propertyIsEnumerable, Nl = (t, e, n) => e in t ? m1(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, w1 = (t, e) => {
  for (var n in e || (e = {}))
    b1.call(e, n) && Nl(t, n, e[n]);
  if (Hl)
    for (var n of Hl(e))
      v1.call(e, n) && Nl(t, n, e[n]);
  return t;
}, y1 = (t, e) => p1(t, g1(e));
let Kr;
const ao = Ai(null);
function Il(t) {
  return t.split("-").map((e, n, i) => i.slice(0, n + 1).join("-")).reverse();
}
function So(t, e = qn().fallbackLocale) {
  const n = Il(t);
  return e ? [.../* @__PURE__ */ new Set([...n, ...Il(e)])] : n;
}
function wn() {
  return Kr ?? void 0;
}
ao.subscribe((t) => {
  Kr = t ?? void 0, typeof window < "u" && t != null && document.documentElement.setAttribute("lang", t);
});
const k1 = (t) => {
  if (t && l1(t) && Qr(t)) {
    const { loadingDelay: e } = qn();
    let n;
    return typeof window < "u" && wn() != null && e ? n = window.setTimeout(
      () => wr.set(!0),
      e
    ) : wr.set(!0), Wu(t).then(() => {
      ao.set(t);
    }).finally(() => {
      clearTimeout(n), wr.set(!1);
    });
  }
  return ao.set(t);
}, Li = y1(w1({}, ao), {
  set: k1
}), Ao = (t) => {
  const e = /* @__PURE__ */ Object.create(null);
  return (i) => {
    const o = JSON.stringify(i);
    return o in e ? e[o] : e[o] = t(i);
  };
};
var E1 = Object.defineProperty, uo = Object.getOwnPropertySymbols, Vu = Object.prototype.hasOwnProperty, Xu = Object.prototype.propertyIsEnumerable, Ul = (t, e, n) => e in t ? E1(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, _s = (t, e) => {
  for (var n in e || (e = {}))
    Vu.call(e, n) && Ul(t, n, e[n]);
  if (uo)
    for (var n of uo(e))
      Xu.call(e, n) && Ul(t, n, e[n]);
  return t;
}, $n = (t, e) => {
  var n = {};
  for (var i in t)
    Vu.call(t, i) && e.indexOf(i) < 0 && (n[i] = t[i]);
  if (t != null && uo)
    for (var i of uo(t))
      e.indexOf(i) < 0 && Xu.call(t, i) && (n[i] = t[i]);
  return n;
};
const ki = (t, e) => {
  const { formats: n } = qn();
  if (t in n && e in n[t])
    return n[t][e];
  throw new Error(`[svelte-i18n] Unknown "${e}" ${t} format.`);
}, C1 = Ao(
  (t) => {
    var e = t, { locale: n, format: i } = e, o = $n(e, ["locale", "format"]);
    if (n == null)
      throw new Error('[svelte-i18n] A "locale" must be set to format numbers');
    return i && (o = ki("number", i)), new Intl.NumberFormat(n, o);
  }
), S1 = Ao(
  (t) => {
    var e = t, { locale: n, format: i } = e, o = $n(e, ["locale", "format"]);
    if (n == null)
      throw new Error('[svelte-i18n] A "locale" must be set to format dates');
    return i ? o = ki("date", i) : Object.keys(o).length === 0 && (o = ki("date", "short")), new Intl.DateTimeFormat(n, o);
  }
), A1 = Ao(
  (t) => {
    var e = t, { locale: n, format: i } = e, o = $n(e, ["locale", "format"]);
    if (n == null)
      throw new Error(
        '[svelte-i18n] A "locale" must be set to format time values'
      );
    return i ? o = ki("time", i) : Object.keys(o).length === 0 && (o = ki("time", "short")), new Intl.DateTimeFormat(n, o);
  }
), T1 = (t = {}) => {
  var e = t, {
    locale: n = wn()
  } = e, i = $n(e, [
    "locale"
  ]);
  return C1(_s({ locale: n }, i));
}, L1 = (t = {}) => {
  var e = t, {
    locale: n = wn()
  } = e, i = $n(e, [
    "locale"
  ]);
  return S1(_s({ locale: n }, i));
}, P1 = (t = {}) => {
  var e = t, {
    locale: n = wn()
  } = e, i = $n(e, [
    "locale"
  ]);
  return A1(_s({ locale: n }, i));
}, R1 = Ao(
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  (t, e = wn()) => new n1(t, e, qn().formats, {
    ignoreTag: qn().ignoreTag
  })
), B1 = (t, e = {}) => {
  var n, i, o, r;
  let s = e;
  typeof t == "object" && (s = t, t = s.id);
  const {
    values: a,
    locale: l = wn(),
    default: u
  } = s;
  if (l == null)
    throw new Error(
      "[svelte-i18n] Cannot format a message without first setting the initial locale."
    );
  let c = qu(t, l);
  if (!c)
    c = (r = (o = (i = (n = qn()).handleMissingMessage) == null ? void 0 : i.call(n, { locale: l, id: t, defaultValue: u })) != null ? o : u) != null ? r : t;
  else if (typeof c != "string")
    return console.warn(
      `[svelte-i18n] Message with id "${t}" must be of type "string", found: "${typeof c}". Gettin its value through the "$format" method is deprecated; use the "json" method instead.`
    ), c;
  if (!a)
    return c;
  let f = c;
  try {
    f = R1(c, l).format(a);
  } catch (h) {
    h instanceof Error && console.warn(
      `[svelte-i18n] Message "${t}" has syntax error:`,
      h.message
    );
  }
  return f;
}, M1 = (t, e) => P1(e).format(t), D1 = (t, e) => L1(e).format(t), O1 = (t, e) => T1(e).format(t), H1 = (t, e = wn()) => qu(t, e);
Kn([Li, Ti], () => B1);
Kn([Li], () => M1);
Kn([Li], () => D1);
Kn([Li], () => O1);
Kn([Li, Ti], () => H1);
const {
  SvelteComponent: N1,
  append: Fe,
  attr: Yt,
  detach: Zu,
  element: Qt,
  init: I1,
  insert: xu,
  noop: jl,
  safe_not_equal: U1,
  set_data: co,
  set_style: yr,
  space: $r,
  text: Bn,
  toggle_class: Fl
} = window.__gradio__svelte__internal, { onMount: j1, createEventDispatcher: F1, getContext: q1 } = window.__gradio__svelte__internal;
function ql(t) {
  let e, n, i, o, r = pi(
    /*file_to_display*/
    t[2]
  ) + "", s, a, l, u, c = (
    /*file_to_display*/
    t[2].orig_name + ""
  ), f;
  return {
    c() {
      e = Qt("div"), n = Qt("span"), i = Qt("div"), o = Qt("progress"), s = Bn(r), l = $r(), u = Qt("span"), f = Bn(c), yr(o, "visibility", "hidden"), yr(o, "height", "0"), yr(o, "width", "0"), o.value = a = pi(
        /*file_to_display*/
        t[2]
      ), Yt(o, "max", "100"), Yt(o, "class", "svelte-cr2edf"), Yt(i, "class", "progress-bar svelte-cr2edf"), Yt(u, "class", "file-name svelte-cr2edf"), Yt(e, "class", "file svelte-cr2edf");
    },
    m(h, d) {
      xu(h, e, d), Fe(e, n), Fe(n, i), Fe(i, o), Fe(o, s), Fe(e, l), Fe(e, u), Fe(u, f);
    },
    p(h, d) {
      d & /*file_to_display*/
      4 && r !== (r = pi(
        /*file_to_display*/
        h[2]
      ) + "") && co(s, r), d & /*file_to_display*/
      4 && a !== (a = pi(
        /*file_to_display*/
        h[2]
      )) && (o.value = a), d & /*file_to_display*/
      4 && c !== (c = /*file_to_display*/
      h[2].orig_name + "") && co(f, c);
    },
    d(h) {
      h && Zu(e);
    }
  };
}
function z1(t) {
  let e, n, i, o = (
    /*files_with_progress*/
    t[0].length + ""
  ), r, s, a = (
    /*files_with_progress*/
    t[0].length > 1 ? "files" : "file"
  ), l, u, c, f = (
    /*file_to_display*/
    t[2] && ql(t)
  );
  return {
    c() {
      e = Qt("div"), n = Qt("span"), i = Bn("Uploading "), r = Bn(o), s = $r(), l = Bn(a), u = Bn("..."), c = $r(), f && f.c(), Yt(n, "class", "uploading svelte-cr2edf"), Yt(e, "class", "wrap svelte-cr2edf"), Fl(
        e,
        "progress",
        /*progress*/
        t[1]
      );
    },
    m(h, d) {
      xu(h, e, d), Fe(e, n), Fe(n, i), Fe(n, r), Fe(n, s), Fe(n, l), Fe(n, u), Fe(e, c), f && f.m(e, null);
    },
    p(h, [d]) {
      d & /*files_with_progress*/
      1 && o !== (o = /*files_with_progress*/
      h[0].length + "") && co(r, o), d & /*files_with_progress*/
      1 && a !== (a = /*files_with_progress*/
      h[0].length > 1 ? "files" : "file") && co(l, a), /*file_to_display*/
      h[2] ? f ? f.p(h, d) : (f = ql(h), f.c(), f.m(e, null)) : f && (f.d(1), f = null), d & /*progress*/
      2 && Fl(
        e,
        "progress",
        /*progress*/
        h[1]
      );
    },
    i: jl,
    o: jl,
    d(h) {
      h && Zu(e), f && f.d();
    }
  };
}
function pi(t) {
  return t.progress * 100 / (t.size || 0) || 0;
}
function G1(t) {
  let e = 0;
  return t.forEach((n) => {
    e += pi(n);
  }), document.documentElement.style.setProperty("--upload-progress-width", (e / t.length).toFixed(2) + "%"), e / t.length;
}
function W1(t, e, n) {
  let { upload_id: i } = e, { root: o } = e, { files: r } = e, s, a = !1, l, u, c = r.map((_) => ({ ..._, progress: 0 }));
  const f = F1();
  function h(_, m) {
    n(0, c = c.map((v) => (v.orig_name === _ && (v.progress += m), v)));
  }
  const d = q1("EventSource_factory");
  return j1(() => {
    s = d(new URL(`${o}/upload_progress?upload_id=${i}`)), s.onmessage = async function(_) {
      const m = JSON.parse(_.data);
      a || n(1, a = !0), m.msg === "done" ? (s.close(), f("done")) : (n(6, l = m), h(m.orig_name, m.chunk_size));
    };
  }), t.$$set = (_) => {
    "upload_id" in _ && n(3, i = _.upload_id), "root" in _ && n(4, o = _.root), "files" in _ && n(5, r = _.files);
  }, t.$$.update = () => {
    t.$$.dirty & /*files_with_progress*/
    1 && G1(c), t.$$.dirty & /*current_file_upload, files_with_progress*/
    65 && n(2, u = l || c[0]);
  }, [
    c,
    a,
    u,
    i,
    o,
    r,
    l
  ];
}
class V1 extends N1 {
  constructor(e) {
    super(), I1(this, e, W1, z1, U1, { upload_id: 3, root: 4, files: 5 });
  }
}
const {
  SvelteComponent: X1,
  append: zl,
  attr: Be,
  binding_callbacks: Z1,
  bubble: Zt,
  check_outros: Ju,
  create_component: x1,
  create_slot: Yu,
  destroy_component: J1,
  detach: To,
  element: es,
  empty: Qu,
  get_all_dirty_from_scope: Ku,
  get_slot_changes: $u,
  group_outros: ec,
  init: Y1,
  insert: Lo,
  listen: ze,
  mount_component: Q1,
  prevent_default: xt,
  run_all: K1,
  safe_not_equal: $1,
  set_style: tc,
  space: eg,
  stop_propagation: Jt,
  toggle_class: Te,
  transition_in: Ut,
  transition_out: pn,
  update_slot_base: nc
} = window.__gradio__svelte__internal, { createEventDispatcher: tg, tick: ng, getContext: ig } = window.__gradio__svelte__internal;
function og(t) {
  let e, n, i, o, r, s, a, l, u, c, f;
  const h = (
    /*#slots*/
    t[22].default
  ), d = Yu(
    h,
    t,
    /*$$scope*/
    t[21],
    null
  );
  return {
    c() {
      e = es("button"), d && d.c(), n = eg(), i = es("input"), Be(i, "aria-label", "file upload"), Be(i, "data-testid", "file-upload"), Be(i, "type", "file"), Be(i, "accept", o = /*accept_file_types*/
      t[14] || void 0), i.multiple = r = /*file_count*/
      t[6] === "multiple" || void 0, Be(i, "webkitdirectory", s = /*file_count*/
      t[6] === "directory" || void 0), Be(i, "mozdirectory", a = /*file_count*/
      t[6] === "directory" || void 0), Be(i, "class", "svelte-1s26xmt"), Be(e, "tabindex", l = /*hidden*/
      t[9] ? -1 : 0), Be(e, "class", "svelte-1s26xmt"), Te(
        e,
        "hidden",
        /*hidden*/
        t[9]
      ), Te(
        e,
        "center",
        /*center*/
        t[4]
      ), Te(
        e,
        "boundedheight",
        /*boundedheight*/
        t[3]
      ), Te(
        e,
        "flex",
        /*flex*/
        t[5]
      ), Te(
        e,
        "disable_click",
        /*disable_click*/
        t[7]
      ), tc(e, "height", "100%");
    },
    m(_, m) {
      Lo(_, e, m), d && d.m(e, null), zl(e, n), zl(e, i), t[30](i), u = !0, c || (f = [
        ze(
          i,
          "change",
          /*load_files_from_upload*/
          t[16]
        ),
        ze(e, "drag", Jt(xt(
          /*drag_handler*/
          t[23]
        ))),
        ze(e, "dragstart", Jt(xt(
          /*dragstart_handler*/
          t[24]
        ))),
        ze(e, "dragend", Jt(xt(
          /*dragend_handler*/
          t[25]
        ))),
        ze(e, "dragover", Jt(xt(
          /*dragover_handler*/
          t[26]
        ))),
        ze(e, "dragenter", Jt(xt(
          /*dragenter_handler*/
          t[27]
        ))),
        ze(e, "dragleave", Jt(xt(
          /*dragleave_handler*/
          t[28]
        ))),
        ze(e, "drop", Jt(xt(
          /*drop_handler*/
          t[29]
        ))),
        ze(
          e,
          "click",
          /*open_file_upload*/
          t[11]
        ),
        ze(
          e,
          "drop",
          /*loadFilesFromDrop*/
          t[17]
        ),
        ze(
          e,
          "dragenter",
          /*updateDragging*/
          t[15]
        ),
        ze(
          e,
          "dragleave",
          /*updateDragging*/
          t[15]
        )
      ], c = !0);
    },
    p(_, m) {
      d && d.p && (!u || m[0] & /*$$scope*/
      2097152) && nc(
        d,
        h,
        _,
        /*$$scope*/
        _[21],
        u ? $u(
          h,
          /*$$scope*/
          _[21],
          m,
          null
        ) : Ku(
          /*$$scope*/
          _[21]
        ),
        null
      ), (!u || m[0] & /*accept_file_types*/
      16384 && o !== (o = /*accept_file_types*/
      _[14] || void 0)) && Be(i, "accept", o), (!u || m[0] & /*file_count*/
      64 && r !== (r = /*file_count*/
      _[6] === "multiple" || void 0)) && (i.multiple = r), (!u || m[0] & /*file_count*/
      64 && s !== (s = /*file_count*/
      _[6] === "directory" || void 0)) && Be(i, "webkitdirectory", s), (!u || m[0] & /*file_count*/
      64 && a !== (a = /*file_count*/
      _[6] === "directory" || void 0)) && Be(i, "mozdirectory", a), (!u || m[0] & /*hidden*/
      512 && l !== (l = /*hidden*/
      _[9] ? -1 : 0)) && Be(e, "tabindex", l), (!u || m[0] & /*hidden*/
      512) && Te(
        e,
        "hidden",
        /*hidden*/
        _[9]
      ), (!u || m[0] & /*center*/
      16) && Te(
        e,
        "center",
        /*center*/
        _[4]
      ), (!u || m[0] & /*boundedheight*/
      8) && Te(
        e,
        "boundedheight",
        /*boundedheight*/
        _[3]
      ), (!u || m[0] & /*flex*/
      32) && Te(
        e,
        "flex",
        /*flex*/
        _[5]
      ), (!u || m[0] & /*disable_click*/
      128) && Te(
        e,
        "disable_click",
        /*disable_click*/
        _[7]
      );
    },
    i(_) {
      u || (Ut(d, _), u = !0);
    },
    o(_) {
      pn(d, _), u = !1;
    },
    d(_) {
      _ && To(e), d && d.d(_), t[30](null), c = !1, K1(f);
    }
  };
}
function rg(t) {
  let e, n, i = !/*hidden*/
  t[9] && Gl(t);
  return {
    c() {
      i && i.c(), e = Qu();
    },
    m(o, r) {
      i && i.m(o, r), Lo(o, e, r), n = !0;
    },
    p(o, r) {
      /*hidden*/
      o[9] ? i && (ec(), pn(i, 1, 1, () => {
        i = null;
      }), Ju()) : i ? (i.p(o, r), r[0] & /*hidden*/
      512 && Ut(i, 1)) : (i = Gl(o), i.c(), Ut(i, 1), i.m(e.parentNode, e));
    },
    i(o) {
      n || (Ut(i), n = !0);
    },
    o(o) {
      pn(i), n = !1;
    },
    d(o) {
      o && To(e), i && i.d(o);
    }
  };
}
function sg(t) {
  let e, n, i, o, r;
  const s = (
    /*#slots*/
    t[22].default
  ), a = Yu(
    s,
    t,
    /*$$scope*/
    t[21],
    null
  );
  return {
    c() {
      e = es("button"), a && a.c(), Be(e, "tabindex", n = /*hidden*/
      t[9] ? -1 : 0), Be(e, "class", "svelte-1s26xmt"), Te(
        e,
        "hidden",
        /*hidden*/
        t[9]
      ), Te(
        e,
        "center",
        /*center*/
        t[4]
      ), Te(
        e,
        "boundedheight",
        /*boundedheight*/
        t[3]
      ), Te(
        e,
        "flex",
        /*flex*/
        t[5]
      ), tc(e, "height", "100%");
    },
    m(l, u) {
      Lo(l, e, u), a && a.m(e, null), i = !0, o || (r = ze(
        e,
        "click",
        /*paste_clipboard*/
        t[10]
      ), o = !0);
    },
    p(l, u) {
      a && a.p && (!i || u[0] & /*$$scope*/
      2097152) && nc(
        a,
        s,
        l,
        /*$$scope*/
        l[21],
        i ? $u(
          s,
          /*$$scope*/
          l[21],
          u,
          null
        ) : Ku(
          /*$$scope*/
          l[21]
        ),
        null
      ), (!i || u[0] & /*hidden*/
      512 && n !== (n = /*hidden*/
      l[9] ? -1 : 0)) && Be(e, "tabindex", n), (!i || u[0] & /*hidden*/
      512) && Te(
        e,
        "hidden",
        /*hidden*/
        l[9]
      ), (!i || u[0] & /*center*/
      16) && Te(
        e,
        "center",
        /*center*/
        l[4]
      ), (!i || u[0] & /*boundedheight*/
      8) && Te(
        e,
        "boundedheight",
        /*boundedheight*/
        l[3]
      ), (!i || u[0] & /*flex*/
      32) && Te(
        e,
        "flex",
        /*flex*/
        l[5]
      );
    },
    i(l) {
      i || (Ut(a, l), i = !0);
    },
    o(l) {
      pn(a, l), i = !1;
    },
    d(l) {
      l && To(e), a && a.d(l), o = !1, r();
    }
  };
}
function Gl(t) {
  let e, n;
  return e = new V1({
    props: {
      root: (
        /*root*/
        t[8]
      ),
      upload_id: (
        /*upload_id*/
        t[12]
      ),
      files: (
        /*file_data*/
        t[13]
      )
    }
  }), {
    c() {
      x1(e.$$.fragment);
    },
    m(i, o) {
      Q1(e, i, o), n = !0;
    },
    p(i, o) {
      const r = {};
      o[0] & /*root*/
      256 && (r.root = /*root*/
      i[8]), o[0] & /*upload_id*/
      4096 && (r.upload_id = /*upload_id*/
      i[12]), o[0] & /*file_data*/
      8192 && (r.files = /*file_data*/
      i[13]), e.$set(r);
    },
    i(i) {
      n || (Ut(e.$$.fragment, i), n = !0);
    },
    o(i) {
      pn(e.$$.fragment, i), n = !1;
    },
    d(i) {
      J1(e, i);
    }
  };
}
function lg(t) {
  let e, n, i, o;
  const r = [sg, rg, og], s = [];
  function a(l, u) {
    return (
      /*filetype*/
      l[0] === "clipboard" ? 0 : (
        /*uploading*/
        l[1] && !/*hidden_upload*/
        l[2] ? 1 : 2
      )
    );
  }
  return e = a(t), n = s[e] = r[e](t), {
    c() {
      n.c(), i = Qu();
    },
    m(l, u) {
      s[e].m(l, u), Lo(l, i, u), o = !0;
    },
    p(l, u) {
      let c = e;
      e = a(l), e === c ? s[e].p(l, u) : (ec(), pn(s[c], 1, 1, () => {
        s[c] = null;
      }), Ju(), n = s[e], n ? n.p(l, u) : (n = s[e] = r[e](l), n.c()), Ut(n, 1), n.m(i.parentNode, i));
    },
    i(l) {
      o || (Ut(n), o = !0);
    },
    o(l) {
      pn(n), o = !1;
    },
    d(l) {
      l && To(i), s[e].d(l);
    }
  };
}
function Wl(t) {
  let e, n = t[0], i = 1;
  for (; i < t.length; ) {
    const o = t[i], r = t[i + 1];
    if (i += 2, (o === "optionalAccess" || o === "optionalCall") && n == null)
      return;
    o === "access" || o === "optionalAccess" ? (e = n, n = r(n)) : (o === "call" || o === "optionalCall") && (n = r((...s) => n.call(e, ...s)), e = void 0);
  }
  return n;
}
function ag(t, e, n) {
  if (!t || t === "*" || t === "file/*" || Array.isArray(t) && t.some((o) => o === "*" || o === "file/*"))
    return !0;
  let i;
  if (typeof t == "string")
    i = t.split(",").map((o) => o.trim());
  else if (Array.isArray(t))
    i = t;
  else
    return !1;
  return i.includes(e) || i.some((o) => {
    const [r] = o.split("/").map((s) => s.trim());
    return o.endsWith("/*") && n.startsWith(r + "/");
  });
}
function ug(t, e, n) {
  let { $$slots: i = {}, $$scope: o } = e, { filetype: r = null } = e, { dragging: s = !1 } = e, { boundedheight: a = !0 } = e, { center: l = !0 } = e, { flex: u = !0 } = e, { file_count: c = "single" } = e, { disable_click: f = !1 } = e, { root: h } = e, { hidden: d = !1 } = e, { format: _ = "file" } = e, { uploading: m = !1 } = e, { hidden_upload: v = null } = e, p, k, w;
  const C = ig("upload_files"), T = tg(), y = ["image", "video", "audio", "text", "file"], O = (g) => g.startsWith(".") || g.endsWith("/*") ? g : y.includes(g) ? g + "/*" : "." + g;
  function P() {
    n(18, s = !s);
  }
  function A() {
    navigator.clipboard.read().then(async (g) => {
      for (let L = 0; L < g.length; L++) {
        const G = g[L].types.find((W) => W.startsWith("image/"));
        if (G) {
          g[L].getType(G).then(async (W) => {
            const de = new File([W], `clipboard.${G.replace("image/", "")}`);
            await X([de]);
          });
          break;
        }
      }
    });
  }
  function R() {
    f || v && (n(2, v.value = "", v), v.click());
  }
  async function z(g) {
    await ng(), n(12, p = Math.random().toString(36).substring(2, 15)), n(1, m = !0);
    const L = await Ma(g, h, p, C);
    return T("load", c === "single" ? Wl([L, "optionalAccess", (G) => G[0]]) : L), n(1, m = !1), L || [];
  }
  async function X(g) {
    if (!g.length)
      return;
    let L = g.map((G) => new File([G], G.name, { type: G.type }));
    return n(13, k = await Da(L)), await z(k);
  }
  async function F(g) {
    const L = g.target;
    if (L.files)
      if (_ != "blob")
        await X(Array.from(L.files));
      else {
        if (c === "single") {
          T("load", L.files[0]);
          return;
        }
        T("load", L.files);
      }
  }
  async function J(g) {
    if (n(18, s = !1), !Wl([g, "access", (G) => G.dataTransfer, "optionalAccess", (G) => G.files]))
      return;
    const L = Array.from(g.dataTransfer.files).filter((G) => {
      const W = "." + G.name.split(".").pop();
      return W && ag(w, W, G.type) || (W && Array.isArray(r) ? r.includes(W) : W === r) ? !0 : (T("error", `Invalid file type only ${r} allowed.`), !1);
    });
    await X(L);
  }
  function E(g) {
    Zt.call(this, t, g);
  }
  function V(g) {
    Zt.call(this, t, g);
  }
  function N(g) {
    Zt.call(this, t, g);
  }
  function U(g) {
    Zt.call(this, t, g);
  }
  function ee(g) {
    Zt.call(this, t, g);
  }
  function H(g) {
    Zt.call(this, t, g);
  }
  function Y(g) {
    Zt.call(this, t, g);
  }
  function se(g) {
    Z1[g ? "unshift" : "push"](() => {
      v = g, n(2, v);
    });
  }
  return t.$$set = (g) => {
    "filetype" in g && n(0, r = g.filetype), "dragging" in g && n(18, s = g.dragging), "boundedheight" in g && n(3, a = g.boundedheight), "center" in g && n(4, l = g.center), "flex" in g && n(5, u = g.flex), "file_count" in g && n(6, c = g.file_count), "disable_click" in g && n(7, f = g.disable_click), "root" in g && n(8, h = g.root), "hidden" in g && n(9, d = g.hidden), "format" in g && n(19, _ = g.format), "uploading" in g && n(1, m = g.uploading), "hidden_upload" in g && n(2, v = g.hidden_upload), "$$scope" in g && n(21, o = g.$$scope);
  }, t.$$.update = () => {
    t.$$.dirty[0] & /*filetype*/
    1 && (r == null ? n(14, w = null) : typeof r == "string" ? n(14, w = O(r)) : (n(0, r = r.map(O)), n(14, w = r.join(", "))));
  }, [
    r,
    m,
    v,
    a,
    l,
    u,
    c,
    f,
    h,
    d,
    A,
    R,
    p,
    k,
    w,
    P,
    F,
    J,
    s,
    _,
    X,
    o,
    i,
    E,
    V,
    N,
    U,
    ee,
    H,
    Y,
    se
  ];
}
class cg extends X1 {
  constructor(e) {
    super(), Y1(
      this,
      e,
      ug,
      lg,
      $1,
      {
        filetype: 0,
        dragging: 18,
        boundedheight: 3,
        center: 4,
        flex: 5,
        file_count: 6,
        disable_click: 7,
        root: 8,
        hidden: 9,
        format: 19,
        uploading: 1,
        hidden_upload: 2,
        paste_clipboard: 10,
        open_file_upload: 11,
        load_files: 20
      },
      null,
      [-1, -1]
    );
  }
  get paste_clipboard() {
    return this.$$.ctx[10];
  }
  get open_file_upload() {
    return this.$$.ctx[11];
  }
  get load_files() {
    return this.$$.ctx[20];
  }
}
const {
  SvelteComponent: fg,
  append: kr,
  attr: dg,
  check_outros: Er,
  create_component: Pi,
  destroy_component: Ri,
  detach: hg,
  element: _g,
  group_outros: Cr,
  init: mg,
  insert: pg,
  mount_component: Bi,
  safe_not_equal: gg,
  set_style: Vl,
  space: Sr,
  toggle_class: Xl,
  transition_in: Ie,
  transition_out: lt
} = window.__gradio__svelte__internal, { createEventDispatcher: bg } = window.__gradio__svelte__internal;
function Zl(t) {
  let e, n;
  return e = new Ei({
    props: {
      Icon: kd,
      label: (
        /*i18n*/
        t[4]("common.edit")
      )
    }
  }), e.$on(
    "click",
    /*click_handler*/
    t[6]
  ), {
    c() {
      Pi(e.$$.fragment);
    },
    m(i, o) {
      Bi(e, i, o), n = !0;
    },
    p(i, o) {
      const r = {};
      o & /*i18n*/
      16 && (r.label = /*i18n*/
      i[4]("common.edit")), e.$set(r);
    },
    i(i) {
      n || (Ie(e.$$.fragment, i), n = !0);
    },
    o(i) {
      lt(e.$$.fragment, i), n = !1;
    },
    d(i) {
      Ri(e, i);
    }
  };
}
function xl(t) {
  let e, n;
  return e = new Ei({
    props: {
      Icon: Xa,
      label: (
        /*i18n*/
        t[4]("common.undo")
      )
    }
  }), e.$on(
    "click",
    /*click_handler_1*/
    t[7]
  ), {
    c() {
      Pi(e.$$.fragment);
    },
    m(i, o) {
      Bi(e, i, o), n = !0;
    },
    p(i, o) {
      const r = {};
      o & /*i18n*/
      16 && (r.label = /*i18n*/
      i[4]("common.undo")), e.$set(r);
    },
    i(i) {
      n || (Ie(e.$$.fragment, i), n = !0);
    },
    o(i) {
      lt(e.$$.fragment, i), n = !1;
    },
    d(i) {
      Ri(e, i);
    }
  };
}
function Jl(t) {
  let e, n;
  return e = new _u({
    props: {
      href: (
        /*download*/
        t[2]
      ),
      download: !0,
      $$slots: { default: [vg] },
      $$scope: { ctx: t }
    }
  }), {
    c() {
      Pi(e.$$.fragment);
    },
    m(i, o) {
      Bi(e, i, o), n = !0;
    },
    p(i, o) {
      const r = {};
      o & /*download*/
      4 && (r.href = /*download*/
      i[2]), o & /*$$scope, i18n*/
      528 && (r.$$scope = { dirty: o, ctx: i }), e.$set(r);
    },
    i(i) {
      n || (Ie(e.$$.fragment, i), n = !0);
    },
    o(i) {
      lt(e.$$.fragment, i), n = !1;
    },
    d(i) {
      Ri(e, i);
    }
  };
}
function vg(t) {
  let e, n;
  return e = new Ei({
    props: {
      Icon: Ga,
      label: (
        /*i18n*/
        t[4]("common.download")
      )
    }
  }), {
    c() {
      Pi(e.$$.fragment);
    },
    m(i, o) {
      Bi(e, i, o), n = !0;
    },
    p(i, o) {
      const r = {};
      o & /*i18n*/
      16 && (r.label = /*i18n*/
      i[4]("common.download")), e.$set(r);
    },
    i(i) {
      n || (Ie(e.$$.fragment, i), n = !0);
    },
    o(i) {
      lt(e.$$.fragment, i), n = !1;
    },
    d(i) {
      Ri(e, i);
    }
  };
}
function wg(t) {
  let e, n, i, o, r, s, a = (
    /*editable*/
    t[0] && Zl(t)
  ), l = (
    /*undoable*/
    t[1] && xl(t)
  ), u = (
    /*download*/
    t[2] && Jl(t)
  );
  return r = new Ei({
    props: {
      Icon: ld,
      label: (
        /*i18n*/
        t[4]("common.clear")
      )
    }
  }), r.$on(
    "click",
    /*click_handler_2*/
    t[8]
  ), {
    c() {
      e = _g("div"), a && a.c(), n = Sr(), l && l.c(), i = Sr(), u && u.c(), o = Sr(), Pi(r.$$.fragment), dg(e, "class", "svelte-1wj0ocy"), Xl(e, "not-absolute", !/*absolute*/
      t[3]), Vl(
        e,
        "position",
        /*absolute*/
        t[3] ? "absolute" : "static"
      );
    },
    m(c, f) {
      pg(c, e, f), a && a.m(e, null), kr(e, n), l && l.m(e, null), kr(e, i), u && u.m(e, null), kr(e, o), Bi(r, e, null), s = !0;
    },
    p(c, [f]) {
      /*editable*/
      c[0] ? a ? (a.p(c, f), f & /*editable*/
      1 && Ie(a, 1)) : (a = Zl(c), a.c(), Ie(a, 1), a.m(e, n)) : a && (Cr(), lt(a, 1, 1, () => {
        a = null;
      }), Er()), /*undoable*/
      c[1] ? l ? (l.p(c, f), f & /*undoable*/
      2 && Ie(l, 1)) : (l = xl(c), l.c(), Ie(l, 1), l.m(e, i)) : l && (Cr(), lt(l, 1, 1, () => {
        l = null;
      }), Er()), /*download*/
      c[2] ? u ? (u.p(c, f), f & /*download*/
      4 && Ie(u, 1)) : (u = Jl(c), u.c(), Ie(u, 1), u.m(e, o)) : u && (Cr(), lt(u, 1, 1, () => {
        u = null;
      }), Er());
      const h = {};
      f & /*i18n*/
      16 && (h.label = /*i18n*/
      c[4]("common.clear")), r.$set(h), (!s || f & /*absolute*/
      8) && Xl(e, "not-absolute", !/*absolute*/
      c[3]), f & /*absolute*/
      8 && Vl(
        e,
        "position",
        /*absolute*/
        c[3] ? "absolute" : "static"
      );
    },
    i(c) {
      s || (Ie(a), Ie(l), Ie(u), Ie(r.$$.fragment, c), s = !0);
    },
    o(c) {
      lt(a), lt(l), lt(u), lt(r.$$.fragment, c), s = !1;
    },
    d(c) {
      c && hg(e), a && a.d(), l && l.d(), u && u.d(), Ri(r);
    }
  };
}
function yg(t, e, n) {
  let { editable: i = !1 } = e, { undoable: o = !1 } = e, { download: r = null } = e, { absolute: s = !0 } = e, { i18n: a } = e;
  const l = bg(), u = () => l("edit"), c = () => l("undo"), f = (h) => {
    l("clear"), h.stopPropagation();
  };
  return t.$$set = (h) => {
    "editable" in h && n(0, i = h.editable), "undoable" in h && n(1, o = h.undoable), "download" in h && n(2, r = h.download), "absolute" in h && n(3, s = h.absolute), "i18n" in h && n(4, a = h.i18n);
  }, [
    i,
    o,
    r,
    s,
    a,
    l,
    u,
    c,
    f
  ];
}
class ic extends fg {
  constructor(e) {
    super(), mg(this, e, yg, wg, gg, {
      editable: 0,
      undoable: 1,
      download: 2,
      absolute: 3,
      i18n: 4
    });
  }
}
function Ar(t, e, n, i) {
  return new (n || (n = Promise))(function(o, r) {
    function s(u) {
      try {
        l(i.next(u));
      } catch (c) {
        r(c);
      }
    }
    function a(u) {
      try {
        l(i.throw(u));
      } catch (c) {
        r(c);
      }
    }
    function l(u) {
      var c;
      u.done ? o(u.value) : (c = u.value, c instanceof n ? c : new n(function(f) {
        f(c);
      })).then(s, a);
    }
    l((i = i.apply(t, e || [])).next());
  });
}
class oc {
  constructor() {
    this.listeners = {};
  }
  on(e, n, i) {
    if (this.listeners[e] || (this.listeners[e] = /* @__PURE__ */ new Set()), this.listeners[e].add(n), i == null ? void 0 : i.once) {
      const o = () => {
        this.un(e, o), this.un(e, n);
      };
      return this.on(e, o), o;
    }
    return () => this.un(e, n);
  }
  un(e, n) {
    var i;
    (i = this.listeners[e]) === null || i === void 0 || i.delete(n);
  }
  once(e, n) {
    return this.on(e, n, { once: !0 });
  }
  unAll() {
    this.listeners = {};
  }
  emit(e, ...n) {
    this.listeners[e] && this.listeners[e].forEach((i) => i(...n));
  }
}
class kg extends oc {
  constructor(e) {
    super(), this.subscriptions = [], this.options = e;
  }
  onInit() {
  }
  _init(e) {
    this.wavesurfer = e, this.onInit();
  }
  destroy() {
    this.emit("destroy"), this.subscriptions.forEach((e) => e());
  }
}
class Eg extends oc {
  constructor() {
    super(...arguments), this.unsubscribe = () => {
    };
  }
  start() {
    this.unsubscribe = this.on("tick", () => {
      requestAnimationFrame(() => {
        this.emit("tick");
      });
    }), this.emit("tick");
  }
  stop() {
    this.unsubscribe();
  }
  destroy() {
    this.unsubscribe();
  }
}
const Cg = ["audio/webm", "audio/wav", "audio/mpeg", "audio/mp4", "audio/mp3"];
class Mi extends kg {
  constructor(e) {
    var n, i, o, r;
    super(Object.assign(Object.assign({}, e), { audioBitsPerSecond: (n = e.audioBitsPerSecond) !== null && n !== void 0 ? n : 128e3, scrollingWaveform: (i = e.scrollingWaveform) !== null && i !== void 0 && i, scrollingWaveformWindow: (o = e.scrollingWaveformWindow) !== null && o !== void 0 ? o : 5, renderRecordedAudio: (r = e.renderRecordedAudio) === null || r === void 0 || r })), this.stream = null, this.mediaRecorder = null, this.dataWindow = null, this.isWaveformPaused = !1, this.lastStartTime = 0, this.lastDuration = 0, this.duration = 0, this.timer = new Eg(), this.subscriptions.push(this.timer.on("tick", () => {
      const s = performance.now() - this.lastStartTime;
      this.duration = this.isPaused() ? this.duration : this.lastDuration + s, this.emit("record-progress", this.duration);
    }));
  }
  static create(e) {
    return new Mi(e || {});
  }
  renderMicStream(e) {
    const n = new AudioContext(), i = n.createMediaStreamSource(e), o = n.createAnalyser();
    i.connect(o);
    const r = o.frequencyBinCount, s = new Float32Array(r);
    let a;
    const l = Math.floor((this.options.scrollingWaveformWindow || 0) * n.sampleRate), u = () => {
      var c;
      if (this.isWaveformPaused)
        return void (a = requestAnimationFrame(u));
      if (o.getFloatTimeDomainData(s), this.options.scrollingWaveform) {
        const h = Math.min(l, this.dataWindow ? this.dataWindow.length + r : r), d = new Float32Array(l);
        if (this.dataWindow) {
          const _ = Math.max(0, l - this.dataWindow.length);
          d.set(this.dataWindow.slice(-h + r), _);
        }
        d.set(s, l - r), this.dataWindow = d;
      } else
        this.dataWindow = s;
      const f = this.options.scrollingWaveformWindow;
      this.wavesurfer && ((c = this.originalOptions) !== null && c !== void 0 || (this.originalOptions = { cursorWidth: this.wavesurfer.options.cursorWidth, interact: this.wavesurfer.options.interact }), this.wavesurfer.options.cursorWidth = 0, this.wavesurfer.options.interact = !1, this.wavesurfer.load("", [this.dataWindow], f)), a = requestAnimationFrame(u);
    };
    return u(), { onDestroy: () => {
      cancelAnimationFrame(a), i == null || i.disconnect(), n == null || n.close();
    }, onEnd: () => {
      this.isWaveformPaused = !0, cancelAnimationFrame(a), this.stopMic();
    } };
  }
  startMic(e) {
    return Ar(this, void 0, void 0, function* () {
      let n;
      try {
        n = yield navigator.mediaDevices.getUserMedia({ audio: !(e != null && e.deviceId) || { deviceId: e.deviceId } });
      } catch (r) {
        throw new Error("Error accessing the microphone: " + r.message);
      }
      const { onDestroy: i, onEnd: o } = this.renderMicStream(n);
      return this.subscriptions.push(this.once("destroy", i)), this.subscriptions.push(this.once("record-end", o)), this.stream = n, n;
    });
  }
  stopMic() {
    this.stream && (this.stream.getTracks().forEach((e) => e.stop()), this.stream = null, this.mediaRecorder = null);
  }
  startRecording(e) {
    return Ar(this, void 0, void 0, function* () {
      const n = this.stream || (yield this.startMic(e));
      this.dataWindow = null;
      const i = this.mediaRecorder || new MediaRecorder(n, { mimeType: this.options.mimeType || Cg.find((s) => MediaRecorder.isTypeSupported(s)), audioBitsPerSecond: this.options.audioBitsPerSecond });
      this.mediaRecorder = i, this.stopRecording();
      const o = [];
      i.ondataavailable = (s) => {
        s.data.size > 0 && o.push(s.data);
      };
      const r = (s) => {
        var a;
        const l = new Blob(o, { type: i.mimeType });
        this.emit(s, l), this.options.renderRecordedAudio && (this.applyOriginalOptionsIfNeeded(), (a = this.wavesurfer) === null || a === void 0 || a.load(URL.createObjectURL(l)));
      };
      i.onpause = () => r("record-pause"), i.onstop = () => r("record-end"), i.start(), this.lastStartTime = performance.now(), this.lastDuration = 0, this.duration = 0, this.isWaveformPaused = !1, this.timer.start(), this.emit("record-start");
    });
  }
  getDuration() {
    return this.duration;
  }
  isRecording() {
    var e;
    return ((e = this.mediaRecorder) === null || e === void 0 ? void 0 : e.state) === "recording";
  }
  isPaused() {
    var e;
    return ((e = this.mediaRecorder) === null || e === void 0 ? void 0 : e.state) === "paused";
  }
  isActive() {
    var e;
    return ((e = this.mediaRecorder) === null || e === void 0 ? void 0 : e.state) !== "inactive";
  }
  stopRecording() {
    var e;
    this.isActive() && ((e = this.mediaRecorder) === null || e === void 0 || e.stop(), this.timer.stop());
  }
  pauseRecording() {
    var e, n;
    this.isRecording() && (this.isWaveformPaused = !0, (e = this.mediaRecorder) === null || e === void 0 || e.requestData(), (n = this.mediaRecorder) === null || n === void 0 || n.pause(), this.timer.stop(), this.lastDuration = this.duration);
  }
  resumeRecording() {
    var e;
    this.isPaused() && (this.isWaveformPaused = !1, (e = this.mediaRecorder) === null || e === void 0 || e.resume(), this.timer.start(), this.lastStartTime = performance.now(), this.emit("record-resume"));
  }
  static getAvailableAudioDevices() {
    return Ar(this, void 0, void 0, function* () {
      return navigator.mediaDevices.enumerateDevices().then((e) => e.filter((n) => n.kind === "audioinput"));
    });
  }
  destroy() {
    this.applyOriginalOptionsIfNeeded(), super.destroy(), this.stopRecording(), this.stopMic();
  }
  applyOriginalOptionsIfNeeded() {
    this.wavesurfer && this.originalOptions && (this.wavesurfer.options.cursorWidth = this.originalOptions.cursorWidth, this.wavesurfer.options.interact = this.originalOptions.interact, delete this.originalOptions);
  }
}
const {
  SvelteComponent: Sg,
  append: ge,
  attr: xe,
  binding_callbacks: ci,
  create_component: Ag,
  destroy_component: Tg,
  destroy_each: Lg,
  detach: Di,
  element: st,
  empty: Pg,
  ensure_array_like: Yl,
  init: Rg,
  insert: Oi,
  listen: fi,
  mount_component: Bg,
  run_all: Mg,
  safe_not_equal: Dg,
  set_data: on,
  set_input_value: ts,
  space: Ln,
  text: rn,
  transition_in: Og,
  transition_out: Hg
} = window.__gradio__svelte__internal, { createEventDispatcher: Ng } = window.__gradio__svelte__internal;
function Ql(t, e, n) {
  const i = t.slice();
  return i[22] = e[n], i;
}
function Kl(t) {
  let e, n;
  return {
    c() {
      e = st("time"), n = rn(
        /*record_time*/
        t[2]
      ), xe(e, "class", "duration-button duration svelte-l4xo8n");
    },
    m(i, o) {
      Oi(i, e, o), ge(e, n);
    },
    p(i, o) {
      o & /*record_time*/
      4 && on(
        n,
        /*record_time*/
        i[2]
      );
    },
    d(i) {
      i && Di(e);
    }
  };
}
function Ig(t) {
  let e, n = Yl(
    /*micDevices*/
    t[5]
  ), i = [];
  for (let o = 0; o < n.length; o += 1)
    i[o] = $l(Ql(t, n, o));
  return {
    c() {
      for (let o = 0; o < i.length; o += 1)
        i[o].c();
      e = Pg();
    },
    m(o, r) {
      for (let s = 0; s < i.length; s += 1)
        i[s] && i[s].m(o, r);
      Oi(o, e, r);
    },
    p(o, r) {
      if (r & /*micDevices*/
      32) {
        n = Yl(
          /*micDevices*/
          o[5]
        );
        let s;
        for (s = 0; s < n.length; s += 1) {
          const a = Ql(o, n, s);
          i[s] ? i[s].p(a, r) : (i[s] = $l(a), i[s].c(), i[s].m(e.parentNode, e));
        }
        for (; s < i.length; s += 1)
          i[s].d(1);
        i.length = n.length;
      }
    },
    d(o) {
      o && Di(e), Lg(i, o);
    }
  };
}
function Ug(t) {
  let e, n = (
    /*i18n*/
    t[1]("audio.no_microphone") + ""
  ), i;
  return {
    c() {
      e = st("option"), i = rn(n), e.__value = "", ts(e, e.__value);
    },
    m(o, r) {
      Oi(o, e, r), ge(e, i);
    },
    p(o, r) {
      r & /*i18n*/
      2 && n !== (n = /*i18n*/
      o[1]("audio.no_microphone") + "") && on(i, n);
    },
    d(o) {
      o && Di(e);
    }
  };
}
function $l(t) {
  let e, n = (
    /*micDevice*/
    t[22].label + ""
  ), i, o;
  return {
    c() {
      e = st("option"), i = rn(n), e.__value = o = /*micDevice*/
      t[22].deviceId, ts(e, e.__value);
    },
    m(r, s) {
      Oi(r, e, s), ge(e, i);
    },
    p(r, s) {
      s & /*micDevices*/
      32 && n !== (n = /*micDevice*/
      r[22].label + "") && on(i, n), s & /*micDevices*/
      32 && o !== (o = /*micDevice*/
      r[22].deviceId) && (e.__value = o, ts(e, e.__value));
    },
    d(r) {
      r && Di(e);
    }
  };
}
function jg(t) {
  let e, n, i, o = (
    /*i18n*/
    t[1]("audio.record") + ""
  ), r, s, a, l = (
    /*i18n*/
    t[1]("audio.stop") + ""
  ), u, c, f, h, d = (
    /*i18n*/
    t[1]("audio.stop") + ""
  ), _, m, v, p, k, w, C = (
    /*i18n*/
    t[1]("audio.resume") + ""
  ), T, y, O, P, A, R, z, X;
  p = new Va({});
  let F = (
    /*timing*/
    t[4] && !/*show_recording_waveform*/
    t[3] && Kl(t)
  );
  function J(N, U) {
    return (
      /*micDevices*/
      N[5].length === 0 ? Ug : Ig
    );
  }
  let E = J(t), V = E(t);
  return {
    c() {
      e = st("div"), n = st("div"), i = st("button"), r = rn(o), s = Ln(), a = st("button"), u = rn(l), f = Ln(), h = st("button"), _ = rn(d), m = Ln(), v = st("button"), Ag(p.$$.fragment), k = Ln(), w = st("button"), T = rn(C), y = Ln(), F && F.c(), O = Ln(), P = st("select"), V.c(), xe(i, "class", "record record-button svelte-l4xo8n"), xe(a, "class", c = "stop-button " + /*record*/
      (t[0].isPaused() ? "stop-button-paused" : "") + " svelte-l4xo8n"), xe(h, "id", "stop-paused"), xe(h, "class", "stop-button-paused svelte-l4xo8n"), xe(v, "class", "pause-button svelte-l4xo8n"), xe(w, "class", "resume-button svelte-l4xo8n"), xe(n, "class", "wrapper svelte-l4xo8n"), xe(P, "class", "mic-select svelte-l4xo8n"), xe(P, "aria-label", "Select input device"), P.disabled = A = /*micDevices*/
      t[5].length === 0, xe(e, "class", "controls svelte-l4xo8n");
    },
    m(N, U) {
      Oi(N, e, U), ge(e, n), ge(n, i), ge(i, r), t[11](i), ge(n, s), ge(n, a), ge(a, u), t[13](a), ge(n, f), ge(n, h), ge(h, _), t[15](h), ge(n, m), ge(n, v), Bg(p, v, null), t[17](v), ge(n, k), ge(n, w), ge(w, T), t[19](w), ge(n, y), F && F.m(n, null), ge(e, O), ge(e, P), V.m(P, null), R = !0, z || (X = [
        fi(
          i,
          "click",
          /*click_handler*/
          t[12]
        ),
        fi(
          a,
          "click",
          /*click_handler_1*/
          t[14]
        ),
        fi(
          h,
          "click",
          /*click_handler_2*/
          t[16]
        ),
        fi(
          v,
          "click",
          /*click_handler_3*/
          t[18]
        ),
        fi(
          w,
          "click",
          /*click_handler_4*/
          t[20]
        )
      ], z = !0);
    },
    p(N, [U]) {
      (!R || U & /*i18n*/
      2) && o !== (o = /*i18n*/
      N[1]("audio.record") + "") && on(r, o), (!R || U & /*i18n*/
      2) && l !== (l = /*i18n*/
      N[1]("audio.stop") + "") && on(u, l), (!R || U & /*record*/
      1 && c !== (c = "stop-button " + /*record*/
      (N[0].isPaused() ? "stop-button-paused" : "") + " svelte-l4xo8n")) && xe(a, "class", c), (!R || U & /*i18n*/
      2) && d !== (d = /*i18n*/
      N[1]("audio.stop") + "") && on(_, d), (!R || U & /*i18n*/
      2) && C !== (C = /*i18n*/
      N[1]("audio.resume") + "") && on(T, C), /*timing*/
      N[4] && !/*show_recording_waveform*/
      N[3] ? F ? F.p(N, U) : (F = Kl(N), F.c(), F.m(n, null)) : F && (F.d(1), F = null), E === (E = J(N)) && V ? V.p(N, U) : (V.d(1), V = E(N), V && (V.c(), V.m(P, null))), (!R || U & /*micDevices*/
      32 && A !== (A = /*micDevices*/
      N[5].length === 0)) && (P.disabled = A);
    },
    i(N) {
      R || (Og(p.$$.fragment, N), R = !0);
    },
    o(N) {
      Hg(p.$$.fragment, N), R = !1;
    },
    d(N) {
      N && Di(e), t[11](null), t[13](null), t[15](null), Tg(p), t[17](null), t[19](null), F && F.d(), V.d(), z = !1, Mg(X);
    }
  };
}
function Fg(t, e, n) {
  let { record: i } = e, { i18n: o } = e, r = [], s, a, l, u, c, { record_time: f } = e, { show_recording_waveform: h } = e, { timing: d = !1 } = e;
  const _ = Ng();
  function m(A) {
    ci[A ? "unshift" : "push"](() => {
      s = A, n(6, s), n(0, i);
    });
  }
  const v = () => i.startRecording();
  function p(A) {
    ci[A ? "unshift" : "push"](() => {
      u = A, n(9, u), n(0, i);
    });
  }
  const k = () => {
    i.isPaused() && (i.resumeRecording(), i.stopRecording()), i.stopRecording();
  };
  function w(A) {
    ci[A ? "unshift" : "push"](() => {
      c = A, n(10, c), n(0, i);
    });
  }
  const C = () => {
    i.isPaused() && (i.resumeRecording(), i.stopRecording()), i.stopRecording();
  };
  function T(A) {
    ci[A ? "unshift" : "push"](() => {
      a = A, n(7, a), n(0, i);
    });
  }
  const y = () => i.pauseRecording();
  function O(A) {
    ci[A ? "unshift" : "push"](() => {
      l = A, n(8, l), n(0, i);
    });
  }
  const P = () => i.resumeRecording();
  return t.$$set = (A) => {
    "record" in A && n(0, i = A.record), "i18n" in A && n(1, o = A.i18n), "record_time" in A && n(2, f = A.record_time), "show_recording_waveform" in A && n(3, h = A.show_recording_waveform), "timing" in A && n(4, d = A.timing);
  }, t.$$.update = () => {
    if (t.$$.dirty & /*i18n*/
    2)
      try {
        let A = [];
        Mi.getAvailableAudioDevices().then((R) => {
          n(5, r = R), R.forEach((z) => {
            z.deviceId && A.push(z);
          }), n(5, r = A);
        });
      } catch (A) {
        throw A instanceof DOMException && A.name == "NotAllowedError" && _("error", o("audio.allow_recording_access")), A;
      }
    t.$$.dirty & /*record*/
    1 && i.on("record-start", () => {
      i.startMic(), n(6, s.style.display = "none", s), n(9, u.style.display = "flex", u), n(7, a.style.display = "block", a);
    }), t.$$.dirty & /*record*/
    1 && i.on("record-end", () => {
      i.isPaused() && (i.resumeRecording(), i.stopRecording()), i.stopMic(), n(6, s.style.display = "flex", s), n(9, u.style.display = "none", u), n(7, a.style.display = "none", a), n(6, s.disabled = !1, s);
    }), t.$$.dirty & /*record*/
    1 && i.on("record-pause", () => {
      n(7, a.style.display = "none", a), n(8, l.style.display = "block", l), n(9, u.style.display = "none", u), n(10, c.style.display = "flex", c);
    }), t.$$.dirty & /*record*/
    1 && i.on("record-resume", () => {
      n(7, a.style.display = "block", a), n(8, l.style.display = "none", l), n(6, s.style.display = "none", s), n(9, u.style.display = "flex", u), n(10, c.style.display = "none", c);
    });
  }, [
    i,
    o,
    f,
    h,
    d,
    r,
    s,
    a,
    l,
    u,
    c,
    m,
    v,
    p,
    k,
    w,
    C,
    T,
    y,
    O,
    P
  ];
}
class qg extends Sg {
  constructor(e) {
    super(), Rg(this, e, Fg, jg, Dg, {
      record: 0,
      i18n: 1,
      record_time: 2,
      show_recording_waveform: 3,
      timing: 4
    });
  }
}
const {
  SvelteComponent: zg,
  add_flush_callback: rc,
  append: at,
  attr: Ct,
  bind: sc,
  binding_callbacks: Mn,
  check_outros: ea,
  create_component: lc,
  destroy_component: ac,
  detach: Hi,
  element: At,
  group_outros: ta,
  init: Gg,
  insert: Ni,
  mount_component: uc,
  noop: cc,
  safe_not_equal: Wg,
  set_data: Vg,
  space: Dn,
  text: Xg,
  transition_in: Ht,
  transition_out: On
} = window.__gradio__svelte__internal, { onMount: Zg } = window.__gradio__svelte__internal, { createEventDispatcher: xg } = window.__gradio__svelte__internal;
function na(t) {
  let e, n, i, o, r, s = (
    /*mode*/
    t[0] === "edit" && ns > 0 && ia()
  );
  function a(c, f) {
    return (
      /*timing*/
      c[13] ? Yg : Jg
    );
  }
  let l = a(t), u = l(t);
  return {
    c() {
      e = At("div"), n = At("time"), n.textContent = "0:00", i = Dn(), o = At("div"), s && s.c(), r = Dn(), u.c(), Ct(n, "class", "time svelte-1z0uz8p"), Ct(e, "class", "timestamps svelte-1z0uz8p");
    },
    m(c, f) {
      Ni(c, e, f), at(e, n), t[19](n), at(e, i), at(e, o), s && s.m(o, null), at(o, r), u.m(o, null);
    },
    p(c, f) {
      /*mode*/
      c[0] === "edit" && ns > 0 ? s ? s.p(c, f) : (s = ia(), s.c(), s.m(o, r)) : s && (s.d(1), s = null), l === (l = a(c)) && u ? u.p(c, f) : (u.d(1), u = l(c), u && (u.c(), u.m(o, null)));
    },
    d(c) {
      c && Hi(e), t[19](null), s && s.d(), u.d();
    }
  };
}
function ia(t) {
  let e;
  return {
    c() {
      e = At("time"), e.textContent = `${cn(ns)}`, Ct(e, "class", "trim-duration svelte-1z0uz8p");
    },
    m(n, i) {
      Ni(n, e, i);
    },
    p: cc,
    d(n) {
      n && Hi(e);
    }
  };
}
function Jg(t) {
  let e;
  return {
    c() {
      e = At("time"), e.textContent = "0:00", Ct(e, "class", "duration svelte-1z0uz8p");
    },
    m(n, i) {
      Ni(n, e, i), t[20](e);
    },
    p: cc,
    d(n) {
      n && Hi(e), t[20](null);
    }
  };
}
function Yg(t) {
  let e, n = cn(
    /*seconds*/
    t[12]
  ) + "", i;
  return {
    c() {
      e = At("time"), i = Xg(n), Ct(e, "class", "duration svelte-1z0uz8p");
    },
    m(o, r) {
      Ni(o, e, r), at(e, i);
    },
    p(o, r) {
      r & /*seconds*/
      4096 && n !== (n = cn(
        /*seconds*/
        o[12]
      ) + "") && Vg(i, n);
    },
    d(o) {
      o && Hi(e);
    }
  };
}
function oa(t) {
  let e, n, i;
  function o(s) {
    t[21](s);
  }
  let r = {
    i18n: (
      /*i18n*/
      t[1]
    ),
    timing: (
      /*timing*/
      t[13]
    ),
    show_recording_waveform: (
      /*waveform_options*/
      t[2].show_recording_waveform
    ),
    record_time: cn(
      /*seconds*/
      t[12]
    )
  };
  return (
    /*record*/
    t[6] !== void 0 && (r.record = /*record*/
    t[6]), e = new qg({ props: r }), Mn.push(() => sc(e, "record", o)), {
      c() {
        lc(e.$$.fragment);
      },
      m(s, a) {
        uc(e, s, a), i = !0;
      },
      p(s, a) {
        const l = {};
        a & /*i18n*/
        2 && (l.i18n = /*i18n*/
        s[1]), a & /*timing*/
        8192 && (l.timing = /*timing*/
        s[13]), a & /*waveform_options*/
        4 && (l.show_recording_waveform = /*waveform_options*/
        s[2].show_recording_waveform), a & /*seconds*/
        4096 && (l.record_time = cn(
          /*seconds*/
          s[12]
        )), !n && a & /*record*/
        64 && (n = !0, l.record = /*record*/
        s[6], rc(() => n = !1)), e.$set(l);
      },
      i(s) {
        i || (Ht(e.$$.fragment, s), i = !0);
      },
      o(s) {
        On(e.$$.fragment, s), i = !1;
      },
      d(s) {
        ac(e, s);
      }
    }
  );
}
function ra(t) {
  let e, n, i;
  function o(s) {
    t[22](s);
  }
  let r = {
    playing: (
      /*playing*/
      t[10]
    ),
    audio_duration: (
      /*audio_duration*/
      t[11]
    ),
    i18n: (
      /*i18n*/
      t[1]
    ),
    waveform_options: (
      /*waveform_options*/
      t[2]
    )
  };
  return (
    /*recordingWaveform*/
    t[3] !== void 0 && (r.waveform = /*recordingWaveform*/
    t[3]), e = new ou({ props: r }), Mn.push(() => sc(e, "waveform", o)), {
      c() {
        lc(e.$$.fragment);
      },
      m(s, a) {
        uc(e, s, a), i = !0;
      },
      p(s, a) {
        const l = {};
        a & /*playing*/
        1024 && (l.playing = /*playing*/
        s[10]), a & /*audio_duration*/
        2048 && (l.audio_duration = /*audio_duration*/
        s[11]), a & /*i18n*/
        2 && (l.i18n = /*i18n*/
        s[1]), a & /*waveform_options*/
        4 && (l.waveform_options = /*waveform_options*/
        s[2]), !n && a & /*recordingWaveform*/
        8 && (n = !0, l.waveform = /*recordingWaveform*/
        s[3], rc(() => n = !1)), e.$set(l);
      },
      i(s) {
        i || (Ht(e.$$.fragment, s), i = !0);
      },
      o(s) {
        On(e.$$.fragment, s), i = !1;
      },
      d(s) {
        ac(e, s);
      }
    }
  );
}
function Qg(t) {
  let e, n, i, o, r, s, a, l, u = (
    /*timing*/
    (t[13] || /*recordedAudio*/
    t[7]) && /*waveform_options*/
    t[2].show_recording_waveform && na(t)
  ), c = (
    /*microphoneContainer*/
    t[5] && !/*recordedAudio*/
    t[7] && oa(t)
  ), f = (
    /*recordingWaveform*/
    t[3] && /*recordedAudio*/
    t[7] && ra(t)
  );
  return {
    c() {
      e = At("div"), n = At("div"), i = Dn(), o = At("div"), r = Dn(), u && u.c(), s = Dn(), c && c.c(), a = Dn(), f && f.c(), Ct(n, "class", "microphone svelte-1z0uz8p"), Ct(n, "data-testid", "microphone-waveform"), Ct(o, "data-testid", "recording-waveform"), Ct(e, "class", "component-wrapper svelte-1z0uz8p");
    },
    m(h, d) {
      Ni(h, e, d), at(e, n), t[17](n), at(e, i), at(e, o), t[18](o), at(e, r), u && u.m(e, null), at(e, s), c && c.m(e, null), at(e, a), f && f.m(e, null), l = !0;
    },
    p(h, [d]) {
      /*timing*/
      (h[13] || /*recordedAudio*/
      h[7]) && /*waveform_options*/
      h[2].show_recording_waveform ? u ? u.p(h, d) : (u = na(h), u.c(), u.m(e, s)) : u && (u.d(1), u = null), /*microphoneContainer*/
      h[5] && !/*recordedAudio*/
      h[7] ? c ? (c.p(h, d), d & /*microphoneContainer, recordedAudio*/
      160 && Ht(c, 1)) : (c = oa(h), c.c(), Ht(c, 1), c.m(e, a)) : c && (ta(), On(c, 1, 1, () => {
        c = null;
      }), ea()), /*recordingWaveform*/
      h[3] && /*recordedAudio*/
      h[7] ? f ? (f.p(h, d), d & /*recordingWaveform, recordedAudio*/
      136 && Ht(f, 1)) : (f = ra(h), f.c(), Ht(f, 1), f.m(e, null)) : f && (ta(), On(f, 1, 1, () => {
        f = null;
      }), ea());
    },
    i(h) {
      l || (Ht(c), Ht(f), l = !0);
    },
    o(h) {
      On(c), On(f), l = !1;
    },
    d(h) {
      h && Hi(e), t[17](null), t[18](null), u && u.d(), c && c.d(), f && f.d();
    }
  };
}
let ns = 0;
function mt(t) {
  let e, n = t[0], i = 1;
  for (; i < t.length; ) {
    const o = t[i], r = t[i + 1];
    if (i += 2, (o === "optionalAccess" || o === "optionalCall") && n == null)
      return;
    o === "access" || o === "optionalAccess" ? (e = n, n = r(n)) : (o === "call" || o === "optionalCall") && (n = r((...s) => n.call(e, ...s)), e = void 0);
  }
  return n;
}
function Kg(t, e, n) {
  let { mode: i } = e, { i18n: o } = e, { dispatch_blob: r } = e, { waveform_settings: s } = e, { waveform_options: a = { show_recording_waveform: !0 } } = e, l, u, c = !1, f, h, d, _ = null, m, v, p, k = 0, w, C = !1;
  const T = () => {
    clearInterval(w), n(16, w = setInterval(
      () => {
        n(12, k++, k);
      },
      1e3
    ));
  }, y = xg(), O = () => {
    h && n(5, h.innerHTML = "", h), l !== void 0 && l.destroy(), h && (l = Ft.create({
      ...s,
      normalize: !1,
      container: h
    }), n(6, d = l.registerPlugin(Mi.create())), d.startMic());
  }, P = () => {
    let E = f;
    !_ || !E || n(3, u = Ft.create({
      container: E,
      url: _,
      ...s
    }));
  };
  Zg(() => {
    O(), window.addEventListener("keydown", (E) => {
      E.key === "ArrowRight" ? $s(u, 0.1) : E.key === "ArrowLeft" && $s(u, -0.1);
    });
  });
  function A(E) {
    Mn[E ? "unshift" : "push"](() => {
      h = E, n(5, h);
    });
  }
  function R(E) {
    Mn[E ? "unshift" : "push"](() => {
      f = E, n(4, f);
    });
  }
  function z(E) {
    Mn[E ? "unshift" : "push"](() => {
      m = E, n(8, m), n(3, u);
    });
  }
  function X(E) {
    Mn[E ? "unshift" : "push"](() => {
      v = E, n(9, v), n(3, u);
    });
  }
  function F(E) {
    d = E, n(6, d);
  }
  function J(E) {
    u = E, n(3, u);
  }
  return t.$$set = (E) => {
    "mode" in E && n(0, i = E.mode), "i18n" in E && n(1, o = E.i18n), "dispatch_blob" in E && n(14, r = E.dispatch_blob), "waveform_settings" in E && n(15, s = E.waveform_settings), "waveform_options" in E && n(2, a = E.waveform_options);
  }, t.$$.update = () => {
    t.$$.dirty & /*record, waveform_options, microphoneContainer*/
    100 && mt([
      d,
      "optionalAccess",
      (E) => E.on,
      "call",
      (E) => E("record-start", () => {
        if (T(), n(13, C = !0), y("start_recording"), a.show_recording_waveform) {
          let V = h;
          V && (V.style.display = "block");
        }
      })
    ]), t.$$.dirty & /*record, interval, waveform_settings, dispatch_blob*/
    114752 && mt([
      d,
      "optionalAccess",
      (E) => E.on,
      "call",
      (E) => E("record-end", async (V) => {
        n(12, k = 0), n(13, C = !1), clearInterval(w);
        try {
          const N = await V.arrayBuffer(), ee = await new AudioContext({ sampleRate: s.sampleRate }).decodeAudioData(N);
          console.log(ee), ee && await Z_(ee).then(async (H) => {
            await r([H], "change"), await r([H], "stop_recording");
          });
        } catch (N) {
          console.error(N);
        }
      })
    ]), t.$$.dirty & /*record, interval*/
    65600 && mt([
      d,
      "optionalAccess",
      (E) => E.on,
      "call",
      (E) => E("record-pause", () => {
        y("pause_recording"), clearInterval(w);
      })
    ]), t.$$.dirty & /*record*/
    64 && mt([
      d,
      "optionalAccess",
      (E) => E.on,
      "call",
      (E) => E("record-resume", () => {
        T();
      })
    ]), t.$$.dirty & /*recordingWaveform, durationRef*/
    520 && mt([
      u,
      "optionalAccess",
      (E) => E.on,
      "call",
      (E) => E("decode", (V) => {
        n(11, p = V), v && n(9, v.textContent = cn(V), v);
      })
    ]), t.$$.dirty & /*recordingWaveform, timeRef*/
    264 && mt([
      u,
      "optionalAccess",
      (E) => E.on,
      "call",
      (E) => E("timeupdate", (V) => m && n(8, m.textContent = cn(V), m))
    ]), t.$$.dirty & /*recordingWaveform*/
    8 && mt([
      u,
      "optionalAccess",
      (E) => E.on,
      "call",
      (E) => E("pause", () => {
        y("pause"), n(10, c = !1);
      })
    ]), t.$$.dirty & /*recordingWaveform*/
    8 && mt([
      u,
      "optionalAccess",
      (E) => E.on,
      "call",
      (E) => E("play", () => {
        y("play"), n(10, c = !0);
      })
    ]), t.$$.dirty & /*recordingWaveform*/
    8 && mt([
      u,
      "optionalAccess",
      (E) => E.on,
      "call",
      (E) => E("finish", () => {
        y("stop"), n(10, c = !1);
      })
    ]), t.$$.dirty & /*record, microphoneContainer, recordingContainer, recordedAudio*/
    240 && mt([
      d,
      "optionalAccess",
      (E) => E.on,
      "call",
      (E) => E("record-end", (V) => {
        n(7, _ = URL.createObjectURL(V));
        const N = h, U = f;
        N && (N.style.display = "none"), U && _ && (U.innerHTML = "", P());
      })
    ]);
  }, [
    i,
    o,
    a,
    u,
    f,
    h,
    d,
    _,
    m,
    v,
    c,
    p,
    k,
    C,
    r,
    s,
    w,
    A,
    R,
    z,
    X,
    F,
    J
  ];
}
class $g extends zg {
  constructor(e) {
    super(), Gg(this, e, Kg, Qg, Wg, {
      mode: 0,
      i18n: 1,
      dispatch_blob: 14,
      waveform_settings: 15,
      waveform_options: 2
    });
  }
}
const {
  SvelteComponent: eb,
  append: un,
  attr: In,
  binding_callbacks: tb,
  detach: Po,
  element: zn,
  init: nb,
  insert: Ro,
  listen: fc,
  noop: sa,
  null_to_empty: la,
  safe_not_equal: ib,
  set_data: dc,
  set_style: aa,
  space: ms,
  text: hc
} = window.__gradio__svelte__internal, { onMount: ob } = window.__gradio__svelte__internal;
function ua(t) {
  let e;
  return {
    c() {
      e = zn("div"), aa(
        e,
        "display",
        /*recording*/
        t[0] ? "block" : "none"
      );
    },
    m(n, i) {
      Ro(n, e, i), t[9](e);
    },
    p(n, i) {
      i & /*recording*/
      1 && aa(
        e,
        "display",
        /*recording*/
        n[0] ? "block" : "none"
      );
    },
    d(n) {
      n && Po(e), t[9](null);
    }
  };
}
function rb(t) {
  let e, n, i, o = (
    /*i18n*/
    t[4]("audio.record") + ""
  ), r, s, a;
  return {
    c() {
      e = zn("button"), n = zn("span"), n.innerHTML = '<span class="dot"></span>', i = ms(), r = hc(o), In(n, "class", "record-icon"), In(e, "class", "record-button svelte-4ycsjo");
    },
    m(l, u) {
      Ro(l, e, u), un(e, n), un(e, i), un(e, r), s || (a = fc(
        e,
        "click",
        /*click_handler_1*/
        t[11]
      ), s = !0);
    },
    p(l, u) {
      u & /*i18n*/
      16 && o !== (o = /*i18n*/
      l[4]("audio.record") + "") && dc(r, o);
    },
    d(l) {
      l && Po(e), s = !1, a();
    }
  };
}
function sb(t) {
  let e, n, i, o = (
    /*paused_recording*/
    (t[1] ? (
      /*i18n*/
      t[4]("audio.pause")
    ) : (
      /*i18n*/
      t[4]("audio.stop")
    )) + ""
  ), r, s, a, l;
  return {
    c() {
      e = zn("button"), n = zn("span"), n.innerHTML = '<span class="pinger"></span> <span class="dot"></span>', i = ms(), r = hc(o), In(n, "class", "record-icon"), In(e, "class", s = la(
        /*paused_recording*/
        t[1] ? "stop-button-paused" : "stop-button"
      ) + " svelte-4ycsjo");
    },
    m(u, c) {
      Ro(u, e, c), un(e, n), un(e, i), un(e, r), a || (l = fc(
        e,
        "click",
        /*click_handler*/
        t[10]
      ), a = !0);
    },
    p(u, c) {
      c & /*paused_recording, i18n*/
      18 && o !== (o = /*paused_recording*/
      (u[1] ? (
        /*i18n*/
        u[4]("audio.pause")
      ) : (
        /*i18n*/
        u[4]("audio.stop")
      )) + "") && dc(r, o), c & /*paused_recording*/
      2 && s !== (s = la(
        /*paused_recording*/
        u[1] ? "stop-button-paused" : "stop-button"
      ) + " svelte-4ycsjo") && In(e, "class", s);
    },
    d(u) {
      u && Po(e), a = !1, l();
    }
  };
}
function lb(t) {
  let e, n, i = (
    /*waveform_options*/
    t[5].show_recording_waveform && ua(t)
  );
  function o(a, l) {
    return (
      /*recording*/
      a[0] ? sb : rb
    );
  }
  let r = o(t), s = r(t);
  return {
    c() {
      e = zn("div"), i && i.c(), n = ms(), s.c(), In(e, "class", "mic-wrap svelte-4ycsjo");
    },
    m(a, l) {
      Ro(a, e, l), i && i.m(e, null), un(e, n), s.m(e, null);
    },
    p(a, [l]) {
      /*waveform_options*/
      a[5].show_recording_waveform ? i ? i.p(a, l) : (i = ua(a), i.c(), i.m(e, n)) : i && (i.d(1), i = null), r === (r = o(a)) && s ? s.p(a, l) : (s.d(1), s = r(a), s && (s.c(), s.m(e, null)));
    },
    i: sa,
    o: sa,
    d(a) {
      a && Po(e), i && i.d(), s.d();
    }
  };
}
function ab(t, e, n) {
  let { recording: i = !1 } = e, { paused_recording: o = !1 } = e, { stop: r } = e, { record: s } = e, { i18n: a } = e, { waveform_settings: l } = e, { waveform_options: u = { show_recording_waveform: !0 } } = e, c, f, h;
  ob(() => {
    d();
  });
  const d = () => {
    c !== void 0 && c.destroy(), h && (c = Ft.create({
      ...l,
      height: 100,
      container: h
    }), n(6, f = c.registerPlugin(Mi.create())));
  };
  function _(p) {
    tb[p ? "unshift" : "push"](() => {
      h = p, n(7, h);
    });
  }
  const m = () => {
    f == null || f.stopMic(), r();
  }, v = () => {
    f == null || f.startMic(), s();
  };
  return t.$$set = (p) => {
    "recording" in p && n(0, i = p.recording), "paused_recording" in p && n(1, o = p.paused_recording), "stop" in p && n(2, r = p.stop), "record" in p && n(3, s = p.record), "i18n" in p && n(4, a = p.i18n), "waveform_settings" in p && n(8, l = p.waveform_settings), "waveform_options" in p && n(5, u = p.waveform_options);
  }, [
    i,
    o,
    r,
    s,
    a,
    u,
    f,
    h,
    l,
    _,
    m,
    v
  ];
}
class ub extends eb {
  constructor(e) {
    super(), nb(this, e, ab, lb, ib, {
      recording: 0,
      paused_recording: 1,
      stop: 2,
      record: 3,
      i18n: 4,
      waveform_settings: 8,
      waveform_options: 5
    });
  }
}
const {
  SvelteComponent: cb,
  add_flush_callback: Bo,
  bind: Mo,
  binding_callbacks: Do,
  bubble: Tr,
  check_outros: ps,
  create_component: qt,
  create_slot: fb,
  destroy_component: zt,
  detach: Gn,
  empty: _c,
  get_all_dirty_from_scope: db,
  get_slot_changes: hb,
  group_outros: gs,
  init: _b,
  insert: Wn,
  mount_component: Gt,
  safe_not_equal: mb,
  space: fo,
  transition_in: Oe,
  transition_out: He,
  update_slot_base: pb
} = window.__gradio__svelte__internal, { getContext: gb, onDestroy: bb, createEventDispatcher: vb } = window.__gradio__svelte__internal;
function wb(t) {
  let e, n, i, o, r;
  e = new ic({
    props: {
      i18n: (
        /*i18n*/
        t[9]
      ),
      download: (
        /*show_download_button*/
        t[6] ? (
          /*value*/
          t[1].file_data.url
        ) : null
      ),
      absolute: !0
    }
  }), e.$on(
    "clear",
    /*clear*/
    t[18]
  ), e.$on(
    "edit",
    /*edit_handler*/
    t[29]
  );
  function s(l) {
    t[30](l);
  }
  let a = {
    value: (
      /*value*/
      t[1]
    ),
    label: (
      /*label*/
      t[3]
    ),
    i18n: (
      /*i18n*/
      t[9]
    ),
    waveform_settings: (
      /*waveform_settings*/
      t[10]
    ),
    waveform_options: (
      /*waveform_options*/
      t[11]
    ),
    editable: (
      /*editable*/
      t[12]
    ),
    interactive: !0
  };
  return (
    /*mode*/
    t[14] !== void 0 && (a.mode = /*mode*/
    t[14]), i = new pu({ props: a }), Do.push(() => Mo(i, "mode", s)), i.$on(
      "stop",
      /*stop_handler*/
      t[31]
    ), i.$on(
      "play",
      /*play_handler*/
      t[32]
    ), i.$on(
      "pause",
      /*pause_handler*/
      t[33]
    ), i.$on(
      "edit",
      /*edit_handler_1*/
      t[34]
    ), {
      c() {
        qt(e.$$.fragment), n = fo(), qt(i.$$.fragment);
      },
      m(l, u) {
        Gt(e, l, u), Wn(l, n, u), Gt(i, l, u), r = !0;
      },
      p(l, u) {
        const c = {};
        u[0] & /*i18n*/
        512 && (c.i18n = /*i18n*/
        l[9]), u[0] & /*show_download_button, value*/
        66 && (c.download = /*show_download_button*/
        l[6] ? (
          /*value*/
          l[1].file_data.url
        ) : null), e.$set(c);
        const f = {};
        u[0] & /*value*/
        2 && (f.value = /*value*/
        l[1]), u[0] & /*label*/
        8 && (f.label = /*label*/
        l[3]), u[0] & /*i18n*/
        512 && (f.i18n = /*i18n*/
        l[9]), u[0] & /*waveform_settings*/
        1024 && (f.waveform_settings = /*waveform_settings*/
        l[10]), u[0] & /*waveform_options*/
        2048 && (f.waveform_options = /*waveform_options*/
        l[11]), u[0] & /*editable*/
        4096 && (f.editable = /*editable*/
        l[12]), !o && u[0] & /*mode*/
        16384 && (o = !0, f.mode = /*mode*/
        l[14], Bo(() => o = !1)), i.$set(f);
      },
      i(l) {
        r || (Oe(e.$$.fragment, l), Oe(i.$$.fragment, l), r = !0);
      },
      o(l) {
        He(e.$$.fragment, l), He(i.$$.fragment, l), r = !1;
      },
      d(l) {
        l && Gn(n), zt(e, l), zt(i, l);
      }
    }
  );
}
function yb(t) {
  let e, n, i, o;
  const r = [Eb, kb], s = [];
  function a(l, u) {
    return (
      /*active_source*/
      l[2] === "microphone" ? 0 : (
        /*active_source*/
        l[2] === "upload" ? 1 : -1
      )
    );
  }
  return ~(e = a(t)) && (n = s[e] = r[e](t)), {
    c() {
      n && n.c(), i = _c();
    },
    m(l, u) {
      ~e && s[e].m(l, u), Wn(l, i, u), o = !0;
    },
    p(l, u) {
      let c = e;
      e = a(l), e === c ? ~e && s[e].p(l, u) : (n && (gs(), He(s[c], 1, 1, () => {
        s[c] = null;
      }), ps()), ~e ? (n = s[e], n ? n.p(l, u) : (n = s[e] = r[e](l), n.c()), Oe(n, 1), n.m(i.parentNode, i)) : n = null);
    },
    i(l) {
      o || (Oe(n), o = !0);
    },
    o(l) {
      He(n), o = !1;
    },
    d(l) {
      l && Gn(i), ~e && s[e].d(l);
    }
  };
}
function kb(t) {
  let e, n, i;
  function o(s) {
    t[27](s);
  }
  let r = {
    filetype: "audio/aac,audio/midi,audio/mpeg,audio/ogg,audio/wav,audio/x-wav,audio/opus,audio/webm,audio/flac,audio/vnd.rn-realaudio,audio/x-ms-wma,audio/x-aiff,audio/amr,audio/*",
    root: (
      /*root*/
      t[4]
    ),
    $$slots: { default: [Cb] },
    $$scope: { ctx: t }
  };
  return (
    /*dragging*/
    t[0] !== void 0 && (r.dragging = /*dragging*/
    t[0]), e = new cg({ props: r }), Do.push(() => Mo(e, "dragging", o)), e.$on(
      "load",
      /*handle_load*/
      t[19]
    ), e.$on(
      "error",
      /*error_handler*/
      t[28]
    ), {
      c() {
        qt(e.$$.fragment);
      },
      m(s, a) {
        Gt(e, s, a), i = !0;
      },
      p(s, a) {
        const l = {};
        a[0] & /*root*/
        16 && (l.root = /*root*/
        s[4]), a[1] & /*$$scope*/
        32 && (l.$$scope = { dirty: a, ctx: s }), !n && a[0] & /*dragging*/
        1 && (n = !0, l.dragging = /*dragging*/
        s[0], Bo(() => n = !1)), e.$set(l);
      },
      i(s) {
        i || (Oe(e.$$.fragment, s), i = !0);
      },
      o(s) {
        He(e.$$.fragment, s), i = !1;
      },
      d(s) {
        zt(e, s);
      }
    }
  );
}
function Eb(t) {
  let e, n, i, o, r, s;
  e = new ic({
    props: { i18n: (
      /*i18n*/
      t[9]
    ), absolute: !0 }
  }), e.$on(
    "clear",
    /*clear*/
    t[18]
  );
  const a = [Ab, Sb], l = [];
  function u(c, f) {
    return (
      /*streaming*/
      c[8] ? 0 : 1
    );
  }
  return i = u(t), o = l[i] = a[i](t), {
    c() {
      qt(e.$$.fragment), n = fo(), o.c(), r = _c();
    },
    m(c, f) {
      Gt(e, c, f), Wn(c, n, f), l[i].m(c, f), Wn(c, r, f), s = !0;
    },
    p(c, f) {
      const h = {};
      f[0] & /*i18n*/
      512 && (h.i18n = /*i18n*/
      c[9]), e.$set(h);
      let d = i;
      i = u(c), i === d ? l[i].p(c, f) : (gs(), He(l[d], 1, 1, () => {
        l[d] = null;
      }), ps(), o = l[i], o ? o.p(c, f) : (o = l[i] = a[i](c), o.c()), Oe(o, 1), o.m(r.parentNode, r));
    },
    i(c) {
      s || (Oe(e.$$.fragment, c), Oe(o), s = !0);
    },
    o(c) {
      He(e.$$.fragment, c), He(o), s = !1;
    },
    d(c) {
      c && (Gn(n), Gn(r)), zt(e, c), l[i].d(c);
    }
  };
}
function Cb(t) {
  let e;
  const n = (
    /*#slots*/
    t[25].default
  ), i = fb(
    n,
    t,
    /*$$scope*/
    t[36],
    null
  );
  return {
    c() {
      i && i.c();
    },
    m(o, r) {
      i && i.m(o, r), e = !0;
    },
    p(o, r) {
      i && i.p && (!e || r[1] & /*$$scope*/
      32) && pb(
        i,
        n,
        o,
        /*$$scope*/
        o[36],
        e ? hb(
          n,
          /*$$scope*/
          o[36],
          r,
          null
        ) : db(
          /*$$scope*/
          o[36]
        ),
        null
      );
    },
    i(o) {
      e || (Oe(i, o), e = !0);
    },
    o(o) {
      He(i, o), e = !1;
    },
    d(o) {
      i && i.d(o);
    }
  };
}
function Sb(t) {
  let e, n, i;
  function o(s) {
    t[26](s);
  }
  let r = {
    i18n: (
      /*i18n*/
      t[9]
    ),
    dispatch_blob: (
      /*dispatch_blob*/
      t[16]
    ),
    waveform_settings: (
      /*waveform_settings*/
      t[10]
    ),
    waveform_options: (
      /*waveform_options*/
      t[11]
    )
  };
  return (
    /*mode*/
    t[14] !== void 0 && (r.mode = /*mode*/
    t[14]), e = new $g({ props: r }), Do.push(() => Mo(e, "mode", o)), {
      c() {
        qt(e.$$.fragment);
      },
      m(s, a) {
        Gt(e, s, a), i = !0;
      },
      p(s, a) {
        const l = {};
        a[0] & /*i18n*/
        512 && (l.i18n = /*i18n*/
        s[9]), a[0] & /*waveform_settings*/
        1024 && (l.waveform_settings = /*waveform_settings*/
        s[10]), a[0] & /*waveform_options*/
        2048 && (l.waveform_options = /*waveform_options*/
        s[11]), !n && a[0] & /*mode*/
        16384 && (n = !0, l.mode = /*mode*/
        s[14], Bo(() => n = !1)), e.$set(l);
      },
      i(s) {
        i || (Oe(e.$$.fragment, s), i = !0);
      },
      o(s) {
        He(e.$$.fragment, s), i = !1;
      },
      d(s) {
        zt(e, s);
      }
    }
  );
}
function Ab(t) {
  let e, n;
  return e = new ub({
    props: {
      record: (
        /*record*/
        t[17]
      ),
      recording: (
        /*recording*/
        t[13]
      ),
      stop: (
        /*stop*/
        t[20]
      ),
      i18n: (
        /*i18n*/
        t[9]
      ),
      waveform_settings: (
        /*waveform_settings*/
        t[10]
      ),
      waveform_options: (
        /*waveform_options*/
        t[11]
      )
    }
  }), {
    c() {
      qt(e.$$.fragment);
    },
    m(i, o) {
      Gt(e, i, o), n = !0;
    },
    p(i, o) {
      const r = {};
      o[0] & /*recording*/
      8192 && (r.recording = /*recording*/
      i[13]), o[0] & /*i18n*/
      512 && (r.i18n = /*i18n*/
      i[9]), o[0] & /*waveform_settings*/
      1024 && (r.waveform_settings = /*waveform_settings*/
      i[10]), o[0] & /*waveform_options*/
      2048 && (r.waveform_options = /*waveform_options*/
      i[11]), e.$set(r);
    },
    i(i) {
      n || (Oe(e.$$.fragment, i), n = !0);
    },
    o(i) {
      He(e.$$.fragment, i), n = !1;
    },
    d(i) {
      zt(e, i);
    }
  };
}
function Tb(t) {
  let e, n, i, o, r, s, a, l;
  e = new ja({
    props: {
      show_label: (
        /*show_label*/
        t[5]
      ),
      Icon: mo,
      float: (
        /*active_source*/
        t[2] === "upload" && /*value*/
        t[1] === null
      ),
      label: (
        /*label*/
        t[3] || /*i18n*/
        t[9]("audio.audio")
      )
    }
  });
  const u = [yb, wb], c = [];
  function f(_, m) {
    return (
      /*value*/
      _[1] === null || /*streaming*/
      _[8] ? 0 : 1
    );
  }
  i = f(t), o = c[i] = u[i](t);
  function h(_) {
    t[35](_);
  }
  let d = {
    sources: (
      /*sources*/
      t[7]
    ),
    handle_clear: (
      /*clear*/
      t[18]
    )
  };
  return (
    /*active_source*/
    t[2] !== void 0 && (d.active_source = /*active_source*/
    t[2]), s = new E_({ props: d }), Do.push(() => Mo(s, "active_source", h)), {
      c() {
        qt(e.$$.fragment), n = fo(), o.c(), r = fo(), qt(s.$$.fragment);
      },
      m(_, m) {
        Gt(e, _, m), Wn(_, n, m), c[i].m(_, m), Wn(_, r, m), Gt(s, _, m), l = !0;
      },
      p(_, m) {
        const v = {};
        m[0] & /*show_label*/
        32 && (v.show_label = /*show_label*/
        _[5]), m[0] & /*active_source, value*/
        6 && (v.float = /*active_source*/
        _[2] === "upload" && /*value*/
        _[1] === null), m[0] & /*label, i18n*/
        520 && (v.label = /*label*/
        _[3] || /*i18n*/
        _[9]("audio.audio")), e.$set(v);
        let p = i;
        i = f(_), i === p ? c[i].p(_, m) : (gs(), He(c[p], 1, 1, () => {
          c[p] = null;
        }), ps(), o = c[i], o ? o.p(_, m) : (o = c[i] = u[i](_), o.c()), Oe(o, 1), o.m(r.parentNode, r));
        const k = {};
        m[0] & /*sources*/
        128 && (k.sources = /*sources*/
        _[7]), !a && m[0] & /*active_source*/
        4 && (a = !0, k.active_source = /*active_source*/
        _[2], Bo(() => a = !1)), s.$set(k);
      },
      i(_) {
        l || (Oe(e.$$.fragment, _), Oe(o), Oe(s.$$.fragment, _), l = !0);
      },
      o(_) {
        He(e.$$.fragment, _), He(o), He(s.$$.fragment, _), l = !1;
      },
      d(_) {
        _ && (Gn(n), Gn(r)), zt(e, _), c[i].d(_), zt(s, _);
      }
    }
  );
}
const Lb = 500, ca = 44;
async function Pb(t) {
  let e, n = t[0], i = 1;
  for (; i < t.length; ) {
    const o = t[i], r = t[i + 1];
    if (i += 2, (o === "optionalAccess" || o === "optionalCall") && n == null)
      return;
    o === "access" || o === "optionalAccess" ? (e = n, n = await r(n)) : (o === "call" || o === "optionalCall") && (n = await r((...s) => n.call(e, ...s)), e = void 0);
  }
  return n;
}
function Rb(t, e, n) {
  let { $$slots: i = {}, $$scope: o } = e, { value: r = null } = e, { label: s } = e, { root: a } = e, { show_label: l = !0 } = e, { show_download_button: u = !0 } = e, { sources: c = ["microphone", "upload"] } = e, { pending: f = !1 } = e, { streaming: h = !1 } = e, { i18n: d } = e, { waveform_settings: _ } = e, { waveform_options: m = {} } = e, { dragging: v } = e, { active_source: p } = e, { editable: k = !0 } = e;
  const w = gb("upload_files");
  let C = !1, T, y = "", O, P = [], A = !1, R = !1, z = [], X;
  function F() {
    X = [
      import("./module-859668d1.js"),
      import("./module-aafe8b06.js")
    ];
  }
  h && F();
  const J = vb(), E = async (B, ue) => {
    let Ce = new File(B, "audio.wav");
    const wt = await Da([Ce], ue === "stream");
    let Q = (await Pb([
      await Ma(wt, a, void 0, w),
      "optionalAccess",
      async (yt) => yt.filter,
      "call",
      async (yt) => yt(Boolean)
    ]))[0];
    r === null ? n(1, r = new As(Q)) : n(1, r.file_data = Q, r), J(ue, r);
  };
  bb(() => {
    h && T && T.state !== "inactive" && T.stop();
  });
  async function V() {
    let B;
    try {
      B = await navigator.mediaDevices.getUserMedia({ audio: !0 });
    } catch (ue) {
      if (!navigator.mediaDevices) {
        J("error", d("audio.no_device_support"));
        return;
      }
      if (ue instanceof DOMException && ue.name == "NotAllowedError") {
        J("error", d("audio.allow_recording_access"));
        return;
      }
      throw ue;
    }
    if (B != null) {
      if (h) {
        const [{ MediaRecorder: ue, register: Ce }, { connect: wt }] = await Promise.all(X);
        await Ce(await wt()), T = new ue(B, { mimeType: "audio/wav" }), T.addEventListener("dataavailable", N);
      } else
        T = new MediaRecorder(B), T.addEventListener("dataavailable", (ue) => {
          z.push(ue.data);
        }), T.addEventListener("stop", async () => {
          n(13, C = !1), await E(z, "change"), await E(z, "stop_recording"), z = [];
        });
      R = !0;
    }
  }
  async function N(B) {
    let ue = await B.data.arrayBuffer(), Ce = new Uint8Array(ue);
    if (O || (n(22, O = new Uint8Array(ue.slice(0, ca))), Ce = new Uint8Array(ue.slice(ca))), f)
      P.push(Ce);
    else {
      let wt = [O].concat(P, [Ce]);
      E(wt, "stream"), n(23, P = []);
    }
  }
  async function U() {
    n(13, C = !0), J("start_recording"), R || await V(), n(22, O = void 0), h && T.start(Lb);
  }
  function ee() {
    J("change", null), J("clear"), n(14, y = ""), n(1, r = null);
  }
  function H({ detail: B }) {
    n(1, r = new As(B)), J("change", r), J("upload", B);
  }
  function Y() {
    n(13, C = !1), h && (J("stop_recording"), T.stop(), f && n(24, A = !0), E(z, "stop_recording"), J("clear"), n(14, y = ""));
  }
  function se(B) {
    y = B, n(14, y);
  }
  function g(B) {
    v = B, n(0, v);
  }
  const L = ({ detail: B }) => J("error", B), G = () => n(14, y = "edit");
  function W(B) {
    y = B, n(14, y);
  }
  function de(B) {
    Tr.call(this, t, B);
  }
  function he(B) {
    Tr.call(this, t, B);
  }
  function q(B) {
    Tr.call(this, t, B);
  }
  const ve = (B) => J("edit", B.detail);
  function M(B) {
    p = B, n(2, p);
  }
  return t.$$set = (B) => {
    "value" in B && n(1, r = B.value), "label" in B && n(3, s = B.label), "root" in B && n(4, a = B.root), "show_label" in B && n(5, l = B.show_label), "show_download_button" in B && n(6, u = B.show_download_button), "sources" in B && n(7, c = B.sources), "pending" in B && n(21, f = B.pending), "streaming" in B && n(8, h = B.streaming), "i18n" in B && n(9, d = B.i18n), "waveform_settings" in B && n(10, _ = B.waveform_settings), "waveform_options" in B && n(11, m = B.waveform_options), "dragging" in B && n(0, v = B.dragging), "active_source" in B && n(2, p = B.active_source), "editable" in B && n(12, k = B.editable), "$$scope" in B && n(36, o = B.$$scope);
  }, t.$$.update = () => {
    if (t.$$.dirty[0] & /*dragging*/
    1 && J("drag", v), t.$$.dirty[0] & /*submit_pending_stream_on_pending_end, pending, header, pending_stream*/
    31457280 && A && f === !1 && (n(24, A = !1), O && P)) {
      let B = [O].concat(P);
      n(23, P = []), E(B, "stream");
    }
  }, [
    v,
    r,
    p,
    s,
    a,
    l,
    u,
    c,
    h,
    d,
    _,
    m,
    k,
    C,
    y,
    J,
    E,
    U,
    ee,
    H,
    Y,
    f,
    O,
    P,
    A,
    i,
    se,
    g,
    L,
    G,
    W,
    de,
    he,
    q,
    ve,
    M,
    o
  ];
}
class Bb extends cb {
  constructor(e) {
    super(), _b(
      this,
      e,
      Rb,
      Tb,
      mb,
      {
        value: 1,
        label: 3,
        root: 4,
        show_label: 5,
        show_download_button: 6,
        sources: 7,
        pending: 21,
        streaming: 8,
        i18n: 9,
        waveform_settings: 10,
        waveform_options: 11,
        dragging: 0,
        active_source: 2,
        editable: 12
      },
      null,
      [-1, -1]
    );
  }
}
function Hn(t) {
  let e = ["", "k", "M", "G", "T", "P", "E", "Z"], n = 0;
  for (; t > 1e3 && n < e.length - 1; )
    t /= 1e3, n++;
  let i = e[n];
  return (Number.isInteger(t) ? t : t.toFixed(1)) + i;
}
const {
  SvelteComponent: Mb,
  append: it,
  attr: ne,
  component_subscribe: fa,
  detach: Db,
  element: Ob,
  init: Hb,
  insert: Nb,
  noop: da,
  safe_not_equal: Ib,
  set_style: Ji,
  svg_element: ot,
  toggle_class: ha
} = window.__gradio__svelte__internal, { onMount: Ub } = window.__gradio__svelte__internal;
function jb(t) {
  let e, n, i, o, r, s, a, l, u, c, f, h;
  return {
    c() {
      e = Ob("div"), n = ot("svg"), i = ot("g"), o = ot("path"), r = ot("path"), s = ot("path"), a = ot("path"), l = ot("g"), u = ot("path"), c = ot("path"), f = ot("path"), h = ot("path"), ne(o, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), ne(o, "fill", "#FF7C00"), ne(o, "fill-opacity", "0.4"), ne(o, "class", "svelte-43sxxs"), ne(r, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), ne(r, "fill", "#FF7C00"), ne(r, "class", "svelte-43sxxs"), ne(s, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), ne(s, "fill", "#FF7C00"), ne(s, "fill-opacity", "0.4"), ne(s, "class", "svelte-43sxxs"), ne(a, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), ne(a, "fill", "#FF7C00"), ne(a, "class", "svelte-43sxxs"), Ji(i, "transform", "translate(" + /*$top*/
      t[1][0] + "px, " + /*$top*/
      t[1][1] + "px)"), ne(u, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), ne(u, "fill", "#FF7C00"), ne(u, "fill-opacity", "0.4"), ne(u, "class", "svelte-43sxxs"), ne(c, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), ne(c, "fill", "#FF7C00"), ne(c, "class", "svelte-43sxxs"), ne(f, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), ne(f, "fill", "#FF7C00"), ne(f, "fill-opacity", "0.4"), ne(f, "class", "svelte-43sxxs"), ne(h, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), ne(h, "fill", "#FF7C00"), ne(h, "class", "svelte-43sxxs"), Ji(l, "transform", "translate(" + /*$bottom*/
      t[2][0] + "px, " + /*$bottom*/
      t[2][1] + "px)"), ne(n, "viewBox", "-1200 -1200 3000 3000"), ne(n, "fill", "none"), ne(n, "xmlns", "http://www.w3.org/2000/svg"), ne(n, "class", "svelte-43sxxs"), ne(e, "class", "svelte-43sxxs"), ha(
        e,
        "margin",
        /*margin*/
        t[0]
      );
    },
    m(d, _) {
      Nb(d, e, _), it(e, n), it(n, i), it(i, o), it(i, r), it(i, s), it(i, a), it(n, l), it(l, u), it(l, c), it(l, f), it(l, h);
    },
    p(d, [_]) {
      _ & /*$top*/
      2 && Ji(i, "transform", "translate(" + /*$top*/
      d[1][0] + "px, " + /*$top*/
      d[1][1] + "px)"), _ & /*$bottom*/
      4 && Ji(l, "transform", "translate(" + /*$bottom*/
      d[2][0] + "px, " + /*$bottom*/
      d[2][1] + "px)"), _ & /*margin*/
      1 && ha(
        e,
        "margin",
        /*margin*/
        d[0]
      );
    },
    i: da,
    o: da,
    d(d) {
      d && Db(e);
    }
  };
}
function Fb(t, e, n) {
  let i, o, { margin: r = !0 } = e;
  const s = Sl([0, 0]);
  fa(t, s, (h) => n(1, i = h));
  const a = Sl([0, 0]);
  fa(t, a, (h) => n(2, o = h));
  let l;
  async function u() {
    await Promise.all([s.set([125, 140]), a.set([-125, -140])]), await Promise.all([s.set([-125, 140]), a.set([125, -140])]), await Promise.all([s.set([-125, 0]), a.set([125, -0])]), await Promise.all([s.set([125, 0]), a.set([-125, 0])]);
  }
  async function c() {
    await u(), l || c();
  }
  async function f() {
    await Promise.all([s.set([125, 0]), a.set([-125, 0])]), c();
  }
  return Ub(() => (f(), () => l = !0)), t.$$set = (h) => {
    "margin" in h && n(0, r = h.margin);
  }, [r, i, o, s, a];
}
class qb extends Mb {
  constructor(e) {
    super(), Hb(this, e, Fb, jb, Ib, { margin: 0 });
  }
}
const {
  SvelteComponent: zb,
  append: sn,
  attr: gt,
  binding_callbacks: _a,
  check_outros: mc,
  create_component: Gb,
  create_slot: Wb,
  destroy_component: Vb,
  destroy_each: pc,
  detach: Z,
  element: St,
  empty: ei,
  ensure_array_like: ho,
  get_all_dirty_from_scope: Xb,
  get_slot_changes: Zb,
  group_outros: gc,
  init: xb,
  insert: x,
  mount_component: Jb,
  noop: is,
  safe_not_equal: Yb,
  set_data: $e,
  set_style: It,
  space: bt,
  text: fe,
  toggle_class: Qe,
  transition_in: Vn,
  transition_out: Xn,
  update_slot_base: Qb
} = window.__gradio__svelte__internal, { tick: Kb } = window.__gradio__svelte__internal, { onDestroy: $b } = window.__gradio__svelte__internal, e2 = (t) => ({}), ma = (t) => ({});
function pa(t, e, n) {
  const i = t.slice();
  return i[38] = e[n], i[40] = n, i;
}
function ga(t, e, n) {
  const i = t.slice();
  return i[38] = e[n], i;
}
function t2(t) {
  let e, n = (
    /*i18n*/
    t[1]("common.error") + ""
  ), i, o, r;
  const s = (
    /*#slots*/
    t[29].error
  ), a = Wb(
    s,
    t,
    /*$$scope*/
    t[28],
    ma
  );
  return {
    c() {
      e = St("span"), i = fe(n), o = bt(), a && a.c(), gt(e, "class", "error svelte-1yserjw");
    },
    m(l, u) {
      x(l, e, u), sn(e, i), x(l, o, u), a && a.m(l, u), r = !0;
    },
    p(l, u) {
      (!r || u[0] & /*i18n*/
      2) && n !== (n = /*i18n*/
      l[1]("common.error") + "") && $e(i, n), a && a.p && (!r || u[0] & /*$$scope*/
      268435456) && Qb(
        a,
        s,
        l,
        /*$$scope*/
        l[28],
        r ? Zb(
          s,
          /*$$scope*/
          l[28],
          u,
          e2
        ) : Xb(
          /*$$scope*/
          l[28]
        ),
        ma
      );
    },
    i(l) {
      r || (Vn(a, l), r = !0);
    },
    o(l) {
      Xn(a, l), r = !1;
    },
    d(l) {
      l && (Z(e), Z(o)), a && a.d(l);
    }
  };
}
function n2(t) {
  let e, n, i, o, r, s, a, l, u, c = (
    /*variant*/
    t[8] === "default" && /*show_eta_bar*/
    t[18] && /*show_progress*/
    t[6] === "full" && ba(t)
  );
  function f(w, C) {
    if (
      /*progress*/
      w[7]
    )
      return r2;
    if (
      /*queue_position*/
      w[2] !== null && /*queue_size*/
      w[3] !== void 0 && /*queue_position*/
      w[2] >= 0
    )
      return o2;
    if (
      /*queue_position*/
      w[2] === 0
    )
      return i2;
  }
  let h = f(t), d = h && h(t), _ = (
    /*timer*/
    t[5] && ya(t)
  );
  const m = [u2, a2], v = [];
  function p(w, C) {
    return (
      /*last_progress_level*/
      w[15] != null ? 0 : (
        /*show_progress*/
        w[6] === "full" ? 1 : -1
      )
    );
  }
  ~(r = p(t)) && (s = v[r] = m[r](t));
  let k = !/*timer*/
  t[5] && La(t);
  return {
    c() {
      c && c.c(), e = bt(), n = St("div"), d && d.c(), i = bt(), _ && _.c(), o = bt(), s && s.c(), a = bt(), k && k.c(), l = ei(), gt(n, "class", "progress-text svelte-1yserjw"), Qe(
        n,
        "meta-text-center",
        /*variant*/
        t[8] === "center"
      ), Qe(
        n,
        "meta-text",
        /*variant*/
        t[8] === "default"
      );
    },
    m(w, C) {
      c && c.m(w, C), x(w, e, C), x(w, n, C), d && d.m(n, null), sn(n, i), _ && _.m(n, null), x(w, o, C), ~r && v[r].m(w, C), x(w, a, C), k && k.m(w, C), x(w, l, C), u = !0;
    },
    p(w, C) {
      /*variant*/
      w[8] === "default" && /*show_eta_bar*/
      w[18] && /*show_progress*/
      w[6] === "full" ? c ? c.p(w, C) : (c = ba(w), c.c(), c.m(e.parentNode, e)) : c && (c.d(1), c = null), h === (h = f(w)) && d ? d.p(w, C) : (d && d.d(1), d = h && h(w), d && (d.c(), d.m(n, i))), /*timer*/
      w[5] ? _ ? _.p(w, C) : (_ = ya(w), _.c(), _.m(n, null)) : _ && (_.d(1), _ = null), (!u || C[0] & /*variant*/
      256) && Qe(
        n,
        "meta-text-center",
        /*variant*/
        w[8] === "center"
      ), (!u || C[0] & /*variant*/
      256) && Qe(
        n,
        "meta-text",
        /*variant*/
        w[8] === "default"
      );
      let T = r;
      r = p(w), r === T ? ~r && v[r].p(w, C) : (s && (gc(), Xn(v[T], 1, 1, () => {
        v[T] = null;
      }), mc()), ~r ? (s = v[r], s ? s.p(w, C) : (s = v[r] = m[r](w), s.c()), Vn(s, 1), s.m(a.parentNode, a)) : s = null), /*timer*/
      w[5] ? k && (k.d(1), k = null) : k ? k.p(w, C) : (k = La(w), k.c(), k.m(l.parentNode, l));
    },
    i(w) {
      u || (Vn(s), u = !0);
    },
    o(w) {
      Xn(s), u = !1;
    },
    d(w) {
      w && (Z(e), Z(n), Z(o), Z(a), Z(l)), c && c.d(w), d && d.d(), _ && _.d(), ~r && v[r].d(w), k && k.d(w);
    }
  };
}
function ba(t) {
  let e, n = `translateX(${/*eta_level*/
  (t[17] || 0) * 100 - 100}%)`;
  return {
    c() {
      e = St("div"), gt(e, "class", "eta-bar svelte-1yserjw"), It(e, "transform", n);
    },
    m(i, o) {
      x(i, e, o);
    },
    p(i, o) {
      o[0] & /*eta_level*/
      131072 && n !== (n = `translateX(${/*eta_level*/
      (i[17] || 0) * 100 - 100}%)`) && It(e, "transform", n);
    },
    d(i) {
      i && Z(e);
    }
  };
}
function i2(t) {
  let e;
  return {
    c() {
      e = fe("processing |");
    },
    m(n, i) {
      x(n, e, i);
    },
    p: is,
    d(n) {
      n && Z(e);
    }
  };
}
function o2(t) {
  let e, n = (
    /*queue_position*/
    t[2] + 1 + ""
  ), i, o, r, s;
  return {
    c() {
      e = fe("queue: "), i = fe(n), o = fe("/"), r = fe(
        /*queue_size*/
        t[3]
      ), s = fe(" |");
    },
    m(a, l) {
      x(a, e, l), x(a, i, l), x(a, o, l), x(a, r, l), x(a, s, l);
    },
    p(a, l) {
      l[0] & /*queue_position*/
      4 && n !== (n = /*queue_position*/
      a[2] + 1 + "") && $e(i, n), l[0] & /*queue_size*/
      8 && $e(
        r,
        /*queue_size*/
        a[3]
      );
    },
    d(a) {
      a && (Z(e), Z(i), Z(o), Z(r), Z(s));
    }
  };
}
function r2(t) {
  let e, n = ho(
    /*progress*/
    t[7]
  ), i = [];
  for (let o = 0; o < n.length; o += 1)
    i[o] = wa(ga(t, n, o));
  return {
    c() {
      for (let o = 0; o < i.length; o += 1)
        i[o].c();
      e = ei();
    },
    m(o, r) {
      for (let s = 0; s < i.length; s += 1)
        i[s] && i[s].m(o, r);
      x(o, e, r);
    },
    p(o, r) {
      if (r[0] & /*progress*/
      128) {
        n = ho(
          /*progress*/
          o[7]
        );
        let s;
        for (s = 0; s < n.length; s += 1) {
          const a = ga(o, n, s);
          i[s] ? i[s].p(a, r) : (i[s] = wa(a), i[s].c(), i[s].m(e.parentNode, e));
        }
        for (; s < i.length; s += 1)
          i[s].d(1);
        i.length = n.length;
      }
    },
    d(o) {
      o && Z(e), pc(i, o);
    }
  };
}
function va(t) {
  let e, n = (
    /*p*/
    t[38].unit + ""
  ), i, o, r = " ", s;
  function a(c, f) {
    return (
      /*p*/
      c[38].length != null ? l2 : s2
    );
  }
  let l = a(t), u = l(t);
  return {
    c() {
      u.c(), e = bt(), i = fe(n), o = fe(" | "), s = fe(r);
    },
    m(c, f) {
      u.m(c, f), x(c, e, f), x(c, i, f), x(c, o, f), x(c, s, f);
    },
    p(c, f) {
      l === (l = a(c)) && u ? u.p(c, f) : (u.d(1), u = l(c), u && (u.c(), u.m(e.parentNode, e))), f[0] & /*progress*/
      128 && n !== (n = /*p*/
      c[38].unit + "") && $e(i, n);
    },
    d(c) {
      c && (Z(e), Z(i), Z(o), Z(s)), u.d(c);
    }
  };
}
function s2(t) {
  let e = Hn(
    /*p*/
    t[38].index || 0
  ) + "", n;
  return {
    c() {
      n = fe(e);
    },
    m(i, o) {
      x(i, n, o);
    },
    p(i, o) {
      o[0] & /*progress*/
      128 && e !== (e = Hn(
        /*p*/
        i[38].index || 0
      ) + "") && $e(n, e);
    },
    d(i) {
      i && Z(n);
    }
  };
}
function l2(t) {
  let e = Hn(
    /*p*/
    t[38].index || 0
  ) + "", n, i, o = Hn(
    /*p*/
    t[38].length
  ) + "", r;
  return {
    c() {
      n = fe(e), i = fe("/"), r = fe(o);
    },
    m(s, a) {
      x(s, n, a), x(s, i, a), x(s, r, a);
    },
    p(s, a) {
      a[0] & /*progress*/
      128 && e !== (e = Hn(
        /*p*/
        s[38].index || 0
      ) + "") && $e(n, e), a[0] & /*progress*/
      128 && o !== (o = Hn(
        /*p*/
        s[38].length
      ) + "") && $e(r, o);
    },
    d(s) {
      s && (Z(n), Z(i), Z(r));
    }
  };
}
function wa(t) {
  let e, n = (
    /*p*/
    t[38].index != null && va(t)
  );
  return {
    c() {
      n && n.c(), e = ei();
    },
    m(i, o) {
      n && n.m(i, o), x(i, e, o);
    },
    p(i, o) {
      /*p*/
      i[38].index != null ? n ? n.p(i, o) : (n = va(i), n.c(), n.m(e.parentNode, e)) : n && (n.d(1), n = null);
    },
    d(i) {
      i && Z(e), n && n.d(i);
    }
  };
}
function ya(t) {
  let e, n = (
    /*eta*/
    t[0] ? `/${/*formatted_eta*/
    t[19]}` : ""
  ), i, o;
  return {
    c() {
      e = fe(
        /*formatted_timer*/
        t[20]
      ), i = fe(n), o = fe("s");
    },
    m(r, s) {
      x(r, e, s), x(r, i, s), x(r, o, s);
    },
    p(r, s) {
      s[0] & /*formatted_timer*/
      1048576 && $e(
        e,
        /*formatted_timer*/
        r[20]
      ), s[0] & /*eta, formatted_eta*/
      524289 && n !== (n = /*eta*/
      r[0] ? `/${/*formatted_eta*/
      r[19]}` : "") && $e(i, n);
    },
    d(r) {
      r && (Z(e), Z(i), Z(o));
    }
  };
}
function a2(t) {
  let e, n;
  return e = new qb({
    props: { margin: (
      /*variant*/
      t[8] === "default"
    ) }
  }), {
    c() {
      Gb(e.$$.fragment);
    },
    m(i, o) {
      Jb(e, i, o), n = !0;
    },
    p(i, o) {
      const r = {};
      o[0] & /*variant*/
      256 && (r.margin = /*variant*/
      i[8] === "default"), e.$set(r);
    },
    i(i) {
      n || (Vn(e.$$.fragment, i), n = !0);
    },
    o(i) {
      Xn(e.$$.fragment, i), n = !1;
    },
    d(i) {
      Vb(e, i);
    }
  };
}
function u2(t) {
  let e, n, i, o, r, s = `${/*last_progress_level*/
  t[15] * 100}%`, a = (
    /*progress*/
    t[7] != null && ka(t)
  );
  return {
    c() {
      e = St("div"), n = St("div"), a && a.c(), i = bt(), o = St("div"), r = St("div"), gt(n, "class", "progress-level-inner svelte-1yserjw"), gt(r, "class", "progress-bar svelte-1yserjw"), It(r, "width", s), gt(o, "class", "progress-bar-wrap svelte-1yserjw"), gt(e, "class", "progress-level svelte-1yserjw");
    },
    m(l, u) {
      x(l, e, u), sn(e, n), a && a.m(n, null), sn(e, i), sn(e, o), sn(o, r), t[30](r);
    },
    p(l, u) {
      /*progress*/
      l[7] != null ? a ? a.p(l, u) : (a = ka(l), a.c(), a.m(n, null)) : a && (a.d(1), a = null), u[0] & /*last_progress_level*/
      32768 && s !== (s = `${/*last_progress_level*/
      l[15] * 100}%`) && It(r, "width", s);
    },
    i: is,
    o: is,
    d(l) {
      l && Z(e), a && a.d(), t[30](null);
    }
  };
}
function ka(t) {
  let e, n = ho(
    /*progress*/
    t[7]
  ), i = [];
  for (let o = 0; o < n.length; o += 1)
    i[o] = Ta(pa(t, n, o));
  return {
    c() {
      for (let o = 0; o < i.length; o += 1)
        i[o].c();
      e = ei();
    },
    m(o, r) {
      for (let s = 0; s < i.length; s += 1)
        i[s] && i[s].m(o, r);
      x(o, e, r);
    },
    p(o, r) {
      if (r[0] & /*progress_level, progress*/
      16512) {
        n = ho(
          /*progress*/
          o[7]
        );
        let s;
        for (s = 0; s < n.length; s += 1) {
          const a = pa(o, n, s);
          i[s] ? i[s].p(a, r) : (i[s] = Ta(a), i[s].c(), i[s].m(e.parentNode, e));
        }
        for (; s < i.length; s += 1)
          i[s].d(1);
        i.length = n.length;
      }
    },
    d(o) {
      o && Z(e), pc(i, o);
    }
  };
}
function Ea(t) {
  let e, n, i, o, r = (
    /*i*/
    t[40] !== 0 && c2()
  ), s = (
    /*p*/
    t[38].desc != null && Ca(t)
  ), a = (
    /*p*/
    t[38].desc != null && /*progress_level*/
    t[14] && /*progress_level*/
    t[14][
      /*i*/
      t[40]
    ] != null && Sa()
  ), l = (
    /*progress_level*/
    t[14] != null && Aa(t)
  );
  return {
    c() {
      r && r.c(), e = bt(), s && s.c(), n = bt(), a && a.c(), i = bt(), l && l.c(), o = ei();
    },
    m(u, c) {
      r && r.m(u, c), x(u, e, c), s && s.m(u, c), x(u, n, c), a && a.m(u, c), x(u, i, c), l && l.m(u, c), x(u, o, c);
    },
    p(u, c) {
      /*p*/
      u[38].desc != null ? s ? s.p(u, c) : (s = Ca(u), s.c(), s.m(n.parentNode, n)) : s && (s.d(1), s = null), /*p*/
      u[38].desc != null && /*progress_level*/
      u[14] && /*progress_level*/
      u[14][
        /*i*/
        u[40]
      ] != null ? a || (a = Sa(), a.c(), a.m(i.parentNode, i)) : a && (a.d(1), a = null), /*progress_level*/
      u[14] != null ? l ? l.p(u, c) : (l = Aa(u), l.c(), l.m(o.parentNode, o)) : l && (l.d(1), l = null);
    },
    d(u) {
      u && (Z(e), Z(n), Z(i), Z(o)), r && r.d(u), s && s.d(u), a && a.d(u), l && l.d(u);
    }
  };
}
function c2(t) {
  let e;
  return {
    c() {
      e = fe(" /");
    },
    m(n, i) {
      x(n, e, i);
    },
    d(n) {
      n && Z(e);
    }
  };
}
function Ca(t) {
  let e = (
    /*p*/
    t[38].desc + ""
  ), n;
  return {
    c() {
      n = fe(e);
    },
    m(i, o) {
      x(i, n, o);
    },
    p(i, o) {
      o[0] & /*progress*/
      128 && e !== (e = /*p*/
      i[38].desc + "") && $e(n, e);
    },
    d(i) {
      i && Z(n);
    }
  };
}
function Sa(t) {
  let e;
  return {
    c() {
      e = fe("-");
    },
    m(n, i) {
      x(n, e, i);
    },
    d(n) {
      n && Z(e);
    }
  };
}
function Aa(t) {
  let e = (100 * /*progress_level*/
  (t[14][
    /*i*/
    t[40]
  ] || 0)).toFixed(1) + "", n, i;
  return {
    c() {
      n = fe(e), i = fe("%");
    },
    m(o, r) {
      x(o, n, r), x(o, i, r);
    },
    p(o, r) {
      r[0] & /*progress_level*/
      16384 && e !== (e = (100 * /*progress_level*/
      (o[14][
        /*i*/
        o[40]
      ] || 0)).toFixed(1) + "") && $e(n, e);
    },
    d(o) {
      o && (Z(n), Z(i));
    }
  };
}
function Ta(t) {
  let e, n = (
    /*p*/
    (t[38].desc != null || /*progress_level*/
    t[14] && /*progress_level*/
    t[14][
      /*i*/
      t[40]
    ] != null) && Ea(t)
  );
  return {
    c() {
      n && n.c(), e = ei();
    },
    m(i, o) {
      n && n.m(i, o), x(i, e, o);
    },
    p(i, o) {
      /*p*/
      i[38].desc != null || /*progress_level*/
      i[14] && /*progress_level*/
      i[14][
        /*i*/
        i[40]
      ] != null ? n ? n.p(i, o) : (n = Ea(i), n.c(), n.m(e.parentNode, e)) : n && (n.d(1), n = null);
    },
    d(i) {
      i && Z(e), n && n.d(i);
    }
  };
}
function La(t) {
  let e, n;
  return {
    c() {
      e = St("p"), n = fe(
        /*loading_text*/
        t[9]
      ), gt(e, "class", "loading svelte-1yserjw");
    },
    m(i, o) {
      x(i, e, o), sn(e, n);
    },
    p(i, o) {
      o[0] & /*loading_text*/
      512 && $e(
        n,
        /*loading_text*/
        i[9]
      );
    },
    d(i) {
      i && Z(e);
    }
  };
}
function f2(t) {
  let e, n, i, o, r;
  const s = [n2, t2], a = [];
  function l(u, c) {
    return (
      /*status*/
      u[4] === "pending" ? 0 : (
        /*status*/
        u[4] === "error" ? 1 : -1
      )
    );
  }
  return ~(n = l(t)) && (i = a[n] = s[n](t)), {
    c() {
      e = St("div"), i && i.c(), gt(e, "class", o = "wrap " + /*variant*/
      t[8] + " " + /*show_progress*/
      t[6] + " svelte-1yserjw"), Qe(e, "hide", !/*status*/
      t[4] || /*status*/
      t[4] === "complete" || /*show_progress*/
      t[6] === "hidden"), Qe(
        e,
        "translucent",
        /*variant*/
        t[8] === "center" && /*status*/
        (t[4] === "pending" || /*status*/
        t[4] === "error") || /*translucent*/
        t[11] || /*show_progress*/
        t[6] === "minimal"
      ), Qe(
        e,
        "generating",
        /*status*/
        t[4] === "generating"
      ), Qe(
        e,
        "border",
        /*border*/
        t[12]
      ), It(
        e,
        "position",
        /*absolute*/
        t[10] ? "absolute" : "static"
      ), It(
        e,
        "padding",
        /*absolute*/
        t[10] ? "0" : "var(--size-8) 0"
      );
    },
    m(u, c) {
      x(u, e, c), ~n && a[n].m(e, null), t[31](e), r = !0;
    },
    p(u, c) {
      let f = n;
      n = l(u), n === f ? ~n && a[n].p(u, c) : (i && (gc(), Xn(a[f], 1, 1, () => {
        a[f] = null;
      }), mc()), ~n ? (i = a[n], i ? i.p(u, c) : (i = a[n] = s[n](u), i.c()), Vn(i, 1), i.m(e, null)) : i = null), (!r || c[0] & /*variant, show_progress*/
      320 && o !== (o = "wrap " + /*variant*/
      u[8] + " " + /*show_progress*/
      u[6] + " svelte-1yserjw")) && gt(e, "class", o), (!r || c[0] & /*variant, show_progress, status, show_progress*/
      336) && Qe(e, "hide", !/*status*/
      u[4] || /*status*/
      u[4] === "complete" || /*show_progress*/
      u[6] === "hidden"), (!r || c[0] & /*variant, show_progress, variant, status, translucent, show_progress*/
      2384) && Qe(
        e,
        "translucent",
        /*variant*/
        u[8] === "center" && /*status*/
        (u[4] === "pending" || /*status*/
        u[4] === "error") || /*translucent*/
        u[11] || /*show_progress*/
        u[6] === "minimal"
      ), (!r || c[0] & /*variant, show_progress, status*/
      336) && Qe(
        e,
        "generating",
        /*status*/
        u[4] === "generating"
      ), (!r || c[0] & /*variant, show_progress, border*/
      4416) && Qe(
        e,
        "border",
        /*border*/
        u[12]
      ), c[0] & /*absolute*/
      1024 && It(
        e,
        "position",
        /*absolute*/
        u[10] ? "absolute" : "static"
      ), c[0] & /*absolute*/
      1024 && It(
        e,
        "padding",
        /*absolute*/
        u[10] ? "0" : "var(--size-8) 0"
      );
    },
    i(u) {
      r || (Vn(i), r = !0);
    },
    o(u) {
      Xn(i), r = !1;
    },
    d(u) {
      u && Z(e), ~n && a[n].d(), t[31](null);
    }
  };
}
let Yi = [], Lr = !1;
async function d2(t, e = !0) {
  if (!(window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && e !== !0)) {
    if (Yi.push(t), !Lr)
      Lr = !0;
    else
      return;
    await Kb(), requestAnimationFrame(() => {
      let n = [0, 0];
      for (let i = 0; i < Yi.length; i++) {
        const r = Yi[i].getBoundingClientRect();
        (i === 0 || r.top + window.scrollY <= n[0]) && (n[0] = r.top + window.scrollY, n[1] = i);
      }
      window.scrollTo({ top: n[0] - 20, behavior: "smooth" }), Lr = !1, Yi = [];
    });
  }
}
function h2(t, e, n) {
  let i, { $$slots: o = {}, $$scope: r } = e, { i18n: s } = e, { eta: a = null } = e, { queue_position: l } = e, { queue_size: u } = e, { status: c } = e, { scroll_to_output: f = !1 } = e, { timer: h = !0 } = e, { show_progress: d = "full" } = e, { message: _ = null } = e, { progress: m = null } = e, { variant: v = "default" } = e, { loading_text: p = "Loading..." } = e, { absolute: k = !0 } = e, { translucent: w = !1 } = e, { border: C = !1 } = e, { autoscroll: T } = e, y, O = !1, P = 0, A = 0, R = null, z = null, X = 0, F = null, J, E = null, V = !0;
  const N = () => {
    n(0, a = n(26, R = n(19, H = null))), n(24, P = performance.now()), n(25, A = 0), O = !0, U();
  };
  function U() {
    requestAnimationFrame(() => {
      n(25, A = (performance.now() - P) / 1e3), O && U();
    });
  }
  function ee() {
    n(25, A = 0), n(0, a = n(26, R = n(19, H = null))), O && (O = !1);
  }
  $b(() => {
    O && ee();
  });
  let H = null;
  function Y(g) {
    _a[g ? "unshift" : "push"](() => {
      E = g, n(16, E), n(7, m), n(14, F), n(15, J);
    });
  }
  function se(g) {
    _a[g ? "unshift" : "push"](() => {
      y = g, n(13, y);
    });
  }
  return t.$$set = (g) => {
    "i18n" in g && n(1, s = g.i18n), "eta" in g && n(0, a = g.eta), "queue_position" in g && n(2, l = g.queue_position), "queue_size" in g && n(3, u = g.queue_size), "status" in g && n(4, c = g.status), "scroll_to_output" in g && n(21, f = g.scroll_to_output), "timer" in g && n(5, h = g.timer), "show_progress" in g && n(6, d = g.show_progress), "message" in g && n(22, _ = g.message), "progress" in g && n(7, m = g.progress), "variant" in g && n(8, v = g.variant), "loading_text" in g && n(9, p = g.loading_text), "absolute" in g && n(10, k = g.absolute), "translucent" in g && n(11, w = g.translucent), "border" in g && n(12, C = g.border), "autoscroll" in g && n(23, T = g.autoscroll), "$$scope" in g && n(28, r = g.$$scope);
  }, t.$$.update = () => {
    t.$$.dirty[0] & /*eta, old_eta, timer_start, eta_from_start*/
    218103809 && (a === null && n(0, a = R), a != null && R !== a && (n(27, z = (performance.now() - P) / 1e3 + a), n(19, H = z.toFixed(1)), n(26, R = a))), t.$$.dirty[0] & /*eta_from_start, timer_diff*/
    167772160 && n(17, X = z === null || z <= 0 || !A ? null : Math.min(A / z, 1)), t.$$.dirty[0] & /*progress*/
    128 && m != null && n(18, V = !1), t.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/
    114816 && (m != null ? n(14, F = m.map((g) => {
      if (g.index != null && g.length != null)
        return g.index / g.length;
      if (g.progress != null)
        return g.progress;
    })) : n(14, F = null), F ? (n(15, J = F[F.length - 1]), E && (J === 0 ? n(16, E.style.transition = "0", E) : n(16, E.style.transition = "150ms", E))) : n(15, J = void 0)), t.$$.dirty[0] & /*status*/
    16 && (c === "pending" ? N() : ee()), t.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/
    10493968 && y && f && (c === "pending" || c === "complete") && d2(y, T), t.$$.dirty[0] & /*status, message*/
    4194320, t.$$.dirty[0] & /*timer_diff*/
    33554432 && n(20, i = A.toFixed(1));
  }, [
    a,
    s,
    l,
    u,
    c,
    h,
    d,
    m,
    v,
    p,
    k,
    w,
    C,
    y,
    F,
    J,
    E,
    X,
    V,
    H,
    i,
    f,
    _,
    T,
    P,
    A,
    R,
    z,
    r,
    o,
    Y,
    se
  ];
}
class bc extends zb {
  constructor(e) {
    super(), xb(
      this,
      e,
      h2,
      f2,
      Yb,
      {
        i18n: 1,
        eta: 0,
        queue_position: 2,
        queue_size: 3,
        status: 4,
        scroll_to_output: 21,
        timer: 5,
        show_progress: 6,
        message: 22,
        progress: 7,
        variant: 8,
        loading_text: 9,
        absolute: 10,
        translucent: 11,
        border: 12,
        autoscroll: 23
      },
      null,
      [-1, -1]
    );
  }
}
const {
  SvelteComponent: _2,
  add_flush_callback: m2,
  assign: vc,
  bind: p2,
  binding_callbacks: g2,
  check_outros: b2,
  create_component: gn,
  destroy_component: bn,
  detach: bs,
  empty: v2,
  flush: pe,
  get_spread_object: wc,
  get_spread_update: yc,
  group_outros: w2,
  init: y2,
  insert: vs,
  mount_component: vn,
  safe_not_equal: k2,
  space: kc,
  transition_in: Tt,
  transition_out: Lt
} = window.__gradio__svelte__internal;
function E2(t) {
  let e, n;
  return e = new Ua({
    props: {
      variant: (
        /*value*/
        t[0] === null && /*active_source*/
        t[19] === "upload" ? "dashed" : "solid"
      ),
      border_mode: (
        /*dragging*/
        t[20] ? "focus" : "base"
      ),
      padding: !1,
      elem_id: (
        /*elem_id*/
        t[2]
      ),
      elem_classes: (
        /*elem_classes*/
        t[3]
      ),
      visible: (
        /*visible*/
        t[4]
      ),
      container: (
        /*container*/
        t[11]
      ),
      scale: (
        /*scale*/
        t[12]
      ),
      min_width: (
        /*min_width*/
        t[13]
      ),
      $$slots: { default: [A2] },
      $$scope: { ctx: t }
    }
  }), {
    c() {
      gn(e.$$.fragment);
    },
    m(i, o) {
      vn(e, i, o), n = !0;
    },
    p(i, o) {
      const r = {};
      o[0] & /*value, active_source*/
      524289 && (r.variant = /*value*/
      i[0] === null && /*active_source*/
      i[19] === "upload" ? "dashed" : "solid"), o[0] & /*dragging*/
      1048576 && (r.border_mode = /*dragging*/
      i[20] ? "focus" : "base"), o[0] & /*elem_id*/
      4 && (r.elem_id = /*elem_id*/
      i[2]), o[0] & /*elem_classes*/
      8 && (r.elem_classes = /*elem_classes*/
      i[3]), o[0] & /*visible*/
      16 && (r.visible = /*visible*/
      i[4]), o[0] & /*container*/
      2048 && (r.container = /*container*/
      i[11]), o[0] & /*scale*/
      4096 && (r.scale = /*scale*/
      i[12]), o[0] & /*min_width*/
      8192 && (r.min_width = /*min_width*/
      i[13]), o[0] & /*label, show_label, show_download_button, value, root, sources, active_source, pending, streaming, editable, gradio, waveform_settings, waveform_options, dragging, loading_status*/
      4179907 | o[1] & /*$$scope*/
      16384 && (r.$$scope = { dirty: o, ctx: i }), e.$set(r);
    },
    i(i) {
      n || (Tt(e.$$.fragment, i), n = !0);
    },
    o(i) {
      Lt(e.$$.fragment, i), n = !1;
    },
    d(i) {
      bn(e, i);
    }
  };
}
function C2(t) {
  let e, n;
  return e = new Ua({
    props: {
      variant: "solid",
      border_mode: (
        /*dragging*/
        t[20] ? "focus" : "base"
      ),
      padding: !1,
      elem_id: (
        /*elem_id*/
        t[2]
      ),
      elem_classes: (
        /*elem_classes*/
        t[3]
      ),
      visible: (
        /*visible*/
        t[4]
      ),
      container: (
        /*container*/
        t[11]
      ),
      scale: (
        /*scale*/
        t[12]
      ),
      min_width: (
        /*min_width*/
        t[13]
      ),
      $$slots: { default: [T2] },
      $$scope: { ctx: t }
    }
  }), {
    c() {
      gn(e.$$.fragment);
    },
    m(i, o) {
      vn(e, i, o), n = !0;
    },
    p(i, o) {
      const r = {};
      o[0] & /*dragging*/
      1048576 && (r.border_mode = /*dragging*/
      i[20] ? "focus" : "base"), o[0] & /*elem_id*/
      4 && (r.elem_id = /*elem_id*/
      i[2]), o[0] & /*elem_classes*/
      8 && (r.elem_classes = /*elem_classes*/
      i[3]), o[0] & /*visible*/
      16 && (r.visible = /*visible*/
      i[4]), o[0] & /*container*/
      2048 && (r.container = /*container*/
      i[11]), o[0] & /*scale*/
      4096 && (r.scale = /*scale*/
      i[12]), o[0] & /*min_width*/
      8192 && (r.min_width = /*min_width*/
      i[13]), o[0] & /*gradio, show_label, show_download_button, value, label, waveform_settings, waveform_options, loading_status*/
      2393731 | o[1] & /*$$scope*/
      16384 && (r.$$scope = { dirty: o, ctx: i }), e.$set(r);
    },
    i(i) {
      n || (Tt(e.$$.fragment, i), n = !0);
    },
    o(i) {
      Lt(e.$$.fragment, i), n = !1;
    },
    d(i) {
      bn(e, i);
    }
  };
}
function S2(t) {
  let e, n;
  return e = new p_({
    props: {
      i18n: (
        /*gradio*/
        t[18].i18n
      ),
      type: "audio"
    }
  }), {
    c() {
      gn(e.$$.fragment);
    },
    m(i, o) {
      vn(e, i, o), n = !0;
    },
    p(i, o) {
      const r = {};
      o[0] & /*gradio*/
      262144 && (r.i18n = /*gradio*/
      i[18].i18n), e.$set(r);
    },
    i(i) {
      n || (Tt(e.$$.fragment, i), n = !0);
    },
    o(i) {
      Lt(e.$$.fragment, i), n = !1;
    },
    d(i) {
      bn(e, i);
    }
  };
}
function A2(t) {
  let e, n, i, o, r;
  const s = [
    {
      autoscroll: (
        /*gradio*/
        t[18].autoscroll
      )
    },
    { i18n: (
      /*gradio*/
      t[18].i18n
    ) },
    /*loading_status*/
    t[1]
  ];
  let a = {};
  for (let c = 0; c < s.length; c += 1)
    a = vc(a, s[c]);
  e = new bc({ props: a });
  function l(c) {
    t[31](c);
  }
  let u = {
    label: (
      /*label*/
      t[7]
    ),
    show_label: (
      /*show_label*/
      t[9]
    ),
    show_download_button: (
      /*show_download_button*/
      t[10]
    ),
    value: (
      /*value*/
      t[0]
    ),
    root: (
      /*root*/
      t[8]
    ),
    sources: (
      /*sources*/
      t[6]
    ),
    active_source: (
      /*active_source*/
      t[19]
    ),
    pending: (
      /*pending*/
      t[16]
    ),
    streaming: (
      /*streaming*/
      t[17]
    ),
    editable: (
      /*editable*/
      t[14]
    ),
    i18n: (
      /*gradio*/
      t[18].i18n
    ),
    waveform_settings: (
      /*waveform_settings*/
      t[21]
    ),
    waveform_options: (
      /*waveform_options*/
      t[15]
    ),
    $$slots: { default: [S2] },
    $$scope: { ctx: t }
  };
  return (
    /*dragging*/
    t[20] !== void 0 && (u.dragging = /*dragging*/
    t[20]), i = new Bb({ props: u }), g2.push(() => p2(i, "dragging", l)), i.$on(
      "change",
      /*change_handler*/
      t[32]
    ), i.$on(
      "stream",
      /*stream_handler*/
      t[33]
    ), i.$on(
      "drag",
      /*drag_handler*/
      t[34]
    ), i.$on(
      "edit",
      /*edit_handler*/
      t[35]
    ), i.$on(
      "play",
      /*play_handler_1*/
      t[36]
    ), i.$on(
      "pause",
      /*pause_handler_1*/
      t[37]
    ), i.$on(
      "stop",
      /*stop_handler_1*/
      t[38]
    ), i.$on(
      "start_recording",
      /*start_recording_handler*/
      t[39]
    ), i.$on(
      "pause_recording",
      /*pause_recording_handler*/
      t[40]
    ), i.$on(
      "stop_recording",
      /*stop_recording_handler*/
      t[41]
    ), i.$on(
      "upload",
      /*upload_handler*/
      t[42]
    ), i.$on(
      "clear",
      /*clear_handler*/
      t[43]
    ), i.$on(
      "error",
      /*handle_error*/
      t[22]
    ), {
      c() {
        gn(e.$$.fragment), n = kc(), gn(i.$$.fragment);
      },
      m(c, f) {
        vn(e, c, f), vs(c, n, f), vn(i, c, f), r = !0;
      },
      p(c, f) {
        const h = f[0] & /*gradio, loading_status*/
        262146 ? yc(s, [
          f[0] & /*gradio*/
          262144 && {
            autoscroll: (
              /*gradio*/
              c[18].autoscroll
            )
          },
          f[0] & /*gradio*/
          262144 && { i18n: (
            /*gradio*/
            c[18].i18n
          ) },
          f[0] & /*loading_status*/
          2 && wc(
            /*loading_status*/
            c[1]
          )
        ]) : {};
        e.$set(h);
        const d = {};
        f[0] & /*label*/
        128 && (d.label = /*label*/
        c[7]), f[0] & /*show_label*/
        512 && (d.show_label = /*show_label*/
        c[9]), f[0] & /*show_download_button*/
        1024 && (d.show_download_button = /*show_download_button*/
        c[10]), f[0] & /*value*/
        1 && (d.value = /*value*/
        c[0]), f[0] & /*root*/
        256 && (d.root = /*root*/
        c[8]), f[0] & /*sources*/
        64 && (d.sources = /*sources*/
        c[6]), f[0] & /*active_source*/
        524288 && (d.active_source = /*active_source*/
        c[19]), f[0] & /*pending*/
        65536 && (d.pending = /*pending*/
        c[16]), f[0] & /*streaming*/
        131072 && (d.streaming = /*streaming*/
        c[17]), f[0] & /*editable*/
        16384 && (d.editable = /*editable*/
        c[14]), f[0] & /*gradio*/
        262144 && (d.i18n = /*gradio*/
        c[18].i18n), f[0] & /*waveform_settings*/
        2097152 && (d.waveform_settings = /*waveform_settings*/
        c[21]), f[0] & /*waveform_options*/
        32768 && (d.waveform_options = /*waveform_options*/
        c[15]), f[0] & /*gradio*/
        262144 | f[1] & /*$$scope*/
        16384 && (d.$$scope = { dirty: f, ctx: c }), !o && f[0] & /*dragging*/
        1048576 && (o = !0, d.dragging = /*dragging*/
        c[20], m2(() => o = !1)), i.$set(d);
      },
      i(c) {
        r || (Tt(e.$$.fragment, c), Tt(i.$$.fragment, c), r = !0);
      },
      o(c) {
        Lt(e.$$.fragment, c), Lt(i.$$.fragment, c), r = !1;
      },
      d(c) {
        c && bs(n), bn(e, c), bn(i, c);
      }
    }
  );
}
function T2(t) {
  let e, n, i, o;
  const r = [
    {
      autoscroll: (
        /*gradio*/
        t[18].autoscroll
      )
    },
    { i18n: (
      /*gradio*/
      t[18].i18n
    ) },
    /*loading_status*/
    t[1]
  ];
  let s = {};
  for (let a = 0; a < r.length; a += 1)
    s = vc(s, r[a]);
  return e = new bc({ props: s }), i = new Gm({
    props: {
      i18n: (
        /*gradio*/
        t[18].i18n
      ),
      show_label: (
        /*show_label*/
        t[9]
      ),
      show_download_button: (
        /*show_download_button*/
        t[10]
      ),
      value: (
        /*value*/
        t[0]
      ),
      label: (
        /*label*/
        t[7]
      ),
      waveform_settings: (
        /*waveform_settings*/
        t[21]
      ),
      waveform_options: (
        /*waveform_options*/
        t[15]
      )
    }
  }), i.$on(
    "share",
    /*share_handler*/
    t[26]
  ), i.$on(
    "error",
    /*error_handler*/
    t[27]
  ), i.$on(
    "play",
    /*play_handler*/
    t[28]
  ), i.$on(
    "pause",
    /*pause_handler*/
    t[29]
  ), i.$on(
    "stop",
    /*stop_handler*/
    t[30]
  ), {
    c() {
      gn(e.$$.fragment), n = kc(), gn(i.$$.fragment);
    },
    m(a, l) {
      vn(e, a, l), vs(a, n, l), vn(i, a, l), o = !0;
    },
    p(a, l) {
      const u = l[0] & /*gradio, loading_status*/
      262146 ? yc(r, [
        l[0] & /*gradio*/
        262144 && {
          autoscroll: (
            /*gradio*/
            a[18].autoscroll
          )
        },
        l[0] & /*gradio*/
        262144 && { i18n: (
          /*gradio*/
          a[18].i18n
        ) },
        l[0] & /*loading_status*/
        2 && wc(
          /*loading_status*/
          a[1]
        )
      ]) : {};
      e.$set(u);
      const c = {};
      l[0] & /*gradio*/
      262144 && (c.i18n = /*gradio*/
      a[18].i18n), l[0] & /*show_label*/
      512 && (c.show_label = /*show_label*/
      a[9]), l[0] & /*show_download_button*/
      1024 && (c.show_download_button = /*show_download_button*/
      a[10]), l[0] & /*value*/
      1 && (c.value = /*value*/
      a[0]), l[0] & /*label*/
      128 && (c.label = /*label*/
      a[7]), l[0] & /*waveform_settings*/
      2097152 && (c.waveform_settings = /*waveform_settings*/
      a[21]), l[0] & /*waveform_options*/
      32768 && (c.waveform_options = /*waveform_options*/
      a[15]), i.$set(c);
    },
    i(a) {
      o || (Tt(e.$$.fragment, a), Tt(i.$$.fragment, a), o = !0);
    },
    o(a) {
      Lt(e.$$.fragment, a), Lt(i.$$.fragment, a), o = !1;
    },
    d(a) {
      a && bs(n), bn(e, a), bn(i, a);
    }
  };
}
function L2(t) {
  let e, n, i, o;
  const r = [C2, E2], s = [];
  function a(l, u) {
    return (
      /*interactive*/
      l[5] ? 1 : 0
    );
  }
  return e = a(t), n = s[e] = r[e](t), {
    c() {
      n.c(), i = v2();
    },
    m(l, u) {
      s[e].m(l, u), vs(l, i, u), o = !0;
    },
    p(l, u) {
      let c = e;
      e = a(l), e === c ? s[e].p(l, u) : (w2(), Lt(s[c], 1, 1, () => {
        s[c] = null;
      }), b2(), n = s[e], n ? n.p(l, u) : (n = s[e] = r[e](l), n.c()), Tt(n, 1), n.m(i.parentNode, i));
    },
    i(l) {
      o || (Tt(n), o = !0);
    },
    o(l) {
      Lt(n), o = !1;
    },
    d(l) {
      l && bs(i), s[e].d(l);
    }
  };
}
function P2(t, e, n) {
  let { elem_id: i = "" } = e, { elem_classes: o = [] } = e, { visible: r = !0 } = e, { interactive: s } = e, { value: a = null } = e, { sources: l } = e, { label: u } = e, { root: c } = e, { show_label: f } = e, { show_download_button: h = !0 } = e, { container: d = !0 } = e, { scale: _ = null } = e, { min_width: m = void 0 } = e, { loading_status: v } = e, { autoplay: p = !1 } = e, { editable: k = !0 } = e, { waveform_options: w = {} } = e, { pending: C } = e, { streaming: T } = e, { gradio: y } = e, O = null, P, A = a, R, z;
  function X({ detail: M }) {
    const [B, ue] = M.includes("Invalid file type") ? ["warning", "complete"] : ["error", "error"];
    n(1, v = v || {}), n(1, v.status = ue, v), n(1, v.message = M, v), y.dispatch(B, M);
  }
  const F = (M) => y.dispatch("share", M.detail), J = (M) => y.dispatch("error", M.detail), E = () => y.dispatch("play"), V = () => y.dispatch("pause"), N = () => y.dispatch("stop");
  function U(M) {
    R = M, n(20, R);
  }
  const ee = ({ detail: M }) => n(0, a = M), H = ({ detail: M }) => {
    n(0, a = M), y.dispatch("stream", a);
  }, Y = ({ detail: M }) => n(20, R = M), se = (M) => y.dispatch("edit", M.detail), g = () => y.dispatch("play"), L = () => y.dispatch("pause"), G = () => y.dispatch("stop"), W = () => y.dispatch("start_recording"), de = () => y.dispatch("pause_recording"), he = (M) => y.dispatch("stop_recording", M.detail), q = () => y.dispatch("upload"), ve = () => y.dispatch("clear");
  return t.$$set = (M) => {
    "elem_id" in M && n(2, i = M.elem_id), "elem_classes" in M && n(3, o = M.elem_classes), "visible" in M && n(4, r = M.visible), "interactive" in M && n(5, s = M.interactive), "value" in M && n(0, a = M.value), "sources" in M && n(6, l = M.sources), "label" in M && n(7, u = M.label), "root" in M && n(8, c = M.root), "show_label" in M && n(9, f = M.show_label), "show_download_button" in M && n(10, h = M.show_download_button), "container" in M && n(11, d = M.container), "scale" in M && n(12, _ = M.scale), "min_width" in M && n(13, m = M.min_width), "loading_status" in M && n(1, v = M.loading_status), "autoplay" in M && n(23, p = M.autoplay), "editable" in M && n(14, k = M.editable), "waveform_options" in M && n(15, w = M.waveform_options), "pending" in M && n(16, C = M.pending), "streaming" in M && n(17, T = M.streaming), "gradio" in M && n(18, y = M.gradio);
  }, t.$$.update = () => {
    t.$$.dirty[0] & /*value, initial_value*/
    33554433 && a && A === null && n(25, A = a), t.$$.dirty[0] & /*value, old_value, gradio*/
    17039361 && JSON.stringify(a) !== JSON.stringify(O) && (n(24, O = a), y.dispatch("change")), t.$$.dirty[0] & /*active_source, sources*/
    524352 && !P && l && n(19, P = l[0]), t.$$.dirty[0] & /*waveform_options, autoplay*/
    8421376 && n(21, z = {
      height: 50,
      waveColor: w.waveform_color || "#9ca3af",
      progressColor: w.waveform_progress_color || "#f97316",
      barWidth: 2,
      barGap: 3,
      cursorWidth: 2,
      cursorColor: "#ddd5e9",
      autoplay: p,
      barRadius: 10,
      dragToSeek: !0,
      normalize: !0,
      minPxPerSec: 20,
      mediaControls: w.show_controls
    });
  }, [
    a,
    v,
    i,
    o,
    r,
    s,
    l,
    u,
    c,
    f,
    h,
    d,
    _,
    m,
    k,
    w,
    C,
    T,
    y,
    P,
    R,
    z,
    X,
    p,
    O,
    A,
    F,
    J,
    E,
    V,
    N,
    U,
    ee,
    H,
    Y,
    se,
    g,
    L,
    G,
    W,
    de,
    he,
    q,
    ve
  ];
}
class Q2 extends _2 {
  constructor(e) {
    super(), y2(
      this,
      e,
      P2,
      L2,
      k2,
      {
        elem_id: 2,
        elem_classes: 3,
        visible: 4,
        interactive: 5,
        value: 0,
        sources: 6,
        label: 7,
        root: 8,
        show_label: 9,
        show_download_button: 10,
        container: 11,
        scale: 12,
        min_width: 13,
        loading_status: 1,
        autoplay: 23,
        editable: 14,
        waveform_options: 15,
        pending: 16,
        streaming: 17,
        gradio: 18
      },
      null,
      [-1, -1]
    );
  }
  get elem_id() {
    return this.$$.ctx[2];
  }
  set elem_id(e) {
    this.$$set({ elem_id: e }), pe();
  }
  get elem_classes() {
    return this.$$.ctx[3];
  }
  set elem_classes(e) {
    this.$$set({ elem_classes: e }), pe();
  }
  get visible() {
    return this.$$.ctx[4];
  }
  set visible(e) {
    this.$$set({ visible: e }), pe();
  }
  get interactive() {
    return this.$$.ctx[5];
  }
  set interactive(e) {
    this.$$set({ interactive: e }), pe();
  }
  get value() {
    return this.$$.ctx[0];
  }
  set value(e) {
    this.$$set({ value: e }), pe();
  }
  get sources() {
    return this.$$.ctx[6];
  }
  set sources(e) {
    this.$$set({ sources: e }), pe();
  }
  get label() {
    return this.$$.ctx[7];
  }
  set label(e) {
    this.$$set({ label: e }), pe();
  }
  get root() {
    return this.$$.ctx[8];
  }
  set root(e) {
    this.$$set({ root: e }), pe();
  }
  get show_label() {
    return this.$$.ctx[9];
  }
  set show_label(e) {
    this.$$set({ show_label: e }), pe();
  }
  get show_download_button() {
    return this.$$.ctx[10];
  }
  set show_download_button(e) {
    this.$$set({ show_download_button: e }), pe();
  }
  get container() {
    return this.$$.ctx[11];
  }
  set container(e) {
    this.$$set({ container: e }), pe();
  }
  get scale() {
    return this.$$.ctx[12];
  }
  set scale(e) {
    this.$$set({ scale: e }), pe();
  }
  get min_width() {
    return this.$$.ctx[13];
  }
  set min_width(e) {
    this.$$set({ min_width: e }), pe();
  }
  get loading_status() {
    return this.$$.ctx[1];
  }
  set loading_status(e) {
    this.$$set({ loading_status: e }), pe();
  }
  get autoplay() {
    return this.$$.ctx[23];
  }
  set autoplay(e) {
    this.$$set({ autoplay: e }), pe();
  }
  get editable() {
    return this.$$.ctx[14];
  }
  set editable(e) {
    this.$$set({ editable: e }), pe();
  }
  get waveform_options() {
    return this.$$.ctx[15];
  }
  set waveform_options(e) {
    this.$$set({ waveform_options: e }), pe();
  }
  get pending() {
    return this.$$.ctx[16];
  }
  set pending(e) {
    this.$$set({ pending: e }), pe();
  }
  get streaming() {
    return this.$$.ctx[17];
  }
  set streaming(e) {
    this.$$set({ streaming: e }), pe();
  }
  get gradio() {
    return this.$$.ctx[18];
  }
  set gradio(e) {
    this.$$set({ gradio: e }), pe();
  }
}
const {
  SvelteComponent: R2,
  append: B2,
  attr: M2,
  detach: D2,
  element: O2,
  init: H2,
  insert: N2,
  noop: Pa,
  safe_not_equal: I2,
  set_data: U2,
  text: j2,
  toggle_class: Pn
} = window.__gradio__svelte__internal;
function F2(t) {
  let e, n;
  return {
    c() {
      e = O2("div"), n = j2(
        /*value*/
        t[0]
      ), M2(e, "class", "svelte-1gecy8w"), Pn(
        e,
        "table",
        /*type*/
        t[1] === "table"
      ), Pn(
        e,
        "gallery",
        /*type*/
        t[1] === "gallery"
      ), Pn(
        e,
        "selected",
        /*selected*/
        t[2]
      );
    },
    m(i, o) {
      N2(i, e, o), B2(e, n);
    },
    p(i, [o]) {
      o & /*value*/
      1 && U2(
        n,
        /*value*/
        i[0]
      ), o & /*type*/
      2 && Pn(
        e,
        "table",
        /*type*/
        i[1] === "table"
      ), o & /*type*/
      2 && Pn(
        e,
        "gallery",
        /*type*/
        i[1] === "gallery"
      ), o & /*selected*/
      4 && Pn(
        e,
        "selected",
        /*selected*/
        i[2]
      );
    },
    i: Pa,
    o: Pa,
    d(i) {
      i && D2(e);
    }
  };
}
function q2(t, e, n) {
  let { value: i } = e, { type: o } = e, { selected: r = !1 } = e;
  return t.$$set = (s) => {
    "value" in s && n(0, i = s.value), "type" in s && n(1, o = s.type), "selected" in s && n(2, r = s.selected);
  }, [i, o, r];
}
class K2 extends R2 {
  constructor(e) {
    super(), H2(this, e, q2, F2, I2, { value: 0, type: 1, selected: 2 });
  }
}
export {
  K2 as BaseExample,
  Bb as BaseInteractiveAudio,
  pu as BasePlayer,
  Gm as BaseStaticAudio,
  Q2 as default
};
