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
186 lines • 160 kB
JavaScript
import{a as X}from"./chunk-ILFCUY66.js";import{a as Wt}from"./chunk-TSC3GVOC.js";import{a as Ut}from"./chunk-BLYHBMDZ.js";import{a as zt}from"./chunk-AEOUXU3Y.js";import{a as Z,b as Qe}from"./chunk-MNMT23XT.js";import{a as Ge}from"./chunk-XHHVAFYO.js";import{a as Je}from"./chunk-5MKOZDXN.js";import{a as ot}from"./chunk-MU5JSBF3.js";import{a as $t,b as Ht,c as qt}from"./chunk-7QYLSJH6.js";import{a as Le}from"./chunk-IKY2Z6UX.js";import{a as je,b as Ae,c as Oe}from"./chunk-G3XOKGOC.js";import{a as Re,b as Pe}from"./chunk-2IWVZCK2.js";import{a as Jt,c as Nt}from"./chunk-MRCYIS6U.js";import"./chunk-NBRXTOBF.js";import{d as Lt}from"./chunk-6XGY3Q2Y.js";import"./chunk-HWCHBMC4.js";import"./chunk-CVKYB7DC.js";import{a as Bt,b as H}from"./chunk-UYYXUKSC.js";import{b as St}from"./chunk-DET2MY23.js";import{a as At,b as Ot}from"./chunk-X6LMH7OB.js";import"./chunk-IXQONZ5Z.js";import{a as Ue,c as z}from"./chunk-VQTCYUQY.js";import{e as $}from"./chunk-TKRAWHQA.js";import{a as N,b as W}from"./chunk-W32HPWBA.js";import{a as Pt,b as jt,c as Ve,d as Ie}from"./chunk-MDGU2XDP.js";import{a as De,c as Dt,i as we,j as Se}from"./chunk-JCH63A4N.js";import"./chunk-NZJKKTDQ.js";import{b as Te,f as me,j as de,l as Be,v as U}from"./chunk-5LJPHUK2.js";import{a as Rt}from"./chunk-YA4NX3C4.js";import{b as L,c as J}from"./chunk-53CQV6LZ.js";import{b as G,c as Q}from"./chunk-4GIODJCK.js";import{c as Ft}from"./chunk-PFG3GPGC.js";import{$a as P,Ab as vt,Bb as p,Cb as h,Da as g,Db as ie,Dd as Mt,Eb as Ce,Hb as E,Ia as D,Ib as K,Ja as xt,Jb as M,Jc as O,Ka as yt,Lb as nt,Ld as se,Ma as Y,Na as $e,Nd as ce,Od as pe,Pd as q,Qb as kt,Rd as R,U as st,V as ct,Wa as Me,X as pt,Xa as y,Y as mt,Ya as f,Z as tt,Zb as B,_a as ft,ab as j,ac as qe,ba as d,bb as b,bd as Tt,ca as u,cb as o,cd as Vt,da as it,db as l,ea as dt,eb as T,fb as ve,gb as Fe,gd as It,hb as ht,hd as Et,ib as He,ja as ut,jb as C,jd as Kt,ka as _t,lb as _,lc as wt,mb as Ct,nb as s,oa as ze,oc as A,pa as te,ra as gt,rb as ke,sb as xe,tb as ye,xa as c,xb as bt,yb as re,zb as le}from"./chunk-MHKTEXY5.js";import{a as fi}from"./chunk-SJB4WMV2.js";import"./chunk-ENGD2CVB.js";import{a as Ee,b as Ke,g as et,h as w}from"./chunk-O7S4L63H.js";var hi=["determinateSpinner"];function Ci(n,r){if(n&1&&(it(),o(0,"svg",11),T(1,"circle",12),l()),n&2){let e=s();Me("viewBox",e._viewBox()),c(),re("stroke-dasharray",e._strokeCircumference(),"px")("stroke-dashoffset",e._strokeCircumference()/2,"px")("stroke-width",e._circleStrokeWidth(),"%"),Me("r",e._circleRadius())}}var bi=new pt("mat-progress-spinner-default-options",{providedIn:"root",factory:()=>({diameter:Gt})}),Gt=100,vi=10,Qt=(()=>{class n{_elementRef=tt(gt);_noopAnimations;get color(){return this._color||this._defaultColor}set color(e){this._color=e}_color;_defaultColor="primary";_determinateCircle;constructor(){let e=tt(bi),i=Mt(),t=this._elementRef.nativeElement;this._noopAnimations=i==="di-disabled"&&!!e&&!e._forceAnimations,this.mode=t.nodeName.toLowerCase()==="mat-spinner"?"indeterminate":"determinate",!this._noopAnimations&&i==="reduced-motion"&&t.classList.add("mat-progress-spinner-reduced-motion"),e&&(e.color&&(this.color=this._defaultColor=e.color),e.diameter&&(this.diameter=e.diameter),e.strokeWidth&&(this.strokeWidth=e.strokeWidth))}mode;get value(){return this.mode==="determinate"?this._value:0}set value(e){this._value=Math.max(0,Math.min(100,e||0))}_value=0;get diameter(){return this._diameter}set diameter(e){this._diameter=e||0}_diameter=Gt;get strokeWidth(){return this._strokeWidth??this.diameter/10}set strokeWidth(e){this._strokeWidth=e||0}_strokeWidth;_circleRadius(){return(this.diameter-vi)/2}_viewBox(){let e=this._circleRadius()*2+this.strokeWidth;return`0 0 ${e} ${e}`}_strokeCircumference(){return 2*Math.PI*this._circleRadius()}_strokeDashOffset(){return this.mode==="determinate"?this._strokeCircumference()*(100-this._value)/100:null}_circleStrokeWidth(){return this.strokeWidth/this.diameter*100}static \u0275fac=function(i){return new(i||n)};static \u0275cmp=D({type:n,selectors:[["mat-progress-spinner"],["mat-spinner"]],viewQuery:function(i,t){if(i&1&&ke(hi,5),i&2){let a;xe(a=ye())&&(t._determinateCircle=a.first)}},hostAttrs:["role","progressbar","tabindex","-1",1,"mat-mdc-progress-spinner","mdc-circular-progress"],hostVars:18,hostBindings:function(i,t){i&2&&(Me("aria-valuemin",0)("aria-valuemax",100)("aria-valuenow",t.mode==="determinate"?t.value:null)("mode",t.mode),vt("mat-"+t.color),re("width",t.diameter,"px")("height",t.diameter,"px")("--mat-progress-spinner-size",t.diameter+"px")("--mat-progress-spinner-active-indicator-width",t.diameter+"px"),le("_mat-animation-noopable",t._noopAnimations)("mdc-circular-progress--indeterminate",t.mode==="indeterminate"))},inputs:{color:"color",mode:"mode",value:[2,"value","value",qe],diameter:[2,"diameter","diameter",qe],strokeWidth:[2,"strokeWidth","strokeWidth",qe]},exportAs:["matProgressSpinner"],decls:14,vars:11,consts:[["circle",""],["determinateSpinner",""],["aria-hidden","true",1,"mdc-circular-progress__determinate-container"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__determinate-circle-graphic"],["cx","50%","cy","50%",1,"mdc-circular-progress__determinate-circle"],["aria-hidden","true",1,"mdc-circular-progress__indeterminate-container"],[1,"mdc-circular-progress__spinner-layer"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-left"],[3,"ngTemplateOutlet"],[1,"mdc-circular-progress__gap-patch"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-right"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__indeterminate-circle-graphic"],["cx","50%","cy","50%"]],template:function(i,t){if(i&1&&($e(0,Ci,2,8,"ng-template",null,0,kt),o(2,"div",2,1),it(),o(4,"svg",3),T(5,"circle",4),l()(),dt(),o(6,"div",5)(7,"div",6)(8,"div",7),He(9,8),l(),o(10,"div",9),He(11,8),l(),o(12,"div",10),He(13,8),l()()()),i&2){let a=bt(1);c(4),Me("viewBox",t._viewBox()),c(),re("stroke-dasharray",t._strokeCircumference(),"px")("stroke-dashoffset",t._strokeDashOffset(),"px")("stroke-width",t._circleStrokeWidth(),"%"),Me("r",t._circleRadius()),c(4),b("ngTemplateOutlet",a),c(2),b("ngTemplateOutlet",a),c(2),b("ngTemplateOutlet",a)}},dependencies:[wt],styles:[`.mat-mdc-progress-spinner {
--mat-progress-spinner-animation-multiplier: 1;
display: block;
overflow: hidden;
line-height: 0;
position: relative;
direction: ltr;
transition: opacity 250ms cubic-bezier(0.4, 0, 0.6, 1);
}
.mat-mdc-progress-spinner circle {
stroke-width: var(--mat-progress-spinner-active-indicator-width, 4px);
}
.mat-mdc-progress-spinner._mat-animation-noopable, .mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__determinate-circle {
transition: none !important;
}
.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-circle-graphic,
.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__spinner-layer,
.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-container {
animation: none !important;
}
.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-container circle {
stroke-dasharray: 0 !important;
}
@media (forced-colors: active) {
.mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic,
.mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle {
stroke: currentColor;
stroke: CanvasText;
}
}
.mat-progress-spinner-reduced-motion {
--mat-progress-spinner-animation-multiplier: 1.25;
}
.mdc-circular-progress__determinate-container,
.mdc-circular-progress__indeterminate-circle-graphic,
.mdc-circular-progress__indeterminate-container,
.mdc-circular-progress__spinner-layer {
position: absolute;
width: 100%;
height: 100%;
}
.mdc-circular-progress__determinate-container {
transform: rotate(-90deg);
}
.mdc-circular-progress--indeterminate .mdc-circular-progress__determinate-container {
opacity: 0;
}
.mdc-circular-progress__indeterminate-container {
font-size: 0;
letter-spacing: 0;
white-space: nowrap;
opacity: 0;
}
.mdc-circular-progress--indeterminate .mdc-circular-progress__indeterminate-container {
opacity: 1;
animation: mdc-circular-progress-container-rotate calc(1568.2352941176ms * var(--mat-progress-spinner-animation-multiplier)) linear infinite;
}
.mdc-circular-progress__determinate-circle-graphic,
.mdc-circular-progress__indeterminate-circle-graphic {
fill: transparent;
}
.mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle,
.mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic {
stroke: var(--mat-progress-spinner-active-indicator-color, var(--mat-sys-primary));
}
@media (forced-colors: active) {
.mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle,
.mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic {
stroke: CanvasText;
}
}
.mdc-circular-progress__determinate-circle {
transition: stroke-dashoffset 500ms cubic-bezier(0, 0, 0.2, 1);
}
.mdc-circular-progress__gap-patch {
position: absolute;
top: 0;
left: 47.5%;
box-sizing: border-box;
width: 5%;
height: 100%;
overflow: hidden;
}
.mdc-circular-progress__gap-patch .mdc-circular-progress__indeterminate-circle-graphic {
left: -900%;
width: 2000%;
transform: rotate(180deg);
}
.mdc-circular-progress__circle-clipper .mdc-circular-progress__indeterminate-circle-graphic {
width: 200%;
}
.mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic {
left: -100%;
}
.mdc-circular-progress--indeterminate .mdc-circular-progress__circle-left .mdc-circular-progress__indeterminate-circle-graphic {
animation: mdc-circular-progress-left-spin calc(1333ms * var(--mat-progress-spinner-animation-multiplier)) cubic-bezier(0.4, 0, 0.2, 1) infinite both;
}
.mdc-circular-progress--indeterminate .mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic {
animation: mdc-circular-progress-right-spin calc(1333ms * var(--mat-progress-spinner-animation-multiplier)) cubic-bezier(0.4, 0, 0.2, 1) infinite both;
}
.mdc-circular-progress__circle-clipper {
display: inline-flex;
position: relative;
width: 50%;
height: 100%;
overflow: hidden;
}
.mdc-circular-progress--indeterminate .mdc-circular-progress__spinner-layer {
animation: mdc-circular-progress-spinner-layer-rotate calc(5332ms * var(--mat-progress-spinner-animation-multiplier)) cubic-bezier(0.4, 0, 0.2, 1) infinite both;
}
@keyframes mdc-circular-progress-container-rotate {
to {
transform: rotate(360deg);
}
}
@keyframes mdc-circular-progress-spinner-layer-rotate {
12.5% {
transform: rotate(135deg);
}
25% {
transform: rotate(270deg);
}
37.5% {
transform: rotate(405deg);
}
50% {
transform: rotate(540deg);
}
62.5% {
transform: rotate(675deg);
}
75% {
transform: rotate(810deg);
}
87.5% {
transform: rotate(945deg);
}
100% {
transform: rotate(1080deg);
}
}
@keyframes mdc-circular-progress-left-spin {
from {
transform: rotate(265deg);
}
50% {
transform: rotate(130deg);
}
to {
transform: rotate(265deg);
}
}
@keyframes mdc-circular-progress-right-spin {
from {
transform: rotate(-265deg);
}
50% {
transform: rotate(-130deg);
}
to {
transform: rotate(-265deg);
}
}
`],encapsulation:2,changeDetection:0})}return n})();var Zt=(()=>{class n{static \u0275fac=function(i){return new(i||n)};static \u0275mod=xt({type:n});static \u0275inj=ct({imports:[Tt]})}return n})();var Ze=(()=>{class n{dialog;constructor(e){this.dialog=e}show(e){return w(this,null,function*(){let{TtlDialogComponent:i}=yield import("./chunk-TAASZOUD.js"),t=this.dialog.open(i,Rt({data:{model:e.model}}));return new Promise((a,m)=>{t.afterClosed().subscribe(x=>{x?a(x):m()})})})}static \u0275fac=function(i){return new(i||n)(mt(Ft))};static \u0275prov=st({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function Xt(n){let r=n instanceof Uint8Array?n:new Uint8Array(n);if(r.length<4)return{ext:"bin",mime:"application/octet-stream"};if(r[0]===137&&r[1]===80&&r[2]===78&&r[3]===71)return{ext:"png",mime:"image/png"};if(r[0]===255&&r[1]===216&&r[2]===255)return{ext:"jpg",mime:"image/jpeg"};if(r[0]===71&&r[1]===73&&r[2]===70&&r[3]===56)return{ext:"gif",mime:"image/gif"};if(r[0]===66&&r[1]===77)return{ext:"bmp",mime:"image/bmp"};if(r[0]===82&&r[1]===73&&r[2]===70&&r[3]===70&&r.length>=12&&r[8]===87&&r[9]===69&&r[10]===66&&r[11]===80)return{ext:"webp",mime:"image/webp"};if(r[0]===73&&r[1]===73&&r[2]===42&&r[3]===0||r[0]===77&&r[1]===77&&r[2]===0&&r[3]===42)return{ext:"tiff",mime:"image/tiff"};if(r[0]===0&&r[1]===0&&r[2]===1&&r[3]===0)return{ext:"ico",mime:"image/x-icon"};if(r[0]===37&&r[1]===80&&r[2]===68&&r[3]===70)return{ext:"pdf",mime:"application/pdf"};if(r[0]===80&&r[1]===75&&r[2]===3&&r[3]===4)return{ext:"zip",mime:"application/zip"};if(r[0]===31&&r[1]===139)return{ext:"gz",mime:"application/gzip"};if(r[0]===66&&r[1]===90&&r[2]===104)return{ext:"bz2",mime:"application/x-bzip2"};if(r[0]===253&&r[1]===55&&r[2]===122&&r[3]===88&&r.length>=6&&r[4]===90&&r[5]===0)return{ext:"xz",mime:"application/x-xz"};if(r[0]===40&&r[1]===181&&r[2]===47&&r[3]===253)return{ext:"zst",mime:"application/zstd"};if(r[0]===4&&r[1]===34&&r[2]===77&&r[3]===24)return{ext:"lz4",mime:"application/x-lz4"};if(r[0]===55&&r[1]===122&&r[2]===188&&r[3]===175&&r.length>=6&&r[4]===39&&r[5]===28)return{ext:"7z",mime:"application/x-7z-compressed"};if(r[0]===82&&r[1]===97&&r[2]===114&&r[3]===33)return{ext:"rar",mime:"application/x-rar-compressed"};if(r[0]===82&&r[1]===73&&r[2]===70&&r[3]===70&&r.length>=12&&r[8]===87&&r[9]===65&&r[10]===86&&r[11]===69)return{ext:"wav",mime:"audio/wav"};if(r[0]===82&&r[1]===73&&r[2]===70&&r[3]===70&&r.length>=12&&r[8]===65&&r[9]===86&&r[10]===73&&r[11]===32)return{ext:"avi",mime:"video/x-msvideo"};if(r[0]===255&&(r[1]===251||r[1]===243||r[1]===242)||r[0]===73&&r[1]===68&&r[2]===51)return{ext:"mp3",mime:"audio/mpeg"};if(r[0]===102&&r[1]===76&&r[2]===97&&r[3]===67)return{ext:"flac",mime:"audio/flac"};if(r[0]===79&&r[1]===103&&r[2]===103&&r[3]===83)return{ext:"ogg",mime:"audio/ogg"};if(r[0]===26&&r[1]===69&&r[2]===223&&r[3]===163)return{ext:"webm",mime:"video/webm"};if(r.length>=8&&r[4]===102&&r[5]===116&&r[6]===121&&r[7]===112)return{ext:"mp4",mime:"video/mp4"};if(r[0]===0&&r[1]===97&&r[2]===115&&r[3]===109)return{ext:"wasm",mime:"application/wasm"};if(r[0]===127&&r[1]===69&&r[2]===76&&r[3]===70)return{ext:"elf",mime:"application/x-elf"};if(r.length>=6&&r[0]===83&&r[1]===81&&r[2]===76&&r[3]===105&&r[4]===116&&r[5]===101)return{ext:"sqlite",mime:"application/x-sqlite3"};if(r[0]===56&&r[1]===66&&r[2]===80&&r[3]===83)return{ext:"psd",mime:"image/vnd.adobe.photoshop"};let e=wi(r);return e||{ext:"bin",mime:"application/octet-stream"}}function wi(n){let r=n[0];if(r===123||r===91)return{ext:"json",mime:"application/json"};if(r===60){let e=new TextDecoder("utf-8",{fatal:!1}).decode(n.slice(0,Math.min(n.length,256))).toLowerCase();if(e.includes("<svg"))return{ext:"svg",mime:"image/svg+xml"};if(e.includes("<!doctype html")||e.includes("<html"))return{ext:"html",mime:"text/html"};if(e.includes("<?xml"))return{ext:"xml",mime:"application/xml"}}if(n[0]===239&&n[1]===187&&n[2]===191){if(n.length>3){if(n[3]===123||n[3]===91)return{ext:"json",mime:"application/json"};if(n[3]===60)return{ext:"xml",mime:"application/xml"}}return{ext:"txt",mime:"text/plain"}}return null}var ee=(()=>{class n{i18n;socket;common;jsonViewDialog;keyNewOrSetDialog;breakpointObserver;cmd;cdr;redisState;settingsService;p3xrResponse;p3xrValue;p3xrValueBuffer;p3xrKey="";isGtSm=window.innerWidth>=960;valueFormat="raw";unsubFns=[];constructor(e,i,t,a,m,x,v,k,S,V){this.i18n=e,this.socket=i,this.common=t,this.jsonViewDialog=a,this.keyNewOrSetDialog=m,this.breakpointObserver=x,this.cmd=v,this.cdr=k,this.redisState=S,this.settingsService=V;let F=this.breakpointObserver.observe("(min-width: 960px)").subscribe(I=>{this.isGtSm=I.matches,this.cdr.markForCheck()});this.unsubFns.push(()=>F.unsubscribe())}destroyBase(){this.unsubFns.forEach(e=>e())}get strings(){return this.i18n.strings()}get isReadonly(){return this.redisState.connection()?.readonly===!0}get maxValueDisplay(){return this.settingsService.maxValueDisplay()??1024}get maxValueAsBuffer(){return this.settingsService.maxValueAsBuffer}copy(e){return w(this,null,function*(){yield this.settingsService.clipboard(e),this.common.toast(this.strings?.status?.dataCopied)})}downloadBuffer(e,i){let t=e instanceof Uint8Array?e:new Uint8Array(e),{ext:a,mime:m}=Xt(t),x=new Blob([t],{type:m}),v=URL.createObjectURL(x),k=document.createElement("a");k.href=v,k.download=`${i||this.p3xrKey}.${a}`,k.click(),URL.revokeObjectURL(v)}showJson(e,i){return w(this,null,function*(){try{yield this.jsonViewDialog.show({value:e,$event:i})}catch(t){}})}refreshKey(){this.cmd.refreshKey$.next()}gtag(e){try{typeof window.gtag=="function"&&window.gtag("config",this.settingsService.googleAnalytics,{page_path:e})}catch(i){}}truncateDisplay(e){if(e==null)return"";let i=String(e);return this.maxValueDisplay<=0?i:i.length>this.maxValueDisplay?i.substring(0,this.maxValueDisplay):i}isTruncated(e){return e==null||this.maxValueDisplay<=0?!1:String(e).length>this.maxValueDisplay}formatValue(e){if(e==null)return"";let i=String(e);switch(this.valueFormat){case"json":try{return JSON.stringify(JSON.parse(i),null,2)}catch(t){return i}case"base64":{let t=new TextEncoder().encode(i),a="";for(let m=0;m<t.length;m++)a+=String.fromCharCode(t[m]);return btoa(a)}default:return i}}isBufferValue(e){return typeof e=="object"&&e!==null&&e.byteLength!==void 0}prettyBytes(e){return this.settingsService.prettyBytes(e)??`${e} bytes`}static \u0275fac=function(i){return new(i||n)(g(R),g(z),g($),g(Z),g(X),g(O),g(H),g(B),g(W),g(N))};static \u0275dir=yt({type:n,inputs:{p3xrResponse:"p3xrResponse",p3xrValue:"p3xrValue",p3xrValueBuffer:"p3xrValueBuffer",p3xrKey:"p3xrKey",valueFormat:"valueFormat"}})}return n})();var Si=["hexContent"],Ti=["hexScrollbar"],Vi=(n,r)=>r.addr;function Ii(n,r){if(n&1&&(ve(0,"div",4)(1,"span",7),p(2),Fe(),ve(3,"span",8),p(4),ve(5,"span",9),p(6),Fe()(),ve(7,"span",10),p(8),ve(9,"span",9),p(10),Fe()()()),n&2){let e=r.$implicit;c(2),h(e.addr),c(2),h(e.hexReal),c(2),h(e.hexPad),c(2),h(e.asciiReal),c(2),h(e.asciiPad)}}var ue=(()=>{class n{cdr;lines=[];contentScrollWidth=0;truncated=!1;contentRef;scrollbarRef;_value="";resizeObs=null;viewReady=!1;constructor(e){this.cdr=e}set value(e){this._value=e??"",this.lines=n.parseHexLines(this._value),this.viewReady&&requestAnimationFrame(()=>this.measure())}get value(){return this._value}ngAfterViewInit(){this.viewReady=!0,this.measure(),this.resizeObs=new ResizeObserver(()=>{this.measure(),this.cdr.detectChanges()}),this.contentRef?.nativeElement&&this.resizeObs.observe(this.contentRef.nativeElement)}ngOnDestroy(){this.resizeObs?.disconnect()}syncScroll(){this.contentRef?.nativeElement&&this.scrollbarRef?.nativeElement&&(this.contentRef.nativeElement.scrollLeft=this.scrollbarRef.nativeElement.scrollLeft)}measure(){let e=this.contentRef?.nativeElement;e&&(this.contentScrollWidth=e.scrollWidth)}static parseHexLines(e){if(!e)return[];let i=new TextEncoder().encode(e),t=[];for(let a=0;a<i.length;a+=16){let m=i.slice(a,a+16),x=m.length,v=a.toString(16).padStart(8,"0"),k=new Uint8Array(16);k.set(m);let S=Array.from(k.slice(0,8)).map(I=>I.toString(16).padStart(2,"0")).join(" "),V=Array.from(k.slice(8)).map(I=>I.toString(16).padStart(2,"0")).join(" "),F=S+" "+V;if(x===16){let I=Array.from(k).map(ne=>ne>=32&&ne<=126?String.fromCharCode(ne):".").join("");t.push({addr:v,hexReal:F,hexPad:"",asciiReal:I,asciiPad:""})}else{let I=x<=8?3*x-1:25+3*(x-8)-1,ne=Array.from(k).map(Ne=>Ne>=32&&Ne<=126?String.fromCharCode(Ne):".").join("");t.push({addr:v,hexReal:F.substring(0,I),hexPad:F.substring(I),asciiReal:ne.substring(0,x),asciiPad:ne.substring(x)})}}return t}static \u0275fac=function(i){return new(i||n)(g(B))};static \u0275cmp=D({type:n,selectors:[["p3xr-hex-monitor"]],viewQuery:function(i,t){if(i&1&&ke(Si,5)(Ti,5),i&2){let a;xe(a=ye())&&(t.contentRef=a.first),xe(a=ye())&&(t.scrollbarRef=a.first)}},inputs:{truncated:"truncated",value:"value"},decls:8,vars:2,consts:[["hexContent",""],["hexScrollbar",""],[2,"font-family","'Roboto Mono', monospace","font-size","16px","line-height","22px"],[2,"overflow","hidden"],[2,"display","flex","white-space","nowrap"],[2,"overflow-x","auto","overflow-y","hidden","position","sticky","bottom","0",3,"scroll"],[2,"height","1px"],[2,"opacity","0.5","padding-right","12px","flex-shrink","0"],[2,"padding-right","12px","flex-shrink","0","white-space","pre"],[2,"opacity","0.5"],[2,"border-left","1px solid var(--p3xr-fieldset-border, rgba(255,255,255,0.25))","padding-left","12px","flex-shrink","0"]],template:function(i,t){i&1&&(ve(0,"div",2)(1,"div",3,0),P(3,Ii,11,5,"div",4,Vi),Fe(),ve(5,"div",5,1),Ct("scroll",function(){return t.syncScroll()}),ht(7,"div",6),Fe()()),i&2&&(c(3),j(t.lines),c(4),re("width",t.contentScrollWidth,"px"))},styles:[`:host{display:block}
`],encapsulation:2})}return n})();var Yt=n=>({maxValueAsBuffer:n});function Ei(n,r){if(n&1){let e=C();o(0,"button",8),_("click",function(){d(e);let t=s(3);return u(t.setBufferUpload())}),o(1,"mat-icon"),p(2,"upload"),l(),o(3,"span"),p(4),l()()}if(n&2){let e=s(3);c(4),h(e.strings==null||e.strings.intention==null?null:e.strings.intention.setBuffer)}}function Ki(n,r){if(n&1){let e=C();o(0,"button",9),_("click",function(){d(e);let t=s(3);return u(t.setBufferUpload())}),o(1,"mat-icon"),p(2,"upload"),l()()}if(n&2){let e=s(3);b("matTooltip",(e.strings==null||e.strings.intention==null?null:e.strings.intention.setBuffer)??"Upload")}}function Mi(n,r){if(n&1&&y(0,Ei,5,1,"button",6)(1,Ki,3,1,"button",7),n&2){let e=s(2);f(e.isGtSm?0:1)}}function Fi(n,r){if(n&1){let e=C();o(0,"button",10),_("click",function(){d(e);let t=s(2);return u(t.downloadBufferFile())}),o(1,"mat-icon"),p(2,"download"),l(),o(3,"span"),p(4),l()()}if(n&2){let e=s(2);c(4),h(e.strings==null||e.strings.intention==null?null:e.strings.intention.downloadBuffer)}}function Di(n,r){if(n&1){let e=C();o(0,"button",11),_("click",function(){d(e);let t=s(2);return u(t.downloadBufferFile())}),o(1,"mat-icon"),p(2,"download"),l()()}if(n&2){let e=s(2);b("matTooltip",(e.strings==null||e.strings.intention==null?null:e.strings.intention.downloadBuffer)??"Download")}}function Bi(n,r){if(n&1){let e=C();o(0,"button",10),_("click",function(t){d(e);let a=s(2);return u(a.jsonViewer(t))}),o(1,"mat-icon"),p(2,"account_tree"),l(),o(3,"span"),p(4),l()()}if(n&2){let e=s(2);c(4),h(e.strings==null||e.strings.intention==null?null:e.strings.intention.jsonViewShow)}}function Ri(n,r){if(n&1){let e=C();o(0,"button",11),_("click",function(t){d(e);let a=s(2);return u(a.jsonViewer(t))}),o(1,"mat-icon"),p(2,"account_tree"),l()()}if(n&2){let e=s(2);b("matTooltip",(e.strings==null||e.strings.intention==null?null:e.strings.intention.jsonViewShow)??"JSON")}}function Pi(n,r){if(n&1){let e=C();o(0,"button",10),_("click",function(){d(e);let t=s(2);return u(t.copyValue())}),o(1,"mat-icon"),p(2,"content_copy"),l(),o(3,"span"),p(4),l()()}if(n&2){let e=s(2);c(4),h(e.strings==null||e.strings.intention==null?null:e.strings.intention.copy)}}function ji(n,r){if(n&1){let e=C();o(0,"button",11),_("click",function(){d(e);let t=s(2);return u(t.copyValue())}),o(1,"mat-icon"),p(2,"content_copy"),l()()}if(n&2){let e=s(2);b("matTooltip",(e.strings==null||e.strings.intention==null?null:e.strings.intention.copy)??"Copy")}}function Ai(n,r){if(n&1){let e=C();o(0,"button",8),_("click",function(){d(e);let t=s(3);return u(t.formatJson())}),o(1,"mat-icon"),p(2,"format_line_spacing"),l(),o(3,"span"),p(4),l()()}if(n&2){let e=s(3);c(4),h(e.strings==null||e.strings.intention==null?null:e.strings.intention.formatJson)}}function Oi(n,r){if(n&1){let e=C();o(0,"button",9),_("click",function(){d(e);let t=s(3);return u(t.formatJson())}),o(1,"mat-icon"),p(2,"format_line_spacing"),l()()}if(n&2){let e=s(3);b("matTooltip",(e.strings==null||e.strings.intention==null?null:e.strings.intention.formatJson)??"Format JSON")}}function Li(n,r){if(n&1&&y(0,Ai,5,1,"button",6)(1,Oi,3,1,"button",7),n&2){let e=s(2);f(e.isGtSm?0:1)}}function Ji(n,r){if(n&1){let e=C();o(0,"button",8),_("click",function(){d(e);let t=s(2);return u(t.jsonEditor())}),o(1,"mat-icon"),p(2,"description"),l(),o(3,"span"),p(4),l()()}if(n&2){let e=s(2);c(4),h(e.strings==null||e.strings.intention==null?null:e.strings.intention.jsonViewEditor)}}function Ni(n,r){if(n&1){let e=C();o(0,"button",9),_("click",function(){d(e);let t=s(2);return u(t.jsonEditor())}),o(1,"mat-icon"),p(2,"description"),l()()}if(n&2){let e=s(2);b("matTooltip",(e.strings==null||e.strings.intention==null?null:e.strings.intention.jsonViewEditor)??"JSON Editor")}}function Wi(n,r){if(n&1){let e=C();o(0,"button",10),_("click",function(){d(e);let t=s(3);return u(t.showDigest())}),o(1,"mat-icon"),p(2,"numbers"),l(),o(3,"span"),p(4,"Digest"),l()()}}function zi(n,r){if(n&1){let e=C();o(0,"button",13),_("click",function(){d(e);let t=s(3);return u(t.showDigest())}),o(1,"mat-icon"),p(2,"numbers"),l()()}}function $i(n,r){if(n&1&&y(0,Wi,5,0,"button",4)(1,zi,3,0,"button",12),n&2){let e=s(2);f(e.isGtSm?0:1)}}function Hi(n,r){if(n&1){let e=C();o(0,"button",8),_("click",function(){d(e);let t=s(3);return u(t.edit())}),o(1,"mat-icon"),p(2,"edit"),l(),o(3,"span"),p(4),l()()}if(n&2){let e=s(3);c(4),h(e.strings==null||e.strings.intention==null?null:e.strings.intention.edit)}}function qi(n,r){if(n&1){let e=C();o(0,"button",9),_("click",function(){d(e);let t=s(3);return u(t.edit())}),o(1,"mat-icon"),p(2,"edit"),l()()}if(n&2){let e=s(3);b("matTooltip",(e.strings==null||e.strings.intention==null?null:e.strings.intention.edit)??"Edit")}}function Ui(n,r){if(n&1&&y(0,Hi,5,1,"button",6)(1,qi,3,1,"button",7),n&2){let e=s(2);f(e.isGtSm?0:1)}}function Gi(n,r){if(n&1&&(o(0,"div",0),y(1,Mi,2,1),y(2,Fi,5,1,"button",4)(3,Di,3,1,"button",5),y(4,Bi,5,1,"button",4)(5,Ri,3,1,"button",5),y(6,Pi,5,1,"button",4)(7,ji,3,1,"button",5),y(8,Li,2,1),y(9,Ji,5,1,"button",6)(10,Ni,3,1,"button",7),y(11,$i,2,1),y(12,Ui,2,1),l()),n&2){let e=s();c(),f(e.isReadonly?-1:1),c(),f(e.isGtSm?2:3),c(2),f(e.isGtSm?4:5),c(2),f(e.isGtSm?6:7),c(2),f(e.isReadonly?-1:8),c(),f(e.isGtSm?9:10),c(2),f(e.redisState.redisVersion().isAtLeast(8,4)?11:-1),c(),f(e.isReadonly?-1:12)}}function Qi(n,r){if(n&1){let e=C();o(0,"mat-slide-toggle",17),M("ngModelChange",function(t){d(e);let a=s(2);return K(a.validateJson,t)||(a.validateJson=t),u(t)}),p(1),l()}if(n&2){let e=s(2);E("ngModel",e.validateJson),c(),ie(" ",e.strings==null||e.strings.label==null?null:e.strings.label.validateJson," ")}}function Zi(n,r){if(n&1){let e=C();o(0,"button",18),_("click",function(){d(e);let t=s(2);return u(t.cancelEdit())}),o(1,"mat-icon"),p(2,"cancel"),l(),o(3,"span"),p(4),l()()}if(n&2){let e=s(2);c(4),h(e.strings==null||e.strings.intention==null?null:e.strings.intention.cancel)}}function Xi(n,r){if(n&1){let e=C();o(0,"button",19),_("click",function(){d(e);let t=s(2);return u(t.cancelEdit())}),o(1,"mat-icon"),p(2,"cancel"),l()()}if(n&2){let e=s(2);b("matTooltip",(e.strings==null||e.strings.intention==null?null:e.strings.intention.cancel)??"Cancel")}}function Yi(n,r){if(n&1){let e=C();o(0,"button",8),_("click",function(){d(e);let t=s(3);return u(t.setBufferUpload())}),o(1,"mat-icon"),p(2,"upload"),l(),o(3,"span"),p(4),l()()}if(n&2){let e=s(3);c(4),h(e.strings==null||e.strings.intention==null?null:e.strings.intention.setBuffer)}}function en(n,r){if(n&1){let e=C();o(0,"button",9),_("click",function(){d(e);let t=s(3);return u(t.setBufferUpload())}),o(1,"mat-icon"),p(2,"upload"),l()()}if(n&2){let e=s(3);b("matTooltip",(e.strings==null||e.strings.intention==null?null:e.strings.intention.setBuffer)??"Upload")}}function tn(n,r){if(n&1&&y(0,Yi,5,1,"button",6)(1,en,3,1,"button",7),n&2){let e=s(2);f(e.isGtSm?0:1)}}function nn(n,r){if(n&1){let e=C();o(0,"button",8),_("click",function(){d(e);let t=s(3);return u(t.save())}),o(1,"mat-icon"),p(2,"save"),l(),o(3,"span"),p(4),l()()}if(n&2){let e=s(3);c(4),h(e.strings==null||e.strings.intention==null?null:e.strings.intention.save)}}function on(n,r){if(n&1){let e=C();o(0,"button",9),_("click",function(){d(e);let t=s(3);return u(t.save())}),o(1,"mat-icon"),p(2,"save"),l()()}if(n&2){let e=s(3);b("matTooltip",(e.strings==null||e.strings.intention==null?null:e.strings.intention.save)??"Save")}}function rn(n,r){if(n&1&&y(0,nn,5,1,"button",6)(1,on,3,1,"button",7),n&2){let e=s(2);f(e.isGtSm?0:1)}}function an(n,r){if(n&1&&(o(0,"div",0),y(1,Qi,2,2,"mat-slide-toggle",14),y(2,Zi,5,1,"button",15)(3,Xi,3,1,"button",16),y(4,tn,2,1),y(5,rn,2,1),l()),n&2){let e=s();c(),f(e.isReadonly?-1:1),c(),f(e.isGtSm?2:3),c(2),f(e.isReadonly?-1:4),c(),f(e.isReadonly?-1:5)}}function ln(n,r){if(n&1&&(o(0,"div",20),p(1),l()),n&2){let e=s(2);c(),Ce(" ",e.strings==null||e.strings.label==null||e.strings.label.isBuffer==null?null:e.strings.label.isBuffer(nt(2,Yt,e.prettyBytes(e.maxValueAsBuffer)))," ",e.bufferDisplay()," ")}}function sn(n,r){if(n&1){let e=C();o(0,"div",20),p(1),l(),o(2,"textarea",22),M("ngModelChange",function(t){d(e);let a=s(2);return K(a.p3xrValueBuffer,t)||(a.p3xrValueBuffer=t),u(t)}),l()}if(n&2){let e=s(2);c(),Ce(" ",e.strings==null||e.strings.label==null||e.strings.label.isBuffer==null?null:e.strings.label.isBuffer(nt(3,Yt,e.prettyBytes(e.maxValueAsBuffer)))," ",e.bufferDisplay()," "),c(),E("ngModel",e.p3xrValueBuffer)}}function cn(n,r){if(n&1){let e=C();o(0,"textarea",22),M("ngModelChange",function(t){d(e);let a=s(2);return K(a.p3xrValue,t)||(a.p3xrValue=t),u(t)}),l()}if(n&2){let e=s(2);E("ngModel",e.p3xrValue)}}function pn(n,r){if(n&1&&(o(0,"mat-form-field",2),y(1,ln,2,4,"div",20),y(2,sn,3,5)(3,cn,1,1,"textarea",21),l()),n&2){let e=s();c(),f(e.p3xrValue&&e.p3xrValue.toString()==="[object ArrayBuffer]"?1:-1),c(),f(e.buffer?2:3)}}function mn(n,r){if(n&1&&T(0,"p3xr-hex-monitor",24),n&2){let e=s(2);b("value",e.truncateDisplay(e.p3xrValue))("truncated",e.isTruncated(e.p3xrValue))}}function dn(n,r){n&1&&(o(0,"span",26),p(1,"..."),l())}function un(n,r){if(n&1&&(o(0,"span",25),p(1),y(2,dn,2,0,"span",26),l()),n&2){let e=s(2);c(),h(e.truncateDisplay(e.formatValue(e.p3xrValue))),c(),f(e.isTruncated(e.p3xrValue)?2:-1)}}function _n(n,r){if(n&1){let e=C();o(0,"div",23),_("click",function(){d(e);let t=s();return u(t.edit())}),y(1,mn,1,2,"p3xr-hex-monitor",24)(2,un,3,2,"span",25),l()}if(n&2){let e=s();re("overflow",e.valueFormat==="hex"?"visible":"auto"),c(),f(e.valueFormat==="hex"?1:2)}}var ei=(()=>{class n extends ee{jsonEditorDialog;overlay;diffDialog;editable=!1;buffer=!1;validateJson=!1;originalValue;constructor(e,i,t,a,m,x,v,k,S,V,F,I,ne){super(e,i,t,a,m,x,v,S,V,F),this.jsonEditorDialog=k,this.overlay=I,this.diffDialog=ne}ngOnInit(){}showDigest(){return w(this,null,function*(){try{let e=yield this.socket.request({action:"key/string-digest",payload:{key:this.p3xrKey}});this.common.toast(e.digest||"No digest")}catch(e){this.common.generalHandleError(e)}})}edit(){let e=this.p3xrValue;typeof e=="string"&&e.length>=this.maxValueAsBuffer?(this.buffer=!0,this.originalValue=structuredClone(this.p3xrValueBuffer)):(this.buffer=!1,this.originalValue=structuredClone(this.p3xrValue)),this.editable=!0}cancelEdit(){this.buffer?this.p3xrValueBuffer=this.originalValue:this.p3xrValue=this.originalValue,this.editable=!1,this.buffer=!1}save(){return w(this,null,function*(){let e=this.buffer?this.p3xrValueBuffer:this.p3xrValue,i=this.originalValue;try{if(this.validateJson&&JSON.parse(e),i!==void 0&&!(yield this.diffDialog.show({keyName:this.p3xrKey,oldValue:i,newValue:e})))return;this.overlay.show({message:this.strings?.intention?.save??"Saving..."}),yield this.socket.request({action:"key/set",payload:{type:this.p3xrResponse?.type,key:this.p3xrKey,value:e}}),this.gtag("/key-set"),this.editable=!1,this.buffer=!1,this.refreshKey(),this.overlay.hide(),this.settingsService.undoEnabled()&&i!==void 0&&i!==e&&(yield this.common.toastWithUndo(this.strings?.status?.saved))&&(this.overlay.show({message:"Undo..."}),yield this.socket.request({action:"key/set",payload:{type:this.p3xrResponse?.type,key:this.p3xrKey,value:i}}),this.refreshKey(),this.overlay.hide(),this.common.toast(this.strings?.status?.reverted))}catch(t){this.common.generalHandleError(t),this.overlay.hide()}})}setBufferUpload(){return w(this,null,function*(){let e=document.createElement("input");e.type="file",e.onchange=()=>w(this,null,function*(){let i=e.files?.[0];if(!i)return;let t=new FileReader;t.onerror=a=>{this.common.generalHandleError(a)},t.onload=a=>w(this,null,function*(){let m=a.target.result;try{if(this.editable){yield this.common.confirm({message:this.i18n.strings().confirm?.uploadBuffer}),this.buffer?this.p3xrValueBuffer=m:this.p3xrValue=m,this.common.toast(this.i18n.strings().confirm?.uploadBufferDone);return}yield this.common.confirm({message:this.i18n.strings().confirm?.uploadBuffer}),this.overlay.show(),yield this.socket.request({action:"key/set",payload:{type:this.p3xrResponse?.type,value:m,key:this.p3xrKey}}),this.common.toast(this.i18n.strings().confirm?.uploadBufferDoneAndSave),this.gtag("/key-set"),this.refreshKey()}catch(x){this.common.generalHandleError(x)}finally{this.overlay.hide()}}),t.readAsArrayBuffer(i)}),e.click()})}jsonViewer(e){return w(this,null,function*(){yield this.showJson(this.p3xrValue,e)})}jsonEditor(){return w(this,null,function*(){try{let e=this.p3xrValue,i=yield this.jsonEditorDialog.show({value:this.p3xrValue});this.originalValue=void 0,this.overlay.show({message:this.strings?.intention?.save??"Saving..."}),yield this.socket.request({action:"key/set",payload:{type:this.p3xrResponse?.type,key:this.p3xrKey,value:i.obj}}),this.p3xrValue=i.obj,this.editable=!1,this.buffer=!1,this.refreshKey(),this.overlay.hide(),this.settingsService.undoEnabled()&&e!==void 0&&e!==i.obj&&(yield this.common.toastWithUndo(this.strings?.status?.saved))&&(this.overlay.show({message:"Undo..."}),yield this.socket.request({action:"key/set",payload:{type:this.p3xrResponse?.type,key:this.p3xrKey,value:e}}),this.refreshKey(),this.overlay.hide(),this.common.toast(this.strings?.status?.reverted))}catch(e){}})}formatJson(){return w(this,null,function*(){try{this.p3xrValue=JSON.stringify(JSON.parse(this.p3xrValue),null,this.settingsService.jsonFormat()??2),yield this.save()}catch(e){this.common.toast(this.strings?.label?.jsonViewNotParsable??"Not valid JSON")}})}copyValue(){this.copy(this.p3xrValue)}downloadBufferFile(){this.downloadBuffer(this.p3xrValueBuffer)}bufferDisplay(){return this.p3xrValueBuffer?.byteLength!==void 0?"("+this.prettyBytes(this.p3xrValueBuffer.byteLength)+")":""}static \u0275fac=function(i){return new(i||n)(g(R),g(z),g($),g(Z),g(X),g(O),g(H),g(Qe),g(B),g(W),g(N),g(Ue),g(Ge))};static \u0275cmp=D({type:n,selectors:[["p3xr-key-string"]],features:[Y],decls:5,vars:3,consts:[[1,"p3xr-key-type-actions"],[1,"p3xr-key-type-content"],["appearance","fill",1,"p3xr-key-type-editor"],[1,"p3xr-key-type-display",2,"cursor","pointer","max-width","100%",3,"overflow"],["mat-raised-button","","type","button",1,"btn-accent","p3xr-action-btn"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-accent",3,"matTooltip"],["mat-raised-button","","type","button",1,"btn-primary","p3xr-action-btn"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-primary",3,"matTooltip"],["mat-raised-button","","type","button",1,"btn-primary","p3xr-action-btn",3,"click"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-primary",3,"click","matTooltip"],["mat-raised-button","","type","button",1,"btn-accent","p3xr-action-btn",3,"click"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-accent",3,"click","matTooltip"],["mat-mini-fab","","type","button","matTooltip","Digest","matTooltipPosition","above",1,"btn-accent"],["mat-mini-fab","","type","button","matTooltip","Digest","matTooltipPosition","above",1,"btn-accent",3,"click"],[1,"btn-accent",2,"margin-right","8px",3,"ngModel"],["mat-raised-button","","type","button",1,"btn-warn","p3xr-action-btn"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-warn",3,"matTooltip"],[1,"btn-accent",2,"margin-right","8px",3,"ngModelChange","ngModel"],["mat-raised-button","","type","button",1,"btn-warn","p3xr-action-btn",3,"click"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-warn",3,"click","matTooltip"],[1,"p3xr-key-type-buffer-info"],["matInput","","cdkTextareaAutosize","","cdkAutosizeMinRows","4",3,"ngModel"],["matInput","","cdkTextareaAutosize","","cdkAutosizeMinRows","4",3,"ngModelChange","ngModel"],[1,"p3xr-key-type-display",2,"cursor","pointer","max-width","100%",3,"click"],[3,"value","truncated"],[1,"p3xr-pre",2,"word-break","break-all","white-space","pre-wrap"],[2,"opacity","0.5"]],template:function(i,t){i&1&&(y(0,Gi,13,8,"div",0),y(1,an,6,4,"div",0),o(2,"div",1),y(3,pn,4,2,"mat-form-field",2)(4,_n,3,3,"div",3),l()),i&2&&(f(t.editable?-1:0),c(),f(t.editable?1:-1),c(2),f(t.editable?3:4))},dependencies:[A,U,Te,me,de,q,ce,pe,Q,G,J,L,Ot,At,Ie,Ve,we,Pt,Se,jt,ue],encapsulation:2})}return n})();var ae=class{page=1;pages=1;zsetMode;settingsService;constructor(r){this.zsetMode=r?.zsetMode??!1,this.settingsService=r?.settingsService}figurePaging(r){let e=this.settingsService?.keyPageCount()??50,i=this.zsetMode?Math.ceil(r/2):r;this.pages=Math.max(Math.ceil(i/e),1),this.page>this.pages?this.page=this.pages:this.page<1&&(this.page=1)}get pageCount(){return this.settingsService?.keyPageCount()??50}get startIndex(){return this.pageCount*(this.page-1)}get endIndex(){return this.startIndex+this.pageCount}pager(r){switch(r){case"first":this.page=1;break;case"prev":this.page>1&&this.page--;break;case"next":this.page<this.pages&&this.page++;break;case"last":this.page=this.pages;break}}pageChange(){this.page<1&&(this.page=1),this.page>this.pages&&(this.page=this.pages)}};function gn(n,r){if(n&1){let e=C();o(0,"div",0)(1,"button",1),_("click",function(){d(e);let t=s();return t.paging.pager("first"),u(t.pageChanged.emit())}),o(2,"span",2),p(3,"skip_previous"),l()(),o(4,"button",1),_("click",function(){d(e);let t=s();return t.paging.pager("prev"),u(t.pageChanged.emit())}),o(5,"span",2),p(6,"keyboard_arrow_left"),l()(),o(7,"p3xr-ng-input",3),_("ngModelChange",function(t){d(e);let a=s();return u(a.onPageChange(t))}),l(),o(8,"span",4),p(9),l(),o(10,"button",1),_("click",function(){d(e);let t=s();return t.paging.pager("next"),u(t.pageChanged.emit())}),o(11,"span",2),p(12,"keyboard_arrow_right"),l()(),o(13,"button",1),_("click",function(){d(e);let t=s();return t.paging.pager("last"),u(t.pageChanged.emit())}),o(14,"span",2),p(15,"skip_next"),l()()()}if(n&2){let e=s();c(),b("matTooltip",(e.strings==null||e.strings.page==null||e.strings.page.treeControls==null||e.strings.page.treeControls.pager==null?null:e.strings.page.treeControls.pager.first)??"First"),c(3),b("matTooltip",(e.strings==null||e.strings.page==null||e.strings.page.treeControls==null||e.strings.page.treeControls.pager==null?null:e.strings.page.treeControls.pager.prev)??"Previous"),c(3),b("max",""+e.paging.pages)("ngModel",e.paging.page),c(2),ie("/ ",e.paging.pages),c(),b("matTooltip",(e.strings==null||e.strings.page==null||e.strings.page.treeControls==null||e.strings.page.treeControls.pager==null?null:e.strings.page.treeControls.pager.next)??"Next"),c(3),b("matTooltip",(e.strings==null||e.strings.page==null||e.strings.page.treeControls==null||e.strings.page.treeControls.pager==null?null:e.strings.page.treeControls.pager.last)??"Last")}}var _e=(()=>{class n{i18n;paging;pageChanged=new ut;constructor(e){this.i18n=e}get strings(){return this.i18n.strings()}onPageChange(e){this.paging.page=e,this.paging.pageChange(),this.pageChanged.emit()}static \u0275fac=function(i){return new(i||n)(g(R))};static \u0275cmp=D({type:n,selectors:[["p3xr-key-pager-inline"]],inputs:{paging:"paging"},outputs:{pageChanged:"pageChanged"},decls:1,vars:1,consts:[[1,"p3xr-key-pager-inline"],["type","button",1,"p3xr-key-pager-btn",3,"click","matTooltip"],[1,"material-icons"],["type","number","step","1","min","1",1,"p3xr-key-pager-input",3,"ngModelChange","max","ngModel"],[1,"p3xr-key-pager-text"]],template:function(i,t){i&1&&y(0,gn,16,7,"div",0),i&2&&f(t.paging.pages>1?0:-1)},dependencies:[A,U,me,de,J,L,Wt],styles:[".p3xr-key-pager-inline[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;padding:4px 0}.p3xr-key-pager-btn[_ngcontent-%COMP%]{background:none;border:none;color:var(--p3xr-input-border-color, var(--p3xr-border-color));cursor:pointer;display:inline-flex;align-items:center;justify-content:center;height:28px;width:28px;margin:0;padding:0}.p3xr-key-pager-btn[_ngcontent-%COMP%]:focus{outline:none}.p3xr-key-pager-btn[_ngcontent-%COMP%] .material-icons[_ngcontent-%COMP%]{font-size:24px}[_nghost-%COMP%] p3xr-ng-input.p3xr-key-pager-input{vertical-align:middle!important;width:64px;margin:0 4px}.p3xr-key-pager-text[_ngcontent-%COMP%]{margin:0 4px;color:var(--p3xr-input-color, inherit)}"]})}return n})();var ti=et(Ut());var xn=(n,r)=>r.key;function yn(n,r){if(n&1){let e=C();o(0,"button",8),_("click",function(t){d(e);let a=s();return u(a.addHash(t))}),o(1,"mat-icon"),p(2,"add"),l()()}}function fn(n,r){if(n&1&&T(0,"p3xr-hex-monitor",11),n&2){let e=s().$implicit,i=s();b("value",i.truncateDisplay(e.value))("truncated",i.isTruncated(e.value))}}function hn(n,r){n&1&&(o(0,"span",19),p(1,"..."),l())}function Cn(n,r){if(n&1&&(p(0),y(1,hn,2,0,"span",19)),n&2){let e=s().$implicit,i=s();h(i.truncateDisplay(i.formatValue(e.value))),c(),f(i.isTruncated(e.value)?1:-1)}}function bn(n,r){if(n&1){let e=C();o(0,"mat-icon",20),_("click",function(t){d(e);let a=s().$implicit,m=s();return u(m.setFieldTtl(a.key,t))}),p(1,"schedule"),l()}if(n&2){let e=s().$implicit,i=s();re("color",i.getFieldTtlColor(e.key)||null)("opacity",i.hasFieldTtl(e.key)?.7:.3),le("p3xr-tree-ttl-pulse",i.isFieldTtlPulsing(e.key)),b("matTooltip",i.hasFieldTtl(e.key)?"TTL: "+i.formatFieldTtl(e.key):i.strings==null||i.strings.intention==null?null:i.strings.intention.ttl)}}function vn(n,r){if(n&1){let e=C();o(0,"mat-icon",21),_("click",function(t){d(e);let a=s().$implicit,m=s();return u(m.deleteHashKey(a.key,t))}),p(1,"delete"),l()}}function kn(n,r){if(n&1){let e=C();o(0,"mat-icon",22),_("click",function(t){d(e);let a=s().$implicit,m=s();return u(m.editValue(a.key,a.value,t))}),p(1,"edit"),l()}}function wn(n,r){if(n&1){let e=C();o(0,"div",7)(1,"span",9),_("click",function(t){let a=d(e).$implicit,m=s();return u(m.editValue(a.key,a.value,t))}),p(2),l(),o(3,"span",10),_("click",function(t){let a=d(e).$implicit,m=s();return u(m.editValue(a.key,a.value,t))}),y(4,fn,1,2,"p3xr-hex-monitor",11)(5,Cn,2,2),l(),o(6,"span",12),y(7,bn,2,7,"mat-icon",13),y(8,vn,2,0,"mat-icon",14),o(9,"mat-icon",15),_("click",function(t){let a=d(e).$implicit,m=s();return u(m.showJsonItem(a.value,t))}),p(10,"account_tree"),l(),o(11,"mat-icon",16),_("click",function(){let t=d(e).$implicit,a=s();return u(a.copyItem(t.value))}),p(12,"content_copy"),l(),o(13,"mat-icon",17),_("click",function(){let t=d(e).$implicit,a=s();return u(a.downloadItem(t.key))}),p(14,"download"),l(),y(15,kn,2,0,"mat-icon",18),l()()}if(n&2){let e=r.$implicit,i=s();c(2),h(e.key),c(),le("p3xr-pre",i.valueFormat!=="hex"),c(),f(i.valueFormat==="hex"?4:5),c(3),f(!i.isReadonly&&i.redisState.redisVersion().isAtLeast(8,0)?7:-1),c(),f(i.isReadonly?-1:8),c(7),f(i.isReadonly?-1:15)}}var ii=(()=>{class n extends ee{ttlDialog;paging;pagedItems=[];fieldTtls={};fieldTtlsFetchedAt=0;ttlCountdownInterval=null;constructor(e,i,t,a,m,x,v,k,S,V,F){super(e,i,t,a,m,x,v,k,S,V),this.ttlDialog=F,this.paging=new ae({settingsService:V})}ngOnInit(){this.updatePaging(),this.loadFieldTtls()}ngOnChanges(e){e.p3xrValue&&(this.updatePaging(),this.loadFieldTtls())}updatePaging(){this.p3xrValue&&(this.paging.figurePaging(Object.keys(this.p3xrValue).length),this.updatePagedItems())}updatePagedItems(){if(!this.p3xrValue){this.pagedItems=[];return}let e=Object.keys(this.p3xrValue);this.pagedItems=e.slice(this.paging.startIndex,this.paging.endIndex).map(i=>({key:i,value:this.p3xrValue[i]}))}addHash(e){return w(this,null,function*(){try{yield this.keyNewOrSetDialog.show({$event:e,type:"append",model:{type:"hash",key:this.p3xrKey}}),this.refreshKey()}catch(i){this.common.generalHandleError(i)}})}deleteHashKey(e,i){return w(this,null,function*(){try{yield this.common.confirm({message:this.i18n.strings().confirm?.deleteHashKey}),yield this.socket.request({action:"key/hash-delete-field",payload:{key:this.p3xrKey,hashKey:e}}),this.common.toast(this.i18n.strings().status?.deletedHashKey),this.refreshKey()}catch(t){this.common.generalHandleError(t)}})}editValue(e,i,t){return w(this,null,function*(){try{let a=typeof i=="string"&&i.length>=this.maxValueAsBuffer?this.p3xrValueBuffer[e]:i;yield this.keyNewOrSetDialog.show({$event:t,type:"edit",model:{type:"hash",key:this.p3xrKey,hashKey:e,value:a}}),this.refreshKey()}catch(a){this.common.generalHandleError(a)}})}ngOnDestroy(){this.clearTtlCountdown()}clearTtlCountdown(){this.ttlCountdownInterval&&(clearInterval(this.ttlCountdownInterval),this.ttlCountdownInterval=null)}startTtlCountdown(){this.clearTtlCountdown(),Object.values(this.fieldTtls).some(i=>i>0)&&(this.ttlCountdownInterval=setInterval(()=>{if(Object.keys(this.fieldTtls).some(t=>{let a=this.fieldTtls[t];if(!a||a<=0)return!1;let m=Math.floor((Date.now()-this.fieldTtlsFetchedAt)/1e3);return a-m<=0})){this.clearTtlCountdown(),this.refreshKey();return}this.cdr.markForCheck()},1e3))}getRemainingFieldTtl(e){let i=this.fieldTtls[e];if(!i||i<=0)return-1;let t=Math.floor((Date.now()-this.fieldTtlsFetchedAt)/1e3),a=i-t;return a>0?a:-1}loadFieldTtls(){return w(this,null,function*(){if(!(!this.redisState.redisVersion().isAtLeast(8,0)||!this.pagedItems.length))try{let e=this.pagedItems.map(t=>t.key);if(e.length===0)return;let i=yield this.socket.request({action:"hash-field/ttls",payload:{key:this.p3xrKey,fields:e}});this.fieldTtls=i.fieldTtls||{},this.fieldTtlsFetchedAt=Date.now(),this.startTtlCountdown(),this.cdr.markForCheck()}catch(e){this.fieldTtls={}}})}getFieldTtlColor(e){let i=this.getRemainingFieldTtl(e);return i<=0?"":i<300?"var(--mat-sys-error, #f44336)":i<3600?"var(--mat-sys-tertiary, #ff9800)":"#4caf50"}isFieldTtlPulsing(e){let i=this.getRemainingFieldTtl(e);return i>0&&i<30}hasFieldTtl(e){return this.getRemainingFieldTtl(e)>0}formatFieldTtl(e){let i=this.getRemainingFieldTtl(e);if(i<=0)return"";let t=this.settingsService.getHumanizeDurationOptions();return(0,ti.default)(i*1e3,Ke(Ee({},t),{largest:2,round:!0,delimiter:" "}))}setFieldTtl(e,i){return w(this,null,function*(){try{let a=(yield this.socket.request({action:"hash-field/ttl-get",payload:{key:this.p3xrKey,field:e}})).ttl??-1,m=yield this.ttlDialog.show({$event:i,model:{ttl:a}});yield this.socket.request({action:"hash-field/ttl",payload:{key:this.p3xrKey,field:e,ttl:m.model.ttl}}),this.common.toast(`${e}: TTL ${m.model.ttl===-1?"removed":m.model.ttl+"s"}`),this.loadFieldTtls()}catch(t){t!==void 0&&this.common.generalHandleError(t)}})}copyItem(e){this.copy(e)}showJsonItem(e,i){this.showJson(e,i)}downloadItem(e){this.downloadBuffer(this.p3xrValueBuffer[e],`${this.p3xrKey}-${e}`)}static \u0275fac=function(i){return new(i||n)(g(R),g(z),g($),g(Z),g(X),g(O),g(H),g(B),g(W),g(N),g(Ze))};static \u0275cmp=D({type:n,selectors:[["p3xr-key-hash"]],features:[Y,te],decls:11,vars:4,consts:[[3,"pageChanged","paging"],[1,"p3xr-key-type-table"],[1,"p3xr-key-type-header"],[2,"flex","20%"],[2,"flex","60%"],[2,"flex","20%","text-align","right"],["mat-icon-button","","matTooltip","Add"],[1,"p3xr-key-type-row"],["mat-icon-button","","matTooltip","Add",3,"click"],[1,"p3xr-key-col",2,"flex","20%","cursor","pointer",3,"click"],[1,"p3xr-value-col",2,"flex","60%","cursor","pointer",3,"click"],[3,"value","truncated"],[1,"p3xr-key-type-row-actions",2,"flex","20%","text-align","right"],[3,"color","opacity","p3xr-tree-ttl-pulse","matTooltip"],["matTooltip","Delete",1,"icon-warn"],["matTooltip","JSON",1,"icon-accent",3,"click"],["matTooltip","Copy",1,"icon-accent",3,"click"],["matTooltip","Download",1,"icon-accent",3,"click"],["matTooltip","Edit",1,"icon-primary"],[2,"opacity","0.5"],[3,"click","matTooltip"],["matTooltip","Delete",1,"icon-warn",3,"click"],["matTooltip","Edit",1,"icon-primary",3,"click"]],template:function(i,t){i&1&&(o(0,"p3xr-key-pager-inline",0),_("pageChanged",function(){return t.updatePagedItems(),t.loadFieldTtls()}),l(),o(1,"div",1)(2,"div",2)(3,"span",3),p(4),l(),o(5,"span",4),p(6),l(),o(7,"span",5),y(8,yn,3,0,"button",6),l()(),P(9,wn,16,7,"div",7,xn),l()),i&2&&(b("paging",t.paging),c(4),h(t.strings==null||t.strings.page==null||t.strings.page.key==null||t.strings.page.key.hash==null||t.strings.page.key.hash.table==null?null:t.strings.page.key.hash.table.hashkey),c(2),h(t.strings==null||t.strings.page==null||t.strings.page.key==null||t.strings.page.key.hash==null||t.strings.page.key.hash.table==null?null:t.strings.page.key.hash.table.value),c(2),f(t.isReadonly?-1:8),c(),j(t.pagedItems))},dependencies:[A,U,q,se,Q,G,J,L,_e,ue],encapsulation:2})}return n})();var Sn=(n,r)=>r.index;function Tn(n,r){if(n&1){let e=C();o(0,"button",8),_("click",function(t){d(e);let a=s();return u(a.appendValue(t))}),o(1,"mat-icon"),p(2,"add"),l()()}}function Vn(n,r){if(n&1&&T(0,"p3xr-hex-monitor",11),n&2){let e=s().$implicit,i=s();b("value",i.truncateDisplay(e.value))("truncated",i.isTruncated(e.value))}}function In(n,r){n&1&&(o(0,"span",18),p(1,"..."),l())}function En(n,r){if(n&1&&(p(0),y(1,In,2,0,"span",18)),n&2){let e=s().$implicit,i=s();h(i.truncateDisplay(i.formatValue(e.value))),c(),f(i.isTruncated(e.value)?1:-1)}}function Kn(n,r){if(n&1){let e=C();o(0,"mat-icon",19),_("click",function(t){d(e);let a=s().$implicit,m=s();return u(m.deleteListElement(a.index,t))}),p(1,"delete"),l()}}function Mn(n,r){if(n&1){let e=C();o(0,"mat-icon",20),_("click",function(t){d(e);let a=s().$implicit,m=s();return u(m.editValue(a.index,a.value,t))}),p(1,"edit"),l()}}function Fn(n,r){if(n&1){let e=C();o(0,"div",7)(1,"span",9),_("click",function(t){let a=d(e).$implicit,m=s();return u(m.editValue(a.index,a.value,t))}),p(2),l(),o(3,"span",10),_("click",function(t){let a=d(e).$implicit,m=s();return u(m.editValue(a.index,a.value,t))}),y(4,Vn,1,2,"p3xr-hex-monitor",11)(5,En,2,2),l(),o(6,"span",12),y(7,Kn,2,0,"mat-icon",13),o(8,"mat-icon",14),_("click",function(t){let a=d(e).$implicit,m=s();return u(m.showJsonItem(a.value,t))}),p(9,"account_tree"),l(),o(10,"mat-icon",15),_("click",function(){let t=d(e).$implicit,a=s();return u(a.copyItem(t.value))}),p(11,"content_copy"),l(),o(12,"mat-icon",16),_("click",function(){let t=d(e).$implicit,a=s();return u(a.downloadItem(t.index))}),p(13,"download"),l(),y(14,Mn,2,0,"mat-icon",17),l()()}if(n&2){let e=r.$implicit,i=s();c(2),h(e.index),c(),le("p3xr-pre",i.valueFormat!=="hex"),c(),f(i.valueFormat==="hex"?4:5),c(3),f(i.isReadonly?-1:7),c(7),f(i.isReadonly?-1:14)}}var ni=(()=>{class n extends ee{paging;pagedItems=[];constructor(e,i,t,a,m,x,v,k,S,V){super(e,i,t,a,m,x,v,k,S,V),this.paging=new ae({settingsService:V})}ngOnInit(){this.updatePaging()}ngOnChanges(e){e.p3xrValue&&this.updatePaging()}updatePaging(){this.p3xrValue&&(this.paging.figurePaging(this.p3xrValue.length),this.updatePagedItems())}updatePagedItems(){if(!this.p3xrValue){this.pagedItems=[];return}this.pagedItems=this.p3xrValue.slice(this.paging.startIndex,this.paging.endIndex).map((e,i)=>({index:this.paging.startIndex+i,value:e}))}appendValue(e){return w(this,null,function*(){try{yield this.keyNewOrSetDialog.show({$event:e,type:"append",model:{type:"list",key:this.p3xrKey}}),this.refreshKey()}catch(i){this.common.generalHandleError(i)}})}deleteListElement(e,i){return w(this,null,function*(){try{yield this.common.confirm({message:this.i18n.strings().confirm?.deleteListItem??this.i18n.strings().confirm?.areYouSure??"Are you sure?"}),yield this.socket.request({action:"key/list-delete-index",payload:{key:this.p3xrKey,index:e}}),this.common.toast(this.i18n.strings().status?.deletedListElement),this.refreshKey()}catch(t){this.common.generalHandleError(t)}})}editValue(e,i,t){return w(this,null,function*(){try{let a=typeof i=="string"&&i.length>=this.maxValueAsBuffer?this.p3xrValueBuffer[e]:i;yield this.keyNewOrSetDialog.show({$event:t,type:"edit",model:{type:"list",key:this.p3xrKey,index:e,value:a}}),this.refreshKey()}catch(a){this.common.generalHandleError(a)}})}copyItem(e){this.copy(e)}showJsonItem(e,i){this.showJson(e,i)}downloadItem(e){this.downloadBuffer(this.p3xrValueBuffer[e])}static \u0275fac=function(i){return new(i||n)(g(R),g(z),g($),g(Z),g(X),g(O),g(H),g(B),g(W),g(N))};static \u0275cmp=D({type:n,selectors:[["p3xr-key-list"]],features:[Y,te],decls:11,vars:4,consts:[[3,"pageChanged","paging"],[1,"p3xr-key-type-table"],[1,"p3xr-key-type-header"],[2,"flex","20%"],[2,"flex","60%"],[2,"flex","20%","text-align","right"],["mat-icon-button","","matTooltip","Add"],[1,"p3xr-key-type-row"],["mat-icon-button","","matTooltip","Add",3,"click"],[1,"p3xr-key-col",2,"flex","20%","cursor","pointer",3,"click"],[1,"p3xr-value-col",2,"flex","60%","cursor","pointer",3,"click"],[3,"value","truncated"],[1,"p3xr-key-type-row-actions",2,"flex","20%","text-align","right"],["matTooltip","Delete",1,"icon-warn"],["matTooltip","JSON",1,"icon-accent",3,"click"],["matTooltip","Copy",1,"icon-accent",3,"click"],["matTooltip","Download",1,"icon-accent",3,"click"],["matTooltip","Edit",1,"icon-primary"],[2,"opacity","0.5"],["matTooltip","Delete",1,"icon-warn",3,"click"],["matTooltip","Edit",1,"icon-primary",3,"click"]],template:function(i,t){i&1&&(o(0,"p3xr-key-pager-inline",0),_("pageChanged",function(){return t.updatePagedItems()}),l(),o(1,"div",1)(2,"div",2)(3,"span",3),p(4),l(),o(5,"span",4),p(6),l(),o(7,"span",5),y(8,Tn,3,0,"button",6),l()(),P(9,Fn,15,6,"div",7,Sn),l()),i&2&&(b("paging",t.paging),c(4),h(t.strings==null||t.strings.page==null||t.strings.page.key==null||t.strings.page.key.list==null||t.strings.page.key.list.table==null?null:t.strings.page.key.list.table.index),c(2),h(t.strings==null||t.strings.page==null||t.strings.page.key==null||t.strings.page.key.list==null||t.strings.page.key.list.table==null?null:t.strings.page.key.list.table.value),c(2),f(t.isReadonly?-1:8),c(),j(t.pagedItems))},dependencies:[A,U,q,se,Q,G,J,L,_e,ue],encapsulation:2})}return n})();var Dn=(n,r)=>r.index;function Bn(n,r){if(n&1){let e=C();o(0,"button",7),_("click",function(t){d(e);let a=s();return u(a.addSet(t))}),o(1,"mat-icon"),p(2,"add"),l()()}}function Rn(n,r){if(n&1&&T(0,"p3xr-hex-monitor",9),n&2){let e=s().$implicit,i=s();b("value",i.truncateDisplay(e.value))("truncated",i.isTruncated(e.value))}}function Pn(n,r){n&1&&(o(0,"span",16),p(1,"..."),l())}function jn(n,r){if(n&1&&(p(0),y(1,Pn,2,0,"span",16)),n&2){let e=s().$implicit,i=s();h(i.truncateDisplay(i.formatValue(e.value))),c(),f(i.isTruncated(e.value)?1:-1)}}function An(n,r){if(n&1){let e=C();o(0,"mat-icon",17),_("click",function(t){d(e);let a=s().$implicit,m=s();return u(m.deleteSetMember(a.index,t))}),p(1,"delete"),l()}}function On(n,r){if(n&1){let e=C();o(0,"mat-icon",18),_("click",function(t){d(e);let a=s().$implicit,m=s();return u(m.editValue(a.index,a.value,t))}),p(1,"edit"),l()}}function Ln(n,r){if(n&1){let e=C();o(0,"div",6)(1,"span",8),_("click",function(t){let a=d(e).$implicit,m=s();return u(m.editValue(a.index,a.value,t))}),y(2,Rn,1,2,"p3xr-hex-monitor",9)(3,jn,2,2),l(),o(4,"span",10),y(5,An,2,0,"mat-icon",11),o(6,"mat-icon",12),_("click",function(t){let a=d(e).$implicit,m=s();return u(m.showJsonItem(a.value,t))}),p(7,"account_tree"),l(),o(8,"mat-icon",13),_("click",function(){let t=d(e).$implicit,a=s();return u(a.copyItem(t.value))}),p(9,"content_copy"),l(),o(10,"mat-icon",14),_("click",function(){let t=d(e).$implicit,a=s();return u(a.downloadItem(t.index))}),p(11,"download"),l(),y(12,On,2,0,"mat-icon",15),l()()}if(n&2){let e=s();c(),le("p3xr-pre",e.valueFormat!=="hex"),c(),f(e.valueFormat==="hex"?2:3),c(3),f(e.isReadonly?-1:5),c(7),f(e.isReadonly?-1:12)}}var oi=(()=>{class n extends ee{paging;pagedItems=[];constructor(e,i,t,a,m,x,v,k,S,V){super(e,i,t,a,m,x,v,k,S,V),this.paging=new ae({settingsService:V})}ngOnInit(){this.updatePaging()}ngOnChanges(e){e.p3xrValue&&this.updatePaging()}updatePaging(){this.p3xrValue&&(this.paging.figurePaging(this.p3xrValue.length),this.updatePagedItems())}updatePagedItems(){if(!this.p3xrValue){this.pagedItems=[];return}this.pagedItems=this.p3xrValue.slice(this.paging.startIndex,this.paging.endIndex).map((e,i)=>({index:this.paging.startIndex+i,value:e}))}addSet(e){return w(this,null,function*(){try{yield this.keyNewOrSetDialog.show({$event:e,type:"append",model:{type:"set",key:this.p3xrKey}}),this.refreshKey()}catch(i){this.common.generalHandleError(i)}})}deleteSetMember(e,i){return w(this,null,function*(){try{yield this.common.confirm({message:this.i18n.strings().confirm?.deleteSetMember}),yield this.socket.request({action:"key/set-delete-member",payload:{key:this.p3xrKey,value:this.p3xrValueBuffer[e]}}),this.common.toast(this.i18n.strings().status?.deletedSetMember),this.refreshKey()}catch(t){this.common.generalHandleError(t)}})}editValue(e,i,t){return w(this,null,function*(){try{let a=typeof i=="string"&&i.length>=this.maxValueAsBuffer?this.p3xrValueBuffer[e]:i;yield this.keyNewOrSetDialog.show({$event:t,type:"edit",model:{type:"set",key:this.p3xrKey,value:a}}),this.refreshKey()}catch(a){this.common.generalHandleError(a)}})}copyItem(e){this.copy(e)}showJsonItem(e,i){this.showJson(e,i)}downloadItem(e){this.downloadBuffer(this.p3xrValueBuffer[e])}static \u0275fac=function(i){return new(i||n)(g(R),g(z),g($),g(Z),g(X),g(O),g(H),g(B),g(W),g(N))};static \u0275cmp=D({type:n,selectors:[["p3xr-key-set"]],features:[Y,te],decls:9,vars:3,consts:[[3,"pageChanged","paging"],[1,"p3xr-key-type-table"],[1,"p3xr-key-type-header"],[2,"flex","95%"],[2,"flex","5%","text-align","right"],["mat-icon-button","","matTooltip","Add"],[1,"p3xr-key-type-row"],["mat-icon-button","","matTooltip","Add",3,"click"],[1,"p3xr-value-col",2,"flex","95%","cursor","pointer",3,"click"],[3,"value","truncated"],[1,"p3xr-key-type-row-actions",2,"flex","5%","text-align","right"],["matTooltip","Delete",1,"icon-warn"],["matTooltip","JSON",1,"icon-accent",3,"click"],["matTooltip","Copy",1,"icon-accent",3,"click"],["matTooltip","Download",1,"icon-accent",3,"click"],["matTooltip","Edit",1,"icon-primary"],[2,"opacity","0.5"],["matTooltip","Delete",1,"icon-warn",3,"click"],["matTooltip","Edit",1,"icon-primary",3,"click"]],template:function(i,t){i&1&&(o(0,"p3xr-key-pager-inline",0),_("pageChanged",function(){return t.updatePagedItems()}),l(),o(1,"div",1)(2,"div",2)(3,"span",3),p(4),l(),o(5,"span",4),y(6,Bn,3,0,"button",5),l()(),P(7,Ln,13,5,"div",6,Dn),l()),i&2&&(b("paging",t.paging),c(4),h(t.strings==null||t.strings.page==null||t.strings.page.key==null||t.strings.page.key.set==null||t.strings.page.key.set.table==null?null:t.strings.page.key.set.table.value),c(2),f(t.isReadonly?-1:6),c(),j(t.pagedItems))},dependencies:[A,U,q,se,Q,G,J,L,_e,ue],encapsulation:2})}return n})();var Jn=(n,r)=>r.index;function Nn(n,r){if(n&1){let e=C();o(0,"button",8),_("click",function(t){d(e);let a=s();return u(a.addZSet(t))}),o(1,"mat-icon"),p(2,"add"),l()()}}function Wn(n,r){if(n&1&&T(0,"p3xr-hex-monitor",11),n&2){let e=s().$implicit,i=s();b("value",i.truncateDisplay(e.member))("truncated",i.isTruncated(e.member))}}function zn(n,r){n&1&&(o(0,"span",18),p(1,"..."),l())}function $n(n,r){if(n&1&&(p(0),y(1,zn,2,0,"span",18)),n&2){let e=s().$implicit,i=s();h(i.truncateDisplay(i.formatValue(e.member))),c(),f(i.isTruncated(e.member)?1:-1)}}function Hn(n,r){if(n&1){let e=C();o(0,"mat-icon",19),_("click",function(t){d(e);let a=s().$implicit,m=s();return u(m.deleteZSet(a,t))}),p(1,"delete"),l()}}function qn(n,r){if(n&1){let e=C();o(0,"mat-icon",20),_("click",function(t){d(e);let a=s().$implicit,m=s();return u(m.editValue(a,t))}),p(1,"edit"),l()}}function Un(n,r){if(n&1){let e=C();o(0,"div",7)(1,"span",9),_("click",function(t){let a=d(e).$implicit,m=s();return u(m.editValue(a,t))}),p(2),l(),o(3,"span",10),_("click",function(t){let a=d(e).$implicit,m=s();return u(m.editValue(a,t))}),y(4,Wn,1,2,"p3xr-hex-monitor",11)(5,$n,2,2),l(),o(6,"span",12),y(7,Hn,2,0,"mat-icon",13),o(8,"mat-icon",14),_("click",function(t){let a=d(e).$implicit,m=s();return u(m.showJsonItem(a.member,t))}),p(9,"account_tree"),l(),o(10,"mat-icon",15),_("click",function(){let t=d(e).$implicit,a=s();return u(a.copyItem(t.member))}),p(11,"content_copy"),l(),o(12,"mat-icon",16),_("click",function(){let t=d(e).$implicit,a=s();return u(a.downloadItem(t.index))}),p(13,"download"),l(),y(14,qn,2,0,"mat-icon",17),l()()}if(n&2){let e=r.$implicit,i=s();c(2),h(e.score),c(),le("p3xr-pre",i.valueFormat!=="hex"),c(),f(i.valueFormat==="hex"?4:5),c(3),f(i.isReadonly?-1:7),c(7),f(i.isReadonly?-1:14)}}var ri=(()=>{class n extends ee{paging;pagedItems=[];constructor(e,i,t,a,m,x,v,k,S,V){super(e,i,t,a,m,x,v,k,S,V),this.paging=new ae({zsetMode:!0,settingsService:V})}ngOnInit(){this.updatePaging()}ngOnChanges(e){e.p3xrValue&&this.updatePaging()}updatePaging(){this.p3xrValue&&(this.paging.figurePaging(this.p3xrValue.length),this.updatePagedItems())}updatePagedItems(){if(!this.p3xrValue){this.pagedItems=[];return}let e=[];for(let i=0;i<this.p3xrValue.length;i+=2)e.push({member:this.p3xrValue[i],score:this.p3xrValue[i+1],index:i/2});this.pagedItems=e.slice(this.paging.startIndex,this.paging.endIndex)}addZSet(e){return w(this,null,function*(){try{yield this.keyNewOrSetDialog.show({$event:e,type:"append",model:{type:"zset",key:this.p3xrKey}}),this.refreshKey()}catch(i){this.common.generalHandleError(i)}})}deleteZSet(e,i){return w(this,null,function*(){try{yield this.common.confirm({message:this.i18n.strings().confirm?.deleteZSetMember}),yield this.socket.request({action:"key/zset-delete-member",payload:{key:this.p3xrKey,value:this.p3xrValueBuffer[e.index*2]}}),this.common.toast(this.i18n.strings().status?.deletedZSetMember),this.refreshKey()}catch(t){this.common.generalHandleError(t)}})}editValue(e,i){return w(this,null,function*(){try{let t=typeof e.member=="string"&&e.member.length>=this.maxValueAsBuffer?this.p3xrValueBuffer[e.index*2]:e.member;yield this.keyNewOrSetDialog.show({$event:i,type:"edit",model:{type:"zset",key:this.p3xrKey,value:t,score:e.score}}),this.refreshKey()}catch(t){this.common.generalHandleError(t)}})}copyItem(e){this.copy(e)}showJsonItem(e,i){this.showJson(e,i)}downloadItem(e){this.downloadBuffer(this.p3xrValueBuffer[e*2])}static \u0275fac=function(i){return new(i||n)(g(R),g(z),g($),g(Z),g(X),g(O),g(H),g(B),g(W),g(N))};static \u0275cmp=D({type:n,selectors:[["p3xr-key-zset"]],features:[Y,te],decls:11,vars:4,consts:[[3,"pageChanged","paging"],[1,"p3xr-key-type-table"],[1,"p3xr-key-type-header"],[2,"flex","20%"],[2,"flex","60%"],[2,"flex","20%","text-align","right"],["mat-icon-button","","matTooltip","Add"],[1,"p3xr-key-type-row"],["mat-icon-button","","matTooltip","Add",3,"click"],[1,"p3xr-key-col",2,"flex","20%","cursor","pointer",3,"click"],[1,"p3xr-value-col",2,"flex","60%","cursor","pointer",3,"click"],[3,"value","truncated"],[1,"p3xr-key-type-row-actions",2,"flex","20%","text-align","right"],["matTooltip","Delete",1,"icon-warn"],["matTooltip","JSON",1,"icon-accent",3,"click"],["matTooltip","Copy",1,"icon-accent",3,"click"],["matTooltip","Download",1,"icon-accent",3,"click"],["matTooltip","Edit",1,"icon-primary"],[2,"opacity","0.5"],["matTooltip","Delete",1,"icon-warn",3,"click"],["matTooltip","Edit",1,"icon-primary",3,"click"]],template:function(i,t){i&1&&(o(0,"p3xr-key-pager-inline",0),_("pageChanged",function(){return t.updatePagedItems()}),l(),o(1,"div",1)(2,"div",2)(3,"span",3),p(4),l(),o(5,"span",4),p(6),l(),o(7,"span",5),y(8,Nn,3,0,"button",6),l()(),P(9,Un,15,6,"div",7,Jn),l()),i&2&&(b("paging",t.paging),c(4),h(t.strings==null||t.strings.page==null||t.strings.page.key==null||t.strings.page.key.zset==null||t.strings.page.key.zset.table==null?null:t.strings.page.key.zset.table.score),c(2),h(t.strings==null||t.strings.page==null||t.strings.page.key==null||t.strings.page.key.zset==null||t.strings.page.key.zset.table==null?null:t.strings.page.key.zset.table.value),c(2),f(t.isReadonly?-1:8),c(),j(t.pagedItems))},dependencies:[A,U,q,se,Q,G,J,L,_e,ue],encapsulation:2})}return n})();var Gn=(n,r)=>r.id,Qn=(n,r)=>r[0];function Zn(n,r){if(n&1){let e=C();o(0,"button",7),_("click",function(t){d(e);let a=s();return u(a.addStream(t))}),o(1,"mat-icon"),p(2,"add"),l()()}if(n&2){let e=s();b("matTooltip",(e.strings==null||e.strings.intention==null?null:e.strings.intention.add)??"Add")}}function Xn(n,r){if(n&1){let e=C();o(0,"mat-icon",16),_("click",function(t){d(e);let a=s().$implicit,m=s();return u(m.deleteStreamTimestamp(a.id,t))}),p(1,"delete"),l()}if(n&2){let e=s(2);b("matTooltip",(e.strings==null||e.strings.intention==null?null:e.strings.intention.delete)??"Delete")}}function Yn(n,r){if(n&1&&T(0,"p3xr-hex-monitor",19),n&2){let e=s().$implicit,i=s(2);b("value",i.truncateDisplay(e[1]))("truncated",i.isTruncated(e[1]))}}function eo(n,r){n&1&&(o(0,"span",20),p(1,"..."),l())}function to(n,r){if(n&1&&(p(0),y(1,eo,2,0,"span",20)),n&2){let e=s().$implicit,i=s(2);h(i.truncateDisplay(i.formatValue(e[1]))),c(),f(i.isTruncated(e[1])?1:-1)}}function io(n,r){if(n&1&&(o(0,"div",15)(1,"span",17),p(2),l(),o(3,"span",18),y(4,Yn,1,2,"p3xr-hex-monitor",19)(5,to,2,2),l()()),n&2){let e=r.$implicit,i=s(2);c(2),h(e[0]),c(),le("p3xr-pre",i.valueFormat!=="hex"),c(),f(i.valueFormat==="hex"?4:5)}}function no(n,r){if(n&1){let e=C();o(0,"div",6)(1,"div",8)(2,"span",9)(3,"strong"),p(4),l(),o(5,"span",10),p(6),l()(),o(7,"span",11),y(8,Xn,2,1,"mat-icon",12),o(9,"mat-icon",13),_("click",function(t){let a=d(e).$implicit,m=s();return u(m.viewEntryJson(a,t))}),p(10,"account_tree"),l(),o(11,"mat-icon",13),_("click",function(){let t=d(e).$implicit,a=s();return u(a.copyEntry(t))}),p(12,"content_copy"),l(),o(13,"mat-icon",13),_("click",function(){let t=d(e).$implicit,a=s();return u(a.downloadEntry(t))}),p(14,"download"),l()()(),o(15,"div",14),P(16,io,6,4,"div",15,Qn),l()()}if(n&2){let e=r.$implicit,i=s();c(4),h(e.id),c(2),h(i.showTimestamp(e.id)),c(2),f(i.isReadonly?-1:8),c(),b("matTooltip",(i.strings==null?null:i.strings.json)??"JSON"),c(2),b("matTooltip",(i.strings==null||i.strings.intention==null?null:i.strings.intention.copy)??"Copy"),c(2),b("matTooltip",(i.strings==null||i.strings.intention==null?null:i.strings.intention.downloadBuffer)??"Download"),c(3),j(e.fields)}}var oo={zn:"zh-CN",no:"nb",fil:"tl"},ai=(()=>{class n extends ee{paging;pagedEntries=[];allEntries=[];constructor(e,i,t,a,m,x,v,k,S,V){super(e,i,t,a,m,x,v,k,S,V),this.paging=new ae({settingsService:V}),ze(()=>{this.i18n.strings(),this.allEntries.length!==0&&(this.allEntries=this.allEntries.map(F=>Ke(Ee({},F),{displayData:this.toDisplayData(F.data,F.hasDuplicateFields)})),this.updatePagedItems(),this.cdr.markForCheck())})}ngOnInit(){this.updatePaging()}ngOnChanges(e){e.p3xrValue&&this.updatePaging()}updatePaging(){this.p3xrValue&&(this.allEntries=this.p3xrValue.map(e=>{let i=e[0],t=e[1],a=[];for(let v=0;v<t.length;v+=2)a.push([t[v],t[v+1]]);let m=this.hasDuplicateFields(a),x=m?this.fieldsToArray(a):this.fieldsToObject(a);return{id:i,fields:a,data:x,displayData:this.toDisplayData(x,m),hasDuplicateFields:m}}),this.paging.figurePaging(this.allEntries.length),this.updatePagedItems())}updatePagedItems(){this.pagedEntries=this.allEntries.slice(this.paging.startIndex,this.paging.endIndex)}showTimestamp(e){try{let i=parseInt(e.slice(0,e.indexOf("-"))),t=this.i18n.currentLang()||"en",a=oo[t]||t;return new Date(i).toLocaleString(a,{year:"numeric",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch(i){return e}}isJsonValue(e){if(!e||e.length<2)return!1;let i=e.charAt(0);if(i!=="{"&&i!=="[")return!1;try{return JSON.parse(e),!0}catch(t){return!1}}formatJsonValue(e){try{return JSON.stringify(JSON.parse(e),null,this.settingsService.jsonFormat()??2)}catch(i){return e}}parseFieldValue(e){try{return JSON.parse(e)}catch(i){return e}}hasDuplicateFields(e){let i=new Set;for(let[t]of e){if(i.has(t))return!0;i.add(t)}return!1}fieldsToObject(e){let i={};for(let[t,a]of e)i[t]=this.parseFieldValue(a);return i}fieldsToArray(e){return e.map(([i,t])=>({field:i,value:this.parseFieldValue(t)}))}toDisplayData(e,i){if(!i)return e;let t=this.strings?.page?.key?.stream?.table?.field,a=this.strings?.page?.key?.stream?.table?.value;return e.map(m=>({[t]:m.field,[a]:m.value}))}entryToExport(e){return e.hasDuplicateFields?{id:e.id,fields:e.data}:Ee({id:e.id},e.data)}downloadEntry(e){let i=[e.id];for(let[v,k]of e.fields)i.push(v),i.push(k);let t=i.join(`
`),a=new Blob([t],{type:"text/plain"}),m=URL.createObjectURL(a),x=document.createElement("a");x.href=m,x.download=`${this.p3xrKey}-${e.id}.txt`,x.click(),URL.revokeObjectURL(m)}copyEntry(e){return w(this,null,function*(){let i=this.entryToExport(e);yield this.copy(JSON.stringify(i,null,2))})}viewEntryJson(e,i){return w(this,null,function*(){let t=this.entryToExport(e);yield this.showJson(JSON.stringify(t),i)})}viewFieldJson(e,i){return w(this,null,function*(){yield this.showJson(e,i)})}copyField(e){this.copy(e)}addStream(e){return w(this,null,function*(){try{yield this.keyNewOrSetDialog.show({$event:e,type:"append",model:{type:"stream",key:this.p3xrKey}}),this.refreshKey()}catch(i){this.common.generalHandleError(i)}})}deleteStreamTimestamp(e,i){return w(this,null,function*(){try{yield this.common.confirm({message:this.i18n.strings().confirm?.deleteStreamTimestamp}),yield this.socket.request({action:"key/stream-delete-timestamp",payload:{key:this.p3xrKey,streamTimestamp:e}}),this.common.toast(this.i18n.strings().status?.deletedStreamTimestamp||this.i18n.strings().status?.deletedKey),this.refreshKey()}catch(t){t&&this.common.generalHandleError(t)}})}static \u0275fac=function(i){return new(i||n)(g(R),g(z),g($),g(Z),g(X),g(O),g(H),g(B),g(W),g(N))};static \u0275cmp=D({type:n,selectors:[["p3xr-key-stream"]],features:[Y,te],decls:9,vars:3,consts:[[3,"pageChanged","paging"],[1,"p3xr-key-type-table"],[1,"p3xr-key-type-header"],[2,"flex","1"],[2,"text-align","right"],["mat-icon-button","",3,"matTooltip"],[1,"p3xr-key-stream-entry-block"],["mat-icon-button","",3,"click","matTooltip"],[1,"p3xr-key-stream-entry-header"],[1,"p3xr-key-stream-timestamp"],[1,"p3xr-key-stream-timestamp-human"],[1,"p3xr-key-type-row-actions"],[1,"icon-warn",3,"matTooltip"],[1,"icon-accent",3,"click","matTooltip"],[1,"p3xr-key-stream-data"],[2,"display","flex","gap","8px","padding","2px 0"],[1,"icon-warn",3,"click","matTooltip"],[2,"min-width","120px","opacity","0.7"],[1,"p3xr-value-col",2,"flex","1","max-height","200px","word-break","break-all"],[3,"value","truncated"],[2,"opacity","0.5"]],template:function(i,t){i&1&&(o(0,"p3xr-key-pager-inline",0),_("pageChanged",function(){return t.updatePagedItems()}),l(),o(1,"div",1)(2,"div",2)(3,"span",3),p(4),l(),o(5,"span",4),y(6,Zn,3,1,"button",5),l()(),P(7,no,18,6,"div",6,Gn),l()),i&2&&(b("paging",t.paging),c(4),h(t.strings==null||t.strings.page==null||t.strings.page.key==null||t.strings.page.key.stream==null||t.strings.page.key.stream.table==null?null:t.strings.page.key.stream.table.timestamp),c(2),f(t.isReadonly?-1:6),c(),j(t.pagedEntries))},dependencies:[A,U,q,se,Q,G,J,L,_e,ue],encapsulation:2})}return n})();function ro(n,r){if(n&1){let e=C();o(0,"button",6),_("click",function(){d(e);let t=s();return u(t.copyValue())}),o(1,"mat-icon"),p(2,"content_copy"),l(),o(3,"span"),p(4),l()()}if(n&2){let e=s();c(4),h(e.strings==null||e.strings.intention==null?null:e.strings.intention.copy)}}function ao(n,r){if(n&1){let e=C();o(0,"button",7),_("click",function(){d(e);let t=s();return u(t.copyValue())}),o(1,"mat-icon"),p(2,"content_copy"),l()()}if(n&2){let e=s();b("matTooltip",(e.strings==null||e.strings.intention==null?null:e.strings.intention.copy)??"Copy")}}function lo(n,r){if(n&1){let e=C();o(0,"button",6),_("click",function(){d(e);let t=s();return u(t.downloadJsonFile())}),o(1,"mat-icon"),p(2,"download"),l(),o(3,"span"),p(4),l()()}if(n&2){let e=s();c(4),h(e.strings==null||e.strings.intention==null?null:e.strings.intention.downloadJson)}}function so(n,r){if(n&1){let e=C();o(0,"button",7),_("click",function(){d(e);let t=s();return u(t.downloadJsonFile())}),o(1,"mat-icon"),p(2,"download"),l()()}if(n&2){let e=s();b("matTooltip",(e.strings==null||e.strings.intention==null?null:e.strings.intention.downloadJson)??"Download JSON")}}function co(n,r){if(n&1){let e=C();o(0,"button",6),_("click",function(){d(e);let t=s();return u(t.expandAll())}),o(1,"mat-icon"),p(2,"unfold_more"),l(),o(3,"span"),p(4),l()()}if(n&2){let e=s();c(4),h(e.strings==null||e.strings.page==null||e.strings.page.treeControls==null?null:e.strings.page.treeControls.expandAll)}}function po(n,r){if(n&1){let e=C();o(0,"button",7),_("click",function(){d(e);let t=s();return u(t.expandAll())}),o(1,"mat-icon"),p(2,"unfold_more"),l()()}if(n&2){let e=s();b("matTooltip",(e.strings==null||e.strings.page==null||e.strings.page.treeControls==null?null:e.strings.page.treeControls.expandAll)??"Expand All")}}function mo(n,r){if(n&1){let e=C();o(0,"button",6),_("click",function(){d(e);let t=s();return u(t.collapseAll())}),o(1,"mat-icon"),p(2,"unfold_less"),l(),o(3,"span"),p(4),l()()}if(n&2){let e=s();c(4),h(e.strings==null||e.strings.page==null||e.strings.page.treeControls==null?null:e.strings.page.treeControls.collapseAll)}}function uo(n,r){if(n&1){let e=C();o(0,"button",7),_("click",function(){d(e);let t=s();return u(t.collapseAll())}),o(1,"mat-icon"),p(2,"unfold_less"),l()()}if(n&2){let e=s();b("matTooltip",(e.strings==null||e.strings.page==null||e.strings.page.treeControls==null?null:e.strings.page.treeControls.collapseAll)??"Collapse All")}}function _o(n,r){if(n&1){let e=C();o(0,"button",6),_("click",function(){d(e);let t=s();return u(t.toggleWrap())}),o(1,"mat-icon"),p(2),l(),o(3,"span"),p(4),l()()}if(n&2){let e=s();c(2),h(e.treeWrap?"wrap_text":"notes"),c(2),h(e.treeWrap?e.strings==null||e.strings.intention==null?null:e.strings.intention.unwrap:e.strings==null||e.strings.intention==null?null:e.strings.intention.wrap)}}function go(n,r){if(n&1){let e=C();o(0,"button",7),_("click",function(){d(e);let t=s();return u(t.toggleWrap())}),o(1,"mat-icon"),p(2),l()()}if(n&2){let e=s();b("matTooltip",e.treeWrap?(e.strings==null||e.strings.intention==null?null:e.strings.intention.unwrap)??"Unwrap":(e.strings==null||e.strings.intention==null?null:e.strings.intention.wrap)??"Wrap"),c(2),h(e.treeWrap?"wrap_text":"notes")}}function xo(n,r){if(n&1){let e=C();o(0,"button",10),_("click",function(){d(e);let t=s(2);return u(t.jsonEditor())}),o(1,"mat-icon"),p(2,"edit"),l(),o(3,"span"),p(4),l()()}if(n&2){let e=s(2);c(4),h(e.strings==null||e.strings.intention==null?null:e.strings.intention.jsonViewEditor)}}function yo(n,r){if(n&1){let e=C();o(0,"button",11),_("click",function(){d(e);let t=s(2);return u(t.jsonEditor())}),o(1,"mat-icon"),p(2,"edit"),l()()}if(n&2){let e=s(2);b("matTooltip",(e.strings==null||e.strings.intention==null?null:e.strings.intention.jsonViewEditor)??"Edit JSON")}}function fo(n,r){if(n&1&&y(0,xo,5,1,"button",8)(1,yo,3,1,"button",9),n&2){let e=s();f(e.isGtSm?0:1)}}function ho(n,r){if(n&1&&T(0,"p3xr-json-tree",4),n&2){let e=s();b("data",e.jsonObj)("label",e.strings==null||e.strings.label==null?null:e.strings.label.tree)("expanded",e.treeExpanded)("wrap",e.treeWrap)}}function Co(n,r){if(n&1&&(o(0,"div",5),p(1),l()),n&2){let e=s();c(),h(e.truncateDisplay(e.p3xrValue))}}var li=(()=>{class n extends ee{jsonEditorDialog;overlay;diffDialog;jsonTree;jsonObj;treeExpanded=!0;treeWrap=!0;constructor(e,i,t,a,m,x,v,k,S,V,F,I,ne){super(e,i,t,a,m,x,k,S,V,F),this.jsonEditorDialog=v,this.overlay=I,this.diffDialog=ne}ngOnInit(){this.parseJson()}ngOnChanges(e){e.p3xrValue&&this.parseJson()}ngOnDestroy(){this.destroyBase()}parseJson(){try{this.jsonObj=JSON.parse(this.p3xrValue)}catch(e){this.jsonObj=void 0}}expandAll(){this.jsonTree?.treeControl.expandAll()}collapseAll(){this.jsonTree?.treeControl.collapseAll();let e=this.jsonTree?.treeControl.dataNodes?.[0];e&&this.jsonTree.treeControl.expand(e)}toggleWrap(){this.treeWrap=!this.treeWrap}copyValue(){return w(this,null,function*(){yield this.copy(this.p3xrValue)})}jsonEditor(){return w(this,null,function*(){try{let e=this.p3xrValue,i=yield this.jsonEditorDialog.show({value:this.p3xrValue,hideFormatSave:!0}),t=typeof i.obj=="string"?i.obj:JSON.stringify(i.obj);this.overlay.show(),yield this.socket.request({action:"key/json-set",payload:{key:this.p3xrKey,path:"$",value:t}}),this.gtag("/key-json-set"),this.refreshKey(),this.overlay.hide(),this.settingsService.undoEnabled()&&e!==void 0&&e!==t&&(yield this.common.toastWithUndo(this.strings?.status?.set))&&(this.overlay.show({message:"Undo..."}),yield this.socket.request({action:"key/json-set",payload:{key:this.p3xrKey,path:"$",value:e}}),this.refreshKey(),this.overlay.hide(),this.common.toast(this.strings?.status?.reverted))}catch(e){e&&this.common.generalHandleError(e),this.overlay.hide()}})}downloadJsonFile(){let e=new Blob([this.p3xrValue],{type:"application/json"}),i=URL.createObjectURL(e),t=document.createElement("a");t.href=i,t.download=`${this.p3xrKey}.json`,t.click(),URL.revokeObjectURL(i)}static \u0275fac=function(i){return new(i||n)(g(R),g(z),g($),g(Z),g(X),g(O),g(Qe),g(H),g(B),g(W),g(N),g(Ue),g(Ge))};static \u0275cmp=D({type:n,selectors:[["p3xr-key-json"]],viewQuery:function(i,t){if(i&1&&ke(ot,5),i&2){let a;xe(a=ye())&&(t.jsonTree=a.first)}},features:[Y,te],decls:15,vars:7,consts:[[1,"p3xr-key-type-actions"],["mat-raised-button","","type","button",1,"btn-accent","p3xr-action-btn"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-accent",3,"matTooltip"],[1,"p3xr-key-type-content",2,"overflow","auto"],[3,"data","label","expanded","wrap"],[1,"p3xr-pre"],["mat-raised-button","","type","button",1,"btn-accent","p3xr-action-btn",3,"click"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-accent",3,"click","matTooltip"],["mat-raised-button","","type","button",1,"btn-primary","p3xr-action-btn"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-primary",3,"matTooltip"],["mat-raised-button","","type","button",1,"btn-primary","p3xr-action-btn",3,"click"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-primary",3,"click","matTooltip"]],template:function(i,t){i&1&&(o(0,"div",0),y(1,ro,5,1,"button",1)(2,ao,3,1,"button",2),y(3,lo,5,1,"button",1)(4,so,3,1,"button",2),y(5,co,5,1,"button",1)(6,po,3,1,"button",2),y(7,mo,5,1,"button",1)(8,uo,3,1,"button",2),y(9,_o,5,2,"button",1)(10,go,3,2,"button",2),y(11,fo,2,1),l(),o(12,"div",3),y(13,ho,1,4,"p3xr-json-tree",4)(14,Co,2,1,"div",5),l()),i&2&&(c(),f(t.isGtSm?1:2),c(2),f(t.isGtSm?3:4),c(2),f(t.isGtSm?5:6),c(2),f(t.isGtSm?7:8),c(2),f(t.isGtSm?9:10),c(2),f(t.isReadonly?-1:11),c(2),f(t.jsonObj!==void 0?13:14))},dependencies:[A,q,ce,pe,Q,G,J,L,ot],encapsulation:2})}return n})();var bo=["tsChart"],vo=["tsDataViewport"],ci=(n,r)=>r.key,ko=(n,r)=>r.destKey;function wo(n,r){if(n&1){let e=C();o(0,"p3xr-ng-button",26),_("click",function(t){return d(e),s().editAllDataPoints(t),u(t.stopPropagation())}),l()}if(n&2){let e=s();b("label",e.strings==null||e.strings.intention==null?null:e.strings.intention.edit)("breakpoint",1280)}}function So(n,r){if(n&1){let e=C();o(0,"p3xr-ng-button",27),_("click",function(t){return d(e),s().loadRange(),u(t.stopPropagation())}),l()}if(n&2){let e=s();b("label",e.strings==null||e.strings.intention==null?null:e.strings.intention.refresh)("breakpoint",1280)}}function To(n,r){if(n&1&&(o(0,"mat-option",16),p(1),l()),n&2){let e=r.$implicit;b("value",e),c(),h(e)}}function Vo(n,r){if(n&1){let e=C();o(0,"mat-form-field",11)(1,"mat-label"),p(2),l(),o(3,"input",28),M("ngModelChange",function(t){d(e);let a=s();return K(a.aggregationBucket,t)||(a.aggregationBucket=t),u(t)}),_("ngModelChange",function(){d(e);let t=s();return u(t.debouncedLoadRange())}),l()()}if(n&2){let e=s();c(2),h(e.strings==null||e.strings.page==null||e.strings.page.key==null||e.strings.page.key.timeseries==null?null:e.strings.page.key.timeseries.timeBucket),c(),E("ngModel",e.aggregationBucket)}}function Io(n,r){if(n&1){let e=C();o(0,"button",33),_("click",function(){d(e);let t=s(2);return u(t.addDataPoint())}),o(1,"mat-icon"),p(2,"add"),l(),o(3,"span"),p(4),l()()}if(n&2){let e=s(2);b("disabled",!e.addValue),c(4),h(e.strings==null||e.strings.intention==null?null:e.strings.intention.add)}}function Eo(n,r){if(n&1){let e=C();o(0,"button",34),_("click",function(){d(e);let t=s(2);return u(t.addDataPoint())}),o(1,"mat-icon"),p(2,"add"),l()()}if(n&2){let e=s(2);b("disabled",!e.addValue)("matTooltip",(e.strings==null||e.strings.intention==null?null:e.strings.intention.add)??"Add")}}function Ko(n,r){if(n&1){let e=C();o(0,"div",22)(1,"mat-form-field",11)(2,"mat-label"),p(3),l(),o(4,"input",29),M("ngModelChange",function(t){d(e);let a=s();return K(a.addTimestamp,t)||(a.addTimestamp=t),u(t)}),l()(),o(5,"mat-form-field",11)(6,"mat-label"),p(7),l(),o(8,"input",30),M("ngModelChange",function(t){d(e);let a=s();return K(a.addValue,t)||(a.addValue=t),u(t)}),_("keydown.enter",function(){d(e);let t=s();return u(t.addDataPoint())}),l()(),y(9,Io,5,2,"button",31)(10,Eo,3,2,"button",32),l()}if(n&2){let e=s();c(3),h(e.strings==null||e.strings.page==null||e.strings.page.key==null||e.strings.page.key.timeseries==null?null:e.strings.page.key.timeseries.timestamp),c(),E("ngModel",e.addTimestamp),c(3),h(e.strings==null||e.strings.page==null||e.strings.page.key==null||e.strings.page.key.timeseries==null?null:e.strings.page.key.timeseries.value),c(),E("ngModel",e.addValue),c(),f(e.isGtSm?9:10)}}function Mo(n,r){n&1&&T(0,"span",39)}function Fo(n,r){if(n&1){let e=C();o(0,"span",43)(1,"mat-icon",44),_("click",function(){d(e);let t=s().$implicit,a=s(2);return u(a.deleteDataPoint(t))}),p(2,"delete"),l(),o(3,"mat-icon",45),_("click",function(){d(e);let t=s().$implicit,a=s(2);return u(a.editDataPoint(t))}),p(4,"edit"),l()()}if(n&2){let e=s(3);c(),b("matTooltip",(e.strings==null||e.strings.intention==null?null:e.strings.intention.delete)??"Delete"),c(2),b("matTooltip",(e.strings==null||e.strings.intention==null?null:e.strings.intention.edit)??"Edit")}}function Do(n,r){if(n&1&&(o(0,"div",42)(1,"span",38),p(2),l(),o(3,"span"),p(4),l(),y(5,Fo,5,2,"span",43),l()),n&2){let e=r.$implicit,i=s(2);c(2),h(i.formatTimestamp(e.timestamp)),c(2),h(e.value),c(),f(i.isReadonly?-1:5)}}function Bo(n,r){if(n&1&&(T(0,"br"),o(1,"p3xr-ng-accordion",35)(2,"div",24)(3,"div",36)(4,"div",37)(5,"span",38),p(6),l(),o(7,"span"),p(8),l(),y(9,Mo,1,0,"span",39),l(),o(10,"cdk-virtual-scroll-viewport",40,1),$e(12,Do,6,3,"div",41),l()()()()),n&2){let e=s();c(),b("title",e.capitalize(e.strings==null||e.strings.page==null||e.strings.page.key==null||e.strings.page.key.timeseries==null?null:e.strings.page.key.timeseries.dataPoints)+" ("+e.rangeData.length+")"),c(5),h(e.strings==null||e.strings.page==null||e.strings.page.key==null||e.strings.page.key.timeseries==null?null:e.strings.page.key.timeseries.timestamp),c(2),h(e.strings==null||e.strings.page==null||e.strings.page.key==null||e.strings.page.key.timeseries==null?null:e.strings.page.key.timeseries.value),c(),f(e.isReadonly?-1:9),c(),b("itemSize",40),c(2),b("cdkVirtualForOf",e.rangeData)}}function Ro(n,r){if(n&1){let e=C();o(0,"div",4)(1,"p3xr-ng-button",46),_("click",function(t){return d(e),s().toggleAlterMode(),u(t.stopPropagation())}),l()()}if(n&2){let e=s();c(),b("label",e.strings==null||e.strings.intention==null?null:e.strings.intention.edit)("mdIcon",e.alterMode?"check_box":"edit")}}function Po(n,r){if(n&1){let e=C();o(0,"div",25)(1,"div",10)(2,"mat-form-field",47)(3,"mat-label"),p(4),l(),o(5,"input",48),M("ngModelChange",function(t){d(e);let a=s();return K(a.alterRetention,t)||(a.alterRetention=t),u(t)}),l(),o(6,"mat-hint"),p(7),l()(),o(8,"mat-form-field",47)(9,"mat-label"),p(10),l(),o(11,"mat-select",14),M("ngModelChange",function(t){d(e);let a=s();return K(a.alterDuplicatePolicy,t)||(a.alterDuplicatePolicy=t),u(t)}),o(12,"mat-option",49),p(13,"LAST"),l(),o(14,"mat-option",50),p(15,"FIRST"),l(),o(16,"mat-option",51),p(17,"MIN"),l(),o(18,"mat-option",52),p(19,"MAX"),l(),o(20,"mat-option",53),p(21,"SUM"),l(),o(22,"mat-option",54),p(23,"BLOCK"),l()(),o(24,"mat-hint"),p(25,"\xA0"),l()(),o(26,"mat-form-field",55)(27,"mat-label"),p(28),l(),o(29,"input",56),M("ngModelChange",function(t){d(e);let a=s();return K(a.alterLabels,t)||(a.alterLabels=t),u(t)}),l(),o(30,"mat-hint"),p(31),l()(),o(32,"button",57),_("click",function(){d(e);let t=s();return u(t.saveAlter())}),o(33,"mat-icon"),p(34,"save"),l(),o(35,"span"),p(36),l()()()()}if(n&2){let e=s();c(4),ie("",e.strings==null||e.strings.page==null||e.strings.page.key==null||e.strings.page.key.timeseries==null?null:e.strings.page.key.timeseries.retention," (ms)"),c(),E("ngModel",e.alterRetention),c(2),h(e.strings==null||e.strings.page==null||e.strings.page.key==null||e.strings.page.key.timeseries==null?null:e.strings.page.key.timeseries.retentionHint),c(3),h(e.strings==null||e.strings.page==null||e.strings.page.key==null||e.strings.page.key.timeseries==null?null:e.strings.page.key.timeseries.duplicatePolicy),c(),E("ngModel",e.alterDuplicatePolicy),c(17),h(e.strings==null||e.strings.page==null||e.strings.page.key==null||e.strings.page.key.timeseries==null?null:e.strings.page.key.timeseries.labels),c(),E("ngModel",e.alterLabels),c(2),h(e.strings==null||e.strings.page==null||e.strings.page.key==null||e.strings.page.key.timeseries==null?null:e.strings.page.key.timeseries.labelsHint),c(5),h(e.strings==null||e.strings.intention==null?null:e.strings.intention.save)}}function jo(n,r){if(n&1&&(o(0,"mat-list-item")(1,"div")(2,"div",58)(3,"span",59),p(4),l(),o(5,"span",60),p(6),l()()()(),T(7,"mat-divider")),n&2){let e=r.$implicit;c(4),h(e.key),c(2),h(e.value)}}function Ao(n,r){if(n&1&&(o(0,"mat-list-item")(1,"div")(2,"div",58)(3,"span",59),p(4),l(),o(5,"span",60),p(6),l()()()(),T(7,"mat-divider")),n&2){let e=r.$implicit;c(4),h(e.key),c(2),h(e.value)}}function Oo(n,r){if(n&1&&(o(0,"mat-list-item")(1,"div")(2,"strong"),p(3),l()()(),T(4,"mat-divider"),P(5,Ao,8,2,null,null,ci)),n&2){let e=s();c(3),h(e.strings==null||e.strings.page==null||e.strings.page.key==null||e.strings.page.key.timeseries==null?null:e.strings.page.key.timeseries.labels),c(2),j(e.tsLabels)}}function Lo(n,r){if(n&1&&(o(0,"mat-list-item")(1,"div")(2,"div",58)(3,"span",59),p(4),l(),o(5,"span",60),p(6),l()()()(),T(7,"mat-divider")),n&2){let e=r.$implicit;c(4),h(e.destKey),c(2),Ce("",e.aggregationType," / ",e.bucketDuration,"ms")}}function Jo(n,r){if(n&1&&(o(0,"mat-list-item")(1,"div")(2,"strong"),p(3),l()()(),T(4,"mat-divider"),P(5,Lo,8,3,null,null,ko)),n&2){let e=s();c(3),h(e.strings==null||e.strings.page==null||e.strings.page.key==null||e.strings.page.key.timeseries==null?null:e.strings.page.key.timeseries.rules),c(2),j(e.tsRules)}}var pi=(()=>{class n extends ee{chartRef;dataViewport;tsInfo={};rangeData=[];rangeFrom="";rangeTo="";aggregationType="";aggregationBucket="";addTimestamp="*";addValue="";autoRefresh=!1;alterMode=!1;alterRetention=0;alterDuplicatePolicy="";alterLabels="";overlayKeysInput="";mrangeFilter="";overlaySeries=[];aggregationTypes=["avg","min","max","sum","count","first","last","range","std.p","std.s","var.p","var.s"];uPlot=null;plot=null;resizeObserver=null;themeObserver=null;langCheckInterval=null;autoRefreshInterval=null;loadRangeDebounceTimer=null;constructor(e,i,t,a,m,x,v,k,S,V){super(e,i,t,a,m,x,v,k,S,V)}ngOnInit(){this.tsInfo=this.p3xrValue||{},this.ensureDefaultLabel(),this.loadRange(),this.themeObserver=new MutationObserver(()=>{setTimeout(()=>this.reinitChart(),100)}),this.themeObserver.observe(document.body,{attributes:!0,attributeFilter:["class"]});let e=this.i18n.currentLang()||"en";this.langCheckInterval=setInterval(()=>{let i=this.i18n.currentLang()||"en";i!==e&&(e=i,setTimeout(()=>this.reinitChart(),100))},500)}ngOnChanges(e){e.p3xrValue&&!e.p3xrValue.firstChange&&(this.tsInfo=this.p3xrValue||{},this.loadRange())}ngAfterViewInit(){this.loadUPlot()}ngOnDestroy(){this.destroyBase(),this.destroyChart(),this.stopAutoRefresh(),this.themeObserver?.disconnect(),this.langCheckInterval&&clearInterval(this.langCheckInterval)}toggleAutoRefresh(){this.autoRefresh=!this.autoRefresh,this.autoRefresh?this.startAutoRefresh():this.stopAutoRefresh(),this.cdr.markForCheck()}startAutoRefresh(){this.stopAutoRefresh(),this.autoRefreshInterval=setInterval(()=>{this.loadRange()},1e4)}stopAutoRefresh(){this.autoRefreshInterval&&(clearInterval(this.autoRefreshInterval),this.autoRefreshInterval=null)}get infoLabels(){if(!this.tsInfo)return[];let e=new Set(["labels","rules","sourceKey","chunks"]);return Object.entries(this.tsInfo).filter(([i])=>!e.has(i)).map(([i,t])=>({key:i,value:t}))}get tsLabels(){let e=this.tsInfo?.labels;return!e||typeof e!="object"?[]:Object.entries(e).map(([i,t])=>({key:i,value:String(t)}))}get tsRules(){return Array.isArray(this.tsInfo?.rules)?this.tsInfo.rules:[]}capitalize(e){return e?e.charAt(0).toUpperCase()+e.slice(1):""}debouncedLoadRange(){clearTimeout(this.loadRangeDebounceTimer),this.loadRangeDebounceTimer=setTimeout(()=>{this.loadRange()},500)}loadRange(){return w(this,null,function*(){try{let e={key:this.p3xrKey};this.rangeFrom&&(e.from=this.rangeFrom),this.rangeTo&&(e.to=this.rangeTo),this.aggregationType&&this.aggregationBucket&&(e.aggregation={type:this.aggregationType,timeBucket:parseInt(this.aggregationBucket,10)});let i=yield this.socket.request({action:"timeseries/range",payload:e});this.rangeData=i.data||[],this.overlaySeries=[];let t=this.overlayKeysInput.split(",").map(m=>m.trim()).filter(m=>m.length>0);for(let m of t)try{let x={key:m};this.rangeFrom&&(x.from=this.rangeFrom),this.rangeTo&&(x.to=this.rangeTo),this.aggregationType&&this.aggregationBucket&&(x.aggregation={type:this.aggregationType,timeBucket:parseInt(this.aggregationBucket,10)});let v=yield this.socket.request({action:"timeseries/range",payload:x});this.overlaySeries.push({key:m,data:v.data||[]})}catch(x){}if(this.mrangeFilter.trim().length>0)try{let m={filter:this.mrangeFilter.trim()};this.rangeFrom&&(m.from=this.rangeFrom),this.rangeTo&&(m.to=this.rangeTo),this.aggregationType&&this.aggregationBucket&&(m.aggregation={type:this.aggregationType,timeBucket:parseInt(this.aggregationBucket,10)});let x=yield this.socket.request({action:"timeseries/mrange",payload:m});for(let v of x.data||[])v.key!==this.p3xrKey&&this.overlaySeries.push({key:v.key,data:v.data})}catch(m){}this.updateChart(),this.cdr.markForCheck();let a=setInterval(()=>{this.dataViewport&&(this.dataViewport.checkViewportSize(),this.dataViewport.elementRef.nativeElement.clientHeight>0&&clearInterval(a))},200);setTimeout(()=>clearInterval(a),3e4)}catch(e){this.common.generalHandleError(e)}})}ensureDefaultLabel(){return w(this,null,function*(){if(this.isReadonly)return;let e=this.tsInfo?.labels;if((e&&typeof e=="object"?Object.keys(e).length:0)===0)try{yield this.socket.request({action:"timeseries/alter",payload:{key:this.p3xrKey,labels:`key ${this.p3xrKey}`}}),this.tsInfo.labels={key:this.p3xrKey},this.cdr.markForCheck()}catch(t){}})}exportChartPng(){if(!this.plot)return;let e=this.chartRef?.nativeElement;if(!e)return;let i=e.querySelector("canvas");if(!i)return;let t=document.body.classList.contains("p3xr-theme-dark"),a=t?"#1e1e1e":"#ffffff",m=t?"rgba(255,255,255,0.87)":"rgba(0,0,0,0.87)",x=20,v=30,k=30,S=i.width+x*2,V=i.height+x*2+v+k,F=document.createElement("canvas");F.width=S,F.height=V;let I=F.getContext("2d");I.fillStyle=a,I.fillRect(0,0,S,V),I.fillStyle=m,I.font="bold 14px Roboto, sans-serif",I.fillText(this.p3xrKey,x,x+16),I.drawImage(i,x,x+v);let ne=[this.p3xrKey,...this.overlaySeries.map(be=>be.key)],Ne=[this.getChartColors().primary,...this.overlaySeries.map((be,yi)=>this.seriesColors[(yi+1)%this.seriesColors.length])],Xe=x,lt=x+v+i.height+16;I.font="12px Roboto, sans-serif";for(let be=0;be<ne.length;be++)I.fillStyle=Ne[be],I.fillRect(Xe,lt-8,12,12),I.fillStyle=m,I.fillText(ne[be],Xe+16,lt+2),Xe+=I.measureText(ne[be]).width+32;let xi=F.toDataURL("image/png"),Ye=document.createElement("a");Ye.href=xi,Ye.download=`${this.p3xrKey}-chart.png`,Ye.click()}toggleAlterMode(){if(this.alterMode=!this.alterMode,this.alterMode){this.alterRetention=this.tsInfo?.retentionTime||0,this.alterDuplicatePolicy=this.tsInfo?.duplicatePolicy||"LAST";let e=this.tsLabels.map(i=>`${i.key} ${i.value}`).join(" ");this.alterLabels=e||`key ${this.p3xrKey}`}this.cdr.markForCheck()}saveAlter(){return w(this,null,function*(){try{let e=this.alterLabels.trim().length>0?this.alterLabels:`key ${this.p3xrKey}`;yield this.socket.request({action:"timeseries/alter",payload:{key:this.p3xrKey,retention:this.alterRetention,duplicatePolicy:this.alterDuplicatePolicy,labels:e}}),this.common.toast(this.strings?.status?.saved),this.alterMode=!1,this.refreshKey()}catch(e){this.common.generalHandleError(e)}})}editDataPoint(e){return w(this,null,function*(){try{yield this.keyNewOrSetDialog.show({type:"edit",model:{type:"timeseries",key:this.p3xrKey,tsTimestamp:String(e.timestamp),value:e.value,originalTimestamp:e.timestamp}}),this.refreshKey(),yield this.loadRange()}catch(i){i!=null&&this.common.generalHandleError(i)}})}editAllDataPoints(e){return w(this,null,function*(){try{let i=this.rangeData.map(a=>`${a.timestamp} ${a.value}`).join(`
`),t=this.tsLabels.map(a=>`${a.key} ${a.value}`).join(" ")||`key ${this.p3xrKey}`;yield this.keyNewOrSetDialog.show({type:"edit",$event:e,model:{type:"timeseries",key:this.p3xrKey,value:i,tsEditAll:!0,tsLabels:t}}),this.refreshKey(),yield this.loadRange()}catch(i){i!=null&&this.common.generalHandleError(i)}})}deleteDataPoint(e){return w(this,null,function*(){try{yield this.common.confirm({message:this.i18n.strings().confirm?.delete}),yield this.socket.request({action:"timeseries/del",payload:{key:this.p3xrKey,from:e.timestamp,to:e.timestamp}}),this.common.toast(this.strings?.status?.deleted),this.refreshKey()}catch(i){i!=null&&this.common.generalHandleError(i)}})}formatTimestamp(e){let i=this.i18n.currentLang()||"en";return new Date(e).toLocaleString(i,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3})}addDataPoint(){return w(this,null,function*(){if(this.addValue)try{yield this.socket.request({action:"timeseries/add",payload:{key:this.p3xrKey,timestamp:this.addTimestamp||"*",value:parseFloat(this.addValue)}}),this.common.toast(this.strings?.status?.added),this.addValue="",this.refreshKey()}catch(e){this.common.generalHandleError(e)}})}loadUPlot(){return w(this,null,function*(){try{let e=yield import("./chunk-RM2ZFJOJ.js");this.uPlot=e.default,this.initChart()}catch(e){console.error("Failed to load uPlot",e)}})}seriesColors=["#1976d2","#9c27b0","#f44336","#4caf50","#ff9800","#00bcd4","#e91e63","#8bc34a"];getChartColors(){let e=document.body.classList.contains("p3xr-theme-dark");return{primary:getComputedStyle(document.body).getPropertyValue("--p3xr-btn-primary-bg").trim()||(e?"#90caf9":"#1976d2"),text:e?"rgba(255,255,255,0.87)":"rgba(0,0,0,0.87)",grid:e?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.08)"}}createOpts(e){let i=this.getChartColors(),t=this.strings?.page?.key?.timeseries||{},a=[{label:this.strings?.label?.time,value:(m,x)=>{if(!x)return"";let v=this.i18n.currentLang()||"en";return new Date(x*1e3).toLocaleString(v,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}},{label:this.p3xrKey,stroke:i.primary,width:2,fill:i.primary+"15"}];for(let m=0;m<this.overlaySeries.length;m++){let x=this.seriesColors[(m+1)%this.seriesColors.length];a.push({label:this.overlaySeries[m].key,stroke:x,width:2})}return{width:e,height:400,cursor:{show:!0,drag:{x:!1,y:!1}},legend:{show:!0,live:!0},scales:{x:{time:!0}},axes:[{stroke:i.text,grid:{stroke:i.grid,width:1},ticks:{stroke:i.grid},font:"11px Roboto",values:(m,x)=>x.map(v=>new Date(v*1e3).toLocaleTimeString(this.i18n.currentLang(),{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}))},{stroke:i.text,grid:{stroke:i.grid,width:1},ticks:{stroke:i.grid},font:"11px Roboto Mono",size:65}],series:a}}initChart(){if(!this.uPlot)return;let e=this.chartRef?.nativeElement;if(!e)return;this.destroyChart();let i=e.clientWidth||400,t=this.buildChartData();this.plot=new this.uPlot(this.createOpts(i),t,e);let a;this.resizeObserver=new ResizeObserver(()=>{clearTimeout(a),a=setTimeout(()=>{let m=e.clientWidth;m>0&&this.plot?.setSize({width:m,height:400})},50)}),this.resizeObserver.observe(e)}reinitChart(){this.destroyChart(),this.initChart()}updateChart(){let e=2+this.overlaySeries.length;if(!this.plot||this.plot.series?.length!==e){this.reinitChart();return}let i=this.buildChartData();this.plot.setData(i,!0),i[0].length>0&&this.plot.setScale("x",{min:i[0][0],max:i[0][i[0].length-1]})}buildChartData(){if(this.overlaySeries.length===0)return[this.rangeData.map(x=>x.timestamp/1e3),this.rangeData.map(x=>x.value)];let e=[this.rangeData,...this.overlaySeries.map(x=>x.data)],i=new Set;for(let x of e)for(let v of x)i.add(v.timestamp);let t=Array.from(i).sort((x,v)=>x-v),m=[t.map(x=>x/1e3)];for(let x of e){let v=new Map;for(let k of x)v.set(k.timestamp,k.value);m.push(t.map(k=>v.has(k)?v.get(k):null))}return m}destroyChart(){this.resizeObserver?.disconnect(),this.resizeObserver=null,this.plot?.destroy(),this.plot=null}static \u0275fac=function(i){return new(i||n)(g(R),g(z),g($),g(Z),g(X),g(O),g(H),g(B),g(W),g(N))};static \u0275cmp=D({type:n,selectors:[["p3xr-key-timeseries"]],viewQuery:function(i,t){if(i&1&&ke(bo,5)(vo,5),i&2){let a;xe(a=ye())&&(t.chartRef=a.first),xe(a=ye())&&(t.dataViewport=a.first)}},features:[Y,te],decls:51,vars:32,consts:[["tsChart",""],["tsDataViewport",""],[1,"p3xr-key-type-content"],["accordionKey","ts-chart",3,"title","expanded"],["actions",""],["mdIcon","edit",3,"label","breakpoint"],["mdIcon","image",3,"click","label","breakpoint"],[3,"click","label","mdIcon","breakpoint"],["mdIcon","refresh",3,"label","breakpoint"],["content","",2,"padding","16px"],[1,"p3xr-timeseries-controls"],["subscriptSizing","dynamic",1,"p3xr-timeseries-field"],["matInput","","placeholder","-",3,"ngModelChange","ngModel"],["matInput","","placeholder","+",3,"ngModelChange","ngModel"],[3,"ngModelChange","ngModel"],["value",""],[3,"value"],["subscriptSizing","dynamic",1,"p3xr-timeseries-field",2,"min-width","200px"],["matInput","",3,"ngModelChange","ngModel","placeholder"],["subscriptSizing","dynamic",1,"p3xr-timeseries-field",2,"min-width","180px"],[1,"p3xr-timeseries-chart-info"],[1,"p3xr-timeseries-chart-container"],[1,"p3xr-timeseries-controls",2,"margin-top","16px"],["accordionKey","ts-info",3,"title"],["content",""],[2,"padding","16px"],["mdIcon","edit",3,"click","label","breakpoint"],["mdIcon","refresh",3,"click","label","breakpoint"],["matInput","","type","number","placeholder","5000",3,"ngModelChange","ngModel"],["matInput","","placeholder","* (auto)",3,"ngModelChange","ngModel"],["matInput","","type","number",3,"ngModelChange","keydown.enter","ngModel"],["mat-raised-button","","type","button",1,"btn-primary","p3xr-action-btn",3,"disabled"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-primary",3,"disabled","matTooltip"],["mat-raised-button","","type","button",1,"btn-primary","p3xr-action-btn",3,"click","disabled"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-primary",3,"click","disabled","matTooltip"],["accordionKey","ts-data",3,"title"],[1,"p3xr-key-type-table"],[1,"p3xr-key-type-header"],[2,"flex","1"],[2,"min-width","52px"],[2,"height","600px",3,"itemSize"],["class","p3xr-key-type-row",4,"cdkVirtualFor","cdkVirtualForOf"],[1,"p3xr-key-type-row"],[1,"p3xr-key-type-row-actions"],[1,"icon-warn",3,"click","matTooltip"],[1,"icon-accent",3,"click","matTooltip"],[3,"click","label","mdIcon"],["subscriptSizing","dynamic",2,"flex","1","min-width","150px"],["matInput","","type","number",3,"ngModelChange","ngModel"],["value","LAST"],["value","FIRST"],["value","MIN"],["value","MAX"],["value","SUM"],["value","BLOCK"],["subscriptSizing","dynamic",2,"flex","1","min-width","200px"],["matInput","",3,"ngModelChange","ngModel"],["mat-raised-button","","type","button",1,"btn-primary","p3xr-action-btn",3,"click"],[2,"display","flex","width","100%"],[1,"p3xr-settings-label",2,"flex","1"],[1,"p3xr-settings-value"]],template:function(i,t){if(i&1){let a=C();o(0,"div",2),T(1,"br"),o(2,"p3xr-ng-accordion",3)(3,"div",4),y(4,wo,1,2,"p3xr-ng-button",5),o(5,"p3xr-ng-button",6),_("click",function(x){return d(a),t.exportChartPng(),u(x.stopPropagation())}),l(),o(6,"p3xr-ng-button",7),_("click",function(x){return d(a),t.toggleAutoRefresh(),u(x.stopPropagation())}),l(),y(7,So,1,2,"p3xr-ng-button",8),l(),o(8,"div",9)(9,"div",10)(10,"mat-form-field",11)(11,"mat-label"),p(12),l(),o(13,"input",12),M("ngModelChange",function(x){return d(a),K(t.rangeFrom,x)||(t.rangeFrom=x),u(x)}),_("ngModelChange",function(){return t.debouncedLoadRange()}),l()(),o(14,"mat-form-field",11)(15,"mat-label"),p(16),l(),o(17,"input",13),M("ngModelChange",function(x){return d(a),K(t.rangeTo,x)||(t.rangeTo=x),u(x)}),_("ngModelChange",function(){return t.debouncedLoadRange()}),l()(),o(18,"mat-form-field",11)(19,"mat-label"),p(20),l(),o(21,"mat-select",14),M("ngModelChange",function(x){return d(a),K(t.aggregationType,x)||(t.aggregationType=x),u(x)}),_("ngModelChange",function(){return t.loadRange()}),o(22,"mat-option",15),p(23),l(),P(24,To,2,2,"mat-option",16,ft),l()(),y(26,Vo,4,2,"mat-form-field",11),o(27,"mat-form-field",17)(28,"mat-label"),p(29),l(),o(30,"input",18),M("ngModelChange",function(x){return d(a),K(t.overlayKeysInput,x)||(t.overlayKeysInput=x),u(x)}),_("ngModelChange",function(){return t.debouncedLoadRange()}),l()(),o(31,"mat-form-field",19)(32,"mat-label"),p(33),l(),o(34,"input",18),M("ngModelChange",function(x){return d(a),K(t.mrangeFilter,x)||(t.mrangeFilter=x),u(x)}),_("ngModelChange",function(){return t.debouncedLoadRange()}),l()()(),o(35,"div",20),p(36),l(),T(37,"div",21,0),y(39,Ko,11,5,"div",22),l()(),y(40,Bo,13,6),T(41,"br"),o(42,"p3xr-ng-accordion",23),y(43,Ro,2,2,"div",4),o(44,"div",24),y(45,Po,37,9,"div",25),o(46,"mat-list"),P(47,jo,8,2,null,null,ci),y(49,Oo,7,1),y(50,Jo,7,1),l()()()()}i&2&&(c(2),b("title",t.strings==null||t.strings.page==null||t.strings.page.key==null||t.strings.page.key.timeseries==null?null:t.strings.page.key.timeseries.chart)("expanded",!0),c(2),f(t.isReadonly?-1:4),c(),b("label",t.strings==null||t.strings.page==null||t.strings.page.key==null||t.strings.page.key.timeseries==null?null:t.strings.page.key.timeseries.exportChart)("breakpoint",1280),c(),b("label",t.strings==null||t.strings.label==null?null:t.strings.label.autoRefresh)("mdIcon",t.autoRefresh?"check_box":"check_box_outline_blank")("breakpoint",1280),c(),f(t.autoRefresh?-1:7),c(5),h(t.strings==null||t.strings.page==null||t.strings.page.key==null||t.strings.page.key.timeseries==null?null:t.strings.page.key.timeseries.from),c(),E("ngModel",t.rangeFrom),c(3),h(t.strings==null||t.strings.page==null||t.strings.page.key==null||t.strings.page.key.timeseries==null?null:t.strings.page.key.timeseries.to),c(),E("ngModel",t.rangeTo),c(3),h(t.strings==null||t.strings.page==null||t.strings.page.key==null||t.strings.page.key.timeseries==null?null:t.strings.page.key.timeseries.aggregation),c(),E("ngModel",t.aggregationType),c(2),h(t.strings==null||t.strings.page==null||t.strings.page.key==null||t.strings.page.key.timeseries==null?null:t.strings.page.key.timeseries.none),c(),j(t.aggregationTypes),c(2),f(t.aggregationType?26:-1),c(3),h(t.strings==null||t.strings.page==null||t.strings.page.key==null||t.strings.page.key.timeseries==null?null:t.strings.page.key.timeseries.overlay),c(),E("ngModel",t.overlayKeysInput),b("placeholder",t.strings==null||t.strings.page==null||t.strings.page.key==null||t.strings.page.key.timeseries==null?null:t.strings.page.key.timeseries.overlayHint),c(3),h(t.strings==null||t.strings.page==null||t.strings.page.key==null||t.strings.page.key.timeseries==null?null:t.strings.page.key.timeseries.mrangeFilter),c(),E("ngModel",t.mrangeFilter),b("placeholder",t.strings==null||t.strings.page==null||t.strings.page.key==null||t.strings.page.key.timeseries==null?null:t.strings.page.key.timeseries.mrangeHint),c(2),Ce(" ",t.rangeData.length," ",t.strings==null||t.strings.page==null||t.strings.page.key==null||t.strings.page.key.timeseries==null?null:t.strings.page.key.timeseries.dataPoints," "),c(3),f(t.isReadonly?-1:39),c(),f(t.rangeData.length>0?40:-1),c(2),b("title",t.strings==null||t.strings.page==null||t.strings.page.key==null||t.strings.page.key.timeseries==null?null:t.strings.page.key.timeseries.info),c(),f(t.isReadonly?-1:43),c(2),f(t.alterMode?45:-1),c(2),j(t.infoLabels),c(2),f(t.tsLabels.length>0?49:-1),c(),f(t.tsRules.length>0?50:-1))},dependencies:[A,U,Te,Be,me,de,Kt,Vt,Et,It,q,ce,pe,Q,G,J,L,Se,we,De,Dt,Ie,Ve,Nt,Jt,Lt,Oe,je,Ae,Re,Pe,Le,Je],encapsulation:2})}return n})();var No=(n,r)=>r.key,Wo=(n,r)=>r.item;function zo(n,r){if(n&1){let e=C();o(0,"p3xr-ng-button",12),_("click",function(t){return d(e),s().refresh(),u(t.stopPropagation())}),l()}if(n&2){let e,i=s();b("label",(e=i.strings())==null||e.intention==null?null:e.intention.refresh)("breakpoint",1280)}}function $o(n,r){n&1&&T(0,"mat-divider")}function Ho(n,r){if(n&1&&(o(0,"mat-list-item")(1,"div",13)(2,"span",14),p(3),l(),o(4,"span",15),p(5),l()()(),y(6,$o,1,0,"mat-divider")),n&2){let e=r.$implicit,i=r.$index,t=r.$count;c(3),h(e.key),c(2),h(e.value),c(),f(i!==t-1?6:-1)}}function qo(n,r){if(n&1){let e=C();o(0,"mat-form-field",9)(1,"mat-label"),p(2),l(),o(3,"input",16),M("ngModelChange",function(t){d(e);let a=s();return K(a.itemInput,t)||(a.itemInput=t),u(t)}),_("keydown.enter",function(){d(e);let t=s();return u(t.addItem())}),l()()}if(n&2){let e,i=s();c(2),h((e=i.strings())==null||e.form==null||e.form.key==null||e.form.key.field==null?null:e.form.key.field.value),c(),E("ngModel",i.itemInput)}}function Uo(n,r){if(n&1){let e=C();o(0,"mat-form-field",10)(1,"mat-label"),p(2),l(),o(3,"input",17),M("ngModelChange",function(t){d(e);let a=s();return K(a.itemInput,t)||(a.itemInput=t),u(t)}),_("keydown.enter",function(){d(e);let t=s();return u(t.addItem())}),l()()}if(n&2){let e,i=s();c(2),h((e=i.strings())==null||e.page==null||e.page.key==null||e.page.key.probabilistic==null?null:e.page.key.probabilistic.item),c(),E("ngModel",i.itemInput)}}function Go(n,r){if(n&1){let e=C();o(0,"mat-form-field",11)(1,"mat-label"),p(2),l(),o(3,"input",18),M("ngModelChange",function(t){d(e);let a=s();return K(a.incrementInput,t)||(a.incrementInput=t),u(t)}),l()()}if(n&2){let e,i=s();c(2),h((e=i.strings())==null||e.form==null||e.form.key==null||e.form.key.field==null?null:e.form.key.field.increment),c(),E("ngModel",i.incrementInput)}}function Qo(n,r){if(n&1){let e=C();o(0,"mat-form-field",11)(1,"mat-label"),p(2),l(),o(3,"input",19),M("ngModelChange",function(t){d(e);let a=s();return K(a.quantileInput,t)||(a.quantileInput=t),u(t)}),_("keydown.enter",function(){d(e);let t=s();return u(t.queryQuantile())}),l()()}if(n&2){let e,i=s();c(2),h((e=i.strings())==null||e.page==null||e.page.key==null||e.page.key.probabilistic==null?null:e.page.key.probabilistic.quantile),c(),E("ngModel",i.quantileInput)}}function Zo(n,r){if(n&1){let e=C();o(0,"button",22),_("click",function(){d(e);let t=s(2);return u(t.addItem())}),o(1,"mat-icon"),p(2,"add"),l(),o(3,"span"),p(4),l()()}if(n&2){let e,i=s(2);c(4),h((e=i.strings())==null||e.intention==null?null:e.intention.add)}}function Xo(n,r){if(n&1){let e=C();o(0,"button",23),_("click",function(){d(e);let t=s(2);return u(t.addItem())}),o(1,"mat-icon"),p(2,"add"),l()()}if(n&2){let e,i=s(2);b("matTooltip",((e=i.strings())==null||e.intention==null?null:e.intention.add)??"Add")}}function Yo(n,r){if(n&1&&y(0,Zo,5,1,"button",20)(1,Xo,3,1,"button",21),n&2){let e=s();f(e.isGtSm?0:1)}}function er(n,r){if(n&1){let e=C();o(0,"button",22),_("click",function(){d(e);let t=s(2);return u(t.checkItem())}),o(1,"mat-icon"),p(2,"search"),l(),o(3,"span"),p(4),l()()}if(n&2){let e,i=s(2);c(4),h((e=i.strings())==null||e.page==null||e.page.key==null||e.page.key.probabilistic==null?null:e.page.key.probabilistic.checkItem)}}function tr(n,r){if(n&1){let e=C();o(0,"button",23),_("click",function(){d(e);let t=s(2);return u(t.checkItem())}),o(1,"mat-icon"),p(2,"search"),l()()}if(n&2){let e,i=s(2);b("matTooltip",((e=i.strings())==null||e.page==null||e.page.key==null||e.page.key.probabilistic==null?null:e.page.key.probabilistic.checkItem)??"Check")}}function ir(n,r){if(n&1&&y(0,er,5,1,"button",20)(1,tr,3,1,"button",21),n&2){let e=s();f(e.isGtSm?0:1)}}function nr(n,r){if(n&1){let e=C();o(0,"button",22),_("click",function(){d(e);let t=s(2);return u(t.deleteItem())}),o(1,"mat-icon"),p(2,"delete"),l(),o(3,"span"),p(4),l()()}if(n&2){let e,i=s(2);c(4),h((e=i.strings())==null||e.intention==null?null:e.intention.delete)}}function or(n,r){if(n&1){let e=C();o(0,"button",23),_("click",function(){d(e);let t=s(2);return u(t.deleteItem())}),o(1,"mat-icon"),p(2,"delete"),l()()}if(n&2){let e,i=s(2);b("matTooltip",((e=i.strings())==null||e.intention==null?null:e.intention.delete)??"Delete")}}function rr(n,r){if(n&1&&y(0,nr,5,1,"button",20)(1,or,3,1,"button",21),n&2){let e=s();f(e.isGtSm?0:1)}}function ar(n,r){if(n&1){let e=C();o(0,"button",22),_("click",function(){d(e);let t=s(2);return u(t.queryItem())}),o(1,"mat-icon"),p(2,"search"),l(),o(3,"span"),p(4),l()()}if(n&2){let e,i=s(2);c(4),h((e=i.strings())==null||e.page==null||e.page.key==null||e.page.key.probabilistic==null?null:e.page.key.probabilistic.queryCount)}}function lr(n,r){if(n&1){let e=C();o(0,"button",23),_("click",function(){d(e);let t=s(2);return u(t.queryItem())}),o(1,"mat-icon"),p(2,"search"),l()()}if(n&2){let e,i=s(2);b("matTooltip",((e=i.strings())==null||e.page==null||e.page.key==null||e.page.key.probabilistic==null?null:e.page.key.probabilistic.queryCount)??"Query")}}function sr(n,r){if(n&1&&y(0,ar,5,1,"button",20)(1,lr,3,1,"button",21),n&2){let e=s();f(e.isGtSm?0:1)}}function cr(n,r){if(n&1){let e=C();o(0,"button",22),_("click",function(){d(e);let t=s(2);return u(t.queryQuantile())}),o(1,"mat-icon"),p(2,"bar_chart"),l(),o(3,"span"),p(4),l()()}if(n&2){let e,i=s(2);c(4),h((e=i.strings())==null||e.page==null||e.page.key==null||e.page.key.probabilistic==null?null:e.page.key.probabilistic.quantile)}}function pr(n,r){if(n&1){let e=C();o(0,"button",23),_("click",function(){d(e);let t=s(2);return u(t.queryQuantile())}),o(1,"mat-icon"),p(2,"bar_chart"),l()()}if(n&2){let e,i=s(2);b("matTooltip",((e=i.strings())==null||e.page==null||e.page.key==null||e.page.key.probabilistic==null?null:e.page.key.probabilistic.quantile)??"Quantile")}}function mr(n,r){if(n&1&&y(0,cr,5,1,"button",20)(1,pr,3,1,"button",21),n&2){let e=s();f(e.isGtSm?0:1)}}function dr(n,r){if(n&1){let e=C();o(0,"button",26),_("click",function(){d(e);let t=s(2);return u(t.resetTdigest())}),o(1,"mat-icon"),p(2,"undo"),l(),o(3,"span"),p(4,"Reset"),l()()}}function ur(n,r){if(n&1){let e=C();o(0,"button",27),_("click",function(){d(e);let t=s(2);return u(t.resetTdigest())}),o(1,"mat-icon"),p(2,"undo"),l()()}}function _r(n,r){if(n&1&&y(0,dr,5,0,"button",24)(1,ur,3,0,"button",25),n&2){let e=s();f(e.isGtSm?0:1)}}function gr(n,r){n&1&&T(0,"mat-divider")}function xr(n,r){if(n&1&&(o(0,"mat-list-item")(1,"div",13)(2,"span",14),p(3),l(),o(4,"span",15),p(5),l()()(),y(6,gr,1,0,"mat-divider")),n&2){let e=r.$implicit,i=r.$index,t=r.$count;c(3),h(e.item),c(2),h(e.count),c(),f(i!==t-1?6:-1)}}function yr(n,r){if(n&1&&(T(0,"mat-divider"),o(1,"mat-list"),P(2,xr,7,3,null,null,Wo),l()),n&2){let e=s();c(2),j(e.topkItems)}}var mi=(()=>{class n extends ee{infoItems=[];topkItems=[];itemInput="";incrementInput=1;quantileInput=.5;autoRefresh=!1;autoRefreshInterval=null;readonly=!1;constructor(e,i,t,a,m,x,v,k,S,V){super(e,i,t,a,m,x,v,k,S,V)}get strings(){return this.i18n.strings}get type(){return this.p3xrResponse?.type||""}ngOnInit(){this.readonly=this.redisState.connection()?.readonly===!0,this.parseInfo(),this.type==="topk"&&this.loadTopkList()}ngOnChanges(e){e.p3xrValue&&this.parseInfo()}ngOnDestroy(){this.stopAutoRefresh(),this.destroyBase()}toggleAutoRefresh(){this.autoRefresh=!this.autoRefresh,this.autoRefresh?this.startAutoRefresh():this.stopAutoRefresh(),this.cdr.markForCheck()}startAutoRefresh(){this.stopAutoRefresh(),this.autoRefreshInterval=setInterval(()=>{this.refresh()},1e4)}stopAutoRefresh(){this.autoRefreshInterval&&(clearInterval(this.autoRefreshInterval),this.autoRefreshInterval=null)}parseInfo(){this.infoItems=[];try{let e=this.p3xrValue,i;typeof e=="object"&&e!==null&&!ArrayBuffer.isView(e)?i=e:typeof e=="string"?i=JSON.parse(e):ArrayBuffer.isView(e)&&(i=JSON.parse(new TextDecoder().decode(e))),i&&typeof i=="object"&&(this.infoItems=Object.entries(i).map(([t,a])=>({key:t,value:a})))}catch(e){}}addItem(){return w(this,null,function*(){if(this.itemInput.trim()){try{yield this.socket.request({action:"probabilistic/add",payload:{key:this.p3xrKey,type:this.type,item:this.itemInput.trim(),increment:this.incrementInput}}),this.common.toast(this.strings()?.page?.key?.probabilistic?.addedSuccessfully),this.itemInput="",this.refresh()}catch(e){this.common.toast(e.message||"Error")}this.cdr.markForCheck()}})}checkItem(){return w(this,null,function*(){if(this.itemInput.trim()){try{let e=yield this.socket.request({action:"probabilistic/check",payload:{key:this.p3xrKey,type:this.type,item:this.itemInput.trim()}}),i=this.strings(),t=e.result===1;this.common.toast(`"${this.itemInput}" \u2014 ${t?i?.page?.key?.probabilistic?.exists:i?.page?.key?.probabilistic?.doesNotExist}`)}catch(e){this.common.toast(e.message||"Error")}this.cdr.markForCheck()}})}deleteItem(){return w(this,null,function*(){if(this.itemInput.trim()){try{yield this.common.confirm({message:this.strings()?.confirm?.delete}),yield this.socket.request({action:"probabilistic/delete",payload:{key:this.p3xrKey,type:this.type,item:this.itemInput.trim()}}),this.common.toast(this.strings()?.page?.key?.probabilistic?.deletedSuccessfully),this.itemInput="",this.refresh()}catch(e){e?.message&&this.common.toast(e.message||"Error")}this.cdr.markForCheck()}})}queryItem(){return w(this,null,function*(){if(this.itemInput.trim()){try{let e=yield this.socket.request({action:"probabilistic/check",payload:{key:this.p3xrKey,type:this.type,item:this.itemInput.trim()}}),i=Array.isArray(e.result)?e.result[0]:e.result;this.common.toast(`"${this.itemInput}" \u2014 ${this.strings()?.page?.key?.probabilistic?.topkCount}: ${i}`)}catch(e){this.common.toast(e.message||"Error")}this.cdr.markForCheck()}})}queryQuantile(){return w(this,null,function*(){try{let e=yield this.socket.request({action:"probabilistic/check",payload:{key:this.p3xrKey,type:this.type,quantile:this.quantileInput}}),i=this.strings(),t=Array.isArray(e.result)?e.result[0]:e.result;this.common.toast(`${i?.page?.key?.probabilistic?.quantile} ${this.quantileInput} = ${t}`)}catch(e){this.common.toast(e.message||"Error")}this.cdr.markForCheck()})}resetTdigest(){return w(this,null,function*(){try{yield this.common.confirm({message:this.strings()?.page?.key?.probabilistic?.resetConfirm}),yield this.socket.request({action:"probabilistic/delete",payload:{key:this.p3xrKey,type:"tdigest"}}),this.common.toast("Reset"),this.refresh()}catch(e){e?.message&&this.common.toast(e.message||"Error")}this.cdr.markForCheck()})}loadTopkList(){return w(this,null,function*(){try{let e=yield this.socket.request({action:"probabilistic/check",payload:{key:this.p3xrKey,type:"topk"}});this.topkItems=e.result||[]}catch(e){this.topkItems=[]}this.cdr.markForCheck()})}refresh(){this.cmd.refreshKey$.next(),this.type==="topk"&&this.loadTopkList()}static \u0275fac=function(i){return new(i||n)(g(R),g(z),g($),g(Z),g(X),g(O),g(H),g(B),g(W),g(N))};static \u0275cmp=D({type:n,selectors:[["p3xr-key-probabilistic"]],features:[Y,te],decls:26,vars:16,consts:[[1,"p3xr-key-type-content"],["accordionKey","prob-info",3,"title"],["actions",""],[3,"click","label","mdIcon","breakpoint"],["mdIcon","refresh",3,"label","breakpoint"],["content",""],["accordionKey","prob-actions",3,"title"],[2,"padding","16px"],[1,"p3xr-timeseries-controls"],["subscriptSizing","dynamic",1,"p3xr-timeseries-field"],["subscriptSizing","dynamic",1,"p3xr-timeseries-field",2,"flex","1","min-width","200px"],["subscriptSizing","dynamic",1,"p3xr-timeseries-field",2,"max-width","120px"],["mdIcon","refresh",3,"click","label","breakpoint"],[2,"display","flex","width","100%"],[1,"p3xr-settings-label",2,"flex","1"],[1,"p3xr-settings-value"],["matInput","","type","number",3,"ngModelChange","keydown.enter","ngModel"],["matInput","",3,"ngModelChange","keydown.enter","ngModel"],["matInput","","type","number",3,"ngModelChange","ngModel"],["matInput","","type","number","step","0.1",3,"ngModelChange","keydown.enter","ngModel"],["mat-raised-button","","type","button",1,"btn-primary","p3xr-action-btn"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-primary",3,"matTooltip"],["mat-raised-button","","type","button",1,"btn-primary","p3xr-action-btn",3,"click"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-primary",3,"click","matTooltip"],["mat-raised-button","","type","button",1,"btn-warn","p3xr-action-btn"],["mat-mini-fab","","type","button","matTooltip","Reset","matTooltipPosition","above",1,"btn-warn"],["mat-raised-button","","type","button",1,"btn-warn","p3xr-action-btn",3,"click"],["mat-mini-fab","","type","button","matTooltip","Reset","matTooltipPosition","above",1,"btn-warn",3,"click"]],template:function(i,t){if(i&1&&(o(0,"div",0),T(1,"br"),o(2,"p3xr-ng-accordion",1)(3,"div",2)(4,"p3xr-ng-button",3),_("click",function(m){return t.toggleAutoRefresh(),m.stopPropagation()}),l(),y(5,zo,1,2,"p3xr-ng-button",4),l(),o(6,"div",5)(7,"mat-list"),P(8,Ho,7,3,null,null,No),l()()(),T(10,"br"),o(11,"p3xr-ng-accordion",6)(12,"div",5)(13,"div",7)(14,"div",8),y(15,qo,4,2,"mat-form-field",9)(16,Uo,4,2,"mat-form-field",10),y(17,Go,4,2,"mat-form-field",11),y(18,Qo,4,2,"mat-form-field",11),y(19,Yo,2,1),y(20,ir,2,1),y(21,rr,2,1),y(22,sr,2,1),y(23,mr,2,1),y(24,_r,2,1),l()(),y(25,yr,4,0),l()()()),i&2){let a,m,x;c(2),b("title",(a=t.strings())==null||a.page==null||a.page.key==null||a.page.key.probabilistic==null?null:a.page.key.probabilistic.info),c(2),b("label",(m=t.strings())==null||m.label==null?null:m.label.autoRefresh)("mdIcon",t.autoRefresh?"check_box":"check_box_outline_blank")("breakpoint",1280),c(),f(t.autoRefresh?-1:5),c(3),j(t.infoItems),c(3),b("title",t.p3xrResponse.type==="topk"?(x=t.strings())==null||x.page==null||x.page.key==null||x.page.key.probabilistic==null?null:x.page.key.probabilistic.topkList:(x=t.strings())==null||x.page==null||x.page.key==null||x.page.key.probabilistic==null?null:x.page.key.probabilistic.addItem),c(4),f(t.p3xrResponse.type==="tdigest"?15:16),c(2),f(t.p3xrResponse.type==="cms"?17:-1),c(),f(t.p3xrResponse.type==="tdigest"?18:-1),c(),f(t.readonly?-1:19),c(),f(t.p3xrResponse.type==="bloom"||t.p3xrResponse.type==="cuckoo"?20:-1),c(),f(t.p3xrResponse.type==="cuckoo"&&!t.readonly?21:-1),c(),f(t.p3xrResponse.type==="cms"?22:-1),c(),f(t.p3xrResponse.type==="tdigest"?23:-1),c(),f(t.p3xrResponse.type==="tdigest"&&!t.readonly?24:-1),c(),f(t.p3xrResponse.type==="topk"&&t.topkItems.length>0?25:-1)}},dependencies:[A,U,Te,Be,me,de,q,ce,pe,Q,G,J,L,Se,we,De,Ie,Ve,Oe,je,Ae,Re,Pe,Le,Je],encapsulation:2})}return n})();var fr=(n,r)=>r.key,di=(n,r)=>r.element;function hr(n,r){if(n&1){let e=C();o(0,"p3xr-ng-button",24),_("click",function(t){return d(e),s().refresh(),u(t.stopPropagation())}),l()}if(n&2){let e,i=s();b("label",(e=i.strings())==null||e.intention==null?null:e.intention.refresh)("breakpoint",1280)}}function Cr(n,r){n&1&&T(0,"mat-divider")}function br(n,r){if(n&1&&(o(0,"mat-list-item")(1,"div",25)(2,"span",26),p(3),l(),o(4,"span",27),p(5),l()()(),y(6,Cr,1,0,"mat-divider")),n&2){let e=r.$implicit,i=r.$index,t=r.$count;c(3),h(e.key),c(2),h(e.value),c(),f(i!==t-1?6:-1)}}function vr(n,r){if(n&1){let e=C();o(0,"button",28),_("click",function(){d(e);let t=s();return u(t.showAddForm=!t.showAddForm)}),o(1,"mat-icon"),p(2,"add"),l()()}}function kr(n,r){if(n&1){let e=C();o(0,"mat-icon",35),_("click",function(){d(e);let t=s().$implicit,a=s();return u(a.removeElement(t.element))}),p(1,"delete"),l()}}function wr(n,r){if(n&1){let e=C();o(0,"div",14)(1,"span",29),p(2),l(),o(3,"span",30),p(4),l(),o(5,"span",31)(6,"mat-icon",32),_("click",function(){let t=d(e).$implicit,a=s();return u(a.searchSimilarByElement(t.element))}),p(7,"search"),l(),o(8,"mat-icon",33),_("click",function(){let t=d(e).$implicit,a=s();return u(a.getAttributes(t.element))}),p(9,"info"),l(),y(10,kr,2,0,"mat-icon",34),l()()}if(n&2){let e=r.$implicit,i=s();c(2),h(e.element),c(2),h(e.score==null?null:e.score.toFixed(4)),c(6),f(i.readonly?-1:10)}}function Sr(n,r){if(n&1){let e=C();o(0,"button",40),_("click",function(){d(e);let t=s(2);return u(t.addElement())}),o(1,"mat-icon"),p(2,"add"),l(),o(3,"span"),p(4),l()()}if(n&2){let e,i=s(2);c(4),h((e=i.strings())==null||e.intention==null?null:e.intention.add)}}function Tr(n,r){if(n&1){let e=C();o(0,"button",41),_("click",function(){d(e);let t=s(2);return u(t.addElement())}),o(1,"mat-icon"),p(2,"add"),l()()}if(n&2){let e,i=s(2);b("matTooltip",((e=i.strings())==null||e.intention==null?null:e.intention.add)??"Add")}}function Vr(n,r){if(n&1){let e=C();o(0,"div",15)(1,"mat-form-field",19)(2,"mat-label"),p(3),l(),o(4,"input",36),M("ngModelChange",function(t){d(e);let a=s();return K(a.elementInput,t)||(a.elementInput=t),u(t)}),_("keydown.enter",function(){d(e);let t=s();return u(t.addElement())}),l()(),o(5,"mat-form-field",19)(6,"mat-label"),p(7),l(),o(8,"input",37),M("ngModelChange",function(t){d(e);let a=s();return K(a.vectorInput,t)||(a.vectorInput=t),u(t)}),_("keydown.enter",function(){d(e);let t=s();return u(t.addElement())}),l()(),y(9,Sr,5,1,"button",38)(10,Tr,3,1,"button",39),l()}if(n&2){let e,i,t=s();c(3),h((e=t.strings())==null||e.page==null||e.page.key==null||e.page.key.vectorset==null?null:e.page.key.vectorset.elementName),c(),E("ngModel",t.elementInput),c(3),h((i=t.strings())==null||i.page==null||i.page.key==null||i.page.key.vectorset==null?null:i.page.key.vectorset.vectorValues),c(),E("ngModel",t.vectorInput),c(),f(t.isGtSm?9:10)}}function Ir(n,r){if(n&1){let e=C();o(0,"mat-form-field",23)(1,"mat-label"),p(2),l(),o(3,"input",42),M("ngModelChange",function(t){d(e);let a=s();return K(a.simFilterInput,t)||(a.simFilterInput=t),u(t)}),_("keydown.enter",function(){d(e);let t=s();return u(t.searchSimilar())}),l()()}if(n&2){let e,i=s();c(2),h((e=i.strings())==null||e.page==null||e.page.key==null||e.page.key.vectorset==null?null:e.page.key.vectorset.filter),c(),E("ngModel",i.simFilterInput)}}function Er(n,r){if(n&1){let e=C();o(0,"button",40),_("click",function(){d(e);let t=s();return t.simMode="element",u(t.searchSimilar())}),o(1,"mat-icon"),p(2,"person"),l(),o(3,"span"),p(4),l()(),o(5,"button",40),_("click",function(){d(e);let t=s();return t.simMode="vector",u(t.searchSimilar())}),o(6,"mat-icon"),p(7,"data_array"),l(),o(8,"span"),p(9),l()()}if(n&2){let e,i,t=s();c(4),h((e=t.strings())==null||e.page==null||e.page.key==null||e.page.key.vectorset==null?null:e.page.key.vectorset.byElement),c(5),h((i=t.strings())==null||i.page==null||i.page.key==null||i.page.key.vectorset==null?null:i.page.key.vectorset.byVector)}}function Kr(n,r){if(n&1){let e=C();o(0,"button",41),_("click",function(){d(e);let t=s();return t.simMode="element",u(t.searchSimilar())}),o(1,"mat-icon"),p(2,"person"),l()(),o(3,"button",41),_("click",function(){d(e);let t=s();return t.simMode="vector",u(t.searchSimilar())}),o(4,"mat-icon"),p(5,"data_array"),l()()}if(n&2){let e,i,t=s();b("matTooltip",((e=t.strings())==null||e.page==null||e.page.key==null||e.page.key.vectorset==null?null:e.page.key.vectorset.byElement)??"By Element"),c(3),b("matTooltip",((i=t.strings())==null||i.page==null||i.page.key==null||i.page.key.vectorset==null?null:i.page.key.vectorset.byVector)??"By Vector")}}function Mr(n,r){n&1&&T(0,"mat-divider")}function Fr(n,r){if(n&1&&(o(0,"mat-list-item")(1,"div",25)(2,"span",44),p(3),l(),o(4,"span",27),p(5),l()()(),y(6,Mr,1,0,"mat-divider")),n&2){let e=r.$implicit,i=r.$index,t=r.$count;c(3),h(e.element),c(2),h(e.score),c(),f(i!==t-1?6:-1)}}function Dr(n,r){if(n&1&&(T(0,"mat-divider",43),o(1,"mat-list"),P(2,Fr,7,3,null,null,di),l()),n&2){let e=s();c(2),j(e.simResults)}}var ui=(()=>{class n extends ee{infoItems=[];elements=[];pagedElements=[];paging;simResults=[];elementInput="";vectorInput="";simQueryInput="";simCountInput=10;simFilterInput="";simMode="element";autoRefresh=!1;autoRefreshInterval=null;readonly=!1;showAddForm=!1;constructor(e,i,t,a,m,x,v,k,S,V){super(e,i,t,a,m,x,v,k,S,V),this.paging=new ae({settingsService:V})}updatePagedElements(){this.pagedElements=this.elements.slice(this.paging.startIndex,this.paging.endIndex)}get strings(){return this.i18n.strings}ngOnInit(){this.readonly=this.redisState.connection()?.readonly===!0,this.parseInfo(),this.loadElements()}ngOnChanges(e){e.p3xrValue&&this.parseInfo()}ngOnDestroy(){this.stopAutoRefresh(),this.destroyBase()}toggleAutoRefresh(){this.autoRefresh=!this.autoRefresh,this.autoRefresh?this.startAutoRefresh():this.stopAutoRefresh(),this.cdr.markForCheck()}startAutoRefresh(){this.stopAutoRefresh(),this.autoRefreshInterval=setInterval(()=>{this.refresh()},1e4)}stopAutoRefresh(){this.autoRefreshInterval&&(clearInterval(this.autoRefreshInterval),this.autoRefreshInterval=null)}parseInfo(){this.infoItems=[];try{let e=this.p3xrValue,i;typeof e=="object"&&e!==null&&!ArrayBuffer.isView(e)?i=e:typeof e=="string"?i=JSON.parse(e):ArrayBuffer.isView(e)&&(i=JSON.parse(new TextDecoder().decode(e))),i&&typeof i=="object"&&(this.infoItems=Object.entries(i).map(([t,a])=>({key:t,value:a})))}catch(e){}}loadElements(){return w(this,null,function*(){try{let e=yield this.socket.request({action:"vectorset/elements",payload:{key:this.p3xrKey}});this.elements=e.elements||[],this.paging.figurePaging(this.elements.length),this.updatePagedElements()}catch(e){this.elements=[],this.pagedElements=[]}this.cdr.markForCheck()})}searchSimilar(e,i){return w(this,null,function*(){let t=e||this.simQueryInput,a=i||this.simMode;if(t.trim()){try{let m=yield this.socket.request({action:"vectorset/sim",payload:{key:this.p3xrKey,query:t.trim(),count:this.simCountInput,mode:a,filter:this.simFilterInput.trim()||void 0}});this.simResults=m.results||[],this.common.toast(this.strings()?.page?.key?.vectorset?.searchComplete)}catch(m){this.common.toast(m.message||"Error"),this.simResults=[]}this.cdr.markForCheck()}})}searchSimilarByElement(e){this.simQueryInput=e,this.simMode="element",this.searchSimilar(e,"element")}addElement(){return w(this,null,function*(){if(!(!this.elementInput.trim()||!this.vectorInput.trim())){try{yield this.socket.request({action:"vectorset/add",payload:{key:this.p3xrKey,element:this.elementInput.trim(),vector:this.vectorInput.trim()}}),this.common.toast(this.strings()?.page?.key?.vectorset?.addedSuccessfully),this.elementInput="",this.vectorInput="",this.refresh()}catch(e){this.common.toast(e.message||"Error")}this.cdr.markForCheck()}})}removeElement(e){return w(this,null,function*(){try{yield this.common.confirm({message:this.strings()?.confirm?.delete}),yield this.socket.request({action:"vectorset/remove",payload:{key:this.p3xrKey,element:e}}),this.common.toast(this.strings()?.page?.key?.vectorset?.removedSuccessfully),this.refresh()}catch(i){i?.message&&this.common.toast(i.message)}this.cdr.markForCheck()})}getAttributes(e){return w(this,null,function*(){try{let t=(yield this.socket.request({action:"vectorset/getattr",payload:{key:this.p3xrKey,element:e}})).attributes;t?this.common.toast(`${e}: ${JSON.stringify(t)}`):this.common.toast(`${e}: ${this.strings()?.page?.key?.vectorset?.noAttributes}`)}catch(i){this.common.toast(i.message||"Error")}this.cdr.markForCheck()})}refresh(){this.cmd.refreshKey$.next(),this.loadElements()}static \u0275fac=function(i){return new(i||n)(g(R),g(z),g($),g(Z),g(X),g(O),g(H),g(B),g(W),g(N))};static \u0275cmp=D({type:n,selectors:[["p3xr-key-vectorset"]],features:[Y,te],decls:42,vars:20,consts:[[1,"p3xr-key-type-content"],["accordionKey","vs-info",3,"title"],["actions",""],[3,"click","label","mdIcon","breakpoint"],["mdIcon","refresh",3,"label","breakpoint"],["content",""],["accordionKey","vs-elements",3,"title"],[3,"pageChanged","paging"],[1,"p3xr-key-type-table"],[1,"p3xr-key-type-header"],[2,"flex","50%"],[2,"flex","20%"],[2,"flex","30%","text-align","right"],["mat-icon-button","","matTooltip","Add"],[1,"p3xr-key-type-row"],[1,"p3xr-timeseries-controls",2,"padding","16px"],["accordionKey","vs-sim",3,"title"],[2,"padding","16px"],[1,"p3xr-timeseries-controls"],["subscriptSizing","dynamic",1,"p3xr-timeseries-field",2,"flex","1","min-width","200px"],["matInput","",3,"ngModelChange","keydown.enter","ngModel","placeholder"],["subscriptSizing","dynamic",1,"p3xr-timeseries-field",2,"max-width","80px"],["matInput","","type","number",3,"ngModelChange","ngModel"],["subscriptSizing","dynamic",1,"p3xr-timeseries-field",2,"flex","1","min-width","150px"],["mdIcon","refresh",3,"click","label","breakpoint"],[2,"display","flex","width","100%"],[1,"p3xr-settings-label",2,"flex","1"],[1,"p3xr-settings-value"],["mat-icon-button","","matTooltip","Add",3,"click"],[1,"p3xr-key-col",2,"flex","50%"],[1,"p3xr-value-col",2,"flex","20%"],[1,"p3xr-key-type-row-actions",2,"flex","30%","text-align","right"],["matTooltip","Find similar",1,"icon-accent",3,"click"],["matTooltip","Attributes",1,"icon-accent",3,"click"],["matTooltip","Delete",1,"icon-warn"],["matTooltip","Delete",1,"icon-warn",3,"click"],["matInput","",3,"ngModelChange","keydown.enter","ngModel"],["matInput","","placeholder","0.1, 0.2, 0.3",3,"ngModelChange","keydown.enter","ngModel"],["mat-raised-button","","type","button",1,"btn-primary","p3xr-action-btn"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-primary",3,"matTooltip"],["mat-raised-button","","type","button",1,"btn-primary","p3xr-action-btn",3,"click"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-primary",3,"click","matTooltip"],["matInput","","placeholder","attr == 'value'",3,"ngModelChange","keydown.enter","ngModel"],[2,"margin","16px 0"],[1,"p3xr-settings-label",2,"flex","1","font-weight","bold"]],template:function(i,t){if(i&1&&(o(0,"div",0),T(1,"br"),o(2,"p3xr-ng-accordion",1)(3,"div",2)(4,"p3xr-ng-button",3),_("click",function(m){return t.toggleAutoRefresh(),m.stopPropagation()}),l(),y(5,hr,1,2,"p3xr-ng-button",4),l(),o(6,"div",5)(7,"mat-list"),P(8,br,7,3,null,null,fr),l()()(),T(10,"br"),o(11,"p3xr-ng-accordion",6)(12,"div",5)(13,"p3xr-key-pager-inline",7),_("pageChanged",function(){return t.updatePagedElements()}),l(),o(14,"div",8)(15,"div",9)(16,"span",10),p(17),l(),o(18,"span",11),p(19),l(),o(20,"span",12),y(21,vr,3,0,"button",13),l()(),P(22,wr,11,3,"div",14,di),l(),y(24,Vr,11,5,"div",15),l()(),T(25,"br"),o(26,"p3xr-ng-accordion",16)(27,"div",5)(28,"div",17)(29,"div",18)(30,"mat-form-field",19)(31,"mat-label"),p(32),l(),o(33,"input",20),M("ngModelChange",function(m){return K(t.simQueryInput,m)||(t.simQueryInput=m),m}),_("keydown.enter",function(){return t.searchSimilar()}),l()(),o(34,"mat-form-field",21)(35,"mat-label"),p(36),l(),o(37,"input",22),M("ngModelChange",function(m){return K(t.simCountInput,m)||(t.simCountInput=m),m}),l()(),y(38,Ir,4,2,"mat-form-field",23),y(39,Er,10,2)(40,Kr,6,2),l(),y(41,Dr,4,0),l()()()()),i&2){let a,m,x,v,k,S,V,F;c(2),b("title",(a=t.strings())==null||a.page==null||a.page.key==null||a.page.key.vectorset==null?null:a.page.key.vectorset.info),c(2),b("label",(m=t.strings())==null||m.label==null?null:m.label.autoRefresh)("mdIcon",t.autoRefresh?"check_box":"check_box_outline_blank")("breakpoint",1280),c(),f(t.autoRefresh?-1:5),c(3),j(t.infoItems),c(3),b("title",((x=t.strings())==null||x.page==null||x.page.key==null||x.page.key.vectorset==null?null:x.page.key.vectorset.elements)+" ("+t.elements.length+")"),c(2),b("paging",t.paging),c(4),h((v=t.strings())==null||v.page==null||v.page.key==null||v.page.key.vectorset==null?null:v.page.key.vectorset.element),c(2),h((k=t.strings())==null||k.page==null||k.page.key==null||k.page.key.vectorset==null?null:k.page.key.vectorset.score),c(2),f(t.readonly?-1:21),c(),j(t.pagedElements),c(2),f(!t.readonly&&t.showAddForm?24:-1),c(2),b("title",(S=t.strings())==null||S.page==null||S.page.key==null||S.page.key.vectorset==null?null:S.page.key.vectorset.similaritySearch),c(6),h(t.simMode==="element"?(V=t.strings())==null||V.page==null||V.page.key==null||V.page.key.vectorset==null?null:V.page.key.vectorset.elementName:(V=t.strings())==null||V.page==null||V.page.key==null||V.page.key.vectorset==null?null:V.page.key.vectorset.vectorValues),c(),E("ngModel",t.simQueryInput),b("placeholder",t.simMode==="vector"?"0.1, 0.2, 0.3":""),c(3),h((F=t.strings())==null||F.page==null||F.page.key==null||F.page.key.vectorset==null?null:F.page.key.vectorset.count),c(),E("ngModel",t.simCountInput),c(),f(t.redisState.redisVersion().isAtLeast(8,2)?38:-1),c(),f(t.isGtSm?39:40),c(2),f(t.simResults.length>0?41:-1)}},dependencies:[A,U,Te,Be,me,de,q,ce,pe,se,Q,G,J,L,Se,we,De,Ie,Ve,Oe,je,Ae,Re,Pe,Le,Je,_e],encapsulation:2})}return n})();var _i=et(fi()),gi=et(Ut());function Br(n,r){n&1&&(o(0,"div",0),T(1,"mat-spinner",1),l())}function Rr(n,r){if(n&1){let e=C();o(0,"button",20),_("click",function(t){d(e);let a=s(3);return u(a.addKey(t))}),o(1,"mat-icon"),p(2,"add"),l(),o(3,"span"),p(4),l()()}if(n&2){let e,i=s(3);c(4),h((e=i.strings())==null||e.intention==null?null:e.intention.addKey)}}function Pr(n,r){if(n&1){let e=C();o(0,"button",21),_("click",function(t){d(e);let a=s(3);return u(a.addKey(t))}),o(1,"mat-icon"),p(2,"add"),l()()}if(n&2){let e,i=s(3);b("matTooltip",((e=i.strings())==null||e.intention==null?null:e.intention.addKey)??"Add to this key")}}function jr(n,r){if(n&1){let e=C();o(0,"button",22),_("click",function(t){d(e);let a=s(3);return u(a.deleteKey(t))}),o(1,"mat-icon"),p(2,"delete"),l(),o(3,"span"),p(4),l()()}if(n&2){let e,i=s(3);c(4),h((e=i.strings())==null||e.intention==null?null:e.intention.delete)}}function Ar(n,r){if(n&1){let e=C();o(0,"button",23),_("click",function(t){d(e);let a=s(3);return u(a.deleteKey(t))}),o(1,"mat-icon"),p(2,"delete"),l()()}if(n&2){let e,i=s(3);b("matTooltip",((e=i.strings())==null||e.intention==null?null:e.intention.delete)??"Delete")}}function Or(n,r){if(n&1){let e=C();o(0,"button",24),_("click",function(t){d(e);let a=s(3);return u(a.setTtl(t))}),o(1,"mat-icon"),p(2,"timer"),l(),o(3,"span"),p(4),l()()}if(n&2){let e,i=s(3);c(4),h((e=i.strings())==null||e.intention==null?null:e.intention.ttl)}}function Lr(n,r){if(n&1){let e=C();o(0,"button",25),_("click",function(t){d(e);let a=s(3);return u(a.setTtl(t))}),o(1,"mat-icon"),p(2,"timer"),l()()}if(n&2){let e,i=s(3);b("matTooltip",((e=i.strings())==null||e.intention==null?null:e.intention.ttl)??"Set TTL")}}function Jr(n,r){if(n&1){let e=C();o(0,"button",24),_("click",function(t){d(e);let a=s(3);return u(a.rename(t))}),o(1,"mat-icon"),p(2,"fingerprint"),l(),o(3,"span"),p(4),l()()}if(n&2){let e,i=s(3);c(4),h((e=i.strings())==null||e.intention==null?null:e.intention.rename)}}function Nr(n,r){if(n&1){let e=C();o(0,"button",25),_("click",function(t){d(e);let a=s(3);return u(a.rename(t))}),o(1,"mat-icon"),p(2,"fingerprint"),l()()}if(n&2){let e,i=s(3);b("matTooltip",((e=i.strings())==null||e.intention==null?null:e.intention.rename)??"Rename")}}function Wr(n,r){if(n&1&&(y(0,Rr,5,1,"button",3)(1,Pr,3,1,"button",4),y(2,jr,5,1,"button",16)(3,Ar,3,1,"button",17),y(4,Or,5,1,"button",18)(5,Lr,3,1,"button",19),y(6,Jr,5,1,"button",18)(7,Nr,3,1,"button",19)),n&2){let e=s(2);f(e.isGtSm?0:1),c(2),f(e.isGtSm?2:3),c(2),f(e.isGtSm?4:5),c(2),f(e.isGtSm?6:7)}}function zr(n,r){if(n&1){let e=C();o(0,"button",20),_("click",function(){d(e);let t=s(2);return u(t.refresh())}),o(1,"mat-icon"),p(2,"refresh"),l(),o(3,"span"),p(4),l()()}if(n&2){let e,i=s(2);c(4),h((e=i.strings())==null||e.intention==null?null:e.intention.reloadKey)}}function $r(n,r){if(n&1){let e=C();o(0,"button",21),_("click",function(){d(e);let t=s(2);return u(t.refresh())}),o(1,"mat-icon"),p(2,"refresh"),l()()}if(n&2){let e,i=s(2);b("matTooltip",((e=i.strings())==null||e.intention==null?null:e.intention.reloadKey)??"Reload Key")}}function Hr(n,r){if(n&1&&(o(0,"span"),p(1),l()),n&2){let e,i=s(2);c(),h((e=i.strings())==null||e.page==null||e.page.key==null||e.page.key.label==null?null:e.page.key.label.ttlNotExpire)}}function qr(n,r){if(n&1&&(o(0,"span",9)(1,"span"),p(2),l(),T(3,"span",26),l()),n&2){let e=s(2);c(2),h(e.response.ttl)}}function Ur(n,r){if(n&1&&(o(0,"span",29),p(1),l()),n&2){let e=s(3);c(),ie("",e.response.compression.ratio,"%")}}function Gr(n,r){if(n&1&&(o(0,"span",30),p(1),l()),n&2){let e=s(3);c(),ie("",-e.response.compression.ratio,"%")}}function Qr(n,r){if(n&1&&(o(0,"div",11)(1,"strong"),p(2),l(),o(3,"span",27)(4,"span",28),p(5),l(),y(6,Ur,2,1,"span",29)(7,Gr,2,1,"span",30),l()()),n&2){let e,i=s(2);c(2),ie("",(e=i.strings())==null||e.page==null||e.page.key==null||e.page.key.label==null?null:e.page.key.label.compression,":"),c(3),h(i.response.compression.algorithm.toUpperCase()),c(),f(i.response.compression.ratio>=0?6:7)}}function Zr(n,r){if(n&1&&(o(0,"span"),p(1),l()),n&2){let e,i=s(2);c(),Ce(", ",i.response.length," ",(e=i.strings())==null||e.page==null||e.page.key==null||e.page.key.label==null?null:e.page.key.label.lengthItem)}}function Xr(n,r){if(n&1){let e=C();o(0,"div",13)(1,"strong",31),p(2),l(),o(3,"mat-button-toggle-group",32),M("ngModelChange",function(t){d(e);let a=s(2);return K(a.valueFormat,t)||(a.valueFormat=t),u(t)}),o(4,"mat-button-toggle",33),p(5,"Raw"),l(),o(6,"mat-button-toggle",34),p(7,"JSON"),l(),o(8,"mat-button-toggle",35),p(9,"Hex"),l(),o(10,"mat-button-toggle",36),p(11,"Base64"),l()()()}if(n&2){let e,i=s(2);c(2),ie("",(e=i.strings())==null||e.label==null?null:e.label.format,":"),c(),E("ngModel",i.valueFormat),c(3),re("border-left",i.dividerBorder),c(2),re("border-left",i.dividerBorder),c(2),re("border-left",i.dividerBorder)}}function Yr(n,r){if(n&1&&T(0,"p3xr-key-string",14),n&2){let e=s(2);b("p3xrResponse",e.response)("p3xrValue",e.response.value)("p3xrValueBuffer",e.response.valueBuffer)("p3xrKey",e.key)("valueFormat",e.valueFormat)}}function ea(n,r){if(n&1&&T(0,"p3xr-key-list",14),n&2){let e=s(2);b("p3xrResponse",e.response)("p3xrValue",e.response.value)("p3xrValueBuffer",e.response.valueBuffer)("p3xrKey",e.key)("valueFormat",e.valueFormat)}}function ta(n,r){if(n&1&&T(0,"p3xr-key-hash",14),n&2){let e=s(2);b("p3xrResponse",e.response)("p3xrValue",e.response.value)("p3xrValueBuffer",e.response.valueBuffer)("p3xrKey",e.key)("valueFormat",e.valueFormat)}}function ia(n,r){if(n&1&&T(0,"p3xr-key-set",14),n&2){let e=s(2);b("p3xrResponse",e.response)("p3xrValue",e.response.value)("p3xrValueBuffer",e.response.valueBuffer)("p3xrKey",e.key)("valueFormat",e.valueFormat)}}function na(n,r){if(n&1&&T(0,"p3xr-key-zset",14),n&2){let e=s(2);b("p3xrResponse",e.response)("p3xrValue",e.response.value)("p3xrValueBuffer",e.response.valueBuffer)("p3xrKey",e.key)("valueFormat",e.valueFormat)}}function oa(n,r){if(n&1&&T(0,"p3xr-key-stream",14),n&2){let e=s(2);b("p3xrResponse",e.response)("p3xrValue",e.response.value)("p3xrValueBuffer",e.response.valueBuffer)("p3xrKey",e.key)("valueFormat",e.valueFormat)}}function ra(n,r){if(n&1&&T(0,"p3xr-key-json",14),n&2){let e=s(2);b("p3xrResponse",e.response)("p3xrValue",e.response.value)("p3xrValueBuffer",e.response.valueBuffer)("p3xrKey",e.key)("valueFormat",e.valueFormat)}}function aa(n,r){if(n&1&&T(0,"p3xr-key-timeseries",14),n&2){let e=s(2);b("p3xrResponse",e.response)("p3xrValue",e.response.value)("p3xrValueBuffer",e.response.valueBuffer)("p3xrKey",e.key)("valueFormat",e.valueFormat)}}function la(n,r){if(n&1&&T(0,"p3xr-key-probabilistic",14),n&2){let e=s(2);b("p3xrResponse",e.response)("p3xrValue",e.response.value)("p3xrValueBuffer",e.response.valueBuffer)("p3xrKey",e.key)("valueFormat",e.valueFormat)}}function sa(n,r){if(n&1&&T(0,"p3xr-key-probabilistic",14),n&2){let e=s(2);b("p3xrResponse",e.response)("p3xrValue",e.response.value)("p3xrValueBuffer",e.response.valueBuffer)("p3xrKey",e.key)("valueFormat",e.valueFormat)}}function ca(n,r){if(n&1&&T(0,"p3xr-key-probabilistic",14),n&2){let e=s(2);b("p3xrResponse",e.response)("p3xrValue",e.response.value)("p3xrValueBuffer",e.response.valueBuffer)("p3xrKey",e.key)("valueFormat",e.valueFormat)}}function pa(n,r){if(n&1&&T(0,"p3xr-key-probabilistic",14),n&2){let e=s(2);b("p3xrResponse",e.response)("p3xrValue",e.response.value)("p3xrValueBuffer",e.response.valueBuffer)("p3xrKey",e.key)("valueFormat",e.valueFormat)}}function ma(n,r){if(n&1&&T(0,"p3xr-key-probabilistic",14),n&2){let e=s(2);b("p3xrResponse",e.response)("p3xrValue",e.response.value)("p3xrValueBuffer",e.response.valueBuffer)("p3xrKey",e.key)("valueFormat",e.valueFormat)}}function da(n,r){if(n&1&&T(0,"p3xr-key-vectorset",14),n&2){let e=s(2);b("p3xrResponse",e.response)("p3xrValue",e.response.value)("p3xrValueBuffer",e.response.valueBuffer)("p3xrKey",e.key)("valueFormat",e.valueFormat)}}function ua(n,r){if(n&1&&(o(0,"div",15),p(1),l()),n&2){let e,i=s(2);c(),ie(" ",(e=i.strings())==null||e.page==null||e.page.key==null||e.page.key.probabilistic==null?null:e.page.key.probabilistic.noItems," ")}}function _a(n,r){if(n&1){let e=C();o(0,"div",2),y(1,Wr,8,4),y(2,zr,5,1,"button",3)(3,$r,3,1,"button",4),l(),o(4,"div",5)(5,"div",6),_("click",function(t){d(e);let a=s();return u(a.rename(t))}),o(6,"strong"),p(7),l(),o(8,"span",7),p(9),l()(),o(10,"div",8),_("click",function(t){d(e);let a=s();return u(a.setTtl(t))}),o(11,"strong"),p(12),l(),y(13,Hr,2,1,"span")(14,qr,4,1,"span",9),l(),o(15,"div",10)(16,"strong"),p(17),l(),o(18,"span"),p(19),l()(),o(20,"div",10)(21,"strong"),p(22),l(),o(23,"span"),p(24),l()(),y(25,Qr,8,3,"div",11),o(26,"div",10)(27,"strong"),p(28),l(),o(29,"span")(30,"span",12),p(31),l(),p(32),y(33,Zr,2,2,"span"),l()(),y(34,Xr,12,8,"div",13),l(),y(35,Yr,1,5,"p3xr-key-string",14)(36,ea,1,5,"p3xr-key-list",14)(37,ta,1,5,"p3xr-key-hash",14)(38,ia,1,5,"p3xr-key-set",14)(39,na,1,5,"p3xr-key-zset",14)(40,oa,1,5,"p3xr-key-stream",14)(41,ra,1,5,"p3xr-key-json",14)(42,aa,1,5,"p3xr-key-timeseries",14)(43,la,1,5,"p3xr-key-probabilistic",14)(44,sa,1,5,"p3xr-key-probabilistic",14)(45,ca,1,5,"p3xr-key-probabilistic",14)(46,pa,1,5,"p3xr-key-probabilistic",14)(47,ma,1,5,"p3xr-key-probabilistic",14)(48,da,1,5,"p3xr-key-vectorset",14)(49,ua,2,1,"div",15)}if(n&2){let e,i,t,a,m,x,v,k,S=s();c(),f(S.isReadonly?-1:1),c(),f(S.isGtSm?2:3),c(5),ie("",(e=S.strings())==null||e.page==null||e.page.key==null||e.page.key.label==null?null:e.page.key.label.key,":"),c(),b("title",S.key),c(),h(S.key),c(3),ie("",(i=S.strings())==null||i.page==null||i.page.key==null||i.page.key.label==null?null:i.page.key.label.ttl,":"),c(),f(S.response.ttl===-1?13:14),c(4),ie("",(t=S.strings())==null||t.page==null||t.page.key==null||t.page.key.label==null?null:t.page.key.label.type,":"),c(2),h((a=S.strings())==null||a.redisTypes==null?null:a.redisTypes[S.response.type]),c(3),ie("",(m=S.strings())==null||m.page==null||m.page.key==null||m.page.key.label==null?null:m.page.key.label.encoding,":"),c(2),h(S.response.encoding),c(),f(S.response.compression?25:-1),c(3),ie("",(x=S.strings())==null||x.page==null||x.page.key==null||x.page.key.label==null?null:x.page.key.label.length,":"),c(3),ie("",S.charactersPrettyBytes(S.response.size),"\xA0"),c(),Ce(" ",S.response.size,"\xA0",(v=S.strings())==null||v.page==null||v.page.key==null||v.page.key.label==null?null:v.page.key.label.lengthString," "),c(),f(S.response.length?33:-1),c(),f(S.response.type!=="timeseries"&&S.response.type!=="json"&&S.response.type!=="bloom"&&S.response.type!=="cuckoo"&&S.response.type!=="topk"&&S.response.type!=="cms"&&S.response.type!=="tdigest"&&S.response.type!=="vectorset"?34:-1),c(),f((k=S.response.type)==="string"?35:k==="list"?36:k==="hash"?37:k==="set"?38:k==="zset"?39:k==="stream"?40:k==="json"?41:k==="timeseries"?42:k==="bloom"?43:k==="cuckoo"?44:k==="topk"?45:k==="cms"?46:k==="tdigest"?47:k==="vectorset"?48:49)}}var N0=(()=>{class n{ngZone;breakpointObserver;i18n;socket;common;cmd;theme;ttlDialog;nav;route;cdr;state;settings;loading=!1;response=null;key="";isReadonly=!1;isGtSm=!0;valueFormat="raw";strings;get dividerBorder(){let e=this.theme.currentTheme()??"";return`solid 1px ${e.includes("Dark")||e.includes("Matrix")?"rgba(255,255,255,0.12)":"rgba(0,0,0,0.12)"}`}ttlInterval;wasExpiring=!1;unsubFns=[];constructor(e,i,t,a,m,x,v,k,S,V,F,I,ne){this.ngZone=e,this.breakpointObserver=i,this.i18n=t,this.socket=a,this.common=m,this.cmd=x,this.theme=v,this.ttlDialog=k,this.nav=S,this.route=V,this.cdr=F,this.state=I,this.settings=ne,this.strings=this.i18n.strings,ze(()=>{this.theme.currentTheme(),this.key&&(this.removeHighlight(),this.generateHighlight())})}ngOnInit(){this.key=this.getStateParam("key")||"",this.isReadonly=this.state.connection()?.readonly===!0;let e=this.breakpointObserver.observe("(min-width: 960px)").subscribe(a=>{this.isGtSm=a.matches,this.cdr.markForCheck()});this.unsubFns.push(()=>e.unsubscribe()),this.loadKey(),this.generateHighlight();let i=this.cmd.refreshKey$.subscribe(()=>{this.refresh({withoutParent:!0})});this.unsubFns.push(()=>i.unsubscribe());let t=this.route.paramMap.subscribe(a=>{let m=a.get("key")||"";m&&m!==this.key&&(this.key=m,this.loadKey(),this.generateHighlight(),this.cdr.markForCheck())});this.unsubFns.push(()=>t.unsubscribe())}ngOnDestroy(){this.clearTtlInterval(),this.removeHighlight(),this.unsubFns.forEach(e=>e())}addKey(e){e.stopPropagation(),this.cmd.keyNew$.next({event:e,node:{key:this.key}})}deleteKey(e){this.cmd.keyDelete$.next({key:this.key,event:e})}rename(e){this.cmd.keyRename$.next({key:this.key,event:e})}setTtl(e){return w(this,null,function*(){try{let i=yield this.ttlDialog.show({$event:e,model:{ttl:this.response.ttl===-1?"":this.response.ttl}});if(i===void 0)return;let t=String(i.model.ttl).trim();t===""||i.model.ttl==null?(yield this.socket.request({action:"key/persist",payload:{key:this.key}}),this.gtag("/persist"),yield this.cmd.refresh(),yield this.refresh({withoutParent:!0}),this.common.toast(this.i18n.strings().status.persisted)):/^-?\d+$/.test(t)?(yield this.socket.request({action:"key/expire",payload:{key:this.key,ttl:parseInt(t)}}),this.gtag("/expire"),yield this.cmd.refresh(),yield this.refresh({withoutParent:!0}),this.common.toast(this.i18n.strings().status.ttlChanged)):this.common.toast(this.i18n.strings().status.notInteger)}catch(i){this.common.generalHandleError(i)}})}refresh(){return w(this,arguments,function*(e={}){this.gtag("/refresh"),yield this.loadKey(e)})}charactersPrettyBytes(e){return!e||e<1024?"":"("+(this.settings.prettyBytes(e)??"")+")"}loadKey(){return w(this,arguments,function*(e={}){this.clearTtlInterval();let i;try{let t=yield this.socket.request({action:"key/get",payload:{key:this.key}});if(this.response=t,t.ttl===-2){this.checkTtl();return}t.size=0,this.decodeValueBuffer(t),this.calculateSize(t),t.ttl>-1&&(this.wasExpiring=!0),this.loadTtl()}catch(t){i=t,console.error(t),t?.message==="Connection is closed."?(this.state.connection.set(void 0),this.common.alert(t?.message??String(t))):this.common.alert(this.i18n.strings().label.unableToLoadKey({key:this.key}))}finally{if(i)this.navigateTo("database.statistics");else if(!e.withoutParent){let t=this.getStateParam("resize");t&&t()}this.loading=!1,this.cdr.markForCheck()}})}toBytes(e){return e instanceof Uint8Array||e instanceof ArrayBuffer?e instanceof ArrayBuffer?new Uint8Array(e):e:e&&e.type==="Buffer"&&Array.isArray(e.data)?new Uint8Array(e.data):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}decodeValueBuffer(e){let{type:i,valueBuffer:t}=e,a=new TextDecoder;switch(i){case"string":e.value=a.decode(this.toBytes(t));break;case"list":case"set":e.value=t.map(v=>a.decode(this.toBytes(v)));break;case"hash":e.value={},Object.entries(t).forEach(([v,k])=>{e.value[v]=a.decode(this.toBytes(k))});break;case"zset":e.value=[];for(let v=0;v<t.length;v+=2)e.value.push(a.decode(this.toBytes(t[v]))),e.value.push(a.decode(t[v+1]));break;case"json":let m=a.decode(this.toBytes(t));try{let v=JSON.parse(m),k=Array.isArray(v)?v[0]:v;e.value=JSON.stringify(k,null,this.settings.jsonFormat()??2)}catch(v){e.value=m}break;case"stream":let x=v=>v.map(k=>Array.isArray(k)?x(k):ArrayBuffer.isView(k)||k instanceof ArrayBuffer?a.decode(k):k);e.value=t.map(v=>x(v));break;case"timeseries":try{e.value=JSON.parse(a.decode(this.toBytes(t)))}catch(v){e.value={}}break;case"bloom":case"cuckoo":case"topk":case"cms":case"tdigest":case"vectorset":try{e.value=JSON.parse(a.decode(this.toBytes(t)))}catch(v){e.value={}}break;default:try{e.value=JSON.parse(a.decode(this.toBytes(t)))}catch(v){e.value=a.decode(this.toBytes(t))}break}}calculateSize(e){if(e.type!=="stream")if(typeof e.valueBuffer=="object"&&e.length>0)for(let i of Object.keys(e.valueBuffer))e.size+=e.valueBuffer[i].byteLength;else if(Array.isArray(e.valueBuffer))for(let i of e.valueBuffer)e.size+=i.byteLength;else e.size=e.valueBuffer.byteLength;else{let i=t=>{let a=0,m=x=>{ArrayBuffer.isView(x)||x instanceof ArrayBuffer?a+=x.byteLength:Array.isArray(x)&&x.forEach(m)};return t.forEach(m),a};e.size=i(e.valueBuffer)}}loadTtl(){if(!this.response||this.response.ttl<=-1)return;let e=()=>{if(!this.checkTtl()){this.clearTtlInterval();return}let i=this.settings.getHumanizeDurationOptions(),t=" "+(0,gi.default)(this.response.ttl*1e3,Ke(Ee({},i),{delimiter:" "})),a=document.getElementById("p3xr-database-key-ttl-counter");a&&(a.innerText=t)};e(),this.state.reducedFunctions()||(this.clearTtlInterval(),this.ttlInterval=setInterval(()=>{this.response.ttl--,e(),this.cdr.markForCheck()},1e3))}checkTtl(){return this.response.ttl<-1||this.wasExpiring&&this.response.ttl<1?(this.common.toast(this.i18n.strings().status.keyIsNotExisting),this.clearTtlInterval(),this.state.redisChanged.set(!0),this.navigateTo("database.statistics"),!1):!0}clearTtlInterval(){this.ttlInterval&&(clearInterval(this.ttlInterval),this.ttlInterval=null)}generateHighlight(){this.removeHighlight();let e=this.theme.currentTheme()??"",i=e.includes("Dark")||e.includes("Matrix"),t=i?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)",a=i?"white":"black",m=document.createElement("style");m.id="p3xr-theme-styles-tree-key",m.textContent=`[data-p3xr-tree-key="${(0,_i.htmlEncode)(this.key)??""}"] .p3xr-database-tree-node-label {
background-color: ${t} !important;
color: ${a} !important;
padding: 2px;
}`,document.head.appendChild(m)}removeHighlight(){document.getElementById("p3xr-theme-styles-tree-key")?.remove()}getStateParam(e){return this.route.snapshot.paramMap.get(e)}navigateTo(e,i){this.nav.navigateTo(e,i)}gtag(e){try{typeof window.gtag=="function"&&window.gtag("config",this.settings.googleAnalytics,{page_path:e})}catch(i){}}static \u0275fac=function(i){return new(i||n)(g(_t),g(O),g(R),g(z),g($),g(H),g(zt),g(Ze),g(Bt),g(St),g(B),g(W),g(N))};static \u0275cmp=D({type:n,selectors:[["p3xr-database-key"]],decls:2,vars:2,consts:[[1,"p3xr-database-key-loading"],["diameter","40"],[1,"p3xr-database-key-actions"],["mat-raised-button","","type","button",1,"btn-accent","p3xr-action-btn"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-accent",3,"matTooltip"],[1,"p3xr-database-key-info"],[1,"p3xr-database-key-info-row","p3xr-database-key-info-row-clickable",3,"click"],[1,"p3xr-typography-ellipsis",3,"title"],[1,"p3xr-database-key-info-row","p3xr-database-key-info-row-clickable","p3xr-database-key-ttl-row",3,"click"],[1,"p3xr-database-key-ttl-value"],[1,"p3xr-database-key-info-row"],[1,"p3xr-database-key-info-row","p3xr-database-key-compression-row"],[2,"opacity","0.5"],[1,"p3xr-database-key-info-row",2,"display","flex","align-items","center"],[3,"p3xrResponse","p3xrValue","p3xrValueBuffer","p3xrKey","valueFormat"],[1,"p3xr-key-type-content",2,"padding","16px","opacity","0.7"],["mat-raised-button","","type","button",1,"btn-warn","p3xr-action-btn"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-warn",3,"matTooltip"],["mat-raised-button","","type","button",1,"btn-primary","p3xr-action-btn"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-primary",3,"matTooltip"],["mat-raised-button","","type","button",1,"btn-accent","p3xr-action-btn",3,"click"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-accent",3,"click","matTooltip"],["mat-raised-button","","type","button",1,"btn-warn","p3xr-action-btn",3,"click"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-warn",3,"click","matTooltip"],["mat-raised-button","","type","button",1,"btn-primary","p3xr-action-btn",3,"click"],["mat-mini-fab","","type","button","matTooltipPosition","above",1,"btn-primary",3,"click","matTooltip"],["id","p3xr-database-key-ttl-counter",1,"p3xr-database-key-ttl-hint"],[1,"p3xr-compression-badge"],[1,"p3xr-compression-algorithm"],[1,"p3xr-compression-ratio-badge","p3xr-compression-good"],[1,"p3xr-compression-ratio-badge","p3xr-compression-bad"],[2,"flex","1"],["hideSingleSelectionIndicator","",1,"p3xr-format-toggle",3,"ngModelChange","ngModel"],["value","raw"],["value","json"],["value","hex"],["value","base64"]],template:function(i,t){i&1&&(y(0,Br,2,0,"div",0),y(1,_a,50,19)),i&2&&(f(t.loading?0:-1),c(),f(!t.loading&&t.response?1:-1))},dependencies:[A,U,me,de,q,ce,pe,Q,G,J,L,Zt,Qt,qt,$t,Ht,ei,ii,ni,oi,ri,ai,li,pi,mi,ui],styles:[`.p3xr-database-key-loading{display:flex;justify-content:center;align-items:center;min-height:100%;padding:32px}.p3xr-database-key-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:8px;padding:4px 8px}.p3xr-database-key-info{border-top:1px solid rgba(255,255,255,.12)}body.p3xr-theme-light .p3xr-database-key-info{border-top-color:#0000001f}.p3xr-database-key-info-row{display:flex;justify-content:space-between;align-items:baseline;padding:12px 16px;border-bottom:1px solid rgba(255,255,255,.12)}.p3xr-database-key-info-row strong{white-space:nowrap;margin-right:16px}.p3xr-database-key-info-row span{text-align:right;overflow:hidden;text-overflow:ellipsis;-webkit-user-select:text;user-select:text}body.p3xr-theme-light .p3xr-database-key-info-row{border-bottom-color:#0000001f}.p3xr-database-key-info-row-clickable{cursor:pointer}.p3xr-database-key-info-row-clickable:hover{background-color:#ffffff1a!important}body.p3xr-theme-light .p3xr-database-key-info-row-clickable:hover{background-color:#0000001a!important}.p3xr-database-key-ttl-value{display:flex;flex-direction:column;align-items:flex-end}.p3xr-database-key-ttl-hint{opacity:.5;font-size:.85em;font-weight:400}.p3xr-compression-badge{display:inline-flex;align-items:center;gap:6px}.p3xr-compression-algorithm{background-color:var(--p3xr-btn-accent-bg);color:var(--p3xr-btn-accent-color);padding:2px 6px;border-radius:4px;font-size:11px;font-weight:700;letter-spacing:.5px}.p3xr-compression-ratio-badge{padding:2px 6px;border-radius:4px;font-size:11px;font-weight:700}.p3xr-compression-good{background-color:var(--mat-sys-primary, #4caf50);color:var(--p3xr-btn-primary-color)}.p3xr-compression-bad{background-color:var(--p3xr-btn-warn-bg, #f44336);color:var(--p3xr-btn-warn-color)}.p3xr-format-toggle{border-radius:4px!important;overflow:hidden!important;box-shadow:none!important}.p3xr-format-toggle .mat-button-toggle{height:32px!important;border-radius:0!important}.p3xr-format-toggle .mat-button-toggle .mat-button-toggle-button{height:32px!important;font-size:13px!important;padding:0 12px!important;display:flex!important;align-items:center!important;justify-content:center!important;border-radius:0!important}.p3xr-format-toggle .mat-button-toggle:first-child{border-radius:4px 0 0 4px!important}.p3xr-format-toggle .mat-button-toggle:last-child{border-radius:0 4px 4px 0!important}
`,`.p3xr-key-type-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:8px;padding:4px 8px}.p3xr-key-type-content{padding:8px 16px 24px}.p3xr-key-type-textarea{width:100%;font-family:monospace;font-size:13px;background:var(--p3xr-input-bg);color:var(--p3xr-input-color);border:1px solid var(--p3xr-fieldset-border);border-radius:4px;padding:8px;resize:vertical}.p3xr-key-type-value{white-space:pre-wrap;word-break:break-all;padding:8px;margin:0;font-size:13px}.p3xr-key-type-display{padding:8px}.p3xr-key-type-editor{width:100%}.p3xr-key-type-editor textarea{font-family:Roboto Mono,monospace;font-size:13px}.p3xr-key-type-buffer-info{padding:8px;opacity:.7;font-style:italic}.p3xr-key-type-table{width:100%}.p3xr-key-type-header{display:flex;align-items:center;gap:8px;padding:8px 16px;font-weight:700;background-color:var(--p3xr-btn-primary-bg);color:var(--p3xr-btn-primary-color);border-bottom:2px solid var(--p3xr-list-border)}.p3xr-key-type-header .mat-mdc-icon-button{color:var(--p3xr-btn-primary-color)!important}.p3xr-key-type-row{display:flex;align-items:flex-start;gap:8px;padding:6px 16px;border-bottom:1px solid var(--p3xr-list-border)}.p3xr-key-type-row:hover{background-color:var(--p3xr-hover-bg)}.p3xr-key-type-row:nth-child(odd){background-color:var(--p3xr-list-odd-bg)}.p3xr-key-type-row:nth-child(odd):hover{background-color:var(--p3xr-hover-bg)}.p3xr-key-type-row .p3xr-key-col{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-user-select:text;user-select:text}.p3xr-key-type-row .p3xr-value-col{overflow-x:hidden;overflow-y:auto;max-height:200px;white-space:pre-wrap;word-break:break-all;-webkit-user-select:text;user-select:text}.p3xr-key-type-row .p3xr-value-col::-webkit-scrollbar{width:6px}.p3xr-key-type-row .p3xr-value-col::-webkit-scrollbar-track{background:transparent}.p3xr-key-type-row .p3xr-value-col::-webkit-scrollbar-thumb{background:transparent;border-radius:3px}.p3xr-key-type-row .p3xr-value-col:hover::-webkit-scrollbar-thumb{background:#80808066}.p3xr-key-type-row-actions{white-space:nowrap!important}.p3xr-key-type-row-actions mat-icon{cursor:pointer;font-size:24px;width:24px;height:24px;margin:0 2px;opacity:.7}.p3xr-key-type-row-actions mat-icon:hover{opacity:1}.p3xr-key-type-row-actions .icon-warn{color:var(--p3xr-btn-warn-bg)}.p3xr-key-type-row-actions .icon-accent{color:var(--p3xr-btn-accent-bg)}.p3xr-key-type-row-actions .icon-primary{color:var(--p3xr-btn-primary-bg)}.p3xr-key-stream-entry-block{border-bottom:1px solid var(--p3xr-list-border)}.p3xr-key-stream-entry-block:nth-child(odd){background-color:var(--p3xr-list-odd-bg)}.p3xr-key-stream-entry-block:hover{background-color:var(--p3xr-hover-bg)}.p3xr-key-stream-entry-header{display:flex;align-items:center;justify-content:space-between;padding:6px 16px;font-size:13px}.p3xr-key-stream-timestamp{display:flex;align-items:center;gap:12px}.p3xr-key-stream-timestamp-human{opacity:.5;font-size:12px}.p3xr-key-stream-data{padding:0 16px 8px;overflow:auto;max-height:300px}.p3xr-timeseries-controls{display:flex;flex-wrap:wrap;align-items:flex-start;gap:12px;padding:8px 0}.p3xr-timeseries-field{min-width:140px;max-width:200px}.p3xr-timeseries-chart-container{width:100%;min-height:400px}.p3xr-timeseries-chart-info{padding:4px 0;opacity:.6;font-size:13px}.p3xr-timeseries-info-key{min-width:180px;flex-shrink:0}.p3xr-timeseries-info-value{word-break:break-all}
`],encapsulation:2,changeDetection:0})}return n})();export{N0 as DatabaseKeyComponent};