import{s}from"./chunk-LvLJmgfZ.js";import{t as m}from"./react-Bj1aDYRI.js";import{t as g}from"./SSRProvider-DC7ElCZZ.js";var p=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),v=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function c(e){if(Intl.Locale){let t=new Intl.Locale(e).maximize(),o=typeof t.getTextInfo=="function"?t.getTextInfo():t.textInfo;if(o)return o.direction==="rtl";if(t.script)return p.has(t.script)}let n=e.split("-")[0];return v.has(n)}var r=s(m(),1),h=Symbol.for("react-aria.i18n.locale");function u(){let e=typeof window<"u"&&window[h]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e="en-US"}return{locale:e,direction:c(e)?"rtl":"ltr"}}var l=u(),a=new Set;function f(){l=u();for(let e of a)e(l)}function d(){let e=g(),[n,t]=(0,r.useState)(l);return(0,r.useEffect)(()=>(a.size===0&&window.addEventListener("languagechange",f),a.add(t),()=>{a.delete(t),a.size===0&&window.removeEventListener("languagechange",f)}),[]),e?{locale:"en-US",direction:"ltr"}:n}var i=r.createContext(null);function w(e){let{locale:n,children:t}=e,o=r.useMemo(()=>({locale:n,direction:c(n)?"rtl":"ltr"}),[n]);return r.createElement(i.Provider,{value:o},t)}function S(e){let{children:n}=e,t=d();return r.createElement(i.Provider,{value:t},n)}function b(e){let{locale:n,children:t}=e;return n?r.createElement(w,{locale:n,children:t}):r.createElement(S,{children:t})}function x(){let e=d();return(0,r.useContext)(i)||e}export{b as n,x as t};
