@nice2dev/ui-money 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,108 @@
1
1
  # @nice2dev/ui-money
2
2
 
3
+ ## 1.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 8c82c30: 1.2.1 — the decisions that waited since 1.2.0, and the debts the CI gates were holding. One API
8
+ change, agreed: `NiceIconSuggestorAI` suggests Nice icons only. Two stylesheets to import if you use
9
+ the packages: `@nice2dev/social/style.css`, `@nice2dev/ui-science/style.css`. Upgrade notes:
10
+ `documentation/omniverk/OMNIVERK_UPGRADE_1.2.1.md`.
11
+
12
+ **Tree-shaking.** An import from a package no longer brings the whole package. Module-level
13
+ statements that may have a side effect — a `displayName` assigned after each component (now
14
+ `Object.assign` inside `/* @__PURE__ */`, or under a development check for plain functions),
15
+ unannotated `forwardRef` / `memo` / `createContext` / icon-factory calls, spreads, registries filled
16
+ at import, `<style>` tags injected at import, a direct `eval` in ui-math — are gone. One import from
17
+ each of 53 packages: 5066.5 kB → 1171.6 kB (`@nice2dev/ui` 1928.2 kB → 12.9 kB, icon packs 48–275 kB
18
+ → 1.6–2.6 kB). `defaultViewRegistry` has the Nice\* input controls from the start, each loading its
19
+ module on first render; sixteen controls add their styles to `<head>` on first render.
20
+
21
+ **Dead code.** 405 source files no entry point imported (never on npm) are deleted;
22
+ `NiceClipboardStack` (`@nice2dev/ui`) and `NiceSampleBrowser` (`@nice2dev/ui-audio`), finished and
23
+ documented, are exported.
24
+
25
+ **ui-mobile draws Nice icons.** New peer `@nice2dev/icons ^1.2.0`; `TabIcons`, `DrawerIcons`,
26
+ `HeaderIcons`, the `NiceSwipeActions` presets and the `NiceInfiniteScroll` states are `Ntd*` icons
27
+ instead of pasted `<svg>`, simple glyphs are CSS marks. `@nice2dev/icons` adds `NtdReply` and
28
+ `NtdInbox`; an icon no longer throws without `window.matchMedia`.
29
+
30
+ **`NiceIconSuggestorAI` (breaking, agreed).** `AIIconLibrary` is `'nice'`; `svgPath` and `unicode`
31
+ left `AISuggestedIcon`; the preview is a `<NiceIcon>`, "Copy SVG" is "Copy JSX".
32
+
33
+ **Peer ranges.** Every internal `@nice2dev/*` peer is `^1.2.0` (was as wide as `^1.0.20`), except
34
+ `@nice2dev/icons ^1.2.1` where a package draws an icon new in 1.2.1: ui-mobile (`NtdReply`,
35
+ `NtdInbox`), ui-audio (`NtdMicrophoneOff`) and ui-security (`NtdBackspace`). ui-security, licensing
36
+ (`^1.2.0`) and templates (`^1.2.0`) gain the `@nice2dev/icons` peer: their glyph icons (`⌫`, `←`,
37
+ `→`, `↑`, `↓`) are Nice icons now. `@nice2dev/icons` adds `NtdBackspace`.
38
+
39
+ **Class names inside components.** 834 class names in library stylesheets had no `nice-` prefix
40
+ (`.tab-button`, `.status-badge`, `.selected`, …) and styled every element of that name on the page.
41
+ They follow `nice-{block}__{element}--{modifier}` now — no change on screen. The class theme hooks
42
+ next to `[data-theme]` on seven controls (`dark` on the AI chart / data grid / code and HTML
43
+ editors / form builder, `light-theme` on `NiceMAM` and `NiceVideoAnnotator`) are `nice-dark` /
44
+ `nice-light`; `NiceLowPowerMode` marks `<html>` with `nice-lpm-no-animations` /
45
+ `nice-lpm-reduced-quality`; the `NiceVideoEditor` of `@nice2dev/ui-video` styles its elements under
46
+ `nice-video-studio`, so they no longer collide with the `NiceVideoEditor` of `@nice2dev/ui`.
47
+ Rules for classes nothing rendered are gone, among them the stylesheet of `NiceGanttChart`, which
48
+ left ui-erp in 1.0.10.
49
+
50
+ **Translations.** About 3,400 UI texts in 32 packages were hard-coded; they go through `t()` now,
51
+ with the English text unchanged and pl / de / fr / es / uk in `@nice2dev/i18n` (ui-diagrams,
52
+ ui-presentations and ui-math in their own dictionaries). In `@nice2dev/events` and
53
+ `@nice2dev/admin` that includes column headers, option labels and the statuses and roles they used
54
+ to print raw (`checked-in`, `no-show`) — English labels for those come from the dictionary. ui-3d and ui-graphics read the app's
55
+ global translator, as ui-audio does since 1.2.0 — their own provider overrides it. ui-audio's
56
+ controls used 631 keys the dictionary did not have (English in every language), and the radio
57
+ player showed raw keys (`search_stations`). Texts that were hard-coded **in Polish** — in
58
+ `NiceSidebarNav`, `NiceNetworkDiscoveryPanel`, the backup and smart-home controls,
59
+ `NiceSavedQueryPanel`, `NiceNotificationPreferences`, the ui-buildings panels, the ui-printing
60
+ template editor and the photo editor — default to English now; Polish is in the dictionary. English
61
+ plurals glued on (`result{s}`) are two keys. `presentationsTranslator(lang)` (ui-presentations)
62
+ translates outside its provider.
63
+
64
+ **List props are optional.** 170 list props (`items`, `columns`, `data`, …) in 15 packages that
65
+ were required without a default are optional, with a stable empty default; every one of those
66
+ controls mounts without data (tested). `NiceStockChart` without data no longer computes NaN
67
+ coordinates.
68
+
69
+ **Unstyled components get stylesheets.** 98 components rendered class names no stylesheet had —
70
+ admin panels, auth forms, events rounds and pickers, the ERP invoice / purchase order / VAT table /
71
+ HR dashboard, the radio player, `NiceInbox`, PWA prompts, `NiceViewRenderer`, shells, smart-home,
72
+ … The fixed layout that sat in inline style objects is in classes now, so an app can override it;
73
+ values that depend on data stay inline. **`@nice2dev/social` and `@nice2dev/ui-science` ship a
74
+ stylesheet — import `@nice2dev/social/style.css` / `@nice2dev/ui-science/style.css`.** ui-science's
75
+ `sideEffects` is `["*.css"]`. Colours, spacing and radii in every stylesheet come from theme tokens
76
+ (visible in dark themes: `NiceRecipe` difficulty badges, transcoder states, warehouse heat map).
77
+
78
+ **Icons only from Nice.** About 130 glyphs (`×`, `→`, `↑`) and 100 pasted `<svg>` used as icons
79
+ are Nice icons; 11 `<svg>` stay as the control's own graphic (logos, spinners, checkbox mark). `NiceIcon`
80
+ gains `pin`, `mic-off`, `log-out`, `chevrons-left`, `chevrons-right`, `zoom-in`, `zoom-out`,
81
+ `navigation`, `refresh-ccw`, `minimize` and `smartphone`; `@nice2dev/icons` gains
82
+ `NtdMicrophoneOff`. The `icon` fields of the module, menu, tab, mode, quick-action, scene and admin
83
+ widget DTOs, notification channels and view toolbar items are rendered through `NiceIcon` — they
84
+ used to be printed as text. `NiceRatings` `thumbs` draws shapes instead of emoji.
85
+
86
+ **Dialogs instead of `window.prompt` / `confirm` / `alert`.** New `useNiceDialogs()` — `prompt`,
87
+ `confirm` and `alert` as promises on `NicePromptDialog` / `NiceConfirmDialog` — and
88
+ `NiceConfirmDialog.showReject`. Seventeen controls asked through the browser's blocking dialogs and
89
+ use the library's now (`NiceFileManager`, `NiceHtmlEditor`, `NiceViewRenderer` action `confirm`, the 3D,
90
+ vector and pixel editors, …). Keys pressed in `NicePromptDialog` / `NiceConfirmDialog` no longer
91
+ reach the page's shortcuts (Escape still closes them), and `NicePromptDialog`'s backdrop covers the
92
+ whole viewport.
93
+
94
+ **Smaller fixes.** `NiceFileManager.items` is optional. `NiceMLStudio` status badges: `draft`,
95
+ `registered`, `archived`, `cancelled` get a neutral colour, deploying / stopped deployments theirs.
96
+ Component docs (`doc.json`) list only props the components have. `NiceMobileTabs`: tabs beyond
97
+ `maxTabs` open from "More" (it only logged). `NiceInventoryManager`: new `onCreatePurchaseOrder`;
98
+ without it the "Create PO" button is gone (it only logged). Keyboard: `NiceNavShell` tabs follow the
99
+ WAI-ARIA tabs pattern, clickable `NiceDeviceTile` / `NiceCardGroup` cards and animated icons with
100
+ `trigger="click"` are focusable. ui-math: `CalculatorService.evaluate` parses instead of running
101
+ `new Function` (`asin`, `sinh`, `ceil`, exponents and `angleUnit` were wrong); `ExpressionParser`
102
+ takes `functions`, `constants`, `ignoreCase` and `strict`, multiplies implicitly (`2x`) and reads `^`
103
+ right to left. `InvoiceLine.vatRate` and `VatRate.rate` are documented as fractions (0.23).
104
+ `AmqpServerBinding` is `Record<string, never>`.
105
+
3
106
  ## 1.2.0
4
107
 
5
108
  ### Minor Changes
@@ -16,7 +16,7 @@ export interface NicePaymentMethod {
16
16
  }
17
17
  export interface NicePaymentMethodSelectorProps extends NiceBaseProps {
18
18
  /** Methods to choose from. */
19
- methods: NicePaymentMethod[];
19
+ methods?: NicePaymentMethod[];
20
20
  /** Selected method id. */
21
21
  value?: string;
22
22
  /** Selection callback. */
@@ -10,7 +10,7 @@ export interface NiceTaxBreakdownLine {
10
10
  }
11
11
  export interface NiceTaxBreakdownProps extends NiceStandardProps {
12
12
  /** Tax lines (one row per VAT rate, optionally grouped). */
13
- lines: NiceTaxBreakdownLine[];
13
+ lines?: NiceTaxBreakdownLine[];
14
14
  /** Locale used for formatting amounts. Default: browser locale. */
15
15
  locale?: string;
16
16
  /**
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var vt=Object.defineProperty;var kt=(t,e,r)=>e in t?vt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var z=(t,e,r)=>kt(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),n=require("react/jsx-runtime"),le=require("@nice2dev/ui-core"),ue=[{code:"USD",numeric:840,symbol:"$",name:"US Dollar",decimals:2,symbolFirst:!0},{code:"EUR",numeric:978,symbol:"€",name:"Euro",decimals:2,symbolFirst:!0},{code:"GBP",numeric:826,symbol:"£",name:"Pound Sterling",decimals:2,symbolFirst:!0},{code:"JPY",numeric:392,symbol:"¥",name:"Japanese Yen",decimals:0,symbolFirst:!0},{code:"CHF",numeric:756,symbol:"Fr",name:"Swiss Franc",decimals:2},{code:"CAD",numeric:124,symbol:"CA$",name:"Canadian Dollar",decimals:2,symbolFirst:!0},{code:"AUD",numeric:36,symbol:"A$",name:"Australian Dollar",decimals:2,symbolFirst:!0},{code:"NZD",numeric:554,symbol:"NZ$",name:"New Zealand Dollar",decimals:2,symbolFirst:!0},{code:"CNY",numeric:156,symbol:"¥",name:"Chinese Yuan Renminbi",decimals:2,symbolFirst:!0},{code:"HKD",numeric:344,symbol:"HK$",name:"Hong Kong Dollar",decimals:2,symbolFirst:!0},{code:"SGD",numeric:702,symbol:"S$",name:"Singapore Dollar",decimals:2,symbolFirst:!0},{code:"PLN",numeric:985,symbol:"zł",name:"Polish Złoty",decimals:2},{code:"CZK",numeric:203,symbol:"Kč",name:"Czech Koruna",decimals:2},{code:"HUF",numeric:348,symbol:"Ft",name:"Hungarian Forint",decimals:2},{code:"RON",numeric:946,symbol:"lei",name:"Romanian Leu",decimals:2},{code:"BGN",numeric:975,symbol:"лв",name:"Bulgarian Lev",decimals:2},{code:"HRK",numeric:191,symbol:"kn",name:"Croatian Kuna",decimals:2},{code:"DKK",numeric:208,symbol:"kr",name:"Danish Krone",decimals:2},{code:"SEK",numeric:752,symbol:"kr",name:"Swedish Krona",decimals:2},{code:"NOK",numeric:578,symbol:"kr",name:"Norwegian Krone",decimals:2},{code:"ISK",numeric:352,symbol:"kr",name:"Icelandic Króna",decimals:0},{code:"RUB",numeric:643,symbol:"₽",name:"Russian Ruble",decimals:2},{code:"UAH",numeric:980,symbol:"₴",name:"Ukrainian Hryvnia",decimals:2},{code:"TRY",numeric:949,symbol:"₺",name:"Turkish Lira",decimals:2,symbolFirst:!0},{code:"MXN",numeric:484,symbol:"Mex$",name:"Mexican Peso",decimals:2,symbolFirst:!0},{code:"BRL",numeric:986,symbol:"R$",name:"Brazilian Real",decimals:2,symbolFirst:!0},{code:"ARS",numeric:32,symbol:"AR$",name:"Argentine Peso",decimals:2,symbolFirst:!0},{code:"CLP",numeric:152,symbol:"CL$",name:"Chilean Peso",decimals:0,symbolFirst:!0},{code:"COP",numeric:170,symbol:"CO$",name:"Colombian Peso",decimals:2,symbolFirst:!0},{code:"PEN",numeric:604,symbol:"S/",name:"Peruvian Sol",decimals:2,symbolFirst:!0},{code:"UYU",numeric:858,symbol:"$U",name:"Uruguayan Peso",decimals:2,symbolFirst:!0},{code:"INR",numeric:356,symbol:"₹",name:"Indian Rupee",decimals:2,symbolFirst:!0},{code:"IDR",numeric:360,symbol:"Rp",name:"Indonesian Rupiah",decimals:2,symbolFirst:!0},{code:"KRW",numeric:410,symbol:"₩",name:"South Korean Won",decimals:0,symbolFirst:!0},{code:"MYR",numeric:458,symbol:"RM",name:"Malaysian Ringgit",decimals:2,symbolFirst:!0},{code:"PHP",numeric:608,symbol:"₱",name:"Philippine Peso",decimals:2,symbolFirst:!0},{code:"THB",numeric:764,symbol:"฿",name:"Thai Baht",decimals:2,symbolFirst:!0},{code:"VND",numeric:704,symbol:"₫",name:"Vietnamese Đồng",decimals:0},{code:"TWD",numeric:901,symbol:"NT$",name:"New Taiwan Dollar",decimals:2,symbolFirst:!0},{code:"PKR",numeric:586,symbol:"₨",name:"Pakistani Rupee",decimals:2},{code:"BDT",numeric:50,symbol:"৳",name:"Bangladeshi Taka",decimals:2},{code:"LKR",numeric:144,symbol:"Rs",name:"Sri Lankan Rupee",decimals:2},{code:"AED",numeric:784,symbol:"د.إ",name:"UAE Dirham",decimals:2},{code:"SAR",numeric:682,symbol:"ر.س",name:"Saudi Riyal",decimals:2},{code:"QAR",numeric:634,symbol:"ر.ق",name:"Qatari Riyal",decimals:2},{code:"KWD",numeric:414,symbol:"د.ك",name:"Kuwaiti Dinar",decimals:3},{code:"BHD",numeric:48,symbol:".د.ب",name:"Bahraini Dinar",decimals:3},{code:"OMR",numeric:512,symbol:"ر.ع",name:"Omani Rial",decimals:3},{code:"JOD",numeric:400,symbol:"د.أ",name:"Jordanian Dinar",decimals:3},{code:"ILS",numeric:376,symbol:"₪",name:"Israeli New Shekel",decimals:2,symbolFirst:!0},{code:"EGP",numeric:818,symbol:"E£",name:"Egyptian Pound",decimals:2,symbolFirst:!0},{code:"ZAR",numeric:710,symbol:"R",name:"South African Rand",decimals:2,symbolFirst:!0},{code:"NGN",numeric:566,symbol:"₦",name:"Nigerian Naira",decimals:2,symbolFirst:!0},{code:"KES",numeric:404,symbol:"KSh",name:"Kenyan Shilling",decimals:2},{code:"GHS",numeric:936,symbol:"₵",name:"Ghanaian Cedi",decimals:2},{code:"MAD",numeric:504,symbol:"د.م.",name:"Moroccan Dirham",decimals:2},{code:"TND",numeric:788,symbol:"د.ت",name:"Tunisian Dinar",decimals:3},{code:"BTC",numeric:0,symbol:"₿",name:"Bitcoin",decimals:8,symbolFirst:!0},{code:"ETH",numeric:0,symbol:"Ξ",name:"Ether",decimals:8,symbolFirst:!0},{code:"USDC",numeric:0,symbol:"USDC",name:"USD Coin",decimals:6},{code:"USDT",numeric:0,symbol:"USDT",name:"Tether",decimals:6}],Fe=new Map(ue.map(t=>[t.code,t]));function X(t){return Fe.get(t.toUpperCase())}function wt(t){Fe.set(t.code.toUpperCase(),t);const e=ue.findIndex(r=>r.code===t.code);e>=0?ue[e]=t:ue.push(t)}function W(t,e){const r=X(e),c=(r==null?void 0:r.decimals)??2,a=Math.pow(10,c);return{amount:(t<0?-1:1)*Math.round(Math.abs(t)*a),currency:e.toUpperCase()}}function we(t){const e=X(t.currency),r=(e==null?void 0:e.decimals)??2;return t.amount/Math.pow(10,r)}function Ct(t,e){return t.currency.toUpperCase()===e.currency.toUpperCase()}function Ce(t,e,r){if(!Ct(t,e))throw new Error(`Cannot ${r} different currencies: ${t.currency} vs ${e.currency}`)}function oe(t,e){return Ce(t,e,"add"),{amount:t.amount+e.amount,currency:t.currency}}function Ke(t,e){return Ce(t,e,"subtract"),{amount:t.amount-e.amount,currency:t.currency}}function _e(t,e){return{amount:(t.amount*e<0?-1:1)*Math.round(Math.abs(t.amount*e)),currency:t.currency}}function jt(t,e){return Ce(t,e,"compare"),t.amount-e.amount}function Mt(t){return t.amount===0}function Pt(t){return t.amount<0}function St(t){return{amount:-t.amount,currency:t.currency}}function ee(t,e={}){const r=X(t.currency),c=e.decimals??(r==null?void 0:r.decimals)??2,a=t.amount/Math.pow(10,c);try{return new Intl.NumberFormat(e.locale,{style:"currency",currency:t.currency,minimumFractionDigits:c,maximumFractionDigits:c,currencyDisplay:e.currencyDisplay??"symbol"}).format(a)}catch{const s=(r==null?void 0:r.symbol)??t.currency,m=a.toFixed(c);return r!=null&&r.symbolFirst?`${s}${m}`:`${m} ${s}`}}function Be(t,e){if(!t)return null;let r=t.replace(/[^\d.,\-]/g,"").trim();if(!r||r==="-")return null;const c=r.startsWith("-");c&&(r=r.slice(1));const a=r.lastIndexOf("."),s=r.lastIndexOf(","),m=Math.max(a,s);let i,l="";m===-1?i=r:(i=r.slice(0,m).replace(/[.,]/g,""),l=r.slice(m+1).replace(/[.,]/g,""));const d=`${i}.${l||"0"}`,y=parseFloat(d);return Number.isFinite(y)?W(c?-y:y,e):null}function ye(t){const e=(t||"").replace(/\D/g,"");return e?/^4/.test(e)?"visa":/^(5[1-5]|2(2[2-9]|[3-6]\d|7[01]|720))/.test(e)?"mastercard":/^3[47]/.test(e)?"amex":/^(6011|65|64[4-9]|622(12[6-9]|1[3-9]\d|[2-8]\d\d|9[01]\d|92[0-5]))/.test(e)?"discover":/^3(0[0-5]|[68])/.test(e)?"diners":/^35(2[89]|[3-8])/.test(e)?"jcb":/^62/.test(e)?"unionpay":/^(50|5[6-9]|6[0-9])/.test(e)?"maestro":/^(2200|2201|2202|2203|2204)/.test(e)?"mir":/^(4011|4312|4389|4514|4576|5041|5066|5067|509|6277|6362|6363|650|6516|6550)/.test(e)?"elo":/^(606282|3841)/.test(e)?"hipercard":"unknown":"unknown"}function je(t){const e=(t||"").replace(/\D/g,"");if(e.length<12||e.length>19)return!1;let r=0,c=!1;for(let a=e.length-1;a>=0;a--){let s=e.charCodeAt(a)-48;c&&(s*=2,s>9&&(s-=9)),r+=s,c=!c}return r%10===0}function Le(t,e){const r=(t||"").replace(/\D/g,""),c=e??ye(r);return c==="amex"?[r.slice(0,4),r.slice(4,10),r.slice(10,15)].filter(Boolean).join(" "):c==="diners"?[r.slice(0,4),r.slice(4,10),r.slice(10,14)].filter(Boolean).join(" "):(r.match(/.{1,4}/g)??[]).join(" ").trim()}function Dt(t,e){const r=(t||"").replace(/\D/g,"");if(r.length<4)return r;const c=r.slice(-4),a="*".repeat(r.length-4)+c,s=e??ye(r);return s==="amex"?[a.slice(0,4),a.slice(4,10),a.slice(10,15)].filter(Boolean).join(" "):s==="diners"?[a.slice(0,4),a.slice(4,10),a.slice(10,14)].filter(Boolean).join(" "):(a.match(/.{1,4}/g)??[]).join(" ").trim()}function Me(t){const e=(t||"").replace(/\D/g,"");if(e.length<3)return null;const r=e.slice(0,2),c=e.length>=4?e.slice(-2):e.slice(2,4),a=parseInt(r,10);return!Number.isFinite(a)||a<1||a>12?null:`${r}/${c}`}function Pe(t,e=new Date){const r=Me(t);if(!r)return!1;const[c,a]=r.split("/"),s=parseInt(c,10),m=2e3+parseInt(a,10);return new Date(m,s,0,23,59,59,999).getTime()>=e.getTime()}function de(t){return t==="amex"?4:3}function ve(t,e={}){var d;const r={},c=ye(t.number),a=je(t.number);a||(r.number="Invalid card number");const s=Pe(t.expiry,e.now);s||(r.expiry="Invalid or expired");const i=(t.cvc||"").replace(/\D/g,"").length===de(c);i||(r.cvc=`CVC must be ${de(c)} digits`);const l=!e.requireHolder||(((d=t.holderName)==null?void 0:d.trim().length)??0)>=2;return l||(r.holderName="Cardholder name required"),{brand:c,numberValid:a,expiryValid:s,cvcValid:i,holderValid:l,isValid:a&&s&&i&&l,errors:r}}class It{constructor(e){z(this,"id","static");this.rates=e}async getRate(e,r){const c=e.toUpperCase(),a=r.toUpperCase();if(c===a)return{base:c,quote:a,rate:1,asOf:new Date().toISOString()};const s=this.rates.find(d=>d.base===c&&d.quote===a);if(s)return s;const m=this.rates.find(d=>d.base===a&&d.quote===c);if(m)return{base:c,quote:a,rate:1/m.rate,asOf:m.asOf};const i=this.rates.find(d=>d.base===c&&d.quote==="USD")??this.rates.find(d=>d.base==="USD"&&d.quote===c),l=this.rates.find(d=>d.base==="USD"&&d.quote===a)??this.rates.find(d=>d.base===a&&d.quote==="USD");if(i&&l){const d=i.base==="USD"?1/i.rate:i.rate,y=l.base==="USD"?l.rate:1/l.rate;return{base:c,quote:a,rate:d*y,asOf:new Date().toISOString()}}throw new Error(`No FX rate for ${c}/${a}`)}}class ge{constructor(e={}){z(this,"cache",new Map);z(this,"fetchImpl");z(this,"ttl");this.fetchImpl=e.fetchImpl??fetch,this.ttl=e.cacheTtl??6e4}cacheKey(e,r){return`${this.id}:${e.toUpperCase()}/${r.toUpperCase()}`}getCached(e,r){const c=this.cacheKey(e,r),a=this.cache.get(c);return a&&a.expires>Date.now()?a.rate:(a&&this.cache.delete(c),null)}setCached(e){this.cache.set(this.cacheKey(e.base,e.quote),{expires:Date.now()+this.ttl,rate:e})}}class ze extends ge{constructor(r={}){super(r);z(this,"id","frankfurter")}async getRate(r,c){const a=r.toUpperCase(),s=c.toUpperCase();if(a===s)return{base:a,quote:s,rate:1,asOf:new Date().toISOString()};const m=this.getCached(a,s);if(m)return m;const i=`https://api.frankfurter.app/latest?from=${a}&to=${s}`,l=await this.fetchImpl(i);if(!l.ok)throw new Error(`Frankfurter HTTP ${l.status}`);const d=await l.json(),y=d.rates[s];if(y==null)throw new Error(`Frankfurter: no rate for ${a}/${s}`);const g={base:a,quote:s,rate:y,asOf:d.date};return this.setCached(g),g}}class He extends ge{constructor(r,c={}){super(c);z(this,"id","openexchangerates");this.appId=r}async getRate(r,c){const a=r.toUpperCase(),s=c.toUpperCase();if(a===s)return{base:a,quote:s,rate:1,asOf:new Date().toISOString()};const m=this.getCached(a,s);if(m)return m;const i=`https://openexchangerates.org/api/latest.json?app_id=${this.appId}`,l=await this.fetchImpl(i);if(!l.ok)throw new Error(`OpenExchangeRates HTTP ${l.status}`);const d=await l.json(),y=d.rates[a],g=d.rates[s];if(y==null||g==null)throw new Error(`OpenExchangeRates: missing rate for ${a} or ${s}`);const h={base:a,quote:s,rate:g/y,asOf:new Date(d.timestamp*1e3).toISOString()};return this.setCached(h),h}}class Ye extends ge{constructor(r={}){super(r);z(this,"id","exchangerate.host")}async getRate(r,c){var h;const a=r.toUpperCase(),s=c.toUpperCase();if(a===s)return{base:a,quote:s,rate:1,asOf:new Date().toISOString()};const m=this.getCached(a,s);if(m)return m;const i=`https://api.exchangerate.host/convert?from=${a}&to=${s}`,l=await this.fetchImpl(i);if(!l.ok)throw new Error(`exchangerate.host HTTP ${l.status}`);const d=await l.json(),y=((h=d.info)==null?void 0:h.rate)??d.result,g={base:a,quote:s,rate:y,asOf:d.date};return this.setCached(g),g}}class Ge extends ge{constructor(r={}){super(r);z(this,"id","nbp");z(this,"table");this.table=r.table??"A"}async getRate(r,c){const a=r.toUpperCase(),s=c.toUpperCase();if(a===s)return{base:a,quote:s,rate:1,asOf:new Date().toISOString()};const m=this.getCached(a,s);if(m)return m;const i=async g=>{var x;if(g==="PLN")return{rate:1,date:new Date().toISOString().slice(0,10)};const h=`https://api.nbp.pl/api/exchangerates/rates/${this.table}/${g}/?format=json`,u=await this.fetchImpl(h);if(!u.ok)return null;const f=(x=(await u.json()).rates)==null?void 0:x[0];return f?{rate:f.mid??f.ask??0,date:f.effectiveDate}:null},l=await i(a),d=await i(s);if(!l||!d||l.rate===0)throw new Error(`NBP: missing rate for ${a} or ${s}`);const y={base:a,quote:s,rate:l.rate/d.rate,asOf:l.date};return this.setCached(y),y}}class Ze extends ze{constructor(){super(...arguments);z(this,"id","ecb")}}class Je extends Ye{constructor(){super(...arguments);z(this,"id","free-forex")}}const Rt=(t={})=>new Ge(t),$t=(t={})=>new Ze(t),At=t=>new He(t.apiKey,t),Ut=(t={})=>new Je(t);async function Ve(t,e,r){const c=e.toUpperCase();if(t.currency.toUpperCase()===c)return t;const a=X(t.currency),s=X(c),m=(a==null?void 0:a.decimals)??2,i=(s==null?void 0:s.decimals)??2,{rate:l}=await r.getRate(t.currency,c),y=t.amount/Math.pow(10,m)*l;return{currency:c,amount:Math.round(y*Math.pow(10,i))}}class Xe{constructor(e={}){z(this,"id");z(this,"name");z(this,"supportedCurrencies");z(this,"minimums");z(this,"counter",0);this.id=e.id??"mock",this.name=e.name??"Mock Processor",this.supportedCurrencies=e.supportedCurrencies??"*"}newId(e){return this.counter+=1,`${e}_${Date.now().toString(36)}_${this.counter}`}async authorize(e){return{id:this.newId("auth"),status:"authorized",processor:this.id,amount:e.amount,raw:{mock:!0,request:e}}}async capture(e,r){return{id:e.replace("auth_","cap_"),status:"captured",processor:this.id,amount:r}}async cancel(e){return{id:e,status:"cancelled",processor:this.id}}async refund(e,r){return{id:e.replace(/^[a-z]+_/,"ref_"),status:"refunded",processor:this.id,amount:r}}}function J(t,e,r,c,a){const s=m=>{const i=c==null?void 0:c[m];return i||(async()=>{throw new Error(`[ui-money] ${e} adapter is not wired. Pass an \`executor.${String(m)}\` implementation that calls the ${e} SDK.`)})};return{id:t,name:e,supportedCurrencies:r,minimums:a,authorize:s("authorize"),capture:s("capture"),cancel:s("cancel"),refund:s("refund")}}function Qe(t){return J("stripe","Stripe","*",t,{USD:50,EUR:50,GBP:30,JPY:50,AUD:50,CAD:50,CHF:50,DKK:250,NOK:300,SEK:300,PLN:200})}function We(t){return J("paypal","PayPal",["USD","EUR","GBP","AUD","CAD","JPY","CHF","NZD","SEK","NOK","DKK","PLN","CZK","HUF","BRL","MXN","HKD","SGD","TWD","THB","PHP","ILS"],t)}function et(t){return J("adyen","Adyen","*",t)}function tt(t){return J("square","Square",["USD","CAD","GBP","AUD","JPY","EUR"],t)}function rt(t){return J("mollie","Mollie","*",t)}function nt(t){return J("braintree","Braintree","*",t)}function at(t){return J("razorpay","Razorpay",["INR","USD","EUR","GBP","AED"],t)}function ct(t){return J("payu","PayU",["PLN","EUR","USD","CZK","HUF","RON","BGN","TRY"],t)}function st(t){return J("przelewy24","Przelewy24",["PLN","EUR"],t)}function it(t={}){return J("tpay","Tpay",["PLN","EUR","USD","GBP"],t)}function ot(t={}){return J("autopay","Autopay",["PLN","EUR","USD","GBP","CZK"],t)}function lt(t={}){const{acquirer:e="native",...r}=t;return J(`blik:${e}`,`BLIK (${e})`,["PLN"],r)}function dt(t){return J("klarna","Klarna",["USD","EUR","GBP","SEK","NOK","DKK","CHF","AUD","CAD","NZD","PLN"],t)}function ut(t){return J("coinbase-commerce","Coinbase Commerce",["BTC","ETH","USDC","USDT","USD","EUR"],t)}const mt={mock:()=>new Xe,stripe:()=>Qe(),paypal:()=>We(),adyen:()=>et(),square:()=>tt(),mollie:()=>rt(),braintree:()=>nt(),razorpay:()=>at(),payu:()=>ct(),przelewy24:()=>st(),tpay:()=>it(),autopay:()=>ot(),blik:()=>lt(),klarna:()=>dt(),"coinbase-commerce":()=>ut()};function Et(t){const e=mt[t];return e?e().supportedCurrencies:"*"}function Tt(t){return`/api/payments/${t}/webhook`}const Ot=[{id:"stripe",name:"Stripe",type:"card",credentials:[{key:"apiKey",label:"Secret API key",secret:!0,required:!0,help:"sk_live_… / sk_test_…"},{key:"publishableKey",label:"Publishable key",required:!0,help:"pk_live_… / pk_test_…"},{key:"webhookSecret",label:"Webhook signing secret",secret:!0,help:"whsec_…"}],supportedMethods:["card","applepay","googlepay","link"],allowedDomains:["api.stripe.com"],hasTestMode:!0},{id:"paypal",name:"PayPal",type:"wallet",credentials:[{key:"clientId",label:"Client ID",required:!0},{key:"clientSecret",label:"Client secret",secret:!0,required:!0},{key:"webhookId",label:"Webhook ID"}],supportedMethods:["paypal","card","paylater"],allowedDomains:["api-m.paypal.com","api-m.sandbox.paypal.com"],hasTestMode:!0},{id:"adyen",name:"Adyen",type:"aggregator",credentials:[{key:"apiKey",label:"API key",secret:!0,required:!0},{key:"merchantAccount",label:"Merchant account",required:!0},{key:"hmacKey",label:"HMAC key (webhooks)",secret:!0},{key:"clientKey",label:"Client key"}],supportedMethods:["card","ideal","bancontact","applepay","googlepay"],allowedDomains:["checkout-test.adyen.com","checkout-live.adyen.com"],hasTestMode:!0},{id:"square",name:"Square",type:"card",credentials:[{key:"accessToken",label:"Access token",secret:!0,required:!0},{key:"applicationId",label:"Application ID",required:!0},{key:"locationId",label:"Location ID",required:!0}],supportedMethods:["card","applepay","googlepay"],allowedDomains:["connect.squareup.com","connect.squareupsandbox.com"],hasTestMode:!0},{id:"mollie",name:"Mollie",type:"aggregator",credentials:[{key:"apiKey",label:"API key",secret:!0,required:!0,help:"live_… / test_…"}],supportedMethods:["card","ideal","bancontact","blik","applepay"],allowedDomains:["api.mollie.com"],hasTestMode:!0},{id:"braintree",name:"Braintree",type:"card",credentials:[{key:"merchantId",label:"Merchant ID",required:!0},{key:"publicKey",label:"Public key",required:!0},{key:"privateKey",label:"Private key",secret:!0,required:!0}],supportedMethods:["card","paypal","applepay","googlepay"],allowedDomains:["api.braintreegateway.com","api.sandbox.braintreegateway.com"],hasTestMode:!0},{id:"razorpay",name:"Razorpay",type:"aggregator",credentials:[{key:"keyId",label:"Key ID",required:!0},{key:"keySecret",label:"Key secret",secret:!0,required:!0},{key:"webhookSecret",label:"Webhook secret",secret:!0}],supportedMethods:["card","upi","netbanking","wallet"],allowedDomains:["api.razorpay.com"],hasTestMode:!0},{id:"payu",name:"PayU",type:"aggregator",credentials:[{key:"posId",label:"POS ID",required:!0},{key:"clientId",label:"OAuth client ID",required:!0},{key:"clientSecret",label:"OAuth client secret",secret:!0,required:!0},{key:"secondKey",label:"Second key (MD5)",secret:!0}],supportedMethods:["card","blik","transfer","googlepay"],allowedDomains:["secure.payu.com","secure.snd.payu.com"],hasTestMode:!0},{id:"przelewy24",name:"Przelewy24",type:"bank",credentials:[{key:"merchantId",label:"Merchant ID",required:!0},{key:"posId",label:"POS ID",required:!0},{key:"crcKey",label:"CRC key",secret:!0,required:!0},{key:"apiKey",label:"API key",secret:!0,required:!0}],supportedMethods:["transfer","blik","card"],allowedDomains:["secure.przelewy24.pl","sandbox.przelewy24.pl"],hasTestMode:!0},{id:"tpay",name:"Tpay",type:"aggregator",credentials:[{key:"merchantId",label:"Merchant ID",required:!0},{key:"apiKey",label:"API key",secret:!0,required:!0},{key:"apiPassword",label:"API password",secret:!0,required:!0}],supportedMethods:["card","blik","transfer","applepay"],allowedDomains:["api.tpay.com","secure.tpay.com"],hasTestMode:!0},{id:"autopay",name:"Autopay",type:"aggregator",credentials:[{key:"serviceId",label:"Service ID",required:!0},{key:"sharedSecret",label:"Shared secret",secret:!0,required:!0}],supportedMethods:["card","blik","transfer"],allowedDomains:["pay.autopay.eu","testpay.autopay.eu"],hasTestMode:!0},{id:"blik",name:"BLIK",type:"bank",credentials:[{key:"acquirer",label:"Acquirer (p24 / tpay / payu / native)",required:!0,help:"Underlying acquirer routing BLIK."}],supportedMethods:["blik"],hasTestMode:!0},{id:"klarna",name:"Klarna",type:"bnpl",credentials:[{key:"username",label:"API username (UID)",required:!0},{key:"password",label:"API password",secret:!0,required:!0},{key:"region",label:"Region (eu / na / oc)",help:"Selects the Klarna API host."}],supportedMethods:["paylater","installments","paynow"],allowedDomains:["api.klarna.com","api.playground.klarna.com"],hasTestMode:!0},{id:"coinbase-commerce",name:"Coinbase Commerce",type:"crypto",credentials:[{key:"apiKey",label:"API key",secret:!0,required:!0},{key:"webhookSharedSecret",label:"Webhook shared secret",secret:!0}],supportedMethods:["crypto"],allowedDomains:["api.commerce.coinbase.com"],hasTestMode:!1},{id:"wallet",name:"In-app Wallet",type:"wallet",currencyKey:"mock",credentials:[{key:"ledgerAccount",label:"Ledger account",required:!0,help:"Account the wallet debits/credits."}],supportedMethods:["wallet"],hasTestMode:!0}],pe=Object.fromEntries(Ot.map(t=>{const{currencyKey:e,...r}=t,c={...r,supportedCurrencies:Et(e??t.id),webhookPath:Tt(t.id)};return[t.id,c]})),pt=Object.values(pe);function qt(t){return pe[t]}function Ft(t,e){const r=o.useMemo(()=>"amount"in t?t:W(t.major,t.currency),[]),[c,a]=o.useState(r),s=o.useCallback(h=>a(u=>W(h,u.currency)),[]),m=o.useCallback(h=>{a(u=>({...u,currency:h.toUpperCase()}))},[]),i=o.useCallback(h=>a(u=>oe(u,h)),[]),l=o.useCallback(h=>a(u=>Ke(u,h)),[]),d=o.useCallback(h=>a(u=>_e(u,h)),[]),y=o.useMemo(()=>ee(c,{locale:e}),[c,e]),g=o.useMemo(()=>we(c),[c]);return{money:c,setMoney:a,setMajor:s,setCurrency:m,add:i,subtract:l,scale:d,formatted:y,major:g}}function xe(t,e,r){const[c,a]=o.useState(null),[s,m]=o.useState(null),[i,l]=o.useState(!1),d=o.useRef(0);return o.useEffect(()=>{if(!t){a(null);return}const y=++d.current;l(!0),m(null),Ve(t,e,r).then(g=>{d.current===y&&a(g)}).catch(g=>{d.current===y&&(m(g instanceof Error?g:new Error(String(g))),a(null))}).finally(()=>{d.current===y&&l(!1)})},[t==null?void 0:t.amount,t==null?void 0:t.currency,e,r]),{converted:c,loading:i,error:s}}function yt(t){const[e,r]=o.useState("idle"),[c,a]=o.useState(null),[s,m]=o.useState(null),i=o.useCallback(()=>{r("idle"),a(null),m(null)},[]),l=o.useCallback(async h=>{r("authorizing"),m(null);try{const u=await t.authorize(h);return a(u),r(u.status),u}catch(u){const b=u instanceof Error?u:new Error(String(u));throw m(b),r("failed"),b}},[t]),d=o.useCallback(async(h,u)=>{const b=h??(c==null?void 0:c.id);if(!b)throw new Error("No authorization id to capture");r("capturing");try{const f=await t.capture(b,u);return a(f),r(f.status),f}catch(f){const x=f instanceof Error?f:new Error(String(f));throw m(x),r("failed"),x}},[t,c==null?void 0:c.id]),y=o.useCallback(async h=>{const u=h??(c==null?void 0:c.id);if(!u)throw new Error("No payment id to cancel");const b=await t.cancel(u);return a(b),r(b.status),b},[t,c==null?void 0:c.id]),g=o.useCallback(async(h,u)=>{const b=h??(c==null?void 0:c.id);if(!b)throw new Error("No payment id to refund");const f=await t.refund(b,u);return a(f),r(f.status),f},[t,c==null?void 0:c.id]);return{status:e,response:c,error:s,authorize:l,capture:d,cancel:y,refund:g,reset:i}}const ke=o.forwardRef(function({value:e,amount:r,currency:c,locale:a,display:s="symbol",highlightNegative:m=!0,zeroPlaceholder:i,convertTo:l,exchangeProvider:d,className:y,style:g,"aria-label":h},u){const b=o.useMemo(()=>{if(e)return e;if(r!=null&&c){const N=X(c),C=(N==null?void 0:N.decimals)??2;return{amount:Math.round(r*Math.pow(10,C)),currency:c.toUpperCase()}}return null},[e,r,c]),f=o.useMemo(()=>b?b.amount===0&&i!=null?i:ee(b,{locale:a,currencyDisplay:s}):"",[b,a,s,i]),{converted:x}=xe(l&&d?b:null,l??"",d);if(!b)return null;const _=b.amount<0,v="nice-money"+(m&&_?" nice-money--negative":"")+(y?` ${y}`:"");return n.jsxs("span",{ref:u,className:v,style:g,"aria-label":h,children:[n.jsx("span",{className:"nice-money__value",children:f}),x&&n.jsxs("span",{className:"nice-money__converted","aria-label":`Converted to ${x.currency}`,children:[" ≈ ",ee(x,{locale:a})]})]})}),Kt=ue.map(t=>t.code).sort(),Se=o.forwardRef(function({value:e,onChange:r,options:c=ue,recents:a=[],searchable:s,showCode:m=!0,showSymbol:i=!0,compact:l=!1,disabled:d,readOnly:y,loading:g,accessMode:h,label:u,helperText:b,error:f,required:x,size:_="md",labelPlacement:v="top",labelWidth:N,controlWidth:C,className:I,style:A,id:P,name:j,title:R,"data-testid":G,"aria-label":O,placeholder:k},q){const E=h==="hidden",Z=d||h==="disabled"||g,te=y||h==="readOnly",F=o.useId(),re=P??`nice-cs-${F}`,[H,$]=o.useState(""),U=s??c.length>8,L=o.useMemo(()=>{if(!H.trim())return c;const M=H.trim().toLowerCase();return c.filter(S=>S.code.toLowerCase().includes(M)||S.name.toLowerCase().includes(M)||S.symbol.toLowerCase().includes(M))},[c,H]),p=o.useMemo(()=>{const M=new Set;return a.map(S=>X(S)).filter(S=>!!S&&!M.has(S.code)&&!!M.add(S.code))},[a]),K=o.useCallback(M=>{const S=M.target.value,ae=X(S);ae&&(r==null||r(S,ae))},[r]),B=M=>{if(l)return`${i?M.symbol+" ":""}${M.code}`;const S=[];return i&&S.push(M.symbol),m&&S.push(M.code),S.push("—",M.name),S.join(" ")},w=`nice-currency-selector nice-currency-selector--${_} nice-currency-selector--label-${v}`+(l?" nice-currency-selector--compact":"")+(f?" nice-currency-selector--error":"")+(Z?" nice-currency-selector--disabled":"")+(I?` ${I}`:""),T=v==="left"&&N!=null?{width:typeof N=="number"?`${N}px`:N,flex:"none"}:void 0,ne=C!=null?{width:typeof C=="number"?`${C}px`:C,flex:"none"}:void 0;return E?null:n.jsxs("div",{ref:q,className:w,style:A,title:R,"data-testid":G,children:[u&&n.jsxs("label",{htmlFor:re,className:"nice-currency-selector__label",style:T,children:[u,x&&n.jsx("span",{className:"nice-currency-selector__required","aria-hidden":!0,children:"*"})]}),n.jsxs("div",{className:"nice-currency-selector__inner",style:ne,children:[U&&n.jsx("input",{type:"search",className:"nice-currency-selector__search",placeholder:"Search currency…",value:H,onChange:M=>$(M.target.value),disabled:Z||te,"aria-label":"Search currency"}),n.jsxs("select",{id:re,name:j,className:"nice-currency-selector__select",value:e??"",onChange:K,disabled:Z||te,required:x,"aria-invalid":!!f,"aria-label":O??(typeof u=="string"?u:"Currency"),children:[!e&&n.jsx("option",{value:"",children:k??"Select currency…"}),p.length>0&&n.jsx("optgroup",{label:"Recent",children:p.map(M=>n.jsx("option",{value:M.code,children:B(M)},`r-${M.code}`))}),n.jsx("optgroup",{label:p.length>0?"All":"",children:L.map(M=>n.jsx("option",{value:M.code,children:B(M)},M.code))})]})]}),(f||b)&&n.jsx("span",{className:f?"nice-currency-selector__error":"nice-currency-selector__helper",children:f??b})]})}),De=o.forwardRef(function({value:e,onChange:r,currency:c,onCurrencyChange:a,currencies:s,hideCurrencySelector:m,min:i,max:l,step:d,locale:y,placeholder:g,label:h,helperText:u,error:b,size:f="md",disabled:x,readOnly:_,required:v,loading:N,accessMode:C,labelPlacement:I="top",errorPlacement:A="bottom",labelWidth:P,controlWidth:j,submitOnEnter:R,onSubmit:G,showFormattedPreview:O=!0,showSteppers:k=!1,className:q,style:E,id:Z,name:te,title:F,"data-testid":re,onBlur:H,onFocus:$,liveGrouping:U,multiplierShortcuts:L=!0,onValidationError:p},K){const B=x||C==="disabled"||N,w=_||C==="readOnly",T=C==="hidden",ne=o.useId(),M=Z??`nice-money-${ne}`,S=((e==null?void 0:e.currency)??c??"USD").toUpperCase(),ae=X(S),V=(ae==null?void 0:ae.decimals)??2,Ie=d??1/Math.pow(10,V),[Ne,he]=o.useState(()=>e?(e.amount/Math.pow(10,V)).toFixed(V):""),[be,Re]=o.useState(!1);o.useEffect(()=>{if(be)return;if(e==null){he("");return}const D=X(e.currency),Y=(D==null?void 0:D.decimals)??2;he((e.amount/Math.pow(10,Y)).toFixed(Y))},[e,be]);const $e=o.useCallback(D=>{let Y=D;if(L){const se=D.trim().match(/^([+-]?\d+(?:[.,]\d+)?)\s*([kKmMbB])$/);if(se){const ie=se[2].toLowerCase()==="k"?1e3:se[2].toLowerCase()==="m"?1e6:1e9,Te=Number(se[1].replace(",","."))*ie;if(!Number.isFinite(Te)){p==null||p(new Error("overflow"));return}Y=String(Te)}}const Q=Be(Y,S);if(!Q){r==null||r(null);return}if(!Number.isSafeInteger(Q.amount)){p==null||p(new Error("overflow: amount exceeds Number.MAX_SAFE_INTEGER"));return}const ce=Q.amount/Math.pow(10,V);if(i!=null&&ce<i){p==null||p(new Error(`min: ${i}`)),r==null||r(W(i,S));return}if(l!=null&&ce>l){p==null||p(new Error(`max: ${l}`)),r==null||r(W(l,S));return}r==null||r(Q)},[S,V,i,l,r,L,p]),bt=o.useCallback(D=>{const Y=D.target.value;he(Y),$e(Y)},[$e]),Ae=o.useCallback(D=>{const Q=(e?e.amount/Math.pow(10,V):0)+D,ce=Math.min(l??1/0,Math.max(i??-1/0,Q));r==null||r(W(ce,S))},[e,V,i,l,S,r]),fe=o.useMemo(()=>{var D,Y;try{const Q=new Intl.NumberFormat(y).formatToParts(12345.6),ce=((D=Q.find(ie=>ie.type==="group"))==null?void 0:D.value)??",",se=((Y=Q.find(ie=>ie.type==="decimal"))==null?void 0:Y.value)??".";return{group:ce,decimal:se}}catch{return{group:",",decimal:"."}}},[y]),Ue=U??!!fe.group,ft=o.useMemo(()=>{if(!Ue||be===!1)return Ne;const D=fe.decimal,Y=fe.group,Q=Ne.replace(new RegExp(`[${Y.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}]`,"g"),""),[ce,se]=Q.split(D);if(!ce)return Q;const ie=ce.replace(/\B(?=(\d{3})+(?!\d))/g,Y);return se!=null?`${ie}${D}${se}`:ie},[Ne,be,Ue,fe]),Ee=o.useMemo(()=>e?ee(e,{locale:y}):"",[e,y]),me=typeof b=="string"?b:void 0,_t=`nice-money-input nice-money-input--${f} nice-money-input--label-${I} nice-money-input--error-${A}`+(me?" nice-money-input--error":"")+(B?" nice-money-input--disabled":"")+(N?" nice-money-input--loading":"")+(q?` ${q}`:""),xt=D=>{R&&D.key==="Enter"&&G&&(D.preventDefault(),G())},gt=I==="left"&&P!=null?{width:typeof P=="number"?`${P}px`:P,flex:"none"}:void 0,Nt=j!=null?{width:typeof j=="number"?`${j}px`:j,flex:"none"}:void 0;return T?null:n.jsxs("div",{ref:K,className:_t,style:E,title:F,"data-testid":re,children:[h&&n.jsxs("label",{htmlFor:M,className:"nice-money-input__label",style:gt,children:[h,v&&n.jsx("span",{className:"nice-money-input__required","aria-hidden":!0,children:"*"})]}),n.jsxs("div",{className:"nice-money-input__row",style:Nt,children:[!m&&n.jsx(Se,{value:S,compact:!0,options:s?s.map(X).filter(D=>!!D):void 0,onChange:D=>a==null?void 0:a(D),disabled:B||w,className:"nice-money-input__currency","aria-label":"Currency"}),m&&n.jsx("span",{className:"nice-money-input__symbol","aria-hidden":!0,children:(ae==null?void 0:ae.symbol)??S}),k&&n.jsx("button",{type:"button",className:"nice-money-input__step nice-money-input__step--down",onClick:()=>Ae(-Ie),disabled:B||w||i!=null&&e!=null&&e.amount/Math.pow(10,V)<=i,"aria-label":"Decrease amount",tabIndex:-1,children:"−"}),n.jsx("input",{id:M,name:te,type:"text",inputMode:"decimal",autoComplete:"transaction-amount",className:"nice-money-input__amount",value:ft,onChange:bt,onKeyDown:xt,onFocus:D=>{Re(!0),$==null||$(D)},onBlur:D=>{Re(!1),e&&he((e.amount/Math.pow(10,V)).toFixed(V)),H==null||H(D)},placeholder:g??`0${V>0?"."+"0".repeat(V):""}`,disabled:B,readOnly:w,required:v,"aria-invalid":!!me,"aria-describedby":me||u?`${M}-help`:void 0}),k&&n.jsx("button",{type:"button",className:"nice-money-input__step nice-money-input__step--up",onClick:()=>Ae(Ie),disabled:B||w||l!=null&&e!=null&&e.amount/Math.pow(10,V)>=l,"aria-label":"Increase amount",tabIndex:-1,children:"+"}),N&&n.jsx("span",{className:"nice-money-input__spinner","aria-hidden":!0,children:n.jsx(le.NiceIcon,{name:"refresh",size:14})})]}),O&&Ee&&n.jsx("span",{className:"nice-money-input__preview","aria-live":"polite",children:Ee}),(me||u)&&n.jsx("span",{id:`${M}-help`,className:me?"nice-money-input__error":"nice-money-input__helper",children:me??u})]})}),Bt={number:"",expiry:"",cvc:""},ht=o.forwardRef(function({value:e=Bt,onChange:r,showHolderName:c=!0,requireHolderName:a,showPostalCode:s=!1,acceptedBrands:m,showBrandIcon:i=!0,size:l="md",disabled:d,readOnly:y,loading:g,accessMode:h,label:u,helperText:b,error:f,required:x,className:_,style:v,id:N,title:C,"data-testid":I},A){const P=h==="hidden",j=d||h==="disabled"||g,R=y||h==="readOnly",G=o.useId(),O=N??`nice-cc-${G}`,[k,q]=o.useState({number:!1,expiry:!1,cvc:!1,holder:!1,postal:!1}),E=o.useMemo(()=>ye(e.number),[e.number]),Z=o.useMemo(()=>ve(e,{requireHolder:a??c}),[e,a,c]),te=!m||m.includes(E)||E==="unknown",F=o.useCallback(w=>{const T={...e,...w},ne=ve(T,{requireHolder:a??c});r==null||r(T,ne)},[e,a,c,r]),re=o.useCallback(w=>{const T=w.target.value.replace(/\D/g,"").slice(0,19);F({number:T})},[F]),H=o.useCallback(w=>{const T=w.target.value.replace(/\D/g,"").slice(0,4);let ne=T;T.length>=3?ne=`${T.slice(0,2)}/${T.slice(2)}`:T.length===2&&(ne=`${T}/`),F({expiry:ne})},[F]),$=o.useCallback(w=>{const T=w.target.value.replace(/\D/g,"").slice(0,de(E));F({cvc:T})},[E,F]),U=o.useMemo(()=>Le(e.number,E),[e.number,E]),L=k.number&&e.number.length>0&&(je(e.number)?te?void 0:"Card brand not accepted":Z.errors.number),p=k.expiry&&e.expiry.length>0&&!Pe(e.expiry)?Z.errors.expiry:void 0,K=k.cvc&&e.cvc.length>0&&e.cvc.length!==de(E)?Z.errors.cvc:void 0,B=`nice-credit-card nice-credit-card--${l}`+(j?" nice-credit-card--disabled":"")+(g?" nice-credit-card--loading":"")+(f?" nice-credit-card--error":"")+(_?` ${_}`:"");return P?null:n.jsxs("div",{ref:A,className:B,style:v,title:C,"data-testid":I,children:[u&&n.jsxs("div",{className:"nice-credit-card__title",children:[u,x&&n.jsx("span",{className:"nice-credit-card__required","aria-hidden":!0,children:"*"})]}),n.jsx("div",{className:"nice-credit-card__row",children:n.jsxs("label",{className:"nice-credit-card__field nice-credit-card__field--number",children:[n.jsx("span",{className:"nice-credit-card__label",children:"Card number"}),n.jsxs("span",{className:"nice-credit-card__input-wrapper",children:[n.jsx("input",{id:`${O}-number`,type:"text",inputMode:"numeric",autoComplete:"cc-number",placeholder:E==="amex"?"3782 822463 10005":"1234 1234 1234 1234",value:U,onChange:re,onBlur:()=>q(w=>({...w,number:!0})),disabled:j,readOnly:R,"aria-invalid":!!L,"aria-describedby":L?`${O}-number-err`:void 0,className:"nice-credit-card__input",maxLength:E==="amex"?17:23}),i&&n.jsx(Lt,{brand:E})]}),L&&n.jsx("span",{id:`${O}-number-err`,className:"nice-credit-card__error",children:L})]})}),n.jsxs("div",{className:"nice-credit-card__row nice-credit-card__row--split",children:[n.jsxs("label",{className:"nice-credit-card__field",children:[n.jsx("span",{className:"nice-credit-card__label",children:"Expiry"}),n.jsx("input",{id:`${O}-expiry`,type:"text",inputMode:"numeric",autoComplete:"cc-exp",placeholder:"MM/YY",value:e.expiry,onChange:H,onBlur:()=>{q(T=>({...T,expiry:!0}));const w=Me(e.expiry);w&&w!==e.expiry&&F({expiry:w})},disabled:j,readOnly:R,"aria-invalid":!!p,"aria-describedby":p?`${O}-expiry-err`:void 0,className:"nice-credit-card__input",maxLength:5}),p&&n.jsx("span",{id:`${O}-expiry-err`,className:"nice-credit-card__error",children:p})]}),n.jsxs("label",{className:"nice-credit-card__field",children:[n.jsx("span",{className:"nice-credit-card__label",children:E==="amex"?"CID":"CVC"}),n.jsx("input",{id:`${O}-cvc`,type:"text",inputMode:"numeric",autoComplete:"cc-csc",placeholder:"•".repeat(de(E)),value:e.cvc,onChange:$,onBlur:()=>q(w=>({...w,cvc:!0})),disabled:j,readOnly:R,"aria-invalid":!!K,"aria-describedby":K?`${O}-cvc-err`:void 0,className:"nice-credit-card__input",maxLength:de(E)}),K&&n.jsx("span",{id:`${O}-cvc-err`,className:"nice-credit-card__error",children:K})]})]}),c&&n.jsx("div",{className:"nice-credit-card__row",children:n.jsxs("label",{className:"nice-credit-card__field",children:[n.jsx("span",{className:"nice-credit-card__label",children:"Cardholder name"}),n.jsx("input",{id:`${O}-holder`,type:"text",autoComplete:"cc-name",placeholder:"Jane Doe",value:e.holderName??"",onChange:w=>F({holderName:w.target.value}),onBlur:()=>q(w=>({...w,holder:!0})),disabled:j,readOnly:R,className:"nice-credit-card__input",maxLength:120})]})}),s&&n.jsx("div",{className:"nice-credit-card__row",children:n.jsxs("label",{className:"nice-credit-card__field",children:[n.jsx("span",{className:"nice-credit-card__label",children:"Postal code"}),n.jsx("input",{id:`${O}-postal`,type:"text",autoComplete:"postal-code",value:e.postalCode??"",onChange:w=>F({postalCode:w.target.value}),onBlur:()=>q(w=>({...w,postal:!0})),disabled:j,readOnly:R,className:"nice-credit-card__input",maxLength:16})]})}),(f||b)&&n.jsx("div",{className:f?"nice-credit-card__form-error":"nice-credit-card__helper",role:f?"alert":void 0,children:f??b})]})}),Oe={visa:"VISA",mastercard:"MasterCard",amex:"AMEX",discover:"Discover",diners:"Diners",jcb:"JCB",unionpay:"UnionPay",maestro:"Maestro",mir:"MIR",elo:"Elo",hipercard:"Hipercard",unknown:""};function Lt({brand:t}){return t==="unknown"?null:n.jsx("span",{className:`nice-credit-card__brand nice-credit-card__brand--${t}`,"aria-label":Oe[t],children:Oe[t]})}const zt=o.forwardRef(function({processor:e,amount:r,editableAmount:c,customer:a,currencies:s,description:m,metadata:i,autoCapture:l=!0,submitLabel:d="Pay",onSuccess:y,onError:g,consents:h,className:u,style:b},f){const[x,_]=o.useState(r),[v,N]=o.useState(r.currency),[C,I]=o.useState({number:"",expiry:"",cvc:""}),[A,P]=o.useState(null),[j,R]=o.useState(!1),[G,O]=o.useState(null),k=yt(e),q=o.useMemo(()=>e.supportedCurrencies==="*"?!0:e.supportedCurrencies.includes(x.currency.toUpperCase()),[e,x.currency]),E=o.useMemo(()=>{var U;const $=(U=e.minimums)==null?void 0:U[x.currency.toUpperCase()];return $==null||x.amount>=$},[e,x]),Z=o.useMemo(()=>{var U;const $=(U=e.minimums)==null?void 0:U[x.currency.toUpperCase()];return $==null?null:{amount:$,currency:x.currency}},[e,x.currency]),te=!!(A!=null&&A.isValid),F=!j&&q&&E&&te,re=o.useCallback(async $=>{if($.preventDefault(),!!F){O(null),R(!0);try{const U={amount:x,card:C,customer:a,description:m,metadata:i,idempotencyKey:Ht()},L=await k.authorize(U);if(l&&L.status==="authorized"){const p=await k.capture(L.id,x);y==null||y(p)}else y==null||y(L)}catch(U){const L=U instanceof Error?U:new Error(String(U));O(L.message),g==null||g(L)}finally{R(!1)}}},[F,x,C,a,m,i,l,k,y,g]),H=X(x.currency);return n.jsxs("form",{ref:f,className:"nice-payment-form"+(u?` ${u}`:""),style:b,onSubmit:re,"aria-busy":j,children:[n.jsx("div",{className:"nice-payment-form__amount",children:c?n.jsx(De,{label:"Amount",value:x,currency:v,currencies:s,onChange:$=>$&&_($),onCurrencyChange:$=>{N($),_(U=>({...U,currency:$}))},disabled:j,required:!0,showFormattedPreview:!0}):n.jsxs("div",{className:"nice-payment-form__total",children:[n.jsx("span",{className:"nice-payment-form__total-label",children:"Total"}),n.jsx(ke,{value:x})]})}),m&&n.jsx("p",{className:"nice-payment-form__description",children:m}),n.jsx("div",{className:"nice-payment-form__card",children:n.jsx(ht,{value:C,onChange:($,U)=>{I($),P(U)},disabled:j})}),!q&&n.jsxs("div",{className:"nice-payment-form__warning",role:"alert",children:[e.name," does not accept ",(H==null?void 0:H.name)??x.currency,"."]}),!E&&Z&&n.jsxs("div",{className:"nice-payment-form__warning",role:"alert",children:["Minimum charge for ",e.name," is ",n.jsx(ke,{value:Z}),"."]}),h&&n.jsx("div",{className:"nice-payment-form__consents",children:h}),G&&n.jsx("div",{className:"nice-payment-form__error",role:"alert",children:G}),n.jsx("button",{type:"submit",className:"nice-payment-form__submit",disabled:!F,"aria-disabled":!F,children:j?"Processing…":d}),n.jsxs("p",{className:"nice-payment-form__processor",children:["Secured by ",n.jsx("strong",{children:e.name})]})]})});function Ht(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`idem_${Date.now().toString(36)}_${Math.random().toString(36).slice(2)}`}const Yt=o.forwardRef(function({price:e,originalPrice:r,period:c,prefix:a,suffix:s,showDiscountBadge:m=!0,size:i="md",locale:l,className:d,style:y},g){const h=r&&r.currency===e.currency&&r.amount>e.amount,u=o.useMemo(()=>!h||!r?null:Math.round((r.amount-e.amount)/r.amount*100),[h,r,e.amount]),b=`nice-price-tag nice-price-tag--${i}`+(d?` ${d}`:"");return n.jsxs("div",{ref:g,className:b,style:y,children:[a&&n.jsx("span",{className:"nice-price-tag__prefix",children:a}),n.jsxs("span",{className:"nice-price-tag__main",children:[n.jsx("span",{className:"nice-price-tag__amount",children:ee(e,{locale:l})}),c&&n.jsx("span",{className:"nice-price-tag__period",children:c})]}),h&&r&&n.jsx("span",{className:"nice-price-tag__original","aria-label":"Original price",children:n.jsx("s",{children:ee(r,{locale:l})})}),h&&m&&u!=null&&u>0&&n.jsxs("span",{className:"nice-price-tag__discount","aria-label":`${u} percent off`,children:["−",u,"%"]}),s&&n.jsx("span",{className:"nice-price-tag__suffix",children:s})]})}),Gt={amount:0,currency:"USD"},Zt=o.forwardRef(function({source:e,defaultSource:r,onSourceChange:c,targetCurrency:a,defaultTargetCurrency:s,onTargetCurrencyChange:m,provider:i,locale:l,showRateLine:d=!0,className:y,style:g},h){const[u,b]=le.useControllableState({value:e,defaultValue:r,fallbackValue:Gt,onChange:c,componentName:"NiceCurrencyConverter"}),[f,x]=le.useControllableState({value:a,defaultValue:s,fallbackValue:u.currency,onChange:m,componentName:"NiceCurrencyConverter"}),{converted:_,loading:v,error:N}=xe(u,f,i),C=o.useMemo(()=>({amount:Math.pow(10,2),currency:u.currency}),[u.currency]),{converted:I}=xe(d?C:null,f,i);return n.jsxs("div",{ref:h,className:"nice-currency-converter"+(y?` ${y}`:""),style:g,children:[n.jsx("div",{className:"nice-currency-converter__row",children:n.jsx(De,{label:"From",value:u,onChange:A=>A&&b(A),currency:u.currency,onCurrencyChange:A=>b({...u,currency:A}),showFormattedPreview:!1})}),n.jsxs("div",{className:"nice-currency-converter__row",children:[n.jsx("label",{className:"nice-currency-converter__label",children:"To"}),n.jsxs("div",{className:"nice-currency-converter__output",children:[n.jsx(Se,{value:f,onChange:A=>x(A),compact:!0}),n.jsx("span",{className:"nice-currency-converter__amount",children:v?"…":N?"—":_?ee(_,{locale:l}):""})]})]}),d&&I&&n.jsxs("p",{className:"nice-currency-converter__rate",children:["1 ",u.currency," = ",ee(I,{locale:l})," ",n.jsxs("span",{className:"nice-currency-converter__inverse",children:["· 1 ",f," ="," ",ee(W(1/we(I),u.currency),{locale:l})]})]}),N&&n.jsx("p",{className:"nice-currency-converter__error",role:"alert",children:N.message})]})});function qe(t){return{amount:Math.round(t.amount),currency:t.currency}}const Jt=o.forwardRef(function({lines:e,locale:r,rounding:c="line",showTotals:a=!0,showGrandTotal:s=!0,hideRateColumn:m=!1,labels:i,density:l="comfortable",className:d,style:y,id:g},h){const u={label:(i==null?void 0:i.label)??"Item",rate:(i==null?void 0:i.rate)??"VAT",net:(i==null?void 0:i.net)??"Net",vat:(i==null?void 0:i.vat)??"Tax",gross:(i==null?void 0:i.gross)??"Gross",total:(i==null?void 0:i.total)??"Total"},b=o.useMemo(()=>{if(c==="total"){const _=new Map;for(const N of e){let C=_.get(N.vatRate);C||(C=[],_.set(N.vatRate,C)),C.push(N.netAmount)}const v=[];for(const[N,C]of _){const I=C.reduce((j,R)=>oe(j,R),W(0,C[0].currency)),A=qe(_e(I,N)),P=oe(I,A);v.push({rate:N,net:I,vat:A,gross:P})}return v}return e.map(_=>{const v=qe(_e(_.netAmount,_.vatRate)),N=oe(_.netAmount,v);return{label:_.label,rate:_.vatRate,net:_.netAmount,vat:v,gross:N}})},[e,c]),f=o.useMemo(()=>{if(b.length===0)return null;const _=b[0].net.currency;let v=W(0,_),N=W(0,_),C=W(0,_);for(const I of b)v=oe(v,I.net),N=oe(N,I.vat),C=oe(C,I.gross);return{net:v,vat:N,gross:C}},[b]),x=_=>ee(_,{locale:r});return n.jsxs("table",{ref:h,id:g,className:`nice-tax-breakdown nice-tax-breakdown--${l} ${d??""}`,style:y,role:"table","aria-label":u.total,children:[n.jsx("thead",{children:n.jsxs("tr",{children:[b.some(_=>_.label!==void 0)&&n.jsx("th",{scope:"col",children:u.label}),!m&&n.jsx("th",{scope:"col",className:"nice-tax-breakdown__rate",children:u.rate}),n.jsx("th",{scope:"col",className:"nice-tax-breakdown__num",children:u.net}),n.jsx("th",{scope:"col",className:"nice-tax-breakdown__num",children:u.vat}),n.jsx("th",{scope:"col",className:"nice-tax-breakdown__num",children:u.gross})]})}),n.jsx("tbody",{children:b.map((_,v)=>n.jsxs("tr",{children:[b.some(N=>N.label!==void 0)&&n.jsx("td",{children:_.label??""}),!m&&n.jsxs("td",{className:"nice-tax-breakdown__rate",children:[(_.rate*100).toLocaleString(r,{maximumFractionDigits:2}),"%"]}),n.jsx("td",{className:"nice-tax-breakdown__num",children:x(_.net)}),n.jsx("td",{className:"nice-tax-breakdown__num",children:x(_.vat)}),n.jsx("td",{className:"nice-tax-breakdown__num",children:x(_.gross)})]},`${_.rate}-${v}`))}),a&&f&&n.jsx("tfoot",{children:s&&n.jsxs("tr",{className:"nice-tax-breakdown__totals",children:[b.some(_=>_.label!==void 0)&&n.jsx("td",{children:u.total}),!m&&n.jsx("td",{children:b.some(_=>_.label!==void 0)?null:u.total}),n.jsx("td",{className:"nice-tax-breakdown__num",children:x(f.net)}),n.jsx("td",{className:"nice-tax-breakdown__num",children:x(f.vat)}),n.jsx("td",{className:"nice-tax-breakdown__num",children:x(f.gross)})]})})]})}),Vt=o.forwardRef(function(e,r){const{methods:c,value:a,onChange:s,layout:m="list",columns:i=2,currency:l,label:d,name:y,readOnly:g=!1,className:h,style:u,id:b,accessMode:f,"data-testid":x}=e,_=o.useId(),v=y??`nice-pm-${_}`,N=o.useMemo(()=>{if(!l)return c;const P=l.toUpperCase();return c.filter(j=>!j.currencies||j.currencies.map(R=>R.toUpperCase()).includes(P))},[c,l]);if(f==="hidden")return null;const C=g||f==="disabled"||f==="readOnly",I=`nice-payment-method-selector nice-payment-method-selector--${m}`+(h?` ${h}`:""),A=m==="grid"?{gridTemplateColumns:`repeat(${i}, minmax(0, 1fr))`}:void 0;return n.jsxs("div",{ref:r,id:b,className:I,style:u,"data-testid":x,children:[d&&n.jsx("div",{className:"nice-payment-method-selector__label",children:d}),n.jsxs("div",{className:"nice-payment-method-selector__options",style:A,role:"radiogroup","aria-label":d??"Payment method",children:[N.map(P=>{const j=P.id===a,R=C||P.disabled;return n.jsxs("label",{className:"nice-payment-method-selector__option"+(j?" nice-payment-method-selector__option--selected":"")+(R?" nice-payment-method-selector__option--disabled":""),children:[n.jsx("input",{type:"radio",className:"nice-payment-method-selector__radio",name:v,value:P.id,checked:j,disabled:R,onChange:()=>s==null?void 0:s(P.id)}),P.icon&&n.jsx("span",{className:"nice-payment-method-selector__icon",children:P.icon}),n.jsxs("span",{className:"nice-payment-method-selector__text",children:[n.jsx("span",{className:"nice-payment-method-selector__name",children:P.label}),P.description&&n.jsx("span",{className:"nice-payment-method-selector__desc",children:P.description})]})]},P.id)}),N.length===0&&n.jsx("div",{className:"nice-payment-method-selector__empty",children:"No methods available."})]})]})}),Xt=[{target:".nice-payment-provider-config",titleKey:"tutorial.paymentProviderConfig.intro.title",title:"Payment provider",contentKey:"tutorial.paymentProviderConfig.intro.content",content:"Pick a provider, fill its credentials (secrets are masked), choose test/live, enable methods and copy the webhook URL.",placement:"auto"}],Qt={providerId:"",mode:"test",credentials:{},enabledMethods:[]},Wt=o.forwardRef(function(e,r){const{value:c,defaultValue:a,onChange:s,providers:m,onTestConnection:i,showWebhookUrl:l=!0,baseUrl:d,readOnly:y=!1,testLabel:g="Test connection",tutorial:h,className:u,style:b,id:f,accessMode:x,"data-testid":_}=e,[v,N]=le.useControllableState({value:c,defaultValue:a,fallbackValue:Qt,onChange:s,componentName:"NicePaymentProviderConfig"}),C=o.useId(),[I,A]=o.useState(new Set),[P,j]=o.useState(!1),[R,G]=o.useState(null),O=o.useMemo(()=>m?m.map(p=>pe[p]).filter(p=>!!p):pt,[m]),k=pe[v.providerId];if(x==="hidden")return null;const q=y||x==="disabled"||x==="readOnly",E=p=>{G(null),A(new Set),N({providerId:p,mode:v.mode,credentials:{},enabledMethods:[]})},Z=(p,K)=>{N({...v,credentials:{...v.credentials,[p]:K}})},te=p=>{const K=new Set(v.enabledMethods??[]);K.has(p)?K.delete(p):K.add(p),N({...v,enabledMethods:[...K]})},F=p=>{A(K=>{const B=new Set(K);return B.has(p)?B.delete(p):B.add(p),B})},re=async()=>{if(i){j(!0),G(null);try{G(await i(v))}catch(p){G({ok:!1,message:p instanceof Error?p.message:String(p)})}finally{j(!1)}}},H=k!=null&&k.webhookPath?`${(d??"").replace(/\/$/,"")}${k.webhookPath}`:"",$=(k==null?void 0:k.supportedCurrencies)==="*"?"All currencies":((k==null?void 0:k.supportedCurrencies)??[]).join(", "),U="nice-payment-provider-config"+(u?` ${u}`:""),L=((k==null?void 0:k.credentials)??[]).filter(p=>!p.testOnly||v.mode==="test");return n.jsxs("div",{ref:r,id:f,className:U,style:b,"data-testid":_,children:[h&&n.jsx("div",{className:"nice-payment-provider-config__tutorial",children:n.jsx(le.NiceTutorialButton,{steps:le.resolveTutorial(h,Xt)})}),n.jsxs("div",{className:"nice-payment-provider-config__row",children:[n.jsxs("label",{className:"nice-payment-provider-config__field",children:[n.jsx("span",{className:"nice-payment-provider-config__field-label",children:"Provider"}),n.jsxs("select",{className:"nice-payment-provider-config__select",value:v.providerId,disabled:q,onChange:p=>E(p.target.value),children:[n.jsx("option",{value:"",children:"— select provider —"}),O.map(p=>n.jsx("option",{value:p.id,children:p.name},p.id))]})]}),(k==null?void 0:k.hasTestMode)&&n.jsxs("div",{className:"nice-payment-provider-config__mode",role:"group","aria-label":"Mode",children:[n.jsx("button",{type:"button",className:"nice-payment-provider-config__mode-btn"+(v.mode==="test"?" nice-payment-provider-config__mode-btn--active":""),onClick:()=>N({...v,mode:"test"}),disabled:q,children:"Test"}),n.jsx("button",{type:"button",className:"nice-payment-provider-config__mode-btn"+(v.mode==="live"?" nice-payment-provider-config__mode-btn--active":""),onClick:()=>N({...v,mode:"live"}),disabled:q,children:"Live"})]})]}),k&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"nice-payment-provider-config__meta",children:[n.jsx("span",{className:"nice-payment-provider-config__badge",children:k.type}),n.jsx("span",{className:"nice-payment-provider-config__currencies",children:$})]}),n.jsx("div",{className:"nice-payment-provider-config__credentials",children:L.map(p=>{const K=`${C}-${p.key}`,B=p.secret,w=I.has(p.key);return n.jsxs("div",{className:"nice-payment-provider-config__field",children:[n.jsxs("label",{className:"nice-payment-provider-config__field-label",htmlFor:K,children:[p.label,p.required&&n.jsx("span",{className:"nice-payment-provider-config__required",children:" *"})]}),n.jsxs("div",{className:"nice-payment-provider-config__input-wrap",children:[n.jsx("input",{id:K,type:B&&!w?"password":"text",className:"nice-payment-provider-config__input",value:v.credentials[p.key]??"",readOnly:q,autoComplete:B?"new-password":"off",onChange:T=>Z(p.key,T.target.value)}),B&&n.jsx("button",{type:"button",className:"nice-payment-provider-config__reveal",onClick:()=>F(p.key),"aria-label":w?"Hide":"Reveal","aria-pressed":w,children:n.jsx(le.NiceIcon,{name:w?"eye-off":"eye",size:14})})]}),p.help&&n.jsx("span",{className:"nice-payment-provider-config__help",children:p.help})]},p.key)})}),k.supportedMethods&&k.supportedMethods.length>0&&n.jsxs("div",{className:"nice-payment-provider-config__methods",children:[n.jsx("span",{className:"nice-payment-provider-config__field-label",children:"Enabled methods"}),n.jsx("div",{className:"nice-payment-provider-config__method-list",children:k.supportedMethods.map(p=>n.jsxs("label",{className:"nice-payment-provider-config__method",children:[n.jsx("input",{type:"checkbox",checked:(v.enabledMethods??[]).includes(p),disabled:q,onChange:()=>te(p)}),p]},p))})]}),l&&k.webhookPath&&n.jsxs("div",{className:"nice-payment-provider-config__field",children:[n.jsx("span",{className:"nice-payment-provider-config__field-label",children:"Webhook URL"}),n.jsx("code",{className:"nice-payment-provider-config__webhook",children:H})]}),i&&n.jsxs("div",{className:"nice-payment-provider-config__test",children:[n.jsx("button",{type:"button",className:"nice-payment-provider-config__test-btn",onClick:()=>void re(),disabled:q||P,children:P?"Testing…":g}),R&&n.jsxs("span",{className:"nice-payment-provider-config__test-result nice-payment-provider-config__test-result--"+(R.ok?"ok":"error"),children:[n.jsx(le.NiceIcon,{name:R.ok?"check":"close",size:14})," ",R.message??(R.ok?"OK":"Failed")]})]})]})]})});exports.EcbRatesProvider=Ze;exports.ExchangeRateHostProvider=Ye;exports.FrankfurterProvider=ze;exports.FreeForexApiProvider=Je;exports.MockPaymentProcessor=Xe;exports.NICE_CURRENCY_CATALOG=ue;exports.NICE_CURRENCY_CODES=Kt;exports.NICE_PAYMENT_PROCESSORS=mt;exports.NICE_PAYMENT_PROVIDER_LIST=pt;exports.NICE_PAYMENT_PROVIDER_PROFILES=pe;exports.NbpRatesProvider=Ge;exports.NiceCreditCardInput=ht;exports.NiceCurrencyConverter=Zt;exports.NiceCurrencySelector=Se;exports.NiceMoney=ke;exports.NiceMoneyInput=De;exports.NicePaymentForm=zt;exports.NicePaymentMethodSelector=Vt;exports.NicePaymentProviderConfig=Wt;exports.NicePriceTag=Yt;exports.NiceTaxBreakdown=Jt;exports.OpenExchangeRatesProvider=He;exports.StaticExchangeRateProvider=It;exports.addMoney=oe;exports.compareMoney=jt;exports.convertMoney=Ve;exports.createEcbRatesProvider=$t;exports.createFreeForexApiProvider=Ut;exports.createNbpRatesProvider=Rt;exports.createOpenExchangeRatesProvider=At;exports.detectCardBrand=ye;exports.expectedCvcLength=de;exports.findCurrency=X;exports.findPaymentProviderProfile=qt;exports.formatCardNumber=Le;exports.formatMoney=ee;exports.fromMoney=we;exports.isExpiryValid=Pe;exports.isNegative=Pt;exports.isZero=Mt;exports.luhnCheck=je;exports.makeAdyenAdapter=et;exports.makeAutopayAdapter=ot;exports.makeBlikAdapter=lt;exports.makeBraintreeAdapter=nt;exports.makeCoinbaseCommerceAdapter=ut;exports.makeKlarnaAdapter=dt;exports.makeMollieAdapter=rt;exports.makePayPalAdapter=We;exports.makePayUAdapter=ct;exports.makePrzelewy24Adapter=st;exports.makeRazorpayAdapter=at;exports.makeSquareAdapter=tt;exports.makeStripeAdapter=Qe;exports.makeTpayAdapter=it;exports.maskCardNumber=Dt;exports.multiplyMoney=_e;exports.negateMoney=St;exports.normaliseExpiry=Me;exports.parseMoney=Be;exports.registerCurrency=wt;exports.subtractMoney=Ke;exports.toMoney=W;exports.useNiceExchangeRate=xe;exports.useNiceMoney=Ft;exports.useNicePayment=yt;exports.validateCreditCard=ve;
1
+ "use strict";var kt=Object.defineProperty;var Ct=(t,e,r)=>e in t?kt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var H=(t,e,r)=>Ct(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),n=require("react/jsx-runtime"),G=require("@nice2dev/ui-core"),me=[{code:"USD",numeric:840,symbol:"$",name:"US Dollar",decimals:2,symbolFirst:!0},{code:"EUR",numeric:978,symbol:"€",name:"Euro",decimals:2,symbolFirst:!0},{code:"GBP",numeric:826,symbol:"£",name:"Pound Sterling",decimals:2,symbolFirst:!0},{code:"JPY",numeric:392,symbol:"¥",name:"Japanese Yen",decimals:0,symbolFirst:!0},{code:"CHF",numeric:756,symbol:"Fr",name:"Swiss Franc",decimals:2},{code:"CAD",numeric:124,symbol:"CA$",name:"Canadian Dollar",decimals:2,symbolFirst:!0},{code:"AUD",numeric:36,symbol:"A$",name:"Australian Dollar",decimals:2,symbolFirst:!0},{code:"NZD",numeric:554,symbol:"NZ$",name:"New Zealand Dollar",decimals:2,symbolFirst:!0},{code:"CNY",numeric:156,symbol:"¥",name:"Chinese Yuan Renminbi",decimals:2,symbolFirst:!0},{code:"HKD",numeric:344,symbol:"HK$",name:"Hong Kong Dollar",decimals:2,symbolFirst:!0},{code:"SGD",numeric:702,symbol:"S$",name:"Singapore Dollar",decimals:2,symbolFirst:!0},{code:"PLN",numeric:985,symbol:"zł",name:"Polish Złoty",decimals:2},{code:"CZK",numeric:203,symbol:"Kč",name:"Czech Koruna",decimals:2},{code:"HUF",numeric:348,symbol:"Ft",name:"Hungarian Forint",decimals:2},{code:"RON",numeric:946,symbol:"lei",name:"Romanian Leu",decimals:2},{code:"BGN",numeric:975,symbol:"лв",name:"Bulgarian Lev",decimals:2},{code:"HRK",numeric:191,symbol:"kn",name:"Croatian Kuna",decimals:2},{code:"DKK",numeric:208,symbol:"kr",name:"Danish Krone",decimals:2},{code:"SEK",numeric:752,symbol:"kr",name:"Swedish Krona",decimals:2},{code:"NOK",numeric:578,symbol:"kr",name:"Norwegian Krone",decimals:2},{code:"ISK",numeric:352,symbol:"kr",name:"Icelandic Króna",decimals:0},{code:"RUB",numeric:643,symbol:"₽",name:"Russian Ruble",decimals:2},{code:"UAH",numeric:980,symbol:"₴",name:"Ukrainian Hryvnia",decimals:2},{code:"TRY",numeric:949,symbol:"₺",name:"Turkish Lira",decimals:2,symbolFirst:!0},{code:"MXN",numeric:484,symbol:"Mex$",name:"Mexican Peso",decimals:2,symbolFirst:!0},{code:"BRL",numeric:986,symbol:"R$",name:"Brazilian Real",decimals:2,symbolFirst:!0},{code:"ARS",numeric:32,symbol:"AR$",name:"Argentine Peso",decimals:2,symbolFirst:!0},{code:"CLP",numeric:152,symbol:"CL$",name:"Chilean Peso",decimals:0,symbolFirst:!0},{code:"COP",numeric:170,symbol:"CO$",name:"Colombian Peso",decimals:2,symbolFirst:!0},{code:"PEN",numeric:604,symbol:"S/",name:"Peruvian Sol",decimals:2,symbolFirst:!0},{code:"UYU",numeric:858,symbol:"$U",name:"Uruguayan Peso",decimals:2,symbolFirst:!0},{code:"INR",numeric:356,symbol:"₹",name:"Indian Rupee",decimals:2,symbolFirst:!0},{code:"IDR",numeric:360,symbol:"Rp",name:"Indonesian Rupiah",decimals:2,symbolFirst:!0},{code:"KRW",numeric:410,symbol:"₩",name:"South Korean Won",decimals:0,symbolFirst:!0},{code:"MYR",numeric:458,symbol:"RM",name:"Malaysian Ringgit",decimals:2,symbolFirst:!0},{code:"PHP",numeric:608,symbol:"₱",name:"Philippine Peso",decimals:2,symbolFirst:!0},{code:"THB",numeric:764,symbol:"฿",name:"Thai Baht",decimals:2,symbolFirst:!0},{code:"VND",numeric:704,symbol:"₫",name:"Vietnamese Đồng",decimals:0},{code:"TWD",numeric:901,symbol:"NT$",name:"New Taiwan Dollar",decimals:2,symbolFirst:!0},{code:"PKR",numeric:586,symbol:"₨",name:"Pakistani Rupee",decimals:2},{code:"BDT",numeric:50,symbol:"৳",name:"Bangladeshi Taka",decimals:2},{code:"LKR",numeric:144,symbol:"Rs",name:"Sri Lankan Rupee",decimals:2},{code:"AED",numeric:784,symbol:"د.إ",name:"UAE Dirham",decimals:2},{code:"SAR",numeric:682,symbol:"ر.س",name:"Saudi Riyal",decimals:2},{code:"QAR",numeric:634,symbol:"ر.ق",name:"Qatari Riyal",decimals:2},{code:"KWD",numeric:414,symbol:"د.ك",name:"Kuwaiti Dinar",decimals:3},{code:"BHD",numeric:48,symbol:".د.ب",name:"Bahraini Dinar",decimals:3},{code:"OMR",numeric:512,symbol:"ر.ع",name:"Omani Rial",decimals:3},{code:"JOD",numeric:400,symbol:"د.أ",name:"Jordanian Dinar",decimals:3},{code:"ILS",numeric:376,symbol:"₪",name:"Israeli New Shekel",decimals:2,symbolFirst:!0},{code:"EGP",numeric:818,symbol:"E£",name:"Egyptian Pound",decimals:2,symbolFirst:!0},{code:"ZAR",numeric:710,symbol:"R",name:"South African Rand",decimals:2,symbolFirst:!0},{code:"NGN",numeric:566,symbol:"₦",name:"Nigerian Naira",decimals:2,symbolFirst:!0},{code:"KES",numeric:404,symbol:"KSh",name:"Kenyan Shilling",decimals:2},{code:"GHS",numeric:936,symbol:"₵",name:"Ghanaian Cedi",decimals:2},{code:"MAD",numeric:504,symbol:"د.م.",name:"Moroccan Dirham",decimals:2},{code:"TND",numeric:788,symbol:"د.ت",name:"Tunisian Dinar",decimals:3},{code:"BTC",numeric:0,symbol:"₿",name:"Bitcoin",decimals:8,symbolFirst:!0},{code:"ETH",numeric:0,symbol:"Ξ",name:"Ether",decimals:8,symbolFirst:!0},{code:"USDC",numeric:0,symbol:"USDC",name:"USD Coin",decimals:6},{code:"USDT",numeric:0,symbol:"USDT",name:"Tether",decimals:6}],Ke=new Map(me.map(t=>[t.code,t]));function W(t){return Ke.get(t.toUpperCase())}function wt(t){Ke.set(t.code.toUpperCase(),t);const e=me.findIndex(r=>r.code===t.code);e>=0?me[e]=t:me.push(t)}function re(t,e){const r=W(e),a=(r==null?void 0:r.decimals)??2,c=Math.pow(10,a);return{amount:(t<0?-1:1)*Math.round(Math.abs(t)*c),currency:e.toUpperCase()}}function we(t){const e=W(t.currency),r=(e==null?void 0:e.decimals)??2;return t.amount/Math.pow(10,r)}function jt(t,e){return t.currency.toUpperCase()===e.currency.toUpperCase()}function je(t,e,r){if(!jt(t,e))throw new Error(`Cannot ${r} different currencies: ${t.currency} vs ${e.currency}`)}function de(t,e){return je(t,e,"add"),{amount:t.amount+e.amount,currency:t.currency}}function Be(t,e){return je(t,e,"subtract"),{amount:t.amount-e.amount,currency:t.currency}}function ge(t,e){return{amount:(t.amount*e<0?-1:1)*Math.round(Math.abs(t.amount*e)),currency:t.currency}}function Mt(t,e){return je(t,e,"compare"),t.amount-e.amount}function Pt(t){return t.amount===0}function St(t){return t.amount<0}function Dt(t){return{amount:-t.amount,currency:t.currency}}function ne(t,e={}){const r=W(t.currency),a=e.decimals??(r==null?void 0:r.decimals)??2,c=t.amount/Math.pow(10,a);try{return new Intl.NumberFormat(e.locale,{style:"currency",currency:t.currency,minimumFractionDigits:a,maximumFractionDigits:a,currencyDisplay:e.currencyDisplay??"symbol"}).format(c)}catch{const s=(r==null?void 0:r.symbol)??t.currency,u=c.toFixed(a);return r!=null&&r.symbolFirst?`${s}${u}`:`${u} ${s}`}}function Le(t,e){if(!t)return null;let r=t.replace(/[^\d.,-]/g,"").trim();if(!r||r==="-")return null;const a=r.startsWith("-");a&&(r=r.slice(1));const c=r.lastIndexOf("."),s=r.lastIndexOf(","),u=Math.max(c,s);let i,l="";u===-1?i=r:(i=r.slice(0,u).replace(/[.,]/g,""),l=r.slice(u+1).replace(/[.,]/g,""));const d=`${i}.${l||"0"}`,h=parseFloat(d);return Number.isFinite(h)?re(a?-h:h,e):null}function he(t){const e=(t||"").replace(/\D/g,"");return e?/^4/.test(e)?"visa":/^(5[1-5]|2(2[2-9]|[3-6]\d|7[01]|720))/.test(e)?"mastercard":/^3[47]/.test(e)?"amex":/^(6011|65|64[4-9]|622(12[6-9]|1[3-9]\d|[2-8]\d\d|9[01]\d|92[0-5]))/.test(e)?"discover":/^3(0[0-5]|[68])/.test(e)?"diners":/^35(2[89]|[3-8])/.test(e)?"jcb":/^62/.test(e)?"unionpay":/^(50|5[6-9]|6[0-9])/.test(e)?"maestro":/^(2200|2201|2202|2203|2204)/.test(e)?"mir":/^(4011|4312|4389|4514|4576|5041|5066|5067|509|6277|6362|6363|650|6516|6550)/.test(e)?"elo":/^(606282|3841)/.test(e)?"hipercard":"unknown":"unknown"}function Me(t){const e=(t||"").replace(/\D/g,"");if(e.length<12||e.length>19)return!1;let r=0,a=!1;for(let c=e.length-1;c>=0;c--){let s=e.charCodeAt(c)-48;a&&(s*=2,s>9&&(s-=9)),r+=s,a=!a}return r%10===0}function ze(t,e){const r=(t||"").replace(/\D/g,""),a=e??he(r);return a==="amex"?[r.slice(0,4),r.slice(4,10),r.slice(10,15)].filter(Boolean).join(" "):a==="diners"?[r.slice(0,4),r.slice(4,10),r.slice(10,14)].filter(Boolean).join(" "):(r.match(/.{1,4}/g)??[]).join(" ").trim()}function It(t,e){const r=(t||"").replace(/\D/g,"");if(r.length<4)return r;const a=r.slice(-4),c="*".repeat(r.length-4)+a,s=e??he(r);return s==="amex"?[c.slice(0,4),c.slice(4,10),c.slice(10,15)].filter(Boolean).join(" "):s==="diners"?[c.slice(0,4),c.slice(4,10),c.slice(10,14)].filter(Boolean).join(" "):(c.match(/.{1,4}/g)??[]).join(" ").trim()}function Pe(t){const e=(t||"").replace(/\D/g,"");if(e.length<3)return null;const r=e.slice(0,2),a=e.length>=4?e.slice(-2):e.slice(2,4),c=parseInt(r,10);return!Number.isFinite(c)||c<1||c>12?null:`${r}/${a}`}function Se(t,e=new Date){const r=Pe(t);if(!r)return!1;const[a,c]=r.split("/"),s=parseInt(a,10),u=2e3+parseInt(c,10);return new Date(u,s,0,23,59,59,999).getTime()>=e.getTime()}function ue(t){return t==="amex"?4:3}function ke(t,e={}){var d;const r={},a=he(t.number),c=Me(t.number);c||(r.number="Invalid card number");const s=Se(t.expiry,e.now);s||(r.expiry="Invalid or expired");const i=(t.cvc||"").replace(/\D/g,"").length===ue(a);i||(r.cvc=`CVC must be ${ue(a)} digits`);const l=!e.requireHolder||(((d=t.holderName)==null?void 0:d.trim().length)??0)>=2;return l||(r.holderName="Cardholder name required"),{brand:a,numberValid:c,expiryValid:s,cvcValid:i,holderValid:l,isValid:c&&s&&i&&l,errors:r}}class Rt{constructor(e){H(this,"id","static");this.rates=e}async getRate(e,r){const a=e.toUpperCase(),c=r.toUpperCase();if(a===c)return{base:a,quote:c,rate:1,asOf:new Date().toISOString()};const s=this.rates.find(d=>d.base===a&&d.quote===c);if(s)return s;const u=this.rates.find(d=>d.base===c&&d.quote===a);if(u)return{base:a,quote:c,rate:1/u.rate,asOf:u.asOf};const i=this.rates.find(d=>d.base===a&&d.quote==="USD")??this.rates.find(d=>d.base==="USD"&&d.quote===a),l=this.rates.find(d=>d.base==="USD"&&d.quote===c)??this.rates.find(d=>d.base===c&&d.quote==="USD");if(i&&l){const d=i.base==="USD"?1/i.rate:i.rate,h=l.base==="USD"?l.rate:1/l.rate;return{base:a,quote:c,rate:d*h,asOf:new Date().toISOString()}}throw new Error(`No FX rate for ${a}/${c}`)}}class Ne{constructor(e={}){H(this,"cache",new Map);H(this,"fetchImpl");H(this,"ttl");this.fetchImpl=e.fetchImpl??fetch,this.ttl=e.cacheTtl??6e4}cacheKey(e,r){return`${this.id}:${e.toUpperCase()}/${r.toUpperCase()}`}getCached(e,r){const a=this.cacheKey(e,r),c=this.cache.get(a);return c&&c.expires>Date.now()?c.rate:(c&&this.cache.delete(a),null)}setCached(e){this.cache.set(this.cacheKey(e.base,e.quote),{expires:Date.now()+this.ttl,rate:e})}}class He extends Ne{constructor(r={}){super(r);H(this,"id","frankfurter")}async getRate(r,a){const c=r.toUpperCase(),s=a.toUpperCase();if(c===s)return{base:c,quote:s,rate:1,asOf:new Date().toISOString()};const u=this.getCached(c,s);if(u)return u;const i=`https://api.frankfurter.app/latest?from=${c}&to=${s}`,l=await this.fetchImpl(i);if(!l.ok)throw new Error(`Frankfurter HTTP ${l.status}`);const d=await l.json(),h=d.rates[s];if(h==null)throw new Error(`Frankfurter: no rate for ${c}/${s}`);const x={base:c,quote:s,rate:h,asOf:d.date};return this.setCached(x),x}}class Ye extends Ne{constructor(r,a={}){super(a);H(this,"id","openexchangerates");this.appId=r}async getRate(r,a){const c=r.toUpperCase(),s=a.toUpperCase();if(c===s)return{base:c,quote:s,rate:1,asOf:new Date().toISOString()};const u=this.getCached(c,s);if(u)return u;const i=`https://openexchangerates.org/api/latest.json?app_id=${this.appId}`,l=await this.fetchImpl(i);if(!l.ok)throw new Error(`OpenExchangeRates HTTP ${l.status}`);const d=await l.json(),h=d.rates[c],x=d.rates[s];if(h==null||x==null)throw new Error(`OpenExchangeRates: missing rate for ${c} or ${s}`);const f={base:c,quote:s,rate:x/h,asOf:new Date(d.timestamp*1e3).toISOString()};return this.setCached(f),f}}class Ge extends Ne{constructor(r={}){super(r);H(this,"id","exchangerate.host")}async getRate(r,a){var f;const c=r.toUpperCase(),s=a.toUpperCase();if(c===s)return{base:c,quote:s,rate:1,asOf:new Date().toISOString()};const u=this.getCached(c,s);if(u)return u;const i=`https://api.exchangerate.host/convert?from=${c}&to=${s}`,l=await this.fetchImpl(i);if(!l.ok)throw new Error(`exchangerate.host HTTP ${l.status}`);const d=await l.json(),h=((f=d.info)==null?void 0:f.rate)??d.result,x={base:c,quote:s,rate:h,asOf:d.date};return this.setCached(x),x}}class Ze extends Ne{constructor(r={}){super(r);H(this,"id","nbp");H(this,"table");this.table=r.table??"A"}async getRate(r,a){const c=r.toUpperCase(),s=a.toUpperCase();if(c===s)return{base:c,quote:s,rate:1,asOf:new Date().toISOString()};const u=this.getCached(c,s);if(u)return u;const i=async x=>{var N;if(x==="PLN")return{rate:1,date:new Date().toISOString().slice(0,10)};const f=`https://api.nbp.pl/api/exchangerates/rates/${this.table}/${x}/?format=json`,m=await this.fetchImpl(f);if(!m.ok)return null;const g=(N=(await m.json()).rates)==null?void 0:N[0];return g?{rate:g.mid??g.ask??0,date:g.effectiveDate}:null},l=await i(c),d=await i(s);if(!l||!d||l.rate===0)throw new Error(`NBP: missing rate for ${c} or ${s}`);const h={base:c,quote:s,rate:l.rate/d.rate,asOf:l.date};return this.setCached(h),h}}class Je extends He{constructor(){super(...arguments);H(this,"id","ecb")}}class Ve extends Ge{constructor(){super(...arguments);H(this,"id","free-forex")}}const $t=(t={})=>new Ze(t),At=(t={})=>new Je(t),Et=t=>new Ye(t.apiKey,t),Ut=(t={})=>new Ve(t);async function Xe(t,e,r){const a=e.toUpperCase();if(t.currency.toUpperCase()===a)return t;const c=W(t.currency),s=W(a),u=(c==null?void 0:c.decimals)??2,i=(s==null?void 0:s.decimals)??2,{rate:l}=await r.getRate(t.currency,a),h=t.amount/Math.pow(10,u)*l;return{currency:a,amount:Math.round(h*Math.pow(10,i))}}class Qe{constructor(e={}){H(this,"id");H(this,"name");H(this,"supportedCurrencies");H(this,"minimums");H(this,"counter",0);this.id=e.id??"mock",this.name=e.name??"Mock Processor",this.supportedCurrencies=e.supportedCurrencies??"*"}newId(e){return this.counter+=1,`${e}_${Date.now().toString(36)}_${this.counter}`}async authorize(e){return{id:this.newId("auth"),status:"authorized",processor:this.id,amount:e.amount,raw:{mock:!0,request:e}}}async capture(e,r){return{id:e.replace("auth_","cap_"),status:"captured",processor:this.id,amount:r}}async cancel(e){return{id:e,status:"cancelled",processor:this.id}}async refund(e,r){return{id:e.replace(/^[a-z]+_/,"ref_"),status:"refunded",processor:this.id,amount:r}}}function V(t,e,r,a,c){const s=u=>{const i=a==null?void 0:a[u];return i||(async()=>{throw new Error(`[ui-money] ${e} adapter is not wired. Pass an \`executor.${String(u)}\` implementation that calls the ${e} SDK.`)})};return{id:t,name:e,supportedCurrencies:r,minimums:c,authorize:s("authorize"),capture:s("capture"),cancel:s("cancel"),refund:s("refund")}}function We(t){return V("stripe","Stripe","*",t,{USD:50,EUR:50,GBP:30,JPY:50,AUD:50,CAD:50,CHF:50,DKK:250,NOK:300,SEK:300,PLN:200})}function et(t){return V("paypal","PayPal",["USD","EUR","GBP","AUD","CAD","JPY","CHF","NZD","SEK","NOK","DKK","PLN","CZK","HUF","BRL","MXN","HKD","SGD","TWD","THB","PHP","ILS"],t)}function tt(t){return V("adyen","Adyen","*",t)}function rt(t){return V("square","Square",["USD","CAD","GBP","AUD","JPY","EUR"],t)}function nt(t){return V("mollie","Mollie","*",t)}function at(t){return V("braintree","Braintree","*",t)}function ct(t){return V("razorpay","Razorpay",["INR","USD","EUR","GBP","AED"],t)}function st(t){return V("payu","PayU",["PLN","EUR","USD","CZK","HUF","RON","BGN","TRY"],t)}function it(t){return V("przelewy24","Przelewy24",["PLN","EUR"],t)}function ot(t={}){return V("tpay","Tpay",["PLN","EUR","USD","GBP"],t)}function lt(t={}){return V("autopay","Autopay",["PLN","EUR","USD","GBP","CZK"],t)}function dt(t={}){const{acquirer:e="native",...r}=t;return V(`blik:${e}`,`BLIK (${e})`,["PLN"],r)}function ut(t){return V("klarna","Klarna",["USD","EUR","GBP","SEK","NOK","DKK","CHF","AUD","CAD","NZD","PLN"],t)}function mt(t){return V("coinbase-commerce","Coinbase Commerce",["BTC","ETH","USDC","USDT","USD","EUR"],t)}const pt={mock:()=>new Qe,stripe:()=>We(),paypal:()=>et(),adyen:()=>tt(),square:()=>rt(),mollie:()=>nt(),braintree:()=>at(),razorpay:()=>ct(),payu:()=>st(),przelewy24:()=>it(),tpay:()=>ot(),autopay:()=>lt(),blik:()=>dt(),klarna:()=>ut(),"coinbase-commerce":()=>mt()};function Tt(t){const e=pt[t];return e?e().supportedCurrencies:"*"}function Ot(t){return`/api/payments/${t}/webhook`}const Ft=[{id:"stripe",name:"Stripe",type:"card",credentials:[{key:"apiKey",label:"Secret API key",secret:!0,required:!0,help:"sk_live_… / sk_test_…"},{key:"publishableKey",label:"Publishable key",required:!0,help:"pk_live_… / pk_test_…"},{key:"webhookSecret",label:"Webhook signing secret",secret:!0,help:"whsec_…"}],supportedMethods:["card","applepay","googlepay","link"],allowedDomains:["api.stripe.com"],hasTestMode:!0},{id:"paypal",name:"PayPal",type:"wallet",credentials:[{key:"clientId",label:"Client ID",required:!0},{key:"clientSecret",label:"Client secret",secret:!0,required:!0},{key:"webhookId",label:"Webhook ID"}],supportedMethods:["paypal","card","paylater"],allowedDomains:["api-m.paypal.com","api-m.sandbox.paypal.com"],hasTestMode:!0},{id:"adyen",name:"Adyen",type:"aggregator",credentials:[{key:"apiKey",label:"API key",secret:!0,required:!0},{key:"merchantAccount",label:"Merchant account",required:!0},{key:"hmacKey",label:"HMAC key (webhooks)",secret:!0},{key:"clientKey",label:"Client key"}],supportedMethods:["card","ideal","bancontact","applepay","googlepay"],allowedDomains:["checkout-test.adyen.com","checkout-live.adyen.com"],hasTestMode:!0},{id:"square",name:"Square",type:"card",credentials:[{key:"accessToken",label:"Access token",secret:!0,required:!0},{key:"applicationId",label:"Application ID",required:!0},{key:"locationId",label:"Location ID",required:!0}],supportedMethods:["card","applepay","googlepay"],allowedDomains:["connect.squareup.com","connect.squareupsandbox.com"],hasTestMode:!0},{id:"mollie",name:"Mollie",type:"aggregator",credentials:[{key:"apiKey",label:"API key",secret:!0,required:!0,help:"live_… / test_…"}],supportedMethods:["card","ideal","bancontact","blik","applepay"],allowedDomains:["api.mollie.com"],hasTestMode:!0},{id:"braintree",name:"Braintree",type:"card",credentials:[{key:"merchantId",label:"Merchant ID",required:!0},{key:"publicKey",label:"Public key",required:!0},{key:"privateKey",label:"Private key",secret:!0,required:!0}],supportedMethods:["card","paypal","applepay","googlepay"],allowedDomains:["api.braintreegateway.com","api.sandbox.braintreegateway.com"],hasTestMode:!0},{id:"razorpay",name:"Razorpay",type:"aggregator",credentials:[{key:"keyId",label:"Key ID",required:!0},{key:"keySecret",label:"Key secret",secret:!0,required:!0},{key:"webhookSecret",label:"Webhook secret",secret:!0}],supportedMethods:["card","upi","netbanking","wallet"],allowedDomains:["api.razorpay.com"],hasTestMode:!0},{id:"payu",name:"PayU",type:"aggregator",credentials:[{key:"posId",label:"POS ID",required:!0},{key:"clientId",label:"OAuth client ID",required:!0},{key:"clientSecret",label:"OAuth client secret",secret:!0,required:!0},{key:"secondKey",label:"Second key (MD5)",secret:!0}],supportedMethods:["card","blik","transfer","googlepay"],allowedDomains:["secure.payu.com","secure.snd.payu.com"],hasTestMode:!0},{id:"przelewy24",name:"Przelewy24",type:"bank",credentials:[{key:"merchantId",label:"Merchant ID",required:!0},{key:"posId",label:"POS ID",required:!0},{key:"crcKey",label:"CRC key",secret:!0,required:!0},{key:"apiKey",label:"API key",secret:!0,required:!0}],supportedMethods:["transfer","blik","card"],allowedDomains:["secure.przelewy24.pl","sandbox.przelewy24.pl"],hasTestMode:!0},{id:"tpay",name:"Tpay",type:"aggregator",credentials:[{key:"merchantId",label:"Merchant ID",required:!0},{key:"apiKey",label:"API key",secret:!0,required:!0},{key:"apiPassword",label:"API password",secret:!0,required:!0}],supportedMethods:["card","blik","transfer","applepay"],allowedDomains:["api.tpay.com","secure.tpay.com"],hasTestMode:!0},{id:"autopay",name:"Autopay",type:"aggregator",credentials:[{key:"serviceId",label:"Service ID",required:!0},{key:"sharedSecret",label:"Shared secret",secret:!0,required:!0}],supportedMethods:["card","blik","transfer"],allowedDomains:["pay.autopay.eu","testpay.autopay.eu"],hasTestMode:!0},{id:"blik",name:"BLIK",type:"bank",credentials:[{key:"acquirer",label:"Acquirer (p24 / tpay / payu / native)",required:!0,help:"Underlying acquirer routing BLIK."}],supportedMethods:["blik"],hasTestMode:!0},{id:"klarna",name:"Klarna",type:"bnpl",credentials:[{key:"username",label:"API username (UID)",required:!0},{key:"password",label:"API password",secret:!0,required:!0},{key:"region",label:"Region (eu / na / oc)",help:"Selects the Klarna API host."}],supportedMethods:["paylater","installments","paynow"],allowedDomains:["api.klarna.com","api.playground.klarna.com"],hasTestMode:!0},{id:"coinbase-commerce",name:"Coinbase Commerce",type:"crypto",credentials:[{key:"apiKey",label:"API key",secret:!0,required:!0},{key:"webhookSharedSecret",label:"Webhook shared secret",secret:!0}],supportedMethods:["crypto"],allowedDomains:["api.commerce.coinbase.com"],hasTestMode:!1},{id:"wallet",name:"In-app Wallet",type:"wallet",currencyKey:"mock",credentials:[{key:"ledgerAccount",label:"Ledger account",required:!0,help:"Account the wallet debits/credits."}],supportedMethods:["wallet"],hasTestMode:!0}],ye=Object.fromEntries(Ft.map(t=>{const{currencyKey:e,...r}=t,a={...r,supportedCurrencies:Tt(e??t.id),webhookPath:Ot(t.id)};return[t.id,a]})),yt=Object.values(ye);function qt(t){return ye[t]}function Kt(t,e){const r=o.useMemo(()=>"amount"in t?t:re(t.major,t.currency),[]),[a,c]=o.useState(r),s=o.useCallback(f=>c(m=>re(f,m.currency)),[]),u=o.useCallback(f=>{c(m=>({...m,currency:f.toUpperCase()}))},[]),i=o.useCallback(f=>c(m=>de(m,f)),[]),l=o.useCallback(f=>c(m=>Be(m,f)),[]),d=o.useCallback(f=>c(m=>ge(m,f)),[]),h=o.useMemo(()=>ne(a,{locale:e}),[a,e]),x=o.useMemo(()=>we(a),[a]);return{money:a,setMoney:c,setMajor:s,setCurrency:u,add:i,subtract:l,scale:d,formatted:h,major:x}}function xe(t,e,r){const[a,c]=o.useState(null),[s,u]=o.useState(null),[i,l]=o.useState(!1),d=o.useRef(0);return o.useEffect(()=>{if(!t){c(null);return}const h=++d.current;l(!0),u(null),Xe(t,e,r).then(x=>{d.current===h&&c(x)}).catch(x=>{d.current===h&&(u(x instanceof Error?x:new Error(String(x))),c(null))}).finally(()=>{d.current===h&&l(!1)})},[t==null?void 0:t.amount,t==null?void 0:t.currency,e,r]),{converted:a,loading:i,error:s}}function ht(t){const[e,r]=o.useState("idle"),[a,c]=o.useState(null),[s,u]=o.useState(null),i=o.useCallback(()=>{r("idle"),c(null),u(null)},[]),l=o.useCallback(async f=>{r("authorizing"),u(null);try{const m=await t.authorize(f);return c(m),r(m.status),m}catch(m){const p=m instanceof Error?m:new Error(String(m));throw u(p),r("failed"),p}},[t]),d=o.useCallback(async(f,m)=>{const p=f??(a==null?void 0:a.id);if(!p)throw new Error("No authorization id to capture");r("capturing");try{const g=await t.capture(p,m);return c(g),r(g.status),g}catch(g){const N=g instanceof Error?g:new Error(String(g));throw u(N),r("failed"),N}},[t,a==null?void 0:a.id]),h=o.useCallback(async f=>{const m=f??(a==null?void 0:a.id);if(!m)throw new Error("No payment id to cancel");const p=await t.cancel(m);return c(p),r(p.status),p},[t,a==null?void 0:a.id]),x=o.useCallback(async(f,m)=>{const p=f??(a==null?void 0:a.id);if(!p)throw new Error("No payment id to refund");const g=await t.refund(p,m);return c(g),r(g.status),g},[t,a==null?void 0:a.id]);return{status:e,response:a,error:s,authorize:l,capture:d,cancel:h,refund:x,reset:i}}const Ce=o.forwardRef(function({value:e,amount:r,currency:a,locale:c,display:s="symbol",highlightNegative:u=!0,zeroPlaceholder:i,convertTo:l,exchangeProvider:d,className:h,style:x,"aria-label":f},m){const p=o.useMemo(()=>{if(e)return e;if(r!=null&&a){const _=W(a),v=(_==null?void 0:_.decimals)??2;return{amount:Math.round(r*Math.pow(10,v)),currency:a.toUpperCase()}}return null},[e,r,a]),g=o.useMemo(()=>p?p.amount===0&&i!=null?i:ne(p,{locale:c,currencyDisplay:s}):"",[p,c,s,i]),{converted:N}=xe(l&&d?p:null,l??"",d);if(!p)return null;const y=p.amount<0,w="nice-money"+(u&&y?" nice-money--negative":"")+(h?` ${h}`:"");return n.jsxs("span",{ref:m,className:w,style:x,"aria-label":f,children:[n.jsx("span",{className:"nice-money__value",children:g}),N&&n.jsxs("span",{className:"nice-money__converted","aria-label":`Converted to ${N.currency}`,children:[" ≈ ",ne(N,{locale:c})]})]})}),Bt=me.map(t=>t.code).sort(),De=o.forwardRef(function({value:e,onChange:r,options:a=me,recents:c=[],searchable:s,showCode:u=!0,showSymbol:i=!0,compact:l=!1,disabled:d,readOnly:h,loading:x,accessMode:f,label:m,helperText:p,error:g,required:N,size:y="md",labelPlacement:w="top",labelWidth:_,controlWidth:v,className:$,style:z,id:j,name:S,title:D,"data-testid":A,"aria-label":X,placeholder:F},k){const{t:q}=G.useNiceTranslation(),T=f==="hidden",J=d||f==="disabled"||x,ae=h||f==="readOnly",B=o.useId(),ee=j??`nice-cs-${B}`,[Y,U]=o.useState(""),E=s??a.length>8,M=o.useMemo(()=>{if(!Y.trim())return a;const P=Y.trim().toLowerCase();return a.filter(I=>I.code.toLowerCase().includes(P)||I.name.toLowerCase().includes(P)||I.symbol.toLowerCase().includes(P))},[a,Y]),b=o.useMemo(()=>{const P=new Set;return c.map(I=>W(I)).filter(I=>!!I&&!P.has(I.code)&&!!P.add(I.code))},[c]),O=o.useCallback(P=>{const I=P.target.value,se=W(I);se&&(r==null||r(I,se))},[r]),L=P=>{if(l)return`${i?P.symbol+" ":""}${P.code}`;const I=[];return i&&I.push(P.symbol),u&&I.push(P.code),I.push("—",P.name),I.join(" ")},C=`nice-currency-selector nice-currency-selector--${y} nice-currency-selector--label-${w}`+(l?" nice-currency-selector--compact":"")+(g?" nice-currency-selector--error":"")+(J?" nice-currency-selector--disabled":"")+($?` ${$}`:""),K=w==="left"&&_!=null?{width:typeof _=="number"?`${_}px`:_,flex:"none"}:void 0,ce=v!=null?{width:typeof v=="number"?`${v}px`:v,flex:"none"}:void 0;return T?null:n.jsxs("div",{ref:k,className:C,style:z,title:D,"data-testid":A,children:[m&&n.jsxs("label",{htmlFor:ee,className:"nice-currency-selector__label",style:K,children:[m,N&&n.jsx("span",{className:"nice-currency-selector__required","aria-hidden":!0,children:"*"})]}),n.jsxs("div",{className:"nice-currency-selector__inner",style:ce,children:[E&&n.jsx("input",{type:"search",className:"nice-currency-selector__search",placeholder:q("currencySelector.searchCurrency","Search currency…"),value:Y,onChange:P=>U(P.target.value),disabled:J||ae,"aria-label":q("currencySelector.searchCurrency2","Search currency")}),n.jsxs("select",{id:ee,name:S,className:"nice-currency-selector__select",value:e??"",onChange:O,disabled:J||ae,required:N,"aria-invalid":!!g,"aria-label":X??(typeof m=="string"?m:"Currency"),children:[!e&&n.jsx("option",{value:"",children:F??"Select currency…"}),b.length>0&&n.jsx("optgroup",{label:q("currencySelector.recent","Recent"),children:b.map(P=>n.jsx("option",{value:P.code,children:L(P)},`r-${P.code}`))}),n.jsx("optgroup",{label:b.length>0?"All":"",children:M.map(P=>n.jsx("option",{value:P.code,children:L(P)},P.code))})]})]}),(g||p)&&n.jsx("span",{className:g?"nice-currency-selector__error":"nice-currency-selector__helper",children:g??p})]})}),Ie=o.forwardRef(function({value:e,onChange:r,currency:a,onCurrencyChange:c,currencies:s,hideCurrencySelector:u,min:i,max:l,step:d,locale:h,placeholder:x,label:f,helperText:m,error:p,size:g="md",disabled:N,readOnly:y,required:w,loading:_,accessMode:v,labelPlacement:$="top",errorPlacement:z="bottom",labelWidth:j,controlWidth:S,submitOnEnter:D,onSubmit:A,showFormattedPreview:X=!0,showSteppers:F=!1,className:k,style:q,id:T,name:J,title:ae,"data-testid":B,onBlur:ee,onFocus:Y,liveGrouping:U,multiplierShortcuts:E=!0,onValidationError:M},b){const{t:O}=G.useNiceTranslation(),L=N||v==="disabled"||_,C=y||v==="readOnly",K=v==="hidden",ce=o.useId(),P=T??`nice-money-${ce}`,I=((e==null?void 0:e.currency)??a??"USD").toUpperCase(),se=W(I),Q=(se==null?void 0:se.decimals)??2,Re=d??1/Math.pow(10,Q),[ve,be]=o.useState(()=>e?(e.amount/Math.pow(10,Q)).toFixed(Q):""),[fe,$e]=o.useState(!1);o.useEffect(()=>{if(fe)return;if(e==null){be("");return}const R=W(e.currency),Z=(R==null?void 0:R.decimals)??2;be((e.amount/Math.pow(10,Z)).toFixed(Z))},[e,fe]);const Ae=o.useCallback(R=>{let Z=R;if(E){const oe=R.trim().match(/^([+-]?\d+(?:[.,]\d+)?)\s*([kKmMbB])$/);if(oe){const le=oe[2].toLowerCase()==="k"?1e3:oe[2].toLowerCase()==="m"?1e6:1e9,Oe=Number(oe[1].replace(",","."))*le;if(!Number.isFinite(Oe)){M==null||M(new Error("overflow"));return}Z=String(Oe)}}const te=Le(Z,I);if(!te){r==null||r(null);return}if(!Number.isSafeInteger(te.amount)){M==null||M(new Error("overflow: amount exceeds Number.MAX_SAFE_INTEGER"));return}const ie=te.amount/Math.pow(10,Q);if(i!=null&&ie<i){M==null||M(new Error(`min: ${i}`)),r==null||r(re(i,I));return}if(l!=null&&ie>l){M==null||M(new Error(`max: ${l}`)),r==null||r(re(l,I));return}r==null||r(te)},[I,Q,i,l,r,E,M]),ft=o.useCallback(R=>{const Z=R.target.value;be(Z),Ae(Z)},[Ae]),Ee=o.useCallback(R=>{const te=(e?e.amount/Math.pow(10,Q):0)+R,ie=Math.min(l??1/0,Math.max(i??-1/0,te));r==null||r(re(ie,I))},[e,Q,i,l,I,r]),_e=o.useMemo(()=>{var R,Z;try{const te=new Intl.NumberFormat(h).formatToParts(12345.6),ie=((R=te.find(le=>le.type==="group"))==null?void 0:R.value)??",",oe=((Z=te.find(le=>le.type==="decimal"))==null?void 0:Z.value)??".";return{group:ie,decimal:oe}}catch{return{group:",",decimal:"."}}},[h]),Ue=U??!!_e.group,_t=o.useMemo(()=>{if(!Ue||fe===!1)return ve;const R=_e.decimal,Z=_e.group,te=ve.replace(new RegExp(`[${Z.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}]`,"g"),""),[ie,oe]=te.split(R);if(!ie)return te;const le=ie.replace(/\B(?=(\d{3})+(?!\d))/g,Z);return oe!=null?`${le}${R}${oe}`:le},[ve,fe,Ue,_e]),Te=o.useMemo(()=>e?ne(e,{locale:h}):"",[e,h]),pe=typeof p=="string"?p:void 0,gt=`nice-money-input nice-money-input--${g} nice-money-input--label-${$} nice-money-input--error-${z}`+(pe?" nice-money-input--error":"")+(L?" nice-money-input--disabled":"")+(_?" nice-money-input--loading":"")+(k?` ${k}`:""),xt=R=>{D&&R.key==="Enter"&&A&&(R.preventDefault(),A())},Nt=$==="left"&&j!=null?{width:typeof j=="number"?`${j}px`:j,flex:"none"}:void 0,vt=S!=null?{width:typeof S=="number"?`${S}px`:S,flex:"none"}:void 0;return K?null:n.jsxs("div",{ref:b,className:gt,style:q,title:ae,"data-testid":B,children:[f&&n.jsxs("label",{htmlFor:P,className:"nice-money-input__label",style:Nt,children:[f,w&&n.jsx("span",{className:"nice-money-input__required","aria-hidden":!0,children:"*"})]}),n.jsxs("div",{className:"nice-money-input__row",style:vt,children:[!u&&n.jsx(De,{value:I,compact:!0,options:s?s.map(W).filter(R=>!!R):void 0,onChange:R=>c==null?void 0:c(R),disabled:L||C,className:"nice-money-input__currency","aria-label":O("moneyInput.currency","Currency")}),u&&n.jsx("span",{className:"nice-money-input__symbol","aria-hidden":!0,children:(se==null?void 0:se.symbol)??I}),F&&n.jsx("button",{type:"button",className:"nice-money-input__step nice-money-input__step--down",onClick:()=>Ee(-Re),disabled:L||C||i!=null&&e!=null&&e.amount/Math.pow(10,Q)<=i,"aria-label":O("moneyInput.decreaseAmount","Decrease amount"),tabIndex:-1,children:"−"}),n.jsx("input",{id:P,name:J,type:"text",inputMode:"decimal",autoComplete:"transaction-amount",className:"nice-money-input__amount",value:_t,onChange:ft,onKeyDown:xt,onFocus:R=>{$e(!0),Y==null||Y(R)},onBlur:R=>{$e(!1),e&&be((e.amount/Math.pow(10,Q)).toFixed(Q)),ee==null||ee(R)},placeholder:x??`0${Q>0?"."+"0".repeat(Q):""}`,disabled:L,readOnly:C,required:w,"aria-invalid":!!pe,"aria-describedby":pe||m?`${P}-help`:void 0}),F&&n.jsx("button",{type:"button",className:"nice-money-input__step nice-money-input__step--up",onClick:()=>Ee(Re),disabled:L||C||l!=null&&e!=null&&e.amount/Math.pow(10,Q)>=l,"aria-label":O("moneyInput.increaseAmount","Increase amount"),tabIndex:-1,children:"+"}),_&&n.jsx("span",{className:"nice-money-input__spinner","aria-hidden":!0,children:n.jsx(G.NiceIcon,{name:"refresh",size:14})})]}),X&&Te&&n.jsx("span",{className:"nice-money-input__preview","aria-live":"polite",children:Te}),(pe||m)&&n.jsx("span",{id:`${P}-help`,className:pe?"nice-money-input__error":"nice-money-input__helper",children:pe??m})]})}),Lt={number:"",expiry:"",cvc:""},bt=o.forwardRef(function({value:e=Lt,onChange:r,showHolderName:a=!0,requireHolderName:c,showPostalCode:s=!1,acceptedBrands:u,showBrandIcon:i=!0,size:l="md",disabled:d,readOnly:h,loading:x,accessMode:f,label:m,helperText:p,error:g,required:N,className:y,style:w,id:_,title:v,"data-testid":$},z){const{t:j}=G.useNiceTranslation(),S=f==="hidden",D=d||f==="disabled"||x,A=h||f==="readOnly",X=o.useId(),F=_??`nice-cc-${X}`,[k,q]=o.useState({number:!1,expiry:!1,cvc:!1,holder:!1,postal:!1}),T=o.useMemo(()=>he(e.number),[e.number]),J=o.useMemo(()=>ke(e,{requireHolder:c??a}),[e,c,a]),ae=!u||u.includes(T)||T==="unknown",B=o.useCallback(C=>{const K={...e,...C},ce=ke(K,{requireHolder:c??a});r==null||r(K,ce)},[e,c,a,r]),ee=o.useCallback(C=>{const K=C.target.value.replace(/\D/g,"").slice(0,19);B({number:K})},[B]),Y=o.useCallback(C=>{const K=C.target.value.replace(/\D/g,"").slice(0,4);let ce=K;K.length>=3?ce=`${K.slice(0,2)}/${K.slice(2)}`:K.length===2&&(ce=`${K}/`),B({expiry:ce})},[B]),U=o.useCallback(C=>{const K=C.target.value.replace(/\D/g,"").slice(0,ue(T));B({cvc:K})},[T,B]),E=o.useMemo(()=>ze(e.number,T),[e.number,T]),M=k.number&&e.number.length>0&&(Me(e.number)?ae?void 0:"Card brand not accepted":J.errors.number),b=k.expiry&&e.expiry.length>0&&!Se(e.expiry)?J.errors.expiry:void 0,O=k.cvc&&e.cvc.length>0&&e.cvc.length!==ue(T)?J.errors.cvc:void 0,L=`nice-credit-card nice-credit-card--${l}`+(D?" nice-credit-card--disabled":"")+(x?" nice-credit-card--loading":"")+(g?" nice-credit-card--error":"")+(y?` ${y}`:"");return S?null:n.jsxs("div",{ref:z,className:L,style:w,title:v,"data-testid":$,children:[m&&n.jsxs("div",{className:"nice-credit-card__title",children:[m,N&&n.jsx("span",{className:"nice-credit-card__required","aria-hidden":!0,children:"*"})]}),n.jsx("div",{className:"nice-credit-card__row",children:n.jsxs("label",{className:"nice-credit-card__field nice-credit-card__field--number",children:[n.jsx("span",{className:"nice-credit-card__label",children:j("creditCardInput.cardNumber","Card number")}),n.jsxs("span",{className:"nice-credit-card__input-wrapper",children:[n.jsx("input",{id:`${F}-number`,type:"text",inputMode:"numeric",autoComplete:"cc-number",placeholder:T==="amex"?"3782 822463 10005":"1234 1234 1234 1234",value:E,onChange:ee,onBlur:()=>q(C=>({...C,number:!0})),disabled:D,readOnly:A,"aria-invalid":!!M,"aria-describedby":M?`${F}-number-err`:void 0,className:"nice-credit-card__input",maxLength:T==="amex"?17:23}),i&&n.jsx(zt,{brand:T})]}),M&&n.jsx("span",{id:`${F}-number-err`,className:"nice-credit-card__error",children:M})]})}),n.jsxs("div",{className:"nice-credit-card__row nice-credit-card__row--split",children:[n.jsxs("label",{className:"nice-credit-card__field",children:[n.jsx("span",{className:"nice-credit-card__label",children:j("creditCardInput.expiry","Expiry")}),n.jsx("input",{id:`${F}-expiry`,type:"text",inputMode:"numeric",autoComplete:"cc-exp",placeholder:j("creditCardInput.mmYy","MM/YY"),value:e.expiry,onChange:Y,onBlur:()=>{q(K=>({...K,expiry:!0}));const C=Pe(e.expiry);C&&C!==e.expiry&&B({expiry:C})},disabled:D,readOnly:A,"aria-invalid":!!b,"aria-describedby":b?`${F}-expiry-err`:void 0,className:"nice-credit-card__input",maxLength:5}),b&&n.jsx("span",{id:`${F}-expiry-err`,className:"nice-credit-card__error",children:b})]}),n.jsxs("label",{className:"nice-credit-card__field",children:[n.jsx("span",{className:"nice-credit-card__label",children:T==="amex"?"CID":"CVC"}),n.jsx("input",{id:`${F}-cvc`,type:"text",inputMode:"numeric",autoComplete:"cc-csc",placeholder:"•".repeat(ue(T)),value:e.cvc,onChange:U,onBlur:()=>q(C=>({...C,cvc:!0})),disabled:D,readOnly:A,"aria-invalid":!!O,"aria-describedby":O?`${F}-cvc-err`:void 0,className:"nice-credit-card__input",maxLength:ue(T)}),O&&n.jsx("span",{id:`${F}-cvc-err`,className:"nice-credit-card__error",children:O})]})]}),a&&n.jsx("div",{className:"nice-credit-card__row",children:n.jsxs("label",{className:"nice-credit-card__field",children:[n.jsx("span",{className:"nice-credit-card__label",children:j("creditCardInput.cardholderName","Cardholder name")}),n.jsx("input",{id:`${F}-holder`,type:"text",autoComplete:"cc-name",placeholder:j("creditCardInput.janeDoe","Jane Doe"),value:e.holderName??"",onChange:C=>B({holderName:C.target.value}),onBlur:()=>q(C=>({...C,holder:!0})),disabled:D,readOnly:A,className:"nice-credit-card__input",maxLength:120})]})}),s&&n.jsx("div",{className:"nice-credit-card__row",children:n.jsxs("label",{className:"nice-credit-card__field",children:[n.jsx("span",{className:"nice-credit-card__label",children:j("creditCardInput.postalCode","Postal code")}),n.jsx("input",{id:`${F}-postal`,type:"text",autoComplete:"postal-code",value:e.postalCode??"",onChange:C=>B({postalCode:C.target.value}),onBlur:()=>q(C=>({...C,postal:!0})),disabled:D,readOnly:A,className:"nice-credit-card__input",maxLength:16})]})}),(g||p)&&n.jsx("div",{className:g?"nice-credit-card__form-error":"nice-credit-card__helper",role:g?"alert":void 0,children:g??p})]})}),Fe={visa:"VISA",mastercard:"MasterCard",amex:"AMEX",discover:"Discover",diners:"Diners",jcb:"JCB",unionpay:"UnionPay",maestro:"Maestro",mir:"MIR",elo:"Elo",hipercard:"Hipercard",unknown:""};function zt({brand:t}){return t==="unknown"?null:n.jsx("span",{className:`nice-credit-card__brand nice-credit-card__brand--${t}`,"aria-label":Fe[t],children:Fe[t]})}const Ht=o.forwardRef(function({processor:e,amount:r,editableAmount:a,customer:c,currencies:s,description:u,metadata:i,autoCapture:l=!0,submitLabel:d="Pay",onSuccess:h,onError:x,consents:f,className:m,style:p},g){const{t:N}=G.useNiceTranslation(),[y,w]=o.useState(r),[_,v]=o.useState(r.currency),[$,z]=o.useState({number:"",expiry:"",cvc:""}),[j,S]=o.useState(null),[D,A]=o.useState(!1),[X,F]=o.useState(null),k=ht(e),q=o.useMemo(()=>e.supportedCurrencies==="*"?!0:e.supportedCurrencies.includes(y.currency.toUpperCase()),[e,y.currency]),T=o.useMemo(()=>{var E;const U=(E=e.minimums)==null?void 0:E[y.currency.toUpperCase()];return U==null||y.amount>=U},[e,y]),J=o.useMemo(()=>{var E;const U=(E=e.minimums)==null?void 0:E[y.currency.toUpperCase()];return U==null?null:{amount:U,currency:y.currency}},[e,y.currency]),ae=!!(j!=null&&j.isValid),B=!D&&q&&T&&ae,ee=o.useCallback(async U=>{if(U.preventDefault(),!!B){F(null),A(!0);try{const E={amount:y,card:$,customer:c,description:u,metadata:i,idempotencyKey:Yt()},M=await k.authorize(E);if(l&&M.status==="authorized"){const b=await k.capture(M.id,y);h==null||h(b)}else h==null||h(M)}catch(E){const M=E instanceof Error?E:new Error(String(E));F(M.message),x==null||x(M)}finally{A(!1)}}},[B,y,$,c,u,i,l,k,h,x]),Y=W(y.currency);return n.jsxs("form",{ref:g,className:"nice-payment-form"+(m?` ${m}`:""),style:p,onSubmit:ee,"aria-busy":D,children:[n.jsx("div",{className:"nice-payment-form__amount",children:a?n.jsx(Ie,{label:N("paymentForm.amount","Amount"),value:y,currency:_,currencies:s,onChange:U=>U&&w(U),onCurrencyChange:U=>{v(U),w(E=>({...E,currency:U}))},disabled:D,required:!0,showFormattedPreview:!0}):n.jsxs("div",{className:"nice-payment-form__total",children:[n.jsx("span",{className:"nice-payment-form__total-label",children:N("paymentForm.total","Total")}),n.jsx(Ce,{value:y})]})}),u&&n.jsx("p",{className:"nice-payment-form__description",children:u}),n.jsx("div",{className:"nice-payment-form__card",children:n.jsx(bt,{value:$,onChange:(U,E)=>{z(U),S(E)},disabled:D})}),!q&&n.jsxs("div",{className:"nice-payment-form__warning",role:"alert",children:[e.name," does not accept ",(Y==null?void 0:Y.name)??y.currency,"."]}),!T&&J&&n.jsxs("div",{className:"nice-payment-form__warning",role:"alert",children:[N("paymentForm.minimumChargeForIs","Minimum charge for {name} is").replace("{name}",String(e.name))," ",n.jsx(Ce,{value:J}),"."]}),f&&n.jsx("div",{className:"nice-payment-form__consents",children:f}),X&&n.jsx("div",{className:"nice-payment-form__error",role:"alert",children:X}),n.jsx("button",{type:"submit",className:"nice-payment-form__submit",disabled:!B,"aria-disabled":!B,children:D?"Processing…":d}),n.jsxs("p",{className:"nice-payment-form__processor",children:[N("paymentForm.securedBy","Secured by")," ",n.jsx("strong",{children:e.name})]})]})});function Yt(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`idem_${Date.now().toString(36)}_${Math.random().toString(36).slice(2)}`}const Gt=o.forwardRef(function({price:e,originalPrice:r,period:a,prefix:c,suffix:s,showDiscountBadge:u=!0,size:i="md",locale:l,className:d,style:h},x){const{t:f}=G.useNiceTranslation(),m=r&&r.currency===e.currency&&r.amount>e.amount,p=o.useMemo(()=>!m||!r?null:Math.round((r.amount-e.amount)/r.amount*100),[m,r,e.amount]),g=`nice-price-tag nice-price-tag--${i}`+(d?` ${d}`:"");return n.jsxs("div",{ref:x,className:g,style:h,children:[c&&n.jsx("span",{className:"nice-price-tag__prefix",children:c}),n.jsxs("span",{className:"nice-price-tag__main",children:[n.jsx("span",{className:"nice-price-tag__amount",children:ne(e,{locale:l})}),a&&n.jsx("span",{className:"nice-price-tag__period",children:a})]}),m&&r&&n.jsx("span",{className:"nice-price-tag__original","aria-label":f("priceTag.originalPrice","Original price"),children:n.jsx("s",{children:ne(r,{locale:l})})}),m&&u&&p!=null&&p>0&&n.jsxs("span",{className:"nice-price-tag__discount","aria-label":`${p} percent off`,children:["−",p,"%"]}),s&&n.jsx("span",{className:"nice-price-tag__suffix",children:s})]})}),Zt={amount:0,currency:"USD"},Jt=o.forwardRef(function({source:e,defaultSource:r,onSourceChange:a,targetCurrency:c,defaultTargetCurrency:s,onTargetCurrencyChange:u,provider:i,locale:l,showRateLine:d=!0,className:h,style:x},f){const{t:m}=G.useNiceTranslation(),[p,g]=G.useControllableState({value:e,defaultValue:r,fallbackValue:Zt,onChange:a,componentName:"NiceCurrencyConverter"}),[N,y]=G.useControllableState({value:c,defaultValue:s,fallbackValue:p.currency,onChange:u,componentName:"NiceCurrencyConverter"}),{converted:w,loading:_,error:v}=xe(p,N,i),$=o.useMemo(()=>({amount:Math.pow(10,2),currency:p.currency}),[p.currency]),{converted:z}=xe(d?$:null,N,i);return n.jsxs("div",{ref:f,className:"nice-currency-converter"+(h?` ${h}`:""),style:x,children:[n.jsx("div",{className:"nice-currency-converter__row",children:n.jsx(Ie,{label:m("currencyConverter.from","From"),value:p,onChange:j=>j&&g(j),currency:p.currency,onCurrencyChange:j=>g({...p,currency:j}),showFormattedPreview:!1})}),n.jsxs("div",{className:"nice-currency-converter__row",children:[n.jsx("label",{className:"nice-currency-converter__label",children:"To"}),n.jsxs("div",{className:"nice-currency-converter__output",children:[n.jsx(De,{value:N,onChange:j=>y(j),compact:!0}),n.jsx("span",{className:"nice-currency-converter__amount",children:_?"…":v?"—":w?ne(w,{locale:l}):""})]})]}),d&&z&&n.jsxs("p",{className:"nice-currency-converter__rate",children:["1 ",p.currency," = ",ne(z,{locale:l})," ",n.jsxs("span",{className:"nice-currency-converter__inverse",children:["· 1 ",N," ="," ",ne(re(1/we(z),p.currency),{locale:l})]})]}),v&&n.jsx("p",{className:"nice-currency-converter__error",role:"alert",children:v.message})]})}),Vt=[];function qe(t){return{amount:Math.round(t.amount),currency:t.currency}}const Xt=o.forwardRef(function({lines:e=Vt,locale:r,rounding:a="line",showTotals:c=!0,showGrandTotal:s=!0,hideRateColumn:u=!1,labels:i,density:l="comfortable",className:d,style:h,id:x},f){const m={label:(i==null?void 0:i.label)??"Item",rate:(i==null?void 0:i.rate)??"VAT",net:(i==null?void 0:i.net)??"Net",vat:(i==null?void 0:i.vat)??"Tax",gross:(i==null?void 0:i.gross)??"Gross",total:(i==null?void 0:i.total)??"Total"},p=o.useMemo(()=>{if(a==="total"){const y=new Map;for(const _ of e){let v=y.get(_.vatRate);v||(v=[],y.set(_.vatRate,v)),v.push(_.netAmount)}const w=[];for(const[_,v]of y){const $=v.reduce((S,D)=>de(S,D),re(0,v[0].currency)),z=qe(ge($,_)),j=de($,z);w.push({rate:_,net:$,vat:z,gross:j})}return w}return e.map(y=>{const w=qe(ge(y.netAmount,y.vatRate)),_=de(y.netAmount,w);return{label:y.label,rate:y.vatRate,net:y.netAmount,vat:w,gross:_}})},[e,a]),g=o.useMemo(()=>{if(p.length===0)return null;const y=p[0].net.currency;let w=re(0,y),_=re(0,y),v=re(0,y);for(const $ of p)w=de(w,$.net),_=de(_,$.vat),v=de(v,$.gross);return{net:w,vat:_,gross:v}},[p]),N=y=>ne(y,{locale:r});return n.jsxs("table",{ref:f,id:x,className:`nice-tax-breakdown nice-tax-breakdown--${l} ${d??""}`,style:h,role:"table","aria-label":m.total,children:[n.jsx("thead",{children:n.jsxs("tr",{children:[p.some(y=>y.label!==void 0)&&n.jsx("th",{scope:"col",children:m.label}),!u&&n.jsx("th",{scope:"col",className:"nice-tax-breakdown__rate",children:m.rate}),n.jsx("th",{scope:"col",className:"nice-tax-breakdown__num",children:m.net}),n.jsx("th",{scope:"col",className:"nice-tax-breakdown__num",children:m.vat}),n.jsx("th",{scope:"col",className:"nice-tax-breakdown__num",children:m.gross})]})}),n.jsx("tbody",{children:p.map((y,w)=>n.jsxs("tr",{children:[p.some(_=>_.label!==void 0)&&n.jsx("td",{children:y.label??""}),!u&&n.jsxs("td",{className:"nice-tax-breakdown__rate",children:[(y.rate*100).toLocaleString(r,{maximumFractionDigits:2}),"%"]}),n.jsx("td",{className:"nice-tax-breakdown__num",children:N(y.net)}),n.jsx("td",{className:"nice-tax-breakdown__num",children:N(y.vat)}),n.jsx("td",{className:"nice-tax-breakdown__num",children:N(y.gross)})]},`${y.rate}-${w}`))}),c&&g&&n.jsx("tfoot",{children:s&&n.jsxs("tr",{className:"nice-tax-breakdown__totals",children:[p.some(y=>y.label!==void 0)&&n.jsx("td",{children:m.total}),!u&&n.jsx("td",{children:p.some(y=>y.label!==void 0)?null:m.total}),n.jsx("td",{className:"nice-tax-breakdown__num",children:N(g.net)}),n.jsx("td",{className:"nice-tax-breakdown__num",children:N(g.vat)}),n.jsx("td",{className:"nice-tax-breakdown__num",children:N(g.gross)})]})})]})}),Qt=[],Wt=o.forwardRef(function(e,r){const{t:a}=G.useNiceTranslation(),{methods:c=Qt,value:s,onChange:u,layout:i="list",columns:l=2,currency:d,label:h,name:x,readOnly:f=!1,className:m,style:p,id:g,accessMode:N,"data-testid":y}=e,w=o.useId(),_=x??`nice-pm-${w}`,v=o.useMemo(()=>{if(!d)return c;const S=d.toUpperCase();return c.filter(D=>!D.currencies||D.currencies.map(A=>A.toUpperCase()).includes(S))},[c,d]);if(N==="hidden")return null;const $=f||N==="disabled"||N==="readOnly",z=`nice-payment-method-selector nice-payment-method-selector--${i}`+(m?` ${m}`:""),j=i==="grid"?{gridTemplateColumns:`repeat(${l}, minmax(0, 1fr))`}:void 0;return n.jsxs("div",{ref:r,id:g,className:z,style:p,"data-testid":y,children:[h&&n.jsx("div",{className:"nice-payment-method-selector__label",children:h}),n.jsxs("div",{className:"nice-payment-method-selector__options",style:j,role:"radiogroup","aria-label":h??"Payment method",children:[v.map(S=>{const D=S.id===s,A=$||S.disabled;return n.jsxs("label",{className:"nice-payment-method-selector__option"+(D?" nice-payment-method-selector__option--selected":"")+(A?" nice-payment-method-selector__option--disabled":""),children:[n.jsx("input",{type:"radio",className:"nice-payment-method-selector__radio",name:_,value:S.id,checked:D,disabled:A,onChange:()=>u==null?void 0:u(S.id)}),S.icon&&n.jsx("span",{className:"nice-payment-method-selector__icon",children:S.icon}),n.jsxs("span",{className:"nice-payment-method-selector__text",children:[n.jsx("span",{className:"nice-payment-method-selector__name",children:S.label}),S.description&&n.jsx("span",{className:"nice-payment-method-selector__desc",children:S.description})]})]},S.id)}),v.length===0&&n.jsx("div",{className:"nice-payment-method-selector__empty",children:a("paymentMethodSelector.noMethodsAvailable","No methods available.")})]})]})}),er=[{target:".nice-payment-provider-config",titleKey:"tutorial.paymentProviderConfig.intro.title",title:"Payment provider",contentKey:"tutorial.paymentProviderConfig.intro.content",content:"Pick a provider, fill its credentials (secrets are masked), choose test/live, enable methods and copy the webhook URL.",placement:"auto"}],tr={providerId:"",mode:"test",credentials:{},enabledMethods:[]},rr=o.forwardRef(function(e,r){const{t:a}=G.useNiceTranslation(),{value:c,defaultValue:s,onChange:u,providers:i,onTestConnection:l,showWebhookUrl:d=!0,baseUrl:h,readOnly:x=!1,testLabel:f="Test connection",tutorial:m,className:p,style:g,id:N,accessMode:y,"data-testid":w}=e,[_,v]=G.useControllableState({value:c,defaultValue:s,fallbackValue:tr,onChange:u,componentName:"NicePaymentProviderConfig"}),$=o.useId(),[z,j]=o.useState(new Set),[S,D]=o.useState(!1),[A,X]=o.useState(null),F=o.useMemo(()=>i?i.map(b=>ye[b]).filter(b=>!!b):yt,[i]),k=ye[_.providerId];if(y==="hidden")return null;const q=x||y==="disabled"||y==="readOnly",T=b=>{X(null),j(new Set),v({providerId:b,mode:_.mode,credentials:{},enabledMethods:[]})},J=(b,O)=>{v({..._,credentials:{..._.credentials,[b]:O}})},ae=b=>{const O=new Set(_.enabledMethods??[]);O.has(b)?O.delete(b):O.add(b),v({..._,enabledMethods:[...O]})},B=b=>{j(O=>{const L=new Set(O);return L.has(b)?L.delete(b):L.add(b),L})},ee=async()=>{if(l){D(!0),X(null);try{X(await l(_))}catch(b){X({ok:!1,message:b instanceof Error?b.message:String(b)})}finally{D(!1)}}},Y=k!=null&&k.webhookPath?`${(h??"").replace(/\/$/,"")}${k.webhookPath}`:"",U=(k==null?void 0:k.supportedCurrencies)==="*"?"All currencies":((k==null?void 0:k.supportedCurrencies)??[]).join(", "),E="nice-payment-provider-config"+(p?` ${p}`:""),M=((k==null?void 0:k.credentials)??[]).filter(b=>!b.testOnly||_.mode==="test");return n.jsxs("div",{ref:r,id:N,className:E,style:g,"data-testid":w,children:[m&&n.jsx("div",{className:"nice-payment-provider-config__tutorial",children:n.jsx(G.NiceTutorialButton,{steps:G.resolveTutorial(m,er)})}),n.jsxs("div",{className:"nice-payment-provider-config__row",children:[n.jsxs("label",{className:"nice-payment-provider-config__field",children:[n.jsx("span",{className:"nice-payment-provider-config__field-label",children:a("paymentProviderConfig.provider","Provider")}),n.jsxs("select",{className:"nice-payment-provider-config__select",value:_.providerId,disabled:q,onChange:b=>T(b.target.value),children:[n.jsx("option",{value:"",children:"— select provider —"}),F.map(b=>n.jsx("option",{value:b.id,children:b.name},b.id))]})]}),(k==null?void 0:k.hasTestMode)&&n.jsxs("div",{className:"nice-payment-provider-config__mode",role:"group","aria-label":a("paymentProviderConfig.mode","Mode"),children:[n.jsx("button",{type:"button",className:"nice-payment-provider-config__mode-btn"+(_.mode==="test"?" nice-payment-provider-config__mode-btn--active":""),onClick:()=>v({..._,mode:"test"}),disabled:q,children:a("paymentProviderConfig.test","Test")}),n.jsx("button",{type:"button",className:"nice-payment-provider-config__mode-btn"+(_.mode==="live"?" nice-payment-provider-config__mode-btn--active":""),onClick:()=>v({..._,mode:"live"}),disabled:q,children:a("paymentProviderConfig.live","Live")})]})]}),k&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"nice-payment-provider-config__meta",children:[n.jsx("span",{className:"nice-payment-provider-config__badge",children:k.type}),n.jsx("span",{className:"nice-payment-provider-config__currencies",children:U})]}),n.jsx("div",{className:"nice-payment-provider-config__credentials",children:M.map(b=>{const O=`${$}-${b.key}`,L=b.secret,C=z.has(b.key);return n.jsxs("div",{className:"nice-payment-provider-config__field",children:[n.jsxs("label",{className:"nice-payment-provider-config__field-label",htmlFor:O,children:[b.label,b.required&&n.jsx("span",{className:"nice-payment-provider-config__required",children:" *"})]}),n.jsxs("div",{className:"nice-payment-provider-config__input-wrap",children:[n.jsx("input",{id:O,type:L&&!C?"password":"text",className:"nice-payment-provider-config__input",value:_.credentials[b.key]??"",readOnly:q,autoComplete:L?"new-password":"off",onChange:K=>J(b.key,K.target.value)}),L&&n.jsx("button",{type:"button",className:"nice-payment-provider-config__reveal",onClick:()=>B(b.key),"aria-label":C?"Hide":"Reveal","aria-pressed":C,children:n.jsx(G.NiceIcon,{name:C?"eye-off":"eye",size:14})})]}),b.help&&n.jsx("span",{className:"nice-payment-provider-config__help",children:b.help})]},b.key)})}),k.supportedMethods&&k.supportedMethods.length>0&&n.jsxs("div",{className:"nice-payment-provider-config__methods",children:[n.jsx("span",{className:"nice-payment-provider-config__field-label",children:a("paymentProviderConfig.enabledMethods","Enabled methods")}),n.jsx("div",{className:"nice-payment-provider-config__method-list",children:k.supportedMethods.map(b=>n.jsxs("label",{className:"nice-payment-provider-config__method",children:[n.jsx("input",{type:"checkbox",checked:(_.enabledMethods??[]).includes(b),disabled:q,onChange:()=>ae(b)}),b]},b))})]}),d&&k.webhookPath&&n.jsxs("div",{className:"nice-payment-provider-config__field",children:[n.jsx("span",{className:"nice-payment-provider-config__field-label",children:a("paymentProviderConfig.webhookUrl","Webhook URL")}),n.jsx("code",{className:"nice-payment-provider-config__webhook",children:Y})]}),l&&n.jsxs("div",{className:"nice-payment-provider-config__test",children:[n.jsx("button",{type:"button",className:"nice-payment-provider-config__test-btn",onClick:()=>void ee(),disabled:q||S,children:S?"Testing…":f}),A&&n.jsxs("span",{className:"nice-payment-provider-config__test-result nice-payment-provider-config__test-result--"+(A.ok?"ok":"error"),children:[n.jsx(G.NiceIcon,{name:A.ok?"check":"close",size:14})," ",A.message??(A.ok?"OK":"Failed")]})]})]})]})});exports.EcbRatesProvider=Je;exports.ExchangeRateHostProvider=Ge;exports.FrankfurterProvider=He;exports.FreeForexApiProvider=Ve;exports.MockPaymentProcessor=Qe;exports.NICE_CURRENCY_CATALOG=me;exports.NICE_CURRENCY_CODES=Bt;exports.NICE_PAYMENT_PROCESSORS=pt;exports.NICE_PAYMENT_PROVIDER_LIST=yt;exports.NICE_PAYMENT_PROVIDER_PROFILES=ye;exports.NbpRatesProvider=Ze;exports.NiceCreditCardInput=bt;exports.NiceCurrencyConverter=Jt;exports.NiceCurrencySelector=De;exports.NiceMoney=Ce;exports.NiceMoneyInput=Ie;exports.NicePaymentForm=Ht;exports.NicePaymentMethodSelector=Wt;exports.NicePaymentProviderConfig=rr;exports.NicePriceTag=Gt;exports.NiceTaxBreakdown=Xt;exports.OpenExchangeRatesProvider=Ye;exports.StaticExchangeRateProvider=Rt;exports.addMoney=de;exports.compareMoney=Mt;exports.convertMoney=Xe;exports.createEcbRatesProvider=At;exports.createFreeForexApiProvider=Ut;exports.createNbpRatesProvider=$t;exports.createOpenExchangeRatesProvider=Et;exports.detectCardBrand=he;exports.expectedCvcLength=ue;exports.findCurrency=W;exports.findPaymentProviderProfile=qt;exports.formatCardNumber=ze;exports.formatMoney=ne;exports.fromMoney=we;exports.isExpiryValid=Se;exports.isNegative=St;exports.isZero=Pt;exports.luhnCheck=Me;exports.makeAdyenAdapter=tt;exports.makeAutopayAdapter=lt;exports.makeBlikAdapter=dt;exports.makeBraintreeAdapter=at;exports.makeCoinbaseCommerceAdapter=mt;exports.makeKlarnaAdapter=ut;exports.makeMollieAdapter=nt;exports.makePayPalAdapter=et;exports.makePayUAdapter=st;exports.makePrzelewy24Adapter=it;exports.makeRazorpayAdapter=ct;exports.makeSquareAdapter=rt;exports.makeStripeAdapter=We;exports.makeTpayAdapter=ot;exports.maskCardNumber=It;exports.multiplyMoney=ge;exports.negateMoney=Dt;exports.normaliseExpiry=Pe;exports.parseMoney=Le;exports.registerCurrency=wt;exports.subtractMoney=Be;exports.toMoney=re;exports.useNiceExchangeRate=xe;exports.useNiceMoney=Kt;exports.useNicePayment=ht;exports.validateCreditCard=ke;