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
1 lines • 17.2 kB
JavaScript
import{a as e,ht as t}from"./i18n.store-B-qxQMr8.js";import{i as n,n as r}from"./socket.service-DpzqLYDp.js";new TextEncoder;var i=4096;function a(e,t,n){let r=t,a=r+n,o=[],s=``;for(;r<a;){let t=e[r++];if(!(t&128))o.push(t);else if((t&224)==192){let n=e[r++]&63;o.push((t&31)<<6|n)}else if((t&240)==224){let n=e[r++]&63,i=e[r++]&63;o.push((t&31)<<12|n<<6|i)}else if((t&248)==240){let n=e[r++]&63,i=e[r++]&63,a=e[r++]&63,s=(t&7)<<18|n<<12|i<<6|a;s>65535&&(s-=65536,o.push(s>>>10&1023|55296),s=56320|s&1023),o.push(s)}else o.push(t);o.length>=i&&(s+=String.fromCharCode(...o),o.length=0)}return o.length>0&&(s+=String.fromCharCode(...o)),s}var o=new TextDecoder,s=200;function c(e,t,n){let r=e.subarray(t,t+n);return o.decode(r)}function l(e,t,n){return n>s?c(e,t,n):a(e,t,n)}var u=class{type;data;constructor(e,t){this.type=e,this.data=t}},d=class e extends Error{constructor(t){super(t);let n=Object.create(e.prototype);Object.setPrototypeOf(this,n),Object.defineProperty(this,`name`,{configurable:!0,enumerable:!1,value:e.name})}};function ee(e,t,n){let r=Math.floor(n/4294967296),i=n;e.setUint32(t,r),e.setUint32(t+4,i)}function f(e,t){let n=e.getInt32(t),r=e.getUint32(t+4);return n*4294967296+r}function p(e,t){let n=e.getUint32(t),r=e.getUint32(t+4);return n*4294967296+r}var m=4294967295,h=17179869183;function g({sec:e,nsec:t}){if(e>=0&&t>=0&&e<=h)if(t===0&&e<=m){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e),t}else{let n=e/4294967296,r=e&4294967295,i=new Uint8Array(8),a=new DataView(i.buffer);return a.setUint32(0,t<<2|n&3),a.setUint32(4,r),i}else{let n=new Uint8Array(12),r=new DataView(n.buffer);return r.setUint32(0,t),ee(r,4,e),n}}function te(e){let t=e.getTime(),n=Math.floor(t/1e3),r=(t-n*1e3)*1e6,i=Math.floor(r/1e9);return{sec:n+i,nsec:r-i*1e9}}function ne(e){return e instanceof Date?g(te(e)):null}function re(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{let e=t.getUint32(0),n=t.getUint32(4);return{sec:(e&3)*4294967296+n,nsec:e>>>2}}case 12:return{sec:f(t,4),nsec:t.getUint32(0)};default:throw new d(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${e.length}`)}}function ie(e){let t=re(e);return new Date(t.sec*1e3+t.nsec/1e6)}var _={type:-1,encode:ne,decode:ie},ae=class e{static defaultCodec=new e;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(_)}register({type:e,encode:t,decode:n}){if(e>=0)this.encoders[e]=t,this.decoders[e]=n;else{let r=-1-e;this.builtInEncoders[r]=t,this.builtInDecoders[r]=n}}tryToEncode(e,t){for(let n=0;n<this.builtInEncoders.length;n++){let r=this.builtInEncoders[n];if(r!=null){let i=r(e,t);if(i!=null)return new u(-1-n,i)}}for(let n=0;n<this.encoders.length;n++){let r=this.encoders[n];if(r!=null){let i=r(e,t);if(i!=null)return new u(n,i)}}return e instanceof u?e:null}decode(e,t,n){let r=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return r?r(e,t,n):new u(t,e)}};function v(e){return e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer}function y(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):v(e)?new Uint8Array(e):Uint8Array.from(e)}function b(e){return`${e<0?`-`:``}0x${Math.abs(e).toString(16).padStart(2,`0`)}`}var x=16,oe=16,se=class{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(e=x,t=oe){this.maxKeyLength=e,this.maxLengthPerKey=t,this.caches=[];for(let e=0;e<this.maxKeyLength;e++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,t,n){let r=this.caches[n-1];FIND_CHUNK:for(let i of r){let r=i.bytes;for(let i=0;i<n;i++)if(r[i]!==e[t+i])continue FIND_CHUNK;return i.str}return null}store(e,t){let n=this.caches[e.length-1],r={bytes:e,str:t};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=r:n.push(r)}decode(e,t,n){let r=this.find(e,t,n);if(r!=null)return this.hit++,r;this.miss++;let i=a(e,t,n),o=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(o,i),i}},S=`array`,C=`map_key`,w=`map_value`,T=e=>{if(typeof e==`string`||typeof e==`number`)return e;throw new d(`The type of key must be string or number but `+typeof e)},E=class{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){let t=this.getUninitializedStateFromPool();t.type=S,t.position=0,t.size=e,t.array=Array(e)}pushMapState(e){let t=this.getUninitializedStateFromPool();t.type=C,t.readCount=0,t.size=e,t.map={}}getUninitializedStateFromPool(){return this.stackHeadPosition++,this.stackHeadPosition===this.stack.length&&this.stack.push({type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null}),this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw Error(`Invalid stack state. Released state is not on top of the stack.`);if(e.type===S){let t=e;t.size=0,t.array=void 0,t.position=0,t.type=void 0}if(e.type===C||e.type===w){let t=e;t.size=0,t.map=void 0,t.readCount=0,t.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}},D=-1,O=new DataView(new ArrayBuffer(0)),ce=new Uint8Array(O.buffer);try{O.getInt8(0)}catch(e){if(!(e instanceof RangeError))throw Error(`This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access`)}var k=RangeError(`Insufficient data`),le=new se,ue=class e{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=O;bytes=ce;headByte=D;stack=new E;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??ae.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.rawStrings=e?.rawStrings??!1,this.maxStrLength=e?.maxStrLength??4294967295,this.maxBinLength=e?.maxBinLength??4294967295,this.maxArrayLength=e?.maxArrayLength??4294967295,this.maxMapLength=e?.maxMapLength??4294967295,this.maxExtLength=e?.maxExtLength??4294967295,this.keyDecoder=e?.keyDecoder===void 0?le:e.keyDecoder,this.mapKeyConverter=e?.mapKeyConverter??T}clone(){return new e({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=D,this.stack.reset()}setBuffer(e){let t=y(e);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===D&&!this.hasRemaining(1))this.setBuffer(e);else{let t=this.bytes.subarray(this.pos),n=y(e),r=new Uint8Array(t.length+n.length);r.set(t),r.set(n,t.length),this.setBuffer(r)}}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){let{view:t,pos:n}=this;return RangeError(`Extra ${t.byteLength-n} of ${t.byteLength} byte(s) found at buffer[${e}]`)}decode(e){if(this.entered)return this.clone().decode(e);try{this.entered=!0,this.reinitializeState(),this.setBuffer(e);let t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t}finally{this.entered=!1}}*decodeMulti(e){if(this.entered){yield*this.clone().decodeMulti(e);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(e);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(e){if(this.entered)return this.clone().decodeAsync(e);try{this.entered=!0;let t=!1,n;for await(let r of e){if(t)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(r);try{n=this.doDecodeSync(),t=!0}catch(e){if(!(e instanceof RangeError))throw e}this.totalPos+=this.pos}if(t){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return n}let{headByte:r,pos:i,totalPos:a}=this;throw RangeError(`Insufficient data in parsing ${b(r)} at ${a} (${i} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(e){return this.decodeMultiAsync(e,!0)}decodeStream(e){return this.decodeMultiAsync(e,!1)}async*decodeMultiAsync(e,t){if(this.entered){yield*this.clone().decodeMultiAsync(e,t);return}try{this.entered=!0;let n=t,r=-1;for await(let i of e){if(t&&r===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(i),n&&(r=this.readArraySize(),n=!1,this.complete());try{for(;yield this.doDecodeSync(),--r!==0;);}catch(e){if(!(e instanceof RangeError))throw e}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){DECODE:for(;;){let e=this.readHeadByte(),t;if(e>=224)t=e-256;else if(e<192)if(e<128)t=e;else if(e<144){let n=e-128;if(n!==0){this.pushMapState(n),this.complete();continue DECODE}else t={}}else if(e<160){let n=e-144;if(n!==0){this.pushArrayState(n),this.complete();continue DECODE}else t=[]}else{let n=e-160;t=this.decodeString(n,0)}else if(e===192)t=null;else if(e===194)t=!1;else if(e===195)t=!0;else if(e===202)t=this.readF32();else if(e===203)t=this.readF64();else if(e===204)t=this.readU8();else if(e===205)t=this.readU16();else if(e===206)t=this.readU32();else if(e===207)t=this.useBigInt64?this.readU64AsBigInt():this.readU64();else if(e===208)t=this.readI8();else if(e===209)t=this.readI16();else if(e===210)t=this.readI32();else if(e===211)t=this.useBigInt64?this.readI64AsBigInt():this.readI64();else if(e===217){let e=this.lookU8();t=this.decodeString(e,1)}else if(e===218){let e=this.lookU16();t=this.decodeString(e,2)}else if(e===219){let e=this.lookU32();t=this.decodeString(e,4)}else if(e===220){let e=this.readU16();if(e!==0){this.pushArrayState(e),this.complete();continue DECODE}else t=[]}else if(e===221){let e=this.readU32();if(e!==0){this.pushArrayState(e),this.complete();continue DECODE}else t=[]}else if(e===222){let e=this.readU16();if(e!==0){this.pushMapState(e),this.complete();continue DECODE}else t={}}else if(e===223){let e=this.readU32();if(e!==0){this.pushMapState(e),this.complete();continue DECODE}else t={}}else if(e===196){let e=this.lookU8();t=this.decodeBinary(e,1)}else if(e===197){let e=this.lookU16();t=this.decodeBinary(e,2)}else if(e===198){let e=this.lookU32();t=this.decodeBinary(e,4)}else if(e===212)t=this.decodeExtension(1,0);else if(e===213)t=this.decodeExtension(2,0);else if(e===214)t=this.decodeExtension(4,0);else if(e===215)t=this.decodeExtension(8,0);else if(e===216)t=this.decodeExtension(16,0);else if(e===199){let e=this.lookU8();t=this.decodeExtension(e,1)}else if(e===200){let e=this.lookU16();t=this.decodeExtension(e,2)}else if(e===201){let e=this.lookU32();t=this.decodeExtension(e,4)}else throw new d(`Unrecognized type byte: ${b(e)}`);this.complete();let n=this.stack;for(;n.length>0;){let e=n.top();if(e.type===S)if(e.array[e.position]=t,e.position++,e.position===e.size)t=e.array,n.release(e);else continue DECODE;else if(e.type===C){if(t===`__proto__`)throw new d(`The key __proto__ is not allowed`);e.key=this.mapKeyConverter(t),e.type=w;continue DECODE}else if(e.map[e.key]=t,e.readCount++,e.readCount===e.size)t=e.map,n.release(e);else{e.key=null,e.type=C;continue DECODE}}return t}}readHeadByte(){return this.headByte===D&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=D}readArraySize(){let e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new d(`Unrecognized array type byte: ${b(e)}`)}}pushMapState(e){if(e>this.maxMapLength)throw new d(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new d(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(e)}decodeString(e,t){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,t):this.decodeBinary(e,t)}decodeUtf8String(e,t){if(e>this.maxStrLength)throw new d(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+t+e)throw k;let n=this.pos+t,r;return r=this.stateIsMapKey()&&this.keyDecoder?.canBeCached(e)?this.keyDecoder.decode(this.bytes,n,e):l(this.bytes,n,e),this.pos+=t+e,r}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===C:!1}decodeBinary(e,t){if(e>this.maxBinLength)throw new d(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+t))throw k;let n=this.pos+t,r=this.bytes.subarray(n,n+e);return this.pos+=t+e,r}decodeExtension(e,t){if(e>this.maxExtLength)throw new d(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);let n=this.view.getInt8(this.pos+t),r=this.decodeBinary(e,t+1);return this.extensionCodec.decode(r,n,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let e=this.view.getUint8(this.pos);return this.pos++,e}readI8(){let e=this.view.getInt8(this.pos);return this.pos++,e}readU16(){let e=this.view.getUint16(this.pos);return this.pos+=2,e}readI16(){let e=this.view.getInt16(this.pos);return this.pos+=2,e}readU32(){let e=this.view.getUint32(this.pos);return this.pos+=4,e}readI32(){let e=this.view.getInt32(this.pos);return this.pos+=4,e}readU64(){let e=p(this.view,this.pos);return this.pos+=8,e}readI64(){let e=f(this.view,this.pos);return this.pos+=8,e}readU64AsBigInt(){let e=this.view.getBigUint64(this.pos);return this.pos+=8,e}readI64AsBigInt(){let e=this.view.getBigInt64(this.pos);return this.pos+=8,e}readF32(){let e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){let e=this.view.getFloat64(this.pos);return this.pos+=8,e}};function de(e,t){return new ue(t).decode(e)}var A=`p3xr-profiler-entries`,j=`p3xr-pubsub-entries`,M=1e4,N=100,P=2e3,F=new Set,I=new Set,L=null,R=null,z=()=>`en`,B=!1,V=!1,H=!1,U=0,W=0,G=null,K=null;function fe(e){if(e instanceof ArrayBuffer)try{let t=de(new Uint8Array(e));return JSON.stringify(t,null,2)}catch{return new TextDecoder().decode(e)}return String(e)}function q(e,t){let n=t.slice(-N);try{localStorage.setItem(e,JSON.stringify(n))}catch{try{localStorage.removeItem(e)}catch{}}}function pe(){let e=[],t=[];try{let t=localStorage.getItem(A);t&&(e=JSON.parse(t))}catch{}try{let e=localStorage.getItem(j);e&&(t=JSON.parse(e))}catch{}return{profiler:e,pubsub:t}}var J=null,Y=e=>{let t=z(),n=new Date(parseFloat(e.time)*1e3),r={displayTime:n.toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1,fractionalSecondDigits:3}),fullTimestamp:n.toISOString(),database:e.database,source:e.source,command:(e.args||[]).join(` `)};if(J){let e=[...J.profilerEntries,r];e.length>M&&(e=e.slice(-M)),J.profilerEntries=e}F.forEach(e=>e(r)),L||=setTimeout(()=>{L=null,J&&q(A,J.profilerEntries)},P)},X=e=>{let t=z(),n=new Date,r={displayTime:n.toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}),fullTimestamp:n.toISOString(),channel:e.channel,message:fe(e.message)};if(J){let e=[...J.pubsubEntries,r];e.length>M&&(e=e.slice(-M)),J.pubsubEntries=e}I.forEach(e=>e(r)),R||=setTimeout(()=>{R=null,J&&q(j,J.pubsubEntries)},P)},Z=e(`monitoringData`,()=>{let{profiler:e,pubsub:n}=pe();return{profilerEntries:t(e),pubsubEntries:t(n),profilerStarted:t(!1),pubsubStarted:t(!1),pubsubPattern:t(`*`)}});function me(e){z=e,B||=!0}function he(){J=Z()}async function ge(){if(V=!0,J?.profilerStarted)return;if(G)return G;let e=++U,t=(async()=>{if(await n({action:`monitor/set`,payload:{enabled:!0}}),e!==U||!V)return;let t=r();t?.removeListener(`monitor-data`,Y),t?.on(`monitor-data`,Y),J&&(J.profilerStarted=!0)})().finally(()=>{G===t&&(G=null)});return G=t,G}function _e(){let e=J?.profilerStarted??!1;V=!1,U++,G=null,r()?.removeListener(`monitor-data`,Y),J&&(J.profilerStarted=!1),e&&n({action:`monitor/set`,payload:{enabled:!1}}).catch(()=>{}),L&&=(clearTimeout(L),null),J&&q(A,J.profilerEntries)}async function Q(){if(H=!0,J?.pubsubStarted)return;if(K)return K;let e=++W,t=J?.pubsubPattern??`*`,i=(async()=>{if(await n({action:`settings/subscription`,payload:{subscription:!0,subscriberPattern:t}}),e!==W||!H)return;let i=r();i?.removeListener(`pubsub-message`,X),i?.on(`pubsub-message`,X),J&&(J.pubsubStarted=!0)})().finally(()=>{K===i&&(K=null)});return K=i,K}function $(){let e=J?.pubsubStarted??!1;H=!1,W++,K=null,r()?.removeListener(`pubsub-message`,X),J&&(J.pubsubStarted=!1),e&&n({action:`settings/subscription`,payload:{subscription:!1,subscriberPattern:`*`}}).catch(()=>{}),R&&=(clearTimeout(R),null),J&&q(j,J.pubsubEntries)}async function ve(){$(),await Q()}function ye(){J&&(J.profilerEntries=[]);try{localStorage.removeItem(A)}catch{}}function be(){J&&(J.pubsubEntries=[]);try{localStorage.removeItem(j)}catch{}}function xe(){L&&=(clearTimeout(L),null),R&&=(clearTimeout(R),null),J&&(q(A,J.profilerEntries),q(j,J.pubsubEntries))}function Se(e){return F.add(e),()=>F.delete(e)}function Ce(e){return I.add(e),()=>I.delete(e)}export{me as a,ve as c,_e as d,$ as f,xe as i,ge as l,ye as n,Se as o,Z as p,be as r,Ce as s,he as t,Q as u};