import{a as H,b as O}from"./chunk-JEOVGUX6.js";import{f as M,s as $}from"./chunk-LBZE4AC4.js";import{b as w}from"./chunk-RTVR37QC.js";import{I as B}from"./chunk-QHAVDXDG.js";import{X as T,Z as A,d as m,f as I,g as S,j as v,n as N,o as Q,q as E,qa as j,s as R}from"./chunk-27KSTDMK.js";import{m as L,n as D,o as x,p as U}from"./chunk-OWZ5YAMH.js";import{z as k}from"./chunk-GQAU5ACB.js";import{Bb as p,Ea as g,Ib as _,fd as n,gd as a,hc as l,ic as q,jc as C,k as u,kc as G,la as b,qa as f,sb as h,yd as y}from"./chunk-ISMRT7VU.js";import{a as c,b as F}from"./chunk-M5TX2NVG.js";var i=class d{static quickGroups(r){return r.quickGroups}setQuickGroups(r,t){r.setState(c({},t.quickGroup))}clearQuickGroups(r){r.setState({quickGroups:[]})}static{this.\u0275fac=function(t){return new(t||d)}}static{this.\u0275prov=b({token:d,factory:d.\u0275fac})}};u([D(H)],i.prototype,"setQuickGroups",null);u([D(O)],i.prototype,"clearQuickGroups",null);u([U()],i,"quickGroups",null);i=u([x({name:"quickGroup",defaults:{quickGroups:[]}})],i);var mt=(()=>{class s{constructor(t,e,o,P){this.data=t,this._dialogRef=e,this._cdr=o,this._fb=P,this.destroyRef=f(g),this.quickGroups$=f(L).select(i.quickGroups),this.quickGroups=[],this.quickGroupForm=this._fb.group({name:this._fb.nonNullable.control(this.data?.name??"",[m.required,m.minLength($.min),m.maxLength(M.max)]),parentId:this._fb.control(this.data?.parentId??null)})}ngOnInit(){this._dialogRef.submitData$$.next(this.quickGroupForm),this._initSubs()}_initSubs(){this.quickGroups$.pipe(k(this.destroyRef)).subscribe(t=>{this.quickGroups=this._filterGroups(t)}),this._dialogRef.instance?.submitted.pipe(k(this.destroyRef)).subscribe(()=>this._cdr.markForCheck())}_filterGroups(t){return this.data?.id?t.filter(e=>e.id!==this.data?.id).map(e=>F(c({},e),{children:e.children.filter(o=>o.id!==this.data?.id)})):t}static{this.\u0275fac=function(e){return new(e||s)(p(A),p(T),p(y),p(E))}}static{this.\u0275cmp=_({type:s,selectors:[["tis-upsert-quick-group-dialog"]],decls:7,vars:14,consts:[[3,"formGroup"],["formControlName","name","token","name",3,"label","placeholder"],["formControlName","parentId","token","parentId",3,"options","label","placeholder"]],template:function(e,o){e&1&&(q(0,"form",0),G(1,"tis-text-field",1),n(2,"translate"),n(3,"translate"),G(4,"wk-tree-input",2),n(5,"translate"),n(6,"translate"),C()),e&2&&(l("formGroup",o.quickGroupForm),h(),l("label",a(2,6,"\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u0433\u0440\u0443\u043F\u043F\u044B"))("placeholder",a(3,8,"\u041D\u0430\u043F\u0440\u0438\u043C\u0435\u0440: \u041D\u0430\u043F\u0438\u0442\u043A\u0438")),h(3),l("options",o.quickGroups)("label",a(5,10,"\u0420\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u0441\u043A\u0430\u044F \u0433\u0440\u0443\u043F\u043F\u0430"))("placeholder",a(6,12,"\u041D\u0435 \u0432\u044B\u0431\u0440\u0430\u043D\u043E")))},dependencies:[R,v,I,S,Q,N,w,j,B],encapsulation:2,changeDetection:0})}}return s})();export{i as a,mt as b};
//# sourceMappingURL=chunk-DUDPUB5T.js.map
