p3x-redis-ui-material
Version:
💿 P3X Redis UI triple frontend — Angular + React/MUI + Vue/Vuetify with 54 languages, 7 themes, Socket.IO, desktop notifications, and full feature parity
3 lines • 58.6 kB
JavaScript
import{a as Ue,b as Je,c as Qe,d as Ye}from"./chunk-EO7FPNYX.js";import{a as it}from"./chunk-PYE27J5F.js";import{a as et}from"./chunk-JTYQ6EUS.js";import{a as mt}from"./chunk-BLYHBMDZ.js";import{a as tt}from"./chunk-FGIK2URP.js";import{a as Xe}from"./chunk-NCBSDZX3.js";import"./chunk-BN33DLGQ.js";import{a as Ke,b as Ne}from"./chunk-SQBBDTZO.js";import{a as We,b as Ze,c as qe}from"./chunk-EPMRI4P6.js";import"./chunk-KLZILXP3.js";import{d as Ge}from"./chunk-CYCQOADG.js";import"./chunk-DCOXSL4B.js";import"./chunk-IDORGLM3.js";import{a as ce,b as L}from"./chunk-VQDF6UGR.js";import{c as Te,e as we}from"./chunk-OTFMRDKW.js";import{a as Le,c as j}from"./chunk-3QQZQR3D.js";import{d as He,e as de}from"./chunk-TEXSADK3.js";import{a as G,b as N}from"./chunk-AN7C4JCR.js";import{i as Ve,j as Oe}from"./chunk-AN3YSLKY.js";import"./chunk-6J2GCUHA.js";import{f as Fe,j as Pe,v as ae}from"./chunk-ICUC3WIE.js";import{a as $e}from"./chunk-YA4NX3C4.js";import{b as A,c as B,d as Ae,e as Be}from"./chunk-VMTBY4VN.js";import{b as se,c as le}from"./chunk-HFDIHHHN.js";import{c as Re}from"./chunk-7JNYLOAK.js";import{$a as J,Ab as ie,Bb as d,C as be,Cb as D,Da as m,Db as z,Eb as ke,Ia as O,Jc as oe,Ld as Me,Na as H,Nd as Ie,Pd as ze,Qd as je,Rd as K,U as fe,Wa as X,Xa as C,Y as ge,Ya as v,Zb as F,_a as U,ab as Q,ba as f,bb as _,ca as g,cb as o,cd as Se,d as xe,db as l,eb as T,gd as re,hd as Ee,jb as w,jd as De,ka as $,kc as ne,lb as h,nb as c,oa as Z,oc as P,ra as q,rb as Ce,sb as ve,tb as ye,xa as s,xb as Y,yb as ee,zb as te}from"./chunk-KQUCMSSK.js";import{a as pt}from"./chunk-SJB4WMV2.js";import"./chunk-FCVD6SGJ.js";import{a as me,b as he,g as _e,h as E}from"./chunk-O7S4L63H.js";function ut(n,p){if(n&1){let e=w();o(0,"h2",2)(1,"a",3),h("click",function(){f(e);let i=c();return g(i.goStatistics())}),d(2),l()()}if(n&2){let e,t=c();s(2),z(" ",(e=t.strings().intention)==null?null:e.main," ")}}function _t(n,p){if(n&1&&(o(0,"mat-option",11)(1,"mat-icon",10),d(2),l(),d(3),l()),n&2){let e=p.$implicit,t=c(3);_("value",e),s(2),D(t.hasKeys(e)?"radio_button_checked":"radio_button_unchecked"),s(),z(" ",e," ")}}function xt(n,p){if(n&1){let e=w();o(0,"div",4)(1,"span",7),d(2,"DB:"),l(),o(3,"mat-form-field",8)(4,"mat-select",9),h("selectionChange",function(i){f(e);let r=c(2);return g(r.selectDatabase(i.value))}),o(5,"mat-select-trigger")(6,"mat-icon",10),d(7),l(),d(8),l(),J(9,_t,4,3,"mat-option",11,U),l()()()}if(n&2){let e,t=c(2);s(4),_("value",t.currentDatabase),X("aria-label",(e=t.strings().form)==null||e.main==null||e.main.label==null?null:e.main.label.database),s(3),D(t.hasKeys(t.currentDatabase)?"radio_button_checked":"radio_button_unchecked"),s(),z(" ",t.currentDatabase," "),s(),Q(t.databaseIndexes)}}function bt(n,p){if(n&1){let e=w();o(0,"button",12),h("click",function(){f(e);let i=c(3);return g(i.save())}),o(1,"mat-icon"),d(2,"save"),l(),o(3,"span"),d(4),l()()}if(n&2){let e,t=c(3);s(4),D((e=t.strings().intention)==null?null:e.save)}}function ft(n,p){if(n&1){let e=w();o(0,"button",13),h("click",function(){f(e);let i=c(3);return g(i.save())}),o(1,"mat-icon"),d(2,"save"),l()()}if(n&2){let e,t=c(3);_("matTooltip",(e=t.strings().intention)==null?null:e.save)}}function gt(n,p){if(n&1&&C(0,bt,5,1,"button",5)(1,ft,3,1,"button",6),n&2){let e=c(2);v(e.isWide?0:1)}}function Ct(n,p){if(n&1){let e=w();o(0,"button",12),h("click",function(){f(e);let i=c(2);return g(i.goStatistics())}),o(1,"mat-icon"),d(2,"show_chart"),l(),o(3,"span"),d(4),l()()}if(n&2){let e,t=c(2);s(4),D((e=t.strings().intention)==null?null:e.statistics)}}function vt(n,p){if(n&1){let e=w();o(0,"button",13),h("click",function(){f(e);let i=c(2);return g(i.goStatistics())}),o(1,"mat-icon"),d(2,"show_chart"),l()()}if(n&2){let e,t=c(2);_("matTooltip",(e=t.strings().intention)==null?null:e.statistics)}}function yt(n,p){if(n&1){let e=w();o(0,"button",12),h("click",function(){f(e);let i=c(2);return g(i.refresh())}),o(1,"mat-icon"),d(2,"refresh"),l(),o(3,"span"),d(4),l()()}if(n&2){let e,t=c(2);s(4),D((e=t.strings().intention)==null?null:e.refresh)}}function kt(n,p){if(n&1){let e=w();o(0,"button",13),h("click",function(){f(e);let i=c(2);return g(i.refresh())}),o(1,"mat-icon"),d(2,"refresh"),l()()}if(n&2){let e,t=c(2);_("matTooltip",(e=t.strings().intention)==null?null:e.refresh)}}function Tt(n,p){if(n&1&&(C(0,xt,11,4,"div",4),C(1,gt,2,1),C(2,Ct,5,1,"button",5)(3,vt,3,1,"button",6),C(4,yt,5,1,"button",5)(5,kt,3,1,"button",6)),n&2){let e=c();v(e.isCluster?-1:0),s(),v(e.isReadonly?-1:1),s(),v(e.isWide?2:3),s(2),v(e.isWide?4:5)}}var ot=(()=>{class n{breakpointObserver;i18n;cmd;socket;cdr;state;strings;isXs=!1;isWide=!0;hasConnection=!1;isCluster=!1;isReadonly=!1;currentDatabase=0;databaseIndexes=[];keyspaceDatabases={};unsubs=[];constructor(e,t,i,r,a,u){this.breakpointObserver=e,this.i18n=t,this.cmd=i,this.socket=r,this.cdr=a,this.state=u,this.strings=this.i18n.strings}ngOnInit(){this.syncFromGlobal();let e=this.socket.connections$.subscribe(()=>this.syncFromGlobal()),t=this.socket.redisDisconnected$.subscribe(()=>this.syncFromGlobal()),i=this.socket.stateChanged$.subscribe(()=>this.syncFromGlobal());this.unsubs.push(()=>{e.unsubscribe(),t.unsubscribe(),i.unsubscribe()});let r=this.breakpointObserver.observe("(max-width: 599px)").subscribe(u=>{this.isXs=u.matches,this.cdr.markForCheck()});this.unsubs.push(()=>r.unsubscribe());let a=this.breakpointObserver.observe("(min-width: 720px)").subscribe(u=>{this.isWide=u.matches,this.cdr.markForCheck()});this.unsubs.push(()=>a.unsubscribe())}ngOnDestroy(){this.unsubs.forEach(e=>e())}hasKeys(e){return!!this.keyspaceDatabases[e]}selectDatabase(e){this.currentDatabase=e,this.cmd.selectDatabase(e).then(()=>{this.syncFromGlobal()}),setTimeout(()=>this.cdr.detectChanges())}save(){this.cmd.save()}goStatistics(){this.cmd.statistics()}refresh(){this.cmd.refresh({withoutParent:!1})}syncFromGlobal(){let e=this.state.connection();this.hasConnection=e!==void 0,this.isCluster=e?.cluster===!0,this.isReadonly=e?.readonly===!0,this.databaseIndexes=this.state.databaseIndexes()??[],this.keyspaceDatabases=this.state.info()?.keyspaceDatabases??{},this.currentDatabase=this.cmd.currentDatabase,this.cdr.detectChanges()}static \u0275fac=function(t){return new(t||n)(m(oe),m(K),m(L),m(j),m(F),m(N))};static \u0275cmp=O({type:n,selectors:[["p3xr-database-header"]],decls:4,vars:2,consts:[["id","p3xr-database-header",1,"p3xr-accordion-toolbar","p3xr-database-header-toolbar"],[1,"p3xr-database-header-tools"],[1,"p3xr-database-header-title"],[1,"p3xr-database-header-link",3,"click"],[1,"p3xr-database-header-db-selector"],["mat-button",""],["mat-icon-button","","matTooltipPosition","below",3,"matTooltip"],[1,"p3xr-database-header-db-label"],["subscriptSizing","dynamic",1,"p3xr-database-header-db-field"],["panelClass","p3xr-database-db-select-container",3,"selectionChange","value"],[1,"p3xr-db-indicator"],[3,"value"],["mat-button","",3,"click"],["mat-icon-button","","matTooltipPosition","below",3,"click","matTooltip"]],template:function(t,i){t&1&&(o(0,"mat-toolbar",0)(1,"div",1),C(2,ut,3,1,"h2",2),C(3,Tt,6,4),l()()),t&2&&(s(2),v(i.isXs?-1:2),s(),v(i.hasConnection?3:-1))},dependencies:[P,ae,Be,Ae,ze,Ie,Me,le,se,B,A,qe,Ve,We,Ze,Ge,Oe],styles:["[_nghost-%COMP%]{display:block}.p3xr-database-header-toolbar[_ngcontent-%COMP%]{height:48px;min-height:48px;max-height:48px;padding:0 8px 0 16px;border-radius:4px 4px 0 0}.p3xr-database-header-tools[_ngcontent-%COMP%]{display:flex;align-items:center;width:100%;height:48px}.p3xr-database-header-title[_ngcontent-%COMP%]{flex:1;font-size:20px;font-weight:400;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.p3xr-database-header-link[_ngcontent-%COMP%]{cursor:pointer;text-decoration:none;color:inherit}.p3xr-database-header-db-selector[_ngcontent-%COMP%]{display:flex;align-items:center;margin:0;padding:0}.p3xr-database-header-db-label[_ngcontent-%COMP%]{font-size:14px;font-weight:700;margin-right:2px}.p3xr-database-header-db-field[_ngcontent-%COMP%]{width:80px;position:relative;top:1px}.p3xr-database-header-db-field[_ngcontent-%COMP%] .mdc-text-field{background:transparent!important;padding:0 8px!important}.p3xr-database-header-db-field[_ngcontent-%COMP%] .mat-mdc-form-field-subscript-wrapper{display:none}.p3xr-database-header-db-field[_ngcontent-%COMP%] .mdc-line-ripple{display:none}.p3xr-database-header-db-field[_ngcontent-%COMP%] .mat-mdc-select-arrow-wrapper{padding-left:0}.p3xr-database-header-db-field[_ngcontent-%COMP%] .mat-mdc-select-trigger{display:flex;align-items:center}.p3xr-database-header-db-field[_ngcontent-%COMP%] .mat-mdc-select-value{display:flex;align-items:center}.p3xr-database-header-db-field[_ngcontent-%COMP%] .mat-mdc-select-value-text{display:flex;align-items:center}.p3xr-database-header-db-field[_ngcontent-%COMP%] mat-select-trigger{display:flex;align-items:center;gap:4px}.p3xr-database-header-db-field[_ngcontent-%COMP%] mat-select-trigger .p3xr-db-indicator{font-size:18px!important;width:18px!important;height:18px!important;line-height:18px!important;overflow:hidden;flex-shrink:0}"],changeDetection:0})}return n})();var rt=(()=>{class n{dialog;constructor(e){this.dialog=e}show(e){return E(this,null,function*(){let{KeyImportDialogComponent:t}=yield import("./chunk-OVFBLRWX.js"),i=this.dialog.open(t,$e({data:e.data,disableClose:!1,width:"700px",maxWidth:"95vw",maxHeight:"90vh"}));return new Promise((r,a)=>{i.afterClosed().subscribe(u=>{u?r(u):a()})})})}static \u0275fac=function(t){return new(t||n)(ge(Re))};static \u0275prov=fe({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function wt(n,p){if(n&1){let e=w();o(0,"button",22),h("click",function(){let i=f(e).$implicit,r=c(2);return g(r.setDivider(i))}),o(1,"span",23),d(2),l()()}if(n&2){let e=p.$implicit;s(2),D(e===""?"(empty)":e)}}function St(n,p){if(n&1&&(o(0,"button",19)(1,"span",5),d(2,"arrow_drop_down"),l()(),o(3,"mat-menu",20,2),J(5,wt,3,1,"button",21,U),l()),n&2){let e,t=Y(4),i=c();_("matMenuTriggerFor",t)("matTooltip",(e=i.strings().form)==null||e.treeSettings==null||e.treeSettings.field==null?null:e.treeSettings.field.treeSeparatorSelector),s(5),Q(i.treeDividers)}}function Et(n,p){if(n&1){let e=w();o(0,"span",10)(1,"button",24),h("click",function(){f(e);let i=c();return g(i.pageAction("first"))}),o(2,"span",5),d(3,"skip_previous"),l()(),o(4,"button",25),h("click",function(){f(e);let i=c();return g(i.pageAction("prev"))}),o(5,"span",5),d(6,"keyboard_arrow_left"),l()(),o(7,"p3xr-ng-input",26),h("ngModelChange",function(i){f(e);let r=c();return g(r.onPageInputChange(i))}),l(),o(8,"span",27),d(9),l(),o(10,"button",25),h("click",function(){f(e);let i=c();return g(i.pageAction("next"))}),o(11,"span",5),d(12,"keyboard_arrow_right"),l()(),o(13,"button",24),h("click",function(){f(e);let i=c();return g(i.pageAction("last"))}),o(14,"span",5),d(15,"skip_next"),l()()()}if(n&2){let e,t,i,r,a=c();_("matTooltip",a.keyCountText()),s(),_("matTooltip",(e=a.strings().page)==null||e.treeControls==null||e.treeControls.pager==null?null:e.treeControls.pager.first),s(3),_("matTooltip",(t=a.strings().page)==null||t.treeControls==null||t.treeControls.pager==null?null:t.treeControls.pager.prev),s(3),_("max",""+a.pages)("ngModel",a.page),s(2),z("/ ",a.pages),s(),_("matTooltip",(i=a.strings().page)==null||i.treeControls==null||i.treeControls.pager==null?null:i.treeControls.pager.next),s(3),_("matTooltip",(r=a.strings().page)==null||r.treeControls==null||r.treeControls.pager==null?null:r.treeControls.pager.last)}}function Dt(n,p){if(n&1&&(o(0,"span",11),d(1),l()),n&2){let e=c();s(),z(" ",e.keyCountText(),"\xA0 ")}}function Mt(n,p){if(n&1){let e=w();o(0,"button",14),h("click",function(){f(e);let i=c();return g(i.clearSearch())}),o(1,"span",5),d(2,"clear"),l()()}if(n&2){let e,t=c();_("matTooltip",(e=t.strings().page)==null||e.treeControls==null||e.treeControls.search==null?null:e.treeControls.search.clear)}}function It(n,p){if(n&1){let e=w();o(0,"span",28),h("click",function(i){f(e);let r=c();return g(r.addRootKey(i))}),d(1,"add"),l()}if(n&2){let e,t=c();_("matTooltip",(e=t.strings().intention)==null?null:e.addKeyRoot)}}function zt(n,p){if(n&1&&(o(0,"div",18),d(1),l()),n&2){let e,t=c();s(),D((e=t.strings().label)==null?null:e.exportSearchHint)}}function Rt(n,p){if(n&1&&(o(0,"div",18),d(1),l()),n&2){let e,t=c(2);s(),D((e=t.strings().label)==null?null:e.importSearchHint)}}function Vt(n,p){if(n&1){let e=w();o(0,"button",6),h("click",function(){f(e);let i=c();return g(i.importKeys())}),o(1,"mat-icon"),d(2,"file_upload"),l(),o(3,"span"),d(4),l()(),C(5,Rt,2,1,"div",18)}if(n&2){let e,t=c();s(4),D((e=t.strings().intention)==null?null:e.importKeys),s(),v(t.search.length>0?5:-1)}}function Ot(n,p){if(n&1&&(o(0,"div",18),d(1),l()),n&2){let e,t=c(2);s(),D((e=t.strings().label)==null?null:e.deleteSearchHint)}}function Ft(n,p){if(n&1){let e=w();T(0,"mat-divider"),o(1,"button",6),h("click",function(){f(e);let i=c();return g(i.deleteSearchKeys())}),o(2,"mat-icon"),d(3,"delete_sweep"),l(),o(4,"span"),d(5),l()(),C(6,Ot,2,1,"div",18)}if(n&2){let e=c();s(2),ee("color","var(--p3xr-btn-warn-bg)"),s(3),D(e.deleteSearchLabel()),s(),v(e.search.length>0?6:-1)}}var at=(()=>{class n{ngZone;elementRef;i18n;common;cmd;treeSettingsDialog;keyImportDialog;socket;cdr;state;settings;overlay;p3xrMainRef;page=1;pages=0;search="";keyCount=0;redisTreeDivider=":";treeDividers=[];searchClientSide=!1;isReadonly=!1;strings;unsubs=[];dividerChange$=new xe;constructor(e,t,i,r,a,u,y,b,x,k,S,M){this.ngZone=e,this.elementRef=t,this.i18n=i,this.common=r,this.cmd=a,this.treeSettingsDialog=u,this.keyImportDialog=y,this.socket=b,this.cdr=x,this.state=k,this.settings=S,this.overlay=M,this.strings=this.i18n.strings}ngOnInit(){this.syncFromGlobal(),this.search&&this.onSearchChange();let e=this.dividerChange$.pipe(be(666)).subscribe(i=>{this.applyDivider(i)});this.unsubs.push(()=>e.unsubscribe());let t=this.cmd.treeRefresh$.subscribe(()=>{this.ngZone.run(()=>{this.syncFromGlobal(),this.requestViewRefresh()})});this.unsubs.push(()=>t.unsubscribe())}ngOnDestroy(){this.unsubs.forEach(e=>e())}keyCountText(){let e=this.strings()?.status?.keyCount;return typeof e=="function"?e({keyCount:this.keyCount}):String(this.keyCount)}searchPlaceholder(){let e=this.strings()?.page?.treeControls?.search;return this.searchClientSide?e?.placeholderClient:e?.placeholderServer}treeExpandAll(){this.common.treeExpandAll$.next()}treeExpandToLevel(e){this.common.treeExpandToLevel$.next(e)}treeCollapseAll(){this.common.treeCollapseAll$.next()}refreshTree(){return E(this,null,function*(){yield this.cmd.refresh(),this.ngZone.run(()=>{this.syncFromGlobal(),this.requestViewRefresh()})})}openTreeSettingDialog(e){return E(this,null,function*(){yield this.treeSettingsDialog.show({$event:e}),this.syncFromGlobal(),this.requestViewRefresh()})}onDividerInputChange(e){this.redisTreeDivider=e??"",this.settings.redisTreeDivider.set(this.redisTreeDivider),this.dividerChange$.next(this.redisTreeDivider)}setDivider(e){this.redisTreeDivider=e??"",this.applyDivider(this.redisTreeDivider)}applyDivider(e){this.settings.redisTreeDivider.set(e),this.state.redisChanged.set(!0),this.cmd.treeRefresh$.next(),this.syncFromGlobal()}pageAction(e){let t=this.state.page()??1,i=this.pages;switch(e){case"prev":t-1>=1&&this.state.page.set(t-1);break;case"next":t+1<=i&&this.state.page.set(t+1);break;case"last":{this.state.page.set(i);break}case"first":{this.state.page.set(1);break}}this.syncFromGlobal()}onPageInputChange(e){let t=parseInt(e,10),i=isNaN(t)?1:t;this.state.page.set(i),this.pageChange()}pageChange(){let e=this.state.page()??1,t=this.pages;e<1?e=1:e>t&&(e=t),this.state.page.set(e),this.syncFromGlobal()}onSearchModelChange(e){this.search=e??"",this.state.search.set(this.search)}onSearchChange(){return E(this,null,function*(){this.state.search.set(this.search),this.state.page.set(1),this.settings.searchClientSide()&&this.state.redisChanged.set(!0),yield this.cmd.refresh(),this.syncFromGlobal(),this.requestViewRefresh(),this.socket.tick()})}clearSearch(){return E(this,null,function*(){this.search="",yield this.onSearchChange()})}exportKeys(){return E(this,null,function*(){let e=this.state.keysRaw();if(!Array.isArray(e)||e.length===0){this.common.toast({message:this.strings().label?.noKeysToExport});return}try{this.overlay.show({message:this.strings().label?.exportProgress});let t=yield this.socket.request({action:"key/export",payload:{keys:e}}),i=JSON.stringify(t.data,null,2),r=new Blob([i],{type:"application/json"}),a=URL.createObjectURL(r),u=document.createElement("a");u.href=a;let y=this.state.connection()?.name||"redis",b=this.state.currentDatabase()??0;u.download=`${y}-db${b}-export.json`,u.click(),URL.revokeObjectURL(a),this.common.toast({message:this.strings().status?.exportDone})}catch(t){this.common.generalHandleError(t)}finally{this.overlay.hide()}})}importKeys(){return E(this,null,function*(){let e=document.createElement("input");e.type="file",e.accept=".json",e.onchange=()=>E(this,null,function*(){let t=e.files?.[0];if(!t)return;let i=new FileReader;i.onerror=()=>this.common.generalHandleError(i.error),i.onload=r=>E(this,null,function*(){try{let a=JSON.parse(r.target.result);if(!a?.keys||!Array.isArray(a.keys)||a.keys.length===0){this.common.toast({message:this.strings().label?.importNoKeys});return}let u=yield this.keyImportDialog.show({data:a});if(u?.pending){try{this.overlay.show({message:this.strings().label?.importProgress});let b=(yield this.socket.request({action:"key/import",payload:{keys:u.keys,conflictMode:u.conflictMode}})).data,x=this.strings().status?.importDone,k=typeof x=="function"?x(b):`Import complete: ${b.created} created, ${b.skipped} skipped, ${b.errors} errors`;this.common.toast({message:k})}finally{this.overlay.hide()}yield this.cmd.refresh(),this.ngZone.run(()=>{this.syncFromGlobal(),this.requestViewRefresh()})}}catch(a){a!=null&&this.common.generalHandleError(a)}}),i.readAsText(t)}),e.click()})}deleteSearchLabel(){let e=this.strings();if(this.search.length>0){let i=e.intention?.deleteSearchKeys;return typeof i=="function"?i({count:this.keyCount}):`Delete ${this.keyCount} matching keys`}let t=e.intention?.deleteAllKeysMenu;return typeof t=="function"?t({count:this.keyCount}):`Delete all ${this.keyCount} keys`}deleteSearchKeys(){return E(this,null,function*(){let e;this.search.length>0?this.settings.searchStartsWith()?e=this.search+"*":e="*"+this.search+"*":e="*";try{let t=this.strings().confirm?.deleteSearchKeys,i=typeof t=="function"?t({count:this.keyCount,pattern:e}):`Are you sure to delete all keys matching "${e}"? Found ${this.keyCount} keys.`;yield this.common.confirm({message:i}),this.overlay.show({message:this.strings().label?.deletingSearchKeys});let a=(yield this.socket.request({action:"key/delete-search-keys",payload:{match:e}})).deletedCount||0,u=this.strings().status?.deletedSearchKeys,y=typeof u=="function"?u({count:a}):`Deleted ${a} keys`;this.common.toast({message:y}),yield this.cmd.refresh(),this.ngZone.run(()=>{this.syncFromGlobal(),this.requestViewRefresh()})}catch(t){t!=null&&this.common.generalHandleError(t)}finally{this.overlay.hide()}})}searchInputClass(){let e=this.search.length>0;return this.isReadonly?e?"search-readonly-clear":"search-readonly":e?"search-full-clear":"search-full"}exportLabel(){let e=this.strings();if(this.search.length>0){let i=e.intention?.exportSearchResults;return typeof i=="function"?i({count:this.keyCount}):`Export ${this.keyCount} results`}let t=e.intention?.exportAllKeys;return typeof t=="function"?t({count:this.keyCount}):`Export all ${this.keyCount} keys`}addRootKey(e){this.cmd.addKey({event:e})}syncFromGlobal(){let e=this.state.filteredKeys();this.page=Number(this.state.page()??1),this.pages=Number(this.state.pages()??0),this.search=this.state.search()??"";let t=this.state.keysRaw();this.keyCount=Array.isArray(t)?t.length:0,this.redisTreeDivider=this.settings.redisTreeDivider()??":",this.treeDividers=Array.isArray(this.state.cfg()?.treeDividers)?this.state.cfg().treeDividers.slice():[],this.searchClientSide=!!this.settings.searchClientSide(),this.isReadonly=this.state.connection()?.readonly===!0}requestViewRefresh(){setTimeout(()=>{try{this.cdr.detectChanges()}catch(e){}})}static \u0275fac=function(t){return new(t||n)(m($),m(q),m(K),m(de),m(L),m(Xe),m(rt),m(j),m(F),m(N),m(G),m(Le))};static \u0275cmp=O({type:n,selectors:[["p3xr-database-treecontrol-controls"]],inputs:{p3xrMainRef:"p3xrMainRef"},decls:52,vars:28,consts:[["expandMenu","matMenu"],["actionsMenu","matMenu"],["dividerMenu","matMenu"],[1,"p3xr-database-treecontrol-controls-leading"],["type","button","matTooltipPosition","above",1,"p3xr-database-treecontrol-icon-button","p3xr-database-treecontrol-icon-primary",3,"matMenuTriggerFor","matTooltip"],["aria-hidden","true",1,"material-icons"],["mat-menu-item","",3,"click"],["type","button","id","p3xr-database-treecontrol-controls-collapse-all","matTooltipPosition","above",1,"p3xr-database-treecontrol-icon-button",3,"click","matTooltip"],["type","button","matTooltipPosition","above",1,"p3xr-database-treecontrol-icon-button",3,"click","matTooltip"],["id","p3xr-database-treecontrol-controls-tree-divider-input","matTooltipPosition","above",1,"p3xr-database-treecontrol-divider-input",3,"ngModelChange","ngModel","matTooltip"],[1,"p3xr-database-treecontrol-controls-pager",3,"matTooltip"],[1,"p3xr-database-treecontrol-controls-keycount"],[1,"p3xr-database-treecontrol-controls-search"],["matTooltipPosition","right","matTooltipClass","p3xr-tree-node-tooltip",3,"ngModelChange","enterPressed","placeholder","ngModel","matTooltip"],["type","button","matTooltipPosition","above",1,"p3xr-database-treecontrol-icon-button","p3xr-database-treecontrol-icon-primary",3,"click","matTooltip"],["type","button","matTooltipPosition","above",1,"p3xr-database-treecontrol-icon-button","p3xr-database-treecontrol-icon-primary",3,"matTooltip"],["matTooltipPosition","above",1,"material-icons","p3xr-database-treecontrol-root-add",3,"matTooltip"],["type","button",1,"p3xr-database-treecontrol-icon-button",3,"matMenuTriggerFor"],[1,"p3xr-menu-hint"],["type","button","matTooltipPosition","above",1,"p3xr-database-treecontrol-divider-trigger",3,"matMenuTriggerFor","matTooltip"],[1,"p3xr-divider-menu"],["mat-menu-item","","type","button"],["mat-menu-item","","type","button",3,"click"],[1,"p3xr-database-treecontrol-divider-menu-label"],["type","button",1,"p3xr-database-treecontrol-icon-button","p3xr-database-treecontrol-icon-primary",3,"click","matTooltip"],["type","button",1,"p3xr-database-treecontrol-icon-button",3,"click","matTooltip"],["type","number","step","1","min","1",1,"p3xr-database-treecontrol-page-input",3,"ngModelChange","max","ngModel"],[1,"p3xr-database-treecontrol-pager-text"],["matTooltipPosition","above",1,"material-icons","p3xr-database-treecontrol-root-add",3,"click","matTooltip"]],template:function(t,i){if(t&1&&(o(0,"div",3)(1,"button",4)(2,"span",5),d(3,"keyboard_arrow_down"),l()(),o(4,"mat-menu",null,0)(6,"button",6),h("click",function(){return i.treeExpandToLevel(1)}),d(7),l(),o(8,"button",6),h("click",function(){return i.treeExpandToLevel(2)}),d(9),l(),o(10,"button",6),h("click",function(){return i.treeExpandToLevel(3)}),d(11),l(),o(12,"button",6),h("click",function(){return i.treeExpandToLevel(4)}),d(13),l(),o(14,"button",6),h("click",function(){return i.treeExpandToLevel(5)}),d(15),l(),T(16,"mat-divider"),o(17,"button",6),h("click",function(){return i.treeExpandAll()}),d(18),l()(),o(19,"button",7),h("click",function(){return i.treeCollapseAll()}),o(20,"span",5),d(21,"keyboard_arrow_up"),l()(),o(22,"button",8),h("click",function(){return i.refreshTree()}),o(23,"span",5),d(24,"refresh"),l()(),o(25,"button",8),h("click",function(a){return i.openTreeSettingDialog(a)}),o(26,"span",5),d(27,"settings"),l()(),o(28,"p3xr-ng-input",9),h("ngModelChange",function(a){return i.onDividerInputChange(a)}),l(),C(29,St,7,2),l(),C(30,Et,16,8,"span",10)(31,Dt,2,1,"span",11),o(32,"div",12)(33,"p3xr-ng-input",13),h("ngModelChange",function(a){return i.onSearchModelChange(a)})("enterPressed",function(){return i.onSearchChange()}),l(),o(34,"button",14),h("click",function(){return i.onSearchChange()}),o(35,"span",5),d(36,"search"),l()(),C(37,Mt,3,1,"button",15),C(38,It,2,1,"span",16),o(39,"button",17)(40,"span",5),d(41,"more_vert"),l()(),o(42,"mat-menu",null,1)(44,"button",6),h("click",function(){return i.exportKeys()}),o(45,"mat-icon"),d(46,"file_download"),l(),o(47,"span"),d(48),l()(),C(49,zt,2,1,"div",18),C(50,Vt,6,2),C(51,Ft,7,4),l()()),t&2){let r,a,u,y,b,x,k,S,M,I,R,V,W,ct=Y(5),dt=Y(43);s(),_("matMenuTriggerFor",ct)("matTooltip",(r=i.strings().intention)==null?null:r.extend),s(6),z("",(a=i.strings().page)==null||a.treeControls==null?null:a.treeControls.level," 1"),s(2),z("",(u=i.strings().page)==null||u.treeControls==null?null:u.treeControls.level," 2"),s(2),z("",(y=i.strings().page)==null||y.treeControls==null?null:y.treeControls.level," 3"),s(2),z("",(b=i.strings().page)==null||b.treeControls==null?null:b.treeControls.level," 4"),s(2),z("",(x=i.strings().page)==null||x.treeControls==null?null:x.treeControls.level," 5"),s(3),D((k=i.strings().page)==null||k.treeControls==null?null:k.treeControls.expandAll),s(),_("matTooltip",(S=i.strings().page)==null||S.treeControls==null?null:S.treeControls.collapseAll),s(3),_("matTooltip",(M=i.strings().intention)==null?null:M.refresh),s(3),_("matTooltip",(I=i.strings().form)==null||I.treeSettings==null||I.treeSettings.label==null?null:I.treeSettings.label.formName),s(3),_("ngModel",i.redisTreeDivider)("matTooltip",(R=i.strings().form)==null||R.treeSettings==null||R.treeSettings.field==null?null:R.treeSettings.field.treeSeparator),s(),v(i.treeDividers.length>0?29:-1),s(),v(i.pages>1?30:31),s(3),ie("p3xr-database-treecontrol-search-input "+i.searchInputClass()),_("placeholder",i.searchPlaceholder())("ngModel",i.search)("matTooltip",(V=i.strings().page)==null||V.treeControls==null||V.treeControls.search==null?null:V.treeControls.search.infoDetails),s(),_("matTooltip",(W=i.strings().page)==null||W.treeControls==null||W.treeControls.search==null?null:W.treeControls.search.search),s(3),v(i.search.length>0?37:-1),s(),v(i.isReadonly?-1:38),s(),_("matMenuTriggerFor",dt),s(9),D(i.exportLabel()),s(),v(i.search.length>0?49:-1),s(),v(i.isReadonly?-1:50),s(),v(i.isReadonly?-1:51)}},dependencies:[P,ae,Fe,Pe,B,A,Ye,Je,Ue,Qe,le,se,Ne,Ke,et],styles:[`:host{display:block;margin-top:2px;min-height:24px;text-align:center}#p3xr-database-treecontrol-controls-container{display:inline-block}.p3xr-database-treecontrol-controls-leading{float:left;line-height:31px}.p3xr-database-treecontrol-controls-search{clear:both;padding:5px;text-align:left;line-height:24px}.p3xr-database-treecontrol-controls-pager{display:inline-block;position:relative;top:2px;vertical-align:middle;line-height:24px}.p3xr-database-treecontrol-controls-keycount{float:right;line-height:26px;margin-top:6px;opacity:.5}.p3xr-database-treecontrol-divider-menu-label{font-family:Roboto Mono,monospace;font-size:14px;font-weight:500}.p3xr-divider-menu.mat-mdc-menu-panel{min-width:20px!important;max-width:40px!important;transform:translate(-20px)}.p3xr-divider-menu.mat-mdc-menu-panel .mat-mdc-menu-content{padding:0!important}.p3xr-divider-menu.mat-mdc-menu-panel .mat-mdc-menu-item{min-height:28px;height:28px;padding:0!important;min-width:0;text-align:center;justify-content:center}.p3xr-divider-menu.mat-mdc-menu-panel .mat-mdc-menu-item .mdc-list-item__primary-text{width:100%;text-align:center}.p3xr-divider-menu.mat-mdc-menu-panel .p3xr-database-treecontrol-divider-menu-label{display:block;text-align:center;width:100%}.p3xr-database-treecontrol-icon-button{align-items:center;background:none;border:0;border-radius:50%;color:var(--p3xr-treecontrol-icon-color);cursor:pointer;display:inline-flex;height:24px;justify-content:center;line-height:24px;margin:0;min-height:24px;min-width:24px;padding:0;vertical-align:middle;width:24px}.p3xr-database-treecontrol-icon-button:focus{outline:none}.p3xr-database-treecontrol-icon-button .material-icons{display:block;font-size:24px;height:24px;line-height:24px;width:24px}.p3xr-database-treecontrol-root-add{color:var(--p3xr-common-warn-color);cursor:pointer;display:inline-block;font-size:24px;height:24px;line-height:24px;vertical-align:middle;width:24px}.p3xr-database-treecontrol-icon-primary{color:var(--p3xr-btn-primary-bg)}p3xr-ng-input.p3xr-database-treecontrol-divider-input{font-family:Roboto Mono,monospace;font-size:14px;font-weight:500;text-align:center;vertical-align:middle!important;width:23px}p3xr-ng-input.p3xr-database-treecontrol-divider-input input.p3xr-input{text-align:center}.p3xr-database-treecontrol-divider-trigger{background:none;border:0;color:var(--p3xr-treecontrol-icon-color);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;height:24px;margin:0;padding:0;vertical-align:middle;width:14px}.p3xr-database-treecontrol-divider-trigger .material-icons{font-size:18px;height:18px;width:18px}p3xr-ng-input.p3xr-database-treecontrol-page-input{vertical-align:middle!important;width:48px}.p3xr-database-treecontrol-pager-text{vertical-align:middle}.p3xr-menu-hint{padding:0 16px 8px;font-size:11px;opacity:.5;font-style:italic;pointer-events:none;line-height:1.3}p3xr-ng-input.p3xr-database-treecontrol-search-input{vertical-align:middle!important;width:auto}.p3xr-database-treecontrol-search-input.search-full{width:calc(100% - 73px)}.p3xr-database-treecontrol-search-input.search-full-clear{width:calc(100% - 98px)}.p3xr-database-treecontrol-search-input.search-readonly{width:calc(100% - 48px)}.p3xr-database-treecontrol-search-input.search-readonly-clear{width:calc(100% - 73px)}
`],encapsulation:2,changeDetection:0})}return n})();var ue=_e(pt()),st=_e(mt());function Kt(n,p){if(n&1){let e=w();o(0,"span",12),h("click",function(i){f(e);let r=c().$implicit;return c(2).toggleExpand(r),g(i.stopPropagation())}),l()}if(n&2){let e=c().$implicit,t=c(2);te("tree-expanded",t.isExpanded(e))("tree-collapsed",!t.isExpanded(e))}}function Nt(n,p){n&1&&T(0,"i",14)}function jt(n,p){n&1&&T(0,"i",15)}function Lt(n,p){n&1&&T(0,"i",16)}function $t(n,p){n&1&&T(0,"i",17)}function Ht(n,p){n&1&&T(0,"i",18)}function At(n,p){n&1&&T(0,"i",19)}function Bt(n,p){n&1&&T(0,"i",20)}function Gt(n,p){n&1&&T(0,"i",21)}function Wt(n,p){n&1&&T(0,"i",22)}function Zt(n,p){n&1&&T(0,"i",22)}function qt(n,p){n&1&&T(0,"i",23)}function Xt(n,p){n&1&&T(0,"i",24)}function Ut(n,p){n&1&&T(0,"i",25)}function Jt(n,p){n&1&&T(0,"i",26)}function Qt(n,p){if(n&1){let e=w();o(0,"span",13),h("click",function(){f(e);let i=c().$implicit,r=c(2);return g(r.selectNode(i))}),C(1,Nt,1,0,"i",14)(2,jt,1,0,"i",15)(3,Lt,1,0,"i",16)(4,$t,1,0,"i",17)(5,Ht,1,0,"i",18)(6,At,1,0,"i",19)(7,Bt,1,0,"i",20)(8,Gt,1,0,"i",21)(9,Wt,1,0,"i",22)(10,Zt,1,0,"i",22)(11,qt,1,0,"i",23)(12,Xt,1,0,"i",24)(13,Ut,1,0,"i",25)(14,Jt,1,0,"i",26),l()}if(n&2){let e,t=c().$implicit;s(),v((e=t.keysInfo.type)==="hash"?1:e==="list"?2:e==="set"?3:e==="string"?4:e==="zset"?5:e==="stream"?6:e==="json"?7:e==="timeseries"?8:e==="bloom"?9:e==="cuckoo"?10:e==="topk"?11:e==="cms"?12:e==="tdigest"?13:e==="vectorset"?14:-1)}}function Yt(n,p){if(n&1&&(o(0,"span",9),d(1),l()),n&2){let e=c().$implicit,t=c(2);s(),ke("",t.divider,"* (",e.childCount,")")}}function ei(n,p){if(n&1&&(o(0,"span",9),d(1),l()),n&2){let e=c().$implicit;s(),z("(",e.keysInfo.length,")")}}function ti(n,p){if(n&1&&(o(0,"span",27)(1,"span",28),d(2,"schedule"),l()()),n&2){let e=c().$implicit,t=c(2);ie(t.getTtlClass(e)),_("matTooltip","TTL: "+t.formatTtl(e))}}function ii(n,p){if(n&1){let e=w();o(0,"span",29)(1,"span",31),h("click",function(i){f(e);let r=c(2).$implicit,a=c(2);return g(a.deleteTree(i,r))}),d(2,"delete"),l()()}if(n&2){let e=c(2).$implicit,t=c(2);_("matTooltip",t.deleteTreeTooltip(e))}}function ni(n,p){if(n&1){let e=w();o(0,"span",29)(1,"span",31),h("click",function(i){f(e);let r=c(2).$implicit,a=c(2);return g(a.deleteKey(i,r.key))}),d(2,"delete"),l()()}if(n&2){let e,t=c(4);_("matTooltip",(e=t.strings())==null||e.intention==null?null:e.intention.delete)}}function oi(n,p){if(n&1){let e=w();o(0,"span",11),C(1,ii,3,1,"span",29)(2,ni,3,1,"span",29),o(3,"span",29)(4,"span",30),h("click",function(i){f(e);let r=c().$implicit,a=c(2);return g(a.addKey(i,r))}),d(5,"add"),l()()()}if(n&2){let e,t=c().$implicit,i=c(2);s(),v(t.type==="folder"?1:2),s(2),_("matTooltip",(e=i.strings())==null||e.intention==null?null:e.intention.addKey)}}function ri(n,p){if(n&1){let e=w();o(0,"div",3),C(1,Kt,1,4,"span",4)(2,Qt,15,1,"span",5),o(3,"span",6)(4,"label",7),h("click",function(){let i=f(e).$implicit,r=c(2);return g(i.expandable?r.toggleExpand(i):r.selectNode(i))}),o(5,"span",8),d(6),l(),C(7,Yt,2,2,"span",9),C(8,ei,2,1,"span",9),l(),C(9,ti,3,3,"span",10),l(),C(10,oi,6,2,"span",11),l()}if(n&2){let e=p.$implicit,t=c(2);ee("padding-left",e.level*20+4,"px"),s(),v(e.expandable?1:e.keysInfo?2:-1),s(2),X("data-p3xr-tree-key",e.type==="folder"?"":e.key),s(),_("matTooltip",t.extractNodeTooltip(e)),s(2),D(e.label),s(),v(e.type==="folder"?7:-1),s(),v(e.type!=="folder"&&(e.keysInfo==null?null:e.keysInfo.type)!=="string"&&(e.keysInfo==null?null:e.keysInfo.type)!=="json"&&e.keysInfo?8:-1),s(),v(e.type!=="folder"&&t.getRemainingTtl(e)>0?9:-1),s(),v(t.isReadonly?-1:10)}}function ai(n,p){if(n&1&&(o(0,"cdk-virtual-scroll-viewport",1),H(1,ri,11,10,"div",2),l()),n&2){let e=c();_("itemSize",28),s(),_("cdkVirtualForOf",e.dataSource)("cdkVirtualForTrackBy",e.trackByKey)}}var lt=(()=>{class n{ngZone;elementRef;i18n;common;theme;socket;keyNewOrSetDialog;nav;cmd;cdr;treeBuilder;state;settingsService;p3xrResize;p3xrMainRef;viewport;dataSource=[];isEnabled=!1;isReadonly=!1;divider=":";strings;expandedKeys=new Set;expandedNodeObjects=[];hierarchicalNodes=[];get expansionStorageKey(){let e=this.state.connection()?.id||"none",t=this.state.currentDatabase()??0;return`p3xr-tree-expanded-${e}-${t}`}saveExpansion(){try{sessionStorage.setItem(this.expansionStorageKey,JSON.stringify([...this.expandedKeys]))}catch(e){}}restoreExpansion(){try{let e=sessionStorage.getItem(this.expansionStorageKey);e&&(this.expandedKeys=new Set(JSON.parse(e)))}catch(e){}}unsubs=[];constructor(e,t,i,r,a,u,y,b,x,k,S,M,I){this.ngZone=e,this.elementRef=t,this.i18n=i,this.common=r,this.theme=a,this.socket=u,this.keyNewOrSetDialog=y,this.nav=b,this.cmd=x,this.cdr=k,this.treeBuilder=S,this.state=M,this.settingsService=I,this.strings=this.i18n.strings,Z(()=>{this.i18n.currentLang(),this.cdr.markForCheck()})}ngOnInit(){this.syncGlobalState(),this.attachWindowFocusListener(),this.startPolling(),this.startTtlRepaint();let e=this.cmd.keyDelete$.subscribe(x=>{this.ngZone.run(()=>this.deleteKey(x.event,x.key))});this.unsubs.push(()=>e.unsubscribe());let t=this.cmd.keyRename$.subscribe(x=>{this.ngZone.run(()=>this.renameKey(x.event,x.key))});this.unsubs.push(()=>t.unsubscribe());let i=this.cmd.keyNew$.subscribe(x=>{this.ngZone.run(()=>this.addKey(x.event,x.node?he(me({},x),{_sourceNode:x.node}):x))});this.unsubs.push(()=>i.unsubscribe());let r=this.cmd.treeControlEnabled$.subscribe(x=>{this.ngZone.run(()=>{this.isEnabled=x})});this.unsubs.push(()=>r.unsubscribe());let a=this.cmd.treeRefresh$.subscribe(()=>{this.ngZone.run(()=>{this.syncGlobalState(),this.rebuildTree()})});this.unsubs.push(()=>a.unsubscribe());let u=this.common.treeExpandAll$.subscribe(()=>this.ngZone.run(()=>{let x=new Set,k=S=>{for(let M of S)M.type==="folder"&&(x.add(M.key),k(M.children??[]))};k(this.hierarchicalNodes),this.expandedKeys=x,this.flattenVisibleNodes(),this.syncExpandedNodesToGlobal(),this.saveExpansion(),this.cdr.markForCheck()}));this.unsubs.push(()=>u.unsubscribe());let y=this.common.treeCollapseAll$.subscribe(()=>this.ngZone.run(()=>{this.expandedKeys=new Set,this.flattenVisibleNodes(),this.syncExpandedNodesToGlobal(),this.saveExpansion(),this.cdr.markForCheck()}));this.unsubs.push(()=>y.unsubscribe());let b=this.common.treeExpandToLevel$.subscribe(x=>this.ngZone.run(()=>{let k=new Set,S=(M,I)=>{for(let R of M)R.type==="folder"&&(I<x&&k.add(R.key),S(R.children??[],I+1))};S(this.hierarchicalNodes,0),this.expandedKeys=k,this.flattenVisibleNodes(),this.syncExpandedNodesToGlobal(),this.saveExpansion(),this.cdr.markForCheck()}));this.unsubs.push(()=>b.unsubscribe()),setTimeout(()=>{this.isEnabled=!0,this.cdr.markForCheck()},50)}ngOnDestroy(){this.unsubs.forEach(e=>e())}ttlRepaintTimer;startTtlRepaint(){let e=()=>{this.cdr.markForCheck();let t=1/0,i=!1;for(let a of this.dataSource){if(a.type==="folder")continue;let u=a.keysInfo?.ttl;if(!u||u<=0)continue;let y=this.getRemainingTtl(a);y<=0?i=!0:y<t&&(t=y)}if(i){this.cmd.refresh(),this.ttlRepaintTimer=setTimeout(e,3e3);return}let r;t<=30?r=1e3:t<=300?r=5e3:r=3e4,this.ttlRepaintTimer=setTimeout(e,r)};this.ttlRepaintTimer=setTimeout(e,3e4),this.unsubs.push(()=>clearTimeout(this.ttlRepaintTimer))}getRemainingTtl(e){let t=e.keysInfo?.ttl;if(!t||t<=0)return-1;let i=this.state.keysInfoFetchedAt()??Date.now(),r=Math.floor((Date.now()-i)/1e3),a=t-r;return a>0?a:-1}formatTtl(e){let t=this.getRemainingTtl(e);if(t<=0)return"";let i=this.settingsService.getHumanizeDurationOptions();return(0,st.default)(t*1e3,he(me({},i),{largest:2,round:!0,delimiter:" "}))}getTtlClass(e){let t=this.getRemainingTtl(e);return t<=0?"":t<30?"p3xr-tree-ttl-red p3xr-tree-ttl-pulse":t<300?"p3xr-tree-ttl-red":t<3600?"p3xr-tree-ttl-yellow":"p3xr-tree-ttl-green"}trackByKey(e,t){return t.key}isExpanded(e){return this.expandedKeys.has(e.key)}toggleExpand(e){this.expandedKeys.has(e.key)?this.expandedKeys.delete(e.key):this.expandedKeys.add(e.key),this.flattenVisibleNodes(),this.syncExpandedNodesToGlobal(),this.saveExpansion()}selectNode(e){this.navigateTo("database.key",{key:e.key})}deleteKey(e,t){return E(this,null,function*(){try{e.preventDefault(),e.stopPropagation(),yield this.common.confirm({message:this.i18n.strings().confirm.deleteKey}),yield this.socket.request({action:"key/delete",payload:{key:t}}),typeof window.gtag=="function"&&window.gtag("config",this.settingsService.googleAnalytics,{page_path:"/delete"}),this.navigateTo("database.statistics"),this.common.toast(this.i18n.strings().status.deletedKey({key:t})),yield this.cmd.refresh(),this.rebuildTree()}catch(i){this.common.generalHandleError(i)}})}renameKey(e,t){return E(this,null,function*(){try{e?.stopPropagation?.();let i=yield this.common.prompt({title:this.i18n.strings().confirm.rename.title,placeholder:this.i18n.strings().confirm.rename.placeholder,initialValue:t,ok:this.i18n.strings().intention.rename,cancel:this.i18n.strings().intention.cancel});yield this.socket.request({action:"key/rename",payload:{key:t,keyNew:i}}),typeof window.gtag=="function"&&window.gtag("config",this.settingsService.googleAnalytics,{page_path:"/rename"}),this.navigateTo("database.key",{key:i}),this.common.toast(this.i18n.strings().status.renamedKey),yield this.cmd.refresh(),this.rebuildTree()}catch(i){this.common.generalHandleError(i)}})}deleteTree(e,t){return E(this,null,function*(){try{e.stopPropagation(),yield this.common.confirm({message:this.i18n.strings().confirm.deleteAllKeys({key:t.key})});let i=this.settingsService.redisTreeDivider();yield this.socket.request({action:"key/del-tree",payload:{key:t.key,redisTreeDivider:i}}),this.common.toast(this.i18n.strings().status.treeDeleted({key:t.key}));let r=location.pathname;r.startsWith("/database/key/")&&decodeURIComponent(r.slice(14).replace(/~/g,"%")).startsWith(t.key+i)&&this.navigateTo("database.statistics"),yield this.cmd.refresh(),this.rebuildTree()}catch(i){this.common.generalHandleError(i)}})}addKey(e,t){return E(this,null,function*(){try{e.stopPropagation();let i=yield this.keyNewOrSetDialog.show({type:"add",$event:e,node:t._sourceNode??{key:t.key}});yield this.cmd.refresh(),this.rebuildTree(),this.navigateTo("database.key",{key:i.key})}catch(i){this.common.generalHandleError(i)}})}extractNodeTooltip(e){if(e.type!=="folder"&&e.keysInfo){let t=this.i18n.strings();return(0,ue.htmlEncode)((t.redisTypes?.[e.keysInfo.type]??e.keysInfo.type)+" - "+e.key)}return(0,ue.htmlEncode)(e.key)}deleteTreeTooltip(e){return this.i18n.strings().confirm?.deleteAllKeys?.({key:e.key})??""}rebuildTree(){this.divider=this.settingsService.redisTreeDivider()??":",this.isReadonly=this.state.connection()?.readonly===!0;let e=this.state.paginatedKeys()??[],t=this.state.keysInfo()??{};this.expandedKeys.size===0&&this.restoreExpansion(),this.treeBuilder.keysToTreeControl({keys:e,divider:this.divider,keysInfo:t}).then(({nodes:i})=>{this.hierarchicalNodes=i,this.flattenVisibleNodes(),this.requestViewRefresh()})}flattenVisibleNodes(){let e=[],t=(i,r)=>{for(let a of i)e.push({label:a.label,key:a.key,level:r,expandable:a.type==="folder",type:a.type,childCount:a.childCount??0,keysInfo:a.keysInfo,_sourceNode:a}),a.type==="folder"&&this.expandedKeys.has(a.key)&&a.children?.length>0&&t(a.children,r+1)};t(this.hierarchicalNodes,0),this.dataSource=e}syncExpandedNodesToGlobal(){let e=[],t=i=>{for(let r of i)r.type==="folder"&&this.expandedKeys.has(r.key)&&e.push(r),r.children?.length>0&&t(r.children)};t(this.hierarchicalNodes),this.expandedNodeObjects=e}syncGlobalState(){this.divider=this.settingsService.redisTreeDivider()??":",this.isReadonly=this.state.connection()?.readonly===!0}startPolling(){let e="",t=setInterval(()=>{let i=JSON.stringify({keysLength:this.state.paginatedKeys()?.length,page:this.state.page(),divider:this.settingsService.redisTreeDivider(),readonly:this.state.connection()?.readonly});i!==e&&(e=i,this.ngZone.run(()=>{this.syncGlobalState(),this.rebuildTree()}))},300);this.unsubs.push(()=>clearInterval(t)),this.ngZone.run(()=>this.rebuildTree())}attachWindowFocusListener(){let e=()=>{this.isEnabled&&this.ngZone.run(()=>{this.isEnabled=!1,setTimeout(()=>{this.isEnabled=!0,this.rebuildTree()})})};window.addEventListener("focus",e),this.unsubs.push(()=>window.removeEventListener("focus",e))}navigateTo(e,t){this.nav.navigateTo(e,t)}requestViewRefresh(){setTimeout(()=>{try{this.cdr.detectChanges(),this.viewport?.checkViewportSize()}catch(e){}})}static \u0275fac=function(t){return new(t||n)(m($),m(q),m(K),m(de),m(tt),m(j),m(it),m(ce),m(L),m(F),m(He),m(N),m(G))};static \u0275cmp=O({type:n,selectors:[["p3xr-database-tree"]],viewQuery:function(t,i){if(t&1&&Ce(re,5),t&2){let r;ve(r=ye())&&(i.viewport=r.first)}},inputs:{p3xrResize:"p3xrResize",p3xrMainRef:"p3xrMainRef"},decls:1,vars:1,consts:[["class","p3xr-database-tree-viewport",3,"itemSize",4,"ngIf"],[1,"p3xr-database-tree-viewport",3,"itemSize"],["class","p3xr-database-tree-row",3,"padding-left",4,"cdkVirtualFor","cdkVirtualForOf","cdkVirtualForTrackBy"],[1,"p3xr-database-tree-row"],[1,"p3xr-tree-branch-head",3,"tree-expanded","tree-collapsed"],[2,"cursor","pointer"],[2,"display","inline-flex","align-items","center"],["matTooltipPosition","right","matTooltipClass","p3xr-tree-node-tooltip",1,"p3xr-database-tree-node",3,"click","matTooltip"],[1,"p3xr-database-tree-node-label"],[1,"p3xr-database-tree-node-count"],["matTooltipPosition","right","matTooltipClass","p3xr-tree-node-tooltip",1,"p3xr-tree-ttl-badge",3,"class","matTooltip"],[1,"p3xr-database-tree-actions"],[1,"p3xr-tree-branch-head",3,"click"],[2,"cursor","pointer",3,"click"],["aria-hidden","true",1,"fas","fa-hashtag","p3xr-tree-type-icon"],["aria-hidden","true",1,"fas","fa-list-ol","p3xr-tree-type-icon"],["aria-hidden","true",1,"fas","fa-list","p3xr-tree-type-icon"],["aria-hidden","true",1,"fas","fa-ellipsis-h","p3xr-tree-type-icon"],["aria-hidden","true",1,"fas","fa-chart-line","p3xr-tree-type-icon"],["aria-hidden","true",1,"fas","fa-stream","p3xr-tree-type-icon"],["aria-hidden","true",1,"fas","fa-code","p3xr-tree-type-icon"],["aria-hidden","true",1,"fas","fa-chart-area","p3xr-tree-type-icon"],["aria-hidden","true",1,"fas","fa-filter","p3xr-tree-type-icon"],["aria-hidden","true",1,"fas","fa-trophy","p3xr-tree-type-icon"],["aria-hidden","true",1,"fas","fa-chart-simple","p3xr-tree-type-icon"],["aria-hidden","true",1,"fas","fa-chart-bar","p3xr-tree-type-icon"],["aria-hidden","true",1,"fas","fa-brain","p3xr-tree-type-icon"],["matTooltipPosition","right","matTooltipClass","p3xr-tree-node-tooltip",1,"p3xr-tree-ttl-badge",3,"matTooltip"],[1,"material-icons","p3xr-tree-ttl-icon"],["matTooltipPosition","after","matTooltipClass","p3xr-tree-node-tooltip",3,"matTooltip"],[1,"material-icons","p3xr-database-treecontrol-folder-icon",3,"click"],[1,"material-icons","p3xr-database-treecontrol-delete-icon",3,"click"]],template:function(t,i){t&1&&H(0,ai,2,3,"cdk-virtual-scroll-viewport",0),t&2&&_("ngIf",i.dataSource.length>0&&i.isEnabled)},dependencies:[P,ne,De,Se,Ee,re,B,A],styles:[`p3xr-database-tree{display:block;height:100%;width:100%;overflow:hidden}.p3xr-database-tree-viewport{height:100%;width:100%;scrollbar-width:none;-ms-overflow-style:none}.p3xr-database-tree-viewport::-webkit-scrollbar{width:0;height:0;display:none}.p3xr-database-tree-row{display:flex;align-items:center;height:28px;line-height:28px;white-space:nowrap;cursor:default}.p3xr-tree-branch-head{display:inline-block;font-family:"Font Awesome 5 Free";font-style:normal;font-weight:900;font-size:24px;line-height:28px;width:28px;text-align:center;margin-right:4px;cursor:pointer;color:var(--p3xr-tree-branch-color)}.p3xr-tree-branch-head.tree-collapsed:before{content:"\\f07b"}.p3xr-tree-branch-head.tree-expanded:before{content:"\\f07c"}.p3xr-tree-type-icon{display:inline-block!important;font-size:14px!important;line-height:28px!important;width:28px!important;text-align:center!important;margin-left:0!important;margin-right:4px!important}.p3xr-database-tree-node{cursor:pointer;display:inline-flex;align-items:center;height:28px;white-space:nowrap}.p3xr-database-tree-node-count{opacity:.5;margin-left:4px}.p3xr-database-treecontrol-folder-icon,.p3xr-database-treecontrol-delete-icon{font-size:18px!important;height:18px!important;width:18px!important;min-width:18px!important;min-height:18px!important;line-height:18px!important;cursor:pointer;vertical-align:middle}.p3xr-database-treecontrol-folder-icon{color:var(--p3xr-common-warn-color)}.p3xr-database-treecontrol-delete-icon{color:var(--p3xr-btn-warn-bg)}.p3xr-tree-ttl-badge{display:inline-flex;align-items:center;vertical-align:middle;margin-left:4px;cursor:default;height:28px}.p3xr-tree-ttl-icon{font-size:16px!important;width:16px!important;height:16px!important;vertical-align:middle!important}.p3xr-tree-ttl-green .p3xr-tree-ttl-icon{color:var(--mat-sys-primary, #4caf50)}.p3xr-tree-ttl-yellow .p3xr-tree-ttl-icon{color:var(--mat-sys-tertiary, #ff9800)}.p3xr-tree-ttl-red .p3xr-tree-ttl-icon{color:var(--mat-sys-error, #f44336)}.p3xr-tree-ttl-pulse{animation:p3xr-ttl-pulse 1s infinite}@keyframes p3xr-ttl-pulse{0%,to{opacity:.7}50%{opacity:1}}.p3xr-database-tree-actions{display:inline-flex;align-items:center;position:relative;top:-1px;visibility:hidden}.p3xr-database-tree-row:hover .p3xr-database-tree-actions{visibility:visible}@media(max-width:599px){.p3xr-database-tree-node{display:inline-block}p3xr-database-tree{height:auto;min-height:100px}.p3xr-database-tree-viewport{height:20vh;min-height:100px}}
`],encapsulation:2,changeDetection:0})}return n})();function si(n,p){if(n&1&&(o(0,"div"),T(1,"p3xr-database-treecontrol-controls",6)(2,"p3xr-database-tree",7)(3,"div",8),o(4,"div",9),T(5,"router-outlet"),l()()),n&2){let e=c(2);s(3),te("p3xr-resizer-active",e.resizeClicked)}}function li(n,p){n&1&&(o(0,"div",10),T(1,"p3xr-database-treecontrol-controls",11)(2,"p3xr-database-tree",12),o(3,"div",11),T(4,"router-outlet"),l()())}function ci(n,p){if(n&1&&(o(0,"div",3),H(1,si,6,2,"div",4)(2,li,5,0,"div",5),l()),n&2){let e=c();s(),_("ngIf",!e.isXs),s(),_("ngIf",e.isXs)}}var no=(()=>{class n{ngZone;breakpointObserver;i18n;cmd;nav;socket;cdr;state;settings;strings;isXs=!1;hasConnection=!1;hasConnections=!1;resizerActive=!1;resizeClicked=!1;resizerMouseoverOn=!1;resizeLeft=void 0;static PANEL_WIDTH_KEY="p3xr-database-panel-width";screenSizeIsSmall=!1;containerEl;headerEl;footerEl;consoleHeaderEl;resizerEl;resizeObserver;observedElement=null;resizeTimeoutId;unsubs=[];resizeMinWidth;constructor(e,t,i,r,a,u,y,b,x){this.ngZone=e,this.breakpointObserver=t,this.i18n=i,this.cmd=r,this.nav=a,this.socket=u,this.cdr=y,this.state=b,this.settings=x,this.strings=this.i18n.strings,this.resizeMinWidth=this.settings.resizeMinWidth,Z(()=>{this.state.consoleDrawerOpen(),setTimeout(()=>this.rawResize(),160)})}ngOnInit(){this.state.currentPage.set("database"),this.syncFromGlobal();let e=this.socket.connections$.subscribe(()=>this.syncFromGlobal()),t=this.socket.redisDisconnected$.subscribe(()=>{this.syncFromGlobal(),this.nav.navigateTo("settings")}),i=this.socket.configuration$.subscribe(()=>this.syncFromGlobal()),r=this.socket.stateChanged$.subscribe(()=>{this.syncFromGlobal(),setTimeout(()=>this.rawResize(),50)});this.unsubs.push(()=>{e.unsubscribe(),t.unsubscribe(),i.unsubscribe(),r.unsubscribe()});let a=this.breakpointObserver.observe("(max-width: 599px)").subscribe(u=>{let y=this.isXs;this.isXs=u.matches,!this.isXs&&y&&(clearTimeout(this.resizeTimeoutId),this.resizeTimeoutId=setTimeout(()=>this.rawResize(),4*this.settings.debounce)),this.screenSizeIsSmall=this.isXs,this.cdr.markForCheck()});this.unsubs.push(()=>a.unsubscribe()),this.ngZone.runOutsideAngular(()=>{setTimeout(()=>this.initDom(),0)})}ngOnDestroy(){this.unsubs.forEach(e=>e()),window.removeEventListener("resize",this.boundRawResize),document.removeEventListener("mousedown",this.boundOnDocumentMouseDown),this.destroyResizer(),this.resizeObserver?.disconnect()}goSettings(){this.nav.navigateTo("settings")}resize=je(()=>{this.resizeLeft=void 0,this.rawResize()},100);boundRawResize=()=>this.rawResize();boundOnDocumentMouseDown=e=>this.onDocumentMouseDown(e);initDom(){this.containerEl=document.getElementById("p3xr-database-content"),this.headerEl=document.getElementById("p3xr-layout-header-container"),this.footerEl=document.getElementById("p3xr-layout-footer-container"),this.consoleHeaderEl=document.querySelector("p3xr-database-header");let e=localStorage.getIt