import{a as n,c as m}from"./chunk-MQVHFWCE.js";import{a as b}from"./chunk-3DEA4WWC.js";import{n as g}from"./chunk-TKVDP62Z.js";import{B as r,E as f,aa as u,e as l,na as p,qa as s,u as e,v as c}from"./chunk-GJDGQISV.js";var D=class o{constructor(i,t){this.localDataService=i;this.toastr=t;this.initLocalDataConfig()}localConfig=new n;_offlineConfigSubject=new l(this.localConfig);offlineConfig$=this._offlineConfigSubject.asObservable();online$=f(r(window,"offline").pipe(e(()=>!1)),r(window,"online").pipe(e(()=>!0))).pipe(u(navigator.onLine));get isOnline(){return navigator.onLine}initLocalDataConfig(){this.localDataService.getOfflineConfig().subscribe({next:i=>{let t=new n(i.configUsingLocal,i.productUsingLocal,i.orderUsingLocal);this.pushNewValue(t),this.localConfig=t,this.updateOfflineConfigDB(i)},error:i=>{this.onErrorInitConfig()}})}onErrorInitConfig(){let i=new n;this.pushNewValue(i),this.localConfig=i,this.updateOfflineConfigDB(i)}getOnlineStatus$(){return c([this.offlineConfig$.pipe(e(i=>i.configUsingLocal)),this.online$]).pipe(e(i=>{let t=i[0],C=i[1],a;return t===!0?a=!1:a=C&&this.isOnline,a}))}pushNewValue(i){this._offlineConfigSubject.next(i)}updateOfflineConfigDB(i){this.localDataService.updateOfflineConfig(i).subscribe({next:t=>{this.pushNewValue(i)}})}static \u0275fac=function(t){return new(t||o)(s(m),s(g))};static \u0275prov=p({token:o,factory:o.\u0275fac,providedIn:"root"})};var h=class{ID;Label;Groups;DiscountRate;SalesID;Point;PointUsed;Debt;DebtLimit;ExpiryDate;DueDays;DueMonths;PricebookID;TaxTypeId;NationalIDNumber;MemberIdentification;EntityID;EntityName;Email;Mobile;Name;LoyaltyEnabled;DebtCalculated;constructor(){this.Label="",this.Point=0,this.PointUsed=0,this.Debt=0,this.EntityID=b.GuidEmpty,this.DueMonths=0,this.DueDays=0,this.LoyaltyEnabled=!1}};export{D as a,h as b};
