"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getClientFingerprint = void 0;
const FINGERPRINT_STORAGE_KEY = 'MIRAI:FINGERPRINT';
const resolveStorage = () => {
  if (typeof window === 'undefined' || !window.localStorage) return null;
  return window.localStorage;
};
const generateId = () => {
  const a = Math.random() * 0x100000000 >>> 0;
  const b = Math.random() * 0x100000000 >>> 0;
  return a.toString(36).padStart(7, '0') + b.toString(36).padStart(7, '0');
};
const getClientFingerprint = () => {
  const storage = resolveStorage();
  if (storage) {
    const stored = storage.getItem(FINGERPRINT_STORAGE_KEY);
    if (stored) return stored;
  }
  const generated = generateId();
  if (storage) storage.setItem(FINGERPRINT_STORAGE_KEY, generated);
  return generated;
};
exports.getClientFingerprint = getClientFingerprint;
//# sourceMappingURL=getClientFingerprint.js.map