"use strict";var e=require("react");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=r(e),n={exports:{}},o={exports:{}},a={},i="function"==typeof Symbol&&Symbol.for,c=i?Symbol.for("react.element"):60103,s=i?Symbol.for("react.portal"):60106,u=i?Symbol.for("react.fragment"):60107,f=i?Symbol.for("react.strict_mode"):60108,l=i?Symbol.for("react.profiler"):60114,p=i?Symbol.for("react.provider"):60109,d=i?Symbol.for("react.context"):60110,y=i?Symbol.for("react.async_mode"):60111,m=i?Symbol.for("react.concurrent_mode"):60111,b=i?Symbol.for("react.forward_ref"):60112,v=i?Symbol.for("react.suspense"):60113,g=i?Symbol.for("react.suspense_list"):60120,h=i?Symbol.for("react.memo"):60115,_=i?Symbol.for("react.lazy"):60116,S=i?Symbol.for("react.block"):60121,E=i?Symbol.for("react.fundamental"):60117,O=i?Symbol.for("react.responder"):60118,w=i?Symbol.for("react.scope"):60119;function x(e){if("object"==typeof e&&null!==e){var r=e.$$typeof;switch(r){case c:switch(e=e.type){case y:case m:case u:case l:case f:case v:return e;default:switch(e=e&&e.$$typeof){case d:case b:case _:case h:case p:return e;default:return r}}case s:return r}}}function $(e){return x(e)===m}a.AsyncMode=y,a.ConcurrentMode=m,a.ContextConsumer=d,a.ContextProvider=p,a.Element=c,a.ForwardRef=b,a.Fragment=u,a.Lazy=_,a.Memo=h,a.Portal=s,a.Profiler=l,a.StrictMode=f,a.Suspense=v,a.isAsyncMode=function(e){return $(e)||x(e)===y},a.isConcurrentMode=$,a.isContextConsumer=function(e){return x(e)===d},a.isContextProvider=function(e){return x(e)===p},a.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===c},a.isForwardRef=function(e){return x(e)===b},a.isFragment=function(e){return x(e)===u},a.isLazy=function(e){return x(e)===_},a.isMemo=function(e){return x(e)===h},a.isPortal=function(e){return x(e)===s},a.isProfiler=function(e){return x(e)===l},a.isStrictMode=function(e){return x(e)===f},a.isSuspense=function(e){return x(e)===v},a.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===u||e===m||e===l||e===f||e===v||e===g||"object"==typeof e&&null!==e&&(e.$$typeof===_||e.$$typeof===h||e.$$typeof===p||e.$$typeof===d||e.$$typeof===b||e.$$typeof===E||e.$$typeof===O||e.$$typeof===w||e.$$typeof===S)},a.typeOf=x;var j={};
/** @license React v16.13.1
 * react-is.development.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,r=e?Symbol.for("react.element"):60103,t=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,s=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,f=e?Symbol.for("react.forward_ref"):60112,l=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,d=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function h(e){if("object"==typeof e&&null!==e){var p=e.$$typeof;switch(p){case r:var m=e.type;switch(m){case s:case u:case n:case a:case o:case l:return m;default:var b=m&&m.$$typeof;switch(b){case c:case f:case y:case d:case i:return b;default:return p}}case t:return p}}}var _=s,S=u,E=c,O=i,w=r,x=f,$=n,T=y,P=d,k=t,N=a,C=o,I=l,R=!1;function A(e){return h(e)===u}j.AsyncMode=_,j.ConcurrentMode=S,j.ContextConsumer=E,j.ContextProvider=O,j.Element=w,j.ForwardRef=x,j.Fragment=$,j.Lazy=T,j.Memo=P,j.Portal=k,j.Profiler=N,j.StrictMode=C,j.Suspense=I,j.isAsyncMode=function(e){return R||(R=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),A(e)||h(e)===s},j.isConcurrentMode=A,j.isContextConsumer=function(e){return h(e)===c},j.isContextProvider=function(e){return h(e)===i},j.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},j.isForwardRef=function(e){return h(e)===f},j.isFragment=function(e){return h(e)===n},j.isLazy=function(e){return h(e)===y},j.isMemo=function(e){return h(e)===d},j.isPortal=function(e){return h(e)===t},j.isProfiler=function(e){return h(e)===a},j.isStrictMode=function(e){return h(e)===o},j.isSuspense=function(e){return h(e)===l},j.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===n||e===u||e===a||e===o||e===l||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===d||e.$$typeof===i||e.$$typeof===c||e.$$typeof===f||e.$$typeof===b||e.$$typeof===v||e.$$typeof===g||e.$$typeof===m)},j.typeOf=h}(),"production"===process.env.NODE_ENV?o.exports=a:o.exports=j
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/;var T=Object.getOwnPropertySymbols,P=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;function N(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var C=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var r={},t=0;t<10;t++)r["_"+String.fromCharCode(t)]=t;if("0123456789"!==Object.getOwnPropertyNames(r).map((function(e){return r[e]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(e){n[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,r){for(var t,n,o=N(e),a=1;a<arguments.length;a++){for(var i in t=Object(arguments[a]))P.call(t,i)&&(o[i]=t[i]);if(T){n=T(t);for(var c=0;c<n.length;c++)k.call(t,n[c])&&(o[n[c]]=t[n[c]])}}return o},I="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",R=function(){};if("production"!==process.env.NODE_ENV){var A=I,M={},V=Function.call.bind(Object.prototype.hasOwnProperty);R=function(e){var r="Warning: "+e;"undefined"!=typeof console&&console.error(r);try{throw new Error(r)}catch(e){}}}function D(e,r,t,n,o){if("production"!==process.env.NODE_ENV)for(var a in e)if(V(e,a)){var i;try{if("function"!=typeof e[a]){var c=Error((n||"React class")+": "+t+" type `"+a+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[a]+"`.");throw c.name="Invariant Violation",c}i=e[a](r,a,n,t,null,A)}catch(e){i=e}if(!i||i instanceof Error||R((n||"React class")+": type specification of "+t+" `"+a+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof i+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),i instanceof Error&&!(i.message in M)){M[i.message]=!0;var s=o?o():"";R("Failed "+t+" type: "+i.message+(null!=s?s:""))}}}D.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(M={})};var F=D,L=o.exports,q=C,z=I,W=F,B=Function.call.bind(Object.prototype.hasOwnProperty),U=function(){};function Y(){return null}"production"!==process.env.NODE_ENV&&(U=function(e){var r="Warning: "+e;"undefined"!=typeof console&&console.error(r);try{throw new Error(r)}catch(e){}});function G(){}function J(){}J.resetWarningCache=G;if("production"!==process.env.NODE_ENV){var H=o.exports;n.exports=function(e,r){var t="function"==typeof Symbol&&Symbol.iterator,n="<<anonymous>>",o={array:s("array"),bool:s("boolean"),func:s("function"),number:s("number"),object:s("object"),string:s("string"),symbol:s("symbol"),any:c(Y),arrayOf:function(e){return c((function(r,t,n,o,a){if("function"!=typeof e)return new i("Property `"+a+"` of component `"+n+"` has invalid PropType notation inside arrayOf.");var c=r[t];if(!Array.isArray(c))return new i("Invalid "+o+" `"+a+"` of type `"+f(c)+"` supplied to `"+n+"`, expected an array.");for(var s=0;s<c.length;s++){var u=e(c,s,n,o,a+"["+s+"]",z);if(u instanceof Error)return u}return null}))},element:c((function(r,t,n,o,a){var c=r[t];return e(c)?null:new i("Invalid "+o+" `"+a+"` of type `"+f(c)+"` supplied to `"+n+"`, expected a single ReactElement.")})),elementType:c((function(e,r,t,n,o){var a=e[r];return L.isValidElementType(a)?null:new i("Invalid "+n+" `"+o+"` of type `"+f(a)+"` supplied to `"+t+"`, expected a single ReactElement type.")})),instanceOf:function(e){return c((function(r,t,o,a,c){if(!(r[t]instanceof e)){var s=e.name||n;return new i("Invalid "+a+" `"+c+"` of type `"+((u=r[t]).constructor&&u.constructor.name?u.constructor.name:n)+"` supplied to `"+o+"`, expected instance of `"+s+"`.")}var u;return null}))},node:c((function(e,r,t,n,o){return u(e[r])?null:new i("Invalid "+n+" `"+o+"` supplied to `"+t+"`, expected a ReactNode.")})),objectOf:function(e){return c((function(r,t,n,o,a){if("function"!=typeof e)return new i("Property `"+a+"` of component `"+n+"` has invalid PropType notation inside objectOf.");var c=r[t],s=f(c);if("object"!==s)return new i("Invalid "+o+" `"+a+"` of type `"+s+"` supplied to `"+n+"`, expected an object.");for(var u in c)if(B(c,u)){var l=e(c,u,n,o,a+"."+u,z);if(l instanceof Error)return l}return null}))},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&U(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),Y;function r(r,t,n,o,c){for(var s=r[t],u=0;u<e.length;u++)if(a(s,e[u]))return null;var f=JSON.stringify(e,(function(e,r){return"symbol"===l(r)?String(r):r}));return new i("Invalid "+o+" `"+c+"` of value `"+String(s)+"` supplied to `"+n+"`, expected one of "+f+".")}return c(r)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&U("Invalid argument supplied to oneOfType, expected an instance of array."),Y;for(var r=0;r<e.length;r++){var t=e[r];if("function"!=typeof t)return U("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(t)+" at index "+r+"."),Y}return c((function(r,t,n,o,a){for(var c=0;c<e.length;c++)if(null==(0,e[c])(r,t,n,o,a,z))return null;return new i("Invalid "+o+" `"+a+"` supplied to `"+n+"`.")}))},shape:function(e){return c((function(r,t,n,o,a){var c=r[t],s=f(c);if("object"!==s)return new i("Invalid "+o+" `"+a+"` of type `"+s+"` supplied to `"+n+"`, expected `object`.");for(var u in e){var l=e[u];if(l){var p=l(c,u,n,o,a+"."+u,z);if(p)return p}}return null}))},exact:function(e){return c((function(r,t,n,o,a){var c=r[t],s=f(c);if("object"!==s)return new i("Invalid "+o+" `"+a+"` of type `"+s+"` supplied to `"+n+"`, expected `object`.");var u=q({},r[t],e);for(var l in u){var p=e[l];if(!p)return new i("Invalid "+o+" `"+a+"` key `"+l+"` supplied to `"+n+"`.\nBad object: "+JSON.stringify(r[t],null,"  ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null,"  "));var d=p(c,l,n,o,a+"."+l,z);if(d)return d}return null}))}};function a(e,r){return e===r?0!==e||1/e==1/r:e!=e&&r!=r}function i(e){this.message=e,this.stack=""}function c(e){if("production"!==process.env.NODE_ENV)var t={},o=0;function a(a,c,s,u,f,l,p){if(u=u||n,l=l||s,p!==z){if(r){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var y=u+":"+s;!t[y]&&o<3&&(U("You are manually calling a React.PropTypes validation function for the `"+l+"` prop on `"+u+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),t[y]=!0,o++)}}return null==c[s]?a?null===c[s]?new i("The "+f+" `"+l+"` is marked as required in `"+u+"`, but its value is `null`."):new i("The "+f+" `"+l+"` is marked as required in `"+u+"`, but its value is `undefined`."):null:e(c,s,u,f,l)}var c=a.bind(null,!1);return c.isRequired=a.bind(null,!0),c}function s(e){return c((function(r,t,n,o,a,c){var s=r[t];return f(s)!==e?new i("Invalid "+o+" `"+a+"` of type `"+l(s)+"` supplied to `"+n+"`, expected `"+e+"`."):null}))}function u(r){switch(typeof r){case"number":case"string":case"undefined":return!0;case"boolean":return!r;case"object":if(Array.isArray(r))return r.every(u);if(null===r||e(r))return!0;var n=function(e){var r=e&&(t&&e[t]||e["@@iterator"]);if("function"==typeof r)return r}(r);if(!n)return!1;var o,a=n.call(r);if(n!==r.entries){for(;!(o=a.next()).done;)if(!u(o.value))return!1}else for(;!(o=a.next()).done;){var i=o.value;if(i&&!u(i[1]))return!1}return!0;default:return!1}}function f(e){var r=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,r){return"symbol"===e||!!r&&("Symbol"===r["@@toStringTag"]||"function"==typeof Symbol&&r instanceof Symbol)}(r,e)?"symbol":r}function l(e){if(null==e)return""+e;var r=f(e);if("object"===r){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return r}function p(e){var r=l(e);switch(r){case"array":case"object":return"an "+r;case"boolean":case"date":case"regexp":return"a "+r;default:return r}}return i.prototype=Error.prototype,o.checkPropTypes=W,o.resetWarningCache=W.resetWarningCache,o.PropTypes=o,o}(H.isElement,!0)}else n.exports=function(){function e(e,r,t,n,o,a){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==a){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function r(){return e}e.isRequired=e;var t={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:r,element:e,elementType:e,instanceOf:r,node:e,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r,checkPropTypes:J,resetWarningCache:G};return t.PropTypes=t,t}();var K=n.exports;!function(e,r){void 0===r&&(r={});var t=r.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===t&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".loader{border:6px solid #3498db;border-top-color:#f3f3f3;border-radius:50%;width:24px;height:24px;-webkit-animation:spin 2s linear infinite;animation:spin 2s linear infinite}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.cta,.payment{display:flex;justify-content:space-between;align-items:center}.orText{font-size:16px;font-weight:600;letter-spacing:0;line-height:22px;margin-right:1em}");const Q=[];function X(r){const n=e.useRef(null),[o,a]=e.useState({loaded:!1,error:!1}),[i]=e.useState({src:r.src||"https://mypaga.com/checkout/?w=160&h=40",charge_url:r.charge_url||"https://mymarket/payment/complete",redirect_url_method:r.redirect_url_method||"GET",public_key:r.public_key||"",currency:r.currency||"NGN",amount:r.amount||"",payment_reference:r.payment_reference||"",account_number:r.account_number||"",product_description:r.product_description||"",phone_number:r.phone_number||"",email:r.email||"",product_codes:r.product_codes||"",display_image:r.display_image||"",display_name:r.display_name||"",display_tagline:r.display_tagline||"",button_label:r.button_label||"",width:r.width||"200",funding_sources:r.funding_sources||"BANK,CARD,PAGA",error_message:r.error_message||"sorry we are unable to load paga checkout at the moment please try again."});return e.useEffect((()=>{if(!Q.includes(i.src)){Q.push(i.src);const e=document.createElement("script");e.src=i.src;Object.keys(i).forEach(((r,t)=>{e.setAttribute(`data-${r}`,i[r])})),e.async=!0,n.current.appendChild(e);const r=()=>{a({loaded:!0,error:!1})},t=()=>{const r=Q.indexOf(i.src);r>=0&&Q.splice(r,1),e.remove(),a({loaded:!0,error:!0})};return e.addEventListener("load",r),e.addEventListener("complete",r),e.addEventListener("error",t),()=>{n.current.removeChild(e),e.removeEventListener("load",r),e.removeEventListener("error",t)}}a({loaded:!0,error:!1})}),[i.src]),o.error?i.error_message:t.default.createElement("span",null,o.loaded?null:t.default.createElement("div",{className:"loader"}),t.default.createElement("div",{className:i.class},t.default.createElement("form",{method:"POST",ref:n})))}X.propTypes={charge_url:K.string,redirect_url_method:K.string,public_key:K.string.isRequired,currency:K.string,amount:K.string.isRequired,payment_reference:K.string,account_number:K.string,product_description:K.string,phone_number:K.string,email:K.string,product_codes:K.string,display_image:K.string,display_name:K.string,display_tagline:K.string,button_label:K.string,width:K.string,funding_sources:K.string,error_message:K.string},module.exports=X;
