1import{r as o,j as e}from"./framer-motion-46115193.js";import{u as _,C as q}from"./index.esm-eef3037b.js";import{u as Q,c as K,g as H}from"./index-19fa935d.js";import{a7 as J,k as X,aM as Y,o as Z,S as w,j as M,T as g,f as m,b5 as ee,W as te,V as ne,b6 as O,z as ae,p as se,aP as oe,aA as re}from"./App-5a95c519.js";import{M as ie}from"./MiniQuill-e86c1f94.js";import{u as le,c as ce}from"./useAutoSave-31c1b462.js";import{L as h,a as ue,b as z}from"./locales-594d83d9.js";import{S as de}from"./SettingsContentContainer-74e670cd.js";import{A as pe,a as xe,b as ge}from"./AccordionSummary-cfe41704.js";import{E as me}from"./ExpandMore-f3eeb7b0.js";import"./index-3ffe96a9.js";import"./index-ca54a7c7.js";import"./isEqual-b20f3d72.js";import"./isObjectLike-fe62a25d.js";import"./_baseClone-0c12cf13.js";import"./_baseIsEqual-ee3c33c1.js";import"./_getTag-55f0d0e0.js";import"./ChevronLeft-dfcf827c.js";import"./Collapse-b4fea431.js";const he=new Set(["ar"]),fe=()=>{var v,y;const i=Q(K),{data:f}=J(i),r=o.useMemo(()=>H(f,"storeSettings"),[f]),{pathname:l}=X(),[R,c]=o.useState(!1),[u,I]=o.useState(null),[$,F]=o.useState(!1),{reset:G,control:P,watch:j}=_({defaultValues:{locale:{...(v=h)==null?void 0:v.en,...r==null?void 0:r.locale},isRtlLanguage:((y=r==null?void 0:r.general)==null?void 0:y.isRtlLanguage)||!1}}),[b,{isLoading:be}]=Y({fixedCacheKey:"shared-update-store"}),{updateStream$:C,pushUpdate:S}=le({delayMs:1e3});o.useEffect(()=>{const t=C.subscribe(a=>{console.log("ð ~ Updates$ ~ Translations",a),b(a)});return()=>{t.unsubscribe()}},[C,b]),o.useEffect(()=>{const t=j(a=>{const n=ce(a),s={"storeSettings.locale":n==null?void 0:n.locale,"storeSettings.general.isRtlLanguage":n==null?void 0:n.isRtlLanguage};S({id:i,body:s})});return()=>t.unsubscribe()},[j,i,S]);const[L,d]=o.useState(null),p=!!L,W=t=>{d(t.currentTarget)},B=()=>{d(null)},D=()=>{if(u){const t=h[u],a=he.has(u);G({locale:t,isRtlLanguage:a}),c(!1)}},N=({key:t})=>{I(t),c(!0),d(null)},U=t=>(a,n)=>{F(n?t:!1)};return e.jsx(Z,{in:l==null?void 0:l.includes("/settings/translations"),children:e.jsxs(de,{children:[e.jsxs(w,{direction:{xs:"column",sm:"row"},justifyContent:"space-between",alignItems:"flex-start",spacing:2,flexWrap:"wrap",children:[e.jsxs(M,{children:[e.jsx(g,{variant:"h5",children:"Translations"}),e.jsx(g,{variant:"body1",color:"text.secondary",children:"Customize your store's language."})]}),e.jsx(m,{id:"demo-customized-button","aria-controls":p?"language-menu":void 0,"aria-haspopup":"true","aria-expanded":p?"true":void 0,onClick:W,variant:"contained",color:"primary",endIcon:e.jsx(ee,{}),children:"Choose language"}),e.jsx(te,{id:"language-menu",anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},PaperProps:{sx:{width:"150px",maxWidth:"100%",boxShadow:1}},anchorEl:L,open:p,onClose:B,children:ue.map((t,a)=>e.jsx(ne,{onClick:()=>N(t),disableRipple:!0,children:e.jsx("span",{children:t.label})},a))})]}),e.jsx(je,{}),e.jsx(M,{children:Object.keys(z).map((t,a)=>{const n=z[t];return e.jsxs(pe,{disableGutters:!0,elevation:0,expanded:$===n.id,onChange:U(n.id),TransitionProps:{unmountOnExit:!0},children:[e.jsx(xe,{expandIcon:e.jsx(me,{}),"aria-controls":"panel1a-content",id:"panel1a-header",sx:{px:0},children:e.jsx(g,{variant:"subtitle1",children:n.label})}),e.jsx(ge,{sx:{px:0},children:e.jsx(O,{container:!0,spacing:2.5,mt:"-10px",children:n.children.map(({name:s,label:A,xs:V,richText:E})=>e.jsx(O,{item:!0,xs:12,sm:V||6,className:`${s}-container`,children:e.jsxs(w,{position:"relative",children:[E&&e.jsx(ae,{variant:"body1",color:"text.secondary",sx:{transform:"translate(10px, -10px) scale(0.8)",transformOrigin:"top left",position:"absolute",fontSize:"1rem",background:"#fff",maxWidth:"calc(133% - 32px)",px:"4px"},children:A}),e.jsx(q,{render:({field:x})=>E?e.jsx(ie,{bounds:`.${s}-container`,className:"mini-quill text-field-quill",modules:{toolbar:{container:[["bold","italic","underline"],["link"]]}},...x,onChange:k=>{let T="";k!=="<p><br></p>"&&(T=k),x.onChange(T)}}):e.jsx(se,{fullWidth:!0,variant:"outlined",size:"small",label:A,...x,sx:{"& .MuiInputLabel-root":{fontSize:"1rem"}}}),name:`locale.${s}`,defaultValue:h.en[s],control:P})]})},s))})})]},n.id)})}
1),e.jsx(oe,{title:"Change language",content:"This will overwrite your existing translation. Proceed?",open:R,actions:e.jsxs(e.Fragment,{children:[e.jsx(m,{onClick:()=>c(!1),color:"inherit",variant:"outlined",children:"Cancel"}),e.jsx(m,{onClick:D,variant:"contained",children:"Ok"})]})})]})})},je=()=>e.jsxs(re,{severity:"info",sx:{mt:2,mb:4},children:["Translation of ",e.jsx("b",{children:"sheet content"})," and ",e.jsx("b",{children:"checkout fields"})," have to be done separately."]}),We=fe;export{We as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.