1import{$ as y,C as c,G as u,La as b,Nc as a,Oa as D,Y as l,a as m,b as p,fa as f,id as d,lb as n,od as _,pd as B,r as i,s as S,vd as h,w as g}from"./chunk-IUFI4OZW.js";var L=(()=>{class o{constructor(){this.httpClient=f(B),this.transferState=f(D),this.platformId=f(b),this._brandConfig=n(null),this.brandConfig=a(()=>this._brandConfig()),this._featuredComments=n([]),this.featuredComments=a(()=>this._featuredComments()),this._loyaltyPlan=n(null),this.loyaltyState=a(()=>this._loyaltyPlan()),this._storeStatus=n(null),this.storeStatus=a(()=>this._storeStatus()),this._storeData=n(null),this.storeData=a(()=>this._storeData()),this.storeTimeZone=a(()=>this._storeData()?.timeZone??this._storeStatus()?.details?.localTimeZone??o.FALLBACK_TIME_ZONE),this._multipleStoresData=n([]),this.multipleStoresData=a(()=>this._multipleStoresData()),this.singleStore=a(()=>{let t=this.brandConfig()?.stores??[];return t.length>1?null:t[0]??null})}static{this.FALLBACK_TIME_ZONE="America/New_York"}hydrateBrandState(t){this._brandConfig.set(t),t.plans.length?this._loyaltyPlan.set(t.plans[0]):this._loyaltyPlan.set(null)}normalizeBrandConfig(t,r){return p(m({},t),{name:t.name||t.id||r})}getBrand(t,r=!1){if(this._brandConfig()&&!r)return i(this._brandConfig());let s=`brand-config-${t}`;if(!r&&d(this.platformId)&&this.transferState.hasKey(s)){let e=this.transferState.get(s,null);if(this.transferState.remove(s),e){let C=this.normalizeBrandConfig(e,t);return this.hydrateBrandState(C),i(C)}}return this.httpClient.get(`${h.api}/brand?listStores=true&listHours=true`).pipe(g(e=>this.normalizeBrandConfig(e,t)),l(e=>{this.hydrateBrandState(e),d(this.platformId)||this.transferState.set(s,e)}),u(e=>(console.error(`Failed to fetch brand data for ${t}`,e),this._brandConfig()?i(this._brandConfig()):S(()=>e))))}getStoreStatus(t,r=!1){if(this._storeStatus()&&!r)return i(this._storeStatus());let s=`${h.api}/brand/store/status?store=${encodeURIComponent(t)}`;return this.httpClient.get(s).pipe(l(e=>this._storeStatus.set(e)))}getStoreData(t,r=!1){if(this._storeData()?.id===t&&!r)return i(this._storeData());let s=new _().set("id",t).set("includeDeliveryArea",!0);return this.httpClient.get(`${h.api}/brand/find/store`,{params:s}).pipe(l(e=>this._storeData.set(e)))}getMultipleStoresData(t=!1){if(this._multipleStoresData().length>0&&!t)return i(this._multipleStoresData());let r=this.brandConfig()?.stores??[];if(r.length===0)return i([]);let s=r.map(e=>this.httpClient.get(`${h.api}/brand/find/store`,{params:new _().set("id",e.id).set("includeDeliveryArea",!0)}).pipe(u(()=>i(p(m({},e),{deliveryAreas:[]})))));return c(s).pipe(l(e=>this._multipleStoresData.set(e)))}getReviews(){return this.httpClient.get(`${h.api}/brand/featuredComments?limit=10`).pipe(l(t=>{this._featuredComments.set(t)}),u(()=>(this._featuredComments.set([]),i([]))))}static{this.\u0275fac=function(r){return new(r||o)}}static{this.\u0275prov=y({token:o,factory:o.\u0275fac,providedIn:"root"})}}return o})();export{L as a};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.