zmp-sdk 2.19.0-rc.4 → 2.19.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.min.js +4 -4
- package/dist/index.es.js +4 -4
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/types/src/types/callbackData.d.ts +1 -1
- package/package.json +1 -1
package/dist/browser.min.js
CHANGED
|
@@ -4236,7 +4236,7 @@
|
|
|
4236
4236
|
}
|
|
4237
4237
|
_ZJSBridgeProvider_bridge = new WeakMap();
|
|
4238
4238
|
|
|
4239
|
-
var version = "2.19.0-rc.
|
|
4239
|
+
var version = "2.19.0-rc.5";
|
|
4240
4240
|
|
|
4241
4241
|
class Basics {
|
|
4242
4242
|
/**
|
|
@@ -8015,11 +8015,11 @@
|
|
|
8015
8015
|
const data = resData.data || {};
|
|
8016
8016
|
const transaction = {
|
|
8017
8017
|
msg: data.resultMessage,
|
|
8018
|
-
appId: data.appId,
|
|
8019
8018
|
orderId: data.orderId,
|
|
8020
8019
|
resultCode: data.resultCode,
|
|
8021
8020
|
transTime: data.transTime,
|
|
8022
|
-
createdAt: data.createAt
|
|
8021
|
+
createdAt: data.createAt,
|
|
8022
|
+
transId: data.transId
|
|
8023
8023
|
};
|
|
8024
8024
|
return transaction;
|
|
8025
8025
|
}
|
|
@@ -8091,11 +8091,11 @@
|
|
|
8091
8091
|
checkTransaction(sdk, object) {
|
|
8092
8092
|
const result = {
|
|
8093
8093
|
msg: 'Success',
|
|
8094
|
-
appId: __classPrivateFieldGet(this, _MockPaymentService_appId, "f"),
|
|
8095
8094
|
orderId: '',
|
|
8096
8095
|
resultCode: 1,
|
|
8097
8096
|
transTime: new Date().getTime().toString(),
|
|
8098
8097
|
createdAt: new Date().getTime().toString(),
|
|
8098
|
+
transId: ''
|
|
8099
8099
|
};
|
|
8100
8100
|
return Promise.resolve(result);
|
|
8101
8101
|
}
|
package/dist/index.es.js
CHANGED
|
@@ -4061,7 +4061,7 @@ class ZJSBridgeProvider {
|
|
|
4061
4061
|
}
|
|
4062
4062
|
_ZJSBridgeProvider_bridge = new WeakMap();
|
|
4063
4063
|
|
|
4064
|
-
var version$1 = "2.19.0-rc.
|
|
4064
|
+
var version$1 = "2.19.0-rc.5";
|
|
4065
4065
|
|
|
4066
4066
|
class Basics {
|
|
4067
4067
|
/**
|
|
@@ -9199,11 +9199,11 @@ class PaymentService {
|
|
|
9199
9199
|
const data = resData.data || {};
|
|
9200
9200
|
const transaction = {
|
|
9201
9201
|
msg: data.resultMessage,
|
|
9202
|
-
appId: data.appId,
|
|
9203
9202
|
orderId: data.orderId,
|
|
9204
9203
|
resultCode: data.resultCode,
|
|
9205
9204
|
transTime: data.transTime,
|
|
9206
|
-
createdAt: data.createAt
|
|
9205
|
+
createdAt: data.createAt,
|
|
9206
|
+
transId: data.transId
|
|
9207
9207
|
};
|
|
9208
9208
|
return transaction;
|
|
9209
9209
|
}
|
|
@@ -9275,11 +9275,11 @@ class MockPaymentService {
|
|
|
9275
9275
|
checkTransaction(sdk, object) {
|
|
9276
9276
|
const result = {
|
|
9277
9277
|
msg: 'Success',
|
|
9278
|
-
appId: __classPrivateFieldGet(this, _MockPaymentService_appId, "f"),
|
|
9279
9278
|
orderId: '',
|
|
9280
9279
|
resultCode: 1,
|
|
9281
9280
|
transTime: new Date().getTime().toString(),
|
|
9282
9281
|
createdAt: new Date().getTime().toString(),
|
|
9282
|
+
transId: ''
|
|
9283
9283
|
};
|
|
9284
9284
|
return Promise.resolve(result);
|
|
9285
9285
|
}
|
package/dist/index.js
CHANGED
|
@@ -13,4 +13,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
15
|
***************************************************************************** */
|
|
16
|
-
function e(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a}function t(e,t){return function(n,i){t(n,i,e)}}function n(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{c(i.next(e))}catch(e){r(e)}}function s(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}function i(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function o(e,t,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(e,n):o?o.value=n:t.set(e,n),n}Object.defineProperty(exports,"__esModule",{value:!0});var r=Object.prototype;var a=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||r)};var s=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),c=a,l=s,u=Object.prototype.hasOwnProperty;var d=function(e){if(!c(e))return l(e);var t=[];for(var n in Object(e))u.call(e,n)&&"constructor"!=n&&t.push(n);return t},p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function h(e,t){return e(t={exports:{}},t.exports),t.exports}var v="object"==typeof p&&p&&p.Object===Object&&p,f="object"==typeof self&&self&&self.Object===Object&&self,m=v||f||Function("return this")(),g=m.Symbol,y=Object.prototype,_=y.hasOwnProperty,E=y.toString,S=g?g.toStringTag:void 0;var A=function(e){var t=_.call(e,S),n=e[S];try{e[S]=void 0;var i=!0}catch(e){}var o=E.call(e);return i&&(t?e[S]=n:delete e[S]),o},O=Object.prototype.toString;var T=A,b=function(e){return O.call(e)},w=g?g.toStringTag:void 0;var N=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},P=N,I=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":w&&w in Object(e)?T(e):b(e)};var C,k=function(e){if(!N(e))return!1;var t=I(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},R=k,B=m["__core-js_shared__"],D=(C=/[^.]+$/.exec(B&&B.keys&&B.keys.IE_PROTO||""))?"Symbol(src)_1."+C:"";var j=function(e){return!!D&&D in e},M=Function.prototype.toString;var L=j,x=function(e){if(null!=e){try{return M.call(e)}catch(e){}try{return e+""}catch(e){}}return""},U=/^\[object .+?Constructor\]$/,W=Function.prototype,z=Object.prototype,F=W.toString,G=z.hasOwnProperty,H=RegExp("^"+F.call(G).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var $=function(e){return!(!N(e)||L(e))&&(k(e)?H:U).test(x(e))},V=function(e,t){return null==e?void 0:e[t]};var Z=function(e,t){var n=V(e,t);return $(n)?n:void 0},J=Z(m,"DataView"),K=Z(m,"Map"),q=Z(m,"Promise"),Q=Z(m,"Set"),Y=Z(m,"WeakMap"),X=J,ee=K,te=q,ne=Q,ie=Y,oe=x(X),re=x(ee),ae=x(te),se=x(ne),ce=x(ie),le=I;(X&&"[object DataView]"!=le(new X(new ArrayBuffer(1)))||ee&&"[object Map]"!=le(new ee)||te&&"[object Promise]"!=le(te.resolve())||ne&&"[object Set]"!=le(new ne)||ie&&"[object WeakMap]"!=le(new ie))&&(le=function(e){var t=I(e),n="[object Object]"==t?e.constructor:void 0,i=n?x(n):"";if(i)switch(i){case oe:return"[object DataView]";case re:return"[object Map]";case ae:return"[object Promise]";case se:return"[object Set]";case ce:return"[object WeakMap]"}return t});var ue=le;var de=function(e){return null!=e&&"object"==typeof e};var pe=function(e){return de(e)&&"[object Arguments]"==I(e)},he=Object.prototype,ve=he.hasOwnProperty,fe=he.propertyIsEnumerable,me=pe(function(){return arguments}())?pe:function(e){return de(e)&&ve.call(e,"callee")&&!fe.call(e,"callee")},ge=Array.isArray,ye=ge;var _e=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var Ee=function(e){return null!=e&&_e(e.length)&&!k(e)};var Se=function(){return!1},Ae=h((function(e,t){var n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,o=i&&i.exports===n?m.Buffer:void 0,r=(o?o.isBuffer:void 0)||Se;e.exports=r})),Oe={};Oe["[object Float32Array]"]=Oe["[object Float64Array]"]=Oe["[object Int8Array]"]=Oe["[object Int16Array]"]=Oe["[object Int32Array]"]=Oe["[object Uint8Array]"]=Oe["[object Uint8ClampedArray]"]=Oe["[object Uint16Array]"]=Oe["[object Uint32Array]"]=!0,Oe["[object Arguments]"]=Oe["[object Array]"]=Oe["[object ArrayBuffer]"]=Oe["[object Boolean]"]=Oe["[object DataView]"]=Oe["[object Date]"]=Oe["[object Error]"]=Oe["[object Function]"]=Oe["[object Map]"]=Oe["[object Number]"]=Oe["[object Object]"]=Oe["[object RegExp]"]=Oe["[object Set]"]=Oe["[object String]"]=Oe["[object WeakMap]"]=!1;var Te=function(e){return de(e)&&_e(e.length)&&!!Oe[I(e)]},be=function(e){return function(t){return e(t)}},we=h((function(e,t){var n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,o=i&&i.exports===n&&v.process,r=function(){try{var e=i&&i.require&&i.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=r})),Ne=we&&we.isTypedArray,Pe=Ne?be(Ne):Te,Ie=d,Ce=ue,ke=me,Re=Ee,Be=Ae,De=Pe,je=Object.prototype.hasOwnProperty;var Me=function(e){if(null==e)return!0;if(Re(e)&&(ge(e)||"string"==typeof e||"function"==typeof e.splice||Be(e)||De(e)||ke(e)))return!e.length;var t=Ce(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(c(e))return!Ie(e).length;for(var n in e)if(je.call(e,n))return!1;return!0};var Le=function(e){return void 0===e};var xe=function(e){return null===e};var Ue=function(e){return"string"==typeof e||!ge(e)&&de(e)&&"[object String]"==I(e)};var We=function(e){return"number"==typeof e||de(e)&&"[object Number]"==I(e)};var ze=function(e){return de(e)&&"[object RegExp]"==I(e)},Fe=we&&we.isRegExp,Ge=Fe?be(Fe):ze;var He=function(e){return"symbol"==typeof e||de(e)&&"[object Symbol]"==I(e)},$e=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ve=/^\w*$/;var Ze=function(e,t){if(ge(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!He(e))||(Ve.test(e)||!$e.test(e)||null!=t&&e in Object(t))},Je=Z(Object,"create");var Ke=function(){this.__data__=Je?Je(null):{},this.size=0};var qe=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Qe=Object.prototype.hasOwnProperty;var Ye=function(e){var t=this.__data__;if(Je){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Qe.call(t,e)?t[e]:void 0},Xe=Object.prototype.hasOwnProperty;var et=Ke,tt=qe,nt=Ye,it=function(e){var t=this.__data__;return Je?void 0!==t[e]:Xe.call(t,e)},ot=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Je&&void 0===t?"__lodash_hash_undefined__":t,this};function rt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}rt.prototype.clear=et,rt.prototype.delete=tt,rt.prototype.get=nt,rt.prototype.has=it,rt.prototype.set=ot;var at=rt;var st=function(){this.__data__=[],this.size=0};var ct=function(e,t){return e===t||e!=e&&t!=t};var lt=function(e,t){for(var n=e.length;n--;)if(ct(e[n][0],t))return n;return-1},ut=Array.prototype.splice;var dt=st,pt=function(e){var t=this.__data__,n=lt(t,e);return!(n<0)&&(n==t.length-1?t.pop():ut.call(t,n,1),--this.size,!0)},ht=function(e){var t=this.__data__,n=lt(t,e);return n<0?void 0:t[n][1]},vt=function(e){return lt(this.__data__,e)>-1},ft=function(e,t){var n=this.__data__,i=lt(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};function mt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}mt.prototype.clear=dt,mt.prototype.delete=pt,mt.prototype.get=ht,mt.prototype.has=vt,mt.prototype.set=ft;var gt=at,yt=mt;var _t=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Et=function(e,t){var n=e.__data__;return _t(t)?n["string"==typeof t?"string":"hash"]:n.map};var St=function(){this.size=0,this.__data__={hash:new gt,map:new(ee||yt),string:new gt}},At=function(e){var t=Et(this,e).delete(e);return this.size-=t?1:0,t},Ot=function(e){return Et(this,e).get(e)},Tt=function(e){return Et(this,e).has(e)},bt=function(e,t){var n=Et(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};function wt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}wt.prototype.clear=St,wt.prototype.delete=At,wt.prototype.get=Ot,wt.prototype.has=Tt,wt.prototype.set=bt;var Nt=wt;function Pt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var i=arguments,o=t?t.apply(this,i):i[0],r=n.cache;if(r.has(o))return r.get(o);var a=e.apply(this,i);return n.cache=r.set(o,a)||r,a};return n.cache=new(Pt.Cache||Nt),n}Pt.Cache=Nt;var It=Pt;var Ct=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,kt=/\\(\\)?/g,Rt=function(e){var t=It(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Ct,(function(e,n,i,o){t.push(i?o.replace(kt,"$1"):n||e)})),t}));var Bt=function(e,t){for(var n=-1,i=null==e?0:e.length,o=Array(i);++n<i;)o[n]=t(e[n],n,e);return o},Dt=g?g.prototype:void 0,jt=Dt?Dt.toString:void 0;var Mt=function e(t){if("string"==typeof t)return t;if(ge(t))return Bt(t,e)+"";if(He(t))return jt?jt.call(t):"";var n=t+"";return"0"==n&&1/t==-Infinity?"-0":n};var Lt=Ze,xt=Rt,Ut=function(e){return null==e?"":Mt(e)};var Wt=function(e,t){return ge(e)?e:Lt(e,t)?[e]:xt(Ut(e))},zt=function(e){if("string"==typeof e||He(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var Ft=function(e,t){for(var n=0,i=(t=Wt(t,e)).length;null!=e&&n<i;)e=e[zt(t[n++])];return n&&n==i?e:void 0};var Gt=function(e,t,n){var i=null==e?void 0:Ft(e,t);return void 0===i?n:i},Ht=function(){try{var e=Z(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var $t=function(e,t,n){"__proto__"==t&&Ht?Ht(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Vt=Object.prototype.hasOwnProperty;var Zt=/^(?:0|[1-9]\d*)$/;var Jt=function(e,t,n){var i=e[t];Vt.call(e,t)&&ct(i,n)&&(void 0!==n||t in e)||$t(e,t,n)},Kt=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Zt.test(e))&&e>-1&&e%1==0&&e<t};var qt=function(e,t,n,i){if(!N(e))return e;for(var o=-1,r=(t=Wt(t,e)).length,a=r-1,s=e;null!=s&&++o<r;){var c=zt(t[o]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(o!=a){var u=s[c];void 0===(l=i?i(u,c,s):void 0)&&(l=N(u)?u:Kt(t[o+1])?[]:{})}Jt(s,c,l),s=s[c]}return e};var Qt,Yt,Xt,en,tn,nn,on,rn,an,sn,cn,ln={isEmpty:Me,isNull:xe,isUndefined:Le,isFunction:R,isObject:P,isString:Ue,isNumber:We,isArray:ye,isRegExp:Ge,get:Gt,set:function(e,t,n){return null==e?e:qt(e,t,n)}};function un(e){return"function"==typeof window.Debug?window.Debug(e):function(...e){process.env.NODE_ENV}}exports.NetworkType=void 0,(Qt=exports.NetworkType||(exports.NetworkType={})).none="none",Qt.wifi="wifi",Qt.cellular="cellular",Qt.unknown="unknown",exports.PlatformType=void 0,(Yt=exports.PlatformType||(exports.PlatformType={})).wp="wp",Yt.android="android",Yt.iOS="iOS",Yt.unknown="unknown",exports.ProfileType=void 0,(Xt=exports.ProfileType||(exports.ProfileType={}))[Xt.user=1]="user",Xt[Xt.oa=0]="oa",Xt[Xt.aliasOA=2]="aliasOA",exports.ChatType=void 0,(en=exports.ChatType||(exports.ChatType={}))[en.user=1]="user",en[en.oa=0]="oa",exports.PostFeedType=void 0,(tn=exports.PostFeedType||(exports.PostFeedType={}))[tn.image=1]="image",tn[tn.link=4]="link",tn[tn.profile=5]="profile",exports.ShareSheetType=void 0,(nn=exports.ShareSheetType||(exports.ShareSheetType={}))[nn.image=1]="image",nn[nn.gif=11]="gif",nn[nn.video=12]="video",nn[nn.link=4]="link",nn[nn.oa=5]="oa",nn[nn.zmp=22]="zmp",exports.OrientationType=void 0,(on=exports.OrientationType||(exports.OrientationType={}))[on.auto=1]="auto",on[on.portrait=2]="portrait",on[on.landscape=3]="landscape",exports.VibrateType=void 0,(rn=exports.VibrateType||(exports.VibrateType={}))[rn.oneShot=0]="oneShot",exports.NativeCode=void 0,(an=exports.NativeCode||(exports.NativeCode={}))[an.token_invalid=-2]="token_invalid",an[an.not_permission=-1]="not_permission",an[an.client_not_support=-5]="client_not_support",an[an.decode_failed=-4]="decode_failed",exports.Events=void 0,(sn=exports.Events||(exports.Events={})).AppPaused="h5.event.paused",sn.AppResumed="h5.event.resumed",sn.NetworkChanged="h5.event.connection.changed",sn.OnDataCallback="h5.event.webview.result",sn.OpenApp="h5.event.open.mp",exports.MediaPickerType=void 0,(cn=exports.MediaPickerType||(exports.MediaPickerType={}))[cn.photo=4]="photo",cn[cn.video=5]="video",cn[cn.file=6]="file",cn[cn.multi_photo=7]="multi_photo",cn[cn.multi_video=8]="multi_video";const dn=e=>{const t=document.cookie;if(t){const o=t.split("; ");if(o&&o.length>0)for(var n=e.length+1,i=o.length-1;i>=0;i--){let t=o[i];if(t&&0===t.indexOf(e)&&(t=t.substring(n,t.length),t))return t=t.replace(/["']/g,""),t}}return null},pn=e=>dn(`${window.location.host}_`+e),hn=e=>dn((()=>{const e=window.location.host;if(e){if(e.indexOf("zalo.me")>=0)return"zalo.me_";if(e.indexOf("baomoi.com")>=0)return"baomoi.com_";if(e.indexOf("mp3.zing.vn")>=0)return"mp3.zing.vn_";if(e.indexOf("zaloapp.com")>=0)return"zaloapp.com_"}return""})()+e),vn=window.zAppID,fn=window.APP_ID,mn=window.APP_CONFIG||{},gn="h5.zdn.vn_zoauth",yn="h5.zdn.vn_zlink3rd",_n="h5.zdn.vn_zoauth_vrf",En="https://graph.zalo.me/v2.0/me",Sn="https://h5.zalo.me/openapi/access_token",An="https://oauth.zaloapp.com/v3/access_token",On="https://graph.zalo.me/v2.0/me/friends/list",Tn=e=>({NONE:e?-2:0,WIFI:e?0:1,"2G":2,"3G":e?15:2,"4G":e?13:2}),bn={GET_DOWNLOADED_STICKER:{name:"action.get.downloaded.sticker",have_callback:!0},OPEN_SHARE_STICKER:{name:"action.open.share.sticker"},OPEN_PROFILE:{name:"action.open.profile"},OPEN_FEED_DETAIL:{name:"action.open.feeddetail"},OPEN_FRIEND_RADA:{name:"action.open.friendrada"},OPEN_INAPP:{name:"action.open.inapp"},OPEN_OUTAPP:{name:"action.open.outapp"},OPEN_PAGE:{name:"action.open.page"},OPEN_PHOTODETAIL:{name:"action.open.photodetail"},OPEN_GALARY:{name:"action.open.galary"},OPEN_GAMECENTER:{name:"action.open.gamecenter"},OPEN_GAMENEWS:{name:"action.open.gamenews"},OPEN_TAB_CONTACT:{name:"action.open.tab.contact"},OPEN_TAB_SOCIAL:{name:"action.open.tab.social"},OPEN_FRIENDSUGGEST:{name:"action.open.friendsuggest"},OPEN_GROUPLIST:{name:"action.open.grouplist"},OPEN_NEARBY:{name:"action.open.nearby"},OPEN_ROOM:{name:"action.open.room"},OPEN_STICKERSTORE:{name:"action.open.stickerstore"},OPEN_CREATECHAT:{name:"action.open.createchat"},COPY_LINK_CATESTICKER:{name:"action.copy.link.catesticker"},REQUEST_BUY_STICKER:{name:"action.request.buy.sticker"},OPEN_CHAT:{name:"action.open.chat"},OPEN_TAB_CHAT:{name:"action.open.tab.chat"},OPEN_CHATGROUP:{name:"action.open.chatgroup"},OPEN_ADDFRIEND:{name:"action.open.addfriend"},OPEN_TAB_MORE:{name:"action.open.tab.more"},OPEN_POSTFEED:{name:"action.open.postfeed"},OPEN_LOGINDEVICES:{name:"action.open.logindevices"},OPEN_SENDSTICKER:{name:"action.open.sendsticker"},REPORT_ABUSE:{name:"action.report.abuse",have_callback:!0},FOLLOW_OA:{name:"action.follow.oa",have_callback:!0},UNFOLLOW_OA:{name:"action.unfollow.oa",have_callback:!0},OPEN_GAMEDETAIL:{name:"action.open.gamedetail"},OPEN_SHARESHEET:{name:"action.open.sharesheet",have_callback:!0},REQUEST_PERMISSION_CAMERA:{name:"action.request.permission.camera"},CHANGE_TITLE_HEADER:{name:"action.change.title.header",skip_jump:!0},WEBVIEW_CLEARCACHE:{name:"action.webview.clearcache"},WEBVIEW_CONFIRMCACHE:{name:"action.webview.confirmcache"},WEBVIEW_ISVISIBLE:{name:"action.webview.isvisible"},WEBVIEW_NETWORKTYPE:{name:"action.webview.networktype",skip_jump:!0},CHANGE_BUTTON_HEADER:{name:"action.change.button.header"},CREATE_OPTIONS_MENU:{name:"action.create.options.menu",skip_jump:!0,have_callback:!0},CREATE_SHORTCUT:{name:"action.create.shortcut"},CHANGE_ACTIONBAR_LEFTBUTTON_TYPE:{name:"action.change.actionbar.leftbutton.type",skip_jump:!0,have_callback:!0},WINDOW_CLOSE:{name:"action.window.close",skip_jump:!0,have_callback:!0},WEBVIEW_CHECKRESERROR:{name:"action.webview.checkResError"},IAP_REQUESTPAYMENT:{name:"action.iap.requestpayment"},ZBROWSER_GETSTATS:{name:"action.zbrowser.getstats"},ZBROWSER_JSBRIDGE:{name:"action.zbrowser.jsbridge",skip_jump:!0,have_callback:!0},PROMPT_AUTHENTICATION:{name:"action.prompt.authentication"},CHANGE_ACTIONBAR_COLOR:{name:"action.change.actionbar.color",skip_jump:!0},PROMPT_AUTHENTICATION_CHECK_STATE:{name:"action.prompt.authentication.check_state"},OPEN_APPSTORE:{name:"action.open.appstore"},GET_LOCATION:{name:"action.get.location",have_callback:!0},QUERY_LOCATION_HIDE:{name:"action.query.location.hide",have_callback:!0},SHOW_TOAST:{name:"action.show.toast",have_callback:!0},OPEN_APP:{name:"action.open.app"},HIDE_KEYBOARD:{name:"action.hide.keyboard"},OPEN_PHONE:{name:"action.open.phone"},OPEN_QR:{name:"action.open.qr"},OPEN_SMS:{name:"action.open.sms"},VIEW_MYQR:{name:"action.view.myqr",have_callback:!0},KEEP_SCREEN:{name:"action.keep.screen",have_callback:!0},CHANGE_AUTOROTATE:{name:"action.change.autorotate",skip_jump:!0},CHECK_APP_INSTALLED:{name:"action.check.app.installed"},QUERY_SHOW:{name:"action.query.show"},QUERY_HIDE:{name:"action.query.hide"},OPEN_INAPPRW:{name:"action.open.inapprw"},ZALORUN_GETTRACKINGSTATUS:{name:"action.zalorun.getTrackingStatus",have_callback:!0},ZALORUN_SETTRACKINGSTATUS:{name:"action.zalorun.setTrackingStatus",have_callback:!0},ZALORUN_GETDAYSTEP:{name:"action.zalorun.getDayStep",have_callback:!0},ZALORUN_FORCESUBMITDATA:{name:"action.zalorun.forceSubmitData",have_callback:!0},ZALORUN_SETWEIGHT:{name:"action.zalorun.setWeight",have_callback:!0},OPEN_PROFILE_EXT:{name:"action.open.profile.ext"},DOWNLOAD_CATE:{name:"action.download.cate",have_callback:!0},JUMP_LOGIN:{name:"action.jump.login",skip_jump:!0,white_list:!0},OPEN_ADTIMA_ADS_INTERSTITIAL:{name:"action.open.adtima.ads.interstitial"},OPEN_ADTIMA_ADS:{name:"action.open.adtima.ads"},GET_ADIDCLIENT:{name:"action.get.adidclient"},SCAN_IBEACON:{name:"action.scan.ibeacon"},INTERACTIVE_VIBRATION:{name:"action.interactive.vibration"},SAVE_IMAGE_GALLERY:{name:"action.save.image.gallery",version_live:{iOS:408}},OPEN_MP:{name:"action.open.mp",version_live:{iOS:402}},CHANGE_ACTIONBAR:{name:"action.change.actionbar",version_live:{iOS:402},skip_jump:!0},ZBROWSER_MPDS:{name:"action.zbrowser.mpds",version_live:{iOS:402}},WEBVIEW_SET_RESULT:{name:"action.webview.set.result",version_live:{iOS:416}},MP_GET_NUMBER:{name:"action.mp.get.number",version_live:{iOS:416}},MP_OPEN_PROFILE_PICKER:{name:"action.mp.open.profile.picker",version_live:{iOS:432}},GET_SUPPORTED_ACTIONS:{name:"action.get.supported.actions",white_list:!0},MP_JOIN_WIFI:{name:"action.mp.join.wifi",version_live:{android:0,iOS:999},have_permission:!1,white_list:!1},PICK_MEDIA:{name:"action.pick.media",version_live:{iOS:999}},MP_CLOSE_LOADINGVIEW:{name:"action.mp.close.loadingview"}},wn=0,Nn=-1400,Pn=-1500,In=-1401,Cn=-1403,kn=-1404,Rn={SUCCESS:"Success",READ_MORE:"Read more at: https://miniapp.zalo.me/docs/api",LOGIN_REQUIRED:"Please login before to call this api. Read more at: https://miniapp.zalo.me/docs/api/login",LOGIN_FAILED:"Login failed.",NOT_PERMISSION:"You don't have permission to call this api",CLIENT_NOT_SUPPORT:"This API is not supported in this Zalo version",DECODE_FAILED:"Can not decode your data. Read more at: https://miniapp.zalo.me/docs/api/error"},Bn="apps/get-info",Dn={android:12100571,iOS:400,wp:0,unknown:0},jn=[bn.GET_DOWNLOADED_STICKER.name,bn.OPEN_SHARE_STICKER.name,bn.OPEN_PROFILE.name,bn.OPEN_FEED_DETAIL.name,bn.OPEN_FRIEND_RADA.name,bn.OPEN_INAPP.name,bn.OPEN_OUTAPP.name,bn.OPEN_PAGE.name,bn.OPEN_PHOTODETAIL.name,bn.OPEN_GALARY.name,bn.OPEN_GAMECENTER.name,bn.OPEN_GAMENEWS.name,bn.OPEN_TAB_CONTACT.name,bn.OPEN_TAB_SOCIAL.name,bn.OPEN_FRIENDSUGGEST.name,bn.OPEN_GROUPLIST.name,bn.OPEN_NEARBY.name,bn.OPEN_ROOM.name,bn.OPEN_STICKERSTORE.name,bn.OPEN_CREATECHAT.name,bn.COPY_LINK_CATESTICKER.name,bn.REQUEST_BUY_STICKER.name,bn.OPEN_CHAT.name,bn.OPEN_TAB_CHAT.name,bn.OPEN_CHATGROUP.name,bn.OPEN_ADDFRIEND.name,bn.OPEN_TAB_MORE.name,bn.OPEN_POSTFEED.name,bn.OPEN_LOGINDEVICES.name,bn.OPEN_SENDSTICKER.name,bn.REPORT_ABUSE.name,bn.FOLLOW_OA.name,bn.UNFOLLOW_OA.name,bn.OPEN_GAMEDETAIL.name,bn.OPEN_SHARESHEET.name,bn.REQUEST_PERMISSION_CAMERA.name,bn.CHANGE_TITLE_HEADER.name,bn.WEBVIEW_CLEARCACHE.name,bn.WEBVIEW_CONFIRMCACHE.name,bn.WEBVIEW_ISVISIBLE.name,bn.WEBVIEW_NETWORKTYPE.name,bn.CHANGE_BUTTON_HEADER.name,bn.CREATE_OPTIONS_MENU.name,bn.CREATE_SHORTCUT.name,bn.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE.name,bn.WINDOW_CLOSE.name,bn.WEBVIEW_CHECKRESERROR.name,bn.IAP_REQUESTPAYMENT.name,bn.ZBROWSER_GETSTATS.name,bn.ZBROWSER_JSBRIDGE.name,bn.PROMPT_AUTHENTICATION.name,bn.CHANGE_ACTIONBAR_COLOR.name,bn.PROMPT_AUTHENTICATION_CHECK_STATE.name,bn.OPEN_APPSTORE.name,bn.GET_LOCATION.name,bn.QUERY_LOCATION_HIDE.name,bn.SHOW_TOAST.name,bn.OPEN_APP.name,bn.HIDE_KEYBOARD.name,bn.OPEN_PHONE.name,bn.OPEN_QR.name,bn.OPEN_SMS.name,bn.VIEW_MYQR.name,bn.KEEP_SCREEN.name,bn.CHANGE_AUTOROTATE.name,bn.CHECK_APP_INSTALLED.name,bn.QUERY_SHOW.name,bn.QUERY_HIDE.name,bn.OPEN_INAPPRW.name,bn.ZALORUN_GETTRACKINGSTATUS.name,bn.ZALORUN_SETTRACKINGSTATUS.name,bn.ZALORUN_GETDAYSTEP.name,bn.ZALORUN_FORCESUBMITDATA.name,bn.ZALORUN_SETWEIGHT.name,bn.OPEN_PROFILE_EXT.name,bn.DOWNLOAD_CATE.name,bn.JUMP_LOGIN.name,bn.OPEN_ADTIMA_ADS_INTERSTITIAL.name,bn.OPEN_ADTIMA_ADS.name,bn.GET_ADIDCLIENT.name,bn.SCAN_IBEACON.name,bn.SAVE_IMAGE_GALLERY.name,bn.OPEN_MP.name,bn.CHANGE_ACTIONBAR.name,bn.INTERACTIVE_VIBRATION.name,bn.ZBROWSER_MPDS.name],Mn=0,Ln=3,xn=1,Un=0,Wn="https://payment-mini.zalo.me/api/order/create",zn="https://payment-mini.zalo.me/api/transaction",Fn="https://payment-mini.zalo.me/api/transaction/get-status";class Gn{constructor(e,t,n){this.code=e,this.message=t,this.api=n}toString(){return`api: ${this.api}; code: ${this.code}; message: ${this.message}`}}class Hn extends Gn{constructor(e,t){super(e,t),this.message=`${t}. ${Rn.READ_MORE}`,this.handler()}handler(){switch(this.code){case exports.NativeCode.token_invalid:this.code=In,this.message=Rn.LOGIN_REQUIRED;break;case exports.NativeCode.not_permission:this.code=Cn,this.message=Rn.NOT_PERMISSION;break;case exports.NativeCode.client_not_support:this.code=kn,this.message=Rn.CLIENT_NOT_SUPPORT;break;case exports.NativeCode.decode_failed:this.message=Rn.DECODE_FAILED}}}const $n={handler:null,setHandler(e){this.handler=e}};$n.setHandler(((e,t)=>t instanceof Gn?(t.api=e,t):new Gn(-2001,ln.isNull(t.message)?"Unknown Error":t.message,e)));const Vn=(e,t,i)=>{const o=i.value;return i.value=function(...e){return n(this,void 0,void 0,(function*(){const{success:i,fail:r}=Array.isArray(e)&&e.length>0&&e[0];return new Promise(((a,s)=>n(this,void 0,void 0,(function*(){try{const t=yield o.apply(this,e);!ln.isNull(i)&&ln.isFunction(i)?i.call(null,t,this):a(t)}catch(e){if("login"!==(null==e?void 0:e.api)&&((null==e?void 0:e.code)===In||(null==e?void 0:e.code)===Cn)){let t=!1;this instanceof xo&&(t=this.getLoginStatus()),t||(e=new Gn(In,Rn.LOGIN_REQUIRED))}const{handler:n}=$n,i=n.call(null,t,e,this);window.zmpSentry&&window.zmpSentry.throwError(i.toString()),!ln.isNull(r)&&ln.isFunction(r)?r.call(null,i,this):s(i)}}))))}))},i},Zn=(e,t,n)=>{const i=n.value;return n.value=function(...e){try{return i.apply(this,e)}catch(e){if("login"!==(null==e?void 0:e.api)&&((null==e?void 0:e.code)===In||(null==e?void 0:e.code)===Cn)){let t=!1;this instanceof xo&&(t=this.getLoginStatus()),t||(e=new Gn(In,Rn.LOGIN_REQUIRED))}const{handler:n}=$n,i=n.call(null,t,e,this);throw window.zmpSentry&&window.zmpSentry.throwError(i.toString()),i}},n},Jn=(e,t)=>({code:wn,message:t||Rn.SUCCESS,data:e||{}}),Kn={badRequest:e=>new Gn(Nn,e),loginFailed:()=>new Gn(Nn,Rn.LOGIN_FAILED),loginRequired:()=>new Gn(In,Rn.LOGIN_REQUIRED),missingParam:e=>new Gn(Nn,`Missing required argument: ${e}`),wrongTypeParam:(e,t,n)=>new Gn(Nn,`Wrong type of parameter '${e}'. Expected ${t}, but got ${n}`),cannotGetShareInfo:()=>new Gn(Pn,"Can not get app info to share"),lengthInvalid:e=>new Gn(Nn,`${e} length is invalid.`)};const qn={encode:function(e){var t=[];for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];if(void 0===i)return;if(null===i)return void t.push(n);t.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}return t.join("&")},decode:function(e,t){var n={};if(""===e)return n;for(var i=e.split("&"),o=0;o<i.length;o++){var r=i[o].split("=",2),a=decodeURIComponent(r[0]);if(t&&Object.prototype.hasOwnProperty.call(n,a))throw new URIError("Duplicate key: "+a);n[a]=2===r.length?decodeURIComponent(r[1]):null}return n},appendToUrl:function(e,t){return e+(-1!==e.indexOf("?")?"&":"?")+("string"==typeof t?t:qn.encode(t))},getParameterByName:function(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");var n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return n?n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"":null},getParamsAsObject:function(e){var t={};return e?(e.split("&").map((function(e){var n=e.split("=");n&&2==n.length&&(t[n[0]]=decodeURIComponent(n[1].replace(/\+/g," ")))})),t):t},toQueryString:function(e){if(!e)return"";if("object"!=(void 0===e?"undefined":typeof e))return e;var t=Object.keys(e),n=[];return t.map((function(t){var i=e[t],o=[t,i="object"==(void 0===i?"undefined":typeof i)?JSON.stringify(i):encodeURIComponent(i)].join("=");n.push(o)})),n.join("&")}};var Qn=qn;const Yn=new RegExp("[\\u0300-\\u036f]","g"),Xn=new RegExp("[đ|Đ]","g"),ei=new RegExp("\\s","g"),ti=un("zmp:utils:common"),ni=e=>{try{new URL(e)}catch(e){return!1}return!0},ii=()=>navigator.userAgent||navigator.vendor||window.opera,oi=()=>{const e=ii().toLowerCase();return{isWP:/iemobile/.test(e),isAndroid:/android/i.test(e)&&!/iemobile/.test(e),isIOS:/iphone|ios|ipad|ipod/.test(e)&&!/iemobile/.test(e),isMobile:/android|iphone|ios|ipad|ipod|iemobile/.test(e),isZalo:/zalo/.test(e)}},ri=e=>{const t=document.getElementsByTagName("meta");for(let n=0;n<t.length;n++)if(t[n].getAttribute("name")===e||t[n].getAttribute("property")===e)return t[n].getAttribute("content");return""},ai=()=>{const e=ii().toLowerCase().split("zalo")[1];if(e){return e.replace(" ","").split("/")[1]||""}return""},si=()=>{let e=oi();return e.isWP?exports.PlatformType.wp:e.isAndroid?exports.PlatformType.android:e.isIOS?exports.PlatformType.iOS:exports.PlatformType.unknown},ci=(e,t)=>{const n=t.toLowerCase(),i=n.split(/[<>]/i),o="array"===i[0];return!!("url"===n&&ni(e)||o&&("array"===n&&Array.isArray(e)||((e,t)=>Array.isArray(t)&&!t.some((t=>"url"===e?!ni(t):typeof t!==e)))(i[1],e))||!Array.isArray(e)&&typeof e===t)},li=e=>(e=>{let t=pn(e);return t||(t=hn(e),t)?t:dn(e)})(e),ui=e=>{if(ln.isObject(JSON)&&JSON.parse&&ln.isString(e)){const t=e.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");return JSON.parse(t,((e,t)=>t))}return ln.isObject(e)?e:new Function("return "+e)()},di=e=>{if(ln.isObject(JSON)&&JSON.stringify)return JSON.stringify(e);if(void 0===e)return"undefined";if(null===e)return"null";try{if("string"==typeof e||null!==e.constructor.toString().match(/string/i))return'"'+e.replace(/"/g,'\\"')+'"'}catch(e){console.log(e)}var t;if(null!==Object.prototype.toString.call(e).match(/array/i)){t=new Array;for(var n=e.length,i=0;i<n;i++)t.push(di(e[i]));return"["+t.join(",")+"]"}if("object"==typeof e){for(var o in t=new Array,e)t.push('"'+o+'":'+di(e[o]));return"{"+t.join(",")+"}"}return e.toString()},pi=()=>{try{const e=Number(ai()),t=si();return e>=Dn[t]}catch(e){return!0}},hi=e=>JSON.stringify(e).replace(/"/g,'\\"').replace(/'/g,"'"),vi=e=>{try{if(e){ti(e);const t=e.replace(/\\/g,"").replace(/'/g,"'");return ti("formattedValue",t,JSON.parse(t),typeof JSON.parse(t)),JSON.parse(t)}return null}catch(t){return ti("parse json error:",t),e}},fi=(e,t,i,o,r,a)=>n(void 0,void 0,void 0,(function*(){const n=new URL(location.href),s=new URLSearchParams;let c=`${n.pathname}${n.search}`;a&&(c=`/zapps/${e}${"/"===a[0]?"":"/"}${a}`);const l=new URL(`https://zalo.me/app/link${c}`);s.append("title",i),s.append("description",o||""),s.append("thumbnail",r),s.append("url",l.href),s.append("accessToken",t||"");const u=yield fetch("https://h5.zalo.me/openapi/create-sharelink",Object.assign({method:"POST",body:s},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})),d=yield u.json();if(!d||0!==d.err)throw Kn.cannotGetShareInfo();return l.search=`${l.search}&zshareId=${d.data.shareId}`,Object.assign(Object.assign({},d.data),{shareableLink:l.href})})),mi=(e,t)=>n=>{if(!(Array.isArray(e)?e.some((e=>ci(n,e))):ci(n,e)))return{error:!0,errorMessage:e};if(t){if(Array.isArray(null==t?void 0:t.values))return{error:!(null==t?void 0:t.values.includes(n)),errorMessage:null==t?void 0:t.values.toString()};if(ln.isNumber(null==t?void 0:t.maxLength))return{error:ln.isString(n)&&n.length>(null==t?void 0:t.maxLength),errorMessage:`data length must <= ${null==t?void 0:t.maxLength}`};if(ln.isNumber(null==t?void 0:t.min)&&ln.isNumber(null==t?void 0:t.max))return{error:n<(null==t?void 0:t.min)||n>(null==t?void 0:t.max),errorMessage:`data must be in between ${null==t?void 0:t.min} and ${null==t?void 0:t.max}`};if(ln.isNumber(null==t?void 0:t.min))return{error:n<(null==t?void 0:t.min),errorMessage:`data must >= ${null==t?void 0:t.min}`};if(ln.isNumber(null==t?void 0:t.max))return{error:n>(null==t?void 0:t.max),errorMessage:`data must <= ${null==t?void 0:t.max}`};if(ln.isRegExp(null==t?void 0:t.regex))return{error:!t.regex.test(n),errorMessage:"data must valid"}}return{error:!1}},gi=(e,t,i)=>n(void 0,void 0,void 0,(function*(){const n={appId:e,versionStatus:t};ln.isUndefined(i)||(n.currentVersion=i);const o=Qn.appendToUrl(`https://h5.zalo.me/${Bn}`,n),r=yield fetch(o,{credentials:"include"});if(r.ok){const e=yield r.json();if(e.err<0||!e.data)throw new Error(e);return{name:e.data.name,version:e.data.version,description:e.data.description,appUrl:e.data.appUrl,qrCodeUrl:e.data.qrCodeUrl,logoUrl:e.data.logoUrl}}throw new Error("Can't get app info")}));var yi=h((function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function r(e,t,i,r,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new o(i,r||e,a),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,i,o=[];if(0===this._eventsCount)return o;for(i in e=this._events)t.call(e,i)&&o.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},s.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var o=0,r=i.length,a=new Array(r);o<r;o++)a[o]=i[o].fn;return a},s.prototype.listenerCount=function(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},s.prototype.emit=function(e,t,i,o,r,a){var s=n?n+e:e;if(!this._events[s])return!1;var c,l,u=this._events[s],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,i),!0;case 4:return u.fn.call(u.context,t,i,o),!0;case 5:return u.fn.call(u.context,t,i,o,r),!0;case 6:return u.fn.call(u.context,t,i,o,r,a),!0}for(l=1,c=new Array(d-1);l<d;l++)c[l-1]=arguments[l];u.fn.apply(u.context,c)}else{var p,h=u.length;for(l=0;l<h;l++)switch(u[l].once&&this.removeListener(e,u[l].fn,void 0,!0),d){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,t);break;case 3:u[l].fn.call(u[l].context,t,i);break;case 4:u[l].fn.call(u[l].context,t,i,o);break;default:if(!c)for(p=1,c=new Array(d-1);p<d;p++)c[p-1]=arguments[p];u[l].fn.apply(u[l].context,c)}}return!0},s.prototype.on=function(e,t,n){return r(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return r(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,i,o){var r=n?n+e:e;if(!this._events[r])return this;if(!t)return a(this,r),this;var s=this._events[r];if(s.fn)s.fn!==t||o&&!s.once||i&&s.context!==i||a(this,r);else{for(var c=0,l=[],u=s.length;c<u;c++)(s[c].fn!==t||o&&!s[c].once||i&&s[c].context!==i)&&l.push(s[c]);l.length?this._events[r]=1===l.length?l[0]:l:a(this,r)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new i,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s}));class _i extends yi{constructor(){super(),this.debug=un("zmp:event-emitter")}static getInstance(){return _i.instance||(_i.instance=new _i),_i.instance}h5ConfirmHandleEvent(e,t,n){ZaloJavaScriptInterface.jsH5EventCallback(e,t,n||"")}on(e,t,n){this.debug(`register ${e}: ${n}`);return super.on(e,((i,o)=>{this.h5ConfirmHandleEvent(i,e,n),t(o)}),n)}once(e,t,n){this.debug(`register once ${e}: ${n}`);return super.once(e,((i,o)=>{this.h5ConfirmHandleEvent(i,e,n),t(o)}),n)}}var Ei={},Si=function(e,t,n){var i=t||"default";return function(){var t=i in Ei?Ei[i](e,n):e;return t.apply(this,arguments)}};Si.setWrapper=function(e){var t=arguments.length<=1||void 0===arguments[1]?"default":arguments[1];Ei[t]=e};var Ai={error:{code:1,error_subcode:1357046,message:"Received Invalid JSON reply.",type:"http"}};function Oi(e){try{return null===e?Ai:JSON.parse(e)}catch(e){return Ai}}var Ti,bi={execute:function(e,t,n,i){n.suppress_http_code=1;var o=Qn.encode(n);"post"!=t&&(e=Qn.appendToUrl(e,o),o="");var r=function(e,t){if(!self.XMLHttpRequest)return null;var n=new XMLHttpRequest,i=function(){};if(!("withCredentials"in n))return null;n.open(e,t,!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded");var o={send:function(e){n.send(e)}},r=Si((function(){r=i,"onload"in o&&o.onload(n)}),"entry","XMLHttpRequest:load"),a=Si((function(){a=i,"onerror"in o&&o.onerror(n)}),"entry","XMLHttpRequest:error");return n.onload=function(){r()},n.onerror=function(){a()},n.onreadystatechange=function(){4==n.readyState&&(200==n.status?r():a())},o}(t,e);return!!r&&(r.onload=function(e){i(Oi(e.responseText))},r.onerror=function(e){e.responseText?i(Oi(e.responseText)):i({error:{code:1,error_subcode:1357045,message:"unknown error (empty response)",status:e.status,type:"http"}})},r.send(o),!0)}};class wi extends yi{constructor(){super(),this.debug=un("zmp:ZaloJSBridge"),this.events=_i.getInstance(),this._accessTk=li("zacc_session")||"DEFAULT_ACCESS_TOKEN",this._jsAccessTk=li("zlink3rd")||"DEFAULT_JS_TOKEN",this.results=[],this._userAgent=ii(),this._device=oi(),this._jsCallFuncCallbacks={},this.events.on(exports.Events.AppPaused,(()=>{if(this.results.length>0){let e=this.results;this.results=[];try{this.sendLogData(e)}catch(e){}}})),this.sendLogTimer?clearInterval(this.sendLogTimer):this.sendLogTimer=setInterval((()=>{if(this.results.length>0){let e=this.results;this.results=[];try{this.sendLogData(e)}catch(e){}}}),5e3)}static getInstance(){return wi.instance||(wi.instance=new wi),wi.instance}set accessTk(e){this._accessTk=e}set jsAccessTk(e){this._jsAccessTk=e}sendLogData(e){try{bi.execute("https://h5.zalo.me/log/async","post",{appId:window.APP_ID,data:JSON.stringify(e)},(e=>{}))}catch(e){}}onJSCall(e,t){try{this.debug("onJSCall",e,t);const n=ui(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,i=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,n)}catch(e){console.error("Call callback error",e)}i&&clearTimeout(i),this._jsCallFuncCallbacks[e]=null,delete this._jsCallFuncCallbacks[e]}}this.results.push({action:n.action,error:n.error_code})}catch(e){console.log("onJSCall","error",e)}}onMultiJSCall(e,t){try{this.debug("onMultiJSCall",e,t);const n=ui(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,i=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,n)}catch(e){console.error("Call callback error",e)}i&&clearTimeout(i)}}this.results.push({action:n.action,error:n.error_code})}catch(e){console.log("onMultiJSCall","error",e)}}nativeEventHandler(e,t,n){this.debug(`eventId: ${e}, eventName: ${t}, eventData: ${n}`);const i=vi(n);this.debug(i);const o=this.handleEventData(t,i);this.events.emit(t,e,o)}handleEventData(e,t){try{switch(e){case exports.Events.OpenApp:const{url:e}=t,n=new URL(e),i=n.pathname.split(`/zapps/${fn}`)[1];return{path:`${i||"/"}${n.search}`};default:return t}}catch(e){return t}}defaultCallback(e){null!=e&&(e=ui(e))}jsCall(e,t,n,i=!1,o=3,r=!0){try{const a=e.name,s=((e="")=>`${e.normalize("NFD").replace(Yn,"").replace(Xn,"d").replace(ei,"").toLowerCase()}_${Math.random().toString(36).substr(2,4)}`)(a);if(!this._device.isMobile||ln.isEmpty(a))return this.onJSCall(s,{error_code:-13,error_message:"params invalid!",data:{device:this._device.isMobile,jsToken:this._jsAccessTk,access_token:this._accessTk},action:a}),!1;null==t&&(t={}),n||(n=this.defaultCallback);const c={error_code:-14,error_message:"Request Timeout!",data:{},action:a};this._jsCallFuncCallbacks[s]={timeout:r&&e.have_callback&&setTimeout((()=>{this.onJSCall(s,c)}),8e3),callback:n};try{return t=di(t),i?this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,window.onMultiJSCall(s)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,`window.onMultiJSCall('${s}')`):this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,window.onJSCall(s)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,`window.onJSCall('${s}')`)}catch(r){if(!(o-- >0)){const e={error_code:-5,error_message:"Not ready!",data:{userAgent:this._userAgent,options:t,jsToken:this._jsAccessTk,access_token:this._accessTk},action:a,js_error:r};return this.onJSCall(s,e),!1}setTimeout((()=>{this.jsCall(e,t,n,i,o)}),500)}}catch(e){console.log("jsCall","error",e)}return!1}}class Ni{constructor(){this.debug=un("zmp:ZJSBridgeProvider"),Ti.set(this,void 0),o(this,Ti,wi.getInstance(),"f")}setZAccSession(e){i(this,Ti,"f").accessTk=e}setJSToken(e){i(this,Ti,"f").jsAccessTk=e}callNative(e,t,o){return this.debug(e.name,t),new Promise(((r,a)=>{const s=i=>n(this,void 0,void 0,(function*(){try{const n=new Hn(i.error_code,`${i.action}: ${i.error_message}`);if(null==o?void 0:o.callback){const e=yield o.callback(i,n);return r(e)}if(i&&i.error_code>=0)r(i.data||{});else if(i&&i.error_code<0){try{window.zmpSentry&&window.zmpSentry.captureMessage(`${e.name}: call native fail`,{extra:{data:t,rs:i}})}catch(e){}return a(n)}}catch(e){return a(e)}})),c=oi().isIOS,l=(e=>{var t;const n=ai(),i=(null===(t=null==e?void 0:e.version_live)||void 0===t?void 0:t.iOS)||0;return!!(Array.isArray(window.ignoreCheckSupport)&&window.ignoreCheckSupport.length>0&&window.ignoreCheckSupport.includes(e.name))||n>=i})(e);if(c&&!l){const t=new Hn(-5,`${e}: Client isn't support this action`);return a(t)}(null==o?void 0:o.delay)?setTimeout((()=>{i(this,Ti,"f").jsCall(e,t,s,null==o?void 0:o.isMultiCallback,null==o?void 0:o.nRetry,null==o?void 0:o.haveTimeout)}),o.delay):i(this,Ti,"f").jsCall(e,t,s,null==o?void 0:o.isMultiCallback,null==o?void 0:o.nRetry,null==o?void 0:o.haveTimeout)}))}}Ti=new WeakMap;var Pi,Ii,Ci,ki,Ri;class Bi{static getVersion(){return"2.19.0-rc.4"}static getSystemInfo(){return{version:ri("version-id")||"",apiVersion:"2.19.0-rc.4",zaloVersion:ai(),platform:si(),language:navigator.language,zaloLanguage:window.zLanguage||"vi",zaloTheme:window.zTheme||"light"}}static getAppInfo(){return n(this,void 0,void 0,(function*(){const e=this.getAppId(),t=this.getSystemInfo();return yield gi(e,0,t.version)}))}}class Di{static setNavigationBarTitle(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.CHANGE_TITLE_HEADER,{title:e.title},{haveTimeout:!1})}))}static setNavigationBarColor(e){return n(this,void 0,void 0,(function*(){const t={};let n;ln.isEmpty(e.textColor)||(t.textColor=e.textColor),ln.isString(e.color)&&e.color.length>0?(ln.isEmpty(e.color)||(t.backgroundColor=e.color),n=5):(ln.isEmpty(e.statusBarColor)||(t.backgroundColor=e.statusBarColor),n=6),this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{actionbarType:n,dataConfig:Object.assign(Object.assign({},e.dataConfig),t)}))),yield this.callNative(bn.CHANGE_ACTIONBAR,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarLeftButton(e){return n(this,void 0,void 0,(function*(){const t="none"===e.type||"home"===e.type?Ln:Mn,n="home"===e.type||"both"===e.type?xn:Un;this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{buttonType:t,dataConfig:Object.assign(Object.assign({},e.dataConfig),{viewInLeftType:t}),homeConfig:Object.assign(Object.assign({},e.homeConfig),{enable:n})}))),yield this.callNative(bn.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarRightButton(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.CREATE_OPTIONS_MENU,{supportToolBar:e.supportToolBar,reset:e.reset,menuListItems:e.menuListItems,zapp:this.getAppId()})}))}}class ji{static setBackgroundColor(e){return n(this,void 0,void 0,(function*(){ln.isString(e.backgroundColor)&&e.backgroundColor.length>0&&(yield this.callNative(bn.CHANGE_ACTIONBAR,{actionbarType:this.isShowNavBar?5:6,dataConfig:{backgroundColor:e.backgroundColor,textColor:e.textColor}}))}))}}class Mi{constructor(e,t,n,i){this.title=i,this.severity=t;const o=new Date;if(this.time=o.toLocaleTimeString(),this.content=e,n>0){const e=(new Error).stack;this.stack=e?e.replace("Error\n",""):""}}toString(){return(this.content.stack?[this.title,this.severity.toUpperCase(),this.time,this.content,this.content.stack.replace("Error:","")]:[this.title,this.severity.toUpperCase(),this.time,JSON.stringify(this.content),this.stack]).join(" ")}}Pi=new WeakMap,Ii=new WeakMap,Ci=new WeakMap,ki=new WeakMap,Ri=new WeakMap;var Li,xi,Ui,Wi,zi,Fi,Gi,Hi,$i,Vi,Zi,Ji,Ki,qi,Qi,Yi,Xi,eo,to,no,io,oo,ro,ao,so,co,lo,uo,po=new class{constructor(){Pi.set(this,3),Ii.set(this,["none","error","warn","info"]),Ci.set(this,"[zmp] > "),ki.set(this,{error:0,warn:0,info:0,firstError:null,lastError:null}),Ri.set(this,((e,t,n)=>{i(this,ki,"f")[i(this,Ii,"f")[e]]++;const r=i(this,Ii,"f")[e];if(o(this,Ci,i(this,Ci,"f")+("string"!=typeof t?new Mi(t,r,e,n).toString():t),"f"),!(e>i(this,Pi,"f")))switch(e){case 1:console.error(i(this,Ci,"f"));break;case 2:console.warn(i(this,Ci,"f"));break;case 3:console.info(i(this,Ci,"f"));break;default:throw new Error("internal")}}))}setLogLevel(e){o(this,Pi,e,"f")}info(e){i(this,Ri,"f").call(this,3,e)}warn(e,t){i(this,Ri,"f").call(this,2,e,t)}error(e,t){i(this,Ri,"f").call(this,1,e,t)}getMetrics(){return i(this,ki,"f")}};class ho{static setDeviceOrientation(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.CHANGE_AUTOROTATE,{autoRotate:exports.OrientationType[e.rotate]})}))}static getNetworkType(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.WEBVIEW_NETWORKTYPE,{url:window.location.href,featureId:""}).then((e=>{const t=e.network;let n;const i=oi().isAndroid;switch(t){case Tn(i).NONE:n=exports.NetworkType.none;break;case Tn(i).WIFI:n=exports.NetworkType.wifi;break;case Tn(i)["2G"]:case Tn(i)["3G"]:case Tn(i)["4G"]:n=exports.NetworkType.cellular;break;default:n=exports.NetworkType.unknown}return{networkType:n}}))}))}static onNetworkStatusChange(e){return n(this,void 0,void 0,(function*(){yield this.events.on(exports.Events.NetworkChanged,(t=>{const n=t&&t.state;this.getNetworkType().then((t=>{const i={isConnected:"CONNECTED"===n,networkType:t&&t.networkType};e(i)})).catch((e=>{po.error(e,"onNetworkStatusChange")}))}))}))}static startBeaconDiscovery(e){var t,i,o,r,a;return n(this,void 0,void 0,(function*(){const n={subaction:0,scanning_type:ln.isNumber(null==e?void 0:e.scanningType)?e.scanningType:0,data:{scan_from_source:ln.isString(null==e?void 0:e.scanFromSource)?e.scanFromSource:"",expire:ln.isNumber(null==e?void 0:e.expire)?e.expire:3e3,monitor_interval:ln.isNumber(null==e?void 0:e.monitorInterval)?e.monitorInterval:60,domain:ln.isString(null==e?void 0:e.domain)?e.domain:"",scan_config:{scan_time:ln.isNumber(null===(t=null==e?void 0:e.scanConfig)||void 0===t?void 0:t.scanTime)?e.scanConfig.scanTime:15e3,time_between_scan:ln.isNumber(null===(i=null==e?void 0:e.scanConfig)||void 0===i?void 0:i.timeBetweenScan)?e.scanConfig.timeBetweenScan:1e4,beacon_timeout:ln.isNumber(null===(o=null==e?void 0:e.scanConfig)||void 0===o?void 0:o.beaconTimeout)?e.scanConfig.beaconTimeout:3e4,delayCheckConnectedTimeout:ln.isNumber(null===(r=null==e?void 0:e.scanConfig)||void 0===r?void 0:r.delayCheckConnectedTimeout)?e.scanConfig.delayCheckConnectedTimeout:5e3,beaconConnectedTimeout:ln.isNumber(null===(a=null==e?void 0:e.scanConfig)||void 0===a?void 0:a.beaconConnectedTimeout)?e.scanConfig.beaconConnectedTimeout:6e5},items:Array.isArray(null==e?void 0:e.items)?null==e?void 0:e.items:[]}};return yield this.callNative(bn.SCAN_IBEACON,Object.assign({},n)),!0}))}static stopBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.SCAN_IBEACON,Object.assign({},{subaction:2})),!0}))}static getBeacons(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.SCAN_IBEACON,Object.assign({},{subaction:1}),{isMultiCallback:!0}).then((e=>{const t={beacons:[]};return Array.isArray(e)&&e.forEach((e=>{const n={uuid:e.uuid,major:e.major,minor:e.minor,distance:e.distance,rssi:e.rssi};t.beacons.push(n)})),t}))}))}static stopBluetoothDevicesDiscovery(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static startBluetoothDevicesDiscovery(e){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},Object.assign({},e))}))}static openBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static onBluetoothDeviceFound(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static onBluetoothAdapterStateChange(){return n(this,void 0,void 0,(function*(){return Promise.resolve()}))}static getConnectedBluetoothDevices(e){return n(this,void 0,void 0,(function*(){const t={services:e.services||[]};return this.callNative({name:""},t)}))}static getBluetoothDevices(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static getBluetoothAdapterState(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static closeBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static scanQRCode(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.OPEN_QR,{skipOpenLink:!0})}))}static showToast(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.SHOW_TOAST,{toast:e.message})}))}static hideKeyboard(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.HIDE_KEYBOARD,{})}))}static openPhone(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.OPEN_PHONE,{phoneNum:e.phoneNumber,phoneCode:e.phoneNumber})}))}static openSMS(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.OPEN_SMS,{content:e.content,phoneCode:e.phoneNumber})}))}static keepScreen(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.KEEP_SCREEN,{data:{keep_screen_on:e.keepScreenOn?1:0}})}))}static openBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.PROMPT_AUTHENTICATION,{secret_data:e.secretData,app_id:this.getZAppId(),ui:{title:e.ui.title,sub_title:e.ui.subTitle,negative_text:e.ui.negativeButtonText},require_fingerprint:e.requireFingerprint?1:0}).then((e=>{var t,n,i,o;return{code:null==e?void 0:e.error_code,message:null==e?void 0:e.error_message,data:{domain:null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.domain,code:null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.error_code,message:null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.error_message,payToken:null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.pay_token}}}))}))}static checkStateBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.PROMPT_AUTHENTICATION_CHECK_STATE,{}).then((e=>({bioState:null==e?void 0:e.bio_state})))}))}static vibrate(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.INTERACTIVE_VIBRATION,{type:exports.VibrateType[e.type],vibrate_time:e.milliseconds})}))}static connectWifi(e){return n(this,void 0,void 0,(function*(){let t="open";return ln.isString(e.password)&&e.password.length>0&&(t="wpa_wpa2"),yield this.callNative(bn.MP_JOIN_WIFI,{ssid:e.SSID,securityType:t,password:e.password,hiddenSsid:e.hiddenSSID})}))}}class vo{constructor(e){Li.set(this,localStorage),xi.set(this,void 0),Ui.set(this,void 0),oi(),o(this,Ui,{keys:new Set,currentSize:0,limitSize:5242880},"f"),o(this,xi,e,"f"),this.findAllCurrentDataByApp(e)}findAllCurrentDataByApp(e){try{let t;for(t in i(this,Li,"f")){if(e){if(t.split("_")[0]!==e)continue}i(this,Ui,"f").keys.add(t)}}catch(e){po.error(e,"LocalResourceStorage > findAllCurrentDataByApp")}}get(e){let t=new Map;return e.forEach((e=>{t.set(e,this.getSync(e))})),Promise.resolve(t)}getSync(e){return i(this,xi,"f")&&(e=`${i(this,xi,"f")}_${e}`),i(this,Ui,"f").keys.has(e)?i(this,Li,"f").getItem(e):null}set(e){return n(this,void 0,void 0,(function*(){return Object.entries(e).forEach((([e,t])=>{this.setSync(e,t.replace(/\\"/g,'"'))})),Promise.resolve({errorKeys:[]})}))}setSync(e,t){i(this,xi,"f")&&(e=`${i(this,xi,"f")}_${e}`),i(this,Li,"f").setItem(e,t),i(this,Ui,"f").keys.add(e)}getInfo(){return n(this,void 0,void 0,(function*(){return Promise.resolve(this.getInfoSync())}))}getInfoSync(){const e=((e,t)=>{let n,i,o=0;for(i in e){const r=i.split("_")[0];e.hasOwnProperty(i)&&(t&&r!==t||(n=2*(e[i].length+i.length),o+=n))}return o})(i(this,Li,"f"),i(this,xi,"f"));return{currentSize:ln.isNumber(e)?Number((e/1024).toFixed(2)):0,limitSize:Number(5120..toFixed(2))}}remove(e){return n(this,void 0,void 0,(function*(){return e.forEach((e=>{this.removeSync(e)})),Promise.resolve({errorKeys:[]})}))}removeSync(e){i(this,xi,"f")&&(e=`${i(this,xi,"f")}_${e}`),i(this,Ui,"f").keys.has(e)&&(i(this,Li,"f").removeItem(e),i(this,Ui,"f").keys.delete(e))}clear(){return n(this,void 0,void 0,(function*(){return Promise.resolve(this.clearSync())}))}clearSync(){i(this,Ui,"f").keys.forEach((e=>{i(this,xi,"f")&&e.indexOf(i(this,xi,"f"))<0||(i(this,Li,"f").removeItem(e),i(this,Ui,"f").keys.delete(e))}))}}Li=new WeakMap,xi=new WeakMap,Ui=new WeakMap;class fo extends Ni{constructor(e){super(),Wi.set(this,void 0),zi.set(this,void 0),o(this,zi,{keys:new Set,currentSize:0,limitSize:5242880},"f"),o(this,Wi,e,"f")}get(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.ZBROWSER_MPDS,{mpds_action:"mpds.get",mpds_data:{keys:e},appId:i(this,Wi,"f")},{isMultiCallback:!1}).then((e=>{let t=new Map;return e&&e.mpds_data&&e.mpds_data.map&&(t=new Map(Object.entries(e.mpds_data.map))),t}))}))}set(e){return n(this,void 0,void 0,(function*(){return{errorKeys:yield this.callNative(bn.ZBROWSER_MPDS,{mpds_action:"mpds.set",mpds_data:{map:e},appId:i(this,Wi,"f")},{isMultiCallback:!1}).then((e=>{let t=[];return e&&e.mpds_data&&e.mpds_data.error_keys&&(t=e.mpds_data.error_keys),t}))}}))}getInfo(){return n(this,void 0,void 0,(function*(){const e=yield this.callNative(bn.ZBROWSER_MPDS,{mpds_action:"mpds.get.size",mpds_data:{},appId:i(this,Wi,"f")},{isMultiCallback:!1}).then((e=>{let t=0;return e&&e.mpds_data&&e.mpds_data.size&&(t=e.mpds_data.size),t}));return{currentSize:ln.isNumber(e)?Number(e/1024):0,limitSize:Number(5120)}}))}remove(e){return n(this,void 0,void 0,(function*(){return{errorKeys:yield this.callNative(bn.ZBROWSER_MPDS,{mpds_action:"mpds.remove.key",mpds_data:{keys:e},appId:i(this,Wi,"f")},{isMultiCallback:!1}).then((e=>{let t=[];return e&&e.mpds_data&&e.mpds_data.error_keys&&(t=e.mpds_data.error_keys),t}))}}))}clear(){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.ZBROWSER_MPDS,{mpds_action:"mpds.clear.appData",mpds_data:{},appId:i(this,Wi,"f")})}))}}Wi=new WeakMap,zi=new WeakMap;class mo{getDataFromStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance(),n=yield t.get(e),i={};return n.forEach(((e,t)=>{i[t]=vi(e)})),i}))}putDataToStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance(),n={};return Object.entries(e).forEach((([e,t])=>{ln.isUndefined(t)||ln.isNull(t)||(n[e]=hi(t))})),yield t.set(n)}))}removeDataFromStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance();return yield t.remove(e)}))}clearStorage(){return n(this,void 0,void 0,(function*(){const e=this.getInstance();yield e.clear()}))}getStorageInfo(){return n(this,void 0,void 0,(function*(){const e=this.getInstance();return yield e.getInfo()}))}}class go extends mo{constructor(e){super(),Fi.set(this,void 0),o(this,Fi,e,"f")}getInstance(){return new vo(i(this,Fi,"f"))}}Fi=new WeakMap;class yo extends mo{constructor(e){super(),Gi.set(this,void 0),o(this,Gi,e,"f")}getInstance(){return new fo(i(this,Gi,"f"))}}Gi=new WeakMap;class _o{static setStorage(e){return n(this,void 0,void 0,(function*(){let t=new go(this.getAppId());return pi()&&(t=new yo(this.getAppId())),yield t.putDataToStorage(e.data)}))}static getStorage(e){return n(this,void 0,void 0,(function*(){let t=new go(this.getAppId());pi()&&(t=new yo(this.getAppId()));return yield t.getDataFromStorage(e.keys)}))}static getStorageInfo(e){return n(this,void 0,void 0,(function*(){let e=new go(this.getAppId());return pi()&&(e=new yo(this.getAppId())),yield e.getStorageInfo()}))}static removeStorage(e){return n(this,void 0,void 0,(function*(){let t=new go(this.getAppId());return pi()&&(t=new yo(this.getAppId())),yield t.removeDataFromStorage(e.keys)}))}static clearStorage(e={}){return n(this,void 0,void 0,(function*(){let e=new go(this.getAppId());pi()&&(e=new yo(this.getAppId())),yield e.clearStorage()}))}}class Eo{static getUserInfo(e){return n(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();let i="id,name,picture";(null==e?void 0:e.avatarType)&&(i=`${i}.type(${null==e?void 0:e.avatarType})`);return{userInfo:yield fetch(`${En}?fields=${i}`,{headers:{access_token:t||""}}).then((e=>n(this,void 0,void 0,(function*(){const t=yield e.json(),n={id:t.id,name:t.name,birthday:"",gender:"",avatar:t.picture&&t.picture.data&&t.picture.data.url};return console.warn("'birthday' and 'gender' are deprecated"),n}))))}}))}static getPhoneNumber(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.MP_GET_NUMBER,{},{isMultiCallback:!0,callback:(e,t)=>{if(0===e.error_code){const t={number:e.data};return Promise.resolve(t)}return Promise.reject(t)},delay:this.isIOS?400:0})}))}}class So{static closeApp(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.WINDOW_CLOSE,{})}))}static openMiniApp(e){return n(this,void 0,void 0,(function*(){const t=null==e?void 0:e.appId,n=(null==e?void 0:e.params)||{},i=Object.entries(n).map((function([e,t]){return[e,t].join("=")})).join("&");let o;try{o=yield gi(t,0)}catch(e){}const r={appId:t};o&&(r.appName=o.name,r.appAvtUrl=o.logoUrl),yield this.callNative(bn.OPEN_MP,{mpUrl:`https://h5.zdn.vn/zapps/${t}/${i.length>0?"?"+i:""}`,mpInfo:r})}))}static openWebview(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.OPEN_INAPP,{url:e.url})}))}static closeLoading(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.MP_CLOSE_LOADINGVIEW,{at:(new Date).getTime(),when:e,url:location.href})}))}}class Ao{static getLocation(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.GET_LOCATION,{silent_request:!1,permission_description:"Cho phép Zalo truy cập vào vị trí của thiết bị này?"},{isMultiCallback:!0,haveTimeout:!1,callback:(e,t)=>{if(0===e.error_code){const t=e.data,n={latitude:t.latitude,longitude:t.longitude,timestamp:t.timestamp,provider:t.provider};return Promise.resolve(n)}return Promise.reject(t)},delay:this.isIOS?400:0})}))}static sendLocation(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.QUERY_LOCATION_HIDE,{title:e.title,touserid:e.toUserId,zapp:this.getZAppId()})}))}}class Oo{static requestCameraPermission(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.REQUEST_PERMISSION_CAMERA,{},{callback:(e,t)=>-2===e.error_code||e.error_code>=0?Promise.resolve({userAllow:-2!==e.error_code,message:e.error_message}):Promise.reject(t)})}))}static saveImageToPhotosAlbum(e){return n(this,void 0,void 0,(function*(){let t={};return ln.isEmpty(e.imageBase64Data)?ln.isEmpty(e.imageUrl)||(t={imageUrl:e.imageUrl}):t={imageBase64Data:e.imageBase64Data},yield this.callNative(bn.SAVE_IMAGE_GALLERY,Object.assign({},t))}))}}class To{static viewOAQr(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.VIEW_MYQR,{dpn:e.displayName,uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openProfile(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.OPEN_PROFILE,{uId:e.id,type:exports.ProfileType[e.type],zapp:this.getZAppId(),sourceId:e.sourceId,sourceIndex:e.sourceIndex})}))}static openChat(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.OPEN_CHAT,{uId:e.id,type:exports.ChatType[e.type],zapp:this.getZAppId(),sourceId:e.sourceId,sourceIndex:e.sourceIndex})}))}static openPostFeed(e){return n(this,void 0,void 0,(function*(){let t={};switch(e.type){case"image":t={photoUrl:e.data.imageUrl};break;case"link":t={link:e.data.link,title:e.data.title,thumb:e.data.thumb,description:e.data.description};break;case"profile":t={avt:e.data.avatar,uid:e.data.id,dpn:e.data.displayName}}return yield this.callNative(bn.OPEN_POSTFEED,Object.assign(Object.assign({type:exports.PostFeedType[e.type]},t),{zapp:this.getZAppId()})).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static followOA(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.FOLLOW_OA,{uid:e.id,showDialogConfirm:!0,zapp:this.getZAppId()},{haveTimeout:!1})}))}static unfollowOA(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.UNFOLLOW_OA,{uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openShareSheet(e){return n(this,void 0,void 0,(function*(){let t={};switch(e.type){case"image":let n=[];Array.isArray(e.data.imageUrls)&&e.data.imageUrls.length>0?n=e.data.imageUrls:n.push(e.data.imageUrl),t={photoUrls:n,photoUrl:e.data.imageUrl,caption:e.data.caption};break;case"gif":t={photoUrl:e.data.imageUrl,gifUrl:e.data.gifUrl,width:e.data.width,height:e.data.height};break;case"video":t={videoThumb:e.data.videoThumb,videoUrl:e.data.videoUrl,width:e.data.width,height:e.data.height};break;case"link":t={link:e.data.link,chatOnly:e.data.chatOnly?1:0};break;case"oa":t={uid:e.data.id};break;case"zmp":const i=yield this.getAccessToken(),o=yield fi(this.getAppId(),i||"",e.data.title||"",e.data.description||"",e.data.thumbnail||"",e.data.path);window.forceShareZMP?t={data:{ZInstantAPIInfo:{url:`${o.zinstantApi}`,zinstantdata_id:`templateId=${o.ztemplateId}&appId=${this.getAppId()}&shareId=${o.shareId}`},previewMsgText:{msg:{en:"Zalo Mini Program",vi:"Chương trình nhỏ"}},enableReactions:1}}:(t={link:o.shareableLink,chatOnly:e.data.chatOnly?1:0},e.type="link")}return yield this.callNative(bn.OPEN_SHARESHEET,Object.assign(Object.assign({type:exports.ShareSheetType[e.type]},t),{zapp:this.getZAppId()}),{haveTimeout:!1}).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static createShortcut(e,t,i){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.CREATE_SHORTCUT,{url:e,title:t,iconUrl:i})}))}static openProfilePicker(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.MP_OPEN_PROFILE_PICKER,{maxProfile:e},{isMultiCallback:!0,callback:(e,t)=>0===e.error_code&&Array.isArray(e.data)?Promise.resolve(e.data.map((e=>e.id))):Promise.reject(t)})}))}static getActionsSupported(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.GET_SUPPORTED_ACTIONS,{},{isMultiCallback:!1,callback:(e,t)=>{const n=si();if(Array.isArray(e.actions)&&e.actions.length>0){const t=Object.keys(bn).filter((e=>bn[e].skip_jump)),n={actions:[...e.actions,...t]};return Promise.resolve(n)}if(n===exports.PlatformType.iOS){const e={actions:jn};return Promise.resolve(e)}return Promise.reject(t)}})}))}static openMediaPicker(e,t,i,o){return n(this,void 0,void 0,(function*(){const n={type:0,url:"https://zapi-server.tungnt.xyz/upload/photos",maxSize:1048576};return yield this.callNative(bn.PICK_MEDIA,{media_type:exports.MediaPickerType[e],edit_view:Object.assign(Object.assign({},{enable:1,aspect_ratio:"1:1"}),t),silent_request:i,upload:n,max_select_item:o},{isMultiCallback:!0,callback:(e,t)=>{var n,i;if(0===e.error_code){const t=vi(null===(n=e.data)||void 0===n?void 0:n.result_content),o={urls:null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.urls};return Promise.resolve(o)}return Promise.reject(t)}})}))}static openOutApp(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.OPEN_OUTAPP,{url:e})}))}}class bo{static getRouteParams(){let e={};const t=window.location.href;try{let n=new URL(t).searchParams.toString();n&&(e=Qn.getParamsAsObject(n))}catch(e){throw new Error("Url không hợp lệ")}return e}static sendDataToPreviousMiniApp(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.WEBVIEW_SET_RESULT,{result:hi(e.data)})}))}static onCallbackData(e){return n(this,void 0,void 0,(function*(){yield this.events.on(exports.Events.OnDataCallback,(t=>{e({data:t})}))}))}}class wo extends Ni{constructor(){var e,t,n,r,a,s,c,l,u,d,p,h,v,f,m,g,y;super(),Hi.set(this,vn),$i.set(this,fn),Vi.set(this,mn),Zi.set(this,void 0),Ji.set(this,void 0),Ki.set(this,void 0),qi.set(this,null),Qi.set(this,{timer:{getToken:0}}),Yi.set(this,void 0),Xi.set(this,void 0),eo.set(this,null),this.events=_i.getInstance(),this.isIOS=oi().isIOS,to.set(this,void 0),this.getActionBarConfig=()=>i(this,to,"f"),this.setActionBarConfig=e=>{o(this,to,e(i(this,to,"f")),"f")},no.set(this,(()=>new Promise(((e,t)=>{ln.isUndefined(i(this,eo,"f"))||ln.isNull(i(this,eo,"f"))?this.callNative(bn.JUMP_LOGIN,{}).then((t=>{const n=t&&t.cookiesOAuthLogins||[],i=n.find((e=>e.name===yn));i&&(this.setJSToken(i.value),window.ZJSBridge.setJSToken&&window.ZJSBridge.setJSToken(i.value)),o(this,eo,n,"f"),e(n)})).catch((e=>{t(e)})):e(i(this,eo,"f"))})))),io.set(this,Di.setNavigationBarRightButton),this.getVersion=Bi.getVersion,this.getSystemInfo=Bi.getSystemInfo,this.setNavigationBarTitle=Di.setNavigationBarTitle,this.setNavigationBarColor=Di.setNavigationBarColor,this.setNavigationBarLeftButton=Di.setNavigationBarLeftButton,this.setBackgroundColor=ji.setBackgroundColor,this.setDeviceOrientation=ho.setDeviceOrientation,this.setStorage=_o.setStorage,this.getStorage=_o.getStorage,this.getStorageInfo=_o.getStorageInfo,this.removeStorage=_o.removeStorage,this.clearStorage=_o.clearStorage,this.getUserInfo=Eo.getUserInfo,this.getNetworkType=ho.getNetworkType,this.onNetworkStatusChange=ho.onNetworkStatusChange,this.startBeaconDiscovery=ho.startBeaconDiscovery,this.stopBeaconDiscovery=ho.stopBeaconDiscovery,this.getBeacons=ho.getBeacons,this.closeApp=So.closeApp,this.getLocation=Ao.getLocation,this.stopBluetoothDevicesDiscovery=ho.stopBluetoothDevicesDiscovery,this.startBluetoothDevicesDiscovery=ho.stopBluetoothDevicesDiscovery,this.openBluetoothAdapter=ho.openBluetoothAdapter,this.onBluetoothDeviceFound=ho.onBluetoothDeviceFound,this.onBluetoothAdapterStateChange=ho.onBluetoothAdapterStateChange,this.getConnectedBluetoothDevices=ho.getConnectedBluetoothDevices,this.getBluetoothDevices=ho.getBluetoothDevices,this.getBluetoothAdapterState=ho.getBluetoothAdapterState,this.closeBluetoothAdapter=ho.closeBluetoothAdapter,this.scanQRCode=ho.scanQRCode,this.openProfile=To.openProfile,this.openChat=To.openChat,this.openPostFeed=To.openPostFeed,this.followOA=To.followOA,this.unFollowOA=To.unfollowOA,this.openShareSheet=To.openShareSheet,this.requestCameraPermission=Oo.requestCameraPermission,this.createShortcut=To.createShortcut,this.openBioAuthentication=ho.openBioAuthentication,this.checkStateBioAuthentication=ho.checkStateBioAuthentication,this.sendLocation=Ao.sendLocation,this.showToast=ho.showToast,this.hideKeyboard=ho.hideKeyboard,this.openPhone=ho.openPhone,this.openSMS=ho.openSMS,this.viewOAQr=To.viewOAQr,this.keepScreen=ho.keepScreen,this.saveImageToPhotosAlbum=Oo.saveImageToPhotosAlbum,this.openMiniApp=So.openMiniApp,this.vibrate=ho.vibrate,this.openWebview=So.openWebview,this.getRouteParams=bo.getRouteParams,this.getAppInfo=Bi.getAppInfo,this.sendDataToPreviousMiniApp=bo.sendDataToPreviousMiniApp,this.onCallbackData=bo.onCallbackData,this.getPhoneNumber=Eo.getPhoneNumber,this.openProfilePicker=To.openProfilePicker,oo.set(this,To.getActionsSupported),this.connectWifi=ho.connectWifi,this.openMediaPicker=To.openMediaPicker,this.openOutApp=To.openOutApp,this.closeLoading=So.closeLoading,o(this,Zi,null,"f"),o(this,Ji,null,"f"),o(this,Ki,null,"f"),this.isShowNavBar=!0,o(this,Yi,0,"f"),o(this,Xi,0,"f");const _="home"===(null===(t=null===(e=i(this,Vi,"f"))||void 0===e?void 0:e.app)||void 0===t?void 0:t.leftButton)||"both"===(null===(r=null===(n=i(this,Vi,"f"))||void 0===n?void 0:n.app)||void 0===r?void 0:r.leftButton)?xn:Un,E=new URL(location.href),S=ln.isString(null===(s=null===(a=i(this,Vi,"f"))||void 0===a?void 0:a.app)||void 0===s?void 0:s.headerColor)&&(null===(u=null===(l=null===(c=i(this,Vi,"f"))||void 0===c?void 0:c.app)||void 0===l?void 0:l.headerColor)||void 0===u?void 0:u.length)>0?5:6,A="none"===(null===(p=null===(d=i(this,Vi,"f"))||void 0===d?void 0:d.app)||void 0===p?void 0:p.leftButton)||"home"===(null===(v=null===(h=i(this,Vi,"f"))||void 0===h?void 0:h.app)||void 0===v?void 0:v.leftButton)?Ln:Mn;o(this,to,{actionbarType:S,buttonType:A,dataConfig:{backgroundColor:(null===(m=null===(f=i(this,Vi,"f"))||void 0===f?void 0:f.app)||void 0===m?void 0:m.headerColor)||"",textColor:(null===(y=null===(g=i(this,Vi,"f"))||void 0===g?void 0:g.app)||void 0===y?void 0:y.textColor)||"",viewInLeftType:A,confirmToExit:1},homeConfig:{enable:_,url:`https://h5.zdn.vn/zapps/${this.getAppId()}/${E.search}`}},"f")}static getInstance(){return wo.instance||(wo.instance=new wo),wo.instance}getLoginStatus(){return ln.isString(i(this,Ki,"f"))&&i(this,Ki,"f").length>0}getAppId(){return i(this,$i,"f")}getZAppId(){return i(this,Hi,"f")}login(e){return n(this,void 0,void 0,(function*(){const e=yield i(this,no,"f").call(this),t=e.find((e=>e.name===gn)),n=e.find((e=>e.name===_n));if(!ln.isUndefined(t)&&!ln.isNull(t)&&ln.isString(t.value)){if(o(this,Zi,t.value,"f"),ln.isUndefined(n)||ln.isNull(n)||!ln.isString(n.value)?yield this.loginZaloV3():(o(this,Ji,n.value,"f"),yield this.loginZaloV4()),!i(this,Ki,"f"))throw Kn.loginFailed();return i(this,Ki,"f")}throw Kn.loginFailed()}))}loginZaloV3(){return n(this,void 0,void 0,(function*(){return yield fetch(`${An}?app_id=${i(this,Hi,"f")}&redirect_uri=https://h5.zdn.vn/zapps/${i(this,$i,"f")}/&code=${i(this,Zi,"f")}&isSDK=true123`).then((e=>n(this,void 0,void 0,(function*(){let t=yield e.json();if(t.access_token){o(this,Ki,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return o(this,Xi,e,"f"),o(this,Yi,(new Date).getTime(),"f"),this.setZAccSession(i(this,Ki,"f")||""),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(i(this,Ki,"f")||""),i(this,Ki,"f")}return null}))))}))}loginZaloV4(){return n(this,void 0,void 0,(function*(){const e=new URLSearchParams;e.append("app_id",i(this,$i,"f")),e.append("code",i(this,Zi,"f")||""),e.append("code_verifier",i(this,Ji,"f")||""),ln.isNull(i(this,qi,"f"))?e.append("grant_type","authorization_code"):(e.append("grant_type","refresh_token"),e.append("refresh_token",i(this,qi,"f")||""));return yield fetch(Sn,Object.assign({method:"POST",body:e},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).then((e=>n(this,void 0,void 0,(function*(){const t=yield e.json();if(t.refresh_token&&o(this,qi,t.refresh_token,"f"),t.access_token){o(this,Ki,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return o(this,Xi,e,"f"),o(this,Yi,(new Date).getTime(),"f"),this.setZAccSession(i(this,Ki,"f")||""),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(i(this,Ki,"f")||""),i(this,Ki,"f")}return null}))))}))}getAccessToken(e){return n(this,void 0,void 0,(function*(){const e=(new Date).getTime()-i(this,Yi,"f");if(!i(this,Ki,"f"))throw Kn.loginRequired();return e<i(this,Xi,"f")?i(this,Ki,"f"):yield this.login()}))}}Hi=new WeakMap,$i=new WeakMap,Vi=new WeakMap,Zi=new WeakMap,Ji=new WeakMap,Ki=new WeakMap,qi=new WeakMap,Qi=new WeakMap,Yi=new WeakMap,Xi=new WeakMap,eo=new WeakMap,to=new WeakMap,no=new WeakMap,io=new WeakMap,oo=new WeakMap;class No{constructor(){ro.set(this,vn),ao.set(this,mn),so.set(this,"DEFAULT ZOAUTH"),co.set(this,"DEFAULT ACCESS TOKEN"),lo.set(this,{timer:{getToken:0}}),uo.set(this,!1),this.getLoginStatus=()=>i(this,uo,"f"),this.getAppId=()=>i(this,ro,"f"),this.login=()=>(o(this,uo,!0,"f"),Promise.resolve(i(this,so,"f"))),this.getAccessToken=()=>Promise.resolve(i(this,co,"f")),this.getVersion=Bi.getVersion,this.getSystemInfo=Bi.getSystemInfo,this.setNavigationBarTitle=()=>Promise.resolve(),this.setNavigationBarColor=()=>Promise.resolve(),this.setBackgroundColor=()=>Promise.resolve(),this.setNavigationBarLeftButton=()=>Promise.resolve(),this.setDeviceOrientation=()=>Promise.resolve(),this.setStorage=e=>n(this,void 0,void 0,(function*(){const t=new go(this.getAppId());return yield t.putDataToStorage(e.data),{errorKeys:[]}})),this.getStorage=e=>n(this,void 0,void 0,(function*(){const t=new go(this.getAppId());return yield t.getDataFromStorage(e.keys)})),this.getStorageInfo=e=>n(this,void 0,void 0,(function*(){const e=new go(this.getAppId());return yield e.getStorageInfo()})),this.removeStorage=e=>n(this,void 0,void 0,(function*(){const t=new go(this.getAppId());return yield t.removeDataFromStorage(e.keys)})),this.clearStorage=e=>n(this,void 0,void 0,(function*(){const e=new go(this.getAppId());return yield e.clearStorage()})),this.getUserInfo=()=>(console.warn("birthday and gender are deprecated"),Promise.resolve({userInfo:{id:"3368637342326461234",name:"User Name",avatar:"https://h5.zdn.vn/static/images/avatar.png"}})),this.getNetworkType=()=>{let e;switch((navigator.connection||navigator.mozConnection||navigator.webkitConnection).effectiveType){case"none":e=exports.NetworkType.none;break;case"4g":e=exports.NetworkType.wifi;break;case"3g":case"2g":e=exports.NetworkType.cellular;break;default:e=exports.NetworkType.unknown}const t={networkType:e};return Promise.resolve(t)},this.onNetworkStatusChange=e=>{const t=navigator.connection||navigator.mozConnection||navigator.webkitConnection,n=t.effectiveType;return t.addEventListener("change",(function(){let t;switch(n){case"none":t=exports.NetworkType.none;break;case"4g":t=exports.NetworkType.wifi;break;case"3g":case"2g":t=exports.NetworkType.cellular;break;default:t=exports.NetworkType.unknown}e({isConnected:!0,networkType:t})})),Promise.resolve()},this.startBeaconDiscovery=e=>Promise.resolve(!0),this.stopBeaconDiscovery=e=>Promise.resolve(!0),this.getBeacons=e=>Promise.resolve({beacons:[]}),this.closeApp=()=>Promise.resolve(),this.getLocation=()=>Promise.resolve({longitude:"105.788026",latitude:"21.0258773",timestamp:(new Date).getTime().toString(),provider:"fused"}),this.onBackButtonClick=()=>Promise.resolve(),this.stopBluetoothDevicesDiscovery=()=>Promise.resolve(),this.startBluetoothDevicesDiscovery=()=>Promise.resolve(),this.openBluetoothAdapter=()=>Promise.resolve(),this.onBluetoothDeviceFound=()=>Promise.resolve(),this.onBluetoothAdapterStateChange=()=>Promise.resolve(),this.getConnectedBluetoothDevices=()=>Promise.resolve(),this.getBluetoothDevices=()=>Promise.resolve(),this.getBluetoothAdapterState=()=>Promise.resolve(),this.closeBluetoothAdapter=()=>Promise.resolve(),this.scanQRCode=()=>Promise.resolve({content:"132"}),this.openProfile=()=>Promise.resolve(),this.openChat=()=>Promise.resolve(),this.openPostFeed=()=>Promise.resolve({status:1,shareType:0,numberOfUser:0}),this.followOA=()=>Promise.resolve(),this.unFollowOA=()=>Promise.resolve(),this.openShareSheet=()=>Promise.resolve({status:2,shareType:0,numberOfUser:0}),this.requestCameraPermission=()=>Promise.resolve({userAllow:!0,message:"Success"}),this.createShortcut=()=>Promise.resolve(),this.openBioAuthentication=()=>Promise.resolve({code:0,message:"OK",data:{domain:"",code:0,message:"",payToken:""}}),this.checkStateBioAuthentication=()=>Promise.resolve({bioState:""}),this.sendLocation=()=>Promise.resolve(),this.showToast=()=>Promise.resolve(),this.hideKeyboard=()=>Promise.resolve(),this.openPhone=()=>Promise.resolve(),this.openSMS=()=>Promise.resolve(),this.viewOAQr=()=>Promise.resolve(),this.keepScreen=()=>Promise.resolve(),this.saveImageToPhotosAlbum=()=>Promise.resolve(),this.openMiniApp=e=>Promise.resolve(),this.vibrate=()=>Promise.resolve(),this.openWebview=e=>(location.replace(e.url),Promise.resolve()),this.getRouteParams=bo.getRouteParams,this.getAppInfo=()=>Promise.resolve({description:"",name:"",version:"",appUrl:"",qrCodeUrl:""}),this.sendDataToPreviousMiniApp=e=>Promise.resolve(),this.onCallbackData=e=>(e({data:""}),Promise.resolve()),this.getPhoneNumber=()=>(console.warn("This api only works on zalo app"),Promise.resolve({number:""})),this.openProfilePicker=()=>(console.warn("This api only works on zalo app"),Promise.resolve([])),this.connectWifi=()=>(console.warn("This api only works on zalo app"),Promise.resolve()),this.openOutApp=e=>(location.href=e,Promise.resolve()),this.closeLoading=e=>Promise.resolve()}on(e,t,n){throw new Error("Method not implemented.")}once(e,t,n){throw new Error("Method not implemented.")}off(e,t,n,i){throw new Error("Method not implemented.")}removeAllListeners(e){throw new Error("Method not implemented.")}openMediaPicker(e,t,n,i){return console.warn("This api only works on zalo app"),Promise.resolve({urls:[]})}}ro=new WeakMap,ao=new WeakMap,so=new WeakMap,co=new WeakMap,lo=new WeakMap,uo=new WeakMap;const Po=Symbol("required"),Io=Symbol("checkType"),Co=(e,t)=>(n,i,o)=>{let r=Reflect.getOwnMetadata(Po,n,i)||[];r.push({parameterIndex:o,fields:e,option:t}),Reflect.defineMetadata(Po,r,n,i)},ko=(e,t,n)=>(i,o,r)=>{let a=Reflect.getOwnMetadata(Io,i,o)||[];a.push({parameterIndex:r,type:e,properties:t,defaultValue:n}),Reflect.defineMetadata(Io,a,i,o)};const Ro=(e,t,n)=>{const i=n.value,o=i.toString().match(/\(.*?\)/)[0].replace(/[()]/gi,"").replace(/\s/gi,"").split(",");return n.value=function(){const n=Reflect.getOwnMetadata(Po,e,t),r=Reflect.getOwnMetadata(Io,e,t);return r&&r.forEach((e=>{const{parameterIndex:t,type:n,properties:i,defaultValue:r}=e;let a=arguments[t],s=o[t];const c=typeof a;if(!ln.isUndefined(a)){if(!ci(a,n))throw Kn.wrongTypeParam(s,n,Array.isArray(a)?"array":null===a?"null":c);"object"===n&&Object.entries(i).forEach((([e,n])=>{const i=e.split("?")[0],o=ln.get(a,i);if(ln.isUndefined(o)||ln.isNull(o)){if(!e.includes("?"))throw Kn.missingParam(e);ln.isObject(ln.get(a,i.split(".")[0]))&&r&&!ln.isUndefined(ln.get(r,i))&&ln.set(arguments[t],i,ln.get(r,i))}else if(ln.isFunction(n)){const e=n(o);if(e&&e.error)throw Kn.wrongTypeParam(`${s}.${i}`,e.errorMessage,typeof o)}}))}})),n&&n.forEach((e=>{const{parameterIndex:t,option:n,fields:i}=e,o=arguments[t],r=null==n?void 0:n.if,a=null==n?void 0:n.defaultValue;let s=!0;r&&(s=Object.keys(r).every((e=>ln.get(o,e)===r[e]))),s&&i.forEach((e=>{const n=e=>{let n=!1;return ln.isEmpty(ln.get(o,e))&&(ln.isUndefined(ln.get(a,e))||ln.set(arguments[t],e,ln.get(a,e)),n=!0),n};if(Array.isArray(e)&&e.length>0&&e.every(n))throw Kn.missingParam(e.join(" or "));if(ln.isString(e)&&n(e))throw Kn.missingParam(e)}))})),i.apply(this,arguments)},n};var Bo,Do,jo,Mo,Lo;class xo{constructor(){this.events=_i.getInstance(),Bo.set(this,void 0),o(this,Bo,this.getServiceInstance(),"f"),this.events.addListener=(e,t,n)=>{const i=e;return this.events.addListener(exports.Events[i],t,n)}}login(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").login(e)}))}getLoginStatus(){return i(this,Bo,"f").getLoginStatus()}getAccessToken(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getAccessToken(e)}))}getVersion(){return i(this,Bo,"f").getVersion()}getSystemInfo(){return i(this,Bo,"f").getSystemInfo()}setNavigationBarTitle(e){return n(this,void 0,void 0,(function*(){return i(this,Bo,"f").setNavigationBarTitle(e)}))}setNavigationBarColor(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").setNavigationBarColor(e)}))}setBackgroundColor(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").setBackgroundColor(e)}))}setNavigationBarLeftButton(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").setNavigationBarLeftButton(e)}))}setDeviceOrientation(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").setDeviceOrientation(e)}))}setStorage(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").setStorage(e)}))}getStorage(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getStorage(e)}))}getStorageInfo(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getStorageInfo(e)}))}removeStorage(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").removeStorage(e)}))}clearStorage(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").clearStorage(e)}))}getUserInfo(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getUserInfo(e)}))}getNetworkType(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getNetworkType(e)}))}onNetworkStatusChange(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").onNetworkStatusChange(e)}))}startBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").startBeaconDiscovery(e)}))}stopBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").stopBeaconDiscovery(e)}))}getBeacons(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getBeacons(e)}))}closeApp(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").closeApp(e)}))}getLocation(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getLocation(e)}))}stopBluetoothDevicesDiscovery(){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").stopBluetoothDevicesDiscovery()}))}startBluetoothDevicesDiscovery(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").startBluetoothDevicesDiscovery(e)}))}openBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").openBluetoothAdapter()}))}onBluetoothDeviceFound(){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").onBluetoothDeviceFound()}))}onBluetoothAdapterStateChange(){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").onBluetoothAdapterStateChange()}))}getConnectedBluetoothDevices(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getConnectedBluetoothDevices(e)}))}getBluetoothDevices(){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getBluetoothDevices()}))}getBluetoothAdapterState(){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getBluetoothAdapterState()}))}closeBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").closeBluetoothAdapter()}))}scanQRCode(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").scanQRCode(e)}))}openProfile(e){return n(this,void 0,void 0,(function*(){yield i(this,Bo,"f").openProfile(e)}))}openChat(e){return n(this,void 0,void 0,(function*(){yield i(this,Bo,"f").openChat(e)}))}openPostFeed(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").openPostFeed(e)}))}followOA(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").followOA(e)}))}unfollowOA(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").unFollowOA(e)}))}openShareSheet(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").openShareSheet(e)}))}requestCameraPermission(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").requestCameraPermission(e)}))}createShortcut(e){return n(this,void 0,void 0,(function*(){const t=yield gi(fn,0),n=oi().isIOS,o=t.logoUrl||ri("og:image:url")||"",r=t.name||document.title,a=e.params?new URLSearchParams(e.params):new URLSearchParams;if(a.append("utm_source","zalo-shortcut"),a.append("utm_medium","default"),a.append("utm_campaign","default"),n){a.append("appId",fn),a.append("appName",r),a.append("appIcon",o);const e=`https://mini.zalo.me/shortcut.html?${a.toString()}`;yield i(this,Bo,"f").openOutApp(encodeURI(e))}else yield i(this,Bo,"f").createShortcut(`https://zalo.me/app/link/zapps/${fn}/?${a.toString()}`,r,o);return Jn()}))}openBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").openBioAuthentication(e)}))}checkStateBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").checkStateBioAuthentication(e)}))}sendLocation(e){return n(this,void 0,void 0,(function*(){yield i(this,Bo,"f").sendLocation(e)}))}showToast(e){return n(this,void 0,void 0,(function*(){yield i(this,Bo,"f").showToast(e)}))}hideKeyboard(e){return n(this,void 0,void 0,(function*(){yield i(this,Bo,"f").hideKeyboard(e)}))}openPhone(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").openPhone(e)}))}openSMS(e){return n(this,void 0,void 0,(function*(){yield i(this,Bo,"f").openSMS(e)}))}viewOAQr(e){return n(this,void 0,void 0,(function*(){yield i(this,Bo,"f").viewOAQr(e)}))}keepScreen(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").keepScreen(e)}))}saveImageToGallery(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").saveImageToPhotosAlbum(e)}))}saveImageToPhotosAlbum(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").saveImageToPhotosAlbum(e)}))}openMiniApp(e){return n(this,void 0,void 0,(function*(){if(!ln.isEmpty(e.params)){const t=e.params||{};Object.keys(t).forEach((e=>{"object"==typeof t[e]&&(t[e]=JSON.stringify(t[e])),t[e]=""+encodeURIComponent(t[e])})),e.params=t}yield i(this,Bo,"f").openMiniApp(e)}))}vibrate(e){return n(this,void 0,void 0,(function*(){yield i(this,Bo,"f").vibrate(e)}))}openWebview(e){return n(this,void 0,void 0,(function*(){yield i(this,Bo,"f").openWebview(e)}))}getRouteParams(){return i(this,Bo,"f").getRouteParams()}getAppInfo(e){return i(this,Bo,"f").getAppInfo()}sendDataToPreviousMiniApp(e){return i(this,Bo,"f").sendDataToPreviousMiniApp(e)}onCallbackData(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").onCallbackData(e)}))}getPhoneNumber(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getPhoneNumber()}))}openProfilePicker(e){return n(this,void 0,void 0,(function*(){const t=yield i(this,Bo,"f").openProfilePicker(e.maxProfile);let n;if(t.length>0)try{const e=yield this.getAccessToken(),i=yield fetch(On,{method:"POST",headers:{"Content-Type":"application/json",access_token:e||""},body:JSON.stringify({fields:"id,name,picture",user_ids:t})}),o=yield i.json();if(0!==o.error||!o.data)throw new Error(o.message);n=t.map((e=>{var t,n,i,r,a,s,c,l,u,d,p;return{id:(null===(n=null===(t=o.data[e])||void 0===t?void 0:t.user_info)||void 0===n?void 0:n.user_id_by_app)||"",profile:{name:null===(r=null===(i=o.data[e])||void 0===i?void 0:i.user_info)||void 0===r?void 0:r.name,avatar:null===(l=null===(c=null===(s=null===(a=o.data[e])||void 0===a?void 0:a.user_info)||void 0===s?void 0:s.picture)||void 0===c?void 0:c.data)||void 0===l?void 0:l.url},code:0!==(null===(u=o.data[e])||void 0===u?void 0:u.error)?-1:0,message:`Get profile: ${ln.isUndefined(null===(d=o.data[e])||void 0===d?void 0:d.message)?"Unknown error":null===(p=o.data[e])||void 0===p?void 0:p.message}`}}))}catch(e){n=t.map((t=>({id:t,profile:{name:"",avatar:""},code:-1,message:`Can't get profile: ${e.message}`})))}return{users:n||[]}}))}connectWifi(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").connectWifi(e)}))}openMediaPicker(e){var t,o,r;return n(this,void 0,void 0,(function*(){const n={};ln.isUndefined(null===(t=e.editView)||void 0===t?void 0:t.enable)||(null===(o=e.editView)||void 0===o?void 0:o.enable)?n.enable=1:n.enable=0,n.aspect_ratio=null===(r=e.editView)||void 0===r?void 0:r.aspectRatio;const a=!0===e.silentRequest?1:0,s=e.maxSelectItem;return yield i(this,Bo,"f").openMediaPicker(e.type,n,a,s)}))}getShareableLink(e){return n(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();return(yield fi(window.APP_ID,t||"",e.title,e.description,e.thumbnail,e.path)).shareableLink}))}closeLoading(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").closeLoading("user action")}))}}Bo=new WeakMap,e([Vn],xo.prototype,"login",null),e([Zn],xo.prototype,"getLoginStatus",null),e([Vn],xo.prototype,"getAccessToken",null),e([Zn],xo.prototype,"getVersion",null),e([Zn],xo.prototype,"getSystemInfo",null),e([Vn,Ro,t(0,ko("object",{title:mi("string")}))],xo.prototype,"setNavigationBarTitle",null),e([Vn,Ro,t(0,ko("object",{color:mi("string"),"textColor?":mi("string",{values:["white","black"]}),"statusBarColor?":mi("string")}))],xo.prototype,"setNavigationBarColor",null),e([Vn,Ro,t(0,ko("object",{backgroundColor:mi("string"),"textColor?":mi("string",{values:["white","black"]})}))],xo.prototype,"setBackgroundColor",null),e([Vn,Ro,t(0,ko("object",{type:mi("string",{values:["none","back","home","both"]})}))],xo.prototype,"setNavigationBarLeftButton",null),e([Vn,Ro,t(0,ko("object",{rotate:mi("string",{values:["auto","portrait","landscape"]})}))],xo.prototype,"setDeviceOrientation",null),e([Vn,Ro,t(0,ko("object",{data:mi("object")}))],xo.prototype,"setStorage",null),e([Vn,Ro,t(0,ko("object",{keys:mi("array<string>")}))],xo.prototype,"getStorage",null),e([Vn],xo.prototype,"getStorageInfo",null),e([Vn,Ro,t(0,ko("object",{keys:mi("array<string>")}))],xo.prototype,"removeStorage",null),e([Vn],xo.prototype,"clearStorage",null),e([Vn,Ro,t(0,ko("object",{"avatarType?":mi("string",{values:["small","normal","large"]})}))],xo.prototype,"getUserInfo",null),e([Vn],xo.prototype,"getNetworkType",null),e([Vn],xo.prototype,"onNetworkStatusChange",null),e([Vn],xo.prototype,"startBeaconDiscovery",null),e([Vn],xo.prototype,"stopBeaconDiscovery",null),e([Vn],xo.prototype,"getBeacons",null),e([Vn],xo.prototype,"closeApp",null),e([Vn],xo.prototype,"getLocation",null),e([Vn],xo.prototype,"stopBluetoothDevicesDiscovery",null),e([Vn],xo.prototype,"startBluetoothDevicesDiscovery",null),e([Vn],xo.prototype,"openBluetoothAdapter",null),e([Vn],xo.prototype,"onBluetoothDeviceFound",null),e([Vn],xo.prototype,"onBluetoothAdapterStateChange",null),e([Vn],xo.prototype,"getConnectedBluetoothDevices",null),e([Vn],xo.prototype,"getBluetoothDevices",null),e([Vn],xo.prototype,"getBluetoothAdapterState",null),e([Vn],xo.prototype,"closeBluetoothAdapter",null),e([Vn],xo.prototype,"scanQRCode",null),e([Vn,Ro,t(0,ko("object",{type:mi("string",{values:["user","oa","aliasOA"]}),id:mi("string")}))],xo.prototype,"openProfile",null),e([Vn,Ro,t(0,ko("object",{type:mi("string",{values:["user","oa"]}),id:mi("string")}))],xo.prototype,"openChat",null),e([Vn,Ro,t(0,Co(["data.imageUrl"],{if:{type:"image"}})),t(0,Co(["data.link"],{if:{type:"link"}})),t(0,Co(["data.id"],{if:{type:"profile"}})),t(0,ko("object",{type:mi("string",{values:["image","link","profile"]}),data:mi("object"),"data.imageUrl?":mi("url"),"data.link?":mi("url"),"data.title?":mi("string"),"data.thumb?":mi("url"),"data.description?":mi("string"),"data.avatar?":mi("url"),"data.id?":mi("string"),"data.displayName?":mi("string")}))],xo.prototype,"openPostFeed",null),e([Vn,Ro,t(0,ko("object",{id:mi("string"),"showDialogConfirm?":mi("boolean")}))],xo.prototype,"followOA",null),e([Vn,Ro,t(0,ko("object",{id:mi("string")}))],xo.prototype,"unfollowOA",null),e([Vn,Ro,t(0,Co([["data.imageUrl","data.imageUrls"]],{if:{type:"image"}})),t(0,Co(["data.link"],{if:{type:"link"}})),t(0,Co(["data.id"],{if:{type:"oa"}})),t(0,Co(["data.gifUrl"],{if:{type:"gif"}})),t(0,Co(["data.videoThumb","data.videoUrl"],{if:{type:"video"}})),t(0,Co(["data.thumbnail","data.title","data.description"],{if:{type:"zmp"},defaultValue:{data:{description:""}}})),t(0,ko("object",{type:mi("string",{values:["image","gif","video","link","oa","zmp"]}),data:mi("object"),"data.imageUrl?":mi("url"),"data.imageUrls?":mi("array<url>",{maxLength:10}),"data.caption?":mi("string"),"data.gifUrl?":mi("url"),"data.width?":mi("number"),"data.height?":mi("number"),"data.videoThumb?":mi("url"),"data.videoUrl?":mi("url"),"data.link?":mi("url"),"data.chatOnly?":mi("boolean"),"data.id?":mi("string"),"data.thumbnail?":mi("url"),"data.path?":mi("string"),"data.title?":mi("string",{maxLength:100}),"data.description?":mi(["string"],{maxLength:400})}))],xo.prototype,"openShareSheet",null),e([Vn],xo.prototype,"requestCameraPermission",null),e([Vn],xo.prototype,"createShortcut",null),e([Vn,Ro,t(0,ko("object",{secretData:mi("string"),"ui?":mi("object"),"ui.title?":mi("string"),"ui.subTitle?":mi("string"),"ui.negativeButtonText?":mi("string"),"requireFingerprint?":mi("boolean")},{requireFingerprint:!0,ui:{title:"Xác thực",subTitle:"Sử dụng sinh trắc học của bạn để xác thực",negativeButtonText:"Đóng"}}))],xo.prototype,"openBioAuthentication",null),e([Vn],xo.prototype,"checkStateBioAuthentication",null),e([Vn,Ro,t(0,ko("object",{toUserId:mi("string"),"title?":mi("string")}))],xo.prototype,"sendLocation",null),e([Vn,Ro,t(0,ko("object",{message:mi("string")}))],xo.prototype,"showToast",null),e([Vn],xo.prototype,"hideKeyboard",null),e([Vn,Ro,t(0,ko("object",{phoneNumber:mi("string")}))],xo.prototype,"openPhone",null),e([Vn,Ro,t(0,ko("object",{content:mi("string"),phoneNumber:mi("string",{regex:/^\+?\d+$/})}))],xo.prototype,"openSMS",null),e([Vn,Ro,t(0,ko("object",{id:mi("string"),"displayName?":mi("string")},{displayName:""}))],xo.prototype,"viewOAQr",null),e([Vn],xo.prototype,"keepScreen",null),e([Vn,Ro,t(0,ko("object",{"imageBase64Data?":mi("string"),"imageUrl?":mi("url")}))],xo.prototype,"saveImageToGallery",null),e([Vn,Ro,t(0,ko("object",{"imageBase64Data?":mi("string"),"imageUrl?":mi("url")}))],xo.prototype,"saveImageToPhotosAlbum",null),e([Vn,Ro,t(0,ko("object",{appId:mi("string"),"params?":mi("object")}))],xo.prototype,"openMiniApp",null),e([Vn,Ro,t(0,ko("object",{"type?":mi("string",{values:["oneShot"]}),"milliseconds?":mi("number")},{type:"oneShot",milliseconds:500}))],xo.prototype,"vibrate",null),e([Vn,Ro,t(0,ko("object",{url:mi("string")}))],xo.prototype,"openWebview",null),e([Zn],xo.prototype,"getRouteParams",null),e([Vn],xo.prototype,"getAppInfo",null),e([Vn],xo.prototype,"sendDataToPreviousMiniApp",null),e([Vn],xo.prototype,"onCallbackData",null),e([Vn],xo.prototype,"getPhoneNumber",null),e([Vn,Ro,t(0,ko("object",{"maxProfile?":mi("number",{min:1,max:10})},{maxProfile:1}))],xo.prototype,"openProfilePicker",null),e([Vn,Ro,t(0,Co(["SSID"])),t(0,ko("object",{SSID:mi("string"),"password?":mi("string"),"hiddenSSID?":mi("boolean")}))],xo.prototype,"connectWifi",null),e([Vn,Ro,t(0,ko("object",{type:mi("string",{values:["photo","video","file","multi_photo","multi_video"]}),"editView?":mi("object"),"editView.enable?":mi("boolean"),"editView.aspectRatio?":mi("string",{regex:/^\d+:\d+$/}),"silentRequest?":mi("boolean"),"maxSelectItem?":mi("number",{min:1})}))],xo.prototype,"openMediaPicker",null),e([Vn,Ro,t(0,ko("object",{title:mi("string",{maxLength:100}),"thumbnail?":mi("url"),"path?":mi("string"),description:mi(["string"],{maxLength:400})},{description:""}))],xo.prototype,"getShareableLink",null),e([Vn,Ro],xo.prototype,"closeLoading",null);class Uo extends xo{getServiceInstance(){return wo.getInstance()}}class Wo extends xo{getServiceInstance(){return new No}}class zo{constructor(){Do.set(this,fn)}static getInstance(){return zo.instance||(zo.instance=new zo),zo.instance}createOrder(e,t){return n(this,void 0,void 0,(function*(){const n=i(this,Do,"f"),o=new URLSearchParams;o.append("amount",t.amount.toString()),o.append("item",encodeURIComponent(JSON.stringify(t.item))),o.append("appId",n),t.desc&&o.append("desc",encodeURIComponent(t.desc)),t.extradata&&o.append("extradata",encodeURIComponent(JSON.stringify(t.extradata))),t.method&&o.append("method",t.method);const r={headers:{"Content-Type":"application/x-www-form-urlencoded",authorization:"Bearer "}};try{const i=yield e.getAccessToken({fail:e=>{throw Kn.loginRequired}});r.headers.authorization=`Bearer ${i}`;const a=yield fetch(Wn,Object.assign(Object.assign({method:"POST"},r),{body:o})),s=yield a.json();if(!s.data||0!==s.err)throw Kn.badRequest(s.msg);const c=s.data.id,l=window.APP_VERSION,u=window.APP_ENV,d={miniAppId:n,accessToken:i||"",orderId:c};l&&(d.version=l),u&&(d.env=u),t.method&&(d.method=t.method);const p=Qn.encode(d),h=new URL(`?${p}`,"https://payment-mini.zalo.me").toString();return yield e.openWebview({url:h,fail:e=>{throw e}}),{orderId:c}}catch(e){throw e}}))}checkTransaction(e,t){return n(this,void 0,void 0,(function*(){try{let n,{data:o}=t;if(o||(o=e.getRouteParams()),"object"==typeof o&&(n=o.appTransID||o.orderId||o.apptransid),"string"==typeof o){const e=Qn.getParameterByName("orderId",o),t=Qn.getParameterByName("appTransID",o)||Qn.getParameterByName("apptransid",o);n=e||t}const r=new URL(zn),a={transId:n||"",appId:i(this,Do,"f")};r.search=new URLSearchParams(a).toString();const s=yield fetch(r.toString()),c=yield s.json();if(!c.data||0!==c.err)throw Kn.badRequest(c.msg);const l=c.data||{};return{msg:l.resultMessage,appId:l.appId,orderId:l.orderId,resultCode:l.resultCode,transTime:l.transTime,createdAt:l.createAt}}catch(e){throw e}}))}getOrderStatus(e){return n(this,void 0,void 0,(function*(){try{const{orderId:t}=e,n=new URL(Fn),o={appId:i(this,Do,"f")};e.transId&&(o.transId=e.transId),e.orderId&&(o.orderId=e.orderId),n.search=new URLSearchParams(o).toString();const r=yield fetch(n.toString()),a=yield r.json();if(!a.data||0!==a.err)throw Kn.badRequest(a.msg);const s=a.data||{};return{returnCode:s.returnCode,returnMessage:s.returnMessage,isProcessing:s.isProcessing,amount:s.amount}}catch(e){throw e}}))}}Do=new WeakMap;class Fo{constructor(){jo.set(this,vn)}static getInstance(){return Fo.instance||(Fo.instance=new Fo),Fo.instance}createOrder(e,t){return Promise.resolve({orderId:""})}checkTransaction(e,t){const n={msg:"Success",appId:i(this,jo,"f"),orderId:"",resultCode:1,transTime:(new Date).getTime().toString(),createdAt:(new Date).getTime().toString()};return Promise.resolve(n)}getOrderStatus(e){return Promise.resolve({returnCode:3,returnMessage:"Giao dịch chưa được thực hiện.",isProcessing:!1,amount:1e4})}}jo=new WeakMap;class Go{constructor(e){Mo.set(this,void 0),Lo.set(this,void 0),o(this,Mo,this.getInstance(),"f"),o(this,Lo,e,"f")}createOrder(e){return i(this,Mo,"f").createOrder(i(this,Lo,"f"),e)}checkTransaction(e){return i(this,Mo,"f").checkTransaction(i(this,Lo,"f"),e)}getOrderStatus(e){return i(this,Mo,"f").getOrderStatus(e)}}Mo=new WeakMap,Lo=new WeakMap,e([Vn,Ro,t(0,ko("object",{amount:mi(["string","number"]),desc:mi("string"),"method?":mi("string",{values:["MOMO","ZALOPAY","MOMO_SANDBOX","ZALOPAY_SANDBOX","CC","CC_SANDBOX","ATM","ATM_SANDBOX"]})}))],Go.prototype,"createOrder",null),e([Vn,Ro],Go.prototype,"checkTransaction",null),e([Vn,Ro,t(0,Co(["transId"],{if:{orderId:void 0}})),t(0,Co(["orderId"],{if:{transId:void 0}})),t(0,ko("object",{"transId?":mi("string"),"orderId?":mi("string")}))],Go.prototype,"getOrderStatus",null);class Ho extends Go{getInstance(){return zo.getInstance()}}class $o extends Go{getInstance(){return Fo.getInstance()}}const Vo=oi();exports.default=void 0,window.onJSCall=e=>function(t){wi.getInstance().onJSCall(e,t)},window.onMultiJSCall=e=>function(t){wi.getInstance().onMultiJSCall(e,t)},window.zaloJSV2={zalo_h5_event_handler:function(e,t,n){wi.getInstance().nativeEventHandler(e,t,n)}},exports.Payment=void 0,Vo.isZalo?(exports.default=new Uo,exports.Payment=new Ho(exports.default)):(exports.default=new Wo,exports.Payment=new $o(exports.default)),window.ZaloMiniAppSDK=exports.default,exports.SDKCreator=xo;
|
|
16
|
+
function e(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a}function t(e,t){return function(n,i){t(n,i,e)}}function n(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{c(i.next(e))}catch(e){r(e)}}function s(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}function i(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function o(e,t,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(e,n):o?o.value=n:t.set(e,n),n}Object.defineProperty(exports,"__esModule",{value:!0});var r=Object.prototype;var a=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||r)};var s=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),c=a,l=s,u=Object.prototype.hasOwnProperty;var d=function(e){if(!c(e))return l(e);var t=[];for(var n in Object(e))u.call(e,n)&&"constructor"!=n&&t.push(n);return t},p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function h(e,t){return e(t={exports:{}},t.exports),t.exports}var v="object"==typeof p&&p&&p.Object===Object&&p,f="object"==typeof self&&self&&self.Object===Object&&self,m=v||f||Function("return this")(),g=m.Symbol,y=Object.prototype,_=y.hasOwnProperty,E=y.toString,S=g?g.toStringTag:void 0;var A=function(e){var t=_.call(e,S),n=e[S];try{e[S]=void 0;var i=!0}catch(e){}var o=E.call(e);return i&&(t?e[S]=n:delete e[S]),o},O=Object.prototype.toString;var T=A,b=function(e){return O.call(e)},w=g?g.toStringTag:void 0;var N=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},P=N,I=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":w&&w in Object(e)?T(e):b(e)};var C,k=function(e){if(!N(e))return!1;var t=I(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},R=k,B=m["__core-js_shared__"],D=(C=/[^.]+$/.exec(B&&B.keys&&B.keys.IE_PROTO||""))?"Symbol(src)_1."+C:"";var j=function(e){return!!D&&D in e},M=Function.prototype.toString;var L=j,x=function(e){if(null!=e){try{return M.call(e)}catch(e){}try{return e+""}catch(e){}}return""},U=/^\[object .+?Constructor\]$/,W=Function.prototype,z=Object.prototype,F=W.toString,G=z.hasOwnProperty,H=RegExp("^"+F.call(G).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var $=function(e){return!(!N(e)||L(e))&&(k(e)?H:U).test(x(e))},V=function(e,t){return null==e?void 0:e[t]};var Z=function(e,t){var n=V(e,t);return $(n)?n:void 0},J=Z(m,"DataView"),K=Z(m,"Map"),q=Z(m,"Promise"),Q=Z(m,"Set"),Y=Z(m,"WeakMap"),X=J,ee=K,te=q,ne=Q,ie=Y,oe=x(X),re=x(ee),ae=x(te),se=x(ne),ce=x(ie),le=I;(X&&"[object DataView]"!=le(new X(new ArrayBuffer(1)))||ee&&"[object Map]"!=le(new ee)||te&&"[object Promise]"!=le(te.resolve())||ne&&"[object Set]"!=le(new ne)||ie&&"[object WeakMap]"!=le(new ie))&&(le=function(e){var t=I(e),n="[object Object]"==t?e.constructor:void 0,i=n?x(n):"";if(i)switch(i){case oe:return"[object DataView]";case re:return"[object Map]";case ae:return"[object Promise]";case se:return"[object Set]";case ce:return"[object WeakMap]"}return t});var ue=le;var de=function(e){return null!=e&&"object"==typeof e};var pe=function(e){return de(e)&&"[object Arguments]"==I(e)},he=Object.prototype,ve=he.hasOwnProperty,fe=he.propertyIsEnumerable,me=pe(function(){return arguments}())?pe:function(e){return de(e)&&ve.call(e,"callee")&&!fe.call(e,"callee")},ge=Array.isArray,ye=ge;var _e=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var Ee=function(e){return null!=e&&_e(e.length)&&!k(e)};var Se=function(){return!1},Ae=h((function(e,t){var n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,o=i&&i.exports===n?m.Buffer:void 0,r=(o?o.isBuffer:void 0)||Se;e.exports=r})),Oe={};Oe["[object Float32Array]"]=Oe["[object Float64Array]"]=Oe["[object Int8Array]"]=Oe["[object Int16Array]"]=Oe["[object Int32Array]"]=Oe["[object Uint8Array]"]=Oe["[object Uint8ClampedArray]"]=Oe["[object Uint16Array]"]=Oe["[object Uint32Array]"]=!0,Oe["[object Arguments]"]=Oe["[object Array]"]=Oe["[object ArrayBuffer]"]=Oe["[object Boolean]"]=Oe["[object DataView]"]=Oe["[object Date]"]=Oe["[object Error]"]=Oe["[object Function]"]=Oe["[object Map]"]=Oe["[object Number]"]=Oe["[object Object]"]=Oe["[object RegExp]"]=Oe["[object Set]"]=Oe["[object String]"]=Oe["[object WeakMap]"]=!1;var Te=function(e){return de(e)&&_e(e.length)&&!!Oe[I(e)]},be=function(e){return function(t){return e(t)}},we=h((function(e,t){var n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,o=i&&i.exports===n&&v.process,r=function(){try{var e=i&&i.require&&i.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=r})),Ne=we&&we.isTypedArray,Pe=Ne?be(Ne):Te,Ie=d,Ce=ue,ke=me,Re=Ee,Be=Ae,De=Pe,je=Object.prototype.hasOwnProperty;var Me=function(e){if(null==e)return!0;if(Re(e)&&(ge(e)||"string"==typeof e||"function"==typeof e.splice||Be(e)||De(e)||ke(e)))return!e.length;var t=Ce(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(c(e))return!Ie(e).length;for(var n in e)if(je.call(e,n))return!1;return!0};var Le=function(e){return void 0===e};var xe=function(e){return null===e};var Ue=function(e){return"string"==typeof e||!ge(e)&&de(e)&&"[object String]"==I(e)};var We=function(e){return"number"==typeof e||de(e)&&"[object Number]"==I(e)};var ze=function(e){return de(e)&&"[object RegExp]"==I(e)},Fe=we&&we.isRegExp,Ge=Fe?be(Fe):ze;var He=function(e){return"symbol"==typeof e||de(e)&&"[object Symbol]"==I(e)},$e=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ve=/^\w*$/;var Ze=function(e,t){if(ge(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!He(e))||(Ve.test(e)||!$e.test(e)||null!=t&&e in Object(t))},Je=Z(Object,"create");var Ke=function(){this.__data__=Je?Je(null):{},this.size=0};var qe=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Qe=Object.prototype.hasOwnProperty;var Ye=function(e){var t=this.__data__;if(Je){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Qe.call(t,e)?t[e]:void 0},Xe=Object.prototype.hasOwnProperty;var et=Ke,tt=qe,nt=Ye,it=function(e){var t=this.__data__;return Je?void 0!==t[e]:Xe.call(t,e)},ot=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Je&&void 0===t?"__lodash_hash_undefined__":t,this};function rt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}rt.prototype.clear=et,rt.prototype.delete=tt,rt.prototype.get=nt,rt.prototype.has=it,rt.prototype.set=ot;var at=rt;var st=function(){this.__data__=[],this.size=0};var ct=function(e,t){return e===t||e!=e&&t!=t};var lt=function(e,t){for(var n=e.length;n--;)if(ct(e[n][0],t))return n;return-1},ut=Array.prototype.splice;var dt=st,pt=function(e){var t=this.__data__,n=lt(t,e);return!(n<0)&&(n==t.length-1?t.pop():ut.call(t,n,1),--this.size,!0)},ht=function(e){var t=this.__data__,n=lt(t,e);return n<0?void 0:t[n][1]},vt=function(e){return lt(this.__data__,e)>-1},ft=function(e,t){var n=this.__data__,i=lt(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};function mt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}mt.prototype.clear=dt,mt.prototype.delete=pt,mt.prototype.get=ht,mt.prototype.has=vt,mt.prototype.set=ft;var gt=at,yt=mt;var _t=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Et=function(e,t){var n=e.__data__;return _t(t)?n["string"==typeof t?"string":"hash"]:n.map};var St=function(){this.size=0,this.__data__={hash:new gt,map:new(ee||yt),string:new gt}},At=function(e){var t=Et(this,e).delete(e);return this.size-=t?1:0,t},Ot=function(e){return Et(this,e).get(e)},Tt=function(e){return Et(this,e).has(e)},bt=function(e,t){var n=Et(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};function wt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}wt.prototype.clear=St,wt.prototype.delete=At,wt.prototype.get=Ot,wt.prototype.has=Tt,wt.prototype.set=bt;var Nt=wt;function Pt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var i=arguments,o=t?t.apply(this,i):i[0],r=n.cache;if(r.has(o))return r.get(o);var a=e.apply(this,i);return n.cache=r.set(o,a)||r,a};return n.cache=new(Pt.Cache||Nt),n}Pt.Cache=Nt;var It=Pt;var Ct=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,kt=/\\(\\)?/g,Rt=function(e){var t=It(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Ct,(function(e,n,i,o){t.push(i?o.replace(kt,"$1"):n||e)})),t}));var Bt=function(e,t){for(var n=-1,i=null==e?0:e.length,o=Array(i);++n<i;)o[n]=t(e[n],n,e);return o},Dt=g?g.prototype:void 0,jt=Dt?Dt.toString:void 0;var Mt=function e(t){if("string"==typeof t)return t;if(ge(t))return Bt(t,e)+"";if(He(t))return jt?jt.call(t):"";var n=t+"";return"0"==n&&1/t==-Infinity?"-0":n};var Lt=Ze,xt=Rt,Ut=function(e){return null==e?"":Mt(e)};var Wt=function(e,t){return ge(e)?e:Lt(e,t)?[e]:xt(Ut(e))},zt=function(e){if("string"==typeof e||He(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var Ft=function(e,t){for(var n=0,i=(t=Wt(t,e)).length;null!=e&&n<i;)e=e[zt(t[n++])];return n&&n==i?e:void 0};var Gt=function(e,t,n){var i=null==e?void 0:Ft(e,t);return void 0===i?n:i},Ht=function(){try{var e=Z(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var $t=function(e,t,n){"__proto__"==t&&Ht?Ht(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Vt=Object.prototype.hasOwnProperty;var Zt=/^(?:0|[1-9]\d*)$/;var Jt=function(e,t,n){var i=e[t];Vt.call(e,t)&&ct(i,n)&&(void 0!==n||t in e)||$t(e,t,n)},Kt=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Zt.test(e))&&e>-1&&e%1==0&&e<t};var qt=function(e,t,n,i){if(!N(e))return e;for(var o=-1,r=(t=Wt(t,e)).length,a=r-1,s=e;null!=s&&++o<r;){var c=zt(t[o]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(o!=a){var u=s[c];void 0===(l=i?i(u,c,s):void 0)&&(l=N(u)?u:Kt(t[o+1])?[]:{})}Jt(s,c,l),s=s[c]}return e};var Qt,Yt,Xt,en,tn,nn,on,rn,an,sn,cn,ln={isEmpty:Me,isNull:xe,isUndefined:Le,isFunction:R,isObject:P,isString:Ue,isNumber:We,isArray:ye,isRegExp:Ge,get:Gt,set:function(e,t,n){return null==e?e:qt(e,t,n)}};function un(e){return"function"==typeof window.Debug?window.Debug(e):function(...e){process.env.NODE_ENV}}exports.NetworkType=void 0,(Qt=exports.NetworkType||(exports.NetworkType={})).none="none",Qt.wifi="wifi",Qt.cellular="cellular",Qt.unknown="unknown",exports.PlatformType=void 0,(Yt=exports.PlatformType||(exports.PlatformType={})).wp="wp",Yt.android="android",Yt.iOS="iOS",Yt.unknown="unknown",exports.ProfileType=void 0,(Xt=exports.ProfileType||(exports.ProfileType={}))[Xt.user=1]="user",Xt[Xt.oa=0]="oa",Xt[Xt.aliasOA=2]="aliasOA",exports.ChatType=void 0,(en=exports.ChatType||(exports.ChatType={}))[en.user=1]="user",en[en.oa=0]="oa",exports.PostFeedType=void 0,(tn=exports.PostFeedType||(exports.PostFeedType={}))[tn.image=1]="image",tn[tn.link=4]="link",tn[tn.profile=5]="profile",exports.ShareSheetType=void 0,(nn=exports.ShareSheetType||(exports.ShareSheetType={}))[nn.image=1]="image",nn[nn.gif=11]="gif",nn[nn.video=12]="video",nn[nn.link=4]="link",nn[nn.oa=5]="oa",nn[nn.zmp=22]="zmp",exports.OrientationType=void 0,(on=exports.OrientationType||(exports.OrientationType={}))[on.auto=1]="auto",on[on.portrait=2]="portrait",on[on.landscape=3]="landscape",exports.VibrateType=void 0,(rn=exports.VibrateType||(exports.VibrateType={}))[rn.oneShot=0]="oneShot",exports.NativeCode=void 0,(an=exports.NativeCode||(exports.NativeCode={}))[an.token_invalid=-2]="token_invalid",an[an.not_permission=-1]="not_permission",an[an.client_not_support=-5]="client_not_support",an[an.decode_failed=-4]="decode_failed",exports.Events=void 0,(sn=exports.Events||(exports.Events={})).AppPaused="h5.event.paused",sn.AppResumed="h5.event.resumed",sn.NetworkChanged="h5.event.connection.changed",sn.OnDataCallback="h5.event.webview.result",sn.OpenApp="h5.event.open.mp",exports.MediaPickerType=void 0,(cn=exports.MediaPickerType||(exports.MediaPickerType={}))[cn.photo=4]="photo",cn[cn.video=5]="video",cn[cn.file=6]="file",cn[cn.multi_photo=7]="multi_photo",cn[cn.multi_video=8]="multi_video";const dn=e=>{const t=document.cookie;if(t){const o=t.split("; ");if(o&&o.length>0)for(var n=e.length+1,i=o.length-1;i>=0;i--){let t=o[i];if(t&&0===t.indexOf(e)&&(t=t.substring(n,t.length),t))return t=t.replace(/["']/g,""),t}}return null},pn=e=>dn(`${window.location.host}_`+e),hn=e=>dn((()=>{const e=window.location.host;if(e){if(e.indexOf("zalo.me")>=0)return"zalo.me_";if(e.indexOf("baomoi.com")>=0)return"baomoi.com_";if(e.indexOf("mp3.zing.vn")>=0)return"mp3.zing.vn_";if(e.indexOf("zaloapp.com")>=0)return"zaloapp.com_"}return""})()+e),vn=window.zAppID,fn=window.APP_ID,mn=window.APP_CONFIG||{},gn="h5.zdn.vn_zoauth",yn="h5.zdn.vn_zlink3rd",_n="h5.zdn.vn_zoauth_vrf",En="https://graph.zalo.me/v2.0/me",Sn="https://h5.zalo.me/openapi/access_token",An="https://oauth.zaloapp.com/v3/access_token",On="https://graph.zalo.me/v2.0/me/friends/list",Tn=e=>({NONE:e?-2:0,WIFI:e?0:1,"2G":2,"3G":e?15:2,"4G":e?13:2}),bn={GET_DOWNLOADED_STICKER:{name:"action.get.downloaded.sticker",have_callback:!0},OPEN_SHARE_STICKER:{name:"action.open.share.sticker"},OPEN_PROFILE:{name:"action.open.profile"},OPEN_FEED_DETAIL:{name:"action.open.feeddetail"},OPEN_FRIEND_RADA:{name:"action.open.friendrada"},OPEN_INAPP:{name:"action.open.inapp"},OPEN_OUTAPP:{name:"action.open.outapp"},OPEN_PAGE:{name:"action.open.page"},OPEN_PHOTODETAIL:{name:"action.open.photodetail"},OPEN_GALARY:{name:"action.open.galary"},OPEN_GAMECENTER:{name:"action.open.gamecenter"},OPEN_GAMENEWS:{name:"action.open.gamenews"},OPEN_TAB_CONTACT:{name:"action.open.tab.contact"},OPEN_TAB_SOCIAL:{name:"action.open.tab.social"},OPEN_FRIENDSUGGEST:{name:"action.open.friendsuggest"},OPEN_GROUPLIST:{name:"action.open.grouplist"},OPEN_NEARBY:{name:"action.open.nearby"},OPEN_ROOM:{name:"action.open.room"},OPEN_STICKERSTORE:{name:"action.open.stickerstore"},OPEN_CREATECHAT:{name:"action.open.createchat"},COPY_LINK_CATESTICKER:{name:"action.copy.link.catesticker"},REQUEST_BUY_STICKER:{name:"action.request.buy.sticker"},OPEN_CHAT:{name:"action.open.chat"},OPEN_TAB_CHAT:{name:"action.open.tab.chat"},OPEN_CHATGROUP:{name:"action.open.chatgroup"},OPEN_ADDFRIEND:{name:"action.open.addfriend"},OPEN_TAB_MORE:{name:"action.open.tab.more"},OPEN_POSTFEED:{name:"action.open.postfeed"},OPEN_LOGINDEVICES:{name:"action.open.logindevices"},OPEN_SENDSTICKER:{name:"action.open.sendsticker"},REPORT_ABUSE:{name:"action.report.abuse",have_callback:!0},FOLLOW_OA:{name:"action.follow.oa",have_callback:!0},UNFOLLOW_OA:{name:"action.unfollow.oa",have_callback:!0},OPEN_GAMEDETAIL:{name:"action.open.gamedetail"},OPEN_SHARESHEET:{name:"action.open.sharesheet",have_callback:!0},REQUEST_PERMISSION_CAMERA:{name:"action.request.permission.camera"},CHANGE_TITLE_HEADER:{name:"action.change.title.header",skip_jump:!0},WEBVIEW_CLEARCACHE:{name:"action.webview.clearcache"},WEBVIEW_CONFIRMCACHE:{name:"action.webview.confirmcache"},WEBVIEW_ISVISIBLE:{name:"action.webview.isvisible"},WEBVIEW_NETWORKTYPE:{name:"action.webview.networktype",skip_jump:!0},CHANGE_BUTTON_HEADER:{name:"action.change.button.header"},CREATE_OPTIONS_MENU:{name:"action.create.options.menu",skip_jump:!0,have_callback:!0},CREATE_SHORTCUT:{name:"action.create.shortcut"},CHANGE_ACTIONBAR_LEFTBUTTON_TYPE:{name:"action.change.actionbar.leftbutton.type",skip_jump:!0,have_callback:!0},WINDOW_CLOSE:{name:"action.window.close",skip_jump:!0,have_callback:!0},WEBVIEW_CHECKRESERROR:{name:"action.webview.checkResError"},IAP_REQUESTPAYMENT:{name:"action.iap.requestpayment"},ZBROWSER_GETSTATS:{name:"action.zbrowser.getstats"},ZBROWSER_JSBRIDGE:{name:"action.zbrowser.jsbridge",skip_jump:!0,have_callback:!0},PROMPT_AUTHENTICATION:{name:"action.prompt.authentication"},CHANGE_ACTIONBAR_COLOR:{name:"action.change.actionbar.color",skip_jump:!0},PROMPT_AUTHENTICATION_CHECK_STATE:{name:"action.prompt.authentication.check_state"},OPEN_APPSTORE:{name:"action.open.appstore"},GET_LOCATION:{name:"action.get.location",have_callback:!0},QUERY_LOCATION_HIDE:{name:"action.query.location.hide",have_callback:!0},SHOW_TOAST:{name:"action.show.toast",have_callback:!0},OPEN_APP:{name:"action.open.app"},HIDE_KEYBOARD:{name:"action.hide.keyboard"},OPEN_PHONE:{name:"action.open.phone"},OPEN_QR:{name:"action.open.qr"},OPEN_SMS:{name:"action.open.sms"},VIEW_MYQR:{name:"action.view.myqr",have_callback:!0},KEEP_SCREEN:{name:"action.keep.screen",have_callback:!0},CHANGE_AUTOROTATE:{name:"action.change.autorotate",skip_jump:!0},CHECK_APP_INSTALLED:{name:"action.check.app.installed"},QUERY_SHOW:{name:"action.query.show"},QUERY_HIDE:{name:"action.query.hide"},OPEN_INAPPRW:{name:"action.open.inapprw"},ZALORUN_GETTRACKINGSTATUS:{name:"action.zalorun.getTrackingStatus",have_callback:!0},ZALORUN_SETTRACKINGSTATUS:{name:"action.zalorun.setTrackingStatus",have_callback:!0},ZALORUN_GETDAYSTEP:{name:"action.zalorun.getDayStep",have_callback:!0},ZALORUN_FORCESUBMITDATA:{name:"action.zalorun.forceSubmitData",have_callback:!0},ZALORUN_SETWEIGHT:{name:"action.zalorun.setWeight",have_callback:!0},OPEN_PROFILE_EXT:{name:"action.open.profile.ext"},DOWNLOAD_CATE:{name:"action.download.cate",have_callback:!0},JUMP_LOGIN:{name:"action.jump.login",skip_jump:!0,white_list:!0},OPEN_ADTIMA_ADS_INTERSTITIAL:{name:"action.open.adtima.ads.interstitial"},OPEN_ADTIMA_ADS:{name:"action.open.adtima.ads"},GET_ADIDCLIENT:{name:"action.get.adidclient"},SCAN_IBEACON:{name:"action.scan.ibeacon"},INTERACTIVE_VIBRATION:{name:"action.interactive.vibration"},SAVE_IMAGE_GALLERY:{name:"action.save.image.gallery",version_live:{iOS:408}},OPEN_MP:{name:"action.open.mp",version_live:{iOS:402}},CHANGE_ACTIONBAR:{name:"action.change.actionbar",version_live:{iOS:402},skip_jump:!0},ZBROWSER_MPDS:{name:"action.zbrowser.mpds",version_live:{iOS:402}},WEBVIEW_SET_RESULT:{name:"action.webview.set.result",version_live:{iOS:416}},MP_GET_NUMBER:{name:"action.mp.get.number",version_live:{iOS:416}},MP_OPEN_PROFILE_PICKER:{name:"action.mp.open.profile.picker",version_live:{iOS:432}},GET_SUPPORTED_ACTIONS:{name:"action.get.supported.actions",white_list:!0},MP_JOIN_WIFI:{name:"action.mp.join.wifi",version_live:{android:0,iOS:999},have_permission:!1,white_list:!1},PICK_MEDIA:{name:"action.pick.media",version_live:{iOS:999}},MP_CLOSE_LOADINGVIEW:{name:"action.mp.close.loadingview"}},wn=0,Nn=-1400,Pn=-1500,In=-1401,Cn=-1403,kn=-1404,Rn={SUCCESS:"Success",READ_MORE:"Read more at: https://miniapp.zalo.me/docs/api",LOGIN_REQUIRED:"Please login before to call this api. Read more at: https://miniapp.zalo.me/docs/api/login",LOGIN_FAILED:"Login failed.",NOT_PERMISSION:"You don't have permission to call this api",CLIENT_NOT_SUPPORT:"This API is not supported in this Zalo version",DECODE_FAILED:"Can not decode your data. Read more at: https://miniapp.zalo.me/docs/api/error"},Bn="apps/get-info",Dn={android:12100571,iOS:400,wp:0,unknown:0},jn=[bn.GET_DOWNLOADED_STICKER.name,bn.OPEN_SHARE_STICKER.name,bn.OPEN_PROFILE.name,bn.OPEN_FEED_DETAIL.name,bn.OPEN_FRIEND_RADA.name,bn.OPEN_INAPP.name,bn.OPEN_OUTAPP.name,bn.OPEN_PAGE.name,bn.OPEN_PHOTODETAIL.name,bn.OPEN_GALARY.name,bn.OPEN_GAMECENTER.name,bn.OPEN_GAMENEWS.name,bn.OPEN_TAB_CONTACT.name,bn.OPEN_TAB_SOCIAL.name,bn.OPEN_FRIENDSUGGEST.name,bn.OPEN_GROUPLIST.name,bn.OPEN_NEARBY.name,bn.OPEN_ROOM.name,bn.OPEN_STICKERSTORE.name,bn.OPEN_CREATECHAT.name,bn.COPY_LINK_CATESTICKER.name,bn.REQUEST_BUY_STICKER.name,bn.OPEN_CHAT.name,bn.OPEN_TAB_CHAT.name,bn.OPEN_CHATGROUP.name,bn.OPEN_ADDFRIEND.name,bn.OPEN_TAB_MORE.name,bn.OPEN_POSTFEED.name,bn.OPEN_LOGINDEVICES.name,bn.OPEN_SENDSTICKER.name,bn.REPORT_ABUSE.name,bn.FOLLOW_OA.name,bn.UNFOLLOW_OA.name,bn.OPEN_GAMEDETAIL.name,bn.OPEN_SHARESHEET.name,bn.REQUEST_PERMISSION_CAMERA.name,bn.CHANGE_TITLE_HEADER.name,bn.WEBVIEW_CLEARCACHE.name,bn.WEBVIEW_CONFIRMCACHE.name,bn.WEBVIEW_ISVISIBLE.name,bn.WEBVIEW_NETWORKTYPE.name,bn.CHANGE_BUTTON_HEADER.name,bn.CREATE_OPTIONS_MENU.name,bn.CREATE_SHORTCUT.name,bn.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE.name,bn.WINDOW_CLOSE.name,bn.WEBVIEW_CHECKRESERROR.name,bn.IAP_REQUESTPAYMENT.name,bn.ZBROWSER_GETSTATS.name,bn.ZBROWSER_JSBRIDGE.name,bn.PROMPT_AUTHENTICATION.name,bn.CHANGE_ACTIONBAR_COLOR.name,bn.PROMPT_AUTHENTICATION_CHECK_STATE.name,bn.OPEN_APPSTORE.name,bn.GET_LOCATION.name,bn.QUERY_LOCATION_HIDE.name,bn.SHOW_TOAST.name,bn.OPEN_APP.name,bn.HIDE_KEYBOARD.name,bn.OPEN_PHONE.name,bn.OPEN_QR.name,bn.OPEN_SMS.name,bn.VIEW_MYQR.name,bn.KEEP_SCREEN.name,bn.CHANGE_AUTOROTATE.name,bn.CHECK_APP_INSTALLED.name,bn.QUERY_SHOW.name,bn.QUERY_HIDE.name,bn.OPEN_INAPPRW.name,bn.ZALORUN_GETTRACKINGSTATUS.name,bn.ZALORUN_SETTRACKINGSTATUS.name,bn.ZALORUN_GETDAYSTEP.name,bn.ZALORUN_FORCESUBMITDATA.name,bn.ZALORUN_SETWEIGHT.name,bn.OPEN_PROFILE_EXT.name,bn.DOWNLOAD_CATE.name,bn.JUMP_LOGIN.name,bn.OPEN_ADTIMA_ADS_INTERSTITIAL.name,bn.OPEN_ADTIMA_ADS.name,bn.GET_ADIDCLIENT.name,bn.SCAN_IBEACON.name,bn.SAVE_IMAGE_GALLERY.name,bn.OPEN_MP.name,bn.CHANGE_ACTIONBAR.name,bn.INTERACTIVE_VIBRATION.name,bn.ZBROWSER_MPDS.name],Mn=0,Ln=3,xn=1,Un=0,Wn="https://payment-mini.zalo.me/api/order/create",zn="https://payment-mini.zalo.me/api/transaction",Fn="https://payment-mini.zalo.me/api/transaction/get-status";class Gn{constructor(e,t,n){this.code=e,this.message=t,this.api=n}toString(){return`api: ${this.api}; code: ${this.code}; message: ${this.message}`}}class Hn extends Gn{constructor(e,t){super(e,t),this.message=`${t}. ${Rn.READ_MORE}`,this.handler()}handler(){switch(this.code){case exports.NativeCode.token_invalid:this.code=In,this.message=Rn.LOGIN_REQUIRED;break;case exports.NativeCode.not_permission:this.code=Cn,this.message=Rn.NOT_PERMISSION;break;case exports.NativeCode.client_not_support:this.code=kn,this.message=Rn.CLIENT_NOT_SUPPORT;break;case exports.NativeCode.decode_failed:this.message=Rn.DECODE_FAILED}}}const $n={handler:null,setHandler(e){this.handler=e}};$n.setHandler(((e,t)=>t instanceof Gn?(t.api=e,t):new Gn(-2001,ln.isNull(t.message)?"Unknown Error":t.message,e)));const Vn=(e,t,i)=>{const o=i.value;return i.value=function(...e){return n(this,void 0,void 0,(function*(){const{success:i,fail:r}=Array.isArray(e)&&e.length>0&&e[0];return new Promise(((a,s)=>n(this,void 0,void 0,(function*(){try{const t=yield o.apply(this,e);!ln.isNull(i)&&ln.isFunction(i)?i.call(null,t,this):a(t)}catch(e){if("login"!==(null==e?void 0:e.api)&&((null==e?void 0:e.code)===In||(null==e?void 0:e.code)===Cn)){let t=!1;this instanceof xo&&(t=this.getLoginStatus()),t||(e=new Gn(In,Rn.LOGIN_REQUIRED))}const{handler:n}=$n,i=n.call(null,t,e,this);window.zmpSentry&&window.zmpSentry.throwError(i.toString()),!ln.isNull(r)&&ln.isFunction(r)?r.call(null,i,this):s(i)}}))))}))},i},Zn=(e,t,n)=>{const i=n.value;return n.value=function(...e){try{return i.apply(this,e)}catch(e){if("login"!==(null==e?void 0:e.api)&&((null==e?void 0:e.code)===In||(null==e?void 0:e.code)===Cn)){let t=!1;this instanceof xo&&(t=this.getLoginStatus()),t||(e=new Gn(In,Rn.LOGIN_REQUIRED))}const{handler:n}=$n,i=n.call(null,t,e,this);throw window.zmpSentry&&window.zmpSentry.throwError(i.toString()),i}},n},Jn=(e,t)=>({code:wn,message:t||Rn.SUCCESS,data:e||{}}),Kn={badRequest:e=>new Gn(Nn,e),loginFailed:()=>new Gn(Nn,Rn.LOGIN_FAILED),loginRequired:()=>new Gn(In,Rn.LOGIN_REQUIRED),missingParam:e=>new Gn(Nn,`Missing required argument: ${e}`),wrongTypeParam:(e,t,n)=>new Gn(Nn,`Wrong type of parameter '${e}'. Expected ${t}, but got ${n}`),cannotGetShareInfo:()=>new Gn(Pn,"Can not get app info to share"),lengthInvalid:e=>new Gn(Nn,`${e} length is invalid.`)};const qn={encode:function(e){var t=[];for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];if(void 0===i)return;if(null===i)return void t.push(n);t.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}return t.join("&")},decode:function(e,t){var n={};if(""===e)return n;for(var i=e.split("&"),o=0;o<i.length;o++){var r=i[o].split("=",2),a=decodeURIComponent(r[0]);if(t&&Object.prototype.hasOwnProperty.call(n,a))throw new URIError("Duplicate key: "+a);n[a]=2===r.length?decodeURIComponent(r[1]):null}return n},appendToUrl:function(e,t){return e+(-1!==e.indexOf("?")?"&":"?")+("string"==typeof t?t:qn.encode(t))},getParameterByName:function(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");var n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return n?n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"":null},getParamsAsObject:function(e){var t={};return e?(e.split("&").map((function(e){var n=e.split("=");n&&2==n.length&&(t[n[0]]=decodeURIComponent(n[1].replace(/\+/g," ")))})),t):t},toQueryString:function(e){if(!e)return"";if("object"!=(void 0===e?"undefined":typeof e))return e;var t=Object.keys(e),n=[];return t.map((function(t){var i=e[t],o=[t,i="object"==(void 0===i?"undefined":typeof i)?JSON.stringify(i):encodeURIComponent(i)].join("=");n.push(o)})),n.join("&")}};var Qn=qn;const Yn=new RegExp("[\\u0300-\\u036f]","g"),Xn=new RegExp("[đ|Đ]","g"),ei=new RegExp("\\s","g"),ti=un("zmp:utils:common"),ni=e=>{try{new URL(e)}catch(e){return!1}return!0},ii=()=>navigator.userAgent||navigator.vendor||window.opera,oi=()=>{const e=ii().toLowerCase();return{isWP:/iemobile/.test(e),isAndroid:/android/i.test(e)&&!/iemobile/.test(e),isIOS:/iphone|ios|ipad|ipod/.test(e)&&!/iemobile/.test(e),isMobile:/android|iphone|ios|ipad|ipod|iemobile/.test(e),isZalo:/zalo/.test(e)}},ri=e=>{const t=document.getElementsByTagName("meta");for(let n=0;n<t.length;n++)if(t[n].getAttribute("name")===e||t[n].getAttribute("property")===e)return t[n].getAttribute("content");return""},ai=()=>{const e=ii().toLowerCase().split("zalo")[1];if(e){return e.replace(" ","").split("/")[1]||""}return""},si=()=>{let e=oi();return e.isWP?exports.PlatformType.wp:e.isAndroid?exports.PlatformType.android:e.isIOS?exports.PlatformType.iOS:exports.PlatformType.unknown},ci=(e,t)=>{const n=t.toLowerCase(),i=n.split(/[<>]/i),o="array"===i[0];return!!("url"===n&&ni(e)||o&&("array"===n&&Array.isArray(e)||((e,t)=>Array.isArray(t)&&!t.some((t=>"url"===e?!ni(t):typeof t!==e)))(i[1],e))||!Array.isArray(e)&&typeof e===t)},li=e=>(e=>{let t=pn(e);return t||(t=hn(e),t)?t:dn(e)})(e),ui=e=>{if(ln.isObject(JSON)&&JSON.parse&&ln.isString(e)){const t=e.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");return JSON.parse(t,((e,t)=>t))}return ln.isObject(e)?e:new Function("return "+e)()},di=e=>{if(ln.isObject(JSON)&&JSON.stringify)return JSON.stringify(e);if(void 0===e)return"undefined";if(null===e)return"null";try{if("string"==typeof e||null!==e.constructor.toString().match(/string/i))return'"'+e.replace(/"/g,'\\"')+'"'}catch(e){console.log(e)}var t;if(null!==Object.prototype.toString.call(e).match(/array/i)){t=new Array;for(var n=e.length,i=0;i<n;i++)t.push(di(e[i]));return"["+t.join(",")+"]"}if("object"==typeof e){for(var o in t=new Array,e)t.push('"'+o+'":'+di(e[o]));return"{"+t.join(",")+"}"}return e.toString()},pi=()=>{try{const e=Number(ai()),t=si();return e>=Dn[t]}catch(e){return!0}},hi=e=>JSON.stringify(e).replace(/"/g,'\\"').replace(/'/g,"'"),vi=e=>{try{if(e){ti(e);const t=e.replace(/\\/g,"").replace(/'/g,"'");return ti("formattedValue",t,JSON.parse(t),typeof JSON.parse(t)),JSON.parse(t)}return null}catch(t){return ti("parse json error:",t),e}},fi=(e,t,i,o,r,a)=>n(void 0,void 0,void 0,(function*(){const n=new URL(location.href),s=new URLSearchParams;let c=`${n.pathname}${n.search}`;a&&(c=`/zapps/${e}${"/"===a[0]?"":"/"}${a}`);const l=new URL(`https://zalo.me/app/link${c}`);s.append("title",i),s.append("description",o||""),s.append("thumbnail",r),s.append("url",l.href),s.append("accessToken",t||"");const u=yield fetch("https://h5.zalo.me/openapi/create-sharelink",Object.assign({method:"POST",body:s},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})),d=yield u.json();if(!d||0!==d.err)throw Kn.cannotGetShareInfo();return l.search=`${l.search}&zshareId=${d.data.shareId}`,Object.assign(Object.assign({},d.data),{shareableLink:l.href})})),mi=(e,t)=>n=>{if(!(Array.isArray(e)?e.some((e=>ci(n,e))):ci(n,e)))return{error:!0,errorMessage:e};if(t){if(Array.isArray(null==t?void 0:t.values))return{error:!(null==t?void 0:t.values.includes(n)),errorMessage:null==t?void 0:t.values.toString()};if(ln.isNumber(null==t?void 0:t.maxLength))return{error:ln.isString(n)&&n.length>(null==t?void 0:t.maxLength),errorMessage:`data length must <= ${null==t?void 0:t.maxLength}`};if(ln.isNumber(null==t?void 0:t.min)&&ln.isNumber(null==t?void 0:t.max))return{error:n<(null==t?void 0:t.min)||n>(null==t?void 0:t.max),errorMessage:`data must be in between ${null==t?void 0:t.min} and ${null==t?void 0:t.max}`};if(ln.isNumber(null==t?void 0:t.min))return{error:n<(null==t?void 0:t.min),errorMessage:`data must >= ${null==t?void 0:t.min}`};if(ln.isNumber(null==t?void 0:t.max))return{error:n>(null==t?void 0:t.max),errorMessage:`data must <= ${null==t?void 0:t.max}`};if(ln.isRegExp(null==t?void 0:t.regex))return{error:!t.regex.test(n),errorMessage:"data must valid"}}return{error:!1}},gi=(e,t,i)=>n(void 0,void 0,void 0,(function*(){const n={appId:e,versionStatus:t};ln.isUndefined(i)||(n.currentVersion=i);const o=Qn.appendToUrl(`https://h5.zalo.me/${Bn}`,n),r=yield fetch(o,{credentials:"include"});if(r.ok){const e=yield r.json();if(e.err<0||!e.data)throw new Error(e);return{name:e.data.name,version:e.data.version,description:e.data.description,appUrl:e.data.appUrl,qrCodeUrl:e.data.qrCodeUrl,logoUrl:e.data.logoUrl}}throw new Error("Can't get app info")}));var yi=h((function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function r(e,t,i,r,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new o(i,r||e,a),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,i,o=[];if(0===this._eventsCount)return o;for(i in e=this._events)t.call(e,i)&&o.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},s.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var o=0,r=i.length,a=new Array(r);o<r;o++)a[o]=i[o].fn;return a},s.prototype.listenerCount=function(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},s.prototype.emit=function(e,t,i,o,r,a){var s=n?n+e:e;if(!this._events[s])return!1;var c,l,u=this._events[s],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,i),!0;case 4:return u.fn.call(u.context,t,i,o),!0;case 5:return u.fn.call(u.context,t,i,o,r),!0;case 6:return u.fn.call(u.context,t,i,o,r,a),!0}for(l=1,c=new Array(d-1);l<d;l++)c[l-1]=arguments[l];u.fn.apply(u.context,c)}else{var p,h=u.length;for(l=0;l<h;l++)switch(u[l].once&&this.removeListener(e,u[l].fn,void 0,!0),d){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,t);break;case 3:u[l].fn.call(u[l].context,t,i);break;case 4:u[l].fn.call(u[l].context,t,i,o);break;default:if(!c)for(p=1,c=new Array(d-1);p<d;p++)c[p-1]=arguments[p];u[l].fn.apply(u[l].context,c)}}return!0},s.prototype.on=function(e,t,n){return r(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return r(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,i,o){var r=n?n+e:e;if(!this._events[r])return this;if(!t)return a(this,r),this;var s=this._events[r];if(s.fn)s.fn!==t||o&&!s.once||i&&s.context!==i||a(this,r);else{for(var c=0,l=[],u=s.length;c<u;c++)(s[c].fn!==t||o&&!s[c].once||i&&s[c].context!==i)&&l.push(s[c]);l.length?this._events[r]=1===l.length?l[0]:l:a(this,r)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new i,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s}));class _i extends yi{constructor(){super(),this.debug=un("zmp:event-emitter")}static getInstance(){return _i.instance||(_i.instance=new _i),_i.instance}h5ConfirmHandleEvent(e,t,n){ZaloJavaScriptInterface.jsH5EventCallback(e,t,n||"")}on(e,t,n){this.debug(`register ${e}: ${n}`);return super.on(e,((i,o)=>{this.h5ConfirmHandleEvent(i,e,n),t(o)}),n)}once(e,t,n){this.debug(`register once ${e}: ${n}`);return super.once(e,((i,o)=>{this.h5ConfirmHandleEvent(i,e,n),t(o)}),n)}}var Ei={},Si=function(e,t,n){var i=t||"default";return function(){var t=i in Ei?Ei[i](e,n):e;return t.apply(this,arguments)}};Si.setWrapper=function(e){var t=arguments.length<=1||void 0===arguments[1]?"default":arguments[1];Ei[t]=e};var Ai={error:{code:1,error_subcode:1357046,message:"Received Invalid JSON reply.",type:"http"}};function Oi(e){try{return null===e?Ai:JSON.parse(e)}catch(e){return Ai}}var Ti,bi={execute:function(e,t,n,i){n.suppress_http_code=1;var o=Qn.encode(n);"post"!=t&&(e=Qn.appendToUrl(e,o),o="");var r=function(e,t){if(!self.XMLHttpRequest)return null;var n=new XMLHttpRequest,i=function(){};if(!("withCredentials"in n))return null;n.open(e,t,!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded");var o={send:function(e){n.send(e)}},r=Si((function(){r=i,"onload"in o&&o.onload(n)}),"entry","XMLHttpRequest:load"),a=Si((function(){a=i,"onerror"in o&&o.onerror(n)}),"entry","XMLHttpRequest:error");return n.onload=function(){r()},n.onerror=function(){a()},n.onreadystatechange=function(){4==n.readyState&&(200==n.status?r():a())},o}(t,e);return!!r&&(r.onload=function(e){i(Oi(e.responseText))},r.onerror=function(e){e.responseText?i(Oi(e.responseText)):i({error:{code:1,error_subcode:1357045,message:"unknown error (empty response)",status:e.status,type:"http"}})},r.send(o),!0)}};class wi extends yi{constructor(){super(),this.debug=un("zmp:ZaloJSBridge"),this.events=_i.getInstance(),this._accessTk=li("zacc_session")||"DEFAULT_ACCESS_TOKEN",this._jsAccessTk=li("zlink3rd")||"DEFAULT_JS_TOKEN",this.results=[],this._userAgent=ii(),this._device=oi(),this._jsCallFuncCallbacks={},this.events.on(exports.Events.AppPaused,(()=>{if(this.results.length>0){let e=this.results;this.results=[];try{this.sendLogData(e)}catch(e){}}})),this.sendLogTimer?clearInterval(this.sendLogTimer):this.sendLogTimer=setInterval((()=>{if(this.results.length>0){let e=this.results;this.results=[];try{this.sendLogData(e)}catch(e){}}}),5e3)}static getInstance(){return wi.instance||(wi.instance=new wi),wi.instance}set accessTk(e){this._accessTk=e}set jsAccessTk(e){this._jsAccessTk=e}sendLogData(e){try{bi.execute("https://h5.zalo.me/log/async","post",{appId:window.APP_ID,data:JSON.stringify(e)},(e=>{}))}catch(e){}}onJSCall(e,t){try{this.debug("onJSCall",e,t);const n=ui(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,i=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,n)}catch(e){console.error("Call callback error",e)}i&&clearTimeout(i),this._jsCallFuncCallbacks[e]=null,delete this._jsCallFuncCallbacks[e]}}this.results.push({action:n.action,error:n.error_code})}catch(e){console.log("onJSCall","error",e)}}onMultiJSCall(e,t){try{this.debug("onMultiJSCall",e,t);const n=ui(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,i=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,n)}catch(e){console.error("Call callback error",e)}i&&clearTimeout(i)}}this.results.push({action:n.action,error:n.error_code})}catch(e){console.log("onMultiJSCall","error",e)}}nativeEventHandler(e,t,n){this.debug(`eventId: ${e}, eventName: ${t}, eventData: ${n}`);const i=vi(n);this.debug(i);const o=this.handleEventData(t,i);this.events.emit(t,e,o)}handleEventData(e,t){try{switch(e){case exports.Events.OpenApp:const{url:e}=t,n=new URL(e),i=n.pathname.split(`/zapps/${fn}`)[1];return{path:`${i||"/"}${n.search}`};default:return t}}catch(e){return t}}defaultCallback(e){null!=e&&(e=ui(e))}jsCall(e,t,n,i=!1,o=3,r=!0){try{const a=e.name,s=((e="")=>`${e.normalize("NFD").replace(Yn,"").replace(Xn,"d").replace(ei,"").toLowerCase()}_${Math.random().toString(36).substr(2,4)}`)(a);if(!this._device.isMobile||ln.isEmpty(a))return this.onJSCall(s,{error_code:-13,error_message:"params invalid!",data:{device:this._device.isMobile,jsToken:this._jsAccessTk,access_token:this._accessTk},action:a}),!1;null==t&&(t={}),n||(n=this.defaultCallback);const c={error_code:-14,error_message:"Request Timeout!",data:{},action:a};this._jsCallFuncCallbacks[s]={timeout:r&&e.have_callback&&setTimeout((()=>{this.onJSCall(s,c)}),8e3),callback:n};try{return t=di(t),i?this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,window.onMultiJSCall(s)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,`window.onMultiJSCall('${s}')`):this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,window.onJSCall(s)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,`window.onJSCall('${s}')`)}catch(r){if(!(o-- >0)){const e={error_code:-5,error_message:"Not ready!",data:{userAgent:this._userAgent,options:t,jsToken:this._jsAccessTk,access_token:this._accessTk},action:a,js_error:r};return this.onJSCall(s,e),!1}setTimeout((()=>{this.jsCall(e,t,n,i,o)}),500)}}catch(e){console.log("jsCall","error",e)}return!1}}class Ni{constructor(){this.debug=un("zmp:ZJSBridgeProvider"),Ti.set(this,void 0),o(this,Ti,wi.getInstance(),"f")}setZAccSession(e){i(this,Ti,"f").accessTk=e}setJSToken(e){i(this,Ti,"f").jsAccessTk=e}callNative(e,t,o){return this.debug(e.name,t),new Promise(((r,a)=>{const s=i=>n(this,void 0,void 0,(function*(){try{const n=new Hn(i.error_code,`${i.action}: ${i.error_message}`);if(null==o?void 0:o.callback){const e=yield o.callback(i,n);return r(e)}if(i&&i.error_code>=0)r(i.data||{});else if(i&&i.error_code<0){try{window.zmpSentry&&window.zmpSentry.captureMessage(`${e.name}: call native fail`,{extra:{data:t,rs:i}})}catch(e){}return a(n)}}catch(e){return a(e)}})),c=oi().isIOS,l=(e=>{var t;const n=ai(),i=(null===(t=null==e?void 0:e.version_live)||void 0===t?void 0:t.iOS)||0;return!!(Array.isArray(window.ignoreCheckSupport)&&window.ignoreCheckSupport.length>0&&window.ignoreCheckSupport.includes(e.name))||n>=i})(e);if(c&&!l){const t=new Hn(-5,`${e}: Client isn't support this action`);return a(t)}(null==o?void 0:o.delay)?setTimeout((()=>{i(this,Ti,"f").jsCall(e,t,s,null==o?void 0:o.isMultiCallback,null==o?void 0:o.nRetry,null==o?void 0:o.haveTimeout)}),o.delay):i(this,Ti,"f").jsCall(e,t,s,null==o?void 0:o.isMultiCallback,null==o?void 0:o.nRetry,null==o?void 0:o.haveTimeout)}))}}Ti=new WeakMap;var Pi,Ii,Ci,ki,Ri;class Bi{static getVersion(){return"2.19.0-rc.5"}static getSystemInfo(){return{version:ri("version-id")||"",apiVersion:"2.19.0-rc.5",zaloVersion:ai(),platform:si(),language:navigator.language,zaloLanguage:window.zLanguage||"vi",zaloTheme:window.zTheme||"light"}}static getAppInfo(){return n(this,void 0,void 0,(function*(){const e=this.getAppId(),t=this.getSystemInfo();return yield gi(e,0,t.version)}))}}class Di{static setNavigationBarTitle(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.CHANGE_TITLE_HEADER,{title:e.title},{haveTimeout:!1})}))}static setNavigationBarColor(e){return n(this,void 0,void 0,(function*(){const t={};let n;ln.isEmpty(e.textColor)||(t.textColor=e.textColor),ln.isString(e.color)&&e.color.length>0?(ln.isEmpty(e.color)||(t.backgroundColor=e.color),n=5):(ln.isEmpty(e.statusBarColor)||(t.backgroundColor=e.statusBarColor),n=6),this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{actionbarType:n,dataConfig:Object.assign(Object.assign({},e.dataConfig),t)}))),yield this.callNative(bn.CHANGE_ACTIONBAR,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarLeftButton(e){return n(this,void 0,void 0,(function*(){const t="none"===e.type||"home"===e.type?Ln:Mn,n="home"===e.type||"both"===e.type?xn:Un;this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{buttonType:t,dataConfig:Object.assign(Object.assign({},e.dataConfig),{viewInLeftType:t}),homeConfig:Object.assign(Object.assign({},e.homeConfig),{enable:n})}))),yield this.callNative(bn.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarRightButton(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.CREATE_OPTIONS_MENU,{supportToolBar:e.supportToolBar,reset:e.reset,menuListItems:e.menuListItems,zapp:this.getAppId()})}))}}class ji{static setBackgroundColor(e){return n(this,void 0,void 0,(function*(){ln.isString(e.backgroundColor)&&e.backgroundColor.length>0&&(yield this.callNative(bn.CHANGE_ACTIONBAR,{actionbarType:this.isShowNavBar?5:6,dataConfig:{backgroundColor:e.backgroundColor,textColor:e.textColor}}))}))}}class Mi{constructor(e,t,n,i){this.title=i,this.severity=t;const o=new Date;if(this.time=o.toLocaleTimeString(),this.content=e,n>0){const e=(new Error).stack;this.stack=e?e.replace("Error\n",""):""}}toString(){return(this.content.stack?[this.title,this.severity.toUpperCase(),this.time,this.content,this.content.stack.replace("Error:","")]:[this.title,this.severity.toUpperCase(),this.time,JSON.stringify(this.content),this.stack]).join(" ")}}Pi=new WeakMap,Ii=new WeakMap,Ci=new WeakMap,ki=new WeakMap,Ri=new WeakMap;var Li,xi,Ui,Wi,zi,Fi,Gi,Hi,$i,Vi,Zi,Ji,Ki,qi,Qi,Yi,Xi,eo,to,no,io,oo,ro,ao,so,co,lo,uo,po=new class{constructor(){Pi.set(this,3),Ii.set(this,["none","error","warn","info"]),Ci.set(this,"[zmp] > "),ki.set(this,{error:0,warn:0,info:0,firstError:null,lastError:null}),Ri.set(this,((e,t,n)=>{i(this,ki,"f")[i(this,Ii,"f")[e]]++;const r=i(this,Ii,"f")[e];if(o(this,Ci,i(this,Ci,"f")+("string"!=typeof t?new Mi(t,r,e,n).toString():t),"f"),!(e>i(this,Pi,"f")))switch(e){case 1:console.error(i(this,Ci,"f"));break;case 2:console.warn(i(this,Ci,"f"));break;case 3:console.info(i(this,Ci,"f"));break;default:throw new Error("internal")}}))}setLogLevel(e){o(this,Pi,e,"f")}info(e){i(this,Ri,"f").call(this,3,e)}warn(e,t){i(this,Ri,"f").call(this,2,e,t)}error(e,t){i(this,Ri,"f").call(this,1,e,t)}getMetrics(){return i(this,ki,"f")}};class ho{static setDeviceOrientation(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.CHANGE_AUTOROTATE,{autoRotate:exports.OrientationType[e.rotate]})}))}static getNetworkType(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.WEBVIEW_NETWORKTYPE,{url:window.location.href,featureId:""}).then((e=>{const t=e.network;let n;const i=oi().isAndroid;switch(t){case Tn(i).NONE:n=exports.NetworkType.none;break;case Tn(i).WIFI:n=exports.NetworkType.wifi;break;case Tn(i)["2G"]:case Tn(i)["3G"]:case Tn(i)["4G"]:n=exports.NetworkType.cellular;break;default:n=exports.NetworkType.unknown}return{networkType:n}}))}))}static onNetworkStatusChange(e){return n(this,void 0,void 0,(function*(){yield this.events.on(exports.Events.NetworkChanged,(t=>{const n=t&&t.state;this.getNetworkType().then((t=>{const i={isConnected:"CONNECTED"===n,networkType:t&&t.networkType};e(i)})).catch((e=>{po.error(e,"onNetworkStatusChange")}))}))}))}static startBeaconDiscovery(e){var t,i,o,r,a;return n(this,void 0,void 0,(function*(){const n={subaction:0,scanning_type:ln.isNumber(null==e?void 0:e.scanningType)?e.scanningType:0,data:{scan_from_source:ln.isString(null==e?void 0:e.scanFromSource)?e.scanFromSource:"",expire:ln.isNumber(null==e?void 0:e.expire)?e.expire:3e3,monitor_interval:ln.isNumber(null==e?void 0:e.monitorInterval)?e.monitorInterval:60,domain:ln.isString(null==e?void 0:e.domain)?e.domain:"",scan_config:{scan_time:ln.isNumber(null===(t=null==e?void 0:e.scanConfig)||void 0===t?void 0:t.scanTime)?e.scanConfig.scanTime:15e3,time_between_scan:ln.isNumber(null===(i=null==e?void 0:e.scanConfig)||void 0===i?void 0:i.timeBetweenScan)?e.scanConfig.timeBetweenScan:1e4,beacon_timeout:ln.isNumber(null===(o=null==e?void 0:e.scanConfig)||void 0===o?void 0:o.beaconTimeout)?e.scanConfig.beaconTimeout:3e4,delayCheckConnectedTimeout:ln.isNumber(null===(r=null==e?void 0:e.scanConfig)||void 0===r?void 0:r.delayCheckConnectedTimeout)?e.scanConfig.delayCheckConnectedTimeout:5e3,beaconConnectedTimeout:ln.isNumber(null===(a=null==e?void 0:e.scanConfig)||void 0===a?void 0:a.beaconConnectedTimeout)?e.scanConfig.beaconConnectedTimeout:6e5},items:Array.isArray(null==e?void 0:e.items)?null==e?void 0:e.items:[]}};return yield this.callNative(bn.SCAN_IBEACON,Object.assign({},n)),!0}))}static stopBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.SCAN_IBEACON,Object.assign({},{subaction:2})),!0}))}static getBeacons(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.SCAN_IBEACON,Object.assign({},{subaction:1}),{isMultiCallback:!0}).then((e=>{const t={beacons:[]};return Array.isArray(e)&&e.forEach((e=>{const n={uuid:e.uuid,major:e.major,minor:e.minor,distance:e.distance,rssi:e.rssi};t.beacons.push(n)})),t}))}))}static stopBluetoothDevicesDiscovery(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static startBluetoothDevicesDiscovery(e){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},Object.assign({},e))}))}static openBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static onBluetoothDeviceFound(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static onBluetoothAdapterStateChange(){return n(this,void 0,void 0,(function*(){return Promise.resolve()}))}static getConnectedBluetoothDevices(e){return n(this,void 0,void 0,(function*(){const t={services:e.services||[]};return this.callNative({name:""},t)}))}static getBluetoothDevices(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static getBluetoothAdapterState(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static closeBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static scanQRCode(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.OPEN_QR,{skipOpenLink:!0})}))}static showToast(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.SHOW_TOAST,{toast:e.message})}))}static hideKeyboard(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.HIDE_KEYBOARD,{})}))}static openPhone(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.OPEN_PHONE,{phoneNum:e.phoneNumber,phoneCode:e.phoneNumber})}))}static openSMS(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.OPEN_SMS,{content:e.content,phoneCode:e.phoneNumber})}))}static keepScreen(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.KEEP_SCREEN,{data:{keep_screen_on:e.keepScreenOn?1:0}})}))}static openBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.PROMPT_AUTHENTICATION,{secret_data:e.secretData,app_id:this.getZAppId(),ui:{title:e.ui.title,sub_title:e.ui.subTitle,negative_text:e.ui.negativeButtonText},require_fingerprint:e.requireFingerprint?1:0}).then((e=>{var t,n,i,o;return{code:null==e?void 0:e.error_code,message:null==e?void 0:e.error_message,data:{domain:null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.domain,code:null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.error_code,message:null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.error_message,payToken:null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.pay_token}}}))}))}static checkStateBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.PROMPT_AUTHENTICATION_CHECK_STATE,{}).then((e=>({bioState:null==e?void 0:e.bio_state})))}))}static vibrate(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.INTERACTIVE_VIBRATION,{type:exports.VibrateType[e.type],vibrate_time:e.milliseconds})}))}static connectWifi(e){return n(this,void 0,void 0,(function*(){let t="open";return ln.isString(e.password)&&e.password.length>0&&(t="wpa_wpa2"),yield this.callNative(bn.MP_JOIN_WIFI,{ssid:e.SSID,securityType:t,password:e.password,hiddenSsid:e.hiddenSSID})}))}}class vo{constructor(e){Li.set(this,localStorage),xi.set(this,void 0),Ui.set(this,void 0),oi(),o(this,Ui,{keys:new Set,currentSize:0,limitSize:5242880},"f"),o(this,xi,e,"f"),this.findAllCurrentDataByApp(e)}findAllCurrentDataByApp(e){try{let t;for(t in i(this,Li,"f")){if(e){if(t.split("_")[0]!==e)continue}i(this,Ui,"f").keys.add(t)}}catch(e){po.error(e,"LocalResourceStorage > findAllCurrentDataByApp")}}get(e){let t=new Map;return e.forEach((e=>{t.set(e,this.getSync(e))})),Promise.resolve(t)}getSync(e){return i(this,xi,"f")&&(e=`${i(this,xi,"f")}_${e}`),i(this,Ui,"f").keys.has(e)?i(this,Li,"f").getItem(e):null}set(e){return n(this,void 0,void 0,(function*(){return Object.entries(e).forEach((([e,t])=>{this.setSync(e,t.replace(/\\"/g,'"'))})),Promise.resolve({errorKeys:[]})}))}setSync(e,t){i(this,xi,"f")&&(e=`${i(this,xi,"f")}_${e}`),i(this,Li,"f").setItem(e,t),i(this,Ui,"f").keys.add(e)}getInfo(){return n(this,void 0,void 0,(function*(){return Promise.resolve(this.getInfoSync())}))}getInfoSync(){const e=((e,t)=>{let n,i,o=0;for(i in e){const r=i.split("_")[0];e.hasOwnProperty(i)&&(t&&r!==t||(n=2*(e[i].length+i.length),o+=n))}return o})(i(this,Li,"f"),i(this,xi,"f"));return{currentSize:ln.isNumber(e)?Number((e/1024).toFixed(2)):0,limitSize:Number(5120..toFixed(2))}}remove(e){return n(this,void 0,void 0,(function*(){return e.forEach((e=>{this.removeSync(e)})),Promise.resolve({errorKeys:[]})}))}removeSync(e){i(this,xi,"f")&&(e=`${i(this,xi,"f")}_${e}`),i(this,Ui,"f").keys.has(e)&&(i(this,Li,"f").removeItem(e),i(this,Ui,"f").keys.delete(e))}clear(){return n(this,void 0,void 0,(function*(){return Promise.resolve(this.clearSync())}))}clearSync(){i(this,Ui,"f").keys.forEach((e=>{i(this,xi,"f")&&e.indexOf(i(this,xi,"f"))<0||(i(this,Li,"f").removeItem(e),i(this,Ui,"f").keys.delete(e))}))}}Li=new WeakMap,xi=new WeakMap,Ui=new WeakMap;class fo extends Ni{constructor(e){super(),Wi.set(this,void 0),zi.set(this,void 0),o(this,zi,{keys:new Set,currentSize:0,limitSize:5242880},"f"),o(this,Wi,e,"f")}get(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.ZBROWSER_MPDS,{mpds_action:"mpds.get",mpds_data:{keys:e},appId:i(this,Wi,"f")},{isMultiCallback:!1}).then((e=>{let t=new Map;return e&&e.mpds_data&&e.mpds_data.map&&(t=new Map(Object.entries(e.mpds_data.map))),t}))}))}set(e){return n(this,void 0,void 0,(function*(){return{errorKeys:yield this.callNative(bn.ZBROWSER_MPDS,{mpds_action:"mpds.set",mpds_data:{map:e},appId:i(this,Wi,"f")},{isMultiCallback:!1}).then((e=>{let t=[];return e&&e.mpds_data&&e.mpds_data.error_keys&&(t=e.mpds_data.error_keys),t}))}}))}getInfo(){return n(this,void 0,void 0,(function*(){const e=yield this.callNative(bn.ZBROWSER_MPDS,{mpds_action:"mpds.get.size",mpds_data:{},appId:i(this,Wi,"f")},{isMultiCallback:!1}).then((e=>{let t=0;return e&&e.mpds_data&&e.mpds_data.size&&(t=e.mpds_data.size),t}));return{currentSize:ln.isNumber(e)?Number(e/1024):0,limitSize:Number(5120)}}))}remove(e){return n(this,void 0,void 0,(function*(){return{errorKeys:yield this.callNative(bn.ZBROWSER_MPDS,{mpds_action:"mpds.remove.key",mpds_data:{keys:e},appId:i(this,Wi,"f")},{isMultiCallback:!1}).then((e=>{let t=[];return e&&e.mpds_data&&e.mpds_data.error_keys&&(t=e.mpds_data.error_keys),t}))}}))}clear(){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.ZBROWSER_MPDS,{mpds_action:"mpds.clear.appData",mpds_data:{},appId:i(this,Wi,"f")})}))}}Wi=new WeakMap,zi=new WeakMap;class mo{getDataFromStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance(),n=yield t.get(e),i={};return n.forEach(((e,t)=>{i[t]=vi(e)})),i}))}putDataToStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance(),n={};return Object.entries(e).forEach((([e,t])=>{ln.isUndefined(t)||ln.isNull(t)||(n[e]=hi(t))})),yield t.set(n)}))}removeDataFromStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance();return yield t.remove(e)}))}clearStorage(){return n(this,void 0,void 0,(function*(){const e=this.getInstance();yield e.clear()}))}getStorageInfo(){return n(this,void 0,void 0,(function*(){const e=this.getInstance();return yield e.getInfo()}))}}class go extends mo{constructor(e){super(),Fi.set(this,void 0),o(this,Fi,e,"f")}getInstance(){return new vo(i(this,Fi,"f"))}}Fi=new WeakMap;class yo extends mo{constructor(e){super(),Gi.set(this,void 0),o(this,Gi,e,"f")}getInstance(){return new fo(i(this,Gi,"f"))}}Gi=new WeakMap;class _o{static setStorage(e){return n(this,void 0,void 0,(function*(){let t=new go(this.getAppId());return pi()&&(t=new yo(this.getAppId())),yield t.putDataToStorage(e.data)}))}static getStorage(e){return n(this,void 0,void 0,(function*(){let t=new go(this.getAppId());pi()&&(t=new yo(this.getAppId()));return yield t.getDataFromStorage(e.keys)}))}static getStorageInfo(e){return n(this,void 0,void 0,(function*(){let e=new go(this.getAppId());return pi()&&(e=new yo(this.getAppId())),yield e.getStorageInfo()}))}static removeStorage(e){return n(this,void 0,void 0,(function*(){let t=new go(this.getAppId());return pi()&&(t=new yo(this.getAppId())),yield t.removeDataFromStorage(e.keys)}))}static clearStorage(e={}){return n(this,void 0,void 0,(function*(){let e=new go(this.getAppId());pi()&&(e=new yo(this.getAppId())),yield e.clearStorage()}))}}class Eo{static getUserInfo(e){return n(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();let i="id,name,picture";(null==e?void 0:e.avatarType)&&(i=`${i}.type(${null==e?void 0:e.avatarType})`);return{userInfo:yield fetch(`${En}?fields=${i}`,{headers:{access_token:t||""}}).then((e=>n(this,void 0,void 0,(function*(){const t=yield e.json(),n={id:t.id,name:t.name,birthday:"",gender:"",avatar:t.picture&&t.picture.data&&t.picture.data.url};return console.warn("'birthday' and 'gender' are deprecated"),n}))))}}))}static getPhoneNumber(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.MP_GET_NUMBER,{},{isMultiCallback:!0,callback:(e,t)=>{if(0===e.error_code){const t={number:e.data};return Promise.resolve(t)}return Promise.reject(t)},delay:this.isIOS?400:0})}))}}class So{static closeApp(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.WINDOW_CLOSE,{})}))}static openMiniApp(e){return n(this,void 0,void 0,(function*(){const t=null==e?void 0:e.appId,n=(null==e?void 0:e.params)||{},i=Object.entries(n).map((function([e,t]){return[e,t].join("=")})).join("&");let o;try{o=yield gi(t,0)}catch(e){}const r={appId:t};o&&(r.appName=o.name,r.appAvtUrl=o.logoUrl),yield this.callNative(bn.OPEN_MP,{mpUrl:`https://h5.zdn.vn/zapps/${t}/${i.length>0?"?"+i:""}`,mpInfo:r})}))}static openWebview(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.OPEN_INAPP,{url:e.url})}))}static closeLoading(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.MP_CLOSE_LOADINGVIEW,{at:(new Date).getTime(),when:e,url:location.href})}))}}class Ao{static getLocation(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.GET_LOCATION,{silent_request:!1,permission_description:"Cho phép Zalo truy cập vào vị trí của thiết bị này?"},{isMultiCallback:!0,haveTimeout:!1,callback:(e,t)=>{if(0===e.error_code){const t=e.data,n={latitude:t.latitude,longitude:t.longitude,timestamp:t.timestamp,provider:t.provider};return Promise.resolve(n)}return Promise.reject(t)},delay:this.isIOS?400:0})}))}static sendLocation(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.QUERY_LOCATION_HIDE,{title:e.title,touserid:e.toUserId,zapp:this.getZAppId()})}))}}class Oo{static requestCameraPermission(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.REQUEST_PERMISSION_CAMERA,{},{callback:(e,t)=>-2===e.error_code||e.error_code>=0?Promise.resolve({userAllow:-2!==e.error_code,message:e.error_message}):Promise.reject(t)})}))}static saveImageToPhotosAlbum(e){return n(this,void 0,void 0,(function*(){let t={};return ln.isEmpty(e.imageBase64Data)?ln.isEmpty(e.imageUrl)||(t={imageUrl:e.imageUrl}):t={imageBase64Data:e.imageBase64Data},yield this.callNative(bn.SAVE_IMAGE_GALLERY,Object.assign({},t))}))}}class To{static viewOAQr(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.VIEW_MYQR,{dpn:e.displayName,uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openProfile(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.OPEN_PROFILE,{uId:e.id,type:exports.ProfileType[e.type],zapp:this.getZAppId(),sourceId:e.sourceId,sourceIndex:e.sourceIndex})}))}static openChat(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.OPEN_CHAT,{uId:e.id,type:exports.ChatType[e.type],zapp:this.getZAppId(),sourceId:e.sourceId,sourceIndex:e.sourceIndex})}))}static openPostFeed(e){return n(this,void 0,void 0,(function*(){let t={};switch(e.type){case"image":t={photoUrl:e.data.imageUrl};break;case"link":t={link:e.data.link,title:e.data.title,thumb:e.data.thumb,description:e.data.description};break;case"profile":t={avt:e.data.avatar,uid:e.data.id,dpn:e.data.displayName}}return yield this.callNative(bn.OPEN_POSTFEED,Object.assign(Object.assign({type:exports.PostFeedType[e.type]},t),{zapp:this.getZAppId()})).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static followOA(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.FOLLOW_OA,{uid:e.id,showDialogConfirm:!0,zapp:this.getZAppId()},{haveTimeout:!1})}))}static unfollowOA(e){return n(this,void 0,void 0,(function*(){yield this.callNative(bn.UNFOLLOW_OA,{uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openShareSheet(e){return n(this,void 0,void 0,(function*(){let t={};switch(e.type){case"image":let n=[];Array.isArray(e.data.imageUrls)&&e.data.imageUrls.length>0?n=e.data.imageUrls:n.push(e.data.imageUrl),t={photoUrls:n,photoUrl:e.data.imageUrl,caption:e.data.caption};break;case"gif":t={photoUrl:e.data.imageUrl,gifUrl:e.data.gifUrl,width:e.data.width,height:e.data.height};break;case"video":t={videoThumb:e.data.videoThumb,videoUrl:e.data.videoUrl,width:e.data.width,height:e.data.height};break;case"link":t={link:e.data.link,chatOnly:e.data.chatOnly?1:0};break;case"oa":t={uid:e.data.id};break;case"zmp":const i=yield this.getAccessToken(),o=yield fi(this.getAppId(),i||"",e.data.title||"",e.data.description||"",e.data.thumbnail||"",e.data.path);window.forceShareZMP?t={data:{ZInstantAPIInfo:{url:`${o.zinstantApi}`,zinstantdata_id:`templateId=${o.ztemplateId}&appId=${this.getAppId()}&shareId=${o.shareId}`},previewMsgText:{msg:{en:"Zalo Mini Program",vi:"Chương trình nhỏ"}},enableReactions:1}}:(t={link:o.shareableLink,chatOnly:e.data.chatOnly?1:0},e.type="link")}return yield this.callNative(bn.OPEN_SHARESHEET,Object.assign(Object.assign({type:exports.ShareSheetType[e.type]},t),{zapp:this.getZAppId()}),{haveTimeout:!1}).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static createShortcut(e,t,i){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.CREATE_SHORTCUT,{url:e,title:t,iconUrl:i})}))}static openProfilePicker(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.MP_OPEN_PROFILE_PICKER,{maxProfile:e},{isMultiCallback:!0,callback:(e,t)=>0===e.error_code&&Array.isArray(e.data)?Promise.resolve(e.data.map((e=>e.id))):Promise.reject(t)})}))}static getActionsSupported(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.GET_SUPPORTED_ACTIONS,{},{isMultiCallback:!1,callback:(e,t)=>{const n=si();if(Array.isArray(e.actions)&&e.actions.length>0){const t=Object.keys(bn).filter((e=>bn[e].skip_jump)),n={actions:[...e.actions,...t]};return Promise.resolve(n)}if(n===exports.PlatformType.iOS){const e={actions:jn};return Promise.resolve(e)}return Promise.reject(t)}})}))}static openMediaPicker(e,t,i,o){return n(this,void 0,void 0,(function*(){const n={type:0,url:"https://zapi-server.tungnt.xyz/upload/photos",maxSize:1048576};return yield this.callNative(bn.PICK_MEDIA,{media_type:exports.MediaPickerType[e],edit_view:Object.assign(Object.assign({},{enable:1,aspect_ratio:"1:1"}),t),silent_request:i,upload:n,max_select_item:o},{isMultiCallback:!0,callback:(e,t)=>{var n,i;if(0===e.error_code){const t=vi(null===(n=e.data)||void 0===n?void 0:n.result_content),o={urls:null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.urls};return Promise.resolve(o)}return Promise.reject(t)}})}))}static openOutApp(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.OPEN_OUTAPP,{url:e})}))}}class bo{static getRouteParams(){let e={};const t=window.location.href;try{let n=new URL(t).searchParams.toString();n&&(e=Qn.getParamsAsObject(n))}catch(e){throw new Error("Url không hợp lệ")}return e}static sendDataToPreviousMiniApp(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(bn.WEBVIEW_SET_RESULT,{result:hi(e.data)})}))}static onCallbackData(e){return n(this,void 0,void 0,(function*(){yield this.events.on(exports.Events.OnDataCallback,(t=>{e({data:t})}))}))}}class wo extends Ni{constructor(){var e,t,n,r,a,s,c,l,u,d,p,h,v,f,m,g,y;super(),Hi.set(this,vn),$i.set(this,fn),Vi.set(this,mn),Zi.set(this,void 0),Ji.set(this,void 0),Ki.set(this,void 0),qi.set(this,null),Qi.set(this,{timer:{getToken:0}}),Yi.set(this,void 0),Xi.set(this,void 0),eo.set(this,null),this.events=_i.getInstance(),this.isIOS=oi().isIOS,to.set(this,void 0),this.getActionBarConfig=()=>i(this,to,"f"),this.setActionBarConfig=e=>{o(this,to,e(i(this,to,"f")),"f")},no.set(this,(()=>new Promise(((e,t)=>{ln.isUndefined(i(this,eo,"f"))||ln.isNull(i(this,eo,"f"))?this.callNative(bn.JUMP_LOGIN,{}).then((t=>{const n=t&&t.cookiesOAuthLogins||[],i=n.find((e=>e.name===yn));i&&(this.setJSToken(i.value),window.ZJSBridge.setJSToken&&window.ZJSBridge.setJSToken(i.value)),o(this,eo,n,"f"),e(n)})).catch((e=>{t(e)})):e(i(this,eo,"f"))})))),io.set(this,Di.setNavigationBarRightButton),this.getVersion=Bi.getVersion,this.getSystemInfo=Bi.getSystemInfo,this.setNavigationBarTitle=Di.setNavigationBarTitle,this.setNavigationBarColor=Di.setNavigationBarColor,this.setNavigationBarLeftButton=Di.setNavigationBarLeftButton,this.setBackgroundColor=ji.setBackgroundColor,this.setDeviceOrientation=ho.setDeviceOrientation,this.setStorage=_o.setStorage,this.getStorage=_o.getStorage,this.getStorageInfo=_o.getStorageInfo,this.removeStorage=_o.removeStorage,this.clearStorage=_o.clearStorage,this.getUserInfo=Eo.getUserInfo,this.getNetworkType=ho.getNetworkType,this.onNetworkStatusChange=ho.onNetworkStatusChange,this.startBeaconDiscovery=ho.startBeaconDiscovery,this.stopBeaconDiscovery=ho.stopBeaconDiscovery,this.getBeacons=ho.getBeacons,this.closeApp=So.closeApp,this.getLocation=Ao.getLocation,this.stopBluetoothDevicesDiscovery=ho.stopBluetoothDevicesDiscovery,this.startBluetoothDevicesDiscovery=ho.stopBluetoothDevicesDiscovery,this.openBluetoothAdapter=ho.openBluetoothAdapter,this.onBluetoothDeviceFound=ho.onBluetoothDeviceFound,this.onBluetoothAdapterStateChange=ho.onBluetoothAdapterStateChange,this.getConnectedBluetoothDevices=ho.getConnectedBluetoothDevices,this.getBluetoothDevices=ho.getBluetoothDevices,this.getBluetoothAdapterState=ho.getBluetoothAdapterState,this.closeBluetoothAdapter=ho.closeBluetoothAdapter,this.scanQRCode=ho.scanQRCode,this.openProfile=To.openProfile,this.openChat=To.openChat,this.openPostFeed=To.openPostFeed,this.followOA=To.followOA,this.unFollowOA=To.unfollowOA,this.openShareSheet=To.openShareSheet,this.requestCameraPermission=Oo.requestCameraPermission,this.createShortcut=To.createShortcut,this.openBioAuthentication=ho.openBioAuthentication,this.checkStateBioAuthentication=ho.checkStateBioAuthentication,this.sendLocation=Ao.sendLocation,this.showToast=ho.showToast,this.hideKeyboard=ho.hideKeyboard,this.openPhone=ho.openPhone,this.openSMS=ho.openSMS,this.viewOAQr=To.viewOAQr,this.keepScreen=ho.keepScreen,this.saveImageToPhotosAlbum=Oo.saveImageToPhotosAlbum,this.openMiniApp=So.openMiniApp,this.vibrate=ho.vibrate,this.openWebview=So.openWebview,this.getRouteParams=bo.getRouteParams,this.getAppInfo=Bi.getAppInfo,this.sendDataToPreviousMiniApp=bo.sendDataToPreviousMiniApp,this.onCallbackData=bo.onCallbackData,this.getPhoneNumber=Eo.getPhoneNumber,this.openProfilePicker=To.openProfilePicker,oo.set(this,To.getActionsSupported),this.connectWifi=ho.connectWifi,this.openMediaPicker=To.openMediaPicker,this.openOutApp=To.openOutApp,this.closeLoading=So.closeLoading,o(this,Zi,null,"f"),o(this,Ji,null,"f"),o(this,Ki,null,"f"),this.isShowNavBar=!0,o(this,Yi,0,"f"),o(this,Xi,0,"f");const _="home"===(null===(t=null===(e=i(this,Vi,"f"))||void 0===e?void 0:e.app)||void 0===t?void 0:t.leftButton)||"both"===(null===(r=null===(n=i(this,Vi,"f"))||void 0===n?void 0:n.app)||void 0===r?void 0:r.leftButton)?xn:Un,E=new URL(location.href),S=ln.isString(null===(s=null===(a=i(this,Vi,"f"))||void 0===a?void 0:a.app)||void 0===s?void 0:s.headerColor)&&(null===(u=null===(l=null===(c=i(this,Vi,"f"))||void 0===c?void 0:c.app)||void 0===l?void 0:l.headerColor)||void 0===u?void 0:u.length)>0?5:6,A="none"===(null===(p=null===(d=i(this,Vi,"f"))||void 0===d?void 0:d.app)||void 0===p?void 0:p.leftButton)||"home"===(null===(v=null===(h=i(this,Vi,"f"))||void 0===h?void 0:h.app)||void 0===v?void 0:v.leftButton)?Ln:Mn;o(this,to,{actionbarType:S,buttonType:A,dataConfig:{backgroundColor:(null===(m=null===(f=i(this,Vi,"f"))||void 0===f?void 0:f.app)||void 0===m?void 0:m.headerColor)||"",textColor:(null===(y=null===(g=i(this,Vi,"f"))||void 0===g?void 0:g.app)||void 0===y?void 0:y.textColor)||"",viewInLeftType:A,confirmToExit:1},homeConfig:{enable:_,url:`https://h5.zdn.vn/zapps/${this.getAppId()}/${E.search}`}},"f")}static getInstance(){return wo.instance||(wo.instance=new wo),wo.instance}getLoginStatus(){return ln.isString(i(this,Ki,"f"))&&i(this,Ki,"f").length>0}getAppId(){return i(this,$i,"f")}getZAppId(){return i(this,Hi,"f")}login(e){return n(this,void 0,void 0,(function*(){const e=yield i(this,no,"f").call(this),t=e.find((e=>e.name===gn)),n=e.find((e=>e.name===_n));if(!ln.isUndefined(t)&&!ln.isNull(t)&&ln.isString(t.value)){if(o(this,Zi,t.value,"f"),ln.isUndefined(n)||ln.isNull(n)||!ln.isString(n.value)?yield this.loginZaloV3():(o(this,Ji,n.value,"f"),yield this.loginZaloV4()),!i(this,Ki,"f"))throw Kn.loginFailed();return i(this,Ki,"f")}throw Kn.loginFailed()}))}loginZaloV3(){return n(this,void 0,void 0,(function*(){return yield fetch(`${An}?app_id=${i(this,Hi,"f")}&redirect_uri=https://h5.zdn.vn/zapps/${i(this,$i,"f")}/&code=${i(this,Zi,"f")}&isSDK=true123`).then((e=>n(this,void 0,void 0,(function*(){let t=yield e.json();if(t.access_token){o(this,Ki,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return o(this,Xi,e,"f"),o(this,Yi,(new Date).getTime(),"f"),this.setZAccSession(i(this,Ki,"f")||""),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(i(this,Ki,"f")||""),i(this,Ki,"f")}return null}))))}))}loginZaloV4(){return n(this,void 0,void 0,(function*(){const e=new URLSearchParams;e.append("app_id",i(this,$i,"f")),e.append("code",i(this,Zi,"f")||""),e.append("code_verifier",i(this,Ji,"f")||""),ln.isNull(i(this,qi,"f"))?e.append("grant_type","authorization_code"):(e.append("grant_type","refresh_token"),e.append("refresh_token",i(this,qi,"f")||""));return yield fetch(Sn,Object.assign({method:"POST",body:e},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).then((e=>n(this,void 0,void 0,(function*(){const t=yield e.json();if(t.refresh_token&&o(this,qi,t.refresh_token,"f"),t.access_token){o(this,Ki,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return o(this,Xi,e,"f"),o(this,Yi,(new Date).getTime(),"f"),this.setZAccSession(i(this,Ki,"f")||""),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(i(this,Ki,"f")||""),i(this,Ki,"f")}return null}))))}))}getAccessToken(e){return n(this,void 0,void 0,(function*(){const e=(new Date).getTime()-i(this,Yi,"f");if(!i(this,Ki,"f"))throw Kn.loginRequired();return e<i(this,Xi,"f")?i(this,Ki,"f"):yield this.login()}))}}Hi=new WeakMap,$i=new WeakMap,Vi=new WeakMap,Zi=new WeakMap,Ji=new WeakMap,Ki=new WeakMap,qi=new WeakMap,Qi=new WeakMap,Yi=new WeakMap,Xi=new WeakMap,eo=new WeakMap,to=new WeakMap,no=new WeakMap,io=new WeakMap,oo=new WeakMap;class No{constructor(){ro.set(this,vn),ao.set(this,mn),so.set(this,"DEFAULT ZOAUTH"),co.set(this,"DEFAULT ACCESS TOKEN"),lo.set(this,{timer:{getToken:0}}),uo.set(this,!1),this.getLoginStatus=()=>i(this,uo,"f"),this.getAppId=()=>i(this,ro,"f"),this.login=()=>(o(this,uo,!0,"f"),Promise.resolve(i(this,so,"f"))),this.getAccessToken=()=>Promise.resolve(i(this,co,"f")),this.getVersion=Bi.getVersion,this.getSystemInfo=Bi.getSystemInfo,this.setNavigationBarTitle=()=>Promise.resolve(),this.setNavigationBarColor=()=>Promise.resolve(),this.setBackgroundColor=()=>Promise.resolve(),this.setNavigationBarLeftButton=()=>Promise.resolve(),this.setDeviceOrientation=()=>Promise.resolve(),this.setStorage=e=>n(this,void 0,void 0,(function*(){const t=new go(this.getAppId());return yield t.putDataToStorage(e.data),{errorKeys:[]}})),this.getStorage=e=>n(this,void 0,void 0,(function*(){const t=new go(this.getAppId());return yield t.getDataFromStorage(e.keys)})),this.getStorageInfo=e=>n(this,void 0,void 0,(function*(){const e=new go(this.getAppId());return yield e.getStorageInfo()})),this.removeStorage=e=>n(this,void 0,void 0,(function*(){const t=new go(this.getAppId());return yield t.removeDataFromStorage(e.keys)})),this.clearStorage=e=>n(this,void 0,void 0,(function*(){const e=new go(this.getAppId());return yield e.clearStorage()})),this.getUserInfo=()=>(console.warn("birthday and gender are deprecated"),Promise.resolve({userInfo:{id:"3368637342326461234",name:"User Name",avatar:"https://h5.zdn.vn/static/images/avatar.png"}})),this.getNetworkType=()=>{let e;switch((navigator.connection||navigator.mozConnection||navigator.webkitConnection).effectiveType){case"none":e=exports.NetworkType.none;break;case"4g":e=exports.NetworkType.wifi;break;case"3g":case"2g":e=exports.NetworkType.cellular;break;default:e=exports.NetworkType.unknown}const t={networkType:e};return Promise.resolve(t)},this.onNetworkStatusChange=e=>{const t=navigator.connection||navigator.mozConnection||navigator.webkitConnection,n=t.effectiveType;return t.addEventListener("change",(function(){let t;switch(n){case"none":t=exports.NetworkType.none;break;case"4g":t=exports.NetworkType.wifi;break;case"3g":case"2g":t=exports.NetworkType.cellular;break;default:t=exports.NetworkType.unknown}e({isConnected:!0,networkType:t})})),Promise.resolve()},this.startBeaconDiscovery=e=>Promise.resolve(!0),this.stopBeaconDiscovery=e=>Promise.resolve(!0),this.getBeacons=e=>Promise.resolve({beacons:[]}),this.closeApp=()=>Promise.resolve(),this.getLocation=()=>Promise.resolve({longitude:"105.788026",latitude:"21.0258773",timestamp:(new Date).getTime().toString(),provider:"fused"}),this.onBackButtonClick=()=>Promise.resolve(),this.stopBluetoothDevicesDiscovery=()=>Promise.resolve(),this.startBluetoothDevicesDiscovery=()=>Promise.resolve(),this.openBluetoothAdapter=()=>Promise.resolve(),this.onBluetoothDeviceFound=()=>Promise.resolve(),this.onBluetoothAdapterStateChange=()=>Promise.resolve(),this.getConnectedBluetoothDevices=()=>Promise.resolve(),this.getBluetoothDevices=()=>Promise.resolve(),this.getBluetoothAdapterState=()=>Promise.resolve(),this.closeBluetoothAdapter=()=>Promise.resolve(),this.scanQRCode=()=>Promise.resolve({content:"132"}),this.openProfile=()=>Promise.resolve(),this.openChat=()=>Promise.resolve(),this.openPostFeed=()=>Promise.resolve({status:1,shareType:0,numberOfUser:0}),this.followOA=()=>Promise.resolve(),this.unFollowOA=()=>Promise.resolve(),this.openShareSheet=()=>Promise.resolve({status:2,shareType:0,numberOfUser:0}),this.requestCameraPermission=()=>Promise.resolve({userAllow:!0,message:"Success"}),this.createShortcut=()=>Promise.resolve(),this.openBioAuthentication=()=>Promise.resolve({code:0,message:"OK",data:{domain:"",code:0,message:"",payToken:""}}),this.checkStateBioAuthentication=()=>Promise.resolve({bioState:""}),this.sendLocation=()=>Promise.resolve(),this.showToast=()=>Promise.resolve(),this.hideKeyboard=()=>Promise.resolve(),this.openPhone=()=>Promise.resolve(),this.openSMS=()=>Promise.resolve(),this.viewOAQr=()=>Promise.resolve(),this.keepScreen=()=>Promise.resolve(),this.saveImageToPhotosAlbum=()=>Promise.resolve(),this.openMiniApp=e=>Promise.resolve(),this.vibrate=()=>Promise.resolve(),this.openWebview=e=>(location.replace(e.url),Promise.resolve()),this.getRouteParams=bo.getRouteParams,this.getAppInfo=()=>Promise.resolve({description:"",name:"",version:"",appUrl:"",qrCodeUrl:""}),this.sendDataToPreviousMiniApp=e=>Promise.resolve(),this.onCallbackData=e=>(e({data:""}),Promise.resolve()),this.getPhoneNumber=()=>(console.warn("This api only works on zalo app"),Promise.resolve({number:""})),this.openProfilePicker=()=>(console.warn("This api only works on zalo app"),Promise.resolve([])),this.connectWifi=()=>(console.warn("This api only works on zalo app"),Promise.resolve()),this.openOutApp=e=>(location.href=e,Promise.resolve()),this.closeLoading=e=>Promise.resolve()}on(e,t,n){throw new Error("Method not implemented.")}once(e,t,n){throw new Error("Method not implemented.")}off(e,t,n,i){throw new Error("Method not implemented.")}removeAllListeners(e){throw new Error("Method not implemented.")}openMediaPicker(e,t,n,i){return console.warn("This api only works on zalo app"),Promise.resolve({urls:[]})}}ro=new WeakMap,ao=new WeakMap,so=new WeakMap,co=new WeakMap,lo=new WeakMap,uo=new WeakMap;const Po=Symbol("required"),Io=Symbol("checkType"),Co=(e,t)=>(n,i,o)=>{let r=Reflect.getOwnMetadata(Po,n,i)||[];r.push({parameterIndex:o,fields:e,option:t}),Reflect.defineMetadata(Po,r,n,i)},ko=(e,t,n)=>(i,o,r)=>{let a=Reflect.getOwnMetadata(Io,i,o)||[];a.push({parameterIndex:r,type:e,properties:t,defaultValue:n}),Reflect.defineMetadata(Io,a,i,o)};const Ro=(e,t,n)=>{const i=n.value,o=i.toString().match(/\(.*?\)/)[0].replace(/[()]/gi,"").replace(/\s/gi,"").split(",");return n.value=function(){const n=Reflect.getOwnMetadata(Po,e,t),r=Reflect.getOwnMetadata(Io,e,t);return r&&r.forEach((e=>{const{parameterIndex:t,type:n,properties:i,defaultValue:r}=e;let a=arguments[t],s=o[t];const c=typeof a;if(!ln.isUndefined(a)){if(!ci(a,n))throw Kn.wrongTypeParam(s,n,Array.isArray(a)?"array":null===a?"null":c);"object"===n&&Object.entries(i).forEach((([e,n])=>{const i=e.split("?")[0],o=ln.get(a,i);if(ln.isUndefined(o)||ln.isNull(o)){if(!e.includes("?"))throw Kn.missingParam(e);ln.isObject(ln.get(a,i.split(".")[0]))&&r&&!ln.isUndefined(ln.get(r,i))&&ln.set(arguments[t],i,ln.get(r,i))}else if(ln.isFunction(n)){const e=n(o);if(e&&e.error)throw Kn.wrongTypeParam(`${s}.${i}`,e.errorMessage,typeof o)}}))}})),n&&n.forEach((e=>{const{parameterIndex:t,option:n,fields:i}=e,o=arguments[t],r=null==n?void 0:n.if,a=null==n?void 0:n.defaultValue;let s=!0;r&&(s=Object.keys(r).every((e=>ln.get(o,e)===r[e]))),s&&i.forEach((e=>{const n=e=>{let n=!1;return ln.isEmpty(ln.get(o,e))&&(ln.isUndefined(ln.get(a,e))||ln.set(arguments[t],e,ln.get(a,e)),n=!0),n};if(Array.isArray(e)&&e.length>0&&e.every(n))throw Kn.missingParam(e.join(" or "));if(ln.isString(e)&&n(e))throw Kn.missingParam(e)}))})),i.apply(this,arguments)},n};var Bo,Do,jo,Mo,Lo;class xo{constructor(){this.events=_i.getInstance(),Bo.set(this,void 0),o(this,Bo,this.getServiceInstance(),"f"),this.events.addListener=(e,t,n)=>{const i=e;return this.events.addListener(exports.Events[i],t,n)}}login(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").login(e)}))}getLoginStatus(){return i(this,Bo,"f").getLoginStatus()}getAccessToken(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getAccessToken(e)}))}getVersion(){return i(this,Bo,"f").getVersion()}getSystemInfo(){return i(this,Bo,"f").getSystemInfo()}setNavigationBarTitle(e){return n(this,void 0,void 0,(function*(){return i(this,Bo,"f").setNavigationBarTitle(e)}))}setNavigationBarColor(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").setNavigationBarColor(e)}))}setBackgroundColor(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").setBackgroundColor(e)}))}setNavigationBarLeftButton(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").setNavigationBarLeftButton(e)}))}setDeviceOrientation(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").setDeviceOrientation(e)}))}setStorage(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").setStorage(e)}))}getStorage(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getStorage(e)}))}getStorageInfo(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getStorageInfo(e)}))}removeStorage(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").removeStorage(e)}))}clearStorage(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").clearStorage(e)}))}getUserInfo(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getUserInfo(e)}))}getNetworkType(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getNetworkType(e)}))}onNetworkStatusChange(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").onNetworkStatusChange(e)}))}startBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").startBeaconDiscovery(e)}))}stopBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").stopBeaconDiscovery(e)}))}getBeacons(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getBeacons(e)}))}closeApp(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").closeApp(e)}))}getLocation(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getLocation(e)}))}stopBluetoothDevicesDiscovery(){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").stopBluetoothDevicesDiscovery()}))}startBluetoothDevicesDiscovery(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").startBluetoothDevicesDiscovery(e)}))}openBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").openBluetoothAdapter()}))}onBluetoothDeviceFound(){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").onBluetoothDeviceFound()}))}onBluetoothAdapterStateChange(){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").onBluetoothAdapterStateChange()}))}getConnectedBluetoothDevices(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getConnectedBluetoothDevices(e)}))}getBluetoothDevices(){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getBluetoothDevices()}))}getBluetoothAdapterState(){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getBluetoothAdapterState()}))}closeBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").closeBluetoothAdapter()}))}scanQRCode(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").scanQRCode(e)}))}openProfile(e){return n(this,void 0,void 0,(function*(){yield i(this,Bo,"f").openProfile(e)}))}openChat(e){return n(this,void 0,void 0,(function*(){yield i(this,Bo,"f").openChat(e)}))}openPostFeed(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").openPostFeed(e)}))}followOA(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").followOA(e)}))}unfollowOA(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").unFollowOA(e)}))}openShareSheet(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").openShareSheet(e)}))}requestCameraPermission(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").requestCameraPermission(e)}))}createShortcut(e){return n(this,void 0,void 0,(function*(){const t=yield gi(fn,0),n=oi().isIOS,o=t.logoUrl||ri("og:image:url")||"",r=t.name||document.title,a=e.params?new URLSearchParams(e.params):new URLSearchParams;if(a.append("utm_source","zalo-shortcut"),a.append("utm_medium","default"),a.append("utm_campaign","default"),n){a.append("appId",fn),a.append("appName",r),a.append("appIcon",o);const e=`https://mini.zalo.me/shortcut.html?${a.toString()}`;yield i(this,Bo,"f").openOutApp(encodeURI(e))}else yield i(this,Bo,"f").createShortcut(`https://zalo.me/app/link/zapps/${fn}/?${a.toString()}`,r,o);return Jn()}))}openBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").openBioAuthentication(e)}))}checkStateBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").checkStateBioAuthentication(e)}))}sendLocation(e){return n(this,void 0,void 0,(function*(){yield i(this,Bo,"f").sendLocation(e)}))}showToast(e){return n(this,void 0,void 0,(function*(){yield i(this,Bo,"f").showToast(e)}))}hideKeyboard(e){return n(this,void 0,void 0,(function*(){yield i(this,Bo,"f").hideKeyboard(e)}))}openPhone(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").openPhone(e)}))}openSMS(e){return n(this,void 0,void 0,(function*(){yield i(this,Bo,"f").openSMS(e)}))}viewOAQr(e){return n(this,void 0,void 0,(function*(){yield i(this,Bo,"f").viewOAQr(e)}))}keepScreen(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").keepScreen(e)}))}saveImageToGallery(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").saveImageToPhotosAlbum(e)}))}saveImageToPhotosAlbum(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").saveImageToPhotosAlbum(e)}))}openMiniApp(e){return n(this,void 0,void 0,(function*(){if(!ln.isEmpty(e.params)){const t=e.params||{};Object.keys(t).forEach((e=>{"object"==typeof t[e]&&(t[e]=JSON.stringify(t[e])),t[e]=""+encodeURIComponent(t[e])})),e.params=t}yield i(this,Bo,"f").openMiniApp(e)}))}vibrate(e){return n(this,void 0,void 0,(function*(){yield i(this,Bo,"f").vibrate(e)}))}openWebview(e){return n(this,void 0,void 0,(function*(){yield i(this,Bo,"f").openWebview(e)}))}getRouteParams(){return i(this,Bo,"f").getRouteParams()}getAppInfo(e){return i(this,Bo,"f").getAppInfo()}sendDataToPreviousMiniApp(e){return i(this,Bo,"f").sendDataToPreviousMiniApp(e)}onCallbackData(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").onCallbackData(e)}))}getPhoneNumber(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").getPhoneNumber()}))}openProfilePicker(e){return n(this,void 0,void 0,(function*(){const t=yield i(this,Bo,"f").openProfilePicker(e.maxProfile);let n;if(t.length>0)try{const e=yield this.getAccessToken(),i=yield fetch(On,{method:"POST",headers:{"Content-Type":"application/json",access_token:e||""},body:JSON.stringify({fields:"id,name,picture",user_ids:t})}),o=yield i.json();if(0!==o.error||!o.data)throw new Error(o.message);n=t.map((e=>{var t,n,i,r,a,s,c,l,u,d,p;return{id:(null===(n=null===(t=o.data[e])||void 0===t?void 0:t.user_info)||void 0===n?void 0:n.user_id_by_app)||"",profile:{name:null===(r=null===(i=o.data[e])||void 0===i?void 0:i.user_info)||void 0===r?void 0:r.name,avatar:null===(l=null===(c=null===(s=null===(a=o.data[e])||void 0===a?void 0:a.user_info)||void 0===s?void 0:s.picture)||void 0===c?void 0:c.data)||void 0===l?void 0:l.url},code:0!==(null===(u=o.data[e])||void 0===u?void 0:u.error)?-1:0,message:`Get profile: ${ln.isUndefined(null===(d=o.data[e])||void 0===d?void 0:d.message)?"Unknown error":null===(p=o.data[e])||void 0===p?void 0:p.message}`}}))}catch(e){n=t.map((t=>({id:t,profile:{name:"",avatar:""},code:-1,message:`Can't get profile: ${e.message}`})))}return{users:n||[]}}))}connectWifi(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").connectWifi(e)}))}openMediaPicker(e){var t,o,r;return n(this,void 0,void 0,(function*(){const n={};ln.isUndefined(null===(t=e.editView)||void 0===t?void 0:t.enable)||(null===(o=e.editView)||void 0===o?void 0:o.enable)?n.enable=1:n.enable=0,n.aspect_ratio=null===(r=e.editView)||void 0===r?void 0:r.aspectRatio;const a=!0===e.silentRequest?1:0,s=e.maxSelectItem;return yield i(this,Bo,"f").openMediaPicker(e.type,n,a,s)}))}getShareableLink(e){return n(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();return(yield fi(window.APP_ID,t||"",e.title,e.description,e.thumbnail,e.path)).shareableLink}))}closeLoading(e){return n(this,void 0,void 0,(function*(){return yield i(this,Bo,"f").closeLoading("user action")}))}}Bo=new WeakMap,e([Vn],xo.prototype,"login",null),e([Zn],xo.prototype,"getLoginStatus",null),e([Vn],xo.prototype,"getAccessToken",null),e([Zn],xo.prototype,"getVersion",null),e([Zn],xo.prototype,"getSystemInfo",null),e([Vn,Ro,t(0,ko("object",{title:mi("string")}))],xo.prototype,"setNavigationBarTitle",null),e([Vn,Ro,t(0,ko("object",{color:mi("string"),"textColor?":mi("string",{values:["white","black"]}),"statusBarColor?":mi("string")}))],xo.prototype,"setNavigationBarColor",null),e([Vn,Ro,t(0,ko("object",{backgroundColor:mi("string"),"textColor?":mi("string",{values:["white","black"]})}))],xo.prototype,"setBackgroundColor",null),e([Vn,Ro,t(0,ko("object",{type:mi("string",{values:["none","back","home","both"]})}))],xo.prototype,"setNavigationBarLeftButton",null),e([Vn,Ro,t(0,ko("object",{rotate:mi("string",{values:["auto","portrait","landscape"]})}))],xo.prototype,"setDeviceOrientation",null),e([Vn,Ro,t(0,ko("object",{data:mi("object")}))],xo.prototype,"setStorage",null),e([Vn,Ro,t(0,ko("object",{keys:mi("array<string>")}))],xo.prototype,"getStorage",null),e([Vn],xo.prototype,"getStorageInfo",null),e([Vn,Ro,t(0,ko("object",{keys:mi("array<string>")}))],xo.prototype,"removeStorage",null),e([Vn],xo.prototype,"clearStorage",null),e([Vn,Ro,t(0,ko("object",{"avatarType?":mi("string",{values:["small","normal","large"]})}))],xo.prototype,"getUserInfo",null),e([Vn],xo.prototype,"getNetworkType",null),e([Vn],xo.prototype,"onNetworkStatusChange",null),e([Vn],xo.prototype,"startBeaconDiscovery",null),e([Vn],xo.prototype,"stopBeaconDiscovery",null),e([Vn],xo.prototype,"getBeacons",null),e([Vn],xo.prototype,"closeApp",null),e([Vn],xo.prototype,"getLocation",null),e([Vn],xo.prototype,"stopBluetoothDevicesDiscovery",null),e([Vn],xo.prototype,"startBluetoothDevicesDiscovery",null),e([Vn],xo.prototype,"openBluetoothAdapter",null),e([Vn],xo.prototype,"onBluetoothDeviceFound",null),e([Vn],xo.prototype,"onBluetoothAdapterStateChange",null),e([Vn],xo.prototype,"getConnectedBluetoothDevices",null),e([Vn],xo.prototype,"getBluetoothDevices",null),e([Vn],xo.prototype,"getBluetoothAdapterState",null),e([Vn],xo.prototype,"closeBluetoothAdapter",null),e([Vn],xo.prototype,"scanQRCode",null),e([Vn,Ro,t(0,ko("object",{type:mi("string",{values:["user","oa","aliasOA"]}),id:mi("string")}))],xo.prototype,"openProfile",null),e([Vn,Ro,t(0,ko("object",{type:mi("string",{values:["user","oa"]}),id:mi("string")}))],xo.prototype,"openChat",null),e([Vn,Ro,t(0,Co(["data.imageUrl"],{if:{type:"image"}})),t(0,Co(["data.link"],{if:{type:"link"}})),t(0,Co(["data.id"],{if:{type:"profile"}})),t(0,ko("object",{type:mi("string",{values:["image","link","profile"]}),data:mi("object"),"data.imageUrl?":mi("url"),"data.link?":mi("url"),"data.title?":mi("string"),"data.thumb?":mi("url"),"data.description?":mi("string"),"data.avatar?":mi("url"),"data.id?":mi("string"),"data.displayName?":mi("string")}))],xo.prototype,"openPostFeed",null),e([Vn,Ro,t(0,ko("object",{id:mi("string"),"showDialogConfirm?":mi("boolean")}))],xo.prototype,"followOA",null),e([Vn,Ro,t(0,ko("object",{id:mi("string")}))],xo.prototype,"unfollowOA",null),e([Vn,Ro,t(0,Co([["data.imageUrl","data.imageUrls"]],{if:{type:"image"}})),t(0,Co(["data.link"],{if:{type:"link"}})),t(0,Co(["data.id"],{if:{type:"oa"}})),t(0,Co(["data.gifUrl"],{if:{type:"gif"}})),t(0,Co(["data.videoThumb","data.videoUrl"],{if:{type:"video"}})),t(0,Co(["data.thumbnail","data.title","data.description"],{if:{type:"zmp"},defaultValue:{data:{description:""}}})),t(0,ko("object",{type:mi("string",{values:["image","gif","video","link","oa","zmp"]}),data:mi("object"),"data.imageUrl?":mi("url"),"data.imageUrls?":mi("array<url>",{maxLength:10}),"data.caption?":mi("string"),"data.gifUrl?":mi("url"),"data.width?":mi("number"),"data.height?":mi("number"),"data.videoThumb?":mi("url"),"data.videoUrl?":mi("url"),"data.link?":mi("url"),"data.chatOnly?":mi("boolean"),"data.id?":mi("string"),"data.thumbnail?":mi("url"),"data.path?":mi("string"),"data.title?":mi("string",{maxLength:100}),"data.description?":mi(["string"],{maxLength:400})}))],xo.prototype,"openShareSheet",null),e([Vn],xo.prototype,"requestCameraPermission",null),e([Vn],xo.prototype,"createShortcut",null),e([Vn,Ro,t(0,ko("object",{secretData:mi("string"),"ui?":mi("object"),"ui.title?":mi("string"),"ui.subTitle?":mi("string"),"ui.negativeButtonText?":mi("string"),"requireFingerprint?":mi("boolean")},{requireFingerprint:!0,ui:{title:"Xác thực",subTitle:"Sử dụng sinh trắc học của bạn để xác thực",negativeButtonText:"Đóng"}}))],xo.prototype,"openBioAuthentication",null),e([Vn],xo.prototype,"checkStateBioAuthentication",null),e([Vn,Ro,t(0,ko("object",{toUserId:mi("string"),"title?":mi("string")}))],xo.prototype,"sendLocation",null),e([Vn,Ro,t(0,ko("object",{message:mi("string")}))],xo.prototype,"showToast",null),e([Vn],xo.prototype,"hideKeyboard",null),e([Vn,Ro,t(0,ko("object",{phoneNumber:mi("string")}))],xo.prototype,"openPhone",null),e([Vn,Ro,t(0,ko("object",{content:mi("string"),phoneNumber:mi("string",{regex:/^\+?\d+$/})}))],xo.prototype,"openSMS",null),e([Vn,Ro,t(0,ko("object",{id:mi("string"),"displayName?":mi("string")},{displayName:""}))],xo.prototype,"viewOAQr",null),e([Vn],xo.prototype,"keepScreen",null),e([Vn,Ro,t(0,ko("object",{"imageBase64Data?":mi("string"),"imageUrl?":mi("url")}))],xo.prototype,"saveImageToGallery",null),e([Vn,Ro,t(0,ko("object",{"imageBase64Data?":mi("string"),"imageUrl?":mi("url")}))],xo.prototype,"saveImageToPhotosAlbum",null),e([Vn,Ro,t(0,ko("object",{appId:mi("string"),"params?":mi("object")}))],xo.prototype,"openMiniApp",null),e([Vn,Ro,t(0,ko("object",{"type?":mi("string",{values:["oneShot"]}),"milliseconds?":mi("number")},{type:"oneShot",milliseconds:500}))],xo.prototype,"vibrate",null),e([Vn,Ro,t(0,ko("object",{url:mi("string")}))],xo.prototype,"openWebview",null),e([Zn],xo.prototype,"getRouteParams",null),e([Vn],xo.prototype,"getAppInfo",null),e([Vn],xo.prototype,"sendDataToPreviousMiniApp",null),e([Vn],xo.prototype,"onCallbackData",null),e([Vn],xo.prototype,"getPhoneNumber",null),e([Vn,Ro,t(0,ko("object",{"maxProfile?":mi("number",{min:1,max:10})},{maxProfile:1}))],xo.prototype,"openProfilePicker",null),e([Vn,Ro,t(0,Co(["SSID"])),t(0,ko("object",{SSID:mi("string"),"password?":mi("string"),"hiddenSSID?":mi("boolean")}))],xo.prototype,"connectWifi",null),e([Vn,Ro,t(0,ko("object",{type:mi("string",{values:["photo","video","file","multi_photo","multi_video"]}),"editView?":mi("object"),"editView.enable?":mi("boolean"),"editView.aspectRatio?":mi("string",{regex:/^\d+:\d+$/}),"silentRequest?":mi("boolean"),"maxSelectItem?":mi("number",{min:1})}))],xo.prototype,"openMediaPicker",null),e([Vn,Ro,t(0,ko("object",{title:mi("string",{maxLength:100}),"thumbnail?":mi("url"),"path?":mi("string"),description:mi(["string"],{maxLength:400})},{description:""}))],xo.prototype,"getShareableLink",null),e([Vn,Ro],xo.prototype,"closeLoading",null);class Uo extends xo{getServiceInstance(){return wo.getInstance()}}class Wo extends xo{getServiceInstance(){return new No}}class zo{constructor(){Do.set(this,fn)}static getInstance(){return zo.instance||(zo.instance=new zo),zo.instance}createOrder(e,t){return n(this,void 0,void 0,(function*(){const n=i(this,Do,"f"),o=new URLSearchParams;o.append("amount",t.amount.toString()),o.append("item",encodeURIComponent(JSON.stringify(t.item))),o.append("appId",n),t.desc&&o.append("desc",encodeURIComponent(t.desc)),t.extradata&&o.append("extradata",encodeURIComponent(JSON.stringify(t.extradata))),t.method&&o.append("method",t.method);const r={headers:{"Content-Type":"application/x-www-form-urlencoded",authorization:"Bearer "}};try{const i=yield e.getAccessToken({fail:e=>{throw Kn.loginRequired}});r.headers.authorization=`Bearer ${i}`;const a=yield fetch(Wn,Object.assign(Object.assign({method:"POST"},r),{body:o})),s=yield a.json();if(!s.data||0!==s.err)throw Kn.badRequest(s.msg);const c=s.data.id,l=window.APP_VERSION,u=window.APP_ENV,d={miniAppId:n,accessToken:i||"",orderId:c};l&&(d.version=l),u&&(d.env=u),t.method&&(d.method=t.method);const p=Qn.encode(d),h=new URL(`?${p}`,"https://payment-mini.zalo.me").toString();return yield e.openWebview({url:h,fail:e=>{throw e}}),{orderId:c}}catch(e){throw e}}))}checkTransaction(e,t){return n(this,void 0,void 0,(function*(){try{let n,{data:o}=t;if(o||(o=e.getRouteParams()),"object"==typeof o&&(n=o.appTransID||o.orderId||o.apptransid),"string"==typeof o){const e=Qn.getParameterByName("orderId",o),t=Qn.getParameterByName("appTransID",o)||Qn.getParameterByName("apptransid",o);n=e||t}const r=new URL(zn),a={transId:n||"",appId:i(this,Do,"f")};r.search=new URLSearchParams(a).toString();const s=yield fetch(r.toString()),c=yield s.json();if(!c.data||0!==c.err)throw Kn.badRequest(c.msg);const l=c.data||{};return{msg:l.resultMessage,orderId:l.orderId,resultCode:l.resultCode,transTime:l.transTime,createdAt:l.createAt,transId:l.transId}}catch(e){throw e}}))}getOrderStatus(e){return n(this,void 0,void 0,(function*(){try{const{orderId:t}=e,n=new URL(Fn),o={appId:i(this,Do,"f")};e.transId&&(o.transId=e.transId),e.orderId&&(o.orderId=e.orderId),n.search=new URLSearchParams(o).toString();const r=yield fetch(n.toString()),a=yield r.json();if(!a.data||0!==a.err)throw Kn.badRequest(a.msg);const s=a.data||{};return{returnCode:s.returnCode,returnMessage:s.returnMessage,isProcessing:s.isProcessing,amount:s.amount}}catch(e){throw e}}))}}Do=new WeakMap;class Fo{constructor(){jo.set(this,vn)}static getInstance(){return Fo.instance||(Fo.instance=new Fo),Fo.instance}createOrder(e,t){return Promise.resolve({orderId:""})}checkTransaction(e,t){const n={msg:"Success",orderId:"",resultCode:1,transTime:(new Date).getTime().toString(),createdAt:(new Date).getTime().toString(),transId:""};return Promise.resolve(n)}getOrderStatus(e){return Promise.resolve({returnCode:3,returnMessage:"Giao dịch chưa được thực hiện.",isProcessing:!1,amount:1e4})}}jo=new WeakMap;class Go{constructor(e){Mo.set(this,void 0),Lo.set(this,void 0),o(this,Mo,this.getInstance(),"f"),o(this,Lo,e,"f")}createOrder(e){return i(this,Mo,"f").createOrder(i(this,Lo,"f"),e)}checkTransaction(e){return i(this,Mo,"f").checkTransaction(i(this,Lo,"f"),e)}getOrderStatus(e){return i(this,Mo,"f").getOrderStatus(e)}}Mo=new WeakMap,Lo=new WeakMap,e([Vn,Ro,t(0,ko("object",{amount:mi(["string","number"]),desc:mi("string"),"method?":mi("string",{values:["MOMO","ZALOPAY","MOMO_SANDBOX","ZALOPAY_SANDBOX","CC","CC_SANDBOX","ATM","ATM_SANDBOX"]})}))],Go.prototype,"createOrder",null),e([Vn,Ro],Go.prototype,"checkTransaction",null),e([Vn,Ro,t(0,Co(["transId"],{if:{orderId:void 0}})),t(0,Co(["orderId"],{if:{transId:void 0}})),t(0,ko("object",{"transId?":mi("string"),"orderId?":mi("string")}))],Go.prototype,"getOrderStatus",null);class Ho extends Go{getInstance(){return zo.getInstance()}}class $o extends Go{getInstance(){return Fo.getInstance()}}const Vo=oi();exports.default=void 0,window.onJSCall=e=>function(t){wi.getInstance().onJSCall(e,t)},window.onMultiJSCall=e=>function(t){wi.getInstance().onMultiJSCall(e,t)},window.zaloJSV2={zalo_h5_event_handler:function(e,t,n){wi.getInstance().nativeEventHandler(e,t,n)}},exports.Payment=void 0,Vo.isZalo?(exports.default=new Uo,exports.Payment=new Ho(exports.default)):(exports.default=new Wo,exports.Payment=new $o(exports.default)),window.ZaloMiniAppSDK=exports.default,exports.SDKCreator=xo;
|
package/dist/index.umd.js
CHANGED
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */function t(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a}function n(e,t){return function(n,i){t(n,i,e)}}function i(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{c(i.next(e))}catch(e){r(e)}}function s(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}function o(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function r(e,t,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(e,n):o?o.value=n:t.set(e,n),n}var a=Object.prototype;var s=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||a)};var c=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),l=s,u=c,d=Object.prototype.hasOwnProperty;var p=function(e){if(!l(e))return u(e);var t=[];for(var n in Object(e))d.call(e,n)&&"constructor"!=n&&t.push(n);return t},h="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function v(e,t){return e(t={exports:{}},t.exports),t.exports}var f="object"==typeof h&&h&&h.Object===Object&&h,m="object"==typeof self&&self&&self.Object===Object&&self,g=f||m||Function("return this")(),y=g.Symbol,_=Object.prototype,E=_.hasOwnProperty,S=_.toString,A=y?y.toStringTag:void 0;var O=function(e){var t=E.call(e,A),n=e[A];try{e[A]=void 0;var i=!0}catch(e){}var o=S.call(e);return i&&(t?e[A]=n:delete e[A]),o},T=Object.prototype.toString;var b=O,w=function(e){return T.call(e)},N=y?y.toStringTag:void 0;var P=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},I=P,C=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":N&&N in Object(e)?b(e):w(e)};var k,R=function(e){if(!P(e))return!1;var t=C(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},B=R,D=g["__core-js_shared__"],j=(k=/[^.]+$/.exec(D&&D.keys&&D.keys.IE_PROTO||""))?"Symbol(src)_1."+k:"";var M=function(e){return!!j&&j in e},L=Function.prototype.toString;var U=M,W=function(e){if(null!=e){try{return L.call(e)}catch(e){}try{return e+""}catch(e){}}return""},x=/^\[object .+?Constructor\]$/,z=Function.prototype,F=Object.prototype,G=z.toString,H=F.hasOwnProperty,$=RegExp("^"+G.call(H).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var V=function(e){return!(!P(e)||U(e))&&(R(e)?$:x).test(W(e))},Z=function(e,t){return null==e?void 0:e[t]};var J=function(e,t){var n=Z(e,t);return V(n)?n:void 0},K=J(g,"DataView"),q=J(g,"Map"),Q=J(g,"Promise"),Y=J(g,"Set"),X=J(g,"WeakMap"),ee=K,te=q,ne=Q,ie=Y,oe=X,re="[object Map]",ae="[object Promise]",se="[object Set]",ce="[object WeakMap]",le="[object DataView]",ue=W(ee),de=W(te),pe=W(ne),he=W(ie),ve=W(oe),fe=C;(ee&&fe(new ee(new ArrayBuffer(1)))!=le||te&&fe(new te)!=re||ne&&fe(ne.resolve())!=ae||ie&&fe(new ie)!=se||oe&&fe(new oe)!=ce)&&(fe=function(e){var t=C(e),n="[object Object]"==t?e.constructor:void 0,i=n?W(n):"";if(i)switch(i){case ue:return le;case de:return re;case pe:return ae;case he:return se;case ve:return ce}return t});var me=fe;var ge=function(e){return null!=e&&"object"==typeof e};var ye=function(e){return ge(e)&&"[object Arguments]"==C(e)},_e=Object.prototype,Ee=_e.hasOwnProperty,Se=_e.propertyIsEnumerable,Ae=ye(function(){return arguments}())?ye:function(e){return ge(e)&&Ee.call(e,"callee")&&!Se.call(e,"callee")},Oe=Array.isArray,Te=Oe;var be=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var we=function(e){return null!=e&&be(e.length)&&!R(e)};var Ne=function(){return!1},Pe=v((function(e,t){var n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,o=i&&i.exports===n?g.Buffer:void 0,r=(o?o.isBuffer:void 0)||Ne;e.exports=r})),Ie={};Ie["[object Float32Array]"]=Ie["[object Float64Array]"]=Ie["[object Int8Array]"]=Ie["[object Int16Array]"]=Ie["[object Int32Array]"]=Ie["[object Uint8Array]"]=Ie["[object Uint8ClampedArray]"]=Ie["[object Uint16Array]"]=Ie["[object Uint32Array]"]=!0,Ie["[object Arguments]"]=Ie["[object Array]"]=Ie["[object ArrayBuffer]"]=Ie["[object Boolean]"]=Ie["[object DataView]"]=Ie["[object Date]"]=Ie["[object Error]"]=Ie["[object Function]"]=Ie["[object Map]"]=Ie["[object Number]"]=Ie["[object Object]"]=Ie["[object RegExp]"]=Ie["[object Set]"]=Ie["[object String]"]=Ie["[object WeakMap]"]=!1;var Ce=function(e){return ge(e)&&be(e.length)&&!!Ie[C(e)]},ke=function(e){return function(t){return e(t)}},Re=v((function(e,t){var n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,o=i&&i.exports===n&&f.process,r=function(){try{var e=i&&i.require&&i.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=r})),Be=Re&&Re.isTypedArray,De=Be?ke(Be):Ce,je=p,Me=me,Le=Ae,Ue=we,We=Pe,xe=De,ze=Object.prototype.hasOwnProperty;var Fe=function(e){if(null==e)return!0;if(Ue(e)&&(Oe(e)||"string"==typeof e||"function"==typeof e.splice||We(e)||xe(e)||Le(e)))return!e.length;var t=Me(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(l(e))return!je(e).length;for(var n in e)if(ze.call(e,n))return!1;return!0};var Ge=function(e){return void 0===e};var He=function(e){return null===e};var $e=function(e){return"string"==typeof e||!Oe(e)&&ge(e)&&"[object String]"==C(e)};var Ve=function(e){return"number"==typeof e||ge(e)&&"[object Number]"==C(e)};var Ze=function(e){return ge(e)&&"[object RegExp]"==C(e)},Je=Re&&Re.isRegExp,Ke=Je?ke(Je):Ze;var qe=function(e){return"symbol"==typeof e||ge(e)&&"[object Symbol]"==C(e)},Qe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ye=/^\w*$/;var Xe=function(e,t){if(Oe(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!qe(e))||(Ye.test(e)||!Qe.test(e)||null!=t&&e in Object(t))},et=J(Object,"create");var tt=function(){this.__data__=et?et(null):{},this.size=0};var nt=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},it=Object.prototype.hasOwnProperty;var ot=function(e){var t=this.__data__;if(et){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return it.call(t,e)?t[e]:void 0},rt=Object.prototype.hasOwnProperty;var at=tt,st=nt,ct=ot,lt=function(e){var t=this.__data__;return et?void 0!==t[e]:rt.call(t,e)},ut=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=et&&void 0===t?"__lodash_hash_undefined__":t,this};function dt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}dt.prototype.clear=at,dt.prototype.delete=st,dt.prototype.get=ct,dt.prototype.has=lt,dt.prototype.set=ut;var pt=dt;var ht=function(){this.__data__=[],this.size=0};var vt=function(e,t){return e===t||e!=e&&t!=t};var ft=function(e,t){for(var n=e.length;n--;)if(vt(e[n][0],t))return n;return-1},mt=Array.prototype.splice;var gt=ht,yt=function(e){var t=this.__data__,n=ft(t,e);return!(n<0)&&(n==t.length-1?t.pop():mt.call(t,n,1),--this.size,!0)},_t=function(e){var t=this.__data__,n=ft(t,e);return n<0?void 0:t[n][1]},Et=function(e){return ft(this.__data__,e)>-1},St=function(e,t){var n=this.__data__,i=ft(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};function At(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}At.prototype.clear=gt,At.prototype.delete=yt,At.prototype.get=_t,At.prototype.has=Et,At.prototype.set=St;var Ot=pt,Tt=At;var bt=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var wt=function(e,t){var n=e.__data__;return bt(t)?n["string"==typeof t?"string":"hash"]:n.map};var Nt=function(){this.size=0,this.__data__={hash:new Ot,map:new(te||Tt),string:new Ot}},Pt=function(e){var t=wt(this,e).delete(e);return this.size-=t?1:0,t},It=function(e){return wt(this,e).get(e)},Ct=function(e){return wt(this,e).has(e)},kt=function(e,t){var n=wt(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};function Rt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Rt.prototype.clear=Nt,Rt.prototype.delete=Pt,Rt.prototype.get=It,Rt.prototype.has=Ct,Rt.prototype.set=kt;var Bt=Rt;function Dt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var i=arguments,o=t?t.apply(this,i):i[0],r=n.cache;if(r.has(o))return r.get(o);var a=e.apply(this,i);return n.cache=r.set(o,a)||r,a};return n.cache=new(Dt.Cache||Bt),n}Dt.Cache=Bt;var jt=Dt;var Mt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Lt=/\\(\\)?/g,Ut=function(e){var t=jt(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Mt,(function(e,n,i,o){t.push(i?o.replace(Lt,"$1"):n||e)})),t}));var Wt=function(e,t){for(var n=-1,i=null==e?0:e.length,o=Array(i);++n<i;)o[n]=t(e[n],n,e);return o},xt=y?y.prototype:void 0,zt=xt?xt.toString:void 0;var Ft=function e(t){if("string"==typeof t)return t;if(Oe(t))return Wt(t,e)+"";if(qe(t))return zt?zt.call(t):"";var n=t+"";return"0"==n&&1/t==-Infinity?"-0":n};var Gt=Xe,Ht=Ut,$t=function(e){return null==e?"":Ft(e)};var Vt=function(e,t){return Oe(e)?e:Gt(e,t)?[e]:Ht($t(e))},Zt=function(e){if("string"==typeof e||qe(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var Jt=function(e,t){for(var n=0,i=(t=Vt(t,e)).length;null!=e&&n<i;)e=e[Zt(t[n++])];return n&&n==i?e:void 0};var Kt=function(e,t,n){var i=null==e?void 0:Jt(e,t);return void 0===i?n:i},qt=function(){try{var e=J(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var Qt=function(e,t,n){"__proto__"==t&&qt?qt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Yt=Object.prototype.hasOwnProperty;var Xt=/^(?:0|[1-9]\d*)$/;var en=function(e,t,n){var i=e[t];Yt.call(e,t)&&vt(i,n)&&(void 0!==n||t in e)||Qt(e,t,n)},tn=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Xt.test(e))&&e>-1&&e%1==0&&e<t};var nn=function(e,t,n,i){if(!P(e))return e;for(var o=-1,r=(t=Vt(t,e)).length,a=r-1,s=e;null!=s&&++o<r;){var c=Zt(t[o]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(o!=a){var u=s[c];void 0===(l=i?i(u,c,s):void 0)&&(l=P(u)?u:tn(t[o+1])?[]:{})}en(s,c,l),s=s[c]}return e};var on,rn,an,sn,cn,ln,un,dn,pn,hn,vn,fn={isEmpty:Fe,isNull:He,isUndefined:Ge,isFunction:B,isObject:I,isString:$e,isNumber:Ve,isArray:Te,isRegExp:Ke,get:Kt,set:function(e,t,n){return null==e?e:nn(e,t,n)}};function mn(e){return"function"==typeof window.Debug?window.Debug(e):function(...e){process.env.NODE_ENV}}e.NetworkType=void 0,(on=e.NetworkType||(e.NetworkType={})).none="none",on.wifi="wifi",on.cellular="cellular",on.unknown="unknown",e.PlatformType=void 0,(rn=e.PlatformType||(e.PlatformType={})).wp="wp",rn.android="android",rn.iOS="iOS",rn.unknown="unknown",e.ProfileType=void 0,(an=e.ProfileType||(e.ProfileType={}))[an.user=1]="user",an[an.oa=0]="oa",an[an.aliasOA=2]="aliasOA",e.ChatType=void 0,(sn=e.ChatType||(e.ChatType={}))[sn.user=1]="user",sn[sn.oa=0]="oa",e.PostFeedType=void 0,(cn=e.PostFeedType||(e.PostFeedType={}))[cn.image=1]="image",cn[cn.link=4]="link",cn[cn.profile=5]="profile",e.ShareSheetType=void 0,(ln=e.ShareSheetType||(e.ShareSheetType={}))[ln.image=1]="image",ln[ln.gif=11]="gif",ln[ln.video=12]="video",ln[ln.link=4]="link",ln[ln.oa=5]="oa",ln[ln.zmp=22]="zmp",e.OrientationType=void 0,(un=e.OrientationType||(e.OrientationType={}))[un.auto=1]="auto",un[un.portrait=2]="portrait",un[un.landscape=3]="landscape",e.VibrateType=void 0,(dn=e.VibrateType||(e.VibrateType={}))[dn.oneShot=0]="oneShot",e.NativeCode=void 0,(pn=e.NativeCode||(e.NativeCode={}))[pn.token_invalid=-2]="token_invalid",pn[pn.not_permission=-1]="not_permission",pn[pn.client_not_support=-5]="client_not_support",pn[pn.decode_failed=-4]="decode_failed",e.Events=void 0,(hn=e.Events||(e.Events={})).AppPaused="h5.event.paused",hn.AppResumed="h5.event.resumed",hn.NetworkChanged="h5.event.connection.changed",hn.OnDataCallback="h5.event.webview.result",hn.OpenApp="h5.event.open.mp",e.MediaPickerType=void 0,(vn=e.MediaPickerType||(e.MediaPickerType={}))[vn.photo=4]="photo",vn[vn.video=5]="video",vn[vn.file=6]="file",vn[vn.multi_photo=7]="multi_photo",vn[vn.multi_video=8]="multi_video";const gn=e=>{const t=document.cookie;if(t){const o=t.split("; ");if(o&&o.length>0)for(var n=e.length+1,i=o.length-1;i>=0;i--){let t=o[i];if(t&&0===t.indexOf(e)&&(t=t.substring(n,t.length),t))return t=t.replace(/["']/g,""),t}}return null},yn=e=>gn(`${window.location.host}_`+e),_n=e=>gn((()=>{const e=window.location.host;if(e){if(e.indexOf("zalo.me")>=0)return"zalo.me_";if(e.indexOf("baomoi.com")>=0)return"baomoi.com_";if(e.indexOf("mp3.zing.vn")>=0)return"mp3.zing.vn_";if(e.indexOf("zaloapp.com")>=0)return"zaloapp.com_"}return""})()+e),En=1048576,Sn=window.zAppID,An=window.APP_ID,On=window.APP_CONFIG||{},Tn="h5.zdn.vn_zoauth",bn="h5.zdn.vn_zlink3rd",wn="h5.zdn.vn_zoauth_vrf",Nn="https://graph.zalo.me/v2.0/me",Pn="https://h5.zalo.me/openapi/access_token",In="https://oauth.zaloapp.com/v3/access_token",Cn="https://graph.zalo.me/v2.0/me/friends/list",kn=5*En,Rn=e=>({NONE:e?-2:0,WIFI:e?0:1,"2G":2,"3G":e?15:2,"4G":e?13:2}),Bn={GET_DOWNLOADED_STICKER:{name:"action.get.downloaded.sticker",have_callback:!0},OPEN_SHARE_STICKER:{name:"action.open.share.sticker"},OPEN_PROFILE:{name:"action.open.profile"},OPEN_FEED_DETAIL:{name:"action.open.feeddetail"},OPEN_FRIEND_RADA:{name:"action.open.friendrada"},OPEN_INAPP:{name:"action.open.inapp"},OPEN_OUTAPP:{name:"action.open.outapp"},OPEN_PAGE:{name:"action.open.page"},OPEN_PHOTODETAIL:{name:"action.open.photodetail"},OPEN_GALARY:{name:"action.open.galary"},OPEN_GAMECENTER:{name:"action.open.gamecenter"},OPEN_GAMENEWS:{name:"action.open.gamenews"},OPEN_TAB_CONTACT:{name:"action.open.tab.contact"},OPEN_TAB_SOCIAL:{name:"action.open.tab.social"},OPEN_FRIENDSUGGEST:{name:"action.open.friendsuggest"},OPEN_GROUPLIST:{name:"action.open.grouplist"},OPEN_NEARBY:{name:"action.open.nearby"},OPEN_ROOM:{name:"action.open.room"},OPEN_STICKERSTORE:{name:"action.open.stickerstore"},OPEN_CREATECHAT:{name:"action.open.createchat"},COPY_LINK_CATESTICKER:{name:"action.copy.link.catesticker"},REQUEST_BUY_STICKER:{name:"action.request.buy.sticker"},OPEN_CHAT:{name:"action.open.chat"},OPEN_TAB_CHAT:{name:"action.open.tab.chat"},OPEN_CHATGROUP:{name:"action.open.chatgroup"},OPEN_ADDFRIEND:{name:"action.open.addfriend"},OPEN_TAB_MORE:{name:"action.open.tab.more"},OPEN_POSTFEED:{name:"action.open.postfeed"},OPEN_LOGINDEVICES:{name:"action.open.logindevices"},OPEN_SENDSTICKER:{name:"action.open.sendsticker"},REPORT_ABUSE:{name:"action.report.abuse",have_callback:!0},FOLLOW_OA:{name:"action.follow.oa",have_callback:!0},UNFOLLOW_OA:{name:"action.unfollow.oa",have_callback:!0},OPEN_GAMEDETAIL:{name:"action.open.gamedetail"},OPEN_SHARESHEET:{name:"action.open.sharesheet",have_callback:!0},REQUEST_PERMISSION_CAMERA:{name:"action.request.permission.camera"},CHANGE_TITLE_HEADER:{name:"action.change.title.header",skip_jump:!0},WEBVIEW_CLEARCACHE:{name:"action.webview.clearcache"},WEBVIEW_CONFIRMCACHE:{name:"action.webview.confirmcache"},WEBVIEW_ISVISIBLE:{name:"action.webview.isvisible"},WEBVIEW_NETWORKTYPE:{name:"action.webview.networktype",skip_jump:!0},CHANGE_BUTTON_HEADER:{name:"action.change.button.header"},CREATE_OPTIONS_MENU:{name:"action.create.options.menu",skip_jump:!0,have_callback:!0},CREATE_SHORTCUT:{name:"action.create.shortcut"},CHANGE_ACTIONBAR_LEFTBUTTON_TYPE:{name:"action.change.actionbar.leftbutton.type",skip_jump:!0,have_callback:!0},WINDOW_CLOSE:{name:"action.window.close",skip_jump:!0,have_callback:!0},WEBVIEW_CHECKRESERROR:{name:"action.webview.checkResError"},IAP_REQUESTPAYMENT:{name:"action.iap.requestpayment"},ZBROWSER_GETSTATS:{name:"action.zbrowser.getstats"},ZBROWSER_JSBRIDGE:{name:"action.zbrowser.jsbridge",skip_jump:!0,have_callback:!0},PROMPT_AUTHENTICATION:{name:"action.prompt.authentication"},CHANGE_ACTIONBAR_COLOR:{name:"action.change.actionbar.color",skip_jump:!0},PROMPT_AUTHENTICATION_CHECK_STATE:{name:"action.prompt.authentication.check_state"},OPEN_APPSTORE:{name:"action.open.appstore"},GET_LOCATION:{name:"action.get.location",have_callback:!0},QUERY_LOCATION_HIDE:{name:"action.query.location.hide",have_callback:!0},SHOW_TOAST:{name:"action.show.toast",have_callback:!0},OPEN_APP:{name:"action.open.app"},HIDE_KEYBOARD:{name:"action.hide.keyboard"},OPEN_PHONE:{name:"action.open.phone"},OPEN_QR:{name:"action.open.qr"},OPEN_SMS:{name:"action.open.sms"},VIEW_MYQR:{name:"action.view.myqr",have_callback:!0},KEEP_SCREEN:{name:"action.keep.screen",have_callback:!0},CHANGE_AUTOROTATE:{name:"action.change.autorotate",skip_jump:!0},CHECK_APP_INSTALLED:{name:"action.check.app.installed"},QUERY_SHOW:{name:"action.query.show"},QUERY_HIDE:{name:"action.query.hide"},OPEN_INAPPRW:{name:"action.open.inapprw"},ZALORUN_GETTRACKINGSTATUS:{name:"action.zalorun.getTrackingStatus",have_callback:!0},ZALORUN_SETTRACKINGSTATUS:{name:"action.zalorun.setTrackingStatus",have_callback:!0},ZALORUN_GETDAYSTEP:{name:"action.zalorun.getDayStep",have_callback:!0},ZALORUN_FORCESUBMITDATA:{name:"action.zalorun.forceSubmitData",have_callback:!0},ZALORUN_SETWEIGHT:{name:"action.zalorun.setWeight",have_callback:!0},OPEN_PROFILE_EXT:{name:"action.open.profile.ext"},DOWNLOAD_CATE:{name:"action.download.cate",have_callback:!0},JUMP_LOGIN:{name:"action.jump.login",skip_jump:!0,white_list:!0},OPEN_ADTIMA_ADS_INTERSTITIAL:{name:"action.open.adtima.ads.interstitial"},OPEN_ADTIMA_ADS:{name:"action.open.adtima.ads"},GET_ADIDCLIENT:{name:"action.get.adidclient"},SCAN_IBEACON:{name:"action.scan.ibeacon"},INTERACTIVE_VIBRATION:{name:"action.interactive.vibration"},SAVE_IMAGE_GALLERY:{name:"action.save.image.gallery",version_live:{iOS:408}},OPEN_MP:{name:"action.open.mp",version_live:{iOS:402}},CHANGE_ACTIONBAR:{name:"action.change.actionbar",version_live:{iOS:402},skip_jump:!0},ZBROWSER_MPDS:{name:"action.zbrowser.mpds",version_live:{iOS:402}},WEBVIEW_SET_RESULT:{name:"action.webview.set.result",version_live:{iOS:416}},MP_GET_NUMBER:{name:"action.mp.get.number",version_live:{iOS:416}},MP_OPEN_PROFILE_PICKER:{name:"action.mp.open.profile.picker",version_live:{iOS:432}},GET_SUPPORTED_ACTIONS:{name:"action.get.supported.actions",white_list:!0},MP_JOIN_WIFI:{name:"action.mp.join.wifi",version_live:{android:0,iOS:999},have_permission:!1,white_list:!1},PICK_MEDIA:{name:"action.pick.media",version_live:{iOS:999}},MP_CLOSE_LOADINGVIEW:{name:"action.mp.close.loadingview"}},Dn=0,jn=-1400,Mn=-1500,Ln=-1401,Un=-1403,Wn=-1404,xn={SUCCESS:"Success",READ_MORE:"Read more at: https://miniapp.zalo.me/docs/api",LOGIN_REQUIRED:"Please login before to call this api. Read more at: https://miniapp.zalo.me/docs/api/login",LOGIN_FAILED:"Login failed.",NOT_PERMISSION:"You don't have permission to call this api",CLIENT_NOT_SUPPORT:"This API is not supported in this Zalo version",DECODE_FAILED:"Can not decode your data. Read more at: https://miniapp.zalo.me/docs/api/error"},zn="apps/get-info",Fn={android:12100571,iOS:400,wp:0,unknown:0},Gn=[Bn.GET_DOWNLOADED_STICKER.name,Bn.OPEN_SHARE_STICKER.name,Bn.OPEN_PROFILE.name,Bn.OPEN_FEED_DETAIL.name,Bn.OPEN_FRIEND_RADA.name,Bn.OPEN_INAPP.name,Bn.OPEN_OUTAPP.name,Bn.OPEN_PAGE.name,Bn.OPEN_PHOTODETAIL.name,Bn.OPEN_GALARY.name,Bn.OPEN_GAMECENTER.name,Bn.OPEN_GAMENEWS.name,Bn.OPEN_TAB_CONTACT.name,Bn.OPEN_TAB_SOCIAL.name,Bn.OPEN_FRIENDSUGGEST.name,Bn.OPEN_GROUPLIST.name,Bn.OPEN_NEARBY.name,Bn.OPEN_ROOM.name,Bn.OPEN_STICKERSTORE.name,Bn.OPEN_CREATECHAT.name,Bn.COPY_LINK_CATESTICKER.name,Bn.REQUEST_BUY_STICKER.name,Bn.OPEN_CHAT.name,Bn.OPEN_TAB_CHAT.name,Bn.OPEN_CHATGROUP.name,Bn.OPEN_ADDFRIEND.name,Bn.OPEN_TAB_MORE.name,Bn.OPEN_POSTFEED.name,Bn.OPEN_LOGINDEVICES.name,Bn.OPEN_SENDSTICKER.name,Bn.REPORT_ABUSE.name,Bn.FOLLOW_OA.name,Bn.UNFOLLOW_OA.name,Bn.OPEN_GAMEDETAIL.name,Bn.OPEN_SHARESHEET.name,Bn.REQUEST_PERMISSION_CAMERA.name,Bn.CHANGE_TITLE_HEADER.name,Bn.WEBVIEW_CLEARCACHE.name,Bn.WEBVIEW_CONFIRMCACHE.name,Bn.WEBVIEW_ISVISIBLE.name,Bn.WEBVIEW_NETWORKTYPE.name,Bn.CHANGE_BUTTON_HEADER.name,Bn.CREATE_OPTIONS_MENU.name,Bn.CREATE_SHORTCUT.name,Bn.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE.name,Bn.WINDOW_CLOSE.name,Bn.WEBVIEW_CHECKRESERROR.name,Bn.IAP_REQUESTPAYMENT.name,Bn.ZBROWSER_GETSTATS.name,Bn.ZBROWSER_JSBRIDGE.name,Bn.PROMPT_AUTHENTICATION.name,Bn.CHANGE_ACTIONBAR_COLOR.name,Bn.PROMPT_AUTHENTICATION_CHECK_STATE.name,Bn.OPEN_APPSTORE.name,Bn.GET_LOCATION.name,Bn.QUERY_LOCATION_HIDE.name,Bn.SHOW_TOAST.name,Bn.OPEN_APP.name,Bn.HIDE_KEYBOARD.name,Bn.OPEN_PHONE.name,Bn.OPEN_QR.name,Bn.OPEN_SMS.name,Bn.VIEW_MYQR.name,Bn.KEEP_SCREEN.name,Bn.CHANGE_AUTOROTATE.name,Bn.CHECK_APP_INSTALLED.name,Bn.QUERY_SHOW.name,Bn.QUERY_HIDE.name,Bn.OPEN_INAPPRW.name,Bn.ZALORUN_GETTRACKINGSTATUS.name,Bn.ZALORUN_SETTRACKINGSTATUS.name,Bn.ZALORUN_GETDAYSTEP.name,Bn.ZALORUN_FORCESUBMITDATA.name,Bn.ZALORUN_SETWEIGHT.name,Bn.OPEN_PROFILE_EXT.name,Bn.DOWNLOAD_CATE.name,Bn.JUMP_LOGIN.name,Bn.OPEN_ADTIMA_ADS_INTERSTITIAL.name,Bn.OPEN_ADTIMA_ADS.name,Bn.GET_ADIDCLIENT.name,Bn.SCAN_IBEACON.name,Bn.SAVE_IMAGE_GALLERY.name,Bn.OPEN_MP.name,Bn.CHANGE_ACTIONBAR.name,Bn.INTERACTIVE_VIBRATION.name,Bn.ZBROWSER_MPDS.name],Hn=0,$n=3,Vn=1,Zn=0,Jn="https://payment-mini.zalo.me/api/order/create",Kn="https://payment-mini.zalo.me/api/transaction",qn="https://payment-mini.zalo.me/api/transaction/get-status";class Qn{constructor(e,t,n){this.code=e,this.message=t,this.api=n}toString(){return`api: ${this.api}; code: ${this.code}; message: ${this.message}`}}class Yn extends Qn{constructor(e,t){super(e,t),this.message=`${t}. ${xn.READ_MORE}`,this.handler()}handler(){switch(this.code){case e.NativeCode.token_invalid:this.code=Ln,this.message=xn.LOGIN_REQUIRED;break;case e.NativeCode.not_permission:this.code=Un,this.message=xn.NOT_PERMISSION;break;case e.NativeCode.client_not_support:this.code=Wn,this.message=xn.CLIENT_NOT_SUPPORT;break;case e.NativeCode.decode_failed:this.message=xn.DECODE_FAILED}}}const Xn={handler:null,setHandler(e){this.handler=e}};Xn.setHandler(((e,t)=>t instanceof Qn?(t.api=e,t):new Qn(-2001,fn.isNull(t.message)?"Unknown Error":t.message,e)));const ei=(e,t,n)=>{const o=n.value;return n.value=function(...e){return i(this,void 0,void 0,(function*(){const{success:n,fail:r}=Array.isArray(e)&&e.length>0&&e[0];return new Promise(((a,s)=>i(this,void 0,void 0,(function*(){try{const t=yield o.apply(this,e);!fn.isNull(n)&&fn.isFunction(n)?n.call(null,t,this):a(t)}catch(e){if("login"!==(null==e?void 0:e.api)&&((null==e?void 0:e.code)===Ln||(null==e?void 0:e.code)===Un)){let t=!1;this instanceof Zo&&(t=this.getLoginStatus()),t||(e=new Qn(Ln,xn.LOGIN_REQUIRED))}const{handler:n}=Xn,i=n.call(null,t,e,this);window.zmpSentry&&window.zmpSentry.throwError(i.toString()),!fn.isNull(r)&&fn.isFunction(r)?r.call(null,i,this):s(i)}}))))}))},n},ti=(e,t,n)=>{const i=n.value;return n.value=function(...e){try{return i.apply(this,e)}catch(e){if("login"!==(null==e?void 0:e.api)&&((null==e?void 0:e.code)===Ln||(null==e?void 0:e.code)===Un)){let t=!1;this instanceof Zo&&(t=this.getLoginStatus()),t||(e=new Qn(Ln,xn.LOGIN_REQUIRED))}const{handler:n}=Xn,i=n.call(null,t,e,this);throw window.zmpSentry&&window.zmpSentry.throwError(i.toString()),i}},n},ni=(e,t)=>({code:Dn,message:t||xn.SUCCESS,data:e||{}}),ii={badRequest:e=>new Qn(jn,e),loginFailed:()=>new Qn(jn,xn.LOGIN_FAILED),loginRequired:()=>new Qn(Ln,xn.LOGIN_REQUIRED),missingParam:e=>new Qn(jn,`Missing required argument: ${e}`),wrongTypeParam:(e,t,n)=>new Qn(jn,`Wrong type of parameter '${e}'. Expected ${t}, but got ${n}`),cannotGetShareInfo:()=>new Qn(Mn,"Can not get app info to share"),lengthInvalid:e=>new Qn(jn,`${e} length is invalid.`)};const oi={encode:function(e){var t=[];for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];if(void 0===i)return;if(null===i)return void t.push(n);t.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}return t.join("&")},decode:function(e,t){var n={};if(""===e)return n;for(var i=e.split("&"),o=0;o<i.length;o++){var r=i[o].split("=",2),a=decodeURIComponent(r[0]);if(t&&Object.prototype.hasOwnProperty.call(n,a))throw new URIError("Duplicate key: "+a);n[a]=2===r.length?decodeURIComponent(r[1]):null}return n},appendToUrl:function(e,t){return e+(-1!==e.indexOf("?")?"&":"?")+("string"==typeof t?t:oi.encode(t))},getParameterByName:function(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");var n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return n?n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"":null},getParamsAsObject:function(e){var t={};return e?(e.split("&").map((function(e){var n=e.split("=");n&&2==n.length&&(t[n[0]]=decodeURIComponent(n[1].replace(/\+/g," ")))})),t):t},toQueryString:function(e){if(!e)return"";if("object"!=(void 0===e?"undefined":typeof e))return e;var t=Object.keys(e),n=[];return t.map((function(t){var i=e[t],o=[t,i="object"==(void 0===i?"undefined":typeof i)?JSON.stringify(i):encodeURIComponent(i)].join("=");n.push(o)})),n.join("&")}};var ri=oi;const ai=new RegExp("[\\u0300-\\u036f]","g"),si=new RegExp("[đ|Đ]","g"),ci=new RegExp("\\s","g"),li=mn("zmp:utils:common"),ui=e=>{try{new URL(e)}catch(e){return!1}return!0},di=()=>navigator.userAgent||navigator.vendor||window.opera,pi=()=>{const e=di().toLowerCase();return{isWP:/iemobile/.test(e),isAndroid:/android/i.test(e)&&!/iemobile/.test(e),isIOS:/iphone|ios|ipad|ipod/.test(e)&&!/iemobile/.test(e),isMobile:/android|iphone|ios|ipad|ipod|iemobile/.test(e),isZalo:/zalo/.test(e)}},hi=e=>{const t=document.getElementsByTagName("meta");for(let n=0;n<t.length;n++)if(t[n].getAttribute("name")===e||t[n].getAttribute("property")===e)return t[n].getAttribute("content");return""},vi=()=>{const e=di().toLowerCase().split("zalo")[1];if(e){return e.replace(" ","").split("/")[1]||""}return""},fi=()=>{let t=pi();return t.isWP?e.PlatformType.wp:t.isAndroid?e.PlatformType.android:t.isIOS?e.PlatformType.iOS:e.PlatformType.unknown},mi=(e,t)=>{const n=t.toLowerCase(),i=n.split(/[<>]/i),o="array"===i[0];return!!("url"===n&&ui(e)||o&&("array"===n&&Array.isArray(e)||((e,t)=>Array.isArray(t)&&!t.some((t=>"url"===e?!ui(t):typeof t!==e)))(i[1],e))||!Array.isArray(e)&&typeof e===t)},gi=e=>(e=>{let t=yn(e);return t||(t=_n(e),t)?t:gn(e)})(e),yi=e=>{if(fn.isObject(JSON)&&JSON.parse&&fn.isString(e)){const t=e.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");return JSON.parse(t,((e,t)=>t))}return fn.isObject(e)?e:new Function("return "+e)()},_i=e=>{if(fn.isObject(JSON)&&JSON.stringify)return JSON.stringify(e);if(void 0===e)return"undefined";if(null===e)return"null";try{if("string"==typeof e||null!==e.constructor.toString().match(/string/i))return'"'+e.replace(/"/g,'\\"')+'"'}catch(e){console.log(e)}var t;if(null!==Object.prototype.toString.call(e).match(/array/i)){t=new Array;for(var n=e.length,i=0;i<n;i++)t.push(_i(e[i]));return"["+t.join(",")+"]"}if("object"==typeof e){for(var o in t=new Array,e)t.push('"'+o+'":'+_i(e[o]));return"{"+t.join(",")+"}"}return e.toString()},Ei=()=>{try{const e=Number(vi()),t=fi();return e>=Fn[t]}catch(e){return!0}},Si=e=>JSON.stringify(e).replace(/"/g,'\\"').replace(/'/g,"'"),Ai=e=>{try{if(e){li(e);const t=e.replace(/\\/g,"").replace(/'/g,"'");return li("formattedValue",t,JSON.parse(t),typeof JSON.parse(t)),JSON.parse(t)}return null}catch(t){return li("parse json error:",t),e}},Oi=(e,t,n,o,r,a)=>i(void 0,void 0,void 0,(function*(){const i=new URL(location.href),s=new URLSearchParams;let c=`${i.pathname}${i.search}`;a&&(c=`/zapps/${e}${"/"===a[0]?"":"/"}${a}`);const l=new URL(`https://zalo.me/app/link${c}`);s.append("title",n),s.append("description",o||""),s.append("thumbnail",r),s.append("url",l.href),s.append("accessToken",t||"");const u=yield fetch("https://h5.zalo.me/openapi/create-sharelink",Object.assign({method:"POST",body:s},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})),d=yield u.json();if(!d||0!==d.err)throw ii.cannotGetShareInfo();return l.search=`${l.search}&zshareId=${d.data.shareId}`,Object.assign(Object.assign({},d.data),{shareableLink:l.href})})),Ti=(e,t)=>n=>{if(!(Array.isArray(e)?e.some((e=>mi(n,e))):mi(n,e)))return{error:!0,errorMessage:e};if(t){if(Array.isArray(null==t?void 0:t.values))return{error:!(null==t?void 0:t.values.includes(n)),errorMessage:null==t?void 0:t.values.toString()};if(fn.isNumber(null==t?void 0:t.maxLength))return{error:fn.isString(n)&&n.length>(null==t?void 0:t.maxLength),errorMessage:`data length must <= ${null==t?void 0:t.maxLength}`};if(fn.isNumber(null==t?void 0:t.min)&&fn.isNumber(null==t?void 0:t.max))return{error:n<(null==t?void 0:t.min)||n>(null==t?void 0:t.max),errorMessage:`data must be in between ${null==t?void 0:t.min} and ${null==t?void 0:t.max}`};if(fn.isNumber(null==t?void 0:t.min))return{error:n<(null==t?void 0:t.min),errorMessage:`data must >= ${null==t?void 0:t.min}`};if(fn.isNumber(null==t?void 0:t.max))return{error:n>(null==t?void 0:t.max),errorMessage:`data must <= ${null==t?void 0:t.max}`};if(fn.isRegExp(null==t?void 0:t.regex))return{error:!t.regex.test(n),errorMessage:"data must valid"}}return{error:!1}},bi=(e,t,n)=>i(void 0,void 0,void 0,(function*(){const i={appId:e,versionStatus:t};fn.isUndefined(n)||(i.currentVersion=n);const o=ri.appendToUrl(`https://h5.zalo.me/${zn}`,i),r=yield fetch(o,{credentials:"include"});if(r.ok){const e=yield r.json();if(e.err<0||!e.data)throw new Error(e);return{name:e.data.name,version:e.data.version,description:e.data.description,appUrl:e.data.appUrl,qrCodeUrl:e.data.qrCodeUrl,logoUrl:e.data.logoUrl}}throw new Error("Can't get app info")}));var wi=v((function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function r(e,t,i,r,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new o(i,r||e,a),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,i,o=[];if(0===this._eventsCount)return o;for(i in e=this._events)t.call(e,i)&&o.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},s.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var o=0,r=i.length,a=new Array(r);o<r;o++)a[o]=i[o].fn;return a},s.prototype.listenerCount=function(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},s.prototype.emit=function(e,t,i,o,r,a){var s=n?n+e:e;if(!this._events[s])return!1;var c,l,u=this._events[s],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,i),!0;case 4:return u.fn.call(u.context,t,i,o),!0;case 5:return u.fn.call(u.context,t,i,o,r),!0;case 6:return u.fn.call(u.context,t,i,o,r,a),!0}for(l=1,c=new Array(d-1);l<d;l++)c[l-1]=arguments[l];u.fn.apply(u.context,c)}else{var p,h=u.length;for(l=0;l<h;l++)switch(u[l].once&&this.removeListener(e,u[l].fn,void 0,!0),d){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,t);break;case 3:u[l].fn.call(u[l].context,t,i);break;case 4:u[l].fn.call(u[l].context,t,i,o);break;default:if(!c)for(p=1,c=new Array(d-1);p<d;p++)c[p-1]=arguments[p];u[l].fn.apply(u[l].context,c)}}return!0},s.prototype.on=function(e,t,n){return r(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return r(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,i,o){var r=n?n+e:e;if(!this._events[r])return this;if(!t)return a(this,r),this;var s=this._events[r];if(s.fn)s.fn!==t||o&&!s.once||i&&s.context!==i||a(this,r);else{for(var c=0,l=[],u=s.length;c<u;c++)(s[c].fn!==t||o&&!s[c].once||i&&s[c].context!==i)&&l.push(s[c]);l.length?this._events[r]=1===l.length?l[0]:l:a(this,r)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new i,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s}));class Ni extends wi{constructor(){super(),this.debug=mn("zmp:event-emitter")}static getInstance(){return Ni.instance||(Ni.instance=new Ni),Ni.instance}h5ConfirmHandleEvent(e,t,n){ZaloJavaScriptInterface.jsH5EventCallback(e,t,n||"")}on(e,t,n){this.debug(`register ${e}: ${n}`);return super.on(e,((i,o)=>{this.h5ConfirmHandleEvent(i,e,n),t(o)}),n)}once(e,t,n){this.debug(`register once ${e}: ${n}`);return super.once(e,((i,o)=>{this.h5ConfirmHandleEvent(i,e,n),t(o)}),n)}}var Pi={},Ii=function(e,t,n){var i=t||"default";return function(){var t=i in Pi?Pi[i](e,n):e;return t.apply(this,arguments)}};Ii.setWrapper=function(e){var t=arguments.length<=1||void 0===arguments[1]?"default":arguments[1];Pi[t]=e};var Ci={error:{code:1,error_subcode:1357046,message:"Received Invalid JSON reply.",type:"http"}};function ki(e){try{return null===e?Ci:JSON.parse(e)}catch(e){return Ci}}var Ri,Bi={execute:function(e,t,n,i){n.suppress_http_code=1;var o=ri.encode(n);"post"!=t&&(e=ri.appendToUrl(e,o),o="");var r=function(e,t){if(!self.XMLHttpRequest)return null;var n=new XMLHttpRequest,i=function(){};if(!("withCredentials"in n))return null;n.open(e,t,!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded");var o={send:function(e){n.send(e)}},r=Ii((function(){r=i,"onload"in o&&o.onload(n)}),"entry","XMLHttpRequest:load"),a=Ii((function(){a=i,"onerror"in o&&o.onerror(n)}),"entry","XMLHttpRequest:error");return n.onload=function(){r()},n.onerror=function(){a()},n.onreadystatechange=function(){4==n.readyState&&(200==n.status?r():a())},o}(t,e);return!!r&&(r.onload=function(e){i(ki(e.responseText))},r.onerror=function(e){e.responseText?i(ki(e.responseText)):i({error:{code:1,error_subcode:1357045,message:"unknown error (empty response)",status:e.status,type:"http"}})},r.send(o),!0)}};class Di extends wi{constructor(){super(),this.debug=mn("zmp:ZaloJSBridge"),this.events=Ni.getInstance(),this._accessTk=gi("zacc_session")||"DEFAULT_ACCESS_TOKEN",this._jsAccessTk=gi("zlink3rd")||"DEFAULT_JS_TOKEN",this.results=[],this._userAgent=di(),this._device=pi(),this._jsCallFuncCallbacks={},this.events.on(e.Events.AppPaused,(()=>{if(this.results.length>0){let e=this.results;this.results=[];try{this.sendLogData(e)}catch(e){}}})),this.sendLogTimer?clearInterval(this.sendLogTimer):this.sendLogTimer=setInterval((()=>{if(this.results.length>0){let e=this.results;this.results=[];try{this.sendLogData(e)}catch(e){}}}),5e3)}static getInstance(){return Di.instance||(Di.instance=new Di),Di.instance}set accessTk(e){this._accessTk=e}set jsAccessTk(e){this._jsAccessTk=e}sendLogData(e){try{Bi.execute("https://h5.zalo.me/log/async","post",{appId:window.APP_ID,data:JSON.stringify(e)},(e=>{}))}catch(e){}}onJSCall(e,t){try{this.debug("onJSCall",e,t);const n=yi(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,i=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,n)}catch(e){console.error("Call callback error",e)}i&&clearTimeout(i),this._jsCallFuncCallbacks[e]=null,delete this._jsCallFuncCallbacks[e]}}this.results.push({action:n.action,error:n.error_code})}catch(e){console.log("onJSCall","error",e)}}onMultiJSCall(e,t){try{this.debug("onMultiJSCall",e,t);const n=yi(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,i=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,n)}catch(e){console.error("Call callback error",e)}i&&clearTimeout(i)}}this.results.push({action:n.action,error:n.error_code})}catch(e){console.log("onMultiJSCall","error",e)}}nativeEventHandler(e,t,n){this.debug(`eventId: ${e}, eventName: ${t}, eventData: ${n}`);const i=Ai(n);this.debug(i);const o=this.handleEventData(t,i);this.events.emit(t,e,o)}handleEventData(t,n){try{switch(t){case e.Events.OpenApp:const{url:t}=n,i=new URL(t),o=i.pathname.split(`/zapps/${An}`)[1];return{path:`${o||"/"}${i.search}`};default:return n}}catch(e){return n}}defaultCallback(e){null!=e&&(e=yi(e))}jsCall(e,t,n,i=!1,o=3,r=!0){try{const a=e.name,s=((e="")=>`${e.normalize("NFD").replace(ai,"").replace(si,"d").replace(ci,"").toLowerCase()}_${Math.random().toString(36).substr(2,4)}`)(a);if(!this._device.isMobile||fn.isEmpty(a))return this.onJSCall(s,{error_code:-13,error_message:"params invalid!",data:{device:this._device.isMobile,jsToken:this._jsAccessTk,access_token:this._accessTk},action:a}),!1;null==t&&(t={}),n||(n=this.defaultCallback);const c={error_code:-14,error_message:"Request Timeout!",data:{},action:a};this._jsCallFuncCallbacks[s]={timeout:r&&e.have_callback&&setTimeout((()=>{this.onJSCall(s,c)}),8e3),callback:n};try{return t=_i(t),i?this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,window.onMultiJSCall(s)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,`window.onMultiJSCall('${s}')`):this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,window.onJSCall(s)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,`window.onJSCall('${s}')`)}catch(r){if(!(o-- >0)){const e={error_code:-5,error_message:"Not ready!",data:{userAgent:this._userAgent,options:t,jsToken:this._jsAccessTk,access_token:this._accessTk},action:a,js_error:r};return this.onJSCall(s,e),!1}setTimeout((()=>{this.jsCall(e,t,n,i,o)}),500)}}catch(e){console.log("jsCall","error",e)}return!1}}class ji{constructor(){this.debug=mn("zmp:ZJSBridgeProvider"),Ri.set(this,void 0),r(this,Ri,Di.getInstance(),"f")}setZAccSession(e){o(this,Ri,"f").accessTk=e}setJSToken(e){o(this,Ri,"f").jsAccessTk=e}callNative(e,t,n){return this.debug(e.name,t),new Promise(((r,a)=>{const s=o=>i(this,void 0,void 0,(function*(){try{const i=new Yn(o.error_code,`${o.action}: ${o.error_message}`);if(null==n?void 0:n.callback){const e=yield n.callback(o,i);return r(e)}if(o&&o.error_code>=0)r(o.data||{});else if(o&&o.error_code<0){try{window.zmpSentry&&window.zmpSentry.captureMessage(`${e.name}: call native fail`,{extra:{data:t,rs:o}})}catch(e){}return a(i)}}catch(e){return a(e)}})),c=pi().isIOS,l=(e=>{var t;const n=vi(),i=(null===(t=null==e?void 0:e.version_live)||void 0===t?void 0:t.iOS)||0;return!!(Array.isArray(window.ignoreCheckSupport)&&window.ignoreCheckSupport.length>0&&window.ignoreCheckSupport.includes(e.name))||n>=i})(e);if(c&&!l){const t=new Yn(-5,`${e}: Client isn't support this action`);return a(t)}(null==n?void 0:n.delay)?setTimeout((()=>{o(this,Ri,"f").jsCall(e,t,s,null==n?void 0:n.isMultiCallback,null==n?void 0:n.nRetry,null==n?void 0:n.haveTimeout)}),n.delay):o(this,Ri,"f").jsCall(e,t,s,null==n?void 0:n.isMultiCallback,null==n?void 0:n.nRetry,null==n?void 0:n.haveTimeout)}))}}Ri=new WeakMap;var Mi,Li,Ui,Wi,xi,zi="2.19.0-rc.4";class Fi{static getVersion(){return zi}static getSystemInfo(){return{version:hi("version-id")||"",apiVersion:zi,zaloVersion:vi(),platform:fi(),language:navigator.language,zaloLanguage:window.zLanguage||"vi",zaloTheme:window.zTheme||"light"}}static getAppInfo(){return i(this,void 0,void 0,(function*(){const e=this.getAppId(),t=this.getSystemInfo();return yield bi(e,0,t.version)}))}}class Gi{static setNavigationBarTitle(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.CHANGE_TITLE_HEADER,{title:e.title},{haveTimeout:!1})}))}static setNavigationBarColor(e){return i(this,void 0,void 0,(function*(){const t={};let n;fn.isEmpty(e.textColor)||(t.textColor=e.textColor),fn.isString(e.color)&&e.color.length>0?(fn.isEmpty(e.color)||(t.backgroundColor=e.color),n=5):(fn.isEmpty(e.statusBarColor)||(t.backgroundColor=e.statusBarColor),n=6),this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{actionbarType:n,dataConfig:Object.assign(Object.assign({},e.dataConfig),t)}))),yield this.callNative(Bn.CHANGE_ACTIONBAR,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarLeftButton(e){return i(this,void 0,void 0,(function*(){const t="none"===e.type||"home"===e.type?$n:Hn,n="home"===e.type||"both"===e.type?Vn:Zn;this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{buttonType:t,dataConfig:Object.assign(Object.assign({},e.dataConfig),{viewInLeftType:t}),homeConfig:Object.assign(Object.assign({},e.homeConfig),{enable:n})}))),yield this.callNative(Bn.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarRightButton(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.CREATE_OPTIONS_MENU,{supportToolBar:e.supportToolBar,reset:e.reset,menuListItems:e.menuListItems,zapp:this.getAppId()})}))}}class Hi{static setBackgroundColor(e){return i(this,void 0,void 0,(function*(){fn.isString(e.backgroundColor)&&e.backgroundColor.length>0&&(yield this.callNative(Bn.CHANGE_ACTIONBAR,{actionbarType:this.isShowNavBar?5:6,dataConfig:{backgroundColor:e.backgroundColor,textColor:e.textColor}}))}))}}class $i{constructor(e,t,n,i){this.title=i,this.severity=t;const o=new Date;if(this.time=o.toLocaleTimeString(),this.content=e,n>0){const e=(new Error).stack;this.stack=e?e.replace("Error\n",""):""}}toString(){return(this.content.stack?[this.title,this.severity.toUpperCase(),this.time,this.content,this.content.stack.replace("Error:","")]:[this.title,this.severity.toUpperCase(),this.time,JSON.stringify(this.content),this.stack]).join(" ")}}Mi=new WeakMap,Li=new WeakMap,Ui=new WeakMap,Wi=new WeakMap,xi=new WeakMap;var Vi,Zi,Ji,Ki,qi,Qi,Yi,Xi,eo,to,no,io,oo,ro,ao,so,co,lo,uo,po,ho,vo,fo,mo,go,yo,_o,Eo,So=new class{constructor(){Mi.set(this,3),Li.set(this,["none","error","warn","info"]),Ui.set(this,"[zmp] > "),Wi.set(this,{error:0,warn:0,info:0,firstError:null,lastError:null}),xi.set(this,((e,t,n)=>{o(this,Wi,"f")[o(this,Li,"f")[e]]++;const i=o(this,Li,"f")[e];if(r(this,Ui,o(this,Ui,"f")+("string"!=typeof t?new $i(t,i,e,n).toString():t),"f"),!(e>o(this,Mi,"f")))switch(e){case 1:console.error(o(this,Ui,"f"));break;case 2:console.warn(o(this,Ui,"f"));break;case 3:console.info(o(this,Ui,"f"));break;default:throw new Error("internal")}}))}setLogLevel(e){r(this,Mi,e,"f")}info(e){o(this,xi,"f").call(this,3,e)}warn(e,t){o(this,xi,"f").call(this,2,e,t)}error(e,t){o(this,xi,"f").call(this,1,e,t)}getMetrics(){return o(this,Wi,"f")}};class Ao{static setDeviceOrientation(t){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.CHANGE_AUTOROTATE,{autoRotate:e.OrientationType[t.rotate]})}))}static getNetworkType(t){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.WEBVIEW_NETWORKTYPE,{url:window.location.href,featureId:""}).then((t=>{const n=t.network;let i;const o=pi().isAndroid;switch(n){case Rn(o).NONE:i=e.NetworkType.none;break;case Rn(o).WIFI:i=e.NetworkType.wifi;break;case Rn(o)["2G"]:case Rn(o)["3G"]:case Rn(o)["4G"]:i=e.NetworkType.cellular;break;default:i=e.NetworkType.unknown}return{networkType:i}}))}))}static onNetworkStatusChange(t){return i(this,void 0,void 0,(function*(){yield this.events.on(e.Events.NetworkChanged,(e=>{const n=e&&e.state;this.getNetworkType().then((e=>{const i={isConnected:"CONNECTED"===n,networkType:e&&e.networkType};t(i)})).catch((e=>{So.error(e,"onNetworkStatusChange")}))}))}))}static startBeaconDiscovery(e){var t,n,o,r,a;return i(this,void 0,void 0,(function*(){const i={subaction:0,scanning_type:fn.isNumber(null==e?void 0:e.scanningType)?e.scanningType:0,data:{scan_from_source:fn.isString(null==e?void 0:e.scanFromSource)?e.scanFromSource:"",expire:fn.isNumber(null==e?void 0:e.expire)?e.expire:3e3,monitor_interval:fn.isNumber(null==e?void 0:e.monitorInterval)?e.monitorInterval:60,domain:fn.isString(null==e?void 0:e.domain)?e.domain:"",scan_config:{scan_time:fn.isNumber(null===(t=null==e?void 0:e.scanConfig)||void 0===t?void 0:t.scanTime)?e.scanConfig.scanTime:15e3,time_between_scan:fn.isNumber(null===(n=null==e?void 0:e.scanConfig)||void 0===n?void 0:n.timeBetweenScan)?e.scanConfig.timeBetweenScan:1e4,beacon_timeout:fn.isNumber(null===(o=null==e?void 0:e.scanConfig)||void 0===o?void 0:o.beaconTimeout)?e.scanConfig.beaconTimeout:3e4,delayCheckConnectedTimeout:fn.isNumber(null===(r=null==e?void 0:e.scanConfig)||void 0===r?void 0:r.delayCheckConnectedTimeout)?e.scanConfig.delayCheckConnectedTimeout:5e3,beaconConnectedTimeout:fn.isNumber(null===(a=null==e?void 0:e.scanConfig)||void 0===a?void 0:a.beaconConnectedTimeout)?e.scanConfig.beaconConnectedTimeout:6e5},items:Array.isArray(null==e?void 0:e.items)?null==e?void 0:e.items:[]}};return yield this.callNative(Bn.SCAN_IBEACON,Object.assign({},i)),!0}))}static stopBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.SCAN_IBEACON,Object.assign({},{subaction:2})),!0}))}static getBeacons(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.SCAN_IBEACON,Object.assign({},{subaction:1}),{isMultiCallback:!0}).then((e=>{const t={beacons:[]};return Array.isArray(e)&&e.forEach((e=>{const n={uuid:e.uuid,major:e.major,minor:e.minor,distance:e.distance,rssi:e.rssi};t.beacons.push(n)})),t}))}))}static stopBluetoothDevicesDiscovery(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static startBluetoothDevicesDiscovery(e){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},Object.assign({},e))}))}static openBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static onBluetoothDeviceFound(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static onBluetoothAdapterStateChange(){return i(this,void 0,void 0,(function*(){return Promise.resolve()}))}static getConnectedBluetoothDevices(e){return i(this,void 0,void 0,(function*(){const t={services:e.services||[]};return this.callNative({name:""},t)}))}static getBluetoothDevices(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static getBluetoothAdapterState(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static closeBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static scanQRCode(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.OPEN_QR,{skipOpenLink:!0})}))}static showToast(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.SHOW_TOAST,{toast:e.message})}))}static hideKeyboard(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.HIDE_KEYBOARD,{})}))}static openPhone(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.OPEN_PHONE,{phoneNum:e.phoneNumber,phoneCode:e.phoneNumber})}))}static openSMS(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.OPEN_SMS,{content:e.content,phoneCode:e.phoneNumber})}))}static keepScreen(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.KEEP_SCREEN,{data:{keep_screen_on:e.keepScreenOn?1:0}})}))}static openBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.PROMPT_AUTHENTICATION,{secret_data:e.secretData,app_id:this.getZAppId(),ui:{title:e.ui.title,sub_title:e.ui.subTitle,negative_text:e.ui.negativeButtonText},require_fingerprint:e.requireFingerprint?1:0}).then((e=>{var t,n,i,o;return{code:null==e?void 0:e.error_code,message:null==e?void 0:e.error_message,data:{domain:null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.domain,code:null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.error_code,message:null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.error_message,payToken:null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.pay_token}}}))}))}static checkStateBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.PROMPT_AUTHENTICATION_CHECK_STATE,{}).then((e=>({bioState:null==e?void 0:e.bio_state})))}))}static vibrate(t){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.INTERACTIVE_VIBRATION,{type:e.VibrateType[t.type],vibrate_time:t.milliseconds})}))}static connectWifi(e){return i(this,void 0,void 0,(function*(){let t="open";return fn.isString(e.password)&&e.password.length>0&&(t="wpa_wpa2"),yield this.callNative(Bn.MP_JOIN_WIFI,{ssid:e.SSID,securityType:t,password:e.password,hiddenSsid:e.hiddenSSID})}))}}class Oo{constructor(e){Vi.set(this,localStorage),Zi.set(this,void 0),Ji.set(this,void 0),pi(),r(this,Ji,{keys:new Set,currentSize:0,limitSize:kn},"f"),r(this,Zi,e,"f"),this.findAllCurrentDataByApp(e)}findAllCurrentDataByApp(e){try{let t;for(t in o(this,Vi,"f")){if(e){if(t.split("_")[0]!==e)continue}o(this,Ji,"f").keys.add(t)}}catch(e){So.error(e,"LocalResourceStorage > findAllCurrentDataByApp")}}get(e){let t=new Map;return e.forEach((e=>{t.set(e,this.getSync(e))})),Promise.resolve(t)}getSync(e){return o(this,Zi,"f")&&(e=`${o(this,Zi,"f")}_${e}`),o(this,Ji,"f").keys.has(e)?o(this,Vi,"f").getItem(e):null}set(e){return i(this,void 0,void 0,(function*(){return Object.entries(e).forEach((([e,t])=>{this.setSync(e,t.replace(/\\"/g,'"'))})),Promise.resolve({errorKeys:[]})}))}setSync(e,t){o(this,Zi,"f")&&(e=`${o(this,Zi,"f")}_${e}`),o(this,Vi,"f").setItem(e,t),o(this,Ji,"f").keys.add(e)}getInfo(){return i(this,void 0,void 0,(function*(){return Promise.resolve(this.getInfoSync())}))}getInfoSync(){const e=((e,t)=>{let n,i,o=0;for(i in e){const r=i.split("_")[0];e.hasOwnProperty(i)&&(t&&r!==t||(n=2*(e[i].length+i.length),o+=n))}return o})(o(this,Vi,"f"),o(this,Zi,"f"));return{currentSize:fn.isNumber(e)?Number((e/1024).toFixed(2)):0,limitSize:Number(5120..toFixed(2))}}remove(e){return i(this,void 0,void 0,(function*(){return e.forEach((e=>{this.removeSync(e)})),Promise.resolve({errorKeys:[]})}))}removeSync(e){o(this,Zi,"f")&&(e=`${o(this,Zi,"f")}_${e}`),o(this,Ji,"f").keys.has(e)&&(o(this,Vi,"f").removeItem(e),o(this,Ji,"f").keys.delete(e))}clear(){return i(this,void 0,void 0,(function*(){return Promise.resolve(this.clearSync())}))}clearSync(){o(this,Ji,"f").keys.forEach((e=>{o(this,Zi,"f")&&e.indexOf(o(this,Zi,"f"))<0||(o(this,Vi,"f").removeItem(e),o(this,Ji,"f").keys.delete(e))}))}}Vi=new WeakMap,Zi=new WeakMap,Ji=new WeakMap;class To extends ji{constructor(e){super(),Ki.set(this,void 0),qi.set(this,void 0),r(this,qi,{keys:new Set,currentSize:0,limitSize:kn},"f"),r(this,Ki,e,"f")}get(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.ZBROWSER_MPDS,{mpds_action:"mpds.get",mpds_data:{keys:e},appId:o(this,Ki,"f")},{isMultiCallback:!1}).then((e=>{let t=new Map;return e&&e.mpds_data&&e.mpds_data.map&&(t=new Map(Object.entries(e.mpds_data.map))),t}))}))}set(e){return i(this,void 0,void 0,(function*(){return{errorKeys:yield this.callNative(Bn.ZBROWSER_MPDS,{mpds_action:"mpds.set",mpds_data:{map:e},appId:o(this,Ki,"f")},{isMultiCallback:!1}).then((e=>{let t=[];return e&&e.mpds_data&&e.mpds_data.error_keys&&(t=e.mpds_data.error_keys),t}))}}))}getInfo(){return i(this,void 0,void 0,(function*(){const e=yield this.callNative(Bn.ZBROWSER_MPDS,{mpds_action:"mpds.get.size",mpds_data:{},appId:o(this,Ki,"f")},{isMultiCallback:!1}).then((e=>{let t=0;return e&&e.mpds_data&&e.mpds_data.size&&(t=e.mpds_data.size),t}));return{currentSize:fn.isNumber(e)?Number(e/1024):0,limitSize:Number(5120)}}))}remove(e){return i(this,void 0,void 0,(function*(){return{errorKeys:yield this.callNative(Bn.ZBROWSER_MPDS,{mpds_action:"mpds.remove.key",mpds_data:{keys:e},appId:o(this,Ki,"f")},{isMultiCallback:!1}).then((e=>{let t=[];return e&&e.mpds_data&&e.mpds_data.error_keys&&(t=e.mpds_data.error_keys),t}))}}))}clear(){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.ZBROWSER_MPDS,{mpds_action:"mpds.clear.appData",mpds_data:{},appId:o(this,Ki,"f")})}))}}Ki=new WeakMap,qi=new WeakMap;class bo{getDataFromStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance(),n=yield t.get(e),i={};return n.forEach(((e,t)=>{i[t]=Ai(e)})),i}))}putDataToStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance(),n={};return Object.entries(e).forEach((([e,t])=>{fn.isUndefined(t)||fn.isNull(t)||(n[e]=Si(t))})),yield t.set(n)}))}removeDataFromStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance();return yield t.remove(e)}))}clearStorage(){return i(this,void 0,void 0,(function*(){const e=this.getInstance();yield e.clear()}))}getStorageInfo(){return i(this,void 0,void 0,(function*(){const e=this.getInstance();return yield e.getInfo()}))}}class wo extends bo{constructor(e){super(),Qi.set(this,void 0),r(this,Qi,e,"f")}getInstance(){return new Oo(o(this,Qi,"f"))}}Qi=new WeakMap;class No extends bo{constructor(e){super(),Yi.set(this,void 0),r(this,Yi,e,"f")}getInstance(){return new To(o(this,Yi,"f"))}}Yi=new WeakMap;class Po{static setStorage(e){return i(this,void 0,void 0,(function*(){let t=new wo(this.getAppId());return Ei()&&(t=new No(this.getAppId())),yield t.putDataToStorage(e.data)}))}static getStorage(e){return i(this,void 0,void 0,(function*(){let t=new wo(this.getAppId());Ei()&&(t=new No(this.getAppId()));return yield t.getDataFromStorage(e.keys)}))}static getStorageInfo(e){return i(this,void 0,void 0,(function*(){let e=new wo(this.getAppId());return Ei()&&(e=new No(this.getAppId())),yield e.getStorageInfo()}))}static removeStorage(e){return i(this,void 0,void 0,(function*(){let t=new wo(this.getAppId());return Ei()&&(t=new No(this.getAppId())),yield t.removeDataFromStorage(e.keys)}))}static clearStorage(e={}){return i(this,void 0,void 0,(function*(){let e=new wo(this.getAppId());Ei()&&(e=new No(this.getAppId())),yield e.clearStorage()}))}}class Io{static getUserInfo(e){return i(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();let n="id,name,picture";(null==e?void 0:e.avatarType)&&(n=`${n}.type(${null==e?void 0:e.avatarType})`);return{userInfo:yield fetch(`${Nn}?fields=${n}`,{headers:{access_token:t||""}}).then((e=>i(this,void 0,void 0,(function*(){const t=yield e.json(),n={id:t.id,name:t.name,birthday:"",gender:"",avatar:t.picture&&t.picture.data&&t.picture.data.url};return console.warn("'birthday' and 'gender' are deprecated"),n}))))}}))}static getPhoneNumber(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.MP_GET_NUMBER,{},{isMultiCallback:!0,callback:(e,t)=>{if(0===e.error_code){const t={number:e.data};return Promise.resolve(t)}return Promise.reject(t)},delay:this.isIOS?400:0})}))}}class Co{static closeApp(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.WINDOW_CLOSE,{})}))}static openMiniApp(e){return i(this,void 0,void 0,(function*(){const t=null==e?void 0:e.appId,n=(null==e?void 0:e.params)||{},i=Object.entries(n).map((function([e,t]){return[e,t].join("=")})).join("&");let o;try{o=yield bi(t,0)}catch(e){}const r={appId:t};o&&(r.appName=o.name,r.appAvtUrl=o.logoUrl),yield this.callNative(Bn.OPEN_MP,{mpUrl:`https://h5.zdn.vn/zapps/${t}/${i.length>0?"?"+i:""}`,mpInfo:r})}))}static openWebview(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.OPEN_INAPP,{url:e.url})}))}static closeLoading(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.MP_CLOSE_LOADINGVIEW,{at:(new Date).getTime(),when:e,url:location.href})}))}}class ko{static getLocation(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.GET_LOCATION,{silent_request:!1,permission_description:"Cho phép Zalo truy cập vào vị trí của thiết bị này?"},{isMultiCallback:!0,haveTimeout:!1,callback:(e,t)=>{if(0===e.error_code){const t=e.data,n={latitude:t.latitude,longitude:t.longitude,timestamp:t.timestamp,provider:t.provider};return Promise.resolve(n)}return Promise.reject(t)},delay:this.isIOS?400:0})}))}static sendLocation(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.QUERY_LOCATION_HIDE,{title:e.title,touserid:e.toUserId,zapp:this.getZAppId()})}))}}class Ro{static requestCameraPermission(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.REQUEST_PERMISSION_CAMERA,{},{callback:(e,t)=>-2===e.error_code||e.error_code>=0?Promise.resolve({userAllow:-2!==e.error_code,message:e.error_message}):Promise.reject(t)})}))}static saveImageToPhotosAlbum(e){return i(this,void 0,void 0,(function*(){let t={};return fn.isEmpty(e.imageBase64Data)?fn.isEmpty(e.imageUrl)||(t={imageUrl:e.imageUrl}):t={imageBase64Data:e.imageBase64Data},yield this.callNative(Bn.SAVE_IMAGE_GALLERY,Object.assign({},t))}))}}class Bo{static viewOAQr(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.VIEW_MYQR,{dpn:e.displayName,uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openProfile(t){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.OPEN_PROFILE,{uId:t.id,type:e.ProfileType[t.type],zapp:this.getZAppId(),sourceId:t.sourceId,sourceIndex:t.sourceIndex})}))}static openChat(t){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.OPEN_CHAT,{uId:t.id,type:e.ChatType[t.type],zapp:this.getZAppId(),sourceId:t.sourceId,sourceIndex:t.sourceIndex})}))}static openPostFeed(t){return i(this,void 0,void 0,(function*(){let n={};switch(t.type){case"image":n={photoUrl:t.data.imageUrl};break;case"link":n={link:t.data.link,title:t.data.title,thumb:t.data.thumb,description:t.data.description};break;case"profile":n={avt:t.data.avatar,uid:t.data.id,dpn:t.data.displayName}}return yield this.callNative(Bn.OPEN_POSTFEED,Object.assign(Object.assign({type:e.PostFeedType[t.type]},n),{zapp:this.getZAppId()})).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static followOA(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.FOLLOW_OA,{uid:e.id,showDialogConfirm:!0,zapp:this.getZAppId()},{haveTimeout:!1})}))}static unfollowOA(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.UNFOLLOW_OA,{uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openShareSheet(t){return i(this,void 0,void 0,(function*(){let n={};switch(t.type){case"image":let e=[];Array.isArray(t.data.imageUrls)&&t.data.imageUrls.length>0?e=t.data.imageUrls:e.push(t.data.imageUrl),n={photoUrls:e,photoUrl:t.data.imageUrl,caption:t.data.caption};break;case"gif":n={photoUrl:t.data.imageUrl,gifUrl:t.data.gifUrl,width:t.data.width,height:t.data.height};break;case"video":n={videoThumb:t.data.videoThumb,videoUrl:t.data.videoUrl,width:t.data.width,height:t.data.height};break;case"link":n={link:t.data.link,chatOnly:t.data.chatOnly?1:0};break;case"oa":n={uid:t.data.id};break;case"zmp":const i=yield this.getAccessToken(),o=yield Oi(this.getAppId(),i||"",t.data.title||"",t.data.description||"",t.data.thumbnail||"",t.data.path);window.forceShareZMP?n={data:{ZInstantAPIInfo:{url:`${o.zinstantApi}`,zinstantdata_id:`templateId=${o.ztemplateId}&appId=${this.getAppId()}&shareId=${o.shareId}`},previewMsgText:{msg:{en:"Zalo Mini Program",vi:"Chương trình nhỏ"}},enableReactions:1}}:(n={link:o.shareableLink,chatOnly:t.data.chatOnly?1:0},t.type="link")}return yield this.callNative(Bn.OPEN_SHARESHEET,Object.assign(Object.assign({type:e.ShareSheetType[t.type]},n),{zapp:this.getZAppId()}),{haveTimeout:!1}).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static createShortcut(e,t,n){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.CREATE_SHORTCUT,{url:e,title:t,iconUrl:n})}))}static openProfilePicker(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.MP_OPEN_PROFILE_PICKER,{maxProfile:e},{isMultiCallback:!0,callback:(e,t)=>0===e.error_code&&Array.isArray(e.data)?Promise.resolve(e.data.map((e=>e.id))):Promise.reject(t)})}))}static getActionsSupported(t){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.GET_SUPPORTED_ACTIONS,{},{isMultiCallback:!1,callback:(t,n)=>{const i=fi();if(Array.isArray(t.actions)&&t.actions.length>0){const e=Object.keys(Bn).filter((e=>Bn[e].skip_jump)),n={actions:[...t.actions,...e]};return Promise.resolve(n)}if(i===e.PlatformType.iOS){const e={actions:Gn};return Promise.resolve(e)}return Promise.reject(n)}})}))}static openMediaPicker(t,n,o,r){return i(this,void 0,void 0,(function*(){const i={type:0,url:"https://zapi-server.tungnt.xyz/upload/photos",maxSize:1048576};return yield this.callNative(Bn.PICK_MEDIA,{media_type:e.MediaPickerType[t],edit_view:Object.assign(Object.assign({},{enable:1,aspect_ratio:"1:1"}),n),silent_request:o,upload:i,max_select_item:r},{isMultiCallback:!0,callback:(e,t)=>{var n,i;if(0===e.error_code){const t=Ai(null===(n=e.data)||void 0===n?void 0:n.result_content),o={urls:null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.urls};return Promise.resolve(o)}return Promise.reject(t)}})}))}static openOutApp(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.OPEN_OUTAPP,{url:e})}))}}class Do{static getRouteParams(){let e={};const t=window.location.href;try{let n=new URL(t).searchParams.toString();n&&(e=ri.getParamsAsObject(n))}catch(e){throw new Error("Url không hợp lệ")}return e}static sendDataToPreviousMiniApp(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.WEBVIEW_SET_RESULT,{result:Si(e.data)})}))}static onCallbackData(t){return i(this,void 0,void 0,(function*(){yield this.events.on(e.Events.OnDataCallback,(e=>{t({data:e})}))}))}}class jo extends ji{constructor(){var e,t,n,i,a,s,c,l,u,d,p,h,v,f,m,g,y;super(),Xi.set(this,Sn),eo.set(this,An),to.set(this,On),no.set(this,void 0),io.set(this,void 0),oo.set(this,void 0),ro.set(this,null),ao.set(this,{timer:{getToken:0}}),so.set(this,void 0),co.set(this,void 0),lo.set(this,null),this.events=Ni.getInstance(),this.isIOS=pi().isIOS,uo.set(this,void 0),this.getActionBarConfig=()=>o(this,uo,"f"),this.setActionBarConfig=e=>{r(this,uo,e(o(this,uo,"f")),"f")},po.set(this,(()=>new Promise(((e,t)=>{fn.isUndefined(o(this,lo,"f"))||fn.isNull(o(this,lo,"f"))?this.callNative(Bn.JUMP_LOGIN,{}).then((t=>{const n=t&&t.cookiesOAuthLogins||[],i=n.find((e=>e.name===bn));i&&(this.setJSToken(i.value),window.ZJSBridge.setJSToken&&window.ZJSBridge.setJSToken(i.value)),r(this,lo,n,"f"),e(n)})).catch((e=>{t(e)})):e(o(this,lo,"f"))})))),ho.set(this,Gi.setNavigationBarRightButton),this.getVersion=Fi.getVersion,this.getSystemInfo=Fi.getSystemInfo,this.setNavigationBarTitle=Gi.setNavigationBarTitle,this.setNavigationBarColor=Gi.setNavigationBarColor,this.setNavigationBarLeftButton=Gi.setNavigationBarLeftButton,this.setBackgroundColor=Hi.setBackgroundColor,this.setDeviceOrientation=Ao.setDeviceOrientation,this.setStorage=Po.setStorage,this.getStorage=Po.getStorage,this.getStorageInfo=Po.getStorageInfo,this.removeStorage=Po.removeStorage,this.clearStorage=Po.clearStorage,this.getUserInfo=Io.getUserInfo,this.getNetworkType=Ao.getNetworkType,this.onNetworkStatusChange=Ao.onNetworkStatusChange,this.startBeaconDiscovery=Ao.startBeaconDiscovery,this.stopBeaconDiscovery=Ao.stopBeaconDiscovery,this.getBeacons=Ao.getBeacons,this.closeApp=Co.closeApp,this.getLocation=ko.getLocation,this.stopBluetoothDevicesDiscovery=Ao.stopBluetoothDevicesDiscovery,this.startBluetoothDevicesDiscovery=Ao.stopBluetoothDevicesDiscovery,this.openBluetoothAdapter=Ao.openBluetoothAdapter,this.onBluetoothDeviceFound=Ao.onBluetoothDeviceFound,this.onBluetoothAdapterStateChange=Ao.onBluetoothAdapterStateChange,this.getConnectedBluetoothDevices=Ao.getConnectedBluetoothDevices,this.getBluetoothDevices=Ao.getBluetoothDevices,this.getBluetoothAdapterState=Ao.getBluetoothAdapterState,this.closeBluetoothAdapter=Ao.closeBluetoothAdapter,this.scanQRCode=Ao.scanQRCode,this.openProfile=Bo.openProfile,this.openChat=Bo.openChat,this.openPostFeed=Bo.openPostFeed,this.followOA=Bo.followOA,this.unFollowOA=Bo.unfollowOA,this.openShareSheet=Bo.openShareSheet,this.requestCameraPermission=Ro.requestCameraPermission,this.createShortcut=Bo.createShortcut,this.openBioAuthentication=Ao.openBioAuthentication,this.checkStateBioAuthentication=Ao.checkStateBioAuthentication,this.sendLocation=ko.sendLocation,this.showToast=Ao.showToast,this.hideKeyboard=Ao.hideKeyboard,this.openPhone=Ao.openPhone,this.openSMS=Ao.openSMS,this.viewOAQr=Bo.viewOAQr,this.keepScreen=Ao.keepScreen,this.saveImageToPhotosAlbum=Ro.saveImageToPhotosAlbum,this.openMiniApp=Co.openMiniApp,this.vibrate=Ao.vibrate,this.openWebview=Co.openWebview,this.getRouteParams=Do.getRouteParams,this.getAppInfo=Fi.getAppInfo,this.sendDataToPreviousMiniApp=Do.sendDataToPreviousMiniApp,this.onCallbackData=Do.onCallbackData,this.getPhoneNumber=Io.getPhoneNumber,this.openProfilePicker=Bo.openProfilePicker,vo.set(this,Bo.getActionsSupported),this.connectWifi=Ao.connectWifi,this.openMediaPicker=Bo.openMediaPicker,this.openOutApp=Bo.openOutApp,this.closeLoading=Co.closeLoading,r(this,no,null,"f"),r(this,io,null,"f"),r(this,oo,null,"f"),this.isShowNavBar=!0,r(this,so,0,"f"),r(this,co,0,"f");const _="home"===(null===(t=null===(e=o(this,to,"f"))||void 0===e?void 0:e.app)||void 0===t?void 0:t.leftButton)||"both"===(null===(i=null===(n=o(this,to,"f"))||void 0===n?void 0:n.app)||void 0===i?void 0:i.leftButton)?Vn:Zn,E=new URL(location.href),S=fn.isString(null===(s=null===(a=o(this,to,"f"))||void 0===a?void 0:a.app)||void 0===s?void 0:s.headerColor)&&(null===(u=null===(l=null===(c=o(this,to,"f"))||void 0===c?void 0:c.app)||void 0===l?void 0:l.headerColor)||void 0===u?void 0:u.length)>0?5:6,A="none"===(null===(p=null===(d=o(this,to,"f"))||void 0===d?void 0:d.app)||void 0===p?void 0:p.leftButton)||"home"===(null===(v=null===(h=o(this,to,"f"))||void 0===h?void 0:h.app)||void 0===v?void 0:v.leftButton)?$n:Hn;r(this,uo,{actionbarType:S,buttonType:A,dataConfig:{backgroundColor:(null===(m=null===(f=o(this,to,"f"))||void 0===f?void 0:f.app)||void 0===m?void 0:m.headerColor)||"",textColor:(null===(y=null===(g=o(this,to,"f"))||void 0===g?void 0:g.app)||void 0===y?void 0:y.textColor)||"",viewInLeftType:A,confirmToExit:1},homeConfig:{enable:_,url:`https://h5.zdn.vn/zapps/${this.getAppId()}/${E.search}`}},"f")}static getInstance(){return jo.instance||(jo.instance=new jo),jo.instance}getLoginStatus(){return fn.isString(o(this,oo,"f"))&&o(this,oo,"f").length>0}getAppId(){return o(this,eo,"f")}getZAppId(){return o(this,Xi,"f")}login(e){return i(this,void 0,void 0,(function*(){const e=yield o(this,po,"f").call(this),t=e.find((e=>e.name===Tn)),n=e.find((e=>e.name===wn));if(!fn.isUndefined(t)&&!fn.isNull(t)&&fn.isString(t.value)){if(r(this,no,t.value,"f"),fn.isUndefined(n)||fn.isNull(n)||!fn.isString(n.value)?yield this.loginZaloV3():(r(this,io,n.value,"f"),yield this.loginZaloV4()),!o(this,oo,"f"))throw ii.loginFailed();return o(this,oo,"f")}throw ii.loginFailed()}))}loginZaloV3(){return i(this,void 0,void 0,(function*(){return yield fetch(`${In}?app_id=${o(this,Xi,"f")}&redirect_uri=https://h5.zdn.vn/zapps/${o(this,eo,"f")}/&code=${o(this,no,"f")}&isSDK=true123`).then((e=>i(this,void 0,void 0,(function*(){let t=yield e.json();if(t.access_token){r(this,oo,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return r(this,co,e,"f"),r(this,so,(new Date).getTime(),"f"),this.setZAccSession(o(this,oo,"f")||""),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(o(this,oo,"f")||""),o(this,oo,"f")}return null}))))}))}loginZaloV4(){return i(this,void 0,void 0,(function*(){const e=new URLSearchParams;e.append("app_id",o(this,eo,"f")),e.append("code",o(this,no,"f")||""),e.append("code_verifier",o(this,io,"f")||""),fn.isNull(o(this,ro,"f"))?e.append("grant_type","authorization_code"):(e.append("grant_type","refresh_token"),e.append("refresh_token",o(this,ro,"f")||""));return yield fetch(Pn,Object.assign({method:"POST",body:e},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).then((e=>i(this,void 0,void 0,(function*(){const t=yield e.json();if(t.refresh_token&&r(this,ro,t.refresh_token,"f"),t.access_token){r(this,oo,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return r(this,co,e,"f"),r(this,so,(new Date).getTime(),"f"),this.setZAccSession(o(this,oo,"f")||""),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(o(this,oo,"f")||""),o(this,oo,"f")}return null}))))}))}getAccessToken(e){return i(this,void 0,void 0,(function*(){const e=(new Date).getTime()-o(this,so,"f");if(!o(this,oo,"f"))throw ii.loginRequired();return e<o(this,co,"f")?o(this,oo,"f"):yield this.login()}))}}Xi=new WeakMap,eo=new WeakMap,to=new WeakMap,no=new WeakMap,io=new WeakMap,oo=new WeakMap,ro=new WeakMap,ao=new WeakMap,so=new WeakMap,co=new WeakMap,lo=new WeakMap,uo=new WeakMap,po=new WeakMap,ho=new WeakMap,vo=new WeakMap;class Mo{constructor(){fo.set(this,Sn),mo.set(this,On),go.set(this,"DEFAULT ZOAUTH"),yo.set(this,"DEFAULT ACCESS TOKEN"),_o.set(this,{timer:{getToken:0}}),Eo.set(this,!1),this.getLoginStatus=()=>o(this,Eo,"f"),this.getAppId=()=>o(this,fo,"f"),this.login=()=>(r(this,Eo,!0,"f"),Promise.resolve(o(this,go,"f"))),this.getAccessToken=()=>Promise.resolve(o(this,yo,"f")),this.getVersion=Fi.getVersion,this.getSystemInfo=Fi.getSystemInfo,this.setNavigationBarTitle=()=>Promise.resolve(),this.setNavigationBarColor=()=>Promise.resolve(),this.setBackgroundColor=()=>Promise.resolve(),this.setNavigationBarLeftButton=()=>Promise.resolve(),this.setDeviceOrientation=()=>Promise.resolve(),this.setStorage=e=>i(this,void 0,void 0,(function*(){const t=new wo(this.getAppId());return yield t.putDataToStorage(e.data),{errorKeys:[]}})),this.getStorage=e=>i(this,void 0,void 0,(function*(){const t=new wo(this.getAppId());return yield t.getDataFromStorage(e.keys)})),this.getStorageInfo=e=>i(this,void 0,void 0,(function*(){const e=new wo(this.getAppId());return yield e.getStorageInfo()})),this.removeStorage=e=>i(this,void 0,void 0,(function*(){const t=new wo(this.getAppId());return yield t.removeDataFromStorage(e.keys)})),this.clearStorage=e=>i(this,void 0,void 0,(function*(){const e=new wo(this.getAppId());return yield e.clearStorage()})),this.getUserInfo=()=>(console.warn("birthday and gender are deprecated"),Promise.resolve({userInfo:{id:"3368637342326461234",name:"User Name",avatar:"https://h5.zdn.vn/static/images/avatar.png"}})),this.getNetworkType=()=>{let t;switch((navigator.connection||navigator.mozConnection||navigator.webkitConnection).effectiveType){case"none":t=e.NetworkType.none;break;case"4g":t=e.NetworkType.wifi;break;case"3g":case"2g":t=e.NetworkType.cellular;break;default:t=e.NetworkType.unknown}const n={networkType:t};return Promise.resolve(n)},this.onNetworkStatusChange=t=>{const n=navigator.connection||navigator.mozConnection||navigator.webkitConnection,i=n.effectiveType;return n.addEventListener("change",(function(){let n;switch(i){case"none":n=e.NetworkType.none;break;case"4g":n=e.NetworkType.wifi;break;case"3g":case"2g":n=e.NetworkType.cellular;break;default:n=e.NetworkType.unknown}t({isConnected:!0,networkType:n})})),Promise.resolve()},this.startBeaconDiscovery=e=>Promise.resolve(!0),this.stopBeaconDiscovery=e=>Promise.resolve(!0),this.getBeacons=e=>Promise.resolve({beacons:[]}),this.closeApp=()=>Promise.resolve(),this.getLocation=()=>Promise.resolve({longitude:"105.788026",latitude:"21.0258773",timestamp:(new Date).getTime().toString(),provider:"fused"}),this.onBackButtonClick=()=>Promise.resolve(),this.stopBluetoothDevicesDiscovery=()=>Promise.resolve(),this.startBluetoothDevicesDiscovery=()=>Promise.resolve(),this.openBluetoothAdapter=()=>Promise.resolve(),this.onBluetoothDeviceFound=()=>Promise.resolve(),this.onBluetoothAdapterStateChange=()=>Promise.resolve(),this.getConnectedBluetoothDevices=()=>Promise.resolve(),this.getBluetoothDevices=()=>Promise.resolve(),this.getBluetoothAdapterState=()=>Promise.resolve(),this.closeBluetoothAdapter=()=>Promise.resolve(),this.scanQRCode=()=>Promise.resolve({content:"132"}),this.openProfile=()=>Promise.resolve(),this.openChat=()=>Promise.resolve(),this.openPostFeed=()=>Promise.resolve({status:1,shareType:0,numberOfUser:0}),this.followOA=()=>Promise.resolve(),this.unFollowOA=()=>Promise.resolve(),this.openShareSheet=()=>Promise.resolve({status:2,shareType:0,numberOfUser:0}),this.requestCameraPermission=()=>Promise.resolve({userAllow:!0,message:"Success"}),this.createShortcut=()=>Promise.resolve(),this.openBioAuthentication=()=>Promise.resolve({code:0,message:"OK",data:{domain:"",code:0,message:"",payToken:""}}),this.checkStateBioAuthentication=()=>Promise.resolve({bioState:""}),this.sendLocation=()=>Promise.resolve(),this.showToast=()=>Promise.resolve(),this.hideKeyboard=()=>Promise.resolve(),this.openPhone=()=>Promise.resolve(),this.openSMS=()=>Promise.resolve(),this.viewOAQr=()=>Promise.resolve(),this.keepScreen=()=>Promise.resolve(),this.saveImageToPhotosAlbum=()=>Promise.resolve(),this.openMiniApp=e=>Promise.resolve(),this.vibrate=()=>Promise.resolve(),this.openWebview=e=>(location.replace(e.url),Promise.resolve()),this.getRouteParams=Do.getRouteParams,this.getAppInfo=()=>Promise.resolve({description:"",name:"",version:"",appUrl:"",qrCodeUrl:""}),this.sendDataToPreviousMiniApp=e=>Promise.resolve(),this.onCallbackData=e=>(e({data:""}),Promise.resolve()),this.getPhoneNumber=()=>(console.warn("This api only works on zalo app"),Promise.resolve({number:""})),this.openProfilePicker=()=>(console.warn("This api only works on zalo app"),Promise.resolve([])),this.connectWifi=()=>(console.warn("This api only works on zalo app"),Promise.resolve()),this.openOutApp=e=>(location.href=e,Promise.resolve()),this.closeLoading=e=>Promise.resolve()}on(e,t,n){throw new Error("Method not implemented.")}once(e,t,n){throw new Error("Method not implemented.")}off(e,t,n,i){throw new Error("Method not implemented.")}removeAllListeners(e){throw new Error("Method not implemented.")}openMediaPicker(e,t,n,i){return console.warn("This api only works on zalo app"),Promise.resolve({urls:[]})}}fo=new WeakMap,mo=new WeakMap,go=new WeakMap,yo=new WeakMap,_o=new WeakMap,Eo=new WeakMap;const Lo=Symbol("required"),Uo=Symbol("checkType"),Wo=(e,t)=>(n,i,o)=>{let r=Reflect.getOwnMetadata(Lo,n,i)||[];r.push({parameterIndex:o,fields:e,option:t}),Reflect.defineMetadata(Lo,r,n,i)},xo=(e,t,n)=>(i,o,r)=>{let a=Reflect.getOwnMetadata(Uo,i,o)||[];a.push({parameterIndex:r,type:e,properties:t,defaultValue:n}),Reflect.defineMetadata(Uo,a,i,o)};const zo=(e,t,n)=>{const i=n.value,o=i.toString().match(/\(.*?\)/)[0].replace(/[()]/gi,"").replace(/\s/gi,"").split(",");return n.value=function(){const n=Reflect.getOwnMetadata(Lo,e,t),r=Reflect.getOwnMetadata(Uo,e,t);return r&&r.forEach((e=>{const{parameterIndex:t,type:n,properties:i,defaultValue:r}=e;let a=arguments[t],s=o[t];const c=typeof a;if(!fn.isUndefined(a)){if(!mi(a,n))throw ii.wrongTypeParam(s,n,Array.isArray(a)?"array":null===a?"null":c);"object"===n&&Object.entries(i).forEach((([e,n])=>{const i=e.split("?")[0],o=fn.get(a,i);if(fn.isUndefined(o)||fn.isNull(o)){if(!e.includes("?"))throw ii.missingParam(e);fn.isObject(fn.get(a,i.split(".")[0]))&&r&&!fn.isUndefined(fn.get(r,i))&&fn.set(arguments[t],i,fn.get(r,i))}else if(fn.isFunction(n)){const e=n(o);if(e&&e.error)throw ii.wrongTypeParam(`${s}.${i}`,e.errorMessage,typeof o)}}))}})),n&&n.forEach((e=>{const{parameterIndex:t,option:n,fields:i}=e,o=arguments[t],r=null==n?void 0:n.if,a=null==n?void 0:n.defaultValue;let s=!0;r&&(s=Object.keys(r).every((e=>fn.get(o,e)===r[e]))),s&&i.forEach((e=>{const n=e=>{let n=!1;return fn.isEmpty(fn.get(o,e))&&(fn.isUndefined(fn.get(a,e))||fn.set(arguments[t],e,fn.get(a,e)),n=!0),n};if(Array.isArray(e)&&e.length>0&&e.every(n))throw ii.missingParam(e.join(" or "));if(fn.isString(e)&&n(e))throw ii.missingParam(e)}))})),i.apply(this,arguments)},n};var Fo,Go,Ho,$o,Vo;class Zo{constructor(){this.events=Ni.getInstance(),Fo.set(this,void 0),r(this,Fo,this.getServiceInstance(),"f"),this.events.addListener=(t,n,i)=>{const o=t;return this.events.addListener(e.Events[o],n,i)}}login(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").login(e)}))}getLoginStatus(){return o(this,Fo,"f").getLoginStatus()}getAccessToken(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getAccessToken(e)}))}getVersion(){return o(this,Fo,"f").getVersion()}getSystemInfo(){return o(this,Fo,"f").getSystemInfo()}setNavigationBarTitle(e){return i(this,void 0,void 0,(function*(){return o(this,Fo,"f").setNavigationBarTitle(e)}))}setNavigationBarColor(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").setNavigationBarColor(e)}))}setBackgroundColor(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").setBackgroundColor(e)}))}setNavigationBarLeftButton(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").setNavigationBarLeftButton(e)}))}setDeviceOrientation(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").setDeviceOrientation(e)}))}setStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").setStorage(e)}))}getStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getStorage(e)}))}getStorageInfo(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getStorageInfo(e)}))}removeStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").removeStorage(e)}))}clearStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").clearStorage(e)}))}getUserInfo(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getUserInfo(e)}))}getNetworkType(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getNetworkType(e)}))}onNetworkStatusChange(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").onNetworkStatusChange(e)}))}startBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").startBeaconDiscovery(e)}))}stopBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").stopBeaconDiscovery(e)}))}getBeacons(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getBeacons(e)}))}closeApp(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").closeApp(e)}))}getLocation(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getLocation(e)}))}stopBluetoothDevicesDiscovery(){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").stopBluetoothDevicesDiscovery()}))}startBluetoothDevicesDiscovery(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").startBluetoothDevicesDiscovery(e)}))}openBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").openBluetoothAdapter()}))}onBluetoothDeviceFound(){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").onBluetoothDeviceFound()}))}onBluetoothAdapterStateChange(){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").onBluetoothAdapterStateChange()}))}getConnectedBluetoothDevices(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getConnectedBluetoothDevices(e)}))}getBluetoothDevices(){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getBluetoothDevices()}))}getBluetoothAdapterState(){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getBluetoothAdapterState()}))}closeBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").closeBluetoothAdapter()}))}scanQRCode(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").scanQRCode(e)}))}openProfile(e){return i(this,void 0,void 0,(function*(){yield o(this,Fo,"f").openProfile(e)}))}openChat(e){return i(this,void 0,void 0,(function*(){yield o(this,Fo,"f").openChat(e)}))}openPostFeed(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").openPostFeed(e)}))}followOA(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").followOA(e)}))}unfollowOA(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").unFollowOA(e)}))}openShareSheet(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").openShareSheet(e)}))}requestCameraPermission(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").requestCameraPermission(e)}))}createShortcut(e){return i(this,void 0,void 0,(function*(){const t=yield bi(An,0),n=pi().isIOS,i=t.logoUrl||hi("og:image:url")||"",r=t.name||document.title,a=e.params?new URLSearchParams(e.params):new URLSearchParams;if(a.append("utm_source","zalo-shortcut"),a.append("utm_medium","default"),a.append("utm_campaign","default"),n){a.append("appId",An),a.append("appName",r),a.append("appIcon",i);const e=`https://mini.zalo.me/shortcut.html?${a.toString()}`;yield o(this,Fo,"f").openOutApp(encodeURI(e))}else yield o(this,Fo,"f").createShortcut(`https://zalo.me/app/link/zapps/${An}/?${a.toString()}`,r,i);return ni()}))}openBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").openBioAuthentication(e)}))}checkStateBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").checkStateBioAuthentication(e)}))}sendLocation(e){return i(this,void 0,void 0,(function*(){yield o(this,Fo,"f").sendLocation(e)}))}showToast(e){return i(this,void 0,void 0,(function*(){yield o(this,Fo,"f").showToast(e)}))}hideKeyboard(e){return i(this,void 0,void 0,(function*(){yield o(this,Fo,"f").hideKeyboard(e)}))}openPhone(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").openPhone(e)}))}openSMS(e){return i(this,void 0,void 0,(function*(){yield o(this,Fo,"f").openSMS(e)}))}viewOAQr(e){return i(this,void 0,void 0,(function*(){yield o(this,Fo,"f").viewOAQr(e)}))}keepScreen(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").keepScreen(e)}))}saveImageToGallery(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").saveImageToPhotosAlbum(e)}))}saveImageToPhotosAlbum(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").saveImageToPhotosAlbum(e)}))}openMiniApp(e){return i(this,void 0,void 0,(function*(){if(!fn.isEmpty(e.params)){const t=e.params||{};Object.keys(t).forEach((e=>{"object"==typeof t[e]&&(t[e]=JSON.stringify(t[e])),t[e]=""+encodeURIComponent(t[e])})),e.params=t}yield o(this,Fo,"f").openMiniApp(e)}))}vibrate(e){return i(this,void 0,void 0,(function*(){yield o(this,Fo,"f").vibrate(e)}))}openWebview(e){return i(this,void 0,void 0,(function*(){yield o(this,Fo,"f").openWebview(e)}))}getRouteParams(){return o(this,Fo,"f").getRouteParams()}getAppInfo(e){return o(this,Fo,"f").getAppInfo()}sendDataToPreviousMiniApp(e){return o(this,Fo,"f").sendDataToPreviousMiniApp(e)}onCallbackData(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").onCallbackData(e)}))}getPhoneNumber(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getPhoneNumber()}))}openProfilePicker(e){return i(this,void 0,void 0,(function*(){const t=yield o(this,Fo,"f").openProfilePicker(e.maxProfile);let n;if(t.length>0)try{const e=yield this.getAccessToken(),i=yield fetch(Cn,{method:"POST",headers:{"Content-Type":"application/json",access_token:e||""},body:JSON.stringify({fields:"id,name,picture",user_ids:t})}),o=yield i.json();if(0!==o.error||!o.data)throw new Error(o.message);n=t.map((e=>{var t,n,i,r,a,s,c,l,u,d,p;return{id:(null===(n=null===(t=o.data[e])||void 0===t?void 0:t.user_info)||void 0===n?void 0:n.user_id_by_app)||"",profile:{name:null===(r=null===(i=o.data[e])||void 0===i?void 0:i.user_info)||void 0===r?void 0:r.name,avatar:null===(l=null===(c=null===(s=null===(a=o.data[e])||void 0===a?void 0:a.user_info)||void 0===s?void 0:s.picture)||void 0===c?void 0:c.data)||void 0===l?void 0:l.url},code:0!==(null===(u=o.data[e])||void 0===u?void 0:u.error)?-1:0,message:`Get profile: ${fn.isUndefined(null===(d=o.data[e])||void 0===d?void 0:d.message)?"Unknown error":null===(p=o.data[e])||void 0===p?void 0:p.message}`}}))}catch(e){n=t.map((t=>({id:t,profile:{name:"",avatar:""},code:-1,message:`Can't get profile: ${e.message}`})))}return{users:n||[]}}))}connectWifi(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").connectWifi(e)}))}openMediaPicker(e){var t,n,r;return i(this,void 0,void 0,(function*(){const i={};fn.isUndefined(null===(t=e.editView)||void 0===t?void 0:t.enable)||(null===(n=e.editView)||void 0===n?void 0:n.enable)?i.enable=1:i.enable=0,i.aspect_ratio=null===(r=e.editView)||void 0===r?void 0:r.aspectRatio;const a=!0===e.silentRequest?1:0,s=e.maxSelectItem;return yield o(this,Fo,"f").openMediaPicker(e.type,i,a,s)}))}getShareableLink(e){return i(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();return(yield Oi(window.APP_ID,t||"",e.title,e.description,e.thumbnail,e.path)).shareableLink}))}closeLoading(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").closeLoading("user action")}))}}Fo=new WeakMap,t([ei],Zo.prototype,"login",null),t([ti],Zo.prototype,"getLoginStatus",null),t([ei],Zo.prototype,"getAccessToken",null),t([ti],Zo.prototype,"getVersion",null),t([ti],Zo.prototype,"getSystemInfo",null),t([ei,zo,n(0,xo("object",{title:Ti("string")}))],Zo.prototype,"setNavigationBarTitle",null),t([ei,zo,n(0,xo("object",{color:Ti("string"),"textColor?":Ti("string",{values:["white","black"]}),"statusBarColor?":Ti("string")}))],Zo.prototype,"setNavigationBarColor",null),t([ei,zo,n(0,xo("object",{backgroundColor:Ti("string"),"textColor?":Ti("string",{values:["white","black"]})}))],Zo.prototype,"setBackgroundColor",null),t([ei,zo,n(0,xo("object",{type:Ti("string",{values:["none","back","home","both"]})}))],Zo.prototype,"setNavigationBarLeftButton",null),t([ei,zo,n(0,xo("object",{rotate:Ti("string",{values:["auto","portrait","landscape"]})}))],Zo.prototype,"setDeviceOrientation",null),t([ei,zo,n(0,xo("object",{data:Ti("object")}))],Zo.prototype,"setStorage",null),t([ei,zo,n(0,xo("object",{keys:Ti("array<string>")}))],Zo.prototype,"getStorage",null),t([ei],Zo.prototype,"getStorageInfo",null),t([ei,zo,n(0,xo("object",{keys:Ti("array<string>")}))],Zo.prototype,"removeStorage",null),t([ei],Zo.prototype,"clearStorage",null),t([ei,zo,n(0,xo("object",{"avatarType?":Ti("string",{values:["small","normal","large"]})}))],Zo.prototype,"getUserInfo",null),t([ei],Zo.prototype,"getNetworkType",null),t([ei],Zo.prototype,"onNetworkStatusChange",null),t([ei],Zo.prototype,"startBeaconDiscovery",null),t([ei],Zo.prototype,"stopBeaconDiscovery",null),t([ei],Zo.prototype,"getBeacons",null),t([ei],Zo.prototype,"closeApp",null),t([ei],Zo.prototype,"getLocation",null),t([ei],Zo.prototype,"stopBluetoothDevicesDiscovery",null),t([ei],Zo.prototype,"startBluetoothDevicesDiscovery",null),t([ei],Zo.prototype,"openBluetoothAdapter",null),t([ei],Zo.prototype,"onBluetoothDeviceFound",null),t([ei],Zo.prototype,"onBluetoothAdapterStateChange",null),t([ei],Zo.prototype,"getConnectedBluetoothDevices",null),t([ei],Zo.prototype,"getBluetoothDevices",null),t([ei],Zo.prototype,"getBluetoothAdapterState",null),t([ei],Zo.prototype,"closeBluetoothAdapter",null),t([ei],Zo.prototype,"scanQRCode",null),t([ei,zo,n(0,xo("object",{type:Ti("string",{values:["user","oa","aliasOA"]}),id:Ti("string")}))],Zo.prototype,"openProfile",null),t([ei,zo,n(0,xo("object",{type:Ti("string",{values:["user","oa"]}),id:Ti("string")}))],Zo.prototype,"openChat",null),t([ei,zo,n(0,Wo(["data.imageUrl"],{if:{type:"image"}})),n(0,Wo(["data.link"],{if:{type:"link"}})),n(0,Wo(["data.id"],{if:{type:"profile"}})),n(0,xo("object",{type:Ti("string",{values:["image","link","profile"]}),data:Ti("object"),"data.imageUrl?":Ti("url"),"data.link?":Ti("url"),"data.title?":Ti("string"),"data.thumb?":Ti("url"),"data.description?":Ti("string"),"data.avatar?":Ti("url"),"data.id?":Ti("string"),"data.displayName?":Ti("string")}))],Zo.prototype,"openPostFeed",null),t([ei,zo,n(0,xo("object",{id:Ti("string"),"showDialogConfirm?":Ti("boolean")}))],Zo.prototype,"followOA",null),t([ei,zo,n(0,xo("object",{id:Ti("string")}))],Zo.prototype,"unfollowOA",null),t([ei,zo,n(0,Wo([["data.imageUrl","data.imageUrls"]],{if:{type:"image"}})),n(0,Wo(["data.link"],{if:{type:"link"}})),n(0,Wo(["data.id"],{if:{type:"oa"}})),n(0,Wo(["data.gifUrl"],{if:{type:"gif"}})),n(0,Wo(["data.videoThumb","data.videoUrl"],{if:{type:"video"}})),n(0,Wo(["data.thumbnail","data.title","data.description"],{if:{type:"zmp"},defaultValue:{data:{description:""}}})),n(0,xo("object",{type:Ti("string",{values:["image","gif","video","link","oa","zmp"]}),data:Ti("object"),"data.imageUrl?":Ti("url"),"data.imageUrls?":Ti("array<url>",{maxLength:10}),"data.caption?":Ti("string"),"data.gifUrl?":Ti("url"),"data.width?":Ti("number"),"data.height?":Ti("number"),"data.videoThumb?":Ti("url"),"data.videoUrl?":Ti("url"),"data.link?":Ti("url"),"data.chatOnly?":Ti("boolean"),"data.id?":Ti("string"),"data.thumbnail?":Ti("url"),"data.path?":Ti("string"),"data.title?":Ti("string",{maxLength:100}),"data.description?":Ti(["string"],{maxLength:400})}))],Zo.prototype,"openShareSheet",null),t([ei],Zo.prototype,"requestCameraPermission",null),t([ei],Zo.prototype,"createShortcut",null),t([ei,zo,n(0,xo("object",{secretData:Ti("string"),"ui?":Ti("object"),"ui.title?":Ti("string"),"ui.subTitle?":Ti("string"),"ui.negativeButtonText?":Ti("string"),"requireFingerprint?":Ti("boolean")},{requireFingerprint:!0,ui:{title:"Xác thực",subTitle:"Sử dụng sinh trắc học của bạn để xác thực",negativeButtonText:"Đóng"}}))],Zo.prototype,"openBioAuthentication",null),t([ei],Zo.prototype,"checkStateBioAuthentication",null),t([ei,zo,n(0,xo("object",{toUserId:Ti("string"),"title?":Ti("string")}))],Zo.prototype,"sendLocation",null),t([ei,zo,n(0,xo("object",{message:Ti("string")}))],Zo.prototype,"showToast",null),t([ei],Zo.prototype,"hideKeyboard",null),t([ei,zo,n(0,xo("object",{phoneNumber:Ti("string")}))],Zo.prototype,"openPhone",null),t([ei,zo,n(0,xo("object",{content:Ti("string"),phoneNumber:Ti("string",{regex:/^\+?\d+$/})}))],Zo.prototype,"openSMS",null),t([ei,zo,n(0,xo("object",{id:Ti("string"),"displayName?":Ti("string")},{displayName:""}))],Zo.prototype,"viewOAQr",null),t([ei],Zo.prototype,"keepScreen",null),t([ei,zo,n(0,xo("object",{"imageBase64Data?":Ti("string"),"imageUrl?":Ti("url")}))],Zo.prototype,"saveImageToGallery",null),t([ei,zo,n(0,xo("object",{"imageBase64Data?":Ti("string"),"imageUrl?":Ti("url")}))],Zo.prototype,"saveImageToPhotosAlbum",null),t([ei,zo,n(0,xo("object",{appId:Ti("string"),"params?":Ti("object")}))],Zo.prototype,"openMiniApp",null),t([ei,zo,n(0,xo("object",{"type?":Ti("string",{values:["oneShot"]}),"milliseconds?":Ti("number")},{type:"oneShot",milliseconds:500}))],Zo.prototype,"vibrate",null),t([ei,zo,n(0,xo("object",{url:Ti("string")}))],Zo.prototype,"openWebview",null),t([ti],Zo.prototype,"getRouteParams",null),t([ei],Zo.prototype,"getAppInfo",null),t([ei],Zo.prototype,"sendDataToPreviousMiniApp",null),t([ei],Zo.prototype,"onCallbackData",null),t([ei],Zo.prototype,"getPhoneNumber",null),t([ei,zo,n(0,xo("object",{"maxProfile?":Ti("number",{min:1,max:10})},{maxProfile:1}))],Zo.prototype,"openProfilePicker",null),t([ei,zo,n(0,Wo(["SSID"])),n(0,xo("object",{SSID:Ti("string"),"password?":Ti("string"),"hiddenSSID?":Ti("boolean")}))],Zo.prototype,"connectWifi",null),t([ei,zo,n(0,xo("object",{type:Ti("string",{values:["photo","video","file","multi_photo","multi_video"]}),"editView?":Ti("object"),"editView.enable?":Ti("boolean"),"editView.aspectRatio?":Ti("string",{regex:/^\d+:\d+$/}),"silentRequest?":Ti("boolean"),"maxSelectItem?":Ti("number",{min:1})}))],Zo.prototype,"openMediaPicker",null),t([ei,zo,n(0,xo("object",{title:Ti("string",{maxLength:100}),"thumbnail?":Ti("url"),"path?":Ti("string"),description:Ti(["string"],{maxLength:400})},{description:""}))],Zo.prototype,"getShareableLink",null),t([ei,zo],Zo.prototype,"closeLoading",null);class Jo extends Zo{getServiceInstance(){return jo.getInstance()}}class Ko extends Zo{getServiceInstance(){return new Mo}}class qo{constructor(){Go.set(this,An)}static getInstance(){return qo.instance||(qo.instance=new qo),qo.instance}createOrder(e,t){return i(this,void 0,void 0,(function*(){const n=o(this,Go,"f"),i=new URLSearchParams;i.append("amount",t.amount.toString()),i.append("item",encodeURIComponent(JSON.stringify(t.item))),i.append("appId",n),t.desc&&i.append("desc",encodeURIComponent(t.desc)),t.extradata&&i.append("extradata",encodeURIComponent(JSON.stringify(t.extradata))),t.method&&i.append("method",t.method);const r={headers:{"Content-Type":"application/x-www-form-urlencoded",authorization:"Bearer "}};try{const o=yield e.getAccessToken({fail:e=>{throw ii.loginRequired}});r.headers.authorization=`Bearer ${o}`;const a=yield fetch(Jn,Object.assign(Object.assign({method:"POST"},r),{body:i})),s=yield a.json();if(!s.data||0!==s.err)throw ii.badRequest(s.msg);const c=s.data.id,l=window.APP_VERSION,u=window.APP_ENV,d={miniAppId:n,accessToken:o||"",orderId:c};l&&(d.version=l),u&&(d.env=u),t.method&&(d.method=t.method);const p=ri.encode(d),h=new URL(`?${p}`,"https://payment-mini.zalo.me").toString();return yield e.openWebview({url:h,fail:e=>{throw e}}),{orderId:c}}catch(e){throw e}}))}checkTransaction(e,t){return i(this,void 0,void 0,(function*(){try{let n,{data:i}=t;if(i||(i=e.getRouteParams()),"object"==typeof i&&(n=i.appTransID||i.orderId||i.apptransid),"string"==typeof i){const e=ri.getParameterByName("orderId",i),t=ri.getParameterByName("appTransID",i)||ri.getParameterByName("apptransid",i);n=e||t}const r=new URL(Kn),a={transId:n||"",appId:o(this,Go,"f")};r.search=new URLSearchParams(a).toString();const s=yield fetch(r.toString()),c=yield s.json();if(!c.data||0!==c.err)throw ii.badRequest(c.msg);const l=c.data||{};return{msg:l.resultMessage,appId:l.appId,orderId:l.orderId,resultCode:l.resultCode,transTime:l.transTime,createdAt:l.createAt}}catch(e){throw e}}))}getOrderStatus(e){return i(this,void 0,void 0,(function*(){try{const{orderId:t}=e,n=new URL(qn),i={appId:o(this,Go,"f")};e.transId&&(i.transId=e.transId),e.orderId&&(i.orderId=e.orderId),n.search=new URLSearchParams(i).toString();const r=yield fetch(n.toString()),a=yield r.json();if(!a.data||0!==a.err)throw ii.badRequest(a.msg);const s=a.data||{};return{returnCode:s.returnCode,returnMessage:s.returnMessage,isProcessing:s.isProcessing,amount:s.amount}}catch(e){throw e}}))}}Go=new WeakMap;class Qo{constructor(){Ho.set(this,Sn)}static getInstance(){return Qo.instance||(Qo.instance=new Qo),Qo.instance}createOrder(e,t){return Promise.resolve({orderId:""})}checkTransaction(e,t){const n={msg:"Success",appId:o(this,Ho,"f"),orderId:"",resultCode:1,transTime:(new Date).getTime().toString(),createdAt:(new Date).getTime().toString()};return Promise.resolve(n)}getOrderStatus(e){return Promise.resolve({returnCode:3,returnMessage:"Giao dịch chưa được thực hiện.",isProcessing:!1,amount:1e4})}}Ho=new WeakMap;class Yo{constructor(e){$o.set(this,void 0),Vo.set(this,void 0),r(this,$o,this.getInstance(),"f"),r(this,Vo,e,"f")}createOrder(e){return o(this,$o,"f").createOrder(o(this,Vo,"f"),e)}checkTransaction(e){return o(this,$o,"f").checkTransaction(o(this,Vo,"f"),e)}getOrderStatus(e){return o(this,$o,"f").getOrderStatus(e)}}$o=new WeakMap,Vo=new WeakMap,t([ei,zo,n(0,xo("object",{amount:Ti(["string","number"]),desc:Ti("string"),"method?":Ti("string",{values:["MOMO","ZALOPAY","MOMO_SANDBOX","ZALOPAY_SANDBOX","CC","CC_SANDBOX","ATM","ATM_SANDBOX"]})}))],Yo.prototype,"createOrder",null),t([ei,zo],Yo.prototype,"checkTransaction",null),t([ei,zo,n(0,Wo(["transId"],{if:{orderId:void 0}})),n(0,Wo(["orderId"],{if:{transId:void 0}})),n(0,xo("object",{"transId?":Ti("string"),"orderId?":Ti("string")}))],Yo.prototype,"getOrderStatus",null);class Xo extends Yo{getInstance(){return qo.getInstance()}}class er extends Yo{getInstance(){return Qo.getInstance()}}const tr=pi();e.default=void 0,window.onJSCall=e=>function(t){Di.getInstance().onJSCall(e,t)},window.onMultiJSCall=e=>function(t){Di.getInstance().onMultiJSCall(e,t)},window.zaloJSV2={zalo_h5_event_handler:function(e,t,n){Di.getInstance().nativeEventHandler(e,t,n)}},e.Payment=void 0,tr.isZalo?(e.default=new Jo,e.Payment=new Xo(e.default)):(e.default=new Ko,e.Payment=new er(e.default)),window.ZaloMiniAppSDK=e.default,e.SDKCreator=Zo,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
15
|
+
***************************************************************************** */function t(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a}function n(e,t){return function(n,i){t(n,i,e)}}function i(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{c(i.next(e))}catch(e){r(e)}}function s(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}function o(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function r(e,t,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(e,n):o?o.value=n:t.set(e,n),n}var a=Object.prototype;var s=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||a)};var c=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),l=s,u=c,d=Object.prototype.hasOwnProperty;var h=function(e){if(!l(e))return u(e);var t=[];for(var n in Object(e))d.call(e,n)&&"constructor"!=n&&t.push(n);return t},p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function v(e,t){return e(t={exports:{}},t.exports),t.exports}var f="object"==typeof p&&p&&p.Object===Object&&p,m="object"==typeof self&&self&&self.Object===Object&&self,g=f||m||Function("return this")(),y=g.Symbol,_=Object.prototype,E=_.hasOwnProperty,S=_.toString,A=y?y.toStringTag:void 0;var O=function(e){var t=E.call(e,A),n=e[A];try{e[A]=void 0;var i=!0}catch(e){}var o=S.call(e);return i&&(t?e[A]=n:delete e[A]),o},T=Object.prototype.toString;var b=O,w=function(e){return T.call(e)},N=y?y.toStringTag:void 0;var P=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},I=P,C=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":N&&N in Object(e)?b(e):w(e)};var k,R=function(e){if(!P(e))return!1;var t=C(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},B=R,D=g["__core-js_shared__"],j=(k=/[^.]+$/.exec(D&&D.keys&&D.keys.IE_PROTO||""))?"Symbol(src)_1."+k:"";var M=function(e){return!!j&&j in e},L=Function.prototype.toString;var U=M,W=function(e){if(null!=e){try{return L.call(e)}catch(e){}try{return e+""}catch(e){}}return""},x=/^\[object .+?Constructor\]$/,z=Function.prototype,F=Object.prototype,G=z.toString,H=F.hasOwnProperty,$=RegExp("^"+G.call(H).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var V=function(e){return!(!P(e)||U(e))&&(R(e)?$:x).test(W(e))},Z=function(e,t){return null==e?void 0:e[t]};var J=function(e,t){var n=Z(e,t);return V(n)?n:void 0},K=J(g,"DataView"),q=J(g,"Map"),Q=J(g,"Promise"),Y=J(g,"Set"),X=J(g,"WeakMap"),ee=K,te=q,ne=Q,ie=Y,oe=X,re="[object Map]",ae="[object Promise]",se="[object Set]",ce="[object WeakMap]",le="[object DataView]",ue=W(ee),de=W(te),he=W(ne),pe=W(ie),ve=W(oe),fe=C;(ee&&fe(new ee(new ArrayBuffer(1)))!=le||te&&fe(new te)!=re||ne&&fe(ne.resolve())!=ae||ie&&fe(new ie)!=se||oe&&fe(new oe)!=ce)&&(fe=function(e){var t=C(e),n="[object Object]"==t?e.constructor:void 0,i=n?W(n):"";if(i)switch(i){case ue:return le;case de:return re;case he:return ae;case pe:return se;case ve:return ce}return t});var me=fe;var ge=function(e){return null!=e&&"object"==typeof e};var ye=function(e){return ge(e)&&"[object Arguments]"==C(e)},_e=Object.prototype,Ee=_e.hasOwnProperty,Se=_e.propertyIsEnumerable,Ae=ye(function(){return arguments}())?ye:function(e){return ge(e)&&Ee.call(e,"callee")&&!Se.call(e,"callee")},Oe=Array.isArray,Te=Oe;var be=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var we=function(e){return null!=e&&be(e.length)&&!R(e)};var Ne=function(){return!1},Pe=v((function(e,t){var n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,o=i&&i.exports===n?g.Buffer:void 0,r=(o?o.isBuffer:void 0)||Ne;e.exports=r})),Ie={};Ie["[object Float32Array]"]=Ie["[object Float64Array]"]=Ie["[object Int8Array]"]=Ie["[object Int16Array]"]=Ie["[object Int32Array]"]=Ie["[object Uint8Array]"]=Ie["[object Uint8ClampedArray]"]=Ie["[object Uint16Array]"]=Ie["[object Uint32Array]"]=!0,Ie["[object Arguments]"]=Ie["[object Array]"]=Ie["[object ArrayBuffer]"]=Ie["[object Boolean]"]=Ie["[object DataView]"]=Ie["[object Date]"]=Ie["[object Error]"]=Ie["[object Function]"]=Ie["[object Map]"]=Ie["[object Number]"]=Ie["[object Object]"]=Ie["[object RegExp]"]=Ie["[object Set]"]=Ie["[object String]"]=Ie["[object WeakMap]"]=!1;var Ce=function(e){return ge(e)&&be(e.length)&&!!Ie[C(e)]},ke=function(e){return function(t){return e(t)}},Re=v((function(e,t){var n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,o=i&&i.exports===n&&f.process,r=function(){try{var e=i&&i.require&&i.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=r})),Be=Re&&Re.isTypedArray,De=Be?ke(Be):Ce,je=h,Me=me,Le=Ae,Ue=we,We=Pe,xe=De,ze=Object.prototype.hasOwnProperty;var Fe=function(e){if(null==e)return!0;if(Ue(e)&&(Oe(e)||"string"==typeof e||"function"==typeof e.splice||We(e)||xe(e)||Le(e)))return!e.length;var t=Me(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(l(e))return!je(e).length;for(var n in e)if(ze.call(e,n))return!1;return!0};var Ge=function(e){return void 0===e};var He=function(e){return null===e};var $e=function(e){return"string"==typeof e||!Oe(e)&&ge(e)&&"[object String]"==C(e)};var Ve=function(e){return"number"==typeof e||ge(e)&&"[object Number]"==C(e)};var Ze=function(e){return ge(e)&&"[object RegExp]"==C(e)},Je=Re&&Re.isRegExp,Ke=Je?ke(Je):Ze;var qe=function(e){return"symbol"==typeof e||ge(e)&&"[object Symbol]"==C(e)},Qe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ye=/^\w*$/;var Xe=function(e,t){if(Oe(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!qe(e))||(Ye.test(e)||!Qe.test(e)||null!=t&&e in Object(t))},et=J(Object,"create");var tt=function(){this.__data__=et?et(null):{},this.size=0};var nt=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},it=Object.prototype.hasOwnProperty;var ot=function(e){var t=this.__data__;if(et){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return it.call(t,e)?t[e]:void 0},rt=Object.prototype.hasOwnProperty;var at=tt,st=nt,ct=ot,lt=function(e){var t=this.__data__;return et?void 0!==t[e]:rt.call(t,e)},ut=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=et&&void 0===t?"__lodash_hash_undefined__":t,this};function dt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}dt.prototype.clear=at,dt.prototype.delete=st,dt.prototype.get=ct,dt.prototype.has=lt,dt.prototype.set=ut;var ht=dt;var pt=function(){this.__data__=[],this.size=0};var vt=function(e,t){return e===t||e!=e&&t!=t};var ft=function(e,t){for(var n=e.length;n--;)if(vt(e[n][0],t))return n;return-1},mt=Array.prototype.splice;var gt=pt,yt=function(e){var t=this.__data__,n=ft(t,e);return!(n<0)&&(n==t.length-1?t.pop():mt.call(t,n,1),--this.size,!0)},_t=function(e){var t=this.__data__,n=ft(t,e);return n<0?void 0:t[n][1]},Et=function(e){return ft(this.__data__,e)>-1},St=function(e,t){var n=this.__data__,i=ft(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};function At(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}At.prototype.clear=gt,At.prototype.delete=yt,At.prototype.get=_t,At.prototype.has=Et,At.prototype.set=St;var Ot=ht,Tt=At;var bt=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var wt=function(e,t){var n=e.__data__;return bt(t)?n["string"==typeof t?"string":"hash"]:n.map};var Nt=function(){this.size=0,this.__data__={hash:new Ot,map:new(te||Tt),string:new Ot}},Pt=function(e){var t=wt(this,e).delete(e);return this.size-=t?1:0,t},It=function(e){return wt(this,e).get(e)},Ct=function(e){return wt(this,e).has(e)},kt=function(e,t){var n=wt(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};function Rt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Rt.prototype.clear=Nt,Rt.prototype.delete=Pt,Rt.prototype.get=It,Rt.prototype.has=Ct,Rt.prototype.set=kt;var Bt=Rt;function Dt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var i=arguments,o=t?t.apply(this,i):i[0],r=n.cache;if(r.has(o))return r.get(o);var a=e.apply(this,i);return n.cache=r.set(o,a)||r,a};return n.cache=new(Dt.Cache||Bt),n}Dt.Cache=Bt;var jt=Dt;var Mt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Lt=/\\(\\)?/g,Ut=function(e){var t=jt(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Mt,(function(e,n,i,o){t.push(i?o.replace(Lt,"$1"):n||e)})),t}));var Wt=function(e,t){for(var n=-1,i=null==e?0:e.length,o=Array(i);++n<i;)o[n]=t(e[n],n,e);return o},xt=y?y.prototype:void 0,zt=xt?xt.toString:void 0;var Ft=function e(t){if("string"==typeof t)return t;if(Oe(t))return Wt(t,e)+"";if(qe(t))return zt?zt.call(t):"";var n=t+"";return"0"==n&&1/t==-Infinity?"-0":n};var Gt=Xe,Ht=Ut,$t=function(e){return null==e?"":Ft(e)};var Vt=function(e,t){return Oe(e)?e:Gt(e,t)?[e]:Ht($t(e))},Zt=function(e){if("string"==typeof e||qe(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var Jt=function(e,t){for(var n=0,i=(t=Vt(t,e)).length;null!=e&&n<i;)e=e[Zt(t[n++])];return n&&n==i?e:void 0};var Kt=function(e,t,n){var i=null==e?void 0:Jt(e,t);return void 0===i?n:i},qt=function(){try{var e=J(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var Qt=function(e,t,n){"__proto__"==t&&qt?qt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Yt=Object.prototype.hasOwnProperty;var Xt=/^(?:0|[1-9]\d*)$/;var en=function(e,t,n){var i=e[t];Yt.call(e,t)&&vt(i,n)&&(void 0!==n||t in e)||Qt(e,t,n)},tn=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Xt.test(e))&&e>-1&&e%1==0&&e<t};var nn=function(e,t,n,i){if(!P(e))return e;for(var o=-1,r=(t=Vt(t,e)).length,a=r-1,s=e;null!=s&&++o<r;){var c=Zt(t[o]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(o!=a){var u=s[c];void 0===(l=i?i(u,c,s):void 0)&&(l=P(u)?u:tn(t[o+1])?[]:{})}en(s,c,l),s=s[c]}return e};var on,rn,an,sn,cn,ln,un,dn,hn,pn,vn,fn={isEmpty:Fe,isNull:He,isUndefined:Ge,isFunction:B,isObject:I,isString:$e,isNumber:Ve,isArray:Te,isRegExp:Ke,get:Kt,set:function(e,t,n){return null==e?e:nn(e,t,n)}};function mn(e){return"function"==typeof window.Debug?window.Debug(e):function(...e){process.env.NODE_ENV}}e.NetworkType=void 0,(on=e.NetworkType||(e.NetworkType={})).none="none",on.wifi="wifi",on.cellular="cellular",on.unknown="unknown",e.PlatformType=void 0,(rn=e.PlatformType||(e.PlatformType={})).wp="wp",rn.android="android",rn.iOS="iOS",rn.unknown="unknown",e.ProfileType=void 0,(an=e.ProfileType||(e.ProfileType={}))[an.user=1]="user",an[an.oa=0]="oa",an[an.aliasOA=2]="aliasOA",e.ChatType=void 0,(sn=e.ChatType||(e.ChatType={}))[sn.user=1]="user",sn[sn.oa=0]="oa",e.PostFeedType=void 0,(cn=e.PostFeedType||(e.PostFeedType={}))[cn.image=1]="image",cn[cn.link=4]="link",cn[cn.profile=5]="profile",e.ShareSheetType=void 0,(ln=e.ShareSheetType||(e.ShareSheetType={}))[ln.image=1]="image",ln[ln.gif=11]="gif",ln[ln.video=12]="video",ln[ln.link=4]="link",ln[ln.oa=5]="oa",ln[ln.zmp=22]="zmp",e.OrientationType=void 0,(un=e.OrientationType||(e.OrientationType={}))[un.auto=1]="auto",un[un.portrait=2]="portrait",un[un.landscape=3]="landscape",e.VibrateType=void 0,(dn=e.VibrateType||(e.VibrateType={}))[dn.oneShot=0]="oneShot",e.NativeCode=void 0,(hn=e.NativeCode||(e.NativeCode={}))[hn.token_invalid=-2]="token_invalid",hn[hn.not_permission=-1]="not_permission",hn[hn.client_not_support=-5]="client_not_support",hn[hn.decode_failed=-4]="decode_failed",e.Events=void 0,(pn=e.Events||(e.Events={})).AppPaused="h5.event.paused",pn.AppResumed="h5.event.resumed",pn.NetworkChanged="h5.event.connection.changed",pn.OnDataCallback="h5.event.webview.result",pn.OpenApp="h5.event.open.mp",e.MediaPickerType=void 0,(vn=e.MediaPickerType||(e.MediaPickerType={}))[vn.photo=4]="photo",vn[vn.video=5]="video",vn[vn.file=6]="file",vn[vn.multi_photo=7]="multi_photo",vn[vn.multi_video=8]="multi_video";const gn=e=>{const t=document.cookie;if(t){const o=t.split("; ");if(o&&o.length>0)for(var n=e.length+1,i=o.length-1;i>=0;i--){let t=o[i];if(t&&0===t.indexOf(e)&&(t=t.substring(n,t.length),t))return t=t.replace(/["']/g,""),t}}return null},yn=e=>gn(`${window.location.host}_`+e),_n=e=>gn((()=>{const e=window.location.host;if(e){if(e.indexOf("zalo.me")>=0)return"zalo.me_";if(e.indexOf("baomoi.com")>=0)return"baomoi.com_";if(e.indexOf("mp3.zing.vn")>=0)return"mp3.zing.vn_";if(e.indexOf("zaloapp.com")>=0)return"zaloapp.com_"}return""})()+e),En=1048576,Sn=window.zAppID,An=window.APP_ID,On=window.APP_CONFIG||{},Tn="h5.zdn.vn_zoauth",bn="h5.zdn.vn_zlink3rd",wn="h5.zdn.vn_zoauth_vrf",Nn="https://graph.zalo.me/v2.0/me",Pn="https://h5.zalo.me/openapi/access_token",In="https://oauth.zaloapp.com/v3/access_token",Cn="https://graph.zalo.me/v2.0/me/friends/list",kn=5*En,Rn=e=>({NONE:e?-2:0,WIFI:e?0:1,"2G":2,"3G":e?15:2,"4G":e?13:2}),Bn={GET_DOWNLOADED_STICKER:{name:"action.get.downloaded.sticker",have_callback:!0},OPEN_SHARE_STICKER:{name:"action.open.share.sticker"},OPEN_PROFILE:{name:"action.open.profile"},OPEN_FEED_DETAIL:{name:"action.open.feeddetail"},OPEN_FRIEND_RADA:{name:"action.open.friendrada"},OPEN_INAPP:{name:"action.open.inapp"},OPEN_OUTAPP:{name:"action.open.outapp"},OPEN_PAGE:{name:"action.open.page"},OPEN_PHOTODETAIL:{name:"action.open.photodetail"},OPEN_GALARY:{name:"action.open.galary"},OPEN_GAMECENTER:{name:"action.open.gamecenter"},OPEN_GAMENEWS:{name:"action.open.gamenews"},OPEN_TAB_CONTACT:{name:"action.open.tab.contact"},OPEN_TAB_SOCIAL:{name:"action.open.tab.social"},OPEN_FRIENDSUGGEST:{name:"action.open.friendsuggest"},OPEN_GROUPLIST:{name:"action.open.grouplist"},OPEN_NEARBY:{name:"action.open.nearby"},OPEN_ROOM:{name:"action.open.room"},OPEN_STICKERSTORE:{name:"action.open.stickerstore"},OPEN_CREATECHAT:{name:"action.open.createchat"},COPY_LINK_CATESTICKER:{name:"action.copy.link.catesticker"},REQUEST_BUY_STICKER:{name:"action.request.buy.sticker"},OPEN_CHAT:{name:"action.open.chat"},OPEN_TAB_CHAT:{name:"action.open.tab.chat"},OPEN_CHATGROUP:{name:"action.open.chatgroup"},OPEN_ADDFRIEND:{name:"action.open.addfriend"},OPEN_TAB_MORE:{name:"action.open.tab.more"},OPEN_POSTFEED:{name:"action.open.postfeed"},OPEN_LOGINDEVICES:{name:"action.open.logindevices"},OPEN_SENDSTICKER:{name:"action.open.sendsticker"},REPORT_ABUSE:{name:"action.report.abuse",have_callback:!0},FOLLOW_OA:{name:"action.follow.oa",have_callback:!0},UNFOLLOW_OA:{name:"action.unfollow.oa",have_callback:!0},OPEN_GAMEDETAIL:{name:"action.open.gamedetail"},OPEN_SHARESHEET:{name:"action.open.sharesheet",have_callback:!0},REQUEST_PERMISSION_CAMERA:{name:"action.request.permission.camera"},CHANGE_TITLE_HEADER:{name:"action.change.title.header",skip_jump:!0},WEBVIEW_CLEARCACHE:{name:"action.webview.clearcache"},WEBVIEW_CONFIRMCACHE:{name:"action.webview.confirmcache"},WEBVIEW_ISVISIBLE:{name:"action.webview.isvisible"},WEBVIEW_NETWORKTYPE:{name:"action.webview.networktype",skip_jump:!0},CHANGE_BUTTON_HEADER:{name:"action.change.button.header"},CREATE_OPTIONS_MENU:{name:"action.create.options.menu",skip_jump:!0,have_callback:!0},CREATE_SHORTCUT:{name:"action.create.shortcut"},CHANGE_ACTIONBAR_LEFTBUTTON_TYPE:{name:"action.change.actionbar.leftbutton.type",skip_jump:!0,have_callback:!0},WINDOW_CLOSE:{name:"action.window.close",skip_jump:!0,have_callback:!0},WEBVIEW_CHECKRESERROR:{name:"action.webview.checkResError"},IAP_REQUESTPAYMENT:{name:"action.iap.requestpayment"},ZBROWSER_GETSTATS:{name:"action.zbrowser.getstats"},ZBROWSER_JSBRIDGE:{name:"action.zbrowser.jsbridge",skip_jump:!0,have_callback:!0},PROMPT_AUTHENTICATION:{name:"action.prompt.authentication"},CHANGE_ACTIONBAR_COLOR:{name:"action.change.actionbar.color",skip_jump:!0},PROMPT_AUTHENTICATION_CHECK_STATE:{name:"action.prompt.authentication.check_state"},OPEN_APPSTORE:{name:"action.open.appstore"},GET_LOCATION:{name:"action.get.location",have_callback:!0},QUERY_LOCATION_HIDE:{name:"action.query.location.hide",have_callback:!0},SHOW_TOAST:{name:"action.show.toast",have_callback:!0},OPEN_APP:{name:"action.open.app"},HIDE_KEYBOARD:{name:"action.hide.keyboard"},OPEN_PHONE:{name:"action.open.phone"},OPEN_QR:{name:"action.open.qr"},OPEN_SMS:{name:"action.open.sms"},VIEW_MYQR:{name:"action.view.myqr",have_callback:!0},KEEP_SCREEN:{name:"action.keep.screen",have_callback:!0},CHANGE_AUTOROTATE:{name:"action.change.autorotate",skip_jump:!0},CHECK_APP_INSTALLED:{name:"action.check.app.installed"},QUERY_SHOW:{name:"action.query.show"},QUERY_HIDE:{name:"action.query.hide"},OPEN_INAPPRW:{name:"action.open.inapprw"},ZALORUN_GETTRACKINGSTATUS:{name:"action.zalorun.getTrackingStatus",have_callback:!0},ZALORUN_SETTRACKINGSTATUS:{name:"action.zalorun.setTrackingStatus",have_callback:!0},ZALORUN_GETDAYSTEP:{name:"action.zalorun.getDayStep",have_callback:!0},ZALORUN_FORCESUBMITDATA:{name:"action.zalorun.forceSubmitData",have_callback:!0},ZALORUN_SETWEIGHT:{name:"action.zalorun.setWeight",have_callback:!0},OPEN_PROFILE_EXT:{name:"action.open.profile.ext"},DOWNLOAD_CATE:{name:"action.download.cate",have_callback:!0},JUMP_LOGIN:{name:"action.jump.login",skip_jump:!0,white_list:!0},OPEN_ADTIMA_ADS_INTERSTITIAL:{name:"action.open.adtima.ads.interstitial"},OPEN_ADTIMA_ADS:{name:"action.open.adtima.ads"},GET_ADIDCLIENT:{name:"action.get.adidclient"},SCAN_IBEACON:{name:"action.scan.ibeacon"},INTERACTIVE_VIBRATION:{name:"action.interactive.vibration"},SAVE_IMAGE_GALLERY:{name:"action.save.image.gallery",version_live:{iOS:408}},OPEN_MP:{name:"action.open.mp",version_live:{iOS:402}},CHANGE_ACTIONBAR:{name:"action.change.actionbar",version_live:{iOS:402},skip_jump:!0},ZBROWSER_MPDS:{name:"action.zbrowser.mpds",version_live:{iOS:402}},WEBVIEW_SET_RESULT:{name:"action.webview.set.result",version_live:{iOS:416}},MP_GET_NUMBER:{name:"action.mp.get.number",version_live:{iOS:416}},MP_OPEN_PROFILE_PICKER:{name:"action.mp.open.profile.picker",version_live:{iOS:432}},GET_SUPPORTED_ACTIONS:{name:"action.get.supported.actions",white_list:!0},MP_JOIN_WIFI:{name:"action.mp.join.wifi",version_live:{android:0,iOS:999},have_permission:!1,white_list:!1},PICK_MEDIA:{name:"action.pick.media",version_live:{iOS:999}},MP_CLOSE_LOADINGVIEW:{name:"action.mp.close.loadingview"}},Dn=0,jn=-1400,Mn=-1500,Ln=-1401,Un=-1403,Wn=-1404,xn={SUCCESS:"Success",READ_MORE:"Read more at: https://miniapp.zalo.me/docs/api",LOGIN_REQUIRED:"Please login before to call this api. Read more at: https://miniapp.zalo.me/docs/api/login",LOGIN_FAILED:"Login failed.",NOT_PERMISSION:"You don't have permission to call this api",CLIENT_NOT_SUPPORT:"This API is not supported in this Zalo version",DECODE_FAILED:"Can not decode your data. Read more at: https://miniapp.zalo.me/docs/api/error"},zn="apps/get-info",Fn={android:12100571,iOS:400,wp:0,unknown:0},Gn=[Bn.GET_DOWNLOADED_STICKER.name,Bn.OPEN_SHARE_STICKER.name,Bn.OPEN_PROFILE.name,Bn.OPEN_FEED_DETAIL.name,Bn.OPEN_FRIEND_RADA.name,Bn.OPEN_INAPP.name,Bn.OPEN_OUTAPP.name,Bn.OPEN_PAGE.name,Bn.OPEN_PHOTODETAIL.name,Bn.OPEN_GALARY.name,Bn.OPEN_GAMECENTER.name,Bn.OPEN_GAMENEWS.name,Bn.OPEN_TAB_CONTACT.name,Bn.OPEN_TAB_SOCIAL.name,Bn.OPEN_FRIENDSUGGEST.name,Bn.OPEN_GROUPLIST.name,Bn.OPEN_NEARBY.name,Bn.OPEN_ROOM.name,Bn.OPEN_STICKERSTORE.name,Bn.OPEN_CREATECHAT.name,Bn.COPY_LINK_CATESTICKER.name,Bn.REQUEST_BUY_STICKER.name,Bn.OPEN_CHAT.name,Bn.OPEN_TAB_CHAT.name,Bn.OPEN_CHATGROUP.name,Bn.OPEN_ADDFRIEND.name,Bn.OPEN_TAB_MORE.name,Bn.OPEN_POSTFEED.name,Bn.OPEN_LOGINDEVICES.name,Bn.OPEN_SENDSTICKER.name,Bn.REPORT_ABUSE.name,Bn.FOLLOW_OA.name,Bn.UNFOLLOW_OA.name,Bn.OPEN_GAMEDETAIL.name,Bn.OPEN_SHARESHEET.name,Bn.REQUEST_PERMISSION_CAMERA.name,Bn.CHANGE_TITLE_HEADER.name,Bn.WEBVIEW_CLEARCACHE.name,Bn.WEBVIEW_CONFIRMCACHE.name,Bn.WEBVIEW_ISVISIBLE.name,Bn.WEBVIEW_NETWORKTYPE.name,Bn.CHANGE_BUTTON_HEADER.name,Bn.CREATE_OPTIONS_MENU.name,Bn.CREATE_SHORTCUT.name,Bn.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE.name,Bn.WINDOW_CLOSE.name,Bn.WEBVIEW_CHECKRESERROR.name,Bn.IAP_REQUESTPAYMENT.name,Bn.ZBROWSER_GETSTATS.name,Bn.ZBROWSER_JSBRIDGE.name,Bn.PROMPT_AUTHENTICATION.name,Bn.CHANGE_ACTIONBAR_COLOR.name,Bn.PROMPT_AUTHENTICATION_CHECK_STATE.name,Bn.OPEN_APPSTORE.name,Bn.GET_LOCATION.name,Bn.QUERY_LOCATION_HIDE.name,Bn.SHOW_TOAST.name,Bn.OPEN_APP.name,Bn.HIDE_KEYBOARD.name,Bn.OPEN_PHONE.name,Bn.OPEN_QR.name,Bn.OPEN_SMS.name,Bn.VIEW_MYQR.name,Bn.KEEP_SCREEN.name,Bn.CHANGE_AUTOROTATE.name,Bn.CHECK_APP_INSTALLED.name,Bn.QUERY_SHOW.name,Bn.QUERY_HIDE.name,Bn.OPEN_INAPPRW.name,Bn.ZALORUN_GETTRACKINGSTATUS.name,Bn.ZALORUN_SETTRACKINGSTATUS.name,Bn.ZALORUN_GETDAYSTEP.name,Bn.ZALORUN_FORCESUBMITDATA.name,Bn.ZALORUN_SETWEIGHT.name,Bn.OPEN_PROFILE_EXT.name,Bn.DOWNLOAD_CATE.name,Bn.JUMP_LOGIN.name,Bn.OPEN_ADTIMA_ADS_INTERSTITIAL.name,Bn.OPEN_ADTIMA_ADS.name,Bn.GET_ADIDCLIENT.name,Bn.SCAN_IBEACON.name,Bn.SAVE_IMAGE_GALLERY.name,Bn.OPEN_MP.name,Bn.CHANGE_ACTIONBAR.name,Bn.INTERACTIVE_VIBRATION.name,Bn.ZBROWSER_MPDS.name],Hn=0,$n=3,Vn=1,Zn=0,Jn="https://payment-mini.zalo.me/api/order/create",Kn="https://payment-mini.zalo.me/api/transaction",qn="https://payment-mini.zalo.me/api/transaction/get-status";class Qn{constructor(e,t,n){this.code=e,this.message=t,this.api=n}toString(){return`api: ${this.api}; code: ${this.code}; message: ${this.message}`}}class Yn extends Qn{constructor(e,t){super(e,t),this.message=`${t}. ${xn.READ_MORE}`,this.handler()}handler(){switch(this.code){case e.NativeCode.token_invalid:this.code=Ln,this.message=xn.LOGIN_REQUIRED;break;case e.NativeCode.not_permission:this.code=Un,this.message=xn.NOT_PERMISSION;break;case e.NativeCode.client_not_support:this.code=Wn,this.message=xn.CLIENT_NOT_SUPPORT;break;case e.NativeCode.decode_failed:this.message=xn.DECODE_FAILED}}}const Xn={handler:null,setHandler(e){this.handler=e}};Xn.setHandler(((e,t)=>t instanceof Qn?(t.api=e,t):new Qn(-2001,fn.isNull(t.message)?"Unknown Error":t.message,e)));const ei=(e,t,n)=>{const o=n.value;return n.value=function(...e){return i(this,void 0,void 0,(function*(){const{success:n,fail:r}=Array.isArray(e)&&e.length>0&&e[0];return new Promise(((a,s)=>i(this,void 0,void 0,(function*(){try{const t=yield o.apply(this,e);!fn.isNull(n)&&fn.isFunction(n)?n.call(null,t,this):a(t)}catch(e){if("login"!==(null==e?void 0:e.api)&&((null==e?void 0:e.code)===Ln||(null==e?void 0:e.code)===Un)){let t=!1;this instanceof Zo&&(t=this.getLoginStatus()),t||(e=new Qn(Ln,xn.LOGIN_REQUIRED))}const{handler:n}=Xn,i=n.call(null,t,e,this);window.zmpSentry&&window.zmpSentry.throwError(i.toString()),!fn.isNull(r)&&fn.isFunction(r)?r.call(null,i,this):s(i)}}))))}))},n},ti=(e,t,n)=>{const i=n.value;return n.value=function(...e){try{return i.apply(this,e)}catch(e){if("login"!==(null==e?void 0:e.api)&&((null==e?void 0:e.code)===Ln||(null==e?void 0:e.code)===Un)){let t=!1;this instanceof Zo&&(t=this.getLoginStatus()),t||(e=new Qn(Ln,xn.LOGIN_REQUIRED))}const{handler:n}=Xn,i=n.call(null,t,e,this);throw window.zmpSentry&&window.zmpSentry.throwError(i.toString()),i}},n},ni=(e,t)=>({code:Dn,message:t||xn.SUCCESS,data:e||{}}),ii={badRequest:e=>new Qn(jn,e),loginFailed:()=>new Qn(jn,xn.LOGIN_FAILED),loginRequired:()=>new Qn(Ln,xn.LOGIN_REQUIRED),missingParam:e=>new Qn(jn,`Missing required argument: ${e}`),wrongTypeParam:(e,t,n)=>new Qn(jn,`Wrong type of parameter '${e}'. Expected ${t}, but got ${n}`),cannotGetShareInfo:()=>new Qn(Mn,"Can not get app info to share"),lengthInvalid:e=>new Qn(jn,`${e} length is invalid.`)};const oi={encode:function(e){var t=[];for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];if(void 0===i)return;if(null===i)return void t.push(n);t.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}return t.join("&")},decode:function(e,t){var n={};if(""===e)return n;for(var i=e.split("&"),o=0;o<i.length;o++){var r=i[o].split("=",2),a=decodeURIComponent(r[0]);if(t&&Object.prototype.hasOwnProperty.call(n,a))throw new URIError("Duplicate key: "+a);n[a]=2===r.length?decodeURIComponent(r[1]):null}return n},appendToUrl:function(e,t){return e+(-1!==e.indexOf("?")?"&":"?")+("string"==typeof t?t:oi.encode(t))},getParameterByName:function(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");var n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return n?n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"":null},getParamsAsObject:function(e){var t={};return e?(e.split("&").map((function(e){var n=e.split("=");n&&2==n.length&&(t[n[0]]=decodeURIComponent(n[1].replace(/\+/g," ")))})),t):t},toQueryString:function(e){if(!e)return"";if("object"!=(void 0===e?"undefined":typeof e))return e;var t=Object.keys(e),n=[];return t.map((function(t){var i=e[t],o=[t,i="object"==(void 0===i?"undefined":typeof i)?JSON.stringify(i):encodeURIComponent(i)].join("=");n.push(o)})),n.join("&")}};var ri=oi;const ai=new RegExp("[\\u0300-\\u036f]","g"),si=new RegExp("[đ|Đ]","g"),ci=new RegExp("\\s","g"),li=mn("zmp:utils:common"),ui=e=>{try{new URL(e)}catch(e){return!1}return!0},di=()=>navigator.userAgent||navigator.vendor||window.opera,hi=()=>{const e=di().toLowerCase();return{isWP:/iemobile/.test(e),isAndroid:/android/i.test(e)&&!/iemobile/.test(e),isIOS:/iphone|ios|ipad|ipod/.test(e)&&!/iemobile/.test(e),isMobile:/android|iphone|ios|ipad|ipod|iemobile/.test(e),isZalo:/zalo/.test(e)}},pi=e=>{const t=document.getElementsByTagName("meta");for(let n=0;n<t.length;n++)if(t[n].getAttribute("name")===e||t[n].getAttribute("property")===e)return t[n].getAttribute("content");return""},vi=()=>{const e=di().toLowerCase().split("zalo")[1];if(e){return e.replace(" ","").split("/")[1]||""}return""},fi=()=>{let t=hi();return t.isWP?e.PlatformType.wp:t.isAndroid?e.PlatformType.android:t.isIOS?e.PlatformType.iOS:e.PlatformType.unknown},mi=(e,t)=>{const n=t.toLowerCase(),i=n.split(/[<>]/i),o="array"===i[0];return!!("url"===n&&ui(e)||o&&("array"===n&&Array.isArray(e)||((e,t)=>Array.isArray(t)&&!t.some((t=>"url"===e?!ui(t):typeof t!==e)))(i[1],e))||!Array.isArray(e)&&typeof e===t)},gi=e=>(e=>{let t=yn(e);return t||(t=_n(e),t)?t:gn(e)})(e),yi=e=>{if(fn.isObject(JSON)&&JSON.parse&&fn.isString(e)){const t=e.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");return JSON.parse(t,((e,t)=>t))}return fn.isObject(e)?e:new Function("return "+e)()},_i=e=>{if(fn.isObject(JSON)&&JSON.stringify)return JSON.stringify(e);if(void 0===e)return"undefined";if(null===e)return"null";try{if("string"==typeof e||null!==e.constructor.toString().match(/string/i))return'"'+e.replace(/"/g,'\\"')+'"'}catch(e){console.log(e)}var t;if(null!==Object.prototype.toString.call(e).match(/array/i)){t=new Array;for(var n=e.length,i=0;i<n;i++)t.push(_i(e[i]));return"["+t.join(",")+"]"}if("object"==typeof e){for(var o in t=new Array,e)t.push('"'+o+'":'+_i(e[o]));return"{"+t.join(",")+"}"}return e.toString()},Ei=()=>{try{const e=Number(vi()),t=fi();return e>=Fn[t]}catch(e){return!0}},Si=e=>JSON.stringify(e).replace(/"/g,'\\"').replace(/'/g,"'"),Ai=e=>{try{if(e){li(e);const t=e.replace(/\\/g,"").replace(/'/g,"'");return li("formattedValue",t,JSON.parse(t),typeof JSON.parse(t)),JSON.parse(t)}return null}catch(t){return li("parse json error:",t),e}},Oi=(e,t,n,o,r,a)=>i(void 0,void 0,void 0,(function*(){const i=new URL(location.href),s=new URLSearchParams;let c=`${i.pathname}${i.search}`;a&&(c=`/zapps/${e}${"/"===a[0]?"":"/"}${a}`);const l=new URL(`https://zalo.me/app/link${c}`);s.append("title",n),s.append("description",o||""),s.append("thumbnail",r),s.append("url",l.href),s.append("accessToken",t||"");const u=yield fetch("https://h5.zalo.me/openapi/create-sharelink",Object.assign({method:"POST",body:s},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})),d=yield u.json();if(!d||0!==d.err)throw ii.cannotGetShareInfo();return l.search=`${l.search}&zshareId=${d.data.shareId}`,Object.assign(Object.assign({},d.data),{shareableLink:l.href})})),Ti=(e,t)=>n=>{if(!(Array.isArray(e)?e.some((e=>mi(n,e))):mi(n,e)))return{error:!0,errorMessage:e};if(t){if(Array.isArray(null==t?void 0:t.values))return{error:!(null==t?void 0:t.values.includes(n)),errorMessage:null==t?void 0:t.values.toString()};if(fn.isNumber(null==t?void 0:t.maxLength))return{error:fn.isString(n)&&n.length>(null==t?void 0:t.maxLength),errorMessage:`data length must <= ${null==t?void 0:t.maxLength}`};if(fn.isNumber(null==t?void 0:t.min)&&fn.isNumber(null==t?void 0:t.max))return{error:n<(null==t?void 0:t.min)||n>(null==t?void 0:t.max),errorMessage:`data must be in between ${null==t?void 0:t.min} and ${null==t?void 0:t.max}`};if(fn.isNumber(null==t?void 0:t.min))return{error:n<(null==t?void 0:t.min),errorMessage:`data must >= ${null==t?void 0:t.min}`};if(fn.isNumber(null==t?void 0:t.max))return{error:n>(null==t?void 0:t.max),errorMessage:`data must <= ${null==t?void 0:t.max}`};if(fn.isRegExp(null==t?void 0:t.regex))return{error:!t.regex.test(n),errorMessage:"data must valid"}}return{error:!1}},bi=(e,t,n)=>i(void 0,void 0,void 0,(function*(){const i={appId:e,versionStatus:t};fn.isUndefined(n)||(i.currentVersion=n);const o=ri.appendToUrl(`https://h5.zalo.me/${zn}`,i),r=yield fetch(o,{credentials:"include"});if(r.ok){const e=yield r.json();if(e.err<0||!e.data)throw new Error(e);return{name:e.data.name,version:e.data.version,description:e.data.description,appUrl:e.data.appUrl,qrCodeUrl:e.data.qrCodeUrl,logoUrl:e.data.logoUrl}}throw new Error("Can't get app info")}));var wi=v((function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function r(e,t,i,r,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new o(i,r||e,a),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,i,o=[];if(0===this._eventsCount)return o;for(i in e=this._events)t.call(e,i)&&o.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},s.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var o=0,r=i.length,a=new Array(r);o<r;o++)a[o]=i[o].fn;return a},s.prototype.listenerCount=function(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},s.prototype.emit=function(e,t,i,o,r,a){var s=n?n+e:e;if(!this._events[s])return!1;var c,l,u=this._events[s],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,i),!0;case 4:return u.fn.call(u.context,t,i,o),!0;case 5:return u.fn.call(u.context,t,i,o,r),!0;case 6:return u.fn.call(u.context,t,i,o,r,a),!0}for(l=1,c=new Array(d-1);l<d;l++)c[l-1]=arguments[l];u.fn.apply(u.context,c)}else{var h,p=u.length;for(l=0;l<p;l++)switch(u[l].once&&this.removeListener(e,u[l].fn,void 0,!0),d){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,t);break;case 3:u[l].fn.call(u[l].context,t,i);break;case 4:u[l].fn.call(u[l].context,t,i,o);break;default:if(!c)for(h=1,c=new Array(d-1);h<d;h++)c[h-1]=arguments[h];u[l].fn.apply(u[l].context,c)}}return!0},s.prototype.on=function(e,t,n){return r(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return r(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,i,o){var r=n?n+e:e;if(!this._events[r])return this;if(!t)return a(this,r),this;var s=this._events[r];if(s.fn)s.fn!==t||o&&!s.once||i&&s.context!==i||a(this,r);else{for(var c=0,l=[],u=s.length;c<u;c++)(s[c].fn!==t||o&&!s[c].once||i&&s[c].context!==i)&&l.push(s[c]);l.length?this._events[r]=1===l.length?l[0]:l:a(this,r)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new i,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s}));class Ni extends wi{constructor(){super(),this.debug=mn("zmp:event-emitter")}static getInstance(){return Ni.instance||(Ni.instance=new Ni),Ni.instance}h5ConfirmHandleEvent(e,t,n){ZaloJavaScriptInterface.jsH5EventCallback(e,t,n||"")}on(e,t,n){this.debug(`register ${e}: ${n}`);return super.on(e,((i,o)=>{this.h5ConfirmHandleEvent(i,e,n),t(o)}),n)}once(e,t,n){this.debug(`register once ${e}: ${n}`);return super.once(e,((i,o)=>{this.h5ConfirmHandleEvent(i,e,n),t(o)}),n)}}var Pi={},Ii=function(e,t,n){var i=t||"default";return function(){var t=i in Pi?Pi[i](e,n):e;return t.apply(this,arguments)}};Ii.setWrapper=function(e){var t=arguments.length<=1||void 0===arguments[1]?"default":arguments[1];Pi[t]=e};var Ci={error:{code:1,error_subcode:1357046,message:"Received Invalid JSON reply.",type:"http"}};function ki(e){try{return null===e?Ci:JSON.parse(e)}catch(e){return Ci}}var Ri,Bi={execute:function(e,t,n,i){n.suppress_http_code=1;var o=ri.encode(n);"post"!=t&&(e=ri.appendToUrl(e,o),o="");var r=function(e,t){if(!self.XMLHttpRequest)return null;var n=new XMLHttpRequest,i=function(){};if(!("withCredentials"in n))return null;n.open(e,t,!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded");var o={send:function(e){n.send(e)}},r=Ii((function(){r=i,"onload"in o&&o.onload(n)}),"entry","XMLHttpRequest:load"),a=Ii((function(){a=i,"onerror"in o&&o.onerror(n)}),"entry","XMLHttpRequest:error");return n.onload=function(){r()},n.onerror=function(){a()},n.onreadystatechange=function(){4==n.readyState&&(200==n.status?r():a())},o}(t,e);return!!r&&(r.onload=function(e){i(ki(e.responseText))},r.onerror=function(e){e.responseText?i(ki(e.responseText)):i({error:{code:1,error_subcode:1357045,message:"unknown error (empty response)",status:e.status,type:"http"}})},r.send(o),!0)}};class Di extends wi{constructor(){super(),this.debug=mn("zmp:ZaloJSBridge"),this.events=Ni.getInstance(),this._accessTk=gi("zacc_session")||"DEFAULT_ACCESS_TOKEN",this._jsAccessTk=gi("zlink3rd")||"DEFAULT_JS_TOKEN",this.results=[],this._userAgent=di(),this._device=hi(),this._jsCallFuncCallbacks={},this.events.on(e.Events.AppPaused,(()=>{if(this.results.length>0){let e=this.results;this.results=[];try{this.sendLogData(e)}catch(e){}}})),this.sendLogTimer?clearInterval(this.sendLogTimer):this.sendLogTimer=setInterval((()=>{if(this.results.length>0){let e=this.results;this.results=[];try{this.sendLogData(e)}catch(e){}}}),5e3)}static getInstance(){return Di.instance||(Di.instance=new Di),Di.instance}set accessTk(e){this._accessTk=e}set jsAccessTk(e){this._jsAccessTk=e}sendLogData(e){try{Bi.execute("https://h5.zalo.me/log/async","post",{appId:window.APP_ID,data:JSON.stringify(e)},(e=>{}))}catch(e){}}onJSCall(e,t){try{this.debug("onJSCall",e,t);const n=yi(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,i=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,n)}catch(e){console.error("Call callback error",e)}i&&clearTimeout(i),this._jsCallFuncCallbacks[e]=null,delete this._jsCallFuncCallbacks[e]}}this.results.push({action:n.action,error:n.error_code})}catch(e){console.log("onJSCall","error",e)}}onMultiJSCall(e,t){try{this.debug("onMultiJSCall",e,t);const n=yi(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,i=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,n)}catch(e){console.error("Call callback error",e)}i&&clearTimeout(i)}}this.results.push({action:n.action,error:n.error_code})}catch(e){console.log("onMultiJSCall","error",e)}}nativeEventHandler(e,t,n){this.debug(`eventId: ${e}, eventName: ${t}, eventData: ${n}`);const i=Ai(n);this.debug(i);const o=this.handleEventData(t,i);this.events.emit(t,e,o)}handleEventData(t,n){try{switch(t){case e.Events.OpenApp:const{url:t}=n,i=new URL(t),o=i.pathname.split(`/zapps/${An}`)[1];return{path:`${o||"/"}${i.search}`};default:return n}}catch(e){return n}}defaultCallback(e){null!=e&&(e=yi(e))}jsCall(e,t,n,i=!1,o=3,r=!0){try{const a=e.name,s=((e="")=>`${e.normalize("NFD").replace(ai,"").replace(si,"d").replace(ci,"").toLowerCase()}_${Math.random().toString(36).substr(2,4)}`)(a);if(!this._device.isMobile||fn.isEmpty(a))return this.onJSCall(s,{error_code:-13,error_message:"params invalid!",data:{device:this._device.isMobile,jsToken:this._jsAccessTk,access_token:this._accessTk},action:a}),!1;null==t&&(t={}),n||(n=this.defaultCallback);const c={error_code:-14,error_message:"Request Timeout!",data:{},action:a};this._jsCallFuncCallbacks[s]={timeout:r&&e.have_callback&&setTimeout((()=>{this.onJSCall(s,c)}),8e3),callback:n};try{return t=_i(t),i?this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,window.onMultiJSCall(s)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,`window.onMultiJSCall('${s}')`):this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,window.onJSCall(s)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,`window.onJSCall('${s}')`)}catch(r){if(!(o-- >0)){const e={error_code:-5,error_message:"Not ready!",data:{userAgent:this._userAgent,options:t,jsToken:this._jsAccessTk,access_token:this._accessTk},action:a,js_error:r};return this.onJSCall(s,e),!1}setTimeout((()=>{this.jsCall(e,t,n,i,o)}),500)}}catch(e){console.log("jsCall","error",e)}return!1}}class ji{constructor(){this.debug=mn("zmp:ZJSBridgeProvider"),Ri.set(this,void 0),r(this,Ri,Di.getInstance(),"f")}setZAccSession(e){o(this,Ri,"f").accessTk=e}setJSToken(e){o(this,Ri,"f").jsAccessTk=e}callNative(e,t,n){return this.debug(e.name,t),new Promise(((r,a)=>{const s=o=>i(this,void 0,void 0,(function*(){try{const i=new Yn(o.error_code,`${o.action}: ${o.error_message}`);if(null==n?void 0:n.callback){const e=yield n.callback(o,i);return r(e)}if(o&&o.error_code>=0)r(o.data||{});else if(o&&o.error_code<0){try{window.zmpSentry&&window.zmpSentry.captureMessage(`${e.name}: call native fail`,{extra:{data:t,rs:o}})}catch(e){}return a(i)}}catch(e){return a(e)}})),c=hi().isIOS,l=(e=>{var t;const n=vi(),i=(null===(t=null==e?void 0:e.version_live)||void 0===t?void 0:t.iOS)||0;return!!(Array.isArray(window.ignoreCheckSupport)&&window.ignoreCheckSupport.length>0&&window.ignoreCheckSupport.includes(e.name))||n>=i})(e);if(c&&!l){const t=new Yn(-5,`${e}: Client isn't support this action`);return a(t)}(null==n?void 0:n.delay)?setTimeout((()=>{o(this,Ri,"f").jsCall(e,t,s,null==n?void 0:n.isMultiCallback,null==n?void 0:n.nRetry,null==n?void 0:n.haveTimeout)}),n.delay):o(this,Ri,"f").jsCall(e,t,s,null==n?void 0:n.isMultiCallback,null==n?void 0:n.nRetry,null==n?void 0:n.haveTimeout)}))}}Ri=new WeakMap;var Mi,Li,Ui,Wi,xi,zi="2.19.0-rc.5";class Fi{static getVersion(){return zi}static getSystemInfo(){return{version:pi("version-id")||"",apiVersion:zi,zaloVersion:vi(),platform:fi(),language:navigator.language,zaloLanguage:window.zLanguage||"vi",zaloTheme:window.zTheme||"light"}}static getAppInfo(){return i(this,void 0,void 0,(function*(){const e=this.getAppId(),t=this.getSystemInfo();return yield bi(e,0,t.version)}))}}class Gi{static setNavigationBarTitle(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.CHANGE_TITLE_HEADER,{title:e.title},{haveTimeout:!1})}))}static setNavigationBarColor(e){return i(this,void 0,void 0,(function*(){const t={};let n;fn.isEmpty(e.textColor)||(t.textColor=e.textColor),fn.isString(e.color)&&e.color.length>0?(fn.isEmpty(e.color)||(t.backgroundColor=e.color),n=5):(fn.isEmpty(e.statusBarColor)||(t.backgroundColor=e.statusBarColor),n=6),this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{actionbarType:n,dataConfig:Object.assign(Object.assign({},e.dataConfig),t)}))),yield this.callNative(Bn.CHANGE_ACTIONBAR,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarLeftButton(e){return i(this,void 0,void 0,(function*(){const t="none"===e.type||"home"===e.type?$n:Hn,n="home"===e.type||"both"===e.type?Vn:Zn;this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{buttonType:t,dataConfig:Object.assign(Object.assign({},e.dataConfig),{viewInLeftType:t}),homeConfig:Object.assign(Object.assign({},e.homeConfig),{enable:n})}))),yield this.callNative(Bn.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarRightButton(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.CREATE_OPTIONS_MENU,{supportToolBar:e.supportToolBar,reset:e.reset,menuListItems:e.menuListItems,zapp:this.getAppId()})}))}}class Hi{static setBackgroundColor(e){return i(this,void 0,void 0,(function*(){fn.isString(e.backgroundColor)&&e.backgroundColor.length>0&&(yield this.callNative(Bn.CHANGE_ACTIONBAR,{actionbarType:this.isShowNavBar?5:6,dataConfig:{backgroundColor:e.backgroundColor,textColor:e.textColor}}))}))}}class $i{constructor(e,t,n,i){this.title=i,this.severity=t;const o=new Date;if(this.time=o.toLocaleTimeString(),this.content=e,n>0){const e=(new Error).stack;this.stack=e?e.replace("Error\n",""):""}}toString(){return(this.content.stack?[this.title,this.severity.toUpperCase(),this.time,this.content,this.content.stack.replace("Error:","")]:[this.title,this.severity.toUpperCase(),this.time,JSON.stringify(this.content),this.stack]).join(" ")}}Mi=new WeakMap,Li=new WeakMap,Ui=new WeakMap,Wi=new WeakMap,xi=new WeakMap;var Vi,Zi,Ji,Ki,qi,Qi,Yi,Xi,eo,to,no,io,oo,ro,ao,so,co,lo,uo,ho,po,vo,fo,mo,go,yo,_o,Eo,So=new class{constructor(){Mi.set(this,3),Li.set(this,["none","error","warn","info"]),Ui.set(this,"[zmp] > "),Wi.set(this,{error:0,warn:0,info:0,firstError:null,lastError:null}),xi.set(this,((e,t,n)=>{o(this,Wi,"f")[o(this,Li,"f")[e]]++;const i=o(this,Li,"f")[e];if(r(this,Ui,o(this,Ui,"f")+("string"!=typeof t?new $i(t,i,e,n).toString():t),"f"),!(e>o(this,Mi,"f")))switch(e){case 1:console.error(o(this,Ui,"f"));break;case 2:console.warn(o(this,Ui,"f"));break;case 3:console.info(o(this,Ui,"f"));break;default:throw new Error("internal")}}))}setLogLevel(e){r(this,Mi,e,"f")}info(e){o(this,xi,"f").call(this,3,e)}warn(e,t){o(this,xi,"f").call(this,2,e,t)}error(e,t){o(this,xi,"f").call(this,1,e,t)}getMetrics(){return o(this,Wi,"f")}};class Ao{static setDeviceOrientation(t){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.CHANGE_AUTOROTATE,{autoRotate:e.OrientationType[t.rotate]})}))}static getNetworkType(t){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.WEBVIEW_NETWORKTYPE,{url:window.location.href,featureId:""}).then((t=>{const n=t.network;let i;const o=hi().isAndroid;switch(n){case Rn(o).NONE:i=e.NetworkType.none;break;case Rn(o).WIFI:i=e.NetworkType.wifi;break;case Rn(o)["2G"]:case Rn(o)["3G"]:case Rn(o)["4G"]:i=e.NetworkType.cellular;break;default:i=e.NetworkType.unknown}return{networkType:i}}))}))}static onNetworkStatusChange(t){return i(this,void 0,void 0,(function*(){yield this.events.on(e.Events.NetworkChanged,(e=>{const n=e&&e.state;this.getNetworkType().then((e=>{const i={isConnected:"CONNECTED"===n,networkType:e&&e.networkType};t(i)})).catch((e=>{So.error(e,"onNetworkStatusChange")}))}))}))}static startBeaconDiscovery(e){var t,n,o,r,a;return i(this,void 0,void 0,(function*(){const i={subaction:0,scanning_type:fn.isNumber(null==e?void 0:e.scanningType)?e.scanningType:0,data:{scan_from_source:fn.isString(null==e?void 0:e.scanFromSource)?e.scanFromSource:"",expire:fn.isNumber(null==e?void 0:e.expire)?e.expire:3e3,monitor_interval:fn.isNumber(null==e?void 0:e.monitorInterval)?e.monitorInterval:60,domain:fn.isString(null==e?void 0:e.domain)?e.domain:"",scan_config:{scan_time:fn.isNumber(null===(t=null==e?void 0:e.scanConfig)||void 0===t?void 0:t.scanTime)?e.scanConfig.scanTime:15e3,time_between_scan:fn.isNumber(null===(n=null==e?void 0:e.scanConfig)||void 0===n?void 0:n.timeBetweenScan)?e.scanConfig.timeBetweenScan:1e4,beacon_timeout:fn.isNumber(null===(o=null==e?void 0:e.scanConfig)||void 0===o?void 0:o.beaconTimeout)?e.scanConfig.beaconTimeout:3e4,delayCheckConnectedTimeout:fn.isNumber(null===(r=null==e?void 0:e.scanConfig)||void 0===r?void 0:r.delayCheckConnectedTimeout)?e.scanConfig.delayCheckConnectedTimeout:5e3,beaconConnectedTimeout:fn.isNumber(null===(a=null==e?void 0:e.scanConfig)||void 0===a?void 0:a.beaconConnectedTimeout)?e.scanConfig.beaconConnectedTimeout:6e5},items:Array.isArray(null==e?void 0:e.items)?null==e?void 0:e.items:[]}};return yield this.callNative(Bn.SCAN_IBEACON,Object.assign({},i)),!0}))}static stopBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.SCAN_IBEACON,Object.assign({},{subaction:2})),!0}))}static getBeacons(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.SCAN_IBEACON,Object.assign({},{subaction:1}),{isMultiCallback:!0}).then((e=>{const t={beacons:[]};return Array.isArray(e)&&e.forEach((e=>{const n={uuid:e.uuid,major:e.major,minor:e.minor,distance:e.distance,rssi:e.rssi};t.beacons.push(n)})),t}))}))}static stopBluetoothDevicesDiscovery(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static startBluetoothDevicesDiscovery(e){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},Object.assign({},e))}))}static openBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static onBluetoothDeviceFound(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static onBluetoothAdapterStateChange(){return i(this,void 0,void 0,(function*(){return Promise.resolve()}))}static getConnectedBluetoothDevices(e){return i(this,void 0,void 0,(function*(){const t={services:e.services||[]};return this.callNative({name:""},t)}))}static getBluetoothDevices(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static getBluetoothAdapterState(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static closeBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static scanQRCode(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.OPEN_QR,{skipOpenLink:!0})}))}static showToast(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.SHOW_TOAST,{toast:e.message})}))}static hideKeyboard(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.HIDE_KEYBOARD,{})}))}static openPhone(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.OPEN_PHONE,{phoneNum:e.phoneNumber,phoneCode:e.phoneNumber})}))}static openSMS(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.OPEN_SMS,{content:e.content,phoneCode:e.phoneNumber})}))}static keepScreen(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.KEEP_SCREEN,{data:{keep_screen_on:e.keepScreenOn?1:0}})}))}static openBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.PROMPT_AUTHENTICATION,{secret_data:e.secretData,app_id:this.getZAppId(),ui:{title:e.ui.title,sub_title:e.ui.subTitle,negative_text:e.ui.negativeButtonText},require_fingerprint:e.requireFingerprint?1:0}).then((e=>{var t,n,i,o;return{code:null==e?void 0:e.error_code,message:null==e?void 0:e.error_message,data:{domain:null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.domain,code:null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.error_code,message:null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.error_message,payToken:null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.pay_token}}}))}))}static checkStateBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.PROMPT_AUTHENTICATION_CHECK_STATE,{}).then((e=>({bioState:null==e?void 0:e.bio_state})))}))}static vibrate(t){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.INTERACTIVE_VIBRATION,{type:e.VibrateType[t.type],vibrate_time:t.milliseconds})}))}static connectWifi(e){return i(this,void 0,void 0,(function*(){let t="open";return fn.isString(e.password)&&e.password.length>0&&(t="wpa_wpa2"),yield this.callNative(Bn.MP_JOIN_WIFI,{ssid:e.SSID,securityType:t,password:e.password,hiddenSsid:e.hiddenSSID})}))}}class Oo{constructor(e){Vi.set(this,localStorage),Zi.set(this,void 0),Ji.set(this,void 0),hi(),r(this,Ji,{keys:new Set,currentSize:0,limitSize:kn},"f"),r(this,Zi,e,"f"),this.findAllCurrentDataByApp(e)}findAllCurrentDataByApp(e){try{let t;for(t in o(this,Vi,"f")){if(e){if(t.split("_")[0]!==e)continue}o(this,Ji,"f").keys.add(t)}}catch(e){So.error(e,"LocalResourceStorage > findAllCurrentDataByApp")}}get(e){let t=new Map;return e.forEach((e=>{t.set(e,this.getSync(e))})),Promise.resolve(t)}getSync(e){return o(this,Zi,"f")&&(e=`${o(this,Zi,"f")}_${e}`),o(this,Ji,"f").keys.has(e)?o(this,Vi,"f").getItem(e):null}set(e){return i(this,void 0,void 0,(function*(){return Object.entries(e).forEach((([e,t])=>{this.setSync(e,t.replace(/\\"/g,'"'))})),Promise.resolve({errorKeys:[]})}))}setSync(e,t){o(this,Zi,"f")&&(e=`${o(this,Zi,"f")}_${e}`),o(this,Vi,"f").setItem(e,t),o(this,Ji,"f").keys.add(e)}getInfo(){return i(this,void 0,void 0,(function*(){return Promise.resolve(this.getInfoSync())}))}getInfoSync(){const e=((e,t)=>{let n,i,o=0;for(i in e){const r=i.split("_")[0];e.hasOwnProperty(i)&&(t&&r!==t||(n=2*(e[i].length+i.length),o+=n))}return o})(o(this,Vi,"f"),o(this,Zi,"f"));return{currentSize:fn.isNumber(e)?Number((e/1024).toFixed(2)):0,limitSize:Number(5120..toFixed(2))}}remove(e){return i(this,void 0,void 0,(function*(){return e.forEach((e=>{this.removeSync(e)})),Promise.resolve({errorKeys:[]})}))}removeSync(e){o(this,Zi,"f")&&(e=`${o(this,Zi,"f")}_${e}`),o(this,Ji,"f").keys.has(e)&&(o(this,Vi,"f").removeItem(e),o(this,Ji,"f").keys.delete(e))}clear(){return i(this,void 0,void 0,(function*(){return Promise.resolve(this.clearSync())}))}clearSync(){o(this,Ji,"f").keys.forEach((e=>{o(this,Zi,"f")&&e.indexOf(o(this,Zi,"f"))<0||(o(this,Vi,"f").removeItem(e),o(this,Ji,"f").keys.delete(e))}))}}Vi=new WeakMap,Zi=new WeakMap,Ji=new WeakMap;class To extends ji{constructor(e){super(),Ki.set(this,void 0),qi.set(this,void 0),r(this,qi,{keys:new Set,currentSize:0,limitSize:kn},"f"),r(this,Ki,e,"f")}get(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.ZBROWSER_MPDS,{mpds_action:"mpds.get",mpds_data:{keys:e},appId:o(this,Ki,"f")},{isMultiCallback:!1}).then((e=>{let t=new Map;return e&&e.mpds_data&&e.mpds_data.map&&(t=new Map(Object.entries(e.mpds_data.map))),t}))}))}set(e){return i(this,void 0,void 0,(function*(){return{errorKeys:yield this.callNative(Bn.ZBROWSER_MPDS,{mpds_action:"mpds.set",mpds_data:{map:e},appId:o(this,Ki,"f")},{isMultiCallback:!1}).then((e=>{let t=[];return e&&e.mpds_data&&e.mpds_data.error_keys&&(t=e.mpds_data.error_keys),t}))}}))}getInfo(){return i(this,void 0,void 0,(function*(){const e=yield this.callNative(Bn.ZBROWSER_MPDS,{mpds_action:"mpds.get.size",mpds_data:{},appId:o(this,Ki,"f")},{isMultiCallback:!1}).then((e=>{let t=0;return e&&e.mpds_data&&e.mpds_data.size&&(t=e.mpds_data.size),t}));return{currentSize:fn.isNumber(e)?Number(e/1024):0,limitSize:Number(5120)}}))}remove(e){return i(this,void 0,void 0,(function*(){return{errorKeys:yield this.callNative(Bn.ZBROWSER_MPDS,{mpds_action:"mpds.remove.key",mpds_data:{keys:e},appId:o(this,Ki,"f")},{isMultiCallback:!1}).then((e=>{let t=[];return e&&e.mpds_data&&e.mpds_data.error_keys&&(t=e.mpds_data.error_keys),t}))}}))}clear(){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.ZBROWSER_MPDS,{mpds_action:"mpds.clear.appData",mpds_data:{},appId:o(this,Ki,"f")})}))}}Ki=new WeakMap,qi=new WeakMap;class bo{getDataFromStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance(),n=yield t.get(e),i={};return n.forEach(((e,t)=>{i[t]=Ai(e)})),i}))}putDataToStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance(),n={};return Object.entries(e).forEach((([e,t])=>{fn.isUndefined(t)||fn.isNull(t)||(n[e]=Si(t))})),yield t.set(n)}))}removeDataFromStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance();return yield t.remove(e)}))}clearStorage(){return i(this,void 0,void 0,(function*(){const e=this.getInstance();yield e.clear()}))}getStorageInfo(){return i(this,void 0,void 0,(function*(){const e=this.getInstance();return yield e.getInfo()}))}}class wo extends bo{constructor(e){super(),Qi.set(this,void 0),r(this,Qi,e,"f")}getInstance(){return new Oo(o(this,Qi,"f"))}}Qi=new WeakMap;class No extends bo{constructor(e){super(),Yi.set(this,void 0),r(this,Yi,e,"f")}getInstance(){return new To(o(this,Yi,"f"))}}Yi=new WeakMap;class Po{static setStorage(e){return i(this,void 0,void 0,(function*(){let t=new wo(this.getAppId());return Ei()&&(t=new No(this.getAppId())),yield t.putDataToStorage(e.data)}))}static getStorage(e){return i(this,void 0,void 0,(function*(){let t=new wo(this.getAppId());Ei()&&(t=new No(this.getAppId()));return yield t.getDataFromStorage(e.keys)}))}static getStorageInfo(e){return i(this,void 0,void 0,(function*(){let e=new wo(this.getAppId());return Ei()&&(e=new No(this.getAppId())),yield e.getStorageInfo()}))}static removeStorage(e){return i(this,void 0,void 0,(function*(){let t=new wo(this.getAppId());return Ei()&&(t=new No(this.getAppId())),yield t.removeDataFromStorage(e.keys)}))}static clearStorage(e={}){return i(this,void 0,void 0,(function*(){let e=new wo(this.getAppId());Ei()&&(e=new No(this.getAppId())),yield e.clearStorage()}))}}class Io{static getUserInfo(e){return i(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();let n="id,name,picture";(null==e?void 0:e.avatarType)&&(n=`${n}.type(${null==e?void 0:e.avatarType})`);return{userInfo:yield fetch(`${Nn}?fields=${n}`,{headers:{access_token:t||""}}).then((e=>i(this,void 0,void 0,(function*(){const t=yield e.json(),n={id:t.id,name:t.name,birthday:"",gender:"",avatar:t.picture&&t.picture.data&&t.picture.data.url};return console.warn("'birthday' and 'gender' are deprecated"),n}))))}}))}static getPhoneNumber(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.MP_GET_NUMBER,{},{isMultiCallback:!0,callback:(e,t)=>{if(0===e.error_code){const t={number:e.data};return Promise.resolve(t)}return Promise.reject(t)},delay:this.isIOS?400:0})}))}}class Co{static closeApp(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.WINDOW_CLOSE,{})}))}static openMiniApp(e){return i(this,void 0,void 0,(function*(){const t=null==e?void 0:e.appId,n=(null==e?void 0:e.params)||{},i=Object.entries(n).map((function([e,t]){return[e,t].join("=")})).join("&");let o;try{o=yield bi(t,0)}catch(e){}const r={appId:t};o&&(r.appName=o.name,r.appAvtUrl=o.logoUrl),yield this.callNative(Bn.OPEN_MP,{mpUrl:`https://h5.zdn.vn/zapps/${t}/${i.length>0?"?"+i:""}`,mpInfo:r})}))}static openWebview(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.OPEN_INAPP,{url:e.url})}))}static closeLoading(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.MP_CLOSE_LOADINGVIEW,{at:(new Date).getTime(),when:e,url:location.href})}))}}class ko{static getLocation(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.GET_LOCATION,{silent_request:!1,permission_description:"Cho phép Zalo truy cập vào vị trí của thiết bị này?"},{isMultiCallback:!0,haveTimeout:!1,callback:(e,t)=>{if(0===e.error_code){const t=e.data,n={latitude:t.latitude,longitude:t.longitude,timestamp:t.timestamp,provider:t.provider};return Promise.resolve(n)}return Promise.reject(t)},delay:this.isIOS?400:0})}))}static sendLocation(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.QUERY_LOCATION_HIDE,{title:e.title,touserid:e.toUserId,zapp:this.getZAppId()})}))}}class Ro{static requestCameraPermission(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.REQUEST_PERMISSION_CAMERA,{},{callback:(e,t)=>-2===e.error_code||e.error_code>=0?Promise.resolve({userAllow:-2!==e.error_code,message:e.error_message}):Promise.reject(t)})}))}static saveImageToPhotosAlbum(e){return i(this,void 0,void 0,(function*(){let t={};return fn.isEmpty(e.imageBase64Data)?fn.isEmpty(e.imageUrl)||(t={imageUrl:e.imageUrl}):t={imageBase64Data:e.imageBase64Data},yield this.callNative(Bn.SAVE_IMAGE_GALLERY,Object.assign({},t))}))}}class Bo{static viewOAQr(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.VIEW_MYQR,{dpn:e.displayName,uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openProfile(t){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.OPEN_PROFILE,{uId:t.id,type:e.ProfileType[t.type],zapp:this.getZAppId(),sourceId:t.sourceId,sourceIndex:t.sourceIndex})}))}static openChat(t){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.OPEN_CHAT,{uId:t.id,type:e.ChatType[t.type],zapp:this.getZAppId(),sourceId:t.sourceId,sourceIndex:t.sourceIndex})}))}static openPostFeed(t){return i(this,void 0,void 0,(function*(){let n={};switch(t.type){case"image":n={photoUrl:t.data.imageUrl};break;case"link":n={link:t.data.link,title:t.data.title,thumb:t.data.thumb,description:t.data.description};break;case"profile":n={avt:t.data.avatar,uid:t.data.id,dpn:t.data.displayName}}return yield this.callNative(Bn.OPEN_POSTFEED,Object.assign(Object.assign({type:e.PostFeedType[t.type]},n),{zapp:this.getZAppId()})).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static followOA(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.FOLLOW_OA,{uid:e.id,showDialogConfirm:!0,zapp:this.getZAppId()},{haveTimeout:!1})}))}static unfollowOA(e){return i(this,void 0,void 0,(function*(){yield this.callNative(Bn.UNFOLLOW_OA,{uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openShareSheet(t){return i(this,void 0,void 0,(function*(){let n={};switch(t.type){case"image":let e=[];Array.isArray(t.data.imageUrls)&&t.data.imageUrls.length>0?e=t.data.imageUrls:e.push(t.data.imageUrl),n={photoUrls:e,photoUrl:t.data.imageUrl,caption:t.data.caption};break;case"gif":n={photoUrl:t.data.imageUrl,gifUrl:t.data.gifUrl,width:t.data.width,height:t.data.height};break;case"video":n={videoThumb:t.data.videoThumb,videoUrl:t.data.videoUrl,width:t.data.width,height:t.data.height};break;case"link":n={link:t.data.link,chatOnly:t.data.chatOnly?1:0};break;case"oa":n={uid:t.data.id};break;case"zmp":const i=yield this.getAccessToken(),o=yield Oi(this.getAppId(),i||"",t.data.title||"",t.data.description||"",t.data.thumbnail||"",t.data.path);window.forceShareZMP?n={data:{ZInstantAPIInfo:{url:`${o.zinstantApi}`,zinstantdata_id:`templateId=${o.ztemplateId}&appId=${this.getAppId()}&shareId=${o.shareId}`},previewMsgText:{msg:{en:"Zalo Mini Program",vi:"Chương trình nhỏ"}},enableReactions:1}}:(n={link:o.shareableLink,chatOnly:t.data.chatOnly?1:0},t.type="link")}return yield this.callNative(Bn.OPEN_SHARESHEET,Object.assign(Object.assign({type:e.ShareSheetType[t.type]},n),{zapp:this.getZAppId()}),{haveTimeout:!1}).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static createShortcut(e,t,n){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.CREATE_SHORTCUT,{url:e,title:t,iconUrl:n})}))}static openProfilePicker(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.MP_OPEN_PROFILE_PICKER,{maxProfile:e},{isMultiCallback:!0,callback:(e,t)=>0===e.error_code&&Array.isArray(e.data)?Promise.resolve(e.data.map((e=>e.id))):Promise.reject(t)})}))}static getActionsSupported(t){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.GET_SUPPORTED_ACTIONS,{},{isMultiCallback:!1,callback:(t,n)=>{const i=fi();if(Array.isArray(t.actions)&&t.actions.length>0){const e=Object.keys(Bn).filter((e=>Bn[e].skip_jump)),n={actions:[...t.actions,...e]};return Promise.resolve(n)}if(i===e.PlatformType.iOS){const e={actions:Gn};return Promise.resolve(e)}return Promise.reject(n)}})}))}static openMediaPicker(t,n,o,r){return i(this,void 0,void 0,(function*(){const i={type:0,url:"https://zapi-server.tungnt.xyz/upload/photos",maxSize:1048576};return yield this.callNative(Bn.PICK_MEDIA,{media_type:e.MediaPickerType[t],edit_view:Object.assign(Object.assign({},{enable:1,aspect_ratio:"1:1"}),n),silent_request:o,upload:i,max_select_item:r},{isMultiCallback:!0,callback:(e,t)=>{var n,i;if(0===e.error_code){const t=Ai(null===(n=e.data)||void 0===n?void 0:n.result_content),o={urls:null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.urls};return Promise.resolve(o)}return Promise.reject(t)}})}))}static openOutApp(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.OPEN_OUTAPP,{url:e})}))}}class Do{static getRouteParams(){let e={};const t=window.location.href;try{let n=new URL(t).searchParams.toString();n&&(e=ri.getParamsAsObject(n))}catch(e){throw new Error("Url không hợp lệ")}return e}static sendDataToPreviousMiniApp(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(Bn.WEBVIEW_SET_RESULT,{result:Si(e.data)})}))}static onCallbackData(t){return i(this,void 0,void 0,(function*(){yield this.events.on(e.Events.OnDataCallback,(e=>{t({data:e})}))}))}}class jo extends ji{constructor(){var e,t,n,i,a,s,c,l,u,d,h,p,v,f,m,g,y;super(),Xi.set(this,Sn),eo.set(this,An),to.set(this,On),no.set(this,void 0),io.set(this,void 0),oo.set(this,void 0),ro.set(this,null),ao.set(this,{timer:{getToken:0}}),so.set(this,void 0),co.set(this,void 0),lo.set(this,null),this.events=Ni.getInstance(),this.isIOS=hi().isIOS,uo.set(this,void 0),this.getActionBarConfig=()=>o(this,uo,"f"),this.setActionBarConfig=e=>{r(this,uo,e(o(this,uo,"f")),"f")},ho.set(this,(()=>new Promise(((e,t)=>{fn.isUndefined(o(this,lo,"f"))||fn.isNull(o(this,lo,"f"))?this.callNative(Bn.JUMP_LOGIN,{}).then((t=>{const n=t&&t.cookiesOAuthLogins||[],i=n.find((e=>e.name===bn));i&&(this.setJSToken(i.value),window.ZJSBridge.setJSToken&&window.ZJSBridge.setJSToken(i.value)),r(this,lo,n,"f"),e(n)})).catch((e=>{t(e)})):e(o(this,lo,"f"))})))),po.set(this,Gi.setNavigationBarRightButton),this.getVersion=Fi.getVersion,this.getSystemInfo=Fi.getSystemInfo,this.setNavigationBarTitle=Gi.setNavigationBarTitle,this.setNavigationBarColor=Gi.setNavigationBarColor,this.setNavigationBarLeftButton=Gi.setNavigationBarLeftButton,this.setBackgroundColor=Hi.setBackgroundColor,this.setDeviceOrientation=Ao.setDeviceOrientation,this.setStorage=Po.setStorage,this.getStorage=Po.getStorage,this.getStorageInfo=Po.getStorageInfo,this.removeStorage=Po.removeStorage,this.clearStorage=Po.clearStorage,this.getUserInfo=Io.getUserInfo,this.getNetworkType=Ao.getNetworkType,this.onNetworkStatusChange=Ao.onNetworkStatusChange,this.startBeaconDiscovery=Ao.startBeaconDiscovery,this.stopBeaconDiscovery=Ao.stopBeaconDiscovery,this.getBeacons=Ao.getBeacons,this.closeApp=Co.closeApp,this.getLocation=ko.getLocation,this.stopBluetoothDevicesDiscovery=Ao.stopBluetoothDevicesDiscovery,this.startBluetoothDevicesDiscovery=Ao.stopBluetoothDevicesDiscovery,this.openBluetoothAdapter=Ao.openBluetoothAdapter,this.onBluetoothDeviceFound=Ao.onBluetoothDeviceFound,this.onBluetoothAdapterStateChange=Ao.onBluetoothAdapterStateChange,this.getConnectedBluetoothDevices=Ao.getConnectedBluetoothDevices,this.getBluetoothDevices=Ao.getBluetoothDevices,this.getBluetoothAdapterState=Ao.getBluetoothAdapterState,this.closeBluetoothAdapter=Ao.closeBluetoothAdapter,this.scanQRCode=Ao.scanQRCode,this.openProfile=Bo.openProfile,this.openChat=Bo.openChat,this.openPostFeed=Bo.openPostFeed,this.followOA=Bo.followOA,this.unFollowOA=Bo.unfollowOA,this.openShareSheet=Bo.openShareSheet,this.requestCameraPermission=Ro.requestCameraPermission,this.createShortcut=Bo.createShortcut,this.openBioAuthentication=Ao.openBioAuthentication,this.checkStateBioAuthentication=Ao.checkStateBioAuthentication,this.sendLocation=ko.sendLocation,this.showToast=Ao.showToast,this.hideKeyboard=Ao.hideKeyboard,this.openPhone=Ao.openPhone,this.openSMS=Ao.openSMS,this.viewOAQr=Bo.viewOAQr,this.keepScreen=Ao.keepScreen,this.saveImageToPhotosAlbum=Ro.saveImageToPhotosAlbum,this.openMiniApp=Co.openMiniApp,this.vibrate=Ao.vibrate,this.openWebview=Co.openWebview,this.getRouteParams=Do.getRouteParams,this.getAppInfo=Fi.getAppInfo,this.sendDataToPreviousMiniApp=Do.sendDataToPreviousMiniApp,this.onCallbackData=Do.onCallbackData,this.getPhoneNumber=Io.getPhoneNumber,this.openProfilePicker=Bo.openProfilePicker,vo.set(this,Bo.getActionsSupported),this.connectWifi=Ao.connectWifi,this.openMediaPicker=Bo.openMediaPicker,this.openOutApp=Bo.openOutApp,this.closeLoading=Co.closeLoading,r(this,no,null,"f"),r(this,io,null,"f"),r(this,oo,null,"f"),this.isShowNavBar=!0,r(this,so,0,"f"),r(this,co,0,"f");const _="home"===(null===(t=null===(e=o(this,to,"f"))||void 0===e?void 0:e.app)||void 0===t?void 0:t.leftButton)||"both"===(null===(i=null===(n=o(this,to,"f"))||void 0===n?void 0:n.app)||void 0===i?void 0:i.leftButton)?Vn:Zn,E=new URL(location.href),S=fn.isString(null===(s=null===(a=o(this,to,"f"))||void 0===a?void 0:a.app)||void 0===s?void 0:s.headerColor)&&(null===(u=null===(l=null===(c=o(this,to,"f"))||void 0===c?void 0:c.app)||void 0===l?void 0:l.headerColor)||void 0===u?void 0:u.length)>0?5:6,A="none"===(null===(h=null===(d=o(this,to,"f"))||void 0===d?void 0:d.app)||void 0===h?void 0:h.leftButton)||"home"===(null===(v=null===(p=o(this,to,"f"))||void 0===p?void 0:p.app)||void 0===v?void 0:v.leftButton)?$n:Hn;r(this,uo,{actionbarType:S,buttonType:A,dataConfig:{backgroundColor:(null===(m=null===(f=o(this,to,"f"))||void 0===f?void 0:f.app)||void 0===m?void 0:m.headerColor)||"",textColor:(null===(y=null===(g=o(this,to,"f"))||void 0===g?void 0:g.app)||void 0===y?void 0:y.textColor)||"",viewInLeftType:A,confirmToExit:1},homeConfig:{enable:_,url:`https://h5.zdn.vn/zapps/${this.getAppId()}/${E.search}`}},"f")}static getInstance(){return jo.instance||(jo.instance=new jo),jo.instance}getLoginStatus(){return fn.isString(o(this,oo,"f"))&&o(this,oo,"f").length>0}getAppId(){return o(this,eo,"f")}getZAppId(){return o(this,Xi,"f")}login(e){return i(this,void 0,void 0,(function*(){const e=yield o(this,ho,"f").call(this),t=e.find((e=>e.name===Tn)),n=e.find((e=>e.name===wn));if(!fn.isUndefined(t)&&!fn.isNull(t)&&fn.isString(t.value)){if(r(this,no,t.value,"f"),fn.isUndefined(n)||fn.isNull(n)||!fn.isString(n.value)?yield this.loginZaloV3():(r(this,io,n.value,"f"),yield this.loginZaloV4()),!o(this,oo,"f"))throw ii.loginFailed();return o(this,oo,"f")}throw ii.loginFailed()}))}loginZaloV3(){return i(this,void 0,void 0,(function*(){return yield fetch(`${In}?app_id=${o(this,Xi,"f")}&redirect_uri=https://h5.zdn.vn/zapps/${o(this,eo,"f")}/&code=${o(this,no,"f")}&isSDK=true123`).then((e=>i(this,void 0,void 0,(function*(){let t=yield e.json();if(t.access_token){r(this,oo,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return r(this,co,e,"f"),r(this,so,(new Date).getTime(),"f"),this.setZAccSession(o(this,oo,"f")||""),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(o(this,oo,"f")||""),o(this,oo,"f")}return null}))))}))}loginZaloV4(){return i(this,void 0,void 0,(function*(){const e=new URLSearchParams;e.append("app_id",o(this,eo,"f")),e.append("code",o(this,no,"f")||""),e.append("code_verifier",o(this,io,"f")||""),fn.isNull(o(this,ro,"f"))?e.append("grant_type","authorization_code"):(e.append("grant_type","refresh_token"),e.append("refresh_token",o(this,ro,"f")||""));return yield fetch(Pn,Object.assign({method:"POST",body:e},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).then((e=>i(this,void 0,void 0,(function*(){const t=yield e.json();if(t.refresh_token&&r(this,ro,t.refresh_token,"f"),t.access_token){r(this,oo,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return r(this,co,e,"f"),r(this,so,(new Date).getTime(),"f"),this.setZAccSession(o(this,oo,"f")||""),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(o(this,oo,"f")||""),o(this,oo,"f")}return null}))))}))}getAccessToken(e){return i(this,void 0,void 0,(function*(){const e=(new Date).getTime()-o(this,so,"f");if(!o(this,oo,"f"))throw ii.loginRequired();return e<o(this,co,"f")?o(this,oo,"f"):yield this.login()}))}}Xi=new WeakMap,eo=new WeakMap,to=new WeakMap,no=new WeakMap,io=new WeakMap,oo=new WeakMap,ro=new WeakMap,ao=new WeakMap,so=new WeakMap,co=new WeakMap,lo=new WeakMap,uo=new WeakMap,ho=new WeakMap,po=new WeakMap,vo=new WeakMap;class Mo{constructor(){fo.set(this,Sn),mo.set(this,On),go.set(this,"DEFAULT ZOAUTH"),yo.set(this,"DEFAULT ACCESS TOKEN"),_o.set(this,{timer:{getToken:0}}),Eo.set(this,!1),this.getLoginStatus=()=>o(this,Eo,"f"),this.getAppId=()=>o(this,fo,"f"),this.login=()=>(r(this,Eo,!0,"f"),Promise.resolve(o(this,go,"f"))),this.getAccessToken=()=>Promise.resolve(o(this,yo,"f")),this.getVersion=Fi.getVersion,this.getSystemInfo=Fi.getSystemInfo,this.setNavigationBarTitle=()=>Promise.resolve(),this.setNavigationBarColor=()=>Promise.resolve(),this.setBackgroundColor=()=>Promise.resolve(),this.setNavigationBarLeftButton=()=>Promise.resolve(),this.setDeviceOrientation=()=>Promise.resolve(),this.setStorage=e=>i(this,void 0,void 0,(function*(){const t=new wo(this.getAppId());return yield t.putDataToStorage(e.data),{errorKeys:[]}})),this.getStorage=e=>i(this,void 0,void 0,(function*(){const t=new wo(this.getAppId());return yield t.getDataFromStorage(e.keys)})),this.getStorageInfo=e=>i(this,void 0,void 0,(function*(){const e=new wo(this.getAppId());return yield e.getStorageInfo()})),this.removeStorage=e=>i(this,void 0,void 0,(function*(){const t=new wo(this.getAppId());return yield t.removeDataFromStorage(e.keys)})),this.clearStorage=e=>i(this,void 0,void 0,(function*(){const e=new wo(this.getAppId());return yield e.clearStorage()})),this.getUserInfo=()=>(console.warn("birthday and gender are deprecated"),Promise.resolve({userInfo:{id:"3368637342326461234",name:"User Name",avatar:"https://h5.zdn.vn/static/images/avatar.png"}})),this.getNetworkType=()=>{let t;switch((navigator.connection||navigator.mozConnection||navigator.webkitConnection).effectiveType){case"none":t=e.NetworkType.none;break;case"4g":t=e.NetworkType.wifi;break;case"3g":case"2g":t=e.NetworkType.cellular;break;default:t=e.NetworkType.unknown}const n={networkType:t};return Promise.resolve(n)},this.onNetworkStatusChange=t=>{const n=navigator.connection||navigator.mozConnection||navigator.webkitConnection,i=n.effectiveType;return n.addEventListener("change",(function(){let n;switch(i){case"none":n=e.NetworkType.none;break;case"4g":n=e.NetworkType.wifi;break;case"3g":case"2g":n=e.NetworkType.cellular;break;default:n=e.NetworkType.unknown}t({isConnected:!0,networkType:n})})),Promise.resolve()},this.startBeaconDiscovery=e=>Promise.resolve(!0),this.stopBeaconDiscovery=e=>Promise.resolve(!0),this.getBeacons=e=>Promise.resolve({beacons:[]}),this.closeApp=()=>Promise.resolve(),this.getLocation=()=>Promise.resolve({longitude:"105.788026",latitude:"21.0258773",timestamp:(new Date).getTime().toString(),provider:"fused"}),this.onBackButtonClick=()=>Promise.resolve(),this.stopBluetoothDevicesDiscovery=()=>Promise.resolve(),this.startBluetoothDevicesDiscovery=()=>Promise.resolve(),this.openBluetoothAdapter=()=>Promise.resolve(),this.onBluetoothDeviceFound=()=>Promise.resolve(),this.onBluetoothAdapterStateChange=()=>Promise.resolve(),this.getConnectedBluetoothDevices=()=>Promise.resolve(),this.getBluetoothDevices=()=>Promise.resolve(),this.getBluetoothAdapterState=()=>Promise.resolve(),this.closeBluetoothAdapter=()=>Promise.resolve(),this.scanQRCode=()=>Promise.resolve({content:"132"}),this.openProfile=()=>Promise.resolve(),this.openChat=()=>Promise.resolve(),this.openPostFeed=()=>Promise.resolve({status:1,shareType:0,numberOfUser:0}),this.followOA=()=>Promise.resolve(),this.unFollowOA=()=>Promise.resolve(),this.openShareSheet=()=>Promise.resolve({status:2,shareType:0,numberOfUser:0}),this.requestCameraPermission=()=>Promise.resolve({userAllow:!0,message:"Success"}),this.createShortcut=()=>Promise.resolve(),this.openBioAuthentication=()=>Promise.resolve({code:0,message:"OK",data:{domain:"",code:0,message:"",payToken:""}}),this.checkStateBioAuthentication=()=>Promise.resolve({bioState:""}),this.sendLocation=()=>Promise.resolve(),this.showToast=()=>Promise.resolve(),this.hideKeyboard=()=>Promise.resolve(),this.openPhone=()=>Promise.resolve(),this.openSMS=()=>Promise.resolve(),this.viewOAQr=()=>Promise.resolve(),this.keepScreen=()=>Promise.resolve(),this.saveImageToPhotosAlbum=()=>Promise.resolve(),this.openMiniApp=e=>Promise.resolve(),this.vibrate=()=>Promise.resolve(),this.openWebview=e=>(location.replace(e.url),Promise.resolve()),this.getRouteParams=Do.getRouteParams,this.getAppInfo=()=>Promise.resolve({description:"",name:"",version:"",appUrl:"",qrCodeUrl:""}),this.sendDataToPreviousMiniApp=e=>Promise.resolve(),this.onCallbackData=e=>(e({data:""}),Promise.resolve()),this.getPhoneNumber=()=>(console.warn("This api only works on zalo app"),Promise.resolve({number:""})),this.openProfilePicker=()=>(console.warn("This api only works on zalo app"),Promise.resolve([])),this.connectWifi=()=>(console.warn("This api only works on zalo app"),Promise.resolve()),this.openOutApp=e=>(location.href=e,Promise.resolve()),this.closeLoading=e=>Promise.resolve()}on(e,t,n){throw new Error("Method not implemented.")}once(e,t,n){throw new Error("Method not implemented.")}off(e,t,n,i){throw new Error("Method not implemented.")}removeAllListeners(e){throw new Error("Method not implemented.")}openMediaPicker(e,t,n,i){return console.warn("This api only works on zalo app"),Promise.resolve({urls:[]})}}fo=new WeakMap,mo=new WeakMap,go=new WeakMap,yo=new WeakMap,_o=new WeakMap,Eo=new WeakMap;const Lo=Symbol("required"),Uo=Symbol("checkType"),Wo=(e,t)=>(n,i,o)=>{let r=Reflect.getOwnMetadata(Lo,n,i)||[];r.push({parameterIndex:o,fields:e,option:t}),Reflect.defineMetadata(Lo,r,n,i)},xo=(e,t,n)=>(i,o,r)=>{let a=Reflect.getOwnMetadata(Uo,i,o)||[];a.push({parameterIndex:r,type:e,properties:t,defaultValue:n}),Reflect.defineMetadata(Uo,a,i,o)};const zo=(e,t,n)=>{const i=n.value,o=i.toString().match(/\(.*?\)/)[0].replace(/[()]/gi,"").replace(/\s/gi,"").split(",");return n.value=function(){const n=Reflect.getOwnMetadata(Lo,e,t),r=Reflect.getOwnMetadata(Uo,e,t);return r&&r.forEach((e=>{const{parameterIndex:t,type:n,properties:i,defaultValue:r}=e;let a=arguments[t],s=o[t];const c=typeof a;if(!fn.isUndefined(a)){if(!mi(a,n))throw ii.wrongTypeParam(s,n,Array.isArray(a)?"array":null===a?"null":c);"object"===n&&Object.entries(i).forEach((([e,n])=>{const i=e.split("?")[0],o=fn.get(a,i);if(fn.isUndefined(o)||fn.isNull(o)){if(!e.includes("?"))throw ii.missingParam(e);fn.isObject(fn.get(a,i.split(".")[0]))&&r&&!fn.isUndefined(fn.get(r,i))&&fn.set(arguments[t],i,fn.get(r,i))}else if(fn.isFunction(n)){const e=n(o);if(e&&e.error)throw ii.wrongTypeParam(`${s}.${i}`,e.errorMessage,typeof o)}}))}})),n&&n.forEach((e=>{const{parameterIndex:t,option:n,fields:i}=e,o=arguments[t],r=null==n?void 0:n.if,a=null==n?void 0:n.defaultValue;let s=!0;r&&(s=Object.keys(r).every((e=>fn.get(o,e)===r[e]))),s&&i.forEach((e=>{const n=e=>{let n=!1;return fn.isEmpty(fn.get(o,e))&&(fn.isUndefined(fn.get(a,e))||fn.set(arguments[t],e,fn.get(a,e)),n=!0),n};if(Array.isArray(e)&&e.length>0&&e.every(n))throw ii.missingParam(e.join(" or "));if(fn.isString(e)&&n(e))throw ii.missingParam(e)}))})),i.apply(this,arguments)},n};var Fo,Go,Ho,$o,Vo;class Zo{constructor(){this.events=Ni.getInstance(),Fo.set(this,void 0),r(this,Fo,this.getServiceInstance(),"f"),this.events.addListener=(t,n,i)=>{const o=t;return this.events.addListener(e.Events[o],n,i)}}login(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").login(e)}))}getLoginStatus(){return o(this,Fo,"f").getLoginStatus()}getAccessToken(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getAccessToken(e)}))}getVersion(){return o(this,Fo,"f").getVersion()}getSystemInfo(){return o(this,Fo,"f").getSystemInfo()}setNavigationBarTitle(e){return i(this,void 0,void 0,(function*(){return o(this,Fo,"f").setNavigationBarTitle(e)}))}setNavigationBarColor(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").setNavigationBarColor(e)}))}setBackgroundColor(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").setBackgroundColor(e)}))}setNavigationBarLeftButton(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").setNavigationBarLeftButton(e)}))}setDeviceOrientation(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").setDeviceOrientation(e)}))}setStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").setStorage(e)}))}getStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getStorage(e)}))}getStorageInfo(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getStorageInfo(e)}))}removeStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").removeStorage(e)}))}clearStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").clearStorage(e)}))}getUserInfo(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getUserInfo(e)}))}getNetworkType(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getNetworkType(e)}))}onNetworkStatusChange(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").onNetworkStatusChange(e)}))}startBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").startBeaconDiscovery(e)}))}stopBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").stopBeaconDiscovery(e)}))}getBeacons(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getBeacons(e)}))}closeApp(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").closeApp(e)}))}getLocation(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getLocation(e)}))}stopBluetoothDevicesDiscovery(){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").stopBluetoothDevicesDiscovery()}))}startBluetoothDevicesDiscovery(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").startBluetoothDevicesDiscovery(e)}))}openBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").openBluetoothAdapter()}))}onBluetoothDeviceFound(){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").onBluetoothDeviceFound()}))}onBluetoothAdapterStateChange(){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").onBluetoothAdapterStateChange()}))}getConnectedBluetoothDevices(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getConnectedBluetoothDevices(e)}))}getBluetoothDevices(){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getBluetoothDevices()}))}getBluetoothAdapterState(){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getBluetoothAdapterState()}))}closeBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").closeBluetoothAdapter()}))}scanQRCode(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").scanQRCode(e)}))}openProfile(e){return i(this,void 0,void 0,(function*(){yield o(this,Fo,"f").openProfile(e)}))}openChat(e){return i(this,void 0,void 0,(function*(){yield o(this,Fo,"f").openChat(e)}))}openPostFeed(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").openPostFeed(e)}))}followOA(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").followOA(e)}))}unfollowOA(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").unFollowOA(e)}))}openShareSheet(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").openShareSheet(e)}))}requestCameraPermission(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").requestCameraPermission(e)}))}createShortcut(e){return i(this,void 0,void 0,(function*(){const t=yield bi(An,0),n=hi().isIOS,i=t.logoUrl||pi("og:image:url")||"",r=t.name||document.title,a=e.params?new URLSearchParams(e.params):new URLSearchParams;if(a.append("utm_source","zalo-shortcut"),a.append("utm_medium","default"),a.append("utm_campaign","default"),n){a.append("appId",An),a.append("appName",r),a.append("appIcon",i);const e=`https://mini.zalo.me/shortcut.html?${a.toString()}`;yield o(this,Fo,"f").openOutApp(encodeURI(e))}else yield o(this,Fo,"f").createShortcut(`https://zalo.me/app/link/zapps/${An}/?${a.toString()}`,r,i);return ni()}))}openBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").openBioAuthentication(e)}))}checkStateBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").checkStateBioAuthentication(e)}))}sendLocation(e){return i(this,void 0,void 0,(function*(){yield o(this,Fo,"f").sendLocation(e)}))}showToast(e){return i(this,void 0,void 0,(function*(){yield o(this,Fo,"f").showToast(e)}))}hideKeyboard(e){return i(this,void 0,void 0,(function*(){yield o(this,Fo,"f").hideKeyboard(e)}))}openPhone(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").openPhone(e)}))}openSMS(e){return i(this,void 0,void 0,(function*(){yield o(this,Fo,"f").openSMS(e)}))}viewOAQr(e){return i(this,void 0,void 0,(function*(){yield o(this,Fo,"f").viewOAQr(e)}))}keepScreen(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").keepScreen(e)}))}saveImageToGallery(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").saveImageToPhotosAlbum(e)}))}saveImageToPhotosAlbum(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").saveImageToPhotosAlbum(e)}))}openMiniApp(e){return i(this,void 0,void 0,(function*(){if(!fn.isEmpty(e.params)){const t=e.params||{};Object.keys(t).forEach((e=>{"object"==typeof t[e]&&(t[e]=JSON.stringify(t[e])),t[e]=""+encodeURIComponent(t[e])})),e.params=t}yield o(this,Fo,"f").openMiniApp(e)}))}vibrate(e){return i(this,void 0,void 0,(function*(){yield o(this,Fo,"f").vibrate(e)}))}openWebview(e){return i(this,void 0,void 0,(function*(){yield o(this,Fo,"f").openWebview(e)}))}getRouteParams(){return o(this,Fo,"f").getRouteParams()}getAppInfo(e){return o(this,Fo,"f").getAppInfo()}sendDataToPreviousMiniApp(e){return o(this,Fo,"f").sendDataToPreviousMiniApp(e)}onCallbackData(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").onCallbackData(e)}))}getPhoneNumber(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").getPhoneNumber()}))}openProfilePicker(e){return i(this,void 0,void 0,(function*(){const t=yield o(this,Fo,"f").openProfilePicker(e.maxProfile);let n;if(t.length>0)try{const e=yield this.getAccessToken(),i=yield fetch(Cn,{method:"POST",headers:{"Content-Type":"application/json",access_token:e||""},body:JSON.stringify({fields:"id,name,picture",user_ids:t})}),o=yield i.json();if(0!==o.error||!o.data)throw new Error(o.message);n=t.map((e=>{var t,n,i,r,a,s,c,l,u,d,h;return{id:(null===(n=null===(t=o.data[e])||void 0===t?void 0:t.user_info)||void 0===n?void 0:n.user_id_by_app)||"",profile:{name:null===(r=null===(i=o.data[e])||void 0===i?void 0:i.user_info)||void 0===r?void 0:r.name,avatar:null===(l=null===(c=null===(s=null===(a=o.data[e])||void 0===a?void 0:a.user_info)||void 0===s?void 0:s.picture)||void 0===c?void 0:c.data)||void 0===l?void 0:l.url},code:0!==(null===(u=o.data[e])||void 0===u?void 0:u.error)?-1:0,message:`Get profile: ${fn.isUndefined(null===(d=o.data[e])||void 0===d?void 0:d.message)?"Unknown error":null===(h=o.data[e])||void 0===h?void 0:h.message}`}}))}catch(e){n=t.map((t=>({id:t,profile:{name:"",avatar:""},code:-1,message:`Can't get profile: ${e.message}`})))}return{users:n||[]}}))}connectWifi(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").connectWifi(e)}))}openMediaPicker(e){var t,n,r;return i(this,void 0,void 0,(function*(){const i={};fn.isUndefined(null===(t=e.editView)||void 0===t?void 0:t.enable)||(null===(n=e.editView)||void 0===n?void 0:n.enable)?i.enable=1:i.enable=0,i.aspect_ratio=null===(r=e.editView)||void 0===r?void 0:r.aspectRatio;const a=!0===e.silentRequest?1:0,s=e.maxSelectItem;return yield o(this,Fo,"f").openMediaPicker(e.type,i,a,s)}))}getShareableLink(e){return i(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();return(yield Oi(window.APP_ID,t||"",e.title,e.description,e.thumbnail,e.path)).shareableLink}))}closeLoading(e){return i(this,void 0,void 0,(function*(){return yield o(this,Fo,"f").closeLoading("user action")}))}}Fo=new WeakMap,t([ei],Zo.prototype,"login",null),t([ti],Zo.prototype,"getLoginStatus",null),t([ei],Zo.prototype,"getAccessToken",null),t([ti],Zo.prototype,"getVersion",null),t([ti],Zo.prototype,"getSystemInfo",null),t([ei,zo,n(0,xo("object",{title:Ti("string")}))],Zo.prototype,"setNavigationBarTitle",null),t([ei,zo,n(0,xo("object",{color:Ti("string"),"textColor?":Ti("string",{values:["white","black"]}),"statusBarColor?":Ti("string")}))],Zo.prototype,"setNavigationBarColor",null),t([ei,zo,n(0,xo("object",{backgroundColor:Ti("string"),"textColor?":Ti("string",{values:["white","black"]})}))],Zo.prototype,"setBackgroundColor",null),t([ei,zo,n(0,xo("object",{type:Ti("string",{values:["none","back","home","both"]})}))],Zo.prototype,"setNavigationBarLeftButton",null),t([ei,zo,n(0,xo("object",{rotate:Ti("string",{values:["auto","portrait","landscape"]})}))],Zo.prototype,"setDeviceOrientation",null),t([ei,zo,n(0,xo("object",{data:Ti("object")}))],Zo.prototype,"setStorage",null),t([ei,zo,n(0,xo("object",{keys:Ti("array<string>")}))],Zo.prototype,"getStorage",null),t([ei],Zo.prototype,"getStorageInfo",null),t([ei,zo,n(0,xo("object",{keys:Ti("array<string>")}))],Zo.prototype,"removeStorage",null),t([ei],Zo.prototype,"clearStorage",null),t([ei,zo,n(0,xo("object",{"avatarType?":Ti("string",{values:["small","normal","large"]})}))],Zo.prototype,"getUserInfo",null),t([ei],Zo.prototype,"getNetworkType",null),t([ei],Zo.prototype,"onNetworkStatusChange",null),t([ei],Zo.prototype,"startBeaconDiscovery",null),t([ei],Zo.prototype,"stopBeaconDiscovery",null),t([ei],Zo.prototype,"getBeacons",null),t([ei],Zo.prototype,"closeApp",null),t([ei],Zo.prototype,"getLocation",null),t([ei],Zo.prototype,"stopBluetoothDevicesDiscovery",null),t([ei],Zo.prototype,"startBluetoothDevicesDiscovery",null),t([ei],Zo.prototype,"openBluetoothAdapter",null),t([ei],Zo.prototype,"onBluetoothDeviceFound",null),t([ei],Zo.prototype,"onBluetoothAdapterStateChange",null),t([ei],Zo.prototype,"getConnectedBluetoothDevices",null),t([ei],Zo.prototype,"getBluetoothDevices",null),t([ei],Zo.prototype,"getBluetoothAdapterState",null),t([ei],Zo.prototype,"closeBluetoothAdapter",null),t([ei],Zo.prototype,"scanQRCode",null),t([ei,zo,n(0,xo("object",{type:Ti("string",{values:["user","oa","aliasOA"]}),id:Ti("string")}))],Zo.prototype,"openProfile",null),t([ei,zo,n(0,xo("object",{type:Ti("string",{values:["user","oa"]}),id:Ti("string")}))],Zo.prototype,"openChat",null),t([ei,zo,n(0,Wo(["data.imageUrl"],{if:{type:"image"}})),n(0,Wo(["data.link"],{if:{type:"link"}})),n(0,Wo(["data.id"],{if:{type:"profile"}})),n(0,xo("object",{type:Ti("string",{values:["image","link","profile"]}),data:Ti("object"),"data.imageUrl?":Ti("url"),"data.link?":Ti("url"),"data.title?":Ti("string"),"data.thumb?":Ti("url"),"data.description?":Ti("string"),"data.avatar?":Ti("url"),"data.id?":Ti("string"),"data.displayName?":Ti("string")}))],Zo.prototype,"openPostFeed",null),t([ei,zo,n(0,xo("object",{id:Ti("string"),"showDialogConfirm?":Ti("boolean")}))],Zo.prototype,"followOA",null),t([ei,zo,n(0,xo("object",{id:Ti("string")}))],Zo.prototype,"unfollowOA",null),t([ei,zo,n(0,Wo([["data.imageUrl","data.imageUrls"]],{if:{type:"image"}})),n(0,Wo(["data.link"],{if:{type:"link"}})),n(0,Wo(["data.id"],{if:{type:"oa"}})),n(0,Wo(["data.gifUrl"],{if:{type:"gif"}})),n(0,Wo(["data.videoThumb","data.videoUrl"],{if:{type:"video"}})),n(0,Wo(["data.thumbnail","data.title","data.description"],{if:{type:"zmp"},defaultValue:{data:{description:""}}})),n(0,xo("object",{type:Ti("string",{values:["image","gif","video","link","oa","zmp"]}),data:Ti("object"),"data.imageUrl?":Ti("url"),"data.imageUrls?":Ti("array<url>",{maxLength:10}),"data.caption?":Ti("string"),"data.gifUrl?":Ti("url"),"data.width?":Ti("number"),"data.height?":Ti("number"),"data.videoThumb?":Ti("url"),"data.videoUrl?":Ti("url"),"data.link?":Ti("url"),"data.chatOnly?":Ti("boolean"),"data.id?":Ti("string"),"data.thumbnail?":Ti("url"),"data.path?":Ti("string"),"data.title?":Ti("string",{maxLength:100}),"data.description?":Ti(["string"],{maxLength:400})}))],Zo.prototype,"openShareSheet",null),t([ei],Zo.prototype,"requestCameraPermission",null),t([ei],Zo.prototype,"createShortcut",null),t([ei,zo,n(0,xo("object",{secretData:Ti("string"),"ui?":Ti("object"),"ui.title?":Ti("string"),"ui.subTitle?":Ti("string"),"ui.negativeButtonText?":Ti("string"),"requireFingerprint?":Ti("boolean")},{requireFingerprint:!0,ui:{title:"Xác thực",subTitle:"Sử dụng sinh trắc học của bạn để xác thực",negativeButtonText:"Đóng"}}))],Zo.prototype,"openBioAuthentication",null),t([ei],Zo.prototype,"checkStateBioAuthentication",null),t([ei,zo,n(0,xo("object",{toUserId:Ti("string"),"title?":Ti("string")}))],Zo.prototype,"sendLocation",null),t([ei,zo,n(0,xo("object",{message:Ti("string")}))],Zo.prototype,"showToast",null),t([ei],Zo.prototype,"hideKeyboard",null),t([ei,zo,n(0,xo("object",{phoneNumber:Ti("string")}))],Zo.prototype,"openPhone",null),t([ei,zo,n(0,xo("object",{content:Ti("string"),phoneNumber:Ti("string",{regex:/^\+?\d+$/})}))],Zo.prototype,"openSMS",null),t([ei,zo,n(0,xo("object",{id:Ti("string"),"displayName?":Ti("string")},{displayName:""}))],Zo.prototype,"viewOAQr",null),t([ei],Zo.prototype,"keepScreen",null),t([ei,zo,n(0,xo("object",{"imageBase64Data?":Ti("string"),"imageUrl?":Ti("url")}))],Zo.prototype,"saveImageToGallery",null),t([ei,zo,n(0,xo("object",{"imageBase64Data?":Ti("string"),"imageUrl?":Ti("url")}))],Zo.prototype,"saveImageToPhotosAlbum",null),t([ei,zo,n(0,xo("object",{appId:Ti("string"),"params?":Ti("object")}))],Zo.prototype,"openMiniApp",null),t([ei,zo,n(0,xo("object",{"type?":Ti("string",{values:["oneShot"]}),"milliseconds?":Ti("number")},{type:"oneShot",milliseconds:500}))],Zo.prototype,"vibrate",null),t([ei,zo,n(0,xo("object",{url:Ti("string")}))],Zo.prototype,"openWebview",null),t([ti],Zo.prototype,"getRouteParams",null),t([ei],Zo.prototype,"getAppInfo",null),t([ei],Zo.prototype,"sendDataToPreviousMiniApp",null),t([ei],Zo.prototype,"onCallbackData",null),t([ei],Zo.prototype,"getPhoneNumber",null),t([ei,zo,n(0,xo("object",{"maxProfile?":Ti("number",{min:1,max:10})},{maxProfile:1}))],Zo.prototype,"openProfilePicker",null),t([ei,zo,n(0,Wo(["SSID"])),n(0,xo("object",{SSID:Ti("string"),"password?":Ti("string"),"hiddenSSID?":Ti("boolean")}))],Zo.prototype,"connectWifi",null),t([ei,zo,n(0,xo("object",{type:Ti("string",{values:["photo","video","file","multi_photo","multi_video"]}),"editView?":Ti("object"),"editView.enable?":Ti("boolean"),"editView.aspectRatio?":Ti("string",{regex:/^\d+:\d+$/}),"silentRequest?":Ti("boolean"),"maxSelectItem?":Ti("number",{min:1})}))],Zo.prototype,"openMediaPicker",null),t([ei,zo,n(0,xo("object",{title:Ti("string",{maxLength:100}),"thumbnail?":Ti("url"),"path?":Ti("string"),description:Ti(["string"],{maxLength:400})},{description:""}))],Zo.prototype,"getShareableLink",null),t([ei,zo],Zo.prototype,"closeLoading",null);class Jo extends Zo{getServiceInstance(){return jo.getInstance()}}class Ko extends Zo{getServiceInstance(){return new Mo}}class qo{constructor(){Go.set(this,An)}static getInstance(){return qo.instance||(qo.instance=new qo),qo.instance}createOrder(e,t){return i(this,void 0,void 0,(function*(){const n=o(this,Go,"f"),i=new URLSearchParams;i.append("amount",t.amount.toString()),i.append("item",encodeURIComponent(JSON.stringify(t.item))),i.append("appId",n),t.desc&&i.append("desc",encodeURIComponent(t.desc)),t.extradata&&i.append("extradata",encodeURIComponent(JSON.stringify(t.extradata))),t.method&&i.append("method",t.method);const r={headers:{"Content-Type":"application/x-www-form-urlencoded",authorization:"Bearer "}};try{const o=yield e.getAccessToken({fail:e=>{throw ii.loginRequired}});r.headers.authorization=`Bearer ${o}`;const a=yield fetch(Jn,Object.assign(Object.assign({method:"POST"},r),{body:i})),s=yield a.json();if(!s.data||0!==s.err)throw ii.badRequest(s.msg);const c=s.data.id,l=window.APP_VERSION,u=window.APP_ENV,d={miniAppId:n,accessToken:o||"",orderId:c};l&&(d.version=l),u&&(d.env=u),t.method&&(d.method=t.method);const h=ri.encode(d),p=new URL(`?${h}`,"https://payment-mini.zalo.me").toString();return yield e.openWebview({url:p,fail:e=>{throw e}}),{orderId:c}}catch(e){throw e}}))}checkTransaction(e,t){return i(this,void 0,void 0,(function*(){try{let n,{data:i}=t;if(i||(i=e.getRouteParams()),"object"==typeof i&&(n=i.appTransID||i.orderId||i.apptransid),"string"==typeof i){const e=ri.getParameterByName("orderId",i),t=ri.getParameterByName("appTransID",i)||ri.getParameterByName("apptransid",i);n=e||t}const r=new URL(Kn),a={transId:n||"",appId:o(this,Go,"f")};r.search=new URLSearchParams(a).toString();const s=yield fetch(r.toString()),c=yield s.json();if(!c.data||0!==c.err)throw ii.badRequest(c.msg);const l=c.data||{};return{msg:l.resultMessage,orderId:l.orderId,resultCode:l.resultCode,transTime:l.transTime,createdAt:l.createAt,transId:l.transId}}catch(e){throw e}}))}getOrderStatus(e){return i(this,void 0,void 0,(function*(){try{const{orderId:t}=e,n=new URL(qn),i={appId:o(this,Go,"f")};e.transId&&(i.transId=e.transId),e.orderId&&(i.orderId=e.orderId),n.search=new URLSearchParams(i).toString();const r=yield fetch(n.toString()),a=yield r.json();if(!a.data||0!==a.err)throw ii.badRequest(a.msg);const s=a.data||{};return{returnCode:s.returnCode,returnMessage:s.returnMessage,isProcessing:s.isProcessing,amount:s.amount}}catch(e){throw e}}))}}Go=new WeakMap;class Qo{constructor(){Ho.set(this,Sn)}static getInstance(){return Qo.instance||(Qo.instance=new Qo),Qo.instance}createOrder(e,t){return Promise.resolve({orderId:""})}checkTransaction(e,t){const n={msg:"Success",orderId:"",resultCode:1,transTime:(new Date).getTime().toString(),createdAt:(new Date).getTime().toString(),transId:""};return Promise.resolve(n)}getOrderStatus(e){return Promise.resolve({returnCode:3,returnMessage:"Giao dịch chưa được thực hiện.",isProcessing:!1,amount:1e4})}}Ho=new WeakMap;class Yo{constructor(e){$o.set(this,void 0),Vo.set(this,void 0),r(this,$o,this.getInstance(),"f"),r(this,Vo,e,"f")}createOrder(e){return o(this,$o,"f").createOrder(o(this,Vo,"f"),e)}checkTransaction(e){return o(this,$o,"f").checkTransaction(o(this,Vo,"f"),e)}getOrderStatus(e){return o(this,$o,"f").getOrderStatus(e)}}$o=new WeakMap,Vo=new WeakMap,t([ei,zo,n(0,xo("object",{amount:Ti(["string","number"]),desc:Ti("string"),"method?":Ti("string",{values:["MOMO","ZALOPAY","MOMO_SANDBOX","ZALOPAY_SANDBOX","CC","CC_SANDBOX","ATM","ATM_SANDBOX"]})}))],Yo.prototype,"createOrder",null),t([ei,zo],Yo.prototype,"checkTransaction",null),t([ei,zo,n(0,Wo(["transId"],{if:{orderId:void 0}})),n(0,Wo(["orderId"],{if:{transId:void 0}})),n(0,xo("object",{"transId?":Ti("string"),"orderId?":Ti("string")}))],Yo.prototype,"getOrderStatus",null);class Xo extends Yo{getInstance(){return qo.getInstance()}}class er extends Yo{getInstance(){return Qo.getInstance()}}const tr=hi();e.default=void 0,window.onJSCall=e=>function(t){Di.getInstance().onJSCall(e,t)},window.onMultiJSCall=e=>function(t){Di.getInstance().onMultiJSCall(e,t)},window.zaloJSV2={zalo_h5_event_handler:function(e,t,n){Di.getInstance().nativeEventHandler(e,t,n)}},e.Payment=void 0,tr.isZalo?(e.default=new Jo,e.Payment=new Xo(e.default)):(e.default=new Ko,e.Payment=new er(e.default)),window.ZaloMiniAppSDK=e.default,e.SDKCreator=Zo,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
@@ -166,8 +166,8 @@ export declare type CreateOrderCallBack = {
|
|
|
166
166
|
*/
|
|
167
167
|
export declare type CheckTransactionSuccessCallBack = {
|
|
168
168
|
msg: string;
|
|
169
|
-
appId: string;
|
|
170
169
|
orderId: string;
|
|
170
|
+
transId: string;
|
|
171
171
|
resultCode: number;
|
|
172
172
|
transTime: string;
|
|
173
173
|
createdAt: string;
|