@worldfirst/worldfirst-js 0.0.1775118337-dev.6 → 0.0.1775118337-dev.7

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
@@ -1,11 +1,11 @@
1
- # @antintl/wf-loader
1
+ # @worlfirst/worldfirst-js
2
2
 
3
3
  WorldFirst 嵌入式金融前端 SDK,为第三方商户提供入驻、支付保管等能力的集成方案。
4
4
 
5
5
  ## 安装
6
6
 
7
7
  ```bash
8
- npm install @antintl/wf-loader
8
+ npm install @worlfirst/worldfirst-js
9
9
  ```
10
10
 
11
11
  ## 使用说明
@@ -13,7 +13,7 @@ npm install @antintl/wf-loader
13
13
  ### 基础用法
14
14
 
15
15
  ```typescript
16
- import { loadWorldFirst } from '@antintl/wf-loader';
16
+ import { loadWorldFirst } from '@worlfirst/worldfirst-js';
17
17
 
18
18
  // 初始化 SDK
19
19
  const sdk = await loadWorldFirst({
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(){var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),l=o((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,`__esModule`,{value:!0}),e.LoaderError=void 0,e.loadScriptClass=r,e.loadScript=i;var n=function(e){t(n,e);function n(t,n){var r=e.call(this,n)||this;return Object.defineProperty(r,`code`,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r.name=`LoaderError`,r.code=t,r}return Object.defineProperty(n,`unificationError`,{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e instanceof n||e instanceof Error&&e.name===`LoaderError`?e:new n(`UNKNOWN_ERROR`,e instanceof Error?e.message:`An unknown error occurred.`)}}),n}(Error);e.LoaderError=n;function r(e,t){return i(e,t)}function i(e,t){var r=function(){if(typeof t==`function`)return t();var e=window[t];return e?.default||e};return new Promise(function(t,i){var a=r();if(a)return t({cache:!0,variable:a});var o=document.querySelector(`script[src="${e}"]`),s=o||document.createElement(`script`);s.src=e,s.async=!0,s.addEventListener(`load`,function(){t({cache:!1,variable:r()})}),s.addEventListener(`error`,function(t){i(new n(`LOAD_ERROR`,`Load script ${e} failed: ${t.message}`))}),o||document.head.appendChild(s)})}})),u=o((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},n=e&&e.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}};Object.defineProperty(e,`__esModule`,{value:!0}),e.tracker=e.ScriptTracker=void 0;var r=l(),i=`https://cdn.marmot-cloud.com/tnpm-package/@antintl-opensdk-debugger/1.0.1/dist/tracker.umd.js`,a=function(){function e(e){var t=this;Object.defineProperty(this,`initOptions`,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,`tracker`,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.initOptions=e,this.loadTacker().then(function(e){t.tracker=e})}return Object.defineProperty(e.prototype,`loadTacker`,{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return(0,r.loadScript)(i,`intlSdkTracker`).then(function(t){return(t?.variable)?.getTrackerInstance(e.initOptions)})}}),Object.defineProperty(e.prototype,`getTracker`,{enumerable:!1,configurable:!0,writable:!0,value:function(){return t(this,void 0,void 0,function(){var e;return n(this,function(t){switch(t.label){case 0:return this.tracker?[2,this.tracker]:[4,this.loadTacker()];case 1:return e=t.sent(),e&&(this.tracker=e),[2,e]}})})}}),Object.defineProperty(e.prototype,`safeCall`,{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.getTracker().then(e)}}),Object.defineProperty(e.prototype,`log`,{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.safeCall(function(t){return t?.log.apply(t,e)})}}),e}();e.ScriptTracker=a;var o=`LOCAL`?.toUpperCase()||`PROD`;e.tracker=new a({appId:`180020050100012557`,env:[`DEV`,`SIT`,`PRE`,`PROD`,`LOCAL`].includes(o)?o:`PROD`,server:`sg`,performance:!1,error:!1})})),d=o((e=>{e&&e.__awaiter,e&&e.__generator,Object.defineProperty(e,`__esModule`,{value:!0}),e.loadScript=void 0,e.createSingletonInstance=i;var t=u(),n=l();Object.defineProperty(e,`loadScript`,{enumerable:!0,get:function(){return n.loadScript}});var r=null;function i(e,t,n){return r||(r=a(e,t,n),r)}function a(e,r,i){var a=new e(r),o=Date.now();return a.init().then(function(e){return i&&t.tracker.log({code:`7988`,msg:i,d1:`initialized`,d2:`无`,d3:`无`,d4:a.version||`无版本号`,d5:`umd`,m1:Date.now()-o,m2:Date.now()-o}),e}).catch(function(e){var r=new n.LoaderError(`INIT_ERROR`,`Initialize Class failed: ${e.message}`);throw i&&t.tracker.log({code:`7988`,msg:i,d1:`createError`,d2:r.code,d3:r.message,d4:`无`,d5:`umd`,m1:Date.now()-o,m2:0}),r})}}))(),f={i18nPrefix:`OPENSDK`},p=class e extends Error{code;name=`OpenSDKError`;_openSDKErrorFlag=`__OpenSDKErrorFlag__`;source=`SDK_INTERNAL`;traceId;reason;static isError(t){return t instanceof e||t instanceof Error&&t._openSDKErrorFlag===`__OpenSDKErrorFlag__`}static unificationError(t,n=`APP_RUNTIME`){return e.isError(t)?t:new m(t instanceof Error?t.message:f.getDefaultMessage?.()||`An unknown error occurred.`,`UNKNOWN_ERROR`,n)}static initConfig(e){f={...f,...e}}constructor(e,t,n,r,i=!0){let a=r,o,s;e&&typeof e==`object`?(s=e.message,o=e.params):s=e,super(f.i18n&&(!i||n!==`SERVER_API`)?f.i18n.get({id:`${f.i18nPrefix}.${t}`,dm:f.getDefaultMessage?.()||s},o):s),this.reason=s,this.code=t,this.source=n,this.traceId=a}toJSON(){let e={message:this.message,code:this.code,source:this.source,traceId:this.traceId,reason:this.reason,stack:this.stack};return JSON.parse(JSON.stringify(e))}},m=class extends p{name=`SDKBridgeError`},ee=e=>[...new Set(e)],h=(e,t)=>e.filter(e=>!t.includes(e)),g=(e,t)=>e.filter(e=>t.includes(e)),_=e=>typeof e==`bigint`||!Number.isNaN(Number(e))&&Math.floor(Number(e))===e,v=e=>typeof e==`bigint`||e>=0&&Number.isSafeInteger(e);function y(e,t){if(t.length===0)return e;let n,r=[...e];for(let e=r.length-1,i=0,a=0;e>0;e--,i++){i%=t.length,a+=n=t[i].codePointAt(0);let o=(n+i+a)%e,s=r[e],c=r[o];r[o]=s,r[e]=c}return r}var b=(e,t)=>{let n=[],r=e;if(typeof r==`bigint`){let e=BigInt(t.length);do n.unshift(t[Number(r%e)]),r/=e;while(r>BigInt(0))}else do n.unshift(t[r%t.length]),r=Math.floor(r/t.length);while(r>0);return n},x=(e,t)=>e.reduce((n,r)=>{let i=t.indexOf(r);if(i===-1)throw Error(`The provided ID (${e.join(``)}) is invalid, as it contains characters that do not exist in the alphabet (${t.join(``)})`);if(typeof n==`bigint`)return n*BigInt(t.length)+BigInt(i);let a=n*t.length+i;return Number.isSafeInteger(a)?a:(re(`Unable to decode the provided string, due to lack of support for BigInt numbers in the current environment`),BigInt(n)*BigInt(t.length)+BigInt(i))},0),S=/^\+?\d+$/,C=e=>{if(!S.test(e))return NaN;let t=Number.parseInt(e,10);return Number.isSafeInteger(t)?t:(re(`Unable to encode the provided BigInt string without loss of information due to lack of support for BigInt type in the current environment`),BigInt(e))},te=(e,t,n)=>Array.from({length:Math.ceil(e.length/t)},(r,i)=>n(e.slice(i*t,(i+1)*t))),w=e=>new RegExp(e.map(e=>ne(e)).sort((e,t)=>t.length-e.length).join(`|`)),T=e=>RegExp(`^[${e.map(e=>ne(e)).sort((e,t)=>t.length-e.length).join(``)}]+$`),ne=e=>e.replace(/[\s#$()*+,.?[\\\]^{|}-]/g,`\\$&`),re=(e=`BigInt is not available in this environment`)=>{if(typeof BigInt!=`function`)throw TypeError(e)},ie=16,ae=3.5,oe=12,se=16,ce=12,le=100,ue=new class{constructor(e=``,t=0,n=`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`,r=`cfhistuCFHISTU`){if(this.minLength=t,typeof t!=`number`)throw TypeError(`Hashids: Provided 'minLength' has to be a number (is ${typeof t})`);if(typeof e!=`string`)throw TypeError(`Hashids: Provided 'salt' has to be a string (is ${typeof e})`);if(typeof n!=`string`)throw TypeError(`Hashids: Provided alphabet has to be a string (is ${typeof n})`);let i=Array.from(e),a=Array.from(n),o=Array.from(r);this.salt=i;let s=ee(a);if(s.length<ie)throw Error(`Hashids: alphabet must contain at least ${ie} unique characters, provided: ${s.join(``)}`);this.alphabet=h(s,o),this.seps=y(g(o,s),i);let c,l;(this.seps.length===0||this.alphabet.length/this.seps.length>ae)&&(c=Math.ceil(this.alphabet.length/ae),c>this.seps.length&&(l=c-this.seps.length,this.seps.push(...this.alphabet.slice(0,l)),this.alphabet=this.alphabet.slice(l))),this.alphabet=y(this.alphabet,i);let u=Math.ceil(this.alphabet.length/oe);this.alphabet.length<3?(this.guards=this.seps.slice(0,u),this.seps=this.seps.slice(u)):(this.guards=this.alphabet.slice(0,u),this.alphabet=this.alphabet.slice(u)),this.guardsRegExp=w(this.guards),this.sepsRegExp=w(this.seps),this.allowedCharsRegExp=T([...this.alphabet,...this.guards,...this.seps])}encode(e,...t){let n=Array.isArray(e)?e:[...e==null?[]:[e],...t];return n.length===0||(n.every(_)||(n=n.map(e=>typeof e==`bigint`||typeof e==`number`?e:C(String(e)))),!n.every(v))?``:this._encode(n).join(``)}decode(e){return!e||typeof e!=`string`||e.length===0?[]:this._decode(e)}encodeHex(e){let t=e;switch(typeof t){case`bigint`:t=t.toString(se);break;case`string`:if(!/^[\dA-Fa-f]+$/.test(t))return``;break;default:throw Error(`Hashids: The provided value is neither a string, nor a BigInt (got: ${typeof t})`)}let n=te(t,ce,e=>Number.parseInt(`1${e}`,16));return this.encode(n)}decodeHex(e){return this.decode(e).map(e=>e.toString(se).slice(1)).join(``)}isValidId(e){return this.allowedCharsRegExp.test(e)}_encode(e){let{alphabet:t}=this,n=e.reduce((e,t,n)=>e+(typeof t==`bigint`?Number(t%BigInt(n+le)):t%(n+le)),0),r=[t[n%t.length]],i=[...r],{seps:a}=this,{guards:o}=this;if(e.forEach((n,o)=>{let s=i.concat(this.salt,t);t=y(t,s);let c=b(n,t);if(r.push(...c),o+1<e.length){let e=c[0].codePointAt(0)+o,t=typeof n==`bigint`?Number(n%BigInt(e)):n%e;r.push(a[t%a.length])}}),r.length<this.minLength){let e=(n+r[0].codePointAt(0))%o.length;if(r.unshift(o[e]),r.length<this.minLength){let e=(n+r[2].codePointAt(0))%o.length;r.push(o[e])}}let s=Math.floor(t.length/2);for(;r.length<this.minLength;){t=y(t,t),r.unshift(...t.slice(s)),r.push(...t.slice(0,s));let e=r.length-this.minLength;if(e>0){let t=e/2;r=r.slice(t,t+this.minLength)}}return r}_decode(e){if(!this.isValidId(e))throw Error(`The provided ID (${e}) is invalid, as it contains characters that do not exist in the alphabet (${this.guards.join(``)}${this.seps.join(``)}${this.alphabet.join(``)})`);let t=e.split(this.guardsRegExp),n=t[t.length===3||t.length===2?1:0];if(n.length===0)return[];let r=n[Symbol.iterator]().next().value,i=n.slice(r.length).split(this.sepsRegExp),a=this.alphabet,o=[];for(let e of i){let t=[r,...this.salt,...a],n=y(a,t.slice(0,a.length));o.push(x(Array.from(e),n)),a=n}return this._encode(o).join(``)===e?o:[]}}(`intl-open-sdk`,6);function de(e,t,n=!1){return(...r)=>{let i,a=new Promise((e,r)=>{i=setTimeout(()=>{n?r(n):e(void 0)},t)});return Promise.race([a,e(...r)]).finally(()=>clearTimeout(i))}}var E=(e=``)=>e+ue.encode(`${Date.now()}${Math.ceil(Math.random()*100)}`),D=class{targetPort;handlers=new Map;debugCallback;name;constructor(e,t){this.targetPort=t,t.onmessage=this.handleMessage,this.name=e}setDebugCallback(e){this.debugCallback=e}onClose(e){return new Promise((t,n)=>{this.on(`close`,async r=>{if(r.name===this.name)try{await e(r.manual),t()}catch(e){n(e)}})})}close(e=!1){return this.send(`close`,{name:this.name,manual:e}),new Promise(()=>{})}on(e,t){return this.handlers.has(e)||this.handlers.set(e,new Set),this.handlers.get(e).add(t),()=>{this.handlers.get(e).delete(t)}}send(e,t){let n={id:E(`modal_port_`),type:e,payload:t};this.debugCallback&&this.debugCallback({...n,type:`MODAL_PORT@`+n.type},`OUT`),this.targetPort.postMessage(n)}handleMessage=e=>{let{type:t,payload:n}=e.data,r=this.handlers.get(t);r&&(this.debugCallback&&this.debugCallback({...e.data,type:`MODAL_PORT@`+e.data.type},`IN`),r.forEach(e=>{e(n)}))}},fe=class{targetPorts=[];name;constructor(e){this.name=e}addPort(e){this.targetPorts.push(...e)}removePort(e){this.targetPorts=this.targetPorts.filter(t=>e!==t)}async getValues(e){return de(()=>Promise.all(this.targetPorts.map(e=>new Promise((t,n)=>{e.postMessage({id:Math.random()+``,type:`${this.name}:START_COLLECT_VALUE`}),e.onmessage=e=>{let r=e.data;(!r||!r.type)&&n(Error(`collect error`));let[i,a]=r.type.split(`:`);a===`SEND_ELEMENT_VALUE`&&t({[i]:r.payload})}}))).then(e=>e.reduce((e,t)=>({...e,...t}),{})),e?.timeout||1e4)()}},pe=class{targetPort;name;constructor(e,t){this.targetPort=t,this.name=e}onSendRequest(e){this.targetPort.onmessage=async t=>{let n=t.data;if(!n||!n.type)return;let[r,i]=n.type.split(`:`);i===`START_COLLECT_VALUE`&&e()}}send(e={}){let t={id:Math.random()+``,payload:e,type:`${this.name}:SEND_ELEMENT_VALUE`};this.targetPort.postMessage(t)}},O={HANDSHAKE:`OPENSDK@HANDSHAKE`,UPDATE_CONFIG:`OPENSDK@UPDATE_CONFIG`,SUBMIT:`OPENSDK@SUBMIT`,SUBMIT_REPLY:`OPENSDK@SUBMIT_REPLY`,REDIRECT:`OPENSDK@REDIRECT`,OPEN_MODAL:`OPENSDK@OPEN_MODAL`,OPEN_MODAL_ERROR:`OPENSDK@OPEN_MODAL_ERROR`,CLOSE_MODAL:`OPENSDK@CLOSE_MODAL`,ERROR:`OPENSDK@ERROR`,HANDSHAKE_ACK:`OPENSDK@HANDSHAKE_ACK`,TRANSFER_RECEIVE_PORT:`OPENSDK@TRANSFER_RECEIVE_PORT`,MESSAGE:`OPENSDK@MESSAGE`,TRANSFER_SEND_PORT:`OPENSDK@TRANSFER_SEND_PORT`,TRANSFER_APP_PORT:`OPENSDK@TRANSFER_APP_PORT`,TRANSFER_MODAL_PORT:`OPENSDK@TRANSFER_MODAL_PORT`,TRANSFER_MODAL_APPEARANCE:`OPENSDK@TRANSFER_MODAL_APPEARANCE`,HEIGHT_UPDATE:`OPENSDK@HEIGHT_UPDATE`},me=c(o(((e,t)=>{var n=`Expected a function`,r=NaN,i=`[object Symbol]`,a=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt,u=typeof global==`object`&&global&&global.Object===Object&&global,d=typeof self==`object`&&self&&self.Object===Object&&self,f=u||d||Function(`return this`)(),p=Object.prototype.toString,m=Math.max,ee=Math.min,h=function(){return f.Date.now()};function g(e,t,r){var i,a,o,s,c,l,u=0,d=!1,f=!1,p=!0;if(typeof e!=`function`)throw TypeError(n);t=b(t)||0,_(r)&&(d=!!r.leading,f=`maxWait`in r,o=f?m(b(r.maxWait)||0,t):o,p=`trailing`in r?!!r.trailing:p);function g(t){var n=i,r=a;return i=a=void 0,u=t,s=e.apply(r,n),s}function v(e){return u=e,c=setTimeout(S,t),d?g(e):s}function y(e){var n=e-l,r=e-u,i=t-n;return f?ee(i,o-r):i}function x(e){var n=e-l,r=e-u;return l===void 0||n>=t||n<0||f&&r>=o}function S(){var e=h();if(x(e))return C(e);c=setTimeout(S,y(e))}function C(e){return c=void 0,p&&i?g(e):(i=a=void 0,s)}function te(){c!==void 0&&clearTimeout(c),u=0,i=l=a=c=void 0}function w(){return c===void 0?s:C(h())}function T(){var e=h(),n=x(e);if(i=arguments,a=this,l=e,n){if(c===void 0)return v(l);if(f)return c=setTimeout(S,t),g(l)}return c===void 0&&(c=setTimeout(S,t)),s}return T.cancel=te,T.flush=w,T}function _(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function v(e){return!!e&&typeof e==`object`}function y(e){return typeof e==`symbol`||v(e)&&p.call(e)==i}function b(e){if(typeof e==`number`)return e;if(y(e))return r;if(_(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=_(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=e.replace(a,``);var n=s.test(e);return n||c.test(e)?l(e.slice(2),n?2:8):o.test(e)?r:+e}t.exports=g}))(),1),k=[O.TRANSFER_RECEIVE_PORT,O.TRANSFER_SEND_PORT,O.TRANSFER_MODAL_PORT,O.TRANSFER_MODAL_APPEARANCE,O.OPEN_MODAL_ERROR,O.TRANSFER_APP_PORT,O.CLOSE_MODAL,O.OPEN_MODAL,O.REDIRECT,O.MESSAGE],A=`@@global`,j=`@@native`,he=.01,ge=10,_e=class e{targetWindow;currentWindow;targetOrigin=`*`;scope;handlers=new Map;mode;resizeObserver;debugCallback;receivePort;static getGlobalBridge(t){return new e(t,A)}static getNativeBridge(t){return new e(`WEBAPP`,j,t)}static getBridge(t,n){if(n===j||n===A)throw Error(`Scope cannot be NATIVE_SCOPE or GLOBAL_SCOPE`);return new e(t,n)}constructor(e,t,n){this.mode=e,this.scope=t,n?this.currentWindow=n:this.currentWindow=window,this.mode===`WEBAPP`&&(this.targetWindow=this.currentWindow?.parent),this.currentWindow?.addEventListener(`message`,this.handleMessage)}setTarget(e){this.targetWindow=e}setOrigin(e){this.targetOrigin=e}setDebugCallback(e){this.debugCallback=e}destroy(){this.currentWindow?.removeEventListener(`message`,this.handleMessage),this.handlers.clear(),this.resizeObserver?.disconnect()}_addPort(e){this._transferPort(O.TRANSFER_RECEIVE_PORT,this.receivePort?.name,e)}_transferReceivePort(e){this._transferPort(O.TRANSFER_RECEIVE_PORT,e.name,e.targetPorts)}_transferSendPort(e){this._transferPort(O.TRANSFER_SEND_PORT,e.name,[e.targetPort])}send(e,t,n){if(!this.targetWindow){console.warn(`[Bridge] Target window not set. Cannot send message:`,e),this.debugCallback?.({id:E(`bridge`),type:`SYSTEM_${O.ERROR}`,payload:{message:`Target window not set`}},`OUT`);return}let r={id:E(`bridge`),type:this.getOriginSendType(e),payload:t};this.debugCallback&&this.debugCallback(r,`OUT`),this.targetWindow.postMessage(r,this.targetOrigin,n)}sendError(e){this.mode===`WEBAPP`&&this.send(O.ERROR,e.toJSON())}sendSubmit(e){this.mode===`WEBAPP`&&this.send(O.SUBMIT_REPLY,e)}sendMessage(e,t){this.mode===`WEBAPP`&&this.send(O.MESSAGE,{type:e,message:t})}redirect(e,t=`redirect`){if(this.mode===`WEBAPP`){if(!e)throw new m(`url is required`,`INVALID_REDIRECT_URL`,`SDK_INTERNAL`);try{new URL(e)}catch{throw new m(`Invalid URL`,`INVALID_REDIRECT_URL`,`SDK_INTERNAL`)}this.send(O.REDIRECT,{url:e,mode:t})}}openModal(e){return this.send(O.OPEN_MODAL,{...e,scope:this.scope}),new Promise((e,t)=>{this.once(O.OPEN_MODAL_ERROR,e=>{t(new p(e.message,e.code,e.source))}),this.once(O.TRANSFER_APP_PORT,(t,n)=>{if(!n?.[0])throw new m(`No ports transferred for modal communication`,`NO_PORTS_ERROR`,`SDK_INTERNAL`);e(new D(t,n[0]))})})}closeModal(){this.send(O.CLOSE_MODAL)}on(e,t){let n=this.getOriginListenType(e);return this.handlers.has(n)||this.handlers.set(n,new Set),this.handlers.get(n).add(t),()=>{this.handlers.get(n).delete(t)}}once(e,t){let n=(r,i)=>{try{t(r,i)}finally{this.off(e,n)}};this.on(e,n)}off(e,t){let n=this.getOriginListenType(e),r=this.handlers.get(n);r&&r.delete(t)}handsShake(e,t){if(this.mode!==`WEBAPP`)throw new m(`handsShake can only be called in WEBAPP mode`,`UNKNOWN_ERROR`,`SDK_INTERNAL`);let n=this.on(O.HANDSHAKE,async n=>{n?.elementMode===`GROUP`?n.isMainElement?this.getReceivePort().then(e=>{t(n,e)}).catch(()=>{t(n)}):this.getSendPort().then(e=>{t(n,e)}).catch(()=>{t(n)}):t(n);let r=0,i=(0,me.default)(e=>{(Math.abs(e-r)>ge||Math.abs((e-r)/r)>he)&&(r=e,this.send(O.HEIGHT_UPDATE,e))},400);this.resizeObserver=new ResizeObserver(e=>{e?.[0]?.contentRect?.height&&i(e[0].contentRect.height)}),this.resizeObserver.observe(document.body),this.send(O.HANDSHAKE_ACK,{version:e})});return()=>{n(),this.resizeObserver?.disconnect()}}handleMessage=e=>{let t=e.data;if(!t||!t.type)return;let[n,r]=t.type.split(`:`);if(this.scope!==j&&(![`WEBAPP`,`HOST`].includes(r)||this.targetOrigin!==`*`&&e.origin!==this.targetOrigin||this.mode===r))return;let i=this.handlers.get(t.type);this.scope!==j&&(i||t.type.endsWith(O.ERROR)||t.type.endsWith(O.MESSAGE))&&this.debugCallback&&this.scope===n&&this.debugCallback(t,`IN`),i&&new Set(i).forEach(n=>n(t.payload,e.ports))};getOriginListenType(e){return e===`error`&&(e=O.ERROR),this.scope===j?e:`${k.includes(e)?A:this.scope}:${this.mode===`WEBAPP`?`HOST`:`WEBAPP`}:${e}`}getOriginSendType(e){return e===`error`&&(e=O.ERROR),this.scope===j?e:`${k.includes(e)?A:this.scope}:${this.mode}:${e}`}_transferPort(e,t,n){if(!this.targetWindow){console.warn(`[Bridge] Target window not set. Cannot send port`);return}this.mode===`HOST`&&this.targetWindow.postMessage({id:E(),type:this.getOriginSendType(e),payload:t},this.targetOrigin,n)}getReceivePort(){return new Promise(e=>{this.on(O.TRANSFER_RECEIVE_PORT,(t,n)=>{this.receivePort||=new fe(t),this.receivePort.addPort(n),e(this.receivePort)})})}getSendPort(){return new Promise((e,t)=>{this.on(O.TRANSFER_SEND_PORT,(n,r)=>{r?e(new pe(n,r[0])):t(Error(`no ports transfer`))})})}},ve=`https://cdn.marmot-cloud.com/tnpm-package/@antintl-opensdk-debugger/1.0.1/dist/tracker.umd.js`,ye=class{options;tracker;trackId;constructor(e){this.options=this.initialOptions(e)}initialOptions(e){return this.options={...this.options,...e,appId:e?.appId||this.options?.appId||`180020050100012557`,performance:e?.performance===!0||this.options?.performance===!0,error:e?.error===!0||this.options?.error===!0},`trackId`in this.options&&(this.trackId=this.options.trackId),this.options}loadTacker(e){return(0,d.loadScript)(ve,`intlSdkTracker`).then(t=>t.variable?.getTrackerInstance(this.initialOptions(e)))}async initTracker(e){if(this.tracker&&!this.options)return this.tracker;let t=await this.loadTacker(e);return t&&(this.tracker=t),t}safeCall(e){return this.initTracker().then(e)}setTrackId(e){this.trackId=e,this.set({trackId:e})}set(e){this.safeCall(t=>t?.set(e))}pv(){this.safeCall(e=>e?.pv())}log(...e){this.trackId&&(e[0].d18=this.trackId),this.safeCall(t=>t?.log(...e))}click(...e){this.safeCall(t=>t?.click(...e))}expo(...e){this.safeCall(t=>t?.expo(...e))}onSendData(...e){this.safeCall(t=>t?.onSendData(...e))}offSendData(...e){this.safeCall(t=>t?.offSendData(...e))}pageMonitor(...e){this.safeCall(t=>t?.pageMonitor(...e))}reportCustomizedPerformance(...e){this.safeCall(t=>t?.reportCustomizedPerformance(...e))}};new ye;var be=c(o(((e,t)=>{var n=200,r=`__lodash_hash_undefined__`,i=800,a=16,o=9007199254740991,s=`[object Arguments]`,c=`[object Array]`,l=`[object AsyncFunction]`,u=`[object Boolean]`,d=`[object Date]`,f=`[object Error]`,p=`[object Function]`,m=`[object GeneratorFunction]`,ee=`[object Map]`,h=`[object Number]`,g=`[object Null]`,_=`[object Object]`,v=`[object Proxy]`,y=`[object RegExp]`,b=`[object Set]`,x=`[object String]`,S=`[object Undefined]`,C=`[object WeakMap]`,te=`[object ArrayBuffer]`,w=`[object DataView]`,T=`[object Float32Array]`,ne=`[object Float64Array]`,re=`[object Int8Array]`,ie=`[object Int16Array]`,ae=`[object Int32Array]`,oe=`[object Uint8Array]`,se=`[object Uint8ClampedArray]`,ce=`[object Uint16Array]`,le=`[object Uint32Array]`,ue=/[\\^$.*+?()[\]{}|]/g,de=/^\[object .+?Constructor\]$/,E=/^(?:0|[1-9]\d*)$/,D={};D[T]=D[ne]=D[re]=D[ie]=D[ae]=D[oe]=D[se]=D[ce]=D[le]=!0,D[s]=D[c]=D[te]=D[u]=D[w]=D[d]=D[f]=D[p]=D[ee]=D[h]=D[_]=D[y]=D[b]=D[x]=D[C]=!1;var fe=typeof global==`object`&&global&&global.Object===Object&&global,pe=typeof self==`object`&&self&&self.Object===Object&&self,O=fe||pe||Function(`return this`)(),me=typeof e==`object`&&e&&!e.nodeType&&e,k=me&&typeof t==`object`&&t&&!t.nodeType&&t,A=k&&k.exports===me,j=A&&fe.process,he=function(){try{return k&&k.require&&k.require(`util`).types||j&&j.binding&&j.binding(`util`)}catch{}}(),ge=he&&he.isTypedArray;function _e(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function ve(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function ye(e){return function(t){return e(t)}}function be(e,t){return e?.[t]}function M(e,t){return function(n){return e(t(n))}}var xe=Array.prototype,Se=Function.prototype,N=Object.prototype,P=O[`__core-js_shared__`],F=Se.toString,I=N.hasOwnProperty,Ce=function(){var e=/[^.]+$/.exec(P&&P.keys&&P.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}(),L=N.toString,we=F.call(Object),Te=RegExp(`^`+F.call(I).replace(ue,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),R=A?O.Buffer:void 0,Ee=O.Symbol,z=O.Uint8Array,B=R?R.allocUnsafe:void 0,V=M(Object.getPrototypeOf,Object),H=Object.create,U=N.propertyIsEnumerable,De=xe.splice,W=Ee?Ee.toStringTag:void 0,G=function(){try{var e=xt(Object,`defineProperty`);return e({},``,{}),e}catch{}}(),Oe=R?R.isBuffer:void 0,ke=Math.max,Ae=Date.now,je=xt(O,`Map`),K=xt(Object,`create`),Me=function(){function e(){}return function(t){if(!Q(t))return{};if(H)return H(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function q(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ne(){this.__data__=K?K(null):{},this.size=0}function Pe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function Fe(e){var t=this.__data__;if(K){var n=t[e];return n===r?void 0:n}return I.call(t,e)?t[e]:void 0}function Ie(e){var t=this.__data__;return K?t[e]!==void 0:I.call(t,e)}function J(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=K&&t===void 0?r:t,this}q.prototype.clear=Ne,q.prototype.delete=Pe,q.prototype.get=Fe,q.prototype.has=Ie,q.prototype.set=J;function Y(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Le(){this.__data__=[],this.size=0}function Re(e){var t=this.__data__,n=tt(t,e);return n<0?!1:(n==t.length-1?t.pop():De.call(t,n,1),--this.size,!0)}function ze(e){var t=this.__data__,n=tt(t,e);return n<0?void 0:t[n][1]}function Be(e){return tt(this.__data__,e)>-1}function Ve(e,t){var n=this.__data__,r=tt(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}Y.prototype.clear=Le,Y.prototype.delete=Re,Y.prototype.get=ze,Y.prototype.has=Be,Y.prototype.set=Ve;function X(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function He(){this.size=0,this.__data__={hash:new q,map:new(je||Y),string:new q}}function Ue(e){var t=bt(this,e).delete(e);return this.size-=t?1:0,t}function We(e){return bt(this,e).get(e)}function Ge(e){return bt(this,e).has(e)}function Ke(e,t){var n=bt(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}X.prototype.clear=He,X.prototype.delete=Ue,X.prototype.get=We,X.prototype.has=Ge,X.prototype.set=Ke;function Z(e){this.size=(this.__data__=new Y(e)).size}function qe(){this.__data__=new Y,this.size=0}function Je(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Ye(e){return this.__data__.get(e)}function Xe(e){return this.__data__.has(e)}function Ze(e,t){var r=this.__data__;if(r instanceof Y){var i=r.__data__;if(!je||i.length<n-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new X(i)}return r.set(e,t),this.size=r.size,this}Z.prototype.clear=qe,Z.prototype.delete=Je,Z.prototype.get=Ye,Z.prototype.has=Xe,Z.prototype.set=Ze;function Qe(e,t){var n=Rt(e),r=!n&&Lt(e),i=!n&&!r&&Vt(e),a=!n&&!r&&!i&&Gt(e),o=n||r||i||a,s=o?ve(e.length,String):[],c=s.length;for(var l in e)(t||I.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||wt(l,c)))&&s.push(l);return s}function $e(e,t,n){(n!==void 0&&!It(e[t],n)||n===void 0&&!(t in e))&&nt(e,t,n)}function et(e,t,n){var r=e[t];(!(I.call(e,t)&&It(r,n))||n===void 0&&!(t in e))&&nt(e,t,n)}function tt(e,t){for(var n=e.length;n--;)if(It(e[n][0],t))return n;return-1}function nt(e,t,n){t==`__proto__`&&G?G(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var rt=yt();function it(e){return e==null?e===void 0?S:g:W&&W in Object(e)?St(e):At(e)}function at(e){return $(e)&&it(e)==s}function ot(e){return!Q(e)||Dt(e)?!1:(Ht(e)?Te:de).test(Ft(e))}function st(e){return $(e)&&Ut(e.length)&&!!D[it(e)]}function ct(e){if(!Q(e))return kt(e);var t=Ot(e),n=[];for(var r in e)r==`constructor`&&(t||!I.call(e,r))||n.push(r);return n}function lt(e,t,n,r,i){e!==t&&rt(t,function(a,o){if(i||=new Z,Q(a))ut(e,t,o,n,lt,r,i);else{var s=r?r(Mt(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),$e(e,o,s)}},qt)}function ut(e,t,n,r,i,a,o){var s=Mt(e,n),c=Mt(t,n),l=o.get(c);if(l){$e(e,n,l);return}var u=a?a(s,c,n+``,e,t,o):void 0,d=u===void 0;if(d){var f=Rt(c),p=!f&&Vt(c),m=!f&&!p&&Gt(c);u=c,f||p||m?Rt(s)?u=s:Bt(s)?u=gt(s):p?(d=!1,u=pt(c,!0)):m?(d=!1,u=ht(c,!0)):u=[]:Wt(c)||Lt(c)?(u=s,Lt(s)?u=Kt(s):(!Q(s)||Ht(s))&&(u=Ct(c))):d=!1}d&&(o.set(c,u),i(u,c,r,a,o),o.delete(c)),$e(e,n,u)}function dt(e,t){return Nt(jt(e,t,Xt),e+``)}var ft=G?function(e,t){return G(e,`toString`,{configurable:!0,enumerable:!1,value:Yt(t),writable:!0})}:Xt;function pt(e,t){if(t)return e.slice();var n=e.length,r=B?B(n):new e.constructor(n);return e.copy(r),r}function mt(e){var t=new e.constructor(e.byteLength);return new z(t).set(new z(e)),t}function ht(e,t){var n=t?mt(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function gt(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}function _t(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?nt(n,s,c):et(n,s,c)}return n}function vt(e){return dt(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&Tt(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}function yt(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}function bt(e,t){var n=e.__data__;return Et(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function xt(e,t){var n=be(e,t);return ot(n)?n:void 0}function St(e){var t=I.call(e,W),n=e[W];try{e[W]=void 0;var r=!0}catch{}var i=L.call(e);return r&&(t?e[W]=n:delete e[W]),i}function Ct(e){return typeof e.constructor==`function`&&!Ot(e)?Me(V(e)):{}}function wt(e,t){var n=typeof e;return t??=o,!!t&&(n==`number`||n!=`symbol`&&E.test(e))&&e>-1&&e%1==0&&e<t}function Tt(e,t,n){if(!Q(n))return!1;var r=typeof t;return(r==`number`?zt(n)&&wt(t,n.length):r==`string`&&t in n)?It(n[t],e):!1}function Et(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function Dt(e){return!!Ce&&Ce in e}function Ot(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||N)}function kt(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}function At(e){return L.call(e)}function jt(e,t,n){return t=ke(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=ke(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),_e(e,this,s)}}function Mt(e,t){if(!(t===`constructor`&&typeof e[t]==`function`)&&t!=`__proto__`)return e[t]}var Nt=Pt(ft);function Pt(e){var t=0,n=0;return function(){var r=Ae(),o=a-(r-n);if(n=r,o>0){if(++t>=i)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Ft(e){if(e!=null){try{return F.call(e)}catch{}try{return e+``}catch{}}return``}function It(e,t){return e===t||e!==e&&t!==t}var Lt=at(function(){return arguments}())?at:function(e){return $(e)&&I.call(e,`callee`)&&!U.call(e,`callee`)},Rt=Array.isArray;function zt(e){return e!=null&&Ut(e.length)&&!Ht(e)}function Bt(e){return $(e)&&zt(e)}var Vt=Oe||Zt;function Ht(e){if(!Q(e))return!1;var t=it(e);return t==p||t==m||t==l||t==v}function Ut(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=o}function Q(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}function $(e){return typeof e==`object`&&!!e}function Wt(e){if(!$(e)||it(e)!=_)return!1;var t=V(e);if(t===null)return!0;var n=I.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&F.call(n)==we}var Gt=ge?ye(ge):st;function Kt(e){return _t(e,qt(e))}function qt(e){return zt(e)?Qe(e,!0):ct(e)}var Jt=vt(function(e,t,n){lt(e,t,n)});function Yt(e){return function(){return e}}function Xt(e){return e}function Zt(){return!1}t.exports=Jt}))(),1);function M(e,...t){return(0,be.default)(e,...t)}function xe(e){let{message:t,traceId:n,code:r,source:i,stack:a,reason:o}=e;if(e.source===`SERVER_API`){let[e,s,c,l]=n?.match(/([a-z0-9\sA-Z]*)(\s*\(([a-zA-Z0-9\.]*)\))?/)||[],u={code:r,source:i,message:t,operationType:l,traceId:s?.replace(/\s/g,``)||`无traceID`,stack:a,reason:o};return JSON.parse(JSON.stringify(u))}return e}var Se=new ye({appId:`180020050100012557`,performance:!1,error:!1}),N=`7981`,P=e=>{N=e},F=(e=``)=>t=>{Se.log({code:`${N}${e}`,...t})},I=F(),Ce=F(`event`),L=F(`iframe`),we=F(`handshake`),Te=F(`merchant`),R=F(`element`),Ee=()=>{if(window.sdkDebugger)return Promise.resolve(window.sdkDebugger);let e=`0.0.20260320102506-dev.21`.replace(/-dev\.[0-9]+/,``),t=`https://cdn.marmot-cloud.com/tnpm-package/@antintl-opensdk-debugger/1.0.3/dist/main.umd.js`;return process.env.NODE_ENV===`production`&&(t=`https://marmot-local-dev.oss-accelerate.aliyuncs.com/tnpm-package/@antintl-opensdk-debugger/${e}/dist/main.umd.js`),(0,d.loadScript)(t,`sdkDebugger`).then(e=>e.variable)},z=(e,t,n,r)=>{if(e===`ERROR`){let e=r||{};I({msg:e.code||n,d1:t,d2:e.reason,d3:e.stack,d4:e.traceId,d5:e.operationType,d6:n})}else if(n.includes(`:HOST:`)||n.includes(`:WEBAPP:`)){let[i,a,o]=n.split(`:`);Ce({msg:o,d1:t,d2:i,d3:a,d4:JSON.stringify(r),d5:`无`,d6:e})}window.sdkDebugger?.log(e,t,n,r)},B=e=>{if(!e)return;let t=xe(p.isError(e)?e.toJSON():e);z(`ERROR`,t.source,t.operationType||t.message||`Unknown Error`,t)},V=class extends p{name=`SDKInternalError`},H=class extends _e{static getGlobalBridge(){return _e.getGlobalBridge(`HOST`)}constructor(e){super(`HOST`,e)}_transferReceivePort(e){super._transferReceivePort(e)}_addPort(e){super._addPort(e)}_transferSendPort(e){super._transferSendPort(e)}setTarget(e){super.setTarget(e)}setDebugCallback(...e){super.setDebugCallback(...e)}},U=class extends V{name=`MountError`;constructor(e,t,n){super(e,t,n||`SDK_USAGE`)}},De=class{static elementType;name;_elementMode;_isMainElement;config;bridge;hooks={};iframe=null;status;cachedSend=[];constructor(e,t){this.config=t,this._isMainElement=t.isMainElement,this._elementMode=t.elementMode,this.name=e,this.bridge=new H(e),this.bridge.setOrigin(t.targetOrigin),this.config.debug&&this.bridge.setDebugCallback((e,t)=>{e.type.endsWith(O.UPDATE_CONFIG)||e.type.endsWith(O.HEIGHT_UPDATE)||(e.type.endsWith(O.MESSAGE)?z(e.payload?.type,`APP_RUNTIME`,e.type,e.payload?.message):e.type.endsWith(O.ERROR)&&t===`IN`?B(e.payload):z(`INFO`,t===`OUT`?`SDK_INTERNAL`:`APP_RUNTIME`,e.type,e.payload))}),this.status=`initialized`}submit(e){throw new V(`This element not support submit`,`NOT_SUPPORT_SUBMIT`,`SDK_USAGE`)}async setup(){}async mount(e){if(this.status!==`initialized`&&this.status!==`unmounted`){let e=new U({message:`element status is ${this.status}, can not mount again`,params:{status:this.status}},`MOUNT_NOT_SUPPORT`);throw B(e),e}return de(()=>Promise.all([this.setup(),this._mount(e)]),15e3,new U(`Mount timeout`,`MOUNT_TIMEOUT`,`SYSTEM`))().then(e=>{let[t]=e;Te({msg:this.name,d1:t?.merchantId||`未配置的商户`}),this.bridge.send(O.HANDSHAKE,M(this.config.appConfig,t||{}))}).catch(e=>{this.umount();let t=V.unificationError(e);throw B(t),t})}async _mount(e){return new Promise(async(t,n)=>{if(!this.isMainElement&&this.isSingleMode)return n(new U({message:`${this.name} element can not be used with single mode`,params:{elementName:this.name}},`MOUNT_NOT_MAINELEMENT_WITH_SINGLE_MODE`));try{if(!e)return n(new U(`container missing`,`MOUNT_MISSING_CONTAINER`));if(this.iframe)return e.appendChild(this.iframe),t();let r=this.config.appUrl,i=new URL(this.config.appUrl);try{i.searchParams.set(`origin`,window.location.origin),i.searchParams.set(`locale`,this.config.locale),r=i.toString()}catch{let e=r.includes(`?`)?`&`:`?`;r=`${r}${e}origin=${encodeURIComponent(window.location.origin)}${e}locale=${encodeURIComponent(this.config.locale)}`}this.status=`mounting`;let a=this.iframe=document.createElement(`iframe`);a.src=r,a.style.width=`100%`,a.style.height=`100%`,a.style.border=`none`,a.style.maxHeight=`100vh`,a.style.height=`0`,a.style.borderRadius=`inherit`,a.style.transition=`height 0.3s ease`;let o=Date.now();this.iframe.onload=()=>{if(!this.iframe?.contentWindow)return t();z(`INFO`,`SYSTEM`,`Iframe ${this.name} loaded, initiating handshake...`),this.status=`mounted`,L({msg:this.name,d1:`是`,m1:Math.round(Date.now()-o),m2:1});{let e=`*`;try{e=new URL(this.iframe.src).origin,e===`null`&&(e=`*`)}catch{e=`*`}this.bridge.setOrigin(e)}this.bridge.setTarget(this.iframe.contentWindow);let e=Date.now(),n=setTimeout(()=>{we({msg:this.name,d1:`handshake timeout`,m1:Math.round(Date.now()-e),m2:0,m3:Math.round(Date.now()-o)})},15e3);this.bridge.on(O.HEIGHT_UPDATE,e=>{a.style.height=`${e}px`}),this.bridge.on(O.HANDSHAKE_ACK,t=>{clearTimeout(n),this.status=`ready`,we({msg:this.name,d1:`handshake ack`,m1:Math.round(Date.now()-e),m2:1,m3:Math.round(Date.now()-o)}),this.cachedSend.length&&(this.cachedSend.forEach(({type:e,payload:t})=>{this.bridge.send(e,t)}),this.cachedSend=[]),console.log(t?.version||`异常的版本`)}),t()},this.iframe.onerror=e=>{L({msg:this.name,d1:`否`,m1:Math.round(Date.now()-o),m2:0}),n(new U(`Iframe load error: ${e}`,`MOUNT_IFRAME_LOAD_ERROR`,`SYSTEM`))},e.appendChild(this.iframe)}catch(e){n(new U(`Initialization crashed: ${e.message}`,`MOUNT_INITIAL_FAILED`,`SDK_INTERNAL`))}})}updateConfig(e){try{if(this.status===`destroyed`)throw new V(`Element already destroyed, cannot update destroyed SDK instance`,`ELEMENT_INSTANCE_DESTROYED`,`SDK_USAGE`);this.config.appConfig=M(this.config.appConfig,e),z(`INFO`,`SDK_USAGE`,`Updating configuration via API`,e),this.bridge.send(O.UPDATE_CONFIG,{merged:this.config.appConfig,updated:e})}catch(e){B(V.unificationError(e))}}umount(){(this.status===`mounted`||this.status===`ready`)&&(this.status=`unmounted`,this.iframe&&this.iframe.parentNode&&this.iframe.parentNode.removeChild(this.iframe))}get isSingleMode(){return this._elementMode===`SINGLE`}on(e,t){this.bridge.on(e,t)}send(e,t){if(this.status===`destroyed`){B(new V(`element status is ${this.status}, can not send message`,`ELEMENT_INSTANCE_DESTROYED`,`SDK_USAGE`));return}if(this.status!==`ready`){this.cachedSend.push({type:e,payload:t});return}this.bridge.send(e,t)}_addPort(e){this.isSingleMode||!this.isMainElement||this.bridge._addPort(e)}_transferReceivePort(e){this.isSingleMode||!this.isMainElement||this.bridge._transferReceivePort(e)}_transferSendPort(e){this.isSingleMode||this.isMainElement||this.bridge._transferSendPort(e)}async _submit(e){return this.bridge.mode===`HOST`?(this.send(O.SUBMIT,e),new Promise(e=>{this.bridge.once(O.SUBMIT_REPLY,t=>{e(t)})})):Promise.reject(Error(`submit method only available in HOST mode`))}destroy(){this.hooks.ondestroy?.forEach(e=>e()),this.hooks={},this.bridge.destroy(),this.umount(),this.status=`destroyed`}get isMainElement(){return this._isMainElement}_addHook(e,t){return this.hooks[e]||(this.hooks[e]=[]),this.hooks[e]?.push(t),()=>{this.hooks[e]=this.hooks[e]?.filter(e=>e!==t)}}},W=class extends De{constructor(e,t,n,r){super(e,{...n,isMainElement:!0,appUrl:t,appConfig:r||{}})}_submit(e){return super._submit(e)}},G=class{config;isInit=!1;version;elementMode=`SINGLE`;_elements=new Map;globalBridgeForWebApp;globalBridgeForModal;openModalHandle;elementClasses={};constructor(e){this.config=e,this.version=e.version,e.trackerCode&&P(e.trackerCode);let t=this.globalBridgeForWebApp=H.getGlobalBridge();this.globalBridgeForWebApp.on(O.OPEN_MODAL,async e=>{let n=this.globalBridgeForModal=H.getGlobalBridge();n.setDebugCallback((e,t)=>{t===`OUT`&&z(`INFO`,`SDK_INTERNAL`,e.type,e.payload)});let r=this._elements.get(e.scope);!r||!r.iframe?.contentWindow?z(`WARN`,`SDK_INTERNAL`,`Element not found or iframe contentWindow not available, confirm close may not work`):t.setTarget(r.iframe.contentWindow);try{let t=new URL(e.url);e.closeConfirm&&(t.searchParams.append(`confirm`,`true`),t.searchParams.has(`closeConfirm`)&&(e.closeConfirm=!0)),e.url=t.toString()}catch{let e=new V(`Invalid URL`,`INVALID_MODAL_URL`,`APP_RUNTIME`);t.send(O.OPEN_MODAL_ERROR,e);return}let i=new MessageChannel,a=E(`modal_`),o=this.openModalHandle=await this.openModal({...e,onClose(){if(e.closeConfirm){let e=new D(a,i.port2);return console.log(e,`send`),e.close(!0)}}});e.appearance&&o.onLoadedSuccess(()=>{n.setTarget(o.getContentWindow()),n.send(O.TRANSFER_MODAL_APPEARANCE,e.appearance)}),e.closeConfirm&&(t.send(O.TRANSFER_APP_PORT,a,[i.port1]),o.onLoadedSuccess(()=>{n.setTarget(o.getContentWindow()),n.send(O.TRANSFER_MODAL_PORT,a,[i.port2])})),t.on(O.CLOSE_MODAL,()=>{o.destroy(),n.destroy()})}),t.on(O.REDIRECT,async e=>{let{url:t,mode:n=`redirect`,destory:r=!0}=e;r&&this.destroy(),n===`replace`?window.location.replace(t):n===`redirect`&&(window.location.href=t)}),t.setDebugCallback((e,t)=>{e.type.endsWith(O.MESSAGE)?z(e.payload?.type,`APP_RUNTIME`,e.type,e.payload?.message):e.type.endsWith(O.ERROR)&&t===`IN`?B(e.payload):e.type.endsWith(O.OPEN_MODAL_ERROR)?z(`ERROR`,`APP_RUNTIME`,`Open modal error`,e.payload):z(`INFO`,t===`OUT`?`SDK_INTERNAL`:`APP_RUNTIME`,e.type,e.payload)}),this.canUseElements().forEach(e=>{let t=e,n;typeof e!=`function`&&(t=e.ElementClass,n=e.config);let r=t;if(!r.elementType)throw new V(`ElementClass must have a static elementType property`,`ELEMENT_DEFINE_ERROR`,`SDK_INTERNAL`);let i=this._generateElementKey(r.elementType,n);if(!this.elementClasses[i])this.elementClasses[i]=r;else throw new V(`This elementType "${r.elementType}" ${n?`with config ${JSON.stringify(n)}`:``} is already registered in factory`,`ELEMENT_ALREADY_REGISTERED`,`SDK_INTERNAL`)})}async openModal(e){return z(`WARN`,`SDK_INTERNAL`,`Open modal request received, but no handler implemented.`,e),Promise.resolve({destroy:()=>{},onLoadedSuccess:e=>{},getContentWindow:()=>null})}async init(){return this.isInit?this:(this.config.debug&&await Ee().then(e=>{e?.mount()}).catch(()=>{B(new V(`Load debugger failed`,`LOAD_DEBUGGER_FAILED`,`SDK_INTERNAL`))}),this.isInit=!0,this)}generateElementKey(e,t){return e}updateConfig(e){let{locale:t,debug:n,env:r}=e;t&&(this.config.locale=t),n&&(this.config.debug=n),r&&(this.config.env=r),(t||r)&&this._elements.forEach(t=>{t.updateConfig(e)})}destroy(){this._elements.forEach(e=>{e.destroy()}),this._elements.clear(),this.openModalHandle?.destroy(),this.globalBridgeForModal?.destroy(),this.globalBridgeForWebApp.destroy()}_generateElementKey(e,t){try{return this.generateElementKey(e,t)}catch{let n=new V({message:`Generate element ${e} key error, with options ${JSON.stringify(t)}`,params:{elementType:e,options:t}},`GENERATE_ELEMENT_KEY_FAILED`,`SDK_INTERNAL`);throw B(n),n}}_createElement(e,t){let n;R({msg:e});let r=this._generateElementKey(e,t);if(n=this.elementClasses[r],R({msg:e,m1:n?1:0}),!n){let t=new V({message:`Element type ${e} not supported.`,params:{elementType:e}},`NOT_SUPPORT_ELEMENT`,`SDK_USAGE`);throw B(t),t}let i;try{i=new n(r,{...this.config,elementMode:this.elementMode,appConfig:{env:this.config.env,locale:this.config.locale,...t}})}catch(t){let n=V.isError(t)?t:new V({message:`Element type ${e} initialization failed`,params:{elementType:e}},`ELEMENT_INIT_FAILED`,`SDK_INTERNAL`);throw B(n),n}return i._addHook(`ondestroy`,()=>{this._removeElement(e,t),this._getElementSize()||z(`INFO`,`SDK_INTERNAL`,`All elements destroyed`)}),this._addElement(e,i,t),i}_addElement(e,t,n){if(this._elements.has(this._generateElementKey(e,n))){let t=new V({message:`${e} element already exists, please don't create twice.`,params:{elementType:e}},`CANNOT_CREATE_SAME_ELEMENT_TWICE`,`SDK_USAGE`);throw B(t),t}this._elements.set(this._generateElementKey(e,n),t)}_removeElement(e,t){this._elements.delete(this._generateElementKey(e,t))}_getElement(e,t){return this._elements.get(this._generateElementKey(e,t))}_getElementSize(){return this._elements.size}},Oe={local:`local`,dev:`dev`,test:`test`,pre:`pre`,sandbox:`sandbox`,prod:`prod`},ke=e=>localStorage.getItem(`WORLDFIRST_APP_ENV`)||Oe.local,Ae=e=>{let t=e.startsWith(`/`)?e:`/${e}`;{let e=localStorage.getItem(`WORLDFIRST_APP_DOCUMENT_PREFIX`);if(!e)throw Error(`WORLDFIRST_APP_DOCUMENT_PREFIX is not set, please checkout your demo`);return`${e}/page/wf-embedded-finance${t}`}return`https://openweb.worldfirst.com.cn${t}`},je=class extends W{static elementType=`onboard`;constructor(e,t){console.log(`%c [ config ]-35`,`font-size:13px; background:pink; color:#bf2c9f;`,t),super(e,Ae(`/index.html#/onboard`),t,t.appConfig),console.log(this)}submit(){return this._submit()}focus(){throw Error(`Method not implemented.`)}blur(){throw Error(`Method not implemented.`)}clear(){throw Error(`Method not implemented.`)}};function K(e,t=!1){let n=JSON.stringify(e);return`<!DOCTYPE html>
1
+ (function(){var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),l=o((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,`__esModule`,{value:!0}),e.LoaderError=void 0,e.loadScriptClass=r,e.loadScript=i;var n=function(e){t(n,e);function n(t,n){var r=e.call(this,n)||this;return Object.defineProperty(r,`code`,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r.name=`LoaderError`,r.code=t,r}return Object.defineProperty(n,`unificationError`,{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e instanceof n||e instanceof Error&&e.name===`LoaderError`?e:new n(`UNKNOWN_ERROR`,e instanceof Error?e.message:`An unknown error occurred.`)}}),n}(Error);e.LoaderError=n;function r(e,t){return i(e,t)}function i(e,t){var r=function(){if(typeof t==`function`)return t();var e=window[t];return e?.default||e};return new Promise(function(t,i){var a=r();if(a)return t({cache:!0,variable:a});var o=document.querySelector(`script[src="${e}"]`),s=o||document.createElement(`script`);s.src=e,s.async=!0,s.addEventListener(`load`,function(){t({cache:!1,variable:r()})}),s.addEventListener(`error`,function(t){i(new n(`LOAD_ERROR`,`Load script ${e} failed: ${t.message}`))}),o||document.head.appendChild(s)})}})),u=o((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},n=e&&e.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}};Object.defineProperty(e,`__esModule`,{value:!0}),e.tracker=e.ScriptTracker=void 0;var r=l(),i=`https://cdn.marmot-cloud.com/tnpm-package/@antintl-opensdk-debugger/1.0.1/dist/tracker.umd.js`,a=function(){function e(e){var t=this;Object.defineProperty(this,`initOptions`,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,`tracker`,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.initOptions=e,this.loadTacker().then(function(e){t.tracker=e})}return Object.defineProperty(e.prototype,`loadTacker`,{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return(0,r.loadScript)(i,`intlSdkTracker`).then(function(t){return(t?.variable)?.getTrackerInstance(e.initOptions)})}}),Object.defineProperty(e.prototype,`getTracker`,{enumerable:!1,configurable:!0,writable:!0,value:function(){return t(this,void 0,void 0,function(){var e;return n(this,function(t){switch(t.label){case 0:return this.tracker?[2,this.tracker]:[4,this.loadTacker()];case 1:return e=t.sent(),e&&(this.tracker=e),[2,e]}})})}}),Object.defineProperty(e.prototype,`safeCall`,{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.getTracker().then(e)}}),Object.defineProperty(e.prototype,`log`,{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.safeCall(function(t){return t?.log.apply(t,e)})}}),e}();e.ScriptTracker=a;var o=`LOCAL`?.toUpperCase()||`PROD`;e.tracker=new a({appId:`180020050100012557`,env:[`DEV`,`SIT`,`PRE`,`PROD`,`LOCAL`].includes(o)?o:`PROD`,server:`sg`,performance:!1,error:!1})})),d=o((e=>{e&&e.__awaiter,e&&e.__generator,Object.defineProperty(e,`__esModule`,{value:!0}),e.loadScript=void 0,e.createSingletonInstance=i;var t=u(),n=l();Object.defineProperty(e,`loadScript`,{enumerable:!0,get:function(){return n.loadScript}});var r=null;function i(e,t,n){return r||(r=a(e,t,n),r)}function a(e,r,i){var a=new e(r),o=Date.now();return a.init().then(function(e){return i&&t.tracker.log({code:`7988`,msg:i,d1:`initialized`,d2:`无`,d3:`无`,d4:a.version||`无版本号`,d5:`umd`,m1:Date.now()-o,m2:Date.now()-o}),e}).catch(function(e){var r=new n.LoaderError(`INIT_ERROR`,`Initialize Class failed: ${e.message}`);throw i&&t.tracker.log({code:`7988`,msg:i,d1:`createError`,d2:r.code,d3:r.message,d4:`无`,d5:`umd`,m1:Date.now()-o,m2:0}),r})}}))(),f={i18nPrefix:`OPENSDK`},p=class e extends Error{code;name=`OpenSDKError`;_openSDKErrorFlag=`__OpenSDKErrorFlag__`;source=`SDK_INTERNAL`;traceId;reason;static isError(t){return t instanceof e||t instanceof Error&&t._openSDKErrorFlag===`__OpenSDKErrorFlag__`}static unificationError(t,n=`APP_RUNTIME`){return e.isError(t)?t:new m(t instanceof Error?t.message:f.getDefaultMessage?.()||`An unknown error occurred.`,`UNKNOWN_ERROR`,n)}static initConfig(e){f={...f,...e}}constructor(e,t,n,r,i=!0){let a=r,o,s;e&&typeof e==`object`?(s=e.message,o=e.params):s=e,super(f.i18n&&(!i||n!==`SERVER_API`)?f.i18n.get({id:`${f.i18nPrefix}.${t}`,dm:f.getDefaultMessage?.()||s},o):s),this.reason=s,this.code=t,this.source=n,this.traceId=a}toJSON(){let e={message:this.message,code:this.code,source:this.source,traceId:this.traceId,reason:this.reason,stack:this.stack};return JSON.parse(JSON.stringify(e))}},m=class extends p{name=`SDKBridgeError`},ee=e=>[...new Set(e)],h=(e,t)=>e.filter(e=>!t.includes(e)),g=(e,t)=>e.filter(e=>t.includes(e)),_=e=>typeof e==`bigint`||!Number.isNaN(Number(e))&&Math.floor(Number(e))===e,v=e=>typeof e==`bigint`||e>=0&&Number.isSafeInteger(e);function y(e,t){if(t.length===0)return e;let n,r=[...e];for(let e=r.length-1,i=0,a=0;e>0;e--,i++){i%=t.length,a+=n=t[i].codePointAt(0);let o=(n+i+a)%e,s=r[e],c=r[o];r[o]=s,r[e]=c}return r}var b=(e,t)=>{let n=[],r=e;if(typeof r==`bigint`){let e=BigInt(t.length);do n.unshift(t[Number(r%e)]),r/=e;while(r>BigInt(0))}else do n.unshift(t[r%t.length]),r=Math.floor(r/t.length);while(r>0);return n},x=(e,t)=>e.reduce((n,r)=>{let i=t.indexOf(r);if(i===-1)throw Error(`The provided ID (${e.join(``)}) is invalid, as it contains characters that do not exist in the alphabet (${t.join(``)})`);if(typeof n==`bigint`)return n*BigInt(t.length)+BigInt(i);let a=n*t.length+i;return Number.isSafeInteger(a)?a:(re(`Unable to decode the provided string, due to lack of support for BigInt numbers in the current environment`),BigInt(n)*BigInt(t.length)+BigInt(i))},0),S=/^\+?\d+$/,C=e=>{if(!S.test(e))return NaN;let t=Number.parseInt(e,10);return Number.isSafeInteger(t)?t:(re(`Unable to encode the provided BigInt string without loss of information due to lack of support for BigInt type in the current environment`),BigInt(e))},te=(e,t,n)=>Array.from({length:Math.ceil(e.length/t)},(r,i)=>n(e.slice(i*t,(i+1)*t))),w=e=>new RegExp(e.map(e=>ne(e)).sort((e,t)=>t.length-e.length).join(`|`)),T=e=>RegExp(`^[${e.map(e=>ne(e)).sort((e,t)=>t.length-e.length).join(``)}]+$`),ne=e=>e.replace(/[\s#$()*+,.?[\\\]^{|}-]/g,`\\$&`),re=(e=`BigInt is not available in this environment`)=>{if(typeof BigInt!=`function`)throw TypeError(e)},ie=16,ae=3.5,oe=12,se=16,ce=12,le=100,ue=new class{constructor(e=``,t=0,n=`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`,r=`cfhistuCFHISTU`){if(this.minLength=t,typeof t!=`number`)throw TypeError(`Hashids: Provided 'minLength' has to be a number (is ${typeof t})`);if(typeof e!=`string`)throw TypeError(`Hashids: Provided 'salt' has to be a string (is ${typeof e})`);if(typeof n!=`string`)throw TypeError(`Hashids: Provided alphabet has to be a string (is ${typeof n})`);let i=Array.from(e),a=Array.from(n),o=Array.from(r);this.salt=i;let s=ee(a);if(s.length<ie)throw Error(`Hashids: alphabet must contain at least ${ie} unique characters, provided: ${s.join(``)}`);this.alphabet=h(s,o),this.seps=y(g(o,s),i);let c,l;(this.seps.length===0||this.alphabet.length/this.seps.length>ae)&&(c=Math.ceil(this.alphabet.length/ae),c>this.seps.length&&(l=c-this.seps.length,this.seps.push(...this.alphabet.slice(0,l)),this.alphabet=this.alphabet.slice(l))),this.alphabet=y(this.alphabet,i);let u=Math.ceil(this.alphabet.length/oe);this.alphabet.length<3?(this.guards=this.seps.slice(0,u),this.seps=this.seps.slice(u)):(this.guards=this.alphabet.slice(0,u),this.alphabet=this.alphabet.slice(u)),this.guardsRegExp=w(this.guards),this.sepsRegExp=w(this.seps),this.allowedCharsRegExp=T([...this.alphabet,...this.guards,...this.seps])}encode(e,...t){let n=Array.isArray(e)?e:[...e==null?[]:[e],...t];return n.length===0||(n.every(_)||(n=n.map(e=>typeof e==`bigint`||typeof e==`number`?e:C(String(e)))),!n.every(v))?``:this._encode(n).join(``)}decode(e){return!e||typeof e!=`string`||e.length===0?[]:this._decode(e)}encodeHex(e){let t=e;switch(typeof t){case`bigint`:t=t.toString(se);break;case`string`:if(!/^[\dA-Fa-f]+$/.test(t))return``;break;default:throw Error(`Hashids: The provided value is neither a string, nor a BigInt (got: ${typeof t})`)}let n=te(t,ce,e=>Number.parseInt(`1${e}`,16));return this.encode(n)}decodeHex(e){return this.decode(e).map(e=>e.toString(se).slice(1)).join(``)}isValidId(e){return this.allowedCharsRegExp.test(e)}_encode(e){let{alphabet:t}=this,n=e.reduce((e,t,n)=>e+(typeof t==`bigint`?Number(t%BigInt(n+le)):t%(n+le)),0),r=[t[n%t.length]],i=[...r],{seps:a}=this,{guards:o}=this;if(e.forEach((n,o)=>{let s=i.concat(this.salt,t);t=y(t,s);let c=b(n,t);if(r.push(...c),o+1<e.length){let e=c[0].codePointAt(0)+o,t=typeof n==`bigint`?Number(n%BigInt(e)):n%e;r.push(a[t%a.length])}}),r.length<this.minLength){let e=(n+r[0].codePointAt(0))%o.length;if(r.unshift(o[e]),r.length<this.minLength){let e=(n+r[2].codePointAt(0))%o.length;r.push(o[e])}}let s=Math.floor(t.length/2);for(;r.length<this.minLength;){t=y(t,t),r.unshift(...t.slice(s)),r.push(...t.slice(0,s));let e=r.length-this.minLength;if(e>0){let t=e/2;r=r.slice(t,t+this.minLength)}}return r}_decode(e){if(!this.isValidId(e))throw Error(`The provided ID (${e}) is invalid, as it contains characters that do not exist in the alphabet (${this.guards.join(``)}${this.seps.join(``)}${this.alphabet.join(``)})`);let t=e.split(this.guardsRegExp),n=t[t.length===3||t.length===2?1:0];if(n.length===0)return[];let r=n[Symbol.iterator]().next().value,i=n.slice(r.length).split(this.sepsRegExp),a=this.alphabet,o=[];for(let e of i){let t=[r,...this.salt,...a],n=y(a,t.slice(0,a.length));o.push(x(Array.from(e),n)),a=n}return this._encode(o).join(``)===e?o:[]}}(`intl-open-sdk`,6);function de(e,t,n=!1){return(...r)=>{let i,a=new Promise((e,r)=>{i=setTimeout(()=>{n?r(n):e(void 0)},t)});return Promise.race([a,e(...r)]).finally(()=>clearTimeout(i))}}var E=(e=``)=>e+ue.encode(`${Date.now()}${Math.ceil(Math.random()*100)}`),D=class{targetPort;handlers=new Map;debugCallback;name;constructor(e,t){this.targetPort=t,t.onmessage=this.handleMessage,this.name=e}setDebugCallback(e){this.debugCallback=e}onClose(e){return new Promise((t,n)=>{this.on(`close`,async r=>{if(r.name===this.name)try{await e(r.manual),t()}catch(e){n(e)}})})}close(e=!1){return this.send(`close`,{name:this.name,manual:e}),new Promise(()=>{})}on(e,t){return this.handlers.has(e)||this.handlers.set(e,new Set),this.handlers.get(e).add(t),()=>{this.handlers.get(e).delete(t)}}send(e,t){let n={id:E(`modal_port_`),type:e,payload:t};this.debugCallback&&this.debugCallback({...n,type:`MODAL_PORT@`+n.type},`OUT`),this.targetPort.postMessage(n)}handleMessage=e=>{let{type:t,payload:n}=e.data,r=this.handlers.get(t);r&&(this.debugCallback&&this.debugCallback({...e.data,type:`MODAL_PORT@`+e.data.type},`IN`),r.forEach(e=>{e(n)}))}},fe=class{targetPorts=[];name;constructor(e){this.name=e}addPort(e){this.targetPorts.push(...e)}removePort(e){this.targetPorts=this.targetPorts.filter(t=>e!==t)}async getValues(e){return de(()=>Promise.all(this.targetPorts.map(e=>new Promise((t,n)=>{e.postMessage({id:Math.random()+``,type:`${this.name}:START_COLLECT_VALUE`}),e.onmessage=e=>{let r=e.data;(!r||!r.type)&&n(Error(`collect error`));let[i,a]=r.type.split(`:`);a===`SEND_ELEMENT_VALUE`&&t({[i]:r.payload})}}))).then(e=>e.reduce((e,t)=>({...e,...t}),{})),e?.timeout||1e4)()}},pe=class{targetPort;name;constructor(e,t){this.targetPort=t,this.name=e}onSendRequest(e){this.targetPort.onmessage=async t=>{let n=t.data;if(!n||!n.type)return;let[r,i]=n.type.split(`:`);i===`START_COLLECT_VALUE`&&e()}}send(e={}){let t={id:Math.random()+``,payload:e,type:`${this.name}:SEND_ELEMENT_VALUE`};this.targetPort.postMessage(t)}},O={HANDSHAKE:`OPENSDK@HANDSHAKE`,UPDATE_CONFIG:`OPENSDK@UPDATE_CONFIG`,SUBMIT:`OPENSDK@SUBMIT`,SUBMIT_REPLY:`OPENSDK@SUBMIT_REPLY`,REDIRECT:`OPENSDK@REDIRECT`,OPEN_MODAL:`OPENSDK@OPEN_MODAL`,OPEN_MODAL_ERROR:`OPENSDK@OPEN_MODAL_ERROR`,CLOSE_MODAL:`OPENSDK@CLOSE_MODAL`,ERROR:`OPENSDK@ERROR`,HANDSHAKE_ACK:`OPENSDK@HANDSHAKE_ACK`,TRANSFER_RECEIVE_PORT:`OPENSDK@TRANSFER_RECEIVE_PORT`,MESSAGE:`OPENSDK@MESSAGE`,TRANSFER_SEND_PORT:`OPENSDK@TRANSFER_SEND_PORT`,TRANSFER_APP_PORT:`OPENSDK@TRANSFER_APP_PORT`,TRANSFER_MODAL_PORT:`OPENSDK@TRANSFER_MODAL_PORT`,TRANSFER_MODAL_APPEARANCE:`OPENSDK@TRANSFER_MODAL_APPEARANCE`,HEIGHT_UPDATE:`OPENSDK@HEIGHT_UPDATE`},me=c(o(((e,t)=>{var n=`Expected a function`,r=NaN,i=`[object Symbol]`,a=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt,u=typeof global==`object`&&global&&global.Object===Object&&global,d=typeof self==`object`&&self&&self.Object===Object&&self,f=u||d||Function(`return this`)(),p=Object.prototype.toString,m=Math.max,ee=Math.min,h=function(){return f.Date.now()};function g(e,t,r){var i,a,o,s,c,l,u=0,d=!1,f=!1,p=!0;if(typeof e!=`function`)throw TypeError(n);t=b(t)||0,_(r)&&(d=!!r.leading,f=`maxWait`in r,o=f?m(b(r.maxWait)||0,t):o,p=`trailing`in r?!!r.trailing:p);function g(t){var n=i,r=a;return i=a=void 0,u=t,s=e.apply(r,n),s}function v(e){return u=e,c=setTimeout(S,t),d?g(e):s}function y(e){var n=e-l,r=e-u,i=t-n;return f?ee(i,o-r):i}function x(e){var n=e-l,r=e-u;return l===void 0||n>=t||n<0||f&&r>=o}function S(){var e=h();if(x(e))return C(e);c=setTimeout(S,y(e))}function C(e){return c=void 0,p&&i?g(e):(i=a=void 0,s)}function te(){c!==void 0&&clearTimeout(c),u=0,i=l=a=c=void 0}function w(){return c===void 0?s:C(h())}function T(){var e=h(),n=x(e);if(i=arguments,a=this,l=e,n){if(c===void 0)return v(l);if(f)return c=setTimeout(S,t),g(l)}return c===void 0&&(c=setTimeout(S,t)),s}return T.cancel=te,T.flush=w,T}function _(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function v(e){return!!e&&typeof e==`object`}function y(e){return typeof e==`symbol`||v(e)&&p.call(e)==i}function b(e){if(typeof e==`number`)return e;if(y(e))return r;if(_(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=_(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=e.replace(a,``);var n=s.test(e);return n||c.test(e)?l(e.slice(2),n?2:8):o.test(e)?r:+e}t.exports=g}))(),1),k=[O.TRANSFER_RECEIVE_PORT,O.TRANSFER_SEND_PORT,O.TRANSFER_MODAL_PORT,O.TRANSFER_MODAL_APPEARANCE,O.OPEN_MODAL_ERROR,O.TRANSFER_APP_PORT,O.CLOSE_MODAL,O.OPEN_MODAL,O.REDIRECT,O.MESSAGE],A=`@@global`,j=`@@native`,he=.01,ge=10,_e=class e{targetWindow;currentWindow;targetOrigin=`*`;scope;handlers=new Map;mode;resizeObserver;debugCallback;receivePort;static getGlobalBridge(t){return new e(t,A)}static getNativeBridge(t){return new e(`WEBAPP`,j,t)}static getBridge(t,n){if(n===j||n===A)throw Error(`Scope cannot be NATIVE_SCOPE or GLOBAL_SCOPE`);return new e(t,n)}constructor(e,t,n){this.mode=e,this.scope=t,n?this.currentWindow=n:this.currentWindow=window,this.mode===`WEBAPP`&&(this.targetWindow=this.currentWindow?.parent),this.currentWindow?.addEventListener(`message`,this.handleMessage)}setTarget(e){this.targetWindow=e}setOrigin(e){this.targetOrigin=e}setDebugCallback(e){this.debugCallback=e}destroy(){this.currentWindow?.removeEventListener(`message`,this.handleMessage),this.handlers.clear(),this.resizeObserver?.disconnect()}_addPort(e){this._transferPort(O.TRANSFER_RECEIVE_PORT,this.receivePort?.name,e)}_transferReceivePort(e){this._transferPort(O.TRANSFER_RECEIVE_PORT,e.name,e.targetPorts)}_transferSendPort(e){this._transferPort(O.TRANSFER_SEND_PORT,e.name,[e.targetPort])}send(e,t,n){if(!this.targetWindow){console.warn(`[Bridge] Target window not set. Cannot send message:`,e),this.debugCallback?.({id:E(`bridge`),type:`SYSTEM_${O.ERROR}`,payload:{message:`Target window not set`}},`OUT`);return}let r={id:E(`bridge`),type:this.getOriginSendType(e),payload:t};this.debugCallback&&this.debugCallback(r,`OUT`),this.targetWindow.postMessage(r,this.targetOrigin,n)}sendError(e){this.mode===`WEBAPP`&&this.send(O.ERROR,e.toJSON())}sendSubmit(e){this.mode===`WEBAPP`&&this.send(O.SUBMIT_REPLY,e)}sendMessage(e,t){this.mode===`WEBAPP`&&this.send(O.MESSAGE,{type:e,message:t})}redirect(e,t=`redirect`){if(this.mode===`WEBAPP`){if(!e)throw new m(`url is required`,`INVALID_REDIRECT_URL`,`SDK_INTERNAL`);try{new URL(e)}catch{throw new m(`Invalid URL`,`INVALID_REDIRECT_URL`,`SDK_INTERNAL`)}this.send(O.REDIRECT,{url:e,mode:t})}}openModal(e){return this.send(O.OPEN_MODAL,{...e,scope:this.scope}),new Promise((e,t)=>{this.once(O.OPEN_MODAL_ERROR,e=>{t(new p(e.message,e.code,e.source))}),this.once(O.TRANSFER_APP_PORT,(t,n)=>{if(!n?.[0])throw new m(`No ports transferred for modal communication`,`NO_PORTS_ERROR`,`SDK_INTERNAL`);e(new D(t,n[0]))})})}closeModal(){this.send(O.CLOSE_MODAL)}on(e,t){let n=this.getOriginListenType(e);return this.handlers.has(n)||this.handlers.set(n,new Set),this.handlers.get(n).add(t),()=>{this.handlers.get(n).delete(t)}}once(e,t){let n=(r,i)=>{try{t(r,i)}finally{this.off(e,n)}};this.on(e,n)}off(e,t){let n=this.getOriginListenType(e),r=this.handlers.get(n);r&&r.delete(t)}handsShake(e,t){if(this.mode!==`WEBAPP`)throw new m(`handsShake can only be called in WEBAPP mode`,`UNKNOWN_ERROR`,`SDK_INTERNAL`);let n=this.on(O.HANDSHAKE,async n=>{n?.elementMode===`GROUP`?n.isMainElement?this.getReceivePort().then(e=>{t(n,e)}).catch(()=>{t(n)}):this.getSendPort().then(e=>{t(n,e)}).catch(()=>{t(n)}):t(n);let r=0,i=(0,me.default)(e=>{(Math.abs(e-r)>ge||Math.abs((e-r)/r)>he)&&(r=e,this.send(O.HEIGHT_UPDATE,e))},400);this.resizeObserver=new ResizeObserver(e=>{e?.[0]?.contentRect?.height&&i(e[0].contentRect.height)}),this.resizeObserver.observe(document.body),this.send(O.HANDSHAKE_ACK,{version:e})});return()=>{n(),this.resizeObserver?.disconnect()}}handleMessage=e=>{let t=e.data;if(!t||!t.type)return;let[n,r]=t.type.split(`:`);if(this.scope!==j&&(![`WEBAPP`,`HOST`].includes(r)||this.targetOrigin!==`*`&&e.origin!==this.targetOrigin||this.mode===r))return;let i=this.handlers.get(t.type);this.scope!==j&&(i||t.type.endsWith(O.ERROR)||t.type.endsWith(O.MESSAGE))&&this.debugCallback&&this.scope===n&&this.debugCallback(t,`IN`),i&&new Set(i).forEach(n=>n(t.payload,e.ports))};getOriginListenType(e){return e===`error`&&(e=O.ERROR),this.scope===j?e:`${k.includes(e)?A:this.scope}:${this.mode===`WEBAPP`?`HOST`:`WEBAPP`}:${e}`}getOriginSendType(e){return e===`error`&&(e=O.ERROR),this.scope===j?e:`${k.includes(e)?A:this.scope}:${this.mode}:${e}`}_transferPort(e,t,n){if(!this.targetWindow){console.warn(`[Bridge] Target window not set. Cannot send port`);return}this.mode===`HOST`&&this.targetWindow.postMessage({id:E(),type:this.getOriginSendType(e),payload:t},this.targetOrigin,n)}getReceivePort(){return new Promise(e=>{this.on(O.TRANSFER_RECEIVE_PORT,(t,n)=>{this.receivePort||=new fe(t),this.receivePort.addPort(n),e(this.receivePort)})})}getSendPort(){return new Promise((e,t)=>{this.on(O.TRANSFER_SEND_PORT,(n,r)=>{r?e(new pe(n,r[0])):t(Error(`no ports transfer`))})})}},ve=`https://cdn.marmot-cloud.com/tnpm-package/@antintl-opensdk-debugger/1.0.1/dist/tracker.umd.js`,ye=class{options;tracker;trackId;constructor(e){this.options=this.initialOptions(e)}initialOptions(e){return this.options={...this.options,...e,appId:e?.appId||this.options?.appId||`180020050100012557`,performance:e?.performance===!0||this.options?.performance===!0,error:e?.error===!0||this.options?.error===!0},`trackId`in this.options&&(this.trackId=this.options.trackId),this.options}loadTacker(e){return(0,d.loadScript)(ve,`intlSdkTracker`).then(t=>t.variable?.getTrackerInstance(this.initialOptions(e)))}async initTracker(e){if(this.tracker&&!this.options)return this.tracker;let t=await this.loadTacker(e);return t&&(this.tracker=t),t}safeCall(e){return this.initTracker().then(e)}setTrackId(e){this.trackId=e,this.set({trackId:e})}set(e){this.safeCall(t=>t?.set(e))}pv(){this.safeCall(e=>e?.pv())}log(...e){this.trackId&&(e[0].d18=this.trackId),this.safeCall(t=>t?.log(...e))}click(...e){this.safeCall(t=>t?.click(...e))}expo(...e){this.safeCall(t=>t?.expo(...e))}onSendData(...e){this.safeCall(t=>t?.onSendData(...e))}offSendData(...e){this.safeCall(t=>t?.offSendData(...e))}pageMonitor(...e){this.safeCall(t=>t?.pageMonitor(...e))}reportCustomizedPerformance(...e){this.safeCall(t=>t?.reportCustomizedPerformance(...e))}};new ye;var be=c(o(((e,t)=>{var n=200,r=`__lodash_hash_undefined__`,i=800,a=16,o=9007199254740991,s=`[object Arguments]`,c=`[object Array]`,l=`[object AsyncFunction]`,u=`[object Boolean]`,d=`[object Date]`,f=`[object Error]`,p=`[object Function]`,m=`[object GeneratorFunction]`,ee=`[object Map]`,h=`[object Number]`,g=`[object Null]`,_=`[object Object]`,v=`[object Proxy]`,y=`[object RegExp]`,b=`[object Set]`,x=`[object String]`,S=`[object Undefined]`,C=`[object WeakMap]`,te=`[object ArrayBuffer]`,w=`[object DataView]`,T=`[object Float32Array]`,ne=`[object Float64Array]`,re=`[object Int8Array]`,ie=`[object Int16Array]`,ae=`[object Int32Array]`,oe=`[object Uint8Array]`,se=`[object Uint8ClampedArray]`,ce=`[object Uint16Array]`,le=`[object Uint32Array]`,ue=/[\\^$.*+?()[\]{}|]/g,de=/^\[object .+?Constructor\]$/,E=/^(?:0|[1-9]\d*)$/,D={};D[T]=D[ne]=D[re]=D[ie]=D[ae]=D[oe]=D[se]=D[ce]=D[le]=!0,D[s]=D[c]=D[te]=D[u]=D[w]=D[d]=D[f]=D[p]=D[ee]=D[h]=D[_]=D[y]=D[b]=D[x]=D[C]=!1;var fe=typeof global==`object`&&global&&global.Object===Object&&global,pe=typeof self==`object`&&self&&self.Object===Object&&self,O=fe||pe||Function(`return this`)(),me=typeof e==`object`&&e&&!e.nodeType&&e,k=me&&typeof t==`object`&&t&&!t.nodeType&&t,A=k&&k.exports===me,j=A&&fe.process,he=function(){try{return k&&k.require&&k.require(`util`).types||j&&j.binding&&j.binding(`util`)}catch{}}(),ge=he&&he.isTypedArray;function _e(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function ve(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function ye(e){return function(t){return e(t)}}function be(e,t){return e?.[t]}function M(e,t){return function(n){return e(t(n))}}var xe=Array.prototype,Se=Function.prototype,N=Object.prototype,P=O[`__core-js_shared__`],F=Se.toString,I=N.hasOwnProperty,Ce=function(){var e=/[^.]+$/.exec(P&&P.keys&&P.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}(),L=N.toString,we=F.call(Object),Te=RegExp(`^`+F.call(I).replace(ue,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),R=A?O.Buffer:void 0,Ee=O.Symbol,z=O.Uint8Array,B=R?R.allocUnsafe:void 0,V=M(Object.getPrototypeOf,Object),H=Object.create,U=N.propertyIsEnumerable,De=xe.splice,W=Ee?Ee.toStringTag:void 0,G=function(){try{var e=xt(Object,`defineProperty`);return e({},``,{}),e}catch{}}(),Oe=R?R.isBuffer:void 0,ke=Math.max,Ae=Date.now,je=xt(O,`Map`),K=xt(Object,`create`),Me=function(){function e(){}return function(t){if(!Q(t))return{};if(H)return H(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function q(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ne(){this.__data__=K?K(null):{},this.size=0}function Pe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function Fe(e){var t=this.__data__;if(K){var n=t[e];return n===r?void 0:n}return I.call(t,e)?t[e]:void 0}function Ie(e){var t=this.__data__;return K?t[e]!==void 0:I.call(t,e)}function J(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=K&&t===void 0?r:t,this}q.prototype.clear=Ne,q.prototype.delete=Pe,q.prototype.get=Fe,q.prototype.has=Ie,q.prototype.set=J;function Y(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Le(){this.__data__=[],this.size=0}function Re(e){var t=this.__data__,n=tt(t,e);return n<0?!1:(n==t.length-1?t.pop():De.call(t,n,1),--this.size,!0)}function ze(e){var t=this.__data__,n=tt(t,e);return n<0?void 0:t[n][1]}function Be(e){return tt(this.__data__,e)>-1}function Ve(e,t){var n=this.__data__,r=tt(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}Y.prototype.clear=Le,Y.prototype.delete=Re,Y.prototype.get=ze,Y.prototype.has=Be,Y.prototype.set=Ve;function X(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function He(){this.size=0,this.__data__={hash:new q,map:new(je||Y),string:new q}}function Ue(e){var t=bt(this,e).delete(e);return this.size-=t?1:0,t}function We(e){return bt(this,e).get(e)}function Ge(e){return bt(this,e).has(e)}function Ke(e,t){var n=bt(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}X.prototype.clear=He,X.prototype.delete=Ue,X.prototype.get=We,X.prototype.has=Ge,X.prototype.set=Ke;function Z(e){this.size=(this.__data__=new Y(e)).size}function qe(){this.__data__=new Y,this.size=0}function Je(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Ye(e){return this.__data__.get(e)}function Xe(e){return this.__data__.has(e)}function Ze(e,t){var r=this.__data__;if(r instanceof Y){var i=r.__data__;if(!je||i.length<n-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new X(i)}return r.set(e,t),this.size=r.size,this}Z.prototype.clear=qe,Z.prototype.delete=Je,Z.prototype.get=Ye,Z.prototype.has=Xe,Z.prototype.set=Ze;function Qe(e,t){var n=Rt(e),r=!n&&Lt(e),i=!n&&!r&&Vt(e),a=!n&&!r&&!i&&Gt(e),o=n||r||i||a,s=o?ve(e.length,String):[],c=s.length;for(var l in e)(t||I.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||wt(l,c)))&&s.push(l);return s}function $e(e,t,n){(n!==void 0&&!It(e[t],n)||n===void 0&&!(t in e))&&nt(e,t,n)}function et(e,t,n){var r=e[t];(!(I.call(e,t)&&It(r,n))||n===void 0&&!(t in e))&&nt(e,t,n)}function tt(e,t){for(var n=e.length;n--;)if(It(e[n][0],t))return n;return-1}function nt(e,t,n){t==`__proto__`&&G?G(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var rt=yt();function it(e){return e==null?e===void 0?S:g:W&&W in Object(e)?St(e):At(e)}function at(e){return $(e)&&it(e)==s}function ot(e){return!Q(e)||Dt(e)?!1:(Ht(e)?Te:de).test(Ft(e))}function st(e){return $(e)&&Ut(e.length)&&!!D[it(e)]}function ct(e){if(!Q(e))return kt(e);var t=Ot(e),n=[];for(var r in e)r==`constructor`&&(t||!I.call(e,r))||n.push(r);return n}function lt(e,t,n,r,i){e!==t&&rt(t,function(a,o){if(i||=new Z,Q(a))ut(e,t,o,n,lt,r,i);else{var s=r?r(Mt(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),$e(e,o,s)}},qt)}function ut(e,t,n,r,i,a,o){var s=Mt(e,n),c=Mt(t,n),l=o.get(c);if(l){$e(e,n,l);return}var u=a?a(s,c,n+``,e,t,o):void 0,d=u===void 0;if(d){var f=Rt(c),p=!f&&Vt(c),m=!f&&!p&&Gt(c);u=c,f||p||m?Rt(s)?u=s:Bt(s)?u=gt(s):p?(d=!1,u=pt(c,!0)):m?(d=!1,u=ht(c,!0)):u=[]:Wt(c)||Lt(c)?(u=s,Lt(s)?u=Kt(s):(!Q(s)||Ht(s))&&(u=Ct(c))):d=!1}d&&(o.set(c,u),i(u,c,r,a,o),o.delete(c)),$e(e,n,u)}function dt(e,t){return Nt(jt(e,t,Xt),e+``)}var ft=G?function(e,t){return G(e,`toString`,{configurable:!0,enumerable:!1,value:Yt(t),writable:!0})}:Xt;function pt(e,t){if(t)return e.slice();var n=e.length,r=B?B(n):new e.constructor(n);return e.copy(r),r}function mt(e){var t=new e.constructor(e.byteLength);return new z(t).set(new z(e)),t}function ht(e,t){var n=t?mt(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function gt(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}function _t(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?nt(n,s,c):et(n,s,c)}return n}function vt(e){return dt(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&Tt(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}function yt(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}function bt(e,t){var n=e.__data__;return Et(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function xt(e,t){var n=be(e,t);return ot(n)?n:void 0}function St(e){var t=I.call(e,W),n=e[W];try{e[W]=void 0;var r=!0}catch{}var i=L.call(e);return r&&(t?e[W]=n:delete e[W]),i}function Ct(e){return typeof e.constructor==`function`&&!Ot(e)?Me(V(e)):{}}function wt(e,t){var n=typeof e;return t??=o,!!t&&(n==`number`||n!=`symbol`&&E.test(e))&&e>-1&&e%1==0&&e<t}function Tt(e,t,n){if(!Q(n))return!1;var r=typeof t;return(r==`number`?zt(n)&&wt(t,n.length):r==`string`&&t in n)?It(n[t],e):!1}function Et(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function Dt(e){return!!Ce&&Ce in e}function Ot(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||N)}function kt(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}function At(e){return L.call(e)}function jt(e,t,n){return t=ke(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=ke(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),_e(e,this,s)}}function Mt(e,t){if(!(t===`constructor`&&typeof e[t]==`function`)&&t!=`__proto__`)return e[t]}var Nt=Pt(ft);function Pt(e){var t=0,n=0;return function(){var r=Ae(),o=a-(r-n);if(n=r,o>0){if(++t>=i)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Ft(e){if(e!=null){try{return F.call(e)}catch{}try{return e+``}catch{}}return``}function It(e,t){return e===t||e!==e&&t!==t}var Lt=at(function(){return arguments}())?at:function(e){return $(e)&&I.call(e,`callee`)&&!U.call(e,`callee`)},Rt=Array.isArray;function zt(e){return e!=null&&Ut(e.length)&&!Ht(e)}function Bt(e){return $(e)&&zt(e)}var Vt=Oe||Zt;function Ht(e){if(!Q(e))return!1;var t=it(e);return t==p||t==m||t==l||t==v}function Ut(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=o}function Q(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}function $(e){return typeof e==`object`&&!!e}function Wt(e){if(!$(e)||it(e)!=_)return!1;var t=V(e);if(t===null)return!0;var n=I.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&F.call(n)==we}var Gt=ge?ye(ge):st;function Kt(e){return _t(e,qt(e))}function qt(e){return zt(e)?Qe(e,!0):ct(e)}var Jt=vt(function(e,t,n){lt(e,t,n)});function Yt(e){return function(){return e}}function Xt(e){return e}function Zt(){return!1}t.exports=Jt}))(),1);function M(e,...t){return(0,be.default)(e,...t)}function xe(e){let{message:t,traceId:n,code:r,source:i,stack:a,reason:o}=e;if(e.source===`SERVER_API`){let[e,s,c,l]=n?.match(/([a-z0-9\sA-Z]*)(\s*\(([a-zA-Z0-9\.]*)\))?/)||[],u={code:r,source:i,message:t,operationType:l,traceId:s?.replace(/\s/g,``)||`无traceID`,stack:a,reason:o};return JSON.parse(JSON.stringify(u))}return e}var Se=new ye({appId:`180020050100012557`,performance:!1,error:!1}),N=`7981`,P=e=>{N=e},F=(e=``)=>t=>{Se.log({code:`${N}${e}`,...t})},I=F(),Ce=F(`event`),L=F(`iframe`),we=F(`handshake`),Te=F(`merchant`),R=F(`element`),Ee=()=>{if(window.sdkDebugger)return Promise.resolve(window.sdkDebugger);let e=`0.0.20260320102506-dev.21`.replace(/-dev\.[0-9]+/,``),t=`https://cdn.marmot-cloud.com/tnpm-package/@antintl-opensdk-debugger/1.0.3/dist/main.umd.js`;return t=`https://marmot-local-dev.oss-accelerate.aliyuncs.com/tnpm-package/@antintl-opensdk-debugger/${e}/dist/main.umd.js`,(0,d.loadScript)(t,`sdkDebugger`).then(e=>e.variable)},z=(e,t,n,r)=>{if(e===`ERROR`){let e=r||{};I({msg:e.code||n,d1:t,d2:e.reason,d3:e.stack,d4:e.traceId,d5:e.operationType,d6:n})}else if(n.includes(`:HOST:`)||n.includes(`:WEBAPP:`)){let[i,a,o]=n.split(`:`);Ce({msg:o,d1:t,d2:i,d3:a,d4:JSON.stringify(r),d5:`无`,d6:e})}window.sdkDebugger?.log(e,t,n,r)},B=e=>{if(!e)return;let t=xe(p.isError(e)?e.toJSON():e);z(`ERROR`,t.source,t.operationType||t.message||`Unknown Error`,t)},V=class extends p{name=`SDKInternalError`},H=class extends _e{static getGlobalBridge(){return _e.getGlobalBridge(`HOST`)}constructor(e){super(`HOST`,e)}_transferReceivePort(e){super._transferReceivePort(e)}_addPort(e){super._addPort(e)}_transferSendPort(e){super._transferSendPort(e)}setTarget(e){super.setTarget(e)}setDebugCallback(...e){super.setDebugCallback(...e)}},U=class extends V{name=`MountError`;constructor(e,t,n){super(e,t,n||`SDK_USAGE`)}},De=class{static elementType;name;_elementMode;_isMainElement;config;bridge;hooks={};iframe=null;status;cachedSend=[];constructor(e,t){this.config=t,this._isMainElement=t.isMainElement,this._elementMode=t.elementMode,this.name=e,this.bridge=new H(e),this.bridge.setOrigin(t.targetOrigin),this.config.debug&&this.bridge.setDebugCallback((e,t)=>{e.type.endsWith(O.UPDATE_CONFIG)||e.type.endsWith(O.HEIGHT_UPDATE)||(e.type.endsWith(O.MESSAGE)?z(e.payload?.type,`APP_RUNTIME`,e.type,e.payload?.message):e.type.endsWith(O.ERROR)&&t===`IN`?B(e.payload):z(`INFO`,t===`OUT`?`SDK_INTERNAL`:`APP_RUNTIME`,e.type,e.payload))}),this.status=`initialized`}submit(e){throw new V(`This element not support submit`,`NOT_SUPPORT_SUBMIT`,`SDK_USAGE`)}async setup(){}async mount(e){if(this.status!==`initialized`&&this.status!==`unmounted`){let e=new U({message:`element status is ${this.status}, can not mount again`,params:{status:this.status}},`MOUNT_NOT_SUPPORT`);throw B(e),e}return de(()=>Promise.all([this.setup(),this._mount(e)]),15e3,new U(`Mount timeout`,`MOUNT_TIMEOUT`,`SYSTEM`))().then(e=>{let[t]=e;Te({msg:this.name,d1:t?.merchantId||`未配置的商户`}),this.bridge.send(O.HANDSHAKE,M(this.config.appConfig,t||{}))}).catch(e=>{this.umount();let t=V.unificationError(e);throw B(t),t})}async _mount(e){return new Promise(async(t,n)=>{if(!this.isMainElement&&this.isSingleMode)return n(new U({message:`${this.name} element can not be used with single mode`,params:{elementName:this.name}},`MOUNT_NOT_MAINELEMENT_WITH_SINGLE_MODE`));try{if(!e)return n(new U(`container missing`,`MOUNT_MISSING_CONTAINER`));if(this.iframe)return e.appendChild(this.iframe),t();let r=this.config.appUrl,i=new URL(this.config.appUrl);try{i.searchParams.set(`origin`,window.location.origin),i.searchParams.set(`locale`,this.config.locale),r=i.toString()}catch{let e=r.includes(`?`)?`&`:`?`;r=`${r}${e}origin=${encodeURIComponent(window.location.origin)}${e}locale=${encodeURIComponent(this.config.locale)}`}this.status=`mounting`;let a=this.iframe=document.createElement(`iframe`);a.src=r,a.style.width=`100%`,a.style.height=`100%`,a.style.border=`none`,a.style.maxHeight=`100vh`,a.style.height=`0`,a.style.borderRadius=`inherit`,a.style.transition=`height 0.3s ease`;let o=Date.now();this.iframe.onload=()=>{if(!this.iframe?.contentWindow)return t();z(`INFO`,`SYSTEM`,`Iframe ${this.name} loaded, initiating handshake...`),this.status=`mounted`,L({msg:this.name,d1:`是`,m1:Math.round(Date.now()-o),m2:1});{let e=`*`;try{e=new URL(this.iframe.src).origin,e===`null`&&(e=`*`)}catch{e=`*`}this.bridge.setOrigin(e)}this.bridge.setTarget(this.iframe.contentWindow);let e=Date.now(),n=setTimeout(()=>{we({msg:this.name,d1:`handshake timeout`,m1:Math.round(Date.now()-e),m2:0,m3:Math.round(Date.now()-o)})},15e3);this.bridge.on(O.HEIGHT_UPDATE,e=>{a.style.height=`${e}px`}),this.bridge.on(O.HANDSHAKE_ACK,t=>{clearTimeout(n),this.status=`ready`,we({msg:this.name,d1:`handshake ack`,m1:Math.round(Date.now()-e),m2:1,m3:Math.round(Date.now()-o)}),this.cachedSend.length&&(this.cachedSend.forEach(({type:e,payload:t})=>{this.bridge.send(e,t)}),this.cachedSend=[]),console.log(t?.version||`异常的版本`)}),t()},this.iframe.onerror=e=>{L({msg:this.name,d1:`否`,m1:Math.round(Date.now()-o),m2:0}),n(new U(`Iframe load error: ${e}`,`MOUNT_IFRAME_LOAD_ERROR`,`SYSTEM`))},e.appendChild(this.iframe)}catch(e){n(new U(`Initialization crashed: ${e.message}`,`MOUNT_INITIAL_FAILED`,`SDK_INTERNAL`))}})}updateConfig(e){try{if(this.status===`destroyed`)throw new V(`Element already destroyed, cannot update destroyed SDK instance`,`ELEMENT_INSTANCE_DESTROYED`,`SDK_USAGE`);this.config.appConfig=M(this.config.appConfig,e),z(`INFO`,`SDK_USAGE`,`Updating configuration via API`,e),this.bridge.send(O.UPDATE_CONFIG,{merged:this.config.appConfig,updated:e})}catch(e){B(V.unificationError(e))}}umount(){(this.status===`mounted`||this.status===`ready`)&&(this.status=`unmounted`,this.iframe&&this.iframe.parentNode&&this.iframe.parentNode.removeChild(this.iframe))}get isSingleMode(){return this._elementMode===`SINGLE`}on(e,t){this.bridge.on(e,t)}send(e,t){if(this.status===`destroyed`){B(new V(`element status is ${this.status}, can not send message`,`ELEMENT_INSTANCE_DESTROYED`,`SDK_USAGE`));return}if(this.status!==`ready`){this.cachedSend.push({type:e,payload:t});return}this.bridge.send(e,t)}_addPort(e){this.isSingleMode||!this.isMainElement||this.bridge._addPort(e)}_transferReceivePort(e){this.isSingleMode||!this.isMainElement||this.bridge._transferReceivePort(e)}_transferSendPort(e){this.isSingleMode||this.isMainElement||this.bridge._transferSendPort(e)}async _submit(e){return this.bridge.mode===`HOST`?(this.send(O.SUBMIT,e),new Promise(e=>{this.bridge.once(O.SUBMIT_REPLY,t=>{e(t)})})):Promise.reject(Error(`submit method only available in HOST mode`))}destroy(){this.hooks.ondestroy?.forEach(e=>e()),this.hooks={},this.bridge.destroy(),this.umount(),this.status=`destroyed`}get isMainElement(){return this._isMainElement}_addHook(e,t){return this.hooks[e]||(this.hooks[e]=[]),this.hooks[e]?.push(t),()=>{this.hooks[e]=this.hooks[e]?.filter(e=>e!==t)}}},W=class extends De{constructor(e,t,n,r){super(e,{...n,isMainElement:!0,appUrl:t,appConfig:r||{}})}_submit(e){return super._submit(e)}},G=class{config;isInit=!1;version;elementMode=`SINGLE`;_elements=new Map;globalBridgeForWebApp;globalBridgeForModal;openModalHandle;elementClasses={};constructor(e){this.config=e,this.version=e.version,e.trackerCode&&P(e.trackerCode);let t=this.globalBridgeForWebApp=H.getGlobalBridge();this.globalBridgeForWebApp.on(O.OPEN_MODAL,async e=>{let n=this.globalBridgeForModal=H.getGlobalBridge();n.setDebugCallback((e,t)=>{t===`OUT`&&z(`INFO`,`SDK_INTERNAL`,e.type,e.payload)});let r=this._elements.get(e.scope);!r||!r.iframe?.contentWindow?z(`WARN`,`SDK_INTERNAL`,`Element not found or iframe contentWindow not available, confirm close may not work`):t.setTarget(r.iframe.contentWindow);try{let t=new URL(e.url);e.closeConfirm&&(t.searchParams.append(`confirm`,`true`),t.searchParams.has(`closeConfirm`)&&(e.closeConfirm=!0)),e.url=t.toString()}catch{let e=new V(`Invalid URL`,`INVALID_MODAL_URL`,`APP_RUNTIME`);t.send(O.OPEN_MODAL_ERROR,e);return}let i=new MessageChannel,a=E(`modal_`),o=this.openModalHandle=await this.openModal({...e,onClose(){if(e.closeConfirm){let e=new D(a,i.port2);return console.log(e,`send`),e.close(!0)}}});e.appearance&&o.onLoadedSuccess(()=>{n.setTarget(o.getContentWindow()),n.send(O.TRANSFER_MODAL_APPEARANCE,e.appearance)}),e.closeConfirm&&(t.send(O.TRANSFER_APP_PORT,a,[i.port1]),o.onLoadedSuccess(()=>{n.setTarget(o.getContentWindow()),n.send(O.TRANSFER_MODAL_PORT,a,[i.port2])})),t.on(O.CLOSE_MODAL,()=>{o.destroy(),n.destroy()})}),t.on(O.REDIRECT,async e=>{let{url:t,mode:n=`redirect`,destory:r=!0}=e;r&&this.destroy(),n===`replace`?window.location.replace(t):n===`redirect`&&(window.location.href=t)}),t.setDebugCallback((e,t)=>{e.type.endsWith(O.MESSAGE)?z(e.payload?.type,`APP_RUNTIME`,e.type,e.payload?.message):e.type.endsWith(O.ERROR)&&t===`IN`?B(e.payload):e.type.endsWith(O.OPEN_MODAL_ERROR)?z(`ERROR`,`APP_RUNTIME`,`Open modal error`,e.payload):z(`INFO`,t===`OUT`?`SDK_INTERNAL`:`APP_RUNTIME`,e.type,e.payload)}),this.canUseElements().forEach(e=>{let t=e,n;typeof e!=`function`&&(t=e.ElementClass,n=e.config);let r=t;if(!r.elementType)throw new V(`ElementClass must have a static elementType property`,`ELEMENT_DEFINE_ERROR`,`SDK_INTERNAL`);let i=this._generateElementKey(r.elementType,n);if(!this.elementClasses[i])this.elementClasses[i]=r;else throw new V(`This elementType "${r.elementType}" ${n?`with config ${JSON.stringify(n)}`:``} is already registered in factory`,`ELEMENT_ALREADY_REGISTERED`,`SDK_INTERNAL`)})}async openModal(e){return z(`WARN`,`SDK_INTERNAL`,`Open modal request received, but no handler implemented.`,e),Promise.resolve({destroy:()=>{},onLoadedSuccess:e=>{},getContentWindow:()=>null})}async init(){return this.isInit?this:(this.config.debug&&await Ee().then(e=>{e?.mount()}).catch(()=>{B(new V(`Load debugger failed`,`LOAD_DEBUGGER_FAILED`,`SDK_INTERNAL`))}),this.isInit=!0,this)}generateElementKey(e,t){return e}updateConfig(e){let{locale:t,debug:n,env:r}=e;t&&(this.config.locale=t),n&&(this.config.debug=n),r&&(this.config.env=r),(t||r)&&this._elements.forEach(t=>{t.updateConfig(e)})}destroy(){this._elements.forEach(e=>{e.destroy()}),this._elements.clear(),this.openModalHandle?.destroy(),this.globalBridgeForModal?.destroy(),this.globalBridgeForWebApp.destroy()}_generateElementKey(e,t){try{return this.generateElementKey(e,t)}catch{let n=new V({message:`Generate element ${e} key error, with options ${JSON.stringify(t)}`,params:{elementType:e,options:t}},`GENERATE_ELEMENT_KEY_FAILED`,`SDK_INTERNAL`);throw B(n),n}}_createElement(e,t){let n;R({msg:e});let r=this._generateElementKey(e,t);if(n=this.elementClasses[r],R({msg:e,m1:n?1:0}),!n){let t=new V({message:`Element type ${e} not supported.`,params:{elementType:e}},`NOT_SUPPORT_ELEMENT`,`SDK_USAGE`);throw B(t),t}let i;try{i=new n(r,{...this.config,elementMode:this.elementMode,appConfig:{env:this.config.env,locale:this.config.locale,...t}})}catch(t){let n=V.isError(t)?t:new V({message:`Element type ${e} initialization failed`,params:{elementType:e}},`ELEMENT_INIT_FAILED`,`SDK_INTERNAL`);throw B(n),n}return i._addHook(`ondestroy`,()=>{this._removeElement(e,t),this._getElementSize()||z(`INFO`,`SDK_INTERNAL`,`All elements destroyed`)}),this._addElement(e,i,t),i}_addElement(e,t,n){if(this._elements.has(this._generateElementKey(e,n))){let t=new V({message:`${e} element already exists, please don't create twice.`,params:{elementType:e}},`CANNOT_CREATE_SAME_ELEMENT_TWICE`,`SDK_USAGE`);throw B(t),t}this._elements.set(this._generateElementKey(e,n),t)}_removeElement(e,t){this._elements.delete(this._generateElementKey(e,t))}_getElement(e,t){return this._elements.get(this._generateElementKey(e,t))}_getElementSize(){return this._elements.size}},Oe={local:`local`,dev:`dev`,test:`test`,pre:`pre`,sandbox:`sandbox`,prod:`prod`},ke=e=>localStorage.getItem(`WORLDFIRST_APP_ENV`)||Oe.local,Ae=e=>{let t=e.startsWith(`/`)?e:`/${e}`;{let e=localStorage.getItem(`WORLDFIRST_APP_DOCUMENT_PREFIX`);if(!e)throw Error(`WORLDFIRST_APP_DOCUMENT_PREFIX is not set, please checkout your demo`);return`${e}/page/wf-embedded-finance${t}`}return`https://openweb.worldfirst.com.cn${t}`},je=class extends W{static elementType=`onboard`;constructor(e,t){console.log(`%c [ config ]-35`,`font-size:13px; background:pink; color:#bf2c9f;`,t),super(e,Ae(`/index.html#/onboard`),t,t.appConfig),console.log(this)}submit(){return this._submit()}focus(){throw Error(`Method not implemented.`)}blur(){throw Error(`Method not implemented.`)}clear(){throw Error(`Method not implemented.`)}};function K(e,t=!1){let n=JSON.stringify(e);return`<!DOCTYPE html>
2
2
  <html>
3
3
  <head><meta charset="UTF-8"></head>
4
4
  <body>
@@ -46,4 +46,4 @@
46
46
  })();
47
47
  <\/script>
48
48
  </body>
49
- </html>`}var Me={onboard:`worldfirst`,Vaulting:`antom`},q={local:{worldfirst:`http://wf-embedded-finance-feat-pianyu0317-dev-unio.page.alipay.net/page/wf-embedded-finance/manifest.json`,antom:`TODO_ANTOM_MANIFEST_URL_LOCAL`},dev:{worldfirst:`http://wf-embedded-finance-feat-pianyu0317-dev-unio.page.alipay.net/page/wf-embedded-finance/manifest.json`,antom:`TODO_ANTOM_MANIFEST_URL_DEV`},test:{worldfirst:`http://wf-embedded-finance-feat-pianyu0317-dev-unio.page.alipay.net/page/wf-embedded-finance/manifest.json`,antom:`TODO_ANTOM_MANIFEST_URL_TEST`},pre:{worldfirst:`http://wf-embedded-finance-feat-pianyu0317-dev-unio.page.alipay.net/page/wf-embedded-finance/manifest.json`,antom:`TODO_ANTOM_MANIFEST_URL_PRE`},sandbox:{worldfirst:`https://sandbox.example.com/page/wf-embedded-finance/manifest.json`,antom:`TODO_ANTOM_MANIFEST_URL_SANDBOX`},prod:{worldfirst:`https://ac.alipay.com/page/wf-embedded-finance/manifest.json`,antom:`TODO_ANTOM_MANIFEST_URL_PROD`}},Ne=`data-wf-preload`,Pe=5e3,Fe=3e4,Ie=[`slow-2g`,`2g`,`3g`],J=!1;function Y(){try{let e=navigator.connection;return!e||!e.effectiveType?!0:!Ie.includes(e.effectiveType)}catch{return!0}}function Le(e){let t=new Map;for(let n of e){let e=Me[n];if(!e){z(`WARN`,`SDK_INTERNAL`,`Unknown element type`,n);continue}let r=t.get(e)||[];r.push(n),t.set(e,r)}return t}async function Re(e,t){let n=Array.from(e.keys()),r=await Promise.allSettled(n.map(async e=>{let n=q[t][e];if(!n||n.startsWith(`TODO`))throw z(`WARN`,`SDK_INTERNAL`,`Preload Manifest URL not configured for provider`,e),Error(`Manifest URL not configured for provider: ${e} in env: ${t}`);let r=new AbortController,i=setTimeout(()=>r.abort(),Pe);try{return{provider:e,manifest:await(await fetch(n,{signal:r.signal})).json()}}finally{clearTimeout(i)}})),i=new Map;return r.forEach((e,t)=>{e.status===`fulfilled`?i.set(e.value.provider,e.value.manifest):z(`WARN`,`SDK_INTERNAL`,`Failed to fetch manifest for provider`,n[t])}),i}function ze(e,t){let n=new Set;return e.forEach((e,r)=>{let i=t.get(r);if(!i?.offlineResources)return;let a=i.offlineResources;Array.isArray(a.sync)&&a.sync.forEach(e=>n.add(e)),e.forEach(e=>{let t=a[e];Array.isArray(t)&&t.forEach(e=>n.add(e))})}),Array.from(n)}function Be(e){try{e.remove()}catch{}}function Ve(e,t){try{if(!(`srcdoc`in document.createElement(`iframe`))){t&&console.warn(`[WorldFirst Preload] srcdoc not supported, skipping preload.`);return}let n=document.createElement(`iframe`);n.setAttribute(Ne,`true`),n.style.cssText=`position:absolute;width:0;height:0;border:0;visibility:hidden;overflow:hidden;`,n.srcdoc=K(e,t);let r=setTimeout(()=>{t&&console.warn(`[WorldFirst Preload] Iframe timed out, cleaning up.`),Be(n)},Fe),i=e=>{e.data?.type===`wf-preload-done`&&(clearTimeout(r),window.removeEventListener(`message`,i),setTimeout(()=>Be(n),1e3))};window.addEventListener(`message`,i),n.onerror=()=>{clearTimeout(r),window.removeEventListener(`message`,i),Be(n)},document.body.appendChild(n)}catch{}}function X(e,t){let n=()=>{typeof requestIdleCallback==`function`?requestIdleCallback(()=>Ve(e,t),{timeout:3e3}):setTimeout(()=>Ve(e,t),200)};document.readyState===`complete`?n():window.addEventListener(`load`,n,{once:!0})}function He(e){if(!J){if(J=!0,!e.elements||e.elements.length===0){J=!1;return}if(!(typeof window>`u`||typeof document>`u`)&&!document.querySelector(`[${Ne}]`)){if(!Y()){z(`INFO`,`SDK_INTERNAL`,`Slow network detected, skipping preload.`);return}(async()=>{let t=Le(e.elements);if(t.size===0)return;z(`INFO`,`SDK_INTERNAL`,`Preload Provider groups:`,Object.fromEntries(t));let n=await Re(t,e.env);if(n.size===0)return;let r=ze(t,n);r.length!==0&&(z(`INFO`,`SDK_INTERNAL`,`Preloading ${r.length} resources:`,r),X(r))})().catch(()=>{z(`ERROR`,`SDK_INTERNAL`,`Preload failed`)})}}}var Ue={env:`prod`,debug:!1,targetOrigin:`https://openweb.worldfirst.com.cn`,version:`0.0.1775118337-dev.6`,trackerCode:`7983`},We=class extends G{static version=`0.0.1775118337-dev.6`;constructor(e){z(`INFO`,`SDK_INTERNAL`,`WorldFirstSDK initialized`,e);let{elements:t,...n}=e;He({elements:t??[],env:ke(e.env)}),super(M(Ue,n))}canUseElements(){return[je]}createElement(e,t){return this._createElement(e,t)}getElement(e,t){return this._getElement(e,t)}};window.loadWorldFirst=async e=>{let{env:t,...n}=e||{},r=t||`prod`;return(0,d.createSingletonInstance)(We,{...n,env:r},`WorldFirstSDK`)},window.WorldFirstSDK=We})();
49
+ </html>`}var Me={onboard:`worldfirst`,Vaulting:`antom`},q={local:{worldfirst:`http://wf-embedded-finance-feat-pianyu0317-dev-unio.page.alipay.net/page/wf-embedded-finance/manifest.json`,antom:`TODO_ANTOM_MANIFEST_URL_LOCAL`},dev:{worldfirst:`http://wf-embedded-finance-feat-pianyu0317-dev-unio.page.alipay.net/page/wf-embedded-finance/manifest.json`,antom:`TODO_ANTOM_MANIFEST_URL_DEV`},test:{worldfirst:`http://wf-embedded-finance-feat-pianyu0317-dev-unio.page.alipay.net/page/wf-embedded-finance/manifest.json`,antom:`TODO_ANTOM_MANIFEST_URL_TEST`},pre:{worldfirst:`http://wf-embedded-finance-feat-pianyu0317-dev-unio.page.alipay.net/page/wf-embedded-finance/manifest.json`,antom:`TODO_ANTOM_MANIFEST_URL_PRE`},sandbox:{worldfirst:`https://sandbox.example.com/page/wf-embedded-finance/manifest.json`,antom:`TODO_ANTOM_MANIFEST_URL_SANDBOX`},prod:{worldfirst:`https://ac.alipay.com/page/wf-embedded-finance/manifest.json`,antom:`TODO_ANTOM_MANIFEST_URL_PROD`}},Ne=`data-wf-preload`,Pe=5e3,Fe=3e4,Ie=[`slow-2g`,`2g`,`3g`],J=!1;function Y(){try{let e=navigator.connection;return!e||!e.effectiveType?!0:!Ie.includes(e.effectiveType)}catch{return!0}}function Le(e){let t=new Map;for(let n of e){let e=Me[n];if(!e){z(`WARN`,`SDK_INTERNAL`,`Unknown element type`,n);continue}let r=t.get(e)||[];r.push(n),t.set(e,r)}return t}async function Re(e,t){let n=Array.from(e.keys()),r=await Promise.allSettled(n.map(async e=>{let n=q[t][e];if(!n||n.startsWith(`TODO`))throw z(`WARN`,`SDK_INTERNAL`,`Preload Manifest URL not configured for provider`,e),Error(`Manifest URL not configured for provider: ${e} in env: ${t}`);let r=new AbortController,i=setTimeout(()=>r.abort(),Pe);try{return{provider:e,manifest:await(await fetch(n,{signal:r.signal})).json()}}finally{clearTimeout(i)}})),i=new Map;return r.forEach((e,t)=>{e.status===`fulfilled`?i.set(e.value.provider,e.value.manifest):z(`WARN`,`SDK_INTERNAL`,`Failed to fetch manifest for provider`,n[t])}),i}function ze(e,t){let n=new Set;return e.forEach((e,r)=>{let i=t.get(r);if(!i?.offlineResources)return;let a=i.offlineResources;Array.isArray(a.sync)&&a.sync.forEach(e=>n.add(e)),e.forEach(e=>{let t=a[e];Array.isArray(t)&&t.forEach(e=>n.add(e))})}),Array.from(n)}function Be(e){try{e.remove()}catch{}}function Ve(e,t){try{if(!(`srcdoc`in document.createElement(`iframe`))){t&&console.warn(`[WorldFirst Preload] srcdoc not supported, skipping preload.`);return}let n=document.createElement(`iframe`);n.setAttribute(Ne,`true`),n.style.cssText=`position:absolute;width:0;height:0;border:0;visibility:hidden;overflow:hidden;`,n.srcdoc=K(e,t);let r=setTimeout(()=>{t&&console.warn(`[WorldFirst Preload] Iframe timed out, cleaning up.`),Be(n)},Fe),i=e=>{e.data?.type===`wf-preload-done`&&(clearTimeout(r),window.removeEventListener(`message`,i),setTimeout(()=>Be(n),1e3))};window.addEventListener(`message`,i),n.onerror=()=>{clearTimeout(r),window.removeEventListener(`message`,i),Be(n)},document.body.appendChild(n)}catch{}}function X(e,t){let n=()=>{typeof requestIdleCallback==`function`?requestIdleCallback(()=>Ve(e,t),{timeout:3e3}):setTimeout(()=>Ve(e,t),200)};document.readyState===`complete`?n():window.addEventListener(`load`,n,{once:!0})}function He(e){if(!J){if(J=!0,!e.elements||e.elements.length===0){J=!1;return}if(!(typeof window>`u`||typeof document>`u`)&&!document.querySelector(`[${Ne}]`)){if(!Y()){z(`INFO`,`SDK_INTERNAL`,`Slow network detected, skipping preload.`);return}(async()=>{let t=Le(e.elements);if(t.size===0)return;z(`INFO`,`SDK_INTERNAL`,`Preload Provider groups:`,Object.fromEntries(t));let n=await Re(t,e.env);if(n.size===0)return;let r=ze(t,n);r.length!==0&&(z(`INFO`,`SDK_INTERNAL`,`Preloading ${r.length} resources:`,r),X(r))})().catch(()=>{z(`ERROR`,`SDK_INTERNAL`,`Preload failed`)})}}}var Ue={env:`prod`,debug:!1,targetOrigin:`https://openweb.worldfirst.com.cn`,version:`0.0.1775118337-dev.7`,trackerCode:`7983`},We=class extends G{static version=`0.0.1775118337-dev.7`;constructor(e){z(`INFO`,`SDK_INTERNAL`,`WorldFirstSDK initialized`,e);let{elements:t,...n}=e;He({elements:t??[],env:ke(e.env)}),super(M(Ue,n))}canUseElements(){return[je]}createElement(e,t){return this._createElement(e,t)}getElement(e,t){return this._getElement(e,t)}};window.loadWorldFirst=async e=>{let{env:t,...n}=e||{},r=t||`prod`;return(0,d.createSingletonInstance)(We,{...n,env:r},`WorldFirstSDK`)},window.WorldFirstSDK=We})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worldfirst/worldfirst-js",
3
- "version": "0.0.1775118337-dev.6",
3
+ "version": "0.0.1775118337-dev.7",
4
4
  "description": "worldfirst sdk",
5
5
  "exports": {
6
6
  ".": {
@@ -88,9 +88,7 @@
88
88
  "react": "^18.0.0",
89
89
  "react-dom": "^18.0.0",
90
90
  "stylelint": "^14.9.1",
91
- "ts-patch": "^3.3.0",
92
- "typescript": "~5.9.3",
93
- "typescript-transform-paths": "^3.5.6"
91
+ "typescript": "~5.9.3"
94
92
  },
95
93
  "peerDependencies": {
96
94
  "react": ">=16.9.0",