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
26 lines (23 loc) • 31.1 kB
JavaScript
import{a as F,i as E}from"./main-OCJB5534.js";import{Ai as wy,Ar as lw,Ct as Pl,D as Ey,Di as wf,Dr as lo,E as En,Er as ln,Fi as xi,Hn as cw,Hr as nn,Ht as Tf,In as by,Ir as mo,It as Sn,Jt as Un,L as Hs,Lt as Sy,Mt as Rc,Nt as Re,O as Fr,P as HT,Pi as xf,Pr as mc,R as Ht,Rn as co,Sr as kr,T as Ee,Tn as _p,Tr as le$1,V as I,W as J,Wi as ze$1,Wt as Ty,X as Jy,Zr as q,_ as Cf,a as $n,an as Wl,dr as ie,er as gT,fr as io,gn as Z$1,gr as jf,in as Wa,ir as h,j as Gb,jn as b9,k as G0,kr as lt,lr as hy,mi as te,mt as Ni,n as $e$1,or as hc,p as Bt,pt as Nf,qr as oe,rt as Ll,t as $Y,vr as jy,w as Eb,wi as vt,wr as lc,xi as v,xt as Pe}from"./chunk-CHqDEyfr.js";import{t as h$1}from"./chunk-CPClUPec.js";import{n as wt,r as yt}from"./chunk-CGgWGJ3E.js";var le=class{dataNodes;expansionModel=new h$1(!0);trackBy;getLevel;isExpandable;getChildren;toggle(r){this.expansionModel.toggle(this._trackByValue(r))}expand(r){this.expansionModel.select(this._trackByValue(r))}collapse(r){this.expansionModel.deselect(this._trackByValue(r))}isExpanded(r){return this.expansionModel.isSelected(this._trackByValue(r))}toggleDescendants(r){this.expansionModel.isSelected(this._trackByValue(r))?this.collapseDescendants(r):this.expandDescendants(r)}collapseAll(){this.expansionModel.clear()}expandDescendants(r){let e=[r];e.push(...this.getDescendants(r)),this.expansionModel.select(...e.map(t=>this._trackByValue(t)))}collapseDescendants(r){let e=[r];e.push(...this.getDescendants(r)),this.expansionModel.deselect(...e.map(t=>this._trackByValue(t)))}_trackByValue(r){return this.trackBy?this.trackBy(r):r}};var X=class extends le{getLevel;isExpandable;options;constructor(r,e,t){super(),this.getLevel=r,this.isExpandable=e,this.options=t,this.options&&(this.trackBy=this.options.trackBy)}getDescendants(r){let e=this.dataNodes.indexOf(r),t=[];for(let n=e+1;n<this.dataNodes.length&&this.getLevel(r)<this.getLevel(this.dataNodes[n]);n++)t.push(this.dataNodes[n]);return t}expandAll(){this.expansionModel.select(...this.dataNodes.map(r=>this._trackByValue(r)))}};var he=new v(`CDK_TREE_NODE_OUTLET_NODE`);var Y=(()=>{class i{viewContainer=h(Pe);_node=h(he,{optional:!0});static ɵfac=function(t){return new(t||i)};static ɵdir=Z$1({type:i,selectors:[[``,`cdkTreeNodeOutlet`,``]]})}return i})();var ce=class{$implicit;level;index;count;constructor(r){this.$implicit=r}};var G=(()=>{class i{template=h($e$1);when;static ɵfac=function(t){return new(t||i)};static ɵdir=Z$1({type:i,selectors:[[``,`cdkTreeNodeDef`,``]],inputs:{when:[0,`cdkTreeNodeDefWhen`,`when`]}})}return i})();function ze(){return Error(`Could not find a tree control, levelAccessor, or childrenAccessor for the tree.`)}var A=(()=>{class i{_differs=h(hc);_changeDetectorRef=h(mc);_elementRef=h(q);_dir=h(mo);_onDestroy=new I;_dataDiffer;_defaultNodeDef=null;_dataSubscription;_levels=new Map;_parents=new Map;_ariaSets=new Map;get dataSource(){return this._dataSource}set dataSource(e){this._dataSource!==e&&this._switchDataSource(e)}_dataSource;treeControl;levelAccessor;childrenAccessor;trackBy;expansionKey;_nodeOutlet;_nodeDefs;viewChange=new Un({start:0,end:Number.MAX_VALUE});_expansionModel;_flattenedNodes=new Un([]);_nodeType=new Un(null);_nodes=new Un(new Map);_keyManagerNodes=new Un([]);_keyManagerFactory=h(b9);_keyManager;_viewInit=!1;ngAfterContentInit(){this._initializeKeyManager()}ngAfterContentChecked(){this._updateDefaultNodeDefinition(),this._subscribeToDataChanges()}ngOnDestroy(){this._nodeOutlet.viewContainer.clear(),this._nodes.complete(),this._keyManagerNodes.complete(),this._nodeType.complete(),this._flattenedNodes.complete(),this.viewChange.complete(),this._onDestroy.next(),this._onDestroy.complete(),this._dataSource&&typeof this._dataSource.disconnect==`function`&&this.dataSource.disconnect(this),this._dataSubscription?.unsubscribe(),this._dataSubscription=void 0,this._keyManager?.destroy()}ngOnInit(){this._checkTreeControlUsage(),this._initializeDataDiffer()}ngAfterViewInit(){this._viewInit=!0}_updateDefaultNodeDefinition(){let e=this._nodeDefs.filter(t=>!t.when);e.length,this._defaultNodeDef=e[0]}_setNodeTypeIfUnset(e){this._nodeType.value===null&&this._nodeType.next(e)}_switchDataSource(e){this._dataSource&&typeof this._dataSource.disconnect==`function`&&this.dataSource.disconnect(this),this._dataSubscription?.unsubscribe(),this._dataSubscription=void 0,e||this._nodeOutlet.viewContainer.clear(),this._dataSource=e,this._nodeDefs&&this._subscribeToDataChanges()}_getExpansionModel(){return this.treeControl?this.treeControl.expansionModel:(this._expansionModel??=new h$1(!0),this._expansionModel)}_subscribeToDataChanges(){if(this._dataSubscription)return;let e;Gb(this._dataSource)?e=this._dataSource.connect(this):Bt(this._dataSource)?e=this._dataSource:Array.isArray(this._dataSource)&&(e=Re(this._dataSource)),e&&(this._dataSubscription=this._getRenderData(e).pipe(Ht(this._onDestroy)).subscribe(t=>{this._renderDataChanges(t)}))}_getRenderData(e){let t=this._getExpansionModel();return Pl([e,this._nodeType,t.changed.pipe(Fr(null),Wl(n=>{this._emitExpansionChanges(n)}))]).pipe(Hs(([n,s])=>s===null?Re({renderNodes:n,flattenedNodes:null,nodeType:s}):this._computeRenderingData(n,s).pipe(ie(o=>F(E({},o),{nodeType:s})))))}_renderDataChanges(e){if(e.nodeType===null){this.renderNodeChanges(e.renderNodes);return}this._updateCachedData(e.flattenedNodes),this.renderNodeChanges(e.renderNodes),this._updateKeyManagerItems(e.flattenedNodes)}_emitExpansionChanges(e){if(!e)return;let t=this._nodes.value;for(let n of e.added)t.get(n)?._emitExpansionState(!0);for(let n of e.removed)t.get(n)?._emitExpansionState(!1)}_initializeKeyManager(){let e=Pl([this._keyManagerNodes,this._nodes]).pipe(ie(([n,s])=>n.reduce((o,a)=>{let d=s.get(this._getExpansionKey(a));return d&&o.push(d),o},[]))),t={trackBy:n=>this._getExpansionKey(n.data),skipPredicate:n=>!!n.isDisabled,typeAheadDebounceInterval:!0,horizontalOrientation:this._dir.value};this._keyManager=this._keyManagerFactory(e,t)}_initializeDataDiffer(){let e=this.trackBy??((t,n)=>this._getExpansionKey(n));this._dataDiffer=this._differs.find([]).create(e)}_checkTreeControlUsage(){}renderNodeChanges(e,t=this._dataDiffer,n=this._nodeOutlet.viewContainer,s){let o=t.diff(e);!o&&!this._viewInit||(o?.forEachOperation((a,d,l)=>{if(a.previousIndex==null)this.insertNode(e[l],l,n,s);else if(l==null)n.remove(d);else{let m=n.get(d);n.move(m,l)}}),o?.forEachIdentityChange(a=>{let d=a.item;if(a.currentIndex!=null){let l=n.get(a.currentIndex);l.context.$implicit=d}}),s?this._changeDetectorRef.markForCheck():this._changeDetectorRef.detectChanges())}_getNodeDef(e,t){if(this._nodeDefs.length===1)return this._nodeDefs.first;return this._nodeDefs.find(s=>s.when&&s.when(t,e))||this._defaultNodeDef}insertNode(e,t,n,s){let o=this._getLevelAccessor(),a=this._getNodeDef(e,t),d=this._getExpansionKey(e),l=new ce(e);l.index=t,s??=this._parents.get(d)??void 0,o?l.level=o(e):s!==void 0&&this._levels.has(this._getExpansionKey(s))?l.level=this._levels.get(this._getExpansionKey(s))+1:l.level=0,this._levels.set(d,l.level),(n||this._nodeOutlet.viewContainer).createEmbeddedView(a.template,l,t),T.mostRecentTreeNode&&(T.mostRecentTreeNode.data=e)}isExpanded(e){return!!(this.treeControl?.isExpanded(e)||this._expansionModel?.isSelected(this._getExpansionKey(e)))}toggle(e){this.treeControl?this.treeControl.toggle(e):this._expansionModel&&this._expansionModel.toggle(this._getExpansionKey(e))}expand(e){this.treeControl?this.treeControl.expand(e):this._expansionModel&&this._expansionModel.select(this._getExpansionKey(e))}collapse(e){this.treeControl?this.treeControl.collapse(e):this._expansionModel&&this._expansionModel.deselect(this._getExpansionKey(e))}toggleDescendants(e){this.treeControl?this.treeControl.toggleDescendants(e):this._expansionModel&&(this.isExpanded(e)?this.collapseDescendants(e):this.expandDescendants(e))}expandDescendants(e){if(this.treeControl)this.treeControl.expandDescendants(e);else if(this._expansionModel){let t=this._expansionModel;t.select(this._getExpansionKey(e)),this._getDescendants(e).pipe(lt(1),Ht(this._onDestroy)).subscribe(n=>{t.select(...n.map(s=>this._getExpansionKey(s)))})}}collapseDescendants(e){if(this.treeControl)this.treeControl.collapseDescendants(e);else if(this._expansionModel){let t=this._expansionModel;t.deselect(this._getExpansionKey(e)),this._getDescendants(e).pipe(lt(1),Ht(this._onDestroy)).subscribe(n=>{t.deselect(...n.map(s=>this._getExpansionKey(s)))})}}expandAll(){this.treeControl?this.treeControl.expandAll():this._expansionModel&&this._forEachExpansionKey(e=>this._expansionModel?.select(...e))}collapseAll(){this.treeControl?this.treeControl.collapseAll():this._expansionModel&&this._forEachExpansionKey(e=>this._expansionModel?.deselect(...e))}_getLevelAccessor(){return this.treeControl?.getLevel?.bind(this.treeControl)??this.levelAccessor}_getChildrenAccessor(){return this.treeControl?.getChildren?.bind(this.treeControl)??this.childrenAccessor}_getDirectChildren(e){let t=this._getLevelAccessor(),n=this._expansionModel??this.treeControl?.expansionModel;if(!n)return Re([]);let s=this._getExpansionKey(e),o=n.changed.pipe(Hs(d=>d.added.includes(s)?Re(!0):d.removed.includes(s)?Re(!1):$n),Fr(this.isExpanded(e)));if(t)return Pl([o,this._flattenedNodes]).pipe(ie(([d,l])=>d?this._findChildrenByLevel(t,l,e,1):[]));let a=this._getChildrenAccessor();if(a)return _p(a(e)??[]);throw ze()}_findChildrenByLevel(e,t,n,s){let o=this._getExpansionKey(n),a=t.findIndex(M=>this._getExpansionKey(M)===o),d=e(n),l=d+s,m=[];for(let M=a+1;M<t.length;M++){let fe=e(t[M]);if(fe<=d)break;fe<=l&&m.push(t[M])}return m}_registerNode(e){this._nodes.value.set(this._getExpansionKey(e.data),e),this._nodes.next(this._nodes.value)}_unregisterNode(e){this._nodes.value.delete(this._getExpansionKey(e.data)),this._nodes.next(this._nodes.value)}_getLevel(e){return this._levels.get(this._getExpansionKey(e))}_getSetSize(e){return this._getAriaSet(e).length}_getPositionInSet(e){let t=this._getAriaSet(e),n=this._getExpansionKey(e);return t.findIndex(s=>this._getExpansionKey(s)===n)+1}_getNodeParent(e){let t=this._parents.get(this._getExpansionKey(e.data));return t&&this._nodes.value.get(this._getExpansionKey(t))}_getNodeChildren(e){return this._getDirectChildren(e.data).pipe(ie(t=>t.reduce((n,s)=>{let o=this._nodes.value.get(this._getExpansionKey(s));return o&&n.push(o),n},[])))}_sendKeydownToKeyManager(e){if(e.target===this._elementRef.nativeElement)this._keyManager.onKeydown(e);else{let t=this._nodes.getValue();for(let[,n]of t)if(e.target===n._elementRef.nativeElement){this._keyManager.onKeydown(e);break}}}_getDescendants(e){if(this.treeControl)return Re(this.treeControl.getDescendants(e));if(this.levelAccessor)return Re(this._findChildrenByLevel(this.levelAccessor,this._flattenedNodes.value,e,Infinity));if(this.childrenAccessor)return this._getAllChildrenRecursively(e).pipe(lw((t,n)=>(t.push(...n),t),[]));throw ze()}_getAllChildrenRecursively(e){return this.childrenAccessor?_p(this.childrenAccessor(e)).pipe(lt(1),Hs(t=>{for(let n of t)this._parents.set(this._getExpansionKey(n),e);return Re(...t).pipe(Ll(n=>ln(Re([n]),this._getAllChildrenRecursively(n))))})):Re([])}_getExpansionKey(e){return this.expansionKey?.(e)??e}_getAriaSet(e){let t=this._getExpansionKey(e),n=this._parents.get(t),s=n?this._getExpansionKey(n):null;return this._ariaSets.get(s)??[e]}_findParentForNode(e,t,n){if(!n.length)return null;let s=this._levels.get(this._getExpansionKey(e))??0;for(let o=t-1;o>=0;o--){let a=n[o];if((this._levels.get(this._getExpansionKey(a))??0)<s)return a}return null}_flattenNestedNodesWithExpansion(e,t=0){let n=this._getChildrenAccessor();return n?Re(...e).pipe(Ll(s=>{let o=this._getExpansionKey(s);this._parents.has(o)||this._parents.set(o,null),this._levels.set(o,t);let a=_p(n(s));return ln(Re([s]),a.pipe(lt(1),Wl(d=>{this._ariaSets.set(o,[...d??[]]);for(let l of d??[]){let m=this._getExpansionKey(l);this._parents.set(m,s),this._levels.set(m,t+1)}}),Hs(d=>d?this._flattenNestedNodesWithExpansion(d,t+1).pipe(ie(l=>this.isExpanded(s)?l:[])):Re([]))))}),lw((s,o)=>(s.push(...o),s),[])):Re([...e])}_computeRenderingData(e,t){if(this.childrenAccessor&&t===`flat`)return this._clearPreviousCache(),this._ariaSets.set(null,[...e]),this._flattenNestedNodesWithExpansion(e).pipe(ie(n=>({renderNodes:n,flattenedNodes:n})));if(this.levelAccessor&&t===`nested`){let n=this.levelAccessor;return Re(e.filter(s=>n(s)===0)).pipe(ie(s=>({renderNodes:s,flattenedNodes:e})),Wl(({flattenedNodes:s})=>{this._calculateParents(s)}))}else return t===`flat`?Re({renderNodes:e,flattenedNodes:e}).pipe(Wl(({flattenedNodes:n})=>{this._calculateParents(n)})):(this._clearPreviousCache(),this._ariaSets.set(null,[...e]),this._flattenNestedNodesWithExpansion(e).pipe(ie(n=>({renderNodes:e,flattenedNodes:n}))))}_updateCachedData(e){this._flattenedNodes.next(e)}_updateKeyManagerItems(e){this._keyManagerNodes.next(e)}_calculateParents(e){let t=this._getLevelAccessor();if(t){this._clearPreviousCache();for(let n=0;n<e.length;n++){let s=e[n],o=this._getExpansionKey(s);this._levels.set(o,t(s));let a=this._findParentForNode(s,n,e);this._parents.set(o,a);let d=a?this._getExpansionKey(a):null,l=this._ariaSets.get(d)??[];l.splice(n,0,s),this._ariaSets.set(d,l)}}}_forEachExpansionKey(e){let t=[],n=[];this._nodes.value.forEach(s=>{t.push(this._getExpansionKey(s.data)),n.push(this._getDescendants(s.data))}),n.length>0?Pl(n).pipe(lt(1),Ht(this._onDestroy)).subscribe(s=>{s.forEach(o=>o.forEach(a=>t.push(this._getExpansionKey(a)))),e(t)}):e(t)}_clearPreviousCache(){this._parents.clear(),this._levels.clear(),this._ariaSets.clear()}static ɵfac=function(t){return new(t||i)};static ɵcmp=Ee({type:i,selectors:[[`cdk-tree`]],contentQueries:function(t,n,s){if(t&1&&Ty(s,G,5),t&2){let o;Cf(o=xf())&&(n._nodeDefs=o)}},viewQuery:function(t,n){if(t&1&&lc(Y,7),t&2){let s;Cf(s=xf())&&(n._nodeOutlet=s.first)}},hostAttrs:[`role`,`tree`,1,`cdk-tree`],hostBindings:function(t,n){t&1&&Sy(`keydown`,function(o){return n._sendKeydownToKeyManager(o)})},inputs:{dataSource:`dataSource`,treeControl:`treeControl`,levelAccessor:`levelAccessor`,childrenAccessor:`childrenAccessor`,trackBy:`trackBy`,expansionKey:`expansionKey`},exportAs:[`cdkTree`],decls:1,vars:0,consts:[[`cdkTreeNodeOutlet`,``]],template:function(t,n){t&1&&Ey(0,0)},dependencies:[Y],encapsulation:2,changeDetection:1})}return i})();var T=(()=>{class i{_elementRef=h(q);_tree=h(A);_tabindex=-1;_type=`flat`;get role(){return`treeitem`}set role(e){}get isExpandable(){return this._isExpandable()}set isExpandable(e){this._inputIsExpandable=e,!(this.data&&!this._isExpandable||!this._inputIsExpandable)&&(this._inputIsExpanded?this.expand():this._inputIsExpanded===!1&&this.collapse())}get isExpanded(){return this._tree.isExpanded(this._data)}set isExpanded(e){this._inputIsExpanded=e,e?this.expand():this.collapse()}isDisabled=!1;typeaheadLabel=null;getLabel(){return this.typeaheadLabel||this._elementRef.nativeElement.textContent?.trim()||``}activation=new J;expandedChange=new J;static mostRecentTreeNode=null;_destroyed=new I;_dataChanges=new I;_inputIsExpandable=!1;_inputIsExpanded=void 0;_shouldFocus=!0;_parentNodeAriaLevel;get data(){return this._data}set data(e){e!==this._data&&(this._data=e,this._dataChanges.next())}_data;get isLeafNode(){return this._tree.treeControl?.isExpandable!==void 0&&!this._tree.treeControl.isExpandable(this._data)?!0:this._tree.treeControl?.isExpandable===void 0&&this._tree.treeControl?.getDescendants(this._data).length===0}get level(){return this._tree._getLevel(this._data)??this._parentNodeAriaLevel}_isExpandable(){return this._tree.treeControl?!this.isLeafNode:this._inputIsExpandable}_getAriaExpanded(){return this._isExpandable()?String(this.isExpanded):null}_getSetSize(){return this._tree._getSetSize(this._data)}_getPositionInSet(){return this._tree._getPositionInSet(this._data)}_changeDetectorRef=h(mc);constructor(){i.mostRecentTreeNode=this}ngOnInit(){this._parentNodeAriaLevel=Ge(this._elementRef.nativeElement),this._tree._getExpansionModel().changed.pipe(ie(()=>this.isExpanded),kr(),Ht(this._destroyed)).pipe(Ht(this._destroyed)).subscribe(()=>this._changeDetectorRef.markForCheck()),this._tree._setNodeTypeIfUnset(this._type),this._tree._registerNode(this)}ngOnDestroy(){i.mostRecentTreeNode===this&&(i.mostRecentTreeNode=null),this._dataChanges.complete(),this._destroyed.next(),this._destroyed.complete()}getParent(){return this._tree._getNodeParent(this)??null}getChildren(){return this._tree._getNodeChildren(this)}focus(){this._tabindex=0,this._shouldFocus&&this._elementRef.nativeElement.focus(),this._changeDetectorRef.markForCheck()}unfocus(){this._tabindex=-1,this._changeDetectorRef.markForCheck()}activate(){this.isDisabled||this.activation.next(this._data)}collapse(){this.isExpandable&&this._tree.collapse(this._data)}expand(){this.isExpandable&&this._tree.expand(this._data)}makeFocusable(){this._tabindex=0,this._changeDetectorRef.markForCheck()}_focusItem(){this.isDisabled||this._tree._keyManager.focusItem(this)}_setActiveItem(){this.isDisabled||(this._shouldFocus=!1,this._tree._keyManager.focusItem(this),this._shouldFocus=!0)}_emitExpansionState(e){this.expandedChange.emit(e)}static ɵfac=function(t){return new(t||i)};static ɵdir=Z$1({type:i,selectors:[[`cdk-tree-node`]],hostAttrs:[`role`,`treeitem`,1,`cdk-tree-node`],hostVars:5,hostBindings:function(t,n){t&1&&Sy(`click`,function(){return n._setActiveItem()})(`focus`,function(){return n._focusItem()}),t&2&&(wy(`tabIndex`,n._tabindex),xi(`aria-expanded`,n._getAriaExpanded())(`aria-level`,n.level+1)(`aria-posinset`,n._getPositionInSet())(`aria-setsize`,n._getSetSize()))},inputs:{role:`role`,isExpandable:[2,`isExpandable`,`isExpandable`,le$1],isExpanded:`isExpanded`,isDisabled:[2,`isDisabled`,`isDisabled`,le$1],typeaheadLabel:[0,`cdkTreeNodeTypeaheadLabel`,`typeaheadLabel`]},outputs:{activation:`activation`,expandedChange:`expandedChange`},exportAs:[`cdkTreeNode`]})}return i})();function Ge(i){let r=i.parentElement;for(;r&&!Ze(r);)r=r.parentElement;return r?r.classList.contains(`cdk-nested-tree-node`)?jf(r.getAttribute(`aria-level`)):0:-1}function Ze(i){let r=i.classList;return!!(r?.contains(`cdk-nested-tree-node`)||r?.contains(`cdk-tree`))}var et=/([A-Za-z%]+)$/;var pe=(()=>{class i{_treeNode=h(T);_tree=h(A);_element=h(q);_dir=h(mo,{optional:!0});_currentPadding=null;_destroyed=new I;indentUnits=`px`;get level(){return this._level}set level(e){this._setLevelInput(e)}_level;get indent(){return this._indent}set indent(e){this._setIndentInput(e)}_indent=40;constructor(){this._setPadding(),this._dir?.change.pipe(Ht(this._destroyed)).subscribe(()=>this._setPadding(!0)),this._treeNode._dataChanges.subscribe(()=>this._setPadding())}ngOnDestroy(){this._destroyed.next(),this._destroyed.complete()}_paddingIndent(){let e=(this._treeNode.data&&this._tree._getLevel(this._treeNode.data))??null,t=this._level==null?e:this._level;return typeof t==`number`?`${t*this._indent}${this.indentUnits}`:null}_setPadding(e=!1){let t=this._paddingIndent();if(t!==this._currentPadding||e){let n=this._element.nativeElement,s=this._dir&&this._dir.value===`rtl`?`paddingRight`:`paddingLeft`,o=s===`paddingLeft`?`paddingRight`:`paddingLeft`;n.style[s]=t||``,n.style[o]=``,this._currentPadding=t}}_setLevelInput(e){this._level=isNaN(e)?null:e,this._setPadding()}_setIndentInput(e){let t=e,n=`px`;if(typeof e==`string`){let s=e.split(et);t=s[0],n=s[1]||n}this.indentUnits=n,this._indent=jf(t),this._setPadding()}static ɵfac=function(t){return new(t||i)};static ɵdir=Z$1({type:i,selectors:[[``,`cdkTreeNodePadding`,``]],inputs:{level:[2,`cdkTreeNodePadding`,`level`,jf],indent:[0,`cdkTreeNodePaddingIndent`,`indent`]}})}return i})();var ue=(()=>{class i{_tree=h(A);_treeNode=h(T);recursive=!1;_toggle(e){e.stopPropagation(),this.recursive?this._tree.toggleDescendants(this._treeNode.data):this._tree.toggle(this._treeNode.data),this._tree._keyManager.focusItem(this._treeNode)}static ɵfac=function(t){return new(t||i)};static ɵdir=Z$1({type:i,selectors:[[``,`cdkTreeNodeToggle`,``]],hostAttrs:[`tabindex`,`-1`],hostBindings:function(t,n){t&1&&Sy(`click`,function(o){return n._toggle(o)})(`keydown.Enter`,function(o){return n._toggle(o),o.preventDefault()})(`keydown.Space`,function(o){return n._toggle(o),o.preventDefault()})},inputs:{recursive:[2,`cdkTreeNodeToggleRecursive`,`recursive`,le$1]}})}return i})();var Qe=(()=>{class i{static ɵfac=function(t){return new(t||i)};static ɵmod=oe({type:i});static ɵinj=te({})}return i})();function tt(i){return!!i._isNoopTreeKeyManager}var $e=(()=>{class i extends T{get tabIndexInputBinding(){return this._tabIndexInputBinding}set tabIndexInputBinding(e){this._tabIndexInputBinding=e}_tabIndexInputBinding;defaultTabIndex=0;_getTabindexAttribute(){return tt(this._tree._keyManager)?this.tabIndexInputBinding:this._tabindex}get disabled(){return this.isDisabled}set disabled(e){this.isDisabled=e}constructor(){super();let e=h(new Jy(`tabindex`),{optional:!0});this.tabIndexInputBinding=Number(e)||this.defaultTabIndex}ngOnInit(){super.ngOnInit()}ngOnDestroy(){super.ngOnDestroy()}static ɵfac=function(t){return new(t||i)};static ɵdir=Z$1({type:i,selectors:[[`mat-tree-node`]],hostAttrs:[1,`mat-tree-node`],hostVars:5,hostBindings:function(t,n){t&1&&Sy(`click`,function(){return n._focusItem()}),t&2&&(wy(`tabIndex`,n._getTabindexAttribute()),xi(`aria-expanded`,n._getAriaExpanded())(`aria-level`,n.level+1)(`aria-posinset`,n._getPositionInSet())(`aria-setsize`,n._getSetSize()))},inputs:{tabIndexInputBinding:[2,`tabIndex`,`tabIndexInputBinding`,e=>e==null?0:jf(e)],disabled:[2,`disabled`,`disabled`,le$1]},outputs:{activation:`activation`,expandedChange:`expandedChange`},exportAs:[`matTreeNode`],features:[Ni([{provide:T,useExisting:i}]),ze$1]})}return i})();var We=(()=>{class i extends G{data;static ɵfac=(()=>{let e;return function(n){return(e||(e=io(i)))(n||i)}})();static ɵdir=Z$1({type:i,selectors:[[``,`matTreeNodeDef`,``]],inputs:{when:[0,`matTreeNodeDefWhen`,`when`],data:[0,`matTreeNode`,`data`]},features:[Ni([{provide:G,useExisting:i}]),ze$1]})}return i})();var Je=(()=>{class i extends pe{get level(){return this._level}set level(e){this._setLevelInput(e)}get indent(){return this._indent}set indent(e){this._setIndentInput(e)}static ɵfac=(()=>{let e;return function(n){return(e||(e=io(i)))(n||i)}})();static ɵdir=Z$1({type:i,selectors:[[``,`matTreeNodePadding`,``]],inputs:{level:[2,`matTreeNodePadding`,`level`,jf],indent:[0,`matTreeNodePaddingIndent`,`indent`]},features:[Ni([{provide:pe,useExisting:i}]),ze$1]})}return i})();var Ue=(()=>{class i{viewContainer=h(Pe);_node=h(he,{optional:!0});static ɵfac=function(t){return new(t||i)};static ɵdir=Z$1({type:i,selectors:[[``,`matTreeNodeOutlet`,``]],features:[Ni([{provide:Y,useExisting:i}])]})}return i})();var qe=(()=>{class i extends A{_nodeOutlet=void 0;static ɵfac=(()=>{let e;return function(n){return(e||(e=io(i)))(n||i)}})();static ɵcmp=Ee({type:i,selectors:[[`mat-tree`]],viewQuery:function(t,n){if(t&1&&lc(Ue,7),t&2){let s;Cf(s=xf())&&(n._nodeOutlet=s.first)}},hostAttrs:[1,`mat-tree`],exportAs:[`matTree`],features:[Ni([{provide:A,useExisting:i}]),ze$1],decls:1,vars:0,consts:[[`matTreeNodeOutlet`,``]],template:function(t,n){t&1&&Ey(0,0)},dependencies:[Ue],styles:[`.mat-tree {
display: block;
background-color: var(--%NS%mat-tree-container-background-color, var(--%NS%mat-sys-surface));
}
.mat-tree-node,
.mat-nested-tree-node {
color: var(--%NS%mat-tree-node-text-color, var(--%NS%mat-sys-on-surface));
font-family: var(--%NS%mat-tree-node-text-font, var(--%NS%mat-sys-body-large-font));
font-size: var(--%NS%mat-tree-node-text-size, var(--%NS%mat-sys-body-large-size));
font-weight: var(--%NS%mat-tree-node-text-weight, var(--%NS%mat-sys-body-large-weight));
}
.mat-tree-node {
display: flex;
align-items: center;
flex: 1;
word-wrap: break-word;
min-height: var(--%NS%mat-tree-node-min-height, 48px);
}
.mat-nested-tree-node {
border-bottom-width: 0;
}
`],encapsulation:2,changeDetection:1})}return i})();var Xe=(()=>{class i extends ue{static ɵfac=(()=>{let e;return function(n){return(e||(e=io(i)))(n||i)}})();static ɵdir=Z$1({type:i,selectors:[[``,`matTreeNodeToggle`,``]],inputs:{recursive:[0,`matTreeNodeToggleRecursive`,`recursive`]},features:[Ni([{provide:ue,useExisting:i}]),ze$1]})}return i})();var Ye=(()=>{class i{static ɵfac=function(t){return new(t||i)};static ɵmod=oe({type:i});static ɵinj=te({imports:[Qe,nn]})}return i})();var Z=class{transformFunction;getLevel;isExpandable;getChildren;constructor(r,e,t,n){this.transformFunction=r,this.getLevel=e,this.isExpandable=t,this.getChildren=n}_flattenNode(r,e,t,n){let s=this.transformFunction(r,e);if(t.push(s),this.isExpandable(s)){let o=this.getChildren(r);o&&(Array.isArray(o)?this._flattenChildren(o,e,t,n):o.pipe(lt(1)).subscribe(a=>{this._flattenChildren(a,e,t,n)}))}return t}_flattenChildren(r,e,t,n){r.forEach((s,o)=>{let a=n.slice();a.push(o!=r.length-1),this._flattenNode(s,e+1,t,a)})}flattenNodes(r){let e=[];return r.forEach(t=>this._flattenNode(t,0,e,[])),e}expandFlattenedNodes(r,e){let t=[],n=[];return n[0]=!0,r.forEach(s=>{let o=!0;for(let a=0;a<=this.getLevel(s);a++)o=o&&n[a];o&&t.push(s),this.isExpandable(s)&&(n[this.getLevel(s)+1]=e.isExpanded(s))}),t}};var ee=class extends Rc{_treeControl;_treeFlattener;_flattenedData=new Un([]);_expandedData=new Un([]);get data(){return this._data.value}set data(r){this._data.next(r),this._flattenedData.next(this._treeFlattener.flattenNodes(this.data)),this._treeControl.dataNodes=this._flattenedData.value}_data=new Un([]);constructor(r,e,t){super(),this._treeControl=r,this._treeFlattener=e,t&&(this.data=t)}connect(r){return cw(r.viewChange,this._treeControl.expansionModel.changed,this._flattenedData).pipe(ie(()=>(this._expandedData.next(this._treeFlattener.expandFlattenedNodes(this._flattenedData.value,this._treeControl)),this._expandedData.value)))}disconnect(){}};function it(i,r){if(i&1&&(Wa(0,`mat-tree-node`,3)(1,`button`,4)(2,`mat-icon`),HT(3,`chevron_right`),wf()(),Wa(4,`span`,5)(5,`span`,6)(6,`span`,7),HT(7),wf(),Wa(8,`span`,8),HT(9,`:`),wf()(),Wa(10,`span`),HT(11),wf()()()),i&2){let e=r.$implicit,t=gT();by(`matTreeNodePaddingIndent`,20),Sn(7),jy(e.key),Sn(3),Tf(`p3xr-json-tree-value p3xr-json-tree-value-`+e.type),Sn(),jy(t.formatDisplay(e))}}function st(i,r){if(i&1&&(Wa(0,`span`,10),HT(1),wf(),Wa(2,`span`,11),HT(3,`...`),wf(),Wa(4,`span`,10),HT(5),wf(),Wa(6,`span`,12),HT(7),wf()),i&2){let e=gT().$implicit;Sn(),jy(e.type===`array`?`[`:`{`),Sn(4),jy(e.type===`array`?`]`:`}`),Sn(2),Nf(`(`,e.childCount,`)`)}}function rt(i,r){if(i&1&&(Wa(0,`mat-tree-node`,3)(1,`button`,9)(2,`mat-icon`),HT(3),wf()(),Wa(4,`span`,7),HT(5),wf(),Wa(6,`span`,8),HT(7,`:\xA0`),wf(),co(8,st,8,3),wf()),i&2){let e=r.$implicit,t=gT();by(`matTreeNodePaddingIndent`,20),Sn(3),jy(t.treeControl.isExpanded(e)?`expand_more`:`chevron_right`),Sn(2),jy(e.key),Sn(3),lo(t.treeControl.isExpanded(e)?-1:8)}}var Wt=(()=>{class i{data;label=``;expanded=!0;depth=0;wrap=!0;transformer=(e,t)=>({key:e.key,value:e.value,type:e.type,level:t,expandable:e.type===`object`||e.type===`array`,childCount:e.childCount});treeControl=new X(e=>e.level,e=>e.expandable);treeFlattener=new Z(this.transformer,e=>e.level,e=>e.expandable,e=>e.children);dataSource=new ee(this.treeControl,this.treeFlattener);hasChild=(e,t)=>t.expandable;ngOnChanges(e){this.buildTree()}buildTree(){if(this.data===void 0||this.data===null){this.dataSource.data=[];return}let e=this.jsonToNode(this.label||`root`,this.data);if(this.dataSource.data=e.children?[e]:[e],this.expanded===`recursive`)this.treeControl.expandAll();else if(this.expanded===!0){let t=this.treeControl.dataNodes;for(let n of t)n.level===0&&n.expandable&&this.treeControl.expand(n)}}jsonToNode(e,t){if(t===null)return{key:e,value:null,type:`null`};if(Array.isArray(t)){let n=t.map((s,o)=>this.jsonToNode(String(o),s));return{key:e,value:t,type:`array`,children:n,childCount:n.length}}if(typeof t==`object`){let n=Object.keys(t).map(s=>this.jsonToNode(s,t[s]));return{key:e,value:t,type:`object`,children:n,childCount:n.length}}return{key:e,value:t,type:typeof t}}formatDisplay(e){return e.type===`null`?`null`:e.type===`string`?`"${e.value}"`:String(e.value)}static ɵfac=function(t){return new(t||i)};static ɵcmp=Ee({type:i,selectors:[[`p3xr-json-tree`]],inputs:{data:`data`,label:`label`,expanded:`expanded`,depth:`depth`,wrap:`wrap`},features:[En],decls:3,vars:5,consts:[[1,`p3xr-json-mat-tree`,3,`dataSource`,`treeControl`],[`matTreeNodePadding`,``,3,`matTreeNodePaddingIndent`,4,`matTreeNodeDef`],[`matTreeNodePadding`,``,3,`matTreeNodePaddingIndent`,4,`matTreeNodeDef`,`matTreeNodeDefWhen`],[`matTreeNodePadding`,``,3,`matTreeNodePaddingIndent`],[`mat-icon-button`,``,`disabled`,``,1,`p3xr-json-tree-toggle`,`p3xr-json-tree-toggle-hidden`],[1,`p3xr-json-tree-leaf-content`],[1,`p3xr-json-tree-leaf-key`],[1,`p3xr-json-tree-key`],[1,`p3xr-json-tree-colon`],[`mat-icon-button`,``,`matTreeNodeToggle`,``,1,`p3xr-json-tree-toggle`],[1,`p3xr-json-tree-bracket`],[1,`p3xr-json-tree-ellipsis`],[1,`p3xr-json-tree-count`]],template:function(t,n){t&1&&(Wa(0,`mat-tree`,0),hy(1,it,12,5,`mat-tree-node`,1)(2,rt,9,4,`mat-tree-node`,2),wf()),t&2&&(vt(`p3xr-json-tree-nowrap`,!n.wrap),by(`dataSource`,n.dataSource)(`treeControl`,n.treeControl),Sn(2),by(`matTreeNodeDefWhen`,n.hasChild))},dependencies:[Eb,Ye,We,Je,Xe,qe,$e,yt,wt,$Y,G0],styles:[`.p3xr-json-mat-tree{font-family:Roboto Mono,monospace;font-size:13px;background:inherit!important}.p3xr-json-mat-tree .mat-tree-node,.p3xr-json-mat-tree .mat-nested-tree-node{background:inherit!important;color:inherit!important}.p3xr-json-mat-tree .mat-tree-node{min-height:24px;height:auto;line-height:1.6}.p3xr-json-tree-toggle-hidden{visibility:hidden!important}.p3xr-json-tree-toggle{width:24px!important;height:24px!important;padding:0!important;flex-shrink:0}.p3xr-json-tree-toggle .mat-icon{font-size:18px;width:18px;height:18px;opacity:.6}.p3xr-json-tree-leaf-content{flex:1;min-width:0;display:flex;align-items:flex-start;gap:6px}.p3xr-json-tree-leaf-key{flex-shrink:0;white-space:nowrap}.p3xr-json-tree-value{word-break:break-word;min-width:0}.p3xr-json-tree-key{font-weight:700;color:var(--%NS%p3xr-json-key-color, #881391)}.p3xr-json-tree-colon{opacity:.6}.p3xr-json-tree-bracket{opacity:.5}.p3xr-json-tree-ellipsis{opacity:.4;margin:0 2px}.p3xr-json-tree-count{opacity:.4;font-size:11px;margin-left:4px;align-self:center}:host{display:block}.p3xr-json-tree-value-string{color:var(--%NS%p3xr-json-value-string, #0b7500)}.p3xr-json-tree-value-number{color:var(--%NS%p3xr-json-value-number, #1a01cc)}.p3xr-json-tree-value-boolean{color:var(--%NS%p3xr-json-value-boolean, #c41a16)}.p3xr-json-tree-value-null{color:var(--%NS%p3xr-json-value-null, #808080);font-style:italic}.p3xr-json-mat-tree .p3xr-json-tree-value{word-break:break-all}.p3xr-json-mat-tree.p3xr-json-tree-nowrap .p3xr-json-tree-value{white-space:nowrap;word-break:normal}.p3xr-json-mat-tree.p3xr-json-tree-nowrap .mat-tree-node{flex-wrap:nowrap}
`],encapsulation:2,changeDetection:1})}return i})();export{Wt as t};