import{u as Ft,m as y,d as C,e as g,F as Qe,E as ct,j as k,k as P,n as W,t as I,f as p,U as De,g as Re,I as gn,l as ie,r as te,J as it,K as vn,y as bn,p as Rt,h as ye,i as z,L as Jt,M as _n,N as wn,D as Ye,O as Yt,P as rt,Q as yn,a as En,R as Sn,S as Dn,b as kn,T as Cn,s as _t,x as $n,o as Tn,H as wt,C as Te,V as On,z as yt,W as In,w as Et,X as Xe,A as zt,Y as An}from"./app-D4Udf6Mm.js";import{_ as Mn,a as xn,b as Pn}from"./OtpDisplay-D2QMFFL_.js";import{_ as Nn}from"./SearchBox-B-38rGG5.js";import{u as Fn}from"./bus-RVphoWuw.js";import"./Spinner-DHClvaFf.js";/*! 2FAuth version 5.4.1 - Copyright (c) 2024 Bubka - https://github.com/Bubka/2FAuth */const Rn={id:"groupSwitch",class:"container groups"},Bn={class:"columns is-centered"},Gn={class:"column is-one-third-tablet is-one-quarter-desktop is-one-quarter-widescreen is-one-quarter-fullhd"},Ln={class:"columns is-multiline"},Xn=["onClick"],Yn={class:"columns is-centered"},zn={class:"column has-text-centered"},Un={__name:"GroupSwitch",props:{showGroupSwitch:Boolean,groups:Array},emits:["update:showGroupSwitch"],setup(o,{emit:e}){const n=Ft(),t=e;function i(r){n.preferences.activeGroup=r,n.preferences.rememberActiveGroup&&gn.updatePreference("activeGroup",r),t("update:showGroupSwitch",!1)}return(r,s)=>{const l=ie("RouterLink"),u=ie("ButtonBackCloseCancel"),a=ie("VueFooter");return y(),C("div",Rn,[g("div",Bn,[g("div",Gn,[g("div",Ln,[(y(!0),C(Qe,null,ct(o.groups,f=>(y(),C("div",{class:"column is-full",key:f.id},[k(p(De),null,{default:P(({mode:c})=>[g("button",{class:W(["button is-fullwidth",{"is-dark has-text-light is-outlined":c=="dark"}]),onClick:E=>i(f.id)},I(f.name),11,Xn)]),_:2},1024)]))),128))]),g("div",Yn,[g("div",zn,[k(l,{to:{name:"groups"}},{default:P(()=>[Re(I(r.$t("groups.manage_groups")),1)]),_:1})])])])]),k(a,{showButtons:!0},{default:P(()=>[k(u,{action:"close",useLinkTag:!1,onClosed:s[0]||(s[0]=f=>r.$emit("update:showGroupSwitch",!1))})]),_:1})])}}},Hn={class:"container group-selector"},qn={class:"columns is-centered is-multiline"},Wn={class:"column is-full has-text-centered"},Vn={class:"column is-one-third-tablet is-one-quarter-desktop is-one-quarter-widescreen is-one-quarter-fullhd"},jn={class:"columns is-multiline"},Kn=["onClick"],Qn={key:0,class:"is-italic"},Zn={key:1},Jn={class:"columns is-centered"},eo={class:"column has-text-centered"},to={class:"control"},no={__name:"DestinationGroupSelector",props:{showDestinationGroupSelector:Boolean,selectedAccountsIds:Array,groups:Array},emits:["update:showDestinationGroupSelector","accounts-moved"],setup(o,{emit:e}){const n=o,t=te(null),i=e;async function r(){t.value===0?await it.withdraw(n.selectedAccountsIds):await vn.assign(n.selectedAccountsIds,t.value),i("accounts-moved")}return(s,l)=>{const u=ie("RouterLink"),a=ie("ButtonBackCloseCancel"),f=ie("VueFooter");return y(),C("div",Hn,[g("div",qn,[g("div",Wn,I(s.$t("groups.move_selected_to")),1),g("div",Vn,[g("div",jn,[(y(!0),C(Qe,null,ct(o.groups,c=>(y(),C("div",{class:"column is-full",key:c.id},[k(p(De),null,{default:P(({mode:E})=>[g("button",{class:W(["button is-fullwidth",{"is-link":p(t)===c.id,"is-dark has-text-light is-outlined":E=="dark"}]),onClick:D=>t.value=c.id},[c.id===0?(y(),C("span",Qn,I(s.$t("groups.no_group")),1)):(y(),C("span",Zn,I(c.name),1))],10,Kn)]),_:2},1024)]))),128))]),g("div",Jn,[g("div",eo,[k(u,{to:{name:"groups"}},{default:P(()=>[Re(I(s.$t("groups.manage_groups")),1)]),_:1})])])])]),k(f,{showButtons:!0},{default:P(()=>[g("p",to,[g("button",{class:"button is-link is-rounded",onClick:r},I(s.$t("commons.move")),1)]),k(a,{action:"cancel",useLinkTag:!1,onCanceled:l[0]||(l[0]=c=>s.$emit("update:showDestinationGroupSelector",!1))})]),_:1})])}}},oo={class:"toolbar has-text-centered"},io={class:"columns"},ro={class:"column has-nowrap px-0"},so={class:"has-text-grey mr-1"},ao=["title"],lo=["title"],uo=["title"],co=["title"],fo={__name:"Toolbar",props:{selectedCount:Number},setup(o){return(e,n)=>{const t=ie("FontAwesomeIcon");return y(),C("div",oo,[g("div",io,[g("div",ro,[g("span",so,I(e.$t("commons.x_selected",{count:o.selectedCount})),1),g("button",{id:"btnUnselectAll",onClick:n[0]||(n[0]=i=>e.$emit("clear-selected")),class:"clear-selection delete mr-4",style:bn({visibility:o.selectedCount>0?"visible":"hidden"}),title:e.$t("commons.clear_selection")},null,12,ao),g("button",{id:"btnSelectAll",onClick:n[1]||(n[1]=i=>e.$emit("select-all")),class:"button mr-5 has-line-height p-1 is-ghost has-text-grey",title:e.$t("commons.select_all")},[g("span",null,I(e.$t("commons.check_all")),1),k(t,{class:"ml-1",icon:["fas","check-square"]})],8,lo),g("button",{id:"btnSortAscending",onClick:n[2]||(n[2]=i=>e.$emit("sort-asc")),class:"button has-line-height p-1 is-ghost has-text-grey",title:e.$t("commons.sort_ascending")},[k(t,{icon:["fas","sort-alpha-down"]})],8,uo),g("button",{id:"btnSortDescending",onClick:n[3]||(n[3]=i=>e.$emit("sort-desc")),class:"button has-line-height p-1 is-ghost has-text-grey",title:e.$t("commons.sort_descending")},[k(t,{icon:["fas","sort-alpha-up"]})],8,co)])])])}}},po={key:0,class:"control"},ho={class:"icon is-small"},mo={key:1,class:"control"},go={key:2,class:"control"},vo=["disabled","title"],bo={key:3,class:"control"},_o=["disabled"],wo={key:4,class:"control"},yo=["disabled","title"],Eo={__name:"ActionButtons",props:{inManagementMode:Boolean,areDisabled:Boolean},emits:["update:inManagementMode","move-button-clicked","delete-button-clicked","export-button-clicked"],setup(o,{emit:e}){const n=Rt(),t=Ft();function i(){t.preferences.useDirectCapture&&t.preferences.defaultCaptureMode==="advancedForm"?n.push({name:"createAccount"}):t.preferences.useDirectCapture&&t.preferences.defaultCaptureMode==="livescan"?n.push({name:"capture"}):n.push({name:"start"})}return(r,s)=>{const l=ie("FontAwesomeIcon");return y(),ye(p(De),null,{default:P(({mode:u})=>[o.inManagementMode?z("",!0):(y(),C("p",po,[g("button",{class:"button is-link is-rounded is-focus",onClick:i},[g("span",null,I(r.$t("commons.new")),1),g("span",ho,[k(l,{icon:["fas","qrcode"]})])])])),o.inManagementMode?z("",!0):(y(),C("p",mo,[g("button",{id:"btnManage",class:W(["button is-rounded",{"is-dark":u=="dark"}]),onClick:s[0]||(s[0]=a=>r.$emit("update:inManagementMode",!0))},I(r.$t("commons.manage")),3)])),o.inManagementMode?(y(),C("p",go,[g("button",{id:"btnMove",disabled:o.areDisabled,class:W(["button is-rounded",[{"is-outlined":u=="dark"||o.areDisabled},o.areDisabled?"is-dark":"is-link"]]),onClick:s[1]||(s[1]=a=>r.$emit("move-button-clicked")),title:r.$t("groups.move_selected_to_group")},I(r.$t("commons.move")),11,vo)])):z("",!0),o.inManagementMode?(y(),C("p",bo,[g("button",{id:"btnDelete",disabled:o.areDisabled,class:W(["button is-rounded",[{"is-outlined":u=="dark"||o.areDisabled},o.areDisabled?"is-dark":"is-link"]]),onClick:s[2]||(s[2]=a=>r.$emit("delete-button-clicked"))},I(r.$t("commons.delete")),11,_o)])):z("",!0),o.inManagementMode?(y(),C("p",wo,[g("button",{id:"btnExport",disabled:o.areDisabled,class:W(["button is-rounded",[{"is-outlined":u=="dark"||o.areDisabled},o.areDisabled?"is-dark":"is-link"]]),onClick:s[3]||(s[3]=a=>r.$emit("export-button-clicked")),title:r.$t("twofaccounts.export_selected_accounts")},I(r.$t("commons.export")),11,yo)])):z("",!0)]),_:1})}}},So={class:"block"},Do={class:"has-text-weight-bold has-text-grey"},ko={class:"is-size-7-mobile"},Co=["href"],$o=["title"],To={class:"block"},Oo={class:"has-text-weight-bold has-text-grey"},Io={class:"is-size-7-mobile"},Ao=["title"],Mo={__name:"ExportButtons",emits:["export-twofauth-format","export-otpauth-format"],setup(o,{emit:e}){Rt();const n=Jt("2fauth");return(t,i)=>(y(),C(Qe,null,[g("div",So,[k(p(De),null,{default:P(({mode:r})=>[g("p",Do,I(t.$t("twofaccounts.twofauth_export_format_sub")),1)]),_:1}),g("p",ko,[Re(I(t.$t("twofaccounts.twofauth_export_format_desc"))+" "+I(t.$t("twofaccounts.twofauth_export_format_url"))+" ",1),g("a",{id:"lnkExportSchemaUrl",class:"is-link",tabindex:"0",href:p(n).urls.exportSchemaUrl,target:"_blank"},I(t.$t("twofaccounts.twofauth_export_schema")),9,Co)]),g("button",{id:"btnExport2FAuth",class:"button is-link is-rounded is-focus my-3",onClick:i[0]||(i[0]=r=>t.$emit("export-twofauth-format")),title:t.$t("twofaccounts.twofauth_export_format_sub")},I(t.$t("twofaccounts.twofauth_export_format")),9,$o)]),g("div",To,[g("p",Oo,I(t.$t("twofaccounts.otpauth_export_format_sub")),1),g("p",Io,I(t.$t("twofaccounts.otpauth_export_format_desc")),1),g("button",{id:"btnExportOtpauth",class:"button is-link is-rounded is-focus my-3",onClick:i[1]||(i[1]=r=>t.$emit("export-otpauth-format")),title:t.$t("twofaccounts.otpauth_export_format_sub")},I(t.$t("twofaccounts.otpauth_export_format")),9,Ao)])],64))}};/**! * Sortable 1.15.2 * @author RubaXa * @author owenm * @license MIT */function Ut(o,e){var n=Object.keys(o);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(o);e&&(t=t.filter(function(i){return Object.getOwnPropertyDescriptor(o,i).enumerable})),n.push.apply(n,t)}return n}function he(o){for(var e=1;e=0)&&(n[i]=o[i]);return n}function No(o,e){if(o==null)return{};var n=Po(o,e),t,i;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(o);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(o,t)&&(n[t]=o[t])}return n}var Fo="1.15.2";function ge(o){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(o)}var be=ge(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Ze=ge(/Edge/i),Ht=ge(/firefox/i),qe=ge(/safari/i)&&!ge(/chrome/i)&&!ge(/android/i),en=ge(/iP(ad|od|hone)/i),tn=ge(/chrome/i)&&ge(/android/i),nn={capture:!1,passive:!1};function O(o,e,n){o.addEventListener(e,n,!be&&nn)}function T(o,e,n){o.removeEventListener(e,n,!be&&nn)}function ft(o,e){if(e){if(e[0]===">"&&(e=e.substring(1)),o)try{if(o.matches)return o.matches(e);if(o.msMatchesSelector)return o.msMatchesSelector(e);if(o.webkitMatchesSelector)return o.webkitMatchesSelector(e)}catch{return!1}return!1}}function Ro(o){return o.host&&o!==document&&o.host.nodeType?o.host:o.parentNode}function de(o,e,n,t){if(o){n=n||document;do{if(e!=null&&(e[0]===">"?o.parentNode===n&&ft(o,e):ft(o,e))||t&&o===n)return o;if(o===n)break}while(o=Ro(o))}return null}var qt=/\s+/g;function ne(o,e,n){if(o&&e)if(o.classList)o.classList[n?"add":"remove"](e);else{var t=(" "+o.className+" ").replace(qt," ").replace(" "+e+" "," ");o.className=(t+(n?" "+e:"")).replace(qt," ")}}function b(o,e,n){var t=o&&o.style;if(t){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(o,""):o.currentStyle&&(n=o.currentStyle),e===void 0?n:n[e];!(e in t)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),t[e]=n+(typeof n=="string"?"":"px")}}function Be(o,e){var n="";if(typeof o=="string")n=o;else do{var t=b(o,"transform");t&&t!=="none"&&(n=t+" "+n)}while(!e&&(o=o.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function on(o,e,n){if(o){var t=o.getElementsByTagName(e),i=0,r=t.length;if(n)for(;i=r,!s)return t;if(t===pe())break;t=ke(t,!1)}return!1}function Ge(o,e,n,t){for(var i=0,r=0,s=o.children;r2&&arguments[2]!==void 0?arguments[2]:{},i=t.evt,r=No(t,Ho);Je.pluginEvent.bind(_)(e,n,he({dragEl:d,parentEl:x,ghostEl:w,rootEl:A,nextEl:Ae,lastDownEl:at,cloneEl:M,cloneHidden:Se,dragStarted:ze,putSortable:Y,activeSortable:_.active,originalEvent:i,oldIndex:Fe,oldDraggableIndex:Ve,newIndex:oe,newDraggableIndex:Ee,hideGhostForTarget:fn,unhideGhostForTarget:pn,cloneNowHidden:function(){Se=!0},cloneNowShown:function(){Se=!1},dispatchSortableEvent:function(l){j({sortable:n,name:l,originalEvent:i})}},r))};function j(o){Uo(he({putSortable:Y,cloneEl:M,targetEl:d,rootEl:A,oldIndex:Fe,oldDraggableIndex:Ve,newIndex:oe,newDraggableIndex:Ee},o))}var d,x,w,A,Ae,at,M,Se,Fe,oe,Ve,Ee,et,Y,Ne=!1,pt=!1,ht=[],Oe,ue,kt,Ct,jt,Kt,ze,Pe,je,Ke=!1,tt=!1,lt,q,$t=[],Mt=!1,mt=[],vt=typeof document<"u",nt=en,Qt=Ze||be?"cssFloat":"float",qo=vt&&!tn&&!en&&"draggable"in document.createElement("div"),un=function(){if(vt){if(be)return!1;var o=document.createElement("x");return o.style.cssText="pointer-events:auto",o.style.pointerEvents==="auto"}}(),dn=function(e,n){var t=b(e),i=parseInt(t.width)-parseInt(t.paddingLeft)-parseInt(t.paddingRight)-parseInt(t.borderLeftWidth)-parseInt(t.borderRightWidth),r=Ge(e,0,n),s=Ge(e,1,n),l=r&&b(r),u=s&&b(s),a=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+R(r).width,f=u&&parseInt(u.marginLeft)+parseInt(u.marginRight)+R(s).width;if(t.display==="flex")return t.flexDirection==="column"||t.flexDirection==="column-reverse"?"vertical":"horizontal";if(t.display==="grid")return t.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&l.float&&l.float!=="none"){var c=l.float==="left"?"left":"right";return s&&(u.clear==="both"||u.clear===c)?"vertical":"horizontal"}return r&&(l.display==="block"||l.display==="flex"||l.display==="table"||l.display==="grid"||a>=i&&t[Qt]==="none"||s&&t[Qt]==="none"&&a+f>i)?"vertical":"horizontal"},Wo=function(e,n,t){var i=t?e.left:e.top,r=t?e.right:e.bottom,s=t?e.width:e.height,l=t?n.left:n.top,u=t?n.right:n.bottom,a=t?n.width:n.height;return i===l||r===u||i+s/2===l+a/2},Vo=function(e,n){var t;return ht.some(function(i){var r=i[re].options.emptyInsertThreshold;if(!(!r||Bt(i))){var s=R(i),l=e>=s.left-r&&e<=s.right+r,u=n>=s.top-r&&n<=s.bottom+r;if(l&&u)return t=i}}),t},cn=function(e){function n(r,s){return function(l,u,a,f){var c=l.options.group.name&&u.options.group.name&&l.options.group.name===u.options.group.name;if(r==null&&(s||c))return!0;if(r==null||r===!1)return!1;if(s&&r==="clone")return r;if(typeof r=="function")return n(r(l,u,a,f),s)(l,u,a,f);var E=(s?l:u).options.group.name;return r===!0||typeof r=="string"&&r===E||r.join&&r.indexOf(E)>-1}}var t={},i=e.group;(!i||st(i)!="object")&&(i={name:i}),t.name=i.name,t.checkPull=n(i.pull,!0),t.checkPut=n(i.put),t.revertClone=i.revertClone,e.group=t},fn=function(){!un&&w&&b(w,"display","none")},pn=function(){!un&&w&&b(w,"display","")};vt&&!tn&&document.addEventListener("click",function(o){if(pt)return o.preventDefault(),o.stopPropagation&&o.stopPropagation(),o.stopImmediatePropagation&&o.stopImmediatePropagation(),pt=!1,!1},!0);var Ie=function(e){if(d){e=e.touches?e.touches[0]:e;var n=Vo(e.clientX,e.clientY);if(n){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);t.target=t.rootEl=n,t.preventDefault=void 0,t.stopPropagation=void 0,n[re]._onDragOver(t)}}},jo=function(e){d&&d.parentNode[re]._isOutsideThisEl(e.target)};function _(o,e){if(!(o&&o.nodeType&&o.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(o));this.el=o,this.options=e=ve({},e),o[re]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(o.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return dn(o,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(s,l){s.setData("Text",l.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:_.supportPointer!==!1&&"PointerEvent"in window&&!qe,emptyInsertThreshold:5};Je.initializePlugins(this,o,n);for(var t in n)!(t in e)&&(e[t]=n[t]);cn(e);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=e.forceFallback?!1:qo,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?O(o,"pointerdown",this._onTapStart):(O(o,"mousedown",this._onTapStart),O(o,"touchstart",this._onTapStart)),this.nativeDraggable&&(O(o,"dragover",this),O(o,"dragenter",this)),ht.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),ve(this,Xo())}_.prototype={constructor:_,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(Pe=null)},_getDirection:function(e,n){return typeof this.options.direction=="function"?this.options.direction.call(this,e,n,d):this.options.direction},_onTapStart:function(e){if(e.cancelable){var n=this,t=this.el,i=this.options,r=i.preventOnFilter,s=e.type,l=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,u=(l||e).target,a=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||u,f=i.filter;if(oi(t),!d&&!(/mousedown|pointerdown/.test(s)&&e.button!==0||i.disabled)&&!a.isContentEditable&&!(!this.nativeDraggable&&qe&&u&&u.tagName.toUpperCase()==="SELECT")&&(u=de(u,i.draggable,t,!1),!(u&&u.animated)&&at!==u)){if(Fe=ae(u),Ve=ae(u,i.draggable),typeof f=="function"){if(f.call(this,e,u,this)){j({sortable:n,rootEl:a,name:"filter",targetEl:u,toEl:t,fromEl:t}),Q("filter",n,{evt:e}),r&&e.cancelable&&e.preventDefault();return}}else if(f&&(f=f.split(",").some(function(c){if(c=de(a,c.trim(),t,!1),c)return j({sortable:n,rootEl:c,name:"filter",targetEl:u,fromEl:t,toEl:t}),Q("filter",n,{evt:e}),!0}),f)){r&&e.cancelable&&e.preventDefault();return}i.handle&&!de(a,i.handle,t,!1)||this._prepareDragStart(e,l,u)}}},_prepareDragStart:function(e,n,t){var i=this,r=i.el,s=i.options,l=r.ownerDocument,u;if(t&&!d&&t.parentNode===r){var a=R(t);if(A=r,d=t,x=d.parentNode,Ae=d.nextSibling,at=t,et=s.group,_.dragged=d,Oe={target:d,clientX:(n||e).clientX,clientY:(n||e).clientY},jt=Oe.clientX-a.left,Kt=Oe.clientY-a.top,this._lastX=(n||e).clientX,this._lastY=(n||e).clientY,d.style["will-change"]="all",u=function(){if(Q("delayEnded",i,{evt:e}),_.eventCanceled){i._onDrop();return}i._disableDelayedDragEvents(),!Ht&&i.nativeDraggable&&(d.draggable=!0),i._triggerDragStart(e,n),j({sortable:i,name:"choose",originalEvent:e}),ne(d,s.chosenClass,!0)},s.ignore.split(",").forEach(function(f){on(d,f.trim(),Tt)}),O(l,"dragover",Ie),O(l,"mousemove",Ie),O(l,"touchmove",Ie),O(l,"mouseup",i._onDrop),O(l,"touchend",i._onDrop),O(l,"touchcancel",i._onDrop),Ht&&this.nativeDraggable&&(this.options.touchStartThreshold=4,d.draggable=!0),Q("delayStart",this,{evt:e}),s.delay&&(!s.delayOnTouchOnly||n)&&(!this.nativeDraggable||!(Ze||be))){if(_.eventCanceled){this._onDrop();return}O(l,"mouseup",i._disableDelayedDrag),O(l,"touchend",i._disableDelayedDrag),O(l,"touchcancel",i._disableDelayedDrag),O(l,"mousemove",i._delayedDragTouchMoveHandler),O(l,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&O(l,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(u,s.delay)}else u()}},_delayedDragTouchMoveHandler:function(e){var n=e.touches?e.touches[0]:e;Math.max(Math.abs(n.clientX-this._lastX),Math.abs(n.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){d&&Tt(d),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;T(e,"mouseup",this._disableDelayedDrag),T(e,"touchend",this._disableDelayedDrag),T(e,"touchcancel",this._disableDelayedDrag),T(e,"mousemove",this._delayedDragTouchMoveHandler),T(e,"touchmove",this._delayedDragTouchMoveHandler),T(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,n){n=n||e.pointerType=="touch"&&e,!this.nativeDraggable||n?this.options.supportPointer?O(document,"pointermove",this._onTouchMove):n?O(document,"touchmove",this._onTouchMove):O(document,"mousemove",this._onTouchMove):(O(d,"dragend",this),O(A,"dragstart",this._onDragStart));try{document.selection?ut(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(e,n){if(Ne=!1,A&&d){Q("dragStarted",this,{evt:n}),this.nativeDraggable&&O(document,"dragover",jo);var t=this.options;!e&&ne(d,t.dragClass,!1),ne(d,t.ghostClass,!0),_.active=this,e&&this._appendGhost(),j({sortable:this,name:"start",originalEvent:n})}else this._nulling()},_emulateDragOver:function(){if(ue){this._lastX=ue.clientX,this._lastY=ue.clientY,fn();for(var e=document.elementFromPoint(ue.clientX,ue.clientY),n=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(ue.clientX,ue.clientY),e!==n);)n=e;if(d.parentNode[re]._isOutsideThisEl(e),n)do{if(n[re]){var t=void 0;if(t=n[re]._onDragOver({clientX:ue.clientX,clientY:ue.clientY,target:e,rootEl:n}),t&&!this.options.dragoverBubble)break}e=n}while(n=n.parentNode);pn()}},_onTouchMove:function(e){if(Oe){var n=this.options,t=n.fallbackTolerance,i=n.fallbackOffset,r=e.touches?e.touches[0]:e,s=w&&Be(w,!0),l=w&&s&&s.a,u=w&&s&&s.d,a=nt&&q&&Vt(q),f=(r.clientX-Oe.clientX+i.x)/(l||1)+(a?a[0]-$t[0]:0)/(l||1),c=(r.clientY-Oe.clientY+i.y)/(u||1)+(a?a[1]-$t[1]:0)/(u||1);if(!_.active&&!Ne){if(t&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))=0&&(j({rootEl:x,name:"add",toEl:x,fromEl:A,originalEvent:e}),j({sortable:this,name:"remove",toEl:x,originalEvent:e}),j({rootEl:x,name:"sort",toEl:x,fromEl:A,originalEvent:e}),j({sortable:this,name:"sort",toEl:x,originalEvent:e})),Y&&Y.save()):oe!==Fe&&oe>=0&&(j({sortable:this,name:"update",toEl:x,originalEvent:e}),j({sortable:this,name:"sort",toEl:x,originalEvent:e})),_.active&&((oe==null||oe===-1)&&(oe=Fe,Ee=Ve),j({sortable:this,name:"end",toEl:x,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){Q("nulling",this),A=d=x=w=Ae=M=at=Se=Oe=ue=ze=oe=Ee=Fe=Ve=Pe=je=Y=et=_.dragged=_.ghost=_.clone=_.active=null,mt.forEach(function(e){e.checked=!0}),mt.length=kt=Ct=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":d&&(this._onDragOver(e),Ko(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],n,t=this.el.children,i=0,r=t.length,s=this.options;ii.right+r||o.clientY>t.bottom&&o.clientX>t.left:o.clientY>i.bottom+r||o.clientX>t.right&&o.clientY>t.top}function ei(o,e,n,t,i,r,s,l){var u=t?o.clientY:o.clientX,a=t?n.height:n.width,f=t?n.top:n.left,c=t?n.bottom:n.right,E=!1;if(!s){if(l&<f+a*r/2:uc-lt)return-je}else if(u>f+a*(1-i)/2&&uc-a*r/2)?u>f+a/2?1:-1:0}function ti(o){return ae(d){mn(e,f.oldIndex,f.newIndex)}},l=()=>{const f=i==null?void 0:i.querySelector(o);!f||t!==void 0||(t=new _(f,{...s,...r}))},u=()=>{t==null||t.destroy(),t=void 0},a=(f,c)=>{if(c!==void 0)t==null||t.option(f,c);else return t==null?void 0:t.option(f)};return _n(l),wn(u),{stop:u,start:l,option:a}}function mn(o,e,n){const t=Ye(o),i=t?[...Yt(o)]:Yt(o);if(n>=0&&n{i.splice(n,0,r),t&&(o.value=i)})}}const si={key:2,class:"header"},ai={class:"columns is-gapless is-mobile is-centered"},li={class:"column is-three-quarters-mobile is-one-third-tablet is-one-quarter-desktop is-one-quarter-widescreen is-one-quarter-fullhd"},ui={key:1,class:"has-text-centered"},di={class:"columns"},ci={key:0,class:"column"},fi=["title"],pi={key:1,class:"column"},hi=["title"],mi={key:3},gi={class:"accounts"},vi={class:"tfa-container"},bi={key:0,class:"tfa-cell tfa-checkbox"},_i={class:"field"},wi=["id","value","name"],yi=["for","onKeypress"],Ei=["onClick","onKeyup"],Si={class:"tfa-text has-ellipsis"},Di=["src"],ki=["src"],Ci={class:"has-ellipsis is-family-primary is-size-6 is-size-7-mobile has-text-grey"},$i={class:"has-text-right"},Ti={key:0},Oi={key:0,class:"has-nowrap has-text-grey has-text-centered is-size-5"},Ii=["onClick","onKeyup","title"],Ai={key:1},Mi=["onClick","title"],xi={class:"has-text-right"},Pi=["onClick"],Ni={key:0,class:"tfa-cell tfa-edit has-text-grey"},Fi={key:0,class:"drag-handle tfa-cell tfa-dots has-text-grey"},Yi={__name:"Accounts",setup(o){const e=Jt("2fauth"),n=Rt(),t=En(),i=Ft(),r=Fn(),s=Sn(),{copy:l,copied:u}=Dn({legacy:!0}),a=kn(),f=Cn(),c=te(!1),E=te(!1),D=te(!1),S=te(!1);te(!1);const $=te(!1),L=te(null),K=te(null),B=te(null),X=te({otp_type:"",account:"",service:"",icon:""}),U=te([]),le=te([]);_t(c,v=>{var m;v==!1&&((m=B.value)==null||m.clearOTP())}),_t(()=>a.items,v=>{r.inManagementMode&&ce()}),_t(()=>r.inManagementMode,v=>{v&&ce()});const Z=$n(()=>!a.isEmpty&&!D.value&&!S.value);Tn(async()=>{i.preferences.getOtpOnRequest?a.fetch().then(()=>{a.backendWasNewer&&t.info({text:wt("commons.data_refreshed_to_reflect_server_changes"),duration:1e4})}):we(),f.fetch()});function ce(){ri("#dv",a.filtered,{animation:200,handle:".drag-handle",onUpdate:v=>{const m=a.filtered[v.oldIndex].id,G=a.items.findIndex(ee=>ee.id==m);mn(a.items,G,v.newIndex),rt(()=>{a.saveOrder()})}})}function Ce(){a.fetch(),a.selectNone(),S.value=!1,t.success({text:wt("twofaccounts.accounts_moved")})}function H(v){X.value.otp_type=v.otp_type,X.value.service=v.service,X.value.account=v.account,X.value.icon=v.icon,rt().then(()=>{c.value=!0,B.value.show(v.id)})}function _e(v){r.inManagementMode?a.select(v.id):!i.preferences.getOtpOnRequest&&v.otp_type.includes("totp")?J(v.otp.password):H(v)}function J(v){l(v),u&&(i.preferences.kickUserAfter==-1&&i.logout({kicked:!0}),i.preferences.clearSearchOnCopy&&(a.filter=""),i.preferences.viewDefaultGroupOnCopy&&(i.preferences.activeGroup=i.preferences.defaultGroup==-1?i.preferences.activeGroup:i.preferences.defaultGroup),t.success({text:wt("commons.copied_to_clipboard")}))}async function $e(v){it.getOtpById(v.id).then(m=>{let G=m.data;if(J(G.password),G.otp_type=="hotp"){let ee=accounts.value.find(V=>V.id==v.id);ee!=null&&(ee.counter=G.counter)}})}function se(v,m){le.value.filter(G=>G.props.period==v||v==null).forEach(G=>{G.turnOn(m)})}function me(v){le.value.filter(m=>m.props.period==v||v==null).forEach(m=>{m.turnOff()})}async function we(v){$.value=!0,me(v);let m;v==null?(L.value=-1,m=it.getAll(!0)):(L.value=v,m=it.getByIds(a.accountIdsWithPeriod(v).join(","),!0)),m.then(G=>{let ee=0;G.data.forEach(V=>{if(V.otp_type==="totp"){const Le=a.items.findIndex(bt=>bt.id===V.id);a.items[Le]==null?a.items.push(V):a.items[Le].otp=V.otp,ee=V.otp.generated_at}}),U.value.forEach(V=>{(V.props.period==v||v==null)&&rt().then(()=>{V.startLoop(ee)})})}).finally(()=>{$.value=!1,L.value=null})}async function fe(){await a.deleteSelected(),a.isEmpty&&(r.inManagementMode=!1,n.push({name:"start"}))}function Me(){r.inManagementMode=!1,a.selectNone()}return(v,m)=>{const G=ie("FontAwesomeIcon"),ee=ie("Modal"),V=ie("font-awesome-icon"),Le=ie("RouterLink"),bt=ie("VueFooter");return y(),C("div",null,[p(D)?(y(),ye(Un,{key:0,showGroupSwitch:p(D),"onUpdate:showGroupSwitch":m[0]||(m[0]=h=>Ye(D)?D.value=h:null),groups:p(f).items,"onUpdate:groups":m[1]||(m[1]=h=>p(f).items=h)},null,8,["showGroupSwitch","groups"])):z("",!0),p(S)?(y(),ye(no,{key:1,showDestinationGroupSelector:p(S),"onUpdate:showDestinationGroupSelector":m[2]||(m[2]=h=>Ye(S)?S.value=h:null),selectedAccountsIds:p(a).selectedIds,"onUpdate:selectedAccountsIds":m[3]||(m[3]=h=>p(a).selectedIds=h),groups:p(f).items,onAccountsMoved:Ce},null,8,["showDestinationGroupSelector","selectedAccountsIds","groups"])):z("",!0),p(Z)||p(D)?(y(),C("div",si,[g("div",ai,[g("div",li,[k(Nn,{keyword:p(a).filter,"onUpdate:keyword":m[4]||(m[4]=h=>p(a).filter=h)},null,8,["keyword"]),p(r).inManagementMode?(y(),ye(fo,{key:0,selectedCount:p(a).selectedCount,onClearSelected:m[5]||(m[5]=h=>p(a).selectNone()),onSelectAll:m[6]||(m[6]=h=>p(a).selectAll()),onSortAsc:m[7]||(m[7]=h=>p(a).sortAsc()),onSortDesc:m[8]||(m[8]=h=>p(a).sortDesc())},null,8,["selectedCount"])):(y(),C("div",ui,[g("div",di,[k(p(De),null,{default:P(({mode:h})=>[p(D)?(y(),C("div",ci,[g("button",{id:"btnHideGroupSwitch",title:v.$t("groups.hide_group_selector"),tabindex:"1",class:W(["button is-text is-like-text",{"has-text-grey":h!="dark"}]),onClick:m[9]||(m[9]=Te(N=>D.value=!p(D),["stop"]))},I(v.$t("groups.select_accounts_to_show")),11,fi)])):(y(),C("div",pi,[g("button",{id:"btnShowGroupSwitch",title:v.$t("groups.show_group_selector"),tabindex:"1",class:W(["button is-text is-like-text",{"has-text-grey":h!="dark"}]),onClick:m[10]||(m[10]=Te(N=>D.value=!p(D),["stop"]))},[Re(I(p(f).current)+" ("+I(p(a).filteredCount)+")  ",1),k(G,{icon:["fas","caret-down"]})],10,hi)]))]),_:1})])]))])])])):z("",!0),k(ee,{modelValue:p(E),"onUpdate:modelValue":m[13]||(m[13]=h=>Ye(E)?E.value=h:null),isFullHeight:!0},{default:P(()=>[k(Mo,{onExportTwofauthFormat:m[11]||(m[11]=h=>p(a).export()),onExportOtpauthFormat:m[12]||(m[12]=h=>p(a).export("otpauth"))})]),_:1},8,["modelValue"]),k(ee,{modelValue:p(c),"onUpdate:modelValue":m[16]||(m[16]=h=>Ye(c)?c.value=h:null)},{default:P(()=>[k(Mn,On({ref_key:"otpDisplay",ref:B},p(X),{onPleaseCloseMe:m[14]||(m[14]=h=>c.value=!1),onPleaseClearSearch:m[15]||(m[15]=h=>p(a).filter="")}),null,16)]),_:1},8,["modelValue"]),p(i).preferences.getOtpOnRequest?z("",!0):(y(),C("span",mi,[(y(!0),C(Qe,null,ct(p(a).periods,h=>(y(),ye(xn,{key:h.period,autostart:!1,period:h.period,generated_at:h.generated_at,onLoopEnded:N=>we(h.period),onLoopStarted:N=>se(h.period,N),onSteppedUp:N=>se(h.period,N),ref_for:!0,ref_key:"looperRefs",ref:U},null,8,["period","generated_at","onLoopEnded","onLoopStarted","onSteppedUp"]))),128))])),p(Z)?(y(),C("div",{key:4,class:W(["container",p(r).inManagementMode?"is-edit-mode":""])},[g("div",gi,[g("span",{id:"dv",class:W(["columns is-multiline",{"is-centered":p(i).preferences.displayMode==="grid"}])},[(y(!0),C(Qe,null,ct(p(a).filtered,h=>(y(),C("div",{class:W([[p(i).preferences.displayMode==="grid"?"tfa-grid":"tfa-list"],"column is-narrow"]),key:h.id},[g("div",vi,[k(Xe,{name:"slideCheckbox"},{default:P(()=>[p(r).inManagementMode?(y(),C("div",bi,[g("div",_i,[k(p(De),null,{default:P(({mode:N})=>[yt(g("input",{class:W(["is-checkradio is-small",N=="dark"?"is-white":"is-info"]),id:"ckb_"+h.id,value:h.id,type:"checkbox",name:"ckb_"+h.id,"onUpdate:modelValue":m[17]||(m[17]=Xt=>p(a).selectedIds=Xt)},null,10,wi),[[In,p(a).selectedIds]])]),_:2},1024),g("label",{tabindex:"0",for:"ckb_"+h.id,onKeypress:Et(Te(N=>p(a).select(h.id),["prevent"]),["space"])},null,40,yi)])])):z("",!0)]),_:2},1024),g("div",{tabindex:"0",class:"tfa-cell tfa-content is-size-3 is-size-4-mobile",onClick:[Te(N=>_e(h),["exact"]),Te(N=>$e(h),["ctrl"])],onKeyup:Et(N=>_e(h),["enter"]),role:"button"},[g("div",Si,[h.icon&&p(i).preferences.showAccountsIcons?(y(),C("img",{key:0,role:"presentation",class:"tfa-icon",src:p(e).config.subdirectory+"/storage/icons/"+h.icon,alt:""},null,8,Di)):h.icon==null&&p(i).preferences.showAccountsIcons?(y(),C("img",{key:1,role:"presentation",class:"tfa-icon",src:p(e).config.subdirectory+"/storage/noicon.svg",alt:""},null,8,ki)):z("",!0),Re(" "+I(h.service?h.service:v.$t("twofaccounts.no_service")),1),p(s).useEncryption&&h.account===v.$t("errors.indecipherable")?(y(),ye(G,{key:2,class:"has-text-danger is-size-5 ml-2",icon:["fas","exclamation-circle"]})):z("",!0),g("span",Ci,I(h.account),1)])],40,Ei),k(Xe,{name:"popLater"},{default:P(()=>[yt(g("div",$i,[h.otp!=null?(y(),C("span",Ti,[p($)==!0&&(p(L)==-1||p(L)==h.period)?(y(),C("span",Oi,[k(G,{icon:["fas","circle-notch"],spin:""})])):(y(),C("span",{key:1,class:"always-on-otp is-clickable has-nowrap has-text-grey is-size-5 ml-4",onClick:N=>J(h.otp.password),onKeyup:Et(N=>J(h.otp.password),["enter"]),title:v.$t("commons.copy_to_clipboard")},I(p(An)(h.otp.password,p(i).preferences.showOtpAsDot&&p(i).preferences.revealDottedOTP&&p(K)==h.id)),41,Ii)),h.otp_type.includes("totp")?(y(),ye(Pn,{key:2,class:W("condensed"),ref_for:!0,ref_key:"dotsRefs",ref:le,period:h.period},null,8,["period"])):z("",!0)])):(y(),C("span",Ai,[k(p(De),null,{default:P(({mode:N})=>[g("button",{class:W(["button tag",N=="dark"?"is-dark":"is-white"]),onClick:Xt=>H(h),title:v.$t("twofaccounts.import.import_this_account")},I(v.$t("commons.generate")),11,Mi)]),_:2},1024)]))],512),[[zt,p(i).preferences.getOtpOnRequest==!1&&!p(r).inManagementMode]])]),_:2},1024),p(i).preferences.showOtpAsDot&&p(i).preferences.revealDottedOTP?(y(),ye(Xe,{key:0,name:"popLater"},{default:P(()=>[yt(g("div",xi,[p(K)==h.id?(y(),C("button",{key:0,class:"pr-0 button is-ghost has-text-grey-dark",onClick:m[18]||(m[18]=Te(N=>K.value=null,["stop"]))},[k(V,{icon:["fas","eye"]})])):(y(),C("button",{key:1,class:"pr-0 button is-ghost has-text-grey-dark",onClick:Te(N=>K.value=h.id,["stop"])},[k(V,{icon:["fas","eye-slash"]})],8,Pi))],512),[[zt,p(i).preferences.getOtpOnRequest==!1&&!p(r).inManagementMode]])]),_:2},1024)):z("",!0),k(Xe,{name:"fadeInOut"},{default:P(()=>[p(r).inManagementMode?(y(),C("div",Ni,[k(p(De),null,{default:P(({mode:N})=>[k(Le,{to:{name:"editAccount",params:{twofaccountId:h.id}},class:W(["tag is-rounded mr-1",N=="dark"?"is-dark":"is-white"])},{default:P(()=>[Re(I(v.$t("commons.edit")),1)]),_:2},1032,["to","class"]),k(Le,{to:{name:"showQRcode",params:{twofaccountId:h.id}},class:W(["tag is-rounded",N=="dark"?"is-dark":"is-white"]),title:v.$t("twofaccounts.show_qrcode")},{default:P(()=>[k(G,{icon:["fas","qrcode"]})]),_:2},1032,["to","class","title"])]),_:2},1024)])):z("",!0)]),_:2},1024),k(Xe,{name:"fadeInOut"},{default:P(()=>[p(r).inManagementMode?(y(),C("div",Fi,[k(G,{icon:["fas","bars"]})])):z("",!0)]),_:1})])],2))),128))],2)]),k(bt,{showButtons:!0,internalFooterType:p(r).inManagementMode&&!p(S)?"doneButton":"navLinks",onDoneButtonClicked:Me},{default:P(()=>[k(Eo,{inManagementMode:p(r).inManagementMode,"onUpdate:inManagementMode":m[19]||(m[19]=h=>p(r).inManagementMode=h),areDisabled:p(a).hasNoneSelected,onMoveButtonClicked:m[20]||(m[20]=h=>S.value=!0),onDeleteButtonClicked:fe,onExportButtonClicked:m[21]||(m[21]=h=>E.value=!0)},null,8,["inManagementMode","areDisabled"])]),_:1},8,["internalFooterType"])],2)):z("",!0)])}}};export{Yi as default};