`+ie),Le&&(ie=vt(ie)),E&&bt?x(ie):ie},e.setConfig=function(){letk=arguments.length>0&&arguments[0]!==void0?arguments[0]:{};li(k),Zt=!0},e.clearConfig=function(){Ze=null,Zt=!1,E=M,C=""},e.isValidAttribute=function(k,d,y){Ze||li({});letT=Z(k),L=Z(d);returnor(T,L,y)},e.addHook=function(k,d){typeofd=="function"&&tt(A[k],d)},e.removeHook=function(k,d){if(d!==void0){lety=hs(A[k],d);returny===-1?void0:fs(A[k],y,1)[0]}returnyr(A[k])},e.removeHooks=function(k){A[k]=[]},e.removeAllHooks=function(){A=kr()},e}varRr=xr();varxt=classs{static_keyMetadata=newWeakMap;static_messageSanitizer=null;staticsortObjectKeys(e){if(typeofe!="object"||e===null)returne;if(Array.isArray(e))returne.map(s.sortObjectKeys);lett={};returnObject.keys(e).sort().forEach(i=>{t[i]=s.sortObjectKeys(e[i])}),t}staticassertCryptoKey(e,t=null,i=[]){if(!(einstanceofCryptoKey))thrownewError("Expected CryptoKey");if(t&&e.algorithm?.name!==t)thrownewError(`Expected algorithm ${t}, got ${e.algorithm?.name}`);for(letrofi)if(!e.usages||!e.usages.includes(r))thrownewError(`Missing required key usage: ${r}`)}staticarrayBufferToBase64(e){lett="",i=newUint8Array(e),r=i.byteLength;for(letn=0;n<r;n++)t+=String.fromCharCode(i[n]);returnbtoa(t)}staticbase64ToArrayBuffer(e){try{if(typeofe!="string"||!e)thrownewError("Invalid base64 input: must be a non-empty string");lett=e.trim();if(!/^[A-Za-z0-9+/]*={0,2}$/.test(t))thrownewError("Invalid base64 format");if(t==="")returnnewArrayBuffer(0);leti=atob(t),r=i.length,n=newUint8Array(r);for(leta=0;a<r;a++)n[a]=i.charCodeAt(a);returnn.buffer}catch(t){throwconsole.error("Base64 to ArrayBuffer conversion failed:",t.message),newError(`Base64 conversion error: ${t.message}`)}}statichexToUint8Array(e){try{if(!e||typeofe!="string")thrownewError("Invalid hex string input: must be a non-empty string");lett=e.replace(/:/g,"").replace(/\s/g,"");if(!/^[0-9a-fA-F]*$/.test(t))thrownewError("Invalid hex format: contains non-hex characters");if(t.length%2!==0)thrownewError("Invalid hex format: odd length");leti=newUint8Array(t.length/2);for(letr=0;r<t.length;r+=2)i[r/2]=parseInt(t.substr(r,2),16);returni}catch(t){throwconsole.error("Hex to Uint8Array conversion failed:",t.message),newError(`Hex conversion error: ${t.message}`)}}staticzeroizeBuffer(e){try{if(!e)return;lett=einstanceofUint8Array?e:einstanceofArrayBuffer?newUint8Array(e):null;if(!t||t.length===0)return;crypto.getRandomValues(t),t.fill(0)}catch{}}staticasyncencryptData(e,t){try{leti=typeofe=="string"?e:JSON.stringify(e),r=crypto.getRandomValues(newUint8Array(16)),n=newTextEncoder,a=n.encode(t),o=awaitcrypto.subtle.importKey("raw",a,{name:"PBKDF2"},!1,["deriveKey"]),c=awaitcrypto.subtle.deriveKey({name:"PBKDF2",salt:r,iterations:31e4,hash:"SHA-256"},o,{name:"AES-GCM",length:256},!1,["encrypt"]),l=crypto.getRandomValues(newUint8Array(12)),h=n.encode(i),u=awaitcrypto.subtle.encrypt({name:"AES-GCM",iv:l},c,h),p={version:"1.0",salt:Array.from(r),iv:Array.from(l),data:Array.from(newUint8Array(u)),timestamp:Date.now()},S=JSON.stringify(p);returns.arrayBufferToBase64(newTextEncoder().encode(S).buffer)}catch(i){throwconsole.error("Encryption failed:",i.message),newError(`Encryption error: ${i.message}`)}}staticasyncdecryptData(e,t){try{leti=s.base64ToArrayBuffer(e),r=newTextDecoder().decode(i),n=JSON.parse(r);if(!n.version||!n.salt||!n.iv||!n.data)thrownewError("Invalid encrypted data format");leta=newUint8Array(n.salt),o=newUint8Array(n.iv),c=newUint8Array(n.data),h=newTextEncoder().encode(t),u=awaitcrypto.subtle.importKey("raw",h,{name:"PBKDF2"},!1,["deriveKey"]),p=awaitcrypto.subtle.deriveKey({name:"PBKDF2",salt:a,iterations:31e4,hash:"SHA-256"},u,{name:"AES-GCM",length:256},!1,["decrypt"]),S=awaitcrypto.subtle.decrypt({name:"AES-GCM",iv:o},p,c),w=newTextDecoder().decode(S);try{returnJSON.parse(w)}catch{returnw}}catch(i){throwconsole.error("Decryption failed:",i.message),newError(`Decryption error: ${i.message}`)}}staticgenerateSecurePassword(){lete="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefgh
Please wait for real-time cryptographic verification to complete.`,"sec.verificationUnavailable":"Securityverificationnotavailable","chat.placeholder":"Typeanencryptedmessage\u2026","chat.send":"Sendmessage","chat.sendFiles":"Sendfiles","chat.hideFiles":"Hidefiles","chat.recordVoice":"Recordvoicemessage","chat.sendVoice":"Sendvoicemessage","chat.discard":"Discard","chat.codeBlock":"Sendasacodeblock(expandstheinput)","chat.codeHint":"Codesnippet\xB7formattingpreserved\xB7\u2318\u21B5tosend","chat.viewOnce":"Viewonce","chat.viewOnceTitle":"Viewonce-vanishesafterthepeerreadsit","chat.viewOncePrefix":"Viewonce\xB7","chat.viewOnceTap":"Viewonce\xB7taptoreveal","chat.viewedOnce":"Viewedonce","chat.disappearing":"Disappearingmessage-deletesonbothsides","chat.disappearAfter":"Disappearafter","chat.visibleFor":"Visiblefor","chat.timerPrefix":"Timer\xB7","chat.expired":"Thismessagehasexpired","chat.deleteForEveryone":"Deleteforeveryone","chat.sending":"Sending","chat.delivered":"Delivered","chat.notSent":"Notsent","chat.notSentReason":"Notsent-thesecurechannelisnotready.Reconnecttocontinue.","chat.encrypted":"Encrypted","chat.decrypted":"Decrypted","chat.encryptedOnDevice":"Encryptedonyourdevice","chat.uploading":"Uploading","chat.downloading":"Downloading","chat.transferring":"Transferring\u2026","chat.copied":"Copied!","chat.collapse":"Collapse","chat.closeMenu":"Closemenu","chat.newChat":"Newchat","chat.newGroup":"Newgroup","chat.createGroup":"Createagroup","chat.groupChats":"Groupchats","chat.secureChat":"Securechat","chat.nameThis":"Namethischat","chat.rename":"Renamechat(localonly)","chat.renameHint":"Double-clicktorename","chat.localLabel":"Locallabel\xB7storedonlyonthisdevice","chat.setStatus":"Setyourstatus","chat.yourStatusPrefix":"Yourstatus-","chat.meshHint":"Upto8peers\xB7P2Pmesh","chat.offline":"Offline","chat.noNetwork":"Nonetwork\xB7reconnecting","chat.startVoiceCall":"Startencryptedvoicecall","chat.startVideoCall":"Startencryptedvideocall","chat.verifyForCalls":"Verifythesessiontoenablecalls","chat.e2eeNote":"Everymessageisend-to-endencryptedonyourdevicebeforeitleaves.","chat.peersOnly":"Sentend-to-endtoconnectedpeersonly-neverstoredonaserver.","flow.invitationCreated":"Secureinvitationcreated","flow.invitationCreatedBang":"Secureinvitationcreatedandencrypted!","flow.responseCreated":"Secureresponsecreated","flow.responseCreatedBang":"Secureresponsecreated!","flow.sendInvitation":"Sendtheinvitationcodetoyourinterlocutorviaasecurechannel(voicecall,SMS,etc.).","flow.sendResponse":"SendtheresponsecodetotheinitiatorviaasecurechannelorletthemscantheQRcodebelow.","flow.sendEncryptedCode":"Sendtheencryptedcode","flow.sendTheResponse":"Sendtheresponse","flow.pasteOrWrite":"Pasteorwritecode\u2026","flow.processingInvitation":"Processingthesecureinvitation...","flow.processingResponse":"Processingthesecureresponse...","flow.finalizing":"Finalizingthesecureconnection...","flow.channelEstablished":"Securechannelestablished","flow.channelReady":"Securechannelisready","flow.restoring":"Restoringconnection\u2026","flow.invitationCaptured":"Invitationcaptured.","err.needInvitation":"Youneedtoinserttheinvitationcodefromyourinterlocutor.","err.needResponse":"Youneedtoinserttheresponsecodefromyourinterlocutor.","err.responseFormat":"Invalidresponseformat-pleasecheckthecode","err.responseNoKey":"Invalidresponsecode-missingorcorruptedcryptographickey.Pleasecheckthecodeandtryagain.","err.responseNoSignKey":"Invalidresponsecode-missingsignatureverificationkey.Pleasecheckthecodeandtryagain.","err.responseOutdated":"Responsedataisoutdated-pleaseuseafreshinvitation","err.setupError":"Connectionsetuperror","err.notReady":"Connectionnotready","err.securityBreach":"Securitybreachdetected-connectionrejected","err.securityValidation":"Securityvalidationfailed-poss
`)!==-1?`\r
`:`
`}function Ur(s){let e=js(s),t=s.split(/\r\n|\n/),i=[],r=[],n=null;for(let a of t)a.startsWith("m=")?(n={lines:[a]},r.push(n)):n?n.lines.push(a):i.push(a);return{eol:e,session:i,media:r}}function zr(s){let e=[...s.session];for(let t of s.media)e.push(...t.lines);return e.join(s.eol)}function Vr(s){let e=s.lines[0].match(/^m=(\w+)/);return e?e[1]:null}function Ws(s,e){let t=new RegExp("^a=rtpmap:(\\d+)\\s+"+e+"\\/","i"),i=[];for(let r of s.lines){let n=r.match(t);n&&i.push(n[1])}return i}function Ys(s){let e=new Map;for(let t of s.split(";")){let i=t.trim();if(!i)continue;let r=i.indexOf("=");r===-1?e.set(i,void 0):e.set(i.slice(0,r).trim(),i.slice(r+1).trim())}return e}function Or(s){let e=[];for(let[t,i]of s)e.push(i===void 0?t:`${t}=${i}`);return e.join(";")}function Xs(s,e,t){let i=s.lines.findIndex(o=>o.startsWith(`a=fmtp:${e}`)||o===`a=fmtp:${e}`);if(i!==-1){let o=s.lines[i].slice(`a=fmtp:${e}`.length),c=Ys(o);for(let[l,h]of Object.entries(t))c.set(l,String(h));s.lines[i]=`a=fmtp:${e}${Or(c)}`;return}let r=new Map;for(let[o,c]of Object.entries(t))r.set(o,String(c));let n=`a=fmtp:${e}${Or(r)}`,a=s.lines.findIndex(o=>o.startsWith(`a=rtpmap:${e}`));a!==-1?s.lines.splice(a+1,0,n):s.lines.push(n)}function bi(s,e){if(!s||typeof s!="string")return s;let t=Ur(s),i=!1;for(let r of t.media)if(Vr(r)==="audio")for(let n of Ws(r,"opus"))Xs(r,n,e),i=!0;return i?zr(t):s}var Qs=/^(rtx|red|ulpfec|flexfec-03|telephone-event|CN)$/i;function Js(s){let e=[];for(let t of s.lines){let i=t.match(/^a=rtpmap:(\d+)\s+([^/]+)\//);i&&!Qs.test(i[2])&&e.push(i[1])}return e}function Zs(s,e){for(let t of Js(s))for(let i of e){let r=`a=rtcp-fb:${t}${i}`;if(s.lines.includes(r))continue;let n=-1;for(let a=0;a<s.lines.length;a++){let o=s.lines[a];(o.startsWith(`a=rtpmap:${t}`)||o.startsWith(`a=fmtp:${t}`)||o.startsWith(`a=rtcp-fb:${t}`))&&(n=a)}n===-1&&(n=s.lines.length-1),s.lines.splice(n+1,0,r)}}function ea(s,e){if(s.lines.some(r=>r.startsWith("a=extmap:")&&r.includes(e)))return;let t=0,i=-1;for(let r=0;r<s.lines.length;r++){let n=s.lines[r].match(/^a=extmap:(\d+)/);n&&(t=Math.max(t,Number(n[1])),i=r)}i===-1&&(i=s.lines.findIndex(r=>r.startsWith("a=mid:")),i===-1&&(i=s.lines.length-1)),s.lines.splice(i+1,0,`a=extmap:${t+1}${e}`)}function Br(s,e){if(!s||typeof s!="string"||!e)return s;let t=Ur(s),i=!1;for(let r of t.media){let n=Vr(r),a=n==="video"?e.video:n==="audio"?e.audio:null;a&&(Array.isArray(a.rtcpFb)&&(Zs(r,a.rtcpFb),i=!0),a.twcc&&e.twccUri&&(ea(r,e.twccUri),i=!0))}return i?zr(t):s}function Hr(s){try{if(Ue||!s||typeof s.setCodecPreferences!="function"||!st.preferRed)return!1;let e=typeof RTCRtpSender<"u"&&RTCRtpSender.getCapabilities?RTCRtpSender.getCapabilities("audio"):null;if(!e||!Array.isArray(e.codecs))return!1;let t=o=>/red$/i.test(o.mimeType),i=o=>/opus$/i.test(o.mimeType);if(!e.codecs.some(t))return!1;let r=e.codecs.filter(t),n=e.codecs.filter(i),a=e.codecs.filter(o=>!t(o)&&!i(o));return s.setCodecPreferences([...r,...n,...a]),!0}catch{return!1}}async function $r(s,e={}){try{if(Ue||!s||typeof s.getParameters!="function")return!1;let t={...st.sender,...e},i=s.getParameters();(!i.encodings||i.encodings.length===0)&&(i.encodings=[{}]);for(let r of i.encodings)r.maxBitrate=t.maxBitrate,r.priority=t.priority,r.networkPriority=t.networkPriority;return await s.setParameters(i),!0}catch{return!1}}var Gr={VP9:0,AV1:1,H264:2,VP8:3};function qr(s){return(String(s||"").split("/")[1]||"").toUpperCase()}function ta(s){let e=t=>{let i=qr(t.mimeType);return Object.prototype.hasOwnProperty.call(Gr,i)?Gr[i]:99};return s.map((t,i)=>({c:t,i})).sort((t,i)=>e(t.c)-e(i.c)||t.i-i.i).map(t=>t.c)}function jr(s){if(!s||!Array.isArray(s.codecs))return null;let e=new Set(s.codecs.map(t=>qr(t.mimeType)));for(let t of xe.codecPreferenceOrder)if(e.has(t))return t;return null}function Wr(){return typeof RTCRtpSender<"u"&&RTCRtpSender.getCapabilities?RTCRtpSender.getCapabilities("video"):null}function Yr(s){try{if(Ue||!s||typeof s.setCodecPreferences!="function")return!1;let e=Wr();return!e||!Array.isArray(e.codecs)?!1:(s.setCodecPreferences(ta(e.codecs)),jr
`)+`\r
`}}varPi=newTextEncoder;functionUt(...s){lete=s.reduce((r,n)=>r+n.length,0),t=newUint8Array(e),i=0;for(letrofs)t.set(r,i),i+=r.length;returnt}asyncfunctionFi(s,e){return(awaits(Ut(Pi.encode("sbq2/bind\0"),e))).slice(0,G.BINDING_BYTES)}asyncfunctionzt(s,e){return(awaits(Ut(Pi.encode("sbq2/blob\0"),e))).slice(0,G.COMMITMENT_BYTES)}functionfn(s,e,t,i){letr=n=>{leta=newUint8Array(4);returnnewDataView(a.buffer).setUint32(0,n.length),Ut(a,n)};returnUt(Pi.encode("sbq2/sas/v1\0"),r(s),r(e),r(t),r(i))}vargt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";functionwa(s){lete="";for(lett=0;t<s.length;t+=3){leti=s[t],r=s[t+1],n=s[t+2];if(e+=gt[i>>2],e+=gt[(i&3)<<4|(r??0)>>4],r===void0||(e+=gt[(r&15)<<2|(n??0)>>6],n===void0))break;e+=gt[n&63]}returne}functionEa(s){typeofs!="string"&&P("payload must be a string");lete=s.replace(/\s+/g,"");e.length>Math.ceil(G.MAX_PAYLOAD_BYTES*4/3)+4&&P("payload is too long"),/^[A-Za-z0-9_-]*$/.test(e)||P("payload contains characters outside base64url"),e.length%4===1&&P("payload has an impossible length");lett=newUint8Array(Math.floor(e.length*3/4)),i=0,r=0,n=0;for(letaofe)r=r<<6|gt.indexOf(a),n+=6,n>=8&&(n-=8,t[i++]=r>>n&255);returnr&(1<<n)-1&&P("payload has non-zero padding bits"),t.subarray(0,i)}varIi="SB2:";functionpn(s){returnIi+wa(s)}functionKi(s){typeofs!="string"&&P("payload must be a string");lete=s.trim();returne.startsWith(Ii)||P("not an SB2 descriptor"),Ea(e.slice(Ii.length))}varyn=2,be=Object.freeze({OFFER:0,ANSWER:1}),We=Object.freeze({MAX_SPKI:256,MIN_SPKI:40,MAX_SIG:160,MIN_SIG:48,MAX_BLOB_BYTES:1024}),Ni=classextendsError{constructor(e,t="key_exchange"){super(e),this.name="KeyExchangeError",this.code=t}},de=(s,e)=>{thrownewNi(s,e)};functiongn({role:s,ecdhSpki:e,ecdsaSpki:t}){s!==be.OFFER&&s!==be.ANSWER&&de("invalid role");for(let[a,o]of[["ecdh",e],["ecdsa",t]])oinstanceofUint8Array||de(`${a} SPKI must be a Uint8Array`),(o.length<We.MIN_SPKI||o.length>We.MAX_SPKI)&&de(`${a} SPKI length out of range`);leti=newUint8Array(4+e.length+2+t.length),r=newDataView(i.buffer),n=0;returni[n++]=yn,i[n++]=s,r.setUint16(n,e.length),n+=2,i.set(e,n),n+=e.length,r.setUint16(n,t.length),n+=2,i.set(t,n),i}functionmn(s){sinstanceofUint8Array||de("key blob must be a Uint8Array"),s.length===0&&de("key blob is empty"),s.length>We.MAX_BLOB_BYTES&&de("key blob exceeds the size limit");lete=newDataView(s.buffer,s.byteOffset,s.byteLength),t=0,i=h=>{t+h>s.length&&de("key blob is truncated")};i(1);letr=s[t++];r!==yn&&de(`unsupported key blob version 0x${r.toString(16)}`,"version"),i(1);letn=s[t++];n!==be.OFFER&&n!==be.ANSWER&&de("reserved key blob role"),i(2);leta=e.getUint16(t);t+=2,(a<We.MIN_SPKI||a>We.MAX_SPKI)&&de("ECDH SPKI length out of range"),i(a);leto=s.slice(t,t+a);t+=a,i(2);letc=e.getUint16(t);t+=2,(c<We.MIN_SPKI||c>We.MAX_SPKI)&&de("ECDSA SPKI length out of range"),i(c);letl=s.slice(t,t+c);returnt+=c,t!==s.length&&de(`${s.length-t} trailing byte(s) after the key blob`),{version:r,role:n,ecdhSpki:o,ecdsaSpki:l}}functionSn({offerDescriptor:s,answerDescriptor:e,offerBlob:t,answerBlob:i}){for(let[r,n]ofObject.entries({offerDescriptor:s,answerDescriptor:e,offerBlob:t,answerBlob:i}))(!(ninstanceofUint8Array)||n.length===0)&&de(`transcript component ${r} is missing`);returnfn(s,e,t,i)}asyncfunction_n(s,e){lett=awaits.digest("SHA-512",e);returnArray.from(newUint8Array(t))}varwn=newTextEncoder;functionOi(s){lete=wn.encode("sbq2/proof/v1\0"),t=newUint8Array(e.length+s.length);returnt.set(e,0),t.set(s,e.length),t}asyncfunctionEn(s,{ecdhPrivateKey:e,peerEcdhPublicKey:t,transcript:i,digits:r=7}){letn=awaits.deriveBits({name:"ECDH",public:t},e,256),a=null;try{a=awaits.importKey("raw",n,"HKDF",!1,["deriveBits"]);leto=newUint8Array(awaits.digest("SHA-256",i)),c=awaits.deriveBits({name:"HKDF",hash:"SHA-256",salt:o,info:wn.encode("sbq2-sas-v1")},a,64),l=newDataView(c),h=(l.getUint32(0)^l.getUint32(4))>>>0,u=10**r;returnString(h%u).padStart(r,"0")}finally{try{newUint8Array(n).fill(0)}catch{}}}asyncfuncti
`).map(i=>i.trim()).filter(Boolean).map(i=>({urls:i}));returnIn(t)}functionLn(s){returnArray.isArray(s)?s.some(e=>(Array.isArray(e?.urls)?e.urls:[e?.urls]).some(Rn)):!1}varVe=window.React,Fa=["# One URL per line, e.g.:","stun:stun.example.com:3478","turn:turn.example.com:3478?transport=udp","","# Or paste JSON for servers with credentials:",'[{"urls":"turns:turn.example.com:5349","username":"user","credential":"secret"}]'].join(`
(*! @license DOMPurify 3.4.10 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.10/LICENSE *)