UNPKG

p3x-redis-ui-material

Version:

💿 The p3x-redis-ui-material web interface that connects to the p3x-redis-ui-server via http and socket.io

33 lines (24 loc) • 190 kB
/*! @license p3x-redis-ui-material v2020.10.435 💿 The p3x-redis-ui-material web interface that connects to the p3x-redis-ui-server via http and socket.io https://corifeus.com/redis-ui-material Copyright (c) 2020 Patrik Laszlo / P3X / Corifeus and contributors. MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information about all licenses, please see main.ddfd5a6f92a2fd67f197.js.LICENSE.txt */ (()=>{var e={93099:(e,t,n)=>{p3xr.ng=angular.module("p3xr-redis-ui",["ngCookies","ngAnimate","ngAria","ngSanitize","ngMessages","ngMaterial","ui.router","treeControl","angular-json-tree","angular-inview"]),n(7083),p3xr.ng.config(["$qProvider","$locationProvider","$urlRouterProvider","$stateProvider","p3xrThemeProvider","$mdAriaProvider",(e,t,o,r,i,s)=>{s.disableWarnings(),e.errorOnUnhandledRejections(!1),t.html5Mode(!0),i.start();const a=n(35924);o.otherwise("/main"),a(r)}]),p3xr.ng.run(["$rootScope","p3xrSocket","p3xrTheme","$mdMedia","$state","$timeout","$cookies","p3xrRedisParser","$animate",(e,t,n,o,r,i,s,a,d)=>{let l,c,m;e.p3xr=p3xr,e.$mdMedia=o,e.isElectron=/electron/i.test(navigator.userAgent),e.hasConnected=()=>0!==Object.keys(p3xr.state.redisConnections).length,e.locationReload=()=>{location.href="/"},Object.defineProperty(e.p3xr.state,"search",{get:()=>(l=s.get("p3xr-state-search"),void 0===l&&(l=""),l),set:e=>{l=e,l=s.put("p3xr-state-search",e,{expires:p3xr.settings.cookieExpiry})}}),Object.defineProperty(e.p3xr.settings,"redisTreeDivider",{get:()=>(c=s.get(p3xr.settings.tree.cookieName),void 0===c&&(c=p3xr.settings.tree.defaultDivider),c),set:e=>{c=e,c=s.put(p3xr.settings.tree.cookieName,e,{expires:p3xr.settings.cookieExpiry})}}),Object.defineProperty(e.p3xr.settings,"jsonFormat",{get:()=>(m=s.get(p3xr.settings.jsonFormatSettings.cookieName),void 0===m&&(m=p3xr.settings.jsonFormatSettings.default),parseInt(m)),set:e=>{m=e,m=s.put(p3xr.settings.jsonFormatSettings.cookieName,e,{expires:p3xr.settings.cookieExpiry})}});const p=()=>{console.log("set animation",e.p3xr.settings.animation),d.enabled(e.p3xr.settings.animation),e.p3xr.settings.animation?$body.removeClass("p3xr-no-animation"):$body.addClass("p3xr-no-animation")};let u,g,x,h,f,y,b;Object.defineProperty(e.p3xr.settings,"animation",{get:()=>(u=s.get(p3xr.settings.animationSettings.cookieName),void 0===u&&(u=p3xr.settings.animationSettings.default),1===parseInt(u)),set:e=>{u=e,u=s.put(p3xr.settings.animationSettings.cookieName,e,{expires:p3xr.settings.cookieExpiry}),p()}}),p(),Object.defineProperty(e.p3xr.settings,"maxValueDisplay",{get:()=>(g=s.get(p3xr.settings.maxValueDisplaySetting.cookieName),void 0===g&&(g=p3xr.settings.maxValueDisplaySetting.default),parseInt(g)),set:e=>{g=parseInt(e),g=s.put(p3xr.settings.maxValueDisplaySetting.cookieName,e,{expires:p3xr.settings.cookieExpiry})}}),Object.defineProperty(e.p3xr.settings,"maxKeys",{get:()=>{x=s.get(p3xr.settings.maxKeysSettings.cookieName),void 0===x&&(x=p3xr.settings.maxKeysSettings.default);let e=parseInt(x);return(isNaN(e)||e<5||e>p3xr.settings.maxKeysSettings.max)&&(e=p3xr.settings.maxKeysSettings.default),e},set:e=>{x=parseInt(e),x=s.put(p3xr.settings.maxKeysSettings.cookieName,e,{expires:p3xr.settings.cookieExpiry})}}),Object.defineProperty(e.p3xr.settings.language,"current",{get:()=>(h=s.get(p3xr.settings.language.cookieName),void 0===h&&(h=p3xr.settings.language.defaultLanguage),h),set:t=>{void 0===t&&(t=p3xr.settings.language.defaultLanguage),h=t,e.p3xr.strings=p3xr.settings.language.translation[t],h=s.put(p3xr.settings.language.cookieName,t,{expires:p3xr.settings.cookieExpiry})}}),e.p3xr.settings.language.current=s.get(p3xr.settings.language.cookieName),Object.defineProperty(e.p3xr.settings,"keysSort",{get:()=>(f=s.get(p3xr.settings.keySortInfo.cookieName),void 0===f?f=p3xr.settings.keySortInfo.default:"true"===f?f=!0:"false"===f&&(f=!1),f),set:e=>{f=e,f=s.put(p3xr.settings.keySortInfo.cookieName,e,{expires:p3xr.settings.cookieExpiry})}}),Object.defineProperty(e.p3xr.settings,"searchClientSide",{get:()=>(y=s.get(p3xr.settings.searchInfoClientSide.cookieName),void 0===y?y=p3xr.settings.searchInfoClientSide.default:"true"===y?y=!0:"false"===y&&(y=!1),(p3xr.state.keysRaw.length>p3xr.settings.maxLightKeysCount||p3xr.state.dbsize>p3xr.settings.maxLightKeysCount)&&(y=!1),y),set:e=>{y=e,y=s.put(p3xr.settings.searchInfoClientSide.cookieName,e,{expires:p3xr.settings.cookieExpiry})}}),Object.defineProperty(e.p3xr.settings,"searchStartsWith",{get:()=>(b=s.get(p3xr.settings.searchInfoStartsWith.cookieName),void 0===b?b=p3xr.settings.searchInfoStartsWith.default:"true"===b?b=!0:"false"===b&&(b=!1),b),set:e=>{b=e,b=s.put(p3xr.settings.searchInfoStartsWith.cookieName,e,{expires:p3xr.settings.cookieExpiry})}});let v=[];Object.defineProperty(e,"expandedNodes",{get:()=>v,set:e=>{v=e}}),e.savedExpandedNodes=[];let $,k=1;Object.defineProperty(e.p3xr.state,"page",{get:()=>k,set:e=>{k=parseInt(e)}}),e.keysTreeRendered=[],Object.defineProperty(e,"keysTree",{get:()=>(!0!==e.p3xr.state.redisChanged&&JSON.stringify($)===JSON.stringify(p3xr.state.keys)||(e.p3xr.state.redisChanged=!1,e.keysTreeRendered=a.keysToTreeControl({keys:p3xr.state.keys}),$=p3xr.state.keys),e.keysTreeRendered)});let w,C=[];Object.defineProperty(e.p3xr.state,"keys",{get:()=>{if(C=e.p3xr.state.keysRaw.slice(),e.p3xr.settings.searchClientSide&&"string"==typeof e.p3xr.state.search&&e.p3xr.state.search.length>0&&(C=e.p3xr.settings.searchStartsWith?C.filter((t=>t.startsWith(e.p3xr.state.search))):C.filter((t=>t.includes(e.p3xr.state.search)))),C<=e.p3xr.settings.pageCount)return C;{const t=(e.p3xr.state.page-1)*e.p3xr.settings.pageCount;return C.slice(t,t+e.p3xr.settings.pageCount)}}}),Object.defineProperty(e.p3xr.state,"pages",{get:()=>Math.ceil(C.length/e.p3xr.settings.pageCount)}),Object.defineProperty(e.p3xr.settings,"pageCount",{get:()=>(w=s.get(p3xr.settings.paging.cookieName),w=void 0===w?p3xr.settings.paging.default:parseInt(w),w),set:e=>{w=e,w=s.put(p3xr.settings.paging.cookieName,e,{expires:p3xr.settings.cookieExpiry})}}),n.start(),console.info("P3X Redis UI ran")}]),angular.element(document).ready((()=>{const e=document.getElementById("p3xr-redis-ui-bootstrap");angular.bootstrap(e,["p3xr-redis-ui"])}))},78808:(e,t,n)=>{p3xr.ng.factory("p3xrDialogConnection",["p3xrCommon","$mdDialog","p3xrSocket",function(e,t,o){return new function(){this.show=async r=>{try{await t.show({controller:["$scope","$mdDialog",function(t,n){t.options=r,void 0!==r.model?(t.model=r.model,t.model.password=r.model.id):t.model={awsElastiCache:!1,azure:!1,name:void 0,host:void 0,port:void 0,password:void 0,id:void 0},t.model.hasOwnProperty("cluster")||(t.model.cluster=!1),t.model.hasOwnProperty("nodes")||(t.model.nodes=[]);for(let e of t.model.nodes)e.password=e.id;t.cancel=function(){n.cancel()};const i=()=>!t.p3xrConnectionForm.$invalid||(e.toast({message:p3xr.strings.form.error.invalid}),!1);t.addNode=e=>{const n={host:void 0,port:void 0,password:void 0,id:p3xr.nextId()};void 0===e?t.model.nodes.push(n):t.model.nodes.splice(e+1,0,n)},t.removeNode=async(n,o)=>{try{await e.confirm({event:n,message:p3xr.strings.confirm.deleteConnectionText}),t.model.nodes.splice(o,1),e.toast({message:p3xr.strings.status.nodeRemoved})}catch(t){if(void 0===t)return;e.generalHandleError(t)}},t.testConnection=async()=>{if(t.p3xrConnectionForm.$setSubmitted(),i())try{p3xr.ui.overlay.show({message:p3xr.strings.title.connectingRedis});await o.request({action:"redis-test-connection",payload:{model:t.model}});e.toast({message:p3xr.strings.status.redisConnected})}catch(t){e.generalHandleError(t)}finally{p3xr.ui.overlay.hide()}},t.submit=async()=>{if(i()){void 0===t.model.host&&(t.model.host="localhost"),void 0===t.model.port&&(t.model.port=6379),"new"===r.type&&(t.model.id=p3xr.nextId());for(let e of t.model.nodes)void 0===e.host&&(e.host="localhost"),void 0===e.id&&(e.id=p3xr.nextId());try{await o.request({action:"connection-save",payload:{model:angular.copy(t.model)}});e.toast({message:"new"===t.options.type?p3xr.strings.status.added:p3xr.strings.status.saved}),n.cancel()}catch(t){e.generalHandleError(t)}}}}],template:n(79862),parent:angular.element(document.body),targetEvent:r.$event,clickOutsideToClose:!0,fullscreen:!0})}catch(t){e.generalHandleError(t)}}}}])},37693:(e,t,n)=>{p3xr.ng.factory("p3xrDialogJsonEditor",["p3xrCommon","$mdDialog","$timeout",function(e,t,o){return new function(){this.show=e=>t.show({controller:["$scope","$mdDialog","p3xrCommon","$rootScope","p3xrTheme",function(t,n,r,i,s){let a,d;i.$broadcast("p3xr-main-resizer",{drag:!1});try{d=JSON.parse(e.value),t.isJson=!0}catch(e){d=void 0,t.isJson=!1}t.isJson&&o((()=>{let e;switch(p3xr.settings.language.current){case"zn":e="zh-CN";break;default:e="en"}const t=document.getElementById("p3xr-jsoneditor"),n={limitDragging:!1,modes:["tree","code","view","preview"],mode:"tree",language:e,ace,theme:s.isDark()?"ace/theme/twilight":"ace/theme/github",indentation:p3xr.settings.jsonFormat};JSON.stringify(d).length>10240&&r.toast({message:p3xr.strings.label.bigJson,hideDelay:1e4}),a=new JSONEditor(t,n,d)}));const l=e=>{if(27===(e.which||e.keyCode)){e.preventDefault(),e.stopPropagation();const t=$(".pico-close");t.length>0?t.click():n.cancel()}};document.documentElement.addEventListener("keydown",l,!0),t.$on("$destroy",(()=>{a&&a.destroy(),i.$broadcast("p3xr-main-resizer",{drag:!0}),document.documentElement.removeEventListener("keydown",l,!0)})),t.ok=function(){n.cancel()},t.save=function({format:e}){try{n.hide({obj:JSON.stringify(a.get(),null,e?p3xr.settings.jsonFormat:0)})}catch(e){r.generalHandleError(e)}}}],template:n(78133),parent:angular.element(document.body),targetEvent:e.$event,clickOutsideToClose:!1,fullscreen:!0,multiple:!0,escapeToClose:!1})}}])},67028:(e,t,n)=>{p3xr.ng.factory("p3xrDialogJsonView",["p3xrCommon","$mdDialog",function(e,t){return new function(){this.show=async o=>{try{await t.show({controller:["$scope","$mdDialog","$timeout",function(e,t,n){e.treeExpandAll=()=>{p3xr.ui.overlay.show({message:p3xr.strings.title.jsonRecursive}),n((()=>{e.howExpanded="recursive",n((()=>{p3xr.ui.overlay.hide()}))}))},e.treeCollapseAll=()=>{e.howExpanded=!0};try{e.howExpanded=!0,e.obj=JSON.parse(o.value),e.isJson=!0}catch(t){e.obj=void 0,e.isJson=!1}e.ok=function(){t.cancel()}}],template:n(53857),parent:angular.element(document.body),targetEvent:o.$event,clickOutsideToClose:!0,fullscreen:!0,multiple:!0})}catch(t){e.generalHandleError(t)}}}}])},30556:(e,t,n)=>{p3xr.ng.factory("p3xrDialogKeyNewOrSet",["p3xrCommon","$mdDialog","p3xrSocket","p3xrDialogJsonEditor","p3xrDialogJsonView",function(e,t,o,r,i){return new function(){this.show=s=>new Promise((async(a,d)=>{try{await t.show({controller:["$scope","$mdDialog",function(t,l){t.jsonViewer=e=>{i.show({event:e.$event,value:e.value})},t.copy=t=>{n.g.p3xr.clipboard({value:t.value}),e.toast(p3xr.strings.status.dataCopied)},t.types=["string","list","hash","set","zset"],t.validateJson=!1,t.model={type:"string",key:void 0!==s.node?s.node.key:"",value:void 0,score:void 0,hashKey:void 0,index:void 0},t.options=s,s.hasOwnProperty("model")&&Object.assign(t.model,s.model),t.cancel=function(){l.cancel(),d()};t.submit=async()=>{if(!t.p3xrKeyNewForm.$invalid||(e.toast({message:p3xr.strings.form.error.invalid}),0))try{const n=await o.request({action:"key-new-or-set",payload:{type:s.type,originalValue:s.hasOwnProperty("model")?s.model.value:void 0,originalHashKey:s.hasOwnProperty("model")?s.model.hashKey:void 0,model:angular.copy(t.model)}});window.gtag("config",p3xr.settings.googleAnalytics,{page_path:"/key-new-or-set"}),a(n),e.toast({message:p3xr.strings.status.set}),l.cancel()}catch(t){d(t),e.generalHandleError(t)}},t.jsonEditor=async n=>{try{const e=await r.show({event:n.$event,value:n.value});t.model.value=e.obj,t.$digest()}catch(t){e.generalHandleError(t)}},t.formatJson=()=>{try{t.model.value=JSON.stringify(JSON.parse(t.model.value),null,p3xr.settings.jsonFormat)}catch(t){e.toast({message:p3xr.strings.label.jsonViewNotParsable})}}}],template:n(45817),parent:angular.element(document.body),targetEvent:s.$event,clickOutsideToClose:!1,fullscreen:!0,multiple:!0})}catch(t){d(t),e.generalHandleError(t)}}))}}])},76310:(e,t,n)=>{p3xr.ng.factory("p3xrDialogTreecontrolSettings",["p3xrCommon","$mdDialog","$timeout",function(e,t,o){return new function(){this.show=async o=>{try{await t.show({controller:["$scope","$rootScope",function(n,r){console.log("$rootScope.p3xr.settings.maxValueDisplay",r.p3xr.settings.maxValueDisplay),n.model={treeSeparator:r.p3xr.settings.redisTreeDivider,pageCount:r.p3xr.settings.pageCount,keysSort:r.p3xr.settings.keysSort,searchClientSide:r.p3xr.settings.searchClientSide,searchStartsWith:r.p3xr.settings.searchStartsWith,maxValueDisplay:r.p3xr.settings.maxValueDisplay,maxKeys:r.p3xr.settings.maxKeys,jsonFormat:2===r.p3xr.settings.jsonFormat,animation:r.p3xr.settings.animation},n.cancel=function(){t.cancel()};n.submit=async()=>{if(!n.p3xrDialogTreecontrolSettingsForm.$invalid||(e.toast({message:p3xr.strings.form.error.invalid}),0))try{r.p3xr.settings.redisTreeDivider=n.model.treeSeparator,r.p3xr.settings.pageCount=n.model.pageCount,r.p3xr.settings.keysSort=n.model.keysSort,r.p3xr.settings.searchClientSide=n.model.searchClientSide,r.p3xr.settings.searchStartsWith=n.model.searchStartsWith,r.p3xr.state.page=1,r.p3xr.state.redisChanged=!0,r.p3xr.settings.maxValueDisplay=n.model.maxValueDisplay,r.p3xr.settings.maxKeys=n.model.maxKeys,r.p3xr.settings.jsonFormat=!0===n.model.jsonFormat?2:4,r.p3xr.settings.animation=!0===n.model.animation?1:0,void 0!==o.p3xrMainRef&&o.p3xrMainRef.refresh(),t.cancel(),r.$broadcast("p3x-refresh")}catch(t){e.generalHandleError(t)}}}],template:n(20526),parent:angular.element(document.body),targetEvent:o.$event,clickOutsideToClose:!0,fullscreen:!0})}catch(t){e.generalHandleError(t)}}}}])},55583:(e,t,n)=>{p3xr.ng.factory("p3xrDialogTtl",["p3xrCommon","$mdDialog",function(e,t){const o=n(19567);return new function(){this.show=async r=>{try{return await t.show({controller:["$scope","$mdDialog",function(t,i){t.cancel=function(){i.cancel()},t.model=r.model;const s=n(42014);"number"==typeof t.model.ttl&&t.model.ttl>0?t.convertTextToTime=s(1e3*t.model.ttl,{delimiter:" "}):t.convertTextToTime="",t.openTimestringNpm=()=>{window.open("https://www.npmjs.com/package/timestring#keywords","_blank")};let a=!0;t.$watch("convertTextToTime",((e,n)=>{if(a)a=!a;else try{t.model.ttl=o(String(e),"s")}catch(e){console.warn("timestring parse error",e)}}));t.submit=async()=>{if(!t.p3xrTtlForm.$invalid||(e.toast({message:p3xr.strings.form.error.invalid}),0))try{isNaN(t.model.ttl)&&(t.model.ttl=Math.round(t.model.ttl));const e={model:t.model};i.hide(e)}catch(t){e.generalHandleError(t)}}}],template:n(85006),parent:angular.element(document.body),targetEvent:r.$event,clickOutsideToClose:!0,fullscreen:!0})}catch(t){e.generalHandleError(t)}}}}])},10305:()=>{p3xr.ng.directive("p3xValidateJson",(function(){return{restrict:"A",require:"ngModel",scope:{p3xValidateJsonRequired:"<"},link:function(e,t,n,o){let r,i=e.p3xValidateJsonRequired||!1;e.$watch("p3xValidateJsonRequired",((e,t)=>{if(i=e,i)try{JSON.parse(r),o.$setValidity("p3xValidateJson",!0)}catch(e){o.$setValidity("p3xValidateJson",!1)}else o.$setValidity("p3xValidateJson",!0)})),o.$validators.p3xIsJson=(e,t)=>{if(r=e,!i)return o.$setValidity("p3xValidateJson",!0),!0;try{return JSON.parse(e),o.$setValidity("p3xValidateJson",!0),!0}catch(e){return o.$setValidity("p3xValidateJson",!1),!1}}}}}))},17229:()=>{p3xr.ng.directive("ngEnter",(function(){return function(e,t,n){t.bind("keydown keypress",(function(t){13===t.which&&(e.$apply((function(){e.$eval(n.ngEnter)})),t.preventDefault())}))}}))},12942:(e,t,n)=>{p3xr.ng.factory("p3xrCommon",["$mdToast","$mdDialog","$mdColors","$rootScope","p3xrRedisParser","$timeout",function(e,t,o,r,i,s){n(76897);const a=e=>{let n,o,r;return e.hasOwnProperty("disableCancel")?(n=t.alert(),o=p3xr.strings.confirm.info,r=p3xr.strings.intention.ok):(n=t.confirm(),o=p3xr.strings.confirm.title,r=p3xr.strings.intention.sure),n.title(o).htmlContent(e.message).targetEvent(e.event).ok(r).multiple(!0),e.hasOwnProperty("disableCancel")||n.cancel(p3xr.strings.intention.cancel),t.show(n)},d={generalHandleError:e=>{if(void 0!==e){if(e instanceof Error||e instanceof Object||(e=new Error(e)),e instanceof Error||"error"===e.status){let t;return t=e instanceof Error?e:e.error,console.warn("generalHandleError"),console.error(t),"string"==typeof t&&p3xr.strings.code.hasOwnProperty(t)?t=new Error(p3xr.strings.code[t]):t.hasOwnProperty("code")&&p3xr.strings.code.hasOwnProperty(t.code)?t.message=p3xr.strings.code[t.code]:p3xr.strings.code.hasOwnProperty(t.message)&&(t.message=p3xr.strings.code[t.message]),d.alert({title:p3xr.strings.title.error,message:"<pre>"+(t.hasOwnProperty("message")?t.message:t)+"</pre>"}),!1}return!0}},toast:t=>{"string"==typeof t&&(t={message:t});const n='<md-toast class="md-toast p3xr-toast-default" ng-click="closeToast()">'+t.message+"</md-toast>";e.show({controller:"p3xrToastController",template:n,hideDelay:t.hideDelay||p3xr.settings.toast.timeout,position:p3xr.settings.toast.position})},alert:e=>("string"==typeof e&&(e={message:e}),e.disableCancel=!0,a(e)),confirm:a,loadRedisInfoResponse:e=>{const{response:t}=e;console.time("loadRedisInfoResponse"),r.p3xr.state.info=i.info(t.info),r.p3xr.state.keysRaw=t.keys,r.p3xr.settings.keysSort&&r.p3xr.state.keysRaw.length<=p3xr.settings.maxLightKeysCount?r.p3xr.state.keysRaw=t.keys.sort(p3xr.sort.naturalCompareDocument()):r.p3xr.state.keysRaw=t.keys,r.p3xr.state.keysInfo=t.keysInfo,s((()=>{r.p3xr.state.reducedFunctions=r.p3xr.state.keysRaw.length>p3xr.settings.maxLightKeysCount,r.$digest(),console.timeEnd("loadRedisInfoResponse")}))},setTableZebraStyles:e=>{const{$odd:t}=e;if(!t)return"";let n="";return n+=`background-color: ${o.getThemeColor(p3xr.state.themeLayout+"-background-500-0.1")};`,n}};return d}]).controller("p3xrToastController",["$scope","$mdToast",function(e,t){e.closeToast=function(){t.hide()}}])},11931:()=>{p3xr.ng.factory("p3xrRedisParser",["$rootScope",function(e){return new function(){const t=this;this.array=e=>{const{line:t}=e;let{divider:n,fieldDivider:o}=e;void 0===n&&(n=","),void 0===o&&(o="=");const r=t.split(n),i={};for(let e of r){const t=e.split(o);i[t[0]]=t[1].trim()}return i},this.info=e=>{const n=e.split("\n"),o={};let r,i;for(let e of n)if(e.startsWith("#"))void 0!==r&&(o[r]=i),r=e.substring(1).toLowerCase().trim(),i={};else if(e.length>2){const n=e.split(":");i[n[0]]=n[1].includes(",")?t.array({line:n[1].trim()}):n[1].trim()}return void 0!==r&&(o[r]=i),o.hasOwnProperty("keyspace")&&(o.keyspaceDatabases={},Object.keys(o.keyspace).forEach((e=>{e=parseInt(e.substring(2)),o.keyspaceDatabases[e]=!0}))),o},this.keysToTreeControl=t=>{let{keys:n}=t,{divider:o}=t;void 0===o&&(o=p3xr.settings.redisTreeDivider);const r=[],i=[];e.expandedNodes=[];const s=(t,n=0,a=r)=>{let d=!1;if(n+1<t.length)for(let e in a){const o=a[e];o.label===t[n]&&"folder"===o.type&&(d=o)}if(!1===d){const r={label:t[n],key:t.slice(0,n+1).join(o),children:[],childCount:0};d=n+1===t.length?Object.assign(r,{type:"element",keysInfo:p3xr.state.keysInfo[r.key]}):Object.assign(r,{type:"folder"}),a.push(d);for(let t of e.savedExpandedNodes)t.key===d.key&&i.push(d)}n+1<t.length&&s(t,n+1,d.children)};e.expandedNodes=i;for(let e of n){let t;t=""===o?[e]:e.split(o),s(t)}const a={},d=e=>{a[e.key]=e.children.length;for(let t of e.children)d(t)};for(let e of r)d(e);const l=e=>{for(let t of Object.keys(a))(t.startsWith(e.key+":")||t===e.key)&&(e.childCount+=a[t]);for(let t of e.children)l(t)};for(let e of r)l(e);return e.savedExpandedNodes=[],r},this.console=new function(){this.parse=e=>{if("object"==typeof e){let t="";return Object.keys(e).forEach((n=>{""!==t&&(t+="\n"),t+=e[n]})),t}return e}}}}])},30876:(e,t,n)=>{p3xr.ng.factory("p3xrSocket",["$rootScope","p3xrCommon","$state",function(e,t,o){const r=io.connect(p3xr.api.host,{rejectUnauthorized:!1,path:"/socket.io",secure:!0});let i=!1;r.on("connect",(async function(){i?console.log("p3xr-socket (socket) RE-connected",r.id):console.log("p3xr-socket (socket) connected",r.id),i=!0})),r.on("disconnect",(function(){location.reload()}));let s=void 0;r.on("info-interval",(t=>{e.p3xr.state.donated=t.donated,t.donated!==s&&(n.g.p3xr.isBot()||window.gtag("config",p3xr.settings.googleAnalytics,{page_path:p3xr.state.donated?"/donated":"/free"}),s=t.donated,e.$digest())}));let a=!1;const d=async function(e){if(!a){a=!0;try{t.generalHandleError(e),o.go("socketio-error",{error:e}),await t.confirm({disableCancel:!1,message:p3xr.strings.confirm.socketioConnectError}),location.reload()}catch(e){t.generalHandleError(e)}}};r.on("error",d),r.on("connect_error",d),r.on("connections",(n=>{t.generalHandleError(n)?(p3xr.state.connections=n.connections,e.$digest()):p3xr.connectionsReset()})),r.on("redis-disconnected",(async n=>{if(void 0!==e.p3xr.state.connection&&e.p3xr.state.connection.id===n.connectionId){e.p3xr.state.connection=void 0,"error"===n.status?t.toast({message:p3xr.strings.status.redisDisconnected(n)}):"code"===n.status&&(p3xr.strings.code.hasOwnProperty(n.code)?t.toast({message:p3xr.strings.code[n.code]}):t.toast({message:"unknown redis disconnect code: "+n.code})),o.go("main");try{await c({action:"trigger-redis-disconnect",enableResponse:!1})}catch(e){t.generalHandleError(e)}}})),r.on("redis-status",(t=>{e.p3xr.state.redisConnections=t.redisConnections}));let l=!1;r.on("configuration",(t=>{e.p3xr.state.cfg=t,!0===p3xr.state.cfg.snapshot?p3xr.state.version="SNAPSHOT":(p3xr.state.version="v"+p3xr.pkg.version,l||(l=!0,window.gtag("config",p3xr.settings.googleAnalytics,{page_path:"/version/"+p3xr.state.version}))),e.$digest()})),r.on("error",t.generalHandleError);const c=t=>{t.payload||(t.payload={}),"string"==typeof e.p3xr.state.search&&e.p3xr.state.search.length>0&&(e.p3xr.settings.searchStartsWith?t.payload.match=e.p3xr.state.search+"*":t.payload.match="*"+e.p3xr.state.search+"*"),t.payload.maxKeys=parseInt(p3xr.settings.maxKeys);let{enableResponse:n}=t;if(!1!==n&&(n=!0),n)return new Promise(((n,o)=>{t.requestId=p3xr.nextId();const i="p3xr-response-"+t.requestId;let s;const a=t=>{if(clearTimeout(s),r.off(i),"ok"===t.status)n(t);else{const e=new Error(t.error);o(e)}e.$digest()};s=setTimeout((()=>{r.off(i,a),o(new Error(p3xr.strings.label.socketIoTimeout({timeout:p3xr.settings.socket.timeout}))),e.$digest()}),p3xr.settings.socket.timeout),r.on(i,a),r.emit("p3xr-request",t)}));r.emit("p3xr-request",t)};return{ioClient:r,request:c}}])},7083:(e,t,n)=>{n(78808),n(37693),n(67028),n(30556),n(76310),n(55583),n(10305),n(17229),n(12942),n(11931),n(30876),n(45092),n(3604),n(15879),n(13032),n(86129),n(53631),n(83613),n(16117),n(8012),n(65836),n(81378),n(57630),n(43886),n(55060),n(32036),n(64250),n(65943),n(61380),n(47871),n(53975),n(7698),n(66342),n(10822),n(16961),n(33269),n(87327)},45092:(e,t,n)=>{p3xr.ng.component("p3xrLayout",{template:n(134),controller:["p3xrTheme","$rootScope","p3xrSocket","p3xrCommon","$state","$cookies","$timeout","$scope",function(e,t,o,r,i,s,a,d){let l;this.getThemeKey=e=>{if(void 0===l){const t=Object.keys(e);l=t.sort(((t,n)=>e[t].order-e[n].order))}return l},this.getVersionColor=()=>"p3xrThemeMatrix"===e.getCurrentThemeName()?"grey-900":"background-A100",this.setTheme=t=>{e.setTheme(e.generateThemeName(t))},this.openLink={github:()=>{window.open("https://github.com/patrikx3/redis-ui","github-patrikx3-"+p3xr.pkg.corifeus.reponame)},githubTodo:()=>{window.open("https://github.com/patrikx3/redis-ui/blob/master/todo.md#to-do",`github-patrikx3-${p3xr.pkg.corifeus.reponame}-todo`)},githubChangelog:()=>{window.open("https://github.com/patrikx3/redis-ui/blob/master/changelog.md#change-log",`github-patrikx3-${p3xr.pkg.corifeus.reponame}-changelog`)},donate:()=>{window.open("https://www.paypal.me/patrikx3","p3x-redis-ui-donate")}};const c=n(77310);let m;Object.defineProperty(this,"themeSelectedKey",{get:()=>{let e=p3xr.state.theme;return e=e.slice("p3xrTheme".length),e=c(e),e}});const p=()=>{m.css("left",document.documentElement.clientWidth/2-m.outerWidth()/2+"px")};this.reducedFunctionalty=()=>{r.confirm({disableCancel:!0,message:p3xr.strings.label.tooManyKeys({count:t.p3xr.state.keysRaw.length,maxLightKeysCount:p3xr.settings.maxLightKeysCount})})},this.$onInit=()=>{m=$("#p3xr-layout-reduced"),p(),$window.on("resize",p);const e=s.getObject(p3xr.settings.connectInfo.cookieName);void 0!==e&&this.connect(e),a((()=>{n.g.p3xrSetLanguage=e=>{t.$apply((()=>{t.isElectron=!0,this.setLanguage(e)}))},n.g.p3xrSetMenu=e=>{t.$apply((()=>{t.isElectron=!0,i.go(e)}))}}),3e3)},this.$onDestroy=function(){$window.off("resize",p)},n.g.p3xr.isBot()||t.$on("$locationChangeSuccess",(async function(e,t,n){const o=new URL(t);o.pathname.toLowerCase().startsWith("/main/key/")?window.gtag("config",p3xr.settings.googleAnalytics,{page_path:"/main/key"}):(console.log("$locationChangeSuccess gtag",o.pathname),window.gtag("config",p3xr.settings.googleAnalytics,{page_path:o.pathname}))})),this.connect=async e=>{console.time("connect"),e=angular.copy(e);try{const n=location.pathname.split("/");n.shift();let a=n.join(".");""===a&&(a="main"),p3xr.ui.overlay.show({message:p3xr.strings.title.connectingRedis});const d=s.get(p3xr.settings.connection.getCookieNameCurrentDatabase(e.id)),l=await o.request({action:"connection-connect",payload:{connection:e,db:d}});t.p3xr.state.page=1,p3xr.state.dbsize=l.dbsize;let c=0;const m=[];for(;c<l.databases;)m.push(c++);p3xr.state.commands=[],Object.keys(l.commands).forEach((e=>{p3xr.state.commands.push(l.commands[e][0])})),p3xr.state.commands.sort(),t.p3xr.state.databaseIndexes=m,t.p3xr.state.connection=e,r.loadRedisInfoResponse({response:l}),s.putObject(p3xr.settings.connectInfo.cookieName,e,{expires:p3xr.settings.cookieExpiry}),i.reload(),a.startsWith("main")?"main"===a&&i.go("main.statistics"):i.go(a)}catch(e){s.remove(p3xr.settings.connectInfo.cookieName),t.p3xr.state.connection=void 0,r.generalHandleError(e)}finally{p3xr.ui.overlay.hide()}console.timeEnd("connect")},this.disconnect=async()=>{try{s.remove(p3xr.settings.connectInfo.cookieName),await o.request({action:"connection-disconnect",payload:{connectionId:p3xr.state.connection.id}}),t.p3xr.state.connection=void 0}catch(e){r.generalHandleError(e)}finally{i.go("main")}},Object.defineProperty(this,"connectionName",{get:()=>void 0!==t.p3xr.state.connection?t.p3xr.strings.label.connected({name:t.p3xr.state.connection.name}):t.p3xr.strings.intention.connect}),this.isMain=()=>i.current.name.startsWith("main"),this.isElectronInitialized=!1,this.setLanguage=async e=>{try{t.p3xr.settings.language.current=e,t.isElectron&&(await o.request({action:"set-language",payload:{key:e}}),this.isElectronInitialized=!0,d.$digest())}catch(e){r.generalHandleError(e)}}}]})},3604:(e,t,n)=>{p3xr.ng.component("p3xrMainKeyHash",{template:n(80176),bindings:{p3xrValue:"=",p3xrKey:"<",p3xrResponse:"<"},controller:["p3xrCommon","p3xrSocket","p3xrDialogJsonView","p3xrDialogKeyNewOrSet","$rootScope",function(e,t,o,r,i){this.copy=t=>{n.g.p3xr.clipboard({value:t.value}),e.toast(p3xr.strings.status.dataCopied)},this.addHash=async t=>{try{await r.show({type:"append",$event:t.$event,model:{type:"hash",key:this.p3xrKey}}),i.$broadcast("p3x-refresh-key")}catch(t){e.generalHandleError(t)}},this.deleteHashKey=async n=>{try{await e.confirm({event:n.$event,message:p3xr.strings.confirm.deleteHashKey}),await t.request({action:"key-hash-delete-field",payload:{key:this.p3xrKey,hashKey:n.hashKey}}),i.$broadcast("p3x-refresh-key")}catch(t){e.generalHandleError(t)}},this.editValue=async t=>{try{const{hashKey:e,value:n}=t;await r.show({type:"edit",$event:t.$event,model:{type:"hash",value:n,hashKey:e,key:this.p3xrKey}}),i.$broadcast("p3x-refresh-key")}catch(t){e.generalHandleError(t)}},this.showJson=e=>{const{value:t}=e;o.show({value:t})},this.setTableStyles=t=>e.setTableZebraStyles(t)}]})},15879:(e,t,n)=>{p3xr.ng.component("p3xrMainKeyList",{template:n(52585),bindings:{p3xrValue:"=",p3xrKey:"<",p3xrResponse:"<"},controller:["$mdColors","p3xrCommon","p3xrSocket","$rootScope","p3xrDialogJsonView","p3xrDialogKeyNewOrSet",function(e,t,o,r,i,s){this.copy=e=>{n.g.p3xr.clipboard({value:e.value}),t.toast(p3xr.strings.status.dataCopied)},this.appendValue=async e=>{try{const{index:t,value:n}=e;await s.show({type:"append",$event:e.$event,model:{type:"list",key:this.p3xrKey}}),r.$broadcast("p3x-refresh-key")}catch(e){t.generalHandleError(e)}},this.editValue=async e=>{try{const{index:t,value:n}=e;await s.show({type:"edit",$event:e.$event,model:{type:"list",value:n,index:e.index,key:this.p3xrKey}}),r.$broadcast("p3x-refresh-key")}catch(e){t.generalHandleError(e)}},this.deleteListElement=async e=>{try{await t.confirm({event:e.$event,message:p3xr.strings.confirm.deleteListItem});await o.request({action:"key-list-delete-index",payload:{key:this.p3xrKey,index:e.index}});r.$broadcast("p3x-refresh-key")}catch(e){t.generalHandleError(e)}},this.showJson=e=>{const{value:t}=e;i.show({value:t})},this.setTableStyles=e=>t.setTableZebraStyles(e)}]})},13032:(e,t,n)=>{p3xr.ng.component("p3xrMainKeySet",{template:n(37129),bindings:{p3xrValue:"=",p3xrKey:"<",p3xrResponse:"<"},controller:["p3xrCommon","p3xrSocket","p3xrDialogJsonView","p3xrDialogKeyNewOrSet","$rootScope",function(e,t,o,r,i){this.copy=t=>{n.g.p3xr.clipboard({value:t.value}),e.toast(p3xr.strings.status.dataCopied)},this.addSet=async t=>{try{await r.show({type:"append",$event:t.$event,model:{type:"set",key:this.p3xrKey}}),i.$broadcast("p3x-refresh-key")}catch(t){e.generalHandleError(t)}},this.deleteSetMember=async n=>{try{await e.confirm({event:n.$event,message:p3xr.strings.confirm.deleteSetMember}),await t.request({action:"key-set-delete-member",payload:{key:this.p3xrKey,value:n.value}}),i.$broadcast("p3x-refresh-key")}catch(t){e.generalHandleError(t)}},this.editValue=async t=>{try{const{value:e}=t;await r.show({type:"edit",$event:t.$event,model:{type:"set",value:e,key:this.p3xrKey}}),i.$broadcast("p3x-refresh-key")}catch(t){e.generalHandleError(t)}},this.showJson=e=>{const{value:t}=e;o.show({value:t})},this.setTableStyles=t=>e.setTableZebraStyles(t)}]})},86129:(e,t,n)=>{p3xr.ng.component("p3xrMainKeyString",{template:n(99263),bindings:{p3xrValue:"=",p3xrKey:"<",p3xrResponse:"<"},controller:["p3xrSocket","p3xrCommon","$rootScope","p3xrDialogJsonView","p3xrDialogJsonEditor",function(e,t,o,r,i){let s;this.copy=()=>{n.g.p3xr.clipboard({value:this.p3xrValue}),t.toast(p3xr.strings.status.dataCopied)},this.editable=!1,this.edit=()=>{s=angular.copy(this.p3xrValue),this.editable=!0},this.cancelEdit=()=>{this.p3xrValue=s,this.editable=!1},this.validateJson=!1,this.save=async()=>{try{if(!0===this.validateJson)try{JSON.parse(this.p3xrValue)}catch(e){return void t.toast({message:p3xr.strings.label.jsonViewNotParsable})}await e.request({action:"key-set",payload:{type:this.p3xrResponse.type,value:this.p3xrValue,key:this.p3xrKey}});window.gtag("config",p3xr.settings.googleAnalytics,{page_path:"/key-set"}),this.editable=!1,o.$broadcast("p3x-refresh-key")}catch(e){t.generalHandleError(e)}},this.jsonViewer=e=>{r.show({event:e.$event,value:this.p3xrValue})},this.jsonEditor=async e=>{try{const t=await i.show({event:e.$event,value:this.p3xrValue});this.p3xrValue=t.obj,await this.save()}catch(e){t.generalHandleError(e)}},this.formatJson=async()=>{try{this.p3xrValue=JSON.stringify(JSON.parse(this.p3xrValue),null,p3xr.settings.jsonFormat),await this.save()}catch(e){t.toast({message:p3xr.strings.label.jsonViewNotParsable})}}}]})},53631:(e,t,n)=>{p3xr.ng.component("p3xrMainKeyZset",{template:n(508),bindings:{p3xrValue:"=",p3xrKey:"<",p3xrResponse:"<"},controller:["$scope","p3xrCommon","p3xrSocket","p3xrDialogJsonView","p3xrDialogKeyNewOrSet","$rootScope",function(e,t,o,r,i,s){this.copy=e=>{n.g.p3xr.clipboard({value:e.value}),t.toast(p3xr.strings.status.dataCopied)};let a;e.$watch("$ctrl.p3xrValue",((e,t)=>{e!==a&&(a=e,this.generatedValue=(e=>{const t=[];let n=void 0;for(let o of e)void 0===n?n=o:(t.push([parseFloat(o),n]),n=void 0);return t})(this.p3xrValue))})),this.showJson=e=>{const{value:t}=e;r.show({value:t})},this.setTableStyles=e=>t.setTableZebraStyles(e),this.addZSet=async e=>{try{await i.show({type:"append",$event:e.$event,model:{type:"zset",key:this.p3xrKey}}),s.$broadcast("p3x-refresh-key")}catch(e){t.generalHandleError(e)}},this.deleteZSet=async e=>{try{await t.confirm({event:e.$event,message:p3xr.strings.confirm.deleteZSetMember}),await o.request({action:"key-zset-delete-member",payload:{key:this.p3xrKey,value:e.member}}),s.$broadcast("p3x-refresh-key")}catch(e){t.generalHandleError(e)}},this.editValue=async e=>{try{const{member:t}=e;await i.show({type:"edit",$event:e.$event,model:{type:"zset",score:e.score,value:t,key:this.p3xrKey}}),s.$broadcast("p3x-refresh-key")}catch(e){t.generalHandleError(e)}}}]})},83613:(e,t,n)=>{p3xr.ng.component("p3xrMainKey",{template:n(69868),bindings:{p3xrResize:"&"},controller:["p3xrCommon","p3xrRedisParser","p3xrSocket","$rootScope","$stateParams","$timeout","$scope","$mdDialog","$state","$interval","p3xrDialogTtl",function(e,t,o,r,i,s,a,d,l,c,m){this.$stateParams=i;let p=!1;const u=()=>!(this.response.ttl<-1||p&&this.response.ttl<1)||(e.toast({message:p3xr.strings.status.keyIsNotExisting}),c.cancel(g),p3xr.state.redisChanged=!0,l.go("main.statistics"),!1);let g;const x=n(42014),h=()=>{if(this.response.ttl>-1){const e=()=>{if(u()){let e;switch(p3xr.settings.language.current){case"zn":e="zh_CN";break;default:e="en"}this.ttlParsed=" "+x(1e3*this.response.ttl,{language:e,delimiter:" "})}else c.cancel(g)};e(),r.p3xr.state.reducedFunctions||(g=c((()=>{this.response.ttl=this.response.ttl-1,e()}),1e3))}},f=async(t={})=>{c.cancel(g);let{withoutParent:n}=t;void 0===n&&(n=!1);let r=void 0;try{p3xr.ui.overlay.show({message:p3xr.strings.intention.getKey});const e=await o.request({action:"key-get",payload:{key:i.key}});this.response=e;const t=e.type;if(-2===e.ttl)return void u();switch(t){case"string":e.length=e.value.length}e.ttl>-1&&(p=!0),h()}catch(t){r=t,console.error(t),e.alert(p3xr.strings.label.unableToLoadKey({key:i.key}))}finally{p3xr.ui.overlay.hide(),void 0!==r?l.go("main.statistics"):n||null===i.resize||i.resize()}};this.$onInit=()=>f(),this.$onDestroy=function(){c.cancel(g)},this.charactersPrettyBytes=e=>{if(e<1024||void 0===e)return"";return"("+n(27036)(e)+")"},this.refresh=e=>{window.gtag("config",p3xr.settings.googleAnalytics,{page_path:"/refresh"}),f(e)},this.rename=async e=>{r.$broadcast("p3xr-key-rename",{key:i.key,$event:e.$event})},this.delete=async()=>{r.$broadcast("p3xr-key-delete",{key:i.key})},this.setTtl=async t=>{try{const t=await m.show({model:{ttl:-1===this.response.ttl?"":this.response.ttl}});if(void 0===t)return;if(null==t.model.ttl||""===String(t.model.ttl).trim()){await o.request({action:"persist",payload:{key:i.key}});window.gtag("config",p3xr.settings.googleAnalytics,{page_path:"/persist"}),await this.refresh(),e.toast({message:p3xr.strings.status.persisted})}else if(String(t.model.ttl).match(/^-{0,1}\d+$/)){await o.request({action:"expire",payload:{key:i.key,ttl:parseInt(t.model.ttl)}});window.gtag("config",p3xr.settings.googleAnalytics,{page_path:"/expire"}),await this.refresh(),e.toast({message:p3xr.strings.status.ttlChanged})}else e.toast({message:p3xr.strings.status.notInteger})}catch(t){e.generalHandleError(t)}},a.$on("p3x-refresh",(()=>{this.refresh({withoutParent:!0})})),a.$on("p3x-refresh-key",(()=>{this.refresh({withoutParent:!0})}))}]})},16117:(e,t,n)=>{p3xr.ng.component("p3xrMainStatistics",{template:n(54498),controller:["p3xrCommon","p3xrRedisParser","p3xrSocket","$rootScope","$scope","$timeout","$stateParams",function(e,t,n,o,r,i,s){const a=["in","run","per"],d=["sha1"],l={perc:"percent",sec:"seconds"},c=$("#p3xr-main-content-container"),m=()=>{this.maxHeight=c[0].offsetHeight-50};$window.on("resize",m),this.$doCheck=m,this.$onInit=()=>{p3xr.state.redisChanged&&(p3xr.state.redisChanged=!1,o.$broadcast("p3x-refresh"))},this.$onDestroy=()=>{$window.off("resize",m)},this.hasDatabases=Object.keys(o.p3xr.state.info.keyspaceDatabases).length>0,this.generateKey=e=>{if(p3xr.strings.title.hasOwnProperty(e))return p3xr.strings.title[e];return e.split("_").map(((e,t)=>(l.hasOwnProperty(e)&&(e=l[e]),d.includes(e)||e.length<4&&!a.includes(e)?e.toUpperCase():0===t?e[0].toUpperCase()+e.substring(1):e))).join(" ")}}]})},8012:(e,t,n)=>{p3xr.ng.component("p3xrMainTreecontrolControls",{template:n(23646),bindings:{p3xrMainRef:"<"},controller:["$cookies","$rootScope","p3xrCommon","$timeout","p3xrDialogTreecontrolSettings","$scope",function(e,t,n,o,r,i){this.treeExpandAll=()=>{try{p3xr.ui.overlay.show({message:p3xr.strings.status.treeExpandAll});let e=[];const n=(t,o=0)=>{if(delete t.$inview,"folder"===t.type){e.push(t);for(let e of t.children)n(e,o++)}};for(let e of t.keysTreeRendered)n(e);t.expandedNodes=e}catch(e){n.generalHandleError(e)}finally{p3xr.ui.overlay.hide()}},this.treeCollapseAll=()=>{t.expandedNodes=[],t.$broadcast("p3xr-main-treecontrol-control-noop")},i.$on("p3xr-main-treecontrol-control-noop",(()=>{o((()=>{$("#p3xr-main-treecontrol-controls-click-noop").click()}))})),this.noop=()=>{},this.page=e=>{const{page:n}=e;switch(n){case"prev":t.p3xr.state.page-1>=1&&(t.p3xr.state.page=t.p3xr.state.page-1);break;case"next":t.p3xr.state.page+1<=t.p3xr.state.pages&&(t.p3xr.state.page=t.p3xr.state.page+1);break;case"last":t.p3xr.state.page=t.p3xr.state.pages;break;case"first":t.p3xr.state.page=1}o((()=>{t.$digest()}))},this.pageChange=()=>{t.p3xr.state.page<1?t.p3xr.state.page=1:t.p3xr.state.page>t.p3xr.state.pages&&(t.p3xr.state.page=t.p3xr.state.pages)},this.openTreeSettingDialog=e=>{e.p3xrMainRef=this.p3xrMainRef,r.show(e)},this.search="",this.$onInit=()=>{this.search=t.p3xr.state.search},this.onSearchChange=()=>{t.p3xr.settings.searchClientSide?t.p3xr.state.redisChanged=!0:this.p3xrMainRef.refresh(),t.p3xr.state.page=1},this.treeDividerChange=()=>{t.p3xr.state.redisChanged=!0,t.$broadcast("p3x-refresh")}}]})},65836:(e,t,n)=>{p3xr.ng.component("p3xrMainTree",{template:n(5484),bindings:{p3xrResize:"&",p3xrMainRef:"<"},controller:["p3xrCommon","p3xrRedisParser","p3xrSocket","$rootScope","$timeout","$state","$scope","$mdDialog","p3xrDialogKeyNewOrSet","p3xrTheme","$stateParams",function(e,t,o,r,i,s,a,d,l,c,m){let p=0;this.$doCheck=()=>{p<10&&(p++,this.p3xrMainRef.resizeRaw())},this.displayNode=(e,t)=>{e.$inview=t},this.getTreeTheme=()=>c.isDark()?"tree-dark":"tree-classic",this.keysTreeOptions={nodeChildren:"children",dirSelectable:!1,multiSelection:!1},this.selectTreeNode=function(e,t,n,o,r,i,a,d,l,c){s.go("main.key",{key:e.key,resize:this.p3xrResize})},this.showToggle=function(e,t,o,i,s,a,d,l,c,m){t||n(52453).recursive({nodes:r.keysTreeRendered}),r.$broadcast("p3xr-main-treecontrol-control-noop")},this.delete=async t=>{try{await e.confirm({message:p3xr.strings.confirm.deleteKey});const n=angular.copy(r.expandedNodes),a=await o.request({action:"delete",payload:{key:t.key}});window.gtag("config",p3xr.settings.googleAnalytics,{page_path:"/delete"}),i((()=>{r.savedExpandedNodes=n,e.loadRedisInfoResponse({response:a})})),s.go("main.statistics"),e.toast({message:p3xr.strings.status.deletedKey({key:t.key})})}catch(t){e.generalHandleError(t)}},this.rename=async t=>{try{const n=d.prompt().title(p3xr.strings.confirm.rename.title).textContent(p3xr.strings.confirm.rename.textContent).placeholder(p3xr.strings.confirm.rename.placeholder).ariaLabel(p3xr.strings.confirm.rename.placeholder).initialValue(t.key).targetEvent(t.$event).required(!0).ok(p3xr.strings.intention.rename).cancel(p3xr.strings.intention.cancel),a=await d.show(n),l=angular.copy(r.expandedNodes),c=await o.request({action:"rename",payload:{key:t.key,keyNew:a}});window.gtag("config",p3xr.settings.googleAnalytics,{page_path:"/rename"}),i((()=>{r.savedExpandedNodes=l,e.loadRedisInfoResponse({response:c}),s.go("main.key",{key:a,resize:this.p3xrResize})})),e.toast({message:p3xr.strings.status.renamedKey})}catch(t){e.generalHandleError(t)}},this.deleteTree=async t=>{try{const{event:n,node:a}=t;n.stopPropagation();const d=angular.copy(r.expandedNodes);await e.confirm({event:n,message:p3xr.strings.confirm.deleteAllKeys({key:a.key})});const l=await o.request({action:"key-del-tree",payload:{key:a.key,redisTreeDivider:p3xr.settings.redisTreeDivider}});i((()=>{r.savedExpandedNodes=d,e.loadRedisInfoResponse({response:l}),void 0!==m.key&&m.key.startsWith(a.key+p3xr.settings.redisTreeDivider)&&s.go("main.statistics")})),e.toast({message:p3xr.strings.status.treeDeleted({key:a.key})})}catch(t){e.generalHandleError(t)}},this.extractNodeTooltip=e=>"folder"!==e.type&&void 0!==e.keysInfo?void 0===e.keysInfo?"":p3xr.ui.htmlEncode(p3xr.strings.redisTypes[e.keysInfo.type]+" - "+e.key):p3xr.ui.htmlEncode(e.key),this.addKey=async t=>{const{event:n,node:o}=t;n.stopPropagation();const a=angular.copy(r.expandedNodes);try{const t=await l.show({$event:n,node:o,type:"add"});i((()=>{r.savedExpandedNodes=a,e.loadRedisInfoResponse({response:t}),s.go("main.key",{key:t.key,resize:this.p3xrResize})}))}catch(t){e.generalHandleError(t)}},a.$on("p3xr-key-delete",((e,t)=>{this.delete(t)})),a.$on("p3xr-key-rename",((e,t)=>{this.rename(t)})),a.$on("p3xr-key-new",((e,t)=>{this.addKey(t)}))}]})},81378:(e,t,n)=>{let o=[],r=-1;const i=n(80230).htmlEncode;p3xr.ng.component("p3xrConsole",{template:n(88236),controller:["p3xrCommon","p3xrSocket","$state","$rootScope","p3xrRedisParser","$mdDialog","$timeout",function(e,t,s,a,d,l,c){const m=p3xr.state.commands;let p,u,g,x,h,f,y;a.hasConnected()||s.go("main");const b=n(76897),v=()=>{let e,t=0;e=[u,g,x];for(let n of e)t+=n.outerHeight();const n=$window.height(),o=Math.max(n-t-66,0);p.height(o),p.css("max-height",o+"px")},k=b(v,p3xr.settings.debounce);let w=0;this.$doCheck=()=>{w<10&&(w++,v())};const C=e=>{if(!1===p3xr.state.monitor)return;let t=i(String(e.message));f.append("<strong>PubSub channel:</strong> "+e.channel),f.append(`<pre>${t}</pre><br/>`),y.scrollTop=y.scrollHeight};let S,T,E,D;this.$onInit=()=>{p=$("#p3xr-console-content"),u=$("#p3xr-layout-header-container"),g=$("#p3xr-layout-footer-container"),x=$("#p3xr-console-header"),h=$("#p3xr-console-input"),f=$("#p3xr-console-content-output"),h.focus(),y=p[0],$window.on("resize",k),k(),this.clearConsole(),t.ioClient.on("pubsub-message",C)},this.$onDestroy=function(){$window.off("resize",k),t.ioClient.removeListener("pubsub-message",C)},this.inputValue="",this.actionEnter=async()=>{let e;const n=String(this.inputValue).trim();if(""!==n)try{f.append(`<div class="p3xr-console-content-output-item">${n}</div>`),this.inputValue="",e=await t.request({action:"console",payload:{command:n}});const s=i(String(d.console.parse(e.result)));f.append(`<pre>${s}</pre>`),e.hasOwnProperty("database")&&(a.p3xr.state.currentDatabase=e.database,a.p3xr.state.redisChanged=!0)}catch(e){console.error(e),f.append(`<pre>${e.message}</pre>`)}finally{let t;t=void 0!==e?e.generatedCommand:n;const i=o.indexOf(t);i>-1&&o.splice(i,1),o.push(t),r=-1,y.scrollTop=y.scrollHeight,h.focus()}};const P=()=>{c((()=>{const e=h.val();h.val("").focus().val(e)}))};this.action=e=>{switch(9!==e.keyCode&&!0!==event.shiftKey&&(S=void 0,T=-1,E=[],D=!1),e.keyCode){case 13:return this.actionEnter();case 38:if(o.length<1)return;-1===r&&(r=o.length),r--,r>-1||(r=o.length-1),this.inputValue=o[r],P();break;case 40:if(o.length<1)return;r++,r>=o.length||(r=0),this.inputValue=o[r],P();break;case 9:if(void 0===this.inputValue&&(this.inputValue=""),!D){const e=String(this.inputValue).trim();S=e,T=-1,E=""===S?m:m.filter((e=>e.startsWith(S.toLowerCase())))}!0===event.shiftKey?T--:T++,T>=E.length?T=0:T<0&&(T=E.length-1),this.inputValue=E[T],e.stopPropagation(),e.preventDefault(),D=!0;break;default:r=-1}},this.clearConsole=()=>{f.empty(),f.append('<div class="p3xr-console-content-output-item"><strong>'+a.p3xr.strings.label.welcomeConsole+"</strong></div>"),f.append('<div class="p3xr-console-content-output-item">'+a.p3xr.strings.label.welcomeConsoleInfo+"</div>"),f.append('<div class="p3xr-console-content-output-item">'+a.p3xr.strings.label.welcomeConsoleInfo2+"</div>"),h.focus()},this.commands=()=>{l.show({controller:["$scope","$mdDialog",function(e,t){e.ok=function(){t.hide()},e.$watch((function(){return $("#p3xr-console-commands").parent().height()}),((t,n)=>{e.height=t}))}],fullscreen:!0,template:'\n<md-dialog aria-label="{{ $root.p3xr.strings.intention.commands }}" layout-fill>\n <md-toolbar md-theme="{{$root.p3xr.state.themeLayout}}">\n <div class="md-toolbar-tools">\n <md-icon>keyboard</md-icon>\n &nbsp;\n {{ $root.p3xr.strings.intention.commands }}\n <span flex></span>\n <md-button class="md-icon-button" ng-click="ok()" aria-label="{{ $root.p3xr.strings.intention.close }}">\n <md-icon>close</md-icon>\n </md-button>\n </div>\n </md-toolbar>\n\n <md-dialog-content flex>\n <div id="p3xr-console-commands">\n <iframe seamless="seamless" src="https://redis.io/commands" frameborder="0" style="width: 100%; height: {{ height - 15 }}px;"></iframe>\n </div>\n </md-dialog-content>\n\n <md-dialog-actions layout="row">\n <span flex></span>\n <md-button ng-click="ok()" class="md-raised md-primary" aria-label="{{ $root.p3xr.strings.intention.close }}">\n <md-icon>close</md-icon>\n {{ $root.p3xr.strings.intention.close }}\n </md-button>\n </md-dialog-actions>\n</md-dialog>\n '})}}]})},57630:(e,t,n)=>{p3xr.ng.component("p3xrError",{template:n(74007),controller:["$stateParams","$rootScope",function(e,t){this.$stateParams=e,t.p3xr.state.failed=!0}]})},43886:(e,t,n)=>{p3xr.ng.component("p3xrMain",{template:n(22315),controller:["$cookies","p3xrSocket","p3xrCommon","p3xrRedisParser","$rootScope","$state","$timeout","$scope","$mdMedia",function(e,t,o,r,i,s,a,d,l){let c,m,p,u,g,x,h=!1,f=!1,y=void 0;Object.defineProperty(d,"resizerColor",{get:()=>f||h?"accent-400":"accent",set:e=>{}});const b=p3xr.settings.resizeMinWidth,v=n(76897);let k,w=!1;d.$watch((function(){return l("xs")}),(function(e){e||!0!==w||(void 0!==k&&a.cancel(k),k=a(T,4*p3xr.settings.debounce)),w=e}));const C=v((()=>{i.$broadcast("p3x-refresh-statistics-tabs")}),p3xr.settings.debounce),S=(e={})=>{let{redrawTabs:t}=e;void 0===t&&(t=!1);let n,o=0;n=[m,p,u];for(let e of n)o+=e.outerHeight();const r=$window.outerHeight(),i=Math.max(r-o-10,100);c.height(i),c.css("max-height",i+"px");const s=p3xr.dom.getPosition(c[0]),a=$("#p3xr-main-treecontrol-container");if(a){const e=$("#p3xr-main-treecontrol-controls-container"),t=p3xr.dom.getPosition(e[0]);a.css("top",s.top+t.height+"px"),a.css("left",s.left+"px"),a.css("height",s.height-t.height+"px"),a.css("max-height",s.height+"px"),void 0!==y?a.css("width",y-s.left+"px"):a.css("width",b+"px"),a.css("min-width",b+"px");const n=p3xr.dom.getPosition(a[0]);void 0===x&&j();const o=5;void 0!==x&&(x=document.getElementById("p3xr-main-content-sizer"),null!==x&&(x.addEventListener("mouseover",E),x.addEventListener("mouseout",D),x.style.top=s.top+"px",x.style.height=s.height+"px",x.style.left=s.left+n.width+"px",x.style.width=o+"px"));const r=$("#p3xr-main-content-container");r.css("top",s.top+"px"),r.css("height",s.height+"px"),r.css("left",s.left+n.width+o+"px"),r.css("width",s.width-n.width-o+"px"),e.width(n.width)}else V();t&&C()},T=v((()=>{y=void 0,S()}),p3xr.settings.debounce),E=()=>{h=!0,d.$digest()},D=()=>{h=!1,d.$digest()},P=e=>{"mousedown"===e.type&&"p3xr-main-content-sizer"!==e.target.id||("mousedown"===e.type?(f=!0,document.documentElement.style.cursor="ew-resize",$body.addClass("p3xr-not-selectable")):"mouseup"===e.type&&(document.documentElement.style.cursor="auto",f=!1,$body.removeClass("p3xr-not-selectable")),!1===f&&S({redrawTabs:!0}),e.stopPropagation(),d.$digest())},N=e=>{if(f){const t=p3xr.dom.getPosition(c[0]);e.clientX<t.left+b||e.clientX>window.innerWidth-b?document.documentElement.style.cursor="not-allowed":(document.documentElement.style.cursor="ew-resize",x.style.left=e.clientX+"px",y=e.clientX,S())}},j=()=>{x=document.getElementById("p3xr-main-content-sizer"),null!==x?(x.addEventListener("mouseover",E),x.addEventListener("mouseout",D),document.addEventListener("mousemove",N),document.addEventListener("mousedown",P),document.addEventListener("mouseup",P)):x=void 0};d.$on("p3xr-main-resizer",((e,t)=>{console.info("p3xr-main-resizer dragging:",t.drag),!0===t.drag?(document.addEventListener("mousemove",N),document.addEventListener("mousedown",P),document.addEventListener("mouseup",P)):(document.removeEventListener("mousemove",N),document.removeEventListener("mousedown",P),document.removeEventListener("mouseup",P))}));const V=()=>{null!=x&&(x.removeEventListener("mouseover",E),x.removeEventListener("mouseout",D),x=void 0),document.removeEventListener("mousedown",P),document.removeEventListener("mouseup",P),document.removeEventListener("mousemove",N)};this.resize=v(S,p3xr.settings.debounce),this.resizeRaw=S,this.$onInit=()=>{c=$("#p3xr-main-conten