hapi-recaptcha-html 1.0.2 → 1.0.3

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 CHANGED
@@ -15,17 +15,18 @@ enquiry-forms.js file:
15
15
  // form 01
16
16
  {
17
17
  name: 'form01',
18
- endpoint: 'https://hapiform.sg/api/<hapiform-id-number-1>',
18
+ hapiformID: '<hapiform-id-number-1>',
19
19
  redirectTo: '/contactus-success.html',
20
- captchaId: 'captcha-01'
21
-
20
+ captchaId: 'captcha-01',
21
+ integrationScriptUrl: "", // optional, POST current DataForm to external URL (API).
22
22
  },
23
23
  // form 02
24
24
  {
25
25
  name: 'form02',
26
- endpoint: 'https://hapiform.sg/api/<hapiform-id-number-2>',
26
+ hapiformID: '<hapiform-id-number-2>',
27
27
  redirectTo: '/contactus-success.html',
28
- captchaId: 'captcha-02'
28
+ captchaId: 'captcha-02',
29
+ integrationScriptUrl: "", // optional, POST current DataForm to external URL (API).
29
30
  }
30
31
  ...
31
32
  ]
@@ -47,11 +48,9 @@ please note that you must use `$store.<form-name>.fileds.<field-name>` to bind i
47
48
 
48
49
  ```
49
50
  - name – The name of the instance, to be matched with `x-data="name"`.
50
- - endpointThe form endpoint URL generated from the backend.
51
+ - hapiformIDhapiform id
51
52
  - redirectTo – Location to be redirected after success. Eg: "/thank-you" or "https://example.com". (Optional)
52
- - fileUpload
53
- - filepond – Filepond object. (Filepond plugin required)
54
- - el – Select `input` element if you're using normal upload.
53
+ - integrationScriptUrl - optional, POST current DataForm to external URL (API).
55
54
  - captchaId - Id of div element to render the google recaptcha, `null` means recaptcha is disabled.
56
55
  - recaptchaTheme - `light` or `dark`.
57
56
  - onSuccess() – On success event.
@@ -2,17 +2,18 @@ Hapi.forms([
2
2
  // form 01
3
3
  {
4
4
  name: 'form01',
5
- endpoint: 'https://hapiform.sg/api/5867eae1-c53d-4734-a50c-abd350eb79d9',
5
+ hapiformID: '5867eae1-c53d-4734-a50c-abd350eb79d9',
6
6
  redirectTo: 'contactus-success.html',
7
- captchaId: 'captcha-01'
8
-
7
+ captchaId: 'captcha-01',
8
+ integrationScriptUrl: "https://gaapi.activamedia.com.sg/123form/webhook-json", // optional, POST current DataForm/Json to external URL (API).
9
9
  },
10
10
  // form 02
11
11
  {
12
12
  name: 'form02',
13
- endpoint: 'https://hapiform.sg/api/5867eae1-c53d-4734-a50c-abd350eb79d9',
13
+ hapiformID: '5867eae1-c53d-4734-a50c-abd350eb79d9',
14
14
  redirectTo: 'contactus-success.html',
15
- captchaId: 'captcha-02'
15
+ captchaId: 'captcha-02',
16
+ integrationScriptUrl: "https://gaapi.activamedia.com.sg/123form/webhook-formdata", // optional, POST current DataForm/Json to external URL (API).
16
17
  }
17
18
  ]
18
19
  );
package/dist/hapi.min.js CHANGED
@@ -1,3 +1,3 @@
1
- (()=>{function B(e,t){return function(){return e.apply(t,arguments)}}var{toString:ft}=Object.prototype,{getPrototypeOf:ue}=Object,K=(e=>t=>{let r=ft.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),R=e=>(e=e.toLowerCase(),t=>K(t)===e),G=e=>t=>typeof t===e,{isArray:P}=Array,j=G("undefined");function dt(e){return e!==null&&!j(e)&&e.constructor!==null&&!j(e.constructor)&&S(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var Fe=R("ArrayBuffer");function pt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Fe(e.buffer),t}var mt=G("string"),S=G("function"),Pe=G("number"),X=e=>e!==null&&typeof e=="object",ht=e=>e===!0||e===!1,W=e=>{if(K(e)!=="object")return!1;let t=ue(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},yt=R("Date"),Et=R("File"),wt=R("Blob"),bt=R("FileList"),At=e=>X(e)&&S(e.pipe),St=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||S(e.append)&&((t=K(e))==="formdata"||t==="object"&&S(e.toString)&&e.toString()==="[object FormData]"))},xt=R("URLSearchParams"),Rt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function k(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,o;if(typeof e!="object"&&(e=[e]),P(e))for(n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else{let s=r?Object.getOwnPropertyNames(e):Object.keys(e),i=s.length,c;for(n=0;n<i;n++)c=s[n],t.call(null,e[c],c,e)}}function Ue(e,t){t=t.toLowerCase();let r=Object.keys(e),n=r.length,o;for(;n-- >0;)if(o=r[n],t===o.toLowerCase())return o;return null}var _e=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),De=e=>!j(e)&&e!==_e;function le(){let{caseless:e}=De(this)&&this||{},t={},r=(n,o)=>{let s=e&&Ue(t,o)||o;W(t[s])&&W(n)?t[s]=le(t[s],n):W(n)?t[s]=le({},n):P(n)?t[s]=n.slice():t[s]=n};for(let n=0,o=arguments.length;n<o;n++)arguments[n]&&k(arguments[n],r);return t}var Ot=(e,t,r,{allOwnKeys:n}={})=>(k(t,(o,s)=>{r&&S(o)?e[s]=B(o,r):e[s]=o},{allOwnKeys:n}),e),gt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Tt=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},Ct=(e,t,r,n)=>{let o,s,i,c={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)i=o[s],(!n||n(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=r!==!1&&ue(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Nt=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},Ft=e=>{if(!e)return null;if(P(e))return e;let t=e.length;if(!Pe(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Pt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&ue(Uint8Array)),Ut=(e,t)=>{let n=(e&&e[Symbol.iterator]).call(e),o;for(;(o=n.next())&&!o.done;){let s=o.value;t.call(e,s[0],s[1])}},_t=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Dt=R("HTMLFormElement"),Lt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,o){return n.toUpperCase()+o}),Ce=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Bt=R("RegExp"),Le=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};k(r,(o,s)=>{t(o,s,e)!==!1&&(n[s]=o)}),Object.defineProperties(e,n)},jt=e=>{Le(e,(t,r)=>{if(S(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(S(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},kt=(e,t)=>{let r={},n=o=>{o.forEach(s=>{r[s]=!0})};return P(e)?n(e):n(String(e).split(t)),r},It=()=>{},Ht=(e,t)=>(e=+e,Number.isFinite(e)?e:t),ce="abcdefghijklmnopqrstuvwxyz",Ne="0123456789",Be={DIGIT:Ne,ALPHA:ce,ALPHA_DIGIT:ce+ce.toUpperCase()+Ne},qt=(e=16,t=Be.ALPHA_DIGIT)=>{let r="",{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};function Mt(e){return!!(e&&S(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var Jt=e=>{let t=new Array(10),r=(n,o)=>{if(X(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[o]=n;let s=P(n)?[]:{};return k(n,(i,c)=>{let d=r(i,o+1);!j(d)&&(s[c]=d)}),t[o]=void 0,s}}return n};return r(e,0)},zt=R("AsyncFunction"),vt=e=>e&&(X(e)||S(e))&&S(e.then)&&S(e.catch),a={isArray:P,isArrayBuffer:Fe,isBuffer:dt,isFormData:St,isArrayBufferView:pt,isString:mt,isNumber:Pe,isBoolean:ht,isObject:X,isPlainObject:W,isUndefined:j,isDate:yt,isFile:Et,isBlob:wt,isRegExp:Bt,isFunction:S,isStream:At,isURLSearchParams:xt,isTypedArray:Pt,isFileList:bt,forEach:k,merge:le,extend:Ot,trim:Rt,stripBOM:gt,inherits:Tt,toFlatObject:Ct,kindOf:K,kindOfTest:R,endsWith:Nt,toArray:Ft,forEachEntry:Ut,matchAll:_t,isHTMLForm:Dt,hasOwnProperty:Ce,hasOwnProp:Ce,reduceDescriptors:Le,freezeMethods:jt,toObjectSet:kt,toCamelCase:Lt,noop:It,toFiniteNumber:Ht,findKey:Ue,global:_e,isContextDefined:De,ALPHABET:Be,generateString:qt,isSpecCompliantForm:Mt,toJSONObject:Jt,isAsyncFn:zt,isThenable:vt};function U(e,t,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o)}a.inherits(U,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:a.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var je=U.prototype,ke={};["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(e=>{ke[e]={value:e}});Object.defineProperties(U,ke);Object.defineProperty(je,"isAxiosError",{value:!0});U.from=(e,t,r,n,o,s)=>{let i=Object.create(je);return a.toFlatObject(e,i,function(d){return d!==Error.prototype},c=>c!=="isAxiosError"),U.call(i,e.message,t,r,n,o),i.cause=e,i.name=e.name,s&&Object.assign(i,s),i};var m=U;var Y=null;function fe(e){return a.isPlainObject(e)||a.isArray(e)}function He(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function Ie(e,t,r){return e?e.concat(t).map(function(o,s){return o=He(o),!r&&s?"["+o+"]":o}).join(r?".":""):t}function Vt(e){return a.isArray(e)&&!e.some(fe)}var $t=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function Wt(e,t,r){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new(Y||FormData),r=a.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(h,O){return!a.isUndefined(O[h])});let n=r.metaTokens,o=r.visitor||u,s=r.dots,i=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(o))throw new TypeError("visitor must be a function");function l(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(!d&&a.isBlob(f))throw new m("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?d&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function u(f,h,O){let x=f;if(f&&!O&&typeof f=="object"){if(a.endsWith(h,"{}"))h=n?h:h.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&Vt(f)||(a.isFileList(f)||a.endsWith(h,"[]"))&&(x=a.toArray(f)))return h=He(h),x.forEach(function($,ut){!(a.isUndefined($)||$===null)&&t.append(i===!0?Ie([h],ut,s):i===null?h:h+"[]",l($))}),!1}return fe(f)?!0:(t.append(Ie(O,h,s),l(f)),!1)}let p=[],w=Object.assign($t,{defaultVisitor:u,convertValue:l,isVisitable:fe});function y(f,h){if(!a.isUndefined(f)){if(p.indexOf(f)!==-1)throw Error("Circular reference detected in "+h.join("."));p.push(f),a.forEach(f,function(x,F){(!(a.isUndefined(x)||x===null)&&o.call(t,x,a.isString(F)?F.trim():F,h,w))===!0&&y(x,h?h.concat(F):[F])}),p.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return y(e),t}var T=Wt;function qe(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Me(e,t){this._pairs=[],e&&T(e,this,t)}var Je=Me.prototype;Je.append=function(t,r){this._pairs.push([t,r])};Je.toString=function(t){let r=t?function(n){return t.call(this,n,qe)}:qe;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};var Q=Me;function Kt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function I(e,t,r){if(!t)return e;let n=r&&r.encode||Kt,o=r&&r.serialize,s;if(o?s=o(t,r):s=a.isURLSearchParams(t)?t.toString():new Q(t,r).toString(n),s){let i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}var de=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(n){n!==null&&t(n)})}},pe=de;var Z={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var ze=typeof URLSearchParams<"u"?URLSearchParams:Q;var ve=typeof FormData<"u"?FormData:null;var Ve=typeof Blob<"u"?Blob:null;var Gt=(()=>{let e;return typeof navigator<"u"&&((e=navigator.product)==="ReactNative"||e==="NativeScript"||e==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),Xt=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),b={isBrowser:!0,classes:{URLSearchParams:ze,FormData:ve,Blob:Ve},isStandardBrowserEnv:Gt,isStandardBrowserWebWorkerEnv:Xt,protocols:["http","https","file","blob","url","data"]};function me(e,t){return T(e,new b.classes.URLSearchParams,Object.assign({visitor:function(r,n,o,s){return b.isNode&&a.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function Yt(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Qt(e){let t={},r=Object.keys(e),n,o=r.length,s;for(n=0;n<o;n++)s=r[n],t[s]=e[s];return t}function Zt(e){function t(r,n,o,s){let i=r[s++],c=Number.isFinite(+i),d=s>=r.length;return i=!i&&a.isArray(o)?o.length:i,d?(a.hasOwnProp(o,i)?o[i]=[o[i],n]:o[i]=n,!c):((!o[i]||!a.isObject(o[i]))&&(o[i]=[]),t(r,n,o[i],s)&&a.isArray(o[i])&&(o[i]=Qt(o[i])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){let r={};return a.forEachEntry(e,(n,o)=>{t(Yt(n),o,r,0)}),r}return null}var ee=Zt;var er={"Content-Type":void 0};function tr(e,t,r){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var te={transitional:Z,adapter:["xhr","http"],transformRequest:[function(t,r){let n=r.getContentType()||"",o=n.indexOf("application/json")>-1,s=a.isObject(t);if(s&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return o&&o?JSON.stringify(ee(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return me(t,this.formSerializer).toString();if((c=a.isFileList(t))||n.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return T(c?{"files[]":t}:t,d&&new d,this.formSerializer)}}return s||o?(r.setContentType("application/json",!1),tr(t)):t}],transformResponse:[function(t){let r=this.transitional||te.transitional,n=r&&r.forcedJSONParsing,o=this.responseType==="json";if(t&&a.isString(t)&&(n&&!this.responseType||o)){let i=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(c){if(i)throw c.name==="SyntaxError"?m.from(c,m.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:b.classes.FormData,Blob:b.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};a.forEach(["delete","get","head"],function(t){te.headers[t]={}});a.forEach(["post","put","patch"],function(t){te.headers[t]=a.merge(er)});var _=te;var rr=a.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"]),$e=e=>{let t={},r,n,o;return e&&e.split(`
2
- `).forEach(function(i){o=i.indexOf(":"),r=i.substring(0,o).trim().toLowerCase(),n=i.substring(o+1).trim(),!(!r||t[r]&&rr[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};var We=Symbol("internals");function H(e){return e&&String(e).trim().toLowerCase()}function re(e){return e===!1||e==null?e:a.isArray(e)?e.map(re):String(e)}function nr(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}var or=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function he(e,t,r,n,o){if(a.isFunction(n))return n.call(this,t,r);if(o&&(t=r),!!a.isString(t)){if(a.isString(n))return t.indexOf(n)!==-1;if(a.isRegExp(n))return n.test(t)}}function sr(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function ir(e,t){let r=a.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(o,s,i){return this[n].call(this,t,o,s,i)},configurable:!0})})}var D=class{constructor(t){t&&this.set(t)}set(t,r,n){let o=this;function s(c,d,l){let u=H(d);if(!u)throw new Error("header name must be a non-empty string");let p=a.findKey(o,u);(!p||o[p]===void 0||l===!0||l===void 0&&o[p]!==!1)&&(o[p||d]=re(c))}let i=(c,d)=>a.forEach(c,(l,u)=>s(l,u,d));return a.isPlainObject(t)||t instanceof this.constructor?i(t,r):a.isString(t)&&(t=t.trim())&&!or(t)?i($e(t),r):t!=null&&s(r,t,n),this}get(t,r){if(t=H(t),t){let n=a.findKey(this,t);if(n){let o=this[n];if(!r)return o;if(r===!0)return nr(o);if(a.isFunction(r))return r.call(this,o,n);if(a.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=H(t),t){let n=a.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||he(this,this[n],n,r)))}return!1}delete(t,r){let n=this,o=!1;function s(i){if(i=H(i),i){let c=a.findKey(n,i);c&&(!r||he(n,n[c],c,r))&&(delete n[c],o=!0)}}return a.isArray(t)?t.forEach(s):s(t),o}clear(t){let r=Object.keys(this),n=r.length,o=!1;for(;n--;){let s=r[n];(!t||he(this,this[s],s,t,!0))&&(delete this[s],o=!0)}return o}normalize(t){let r=this,n={};return a.forEach(this,(o,s)=>{let i=a.findKey(n,s);if(i){r[i]=re(o),delete r[s];return}let c=t?sr(s):String(s).trim();c!==s&&delete r[s],r[c]=re(o),n[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return a.forEach(this,(n,o)=>{n!=null&&n!==!1&&(r[o]=t&&a.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
3
- `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let n=new this(t);return r.forEach(o=>n.set(o)),n}static accessor(t){let n=(this[We]=this[We]={accessors:{}}).accessors,o=this.prototype;function s(i){let c=H(i);n[c]||(ir(o,i),n[c]=!0)}return a.isArray(t)?t.forEach(s):s(t),this}};D.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.freezeMethods(D.prototype);a.freezeMethods(D);var A=D;function q(e,t){let r=this||_,n=t||r,o=A.from(n.headers),s=n.data;return a.forEach(e,function(c){s=c.call(r,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function M(e){return!!(e&&e.__CANCEL__)}function Ke(e,t,r){m.call(this,e??"canceled",m.ERR_CANCELED,t,r),this.name="CanceledError"}a.inherits(Ke,m,{__CANCEL__:!0});var C=Ke;function ye(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new m("Request failed with status code "+r.status,[m.ERR_BAD_REQUEST,m.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}var Ge=b.isStandardBrowserEnv?function(){return{write:function(r,n,o,s,i,c){let d=[];d.push(r+"="+encodeURIComponent(n)),a.isNumber(o)&&d.push("expires="+new Date(o).toGMTString()),a.isString(s)&&d.push("path="+s),a.isString(i)&&d.push("domain="+i),c===!0&&d.push("secure"),document.cookie=d.join("; ")},read:function(r){let n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function Ee(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function we(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function J(e,t){return e&&!Ee(t)?we(e,t):t}var Xe=b.isStandardBrowserEnv?function(){let t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function o(s){let i=s;return t&&(r.setAttribute("href",i),i=r.href),r.setAttribute("href",i),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=o(window.location.href),function(i){let c=a.isString(i)?o(i):i;return c.protocol===n.protocol&&c.host===n.host}}():function(){return function(){return!0}}();function be(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function ar(e,t){e=e||10;let r=new Array(e),n=new Array(e),o=0,s=0,i;return t=t!==void 0?t:1e3,function(d){let l=Date.now(),u=n[s];i||(i=l),r[o]=d,n[o]=l;let p=s,w=0;for(;p!==o;)w+=r[p++],p=p%e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),l-i<t)return;let y=u&&l-u;return y?Math.round(w*1e3/y):void 0}}var Ye=ar;function Qe(e,t){let r=0,n=Ye(50,250);return o=>{let s=o.loaded,i=o.lengthComputable?o.total:void 0,c=s-r,d=n(c),l=s<=i;r=s;let u={loaded:s,total:i,progress:i?s/i:void 0,bytes:c,rate:d||void 0,estimated:d&&i&&l?(i-s)/d:void 0,event:o};u[t?"download":"upload"]=!0,e(u)}}var cr=typeof XMLHttpRequest<"u",Ze=cr&&function(e){return new Promise(function(r,n){let o=e.data,s=A.from(e.headers).normalize(),i=e.responseType,c;function d(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}a.isFormData(o)&&(b.isStandardBrowserEnv||b.isStandardBrowserWebWorkerEnv?s.setContentType(!1):s.setContentType("multipart/form-data;",!1));let l=new XMLHttpRequest;if(e.auth){let y=e.auth.username||"",f=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.set("Authorization","Basic "+btoa(y+":"+f))}let u=J(e.baseURL,e.url);l.open(e.method.toUpperCase(),I(u,e.params,e.paramsSerializer),!0),l.timeout=e.timeout;function p(){if(!l)return;let y=A.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders()),h={data:!i||i==="text"||i==="json"?l.responseText:l.response,status:l.status,statusText:l.statusText,headers:y,config:e,request:l};ye(function(x){r(x),d()},function(x){n(x),d()},h),l=null}if("onloadend"in l?l.onloadend=p:l.onreadystatechange=function(){!l||l.readyState!==4||l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)||setTimeout(p)},l.onabort=function(){l&&(n(new m("Request aborted",m.ECONNABORTED,e,l)),l=null)},l.onerror=function(){n(new m("Network Error",m.ERR_NETWORK,e,l)),l=null},l.ontimeout=function(){let f=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",h=e.transitional||Z;e.timeoutErrorMessage&&(f=e.timeoutErrorMessage),n(new m(f,h.clarifyTimeoutError?m.ETIMEDOUT:m.ECONNABORTED,e,l)),l=null},b.isStandardBrowserEnv){let y=(e.withCredentials||Xe(u))&&e.xsrfCookieName&&Ge.read(e.xsrfCookieName);y&&s.set(e.xsrfHeaderName,y)}o===void 0&&s.setContentType(null),"setRequestHeader"in l&&a.forEach(s.toJSON(),function(f,h){l.setRequestHeader(h,f)}),a.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),i&&i!=="json"&&(l.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&l.addEventListener("progress",Qe(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&l.upload&&l.upload.addEventListener("progress",Qe(e.onUploadProgress)),(e.cancelToken||e.signal)&&(c=y=>{l&&(n(!y||y.type?new C(null,e,l):y),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c)));let w=be(u);if(w&&b.protocols.indexOf(w)===-1){n(new m("Unsupported protocol "+w+":",m.ERR_BAD_REQUEST,e));return}l.send(o||null)})};var ne={http:Y,xhr:Ze};a.forEach(ne,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var et={getAdapter:e=>{e=a.isArray(e)?e:[e];let{length:t}=e,r,n;for(let o=0;o<t&&(r=e[o],!(n=a.isString(r)?ne[r.toLowerCase()]:r));o++);if(!n)throw n===!1?new m(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT"):new Error(a.hasOwnProp(ne,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`);if(!a.isFunction(n))throw new TypeError("adapter is not a function");return n},adapters:ne};function Ae(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new C(null,e)}function oe(e){return Ae(e),e.headers=A.from(e.headers),e.data=q.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),et.getAdapter(e.adapter||_.adapter)(e).then(function(n){return Ae(e),n.data=q.call(e,e.transformResponse,n),n.headers=A.from(n.headers),n},function(n){return M(n)||(Ae(e),n&&n.response&&(n.response.data=q.call(e,e.transformResponse,n.response),n.response.headers=A.from(n.response.headers))),Promise.reject(n)})}var tt=e=>e instanceof A?e.toJSON():e;function g(e,t){t=t||{};let r={};function n(l,u,p){return a.isPlainObject(l)&&a.isPlainObject(u)?a.merge.call({caseless:p},l,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function o(l,u,p){if(a.isUndefined(u)){if(!a.isUndefined(l))return n(void 0,l,p)}else return n(l,u,p)}function s(l,u){if(!a.isUndefined(u))return n(void 0,u)}function i(l,u){if(a.isUndefined(u)){if(!a.isUndefined(l))return n(void 0,l)}else return n(void 0,u)}function c(l,u,p){if(p in t)return n(l,u);if(p in e)return n(void 0,l)}let d={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(l,u)=>o(tt(l),tt(u),!0)};return a.forEach(Object.keys(Object.assign({},e,t)),function(u){let p=d[u]||o,w=p(e[u],t[u],u);a.isUndefined(w)&&p!==c||(r[u]=w)}),r}var se="1.4.0";var Se={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Se[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});var rt={};Se.transitional=function(t,r,n){function o(s,i){return"[Axios v"+se+"] Transitional option '"+s+"'"+i+(n?". "+n:"")}return(s,i,c)=>{if(t===!1)throw new m(o(i," has been removed"+(r?" in "+r:"")),m.ERR_DEPRECATED);return r&&!rt[i]&&(rt[i]=!0,console.warn(o(i," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(s,i,c):!0}};function lr(e,t,r){if(typeof e!="object")throw new m("options must be an object",m.ERR_BAD_OPTION_VALUE);let n=Object.keys(e),o=n.length;for(;o-- >0;){let s=n[o],i=t[s];if(i){let c=e[s],d=c===void 0||i(c,s,e);if(d!==!0)throw new m("option "+s+" must be "+d,m.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new m("Unknown option "+s,m.ERR_BAD_OPTION)}}var ie={assertOptions:lr,validators:Se};var N=ie.validators,L=class{constructor(t){this.defaults=t,this.interceptors={request:new pe,response:new pe}}request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=g(this.defaults,r);let{transitional:n,paramsSerializer:o,headers:s}=r;n!==void 0&&ie.assertOptions(n,{silentJSONParsing:N.transitional(N.boolean),forcedJSONParsing:N.transitional(N.boolean),clarifyTimeoutError:N.transitional(N.boolean)},!1),o!=null&&(a.isFunction(o)?r.paramsSerializer={serialize:o}:ie.assertOptions(o,{encode:N.function,serialize:N.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i;i=s&&a.merge(s.common,s[r.method]),i&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete s[f]}),r.headers=A.concat(i,s);let c=[],d=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(r)===!1||(d=d&&h.synchronous,c.unshift(h.fulfilled,h.rejected))});let l=[];this.interceptors.response.forEach(function(h){l.push(h.fulfilled,h.rejected)});let u,p=0,w;if(!d){let f=[oe.bind(this),void 0];for(f.unshift.apply(f,c),f.push.apply(f,l),w=f.length,u=Promise.resolve(r);p<w;)u=u.then(f[p++],f[p++]);return u}w=c.length;let y=r;for(p=0;p<w;){let f=c[p++],h=c[p++];try{y=f(y)}catch(O){h.call(this,O);break}}try{u=oe.call(this,y)}catch(f){return Promise.reject(f)}for(p=0,w=l.length;p<w;)u=u.then(l[p++],l[p++]);return u}getUri(t){t=g(this.defaults,t);let r=J(t.baseURL,t.url);return I(r,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){L.prototype[t]=function(r,n){return this.request(g(n||{},{method:t,url:r,data:(n||{}).data}))}});a.forEach(["post","put","patch"],function(t){function r(n){return function(s,i,c){return this.request(g(c||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}L.prototype[t]=r(),L.prototype[t+"Form"]=r(!0)});var z=L;var v=class{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(s){r=s});let n=this;this.promise.then(o=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](o);n._listeners=null}),this.promise.then=o=>{let s,i=new Promise(c=>{n.subscribe(c),s=c}).then(o);return i.cancel=function(){n.unsubscribe(s)},i},t(function(s,i,c){n.reason||(n.reason=new C(s,i,c),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}static source(){let t;return{token:new v(function(o){t=o}),cancel:t}}},nt=v;function xe(e){return function(r){return e.apply(null,r)}}function Re(e){return a.isObject(e)&&e.isAxiosError===!0}var Oe={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(Oe).forEach(([e,t])=>{Oe[t]=e});var ot=Oe;function st(e){let t=new z(e),r=B(z.prototype.request,t);return a.extend(r,z.prototype,t,{allOwnKeys:!0}),a.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return st(g(e,o))},r}var E=st(_);E.Axios=z;E.CanceledError=C;E.CancelToken=nt;E.isCancel=M;E.VERSION=se;E.toFormData=T;E.AxiosError=m;E.Cancel=E.CanceledError;E.all=function(t){return Promise.all(t)};E.spread=xe;E.isAxiosError=Re;E.mergeConfig=g;E.AxiosHeaders=A;E.formToJSON=e=>ee(a.isHTMLForm(e)?new FormData(e):e);E.HttpStatusCode=ot;E.default=E;var ae=E;var{Axios:Xo,AxiosError:Yo,CanceledError:Qo,isCancel:Zo,CancelToken:es,VERSION:ts,all:rs,Cancel:ns,isAxiosError:os,spread:ss,toFormData:is,AxiosHeaders:as,HttpStatusCode:cs,formToJSON:ls,mergeConfig:us}=ae;var V=class{constructor({theme:t="light",render_element_or_id:r="recaptcha-el"}){this.gl_api_url="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit",this.captcha_sitekey="6LeRUzsjAAAAANUHNEY6VkUXmMo_wlrDK5SUoFUV",this.verify_url="https://internalapi.activamedia.com.sg/v1/recaptcha/verify",this.theme=t,this.render_element_or_id=r,this.defineOnloadCallBack(),this.loadJsFile()}defineOnloadCallBack(){window.onloadCallback=()=>{}}loadJsFile(){if(document.querySelectorAll(`script[src="${this.gl_api_url}"]`).length===0){var t=document.createElement("script");t.setAttribute("src",this.gl_api_url),t.setAttribute("type","text/javascript"),t.setAttribute("async",!0),t.setAttribute("defer",!0),document.body.appendChild(t)}}sleep(t){return new Promise(r=>setTimeout(r,t))}async render(){let t="";for(;;){if(await this.sleep(200),typeof grecaptcha<"u"&&grecaptcha!==void 0&&typeof grecaptcha.render=="function"){t=grecaptcha.render(this.render_element_or_id,{sitekey:this.captcha_sitekey,theme:this.theme});break}console.info("checking grecaptcha undefined")}return t}reset(t){grecaptcha.reset(t)}fetchResponse(t){try{return grecaptcha.getResponse(t)}catch(r){console.error(r)}}async verifyRecaptcha(t){return await fetch(this.verify_url,{method:"post",body:JSON.stringify({token:t}),headers:{Accept:"application/json","Content-Type":"application/json"}}).then(r=>r.json())}};var ge={config:{},name:null,endpoint:null,redirectTo:null,fileUpload:{filepond:null,el:null},onSuccess(e){},onFailed(e){},captchaId:null,recaptchaTheme:"light"};function at(e){document.addEventListener("alpine:init",()=>{for(let t of e){let r=Object.assign({},ge,t);document.addEventListener("alpine:init",pr(r))}})}async function ur(e){if(e.captchaId){let t=document.getElementById(e.captchaId);if(t)e.amCaptcha=new V({theme:this.recaptchaTheme,render_element_or_id:t}),e.widgetId=await e.amCaptcha.render();else throw"Can't find recaptcha rendering element. by id: "+this.captchaId}}function fr(e){if(console.log("\u{1F4E2} Form name: "+e.name),typeof e.redirectTo!="function"&&e.redirectTo.length&&new URL(e.endpoint).host==="hapiform.sg"&&console.log("\u{1F680} "+window.location.origin+e.redirectTo),e.endpoint){let t=new URL(e.endpoint),r=e.endpoint.match(/[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/);t.host==="hapiform.sg"&&console.log(`\u{1F680} ${t.origin}/${r}`)}}async function dr(e){let t=e.amCaptcha.fetchResponse(e.widgetId);if(t.length===0)throw{recaptchaError:"You can't leave Captcha Code empty"};return await e.amCaptcha.verifyRecaptcha(t).then(r=>{if(r.success===!1)throw{recaptchaError:"captcha invalid: timeout or duplicate."}})}function it(e,t){ae(e).then(r=>{t.redirectTo&&(window.location.href=t.redirectTo),t.fileUpload.filepond&&t.fileUpload.filepond.removeFiles(),mr(),t.resetFields(),t.onSuccess(r),Er()}).catch(r=>{t.errors=r.response.data.errors,t.busy=!1,t.onFailed(r.response),wr(),t.captchaId&&t.amCaptcha.reset(t.widgetId)})}async function pr(e){Alpine.data(e.name,()=>({...e,errors:{},busy:!1,amCaptcha:null,widgetId:null,async init(){Alpine.store(e.name,{fields:{}}),this.$watch("busy",t=>{let r=this.$el.querySelectorAll('form button, form input[type="submit"], form input[type="button"]');t?r.forEach(n=>{n.disabled=!0}):r.forEach(n=>{n.disabled=!1})}),this.$init&&this.$init(),ur(this).catch(t=>console.error(t)),fr(this)},async submit(){this.busy=!0,this.errors={};let t=new FormData,r=Alpine.store(this.name).fields;if(Object.keys(r).forEach((c,d)=>{typeof r[c]=="object"?r[c].forEach((l,u)=>{t.append(`${c}[${u}]`,l)}):t.append(c,r[c])}),e.fileUpload.filepond)e.fileUpload.filepond.getFiles().forEach((c,d)=>{t.append(`files[${d}]`,c.file,c.name)});else if(e.fileUpload.el){let d=document.querySelector(e.fileUpload.el).files;for(let l=0;l<d.length;l++)t.append(`files[${l}]`,d[l],d[l].name)}let o=new URL(window.top.location.href);t.append("x_origin",o.origin+o.pathname);let s={method:"POST",url:br(e.endpoint),data:t},i=Object.assign({},s,e.config);this.captchaId?await dr(this).then(()=>{it(i,this)}).catch(c=>{this.errors=c,e.onFailed(c),this.busy=!1}).finally(()=>{}):it(i,this)},resetFields(){this.errors={},Alpine.store(this.name).fields={},this.busy=!1,this.captchaId&&this.amCaptcha.reset(this.widgetId)}}))}function mr(){hr(),yr()}function hr(){try{ge.fileUpload.filepond.removeFiles()}catch{}}function yr(){try{let e=document.querySelector(ge.fileUpload.el);e.value=""}catch{}}function Er(){ct("hapi:success")}function wr(){ct("hapi:error")}function ct(e){let t=new Event(e);document.dispatchEvent(t)}function br(e){let t=new URL(e);return(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&(t.searchParams.set("test","1"),console.log("testing mode!")),t.href}function Te(){if(document.querySelectorAll('script[src="//unpkg.com/alpinejs"]').length===0){var e=document.createElement("script");e.setAttribute("src","//unpkg.com/alpinejs"),e.setAttribute("type","text/javascript"),e.setAttribute("defer",!0),document.body.appendChild(e)}}var lt={forms:at},ws=lt;window.Hapi=lt;Te();})();
1
+ (()=>{function B(e,t){return function(){return e.apply(t,arguments)}}var{toString:dt}=Object.prototype,{getPrototypeOf:le}=Object,K=(e=>t=>{let r=dt.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),x=e=>(e=e.toLowerCase(),t=>K(t)===e),G=e=>t=>typeof t===e,{isArray:P}=Array,j=G("undefined");function pt(e){return e!==null&&!j(e)&&e.constructor!==null&&!j(e.constructor)&&A(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var Fe=x("ArrayBuffer");function mt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Fe(e.buffer),t}var ht=G("string"),A=G("function"),Pe=G("number"),X=e=>e!==null&&typeof e=="object",yt=e=>e===!0||e===!1,W=e=>{if(K(e)!=="object")return!1;let t=le(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},wt=x("Date"),Et=x("File"),bt=x("Blob"),St=x("FileList"),At=e=>X(e)&&A(e.pipe),gt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||A(e.append)&&((t=K(e))==="formdata"||t==="object"&&A(e.toString)&&e.toString()==="[object FormData]"))},xt=x("URLSearchParams"),Rt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function k(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,o;if(typeof e!="object"&&(e=[e]),P(e))for(n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else{let i=r?Object.getOwnPropertyNames(e):Object.keys(e),s=i.length,l;for(n=0;n<s;n++)l=i[n],t.call(null,e[l],l,e)}}function Ue(e,t){t=t.toLowerCase();let r=Object.keys(e),n=r.length,o;for(;n-- >0;)if(o=r[n],t===o.toLowerCase())return o;return null}var _e=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),De=e=>!j(e)&&e!==_e;function ce(){let{caseless:e}=De(this)&&this||{},t={},r=(n,o)=>{let i=e&&Ue(t,o)||o;W(t[i])&&W(n)?t[i]=ce(t[i],n):W(n)?t[i]=ce({},n):P(n)?t[i]=n.slice():t[i]=n};for(let n=0,o=arguments.length;n<o;n++)arguments[n]&&k(arguments[n],r);return t}var Ot=(e,t,r,{allOwnKeys:n}={})=>(k(t,(o,i)=>{r&&A(o)?e[i]=B(o,r):e[i]=o},{allOwnKeys:n}),e),Tt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Ct=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},Nt=(e,t,r,n)=>{let o,i,s,l={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)s=o[i],(!n||n(s,e,t))&&!l[s]&&(t[s]=e[s],l[s]=!0);e=r!==!1&&le(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Ft=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},Pt=e=>{if(!e)return null;if(P(e))return e;let t=e.length;if(!Pe(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Ut=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&le(Uint8Array)),_t=(e,t)=>{let n=(e&&e[Symbol.iterator]).call(e),o;for(;(o=n.next())&&!o.done;){let i=o.value;t.call(e,i[0],i[1])}},Dt=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Lt=x("HTMLFormElement"),Bt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,o){return n.toUpperCase()+o}),Ce=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),jt=x("RegExp"),Le=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};k(r,(o,i)=>{t(o,i,e)!==!1&&(n[i]=o)}),Object.defineProperties(e,n)},kt=e=>{Le(e,(t,r)=>{if(A(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(A(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},It=(e,t)=>{let r={},n=o=>{o.forEach(i=>{r[i]=!0})};return P(e)?n(e):n(String(e).split(t)),r},Ht=()=>{},qt=(e,t)=>(e=+e,Number.isFinite(e)?e:t),ae="abcdefghijklmnopqrstuvwxyz",Ne="0123456789",Be={DIGIT:Ne,ALPHA:ae,ALPHA_DIGIT:ae+ae.toUpperCase()+Ne},Mt=(e=16,t=Be.ALPHA_DIGIT)=>{let r="",{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};function Jt(e){return!!(e&&A(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var zt=e=>{let t=new Array(10),r=(n,o)=>{if(X(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[o]=n;let i=P(n)?[]:{};return k(n,(s,l)=>{let f=r(s,o+1);!j(f)&&(i[l]=f)}),t[o]=void 0,i}}return n};return r(e,0)},vt=x("AsyncFunction"),Vt=e=>e&&(X(e)||A(e))&&A(e.then)&&A(e.catch),a={isArray:P,isArrayBuffer:Fe,isBuffer:pt,isFormData:gt,isArrayBufferView:mt,isString:ht,isNumber:Pe,isBoolean:yt,isObject:X,isPlainObject:W,isUndefined:j,isDate:wt,isFile:Et,isBlob:bt,isRegExp:jt,isFunction:A,isStream:At,isURLSearchParams:xt,isTypedArray:Ut,isFileList:St,forEach:k,merge:ce,extend:Ot,trim:Rt,stripBOM:Tt,inherits:Ct,toFlatObject:Nt,kindOf:K,kindOfTest:x,endsWith:Ft,toArray:Pt,forEachEntry:_t,matchAll:Dt,isHTMLForm:Lt,hasOwnProperty:Ce,hasOwnProp:Ce,reduceDescriptors:Le,freezeMethods:kt,toObjectSet:It,toCamelCase:Bt,noop:Ht,toFiniteNumber:qt,findKey:Ue,global:_e,isContextDefined:De,ALPHABET:Be,generateString:Mt,isSpecCompliantForm:Jt,toJSONObject:zt,isAsyncFn:vt,isThenable:Vt};function U(e,t,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o)}a.inherits(U,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:a.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var je=U.prototype,ke={};["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(e=>{ke[e]={value:e}});Object.defineProperties(U,ke);Object.defineProperty(je,"isAxiosError",{value:!0});U.from=(e,t,r,n,o,i)=>{let s=Object.create(je);return a.toFlatObject(e,s,function(f){return f!==Error.prototype},l=>l!=="isAxiosError"),U.call(s,e.message,t,r,n,o),s.cause=e,s.name=e.name,i&&Object.assign(s,i),s};var m=U;var Y=null;function ue(e){return a.isPlainObject(e)||a.isArray(e)}function He(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function Ie(e,t,r){return e?e.concat(t).map(function(o,i){return o=He(o),!r&&i?"["+o+"]":o}).join(r?".":""):t}function $t(e){return a.isArray(e)&&!e.some(ue)}var Wt=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function Kt(e,t,r){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new(Y||FormData),r=a.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(h,R){return!a.isUndefined(R[h])});let n=r.metaTokens,o=r.visitor||u,i=r.dots,s=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(o))throw new TypeError("visitor must be a function");function c(d){if(d===null)return"";if(a.isDate(d))return d.toISOString();if(!f&&a.isBlob(d))throw new m("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(d)||a.isTypedArray(d)?f&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function u(d,h,R){let g=d;if(d&&!R&&typeof d=="object"){if(a.endsWith(h,"{}"))h=n?h:h.slice(0,-2),d=JSON.stringify(d);else if(a.isArray(d)&&$t(d)||(a.isFileList(d)||a.endsWith(h,"[]"))&&(g=a.toArray(d)))return h=He(h),g.forEach(function($,ft){!(a.isUndefined($)||$===null)&&t.append(s===!0?Ie([h],ft,i):s===null?h:h+"[]",c($))}),!1}return ue(d)?!0:(t.append(Ie(R,h,i),c(d)),!1)}let p=[],E=Object.assign(Wt,{defaultVisitor:u,convertValue:c,isVisitable:ue});function y(d,h){if(!a.isUndefined(d)){if(p.indexOf(d)!==-1)throw Error("Circular reference detected in "+h.join("."));p.push(d),a.forEach(d,function(g,F){(!(a.isUndefined(g)||g===null)&&o.call(t,g,a.isString(F)?F.trim():F,h,E))===!0&&y(g,h?h.concat(F):[F])}),p.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return y(e),t}var T=Kt;function qe(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Me(e,t){this._pairs=[],e&&T(e,this,t)}var Je=Me.prototype;Je.append=function(t,r){this._pairs.push([t,r])};Je.toString=function(t){let r=t?function(n){return t.call(this,n,qe)}:qe;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};var Q=Me;function Gt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function I(e,t,r){if(!t)return e;let n=r&&r.encode||Gt,o=r&&r.serialize,i;if(o?i=o(t,r):i=a.isURLSearchParams(t)?t.toString():new Q(t,r).toString(n),i){let s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}var fe=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(n){n!==null&&t(n)})}},de=fe;var Z={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var ze=typeof URLSearchParams<"u"?URLSearchParams:Q;var ve=typeof FormData<"u"?FormData:null;var Ve=typeof Blob<"u"?Blob:null;var Xt=(()=>{let e;return typeof navigator<"u"&&((e=navigator.product)==="ReactNative"||e==="NativeScript"||e==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),Yt=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),b={isBrowser:!0,classes:{URLSearchParams:ze,FormData:ve,Blob:Ve},isStandardBrowserEnv:Xt,isStandardBrowserWebWorkerEnv:Yt,protocols:["http","https","file","blob","url","data"]};function pe(e,t){return T(e,new b.classes.URLSearchParams,Object.assign({visitor:function(r,n,o,i){return b.isNode&&a.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}function Qt(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Zt(e){let t={},r=Object.keys(e),n,o=r.length,i;for(n=0;n<o;n++)i=r[n],t[i]=e[i];return t}function er(e){function t(r,n,o,i){let s=r[i++],l=Number.isFinite(+s),f=i>=r.length;return s=!s&&a.isArray(o)?o.length:s,f?(a.hasOwnProp(o,s)?o[s]=[o[s],n]:o[s]=n,!l):((!o[s]||!a.isObject(o[s]))&&(o[s]=[]),t(r,n,o[s],i)&&a.isArray(o[s])&&(o[s]=Zt(o[s])),!l)}if(a.isFormData(e)&&a.isFunction(e.entries)){let r={};return a.forEachEntry(e,(n,o)=>{t(Qt(n),o,r,0)}),r}return null}var ee=er;var tr={"Content-Type":void 0};function rr(e,t,r){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var te={transitional:Z,adapter:["xhr","http"],transformRequest:[function(t,r){let n=r.getContentType()||"",o=n.indexOf("application/json")>-1,i=a.isObject(t);if(i&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return o&&o?JSON.stringify(ee(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return pe(t,this.formSerializer).toString();if((l=a.isFileList(t))||n.indexOf("multipart/form-data")>-1){let f=this.env&&this.env.FormData;return T(l?{"files[]":t}:t,f&&new f,this.formSerializer)}}return i||o?(r.setContentType("application/json",!1),rr(t)):t}],transformResponse:[function(t){let r=this.transitional||te.transitional,n=r&&r.forcedJSONParsing,o=this.responseType==="json";if(t&&a.isString(t)&&(n&&!this.responseType||o)){let s=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(l){if(s)throw l.name==="SyntaxError"?m.from(l,m.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:b.classes.FormData,Blob:b.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};a.forEach(["delete","get","head"],function(t){te.headers[t]={}});a.forEach(["post","put","patch"],function(t){te.headers[t]=a.merge(tr)});var _=te;var nr=a.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"]),$e=e=>{let t={},r,n,o;return e&&e.split(`
2
+ `).forEach(function(s){o=s.indexOf(":"),r=s.substring(0,o).trim().toLowerCase(),n=s.substring(o+1).trim(),!(!r||t[r]&&nr[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};var We=Symbol("internals");function H(e){return e&&String(e).trim().toLowerCase()}function re(e){return e===!1||e==null?e:a.isArray(e)?e.map(re):String(e)}function or(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}var ir=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function me(e,t,r,n,o){if(a.isFunction(n))return n.call(this,t,r);if(o&&(t=r),!!a.isString(t)){if(a.isString(n))return t.indexOf(n)!==-1;if(a.isRegExp(n))return n.test(t)}}function sr(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function ar(e,t){let r=a.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(o,i,s){return this[n].call(this,t,o,i,s)},configurable:!0})})}var D=class{constructor(t){t&&this.set(t)}set(t,r,n){let o=this;function i(l,f,c){let u=H(f);if(!u)throw new Error("header name must be a non-empty string");let p=a.findKey(o,u);(!p||o[p]===void 0||c===!0||c===void 0&&o[p]!==!1)&&(o[p||f]=re(l))}let s=(l,f)=>a.forEach(l,(c,u)=>i(c,u,f));return a.isPlainObject(t)||t instanceof this.constructor?s(t,r):a.isString(t)&&(t=t.trim())&&!ir(t)?s($e(t),r):t!=null&&i(r,t,n),this}get(t,r){if(t=H(t),t){let n=a.findKey(this,t);if(n){let o=this[n];if(!r)return o;if(r===!0)return or(o);if(a.isFunction(r))return r.call(this,o,n);if(a.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=H(t),t){let n=a.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||me(this,this[n],n,r)))}return!1}delete(t,r){let n=this,o=!1;function i(s){if(s=H(s),s){let l=a.findKey(n,s);l&&(!r||me(n,n[l],l,r))&&(delete n[l],o=!0)}}return a.isArray(t)?t.forEach(i):i(t),o}clear(t){let r=Object.keys(this),n=r.length,o=!1;for(;n--;){let i=r[n];(!t||me(this,this[i],i,t,!0))&&(delete this[i],o=!0)}return o}normalize(t){let r=this,n={};return a.forEach(this,(o,i)=>{let s=a.findKey(n,i);if(s){r[s]=re(o),delete r[i];return}let l=t?sr(i):String(i).trim();l!==i&&delete r[i],r[l]=re(o),n[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return a.forEach(this,(n,o)=>{n!=null&&n!==!1&&(r[o]=t&&a.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
3
+ `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let n=new this(t);return r.forEach(o=>n.set(o)),n}static accessor(t){let n=(this[We]=this[We]={accessors:{}}).accessors,o=this.prototype;function i(s){let l=H(s);n[l]||(ar(o,s),n[l]=!0)}return a.isArray(t)?t.forEach(i):i(t),this}};D.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.freezeMethods(D.prototype);a.freezeMethods(D);var S=D;function q(e,t){let r=this||_,n=t||r,o=S.from(n.headers),i=n.data;return a.forEach(e,function(l){i=l.call(r,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function M(e){return!!(e&&e.__CANCEL__)}function Ke(e,t,r){m.call(this,e??"canceled",m.ERR_CANCELED,t,r),this.name="CanceledError"}a.inherits(Ke,m,{__CANCEL__:!0});var C=Ke;function he(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new m("Request failed with status code "+r.status,[m.ERR_BAD_REQUEST,m.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}var Ge=b.isStandardBrowserEnv?function(){return{write:function(r,n,o,i,s,l){let f=[];f.push(r+"="+encodeURIComponent(n)),a.isNumber(o)&&f.push("expires="+new Date(o).toGMTString()),a.isString(i)&&f.push("path="+i),a.isString(s)&&f.push("domain="+s),l===!0&&f.push("secure"),document.cookie=f.join("; ")},read:function(r){let n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function ye(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function we(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function J(e,t){return e&&!ye(t)?we(e,t):t}var Xe=b.isStandardBrowserEnv?function(){let t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function o(i){let s=i;return t&&(r.setAttribute("href",s),s=r.href),r.setAttribute("href",s),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=o(window.location.href),function(s){let l=a.isString(s)?o(s):s;return l.protocol===n.protocol&&l.host===n.host}}():function(){return function(){return!0}}();function Ee(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function cr(e,t){e=e||10;let r=new Array(e),n=new Array(e),o=0,i=0,s;return t=t!==void 0?t:1e3,function(f){let c=Date.now(),u=n[i];s||(s=c),r[o]=f,n[o]=c;let p=i,E=0;for(;p!==o;)E+=r[p++],p=p%e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-s<t)return;let y=u&&c-u;return y?Math.round(E*1e3/y):void 0}}var Ye=cr;function Qe(e,t){let r=0,n=Ye(50,250);return o=>{let i=o.loaded,s=o.lengthComputable?o.total:void 0,l=i-r,f=n(l),c=i<=s;r=i;let u={loaded:i,total:s,progress:s?i/s:void 0,bytes:l,rate:f||void 0,estimated:f&&s&&c?(s-i)/f:void 0,event:o};u[t?"download":"upload"]=!0,e(u)}}var lr=typeof XMLHttpRequest<"u",Ze=lr&&function(e){return new Promise(function(r,n){let o=e.data,i=S.from(e.headers).normalize(),s=e.responseType,l;function f(){e.cancelToken&&e.cancelToken.unsubscribe(l),e.signal&&e.signal.removeEventListener("abort",l)}a.isFormData(o)&&(b.isStandardBrowserEnv||b.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let c=new XMLHttpRequest;if(e.auth){let y=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(y+":"+d))}let u=J(e.baseURL,e.url);c.open(e.method.toUpperCase(),I(u,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function p(){if(!c)return;let y=S.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders()),h={data:!s||s==="text"||s==="json"?c.responseText:c.response,status:c.status,statusText:c.statusText,headers:y,config:e,request:c};he(function(g){r(g),f()},function(g){n(g),f()},h),c=null}if("onloadend"in c?c.onloadend=p:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(p)},c.onabort=function(){c&&(n(new m("Request aborted",m.ECONNABORTED,e,c)),c=null)},c.onerror=function(){n(new m("Network Error",m.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let d=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",h=e.transitional||Z;e.timeoutErrorMessage&&(d=e.timeoutErrorMessage),n(new m(d,h.clarifyTimeoutError?m.ETIMEDOUT:m.ECONNABORTED,e,c)),c=null},b.isStandardBrowserEnv){let y=(e.withCredentials||Xe(u))&&e.xsrfCookieName&&Ge.read(e.xsrfCookieName);y&&i.set(e.xsrfHeaderName,y)}o===void 0&&i.setContentType(null),"setRequestHeader"in c&&a.forEach(i.toJSON(),function(d,h){c.setRequestHeader(h,d)}),a.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),s&&s!=="json"&&(c.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&c.addEventListener("progress",Qe(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",Qe(e.onUploadProgress)),(e.cancelToken||e.signal)&&(l=y=>{c&&(n(!y||y.type?new C(null,e,c):y),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(l),e.signal&&(e.signal.aborted?l():e.signal.addEventListener("abort",l)));let E=Ee(u);if(E&&b.protocols.indexOf(E)===-1){n(new m("Unsupported protocol "+E+":",m.ERR_BAD_REQUEST,e));return}c.send(o||null)})};var ne={http:Y,xhr:Ze};a.forEach(ne,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var et={getAdapter:e=>{e=a.isArray(e)?e:[e];let{length:t}=e,r,n;for(let o=0;o<t&&(r=e[o],!(n=a.isString(r)?ne[r.toLowerCase()]:r));o++);if(!n)throw n===!1?new m(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT"):new Error(a.hasOwnProp(ne,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`);if(!a.isFunction(n))throw new TypeError("adapter is not a function");return n},adapters:ne};function be(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new C(null,e)}function oe(e){return be(e),e.headers=S.from(e.headers),e.data=q.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),et.getAdapter(e.adapter||_.adapter)(e).then(function(n){return be(e),n.data=q.call(e,e.transformResponse,n),n.headers=S.from(n.headers),n},function(n){return M(n)||(be(e),n&&n.response&&(n.response.data=q.call(e,e.transformResponse,n.response),n.response.headers=S.from(n.response.headers))),Promise.reject(n)})}var tt=e=>e instanceof S?e.toJSON():e;function O(e,t){t=t||{};let r={};function n(c,u,p){return a.isPlainObject(c)&&a.isPlainObject(u)?a.merge.call({caseless:p},c,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function o(c,u,p){if(a.isUndefined(u)){if(!a.isUndefined(c))return n(void 0,c,p)}else return n(c,u,p)}function i(c,u){if(!a.isUndefined(u))return n(void 0,u)}function s(c,u){if(a.isUndefined(u)){if(!a.isUndefined(c))return n(void 0,c)}else return n(void 0,u)}function l(c,u,p){if(p in t)return n(c,u);if(p in e)return n(void 0,c)}let f={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:l,headers:(c,u)=>o(tt(c),tt(u),!0)};return a.forEach(Object.keys(Object.assign({},e,t)),function(u){let p=f[u]||o,E=p(e[u],t[u],u);a.isUndefined(E)&&p!==l||(r[u]=E)}),r}var ie="1.4.0";var Se={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Se[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});var rt={};Se.transitional=function(t,r,n){function o(i,s){return"[Axios v"+ie+"] Transitional option '"+i+"'"+s+(n?". "+n:"")}return(i,s,l)=>{if(t===!1)throw new m(o(s," has been removed"+(r?" in "+r:"")),m.ERR_DEPRECATED);return r&&!rt[s]&&(rt[s]=!0,console.warn(o(s," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,s,l):!0}};function ur(e,t,r){if(typeof e!="object")throw new m("options must be an object",m.ERR_BAD_OPTION_VALUE);let n=Object.keys(e),o=n.length;for(;o-- >0;){let i=n[o],s=t[i];if(s){let l=e[i],f=l===void 0||s(l,i,e);if(f!==!0)throw new m("option "+i+" must be "+f,m.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new m("Unknown option "+i,m.ERR_BAD_OPTION)}}var se={assertOptions:ur,validators:Se};var N=se.validators,L=class{constructor(t){this.defaults=t,this.interceptors={request:new de,response:new de}}request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=O(this.defaults,r);let{transitional:n,paramsSerializer:o,headers:i}=r;n!==void 0&&se.assertOptions(n,{silentJSONParsing:N.transitional(N.boolean),forcedJSONParsing:N.transitional(N.boolean),clarifyTimeoutError:N.transitional(N.boolean)},!1),o!=null&&(a.isFunction(o)?r.paramsSerializer={serialize:o}:se.assertOptions(o,{encode:N.function,serialize:N.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let s;s=i&&a.merge(i.common,i[r.method]),s&&a.forEach(["delete","get","head","post","put","patch","common"],d=>{delete i[d]}),r.headers=S.concat(s,i);let l=[],f=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(r)===!1||(f=f&&h.synchronous,l.unshift(h.fulfilled,h.rejected))});let c=[];this.interceptors.response.forEach(function(h){c.push(h.fulfilled,h.rejected)});let u,p=0,E;if(!f){let d=[oe.bind(this),void 0];for(d.unshift.apply(d,l),d.push.apply(d,c),E=d.length,u=Promise.resolve(r);p<E;)u=u.then(d[p++],d[p++]);return u}E=l.length;let y=r;for(p=0;p<E;){let d=l[p++],h=l[p++];try{y=d(y)}catch(R){h.call(this,R);break}}try{u=oe.call(this,y)}catch(d){return Promise.reject(d)}for(p=0,E=c.length;p<E;)u=u.then(c[p++],c[p++]);return u}getUri(t){t=O(this.defaults,t);let r=J(t.baseURL,t.url);return I(r,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){L.prototype[t]=function(r,n){return this.request(O(n||{},{method:t,url:r,data:(n||{}).data}))}});a.forEach(["post","put","patch"],function(t){function r(n){return function(i,s,l){return this.request(O(l||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:s}))}}L.prototype[t]=r(),L.prototype[t+"Form"]=r(!0)});var z=L;var Ae=class e{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});let n=this;this.promise.then(o=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](o);n._listeners=null}),this.promise.then=o=>{let i,s=new Promise(l=>{n.subscribe(l),i=l}).then(o);return s.cancel=function(){n.unsubscribe(i)},s},t(function(i,s,l){n.reason||(n.reason=new C(i,s,l),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}static source(){let t;return{token:new e(function(o){t=o}),cancel:t}}},nt=Ae;function ge(e){return function(r){return e.apply(null,r)}}function xe(e){return a.isObject(e)&&e.isAxiosError===!0}var Re={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(Re).forEach(([e,t])=>{Re[t]=e});var ot=Re;function it(e){let t=new z(e),r=B(z.prototype.request,t);return a.extend(r,z.prototype,t,{allOwnKeys:!0}),a.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return it(O(e,o))},r}var w=it(_);w.Axios=z;w.CanceledError=C;w.CancelToken=nt;w.isCancel=M;w.VERSION=ie;w.toFormData=T;w.AxiosError=m;w.Cancel=w.CanceledError;w.all=function(t){return Promise.all(t)};w.spread=ge;w.isAxiosError=xe;w.mergeConfig=O;w.AxiosHeaders=S;w.formToJSON=e=>ee(a.isHTMLForm(e)?new FormData(e):e);w.HttpStatusCode=ot;w.default=w;var v=w;var{Axios:Qo,AxiosError:Zo,CanceledError:ei,isCancel:ti,CancelToken:ri,VERSION:ni,all:oi,Cancel:ii,isAxiosError:si,spread:ai,toFormData:ci,AxiosHeaders:li,HttpStatusCode:ui,formToJSON:fi,mergeConfig:di}=v;var V=class{constructor({theme:t="light",render_element_or_id:r="recaptcha-el"}){this.gl_api_url="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit",this.captcha_sitekey="6LeRUzsjAAAAANUHNEY6VkUXmMo_wlrDK5SUoFUV",this.verify_url="https://internalapi.activamedia.com.sg/v1/recaptcha/verify",this.theme=t,this.render_element_or_id=r,this.defineOnloadCallBack(),this.loadJsFile()}defineOnloadCallBack(){window.onloadCallback=()=>{}}loadJsFile(){if(document.querySelectorAll(`script[src="${this.gl_api_url}"]`).length===0){var t=document.createElement("script");t.setAttribute("src",this.gl_api_url),t.setAttribute("type","text/javascript"),t.setAttribute("async",!0),t.setAttribute("defer",!0),document.body.appendChild(t)}}sleep(t){return new Promise(r=>setTimeout(r,t))}async render(){let t="";for(;;){if(await this.sleep(200),typeof grecaptcha<"u"&&grecaptcha!==void 0&&typeof grecaptcha.render=="function"){t=grecaptcha.render(this.render_element_or_id,{sitekey:this.captcha_sitekey,theme:this.theme});break}console.info("checking grecaptcha undefined")}return t}reset(t){grecaptcha.reset(t)}fetchResponse(t){try{return grecaptcha.getResponse(t)}catch(r){console.error(r)}}async verifyRecaptcha(t){return await fetch(this.verify_url,{method:"post",body:JSON.stringify({token:t}),headers:{Accept:"application/json","Content-Type":"application/json"}}).then(r=>r.json())}};var Oe={config:{},name:null,hapiformID:null,redirectTo:null,integrationScriptUrl:"",fileUpload:{filepond:null,el:null},onSuccess(e){},onFailed(e){},captchaId:null,recaptchaTheme:"light"};function at(e){document.addEventListener("alpine:init",()=>{for(let t of e){let r=Object.assign({},Oe,t);document.addEventListener("alpine:init",hr(r))}})}async function fr(e){if(e.captchaId){let t=document.getElementById(e.captchaId);if(t)e.amCaptcha=new V({theme:this.recaptchaTheme,render_element_or_id:t}),e.widgetId=await e.amCaptcha.render();else throw"Can't find recaptcha rendering element. by id: "+this.captchaId}}function ct(e){if(e.hapiformID.length===0)throw console.error("No hapiform ID provided!"),new Error("No hapiform ID provided!");return`https://hapiform.sg/api/${e.hapiformID}`}function dr(e){console.log("\u{1F4E2} Form name: "+e.name);let t=ct(e);if(typeof e.redirectTo!="function"&&e.redirectTo.length&&new URL(t).host==="hapiform.sg"&&console.log("\u{1F680} "+window.location.origin+e.redirectTo),t){let r=new URL(t),n=t.match(/[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/);r.host==="hapiform.sg"&&console.log(`\u{1F680} ${r.origin}/${n}`)}}async function pr(e){let t=e.amCaptcha.fetchResponse(e.widgetId);if(t.length===0)throw{recaptchaError:"You can't leave Captcha Code empty"};return await e.amCaptcha.verifyRecaptcha(t).then(r=>{if(r.success===!1)throw{recaptchaError:"captcha invalid: timeout or duplicate."}})}function mr(e){window.location.hostname!=="localhost"&&window.location.hostname!=="127.0.0.1"&&v(e).then(t=>{}).catch(t=>{console.error(t)})}function st(e,t){v(e).then(r=>{if(t.integrationScriptUrl.length>0){let n=Object.assign({},e);n.url=t.integrationScriptUrl,mr(n)}t.redirectTo&&(window.location.href=t.redirectTo),t.fileUpload.filepond&&t.fileUpload.filepond.removeFiles(),yr(),t.resetFields(),t.onSuccess(r),br()}).catch(r=>{t.errors=r.response.data.errors,t.busy=!1,t.onFailed(r.response),Sr(),t.captchaId&&t.amCaptcha.reset(t.widgetId)})}async function hr(e){Alpine.data(e.name,()=>({...e,errors:{},busy:!1,amCaptcha:null,widgetId:null,async init(){Alpine.store(e.name,{fields:{}}),this.$watch("busy",t=>{let r=this.$el.querySelectorAll('form button, form input[type="submit"], form input[type="button"]');t?r.forEach(n=>{n.disabled=!0}):r.forEach(n=>{n.disabled=!1})}),this.$init&&this.$init(),fr(this).catch(t=>console.error(t)),dr(this)},async submit(){this.busy=!0,this.errors={};let t=new FormData,r=Alpine.store(this.name).fields;if(Object.keys(r).forEach((f,c)=>{typeof r[f]=="object"?r[f].forEach((u,p)=>{t.append(`${f}[${p}]`,u)}):t.append(f,r[f])}),e.fileUpload.filepond)e.fileUpload.filepond.getFiles().forEach((f,c)=>{t.append(`files[${c}]`,f.file,f.name)});else if(e.fileUpload.el){let c=document.querySelector(e.fileUpload.el).files;for(let u=0;u<c.length;u++)t.append(`files[${u}]`,c[u],c[u].name)}let o=new URL(window.top.location.href);t.append("x_origin",o.origin+o.pathname);let i=ct(e),s={method:"POST",url:Ar(i),data:t},l=Object.assign({},s,e.config);this.captchaId?await pr(this).then(()=>{st(l,this)}).catch(f=>{this.errors=f,e.onFailed(f),this.busy=!1}).finally(()=>{}):st(l,this)},resetFields(){this.errors={},Alpine.store(this.name).fields={},this.busy=!1,this.captchaId&&this.amCaptcha.reset(this.widgetId)}}))}function yr(){wr(),Er()}function wr(){try{Oe.fileUpload.filepond.removeFiles()}catch{}}function Er(){try{let e=document.querySelector(Oe.fileUpload.el);e.value=""}catch{}}function br(){lt("hapi:success")}function Sr(){lt("hapi:error")}function lt(e){let t=new Event(e);document.dispatchEvent(t)}function Ar(e){let t=new URL(e);return(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&(t.searchParams.set("test","1"),console.log("testing mode!")),t.href}function Te(){if(document.querySelectorAll('script[src="//unpkg.com/alpinejs"]').length===0){var e=document.createElement("script");e.setAttribute("src","//unpkg.com/alpinejs"),e.setAttribute("type","text/javascript"),e.setAttribute("defer",!0),document.body.appendChild(e)}}var ut={forms:at},Si=ut;window.Hapi=ut;Te();})();
package/package.json CHANGED
@@ -5,12 +5,13 @@
5
5
  "bundleDependencies": false,
6
6
  "dependencies": {
7
7
  "axios": "^1.4.0",
8
- "esbuild": "0.17.19"
8
+ "esbuild": "0.18.16"
9
9
  },
10
10
  "deprecated": false,
11
11
  "description": "hapiform html js library with google recaptcha",
12
12
  "keywords": [
13
- "hapi", "hapiform"
13
+ "hapi",
14
+ "hapiform"
14
15
  ],
15
16
  "license": "MIT",
16
17
  "main": "index.js",
@@ -19,5 +20,5 @@
19
20
  "build": "esbuild index.js --bundle --minify --outfile=./dist/hapi.min.js",
20
21
  "watch": "esbuild index.js --watch --bundle --minify --outfile=./dist/hapi.min.js"
21
22
  },
22
- "version": "1.0.2"
23
+ "version": "1.0.3"
23
24
  }
package/src/hapi.js CHANGED
@@ -7,8 +7,9 @@ import AMCaptcha from './recaptcha';
7
7
  let hapiOptions = {
8
8
  config: {},
9
9
  name: null,
10
- endpoint: null,
10
+ hapiformID: null,
11
11
  redirectTo: null,
12
+ integrationScriptUrl: '',
12
13
  fileUpload: {
13
14
  filepond: null,
14
15
  el: null,
@@ -50,11 +51,20 @@ async function renderCaptcha(a) {
50
51
  }
51
52
  }
52
53
 
54
+ function orgEndpoint(a) {
55
+ if (a.hapiformID.length === 0) {
56
+ console.error("No hapiform ID provided!");
57
+ throw new Error("No hapiform ID provided!");
58
+ }
59
+ return `https://hapiform.sg/api/${a.hapiformID}`;
60
+ }
61
+
53
62
  function displayHapiformInformation(a) {
54
63
  console.log("📢 Form name: " + a.name);
64
+ let org_endpoint = orgEndpoint(a);
55
65
  // Display redirect path
56
66
  if (typeof a.redirectTo !== "function" && a.redirectTo.length) {
57
- let endpoint = new URL(a.endpoint);
67
+ let endpoint = new URL(org_endpoint);
58
68
 
59
69
  if (endpoint.host === "hapiform.sg") {
60
70
  console.log("🚀 " + window.location.origin + a.redirectTo);
@@ -62,9 +72,9 @@ function displayHapiformInformation(a) {
62
72
  }
63
73
 
64
74
  // Display the endpoint
65
- if (a.endpoint) {
66
- let endpoint = new URL(a.endpoint);
67
- let uuid = a.endpoint.match(/[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/);
75
+ if (org_endpoint) {
76
+ let endpoint = new URL(org_endpoint);
77
+ let uuid = org_endpoint.match(/[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/);
68
78
 
69
79
  if (endpoint.host === "hapiform.sg") {
70
80
  console.log(`🚀 ${endpoint.origin}/${uuid}`);
@@ -87,9 +97,26 @@ async function verifyCaptcha(a) {
87
97
  });
88
98
  }
89
99
 
100
+ function integrationWebhook(config) {
101
+ if (window.location.hostname !== "localhost" && window.location.hostname !== "127.0.0.1") {
102
+ axios(config).then((res) => {
103
+ }).catch((e) => {
104
+ console.error(e)
105
+ })
106
+ }
107
+ }
108
+
90
109
  function onSubmission(config, a) {
91
110
  axios(config)
92
111
  .then((res) => {
112
+ // on success webhook begin
113
+ if (a.integrationScriptUrl.length > 0) {
114
+ let integration_config = Object.assign({}, config);
115
+ integration_config.url = a.integrationScriptUrl;
116
+ integrationWebhook(integration_config);
117
+ }
118
+ // on success webhook end
119
+
93
120
  if (a.redirectTo) {
94
121
  window.location.href = a.redirectTo;
95
122
  }
@@ -189,10 +216,10 @@ async function alpineInitData(options) {
189
216
  let currentUrl = new URL(window.top.location.href);
190
217
 
191
218
  formData.append("x_origin", currentUrl.origin + currentUrl.pathname);
192
-
219
+ let org_endpoint = orgEndpoint(options);
193
220
  const defaultConfig = {
194
221
  method: "POST",
195
- url: getEndpoint(options.endpoint),
222
+ url: getEndpoint(org_endpoint),
196
223
  data: formData,
197
224
  };
198
225