var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
import React, { useState, useRef, useEffect } from "react";
import { createPortal } from "react-dom";
const version = "1.0.330";
function s(r, t2) {
  try {
    if (r === null || typeof r != "object") return r;
    if (r instanceof Date) return new Date(r);
    if (Array.isArray(r)) {
      let e2 = [];
      for (let i = 0; i < r.length; i++) e2[i] = s(r[i], "array");
      return e2;
    }
    if (r instanceof Object) {
      delete r.$initParent;
      let e2 = {};
      for (let i in r) r.hasOwnProperty(i) && (e2[i] = s(r[i], "object"));
      return e2;
    }
    return r;
  } catch {
    return console.error("error - cloneDeep node:", r, t2), {};
  }
}
__name(s, "s");
function c$1(r, t2) {
  if (r === t2) return !0;
  if (r == null || t2 == null) return r === t2;
  if (typeof r != typeof t2) return !1;
  if (r instanceof Date && t2 instanceof Date) return r.getTime() === t2.getTime();
  if (Array.isArray(r) && Array.isArray(t2)) {
    if (r.length !== t2.length) return !1;
    for (let e2 = 0; e2 < r.length; e2++) if (!c$1(r[e2], t2[e2])) return !1;
    return !0;
  }
  if (r instanceof Object && t2 instanceof Object) {
    let e2 = Object.keys(r), i = Object.keys(t2);
    if (e2.length !== i.length) return !1;
    for (let n2 of e2) if (!t2.hasOwnProperty(n2) || !c$1(r[n2], t2[n2])) return !1;
    return !0;
  }
  return !1;
}
__name(c$1, "c$1");
function d$1(r) {
  let t2 = [], e2 = JSON.stringify(r, function(i, n2) {
    if (typeof n2 == "object" && n2 !== null) {
      if (t2.indexOf(n2) !== -1) return;
      t2.push(n2);
    }
    return n2;
  });
  return t2 = null, e2;
}
__name(d$1, "d$1");
var l$2 = /* @__PURE__ */ __name((r) => {
  var t2 = null, e2 = r.slice(0, 2);
  if (e2 === "on") {
    var i = r.charAt(2), n2 = r.charAt(2).toUpperCase();
    i === n2 && (t2 = r.slice(2).toLowerCase());
  }
  return window.Ext.isClassic === !0 && t2 === "tap" && (t2 = "click"), t2;
}, "l$2"), h = /* @__PURE__ */ __name((r, t2, e2) => {
  if (!(typeof window === void 0 || typeof window > "u")) {
    var i = /* @__PURE__ */ __name((o2) => {
      let p2 = o2.charAt(0).toUpperCase(), a2 = o2.slice(1);
      var u2 = "set" + (p2 + a2);
      return u2;
    }, "i"), n2;
    window.Ext.isClassic === !0 ? t2 === "items" ? (r.removeAll(!0), r.add(e2)) : t2 !== "layout" && (n2 = i(t2), r[n2] !== void 0 ? r[n2](e2) : r[t2] = e2) : (n2 = i(t2), r[n2] !== void 0 && r[n2](e2));
  }
}, "h");
function m$1(r, t2, e2, i) {
  delete t2.children, delete e2.children;
  for (let [f] of Object.entries(t2)) {
    if (l$2(f) != null || f === "xtype" || f === "items") return;
    var n2 = s(t2[f], "root"), o2 = s(e2[f], "root");
    n2 != null && delete n2.listeners, o2 != null && delete o2.listeners;
    var y = d$1(n2), p2 = d$1(o2), a2 = c$1(y, p2);
    a2 || h(i, f, o2);
  }
}
__name(m$1, "m$1");
var l$1 = /* @__PURE__ */ __name((d2) => {
  var t2 = null, n2 = d2.slice(0, 2);
  if (n2 === "on") {
    var r = d2.charAt(2), e2 = d2.charAt(2).toUpperCase();
    r === e2 && (t2 = d2.slice(2).toLowerCase());
  }
  return window.Ext.isClassic === !0 && t2 === "tap" && (t2 = "click"), t2;
}, "l$1"), u = /* @__PURE__ */ __name((d2, t2, n2, r) => {
  if (!(typeof window === void 0 || typeof window > "u")) {
    var e2 = {};
    if (e2.xtype = d2, t2 !== void 0) for (let [i, o2] of Object.entries(t2)) e2[i] = o2;
    if (n2.references === !0 && (e2.controller = window.Ext.create("Ext.app.ViewController")), e2.store !== void 0 && (e2.store.listeners !== void 0 ? e2.store.listeners.load === void 0 && (e2.store.listeners.load = (i) => {
      n2.storeloaded !== void 0 && n2.storeloaded(i, r()), n2.onStoreloaded !== void 0 && n2.onStoreloaded(i, r());
    }) : e2.store.listeners = { load: /* @__PURE__ */ __name((i) => {
      n2.storeloaded !== void 0 && n2.storeloaded(i, r()), n2.onStoreloaded !== void 0 && n2.onStoreloaded(i, r());
    }, "load") }), e2.listeners === void 0) {
      e2.listeners = {};
      for (let [i, o2] of Object.entries(n2)) {
        var f = l$1(i);
        f !== null && (e2.listeners[f] = function() {
          o2(...arguments);
        });
      }
      Object.keys(e2.listeners).length === 0 && delete e2.listeners;
    }
    return e2;
  }
}, "u"), E = /* @__PURE__ */ __name((o2, m2, l2, f) => {
  var d2 = [];
  if (!(typeof window === void 0 || typeof window > "u")) {
    var r = [], n2 = [];
    if (o2 === void 0) return { childarray: [] };
    o2.length === void 0 ? r.push(o2) : r = o2;
    var a2 = 0;
    try {
      r.forEach((t2) => {
        if (m2.xtype == "tabpanel") {
          var p2;
          window.Ext.ReExtTheme === "classic" ? p2 = "Ext.panel.Panel" : p2 = "Ext.Panel";
          var u2;
          u2 = window.Ext.create(p2, { layout: "fit", title: t2.props.title, cls: "ReExtTabChildRoot", items: [{ xtype: "component", listeners: { activate: /* @__PURE__ */ __name((e2) => {
            n2.push(e2.el.dom), a2++, a2 === r.length && f(n2);
            var i = e2.el.dom.parentNode;
            l2.observe(i);
          }, "activate"), render: /* @__PURE__ */ __name((e2) => {
            n2.push(e2.el.dom), a2++, a2 === r.length && f(n2);
            var i = e2.el.dom.parentNode;
            l2.observe(i);
          }, "render") }, style: { display: "flex", height: "100%", width: "100%" } }] }), d2.push(u2);
        } else {
          var v = t2.props.childHeight, h2 = t2.props.childWidth, c2 = t2.props.childFlex, y = t2.props.childRegion, x2 = t2.props.childSplit;
          let e2 = {};
          e2.xtype = "container", e2.layout = "fit", e2.name = "portalcontainer", e2.cls = "portalcontainer";
          var s2 = !1;
          v !== void 0 && (e2.height = v, s2 = !0), h2 !== void 0 && (e2.width = h2, s2 = !0), s2 === !1 && (c2 !== void 0 ? e2.flex = c2 : e2.flex = 1), y !== void 0 && (e2.region = y), x2 !== void 0 && (e2.split = x2), e2.items = [{ xtype: "container", layout: "fit", name: "portalroot", cls: "portalroot", style: { flex: 1, display: "flex", height: "100%", width: "100%" }, listeners: { render: /* @__PURE__ */ __name((i) => {
            n2.push(i.el.dom), a2++, a2 === r.length && f(n2);
            var g2 = i.el.dom.parentNode;
            l2.observe(g2);
          }, "render") } }], d2.push(e2);
        }
      });
      var w2 = { childarray: d2 };
      return w2;
    } catch (t2) {
      return console.error("iteratechildren:", t2.toString()), [];
    }
  }
}, "E"), a$1 = /* @__PURE__ */ __name(() => {
  var t2;
  return typeof ResizeObserver < "u" ? (t2 = new ResizeObserver((o2) => {
    if (!(typeof window === void 0 || typeof window > "u")) for (let n2 of o2) {
      var r = 0, e2 = n2.target.children.item(r);
      if (e2 !== null && n2.contentBoxSize) {
        let i = n2.contentBoxSize[0];
        var s2 = i.inlineSize, f = window.Ext.getCmp(e2.id);
        if (f !== void 0) window.Ext.getCmp(e2.id).setWidth(s2), window.Ext.getCmp(e2.id).setHeight(i.blockSize);
        else if (!e2.classList.contains("wm")) {
          console.log("child not found", e2.id);
          var d2 = e2.getAttribute("w");
          d2 !== "w" && console.warn("child not resized", e2);
        }
      }
    }
  }), t2) : null;
}, "a$1");
async function o() {
  return await new Promise((e2) => {
    function t2() {
      window.Ext !== void 0 && window.Ext.onReady(function() {
        return clearInterval(n2), e2(1);
      });
    }
    __name(t2, "t");
    var n2 = setInterval(t2, 5);
  });
}
__name(o, "o");
var n$1 = /* @__PURE__ */ __name((t2, d2, l2) => {
  if (typeof window > "u") return;
  let e2 = document.createElement("div");
  e2.classList.add("wm"), e2.style.zIndex = 2e4, e2.style.position = "absolute", e2.style.bottom = "0px", e2.style.right = "0px", e2.style.color = "white", e2.style.fontSize = "10px", e2.style.fontWeight = "bold", e2.style.fontStyle = "italic", e2.style.background = "#B87333", e2.style.padding = "1px 3px 1px 1px", e2.style.border = "1px solid lightgray", e2.style.borderRadius = "3px 3px 3px 3px", e2.innerText = "ReExt " + d2, l2 !== null ? l2.appendChild(e2) : t2.el !== void 0 && t2.el.dom.appendChild(e2);
}, "n$1");
function doLogo(props, style, version2, type, reextplugin, React2) {
  var extlocation = "", extver = "", exttoolkit = "", exttheme = "";
  if (window.Ext !== void 0 && window.Ext.versions !== null && window.Ext.versions !== void 0) {
    extver = window.Ext.versions.core.version, exttheme = window.Ext.ReExtTheme, extlocation = window.Ext.ReExtLocation;
    var classic = window.Ext.isClassic;
    classic === !0 ? exttoolkit = "classic" : exttoolkit = "modern";
  }
  return /* @__PURE__ */ jsxs("div", { name: "ReExtRootLogo", "data-rid": props.rid, style: { display: "flex", flexDirection: props.flexdirection, alignItems: "center", color: "black", padding: 5, ...style }, children: [
    /* @__PURE__ */ jsx("img", { style: { height: 40, width: 80 }, src: "../ReExt/ReExt.png" }),
    /* @__PURE__ */ jsxs("div", { style: { margin: "0 0 0 3px" }, children: [
      /* @__PURE__ */ jsx("div", { style: { margin: "0 0 0 1px", fontSize: 12, color: "black" }, children: /* @__PURE__ */ jsx("a", { style: props.style, target: "_blank", rel: "noreferrer", href: "https://www.npmjs.com/package/@sencha/reext", children: /* @__PURE__ */ jsxs("i", { children: [
        "ReExt ",
        version2
      ] }) }) }),
      /* @__PURE__ */ jsx("div", { style: { fontSize: "10px", margin: "2px 0 0 0" }, children: /* @__PURE__ */ jsxs("span", { style: { margin: "0 0 0 0" }, children: [
        type,
        ", reextplugin: ",
        reextplugin.toString()
      ] }) }),
      /* @__PURE__ */ jsx("div", { style: { fontSize: "10px", margin: "2px 0 0 0" }, children: /* @__PURE__ */ jsxs("span", { style: { margin: "0 0 0 0" }, children: [
        "React: ",
        /* @__PURE__ */ jsx("b", { children: React2.version })
      ] }) }),
      /* @__PURE__ */ jsx("div", { style: { fontSize: "10px", margin: "2px 0 0 0" }, children: /* @__PURE__ */ jsxs("span", { style: { margin: "0 0 0 0" }, children: [
        "ExtJS: ",
        /* @__PURE__ */ jsxs("b", { children: [
          extver,
          " (",
          extlocation,
          ")"
        ] })
      ] }) }),
      /* @__PURE__ */ jsxs("div", { style: { fontSize: "10px", margin: "2px 0 0 0" }, children: [
        /* @__PURE__ */ jsxs("span", { style: { margin: "0 0 0 0" }, children: [
          "toolkit: ",
          /* @__PURE__ */ jsx("b", { children: exttoolkit })
        ] }),
        /* @__PURE__ */ jsxs("span", { style: { margin: "0 0 0 5px" }, children: [
          "theme: ",
          /* @__PURE__ */ jsx("b", { children: exttheme })
        ] })
      ] })
    ] })
  ] });
}
__name(doLogo, "doLogo");
const ReExt = /* @__PURE__ */ __name((props) => {
  if (typeof window === void 0 || typeof window > "u")
    return;
  if (props.xtype === "window")
    return null;
  var type = window.tt;
  const [reextplugin, setReExtPlugin] = useState(!1), [dom, setDom] = useState(null), [rootstyle, setRootStyle] = useState(null), [rootclassname, setRootClassName] = useState(null), [extcmp, setExtCmp] = useState(null), extcmpRef = useRef(null);
  extcmpRef.current = extcmp;
  const getExtCmp = /* @__PURE__ */ __name(() => extcmpRef.current, "getExtCmp"), [currconfig, setCurrConfig] = useState(null), currconfigRef = useRef(null);
  currconfigRef.current = currconfig;
  const getCurrConfig = /* @__PURE__ */ __name(() => currconfigRef.current, "getCurrConfig"), ReExtRootRef = useRef(null);
  var resizeObserver = a$1();
  return props.xtype === "logo" ? doLogo(props, rootstyle, version, type, reextplugin, React) : (useEffect(() => {
    setCurrConfig(props.config);
    try {
      var r = __IS_REEXT_RUNNING__;
      setReExtPlugin(!0);
    } catch {
      setReExtPlugin(!1);
    }
    var cmp, returnHit = "false";
    if (!(typeof window === void 0 || typeof window > "u"))
      return (async () => {
        if (await o(), returnHit === "false" && props.xtype !== "logo") {
          var latestconfig;
          getCurrConfig() == null ? latestconfig = props.config : latestconfig = getCurrConfig();
          try {
            var o$1 = u(props.xtype, latestconfig, props, getExtCmp), f = Ext.ClassManager.getByAlias("widget." + o$1.xtype);
            if (f === void 0) {
              var message = "ReExt " + o$1.xtype + " could not be created";
              o$1 = { xtype: "label", text: message, style: { color: "red", background: "lightgray" } };
            }
            if (o$1.height === void 0 && o$1.xtype !== "window" && (window.Ext.isClassic === !0 && o$1.xtype === "grid" ? o$1.height = 0 : o$1.height = "100%"), o$1.width === void 0 && o$1.xtype !== "window" && (window.Ext.isClassic === !0 && o$1.xtype === "grid" ? o$1.width = 0 : o$1.width = "100%"), window.Ext.isClassic === !0) {
              const boxready = /* @__PURE__ */ __name((c2) => {
                var parent = c2.el.dom.parentNode;
                resizeObserver.observe(parent);
              }, "boxready");
              o$1.listeners === void 0 ? o$1.listeners = { boxready } : o$1.listeners.boxready = boxready;
            }
            o$1.xtype !== "window" && (o$1.renderTo = ReExtRootRef.current), o$1.xtype === "tabpanel" && (o$1.deferredRender = !1), (o$1.xtype === "panel" || o$1.xtype === "container") && o$1.layout === void 0 && (o$1.layout = { type: "vbox", align: "stretch" }), cmp = window.Ext.create(o$1), setExtCmp(cmp), extcmpRef.current = cmp, props.config !== void 0 && props.config.reference !== void 0 && props.ReExtParent !== void 0 && (props.ReExtParent.ReExtChildren === void 0 && (props.ReExtParent.ReExtChildren = []), props.ReExtParent.ReExtChildren.push(cmp)), type !== null && type !== "production" && n$1(cmp, o$1.xtype, ReExtRootRef.current), props.ready !== void 0 && props.ready(cmp);
          } catch (e2) {
            console.error("ReExt.jsx:", e2);
          }
        }
      })(), () => {
        returnHit = "true", !(typeof window === void 0 || typeof window > "u") && window.Ext !== void 0 && window.Ext.destroy !== void 0 && cmp != null && (setExtCmp(null), window.Ext.destroy(cmp));
      };
  }, []), useEffect(() => {
    if (!(typeof window === void 0 || typeof window > "u") && (setCurrConfig(props.config), props.config !== void 0 && extcmpRef.current !== null)) {
      var oldconfig = currconfigRef.current, newconfig = props.config, extcmp2 = extcmpRef.current;
      m$1("config", oldconfig, newconfig, extcmp2);
    }
  }, [props.config]), useEffect(() => {
    if (props.children && extcmpRef.current !== null) {
      const a2 = E(
        props.children,
        extcmpRef.current,
        resizeObserver,
        setDom
      );
      a2.childarray.length > 0 && (extcmpRef.current.removeAll(), extcmpRef.current.add(a2.childarray));
    }
  }, [extcmpRef.current]), useEffect(() => {
    if (!(typeof window === void 0 || typeof window > "u")) {
      var rootConfigs = {};
      props.flex !== void 0 ? rootConfigs.flex = props.flex : props.rootStyle !== void 0 && props.rootStyle.flex !== void 0 ? rootConfigs.flex = props.rootStyle.flex : rootConfigs.flex = 1;
      var oldstyle = {};
      props.style !== void 0 && (oldstyle = props.style);
      var rootstyle2 = {
        ...oldstyle,
        //...props.rootStyle,
        ...rootConfigs,
        //flex: 1,
        position: "relative",
        display: "flex",
        overflow: "hidden"
      };
      setRootStyle(rootstyle2);
      var oldclassname = "";
      props.className !== void 0 && (oldclassname = props.className);
      var rootclassname2 = "";
      props.rootClassName !== void 0 && (rootclassname2 = props.rootClassName);
      var rootclassnameall = oldclassname + " " + rootclassname2;
      setRootClassName(rootclassnameall);
    }
  }, [dom]), /* @__PURE__ */ jsx(
    "div",
    {
      name: "ReExtRoot-" + props.xtype,
      "data-rid": props.rid,
      className: rootclassname,
      style: rootstyle,
      ref: ReExtRootRef,
      children: dom !== null && dom.map((domitem, i) => {
        if (dom.length === 1) {
          var style = {};
          props.children.props.style === void 0 ? style = { display: "flex", flex: 1 } : style = { ...props.children.props.style, flex: 1 };
          var modifiedChild = React.cloneElement(props.children, {
            //rootStyle: { ...props.children.props.rootStyle, flex: 1 }
            style
            //style: { ...props.children.props.style, flex: 1 }
            //style: style
          }), p2 = createPortal(modifiedChild, domitem);
          return p2;
        } else {
          var style = {};
          props.children[i].props.style === void 0 ? style = { display: "flex", flex: 1 } : style = { ...props.children[i].props.style, flex: 1 };
          var modifiedChild = React.cloneElement(props.children[i], {
            //rootStyle: { ...props.children[i].props.rootStyle, flex: 1 }
            style
            //style: { ...props.children[i].props.style, flex: 1 }
            //style: style
          }), p2 = createPortal(modifiedChild, domitem);
          return p2;
        }
      })
    }
  ));
}, "ReExt");
var n = Object.defineProperty, t = /* @__PURE__ */ __name((o2, d2) => n(o2, "name", { value: d2, configurable: !0 }), "t");
async function e() {
  if (typeof window === void 0 || typeof window > "u") return;
  function o2(d2) {
    d2.style.width = "100%", d2.style.height = "100%", d2.style.margin = "0", d2.style.padding = "0", d2.style.padding = "0", d2.style.boxSizing = "border-box", d2.style.overflow = "hidden";
  }
  __name(o2, "o"), t(o2, "doFill"), document.documentElement && o2(document.documentElement), document.body && o2(document.body), document.getElementById("root") && o2(document.getElementById("root"));
}
__name(e, "e");
t(e, "Fill");
function ReExtSplash() {
  if (!(typeof window === void 0 || typeof window > "u"))
    return /* @__PURE__ */ jsx("div", { className: "splash", style: {
      fontSize: "36px",
      border: "10px solid #0960a5",
      width: "100%",
      height: "100%",
      margin: 0,
      padding: 0,
      boxSizing: "border-box",
      overflow: "hidden",
      display: "flex",
      flexDirection: "column",
      flex: 1,
      justifyContent: "center",
      alignItems: "center"
    }, children: /* @__PURE__ */ jsx("img", { style: { height: 500, width: 1e3 }, src: "../ReExt/ReExt.png" }) });
}
__name(ReExtSplash, "ReExtSplash");
var we = /* @__PURE__ */ __name((e2, r) => () => (r || e2((r = { exports: {} }).exports, r), r.exports), "we"), Ee = we(() => {
}), w = crypto, R = /* @__PURE__ */ __name((e2) => e2 instanceof CryptoKey, "R"), g = new TextEncoder(), d = new TextDecoder();
function re(...e2) {
  let r = e2.reduce((i, { length: s2 }) => i + s2, 0), n2 = new Uint8Array(r), t2 = 0;
  for (let i of e2) n2.set(i, t2), t2 += i.length;
  return n2;
}
__name(re, "re");
var ge = /* @__PURE__ */ __name((e2) => {
  let r = atob(e2), n2 = new Uint8Array(r.length);
  for (let t2 = 0; t2 < r.length; t2++) n2[t2] = r.charCodeAt(t2);
  return n2;
}, "ge"), x = /* @__PURE__ */ __name((e2) => {
  let r = e2;
  r instanceof Uint8Array && (r = d.decode(r)), r = r.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
  try {
    return ge(r);
  } catch {
    throw new TypeError("The input to be decoded is not correctly encoded.");
  }
}, "x"), _a, _ = (_a = class extends Error {
  static get code() {
    return "ERR_JOSE_GENERIC";
  }
  constructor(r) {
    var _a8;
    super(r), this.code = "ERR_JOSE_GENERIC", this.name = this.constructor.name, (_a8 = Error.captureStackTrace) == null || _a8.call(Error, this, this.constructor);
  }
}, __name(_a, "_"), _a), _a2, p = (_a2 = class extends _ {
  static get code() {
    return "ERR_JWT_CLAIM_VALIDATION_FAILED";
  }
  constructor(r, n2, t2 = "unspecified", i = "unspecified") {
    super(r), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = t2, this.reason = i, this.payload = n2;
  }
}, __name(_a2, "p"), _a2), _a3, I = (_a3 = class extends _ {
  static get code() {
    return "ERR_JWT_EXPIRED";
  }
  constructor(r, n2, t2 = "unspecified", i = "unspecified") {
    super(r), this.code = "ERR_JWT_EXPIRED", this.claim = t2, this.reason = i, this.payload = n2;
  }
}, __name(_a3, "I"), _a3), _a4, m = (_a4 = class extends _ {
  constructor() {
    super(...arguments), this.code = "ERR_JOSE_NOT_SUPPORTED";
  }
  static get code() {
    return "ERR_JOSE_NOT_SUPPORTED";
  }
}, __name(_a4, "m"), _a4), _a5, l = (_a5 = class extends _ {
  constructor() {
    super(...arguments), this.code = "ERR_JWS_INVALID";
  }
  static get code() {
    return "ERR_JWS_INVALID";
  }
}, __name(_a5, "l"), _a5), _a6, a = (_a6 = class extends _ {
  constructor() {
    super(...arguments), this.code = "ERR_JWT_INVALID";
  }
  static get code() {
    return "ERR_JWT_INVALID";
  }
}, __name(_a6, "a"), _a6), _a7, P = (_a7 = class extends _ {
  constructor() {
    super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
  }
  static get code() {
    return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
  }
}, __name(_a7, "P"), _a7);
function b(e2, r = "algorithm.name") {
  return new TypeError(`CryptoKey does not support this operation, its ${r} must be ${e2}`);
}
__name(b, "b");
function C(e2, r) {
  return e2.name === r;
}
__name(C, "C");
function K(e2) {
  return parseInt(e2.name.slice(4), 10);
}
__name(K, "K");
function Ie(e2) {
  switch (e2) {
    case "ES256":
      return "P-256";
    case "ES384":
      return "P-384";
    case "ES512":
      return "P-521";
    default:
      throw new Error("unreachable");
  }
}
__name(Ie, "Ie");
function De(e2, r) {
  if (r.length && !r.some((n2) => e2.usages.includes(n2))) {
    let n2 = "CryptoKey does not support this operation, its usages must include ";
    if (r.length > 2) {
      let t2 = r.pop();
      n2 += `one of ${r.join(", ")}, or ${t2}.`;
    } else r.length === 2 ? n2 += `one of ${r[0]} or ${r[1]}.` : n2 += `${r[0]}.`;
    throw new TypeError(n2);
  }
}
__name(De, "De");
function ne(e2, r, ...n2) {
  switch (r) {
    case "HS256":
    case "HS384":
    case "HS512": {
      if (!C(e2.algorithm, "HMAC")) throw b("HMAC");
      let t2 = parseInt(r.slice(2), 10);
      if (K(e2.algorithm.hash) !== t2) throw b(`SHA-${t2}`, "algorithm.hash");
      break;
    }
    case "RS256":
    case "RS384":
    case "RS512": {
      if (!C(e2.algorithm, "RSASSA-PKCS1-v1_5")) throw b("RSASSA-PKCS1-v1_5");
      let t2 = parseInt(r.slice(2), 10);
      if (K(e2.algorithm.hash) !== t2) throw b(`SHA-${t2}`, "algorithm.hash");
      break;
    }
    case "PS256":
    case "PS384":
    case "PS512": {
      if (!C(e2.algorithm, "RSA-PSS")) throw b("RSA-PSS");
      let t2 = parseInt(r.slice(2), 10);
      if (K(e2.algorithm.hash) !== t2) throw b(`SHA-${t2}`, "algorithm.hash");
      break;
    }
    case "EdDSA": {
      if (e2.algorithm.name !== "Ed25519" && e2.algorithm.name !== "Ed448") throw b("Ed25519 or Ed448");
      break;
    }
    case "ES256":
    case "ES384":
    case "ES512": {
      if (!C(e2.algorithm, "ECDSA")) throw b("ECDSA");
      let t2 = Ie(r);
      if (e2.algorithm.namedCurve !== t2) throw b(t2, "algorithm.namedCurve");
      break;
    }
    default:
      throw new TypeError("CryptoKey does not support this operation");
  }
  De(e2, n2);
}
__name(ne, "ne");
function te(e2, r, ...n2) {
  var _a8;
  if (n2.length > 2) {
    let t2 = n2.pop();
    e2 += `one of type ${n2.join(", ")}, or ${t2}.`;
  } else n2.length === 2 ? e2 += `one of type ${n2[0]} or ${n2[1]}.` : e2 += `of type ${n2[0]}.`;
  return r == null ? e2 += ` Received ${r}` : typeof r == "function" && r.name ? e2 += ` Received function ${r.name}` : typeof r == "object" && r != null && ((_a8 = r.constructor) != null && _a8.name) && (e2 += ` Received an instance of ${r.constructor.name}`), e2;
}
__name(te, "te");
var j = /* @__PURE__ */ __name((e2, ...r) => te("Key must be ", e2, ...r), "j");
function M(e2, r, ...n2) {
  return te(`Key for the ${e2} algorithm must be `, r, ...n2);
}
__name(M, "M");
var J = /* @__PURE__ */ __name((e2) => R(e2) ? !0 : (e2 == null ? void 0 : e2[Symbol.toStringTag]) === "KeyObject", "J"), A = ["CryptoKey"], Re = /* @__PURE__ */ __name((...e2) => {
  let r = e2.filter(Boolean);
  if (r.length === 0 || r.length === 1) return !0;
  let n2;
  for (let t2 of r) {
    let i = Object.keys(t2);
    if (!n2 || n2.size === 0) {
      n2 = new Set(i);
      continue;
    }
    for (let s2 of i) {
      if (n2.has(s2)) return !1;
      n2.add(s2);
    }
  }
  return !0;
}, "Re"), ie = Re;
function $e(e2) {
  return typeof e2 == "object" && e2 !== null;
}
__name($e, "$e");
function k(e2) {
  if (!$e(e2) || Object.prototype.toString.call(e2) !== "[object Object]") return !1;
  if (Object.getPrototypeOf(e2) === null) return !0;
  let r = e2;
  for (; Object.getPrototypeOf(r) !== null; ) r = Object.getPrototypeOf(r);
  return Object.getPrototypeOf(e2) === r;
}
__name(k, "k");
var se = /* @__PURE__ */ __name((e2, r) => {
  if (e2.startsWith("RS") || e2.startsWith("PS")) {
    let { modulusLength: n2 } = r.algorithm;
    if (typeof n2 != "number" || n2 < 2048) throw new TypeError(`${e2} requires key modulusLength to be 2048 bits or larger`);
  }
}, "se");
function Pe(e2) {
  let r, n2;
  switch (e2.kty) {
    case "RSA": {
      switch (e2.alg) {
        case "PS256":
        case "PS384":
        case "PS512":
          r = { name: "RSA-PSS", hash: `SHA-${e2.alg.slice(-3)}` }, n2 = e2.d ? ["sign"] : ["verify"];
          break;
        case "RS256":
        case "RS384":
        case "RS512":
          r = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${e2.alg.slice(-3)}` }, n2 = e2.d ? ["sign"] : ["verify"];
          break;
        case "RSA-OAEP":
        case "RSA-OAEP-256":
        case "RSA-OAEP-384":
        case "RSA-OAEP-512":
          r = { name: "RSA-OAEP", hash: `SHA-${parseInt(e2.alg.slice(-3), 10) || 1}` }, n2 = e2.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
          break;
        default:
          throw new m('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
      }
      break;
    }
    case "EC": {
      switch (e2.alg) {
        case "ES256":
          r = { name: "ECDSA", namedCurve: "P-256" }, n2 = e2.d ? ["sign"] : ["verify"];
          break;
        case "ES384":
          r = { name: "ECDSA", namedCurve: "P-384" }, n2 = e2.d ? ["sign"] : ["verify"];
          break;
        case "ES512":
          r = { name: "ECDSA", namedCurve: "P-521" }, n2 = e2.d ? ["sign"] : ["verify"];
          break;
        case "ECDH-ES":
        case "ECDH-ES+A128KW":
        case "ECDH-ES+A192KW":
        case "ECDH-ES+A256KW":
          r = { name: "ECDH", namedCurve: e2.crv }, n2 = e2.d ? ["deriveBits"] : [];
          break;
        default:
          throw new m('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
      }
      break;
    }
    case "OKP": {
      switch (e2.alg) {
        case "EdDSA":
          r = { name: e2.crv }, n2 = e2.d ? ["sign"] : ["verify"];
          break;
        case "ECDH-ES":
        case "ECDH-ES+A128KW":
        case "ECDH-ES+A192KW":
        case "ECDH-ES+A256KW":
          r = { name: e2.crv }, n2 = e2.d ? ["deriveBits"] : [];
          break;
        default:
          throw new m('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
      }
      break;
    }
    default:
      throw new m('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
  }
  return { algorithm: r, keyUsages: n2 };
}
__name(Pe, "Pe");
var Ce = /* @__PURE__ */ __name(async (e2) => {
  if (!e2.alg) throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
  let { algorithm: r, keyUsages: n2 } = Pe(e2), t2 = [r, e2.ext ?? !1, e2.key_ops ?? n2], i = { ...e2 };
  return delete i.alg, delete i.use, w.subtle.importKey("jwk", i, ...t2);
}, "Ce"), ue = Ce, oe = /* @__PURE__ */ __name((e2) => x(e2), "oe"), N, q, ce = /* @__PURE__ */ __name((e2) => (e2 == null ? void 0 : e2[Symbol.toStringTag]) === "KeyObject", "ce"), le = /* @__PURE__ */ __name(async (e2, r, n2, t2) => {
  let i = e2.get(r);
  if (i != null && i[t2]) return i[t2];
  let s2 = await ue({ ...n2, alg: t2 });
  return i ? i[t2] = s2 : e2.set(r, { [t2]: s2 }), s2;
}, "le"), Oe = /* @__PURE__ */ __name((e2, r) => {
  if (ce(e2)) {
    let n2 = e2.export({ format: "jwk" });
    return delete n2.d, delete n2.dp, delete n2.dq, delete n2.p, delete n2.q, delete n2.qi, n2.k ? oe(n2.k) : (q || (q = /* @__PURE__ */ new WeakMap()), le(q, e2, n2, r));
  }
  return e2;
}, "Oe"), Te = /* @__PURE__ */ __name((e2, r) => {
  if (ce(e2)) {
    let n2 = e2.export({ format: "jwk" });
    return n2.k ? oe(n2.k) : (N || (N = /* @__PURE__ */ new WeakMap()), le(N, e2, n2, r));
  }
  return e2;
}, "Te"), L = { normalizePublicKey: Oe, normalizePrivateKey: Te }, S = /* @__PURE__ */ __name((e2) => e2 == null ? void 0 : e2[Symbol.toStringTag], "S"), We = /* @__PURE__ */ __name((e2, r) => {
  if (!(r instanceof Uint8Array)) {
    if (!J(r)) throw new TypeError(M(e2, r, ...A, "Uint8Array"));
    if (r.type !== "secret") throw new TypeError(`${S(r)} instances for symmetric algorithms must be of type "secret"`);
  }
}, "We"), Ke = /* @__PURE__ */ __name((e2, r, n2) => {
  if (!J(r)) throw new TypeError(M(e2, r, ...A));
  if (r.type === "secret") throw new TypeError(`${S(r)} instances for asymmetric algorithms must not be of type "secret"`);
  if (n2 === "sign" && r.type === "public") throw new TypeError(`${S(r)} instances for asymmetric algorithm signing must be of type "private"`);
  if (n2 === "decrypt" && r.type === "public") throw new TypeError(`${S(r)} instances for asymmetric algorithm decryption must be of type "private"`);
  if (r.algorithm && n2 === "verify" && r.type === "private") throw new TypeError(`${S(r)} instances for asymmetric algorithm verifying must be of type "public"`);
  if (r.algorithm && n2 === "encrypt" && r.type === "private") throw new TypeError(`${S(r)} instances for asymmetric algorithm encryption must be of type "public"`);
}, "Ke"), je = /* @__PURE__ */ __name((e2, r, n2) => {
  e2.startsWith("HS") || e2 === "dir" || e2.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e2) ? We(e2, r) : Ke(e2, r, n2);
}, "je"), fe = je;
function Me(e2, r, n2, t2, i) {
  if (i.crit !== void 0 && (t2 == null ? void 0 : t2.crit) === void 0) throw new e2('"crit" (Critical) Header Parameter MUST be integrity protected');
  if (!t2 || t2.crit === void 0) return /* @__PURE__ */ new Set();
  if (!Array.isArray(t2.crit) || t2.crit.length === 0 || t2.crit.some((u2) => typeof u2 != "string" || u2.length === 0)) throw new e2('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
  let s2;
  n2 !== void 0 ? s2 = new Map([...Object.entries(n2), ...r.entries()]) : s2 = r;
  for (let u2 of t2.crit) {
    if (!s2.has(u2)) throw new m(`Extension Header Parameter "${u2}" is not recognized`);
    if (i[u2] === void 0) throw new e2(`Extension Header Parameter "${u2}" is missing`);
    if (s2.get(u2) && t2[u2] === void 0) throw new e2(`Extension Header Parameter "${u2}" MUST be integrity protected`);
  }
  return new Set(t2.crit);
}
__name(Me, "Me");
var ae = Me;
function H(e2, r) {
  let n2 = `SHA-${e2.slice(-3)}`;
  switch (e2) {
    case "HS256":
    case "HS384":
    case "HS512":
      return { hash: n2, name: "HMAC" };
    case "PS256":
    case "PS384":
    case "PS512":
      return { hash: n2, name: "RSA-PSS", saltLength: e2.slice(-3) >> 3 };
    case "RS256":
    case "RS384":
    case "RS512":
      return { hash: n2, name: "RSASSA-PKCS1-v1_5" };
    case "ES256":
    case "ES384":
    case "ES512":
      return { hash: n2, name: "ECDSA", namedCurve: r.namedCurve };
    case "EdDSA":
      return { name: r.name };
    default:
      throw new m(`alg ${e2} is not supported either by JOSE or your javascript runtime`);
  }
}
__name(H, "H");
async function G(e2, r, n2) {
  if (r = await L.normalizePublicKey(r, e2), R(r)) return ne(r, e2, n2), r;
  if (r instanceof Uint8Array) {
    if (!e2.startsWith("HS")) throw new TypeError(j(r, ...A));
    return w.subtle.importKey("raw", r, { hash: `SHA-${e2.slice(-3)}`, name: "HMAC" }, !1, [n2]);
  }
  throw new TypeError(j(r, ...A, "Uint8Array"));
}
__name(G, "G");
var Ne = /* @__PURE__ */ __name(async (e2, r, n2, t2) => {
  let i = await G(e2, r, "verify");
  se(e2, i);
  let s2 = H(e2, i.algorithm);
  try {
    return await w.subtle.verify(s2, i, n2, t2);
  } catch {
    return !1;
  }
}, "Ne"), ye = Ne;
async function he(e2, r, n2) {
  if (!k(e2)) throw new l("Flattened JWS must be an object");
  if (e2.protected === void 0 && e2.header === void 0) throw new l('Flattened JWS must have either of the "protected" or "header" members');
  if (e2.protected !== void 0 && typeof e2.protected != "string") throw new l("JWS Protected Header incorrect type");
  if (e2.payload === void 0) throw new l("JWS Payload missing");
  if (typeof e2.signature != "string") throw new l("JWS Signature missing or incorrect type");
  if (e2.header !== void 0 && !k(e2.header)) throw new l("JWS Unprotected Header incorrect type");
  let t2 = {};
  if (e2.protected) try {
    let W = x(e2.protected);
    t2 = JSON.parse(d.decode(W));
  } catch {
    throw new l("JWS Protected Header is invalid");
  }
  if (!ie(t2, e2.header)) throw new l("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
  let i = { ...t2, ...e2.header }, s2 = ae(l, /* @__PURE__ */ new Map([["b64", !0]]), n2 == null ? void 0 : n2.crit, t2, i), u2 = !0;
  if (s2.has("b64") && (u2 = t2.b64, typeof u2 != "boolean")) throw new l('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
  let { alg: o2 } = i;
  if (typeof o2 != "string" || !o2) throw new l('JWS "alg" (Algorithm) Header Parameter missing or invalid');
  if (u2) {
    if (typeof e2.payload != "string") throw new l("JWS Payload must be a string");
  } else if (typeof e2.payload != "string" && !(e2.payload instanceof Uint8Array)) throw new l("JWS Payload must be a string or an Uint8Array instance");
  let f = !1;
  typeof r == "function" && (r = await r(t2, e2), f = !0), fe(o2, r, "verify");
  let y = re(g.encode(e2.protected ?? ""), g.encode("."), typeof e2.payload == "string" ? g.encode(e2.payload) : e2.payload), v;
  try {
    v = x(e2.signature);
  } catch {
    throw new l("Failed to base64url decode the signature");
  }
  if (!await ye(o2, r, v, y)) throw new P();
  let E2;
  if (u2) try {
    E2 = x(e2.payload);
  } catch {
    throw new l("Failed to base64url decode the payload");
  }
  else typeof e2.payload == "string" ? E2 = g.encode(e2.payload) : E2 = e2.payload;
  let h2 = { payload: E2 };
  return e2.protected !== void 0 && (h2.protectedHeader = t2), e2.header !== void 0 && (h2.unprotectedHeader = e2.header), f ? { ...h2, key: r } : h2;
}
__name(he, "he");
async function me(e2, r, n2) {
  if (e2 instanceof Uint8Array && (e2 = d.decode(e2)), typeof e2 != "string") throw new l("Compact JWS must be a string or Uint8Array");
  let { 0: t2, 1: i, 2: s2, length: u2 } = e2.split(".");
  if (u2 !== 3) throw new l("Invalid Compact JWS");
  let o2 = await he({ payload: i, protected: t2, signature: s2 }, r, n2), c2 = { payload: o2.payload, protectedHeader: o2.protectedHeader };
  return typeof r == "function" ? { ...c2, key: o2.key } : c2;
}
__name(me, "me");
var ve = /* @__PURE__ */ __name((e2) => Math.floor(e2.getTime() / 1e3), "ve"), qe = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, U = /* @__PURE__ */ __name((e2) => {
  let r = qe.exec(e2);
  if (!r || r[4] && r[1]) throw new TypeError("Invalid time period format");
  let n2 = parseFloat(r[2]), t2 = r[3].toLowerCase(), i;
  switch (t2) {
    case "sec":
    case "secs":
    case "second":
    case "seconds":
    case "s":
      i = Math.round(n2);
      break;
    case "minute":
    case "minutes":
    case "min":
    case "mins":
    case "m":
      i = Math.round(n2 * 60);
      break;
    case "hour":
    case "hours":
    case "hr":
    case "hrs":
    case "h":
      i = Math.round(n2 * 3600);
      break;
    case "day":
    case "days":
    case "d":
      i = Math.round(n2 * 86400);
      break;
    case "week":
    case "weeks":
    case "w":
      i = Math.round(n2 * 604800);
      break;
    default:
      i = Math.round(n2 * 31557600);
      break;
  }
  return r[1] === "-" || r[4] === "ago" ? -i : i;
}, "U"), de = /* @__PURE__ */ __name((e2) => e2.toLowerCase().replace(/^application\//, ""), "de"), Le = /* @__PURE__ */ __name((e2, r) => typeof e2 == "string" ? r.includes(e2) : Array.isArray(e2) ? r.some(Set.prototype.has.bind(new Set(e2))) : !1, "Le"), _e = /* @__PURE__ */ __name((e2, r, n2 = {}) => {
  let t2;
  try {
    t2 = JSON.parse(d.decode(r));
  } catch {
  }
  if (!k(t2)) throw new a("JWT Claims Set must be a top-level JSON object");
  let { typ: i } = n2;
  if (i && (typeof e2.typ != "string" || de(e2.typ) !== de(i))) throw new p('unexpected "typ" JWT header value', t2, "typ", "check_failed");
  let { requiredClaims: s2 = [], issuer: u2, subject: o2, audience: c2, maxTokenAge: f } = n2, y = [...s2];
  f !== void 0 && y.push("iat"), c2 !== void 0 && y.push("aud"), o2 !== void 0 && y.push("sub"), u2 !== void 0 && y.push("iss");
  for (let h2 of new Set(y.reverse())) if (!(h2 in t2)) throw new p(`missing required "${h2}" claim`, t2, h2, "missing");
  if (u2 && !(Array.isArray(u2) ? u2 : [u2]).includes(t2.iss)) throw new p('unexpected "iss" claim value', t2, "iss", "check_failed");
  if (o2 && t2.sub !== o2) throw new p('unexpected "sub" claim value', t2, "sub", "check_failed");
  if (c2 && !Le(t2.aud, typeof c2 == "string" ? [c2] : c2)) throw new p('unexpected "aud" claim value', t2, "aud", "check_failed");
  let v;
  switch (typeof n2.clockTolerance) {
    case "string":
      v = U(n2.clockTolerance);
      break;
    case "number":
      v = n2.clockTolerance;
      break;
    case "undefined":
      v = 0;
      break;
    default:
      throw new TypeError("Invalid clockTolerance option type");
  }
  let { currentDate: ee } = n2, E2 = ve(ee || /* @__PURE__ */ new Date());
  if ((t2.iat !== void 0 || f) && typeof t2.iat != "number") throw new p('"iat" claim must be a number', t2, "iat", "invalid");
  if (t2.nbf !== void 0) {
    if (typeof t2.nbf != "number") throw new p('"nbf" claim must be a number', t2, "nbf", "invalid");
    if (t2.nbf > E2 + v) throw new p('"nbf" claim timestamp check failed', t2, "nbf", "check_failed");
  }
  if (t2.exp !== void 0) {
    if (typeof t2.exp != "number") throw new p('"exp" claim must be a number', t2, "exp", "invalid");
    if (t2.exp <= E2 - v) throw new I('"exp" claim timestamp check failed', t2, "exp", "check_failed");
  }
  if (f) {
    let h2 = E2 - t2.iat, W = typeof f == "number" ? f : U(f);
    if (h2 - v > W) throw new I('"iat" claim timestamp check failed (too far in the past)', t2, "iat", "check_failed");
    if (h2 < 0 - v) throw new p('"iat" claim timestamp check failed (it should be in the past)', t2, "iat", "check_failed");
  }
  return t2;
}, "_e");
async function z$1(e2, r, n2) {
  var _a8;
  let t2 = await me(e2, r, n2);
  if ((_a8 = t2.protectedHeader.crit) != null && _a8.includes("b64") && t2.protectedHeader.b64 === !1) throw new a("JWTs MUST NOT use unencoded payload");
  let s2 = { payload: _e(t2.protectedHeader, t2.payload, n2), protectedHeader: t2.protectedHeader };
  return typeof r == "function" ? { ...s2, key: t2.key } : s2;
}
__name(z$1, "z$1");
var be = x;
function V(e2) {
  if (typeof e2 != "string") throw new a("JWTs must use Compact JWS serialization, JWT must be a string");
  let { 1: r, length: n2 } = e2.split(".");
  if (n2 === 5) throw new a("Only JWTs using Compact JWS serialization can be decoded");
  if (n2 !== 3) throw new a("Invalid JWT");
  if (!r) throw new a("JWTs must contain a payload");
  let t2;
  try {
    t2 = be(r);
  } catch {
    throw new a("Failed to base64url decode the payload");
  }
  let i;
  try {
    i = JSON.parse(d.decode(t2));
  } catch {
    throw new a("Failed to parse the decoded payload as JSON");
  }
  if (!k(i)) throw new a("Invalid JWT Claims Set");
  return i;
}
__name(V, "V");
function O(e2) {
  var r = new Error(e2);
  return r.source = "ulid", r;
}
__name(O, "O");
var X = "0123456789ABCDEFGHJKMNPQRSTVWXYZ", D = X.length, xe = Math.pow(2, 48) - 1, Ge = 10, Ue = 16;
function ze(e2) {
  var r = Math.floor(e2() * D);
  return r === D && (r = D - 1), X.charAt(r);
}
__name(ze, "ze");
function Ve(e2, r) {
  if (isNaN(e2)) throw new Error(e2 + " must be a number");
  if (e2 > xe) throw O("cannot encode time greater than " + xe);
  if (e2 < 0) throw O("time must be positive");
  if (Number.isInteger(e2) === !1) throw O("time must be an integer");
  for (var n2 = void 0, t2 = ""; r > 0; r--) n2 = e2 % D, t2 = X.charAt(n2) + t2, e2 = (e2 - n2) / D;
  return t2;
}
__name(Ve, "Ve");
function Xe(e2, r) {
  for (var n2 = ""; e2 > 0; e2--) n2 = ze(r) + n2;
  return n2;
}
__name(Xe, "Xe");
function Fe() {
  var e2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, r = arguments[1];
  r || (r = typeof window < "u" ? window : null);
  var n2 = r && (r.crypto || r.msCrypto);
  if (n2) return function() {
    var i = new Uint8Array(1);
    return n2.getRandomValues(i), i[0] / 255;
  };
  try {
    var t2 = Ee();
    return function() {
      return t2.randomBytes(1).readUInt8() / 255;
    };
  } catch {
  }
  if (e2) {
    try {
      console.error("secure crypto unusable, falling back to insecure Math.random()!");
    } catch {
    }
    return function() {
      return Math.random();
    };
  }
  throw O("secure crypto unusable, insecure Math.random not allowed");
}
__name(Fe, "Fe");
function Be(e2) {
  return e2 || (e2 = Fe()), function(n2) {
    return isNaN(n2) && (n2 = Date.now()), Ve(n2, Ge) + Xe(Ue, e2);
  };
}
__name(Be, "Be");
Be();
var Ze;
function Qe(e2) {
  return Ze == null ? void 0 : Ze.get(e2);
}
__name(Qe, "Qe");
var er;
function rr(e2) {
  return er == null ? void 0 : er.get(e2);
}
__name(rr, "rr");
var nr;
function tr(e2, r) {
  var _a8;
  return (_a8 = nr == null ? void 0 : nr.get(e2)) == null ? void 0 : _a8.get(r);
}
__name(tr, "tr");
function ir(e2) {
  var _a8, _b;
  let r = typeof e2;
  return r === "string" ? `"${e2}"` : r === "number" || r === "bigint" || r === "boolean" ? `${e2}` : r === "object" || r === "function" ? (e2 && ((_b = (_a8 = Object.getPrototypeOf(e2)) == null ? void 0 : _a8.constructor) == null ? void 0 : _b.name)) ?? "null" : r;
}
__name(ir, "ir");
function T(e2, r, n2, t2, i) {
  let s2 = i && "input" in i ? i.input : n2.value, u2 = (i == null ? void 0 : i.expected) ?? e2.expects ?? null, o2 = (i == null ? void 0 : i.received) ?? ir(s2), c2 = { kind: e2.kind, type: e2.type, input: s2, expected: u2, received: o2, message: `Invalid ${r}: ${u2 ? `Expected ${u2} but r` : "R"}eceived ${o2}`, requirement: e2.requirement, path: i == null ? void 0 : i.path, issues: i == null ? void 0 : i.issues, lang: t2.lang, abortEarly: t2.abortEarly, abortPipeEarly: t2.abortPipeEarly }, f = e2.kind === "schema", y = (i == null ? void 0 : i.message) ?? e2.message ?? tr(e2.reference, c2.lang) ?? (f ? rr(c2.lang) : null) ?? t2.message ?? Qe(c2.lang);
  y && (c2.message = typeof y == "function" ? y(c2) : y), f && (n2.typed = !1), n2.issues ? n2.issues.push(c2) : n2.issues = [c2];
}
__name(T, "T");
function F(e2) {
  return { kind: "transformation", type: "brand", reference: F, async: !1, name: e2, _run(r) {
    return r;
  } };
}
__name(F, "F");
function sr(e2, r, n2) {
  return typeof e2.default == "function" ? e2.default(r, n2) : e2.default;
}
__name(sr, "sr");
function B(e2) {
  return { kind: "schema", type: "number", reference: B, expects: "number", async: !1, message: e2, _run(r, n2) {
    return typeof r.value == "number" && !isNaN(r.value) ? r.typed = !0 : T(this, "type", r, n2), r;
  } };
}
__name(B, "B");
function Y(e2, ...r) {
  let n2 = { kind: "schema", type: "optional", reference: Y, expects: `${e2.expects} | undefined`, async: !1, wrapped: e2, _run(t2, i) {
    return t2.value === void 0 && ("default" in this && (t2.value = sr(this, t2, i)), t2.value === void 0) ? (t2.typed = !0, t2) : this.wrapped._run(t2, i);
  } };
  return 0 in r && (n2.default = r[0]), n2;
}
__name(Y, "Y");
function Z(e2, r) {
  return { kind: "schema", type: "strict_object", reference: Z, expects: "Object", async: !1, entries: e2, message: r, _run(n2, t2) {
    var _a8;
    let i = n2.value;
    if (i && typeof i == "object") {
      n2.typed = !0, n2.value = {};
      for (let s2 in this.entries) {
        let u2 = i[s2], o2 = this.entries[s2]._run({ typed: !1, value: u2 }, t2);
        if (o2.issues) {
          let c2 = { type: "object", origin: "value", input: i, key: s2, value: u2 };
          for (let f of o2.issues) f.path ? f.path.unshift(c2) : f.path = [c2], (_a8 = n2.issues) == null || _a8.push(f);
          if (n2.issues || (n2.issues = o2.issues), t2.abortEarly) {
            n2.typed = !1;
            break;
          }
        }
        o2.typed || (n2.typed = !1), (o2.value !== void 0 || s2 in i) && (n2.value[s2] = o2.value);
      }
      if (!n2.issues || !t2.abortEarly) {
        for (let s2 in i) if (!(s2 in this.entries)) {
          let u2 = i[s2];
          T(this, "type", n2, t2, { input: u2, expected: "never", path: [{ type: "object", origin: "value", input: i, key: s2, value: u2 }] });
          break;
        }
      }
    } else T(this, "type", n2, t2);
    return n2;
  } };
}
__name(Z, "Z");
function Q(e2) {
  return { kind: "schema", type: "string", reference: Q, expects: "string", async: !1, message: e2, _run(r, n2) {
    return typeof r.value == "string" ? r.typed = !0 : T(this, "type", r, n2), r;
  } };
}
__name(Q, "Q");
function ke(...e2) {
  return { ...e2[0], pipe: e2, _run(r, n2) {
    for (let t2 of e2) if (t2.kind !== "metadata") {
      if (r.issues && (t2.kind === "schema" || t2.kind === "transformation")) {
        r.typed = !1;
        break;
      }
      (!r.issues || !n2.abortEarly && !n2.abortPipeEarly) && (r = t2._run(r, n2));
    }
    return r;
  } };
}
__name(ke, "ke");
var or = ke(Q(), F("lid"));
Z({ id: or, ver: Y(B()) });
var cr = /* @__PURE__ */ __name((e2) => () => e2 * 48271 % 2147483647 / 2147483647, "cr"), lr = /* @__PURE__ */ __name((e2) => typeof Buffer < "u" ? Buffer.from(e2).toString("base64") : btoa(typeof e2 == "string" ? e2 : String.fromCharCode(...e2)), "lr"), fr = /* @__PURE__ */ __name((e2) => typeof Buffer < "u" ? Buffer.from(e2, "base64").toString() : atob(e2), "fr"), ar = /* @__PURE__ */ __name((e2, r) => {
  let n2 = cr(r), i = new TextEncoder().encode(e2).map((s2) => s2 ^ Math.floor(n2() * 256));
  return lr(i);
}, "ar"), pr = /* @__PURE__ */ __name((e2) => e2.split("").reverse().join(""), "pr"), yr = /* @__PURE__ */ __name((e2) => typeof e2 == "object" && !!e2 && "sub" in e2 && "exp" in e2 && typeof e2.sub == "string" && typeof e2.exp == "number", "yr"), hr = /* @__PURE__ */ __name(async (e2) => {
  let r = pr(fr(e2));
  return { decoded: V(r), jwt: r };
}, "hr"), mr = /* @__PURE__ */ __name(async (e2) => {
  let { decoded: r, jwt: n2 } = await hr(e2);
  if (!yr(r)) throw new Error("Invalid license key");
  let { sub: t2, exp: i } = r, s2 = new TextEncoder().encode(ar(t2, i));
  return await z$1(n2, s2), r;
}, "mr");
function ReExtTrial({
  r,
  v,
  t: t2,
  trialdialog,
  type,
  daysleft,
  setTrialDialog,
  setType,
  setDaysLeft
}) {
  if (window.dl = 5, useEffect(() => {
    r !== void 0 && r.toLowerCase().includes("ehsug") ? setType("production") : setType(t2);
  }, []), useEffect(() => {
    const getReExtKeyInfo = /* @__PURE__ */ __name(async (reextkey) => {
      if (reextkey === void 0)
        return { type: "nokey", daysleft: 0 };
      try {
        const payload = await mr(reextkey), differenceInMilliseconds = new Date(payload.exp * 1e3) - /* @__PURE__ */ new Date(), differenceInDays = Math.floor(differenceInMilliseconds / (1e3 * 60 * 60 * 24));
        return differenceInDays > 0 ? { type: "trial", daysleft: differenceInDays } : { type: "expired", daysleft: 0 };
      } catch (e2) {
        return e2.message.includes("claim timestamp check failed") ? { type: "expired", daysleft: 0 } : { type: "invalidkey", daysleft: 0 };
      }
    }, "getReExtKeyInfo");
    type !== null && type !== "production" && (/* @__PURE__ */ __name(async () => {
      var result = await getReExtKeyInfo(r);
      switch (setType(result.type), setDaysLeft(result.daysleft), result.type) {
        case "production":
        case "trial":
          setTrialDialog(!1);
          break;
        case "nokey":
        case "expired":
        case "invalidkey":
        default:
          setTrialDialog(!0);
          break;
      }
    }, "doAsync"))();
  }, [type]), type !== "production" && trialdialog === !0)
    return /* @__PURE__ */ jsx("div", { style: {
      zIndex: 2e5,
      fontSize: "22px",
      background: "rgb(211,211,211,.4)",
      color: "black",
      display: "flex",
      flexDirection: "column",
      position: "absolute",
      left: "50%",
      width: "100%",
      height: "100%",
      transform: "translateX(-50%)",
      padding: "10px 10px 10px 10px",
      border: "1px solid black"
    }, children: /* @__PURE__ */ jsxs("div", { style: {
      height: "100%",
      display: "flex",
      padding: "10px 10px 10px 10px",
      flexDirection: "column",
      margin: "40px",
      borderRadius: "5px",
      border: "1px solid gray",
      background: "white"
    }, children: [
      /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "row", alignItems: "center" }, children: [
        /* @__PURE__ */ jsx("img", { style: { width: 160 }, src: "../ReExt/ReExt.png" }),
        /* @__PURE__ */ jsxs("div", { style: { margin: "0 0 0 20px" }, children: [
          "Welcome to the ReExt v",
          v,
          " Trial"
        ] })
      ] }),
      type === "trial" || type === "nokey" && /* @__PURE__ */ jsxs(Fragment, { children: [
        /* @__PURE__ */ jsxs("div", { style: { margin: "10px 0 10px 0", fontSize: "18px" }, children: [
          "This is a 30 day trial version of ReExt.",
          /* @__PURE__ */ jsx("br", {}),
          "Without a valid trial key, this dialog will appear.",
          /* @__PURE__ */ jsx("br", {}),
          /* @__PURE__ */ jsx("br", {}),
          "To have a trial key emailed to you, fill in this form and click 'Get Trial Key'."
        ] }),
        /* @__PURE__ */ jsx("div", { style: { xwidth: "100%", flex: 1, display: "flex", border: "0px solid red" }, children: /* @__PURE__ */ jsx("iframe", { style: { width: "100%", margin: "0 0 10px 0", flex: 1, border: "0px solid lightgray" }, src: "https://www.sencha.com/forms/reext/trial-reext.php" }) }),
        /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "row", justifyContent: "space-between", alignItems: "flex-end" }, children: [
          /* @__PURE__ */ jsx("div", { style: { fontSize: "12px" }, children: type }),
          /* @__PURE__ */ jsx(
            "button",
            {
              style: { fontSize: "18px", padding: "5px 5px 5px 5px" },
              onClick: /* @__PURE__ */ __name(() => {
                setTrialDialog(!1);
              }, "onClick"),
              children: "Close"
            }
          )
        ] })
      ] }),
      type === "expired" && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", justifyContent: "center", alignItems: "center", margin: "10px 0 10px 0", fontSize: "18px", height: "100%" }, children: [
        /* @__PURE__ */ jsx("div", { style: { margin: "0 0 20px 0", fontSize: "24px" }, children: "Your ReExt trial key has expired" }),
        /* @__PURE__ */ jsx("div", { children: "Contact Sencha Sales" }),
        /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("a", { href: "https://www.sencha.com/company/contact/", target: "_blank", rel: "noopener noreferrer", children: "https://www.sencha.com/company/contact/" }) })
      ] }) }),
      type === "invalidkey" && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", justifyContent: "center", alignItems: "center", margin: "10px 0 10px 0", fontSize: "18px", height: "100%" }, children: [
        /* @__PURE__ */ jsx("div", { style: { margin: "0 0 20px 0", fontSize: "24px" }, children: "Your ReExt trial key is invalid" }),
        /* @__PURE__ */ jsx("div", { children: "Contact Sencha Sales" }),
        /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("a", { href: "https://www.sencha.com/company/contact/", target: "_blank", rel: "noopener noreferrer", children: "https://www.sencha.com/company/contact/" }) })
      ] }) })
    ] }) });
}
__name(ReExtTrial, "ReExtTrial");
async function z(t2) {
  try {
    let P2 = /* @__PURE__ */ __name(async (e2, x2, d2) => new Promise((v) => {
      window.Ext.onReady(function() {
        return window.Ext.ReExtLocation = d2, window.Ext.ReExtTheme = e2, window.Ext.ReExtLi = !0, v(1);
      });
    }), "P"), w2 = /* @__PURE__ */ __name(async (e2) => typeof window === void 0 || typeof window > "u" ? void 0 : new Promise((d2, j2) => {
      let v = document.getElementsByTagName("HEAD")[0];
      var E2 = !1;
      for (let y = 0; y < v.childNodes.length; y++) v.childNodes[y].src === e2 && (E2 = !0);
      if (E2 === !1) {
        let y = document.createElement("script");
        y.src = e2, v.appendChild(y), y.addEventListener("load", () => {
          if (window.Ext === void 0) return d2(1);
          window.Ext.onReady(function() {
            return d2(1);
          });
        }), y.addEventListener("error", () => {
          var f = `${e2} (js)

 - did you download the SDK from the support portal?
 - are you trying to download a file without an enterprise license?
 - do you have debug: true for ReExtData in a production build?`;
          console.error(f), j2(f);
        });
      }
    }), "w"), r = /* @__PURE__ */ __name(async (e2) => typeof window === void 0 || typeof window > "u" ? void 0 : new Promise((d2, j2) => {
      let v = document.getElementsByTagName("HEAD")[0];
      var E2 = !1;
      for (let f = 0; f < v.childNodes.length; f++) {
        let K2 = v.childNodes[f];
        var y = window.location.origin + "/" + e2;
        K2.href === e2 && (E2 = !0);
      }
      if (E2 === !1) {
        let f = document.createElement("link");
        f.rel = "stylesheet", f.type = "text/css", f.href = e2, v.appendChild(f), f.addEventListener("load", () => {
          if (window.Ext === void 0) return c, d2(1);
          window.Ext.onReady(function() {
            return d2(1);
          });
        }), f.addEventListener("error", () => {
          var K2 = `${e2} (css)

                - did you download the SDK from the support portal?
                - are you trying to download a file without an enterprise license?`;
          return console.error(K2), j2(K2);
        });
      }
    }), "r");
    var a2 = t2.toolkit;
    (a2 == null || a2 === "") && (a2 = "modern");
    var s2 = t2.theme;
    (s2 == null || s2 === "") && (s2 = "material");
    var l2 = t2.packages;
    l2 === void 0 && (l2 = { charts: !1, fontawesome: !1, ux: !1, calendar: !1, d3: !1, exporter: !1, pivot: !1, pivotd3: !1, pivotlocale: !1, froalaeditor: !1 });
    var i = t2.debug, T2 = t2.license, m2 = t2.urlbase, S2 = t2.location;
    (S2 === "remote" || S2 === null) && (m2 = "https://cdn.sencha.com/reext/ext/");
    var N2 = t2.rtl;
    N2 === !1 || N2 === void 0 ? N2 = "" : N2 = "-rtl";
    var C2 = t2.locale;
    C2 === void 0 && (C2 = "en");
    var u2 = t2.sdkversion;
    switch (u2) {
      case "7.0.0":
        u2 = u2 + ".156";
        break;
      case "7.1.0":
        u2 = u2 + ".46";
        break;
      case "7.2.0":
      case "7.3.0":
      case "7.3.1":
      case "7.4.0":
      case "7.5.0":
      case "7.5.1":
      case "7.6.0":
      case "7.7.0":
      case "7.8.0":
        break;
      default:
        throw `SDK version ${u2} is not valid`;
    }
    var A2 = m2 + "ext-" + u2, n2 = m2 + "ext-addons-" + u2;
    i === !0 ? i = "-debug" : i = "";
    var B2 = "";
    a2 === "modern" && (B2 = "-modern");
    var F2 = ["ios", "material", "neptune", "triton"];
    if (a2 === "modern" && !F2.includes(s2)) throw `${s2} theme is not in ${a2} toolkit for SDK version ${u2}`;
    var I2 = ["classic", "crisp", "graphite", "gray", "material", "neptune", "triton"];
    a2 === "classic" && !I2.includes(s2) && console.warn(`${s2} is a custom theme in ${a2} toolkit for SDK version ${u2}`);
    var H2 = !1;
    (l2.calendar === !0 || l2.d3 === !0 || l2.exporter === !0 || l2.pivot === !0 || l2.pivotd3 === !0 || l2.pivotlocale === !0 || l2.froalaeditor === !0) && (H2 = !0);
    var o2 = A2 + "/build";
    if (u2.slice(-1) === "c") {
      await w2(`${o2}/ext-${u2}-toolkit-${a2}-sdk.js`), await r(`${o2}/ext-${u2}-theme-${s2}-sdk.css`), H2 === !0 && (await w2(`${A2}/ext-${u2}-toolkit-${a2}-addons.js`), await r(`${A2}/ext-${u2}-theme-${s2}-addons.css`)), await P2(s2, T2, S2);
      return;
    }
    var q2 = await w2(`${o2}/ext${B2}-all${N2}${i}.js`);
    if (await r(`${o2}/${a2}/theme-${s2}/resources/theme-${s2}-all${N2}.css`), l2.fontawesome === !0 && await r(`${o2}/packages/font-awesome/resources/font-awesome-all${i}.css`), await w2(`${o2}/${a2}/locale/locale-${C2}${i}.js`), l2.ux === !0 && (await w2(`${o2}/packages/ux/${a2}/ux${i}.js`), u2 === "7.0.0" && a2 === "modern" && s2 === "neptune" && await r(`${o2}/packages/ux/${a2}/${a2}-${s2}/resources/ux-all${i}.css`), u2 === "7.0.0" && a2 === "classic" && await r(`${o2}/packages/ux/${a2}/${s2}/resources/ux-all${i}.css`), u2 !== "7.0.0" && a2 === "classic" && s2 === "material" && await r(`${o2}/packages/ux/${a2}/${a2}-${s2}/resources/ux-all${i}.css`), u2 !== "7.0.0" && a2 === "classic" && s2 !== "material" && s2 !== "gray" && await r(`${o2}/packages/ux/${a2}/${s2}/resources/ux-all${i}.css`)), l2.charts === !0) {
      await w2(`${o2}/packages/charts/${a2}/charts${i}.js`);
      var O2 = !0;
      (a2 === "modern" && s2 === "ios" && u2 === "7.0.0" || s2 === "gray") && (O2 = !1), O2 === !0 && (a2 === "classic" && s2 !== "material" ? await r(`${o2}/packages/charts/${a2}/${s2}/resources/charts-all${i}.css`) : await r(`${o2}/packages/charts/${a2}/${a2}-${s2}/resources/charts-all${i}.css`));
    }
    if (H2 === !0) {
      var $;
      n2 = n2 + "/packages", l2.calendar === !0 && ($ = "calendar", await w2(`${n2}/${$}/build/${a2}/${$}${i}.js`), a2 === "modern" && s2 === "ios" || u2 === "7.0.0.156" ? await r(`${n2}/${$}/build/${a2}/${s2}/resources/${$}-all${i}.css`) : s2 !== "gray" && s2 !== "graphite" && (a2 === "classic" && s2 !== "material" ? await r(`${n2}/${$}/build/${a2}/${s2}/resources/${$}-all${i}.css`) : await r(`${n2}/${$}/build/${a2}/${a2}-${s2}/resources/${$}-all${i}.css`))), l2.d3 === !0 && ($ = "d3", await w2(`${n2}/${$}/build/${a2}/${$}${i}.js`), a2 === "modern" && (s2 === "ios" || s2 === "material") ? await r(`${n2}/${$}/build/${a2}/${s2}/resources/${$}-all${i}.css`) : s2 !== "gray" && s2 !== "graphite" && (a2 === "classic" && s2 !== "material" ? await r(`${n2}/${$}/build/${a2}/${s2}/resources/${$}-all${i}.css`) : await r(`${n2}/${$}/build/${a2}/${a2}-${s2}/resources/${$}-all${i}.css`))), l2.exporter === !0 && ($ = "exporter", await w2(`${n2}/${$}/build/${a2}/${$}${i}.js`), await r(`${n2}/${$}/build/${a2}/resources/${$}-all${i}.css`)), l2.pivot === !0 && ($ = "pivot", await w2(`${n2}/${$}/build/${a2}/${$}${i}.js`), a2 === "modern" && (s2 === "ios" || s2 === "material") ? await r(`${n2}/${$}/build/${a2}/${s2}/resources/${$}-all${i}.css`) : s2 !== "gray" && s2 !== "graphite" && (a2 === "classic" && s2 !== "material" ? await r(`${n2}/${$}/build/${a2}/${s2}/resources/${$}-all${i}.css`) : await r(`${n2}/${$}/build/${a2}/${a2}-${s2}/resources/${$}-all${i}.css`))), l2.pivotd3 === !0 && ($ = "pivot-d3", await w2(`${n2}/${$}/build/${a2}/${$}${i}.js`), a2 === "modern" && (s2 === "ios" || s2 === "material") ? await r(`${n2}/${$}/build/${a2}/${s2}/resources/${$}-all${i}.css`) : s2 !== "gray" && s2 !== "graphite" && (a2 === "classic" && s2 !== "material" ? await r(`${n2}/${$}/build/${a2}/${s2}/resources/${$}-all${i}.css`) : await r(`${n2}/${$}/build/${a2}/${a2}-${s2}/resources/${$}-all${i}.css`))), l2.froalaeditor === !0 && ($ = "froala-editor", await w2(`${n2}/${$}/build/${a2}/${$}${i}.js`), await r(`${n2}/${$}/build/${a2}/${s2}/resources/${$}-all${i}.css`), await w2(`${n2}/${$}/development/froalaeditor.pkgd.js`), await r(`${n2}/${$}/development/froalaeditor.pkgd.css`)), l2.pivotlocale;
    }
    async function J2(e2) {
      var x2 = e2.location;
      if (x2 === "local") {
        var d2 = e2.overrides;
        if (d2 === void 0 && (d2 = !1), d2 !== !0 && (d2 = !1), d2 === !0) {
          var j2 = `${e2.urlbase}ext-${e2.sdkversion}/${a2}overrides.js`;
          async function E2(y) {
            try {
              let f = await fetch(y, { method: "HEAD" });
              return f.status === 404 ? (console.error("ReExtData.overrides is true but no overrides file exists"), !1) : f.status === 200;
            } catch {
              return !1;
            }
          }
          __name(E2, "E");
          var v = await E2(j2);
          v && await w2(j2);
        }
      }
    }
    if (__name(J2, "J"), await J2(t2), t2.debug === !0) try {
      await w2("node_modules/@sencha/reext/dist/ReExt/debug.js");
    } catch (e2) {
      console.warn("debug not loaded... " + e2.toString());
    }
    async function _2(e2, x2) {
      if (e2 !== void 0 && x2 !== void 0) for (let d2 of x2) {
        let j2 = `${window.location.origin}/${e2}/${d2}`;
        await w2(j2);
      }
    }
    __name(_2, "_"), await _2(t2.customfolder, t2.customfiles), await P2(s2, T2, S2);
  } catch {
    console.log("fail");
  }
}
__name(z, "z");
window.tt = "trial";
window.dl = 0;
function doReExt(xtype, props) {
  var newprops = { ...props };
  return props.config === void 0 && (newprops.config = {}), props.style === void 0 && (newprops.style = {}), Object.entries(newprops).forEach(([key, value]) => {
    switch (key) {
      case "rootClassName":
        newprops.className = value;
        break;
      case "rootStyle":
        newprops.style = value;
        break;
      case "region":
        delete newprops.region, newprops.childRegion = value;
        break;
      case "childFlex":
        newprops.flex = value, newprops.style.flex = value;
        break;
      case "flex":
        newprops.style.flex = value, newprops.childFlex = value;
        break;
      default:
        !/^on[A-Z]/.test(key) && key !== "region" && key !== "xtype" && key !== "ready" && key !== "config" && key !== "storeloaded" && (newprops.config[key] = value);
    }
  }), /* @__PURE__ */ jsx(ReExt, { xtype, ...newprops, children: props.children });
}
__name(doReExt, "doReExt");
function ReExtBreadCrumb(props) {
  return doReExt("breadcrumb", props);
}
__name(ReExtBreadCrumb, "ReExtBreadCrumb");
function ReExtButton(props) {
  return useEffect(() => {
  }, [props]), doReExt("button", props);
}
__name(ReExtButton, "ReExtButton");
function ReExtCycleButton(props) {
  return doReExt("cycle", props);
}
__name(ReExtCycleButton, "ReExtCycleButton");
function ReExtSegmentedButton(props) {
  return doReExt("segmentedbutton", props);
}
__name(ReExtSegmentedButton, "ReExtSegmentedButton");
function ReExtSplitButton(props) {
  return doReExt("splitbutton", props);
}
__name(ReExtSplitButton, "ReExtSplitButton");
function ReExtFileButton(props) {
  return doReExt("filebutton", props);
}
__name(ReExtFileButton, "ReExtFileButton");
function ReExtColorButton(props) {
  return doReExt("colorbutton", props);
}
__name(ReExtColorButton, "ReExtColorButton");
function ReExtCalendar(props) {
  return doReExt("calendar", props);
}
__name(ReExtCalendar, "ReExtCalendar");
function ReExtCalendarPicker(props) {
  return doReExt("calendar-calendar-picker", props);
}
__name(ReExtCalendarPicker, "ReExtCalendarPicker");
function ReExtCalendarDay(props) {
  return doReExt("calendar-day", props);
}
__name(ReExtCalendarDay, "ReExtCalendarDay");
function ReExtCalendarDays(props) {
  return doReExt("calendar-days", props);
}
__name(ReExtCalendarDays, "ReExtCalendarDays");
function ReExtCalendarMonth(props) {
  return doReExt("calendar-month", props);
}
__name(ReExtCalendarMonth, "ReExtCalendarMonth");
function ReExtCalendarWeek(props) {
  return doReExt("calendar-week", props);
}
__name(ReExtCalendarWeek, "ReExtCalendarWeek");
function ReExtCalendarWeeks(props) {
  return doReExt("calendar-weeks", props);
}
__name(ReExtCalendarWeeks, "ReExtCalendarWeeks");
function ReExtChart(props) {
  return doReExt("chart", props);
}
__name(ReExtChart, "ReExtChart");
function ReExtCheckboxField(props) {
  return doReExt("checkboxfield", props);
}
__name(ReExtCheckboxField, "ReExtCheckboxField");
function ReExtColorField(props) {
  return doReExt("colorfield", props);
}
__name(ReExtColorField, "ReExtColorField");
function ReExtColorPicker(props) {
  return doReExt("colorpicker", props);
}
__name(ReExtColorPicker, "ReExtColorPicker");
function ReExtComboboxField(props) {
  return doReExt("comboboxfield", props);
}
__name(ReExtComboboxField, "ReExtComboboxField");
function ReExtContainer(props) {
  return doReExt("container", props);
}
__name(ReExtContainer, "ReExtContainer");
function ReExtD3HeatMap(props) {
  return doReExt("d3-heatmap", props);
}
__name(ReExtD3HeatMap, "ReExtD3HeatMap");
function ReExtD3HorizontalTree(props) {
  return doReExt("d3-horizontal-tree", props);
}
__name(ReExtD3HorizontalTree, "ReExtD3HorizontalTree");
function ReExtD3Pack(props) {
  return doReExt("d3-pack", props);
}
__name(ReExtD3Pack, "ReExtD3Pack");
function ReExtD3Sunburst(props) {
  return doReExt("d3-sunburst", props);
}
__name(ReExtD3Sunburst, "ReExtD3Sunburst");
function ReExtD3Tree(props) {
  return doReExt("d3-tree", props);
}
__name(ReExtD3Tree, "ReExtD3Tree");
function ReExtDateField(props) {
  return doReExt("datefield", props);
}
__name(ReExtDateField, "ReExtDateField");
function ReExtDatePicker(props) {
  return doReExt("datepicker", props);
}
__name(ReExtDatePicker, "ReExtDatePicker");
function ReExtDisplayField(props) {
  return doReExt("displayfield", props);
}
__name(ReExtDisplayField, "ReExtDisplayField");
function ReExtFileField(props) {
  return doReExt("filefield", props);
}
__name(ReExtFileField, "ReExtFileField");
function ReExtFroalaEditorField(props) {
  return doReExt("froalaeditorfield", props);
}
__name(ReExtFroalaEditorField, "ReExtFroalaEditorField");
function ReExtGrid(props) {
  return doReExt("grid", props);
}
__name(ReExtGrid, "ReExtGrid");
function ReExtGuage(props) {
  return doReExt("guage", props);
}
__name(ReExtGuage, "ReExtGuage");
function ReExtHtmlEditor(props) {
  return doReExt("htmleditor", props);
}
__name(ReExtHtmlEditor, "ReExtHtmlEditor");
function ReExtImage(props) {
  return doReExt("image", props);
}
__name(ReExtImage, "ReExtImage");
function ReExtLabel(props) {
  return doReExt("label", props);
}
__name(ReExtLabel, "ReExtLabel");
function ReExtMonthPicker(props) {
  return doReExt("monthpicker", props);
}
__name(ReExtMonthPicker, "ReExtMonthPicker");
function ReExtMultiSelectField(props) {
  return doReExt("multiselectfield", props);
}
__name(ReExtMultiSelectField, "ReExtMultiSelectField");
function ReExtNumberField(props) {
  return doReExt("numberfield", props);
}
__name(ReExtNumberField, "ReExtNumberField");
function ReExtPanel(props) {
  return doReExt("panel", props);
}
__name(ReExtPanel, "ReExtPanel");
function ReExtPickerField(props) {
  return doReExt("pickerfield", props);
}
__name(ReExtPickerField, "ReExtPickerField");
function ReExtPivotGrid(props) {
  return doReExt("pivotgrid", props);
}
__name(ReExtPivotGrid, "ReExtPivotGrid");
function ReExtPivotTreeMap(props) {
  return doReExt("pivottreemap", props);
}
__name(ReExtPivotTreeMap, "ReExtPivotTreeMap");
function ReExtPivotheatmap(props) {
  return doReExt("pivotheatmap", props);
}
__name(ReExtPivotheatmap, "ReExtPivotheatmap");
function ReExtRadioField(props) {
  return doReExt("radiofield", props);
}
__name(ReExtRadioField, "ReExtRadioField");
function ReExtRating(props) {
  return doReExt("rating", props);
}
__name(ReExtRating, "ReExtRating");
function ReExtSearchField(props) {
  return doReExt("searchfield", props);
}
__name(ReExtSearchField, "ReExtSearchField");
function ReExtSliderField(props) {
  return doReExt("sliderfield", props);
}
__name(ReExtSliderField, "ReExtSliderField");
function ReExtTagField(props) {
  return doReExt("tagfield", props);
}
__name(ReExtTagField, "ReExtTagField");
function ReExtTextAreaField(props) {
  return doReExt("textareafield", props);
}
__name(ReExtTextAreaField, "ReExtTextAreaField");
function ReExtTextField(props) {
  return doReExt("textfield", props);
}
__name(ReExtTextField, "ReExtTextField");
function ReExtTimeField(props) {
  return doReExt("timefield", props);
}
__name(ReExtTimeField, "ReExtTimeField");
function ReExtTimePicker(props) {
  return doReExt("timepicker", props);
}
__name(ReExtTimePicker, "ReExtTimePicker");
function ReExtTreelist(props) {
  return doReExt("treelist", props);
}
__name(ReExtTreelist, "ReExtTreelist");
function ReExtTreePicker(props) {
  return doReExt("treepicker", props);
}
__name(ReExtTreePicker, "ReExtTreePicker");
function ReExtTriggerField(props) {
  return doReExt("triggerfield", props);
}
__name(ReExtTriggerField, "ReExtTriggerField");
function ReExtProvider({ children, ReExtData, reextkey, splash }) {
  if (typeof window === void 0 || typeof window > "u")
    return;
  const [ready, setReady] = useState(!1), [trialdialog, setTrialDialog] = useState(null), [type, setType] = useState(null), [daysleft, setDaysLeft] = useState(null), [reextplugin, setReExtPlugin] = useState(!1);
  useEffect(() => {
    window.location.host === "reextdemo.vercel.app" && (setType("production"), window.tt = "production");
    try {
      var r = __IS_REEXT_RUNNING__;
      setReExtPlugin(!0);
    } catch {
      console.error("Vite or Next.js plugin not installed"), setReExtPlugin(!1);
    }
  }, []);
  try {
    if (useEffect(() => {
      (/* @__PURE__ */ __name(async () => {
        var ReExtDataDefault = {
          sdkversion: "7.8.0",
          toolkit: "classic",
          theme: "classic",
          packages: { charts: !1, fontawesome: !1, ux: !1, calendar: !1, d3: !1, exporter: !1, pivot: !1, pivotd3: !1, pivotlocale: !1, froalaeditor: !1 },
          rtl: !1,
          locale: "en",
          debug: !1,
          urlbase: "./",
          location: "remote",
          overrides: !1
        };
        ReExtData === void 0 && (ReExtData = ReExtDataDefault);
        try {
          await z(ReExtData), setReady(!0);
        } catch (e2) {
          console.error("fail", e2);
        }
      }, "doAsync"))();
    }, []), !ready)
      return splash === !0 || splash === "true" ? /* @__PURE__ */ jsx(ReExtSplash, {}) : null;
    if (ready)
      return console.log("type", type), /* @__PURE__ */ jsxs(Fragment, { children: [
        type !== "production" && /* @__PURE__ */ jsx(
          ReExtTrial,
          {
            r: reextkey,
            v: version,
            t: type,
            trialdialog,
            type,
            daysleft,
            setTrialDialog,
            setType,
            setDaysLeft
          }
        ),
        reextplugin === !1 && /* @__PURE__ */ jsxs(
          "div",
          {
            style: {
              border: "10px solid red",
              boxSizing: "border-box",
              display: "flex",
              flexDirection: "column",
              alignItems: "center",
              justifyContent: "center",
              height: "100vh",
              width: "100vw",
              fontSize: 24,
              color: "red"
            },
            children: [
              /* @__PURE__ */ jsx("div", { style: { margin: "0 0 10px 0" }, children: "The Vite or Next.js ReExt plugin is needed to run this app" }),
              /* @__PURE__ */ jsx("div", { children: "for Vite, modify vite.config.js like this" }),
              /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: {
                __html: `
<pre>
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';
import reext from './node_modules/@sencha/reext/dist/ReExt/vite-plugin-reext.js';
export default defineConfig({
  plugins: [
    react(), 
    reext()
  ]
})
</pre>`
              } }),
              /* @__PURE__ */ jsx("div", { children: "for Next.js, modify next.config.mjs like this" }),
              /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: {
                __html: `
<pre>
/** @type {import('next').NextConfig} */
import withReExtPlugin from './node_modules/@sencha/reext/dist/ReExt/next-plugin-reext.js';
const nextConfig = {};
export default withReExtPlugin(nextConfig);
</pre>`
              } })
            ]
          }
        ),
        reextplugin === !0 && children
      ] });
  } catch (e2) {
    return /* @__PURE__ */ jsx("div", { children: e2.toString() });
  }
}
__name(ReExtProvider, "ReExtProvider");
const useReExtState = /* @__PURE__ */ __name((init) => {
  if (typeof window === void 0 || typeof window > "u")
    return;
  const [s2, setS] = useState(init);
  var sRef = useRef();
  return sRef.current = s2, [/* @__PURE__ */ __name(() => sRef.current, "getS"), setS];
}, "useReExtState");
function ReExtReferences(obj) {
  if (!(typeof window === void 0 || typeof window > "u")) {
    for (var refs, c2 = obj.getController(), parent = obj; c2 === void 0; )
      c2 = obj.parent.getController(), parent = obj.parent;
    if (refs = c2.getReferences(), refs === null && (refs = {}), parent.ReExtChildren !== void 0)
      for (var i = 0; i < parent.ReExtChildren.length; i++)
        parent.ReExtChildren[i].reference !== null && (refs[parent.ReExtChildren[i].reference] = parent.ReExtChildren[i]);
    return refs;
  }
}
__name(ReExtReferences, "ReExtReferences");
export {
  e as Fill,
  ReExtBreadCrumb,
  ReExtButton,
  ReExtCalendar,
  ReExtCalendarDay,
  ReExtCalendarDays,
  ReExtCalendarMonth,
  ReExtCalendarPicker,
  ReExtCalendarWeek,
  ReExtCalendarWeeks,
  ReExtChart,
  ReExtCheckboxField,
  ReExtColorButton,
  ReExtColorField,
  ReExtColorPicker,
  ReExtComboboxField,
  ReExtContainer,
  ReExtCycleButton,
  ReExtD3HeatMap,
  ReExtD3HorizontalTree,
  ReExtD3Pack,
  ReExtD3Sunburst,
  ReExtD3Tree,
  ReExtDateField,
  ReExtDatePicker,
  ReExtDisplayField,
  ReExtFileButton,
  ReExtFileField,
  ReExtFroalaEditorField,
  ReExtGrid,
  ReExtGuage,
  ReExtHtmlEditor,
  ReExtImage,
  ReExtLabel,
  ReExtMonthPicker,
  ReExtMultiSelectField,
  ReExtNumberField,
  ReExtPanel,
  ReExtPickerField,
  ReExtPivotGrid,
  ReExtPivotTreeMap,
  ReExtPivotheatmap,
  ReExtProvider,
  ReExtRadioField,
  ReExtRating,
  ReExtReferences,
  ReExtSearchField,
  ReExtSegmentedButton,
  ReExtSliderField,
  ReExtSplitButton,
  ReExtTagField,
  ReExtTextAreaField,
  ReExtTextField,
  ReExtTimeField,
  ReExtTimePicker,
  ReExtTreePicker,
  ReExtTreelist,
  ReExtTriggerField,
  ReExt as default,
  useReExtState
};
