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