"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var fingerprint_exports = {};
__export(fingerprint_exports, {
  BEM_ISH: () => BEM_ISH,
  CSS_MODULE_HASH: () => CSS_MODULE_HASH,
  FRAMEWORK_PREFIXES: () => FRAMEWORK_PREFIXES,
  NUMERIC_INDEX_SUFFIX: () => NUMERIC_INDEX_SUFFIX,
  STATE_TOKENS: () => STATE_TOKENS,
  TAILWIND_UTILITY: () => TAILWIND_UTILITY,
  canonicalJson: () => canonicalJson,
  computeFingerprintFromInput: () => computeFingerprintFromInput,
  normalizeClasses: () => normalizeClasses
});
module.exports = __toCommonJS(fingerprint_exports);
var crypto = __toESM(require("crypto"));
const BEM_ISH = /^[a-z][a-z-]+(__[a-z-]+)?(--[a-z-]+)?$/;
const FRAMEWORK_PREFIXES = ["data-radix-", "data-headlessui-", "MuiSelect-", "ant-select-"];
const TAILWIND_UTILITY = /^(bg|text|p|m|w|h|flex|grid|border|rounded|shadow)-|^(hover|focus|md|lg|sm|xl):/;
const CSS_MODULE_HASH = /_[a-z0-9]{5,}$/;
const NUMERIC_INDEX_SUFFIX = /-\d+$/;
const STATE_TOKENS = /* @__PURE__ */ new Set(["is-active", "is-open", "expanded", "selected", "active", "open"]);
function isStructural(cls) {
  if (!cls) return false;
  if (FRAMEWORK_PREFIXES.some((p) => cls.startsWith(p))) return true;
  if (STATE_TOKENS.has(cls)) return false;
  if (TAILWIND_UTILITY.test(cls)) return false;
  if (CSS_MODULE_HASH.test(cls)) return false;
  if (NUMERIC_INDEX_SUFFIX.test(cls)) return false;
  return BEM_ISH.test(cls);
}
function normalizeClasses(className) {
  if (!className) return "";
  const tokens = className.split(/\s+/).filter(Boolean);
  const kept = tokens.filter(isStructural);
  const deduped = Array.from(new Set(kept));
  deduped.sort();
  return deduped.join(" ");
}
function canonicalJson(value) {
  if (value === null || typeof value !== "object")
    return JSON.stringify(value);
  if (Array.isArray(value))
    return "[" + value.map(canonicalJson).join(",") + "]";
  const obj = value;
  const keys = Object.keys(obj).sort();
  return "{" + keys.map((k) => JSON.stringify(k) + ":" + canonicalJson(obj[k])).join(",") + "}";
}
function computeFingerprintFromInput(input) {
  const json = canonicalJson(input);
  return crypto.createHash("sha256").update(json).digest("hex").slice(0, 16);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  BEM_ISH,
  CSS_MODULE_HASH,
  FRAMEWORK_PREFIXES,
  NUMERIC_INDEX_SUFFIX,
  STATE_TOKENS,
  TAILWIND_UTILITY,
  canonicalJson,
  computeFingerprintFromInput,
  normalizeClasses
});
