import{a as g,b as $}from"./chunk-B47LJMRU.js";import{b as I}from"./chunk-QG2WC3H3.js";import{a as T}from"./chunk-ZZVJWSMI.js";import{a as o}from"./chunk-KHAMQZND.js";import{c as y}from"./chunk-OBT56KUD.js";import{F as p,P as n,ha as c,ka as S,pa as b,ua as h,v as d}from"./chunk-IYD54RT7.js";import{a as f,b as v}from"./chunk-RVFOIZLJ.js";var l=(()=>{let s=class s{constructor(e){this.http=e}getTeamStats(e,t){return this.http.get(`${o}/script/dashboard/${e}/${t}/teamstats`)}getSubsystemStats(e,t){return this.http.get(`${o}/script/dashboard/${e}/${t}/subsystemstats`)}getTimelineStats(e,t){return this.http.get(`${o}/script/dashboard/${e}/${t}/timelinestats`)}getSubsystems(e,t,a,r,i){let m={pageNum:a,pageSize:r,orderByAttributeType:i};return t&&(m=v(f({},m),{filter:t})),this.http.get(`${o}/script/dashboard/${e}/subsystems`,{params:m})}getSubsystemsCount(e,t){let a={};return t&&(a=v(f({},a),{filter:t})),this.http.get(`${o}/script/dashboard/${e}/subsystems/count`,{params:a})}getTeams(e,t,a,r,i){let m={filter:t,pageNum:a,pageSize:r,orderByAttributeType:i};return this.http.get(`${o}/script/dashboard/${e}/teams`,{params:m})}getTeamsCount(e,t){return this.http.get(`${o}/script/dashboard/${e}/teams/count`,{params:{filter:t}})}};s.\u0275fac=function(t){return new(t||s)(h(y))},s.\u0275prov=b({token:s,factory:s.\u0275fac,providedIn:"root"});let u=s;return u})();var N=(()=>{let s=class s{constructor(e,t,a){this.uiService=e,this.dashboardHttpService=t,this.transactionService=a,this._teamStats=d([this.uiService.branchId,this.uiService.ciSetId]).pipe(p(([r,i])=>r!==""&&i!==""),c(([r,i])=>this.dashboardHttpService.getTeamStats(r,i))),this._subsystemStats=d([this.uiService.branchId,this.uiService.ciSetId]).pipe(p(([r,i])=>r!==""&&i!==""),c(([r,i])=>this.dashboardHttpService.getSubsystemStats(r,i))),this._timelineStats=d([this.uiService.branchId,this.uiService.ciSetId]).pipe(p(([r,i])=>r!==""&&i!==""),c(([r,i])=>this.dashboardHttpService.getTimelineStats(r,i)))}getSubsystemsPaginated(e,t,a,r){return this.uiService.branchId.pipe(n(1),p(i=>i!==""&&i!=="-1"),c(i=>this.dashboardHttpService.getSubsystems(i,e,t,a,r)))}getSubsystemsCount(e){return this.uiService.branchId.pipe(n(1),p(t=>t!==""&&t!=="-1"),c(t=>this.dashboardHttpService.getSubsystemsCount(t,e)))}createSubsystem(e){return this.uiService.branchId.pipe(n(1),c(t=>this.transactionService.performMutation({branch:t,txComment:`Create Script Subsystem ${e}`,createArtifacts:[{typeId:g.SCRIPTSUBSYSTEM,name:e}]})),S(t=>this.uiService.update=!0))}getTeamsPaginated(e,t,a,r){return this.uiService.branchId.pipe(n(1),p(i=>i!==""&&i!=="-1"),c(i=>this.dashboardHttpService.getTeams(i,e,t,a,r)))}getTeamsCount(e){return this.uiService.branchId.pipe(n(1),p(t=>t!==""&&t!=="-1"),c(t=>this.dashboardHttpService.getTeamsCount(t,e)))}createTeam(e){return this.uiService.branchId.pipe(n(1),c(t=>this.transactionService.performMutation({branch:t,txComment:`Create Script Team ${e}`,createArtifacts:[{typeId:g.SCRIPTTEAM,name:e}]})),S(t=>this.uiService.update=!0))}updateArtifact(e){return this.uiService.branchId.pipe(n(1),c(t=>this.transactionService.performMutation({branch:t,txComment:`Modifying ${e.id}`,modifyArtifacts:[{id:e.id,setAttributes:[{typeId:$.NAME,value:e.name}]}]})),S(t=>this.uiService.update=!0))}updateAttribute(e,t,a){return this.uiService.branchId.pipe(n(1),c(r=>this.transactionService.performMutation({branch:r,txComment:`Modifying ${e}`,modifyArtifacts:[{id:e,setAttributes:[{typeId:t,value:a}]}]})),S(r=>this.uiService.update=!0))}get teamStats(){return this._teamStats}get subsystemStats(){return this._subsystemStats}get timelineStats(){return this._timelineStats}};s.\u0275fac=function(t){return new(t||s)(h(T),h(l),h(I))},s.\u0275prov=b({token:s,factory:s.\u0275fac,providedIn:"root"});let u=s;return u})();export{N as a};
