import{c as R}from"./chunk-VFX53AYF.js";import{f as U,t as c}from"./chunk-ZVQ5RRLK.js";import{b as w}from"./chunk-TPHZRJVN.js";import{b as B,e as j,f as O}from"./chunk-L2U5MHO4.js";import{$a as k,B as S,D as A,Ga as L,Ha as T,Xa as x,o as p,q as v,r as I,u as F,w as E,z as N}from"./chunk-6PWFR42O.js";import{a as y,b as m}from"./chunk-IGFM5CCE.js";import{b as M}from"./chunk-YEPOPWON.js";import{o as G}from"./chunk-M6NTKB7A.js";import{Db as C,dc as a,ec as _,fc as b,fd as r,gc as l,gd as n,lb as s,ma as g,wb as o,zd as D}from"./chunk-I3FGJX2C.js";import{d as f,n as $}from"./chunk-INB5GR2I.js";import{a as d,b as h}from"./chunk-B7YGBANW.js";$();var e,z=(e=class{constructor(i,t,u,P,H){this.data=i,this._dialogRef=t,this._cdr=u,this._fb=P,this._localizationService=H,this.categories$=g(G).select(M.categories),this.icon=O,this.categories=[],this.categoryForm=this._fb.group({name:this._fb.nonNullable.control(this.data?.name??"",[p.required,p.minLength(c.min),p.maxLength(U.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??"",R(c.max,this._localizationService.getSync.bind(this._localizationService)))})}ngOnInit(){this._dialogRef.submitData$$.next(this.categoryForm),this._initSubs()}_initSubs(){this.categories$.pipe(m(this)).subscribe(i=>{this.categories=this._filterOutCurrentCategory(i)}),this._dialogRef.instance?.submitted.pipe(m(this)).subscribe(()=>this._cdr.markForCheck())}_filterOutCurrentCategory(i){return this.data?.id?i.filter(t=>t.id!==this.data?.id).map(t=>h(d({},t),{children:this._filterOutCurrentCategory(t.children)})):i}},e.\u0275fac=function(t){return new(t||e)(o(T),o(L),o(D),o(S),o(j))},e.\u0275cmp=C({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,u){t&1&&(_(0,"form",0),l(1,"tis-text-field",1),r(2,"translate"),r(3,"translate"),l(4,"wk-tree-input",2),r(5,"translate"),r(6,"translate"),l(7,"wk-text-area",3),r(8,"translate"),b()),t&2&&(a("formGroup",u.categoryForm),s(),a("label",n(2,9,"\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438"))("placeholder",n(3,11,"\u041D\u0430\u043F\u0440\u0438\u043C\u0435\u0440: \u041E\u0432\u043E\u0449\u0438 \u0438 \u0444\u0440\u0443\u043A\u0442\u044B")),s(3),a("searchInput",!0)("options",u.categories)("label",n(5,13,"\u0420\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u0441\u043A\u0430\u044F \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F"))("placeholder",n(6,15,"\u041D\u0435 \u0432\u044B\u0431\u0440\u0430\u043D\u043E")),s(3),a("minHeight",68)("label",n(8,17,"\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439")))},dependencies:[A,F,v,I,E,N,w,k,x,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);z=f([y()],z);export{z as a};
//# sourceMappingURL=chunk-JEWEX3QR.js.map
