let n=new Map;class c{format(e){return this.formatter.format(e)}formatToParts(e){return this.formatter.formatToParts(e)}formatRange(e,r){if(typeof this.formatter.formatRange=="function")return this.formatter.formatRange(e,r);if(r<e)throw new RangeError("End date must be >= start date");return`${this.formatter.format(e)} – ${this.formatter.format(r)}`}formatRangeToParts(e,r){if(typeof this.formatter.formatRangeToParts=="function")return this.formatter.formatRangeToParts(e,r);if(r<e)throw new RangeError("End date must be >= start date");let u=this.formatter.formatToParts(e),t=this.formatter.formatToParts(r);return[...u.map(a=>({...a,source:"startRange"})),{type:"literal",value:" – ",source:"shared"},...t.map(a=>({...a,source:"endRange"}))]}resolvedOptions(){let e=this.formatter.resolvedOptions();return m()&&(this.resolvedHourCycle||(this.resolvedHourCycle=d(e.locale,this.options)),e.hourCycle=this.resolvedHourCycle,e.hour12=this.resolvedHourCycle==="h11"||this.resolvedHourCycle==="h12"),e.calendar==="ethiopic-amete-alem"&&(e.calendar="ethioaa"),e}constructor(e,r={}){this.formatter=h(e,r),this.options=r}}const l={true:{ja:"h11"},false:{}};function h(o,e={}){if(typeof e.hour12=="boolean"&&i()){e={...e};let t=l[String(e.hour12)][o.split("-")[0]],a=e.hour12?"h12":"h23";e.hourCycle=t??a,delete e.hour12}let r=o+(e?Object.entries(e).sort((t,a)=>t[0]<a[0]?-1:1).join():"");if(n.has(r))return n.get(r);let u=new Intl.DateTimeFormat(o,e);return n.set(r,u),u}let f=null;function i(){return f==null&&(f=new Intl.DateTimeFormat("en-US",{hour:"numeric",hour12:!1}).format(new Date(2020,2,3,0))==="24"),f}let s=null;function m(){return s==null&&(s=new Intl.DateTimeFormat("fr",{hour:"numeric",hour12:!1}).resolvedOptions().hourCycle==="h12"),s}function d(o,e){if(!e.timeStyle&&!e.hour)return;o=o.replace(/(-u-)?-nu-[a-zA-Z0-9]+/,""),o+=(o.includes("-u-")?"":"-u")+"-nu-latn";let r=h(o,{...e,timeZone:void 0}),u=parseInt(r.formatToParts(new Date(2020,2,3,0)).find(a=>a.type==="hour").value,10),t=parseInt(r.formatToParts(new Date(2020,2,3,23)).find(a=>a.type==="hour").value,10);if(u===0&&t===23)return"h23";if(u===24&&t===23)return"h24";if(u===0&&t===11)return"h11";if(u===12&&t===11)return"h12";throw new Error("Unexpected hour cycle result")}export{c as $};
