chunk.YXKHB4AC.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import {
  2. i,
  3. s,
  4. t
  5. } from "./chunk.VIWFLAGR.js";
  6. import {
  7. w
  8. } from "./chunk.5PIDMFOE.js";
  9. // node_modules/lit-html/directives/class-map.js
  10. var e = i(class extends s {
  11. constructor(t2) {
  12. var s2;
  13. if (super(t2), t2.type !== t.ATTRIBUTE || t2.name !== "class" || ((s2 = t2.strings) === null || s2 === void 0 ? void 0 : s2.length) > 2)
  14. throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
  15. }
  16. render(t2) {
  17. return Object.keys(t2).filter((s2) => t2[s2]).join(" ");
  18. }
  19. update(s2, [r]) {
  20. if (this.bt === void 0) {
  21. this.bt = new Set();
  22. for (const t2 in r)
  23. r[t2] && this.bt.add(t2);
  24. return this.render(r);
  25. }
  26. const i2 = s2.element.classList;
  27. this.bt.forEach((t2) => {
  28. t2 in r || (i2.remove(t2), this.bt.delete(t2));
  29. });
  30. for (const t2 in r) {
  31. const s3 = !!r[t2];
  32. s3 !== this.bt.has(t2) && (s3 ? (i2.add(t2), this.bt.add(t2)) : (i2.remove(t2), this.bt.delete(t2)));
  33. }
  34. return w;
  35. }
  36. });
  37. export {
  38. e
  39. };
  40. /**
  41. * @license
  42. * Copyright 2018 Google LLC
  43. * SPDX-License-Identifier: BSD-3-Clause
  44. */