var k = {}, w;
function v() {
  return w || (w = 1, (function(h) {
    (function() {
      var s = {
        not_type: /[^T]/,
        not_primitive: /[^v]/,
        number: /[diefg]/,
        numeric_arg: /[bcdiefguxX]/,
        json: /[j]/,
        text: /^[^\x25]+/,
        modulo: /^\x25{2}/,
        placeholder: /^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,
        key: /^([a-z_][a-z_\d]*)/i,
        key_access: /^\.([a-z_][a-z_\d]*)/i,
        index_access: /^\[(\d+)\]/,
        sign: /^[+-]/
      };
      function u(n) {
        return m(_(n), arguments);
      }
      function x(n, o) {
        return u.apply(null, [n].concat(o || []));
      }
      function m(n, o) {
        var t = 1, c = n.length, e, p = "", a, i, r, f, g, y, b, l;
        for (a = 0; a < c; a++) if (typeof n[a] == "string") p += n[a];
        else if (typeof n[a] == "object") {
          if (r = n[a], r.keys) for (e = o[t], i = 0; i < r.keys.length; i++) {
            if (e == null) throw new Error(u('[sprintf] Cannot access property "%s" of undefined value "%s"', r.keys[i], r.keys[i - 1]));
            e = e[r.keys[i]];
          }
          else r.param_no ? e = o[r.param_no] : e = o[t++];
          if (s.not_type.test(r.type) && s.not_primitive.test(r.type) && e instanceof Function && (e = e()), s.numeric_arg.test(r.type) && typeof e != "number" && isNaN(e)) throw new TypeError(u("[sprintf] expecting number but found %T", e));
          switch (s.number.test(r.type) && (b = e >= 0), r.type) {
            case "b":
              e = parseInt(e, 10).toString(2);
              break;
            case "c":
              e = String.fromCharCode(parseInt(e, 10));
              break;
            case "d":
            case "i":
              e = parseInt(e, 10);
              break;
            case "j":
              e = JSON.stringify(e, null, r.width ? parseInt(r.width) : 0);
              break;
            case "e":
              e = r.precision ? parseFloat(e).toExponential(r.precision) : parseFloat(e).toExponential();
              break;
            case "f":
              e = r.precision ? parseFloat(e).toFixed(r.precision) : parseFloat(e);
              break;
            case "g":
              e = r.precision ? String(Number(e.toPrecision(r.precision))) : parseFloat(e);
              break;
            case "o":
              e = (parseInt(e, 10) >>> 0).toString(8);
              break;
            case "s":
              e = String(e), e = r.precision ? e.substring(0, r.precision) : e;
              break;
            case "t":
              e = String(!!e), e = r.precision ? e.substring(0, r.precision) : e;
              break;
            case "T":
              e = Object.prototype.toString.call(e).slice(8, -1).toLowerCase(), e = r.precision ? e.substring(0, r.precision) : e;
              break;
            case "u":
              e = parseInt(e, 10) >>> 0;
              break;
            case "v":
              e = e.valueOf(), e = r.precision ? e.substring(0, r.precision) : e;
              break;
            case "x":
              e = (parseInt(e, 10) >>> 0).toString(16);
              break;
            case "X":
              e = (parseInt(e, 10) >>> 0).toString(16).toUpperCase();
              break;
          }
          s.json.test(r.type) ? p += e : (s.number.test(r.type) && (!b || r.sign) ? (l = b ? "+" : "-", e = e.toString().replace(s.sign, "")) : l = "", g = r.pad_char ? r.pad_char === "0" ? "0" : r.pad_char.charAt(1) : " ", y = r.width - (l + e).length, f = r.width && y > 0 ? g.repeat(y) : "", p += r.align ? l + e + f : g === "0" ? l + f + e : f + l + e);
        }
        return p;
      }
      var d = /* @__PURE__ */ Object.create(null);
      function _(n) {
        if (d[n]) return d[n];
        for (var o = n, t, c = [], e = 0; o; ) {
          if ((t = s.text.exec(o)) !== null) c.push(t[0]);
          else if ((t = s.modulo.exec(o)) !== null) c.push("%");
          else if ((t = s.placeholder.exec(o)) !== null) {
            if (t[2]) {
              e |= 1;
              var p = [], a = t[2], i = [];
              if ((i = s.key.exec(a)) !== null)
                for (p.push(i[1]); (a = a.substring(i[0].length)) !== ""; ) if ((i = s.key_access.exec(a)) !== null) p.push(i[1]);
                else if ((i = s.index_access.exec(a)) !== null) p.push(i[1]);
                else throw new SyntaxError("[sprintf] failed to parse named argument key");
              else throw new SyntaxError("[sprintf] failed to parse named argument key");
              t[2] = p;
            } else e |= 2;
            if (e === 3) throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");
            c.push({
              placeholder: t[0],
              param_no: t[1],
              keys: t[2],
              sign: t[3],
              pad_char: t[4],
              align: t[5],
              width: t[6],
              precision: t[7],
              type: t[8]
            });
          } else throw new SyntaxError("[sprintf] unexpected placeholder");
          o = o.substring(t[0].length);
        }
        return d[n] = c;
      }
      h.sprintf = u, h.vsprintf = x, typeof window < "u" && (window.sprintf = u, window.vsprintf = x);
    })();
  })(k)), k;
}
var S = v();
export {
  S as _
};
//# sourceMappingURL=sprintf-D5E86llw-yUkJWEcD.js.map
