index.js
2 lines
| 1 | /*! For license information please see index.js.LICENSE.txt */ |
| 2 | (()=>{"use strict";var e={94931:(e,r,o)=>{var t=o(51609),n=Symbol.for("react.element"),a=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};r.jsx=function(e,r,o){var t,c={},l=null,u=null;for(t in void 0!==o&&(l=""+o),void 0!==r.key&&(l=""+r.key),void 0!==r.ref&&(u=r.ref),r)a.call(r,t)&&!s.hasOwnProperty(t)&&(c[t]=r[t]);if(e&&e.defaultProps)for(t in r=e.defaultProps)void 0===c[t]&&(c[t]=r[t]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:i.current}}},39793:(e,r,o)=>{e.exports=o(94931)},51609:e=>{e.exports=window.React}},r={};function o(t){var n=r[t];if(void 0!==n)return n.exports;var a=r[t]={exports:{}};return e[t](a,a.exports,o),a.exports}o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var t={};o.r(t),o.d(t,{CurrencyContext:()=>h,CurrencyFactory:()=>u,default:()=>P,getCurrencyData:()=>p,getFilteredCurrencyInstance:()=>g,localiseMonetaryValue:()=>m,unformatLocalisedMonetaryValue:()=>y});const n=window.wp.htmlEntities,a=window.wp.i18n,i=window.wc.number,s=window.wp.deprecated;var c=o.n(s),l=o(39793);const u=function(e){let r;function o(e){const r=e.replace(/<!--[\s\S]*?(-->|$)/g,"").replace(/<(script|style)[^>]*>[\s\S]*?(<\/\1>|$)/gi,"").replace(/<\/?[a-z][\s\S]*?(>|$)/gi,"");return r!==e?o(r):r}function t(e){if(e.priceFormat)return o(e.priceFormat.toString());switch(e.symbolPosition){case"left":return"%1$s%2$s";case"right":return"%2$s%1$s";case"left_space":return"%1$s %2$s";case"right_space":return"%2$s %1$s"}return"%1$s%2$s"}function s(e){const o={code:"USD",symbol:"$",symbolPosition:"left",thousandSeparator:",",decimalSeparator:".",precision:2,...e};let a=o.precision;null===a?(console.warn("Currency precision is null"),a=NaN):"string"==typeof a&&(a=parseInt(a,10)),r={code:o.code.toString(),symbol:(0,n.decodeEntities)(o.symbol.toString()),symbolPosition:o.symbolPosition.toString(),decimalSeparator:o.decimalSeparator.toString(),priceFormat:t(o),thousandSeparator:o.thousandSeparator.toString(),precision:a}}function u(e,o=!1){const t=(0,i.numberFormat)(r,e);if(""===t)return t;const{priceFormat:n,symbol:s,code:c}=r;return(0,a.sprintf)(n,o?c:s,t)}return s(e),{getCurrencyConfig:()=>({...r}),getDataForCountry:function(e,r={},o={}){const t=r[e];if(!t)return{};const a=o[t.currency_code];return a?{code:t.currency_code,symbol:(0,n.decodeEntities)(a),symbolPosition:t.currency_pos,thousandSeparator:t.thousand_sep,decimalSeparator:t.decimal_sep,precision:t.num_decimals}:{}},setCurrency:s,formatAmount:u,formatCurrency:function(e){return c()("Currency().formatCurrency",{version:"5.0.0",alternative:"Currency().formatAmount",plugin:"WooCommerce",hint:"`formatAmount` accepts the same arguments as formatCurrency"}),u(e)},getPriceFormat:t,formatDecimal(e){if("number"!=typeof e&&(e=parseFloat(e)),Number.isNaN(e))return 0;const{precision:o}=r;return Math.round(e*Math.pow(10,o))/Math.pow(10,o)},formatDecimalString(e){if("number"!=typeof e&&(e=parseFloat(e)),Number.isNaN(e))return"";const{precision:o}=r;return e.toFixed(o)},render:e=>("number"!=typeof e&&(e=parseFloat(e)),e<0?(0,l.jsx)("span",{className:"is-negative",children:u(e)}):u(e))}};function p(){return c()("getCurrencyData",{version:"3.1.0",alternative:"CurrencyFactory.getDataForCountry",plugin:"WooCommerce Admin",hint:"Pass in the country, locale data, and symbol info to use getDataForCountry"}),{US:{code:"USD",symbol:"$",symbolPosition:"left",thousandSeparator:",",decimalSeparator:".",precision:2},EU:{code:"EUR",symbol:"€",symbolPosition:"left",thousandSeparator:".",decimalSeparator:",",precision:2},IN:{code:"INR",symbol:"₹",symbolPosition:"left",thousandSeparator:",",decimalSeparator:".",precision:2},GB:{code:"GBP",symbol:"£",symbolPosition:"left",thousandSeparator:",",decimalSeparator:".",precision:2},BR:{code:"BRL",symbol:"R$",symbolPosition:"left",thousandSeparator:".",decimalSeparator:",",precision:2},VN:{code:"VND",symbol:"₫",symbolPosition:"right",thousandSeparator:".",decimalSeparator:",",precision:1},ID:{code:"IDR",symbol:"Rp",symbolPosition:"left",thousandSeparator:".",decimalSeparator:",",precision:0},BD:{code:"BDT",symbol:"৳",symbolPosition:"left",thousandSeparator:",",decimalSeparator:".",precision:0},PK:{code:"PKR",symbol:"₨",symbolPosition:"left",thousandSeparator:",",decimalSeparator:".",precision:2},RU:{code:"RUB",symbol:"₽",symbolPosition:"right",thousandSeparator:" ",decimalSeparator:",",precision:2},TR:{code:"TRY",symbol:"₺",symbolPosition:"left",thousandSeparator:".",decimalSeparator:",",precision:2},MX:{code:"MXN",symbol:"$",symbolPosition:"left",thousandSeparator:",",decimalSeparator:".",precision:2},CA:{code:"CAD",symbol:"$",symbolPosition:"left",thousandSeparator:",",decimalSeparator:".",precision:2}}}const d=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),m=(e,r)=>{if("number"==typeof r)return(0,i.numberFormat)(e,r);if("string"==typeof r){const o=d(e.decimalSeparator),t=d(e.thousandSeparator),n=new RegExp(`^\\s*(\\d+|\\d{1,3}(?:${t}\\d{3})*)(?:${o}\\d+)?\\s*$`);return r.replace(n,r=>{const o=(0,i.parseNumber)(e,r);return(0,i.numberFormat)(e,o)})}return r},y=(e,r)=>{if(!r)throw new Error("Input value is undefined");if(Number.isFinite(r))return r;if("string"!=typeof r)throw new Error("Input value is not a number or a numeric string");if(r.includes("[")&&r.includes("]"))throw new Error("Input value contains formula");if(!new RegExp(`^\\s*[0-9${d(e.thousandSeparator)}${d(e.decimalSeparator)}]+\\s*$`).test(r))throw new Error("Input value contains non-numeric characters and is not a formula");if(r.split(e.decimalSeparator).length>2||r.includes(e.thousandSeparator)&&r.includes(e.decimalSeparator)&&r.indexOf(e.decimalSeparator)<=r.indexOf(e.thousandSeparator))throw new Error("Invalid decimal separator");const o=r.replace(new RegExp(d(e.thousandSeparator),"g"),"").replace(e.decimalSeparator,".");return Number(o)},f=window.wp.element,S=window.wp.hooks,b=(0,window.wc.wcSettings.getSetting)("currency"),w=u(b),g=e=>{const r=w.getCurrencyConfig(),o=(0,S.applyFilters)("woocommerce_admin_report_currency",r,e);return u(o)},h=(0,f.createContext)(w),P=u;(window.wc=window.wc||{}).currency=t})(); |