import { toColorValue as o } from "../../../../@twind_core@1.1.3_typescript@5.8.3/node_modules/@twind/core/core.js";
import f from "../../../../@twind_preset-tailwind@1.1.4_@twind_core@1.1.3_typescript@5.8.3__typescript@5.8.3/node_modules/@twind/preset-tailwind/defaultTheme.js";
import { blue as s, gray as c } from "../../../../@twind_preset-tailwind@1.1.4_@twind_core@1.1.3_typescript@5.8.3__typescript@5.8.3/node_modules/@twind/preset-tailwind/_/colors-16fd59b8.js";
let [b, h] = f.fontSize.base, { spacing: e, borderWidth: p, borderRadius: u } = f;
function y({ strategy: r } = {}) {
  let d = {};
  return r !== "base" && (d.rules = [
    [
      "(" + [
        ...new Set(g.flatMap((n) => n.c).filter(Boolean))
      ].join("|") + ")",
      (n, i) => ({
        "@layer base": g.filter((a) => a.c?.includes(n[1])).map(({ c: a, s: t }) => ({
          ["" + a.map((w) => "." + i.e(i.h(w)))]: typeof t == "function" ? t(i) : t
        }))
      })
    ]
  ]), r !== "class" && (d.preflight = (n) => {
    let i = {};
    for (let { b: a, s: t } of g) i["" + a] = typeof t == "function" ? t(n) : t;
    return i;
  }), d;
}
let g = [
  {
    b: [
      "[type='text']",
      "[type='email']",
      "[type='url']",
      "[type='password']",
      "[type='number']",
      "[type='date']",
      "[type='datetime-local']",
      "[type='month']",
      "[type='search']",
      "[type='tel']",
      "[type='time']",
      "[type='week']",
      "[multiple]",
      "textarea",
      "select"
    ],
    c: [
      "form-input",
      "form-textarea",
      "form-select",
      "form-multiselect"
    ],
    s: ({ theme: r }) => ({
      appearance: "none",
      "background-color": "#fff",
      "border-color": o(r("colors.gray.500", c[500])),
      "border-width": p.DEFAULT,
      "border-radius": u.none,
      "padding-top": e[2],
      "padding-right": e[3],
      "padding-bottom": e[2],
      "padding-left": e[3],
      "font-size": b,
      "line-height": h,
      "--tw-shadow": "0 0 #0000",
      "&:focus": {
        outline: "2px solid transparent",
        "outline-offset": "2px",
        "--tw-ring-inset": "var(--tw-empty,/*!*/ /*!*/)",
        "--tw-ring-offset-width": "0px",
        "--tw-ring-offset-color": "#fff",
        "--tw-ring-color": o(r("colors.blue.600", s[600])),
        "--tw-ring-offset-shadow": "var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)",
        "--tw-ring-shadow": "var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color)",
        "box-shadow": "var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)",
        "border-color": o(r("colors.blue.600", s[600]))
      }
    })
  },
  {
    b: [
      "input",
      "textarea"
    ],
    c: [
      "form-input",
      "form-textarea"
    ],
    s: ({ theme: r }) => ({
      "&::placeholder": {
        color: o(r("colors.gray.500", c[500])),
        opacity: "1"
      }
    })
  },
  {
    b: [
      ""
    ],
    c: [
      "form-input"
    ],
    s: {
      "&::-webkit-datetime-edit-fields-wrapper": {
        padding: "0"
      },
      // Unfortunate hack until https://bugs.webkit.org/show_bug.cgi?id=198959 is fixed.
      // This sucks because users can't change line-height with a utility on date inputs now.
      // Reference: https://github.com/twbs/bootstrap/pull/31993
      "&::-webkit-date-and-time-value": {
        "min-height": "1.5em"
      }
    }
  },
  {
    b: [
      "select"
    ],
    c: [
      "form-select"
    ],
    s: ({ theme: r }) => ({
      "background-image": `url("${l(`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20"><path stroke="${o(r("colors.gray.500", c[500]))}" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M6 8l4 4 4-4"/></svg>`)}")`,
      "background-position": `right ${e[2]} center`,
      "background-repeat": "no-repeat",
      "background-size": "1.5em 1.5em",
      "padding-right": e[10],
      "color-adjust": "exact"
    })
  },
  {
    b: [
      "[multiple]"
    ],
    // class: null,
    s: {
      "background-image": "initial",
      "background-position": "initial",
      "background-repeat": "unset",
      "background-size": "initial",
      "padding-right": e[3],
      "color-adjust": "unset"
    }
  },
  {
    b: [
      "[type='checkbox']",
      "[type='radio']"
    ],
    c: [
      "form-checkbox",
      "form-radio"
    ],
    s: ({ theme: r }) => ({
      appearance: "none",
      padding: "0",
      "color-adjust": "exact",
      display: "inline-block",
      "vertical-align": "middle",
      "background-origin": "border-box",
      "user-select": "none",
      "flex-shrink": "0",
      height: e[4],
      width: e[4],
      color: o(r("colors.blue.600", s[600])),
      "background-color": "#fff",
      "border-color": o(r("colors.gray.500", c[500])),
      "border-width": p.DEFAULT,
      "--tw-shadow": "0 0 #0000",
      "&:focus": {
        outline: "2px solid transparent",
        "outline-offset": "2px",
        "--tw-ring-inset": "var(--tw-empty,/*!*/ /*!*/)",
        "--tw-ring-offset-width": "2px",
        "--tw-ring-offset-color": "#fff",
        "--tw-ring-color": o(r("colors.blue.600", s[600])),
        "--tw-ring-offset-shadow": "var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)",
        "--tw-ring-shadow": "var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)",
        "box-shadow": "var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)"
      },
      "&:checked": {
        "border-color": "transparent",
        "background-color": "currentColor",
        "background-size": "100% 100%",
        "background-position": "center",
        "background-repeat": "no-repeat",
        "&:hover,&:focus": {
          "border-color": "transparent",
          "background-color": "currentColor"
        }
      }
    })
  },
  {
    b: [
      "[type='checkbox']"
    ],
    c: [
      "form-checkbox"
    ],
    s: {
      "border-radius": u.none,
      "&:checked": {
        "background-image": `url("${l('<svg viewBox="0 0 16 16" fill="white" xmlns="http://www.w3.org/2000/svg"><path d="M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z"/></svg>')}")`
      },
      "&:indeterminate": {
        "background-image": `url("${l('<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 16"><path stroke="white" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 8h8"/></svg>')}")`,
        "border-color": "transparent",
        "background-color": "currentColor",
        "background-size": "100% 100%",
        "background-position": "center",
        "background-repeat": "no-repeat",
        "&:hover,&:focus": {
          "border-color": "transparent",
          "background-color": "currentColor"
        }
      }
    }
  },
  {
    b: [
      "[type='radio']"
    ],
    c: [
      "form-radio"
    ],
    s: {
      "border-radius": "100%",
      "&:checked": {
        "background-image": `url("${l('<svg viewBox="0 0 16 16" fill="white" xmlns="http://www.w3.org/2000/svg"><circle cx="8" cy="8" r="3"/></svg>')}")`
      }
    }
  },
  {
    b: [
      "[type='file']"
    ],
    // class: null,
    s: {
      background: "unset",
      "border-color": "inherit",
      "border-width": "0",
      "border-radius": "0",
      padding: "0",
      "font-size": "unset",
      "line-height": "inherit",
      "&:focus": {
        outline: [
          "1px solid ButtonText",
          "1px auto -webkit-focus-ring-color"
        ]
      }
    }
  }
];
function m(r) {
  switch (r) {
    // Browsers tolerate these characters, and they're frequent
    case "%20":
      return " ";
    case "%3D":
      return "=";
    case "%3A":
      return ":";
    case "%2F":
      return "/";
    default:
      return r.toLowerCase();
  }
}
function l(r) {
  return "data:image/svg+xml," + encodeURIComponent(r.trim().replace(/\s+/g, " ").replace(/"/g, "'")).replace(/%[\dA-F]{2}/g, m);
}
export {
  y as default
};
//# sourceMappingURL=preset-tailwind-forms.js.map
