const createFallbackUuid = (): string => { let timestamp = Date.now(); return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (token) => { const random = (timestamp + Math.random() * 16) % 16 | 0; timestamp = Math.floor(timestamp / 16); const value = token === "x" ? random : (random & 0x3) | 0x8; return value.toString(16); }); }; export const createId = (): string => { if (typeof globalThis.crypto?.randomUUID === "function") { return globalThis.crypto.randomUUID(); } return createFallbackUuid(); };