import{a as M,c as A,i as U}from"./chunk-ZSNLO3TX.js";import{b as C}from"./chunk-D5M6Y5VI.js";import{g as I}from"./chunk-CX23ZL4L.js";import{B as l,Eb as b,N as g,P as h,U as P,ba as S,da as u,ea as T,g as c,ga as j,ha as o,ka as v,p,pa as m,ua as a,v as f}from"./chunk-IYD54RT7.js";var L=(()=>{let t=class t{constructor(e){this.ui=e,this._filter=b(""),this._singleLineAdjustment=new c(0),this._columnCount=new c(0),this._selected=b({id:"",description:"",interfaceLogicalType:"",interfacePlatformType2sComplement:!1,interfacePlatformTypeAnalogAccuracy:"",interfacePlatformTypeBitsResolution:"",interfacePlatformTypeBitSize:"",interfacePlatformTypeCompRate:"",interfaceDefaultValue:"",enumSet:{name:"",applicability:{id:"1",name:"Base"},description:""},interfacePlatformTypeMaxval:"",interfacePlatformTypeMinval:"",interfacePlatformTypeMsbValue:"",interfacePlatformTypeUnits:"",interfacePlatformTypeValidRangeDescription:"",name:"",applicability:{id:"1",name:"Base"}})}get filter(){return this._filter}set filterString(e){this._filter.set(e)}get singleLineAdjustment(){return this._singleLineAdjustment}set singleLineAdjustmentNumber(e){e!==this._singleLineAdjustment.getValue()&&this._singleLineAdjustment.next(e)}get columnCount(){return this._columnCount}set columnCountNumber(e){e!==this._columnCount.getValue()&&this._columnCount.next(e)}get typeUpdateRequired(){return this.ui.update}set updateTypes(e){this.ui.updated=e}get BranchId(){return this.ui.id}set BranchIdString(e){this.ui.idValue=e}set branchType(e){this.ui.typeValue=e}get selected(){return this._selected}select(e){this._selected.update(i=>i.id!==e.id?e:{id:"",description:"",interfaceLogicalType:"",interfacePlatformType2sComplement:!1,interfacePlatformTypeAnalogAccuracy:"",interfacePlatformTypeBitsResolution:"",interfacePlatformTypeBitSize:"",interfacePlatformTypeCompRate:"",interfaceDefaultValue:"",enumSet:{name:"",applicability:{id:"1",name:"Base"},description:""},interfacePlatformTypeMaxval:"",interfacePlatformTypeMinval:"",interfacePlatformTypeMsbValue:"",interfacePlatformTypeUnits:"",interfacePlatformTypeValidRangeDescription:"",name:"",applicability:{id:"1",name:"Base"}})}};t.\u0275fac=function(i){return new(i||t)(a(I))},t.\u0275prov=m({token:t,factory:t.\u0275fac,providedIn:"root"});let n=t;return n})();var q=(()=>{let t=class t{constructor(e,i,s,d){this.typesService=e,this.uiService=i,this.preferenceService=s,this.sharedTypeService=d,this._currentPage$=new c(0),this._currentPageSize$=new c(10),this._filterObs=C(this.uiService.filter),this._typeData=f([this._filterObs,this.uiService.BranchId,this.currentPage,this.currentPageSize]).pipe(u(),g(500),P(),o(([y,r,B,V])=>l(()=>r!==""&&r!=="0"&&r!=="-1",this.typesService.getFilteredTypes(y,r,B+1,V).pipe(S(_=>this.uiService.typeUpdateRequired),u(),v(_=>{_.length<=this.uiService.columnCount.getValue()?this.uiService.singleLineAdjustmentNumber=30:this.uiService.singleLineAdjustmentNumber=0})),p([]))),T({refCount:!0,bufferSize:1}),j([])),this._typeDataCount=f([this._filterObs,this.uiService.BranchId]).pipe(u(),g(500),P(),o(([y,r])=>l(()=>r!==""&&r!=="0"&&r!=="-1",this.typesService.getFilteredTypesCount(y,r).pipe(S(B=>this.uiService.typeUpdateRequired),u()),p(0))),T({refCount:!0,bufferSize:1}))}get typeData(){return this._typeData}get typeDataCount(){return this._typeDataCount}createType(e,i,s){return this.sharedTypeService.createType(e,i,s)}get currentPage(){return this._currentPage$}set page(e){this._currentPage$.next(e)}get currentPageSize(){return this._currentPageSize$}set pageSize(e){this._currentPageSize$.next(e)}get preferences(){return this.preferenceService.preferences}get inEditMode(){return this.preferenceService.inEditMode}get BranchPrefs(){return this.preferenceService.BranchPrefs}updatePreferences(e){return this.createUserPreferenceBranchTransaction(e.editable).pipe(h(1),o(i=>this.typesService.performMutation(i).pipe(h(1),v(()=>{this.uiService.updateTypes=!0}))))}createUserPreferenceBranchTransaction(e){return f(this.preferences,this.uiService.BranchId,this.BranchPrefs).pipe(h(1),o(([i,s,d])=>l(()=>i.hasBranchPref,p({branch:"570",txComment:"Updating MIM User Preferences",modifyArtifacts:[{id:i.id,setAttributes:[{typeName:"MIM Branch Preferences",value:[...d,`${s}:${e}`]}]}]}),p({branch:"570",txComment:"Updating MIM User Preferences",modifyArtifacts:[{id:i.id,addAttributes:[{typeName:"MIM Branch Preferences",value:`${s}:${e}`}]}]}))))}};t.\u0275fac=function(i){return new(i||t)(a(M),a(L),a(U),a(A))},t.\u0275prov=m({token:t,factory:t.\u0275fac,providedIn:"root"});let n=t;return n})();export{L as a,q as b};
