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G,GAAG,SAAS,GAAG,UAAU,CAAC,CAAC;aAAA;QAC3E,CAAC;QAEa,yBAAW,GAAzB,UAA0B,OAAiB;YACvC,KAAkB,UAAO,EAAP,mBAAO,EAAP,qBAAO,EAAP,IAAO;gBAApB,IAAM,GAAG,gBAAA;gBACV,+HAA+H;gBAC/H,QAAQ,CAAC,KAAK,CAAC,2CAA2C,GAAG,GAAG,GAAG,SAAS,GAAG,UAAU,CAAC,CAAC;aAAA;QACnG,CAAC;QACL,oBAAC;IAAD,CAAC,AA9HD,IA8HC;IA9HY,qBAAa,gBA8HzB,CAAA;AACL,CAAC,EAhIS,OAAO,KAAP,OAAO,QAgIhB","sourcesContent":["\"use strict\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-namespace,unused-imports/no-unused-vars\r\nnamespace TescoSW {\r\n export class Compatibility {\r\n private static __isEdgeHtml: boolean | undefined;\r\n private static __isBlink: boolean | undefined;\r\n private static __isGecko: boolean | undefined;\r\n private static __isWebKit: boolean | undefined;\r\n\r\n public static isEdgeHtml(): boolean {\r\n if (Compatibility.__isEdgeHtml === undefined)\r\n Compatibility.__isEdgeHtml = (self as any).Reflect.ownKeys(self).filter((v: any) => typeof v === \"string\" && ((v as any).startsWith(\"ms\") || (v as any).startsWith(\"MS\"))).length > 0;\r\n return Compatibility.__isEdgeHtml;\r\n }\r\n\r\n public static isBlink(): boolean {\r\n if (Compatibility.__isBlink === undefined)\r\n Compatibility.__isBlink = !!(self as any).chrome && !Compatibility.isEdgeHtml();\r\n return Compatibility.__isBlink;\r\n }\r\n\r\n public static isGecko(): boolean {\r\n if (Compatibility.__isGecko === undefined)\r\n Compatibility.__isGecko = (self as any).Reflect.ownKeys(self).filter((v: any) => typeof v === \"string\" && (v as any).startsWith(\"moz\")).length > 0;\r\n return Compatibility.__isGecko;\r\n }\r\n\r\n public static isWebKit(): boolean {\r\n if (Compatibility.__isWebKit === undefined)\r\n Compatibility.__isWebKit = !Compatibility.isBlink() && !Compatibility.isEdgeHtml() && (self as any).Reflect.ownKeys(self).filter((v: any) => typeof v === \"string\" && (v as any).startsWith(\"webkit\") && v !== \"webkitURL\" /* už i ve FF */).length > 0;\r\n return Compatibility.__isWebKit;\r\n }\r\n\r\n public static checkCalcSupport(): boolean {\r\n const dummy = document.createElement(\"_\");\r\n const inline = dummy.style;\r\n inline[\"width\"] = \"calc(100% - 1px)\";\r\n return inline.length > 0;\r\n }\r\n\r\n public static checkStyleSupport(styleName: string): boolean {\r\n // return document.createElement(\"detect\").style[styleName] === \"\";\r\n\r\n const d = document.createElement(\"detect\");\r\n const csSprefix = \"Webkit,Moz,O,ms,Khtml\".split(\",\");\r\n const style = styleName[0].toUpperCase() + styleName.substr(1);\r\n const all = (styleName + \",\" + csSprefix.join(style + \",\") + style).split(\",\");\r\n\r\n for (let n = 0, np = all.length; n < np; n++)\r\n if ((d.style as any)[all[n]] === \"\")\r\n return true;\r\n\r\n return false;\r\n }\r\n\r\n // @ts-ignore // nevyužito, ale ponecháno\r\n private static _getParameterByName(name: string, url?: string): string | null {\r\n if (!window || !window.location || !window.location.href)\r\n return null;\r\n if (!url)\r\n url = window.location.href;\r\n name = name.replace(/[[\\]]/g, \"\\\\$&\");\r\n const regex = new RegExp(\"[?&]\" + name + \"(=([^&#]*)|&|#|$)\");\r\n const results = regex.exec(url);\r\n if (!results)\r\n return null;\r\n if (!results[2])\r\n return \"\";\r\n return decodeURIComponent(results[2].replace(/\\+/g, \" \"));\r\n }\r\n\r\n // @ts-ignore // nevyužito, ale ponecháno\r\n private static _getEngineVersion(engine: string): number {\r\n if (!navigator || !navigator.userAgent)\r\n return 0;\r\n const eGroups = new RegExp(engine + \"\\\\/(\\\\d+\\\\.\\\\d+)\").exec(navigator.userAgent);\r\n return eGroups && eGroups.length === 2 ? +eGroups[1] : 0;\r\n }\r\n\r\n public static checkRemotingCompatibility(): boolean {\r\n //https://docs.microsoft.com/en-us/microsoft-edge/dev-guide\r\n\r\n if (self) {\r\n if (typeof (self as any).WebAssembly !== \"object\") return false; // Chrome 57, Edge 16, Safari 11, FF 52, Opera 44\r\n //if (Intl.Collator('en').resolvedOptions().caseFirst === void 0) return false; // FF 55 - Vlastnost nize neni potreba, jen potrebujeme vyspecifikovat verzi FF55, ktera ma chybu v indexedDB volane pres webWorker\r\n if (typeof (self as any).AbortController !== \"function\" && !Compatibility.isBlink()) return false; // Edge 16, Safari 11.1, FF 57\r\n\r\n if (navigator && !(\"serviceWorker\" in navigator)) {\r\n return false;\r\n }\r\n\r\n if (Compatibility.isEdgeHtml()) return false;\r\n\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public static checkUICompatibility(): boolean {\r\n if (!Compatibility.checkCalcSupport())\r\n return false;\r\n\r\n // detekce jsetli podporuje styl flexWrap pouzivany pro wrappanel\r\n if (!Compatibility.checkStyleSupport(\"flexWrap\"))\r\n return false;\r\n\r\n // detekce FF 53 - detekce verze, která správně podporuje flex\r\n if (Compatibility.isGecko() && Object.prototype.toString.call(Error.prototype) !== \"[object Object]\")\r\n return false;\r\n\r\n return true;\r\n }\r\n\r\n public static checkCompatibility(): boolean {\r\n return Compatibility.checkRemotingCompatibility() && Compatibility.checkUICompatibility();\r\n }\r\n\r\n public static loadScripts(scripts: string[]): void {\r\n for (const scr of scripts)\r\n //document.write('<script src=\"JS/' + scr + '.js\"><' + '/script>');\r\n document.write(\"<script src=\\\"js/\" + scr + \".js\\\"><\" + \"/script>\");\r\n }\r\n\r\n public static loadModules(modules: string[]): void {\r\n for (const scr of modules)\r\n //document.write('<script src=\"JS/' + scr + '.js?version=' + (TescoSW as any).versionInfo.client.version + '\"><' + '/script>');\r\n document.write(\"<script type=\\\"module\\\" src=\\\"../scripts/\" + scr + \".js\\\"><\" + \"/script>\");\r\n }\r\n }\r\n}\r\n"]}