import{u as i,a as l}from"./hooks-1.0.74-NYCTWeI9.js";import{l as n,at as c,S as o,au as u,av as p,aw as r,ax as f,ay as m,C as S}from"./lib-1.0.74-B5IEqfHg.js";import{r as g}from"./redux-1.0.74-D8bIc6ki.js";import{R as q}from"./RestApi-1.0.74-5XKxNzpR.js";import{e as d}from"./utils-1.0.74-7xWhx9mc.js";const A=()=>{const t=i(e=>e.locales.translations);return n.debug("translations",t),t},C=t=>{const e=l();g.useEffect(()=>{if(t===!0)return;c.getSelectors().selectTranslations(o.getState().locales)===void 0&&(u.getSelectors().selectRequests(o.getState().ui).includes("translations")||(e(p({request:"translations"})),n.debug("loading custom translations"),q(S.appUrlLocalizationGet,{},s=>{if(n.debug(s),(s==null?void 0:s.code)==="ok"&&(s==null?void 0:s.data)!==void 0&&s.data!==!1)try{const a=JSON.parse(s.data);e(f({translations:a})),e(m({savedTranslations:a}))}catch{d("Invalid response",{variant:"error"})}finally{e(r({request:"translations"}))}},s=>{console.error(s),e(r({request:"translations"}))})))},[])};export{A as a,C as u};
