| 1 |
var C=r=>{throw TypeError(r)};var _=(r,t,e)=>t.has(r)||C("Cannot "+e);var A=(r,t,e)=>(_(r,t,"read from private field"),e?e.call(r):t.get(r)),v=(r,t,e)=>t.has(r)?C("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),N=(r,t,e,s)=>(_(r,t,"write to private field"),s?s.call(r,e):t.set(r,e),e),b=(r,t,e)=>(_(r,t,"access private method"),e);import{A as x}from"./Arr.js?ver=1.6.6";import{d as $}from"./dayjs.min.js?ver=1.6.6";import{u as L,t as j}from"./timezone.js?ver=1.6.6";import{a as J,w as P}from"./weekOfYear.js?ver=1.6.6";import{A as d,a as V,t as h}from"./Translator.js?ver=1.6.6";$.extend(L);$.extend(j);$.extend(J);$.extend(P);const F={date:"MMM DD, YYYY",date_short:"MMM DD",time:"h:mm A",date_time:"MMM DD, YYYY h:mm A",month_year:"MMM YYYY",month_long:"MMMM"},W=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],z=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],H=["January","February","March","April","May","June","July","August","September","October","November","December"],K=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function O(r="date_short"){if(!Object.prototype.hasOwnProperty.call(F,r))return r;const t=d.get("datei18")||{};return t.formats_source!=="wordpress"?F[r]:(t.formats||{})[r]||F[r]}function D(r,t){const e=Object.values(r||{});return t.map((s,a)=>e[a]||s)}function T(){const r=d.get("datei18")||{};return{name:"fluent_date_time",weekdays:D(r.weekdays,W),weekdaysShort:D(r.weekdaysShort,z),months:D(r.months,H),monthsShort:D(r.monthsShort,K),meridiem:(t,e,s)=>{const a=r.am||"AM",c=r.pm||"PM",l=t<12?a:c;return s?l.toLowerCase():l}}}const q=/^[+-]\d{2}:\d{2}$/;function R(r){const t=$.utc(r),e=(d.get("datei18")||{}).timezone||{};if(e.source!=="wordpress"||!e.site)return t.local();try{return q.test(e.site)?t.utcOffset(e.site):t.tz(e.site)}catch{return t.local()}}function B(){return R(new Date().toISOString())}function st(r){return(d.get("datei18")||{}).formats_source==="wordpress"?"date":r.year()===B().year()?"date_short":"date"}var g,Y,y,M,G;const o=class o{static setLocale(){var s;const t=d.get("wp_locale","en-US").replace("_","-"),e=d.get("shop",{});N(o,Y,e.decimal_separator||null),N(o,g,t),e.decimal_separator?N(o,g,e.decimal_separator==="comma"?"de-DE":"en-US"):N(o,g,navigator.language||((s=navigator.languages)==null?void 0:s[0])||"en-US")}static formatForOrder(t,e,s=!0,a=!1){let c=null;return typeof e=="string"?c=e||null:e&&e.currency&&(c=e.currency),o.formatNumber(t,s,a,c)}static formatNumber(t,e=!0,s=!1,a=null){var i;if(!t&&s)return"";const{signs:c,sign:l,position:u}=b(i=o,y,M).call(i),f=x.get(c,(a||"").toUpperCase(),l);let n=new Intl.NumberFormat(A(o,g),{minimumFractionDigits:0,maximumFractionDigits:2}).format(t?t/100:0);return n=V(n),e?u==="before"?`${f}${n}`:`${n}${f}`:n}static formatScaled(t,e=!0,s=!1,a=""){var w;if(!t&&s)return"";const{signs:c,sign:l,position:u}=b(w=o,y,M).call(w),f=x.get(c,(a||"").toUpperCase(),l);let n,i="";if(Math.abs(t)>=1e11)t=t/1e9,i="B";else if(Math.abs(t)>=1e8)t=t/1e6,i="M";else if(Math.abs(t)>=1e5)t=t/1e3,i="K";else return o.formatNumber(t,e,s,f);if(n=o.formatNumber(t,!1,s,f),!e)return n;const S=`${n}${i}`;return u==="before"?`${f}${S}`:`${S}${f}`}static formatScaledChart(t,e=""){var i;if(!t)return"0";const{signs:s,sign:a,position:c}=b(i=o,y,M).call(i),l=x.get(s,(e||"").toUpperCase(),a);let u="";Math.abs(t)>=1e11?(t=t/1e9,u="B"):Math.abs(t)>=1e8?(t=t/1e6,u="M"):Math.abs(t)>=1e5&&(t=t/1e3,u="K");const n=`${new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:2}).format(t/100)}${u}`;return c==="before"?`${l}${n}`:`${n}${l}`}static scaled(t,e=!0,s=!1,a=""){return o.formatScaled(t*100,e,s,a)}static scaledChart(t,e=!0,s=!1,a=""){return o.formatScaledChart(t*100,a)}static formatBulk(t,e=!1,s=(c=>b(c=o,y,M).call(c))().sign,a=!1){return t.map(l=>e?o.formatScaled(l,!0,a,s):o.formatNumber(l,!0,a,s))}static get currencySign(){var t;return b(t=o,y,M).call(t).sign}static get currencyPosition(){var t;return b(t=o,y,M).call(t).position}static get locale(){return A(o,g)}static generateVolumeSummary(t,e=!1){if(e){const s=$(),a=s.format("YYYY-MM"),c=s.subtract(1,"month").format("YYYY-MM"),l=s.locale(T()).format(O("month_long")),u=s.subtract(1,"month").locale(T()).format(O("month_long")),f=t[a]||{current:0,yoy_growth:0},n=t[c]||{current:0,yoy_growth:0};n.yoy_growth=Number(n.yoy_growth||0),f.yoy_growth=Number(f.yoy_growth||0);const i=o.formatScaled(n.current),S=o.formatScaled(f.current),w=n.yoy_growth>=0?h("Increase of %s year-over-year",n.yoy_growth.toFixed(1)+"%"):h("Decrease of %s year-over-year",Math.abs(n.yoy_growth).toFixed(1)+"%");return h("%1$s gross volume was %2$s, a %3$s. Gross volume for the month of %4$s so far is %5$s. Here's the trend over the previous 12 months.",`<span class="font-bold">${u}</span>`,`<span class="font-bold fct-custom-tooltip">${i}<span class="fct-custom-tooltip-content">${o.formatNumber(n.current)}</span></span>`,`<span class="font-bold ${n.yoy_growth>=0?"text-green-500":"text-red-500"}">${w} </span>`,l,`<span class="font-bold fct-custom-tooltip">${S}<span class="fct-custom-tooltip-content">${o.formatNumber(f.current)}</span></span>`)}else{const s=$(),a=s.year(),c=Math.floor((s.month()+3)/3);s.locale(T()).format(O("month_long"));const l=c*3-1;let u=$().year(a).month(l).endOf("month");c===1&&(u=u.month(2).endOf("month")),c===2&&(u=u.month(5).endOf("month")),c===3&&(u=u.month(8).endOf("month")),c===4&&(u=u.month(11).endOf("month"));const f=u.diff(s,"day"),n=Object.keys(t)[0],i=Object.values(t)[0],S=o.formatScaled(i.current);i.yy_growth=Number(i.yy_growth||0);const w=i.yy_growth>=0?h("Increase of %s year-over-year",i.yy_growth.toFixed(1)+"%"):h("Decrease of %s year-over-year",Math.abs(i.yy_growth).toFixed(1)+"%");let I=`Q${c}-${a}`;const m=x.get(t,I,{current:0,prev_year:0,yy_growth:0});m.yy_growth=Number(m.yy_growth||0);const U=o.formatScaled(m.current);let p=0;m.current===0&&i.current===0?p=0:m.current===0?p=-100:(p=(m.current-i.current)/m.current*100,isNaN(p)&&(p=0));const k=p>=0?h("a increase of %1$s compared to %2$s",p.toFixed(1)+"%",n):h("a decrease of %1$s compared to %2$s",Math.abs(p).toFixed(1)+"%",n);return h("%1$s gross volume was %2$s, a %3$s. With %4$s days left in %5$s, Gross volume is %6$s for the quarter, %7$s and %8$s year-over-year",`<span class="font-bold">${n}</span>`,`<span class="font-bold fct-custom-tooltip">${S}<span class="fct-custom-tooltip-content">${o.formatNumber(i.current)}</span></span>`,`<span class="font-bold ${i.yy_growth>=0?"text-green-500":"text-red-500"}">${w} </span>`,f,`Q${c}`,`<span class="font-bold fct-custom-tooltip">${U}<span class="fct-custom-tooltip-content">${o.formatNumber(m.current)}</span></span>`,`<span class="font-bold ${p>=0?"text-green-500":"text-red-500"}">${k} </span>`,`<span class="font-bold ${m.yy_growth>=0?"text-green-500":"text-red-500"}">${m.yy_growth}% </span>`)}}};g=new WeakMap,Y=new WeakMap,y=new WeakSet,M=function(){return{signs:d.get("currency_signs",{}),sign:d.get("shop.currency_sign","$"),position:d.get("shop.currency_position","before")}},G=function(t){return t},v(o,y),v(o,g,null),v(o,Y),d.onShopUpdate(()=>o.setLocale());let E=o;E.setLocale();export{E as C,st as a,T as f,O as r,R as t}; |