moyasar-payment-form 2.0.3 → 2.0.4

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.
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * name: moyasar-payment-form
3
- * version: v2.0.2
3
+ * version: v2.0.4
4
4
  * description: Moyasar payment form utilities
5
- * author: Moyasar Development Team
5
+ * author: Jan Jagieła - Railwaymen Team
6
6
  * homepage: https://docs.moyasar.com/credit-card
7
7
  */
8
8
  const e = {};
package/dist/moyasar.css CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * name: moyasar-payment-form
3
- * version: v2.0.2
3
+ * version: v2.0.4
4
4
  * description: Moyasar payment form utilities
5
- * author: Moyasar Development Team
5
+ * author: Jan Jagieła - Railwaymen Team
6
6
  * homepage: https://docs.moyasar.com/credit-card
7
7
  */
8
8
  *,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.apple-pay-button{-webkit-appearance:-apple-pay-button;-apple-pay-button-style:black;height:2.75rem}.pointer-events-none{pointer-events:none!important}.static{position:static!important}.fixed{position:fixed!important}.absolute{position:absolute!important}.relative{position:relative!important}.inset-0{inset:0!important}.right-2{right:.5rem!important}.top-1\/4{top:25%!important}.z-10{z-index:10!important}.z-\[1\]{z-index:1!important}.z-\[2\]{z-index:2!important}.z-\[9\]{z-index:9!important}.col-span-full{grid-column:1 / -1!important}.mx-auto{margin-left:auto!important;margin-right:auto!important}.-mb-\[3px\]{margin-bottom:-3px!important}.mb-0\.5{margin-bottom:.125rem!important}.mb-4{margin-bottom:1rem!important}.ms-auto{margin-inline-start:auto!important}.box-border{box-sizing:border-box!important}.block{display:block!important}.flex{display:flex!important}.inline-flex{display:inline-flex!important}.grid{display:grid!important}.hidden{display:none!important}.h-11{height:2.75rem!important}.h-4{height:1rem!important}.h-5{height:1.25rem!important}.h-\[22px\]{height:22px!important}.h-\[9px\]{height:9px!important}.max-h-full{max-height:100%!important}.w-4{width:1rem!important}.w-5{width:1.25rem!important}.w-\[9px\]{width:9px!important}.w-auto{width:auto!important}.w-fit{width:-moz-fit-content!important;width:fit-content!important}.w-full{width:100%!important}.min-w-60{min-width:15rem!important}.shrink-0{flex-shrink:0!important}.grow{flex-grow:1!important}.origin-bottom{transform-origin:bottom!important}.-translate-y-1\/2{--tw-translate-y: -50% !important;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-45{--tw-rotate: 45deg !important;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}@keyframes dialog-in-mobile{0%{opacity:0;transform:translateY(1rem)}to{opacity:1;transform:translateY(0)}}.animate-dialog-in-mobile{animation:dialog-in-mobile .3s ease-out 1 normal forwards!important}@keyframes dialog-out-mobile{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(1rem)}}.animate-dialog-out-mobile{animation:dialog-out-mobile .2s ease-in 1 normal forwards!important}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.animate-fade-in{animation:fade-in .3s ease-out 1 normal forwards!important}@keyframes fade-out{0%{opacity:1}to{opacity:0}}.animate-fade-out{animation:fade-out .2s ease-in 1 normal forwards!important}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite!important}.cursor-pointer{cursor:pointer!important}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))!important}.flex-col{flex-direction:column!important}.items-end{align-items:flex-end!important}.items-center{align-items:center!important}.justify-end{justify-content:flex-end!important}.justify-center{justify-content:center!important}.justify-between{justify-content:space-between!important}.gap-1{gap:.25rem!important}.gap-2{gap:.5rem!important}.gap-4{gap:1rem!important}.gap-y-\[1px\]{row-gap:1px!important}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0 !important;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)))!important;margin-bottom:calc(.5rem * var(--tw-space-y-reverse))!important}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0 !important;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)))!important;margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))!important}.rounded-lg{border-radius:.5rem!important}.rounded-md{border-radius:.375rem!important}.rounded-none{border-radius:0!important}.rounded-sm{border-radius:.125rem!important}.rounded-b-none{border-bottom-right-radius:0!important;border-bottom-left-radius:0!important}.rounded-t-lg{border-top-left-radius:.5rem!important;border-top-right-radius:.5rem!important}.rounded-bl-lg{border-bottom-left-radius:.5rem!important}.rounded-br-lg{border-bottom-right-radius:.5rem!important}.border{border-width:1px!important}.border-0{border-width:0px!important}.border-r-\[3px\]{border-right-width:3px!important}.border-t-\[3px\]{border-top-width:3px!important}.border-error{--tw-border-opacity: 1 !important;border-color:rgb(220 39 39 / var(--tw-border-opacity))!important}.border-neutral-300{--tw-border-opacity: 1 !important;border-color:rgb(212 212 212 / var(--tw-border-opacity))!important}.border-red-800{--tw-border-opacity: 1 !important;border-color:rgb(153 27 27 / var(--tw-border-opacity))!important}.border-white{--tw-border-opacity: 1 !important;border-color:rgb(255 255 255 / var(--tw-border-opacity))!important}.bg-black{--tw-bg-opacity: 1 !important;background-color:rgb(26 26 26 / var(--tw-bg-opacity))!important}.bg-error{--tw-bg-opacity: 1 !important;background-color:rgb(220 39 39 / var(--tw-bg-opacity))!important}.bg-gray-500\/75{background-color:#6b7280bf!important}.bg-neutral-300{--tw-bg-opacity: 1 !important;background-color:rgb(212 212 212 / var(--tw-bg-opacity))!important}.bg-primary{--tw-bg-opacity: 1 !important;background-color:rgb(24 63 156 / var(--tw-bg-opacity))!important}.bg-red-100{--tw-bg-opacity: 1 !important;background-color:rgb(254 226 226 / var(--tw-bg-opacity))!important}.bg-red-500\/20{background-color:#ef444433!important}.bg-slate-100{--tw-bg-opacity: 1 !important;background-color:rgb(241 245 249 / var(--tw-bg-opacity))!important}.bg-stc{--tw-bg-opacity: 1 !important;background-color:rgb(95 24 150 / var(--tw-bg-opacity))!important}.bg-success{--tw-bg-opacity: 1 !important;background-color:rgb(40 199 89 / var(--tw-bg-opacity))!important}.object-contain{-o-object-fit:contain!important;object-fit:contain!important}.object-center{-o-object-position:center!important;object-position:center!important}.p-4{padding:1rem!important}.px-3{padding-left:.75rem!important;padding-right:.75rem!important}.px-4{padding-left:1rem!important;padding-right:1rem!important}.py-2{padding-top:.5rem!important;padding-bottom:.5rem!important}.text-center{text-align:center!important}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace!important}.text-base{font-size:1rem!important;line-height:1.5rem!important}.text-sm{font-size:.875rem!important;line-height:1.25rem!important}.text-xl{font-size:1.25rem!important;line-height:1.75rem!important}.text-xs{font-size:.75rem!important;line-height:1rem!important}.font-medium{font-weight:500!important}.uppercase{text-transform:uppercase!important}.leading-4{line-height:1rem!important}.leading-6{line-height:1.5rem!important}.text-black{--tw-text-opacity: 1 !important;color:rgb(26 26 26 / var(--tw-text-opacity))!important}.text-black\/70{color:#1a1a1ab3!important}.text-black\/90{color:#1a1a1ae6!important}.text-error{--tw-text-opacity: 1 !important;color:rgb(220 39 39 / var(--tw-text-opacity))!important}.text-neutral-800\/90{color:#262626e6!important}.text-primary-400{--tw-text-opacity: 1 !important;color:rgb(7 89 133 / var(--tw-text-opacity))!important}.text-red-600{--tw-text-opacity: 1 !important;color:rgb(220 38 38 / var(--tw-text-opacity))!important}.text-white{--tw-text-opacity: 1 !important;color:rgb(255 255 255 / var(--tw-text-opacity))!important}.opacity-25{opacity:.25!important}.opacity-75{opacity:.75!important}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1) !important;--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color) !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)!important}.shadow-input{--tw-shadow: 0 0 0 1px #e0e0e0,0 2px 4px 0 rgba(0,0,0,.07),0 1px 1.5px 0 rgba(0,0,0,.05) !important;--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color), 0 2px 4px 0 var(--tw-shadow-color), 0 1px 1.5px 0 var(--tw-shadow-color) !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)!important}.shadow-input-error{--tw-shadow: 0 0 0 1px #ef9896,0 2px 4px 0 rgba(0,0,0,.07),0 1px 1.5px 0 rgba(0,0,0,.05) !important;--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color), 0 2px 4px 0 var(--tw-shadow-color), 0 1px 1.5px 0 var(--tw-shadow-color) !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)!important}.grayscale{--tw-grayscale: grayscale(100%) !important;filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)!important}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)!important}.transition-all{transition-property:all!important;transition-timing-function:cubic-bezier(.4,0,.2,1)!important;transition-duration:.15s!important}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke!important;transition-timing-function:cubic-bezier(.4,0,.2,1)!important;transition-duration:.15s!important}.transition-opacity{transition-property:opacity!important;transition-timing-function:cubic-bezier(.4,0,.2,1)!important;transition-duration:.15s!important}.duration-200{transition-duration:.2s!important}.duration-300{transition-duration:.3s!important}.placeholder\:text-black\/70::-moz-placeholder{color:#1a1a1ab3!important}.placeholder\:text-black\/70::placeholder{color:#1a1a1ab3!important}.empty\:hidden:empty{display:none!important}.focus\:z-\[2\]:focus{z-index:2!important}.focus\:shadow-input-focus:focus{--tw-shadow: 0 0 0 1px rgba(50,151,211,.3),0 1px 1px 0 rgba(0,0,0,.07),0 0 0 4px rgba(50,151,211,.3) !important;--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color), 0 1px 1px 0 var(--tw-shadow-color), 0 0 0 4px var(--tw-shadow-color) !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)!important}.focus\:outline-none:focus{outline:2px solid transparent!important;outline-offset:2px!important}.disabled\:cursor-default:disabled{cursor:default!important}.disabled\:opacity-70:disabled{opacity:.7!important}@media (min-width: 640px){.sm\:h-5{height:1.25rem!important}}@media (min-width: 768px){.md\:mx-auto{margin-left:auto!important;margin-right:auto!important}.md\:max-w-80{max-width:20rem!important}.md\:max-w-96{max-width:24rem!important}@keyframes dialog-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.md\:animate-dialog-in{animation:dialog-in .3s ease-out 1 normal forwards!important}@keyframes dialog-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.95)}}.md\:animate-dialog-out{animation:dialog-out .2s ease-in 1 normal forwards!important}.md\:justify-center{justify-content:center!important}.md\:rounded-b-lg{border-bottom-right-radius:.5rem!important;border-bottom-left-radius:.5rem!important}}@media (min-width: 1024px){.lg\:max-w-screen-sm{max-width:640px!important}.lg\:p-10{padding:2.5rem!important}}
package/dist/moyasar.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * name: moyasar-payment-form
3
- * version: v2.0.2
3
+ * version: v2.0.4
4
4
  * description: Moyasar payment form utilities
5
- * author: Moyasar Development Team
5
+ * author: Jan Jagieła - Railwaymen Team
6
6
  * homepage: https://docs.moyasar.com/credit-card
7
7
  */
8
8
  var vn = Object.defineProperty, gn = Object.defineProperties;
@@ -310,7 +310,7 @@ function f(e, t, n, r, o, a) {
310
310
  if (typeof e == "function" && (i = e.defaultProps)) for (s in i) u[s] === void 0 && (u[s] = i[s]);
311
311
  return E.vnode && E.vnode(l), l;
312
312
  }
313
- const Jt = "2.0.2", z = it({});
313
+ const Jt = "2.0.4", z = it({});
314
314
  var ue, R, Ge, yt, he = 0, Wt = [], N = E, vt = N.__b, gt = N.__r, bt = N.diffed, wt = N.__c, kt = N.unmount, xt = N.__;
315
315
  function Ne(e, t) {
316
316
  N.__h && N.__h(R, e, he || t), he = 0;
@@ -3081,7 +3081,7 @@ var Lr = function() {
3081
3081
  }, e;
3082
3082
  }();
3083
3083
  const Yr = new qr({
3084
- key: "e4ff3075-0d9e-48cf-a8af-b0443befbbec",
3084
+ key: "95fc54a8-f3ef-454c-b93d-e7e765de19f0",
3085
3085
  revision: Jt
3086
3086
  });
3087
3087
  var Jr = /* @__PURE__ */ function() {
@@ -3137,7 +3137,7 @@ function Qr({ config: e }) {
3137
3137
  minimumFractionDigits: s
3138
3138
  }).format(u), [d, c] = I(O(S({
3139
3139
  version: Jt,
3140
- base_url: "https://apimig.moyasar.com"
3140
+ base_url: "https://api.moyasar.com"
3141
3141
  }, e), {
3142
3142
  translations: Rn(o),
3143
3143
  formattedAmount: l,
@@ -3240,21 +3240,25 @@ const $r = (e) => {
3240
3240
  )), e.currency || G("currency"), e.currency && e.currency.trim().length !== 3 && P("Currency must be in ISO 3166-1 alpha-3 country code format"), e.description || G("description"), e.description && e.description.trim().length === 0 && P("Description can't be empty"), e.callback_url || G("callback_url"), _n(e.callback_url) || ie("Callback URL"), !0), P = (e) => {
3241
3241
  throw window.silentError && console.error(e), new Error(e);
3242
3242
  }, G = (e) => P(`Missing entry: ${e} is required`), ie = (e) => P(`${e} is invalid`), _n = (e) => typeof e == "string" && /^https?:\/\/.+/.test(e), ro = (e, t = !1) => (t && (window.silentError = t), no(e), to(e), eo(e), $r(e), !0), oo = (e) => {
3243
- const t = e.publishable_api_key.startsWith("pk_test") || location.protocol === "http:";
3243
+ const t = e.publishable_api_key.startsWith("pk_test") || location.protocol === "http:", n = e.element;
3244
+ let r;
3245
+ if (typeof n == "string" && (r = document.querySelector(n)), n instanceof Element && (r = n), !r) {
3246
+ console.error(
3247
+ "Moyasar Form [element] config must be a valid query selector or a valid Element instance."
3248
+ );
3249
+ return;
3250
+ }
3244
3251
  try {
3245
3252
  ro(e, t);
3246
3253
  } catch (o) {
3247
- const a = document.createElement("div"), i = "moyasarFallbackRoot";
3248
- a.id = i, document.body.appendChild(a), _t(/* @__PURE__ */ f(() => /* @__PURE__ */ f("div", { class: "mx-auto w-fit rounded-lg border-red-800 bg-red-500/20 p-4 font-mono text-sm leading-6", children: [
3254
+ console.error(o), _t(/* @__PURE__ */ f(() => /* @__PURE__ */ f("div", { class: "mx-auto w-fit rounded-lg border-red-800 bg-red-500/20 p-4 font-mono text-sm leading-6", children: [
3249
3255
  /* @__PURE__ */ f("h2", { class: "mb-4 text-center text-xl font-medium", children: "Form configuration issue!" }),
3250
3256
  /* @__PURE__ */ f("p", { children: "Please check configuration for missing properties or incorrect values." }),
3251
3257
  /* @__PURE__ */ f("p", { children: "Check browser console for more information" })
3252
- ] }), {}), document.getElementById(i));
3258
+ ] }), {}), r);
3253
3259
  return;
3254
3260
  }
3255
- const n = e.element;
3256
- let r;
3257
- typeof n == "string" && (r = document.querySelector(n)), n instanceof Element && (r = n), r && (r.setAttribute("moyasar-payment-form-root", ""), r.setAttribute("lang", e.language), _t(/* @__PURE__ */ f(Qr, { config: e }), r));
3261
+ r.setAttribute("lang", e.language), _t(/* @__PURE__ */ f(Qr, { config: e }), r);
3258
3262
  }, ao = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
3259
3263
  let io = (e = 21) => {
3260
3264
  let t = "", n = crypto.getRandomValues(new Uint8Array(e));
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * name: moyasar-payment-form
3
- * version: v2.0.2
3
+ * version: v2.0.4
4
4
  * description: Moyasar payment form utilities
5
- * author: Moyasar Development Team
5
+ * author: Jan Jagieła - Railwaymen Team
6
6
  * homepage: https://docs.moyasar.com/credit-card
7
7
  */
8
- (function(D,b){typeof exports=="object"&&typeof module!="undefined"?module.exports=b():typeof define=="function"&&define.amd?define(b):(D=typeof globalThis!="undefined"?globalThis:D||self,D.Moyasar=b())})(this,function(){"use strict";var so=Object.defineProperty,lo=Object.defineProperties;var co=Object.getOwnPropertyDescriptors;var He=Object.getOwnPropertySymbols;var mn=Object.prototype.hasOwnProperty,hn=Object.prototype.propertyIsEnumerable;var _n=Math.pow,fn=(D,b,F)=>b in D?so(D,b,{enumerable:!0,configurable:!0,writable:!0,value:F}):D[b]=F,S=(D,b)=>{for(var F in b||(b={}))mn.call(b,F)&&fn(D,F,b[F]);if(He)for(var F of He(b))hn.call(b,F)&&fn(D,F,b[F]);return D},R=(D,b)=>lo(D,co(b));var Ke=(D,b)=>{var F={};for(var V in D)mn.call(D,V)&&b.indexOf(V)<0&&(F[V]=D[V]);if(D!=null&&He)for(var V of He(D))b.indexOf(V)<0&&hn.call(D,V)&&(F[V]=D[V]);return F};var Q=(D,b,F)=>new Promise((V,ve)=>{var Ee=W=>{try{ce(F.next(W))}catch(ue){ve(ue)}},ge=W=>{try{ce(F.throw(W))}catch(ue){ve(ue)}},ce=W=>W.done?V(W.value):Promise.resolve(W.value).then(Ee,ge);ce((F=F.apply(D,b)).next())});var D,b,F,V,ve,Ee,ge,ce,W,ue,pt,be={},ft=[],yn=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Se=Array.isArray;function oe(e,t){for(var n in t)e[n]=t[n];return e}function mt(e){var t=e.parentNode;t&&t.removeChild(e)}function Ze(e,t,n){var r,o,a,i={};for(a in t)a=="key"?r=t[a]:a=="ref"?o=t[a]:i[a]=t[a];if(arguments.length>2&&(i.children=arguments.length>3?D.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)i[a]===void 0&&(i[a]=e.defaultProps[a]);return Ce(e,i,r,o,null)}function Ce(e,t,n,r,o){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o==null?++F:o,__i:-1,__u:0};return o==null&&b.vnode!=null&&b.vnode(a),a}function ae(e){return e.children}function $(e,t){this.props=e,this.context=t}function de(e,t){if(t==null)return e.__?de(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?de(e):null}function ht(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return ht(e)}}function qe(e){(!e.__d&&(e.__d=!0)&&V.push(e)&&!Ae.__r++||ve!==b.debounceRendering)&&((ve=b.debounceRendering)||Ee)(Ae)}function Ae(){var e,t,n,r,o,a,i,s;for(V.sort(ge);e=V.shift();)e.__d&&(t=V.length,r=void 0,a=(o=(n=e).__v).__e,i=[],s=[],n.__P&&((r=oe({},o)).__v=o.__v+1,b.vnode&&b.vnode(r),Ye(n.__P,r,o,n.__n,n.__P.namespaceURI,32&o.__u?[a]:null,i,a==null?de(o):a,!!(32&o.__u),s),r.__v=o.__v,r.__.__k[r.__i]=r,bt(i,r,s),r.__e!=a&&ht(r)),V.length>t&&V.sort(ge));Ae.__r=0}function _t(e,t,n,r,o,a,i,s,u,l,d){var c,_,p,y,g,m=r&&r.__k||ft,h=t.length;for(n.__d=u,vn(n,t,m),u=n.__d,c=0;c<h;c++)(p=n.__k[c])!=null&&typeof p!="boolean"&&typeof p!="function"&&(_=p.__i===-1?be:m[p.__i]||be,p.__i=c,Ye(e,p,_,o,a,i,s,u,l,d),y=p.__e,p.ref&&_.ref!=p.ref&&(_.ref&&Je(_.ref,null,p),d.push(p.ref,p.__c||y,p)),g==null&&y!=null&&(g=y),65536&p.__u||_.__k===p.__k?(u&&typeof p.type=="string"&&!e.contains(u)&&(u=de(_)),u=yt(p,u,e)):typeof p.type=="function"&&p.__d!==void 0?u=p.__d:y&&(u=y.nextSibling),p.__d=void 0,p.__u&=-196609);n.__d=u,n.__e=g}function vn(e,t,n){var r,o,a,i,s,u=t.length,l=n.length,d=l,c=0;for(e.__k=[],r=0;r<u;r++)i=r+c,(o=e.__k[r]=(o=t[r])==null||typeof o=="boolean"||typeof o=="function"?null:typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?Ce(null,o,null,null,null):Se(o)?Ce(ae,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?Ce(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)!=null?(o.__=e,o.__b=e.__b+1,s=gn(o,n,i,d),o.__i=s,a=null,s!==-1&&(d--,(a=n[s])&&(a.__u|=131072)),a==null||a.__v===null?(s==-1&&c--,typeof o.type!="function"&&(o.__u|=65536)):s!==i&&(s==i-1?c=s-i:s==i+1?c++:s>i?d>u-i?c+=s-i:c--:s<i&&c++,s!==r+c&&(o.__u|=65536))):(a=n[i])&&a.key==null&&a.__e&&!(131072&a.__u)&&(a.__e==e.__d&&(e.__d=de(a)),We(a,a,!1),n[i]=null,d--);if(d)for(r=0;r<l;r++)(a=n[r])!=null&&!(131072&a.__u)&&(a.__e==e.__d&&(e.__d=de(a)),We(a,a))}function yt(e,t,n){var r,o;if(typeof e.type=="function"){for(r=e.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=e,t=yt(r[o],t,n));return t}e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType===8);return t}function Te(e,t){return t=t||[],e==null||typeof e=="boolean"||(Se(e)?e.some(function(n){Te(n,t)}):t.push(e)),t}function gn(e,t,n,r){var o=e.key,a=e.type,i=n-1,s=n+1,u=t[n];if(u===null||u&&o==u.key&&a===u.type&&!(131072&u.__u))return n;if(r>(u!=null&&!(131072&u.__u)?1:0))for(;i>=0||s<t.length;){if(i>=0){if((u=t[i])&&!(131072&u.__u)&&o==u.key&&a===u.type)return i;i--}if(s<t.length){if((u=t[s])&&!(131072&u.__u)&&o==u.key&&a===u.type)return s;s++}}return-1}function vt(e,t,n){t[0]==="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":typeof n!="number"||yn.test(t)?n:n+"px"}function De(e,t,n,r,o){var a;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||vt(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||vt(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")a=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in e||t==="onFocusOut"||t==="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=n,n?r?n.u=r.u:(n.u=ce,e.addEventListener(t,a?ue:W,a)):e.removeEventListener(t,a?ue:W,a);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n==null?"":n;break e}catch(i){}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function gt(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=ce++;else if(t.t<n.u)return;return n(b.event?b.event(t):t)}}}function Ye(e,t,n,r,o,a,i,s,u,l){var d,c,_,p,y,g,m,h,v,x,k,w,P,A,T,B,C=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(u=!!(32&n.__u),a=[s=t.__e=n.__e]),(d=b.__b)&&d(t);e:if(typeof C=="function")try{if(h=t.props,v="prototype"in C&&C.prototype.render,x=(d=C.contextType)&&r[d.__c],k=d?x?x.props.value:d.__:r,n.__c?m=(c=t.__c=n.__c).__=c.__E:(v?t.__c=c=new C(h,k):(t.__c=c=new $(h,k),c.constructor=C,c.render=wn),x&&x.sub(c),c.props=h,c.state||(c.state={}),c.context=k,c.__n=r,_=c.__d=!0,c.__h=[],c._sb=[]),v&&c.__s==null&&(c.__s=c.state),v&&C.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=oe({},c.__s)),oe(c.__s,C.getDerivedStateFromProps(h,c.__s))),p=c.props,y=c.state,c.__v=t,_)v&&C.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),v&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(v&&C.getDerivedStateFromProps==null&&h!==p&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(h,k),!c.__e&&(c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(h,c.__s,k)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(c.props=h,c.state=c.__s,c.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(O){O&&(O.__=t)}),w=0;w<c._sb.length;w++)c.__h.push(c._sb[w]);c._sb=[],c.__h.length&&i.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(h,c.__s,k),v&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(p,y,g)})}if(c.context=k,c.props=h,c.__P=e,c.__e=!1,P=b.__r,A=0,v){for(c.state=c.__s,c.__d=!1,P&&P(t),d=c.render(c.props,c.state,c.context),T=0;T<c._sb.length;T++)c.__h.push(c._sb[T]);c._sb=[]}else do c.__d=!1,P&&P(t),d=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++A<25);c.state=c.__s,c.getChildContext!=null&&(r=oe(oe({},r),c.getChildContext())),v&&!_&&c.getSnapshotBeforeUpdate!=null&&(g=c.getSnapshotBeforeUpdate(p,y)),_t(e,Se(B=d!=null&&d.type===ae&&d.key==null?d.props.children:d)?B:[B],t,n,r,o,a,i,s,u,l),c.base=t.__e,t.__u&=-161,c.__h.length&&i.push(c),m&&(c.__E=c.__=null)}catch(O){t.__v=null,u||a!=null?(t.__e=s,t.__u|=u?160:32,a[a.indexOf(s)]=null):(t.__e=n.__e,t.__k=n.__k),b.__e(O,t,n)}else a==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=bn(n.__e,t,n,r,o,a,i,u,l);(d=b.diffed)&&d(t)}function bt(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)Je(n[r],n[++r],n[++r]);b.__c&&b.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(a){a.call(o)})}catch(a){b.__e(a,o.__v)}})}function bn(e,t,n,r,o,a,i,s,u){var l,d,c,_,p,y,g,m=n.props,h=t.props,v=t.type;if(v==="svg"?o="http://www.w3.org/2000/svg":v==="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),a!=null){for(l=0;l<a.length;l++)if((p=a[l])&&"setAttribute"in p==!!v&&(v?p.localName===v:p.nodeType===3)){e=p,a[l]=null;break}}if(e==null){if(v===null)return document.createTextNode(h);e=document.createElementNS(o,v,h.is&&h),a=null,s=!1}if(v===null)m===h||s&&e.data===h||(e.data=h);else{if(a=a&&D.call(e.childNodes),m=n.props||be,!s&&a!=null)for(m={},l=0;l<e.attributes.length;l++)m[(p=e.attributes[l]).name]=p.value;for(l in m)if(p=m[l],l!="children"){if(l=="dangerouslySetInnerHTML")c=p;else if(l!=="key"&&!(l in h)){if(l=="value"&&"defaultValue"in h||l=="checked"&&"defaultChecked"in h)continue;De(e,l,null,p,o)}}for(l in h)p=h[l],l=="children"?_=p:l=="dangerouslySetInnerHTML"?d=p:l=="value"?y=p:l=="checked"?g=p:l==="key"||s&&typeof p!="function"||m[l]===p||De(e,l,p,m[l],o);if(d)s||c&&(d.__html===c.__html||d.__html===e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(c&&(e.innerHTML=""),_t(e,Se(_)?_:[_],t,n,r,v==="foreignObject"?"http://www.w3.org/1999/xhtml":o,a,i,a?a[0]:n.__k&&de(n,0),s,u),a!=null)for(l=a.length;l--;)a[l]!=null&&mt(a[l]);s||(l="value",y!==void 0&&(y!==e[l]||v==="progress"&&!y||v==="option"&&y!==m[l])&&De(e,l,y,m[l],o),l="checked",g!==void 0&&g!==e[l]&&De(e,l,g,m[l],o))}return e}function Je(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){b.__e(r,n)}}function We(e,t,n){var r,o;if(b.unmount&&b.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||Je(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(a){b.__e(a,t)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&We(r[o],t,n||typeof e.type!="function");n||e.__e==null||mt(e.__e),e.__c=e.__=e.__e=e.__d=void 0}function wn(e,t,n){return this.constructor(e,n)}function wt(e,t,n){var r,o,a,i;b.__&&b.__(e,t),o=(r=typeof n=="function")?null:t.__k,a=[],i=[],Ye(t,e=(!r&&n||t).__k=Ze(ae,null,[e]),o||be,be,t.namespaceURI,!r&&n?[n]:o?null:t.firstChild?D.call(t.childNodes):null,a,!r&&n?n:o?o.__e:t.firstChild,r,i),bt(a,e,i)}function Xe(e,t){var n={__c:t="__cC"+pt++,__:e,Consumer:function(r,o){return r.children(o)},Provider:function(r){var o,a;return this.getChildContext||(o=[],(a={})[t]=this,this.getChildContext=function(){return a},this.componentWillUnmount=function(){o=null},this.shouldComponentUpdate=function(i){this.props.value!==i.value&&o.some(function(s){s.__e=!0,qe(s)})},this.sub=function(i){o.push(i);var s=i.componentWillUnmount;i.componentWillUnmount=function(){o&&o.splice(o.indexOf(i),1),s&&s.call(i)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}D=ft.slice,b={__e:function(e,t,n,r){for(var o,a,i;t=t.__;)if((o=t.__c)&&!o.__)try{if((a=o.constructor)&&a.getDerivedStateFromError!=null&&(o.setState(a.getDerivedStateFromError(e)),i=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),i=o.__d),i)return o.__E=o}catch(s){e=s}throw e}},F=0,$.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=oe({},this.state),typeof e=="function"&&(e=e(oe({},n),this.props)),e&&oe(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),qe(this))},$.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),qe(this))},$.prototype.render=ae,V=[],Ee=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ge=function(e,t){return e.__v.__b-t.__v.__b},Ae.__r=0,ce=0,W=gt(!1),ue=gt(!0),pt=0;var kn=0;function f(e,t,n,r,o,a){t||(t={});var i,s,u=t;if("ref"in u)for(s in u={},t)s=="ref"?i=t[s]:u[s]=t[s];var l={type:e,props:u,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--kn,__i:-1,__u:0,__source:o,__self:a};if(typeof e=="function"&&(i=e.defaultProps))for(s in i)u[s]===void 0&&(u[s]=i[s]);return b.vnode&&b.vnode(l),l}const kt="2.0.2",z=Xe({});var me,I,Qe,xt,we=0,Pt=[],U=b,Et=U.__b,St=U.__r,Ct=U.diffed,At=U.__c,Tt=U.unmount,Dt=U.__;function Me(e,t){U.__h&&U.__h(I,e,we||t),we=0;var n=I.__H||(I.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function N(e){return we=1,xn(It,e)}function xn(e,t,n){var r=Me(me++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):It(void 0,t),function(s){var u=r.__N?r.__N[0]:r.__[0],l=r.t(u,s);u!==l&&(r.__N=[l,r.__[1]],r.__c.setState({}))}],r.__c=I,!I.u)){var o=function(s,u,l){if(!r.__c.__H)return!0;var d=r.__c.__H.__.filter(function(_){return!!_.__c});if(d.every(function(_){return!_.__N}))return!a||a.call(this,s,u,l);var c=!1;return d.forEach(function(_){if(_.__N){var p=_.__[0];_.__=_.__N,_.__N=void 0,p!==_.__[0]&&(c=!0)}}),!(!c&&r.__c.props===s)&&(!a||a.call(this,s,u,l))};I.u=!0;var a=I.shouldComponentUpdate,i=I.componentWillUpdate;I.componentWillUpdate=function(s,u,l){if(this.__e){var d=a;a=void 0,o(s,u,l),a=d}i&&i.call(this,s,u,l)},I.shouldComponentUpdate=o}return r.__N||r.__}function Z(e,t){var n=Me(me++,3);!U.__s&&Rt(n.__H,t)&&(n.__=e,n.i=t,I.__H.__h.push(n))}function ee(e){return we=5,pe(function(){return{current:e}},[])}function pe(e,t){var n=Me(me++,7);return Rt(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Mt(e,t){return we=8,pe(function(){return e},t)}function L(e){var t=I.context[e.__c],n=Me(me++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(I)),t.props.value):e.__}function Pn(){for(var e;e=Pt.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Oe),e.__H.__h.forEach($e),e.__H.__h=[]}catch(t){e.__H.__h=[],U.__e(t,e.__v)}}U.__b=function(e){I=null,Et&&Et(e)},U.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Dt&&Dt(e,t)},U.__r=function(e){St&&St(e),me=0;var t=(I=e.__c).__H;t&&(Qe===I?(t.__h=[],I.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.i=n.__N=void 0})):(t.__h.forEach(Oe),t.__h.forEach($e),t.__h=[],me=0)),Qe=I},U.diffed=function(e){Ct&&Ct(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Pt.push(t)!==1&&xt===U.requestAnimationFrame||((xt=U.requestAnimationFrame)||En)(Pn)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.i=void 0})),Qe=I=null},U.__c=function(e,t){t.some(function(n){try{n.__h.forEach(Oe),n.__h=n.__h.filter(function(r){return!r.__||$e(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],U.__e(r,n.__v)}}),At&&At(e,t)},U.unmount=function(e){Tt&&Tt(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{Oe(r)}catch(o){t=o}}),n.__H=void 0,t&&U.__e(t,n.__v))};var Ot=typeof requestAnimationFrame=="function";function En(e){var t,n=function(){clearTimeout(r),Ot&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Ot&&(t=requestAnimationFrame(n))}function Oe(e){var t=I,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),I=t}function $e(e){var t=I;e.__c=e.__(),I=t}function Rt(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function It(e,t){return typeof t=="function"?t(e):t}function Y(){const{language:e,translations:t}=L(z);function n(r){if(!t)return r;const o=t[e][r];return o||t.en[r]||r}return{t:n}}const Sn=()=>{const{t:e}=Y(),{isTestMode:t}=L(z);return f("footer",{class:"flex flex-col items-center gap-4 text-xs",children:[f("a",{href:"https://moyasar.com/?ref=payment-form-v1.14.0",target:"_blank",class:"text-black/70",children:[e("form.powered_by")," ",f("strong",{children:e("common.moyasar")})]}),t&&f("span",{class:"text-red-600",children:e("common.test_mode_disclaimer")})]})},Cn={"error.authentication_error":"خطأ في المصادقة، الخدمة غير متوفرة حالياً","error.authorization_error":"خطأ في التفويض، الخدمة غير متوفرة حالياً","error.network":"خطأ في الشبكة","error.unknown":"حدث خطأ غير متوقع","error.invalid_mobile":"رقم الجوال غير صحيح","error.invalid_otp":"رمز التحقق غير صحيح","error.invalid_request_error":"طلب دفع غير صحيح","error.mobile_not_registered":"رقم الجوال غير مسجل","error.account_inactive_error":"حساب التاجر غير نشط","error.invalid_name":"يجب إدخال الاسم الأول والأخير","error.unsupported_cc_type":"نوع البطاقة الإئتمانية غير مدعوم","error.invalid_cc_number":"رقم البطاقة الإئتمانية غير صحيح","error.invalid_date":"تاريخ الإنتهاء غير صحيح","error.invalid_month":"شهر الإنتهاء غير صحيح","error.invalid_year":"سنة الإنتهاء غير صحيحة","error.invalid_csc":"رمز الأمان للبطاقة غير صحيح","error.cant_start_payment":"خطأ في بدء عملية الدفع، يرجى المحاولة لاحقاً","error.otp_time_out":"انتهت مدة رمز التحقق، يرجى المحاولة مرة أخرى","error.api_error":"حدث خطأ، يرجى تحديث الصفحة والمحاولة مرة أخرى","error.applePay":"تعذر الاتصال أو تفويض العملية","error.m070":"غير مسموح للتاجر بإجراء عمليات في نظام 3Ds","error.m071":"غير مسموح للتاجر بإجراء عمليات مباشرة بدون نظام 3Ds","error.m072":"لا يوجد للبائع حساب بنكي فعال","error.m074":"بلد البطاقة الائتمانية غير مسموح به","error.m075":"حساب التاجر غير مشترك في فواتير ميسر","error.m076":"حساب التاجر غير مسموح له باستخدام طريقة الدفع هذه","error.m077":"حساب التاجر لا يمكنه استخدام طريقة دفع STC Pay","form.cc":"بطاقة ائتمانية","form.code":"الرمز","form.mobile":"رقم الجوال","form.otp":"رمز التحقق","form.required":"مطلوب","form.name_on_card":"الاسم على البطاقة","form.last_name":"اسم العائلة","form.card_info":"معلومات البطاقة","form.date":"تاريخ الانتهاء","form.csc":"رمز التحقق CVC","form.or_pay_with_card":"أو ادفع بالبطاقة","form.powered_by":"مدعوم بواسطة","form.save_card_notice":"سيتم حفظ بيانات بطاقتك عند الإرسال","button.pay":"ادفع","button.pay-with":"ادفع باستخدام","button.buy":"اشتر باستخدام","button.donate":"تبرع باستخدام","button.book":"احجز باستخدام","button.check-out":"اتمام الشراء باستخدام","button.subscribe":"اشترك باستخدام","button.add-money":"أضف رصيد باستخدام","button.contribute":"ساهم باستخدام","button.order":"اطلب باستخدام","button.reload":"أعد الشحن باستخدام","button.rent":"استأجر باستخدام","button.support":"ادعم باستخدام","button.tip":"اترك إكرامية باستخدام","button.top-up":"اشحن باستخدام","button.continue":"المتابعة للدفع","button.verify":"تحقق","button.proceed":"متابعة","button.cancel":"إلغاء","validation.is_invalid":":attr غير صحيح","validation.can_t_be_blank":":attr مطلوب","validation.should_be_english_letters_only":"الاسم يجب أن يحتوي على أحرف إنجليزية ومسافات فقط","validation.first_and_last_name_required":"يجب إدخال الاسم الأول والأخير","common.moyasar":"ميسر","common.test_mode_disclaimer":"وضع الاختبار مفعل: يرجى عدم الاستخدام في بيئة غير تجريبية!"},An={"error.authentication_error":"Authentication error, service is unavailable now","error.authorization_error":"Authorization error, service is unavailable now","error.network":"Network Error","error.unknown":"Unexpected error occurred","error.invalid_mobile":"Invalid mobile number","error.invalid_otp":"Invalid verification code","error.invalid_request_error":"Invalid payment request","error.mobile_not_registered":"Mobile number is not registered","error.account_inactive_error":"Merchant account is not active","error.invalid_name":"First and last names are required","error.unsupported_cc_type":"Unsupported card type","error.invalid_cc_number":"Invalid credit card","error.invalid_date":"Invalid date","error.invalid_month":"Invalid month","error.invalid_year":"Invalid year","error.invalid_csc":"Invalid CVC number","error.cant_start_payment":"Error initiating payment, please try again later","error.otp_time_out":"OTP time has finished, please try again","error.api_error":"An error has occurred, please refresh the page and try again.","error.applePay":"Unable to connect or authorize transaction","error.m070":"Merchant is not allowed to transact in 3Ds","error.m071":"Merchant is not allowed to transact directly without 3Ds","error.m072":"Merchant does not have bank MID specified","error.m074":"Credit card country is not allowed","error.m075":"Merchant account is not subscribed to Moyasar invoices","error.m076":"Merchant account is not allowed to use this payment method","error.m077":"Merchant account cannot use stc pay method","form.cc":"Credit Card","form.code":"Code","form.mobile":"Mobile number","form.otp":"Verification code","form.required":"Required","form.name_on_card":"Name on card","form.last_name":"Last name","form.card_info":"Card information","form.date":"Expiry date","form.csc":"CVC","form.or_pay_with_card":"Or pay with card","form.powered_by":"Powered by","form.save_card_notice":"You card data will be saved upon submit.","button.pay":"Pay","button.pay-with":"Pay with","button.buy":"Buy with","button.donate":"Donate with","button.book":"Book with","button.check-out":"Check out with","button.subscribe":"Subscribe with","button.add-money":"Add money with","button.contribute":"Contribute with","button.order":"Order with","button.reload":"Reload with","button.rent":"Rent with","button.support":"Support with","button.tip":"Tip with","button.top-up":"Top Up with","button.continue":"Continue with payment","button.verify":"Verify","button.proceed":"Proceed","button.cancel":"Cancel","validation.is_invalid":"Invalid :attr","validation.can_t_be_blank":":attr is required","validation.should_be_english_letters_only":"Name may only have English alphabet and spaces","validation.first_and_last_name_required":"Both first and last name are required","common.moyasar":"Moyasar","common.test_mode_disclaimer":"Test Mode Enabled: Please do not use in production!"},Tn=e=>{const t={en:An,ar:Cn};return e&&Object.entries(e).forEach(([n,r])=>{t[n]||(t[n]={}),Object.entries(r).forEach(([o,a])=>{t[n][o]=a})}),t},Dn="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%20450%20133'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;'%3e%3cg%3e%3cpath%20d='M291.862,97.715l0,-69.89l11.852,0l0,5.604c3.607,-4.509%208.954,-6.957%2015.588,-6.957c13.656,0%2023.447,10.886%2023.447,26.474c0,15.588%20-9.855,26.668%20-23.447,26.668c-6.699,0%20-11.981,-2.577%20-15.588,-7.086l0,25.186l-11.852,0l0,0.001Zm11.853,-51.209l-0,12.883c2.512,5.218%207.021,9.018%2013.527,9.018c7.859,0%2013.141,-5.862%2013.141,-15.524c-0,-9.533%20-5.282,-15.331%20-13.141,-15.331c-6.506,0.064%20-11.015,3.607%20-13.527,8.954'%20style='fill:%2302aa7c;fill-rule:nonzero;'/%3e%3cpath%20d='M350.415,63.769c0,-8.503%205.282,-14.429%2014.042,-15.524l20.162,-2.577l0,-2.512c0,-3.027%20-1.546,-4.638%20-4.38,-4.638l-25.315,0l0,-10.757l25.766,0c10.242,0%2015.846,5.024%2015.846,13.914l0,36.394l-11.981,0l0,-6.119c-3.478,4.896%20-9.211,7.665%20-16.619,7.665c-10.435,0%20-17.521,-6.377%20-17.521,-15.846m20.419,6.183c6.055,0%2011.659,-3.414%2013.72,-8.438l0,-6.313l-15.395,2.126c-4.251,0.58%20-6.635,2.834%20-6.635,6.506c0.001,3.929%203.028,6.119%208.31,6.119'%20style='fill:%2302aa7c;fill-rule:nonzero;'/%3e%3cpath%20d='M405.167,86.958l8.632,0c3.285,0%204.767,-1.353%205.862,-4.445l1.546,-4.445l-18.294,-50.308l12.368,0l11.401,35.042l0.258,0l10.886,-35.042l12.174,0l-20.033,57.78c-2.705,7.923%20-6.313,12.174%20-15.137,12.174l-9.662,0l-0.001,-10.756Z'%20style='fill:%2302aa7c;fill-rule:nonzero;'/%3e%3cpath%20d='M43.48,132.306c13.785,0%2025.122,-4.316%2032.594,-11.53c5.604,-5.54%208.889,-13.012%208.889,-21.643c0,-7.794%20-2.899,-14.815%20-8.245,-20.162c-5.346,-5.347%20-13.012,-9.276%20-22.674,-11.144l-15.846,-3.092c-6.57,-1.224%20-10.306,-4.509%20-10.306,-9.082c0,-5.991%205.797,-10.113%2015.073,-10.113c5.797,0%2010.757,1.868%2014.042,5.153c2.061,2.255%203.478,5.153%203.929,8.438l22.867,-5.153c-0.644,-6.57%20-3.736,-12.368%20-8.438,-17.134c-7.536,-7.408%20-19.067,-12.11%20-32.658,-12.11c-12.561,0%20-23.06,4.123%20-30.339,10.693c-6.184,5.797%20-9.662,13.591%20-9.662,22.287c0,7.601%202.448,14.042%207.408,18.938c4.96,4.96%2012.174,8.632%2021.643,10.95l15.653,3.736c7.859,1.868%2011.337,4.767%2011.337,9.92c0,6.377%20-5.797,10.113%20-15.266,10.113c-6.828,0%20-12.368,-2.255%20-15.846,-5.991c-2.448,-2.448%20-3.929,-5.797%20-4.123,-9.469l-23.512,5.154c0.644,7.021%203.929,13.205%208.889,18.165c7.794,8.18%2020.42,13.076%2034.591,13.076m174.048,0c15.266,0%2026.99,-5.54%2035.041,-13.398c6.377,-6.184%2010.306,-13.398%2012.368,-20.806l-24.091,-8.052c-1.031,3.736%20-3.092,7.665%20-6.377,10.693c-3.929,3.736%20-9.276,6.377%20-16.941,6.377c-7.021,0%20-13.591,-2.705%20-18.358,-7.408c-4.767,-4.96%20-7.665,-12.174%20-7.665,-21.257c-0,-9.276%202.899,-16.297%207.665,-21.257c4.702,-4.767%2011.144,-7.214%2018.165,-7.214c7.408,-0%2012.561,2.448%2016.297,6.184c3.092,3.092%204.96,7.021%206.184,10.95l24.542,-8.245c-1.868,-7.214%20-5.797,-14.429%20-11.53,-20.419c-8.245,-8.052%20-20.226,-13.785%20-36.072,-13.785c-14.622,-0%20-27.827,5.54%20-37.296,15.073c-9.469,9.662%20-15.266,23.125%20-15.266,38.778c0,15.653%205.991,29.051%2015.653,38.778c9.403,9.468%2022.801,15.008%2037.681,15.008m-83.288,0c10.693,0%2018.358,-3.285%2021.643,-6.184l0,-22.287c-2.512,1.868%20-7.408,4.123%20-13.849,4.123c-4.573,0%20-7.859,-1.031%20-10.306,-3.285c-2.061,-2.061%20-3.092,-5.604%20-3.092,-10.306l0,-94.367l-27.247,0l0,27.827l54.43,0l0,26.41l-54.43,0l0,46.829c0,9.469%202.899,17.134%208.052,22.481c5.797,5.667%2014.299,8.759%2024.799,8.759'%20style='fill:%23fff;fill-rule:nonzero;'/%3e%3c/g%3e%3c/svg%3e";function Nt(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Nt(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Mn(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Nt(e))&&(r&&(r+=" "),r+=t);return r}const ie=(...e)=>Mn(e),et=e=>{const p=e,{children:t,type:n="button",variant:r="primary",onClick:o,disabled:a,busy:i,fail:s,success:u}=p,l=Ke(p,["children","type","variant","onClick","disabled","busy","fail","success"]),{isProcessing:d}=L(z),c={primary:"bg-primary text-white",stc:"bg-stc text-white",error:"bg-error text-white pointer-events-none",success:"bg-success text-white"};function _(){return s?c.error:u?c.success:c[r]}return f("button",R(S({},l),{type:n,disabled:d||a,onClick:o,class:ie(["flex h-11 w-full cursor-pointer items-center justify-center gap-2 rounded-lg px-3 py-2 transition-colors disabled:cursor-default disabled:opacity-70",_(),e.class,d&&!s&&"pointer-events-none grayscale"]),children:[s?f("svg",{class:"h-5 w-5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[f("circle",{cx:"12",cy:"12",r:"10"}),f("path",{d:"m15 9-6 6"}),f("path",{d:"m9 9 6 6"})]}):t,i&&f("svg",{class:"h-4 w-4 animate-spin text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[f("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),f("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),u&&f("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"h-4 w-4",children:[f("path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5"}),f("path",{class:"animate-fade-in",d:"m9 11 3 3L22 4"})]})]}))},he=e=>{const u=e,{name:t,placeholder:n,type:r="text",onBlur:o,disabled:a}=u,i=Ke(u,["name","placeholder","type","onBlur","disabled"]),{isProcessing:s}=L(z);return f("input",R(S({},i),{dir:"ltr",id:t,name:t,disabled:s||a,class:ie(["relative block w-full rounded-lg border-0 px-4 py-2 text-sm text-black shadow-input placeholder:text-black/70 focus:z-[2] focus:shadow-input-focus focus:outline-none",e.class,s&&"pointer-events-none grayscale",e.error&&"z-[1] shadow-input-error"]),type:r,placeholder:n,onBlur:l=>{const d=l.target;d.classList.add("shadow-input-error","z-[1]"),d.value.trim()&&d.classList.remove("shadow-input-error","z-[1]"),o&&typeof o=="function"&&o(l)}}))},tt=Xe({});function On(e,t){for(var n in t)e[n]=t[n];return e}function Ft(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function Ut(e,t){this.props=e,this.context=t}(Ut.prototype=new $).isPureReactComponent=!0,Ut.prototype.shouldComponentUpdate=function(e,t){return Ft(this.props,e)||Ft(this.state,t)};var Lt=b.__b;b.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Lt&&Lt(e)};var Rn=b.__e;b.__e=function(e,t,n,r){if(e.then){for(var o,a=t;a=a.__;)if((o=a.__c)&&o.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t)}Rn(e,t,n,r)};var Vt=b.unmount;function Gt(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=On({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Gt(r,t,n)})),e}function Bt(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Bt(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function nt(){this.__u=0,this.t=null,this.__b=null}function zt(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Re(){this.u=null,this.o=null}b.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Vt&&Vt(e)},(nt.prototype=new $).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var o=zt(r.__v),a=!1,i=function(){a||(a=!0,n.__R=null,o?o(s):s())};n.__R=i;var s=function(){if(!--r.__u){if(r.state.__a){var u=r.state.__a;r.__v.__k[0]=Bt(u,u.__c.__P,u.__c.__O)}var l;for(r.setState({__a:r.__b=null});l=r.t.pop();)l.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(i,i)},nt.prototype.componentWillUnmount=function(){this.t=[]},nt.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Gt(this.__b,n,r.__O=r.__P)}this.__b=null}var o=t.__a&&Ze(ae,null,e.fallback);return o&&(o.__u&=-33),[Ze(ae,null,t.__a?null:e.children),o]};var jt=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};(Re.prototype=new $).__a=function(e){var t=this,n=zt(t.__v),r=t.o.get(e);return r[0]++,function(o){var a=function(){t.props.revealOrder?(r.push(o),jt(t,e,r)):o()};n?n(a):a()}},Re.prototype.render=function(e){this.u=null,this.o=new Map;var t=Te(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},Re.prototype.componentDidUpdate=Re.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,n){jt(e,n,t)})};var In=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,Nn=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Fn=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Un=/[A-Z0-9]/g,Ln=typeof document!="undefined",Vn=function(e){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};$.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty($.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Ht=b.event;function Gn(){}function Bn(){return this.cancelBubble}function zn(){return this.defaultPrevented}b.event=function(e){return Ht&&(e=Ht(e)),e.persist=Gn,e.isPropagationStopped=Bn,e.isDefaultPrevented=zn,e.nativeEvent=e};var jn={enumerable:!1,configurable:!0,get:function(){return this.class}},Kt=b.vnode;b.vnode=function(e){typeof e.type=="string"&&function(t){var n=t.props,r=t.type,o={};for(var a in n){var i=n[a];if(!(a==="value"&&"defaultValue"in n&&i==null||Ln&&a==="children"&&r==="noscript"||a==="class"||a==="className")){var s=a.toLowerCase();a==="defaultValue"&&"value"in n&&n.value==null?a="value":a==="download"&&i===!0?i="":s==="translate"&&i==="no"?i=!1:s==="ondoubleclick"?a="ondblclick":s!=="onchange"||r!=="input"&&r!=="textarea"||Vn(n.type)?s==="onfocus"?a="onfocusin":s==="onblur"?a="onfocusout":Fn.test(a)?a=s:r.indexOf("-")===-1&&Nn.test(a)?a=a.replace(Un,"-$&").toLowerCase():i===null&&(i=void 0):s=a="oninput",s==="oninput"&&o[a=s]&&(a="oninputCapture"),o[a]=i}}r=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=Te(n.children).forEach(function(u){u.props.selected=o.value.indexOf(u.props.value)!=-1})),r=="select"&&o.defaultValue!=null&&(o.value=Te(n.children).forEach(function(u){u.props.selected=o.multiple?o.defaultValue.indexOf(u.props.value)!=-1:o.defaultValue==u.props.value})),n.class&&!n.className?(o.class=n.class,Object.defineProperty(o,"className",jn)):(n.className&&!n.class||n.class&&n.className)&&(o.class=o.className=n.className),t.props=o}(e),e.$$typeof=In,Kt&&Kt(e)};var Zt=b.__r;b.__r=function(e){Zt&&Zt(e),e.__c};var qt=b.diffed;b.diffed=function(e){qt&&qt(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value)};function _e(e,t,n){var r=this,o=ee(null),a=ee(0),i=ee(null),s=ee([]),u=ee(),l=ee(),d=ee(e),c=ee(!0);d.current=e;var _=typeof window!="undefined",p=!t&&t!==0&&_;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var y=!!(n=n||{}).leading,g=!("trailing"in n)||!!n.trailing,m="maxWait"in n,h="debounceOnServer"in n&&!!n.debounceOnServer,v=m?Math.max(+n.maxWait||0,t):null;Z(function(){return c.current=!0,function(){c.current=!1}},[]);var x=pe(function(){var k=function(C){var O=s.current,q=u.current;return s.current=u.current=null,a.current=C,l.current=d.current.apply(q,O)},w=function(C,O){p&&cancelAnimationFrame(i.current),i.current=p?requestAnimationFrame(C):setTimeout(C,O)},P=function(C){if(!c.current)return!1;var O=C-o.current;return!o.current||O>=t||O<0||m&&C-a.current>=v},A=function(C){return i.current=null,g&&s.current?k(C):(s.current=u.current=null,l.current)},T=function C(){var O=Date.now();if(P(O))return A(O);if(c.current){var q=t-(O-o.current),ne=m?Math.min(q,v-(O-a.current)):q;w(C,ne)}},B=function(){if(_||h){var C=Date.now(),O=P(C);if(s.current=[].slice.call(arguments),u.current=r,o.current=C,O){if(!i.current&&c.current)return a.current=o.current,w(T,t),y?k(o.current):l.current;if(m)return w(T,t),k(o.current)}return i.current||w(T,t),l.current}};return B.cancel=function(){i.current&&(p?cancelAnimationFrame(i.current):clearTimeout(i.current)),a.current=0,s.current=o.current=u.current=i.current=null},B.isPending=function(){return!!i.current},B.flush=function(){return i.current?A(Date.now()):l.current},B},[y,m,t,v,g,p,_,h]);return x}var Hn=Object.defineProperty,Kn=(e,t,n)=>t in e?Hn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ie=(e,t,n)=>Kn(e,typeof t!="symbol"?t+"":t,n);const Yt={"#":{pattern:/[0-9]/},"@":{pattern:/[a-zA-Z]/},"*":{pattern:/[a-zA-Z0-9]/}},Jt=(e,t,n)=>e.replaceAll(t,"").replace(n,".").replace("..",".").replace(/[^.\d]/g,""),Wt=(e,t,n)=>{var o;var r;return new Intl.NumberFormat((o=(r=n.number)==null?void 0:r.locale)!=null?o:"en",{minimumFractionDigits:e,maximumFractionDigits:t,roundingMode:"trunc"})},Zn=(e,t=!0,n)=>{var m,h,v;var r,o,a,i;const s=((r=n.number)==null?void 0:r.unsigned)==null&&e.startsWith("-")?"-":"",u=(m=(o=n.number)==null?void 0:o.fraction)!=null?m:0;let l=Wt(0,u,n);const d=l.formatToParts(1000.12),c=(h=(a=d.find(x=>x.type==="group"))==null?void 0:a.value)!=null?h:" ",_=(v=(i=d.find(x=>x.type==="decimal"))==null?void 0:i.value)!=null?v:".",p=Jt(e,c,_);if(Number.isNaN(parseFloat(p)))return s;const y=p.split(".");if(y[1]!=null&&y[1].length>=1){const x=y[1].length<=u?y[1].length:u;l=Wt(x,u,n)}let g=l.format(parseFloat(p));return t?u>0&&p.endsWith(".")&&!p.slice(0,-1).includes(".")&&(g+=_):g=Jt(g,c,_),s+g};class qn{constructor(t={}){var r;Ie(this,"opts",{}),Ie(this,"memo",new Map);const n=S({},t);if(n.tokens!=null){n.tokens=n.tokensReplace?S({},n.tokens):S(S({},Yt),n.tokens);for(const o of Object.values(n.tokens))typeof o.pattern=="string"&&(o.pattern=new RegExp(o.pattern))}else n.tokens=Yt;Array.isArray(n.mask)&&(n.mask.length>1?n.mask=[...n.mask].sort((o,a)=>o.length-a.length):n.mask=(r=n.mask[0])!=null?r:""),n.mask===""&&(n.mask=null),this.opts=n}masked(t){return this.process(t,this.findMask(t))}unmasked(t){return this.process(t,this.findMask(t),!1)}isEager(){return this.opts.eager===!0}isReversed(){return this.opts.reversed===!0}completed(t){const n=this.findMask(t);if(this.opts.mask==null||n==null)return!1;const r=this.process(t,n).length;return typeof this.opts.mask=="string"?r>=this.opts.mask.length:r>=n.length}findMask(t){var o,a;const n=this.opts.mask;if(n==null)return null;if(typeof n=="string")return n;if(typeof n=="function")return n(t);const r=this.process(t,(o=n.slice(-1).pop())!=null?o:"",!1);return(a=n.find(i=>this.process(t,i,!1).length>=r.length))!=null?a:""}escapeMask(t){const n=[],r=[];return t.split("").forEach((o,a)=>{o==="!"&&t[a-1]!=="!"?r.push(a-r.length):n.push(o)}),{mask:n.join(""),escaped:r}}process(t,n,r=!0){if(this.opts.number!=null)return Zn(t,r,this.opts);if(n==null)return t;const o=`v=${t},mr=${n},m=${r?1:0}`;if(this.memo.has(o))return this.memo.get(o);const{mask:a,escaped:i}=this.escapeMask(n),s=[],u=this.opts.tokens!=null?this.opts.tokens:{},l=this.isReversed()?-1:1,d=this.isReversed()?"unshift":"push",c=this.isReversed()?0:a.length-1,_=this.isReversed()?()=>m>-1&&h>-1:()=>m<a.length&&h<t.length,p=x=>!this.isReversed()&&x<=c||this.isReversed()&&x>=c;let y,g=-1,m=this.isReversed()?a.length-1:0,h=this.isReversed()?t.length-1:0,v=!1;for(;_();){const x=a.charAt(m),k=u[x],w=(k==null?void 0:k.transform)!=null?k.transform(t.charAt(h)):t.charAt(h);if(!i.includes(m)&&k!=null?(w.match(k.pattern)!=null?(s[d](w),k.repeated?(g===-1?g=m:m===c&&m!==g&&(m=g-l),c===g&&(m-=l)):k.multiple&&(v=!0,m-=l),m+=l):k.multiple?v&&(m+=l,h-=l,v=!1):w===y?y=void 0:k.optional&&(m+=l,h-=l),h+=l):(r&&!this.isEager()&&s[d](x),w===x&&!this.isEager()?h+=l:y=x,this.isEager()||(m+=l)),this.isEager())for(;p(m)&&(u[a.charAt(m)]==null||i.includes(m));){if(r){if(s[d](a.charAt(m)),t.charAt(h)===a.charAt(m)){m+=l,h+=l;continue}}else a.charAt(m)===t.charAt(h)&&(h+=l);m+=l}}return this.memo.set(o,s.join("")),this.memo.get(o)}}const Xt=e=>JSON.parse(e.replaceAll("'",'"')),Yn=(e,t={})=>{const n=S({},t);e.dataset.maska!=null&&e.dataset.maska!==""&&(n.mask=Jn(e.dataset.maska)),e.dataset.maskaEager!=null&&(n.eager=Ne(e.dataset.maskaEager)),e.dataset.maskaReversed!=null&&(n.reversed=Ne(e.dataset.maskaReversed)),e.dataset.maskaTokensReplace!=null&&(n.tokensReplace=Ne(e.dataset.maskaTokensReplace)),e.dataset.maskaTokens!=null&&(n.tokens=Wn(e.dataset.maskaTokens));const r={};return e.dataset.maskaNumberLocale!=null&&(r.locale=e.dataset.maskaNumberLocale),e.dataset.maskaNumberFraction!=null&&(r.fraction=parseInt(e.dataset.maskaNumberFraction)),e.dataset.maskaNumberUnsigned!=null&&(r.unsigned=Ne(e.dataset.maskaNumberUnsigned)),(e.dataset.maskaNumber!=null||Object.values(r).length>0)&&(n.number=r),n},Ne=e=>e!==""?!!JSON.parse(e):!0,Jn=e=>e.startsWith("[")&&e.endsWith("]")?Xt(e):e,Wn=e=>{if(e.startsWith("{")&&e.endsWith("}"))return Xt(e);const t={};return e.split("|").forEach(n=>{const r=n.split(":");t[r[0]]={pattern:new RegExp(r[1]),optional:r[2]==="optional",multiple:r[2]==="multiple",repeated:r[2]==="repeated"}}),t};class Fe{constructor(t,n={}){Ie(this,"items",new Map),Ie(this,"onInput",r=>{if(r instanceof CustomEvent&&r.type==="input"&&!r.isTrusted&&!r.bubbles)return;const o=r.target,a=this.items.get(o),i="inputType"in r&&r.inputType.startsWith("delete"),s=a.isEager(),u=i&&s&&a.unmasked(o.value)===""?"":o.value;this.fixCursor(o,i,()=>this.setValue(o,u))}),this.options=n,this.init(this.getInputs(t))}update(t={}){this.options=S({},t),this.init(Array.from(this.items.keys()))}updateValue(t){t.value!==""&&t.value!==this.processInput(t).masked&&this.setValue(t,t.value)}destroy(){for(const t of this.items.keys())t.removeEventListener("input",this.onInput);this.items.clear()}init(t){const n=this.getOptions(this.options);for(const r of t){this.items.has(r)||r.addEventListener("input",this.onInput,{capture:!0});const o=new qn(Yn(r,n));this.items.set(r,o),queueMicrotask(()=>this.updateValue(r)),r.selectionStart===null&&o.isEager()&&console.warn("Maska: input of `%s` type is not supported",r.type)}}getInputs(t){return typeof t=="string"?Array.from(document.querySelectorAll(t)):"length"in t?Array.from(t):[t]}getOptions(t){const i=t,{onMaska:n,preProcess:r,postProcess:o}=i;return Ke(i,["onMaska","preProcess","postProcess"])}fixCursor(t,n,r){const o=t.selectionStart,a=t.value;if(r(),o===null||o===a.length&&!n)return;const i=t.value,s=a.slice(0,o),u=i.slice(0,o),l=this.processInput(t,s).unmasked,d=this.processInput(t,u).unmasked;let c=o;s!==u&&(c+=n?i.length-a.length:l.length-d.length),t.setSelectionRange(c,c)}setValue(t,n){const r=this.processInput(t,n);t.value=r.masked,this.options.onMaska!=null&&(Array.isArray(this.options.onMaska)?this.options.onMaska.forEach(o=>o(r)):this.options.onMaska(r)),t.dispatchEvent(new CustomEvent("maska",{detail:r})),t.dispatchEvent(new CustomEvent("input",{detail:r.masked}))}processInput(t,n){const r=this.items.get(t);let o=n!=null?n:t.value;this.options.preProcess!=null&&(o=this.options.preProcess(o));let a=r.masked(o);return this.options.postProcess!=null&&(a=this.options.postProcess(a)),{masked:a,unmasked:r.unmasked(o),completed:r.completed(o)}}}const Xn=({showOtp:e,value:t,setValue:n})=>{const{t:r}=Y(),{handleBlur:o,err:a}=L(tt),i="### ### ####",s=l=>{const d=l.target,{value:c}=d;n(c)},u=_e(o,1e3);return Z(()=>{new Fe('[name="mysr-stc-mobile"]')},[]),f(he,{name:"mysr-stc-mobile",label:r("form.mobile"),type:"text",inputMode:"numeric",maxLength:i.length,autocomplete:"tel-national",placeholder:"05x xxx xxxx",class:ie(["animate-fade-in text-center",!e&&"hidden"]),onAnimationEnd:l=>{l.target&&l.target.focus()},value:t,onKeyUp:l=>{s(l),u(l)},onBlur:o,error:a.phone,"data-maska":i,"data-maska-eager":!0})},Qn=({showPhone:e,value:t,setValue:n})=>{const{t:r}=Y(),{handleBlur:o,err:a}=L(tt),i=u=>{const l=u.target,{value:d}=l;n(d)},s=_e(o,1e3);return Z(()=>{new Fe('[name="mysr-stc-otp"]')},[]),f(he,{name:"mysr-stc-otp",label:r("form.otp"),type:"text",inputMode:"numeric",autocomplete:"one-time-code",placeholder:r("form.code"),class:ie(["animate-fade-in text-center",e&&"hidden"]),onAnimationEnd:u=>{u.target&&u.target.focus()},value:t,onKeyUp:u=>{i(u),s(u)},onBlur:o,error:a.otp,"data-maska":"### ###","data-maska-eager":!0})},j=e=>e.split(" ").join(""),$n=({countTo:e,callback:t})=>{const n=ee(null),r=Mt(()=>{const s=e?new Date(e).getTime()-new Date().getTime():0;return s<0?0:s},[e]),[o,a]=N(r());Z(()=>(n.current=setInterval(()=>{a(r())},500),()=>{n.current&&clearInterval(n.current)}),[r]),Z(()=>{o===0&&(n.current&&clearInterval(n.current),typeof t=="function"&&t(0))},[t,o]);const i=()=>{const s=Math.floor(o/1e3/60/60),u=Math.floor((o/1e3/60/60-s)*60),l=Math.floor(((o/1e3/60/60-s)*60-u)*60);return f("span",{children:[u,":",l<10?`0${l}`:l]})};return!e||!o?null:f("div",{class:ie("inline-flex gap-2 text-sm"),children:i()})},er="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%20512%20174'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;'%3e%3cg%3e%3cpath%20d='M326.531,121.529l-0,-74.676l12.663,0l0,5.988c3.854,-4.818%209.567,-7.433%2016.655,-7.433c14.592,-0%2025.053,11.631%2025.053,28.286c-0,16.656%20-10.53,28.494%20-25.053,28.494c-7.157,0%20-12.801,-2.753%20-16.655,-7.571l0,26.911l-12.663,-0l-0,0.001Zm12.664,-54.716l0,13.765c2.684,5.576%207.502,9.636%2014.453,9.636c8.398,-0%2014.041,-6.264%2014.041,-16.587c0,-10.186%20-5.643,-16.381%20-14.041,-16.381c-6.951,0.069%20-11.769,3.854%20-14.453,9.567'%20style='fill:%2302aa7c;fill-rule:nonzero;'%20/%3e%3cpath%20d='M389.093,85.258c-0,-9.085%205.643,-15.417%2015.003,-16.587l21.543,-2.753l-0,-2.684c-0,-3.234%20-1.652,-4.956%20-4.68,-4.956l-27.048,0l-0,-11.493l27.53,-0c10.943,-0%2016.931,5.368%2016.931,14.867l-0,38.885l-12.802,0l0,-6.538c-3.716,5.232%20-9.841,8.19%20-17.757,8.19c-11.149,0%20-18.72,-6.813%20-18.72,-16.931m21.817,6.607c6.469,-0%2012.457,-3.648%2014.659,-9.016l0,-6.745l-16.449,2.271c-4.542,0.62%20-7.089,3.028%20-7.089,6.952c0.001,4.198%203.235,6.538%208.879,6.538'%20style='fill:%2302aa7c;fill-rule:nonzero;'%20/%3e%3cpath%20d='M447.594,110.035l9.223,0c3.51,0%205.093,-1.446%206.263,-4.749l1.652,-4.75l-19.547,-53.752l13.215,-0l12.182,37.441l0.275,0l11.632,-37.441l13.007,-0l-21.404,61.736c-2.891,8.465%20-6.746,13.008%20-16.174,13.008l-10.323,-0l-0.001,-11.493Z'%20style='fill:%2302aa7c;fill-rule:nonzero;'%20/%3e%3cpath%20d='M61.142,158.488c14.729,0%2026.842,-4.611%2034.826,-12.319c5.987,-5.92%209.497,-13.903%209.497,-23.125c0,-8.328%20-3.097,-15.83%20-8.809,-21.543c-5.712,-5.713%20-13.903,-9.911%20-24.227,-11.907l-16.931,-3.304c-7.02,-1.307%20-11.011,-4.817%20-11.011,-9.703c-0,-6.402%206.194,-10.806%2016.105,-10.806c6.194,0%2011.493,1.996%2015.003,5.506c2.202,2.409%203.716,5.506%204.198,9.016l24.433,-5.506c-0.688,-7.02%20-3.992,-13.215%20-9.016,-18.307c-8.052,-7.915%20-20.372,-12.939%20-34.894,-12.939c-13.421,-0%20-24.639,4.405%20-32.416,11.425c-6.608,6.194%20-10.324,14.521%20-10.324,23.813c0,8.121%202.616,15.003%207.915,20.234c5.3,5.3%2013.008,9.223%2023.125,11.7l16.725,3.992c8.397,1.996%2012.113,5.093%2012.113,10.599c0,6.814%20-6.194,10.806%20-16.311,10.806c-7.295,-0%20-13.215,-2.41%20-16.931,-6.402c-2.616,-2.615%20-4.198,-6.194%20-4.405,-10.117l-25.122,5.507c0.688,7.502%204.198,14.109%209.498,19.409c8.327,8.74%2021.818,13.971%2036.959,13.971m185.965,0c16.311,0%2028.838,-5.919%2037.44,-14.315c6.814,-6.608%2011.012,-14.316%2013.215,-22.231l-25.74,-8.603c-1.102,3.992%20-3.304,8.19%20-6.814,11.425c-4.198,3.992%20-9.911,6.814%20-18.101,6.814c-7.502,-0%20-14.522,-2.891%20-19.615,-7.916c-5.093,-5.299%20-8.19,-13.007%20-8.19,-22.712c0,-9.911%203.098,-17.413%208.19,-22.713c5.024,-5.093%2011.907,-7.708%2019.409,-7.708c7.915,0%2013.421,2.616%2017.413,6.608c3.303,3.304%205.299,7.502%206.607,11.7l26.222,-8.81c-1.995,-7.708%20-6.193,-15.417%20-12.319,-21.817c-8.81,-8.603%20-21.611,-14.729%20-38.542,-14.729c-15.623,0%20-29.732,5.919%20-39.849,16.105c-10.118,10.324%20-16.312,24.709%20-16.312,41.433c0,16.725%206.401,31.04%2016.725,41.433c10.047,10.117%2024.362,16.036%2040.261,16.036m-88.991,0c11.425,0%2019.615,-3.51%2023.125,-6.607l0,-23.813c-2.684,1.996%20-7.915,4.405%20-14.797,4.405c-4.886,-0%20-8.397,-1.102%20-11.012,-3.51c-2.202,-2.202%20-3.303,-5.988%20-3.303,-11.012l-0,-100.828l-29.113,0l0,29.732l58.157,0l-0,28.219l-58.157,-0l0,50.035c0,10.117%203.097,18.307%208.603,24.02c6.194,6.055%2015.278,9.359%2026.497,9.359'%20style='fill:%23502c84;fill-rule:nonzero;'%20/%3e%3c/g%3e%3c/svg%3e";function Qt(e){return e.errors!==void 0}const tr=()=>{const{t:e}=Y(),[t,n]=N(!1),{amount:r,currency:o,description:a,publishable_api_key:i,metadata:s,invoice_id:u,version:l,base_url:d,on_failure:c,setFormSettings:_}=L(z),p=v=>{_&&(n(v),_(x=>R(S({},x),{isProcessing:v})))},y={amount:r,currency:o,description:a,publishable_api_key:i};s&&Object.keys(s).length>0&&(y.metadata=s),u&&(y.invoice_id=u.toLowerCase());const g=v=>{_&&_(x=>R(S({},x),{apiError:`${e("error."+v.type)}, ${v.message}`}))},m=()=>{_&&_(v=>R(S({},v),{apiError:""}))};return{processing:t,postData:k=>Q(this,[k],function*({data:v,path:x}){p(!0),m();const w=x||`${d}/v1/payments`;try{const P=yield fetch(w,{method:"POST",headers:{"Content-Type":"application/json","X-Moyasar-Form-Version":l},body:JSON.stringify(S(S({},y),v))});if(!P.ok){if(typeof P=="object"){const A=yield P.json();if(console.log("fetch error:",A),!Qt(A)){g({type:"api_error",message:`Error code: ${P.status}`,errors:null});return}return g(A),A}return yield Promise.reject(P)}return P.json()}catch(P){if(c)try{yield c(P)}catch(A){console.error("An error happened when firing failure callback"),console.error(A)}console.error(P)}finally{p(!1)}})}},nr=()=>{const{apiError:e}=L(z),[t,n]=N(!1);return Z(()=>{n(!!e)},[e]),Z(()=>{let r=null;return t&&(r=setTimeout(()=>{n(!1)},3e3)),()=>{r&&clearTimeout(r)}},[t]),{fail:t}},rr=n=>Q(this,[n],function*({on_initiating:e,setFormSettings:t}){const r=a=>{if(typeof a!="object"||!t)return;const i=["callback_url","description","metadata","amount"];for(const s in a)if(!i.includes(s))throw new Error(`Changing ${s} is not allowed!`);t(s=>S(S({},s),a))};if(!e)return Promise.resolve();if(typeof e!="function")throw new Error("Invalid on_initiating handler");const o=yield e();if(typeof o=="boolean")return o;if(typeof o=="object")return r(o),!0;throw new Error(`Invalid on_initiating handler result: ${o}`)}),or=(e,t,n)=>Q(this,null,function*(){var o;const r=`${e}${e.indexOf("?")>-1?"&":"?"}id=${t.id}&status=${t.status}&message=${(o=t.source)==null?void 0:o.message}`;n&&typeof n=="function"?yield n(r):window.location.href=r}),ar=n=>Q(this,[n],function*({payment:e,on_completed:t}){if(t!==null){if(typeof t!="function")throw new Error("Invalid on_completed handler");try{yield t(e)}catch(r){throw new Error("Unexpected error while handling on_completed callback")}}}),ke=({defaultError:e})=>{const{callback_url:t,on_initiating:n,on_redirect:r,on_completed:o,setFormSettings:a}=L(z),[i,s]=N(e),{processing:u,postData:l}=tr(),[d,c]=N(!1),[_,p]=N(!1),{fail:y}=nr();function g(A){return Q(this,arguments,function*({data:v,path:x,onSuccess:k,onFailed:w,initPayment:P}){const T=yield l({data:v,path:x});Qt(T)||(T&&(k&&k(T),o&&!P&&(yield ar({payment:T,on_completed:o}).catch(B=>{console.error(B)})),T.status==="paid"&&(p(!0),setTimeout(()=>{or(t,T,r).catch(()=>{})},100)),T.status==="failed"&&w&&w(T)),c(!1))})}function m(v){return Q(this,null,function*(){if(c(!0),v.initPayment){try{const x=yield rr({on_initiating:n,setFormSettings:a});if(typeof x=="boolean"&&!x){c(!1);return}yield g(v)}catch(x){console.error(x),c(!1)}return}yield g(v)})}const h=pe(()=>u||d,[u,d]);return{makePayment:m,busy:d,fail:y,success:_,processing:u,loading:h,error:i,setError:s}},$t=({inForm:e=!1})=>{const{apiError:t,showForm:n}=L(z);return n&&!e?null:f("p",{class:"flex flex-col gap-2 rounded-md border border-error bg-red-100 px-4 py-2 text-xs font-medium text-error empty:hidden",children:t})},ir=()=>{const{t:e}=Y(),{formattedAmount:t,isRtl:n,fixed_width:r,setFormSettings:o,showForm:a}=L(z),[i,s]=N(null),[u,l]=N(!1),d={phone:"",otp:""},{makePayment:c,busy:_,fail:p,success:y,loading:g,error:m,setError:h}=ke({defaultError:d}),[v,x]=N(""),[k,w]=N(""),[P,A]=N(""),T=G=>{const M=/^05[503649187][0-9]{7}$/.test(j(G));return h(J=>R(S({},J),{phone:M?"":"error.invalid_mobile"})),M},B=G=>{const M=/^[0-9]{4,}$/.test(j(G));return h(J=>R(S({},J),{otp:M?"":"error.invalid_otp"})),M},C=G=>{const{value:M,name:J}=G.target,le=M.trim();if(l(!1),!le){l(!le);return}J==="mysr-stc-mobile"&&T(le),J==="mysr-stc-otp"&&B(le)},O=()=>{if(!T(v))return;function G(M){const{transaction_url:J}=M.source;A(J),s(new Date().getTime()+5*60*1e3)}c({data:{source:{type:"stcpay",mobile:j(v)}},onSuccess:G,initPayment:!0}).catch(M=>{console.error(M)})},q=()=>{if(!i||!B(k))return;function G(M){var J;M.status==="failed"&&((J=M.source)==null?void 0:J.message)==="Invalid OTP"&&(h(le=>R(S({},le),{otp:"error.invalid_otp"})),w(""),s(null))}c({data:{otp_value:j(k)},path:P,onFailed:G}).catch(M=>{console.error(M)})},ne=G=>{if(G.preventDefault(),h(d),!i){O();return}q()},K=G=>{G>0||(h(M=>R(S({},M),{otp:"error.otp_time_out"})),w(""),s(null))},re=pe(()=>m.phone||i&&m.otp&&m.otp!=="error.otp_time_out"?!0:u||g,[m,u,g]),se=G=>o(M=>R(S({},M),{showForm:G})),[ye,Pe]=N(!1),je=()=>{Pe(!0)},dt=()=>{ye&&(x(""),w(""),h(d),se(!1),Pe(!1),l(!1))};return f(tt.Provider,{value:{err:m,setErr:h,handleBlur:C},children:f(ae,{children:[f(et,{variant:"stc",onClick:()=>se(!0),children:f("img",{class:"pointer-events-none h-4 max-h-full",height:16,width:55,alt:"STC Pay",src:Dn})}),a&&f(ae,{children:[f("div",{class:ie(["fixed inset-0 z-[9] bg-gray-500/75 transition-opacity",ye?"animate-fade-out duration-300":"animate-fade-in duration-200"])}),f("div",{class:"fixed inset-0 z-10 flex flex-col justify-end md:justify-center",children:f("div",{class:ie(["flex w-full origin-bottom flex-col gap-4 rounded-t-lg border-neutral-300 bg-slate-100 p-4 shadow transition-all md:rounded-b-lg lg:p-10",r&&"md:mx-auto md:max-w-96 lg:max-w-screen-sm",ye?"animate-dialog-out-mobile duration-200 md:animate-dialog-out":"animate-dialog-in-mobile duration-300 md:animate-dialog-in"]),onAnimationEnd:dt,children:[f($t,{inForm:!0}),f("div",{class:"flex items-center",children:[f("img",{alt:"",src:er,class:"h-5"}),f("button",{onClick:je,class:"ms-auto",children:"Cancel"})]}),f("form",{class:"flex flex-col gap-4",onSubmit:ne,children:[f("div",{class:"space-y-2",children:[f("div",{class:"flex items-end justify-between text-xs font-medium",children:[i?f("label",{for:"mysr-stc-mobile",children:e("form.otp")}):f("label",{for:"mysr-stc-otp",children:e("form.mobile")}),u&&f("span",{class:"uppercase text-error",children:e("form.required")})]}),f(Xn,{value:v,setValue:x,showOtp:!i&&typeof i!="number"}),f(Qn,{value:k,setValue:w,showPhone:!i&&typeof i!="number"})]}),f(et,{success:y,fail:p,busy:_,variant:"stc",class:"flex gap-1",disabled:re,type:"submit",children:[!n&&e("button.pay")," ",i?f($n,{countTo:i,callback:K}):t]})]}),f("p",{class:"flex flex-col gap-2 text-xs font-medium text-error empty:hidden",children:Object.entries(m).map(([G,M])=>f("span",{class:"empty:hidden",children:e(M)},G))})]})})]})]})})},sr=()=>{const{t:e}=Y(),{base_url:t,payment_button_type:n,publishable_api_key:r,apple_pay:o,payment_options:a,currency:i,supported_networks:s,decimalAmount:u,statement_descriptor:l,setFormSettings:d}=L(z),{makePayment:c}=ke({defaultError:{}});function _(){if(!ApplePaySession)return;const p=(o==null?void 0:o.label)||(a==null?void 0:a.label),g={countryCode:(o==null?void 0:o.country)||(a==null?void 0:a.country),currencyCode:i,supportedNetworks:s,merchantCapabilities:o.merchant_capabilities,total:{label:p,amount:u}},m=new ApplePaySession(o.version,g);m.onvalidatemerchant=h=>{const v={validation_url:h.validationURL,display_name:p,domain_name:window.location.hostname,publishable_api_key:r},x=o.validate_merchant_url||`${t}/v1/applepay/initiate`;fetch(x,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)}).then(k=>k.ok?k:Promise.reject(k)).then(k=>k.json()).then(k=>{m.completeMerchantValidation(k)}).catch(k=>{console.error("Apple Pay error:",k),d(w=>R(S({},w),{apiError:e("error.applePay")})),m.abort()})},m.onpaymentauthorized=h=>{const v={source:{type:"applepay",token:JSON.stringify(h.payment.token)}};l&&(v.statement_descriptor=l);function x(w){var A;console.error(w),m.completePayment({status:ApplePaySession.STATUS_FAILURE,errors:[]});let P="Payment failed.";w instanceof Response?P+=" Error: "+w.statusText:typeof w=="string"?P+=" Error: "+w:w.status==="failed"&&(P+=" Error: "+((A=w.source)==null?void 0:A.message)),d(T=>R(S({},T),{apiError:P}))}function k(w){console.error(w),m.completePayment({status:ApplePaySession.STATUS_SUCCESS})}c({data:v,onFailed:x,onSuccess:k}).catch(w=>{console.error(w)})},m.oncancel=()=>{try{m.abort()}catch(h){console.error(h)}},m.begin()}return f("button",{class:"apple-pay-button",style:{"-apple-pay-button-type":n},onClick:_})},lr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeEAAABLCAMAAABwZM8AAAADAFBMVEUAAAD////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////9/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f3+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+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UmulbQu0jwJC6vFu8hWaI7AvAGfz6s/q+tco+WifD5hKZkLanPWo7uZ5bZNaUyQSQhow/7Uzvd//cXCNo6FfG8UoBGHf3hj1v5nLtR7Y1zaoLqRlQfMTsay9LrRRhwsGsUCwJqVViVO85pDOXlFai82v6VfSTFOhmCKmK01UJ0YWnlH1Zv+4/YuSQXnbpiZKPUKGW3gg9RDnjkEpppXiSv7fgGx7L+67vz/9CotKWr7y1xuZCsEFMMrzeSixvg0YVHxiUd3Mp3y8Y0NF+qP6PncqDxo+tn7WyuoQrEKzBKspWqqg0RLdf+bSlSnAlIqoz8mle1UhXICTG20D7q3VVP6sC4ZRKLKsu4QqEQN+j5qgUjK1uwxUIbe8G9mlzleBKhLBqcZ++XDXSFQiFSyiwl7VU/awKRHRNjkdLqku4AiEx6E0qhNqyjpHVbbgCodFoE8NPQKGKSoOA2kGncm+hnb5QZbgiUWNkZyOHVb2sKqr4QEIadOJl/R9/eIVAmWuIbgAAAABJRU5ErkJggg==",cr=()=>{const{isTestMode:e,payment_button_type:t,samsung_pay:n,payment_options:r,supported_networks:o,currency:a,decimalAmount:i,setFormSettings:s}=L(z),[u,l]=N(!1),[d,c]=N(!1),{makePayment:_}=ke({defaultError:{}}),{t:p}=Y(),y=ee(null);Z(()=>{let h=null;return u||(h=setInterval(()=>{window.SamsungPay&&l(!0)},100)),()=>{clearInterval(h)}},[u]);const g=pe(()=>{if(!(!u||!n))return new SamsungPay.PaymentClient({environment:n.environment})},[u]);if(Z(()=>Q(this,null,function*(){if(!g||!n)return;const h=n.version,v=n.service_id,x=o==null?void 0:o.filter(w=>w!=="mada").map(w=>w.toLowerCase()),k={version:h,serviceId:v,protocol:"PROTOCOL_3DS",allowedBrands:x};y.current=()=>Q(this,null,function*(){const{order_number:w,id:P,country:A,label:T}=n,B=T||(r==null?void 0:r.label),C=A||(r==null?void 0:r.country),O={orderNumber:w,merchant:{name:B,id:P,countryCode:C,url:window.location.hostname},amount:{option:"FORMAT_TOTAL_ESTIMATED_AMOUNT",currency:a,total:i}},q=()=>{g.notify({status:"CHARGED",provider:"Moyasar"})},ne=K=>{var se;g.notify({status:"REJECTED",provider:"Moyasar"});let re="Payment failed.";K instanceof Payment&&K.isFailed()?re+=" Error: "+((se=K.source)==null?void 0:se.message):K instanceof Response?re+=" Error: "+K.statusText:typeof K=="string"&&(re+=" Error: "+K)};try{const K=yield g.loadPaymentSheet(k,O);_({initPayment:!0,data:{source:{type:"samsungpay",token:K["3DS"].data}},onFailed:ne,onSuccess:q})}catch(K){try{g.notify({status:"ERRED",provider:"Moyasar"})}catch(re){}console.log("Samsung Pay error: ",K)}});try{(yield g.isReadyToPay(k)).result?c(!0):s(P=>R(S({},P),{apiError:"Cannot initialize Samsung Pay"}))}catch(w){try{g.notify({status:"ERRED",provider:"Moyasar"})}catch(P){}s(P=>R(S({},P),{apiError:"Cannot initialize Samsung Pay"})),console.error("Samsung Pay Error: ",w)}}),[g,n]),!u||!d)return null;const m=t==="pay"?"pay-with":t;return f("button",{class:"flex h-11 w-full items-center justify-center gap-1 rounded-md bg-black text-white",onClick:y.current,children:[f("span",{children:p(`button.${m}`)}),f("img",{src:lr,alt:"",class:"-mb-[3px] h-[22px]"}),f("div",{class:"mb-0.5 h-[9px] w-[9px] rotate-45 rounded-sm border-r-[3px] border-t-[3px] border-white"})]})},ur=()=>{const{language:e,payment_button_type:t,google_pay:n,payment_options:r,supported_networks:o,currency:a,decimalAmount:i,setFormSettings:s}=L(z),[u,l]=N(!1),{makePayment:d}=ke({defaultError:{}});Z(()=>{let _=null;return u||(_=setInterval(()=>{var p,y;(y=(p=window.google)==null?void 0:p.payments)!=null&&y.api&&l(!0)},100)),()=>{clearInterval(_)}},[u]);const c=pe(()=>{if(u)return new google.payments.api.PaymentsClient({environment:n.environment})},[u]);return Z(()=>Q(this,null,function*(){const _=document.getElementById("googlePay-container");if(!c||!n||(_==null?void 0:_.children.length)>=1)return;n.merchant_id;const p=o==null?void 0:o.filter(P=>P!=="mada").map(P=>P.toUpperCase()),y=n.auth_methods,g={apiVersion:2,apiVersionMinor:0},m={type:"CARD",parameters:{allowedAuthMethods:y,allowedCardNetworks:p}},h=Object.assign({},g);h.allowedPaymentMethods=[m];const v=()=>Q(this,null,function*(){const{country:P,label:A,merchant_id:T}=n,B=A||(r==null?void 0:r.label),C=P||(r==null?void 0:r.country),O=R(S({},g),{allowedPaymentMethods:[w],merchantInfo:{merchantId:T,merchantName:B},transactionInfo:{countryCode:C,currencyCode:a,totalPriceStatus:"FINAL",totalPrice:i}});try{const q=yield c.loadPaymentData(O);d({initPayment:!0,data:{source:{type:"googlepay",token:q.paymentMethodData.tokenizationData.token}}})}catch(q){console.error(q)}}),x=()=>{const P=c.createButton({onClick:v,buttonLocale:e,buttonColor:"black",buttonType:t,buttonRadius:6,buttonSizeMode:"fill"});_.appendChild(P)},k={type:"PAYMENT_GATEWAY",parameters:{gateway:"moyasar",gatewayMerchantId:n.gateway_merchant_id}},w=Object.assign({},m,{tokenizationSpecification:k});try{(yield c.isReadyToPay(h)).result?x():s(A=>R(S({},A),{apiError:"Cannot initialize Google Pay"}))}catch(P){s(A=>R(S({},A),{apiError:"Cannot initialize Google Pay"})),console.error("Google Pay Error: ",P)}}),[c,n]),u?f("div",{id:"googlePay-container",class:"flex h-11 items-center justify-center rounded-md bg-black empty:hidden"}):null},dr=()=>{const{t:e}=Y(),{methods:t,apple_pay:n,samsung_pay:r,google_pay:o}=L(z),a=t.includes("stcpay"),i=t.includes("creditcard"),s=location.protocol==="https:"&&t.includes("applepay")&&typeof window.ApplePaySession!="undefined"&&ApplePaySession.canMakePayments()&&(n==null?void 0:n.version)&&ApplePaySession.supportsVersion(n==null?void 0:n.version),u=!!(r!=null&&r.service_id),l=!!(o!=null&&o.merchant_id);return!s&&!a&&!u&&!l?null:f("div",{class:"flex w-full flex-col gap-4",role:"main",children:[a&&f(ir,{}),s&&f(sr,{}),u&&f(cr,{}),l&&f(ur,{}),i&&f("p",{class:"flex items-center gap-4",children:[f("hr",{class:"grow bg-neutral-300"}),f("span",{class:"text-neutral-800/90",children:e("form.or_pay_with_card")}),f("hr",{class:"grow bg-neutral-300"})]})]})},rt=["mada","visa","amex","masterCard"],ot=["creditcard","applepay","stcpay","samsungpay"],at=["supports3DS","supportsCredit","supportsDebit","supportsEMV"],pr=["pay","buy","plain","book","check-out","subscribe","add-money","contribute","order","reload","rent","support","tip","top-up","continue"],en={ADP:0,AFN:0,ALL:0,AMD:0,BHD:3,BIF:0,BYN:2,BYR:0,CAD:2,CHF:2,CLF:4,CLP:0,COP:0,CRC:0,CZK:0,default:2,DJF:0,DKK:2,ESP:0,GNF:0,GYD:0,HUF:0,IDR:0,IQD:0,IRR:0,ISK:0,ITL:0,JOD:3,JPY:0,KMF:0,KPW:0,KRW:0,KWD:3,LAK:0,LBP:2,LUF:0,LYD:3,MGA:0,MGF:0,MMK:0,MNT:0,MRO:0,MUR:0,NOK:0,OMR:3,PKR:0,PYG:0,RSD:0,RWF:0,SEK:0,SLL:0,SOS:0,STD:0,SYP:0,TMM:0,TND:3,TRL:0,TWD:0,TZS:0,UGX:0,UYI:0,UYW:4,UZS:0,VEF:0,VND:0,VUV:0,XAF:0,XOF:0,XPF:0,YER:0,ZMK:0,ZWD:0},fr=["22337902","22337986","22402030","40177800","403024","40545400","406136","406996","40719700","40728100","40739500","407520","409201","410621","410685","410834","412565","417633","419593","420132","421141","42222200","422817","422818","422819","428331","428671","428672","428673","431361","432328","434107","439954","440533","440647","440795","442429","442463","445564","446393","446404","446672","45488707","45501701","455036","455708","457865","457997","458456","462220","468540","468541","468542","468543","474491","483010","483011","483012","484783","486094","486095","486096","489318","489319","49098000","49098001","492464","504300","513213","515079","516138","520058","521076","52166100","524130","524514","524940","529415","529741","530060","531196","535825","535989","536023","537767","53973776","543085","543357","549760","554180","555610","558563","588845","588848","588850","604906","636120","968201","968202","968203","968204","968205","968206","968207","968208","968209","968211","968212"],tn=e=>{const t=!e,n=/^[a-zA-Z\-\s]+$/.test(e),r=/^[a-zA-Z-]+\s+?([a-zA-Z-]+\s?)+$/.test(e);return{isEmpty:t,isEnglishOnly:n,isValidFormat:r,isValid:!t&&n&&r}},mr=({value:e,setValue:t,err:n,setErr:r})=>{const{t:o}=Y(),[a,i]=N(!1),s=d=>{const c=d.target.value.trim(),{isEmpty:_,isEnglishOnly:p,isValidFormat:y}=tn(c);if(_){i(!c);return}if(!p){r(g=>R(S({},g),{name:"validation.should_be_english_letters_only"}));return}if(!y){r(g=>R(S({},g),{name:"validation.first_and_last_name_required"}));return}i(!1),r(g=>R(S({},g),{name:""}))},u=d=>{const c=d.target,{value:_}=c;t(_)},l=_e(s,1e3);return f("div",{class:"space-y-2",role:"complementary","aria-label":o("form.name_on_card"),children:[f("div",{class:"flex items-end justify-between text-xs font-medium",children:[f("label",{for:"mysr-cc-name",children:o("form.name_on_card")}),a&&f("span",{class:"uppercase text-error",children:o("form.required")})]}),f(he,{name:"mysr-cc-name",placeholder:o("form.name_on_card"),onBlur:s,class:n.name?"shadow-input-error":"",autocomplete:"cc-name",dir:"ltr",value:e,onKeyUp:d=>{u(d),l(d)},onChange:u}),n.name&&f("p",{class:"text-xs font-medium text-error",children:o(n.name)})]})},nn=(e,t)=>{const n=t==="amex"?/^\d{4}$/.test(e):/^\d{3}$/.test(e);return{isValid:n,msg:n?"":"error.invalid_csc"}},Ue=Xe({}),hr=({setValue:e})=>{const{t}=Y(),{handleBlur:n,err:r}=L(Ue),o="** / **",a=s=>{const u=s.target,{value:l}=u;e(l)},i=_e(n,1e3);return Z(()=>{new Fe('[name="mysr-cc-exp"]')},[]),f(he,{"aria-label":t("form.date"),name:"mysr-cc-exp",onBlur:n,class:"rounded-none rounded-bl-lg",placeholder:"MM / YY",autocomplete:"cc-exp",inputMode:"numeric",maxLength:o.length,"data-maska":o,"data-maska-eager":!0,onKeyUp:s=>{a(s),i(s)},error:r.exp})},_r=({value:e,setValue:t})=>{const{t:n}=Y(),{handleBlur:r,err:o,config:a}=L(Ue),i=u=>{const l=u.target,{value:d}=l;t(d)},s=_e(r,1e3);return f(he,{"aria-label":n("form.csc"),name:"mysr-cc-csc",onBlur:r,class:"rounded-none rounded-br-lg",placeholder:"CVC",autocomplete:"cc-csc",inputMode:"numeric",maxLength:a.csc,value:e,onKeyUp:u=>{i(u),s(u)},error:o.csc})},yr=e=>/^4/.test(j(e)),vr=e=>/^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)/.test(j(e)),rn=e=>/^3[47]/.test(j(e)),on=e=>{const t=j(e),n=t.slice(0,6),r=t.slice(0,8);for(const o of fr)if(o==n||o==r)return!0;return!1},it=()=>{const{supported_networks:e}=L(z);function t(n){let r="";return yr(n)&&(r="visa"),vr(n)&&(r="masterCard"),rn(n)&&(r="amex"),on(n)&&(r="mada"),r===""||!e.includes(r)?"":r}return{getCardSchema:t}},gr=({value:e,setValue:t})=>{const{t:n}=Y(),{handleBlur:r,err:o,setType:a}=L(Ue),{getCardSchema:i}=it(),s=l=>{const d=l.target,{value:c}=d;t(c),a(i(c))},u=_e(r,1e3);return Z(()=>{new Fe('[name="mysr-cc-number"]',{mask:l=>rn(l)?"#### ###### #####":"#### #### #### ####"})},[]),f(he,{"aria-label":n("form.cc"),name:"mysr-cc-number",placeholder:"1234 5678 9101 1121",onBlur:r,class:"col-span-full rounded-b-none",autocomplete:"cc-number",inputMode:"numeric",value:e,onKeyUp:l=>{s(l),u(l)},onChange:s,error:o.cc})},br="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%2096%2064'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;'%3e%3cpath%20d='M95,6.894c0,-3.253%20-2.641,-5.894%20-5.894,-5.894l-82.212,0c-3.253,0%20-5.894,2.641%20-5.894,5.894l0,50.212c0,3.253%202.641,5.894%205.894,5.894l82.212,0c3.253,0%205.894,-2.641%205.894,-5.894l0,-50.212Z'%20style='fill:%23fff;stroke:%237e7e7e;stroke-width:0.5px;'/%3e%3cclipPath%20id='_clip1'%3e%3crect%20x='7.179'%20y='18.832'%20width='81.642'%20height='26.336'/%3e%3c/clipPath%3e%3cg%20clip-path='url(%23_clip1)'%3e%3cg%3e%3cpath%20d='M47.418,19.387l-5.431,25.384l-6.567,0l5.432,-25.384l6.566,0Zm27.627,16.39l3.457,-9.532l1.989,9.532l-5.446,0Zm7.326,8.994l6.074,0l-5.3,-25.384l-5.607,0c-1.259,0%20-2.323,0.733%20-2.795,1.863l-9.852,23.521l6.895,0l1.37,-3.79l8.424,-0l0.791,3.79Zm-17.137,-8.287c0.028,-6.701%20-9.267,-7.069%20-9.201,-10.062c0.019,-0.912%200.887,-1.879%202.784,-2.127c0.943,-0.123%203.534,-0.218%206.476,1.136l1.152,-5.383c-1.58,-0.574%20-3.614,-1.125%20-6.143,-1.125c-6.49,-0%20-11.059,3.451%20-11.097,8.391c-0.041,3.655%203.261,5.693%205.75,6.908c2.557,1.245%203.417,2.041%203.406,3.154c-0.017,1.704%20-2.041,2.455%20-3.929,2.485c-3.302,0.052%20-5.218,-0.892%20-6.745,-1.603l-1.19,5.562c1.534,0.705%204.365,1.317%207.303,1.348c6.898,0%2011.411,-3.408%2011.434,-8.684Zm-27.2,-17.097l-10.639,25.384l-6.942,0l-5.235,-20.258c-0.318,-1.248%20-0.595,-1.705%20-1.562,-2.23c-1.576,-0.857%20-4.183,-1.66%20-6.477,-2.158l0.157,-0.738l11.173,0c1.423,0%202.705,0.948%203.028,2.588l2.765,14.69l6.833,-17.278l6.899,0Z'%20style='fill:%230d357f;fill-rule:nonzero;'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",wr="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%2096%2064'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;'%3e%3cpath%20d='M95,7.094c0,-3.363%20-2.731,-6.094%20-6.094,-6.094l-81.812,0c-3.363,0%20-6.094,2.731%20-6.094,6.094l-0,49.812c-0,3.363%202.731,6.094%206.094,6.094l81.812,0c3.363,0%206.094,-2.731%206.094,-6.094l0,-49.812Z'%20style='fill:%23fff;stroke:%23b1b1b1;stroke-width:0.5px;'/%3e%3cpath%20d='M95,6.894c0,-3.253%20-2.641,-5.894%20-5.894,-5.894l-82.212,0c-3.253,0%20-5.894,2.641%20-5.894,5.894l0,50.212c0,3.253%202.641,5.894%205.894,5.894l82.212,0c3.253,0%205.894,-2.641%205.894,-5.894l0,-50.212Z'%20style='fill:%23fff;stroke:%237e7e7e;stroke-width:0.5px;'/%3e%3cg%20opacity='0'%3e%3crect%20x='14.04'%20y='9.539'%20width='67.919'%20height='44.921'%20style='fill:%23fff;'/%3e%3c/g%3e%3crect%20x='39.044'%20y='17.366'%20width='17.917'%20height='29.263'%20style='fill:%23ff5f00;'/%3e%3cpath%20d='M40.89,32c-0.005,-5.706%202.619,-11.106%207.107,-14.629c-3.278,-2.576%20-7.329,-3.978%20-11.498,-3.978c-10.209,0%20-18.61,8.401%20-18.61,18.61c0,10.208%208.401,18.609%2018.61,18.609c4.169,-0%208.22,-1.401%2011.498,-3.978c-4.489,-3.524%20-7.113,-8.927%20-7.107,-14.634Z'%20style='fill:%23eb001b;fill-rule:nonzero;'/%3e%3cpath%20d='M76.33,43.533l0,-0.6l0.259,0l-0,-0.124l-0.615,-0l-0,0.124l0.242,0l0,0.6l0.114,-0Zm1.194,-0l0,-0.724l-0.186,-0l-0.217,0.517l-0.217,-0.517l-0.186,-0l-0,0.724l0.134,-0l0,-0.548l0.202,0.47l0.139,0l0.202,-0.47l0,0.548l0.129,-0Z'%20style='fill:%23f79e1b;fill-rule:nonzero;'/%3e%3cpath%20d='M78.108,32c0,10.209%20-8.4,18.609%20-18.609,18.609c-4.171,-0%20-8.223,-1.402%20-11.502,-3.98c4.487,-3.526%207.111,-8.926%207.111,-14.632c-0,-5.705%20-2.624,-11.106%20-7.111,-14.631c3.279,-2.578%207.331,-3.98%2011.502,-3.98c10.209,-0%2018.609,8.4%2018.609,18.609l0,0.005Z'%20style='fill:%23f79e1b;fill-rule:nonzero;'/%3e%3c/svg%3e",kr="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%2096%2064'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;'%3e%3cpath%20d='M95,7.053c0,-3.341%20-2.712,-6.053%20-6.053,-6.053l-81.894,-0c-3.341,-0%20-6.053,2.712%20-6.053,6.053l0,49.894c0,3.341%202.712,6.053%206.053,6.053l81.894,0c3.341,0%206.053,-2.712%206.053,-6.053l0,-49.894Z'%20style='fill:%23006fcf;stroke:%237e7e7e;stroke-width:0.5px;'/%3e%3cg%3e%3cpath%20d='M54.459,9.71l-10.404,23.609l8.342,0l0,21.172l26.31,0l4.061,-4.51l4.063,4.534l7.933,0l0,-2.672l-6.538,0l-5.395,-5.867l-5.44,5.88l-22.088,0l0,-18.444l22.202,0l5.408,5.938l5.476,-5.963l6.352,-0l0,-2.626l-4.935,-0l-0,-12.769l-4.686,12.699l-4.45,0l-4.823,-12.608l0,12.647l-10.546,0l-1.49,-3.637l-8.559,0l-1.457,3.589l-5.544,0l8.116,-18.39l6.498,-0l8.058,18.438l-0,-18.443l7.875,-0l4.161,11.351l4.127,-11.364l7.714,0.003l0,-2.656l-9.767,-0l-2.048,5.839l-2.2,-5.8l-12.552,-0l-0.077,7.83l-3.474,-7.76l-10.223,-0.02Z'%20style='fill:%23fff;'/%3e%3cpath%20d='M59.526,16.941l-2.53,5.961l5.011,0l-2.481,-5.961Z'%20style='fill:%23fff;'/%3e%3cpath%20d='M60.312,37.605l10.641,-0l0,-4.147l8.738,9.184l-8.621,9.204l-0.101,0l0,-4.221l-10.669,-0l-0,-2.905l10.397,0l-0,-4.077l-10.397,0l0.012,-3.038Z'%20style='fill:%23fff;'/%3e%3cpath%20d='M94.723,47.865l0,3.969l-8.581,-9.23l8.59,-9.225l-0,3.95l-4.946,5.265l4.937,5.271Z'%20style='fill:%23fff;'/%3e%3c/g%3e%3c/svg%3e",xr="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%2096%2064'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;'%3e%3cpath%20d='M95,6.894c0,-3.253%20-2.641,-5.894%20-5.894,-5.894l-82.212,0c-3.253,0%20-5.894,2.641%20-5.894,5.894l0,50.212c0,3.253%202.641,5.894%205.894,5.894l82.212,0c3.253,0%205.894,-2.641%205.894,-5.894l0,-50.212Z'%20style='fill:%23fff;stroke:%237e7e7e;stroke-width:0.5px;'/%3e%3cg%3e%3crect%20x='5.311'%20y='34.182'%20width='36.116'%20height='12.031'%20style='fill:%2384b740;'/%3e%3crect%20x='5.311'%20y='17.765'%20width='36.116'%20height='12.042'%20style='fill:%23259bd6;'/%3e%3cpath%20d='M77.542,43.769l-0.161,0.032c-0.557,0.107%20-0.761,0.15%20-1.168,0.15c-0.944,-0%20-2.059,-0.483%20-2.059,-2.756c-0,-1.169%200.193,-2.724%201.951,-2.724l0.011,0c0.3,0.022%200.644,0.054%201.287,0.247l0.139,0.043l0,5.008Zm0.29,-11.335l-0.29,0.054l0,4.203l-0.257,-0.075l-0.075,-0.021c-0.29,-0.086%20-0.954,-0.279%20-1.598,-0.279c-3.517,0%20-4.257,2.659%20-4.257,4.89c0,3.056%201.716,4.815%204.708,4.815c1.265,-0%202.198,-0.129%203.141,-0.44c0.869,-0.279%201.18,-0.676%201.18,-1.523l-0,-12.063c-0.836,0.15%20-1.705,0.3%20-2.552,0.439'%20style='fill:%2327292d;fill-rule:nonzero;'/%3e%3cpath%20d='M87.997,43.844l-0.15,0.043l-0.536,0.139c-0.504,0.129%20-0.954,0.204%20-1.297,0.204c-0.826,-0%20-1.319,-0.408%20-1.319,-1.105c-0,-0.45%200.203,-1.211%201.555,-1.211l1.747,-0l0,1.93Zm-1.233,-7.582c-1.083,0%20-2.198,0.193%20-3.581,0.622l-0.901,0.268l0.3,2.038l0.88,-0.29c0.922,-0.3%202.069,-0.493%202.927,-0.493c0.386,0%201.566,0%201.566,1.276l-0,0.558l-1.641,-0c-2.992,-0%20-4.375,0.954%20-4.375,3.002c-0,1.748%201.276,2.799%203.421,2.799c0.664,-0%201.587,-0.129%202.38,-0.322l0.043,-0.01l0.043,0.01l0.268,0.043c0.836,0.15%201.705,0.3%202.552,0.461l0,-6.691c0,-2.166%20-1.308,-3.271%20-3.882,-3.271'%20style='fill:%2327292d;fill-rule:nonzero;'/%3e%3cpath%20d='M67.162,43.844l-0.15,0.043l-0.536,0.139c-0.504,0.129%20-0.944,0.204%20-1.297,0.204c-0.826,-0%20-1.319,-0.408%20-1.319,-1.105c-0,-0.45%200.203,-1.211%201.544,-1.211l1.748,-0l0.01,1.93Zm-1.222,-7.582c-1.094,0%20-2.198,0.193%20-3.582,0.622l-0.9,0.268l0.3,2.038l0.879,-0.29c0.922,-0.3%202.07,-0.493%202.928,-0.493c0.386,0%201.565,0%201.565,1.276l0,0.558l-1.641,-0c-2.991,-0%20-4.385,0.954%20-4.385,3.002c-0,1.748%201.276,2.799%203.431,2.799c0.665,-0%201.587,-0.129%202.381,-0.322l0.043,-0.01l0.042,0.01l0.258,0.043c0.847,0.15%201.705,0.3%202.552,0.472l-0,-6.691c0.011,-2.188%20-1.298,-3.282%20-3.871,-3.282'%20style='fill:%2327292d;fill-rule:nonzero;'/%3e%3cpath%20d='M55.871,36.284c-1.362,-0%20-2.488,0.45%20-2.906,0.643l-0.107,0.054l-0.097,-0.075c-0.579,-0.418%20-1.426,-0.633%20-2.606,-0.633c-1.04,0%20-2.016,0.15%20-3.077,0.461c-0.912,0.279%20-1.266,0.719%20-1.266,1.544l0,7.646l2.853,0l-0,-7.067l0.139,-0.042c0.579,-0.193%200.922,-0.226%201.255,-0.226c0.826,0%201.244,0.44%201.244,1.298l-0,6.048l2.809,-0l0,-6.166c0,-0.365%20-0.075,-0.579%20-0.086,-0.622l-0.096,-0.182l0.193,-0.086c0.429,-0.193%200.901,-0.29%201.394,-0.29c0.568,0%201.244,0.226%201.244,1.298l-0,6.048l2.799,-0l-0,-6.327c-0,-2.241%20-1.201,-3.324%20-3.689,-3.324'%20style='fill:%2327292d;fill-rule:nonzero;'/%3e%3cpath%20d='M85.896,25.614c-0.419,0%20-1.116,-0.043%20-1.662,-0.15l-0.161,-0.032l-0,-4.128c-0,-0.344%20-0.065,-0.558%20-0.075,-0.59l-0.086,-0.172l0.182,-0.075c0.043,-0.021%200.086,-0.032%200.14,-0.053l0.032,-0.022c0.064,-0.021%200.128,-0.043%200.193,-0.064c0.032,-0.011%200.053,-0.022%200.075,-0.022c0.633,-0.171%201.212,-0.15%201.469,-0.171l0.011,-0c1.748,-0%201.951,1.555%201.951,2.723c-0.01,2.274%20-1.136,2.756%20-2.069,2.756m-0.011,-7.849l-0.075,-0c-1.641,-0%20-3.324,0.45%20-3.925,1.33c-0.321,0.429%20-0.504,0.965%20-0.514,1.597l-0,4.258c-0,0.364%20-0.076,0.504%20-0.086,0.536l-0.097,0.182l-5.179,-0l-0,-2.96l-0.011,0c-0.064,-3.12%20-1.909,-4.836%20-4.579,-4.836l-2.605,0c-0.108,0.762%20-0.193,1.298%20-0.301,2.059l2.595,0c1.362,0%202.081,1.158%202.081,2.938l-0,2.981l-0.183,-0.096c-0.032,-0.011%20-0.257,-0.086%20-0.611,-0.086l-4.482,-0c-0.086,0.568%20-0.193,1.308%20-0.311,2.048l13.779,0c0.472,-0.096%201.019,-0.182%201.491,-0.257c0.697,0.343%201.994,0.525%202.884,0.525c2.992,0%204.933,-2.005%204.933,-5.093c-0.011,-3.056%20-1.887,-5.062%20-4.804,-5.126'%20style='fill:%2327292d;fill-rule:nonzero;'/%3e%3cpath%20d='M57.78,28.971l4.074,-0c2.992,-0%204.386,-0.987%204.386,-3.421c0,-1.748%20-1.276,-3.142%20-3.421,-3.142l-2.755,0c-0.826,0%20-1.319,-0.472%20-1.319,-1.265c-0,-0.536%200.203,-1.201%201.554,-1.201l6.027,-0c0.129,-0.783%200.193,-1.276%200.311,-2.059l-6.262,-0c-2.917,-0%20-4.386,1.222%20-4.386,3.26c-0,2.016%201.276,3.067%203.42,3.067l2.756,-0c0.826,-0%201.319,0.654%201.319,1.34c0,0.45%20-0.203,1.383%20-1.544,1.383l-0.461,0l-8.825,-0.021l-1.609,-0c-1.361,-0%20-2.316,-0.772%20-2.316,-2.563l0,-1.233c0,-1.866%200.74,-3.024%202.316,-3.024l2.617,-0c0.118,-0.794%200.193,-1.298%200.3,-2.048l-3.571,-0c-2.67,-0%20-4.514,1.791%20-4.579,4.911l0,1.394c0.065,3.12%201.909,4.611%204.579,4.611l2.606,-0l4.783,0.011Z'%20style='fill:%2327292d;fill-rule:nonzero;'/%3e%3c/g%3e%3c/svg%3e",Pr=({type:e})=>{const t="h-4 sm:h-5 w-auto object-contain object-center";return f("div",{class:"absolute right-2 top-1/4 z-[2] flex -translate-y-1/2 items-center gap-1",children:[{alt:"AMEX",src:kr},{alt:"MADA",src:xr},{alt:"Visa",src:br},{alt:"MasterCard",src:wr}].filter(r=>e!==""?e.toLowerCase()===r.alt.toLowerCase():!0).map(r=>f("img",{class:t,alt:r.alt,src:r.src,loading:"lazy"}))})},an=e=>{const t="#### #### #### ####",n={mask:t,validator:o=>/^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$/.test(j(o)),csc:3},r={amex:{mask:"#### ###### #####",validator:o=>/^3[47][0-9]{13}$/.test(j(o)),csc:4},mada:{mask:t,validator:o=>on(o)&&/\d{16}/.test(j(o)),csc:3},visa:{mask:t,validator:o=>/^4[0-9]{12}(?:[0-9]{3})?$/.test(j(o)),csc:3},mastercard:n,masterCard:n};return e===""?r.visa:r[e]},sn=e=>{const[t,n]=e.split("/"),r=parseInt(t.trim()),o=r>=1&&r<=12,a=parseInt(n==null?void 0:n.trim()),i=Number.isNaN(a)||a<+new Date().getFullYear().toString().slice(-2)||a>99,s=/^\d{2} ?\/ ?\d{2}$/.test(e);return{isValidExpFormat:s,isValidYear:!i,inValidMonth:o,isValid:s&&!i&&o}},Er=e=>{const t=[0,2,4,6,8,1,3,5,7,9];if(typeof e!="string")throw new TypeError("Expected string input");if(!e)return!1;let n=e.length,r=!0,o=0;for(;n;){const a=e.charCodeAt(--n)-48;if(a<0||a>9)return!1;r=!r,o+=r?t[a]:a}return o%10===0},ln=()=>{const{getCardSchema:e}=it();function t(n,r){const o=r||e(n);if(!o&&n.length>3)return!1;const{validator:a}=an(o),i=a(n),s=Er(n);return i&&s}return{isValidCc:t}},Sr=({cc:e,setCc:t,cvc:n,setCvc:r,exp:o,setExp:a,err:i,setErr:s})=>{const{t:u}=Y(),[l,d]=N(!1),[c,_]=N(""),{isValidCc:p}=ln(),y=Mt(()=>an(c),[c]),g=m=>{const{value:h,name:v}=m.target,x=j(h.trim());if(!x){d(!x);return}if(v==="mysr-cc-csc"){const{msg:k}=nn(x,c);s(w=>R(S({},w),{csc:k}))}if(v==="mysr-cc-exp"){const{isValidExpFormat:k,isValidYear:w,inValidMonth:P}=sn(x);s(A=>R(S({},A),{exp_month:P?"":"error.invalid_month",exp_year:w?"":"error.invalid_year",exp:k?"":"error.invalid_date"}))}v==="mysr-cc-number"&&s(k=>R(S({},k),{cc:c===""?"error.unsupported_cc_type":p(x)?"":"error.invalid_cc_number"}))};return Z(()=>{Object.values(i).filter(m=>m).length===0&&d(!1)},[i]),f(Ue.Provider,{value:{err:i,setErr:s,handleBlur:g,type:c,setType:_,config:y()},children:f("div",{class:"space-y-2",role:"complementary","aria-label":u("form.card_info"),children:[f("div",{class:"flex items-end justify-between text-xs font-medium",children:[f("legend",{children:u("form.card_info")}),l&&f("span",{class:"uppercase text-error",children:u("form.required")})]}),f("div",{class:"relative grid grid-cols-2 gap-y-[1px]",dir:"ltr",children:[f(gr,{value:e,setValue:t}),f(Pr,{type:c}),f(hr,{value:o,setValue:a}),f(_r,{value:n,setValue:r})]}),f("p",{class:"flex flex-col gap-2 text-xs font-medium text-error",children:Object.entries(i).filter(([m])=>m!=="name").map(([m,h])=>f("span",{class:"empty:hidden",children:u(h)},m))})]})})},Cr=()=>{const{t:e}=Y(),{formattedAmount:t,isRtl:n,credit_card:r,statement_descriptor:o,callback_url:a,payment_button_type:i}=L(z),[s,u]=N(""),[l,d]=N(""),[c,_]=N(""),[p,y]=N(""),{getCardSchema:g}=it(),{isValidCc:m}=ln(),h={name:"",csc:"",cc:"",exp:"",exp_month:"",exp_year:""},{makePayment:v,busy:x,fail:k,success:w,loading:P,error:A,setError:T}=ke({defaultError:h});return f("form",{class:"space-y-6",onSubmit:O=>{O.preventDefault();const{isValid:q}=tn(s),ne=j(l),K=j(p),re=j(c),se=g(ne),ye=m(ne,se),{isValid:Pe}=nn(re,se),{isValid:je}=sn(K);if(!q||!ye||!Pe||!je){const X=S({},h);q||(X.name=e("error.invalid_name")),ye||(X.cc=e("error.invalid_cc_number")),Pe||(X.csc=e("error.invalid_csc")),je||(X.exp=e("error.invalid_date")),T(X);return}const[dt,G]=K.split("/"),M={type:"creditcard",name:s,number:ne,month:dt,year:G,cvc:re};r!=null&&r.manual&&(M.manual=!0),r!=null&&r.save_card&&(M.save_card=!0),o&&(M.statement_descriptor=o);function J(X){const{transaction_url:io}=X.source;window.location.href=io}function le(X){console.error(X)}v({data:{callback_url:a,source:M},initPayment:!0,onFailed:le,onSuccess:J}).catch(X=>{console.error(X)})},children:[f(mr,{value:s,setValue:u,err:A,setErr:T}),f(Sr,{cc:l,setCc:d,cvc:c,setCvc:_,exp:p,setExp:y,err:A,setErr:T}),f(et,{type:"submit",disabled:P,success:w,fail:k,busy:x,children:[(i!=="plain"||!n)&&e(`button.${i}`)," ",t]}),(r==null?void 0:r.save_card)&&f("p",{class:"flex items-center justify-center gap-2 text-xs text-primary-400",role:"complementary","aria-label":e("form.save_card_notice"),children:[f("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",class:"h-4 w-4 shrink-0",fill:"currentColor",children:f("path",{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"})}),e("form.save_card_notice")]})]})};var st=function(e,t){return st=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])},st(e,t)};function Ar(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");st(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var te=function(){return te=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},te.apply(this,arguments)};function Le(e,t,n,r){function o(a){return a instanceof n?a:new n(function(i){i(a)})}return new(n||(n=Promise))(function(a,i){function s(d){try{l(r.next(d))}catch(c){i(c)}}function u(d){try{l(r.throw(d))}catch(c){i(c)}}function l(d){d.done?a(d.value):o(d.value).then(s,u)}l((r=r.apply(e,t||[])).next())})}function xe(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,o,a,i;return i={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(l){return function(d){return u([l,d])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(n=0)),n;)try{if(r=1,o&&(a=l[0]&2?o.return:l[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,l[1])).done)return a;switch(o=0,a&&(l=[l[0]&2,a.value]),l[0]){case 0:case 1:a=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!a||l[1]>a[0]&&l[1]<a[3])){n.label=l[1];break}if(l[0]===6&&n.label<a[1]){n.label=a[1],a=l;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(l);break}a[2]&&n.ops.pop(),n.trys.pop();continue}l=t.call(e,n)}catch(d){l=[6,d],o=0}finally{r=a=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Tr(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ve(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,a=[],i;try{for(;(t===void 0||t-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(s){i={error:s}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a}function Ge(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,a;r<o;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;function cn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length===0?function(n){return n}:e.length===1?e[0]:e.reduce(function(n,r){return function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];return n(r.apply(void 0,Ge([],Ve(o),!1)))}})}function Dr(e){if(e)return Object.keys(e).forEach(function(t){typeof e[t]=="object"&&(e[t]=JSON.stringify(e[t])),e[t]=String(e[t])}),e}function un(e){if(e)return Object.keys(e).forEach(function(t){typeof e[t]=="string"||typeof e[t]=="boolean"||typeof e[t]=="number"||(e[t]=JSON.stringify(e[t]))}),e}function Mr(e){return typeof e=="object"&&typeof e.message!="undefined"}function Or(e){if(typeof e.stacktrace!="undefined"||typeof e["opera#sourceloc"]!="undefined"){var t=e.stacktrace,n=t===void 0?"":t;return n.split(`
8
+ (function(D,b){typeof exports=="object"&&typeof module!="undefined"?module.exports=b():typeof define=="function"&&define.amd?define(b):(D=typeof globalThis!="undefined"?globalThis:D||self,D.Moyasar=b())})(this,function(){"use strict";var so=Object.defineProperty,lo=Object.defineProperties;var co=Object.getOwnPropertyDescriptors;var He=Object.getOwnPropertySymbols;var mn=Object.prototype.hasOwnProperty,hn=Object.prototype.propertyIsEnumerable;var _n=Math.pow,fn=(D,b,F)=>b in D?so(D,b,{enumerable:!0,configurable:!0,writable:!0,value:F}):D[b]=F,S=(D,b)=>{for(var F in b||(b={}))mn.call(b,F)&&fn(D,F,b[F]);if(He)for(var F of He(b))hn.call(b,F)&&fn(D,F,b[F]);return D},R=(D,b)=>lo(D,co(b));var Ke=(D,b)=>{var F={};for(var V in D)mn.call(D,V)&&b.indexOf(V)<0&&(F[V]=D[V]);if(D!=null&&He)for(var V of He(D))b.indexOf(V)<0&&hn.call(D,V)&&(F[V]=D[V]);return F};var Q=(D,b,F)=>new Promise((V,ve)=>{var Ee=W=>{try{ce(F.next(W))}catch(ue){ve(ue)}},ge=W=>{try{ce(F.throw(W))}catch(ue){ve(ue)}},ce=W=>W.done?V(W.value):Promise.resolve(W.value).then(Ee,ge);ce((F=F.apply(D,b)).next())});var D,b,F,V,ve,Ee,ge,ce,W,ue,pt,be={},ft=[],yn=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Se=Array.isArray;function oe(e,t){for(var n in t)e[n]=t[n];return e}function mt(e){var t=e.parentNode;t&&t.removeChild(e)}function Ze(e,t,n){var r,o,a,i={};for(a in t)a=="key"?r=t[a]:a=="ref"?o=t[a]:i[a]=t[a];if(arguments.length>2&&(i.children=arguments.length>3?D.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)i[a]===void 0&&(i[a]=e.defaultProps[a]);return Ce(e,i,r,o,null)}function Ce(e,t,n,r,o){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o==null?++F:o,__i:-1,__u:0};return o==null&&b.vnode!=null&&b.vnode(a),a}function ae(e){return e.children}function $(e,t){this.props=e,this.context=t}function de(e,t){if(t==null)return e.__?de(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?de(e):null}function ht(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return ht(e)}}function qe(e){(!e.__d&&(e.__d=!0)&&V.push(e)&&!Ae.__r++||ve!==b.debounceRendering)&&((ve=b.debounceRendering)||Ee)(Ae)}function Ae(){var e,t,n,r,o,a,i,s;for(V.sort(ge);e=V.shift();)e.__d&&(t=V.length,r=void 0,a=(o=(n=e).__v).__e,i=[],s=[],n.__P&&((r=oe({},o)).__v=o.__v+1,b.vnode&&b.vnode(r),Ye(n.__P,r,o,n.__n,n.__P.namespaceURI,32&o.__u?[a]:null,i,a==null?de(o):a,!!(32&o.__u),s),r.__v=o.__v,r.__.__k[r.__i]=r,bt(i,r,s),r.__e!=a&&ht(r)),V.length>t&&V.sort(ge));Ae.__r=0}function _t(e,t,n,r,o,a,i,s,u,l,d){var c,_,p,y,g,m=r&&r.__k||ft,h=t.length;for(n.__d=u,vn(n,t,m),u=n.__d,c=0;c<h;c++)(p=n.__k[c])!=null&&typeof p!="boolean"&&typeof p!="function"&&(_=p.__i===-1?be:m[p.__i]||be,p.__i=c,Ye(e,p,_,o,a,i,s,u,l,d),y=p.__e,p.ref&&_.ref!=p.ref&&(_.ref&&Je(_.ref,null,p),d.push(p.ref,p.__c||y,p)),g==null&&y!=null&&(g=y),65536&p.__u||_.__k===p.__k?(u&&typeof p.type=="string"&&!e.contains(u)&&(u=de(_)),u=yt(p,u,e)):typeof p.type=="function"&&p.__d!==void 0?u=p.__d:y&&(u=y.nextSibling),p.__d=void 0,p.__u&=-196609);n.__d=u,n.__e=g}function vn(e,t,n){var r,o,a,i,s,u=t.length,l=n.length,d=l,c=0;for(e.__k=[],r=0;r<u;r++)i=r+c,(o=e.__k[r]=(o=t[r])==null||typeof o=="boolean"||typeof o=="function"?null:typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?Ce(null,o,null,null,null):Se(o)?Ce(ae,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?Ce(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)!=null?(o.__=e,o.__b=e.__b+1,s=gn(o,n,i,d),o.__i=s,a=null,s!==-1&&(d--,(a=n[s])&&(a.__u|=131072)),a==null||a.__v===null?(s==-1&&c--,typeof o.type!="function"&&(o.__u|=65536)):s!==i&&(s==i-1?c=s-i:s==i+1?c++:s>i?d>u-i?c+=s-i:c--:s<i&&c++,s!==r+c&&(o.__u|=65536))):(a=n[i])&&a.key==null&&a.__e&&!(131072&a.__u)&&(a.__e==e.__d&&(e.__d=de(a)),We(a,a,!1),n[i]=null,d--);if(d)for(r=0;r<l;r++)(a=n[r])!=null&&!(131072&a.__u)&&(a.__e==e.__d&&(e.__d=de(a)),We(a,a))}function yt(e,t,n){var r,o;if(typeof e.type=="function"){for(r=e.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=e,t=yt(r[o],t,n));return t}e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType===8);return t}function Te(e,t){return t=t||[],e==null||typeof e=="boolean"||(Se(e)?e.some(function(n){Te(n,t)}):t.push(e)),t}function gn(e,t,n,r){var o=e.key,a=e.type,i=n-1,s=n+1,u=t[n];if(u===null||u&&o==u.key&&a===u.type&&!(131072&u.__u))return n;if(r>(u!=null&&!(131072&u.__u)?1:0))for(;i>=0||s<t.length;){if(i>=0){if((u=t[i])&&!(131072&u.__u)&&o==u.key&&a===u.type)return i;i--}if(s<t.length){if((u=t[s])&&!(131072&u.__u)&&o==u.key&&a===u.type)return s;s++}}return-1}function vt(e,t,n){t[0]==="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":typeof n!="number"||yn.test(t)?n:n+"px"}function De(e,t,n,r,o){var a;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||vt(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||vt(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")a=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in e||t==="onFocusOut"||t==="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=n,n?r?n.u=r.u:(n.u=ce,e.addEventListener(t,a?ue:W,a)):e.removeEventListener(t,a?ue:W,a);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n==null?"":n;break e}catch(i){}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function gt(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=ce++;else if(t.t<n.u)return;return n(b.event?b.event(t):t)}}}function Ye(e,t,n,r,o,a,i,s,u,l){var d,c,_,p,y,g,m,h,v,x,k,w,P,A,T,B,C=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(u=!!(32&n.__u),a=[s=t.__e=n.__e]),(d=b.__b)&&d(t);e:if(typeof C=="function")try{if(h=t.props,v="prototype"in C&&C.prototype.render,x=(d=C.contextType)&&r[d.__c],k=d?x?x.props.value:d.__:r,n.__c?m=(c=t.__c=n.__c).__=c.__E:(v?t.__c=c=new C(h,k):(t.__c=c=new $(h,k),c.constructor=C,c.render=wn),x&&x.sub(c),c.props=h,c.state||(c.state={}),c.context=k,c.__n=r,_=c.__d=!0,c.__h=[],c._sb=[]),v&&c.__s==null&&(c.__s=c.state),v&&C.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=oe({},c.__s)),oe(c.__s,C.getDerivedStateFromProps(h,c.__s))),p=c.props,y=c.state,c.__v=t,_)v&&C.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),v&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(v&&C.getDerivedStateFromProps==null&&h!==p&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(h,k),!c.__e&&(c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(h,c.__s,k)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(c.props=h,c.state=c.__s,c.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(O){O&&(O.__=t)}),w=0;w<c._sb.length;w++)c.__h.push(c._sb[w]);c._sb=[],c.__h.length&&i.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(h,c.__s,k),v&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(p,y,g)})}if(c.context=k,c.props=h,c.__P=e,c.__e=!1,P=b.__r,A=0,v){for(c.state=c.__s,c.__d=!1,P&&P(t),d=c.render(c.props,c.state,c.context),T=0;T<c._sb.length;T++)c.__h.push(c._sb[T]);c._sb=[]}else do c.__d=!1,P&&P(t),d=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++A<25);c.state=c.__s,c.getChildContext!=null&&(r=oe(oe({},r),c.getChildContext())),v&&!_&&c.getSnapshotBeforeUpdate!=null&&(g=c.getSnapshotBeforeUpdate(p,y)),_t(e,Se(B=d!=null&&d.type===ae&&d.key==null?d.props.children:d)?B:[B],t,n,r,o,a,i,s,u,l),c.base=t.__e,t.__u&=-161,c.__h.length&&i.push(c),m&&(c.__E=c.__=null)}catch(O){t.__v=null,u||a!=null?(t.__e=s,t.__u|=u?160:32,a[a.indexOf(s)]=null):(t.__e=n.__e,t.__k=n.__k),b.__e(O,t,n)}else a==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=bn(n.__e,t,n,r,o,a,i,u,l);(d=b.diffed)&&d(t)}function bt(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)Je(n[r],n[++r],n[++r]);b.__c&&b.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(a){a.call(o)})}catch(a){b.__e(a,o.__v)}})}function bn(e,t,n,r,o,a,i,s,u){var l,d,c,_,p,y,g,m=n.props,h=t.props,v=t.type;if(v==="svg"?o="http://www.w3.org/2000/svg":v==="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),a!=null){for(l=0;l<a.length;l++)if((p=a[l])&&"setAttribute"in p==!!v&&(v?p.localName===v:p.nodeType===3)){e=p,a[l]=null;break}}if(e==null){if(v===null)return document.createTextNode(h);e=document.createElementNS(o,v,h.is&&h),a=null,s=!1}if(v===null)m===h||s&&e.data===h||(e.data=h);else{if(a=a&&D.call(e.childNodes),m=n.props||be,!s&&a!=null)for(m={},l=0;l<e.attributes.length;l++)m[(p=e.attributes[l]).name]=p.value;for(l in m)if(p=m[l],l!="children"){if(l=="dangerouslySetInnerHTML")c=p;else if(l!=="key"&&!(l in h)){if(l=="value"&&"defaultValue"in h||l=="checked"&&"defaultChecked"in h)continue;De(e,l,null,p,o)}}for(l in h)p=h[l],l=="children"?_=p:l=="dangerouslySetInnerHTML"?d=p:l=="value"?y=p:l=="checked"?g=p:l==="key"||s&&typeof p!="function"||m[l]===p||De(e,l,p,m[l],o);if(d)s||c&&(d.__html===c.__html||d.__html===e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(c&&(e.innerHTML=""),_t(e,Se(_)?_:[_],t,n,r,v==="foreignObject"?"http://www.w3.org/1999/xhtml":o,a,i,a?a[0]:n.__k&&de(n,0),s,u),a!=null)for(l=a.length;l--;)a[l]!=null&&mt(a[l]);s||(l="value",y!==void 0&&(y!==e[l]||v==="progress"&&!y||v==="option"&&y!==m[l])&&De(e,l,y,m[l],o),l="checked",g!==void 0&&g!==e[l]&&De(e,l,g,m[l],o))}return e}function Je(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){b.__e(r,n)}}function We(e,t,n){var r,o;if(b.unmount&&b.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||Je(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(a){b.__e(a,t)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&We(r[o],t,n||typeof e.type!="function");n||e.__e==null||mt(e.__e),e.__c=e.__=e.__e=e.__d=void 0}function wn(e,t,n){return this.constructor(e,n)}function wt(e,t,n){var r,o,a,i;b.__&&b.__(e,t),o=(r=typeof n=="function")?null:t.__k,a=[],i=[],Ye(t,e=(!r&&n||t).__k=Ze(ae,null,[e]),o||be,be,t.namespaceURI,!r&&n?[n]:o?null:t.firstChild?D.call(t.childNodes):null,a,!r&&n?n:o?o.__e:t.firstChild,r,i),bt(a,e,i)}function Xe(e,t){var n={__c:t="__cC"+pt++,__:e,Consumer:function(r,o){return r.children(o)},Provider:function(r){var o,a;return this.getChildContext||(o=[],(a={})[t]=this,this.getChildContext=function(){return a},this.componentWillUnmount=function(){o=null},this.shouldComponentUpdate=function(i){this.props.value!==i.value&&o.some(function(s){s.__e=!0,qe(s)})},this.sub=function(i){o.push(i);var s=i.componentWillUnmount;i.componentWillUnmount=function(){o&&o.splice(o.indexOf(i),1),s&&s.call(i)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}D=ft.slice,b={__e:function(e,t,n,r){for(var o,a,i;t=t.__;)if((o=t.__c)&&!o.__)try{if((a=o.constructor)&&a.getDerivedStateFromError!=null&&(o.setState(a.getDerivedStateFromError(e)),i=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),i=o.__d),i)return o.__E=o}catch(s){e=s}throw e}},F=0,$.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=oe({},this.state),typeof e=="function"&&(e=e(oe({},n),this.props)),e&&oe(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),qe(this))},$.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),qe(this))},$.prototype.render=ae,V=[],Ee=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ge=function(e,t){return e.__v.__b-t.__v.__b},Ae.__r=0,ce=0,W=gt(!1),ue=gt(!0),pt=0;var kn=0;function f(e,t,n,r,o,a){t||(t={});var i,s,u=t;if("ref"in u)for(s in u={},t)s=="ref"?i=t[s]:u[s]=t[s];var l={type:e,props:u,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--kn,__i:-1,__u:0,__source:o,__self:a};if(typeof e=="function"&&(i=e.defaultProps))for(s in i)u[s]===void 0&&(u[s]=i[s]);return b.vnode&&b.vnode(l),l}const kt="2.0.4",z=Xe({});var me,I,Qe,xt,we=0,Pt=[],U=b,Et=U.__b,St=U.__r,Ct=U.diffed,At=U.__c,Tt=U.unmount,Dt=U.__;function Me(e,t){U.__h&&U.__h(I,e,we||t),we=0;var n=I.__H||(I.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function N(e){return we=1,xn(It,e)}function xn(e,t,n){var r=Me(me++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):It(void 0,t),function(s){var u=r.__N?r.__N[0]:r.__[0],l=r.t(u,s);u!==l&&(r.__N=[l,r.__[1]],r.__c.setState({}))}],r.__c=I,!I.u)){var o=function(s,u,l){if(!r.__c.__H)return!0;var d=r.__c.__H.__.filter(function(_){return!!_.__c});if(d.every(function(_){return!_.__N}))return!a||a.call(this,s,u,l);var c=!1;return d.forEach(function(_){if(_.__N){var p=_.__[0];_.__=_.__N,_.__N=void 0,p!==_.__[0]&&(c=!0)}}),!(!c&&r.__c.props===s)&&(!a||a.call(this,s,u,l))};I.u=!0;var a=I.shouldComponentUpdate,i=I.componentWillUpdate;I.componentWillUpdate=function(s,u,l){if(this.__e){var d=a;a=void 0,o(s,u,l),a=d}i&&i.call(this,s,u,l)},I.shouldComponentUpdate=o}return r.__N||r.__}function Z(e,t){var n=Me(me++,3);!U.__s&&Rt(n.__H,t)&&(n.__=e,n.i=t,I.__H.__h.push(n))}function ee(e){return we=5,pe(function(){return{current:e}},[])}function pe(e,t){var n=Me(me++,7);return Rt(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Mt(e,t){return we=8,pe(function(){return e},t)}function L(e){var t=I.context[e.__c],n=Me(me++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(I)),t.props.value):e.__}function Pn(){for(var e;e=Pt.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Oe),e.__H.__h.forEach($e),e.__H.__h=[]}catch(t){e.__H.__h=[],U.__e(t,e.__v)}}U.__b=function(e){I=null,Et&&Et(e)},U.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Dt&&Dt(e,t)},U.__r=function(e){St&&St(e),me=0;var t=(I=e.__c).__H;t&&(Qe===I?(t.__h=[],I.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.i=n.__N=void 0})):(t.__h.forEach(Oe),t.__h.forEach($e),t.__h=[],me=0)),Qe=I},U.diffed=function(e){Ct&&Ct(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Pt.push(t)!==1&&xt===U.requestAnimationFrame||((xt=U.requestAnimationFrame)||En)(Pn)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.i=void 0})),Qe=I=null},U.__c=function(e,t){t.some(function(n){try{n.__h.forEach(Oe),n.__h=n.__h.filter(function(r){return!r.__||$e(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],U.__e(r,n.__v)}}),At&&At(e,t)},U.unmount=function(e){Tt&&Tt(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{Oe(r)}catch(o){t=o}}),n.__H=void 0,t&&U.__e(t,n.__v))};var Ot=typeof requestAnimationFrame=="function";function En(e){var t,n=function(){clearTimeout(r),Ot&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Ot&&(t=requestAnimationFrame(n))}function Oe(e){var t=I,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),I=t}function $e(e){var t=I;e.__c=e.__(),I=t}function Rt(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function It(e,t){return typeof t=="function"?t(e):t}function Y(){const{language:e,translations:t}=L(z);function n(r){if(!t)return r;const o=t[e][r];return o||t.en[r]||r}return{t:n}}const Sn=()=>{const{t:e}=Y(),{isTestMode:t}=L(z);return f("footer",{class:"flex flex-col items-center gap-4 text-xs",children:[f("a",{href:"https://moyasar.com/?ref=payment-form-v1.14.0",target:"_blank",class:"text-black/70",children:[e("form.powered_by")," ",f("strong",{children:e("common.moyasar")})]}),t&&f("span",{class:"text-red-600",children:e("common.test_mode_disclaimer")})]})},Cn={"error.authentication_error":"خطأ في المصادقة، الخدمة غير متوفرة حالياً","error.authorization_error":"خطأ في التفويض، الخدمة غير متوفرة حالياً","error.network":"خطأ في الشبكة","error.unknown":"حدث خطأ غير متوقع","error.invalid_mobile":"رقم الجوال غير صحيح","error.invalid_otp":"رمز التحقق غير صحيح","error.invalid_request_error":"طلب دفع غير صحيح","error.mobile_not_registered":"رقم الجوال غير مسجل","error.account_inactive_error":"حساب التاجر غير نشط","error.invalid_name":"يجب إدخال الاسم الأول والأخير","error.unsupported_cc_type":"نوع البطاقة الإئتمانية غير مدعوم","error.invalid_cc_number":"رقم البطاقة الإئتمانية غير صحيح","error.invalid_date":"تاريخ الإنتهاء غير صحيح","error.invalid_month":"شهر الإنتهاء غير صحيح","error.invalid_year":"سنة الإنتهاء غير صحيحة","error.invalid_csc":"رمز الأمان للبطاقة غير صحيح","error.cant_start_payment":"خطأ في بدء عملية الدفع، يرجى المحاولة لاحقاً","error.otp_time_out":"انتهت مدة رمز التحقق، يرجى المحاولة مرة أخرى","error.api_error":"حدث خطأ، يرجى تحديث الصفحة والمحاولة مرة أخرى","error.applePay":"تعذر الاتصال أو تفويض العملية","error.m070":"غير مسموح للتاجر بإجراء عمليات في نظام 3Ds","error.m071":"غير مسموح للتاجر بإجراء عمليات مباشرة بدون نظام 3Ds","error.m072":"لا يوجد للبائع حساب بنكي فعال","error.m074":"بلد البطاقة الائتمانية غير مسموح به","error.m075":"حساب التاجر غير مشترك في فواتير ميسر","error.m076":"حساب التاجر غير مسموح له باستخدام طريقة الدفع هذه","error.m077":"حساب التاجر لا يمكنه استخدام طريقة دفع STC Pay","form.cc":"بطاقة ائتمانية","form.code":"الرمز","form.mobile":"رقم الجوال","form.otp":"رمز التحقق","form.required":"مطلوب","form.name_on_card":"الاسم على البطاقة","form.last_name":"اسم العائلة","form.card_info":"معلومات البطاقة","form.date":"تاريخ الانتهاء","form.csc":"رمز التحقق CVC","form.or_pay_with_card":"أو ادفع بالبطاقة","form.powered_by":"مدعوم بواسطة","form.save_card_notice":"سيتم حفظ بيانات بطاقتك عند الإرسال","button.pay":"ادفع","button.pay-with":"ادفع باستخدام","button.buy":"اشتر باستخدام","button.donate":"تبرع باستخدام","button.book":"احجز باستخدام","button.check-out":"اتمام الشراء باستخدام","button.subscribe":"اشترك باستخدام","button.add-money":"أضف رصيد باستخدام","button.contribute":"ساهم باستخدام","button.order":"اطلب باستخدام","button.reload":"أعد الشحن باستخدام","button.rent":"استأجر باستخدام","button.support":"ادعم باستخدام","button.tip":"اترك إكرامية باستخدام","button.top-up":"اشحن باستخدام","button.continue":"المتابعة للدفع","button.verify":"تحقق","button.proceed":"متابعة","button.cancel":"إلغاء","validation.is_invalid":":attr غير صحيح","validation.can_t_be_blank":":attr مطلوب","validation.should_be_english_letters_only":"الاسم يجب أن يحتوي على أحرف إنجليزية ومسافات فقط","validation.first_and_last_name_required":"يجب إدخال الاسم الأول والأخير","common.moyasar":"ميسر","common.test_mode_disclaimer":"وضع الاختبار مفعل: يرجى عدم الاستخدام في بيئة غير تجريبية!"},An={"error.authentication_error":"Authentication error, service is unavailable now","error.authorization_error":"Authorization error, service is unavailable now","error.network":"Network Error","error.unknown":"Unexpected error occurred","error.invalid_mobile":"Invalid mobile number","error.invalid_otp":"Invalid verification code","error.invalid_request_error":"Invalid payment request","error.mobile_not_registered":"Mobile number is not registered","error.account_inactive_error":"Merchant account is not active","error.invalid_name":"First and last names are required","error.unsupported_cc_type":"Unsupported card type","error.invalid_cc_number":"Invalid credit card","error.invalid_date":"Invalid date","error.invalid_month":"Invalid month","error.invalid_year":"Invalid year","error.invalid_csc":"Invalid CVC number","error.cant_start_payment":"Error initiating payment, please try again later","error.otp_time_out":"OTP time has finished, please try again","error.api_error":"An error has occurred, please refresh the page and try again.","error.applePay":"Unable to connect or authorize transaction","error.m070":"Merchant is not allowed to transact in 3Ds","error.m071":"Merchant is not allowed to transact directly without 3Ds","error.m072":"Merchant does not have bank MID specified","error.m074":"Credit card country is not allowed","error.m075":"Merchant account is not subscribed to Moyasar invoices","error.m076":"Merchant account is not allowed to use this payment method","error.m077":"Merchant account cannot use stc pay method","form.cc":"Credit Card","form.code":"Code","form.mobile":"Mobile number","form.otp":"Verification code","form.required":"Required","form.name_on_card":"Name on card","form.last_name":"Last name","form.card_info":"Card information","form.date":"Expiry date","form.csc":"CVC","form.or_pay_with_card":"Or pay with card","form.powered_by":"Powered by","form.save_card_notice":"You card data will be saved upon submit.","button.pay":"Pay","button.pay-with":"Pay with","button.buy":"Buy with","button.donate":"Donate with","button.book":"Book with","button.check-out":"Check out with","button.subscribe":"Subscribe with","button.add-money":"Add money with","button.contribute":"Contribute with","button.order":"Order with","button.reload":"Reload with","button.rent":"Rent with","button.support":"Support with","button.tip":"Tip with","button.top-up":"Top Up with","button.continue":"Continue with payment","button.verify":"Verify","button.proceed":"Proceed","button.cancel":"Cancel","validation.is_invalid":"Invalid :attr","validation.can_t_be_blank":":attr is required","validation.should_be_english_letters_only":"Name may only have English alphabet and spaces","validation.first_and_last_name_required":"Both first and last name are required","common.moyasar":"Moyasar","common.test_mode_disclaimer":"Test Mode Enabled: Please do not use in production!"},Tn=e=>{const t={en:An,ar:Cn};return e&&Object.entries(e).forEach(([n,r])=>{t[n]||(t[n]={}),Object.entries(r).forEach(([o,a])=>{t[n][o]=a})}),t},Dn="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%20450%20133'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;'%3e%3cg%3e%3cpath%20d='M291.862,97.715l0,-69.89l11.852,0l0,5.604c3.607,-4.509%208.954,-6.957%2015.588,-6.957c13.656,0%2023.447,10.886%2023.447,26.474c0,15.588%20-9.855,26.668%20-23.447,26.668c-6.699,0%20-11.981,-2.577%20-15.588,-7.086l0,25.186l-11.852,0l0,0.001Zm11.853,-51.209l-0,12.883c2.512,5.218%207.021,9.018%2013.527,9.018c7.859,0%2013.141,-5.862%2013.141,-15.524c-0,-9.533%20-5.282,-15.331%20-13.141,-15.331c-6.506,0.064%20-11.015,3.607%20-13.527,8.954'%20style='fill:%2302aa7c;fill-rule:nonzero;'/%3e%3cpath%20d='M350.415,63.769c0,-8.503%205.282,-14.429%2014.042,-15.524l20.162,-2.577l0,-2.512c0,-3.027%20-1.546,-4.638%20-4.38,-4.638l-25.315,0l0,-10.757l25.766,0c10.242,0%2015.846,5.024%2015.846,13.914l0,36.394l-11.981,0l0,-6.119c-3.478,4.896%20-9.211,7.665%20-16.619,7.665c-10.435,0%20-17.521,-6.377%20-17.521,-15.846m20.419,6.183c6.055,0%2011.659,-3.414%2013.72,-8.438l0,-6.313l-15.395,2.126c-4.251,0.58%20-6.635,2.834%20-6.635,6.506c0.001,3.929%203.028,6.119%208.31,6.119'%20style='fill:%2302aa7c;fill-rule:nonzero;'/%3e%3cpath%20d='M405.167,86.958l8.632,0c3.285,0%204.767,-1.353%205.862,-4.445l1.546,-4.445l-18.294,-50.308l12.368,0l11.401,35.042l0.258,0l10.886,-35.042l12.174,0l-20.033,57.78c-2.705,7.923%20-6.313,12.174%20-15.137,12.174l-9.662,0l-0.001,-10.756Z'%20style='fill:%2302aa7c;fill-rule:nonzero;'/%3e%3cpath%20d='M43.48,132.306c13.785,0%2025.122,-4.316%2032.594,-11.53c5.604,-5.54%208.889,-13.012%208.889,-21.643c0,-7.794%20-2.899,-14.815%20-8.245,-20.162c-5.346,-5.347%20-13.012,-9.276%20-22.674,-11.144l-15.846,-3.092c-6.57,-1.224%20-10.306,-4.509%20-10.306,-9.082c0,-5.991%205.797,-10.113%2015.073,-10.113c5.797,0%2010.757,1.868%2014.042,5.153c2.061,2.255%203.478,5.153%203.929,8.438l22.867,-5.153c-0.644,-6.57%20-3.736,-12.368%20-8.438,-17.134c-7.536,-7.408%20-19.067,-12.11%20-32.658,-12.11c-12.561,0%20-23.06,4.123%20-30.339,10.693c-6.184,5.797%20-9.662,13.591%20-9.662,22.287c0,7.601%202.448,14.042%207.408,18.938c4.96,4.96%2012.174,8.632%2021.643,10.95l15.653,3.736c7.859,1.868%2011.337,4.767%2011.337,9.92c0,6.377%20-5.797,10.113%20-15.266,10.113c-6.828,0%20-12.368,-2.255%20-15.846,-5.991c-2.448,-2.448%20-3.929,-5.797%20-4.123,-9.469l-23.512,5.154c0.644,7.021%203.929,13.205%208.889,18.165c7.794,8.18%2020.42,13.076%2034.591,13.076m174.048,0c15.266,0%2026.99,-5.54%2035.041,-13.398c6.377,-6.184%2010.306,-13.398%2012.368,-20.806l-24.091,-8.052c-1.031,3.736%20-3.092,7.665%20-6.377,10.693c-3.929,3.736%20-9.276,6.377%20-16.941,6.377c-7.021,0%20-13.591,-2.705%20-18.358,-7.408c-4.767,-4.96%20-7.665,-12.174%20-7.665,-21.257c-0,-9.276%202.899,-16.297%207.665,-21.257c4.702,-4.767%2011.144,-7.214%2018.165,-7.214c7.408,-0%2012.561,2.448%2016.297,6.184c3.092,3.092%204.96,7.021%206.184,10.95l24.542,-8.245c-1.868,-7.214%20-5.797,-14.429%20-11.53,-20.419c-8.245,-8.052%20-20.226,-13.785%20-36.072,-13.785c-14.622,-0%20-27.827,5.54%20-37.296,15.073c-9.469,9.662%20-15.266,23.125%20-15.266,38.778c0,15.653%205.991,29.051%2015.653,38.778c9.403,9.468%2022.801,15.008%2037.681,15.008m-83.288,0c10.693,0%2018.358,-3.285%2021.643,-6.184l0,-22.287c-2.512,1.868%20-7.408,4.123%20-13.849,4.123c-4.573,0%20-7.859,-1.031%20-10.306,-3.285c-2.061,-2.061%20-3.092,-5.604%20-3.092,-10.306l0,-94.367l-27.247,0l0,27.827l54.43,0l0,26.41l-54.43,0l0,46.829c0,9.469%202.899,17.134%208.052,22.481c5.797,5.667%2014.299,8.759%2024.799,8.759'%20style='fill:%23fff;fill-rule:nonzero;'/%3e%3c/g%3e%3c/svg%3e";function Nt(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Nt(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Mn(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Nt(e))&&(r&&(r+=" "),r+=t);return r}const ie=(...e)=>Mn(e),et=e=>{const p=e,{children:t,type:n="button",variant:r="primary",onClick:o,disabled:a,busy:i,fail:s,success:u}=p,l=Ke(p,["children","type","variant","onClick","disabled","busy","fail","success"]),{isProcessing:d}=L(z),c={primary:"bg-primary text-white",stc:"bg-stc text-white",error:"bg-error text-white pointer-events-none",success:"bg-success text-white"};function _(){return s?c.error:u?c.success:c[r]}return f("button",R(S({},l),{type:n,disabled:d||a,onClick:o,class:ie(["flex h-11 w-full cursor-pointer items-center justify-center gap-2 rounded-lg px-3 py-2 transition-colors disabled:cursor-default disabled:opacity-70",_(),e.class,d&&!s&&"pointer-events-none grayscale"]),children:[s?f("svg",{class:"h-5 w-5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[f("circle",{cx:"12",cy:"12",r:"10"}),f("path",{d:"m15 9-6 6"}),f("path",{d:"m9 9 6 6"})]}):t,i&&f("svg",{class:"h-4 w-4 animate-spin text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[f("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),f("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),u&&f("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"h-4 w-4",children:[f("path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5"}),f("path",{class:"animate-fade-in",d:"m9 11 3 3L22 4"})]})]}))},he=e=>{const u=e,{name:t,placeholder:n,type:r="text",onBlur:o,disabled:a}=u,i=Ke(u,["name","placeholder","type","onBlur","disabled"]),{isProcessing:s}=L(z);return f("input",R(S({},i),{dir:"ltr",id:t,name:t,disabled:s||a,class:ie(["relative block w-full rounded-lg border-0 px-4 py-2 text-sm text-black shadow-input placeholder:text-black/70 focus:z-[2] focus:shadow-input-focus focus:outline-none",e.class,s&&"pointer-events-none grayscale",e.error&&"z-[1] shadow-input-error"]),type:r,placeholder:n,onBlur:l=>{const d=l.target;d.classList.add("shadow-input-error","z-[1]"),d.value.trim()&&d.classList.remove("shadow-input-error","z-[1]"),o&&typeof o=="function"&&o(l)}}))},tt=Xe({});function On(e,t){for(var n in t)e[n]=t[n];return e}function Ft(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function Ut(e,t){this.props=e,this.context=t}(Ut.prototype=new $).isPureReactComponent=!0,Ut.prototype.shouldComponentUpdate=function(e,t){return Ft(this.props,e)||Ft(this.state,t)};var Lt=b.__b;b.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Lt&&Lt(e)};var Rn=b.__e;b.__e=function(e,t,n,r){if(e.then){for(var o,a=t;a=a.__;)if((o=a.__c)&&o.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t)}Rn(e,t,n,r)};var Vt=b.unmount;function Gt(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=On({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Gt(r,t,n)})),e}function Bt(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Bt(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function nt(){this.__u=0,this.t=null,this.__b=null}function zt(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Re(){this.u=null,this.o=null}b.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Vt&&Vt(e)},(nt.prototype=new $).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var o=zt(r.__v),a=!1,i=function(){a||(a=!0,n.__R=null,o?o(s):s())};n.__R=i;var s=function(){if(!--r.__u){if(r.state.__a){var u=r.state.__a;r.__v.__k[0]=Bt(u,u.__c.__P,u.__c.__O)}var l;for(r.setState({__a:r.__b=null});l=r.t.pop();)l.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(i,i)},nt.prototype.componentWillUnmount=function(){this.t=[]},nt.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Gt(this.__b,n,r.__O=r.__P)}this.__b=null}var o=t.__a&&Ze(ae,null,e.fallback);return o&&(o.__u&=-33),[Ze(ae,null,t.__a?null:e.children),o]};var jt=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};(Re.prototype=new $).__a=function(e){var t=this,n=zt(t.__v),r=t.o.get(e);return r[0]++,function(o){var a=function(){t.props.revealOrder?(r.push(o),jt(t,e,r)):o()};n?n(a):a()}},Re.prototype.render=function(e){this.u=null,this.o=new Map;var t=Te(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},Re.prototype.componentDidUpdate=Re.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,n){jt(e,n,t)})};var In=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,Nn=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Fn=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Un=/[A-Z0-9]/g,Ln=typeof document!="undefined",Vn=function(e){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};$.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty($.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Ht=b.event;function Gn(){}function Bn(){return this.cancelBubble}function zn(){return this.defaultPrevented}b.event=function(e){return Ht&&(e=Ht(e)),e.persist=Gn,e.isPropagationStopped=Bn,e.isDefaultPrevented=zn,e.nativeEvent=e};var jn={enumerable:!1,configurable:!0,get:function(){return this.class}},Kt=b.vnode;b.vnode=function(e){typeof e.type=="string"&&function(t){var n=t.props,r=t.type,o={};for(var a in n){var i=n[a];if(!(a==="value"&&"defaultValue"in n&&i==null||Ln&&a==="children"&&r==="noscript"||a==="class"||a==="className")){var s=a.toLowerCase();a==="defaultValue"&&"value"in n&&n.value==null?a="value":a==="download"&&i===!0?i="":s==="translate"&&i==="no"?i=!1:s==="ondoubleclick"?a="ondblclick":s!=="onchange"||r!=="input"&&r!=="textarea"||Vn(n.type)?s==="onfocus"?a="onfocusin":s==="onblur"?a="onfocusout":Fn.test(a)?a=s:r.indexOf("-")===-1&&Nn.test(a)?a=a.replace(Un,"-$&").toLowerCase():i===null&&(i=void 0):s=a="oninput",s==="oninput"&&o[a=s]&&(a="oninputCapture"),o[a]=i}}r=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=Te(n.children).forEach(function(u){u.props.selected=o.value.indexOf(u.props.value)!=-1})),r=="select"&&o.defaultValue!=null&&(o.value=Te(n.children).forEach(function(u){u.props.selected=o.multiple?o.defaultValue.indexOf(u.props.value)!=-1:o.defaultValue==u.props.value})),n.class&&!n.className?(o.class=n.class,Object.defineProperty(o,"className",jn)):(n.className&&!n.class||n.class&&n.className)&&(o.class=o.className=n.className),t.props=o}(e),e.$$typeof=In,Kt&&Kt(e)};var Zt=b.__r;b.__r=function(e){Zt&&Zt(e),e.__c};var qt=b.diffed;b.diffed=function(e){qt&&qt(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value)};function _e(e,t,n){var r=this,o=ee(null),a=ee(0),i=ee(null),s=ee([]),u=ee(),l=ee(),d=ee(e),c=ee(!0);d.current=e;var _=typeof window!="undefined",p=!t&&t!==0&&_;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var y=!!(n=n||{}).leading,g=!("trailing"in n)||!!n.trailing,m="maxWait"in n,h="debounceOnServer"in n&&!!n.debounceOnServer,v=m?Math.max(+n.maxWait||0,t):null;Z(function(){return c.current=!0,function(){c.current=!1}},[]);var x=pe(function(){var k=function(C){var O=s.current,q=u.current;return s.current=u.current=null,a.current=C,l.current=d.current.apply(q,O)},w=function(C,O){p&&cancelAnimationFrame(i.current),i.current=p?requestAnimationFrame(C):setTimeout(C,O)},P=function(C){if(!c.current)return!1;var O=C-o.current;return!o.current||O>=t||O<0||m&&C-a.current>=v},A=function(C){return i.current=null,g&&s.current?k(C):(s.current=u.current=null,l.current)},T=function C(){var O=Date.now();if(P(O))return A(O);if(c.current){var q=t-(O-o.current),ne=m?Math.min(q,v-(O-a.current)):q;w(C,ne)}},B=function(){if(_||h){var C=Date.now(),O=P(C);if(s.current=[].slice.call(arguments),u.current=r,o.current=C,O){if(!i.current&&c.current)return a.current=o.current,w(T,t),y?k(o.current):l.current;if(m)return w(T,t),k(o.current)}return i.current||w(T,t),l.current}};return B.cancel=function(){i.current&&(p?cancelAnimationFrame(i.current):clearTimeout(i.current)),a.current=0,s.current=o.current=u.current=i.current=null},B.isPending=function(){return!!i.current},B.flush=function(){return i.current?A(Date.now()):l.current},B},[y,m,t,v,g,p,_,h]);return x}var Hn=Object.defineProperty,Kn=(e,t,n)=>t in e?Hn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ie=(e,t,n)=>Kn(e,typeof t!="symbol"?t+"":t,n);const Yt={"#":{pattern:/[0-9]/},"@":{pattern:/[a-zA-Z]/},"*":{pattern:/[a-zA-Z0-9]/}},Jt=(e,t,n)=>e.replaceAll(t,"").replace(n,".").replace("..",".").replace(/[^.\d]/g,""),Wt=(e,t,n)=>{var o;var r;return new Intl.NumberFormat((o=(r=n.number)==null?void 0:r.locale)!=null?o:"en",{minimumFractionDigits:e,maximumFractionDigits:t,roundingMode:"trunc"})},Zn=(e,t=!0,n)=>{var m,h,v;var r,o,a,i;const s=((r=n.number)==null?void 0:r.unsigned)==null&&e.startsWith("-")?"-":"",u=(m=(o=n.number)==null?void 0:o.fraction)!=null?m:0;let l=Wt(0,u,n);const d=l.formatToParts(1000.12),c=(h=(a=d.find(x=>x.type==="group"))==null?void 0:a.value)!=null?h:" ",_=(v=(i=d.find(x=>x.type==="decimal"))==null?void 0:i.value)!=null?v:".",p=Jt(e,c,_);if(Number.isNaN(parseFloat(p)))return s;const y=p.split(".");if(y[1]!=null&&y[1].length>=1){const x=y[1].length<=u?y[1].length:u;l=Wt(x,u,n)}let g=l.format(parseFloat(p));return t?u>0&&p.endsWith(".")&&!p.slice(0,-1).includes(".")&&(g+=_):g=Jt(g,c,_),s+g};class qn{constructor(t={}){var r;Ie(this,"opts",{}),Ie(this,"memo",new Map);const n=S({},t);if(n.tokens!=null){n.tokens=n.tokensReplace?S({},n.tokens):S(S({},Yt),n.tokens);for(const o of Object.values(n.tokens))typeof o.pattern=="string"&&(o.pattern=new RegExp(o.pattern))}else n.tokens=Yt;Array.isArray(n.mask)&&(n.mask.length>1?n.mask=[...n.mask].sort((o,a)=>o.length-a.length):n.mask=(r=n.mask[0])!=null?r:""),n.mask===""&&(n.mask=null),this.opts=n}masked(t){return this.process(t,this.findMask(t))}unmasked(t){return this.process(t,this.findMask(t),!1)}isEager(){return this.opts.eager===!0}isReversed(){return this.opts.reversed===!0}completed(t){const n=this.findMask(t);if(this.opts.mask==null||n==null)return!1;const r=this.process(t,n).length;return typeof this.opts.mask=="string"?r>=this.opts.mask.length:r>=n.length}findMask(t){var o,a;const n=this.opts.mask;if(n==null)return null;if(typeof n=="string")return n;if(typeof n=="function")return n(t);const r=this.process(t,(o=n.slice(-1).pop())!=null?o:"",!1);return(a=n.find(i=>this.process(t,i,!1).length>=r.length))!=null?a:""}escapeMask(t){const n=[],r=[];return t.split("").forEach((o,a)=>{o==="!"&&t[a-1]!=="!"?r.push(a-r.length):n.push(o)}),{mask:n.join(""),escaped:r}}process(t,n,r=!0){if(this.opts.number!=null)return Zn(t,r,this.opts);if(n==null)return t;const o=`v=${t},mr=${n},m=${r?1:0}`;if(this.memo.has(o))return this.memo.get(o);const{mask:a,escaped:i}=this.escapeMask(n),s=[],u=this.opts.tokens!=null?this.opts.tokens:{},l=this.isReversed()?-1:1,d=this.isReversed()?"unshift":"push",c=this.isReversed()?0:a.length-1,_=this.isReversed()?()=>m>-1&&h>-1:()=>m<a.length&&h<t.length,p=x=>!this.isReversed()&&x<=c||this.isReversed()&&x>=c;let y,g=-1,m=this.isReversed()?a.length-1:0,h=this.isReversed()?t.length-1:0,v=!1;for(;_();){const x=a.charAt(m),k=u[x],w=(k==null?void 0:k.transform)!=null?k.transform(t.charAt(h)):t.charAt(h);if(!i.includes(m)&&k!=null?(w.match(k.pattern)!=null?(s[d](w),k.repeated?(g===-1?g=m:m===c&&m!==g&&(m=g-l),c===g&&(m-=l)):k.multiple&&(v=!0,m-=l),m+=l):k.multiple?v&&(m+=l,h-=l,v=!1):w===y?y=void 0:k.optional&&(m+=l,h-=l),h+=l):(r&&!this.isEager()&&s[d](x),w===x&&!this.isEager()?h+=l:y=x,this.isEager()||(m+=l)),this.isEager())for(;p(m)&&(u[a.charAt(m)]==null||i.includes(m));){if(r){if(s[d](a.charAt(m)),t.charAt(h)===a.charAt(m)){m+=l,h+=l;continue}}else a.charAt(m)===t.charAt(h)&&(h+=l);m+=l}}return this.memo.set(o,s.join("")),this.memo.get(o)}}const Xt=e=>JSON.parse(e.replaceAll("'",'"')),Yn=(e,t={})=>{const n=S({},t);e.dataset.maska!=null&&e.dataset.maska!==""&&(n.mask=Jn(e.dataset.maska)),e.dataset.maskaEager!=null&&(n.eager=Ne(e.dataset.maskaEager)),e.dataset.maskaReversed!=null&&(n.reversed=Ne(e.dataset.maskaReversed)),e.dataset.maskaTokensReplace!=null&&(n.tokensReplace=Ne(e.dataset.maskaTokensReplace)),e.dataset.maskaTokens!=null&&(n.tokens=Wn(e.dataset.maskaTokens));const r={};return e.dataset.maskaNumberLocale!=null&&(r.locale=e.dataset.maskaNumberLocale),e.dataset.maskaNumberFraction!=null&&(r.fraction=parseInt(e.dataset.maskaNumberFraction)),e.dataset.maskaNumberUnsigned!=null&&(r.unsigned=Ne(e.dataset.maskaNumberUnsigned)),(e.dataset.maskaNumber!=null||Object.values(r).length>0)&&(n.number=r),n},Ne=e=>e!==""?!!JSON.parse(e):!0,Jn=e=>e.startsWith("[")&&e.endsWith("]")?Xt(e):e,Wn=e=>{if(e.startsWith("{")&&e.endsWith("}"))return Xt(e);const t={};return e.split("|").forEach(n=>{const r=n.split(":");t[r[0]]={pattern:new RegExp(r[1]),optional:r[2]==="optional",multiple:r[2]==="multiple",repeated:r[2]==="repeated"}}),t};class Fe{constructor(t,n={}){Ie(this,"items",new Map),Ie(this,"onInput",r=>{if(r instanceof CustomEvent&&r.type==="input"&&!r.isTrusted&&!r.bubbles)return;const o=r.target,a=this.items.get(o),i="inputType"in r&&r.inputType.startsWith("delete"),s=a.isEager(),u=i&&s&&a.unmasked(o.value)===""?"":o.value;this.fixCursor(o,i,()=>this.setValue(o,u))}),this.options=n,this.init(this.getInputs(t))}update(t={}){this.options=S({},t),this.init(Array.from(this.items.keys()))}updateValue(t){t.value!==""&&t.value!==this.processInput(t).masked&&this.setValue(t,t.value)}destroy(){for(const t of this.items.keys())t.removeEventListener("input",this.onInput);this.items.clear()}init(t){const n=this.getOptions(this.options);for(const r of t){this.items.has(r)||r.addEventListener("input",this.onInput,{capture:!0});const o=new qn(Yn(r,n));this.items.set(r,o),queueMicrotask(()=>this.updateValue(r)),r.selectionStart===null&&o.isEager()&&console.warn("Maska: input of `%s` type is not supported",r.type)}}getInputs(t){return typeof t=="string"?Array.from(document.querySelectorAll(t)):"length"in t?Array.from(t):[t]}getOptions(t){const i=t,{onMaska:n,preProcess:r,postProcess:o}=i;return Ke(i,["onMaska","preProcess","postProcess"])}fixCursor(t,n,r){const o=t.selectionStart,a=t.value;if(r(),o===null||o===a.length&&!n)return;const i=t.value,s=a.slice(0,o),u=i.slice(0,o),l=this.processInput(t,s).unmasked,d=this.processInput(t,u).unmasked;let c=o;s!==u&&(c+=n?i.length-a.length:l.length-d.length),t.setSelectionRange(c,c)}setValue(t,n){const r=this.processInput(t,n);t.value=r.masked,this.options.onMaska!=null&&(Array.isArray(this.options.onMaska)?this.options.onMaska.forEach(o=>o(r)):this.options.onMaska(r)),t.dispatchEvent(new CustomEvent("maska",{detail:r})),t.dispatchEvent(new CustomEvent("input",{detail:r.masked}))}processInput(t,n){const r=this.items.get(t);let o=n!=null?n:t.value;this.options.preProcess!=null&&(o=this.options.preProcess(o));let a=r.masked(o);return this.options.postProcess!=null&&(a=this.options.postProcess(a)),{masked:a,unmasked:r.unmasked(o),completed:r.completed(o)}}}const Xn=({showOtp:e,value:t,setValue:n})=>{const{t:r}=Y(),{handleBlur:o,err:a}=L(tt),i="### ### ####",s=l=>{const d=l.target,{value:c}=d;n(c)},u=_e(o,1e3);return Z(()=>{new Fe('[name="mysr-stc-mobile"]')},[]),f(he,{name:"mysr-stc-mobile",label:r("form.mobile"),type:"text",inputMode:"numeric",maxLength:i.length,autocomplete:"tel-national",placeholder:"05x xxx xxxx",class:ie(["animate-fade-in text-center",!e&&"hidden"]),onAnimationEnd:l=>{l.target&&l.target.focus()},value:t,onKeyUp:l=>{s(l),u(l)},onBlur:o,error:a.phone,"data-maska":i,"data-maska-eager":!0})},Qn=({showPhone:e,value:t,setValue:n})=>{const{t:r}=Y(),{handleBlur:o,err:a}=L(tt),i=u=>{const l=u.target,{value:d}=l;n(d)},s=_e(o,1e3);return Z(()=>{new Fe('[name="mysr-stc-otp"]')},[]),f(he,{name:"mysr-stc-otp",label:r("form.otp"),type:"text",inputMode:"numeric",autocomplete:"one-time-code",placeholder:r("form.code"),class:ie(["animate-fade-in text-center",e&&"hidden"]),onAnimationEnd:u=>{u.target&&u.target.focus()},value:t,onKeyUp:u=>{i(u),s(u)},onBlur:o,error:a.otp,"data-maska":"### ###","data-maska-eager":!0})},j=e=>e.split(" ").join(""),$n=({countTo:e,callback:t})=>{const n=ee(null),r=Mt(()=>{const s=e?new Date(e).getTime()-new Date().getTime():0;return s<0?0:s},[e]),[o,a]=N(r());Z(()=>(n.current=setInterval(()=>{a(r())},500),()=>{n.current&&clearInterval(n.current)}),[r]),Z(()=>{o===0&&(n.current&&clearInterval(n.current),typeof t=="function"&&t(0))},[t,o]);const i=()=>{const s=Math.floor(o/1e3/60/60),u=Math.floor((o/1e3/60/60-s)*60),l=Math.floor(((o/1e3/60/60-s)*60-u)*60);return f("span",{children:[u,":",l<10?`0${l}`:l]})};return!e||!o?null:f("div",{class:ie("inline-flex gap-2 text-sm"),children:i()})},er="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%20512%20174'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;'%3e%3cg%3e%3cpath%20d='M326.531,121.529l-0,-74.676l12.663,0l0,5.988c3.854,-4.818%209.567,-7.433%2016.655,-7.433c14.592,-0%2025.053,11.631%2025.053,28.286c-0,16.656%20-10.53,28.494%20-25.053,28.494c-7.157,0%20-12.801,-2.753%20-16.655,-7.571l0,26.911l-12.663,-0l-0,0.001Zm12.664,-54.716l0,13.765c2.684,5.576%207.502,9.636%2014.453,9.636c8.398,-0%2014.041,-6.264%2014.041,-16.587c0,-10.186%20-5.643,-16.381%20-14.041,-16.381c-6.951,0.069%20-11.769,3.854%20-14.453,9.567'%20style='fill:%2302aa7c;fill-rule:nonzero;'%20/%3e%3cpath%20d='M389.093,85.258c-0,-9.085%205.643,-15.417%2015.003,-16.587l21.543,-2.753l-0,-2.684c-0,-3.234%20-1.652,-4.956%20-4.68,-4.956l-27.048,0l-0,-11.493l27.53,-0c10.943,-0%2016.931,5.368%2016.931,14.867l-0,38.885l-12.802,0l0,-6.538c-3.716,5.232%20-9.841,8.19%20-17.757,8.19c-11.149,0%20-18.72,-6.813%20-18.72,-16.931m21.817,6.607c6.469,-0%2012.457,-3.648%2014.659,-9.016l0,-6.745l-16.449,2.271c-4.542,0.62%20-7.089,3.028%20-7.089,6.952c0.001,4.198%203.235,6.538%208.879,6.538'%20style='fill:%2302aa7c;fill-rule:nonzero;'%20/%3e%3cpath%20d='M447.594,110.035l9.223,0c3.51,0%205.093,-1.446%206.263,-4.749l1.652,-4.75l-19.547,-53.752l13.215,-0l12.182,37.441l0.275,0l11.632,-37.441l13.007,-0l-21.404,61.736c-2.891,8.465%20-6.746,13.008%20-16.174,13.008l-10.323,-0l-0.001,-11.493Z'%20style='fill:%2302aa7c;fill-rule:nonzero;'%20/%3e%3cpath%20d='M61.142,158.488c14.729,0%2026.842,-4.611%2034.826,-12.319c5.987,-5.92%209.497,-13.903%209.497,-23.125c0,-8.328%20-3.097,-15.83%20-8.809,-21.543c-5.712,-5.713%20-13.903,-9.911%20-24.227,-11.907l-16.931,-3.304c-7.02,-1.307%20-11.011,-4.817%20-11.011,-9.703c-0,-6.402%206.194,-10.806%2016.105,-10.806c6.194,0%2011.493,1.996%2015.003,5.506c2.202,2.409%203.716,5.506%204.198,9.016l24.433,-5.506c-0.688,-7.02%20-3.992,-13.215%20-9.016,-18.307c-8.052,-7.915%20-20.372,-12.939%20-34.894,-12.939c-13.421,-0%20-24.639,4.405%20-32.416,11.425c-6.608,6.194%20-10.324,14.521%20-10.324,23.813c0,8.121%202.616,15.003%207.915,20.234c5.3,5.3%2013.008,9.223%2023.125,11.7l16.725,3.992c8.397,1.996%2012.113,5.093%2012.113,10.599c0,6.814%20-6.194,10.806%20-16.311,10.806c-7.295,-0%20-13.215,-2.41%20-16.931,-6.402c-2.616,-2.615%20-4.198,-6.194%20-4.405,-10.117l-25.122,5.507c0.688,7.502%204.198,14.109%209.498,19.409c8.327,8.74%2021.818,13.971%2036.959,13.971m185.965,0c16.311,0%2028.838,-5.919%2037.44,-14.315c6.814,-6.608%2011.012,-14.316%2013.215,-22.231l-25.74,-8.603c-1.102,3.992%20-3.304,8.19%20-6.814,11.425c-4.198,3.992%20-9.911,6.814%20-18.101,6.814c-7.502,-0%20-14.522,-2.891%20-19.615,-7.916c-5.093,-5.299%20-8.19,-13.007%20-8.19,-22.712c0,-9.911%203.098,-17.413%208.19,-22.713c5.024,-5.093%2011.907,-7.708%2019.409,-7.708c7.915,0%2013.421,2.616%2017.413,6.608c3.303,3.304%205.299,7.502%206.607,11.7l26.222,-8.81c-1.995,-7.708%20-6.193,-15.417%20-12.319,-21.817c-8.81,-8.603%20-21.611,-14.729%20-38.542,-14.729c-15.623,0%20-29.732,5.919%20-39.849,16.105c-10.118,10.324%20-16.312,24.709%20-16.312,41.433c0,16.725%206.401,31.04%2016.725,41.433c10.047,10.117%2024.362,16.036%2040.261,16.036m-88.991,0c11.425,0%2019.615,-3.51%2023.125,-6.607l0,-23.813c-2.684,1.996%20-7.915,4.405%20-14.797,4.405c-4.886,-0%20-8.397,-1.102%20-11.012,-3.51c-2.202,-2.202%20-3.303,-5.988%20-3.303,-11.012l-0,-100.828l-29.113,0l0,29.732l58.157,0l-0,28.219l-58.157,-0l0,50.035c0,10.117%203.097,18.307%208.603,24.02c6.194,6.055%2015.278,9.359%2026.497,9.359'%20style='fill:%23502c84;fill-rule:nonzero;'%20/%3e%3c/g%3e%3c/svg%3e";function Qt(e){return e.errors!==void 0}const tr=()=>{const{t:e}=Y(),[t,n]=N(!1),{amount:r,currency:o,description:a,publishable_api_key:i,metadata:s,invoice_id:u,version:l,base_url:d,on_failure:c,setFormSettings:_}=L(z),p=v=>{_&&(n(v),_(x=>R(S({},x),{isProcessing:v})))},y={amount:r,currency:o,description:a,publishable_api_key:i};s&&Object.keys(s).length>0&&(y.metadata=s),u&&(y.invoice_id=u.toLowerCase());const g=v=>{_&&_(x=>R(S({},x),{apiError:`${e("error."+v.type)}, ${v.message}`}))},m=()=>{_&&_(v=>R(S({},v),{apiError:""}))};return{processing:t,postData:k=>Q(this,[k],function*({data:v,path:x}){p(!0),m();const w=x||`${d}/v1/payments`;try{const P=yield fetch(w,{method:"POST",headers:{"Content-Type":"application/json","X-Moyasar-Form-Version":l},body:JSON.stringify(S(S({},y),v))});if(!P.ok){if(typeof P=="object"){const A=yield P.json();if(console.log("fetch error:",A),!Qt(A)){g({type:"api_error",message:`Error code: ${P.status}`,errors:null});return}return g(A),A}return yield Promise.reject(P)}return P.json()}catch(P){if(c)try{yield c(P)}catch(A){console.error("An error happened when firing failure callback"),console.error(A)}console.error(P)}finally{p(!1)}})}},nr=()=>{const{apiError:e}=L(z),[t,n]=N(!1);return Z(()=>{n(!!e)},[e]),Z(()=>{let r=null;return t&&(r=setTimeout(()=>{n(!1)},3e3)),()=>{r&&clearTimeout(r)}},[t]),{fail:t}},rr=n=>Q(this,[n],function*({on_initiating:e,setFormSettings:t}){const r=a=>{if(typeof a!="object"||!t)return;const i=["callback_url","description","metadata","amount"];for(const s in a)if(!i.includes(s))throw new Error(`Changing ${s} is not allowed!`);t(s=>S(S({},s),a))};if(!e)return Promise.resolve();if(typeof e!="function")throw new Error("Invalid on_initiating handler");const o=yield e();if(typeof o=="boolean")return o;if(typeof o=="object")return r(o),!0;throw new Error(`Invalid on_initiating handler result: ${o}`)}),or=(e,t,n)=>Q(this,null,function*(){var o;const r=`${e}${e.indexOf("?")>-1?"&":"?"}id=${t.id}&status=${t.status}&message=${(o=t.source)==null?void 0:o.message}`;n&&typeof n=="function"?yield n(r):window.location.href=r}),ar=n=>Q(this,[n],function*({payment:e,on_completed:t}){if(t!==null){if(typeof t!="function")throw new Error("Invalid on_completed handler");try{yield t(e)}catch(r){throw new Error("Unexpected error while handling on_completed callback")}}}),ke=({defaultError:e})=>{const{callback_url:t,on_initiating:n,on_redirect:r,on_completed:o,setFormSettings:a}=L(z),[i,s]=N(e),{processing:u,postData:l}=tr(),[d,c]=N(!1),[_,p]=N(!1),{fail:y}=nr();function g(A){return Q(this,arguments,function*({data:v,path:x,onSuccess:k,onFailed:w,initPayment:P}){const T=yield l({data:v,path:x});Qt(T)||(T&&(k&&k(T),o&&!P&&(yield ar({payment:T,on_completed:o}).catch(B=>{console.error(B)})),T.status==="paid"&&(p(!0),setTimeout(()=>{or(t,T,r).catch(()=>{})},100)),T.status==="failed"&&w&&w(T)),c(!1))})}function m(v){return Q(this,null,function*(){if(c(!0),v.initPayment){try{const x=yield rr({on_initiating:n,setFormSettings:a});if(typeof x=="boolean"&&!x){c(!1);return}yield g(v)}catch(x){console.error(x),c(!1)}return}yield g(v)})}const h=pe(()=>u||d,[u,d]);return{makePayment:m,busy:d,fail:y,success:_,processing:u,loading:h,error:i,setError:s}},$t=({inForm:e=!1})=>{const{apiError:t,showForm:n}=L(z);return n&&!e?null:f("p",{class:"flex flex-col gap-2 rounded-md border border-error bg-red-100 px-4 py-2 text-xs font-medium text-error empty:hidden",children:t})},ir=()=>{const{t:e}=Y(),{formattedAmount:t,isRtl:n,fixed_width:r,setFormSettings:o,showForm:a}=L(z),[i,s]=N(null),[u,l]=N(!1),d={phone:"",otp:""},{makePayment:c,busy:_,fail:p,success:y,loading:g,error:m,setError:h}=ke({defaultError:d}),[v,x]=N(""),[k,w]=N(""),[P,A]=N(""),T=G=>{const M=/^05[503649187][0-9]{7}$/.test(j(G));return h(J=>R(S({},J),{phone:M?"":"error.invalid_mobile"})),M},B=G=>{const M=/^[0-9]{4,}$/.test(j(G));return h(J=>R(S({},J),{otp:M?"":"error.invalid_otp"})),M},C=G=>{const{value:M,name:J}=G.target,le=M.trim();if(l(!1),!le){l(!le);return}J==="mysr-stc-mobile"&&T(le),J==="mysr-stc-otp"&&B(le)},O=()=>{if(!T(v))return;function G(M){const{transaction_url:J}=M.source;A(J),s(new Date().getTime()+5*60*1e3)}c({data:{source:{type:"stcpay",mobile:j(v)}},onSuccess:G,initPayment:!0}).catch(M=>{console.error(M)})},q=()=>{if(!i||!B(k))return;function G(M){var J;M.status==="failed"&&((J=M.source)==null?void 0:J.message)==="Invalid OTP"&&(h(le=>R(S({},le),{otp:"error.invalid_otp"})),w(""),s(null))}c({data:{otp_value:j(k)},path:P,onFailed:G}).catch(M=>{console.error(M)})},ne=G=>{if(G.preventDefault(),h(d),!i){O();return}q()},K=G=>{G>0||(h(M=>R(S({},M),{otp:"error.otp_time_out"})),w(""),s(null))},re=pe(()=>m.phone||i&&m.otp&&m.otp!=="error.otp_time_out"?!0:u||g,[m,u,g]),se=G=>o(M=>R(S({},M),{showForm:G})),[ye,Pe]=N(!1),je=()=>{Pe(!0)},dt=()=>{ye&&(x(""),w(""),h(d),se(!1),Pe(!1),l(!1))};return f(tt.Provider,{value:{err:m,setErr:h,handleBlur:C},children:f(ae,{children:[f(et,{variant:"stc",onClick:()=>se(!0),children:f("img",{class:"pointer-events-none h-4 max-h-full",height:16,width:55,alt:"STC Pay",src:Dn})}),a&&f(ae,{children:[f("div",{class:ie(["fixed inset-0 z-[9] bg-gray-500/75 transition-opacity",ye?"animate-fade-out duration-300":"animate-fade-in duration-200"])}),f("div",{class:"fixed inset-0 z-10 flex flex-col justify-end md:justify-center",children:f("div",{class:ie(["flex w-full origin-bottom flex-col gap-4 rounded-t-lg border-neutral-300 bg-slate-100 p-4 shadow transition-all md:rounded-b-lg lg:p-10",r&&"md:mx-auto md:max-w-96 lg:max-w-screen-sm",ye?"animate-dialog-out-mobile duration-200 md:animate-dialog-out":"animate-dialog-in-mobile duration-300 md:animate-dialog-in"]),onAnimationEnd:dt,children:[f($t,{inForm:!0}),f("div",{class:"flex items-center",children:[f("img",{alt:"",src:er,class:"h-5"}),f("button",{onClick:je,class:"ms-auto",children:"Cancel"})]}),f("form",{class:"flex flex-col gap-4",onSubmit:ne,children:[f("div",{class:"space-y-2",children:[f("div",{class:"flex items-end justify-between text-xs font-medium",children:[i?f("label",{for:"mysr-stc-mobile",children:e("form.otp")}):f("label",{for:"mysr-stc-otp",children:e("form.mobile")}),u&&f("span",{class:"uppercase text-error",children:e("form.required")})]}),f(Xn,{value:v,setValue:x,showOtp:!i&&typeof i!="number"}),f(Qn,{value:k,setValue:w,showPhone:!i&&typeof i!="number"})]}),f(et,{success:y,fail:p,busy:_,variant:"stc",class:"flex gap-1",disabled:re,type:"submit",children:[!n&&e("button.pay")," ",i?f($n,{countTo:i,callback:K}):t]})]}),f("p",{class:"flex flex-col gap-2 text-xs font-medium text-error empty:hidden",children:Object.entries(m).map(([G,M])=>f("span",{class:"empty:hidden",children:e(M)},G))})]})})]})]})})},sr=()=>{const{t:e}=Y(),{base_url:t,payment_button_type:n,publishable_api_key:r,apple_pay:o,payment_options:a,currency:i,supported_networks:s,decimalAmount:u,statement_descriptor:l,setFormSettings:d}=L(z),{makePayment:c}=ke({defaultError:{}});function _(){if(!ApplePaySession)return;const p=(o==null?void 0:o.label)||(a==null?void 0:a.label),g={countryCode:(o==null?void 0:o.country)||(a==null?void 0:a.country),currencyCode:i,supportedNetworks:s,merchantCapabilities:o.merchant_capabilities,total:{label:p,amount:u}},m=new ApplePaySession(o.version,g);m.onvalidatemerchant=h=>{const v={validation_url:h.validationURL,display_name:p,domain_name:window.location.hostname,publishable_api_key:r},x=o.validate_merchant_url||`${t}/v1/applepay/initiate`;fetch(x,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)}).then(k=>k.ok?k:Promise.reject(k)).then(k=>k.json()).then(k=>{m.completeMerchantValidation(k)}).catch(k=>{console.error("Apple Pay error:",k),d(w=>R(S({},w),{apiError:e("error.applePay")})),m.abort()})},m.onpaymentauthorized=h=>{const v={source:{type:"applepay",token:JSON.stringify(h.payment.token)}};l&&(v.statement_descriptor=l);function x(w){var A;console.error(w),m.completePayment({status:ApplePaySession.STATUS_FAILURE,errors:[]});let P="Payment failed.";w instanceof Response?P+=" Error: "+w.statusText:typeof w=="string"?P+=" Error: "+w:w.status==="failed"&&(P+=" Error: "+((A=w.source)==null?void 0:A.message)),d(T=>R(S({},T),{apiError:P}))}function k(w){console.error(w),m.completePayment({status:ApplePaySession.STATUS_SUCCESS})}c({data:v,onFailed:x,onSuccess:k}).catch(w=>{console.error(w)})},m.oncancel=()=>{try{m.abort()}catch(h){console.error(h)}},m.begin()}return f("button",{class:"apple-pay-button",style:{"-apple-pay-button-type":n},onClick:_})},lr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeEAAABLCAMAAABwZM8AAAADAFBMVEUAAAD////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////9/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f3+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/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Uw577RqZbDho1wmBUb37R0JEjXAzX6YT5yDs3veKRwYmdq2f2ABTKZnh70cj5fmmGeSjTX3RueQhn9dH5wBWUT17jyGKLPAVWUihQCkoA4xc/2dpORbT/b9Pi8YCQpTtuITq/AbjTdqJ0A2gA425/rOXAG+2nc22Hd22694v9AJX1ZAX0mLyg6ckX/tm6b0fL7x68ZaLqxqt9lQLQ8xPTGhYsvP3mWZ/6GHAmDxfAXjKYDIXOIRTEDVvJwaEl/VCLKxNXsTI0vk0eO0elYPtce87Fl8+aM+vyi4fUmulbQu0jwJC6vFu8hWaI7AvAGfz6s/q+tco+WifD5hKZkLanPWo7uZ5bZNaUyQSQhow/7Uzvd//cXCNo6FfG8UoBGHf3hj1v5nLtR7Y1zaoLqRlQfMTsay9LrRRhwsGsUCwJqVViVO85pDOXlFai82v6VfSTFOhmCKmK01UJ0YWnlH1Zv+4/YuSQXnbpiZKPUKGW3gg9RDnjkEpppXiSv7fgGx7L+67vz/9CotKWr7y1xuZCsEFMMrzeSixvg0YVHxiUd3Mp3y8Y0NF+qP6PncqDxo+tn7WyuoQrEKzBKspWqqg0RLdf+bSlSnAlIqoz8mle1UhXICTG20D7q3VVP6sC4ZRKLKsu4QqEQN+j5qgUjK1uwxUIbe8G9mlzleBKhLBqcZ++XDXSFQiFSyiwl7VU/awKRHRNjkdLqku4AiEx6E0qhNqyjpHVbbgCodFoE8NPQKGKSoOA2kGncm+hnb5QZbgiUWNkZyOHVb2sKqr4QEIadOJl/R9/eIVAmWuIbgAAAABJRU5ErkJggg==",cr=()=>{const{isTestMode:e,payment_button_type:t,samsung_pay:n,payment_options:r,supported_networks:o,currency:a,decimalAmount:i,setFormSettings:s}=L(z),[u,l]=N(!1),[d,c]=N(!1),{makePayment:_}=ke({defaultError:{}}),{t:p}=Y(),y=ee(null);Z(()=>{let h=null;return u||(h=setInterval(()=>{window.SamsungPay&&l(!0)},100)),()=>{clearInterval(h)}},[u]);const g=pe(()=>{if(!(!u||!n))return new SamsungPay.PaymentClient({environment:n.environment})},[u]);if(Z(()=>Q(this,null,function*(){if(!g||!n)return;const h=n.version,v=n.service_id,x=o==null?void 0:o.filter(w=>w!=="mada").map(w=>w.toLowerCase()),k={version:h,serviceId:v,protocol:"PROTOCOL_3DS",allowedBrands:x};y.current=()=>Q(this,null,function*(){const{order_number:w,id:P,country:A,label:T}=n,B=T||(r==null?void 0:r.label),C=A||(r==null?void 0:r.country),O={orderNumber:w,merchant:{name:B,id:P,countryCode:C,url:window.location.hostname},amount:{option:"FORMAT_TOTAL_ESTIMATED_AMOUNT",currency:a,total:i}},q=()=>{g.notify({status:"CHARGED",provider:"Moyasar"})},ne=K=>{var se;g.notify({status:"REJECTED",provider:"Moyasar"});let re="Payment failed.";K instanceof Payment&&K.isFailed()?re+=" Error: "+((se=K.source)==null?void 0:se.message):K instanceof Response?re+=" Error: "+K.statusText:typeof K=="string"&&(re+=" Error: "+K)};try{const K=yield g.loadPaymentSheet(k,O);_({initPayment:!0,data:{source:{type:"samsungpay",token:K["3DS"].data}},onFailed:ne,onSuccess:q})}catch(K){try{g.notify({status:"ERRED",provider:"Moyasar"})}catch(re){}console.log("Samsung Pay error: ",K)}});try{(yield g.isReadyToPay(k)).result?c(!0):s(P=>R(S({},P),{apiError:"Cannot initialize Samsung Pay"}))}catch(w){try{g.notify({status:"ERRED",provider:"Moyasar"})}catch(P){}s(P=>R(S({},P),{apiError:"Cannot initialize Samsung Pay"})),console.error("Samsung Pay Error: ",w)}}),[g,n]),!u||!d)return null;const m=t==="pay"?"pay-with":t;return f("button",{class:"flex h-11 w-full items-center justify-center gap-1 rounded-md bg-black text-white",onClick:y.current,children:[f("span",{children:p(`button.${m}`)}),f("img",{src:lr,alt:"",class:"-mb-[3px] h-[22px]"}),f("div",{class:"mb-0.5 h-[9px] w-[9px] rotate-45 rounded-sm border-r-[3px] border-t-[3px] border-white"})]})},ur=()=>{const{language:e,payment_button_type:t,google_pay:n,payment_options:r,supported_networks:o,currency:a,decimalAmount:i,setFormSettings:s}=L(z),[u,l]=N(!1),{makePayment:d}=ke({defaultError:{}});Z(()=>{let _=null;return u||(_=setInterval(()=>{var p,y;(y=(p=window.google)==null?void 0:p.payments)!=null&&y.api&&l(!0)},100)),()=>{clearInterval(_)}},[u]);const c=pe(()=>{if(u)return new google.payments.api.PaymentsClient({environment:n.environment})},[u]);return Z(()=>Q(this,null,function*(){const _=document.getElementById("googlePay-container");if(!c||!n||(_==null?void 0:_.children.length)>=1)return;n.merchant_id;const p=o==null?void 0:o.filter(P=>P!=="mada").map(P=>P.toUpperCase()),y=n.auth_methods,g={apiVersion:2,apiVersionMinor:0},m={type:"CARD",parameters:{allowedAuthMethods:y,allowedCardNetworks:p}},h=Object.assign({},g);h.allowedPaymentMethods=[m];const v=()=>Q(this,null,function*(){const{country:P,label:A,merchant_id:T}=n,B=A||(r==null?void 0:r.label),C=P||(r==null?void 0:r.country),O=R(S({},g),{allowedPaymentMethods:[w],merchantInfo:{merchantId:T,merchantName:B},transactionInfo:{countryCode:C,currencyCode:a,totalPriceStatus:"FINAL",totalPrice:i}});try{const q=yield c.loadPaymentData(O);d({initPayment:!0,data:{source:{type:"googlepay",token:q.paymentMethodData.tokenizationData.token}}})}catch(q){console.error(q)}}),x=()=>{const P=c.createButton({onClick:v,buttonLocale:e,buttonColor:"black",buttonType:t,buttonRadius:6,buttonSizeMode:"fill"});_.appendChild(P)},k={type:"PAYMENT_GATEWAY",parameters:{gateway:"moyasar",gatewayMerchantId:n.gateway_merchant_id}},w=Object.assign({},m,{tokenizationSpecification:k});try{(yield c.isReadyToPay(h)).result?x():s(A=>R(S({},A),{apiError:"Cannot initialize Google Pay"}))}catch(P){s(A=>R(S({},A),{apiError:"Cannot initialize Google Pay"})),console.error("Google Pay Error: ",P)}}),[c,n]),u?f("div",{id:"googlePay-container",class:"flex h-11 items-center justify-center rounded-md bg-black empty:hidden"}):null},dr=()=>{const{t:e}=Y(),{methods:t,apple_pay:n,samsung_pay:r,google_pay:o}=L(z),a=t.includes("stcpay"),i=t.includes("creditcard"),s=location.protocol==="https:"&&t.includes("applepay")&&typeof window.ApplePaySession!="undefined"&&ApplePaySession.canMakePayments()&&(n==null?void 0:n.version)&&ApplePaySession.supportsVersion(n==null?void 0:n.version),u=!!(r!=null&&r.service_id),l=!!(o!=null&&o.merchant_id);return!s&&!a&&!u&&!l?null:f("div",{class:"flex w-full flex-col gap-4",role:"main",children:[a&&f(ir,{}),s&&f(sr,{}),u&&f(cr,{}),l&&f(ur,{}),i&&f("p",{class:"flex items-center gap-4",children:[f("hr",{class:"grow bg-neutral-300"}),f("span",{class:"text-neutral-800/90",children:e("form.or_pay_with_card")}),f("hr",{class:"grow bg-neutral-300"})]})]})},rt=["mada","visa","amex","masterCard"],ot=["creditcard","applepay","stcpay","samsungpay"],at=["supports3DS","supportsCredit","supportsDebit","supportsEMV"],pr=["pay","buy","plain","book","check-out","subscribe","add-money","contribute","order","reload","rent","support","tip","top-up","continue"],en={ADP:0,AFN:0,ALL:0,AMD:0,BHD:3,BIF:0,BYN:2,BYR:0,CAD:2,CHF:2,CLF:4,CLP:0,COP:0,CRC:0,CZK:0,default:2,DJF:0,DKK:2,ESP:0,GNF:0,GYD:0,HUF:0,IDR:0,IQD:0,IRR:0,ISK:0,ITL:0,JOD:3,JPY:0,KMF:0,KPW:0,KRW:0,KWD:3,LAK:0,LBP:2,LUF:0,LYD:3,MGA:0,MGF:0,MMK:0,MNT:0,MRO:0,MUR:0,NOK:0,OMR:3,PKR:0,PYG:0,RSD:0,RWF:0,SEK:0,SLL:0,SOS:0,STD:0,SYP:0,TMM:0,TND:3,TRL:0,TWD:0,TZS:0,UGX:0,UYI:0,UYW:4,UZS:0,VEF:0,VND:0,VUV:0,XAF:0,XOF:0,XPF:0,YER:0,ZMK:0,ZWD:0},fr=["22337902","22337986","22402030","40177800","403024","40545400","406136","406996","40719700","40728100","40739500","407520","409201","410621","410685","410834","412565","417633","419593","420132","421141","42222200","422817","422818","422819","428331","428671","428672","428673","431361","432328","434107","439954","440533","440647","440795","442429","442463","445564","446393","446404","446672","45488707","45501701","455036","455708","457865","457997","458456","462220","468540","468541","468542","468543","474491","483010","483011","483012","484783","486094","486095","486096","489318","489319","49098000","49098001","492464","504300","513213","515079","516138","520058","521076","52166100","524130","524514","524940","529415","529741","530060","531196","535825","535989","536023","537767","53973776","543085","543357","549760","554180","555610","558563","588845","588848","588850","604906","636120","968201","968202","968203","968204","968205","968206","968207","968208","968209","968211","968212"],tn=e=>{const t=!e,n=/^[a-zA-Z\-\s]+$/.test(e),r=/^[a-zA-Z-]+\s+?([a-zA-Z-]+\s?)+$/.test(e);return{isEmpty:t,isEnglishOnly:n,isValidFormat:r,isValid:!t&&n&&r}},mr=({value:e,setValue:t,err:n,setErr:r})=>{const{t:o}=Y(),[a,i]=N(!1),s=d=>{const c=d.target.value.trim(),{isEmpty:_,isEnglishOnly:p,isValidFormat:y}=tn(c);if(_){i(!c);return}if(!p){r(g=>R(S({},g),{name:"validation.should_be_english_letters_only"}));return}if(!y){r(g=>R(S({},g),{name:"validation.first_and_last_name_required"}));return}i(!1),r(g=>R(S({},g),{name:""}))},u=d=>{const c=d.target,{value:_}=c;t(_)},l=_e(s,1e3);return f("div",{class:"space-y-2",role:"complementary","aria-label":o("form.name_on_card"),children:[f("div",{class:"flex items-end justify-between text-xs font-medium",children:[f("label",{for:"mysr-cc-name",children:o("form.name_on_card")}),a&&f("span",{class:"uppercase text-error",children:o("form.required")})]}),f(he,{name:"mysr-cc-name",placeholder:o("form.name_on_card"),onBlur:s,class:n.name?"shadow-input-error":"",autocomplete:"cc-name",dir:"ltr",value:e,onKeyUp:d=>{u(d),l(d)},onChange:u}),n.name&&f("p",{class:"text-xs font-medium text-error",children:o(n.name)})]})},nn=(e,t)=>{const n=t==="amex"?/^\d{4}$/.test(e):/^\d{3}$/.test(e);return{isValid:n,msg:n?"":"error.invalid_csc"}},Ue=Xe({}),hr=({setValue:e})=>{const{t}=Y(),{handleBlur:n,err:r}=L(Ue),o="** / **",a=s=>{const u=s.target,{value:l}=u;e(l)},i=_e(n,1e3);return Z(()=>{new Fe('[name="mysr-cc-exp"]')},[]),f(he,{"aria-label":t("form.date"),name:"mysr-cc-exp",onBlur:n,class:"rounded-none rounded-bl-lg",placeholder:"MM / YY",autocomplete:"cc-exp",inputMode:"numeric",maxLength:o.length,"data-maska":o,"data-maska-eager":!0,onKeyUp:s=>{a(s),i(s)},error:r.exp})},_r=({value:e,setValue:t})=>{const{t:n}=Y(),{handleBlur:r,err:o,config:a}=L(Ue),i=u=>{const l=u.target,{value:d}=l;t(d)},s=_e(r,1e3);return f(he,{"aria-label":n("form.csc"),name:"mysr-cc-csc",onBlur:r,class:"rounded-none rounded-br-lg",placeholder:"CVC",autocomplete:"cc-csc",inputMode:"numeric",maxLength:a.csc,value:e,onKeyUp:u=>{i(u),s(u)},error:o.csc})},yr=e=>/^4/.test(j(e)),vr=e=>/^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)/.test(j(e)),rn=e=>/^3[47]/.test(j(e)),on=e=>{const t=j(e),n=t.slice(0,6),r=t.slice(0,8);for(const o of fr)if(o==n||o==r)return!0;return!1},it=()=>{const{supported_networks:e}=L(z);function t(n){let r="";return yr(n)&&(r="visa"),vr(n)&&(r="masterCard"),rn(n)&&(r="amex"),on(n)&&(r="mada"),r===""||!e.includes(r)?"":r}return{getCardSchema:t}},gr=({value:e,setValue:t})=>{const{t:n}=Y(),{handleBlur:r,err:o,setType:a}=L(Ue),{getCardSchema:i}=it(),s=l=>{const d=l.target,{value:c}=d;t(c),a(i(c))},u=_e(r,1e3);return Z(()=>{new Fe('[name="mysr-cc-number"]',{mask:l=>rn(l)?"#### ###### #####":"#### #### #### ####"})},[]),f(he,{"aria-label":n("form.cc"),name:"mysr-cc-number",placeholder:"1234 5678 9101 1121",onBlur:r,class:"col-span-full rounded-b-none",autocomplete:"cc-number",inputMode:"numeric",value:e,onKeyUp:l=>{s(l),u(l)},onChange:s,error:o.cc})},br="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%2096%2064'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;'%3e%3cpath%20d='M95,6.894c0,-3.253%20-2.641,-5.894%20-5.894,-5.894l-82.212,0c-3.253,0%20-5.894,2.641%20-5.894,5.894l0,50.212c0,3.253%202.641,5.894%205.894,5.894l82.212,0c3.253,0%205.894,-2.641%205.894,-5.894l0,-50.212Z'%20style='fill:%23fff;stroke:%237e7e7e;stroke-width:0.5px;'/%3e%3cclipPath%20id='_clip1'%3e%3crect%20x='7.179'%20y='18.832'%20width='81.642'%20height='26.336'/%3e%3c/clipPath%3e%3cg%20clip-path='url(%23_clip1)'%3e%3cg%3e%3cpath%20d='M47.418,19.387l-5.431,25.384l-6.567,0l5.432,-25.384l6.566,0Zm27.627,16.39l3.457,-9.532l1.989,9.532l-5.446,0Zm7.326,8.994l6.074,0l-5.3,-25.384l-5.607,0c-1.259,0%20-2.323,0.733%20-2.795,1.863l-9.852,23.521l6.895,0l1.37,-3.79l8.424,-0l0.791,3.79Zm-17.137,-8.287c0.028,-6.701%20-9.267,-7.069%20-9.201,-10.062c0.019,-0.912%200.887,-1.879%202.784,-2.127c0.943,-0.123%203.534,-0.218%206.476,1.136l1.152,-5.383c-1.58,-0.574%20-3.614,-1.125%20-6.143,-1.125c-6.49,-0%20-11.059,3.451%20-11.097,8.391c-0.041,3.655%203.261,5.693%205.75,6.908c2.557,1.245%203.417,2.041%203.406,3.154c-0.017,1.704%20-2.041,2.455%20-3.929,2.485c-3.302,0.052%20-5.218,-0.892%20-6.745,-1.603l-1.19,5.562c1.534,0.705%204.365,1.317%207.303,1.348c6.898,0%2011.411,-3.408%2011.434,-8.684Zm-27.2,-17.097l-10.639,25.384l-6.942,0l-5.235,-20.258c-0.318,-1.248%20-0.595,-1.705%20-1.562,-2.23c-1.576,-0.857%20-4.183,-1.66%20-6.477,-2.158l0.157,-0.738l11.173,0c1.423,0%202.705,0.948%203.028,2.588l2.765,14.69l6.833,-17.278l6.899,0Z'%20style='fill:%230d357f;fill-rule:nonzero;'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",wr="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%2096%2064'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;'%3e%3cpath%20d='M95,7.094c0,-3.363%20-2.731,-6.094%20-6.094,-6.094l-81.812,0c-3.363,0%20-6.094,2.731%20-6.094,6.094l-0,49.812c-0,3.363%202.731,6.094%206.094,6.094l81.812,0c3.363,0%206.094,-2.731%206.094,-6.094l0,-49.812Z'%20style='fill:%23fff;stroke:%23b1b1b1;stroke-width:0.5px;'/%3e%3cpath%20d='M95,6.894c0,-3.253%20-2.641,-5.894%20-5.894,-5.894l-82.212,0c-3.253,0%20-5.894,2.641%20-5.894,5.894l0,50.212c0,3.253%202.641,5.894%205.894,5.894l82.212,0c3.253,0%205.894,-2.641%205.894,-5.894l0,-50.212Z'%20style='fill:%23fff;stroke:%237e7e7e;stroke-width:0.5px;'/%3e%3cg%20opacity='0'%3e%3crect%20x='14.04'%20y='9.539'%20width='67.919'%20height='44.921'%20style='fill:%23fff;'/%3e%3c/g%3e%3crect%20x='39.044'%20y='17.366'%20width='17.917'%20height='29.263'%20style='fill:%23ff5f00;'/%3e%3cpath%20d='M40.89,32c-0.005,-5.706%202.619,-11.106%207.107,-14.629c-3.278,-2.576%20-7.329,-3.978%20-11.498,-3.978c-10.209,0%20-18.61,8.401%20-18.61,18.61c0,10.208%208.401,18.609%2018.61,18.609c4.169,-0%208.22,-1.401%2011.498,-3.978c-4.489,-3.524%20-7.113,-8.927%20-7.107,-14.634Z'%20style='fill:%23eb001b;fill-rule:nonzero;'/%3e%3cpath%20d='M76.33,43.533l0,-0.6l0.259,0l-0,-0.124l-0.615,-0l-0,0.124l0.242,0l0,0.6l0.114,-0Zm1.194,-0l0,-0.724l-0.186,-0l-0.217,0.517l-0.217,-0.517l-0.186,-0l-0,0.724l0.134,-0l0,-0.548l0.202,0.47l0.139,0l0.202,-0.47l0,0.548l0.129,-0Z'%20style='fill:%23f79e1b;fill-rule:nonzero;'/%3e%3cpath%20d='M78.108,32c0,10.209%20-8.4,18.609%20-18.609,18.609c-4.171,-0%20-8.223,-1.402%20-11.502,-3.98c4.487,-3.526%207.111,-8.926%207.111,-14.632c-0,-5.705%20-2.624,-11.106%20-7.111,-14.631c3.279,-2.578%207.331,-3.98%2011.502,-3.98c10.209,-0%2018.609,8.4%2018.609,18.609l0,0.005Z'%20style='fill:%23f79e1b;fill-rule:nonzero;'/%3e%3c/svg%3e",kr="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%2096%2064'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;'%3e%3cpath%20d='M95,7.053c0,-3.341%20-2.712,-6.053%20-6.053,-6.053l-81.894,-0c-3.341,-0%20-6.053,2.712%20-6.053,6.053l0,49.894c0,3.341%202.712,6.053%206.053,6.053l81.894,0c3.341,0%206.053,-2.712%206.053,-6.053l0,-49.894Z'%20style='fill:%23006fcf;stroke:%237e7e7e;stroke-width:0.5px;'/%3e%3cg%3e%3cpath%20d='M54.459,9.71l-10.404,23.609l8.342,0l0,21.172l26.31,0l4.061,-4.51l4.063,4.534l7.933,0l0,-2.672l-6.538,0l-5.395,-5.867l-5.44,5.88l-22.088,0l0,-18.444l22.202,0l5.408,5.938l5.476,-5.963l6.352,-0l0,-2.626l-4.935,-0l-0,-12.769l-4.686,12.699l-4.45,0l-4.823,-12.608l0,12.647l-10.546,0l-1.49,-3.637l-8.559,0l-1.457,3.589l-5.544,0l8.116,-18.39l6.498,-0l8.058,18.438l-0,-18.443l7.875,-0l4.161,11.351l4.127,-11.364l7.714,0.003l0,-2.656l-9.767,-0l-2.048,5.839l-2.2,-5.8l-12.552,-0l-0.077,7.83l-3.474,-7.76l-10.223,-0.02Z'%20style='fill:%23fff;'/%3e%3cpath%20d='M59.526,16.941l-2.53,5.961l5.011,0l-2.481,-5.961Z'%20style='fill:%23fff;'/%3e%3cpath%20d='M60.312,37.605l10.641,-0l0,-4.147l8.738,9.184l-8.621,9.204l-0.101,0l0,-4.221l-10.669,-0l-0,-2.905l10.397,0l-0,-4.077l-10.397,0l0.012,-3.038Z'%20style='fill:%23fff;'/%3e%3cpath%20d='M94.723,47.865l0,3.969l-8.581,-9.23l8.59,-9.225l-0,3.95l-4.946,5.265l4.937,5.271Z'%20style='fill:%23fff;'/%3e%3c/g%3e%3c/svg%3e",xr="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%2096%2064'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;'%3e%3cpath%20d='M95,6.894c0,-3.253%20-2.641,-5.894%20-5.894,-5.894l-82.212,0c-3.253,0%20-5.894,2.641%20-5.894,5.894l0,50.212c0,3.253%202.641,5.894%205.894,5.894l82.212,0c3.253,0%205.894,-2.641%205.894,-5.894l0,-50.212Z'%20style='fill:%23fff;stroke:%237e7e7e;stroke-width:0.5px;'/%3e%3cg%3e%3crect%20x='5.311'%20y='34.182'%20width='36.116'%20height='12.031'%20style='fill:%2384b740;'/%3e%3crect%20x='5.311'%20y='17.765'%20width='36.116'%20height='12.042'%20style='fill:%23259bd6;'/%3e%3cpath%20d='M77.542,43.769l-0.161,0.032c-0.557,0.107%20-0.761,0.15%20-1.168,0.15c-0.944,-0%20-2.059,-0.483%20-2.059,-2.756c-0,-1.169%200.193,-2.724%201.951,-2.724l0.011,0c0.3,0.022%200.644,0.054%201.287,0.247l0.139,0.043l0,5.008Zm0.29,-11.335l-0.29,0.054l0,4.203l-0.257,-0.075l-0.075,-0.021c-0.29,-0.086%20-0.954,-0.279%20-1.598,-0.279c-3.517,0%20-4.257,2.659%20-4.257,4.89c0,3.056%201.716,4.815%204.708,4.815c1.265,-0%202.198,-0.129%203.141,-0.44c0.869,-0.279%201.18,-0.676%201.18,-1.523l-0,-12.063c-0.836,0.15%20-1.705,0.3%20-2.552,0.439'%20style='fill:%2327292d;fill-rule:nonzero;'/%3e%3cpath%20d='M87.997,43.844l-0.15,0.043l-0.536,0.139c-0.504,0.129%20-0.954,0.204%20-1.297,0.204c-0.826,-0%20-1.319,-0.408%20-1.319,-1.105c-0,-0.45%200.203,-1.211%201.555,-1.211l1.747,-0l0,1.93Zm-1.233,-7.582c-1.083,0%20-2.198,0.193%20-3.581,0.622l-0.901,0.268l0.3,2.038l0.88,-0.29c0.922,-0.3%202.069,-0.493%202.927,-0.493c0.386,0%201.566,0%201.566,1.276l-0,0.558l-1.641,-0c-2.992,-0%20-4.375,0.954%20-4.375,3.002c-0,1.748%201.276,2.799%203.421,2.799c0.664,-0%201.587,-0.129%202.38,-0.322l0.043,-0.01l0.043,0.01l0.268,0.043c0.836,0.15%201.705,0.3%202.552,0.461l0,-6.691c0,-2.166%20-1.308,-3.271%20-3.882,-3.271'%20style='fill:%2327292d;fill-rule:nonzero;'/%3e%3cpath%20d='M67.162,43.844l-0.15,0.043l-0.536,0.139c-0.504,0.129%20-0.944,0.204%20-1.297,0.204c-0.826,-0%20-1.319,-0.408%20-1.319,-1.105c-0,-0.45%200.203,-1.211%201.544,-1.211l1.748,-0l0.01,1.93Zm-1.222,-7.582c-1.094,0%20-2.198,0.193%20-3.582,0.622l-0.9,0.268l0.3,2.038l0.879,-0.29c0.922,-0.3%202.07,-0.493%202.928,-0.493c0.386,0%201.565,0%201.565,1.276l0,0.558l-1.641,-0c-2.991,-0%20-4.385,0.954%20-4.385,3.002c-0,1.748%201.276,2.799%203.431,2.799c0.665,-0%201.587,-0.129%202.381,-0.322l0.043,-0.01l0.042,0.01l0.258,0.043c0.847,0.15%201.705,0.3%202.552,0.472l-0,-6.691c0.011,-2.188%20-1.298,-3.282%20-3.871,-3.282'%20style='fill:%2327292d;fill-rule:nonzero;'/%3e%3cpath%20d='M55.871,36.284c-1.362,-0%20-2.488,0.45%20-2.906,0.643l-0.107,0.054l-0.097,-0.075c-0.579,-0.418%20-1.426,-0.633%20-2.606,-0.633c-1.04,0%20-2.016,0.15%20-3.077,0.461c-0.912,0.279%20-1.266,0.719%20-1.266,1.544l0,7.646l2.853,0l-0,-7.067l0.139,-0.042c0.579,-0.193%200.922,-0.226%201.255,-0.226c0.826,0%201.244,0.44%201.244,1.298l-0,6.048l2.809,-0l0,-6.166c0,-0.365%20-0.075,-0.579%20-0.086,-0.622l-0.096,-0.182l0.193,-0.086c0.429,-0.193%200.901,-0.29%201.394,-0.29c0.568,0%201.244,0.226%201.244,1.298l-0,6.048l2.799,-0l-0,-6.327c-0,-2.241%20-1.201,-3.324%20-3.689,-3.324'%20style='fill:%2327292d;fill-rule:nonzero;'/%3e%3cpath%20d='M85.896,25.614c-0.419,0%20-1.116,-0.043%20-1.662,-0.15l-0.161,-0.032l-0,-4.128c-0,-0.344%20-0.065,-0.558%20-0.075,-0.59l-0.086,-0.172l0.182,-0.075c0.043,-0.021%200.086,-0.032%200.14,-0.053l0.032,-0.022c0.064,-0.021%200.128,-0.043%200.193,-0.064c0.032,-0.011%200.053,-0.022%200.075,-0.022c0.633,-0.171%201.212,-0.15%201.469,-0.171l0.011,-0c1.748,-0%201.951,1.555%201.951,2.723c-0.01,2.274%20-1.136,2.756%20-2.069,2.756m-0.011,-7.849l-0.075,-0c-1.641,-0%20-3.324,0.45%20-3.925,1.33c-0.321,0.429%20-0.504,0.965%20-0.514,1.597l-0,4.258c-0,0.364%20-0.076,0.504%20-0.086,0.536l-0.097,0.182l-5.179,-0l-0,-2.96l-0.011,0c-0.064,-3.12%20-1.909,-4.836%20-4.579,-4.836l-2.605,0c-0.108,0.762%20-0.193,1.298%20-0.301,2.059l2.595,0c1.362,0%202.081,1.158%202.081,2.938l-0,2.981l-0.183,-0.096c-0.032,-0.011%20-0.257,-0.086%20-0.611,-0.086l-4.482,-0c-0.086,0.568%20-0.193,1.308%20-0.311,2.048l13.779,0c0.472,-0.096%201.019,-0.182%201.491,-0.257c0.697,0.343%201.994,0.525%202.884,0.525c2.992,0%204.933,-2.005%204.933,-5.093c-0.011,-3.056%20-1.887,-5.062%20-4.804,-5.126'%20style='fill:%2327292d;fill-rule:nonzero;'/%3e%3cpath%20d='M57.78,28.971l4.074,-0c2.992,-0%204.386,-0.987%204.386,-3.421c0,-1.748%20-1.276,-3.142%20-3.421,-3.142l-2.755,0c-0.826,0%20-1.319,-0.472%20-1.319,-1.265c-0,-0.536%200.203,-1.201%201.554,-1.201l6.027,-0c0.129,-0.783%200.193,-1.276%200.311,-2.059l-6.262,-0c-2.917,-0%20-4.386,1.222%20-4.386,3.26c-0,2.016%201.276,3.067%203.42,3.067l2.756,-0c0.826,-0%201.319,0.654%201.319,1.34c0,0.45%20-0.203,1.383%20-1.544,1.383l-0.461,0l-8.825,-0.021l-1.609,-0c-1.361,-0%20-2.316,-0.772%20-2.316,-2.563l0,-1.233c0,-1.866%200.74,-3.024%202.316,-3.024l2.617,-0c0.118,-0.794%200.193,-1.298%200.3,-2.048l-3.571,-0c-2.67,-0%20-4.514,1.791%20-4.579,4.911l0,1.394c0.065,3.12%201.909,4.611%204.579,4.611l2.606,-0l4.783,0.011Z'%20style='fill:%2327292d;fill-rule:nonzero;'/%3e%3c/g%3e%3c/svg%3e",Pr=({type:e})=>{const t="h-4 sm:h-5 w-auto object-contain object-center";return f("div",{class:"absolute right-2 top-1/4 z-[2] flex -translate-y-1/2 items-center gap-1",children:[{alt:"AMEX",src:kr},{alt:"MADA",src:xr},{alt:"Visa",src:br},{alt:"MasterCard",src:wr}].filter(r=>e!==""?e.toLowerCase()===r.alt.toLowerCase():!0).map(r=>f("img",{class:t,alt:r.alt,src:r.src,loading:"lazy"}))})},an=e=>{const t="#### #### #### ####",n={mask:t,validator:o=>/^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$/.test(j(o)),csc:3},r={amex:{mask:"#### ###### #####",validator:o=>/^3[47][0-9]{13}$/.test(j(o)),csc:4},mada:{mask:t,validator:o=>on(o)&&/\d{16}/.test(j(o)),csc:3},visa:{mask:t,validator:o=>/^4[0-9]{12}(?:[0-9]{3})?$/.test(j(o)),csc:3},mastercard:n,masterCard:n};return e===""?r.visa:r[e]},sn=e=>{const[t,n]=e.split("/"),r=parseInt(t.trim()),o=r>=1&&r<=12,a=parseInt(n==null?void 0:n.trim()),i=Number.isNaN(a)||a<+new Date().getFullYear().toString().slice(-2)||a>99,s=/^\d{2} ?\/ ?\d{2}$/.test(e);return{isValidExpFormat:s,isValidYear:!i,inValidMonth:o,isValid:s&&!i&&o}},Er=e=>{const t=[0,2,4,6,8,1,3,5,7,9];if(typeof e!="string")throw new TypeError("Expected string input");if(!e)return!1;let n=e.length,r=!0,o=0;for(;n;){const a=e.charCodeAt(--n)-48;if(a<0||a>9)return!1;r=!r,o+=r?t[a]:a}return o%10===0},ln=()=>{const{getCardSchema:e}=it();function t(n,r){const o=r||e(n);if(!o&&n.length>3)return!1;const{validator:a}=an(o),i=a(n),s=Er(n);return i&&s}return{isValidCc:t}},Sr=({cc:e,setCc:t,cvc:n,setCvc:r,exp:o,setExp:a,err:i,setErr:s})=>{const{t:u}=Y(),[l,d]=N(!1),[c,_]=N(""),{isValidCc:p}=ln(),y=Mt(()=>an(c),[c]),g=m=>{const{value:h,name:v}=m.target,x=j(h.trim());if(!x){d(!x);return}if(v==="mysr-cc-csc"){const{msg:k}=nn(x,c);s(w=>R(S({},w),{csc:k}))}if(v==="mysr-cc-exp"){const{isValidExpFormat:k,isValidYear:w,inValidMonth:P}=sn(x);s(A=>R(S({},A),{exp_month:P?"":"error.invalid_month",exp_year:w?"":"error.invalid_year",exp:k?"":"error.invalid_date"}))}v==="mysr-cc-number"&&s(k=>R(S({},k),{cc:c===""?"error.unsupported_cc_type":p(x)?"":"error.invalid_cc_number"}))};return Z(()=>{Object.values(i).filter(m=>m).length===0&&d(!1)},[i]),f(Ue.Provider,{value:{err:i,setErr:s,handleBlur:g,type:c,setType:_,config:y()},children:f("div",{class:"space-y-2",role:"complementary","aria-label":u("form.card_info"),children:[f("div",{class:"flex items-end justify-between text-xs font-medium",children:[f("legend",{children:u("form.card_info")}),l&&f("span",{class:"uppercase text-error",children:u("form.required")})]}),f("div",{class:"relative grid grid-cols-2 gap-y-[1px]",dir:"ltr",children:[f(gr,{value:e,setValue:t}),f(Pr,{type:c}),f(hr,{value:o,setValue:a}),f(_r,{value:n,setValue:r})]}),f("p",{class:"flex flex-col gap-2 text-xs font-medium text-error",children:Object.entries(i).filter(([m])=>m!=="name").map(([m,h])=>f("span",{class:"empty:hidden",children:u(h)},m))})]})})},Cr=()=>{const{t:e}=Y(),{formattedAmount:t,isRtl:n,credit_card:r,statement_descriptor:o,callback_url:a,payment_button_type:i}=L(z),[s,u]=N(""),[l,d]=N(""),[c,_]=N(""),[p,y]=N(""),{getCardSchema:g}=it(),{isValidCc:m}=ln(),h={name:"",csc:"",cc:"",exp:"",exp_month:"",exp_year:""},{makePayment:v,busy:x,fail:k,success:w,loading:P,error:A,setError:T}=ke({defaultError:h});return f("form",{class:"space-y-6",onSubmit:O=>{O.preventDefault();const{isValid:q}=tn(s),ne=j(l),K=j(p),re=j(c),se=g(ne),ye=m(ne,se),{isValid:Pe}=nn(re,se),{isValid:je}=sn(K);if(!q||!ye||!Pe||!je){const X=S({},h);q||(X.name=e("error.invalid_name")),ye||(X.cc=e("error.invalid_cc_number")),Pe||(X.csc=e("error.invalid_csc")),je||(X.exp=e("error.invalid_date")),T(X);return}const[dt,G]=K.split("/"),M={type:"creditcard",name:s,number:ne,month:dt,year:G,cvc:re};r!=null&&r.manual&&(M.manual=!0),r!=null&&r.save_card&&(M.save_card=!0),o&&(M.statement_descriptor=o);function J(X){const{transaction_url:io}=X.source;window.location.href=io}function le(X){console.error(X)}v({data:{callback_url:a,source:M},initPayment:!0,onFailed:le,onSuccess:J}).catch(X=>{console.error(X)})},children:[f(mr,{value:s,setValue:u,err:A,setErr:T}),f(Sr,{cc:l,setCc:d,cvc:c,setCvc:_,exp:p,setExp:y,err:A,setErr:T}),f(et,{type:"submit",disabled:P,success:w,fail:k,busy:x,children:[(i!=="plain"||!n)&&e(`button.${i}`)," ",t]}),(r==null?void 0:r.save_card)&&f("p",{class:"flex items-center justify-center gap-2 text-xs text-primary-400",role:"complementary","aria-label":e("form.save_card_notice"),children:[f("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",class:"h-4 w-4 shrink-0",fill:"currentColor",children:f("path",{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"})}),e("form.save_card_notice")]})]})};var st=function(e,t){return st=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])},st(e,t)};function Ar(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");st(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var te=function(){return te=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},te.apply(this,arguments)};function Le(e,t,n,r){function o(a){return a instanceof n?a:new n(function(i){i(a)})}return new(n||(n=Promise))(function(a,i){function s(d){try{l(r.next(d))}catch(c){i(c)}}function u(d){try{l(r.throw(d))}catch(c){i(c)}}function l(d){d.done?a(d.value):o(d.value).then(s,u)}l((r=r.apply(e,t||[])).next())})}function xe(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,o,a,i;return i={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(l){return function(d){return u([l,d])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(n=0)),n;)try{if(r=1,o&&(a=l[0]&2?o.return:l[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,l[1])).done)return a;switch(o=0,a&&(l=[l[0]&2,a.value]),l[0]){case 0:case 1:a=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!a||l[1]>a[0]&&l[1]<a[3])){n.label=l[1];break}if(l[0]===6&&n.label<a[1]){n.label=a[1],a=l;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(l);break}a[2]&&n.ops.pop(),n.trys.pop();continue}l=t.call(e,n)}catch(d){l=[6,d],o=0}finally{r=a=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Tr(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ve(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,a=[],i;try{for(;(t===void 0||t-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(s){i={error:s}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a}function Ge(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,a;r<o;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;function cn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length===0?function(n){return n}:e.length===1?e[0]:e.reduce(function(n,r){return function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];return n(r.apply(void 0,Ge([],Ve(o),!1)))}})}function Dr(e){if(e)return Object.keys(e).forEach(function(t){typeof e[t]=="object"&&(e[t]=JSON.stringify(e[t])),e[t]=String(e[t])}),e}function un(e){if(e)return Object.keys(e).forEach(function(t){typeof e[t]=="string"||typeof e[t]=="boolean"||typeof e[t]=="number"||(e[t]=JSON.stringify(e[t]))}),e}function Mr(e){return typeof e=="object"&&typeof e.message!="undefined"}function Or(e){if(typeof e.stacktrace!="undefined"||typeof e["opera#sourceloc"]!="undefined"){var t=e.stacktrace,n=t===void 0?"":t;return n.split(`
9
9
  `).filter(function(a){return a!==""})}else if(e.stack){var r=e.stack,o=r===void 0?"":r;return o.split(`
10
- `).filter(function(a){return a!==""})}else return["No stacktrace available"]}function Rr(e){return Object.keys(e).map(function(t){return"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(e[t]))}).join("&")}function dn(){return Object.prototype.toString.call(typeof process!="undefined"?process:0)==="[object process]"}function Be(){return dn()?global:typeof window!="undefined"?window:typeof self!="undefined"?self:{}}var Ir=function(){function e(t){this._data=t}return e.prototype.toJSON=function(){return JSON.stringify(this._data)},e.prototype.serialize=function(){return this._data},e}(),Nr="1.3.31",lt=function(){function e(){}return e.serialize=function(){return{transport:this.transport(),origin:this.origin()}},e.origin=function(){var t=Be();return t.location?t.location.origin||"".concat(t.location.protocol,"//").concat(t.location.hostname):""},e.transport=function(){var t=Be();return dn()&&typeof jest=="undefined"?"NodeHTTP":t.XDomainRequest?"XDomainRequest":t.XMLHttpRequest&&!t.fetch?"XMLHttpRequest":"fetch"},e.supportsPromises=function(){var t=Be();return"Promise"in t&&"resolve"in t.Promise&&"reject"in t.Promise&&"all"in t.Promise&&"race"in t.Promise&&function(){var n;return new t.Promise(function(r){n=r}),typeof n=="function"}()},e}(),Fr=function(){function e(t){this.url=t}return e.prototype.send=function(t){var n=this;return new Promise(function(r,o){var a,i=new XDomainRequest,s=new RegExp("^https?:");i.onload=function(){return r({})},i.open("POST",n.url.replace(s,(a=window==null?void 0:window.location)===null||a===void 0?void 0:a.protocol)),setTimeout(function(){try{i.send(t)}catch(u){o(u)}},0)})},e}(),Ur=function(){function e(t){this.url=t}return e.prototype.send=function(t){var n=this;return new Promise(function(r,o){try{var a=new XMLHttpRequest;a.onreadystatechange=function(){a.readyState===XMLHttpRequest.DONE&&r({})},a.open("POST",n.url),a.send(t)}catch(i){o(i)}})},e}(),Lr=function(){function e(t,n){this.url=t}return e.prototype.send=function(t){return Le(this,void 0,void 0,function(){var n,r,o;return xe(this,function(a){switch(a.label){case 0:return[4,fetch(this.url,{method:"POST",body:t})];case 1:return n=a.sent(),r=n.statusText,o=n.ok,[2,o?Promise.resolve({}):Promise.reject({statusText:r})]}})})},e}(),Vr=function(){function e(t){this.url=t,this.https=Promise.resolve().then(()=>ao)}return e.prototype.send=function(t){var n=this,r={method:"POST",headers:{"Content-Type":"application/json","Content-Length":t.length}};return new Promise(function(o,a){n.https.then(function(i){var s=i.request(n.url,r,function(){}).on("error",function(u){return a(u)});s.write(t),s.end(),o({})}).catch(function(i){console.warn("NodeTransport is being used, but the HTTPS module could not be imported. No data will be sent to AppSignal."),a(i)})})},e}(),Gr=function(){function e(t){this._uri=t.uri||"https://appsignal-endpoint.net/collect",this._apiKey=t.key,this._clientVersion=t.version,this._transport=this._createTransport(this._url())}return e.prototype.push=function(t){return Le(this,void 0,void 0,function(){return xe(this,function(n){switch(n.label){case 0:return[4,this._transport.send(t.toJSON())];case 1:return n.sent(),[2,t]}})})},e.prototype._createTransport=function(t){switch(lt.transport()){case"XDomainRequest":return new Fr(t);case"XMLHttpRequest":return new Ur(t);case"NodeHTTP":return new Vr(t);default:return new Lr(t)}},e.prototype._url=function(){var t=this._authorization();return"".concat(this._uri,"?").concat(Rr(t))},e.prototype._authorization=function(){return{api_key:this._apiKey,version:this._clientVersion}},e}(),ze=function(e){Ar(t,e);function t(n){return e.call(this,te({timestamp:Math.round(new Date().getTime()/1e3),namespace:"frontend",error:{name:"NullError",message:"No error has been set",backtrace:[]}},n))||this}return t.prototype.setAction=function(n){return!n||typeof n!="string"?this:(this._data.action=n,this)},t.prototype.setNamespace=function(n){return!n||typeof n!="string"?this:(this._data.namespace=n,this)},t.prototype.setError=function(n){return!n||!Mr(n)?this:(this._data.error={name:n.name||"[unknown]",message:n.message,backtrace:Or(n)},this)},t.prototype.setTags=function(n){return this._data.tags=te(te({},this._data.tags),Dr(n)),this},t.prototype.setParams=function(n){return this._data.params=te(te({},this._data.params),n),this},t.prototype.setBreadcrumbs=function(n){return this._data.breadcrumbs=n,this},t}(Ir),Br=function(){function e(t){this._data=t||[]}return e.prototype.clear=function(){this._data=[]},e.prototype.values=function(){return this._data},e.prototype.push=function(t){var n;return Array.isArray(t)?(n=this._data).push.apply(n,Ge([],Ve(t),!1)):this._data.push(t)},e.prototype.drain=function(){return xe(this,function(t){switch(t.label){case 0:return this._data.length>0?[4,this._data.shift()]:[3,2];case 1:return t.sent(),[3,0];case 2:return[2]}})},e}(),zr=function(){function e(t,n,r){this._retries=0,this._timerID=0,this._duration=0,this._api=n,this._queue=t,this.options=te({limit:5,initialDuration:1e3},r),this.reset()}return e.prototype.schedule=function(t){var n=this;t===void 0&&(t=this._duration);var r=Be(),o=1.3,a=function(){return Le(n,void 0,void 0,function(){var i,s,u,l,d,c,_;return xe(this,function(p){switch(p.label){case 0:p.trys.push([0,7,8,9]),i=Tr(this._queue.drain()),s=i.next(),p.label=1;case 1:if(s.done)return[3,6];if(u=s.value,!u)return[2];p.label=2;case 2:return p.trys.push([2,4,,5]),[4,this._api.push(u)];case 3:return p.sent(),[3,5];case 4:return p.sent(),l=Math.floor(Math.pow(t,o)),this._retries=this._retries-1,this._retries===0?this.reset():(this._queue.push(u),this._timerID=this.schedule(l)),[2];case 5:return s=i.next(),[3,1];case 6:return[3,9];case 7:return d=p.sent(),c={error:d},[3,9];case 8:try{s&&!s.done&&(_=i.return)&&_.call(i)}finally{if(c)throw c.error}return[7];case 9:return this.reset(),[2]}})})};return r.setTimeout(a,t)},e.prototype.reset=function(){var t=this.options,n=t.limit,r=t.initialDuration;this._retries=n,this._duration=r},e}(),jr=function(){function e(t){this.VERSION=Nr,this.ignored=[],this._breadcrumbs=[],this._hooks={decorators:Array(),overrides:Array()},this._env=lt.serialize(),this._queue=new Br([]);var n=t.key,r=n===void 0?"":n,o=t.uri,a=t.revision,i=t.ignoreErrors;a&&typeof a!="string"&&(t.revision=String(a)),r===""&&console.info("[APPSIGNAL]: Started in development mode."),this._api=new Gr({key:r,uri:o,version:this.VERSION}),i&&Array.isArray(i)&&(this.ignored=i),this._dispatcher=new zr(this._queue,this._api),this._options=t}return e.prototype.send=function(t,n,r){var o=this;if(!(t instanceof Error)&&!(t instanceof ze)&&!(t&&t.error instanceof Error)){console.error("[APPSIGNAL]: Can't send error, given error is not a valid type");return}var a;if("error"in t?a=t.error:a=t,this.ignored.length!==0){if(a&&"message"in a&&this.ignored.some(function(d){return d.test(a.message)})){console.warn("[APPSIGNAL]: Ignored an error: ".concat(a.message));return}if(a instanceof ze){var i=a.serialize().error;if(i.message&&this.ignored.some(function(d){return d.test(i.message)})){console.warn("[APPSIGNAL]: Ignored a span: ".concat(i.message));return}}}var s=a instanceof ze?a:this._createSpanFromError(a);if(this._hooks.decorators.length>0&&cn.apply(void 0,Ge([],Ve(this._hooks.decorators),!1))(s),n)if(typeof n=="function"){var u=n;u(s)}else{console.warn("[APPSIGNAL]: DEPRECATED: Calling the `send`/`sendError` function with a tags object is deprecated. Use the callback argument instead.");var l=un(n)||{};s.setTags(l)}if(r&&(console.warn("[APPSIGNAL]: DEPRECATED: Calling the `send`/`sendError` function with a namespace is deprecated. Use the callback argument instead."),s.setNamespace(r)),this._breadcrumbs.length>0&&s.setBreadcrumbs(this._breadcrumbs),this._hooks.overrides.length>0&&cn.apply(void 0,Ge([],Ve(this._hooks.overrides),!1))(s),lt.supportsPromises())if(this._breadcrumbs=[],!this._options.key)console.warn("[APPSIGNAL]: Span not sent because we're in development mode:",s);else return this._api.push(s).catch(function(){o._queue.push(s),setTimeout(function(){return o._dispatcher.schedule()},0)});else{console.error("[APPSIGNAL]: Error not sent. A Promise polyfill is required.");return}},e.prototype.sendError=function(t,n,r){return this.send(t,n,r)},e.prototype.use=function(t){t.call(this)},e.prototype.createSpan=function(t){var n=this._options,r=n.revision,o=r===void 0?"":r,a=n.namespace,i=new ze({environment:this._env,revision:o});return a&&i.setNamespace(a),t&&typeof t=="function"&&t(i),i},e.prototype.wrap=function(t,n,r){return Le(this,void 0,void 0,function(){var o;return xe(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,5]),[4,t()];case 1:return[2,a.sent()];case 2:return o=a.sent(),o instanceof Error||o instanceof ErrorEvent?[4,this.sendError(o,n,r)]:[3,4];case 3:a.sent(),a.label=4;case 4:return[2,Promise.reject(o)];case 5:return[2]}})})},e.prototype.addDecorator=function(t){this._hooks.decorators.push(t)},e.prototype.addOverride=function(t){this._hooks.overrides.push(t)},e.prototype.demo=function(){var t=this._createSpanFromError(new Error("Hello world! This is an error used for demonstration purposes."));t.setAction("TestAction").setParams({path:"/hello",method:"GET"}).setTags({demo_sample:"true"}),this.send(t)},e.prototype.addBreadcrumb=function(t){var n=te(te({timestamp:Math.round(new Date().getTime()/1e3)},t),{metadata:un(t.metadata)});if(!n.category){console.warn("[APPSIGNAL]: Breadcrumb not added. `category` is missing.");return}if(!n.action){console.warn("[APPSIGNAL]: Breadcrumb not added. `action` is missing.");return}this._breadcrumbs.length===20&&this._breadcrumbs.pop(),this._breadcrumbs.unshift(n)},e.prototype._createSpanFromError=function(t){var n=this.createSpan();return n.setError(t),n},e}();const Hr=new jr({key:"e4ff3075-0d9e-48cf-a8af-b0443befbbec",revision:kt});var Kr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(r[a]=o[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ct=function(){return ct=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},ct.apply(this,arguments)},Zr=function(e){Kr(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.state={error:void 0},n}return t.prototype.componentDidCatch=function(n,r){var o=this.props,a=o.instance,i=o.action,s=o.tags,u=n.name,l=n.message,d=n.stack,c=a.createSpan();c.setError({name:u,message:l,stack:d}).setTags(ct({framework:"Preact"},s)),i&&i!==""&&c.setAction(i),a.send(c),this.setState({error:n})},t.prototype.render=function(){return this.state.error?this.props.fallback?this.props.fallback(this.state.error):null:this.props.children},t.defaultProps={action:""},t}($);const qr=()=>f("div",{class:"mx-auto w-fit rounded-lg border-red-800 bg-red-500/20 p-4 font-mono text-sm leading-6",children:f("h2",{class:"mb-4 text-center text-xl font-medium",children:"Something went wrong"})});function Yr({config:e}){const{amount:t,currency:n,language:r,translations:o,publishable_api_key:a}=e,i=document.documentElement.dir==="rtl"||r==="ar",s=en[n]||en.default,u=s===0?t:parseFloat((t/_n(10,s)).toFixed(s)),l=new Intl.NumberFormat("en",{style:"currency",currency:n,currencyDisplay:"symbol",minimumFractionDigits:s}).format(u),[d,c]=N(R(S({version:kt,base_url:"https://apimig.moyasar.com"},e),{translations:Tn(o),formattedAmount:l,decimalAmount:u.toFixed(s).toString(),isProcessing:!1,isRtl:i,showForm:!1,isTestMode:(a==null?void 0:a.startsWith("pk_test"))||location.protocol==="http:"}));return Z(()=>{var _,p;if(!window.SamsungPay&&e.samsung_pay){const y=document.createElement("script");y.src="https://img.mpay.samsung.com/gsmpi/sdk/samsungpay_web_sdk.js",document.body.append(y)}if(!((p=(_=window.google)==null?void 0:_.payments)!=null&&p.api)&&e.google_pay){const y=document.createElement("script");y.src="https://pay.google.com/gp/p/js/pay.js",document.body.append(y)}},[]),f(z.Provider,{value:R(S({},d),{setFormSettings:c}),children:f(Zr,{instance:Hr,tags:{tag:"moyasar-payment-form"},fallback:()=>f(qr,{}),children:f("div",{class:ie(["box-border flex w-full min-w-60 flex-col gap-4 text-base leading-4 text-black/90",e.fixed_width&&"md:mx-auto md:max-w-80"]),dir:r==="ar"?"rtl":"ltr",children:[f($t,{}),f(dr,{}),e.methods.includes("creditcard")&&f(Cr,{}),f(Sn,{})]})})})}const Jr=e=>{function t(n){if(typeof n!="function")return!1;const r=(n==null?void 0:n.constructor.prototype.constructor.name)==="AsyncFunction",o=n.toString().startsWith("async");return r||o}return e.on_initiating&&!t(e.on_initiating)&&E("On initiating must be a promise based callback, check documentation for implementation details"),e.on_completed&&!t(e.on_completed)&&E("On completed must be a promise based callback, check documentation for implementation details"),e.on_failure&&!t(e.on_failure)&&E("On failure must be a promise based callback, check documentation for implementation details"),e.on_redirect&&!t(e.on_redirect)&&E("On redirect must be a promise based callback, check documentation for implementation details"),!0},Wr=e=>{var t,n;return e.payment_button_type&&typeof e.payment_button_type!="string"&&fe("Payment button type"),e.payment_button_type&&!pr.includes(e.payment_button_type)&&E("Unsupported button type, check documentation for list of supported types"),e.language&&typeof e.language!="string"&&fe("Language"),e.translations&&typeof e.translations!="object"&&fe("Translations"),e.metadata&&typeof e.metadata!="object"&&E("Metadata must be and object"),e.metadata&&Object.entries(e.metadata).length>50&&E("Only 50 Key/Value pairs are allowed in metadata"),e.invoice_id&&typeof e.invoice_id!="string"&&E("Invoice ID must be a string"),e.invoice_id&&(/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}$/.test((t=e.invoice_id)!=null?t:"")||E("Invalid invoice ID format")),e.statement_descriptor&&typeof e.statement_descriptor!="string"&&E("Statement descriptor must be a string"),e.statement_descriptor&&(/^[\w\s\d\-~]{1,64}$/.test((n=e.statement_descriptor)!=null?n:"")||E('Invalid format for the statement descriptor [length between 1 and 64 characters, allowed alphanumeric characters, white-spaces, "/", "-" and "~" symbols] ')),e.fixed_width&&typeof e.fixed_width!="boolean"&&E("Fixed width expects boolean value"),!0},ut=(e,t)=>e.every(n=>t.includes(n)),Xr=e=>{var t,n,r,o,a,i,s,u,l,d,c,_;if(e.methods&&!Array.isArray(e.methods)&&E("Methods must be an array"),e.methods.includes("creditcard")&&((t=e.credit_card)!=null&&t.manual&&typeof e.credit_card.manual!="boolean"&&E("Credit Card manual option must be a boolean"),(n=e.credit_card)!=null&&n.save_card&&typeof e.credit_card.save_card!="boolean"&&E("Credit Card save card option must be a boolean")),e.methods.includes("applepay")&&(e.apple_pay||H("Apple Pay configuration"),e.apple_pay)){const p=e.apple_pay.country||((r=e.payment_options)==null?void 0:r.country),y=e.apple_pay.label||((o=e.payment_options)==null?void 0:o.label);p||H("Apple Pay country or Payment Options country"),(p==null?void 0:p.trim().length)!==2&&E("Country must be two-letter ISO 3166 country code"),y||H("Apple Pay label or Payment Options label"),(y==null?void 0:y.trim().length)===0&&E("Apple Pay label or Payment Options label can't be empty"),e.apple_pay.validate_merchant_url&&!pn(e.apple_pay.validate_merchant_url)&&fe("Apple Pay Validate Merchant URL"),(a=e.apple_pay)!=null&&a.merchant_capabilities&&(ut(e.apple_pay.merchant_capabilities,at)||E(`Apple Pay merchant capabilities supports only ${at.join(", ")}`)),(i=e.apple_pay)!=null&&i.supported_countries&&!Array.isArray(e.apple_pay.supported_countries)&&E("Apple Pay Supported Countries must be an array of country codes")}if(e.samsung_pay){const p=e.samsung_pay.country||((s=e.payment_options)==null?void 0:s.country),y=e.samsung_pay.label||((u=e.payment_options)==null?void 0:u.label),g=e.samsung_pay.order_number,m=e.publishable_api_key.startsWith("pk_test")||location.protocol==="http:";!window.SamsungPay&&m&&console.warn("To speed up loading of Samsung Pay button you can include the Samsung Pay Web SDK JavaScript file in your website front-end directly. If there will be no Samsung Pay available on form initialization it will be loaded automatically"),e.samsung_pay.service_id||H("Samsung Pay service_id"),e.samsung_pay.service_id.trim().length===0&&E("Samsung Pay service_id can't be empty"),g||H("Samsung Pay order_number or Payment Options order_number"),(g==null?void 0:g.trim().length)===0&&E("Order number can't be empty"),p||H("Samsung Pay country or Payment Options country"),(p==null?void 0:p.trim().length)!==2&&E("Country must be two-letter ISO 3166 country code"),y||H("Samsung Pay label or Payment Options label"),(y==null?void 0:y.trim().length)===0&&E("Samsung Pay label or Payment Options label can't be empty")}if(e.google_pay){const p=e.google_pay.country||((l=e.payment_options)==null?void 0:l.country),y=e.google_pay.label||((d=e.payment_options)==null?void 0:d.label),g=e.publishable_api_key.startsWith("pk_test")||location.protocol==="http:",m=e.google_pay.environment;!((_=(c=window.google)==null?void 0:c.payments)!=null&&_.api)&&g&&console.warn("To speed up loading of Google Pay button you can include the Google Pay Web SDK JavaScript file in your website front-end directly. If there will be no Google Pay available on form initialization it will be loaded automatically"),e.google_pay.merchant_id||H("Google Pay service_id"),e.google_pay.merchant_id.trim().length===0&&E("Google Pay service_id can't be empty"),p||H("Google Pay country or Payment Options country"),(p==null?void 0:p.trim().length)!==2&&E("Country must be two-letter ISO 3166 country code"),y||H("Google Pay label or Payment Options label"),(y==null?void 0:y.trim().length)===0&&E("Google Pay label or Payment Options label can't be empty"),m&&!["PRODUCTION","TEST"].includes(m)&&E("Google Pay environment can be set to `TEST` or `PRODUCTION`");const{auth_methods:h}=e.google_pay;h&&!Array.isArray(h)&&E("Google Pay auth_methods must be an array"),h&&!h.every(v=>v==="PAN_ONLY"||v==="CRYPTOGRAM_3DS")&&E("Google Pay auth_methods must contain 'CRYPTOGRAM_3DS' and/or 'PAN_ONLY'")}return e.methods&&(ut(e.methods,ot)||E(`Moyasar form supports only ${ot.join(", ")} methods`)),e.supported_networks&&(ut(e.supported_networks,rt)||E(`Moyasar form supports only ${rt.join(", ")} networks`)),!0},Qr=e=>(e.element||H("element"),typeof e.element!="string"&&!(e.element instanceof Element)&&fe("Element"),typeof e.element=="string"&&!document.querySelector(e.element)&&E(`Selector ${e.element} does't exist id DOM`),e.publishable_api_key.trim()||H("publishable_api_key"),e.publishable_api_key&&(/^pk_(test|live)_.{40}$/.test(e.publishable_api_key)||fe("Publishable API Key"),location.protocol.toLowerCase()==="http:"&&e.publishable_api_key.startsWith("pk_live")&&E("Production key (pk_live) require secure connection, for development use key starting with pk_test")),e.amount||H("amount"),e.amount&&((typeof e.amount!="number"||e.amount<100)&&E("Amount must be a non-negative integer. Minimal supported value is 100."),Number.isInteger(e.amount)||E("Amount must be in minor unit of selected currency, e.g. for $19.99 set amount to 1999.")),e.currency||H("currency"),e.currency&&e.currency.trim().length!==3&&E("Currency must be in ISO 3166-1 alpha-3 country code format"),e.description||H("description"),e.description&&e.description.trim().length===0&&E("Description can't be empty"),e.callback_url||H("callback_url"),pn(e.callback_url)||fe("Callback URL"),!0),E=e=>{throw window.silentError&&console.error(e),new Error(e)},H=e=>E(`Missing entry: ${e} is required`),fe=e=>E(`${e} is invalid`),pn=e=>typeof e=="string"&&/^https?:\/\/.+/.test(e),$r=(e,t=!1)=>(t&&(window.silentError=t),Qr(e),Xr(e),Wr(e),Jr(e),!0),eo=e=>{const t=e.publishable_api_key.startsWith("pk_test")||location.protocol==="http:";try{$r(e,t)}catch(o){const a=document.createElement("div"),i="moyasarFallbackRoot";a.id=i,document.body.appendChild(a),wt(f(()=>f("div",{class:"mx-auto w-fit rounded-lg border-red-800 bg-red-500/20 p-4 font-mono text-sm leading-6",children:[f("h2",{class:"mb-4 text-center text-xl font-medium",children:"Form configuration issue!"}),f("p",{children:"Please check configuration for missing properties or incorrect values."}),f("p",{children:"Check browser console for more information"})]}),{}),document.getElementById(i));return}const n=e.element;let r;typeof n=="string"&&(r=document.querySelector(n)),n instanceof Element&&(r=n),r&&(r.setAttribute("moyasar-payment-form-root",""),r.setAttribute("lang",e.language),wt(f(Yr,{config:e}),r))},to="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let no=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e));for(;e--;)t+=to[n[e]&63];return t};const ro=e=>{const t=S({},e);return e.payment_button_type||(t.payment_button_type="pay"),e.language||(t.language=document.documentElement.lang||"en"),e.methods||(t.methods=ot),e.supported_networks&&(t.supported_networks=e.supported_networks.map(n=>n==="mastercard"?"masterCard":n)),e.supported_networks||(t.supported_networks=rt.filter(n=>n!=="amex")),!e.fixed_width&&e.fixed_width!==!1&&(t.fixed_width=!0),e.apple_pay&&(e.apple_pay.version||(t.apple_pay.version=6),e.apple_pay.merchant_capabilities||(t.apple_pay.merchant_capabilities=at.filter(n=>n!=="supportsEMV")),e.apple_pay.supported_countries||(t.apple_pay.supported_countries=["SA"])),e.samsung_pay&&(e.samsung_pay.version||(t.samsung_pay.version=2),e.samsung_pay.environment||(t.samsung_pay.environment="PRODUCTION")),e.google_pay&&(e.google_pay.environment||(t.google_pay.environment="PRODUCTION"),e.google_pay.auth_methods||(t.google_pay.auth_methods=["PAN_ONLY","CRYPTOGRAM_3DS"]),e.google_pay.gateway_merchant_id||(t.google_pay.gateway_merchant_id=no(36))),t};class oo{static init(t){const n=ro(t);eo(n)}}const ao=Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"}));return oo});
10
+ `).filter(function(a){return a!==""})}else return["No stacktrace available"]}function Rr(e){return Object.keys(e).map(function(t){return"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(e[t]))}).join("&")}function dn(){return Object.prototype.toString.call(typeof process!="undefined"?process:0)==="[object process]"}function Be(){return dn()?global:typeof window!="undefined"?window:typeof self!="undefined"?self:{}}var Ir=function(){function e(t){this._data=t}return e.prototype.toJSON=function(){return JSON.stringify(this._data)},e.prototype.serialize=function(){return this._data},e}(),Nr="1.3.31",lt=function(){function e(){}return e.serialize=function(){return{transport:this.transport(),origin:this.origin()}},e.origin=function(){var t=Be();return t.location?t.location.origin||"".concat(t.location.protocol,"//").concat(t.location.hostname):""},e.transport=function(){var t=Be();return dn()&&typeof jest=="undefined"?"NodeHTTP":t.XDomainRequest?"XDomainRequest":t.XMLHttpRequest&&!t.fetch?"XMLHttpRequest":"fetch"},e.supportsPromises=function(){var t=Be();return"Promise"in t&&"resolve"in t.Promise&&"reject"in t.Promise&&"all"in t.Promise&&"race"in t.Promise&&function(){var n;return new t.Promise(function(r){n=r}),typeof n=="function"}()},e}(),Fr=function(){function e(t){this.url=t}return e.prototype.send=function(t){var n=this;return new Promise(function(r,o){var a,i=new XDomainRequest,s=new RegExp("^https?:");i.onload=function(){return r({})},i.open("POST",n.url.replace(s,(a=window==null?void 0:window.location)===null||a===void 0?void 0:a.protocol)),setTimeout(function(){try{i.send(t)}catch(u){o(u)}},0)})},e}(),Ur=function(){function e(t){this.url=t}return e.prototype.send=function(t){var n=this;return new Promise(function(r,o){try{var a=new XMLHttpRequest;a.onreadystatechange=function(){a.readyState===XMLHttpRequest.DONE&&r({})},a.open("POST",n.url),a.send(t)}catch(i){o(i)}})},e}(),Lr=function(){function e(t,n){this.url=t}return e.prototype.send=function(t){return Le(this,void 0,void 0,function(){var n,r,o;return xe(this,function(a){switch(a.label){case 0:return[4,fetch(this.url,{method:"POST",body:t})];case 1:return n=a.sent(),r=n.statusText,o=n.ok,[2,o?Promise.resolve({}):Promise.reject({statusText:r})]}})})},e}(),Vr=function(){function e(t){this.url=t,this.https=Promise.resolve().then(()=>ao)}return e.prototype.send=function(t){var n=this,r={method:"POST",headers:{"Content-Type":"application/json","Content-Length":t.length}};return new Promise(function(o,a){n.https.then(function(i){var s=i.request(n.url,r,function(){}).on("error",function(u){return a(u)});s.write(t),s.end(),o({})}).catch(function(i){console.warn("NodeTransport is being used, but the HTTPS module could not be imported. No data will be sent to AppSignal."),a(i)})})},e}(),Gr=function(){function e(t){this._uri=t.uri||"https://appsignal-endpoint.net/collect",this._apiKey=t.key,this._clientVersion=t.version,this._transport=this._createTransport(this._url())}return e.prototype.push=function(t){return Le(this,void 0,void 0,function(){return xe(this,function(n){switch(n.label){case 0:return[4,this._transport.send(t.toJSON())];case 1:return n.sent(),[2,t]}})})},e.prototype._createTransport=function(t){switch(lt.transport()){case"XDomainRequest":return new Fr(t);case"XMLHttpRequest":return new Ur(t);case"NodeHTTP":return new Vr(t);default:return new Lr(t)}},e.prototype._url=function(){var t=this._authorization();return"".concat(this._uri,"?").concat(Rr(t))},e.prototype._authorization=function(){return{api_key:this._apiKey,version:this._clientVersion}},e}(),ze=function(e){Ar(t,e);function t(n){return e.call(this,te({timestamp:Math.round(new Date().getTime()/1e3),namespace:"frontend",error:{name:"NullError",message:"No error has been set",backtrace:[]}},n))||this}return t.prototype.setAction=function(n){return!n||typeof n!="string"?this:(this._data.action=n,this)},t.prototype.setNamespace=function(n){return!n||typeof n!="string"?this:(this._data.namespace=n,this)},t.prototype.setError=function(n){return!n||!Mr(n)?this:(this._data.error={name:n.name||"[unknown]",message:n.message,backtrace:Or(n)},this)},t.prototype.setTags=function(n){return this._data.tags=te(te({},this._data.tags),Dr(n)),this},t.prototype.setParams=function(n){return this._data.params=te(te({},this._data.params),n),this},t.prototype.setBreadcrumbs=function(n){return this._data.breadcrumbs=n,this},t}(Ir),Br=function(){function e(t){this._data=t||[]}return e.prototype.clear=function(){this._data=[]},e.prototype.values=function(){return this._data},e.prototype.push=function(t){var n;return Array.isArray(t)?(n=this._data).push.apply(n,Ge([],Ve(t),!1)):this._data.push(t)},e.prototype.drain=function(){return xe(this,function(t){switch(t.label){case 0:return this._data.length>0?[4,this._data.shift()]:[3,2];case 1:return t.sent(),[3,0];case 2:return[2]}})},e}(),zr=function(){function e(t,n,r){this._retries=0,this._timerID=0,this._duration=0,this._api=n,this._queue=t,this.options=te({limit:5,initialDuration:1e3},r),this.reset()}return e.prototype.schedule=function(t){var n=this;t===void 0&&(t=this._duration);var r=Be(),o=1.3,a=function(){return Le(n,void 0,void 0,function(){var i,s,u,l,d,c,_;return xe(this,function(p){switch(p.label){case 0:p.trys.push([0,7,8,9]),i=Tr(this._queue.drain()),s=i.next(),p.label=1;case 1:if(s.done)return[3,6];if(u=s.value,!u)return[2];p.label=2;case 2:return p.trys.push([2,4,,5]),[4,this._api.push(u)];case 3:return p.sent(),[3,5];case 4:return p.sent(),l=Math.floor(Math.pow(t,o)),this._retries=this._retries-1,this._retries===0?this.reset():(this._queue.push(u),this._timerID=this.schedule(l)),[2];case 5:return s=i.next(),[3,1];case 6:return[3,9];case 7:return d=p.sent(),c={error:d},[3,9];case 8:try{s&&!s.done&&(_=i.return)&&_.call(i)}finally{if(c)throw c.error}return[7];case 9:return this.reset(),[2]}})})};return r.setTimeout(a,t)},e.prototype.reset=function(){var t=this.options,n=t.limit,r=t.initialDuration;this._retries=n,this._duration=r},e}(),jr=function(){function e(t){this.VERSION=Nr,this.ignored=[],this._breadcrumbs=[],this._hooks={decorators:Array(),overrides:Array()},this._env=lt.serialize(),this._queue=new Br([]);var n=t.key,r=n===void 0?"":n,o=t.uri,a=t.revision,i=t.ignoreErrors;a&&typeof a!="string"&&(t.revision=String(a)),r===""&&console.info("[APPSIGNAL]: Started in development mode."),this._api=new Gr({key:r,uri:o,version:this.VERSION}),i&&Array.isArray(i)&&(this.ignored=i),this._dispatcher=new zr(this._queue,this._api),this._options=t}return e.prototype.send=function(t,n,r){var o=this;if(!(t instanceof Error)&&!(t instanceof ze)&&!(t&&t.error instanceof Error)){console.error("[APPSIGNAL]: Can't send error, given error is not a valid type");return}var a;if("error"in t?a=t.error:a=t,this.ignored.length!==0){if(a&&"message"in a&&this.ignored.some(function(d){return d.test(a.message)})){console.warn("[APPSIGNAL]: Ignored an error: ".concat(a.message));return}if(a instanceof ze){var i=a.serialize().error;if(i.message&&this.ignored.some(function(d){return d.test(i.message)})){console.warn("[APPSIGNAL]: Ignored a span: ".concat(i.message));return}}}var s=a instanceof ze?a:this._createSpanFromError(a);if(this._hooks.decorators.length>0&&cn.apply(void 0,Ge([],Ve(this._hooks.decorators),!1))(s),n)if(typeof n=="function"){var u=n;u(s)}else{console.warn("[APPSIGNAL]: DEPRECATED: Calling the `send`/`sendError` function with a tags object is deprecated. Use the callback argument instead.");var l=un(n)||{};s.setTags(l)}if(r&&(console.warn("[APPSIGNAL]: DEPRECATED: Calling the `send`/`sendError` function with a namespace is deprecated. Use the callback argument instead."),s.setNamespace(r)),this._breadcrumbs.length>0&&s.setBreadcrumbs(this._breadcrumbs),this._hooks.overrides.length>0&&cn.apply(void 0,Ge([],Ve(this._hooks.overrides),!1))(s),lt.supportsPromises())if(this._breadcrumbs=[],!this._options.key)console.warn("[APPSIGNAL]: Span not sent because we're in development mode:",s);else return this._api.push(s).catch(function(){o._queue.push(s),setTimeout(function(){return o._dispatcher.schedule()},0)});else{console.error("[APPSIGNAL]: Error not sent. A Promise polyfill is required.");return}},e.prototype.sendError=function(t,n,r){return this.send(t,n,r)},e.prototype.use=function(t){t.call(this)},e.prototype.createSpan=function(t){var n=this._options,r=n.revision,o=r===void 0?"":r,a=n.namespace,i=new ze({environment:this._env,revision:o});return a&&i.setNamespace(a),t&&typeof t=="function"&&t(i),i},e.prototype.wrap=function(t,n,r){return Le(this,void 0,void 0,function(){var o;return xe(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,5]),[4,t()];case 1:return[2,a.sent()];case 2:return o=a.sent(),o instanceof Error||o instanceof ErrorEvent?[4,this.sendError(o,n,r)]:[3,4];case 3:a.sent(),a.label=4;case 4:return[2,Promise.reject(o)];case 5:return[2]}})})},e.prototype.addDecorator=function(t){this._hooks.decorators.push(t)},e.prototype.addOverride=function(t){this._hooks.overrides.push(t)},e.prototype.demo=function(){var t=this._createSpanFromError(new Error("Hello world! This is an error used for demonstration purposes."));t.setAction("TestAction").setParams({path:"/hello",method:"GET"}).setTags({demo_sample:"true"}),this.send(t)},e.prototype.addBreadcrumb=function(t){var n=te(te({timestamp:Math.round(new Date().getTime()/1e3)},t),{metadata:un(t.metadata)});if(!n.category){console.warn("[APPSIGNAL]: Breadcrumb not added. `category` is missing.");return}if(!n.action){console.warn("[APPSIGNAL]: Breadcrumb not added. `action` is missing.");return}this._breadcrumbs.length===20&&this._breadcrumbs.pop(),this._breadcrumbs.unshift(n)},e.prototype._createSpanFromError=function(t){var n=this.createSpan();return n.setError(t),n},e}();const Hr=new jr({key:"95fc54a8-f3ef-454c-b93d-e7e765de19f0",revision:kt});var Kr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(r[a]=o[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ct=function(){return ct=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},ct.apply(this,arguments)},Zr=function(e){Kr(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.state={error:void 0},n}return t.prototype.componentDidCatch=function(n,r){var o=this.props,a=o.instance,i=o.action,s=o.tags,u=n.name,l=n.message,d=n.stack,c=a.createSpan();c.setError({name:u,message:l,stack:d}).setTags(ct({framework:"Preact"},s)),i&&i!==""&&c.setAction(i),a.send(c),this.setState({error:n})},t.prototype.render=function(){return this.state.error?this.props.fallback?this.props.fallback(this.state.error):null:this.props.children},t.defaultProps={action:""},t}($);const qr=()=>f("div",{class:"mx-auto w-fit rounded-lg border-red-800 bg-red-500/20 p-4 font-mono text-sm leading-6",children:f("h2",{class:"mb-4 text-center text-xl font-medium",children:"Something went wrong"})});function Yr({config:e}){const{amount:t,currency:n,language:r,translations:o,publishable_api_key:a}=e,i=document.documentElement.dir==="rtl"||r==="ar",s=en[n]||en.default,u=s===0?t:parseFloat((t/_n(10,s)).toFixed(s)),l=new Intl.NumberFormat("en",{style:"currency",currency:n,currencyDisplay:"symbol",minimumFractionDigits:s}).format(u),[d,c]=N(R(S({version:kt,base_url:"https://api.moyasar.com"},e),{translations:Tn(o),formattedAmount:l,decimalAmount:u.toFixed(s).toString(),isProcessing:!1,isRtl:i,showForm:!1,isTestMode:(a==null?void 0:a.startsWith("pk_test"))||location.protocol==="http:"}));return Z(()=>{var _,p;if(!window.SamsungPay&&e.samsung_pay){const y=document.createElement("script");y.src="https://img.mpay.samsung.com/gsmpi/sdk/samsungpay_web_sdk.js",document.body.append(y)}if(!((p=(_=window.google)==null?void 0:_.payments)!=null&&p.api)&&e.google_pay){const y=document.createElement("script");y.src="https://pay.google.com/gp/p/js/pay.js",document.body.append(y)}},[]),f(z.Provider,{value:R(S({},d),{setFormSettings:c}),children:f(Zr,{instance:Hr,tags:{tag:"moyasar-payment-form"},fallback:()=>f(qr,{}),children:f("div",{class:ie(["box-border flex w-full min-w-60 flex-col gap-4 text-base leading-4 text-black/90",e.fixed_width&&"md:mx-auto md:max-w-80"]),dir:r==="ar"?"rtl":"ltr",children:[f($t,{}),f(dr,{}),e.methods.includes("creditcard")&&f(Cr,{}),f(Sn,{})]})})})}const Jr=e=>{function t(n){if(typeof n!="function")return!1;const r=(n==null?void 0:n.constructor.prototype.constructor.name)==="AsyncFunction",o=n.toString().startsWith("async");return r||o}return e.on_initiating&&!t(e.on_initiating)&&E("On initiating must be a promise based callback, check documentation for implementation details"),e.on_completed&&!t(e.on_completed)&&E("On completed must be a promise based callback, check documentation for implementation details"),e.on_failure&&!t(e.on_failure)&&E("On failure must be a promise based callback, check documentation for implementation details"),e.on_redirect&&!t(e.on_redirect)&&E("On redirect must be a promise based callback, check documentation for implementation details"),!0},Wr=e=>{var t,n;return e.payment_button_type&&typeof e.payment_button_type!="string"&&fe("Payment button type"),e.payment_button_type&&!pr.includes(e.payment_button_type)&&E("Unsupported button type, check documentation for list of supported types"),e.language&&typeof e.language!="string"&&fe("Language"),e.translations&&typeof e.translations!="object"&&fe("Translations"),e.metadata&&typeof e.metadata!="object"&&E("Metadata must be and object"),e.metadata&&Object.entries(e.metadata).length>50&&E("Only 50 Key/Value pairs are allowed in metadata"),e.invoice_id&&typeof e.invoice_id!="string"&&E("Invoice ID must be a string"),e.invoice_id&&(/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}$/.test((t=e.invoice_id)!=null?t:"")||E("Invalid invoice ID format")),e.statement_descriptor&&typeof e.statement_descriptor!="string"&&E("Statement descriptor must be a string"),e.statement_descriptor&&(/^[\w\s\d\-~]{1,64}$/.test((n=e.statement_descriptor)!=null?n:"")||E('Invalid format for the statement descriptor [length between 1 and 64 characters, allowed alphanumeric characters, white-spaces, "/", "-" and "~" symbols] ')),e.fixed_width&&typeof e.fixed_width!="boolean"&&E("Fixed width expects boolean value"),!0},ut=(e,t)=>e.every(n=>t.includes(n)),Xr=e=>{var t,n,r,o,a,i,s,u,l,d,c,_;if(e.methods&&!Array.isArray(e.methods)&&E("Methods must be an array"),e.methods.includes("creditcard")&&((t=e.credit_card)!=null&&t.manual&&typeof e.credit_card.manual!="boolean"&&E("Credit Card manual option must be a boolean"),(n=e.credit_card)!=null&&n.save_card&&typeof e.credit_card.save_card!="boolean"&&E("Credit Card save card option must be a boolean")),e.methods.includes("applepay")&&(e.apple_pay||H("Apple Pay configuration"),e.apple_pay)){const p=e.apple_pay.country||((r=e.payment_options)==null?void 0:r.country),y=e.apple_pay.label||((o=e.payment_options)==null?void 0:o.label);p||H("Apple Pay country or Payment Options country"),(p==null?void 0:p.trim().length)!==2&&E("Country must be two-letter ISO 3166 country code"),y||H("Apple Pay label or Payment Options label"),(y==null?void 0:y.trim().length)===0&&E("Apple Pay label or Payment Options label can't be empty"),e.apple_pay.validate_merchant_url&&!pn(e.apple_pay.validate_merchant_url)&&fe("Apple Pay Validate Merchant URL"),(a=e.apple_pay)!=null&&a.merchant_capabilities&&(ut(e.apple_pay.merchant_capabilities,at)||E(`Apple Pay merchant capabilities supports only ${at.join(", ")}`)),(i=e.apple_pay)!=null&&i.supported_countries&&!Array.isArray(e.apple_pay.supported_countries)&&E("Apple Pay Supported Countries must be an array of country codes")}if(e.samsung_pay){const p=e.samsung_pay.country||((s=e.payment_options)==null?void 0:s.country),y=e.samsung_pay.label||((u=e.payment_options)==null?void 0:u.label),g=e.samsung_pay.order_number,m=e.publishable_api_key.startsWith("pk_test")||location.protocol==="http:";!window.SamsungPay&&m&&console.warn("To speed up loading of Samsung Pay button you can include the Samsung Pay Web SDK JavaScript file in your website front-end directly. If there will be no Samsung Pay available on form initialization it will be loaded automatically"),e.samsung_pay.service_id||H("Samsung Pay service_id"),e.samsung_pay.service_id.trim().length===0&&E("Samsung Pay service_id can't be empty"),g||H("Samsung Pay order_number or Payment Options order_number"),(g==null?void 0:g.trim().length)===0&&E("Order number can't be empty"),p||H("Samsung Pay country or Payment Options country"),(p==null?void 0:p.trim().length)!==2&&E("Country must be two-letter ISO 3166 country code"),y||H("Samsung Pay label or Payment Options label"),(y==null?void 0:y.trim().length)===0&&E("Samsung Pay label or Payment Options label can't be empty")}if(e.google_pay){const p=e.google_pay.country||((l=e.payment_options)==null?void 0:l.country),y=e.google_pay.label||((d=e.payment_options)==null?void 0:d.label),g=e.publishable_api_key.startsWith("pk_test")||location.protocol==="http:",m=e.google_pay.environment;!((_=(c=window.google)==null?void 0:c.payments)!=null&&_.api)&&g&&console.warn("To speed up loading of Google Pay button you can include the Google Pay Web SDK JavaScript file in your website front-end directly. If there will be no Google Pay available on form initialization it will be loaded automatically"),e.google_pay.merchant_id||H("Google Pay service_id"),e.google_pay.merchant_id.trim().length===0&&E("Google Pay service_id can't be empty"),p||H("Google Pay country or Payment Options country"),(p==null?void 0:p.trim().length)!==2&&E("Country must be two-letter ISO 3166 country code"),y||H("Google Pay label or Payment Options label"),(y==null?void 0:y.trim().length)===0&&E("Google Pay label or Payment Options label can't be empty"),m&&!["PRODUCTION","TEST"].includes(m)&&E("Google Pay environment can be set to `TEST` or `PRODUCTION`");const{auth_methods:h}=e.google_pay;h&&!Array.isArray(h)&&E("Google Pay auth_methods must be an array"),h&&!h.every(v=>v==="PAN_ONLY"||v==="CRYPTOGRAM_3DS")&&E("Google Pay auth_methods must contain 'CRYPTOGRAM_3DS' and/or 'PAN_ONLY'")}return e.methods&&(ut(e.methods,ot)||E(`Moyasar form supports only ${ot.join(", ")} methods`)),e.supported_networks&&(ut(e.supported_networks,rt)||E(`Moyasar form supports only ${rt.join(", ")} networks`)),!0},Qr=e=>(e.element||H("element"),typeof e.element!="string"&&!(e.element instanceof Element)&&fe("Element"),typeof e.element=="string"&&!document.querySelector(e.element)&&E(`Selector ${e.element} does't exist id DOM`),e.publishable_api_key.trim()||H("publishable_api_key"),e.publishable_api_key&&(/^pk_(test|live)_.{40}$/.test(e.publishable_api_key)||fe("Publishable API Key"),location.protocol.toLowerCase()==="http:"&&e.publishable_api_key.startsWith("pk_live")&&E("Production key (pk_live) require secure connection, for development use key starting with pk_test")),e.amount||H("amount"),e.amount&&((typeof e.amount!="number"||e.amount<100)&&E("Amount must be a non-negative integer. Minimal supported value is 100."),Number.isInteger(e.amount)||E("Amount must be in minor unit of selected currency, e.g. for $19.99 set amount to 1999.")),e.currency||H("currency"),e.currency&&e.currency.trim().length!==3&&E("Currency must be in ISO 3166-1 alpha-3 country code format"),e.description||H("description"),e.description&&e.description.trim().length===0&&E("Description can't be empty"),e.callback_url||H("callback_url"),pn(e.callback_url)||fe("Callback URL"),!0),E=e=>{throw window.silentError&&console.error(e),new Error(e)},H=e=>E(`Missing entry: ${e} is required`),fe=e=>E(`${e} is invalid`),pn=e=>typeof e=="string"&&/^https?:\/\/.+/.test(e),$r=(e,t=!1)=>(t&&(window.silentError=t),Qr(e),Xr(e),Wr(e),Jr(e),!0),eo=e=>{const t=e.publishable_api_key.startsWith("pk_test")||location.protocol==="http:",n=e.element;let r;if(typeof n=="string"&&(r=document.querySelector(n)),n instanceof Element&&(r=n),!r){console.error("Moyasar Form [element] config must be a valid query selector or a valid Element instance.");return}try{$r(e,t)}catch(o){console.error(o),wt(f(()=>f("div",{class:"mx-auto w-fit rounded-lg border-red-800 bg-red-500/20 p-4 font-mono text-sm leading-6",children:[f("h2",{class:"mb-4 text-center text-xl font-medium",children:"Form configuration issue!"}),f("p",{children:"Please check configuration for missing properties or incorrect values."}),f("p",{children:"Check browser console for more information"})]}),{}),r);return}r.setAttribute("lang",e.language),wt(f(Yr,{config:e}),r)},to="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let no=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e));for(;e--;)t+=to[n[e]&63];return t};const ro=e=>{const t=S({},e);return e.payment_button_type||(t.payment_button_type="pay"),e.language||(t.language=document.documentElement.lang||"en"),e.methods||(t.methods=ot),e.supported_networks&&(t.supported_networks=e.supported_networks.map(n=>n==="mastercard"?"masterCard":n)),e.supported_networks||(t.supported_networks=rt.filter(n=>n!=="amex")),!e.fixed_width&&e.fixed_width!==!1&&(t.fixed_width=!0),e.apple_pay&&(e.apple_pay.version||(t.apple_pay.version=6),e.apple_pay.merchant_capabilities||(t.apple_pay.merchant_capabilities=at.filter(n=>n!=="supportsEMV")),e.apple_pay.supported_countries||(t.apple_pay.supported_countries=["SA"])),e.samsung_pay&&(e.samsung_pay.version||(t.samsung_pay.version=2),e.samsung_pay.environment||(t.samsung_pay.environment="PRODUCTION")),e.google_pay&&(e.google_pay.environment||(t.google_pay.environment="PRODUCTION"),e.google_pay.auth_methods||(t.google_pay.auth_methods=["PAN_ONLY","CRYPTOGRAM_3DS"]),e.google_pay.gateway_merchant_id||(t.google_pay.gateway_merchant_id=no(36))),t};class oo{static init(t){const n=ro(t);eo(n)}}const ao=Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"}));return oo});
package/package.json CHANGED
@@ -2,8 +2,11 @@
2
2
  "name": "moyasar-payment-form",
3
3
  "description": "Moyasar payment form utilities",
4
4
  "license": "MIT",
5
- "author": "Moyasar Development Team",
6
- "version": "2.0.3",
5
+ "author": "Jan Jagieła - Railwaymen Team",
6
+ "contributors": [
7
+ "Moyasar Developers"
8
+ ],
9
+ "version": "2.0.4",
7
10
  "homepage": "https://docs.moyasar.com/credit-card",
8
11
  "files": [
9
12
  "dist"
@@ -30,7 +33,7 @@
30
33
  "caddy": "caddy run --watch --config ./Caddyfile"
31
34
  },
32
35
  "devDependencies": {
33
- "@appsignal/javascript": "1.4.0",
36
+ "@appsignal/javascript": "^1.4.0",
34
37
  "@appsignal/preact": "1.0.24",
35
38
  "@preact/preset-vite": "2.8.3",
36
39
  "@types/applepayjs": "14.0.8",