var _a, _b;
import { createStore } from "@stencil/store";
import env from "./helpers/env";
import getCache from "./helpers/getCache";
import getHandlebarsHelpers from "./helpers/getHandlebarsHelpers";
import setCache from "./helpers/setCache";
const { state, onChange } = createStore({
  darkMode: getCache("floodteam:darkMode", !!((_b = (_a = window === null || window === void 0 ? void 0 : window.matchMedia) === null || _a === void 0 ? void 0 : _a.call(window, "(prefers-color-scheme: dark)")) === null || _b === void 0 ? void 0 : _b.matches)),
  manifest: {},
  config: env(),
  version: "1.1.0",
  locations: getCache("floodteam:locations", []),
  profile: getCache("floodteam:profile", {}),
  session: null,
  services: getCache("floodteam:services", []),
  templates: getCache("floodteam:templates", []),
  isOnline: false,
  claims: {},
  myJobs: getCache("floodteam:templates", []),
  pins: getCache("floodteam:pins", []),
  feed: getCache("floodteam:feed", []),
  filters: getCache("floodteam:filters", {}),
  editorSizes: [50, 50],
  isPreviewing: false,
  showingNaviation: false,
  helpers: getHandlebarsHelpers(),
  roles: [
    "homeowner",
    "franchisee",
    "mitigation",
    "vision",
    "design",
    "tech",
    "finance",
    "operations",
    "success",
    "marketing",
    "agent",
    "adjuster",
    "referral",
    "vendor",
    "business",
  ],
});
onChange("darkMode", async (value) => {
  await setCache("floodteam:darkMode", value);
  if (value) {
    document.body.classList.remove("light");
    document.body.classList.add("dark");
  }
  else {
    document.body.classList.remove("dark");
    document.body.classList.add("light");
  }
});
onChange("editorSizes", async (value) => {
  await setCache("floodteam:editorSizes", value);
});
onChange("isPreviewing", async (value) => {
  await setCache("floodteam:isPreviewing", value);
});
onChange("feed", async (value) => {
  await setCache("floodteam:feed", value);
});
onChange("filters", async (value) => {
  console.log(value);
  await setCache("floodteam:filters", value);
});
onChange("pins", async (value) => {
  await setCache("floodteam:pins", value);
});
onChange("myJobs", async (value) => {
  await setCache("floodteam:myjobs", value);
});
onChange("claims", async (value) => {
  await setCache("floodteam:claims", value);
});
onChange("profile", async (value) => {
  await setCache("floodteam:profile", value);
});
onChange("services", async (value) => {
  await setCache("floodteam:services", value);
});
onChange("locations", async (value) => {
  await setCache("floodteam:locations", value);
});
onChange("templates", async (value) => {
  await setCache("floodteam:templates", value);
});
export default state;
//# sourceMappingURL=store.js.map