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