"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6088],{12976:(e,t,n)=>{n.d(t,{k:()=>l});var a=n(20063),r=n(12115),o=n(22919),i=n(20973),s=n(86181);function l(e="storefront"){let t=(0,o.K)(),n=(0,a.useParams)(),c="string"==typeof n?.lang?n.lang:s.q,u=(0,r.useCallback)((e,n,a)=>{let r;if(!t){let t=n||e;return a&&Object.entries(a).forEach(([e,n])=>{t=t.replace(RegExp(`{{${e}}}|{${e}}`,"g"),String(n))}),(0,i.X)(e,t),t}let o=e.split(".").reduce((e,t)=>e&&"object"==typeof e?e[t]:void 0,t);return r="string"==typeof o?o:n||e,a&&Object.entries(a).forEach(([e,t])=>{r=r.replace(RegExp(`{{${e}}}|{${e}}`,"g"),String(t))}),(0,i.X)(e,r),r},[t]);return(0,r.useMemo)(()=>({t:u,lang:c}),[u,c])}},20973:(e,t,n)=>{n.d(t,{S:()=>l,X:()=>s});var a=n(12115);let r=!1;window.__KOMERO_BROWSE_MODE__=!1;let o=window.self!==window.top,i=new Map;function s(e,t){o&&t&&e&&i.set(t.trim(),e)}function l({isBrowseMode:e=!1}){return(0,a.useEffect)(()=>{window.__KOMERO_BROWSE_MODE__=e},[e]),(0,a.useEffect)(()=>{if(!o)return;let e="translation-inspect-styles";if(!document.getElementById(e)){let t=document.createElement("style");t.id=e,t.innerHTML=` .translation-inspect-hover { outline: 2px dashed #3b82f6 !important; outline-offset: 2px !important; cursor: cell !important; background-color: rgba(59, 130, 246, 0.1) !important; transition: outline 0.1s ease-in-out, background-color 0.1s ease-in-out !important; z-index: 999999 !important; } .translation-selector-mode body { cursor: crosshair !important; } `,document.head.appendChild(t)}let t=null,n=e=>{let t=e,n=null,a=0;for(;t&&a<4;){let e=t.textContent?.trim();if(e&&i.has(e)){n=i.get(e)||null;break}if(!n&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.placeholder&&i.has(t.placeholder.trim())?n=i.get(t.placeholder.trim())||null:t.value&&i.has(t.value.trim())&&(n=i.get(t.value.trim())||null)),!n&&e&&e.length<150){for(let[t,a]of Array.from(i.entries()))if(t.length>3&&e.includes(t)){n=a;break}}if(n)break;t=t.parentElement,a++}return{key:n,el:n?t:null}},a=e=>{if(e.data?.type==="ENABLE_TRANSLATION_INSPECT")r=!0,document.body.classList.add("translation-selector-mode");else if(e.data?.type==="DISABLE_TRANSLATION_INSPECT")r=!1,document.body.classList.remove("translation-selector-mode"),t&&(t.classList.remove("translation-inspect-hover"),t=null);else if(e.data?.type==="SET_BROWSE_MODE"){let n=!!e.data.enabled;window.__KOMERO_BROWSE_MODE__=n,n?(r=!1,document.body.classList.remove("translation-selector-mode"),t&&(t.classList.remove("translation-inspect-hover"),t=null)):r&&document.body.classList.add("translation-selector-mode")}else if(e.data?.type==="SET_INSPECT_MODE"){r=!!e.data.enabled;let n=window.__KOMERO_BROWSE_MODE__;r&&!n?document.body.classList.add("translation-selector-mode"):document.body.classList.remove("translation-selector-mode"),!r&&t&&(t.classList.remove("translation-inspect-hover"),t=null)}},s=e=>{let a=window.__KOMERO_BROWSE_MODE__;if(!r||a)return void e.target.classList.remove("translation-inspect-hover");t&&(t.classList.remove("translation-inspect-hover"),t=null);let{key:o,el:i}=n(e.target);o&&i&&(i.classList.add("translation-inspect-hover"),t=i)},l=e=>{let n=window.__KOMERO_BROWSE_MODE__;r&&!n&&t&&(t.classList.remove("translation-inspect-hover"),t=null)},c=e=>{let t=window.__KOMERO_BROWSE_MODE__;if(!r||t||e.altKey||e.ctrlKey||e.metaKey)return;let{key:a}=n(e.target);a&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),window.parent.postMessage({type:"TRANSLATION_KEY_CLICKED",key:a},"*"))};return window.addEventListener("message",a),document.addEventListener("click",c,{capture:!0}),document.addEventListener("mouseover",s,{capture:!0}),document.addEventListener("mouseout",l,{capture:!0}),()=>{window.removeEventListener("message",a),document.removeEventListener("click",c,{capture:!0}),document.removeEventListener("mouseover",s,{capture:!0}),document.removeEventListener("mouseout",l,{capture:!0})}},[]),null}},22919:(e,t,n)=>{n.d(t,{DictionaryProvider:()=>s,K:()=>i});var a=n(95155),r=n(12115);let o=(0,r.createContext)(null);function i(){let e=(0,r.useContext)(o);if(null===e)throw Error("useDictionary must be used within a DictionaryProvider");return e}function s({dictionary:e,children:t}){let[n,i]=(0,r.useState)(e);return r.useEffect(()=>{i(e)},[e]),r.useEffect(()=>{if(window.self!==window.top){let e=e=>{e.data?.type==="UPDATE_TRANSLATION_DICTIONARY"&&e.data.dictionary&&i(e.data.dictionary)};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)}},[]),(0,a.jsx)(o.Provider,{value:n,children:t})}},25177:(e,t,n)=>{n.d(t,{Hd:()=>l,ZU:()=>s,nr:()=>c});class a extends Error{constructor(e="Authentication required"){super(e),this.status=401,this.code="AUTH_REQUIRED",this.name="AuthRequiredError"}}let r=null,o=null,i=null;async function s(){return i||(i=fetch("/api/auth/refresh",{method:"POST",credentials:"same-origin"}).then(async e=>{if(e.ok){let t=(await e.json().catch(()=>({}))).token;return t&&(r=t),{refreshed:!0,token:t}}return{refreshed:!1}}).catch(()=>({refreshed:!1})).finally(()=>{i=null}))}function l(e,t=!1){t?o=e:r=e}async function c(e,t={}){let i=(t.method??"GET").toUpperCase(),l=!0===t.requireAuth||!1!==t.requireAuth&&["POST","PUT","PATCH","DELETE"].includes(i),u=new Headers(t.headers),d=null!=t.body&&"GET"!==i&&"HEAD"!==i,m="undefined"!=typeof FormData&&t.body instanceof FormData;!d||m||u.has("Content-Type")||u.set("Content-Type","application/json");let h=t.token??null;if(l&&!h){let e=!!t.adminAuth,i=e?"/api/auth/token?admin=1":"/api/auth/token";if(!(h=e?o:r))if(1){try{let t=await fetch(i,{credentials:"same-origin",cache:"no-store"});h=t.ok?(await