{"scan_id":"a6596377-0e50-4910-884c-999302b04827","url":"https://chicha-talks-i7o53wkws5.edgeone.app/","final_url":"https://chicha-talks-i7o53wkws5.edgeone.app/","status":"completed","scan_type":"public","title":"Chicha Talks","screenshot":"/api/v1/screenshot/a6596377-0e50-4910-884c-999302b04827.png","submitted_at":"2026-01-12T03:03:10.340555Z","completed_at":"2026-01-12T03:04:45.860015Z","load_time":92.40609216690063,"load_time_comparison":{"band":"slow","label":"Slow","percentile":95,"faster_than_pct":5,"median":3.62,"p25":1.05,"p50":3.62,"p75":11.42,"sample_size":429305},"links":[],"forms":[],"cookies":[],"scripts":[{"src":"https://cdnjs.cloudflare.com/ajax/libs/tone/14.8.49/Tone.js","source":"intercepted","headers":{"age":"759685","nel":"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}","date":"Mon, 12 Jan 2026 03:03:19 GMT","etag":"\"63555fcb-106cb\"","vary":"Accept-Encoding","cf-ray":"9bc96b8b3a0bd34d-FRA","server":"cloudflare","alt-svc":"h3=\":443\"; ma=86400","expires":"Sat, 02 Jan 2027 03:03:19 GMT","report-to":"{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=3qpffLlkhYs4tjj6v4zMqvN6i7%2BzSHS3QRZqQFhJxZyVjxRVAp9eb9NGnAVO3Y08Sf6RVGLMxarxBvJpDAVBHx%2FqP8Lk8sXOi7zEQfjLvCzf4kF%2BICQEXJ3sLNiHb1gdOgZE7FC6\"}],\"group\":\"cf-nel\",\"max_age\":604800}","cf-cdnjs-via":"cfworker/kv","content-type":"application/javascript; charset=utf-8","accept-ranges":"bytes","cache-control":"public, max-age=30672000","last-modified":"Sun, 23 Oct 2022 15:37:47 GMT","content-length":"67275","cf-cache-status":"HIT","content-encoding":"br","timing-allow-origin":"*","x-content-type-options":"nosniff","strict-transport-security":"max-age=15780000","access-control-allow-origin":"*","cross-origin-resource-policy":"cross-origin"},"ip_info":{"ip":"104.17.25.14","asn":13335,"country":"US","asn_name":"CLOUDFLARENET"},"captured_at":1768187001.4852798,"content_hash":"1261cdd3331d826237e7b0b954b5ed7d2381c8df4331d2018acea8c7a64a9a7b","is_whitelisted":true},{"src":null,"size":26548,"type":"inline","source":"dom","content":"\n    // Firebase Imports\n    import { initializeApp } from \"https://www.gstatic.com/firebasejs/9.22.0/firebase-app.js\";\n    import { getAuth, signInWithEmailAndPassword, createUserWithEmailAndPassword, onAuthStateChanged, signOut } from \"https://www.gstatic.com/firebasejs/9.22.0/firebase-auth.js\";\n    import { getDatabase, ref, set, get, onValue, push, update, remove, serverTimestamp, query, orderByChild, limitToLast, onDisconnect } from \"https://www.gstatic.com/firebasejs/9.22.0/firebase-database.js\";\n\n    // UPDATED FIREBASE CONFIGURATION (moviehunt)\n    const firebaseConfig = {\n      apiKey: \"AIzaSyDh0C_isIzAaBcC-2_X-NNDOM9iw7GNw0g\",\n      authDomain: \"moviehunt-4a94f.firebaseapp.com\",\n      databaseURL: \"https://moviehunt-4a94f-default-rtdb.firebaseio.com\",\n      projectId: \"moviehunt-4a94f\",\n      storageBucket: \"moviehunt-4a94f.firebasestorage.app\",\n      messagingSenderId: \"999224224894\",\n      appId: \"1:999224224894:web:fab47a42990abfb360bc2f\",\n      measurementId: \"G-FNPQZRZ9EJ\"\n    };\n\n    const app = initializeApp(firebaseConfig);\n    const auth = getAuth(app);\n    const db = getDatabase(app);\n\n    // Global State\n    let currentUser = null;\n    let currentUserData = null;\n    let activeChatId = null;\n    let activeChatUser = null; // The other user object\n    let localStream = null;\n    let remoteStream = null;\n    let peerConnection = null;\n    let currentCallId = null;\n    let callType = 'video';\n    let ringtone = null;\n    \n    // WebRTC Config\n    const rtcConfig = {\n        iceServers: [\n            { urls: 'stun:stun.l.google.com:19302' },\n            { urls: 'stun:stun1.l.google.com:19302' }\n        ]\n    };\n\n    // Emoji to SVG Function\n    function emojiToSVG(content) {\n        const svgString = `\n        <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"100\" height=\"100\" viewBox=\"0 0 100 100\">\n            <rect width=\"100\" height=\"100\" fill=\"#000\"/>\n            <text x=\"50\" y=\"60\" font-family=\"Arial\" font-size=\"50\" fill=\"#fff\" text-anchor=\"middle\">${content}</text>\n        </svg>`;\n        return \"data:image/svg+xml;base64,\" + btoa(unescape(encodeURIComponent(svgString)));\n    }\n\n    // --- DOM Elements ---\n    const screens = {\n        auth: document.getElementById('auth-screen'),\n        setup: document.getElementById('profile-setup-screen'),\n        main: document.getElementById('main-interface'),\n        chat: document.getElementById('chat-screen')\n    };\n    \n    // --- AUTHENTICATION ---\n    onAuthStateChanged(auth, async (user) => {\n        if (user) {\n            currentUser = user;\n            // Check if profile exists\n            const snap = await get(ref(db, `users/${user.uid}`));\n            if (snap.exists()) {\n                currentUserData = snap.val();\n                initApp();\n            } else {\n                showScreen('setup');\n            }\n        } else {\n            showScreen('auth');\n            currentUser = null;\n        }\n    });\n\n    document.getElementById('btn-login').onclick = () => handleAuth('login');\n    document.getElementById('btn-signup').onclick = () => handleAuth('signup');\n\n    async function handleAuth(type) {\n        const email = document.getElementById('auth-email').value;\n        const pass = document.getElementById('auth-pass').value;\n        const errorP = document.getElementById('auth-error');\n        \n        try {\n            if (type === 'login') {\n                await signInWithEmailAndPassword(auth, email, pass);\n            } else {\n                await createUserWithEmailAndPassword(auth, email, pass);\n                // Profile setup will trigger via onAuthStateChanged\n            }\n        } catch (e) {\n            errorP.innerText = e.message;\n        }\n    }\n\n    // --- PROFILE SETUP ---\n    document.getElementById('setup-emoji').addEventListener('input', (e) => {\n        const val = e.target.value.substring(0,2);\n        if(val) document.getElementById('emoji-preview').innerHTML = `<img src=\"${emojiToSVG(val)}\" style=\"width:100%\">`;\n    });\n\n    document.getElementById('btn-save-profile').onclick = async () => {\n        const name = document.getElementById('setup-name').value;\n        const bio = document.getElementById('setup-bio').value;\n        const emoji = document.getElementById('setup-emoji').value || \"U\";\n        \n        if (!name) return alert(\"Name required\");\n        \n        // Generate ID\n        const uniqueId = \"chicha-\" + Math.floor(1000 + Math.random() * 9000);\n        const dpUrl = emojiToSVG(emoji);\n        \n        const userData = {\n            name, bio, emoji, uid: currentUser.uid, \n            publicId: uniqueId, dpUrl, email: currentUser.email\n        };\n\n        // Save to DB\n        await set(ref(db, `users/${currentUser.uid}`), userData);\n        // Index by publicId for searching\n        await set(ref(db, `userList/${uniqueId}`), currentUser.uid);\n        \n        currentUserData = userData;\n        initApp();\n    };\n\n    // --- APP INITIALIZATION ---\n    function initApp() {\n        showScreen('main');\n        setupPresence();\n        loadContacts();\n        loadRequests();\n        loadCallLogs();\n        listenForIncomingCalls();\n        \n        // Setup side menu\n        document.getElementById('menu-name').innerText = currentUserData.name;\n        document.getElementById('menu-uid').innerText = `@${currentUserData.publicId}`;\n        document.getElementById('menu-avatar').src = currentUserData.dpUrl;\n    }\n\n    // PRESENCE SYSTEM\n    function setupPresence() {\n        const connectedRef = ref(db, \".info/connected\");\n        const userStatusRef = ref(db, `status/${currentUser.uid}`);\n        \n        onValue(connectedRef, (snap) => {\n            if (snap.val() === true) {\n                onDisconnect(userStatusRef).set({ state: 'offline', last_changed: serverTimestamp() });\n                set(userStatusRef, { state: 'online', last_changed: serverTimestamp() });\n            }\n        });\n    }\n\n    // --- NAVIGATION ---\n    function showScreen(name) {\n        Object.values(screens).forEach(s => s.classList.add('hidden'));\n        screens[name].classList.remove('hidden');\n    }\n\n    document.querySelectorAll('.nav-item').forEach(btn => {\n        btn.onclick = () => {\n            document.querySelectorAll('.nav-item').forEach(b => b.classList.remove('active'));\n            btn.classList.add('active');\n            \n            ['view-contacts', 'view-requests', 'view-calls'].forEach(v => document.getElementById(v).classList.add('hidden'));\n            document.getElementById(btn.dataset.target).classList.remove('hidden');\n        };\n    });\n\n    // Side Menu\n    const sideMenu = document.getElementById('side-menu');\n    const menuOverlay = document.getElementById('menu-overlay');\n    document.getElementById('menu-btn').onclick = () => { sideMenu.classList.add('open'); menuOverlay.style.display = 'block'; };\n    menuOverlay.onclick = () => { sideMenu.classList.remove('open'); menuOverlay.style.display = 'none'; };\n    document.getElementById('btn-logout').onclick = () => signOut(auth);\n\n    // --- FRIENDS & REQUESTS ---\n    document.getElementById('add-friend-btn').onclick = () => document.getElementById('add-friend-modal').classList.remove('hidden');\n    document.getElementById('close-add-friend').onclick = () => document.getElementById('add-friend-modal').classList.add('hidden');\n\n    document.getElementById('btn-send-request').onclick = async () => {\n        const targetId = document.getElementById('search-uid').value.trim();\n        const resDiv = document.getElementById('search-result');\n        \n        if(targetId === currentUserData.publicId) return resDiv.innerText = \"That's you!\";\n        \n        const idSnap = await get(ref(db, `userList/${targetId}`));\n        if (!idSnap.exists()) return resDiv.innerText = \"User not found.\";\n        \n        const targetUid = idSnap.val();\n        await push(ref(db, `requests/${targetUid}`), {\n            from: currentUser.uid,\n            name: currentUserData.name,\n            dpUrl: currentUserData.dpUrl\n        });\n        resDiv.innerText = \"Request sent!\";\n        resDiv.style.color = \"var(--primary-color)\";\n    };\n\n    function loadRequests() {\n        onValue(ref(db, `requests/${currentUser.uid}`), (snap) => {\n            const list = document.getElementById('view-requests');\n            list.innerHTML = '';\n            if(!snap.exists()) return list.innerHTML = '<p class=\"text-center\" style=\"margin-top:20px;color:#555\">No pending requests</p>';\n            \n            snap.forEach(child => {\n                const req = child.val();\n                const div = document.createElement('div');\n                div.className = 'list-item';\n                div.innerHTML = `\n                    <img src=\"${req.dpUrl}\" class=\"avatar\">\n                    <div class=\"info\"><div class=\"name\">${req.name}</div></div>\n                    <button class=\"btn\" style=\"width:auto; padding:5px 15px; font-size:0.8rem\">Accept</button>\n                `;\n                div.querySelector('button').onclick = async () => {\n                    // Add to both contacts\n                    await set(ref(db, `contacts/${currentUser.uid}/${child.key}`), req.from);\n                    await set(ref(db, `contacts/${req.from}/${currentUser.uid}`), currentUser.uid);\n                    // Remove request\n                    await remove(ref(db, `requests/${currentUser.uid}/${child.key}`));\n                };\n                list.appendChild(div);\n            });\n        });\n    }\n\n    // --- CONTACTS LIST ---\n    function loadContacts() {\n        onValue(ref(db, `contacts/${currentUser.uid}`), async (snap) => {\n            const list = document.getElementById('view-contacts');\n            list.innerHTML = '';\n            \n            if(!snap.exists()) return;\n\n            const contacts = [];\n            snap.forEach(c => contacts.push({key: c.key, uid: c.val()}));\n\n            for (let c of contacts) {\n                const userSnap = await get(ref(db, `users/${c.uid}`));\n                const userData = userSnap.val();\n                \n                // Get unread count\n                const unreadSnap = await get(ref(db, `unreadCounts/${currentUser.uid}/${getChatId(currentUser.uid, c.uid)}`));\n                const unread = unreadSnap.val() || 0;\n\n                const div = document.createElement('div');\n                div.className = 'list-item';\n                div.innerHTML = `\n                    <img src=\"${userData.dpUrl}\" class=\"avatar\">\n                    <div class=\"info\">\n                        <div class=\"name\">${userData.name}</div>\n                        <div class=\"status\" id=\"status-${c.uid}\">Offline</div>\n                    </div>\n                    ${unread > 0 ? `<div class=\"badge\">${unread}</div>` : ''}\n                `;\n                \n                // Realtime status listener\n                onValue(ref(db, `status/${c.uid}`), (sSnap) => {\n                    const el = document.getElementById(`status-${c.uid}`);\n                    if(el && sSnap.exists()) el.innerText = sSnap.val().state === 'online' ? 'Online' : 'Offline';\n                });\n\n                div.onclick = () => openChat(userData);\n                list.appendChild(div);\n            }\n        });\n    }\n\n    // --- CHATTING ---\n    function getChatId(uid1, uid2) {\n        return uid1 < uid2 ? `${uid1}_${uid2}` : `${uid2}_${uid1}`;\n    }\n\n    async function openChat(user) {\n        activeChatUser = user;\n        activeChatId = getChatId(currentUser.uid, user.uid);\n        \n        // UI Updates\n        document.getElementById('chat-header-name').innerText = user.name;\n        document.getElementById('chat-header-avatar').src = user.dpUrl;\n        showScreen('chat');\n        \n        // Reset Unread\n        set(ref(db, `unreadCounts/${currentUser.uid}/${activeChatId}`), 0);\n\n        // Check cleared timestamp\n        const clearedSnap = await get(ref(db, `userChats/${currentUser.uid}/${activeChatId}/clearedAt`));\n        const clearedAt = clearedSnap.val() || 0;\n\n        // Load Messages\n        const msgRef = query(ref(db, `messages/${activeChatId}`), orderByChild('timestamp'));\n        onValue(msgRef, (snap) => {\n            const container = document.getElementById('chat-messages');\n            container.innerHTML = '';\n            snap.forEach(child => {\n                const msg = child.val();\n                if (msg.timestamp > clearedAt) {\n                    const div = document.createElement('div');\n                    div.className = `message ${msg.sender === currentUser.uid ? 'msg-me' : 'msg-other'}`;\n                    div.innerText = msg.text;\n                    container.appendChild(div);\n                }\n            });\n            container.scrollTop = container.scrollHeight;\n        });\n\n        // Typing Indicator Listener\n        onValue(ref(db, `typing/${activeChatId}/${user.uid}`), (snap) => {\n            const ind = document.getElementById('typing-indicator');\n            ind.innerText = snap.val() ? `${user.name} is typing...` : '';\n        });\n    }\n\n    document.getElementById('back-chat').onclick = () => {\n        activeChatId = null;\n        showScreen('main');\n    };\n\n    // Send Message\n    document.getElementById('send-msg-btn').onclick = sendMessage;\n    document.getElementById('message-input').onkeypress = (e) => { if(e.key === 'Enter') sendMessage(); };\n    \n    // Typing Handler\n    let typingTimeout;\n    document.getElementById('message-input').oninput = () => {\n        set(ref(db, `typing/${activeChatId}/${currentUser.uid}`), true);\n        clearTimeout(typingTimeout);\n        typingTimeout = setTimeout(() => set(ref(db, `typing/${activeChatId}/${currentUser.uid}`), false), 3000);\n    };\n\n    async function sendMessage() {\n        const input = document.getElementById('message-input');\n        const text = input.value.trim();\n        if(!text || !activeChatId) return;\n        \n        const msg = {\n            text,\n            sender: currentUser.uid,\n            timestamp: serverTimestamp()\n        };\n        \n        await push(ref(db, `messages/${activeChatId}`), msg);\n        \n        // Update Unread for other user\n        const otherCountRef = ref(db, `unreadCounts/${activeChatUser.uid}/${activeChatId}`);\n        const snap = await get(otherCountRef);\n        set(otherCountRef, (snap.val() || 0) + 1);\n        \n        input.value = '';\n    }\n\n    // Clear Chat\n    document.getElementById('btn-clear-chat').onclick = () => {\n        if(confirm(\"Clear chat history?\")) {\n            set(ref(db, `userChats/${currentUser.uid}/${activeChatId}/clearedAt`), serverTimestamp());\n            document.getElementById('chat-messages').innerHTML = ''; // Immediate visual clear\n        }\n    };\n\n    // --- WEBRTC CALLING ---\n    // Signaling & Call Logic\n    \n    document.getElementById('btn-voice-call').onclick = () => startCall('voice');\n    document.getElementById('btn-video-call').onclick = () => startCall('video');\n\n    async function startCall(type) {\n        callType = type;\n        const callId = push(ref(db, 'calls')).key;\n        currentCallId = callId;\n\n        // UI Setup\n        document.getElementById('call-modal').classList.remove('hidden');\n        document.getElementById('outgoing-call-ui').classList.remove('hidden');\n        document.getElementById('incoming-call-ui').classList.add('hidden');\n        document.getElementById('active-call-controls').classList.add('hidden');\n        \n        // Get Local Media\n        try {\n            localStream = await navigator.mediaDevices.getUserMedia({ \n                video: type === 'video', \n                audio: true \n            });\n            document.getElementById('local-video').srcObject = localStream;\n            if(type === 'voice') document.getElementById('local-video').classList.add('hidden');\n            \n            // Create Peer Connection\n            createPeerConnection();\n\n            // Create Offer\n            const offer = await peerConnection.createOffer();\n            await peerConnection.setLocalDescription(offer);\n\n            // Push Offer\n            const callData = {\n                caller: currentUser.uid,\n                callee: activeChatUser.uid,\n                type: type,\n                offer: { type: offer.type, sdp: offer.sdp },\n                timestamp: serverTimestamp()\n            };\n            await set(ref(db, `calls/${callId}`), callData);\n\n            // Listen for Answer\n            onValue(ref(db, `calls/${callId}/answer`), (snap) => {\n                const answer = snap.val();\n                if (answer && !peerConnection.currentRemoteDescription) {\n                    const rtcSessionDescription = new RTCSessionDescription(answer);\n                    peerConnection.setRemoteDescription(rtcSessionDescription);\n                    // UI Transition\n                    document.getElementById('outgoing-call-ui').classList.add('hidden');\n                    document.getElementById('active-call-controls').classList.remove('hidden');\n                }\n            });\n\n            // Listen for Remote Candidates\n            onValue(ref(db, `calls/${callId}/calleeCandidates`), (snap) => {\n                snap.forEach(c => {\n                    peerConnection.addIceCandidate(new RTCIceCandidate(c.val()));\n                });\n            });\n\n        } catch (e) {\n            console.error(\"Media Error\", e);\n            alert(\"Could not access camera/mic\");\n            endCall();\n        }\n    }\n\n    function createPeerConnection() {\n        peerConnection = new RTCPeerConnection(rtcConfig);\n        \n        // Add local tracks\n        localStream.getTracks().forEach(track => peerConnection.addTrack(track, localStream));\n\n        // Handle ICE Candidates\n        peerConnection.onicecandidate = (event) => {\n            if (event.candidate) {\n                const node = currentUser.uid === activeChatUser?.uid ? 'calleeCandidates' : 'callerCandidates'; // Logic check needed here\n                // Simplified: The creator is Caller, the listener is Callee\n                // Actually, we need to know role.\n                const isCaller = document.getElementById('outgoing-call-ui').classList.contains('hidden') === false \n                                || (document.getElementById('active-call-controls').classList.contains('hidden') === false && !document.getElementById('btn-accept-call').offsetParent); \n                \n                // Better Logic: If I started the call (currentCallId exists and I pushed offer)\n                // For simplicity, let's just push to both and let DB sort or specific paths\n                if(currentCallId) {\n                   const path = isCaller ? `calls/${currentCallId}/callerCandidates` : `calls/${currentCallId}/calleeCandidates`;\n                   push(ref(db, path), event.candidate.toJSON());\n                }\n            }\n        };\n\n        // Handle Remote Stream\n        peerConnection.ontrack = (event) => {\n            document.getElementById('remote-video').srcObject = event.streams[0];\n        };\n    }\n\n    // --- INCOMING CALLS ---\n    function listenForIncomingCalls() {\n        // Simple listener: Check last added call where callee is me\n        const callsRef = query(ref(db, 'calls'), orderByChild('callee'), limitToLast(1));\n        \n        onValue(callsRef, async (snap) => {\n            if (!snap.exists()) return;\n            const data = Object.values(snap.val())[0];\n            const key = Object.keys(snap.val())[0];\n\n            if (data.callee === currentUser.uid && !data.ended && !currentCallId) {\n                // Check if call is recent (within 1 min)\n                if (Date.now() - data.timestamp > 60000) return;\n\n                currentCallId = key;\n                callType = data.type;\n                \n                // Fetch Caller Info\n                const callerSnap = await get(ref(db, `users/${data.caller}`));\n                const callerData = callerSnap.val();\n                activeChatUser = callerData; // For ICE logic\n\n                // Play Ringtone \n                if(Tone.context.state !== 'running') await Tone.start();\n                ringtone = new Tone.Oscillator(440, \"sine\").toDestination().start();\n                ringtone.volume.value = -10;\n                \n                // Show UI\n                document.getElementById('call-modal').classList.remove('hidden');\n                document.getElementById('incoming-call-ui').classList.remove('hidden');\n                document.getElementById('outgoing-call-ui').classList.add('hidden');\n                document.getElementById('active-call-controls').classList.add('hidden');\n                \n                document.getElementById('caller-name').innerText = callerData.name;\n                document.getElementById('caller-avatar').src = callerData.dpUrl;\n\n                // Handle Accept\n                document.getElementById('btn-accept-call').onclick = () => acceptCall(data.offer);\n            }\n        });\n    }\n\n    async function acceptCall(remoteOffer) {\n        if(ringtone) { ringtone.stop(); ringtone = null; }\n        document.getElementById('incoming-call-ui').classList.add('hidden');\n        document.getElementById('active-call-controls').classList.remove('hidden');\n\n        localStream = await navigator.mediaDevices.getUserMedia({ \n            video: callType === 'video', \n            audio: true \n        });\n        document.getElementById('local-video').srcObject = localStream;\n        if(callType === 'voice') document.getElementById('local-video').classList.add('hidden');\n\n        createPeerConnection(); // Re-assigns onicecandidate logic\n        \n        // Correct ICE Candidate Logic for Callee\n        peerConnection.onicecandidate = (event) => {\n            if(event.candidate) {\n                push(ref(db, `calls/${currentCallId}/calleeCandidates`), event.candidate.toJSON());\n            }\n        };\n\n        // Listen for Caller Candidates\n        onValue(ref(db, `calls/${currentCallId}/callerCandidates`), (snap) => {\n            snap.forEach(c => peerConnection.addIceCandidate(new RTCIceCandidate(c.val())));\n        });\n\n        await peerConnection.setRemoteDescription(new RTCSessionDescription(remoteOffer));\n        const answer = await peerConnection.createAnswer();\n        await peerConnection.setLocalDescription(answer);\n\n        await update(ref(db, `calls/${currentCallId}`), { answer: { type: answer.type, sdp: answer.sdp } });\n    }\n\n    // Call Controls\n    document.getElementById('btn-hangup').onclick = endCall;\n    document.getElementById('btn-reject-call').onclick = endCall;\n    document.getElementById('btn-cancel-call').onclick = endCall;\n\n    document.getElementById('btn-toggle-mute').onclick = (e) => {\n        const track = localStream.getAudioTracks()[0];\n        track.enabled = !track.enabled;\n        e.currentTarget.style.backgroundColor = track.enabled ? '#444' : 'var(--danger-color)';\n    };\n\n    document.getElementById('btn-toggle-video').onclick = (e) => {\n        const track = localStream.getVideoTracks()[0];\n        track.enabled = !track.enabled;\n        e.currentTarget.style.backgroundColor = track.enabled ? '#444' : 'var(--danger-color)';\n    };\n\n    async function endCall() {\n        if(ringtone) { ringtone.stop(); ringtone = null; }\n        if (localStream) localStream.getTracks().forEach(t => t.stop());\n        if (peerConnection) peerConnection.close();\n        \n        document.getElementById('call-modal').classList.add('hidden');\n        \n        // Log Call\n        if(currentCallId && activeChatUser) {\n           update(ref(db, `calls/${currentCallId}`), { ended: true });\n           \n           const log = {\n               type: callType,\n               with: activeChatUser.name,\n               timestamp: serverTimestamp()\n           };\n           push(ref(db, `callLogs/${currentUser.uid}`), log);\n        }\n\n        currentCallId = null;\n        localStream = null;\n    }\n\n    // Load Logs\n    function loadCallLogs() {\n        onValue(ref(db, `callLogs/${currentUser.uid}`), (snap) => {\n            const list = document.getElementById('view-calls');\n            list.innerHTML = '';\n            snap.forEach(c => {\n                const log = c.val();\n                const div = document.createElement('div');\n                div.className = 'list-item';\n                div.innerHTML = `\n                    <div class=\"material-icons-round\" style=\"font-size:30px; margin-right:15px; color: ${log.type === 'missed' ? 'red' : 'green'}\">\n                        ${log.type === 'video' ? 'videocam' : 'call'}\n                    </div>\n                    <div class=\"info\">\n                        <div class=\"name\">${log.with}</div>\n                        <div class=\"status\">${new Date(log.timestamp).toLocaleTimeString()}</div>\n                    </div>\n                `;\n                list.prepend(div);\n            });\n        });\n    }\n\n    // Draggable Local Video\n    const dragItem = document.getElementById(\"local-video\");\n    let active = false;\n    let currentX, currentY, initialX, initialY, xOffset = 0, yOffset = 0;\n\n    dragItem.addEventListener(\"touchstart\", dragStart, false);\n    dragItem.addEventListener(\"touchend\", dragEnd, false);\n    dragItem.addEventListener(\"touchmove\", drag, false);\n    dragItem.addEventListener(\"mousedown\", dragStart, false);\n    dragItem.addEventListener(\"mouseup\", dragEnd, false);\n    dragItem.addEventListener(\"mousemove\", drag, false);\n\n    function dragStart(e) {\n        if (e.type === \"touchstart\") {\n            initialX = e.touches[0].clientX - xOffset;\n            initialY = e.touches[0].clientY - yOffset;\n        } else {\n            initialX = e.clientX - xOffset;\n            initialY = e.clientY - yOffset;\n        }\n        if (e.target === dragItem) active = true;\n    }\n    function dragEnd(e) { initialX = currentX; initialY = currentY; active = false; }\n    function drag(e) {\n        if (active) {\n            e.preventDefault();\n            if (e.type === \"touchmove\") {\n                currentX = e.touches[0].clientX - initialX;\n                currentY = e.touches[0].clientY - initialY;\n            } else {\n                currentX = e.clientX - initialX;\n                currentY = e.clientY - initialY;\n            }\n            xOffset = currentX; yOffset = currentY;\n            setTranslate(currentX, currentY, dragItem);\n        }\n    }\n    function setTranslate(xPos, yPos, el) { el.style.transform = `translate3d(${xPos}px, ${yPos}px, 0)`; }\n","captured_at":"2026-01-12T03:04:40.776576+00:00","fetch_method":"inline"}],"intercepted_scripts":[{"ip":"104.17.25.14","asn":13335,"url":"https://cdnjs.cloudflare.com/ajax/libs/tone/14.8.49/Tone.js","country":"US","headers":{"age":"759685","nel":"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}","date":"Mon, 12 Jan 2026 03:03:19 GMT","etag":"\"63555fcb-106cb\"","vary":"Accept-Encoding","cf-ray":"9bc96b8b3a0bd34d-FRA","server":"cloudflare","alt-svc":"h3=\":443\"; ma=86400","expires":"Sat, 02 Jan 2027 03:03:19 GMT","report-to":"{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=3qpffLlkhYs4tjj6v4zMqvN6i7%2BzSHS3QRZqQFhJxZyVjxRVAp9eb9NGnAVO3Y08Sf6RVGLMxarxBvJpDAVBHx%2FqP8Lk8sXOi7zEQfjLvCzf4kF%2BICQEXJ3sLNiHb1gdOgZE7FC6\"}],\"group\":\"cf-nel\",\"max_age\":604800}","cf-cdnjs-via":"cfworker/kv","content-type":"application/javascript; charset=utf-8","accept-ranges":"bytes","cache-control":"public, max-age=30672000","last-modified":"Sun, 23 Oct 2022 15:37:47 GMT","content-length":"67275","cf-cache-status":"HIT","content-encoding":"br","timing-allow-origin":"*","x-content-type-options":"nosniff","strict-transport-security":"max-age=15780000","access-control-allow-origin":"*","cross-origin-resource-policy":"cross-origin"},"asn_info":{"ip":"104.17.25.14","asn":13335,"country":"US","asn_name":"CLOUDFLARENET"},"content_hash":"1261cdd3331d826237e7b0b954b5ed7d2381c8df4331d2018acea8c7a64a9a7b","intercepted_at":1768187001.4852798,"is_whitelisted":true}],"secondary_scripts":[],"meta_tags":[],"console_logs":[],"error":null,"http_transactions":[],"redirect_chains":[],"redirects":[],"security_verdict":{"verdict":"Low Risk","confidence":73,"risk_level":"low","risk_factors":[],"overall_score":27,"recommendations":[],"detailed_analysis":{"html_forms":{"score":50,"issues":[],"impersonated_brand":null,"brand_mismatch_detected":false,"disguised_password_fields":0,"brand_impersonation_detected":false},"url_analysis":{"score":65,"issues":[],"positive_signals":["HTTPS encryption used"],"suspicious_patterns":[]},"safe_browsing":{"score":100,"issues":[],"threats":[],"positive_signals":["No Google Safe Browsing threats detected"]},"clone_detection":{"score":100,"issues":[],"warnings":[],"positive_signals":["No visual similarity to known brand sites"]},"network_security":{"score":65,"issues":[],"mixed_content":false,"secure_requests":10,"security_headers":{"detected":true},"insecure_requests":0,"certificate_issues":[]},"technology_risks":{"score":50,"issues":[],"security_technologies":[],"vulnerable_technologies":[]},"redirect_analysis":{"score":50,"issues":[],"total_redirects":0,"blob_url_detected":false,"protocol_downgrades":0,"suspicious_patterns":0,"cross_domain_redirects":0,"compromised_wordpress_detected":false}},"threat_categories":[],"security_indicators":{"negative":[],"positive":["HTTPS encryption used","Good network security practices","No Google Safe Browsing threats detected","No visual similarity to known brand sites"],"warnings":[]}},"tracker_analysis":{"summary":{"total_trackers":0,"unique_companies":0,"highest_risk_category":null},"privacy_concerns":[],"detected_trackers":[],"tracker_categories":{"other":[],"video":[],"privacy":[],"security":[],"analytics":[],"marketing":[],"advertising":[],"performance":[],"social_media":[],"apm_monitoring":[],"authentication":[],"error_tracking":[],"fingerprinting":[],"consent_management":[],"first_party_analytics":[]},"unique_ids_extracted":{}},"technologies":{"detected":[{"name":"Cloudflare","version":null,"category":"wappalyzer","confidence":50,"detected_at":"2026-01-12T03:04:51.127059Z","website":null,"description":null,"details":{"cpe":null,"source":"wappalyzer","implies":null,"detected_by":["implied"]}},{"name":"cdnjs","version":null,"category":"wappalyzer","confidence":20,"detected_at":"2026-01-12T03:04:51.127059Z","website":null,"description":null,"details":{"cpe":null,"source":"wappalyzer","implies":["Cloudflare"],"detected_by":["scriptSrc"],"detection_details":[{"method":"scriptSrc","matches":[{"url":"https://cdnjs.cloudflare.com/ajax/libs/tone/14.8.49/Tone.js","pattern":"cdnjs\\.cloudflare\\.com"}]}],"confidence_breakdown":{"scriptSrc":20}}}]},"domains":["cdnjs.cloudflare.com"],"ip_addresses":["43.152.26.58","142.250.185.131","142.250.185.138","104.17.25.14","142.250.74.195"],"page_stats":{},"screenshot_hashes":{"crop_resistant":"3032323232323230","ahash":"0001100000011000000110000001100000011000000110000001100000011000","ahash_hex":"1818181818181818","ahash_int":"1736164148113840152","phash":"1100110001100110001100111001100111001100011001100011001110011001","phash_hex":"cc663399cc663399","phash_int":"14728516367014048665","dhash":"0011000000110010001100100011001000110010001100100011001000110000","dhash_hex":"3032323232323230","dhash_int":"3472893453827977776","whash":"0001100000011000000110000001100000011100000111000001110000011100","whash_hex":"181818181c1c1c1c","whash_int":"1736164148181212188"},"favicon_hash":null,"fuzzy_hashes":{"tlsh":"T1F313D89631F315328663726B2BA7834A3130D103AB45DE943EAD57904F86FE8D8B77C9","sdhash":"sdhash:3:43057:IGAApkiHCSo2iLgAKBiJQI4EDICxAAGABclJQgQEJNUI5wBQAjN4AQLYAhoAH20yCJDQISEBukTSAkgdHhMU7Bgpg1AhVqAY","ssdeep":"384:PdGh0XJZ1TJgZaTlEpgNVn3Sb1hGEWPgKlKcSWBlYPYul/V6n:P4h0XFeIRygNVnibjYPgK8cSWQPY2V6n"},"content_analysis":{"modules":{"language":{"results":{"confidence":0.8,"text_length":387,"language_info":{"name":"English","script":"Latin","direction":"ltr"},"agreement_ratio":1.0,"detection_method":"html_attribute_validated","primary_language":"en","script_detection":{"script":null,"confidence":0.0},"consistency_score":1.0,"dominant_language":"en","character_analysis":{"likely_language":null,"character_counts":{"french_specific":0,"german_specific":0,"polish_specific":0,"norwegian_danish":0,"swedish_specific":0}},"detected_languages":{},"html_lang_warnings":[],"html_lang_attribute":"en","html_lang_trust_score":1.0,"language_distribution":{"headings":{"language":"en","confidence":0.9999983928442553},"body_text":{"language":"en","confidence":0.5022494238747998}}},"version":"1.0.0","timestamp":1768187089.2209196},"classification":{"results":{"website_type":"webapp","all_categories":[{"name":"social media network","confidence":0.4992675483226776},{"name":"entertainment media","confidence":0.26779094338417053}],"primary_category":"social media network","language_agnostic":true,"primary_confidence":0.4992675483226776,"structural_features":{"og_type":null,"has_login":true,"has_crypto":false,"has_search":false,"domain_type":"unknown","has_payment":false,"has_articles":false,"has_comments":false,"has_products":false,"schema_types":[],"has_financial":false,"has_newsletter":false,"phishing_indicators":0},"classification_method":"ml+structural"},"version":"1.0.0","timestamp":1768187091.1514597}},"scan_id":"a6596377-0e50-4910-884c-999302b04827","analyzed_at":"2026-01-12T03:04:49.196867Z"},"domain_rankings":null,"rdap_data":{"domains":[{"domain":"edgeone.app","handle":"DF7BB180B-APP","parent_handle":"","name":"edgeone.app","whois_server":"","type":"domain","terms_of_service_url":"","description":[],"last_changed_date":"2025-10-14T07:20:29.186000Z","registration_date":"2023-05-10T03:27:26.272000Z","expiration_date":"2026-05-10T03:27:26.272000Z","rdap_url":"https://pubapi.registry.google/rdap/domain/edgeone.app","registrar":"MarkMonitor Inc.","status":["client delete prohibited","client transfer prohibited","client update prohibited"],"nameservers":["ns3.dnsv4.com","ns4.dnsv4.com"],"entities":{"abuse":[{"name":"Prudence Malinki","type":"entity","email":"registryescalations@markmonitor.com"}],"registrar":[{"url":"https://pubapi.registry.google/rdap/entity/292","name":"MarkMonitor Inc.","type":"entity","handle":"292"}]},"lookup_timestamp":"2026-01-12T03:04:52.168029Z"}],"ips":[{"ip_address":"216.58.209.170/32","handle":"NET-216-58-192-0-1","parent_handle":"NET-216-0-0-0-0","name":"GOOGLE","whois_server":"whois.arin.net","type":"ip network","terms_of_service_url":"https://www.arin.net/resources/registry/whois/tou/","description":[],"last_changed_date":"2012-01-27T21:50:20Z","registration_date":"2012-01-27T21:50:20Z","expiration_date":null,"rdap_url":"https://rdap.arin.net/registry/ip/216.58.192.0","rir":"arin","country":"","ip_version":4,"assignment_type":"direct allocation","network":"216.58.192.0/19","entities":{"abuse":[{"rir":"arin","tel":"+1-650-253-0000","url":"https://rdap.arin.net/registry/entity/ABUSE5250-ARIN","name":"Abuse","type":"entity","email":"network-abuse@google.com","handle":"ABUSE5250-ARIN","address":{"po_box":"","region":"","country":"","locality":"","ext_address":"","postal_code":"","street_address":""},"whois_server":"whois.arin.net"}],"technical":[{"rir":"arin","tel":"+1-650-253-0000","url":"https://rdap.arin.net/registry/entity/ZG39-ARIN","name":"Google LLC","type":"entity","email":"arin-contact@google.com","handle":"ZG39-ARIN","address":{"po_box":"","region":"","country":"","locality":"","ext_address":"","postal_code":"","street_address":""},"whois_server":"whois.arin.net"}],"registrant":[{"rir":"arin","url":"https://rdap.arin.net/registry/entity/GOGL","name":"Google LLC","type":"entity","handle":"GOGL","address":{"po_box":"","region":"","country":"","locality":"","ext_address":"","postal_code":"","street_address":""},"whois_server":"whois.arin.net"}],"administrative":[{"rir":"arin","tel":"+1-650-253-0000","url":"https://rdap.arin.net/registry/entity/ZG39-ARIN","name":"Google LLC","type":"entity","email":"arin-contact@google.com","handle":"ZG39-ARIN","address":{"po_box":"","region":"","country":"","locality":"","ext_address":"","postal_code":"","street_address":""},"whois_server":"whois.arin.net"}]},"lookup_timestamp":"2026-01-12T03:04:52.594329Z"}]},"domains_contacted":["cdnjs.cloudflare.com"],"unique_asns":[15169,139341,13335],"countries":["US","SG"],"ip_table":[{"ip":"43.152.26.58","asn":"AS139341","asn_name":"ACE","country":"SG","country_name":"Singapore","city":null,"state":null,"cdn":null,"requests":1},{"ip":"142.250.185.131","asn":"AS139341","asn_name":"ACE","country":"US","country_name":null,"city":null,"state":null,"cdn":null,"requests":0},{"ip":"142.250.185.138","asn":"AS13335","asn_name":"CLOUDFLARENET","country":"US","country_name":null,"city":null,"state":null,"cdn":null,"requests":0},{"ip":"104.17.25.14","asn":"AS13335","asn_name":"CLOUDFLARENET","country":"US","country_name":"United States","city":null,"state":null,"cdn":null,"requests":0},{"ip":"142.250.74.195","asn":null,"asn_name":null,"country":"US","country_name":null,"city":null,"state":null,"cdn":null,"requests":0}],"asn_table":[{"asn":"15169 (GOOGLE)","org":"GOOGLE"},{"asn":"139341 (ACE)","org":"ACE"},{"asn":"13335 (CLOUDFLARENET)","org":"CLOUDFLARENET"}],"asns":[15169,139341,13335],"primary_asn":139341,"primary_ip":"43.152.26.58","asn_orgs":{"13335":"CLOUDFLARENET","139341":"ACE","15169":"GOOGLE"},"asn_names":["GOOGLE","ACE","CLOUDFLARENET"],"ip_asn_info":{"ip_table":[{"ip":"43.152.26.58","asn":"AS139341","asn_name":"ACE","country":"SG","country_name":"Singapore","city":null,"state":null,"cdn":null,"requests":1},{"ip":"142.250.185.131","asn":"AS139341","asn_name":"ACE","country":"US","country_name":null,"city":null,"state":null,"cdn":null,"requests":0},{"ip":"142.250.185.138","asn":"AS13335","asn_name":"CLOUDFLARENET","country":"US","country_name":null,"city":null,"state":null,"cdn":null,"requests":0},{"ip":"104.17.25.14","asn":"AS13335","asn_name":"CLOUDFLARENET","country":"US","country_name":"United States","city":null,"state":null,"cdn":null,"requests":0},{"ip":"142.250.74.195","asn":null,"asn_name":null,"country":"US","country_name":null,"city":null,"state":null,"cdn":null,"requests":0}],"total_ips":5,"countries":["SG","US"]},"security_headers":{"headers":{},"missing_headers":[],"analyzed":false},"csp_analysis":null,"csp_policy":null,"iframes":null,"cors_findings":null,"network_requests":[],"total_requests":0,"ai_security_analysis":{"verdict":"Login page on a relatively old, unranked domain; no malicious indicators detected.","classification":"LOW_RISK","risk_score":2,"confidence_percentage":78,"threat_type":"Not Applicable","key_evidence":["Login form with email address and password fields detected via OCR","Domain age is 977 days (well established)","No malicious Indicators of Compromise matches found","No external links, redirects, or payment fields present"],"risk_factors":["Credential collection form on an unrecognized, unranked domain"],"safety_factors":["Domain has been registered for over 2.5 years","No malicious Indicators of Compromise detected","No external links or redirects","No payment or sensitive personal data fields beyond email/password","No brand impersonation or trademark misuse"],"recommended_action":"Use with caution","skipped_reason":null,"assessed_by":"ai","confidence_fixed":false},"network_data":{"redirects":[],"console_logs":[{"type":"log","message":"%c * Tone.js v14.8.49 *  background: #000; color: #fff","timestamp":"2026-01-12T03:04:51.089085+00:00"}],"ip_addresses":["43.152.26.58","142.250.185.131","142.250.185.138","104.17.25.14","142.250.74.195"],"total_requests":17,"dns_resolutions":{"www.gstatic.com":{"ip":"142.250.185.131","error":null,"status":"resolved"},"fonts.gstatic.com":{"ip":"142.250.74.195","error":null,"status":"resolved"},"cdnjs.cloudflare.com":{"ip":"104.17.25.14","error":null,"status":"resolved"},"fonts.googleapis.com":{"ip":"142.250.185.138","error":null,"status":"resolved"},"chicha-talks-i7o53wkws5.edgeone.app":{"ip":"43.152.26.58","error":null,"status":"resolved"}},"total_responses":1,"domains_contacted":["www.gstatic.com","fonts.gstatic.com","cdnjs.cloudflare.com","fonts.googleapis.com","chicha-talks-i7o53wkws5.edgeone.app"],"http_transactions":[{"request":{"url":"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==","type":"Image","method":"GET","headers":{"Pragma":"no-cache","Referer":"","Cache-Control":"no-cache, no-store, must-revalidate"}},"response":{"url":"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==","status":200,"headers":{"Content-Type":"image/gif"},"mimeType":"image/gif","protocol":"data","statusText":"OK","securityState":"unknown","remoteIPAddress":null,"encodedDataLength":0.0},"duration_ms":null}],"performance_metrics":{"request_count":1,"total_duration":null,"fastest_request":null,"slowest_request":null,"average_request_duration":null}},"local_storage":[],"session_storage":[],"domain_description":"Within the application-focused generic top-level domain (.app), 'chicha-talks-i7o53wkws5.edgeone.app' is registered with subdomain 'chicha-talks-i7o53wkws5'. Count 7 characters in 'edgeone' split between 4 vowels and 3 consonants. It segments into 2 words: edge, one. Average segment length settles at 3.5 characters. No strong language cues emerged from the frequency lists.","bot_detection":null,"capture_recovered":true,"recovered_capture_refused":null,"navigation_committed":true,"site_not_reached":null,"dns_not_found_host":null,"title_source":"regular","screenshot_version":null,"warning_page_detected":false,"warning_page_type":null,"warning_page_url":null,"extracted_target_url":null,"warning_bypass_successful":null,"warning_bypass_load_time":null,"sections_available":{"malware":false,"yara":false,"reports":false},"compacted":null,"verdicts_ready":true,"warning_bypass_error":null,"ocr_text":"Chicha Talks\n\nConnect with your chichas seamlessly.\nEmait Address\nPassword\n\nsion up ]\n\n","javascript_files":[{"url":"https://cdnjs.cloudflare.com/ajax/libs/tone/14.8.49/Tone.js","filename":"Tone.js","script_type":"external","content_sha256":"1261cdd3331d826237e7b0b954b5ed7d2381c8df4331d2018acea8c7a64a9a7b","is_whitelisted":true,"metrics":{"code_length":349169,"normalized_length":0,"function_count":0,"function_call_count":3681,"ast_node_count":0,"ast_depth":0,"url_count":0,"domain_count":null,"fuzzy_block_size":0,"module_count":0,"complexity_score":0.0},"ml_vectors":{"available":false,"codebert_available":false,"graphcodebert_available":false,"ast_features_available":false,"handcrafted_features_available":false,"composite_vector_available":false,"dimensions":{"codebert":768,"graphcodebert":768,"ast_features":128,"handcrafted":64,"composite":192}},"library_detection":{"detected":false,"primary_library":"","version":"","confidence":{},"all_libraries":[],"library_count":0},"copyright":{},"module_info":{"pattern":"","is_module":false,"import_count":0,"detected_modules":[]},"cdn_info":{"is_cdn":false,"cdn_type":null,"is_minified_url":false}},{"url":"inline://a6596377-0e50-4910-884c-999302b04827/script_1_25375d8d9ff82115","filename":null,"script_type":"inline","content_sha256":"25375d8d9ff82115330aea57f9005db4c9d59d6cd32f2ffc1ac81187a240da83","is_whitelisted":false,"metrics":{"code_length":26548,"normalized_length":18680,"function_count":69,"function_call_count":243,"ast_node_count":3522,"ast_depth":22,"url_count":6,"domain_count":null,"fuzzy_block_size":0,"module_count":0,"complexity_score":74},"ml_vectors":{"available":true,"codebert_available":true,"graphcodebert_available":true,"ast_features_available":true,"handcrafted_features_available":true,"composite_vector_available":false,"dimensions":{"codebert":768,"graphcodebert":768,"ast_features":128,"handcrafted":64,"composite":192}},"library_detection":{"detected":false,"primary_library":"","version":"","confidence":{},"all_libraries":[],"library_count":0},"copyright":{"authors":[],"licenses":[],"versions":[],"library_names":[],"copyright_count":0,"detected_library":null,"copyright_notices":[],"signature_matches":[],"retirejs_detection":null,"multiple_copyrights":false},"module_info":{"pattern":"application","is_module":true,"import_count":0,"detected_modules":[]},"cdn_info":{"is_cdn":false,"cdn_type":null,"is_minified_url":false}}],"url_metadata":{"is_redirect_wrapper":false,"wrapper_type":null,"extracted_destination":null,"fragment_data":null,"original_url":"https://chicha-talks-i7o53wkws5.edgeone.app/"},"parent_scan_id":null,"scan_relationship":null,"child_scans":[],"ioc_matches":null}