@swisspost/internet-header 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index-3216e4c8.js +176 -0
- package/dist/cjs/index-3216e4c8.js.map +1 -0
- package/dist/cjs/{language.service-7dbf739d.js → language.service-41b458b1.js} +6 -1
- package/dist/cjs/language.service-41b458b1.js.map +1 -0
- package/dist/cjs/post-language-switch.cjs.entry.js +1 -1
- package/dist/cjs/post-logo.cjs.entry.js +1 -1
- package/dist/cjs/post-main-navigation.cjs.entry.js +1 -1
- package/dist/cjs/post-search.cjs.entry.js +1 -1
- package/dist/cjs/post-skiplinks.cjs.entry.js +2 -2
- package/dist/cjs/post-skiplinks.cjs.entry.js.map +1 -1
- package/dist/cjs/swisspost-internet-breadcrumbs.cjs.entry.js +112 -92
- package/dist/cjs/swisspost-internet-breadcrumbs.cjs.entry.js.map +1 -1
- package/dist/cjs/swisspost-internet-header.cjs.entry.js +15 -13
- package/dist/cjs/swisspost-internet-header.cjs.entry.js.map +1 -1
- package/dist/collection/assets/i18n/translations.js +5 -0
- package/dist/collection/assets/i18n/translations.js.map +1 -1
- package/dist/collection/components/post-internet-breadcrumbs/post-internet-breadcrumbs.css +0 -4
- package/dist/collection/components/post-skiplinks/post-skiplinks.js +1 -1
- package/dist/collection/components/post-skiplinks/post-skiplinks.js.map +1 -1
- package/dist/collection/models/general.model.js.map +1 -1
- package/dist/collection/services/config.service.js +5 -3
- package/dist/collection/services/config.service.js.map +1 -1
- package/dist/components/index2.js +67 -35
- package/dist/components/index2.js.map +1 -1
- package/dist/components/language.service.js +5 -0
- package/dist/components/language.service.js.map +1 -1
- package/dist/components/post-skiplinks2.js +1 -1
- package/dist/components/post-skiplinks2.js.map +1 -1
- package/dist/components/swisspost-internet-breadcrumbs.js +110 -90
- package/dist/components/swisspost-internet-breadcrumbs.js.map +1 -1
- package/dist/components/swisspost-internet-header.js +13 -11
- package/dist/components/swisspost-internet-header.js.map +1 -1
- package/dist/esm/index-d2256e06.js +173 -0
- package/dist/esm/index-d2256e06.js.map +1 -0
- package/dist/esm/{language.service-023d2711.js → language.service-85d8689e.js} +6 -1
- package/dist/esm/language.service-85d8689e.js.map +1 -0
- package/dist/esm/post-language-switch.entry.js +1 -1
- package/dist/esm/post-logo.entry.js +1 -1
- package/dist/esm/post-main-navigation.entry.js +1 -1
- package/dist/esm/post-search.entry.js +1 -1
- package/dist/esm/post-skiplinks.entry.js +2 -2
- package/dist/esm/post-skiplinks.entry.js.map +1 -1
- package/dist/esm/swisspost-internet-breadcrumbs.entry.js +112 -92
- package/dist/esm/swisspost-internet-breadcrumbs.entry.js.map +1 -1
- package/dist/esm/swisspost-internet-header.entry.js +15 -13
- package/dist/esm/swisspost-internet-header.entry.js.map +1 -1
- package/dist/esm-es5/index-d2256e06.js +2 -0
- package/dist/esm-es5/index-d2256e06.js.map +1 -0
- package/dist/esm-es5/language.service-85d8689e.js +2 -0
- package/dist/esm-es5/language.service-85d8689e.js.map +1 -0
- package/dist/esm-es5/post-language-switch.entry.js +1 -1
- package/dist/esm-es5/post-logo.entry.js +1 -1
- package/dist/esm-es5/post-main-navigation.entry.js +1 -1
- package/dist/esm-es5/post-search.entry.js +1 -1
- package/dist/esm-es5/post-skiplinks.entry.js +1 -1
- package/dist/esm-es5/post-skiplinks.entry.js.map +1 -1
- package/dist/esm-es5/swisspost-internet-breadcrumbs.entry.js +2 -2
- package/dist/esm-es5/swisspost-internet-breadcrumbs.entry.js.map +1 -1
- package/dist/esm-es5/swisspost-internet-header.entry.js +1 -1
- package/dist/esm-es5/swisspost-internet-header.entry.js.map +1 -1
- package/dist/swisspost-internet-header/p-17a47667.system.js +1 -1
- package/dist/swisspost-internet-header/{p-38d645ba.system.entry.js → p-1f13dad6.system.entry.js} +2 -2
- package/dist/swisspost-internet-header/{p-38d645ba.system.entry.js.map → p-1f13dad6.system.entry.js.map} +0 -0
- package/dist/swisspost-internet-header/{p-5d2fac3b.system.entry.js → p-2df9df9c.system.entry.js} +2 -2
- package/dist/swisspost-internet-header/{p-5d2fac3b.system.entry.js.map → p-2df9df9c.system.entry.js.map} +0 -0
- package/dist/swisspost-internet-header/{p-d33734b5.entry.js → p-2fd9a085.entry.js} +2 -2
- package/dist/swisspost-internet-header/{p-d33734b5.entry.js.map → p-2fd9a085.entry.js.map} +0 -0
- package/dist/swisspost-internet-header/p-324563ab.system.js +2 -0
- package/dist/swisspost-internet-header/p-324563ab.system.js.map +1 -0
- package/dist/swisspost-internet-header/p-33ff32c6.entry.js +2 -0
- package/dist/swisspost-internet-header/p-33ff32c6.entry.js.map +1 -0
- package/dist/swisspost-internet-header/{p-493337e1.system.entry.js → p-38f55161.system.entry.js} +2 -2
- package/dist/swisspost-internet-header/{p-493337e1.system.entry.js.map → p-38f55161.system.entry.js.map} +0 -0
- package/dist/swisspost-internet-header/p-4f39b3a4.system.entry.js +2 -0
- package/dist/swisspost-internet-header/p-4f39b3a4.system.entry.js.map +1 -0
- package/dist/swisspost-internet-header/p-5adcac2a.entry.js +6 -0
- package/dist/swisspost-internet-header/p-5adcac2a.entry.js.map +1 -0
- package/dist/swisspost-internet-header/{p-0cba8ab4.entry.js → p-5b22e42c.entry.js} +2 -2
- package/dist/swisspost-internet-header/{p-0cba8ab4.entry.js.map → p-5b22e42c.entry.js.map} +0 -0
- package/dist/swisspost-internet-header/p-733756a9.system.entry.js +7 -0
- package/dist/swisspost-internet-header/p-733756a9.system.entry.js.map +1 -0
- package/dist/swisspost-internet-header/{p-322526ef.entry.js → p-812b69b4.entry.js} +2 -2
- package/dist/swisspost-internet-header/{p-322526ef.entry.js.map → p-812b69b4.entry.js.map} +0 -0
- package/dist/swisspost-internet-header/p-84d73529.system.entry.js +2 -0
- package/dist/swisspost-internet-header/p-84d73529.system.entry.js.map +1 -0
- package/dist/swisspost-internet-header/{p-62c5cf26.entry.js → p-908c0350.entry.js} +2 -2
- package/dist/swisspost-internet-header/{p-62c5cf26.entry.js.map → p-908c0350.entry.js.map} +0 -0
- package/dist/swisspost-internet-header/p-9b4d5e90.system.js +2 -0
- package/dist/swisspost-internet-header/p-9b4d5e90.system.js.map +1 -0
- package/dist/swisspost-internet-header/p-a6001d1e.js +2 -0
- package/dist/swisspost-internet-header/p-a6001d1e.js.map +1 -0
- package/dist/swisspost-internet-header/p-a74b380d.js +2 -0
- package/dist/swisspost-internet-header/p-a74b380d.js.map +1 -0
- package/dist/swisspost-internet-header/p-c565414e.entry.js +2 -0
- package/dist/swisspost-internet-header/p-c565414e.entry.js.map +1 -0
- package/dist/swisspost-internet-header/{p-db87f3e3.system.entry.js → p-c5f85f6e.system.entry.js} +2 -2
- package/dist/swisspost-internet-header/{p-db87f3e3.system.entry.js.map → p-c5f85f6e.system.entry.js.map} +0 -0
- package/dist/swisspost-internet-header/swisspost-internet-header.esm.js +1 -1
- package/dist/types/assets/i18n/translations.d.ts +5 -0
- package/dist/types/models/general.model.d.ts +1 -1
- package/dist/types/services/language.service.d.ts +5 -0
- package/package.json +8 -8
- package/dist/cjs/index-e7245d60.js +0 -144
- package/dist/cjs/index-e7245d60.js.map +0 -1
- package/dist/cjs/language.service-7dbf739d.js.map +0 -1
- package/dist/esm/index-a75df186.js +0 -141
- package/dist/esm/index-a75df186.js.map +0 -1
- package/dist/esm/language.service-023d2711.js.map +0 -1
- package/dist/esm-es5/index-a75df186.js +0 -2
- package/dist/esm-es5/index-a75df186.js.map +0 -1
- package/dist/esm-es5/language.service-023d2711.js +0 -2
- package/dist/esm-es5/language.service-023d2711.js.map +0 -1
- package/dist/swisspost-internet-header/p-0942595f.js +0 -2
- package/dist/swisspost-internet-header/p-0942595f.js.map +0 -1
- package/dist/swisspost-internet-header/p-3753a678.system.js +0 -2
- package/dist/swisspost-internet-header/p-3753a678.system.js.map +0 -1
- package/dist/swisspost-internet-header/p-3df823de.system.entry.js +0 -2
- package/dist/swisspost-internet-header/p-3df823de.system.entry.js.map +0 -1
- package/dist/swisspost-internet-header/p-69c64c29.js +0 -2
- package/dist/swisspost-internet-header/p-69c64c29.js.map +0 -1
- package/dist/swisspost-internet-header/p-715ebef7.system.entry.js +0 -7
- package/dist/swisspost-internet-header/p-715ebef7.system.entry.js.map +0 -1
- package/dist/swisspost-internet-header/p-7709ed5c.entry.js +0 -2
- package/dist/swisspost-internet-header/p-7709ed5c.entry.js.map +0 -1
- package/dist/swisspost-internet-header/p-c8296f63.system.js +0 -2
- package/dist/swisspost-internet-header/p-c8296f63.system.js.map +0 -1
- package/dist/swisspost-internet-header/p-ccb522ba.entry.js +0 -2
- package/dist/swisspost-internet-header/p-ccb522ba.entry.js.map +0 -1
- package/dist/swisspost-internet-header/p-cfa787d7.entry.js +0 -6
- package/dist/swisspost-internet-header/p-cfa787d7.entry.js.map +0 -1
- package/dist/swisspost-internet-header/p-f38f38f4.system.entry.js +0 -2
- package/dist/swisspost-internet-header/p-f38f38f4.system.entry.js.map +0 -1
|
File without changes
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
System.register([],(function(e){"use strict";return{execute:function(){e({d:i,t:n});function n(e,n,i){var t=i||{},o=t.noTrailing,f=o===void 0?false:o,r=t.noLeading,u=r===void 0?false:r,a=t.debounceMode,d=a===void 0?undefined:a;var c;var s=false;var l=0;function v(){if(c){clearTimeout(c)}}function g(e){var n=e||{},i=n.upcomingOnly,t=i===void 0?false:i;v();s=!t}function m(){for(var i=arguments.length,t=new Array(i),o=0;o<i;o++){t[o]=arguments[o]}var r=this;var a=Date.now()-l;if(s){return}function g(){l=Date.now();n.apply(r,t)}function m(){c=undefined}if(!u&&d&&!c){g()}v();if(d===undefined&&a>e){if(u){l=Date.now();if(!f){c=setTimeout(d?m:g,e)}}else{g()}}else if(f!==true){c=setTimeout(d?m:g,d===undefined?e-a:e)}}m.cancel=g;return m}function i(e,i,t){var o=t||{},f=o.atBegin,r=f===void 0?false:f;return n(e,i,{debounceMode:r!==false})}}}}));
|
|
2
|
+
//# sourceMappingURL=p-9b4d5e90.system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["throttle","delay","callback","options","_ref","_ref$noTrailing","noTrailing","_ref$noLeading","noLeading","_ref$debounceMode","debounceMode","undefined","timeoutID","cancelled","lastExec","clearExistingTimeout","clearTimeout","cancel","_ref2","_ref2$upcomingOnly","upcomingOnly","wrapper","_len","arguments","length","arguments_","Array","_key","self","this","elapsed","Date","now","exec","apply","clear","setTimeout","debounce","_ref$atBegin","atBegin"],"sources":["../../node_modules/.pnpm/throttle-debounce@5.0.0/node_modules/throttle-debounce/esm/index.js"],"sourcesContent":["/* eslint-disable no-undefined,no-param-reassign,no-shadow */\n\n/**\n * Throttle execution of a function. Especially useful for rate limiting\n * execution of handlers on events like resize and scroll.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)\n * are most useful.\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,\n * as-is, to `callback` when the throttled-function is executed.\n * @param {object} [options] - An object to configure options.\n * @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds\n * while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed\n * one final time after the last throttled-function call. (After the throttled-function has not been called for\n * `delay` milliseconds, the internal counter is reset).\n * @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback\n * immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that\n * callback will never executed if both noLeading = true and noTrailing = true.\n * @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is\n * false (at end), schedule `callback` to execute after `delay` ms.\n *\n * @returns {Function} A new, throttled, function.\n */\nfunction throttle (delay, callback, options) {\n var _ref = options || {},\n _ref$noTrailing = _ref.noTrailing,\n noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,\n _ref$noLeading = _ref.noLeading,\n noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,\n _ref$debounceMode = _ref.debounceMode,\n debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;\n /*\n * After wrapper has stopped being called, this timeout ensures that\n * `callback` is executed at the proper times in `throttle` and `end`\n * debounce modes.\n */\n\n\n var timeoutID;\n var cancelled = false; // Keep track of the last time `callback` was executed.\n\n var lastExec = 0; // Function to clear existing timeout\n\n function clearExistingTimeout() {\n if (timeoutID) {\n clearTimeout(timeoutID);\n }\n } // Function to cancel next exec\n\n\n function cancel(options) {\n var _ref2 = options || {},\n _ref2$upcomingOnly = _ref2.upcomingOnly,\n upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;\n\n clearExistingTimeout();\n cancelled = !upcomingOnly;\n }\n /*\n * The `wrapper` function encapsulates all of the throttling / debouncing\n * functionality and when executed will limit the rate at which `callback`\n * is executed.\n */\n\n\n function wrapper() {\n for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {\n arguments_[_key] = arguments[_key];\n }\n\n var self = this;\n var elapsed = Date.now() - lastExec;\n\n if (cancelled) {\n return;\n } // Execute `callback` and update the `lastExec` timestamp.\n\n\n function exec() {\n lastExec = Date.now();\n callback.apply(self, arguments_);\n }\n /*\n * If `debounceMode` is true (at begin) this is used to clear the flag\n * to allow future `callback` executions.\n */\n\n\n function clear() {\n timeoutID = undefined;\n }\n\n if (!noLeading && debounceMode && !timeoutID) {\n /*\n * Since `wrapper` is being called for the first time and\n * `debounceMode` is true (at begin), execute `callback`\n * and noLeading != true.\n */\n exec();\n }\n\n clearExistingTimeout();\n\n if (debounceMode === undefined && elapsed > delay) {\n if (noLeading) {\n /*\n * In throttle mode with noLeading, if `delay` time has\n * been exceeded, update `lastExec` and schedule `callback`\n * to execute after `delay` ms.\n */\n lastExec = Date.now();\n\n if (!noTrailing) {\n timeoutID = setTimeout(debounceMode ? clear : exec, delay);\n }\n } else {\n /*\n * In throttle mode without noLeading, if `delay` time has been exceeded, execute\n * `callback`.\n */\n exec();\n }\n } else if (noTrailing !== true) {\n /*\n * In trailing throttle mode, since `delay` time has not been\n * exceeded, schedule `callback` to execute `delay` ms after most\n * recent execution.\n *\n * If `debounceMode` is true (at begin), schedule `clear` to execute\n * after `delay` ms.\n *\n * If `debounceMode` is false (at end), schedule `callback` to\n * execute after `delay` ms.\n */\n timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);\n }\n }\n\n wrapper.cancel = cancel; // Return the wrapper function.\n\n return wrapper;\n}\n\n/* eslint-disable no-undefined */\n/**\n * Debounce execution of a function. Debouncing, unlike throttling,\n * guarantees that a function is only executed a single time, either at the\n * very beginning of a series of calls, or at the very end.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n * to `callback` when the debounced-function is executed.\n * @param {object} [options] - An object to configure options.\n * @param {boolean} [options.atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds\n * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.\n * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).\n *\n * @returns {Function} A new, debounced function.\n */\n\nfunction debounce (delay, callback, options) {\n var _ref = options || {},\n _ref$atBegin = _ref.atBegin,\n atBegin = _ref$atBegin === void 0 ? false : _ref$atBegin;\n\n return throttle(delay, callback, {\n debounceMode: atBegin !== false\n });\n}\n\nexport { debounce, throttle };\n//# sourceMappingURL=index.js.map\n"],"mappings":"oFAuBA,SAASA,EAAUC,EAAOC,EAAUC,GAClC,IAAIC,EAAOD,GAAW,GAClBE,EAAkBD,EAAKE,WACvBA,EAAaD,SAAyB,EAAI,MAAQA,EAClDE,EAAiBH,EAAKI,UACtBA,EAAYD,SAAwB,EAAI,MAAQA,EAChDE,EAAoBL,EAAKM,aACzBA,EAAeD,SAA2B,EAAIE,UAAYF,EAQ9D,IAAIG,EACJ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",fr:"Fermer la superposition",it:"Chiudi sovrapposizione"},"Current language is English":{de:"Die aktuelle Sprache ist Deutsch",fr:"La langue actuelle est le français",it:"La lingua corrente è l'italiano"},"Change language":{de:"Sprache wechseln",fr:"Changer de langue",it:"Cambia lingua"},"Go to main content":{de:"Zum Hauptinhalt springen",fr:"Aller au contenu principal",it:"Vai al contenuto principale"},"Go to search":{de:"Zur Suche springen",fr:"Aller à la recherche",it:"Vai alla ricerca"},"Go to login":{de:"Zum Login springen",fr:"Aller au login",it:"Vai al login"},"Open menu":{de:"Menü öffnen",fr:"Ouvrir le menu",it:"Apri il menu"},"Navigate on post.ch":{de:"Navigieren auf post.ch",fr:"Naviguer sur post.ch",it:"Navigate su post.ch"}};const i=(n,i,r,t)=>{if(n.length===0){return undefined}if(n.length===1){return n[0]}const l=new URL(window.location.href);let u=[i,l.searchParams.get("lang"),l.pathname.split("/").find((e=>n.includes(e))),r!==undefined?window.localStorage.getItem(r):null,o("language"),o("lang"),t!==undefined?o(t):null,document.documentElement.lang,a(n),e.currentLanguage].filter((e=>!!e));const s=u.find((e=>n.includes(e)))||n[0];if(!s||s.length!==2){throw new Error(`Current language could not be determined from settings or the language provided (${s}) is not supported by the Header API.`)}return s};const r=(n,i,r)=>{if(r!==undefined){window.localStorage.setItem(r,n)}if(i!==undefined){t(i,n)}e.currentLanguage=n};const o=e=>{var n;return((n=document.cookie.match("(^|;)\\s*"+e+"\\s*=\\s*([^;]+)"))===null||n===void 0?void 0:n.pop())||""};const t=(e,n)=>{document.cookie=`${encodeURIComponent(e)}=${encodeURIComponent(n)}`};const a=e=>{if(navigator.language){const n=l(navigator.language);if(e.indexOf(n)!==-1){return n}}if(navigator.languages){for(const n of navigator.languages){const i=l(n);if(e.indexOf(i)!==-1){return i}}}return null};const l=e=>e.substring(0,2).toLowerCase();const u=(i,r,o=n)=>{var t,a,l;return(l=(t=o[i])===null||t===void 0?void 0:t[(a=r!==null&&r!==void 0?r:e.currentLanguage)!==null&&a!==void 0?a:""])!==null&&l!==void 0?l:i};export{i as g,r as p,u as t};
|
|
2
|
+
//# sourceMappingURL=p-a6001d1e.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["translations","de","fr","it","getUserLang","supportedLanguages","implementorPreferredLanguage","localStorageKey","cookieKey","length","undefined","url","URL","window","location","href","languagesSet","searchParams","get","pathname","split","find","segment","includes","localStorage","getItem","getCookie","document","documentElement","lang","getPreferredLanguageFromBrowser","state","currentLanguage","filter","language","Error","persistLanguageChoice","setItem","setCookie","name","_a","cookie","match","pop","key","value","encodeURIComponent","navigator","extractLanguage","indexOf","languages","l","substring","toLowerCase","translate","translationObject","_b","_c"],"sources":["./src/assets/i18n/translations.ts","./src/services/language.service.ts"],"sourcesContent":["export const translations = {\n 'Close overlay': {\n de: 'Overlay Schliessen',\n fr: 'Fermer la superposition',\n it: 'Chiudi sovrapposizione',\n },\n 'Current language is English': {\n de: 'Die aktuelle Sprache ist Deutsch',\n fr: 'La langue actuelle est le français',\n it: \"La lingua corrente è l'italiano\",\n },\n 'Change language': {\n de: 'Sprache wechseln',\n fr: 'Changer de langue',\n it: 'Cambia lingua',\n },\n 'Go to main content': {\n de: 'Zum Hauptinhalt springen',\n fr: 'Aller au contenu principal',\n it: 'Vai al contenuto principale',\n },\n 'Go to search': {\n de: 'Zur Suche springen',\n fr: 'Aller à la recherche',\n it: 'Vai alla ricerca',\n },\n 'Go to login': {\n de: 'Zum Login springen',\n fr: 'Aller au login',\n it: 'Vai al login',\n },\n 'Open menu': {\n de: 'Menü öffnen',\n fr: 'Ouvrir le menu',\n it: 'Apri il menu',\n },\n 'Navigate on post.ch': {\n de: 'Navigieren auf post.ch',\n fr: 'Naviguer sur post.ch',\n it: 'Navigate su post.ch',\n },\n};\n","import { translations } from '../assets/i18n/translations';\nimport { state } from '../data/store';\n\nexport const getUserLang = (\n supportedLanguages: string[],\n implementorPreferredLanguage?: string,\n localStorageKey?: string,\n cookieKey?: string,\n) => {\n // If there are no supported languages, well...\n if (supportedLanguages.length === 0) {\n return undefined;\n }\n\n // If there is only one language in the config, use this\n if (supportedLanguages.length === 1) {\n return supportedLanguages[0];\n }\n\n const url = new URL(window.location.href);\n\n /**\n * Build array of possible language definitions in order of importance.\n * At the end is a filter function that will weed out any undefined or null entries.\n */\n let languagesSet: Array<string> = [\n // Check if implementor overrides lang config\n implementorPreferredLanguage,\n\n // Check query string param\n url.searchParams.get('lang'),\n\n // Check url pathname\n url.pathname.split('/').find(segment => supportedLanguages.includes(segment)),\n\n // Check local storage with the key provided\n localStorageKey !== undefined ? window.localStorage.getItem(localStorageKey) : null,\n\n // Check cookies\n getCookie('language'),\n getCookie('lang'),\n cookieKey !== undefined ? getCookie(cookieKey) : null,\n\n // Check document language\n document.documentElement.lang,\n\n // Check browser preferred language\n getPreferredLanguageFromBrowser(supportedLanguages),\n\n // Check the state\n state.currentLanguage,\n ].filter((lang): lang is string => !!lang);\n\n // Check the set of languages to see if it matches\n // any of the supported languages. Return the first\n // supported language if there is none set\n const lang =\n languagesSet.find(language => supportedLanguages.includes(language)) || supportedLanguages[0];\n\n if (!lang || lang.length !== 2) {\n throw new Error(\n `Current language could not be determined from settings or the language provided (${lang}) is not supported by the Header API.`,\n );\n }\n\n return lang;\n};\n\n/**\n * Persist chosen language to local storage\n * @param lang Currently chose language, two char string\n */\nexport const persistLanguageChoice = (\n lang: string,\n cookieKey?: string,\n localStorageKey?: string,\n) => {\n if (localStorageKey !== undefined) {\n window.localStorage.setItem(localStorageKey, lang);\n }\n\n if (cookieKey !== undefined) {\n setCookie(cookieKey, lang);\n }\n\n state.currentLanguage = lang;\n};\n\n/**\n * Read a cookie by name\n * https://stackoverflow.com/questions/5639346/what-is-the-shortest-function-for-reading-a-cookie-by-name-in-javascript?rq=1\n * @param name Cookie name\n * @returns Cookie value or an empty string\n */\nexport const getCookie = (name: string) => {\n return document.cookie.match('(^|;)\\\\s*' + name + '\\\\s*=\\\\s*([^;]+)')?.pop() || '';\n};\n\n/**\n * Write a new cookie\n * https://developer.mozilla.org/en-US/docs/Web/API/document/cookie#A_little_framework.3A_a_complete_cookies_reader.2Fwriter_with_full_unicode_support\n * @param key\n * @param value\n */\nexport const setCookie = (key: string, value: string) => {\n document.cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;\n};\n\nconst getPreferredLanguageFromBrowser = (supportedLanguages: string[]): string | null => {\n // IE & Chrome\n if (navigator.language) {\n const lang = extractLanguage(navigator.language);\n if (supportedLanguages.indexOf(lang) !== -1) {\n return lang;\n }\n }\n\n // Chrome supports a list of preferred languages: if the preferred is not supported, we go down the list.\n if (navigator.languages) {\n for (const l of navigator.languages) {\n const lang = extractLanguage(l);\n if (supportedLanguages.indexOf(lang) !== -1) {\n return lang;\n }\n }\n }\n\n return null;\n};\n\nconst extractLanguage = (language: string): string => language.substring(0, 2).toLowerCase();\n\n/**\n * Simple translate function for general header UI strings\n *\n * @param key Translation key\n * @param lang Force a language\n * @param translationObject Optionally provide translations\n * @returns Translated string or the key\n */\nexport const translate = (key: string, lang?: string, translationObject = translations) =>\n translationObject[key]?.[lang ?? state.currentLanguage ?? ''] ?? key;\n"],"mappings":"oCAAO,MAAMA,EAAe,CAC1B,gBAAiB,CACfC,GAAI,qBACJC,GAAI,0BACJC,GAAI,0BAEN,8BAA+B,CAC7BF,GAAI,mCACJC,GAAI,qCACJC,GAAI,mCAEN,kBAAmB,CACjBF,GAAI,mBACJC,GAAI,oBACJC,GAAI,iBAEN,qBAAsB,CACpBF,GAAI,2BACJC,GAAI,6BACJC,GAAI,+BAEN,eAAgB,CACdF,GAAI,qBACJC,GAAI,uBACJC,GAAI,oBAEN,cAAe,CACbF,GAAI,qBACJC,GAAI,iBACJC,GAAI,gBAEN,YAAa,CACXF,GAAI,cACJC,GAAI,iBACJC,GAAI,gBAEN,sBAAuB,CACrBF,GAAI,yBACJC,GAAI,uBACJC,GAAI,wB,MCpCKC,EAAc,CACzBC,EACAC,EACAC,EACAC,KAGA,GAAIH,EAAmBI,S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vB,IAAK,MAAMC,KAAKJ,UAAUG,UAAW,CACnC,MAAMrB,EAAOmB,EAAgBG,GAC7B,GAAI9C,EAAmB4C,QAAQpB,MAAW,EAAG,CAC3C,OAAOA,C,GAKb,OAAO,IAAI,EAGb,MAAMmB,EAAmBd,GAA6BA,EAASkB,UAAU,EAAG,GAAGC,c,MAUlEC,EAAY,CAACV,EAAaf,EAAe0B,EAAoBvD,KAAY,IAAAwC,EAAAgB,EAAAC,EACpF,OAAAA,GAAAjB,EAAAe,EAAkBX,MAAI,MAAAJ,SAAA,SAAAA,GAAGgB,EAAA3B,IAAI,MAAJA,SAAI,EAAJA,EAAQE,EAAMC,mBAAe,MAAAwB,SAAA,EAAAA,EAAI,OAAG,MAAAC,SAAA,EAAAA,EAAIb,CAAG,S"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e,i,n){var f=n||{},a=f.noTrailing,t=a===void 0?false:a,r=f.noLeading,o=r===void 0?false:r,u=f.debounceMode,d=u===void 0?undefined:u;var v;var s=false;var c=0;function l(){if(v){clearTimeout(v)}}function m(e){var i=e||{},n=i.upcomingOnly,f=n===void 0?false:n;l();s=!f}function D(){for(var n=arguments.length,f=new Array(n),a=0;a<n;a++){f[a]=arguments[a]}var r=this;var u=Date.now()-c;if(s){return}function m(){c=Date.now();i.apply(r,f)}function D(){v=undefined}if(!o&&d&&!v){m()}l();if(d===undefined&&u>e){if(o){c=Date.now();if(!t){v=setTimeout(d?D:m,e)}}else{m()}}else if(t!==true){v=setTimeout(d?D:m,d===undefined?e-u:e)}}D.cancel=m;return D}function i(i,n,f){var a=f||{},t=a.atBegin,r=t===void 0?false:t;return e(i,n,{debounceMode:r!==false})}export{i as d,e as t};
|
|
2
|
+
//# sourceMappingURL=p-a74b380d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["throttle","delay","callback","options","_ref","_ref$noTrailing","noTrailing","_ref$noLeading","noLeading","_ref$debounceMode","debounceMode","undefined","timeoutID","cancelled","lastExec","clearExistingTimeout","clearTimeout","cancel","_ref2","_ref2$upcomingOnly","upcomingOnly","wrapper","_len","arguments","length","arguments_","Array","_key","self","this","elapsed","Date","now","exec","apply","clear","setTimeout","debounce","_ref$atBegin","atBegin"],"sources":["../../node_modules/.pnpm/throttle-debounce@5.0.0/node_modules/throttle-debounce/esm/index.js"],"sourcesContent":["/* eslint-disable no-undefined,no-param-reassign,no-shadow */\n\n/**\n * Throttle execution of a function. Especially useful for rate limiting\n * execution of handlers on events like resize and scroll.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)\n * are most useful.\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,\n * as-is, to `callback` when the throttled-function is executed.\n * @param {object} [options] - An object to configure options.\n * @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds\n * while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed\n * one final time after the last throttled-function call. (After the throttled-function has not been called for\n * `delay` milliseconds, the internal counter is reset).\n * @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback\n * immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that\n * callback will never executed if both noLeading = true and noTrailing = true.\n * @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is\n * false (at end), schedule `callback` to execute after `delay` ms.\n *\n * @returns {Function} A new, throttled, function.\n */\nfunction throttle (delay, callback, options) {\n var _ref = options || {},\n _ref$noTrailing = _ref.noTrailing,\n noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,\n _ref$noLeading = _ref.noLeading,\n noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,\n _ref$debounceMode = _ref.debounceMode,\n debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;\n /*\n * After wrapper has stopped being called, this timeout ensures that\n * `callback` is executed at the proper times in `throttle` and `end`\n * debounce modes.\n */\n\n\n var timeoutID;\n var cancelled = false; // Keep track of the last time `callback` was executed.\n\n var lastExec = 0; // Function to clear existing timeout\n\n function clearExistingTimeout() {\n if (timeoutID) {\n clearTimeout(timeoutID);\n }\n } // Function to cancel next exec\n\n\n function cancel(options) {\n var _ref2 = options || {},\n _ref2$upcomingOnly = _ref2.upcomingOnly,\n upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;\n\n clearExistingTimeout();\n cancelled = !upcomingOnly;\n }\n /*\n * The `wrapper` function encapsulates all of the throttling / debouncing\n * functionality and when executed will limit the rate at which `callback`\n * is executed.\n */\n\n\n function wrapper() {\n for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {\n arguments_[_key] = arguments[_key];\n }\n\n var self = this;\n var elapsed = Date.now() - lastExec;\n\n if (cancelled) {\n return;\n } // Execute `callback` and update the `lastExec` timestamp.\n\n\n function exec() {\n lastExec = Date.now();\n callback.apply(self, arguments_);\n }\n /*\n * If `debounceMode` is true (at begin) this is used to clear the flag\n * to allow future `callback` executions.\n */\n\n\n function clear() {\n timeoutID = undefined;\n }\n\n if (!noLeading && debounceMode && !timeoutID) {\n /*\n * Since `wrapper` is being called for the first time and\n * `debounceMode` is true (at begin), execute `callback`\n * and noLeading != true.\n */\n exec();\n }\n\n clearExistingTimeout();\n\n if (debounceMode === undefined && elapsed > delay) {\n if (noLeading) {\n /*\n * In throttle mode with noLeading, if `delay` time has\n * been exceeded, update `lastExec` and schedule `callback`\n * to execute after `delay` ms.\n */\n lastExec = Date.now();\n\n if (!noTrailing) {\n timeoutID = setTimeout(debounceMode ? clear : exec, delay);\n }\n } else {\n /*\n * In throttle mode without noLeading, if `delay` time has been exceeded, execute\n * `callback`.\n */\n exec();\n }\n } else if (noTrailing !== true) {\n /*\n * In trailing throttle mode, since `delay` time has not been\n * exceeded, schedule `callback` to execute `delay` ms after most\n * recent execution.\n *\n * If `debounceMode` is true (at begin), schedule `clear` to execute\n * after `delay` ms.\n *\n * If `debounceMode` is false (at end), schedule `callback` to\n * execute after `delay` ms.\n */\n timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);\n }\n }\n\n wrapper.cancel = cancel; // Return the wrapper function.\n\n return wrapper;\n}\n\n/* eslint-disable no-undefined */\n/**\n * Debounce execution of a function. Debouncing, unlike throttling,\n * guarantees that a function is only executed a single time, either at the\n * very beginning of a series of calls, or at the very end.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n * to `callback` when the debounced-function is executed.\n * @param {object} [options] - An object to configure options.\n * @param {boolean} [options.atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds\n * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.\n * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).\n *\n * @returns {Function} A new, debounced function.\n */\n\nfunction debounce (delay, callback, options) {\n var _ref = options || {},\n _ref$atBegin = _ref.atBegin,\n atBegin = _ref$atBegin === void 0 ? false : _ref$atBegin;\n\n return throttle(delay, callback, {\n debounceMode: atBegin !== false\n });\n}\n\nexport { debounce, throttle };\n//# sourceMappingURL=index.js.map\n"],"mappings":"AAuBA,SAASA,EAAUC,EAAOC,EAAUC,GAClC,IAAIC,EAAOD,GAAW,GAClBE,EAAkBD,EAAKE,WACvBA,EAAaD,SAAyB,EAAI,MAAQA,EAClDE,EAAiBH,EAAKI,UACtBA,EAAYD,SAAwB,EAAI,MAAQA,EAChDE,EAAoBL,EAAKM,aACzBA,EAAeD,SAA2B,EAAIE,UAAYF,EAQ9D,IAAIG,EACJ,IAAIC,EAAY,MAEhB,IAAIC,EAAW,EAEf,SAASC,IACP,GAAIH,EAAW,CACbI,aAAaJ,EACnB,CACA,CAGE,SAASK,EAAOd,GACd,IAAIe,EAAQf,GAAW,GACnBgB,EAAqBD,EAAME,aAC3BA,EAAeD,SAA4B,EAAI,MAAQA,EAE3DJ,IACAF,GAAaO,CACjB,CAQE,SAASC,IACP,IAAK,IAAIC,EAAOC,UAAUC,OAAQC,EAAa,IAAIC,MAAMJ,GAAOK,EAAO,EAAGA,EAAOL,EAAMK,IAAQ,CAC7FF,EAAWE,GAAQJ,UAAUI,EACnC,CAEI,IAAIC,EAAOC,KACX,IAAIC,EAAUC,KAAKC,MAAQlB,EAE3B,GAAID,EAAW,CACb,MACN,CAGI,SAASoB,IACPnB,EAAWiB,KAAKC,MAChB9B,EAASgC,MAAMN,EAAMH,EAC3B,CAOI,SAASU,IACPvB,EAAYD,SAClB,CAEI,IAAKH,GAAaE,IAAiBE,EAAW,CAM5CqB,GACN,CAEIlB,IAEA,GAAIL,IAAiBC,WAAamB,EAAU7B,EAAO,CACjD,GAAIO,EAAW,CAMbM,EAAWiB,KAAKC,MAEhB,IAAK1B,EAAY,CACfM,EAAYwB,WAAW1B,EAAeyB,EAAQF,EAAMhC,EAC9D,CACA,KAAa,CAKLgC,GACR,CACA,MAAW,GAAI3B,IAAe,KAAM,CAY9BM,EAAYwB,WAAW1B,EAAeyB,EAAQF,EAAMvB,IAAiBC,UAAYV,EAAQ6B,EAAU7B,EACzG,CACA,CAEEoB,EAAQJ,OAASA,EAEjB,OAAOI,CACT,CAmBA,SAASgB,EAAUpC,EAAOC,EAAUC,GAClC,IAAIC,EAAOD,GAAW,GAClBmC,EAAelC,EAAKmC,QACpBA,EAAUD,SAAsB,EAAI,MAAQA,EAEhD,OAAOtC,EAASC,EAAOC,EAAU,CAC/BQ,aAAc6B,IAAY,OAE9B,Q"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as i,h as s,H as n,g as t}from"./p-5032057e.js";import{s as l}from"./p-06649b46.js";import{t as a}from"./p-a6001d1e.js";import{S as e}from"./p-ab1dd269.js";const o=":host{display:block}.skiplinks a{position:absolute;top:0.5rem;left:0.5rem;clip:rect(0 0 0 0);width:1px;overflow:hidden;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:0.25rem;background:white}.skiplinks a:focus-visible{clip:unset;width:auto}";const r=class{constructor(s){i(this,s)}getMainId(){var i;return(i=document.querySelector("main[id]"))===null||i===void 0?void 0:i.getAttribute("id")}setFocus(i){const s=this.host.closest(".post-internet-header");if(!s){return}const n=s.querySelector(i);if(n){n.setFocus()}}focusMain(){this.setFocus("post-main-navigation")}focusSearch(){this.setFocus("post-search")}focusLogin(){this.setFocus("post-klp-login-widget")}render(){var i;const t=(i=l.localizedConfig)===null||i===void 0?void 0:i.header;const o=this.getMainId();if(t===undefined){return}return s(n,null,s("div",{class:"skiplinks"},s("h1",{class:"visually-hidden"},a("Navigate on post.ch")),s("ul",{class:"no-list"},s("li",null,s("a",{class:"nav-link",href:t.logo.logoLink,accessKey:"0",title:"[ALT + 0]"},s("span",null,t.logo.logoLinkTitle),s(e,{name:"pi-pointy-arrow-right"}))),s("li",null,s("a",{class:"nav-link",href:"#post-internet-header-main-navigation",accessKey:"1",title:"[ALT + 1]",onClick:()=>this.focusMain()},s("span",null,t.translations.navMainAriaLabel),s(e,{name:"pi-pointy-arrow-right"}))),o?s("li",null,s("a",{class:"nav-link",href:`#${o}`,accessKey:"2",title:"[ALT + 2]"},s("span",null,a("Go to main content")),s(e,{name:"pi-pointy-arrow-right"}))):null,l.search?s("li",null,s("a",{class:"nav-link",href:"#post-internet-header-search-button",accessKey:"3",title:"[ALT + 3]",onClick:()=>this.focusSearch()},s("span",null,a("Go to search")),s(e,{name:"pi-pointy-arrow-right"}))):null,l.login?s("li",null,s("a",{class:"nav-link",href:"#post-klp-login-widget",accessKey:"4",title:"[ALT + 4]",onClick:()=>this.focusLogin()},s("span",null,a("Go to login")),s(e,{name:"pi-pointy-arrow-right"}))):null)))}get host(){return t(this)}};r.style=o;export{r as post_skiplinks};
|
|
2
|
+
//# sourceMappingURL=p-c565414e.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["postSkiplinksCss","PostSkiplinks","getMainId","_a","document","querySelector","getAttribute","setFocus","tagname","rootHost","this","host","closest","focusable","focusMain","focusSearch","focusLogin","render","config","state","localizedConfig","header","mainId","undefined","h","Host","class","translate","href","logo","logoLink","accessKey","title","logoLinkTitle","SvgIcon","name","onClick","translations","navMainAriaLabel","search","login"],"sources":["./src/components/post-skiplinks/post-skiplinks.scss?tag=post-skiplinks","./src/components/post-skiplinks/post-skiplinks.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.skiplinks {\n a {\n position: absolute;\n top: 0.5rem;\n left: 0.5rem;\n clip: rect(0 0 0 0);\n width: 1px;\n overflow: hidden;\n display: flex;\n align-items: center;\n padding: 0.25rem;\n background: white;\n\n &:focus-visible {\n clip: unset;\n width: auto;\n }\n }\n}\n","import { Component, Host, h, Element } from '@stencil/core';\nimport { state } from '../../data/store';\nimport { FocusableElement } from '../../models/header.model';\nimport { translate } from '../../services/language.service';\nimport { SvgIcon } from '../../utils/svg-icon.component';\n\n@Component({\n tag: 'post-skiplinks',\n styleUrl: 'post-skiplinks.scss',\n shadow: false,\n})\nexport class PostSkiplinks {\n @Element() host: HTMLElement;\n\n private getMainId() {\n return document.querySelector('main[id]')?.getAttribute('id');\n }\n\n private setFocus(tagname: string) {\n const rootHost = this.host.closest('.post-internet-header');\n if (!rootHost) {\n return;\n }\n\n const focusable = rootHost.querySelector<FocusableElement>(tagname);\n if (focusable) {\n focusable.setFocus();\n }\n }\n\n private focusMain() {\n this.setFocus('post-main-navigation');\n }\n\n private focusSearch() {\n this.setFocus('post-search');\n }\n\n private focusLogin() {\n this.setFocus('post-klp-login-widget');\n }\n\n render() {\n const config = state.localizedConfig?.header;\n const mainId = this.getMainId();\n\n if (config === undefined) {\n return;\n }\n\n return (\n <Host>\n <div class=\"skiplinks\">\n <h1 class=\"visually-hidden\">{translate('Navigate on post.ch')}</h1>\n <ul class=\"no-list\">\n <li>\n <a class=\"nav-link\" href={config.logo.logoLink} accessKey=\"0\" title=\"[ALT + 0]\">\n <span>{config.logo.logoLinkTitle}</span>\n <SvgIcon name=\"pi-pointy-arrow-right\" />\n </a>\n </li>\n <li>\n <a\n class=\"nav-link\"\n href=\"#post-internet-header-main-navigation\"\n accessKey=\"1\"\n title=\"[ALT + 1]\"\n onClick={() => this.focusMain()}\n >\n <span>{config.translations.navMainAriaLabel}</span>\n <SvgIcon name=\"pi-pointy-arrow-right\" />\n </a>\n </li>\n {mainId ? (\n <li>\n <a class=\"nav-link\" href={`#${mainId}`} accessKey=\"2\" title=\"[ALT + 2]\">\n <span>{translate('Go to main content')}</span>\n <SvgIcon name=\"pi-pointy-arrow-right\" />\n </a>\n </li>\n ) : null}\n {state.search ? (\n <li>\n <a\n class=\"nav-link\"\n href=\"#post-internet-header-search-button\"\n accessKey=\"3\"\n title=\"[ALT + 3]\"\n onClick={() => this.focusSearch()}\n >\n <span>{translate('Go to search')}</span>\n <SvgIcon name=\"pi-pointy-arrow-right\" />\n </a>\n </li>\n ) : null}\n {state.login ? (\n <li>\n <a\n class=\"nav-link\"\n href=\"#post-klp-login-widget\"\n accessKey=\"4\"\n title=\"[ALT + 4]\"\n onClick={() => this.focusLogin()}\n >\n <span>{translate('Go to login')}</span>\n <SvgIcon name=\"pi-pointy-arrow-right\" />\n </a>\n </li>\n ) : null}\n </ul>\n </div>\n </Host>\n );\n }\n}\n"],"mappings":"qKAAA,MAAMA,EAAmB,sR,MCWZC,EAAa,M,yBAGhBC,Y,MACN,OAAOC,EAAAC,SAASC,cAAc,eAAW,MAAAF,SAAA,SAAAA,EAAEG,aAAa,K,CAGlDC,SAASC,GACf,MAAMC,EAAWC,KAAKC,KAAKC,QAAQ,yBACnC,IAAKH,EAAU,CACb,M,CAGF,MAAMI,EAAYJ,EAASJ,cAAgCG,GAC3D,GAAIK,EAAW,CACbA,EAAUN,U,EAINO,YACNJ,KAAKH,SAAS,uB,CAGRQ,cACNL,KAAKH,SAAS,c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ENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(t,i,e,n){function o(t){return t instanceof e?t:new e((function(i){i(t)}))}return new(e||(e=Promise))((function(e,r){function a(t){try{s(n.next(t))}catch(t){r(t)}}function l(t){try{s(n["throw"](t))}catch(t){r(t)}}function s(t){t.done?e(t.value):o(t.value).then(a,l)}s((n=n.apply(t,i||[])).next())}))};var __generator=this&&this.__generator||function(t,i){var e={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,o,r,a;return a={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(t){return function(i){return s([t,i])}}function s(l){if(n)throw new TypeError("Generator is already executing.");while(a&&(a=0,l[0]&&(e=0)),e)try{if(n=1,o&&(r=l[0]&2?o["return"]:l[0]?o["throw"]||((r=o["return"])&&r.call(o),0):o.next)&&!(r=r.call(o,l[1])).done)return r;if(o=0,r)l=[l[0]&2,r.value];switch(l[0]){case 0:case 1:r=l;break;case 4:e.label++;return{value:l[1],done:false};case 5:e.label++;o=l[1];l=[0];continue;case 7:l=e.ops.pop();e.trys.pop();continue;default:if(!(r=e.trys,r=r.length>0&&r[r.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!r||l[1]>r[0]&&l[1]<r[3])){e.label=l[1];break}if(l[0]===6&&e.label<r[1]){e.label=r[1];r=l;break}if(r&&e.label<r[2]){e.label=r[2];e.ops.push(l);break}if(r[2])e.ops.pop();e.trys.pop();continue}l=i.call(t,e)}catch(t){l=[6,t];o=0}finally{n=r=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:true}}};System.register(["./p-1b8f9bc8.system.js","./p-c8296f63.system.js","./p-b3014611.system.js","./p-7fcba2e7.system.js","./p-88aac12c.system.js","./p-ffc59851.system.js","./p-ee119d2e.system.js"],(function(t){"use strict";var i,e,n,o,r,a,l,s,u,d,f,m,c;return{setters:[function(t){i=t.h;e=t.r;n=t.c;o=t.H;r=t.g},function(t){a=t.t},function(t){l=t.c;s=t.d;u=t.e},function(t){d=t.s},function(t){f=t.u},function(t){m=t.S},function(t){c=t.S}],execute:function(){var h=function(t){var e,n,o;var r=t.level.url?"a":"button";return i(r,{class:{"main-link":true,active:!!t.level.isActiveOverride,focus:t.isOpen},href:t.level.url,title:((e=t.level.title)===null||e===void 0?void 0:e.trim())&&((n=t.level.title)===null||n===void 0?void 0:n.trim())!==((o=t.level.text)===null||o===void 0?void 0:o.trim())?t.level.title:undefined,tabindex:t.level.url?undefined:0,"aria-haspopup":!t.level.noFlyout+"","aria-expanded":t.level.noFlyout?null:t.isOpen+"",onTouchEnd:function(i){return t.onTouchEnd(i)},onKeyDown:function(i){return t.onKeyDown(i)},onClick:function(i){return t.onClick(i)}},i("span",null,t.level.text),i("svg",{"aria-hidden":"true"},i("use",{href:"#pi-pointy-arrow-right"})))};var p='.flyout-nav,.flyout-column h3{font-size:0.9375rem;line-height:1.4}@media (min-width: 600px){.flyout-nav,.flyout-column h3{font-size:1rem}}@media (min-width: 1024px){.flyout-nav,.flyout-column h3{font-size:1.0625rem}}.flyout-title{font-size:1.0625rem;line-height:1.4}@media (min-width: 600px){.flyout-title{font-size:1.25rem}}@media (min-width: 1024px){.flyout-title{font-size:1.5rem;line-height:1.1}}@font-face{font-display:swap;font-family:"Frutiger Neue For Post";font-weight:700;src:url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Bold.woff2") format("woff2"), url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Bold.woff") format("woff")}@font-face{font-display:swap;font-family:"Frutiger Neue For Post";font-weight:400;src:url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Rg.woff2") format("woff2"), url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Rg.woff") format("woff")}@font-face{font-display:swap;font-family:"Frutiger Neue For Post";font-weight:300;src:url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Lt.woff2") format("woff2"), url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Lt.woff") format("woff")}*,:host,*::before,*::after{-webkit-box-sizing:border-box;box-sizing:border-box}:host{font-family:"Frutiger Neue For Post", system-ui, sans-serif}button{font:inherit;padding:0}img,svg{max-width:100%;max-height:100%}@media (forced-colors: active){svg{color:white}}.main-container,.flyout-linklist,.no-list{list-style:none;padding-left:0;margin-top:0;margin-bottom:0}.btn-blank{background-color:transparent;border:none;border-radius:0;padding:0}.main-link,.flyout-close-button,.flyout-link,.nav-link{text-decoration:none;color:rgba(0, 0, 0, 0.8);-webkit-transition:color 200ms;transition:color 200ms;background-color:transparent;border-radius:0;-webkit-box-shadow:none;box-shadow:none;border:0;margin:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:0.5rem}.main-link:hover,.flyout-close-button:hover,.flyout-link:hover,.nav-link:hover,.main-link:focus,.flyout-close-button:focus,.flyout-link:focus,.nav-link:focus{color:black}.main-link>svg,.flyout-close-button>svg,.flyout-link>svg,.nav-link>svg{width:1.4em;height:1.4em;-ms-flex-negative:0;flex-shrink:0}.main-link>span,.flyout-close-button>span,.flyout-link>span,.nav-link>span{-ms-flex-negative:1;flex-shrink:1}.box>*:first-child{margin-top:0}.box>*:last-child{margin-bottom:0}.mirrored{-webkit-transform:scaleX(-1);transform:scaleX(-1)}.rotate-270{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.bold{font-weight:700}.light{font-weight:300}.d-flex{display:-ms-flexbox;display:flex}.d-inline-flex{display:-ms-inline-flexbox;display:inline-flex}.align-items-center{-ms-flex-align:center;align-items:center}@media (min-width: 1441px){.wide-container{margin:0 auto;max-width:1440px}}@media (max-width: 599.98px){.container{padding-right:16px;padding-left:16px}}@media (min-width: 600px) and (max-width: 1023.98px){.container{padding-right:32px;padding-left:32px}}@media (min-width: 1024px){.container{padding-right:40px;padding-left:40px}}.visually-hidden{position:absolute;width:1px;height:1px;border:0;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0)}@media (max-width: -0.02px){.hidden-xs{display:none}}@media (max-width: 399.98px){.hidden-sm{display:none}}@media (max-width: 599.98px){.hidden-rg{display:none}}@media (max-width: 779.98px){.hidden-md{display:none}}@media (max-width: 1023.98px){.hidden-lg{display:none}}@media (max-width: 1279.98px){.hidden-xl{display:none}}@media (max-width: 1440.98px){.hidden-xxl{display:none}}:host{--host-window-height:var(--window-height, 100vh);--calculated-header-height:calc(var(--header-height) + 1px);display:block;min-width:0;height:var(--header-height)}:host(.no-animation) *{-webkit-animation:none !important;animation:none !important;-webkit-transition:none !important;transition:none !important}@media (min-width: 1024px){.main-navigation,.main-container,.main-container li,.main-link{height:100%}}.main-navigation{font-size:1.125rem}@media (min-width: 1024px){.main-navigation{font-size:1rem;margin:0 0.75rem}}@media (min-width: 1280px){.main-navigation{font-size:1.125rem}}@media (min-width: 1441px){.main-navigation{font-size:1.25rem}}@media (max-width: 1023.98px){.main-navigation{position:absolute;top:var(--calculated-header-height);left:0;background:white;height:calc(var(--host-window-height) - var(--calculated-header-height));width:100%;margin:0;overflow:hidden scroll;-webkit-overflow-scrolling:touch;-ms-scroll-chaining:none;overscroll-behavior:contain;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between;z-index:-1;visibility:hidden;-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transition:visibility 0.35s, -webkit-transform 0.35s;transition:visibility 0.35s, -webkit-transform 0.35s;transition:transform 0.35s, visibility 0.35s;transition:transform 0.35s, visibility 0.35s, -webkit-transform 0.35s}}@media (max-width: 1023.98px) and (prefers-reduced-motion: reduce){.main-navigation{-webkit-transition:none;transition:none}}@media (max-width: 1023.98px){.main-navigation.open{-webkit-transform:translateY(0);transform:translateY(0);visibility:visible}}.main-container{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:start;justify-content:flex-start}@media (max-width: 1023.98px){.main-container{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:stretch;align-items:stretch;-ms-flex-pack:start;justify-content:flex-start;padding-top:2.5rem;padding-bottom:2.5rem}.main-container>li+li{border-top:1px solid #e6e6e6}}@media (min-width: 1024px){.main-container{padding-right:0;padding-left:0}}.main-container>li{-ms-flex:0 1 auto;flex:0 1 auto;min-width:0}.main-link{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding-right:0.75rem;padding-left:0.75rem;text-align:left;cursor:pointer;width:100%}@media (min-width: 1024px){.main-link svg{display:none}}@media (max-width: 1023.98px){.main-link{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;font-weight:300;padding:0.625rem 0;width:100%;text-align:left}.main-link svg{width:1.5rem;height:1.5rem}}.main-link span{overflow:hidden;text-overflow:ellipsis}.main-link,.flyout-link{position:relative;color:black}.main-link::after,.flyout-link::after{content:"";position:absolute;bottom:-1px;left:0;width:100%;height:4px;background-color:transparent;opacity:0;-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transition:opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);transition:opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);transition:opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);transition:opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.25s cubic-bezier(0.4, 0, 0.2, 1)}@media (prefers-reduced-motion: reduce){.main-link::after,.flyout-link::after{-webkit-transition:none;transition:none}}.main-link:hover::after,.main-link.focus::after,.flyout-link:hover::after,.flyout-link.focus::after{background-color:#cccccc;opacity:1;-webkit-transform:scale(1);transform:scale(1)}.main-link.active,.flyout-link.active{font-weight:700}.main-link.active::after,.flyout-link.active::after{background-color:#fc0;opacity:1;-webkit-transform:scale(1);transform:scale(1)}.flyout{left:0;width:100%;background:white;padding-bottom:3rem;overflow:auto;-ms-scroll-chaining:none;overscroll-behavior:contain;visibility:hidden}@media (min-width: 1024px){.flyout{position:absolute;top:100%;max-height:calc(100vh - var(--header-height) - var(--meta-header-height) - 1px);z-index:-1;-webkit-box-shadow:0 0 1px 0 rgba(0, 0, 0, 0.4);box-shadow:0 0 1px 0 rgba(0, 0, 0, 0.4);-webkit-transform:translateY(-100%);transform:translateY(-100%)}.flyout.open{-webkit-box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.4);box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.4);-webkit-transform:translateY(0);transform:translateY(0)}}@media (max-width: 1023.98px){.flyout{position:fixed;top:0;height:100%;z-index:1;-webkit-transform:translateX(100%);transform:translateX(100%)}.flyout.open{-webkit-transform:translateX(0);transform:translateX(0)}}.flyout.open{visibility:visible}.flyout.animate{-webkit-transition:visibility 0.35s, -webkit-transform 0.35s, -webkit-box-shadow 0.35s;transition:visibility 0.35s, -webkit-transform 0.35s, -webkit-box-shadow 0.35s;transition:transform 0.35s, visibility 0.35s, box-shadow 0.35s;transition:transform 0.35s, visibility 0.35s, box-shadow 0.35s, -webkit-transform 0.35s, -webkit-box-shadow 0.35s}@media (prefers-reduced-motion: reduce){.flyout.animate{-webkit-transition:none;transition:none}}.flyout-nav{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;min-height:3.5rem;-webkit-box-sizing:content-box;box-sizing:content-box}.flyout-row{display:-ms-flexbox;display:flex;gap:1.5rem}@media (max-width: 1023.98px){.flyout-row{display:grid;grid-template-columns:1fr 1fr}}@media (max-width: 599.98px){.flyout-row{grid-template-columns:1fr}}.flyout-column{-ms-flex:1;flex:1;max-width:25%}@media (max-width: 1023.98px){.flyout-column{max-width:none}}.flyout-column h3{margin-top:0}.flyout-back-button{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;font-size:1rem;font-weight:400;cursor:pointer}@media (max-width: 599.98px){.flyout-back-button{padding-right:16px;padding-left:16px}}@media (min-width: 600px) and (max-width: 1023.98px){.flyout-back-button{padding-right:32px;padding-left:32px}}@media (min-width: 1024px){.flyout-back-button{padding-right:40px;padding-left:40px}}.flyout-back-button svg{width:1.5rem;height:1.5rem}@media (min-width: 1024px){.flyout-back-button{display:none}}.flyout-close-button{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-left:auto;padding:0 1.5rem;cursor:pointer}.flyout-close-button svg{width:1.5rem;height:1.5rem}@media (max-width: 1023.98px){.flyout-close-button{display:none}}.flyout-linklist li{border-top:1px solid #e6e6e6}.flyout-linklist:first-child>li{border-top-color:transparent}.flyout-link{display:block;padding:0.75rem 0}.flyout-title{margin:2.5rem 0 1.5rem 0}@media (min-width: 1024px){.flyout-title{display:none}}';var y=t("post_main_navigation",function(){function t(t){e(this,t);this.dropdownToggled=n(this,"dropdownToggled",7);this.flyoutToggled=n(this,"flyoutToggled",7);this.resizeTimer=null;this.mouseLeaveTimer=null;this.mouseEnterTimer=null;this.activeFlyout=undefined;this.mobileMenuOpen=undefined}t.prototype.connectedCallback=function(){var t=this;this.throttledResize=a(300,(function(){return t.handleResize()}));window.addEventListener("resize",this.throttledResize,{passive:true});this.setWindowHeight()};t.prototype.disconnectedCallback=function(){window.removeEventListener("resize",this.throttledResize);l();if(this.mouseEnterTimer!==null)window.clearTimeout(this.mouseEnterTimer);if(this.mouseLeaveTimer!==null)window.clearTimeout(this.mouseLeaveTimer)};t.prototype.handleResize=function(){var t=this;this.host.classList.add("no-animation");if(this.resizeTimer!==null)window.clearTimeout(this.resizeTimer);this.resizeTimer=window.setTimeout((function(){t.host.classList.remove("no-animation")}),300);this.setWindowHeight()};t.prototype.setWindowHeight=function(){var t=this;if(!this.host){return}this.host.style.setProperty("--window-height","".concat(window.innerHeight,"px"));window.setTimeout((function(){t.host.style.setProperty("--window-height","".concat(window.innerHeight,"px"))}),100)};t.prototype.openFlyout=function(t){var i;var e=(i=this.host.shadowRoot)===null||i===void 0?void 0:i.getElementById(t);if(e&&this.activeFlyout!==""){this.addFlyoutAnimation(e)}this.activeFlyout=t;this.flyoutToggled.emit(t);this.setWindowHeight();if(this.mouseLeaveTimer!==null){window.clearTimeout(this.mouseLeaveTimer);this.mouseLeaveTimer=null}};t.prototype.closeFlyout=function(t){var i;if(t===undefined)return;var e=(i=this.host.shadowRoot)===null||i===void 0?void 0:i.getElementById(t);if(e){this.addFlyoutAnimation(e)}this.activeFlyout=null;this.flyoutToggled.emit()};t.prototype.addFlyoutAnimation=function(t){var i=this;if(!f()){t.classList.add("animate");t.addEventListener("transitionend",(function(){return i.removeFlyoutAnimation(t)}),{once:true})}};t.prototype.removeFlyoutAnimation=function(t){t.classList.remove("animate")};t.prototype.isActiveFlyout=function(t){return t===this.activeFlyout};t.prototype.handleMouseEnter=function(t){var i=this;if(this.mouseEnterTimer!==null){window.clearTimeout(this.mouseEnterTimer);this.mouseEnterTimer=null}if(this.mouseLeaveTimer&&this.activeFlyout===t.id){window.clearTimeout(this.mouseLeaveTimer);this.mouseLeaveTimer=null}if(window.innerWidth>=1024&&t.flyout.length>0&&this.activeFlyout!==t.id){this.mouseEnterTimer=window.setTimeout((function(){i.mouseEnterTimer=null;if(t.id!==undefined)i.openFlyout(t.id)}),200)}};t.prototype.handleMouseLeave=function(t){var i=this;if(this.mouseEnterTimer!==null){window.clearTimeout(this.mouseEnterTimer)}if(this.activeFlyout&&this.activeFlyout!==t.id){return}if(window.innerWidth>=1024&&t.flyout.length>0){this.mouseLeaveTimer=window.setTimeout((function(){i.closeFlyout(t.id)}),300)}};t.prototype.handleTouchEnd=function(t,i){if(!this.isActiveFlyout(i.id)&&!i.noFlyout){if(t.cancelable)t.preventDefault();if(i.id)this.openFlyout(i.id)}};t.prototype.handleKeyPress=function(t,i){if(t.key==="Enter"&&!this.isActiveFlyout(i.id)&&!i.noFlyout){t.preventDefault();if(i.id)this.openFlyout(i.id)}};t.prototype.handleClick=function(t,i){if(!this.isActiveFlyout(i.id)&&!i.noFlyout){t.preventDefault();if(i.id)this.openFlyout(i.id)}};t.prototype.setBodyScroll=function(){if(this.mobileMenuOpen){s(this.flyoutElement)}else{u(this.flyoutElement)}};t.prototype.toggleDropdown=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){this.mobileMenuOpen=t===undefined?!this.mobileMenuOpen:t;this.dropdownToggled.emit({open:this.mobileMenuOpen,element:this.host});if(t===false){this.closeFlyout()}this.setBodyScroll();this.setWindowHeight();return[2,this.mobileMenuOpen]}))}))};t.prototype.setFocus=function(){return __awaiter(this,void 0,void 0,(function(){var t,i;return __generator(this,(function(e){i=(t=this.host.shadowRoot)===null||t===void 0?void 0:t.querySelector(".main-link");if(i){i.focus()}return[2]}))}))};t.prototype.setActiveFlyout=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){this.activeFlyout=t;this.flyoutToggled.emit(this.activeFlyout);return[2]}))}))};t.prototype.render=function(){var t=this;var e;if(((e=d.localizedConfig)===null||e===void 0?void 0:e.header)===undefined)return;var n=d.localizedConfig.header;return i(o,null,i(m,null),i("nav",{id:"post-internet-header-main-navigation",class:{"main-navigation":true,open:this.mobileMenuOpen},ref:function(i){return t.flyoutElement=i}},i("h2",{class:"visually-hidden"},n.translations.navMainAriaLabel),i("ul",{class:"main-container container"},n.navMain.map((function(e){return i("li",{key:e.text,onMouseLeave:function(){return t.handleMouseLeave(e)},onMouseEnter:function(){return t.handleMouseEnter(e)}},i(h,{level:e,isOpen:t.isActiveFlyout(e.id),onTouchEnd:function(i){return t.handleTouchEnd(i,e)},onKeyDown:function(i){return t.handleKeyPress(i,e)},onClick:function(i){return t.handleClick(i,e)}}),!e.noFlyout?i("div",{id:e.id,class:{flyout:true,open:t.isActiveFlyout(e.id)}},i("div",{class:"wide-container"},i("div",{class:"flyout-nav"},i("button",{class:"nav-link flyout-back-button",onClick:function(){return t.closeFlyout(e.id)}},i(c,{name:"pi-pointy-arrow-right",classNames:"mirrored"}),i("span",null,n.translations.backButtonText)),i("button",{class:"flyout-close-button",onClick:function(){return t.closeFlyout(e.id)}},i("span",{class:"visually-hidden"},n.translations.mobileNavToggleClose),i(c,{name:"pi-close"}))),i("h2",{class:"flyout-title container"},i("a",{href:e.url,class:"nav-link"},e.text)),i("div",{class:"flyout-row container"},e.flyout.map((function(t){return i("div",{key:t.title,class:"flyout-column"},t.title?i("h3",null,t.title):null,i("ul",{class:"flyout-linklist"},t.linkList.map((function(t){return i("li",{key:t.url},i("a",{class:{"flyout-link":true,active:!!(t===null||t===void 0?void 0:t.isActiveOverride)},href:t.url,target:t.target},t.title))}))))}))))):null)}))),i("slot",null)))};Object.defineProperty(t.prototype,"host",{get:function(){return r(this)},enumerable:false,configurable:true});return t}());y.style=p}}}));
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,i,e,n){function o(t){return t instanceof e?t:new e((function(i){i(t)}))}return new(e||(e=Promise))((function(e,r){function a(t){try{s(n.next(t))}catch(t){r(t)}}function l(t){try{s(n["throw"](t))}catch(t){r(t)}}function s(t){t.done?e(t.value):o(t.value).then(a,l)}s((n=n.apply(t,i||[])).next())}))};var __generator=this&&this.__generator||function(t,i){var e={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,o,r,a;return a={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(t){return function(i){return s([t,i])}}function s(l){if(n)throw new TypeError("Generator is already executing.");while(a&&(a=0,l[0]&&(e=0)),e)try{if(n=1,o&&(r=l[0]&2?o["return"]:l[0]?o["throw"]||((r=o["return"])&&r.call(o),0):o.next)&&!(r=r.call(o,l[1])).done)return r;if(o=0,r)l=[l[0]&2,r.value];switch(l[0]){case 0:case 1:r=l;break;case 4:e.label++;return{value:l[1],done:false};case 5:e.label++;o=l[1];l=[0];continue;case 7:l=e.ops.pop();e.trys.pop();continue;default:if(!(r=e.trys,r=r.length>0&&r[r.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!r||l[1]>r[0]&&l[1]<r[3])){e.label=l[1];break}if(l[0]===6&&e.label<r[1]){e.label=r[1];r=l;break}if(r&&e.label<r[2]){e.label=r[2];e.ops.push(l);break}if(r[2])e.ops.pop();e.trys.pop();continue}l=i.call(t,e)}catch(t){l=[6,t];o=0}finally{n=r=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:true}}};System.register(["./p-1b8f9bc8.system.js","./p-9b4d5e90.system.js","./p-b3014611.system.js","./p-7fcba2e7.system.js","./p-88aac12c.system.js","./p-ffc59851.system.js","./p-ee119d2e.system.js"],(function(t){"use strict";var i,e,n,o,r,a,l,s,u,d,f,m,c;return{setters:[function(t){i=t.h;e=t.r;n=t.c;o=t.H;r=t.g},function(t){a=t.t},function(t){l=t.c;s=t.d;u=t.e},function(t){d=t.s},function(t){f=t.u},function(t){m=t.S},function(t){c=t.S}],execute:function(){var h=function(t){var e,n,o;var r=t.level.url?"a":"button";return i(r,{class:{"main-link":true,active:!!t.level.isActiveOverride,focus:t.isOpen},href:t.level.url,title:((e=t.level.title)===null||e===void 0?void 0:e.trim())&&((n=t.level.title)===null||n===void 0?void 0:n.trim())!==((o=t.level.text)===null||o===void 0?void 0:o.trim())?t.level.title:undefined,tabindex:t.level.url?undefined:0,"aria-haspopup":!t.level.noFlyout+"","aria-expanded":t.level.noFlyout?null:t.isOpen+"",onTouchEnd:function(i){return t.onTouchEnd(i)},onKeyDown:function(i){return t.onKeyDown(i)},onClick:function(i){return t.onClick(i)}},i("span",null,t.level.text),i("svg",{"aria-hidden":"true"},i("use",{href:"#pi-pointy-arrow-right"})))};var p='.flyout-nav,.flyout-column h3{font-size:0.9375rem;line-height:1.4}@media (min-width: 600px){.flyout-nav,.flyout-column h3{font-size:1rem}}@media (min-width: 1024px){.flyout-nav,.flyout-column h3{font-size:1.0625rem}}.flyout-title{font-size:1.0625rem;line-height:1.4}@media (min-width: 600px){.flyout-title{font-size:1.25rem}}@media (min-width: 1024px){.flyout-title{font-size:1.5rem;line-height:1.1}}@font-face{font-display:swap;font-family:"Frutiger Neue For Post";font-weight:700;src:url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Bold.woff2") format("woff2"), url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Bold.woff") format("woff")}@font-face{font-display:swap;font-family:"Frutiger Neue For Post";font-weight:400;src:url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Rg.woff2") format("woff2"), url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Rg.woff") format("woff")}@font-face{font-display:swap;font-family:"Frutiger Neue For Post";font-weight:300;src:url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Lt.woff2") format("woff2"), url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Lt.woff") format("woff")}*,:host,*::before,*::after{-webkit-box-sizing:border-box;box-sizing:border-box}:host{font-family:"Frutiger Neue For Post", system-ui, sans-serif}button{font:inherit;padding:0}img,svg{max-width:100%;max-height:100%}@media (forced-colors: active){svg{color:white}}.main-container,.flyout-linklist,.no-list{list-style:none;padding-left:0;margin-top:0;margin-bottom:0}.btn-blank{background-color:transparent;border:none;border-radius:0;padding:0}.main-link,.flyout-close-button,.flyout-link,.nav-link{text-decoration:none;color:rgba(0, 0, 0, 0.8);-webkit-transition:color 200ms;transition:color 200ms;background-color:transparent;border-radius:0;-webkit-box-shadow:none;box-shadow:none;border:0;margin:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:0.5rem}.main-link:hover,.flyout-close-button:hover,.flyout-link:hover,.nav-link:hover,.main-link:focus,.flyout-close-button:focus,.flyout-link:focus,.nav-link:focus{color:black}.main-link>svg,.flyout-close-button>svg,.flyout-link>svg,.nav-link>svg{width:1.4em;height:1.4em;-ms-flex-negative:0;flex-shrink:0}.main-link>span,.flyout-close-button>span,.flyout-link>span,.nav-link>span{-ms-flex-negative:1;flex-shrink:1}.box>*:first-child{margin-top:0}.box>*:last-child{margin-bottom:0}.mirrored{-webkit-transform:scaleX(-1);transform:scaleX(-1)}.rotate-270{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.bold{font-weight:700}.light{font-weight:300}.d-flex{display:-ms-flexbox;display:flex}.d-inline-flex{display:-ms-inline-flexbox;display:inline-flex}.align-items-center{-ms-flex-align:center;align-items:center}@media (min-width: 1441px){.wide-container{margin:0 auto;max-width:1440px}}@media (max-width: 599.98px){.container{padding-right:16px;padding-left:16px}}@media (min-width: 600px) and (max-width: 1023.98px){.container{padding-right:32px;padding-left:32px}}@media (min-width: 1024px){.container{padding-right:40px;padding-left:40px}}.visually-hidden{position:absolute;width:1px;height:1px;border:0;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0)}@media (max-width: -0.02px){.hidden-xs{display:none}}@media (max-width: 399.98px){.hidden-sm{display:none}}@media (max-width: 599.98px){.hidden-rg{display:none}}@media (max-width: 779.98px){.hidden-md{display:none}}@media (max-width: 1023.98px){.hidden-lg{display:none}}@media (max-width: 1279.98px){.hidden-xl{display:none}}@media (max-width: 1440.98px){.hidden-xxl{display:none}}:host{--host-window-height:var(--window-height, 100vh);--calculated-header-height:calc(var(--header-height) + 1px);display:block;min-width:0;height:var(--header-height)}:host(.no-animation) *{-webkit-animation:none !important;animation:none !important;-webkit-transition:none !important;transition:none !important}@media (min-width: 1024px){.main-navigation,.main-container,.main-container li,.main-link{height:100%}}.main-navigation{font-size:1.125rem}@media (min-width: 1024px){.main-navigation{font-size:1rem;margin:0 0.75rem}}@media (min-width: 1280px){.main-navigation{font-size:1.125rem}}@media (min-width: 1441px){.main-navigation{font-size:1.25rem}}@media (max-width: 1023.98px){.main-navigation{position:absolute;top:var(--calculated-header-height);left:0;background:white;height:calc(var(--host-window-height) - var(--calculated-header-height));width:100%;margin:0;overflow:hidden scroll;-webkit-overflow-scrolling:touch;-ms-scroll-chaining:none;overscroll-behavior:contain;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between;z-index:-1;visibility:hidden;-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transition:visibility 0.35s, -webkit-transform 0.35s;transition:visibility 0.35s, -webkit-transform 0.35s;transition:transform 0.35s, visibility 0.35s;transition:transform 0.35s, visibility 0.35s, -webkit-transform 0.35s}}@media (max-width: 1023.98px) and (prefers-reduced-motion: reduce){.main-navigation{-webkit-transition:none;transition:none}}@media (max-width: 1023.98px){.main-navigation.open{-webkit-transform:translateY(0);transform:translateY(0);visibility:visible}}.main-container{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:start;justify-content:flex-start}@media (max-width: 1023.98px){.main-container{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:stretch;align-items:stretch;-ms-flex-pack:start;justify-content:flex-start;padding-top:2.5rem;padding-bottom:2.5rem}.main-container>li+li{border-top:1px solid #e6e6e6}}@media (min-width: 1024px){.main-container{padding-right:0;padding-left:0}}.main-container>li{-ms-flex:0 1 auto;flex:0 1 auto;min-width:0}.main-link{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding-right:0.75rem;padding-left:0.75rem;text-align:left;cursor:pointer;width:100%}@media (min-width: 1024px){.main-link svg{display:none}}@media (max-width: 1023.98px){.main-link{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;font-weight:300;padding:0.625rem 0;width:100%;text-align:left}.main-link svg{width:1.5rem;height:1.5rem}}.main-link span{overflow:hidden;text-overflow:ellipsis}.main-link,.flyout-link{position:relative;color:black}.main-link::after,.flyout-link::after{content:"";position:absolute;bottom:-1px;left:0;width:100%;height:4px;background-color:transparent;opacity:0;-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transition:opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);transition:opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);transition:opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);transition:opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.25s cubic-bezier(0.4, 0, 0.2, 1)}@media (prefers-reduced-motion: reduce){.main-link::after,.flyout-link::after{-webkit-transition:none;transition:none}}.main-link:hover::after,.main-link.focus::after,.flyout-link:hover::after,.flyout-link.focus::after{background-color:#cccccc;opacity:1;-webkit-transform:scale(1);transform:scale(1)}.main-link.active,.flyout-link.active{font-weight:700}.main-link.active::after,.flyout-link.active::after{background-color:#fc0;opacity:1;-webkit-transform:scale(1);transform:scale(1)}.flyout{left:0;width:100%;background:white;padding-bottom:3rem;overflow:auto;-ms-scroll-chaining:none;overscroll-behavior:contain;visibility:hidden}@media (min-width: 1024px){.flyout{position:absolute;top:100%;max-height:calc(100vh - var(--header-height) - var(--meta-header-height) - 1px);z-index:-1;-webkit-box-shadow:0 0 1px 0 rgba(0, 0, 0, 0.4);box-shadow:0 0 1px 0 rgba(0, 0, 0, 0.4);-webkit-transform:translateY(-100%);transform:translateY(-100%)}.flyout.open{-webkit-box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.4);box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.4);-webkit-transform:translateY(0);transform:translateY(0)}}@media (max-width: 1023.98px){.flyout{position:fixed;top:0;height:100%;z-index:1;-webkit-transform:translateX(100%);transform:translateX(100%)}.flyout.open{-webkit-transform:translateX(0);transform:translateX(0)}}.flyout.open{visibility:visible}.flyout.animate{-webkit-transition:visibility 0.35s, -webkit-transform 0.35s, -webkit-box-shadow 0.35s;transition:visibility 0.35s, -webkit-transform 0.35s, -webkit-box-shadow 0.35s;transition:transform 0.35s, visibility 0.35s, box-shadow 0.35s;transition:transform 0.35s, visibility 0.35s, box-shadow 0.35s, -webkit-transform 0.35s, -webkit-box-shadow 0.35s}@media (prefers-reduced-motion: reduce){.flyout.animate{-webkit-transition:none;transition:none}}.flyout-nav{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;min-height:3.5rem;-webkit-box-sizing:content-box;box-sizing:content-box}.flyout-row{display:-ms-flexbox;display:flex;gap:1.5rem}@media (max-width: 1023.98px){.flyout-row{display:grid;grid-template-columns:1fr 1fr}}@media (max-width: 599.98px){.flyout-row{grid-template-columns:1fr}}.flyout-column{-ms-flex:1;flex:1;max-width:25%}@media (max-width: 1023.98px){.flyout-column{max-width:none}}.flyout-column h3{margin-top:0}.flyout-back-button{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;font-size:1rem;font-weight:400;cursor:pointer}@media (max-width: 599.98px){.flyout-back-button{padding-right:16px;padding-left:16px}}@media (min-width: 600px) and (max-width: 1023.98px){.flyout-back-button{padding-right:32px;padding-left:32px}}@media (min-width: 1024px){.flyout-back-button{padding-right:40px;padding-left:40px}}.flyout-back-button svg{width:1.5rem;height:1.5rem}@media (min-width: 1024px){.flyout-back-button{display:none}}.flyout-close-button{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-left:auto;padding:0 1.5rem;cursor:pointer}.flyout-close-button svg{width:1.5rem;height:1.5rem}@media (max-width: 1023.98px){.flyout-close-button{display:none}}.flyout-linklist li{border-top:1px solid #e6e6e6}.flyout-linklist:first-child>li{border-top-color:transparent}.flyout-link{display:block;padding:0.75rem 0}.flyout-title{margin:2.5rem 0 1.5rem 0}@media (min-width: 1024px){.flyout-title{display:none}}';var y=t("post_main_navigation",function(){function t(t){e(this,t);this.dropdownToggled=n(this,"dropdownToggled",7);this.flyoutToggled=n(this,"flyoutToggled",7);this.resizeTimer=null;this.mouseLeaveTimer=null;this.mouseEnterTimer=null;this.activeFlyout=undefined;this.mobileMenuOpen=undefined}t.prototype.connectedCallback=function(){var t=this;this.throttledResize=a(300,(function(){return t.handleResize()}));window.addEventListener("resize",this.throttledResize,{passive:true});this.setWindowHeight()};t.prototype.disconnectedCallback=function(){window.removeEventListener("resize",this.throttledResize);l();if(this.mouseEnterTimer!==null)window.clearTimeout(this.mouseEnterTimer);if(this.mouseLeaveTimer!==null)window.clearTimeout(this.mouseLeaveTimer)};t.prototype.handleResize=function(){var t=this;this.host.classList.add("no-animation");if(this.resizeTimer!==null)window.clearTimeout(this.resizeTimer);this.resizeTimer=window.setTimeout((function(){t.host.classList.remove("no-animation")}),300);this.setWindowHeight()};t.prototype.setWindowHeight=function(){var t=this;if(!this.host){return}this.host.style.setProperty("--window-height","".concat(window.innerHeight,"px"));window.setTimeout((function(){t.host.style.setProperty("--window-height","".concat(window.innerHeight,"px"))}),100)};t.prototype.openFlyout=function(t){var i;var e=(i=this.host.shadowRoot)===null||i===void 0?void 0:i.getElementById(t);if(e&&this.activeFlyout!==""){this.addFlyoutAnimation(e)}this.activeFlyout=t;this.flyoutToggled.emit(t);this.setWindowHeight();if(this.mouseLeaveTimer!==null){window.clearTimeout(this.mouseLeaveTimer);this.mouseLeaveTimer=null}};t.prototype.closeFlyout=function(t){var i;if(t===undefined)return;var e=(i=this.host.shadowRoot)===null||i===void 0?void 0:i.getElementById(t);if(e){this.addFlyoutAnimation(e)}this.activeFlyout=null;this.flyoutToggled.emit()};t.prototype.addFlyoutAnimation=function(t){var i=this;if(!f()){t.classList.add("animate");t.addEventListener("transitionend",(function(){return i.removeFlyoutAnimation(t)}),{once:true})}};t.prototype.removeFlyoutAnimation=function(t){t.classList.remove("animate")};t.prototype.isActiveFlyout=function(t){return t===this.activeFlyout};t.prototype.handleMouseEnter=function(t){var i=this;if(this.mouseEnterTimer!==null){window.clearTimeout(this.mouseEnterTimer);this.mouseEnterTimer=null}if(this.mouseLeaveTimer&&this.activeFlyout===t.id){window.clearTimeout(this.mouseLeaveTimer);this.mouseLeaveTimer=null}if(window.innerWidth>=1024&&t.flyout.length>0&&this.activeFlyout!==t.id){this.mouseEnterTimer=window.setTimeout((function(){i.mouseEnterTimer=null;if(t.id!==undefined)i.openFlyout(t.id)}),200)}};t.prototype.handleMouseLeave=function(t){var i=this;if(this.mouseEnterTimer!==null){window.clearTimeout(this.mouseEnterTimer)}if(this.activeFlyout&&this.activeFlyout!==t.id){return}if(window.innerWidth>=1024&&t.flyout.length>0){this.mouseLeaveTimer=window.setTimeout((function(){i.closeFlyout(t.id)}),300)}};t.prototype.handleTouchEnd=function(t,i){if(!this.isActiveFlyout(i.id)&&!i.noFlyout){if(t.cancelable)t.preventDefault();if(i.id)this.openFlyout(i.id)}};t.prototype.handleKeyPress=function(t,i){if(t.key==="Enter"&&!this.isActiveFlyout(i.id)&&!i.noFlyout){t.preventDefault();if(i.id)this.openFlyout(i.id)}};t.prototype.handleClick=function(t,i){if(!this.isActiveFlyout(i.id)&&!i.noFlyout){t.preventDefault();if(i.id)this.openFlyout(i.id)}};t.prototype.setBodyScroll=function(){if(this.mobileMenuOpen){s(this.flyoutElement)}else{u(this.flyoutElement)}};t.prototype.toggleDropdown=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){this.mobileMenuOpen=t===undefined?!this.mobileMenuOpen:t;this.dropdownToggled.emit({open:this.mobileMenuOpen,element:this.host});if(t===false){this.closeFlyout()}this.setBodyScroll();this.setWindowHeight();return[2,this.mobileMenuOpen]}))}))};t.prototype.setFocus=function(){return __awaiter(this,void 0,void 0,(function(){var t,i;return __generator(this,(function(e){i=(t=this.host.shadowRoot)===null||t===void 0?void 0:t.querySelector(".main-link");if(i){i.focus()}return[2]}))}))};t.prototype.setActiveFlyout=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){this.activeFlyout=t;this.flyoutToggled.emit(this.activeFlyout);return[2]}))}))};t.prototype.render=function(){var t=this;var e;if(((e=d.localizedConfig)===null||e===void 0?void 0:e.header)===undefined)return;var n=d.localizedConfig.header;return i(o,null,i(m,null),i("nav",{id:"post-internet-header-main-navigation",class:{"main-navigation":true,open:this.mobileMenuOpen},ref:function(i){return t.flyoutElement=i}},i("h2",{class:"visually-hidden"},n.translations.navMainAriaLabel),i("ul",{class:"main-container container"},n.navMain.map((function(e){return i("li",{key:e.text,onMouseLeave:function(){return t.handleMouseLeave(e)},onMouseEnter:function(){return t.handleMouseEnter(e)}},i(h,{level:e,isOpen:t.isActiveFlyout(e.id),onTouchEnd:function(i){return t.handleTouchEnd(i,e)},onKeyDown:function(i){return t.handleKeyPress(i,e)},onClick:function(i){return t.handleClick(i,e)}}),!e.noFlyout?i("div",{id:e.id,class:{flyout:true,open:t.isActiveFlyout(e.id)}},i("div",{class:"wide-container"},i("div",{class:"flyout-nav"},i("button",{class:"nav-link flyout-back-button",onClick:function(){return t.closeFlyout(e.id)}},i(c,{name:"pi-pointy-arrow-right",classNames:"mirrored"}),i("span",null,n.translations.backButtonText)),i("button",{class:"flyout-close-button",onClick:function(){return t.closeFlyout(e.id)}},i("span",{class:"visually-hidden"},n.translations.mobileNavToggleClose),i(c,{name:"pi-close"}))),i("h2",{class:"flyout-title container"},i("a",{href:e.url,class:"nav-link"},e.text)),i("div",{class:"flyout-row container"},e.flyout.map((function(t){return i("div",{key:t.title,class:"flyout-column"},t.title?i("h3",null,t.title):null,i("ul",{class:"flyout-linklist"},t.linkList.map((function(t){return i("li",{key:t.url},i("a",{class:{"flyout-link":true,active:!!(t===null||t===void 0?void 0:t.isActiveOverride)},href:t.url,target:t.target},t.title))}))))}))))):null)}))),i("slot",null)))};Object.defineProperty(t.prototype,"host",{get:function(){return r(this)},enumerable:false,configurable:true});return t}());y.style=p}}}));
|
|
2
|
+
//# sourceMappingURL=p-c5f85f6e.system.entry.js.map
|
|
File without changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,b as o}from"./p-5032057e.js";export{s as setNonce}from"./p-5032057e.js";const t=()=>{const o=import.meta.url;const t={};if(o!==""){t.resourcesUrl=new URL(".",o).href}return e(t)};t().then((e=>o([["p-
|
|
1
|
+
import{p as e,b as o}from"./p-5032057e.js";export{s as setNonce}from"./p-5032057e.js";const t=()=>{const o=import.meta.url;const t={};if(o!==""){t.resourcesUrl=new URL(".",o).href}return e(t)};t().then((e=>o([["p-33ff32c6",[[1,"swisspost-internet-header",{project:[1],stickyness:[1],language:[1],meta:[4],login:[4],search:[4],skiplinks:[4],configProxy:[1,"config-proxy"],environment:[1],languageSwitchOverrides:[1,"language-switch-overrides"],customConfig:[1,"custom-config"],languageCookieKey:[1,"language-cookie-key"],languageLocalStorageKey:[1,"language-local-storage-key"],activeRoute:[8,"active-route"],osFlyoutOverrides:[1,"os-flyout-overrides"],fullWidth:[4,"full-width"],activeFlyout:[32],activeDropdownElement:[32],getCurrentLanguage:[64]},[[0,"languageChanged","handleLanguageChangeEvent"]]]]],["p-5adcac2a",[[1,"swisspost-internet-breadcrumbs",{customItems:[1,"custom-items"],customBreadcrumbItems:[32],overlayVisible:[32],isConcatenated:[32],dropdownOpen:[32],refsReady:[32]}]]],["p-64cb215a",[[1,"swisspost-internet-footer",{liveSupportEnabled:[32]}]]],["p-77d5e07f",[[1,"post-klp-login-widget",{setFocus:[64]}]]],["p-5b22e42c",[[1,"post-language-switch",{mode:[1],langSwitchOpen:[32],toggleDropdown:[64]}]]],["p-812b69b4",[[1,"post-logo",{showFaviconLogo:[32]}]]],["p-2fd9a085",[[1,"post-main-navigation",{activeFlyout:[32],mobileMenuOpen:[32],toggleDropdown:[64],setFocus:[64],setActiveFlyout:[64]}]]],["p-26879023",[[1,"post-meta-navigation",{orientation:[1],fullWidth:[4,"full-width"]}]]],["p-908c0350",[[1,"post-search",{searchDropdownOpen:[32],coveoSuggestions:[32],placeSuggestions:[32],parcelSuggestion:[32],toggleDropdown:[64],setFocus:[64]}]]],["p-c565414e",[[0,"post-skiplinks"]]]],e)));
|
|
2
2
|
//# sourceMappingURL=swisspost-internet-header.esm.js.map
|
|
@@ -28,7 +28,7 @@ export interface ICustomConfig {
|
|
|
28
28
|
en?: ILocalizedCustomConfig;
|
|
29
29
|
}
|
|
30
30
|
export interface ILocalizedCustomConfig {
|
|
31
|
-
header
|
|
31
|
+
header?: ICustomHeaderConfig;
|
|
32
32
|
footer?: ICustomFooterConfig;
|
|
33
33
|
}
|
|
34
34
|
export type Environment = 'int01' | 'int02' | 'prod';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swisspost/internet-header",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Swiss Post Internet Header",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "loader/index.cjs.js",
|
|
@@ -24,32 +24,32 @@
|
|
|
24
24
|
"@stencil/core": "3.0.0",
|
|
25
25
|
"@stencil/store": "2.0.3",
|
|
26
26
|
"body-scroll-lock": "4.0.0-beta.0",
|
|
27
|
-
"iframe-resizer": "4.3.
|
|
27
|
+
"iframe-resizer": "4.3.3",
|
|
28
28
|
"jquery": "3.6.3",
|
|
29
29
|
"tabbable": "6.0.1",
|
|
30
|
-
"throttle-debounce": "
|
|
30
|
+
"throttle-debounce": "5.0.0",
|
|
31
31
|
"url-polyfill": "1.1.12"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@babel/core": "7.20.12",
|
|
35
35
|
"@stencil/eslint-plugin": "0.4.0",
|
|
36
36
|
"@stencil/sass": "2.0.3",
|
|
37
|
-
"@swisspost/design-system-styles": "5.3.
|
|
37
|
+
"@swisspost/design-system-styles": "5.3.1",
|
|
38
38
|
"@types/iframe-resizer": "3.5.9",
|
|
39
39
|
"@types/jest": "27.5.2",
|
|
40
40
|
"@types/jquery": "3.5.16",
|
|
41
|
-
"@types/node": "18.11.
|
|
42
|
-
"@types/throttle-debounce": "
|
|
41
|
+
"@types/node": "18.11.19",
|
|
42
|
+
"@types/throttle-debounce": "5.0.0",
|
|
43
43
|
"babel-loader": "9.1.2",
|
|
44
44
|
"bootstrap": "5.1",
|
|
45
45
|
"eslint-plugin-react": "^7.32.0",
|
|
46
46
|
"globby": "13.1.3",
|
|
47
47
|
"jest": "27.5.1",
|
|
48
|
-
"rimraf": "
|
|
48
|
+
"rimraf": "4.1.2",
|
|
49
49
|
"rollup-plugin-node-polyfills": "0.2.1",
|
|
50
50
|
"rollup-plugin-scss": "4.0.0",
|
|
51
51
|
"rollup-plugin-visualizer": "5.9.0",
|
|
52
|
-
"sass": "1.
|
|
52
|
+
"sass": "1.58.0",
|
|
53
53
|
"start-server-and-test": "1.15.3",
|
|
54
54
|
"ts-jest": "27.1.5",
|
|
55
55
|
"typescript": "4.8.4"
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Throttle execution of a function. Especially useful for rate limiting
|
|
7
|
-
* execution of handlers on events like resize and scroll.
|
|
8
|
-
*
|
|
9
|
-
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
10
|
-
* @param {boolean} [noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the
|
|
11
|
-
* throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time
|
|
12
|
-
* after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds,
|
|
13
|
-
* the internal counter is reset).
|
|
14
|
-
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
|
|
15
|
-
* to `callback` when the throttled-function is executed.
|
|
16
|
-
* @param {boolean} [debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end),
|
|
17
|
-
* schedule `callback` to execute after `delay` ms.
|
|
18
|
-
*
|
|
19
|
-
* @returns {Function} A new, throttled, function.
|
|
20
|
-
*/
|
|
21
|
-
function throttle (delay, noTrailing, callback, debounceMode) {
|
|
22
|
-
/*
|
|
23
|
-
* After wrapper has stopped being called, this timeout ensures that
|
|
24
|
-
* `callback` is executed at the proper times in `throttle` and `end`
|
|
25
|
-
* debounce modes.
|
|
26
|
-
*/
|
|
27
|
-
var timeoutID;
|
|
28
|
-
var cancelled = false; // Keep track of the last time `callback` was executed.
|
|
29
|
-
|
|
30
|
-
var lastExec = 0; // Function to clear existing timeout
|
|
31
|
-
|
|
32
|
-
function clearExistingTimeout() {
|
|
33
|
-
if (timeoutID) {
|
|
34
|
-
clearTimeout(timeoutID);
|
|
35
|
-
}
|
|
36
|
-
} // Function to cancel next exec
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
function cancel() {
|
|
40
|
-
clearExistingTimeout();
|
|
41
|
-
cancelled = true;
|
|
42
|
-
} // `noTrailing` defaults to falsy.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if (typeof noTrailing !== 'boolean') {
|
|
46
|
-
debounceMode = callback;
|
|
47
|
-
callback = noTrailing;
|
|
48
|
-
noTrailing = undefined;
|
|
49
|
-
}
|
|
50
|
-
/*
|
|
51
|
-
* The `wrapper` function encapsulates all of the throttling / debouncing
|
|
52
|
-
* functionality and when executed will limit the rate at which `callback`
|
|
53
|
-
* is executed.
|
|
54
|
-
*/
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
function wrapper() {
|
|
58
|
-
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
59
|
-
arguments_[_key] = arguments[_key];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
var self = this;
|
|
63
|
-
var elapsed = Date.now() - lastExec;
|
|
64
|
-
|
|
65
|
-
if (cancelled) {
|
|
66
|
-
return;
|
|
67
|
-
} // Execute `callback` and update the `lastExec` timestamp.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
function exec() {
|
|
71
|
-
lastExec = Date.now();
|
|
72
|
-
callback.apply(self, arguments_);
|
|
73
|
-
}
|
|
74
|
-
/*
|
|
75
|
-
* If `debounceMode` is true (at begin) this is used to clear the flag
|
|
76
|
-
* to allow future `callback` executions.
|
|
77
|
-
*/
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
function clear() {
|
|
81
|
-
timeoutID = undefined;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (debounceMode && !timeoutID) {
|
|
85
|
-
/*
|
|
86
|
-
* Since `wrapper` is being called for the first time and
|
|
87
|
-
* `debounceMode` is true (at begin), execute `callback`.
|
|
88
|
-
*/
|
|
89
|
-
exec();
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
clearExistingTimeout();
|
|
93
|
-
|
|
94
|
-
if (debounceMode === undefined && elapsed > delay) {
|
|
95
|
-
/*
|
|
96
|
-
* In throttle mode, if `delay` time has been exceeded, execute
|
|
97
|
-
* `callback`.
|
|
98
|
-
*/
|
|
99
|
-
exec();
|
|
100
|
-
} else if (noTrailing !== true) {
|
|
101
|
-
/*
|
|
102
|
-
* In trailing throttle mode, since `delay` time has not been
|
|
103
|
-
* exceeded, schedule `callback` to execute `delay` ms after most
|
|
104
|
-
* recent execution.
|
|
105
|
-
*
|
|
106
|
-
* If `debounceMode` is true (at begin), schedule `clear` to execute
|
|
107
|
-
* after `delay` ms.
|
|
108
|
-
*
|
|
109
|
-
* If `debounceMode` is false (at end), schedule `callback` to
|
|
110
|
-
* execute after `delay` ms.
|
|
111
|
-
*/
|
|
112
|
-
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
wrapper.cancel = cancel; // Return the wrapper function.
|
|
117
|
-
|
|
118
|
-
return wrapper;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/* eslint-disable no-undefined */
|
|
122
|
-
/**
|
|
123
|
-
* Debounce execution of a function. Debouncing, unlike throttling,
|
|
124
|
-
* guarantees that a function is only executed a single time, either at the
|
|
125
|
-
* very beginning of a series of calls, or at the very end.
|
|
126
|
-
*
|
|
127
|
-
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
128
|
-
* @param {boolean} [atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds
|
|
129
|
-
* after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.
|
|
130
|
-
* (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).
|
|
131
|
-
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
|
|
132
|
-
* to `callback` when the debounced-function is executed.
|
|
133
|
-
*
|
|
134
|
-
* @returns {Function} A new, debounced function.
|
|
135
|
-
*/
|
|
136
|
-
|
|
137
|
-
function debounce (delay, atBegin, callback) {
|
|
138
|
-
return callback === undefined ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
exports.debounce = debounce;
|
|
142
|
-
exports.throttle = throttle;
|
|
143
|
-
|
|
144
|
-
//# sourceMappingURL=index-e7245d60.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"index-e7245d60.js","mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE;AAC9D;AACA;AACA;AACA;AACA;AACA,EAAE,IAAI,SAAS,CAAC;AAChB,EAAE,IAAI,SAAS,GAAG,KAAK,CAAC;AACxB;AACA,EAAE,IAAI,QAAQ,GAAG,CAAC,CAAC;AACnB;AACA,EAAE,SAAS,oBAAoB,GAAG;AAClC,IAAI,IAAI,SAA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ACA;AACA,MAAM,IAAI,EAAE,CAAC;AACb,KAAK;AACL;AACA,IAAI,oBAAoB,EAAE,CAAC;AAC3B;AACA,IAAI,IAAI,YAAY,KAAK,SAAS,IAAI,OAAO,GAAG,KAAK,EAAE;AACvD;AACA;AACA;AACA;AACA,MAAM,IAAI,EAAE,CAAC;AACb,KAAK,MAAM,IAAI,UAAU,KAAK,IAAI,EAAE;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,SAAS,GAAG,UAAU,CAAC,YAAY,GAAG,KAAK,GAAG,IAAI,EAAE,YAAY,KAAK,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,KAAK,CAAC,CAAC;AAChH,KAAK;AACL,GAAG;AACH;AACA,EAAE,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;AAC1B;AACA,EAAE,OAAO,OAAO,CAAC;AACjB,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE;AAC7C,EAAE,OAAO,QAAQ,KAAK,SAAS,GAAG,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,KAAK,KAAK,CAAC,CAAC;AACjH;;;;;","names":[],"sources":["../../node_modules/.pnpm/throttle-debounce@3.0.1/node_modules/throttle-debounce/esm/index.js"],"sourcesContent":["/* eslint-disable no-undefined,no-param-reassign,no-shadow */\n\n/**\n * Throttle execution of a function. Especially useful for rate limiting\n * execution of handlers on events like resize and scroll.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n * @param {boolean} [noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the\n * throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time\n * after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds,\n * the internal counter is reset).\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n * to `callback` when the throttled-function is executed.\n * @param {boolean} [debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end),\n * schedule `callback` to execute after `delay` ms.\n *\n * @returns {Function} A new, throttled, function.\n */\nfunction throttle (delay, noTrailing, callback, debounceMode) {\n /*\n * After wrapper has stopped being called, this timeout ensures that\n * `callback` is executed at the proper times in `throttle` and `end`\n * debounce modes.\n */\n var timeoutID;\n var cancelled = false; // Keep track of the last time `callback` was executed.\n\n var lastExec = 0; // Function to clear existing timeout\n\n function clearExistingTimeout() {\n if (timeoutID) {\n clearTimeout(timeoutID);\n }\n } // Function to cancel next exec\n\n\n function cancel() {\n clearExistingTimeout();\n cancelled = true;\n } // `noTrailing` defaults to falsy.\n\n\n if (typeof noTrailing !== 'boolean') {\n debounceMode = callback;\n callback = noTrailing;\n noTrailing = undefined;\n }\n /*\n * The `wrapper` function encapsulates all of the throttling / debouncing\n * functionality and when executed will limit the rate at which `callback`\n * is executed.\n */\n\n\n function wrapper() {\n for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {\n arguments_[_key] = arguments[_key];\n }\n\n var self = this;\n var elapsed = Date.now() - lastExec;\n\n if (cancelled) {\n return;\n } // Execute `callback` and update the `lastExec` timestamp.\n\n\n function exec() {\n lastExec = Date.now();\n callback.apply(self, arguments_);\n }\n /*\n * If `debounceMode` is true (at begin) this is used to clear the flag\n * to allow future `callback` executions.\n */\n\n\n function clear() {\n timeoutID = undefined;\n }\n\n if (debounceMode && !timeoutID) {\n /*\n * Since `wrapper` is being called for the first time and\n * `debounceMode` is true (at begin), execute `callback`.\n */\n exec();\n }\n\n clearExistingTimeout();\n\n if (debounceMode === undefined && elapsed > delay) {\n /*\n * In throttle mode, if `delay` time has been exceeded, execute\n * `callback`.\n */\n exec();\n } else if (noTrailing !== true) {\n /*\n * In trailing throttle mode, since `delay` time has not been\n * exceeded, schedule `callback` to execute `delay` ms after most\n * recent execution.\n *\n * If `debounceMode` is true (at begin), schedule `clear` to execute\n * after `delay` ms.\n *\n * If `debounceMode` is false (at end), schedule `callback` to\n * execute after `delay` ms.\n */\n timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);\n }\n }\n\n wrapper.cancel = cancel; // Return the wrapper function.\n\n return wrapper;\n}\n\n/* eslint-disable no-undefined */\n/**\n * Debounce execution of a function. Debouncing, unlike throttling,\n * guarantees that a function is only executed a single time, either at the\n * very beginning of a series of calls, or at the very end.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n * @param {boolean} [atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds\n * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.\n * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n * to `callback` when the debounced-function is executed.\n *\n * @returns {Function} A new, debounced function.\n */\n\nfunction debounce (delay, atBegin, callback) {\n return callback === undefined ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false);\n}\n\nexport { debounce, throttle };\n//# sourceMappingURL=index.js.map\n"],"version":3}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"language.service-7dbf739d.js","mappings":";;;;AAAO,MAAM,YAAY,GAAG;EAC1B,eAAe,EAAE;IACf,EAAE,EAAE,oBAAoB;IACxB,EAAE,EAAE,yBAAyB;IAC7B,EAAE,EAAE,wBAAwB;GAC7B;EACD,6BAA6B,EAAE;IAC7B,EAAE,EAAE,kCAAkC;IACtC,EAAE,EAAE,oCAAoC;IACxC,EAAE,EAAE,iCAAiC;GACtC;EACD,iBAAiB,EAAE;IACjB,EA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AAC,KAAK,CAAC,EAAE,CAAC;AAC9E,CAAC,CAAC;AAEF,MAAM,+BAA+B,GAAG,CAAC,kBAA4B;;EAEnE,IAAI,SAAS,CAAC,QAAQ,EAAE;IACtB,MAAM,IAAI,GAAG,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACjD,IAAI,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;MAC3C,OAAO,IAAI,CAAC;KACb;GACF;;EAGD,IAAI,SAAS,CAAC,SAAS,EAAE;IACvB,KAAK,MAAM,CAAC,IAAI,SAAS,CAAC,SAAS,EAAE;MACnC,MAAM,IAAI,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;MAChC,IAAI,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;QAC3C,OAAO,IAAI,CAAC;OACb;KACF;GACF;EAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,QAAgB,KAAa,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AAE7F;;;;;;;;MAQa,SAAS,GAAG,CAAC,GAAW,EAAE,IAAa,EAAE,iBAAiB,GAAG,YAAY,uBACpF,OAAA,MAAA,MAAA,iBAAiB,CAAC,GAAG,CAAC,0CAAG,MAAA,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAIA,WAAK,CAAC,eAAe,mCAAI,EAAE,CAAC,mCAAI,GAAG,CAAA;;;;;;","names":["state"],"sources":["./src/assets/i18n/translations.ts","./src/services/language.service.ts"],"sourcesContent":["export const translations = {\n 'Close overlay': {\n de: 'Overlay Schliessen',\n fr: 'Fermer la superposition',\n it: 'Chiudi sovrapposizione',\n },\n 'Current language is English': {\n de: 'Die aktuelle Sprache ist Deutsch',\n fr: 'La langue actuelle est le français',\n it: \"La lingua corrente è l'italiano\",\n },\n 'Change language': {\n de: 'Sprache wechseln',\n fr: 'Changer de langue',\n it: 'Cambia lingua',\n },\n 'Go to main content': {\n de: 'Zum Hauptinhalt springen',\n fr: 'Aller au contenu principal',\n it: 'Vai al contenuto principale',\n },\n 'Go to search': {\n de: 'Zur Suche springen',\n fr: 'Aller à la recherche',\n it: 'Vai alla ricerca',\n },\n 'Go to login': {\n de: 'Zum Login springen',\n fr: 'Aller au login',\n it: 'Vai al login',\n },\n 'Open menu': {\n de: 'Menü öffnen',\n fr: 'Ouvrir le menu',\n it: 'Apri il menu',\n },\n};\n","import { translations } from '../assets/i18n/translations';\nimport { state } from '../data/store';\n\nexport const getUserLang = (\n supportedLanguages: string[],\n implementorPreferredLanguage?: string,\n localStorageKey?: string,\n cookieKey?: string,\n) => {\n // If there are no supported languages, well...\n if (supportedLanguages.length === 0) {\n return undefined;\n }\n\n // If there is only one language in the config, use this\n if (supportedLanguages.length === 1) {\n return supportedLanguages[0];\n }\n\n const url = new URL(window.location.href);\n\n /**\n * Build array of possible language definitions in order of importance.\n * At the end is a filter function that will weed out any undefined or null entries.\n */\n let languagesSet: Array<string> = [\n // Check if implementor overrides lang config\n implementorPreferredLanguage,\n\n // Check query string param\n url.searchParams.get('lang'),\n\n // Check url pathname\n url.pathname.split('/').find(segment => supportedLanguages.includes(segment)),\n\n // Check local storage with the key provided\n localStorageKey !== undefined ? window.localStorage.getItem(localStorageKey) : null,\n\n // Check cookies\n getCookie('language'),\n getCookie('lang'),\n cookieKey !== undefined ? getCookie(cookieKey) : null,\n\n // Check document language\n document.documentElement.lang,\n\n // Check browser preferred language\n getPreferredLanguageFromBrowser(supportedLanguages),\n\n // Check the state\n state.currentLanguage,\n ].filter((lang): lang is string => !!lang);\n\n // Check the set of languages to see if it matches\n // any of the supported languages. Return the first\n // supported language if there is none set\n const lang =\n languagesSet.find(language => supportedLanguages.includes(language)) || supportedLanguages[0];\n\n if (!lang || lang.length !== 2) {\n throw new Error(\n `Current language could not be determined from settings or the language provided (${lang}) is not supported by the Header API.`,\n );\n }\n\n return lang;\n};\n\n/**\n * Persist chosen language to local storage\n * @param lang Currently chose language, two char string\n */\nexport const persistLanguageChoice = (\n lang: string,\n cookieKey?: string,\n localStorageKey?: string,\n) => {\n if (localStorageKey !== undefined) {\n window.localStorage.setItem(localStorageKey, lang);\n }\n\n if (cookieKey !== undefined) {\n setCookie(cookieKey, lang);\n }\n\n state.currentLanguage = lang;\n};\n\n/**\n * Read a cookie by name\n * https://stackoverflow.com/questions/5639346/what-is-the-shortest-function-for-reading-a-cookie-by-name-in-javascript?rq=1\n * @param name Cookie name\n * @returns Cookie value or an empty string\n */\nexport const getCookie = (name: string) => {\n return document.cookie.match('(^|;)\\\\s*' + name + '\\\\s*=\\\\s*([^;]+)')?.pop() || '';\n};\n\n/**\n * Write a new cookie\n * https://developer.mozilla.org/en-US/docs/Web/API/document/cookie#A_little_framework.3A_a_complete_cookies_reader.2Fwriter_with_full_unicode_support\n * @param key\n * @param value\n */\nexport const setCookie = (key: string, value: string) => {\n document.cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;\n};\n\nconst getPreferredLanguageFromBrowser = (supportedLanguages: string[]): string | null => {\n // IE & Chrome\n if (navigator.language) {\n const lang = extractLanguage(navigator.language);\n if (supportedLanguages.indexOf(lang) !== -1) {\n return lang;\n }\n }\n\n // Chrome supports a list of preferred languages: if the preferred is not supported, we go down the list.\n if (navigator.languages) {\n for (const l of navigator.languages) {\n const lang = extractLanguage(l);\n if (supportedLanguages.indexOf(lang) !== -1) {\n return lang;\n }\n }\n }\n\n return null;\n};\n\nconst extractLanguage = (language: string): string => language.substring(0, 2).toLowerCase();\n\n/**\n * Simple translate function for general header UI strings\n *\n * @param key Translation key\n * @param lang Force a language\n * @param translationObject Optionally provide translations\n * @returns Translated string or the key\n */\nexport const translate = (key: string, lang?: string, translationObject = translations) =>\n translationObject[key]?.[lang ?? state.currentLanguage ?? ''] ?? key;\n"],"version":3}
|