import{b as P}from"./chunk-BFHKBWV4.js";import{L as D}from"./chunk-YH6S4N6L.js";import{Ia as x,J as g,L as I,gc as R,pb as E}from"./chunk-SKS75OWJ.js";import{ca as j}from"./chunk-YFLVJJPF.js";import{Da as S,E as d,F as f,La as m,Oa as y,Qa as p,T as h,a as l,b as u,n as b}from"./chunk-TLSI73L3.js";var O=new y("Server Request"),Q=new y("Server Response");function L(i,a){let e=i?.root?.children?.primary?.segments,t=a?.root?.children?.primary?.segments;return e?.length===t?.length&&e.every((r,c)=>r.path===t[c].path)}function v(i,a,e){return i.has(e)&&a.has(e)&&i.get(e)===a.get(e)||!i.has(e)&&!a.has(e)}function V(i,a,e){return e.every(t=>v(i,a,t))}function B(i,a){let e=i.queryParamMap,t=a.queryParamMap;return v(e,t,"target")}function _(i,a){let e=i.queryParamMap,t=a.queryParamMap;return v(e,t,"query")}function H(i,a){let e=i.queryParamMap,t=a.queryParamMap;return v(e,t,"currentPage")}function k(i){let a=i.split("."),t=["co","com"].includes(a[a.length-2])?-3:-2;return a.slice(t).join(".")}var T=(()=>{class i{get isActive(){return this._active}get twicpicsDomain(){return this._twicpicsDomain}constructor(e,t,r,c){this.configService=e,this.scriptLoader=t,this.windowRef=r,this.request=c,this._active=!1,this.destroy$=new b,this.init()}init(){this.configService.getConfig().pipe(S(this.destroy$)).subscribe(e=>{e.twicpics?.isEnabled&&(this._active=!0,this._twicpicsDomain=e.twicpics.forcedDomain?e.twicpics.forcedDomain:this.generateTwicpicsDomain(),this.scriptLoader.embedScript({src:`https://${this._twicpicsDomain}/?v1`}))})}generateTwicpicsDomain(){let e=this.windowRef.isBrowser()?this.windowRef.nativeWindow.location.hostname:this.request.hostname;return`twicpics.${k(e)}`}normalizeMediaUrl(e){return new RegExp(/^(http|data:image|\/\/)/i).test(e)?e:"image:"+e}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}static{this.\u0275fac=function(t){return new(t||i)(p(P),p(x),p(I),p(O,8))}}static{this.\u0275prov=m({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var $=(()=>{class i{constructor(e,t,r){this.occConfig=e,this.deviceService=t,this.twicpicsService=r}normalizeMedia(e,t){if(!e)return;let r=e.isVideo==="true"||e.isVideo===!0,c=!r&&this.twicpicsService.isActive,s=!!e.videoId&&!!e.url&&e.url!=="null"&&e.url!=="",n=t||(s?{url:e.url}:void 0);return u(l({},e),{isVideo:r,originalUrl:e.url,url:this.normalizeImageUrl(e.url),urlTwicPic:c?this.twicpicsService.normalizeMediaUrl(e.url):void 0,previewMedia:this.normalizeMedia(n),twicPicsDomain:c?this.twicpicsService.twicpicsDomain:void 0})}getMediaFromContainer(e){let t=this.deviceService.isMobile,r=this.deviceService.isTablet,c=this.deviceService.isDevice;return f([t,r,c]).pipe(h(([s,n,o])=>s&&!n&&o||!s&&n&&o||!s&&!n&&!o),d(([s,n])=>s?e.mobile||e.tablet||e.desktop:n?e.tablet||e.desktop||e.mobile:e.desktop||e.tablet||e.mobile))}getMediaFromCustomMediaArray(e){let t=this.deviceService.isMobile,r=this.deviceService.isTablet,c=this.deviceService.isDevice;return f([t,r,c]).pipe(h(([s,n,o])=>s&&!n&&o||!s&&n&&o||!s&&!n&&!o),d(([s,n])=>s?e.find(o=>o.format==="mobile")||e[0]:n?e.find(o=>o.format==="tablet")||e[0]:e.find(o=>o.format==="desktop")||e[0])),e[0]}getMediaFromMediaContainerObject(e){let t=this.deviceService.isMobile,r=this.deviceService.isTablet,c=this.deviceService.isDevice;return f([t,r,c]).pipe(h(([s,n,o])=>s&&!n&&o||!s&&n&&o||!s&&!n&&!o),d(([s,n])=>s?e.mobile||e.tablet||e.desktop:n?e.tablet||e.desktop||e.mobile:e.desktop||e.tablet||e.mobile)),e.desktop||e.tablet||e.mobile}normalizeImageUrl(e){return new RegExp(/^(http|data:image|\/\/)/i).test(e)?e:(this.occConfig.backend?.media?.baseUrl||this.occConfig.backend?.occ?.baseUrl||"")+e}static{this.\u0275fac=function(t){return new(t||i)(p(g),p(j),p(T))}}static{this.\u0275prov=m({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var ie=(()=>{class i extends E{constructor(e,t){super(e),this.config=e,this.imageService=t}normalize(e){let t={};if(e)for(let r of e){let c=Object.prototype.hasOwnProperty.call(r,"galleryIndex");Object.prototype.hasOwnProperty.call(t,r.imageType)||(t[r.imageType]=c?[]:{});let s;c&&!t[r.imageType][r.galleryIndex]&&(t[r.imageType][r.galleryIndex]={}),c?s=t[r.imageType][r.galleryIndex]:s=t[r.imageType],s[r.format]=this.imageService.normalizeMedia(r)}return t}convert(e,t){if(!e)return null;t=super.convert(e,t);let r=e.bundles,c=e.indexedBundles,s=e.accessories,n=e.detachedPieces;return r&&(t.bundles=r.map(o=>u(l({},o),{galleryImages:this.normalize(o.galleryImages),products:o.products}))),c&&(t.indexedBundles=c.map(o=>u(l({},o),{galleryImages:this.normalize(o.galleryImages),products:[]}))),s&&(t.accessories=s.map(o=>this.convert(o))),n&&(t.detachedPieces=n.map(o=>this.convert(o))),t}static{this.\u0275fac=function(t){return new(t||i)(p(g),p($))}}static{this.\u0275prov=m({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();function F(){return R({facade:z,feature:D,methods:["getOrderHistoryList","updateOrderSaveOrderProducts","getOrderDetails","getOrderReturnConsignment","getOrderReturnReasons","submitOrderReturn"],async:!0})}var z=(()=>{class i{static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=m({token:i,factory:()=>F(),providedIn:"root"})}}return i})();export{O as a,Q as b,L as c,v as d,V as e,B as f,_ as g,H as h,k as i,$ as j,ie as k,z as l};
