{"version":3,"sources":["node_modules/@discover-swiss/shared/fesm2022/discover-swiss-shared.mjs"],"sourcesContent":["import * as i0 from '@angular/core';\nimport { Pipe, InjectionToken, Inject, Component, Input } from '@angular/core';\nimport { startWith, map } from 'rxjs/operators';\nimport { NgIf } from '@angular/common';\nimport * as i1 from '@angular/material/progress-spinner';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\nfunction LoaderComponent_mat_spinner_1_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"mat-spinner\");\n }\n}\nfunction LoaderComponent_div_2_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"div\", 3);\n }\n}\nlet DsDisplayFnPipe = /*#__PURE__*/(() => {\n class DsDisplayFnPipe {\n transform(value, displayFn) {\n return displayFn(value);\n }\n static {\n this.ɵfac = function DsDisplayFnPipe_Factory(t) {\n return new (t || DsDisplayFnPipe)();\n };\n }\n static {\n this.ɵpipe = /* @__PURE__ */i0.ɵɵdefinePipe({\n name: \"dsDisplayFn\",\n type: DsDisplayFnPipe,\n pure: true,\n standalone: true\n });\n }\n }\n return DsDisplayFnPipe;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst findAvailableLang = (value, lang, defaultLang) => {\n if (!value) {\n return null;\n }\n // fallback for stringified data\n if (typeof value === 'string') {\n return value;\n }\n const currentLangProp = value[lang];\n if (currentLangProp) {\n return currentLangProp;\n }\n const defaultLangProp = value[defaultLang];\n if (defaultLangProp) {\n return defaultLangProp;\n }\n // return first non empty value (translation)\n for (const [, v] of Object.entries(value)) {\n if (v) {\n return v;\n }\n }\n return null;\n};\nconst LANGUAGE_SERVICE_TOKEN = new InjectionToken('languageServiceToken');\nconst TRANSLATE_SERVICE_TOKEN = new InjectionToken('translateServiceToken');\nconst CONFIG_SERVICE_TOKEN = new InjectionToken('configServiceToken');\nlet DsImageUrlPipe = /*#__PURE__*/(() => {\n class DsImageUrlPipe {\n constructor(config) {\n this.config = config;\n this.mediaServiceUrl = config.get('mediaServiceUrl');\n }\n transform(imageObj, params) {\n if (!imageObj) {\n return null;\n }\n if (!imageObj?.id && !imageObj?.identifier) {\n return imageObj?.contentUrl;\n }\n if (!this.mediaServiceUrl) {\n throw new Error('MediaService URL is absent in config.json');\n }\n const width = params?.width ? 'width=' + params.width : '';\n const height = params?.height ? 'height=' + params.height : '';\n const id = imageObj?.id || imageObj?.identifier;\n return `${this.mediaServiceUrl}/image/${id}${width || height ? '?' : ''}${width}${width && height ? '&' : ''}${height}`;\n }\n static {\n this.ɵfac = function DsImageUrlPipe_Factory(t) {\n return new (t || DsImageUrlPipe)(i0.ɵɵdirectiveInject(CONFIG_SERVICE_TOKEN, 16));\n };\n }\n static {\n this.ɵpipe = /* @__PURE__ */i0.ɵɵdefinePipe({\n name: \"dsImageUrl\",\n type: DsImageUrlPipe,\n pure: true,\n standalone: true\n });\n }\n }\n return DsImageUrlPipe;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet DsIsTranslatablePipe = /*#__PURE__*/(() => {\n class DsIsTranslatablePipe {\n constructor(languageService) {\n this.languageService = languageService;\n }\n transform(value) {\n if (typeof value !== 'object') return false;\n if (Object.keys(value).some(key => this.languageService.availableLang.includes(key))) return true;\n return false;\n }\n static {\n this.ɵfac = function DsIsTranslatablePipe_Factory(t) {\n return new (t || DsIsTranslatablePipe)(i0.ɵɵdirectiveInject(LANGUAGE_SERVICE_TOKEN, 16));\n };\n }\n static {\n this.ɵpipe = /* @__PURE__ */i0.ɵɵdefinePipe({\n name: \"dsIsTranslatable\",\n type: DsIsTranslatablePipe,\n pure: true,\n standalone: true\n });\n }\n }\n return DsIsTranslatablePipe;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet DsTranslatePipe = /*#__PURE__*/(() => {\n class DsTranslatePipe {\n constructor(translateService, configurationService) {\n this.translateService = translateService;\n this.configurationService = configurationService;\n this._defaultLang = configurationService.get('defaultLang');\n }\n transform(value) {\n return this.translateService.onLangChange.pipe(startWith({\n lang: this.translateService.currentLang\n }), map(({\n lang\n }) => findAvailableLang(value, lang, this._defaultLang)));\n }\n static {\n this.ɵfac = function DsTranslatePipe_Factory(t) {\n return new (t || DsTranslatePipe)(i0.ɵɵdirectiveInject(TRANSLATE_SERVICE_TOKEN, 16), i0.ɵɵdirectiveInject(CONFIG_SERVICE_TOKEN, 16));\n };\n }\n static {\n this.ɵpipe = /* @__PURE__ */i0.ɵɵdefinePipe({\n name: \"dsTranslate\",\n type: DsTranslatePipe,\n pure: true,\n standalone: true\n });\n }\n }\n return DsTranslatePipe;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet DsTypeofPipe = /*#__PURE__*/(() => {\n class DsTypeofPipe {\n transform(value) {\n if (Array.isArray(value)) {\n return 'array';\n }\n return typeof value;\n }\n static {\n this.ɵfac = function DsTypeofPipe_Factory(t) {\n return new (t || DsTypeofPipe)();\n };\n }\n static {\n this.ɵpipe = /* @__PURE__ */i0.ɵɵdefinePipe({\n name: \"dsTypeof\",\n type: DsTypeofPipe,\n pure: true,\n standalone: true\n });\n }\n }\n return DsTypeofPipe;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet DsGroupByDeliveryPipe = /*#__PURE__*/(() => {\n class DsGroupByDeliveryPipe {\n transform(order) {\n if (order.orderDelivery) {\n const orderItemLookup = new Map();\n order.orderedItem.forEach(orderItem => orderItemLookup.set(orderItem.orderItemNumber, orderItem));\n const response = order.orderDelivery.map(od => {\n return {\n ...od,\n orderItems: od.itemShipped.map(itemNumber => orderItemLookup.get(itemNumber))\n };\n });\n const allOrderNumbers = [...orderItemLookup.keys()];\n const usableOrderNumbers = order.orderDelivery.map(od => od.itemShipped).flat();\n const unusableOrderNumbers = allOrderNumbers.filter(i => !usableOrderNumbers.includes(i));\n if (unusableOrderNumbers.length) {\n response.push({\n name: '',\n orderItems: unusableOrderNumbers.map(orderItemNumber => orderItemLookup.get(orderItemNumber))\n });\n }\n return response;\n } else {\n const res = [{\n name: '',\n orderItems: order.orderedItem\n }];\n return res;\n }\n }\n static {\n this.ɵfac = function DsGroupByDeliveryPipe_Factory(t) {\n return new (t || DsGroupByDeliveryPipe)();\n };\n }\n static {\n this.ɵpipe = /* @__PURE__ */i0.ɵɵdefinePipe({\n name: \"dsGroupByDelivery\",\n type: DsGroupByDeliveryPipe,\n pure: true,\n standalone: true\n });\n }\n }\n return DsGroupByDeliveryPipe;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet LoaderComponent = /*#__PURE__*/(() => {\n class LoaderComponent {\n constructor() {\n this.mode = 'spinner';\n }\n static {\n this.ɵfac = function LoaderComponent_Factory(t) {\n return new (t || LoaderComponent)();\n };\n }\n static {\n this.ɵcmp = /* @__PURE__ */i0.ɵɵdefineComponent({\n type: LoaderComponent,\n selectors: [[\"ds-loader\"]],\n inputs: {\n mode: \"mode\"\n },\n standalone: true,\n features: [i0.ɵɵStandaloneFeature],\n decls: 3,\n vars: 2,\n consts: [[1, \"loader-wrapper\"], [4, \"ngIf\"], [\"class\", \"dot-pulse\", 4, \"ngIf\"], [1, \"dot-pulse\"]],\n template: function LoaderComponent_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\", 0);\n i0.ɵɵtemplate(1, LoaderComponent_mat_spinner_1_Template, 1, 0, \"mat-spinner\", 1)(2, LoaderComponent_div_2_Template, 1, 0, \"div\", 2);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", ctx.mode === \"spinner\");\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", ctx.mode !== \"spinner\");\n }\n },\n dependencies: [NgIf, MatProgressSpinnerModule, i1.MatProgressSpinner],\n styles: [\"[_ngcontent-%COMP%]:root{--unnamed-color-ffffff: #ffffff;--unnamed-color-cbcbcb: #cbcbcb;--unnamed-color-212121: #212121;--unnamed-color-d02c2e: #d02c2e;--unnamed-color-efefef: #efefef;--unnamed-color-4f4f4f: #4f4f4f;--unnamed-color-ed696a: #ed696a;--mainred: #d02c2e}[_nghost-%COMP%]{display:flex;flex-direction:column;height:100%;width:100%}.loader-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;justify-content:center;align-items:center}.loader-wrapper[_ngcontent-%COMP%] .mat-progress-spinner{width:50px!important;height:50px!important}.loader-wrapper[_ngcontent-%COMP%] .mat-progress-spinner svg{width:100%!important;height:100%!important}.loader-wrapper[_ngcontent-%COMP%] .mat-progress-spinner circle, .mat-spinner[_ngcontent-%COMP%] circle[_ngcontent-%COMP%]{stroke:var(--unnamed-color-d02c2e)}.dot-pulse[_ngcontent-%COMP%]{position:relative;left:-9999px;width:10px;height:10px;border-radius:5px;background-color:var(--unnamed-color-ed696a);color:var(--unnamed-color-ed696a);box-shadow:9999px 0 0 -5px var(--unnamed-color-ed696a);animation:_ngcontent-%COMP%_dotPulse 1.5s infinite linear;animation-delay:.25s}.dot-pulse[_ngcontent-%COMP%]:before, .dot-pulse[_ngcontent-%COMP%]:after{content:\\\"\\\";display:inline-block;position:absolute;top:0;width:10px;height:10px;border-radius:5px;background-color:var(--unnamed-color-ed696a);color:var(--unnamed-color-ed696a)}.dot-pulse[_ngcontent-%COMP%]:before{box-shadow:9984px 0 0 -5px var(--unnamed-color-ed696a);animation:_ngcontent-%COMP%_dotPulseBefore 1.5s infinite linear;animation-delay:0s}.dot-pulse[_ngcontent-%COMP%]:after{box-shadow:10014px 0 0 -5px var(--unnamed-color-ed696a);animation:_ngcontent-%COMP%_dotPulseAfter 1.5s infinite linear;animation-delay:.5s}@keyframes _ngcontent-%COMP%_dotPulseBefore{0%{box-shadow:9984px 0 0 -5px var(--unnamed-color-ed696a)}30%{box-shadow:9984px 0 0 2px var(--unnamed-color-ed696a)}60%,to{box-shadow:9984px 0 0 -5px var(--unnamed-color-ed696a)}}@keyframes _ngcontent-%COMP%_dotPulse{0%{box-shadow:9999px 0 0 -5px var(--unnamed-color-ed696a)}30%{box-shadow:9999px 0 0 2px var(--unnamed-color-ed696a)}60%,to{box-shadow:9999px 0 0 -5px var(--unnamed-color-ed696a)}}@keyframes _ngcontent-%COMP%_dotPulseAfter{0%{box-shadow:10014px 0 0 -5px var(--unnamed-color-ed696a)}30%{box-shadow:10014px 0 0 2px var(--unnamed-color-ed696a)}60%,to{box-shadow:10014px 0 0 -5px var(--unnamed-color-ed696a)}}\"]\n });\n }\n }\n return LoaderComponent;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/*\n * Public API Surface of shared\n */\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { CONFIG_SERVICE_TOKEN, DsDisplayFnPipe, DsGroupByDeliveryPipe, DsImageUrlPipe, DsIsTranslatablePipe, DsTranslatePipe, DsTypeofPipe, LANGUAGE_SERVICE_TOKEN, LoaderComponent, TRANSLATE_SERVICE_TOKEN, findAvailableLang };\n"],"mappings":"sEAgBA,IAAIA,GAAgC,IAAM,CACxC,MAAMA,CAAgB,CACpB,UAAUC,EAAOC,EAAW,CAC1B,OAAOA,EAAUD,CAAK,CACxB,CACA,MAAO,CACL,KAAK,UAAO,SAAiCE,EAAG,CAC9C,OAAO,IAAKA,GAAKH,EACnB,CACF,CACA,MAAO,CACL,KAAK,WAA0BI,EAAa,CAC1C,KAAM,cACN,KAAMJ,EACN,KAAM,GACN,WAAY,EACd,CAAC,CACH,CACF,CACA,OAAOA,CACT,GAAG,EAIGK,EAAoB,CAACJ,EAAOK,EAAMC,IAAgB,CACtD,GAAI,CAACN,EACH,OAAO,KAGT,GAAI,OAAOA,GAAU,SACnB,OAAOA,EAET,IAAMO,EAAkBP,EAAMK,CAAI,EAClC,GAAIE,EACF,OAAOA,EAET,IAAMC,EAAkBR,EAAMM,CAAW,EACzC,GAAIE,EACF,OAAOA,EAGT,OAAW,CAAC,CAAEC,CAAC,IAAK,OAAO,QAAQT,CAAK,EACtC,GAAIS,EACF,OAAOA,EAGX,OAAO,IACT,EACMC,EAAyB,IAAIC,EAAe,sBAAsB,EAClEC,EAA0B,IAAID,EAAe,uBAAuB,EACpEE,EAAuB,IAAIF,EAAe,oBAAoB,EAsEpE,IAAIG,GAAgC,IAAM,CACxC,MAAMA,CAAgB,CACpB,YAAYC,EAAkBC,EAAsB,CAClD,KAAK,iBAAmBD,EACxB,KAAK,qBAAuBC,EAC5B,KAAK,aAAeA,EAAqB,IAAI,aAAa,CAC5D,CACA,UAAUC,EAAO,CACf,OAAO,KAAK,iBAAiB,aAAa,KAAKC,EAAU,CACvD,KAAM,KAAK,iBAAiB,WAC9B,CAAC,EAAGC,EAAI,CAAC,CACP,KAAAC,CACF,IAAMC,EAAkBJ,EAAOG,EAAM,KAAK,YAAY,CAAC,CAAC,CAC1D,CACA,MAAO,CACL,KAAK,UAAO,SAAiCE,EAAG,CAC9C,OAAO,IAAKA,GAAKR,GAAoBS,EAAkBC,EAAyB,EAAE,EAAMD,EAAkBE,EAAsB,EAAE,CAAC,CACrI,CACF,CACA,MAAO,CACL,KAAK,WAA0BC,EAAa,CAC1C,KAAM,cACN,KAAMZ,EACN,KAAM,GACN,WAAY,EACd,CAAC,CACH,CACF,CACA,OAAOA,CACT,GAAG","names":["DsDisplayFnPipe","value","displayFn","t","ɵɵdefinePipe","findAvailableLang","lang","defaultLang","currentLangProp","defaultLangProp","v","LANGUAGE_SERVICE_TOKEN","InjectionToken","TRANSLATE_SERVICE_TOKEN","CONFIG_SERVICE_TOKEN","DsTranslatePipe","translateService","configurationService","value","startWith","map","lang","findAvailableLang","t","ɵɵdirectiveInject","TRANSLATE_SERVICE_TOKEN","CONFIG_SERVICE_TOKEN","ɵɵdefinePipe"],"x_google_ignoreList":[0]}