import { g as e, vn as t } from "./runtime-core.esm-bundler-Ci9kEgM7.js";
import { i as n, n as r } from "./log-4xrnzcdK.js";
import { t as i } from "./api-DL2Um68W.js";
import { t as a } from "./isArray-CI0_UXAa.js";
import { c as o, d as s, l as c, s as l } from "./_Uint8Array-B15EB2HR.js";
import { a as u, n as d, r as f } from "./isSymbol-B9ImcFp_.js";
import { n as p } from "./set-HZS68aKk.js";
import { a as ee, c as m, i as h, n as g, o as _, r as v, s as y, t as te } from "./_initCloneObject-CuPjIsdx.js";
import { a as b, c as x, i as S, n as C, o as w, r as ne, s as re, t as ie } from "./isEqual-B9AJyoCE.js";
import { t as ae } from "./virtualRef-zNuVbH78.js";
var T = n(`busy`, () => {
  let n2 = r(), i2 = t([]), a2 = e(() => i2.value.length > 0), o2 = e(() => (e2) => i2.value.some((t2) => t2.task === e2));
  function s2(e2, t2) {
    i2.value.unshift({ timestamp: Date.now(), task: e2 }), t2 != null && (typeof t2 == `string` ? n2.add({ message: t2, type: `info`, group: `busy` }) : typeof t2 == `object` && n2.add(Object.assign({ type: `info`, group: `busy` }, t2)));
  }
  function c2(e2) {
    let t2 = false;
    i2.value = i2.value.filter((n3) => t2 ? true : n3.task === e2 ? (t2 = true, false) : true);
  }
  function l2() {
    i2.value = [];
  }
  return { tasks: i2, isBusy: a2, hasTask: o2, add: s2, remove: c2, reset: l2 };
});
function oe(e2, t2) {
  for (var n2 = -1, r2 = e2 == null ? 0 : e2.length; ++n2 < r2 && t2(e2[n2], n2, e2) !== false; ) ;
  return e2;
}
function se(e2, t2) {
  return e2 && m(t2, x(t2), e2);
}
function ce(e2, t2) {
  return e2 && m(t2, y(t2), e2);
}
function le(e2, t2) {
  return m(e2, w(e2), t2);
}
var E = Object.getOwnPropertySymbols ? function(e2) {
  for (var t2 = []; e2; ) b(t2, w(e2)), e2 = h(e2);
  return t2;
} : re;
function D(e2, t2) {
  return m(e2, E(e2), t2);
}
function O(e2) {
  return S(e2, y, E);
}
var k = Object.prototype.hasOwnProperty;
function A(e2) {
  var t2 = e2.length, n2 = new e2.constructor(t2);
  return t2 && typeof e2[0] == `string` && k.call(e2, `index`) && (n2.index = e2.index, n2.input = e2.input), n2;
}
function j(e2, t2) {
  var n2 = t2 ? v(e2.buffer) : e2.buffer;
  return new e2.constructor(n2, e2.byteOffset, e2.byteLength);
}
var M = /\w*$/;
function N(e2) {
  var t2 = new e2.constructor(e2.source, M.exec(e2));
  return t2.lastIndex = e2.lastIndex, t2;
}
var P = u ? u.prototype : void 0, F = P ? P.valueOf : void 0;
function I(e2) {
  return F ? Object(F.call(e2)) : {};
}
var L = `[object Boolean]`, R = `[object Date]`, z = `[object Map]`, B = `[object Number]`, V = `[object RegExp]`, H = `[object Set]`, U = `[object String]`, W = `[object Symbol]`, ue = `[object ArrayBuffer]`, de = `[object DataView]`, fe = `[object Float32Array]`, pe = `[object Float64Array]`, me = `[object Int8Array]`, he = `[object Int16Array]`, ge = `[object Int32Array]`, _e = `[object Uint8Array]`, ve = `[object Uint8ClampedArray]`, ye = `[object Uint16Array]`, be = `[object Uint32Array]`;
function xe(e2, t2, n2) {
  var r2 = e2.constructor;
  switch (t2) {
    case ue:
      return v(e2);
    case L:
    case R:
      return new r2(+e2);
    case de:
      return j(e2, n2);
    case fe:
    case pe:
    case me:
    case he:
    case ge:
    case _e:
    case ve:
    case ye:
    case be:
      return g(e2, n2);
    case z:
      return new r2();
    case B:
    case U:
      return new r2(e2);
    case V:
      return N(e2);
    case H:
      return new r2();
    case W:
      return I(e2);
  }
}
var Se = `[object Map]`;
function Ce(e2) {
  return d(e2) && C(e2) == Se;
}
var G = l && l.isMap, we = G ? o(G) : Ce, Te = `[object Set]`;
function Ee(e2) {
  return d(e2) && C(e2) == Te;
}
var K = l && l.isSet, De = K ? o(K) : Ee, Oe = 1, ke = 2, Ae = 4, q = `[object Arguments]`, je = `[object Array]`, Me = `[object Boolean]`, Ne = `[object Date]`, Pe = `[object Error]`, J = `[object Function]`, Fe = `[object GeneratorFunction]`, Ie = `[object Map]`, Le = `[object Number]`, Y = `[object Object]`, Re = `[object RegExp]`, ze = `[object Set]`, Be = `[object String]`, Ve = `[object Symbol]`, He = `[object WeakMap]`, Ue = `[object ArrayBuffer]`, We = `[object DataView]`, X = `[object Float32Array]`, Ge = `[object Float64Array]`, Ke = `[object Int8Array]`, qe = `[object Int16Array]`, Je = `[object Int32Array]`, Ye = `[object Uint8Array]`, Xe = `[object Uint8ClampedArray]`, Ze = `[object Uint16Array]`, Qe = `[object Uint32Array]`, Z = {};
Z[q] = Z[je] = Z[Ue] = Z[We] = Z[Me] = Z[Ne] = Z[X] = Z[Ge] = Z[Ke] = Z[qe] = Z[Je] = Z[Ie] = Z[Le] = Z[Y] = Z[Re] = Z[ze] = Z[Be] = Z[Ve] = Z[Ye] = Z[Xe] = Z[Ze] = Z[Qe] = true, Z[Pe] = Z[J] = Z[He] = false;
function Q(e2, t2, n2, r2, i2, o2) {
  var l2, u2 = t2 & Oe, d2 = t2 & ke, m2 = t2 & Ae;
  if (n2 && (l2 = i2 ? n2(e2, r2, i2, o2) : n2(e2)), l2 !== void 0) return l2;
  if (!f(e2)) return e2;
  var h2 = a(e2);
  if (h2) {
    if (l2 = A(e2), !u2) return ee(e2, l2);
  } else {
    var g2 = C(e2), v2 = g2 == J || g2 == Fe;
    if (c(e2)) return _(e2, u2);
    if (g2 == Y || g2 == q || v2 && !i2) {
      if (l2 = d2 || v2 ? {} : te(e2), !u2) return d2 ? D(e2, ce(l2, e2)) : le(e2, se(l2, e2));
    } else {
      if (!Z[g2]) return i2 ? e2 : {};
      l2 = xe(e2, g2, u2);
    }
  }
  o2 || (o2 = new s());
  var b2 = o2.get(e2);
  if (b2) return b2;
  o2.set(e2, l2), De(e2) ? e2.forEach(function(r3) {
    l2.add(Q(r3, t2, n2, r3, e2, o2));
  }) : we(e2) && e2.forEach(function(r3, i3) {
    l2.set(i3, Q(r3, t2, n2, i3, e2, o2));
  });
  var S2 = h2 ? void 0 : (m2 ? d2 ? O : ne : d2 ? y : x)(e2);
  return oe(S2 || e2, function(r3, i3) {
    S2 && (i3 = r3, r3 = e2[i3]), p(l2, i3, Q(r3, t2, n2, i3, e2, o2));
  }), l2;
}
var $e = 1, et = 4;
function $(e2) {
  return Q(e2, $e | et);
}
var tt = n(`settings`, () => {
  let n2 = T(), r2 = i(), { state: a2, getVirtualRef: o2 } = ae({}), s2 = t({});
  async function c2() {
    return n2.add(`settings.doPull`), await r2.request(`/admin/settings/options/index`, { method: `GET` }).then((e2) => (a2.value = $(e2.data.options), s2.value = $(e2.data.options), { message: e2.data.message, success: true })).catch((e2) => {
    }).finally(() => {
      n2.remove(`settings.doPull`);
    });
  }
  async function l2() {
    return n2.add(`settings.doPush`), r2.request(`/admin/settings/options/store`, { method: `POST`, data: { options: a2.value } }).then((e2) => (s2.value = $(a2.value), { message: e2.data.message, success: true })).catch((e2) => {
      throw Error(e2.response ? e2.response.data.message : e2.message);
    }).finally(() => {
      n2.remove(`settings.doPush`);
    });
  }
  function u2() {
    Object.keys(a2.value).length === 0 && c2();
  }
  return { options: a2, virtualOptions: o2, doPull: c2, doPush: l2, initPull: u2, hasChanged: e(() => !ie(a2.value, s2.value)) };
});
export {
  $ as n,
  T as r,
  tt as t
};
