import { generateUUID } from "./uuid";
import { BrowserStorage } from "~/utils/browser";
export function createNewDeviceId() {
    let deviceId;
    try {
        deviceId = `$device:${generateUUID()}`;
    }
    catch (_error) {
        deviceId = `$device:default-${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
    }
    return deviceId;
}
export function getDeviceId() {
    const storage = new BrowserStorage();
    let deviceId = storage.getItem("localLogicDevice");
    if (!deviceId) {
        deviceId = createNewDeviceId();
        storage.setItem("localLogicDevice", deviceId);
    }
    return deviceId;
}
//# sourceMappingURL=device.js.map