"use strict";(globalThis.webpackChunkgroup_speed_dial=globalThis.webpackChunkgroup_speed_dial||[]).push([[499],{213:(e,t,r)=>{r.d(t,{o:()=>s});class s{alphabet;#e;constructor(e){this.alphabet=e,this.#e=BigInt(e.length)}encode(e){if(0===e.length)return"";let t=0n;for(let r=0;r<e.length;r++)t=t<<8n|BigInt(e[r]);const r=[];if(0n===t)return this.alphabet[0];for(;t>0n;){const e=Number(t%this.#e);r.push(this.alphabet[e]),t/=this.#e}return r.reverse().join("")}decode(e){if(0===e.length)return new Uint8Array(0);let t=0n;for(let r=0;r<e.length;r++){const s=this.alphabet.indexOf(e[r]);if(-1===s)throw new Error(`Invalid character at position ${r}: ${e[r]}`);t=t*this.#e+BigInt(s)}if(0n===t)return new Uint8Array([0]);let r=t,s=0;for(;r>0n;)r>>=8n,s++;const a=new Uint8Array(s);for(let e=s-1;e>=0;e--)a[e]=Number(0xffn&t),t>>=8n;return a}}},1339:(e,t,r)=>{function s(e,t){const r=e();return new Promise(((e,s)=>{r.postMessage(t),r.onmessageerror=s,r.onerror=s,r.onmessage=t=>e(t.data)})).finally((()=>r.terminate()))}r.d(t,{c:()=>s})},4971:(e,t,r)=>{r.d(t,{K:()=>l});var s=(e=>(e[e.RAW=0]="RAW",e[e.BASE_64=1]="BASE_64",e[e.BASE_93=2]="BASE_93",e))({}),a=(e=>(e[e.LZ=0]="LZ",e[e.LZMA=1]="LZMA",e))({}),n=r(565),i=r(9991),c=r(8e3),o=(r(7475),r(9415));class h{passwordHashWithSecret;lzutf8;keyPromise;constructor(e,t){this.passwordHashWithSecret=e,this.lzutf8=t,this.keyPromise=new o.k(e).unwrapKey(e.options.secret)}async encrypt(e,{encoding:t,compression:r}){performance.now();const o=JSON.stringify(e);let h;switch(r){default:case a.LZ:h=await this.lzutf8.compress(o);break;case a.LZMA:h=await(0,i.v)(o)}const p=self.crypto.getRandomValues(new Uint8Array(12)),d=await self.crypto.subtle.encrypt({name:"AES-GCM",iv:p},await this.keyPromise,h);let u;switch(t){default:case s.RAW:u=(0,n.JR)(d);break;case s.BASE_64:u=btoa((0,n.JR)(d));break;case s.BASE_93:u=await(0,c.h)(new Uint8Array(d))}return{ciphertext:u,iv:[...p],en:t,cp:r}}async decrypt({ciphertext:e,iv:t,cp:r,en:o}){let h;switch(o){default:case s.RAW:h=(0,n.Al)(e);break;case s.BASE_64:h=(0,n.Al)(atob(e));break;case s.BASE_93:h=await(0,c.A)(e)}const p=await self.crypto.subtle.decrypt({name:"AES-GCM",iv:new Uint8Array(t)},await this.keyPromise,h);let d;switch(r){default:case a.LZ:d=await this.lzutf8.decompress(new Uint8Array(p));break;case a.LZMA:d=await(0,i.O)(new Uint8Array(p))}return JSON.parse(d)}}var p=r(4840),d=r(4571),u=r(8778);class l{ciphertext;cp;en;iv;pwdOptions;accessSecret;constructor(e){Object.assign(this,e)}async decrypt(e){const t=new h({hash:e,options:this.pwdOptions});return await t.decrypt(this)}static async encrypt(e,t){const r=new d.w("Encryption:"),n=await l.generateNewPassword(t,"SHA-256",5e6);r.diff("generated password hash");const i=new h(n),c=await i.encrypt(e,{encoding:s.BASE_93,compression:a.LZMA});return r.diff("encrypted + encoded"),r.stop("Total"),new l({...c,pwdOptions:n.options,accessSecret:await(0,u.d)(n.hash,"SHA-256")})}static async generateNewPassword(e,t,r){const s=await self.crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]);return await(0,p.mA)(e,s,{iterations:r,salt:(0,n.gU)(128),hash:t})}}},8e3:(e,t,r)=>{r.d(t,{A:()=>h,h:()=>o});var s=r(1339);function a(){return new Worker(r.p+"base93.worker.worker.js")}var n=r(213),i=r(5782);const c=" !#$%&'()*+,-./0123456789:;=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~";async function o(e){return i.x?new n.o(c).encode(e):(0,s.c)(a,{type:"encode",alphabet:c,buffer:e})}async function h(e){return i.x?new n.o(c).decode(e):(0,s.c)(a,{type:"decode",alphabet:c,data:e})}},9191:(e,t,r)=>{r.r(t),r.d(t,{SharedGroups:()=>c});var s=r(471),a=r(4971),n=r(8309),i=r(6849);class c{uuidBase64;shared;get theme(){return this.shared.theme}get name(){return this.shared.name}groupsPromise;keyVault;constructor(e,t){this.uuidBase64=e,this.shared=t,this.keyVault=t.encrypted?new s.e(`_pwdVault${this.uuidBase64}`,(()=>this.shared.encrypted?.pwdOptions),{title:`${(0,i.tr)("share_unlock")}: ${this.shared.name}`},(e=>this.verifyHashCRC(e))):null,this.groupsPromise=this.initGroupData()}async verifyHashCRC(e){const t=await(0,n.V6)(e);return"error"in t?"":(this.shared=t.data,t.data.encrypted.pwdOptions.secret||"")}async initGroupData(){const e=[];if(this.shared.encrypted){await this.keyVault.unlockIfNeeded({persistent:!0});const t=await this.keyVault.decryptData(new a.K(this.shared.encrypted));t&&e.push(...t.groups)}return this.shared.groups.concat(e)}async lock(){await(this.keyVault?.lock())}}},9991:(e,t,r)=>{r.d(t,{v:()=>c,O:()=>o});var s=r(1339);function a(){return new Worker(r.p+"lzma_high_compressor.worker.worker.js")}var n=r(611),i=r(5782);async function c(e,t=9){return i.x?new Uint8Array(n.j.compress(e,t)):(0,s.c)(a,{type:"compress",mode:t,data:e})}async function o(e){return i.x?n.j.decompress(e):(0,s.c)(a,{type:"decompress",byteArray:e})}}}]);