{"version":3,"file":"tints.js","names":[],"sources":["esm/tints.js"],"sourcesContent":["import React from \"react\";\nconst listeners = /* @__PURE__ */ new Set();\nconst familiesValues = {\n  tamagui: [\"yellow\", \"yellow\", \"yellow\", \"gray\", \"red\", \"green\", \"blue\"],\n  xmas: [\"red\", \"green\", \"red\", \"green\", \"red\", \"green\", \"red\"],\n  easter: [\n    \"yellow\",\n    \"yellow\",\n    \"yellow\",\n    \"yellow\",\n    \"yellow\",\n    \"yellow\",\n    \"yellow\"\n  ],\n  halloween: [\n    \"yellow\",\n    \"gray\",\n    \"yellow\",\n    \"gray\",\n    \"yellow\",\n    \"gray\",\n    \"yellow\"\n  ],\n  valentine: [\"red\", \"red\", \"red\", \"red\", \"red\", \"red\", \"red\"],\n  lunar: [\"yellow\", \"red\", \"red\", \"red\", \"red\", \"red\", \"yellow\"],\n  stpatricks: [\n    \"green\",\n    \"yellow\",\n    \"green\",\n    \"yellow\",\n    \"green\",\n    \"yellow\",\n    \"green\"\n  ]\n};\nconst DEFAULT_FAMILY = \"tamagui\";\nconst familiesNames = Object.keys(familiesValues);\nconst families = familiesValues;\nlet fam = DEFAULT_FAMILY;\nfunction getTints() {\n  return {\n    name: fam || DEFAULT_FAMILY,\n    tints: families[fam] || families.tamagui,\n    families\n  };\n}\nfunction useTints() {\n  const [val, setVal] = React.useState(getTints());\n  React.useEffect(() => {\n    return onTintFamilyChange(() => {\n      React.startTransition(() => {\n        setVal(getTints());\n      });\n    });\n  }, []);\n  return val;\n}\nfunction setTintFamily(next) {\n  if (!families[next]) throw `impossible`;\n  fam = next;\n  if (typeof document !== \"undefined\") {\n    const root = document.documentElement.classList;\n    familiesNames.forEach((s) => {\n      if (s !== \"tamagui\") {\n        root.remove(`${s}-season`);\n      }\n    });\n    if (next !== \"tamagui\") {\n      root.add(`${next}-season`);\n    }\n  }\n  React.startTransition(() => {\n    listeners.forEach((l) => l(next));\n  });\n}\nconst setNextTintFamily = () => {\n  setTintFamily(familiesNames[(familiesNames.indexOf(fam) + 1) % familiesNames.length]);\n};\nconst onTintFamilyChange = (cb) => {\n  listeners.add(cb);\n  return () => {\n    listeners.delete(cb);\n  };\n};\nexport {\n  getTints,\n  onTintFamilyChange,\n  setNextTintFamily,\n  setTintFamily,\n  useTints\n};\n//# sourceMappingURL=tints.js.map\n"],"mappings":";;;AACA,MAAM,4BAA4B,IAAI,IAAI;AAC1C,MAAM,iBAAiB;CACrB,SAAS;EAAC;EAAU;EAAU;EAAU;EAAQ;EAAO;EAAS;CAAM;CACtE,MAAM;EAAC;EAAO;EAAS;EAAO;EAAS;EAAO;EAAS;CAAK;CAC5D,QAAQ;EACN;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,WAAW;EACT;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,WAAW;EAAC;EAAO;EAAO;EAAO;EAAO;EAAO;EAAO;CAAK;CAC3D,OAAO;EAAC;EAAU;EAAO;EAAO;EAAO;EAAO;EAAO;CAAQ;CAC7D,YAAY;EACV;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF;AACA,MAAM,iBAAiB;AACvB,MAAM,gBAAgB,OAAO,KAAK,cAAc;AAChD,MAAM,WAAW;AACjB,IAAI,MAAM;AACV,SAAS,WAAW;CAClB,OAAO;EACL,MAAM,OAAO;EACb,OAAO,SAAS,QAAQ,SAAS;EACjC;CACF;AACF;AACA,SAAS,WAAW;CAClB,MAAM,CAAC,KAAK,UAAU,MAAM,SAAS,SAAS,CAAC;CAC/C,MAAM,gBAAgB;EACpB,OAAO,yBAAyB;GAC9B,MAAM,sBAAsB;IAC1B,OAAO,SAAS,CAAC;GACnB,CAAC;EACH,CAAC;CACH,GAAG,CAAC,CAAC;CACL,OAAO;AACT;AACA,SAAS,cAAc,MAAM;CAC3B,IAAI,CAAC,SAAS,OAAO,MAAM;CAC3B,MAAM;CACN,IAAI,OAAO,aAAa,aAAa;EACnC,MAAM,OAAO,SAAS,gBAAgB;EACtC,cAAc,SAAS,MAAM;GAC3B,IA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