@a-tech.jo/atech_payment 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -5
- package/build/index.js +2 -0
- package/build/index.js.LICENSE.txt +28 -0
- package/package.json +1 -1
- package/src/hyperpay/hyperpayOrder.js +0 -99
- package/src/paypal/buttonWrapper.js +0 -76
- package/src/paypal/paypalOrder.js +0 -32
- package/src/shared/config.js +0 -12
- package/src/shared/paypalService.js +0 -16
- package/src/shared/requests/backendConnector.js +0 -24
- package/src/shared/requests/hyperpayConnector.js +0 -59
- package/src/shared/requests/request.js +0 -90
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @a-tech.jo/atech_payment
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
This Package is the frontend interface to integrate with A-Tech payment project, its used a plug and play to be used without huge effort to embed payment providers in Next js projects
|
|
4
4
|
|
|
5
5
|
## Steps for Usage
|
|
6
6
|
|
|
@@ -11,10 +11,16 @@ A React component that integrates PayPal payments into your application.
|
|
|
11
11
|
To test the package locally:
|
|
12
12
|
|
|
13
13
|
- First, link the package by running `npm link` in the package directory.
|
|
14
|
-
- Then, in the app where you want to use the package, link it using `npm link
|
|
15
|
-
- Last, make sure `
|
|
14
|
+
- Then, in the app where you want to use the package, link it using `npm link @a-tech.jo/atech_payment`.
|
|
15
|
+
- Last, make sure `backend` is running at port 5000.
|
|
16
16
|
|
|
17
17
|
3. **Publishing**
|
|
18
18
|
When ready to share the package, publish it by running `npm publish`.
|
|
19
19
|
After publishing, it can be installed in any app using:
|
|
20
|
-
`npm
|
|
20
|
+
`npm run publish`
|
|
21
|
+
|
|
22
|
+
4. **Add to your project**
|
|
23
|
+
1. Open next.config.js
|
|
24
|
+
2. Add the package to transpilePackages key as below:
|
|
25
|
+
transpilePackages: [ "@a-tech.jo/atech_payment"]
|
|
26
|
+
3. use the package
|
package/build/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
+
(()=>{"use strict";var t={287:(t,e)=>{var r=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.iterator,d={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,m={};function v(t,e,r){this.props=t,this.context=e,this.refs=m,this.updater=r||d}function g(){}function b(t,e,r){this.props=t,this.context=e,this.refs=m,this.updater=r||d}v.prototype.isReactComponent={},v.prototype.setState=function(t,e){if("object"!=typeof t&&"function"!=typeof t&&null!=t)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")},v.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")},g.prototype=v.prototype;var w=b.prototype=new g;w.constructor=b,y(w,v.prototype),w.isPureReactComponent=!0;var E=Array.isArray,O=Object.prototype.hasOwnProperty,S={current:null},R={key:!0,ref:!0,__self:!0,__source:!0};function x(t,e,n){var o,i={},a=null,s=null;if(null!=e)for(o in void 0!==e.ref&&(s=e.ref),void 0!==e.key&&(a=""+e.key),e)O.call(e,o)&&!R.hasOwnProperty(o)&&(i[o]=e[o]);var c=arguments.length-2;if(1===c)i.children=n;else if(1<c){for(var u=Array(c),l=0;l<c;l++)u[l]=arguments[l+2];i.children=u}if(t&&t.defaultProps)for(o in c=t.defaultProps)void 0===i[o]&&(i[o]=c[o]);return{$$typeof:r,type:t,key:a,ref:s,props:i,_owner:S.current}}function P(t){return"object"==typeof t&&null!==t&&t.$$typeof===r}var _=/\/+/g;function j(t,e){return"object"==typeof t&&null!==t&&null!=t.key?function(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,(function(t){return e[t]}))}(""+t.key):e.toString(36)}function L(t,e,o,i,a){var s=typeof t;"undefined"!==s&&"boolean"!==s||(t=null);var c=!1;if(null===t)c=!0;else switch(s){case"string":case"number":c=!0;break;case"object":switch(t.$$typeof){case r:case n:c=!0}}if(c)return a=a(c=t),t=""===i?"."+j(c,0):i,E(a)?(o="",null!=t&&(o=t.replace(_,"$&/")+"/"),L(a,e,o,"",(function(t){return t}))):null!=a&&(P(a)&&(a=function(t,e){return{$$typeof:r,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}(a,o+(!a.key||c&&c.key===a.key?"":(""+a.key).replace(_,"$&/")+"/")+t)),e.push(a)),1;if(c=0,i=""===i?".":i+":",E(t))for(var u=0;u<t.length;u++){var l=i+j(s=t[u],u);c+=L(s,e,o,l,a)}else if(l=function(t){return null===t||"object"!=typeof t?null:"function"==typeof(t=h&&t[h]||t["@@iterator"])?t:null}(t),"function"==typeof l)for(t=l.call(t),u=0;!(s=t.next()).done;)c+=L(s=s.value,e,o,l=i+j(s,u++),a);else if("object"===s)throw e=String(t),Error("Objects are not valid as a React child (found: "+("[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return c}function T(t,e,r){if(null==t)return t;var n=[],o=0;return L(t,n,"","",(function(t){return e.call(r,t,o++)})),n}function N(t){if(-1===t._status){var e=t._result;(e=e()).then((function(e){0!==t._status&&-1!==t._status||(t._status=1,t._result=e)}),(function(e){0!==t._status&&-1!==t._status||(t._status=2,t._result=e)})),-1===t._status&&(t._status=0,t._result=e)}if(1===t._status)return t._result.default;throw t._result}var A={current:null},k={transition:null},C={ReactCurrentDispatcher:A,ReactCurrentBatchConfig:k,ReactCurrentOwner:S};e.Children={map:T,forEach:function(t,e,r){T(t,(function(){e.apply(this,arguments)}),r)},count:function(t){var e=0;return T(t,(function(){e++})),e},toArray:function(t){return T(t,(function(t){return t}))||[]},only:function(t){if(!P(t))throw Error("React.Children.only expected to receive a single React element child.");return t}},e.Component=v,e.Fragment=o,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=C,e.cloneElement=function(t,e,n){if(null==t)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var o=y({},t.props),i=t.key,a=t.ref,s=t._owner;if(null!=e){if(void 0!==e.ref&&(a=e.ref,s=S.current),void 0!==e.key&&(i=""+e.key),t.type&&t.type.defaultProps)var c=t.type.defaultProps;for(u in e)O.call(e,u)&&!R.hasOwnProperty(u)&&(o[u]=void 0===e[u]&&void 0!==c?c[u]:e[u])}var u=arguments.length-2;if(1===u)o.children=n;else if(1<u){c=Array(u);for(var l=0;l<u;l++)c[l]=arguments[l+2];o.children=c}return{$$typeof:r,type:t.type,key:i,ref:a,props:o,_owner:s}},e.createContext=function(t){return(t={$$typeof:c,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:s,_context:t},t.Consumer=t},e.createElement=x,e.createFactory=function(t){var e=x.bind(null,t);return e.type=t,e},e.createRef=function(){return{current:null}},e.forwardRef=function(t){return{$$typeof:u,render:t}},e.isValidElement=P,e.lazy=function(t){return{$$typeof:p,_payload:{_status:-1,_result:t},_init:N}},e.memo=function(t,e){return{$$typeof:f,type:t,compare:void 0===e?null:e}},e.startTransition=function(t){var e=k.transition;k.transition={};try{t()}finally{k.transition=e}},e.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},e.useCallback=function(t,e){return A.current.useCallback(t,e)},e.useContext=function(t){return A.current.useContext(t)},e.useDebugValue=function(){},e.useDeferredValue=function(t){return A.current.useDeferredValue(t)},e.useEffect=function(t,e){return A.current.useEffect(t,e)},e.useId=function(){return A.current.useId()},e.useImperativeHandle=function(t,e,r){return A.current.useImperativeHandle(t,e,r)},e.useInsertionEffect=function(t,e){return A.current.useInsertionEffect(t,e)},e.useLayoutEffect=function(t,e){return A.current.useLayoutEffect(t,e)},e.useMemo=function(t,e){return A.current.useMemo(t,e)},e.useReducer=function(t,e,r){return A.current.useReducer(t,e,r)},e.useRef=function(t){return A.current.useRef(t)},e.useState=function(t){return A.current.useState(t)},e.useSyncExternalStore=function(t,e,r){return A.current.useSyncExternalStore(t,e,r)},e.useTransition=function(){return A.current.useTransition()},e.version="18.2.0"},540:(t,e,r)=>{t.exports=r(287)}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t={};r.r(t),r.d(t,{hasBrowserEnv:()=>ht,hasStandardBrowserEnv:()=>yt,hasStandardBrowserWebWorkerEnv:()=>mt,navigator:()=>dt,origin:()=>vt});var e=r(540);const n={development:{BACKEND_BASE_URL:"http://localhost:5000/api",HYPERPAY_BASE_URL:"https://eu-test.oppwa.com/"},production:{BACKEND_BASE_URL:"http://prod:5000/api",HYPERPAY_BASE_URL:"https://eu-prod.oppwa.com/"}};function o(t,e){return function(){return t.apply(e,arguments)}}const{toString:i}=Object.prototype,{getPrototypeOf:a}=Object,s=(c=Object.create(null),t=>{const e=i.call(t);return c[e]||(c[e]=e.slice(8,-1).toLowerCase())});var c;const u=t=>(t=t.toLowerCase(),e=>s(e)===t),l=t=>e=>typeof e===t,{isArray:f}=Array,p=l("undefined"),h=u("ArrayBuffer"),d=l("string"),y=l("function"),m=l("number"),v=t=>null!==t&&"object"==typeof t,g=t=>{if("object"!==s(t))return!1;const e=a(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||Symbol.toStringTag in t||Symbol.iterator in t)},b=u("Date"),w=u("File"),E=u("Blob"),O=u("FileList"),S=u("URLSearchParams"),[R,x,P,_]=["ReadableStream","Request","Response","Headers"].map(u);function j(t,e,{allOwnKeys:r=!1}={}){if(null==t)return;let n,o;if("object"!=typeof t&&(t=[t]),f(t))for(n=0,o=t.length;n<o;n++)e.call(null,t[n],n,t);else{const o=r?Object.getOwnPropertyNames(t):Object.keys(t),i=o.length;let a;for(n=0;n<i;n++)a=o[n],e.call(null,t[a],a,t)}}function L(t,e){e=e.toLowerCase();const r=Object.keys(t);let n,o=r.length;for(;o-- >0;)if(n=r[o],e===n.toLowerCase())return n;return null}const T="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,N=t=>!p(t)&&t!==T,A=(k="undefined"!=typeof Uint8Array&&a(Uint8Array),t=>k&&t instanceof k);var k;const C=u("HTMLFormElement"),F=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),D=u("RegExp"),B=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};j(r,((r,o)=>{let i;!1!==(i=e(r,o,t))&&(n[o]=i||r)})),Object.defineProperties(t,n)},U="abcdefghijklmnopqrstuvwxyz",I="0123456789",q={DIGIT:I,ALPHA:U,ALPHA_DIGIT:U+U.toUpperCase()+I},M=u("AsyncFunction"),H=(G="function"==typeof setImmediate,$=y(T.postMessage),G?setImmediate:$?(z=`axios@${Math.random()}`,V=[],T.addEventListener("message",(({source:t,data:e})=>{t===T&&e===z&&V.length&&V.shift()()}),!1),t=>{V.push(t),T.postMessage(z,"*")}):t=>setTimeout(t));var G,$,z,V;const K="undefined"!=typeof queueMicrotask?queueMicrotask.bind(T):"undefined"!=typeof process&&process.nextTick||H,J={isArray:f,isArrayBuffer:h,isBuffer:function(t){return null!==t&&!p(t)&&null!==t.constructor&&!p(t.constructor)&&y(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||y(t.append)&&("formdata"===(e=s(t))||"object"===e&&y(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&h(t.buffer),e},isString:d,isNumber:m,isBoolean:t=>!0===t||!1===t,isObject:v,isPlainObject:g,isReadableStream:R,isRequest:x,isResponse:P,isHeaders:_,isUndefined:p,isDate:b,isFile:w,isBlob:E,isRegExp:D,isFunction:y,isStream:t=>v(t)&&y(t.pipe),isURLSearchParams:S,isTypedArray:A,isFileList:O,forEach:j,merge:function t(){const{caseless:e}=N(this)&&this||{},r={},n=(n,o)=>{const i=e&&L(r,o)||o;g(r[i])&&g(n)?r[i]=t(r[i],n):g(n)?r[i]=t({},n):f(n)?r[i]=n.slice():r[i]=n};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&j(arguments[t],n);return r},extend:(t,e,r,{allOwnKeys:n}={})=>(j(e,((e,n)=>{r&&y(e)?t[n]=o(e,r):t[n]=e}),{allOwnKeys:n}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},toFlatObject:(t,e,r,n)=>{let o,i,s;const c={};if(e=e||{},null==t)return e;do{for(o=Object.getOwnPropertyNames(t),i=o.length;i-- >0;)s=o[i],n&&!n(s,t,e)||c[s]||(e[s]=t[s],c[s]=!0);t=!1!==r&&a(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},kindOf:s,kindOfTest:u,endsWith:(t,e,r)=>{t=String(t),(void 0===r||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return-1!==n&&n===r},toArray:t=>{if(!t)return null;if(f(t))return t;let e=t.length;if(!m(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},forEachEntry:(t,e)=>{const r=(t&&t[Symbol.iterator]).call(t);let n;for(;(n=r.next())&&!n.done;){const r=n.value;e.call(t,r[0],r[1])}},matchAll:(t,e)=>{let r;const n=[];for(;null!==(r=t.exec(e));)n.push(r);return n},isHTMLForm:C,hasOwnProperty:F,hasOwnProp:F,reduceDescriptors:B,freezeMethods:t=>{B(t,((e,r)=>{if(y(t)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=t[r];y(n)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(t,e)=>{const r={},n=t=>{t.forEach((t=>{r[t]=!0}))};return f(t)?n(t):n(String(t).split(e)),r},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(t,e,r){return e.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(t,e)=>null!=t&&Number.isFinite(t=+t)?t:e,findKey:L,global:T,isContextDefined:N,ALPHABET:q,generateString:(t=16,e=q.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r},isSpecCompliantForm:function(t){return!!(t&&y(t.append)&&"FormData"===t[Symbol.toStringTag]&&t[Symbol.iterator])},toJSONObject:t=>{const e=new Array(10),r=(t,n)=>{if(v(t)){if(e.indexOf(t)>=0)return;if(!("toJSON"in t)){e[n]=t;const o=f(t)?[]:{};return j(t,((t,e)=>{const i=r(t,n+1);!p(i)&&(o[e]=i)})),e[n]=void 0,o}}return t};return r(t,0)},isAsyncFn:M,isThenable:t=>t&&(v(t)||y(t))&&y(t.then)&&y(t.catch),setImmediate:H,asap:K};function W(t,e,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o,this.status=o.status?o.status:null)}J.inherits(W,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:J.toJSONObject(this.config),code:this.code,status:this.status}}});const Y=W.prototype,X={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((t=>{X[t]={value:t}})),Object.defineProperties(W,X),Object.defineProperty(Y,"isAxiosError",{value:!0}),W.from=(t,e,r,n,o,i)=>{const a=Object.create(Y);return J.toFlatObject(t,a,(function(t){return t!==Error.prototype}),(t=>"isAxiosError"!==t)),W.call(a,t.message,e,r,n,o),a.cause=t,a.name=t.name,i&&Object.assign(a,i),a};const Q=W;function Z(t){return J.isPlainObject(t)||J.isArray(t)}function tt(t){return J.endsWith(t,"[]")?t.slice(0,-2):t}function et(t,e,r){return t?t.concat(e).map((function(t,e){return t=tt(t),!r&&e?"["+t+"]":t})).join(r?".":""):e}const rt=J.toFlatObject(J,{},null,(function(t){return/^is[A-Z]/.test(t)})),nt=function(t,e,r){if(!J.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const n=(r=J.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!J.isUndefined(e[t])}))).metaTokens,o=r.visitor||u,i=r.dots,a=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&J.isSpecCompliantForm(e);if(!J.isFunction(o))throw new TypeError("visitor must be a function");function c(t){if(null===t)return"";if(J.isDate(t))return t.toISOString();if(!s&&J.isBlob(t))throw new Q("Blob is not supported. Use a Buffer instead.");return J.isArrayBuffer(t)||J.isTypedArray(t)?s&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function u(t,r,o){let s=t;if(t&&!o&&"object"==typeof t)if(J.endsWith(r,"{}"))r=n?r:r.slice(0,-2),t=JSON.stringify(t);else if(J.isArray(t)&&function(t){return J.isArray(t)&&!t.some(Z)}(t)||(J.isFileList(t)||J.endsWith(r,"[]"))&&(s=J.toArray(t)))return r=tt(r),s.forEach((function(t,n){!J.isUndefined(t)&&null!==t&&e.append(!0===a?et([r],n,i):null===a?r:r+"[]",c(t))})),!1;return!!Z(t)||(e.append(et(o,r,i),c(t)),!1)}const l=[],f=Object.assign(rt,{defaultVisitor:u,convertValue:c,isVisitable:Z});if(!J.isObject(t))throw new TypeError("data must be an object");return function t(r,n){if(!J.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+n.join("."));l.push(r),J.forEach(r,(function(r,i){!0===(!(J.isUndefined(r)||null===r)&&o.call(e,r,J.isString(i)?i.trim():i,n,f))&&t(r,n?n.concat(i):[i])})),l.pop()}}(t),e};function ot(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,(function(t){return e[t]}))}function it(t,e){this._pairs=[],t&&nt(t,this,e)}const at=it.prototype;at.append=function(t,e){this._pairs.push([t,e])},at.toString=function(t){const e=t?function(e){return t.call(this,e,ot)}:ot;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")};const st=it;function ct(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ut(t,e,r){if(!e)return t;const n=r&&r.encode||ct,o=r&&r.serialize;let i;if(i=o?o(e,r):J.isURLSearchParams(e)?e.toString():new st(e,r).toString(n),i){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+i}return t}const lt=class{constructor(){this.handlers=[]}use(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){J.forEach(this.handlers,(function(e){null!==e&&t(e)}))}},ft={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},pt={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:st,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},ht="undefined"!=typeof window&&"undefined"!=typeof document,dt="object"==typeof navigator&&navigator||void 0,yt=ht&&(!dt||["ReactNative","NativeScript","NS"].indexOf(dt.product)<0),mt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,vt=ht&&window.location.href||"http://localhost",gt={...t,...pt},bt=function(t){function e(t,r,n,o){let i=t[o++];if("__proto__"===i)return!0;const a=Number.isFinite(+i),s=o>=t.length;return i=!i&&J.isArray(n)?n.length:i,s?(J.hasOwnProp(n,i)?n[i]=[n[i],r]:n[i]=r,!a):(n[i]&&J.isObject(n[i])||(n[i]=[]),e(t,r,n[i],o)&&J.isArray(n[i])&&(n[i]=function(t){const e={},r=Object.keys(t);let n;const o=r.length;let i;for(n=0;n<o;n++)i=r[n],e[i]=t[i];return e}(n[i])),!a)}if(J.isFormData(t)&&J.isFunction(t.entries)){const r={};return J.forEachEntry(t,((t,n)=>{e(function(t){return J.matchAll(/\w+|\[(\w*)]/g,t).map((t=>"[]"===t[0]?"":t[1]||t[0]))}(t),n,r,0)})),r}return null},wt={transitional:ft,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const r=e.getContentType()||"",n=r.indexOf("application/json")>-1,o=J.isObject(t);if(o&&J.isHTMLForm(t)&&(t=new FormData(t)),J.isFormData(t))return n?JSON.stringify(bt(t)):t;if(J.isArrayBuffer(t)||J.isBuffer(t)||J.isStream(t)||J.isFile(t)||J.isBlob(t)||J.isReadableStream(t))return t;if(J.isArrayBufferView(t))return t.buffer;if(J.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let i;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return nt(t,new gt.classes.URLSearchParams,Object.assign({visitor:function(t,e,r,n){return gt.isNode&&J.isBuffer(t)?(this.append(e,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},e))}(t,this.formSerializer).toString();if((i=J.isFileList(t))||r.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return nt(i?{"files[]":t}:t,e&&new e,this.formSerializer)}}return o||n?(e.setContentType("application/json",!1),function(t,e,r){if(J.isString(t))try{return(0,JSON.parse)(t),J.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(0,JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||wt.transitional,r=e&&e.forcedJSONParsing,n="json"===this.responseType;if(J.isResponse(t)||J.isReadableStream(t))return t;if(t&&J.isString(t)&&(r&&!this.responseType||n)){const r=!(e&&e.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(t){if(r){if("SyntaxError"===t.name)throw Q.from(t,Q.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:gt.classes.FormData,Blob:gt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};J.forEach(["delete","get","head","post","put","patch"],(t=>{wt.headers[t]={}}));const Et=wt,Ot=J.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),St=Symbol("internals");function Rt(t){return t&&String(t).trim().toLowerCase()}function xt(t){return!1===t||null==t?t:J.isArray(t)?t.map(xt):String(t)}function Pt(t,e,r,n,o){return J.isFunction(n)?n.call(this,e,r):(o&&(e=r),J.isString(e)?J.isString(n)?-1!==e.indexOf(n):J.isRegExp(n)?n.test(e):void 0:void 0)}class _t{constructor(t){t&&this.set(t)}set(t,e,r){const n=this;function o(t,e,r){const o=Rt(e);if(!o)throw new Error("header name must be a non-empty string");const i=J.findKey(n,o);(!i||void 0===n[i]||!0===r||void 0===r&&!1!==n[i])&&(n[i||e]=xt(t))}const i=(t,e)=>J.forEach(t,((t,r)=>o(t,r,e)));if(J.isPlainObject(t)||t instanceof this.constructor)i(t,e);else if(J.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()))i((t=>{const e={};let r,n,o;return t&&t.split("\n").forEach((function(t){o=t.indexOf(":"),r=t.substring(0,o).trim().toLowerCase(),n=t.substring(o+1).trim(),!r||e[r]&&Ot[r]||("set-cookie"===r?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)})),e})(t),e);else if(J.isHeaders(t))for(const[e,n]of t.entries())o(n,e,r);else null!=t&&o(e,t,r);return this}get(t,e){if(t=Rt(t)){const r=J.findKey(this,t);if(r){const t=this[r];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}(t);if(J.isFunction(e))return e.call(this,t,r);if(J.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=Rt(t)){const r=J.findKey(this,t);return!(!r||void 0===this[r]||e&&!Pt(0,this[r],r,e))}return!1}delete(t,e){const r=this;let n=!1;function o(t){if(t=Rt(t)){const o=J.findKey(r,t);!o||e&&!Pt(0,r[o],o,e)||(delete r[o],n=!0)}}return J.isArray(t)?t.forEach(o):o(t),n}clear(t){const e=Object.keys(this);let r=e.length,n=!1;for(;r--;){const o=e[r];t&&!Pt(0,this[o],o,t,!0)||(delete this[o],n=!0)}return n}normalize(t){const e=this,r={};return J.forEach(this,((n,o)=>{const i=J.findKey(r,o);if(i)return e[i]=xt(n),void delete e[o];const a=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((t,e,r)=>e.toUpperCase()+r))}(o):String(o).trim();a!==o&&delete e[o],e[a]=xt(n),r[a]=!0})),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return J.forEach(this,((r,n)=>{null!=r&&!1!==r&&(e[n]=t&&J.isArray(r)?r.join(", "):r)})),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([t,e])=>t+": "+e)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const r=new this(t);return e.forEach((t=>r.set(t))),r}static accessor(t){const e=(this[St]=this[St]={accessors:{}}).accessors,r=this.prototype;function n(t){const n=Rt(t);e[n]||(function(t,e){const r=J.toCamelCase(" "+e);["get","set","has"].forEach((n=>{Object.defineProperty(t,n+r,{value:function(t,r,o){return this[n].call(this,e,t,r,o)},configurable:!0})}))}(r,t),e[n]=!0)}return J.isArray(t)?t.forEach(n):n(t),this}}_t.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),J.reduceDescriptors(_t.prototype,(({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[r]=t}}})),J.freezeMethods(_t);const jt=_t;function Lt(t,e){const r=this||Et,n=e||r,o=jt.from(n.headers);let i=n.data;return J.forEach(t,(function(t){i=t.call(r,i,o.normalize(),e?e.status:void 0)})),o.normalize(),i}function Tt(t){return!(!t||!t.__CANCEL__)}function Nt(t,e,r){Q.call(this,null==t?"canceled":t,Q.ERR_CANCELED,e,r),this.name="CanceledError"}J.inherits(Nt,Q,{__CANCEL__:!0});const At=Nt;function kt(t,e,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?e(new Q("Request failed with status code "+r.status,[Q.ERR_BAD_REQUEST,Q.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):t(r)}const Ct=(t,e,r=3)=>{let n=0;const o=function(t,e){t=t||10;const r=new Array(t),n=new Array(t);let o,i=0,a=0;return e=void 0!==e?e:1e3,function(s){const c=Date.now(),u=n[a];o||(o=c),r[i]=s,n[i]=c;let l=a,f=0;for(;l!==i;)f+=r[l++],l%=t;if(i=(i+1)%t,i===a&&(a=(a+1)%t),c-o<e)return;const p=u&&c-u;return p?Math.round(1e3*f/p):void 0}}(50,250);return function(t,e){let r,n,o=0,i=1e3/e;const a=(e,i=Date.now())=>{o=i,r=null,n&&(clearTimeout(n),n=null),t.apply(null,e)};return[(...t)=>{const e=Date.now(),s=e-o;s>=i?a(t,e):(r=t,n||(n=setTimeout((()=>{n=null,a(r)}),i-s)))},()=>r&&a(r)]}((r=>{const i=r.loaded,a=r.lengthComputable?r.total:void 0,s=i-n,c=o(s);n=i,t({loaded:i,total:a,progress:a?i/a:void 0,bytes:s,rate:c||void 0,estimated:c&&a&&i<=a?(a-i)/c:void 0,event:r,lengthComputable:null!=a,[e?"download":"upload"]:!0})}),r)},Ft=(t,e)=>{const r=null!=t;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},Dt=t=>(...e)=>J.asap((()=>t(...e))),Bt=gt.hasStandardBrowserEnv?function(){const t=gt.navigator&&/(msie|trident)/i.test(gt.navigator.userAgent),e=document.createElement("a");let r;function n(r){let n=r;return t&&(e.setAttribute("href",n),n=e.href),e.setAttribute("href",n),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:"/"===e.pathname.charAt(0)?e.pathname:"/"+e.pathname}}return r=n(window.location.href),function(t){const e=J.isString(t)?n(t):t;return e.protocol===r.protocol&&e.host===r.host}}():function(){return!0},Ut=gt.hasStandardBrowserEnv?{write(t,e,r,n,o,i){const a=[t+"="+encodeURIComponent(e)];J.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),J.isString(n)&&a.push("path="+n),J.isString(o)&&a.push("domain="+o),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function It(t,e){return t&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)?function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}const qt=t=>t instanceof jt?{...t}:t;function Mt(t,e){e=e||{};const r={};function n(t,e,r){return J.isPlainObject(t)&&J.isPlainObject(e)?J.merge.call({caseless:r},t,e):J.isPlainObject(e)?J.merge({},e):J.isArray(e)?e.slice():e}function o(t,e,r){return J.isUndefined(e)?J.isUndefined(t)?void 0:n(void 0,t,r):n(t,e,r)}function i(t,e){if(!J.isUndefined(e))return n(void 0,e)}function a(t,e){return J.isUndefined(e)?J.isUndefined(t)?void 0:n(void 0,t):n(void 0,e)}function s(r,o,i){return i in e?n(r,o):i in t?n(void 0,r):void 0}const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:(t,e)=>o(qt(t),qt(e),!0)};return J.forEach(Object.keys(Object.assign({},t,e)),(function(n){const i=c[n]||o,a=i(t[n],e[n],n);J.isUndefined(a)&&i!==s||(r[n]=a)})),r}const Ht=t=>{const e=Mt({},t);let r,{data:n,withXSRFToken:o,xsrfHeaderName:i,xsrfCookieName:a,headers:s,auth:c}=e;if(e.headers=s=jt.from(s),e.url=ut(It(e.baseURL,e.url),t.params,t.paramsSerializer),c&&s.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),J.isFormData(n))if(gt.hasStandardBrowserEnv||gt.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(!1!==(r=s.getContentType())){const[t,...e]=r?r.split(";").map((t=>t.trim())).filter(Boolean):[];s.setContentType([t||"multipart/form-data",...e].join("; "))}if(gt.hasStandardBrowserEnv&&(o&&J.isFunction(o)&&(o=o(e)),o||!1!==o&&Bt(e.url))){const t=i&&a&&Ut.read(a);t&&s.set(i,t)}return e},Gt="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise((function(e,r){const n=Ht(t);let o=n.data;const i=jt.from(n.headers).normalize();let a,s,c,u,l,{responseType:f,onUploadProgress:p,onDownloadProgress:h}=n;function d(){u&&u(),l&&l(),n.cancelToken&&n.cancelToken.unsubscribe(a),n.signal&&n.signal.removeEventListener("abort",a)}let y=new XMLHttpRequest;function m(){if(!y)return;const n=jt.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders());kt((function(t){e(t),d()}),(function(t){r(t),d()}),{data:f&&"text"!==f&&"json"!==f?y.response:y.responseText,status:y.status,statusText:y.statusText,headers:n,config:t,request:y}),y=null}y.open(n.method.toUpperCase(),n.url,!0),y.timeout=n.timeout,"onloadend"in y?y.onloadend=m:y.onreadystatechange=function(){y&&4===y.readyState&&(0!==y.status||y.responseURL&&0===y.responseURL.indexOf("file:"))&&setTimeout(m)},y.onabort=function(){y&&(r(new Q("Request aborted",Q.ECONNABORTED,t,y)),y=null)},y.onerror=function(){r(new Q("Network Error",Q.ERR_NETWORK,t,y)),y=null},y.ontimeout=function(){let e=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const o=n.transitional||ft;n.timeoutErrorMessage&&(e=n.timeoutErrorMessage),r(new Q(e,o.clarifyTimeoutError?Q.ETIMEDOUT:Q.ECONNABORTED,t,y)),y=null},void 0===o&&i.setContentType(null),"setRequestHeader"in y&&J.forEach(i.toJSON(),(function(t,e){y.setRequestHeader(e,t)})),J.isUndefined(n.withCredentials)||(y.withCredentials=!!n.withCredentials),f&&"json"!==f&&(y.responseType=n.responseType),h&&([c,l]=Ct(h,!0),y.addEventListener("progress",c)),p&&y.upload&&([s,u]=Ct(p),y.upload.addEventListener("progress",s),y.upload.addEventListener("loadend",u)),(n.cancelToken||n.signal)&&(a=e=>{y&&(r(!e||e.type?new At(null,t,y):e),y.abort(),y=null)},n.cancelToken&&n.cancelToken.subscribe(a),n.signal&&(n.signal.aborted?a():n.signal.addEventListener("abort",a)));const v=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(n.url);v&&-1===gt.protocols.indexOf(v)?r(new Q("Unsupported protocol "+v+":",Q.ERR_BAD_REQUEST,t)):y.send(o||null)}))},$t=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let r,n=new AbortController;const o=function(t){if(!r){r=!0,a();const e=t instanceof Error?t:this.reason;n.abort(e instanceof Q?e:new At(e instanceof Error?e.message:e))}};let i=e&&setTimeout((()=>{i=null,o(new Q(`timeout ${e} of ms exceeded`,Q.ETIMEDOUT))}),e);const a=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach((t=>{t.unsubscribe?t.unsubscribe(o):t.removeEventListener("abort",o)})),t=null)};t.forEach((t=>t.addEventListener("abort",o)));const{signal:s}=n;return s.unsubscribe=()=>J.asap(a),s}},zt=function*(t,e){let r=t.byteLength;if(!e||r<e)return void(yield t);let n,o=0;for(;o<r;)n=o+e,yield t.slice(o,n),o=n},Vt=(t,e,r,n)=>{const o=async function*(t,e){for await(const r of async function*(t){if(t[Symbol.asyncIterator])return void(yield*t);const e=t.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)break;yield r}}finally{await e.cancel()}}(t))yield*zt(r,e)}(t,e);let i,a=0,s=t=>{i||(i=!0,n&&n(t))};return new ReadableStream({async pull(t){try{const{done:e,value:n}=await o.next();if(e)return s(),void t.close();let i=n.byteLength;if(r){let t=a+=i;r(t)}t.enqueue(new Uint8Array(n))}catch(t){throw s(t),t}},cancel:t=>(s(t),o.return())},{highWaterMark:2})},Kt="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Jt=Kt&&"function"==typeof ReadableStream,Wt=Kt&&("function"==typeof TextEncoder?(Yt=new TextEncoder,t=>Yt.encode(t)):async t=>new Uint8Array(await new Response(t).arrayBuffer()));var Yt;const Xt=(t,...e)=>{try{return!!t(...e)}catch(t){return!1}},Qt=Jt&&Xt((()=>{let t=!1;const e=new Request(gt.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e})),Zt=Jt&&Xt((()=>J.isReadableStream(new Response("").body))),te={stream:Zt&&(t=>t.body)};var ee;Kt&&(ee=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((t=>{!te[t]&&(te[t]=J.isFunction(ee[t])?e=>e[t]():(e,r)=>{throw new Q(`Response type '${t}' is not supported`,Q.ERR_NOT_SUPPORT,r)})})));const re=Kt&&(async t=>{let{url:e,method:r,data:n,signal:o,cancelToken:i,timeout:a,onDownloadProgress:s,onUploadProgress:c,responseType:u,headers:l,withCredentials:f="same-origin",fetchOptions:p}=Ht(t);u=u?(u+"").toLowerCase():"text";let h,d=$t([o,i&&i.toAbortSignal()],a);const y=d&&d.unsubscribe&&(()=>{d.unsubscribe()});let m;try{if(c&&Qt&&"get"!==r&&"head"!==r&&0!==(m=await(async(t,e)=>{const r=J.toFiniteNumber(t.getContentLength());return null==r?(async t=>{if(null==t)return 0;if(J.isBlob(t))return t.size;if(J.isSpecCompliantForm(t)){const e=new Request(gt.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}return J.isArrayBufferView(t)||J.isArrayBuffer(t)?t.byteLength:(J.isURLSearchParams(t)&&(t+=""),J.isString(t)?(await Wt(t)).byteLength:void 0)})(e):r})(l,n))){let t,r=new Request(e,{method:"POST",body:n,duplex:"half"});if(J.isFormData(n)&&(t=r.headers.get("content-type"))&&l.setContentType(t),r.body){const[t,e]=Ft(m,Ct(Dt(c)));n=Vt(r.body,65536,t,e)}}J.isString(f)||(f=f?"include":"omit");const o="credentials"in Request.prototype;h=new Request(e,{...p,signal:d,method:r.toUpperCase(),headers:l.normalize().toJSON(),body:n,duplex:"half",credentials:o?f:void 0});let i=await fetch(h);const a=Zt&&("stream"===u||"response"===u);if(Zt&&(s||a&&y)){const t={};["status","statusText","headers"].forEach((e=>{t[e]=i[e]}));const e=J.toFiniteNumber(i.headers.get("content-length")),[r,n]=s&&Ft(e,Ct(Dt(s),!0))||[];i=new Response(Vt(i.body,65536,r,(()=>{n&&n(),y&&y()})),t)}u=u||"text";let v=await te[J.findKey(te,u)||"text"](i,t);return!a&&y&&y(),await new Promise(((e,r)=>{kt(e,r,{data:v,headers:jt.from(i.headers),status:i.status,statusText:i.statusText,config:t,request:h})}))}catch(e){if(y&&y(),e&&"TypeError"===e.name&&/fetch/i.test(e.message))throw Object.assign(new Q("Network Error",Q.ERR_NETWORK,t,h),{cause:e.cause||e});throw Q.from(e,e&&e.code,t,h)}}),ne={http:null,xhr:Gt,fetch:re};J.forEach(ne,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));const oe=t=>`- ${t}`,ie=t=>J.isFunction(t)||null===t||!1===t,ae=t=>{t=J.isArray(t)?t:[t];const{length:e}=t;let r,n;const o={};for(let i=0;i<e;i++){let e;if(r=t[i],n=r,!ie(r)&&(n=ne[(e=String(r)).toLowerCase()],void 0===n))throw new Q(`Unknown adapter '${e}'`);if(n)break;o[e||"#"+i]=n}if(!n){const t=Object.entries(o).map((([t,e])=>`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build")));let r=e?t.length>1?"since :\n"+t.map(oe).join("\n"):" "+oe(t[0]):"as no adapter specified";throw new Q("There is no suitable adapter to dispatch the request "+r,"ERR_NOT_SUPPORT")}return n};function se(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new At(null,t)}function ce(t){return se(t),t.headers=jt.from(t.headers),t.data=Lt.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1),ae(t.adapter||Et.adapter)(t).then((function(e){return se(t),e.data=Lt.call(t,t.transformResponse,e),e.headers=jt.from(e.headers),e}),(function(e){return Tt(e)||(se(t),e&&e.response&&(e.response.data=Lt.call(t,t.transformResponse,e.response),e.response.headers=jt.from(e.response.headers))),Promise.reject(e)}))}const ue={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{ue[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));const le={};ue.transitional=function(t,e,r){function n(t,e){return"[Axios v1.7.7] Transitional option '"+t+"'"+e+(r?". "+r:"")}return(r,o,i)=>{if(!1===t)throw new Q(n(o," has been removed"+(e?" in "+e:"")),Q.ERR_DEPRECATED);return e&&!le[o]&&(le[o]=!0,console.warn(n(o," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,o,i)}};const fe={assertOptions:function(t,e,r){if("object"!=typeof t)throw new Q("options must be an object",Q.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let o=n.length;for(;o-- >0;){const i=n[o],a=e[i];if(a){const e=t[i],r=void 0===e||a(e,i,t);if(!0!==r)throw new Q("option "+i+" must be "+r,Q.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new Q("Unknown option "+i,Q.ERR_BAD_OPTION)}},validators:ue},pe=fe.validators;class he{constructor(t){this.defaults=t,this.interceptors={request:new lt,response:new lt}}async request(t,e){try{return await this._request(t,e)}catch(t){if(t instanceof Error){let e;Error.captureStackTrace?Error.captureStackTrace(e={}):e=new Error;const r=e.stack?e.stack.replace(/^.+\n/,""):"";try{t.stack?r&&!String(t.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(t.stack+="\n"+r):t.stack=r}catch(t){}}throw t}}_request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=Mt(this.defaults,e);const{transitional:r,paramsSerializer:n,headers:o}=e;void 0!==r&&fe.assertOptions(r,{silentJSONParsing:pe.transitional(pe.boolean),forcedJSONParsing:pe.transitional(pe.boolean),clarifyTimeoutError:pe.transitional(pe.boolean)},!1),null!=n&&(J.isFunction(n)?e.paramsSerializer={serialize:n}:fe.assertOptions(n,{encode:pe.function,serialize:pe.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let i=o&&J.merge(o.common,o[e.method]);o&&J.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete o[t]})),e.headers=jt.concat(i,o);const a=[];let s=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(s=s&&t.synchronous,a.unshift(t.fulfilled,t.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(t){c.push(t.fulfilled,t.rejected)}));let l,f=0;if(!s){const t=[ce.bind(this),void 0];for(t.unshift.apply(t,a),t.push.apply(t,c),l=t.length,u=Promise.resolve(e);f<l;)u=u.then(t[f++],t[f++]);return u}l=a.length;let p=e;for(f=0;f<l;){const t=a[f++],e=a[f++];try{p=t(p)}catch(t){e.call(this,t);break}}try{u=ce.call(this,p)}catch(t){return Promise.reject(t)}for(f=0,l=c.length;f<l;)u=u.then(c[f++],c[f++]);return u}getUri(t){return ut(It((t=Mt(this.defaults,t)).baseURL,t.url),t.params,t.paramsSerializer)}}J.forEach(["delete","get","head","options"],(function(t){he.prototype[t]=function(e,r){return this.request(Mt(r||{},{method:t,url:e,data:(r||{}).data}))}})),J.forEach(["post","put","patch"],(function(t){function e(e){return function(r,n,o){return this.request(Mt(o||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}he.prototype[t]=e(),he.prototype[t+"Form"]=e(!0)}));const de=he;class ye{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise((function(t){e=t}));const r=this;this.promise.then((t=>{if(!r._listeners)return;let e=r._listeners.length;for(;e-- >0;)r._listeners[e](t);r._listeners=null})),this.promise.then=t=>{let e;const n=new Promise((t=>{r.subscribe(t),e=t})).then(t);return n.cancel=function(){r.unsubscribe(e)},n},t((function(t,n,o){r.reason||(r.reason=new At(t,n,o),e(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}toAbortSignal(){const t=new AbortController,e=e=>{t.abort(e)};return this.subscribe(e),t.signal.unsubscribe=()=>this.unsubscribe(e),t.signal}static source(){let t;return{token:new ye((function(e){t=e})),cancel:t}}}const me=ye,ve={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ve).forEach((([t,e])=>{ve[e]=t}));const ge=ve,be=function t(e){const r=new de(e),n=o(de.prototype.request,r);return J.extend(n,de.prototype,r,{allOwnKeys:!0}),J.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return t(Mt(e,r))},n}(Et);be.Axios=de,be.CanceledError=At,be.CancelToken=me,be.isCancel=Tt,be.VERSION="1.7.7",be.toFormData=nt,be.AxiosError=Q,be.Cancel=be.CanceledError,be.all=function(t){return Promise.all(t)},be.spread=function(t){return function(e){return t.apply(null,e)}},be.isAxiosError=function(t){return J.isObject(t)&&!0===t.isAxiosError},be.mergeConfig=Mt,be.AxiosHeaders=jt,be.formToJSON=t=>bt(J.isHTMLForm(t)?new FormData(t):t),be.getAdapter=ae,be.HttpStatusCode=ge,be.default=be;const we=be;function Ee(t){return Ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ee(t)}function Oe(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Se(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Oe(Object(r),!0).forEach((function(e){Re(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Oe(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Re(t,e,r){return(e=Le(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xe(){xe=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype),s=new T(n||[]);return o(a,"_invoke",{value:P(t,r,s)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",d="executing",y="completed",m={};function v(){}function g(){}function b(){}var w={};u(w,a,(function(){return this}));var E=Object.getPrototypeOf,O=E&&E(E(N([])));O&&O!==r&&n.call(O,a)&&(w=O);var S=b.prototype=v.prototype=Object.create(w);function R(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function r(o,i,a,s){var c=f(t[o],t,i);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==Ee(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(l).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,s)}))}s(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function P(e,r,n){var o=p;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var c=_(s,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?y:h,u.arg===m)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=y,n.method="throw",n.arg=u.arg)}}}function _(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,_(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(Ee(e)+" is not iterable")}return g.prototype=b,o(S,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=u(b,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},R(x.prototype),u(x.prototype,s,(function(){return this})),e.AsyncIterator=x,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},R(S),u(S,c,"Generator"),u(S,a,(function(){return this})),u(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function Pe(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function _e(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){Pe(i,n,o,a,s,"next",t)}function s(t){Pe(i,n,o,a,s,"throw",t)}a(void 0)}))}}function je(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Le(n.key),n)}}function Le(t){var e=function(t,e){if("object"!=Ee(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ee(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ee(e)?e:e+""}const Te=new(function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},e=[{key:"handleRequests",value:(c=_e(xe().mark((function t(e,r){var o;return xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,we.defaults.baseURL=n[r].BACKEND_BASE_URL,t.next=4,we.request(e);case 4:return o=t.sent,t.abrupt("return",o.data);case 8:if(t.prev=8,t.t0=t.catch(0),console.log("err",t.t0),!t.t0.response){t.next=17;break}if(401!==t.t0.response.status){t.next=14;break}return t.abrupt("return",window.location.href="/login");case 14:return t.abrupt("return",t.t0.response.data);case 17:if(!t.t0.request){t.next=21;break}return t.abrupt("return",{success:!1,message:"No response received, please try again later."});case 21:return t.abrupt("return",{success:!1,message:"An unexpected error occurred."});case 22:case"end":return t.stop()}}),t,null,[[0,8]])}))),function(t,e){return c.apply(this,arguments)})},{key:"post",value:(s=_e(xe().mark((function t(e,r){var n;return xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Se(Se({},{method:"post"}),e),t.next=4,this.handleRequests(n,r);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t,this)}))),function(t,e){return s.apply(this,arguments)})},{key:"get",value:(a=_e(xe().mark((function t(){var e,r,n,o=arguments;return xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=o.length>0&&void 0!==o[0]?o[0]:{},r=o.length>1?o[1]:void 0,n=Se(Se({},{method:"get"}),e),t.next=6,this.handleRequests(n,r);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t,this)}))),function(){return a.apply(this,arguments)})},{key:"put",value:(i=_e(xe().mark((function t(e,r){var n;return xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Se(Se({},{method:"put"}),e),t.next=4,this.handleRequests(n,r);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t,this)}))),function(t,e){return i.apply(this,arguments)})},{key:"patch",value:(o=_e(xe().mark((function t(e,r){var n;return xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Se(Se({},{method:"patch"}),e),t.next=4,this.handleRequests(n,r);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t,this)}))),function(t,e){return o.apply(this,arguments)})},{key:"delete",value:(r=_e(xe().mark((function t(e,r){var n;return xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Se(Se({},{method:"delete"}),e),t.next=4,this.handleRequests(n,r);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t,this)}))),function(t,e){return r.apply(this,arguments)})}],e&&je(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,o,i,a,s,c}());function Ne(t){return Ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ne(t)}function Ae(){Ae=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype),s=new T(n||[]);return o(a,"_invoke",{value:P(t,r,s)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",d="executing",y="completed",m={};function v(){}function g(){}function b(){}var w={};u(w,a,(function(){return this}));var E=Object.getPrototypeOf,O=E&&E(E(N([])));O&&O!==r&&n.call(O,a)&&(w=O);var S=b.prototype=v.prototype=Object.create(w);function R(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function r(o,i,a,s){var c=f(t[o],t,i);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==Ne(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(l).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,s)}))}s(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function P(e,r,n){var o=p;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var c=_(s,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?y:h,u.arg===m)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=y,n.method="throw",n.arg=u.arg)}}}function _(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,_(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(Ne(e)+" is not iterable")}return g.prototype=b,o(S,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=u(b,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},R(x.prototype),u(x.prototype,s,(function(){return this})),e.AsyncIterator=x,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},R(S),u(S,c,"Generator"),u(S,a,(function(){return this})),u(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function ke(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function Ce(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){ke(i,n,o,a,s,"next",t)}function s(t){ke(i,n,o,a,s,"throw",t)}a(void 0)}))}}function Fe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,De(n.key),n)}}function De(t){var e=function(t,e){if("object"!=Ne(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ne(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ne(e)?e:e+""}var Be,Ue,Ie;new(function(){return t=function t(){var e,r,o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=this,o=function(t){return{"Content-Type":"application/x-www-form-urlencoded","Content-Length":null==t?void 0:t.length}},(r=De(r="defaultHeaders"))in e?Object.defineProperty(e,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[r]=o,this.BASEURL=n.production.HYPERPAY_BASE_URL,this.DEV_BASEURL=n.development.HYPERPAY_BASE_URL},e=[{key:"createHyperpayOrder",value:(i=Ce(Ae().mark((function t(e,r){var n,o,i;return Ae().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.defaultHeaders(),o={url:"/hyperpay/orders/create-order",data:e,headers:n},console.log("requestConfig",o),t.next=6,Te.post(o,r);case 6:return i=t.sent,console.log("result",i),t.abrupt("return",i);case 9:case"end":return t.stop()}}),t,this)}))),function(t,e){return i.apply(this,arguments)})},{key:"getOrderStatus",value:(o=Ce(Ae().mark((function t(e){var r,n,o;return Ae().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this.defaultHeaders(),n={url:"/hyperpay/orders/get-order/".concat(e),headers:r},t.next=5,Te.get(n);case 5:return o=t.sent,t.abrupt("return",o);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})},{key:"captureOrder",value:(r=Ce(Ae().mark((function t(e){var r,n,o;return Ae().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this.defaultHeaders(),n={url:"/hyperpay/orders/capture-order/".concat(e),headers:r},t.next=5,Te.post(n);case 5:return o=t.sent,t.abrupt("return",o);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return r.apply(this,arguments)})}],e&&Fe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,o,i}()),function(t){t.INITIAL="initial",t.PENDING="pending",t.REJECTED="rejected",t.RESOLVED="resolved"}(Be||(Be={})),function(t){t.LOADING_STATUS="setLoadingStatus",t.RESET_OPTIONS="resetOptions",t.SET_BRAINTREE_INSTANCE="braintreeInstance"}(Ue||(Ue={})),function(t){t.NUMBER="number",t.CVV="cvv",t.EXPIRATION_DATE="expirationDate",t.EXPIRATION_MONTH="expirationMonth",t.EXPIRATION_YEAR="expirationYear",t.POSTAL_CODE="postalCode"}(Ie||(Ie={}));var qe=function(){return qe=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},qe.apply(this,arguments)};function Me(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}function He(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var Ge="dataNamespace",$e="3.84.0",ze=("https://js.braintreegateway.com/web/".concat($e,"/js/client.min.js"),"https://js.braintreegateway.com/web/".concat($e,"/js/paypal-checkout.min.js"),"paypal"),Ve="usePayPalScriptReducer must be used within a PayPalScriptProvider";function Ke(t){return void 0===t&&(t=ze),window[t]}function Je(t){var e=t.reactComponentName,r=t.sdkComponentKey,n=t.sdkRequestedComponents,o=void 0===n?"":n,i=t.sdkDataNamespace,a=void 0===i?ze:i,s=r.charAt(0).toUpperCase().concat(r.substring(1)),c="Unable to render <".concat(e," /> because window.").concat(a,".").concat(s," is undefined."),u="string"==typeof o?o:o.join(",");if(!u.includes(r)){var l=[u,r].filter(Boolean).join();c+="\nTo fix the issue, add '".concat(r,"' to the list of components passed to the parent PayPalScriptProvider:")+"\n`<PayPalScriptProvider options={{ components: '".concat(l,"'}}>`.")}return c}var We=(0,e.createContext)(null);function Ye(){var t=function(t){if("function"==typeof(null==t?void 0:t.dispatch)&&0!==t.dispatch.length)return t;throw new Error(Ve)}((0,e.useContext)(We));return[qe(qe({},t),{isInitial:t.loadingStatus===Be.INITIAL,isPending:t.loadingStatus===Be.PENDING,isResolved:t.loadingStatus===Be.RESOLVED,isRejected:t.loadingStatus===Be.REJECTED}),t.dispatch]}(0,e.createContext)({});var Xe=function(t){var r,n=t.className,o=void 0===n?"":n,i=t.disabled,a=void 0!==i&&i,s=t.children,c=t.forceReRender,u=void 0===c?[]:c,l=Me(t,["className","disabled","children","forceReRender"]),f=a?{opacity:.38}:{},p="".concat(o," ").concat(a?"paypal-buttons-disabled":"").trim(),h=(0,e.useRef)(null),d=(0,e.useRef)(null),y=Ye()[0],m=y.isResolved,v=y.options,g=(0,e.useState)(null),b=g[0],w=g[1],E=(0,e.useState)(!0),O=E[0],S=E[1],R=(0,e.useState)(null)[1];function x(){null!==d.current&&d.current.close().catch((function(){}))}return(null===(r=d.current)||void 0===r?void 0:r.updateProps)&&d.current.updateProps({message:l.message}),(0,e.useEffect)((function(){if(!1===m)return x;var t=Ke(v.dataNamespace);if(void 0===t||void 0===t.Buttons)return R((function(){throw new Error(Je({reactComponentName:Xe.displayName,sdkComponentKey:"buttons",sdkRequestedComponents:v.components,sdkDataNamespace:v[Ge]}))})),x;try{d.current=t.Buttons(qe(qe({},l),{onInit:function(t,e){w(e),"function"==typeof l.onInit&&l.onInit(t,e)}}))}catch(t){return R((function(){throw new Error("Failed to render <PayPalButtons /> component. Failed to initialize: ".concat(t))}))}return!1===d.current.isEligible()?(S(!1),x):h.current?(d.current.render(h.current).catch((function(t){null!==h.current&&0!==h.current.children.length&&R((function(){throw new Error("Failed to render <PayPalButtons /> component. ".concat(t))}))})),x):x}),He(He([m],u,!0),[l.fundingSource],!1)),(0,e.useEffect)((function(){null!==b&&(!0===a?b.disable().catch((function(){})):b.enable().catch((function(){})))}),[a,b]),e.createElement(e.Fragment,null,O?e.createElement("div",{ref:h,style:f,className:p}):s)};Xe.displayName="PayPalButtons";var Qe=function(t){var r=t.className,n=void 0===r?"":r,o=t.children,i=Me(t,["className","children"]),a=Ye()[0],s=a.isResolved,c=a.options,u=(0,e.useRef)(null),l=(0,e.useState)(!0),f=l[0],p=l[1],h=(0,e.useState)(null)[1];return(0,e.useEffect)((function(){if(!1!==s){var t=Ke(c[Ge]);if(void 0===t||void 0===t.Marks)return h((function(){throw new Error(Je({reactComponentName:Qe.displayName,sdkComponentKey:"marks",sdkRequestedComponents:c.components,sdkDataNamespace:c[Ge]}))}));!function(t){var e=u.current;if(!e||!t.isEligible())return p(!1);e.firstChild&&e.removeChild(e.firstChild),t.render(e).catch((function(t){null!==e&&0!==e.children.length&&h((function(){throw new Error("Failed to render <PayPalMarks /> component. ".concat(t))}))}))}(t.Marks(qe({},i)))}}),[s,i.fundingSource]),e.createElement(e.Fragment,null,f?e.createElement("div",{ref:u,className:n}):o)};Qe.displayName="PayPalMarks";var Ze=function(t){var r=t.className,n=void 0===r?"":r,o=t.forceReRender,i=void 0===o?[]:o,a=Me(t,["className","forceReRender"]),s=Ye()[0],c=s.isResolved,u=s.options,l=(0,e.useRef)(null),f=(0,e.useRef)(null),p=(0,e.useState)(null)[1];return(0,e.useEffect)((function(){if(!1!==c){var t=Ke(u[Ge]);if(void 0===t||void 0===t.Messages)return p((function(){throw new Error(Je({reactComponentName:Ze.displayName,sdkComponentKey:"messages",sdkRequestedComponents:u.components,sdkDataNamespace:u[Ge]}))}));f.current=t.Messages(qe({},a)),f.current.render(l.current).catch((function(t){null!==l.current&&0!==l.current.children.length&&p((function(){throw new Error("Failed to render <PayPalMessages /> component. ".concat(t))}))}))}}),He([c],i,!0)),e.createElement("div",{ref:l,className:n})};function tr(){}function er(t){return er="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},er(t)}function rr(){rr=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype),s=new T(n||[]);return o(a,"_invoke",{value:P(t,r,s)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",d="executing",y="completed",m={};function v(){}function g(){}function b(){}var w={};u(w,a,(function(){return this}));var E=Object.getPrototypeOf,O=E&&E(E(N([])));O&&O!==r&&n.call(O,a)&&(w=O);var S=b.prototype=v.prototype=Object.create(w);function R(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function r(o,i,a,s){var c=f(t[o],t,i);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==er(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(l).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,s)}))}s(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function P(e,r,n){var o=p;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var c=_(s,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?y:h,u.arg===m)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=y,n.method="throw",n.arg=u.arg)}}}function _(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,_(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(er(e)+" is not iterable")}return g.prototype=b,o(S,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=u(b,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},R(x.prototype),u(x.prototype,s,(function(){return this})),e.AsyncIterator=x,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},R(S),u(S,c,"Generator"),u(S,a,(function(){return this})),u(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function nr(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function or(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){nr(i,n,o,a,s,"next",t)}function s(t){nr(i,n,o,a,s,"throw",t)}a(void 0)}))}}function ir(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ar(n.key),n)}}function ar(t){var e=function(t,e){if("object"!=er(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=er(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==er(e)?e:e+""}Ze.displayName="PayPalMessages",(0,e.createContext)({cardFieldsForm:null,fields:{},registerField:tr,unregisterField:tr}),new(function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},e=[{key:"createPaypalOrder",value:(n=or(rr().mark((function t(e,r){var n,o;return rr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={url:"/paypal/orders/create-order",data:e},t.next=3,Te.post(n,r);case 3:return o=t.sent,t.abrupt("return",o);case 5:case"end":return t.stop()}}),t)}))),function(t,e){return n.apply(this,arguments)})},{key:"approveOrder",value:(r=or(rr().mark((function t(e,r){var n,o;return rr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={url:"/paypal/orders/capture-order",data:e},t.next=3,Te.post(n,r);case 3:return o=t.sent,t.abrupt("return",o);case 5:case"end":return t.stop()}}),t)}))),function(t,e){return r.apply(this,arguments)})}],e&&ir(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,n}())})()})();
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* react-paypal-js v8.7.0 (2024-09-16T17:52:54.237Z)
|
|
3
|
+
* Copyright 2020-present, PayPal, Inc. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @license React
|
|
22
|
+
* react.production.min.js
|
|
23
|
+
*
|
|
24
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
25
|
+
*
|
|
26
|
+
* This source code is licensed under the MIT license found in the
|
|
27
|
+
* LICENSE file in the root directory of this source tree.
|
|
28
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import hyperpayConnector from "../shared/requests/hyperpayConnector.js";
|
|
3
|
-
|
|
4
|
-
const HyperpayOrder = ({ redirectUrl, order, env }) => {
|
|
5
|
-
const [error, setError] = useState(null);
|
|
6
|
-
const [checkoutId, setCheckoutId] = useState(null);
|
|
7
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
if (order) {
|
|
11
|
-
initiateOrder();
|
|
12
|
-
}
|
|
13
|
-
}, [order]);
|
|
14
|
-
|
|
15
|
-
const initiateOrder = async () => {
|
|
16
|
-
try {
|
|
17
|
-
if (!order) {
|
|
18
|
-
setError("Data must be provided");
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
setIsLoading(true);
|
|
22
|
-
const result = await hyperpayConnector.createHyperpayOrder(order, env);
|
|
23
|
-
setIsLoading(false);
|
|
24
|
-
|
|
25
|
-
if (result?.error) {
|
|
26
|
-
setError(result.error);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
setCheckoutId(result?.id);
|
|
31
|
-
} catch (err) {
|
|
32
|
-
console.error("err", err);
|
|
33
|
-
setError("An unexpected error occurred.");
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const checkout = async ( ) => {
|
|
38
|
-
try {
|
|
39
|
-
if (!checkoutId) {
|
|
40
|
-
setError("Checkout ID must be provided");
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
setIsLoading(true);
|
|
44
|
-
const result = await hyperpayConnector.getOrderStatus(checkoutId, env);
|
|
45
|
-
setIsLoading(false);
|
|
46
|
-
|
|
47
|
-
if (result?.error) {
|
|
48
|
-
setError(result.error);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return result;
|
|
53
|
-
} catch (err) {
|
|
54
|
-
console.error("err", err);
|
|
55
|
-
setError("An unexpected error occurred.");
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
useEffect(() => {
|
|
60
|
-
if (checkoutId) {
|
|
61
|
-
const script = document.createElement("script");
|
|
62
|
-
script.src = `https://eu-test.oppwa.com/v1/paymentWidgets.js?checkoutId=${checkoutId}`;
|
|
63
|
-
script.async = true;
|
|
64
|
-
script.crossOrigin = "anonymous";
|
|
65
|
-
document.body.appendChild(script);
|
|
66
|
-
|
|
67
|
-
return () => {
|
|
68
|
-
document.body.removeChild(script);
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
}, [checkoutId]);
|
|
72
|
-
|
|
73
|
-
if (error) {
|
|
74
|
-
return <p>Error: {error}</p>;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (isLoading) {
|
|
79
|
-
return <p>Loading...</p>;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (checkoutId) {
|
|
83
|
-
return (
|
|
84
|
-
<form
|
|
85
|
-
action={redirectUrl}
|
|
86
|
-
className="paymentWidgets"
|
|
87
|
-
data-brands="VISA MASTER AMEX"
|
|
88
|
-
></form>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return (
|
|
93
|
-
<div>
|
|
94
|
-
<p>No order</p>
|
|
95
|
-
</div>
|
|
96
|
-
);
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export default HyperpayOrder;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { PayPalButtons, usePayPalScriptReducer } from "@paypal/react-paypal-js";
|
|
3
|
-
import backendConnector from "../shared/requests/backendConnector.js";
|
|
4
|
-
|
|
5
|
-
const Spinner = () => <div className="spinner">Processing payment...</div>;
|
|
6
|
-
|
|
7
|
-
const ButtonWrapper = ({
|
|
8
|
-
order,
|
|
9
|
-
onChange = () => {},
|
|
10
|
-
onStatusChange = () => {},
|
|
11
|
-
env,
|
|
12
|
-
}) => {
|
|
13
|
-
if (env !== "production" && env !== "development") {
|
|
14
|
-
return <div>Invalid Env</div>;
|
|
15
|
-
}
|
|
16
|
-
const [{ isPending }] = usePayPalScriptReducer();
|
|
17
|
-
|
|
18
|
-
const createOrderOrSubscription = async () => {
|
|
19
|
-
try {
|
|
20
|
-
const response = await backendConnector.createPaypalOrder(order, env);
|
|
21
|
-
onChange({ event: "createOrder", data: response });
|
|
22
|
-
return response.id;
|
|
23
|
-
} catch (error) {
|
|
24
|
-
console.error("Error creating PayPal transaction:", error);
|
|
25
|
-
throw new Error("Transaction creation failed");
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const handleApproval = async (data, actions) => {
|
|
30
|
-
try {
|
|
31
|
-
console.log(data);
|
|
32
|
-
const captureData = {
|
|
33
|
-
orderId: data?.orderID || undefined,
|
|
34
|
-
subscriptionId: data?.subscriptionID || data?.id,
|
|
35
|
-
type: order.type,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
await backendConnector.approveOrder(captureData, env);
|
|
39
|
-
if (order.type == "order") {
|
|
40
|
-
return actions.order.capture().then(function (details) {
|
|
41
|
-
onStatusChange(true);
|
|
42
|
-
onChange({ event: "approveOrder", data: data });
|
|
43
|
-
|
|
44
|
-
console.log(
|
|
45
|
-
"Transaction completed by " + details.payer.name.given_name
|
|
46
|
-
);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
onStatusChange(true);
|
|
50
|
-
onChange({ event: "approveOrder", data: data });
|
|
51
|
-
} catch (error) {
|
|
52
|
-
console.error("Error capturing PayPal transaction:", error);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<>
|
|
58
|
-
{isPending ? <Spinner /> : null}
|
|
59
|
-
<PayPalButtons
|
|
60
|
-
style={{ layout: "vertical" }}
|
|
61
|
-
disabled={false}
|
|
62
|
-
fundingSource={undefined}
|
|
63
|
-
createOrder={
|
|
64
|
-
order.type === "order" ? createOrderOrSubscription : undefined
|
|
65
|
-
}
|
|
66
|
-
createSubscription={
|
|
67
|
-
order.type === "subscription" ? createOrderOrSubscription : undefined
|
|
68
|
-
}
|
|
69
|
-
onError={(err) => console.log(err)}
|
|
70
|
-
onApprove={handleApproval}
|
|
71
|
-
/>
|
|
72
|
-
</>
|
|
73
|
-
);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export default ButtonWrapper;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { PayPalScriptProvider } from "@paypal/react-paypal-js";
|
|
3
|
-
import ButtonWrapper from "./buttonWrapper.js";
|
|
4
|
-
|
|
5
|
-
const PaypalOrder = ({
|
|
6
|
-
currency = "USD",
|
|
7
|
-
clientId = "test",
|
|
8
|
-
order = {},
|
|
9
|
-
onChange = () => {},
|
|
10
|
-
onStatusChange = () => {},
|
|
11
|
-
env,
|
|
12
|
-
}) => {
|
|
13
|
-
const initialOptions = {
|
|
14
|
-
clientId: clientId,
|
|
15
|
-
currency: currency,
|
|
16
|
-
vault: order.type === "subscription",
|
|
17
|
-
};
|
|
18
|
-
return (
|
|
19
|
-
<div style={{ maxWidth: "750px", minHeight: "200px" }}>
|
|
20
|
-
<PayPalScriptProvider options={initialOptions}>
|
|
21
|
-
<ButtonWrapper
|
|
22
|
-
order={order}
|
|
23
|
-
onChange={onChange}
|
|
24
|
-
onStatusChange={onStatusChange}
|
|
25
|
-
env={env}
|
|
26
|
-
/>
|
|
27
|
-
</PayPalScriptProvider>
|
|
28
|
-
</div>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default PaypalOrder;
|
package/src/shared/config.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const config = {
|
|
2
|
-
development: {
|
|
3
|
-
BACKEND_BASE_URL: "http://localhost:5000/api",
|
|
4
|
-
HYPERPAY_BASE_URL: "https://eu-test.oppwa.com/",
|
|
5
|
-
},
|
|
6
|
-
production: {
|
|
7
|
-
BACKEND_BASE_URL: "http://prod:5000/api",
|
|
8
|
-
HYPERPAY_BASE_URL: "https://eu-prod.oppwa.com/",
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export default config;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Services
|
|
2
|
-
import backendConnector from "./requests/backendConnector";
|
|
3
|
-
|
|
4
|
-
class PaypalService {
|
|
5
|
-
async createOrder(data) {
|
|
6
|
-
const result = await backendConnector.createPaypalOrder(data);
|
|
7
|
-
if (result?.id) return result?.id;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
async onApprove(data) {
|
|
11
|
-
const result = await backendConnector.approveOrder(data);
|
|
12
|
-
return result;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export default new PaypalService();
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// Services
|
|
2
|
-
import request from "./request.js";
|
|
3
|
-
|
|
4
|
-
class BackendConnector {
|
|
5
|
-
async createPaypalOrder(data, env) {
|
|
6
|
-
const requestConfig = {
|
|
7
|
-
url: "/paypal/orders/create-order",
|
|
8
|
-
data,
|
|
9
|
-
};
|
|
10
|
-
const result = await request.post(requestConfig, env);
|
|
11
|
-
return result;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
async approveOrder(data, env) {
|
|
15
|
-
const requestConfig = {
|
|
16
|
-
url: "/paypal/orders/capture-order",
|
|
17
|
-
data,
|
|
18
|
-
};
|
|
19
|
-
const result = await request.post(requestConfig, env);
|
|
20
|
-
return result;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export default new BackendConnector();
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// Services
|
|
2
|
-
import config from "../config.js";
|
|
3
|
-
import request from "./request.js";
|
|
4
|
-
|
|
5
|
-
class HyperpayConnector {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.BASEURL = config.production.HYPERPAY_BASE_URL;
|
|
8
|
-
this.DEV_BASEURL = config.development.HYPERPAY_BASE_URL;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
defaultHeaders = (data) => {
|
|
12
|
-
const headers = {
|
|
13
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
14
|
-
"Content-Length": data?.length,
|
|
15
|
-
// Authorization:
|
|
16
|
-
// "Bearer OGFjN2E0Yzc5Mzk0YmRjODAxOTM5NzM2ZjFhNzA2NDF8enlac1lYckc4QXk6bjYzI1NHNng=",
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
return headers;
|
|
20
|
-
};
|
|
21
|
-
async createHyperpayOrder(data, env) {
|
|
22
|
-
const headers = this.defaultHeaders();
|
|
23
|
-
const url = "/hyperpay/orders/create-order";
|
|
24
|
-
const requestConfig = {
|
|
25
|
-
url: url,
|
|
26
|
-
// baseUrl: env === "development" ? this.DEV_BASEURL : this.BASEURL,
|
|
27
|
-
data,
|
|
28
|
-
headers: headers,
|
|
29
|
-
};
|
|
30
|
-
console.log("requestConfig", requestConfig);
|
|
31
|
-
const result = await request.post(requestConfig ,env);
|
|
32
|
-
console.log("result", result);
|
|
33
|
-
return result;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
async getOrderStatus(checkoutId, env = "production") {
|
|
37
|
-
const headers = this.defaultHeaders();
|
|
38
|
-
const requestConfig = {
|
|
39
|
-
url: `/hyperpay/orders/get-order/${checkoutId}`,
|
|
40
|
-
// baseUrl: env === "development" ? this.DEV_BASEURL : this.BASEURL,
|
|
41
|
-
headers,
|
|
42
|
-
};
|
|
43
|
-
const result = await request.get(requestConfig);
|
|
44
|
-
return result;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
async captureOrder(orderId, env = "production") {
|
|
48
|
-
const headers = this.defaultHeaders();
|
|
49
|
-
const requestConfig = {
|
|
50
|
-
url: `/hyperpay/orders/capture-order/${orderId}`,
|
|
51
|
-
// baseUrl: env === "development" ? this.DEV_BASEURL : this.BASEURL,
|
|
52
|
-
headers,
|
|
53
|
-
};
|
|
54
|
-
const result = await request.post(requestConfig);
|
|
55
|
-
return result;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export default new HyperpayConnector();
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
// CONFIG
|
|
3
|
-
import config from "../config.js";
|
|
4
|
-
|
|
5
|
-
class Request {
|
|
6
|
-
constructor() {}
|
|
7
|
-
|
|
8
|
-
async handleRequests(finalConfig, env) {
|
|
9
|
-
try {
|
|
10
|
-
axios.defaults.baseURL = config[env].BACKEND_BASE_URL;
|
|
11
|
-
const response = await axios.request(finalConfig);
|
|
12
|
-
|
|
13
|
-
return response.data;
|
|
14
|
-
} catch (err) {
|
|
15
|
-
console.log("err", err);
|
|
16
|
-
if (err.response) {
|
|
17
|
-
if (err.response.status === 401) {
|
|
18
|
-
return (window.location.href = "/login");
|
|
19
|
-
}
|
|
20
|
-
return err.response.data;
|
|
21
|
-
} else if (err.request) {
|
|
22
|
-
return {
|
|
23
|
-
success: false,
|
|
24
|
-
message: "No response received, please try again later.",
|
|
25
|
-
};
|
|
26
|
-
} else {
|
|
27
|
-
|
|
28
|
-
return { success: false, message: "An unexpected error occurred." };
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async post(config, env) {
|
|
34
|
-
const defaultConfig = {
|
|
35
|
-
method: "post",
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const finalConfig = {
|
|
39
|
-
...defaultConfig,
|
|
40
|
-
...config,
|
|
41
|
-
};
|
|
42
|
-
return await this.handleRequests(finalConfig, env);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async get(config = {}, env) {
|
|
46
|
-
const defaultConfig = {
|
|
47
|
-
method: "get",
|
|
48
|
-
};
|
|
49
|
-
const finalConfig = {
|
|
50
|
-
...defaultConfig,
|
|
51
|
-
...config,
|
|
52
|
-
};
|
|
53
|
-
return await this.handleRequests(finalConfig, env);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
async put(config, env) {
|
|
57
|
-
const defaultConfig = {
|
|
58
|
-
method: "put",
|
|
59
|
-
};
|
|
60
|
-
const finalConfig = {
|
|
61
|
-
...defaultConfig,
|
|
62
|
-
...config,
|
|
63
|
-
};
|
|
64
|
-
return await this.handleRequests(finalConfig, env);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
async patch(config, env) {
|
|
68
|
-
const defaultConfig = {
|
|
69
|
-
method: "patch",
|
|
70
|
-
};
|
|
71
|
-
const finalConfig = {
|
|
72
|
-
...defaultConfig,
|
|
73
|
-
...config,
|
|
74
|
-
};
|
|
75
|
-
return await this.handleRequests(finalConfig, env);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
async delete(config, env) {
|
|
79
|
-
const defaultConfig = {
|
|
80
|
-
method: "delete",
|
|
81
|
-
};
|
|
82
|
-
const finalConfig = {
|
|
83
|
-
...defaultConfig,
|
|
84
|
-
...config,
|
|
85
|
-
};
|
|
86
|
-
return await this.handleRequests(finalConfig, env);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export default new Request();
|