"use strict";(globalThis.webpackChunkgroup_speed_dial=globalThis.webpackChunkgroup_speed_dial||[]).push([[141],{596:(t,e,a)=>{a.d(e,{D:()=>o});const o=()=>Promise.all([a.e(611),a.e(900)]).then(a.bind(a,7033))},1604:(t,e,a)=>{a.d(e,{e:()=>n});var o=a(6849);const n=(t,e)=>{const{column:a,capitalize:n,lowercase:s,substitutions:i}=e||{};let r=(0,o.tr)(t,i);return!0!==a&&!1!==a||(r.endsWith(":")?a||(r=r.slice(0,-1)):a&&(r+=":")),n&&(r=r[0].toLocaleUpperCase()+r.slice(1)),s&&(r=r.toLocaleLowerCase()),r}},5708:(t,e,a)=>{a.r(e),a.d(e,{showHistoryModal:()=>C});var o=a(9421),n=a(6849),s=a(4135),i=a(1816),r=a(8653),c=a(1619),l=a(6719),p=a(8197),d=a(6994),u=a(1608),h=a(8955),m=a(596),w=a(8177),_=a(4449),g=a(6002),y=a(963),b=a(1604),f=a(3532);async function C(){let t;const e=document.createElement("div"),a=(0,c.z)("select",{size:7,style:"min-width: 300px",handlers:{onchange:x}},[(0,c.z)("option",{textContent:(0,n.tr)("history_loading")})]),C=(0,c.z)("p",{class:"flex flex-space-between"},[(0,c.z)("label",{textContent:(0,n.tr)("label_see_also")}),(0,c.z)("a",{target:"_blank",href:(0,y.Z)("/popup/popup.html#OptionsImportBackup"),textContent:(0,b.e)("o_backup_restore",{column:!1})})]);function v(e){t=e.sort((0,_.s)("date",!1));const o=a.value;a.replaceChildren(...t.map((t=>(0,c.z)("option",{value:t.id,textContent:`${(0,r.Ib)(t.date)}: ${t.name}`,title:t.name})))),a.value=o}async function x(){const e=t.filter((t=>t.id===+a.value))[0];if(!e)return;const o=e.metadata?.folders?.map((t=>new f.v(t))),n=e.groups.map(g.$),s=n.find((t=>t.id===d.e.id));s&&await(0,i.Wx)(s),await(0,u.N)(n,o)}async function z(){d.e.removeOnChange(x),await(0,i.Pz)()}o.p.show((0,n.tr)("op_history"),(0,c.z)("div",{},[e,C,a]),{yesText:(0,n.tr)("history_restore"),noText:(0,n.tr)("history_cancel"),onYes:()=>{const e=t.filter((t=>t.id===+a.value))[0];e&&p.M.action("importData",{replaceExisting:!0,groups:e.groups,metadata:e.metadata},(0,n.tr)("save_history_restored"))},onNo:z,onClose:z}),a.focus(),d.e.addOnChange(x),await(async()=>{await(0,s.$A)(e,(()=>h.i.withDB((async t=>{const e=await t.dbTransactionOperation(l.ew.DB_HISTORY,l.p0.DB_OP_READONLY,"getAll");v(e);const a=(await(await(0,m.D)()).getSyncBackups().catch((t=>[]))).map((t=>({...t,id:-(0,w.V)(),name:(0,n.tr)("automatic_backup")})));v(e.concat(a))}))))})().catch((t=>{throw e.textContent="Error: "+JSON.stringify(t),t}))}}}]);