{"version":3,"file":"crypto.cjs","names":[],"sources":["../../src/polyfills/crypto.ts"],"sourcesContent":["/**\n * Polyfill: crypto.getRandomValues\n *\n * Required by uuid generation in CopilotKit. Uses Math.random — NOT\n * cryptographically secure. For secure randomness, install\n * react-native-get-random-values before this polyfill.\n *\n * Skipped if crypto.getRandomValues is already defined.\n *\n * Usage:\n *   import \"@copilotkit/react-native/polyfills/crypto\";\n */\n\nexport {};\n\nconst g = globalThis as Record<string, unknown>;\n\nif (typeof g.crypto === \"undefined\") {\n  g.crypto = {};\n}\nconst cryptoObj = g.crypto as Record<string, unknown>;\nif (!cryptoObj.getRandomValues) {\n  console.warn(\n    \"[CopilotKit] Installing non-cryptographic crypto.getRandomValues polyfill (Math.random). \" +\n      \"This is NOT secure for cryptographic operations. Install 'react-native-get-random-values' \" +\n      \"for a secure implementation.\",\n  );\n  cryptoObj.getRandomValues = function (array: Uint8Array): Uint8Array {\n    for (let i = 0; i < array.length; i++) {\n      array[i] = Math.floor(Math.random() * 256);\n    }\n    return array;\n  };\n}\n"],"mappings":";;AAeA,MAAM,IAAI;AAEV,IAAI,OAAO,EAAE,WAAW,YACtB,GAAE,SAAS,EAAE;AAEf,MAAM,YAAY,EAAE;AACpB,IAAI,CAAC,UAAU,iBAAiB;AAC9B,SAAQ,KACN,kNAGD;AACD,WAAU,kBAAkB,SAAU,OAA+B;AACnE,OAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,IAChC,OAAM,KAAK,KAAK,MAAM,KAAK,QAAQ,GAAG,IAAI;AAE5C,SAAO"}