@worldfirst/worldfirst-js 0.0.1778210535-dev.0 → 0.0.1778210535-dev.2
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/dist/index.js +1 -1
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +12 -756
- package/package.json +1 -1
- package/types.d.ts +31 -4
- package/types.untrimmed.d.ts +34 -4
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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),e=null),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=`DEV`?.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:(ie(`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:(ie(`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))),ne=e=>new RegExp(e.map(e=>re(e)).sort((e,t)=>t.length-e.length).join(`|`)),w=e=>RegExp(`^[${e.map(e=>re(e)).sort((e,t)=>t.length-e.length).join(``)}]+$`),re=e=>e.replace(/[\s#$()*+,.?[\\\]^{|}-]/g,`\\$&`),ie=(e=`BigInt is not available in this environment`)=>{if(typeof BigInt!=`function`)throw TypeError(e)},ae=16,oe=3.5,se=12,ce=16,le=12,ue=100,de=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<ae)throw Error(`Hashids: alphabet must contain at least ${ae} unique characters, provided: ${s.join(``)}`);this.alphabet=h(s,o);let c=g(o,s);this.seps=y(c,i);let l,u;(this.seps.length===0||this.alphabet.length/this.seps.length>oe)&&(l=Math.ceil(this.alphabet.length/oe),l>this.seps.length&&(u=l-this.seps.length,this.seps.push(...this.alphabet.slice(0,u)),this.alphabet=this.alphabet.slice(u))),this.alphabet=y(this.alphabet,i);let d=Math.ceil(this.alphabet.length/se);this.alphabet.length<3?(this.guards=this.seps.slice(0,d),this.seps=this.seps.slice(d)):(this.guards=this.alphabet.slice(0,d),this.alphabet=this.alphabet.slice(d)),this.guardsRegExp=ne(this.guards),this.sepsRegExp=ne(this.seps),this.allowedCharsRegExp=w([...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(ce);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,le,e=>Number.parseInt(`1${e}`,16));return this.encode(n)}decodeHex(e){return this.decode(e).map(e=>e.toString(ce).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+ue)):t%(n+ue)),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)];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 fe(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 T=(e=``)=>e+de.encode(`${Date.now()}${Math.ceil(Math.random()*100)}`),E=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:T(`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)}))}},pe=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 fe(()=>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;if(!r||!r.type){n(Error(`collect error`));return}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)()}},me=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)}},D={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`},he=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 ne(){return c===void 0?s:C(h())}function w(){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 w.cancel=te,w.flush=ne,w}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),O=[D.TRANSFER_RECEIVE_PORT,D.TRANSFER_SEND_PORT,D.TRANSFER_MODAL_PORT,D.TRANSFER_MODAL_APPEARANCE,D.OPEN_MODAL_ERROR,D.TRANSFER_APP_PORT,D.CLOSE_MODAL,D.OPEN_MODAL,D.REDIRECT,D.MESSAGE],k=`@@global`,A=`@@native`,ge=.01,_e=10,ve=class e{targetWindow;currentWindow;targetOrigin=`*`;scope;handlers=new Map;mode;resizeObserver;debugCallback;receivePort;static getGlobalBridge(t){return new e(t,k)}static getNativeBridge(t){return new e(`WEBAPP`,A,t)}static getBridge(t,n){if(n===A||n===k)throw Error(`Scope cannot be ${A} or ${k}`);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(D.TRANSFER_RECEIVE_PORT,this.receivePort?.name,e)}_transferReceivePort(e){this._transferPort(D.TRANSFER_RECEIVE_PORT,e.name,e.targetPorts)}_transferSendPort(e){this._transferPort(D.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:T(`bridge`),type:`SYSTEM_${D.ERROR}`,payload:{message:`Target window not set`}},`OUT`);return}let r={id:T(`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(D.ERROR,e.toJSON())}sendSubmit(e){this.mode===`WEBAPP`&&this.send(D.SUBMIT_REPLY,e)}sendMessage(e,t){this.mode===`WEBAPP`&&this.send(D.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(D.REDIRECT,{url:e,mode:t})}}openModal(e){return this.send(D.OPEN_MODAL,{...e,scope:this.scope}),new Promise((e,t)=>{this.once(D.OPEN_MODAL_ERROR,e=>{t(new p(e.message,e.code,e.source))}),this.once(D.TRANSFER_APP_PORT,(t,n)=>{if(!n?.[0])throw new m(`No ports transferred for modal communication`,`NO_PORTS_ERROR`,`SDK_INTERNAL`);e(new E(t,n[0]))})})}closeModal(){this.send(D.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(D.HANDSHAKE,async n=>{n?.elementMode===`GROUP`?n.isMainElement?this.getReceivePort().then(e=>{t(n,e)}):this.getSendPort().then(e=>{t(n,e)}).catch(()=>{t(n)}):t(n);let r=0,i=(0,he.default)(e=>{(Math.abs(e-r)>_e||Math.abs((e-r)/r)>ge)&&(r=e,this.send(D.HEIGHT_UPDATE,e))},400);this.resizeObserver=new ResizeObserver(e=>{let t=e?.[0]?.contentRect;t&&i(t.height)}),this.resizeObserver.observe(document.body),this.send(D.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!==A&&(![`WEBAPP`,`HOST`].includes(r)||this.targetOrigin!==`*`&&e.origin!==this.targetOrigin||this.mode===r))return;let i=this.handlers.get(t.type);this.scope!==A&&(i||t.type.endsWith(D.ERROR)||t.type.endsWith(D.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=D.ERROR),this.scope===A?e:`${O.includes(e)?k:this.scope}:${this.mode===`WEBAPP`?`HOST`:`WEBAPP`}:${e}`}getOriginSendType(e){return e===`error`&&(e=D.ERROR),this.scope===A?e:`${O.includes(e)?k: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:T(),type:this.getOriginSendType(e),payload:t},this.targetOrigin,n)}getReceivePort(){return new Promise(e=>{this.on(D.TRANSFER_RECEIVE_PORT,(t,n)=>{this.receivePort||=new pe(t),n&&this.receivePort.addPort(n),e(this.receivePort)})})}getSendPort(){return new Promise((e,t)=>{this.on(D.TRANSFER_SEND_PORT,(n,r)=>{r?e(new me(n,r[0])):t(Error(`no ports transfer`))})})}},ye=`https://cdn.marmot-cloud.com/tnpm-package/@antintl-opensdk-debugger/1.0.1/dist/tracker.umd.js`,be=class{options;tracker;trackId;constructor(e){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){let t=(0,d.loadScript)(ye,`intlSdkTracker`);return t?t.then(t=>t.variable?.getTrackerInstance(this.initialOptions(e))):Promise.resolve(void 0)}async initTracker(e){if(this.tracker&&!e)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 be;var xe=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]`,ne=`[object DataView]`,w=`[object Float32Array]`,re=`[object Float64Array]`,ie=`[object Int8Array]`,ae=`[object Int16Array]`,oe=`[object Int32Array]`,se=`[object Uint8Array]`,ce=`[object Uint8ClampedArray]`,le=`[object Uint16Array]`,ue=`[object Uint32Array]`,de=/[\\^$.*+?()[\]{}|]/g,fe=/^\[object .+?Constructor\]$/,T=/^(?:0|[1-9]\d*)$/,E={};E[w]=E[re]=E[ie]=E[ae]=E[oe]=E[se]=E[ce]=E[le]=E[ue]=!0,E[s]=E[c]=E[te]=E[u]=E[ne]=E[d]=E[f]=E[p]=E[ee]=E[h]=E[_]=E[y]=E[b]=E[x]=E[C]=!1;var pe=typeof global==`object`&&global&&global.Object===Object&&global,me=typeof self==`object`&&self&&self.Object===Object&&self,D=pe||me||Function(`return this`)(),he=typeof e==`object`&&e&&!e.nodeType&&e,O=he&&typeof t==`object`&&t&&!t.nodeType&&t,k=O&&O.exports===he,A=k&&pe.process,ge=function(){try{return O&&O.require&&O.require(`util`).types||A&&A.binding&&A.binding(`util`)}catch{}}(),_e=ge&&ge.isTypedArray;function ve(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 ye(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function be(e){return function(t){return e(t)}}function xe(e,t){return e?.[t]}function j(e,t){return function(n){return e(t(n))}}var Se=Array.prototype,Ce=Function.prototype,M=Object.prototype,we=D[`__core-js_shared__`],N=Ce.toString,P=M.hasOwnProperty,Te=function(){var e=/[^.]+$/.exec(we&&we.keys&&we.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}(),F=M.toString,Ee=N.call(Object),De=RegExp(`^`+N.call(P).replace(de,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),I=k?D.Buffer:void 0,Oe=D.Symbol,L=D.Uint8Array,R=I?I.allocUnsafe:void 0,z=j(Object.getPrototypeOf,Object),B=Object.create,V=M.propertyIsEnumerable,ke=Se.splice,H=Oe?Oe.toStringTag:void 0,U=function(){try{var e=xt(Object,`defineProperty`);return e({},``,{}),e}catch{}}(),Ae=I?I.isBuffer:void 0,je=Math.max,Me=Date.now,W=xt(D,`Map`),G=xt(Object,`create`),Ne=function(){function e(){}return function(t){if(!Q(t))return{};if(B)return B(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function K(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 Pe(){this.__data__=G?G(null):{},this.size=0}function Fe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}function Ie(e){var t=this.__data__;if(G){var n=t[e];return n===r?void 0:n}return P.call(t,e)?t[e]:void 0}function Le(e){var t=this.__data__;return G?t[e]!==void 0:P.call(t,e)}function Re(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=G&&t===void 0?r:t,this}K.prototype.clear=Pe,K.prototype.delete=Fe,K.prototype.get=Ie,K.prototype.has=Le,K.prototype.set=Re;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 ze(){this.__data__=[],this.size=0}function Be(e){var t=this.__data__,n=nt(t,e);return n<0?!1:(n==t.length-1?t.pop():ke.call(t,n,1),--this.size,!0)}function Ve(e){var t=this.__data__,n=nt(t,e);return n<0?void 0:t[n][1]}function He(e){return nt(this.__data__,e)>-1}function Ue(e,t){var n=this.__data__,r=nt(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}q.prototype.clear=ze,q.prototype.delete=Be,q.prototype.get=Ve,q.prototype.has=He,q.prototype.set=Ue;function J(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 We(){this.size=0,this.__data__={hash:new K,map:new(W||q),string:new K}}function Ge(e){var t=Z(this,e).delete(e);return this.size-=+!!t,t}function Ke(e){return Z(this,e).get(e)}function Y(e){return Z(this,e).has(e)}function qe(e,t){var n=Z(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}J.prototype.clear=We,J.prototype.delete=Ge,J.prototype.get=Ke,J.prototype.has=Y,J.prototype.set=qe;function X(e){var t=this.__data__=new q(e);this.size=t.size}function Je(){this.__data__=new q,this.size=0}function Ye(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Xe(e){return this.__data__.get(e)}function Ze(e){return this.__data__.has(e)}function Qe(e,t){var r=this.__data__;if(r instanceof q){var i=r.__data__;if(!W||i.length<n-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new J(i)}return r.set(e,t),this.size=r.size,this}X.prototype.clear=Je,X.prototype.delete=Ye,X.prototype.get=Xe,X.prototype.has=Ze,X.prototype.set=Qe;function $e(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?ye(e.length,String):[],c=s.length;for(var l in e)(t||P.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 et(e,t,n){(n!==void 0&&!It(e[t],n)||n===void 0&&!(t in e))&&rt(e,t,n)}function tt(e,t,n){var r=e[t];(!(P.call(e,t)&&It(r,n))||n===void 0&&!(t in e))&&rt(e,t,n)}function nt(e,t){for(var n=e.length;n--;)if(It(e[n][0],t))return n;return-1}function rt(e,t,n){t==`__proto__`&&U?U(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var it=bt();function at(e){return e==null?e===void 0?S:g:H&&H in Object(e)?St(e):At(e)}function ot(e){return $(e)&&at(e)==s}function st(e){return!Q(e)||Dt(e)?!1:(Ht(e)?De:fe).test(Ft(e))}function ct(e){return $(e)&&Ut(e.length)&&!!E[at(e)]}function lt(e){if(!Q(e))return kt(e);var t=Ot(e),n=[];for(var r in e)r==`constructor`&&(t||!P.call(e,r))||n.push(r);return n}function ut(e,t,n,r,i){e!==t&&it(t,function(a,o){if(i||=new X,Q(a))dt(e,t,o,n,ut,r,i);else{var s=r?r(Mt(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),et(e,o,s)}},qt)}function dt(e,t,n,r,i,a,o){var s=Mt(e,n),c=Mt(t,n),l=o.get(c);if(l){et(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=_t(s):p?(d=!1,u=mt(c,!0)):m?(d=!1,u=gt(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)),et(e,n,u)}function ft(e,t){return Nt(jt(e,t,Xt),e+``)}var pt=U?function(e,t){return U(e,`toString`,{configurable:!0,enumerable:!1,value:Yt(t),writable:!0})}:Xt;function mt(e,t){if(t)return e.slice();var n=e.length,r=R?R(n):new e.constructor(n);return e.copy(r),r}function ht(e){var t=new e.constructor(e.byteLength);return new L(t).set(new L(e)),t}function gt(e,t){var n=t?ht(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function _t(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}function vt(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?rt(n,s,c):tt(n,s,c)}return n}function yt(e){return ft(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 bt(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 Z(e,t){var n=e.__data__;return Et(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function xt(e,t){var n=xe(e,t);return st(n)?n:void 0}function St(e){var t=P.call(e,H),n=e[H];try{e[H]=void 0;var r=!0}catch{}var i=F.call(e);return r&&(t?e[H]=n:delete e[H]),i}function Ct(e){return typeof e.constructor==`function`&&!Ot(e)?Ne(z(e)):{}}function wt(e,t){var n=typeof e;return t??=o,!!t&&(n==`number`||n!=`symbol`&&T.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!!Te&&Te in e}function Ot(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||M)}function kt(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}function At(e){return F.call(e)}function jt(e,t,n){return t=je(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=je(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),ve(e,this,s)}}function Mt(e,t){if(!(t===`constructor`&&typeof e[t]==`function`)&&t!=`__proto__`)return e[t]}var Nt=Pt(pt);function Pt(e){var t=0,n=0;return function(){var r=Me(),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 N.call(e)}catch{}try{return e+``}catch{}}return``}function It(e,t){return e===t||e!==e&&t!==t}var Lt=ot(function(){return arguments}())?ot:function(e){return $(e)&&P.call(e,`callee`)&&!V.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=Ae||Zt;function Ht(e){if(!Q(e))return!1;var t=at(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)||at(e)!=_)return!1;var t=z(e);if(t===null)return!0;var n=P.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&N.call(n)==Ee}var Gt=_e?be(_e):ct;function Kt(e){return vt(e,qt(e))}function qt(e){return zt(e)?$e(e,!0):lt(e)}var Jt=yt(function(e,t,n){ut(e,t,n)});function Yt(e){return function(){return e}}function Xt(e){return e}function Zt(){return!1}t.exports=Jt}))(),1);function j(e,...t){return(0,xe.default)({},e,...t)}function Se(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 Ce=new be({appId:`180020050100012557`,performance:!1,error:!1}),M=`7981`,we=e=>{M=e},N=(e=``)=>t=>{Ce.log({code:`${M}${e}`,...t})},P=N(),Te=N(`event`),F=N(`iframe`),Ee=N(`handshake`),De=N(`merchant`),I=N(`element`),Oe=()=>{if(window.sdkDebugger)return Promise.resolve(window.sdkDebugger);let e=`0.0.20260330073610-dev.34`.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)},L=(e,t,n,r)=>{if(e===`ERROR`){let e=r||{};P({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(`:`);Te({msg:o,d1:t,d2:i,d3:a,d4:JSON.stringify(r),d5:`无`,d6:e})}window.sdkDebugger?.log(e,t,n,r)},R=e=>{if(!e)return;let t=Se(p.isError(e)?e.toJSON():e);L(`ERROR`,t.source,t.operationType||t.message||`Unknown Error`,t)},z=class extends p{name=`SDKInternalError`},B=class extends ve{static getGlobalBridge(){return ve.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)}},V=class extends z{name=`MountError`;constructor(e,t,n){super(e,t,n||`SDK_USAGE`)}},ke=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 B(e),this.bridge.setOrigin(t.targetOrigin),this.config.debug&&this.bridge.setDebugCallback((e,t)=>{e.type.endsWith(D.UPDATE_CONFIG)||e.type.endsWith(D.HEIGHT_UPDATE)||(e.type.endsWith(D.MESSAGE)?L(e.payload?.type,`APP_RUNTIME`,e.type,e.payload?.message):e.type.endsWith(D.ERROR)&&t===`IN`?R(e.payload):L(`INFO`,t===`OUT`?`SDK_INTERNAL`:`APP_RUNTIME`,e.type,e.payload))}),this.status=`initialized`}submit(e){throw new z(`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 V({message:`element status is ${this.status}, can not mount again`,params:{status:this.status}},`MOUNT_NOT_SUPPORT`);throw R(e),e}return fe(()=>Promise.all([this.setup(),this._mount(e)]),15e3,new V(`Mount timeout`,`MOUNT_TIMEOUT`,`SYSTEM`))().then(e=>{let[t]=e;De({msg:this.name,d1:t?.merchantId||`未配置的商户`}),this.bridge.send(D.HANDSHAKE,j(this.config.appConfig,t||{}))}).catch(e=>{this.unmount();let t=z.unificationError(e);throw R(t),t})}async _mount(e){return new Promise(async(t,n)=>{if(!this.isMainElement&&this.isSingleMode)return n(new V({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 V(`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();L(`INFO`,`SYSTEM`,`Iframe ${this.name} loaded, initiating handshake...`),this.status=`mounted`,F({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(()=>{Ee({msg:this.name,d1:`handshake timeout`,m1:Math.round(Date.now()-e),m2:0,m3:Math.round(Date.now()-o)})},15e3);this.bridge.on(D.HEIGHT_UPDATE,e=>{a.style.height=`${e}px`}),this.bridge.on(D.HANDSHAKE_ACK,t=>{clearTimeout(n),this.status=`ready`,Ee({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=>{F({msg:this.name,d1:`否`,m1:Math.round(Date.now()-o),m2:0}),n(new V(`Iframe load error: ${e}`,`MOUNT_IFRAME_LOAD_ERROR`,`SYSTEM`))},e.appendChild(this.iframe)}catch(e){n(new V(`Initialization crashed: ${e.message}`,`MOUNT_INITIAL_FAILED`,`SDK_INTERNAL`))}})}updateConfig(e){try{if(this.status===`destroyed`)throw new z(`Element already destroyed, cannot update destroyed SDK instance`,`ELEMENT_INSTANCE_DESTROYED`,`SDK_USAGE`);this.config.appConfig=j(this.config.appConfig,e),L(`INFO`,`SDK_USAGE`,`Updating configuration via API`,e),this.bridge.send(D.UPDATE_CONFIG,{merged:this.config.appConfig,updated:e})}catch(e){R(z.unificationError(e))}}unmount(){(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`){R(new z(`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(D.SUBMIT,e),new Promise(e=>{this.bridge.once(D.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.unmount(),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)}}},H=class extends ke{constructor(e,t,n,r){super(e,{...n,isMainElement:!0,appUrl:t,appConfig:r||{}})}_submit(e){return super._submit(e)}},U=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&&we(e.trackerCode);let t=this.globalBridgeForWebApp=B.getGlobalBridge();this.globalBridgeForWebApp.on(D.OPEN_MODAL,async e=>{let n=this.globalBridgeForModal=B.getGlobalBridge();n.setDebugCallback((e,t)=>{t===`OUT`&&L(`INFO`,`SDK_INTERNAL`,e.type,e.payload)});let r=this._elements.get(e.scope);!r||!r.iframe?.contentWindow?L(`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 z(`Invalid URL`,`INVALID_MODAL_URL`,`APP_RUNTIME`);t.send(D.OPEN_MODAL_ERROR,e);return}let i=new MessageChannel,a=T(`modal_`),o=this.openModalHandle=await this.openModal({...e,onClose(){if(e.closeConfirm){let e=new E(a,i.port2);return console.log(e,`send`),e.close(!0)}}});e.appearance&&o.onLoadedSuccess(()=>{n.setTarget(o.getContentWindow()),n.send(D.TRANSFER_MODAL_APPEARANCE,e.appearance)}),e.closeConfirm&&(t.send(D.TRANSFER_APP_PORT,a,[i.port1]),o.onLoadedSuccess(()=>{n.setTarget(o.getContentWindow()),n.send(D.TRANSFER_MODAL_PORT,a,[i.port2])})),t.on(D.CLOSE_MODAL,()=>{o.destroy(),n.destroy()})}),t.on(D.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(D.MESSAGE)?L(e.payload?.type,`APP_RUNTIME`,e.type,e.payload?.message):e.type.endsWith(D.ERROR)&&t===`IN`?R(e.payload):e.type.endsWith(D.OPEN_MODAL_ERROR)?L(`ERROR`,`APP_RUNTIME`,`Open modal error`,e.payload):L(`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 z(`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 z(`This elementType "${r.elementType}" ${n?`with config ${JSON.stringify(n)}`:``} is already registered in factory`,`ELEMENT_ALREADY_REGISTERED`,`SDK_INTERNAL`)})}async openModal(e){return L(`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 Oe().then(e=>{e?.mount()}).catch(()=>{R(new z(`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 z({message:`Generate element ${e} key error, with options ${JSON.stringify(t)}`,params:{elementType:e,options:t}},`GENERATE_ELEMENT_KEY_FAILED`,`SDK_INTERNAL`);throw R(n),n}}_createElement(e,t){let n;I({msg:e});let r=this._generateElementKey(e,t);if(n=this.elementClasses[r],I({msg:e,m1:+!!n}),!n){let t=new z({message:`Element type ${e} not supported.`,params:{elementType:e}},`NOT_SUPPORT_ELEMENT`,`SDK_USAGE`);throw R(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=z.isError(t)?t:new z({message:`Element type ${e} initialization failed ${t instanceof Error?t.message:``}`,params:{elementType:e}},`ELEMENT_INIT_FAILED`,`SDK_INTERNAL`);throw R(n),n}return i._addHook(`ondestroy`,()=>{this._removeElement(e,t),this._getElementSize()||L(`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 z({message:`${e} element already exists, please don't create twice.`,params:{elementType:e}},`CANNOT_CREATE_SAME_ELEMENT_TWICE`,`SDK_USAGE`);throw R(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}},Ae={local:`local`,dev:`dev`,test:`test`,pre:`pre`,sandbox:`sandbox`,prod:`prod`},je=e=>localStorage.getItem(`WORLDFIRST_APP_ENV`)||Ae.local,Me=()=>{{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.startsWith(`http://wf.local.alipay.net`)?e:`${e}/page/wf-embedded-finance`}return`https://openweb.worldfirst.com.cn`},W=e=>{let t=e.startsWith(`/`)?e:`/${e}`;return`${Me()}${t}`},G={ONBOARD:`onboard`},Ne=class extends H{static elementType=G.ONBOARD;constructor(e,t){super(e,W(`/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.`)}},K={onboard:`worldfirst`,Vaulting:`antom`},Pe={worldfirst:`/manifest.json`,antom:`TODO_ANTOM_MANIFEST_URL_LOCAL`},Fe=`data-wf-preload`,Ie=5e3,Le=3e4,Re=[`slow-2g`,`2g`,`3g`],q=`{lang}`,ze=`zh-CN`,Be=[`zh-CN`,`en-US`,`en-GB`,`nl-NL`,`vi-VN`,`ja-JP`,`ko-KR`,`de-DE`,`th-TH`,`ms-MY`,`zh-TW`,`in-ID`,`pt-BR`,`es-ES`,`tr-TR`,`ar-SA`,`pl-PL`];function Ve(e){return e&&Be.includes(e)?e:ze}function He(e,t){return e.includes(q)?e.replace(q,t.toLowerCase()):e}var Ue=!1;function J(){try{let e=navigator.connection;return!e||!e.effectiveType?!0:!Re.includes(e.effectiveType)}catch{return!0}}function We(e){let t=new Map;for(let n of e){let e=K[n];if(!e){L(`WARN`,`SDK_INTERNAL`,`Unknown element type`,n);continue}let r=t.get(e)||[];r.push(n),t.set(e,r)}return t}async function Ge(e,t){let n=Array.from(e.keys()),r=await Promise.allSettled(n.map(async e=>{let n=W(Pe[e]);if(!n||n.startsWith(`TODO`))throw L(`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(),Ie);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):L(`WARN`,`SDK_INTERNAL`,`Failed to fetch manifest for provider`,n[t])}),i}function Ke(e,t,n){let r=new Set,i=new Set,a=Ve(n),o=`default`;return e.forEach((e,n)=>{let s=t.get(n);if(!s?.offlineResources)return;let c=s.offlineResources;c.cacheControl&&(o=c.cacheControl),Array.isArray(c.sync)&&c.sync.forEach(e=>r.add(He(e,a))),e.forEach(e=>{let t=c[e];Array.isArray(t)&&t.forEach(e=>{let t=He(e,a);i.has(t)||i.add(t)})}),Array.isArray(c.async)&&c.async.forEach(e=>i.add(He(e,a)))}),{sync:Array.from(r),async:Array.from(i),cacheControl:o}}function Y(e){try{e.remove()}catch{}}function qe(e,t){try{let n=W(`/preload.html`),{cacheControl:r}=e,i=[e.sync,e.async].filter(e=>e.length>0),a=0,o=document.createElement(`iframe`);o.setAttribute(Fe,`true`),o.style.cssText=`position:absolute;width:0;height:0;border:0;visibility:hidden;overflow:hidden;`;let s=()=>{a<i.length&&o.contentWindow?.postMessage({type:`wf-preload-start`,urls:i[a],cache:r},`*`)},c=e=>{if(e.source===o.contentWindow)if(e.data?.type===`wf-preload-ready`){if(i.length===0){clearTimeout(l),window.removeEventListener(`message`,c),Y(o);return}s()}else e.data?.type===`wf-preload-done`&&(L(`INFO`,`SDK_INTERNAL`,`Preload batch ${a+1}/${i.length} done:`,e.data),a++,a<i.length?s():(clearTimeout(l),window.removeEventListener(`message`,c),setTimeout(()=>Y(o),1e3)))},l=setTimeout(()=>{t&&console.warn(`[WorldFirst Preload] Iframe timed out, cleaning up.`),window.removeEventListener(`message`,c),Y(o)},Le);window.addEventListener(`message`,c),o.onerror=()=>{clearTimeout(l),window.removeEventListener(`message`,c),Y(o)},o.src=n,document.body.appendChild(o)}catch{}}function X(e,t){let n=()=>{typeof requestIdleCallback==`function`?requestIdleCallback(()=>qe(e,t),{timeout:3e3}):setTimeout(()=>qe(e,t),200)};document.readyState===`complete`?n():window.addEventListener(`load`,n,{once:!0})}function Je(e){if(!Ue){if(Ue=!0,!e.elements||e.elements.length===0){Ue=!1;return}if(!(typeof window>`u`||typeof document>`u`)&&!document.querySelector(`[${Fe}]`)){if(!J()){L(`INFO`,`SDK_INTERNAL`,`Slow network detected, skipping preload.`);return}(async()=>{let t=We(e.elements);if(t.size===0)return;L(`INFO`,`SDK_INTERNAL`,`Preload Provider groups:`,Object.fromEntries(t));let n=await Ge(t,e.env);if(n.size===0)return;let r=Ke(t,n,e.locale);r.sync.length===0&&r.async.length===0||(L(`INFO`,`SDK_INTERNAL`,`Preloading ${r.sync.length} sync + ${r.async.length} async resources`),X(r))})().catch(()=>{L(`ERROR`,`SDK_INTERNAL`,`Preload failed`)})}}}var Ye={env:`prod`,debug:!1,targetOrigin:`https://openweb.worldfirst.com.cn`,version:`0.0.1778210535-dev.0`,trackerCode:`7983`},Xe=class extends U{static version=`0.0.1778210535-dev.0`;constructor(e){L(`INFO`,`SDK_INTERNAL`,`WorldFirstSDK initialized`,e);let{elements:t,...n}=e;Je({elements:t??[],env:je(e.env),locale:e.locale}),super(j(Ye,n))}canUseElements(){return[Ne]}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)(Xe,{...n,env:r},`WorldFirstSDK`)},window.WorldFirstSDK=Xe})();
|
|
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),e=null),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=`DEV`?.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,te=e=>typeof e==`bigint`||e>=0&&Number.isSafeInteger(e);function v(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 y=(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},b=(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:(ae(`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),x=/^\+?\d+$/,S=e=>{if(!x.test(e))return NaN;let t=Number.parseInt(e,10);return Number.isSafeInteger(t)?t:(ae(`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))},ne=(e,t,n)=>Array.from({length:Math.ceil(e.length/t)},(r,i)=>n(e.slice(i*t,(i+1)*t))),re=e=>new RegExp(e.map(e=>ie(e)).sort((e,t)=>t.length-e.length).join(`|`)),C=e=>RegExp(`^[${e.map(e=>ie(e)).sort((e,t)=>t.length-e.length).join(``)}]+$`),ie=e=>e.replace(/[\s#$()*+,.?[\\\]^{|}-]/g,`\\$&`),ae=(e=`BigInt is not available in this environment`)=>{if(typeof BigInt!=`function`)throw TypeError(e)},oe=16,se=3.5,ce=12,le=16,ue=12,de=100,fe=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<oe)throw Error(`Hashids: alphabet must contain at least ${oe} unique characters, provided: ${s.join(``)}`);this.alphabet=h(s,o);let c=g(o,s);this.seps=v(c,i);let l,u;(this.seps.length===0||this.alphabet.length/this.seps.length>se)&&(l=Math.ceil(this.alphabet.length/se),l>this.seps.length&&(u=l-this.seps.length,this.seps.push(...this.alphabet.slice(0,u)),this.alphabet=this.alphabet.slice(u))),this.alphabet=v(this.alphabet,i);let d=Math.ceil(this.alphabet.length/ce);this.alphabet.length<3?(this.guards=this.seps.slice(0,d),this.seps=this.seps.slice(d)):(this.guards=this.alphabet.slice(0,d),this.alphabet=this.alphabet.slice(d)),this.guardsRegExp=re(this.guards),this.sepsRegExp=re(this.seps),this.allowedCharsRegExp=C([...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:S(String(e)))),!n.every(te))?``: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(le);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=ne(t,ue,e=>Number.parseInt(`1${e}`,16));return this.encode(n)}decodeHex(e){return this.decode(e).map(e=>e.toString(le).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+de)):t%(n+de)),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=v(t,s);let c=y(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=v(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)];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=v(a,t.slice(0,a.length));o.push(b(Array.from(e),n)),a=n}return this._encode(o).join(``)===e?o:[]}}(`intl-open-sdk`,6);function pe(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 w=(e=``)=>e+fe.encode(`${Date.now()}${Math.ceil(Math.random()*100)}`),T=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:w(`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)}))}},me=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 pe(()=>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;if(!r||!r.type){n(Error(`collect error`));return}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)()}},he=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)}},E={HANDSHAKE:`OPENSDK@HANDSHAKE`,READY_HANDSHAKE:`OPENSDK@READY_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`},ge=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=y(t)||0,_(r)&&(d=!!r.leading,f=`maxWait`in r,o=f?m(y(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 te(e){return u=e,c=setTimeout(x,t),d?g(e):s}function v(e){var n=e-l,r=e-u,i=t-n;return f?ee(i,o-r):i}function b(e){var n=e-l,r=e-u;return l===void 0||n>=t||n<0||f&&r>=o}function x(){var e=h();if(b(e))return S(e);c=setTimeout(x,v(e))}function S(e){return c=void 0,p&&i?g(e):(i=a=void 0,s)}function ne(){c!==void 0&&clearTimeout(c),u=0,i=l=a=c=void 0}function re(){return c===void 0?s:S(h())}function C(){var e=h(),n=b(e);if(i=arguments,a=this,l=e,n){if(c===void 0)return te(l);if(f)return c=setTimeout(x,t),g(l)}return c===void 0&&(c=setTimeout(x,t)),s}return C.cancel=ne,C.flush=re,C}function _(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function te(e){return!!e&&typeof e==`object`}function v(e){return typeof e==`symbol`||te(e)&&p.call(e)==i}function y(e){if(typeof e==`number`)return e;if(v(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),D=[E.TRANSFER_RECEIVE_PORT,E.TRANSFER_SEND_PORT,E.TRANSFER_MODAL_PORT,E.TRANSFER_MODAL_APPEARANCE,E.OPEN_MODAL_ERROR,E.TRANSFER_APP_PORT,E.CLOSE_MODAL,E.OPEN_MODAL,E.REDIRECT,E.MESSAGE],O=`@@global`,k=`@@native`,_e=.01,ve=10,ye=class e{targetWindow;currentWindow;targetOrigin=`*`;scope;handlers=new Map;mode;resizeObserver;debugCallback;receivePort;static getGlobalBridge(t){return new e(t,O)}static getNativeBridge(t){return new e(`WEBAPP`,k,t)}static getBridge(t,n){if(n===k||n===O)throw Error(`Scope cannot be ${k} or ${O}`);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(E.TRANSFER_RECEIVE_PORT,this.receivePort?.name,e)}_transferReceivePort(e){this._transferPort(E.TRANSFER_RECEIVE_PORT,e.name,e.targetPorts)}_transferSendPort(e){this._transferPort(E.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:w(`bridge`),type:`SYSTEM_${E.ERROR}`,payload:{message:`Target window not set`}},`OUT`);return}let r={id:w(`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(E.ERROR,e.toJSON())}sendSubmit(e){this.mode===`WEBAPP`&&this.send(E.SUBMIT_REPLY,e)}sendMessage(e,t){this.mode===`WEBAPP`&&this.send(E.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(E.REDIRECT,{url:e,mode:t})}}openModal(e){return this.send(E.OPEN_MODAL,{...e,scope:this.scope}),new Promise((e,t)=>{this.once(E.OPEN_MODAL_ERROR,e=>{t(new p(e.message,e.code,e.source))}),this.once(E.TRANSFER_APP_PORT,(t,n)=>{if(!n?.[0])throw new m(`No ports transferred for modal communication`,`NO_PORTS_ERROR`,`SDK_INTERNAL`);e(new T(t,n[0]))})})}closeModal(){this.send(E.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(E.HANDSHAKE,async n=>{n?.elementMode===`GROUP`?n.isMainElement?this.getReceivePort().then(e=>{t(n,e)}):this.getSendPort().then(e=>{t(n,e)}).catch(()=>{t(n)}):t(n);let r=0,i=(0,ge.default)(e=>{(Math.abs(e-r)>ve||Math.abs((e-r)/r)>_e)&&(r=e,this.send(E.HEIGHT_UPDATE,e))},400);this.resizeObserver=new ResizeObserver(e=>{let t=e?.[0]?.contentRect;t&&i(t.height)}),this.resizeObserver.observe(document.body),this.send(E.HANDSHAKE_ACK,{version:e})});return this.send(E.READY_HANDSHAKE),()=>{n(),this.resizeObserver?.disconnect()}}handleMessage=e=>{let t=e.data;if(!t||!t.type)return;let[n,r]=t.type.split(`:`);if(this.scope!==k&&(![`WEBAPP`,`HOST`].includes(r)||this.targetOrigin!==`*`&&e.origin!==this.targetOrigin||this.mode===r))return;let i=this.handlers.get(t.type);this.scope!==k&&(i||t.type.endsWith(E.ERROR)||t.type.endsWith(E.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=E.ERROR),this.scope===k?e:`${D.includes(e)?O:this.scope}:${this.mode===`WEBAPP`?`HOST`:`WEBAPP`}:${e}`}getOriginSendType(e){return e===`error`&&(e=E.ERROR),this.scope===k?e:`${D.includes(e)?O: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:w(),type:this.getOriginSendType(e),payload:t},this.targetOrigin,n)}getReceivePort(){return new Promise(e=>{this.on(E.TRANSFER_RECEIVE_PORT,(t,n)=>{this.receivePort||=new me(t),n&&this.receivePort.addPort(n),e(this.receivePort)})})}getSendPort(){return new Promise((e,t)=>{this.on(E.TRANSFER_SEND_PORT,(n,r)=>{r?e(new he(n,r[0])):t(Error(`no ports transfer`))})})}},be=`https://cdn.marmot-cloud.com/tnpm-package/@antintl-opensdk-debugger/1.0.1/dist/tracker.umd.js`,xe=class{options;tracker;trackId;constructor(e){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){let t=(0,d.loadScript)(be,`intlSdkTracker`);return t?t.then(t=>t.variable?.getTrackerInstance(this.initialOptions(e))):Promise.resolve(void 0)}async initTracker(e){if(this.tracker&&!e)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 xe;var Se=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]`,te=`[object Proxy]`,v=`[object RegExp]`,y=`[object Set]`,b=`[object String]`,x=`[object Undefined]`,S=`[object WeakMap]`,ne=`[object ArrayBuffer]`,re=`[object DataView]`,C=`[object Float32Array]`,ie=`[object Float64Array]`,ae=`[object Int8Array]`,oe=`[object Int16Array]`,se=`[object Int32Array]`,ce=`[object Uint8Array]`,le=`[object Uint8ClampedArray]`,ue=`[object Uint16Array]`,de=`[object Uint32Array]`,fe=/[\\^$.*+?()[\]{}|]/g,pe=/^\[object .+?Constructor\]$/,w=/^(?:0|[1-9]\d*)$/,T={};T[C]=T[ie]=T[ae]=T[oe]=T[se]=T[ce]=T[le]=T[ue]=T[de]=!0,T[s]=T[c]=T[ne]=T[u]=T[re]=T[d]=T[f]=T[p]=T[ee]=T[h]=T[_]=T[v]=T[y]=T[b]=T[S]=!1;var me=typeof global==`object`&&global&&global.Object===Object&&global,he=typeof self==`object`&&self&&self.Object===Object&&self,E=me||he||Function(`return this`)(),ge=typeof e==`object`&&e&&!e.nodeType&&e,D=ge&&typeof t==`object`&&t&&!t.nodeType&&t,O=D&&D.exports===ge,k=O&&me.process,_e=function(){try{return D&&D.require&&D.require(`util`).types||k&&k.binding&&k.binding(`util`)}catch{}}(),ve=_e&&_e.isTypedArray;function ye(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 be(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function xe(e){return function(t){return e(t)}}function Se(e,t){return e?.[t]}function A(e,t){return function(n){return e(t(n))}}var Ce=Array.prototype,we=Function.prototype,j=Object.prototype,M=E[`__core-js_shared__`],N=we.toString,P=j.hasOwnProperty,Te=function(){var e=/[^.]+$/.exec(M&&M.keys&&M.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}(),F=j.toString,Ee=N.call(Object),De=RegExp(`^`+N.call(P).replace(fe,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),I=O?E.Buffer:void 0,Oe=E.Symbol,L=E.Uint8Array,R=I?I.allocUnsafe:void 0,z=A(Object.getPrototypeOf,Object),B=Object.create,V=j.propertyIsEnumerable,ke=Ce.splice,H=Oe?Oe.toStringTag:void 0,U=function(){try{var e=xt(Object,`defineProperty`);return e({},``,{}),e}catch{}}(),Ae=I?I.isBuffer:void 0,W=Math.max,G=Date.now,K=xt(E,`Map`),q=xt(Object,`create`),je=function(){function e(){}return function(t){if(!Q(t))return{};if(B)return B(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function J(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 Me(){this.__data__=q?q(null):{},this.size=0}function Ne(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}function Pe(e){var t=this.__data__;if(q){var n=t[e];return n===r?void 0:n}return P.call(t,e)?t[e]:void 0}function Fe(e){var t=this.__data__;return q?t[e]!==void 0:P.call(t,e)}function Ie(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=q&&t===void 0?r:t,this}J.prototype.clear=Me,J.prototype.delete=Ne,J.prototype.get=Pe,J.prototype.has=Fe,J.prototype.set=Ie;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():ke.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 J,map:new(K||Y),string:new J}}function Ue(e){var t=bt(this,e).delete(e);return this.size-=+!!t,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){var t=this.__data__=new Y(e);this.size=t.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(!K||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?be(e.length,String):[],c=s.length;for(var l in e)(t||P.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];(!(P.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__`&&U?U(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?x:g:H&&H 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)?De:pe).test(Ft(e))}function st(e){return $(e)&&Ut(e.length)&&!!T[it(e)]}function ct(e){if(!Q(e))return kt(e);var t=Ot(e),n=[];for(var r in e)r==`constructor`&&(t||!P.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=U?function(e,t){return U(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=R?R(n):new e.constructor(n);return e.copy(r),r}function mt(e){var t=new e.constructor(e.byteLength);return new L(t).set(new L(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=Se(e,t);return ot(n)?n:void 0}function St(e){var t=P.call(e,H),n=e[H];try{e[H]=void 0;var r=!0}catch{}var i=F.call(e);return r&&(t?e[H]=n:delete e[H]),i}function Ct(e){return typeof e.constructor==`function`&&!Ot(e)?je(z(e)):{}}function wt(e,t){var n=typeof e;return t??=o,!!t&&(n==`number`||n!=`symbol`&&w.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!!Te&&Te in e}function Ot(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||j)}function kt(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}function At(e){return F.call(e)}function jt(e,t,n){return t=W(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=W(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),ye(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=G(),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 N.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)&&P.call(e,`callee`)&&!V.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=Ae||Zt;function Ht(e){if(!Q(e))return!1;var t=it(e);return t==p||t==m||t==l||t==te}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=z(e);if(t===null)return!0;var n=P.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&N.call(n)==Ee}var Gt=ve?xe(ve):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 A(e,...t){return(0,Se.default)({},e,...t)}function Ce(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 we=new xe({appId:`180020050100012557`,performance:!1,error:!1}),j=`7981`,M=e=>{j=e},N=(e=``)=>t=>{we.log({code:`${j}${e}`,...t})},P=N(),Te=N(`event`),F=N(`iframe`),Ee=N(`handshake`),De=N(`merchant`),I=N(`element`),Oe=()=>{if(window.sdkDebugger)return Promise.resolve(window.sdkDebugger);let e=`0.0.20260429111818-dev.1`.replace(/-dev\.[0-9]+/,``),t=`https://cdn.marmot-cloud.com/tnpm-package/@antintl-opensdk-debugger/1.0.6/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)},L=(e,t,n,r)=>{if(e===`ERROR`){let e=r||{};P({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(`:`);Te({msg:o,d1:t,d2:i,d3:a,d4:JSON.stringify(r),d5:`无`,d6:e})}window.sdkDebugger?.log(e,t,n,r)},R=e=>{if(!e)return;let t=Ce(p.isError(e)?e.toJSON():e);L(`ERROR`,t.source,t.operationType||t.message||`Unknown Error`,t)},z=class extends p{name=`SDKInternalError`},B=class extends ye{static getGlobalBridge(){return ye.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)}},V=class extends z{name=`MountError`;constructor(e,t,n){super(e,t,n||`SDK_USAGE`)}},ke=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 B(e),this.bridge.setOrigin(t.targetOrigin),this.config.debug&&this.bridge.setDebugCallback((e,t)=>{e.type.endsWith(E.UPDATE_CONFIG)||e.type.endsWith(E.HEIGHT_UPDATE)||(e.type.endsWith(E.MESSAGE)?L(e.payload?.type,`APP_RUNTIME`,e.type,e.payload?.message):e.type.endsWith(E.ERROR)&&t===`IN`?R(e.payload):L(`INFO`,t===`OUT`?`SDK_INTERNAL`:`APP_RUNTIME`,e.type,e.payload))}),this.status=`initialized`}submit(e){throw new z(`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 V({message:`element status is ${this.status}, can not mount again`,params:{status:this.status}},`MOUNT_NOT_SUPPORT`);throw R(e),e}return pe(()=>Promise.all([this.setup(),this._mount(e)]),15e3,new V(`Mount timeout`,`MOUNT_TIMEOUT`,`SYSTEM`))().then(e=>{let[t]=e;De({msg:this.name,d1:t?.merchantId||`未配置的商户`}),this.bridge.send(E.HANDSHAKE,A(this.config.appConfig,t||{}))}).catch(e=>{this.unmount();let t=z.unificationError(e);throw R(t),t})}async _mount(e){return new Promise(async(t,n)=>{if(!this.isMainElement&&this.isSingleMode)return n(new V({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 V(`container missing`,`MOUNT_MISSING_CONTAINER`));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`,this.iframe||(this.iframe=document.createElement(`iframe`),this.iframe.src=r,this.iframe.style.width=`100%`,this.iframe.style.border=`none`,this.iframe.style.maxHeight=`100vh`,this.iframe.style.height=`0`,this.iframe.style.borderRadius=`inherit`,this.iframe.style.transition=`height 0.3s ease`,this.bridge.on(E.HEIGHT_UPDATE,e=>{this.iframe&&(this.iframe.style.height=`${e}px`)}));let a=Date.now();{let e=`*`;try{e=new URL(this.iframe.src).origin,e===`null`&&(e=`*`)}catch{e=`*`}this.bridge.setOrigin(e)}let o=e=>{if(console.log(`handShakeHandler`,e,this.status),this.status===`mounted`||this.status===`ready`)return;if(!this.iframe?.contentWindow)return t();L(`INFO`,`SYSTEM`,`Iframe ${this.name} loaded, initiating handshake...`),this.status=`mounted`,F({msg:this.name,d1:`是`,m1:Math.round(Date.now()-a),m2:1}),this.bridge.setTarget(this.iframe.contentWindow);let n=Date.now(),r=setTimeout(()=>{Ee({msg:this.name,d1:`handshake timeout`,m1:Math.round(Date.now()-n),m2:0,m3:Math.round(Date.now()-a)})},15e3);this.bridge.once(E.HANDSHAKE_ACK,e=>{clearTimeout(r),this.status=`ready`,Ee({msg:this.name,d1:`handshake ack`,m1:Math.round(Date.now()-n),m2:1,m3:Math.round(Date.now()-a)}),this.cachedSend.length&&(this.cachedSend.forEach(({type:e,payload:t})=>{this.bridge.send(e,t)}),this.cachedSend=[]),console.log(e?.version||`异常的版本`)}),t()};this.bridge.once(E.READY_HANDSHAKE,()=>{o(`readyHandshake`)}),this.iframe.onload=()=>{setTimeout(()=>{o(`onload`)},200)},this.iframe.onerror=e=>{F({msg:this.name,d1:`否`,m1:Math.round(Date.now()-a),m2:0}),n(new V(`Iframe load error: ${e}`,`MOUNT_IFRAME_LOAD_ERROR`,`SYSTEM`))},e.appendChild(this.iframe)}catch(e){n(new V(`Initialization crashed: ${e.message}`,`MOUNT_INITIAL_FAILED`,`SDK_INTERNAL`))}})}updateConfig(e){try{if(this.status===`destroyed`)throw new z(`Element already destroyed, cannot update destroyed SDK instance`,`ELEMENT_INSTANCE_DESTROYED`,`SDK_USAGE`);this.config.appConfig=A(this.config.appConfig,e),L(`INFO`,`SDK_USAGE`,`Updating configuration via API`,e),this.bridge.send(E.UPDATE_CONFIG,{merged:this.config.appConfig,updated:e})}catch(e){R(z.unificationError(e))}}unmount(){(this.status===`mounted`||this.status===`ready`)&&(this.status=`unmounted`,this.iframe&&this.iframe.parentNode&&(this.iframe.style.height=`0`,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`){R(new z(`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(E.SUBMIT,e),new Promise(e=>{this.bridge.once(E.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.unmount(),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)}}},H=class extends ke{constructor(e,t,n,r){super(e,{...n,isMainElement:!0,appUrl:t,appConfig:r||{}})}_submit(e){return super._submit(e)}},U=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&&M(e.trackerCode);let t=this.globalBridgeForWebApp=B.getGlobalBridge();this.globalBridgeForWebApp.on(E.OPEN_MODAL,async e=>{let n=this.globalBridgeForModal=B.getGlobalBridge();n.setDebugCallback((e,t)=>{t===`OUT`&&L(`INFO`,`SDK_INTERNAL`,e.type,e.payload)});let r=this._elements.get(e.scope);!r||!r.iframe?.contentWindow?L(`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 z(`Invalid URL`,`INVALID_MODAL_URL`,`APP_RUNTIME`);t.send(E.OPEN_MODAL_ERROR,e);return}let i=new MessageChannel,a=w(`modal_`),o=this.openModalHandle=await this.openModal({...e,onClose(){if(e.closeConfirm)return new T(a,i.port2).close(!0)}});e.appearance&&o.onLoadedSuccess(()=>{n.setTarget(o.getContentWindow()),n.send(E.TRANSFER_MODAL_APPEARANCE,e.appearance)}),e.closeConfirm&&(t.send(E.TRANSFER_APP_PORT,a,[i.port1]),o.onLoadedSuccess(()=>{n.setTarget(o.getContentWindow()),n.send(E.TRANSFER_MODAL_PORT,a,[i.port2])})),t.on(E.CLOSE_MODAL,()=>{o.destroy(),n.destroy()})}),t.on(E.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(E.MESSAGE)?L(e.payload?.type,`APP_RUNTIME`,e.type,e.payload?.message):e.type.endsWith(E.ERROR)&&t===`IN`?R(e.payload):e.type.endsWith(E.OPEN_MODAL_ERROR)?L(`ERROR`,`APP_RUNTIME`,`Open modal error`,e.payload):L(`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 z(`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 z(`This elementType "${r.elementType}" ${n?`with config ${JSON.stringify(n)}`:``} is already registered in factory`,`ELEMENT_ALREADY_REGISTERED`,`SDK_INTERNAL`)})}async openModal(e){return L(`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 Oe().then(e=>{e?.mount()}).catch(()=>{R(new z(`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 z({message:`Generate element ${e} key error, with options ${JSON.stringify(t)}`,params:{elementType:e,options:t}},`GENERATE_ELEMENT_KEY_FAILED`,`SDK_INTERNAL`);throw R(n),n}}_createElement(e,t){let n;I({msg:e});let r=this._generateElementKey(e,t);if(n=this.elementClasses[r],I({msg:e,m1:+!!n}),!n){let t=new z({message:`Element type ${e} not supported.`,params:{elementType:e}},`NOT_SUPPORT_ELEMENT`,`SDK_USAGE`);throw R(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=z.isError(t)?t:new z({message:`Element type ${e} initialization failed ${t instanceof Error?t.message:``}`,params:{elementType:e}},`ELEMENT_INIT_FAILED`,`SDK_INTERNAL`);throw R(n),n}return i._addHook(`ondestroy`,()=>{this._removeElement(e,t),this._getElementSize()||L(`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 z({message:`${e} element already exists, please don't create twice.`,params:{elementType:e}},`CANNOT_CREATE_SAME_ELEMENT_TWICE`,`SDK_USAGE`);throw R(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}},Ae=()=>{{let e=sessionStorage.getItem(`WORLDFIRST_APP_DOCUMENT_PREFIX`);if(!e)throw Error(`WORLDFIRST_APP_DOCUMENT_PREFIX is not set in sessionStorage, please checkout`);return e.startsWith(`http://wf.local.alipay.net`)?e:`${e}/page/wf-embedded`}return`https://openweb.worldfirst.com.cn`},W=e=>{let t=e.startsWith(`/`)?e:`/${e}`;return`${Ae()}${t}`},G=`data-wf-auth`;function K(e,t,n){e.contentWindow?.postMessage({type:`AUTH_INIT`,clientId:t.clientId,token:t.token,country:t.country},n)}function q(e){let t=Ae(),n=document.querySelector(`[${G}]`);if(n&&e)return K(n,e,t),n.onload=()=>K(n,e,t),()=>{n.onload=null,n.remove()};if(n&&!e)return L(`INFO`,`SDK_INTERNAL`,`set empty auth config`,`No auth config provided`),()=>{n.onload=null,n.remove()};let r=document.createElement(`iframe`);return r.src=`${t}/auth.html`,r.style.cssText=`position:absolute;width:0;height:0;border:0;visibility:hidden;`,r.setAttribute(G,`true`),e&&(K(r,e,t),r.onload=()=>K(r,e,t)),document.body.appendChild(r),()=>{r.onload=null,r.remove()}}var je={ONBOARD:`onboard`},J=class extends H{static elementType=je.ONBOARD;constructor(e,t){super(e,W(`/onboard.html`),t,t.appConfig)}async mount(e){await super.mount(e);let t=new MessageChannel,n=document.querySelector(`[${G}]`);n&&(n?.contentWindow?.postMessage({type:`wf-token-connect`,elementId:this.name},`*`,[t.port1]),this.iframe?.contentWindow?.postMessage({type:`wf-token-channel`,elementId:this.name},`*`,[t.port2]),this._addHook(`ondestroy`,()=>{t.port1.close(),t.port2.close()}))}submit(){return this._submit()}focus(){throw Error(`Method not implemented.`)}blur(){throw Error(`Method not implemented.`)}clear(){throw Error(`Method not implemented.`)}},Me=`/preload.html`,Ne={onboard:`worldfirst`},Pe={worldfirst:`/manifest.json`,antom:`TODO_ANTOM_MANIFEST_URL_LOCAL`},Fe=`data-wf-preload`,Ie=5e3,Y=3e4,Le=[`slow-2g`,`2g`,`3g`],Re=`{lang}`,ze=`zh-CN`,Be=[`zh-CN`,`en-US`,`en-GB`,`nl-NL`,`vi-VN`,`ja-JP`,`ko-KR`,`de-DE`,`th-TH`,`ms-MY`,`zh-TW`,`in-ID`,`pt-BR`,`es-ES`,`tr-TR`,`ar-SA`,`pl-PL`];function Ve(e){return e&&Be.includes(e)?e:ze}function X(e,t){return e.includes(Re)?e.replace(Re,t.toLowerCase()):e}var He=!1;function Ue(){try{let e=navigator.connection;return!e||!e.effectiveType?!0:!Le.includes(e.effectiveType)}catch{return!0}}function We(e){let t=new Map;for(let n of e){let e=Ne[n];if(!e){L(`WARN`,`SDK_INTERNAL`,`Unknown element type`,n);continue}let r=t.get(e)||[];r.push(n),t.set(e,r)}return t}async function Ge(e){let t=Array.from(e.keys()),n=await Promise.allSettled(t.map(async e=>{let t=W(Pe[e]);if(!t||t.startsWith(`TODO`))return L(`WARN`,`SDK_INTERNAL`,`Preload Manifest URL not configured for provider`,e),{provider:e,manifest:{}};let n=new AbortController,r=setTimeout(()=>n.abort(),Ie);try{return{provider:e,manifest:await(await fetch(t,{signal:n.signal})).json()}}finally{clearTimeout(r)}})),r=new Map;return n.forEach((e,n)=>{e.status===`fulfilled`?r.set(e.value.provider,e.value.manifest):L(`WARN`,`SDK_INTERNAL`,`Failed to fetch manifest for provider`,t[n])}),r}function Ke(e,t,n){let r=new Set,i=new Set,a=Ve(n),o=`default`;return e.forEach((e,n)=>{let s=t.get(n);if(!s?.offlineResources)return;let c=s.offlineResources;c.cacheControl&&(o=c.cacheControl),Array.isArray(c.sync)&&c.sync.forEach(e=>r.add(X(e,a))),e.forEach(e=>{let t=c[e];Array.isArray(t)&&t.forEach(e=>{let t=X(e,a);i.has(t)||i.add(t)})}),Array.isArray(c.async)&&c.async.forEach(e=>i.add(X(e,a)))}),{sync:Array.from(r),async:Array.from(i),cacheControl:o}}function Z(e){try{e.remove()}catch{}}function qe(e,t){try{let n=W(Me),{cacheControl:r}=e,i=[e.sync,e.async].filter(e=>e.length>0),a=0,o=document.createElement(`iframe`);o.setAttribute(Fe,`true`),o.style.cssText=`position:absolute;width:0;height:0;border:0;visibility:hidden;overflow:hidden;`;let s=()=>{a<i.length&&o.contentWindow?.postMessage({type:`wf-preload-start`,urls:i[a],cache:r},`*`)},c=e=>{if(e.source===o.contentWindow)if(e.data?.type===`wf-preload-ready`){if(i.length===0){clearTimeout(l),window.removeEventListener(`message`,c),Z(o);return}s()}else e.data?.type===`wf-preload-done`&&(L(`INFO`,`SDK_INTERNAL`,`Preload batch ${a+1}/${i.length} done:`,e.data),a++,a<i.length?s():(clearTimeout(l),window.removeEventListener(`message`,c),setTimeout(()=>Z(o),1e3)))},l=setTimeout(()=>{t&&console.warn(`[WorldFirst Preload] Iframe timed out, cleaning up.`),window.removeEventListener(`message`,c),Z(o)},Y);window.addEventListener(`message`,c),o.onerror=()=>{clearTimeout(l),window.removeEventListener(`message`,c),Z(o)},o.src=n,document.body.appendChild(o)}catch{}}function Je(e,t){let n=()=>{typeof requestIdleCallback==`function`?requestIdleCallback(()=>qe(e,t),{timeout:3e3}):setTimeout(()=>qe(e,t),200)};document.readyState===`complete`?n():window.addEventListener(`load`,n,{once:!0})}function Ye(e){if(!He){if(He=!0,!e.elements||e.elements.length===0){He=!1;return}if(!(typeof window>`u`||typeof document>`u`)&&!document.querySelector(`[${Fe}]`)){if(!Ue()){L(`INFO`,`SDK_INTERNAL`,`Slow network detected, skipping preload.`);return}(async()=>{let t=We(e.elements);if(t.size===0)return;L(`INFO`,`SDK_INTERNAL`,`Preload Provider groups:`,Object.fromEntries(t));let n=await Ge(t);if(n.size===0)return;let r=Ke(t,n,e.locale);r.sync.length===0&&r.async.length===0||(L(`INFO`,`SDK_INTERNAL`,`Preloading ${r.sync.length} sync + ${r.async.length} async resources`),Je(r))})().catch(()=>{L(`ERROR`,`SDK_INTERNAL`,`Preload failed`)})}}}var Xe={env:`prod`,debug:!1,targetOrigin:`https://openweb.worldfirst.com.cn`,version:`0.0.1778210535-dev.2`,trackerCode:`7983`},Ze=class extends U{static version=`0.0.1778210535-dev.2`;destroyAuthIframe=null;constructor(e){L(`INFO`,`SDK_INTERNAL`,`WorldFirstSDK initialized`,e);let{elements:t=[],authConfig:n,...r}=e;Ye({elements:t,locale:e.locale}),super(A(Xe,r)),this.destroyAuthIframe=q(n)}setAuth(e){this.destroyAuthIframe=q(e)}canUseElements(){return[J]}createElement(e,t){return this._createElement(e,t)}getElement(e,t){return this._getElement(e,t)}destroy(){this.destroyAuthIframe?.(),this.destroyAuthIframe=null,super.destroy()}};window.loadWorldFirst=async e=>{let{env:t,...n}=e||{},r=t||`prod`;return(0,d.createSingletonInstance)(Ze,{...n,env:r},`WorldFirstSDK`)},window.WorldFirstSDK=Ze})();
|
package/lib/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),t=e((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)})}})),n=e((e=>{var n=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())})},r=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 i=t(),a=`https://cdn.marmot-cloud.com/tnpm-package/@antintl-opensdk-debugger/1.0.1/dist/tracker.umd.js`,o=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,i.loadScript)(a,`intlSdkTracker`).then(function(t){return(t?.variable)?.getTrackerInstance(e.initOptions)})}}),Object.defineProperty(e.prototype,`getTracker`,{enumerable:!1,configurable:!0,writable:!0,value:function(){return n(this,void 0,void 0,function(){var e;return r(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=o;var s=`DEV`?.toUpperCase()||`PROD`;e.tracker=new o({appId:`180020050100012557`,env:[`DEV`,`SIT`,`PRE`,`PROD`,`LOCAL`].includes(s)?s:`PROD`,server:`sg`,performance:!1,error:!1})})),r=e((e=>{var r=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())})},i=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.loadScript=void 0,e.createLoader=u;var a=n(),o=t();Object.defineProperty(e,`loadScript`,{enumerable:!0,get:function(){return o.loadScript}});var s=null;function c(e,t,n){return s||(s=l(e,t,n),s)}function l(e,t,n){var r=new e(t),i=Date.now();return r.init().then(function(e){return n&&a.tracker.log({code:`7988`,msg:n,d1:`initialized`,d2:`无`,d3:`无`,d4:r.version||`无版本号`,d5:`umd`,m1:Date.now()-i,m2:Date.now()-i}),e}).catch(function(e){var t=new o.LoaderError(`INIT_ERROR`,`Initialize Class failed: ${e.message}`);throw n&&a.tracker.log({code:`7988`,msg:n,d1:`createError`,d2:t.code,d3:t.message,d4:`无`,d5:`umd`,m1:Date.now()-i,m2:0}),t})}function u(e){var t=this,n=e.sdkURL,s=e.globalName,u=e.timeout,f=u===void 0?2e4:u,p=e.onLoadComplete,m=e.onError,h=e.onLoadStart,g=e.onInitialized,_=e.single,v=_===void 0?!0:_,y=e.namespace;return function(e){return r(t,void 0,void 0,function(){var t,u,_=this;return i(this,function(b){return h?.(),t=Date.now(),a.tracker.log({code:`7988`,msg:y,d1:`loadStart`,d2:`无`,d3:`无`,d4:`无`,d5:`npm`,m1:0,m2:0}),u=d(function(){return(0,o.loadScriptClass)(n,s)},f),[2,u().then(function(n){return r(_,[n],void 0,function(n){var r,u,d,f,m=n.variable,h=n.cache;return i(this,function(n){switch(n.label){case 0:if(r=Date.now(),h||a.tracker.log({code:`7988`,msg:y,d1:`loadComplete`,d2:`无`,d3:`无`,d4:m.version||`无`,d5:`npm`,m1:Date.now()-t,m2:0}),p?.(),!m)throw new o.LoaderError(`NO_REMOTE_CLASS`,`No variables ${s} were found. Cannot be initialized the Class ${s}`);n.label=1;case 1:return n.trys.push([1,3,,4]),u=v?c:l,[4,u(m,e,void 0)];case 2:return d=n.sent(),a.tracker.log({code:`7988`,msg:y,d1:`initialized`,d2:`无`,d3:`无`,d4:d.version||`无版本号`,d5:`npm`,m1:Date.now()-t,m2:Date.now()-r}),g?.(d,window.location.href),[2,d];case 3:throw f=n.sent(),new o.LoaderError(`INIT_ERROR`,`Initialize Class ${s} failed: ${f.message}`);case 4:return[2]}})})}).catch(function(e){var n=o.LoaderError.unificationError(e);return a.tracker.log({code:`7988`,msg:y,d1:`createError`,d2:n.code,d3:n.message,d4:`无`,d5:`npm`,m1:Date.now()-t,m2:0}),m?.(n),Promise.reject(e)})]})})}}function d(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return Promise.race([new Promise(function(e,n){setTimeout(function(){n(new o.LoaderError(`LOAD_TIMEOUT`,`Load timeout: ${t}`))},t)}),e.apply(void 0,n)])}}}))(),i=e=>[...new Set(e)],a=(e,t)=>e.filter(e=>!t.includes(e)),o=(e,t)=>e.filter(e=>t.includes(e)),s=e=>typeof e==`bigint`||!Number.isNaN(Number(e))&&Math.floor(Number(e))===e,c=e=>typeof e==`bigint`||e>=0&&Number.isSafeInteger(e);function l(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 u=(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},d=(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:(v(`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),f=/^\+?\d+$/,p=e=>{if(!f.test(e))return NaN;let t=Number.parseInt(e,10);return Number.isSafeInteger(t)?t:(v(`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))},m=(e,t,n)=>Array.from({length:Math.ceil(e.length/t)},(r,i)=>n(e.slice(i*t,(i+1)*t))),h=e=>new RegExp(e.map(e=>_(e)).sort((e,t)=>t.length-e.length).join(`|`)),g=e=>RegExp(`^[${e.map(e=>_(e)).sort((e,t)=>t.length-e.length).join(``)}]+$`),_=e=>e.replace(/[\s#$()*+,.?[\\\]^{|}-]/g,`\\$&`),v=(e=`BigInt is not available in this environment`)=>{if(typeof BigInt!=`function`)throw TypeError(e)},y=16,b=3.5,x=12,S=16,C=12,w=100;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 s=Array.from(e),c=Array.from(n),u=Array.from(r);this.salt=s;let d=i(c);if(d.length<y)throw Error(`Hashids: alphabet must contain at least ${y} unique characters, provided: ${d.join(``)}`);this.alphabet=a(d,u);let f=o(u,d);this.seps=l(f,s);let p,m;(this.seps.length===0||this.alphabet.length/this.seps.length>b)&&(p=Math.ceil(this.alphabet.length/b),p>this.seps.length&&(m=p-this.seps.length,this.seps.push(...this.alphabet.slice(0,m)),this.alphabet=this.alphabet.slice(m))),this.alphabet=l(this.alphabet,s);let _=Math.ceil(this.alphabet.length/x);this.alphabet.length<3?(this.guards=this.seps.slice(0,_),this.seps=this.seps.slice(_)):(this.guards=this.alphabet.slice(0,_),this.alphabet=this.alphabet.slice(_)),this.guardsRegExp=h(this.guards),this.sepsRegExp=h(this.seps),this.allowedCharsRegExp=g([...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(s)||(n=n.map(e=>typeof e==`bigint`||typeof e==`number`?e:p(String(e)))),!n.every(c))?``: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(S);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=m(t,C,e=>Number.parseInt(`1${e}`,16));return this.encode(n)}decodeHex(e){return this.decode(e).map(e=>e.toString(S).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+w)):t%(n+w)),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=l(t,s);let c=u(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=l(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)];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=l(a,t.slice(0,a.length));o.push(d(Array.from(e),n)),a=n}return this._encode(o).join(``)===e?o:[]}}(`intl-open-sdk`,6);var T={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`};e(((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,h=Math.min,g=function(){return f.Date.now()};function _(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=x(t)||0,v(r)&&(d=!!r.leading,f=`maxWait`in r,o=f?m(x(r.maxWait)||0,t):o,p=`trailing`in r?!!r.trailing:p);function _(t){var n=i,r=a;return i=a=void 0,u=t,s=e.apply(r,n),s}function y(e){return u=e,c=setTimeout(C,t),d?_(e):s}function b(e){var n=e-l,r=e-u,i=t-n;return f?h(i,o-r):i}function S(e){var n=e-l,r=e-u;return l===void 0||n>=t||n<0||f&&r>=o}function C(){var e=g();if(S(e))return w(e);c=setTimeout(C,b(e))}function w(e){return c=void 0,p&&i?_(e):(i=a=void 0,s)}function T(){c!==void 0&&clearTimeout(c),u=0,i=l=a=c=void 0}function ee(){return c===void 0?s:w(g())}function E(){var e=g(),n=S(e);if(i=arguments,a=this,l=e,n){if(c===void 0)return y(l);if(f)return c=setTimeout(C,t),_(l)}return c===void 0&&(c=setTimeout(C,t)),s}return E.cancel=T,E.flush=ee,E}function v(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function y(e){return!!e&&typeof e==`object`}function b(e){return typeof e==`symbol`||y(e)&&p.call(e)==i}function x(e){if(typeof e==`number`)return e;if(b(e))return r;if(v(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=v(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=_}))(),T.TRANSFER_RECEIVE_PORT,T.TRANSFER_SEND_PORT,T.TRANSFER_MODAL_PORT,T.TRANSFER_MODAL_APPEARANCE,T.OPEN_MODAL_ERROR,T.TRANSFER_APP_PORT,T.CLOSE_MODAL,T.OPEN_MODAL,T.REDIRECT,T.MESSAGE;var ee=`https://cdn.marmot-cloud.com/tnpm-package/@antintl-opensdk-debugger/1.0.1/dist/tracker.umd.js`,E=class{options;tracker;trackId;constructor(e){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){let t=(0,r.loadScript)(ee,`intlSdkTracker`);return t?t.then(t=>t.variable?.getTrackerInstance(this.initialOptions(e))):Promise.resolve(void 0)}async initTracker(e){if(this.tracker&&!e)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 E,e(((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]`,h=`[object Map]`,g=`[object Number]`,_=`[object Null]`,v=`[object Object]`,y=`[object Proxy]`,b=`[object RegExp]`,x=`[object Set]`,S=`[object String]`,C=`[object Undefined]`,w=`[object WeakMap]`,T=`[object ArrayBuffer]`,ee=`[object DataView]`,E=`[object Float32Array]`,te=`[object Float64Array]`,ne=`[object Int8Array]`,D=`[object Int16Array]`,re=`[object Int32Array]`,ie=`[object Uint8Array]`,ae=`[object Uint8ClampedArray]`,O=`[object Uint16Array]`,oe=`[object Uint32Array]`,se=/[\\^$.*+?()[\]{}|]/g,ce=/^\[object .+?Constructor\]$/,le=/^(?:0|[1-9]\d*)$/,k={};k[E]=k[te]=k[ne]=k[D]=k[re]=k[ie]=k[ae]=k[O]=k[oe]=!0,k[s]=k[c]=k[T]=k[u]=k[ee]=k[d]=k[f]=k[p]=k[h]=k[g]=k[v]=k[b]=k[x]=k[S]=k[w]=!1;var ue=typeof global==`object`&&global&&global.Object===Object&&global,de=typeof self==`object`&&self&&self.Object===Object&&self,A=ue||de||Function(`return this`)(),fe=typeof e==`object`&&e&&!e.nodeType&&e,j=fe&&typeof t==`object`&&t&&!t.nodeType&&t,pe=j&&j.exports===fe,M=pe&&ue.process,me=function(){try{return j&&j.require&&j.require(`util`).types||M&&M.binding&&M.binding(`util`)}catch{}}(),he=me&&me.isTypedArray;function ge(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 _e(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function ve(e){return function(t){return e(t)}}function ye(e,t){return e?.[t]}function be(e,t){return function(n){return e(t(n))}}var xe=Array.prototype,Se=Function.prototype,N=Object.prototype,P=A[`__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:``}(),we=N.toString,Te=F.call(Object),Ee=RegExp(`^`+F.call(I).replace(se,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),L=pe?A.Buffer:void 0,De=A.Symbol,Oe=A.Uint8Array,ke=L?L.allocUnsafe:void 0,Ae=be(Object.getPrototypeOf,Object),je=Object.create,Me=N.propertyIsEnumerable,Ne=xe.splice,R=De?De.toStringTag:void 0,z=function(){try{var e=X(Object,`defineProperty`);return e({},``,{}),e}catch{}}(),Pe=L?L.isBuffer:void 0,Fe=Math.max,Ie=Date.now,Le=X(A,`Map`),B=X(Object,`create`),Re=function(){function e(){}return function(t){if(!Q(t))return{};if(je)return je(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function V(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 ze(){this.__data__=B?B(null):{},this.size=0}function Be(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}function Ve(e){var t=this.__data__;if(B){var n=t[e];return n===r?void 0:n}return I.call(t,e)?t[e]:void 0}function He(e){var t=this.__data__;return B?t[e]!==void 0:I.call(t,e)}function Ue(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=B&&t===void 0?r:t,this}V.prototype.clear=ze,V.prototype.delete=Be,V.prototype.get=Ve,V.prototype.has=He,V.prototype.set=Ue;function H(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 We(){this.__data__=[],this.size=0}function Ge(e){var t=this.__data__,n=K(t,e);return n<0?!1:(n==t.length-1?t.pop():Ne.call(t,n,1),--this.size,!0)}function Ke(e){var t=this.__data__,n=K(t,e);return n<0?void 0:t[n][1]}function qe(e){return K(this.__data__,e)>-1}function Je(e,t){var n=this.__data__,r=K(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}H.prototype.clear=We,H.prototype.delete=Ge,H.prototype.get=Ke,H.prototype.has=qe,H.prototype.set=Je;function U(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 Ye(){this.size=0,this.__data__={hash:new V,map:new(Le||H),string:new V}}function Xe(e){var t=Y(this,e).delete(e);return this.size-=+!!t,t}function Ze(e){return Y(this,e).get(e)}function Qe(e){return Y(this,e).has(e)}function $e(e,t){var n=Y(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}U.prototype.clear=Ye,U.prototype.delete=Xe,U.prototype.get=Ze,U.prototype.has=Qe,U.prototype.set=$e;function W(e){var t=this.__data__=new H(e);this.size=t.size}function et(){this.__data__=new H,this.size=0}function tt(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function nt(e){return this.__data__.get(e)}function rt(e){return this.__data__.has(e)}function it(e,t){var r=this.__data__;if(r instanceof H){var i=r.__data__;if(!Le||i.length<n-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new U(i)}return r.set(e,t),this.size=r.size,this}W.prototype.clear=et,W.prototype.delete=tt,W.prototype.get=nt,W.prototype.has=rt,W.prototype.set=it;function at(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?_e(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`)||Tt(l,c)))&&s.push(l);return s}function G(e,t,n){(n!==void 0&&!Z(e[t],n)||n===void 0&&!(t in e))&&q(e,t,n)}function ot(e,t,n){var r=e[t];(!(I.call(e,t)&&Z(r,n))||n===void 0&&!(t in e))&&q(e,t,n)}function K(e,t){for(var n=e.length;n--;)if(Z(e[n][0],t))return n;return-1}function q(e,t,n){t==`__proto__`&&z?z(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var st=St();function J(e){return e==null?e===void 0?C:_:R&&R in Object(e)?Ct(e):jt(e)}function ct(e){return $(e)&&J(e)==s}function lt(e){return!Q(e)||Ot(e)?!1:(Ht(e)?Ee:ce).test(It(e))}function ut(e){return $(e)&&Ut(e.length)&&!!k[J(e)]}function dt(e){if(!Q(e))return At(e);var t=kt(e),n=[];for(var r in e)r==`constructor`&&(t||!I.call(e,r))||n.push(r);return n}function ft(e,t,n,r,i){e!==t&&st(t,function(a,o){if(i||=new W,Q(a))pt(e,t,o,n,ft,r,i);else{var s=r?r(Nt(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),G(e,o,s)}},qt)}function pt(e,t,n,r,i,a,o){var s=Nt(e,n),c=Nt(t,n),l=o.get(c);if(l){G(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=yt(s):p?(d=!1,u=gt(c,!0)):m?(d=!1,u=vt(c,!0)):u=[]:Wt(c)||Lt(c)?(u=s,Lt(s)?u=Kt(s):(!Q(s)||Ht(s))&&(u=wt(c))):d=!1}d&&(o.set(c,u),i(u,c,r,a,o),o.delete(c)),G(e,n,u)}function mt(e,t){return Pt(Mt(e,t,Xt),e+``)}var ht=z?function(e,t){return z(e,`toString`,{configurable:!0,enumerable:!1,value:Yt(t),writable:!0})}:Xt;function gt(e,t){if(t)return e.slice();var n=e.length,r=ke?ke(n):new e.constructor(n);return e.copy(r),r}function _t(e){var t=new e.constructor(e.byteLength);return new Oe(t).set(new Oe(e)),t}function vt(e,t){var n=t?_t(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function yt(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}function bt(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?q(n,s,c):ot(n,s,c)}return n}function xt(e){return mt(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&&Et(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 St(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 Y(e,t){var n=e.__data__;return Dt(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function X(e,t){var n=ye(e,t);return lt(n)?n:void 0}function Ct(e){var t=I.call(e,R),n=e[R];try{e[R]=void 0;var r=!0}catch{}var i=we.call(e);return r&&(t?e[R]=n:delete e[R]),i}function wt(e){return typeof e.constructor==`function`&&!kt(e)?Re(Ae(e)):{}}function Tt(e,t){var n=typeof e;return t??=o,!!t&&(n==`number`||n!=`symbol`&&le.test(e))&&e>-1&&e%1==0&&e<t}function Et(e,t,n){if(!Q(n))return!1;var r=typeof t;return(r==`number`?zt(n)&&Tt(t,n.length):r==`string`&&t in n)?Z(n[t],e):!1}function Dt(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function Ot(e){return!!Ce&&Ce in e}function kt(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||N)}function At(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}function jt(e){return we.call(e)}function Mt(e,t,n){return t=Fe(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=Fe(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),ge(e,this,s)}}function Nt(e,t){if(!(t===`constructor`&&typeof e[t]==`function`)&&t!=`__proto__`)return e[t]}var Pt=Ft(ht);function Ft(e){var t=0,n=0;return function(){var r=Ie(),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 It(e){if(e!=null){try{return F.call(e)}catch{}try{return e+``}catch{}}return``}function Z(e,t){return e===t||e!==e&&t!==t}var Lt=ct(function(){return arguments}())?ct:function(e){return $(e)&&I.call(e,`callee`)&&!Me.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=Pe||Zt;function Ht(e){if(!Q(e))return!1;var t=J(e);return t==p||t==m||t==l||t==y}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)||J(e)!=v)return!1;var t=Ae(e);if(t===null)return!0;var n=I.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&F.call(n)==Te}var Gt=he?ve(he):ut;function Kt(e){return bt(e,qt(e))}function qt(e){return zt(e)?at(e,!0):dt(e)}var Jt=xt(function(e,t,n){ft(e,t,n)});function Yt(e){return function(){return e}}function Xt(e){return e}function Zt(){return!1}t.exports=Jt}))();var te=new E({appId:`180020050100012557`,performance:!1,error:!1}),ne=`7981`,D=(e=``)=>t=>{te.log({code:`${ne}${e}`,...t})},re=D(),ie=D(`event`),ae=(e,t,n,r)=>{if(e===`ERROR`){let e=r||{};re({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(`:`);ie({msg:o,d1:t,d2:i,d3:a,d4:JSON.stringify(r),d5:`无`,d6:e})}window.sdkDebugger?.log(e,t,n,r)},O={DEV:`https://sdk-dev.marmot-cloud.com/package/worldfirst-js/dev-1778210535/dist/index.js`,LOCAL:`http://localhost:7981/index.js`,PROD:`http://js-dev.worldfirst.com/v1/dist/index.js`},oe=(0,r.createLoader)({sdkURL:O.DEV,globalName:`WorldFirstSDK`,namespace:`WorldFirstSDK`}),se=async e=>{let{env:t,...n}=e||{},r=t||`prod`;return ae(`INFO`,`SDK_INTERNAL`,`loadWorldFirst stageName: DEV`,O),oe({...n,env:r})};exports.loadWorldFirst=se;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),t=e((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)})}})),n=e((e=>{var n=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())})},r=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 i=t(),a=`https://cdn.marmot-cloud.com/tnpm-package/@antintl-opensdk-debugger/1.0.1/dist/tracker.umd.js`,o=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,i.loadScript)(a,`intlSdkTracker`).then(function(t){return(t?.variable)?.getTrackerInstance(e.initOptions)})}}),Object.defineProperty(e.prototype,`getTracker`,{enumerable:!1,configurable:!0,writable:!0,value:function(){return n(this,void 0,void 0,function(){var e;return r(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=o;var s=`DEV`?.toUpperCase()||`PROD`;e.tracker=new o({appId:`180020050100012557`,env:[`DEV`,`SIT`,`PRE`,`PROD`,`LOCAL`].includes(s)?s:`PROD`,server:`sg`,performance:!1,error:!1})})),r=(0,e((e=>{var r=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())})},i=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.loadScript=void 0,e.createLoader=u;var a=n(),o=t();Object.defineProperty(e,`loadScript`,{enumerable:!0,get:function(){return o.loadScript}});var s=null;function c(e,t,n){return s||(s=l(e,t,n),s)}function l(e,t,n){var r=new e(t),i=Date.now();return r.init().then(function(e){return n&&a.tracker.log({code:`7988`,msg:n,d1:`initialized`,d2:`无`,d3:`无`,d4:r.version||`无版本号`,d5:`umd`,m1:Date.now()-i,m2:Date.now()-i}),e}).catch(function(e){var t=new o.LoaderError(`INIT_ERROR`,`Initialize Class failed: ${e.message}`);throw n&&a.tracker.log({code:`7988`,msg:n,d1:`createError`,d2:t.code,d3:t.message,d4:`无`,d5:`umd`,m1:Date.now()-i,m2:0}),t})}function u(e){var t=this,n=e.sdkURL,s=e.globalName,u=e.timeout,f=u===void 0?2e4:u,p=e.onLoadComplete,m=e.onError,h=e.onLoadStart,g=e.onInitialized,_=e.single,v=_===void 0?!0:_,y=e.namespace;return function(e){return r(t,void 0,void 0,function(){var t,u,_=this;return i(this,function(b){return h?.(),t=Date.now(),a.tracker.log({code:`7988`,msg:y,d1:`loadStart`,d2:`无`,d3:`无`,d4:`无`,d5:`npm`,m1:0,m2:0}),u=d(function(){return(0,o.loadScriptClass)(n,s)},f),[2,u().then(function(n){return r(_,[n],void 0,function(n){var r,u,d,f,m=n.variable,h=n.cache;return i(this,function(n){switch(n.label){case 0:if(r=Date.now(),h||a.tracker.log({code:`7988`,msg:y,d1:`loadComplete`,d2:`无`,d3:`无`,d4:m.version||`无`,d5:`npm`,m1:Date.now()-t,m2:0}),p?.(),!m)throw new o.LoaderError(`NO_REMOTE_CLASS`,`No variables ${s} were found. Cannot be initialized the Class ${s}`);n.label=1;case 1:return n.trys.push([1,3,,4]),u=v?c:l,[4,u(m,e,void 0)];case 2:return d=n.sent(),a.tracker.log({code:`7988`,msg:y,d1:`initialized`,d2:`无`,d3:`无`,d4:d.version||`无版本号`,d5:`npm`,m1:Date.now()-t,m2:Date.now()-r}),g?.(d,window.location.href),[2,d];case 3:throw f=n.sent(),new o.LoaderError(`INIT_ERROR`,`Initialize Class ${s} failed: ${f.message}`);case 4:return[2]}})})}).catch(function(e){var n=o.LoaderError.unificationError(e);return a.tracker.log({code:`7988`,msg:y,d1:`createError`,d2:n.code,d3:n.message,d4:`无`,d5:`npm`,m1:Date.now()-t,m2:0}),m?.(n),Promise.reject(e)})]})})}}function d(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return Promise.race([new Promise(function(e,n){setTimeout(function(){n(new o.LoaderError(`LOAD_TIMEOUT`,`Load timeout: ${t}`))},t)}),e.apply(void 0,n)])}}}))().createLoader)({sdkURL:{LOCAL:`http://localhost:7981/index.js`,DEV:`https://sdk-dev.marmot-cloud.com/package/worldfirst-js/dev-1778210535/dist/index.js`,PROD:`http://js-dev.worldfirst.com/v1/dist/index.js`}.DEV,globalName:`WorldFirstSDK`,namespace:`WorldFirstSDK`}),i=async e=>{let{env:t,...n}=e||{},i=t||`prod`;return r({...n,env:i})};exports.loadWorldFirst=i;
|
package/lib/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import type { WorldFirstLoadConfig, WorldFirstSDK } from "../types";
|
|
|
2
2
|
/**
|
|
3
3
|
* @description load WorldFirst instance
|
|
4
4
|
*/
|
|
5
|
-
export declare const loadWorldFirst: (config
|
|
5
|
+
export declare const loadWorldFirst: (config: WorldFirstLoadConfig) => Promise<WorldFirstSDK>;
|
package/lib/index.js
CHANGED
|
@@ -239,7 +239,7 @@ var e = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
239
239
|
performance: !1,
|
|
240
240
|
error: !1
|
|
241
241
|
});
|
|
242
|
-
})), r = (/* @__PURE__ */ e(((e) => {
|
|
242
|
+
})), r = (0, (/* @__PURE__ */ e(((e) => {
|
|
243
243
|
var r = e && e.__awaiter || function(e, t, n, r) {
|
|
244
244
|
function i(e) {
|
|
245
245
|
return e instanceof n ? e : new n(function(t) {
|
|
@@ -463,764 +463,20 @@ var e = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
463
463
|
}), e.apply(void 0, n)]);
|
|
464
464
|
};
|
|
465
465
|
}
|
|
466
|
-
})))()
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
let o = (n + i + a) % e, s = r[e], c = r[o];
|
|
473
|
-
r[o] = s, r[e] = c;
|
|
474
|
-
}
|
|
475
|
-
return r;
|
|
476
|
-
}
|
|
477
|
-
var u = (e, t) => {
|
|
478
|
-
let n = [], r = e;
|
|
479
|
-
if (typeof r == "bigint") {
|
|
480
|
-
let e = BigInt(t.length);
|
|
481
|
-
do
|
|
482
|
-
n.unshift(t[Number(r % e)]), r /= e;
|
|
483
|
-
while (r > BigInt(0));
|
|
484
|
-
} else do
|
|
485
|
-
n.unshift(t[r % t.length]), r = Math.floor(r / t.length);
|
|
486
|
-
while (r > 0);
|
|
487
|
-
return n;
|
|
488
|
-
}, d = (e, t) => e.reduce((n, r) => {
|
|
489
|
-
let i = t.indexOf(r);
|
|
490
|
-
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("")})`);
|
|
491
|
-
if (typeof n == "bigint") return n * BigInt(t.length) + BigInt(i);
|
|
492
|
-
let a = n * t.length + i;
|
|
493
|
-
return Number.isSafeInteger(a) ? a : (v("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));
|
|
494
|
-
}, 0), f = /^\+?\d+$/, p = (e) => {
|
|
495
|
-
if (!f.test(e)) return NaN;
|
|
496
|
-
let t = Number.parseInt(e, 10);
|
|
497
|
-
return Number.isSafeInteger(t) ? t : (v("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));
|
|
498
|
-
}, m = (e, t, n) => Array.from({ length: Math.ceil(e.length / t) }, (r, i) => n(e.slice(i * t, (i + 1) * t))), h = (e) => new RegExp(e.map((e) => _(e)).sort((e, t) => t.length - e.length).join("|")), g = (e) => RegExp(`^[${e.map((e) => _(e)).sort((e, t) => t.length - e.length).join("")}]+$`), _ = (e) => e.replace(/[\s#$()*+,.?[\\\]^{|}-]/g, "\\$&"), v = (e = "BigInt is not available in this environment") => {
|
|
499
|
-
if (typeof BigInt != "function") throw TypeError(e);
|
|
500
|
-
}, y = 16, b = 3.5, x = 12, S = 16, C = 12, w = 100;
|
|
501
|
-
new class {
|
|
502
|
-
constructor(e = "", t = 0, n = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", r = "cfhistuCFHISTU") {
|
|
503
|
-
if (this.minLength = t, typeof t != "number") throw TypeError(`Hashids: Provided 'minLength' has to be a number (is ${typeof t})`);
|
|
504
|
-
if (typeof e != "string") throw TypeError(`Hashids: Provided 'salt' has to be a string (is ${typeof e})`);
|
|
505
|
-
if (typeof n != "string") throw TypeError(`Hashids: Provided alphabet has to be a string (is ${typeof n})`);
|
|
506
|
-
let s = Array.from(e), c = Array.from(n), u = Array.from(r);
|
|
507
|
-
this.salt = s;
|
|
508
|
-
let d = i(c);
|
|
509
|
-
if (d.length < y) throw Error(`Hashids: alphabet must contain at least ${y} unique characters, provided: ${d.join("")}`);
|
|
510
|
-
this.alphabet = a(d, u);
|
|
511
|
-
let f = o(u, d);
|
|
512
|
-
this.seps = l(f, s);
|
|
513
|
-
let p, m;
|
|
514
|
-
(this.seps.length === 0 || this.alphabet.length / this.seps.length > b) && (p = Math.ceil(this.alphabet.length / b), p > this.seps.length && (m = p - this.seps.length, this.seps.push(...this.alphabet.slice(0, m)), this.alphabet = this.alphabet.slice(m))), this.alphabet = l(this.alphabet, s);
|
|
515
|
-
let _ = Math.ceil(this.alphabet.length / x);
|
|
516
|
-
this.alphabet.length < 3 ? (this.guards = this.seps.slice(0, _), this.seps = this.seps.slice(_)) : (this.guards = this.alphabet.slice(0, _), this.alphabet = this.alphabet.slice(_)), this.guardsRegExp = h(this.guards), this.sepsRegExp = h(this.seps), this.allowedCharsRegExp = g([
|
|
517
|
-
...this.alphabet,
|
|
518
|
-
...this.guards,
|
|
519
|
-
...this.seps
|
|
520
|
-
]);
|
|
521
|
-
}
|
|
522
|
-
encode(e, ...t) {
|
|
523
|
-
let n = Array.isArray(e) ? e : [...e == null ? [] : [e], ...t];
|
|
524
|
-
return n.length === 0 || (n.every(s) || (n = n.map((e) => typeof e == "bigint" || typeof e == "number" ? e : p(String(e)))), !n.every(c)) ? "" : this._encode(n).join("");
|
|
525
|
-
}
|
|
526
|
-
decode(e) {
|
|
527
|
-
return !e || typeof e != "string" || e.length === 0 ? [] : this._decode(e);
|
|
528
|
-
}
|
|
529
|
-
encodeHex(e) {
|
|
530
|
-
let t = e;
|
|
531
|
-
switch (typeof t) {
|
|
532
|
-
case "bigint":
|
|
533
|
-
t = t.toString(S);
|
|
534
|
-
break;
|
|
535
|
-
case "string":
|
|
536
|
-
if (!/^[\dA-Fa-f]+$/.test(t)) return "";
|
|
537
|
-
break;
|
|
538
|
-
default: throw Error(`Hashids: The provided value is neither a string, nor a BigInt (got: ${typeof t})`);
|
|
539
|
-
}
|
|
540
|
-
let n = m(t, C, (e) => Number.parseInt(`1${e}`, 16));
|
|
541
|
-
return this.encode(n);
|
|
542
|
-
}
|
|
543
|
-
decodeHex(e) {
|
|
544
|
-
return this.decode(e).map((e) => e.toString(S).slice(1)).join("");
|
|
545
|
-
}
|
|
546
|
-
isValidId(e) {
|
|
547
|
-
return this.allowedCharsRegExp.test(e);
|
|
548
|
-
}
|
|
549
|
-
_encode(e) {
|
|
550
|
-
let { alphabet: t } = this, n = e.reduce((e, t, n) => e + (typeof t == "bigint" ? Number(t % BigInt(n + w)) : t % (n + w)), 0), r = [t[n % t.length]], i = [...r], { seps: a } = this, { guards: o } = this;
|
|
551
|
-
if (e.forEach((n, o) => {
|
|
552
|
-
let s = i.concat(this.salt, t);
|
|
553
|
-
t = l(t, s);
|
|
554
|
-
let c = u(n, t);
|
|
555
|
-
if (r.push(...c), o + 1 < e.length) {
|
|
556
|
-
let e = c[0].codePointAt(0) + o, t = typeof n == "bigint" ? Number(n % BigInt(e)) : n % e;
|
|
557
|
-
r.push(a[t % a.length]);
|
|
558
|
-
}
|
|
559
|
-
}), r.length < this.minLength) {
|
|
560
|
-
let e = (n + r[0].codePointAt(0)) % o.length;
|
|
561
|
-
if (r.unshift(o[e]), r.length < this.minLength) {
|
|
562
|
-
let e = (n + r[2].codePointAt(0)) % o.length;
|
|
563
|
-
r.push(o[e]);
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
let s = Math.floor(t.length / 2);
|
|
567
|
-
for (; r.length < this.minLength;) {
|
|
568
|
-
t = l(t, t), r.unshift(...t.slice(s)), r.push(...t.slice(0, s));
|
|
569
|
-
let e = r.length - this.minLength;
|
|
570
|
-
if (e > 0) {
|
|
571
|
-
let t = e / 2;
|
|
572
|
-
r = r.slice(t, t + this.minLength);
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
return r;
|
|
576
|
-
}
|
|
577
|
-
_decode(e) {
|
|
578
|
-
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("")})`);
|
|
579
|
-
let t = e.split(this.guardsRegExp), n = t[+(t.length === 3 || t.length === 2)];
|
|
580
|
-
if (n.length === 0) return [];
|
|
581
|
-
let r = n[Symbol.iterator]().next().value, i = n.slice(r.length).split(this.sepsRegExp), a = this.alphabet, o = [];
|
|
582
|
-
for (let e of i) {
|
|
583
|
-
let t = [
|
|
584
|
-
r,
|
|
585
|
-
...this.salt,
|
|
586
|
-
...a
|
|
587
|
-
], n = l(a, t.slice(0, a.length));
|
|
588
|
-
o.push(d(Array.from(e), n)), a = n;
|
|
589
|
-
}
|
|
590
|
-
return this._encode(o).join("") === e ? o : [];
|
|
591
|
-
}
|
|
592
|
-
}("intl-open-sdk", 6);
|
|
593
|
-
//#endregion
|
|
594
|
-
//#region node_modules/@antintl/opensdk-bridge/lib/types.js
|
|
595
|
-
var T = {
|
|
596
|
-
HANDSHAKE: "OPENSDK@HANDSHAKE",
|
|
597
|
-
UPDATE_CONFIG: "OPENSDK@UPDATE_CONFIG",
|
|
598
|
-
SUBMIT: "OPENSDK@SUBMIT",
|
|
599
|
-
SUBMIT_REPLY: "OPENSDK@SUBMIT_REPLY",
|
|
600
|
-
REDIRECT: "OPENSDK@REDIRECT",
|
|
601
|
-
OPEN_MODAL: "OPENSDK@OPEN_MODAL",
|
|
602
|
-
OPEN_MODAL_ERROR: "OPENSDK@OPEN_MODAL_ERROR",
|
|
603
|
-
CLOSE_MODAL: "OPENSDK@CLOSE_MODAL",
|
|
604
|
-
ERROR: "OPENSDK@ERROR",
|
|
605
|
-
HANDSHAKE_ACK: "OPENSDK@HANDSHAKE_ACK",
|
|
606
|
-
TRANSFER_RECEIVE_PORT: "OPENSDK@TRANSFER_RECEIVE_PORT",
|
|
607
|
-
MESSAGE: "OPENSDK@MESSAGE",
|
|
608
|
-
TRANSFER_SEND_PORT: "OPENSDK@TRANSFER_SEND_PORT",
|
|
609
|
-
TRANSFER_APP_PORT: "OPENSDK@TRANSFER_APP_PORT",
|
|
610
|
-
TRANSFER_MODAL_PORT: "OPENSDK@TRANSFER_MODAL_PORT",
|
|
611
|
-
TRANSFER_MODAL_APPEARANCE: "OPENSDK@TRANSFER_MODAL_APPEARANCE",
|
|
612
|
-
HEIGHT_UPDATE: "OPENSDK@HEIGHT_UPDATE"
|
|
613
|
-
};
|
|
614
|
-
(/* @__PURE__ */ e(((e, t) => {
|
|
615
|
-
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, h = Math.min, g = function() {
|
|
616
|
-
return f.Date.now();
|
|
617
|
-
};
|
|
618
|
-
function _(e, t, r) {
|
|
619
|
-
var i, a, o, s, c, l, u = 0, d = !1, f = !1, p = !0;
|
|
620
|
-
if (typeof e != "function") throw TypeError(n);
|
|
621
|
-
t = x(t) || 0, v(r) && (d = !!r.leading, f = "maxWait" in r, o = f ? m(x(r.maxWait) || 0, t) : o, p = "trailing" in r ? !!r.trailing : p);
|
|
622
|
-
function _(t) {
|
|
623
|
-
var n = i, r = a;
|
|
624
|
-
return i = a = void 0, u = t, s = e.apply(r, n), s;
|
|
625
|
-
}
|
|
626
|
-
function y(e) {
|
|
627
|
-
return u = e, c = setTimeout(C, t), d ? _(e) : s;
|
|
628
|
-
}
|
|
629
|
-
function b(e) {
|
|
630
|
-
var n = e - l, r = e - u, i = t - n;
|
|
631
|
-
return f ? h(i, o - r) : i;
|
|
632
|
-
}
|
|
633
|
-
function S(e) {
|
|
634
|
-
var n = e - l, r = e - u;
|
|
635
|
-
return l === void 0 || n >= t || n < 0 || f && r >= o;
|
|
636
|
-
}
|
|
637
|
-
function C() {
|
|
638
|
-
var e = g();
|
|
639
|
-
if (S(e)) return w(e);
|
|
640
|
-
c = setTimeout(C, b(e));
|
|
641
|
-
}
|
|
642
|
-
function w(e) {
|
|
643
|
-
return c = void 0, p && i ? _(e) : (i = a = void 0, s);
|
|
644
|
-
}
|
|
645
|
-
function T() {
|
|
646
|
-
c !== void 0 && clearTimeout(c), u = 0, i = l = a = c = void 0;
|
|
647
|
-
}
|
|
648
|
-
function ee() {
|
|
649
|
-
return c === void 0 ? s : w(g());
|
|
650
|
-
}
|
|
651
|
-
function E() {
|
|
652
|
-
var e = g(), n = S(e);
|
|
653
|
-
if (i = arguments, a = this, l = e, n) {
|
|
654
|
-
if (c === void 0) return y(l);
|
|
655
|
-
if (f) return c = setTimeout(C, t), _(l);
|
|
656
|
-
}
|
|
657
|
-
return c === void 0 && (c = setTimeout(C, t)), s;
|
|
658
|
-
}
|
|
659
|
-
return E.cancel = T, E.flush = ee, E;
|
|
660
|
-
}
|
|
661
|
-
function v(e) {
|
|
662
|
-
var t = typeof e;
|
|
663
|
-
return !!e && (t == "object" || t == "function");
|
|
664
|
-
}
|
|
665
|
-
function y(e) {
|
|
666
|
-
return !!e && typeof e == "object";
|
|
667
|
-
}
|
|
668
|
-
function b(e) {
|
|
669
|
-
return typeof e == "symbol" || y(e) && p.call(e) == i;
|
|
670
|
-
}
|
|
671
|
-
function x(e) {
|
|
672
|
-
if (typeof e == "number") return e;
|
|
673
|
-
if (b(e)) return r;
|
|
674
|
-
if (v(e)) {
|
|
675
|
-
var t = typeof e.valueOf == "function" ? e.valueOf() : e;
|
|
676
|
-
e = v(t) ? t + "" : t;
|
|
677
|
-
}
|
|
678
|
-
if (typeof e != "string") return e === 0 ? e : +e;
|
|
679
|
-
e = e.replace(a, "");
|
|
680
|
-
var n = s.test(e);
|
|
681
|
-
return n || c.test(e) ? l(e.slice(2), n ? 2 : 8) : o.test(e) ? r : +e;
|
|
682
|
-
}
|
|
683
|
-
t.exports = _;
|
|
684
|
-
})))(), T.TRANSFER_RECEIVE_PORT, T.TRANSFER_SEND_PORT, T.TRANSFER_MODAL_PORT, T.TRANSFER_MODAL_APPEARANCE, T.OPEN_MODAL_ERROR, T.TRANSFER_APP_PORT, T.CLOSE_MODAL, T.OPEN_MODAL, T.REDIRECT, T.MESSAGE;
|
|
685
|
-
//#endregion
|
|
686
|
-
//#region node_modules/@antintl/opensdk-bridge/lib/OpenSDKTracker.js
|
|
687
|
-
var ee = "https://cdn.marmot-cloud.com/tnpm-package/@antintl-opensdk-debugger/1.0.1/dist/tracker.umd.js", E = class {
|
|
688
|
-
options;
|
|
689
|
-
tracker;
|
|
690
|
-
trackId;
|
|
691
|
-
constructor(e) {
|
|
692
|
-
this.initialOptions(e);
|
|
693
|
-
}
|
|
694
|
-
initialOptions(e) {
|
|
695
|
-
return this.options = {
|
|
696
|
-
...this.options,
|
|
697
|
-
...e,
|
|
698
|
-
appId: e?.appId || this.options?.appId || "180020050100012557",
|
|
699
|
-
performance: e?.performance === !0 || this.options?.performance === !0,
|
|
700
|
-
error: e?.error === !0 || this.options?.error === !0
|
|
701
|
-
}, "trackId" in this.options && (this.trackId = this.options.trackId), this.options;
|
|
702
|
-
}
|
|
703
|
-
loadTacker(e) {
|
|
704
|
-
let t = (0, r.loadScript)(ee, "intlSdkTracker");
|
|
705
|
-
return t ? t.then((t) => t.variable?.getTrackerInstance(this.initialOptions(e))) : Promise.resolve(void 0);
|
|
706
|
-
}
|
|
707
|
-
async initTracker(e) {
|
|
708
|
-
if (this.tracker && !e) return this.tracker;
|
|
709
|
-
let t = await this.loadTacker(e);
|
|
710
|
-
return t && (this.tracker = t), t;
|
|
711
|
-
}
|
|
712
|
-
safeCall(e) {
|
|
713
|
-
return this.initTracker().then(e);
|
|
714
|
-
}
|
|
715
|
-
setTrackId(e) {
|
|
716
|
-
this.trackId = e, this.set({ trackId: e });
|
|
717
|
-
}
|
|
718
|
-
set(e) {
|
|
719
|
-
this.safeCall((t) => t?.set(e));
|
|
720
|
-
}
|
|
721
|
-
pv() {
|
|
722
|
-
this.safeCall((e) => e?.pv());
|
|
723
|
-
}
|
|
724
|
-
log(...e) {
|
|
725
|
-
this.trackId && (e[0].d18 = this.trackId), this.safeCall((t) => t?.log(...e));
|
|
726
|
-
}
|
|
727
|
-
click(...e) {
|
|
728
|
-
this.safeCall((t) => t?.click(...e));
|
|
729
|
-
}
|
|
730
|
-
expo(...e) {
|
|
731
|
-
this.safeCall((t) => t?.expo(...e));
|
|
732
|
-
}
|
|
733
|
-
onSendData(...e) {
|
|
734
|
-
this.safeCall((t) => t?.onSendData(...e));
|
|
735
|
-
}
|
|
736
|
-
offSendData(...e) {
|
|
737
|
-
this.safeCall((t) => t?.offSendData(...e));
|
|
738
|
-
}
|
|
739
|
-
pageMonitor(...e) {
|
|
740
|
-
this.safeCall((t) => t?.pageMonitor(...e));
|
|
741
|
-
}
|
|
742
|
-
reportCustomizedPerformance(...e) {
|
|
743
|
-
this.safeCall((t) => t?.reportCustomizedPerformance(...e));
|
|
744
|
-
}
|
|
745
|
-
};
|
|
746
|
-
new E(), (/* @__PURE__ */ e(((e, t) => {
|
|
747
|
-
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]", h = "[object Map]", g = "[object Number]", _ = "[object Null]", v = "[object Object]", y = "[object Proxy]", b = "[object RegExp]", x = "[object Set]", S = "[object String]", C = "[object Undefined]", w = "[object WeakMap]", T = "[object ArrayBuffer]", ee = "[object DataView]", E = "[object Float32Array]", te = "[object Float64Array]", ne = "[object Int8Array]", D = "[object Int16Array]", re = "[object Int32Array]", ie = "[object Uint8Array]", ae = "[object Uint8ClampedArray]", O = "[object Uint16Array]", oe = "[object Uint32Array]", se = /[\\^$.*+?()[\]{}|]/g, ce = /^\[object .+?Constructor\]$/, le = /^(?:0|[1-9]\d*)$/, k = {};
|
|
748
|
-
k[E] = k[te] = k[ne] = k[D] = k[re] = k[ie] = k[ae] = k[O] = k[oe] = !0, k[s] = k[c] = k[T] = k[u] = k[ee] = k[d] = k[f] = k[p] = k[h] = k[g] = k[v] = k[b] = k[x] = k[S] = k[w] = !1;
|
|
749
|
-
var ue = typeof global == "object" && global && global.Object === Object && global, de = typeof self == "object" && self && self.Object === Object && self, A = ue || de || Function("return this")(), fe = typeof e == "object" && e && !e.nodeType && e, j = fe && typeof t == "object" && t && !t.nodeType && t, pe = j && j.exports === fe, M = pe && ue.process, me = function() {
|
|
750
|
-
try {
|
|
751
|
-
return j && j.require && j.require("util").types || M && M.binding && M.binding("util");
|
|
752
|
-
} catch {}
|
|
753
|
-
}(), he = me && me.isTypedArray;
|
|
754
|
-
function ge(e, t, n) {
|
|
755
|
-
switch (n.length) {
|
|
756
|
-
case 0: return e.call(t);
|
|
757
|
-
case 1: return e.call(t, n[0]);
|
|
758
|
-
case 2: return e.call(t, n[0], n[1]);
|
|
759
|
-
case 3: return e.call(t, n[0], n[1], n[2]);
|
|
760
|
-
}
|
|
761
|
-
return e.apply(t, n);
|
|
762
|
-
}
|
|
763
|
-
function _e(e, t) {
|
|
764
|
-
for (var n = -1, r = Array(e); ++n < e;) r[n] = t(n);
|
|
765
|
-
return r;
|
|
766
|
-
}
|
|
767
|
-
function ve(e) {
|
|
768
|
-
return function(t) {
|
|
769
|
-
return e(t);
|
|
770
|
-
};
|
|
771
|
-
}
|
|
772
|
-
function ye(e, t) {
|
|
773
|
-
return e?.[t];
|
|
774
|
-
}
|
|
775
|
-
function be(e, t) {
|
|
776
|
-
return function(n) {
|
|
777
|
-
return e(t(n));
|
|
778
|
-
};
|
|
779
|
-
}
|
|
780
|
-
var xe = Array.prototype, Se = Function.prototype, N = Object.prototype, P = A["__core-js_shared__"], F = Se.toString, I = N.hasOwnProperty, Ce = function() {
|
|
781
|
-
var e = /[^.]+$/.exec(P && P.keys && P.keys.IE_PROTO || "");
|
|
782
|
-
return e ? "Symbol(src)_1." + e : "";
|
|
783
|
-
}(), we = N.toString, Te = F.call(Object), Ee = RegExp("^" + F.call(I).replace(se, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"), L = pe ? A.Buffer : void 0, De = A.Symbol, Oe = A.Uint8Array, ke = L ? L.allocUnsafe : void 0, Ae = be(Object.getPrototypeOf, Object), je = Object.create, Me = N.propertyIsEnumerable, Ne = xe.splice, R = De ? De.toStringTag : void 0, z = function() {
|
|
784
|
-
try {
|
|
785
|
-
var e = X(Object, "defineProperty");
|
|
786
|
-
return e({}, "", {}), e;
|
|
787
|
-
} catch {}
|
|
788
|
-
}(), Pe = L ? L.isBuffer : void 0, Fe = Math.max, Ie = Date.now, Le = X(A, "Map"), B = X(Object, "create"), Re = function() {
|
|
789
|
-
function e() {}
|
|
790
|
-
return function(t) {
|
|
791
|
-
if (!Q(t)) return {};
|
|
792
|
-
if (je) return je(t);
|
|
793
|
-
e.prototype = t;
|
|
794
|
-
var n = new e();
|
|
795
|
-
return e.prototype = void 0, n;
|
|
796
|
-
};
|
|
797
|
-
}();
|
|
798
|
-
function V(e) {
|
|
799
|
-
var t = -1, n = e == null ? 0 : e.length;
|
|
800
|
-
for (this.clear(); ++t < n;) {
|
|
801
|
-
var r = e[t];
|
|
802
|
-
this.set(r[0], r[1]);
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
function ze() {
|
|
806
|
-
this.__data__ = B ? B(null) : {}, this.size = 0;
|
|
807
|
-
}
|
|
808
|
-
function Be(e) {
|
|
809
|
-
var t = this.has(e) && delete this.__data__[e];
|
|
810
|
-
return this.size -= +!!t, t;
|
|
811
|
-
}
|
|
812
|
-
function Ve(e) {
|
|
813
|
-
var t = this.__data__;
|
|
814
|
-
if (B) {
|
|
815
|
-
var n = t[e];
|
|
816
|
-
return n === r ? void 0 : n;
|
|
817
|
-
}
|
|
818
|
-
return I.call(t, e) ? t[e] : void 0;
|
|
819
|
-
}
|
|
820
|
-
function He(e) {
|
|
821
|
-
var t = this.__data__;
|
|
822
|
-
return B ? t[e] !== void 0 : I.call(t, e);
|
|
823
|
-
}
|
|
824
|
-
function Ue(e, t) {
|
|
825
|
-
var n = this.__data__;
|
|
826
|
-
return this.size += +!this.has(e), n[e] = B && t === void 0 ? r : t, this;
|
|
827
|
-
}
|
|
828
|
-
V.prototype.clear = ze, V.prototype.delete = Be, V.prototype.get = Ve, V.prototype.has = He, V.prototype.set = Ue;
|
|
829
|
-
function H(e) {
|
|
830
|
-
var t = -1, n = e == null ? 0 : e.length;
|
|
831
|
-
for (this.clear(); ++t < n;) {
|
|
832
|
-
var r = e[t];
|
|
833
|
-
this.set(r[0], r[1]);
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
function We() {
|
|
837
|
-
this.__data__ = [], this.size = 0;
|
|
838
|
-
}
|
|
839
|
-
function Ge(e) {
|
|
840
|
-
var t = this.__data__, n = K(t, e);
|
|
841
|
-
return n < 0 ? !1 : (n == t.length - 1 ? t.pop() : Ne.call(t, n, 1), --this.size, !0);
|
|
842
|
-
}
|
|
843
|
-
function Ke(e) {
|
|
844
|
-
var t = this.__data__, n = K(t, e);
|
|
845
|
-
return n < 0 ? void 0 : t[n][1];
|
|
846
|
-
}
|
|
847
|
-
function qe(e) {
|
|
848
|
-
return K(this.__data__, e) > -1;
|
|
849
|
-
}
|
|
850
|
-
function Je(e, t) {
|
|
851
|
-
var n = this.__data__, r = K(n, e);
|
|
852
|
-
return r < 0 ? (++this.size, n.push([e, t])) : n[r][1] = t, this;
|
|
853
|
-
}
|
|
854
|
-
H.prototype.clear = We, H.prototype.delete = Ge, H.prototype.get = Ke, H.prototype.has = qe, H.prototype.set = Je;
|
|
855
|
-
function U(e) {
|
|
856
|
-
var t = -1, n = e == null ? 0 : e.length;
|
|
857
|
-
for (this.clear(); ++t < n;) {
|
|
858
|
-
var r = e[t];
|
|
859
|
-
this.set(r[0], r[1]);
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
function Ye() {
|
|
863
|
-
this.size = 0, this.__data__ = {
|
|
864
|
-
hash: new V(),
|
|
865
|
-
map: new (Le || H)(),
|
|
866
|
-
string: new V()
|
|
867
|
-
};
|
|
868
|
-
}
|
|
869
|
-
function Xe(e) {
|
|
870
|
-
var t = Y(this, e).delete(e);
|
|
871
|
-
return this.size -= +!!t, t;
|
|
872
|
-
}
|
|
873
|
-
function Ze(e) {
|
|
874
|
-
return Y(this, e).get(e);
|
|
875
|
-
}
|
|
876
|
-
function Qe(e) {
|
|
877
|
-
return Y(this, e).has(e);
|
|
878
|
-
}
|
|
879
|
-
function $e(e, t) {
|
|
880
|
-
var n = Y(this, e), r = n.size;
|
|
881
|
-
return n.set(e, t), this.size += n.size == r ? 0 : 1, this;
|
|
882
|
-
}
|
|
883
|
-
U.prototype.clear = Ye, U.prototype.delete = Xe, U.prototype.get = Ze, U.prototype.has = Qe, U.prototype.set = $e;
|
|
884
|
-
function W(e) {
|
|
885
|
-
var t = this.__data__ = new H(e);
|
|
886
|
-
this.size = t.size;
|
|
887
|
-
}
|
|
888
|
-
function et() {
|
|
889
|
-
this.__data__ = new H(), this.size = 0;
|
|
890
|
-
}
|
|
891
|
-
function tt(e) {
|
|
892
|
-
var t = this.__data__, n = t.delete(e);
|
|
893
|
-
return this.size = t.size, n;
|
|
894
|
-
}
|
|
895
|
-
function nt(e) {
|
|
896
|
-
return this.__data__.get(e);
|
|
897
|
-
}
|
|
898
|
-
function rt(e) {
|
|
899
|
-
return this.__data__.has(e);
|
|
900
|
-
}
|
|
901
|
-
function it(e, t) {
|
|
902
|
-
var r = this.__data__;
|
|
903
|
-
if (r instanceof H) {
|
|
904
|
-
var i = r.__data__;
|
|
905
|
-
if (!Le || i.length < n - 1) return i.push([e, t]), this.size = ++r.size, this;
|
|
906
|
-
r = this.__data__ = new U(i);
|
|
907
|
-
}
|
|
908
|
-
return r.set(e, t), this.size = r.size, this;
|
|
909
|
-
}
|
|
910
|
-
W.prototype.clear = et, W.prototype.delete = tt, W.prototype.get = nt, W.prototype.has = rt, W.prototype.set = it;
|
|
911
|
-
function at(e, t) {
|
|
912
|
-
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 ? _e(e.length, String) : [], c = s.length;
|
|
913
|
-
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") || Tt(l, c))) && s.push(l);
|
|
914
|
-
return s;
|
|
915
|
-
}
|
|
916
|
-
function G(e, t, n) {
|
|
917
|
-
(n !== void 0 && !Z(e[t], n) || n === void 0 && !(t in e)) && q(e, t, n);
|
|
918
|
-
}
|
|
919
|
-
function ot(e, t, n) {
|
|
920
|
-
var r = e[t];
|
|
921
|
-
(!(I.call(e, t) && Z(r, n)) || n === void 0 && !(t in e)) && q(e, t, n);
|
|
922
|
-
}
|
|
923
|
-
function K(e, t) {
|
|
924
|
-
for (var n = e.length; n--;) if (Z(e[n][0], t)) return n;
|
|
925
|
-
return -1;
|
|
926
|
-
}
|
|
927
|
-
function q(e, t, n) {
|
|
928
|
-
t == "__proto__" && z ? z(e, t, {
|
|
929
|
-
configurable: !0,
|
|
930
|
-
enumerable: !0,
|
|
931
|
-
value: n,
|
|
932
|
-
writable: !0
|
|
933
|
-
}) : e[t] = n;
|
|
934
|
-
}
|
|
935
|
-
var st = St();
|
|
936
|
-
function J(e) {
|
|
937
|
-
return e == null ? e === void 0 ? C : _ : R && R in Object(e) ? Ct(e) : jt(e);
|
|
938
|
-
}
|
|
939
|
-
function ct(e) {
|
|
940
|
-
return $(e) && J(e) == s;
|
|
941
|
-
}
|
|
942
|
-
function lt(e) {
|
|
943
|
-
return !Q(e) || Ot(e) ? !1 : (Ht(e) ? Ee : ce).test(It(e));
|
|
944
|
-
}
|
|
945
|
-
function ut(e) {
|
|
946
|
-
return $(e) && Ut(e.length) && !!k[J(e)];
|
|
947
|
-
}
|
|
948
|
-
function dt(e) {
|
|
949
|
-
if (!Q(e)) return At(e);
|
|
950
|
-
var t = kt(e), n = [];
|
|
951
|
-
for (var r in e) r == "constructor" && (t || !I.call(e, r)) || n.push(r);
|
|
952
|
-
return n;
|
|
953
|
-
}
|
|
954
|
-
function ft(e, t, n, r, i) {
|
|
955
|
-
e !== t && st(t, function(a, o) {
|
|
956
|
-
if (i ||= new W(), Q(a)) pt(e, t, o, n, ft, r, i);
|
|
957
|
-
else {
|
|
958
|
-
var s = r ? r(Nt(e, o), a, o + "", e, t, i) : void 0;
|
|
959
|
-
s === void 0 && (s = a), G(e, o, s);
|
|
960
|
-
}
|
|
961
|
-
}, qt);
|
|
962
|
-
}
|
|
963
|
-
function pt(e, t, n, r, i, a, o) {
|
|
964
|
-
var s = Nt(e, n), c = Nt(t, n), l = o.get(c);
|
|
965
|
-
if (l) {
|
|
966
|
-
G(e, n, l);
|
|
967
|
-
return;
|
|
968
|
-
}
|
|
969
|
-
var u = a ? a(s, c, n + "", e, t, o) : void 0, d = u === void 0;
|
|
970
|
-
if (d) {
|
|
971
|
-
var f = Rt(c), p = !f && Vt(c), m = !f && !p && Gt(c);
|
|
972
|
-
u = c, f || p || m ? Rt(s) ? u = s : Bt(s) ? u = yt(s) : p ? (d = !1, u = gt(c, !0)) : m ? (d = !1, u = vt(c, !0)) : u = [] : Wt(c) || Lt(c) ? (u = s, Lt(s) ? u = Kt(s) : (!Q(s) || Ht(s)) && (u = wt(c))) : d = !1;
|
|
973
|
-
}
|
|
974
|
-
d && (o.set(c, u), i(u, c, r, a, o), o.delete(c)), G(e, n, u);
|
|
975
|
-
}
|
|
976
|
-
function mt(e, t) {
|
|
977
|
-
return Pt(Mt(e, t, Xt), e + "");
|
|
978
|
-
}
|
|
979
|
-
var ht = z ? function(e, t) {
|
|
980
|
-
return z(e, "toString", {
|
|
981
|
-
configurable: !0,
|
|
982
|
-
enumerable: !1,
|
|
983
|
-
value: Yt(t),
|
|
984
|
-
writable: !0
|
|
985
|
-
});
|
|
986
|
-
} : Xt;
|
|
987
|
-
function gt(e, t) {
|
|
988
|
-
if (t) return e.slice();
|
|
989
|
-
var n = e.length, r = ke ? ke(n) : new e.constructor(n);
|
|
990
|
-
return e.copy(r), r;
|
|
991
|
-
}
|
|
992
|
-
function _t(e) {
|
|
993
|
-
var t = new e.constructor(e.byteLength);
|
|
994
|
-
return new Oe(t).set(new Oe(e)), t;
|
|
995
|
-
}
|
|
996
|
-
function vt(e, t) {
|
|
997
|
-
var n = t ? _t(e.buffer) : e.buffer;
|
|
998
|
-
return new e.constructor(n, e.byteOffset, e.length);
|
|
999
|
-
}
|
|
1000
|
-
function yt(e, t) {
|
|
1001
|
-
var n = -1, r = e.length;
|
|
1002
|
-
for (t ||= Array(r); ++n < r;) t[n] = e[n];
|
|
1003
|
-
return t;
|
|
1004
|
-
}
|
|
1005
|
-
function bt(e, t, n, r) {
|
|
1006
|
-
var i = !n;
|
|
1007
|
-
n ||= {};
|
|
1008
|
-
for (var a = -1, o = t.length; ++a < o;) {
|
|
1009
|
-
var s = t[a], c = r ? r(n[s], e[s], s, n, e) : void 0;
|
|
1010
|
-
c === void 0 && (c = e[s]), i ? q(n, s, c) : ot(n, s, c);
|
|
1011
|
-
}
|
|
1012
|
-
return n;
|
|
1013
|
-
}
|
|
1014
|
-
function xt(e) {
|
|
1015
|
-
return mt(function(t, n) {
|
|
1016
|
-
var r = -1, i = n.length, a = i > 1 ? n[i - 1] : void 0, o = i > 2 ? n[2] : void 0;
|
|
1017
|
-
for (a = e.length > 3 && typeof a == "function" ? (i--, a) : void 0, o && Et(n[0], n[1], o) && (a = i < 3 ? void 0 : a, i = 1), t = Object(t); ++r < i;) {
|
|
1018
|
-
var s = n[r];
|
|
1019
|
-
s && e(t, s, r, a);
|
|
1020
|
-
}
|
|
1021
|
-
return t;
|
|
1022
|
-
});
|
|
1023
|
-
}
|
|
1024
|
-
function St(e) {
|
|
1025
|
-
return function(t, n, r) {
|
|
1026
|
-
for (var i = -1, a = Object(t), o = r(t), s = o.length; s--;) {
|
|
1027
|
-
var c = o[e ? s : ++i];
|
|
1028
|
-
if (n(a[c], c, a) === !1) break;
|
|
1029
|
-
}
|
|
1030
|
-
return t;
|
|
1031
|
-
};
|
|
1032
|
-
}
|
|
1033
|
-
function Y(e, t) {
|
|
1034
|
-
var n = e.__data__;
|
|
1035
|
-
return Dt(t) ? n[typeof t == "string" ? "string" : "hash"] : n.map;
|
|
1036
|
-
}
|
|
1037
|
-
function X(e, t) {
|
|
1038
|
-
var n = ye(e, t);
|
|
1039
|
-
return lt(n) ? n : void 0;
|
|
1040
|
-
}
|
|
1041
|
-
function Ct(e) {
|
|
1042
|
-
var t = I.call(e, R), n = e[R];
|
|
1043
|
-
try {
|
|
1044
|
-
e[R] = void 0;
|
|
1045
|
-
var r = !0;
|
|
1046
|
-
} catch {}
|
|
1047
|
-
var i = we.call(e);
|
|
1048
|
-
return r && (t ? e[R] = n : delete e[R]), i;
|
|
1049
|
-
}
|
|
1050
|
-
function wt(e) {
|
|
1051
|
-
return typeof e.constructor == "function" && !kt(e) ? Re(Ae(e)) : {};
|
|
1052
|
-
}
|
|
1053
|
-
function Tt(e, t) {
|
|
1054
|
-
var n = typeof e;
|
|
1055
|
-
return t ??= o, !!t && (n == "number" || n != "symbol" && le.test(e)) && e > -1 && e % 1 == 0 && e < t;
|
|
1056
|
-
}
|
|
1057
|
-
function Et(e, t, n) {
|
|
1058
|
-
if (!Q(n)) return !1;
|
|
1059
|
-
var r = typeof t;
|
|
1060
|
-
return (r == "number" ? zt(n) && Tt(t, n.length) : r == "string" && t in n) ? Z(n[t], e) : !1;
|
|
1061
|
-
}
|
|
1062
|
-
function Dt(e) {
|
|
1063
|
-
var t = typeof e;
|
|
1064
|
-
return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
|
|
1065
|
-
}
|
|
1066
|
-
function Ot(e) {
|
|
1067
|
-
return !!Ce && Ce in e;
|
|
1068
|
-
}
|
|
1069
|
-
function kt(e) {
|
|
1070
|
-
var t = e && e.constructor;
|
|
1071
|
-
return e === (typeof t == "function" && t.prototype || N);
|
|
1072
|
-
}
|
|
1073
|
-
function At(e) {
|
|
1074
|
-
var t = [];
|
|
1075
|
-
if (e != null) for (var n in Object(e)) t.push(n);
|
|
1076
|
-
return t;
|
|
1077
|
-
}
|
|
1078
|
-
function jt(e) {
|
|
1079
|
-
return we.call(e);
|
|
1080
|
-
}
|
|
1081
|
-
function Mt(e, t, n) {
|
|
1082
|
-
return t = Fe(t === void 0 ? e.length - 1 : t, 0), function() {
|
|
1083
|
-
for (var r = arguments, i = -1, a = Fe(r.length - t, 0), o = Array(a); ++i < a;) o[i] = r[t + i];
|
|
1084
|
-
i = -1;
|
|
1085
|
-
for (var s = Array(t + 1); ++i < t;) s[i] = r[i];
|
|
1086
|
-
return s[t] = n(o), ge(e, this, s);
|
|
1087
|
-
};
|
|
1088
|
-
}
|
|
1089
|
-
function Nt(e, t) {
|
|
1090
|
-
if (!(t === "constructor" && typeof e[t] == "function") && t != "__proto__") return e[t];
|
|
1091
|
-
}
|
|
1092
|
-
var Pt = Ft(ht);
|
|
1093
|
-
function Ft(e) {
|
|
1094
|
-
var t = 0, n = 0;
|
|
1095
|
-
return function() {
|
|
1096
|
-
var r = Ie(), o = a - (r - n);
|
|
1097
|
-
if (n = r, o > 0) {
|
|
1098
|
-
if (++t >= i) return arguments[0];
|
|
1099
|
-
} else t = 0;
|
|
1100
|
-
return e.apply(void 0, arguments);
|
|
1101
|
-
};
|
|
1102
|
-
}
|
|
1103
|
-
function It(e) {
|
|
1104
|
-
if (e != null) {
|
|
1105
|
-
try {
|
|
1106
|
-
return F.call(e);
|
|
1107
|
-
} catch {}
|
|
1108
|
-
try {
|
|
1109
|
-
return e + "";
|
|
1110
|
-
} catch {}
|
|
1111
|
-
}
|
|
1112
|
-
return "";
|
|
1113
|
-
}
|
|
1114
|
-
function Z(e, t) {
|
|
1115
|
-
return e === t || e !== e && t !== t;
|
|
1116
|
-
}
|
|
1117
|
-
var Lt = ct(function() {
|
|
1118
|
-
return arguments;
|
|
1119
|
-
}()) ? ct : function(e) {
|
|
1120
|
-
return $(e) && I.call(e, "callee") && !Me.call(e, "callee");
|
|
1121
|
-
}, Rt = Array.isArray;
|
|
1122
|
-
function zt(e) {
|
|
1123
|
-
return e != null && Ut(e.length) && !Ht(e);
|
|
1124
|
-
}
|
|
1125
|
-
function Bt(e) {
|
|
1126
|
-
return $(e) && zt(e);
|
|
1127
|
-
}
|
|
1128
|
-
var Vt = Pe || Zt;
|
|
1129
|
-
function Ht(e) {
|
|
1130
|
-
if (!Q(e)) return !1;
|
|
1131
|
-
var t = J(e);
|
|
1132
|
-
return t == p || t == m || t == l || t == y;
|
|
1133
|
-
}
|
|
1134
|
-
function Ut(e) {
|
|
1135
|
-
return typeof e == "number" && e > -1 && e % 1 == 0 && e <= o;
|
|
1136
|
-
}
|
|
1137
|
-
function Q(e) {
|
|
1138
|
-
var t = typeof e;
|
|
1139
|
-
return e != null && (t == "object" || t == "function");
|
|
1140
|
-
}
|
|
1141
|
-
function $(e) {
|
|
1142
|
-
return typeof e == "object" && !!e;
|
|
1143
|
-
}
|
|
1144
|
-
function Wt(e) {
|
|
1145
|
-
if (!$(e) || J(e) != v) return !1;
|
|
1146
|
-
var t = Ae(e);
|
|
1147
|
-
if (t === null) return !0;
|
|
1148
|
-
var n = I.call(t, "constructor") && t.constructor;
|
|
1149
|
-
return typeof n == "function" && n instanceof n && F.call(n) == Te;
|
|
1150
|
-
}
|
|
1151
|
-
var Gt = he ? ve(he) : ut;
|
|
1152
|
-
function Kt(e) {
|
|
1153
|
-
return bt(e, qt(e));
|
|
1154
|
-
}
|
|
1155
|
-
function qt(e) {
|
|
1156
|
-
return zt(e) ? at(e, !0) : dt(e);
|
|
1157
|
-
}
|
|
1158
|
-
var Jt = xt(function(e, t, n) {
|
|
1159
|
-
ft(e, t, n);
|
|
1160
|
-
});
|
|
1161
|
-
function Yt(e) {
|
|
1162
|
-
return function() {
|
|
1163
|
-
return e;
|
|
1164
|
-
};
|
|
1165
|
-
}
|
|
1166
|
-
function Xt(e) {
|
|
1167
|
-
return e;
|
|
1168
|
-
}
|
|
1169
|
-
function Zt() {
|
|
1170
|
-
return !1;
|
|
1171
|
-
}
|
|
1172
|
-
t.exports = Jt;
|
|
1173
|
-
})))();
|
|
1174
|
-
//#endregion
|
|
1175
|
-
//#region node_modules/@antintl/opensdk-core/lib/toolset/internalTracker.js
|
|
1176
|
-
var te = new E({
|
|
1177
|
-
appId: "180020050100012557",
|
|
1178
|
-
performance: !1,
|
|
1179
|
-
error: !1
|
|
1180
|
-
}), ne = "7981", D = (e = "") => (t) => {
|
|
1181
|
-
te.log({
|
|
1182
|
-
code: `${ne}${e}`,
|
|
1183
|
-
...t
|
|
1184
|
-
});
|
|
1185
|
-
}, re = D(), ie = D("event"), ae = (e, t, n, r) => {
|
|
1186
|
-
if (e === "ERROR") {
|
|
1187
|
-
let e = r || {};
|
|
1188
|
-
re({
|
|
1189
|
-
msg: e.code || n,
|
|
1190
|
-
d1: t,
|
|
1191
|
-
d2: e.reason,
|
|
1192
|
-
d3: e.stack,
|
|
1193
|
-
d4: e.traceId,
|
|
1194
|
-
d5: e.operationType,
|
|
1195
|
-
d6: n
|
|
1196
|
-
});
|
|
1197
|
-
} else if (n.includes(":HOST:") || n.includes(":WEBAPP:")) {
|
|
1198
|
-
let [i, a, o] = n.split(":");
|
|
1199
|
-
ie({
|
|
1200
|
-
msg: o,
|
|
1201
|
-
d1: t,
|
|
1202
|
-
d2: i,
|
|
1203
|
-
d3: a,
|
|
1204
|
-
d4: JSON.stringify(r),
|
|
1205
|
-
d5: "无",
|
|
1206
|
-
d6: e
|
|
1207
|
-
});
|
|
1208
|
-
}
|
|
1209
|
-
window.sdkDebugger?.log(e, t, n, r);
|
|
1210
|
-
}, O = {
|
|
1211
|
-
DEV: "https://sdk-dev.marmot-cloud.com/package/worldfirst-js/dev-1778210535/dist/index.js",
|
|
1212
|
-
LOCAL: "http://localhost:7981/index.js",
|
|
1213
|
-
PROD: "http://js-dev.worldfirst.com/v1/dist/index.js"
|
|
1214
|
-
}, oe = (0, r.createLoader)({
|
|
1215
|
-
sdkURL: O.DEV,
|
|
466
|
+
})))().createLoader)({
|
|
467
|
+
sdkURL: {
|
|
468
|
+
LOCAL: "http://localhost:7981/index.js",
|
|
469
|
+
DEV: "https://sdk-dev.marmot-cloud.com/package/worldfirst-js/dev-1778210535/dist/index.js",
|
|
470
|
+
PROD: "http://js-dev.worldfirst.com/v1/dist/index.js"
|
|
471
|
+
}.DEV,
|
|
1216
472
|
globalName: "WorldFirstSDK",
|
|
1217
473
|
namespace: "WorldFirstSDK"
|
|
1218
|
-
}),
|
|
1219
|
-
let { env: t, ...n } = e || {},
|
|
1220
|
-
return
|
|
474
|
+
}), i = async (e) => {
|
|
475
|
+
let { env: t, ...n } = e || {}, i = t || "prod";
|
|
476
|
+
return r({
|
|
1221
477
|
...n,
|
|
1222
|
-
env:
|
|
478
|
+
env: i
|
|
1223
479
|
});
|
|
1224
480
|
};
|
|
1225
481
|
//#endregion
|
|
1226
|
-
export {
|
|
482
|
+
export { i as loadWorldFirst };
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -8,6 +8,15 @@ declare interface Appearance<Props extends Partial<DefaultAppearanceProps> = Def
|
|
|
8
8
|
layout?: Props['layout'];
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @description 获取身份认证信息
|
|
13
|
+
*/
|
|
14
|
+
export declare interface AuthConfig {
|
|
15
|
+
clientId: string;
|
|
16
|
+
token: string;
|
|
17
|
+
country: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
11
20
|
declare interface BaseAppearance<A extends Partial<Appearance>> {
|
|
12
21
|
appearance?: A;
|
|
13
22
|
}
|
|
@@ -18,6 +27,7 @@ declare interface BaseAppearance<A extends Partial<Appearance>> {
|
|
|
18
27
|
declare interface BaseBridgeEventMap<AppConfig extends Record<string, any> = Record<string, any>, SubmitReplay extends Record<string, any> = Record<string, any>, SubmitParams extends Record<string, any> = Record<string, any>, AppErrorCodes extends string = string, OpenModalConfig extends BaseOpenModalConfig = BaseOpenModalConfig> {
|
|
19
28
|
error: ErrorPayload<AppErrorCodes>;
|
|
20
29
|
/* Excluded from this release type: "OPENSDK@HANDSHAKE" */
|
|
30
|
+
/* Excluded from this release type: "OPENSDK@READY_HANDSHAKE" */
|
|
21
31
|
/* Excluded from this release type: "OPENSDK@UPDATE_CONFIG" */
|
|
22
32
|
/* Excluded from this release type: "OPENSDK@HANDSHAKE_ACK" */
|
|
23
33
|
/* Excluded from this release type: "OPENSDK@SUBMIT" */
|
|
@@ -295,8 +305,6 @@ declare interface iBaseElementClass {
|
|
|
295
305
|
|
|
296
306
|
export declare interface OnboardAppConfig {
|
|
297
307
|
name?: string;
|
|
298
|
-
token?: string;
|
|
299
|
-
sdkClientId?: string;
|
|
300
308
|
/**
|
|
301
309
|
* @description Theme configuration to pass to the onboard page
|
|
302
310
|
*/
|
|
@@ -324,6 +332,15 @@ export declare type OnboardAppearance = PickAppearance<{
|
|
|
324
332
|
export declare class OnboardElement extends BaseMainElement<OnboardElementConfig> {
|
|
325
333
|
static elementType: string;
|
|
326
334
|
constructor(name: string, config: OnboardElementConfig);
|
|
335
|
+
/**
|
|
336
|
+
* 重写 mount:完成标准挂载流程后,创建 MessageChannel 并分发端口。
|
|
337
|
+
*
|
|
338
|
+
* - port1 → Auth iframe(token 服务端)
|
|
339
|
+
* - port2 → 当前 Element iframe(token 客户端)
|
|
340
|
+
*
|
|
341
|
+
* 销毁 iframe 时自动关闭通道。
|
|
342
|
+
*/
|
|
343
|
+
mount(containerEle: HTMLElement): Promise<void>;
|
|
327
344
|
submit(): Promise<Record<string, any>>;
|
|
328
345
|
protected focus(): void;
|
|
329
346
|
protected blur(): void;
|
|
@@ -515,15 +532,23 @@ export declare type WorldFirstBridgeEventMap<AppConfig extends Record<string, an
|
|
|
515
532
|
* @public
|
|
516
533
|
* @description load config type
|
|
517
534
|
*/
|
|
518
|
-
export declare
|
|
519
|
-
}
|
|
535
|
+
export declare type WorldFirstLoadConfig = WorldFirstSDKConfig;
|
|
520
536
|
|
|
521
537
|
export declare class WorldFirstSDK extends BaseFactory {
|
|
522
538
|
/**
|
|
523
539
|
* SDK 版本号
|
|
524
540
|
*/
|
|
525
541
|
static version: string;
|
|
542
|
+
/**
|
|
543
|
+
* Auth iframe 清理函数
|
|
544
|
+
*/
|
|
545
|
+
private destroyAuthIframe;
|
|
526
546
|
constructor(config: WorldFirstSDKConfig);
|
|
547
|
+
/**
|
|
548
|
+
* 更新 Auth 配置,触发向 Auth iframe 传递凭证。
|
|
549
|
+
* 可在构造函数未传 authConfig 时,后续调用此方法来完成认证初始化。
|
|
550
|
+
*/
|
|
551
|
+
setAuth(authConfig: AuthConfig): void;
|
|
527
552
|
/**
|
|
528
553
|
* 实现 BaseFactory 的 canUseElements 抽象方法
|
|
529
554
|
* 返回工厂可用的元素类列表
|
|
@@ -544,6 +569,7 @@ export declare class WorldFirstSDK extends BaseFactory {
|
|
|
544
569
|
* 获取已创建的元素
|
|
545
570
|
*/
|
|
546
571
|
getElement(type: string, options?: any): any;
|
|
572
|
+
destroy(): void;
|
|
547
573
|
}
|
|
548
574
|
|
|
549
575
|
/**
|
|
@@ -551,6 +577,7 @@ export declare class WorldFirstSDK extends BaseFactory {
|
|
|
551
577
|
*/
|
|
552
578
|
export declare interface WorldFirstSDKConfig extends Omit<BaseFactoryConfig, 'version' | 'targetOrigin'>, PreLoadConfig {
|
|
553
579
|
version?: string;
|
|
580
|
+
authConfig?: AuthConfig;
|
|
554
581
|
}
|
|
555
582
|
|
|
556
583
|
/**
|
package/types.untrimmed.d.ts
CHANGED
|
@@ -8,6 +8,15 @@ declare interface Appearance<Props extends Partial<DefaultAppearanceProps> = Def
|
|
|
8
8
|
layout?: Props['layout'];
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @description 获取身份认证信息
|
|
13
|
+
*/
|
|
14
|
+
export declare interface AuthConfig {
|
|
15
|
+
clientId: string;
|
|
16
|
+
token: string;
|
|
17
|
+
country: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
11
20
|
declare interface BaseAppearance<A extends Partial<Appearance>> {
|
|
12
21
|
appearance?: A;
|
|
13
22
|
}
|
|
@@ -21,6 +30,10 @@ declare interface BaseBridgeEventMap<AppConfig extends Record<string, any> = Rec
|
|
|
21
30
|
* @internal 内部事件 不暴露给商户
|
|
22
31
|
*/
|
|
23
32
|
"OPENSDK@HANDSHAKE": AppConfig;
|
|
33
|
+
/**
|
|
34
|
+
* @internal 内部事件 不暴露给商户
|
|
35
|
+
*/
|
|
36
|
+
"OPENSDK@READY_HANDSHAKE": void;
|
|
24
37
|
/**
|
|
25
38
|
* @internal 内部事件 不暴露给商户
|
|
26
39
|
*/
|
|
@@ -521,8 +534,6 @@ declare interface iBaseElementClass {
|
|
|
521
534
|
|
|
522
535
|
export declare interface OnboardAppConfig {
|
|
523
536
|
name?: string;
|
|
524
|
-
token?: string;
|
|
525
|
-
sdkClientId?: string;
|
|
526
537
|
/**
|
|
527
538
|
* @description Theme configuration to pass to the onboard page
|
|
528
539
|
*/
|
|
@@ -550,6 +561,15 @@ export declare type OnboardAppearance = PickAppearance<{
|
|
|
550
561
|
export declare class OnboardElement extends BaseMainElement<OnboardElementConfig> {
|
|
551
562
|
static elementType: string;
|
|
552
563
|
constructor(name: string, config: OnboardElementConfig);
|
|
564
|
+
/**
|
|
565
|
+
* 重写 mount:完成标准挂载流程后,创建 MessageChannel 并分发端口。
|
|
566
|
+
*
|
|
567
|
+
* - port1 → Auth iframe(token 服务端)
|
|
568
|
+
* - port2 → 当前 Element iframe(token 客户端)
|
|
569
|
+
*
|
|
570
|
+
* 销毁 iframe 时自动关闭通道。
|
|
571
|
+
*/
|
|
572
|
+
mount(containerEle: HTMLElement): Promise<void>;
|
|
553
573
|
submit(): Promise<Record<string, any>>;
|
|
554
574
|
protected focus(): void;
|
|
555
575
|
protected blur(): void;
|
|
@@ -744,15 +764,23 @@ export declare type WorldFirstBridgeEventMap<AppConfig extends Record<string, an
|
|
|
744
764
|
* @public
|
|
745
765
|
* @description load config type
|
|
746
766
|
*/
|
|
747
|
-
export declare
|
|
748
|
-
}
|
|
767
|
+
export declare type WorldFirstLoadConfig = WorldFirstSDKConfig;
|
|
749
768
|
|
|
750
769
|
export declare class WorldFirstSDK extends BaseFactory {
|
|
751
770
|
/**
|
|
752
771
|
* SDK 版本号
|
|
753
772
|
*/
|
|
754
773
|
static version: string;
|
|
774
|
+
/**
|
|
775
|
+
* Auth iframe 清理函数
|
|
776
|
+
*/
|
|
777
|
+
private destroyAuthIframe;
|
|
755
778
|
constructor(config: WorldFirstSDKConfig);
|
|
779
|
+
/**
|
|
780
|
+
* 更新 Auth 配置,触发向 Auth iframe 传递凭证。
|
|
781
|
+
* 可在构造函数未传 authConfig 时,后续调用此方法来完成认证初始化。
|
|
782
|
+
*/
|
|
783
|
+
setAuth(authConfig: AuthConfig): void;
|
|
756
784
|
/**
|
|
757
785
|
* 实现 BaseFactory 的 canUseElements 抽象方法
|
|
758
786
|
* 返回工厂可用的元素类列表
|
|
@@ -773,6 +801,7 @@ export declare class WorldFirstSDK extends BaseFactory {
|
|
|
773
801
|
* 获取已创建的元素
|
|
774
802
|
*/
|
|
775
803
|
getElement(type: string, options?: any): any;
|
|
804
|
+
destroy(): void;
|
|
776
805
|
}
|
|
777
806
|
|
|
778
807
|
/**
|
|
@@ -780,6 +809,7 @@ export declare class WorldFirstSDK extends BaseFactory {
|
|
|
780
809
|
*/
|
|
781
810
|
export declare interface WorldFirstSDKConfig extends Omit<BaseFactoryConfig, 'version' | 'targetOrigin'>, PreLoadConfig {
|
|
782
811
|
version?: string;
|
|
812
|
+
authConfig?: AuthConfig;
|
|
783
813
|
}
|
|
784
814
|
|
|
785
815
|
/**
|