import { defineStore as r } from "pinia";
import { aa as a, ab as s, ac as l } from "./index.vue_vue_type_script_setup_true_lang-BMVa5UfU.js";
const u = {
  async read() {
    return a(await s().get("/public-setting"));
  },
  async update(e) {
    return a(await s().put("/public-setting", e));
  }
};
function c() {
  return {
    loadingQueue: [],
    publicSetting: {
      delivery: {
        feedMe: {
          areas: [],
          enable: !1,
          maxDistance: 0
        }
      },
      sms: {
        firebase: !1
      },
      assets: {
        groups: []
      },
      aiSettings: {
        remy: { enable: !1 }
      }
    }
  };
}
const d = r("menu-app", {
  state: () => c(),
  actions: {
    addLoadingQueues(e) {
      this.loadingQueue = [...this.loadingQueue, ...e];
    },
    clearLoadingQueue() {
      this.loadingQueue = [];
    },
    resolveQueues(e) {
      this.loadingQueue = this.loadingQueue.filter((t) => !e.includes(t.id));
    },
    async promise(e, t = !0) {
      const i = l();
      try {
        const n = [{ id: i, isGlobal: t }];
        return this.addLoadingQueues(n), await e();
      } finally {
        this.resolveQueues([i]);
      }
    },
    async getPublicSetting() {
      return this.publicSetting = await u.read(), this.publicSetting;
    },
    async updatePublicSetting(e) {
      return this.publicSetting = await u.update({
        ...this.publicSetting,
        ...e
      }), this.publicSetting;
    }
  }
});
export {
  d as u
};
