Something went wrong. Try again.
A design system in a box. hip-ui.tngl.io/docs/introduction
Something went wrong. Try again.
1import{i as e}from"./jsx-runtime-D-oznMWL.js";import{t}from"./react-DNjXG-IQ.js";import{J as n}from"./button-B3FtKFjE.js";var r=Symbol.for(`react-aria.i18n.locale`),i=Symbol.for(`react-aria.i18n.strings`),a=void 0,o=class e{getStringForLocale(e,t){let n=this.getStringsForLocale(t)[e];if(!n)throw Error(`Could not find intl message ${e} in ${t} locale`);return n}getStringsForLocale(e){let t=this.strings[e];return t||(t=s(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(t){if(typeof window>`u`)return null;let n=window[r];if(a===void 0){let t=window[i];if(!t)return null;a={};for(let r in t)a[r]=new e({[n]:t[r]},n)}let o=a?.[t];if(!o)throw Error(`Strings for package "${t}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);return o}constructor(e,t=`en-US`){this.strings=Object.fromEntries(Object.entries(e).filter(([,e])=>e)),this.defaultLocale=t}};function s(e,t,n=`en-US`){if(t[e])return t[e];let r=c(e);if(t[r])return t[r];for(let e in t)if(e.startsWith(r+`-`))return t[e];return t[n]}function c(e){return Intl.Locale?new Intl.Locale(e).language:e.split(`-`)[0]}var l=new Map,u=new Map,d=class{format(e,t){let n=this.strings.getStringForLocale(e,this.locale);return typeof n==`function`?n(t,this):n}plural(e,t,n=`cardinal`){let r=t[`=`+e];if(r)return typeof r==`function`?r():r;let i=this.locale+`:`+n,a=l.get(i);return a||(a=new Intl.PluralRules(this.locale,{type:n}),l.set(i,a)),r=t[a.select(e)]||t.other,typeof r==`function`?r():r}number(e){let t=u.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),u.set(this.locale,t)),t.format(e)}select(e,t){let n=e[t]||e.other;return typeof n==`function`?n():n}constructor(e,t){this.locale=e,this.strings=t}},f=e(t(),1),p=new WeakMap;function m(e){let t=p.get(e);return t||(t=new o(e),p.set(e,t)),t}function h(e,t){return t&&o.getGlobalDictionaryForPackage(t)||m(e)}function g(e,t){let{locale:r}=n(),i=h(e,t);return(0,f.useMemo)(()=>new d(r,i),[r,i])}export{o as i,g as n,d as r,h as t};