import{a as j}from"./chunk-VB7C24XU.js";import{f as k,t as O,x as U}from"./chunk-ZVQ5RRLK.js";import{b as R}from"./chunk-HTEZFA6O.js";import{b as B,f as S}from"./chunk-LH4LY7P4.js";import{$a as x,B as v,D as T,Ia as A,Ja as L,o as u,q as y,r as E,u as F,w as I,z as N}from"./chunk-IDENGFF3.js";import{a as b,b as l}from"./chunk-IGFM5CCE.js";import{b as M}from"./chunk-YEPOPWON.js";import{o as G}from"./chunk-M6NTKB7A.js";import{Db as g,dc as a,ec as C,fc as _,fd as o,gc as m,gd as r,lb as p,ma as f,wb as n,zd as D}from"./chunk-I3FGJX2C.js";import{d as h,n as P}from"./chunk-INB5GR2I.js";import{a as c,b as d}from"./chunk-B7YGBANW.js";P();var e,w=(e=class{constructor(i,t,s,H){this.data=i,this._dialogRef=t,this._cdr=s,this._fb=H,this.categories$=f(G).select(M.categories),this.icon=S,this.categories=[],this.categoryForm=this._fb.group({name:this._fb.nonNullable.control(this.data?.name??"",[u.required,u.minLength(O.min),u.maxLength(k.max)]),isQuick:this._fb.nonNullable.control(!!this.data?.isQuick),parentId:this._fb.control(this.data?.parentId??null),comment:this._fb.nonNullable.control(this.data?.comment??"",u.maxLength(U.max))})}ngOnInit(){this._dialogRef.submitData$$.next(this.categoryForm),this._initSubs()}_initSubs(){this.categories$.pipe(l(this)).subscribe(i=>{this.categories=this._filterOutCurrentCategory(i)}),this._dialogRef.instance?.submitted.pipe(l(this)).subscribe(()=>this._cdr.markForCheck())}_filterOutCurrentCategory(i){return this.data?.id?i.filter(t=>t.id!==this.data?.id).map(t=>d(c({},t),{children:this._filterOutCurrentCategory(t.children)})):i}},e.\u0275fac=function(t){return new(t||e)(n(L),n(A),n(D),n(v))},e.\u0275cmp=g({type:e,selectors:[["tis-upsert-category-dialog"]],decls:9,vars:19,consts:[[3,"formGroup"],["formControlName","name","token","name",3,"label","placeholder"],["formControlName","parentId","token","parentId",3,"searchInput","options","label","placeholder"],["formControlName","comment","token","comment",3,"minHeight","label"]],template:function(t,s){t&1&&(C(0,"form",0),m(1,"tis-text-field",1),o(2,"translate"),o(3,"translate"),m(4,"wk-tree-input",2),o(5,"translate"),o(6,"translate"),m(7,"tis-text-area",3),o(8,"translate"),_()),t&2&&(a("formGroup",s.categoryForm),p(),a("label",r(2,9,"\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438"))("placeholder",r(3,11,"\u041D\u0430\u043F\u0440\u0438\u043C\u0435\u0440: \u041E\u0432\u043E\u0449\u0438 \u0438 \u0444\u0440\u0443\u043A\u0442\u044B")),p(3),a("searchInput",!0)("options",s.categories)("label",r(5,13,"\u0420\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u0441\u043A\u0430\u044F \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F"))("placeholder",r(6,15,"\u041D\u0435 \u0432\u044B\u0431\u0440\u0430\u043D\u043E")),p(3),a("minHeight",68)("label",r(8,17,"\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439")))},dependencies:[T,F,y,E,I,N,R,x,j,B],styles:[`.tree-view-item[_ngcontent-%COMP%]{width:100%;display:flex;gap:var(--space-horizontal-s);align-items:center}.icon-star[_ngcontent-%COMP%]{fill:var(--color-font-warning)}
/*# sourceMappingURL=upsert-category-dialog.component-4TP2JSGL.css.map */`],changeDetection:0}),e);w=h([b()],w);export{w as a};
//# sourceMappingURL=chunk-4Y472K6W.js.map
