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.3 kB
JavaScript
import {a8 as y,T as p,ab as Ae,aa as Z$1,bT as je,cv as lc,L as uc,a9 as q,ac as uo,a2 as C$1,ad as Vn,cw as L6,bI as h,cx as Lb,cy as Bt,bZ as Se,ag as Ht$1,cz as Ml,ap as Nr,al as jl,am as Ps,af as oe,ak as st$1,cA as gp,cB as JE,cC as Al,_ as _e,ae as Q$1,cD as Ar,aH as Of,ar as re,as as ee$1,aS as Gv,bV as Jr,aW as tn,cE as Tc,a5 as QE,b$ as Hn,cF as cn,ce as gv,k as bv,a$ as rc,b0 as Df,b1 as Ef,bR as Ev,aE as ce$1,aZ as yv,aI as Ei,c4 as Be,aF as Ii,m as mb,y as yt,w as wt,e as aY,g as _A,aG as Dn,B as Ba,bq as cv,v as vf,o as mt,p as pv,c as In,I as IS,J as JT,R as Rv,a_ as wf,n as no,r as ro,t as If}from'./chunk-BwlFOdbx.js';import {F,E}from'./main-HNF44SV3.js';var le=class{dataNodes;expansionModel=new h(true);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}},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 y("CDK_TREE_NODE_OUTLET_NODE"),Y=(()=>{class i{viewContainer=p(Ae);_node=p(he,{optional:true});static \u0275fac=function(t){return new(t||i)};static \u0275dir=Z$1({type:i,selectors:[["","cdkTreeNodeOutlet",""]]})}return i})(),ce=class{$implicit;level;index;count;constructor(r){this.$implicit=r;}},G=(()=>{class i{template=p(je);when;static \u0275fac=function(t){return new(t||i)};static \u0275dir=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 S=(()=>{class i{_differs=p(lc);_changeDetectorRef=p(uc);_elementRef=p(q);_dir=p(uo);_onDestroy=new C$1;_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 Vn({start:0,end:Number.MAX_VALUE});_expansionModel;_flattenedNodes=new Vn([]);_nodeType=new Vn(null);_nodes=new Vn(new Map);_keyManagerNodes=new Vn([]);_keyManagerFactory=p(L6);_keyManager;_viewInit=false;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=true;}_updateDefaultNodeDefinition(){let e=this._nodeDefs.filter(t=>!t.when);e.length>1,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(true),this._expansionModel)}_subscribeToDataChanges(){if(this._dataSubscription)return;let e;Lb(this._dataSource)?e=this._dataSource.connect(this):Bt(this._dataSource)?e=this._dataSource:Array.isArray(this._dataSource)&&(e=Se(this._dataSource)),e&&(this._dataSubscription=this._getRenderData(e).pipe(Ht$1(this._onDestroy)).subscribe(t=>{this._renderDataChanges(t);}));}_getRenderData(e){let t=this._getExpansionModel();return Ml([e,this._nodeType,t.changed.pipe(Nr(null),jl(n=>{this._emitExpansionChanges(n);}))]).pipe(Ps(([n,s])=>s===null?Se({renderNodes:n,flattenedNodes:null,nodeType:s}):this._computeRenderingData(n,s).pipe(oe(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(true);for(let n of e.removed)t.get(n)?._emitExpansionState(false);}_initializeKeyManager(){let e=Ml([this._keyManagerNodes,this._nodes]).pipe(oe(([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:true,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;let n=this._nodeDefs.find(s=>s.when&&s.when(t,e))||this._defaultNodeDef;return n}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),M.mostRecentTreeNode&&(M.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(st$1(1),Ht$1(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(st$1(1),Ht$1(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 Se([]);let s=this._getExpansionKey(e),o=n.changed.pipe(Ps(d=>d.added.includes(s)?Se(true):d.removed.includes(s)?Se(false):Hn),Nr(this.isExpanded(e)));if(t)return Ml([o,this._flattenedNodes]).pipe(oe(([d,l])=>d?this._findChildrenByLevel(t,l,e,1):[]));let a=this._getChildrenAccessor();if(a)return gp(a(e)??[]);throw ze()}_findChildrenByLevel(e,t,n,s){let o=this._getExpansionKey(n),a=t.findIndex(N=>this._getExpansionKey(N)===o),d=e(n),l=d+s,m=[];for(let N=a+1;N<t.length;N++){let fe=e(t[N]);if(fe<=d)break;fe<=l&&m.push(t[N]);}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(oe(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 Se(this.treeControl.getDescendants(e));if(this.levelAccessor){let t=this._findChildrenByLevel(this.levelAccessor,this._flattenedNodes.value,e,1/0);return Se(t)}if(this.childrenAccessor)return this._getAllChildrenRecursively(e).pipe(JE((t,n)=>(t.push(...n),t),[]));throw ze()}_getAllChildrenRecursively(e){return this.childrenAccessor?gp(this.childrenAccessor(e)).pipe(st$1(1),Ps(t=>{for(let n of t)this._parents.set(this._getExpansionKey(n),e);return Se(...t).pipe(Al(n=>cn(Se([n]),this._getAllChildrenRecursively(n))))})):Se([])}_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?Se(...e).pipe(Al(s=>{let o=this._getExpansionKey(s);this._parents.has(o)||this._parents.set(o,null),this._levels.set(o,t);let a=gp(n(s));return cn(Se([s]),a.pipe(st$1(1),jl(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);}}),Ps(d=>d?this._flattenNestedNodesWithExpansion(d,t+1).pipe(oe(l=>this.isExpanded(s)?l:[])):Se([]))))}),JE((s,o)=>(s.push(...o),s),[])):Se([...e])}_computeRenderingData(e,t){if(this.childrenAccessor&&t==="flat")return this._clearPreviousCache(),this._ariaSets.set(null,[...e]),this._flattenNestedNodesWithExpansion(e).pipe(oe(n=>({renderNodes:n,flattenedNodes:n})));if(this.levelAccessor&&t==="nested"){let n=this.levelAccessor;return Se(e.filter(s=>n(s)===0)).pipe(oe(s=>({renderNodes:s,flattenedNodes:e})),jl(({flattenedNodes:s})=>{this._calculateParents(s);}))}else return t==="flat"?Se({renderNodes:e,flattenedNodes:e}).pipe(jl(({flattenedNodes:n})=>{this._calculateParents(n);})):(this._clearPreviousCache(),this._ariaSets.set(null,[...e]),this._flattenNestedNodesWithExpansion(e).pipe(oe(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?Ml(n).pipe(st$1(1),Ht$1(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 \u0275fac=function(t){return new(t||i)};static \u0275cmp=_e({type:i,selectors:[["cdk-tree"]],contentQueries:function(t,n,s){if(t&1&&Ev(s,G,5),t&2){let o;Df(o=Ef())&&(n._nodeDefs=o);}},viewQuery:function(t,n){if(t&1&&rc(Y,7),t&2){let s;Df(s=Ef())&&(n._nodeOutlet=s.first);}},hostAttrs:["role","tree",1,"cdk-tree"],hostBindings:function(t,n){t&1&&bv("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&&gv(0,0);},dependencies:[Y],encapsulation:2,changeDetection:1})}return i})(),M=(()=>{class i{_elementRef=p(q);_tree=p(S);_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===false&&this.collapse());}get isExpanded(){return this._tree.isExpanded(this._data)}set isExpanded(e){this._inputIsExpanded=e,e?this.expand():this.collapse();}isDisabled=false;typeaheadLabel=null;getLabel(){return this.typeaheadLabel||this._elementRef.nativeElement.textContent?.trim()||""}activation=new Q$1;expandedChange=new Q$1;static mostRecentTreeNode=null;_destroyed=new C$1;_dataChanges=new C$1;_inputIsExpandable=false;_inputIsExpanded=void 0;_shouldFocus=true;_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)?true: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=p(uc);constructor(){i.mostRecentTreeNode=this;}ngOnInit(){this._parentNodeAriaLevel=Ge(this._elementRef.nativeElement),this._tree._getExpansionModel().changed.pipe(oe(()=>this.isExpanded),Ar(),Ht$1(this._destroyed)).pipe(Ht$1(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=false,this._tree._keyManager.focusItem(this),this._shouldFocus=true);}_emitExpansionState(e){this.expandedChange.emit(e);}static \u0275fac=function(t){return new(t||i)};static \u0275dir=Z$1({type:i,selectors:[["cdk-tree-node"]],hostAttrs:["role","treeitem",1,"cdk-tree-node"],hostVars:5,hostBindings:function(t,n){t&1&&bv("click",function(){return n._setActiveItem()})("focus",function(){return n._focusItem()}),t&2&&(yv("tabIndex",n._tabindex),Ei("aria-expanded",n._getAriaExpanded())("aria-level",n.level+1)("aria-posinset",n._getPositionInSet())("aria-setsize",n._getSetSize()));},inputs:{role:"role",isExpandable:[2,"isExpandable","isExpandable",ce$1],isExpanded:"isExpanded",isDisabled:[2,"isDisabled","isDisabled",ce$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")?Of(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%]+)$/,pe=(()=>{class i{_treeNode=p(M);_tree=p(S);_element=p(q);_dir=p(uo,{optional:true});_currentPadding=null;_destroyed=new C$1;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$1(this._destroyed)).subscribe(()=>this._setPadding(true)),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=false){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=Of(t),this._setPadding();}static \u0275fac=function(t){return new(t||i)};static \u0275dir=Z$1({type:i,selectors:[["","cdkTreeNodePadding",""]],inputs:{level:[2,"cdkTreeNodePadding","level",Of],indent:[0,"cdkTreeNodePaddingIndent","indent"]}})}return i})(),ue=(()=>{class i{_tree=p(S);_treeNode=p(M);recursive=false;_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 \u0275fac=function(t){return new(t||i)};static \u0275dir=Z$1({type:i,selectors:[["","cdkTreeNodeToggle",""]],hostAttrs:["tabindex","-1"],hostBindings:function(t,n){t&1&&bv("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",ce$1]}})}return i})();var Qe=(()=>{class i{static \u0275fac=function(t){return new(t||i)};static \u0275mod=re({type:i});static \u0275inj=ee$1({})}return i})();function tt(i){return !!i._isNoopTreeKeyManager}var $e=(()=>{class i extends M{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=p(new Gv("tabindex"),{optional:true});this.tabIndexInputBinding=Number(e)||this.defaultTabIndex;}ngOnInit(){super.ngOnInit();}ngOnDestroy(){super.ngOnDestroy();}static \u0275fac=function(t){return new(t||i)};static \u0275dir=Z$1({type:i,selectors:[["mat-tree-node"]],hostAttrs:[1,"mat-tree-node"],hostVars:5,hostBindings:function(t,n){t&1&&bv("click",function(){return n._focusItem()}),t&2&&(yv("tabIndex",n._getTabindexAttribute()),Ei("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:Of(e)],disabled:[2,"disabled","disabled",ce$1]},outputs:{activation:"activation",expandedChange:"expandedChange"},exportAs:["matTreeNode"],features:[Ii([{provide:M,useExisting:i}]),Be]})}return i})(),We=(()=>{class i extends G{data;static \u0275fac=(()=>{let e;return function(n){return (e||(e=Jr(i)))(n||i)}})();static \u0275dir=Z$1({type:i,selectors:[["","matTreeNodeDef",""]],inputs:{when:[0,"matTreeNodeDefWhen","when"],data:[0,"matTreeNode","data"]},features:[Ii([{provide:G,useExisting:i}]),Be]})}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 \u0275fac=(()=>{let e;return function(n){return (e||(e=Jr(i)))(n||i)}})();static \u0275dir=Z$1({type:i,selectors:[["","matTreeNodePadding",""]],inputs:{level:[2,"matTreeNodePadding","level",Of],indent:[0,"matTreeNodePaddingIndent","indent"]},features:[Ii([{provide:pe,useExisting:i}]),Be]})}return i})(),Ue=(()=>{class i{viewContainer=p(Ae);_node=p(he,{optional:true});static \u0275fac=function(t){return new(t||i)};static \u0275dir=Z$1({type:i,selectors:[["","matTreeNodeOutlet",""]],features:[Ii([{provide:Y,useExisting:i}])]})}return i})(),qe=(()=>{class i extends S{_nodeOutlet=void 0;static \u0275fac=(()=>{let e;return function(n){return (e||(e=Jr(i)))(n||i)}})();static \u0275cmp=_e({type:i,selectors:[["mat-tree"]],viewQuery:function(t,n){if(t&1&&rc(Ue,7),t&2){let s;Df(s=Ef())&&(n._nodeOutlet=s.first);}},hostAttrs:[1,"mat-tree"],exportAs:["matTree"],features:[Ii([{provide:S,useExisting:i}]),Be],decls:1,vars:0,consts:[["matTreeNodeOutlet",""]],template:function(t,n){t&1&&gv(0,0);},dependencies:[Ue],styles:[`.mat-tree {
display: block;
background-color: var(--mat-tree-container-background-color, var(--mat-sys-surface));
}
.mat-tree-node,
.mat-nested-tree-node {
color: var(--mat-tree-node-text-color, var(--mat-sys-on-surface));
font-family: var(--mat-tree-node-text-font, var(--mat-sys-body-large-font));
font-size: var(--mat-tree-node-text-size, var(--mat-sys-body-large-size));
font-weight: var(--mat-tree-node-text-weight, var(--mat-sys-body-large-weight));
}
.mat-tree-node {
display: flex;
align-items: center;
flex: 1;
word-wrap: break-word;
min-height: var(--mat-tree-node-min-height, 48px);
}
.mat-nested-tree-node {
border-bottom-width: 0;
}
`],encapsulation:2,changeDetection:1})}return i})(),Xe=(()=>{class i extends ue{static \u0275fac=(()=>{let e;return function(n){return (e||(e=Jr(i)))(n||i)}})();static \u0275dir=Z$1({type:i,selectors:[["","matTreeNodeToggle",""]],inputs:{recursive:[0,"matTreeNodeToggleRecursive","recursive"]},features:[Ii([{provide:ue,useExisting:i}]),Be]})}return i})();var Ye=(()=>{class i{static \u0275fac=function(t){return new(t||i)};static \u0275mod=re({type:i});static \u0275inj=ee$1({imports:[Qe,tn]})}return i})(),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(st$1(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]=true,r.forEach(s=>{let o=true;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}},ee=class extends Tc{_treeControl;_treeFlattener;_flattenedData=new Vn([]);_expandedData=new Vn([]);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 Vn([]);constructor(r,e,t){super(),this._treeControl=r,this._treeFlattener=e,t&&(this.data=t);}connect(r){return QE(r.viewChange,this._treeControl.expansionModel.changed,this._flattenedData).pipe(oe(()=>(this._expandedData.next(this._treeFlattener.expandFlattenedNodes(this._flattenedData.value,this._treeControl)),this._expandedData.value)))}disconnect(){}};function it(i,r){if(i&1&&(Ba(0,"mat-tree-node",3)(1,"button",4)(2,"mat-icon"),IS(3,"chevron_right"),vf()(),Ba(4,"span",5)(5,"span",6)(6,"span",7),IS(7),vf(),Ba(8,"span",8),IS(9,":"),vf()(),Ba(10,"span"),IS(11),vf()()()),i&2){let e=r.$implicit,t=JT();pv("matTreeNodePaddingIndent",20),In(7),Rv(e.key),In(3),wf("p3xr-json-tree-value p3xr-json-tree-value-"+e.type),In(),Rv(t.formatDisplay(e));}}function st(i,r){if(i&1&&(Ba(0,"span",10),IS(1),vf(),Ba(2,"span",11),IS(3,"..."),vf(),Ba(4,"span",10),IS(5),vf(),Ba(6,"span",12),IS(7),vf()),i&2){let e=JT().$implicit;In(),Rv(e.type==="array"?"[":"{"),In(4),Rv(e.type==="array"?"]":"}"),In(2),If("(",e.childCount,")");}}function rt(i,r){if(i&1&&(Ba(0,"mat-tree-node",3)(1,"button",9)(2,"mat-icon"),IS(3),vf()(),Ba(4,"span",7),IS(5),vf(),Ba(6,"span",8),IS(7,":\xA0"),vf(),no(8,st,8,3),vf()),i&2){let e=r.$implicit,t=JT();pv("matTreeNodePaddingIndent",20),In(3),Rv(t.treeControl.isExpanded(e)?"expand_more":"chevron_right"),In(2),Rv(e.key),In(3),ro(t.treeControl.isExpanded(e)?-1:8);}}var Wt=(()=>{class i{data;label="";expanded=true;depth=0;wrap=true;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===true){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 \u0275fac=function(t){return new(t||i)};static \u0275cmp=_e({type:i,selectors:[["p3xr-json-tree"]],inputs:{data:"data",label:"label",expanded:"expanded",depth:"depth",wrap:"wrap"},features:[Dn],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&&(Ba(0,"mat-tree",0),cv(1,it,12,5,"mat-tree-node",1)(2,rt,9,4,"mat-tree-node",2),vf()),t&2&&(mt("p3xr-json-tree-nowrap",!n.wrap),pv("dataSource",n.dataSource)("treeControl",n.treeControl),In(2),pv("matTreeNodeDefWhen",n.hasChild));},dependencies:[mb,Ye,We,Je,Xe,qe,$e,yt,wt,aY,_A],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(--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(--p3xr-json-value-string, #0b7500)}.p3xr-json-tree-value-number{color:var(--p3xr-json-value-number, #1a01cc)}.p3xr-json-tree-value-boolean{color:var(--p3xr-json-value-boolean, #c41a16)}.p3xr-json-tree-value-null{color:var(--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 W};