zmp-sdk 2.22.1 → 2.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2783,7 +2783,7 @@
2783
2783
  unknown: 0
2784
2784
  };
2785
2785
  const ZALO_SUPPORT_SHARE_MULTI_IMAGE_VERSION = {
2786
- android: 12100641,
2786
+ android: 12100615,
2787
2787
  iOS: 460,
2788
2788
  wp: 0,
2789
2789
  unknown: 0
@@ -3743,7 +3743,7 @@
3743
3743
  }
3744
3744
  }
3745
3745
 
3746
- var version = "2.22.1";
3746
+ var version = "2.22.2";
3747
3747
 
3748
3748
  class Basics {
3749
3749
  /**
package/dist/index.es.js CHANGED
@@ -2780,7 +2780,7 @@ const ZALO_SUPPORT_STORAGE_VERSION = {
2780
2780
  unknown: 0
2781
2781
  };
2782
2782
  const ZALO_SUPPORT_SHARE_MULTI_IMAGE_VERSION = {
2783
- android: 12100641,
2783
+ android: 12100615,
2784
2784
  iOS: 460,
2785
2785
  wp: 0,
2786
2786
  unknown: 0
@@ -3740,7 +3740,7 @@ class ZMPEEmitter extends eventemitter3 {
3740
3740
  }
3741
3741
  }
3742
3742
 
3743
- var version$1 = "2.22.1";
3743
+ var version$1 = "2.22.2";
3744
3744
 
3745
3745
  class Basics {
3746
3746
  /**
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,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a}function t(e,t){return function(i,n){t(i,n,e)}}function i(e,t,i,n){return new(i||(i=Promise))((function(o,r){function a(e){try{c(n.next(e))}catch(e){r(e)}}function s(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function n(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)}function o(e,t,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!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"===n?o.call(e,i):o?o.value=i:t.set(e,i),i}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(i){return e(t(i))}}(Object.keys,Object),c=Object.prototype.hasOwnProperty;var l=function(e){if(!a(e))return s(e);var t=[];for(var i in Object(e))c.call(e,i)&&"constructor"!=i&&t.push(i);return t},d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function u(e,t){return e(t={exports:{}},t.exports),t.exports}var p="object"==typeof d&&d&&d.Object===Object&&d,h="object"==typeof self&&self&&self.Object===Object&&self,v=p||h||Function("return this")(),f=v.Symbol,g=Object.prototype,m=g.hasOwnProperty,y=g.toString,_=f?f.toStringTag:void 0;var S=function(e){var t=m.call(e,_),i=e[_];try{e[_]=void 0;var n=!0}catch(e){}var o=y.call(e);return n&&(t?e[_]=i:delete e[_]),o},E=Object.prototype.toString;var O=function(e){return E.call(e)},A=f?f.toStringTag:void 0;var T=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":A&&A in Object(e)?S(e):O(e)};var b=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var w,N=function(e){if(!b(e))return!1;var t=T(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},C=v["__core-js_shared__"],I=(w=/[^.]+$/.exec(C&&C.keys&&C.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"";var P=function(e){return!!I&&I in e},k=Function.prototype.toString;var R=function(e){if(null!=e){try{return k.call(e)}catch(e){}try{return e+""}catch(e){}}return""},D=/^\[object .+?Constructor\]$/,B=Function.prototype,j=Object.prototype,x=B.toString,U=j.hasOwnProperty,M=RegExp("^"+x.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var L=function(e){return!(!b(e)||P(e))&&(N(e)?M:D).test(R(e))};var W=function(e,t){return null==e?void 0:e[t]};var z=function(e,t){var i=W(e,t);return L(i)?i:void 0},J=z(v,"DataView"),F=z(v,"Map"),K=z(v,"Promise"),G=z(v,"Set"),H=z(v,"WeakMap"),$=R(J),V=R(F),Z=R(K),q=R(G),Q=R(H),Y=T;(J&&"[object DataView]"!=Y(new J(new ArrayBuffer(1)))||F&&"[object Map]"!=Y(new F)||K&&"[object Promise]"!=Y(K.resolve())||G&&"[object Set]"!=Y(new G)||H&&"[object WeakMap]"!=Y(new H))&&(Y=function(e){var t=T(e),i="[object Object]"==t?e.constructor:void 0,n=i?R(i):"";if(n)switch(n){case $:return"[object DataView]";case V:return"[object Map]";case Z:return"[object Promise]";case q:return"[object Set]";case Q:return"[object WeakMap]"}return t});var X=Y;var ee=function(e){return null!=e&&"object"==typeof e};var te=function(e){return ee(e)&&"[object Arguments]"==T(e)},ie=Object.prototype,ne=ie.hasOwnProperty,oe=ie.propertyIsEnumerable,re=te(function(){return arguments}())?te:function(e){return ee(e)&&ne.call(e,"callee")&&!oe.call(e,"callee")},ae=Array.isArray;var se=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var ce=function(e){return null!=e&&se(e.length)&&!N(e)};var le=function(){return!1},de=u((function(e,t){var i=t&&!t.nodeType&&t,n=i&&e&&!e.nodeType&&e,o=n&&n.exports===i?v.Buffer:void 0,r=(o?o.isBuffer:void 0)||le;e.exports=r})),ue={};ue["[object Float32Array]"]=ue["[object Float64Array]"]=ue["[object Int8Array]"]=ue["[object Int16Array]"]=ue["[object Int32Array]"]=ue["[object Uint8Array]"]=ue["[object Uint8ClampedArray]"]=ue["[object Uint16Array]"]=ue["[object Uint32Array]"]=!0,ue["[object Arguments]"]=ue["[object Array]"]=ue["[object ArrayBuffer]"]=ue["[object Boolean]"]=ue["[object DataView]"]=ue["[object Date]"]=ue["[object Error]"]=ue["[object Function]"]=ue["[object Map]"]=ue["[object Number]"]=ue["[object Object]"]=ue["[object RegExp]"]=ue["[object Set]"]=ue["[object String]"]=ue["[object WeakMap]"]=!1;var pe=function(e){return ee(e)&&se(e.length)&&!!ue[T(e)]};var he=function(e){return function(t){return e(t)}},ve=u((function(e,t){var i=t&&!t.nodeType&&t,n=i&&e&&!e.nodeType&&e,o=n&&n.exports===i&&p.process,r=function(){try{var e=n&&n.require&&n.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=r})),fe=ve&&ve.isTypedArray,ge=fe?he(fe):pe,me=Object.prototype.hasOwnProperty;var ye=function(e){if(null==e)return!0;if(ce(e)&&(ae(e)||"string"==typeof e||"function"==typeof e.splice||de(e)||ge(e)||re(e)))return!e.length;var t=X(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(a(e))return!l(e).length;for(var i in e)if(me.call(e,i))return!1;return!0};var _e=function(e){return void 0===e};var Se=function(e){return null===e};var Ee=function(e){return"string"==typeof e||!ae(e)&&ee(e)&&"[object String]"==T(e)};var Oe=function(e){return"number"==typeof e||ee(e)&&"[object Number]"==T(e)};var Ae=function(e){return ee(e)&&"[object RegExp]"==T(e)},Te=ve&&ve.isRegExp,be=Te?he(Te):Ae;var we=function(e){return"symbol"==typeof e||ee(e)&&"[object Symbol]"==T(e)},Ne=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ce=/^\w*$/;var Ie=function(e,t){if(ae(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!we(e))||(Ce.test(e)||!Ne.test(e)||null!=t&&e in Object(t))},Pe=z(Object,"create");var ke=function(){this.__data__=Pe?Pe(null):{},this.size=0};var Re=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},De=Object.prototype.hasOwnProperty;var Be=function(e){var t=this.__data__;if(Pe){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return De.call(t,e)?t[e]:void 0},je=Object.prototype.hasOwnProperty;var xe=function(e){var t=this.__data__;return Pe?void 0!==t[e]:je.call(t,e)};var Ue=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=Pe&&void 0===t?"__lodash_hash_undefined__":t,this};function Me(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}Me.prototype.clear=ke,Me.prototype.delete=Re,Me.prototype.get=Be,Me.prototype.has=xe,Me.prototype.set=Ue;var Le=Me;var We=function(){this.__data__=[],this.size=0};var ze=function(e,t){return e===t||e!=e&&t!=t};var Je=function(e,t){for(var i=e.length;i--;)if(ze(e[i][0],t))return i;return-1},Fe=Array.prototype.splice;var Ke=function(e){var t=this.__data__,i=Je(t,e);return!(i<0)&&(i==t.length-1?t.pop():Fe.call(t,i,1),--this.size,!0)};var Ge=function(e){var t=this.__data__,i=Je(t,e);return i<0?void 0:t[i][1]};var He=function(e){return Je(this.__data__,e)>-1};var $e=function(e,t){var i=this.__data__,n=Je(i,e);return n<0?(++this.size,i.push([e,t])):i[n][1]=t,this};function Ve(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}Ve.prototype.clear=We,Ve.prototype.delete=Ke,Ve.prototype.get=Ge,Ve.prototype.has=He,Ve.prototype.set=$e;var Ze=Ve;var qe=function(){this.size=0,this.__data__={hash:new Le,map:new(F||Ze),string:new Le}};var Qe=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Ye=function(e,t){var i=e.__data__;return Qe(t)?i["string"==typeof t?"string":"hash"]:i.map};var Xe=function(e){var t=Ye(this,e).delete(e);return this.size-=t?1:0,t};var et=function(e){return Ye(this,e).get(e)};var tt=function(e){return Ye(this,e).has(e)};var it=function(e,t){var i=Ye(this,e),n=i.size;return i.set(e,t),this.size+=i.size==n?0:1,this};function nt(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}nt.prototype.clear=qe,nt.prototype.delete=Xe,nt.prototype.get=et,nt.prototype.has=tt,nt.prototype.set=it;var ot=nt;function rt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var i=function(){var n=arguments,o=t?t.apply(this,n):n[0],r=i.cache;if(r.has(o))return r.get(o);var a=e.apply(this,n);return i.cache=r.set(o,a)||r,a};return i.cache=new(rt.Cache||ot),i}rt.Cache=ot;var at=rt;var st=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ct=/\\(\\)?/g,lt=function(e){var t=at(e,(function(e){return 500===i.size&&i.clear(),e})),i=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(st,(function(e,i,n,o){t.push(n?o.replace(ct,"$1"):i||e)})),t}));var dt=function(e,t){for(var i=-1,n=null==e?0:e.length,o=Array(n);++i<n;)o[i]=t(e[i],i,e);return o},ut=f?f.prototype:void 0,pt=ut?ut.toString:void 0;var ht=function e(t){if("string"==typeof t)return t;if(ae(t))return dt(t,e)+"";if(we(t))return pt?pt.call(t):"";var i=t+"";return"0"==i&&1/t==-Infinity?"-0":i};var vt=function(e){return null==e?"":ht(e)};var ft=function(e,t){return ae(e)?e:Ie(e,t)?[e]:lt(vt(e))};var gt=function(e){if("string"==typeof e||we(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var mt=function(e,t){for(var i=0,n=(t=ft(t,e)).length;null!=e&&i<n;)e=e[gt(t[i++])];return i&&i==n?e:void 0};var yt=function(e,t,i){var n=null==e?void 0:mt(e,t);return void 0===n?i:n},_t=function(){try{var e=z(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var St=function(e,t,i){"__proto__"==t&&_t?_t(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i},Et=Object.prototype.hasOwnProperty;var Ot=function(e,t,i){var n=e[t];Et.call(e,t)&&ze(n,i)&&(void 0!==i||t in e)||St(e,t,i)},At=/^(?:0|[1-9]\d*)$/;var Tt=function(e,t){var i=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==i||"symbol"!=i&&At.test(e))&&e>-1&&e%1==0&&e<t};var bt=function(e,t,i,n){if(!b(e))return e;for(var o=-1,r=(t=ft(t,e)).length,a=r-1,s=e;null!=s&&++o<r;){var c=gt(t[o]),l=i;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(o!=a){var d=s[c];void 0===(l=n?n(d,c,s):void 0)&&(l=b(d)?d:Tt(t[o+1])?[]:{})}Ot(s,c,l),s=s[c]}return e};var wt,Nt,Ct,It,Pt,kt,Rt,Dt,Bt,jt,xt={isEmpty:ye,isNull:Se,isUndefined:_e,isFunction:N,isObject:b,isString:Ee,isNumber:Oe,isArray:ae,isRegExp:be,get:yt,set:function(e,t,i){return null==e?e:bt(e,t,i)},isPromise:e=>!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then};function Ut(e){return"function"==typeof window.Debug?window.Debug(e):function(...e){process.env.NODE_ENV}}exports.NetworkType=void 0,(wt=exports.NetworkType||(exports.NetworkType={})).none="none",wt.wifi="wifi",wt.cellular="cellular",wt.unknown="unknown",exports.PlatformType=void 0,(Nt=exports.PlatformType||(exports.PlatformType={})).wp="wp",Nt.android="android",Nt.iOS="iOS",Nt.unknown="unknown",exports.ProfileType=void 0,(Ct=exports.ProfileType||(exports.ProfileType={}))[Ct.user=1]="user",Ct[Ct.oa=0]="oa",Ct[Ct.aliasOA=2]="aliasOA",exports.ChatType=void 0,(It=exports.ChatType||(exports.ChatType={}))[It.user=1]="user",It[It.oa=0]="oa",exports.PostFeedType=void 0,(Pt=exports.PostFeedType||(exports.PostFeedType={}))[Pt.image=1]="image",Pt[Pt.link=4]="link",Pt[Pt.profile=5]="profile",exports.ShareSheetType=void 0,(kt=exports.ShareSheetType||(exports.ShareSheetType={}))[kt.image=1]="image",kt[kt.gif=11]="gif",kt[kt.video=12]="video",kt[kt.link=4]="link",kt[kt.oa=5]="oa",kt[kt.zmp=20]="zmp",kt[kt.multi_image=21]="multi_image",exports.OrientationType=void 0,(Rt=exports.OrientationType||(exports.OrientationType={}))[Rt.auto=1]="auto",Rt[Rt.portrait=2]="portrait",Rt[Rt.landscape=3]="landscape",exports.VibrateType=void 0,(Dt=exports.VibrateType||(exports.VibrateType={}))[Dt.oneShot=0]="oneShot",exports.Events=void 0,(Bt=exports.Events||(exports.Events={})).AppPaused="h5.event.paused",Bt.AppResumed="h5.event.resumed",Bt.NetworkChanged="h5.event.connection.changed",Bt.OnDataCallback="h5.event.webview.result",Bt.OpenApp="h5.event.open.mp",Bt.AppClose="h5.event.action.close",exports.MediaPickerType=void 0,(jt=exports.MediaPickerType||(exports.MediaPickerType={}))[jt.photo=4]="photo",jt[jt.video=5]="video",jt[jt.file=6]="file";const Mt=e=>{const t=document.cookie;if(t){const o=t.split("; ");if(o&&o.length>0)for(var i=e.length+1,n=o.length-1;n>=0;n--){let t=o[n];if(t&&0===t.indexOf(e)&&(t=t.substring(i,t.length),t))return t=t.replace(/["']/g,""),t}}return null},Lt=e=>Mt(`${window.location.host}_`+e),Wt=e=>Mt((()=>{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),zt=window.zAppID,Jt=window.APP_ID,Ft=window.APP_CONFIG||{},Kt="h5.zdn.vn_zoauth",Gt="h5.zdn.vn_zlink3rd",Ht="h5.zdn.vn_zoauth_vrf",$t="h5.zdn.vn_deviceID",Vt="h5.zdn.vn_contextID",Zt="h5.zdn.vn_contextType",qt="https://graph.zalo.me/v2.0/me",Qt="https://h5.zalo.me/openapi/access_token",Yt="https://oauth.zaloapp.com/v3/access_token",Xt="https://graph.zalo.me/v2.0/me/friends/list",ei="https://h5.zalo.me/apps/get-info",ti="https://h5.zalo.me/log/async",ii=e=>({NONE:e?-2:0,WIFI:e?0:1,"2G":2,"3G":e?15:2,"4G":e?13:2}),ni=0,oi=-2e3,ri=-1400,ai=-1500,si=-1401,ci=-2004,li=-2005,di={SUCCESS:"Success",UNKNOWN_ERROR:"Unknown error. Please try again later.",TIME_OUT:"Request timeout. Please try again later.",LOGIN_REQUIRED:"Please login (https://miniapp.zalo.me/docs/api/login) before to call this api",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 id. Please check your params again.",INVALID_PARAM:"Invalid parameter",USER_DENIED:"User denied",USER_CANCEL:"User cancel",MEDIA_PICKER_FAIL:"Unable to pick media",SAVE_IMAGE_FAIL:"Unable to save image"},ui={SUCCESS:{code:ni,message:di.SUCCESS},UNKNOWN_ERROR:{code:oi,message:di.UNKNOWN_ERROR},UNAUTHORIZED:{code:si,message:di.LOGIN_REQUIRED},FORBIDDEN:{code:-1403,message:di.NOT_PERMISSION},CLIENT_NOT_SUPPORT:{code:-1404,message:di.CLIENT_NOT_SUPPORT},DECODE_FAILED:{code:-2001,message:di.DECODE_FAILED},TIME_OUT:{code:-1408,message:di.TIME_OUT},USER_DENIED:{code:-2002,message:di.USER_DENIED},USER_CANCEL:{code:-2003,message:di.USER_CANCEL}},pi={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",error_list:{android:{"-2":{map_to:ui.USER_DENIED}},iOS:{"-2":{map_to:ui.USER_DENIED}}}},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,error_list:{android:{"-1":{map_to:ui.USER_DENIED}},iOS:{"-1":{map_to:ui.USER_DENIED}}}},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},error_list:{android:{"-101":{map_to:{code:li,message:di.SAVE_IMAGE_FAIL},need_more_detail:!0},"-102":{map_to:{code:li,message:di.SAVE_IMAGE_FAIL},need_more_detail:!0}},iOS:{"-10":{map_to:{code:li,message:di.SAVE_IMAGE_FAIL},need_more_detail:!0}}}},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},error_list:{android:{"-1":{map_to:ui.USER_DENIED},"-101":{map_to:ui.USER_DENIED}},iOS:{"-1":{map_to:ui.USER_DENIED},"-10":{map_to:ui.USER_DENIED}}}},MP_OPEN_PROFILE_PICKER:{name:"action.mp.open.profile.picker",version_live:{iOS:432},error_list:{android:{"-101":{map_to:ui.USER_CANCEL}},iOS:{"-101":{map_to:ui.USER_CANCEL}}}},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:440},error_list:{android:{"-101":{map_to:ui.USER_CANCEL},999:{map_to:{code:ci,message:di.MEDIA_PICKER_FAIL},need_more_detail:!0}},iOS:{"-10":{map_to:{code:ci,message:di.MEDIA_PICKER_FAIL}}}}},MP_CLOSE_LOADINGVIEW:{name:"action.mp.close.loadingview"}},hi={android:{"-4":ui.DECODE_FAILED,"-5":ui.CLIENT_NOT_SUPPORT,"-14":ui.TIME_OUT},iOS:{"-9":ui.DECODE_FAILED,"-5":ui.CLIENT_NOT_SUPPORT,"-14":ui.TIME_OUT}},vi={android:12100571,iOS:400,wp:0,unknown:0},fi={android:12100641,iOS:460,wp:0,unknown:0},gi=[pi.GET_DOWNLOADED_STICKER.name,pi.OPEN_SHARE_STICKER.name,pi.OPEN_PROFILE.name,pi.OPEN_FEED_DETAIL.name,pi.OPEN_FRIEND_RADA.name,pi.OPEN_INAPP.name,pi.OPEN_OUTAPP.name,pi.OPEN_PAGE.name,pi.OPEN_PHOTODETAIL.name,pi.OPEN_GALARY.name,pi.OPEN_GAMECENTER.name,pi.OPEN_GAMENEWS.name,pi.OPEN_TAB_CONTACT.name,pi.OPEN_TAB_SOCIAL.name,pi.OPEN_FRIENDSUGGEST.name,pi.OPEN_GROUPLIST.name,pi.OPEN_NEARBY.name,pi.OPEN_ROOM.name,pi.OPEN_STICKERSTORE.name,pi.OPEN_CREATECHAT.name,pi.COPY_LINK_CATESTICKER.name,pi.REQUEST_BUY_STICKER.name,pi.OPEN_CHAT.name,pi.OPEN_TAB_CHAT.name,pi.OPEN_CHATGROUP.name,pi.OPEN_ADDFRIEND.name,pi.OPEN_TAB_MORE.name,pi.OPEN_POSTFEED.name,pi.OPEN_LOGINDEVICES.name,pi.OPEN_SENDSTICKER.name,pi.REPORT_ABUSE.name,pi.FOLLOW_OA.name,pi.UNFOLLOW_OA.name,pi.OPEN_GAMEDETAIL.name,pi.OPEN_SHARESHEET.name,pi.REQUEST_PERMISSION_CAMERA.name,pi.CHANGE_TITLE_HEADER.name,pi.WEBVIEW_CLEARCACHE.name,pi.WEBVIEW_CONFIRMCACHE.name,pi.WEBVIEW_ISVISIBLE.name,pi.WEBVIEW_NETWORKTYPE.name,pi.CHANGE_BUTTON_HEADER.name,pi.CREATE_OPTIONS_MENU.name,pi.CREATE_SHORTCUT.name,pi.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE.name,pi.WINDOW_CLOSE.name,pi.WEBVIEW_CHECKRESERROR.name,pi.IAP_REQUESTPAYMENT.name,pi.ZBROWSER_GETSTATS.name,pi.ZBROWSER_JSBRIDGE.name,pi.PROMPT_AUTHENTICATION.name,pi.CHANGE_ACTIONBAR_COLOR.name,pi.PROMPT_AUTHENTICATION_CHECK_STATE.name,pi.OPEN_APPSTORE.name,pi.GET_LOCATION.name,pi.QUERY_LOCATION_HIDE.name,pi.SHOW_TOAST.name,pi.OPEN_APP.name,pi.HIDE_KEYBOARD.name,pi.OPEN_PHONE.name,pi.OPEN_QR.name,pi.OPEN_SMS.name,pi.VIEW_MYQR.name,pi.KEEP_SCREEN.name,pi.CHANGE_AUTOROTATE.name,pi.CHECK_APP_INSTALLED.name,pi.QUERY_SHOW.name,pi.QUERY_HIDE.name,pi.OPEN_INAPPRW.name,pi.ZALORUN_GETTRACKINGSTATUS.name,pi.ZALORUN_SETTRACKINGSTATUS.name,pi.ZALORUN_GETDAYSTEP.name,pi.ZALORUN_FORCESUBMITDATA.name,pi.ZALORUN_SETWEIGHT.name,pi.OPEN_PROFILE_EXT.name,pi.DOWNLOAD_CATE.name,pi.JUMP_LOGIN.name,pi.OPEN_ADTIMA_ADS_INTERSTITIAL.name,pi.OPEN_ADTIMA_ADS.name,pi.GET_ADIDCLIENT.name,pi.SCAN_IBEACON.name,pi.SAVE_IMAGE_GALLERY.name,pi.OPEN_MP.name,pi.CHANGE_ACTIONBAR.name,pi.INTERACTIVE_VIBRATION.name,pi.ZBROWSER_MPDS.name],mi=0,yi=3,_i=1,Si=0,Ei="https://payment-mini.zalo.me/api/order/create",Oi="https://payment-mini.zalo.me/api/transaction";class Ai{constructor(e,t,i){this.code=e,this.message=t,this.api=i}toString(){return`api: ${String(this.api)}; code: ${this.code}; message: ${this.message}`}toJSON(){return{code:this.code,message:this.message,api:this.api}}}const Ti=(e,t)=>e instanceof Ai?((e,t)=>(e.api=t,e.toJSON()))(e,t):((e,t)=>e instanceof Error?new Ai(oi,e.message,t).toJSON():new Ai(oi,di.UNKNOWN_ERROR,t).toJSON())(e,t),bi=(e,t)=>({code:ni,message:t||di.SUCCESS,data:e||{}}),wi={badRequest:e=>new Ai(ri,e),loginFailed:e=>new Ai(si,`${di.LOGIN_FAILED}: ${e}`),loginRequired:()=>new Ai(si,di.LOGIN_REQUIRED),missingParam:e=>new Ai(ri,`Missing required argument: ${e}`),wrongTypeParam:(e,t,i)=>new Ai(ri,`Wrong type of parameter '${e}'. Expected ${t}, but got ${i}`),cannotGetShareInfo:()=>new Ai(ai,"Can not get app info to share"),lengthInvalid:e=>new Ai(ri,`${e} length is invalid.`)};const Ni={encode:function(e){var t=[];for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];if(void 0===n)return;if(null===n)return void t.push(i);t.push(encodeURIComponent(i)+"="+encodeURIComponent(n))}return t.join("&")},decode:function(e,t){var i={};if(""===e)return i;for(var n=e.split("&"),o=0;o<n.length;o++){var r=n[o].split("=",2),a=decodeURIComponent(r[0]);if(t&&Object.prototype.hasOwnProperty.call(i,a))throw new URIError("Duplicate key: "+a);i[a]=2===r.length?decodeURIComponent(r[1]):null}return i},appendToUrl:function(e,t){return e+(-1!==e.indexOf("?")?"&":"?")+("string"==typeof t?t:Ni.encode(t))},getParameterByName:function(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");var i=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null},getParamsAsObject:function(e){var t={};return e?(e.split("&").map((function(e){var i=e.split("=");i&&2==i.length&&(t[i[0]]=decodeURIComponent(i[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),i=[];return t.map((function(t){var n=e[t],o=[t,n="object"==(void 0===n?"undefined":typeof n)?JSON.stringify(n):encodeURIComponent(n)].join("=");i.push(o)})),i.join("&")}},Ci=new RegExp("[\\u0300-\\u036f]","g"),Ii=new RegExp("[đ|Đ]","g"),Pi=new RegExp("\\s","g"),ki=Ut("zmp:utils:common"),Ri=e=>{try{new URL(e)}catch(e){return!1}return!0},Di=()=>navigator.userAgent||navigator.vendor||window.opera,Bi=()=>{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)}},ji=e=>{const t=document.getElementsByTagName("meta");for(let i=0;i<t.length;i++)if(t[i].getAttribute("name")===e||t[i].getAttribute("property")===e)return t[i].getAttribute("content");return""},xi=()=>{const e=Di().toLowerCase().split("zalo")[1];if(e){return e.replace(" ","").split("/")[1]||""}return""},Ui=()=>{let e=Bi();return e.isWP?exports.PlatformType.wp:e.isAndroid?exports.PlatformType.android:e.isIOS?exports.PlatformType.iOS:exports.PlatformType.unknown},Mi=(e,t)=>{const i=t.toLowerCase(),n=i.split(/[<>]/i),o="array"===n[0];return!!("url"===i&&Ri(e)||o&&("array"===i&&Array.isArray(e)||((e,t)=>Array.isArray(t)&&!t.some((t=>"url"===e?!Ri(t):typeof t!==e)))(n[1],e))||!Array.isArray(e)&&typeof e===t)},Li=e=>(e=>{let t=Lt(e);return t||(t=Wt(e),t)?t:Mt(e)})(e),Wi=e=>{if(xt.isObject(JSON)&&JSON.parse&&xt.isString(e)){const t=e.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\x00/g,"");return JSON.parse(t,((e,t)=>t))}return xt.isObject(e)?e:new Function("return "+e)()},zi=e=>{if(xt.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 i=e.length,n=0;n<i;n++)t.push(zi(e[n]));return"["+t.join(",")+"]"}if("object"==typeof e){for(var o in t=new Array,e)t.push('"'+o+'":'+zi(e[o]));return"{"+t.join(",")+"}"}return e.toString()},Ji=()=>{try{const e=Number(xi()),t=Ui();return e>=vi[t]}catch(e){return!0}},Fi=e=>JSON.stringify(e).replace(/"/g,'\\"').replace(/'/g,"&#39;"),Ki=e=>{try{if(e){ki(e);const t=e.replace(/\\/g,"").replace(/&#39;/g,"'");return ki("formattedValue",t,JSON.parse(t),typeof JSON.parse(t)),JSON.parse(t)}return null}catch(t){return ki("parse json error:",t),e}},Gi=(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 d=yield fetch("https://h5.zalo.me/openapi/create-sharelink",Object.assign({method:"POST",body:s},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})),u=yield d.json();if(!u||0!==u.err)throw wi.cannotGetShareInfo();return l.search=`${l.search}&zshareId=${u.data.shareId}`,Object.assign(Object.assign({},u.data),{shareableLink:l.href})})),Hi=(e,t)=>i=>{if(!(Array.isArray(e)?e.some((e=>Mi(i,e))):Mi(i,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(i)),errorMessage:null==t?void 0:t.values.toString()};if(xt.isNumber(null==t?void 0:t.maxLength))return{error:xt.isString(i)&&i.length>(null==t?void 0:t.maxLength),errorMessage:`data length must <= ${null==t?void 0:t.maxLength}`};if(xt.isNumber(null==t?void 0:t.min)&&xt.isNumber(null==t?void 0:t.max))return{error:i<(null==t?void 0:t.min)||i>(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(xt.isNumber(null==t?void 0:t.min))return{error:i<(null==t?void 0:t.min),errorMessage:`data must >= ${null==t?void 0:t.min}`};if(xt.isNumber(null==t?void 0:t.max))return{error:i>(null==t?void 0:t.max),errorMessage:`data must <= ${null==t?void 0:t.max}`};if(xt.isRegExp(null==t?void 0:t.regex))return{error:!t.regex.test(i),errorMessage:"data must valid"}}return{error:!1}},$i=(e,t,n)=>i(void 0,void 0,void 0,(function*(){const i={appId:e,versionStatus:t};xt.isUndefined(n)||(i.currentVersion=n);const o=Ni.appendToUrl(ei,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 Vi=u((function(e){var t=Object.prototype.hasOwnProperty,i="~";function n(){}function o(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function r(e,t,n,r,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new o(n,r||e,a),c=i?i+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 n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),s.prototype.eventNames=function(){var e,n,o=[];if(0===this._eventsCount)return o;for(n in e=this._events)t.call(e,n)&&o.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},s.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,r=n.length,a=new Array(r);o<r;o++)a[o]=n[o].fn;return a},s.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,o,r,a){var s=i?i+e:e;if(!this._events[s])return!1;var c,l,d=this._events[s],u=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),u){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,n),!0;case 4:return d.fn.call(d.context,t,n,o),!0;case 5:return d.fn.call(d.context,t,n,o,r),!0;case 6:return d.fn.call(d.context,t,n,o,r,a),!0}for(l=1,c=new Array(u-1);l<u;l++)c[l-1]=arguments[l];d.fn.apply(d.context,c)}else{var p,h=d.length;for(l=0;l<h;l++)switch(d[l].once&&this.removeListener(e,d[l].fn,void 0,!0),u){case 1:d[l].fn.call(d[l].context);break;case 2:d[l].fn.call(d[l].context,t);break;case 3:d[l].fn.call(d[l].context,t,n);break;case 4:d[l].fn.call(d[l].context,t,n,o);break;default:if(!c)for(p=1,c=new Array(u-1);p<u;p++)c[p-1]=arguments[p];d[l].fn.apply(d[l].context,c)}}return!0},s.prototype.on=function(e,t,i){return r(this,e,t,i,!1)},s.prototype.once=function(e,t,i){return r(this,e,t,i,!0)},s.prototype.removeListener=function(e,t,n,o){var r=i?i+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||n&&s.context!==n||a(this,r);else{for(var c=0,l=[],d=s.length;c<d;c++)(s[c].fn!==t||o&&!s[c].once||n&&s[c].context!==n)&&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=i?i+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=i,s.EventEmitter=s,e.exports=s}));class Zi extends Vi{constructor(){super(),this.debug=Ut("zmp:event-emitter")}static getInstance(){return Zi.instance||(Zi.instance=new Zi),Zi.instance}h5ConfirmHandleEvent(e,t,i){ZaloJavaScriptInterface.jsH5EventCallback(e,t,i||"")}on(e,t,i){this.debug(`register ${e}: ${i}`);return super.on(e,((n,o)=>{this.h5ConfirmHandleEvent(n,e,i),t(o)}),i)}once(e,t,i){this.debug(`register once ${e}: ${i}`);return super.once(e,((n,o)=>{this.h5ConfirmHandleEvent(n,e,i),t(o)}),i)}}var qi,Qi,Yi,Xi,en;class tn{static getVersion(){return"2.22.1"}static getSystemInfo(){return{version:ji("version-id")||"",apiVersion:"2.22.1",zaloVersion:xi(),platform:Ui(),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 $i(e,0,t.version)}))}}class nn{static setNavigationBarTitle(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.CHANGE_TITLE_HEADER,{title:e.title},{haveTimeout:!1})}))}static setNavigationBarColor(e){return i(this,void 0,void 0,(function*(){const t={};let i;xt.isEmpty(e.textColor)||(t.textColor=e.textColor),xt.isString(e.color)&&e.color.length>0?(xt.isEmpty(e.color)||(t.backgroundColor=e.color),i=5):(xt.isEmpty(e.statusBarColor)||(t.backgroundColor=e.statusBarColor),i=6),this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{actionbarType:i,dataConfig:Object.assign(Object.assign({},e.dataConfig),t)}))),yield this.getJSBridge().callNative(pi.CHANGE_ACTIONBAR,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarLeftButton(e,t){return i(this,void 0,void 0,(function*(){let i,n;xt.isString(e)&&(i="none"===e||"home"===e?yi:mi,n="home"===e||"both"===e?_i:Si),this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{buttonType:xt.isNumber(i)?i:e.buttonType,dataConfig:Object.assign(Object.assign({},e.dataConfig),{confirmToExit:xt.isNumber(t)?t:e.dataConfig.confirmToExit,viewInLeftType:xt.isNumber(i)?i:e.dataConfig.viewInLeftType}),homeConfig:Object.assign(Object.assign({},e.homeConfig),{enable:xt.isNumber(n)?n:e.homeConfig.enable})}))),yield this.getJSBridge().callNative(pi.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBar(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.CHANGE_ACTIONBAR,{data:e},{haveTimeout:!1})}))}}class on{static setBackgroundColor(e){return i(this,void 0,void 0,(function*(){xt.isString(e.backgroundColor)&&e.backgroundColor.length>0&&(yield this.getJSBridge().callNative(pi.CHANGE_ACTIONBAR,{actionbarType:this.isShowNavBar?5:6,dataConfig:{backgroundColor:e.backgroundColor,textColor:e.textColor}}))}))}}class rn{constructor(e,t,i,n){this.title=n,this.severity=t;const o=new Date;if(this.time=o.toLocaleTimeString(),this.content=e,i>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(" ")}}qi=new WeakMap,Qi=new WeakMap,Yi=new WeakMap,Xi=new WeakMap,en=new WeakMap;const an=new class{constructor(){qi.set(this,3),Qi.set(this,["none","error","warn","info"]),Yi.set(this,"[zmp] > "),Xi.set(this,{error:0,warn:0,info:0,firstError:null,lastError:null}),en.set(this,((e,t,i)=>{n(this,Xi,"f")[n(this,Qi,"f")[e]]++;const r=n(this,Qi,"f")[e];if(o(this,Yi,n(this,Yi,"f")+("string"!=typeof t?new rn(t,r,e,i).toString():t),"f"),!(e>n(this,qi,"f")))switch(e){case 1:console.error(n(this,Yi,"f"));break;case 2:console.warn(n(this,Yi,"f"));break;case 3:console.info(n(this,Yi,"f"));break;default:throw new Error("internal")}}))}setLogLevel(e){o(this,qi,e,"f")}info(e){n(this,en,"f").call(this,3,e)}warn(e,t){n(this,en,"f").call(this,2,e,t)}error(e,t){n(this,en,"f").call(this,1,e,t)}getMetrics(){return n(this,Xi,"f")}};class sn{static setDeviceOrientation(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.CHANGE_AUTOROTATE,{autoRotate:exports.OrientationType[e.rotate]})}))}static getNetworkType(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.WEBVIEW_NETWORKTYPE,{url:window.location.href,featureId:""}).then((e=>{const t=e.network;let i;const n=Bi().isAndroid;switch(t){case ii(n).NONE:i=exports.NetworkType.none;break;case ii(n).WIFI:i=exports.NetworkType.wifi;break;case ii(n)["2G"]:case ii(n)["3G"]:case ii(n)["4G"]:i=exports.NetworkType.cellular;break;default:i=exports.NetworkType.unknown}return{networkType:i}}))}))}static onNetworkStatusChange(e){return i(this,void 0,void 0,(function*(){yield this.events.on(exports.Events.NetworkChanged,(t=>{const i=t&&t.state;this.getNetworkType().then((t=>{const n={isConnected:"CONNECTED"===i,networkType:t&&t.networkType};e(n)})).catch((e=>{an.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:xt.isNumber(null==e?void 0:e.scanningType)?e.scanningType:0,data:{scan_from_source:xt.isString(null==e?void 0:e.scanFromSource)?e.scanFromSource:"",expire:xt.isNumber(null==e?void 0:e.expire)?e.expire:3e3,monitor_interval:xt.isNumber(null==e?void 0:e.monitorInterval)?e.monitorInterval:60,domain:xt.isString(null==e?void 0:e.domain)?e.domain:"",scan_config:{scan_time:xt.isNumber(null===(t=null==e?void 0:e.scanConfig)||void 0===t?void 0:t.scanTime)?e.scanConfig.scanTime:15e3,time_between_scan:xt.isNumber(null===(n=null==e?void 0:e.scanConfig)||void 0===n?void 0:n.timeBetweenScan)?e.scanConfig.timeBetweenScan:1e4,beacon_timeout:xt.isNumber(null===(o=null==e?void 0:e.scanConfig)||void 0===o?void 0:o.beaconTimeout)?e.scanConfig.beaconTimeout:3e4,delayCheckConnectedTimeout:xt.isNumber(null===(r=null==e?void 0:e.scanConfig)||void 0===r?void 0:r.delayCheckConnectedTimeout)?e.scanConfig.delayCheckConnectedTimeout:5e3,beaconConnectedTimeout:xt.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.getJSBridge().callNative(pi.SCAN_IBEACON,Object.assign({},i)),!0}))}static stopBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.SCAN_IBEACON,Object.assign({},{subaction:2})),!0}))}static getBeacons(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.SCAN_IBEACON,Object.assign({},{subaction:1}),{isMultiCallback:!0}).then((e=>{const t={beacons:[]};return Array.isArray(e)&&e.forEach((e=>{const i={uuid:e.uuid,major:e.major,minor:e.minor,distance:e.distance,rssi:e.rssi};t.beacons.push(i)})),t}))}))}static stopBluetoothDevicesDiscovery(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static startBluetoothDevicesDiscovery(e){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},Object.assign({},e))}))}static openBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static onBluetoothDeviceFound(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().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.getJSBridge().callNative({name:""},t)}))}static getBluetoothDevices(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static getBluetoothAdapterState(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static closeBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static scanQRCode(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.OPEN_QR,{skipOpenLink:!0})}))}static showToast(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.SHOW_TOAST,{toast:e.message})}))}static hideKeyboard(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.HIDE_KEYBOARD,{})}))}static openPhone(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.OPEN_PHONE,{phoneNum:e.phoneNumber,phoneCode:e.phoneNumber})}))}static openSMS(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.OPEN_SMS,{content:e.content,phoneCode:e.phoneNumber})}))}static keepScreen(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.KEEP_SCREEN,{data:{keep_screen_on:e.keepScreenOn?1:0}})}))}static openBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.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,i,n,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===(i=null==e?void 0:e.data)||void 0===i?void 0:i.error_code,message:null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.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.getJSBridge().callNative(pi.PROMPT_AUTHENTICATION_CHECK_STATE,{}).then((e=>({bioState:null==e?void 0:e.bio_state})))}))}static vibrate(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.INTERACTIVE_VIBRATION,{type:exports.VibrateType[e.type],vibrate_time:e.milliseconds})}))}static connectWifi(e){return i(this,void 0,void 0,(function*(){let t="open";return xt.isString(e.password)&&e.password.length>0&&(t="wpa_wpa2"),yield this.getJSBridge().callNative(pi.MP_JOIN_WIFI,{ssid:e.SSID,securityType:t,password:e.password,hiddenSsid:e.hiddenSSID})}))}static openAppStore(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.OPEN_APPSTORE,e)}))}}var cn,ln,dn;class un{constructor(e){cn.set(this,localStorage),ln.set(this,void 0),dn.set(this,void 0),Bi(),o(this,dn,{keys:new Set,currentSize:0,limitSize:5242880},"f"),o(this,ln,e,"f"),this.findAllCurrentDataByApp(e)}findAllCurrentDataByApp(e){try{let t;for(t in n(this,cn,"f")){if(e){if(t.split("_")[0]!==e)continue}n(this,dn,"f").keys.add(t)}}catch(e){an.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 n(this,ln,"f")&&(e=`${n(this,ln,"f")}_${e}`),n(this,dn,"f").keys.has(e)?n(this,cn,"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){n(this,ln,"f")&&(e=`${n(this,ln,"f")}_${e}`),n(this,cn,"f").setItem(e,t),n(this,dn,"f").keys.add(e)}getInfo(){return i(this,void 0,void 0,(function*(){return Promise.resolve(this.getInfoSync())}))}getInfoSync(){const e=((e,t)=>{let i,n,o=0;for(n in e){const r=n.split("_")[0];e.hasOwnProperty(n)&&(t&&r!==t||(i=2*(e[n].length+n.length),o+=i))}return o})(n(this,cn,"f"),n(this,ln,"f"));return{currentSize:xt.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){n(this,ln,"f")&&(e=`${n(this,ln,"f")}_${e}`),n(this,dn,"f").keys.has(e)&&(n(this,cn,"f").removeItem(e),n(this,dn,"f").keys.delete(e))}clear(){return i(this,void 0,void 0,(function*(){return Promise.resolve(this.clearSync())}))}clearSync(){n(this,dn,"f").keys.forEach((e=>{n(this,ln,"f")&&e.indexOf(n(this,ln,"f"))<0||(n(this,cn,"f").removeItem(e),n(this,dn,"f").keys.delete(e))}))}}cn=new WeakMap,ln=new WeakMap,dn=new WeakMap;var pn={},hn=function(e,t,i){var n=t||"default";return function(){var t=n in pn?pn[n](e,i):e;return t.apply(this,arguments)}};hn.setWrapper=function(e){var t=arguments.length<=1||void 0===arguments[1]?"default":arguments[1];pn[t]=e};var vn={error:{code:1,error_subcode:1357046,message:"Received Invalid JSON reply.",type:"http"}};function fn(e){try{return null===e?vn:JSON.parse(e)}catch(e){return vn}}var gn,mn,yn,_n,Sn,En,On,An,Tn,bn,wn,Nn,Cn,In,Pn,kn,Rn,Dn,Bn,jn,xn,Un,Mn,Ln,Wn,zn,Jn,Fn,Kn,Gn,Hn={execute:function(e,t,i,n){i.suppress_http_code=1;var o=Ni.encode(i);"post"!=t&&(e=Ni.appendToUrl(e,o),o="");var r=function(e,t){if(!self.XMLHttpRequest)return null;var i=new XMLHttpRequest,n=function(){};if(!("withCredentials"in i))return null;i.open(e,t,!0),i.setRequestHeader("Content-type","application/x-www-form-urlencoded");var o={send:function(e){i.send(e)}},r=hn((function(){r=n,"onload"in o&&o.onload(i)}),"entry","XMLHttpRequest:load"),a=hn((function(){a=n,"onerror"in o&&o.onerror(i)}),"entry","XMLHttpRequest:error");return i.onload=function(){r()},i.onerror=function(){a()},i.onreadystatechange=function(){4==i.readyState&&(200==i.status?r():a())},o}(t,e);return!!r&&(r.onload=function(e){n(fn(e.responseText))},r.onerror=function(e){e.responseText?n(fn(e.responseText)):n({error:{code:1,error_subcode:1357045,message:"unknown error (empty response)",status:e.status,type:"http"}})},r.send(o),!0)}};class $n extends Vi{constructor(){super(),gn.add(this),this.debug=Ut("zmp:ZaloJSBridge"),this.events=Zi.getInstance(),this._accessTk=Li("zacc_session")||"DEFAULT_ACCESS_TOKEN",this._jsAccessTk=Li("zlink3rd")||"DEFAULT_JS_TOKEN",this.results=[],this._userAgent=Di(),this._device=Bi(),this.isJumped=!1,mn.set(this,null),yn.set(this,void 0),this.jump=()=>new Promise(((e,t)=>{xt.isUndefined(n(this,mn,"f"))||xt.isNull(n(this,mn,"f"))?this.callNative(pi.JUMP_LOGIN,{}).then((t=>{const i=t&&t.cookiesOAuthLogins||[],r=t&&t.actionPermission||[];Object.entries(r).forEach((e=>{const t=e[0],i=e[1]||{perm:0,decode:0};n(this,yn,"f")[t]||(n(this,yn,"f")[t]={permission:!1,support:!1}),n(this,yn,"f")[t].permission=1===i.perm}));const a=i.find((e=>e.name===Gt));a&&(this.jsAccessTk=a.value,window.ZJSBridge.setJSToken&&window.ZJSBridge.setJSToken(a.value)),o(this,mn,i,"f"),this.isJumped=!0,e(i)})).catch((e=>{this.isJumped=!1,t(e)})):e(n(this,mn,"f"))})),this._jsCallFuncCallbacks={},o(this,yn,{},"f"),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 $n.instance||($n.instance=new $n),$n.instance}set accessTk(e){this._accessTk=e}set jsAccessTk(e){this._jsAccessTk=e}sendLogData(e){try{const t=e.map((e=>({action:e.action,error:e.error})));Hn.execute(ti,"post",{appId:window.APP_ID,data:JSON.stringify(t)},(e=>{})),window.zmpSentry&&window.zmpSentry.captureMessage("Result from native",{extra:{data:e}})}catch(e){}}onJSCall(e,t){try{this.debug("onJSCall",e,t);const i=Wi(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,n=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,i)}catch(e){console.error("Call callback error",e)}n&&clearTimeout(n),this._jsCallFuncCallbacks[e]=null,delete this._jsCallFuncCallbacks[e]}}this.results.push({action:i.action,error:i.error_code,message:i.error_message})}catch(e){console.log("onJSCall","error",e)}}onMultiJSCall(e,t){try{this.debug("onMultiJSCall",e,t);const i=Wi(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,n=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,i)}catch(e){console.error("Call callback error",e)}n&&clearTimeout(n)}}this.results.push({action:i.action,error:i.error_code,message:i.error_message})}catch(e){console.log("onMultiJSCall","error",e)}}nativeEventHandler(e,t,i){this.debug(`eventId: ${e}, eventName: ${t}, eventData: ${i}`);const n=Ki(i);this.debug(n);const o=this.handleEventData(t,n);this.events.emit(t,e,o)}handleEventData(e,t){try{switch(e){case exports.Events.OpenApp:const{url:e}=t,i=new URL(e),n=i.pathname.split(`/zapps/${Jt}`)[1];return{path:`${n||"/"}${i.search}`};default:return t}}catch(e){return t}}defaultCallback(e){null!=e&&(e=Wi(e))}callNative(e,t,o){return this.debug(e.name,t),new Promise(((r,a)=>{const s=t=>i(this,void 0,void 0,(function*(){var i,n,s,c,l,d,u,p;try{if(xt.isUndefined(t)||xt.isNull(t))return a(new Error("Native callback is null"));if(0!==t.error_code){let o=new Ai(t.error_code,t.error_message);const r=Ui();if(e===pi.JUMP_LOGIN)o=new Ai(oi,`Can not get auth code: ${t.error_message}`);else if(this.isJumped||e.skip_jump){if("permission required!"===String(o.message).toLowerCase()||"no permission!"===String(o.message).toLowerCase())o=new Ai(ui.FORBIDDEN.code,ui.FORBIDDEN.message);else if(hi[r][t.error_code])o=new Ai(hi[r][t.error_code].code,hi[r][t.error_code].message);else if(null===(n=null===(i=e.error_list)||void 0===i?void 0:i[r])||void 0===n?void 0:n[String(t.error_code)]){let i=e.error_list[r][String(t.error_code)].map_to.message;(null===(l=null===(c=null===(s=e.error_list)||void 0===s?void 0:s[r])||void 0===c?void 0:c[String(t.error_code)])||void 0===l?void 0:l.need_more_detail)&&(i=`${null===(p=null===(u=null===(d=e.error_list)||void 0===d?void 0:d[r])||void 0===u?void 0:u[String(t.error_code)])||void 0===p?void 0:p.map_to.message}: ${t.error_message}`),o=new Ai(e.error_list[r][String(t.error_code)].map_to.code,i)}}else o=new Ai(ui.UNAUTHORIZED.code,ui.UNAUTHORIZED.message);return a(o)}if(null==o?void 0:o.successCallback){const e=yield o.successCallback(t.data);return r(e)}r(t.data||{})}catch(e){return a(e)}})),c=Bi().isIOS,l=(e=>{var t;const i=xi(),n=(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))||i>=n})(e);if(c&&!l){const e=new Ai(-5,"Client isn't support this action");return a(e)}(null==o?void 0:o.delay)?setTimeout((()=>{n(this,gn,"m",_n).call(this,e,t,s,null==o?void 0:o.isMultiCallback,null==o?void 0:o.nRetry,null==o?void 0:o.haveTimeout)}),o.delay):n(this,gn,"m",_n).call(this,e,t,s,null==o?void 0:o.isMultiCallback,null==o?void 0:o.nRetry,null==o?void 0:o.haveTimeout)}))}}mn=new WeakMap,yn=new WeakMap,gn=new WeakSet,_n=function e(t,i,o,r=!1,a=3,s=!0){try{const c=t.name,l=((e="")=>`${e.normalize("NFD").replace(Ci,"").replace(Ii,"d").replace(Pi,"").toLowerCase()}_${Math.random().toString(36).substr(2,4)}`)(c);if(!this._device.isMobile||xt.isEmpty(c))return this.onJSCall(l,{error_code:-13,error_message:"params invalid!",data:{device:this._device.isMobile,jsToken:this._jsAccessTk,access_token:this._accessTk},action:c}),!1;null==i&&(i={}),o||(o=this.defaultCallback);const d={error_code:-14,error_message:"Request Timeout!",data:{},action:c};this._jsCallFuncCallbacks[l]={timeout:s&&t.have_callback&&setTimeout((()=>{this.onJSCall(l,d)}),8e3),callback:o};try{return i=zi(i),r?this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,window.onMultiJSCall(l)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,`window.onMultiJSCall('${l}')`):this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,window.onJSCall(l)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,`window.onJSCall('${l}')`)}catch(s){if(!(a-- >0)){const e={error_code:-5,error_message:"Not ready!",data:{userAgent:this._userAgent,options:i,jsToken:this._jsAccessTk,access_token:this._accessTk},action:c,js_error:s};return this.onJSCall(l,e),!1}setTimeout((()=>{n(this,gn,"m",e).call(this,t,i,o,r,a)}),500)}}catch(e){console.log("jsCall","error",e)}return!1};class Vn{constructor(e){Sn.set(this,void 0),En.set(this,void 0),On.set(this,void 0),o(this,En,{keys:new Set,currentSize:0,limitSize:5242880},"f"),o(this,Sn,e,"f"),o(this,On,$n.getInstance(),"f")}get(e){return i(this,void 0,void 0,(function*(){return yield n(this,On,"f").callNative(pi.ZBROWSER_MPDS,{mpds_action:"mpds.get",mpds_data:{keys:e},appId:n(this,Sn,"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 n(this,On,"f").callNative(pi.ZBROWSER_MPDS,{mpds_action:"mpds.set",mpds_data:{map:e},appId:n(this,Sn,"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 n(this,On,"f").callNative(pi.ZBROWSER_MPDS,{mpds_action:"mpds.get.size",mpds_data:{},appId:n(this,Sn,"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:xt.isNumber(e)?Number(e/1024):0,limitSize:Number(5120)}}))}remove(e){return i(this,void 0,void 0,(function*(){return{errorKeys:yield n(this,On,"f").callNative(pi.ZBROWSER_MPDS,{mpds_action:"mpds.remove.key",mpds_data:{keys:e},appId:n(this,Sn,"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 n(this,On,"f").callNative(pi.ZBROWSER_MPDS,{mpds_action:"mpds.clear.appData",mpds_data:{},appId:n(this,Sn,"f")})}))}}Sn=new WeakMap,En=new WeakMap,On=new WeakMap;class Zn{getDataFromStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance(),i=yield t.get(e),n={};return i.forEach(((e,t)=>{n[t]=Ki(e)})),n}))}putDataToStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance(),i={};return Object.entries(e).forEach((([e,t])=>{xt.isUndefined(t)||xt.isNull(t)||(i[e]=Fi(t))})),yield t.set(i)}))}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 qn extends Zn{constructor(e){super(),An.set(this,void 0),o(this,An,e,"f")}getInstance(){return new un(n(this,An,"f"))}}An=new WeakMap;class Qn extends Zn{constructor(e){super(),Tn.set(this,void 0),o(this,Tn,e,"f")}getInstance(){return new Vn(n(this,Tn,"f"))}}Tn=new WeakMap;class Yn{static setStorage(e){return i(this,void 0,void 0,(function*(){let t=new qn(this.getAppId());return Ji()&&(t=new Qn(this.getAppId())),yield t.putDataToStorage(e.data)}))}static getStorage(e){return i(this,void 0,void 0,(function*(){let t=new qn(this.getAppId());Ji()&&(t=new Qn(this.getAppId()));return yield t.getDataFromStorage(e.keys)}))}static getStorageInfo(e){return i(this,void 0,void 0,(function*(){let e=new qn(this.getAppId());return Ji()&&(e=new Qn(this.getAppId())),yield e.getStorageInfo()}))}static removeStorage(e){return i(this,void 0,void 0,(function*(){let t=new qn(this.getAppId());return Ji()&&(t=new Qn(this.getAppId())),yield t.removeDataFromStorage(e.keys)}))}static clearStorage(e={}){return i(this,void 0,void 0,(function*(){let e=new qn(this.getAppId());Ji()&&(e=new Qn(this.getAppId())),yield e.clearStorage()}))}}class Xn{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(`${qt}?fields=${n}`,{headers:{access_token:t||""}}).then((e=>i(this,void 0,void 0,(function*(){const t=yield e.json(),i={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"),i}))))}}))}static getPhoneNumber(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.MP_GET_NUMBER,{},{isMultiCallback:!0,successCallback:e=>{const t={number:e};return Promise.resolve(t)},delay:this.isIOS?400:0})}))}}class eo{static closeApp(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.WINDOW_CLOSE,{})}))}static openMiniApp(e){return i(this,void 0,void 0,(function*(){const t=null==e?void 0:e.appId,i=(null==e?void 0:e.params)||{},n=Object.entries(i).map((function([e,t]){return[e,t].join("=")})).join("&");let o;try{o=yield $i(t,0)}catch(e){}const r={appId:t};o&&(r.appName=o.name,r.appAvtUrl=o.logoUrl),yield this.getJSBridge().callNative(pi.OPEN_MP,{mpUrl:`https://h5.zdn.vn/zapps/${t}/${n.length>0?"?"+n:""}`,mpInfo:r})}))}static openWebview(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.OPEN_INAPP,{url:e})}))}static closeLoading(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.MP_CLOSE_LOADINGVIEW,{at:(new Date).getTime(),when:e,url:location.href})}))}}class to{static getLocation(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.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,successCallback:e=>{const t={latitude:e.latitude,longitude:e.longitude,timestamp:e.timestamp,provider:e.provider};return Promise.resolve(t)},delay:this.isIOS?400:0})}))}static sendLocation(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.QUERY_LOCATION_HIDE,{title:e.title,touserid:e.toUserId,zapp:this.getZAppId()})}))}}class io{static requestCameraPermission(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.REQUEST_PERMISSION_CAMERA,{},{successCallback:()=>Promise.resolve({userAllow:!0,message:"User Allow"})})}))}static saveImageToPhotosAlbum(e){return i(this,void 0,void 0,(function*(){let t={};return xt.isEmpty(e.imageBase64Data)?xt.isEmpty(e.imageUrl)||(t={imageUrl:e.imageUrl}):t={imageBase64Data:e.imageBase64Data},yield this.getJSBridge().callNative(pi.SAVE_IMAGE_GALLERY,Object.assign({},t))}))}}class no{static viewOAQr(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.VIEW_MYQR,{dpn:e.displayName,uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openProfile(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.OPEN_PROFILE,{uId:e.id,type:exports.ProfileType[e.type],zapp:this.getZAppId(),sourceId:e.sourceId,sourceIndex:e.sourceIndex})}))}static openChat(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.OPEN_CHAT,{uId:e.id,type:exports.ChatType[e.type],msg:e.message||"",zapp:this.getZAppId(),sourceId:e.sourceId,sourceIndex:e.sourceIndex})}))}static openPostFeed(e){return i(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.getJSBridge().callNative(pi.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 i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.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.getJSBridge().callNative(pi.UNFOLLOW_OA,{uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openShareSheet(e){return i(this,void 0,void 0,(function*(){let t={},i=e.type;switch(e.type){case"image":let n=[];const o=xi(),r=Ui();o>=fi[r]&&(i="multi_image"),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 a=yield this.getAccessToken(),s=yield Gi(this.getAppId(),a||"",e.data.title||"",e.data.description||"",e.data.thumbnail||"",e.data.path);window.forceShareZMP?t={data:{ZInstantAPIInfo:{url:`${s.zinstantApi}`,zinstantdata_id:`templateId=${s.ztemplateId}&appId=${this.getAppId()}&shareId=${s.shareId}`},previewMsgText:{msg:{en:"Zalo Mini Program",vi:"Chương trình nhỏ"}},enableReactions:1}}:(t={link:s.shareableLink,chatOnly:e.data.chatOnly?1:0},e.type="link")}return yield this.getJSBridge().callNative(pi.OPEN_SHARESHEET,Object.assign(Object.assign({type:exports.ShareSheetType[i]},t),{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.getJSBridge().callNative(pi.CREATE_SHORTCUT,{url:e,title:t,iconUrl:n})}))}static openProfilePicker(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.MP_OPEN_PROFILE_PICKER,{maxProfile:e},{isMultiCallback:!0,successCallback:e=>{if(Array.isArray(e))return Promise.resolve(e.map((e=>e.id)))}})}))}static getActionsSupported(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.GET_SUPPORTED_ACTIONS,{},{isMultiCallback:!1,successCallback:e=>{const t=Ui();if(Array.isArray(e.actions)&&e.actions.length>0){const t=Object.keys(pi).filter((e=>pi[e].skip_jump)),i={actions:[...e.actions,...t]};return Promise.resolve(i)}if(t===exports.PlatformType.iOS){const e={actions:gi};return Promise.resolve(e)}}})}))}static openMediaPicker(e,t,n,o,r,a){return i(this,void 0,void 0,(function*(){const i={type:0,url:t,maxSize:n||1048576};return yield this.getJSBridge().callNative(pi.PICK_MEDIA,{media_type:exports.MediaPickerType[e],edit_view:Object.assign(Object.assign({},{enable:1,aspect_ratio:"1:1"}),o),silent_request:r,upload:i,max_select_items:a},{isMultiCallback:!0,successCallback:e=>{const t={data:null==e?void 0:e.result_content};return Promise.resolve(t)}})}))}static openOutApp(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.OPEN_OUTAPP,{url:e})}))}}class oo{static getRouteParams(){let e={};const t=window.location.href;try{let i=new URL(t).searchParams.toString();i&&(e=Ni.getParamsAsObject(i))}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.getJSBridge().callNative(pi.WEBVIEW_SET_RESULT,{result:Fi(e.data)})}))}static onCallbackData(e){return i(this,void 0,void 0,(function*(){yield this.events.on(exports.Events.OnDataCallback,(t=>{e({data:t})}))}))}}class ro{constructor(){var e,t,i,r,a,s,c,l,d,u,p,h,v,f,g,m,y;bn.set(this,zt),wn.set(this,Jt),Nn.set(this,Ft),Cn.set(this,void 0),In.set(this,void 0),Pn.set(this,void 0),kn.set(this,null),Rn.set(this,{timer:{getToken:0}}),Dn.set(this,void 0),Bn.set(this,void 0),jn.set(this,void 0),xn.set(this,void 0),Un.set(this,void 0),this.events=Zi.getInstance(),this.isIOS=Bi().isIOS,Mn.set(this,void 0),this.getActionBarConfig=()=>n(this,Mn,"f"),this.setActionBarConfig=e=>{o(this,Mn,e(n(this,Mn,"f")),"f")},this.getVersion=tn.getVersion,this.getSystemInfo=tn.getSystemInfo,this.setNavigationBarTitle=nn.setNavigationBarTitle,this.setNavigationBarColor=nn.setNavigationBarColor,this.setNavigationBarLeftButton=nn.setNavigationBarLeftButton,this.setBackgroundColor=on.setBackgroundColor,this.setDeviceOrientation=sn.setDeviceOrientation,this.setStorage=Yn.setStorage,this.getStorage=Yn.getStorage,this.getStorageInfo=Yn.getStorageInfo,this.removeStorage=Yn.removeStorage,this.clearStorage=Yn.clearStorage,this.getUserInfo=Xn.getUserInfo,this.getNetworkType=sn.getNetworkType,this.onNetworkStatusChange=sn.onNetworkStatusChange,this.startBeaconDiscovery=sn.startBeaconDiscovery,this.stopBeaconDiscovery=sn.stopBeaconDiscovery,this.getBeacons=sn.getBeacons,this.closeApp=eo.closeApp,this.getLocation=to.getLocation,this.stopBluetoothDevicesDiscovery=sn.stopBluetoothDevicesDiscovery,this.startBluetoothDevicesDiscovery=sn.stopBluetoothDevicesDiscovery,this.openBluetoothAdapter=sn.openBluetoothAdapter,this.onBluetoothDeviceFound=sn.onBluetoothDeviceFound,this.onBluetoothAdapterStateChange=sn.onBluetoothAdapterStateChange,this.getConnectedBluetoothDevices=sn.getConnectedBluetoothDevices,this.getBluetoothDevices=sn.getBluetoothDevices,this.getBluetoothAdapterState=sn.getBluetoothAdapterState,this.closeBluetoothAdapter=sn.closeBluetoothAdapter,this.scanQRCode=sn.scanQRCode,this.openProfile=no.openProfile,this.openChat=no.openChat,this.openPostFeed=no.openPostFeed,this.followOA=no.followOA,this.unFollowOA=no.unfollowOA,this.openShareSheet=no.openShareSheet,this.requestCameraPermission=io.requestCameraPermission,this.createShortcut=no.createShortcut,this.openBioAuthentication=sn.openBioAuthentication,this.checkStateBioAuthentication=sn.checkStateBioAuthentication,this.sendLocation=to.sendLocation,this.showToast=sn.showToast,this.hideKeyboard=sn.hideKeyboard,this.openPhone=sn.openPhone,this.openSMS=sn.openSMS,this.viewOAQr=no.viewOAQr,this.keepScreen=sn.keepScreen,this.saveImageToPhotosAlbum=io.saveImageToPhotosAlbum,this.openMiniApp=eo.openMiniApp,this.vibrate=sn.vibrate,this.openWebview=eo.openWebview,this.getRouteParams=oo.getRouteParams,this.getAppInfo=tn.getAppInfo,this.sendDataToPreviousMiniApp=oo.sendDataToPreviousMiniApp,this.onCallbackData=oo.onCallbackData,this.getPhoneNumber=Xn.getPhoneNumber,this.openProfilePicker=no.openProfilePicker,Ln.set(this,no.getActionsSupported),this.connectWifi=sn.connectWifi,this.openMediaPicker=no.openMediaPicker,this.openOutApp=no.openOutApp,this.closeLoading=eo.closeLoading,this.openAppStore=sn.openAppStore,o(this,Cn,null,"f"),o(this,In,null,"f"),o(this,Pn,null,"f"),this.isShowNavBar=!0,o(this,Bn,0,"f"),o(this,jn,0,"f"),o(this,xn,"","f"),o(this,Un,null,"f"),o(this,Dn,$n.getInstance(),"f");const _="home"===(null===(t=null===(e=n(this,Nn,"f"))||void 0===e?void 0:e.app)||void 0===t?void 0:t.leftButton)||"both"===(null===(r=null===(i=n(this,Nn,"f"))||void 0===i?void 0:i.app)||void 0===r?void 0:r.leftButton)?_i:Si,S=new URL(location.href),E=xt.isString(null===(s=null===(a=n(this,Nn,"f"))||void 0===a?void 0:a.app)||void 0===s?void 0:s.headerColor)&&(null===(d=null===(l=null===(c=n(this,Nn,"f"))||void 0===c?void 0:c.app)||void 0===l?void 0:l.headerColor)||void 0===d?void 0:d.length)>0?5:6,O="none"===(null===(p=null===(u=n(this,Nn,"f"))||void 0===u?void 0:u.app)||void 0===p?void 0:p.leftButton)||"home"===(null===(v=null===(h=n(this,Nn,"f"))||void 0===h?void 0:h.app)||void 0===v?void 0:v.leftButton)?yi:mi;o(this,Mn,{actionbarType:E,buttonType:O,dataConfig:{backgroundColor:(null===(g=null===(f=n(this,Nn,"f"))||void 0===f?void 0:f.app)||void 0===g?void 0:g.headerColor)||"",textColor:(null===(y=null===(m=n(this,Nn,"f"))||void 0===m?void 0:m.app)||void 0===y?void 0:y.textColor)||"",viewInLeftType:O,confirmToExit:1},homeConfig:{enable:_,url:`https://h5.zdn.vn/zapps/${this.getAppId()}/${S.search}`}},"f")}static getInstance(){return ro.instance||(ro.instance=new ro),ro.instance}getLoginStatus(){return xt.isString(n(this,Pn,"f"))&&n(this,Pn,"f").length>0}getAppId(){return n(this,wn,"f")}getZAppId(){return n(this,bn,"f")}getDeviceId(){return n(this,xn,"f")}getContext(){return n(this,Un,"f")}getJSBridge(){return n(this,Dn,"f")}login(e){return i(this,void 0,void 0,(function*(){const e=(new Date).getTime()-n(this,Bn,"f");if(n(this,Pn,"f")&&e<n(this,jn,"f"))return n(this,Pn,"f");const t=yield n(this,Dn,"f").jump(),i=t.find((e=>e.name===$t)),r=t.find((e=>e.name===Vt)),a=t.find((e=>e.name===Zt));i&&o(this,xn,i.value,"f"),r&&a&&o(this,Un,{id:r.value,type:a.value},"f");const s=t.find((e=>e.name===Kt)),c=t.find((e=>e.name===Ht));if(!xt.isUndefined(s)&&!xt.isNull(s)&&xt.isString(s.value)){if(o(this,Cn,s.value,"f"),xt.isUndefined(c)||xt.isNull(c)||!xt.isString(c.value)?yield this.loginZaloV3():(o(this,In,c.value,"f"),yield this.loginZaloV4()),!n(this,Pn,"f"))throw wi.loginFailed("Invalid authorization code");return n(this,Pn,"f")}throw wi.loginFailed("Zalo app has not been activated")}))}loginZaloV3(){return i(this,void 0,void 0,(function*(){return yield fetch(`${Yt}?app_id=${n(this,bn,"f")}&redirect_uri=https://h5.zdn.vn/zapps/${n(this,wn,"f")}/&code=${n(this,Cn,"f")}&isSDK=true`).then((e=>i(this,void 0,void 0,(function*(){let t=yield e.json();if(t.access_token){o(this,Pn,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return o(this,jn,e,"f"),o(this,Bn,(new Date).getTime(),"f"),n(this,Dn,"f").accessTk=n(this,Pn,"f")||"",window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(n(this,Pn,"f")||""),n(this,Pn,"f")}return null}))))}))}loginZaloV4(){return i(this,void 0,void 0,(function*(){const e=new URLSearchParams;e.append("app_id",n(this,wn,"f")),e.append("code",n(this,Cn,"f")||""),e.append("code_verifier",n(this,In,"f")||""),xt.isNull(n(this,kn,"f"))?e.append("grant_type","authorization_code"):(e.append("grant_type","refresh_token"),e.append("refresh_token",n(this,kn,"f")||""));return yield fetch(Qt,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&&o(this,kn,t.refresh_token,"f"),t.access_token){o(this,Pn,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return o(this,jn,e,"f"),o(this,Bn,(new Date).getTime(),"f"),n(this,Dn,"f").accessTk=n(this,Pn,"f")||"",window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(n(this,Pn,"f")||""),n(this,Pn,"f")}return null}))))}))}getAccessToken(e){return i(this,void 0,void 0,(function*(){const e=(new Date).getTime()-n(this,Bn,"f");if(!n(this,Pn,"f"))throw wi.loginRequired();return e<n(this,jn,"f")?n(this,Pn,"f"):yield this.login()}))}}bn=new WeakMap,wn=new WeakMap,Nn=new WeakMap,Cn=new WeakMap,In=new WeakMap,Pn=new WeakMap,kn=new WeakMap,Rn=new WeakMap,Dn=new WeakMap,Bn=new WeakMap,jn=new WeakMap,xn=new WeakMap,Un=new WeakMap,Mn=new WeakMap,Ln=new WeakMap;class ao{constructor(){Wn.set(this,zt),zn.set(this,Ft),Jn.set(this,"DEFAULT ZOAUTH"),Fn.set(this,"DEFAULT ACCESS TOKEN"),Kn.set(this,{timer:{getToken:0}}),Gn.set(this,!1),this.getLoginStatus=()=>n(this,Gn,"f"),this.getAppId=()=>n(this,Wn,"f"),this.getDeviceId=()=>"",this.login=()=>(o(this,Gn,!0,"f"),Promise.resolve(n(this,Jn,"f"))),this.getAccessToken=()=>Promise.resolve(n(this,Fn,"f")),this.getVersion=tn.getVersion,this.getSystemInfo=tn.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 qn(this.getAppId());return yield t.putDataToStorage(e.data),{errorKeys:[]}})),this.getStorage=e=>i(this,void 0,void 0,(function*(){const t=new qn(this.getAppId());return yield t.getDataFromStorage(e.keys)})),this.getStorageInfo=e=>i(this,void 0,void 0,(function*(){const e=new qn(this.getAppId());return yield e.getStorageInfo()})),this.removeStorage=e=>i(this,void 0,void 0,(function*(){const t=new qn(this.getAppId());return yield t.removeDataFromStorage(e.keys)})),this.clearStorage=e=>i(this,void 0,void 0,(function*(){const e=new qn(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,i=t.effectiveType;return t.addEventListener("change",(function(){let t;switch(i){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),Promise.resolve()),this.getRouteParams=oo.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(),this.openAppStore=e=>Promise.resolve()}getContext(){return null}on(e,t,i){throw new Error("Method not implemented.")}once(e,t,i){throw new Error("Method not implemented.")}off(e,t,i,n){throw new Error("Method not implemented.")}removeAllListeners(e){throw new Error("Method not implemented.")}openMediaPicker(e,t,i,n,o,r){return console.warn("This api only works on zalo app"),Promise.resolve({data:""})}}Wn=new WeakMap,zn=new WeakMap,Jn=new WeakMap,Fn=new WeakMap,Kn=new WeakMap,Gn=new WeakMap;const so=Symbol("required"),co=Symbol("checkType"),lo=(e,t)=>(i,n,o)=>{let r=Reflect.getOwnMetadata(so,i,n)||[];r.push({parameterIndex:o,fields:e,option:t}),Reflect.defineMetadata(so,r,i,n)},uo=(e,t,i)=>(n,o,r)=>{let a=Reflect.getOwnMetadata(co,n,o)||[];a.push({parameterIndex:r,type:e,properties:t,defaultValue:i}),Reflect.defineMetadata(co,a,n,o)};function po(e,t){Reflect.getMetadataKeys(e).map((i=>{const n=Reflect.getMetadata(i,e);Reflect.defineMetadata(i,n,t)}))}const ho=(e,t={})=>i=>{var n;let o=Object.getOwnPropertyDescriptors(i.prototype);if(t.deep){let e=Object.getPrototypeOf(i);for(;e.prototype;){const t=Object.getOwnPropertyDescriptors(e.prototype);o=Object.assign(Object.assign({},t),o),e=Object.getPrototypeOf(e)}}for(const[r,a]of Object.entries(o)){const o="function"==typeof a.value&&"constructor"!=r;if(null===(n=t.exclude)||void 0===n?void 0:n.includes(r))continue;if(t.excludePrefix&&r.startsWith(t.excludePrefix))continue;if(!o)continue;const s=a.value;e(i,r,a),s!=a.value&&po(s,a.value),Object.defineProperty(i.prototype,r,a)}},vo=(e,t,i)=>{const n=i.value,o=function(e){return e.toString().match(/\(.*?\)/)[0].replace(/[()]/gi,"").replace(/\s/gi,"").split(",")}(n);return i.value=function(...i){try{const r=Reflect.getOwnMetadata(so,e.prototype,t),a=Reflect.getOwnMetadata(co,e.prototype,t);a&&a.forEach((e=>{const{parameterIndex:t,type:n,properties:r,defaultValue:a}=e;let s=i[t],c=o[t];const l=typeof s;if(!xt.isUndefined(s)){if(!Mi(s,n))throw wi.wrongTypeParam(c,n,Array.isArray(s)?"array":null===s?"null":l);"object"===n&&Object.entries(r).forEach((([e,n])=>{const o=e.split("?")[0],r=xt.get(s,o);if(xt.isUndefined(r)||xt.isNull(r)){if(!e.includes("?"))throw wi.missingParam(e);xt.get(s,o.split(".")[0])||!a||xt.isUndefined(xt.get(a,o))||xt.set(i[t],o,xt.get(a,o))}else if(xt.isFunction(n)){const e=n(r);if(e&&e.error)throw wi.wrongTypeParam(`${c}.${o}`,e.errorMessage,typeof r)}}))}})),r&&r.forEach((e=>{const{parameterIndex:t,option:n,fields:o}=e,r=i[t],a=null==n?void 0:n.if,s=null==n?void 0:n.defaultValue;let c=!0;a&&(c=Object.keys(a).every((e=>xt.get(r,e)===a[e]))),c&&o.forEach((e=>{const n=e=>{let n=!1;return xt.isEmpty(xt.get(r,e))&&(xt.isUndefined(xt.get(s,e))||xt.set(i[t],e,xt.get(s,e)),n=!0),n};if(Array.isArray(e)&&e.length>0&&e.every(n))throw wi.missingParam(e.join(" or "));if(xt.isString(e)&&n(e))throw wi.missingParam(e)}))}));const s=n.call(this,...i);if(xt.isPromise(s)){const{success:e,fail:n}=Array.isArray(i)&&i.length>0&&i[0];return new Promise(((i,o)=>{s.then((t=>{!xt.isNull(e)&&xt.isFunction(e)?e.call(null,t,this):i(s)})).catch((e=>{const i=Ti(e,t);!xt.isNull(n)&&xt.isFunction(n)?n.call(null,i,this):o(i)}))}))}return s}catch(e){throw Ti(e,t)}},i};var fo,go,mo,yo,_o;exports.SDKCreator=class{constructor(){this.events=Zi.getInstance(),fo.set(this,void 0),o(this,fo,this.getServiceInstance(),"f"),this.events.addListener=(e,t,i)=>{const n=e;return this.events.addListener(exports.Events[n],t,i)}}login(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").login(e)}))}getLoginStatus(){return n(this,fo,"f").getLoginStatus()}getAccessToken(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getAccessToken(e)}))}getVersion(){return n(this,fo,"f").getVersion()}getSystemInfo(){return n(this,fo,"f").getSystemInfo()}setNavigationBarTitle(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").setNavigationBarTitle(e)}))}setNavigationBarColor(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").setNavigationBarColor(e)}))}setBackgroundColor(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").setBackgroundColor(e)}))}setNavigationBarLeftButton(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").setNavigationBarLeftButton(e.type)}))}setDeviceOrientation(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").setDeviceOrientation(e)}))}setStorage(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").setStorage(e)}))}getStorage(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getStorage(e)}))}getStorageInfo(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getStorageInfo(e)}))}removeStorage(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").removeStorage(e)}))}clearStorage(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").clearStorage(e)}))}getUserInfo(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getUserInfo(e)}))}getNetworkType(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getNetworkType(e)}))}onNetworkStatusChange(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").onNetworkStatusChange(e)}))}startBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").startBeaconDiscovery(e)}))}stopBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").stopBeaconDiscovery(e)}))}getBeacons(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getBeacons(e)}))}closeApp(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").closeApp(e)}))}getLocation(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getLocation(e)}))}stopBluetoothDevicesDiscovery(){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").stopBluetoothDevicesDiscovery()}))}startBluetoothDevicesDiscovery(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").startBluetoothDevicesDiscovery(e)}))}openBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").openBluetoothAdapter()}))}onBluetoothDeviceFound(){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").onBluetoothDeviceFound()}))}onBluetoothAdapterStateChange(){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").onBluetoothAdapterStateChange()}))}getConnectedBluetoothDevices(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getConnectedBluetoothDevices(e)}))}getBluetoothDevices(){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getBluetoothDevices()}))}getBluetoothAdapterState(){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getBluetoothAdapterState()}))}closeBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").closeBluetoothAdapter()}))}scanQRCode(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").scanQRCode(e)}))}openProfile(e){return i(this,void 0,void 0,(function*(){yield n(this,fo,"f").openProfile(e)}))}openChat(e){return i(this,void 0,void 0,(function*(){yield n(this,fo,"f").openChat(e)}))}openPostFeed(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").openPostFeed(e)}))}followOA(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").followOA(e)}))}unfollowOA(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").unFollowOA(e)}))}openShareSheet(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").openShareSheet(e)}))}requestCameraPermission(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").requestCameraPermission(e)}))}createShortcut(e){return i(this,void 0,void 0,(function*(){const t=yield $i(Jt,0),i=Bi().isIOS,o=t.logoUrl||ji("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"),i){a.append("appId",Jt),a.append("appName",r),a.append("appIcon",o);const e=`https://mini.zalo.me/shortcut.html?${a.toString()}`;yield n(this,fo,"f").openOutApp(encodeURI(e))}else yield n(this,fo,"f").createShortcut(`https://zalo.me/app/link/zapps/${Jt}/?${a.toString()}`,r,o);return bi()}))}openBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").openBioAuthentication(e)}))}checkStateBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").checkStateBioAuthentication(e)}))}sendLocation(e){return i(this,void 0,void 0,(function*(){yield n(this,fo,"f").sendLocation(e)}))}showToast(e){return i(this,void 0,void 0,(function*(){yield n(this,fo,"f").showToast(e)}))}hideKeyboard(e){return i(this,void 0,void 0,(function*(){yield n(this,fo,"f").hideKeyboard(e)}))}openPhone(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").openPhone(e)}))}openSMS(e){return i(this,void 0,void 0,(function*(){yield n(this,fo,"f").openSMS(e)}))}viewOAQr(e){return i(this,void 0,void 0,(function*(){yield n(this,fo,"f").viewOAQr(e)}))}keepScreen(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").keepScreen(e)}))}saveImageToGallery(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").saveImageToPhotosAlbum(e)}))}saveImageToPhotosAlbum(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").saveImageToPhotosAlbum(e)}))}openMiniApp(e){return i(this,void 0,void 0,(function*(){if(!xt.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 n(this,fo,"f").openMiniApp(e)}))}vibrate(e){return i(this,void 0,void 0,(function*(){console.log(e),yield n(this,fo,"f").vibrate(e)}))}openWebview(e){return i(this,void 0,void 0,(function*(){const t=new URL(e.url),i=t.searchParams.get("typeInapp");xt.isEmpty(i)&&t.searchParams.set("typeInapp","1"),yield n(this,fo,"f").openWebview(t.href)}))}getRouteParams(){return n(this,fo,"f").getRouteParams()}getAppInfo(e){return n(this,fo,"f").getAppInfo()}sendDataToPreviousMiniApp(e){return n(this,fo,"f").sendDataToPreviousMiniApp(e)}onCallbackData(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").onCallbackData(e)}))}getPhoneNumber(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getPhoneNumber()}))}openProfilePicker(e){return i(this,void 0,void 0,(function*(){const t=yield n(this,fo,"f").openProfilePicker(e.maxProfile);let i;if(t.length>0)try{const e=yield this.getAccessToken(),n=yield fetch(Xt,{method:"POST",headers:{"Content-Type":"application/json",access_token:e||""},body:JSON.stringify({fields:"id,name,picture",user_ids:t})}),o=yield n.json();if(0!==o.error||!o.data)throw new Error(o.message);i=t.map((e=>{var t,i,n,r,a,s,c,l,d,u,p;return{id:(null===(i=null===(t=o.data[e])||void 0===t?void 0:t.user_info)||void 0===i?void 0:i.user_id_by_app)||"",profile:{name:null===(r=null===(n=o.data[e])||void 0===n?void 0:n.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===(d=o.data[e])||void 0===d?void 0:d.error)?-1:0,message:`Get profile: ${xt.isUndefined(null===(u=o.data[e])||void 0===u?void 0:u.message)?"Unknown error":null===(p=o.data[e])||void 0===p?void 0:p.message}`}}))}catch(e){i=t.map((t=>({id:t,profile:{name:"",avatar:""},code:-1,message:`Can't get profile: ${e.message}`})))}return{users:i||[]}}))}connectWifi(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").connectWifi(e)}))}openMediaPicker(e){var t,o,r;return i(this,void 0,void 0,(function*(){const i={};xt.isUndefined(null===(t=e.editView)||void 0===t?void 0:t.enable)||(null===(o=e.editView)||void 0===o?void 0:o.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 n(this,fo,"f").openMediaPicker(e.type,e.serverUploadUrl,e.maxItemSize,i,a,s)}))}getShareableLink(e){return i(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();return(yield Gi(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 n(this,fo,"f").closeLoading("user action")}))}requestUpdateZalo(e){return i(this,void 0,void 0,(function*(){const e=Bi().isIOS?"https://apps.apple.com/vn/app/zalo/id579523206":"https://play.google.com/store/apps/details?id=com.zing.zalo";return yield n(this,fo,"f").openOutApp(e)}))}onConfirmToExit(e){this.events.on(exports.Events.AppClose,e,'{"handle_h5": 1}'),n(this,fo,"f").setNavigationBarLeftButton(void 0,2)}offConfirmToExit(){this.events.off(exports.Events.AppClose),n(this,fo,"f").setNavigationBarLeftButton(void 0,0)}getDeviceId(){return n(this,fo,"f").getDeviceId()}getContext(){return n(this,fo,"f").getContext()}},fo=new WeakMap,e([t(0,uo("object",{title:Hi("string")}))],exports.SDKCreator.prototype,"setNavigationBarTitle",null),e([t(0,uo("object",{color:Hi("string"),"textColor?":Hi("string",{values:["white","black"]}),"statusBarColor?":Hi("string")}))],exports.SDKCreator.prototype,"setNavigationBarColor",null),e([t(0,uo("object",{backgroundColor:Hi("string"),"textColor?":Hi("string",{values:["white","black"]})}))],exports.SDKCreator.prototype,"setBackgroundColor",null),e([t(0,uo("object",{type:Hi("string",{values:["none","back","home","both"]})}))],exports.SDKCreator.prototype,"setNavigationBarLeftButton",null),e([t(0,uo("object",{rotate:Hi("string",{values:["auto","portrait","landscape"]})}))],exports.SDKCreator.prototype,"setDeviceOrientation",null),e([t(0,uo("object",{data:Hi("object")}))],exports.SDKCreator.prototype,"setStorage",null),e([t(0,uo("object",{keys:Hi("array<string>")}))],exports.SDKCreator.prototype,"getStorage",null),e([t(0,uo("object",{keys:Hi("array<string>")}))],exports.SDKCreator.prototype,"removeStorage",null),e([t(0,uo("object",{"avatarType?":Hi("string",{values:["small","normal","large"]})}))],exports.SDKCreator.prototype,"getUserInfo",null),e([t(0,uo("object",{type:Hi("string",{values:["user","oa","aliasOA"]}),id:Hi("string")}))],exports.SDKCreator.prototype,"openProfile",null),e([t(0,uo("object",{type:Hi("string",{values:["user","oa"]}),id:Hi("string"),"message?":Hi("string")}))],exports.SDKCreator.prototype,"openChat",null),e([t(0,lo(["data.imageUrl"],{if:{type:"image"}})),t(0,lo(["data.link"],{if:{type:"link"}})),t(0,lo(["data.id"],{if:{type:"profile"}})),t(0,uo("object",{type:Hi("string",{values:["image","link","profile"]}),data:Hi("object"),"data.imageUrl?":Hi("url"),"data.link?":Hi("url"),"data.title?":Hi("string"),"data.thumb?":Hi("url"),"data.description?":Hi("string"),"data.avatar?":Hi("url"),"data.id?":Hi("string"),"data.displayName?":Hi("string")}))],exports.SDKCreator.prototype,"openPostFeed",null),e([t(0,uo("object",{id:Hi("string"),"showDialogConfirm?":Hi("boolean")}))],exports.SDKCreator.prototype,"followOA",null),e([t(0,uo("object",{id:Hi("string")}))],exports.SDKCreator.prototype,"unfollowOA",null),e([t(0,lo([["data.imageUrl","data.imageUrls"]],{if:{type:"image"}})),t(0,lo(["data.link"],{if:{type:"link"}})),t(0,lo(["data.id"],{if:{type:"oa"}})),t(0,lo(["data.gifUrl"],{if:{type:"gif"}})),t(0,lo(["data.videoThumb","data.videoUrl"],{if:{type:"video"}})),t(0,lo(["data.thumbnail","data.title","data.description"],{if:{type:"zmp"},defaultValue:{data:{description:""}}})),t(0,uo("object",{type:Hi("string",{values:["image","gif","video","link","oa","zmp"]}),data:Hi("object"),"data.imageUrl?":Hi("url"),"data.imageUrls?":Hi("array<url>",{maxLength:10}),"data.caption?":Hi("string"),"data.gifUrl?":Hi("url"),"data.width?":Hi("number"),"data.height?":Hi("number"),"data.videoThumb?":Hi("url"),"data.videoUrl?":Hi("url"),"data.link?":Hi("url"),"data.chatOnly?":Hi("boolean"),"data.id?":Hi("string"),"data.thumbnail?":Hi("url"),"data.path?":Hi("string"),"data.title?":Hi("string",{maxLength:100}),"data.description?":Hi(["string"],{maxLength:400})}))],exports.SDKCreator.prototype,"openShareSheet",null),e([t(0,uo("object",{secretData:Hi("string"),"ui?":Hi("object"),"ui.title?":Hi("string"),"ui.subTitle?":Hi("string"),"ui.negativeButtonText?":Hi("string"),"requireFingerprint?":Hi("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"}}))],exports.SDKCreator.prototype,"openBioAuthentication",null),e([t(0,uo("object",{toUserId:Hi("string"),"title?":Hi("string")}))],exports.SDKCreator.prototype,"sendLocation",null),e([t(0,uo("object",{message:Hi("string")}))],exports.SDKCreator.prototype,"showToast",null),e([t(0,uo("object",{phoneNumber:Hi("string")}))],exports.SDKCreator.prototype,"openPhone",null),e([t(0,uo("object",{content:Hi("string"),phoneNumber:Hi("string",{regex:/^\+?\d+$/})}))],exports.SDKCreator.prototype,"openSMS",null),e([t(0,uo("object",{id:Hi("string"),"displayName?":Hi("string")},{displayName:""}))],exports.SDKCreator.prototype,"viewOAQr",null),e([t(0,uo("object",{"imageBase64Data?":Hi("string"),"imageUrl?":Hi("url")}))],exports.SDKCreator.prototype,"saveImageToGallery",null),e([t(0,uo("object",{"imageBase64Data?":Hi("string"),"imageUrl?":Hi("url")}))],exports.SDKCreator.prototype,"saveImageToPhotosAlbum",null),e([t(0,uo("object",{appId:Hi("string"),"params?":Hi("object")}))],exports.SDKCreator.prototype,"openMiniApp",null),e([t(0,uo("object",{"type?":Hi("string",{values:["oneShot"]}),"milliseconds?":Hi("number")},{type:"oneShot",milliseconds:500}))],exports.SDKCreator.prototype,"vibrate",null),e([t(0,uo("object",{url:Hi("url")}))],exports.SDKCreator.prototype,"openWebview",null),e([t(0,uo("object",{"maxProfile?":Hi("number",{min:1,max:10})},{maxProfile:1}))],exports.SDKCreator.prototype,"openProfilePicker",null),e([t(0,lo(["SSID"])),t(0,uo("object",{SSID:Hi("string"),"password?":Hi("string"),"hiddenSSID?":Hi("boolean")}))],exports.SDKCreator.prototype,"connectWifi",null),e([t(0,uo("object",{type:Hi("string",{values:["photo","video","file"]}),serverUploadUrl:Hi("url"),"maxItemSize?":Hi("number",{min:0}),"editView?":Hi("object"),"editView.enable?":Hi("boolean"),"editView.aspectRatio?":Hi("string",{regex:/^\d+:\d+$/}),"silentRequest?":Hi("boolean"),"maxSelectItem?":Hi("number",{min:1})}))],exports.SDKCreator.prototype,"openMediaPicker",null),e([t(0,uo("object",{title:Hi("string",{maxLength:100}),"thumbnail?":Hi("url"),"path?":Hi("string"),description:Hi(["string"],{maxLength:400})},{description:""}))],exports.SDKCreator.prototype,"getShareableLink",null),exports.SDKCreator=e([ho(vo)],exports.SDKCreator);class So extends exports.SDKCreator{getServiceInstance(){return ro.getInstance()}}class Eo extends exports.SDKCreator{getServiceInstance(){return new ao}}class Oo{constructor(){go.set(this,Jt)}static getInstance(){return Oo.instance||(Oo.instance=new Oo),Oo.instance}createOrder(e,t){return i(this,void 0,void 0,(function*(){const i=n(this,go,"f"),o=new URLSearchParams;o.append("amount",t.amount.toString()),o.append("item",encodeURIComponent(JSON.stringify(t.item))),o.append("appId",i),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 n=yield e.getAccessToken({fail:e=>{throw wi.loginRequired}});r.headers.authorization=`Bearer ${n}`;const a=yield fetch(Ei,Object.assign(Object.assign({method:"POST"},r),{body:o})),s=yield a.json();if(!s.data||0!==s.err)throw wi.badRequest(s.msg);const c=s.data.id,l=s.data.jwt,d=window.APP_VERSION,u=window.APP_ENV,p={miniAppId:i,orderId:c};l&&(p.token=l),d&&(p.version=d),u&&(p.env=u),t.method&&(p.method=t.method);const h=Ni.encode(p),v=new URL(`?${h}`,"https://payment-mini.zalo.me").toString();return yield e.openWebview({url:v,fail:e=>{throw e}}),{orderId:c}}catch(e){throw e}}))}checkTransaction(e,t){return i(this,void 0,void 0,(function*(){try{let i,{data:o}=t;if(o||(o=e.getRouteParams()),"object"==typeof o&&(i=o.appTransID||o.orderId||o.apptransid),"string"==typeof o){const e=Ni.getParameterByName("orderId",o),t=Ni.getParameterByName("appTransID",o)||Ni.getParameterByName("apptransid",o);i=e||t}const r={headers:{authorization:"Bearer "}},a=yield e.getAccessToken({fail:e=>{throw wi.loginRequired}});r.headers.authorization=`Bearer ${a}`;const s=new URL(Oi),c={transId:i||"",appId:n(this,go,"f")};s.search=new URLSearchParams(c).toString();const l=yield fetch(s.toString(),r),d=yield l.json();if(!d.data||0!==d.err)throw wi.badRequest(d.msg);const u=d.data||{};return{msg:u.resultMessage,orderId:u.orderId,resultCode:u.resultCode,transTime:u.transTime,createdAt:u.createAt,transId:u.transId}}catch(e){throw e}}))}}go=new WeakMap;class Ao{constructor(){mo.set(this,zt)}static getInstance(){return Ao.instance||(Ao.instance=new Ao),Ao.instance}createOrder(e,t){return Promise.resolve({orderId:""})}checkTransaction(e,t){const i={msg:"Success",orderId:"",resultCode:1,transTime:(new Date).getTime().toString(),createdAt:(new Date).getTime().toString(),transId:""};return Promise.resolve(i)}}mo=new WeakMap;let To=class{constructor(e){yo.set(this,void 0),_o.set(this,void 0),o(this,yo,this.getInstance(),"f"),o(this,_o,e,"f")}createOrder(e){return n(this,yo,"f").createOrder(n(this,_o,"f"),e)}checkTransaction(e){return n(this,yo,"f").checkTransaction(n(this,_o,"f"),e)}};yo=new WeakMap,_o=new WeakMap,e([t(0,uo("object",{amount:Hi(["string","number"]),desc:Hi("string"),"method?":Hi("string",{values:["MOMO","ZALOPAY","MOMO_SANDBOX","ZALOPAY_SANDBOX","CC","CC_SANDBOX","ATM","ATM_SANDBOX"]})}))],To.prototype,"createOrder",null),To=e([ho(vo)],To);class bo extends To{getInstance(){return Oo.getInstance()}}class wo extends To{getInstance(){return Ao.getInstance()}}const No=Bi();exports.default=void 0,window.onJSCall=e=>function(t){$n.getInstance().onJSCall(e,t)},window.onMultiJSCall=e=>function(t){$n.getInstance().onMultiJSCall(e,t)},window.zaloJSV2={zalo_h5_event_handler:function(e,t,i){$n.getInstance().nativeEventHandler(e,t,i)}},exports.Payment=void 0,No.isZalo?(exports.default=new So,exports.Payment=new bo(exports.default)):(exports.default=new Eo,exports.Payment=new wo(exports.default)),window.ZaloMiniAppSDK=exports.default,exports.default=exports.default;
16
+ function e(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a}function t(e,t){return function(i,n){t(i,n,e)}}function i(e,t,i,n){return new(i||(i=Promise))((function(o,r){function a(e){try{c(n.next(e))}catch(e){r(e)}}function s(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function n(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)}function o(e,t,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!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"===n?o.call(e,i):o?o.value=i:t.set(e,i),i}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(i){return e(t(i))}}(Object.keys,Object),c=Object.prototype.hasOwnProperty;var l=function(e){if(!a(e))return s(e);var t=[];for(var i in Object(e))c.call(e,i)&&"constructor"!=i&&t.push(i);return t},d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function u(e,t){return e(t={exports:{}},t.exports),t.exports}var p="object"==typeof d&&d&&d.Object===Object&&d,h="object"==typeof self&&self&&self.Object===Object&&self,v=p||h||Function("return this")(),f=v.Symbol,g=Object.prototype,m=g.hasOwnProperty,y=g.toString,_=f?f.toStringTag:void 0;var S=function(e){var t=m.call(e,_),i=e[_];try{e[_]=void 0;var n=!0}catch(e){}var o=y.call(e);return n&&(t?e[_]=i:delete e[_]),o},E=Object.prototype.toString;var O=function(e){return E.call(e)},A=f?f.toStringTag:void 0;var T=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":A&&A in Object(e)?S(e):O(e)};var b=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var w,N=function(e){if(!b(e))return!1;var t=T(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},C=v["__core-js_shared__"],I=(w=/[^.]+$/.exec(C&&C.keys&&C.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"";var P=function(e){return!!I&&I in e},k=Function.prototype.toString;var R=function(e){if(null!=e){try{return k.call(e)}catch(e){}try{return e+""}catch(e){}}return""},D=/^\[object .+?Constructor\]$/,B=Function.prototype,j=Object.prototype,x=B.toString,U=j.hasOwnProperty,M=RegExp("^"+x.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var L=function(e){return!(!b(e)||P(e))&&(N(e)?M:D).test(R(e))};var W=function(e,t){return null==e?void 0:e[t]};var z=function(e,t){var i=W(e,t);return L(i)?i:void 0},J=z(v,"DataView"),F=z(v,"Map"),K=z(v,"Promise"),G=z(v,"Set"),H=z(v,"WeakMap"),$=R(J),V=R(F),Z=R(K),q=R(G),Q=R(H),Y=T;(J&&"[object DataView]"!=Y(new J(new ArrayBuffer(1)))||F&&"[object Map]"!=Y(new F)||K&&"[object Promise]"!=Y(K.resolve())||G&&"[object Set]"!=Y(new G)||H&&"[object WeakMap]"!=Y(new H))&&(Y=function(e){var t=T(e),i="[object Object]"==t?e.constructor:void 0,n=i?R(i):"";if(n)switch(n){case $:return"[object DataView]";case V:return"[object Map]";case Z:return"[object Promise]";case q:return"[object Set]";case Q:return"[object WeakMap]"}return t});var X=Y;var ee=function(e){return null!=e&&"object"==typeof e};var te=function(e){return ee(e)&&"[object Arguments]"==T(e)},ie=Object.prototype,ne=ie.hasOwnProperty,oe=ie.propertyIsEnumerable,re=te(function(){return arguments}())?te:function(e){return ee(e)&&ne.call(e,"callee")&&!oe.call(e,"callee")},ae=Array.isArray;var se=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var ce=function(e){return null!=e&&se(e.length)&&!N(e)};var le=function(){return!1},de=u((function(e,t){var i=t&&!t.nodeType&&t,n=i&&e&&!e.nodeType&&e,o=n&&n.exports===i?v.Buffer:void 0,r=(o?o.isBuffer:void 0)||le;e.exports=r})),ue={};ue["[object Float32Array]"]=ue["[object Float64Array]"]=ue["[object Int8Array]"]=ue["[object Int16Array]"]=ue["[object Int32Array]"]=ue["[object Uint8Array]"]=ue["[object Uint8ClampedArray]"]=ue["[object Uint16Array]"]=ue["[object Uint32Array]"]=!0,ue["[object Arguments]"]=ue["[object Array]"]=ue["[object ArrayBuffer]"]=ue["[object Boolean]"]=ue["[object DataView]"]=ue["[object Date]"]=ue["[object Error]"]=ue["[object Function]"]=ue["[object Map]"]=ue["[object Number]"]=ue["[object Object]"]=ue["[object RegExp]"]=ue["[object Set]"]=ue["[object String]"]=ue["[object WeakMap]"]=!1;var pe=function(e){return ee(e)&&se(e.length)&&!!ue[T(e)]};var he=function(e){return function(t){return e(t)}},ve=u((function(e,t){var i=t&&!t.nodeType&&t,n=i&&e&&!e.nodeType&&e,o=n&&n.exports===i&&p.process,r=function(){try{var e=n&&n.require&&n.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=r})),fe=ve&&ve.isTypedArray,ge=fe?he(fe):pe,me=Object.prototype.hasOwnProperty;var ye=function(e){if(null==e)return!0;if(ce(e)&&(ae(e)||"string"==typeof e||"function"==typeof e.splice||de(e)||ge(e)||re(e)))return!e.length;var t=X(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(a(e))return!l(e).length;for(var i in e)if(me.call(e,i))return!1;return!0};var _e=function(e){return void 0===e};var Se=function(e){return null===e};var Ee=function(e){return"string"==typeof e||!ae(e)&&ee(e)&&"[object String]"==T(e)};var Oe=function(e){return"number"==typeof e||ee(e)&&"[object Number]"==T(e)};var Ae=function(e){return ee(e)&&"[object RegExp]"==T(e)},Te=ve&&ve.isRegExp,be=Te?he(Te):Ae;var we=function(e){return"symbol"==typeof e||ee(e)&&"[object Symbol]"==T(e)},Ne=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ce=/^\w*$/;var Ie=function(e,t){if(ae(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!we(e))||(Ce.test(e)||!Ne.test(e)||null!=t&&e in Object(t))},Pe=z(Object,"create");var ke=function(){this.__data__=Pe?Pe(null):{},this.size=0};var Re=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},De=Object.prototype.hasOwnProperty;var Be=function(e){var t=this.__data__;if(Pe){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return De.call(t,e)?t[e]:void 0},je=Object.prototype.hasOwnProperty;var xe=function(e){var t=this.__data__;return Pe?void 0!==t[e]:je.call(t,e)};var Ue=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=Pe&&void 0===t?"__lodash_hash_undefined__":t,this};function Me(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}Me.prototype.clear=ke,Me.prototype.delete=Re,Me.prototype.get=Be,Me.prototype.has=xe,Me.prototype.set=Ue;var Le=Me;var We=function(){this.__data__=[],this.size=0};var ze=function(e,t){return e===t||e!=e&&t!=t};var Je=function(e,t){for(var i=e.length;i--;)if(ze(e[i][0],t))return i;return-1},Fe=Array.prototype.splice;var Ke=function(e){var t=this.__data__,i=Je(t,e);return!(i<0)&&(i==t.length-1?t.pop():Fe.call(t,i,1),--this.size,!0)};var Ge=function(e){var t=this.__data__,i=Je(t,e);return i<0?void 0:t[i][1]};var He=function(e){return Je(this.__data__,e)>-1};var $e=function(e,t){var i=this.__data__,n=Je(i,e);return n<0?(++this.size,i.push([e,t])):i[n][1]=t,this};function Ve(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}Ve.prototype.clear=We,Ve.prototype.delete=Ke,Ve.prototype.get=Ge,Ve.prototype.has=He,Ve.prototype.set=$e;var Ze=Ve;var qe=function(){this.size=0,this.__data__={hash:new Le,map:new(F||Ze),string:new Le}};var Qe=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Ye=function(e,t){var i=e.__data__;return Qe(t)?i["string"==typeof t?"string":"hash"]:i.map};var Xe=function(e){var t=Ye(this,e).delete(e);return this.size-=t?1:0,t};var et=function(e){return Ye(this,e).get(e)};var tt=function(e){return Ye(this,e).has(e)};var it=function(e,t){var i=Ye(this,e),n=i.size;return i.set(e,t),this.size+=i.size==n?0:1,this};function nt(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}nt.prototype.clear=qe,nt.prototype.delete=Xe,nt.prototype.get=et,nt.prototype.has=tt,nt.prototype.set=it;var ot=nt;function rt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var i=function(){var n=arguments,o=t?t.apply(this,n):n[0],r=i.cache;if(r.has(o))return r.get(o);var a=e.apply(this,n);return i.cache=r.set(o,a)||r,a};return i.cache=new(rt.Cache||ot),i}rt.Cache=ot;var at=rt;var st=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ct=/\\(\\)?/g,lt=function(e){var t=at(e,(function(e){return 500===i.size&&i.clear(),e})),i=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(st,(function(e,i,n,o){t.push(n?o.replace(ct,"$1"):i||e)})),t}));var dt=function(e,t){for(var i=-1,n=null==e?0:e.length,o=Array(n);++i<n;)o[i]=t(e[i],i,e);return o},ut=f?f.prototype:void 0,pt=ut?ut.toString:void 0;var ht=function e(t){if("string"==typeof t)return t;if(ae(t))return dt(t,e)+"";if(we(t))return pt?pt.call(t):"";var i=t+"";return"0"==i&&1/t==-Infinity?"-0":i};var vt=function(e){return null==e?"":ht(e)};var ft=function(e,t){return ae(e)?e:Ie(e,t)?[e]:lt(vt(e))};var gt=function(e){if("string"==typeof e||we(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var mt=function(e,t){for(var i=0,n=(t=ft(t,e)).length;null!=e&&i<n;)e=e[gt(t[i++])];return i&&i==n?e:void 0};var yt=function(e,t,i){var n=null==e?void 0:mt(e,t);return void 0===n?i:n},_t=function(){try{var e=z(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var St=function(e,t,i){"__proto__"==t&&_t?_t(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i},Et=Object.prototype.hasOwnProperty;var Ot=function(e,t,i){var n=e[t];Et.call(e,t)&&ze(n,i)&&(void 0!==i||t in e)||St(e,t,i)},At=/^(?:0|[1-9]\d*)$/;var Tt=function(e,t){var i=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==i||"symbol"!=i&&At.test(e))&&e>-1&&e%1==0&&e<t};var bt=function(e,t,i,n){if(!b(e))return e;for(var o=-1,r=(t=ft(t,e)).length,a=r-1,s=e;null!=s&&++o<r;){var c=gt(t[o]),l=i;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(o!=a){var d=s[c];void 0===(l=n?n(d,c,s):void 0)&&(l=b(d)?d:Tt(t[o+1])?[]:{})}Ot(s,c,l),s=s[c]}return e};var wt,Nt,Ct,It,Pt,kt,Rt,Dt,Bt,jt,xt={isEmpty:ye,isNull:Se,isUndefined:_e,isFunction:N,isObject:b,isString:Ee,isNumber:Oe,isArray:ae,isRegExp:be,get:yt,set:function(e,t,i){return null==e?e:bt(e,t,i)},isPromise:e=>!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then};function Ut(e){return"function"==typeof window.Debug?window.Debug(e):function(...e){process.env.NODE_ENV}}exports.NetworkType=void 0,(wt=exports.NetworkType||(exports.NetworkType={})).none="none",wt.wifi="wifi",wt.cellular="cellular",wt.unknown="unknown",exports.PlatformType=void 0,(Nt=exports.PlatformType||(exports.PlatformType={})).wp="wp",Nt.android="android",Nt.iOS="iOS",Nt.unknown="unknown",exports.ProfileType=void 0,(Ct=exports.ProfileType||(exports.ProfileType={}))[Ct.user=1]="user",Ct[Ct.oa=0]="oa",Ct[Ct.aliasOA=2]="aliasOA",exports.ChatType=void 0,(It=exports.ChatType||(exports.ChatType={}))[It.user=1]="user",It[It.oa=0]="oa",exports.PostFeedType=void 0,(Pt=exports.PostFeedType||(exports.PostFeedType={}))[Pt.image=1]="image",Pt[Pt.link=4]="link",Pt[Pt.profile=5]="profile",exports.ShareSheetType=void 0,(kt=exports.ShareSheetType||(exports.ShareSheetType={}))[kt.image=1]="image",kt[kt.gif=11]="gif",kt[kt.video=12]="video",kt[kt.link=4]="link",kt[kt.oa=5]="oa",kt[kt.zmp=20]="zmp",kt[kt.multi_image=21]="multi_image",exports.OrientationType=void 0,(Rt=exports.OrientationType||(exports.OrientationType={}))[Rt.auto=1]="auto",Rt[Rt.portrait=2]="portrait",Rt[Rt.landscape=3]="landscape",exports.VibrateType=void 0,(Dt=exports.VibrateType||(exports.VibrateType={}))[Dt.oneShot=0]="oneShot",exports.Events=void 0,(Bt=exports.Events||(exports.Events={})).AppPaused="h5.event.paused",Bt.AppResumed="h5.event.resumed",Bt.NetworkChanged="h5.event.connection.changed",Bt.OnDataCallback="h5.event.webview.result",Bt.OpenApp="h5.event.open.mp",Bt.AppClose="h5.event.action.close",exports.MediaPickerType=void 0,(jt=exports.MediaPickerType||(exports.MediaPickerType={}))[jt.photo=4]="photo",jt[jt.video=5]="video",jt[jt.file=6]="file";const Mt=e=>{const t=document.cookie;if(t){const o=t.split("; ");if(o&&o.length>0)for(var i=e.length+1,n=o.length-1;n>=0;n--){let t=o[n];if(t&&0===t.indexOf(e)&&(t=t.substring(i,t.length),t))return t=t.replace(/["']/g,""),t}}return null},Lt=e=>Mt(`${window.location.host}_`+e),Wt=e=>Mt((()=>{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),zt=window.zAppID,Jt=window.APP_ID,Ft=window.APP_CONFIG||{},Kt="h5.zdn.vn_zoauth",Gt="h5.zdn.vn_zlink3rd",Ht="h5.zdn.vn_zoauth_vrf",$t="h5.zdn.vn_deviceID",Vt="h5.zdn.vn_contextID",Zt="h5.zdn.vn_contextType",qt="https://graph.zalo.me/v2.0/me",Qt="https://h5.zalo.me/openapi/access_token",Yt="https://oauth.zaloapp.com/v3/access_token",Xt="https://graph.zalo.me/v2.0/me/friends/list",ei="https://h5.zalo.me/apps/get-info",ti="https://h5.zalo.me/log/async",ii=e=>({NONE:e?-2:0,WIFI:e?0:1,"2G":2,"3G":e?15:2,"4G":e?13:2}),ni=0,oi=-2e3,ri=-1400,ai=-1500,si=-1401,ci=-2004,li=-2005,di={SUCCESS:"Success",UNKNOWN_ERROR:"Unknown error. Please try again later.",TIME_OUT:"Request timeout. Please try again later.",LOGIN_REQUIRED:"Please login (https://miniapp.zalo.me/docs/api/login) before to call this api",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 id. Please check your params again.",INVALID_PARAM:"Invalid parameter",USER_DENIED:"User denied",USER_CANCEL:"User cancel",MEDIA_PICKER_FAIL:"Unable to pick media",SAVE_IMAGE_FAIL:"Unable to save image"},ui={SUCCESS:{code:ni,message:di.SUCCESS},UNKNOWN_ERROR:{code:oi,message:di.UNKNOWN_ERROR},UNAUTHORIZED:{code:si,message:di.LOGIN_REQUIRED},FORBIDDEN:{code:-1403,message:di.NOT_PERMISSION},CLIENT_NOT_SUPPORT:{code:-1404,message:di.CLIENT_NOT_SUPPORT},DECODE_FAILED:{code:-2001,message:di.DECODE_FAILED},TIME_OUT:{code:-1408,message:di.TIME_OUT},USER_DENIED:{code:-2002,message:di.USER_DENIED},USER_CANCEL:{code:-2003,message:di.USER_CANCEL}},pi={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",error_list:{android:{"-2":{map_to:ui.USER_DENIED}},iOS:{"-2":{map_to:ui.USER_DENIED}}}},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,error_list:{android:{"-1":{map_to:ui.USER_DENIED}},iOS:{"-1":{map_to:ui.USER_DENIED}}}},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},error_list:{android:{"-101":{map_to:{code:li,message:di.SAVE_IMAGE_FAIL},need_more_detail:!0},"-102":{map_to:{code:li,message:di.SAVE_IMAGE_FAIL},need_more_detail:!0}},iOS:{"-10":{map_to:{code:li,message:di.SAVE_IMAGE_FAIL},need_more_detail:!0}}}},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},error_list:{android:{"-1":{map_to:ui.USER_DENIED},"-101":{map_to:ui.USER_DENIED}},iOS:{"-1":{map_to:ui.USER_DENIED},"-10":{map_to:ui.USER_DENIED}}}},MP_OPEN_PROFILE_PICKER:{name:"action.mp.open.profile.picker",version_live:{iOS:432},error_list:{android:{"-101":{map_to:ui.USER_CANCEL}},iOS:{"-101":{map_to:ui.USER_CANCEL}}}},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:440},error_list:{android:{"-101":{map_to:ui.USER_CANCEL},999:{map_to:{code:ci,message:di.MEDIA_PICKER_FAIL},need_more_detail:!0}},iOS:{"-10":{map_to:{code:ci,message:di.MEDIA_PICKER_FAIL}}}}},MP_CLOSE_LOADINGVIEW:{name:"action.mp.close.loadingview"}},hi={android:{"-4":ui.DECODE_FAILED,"-5":ui.CLIENT_NOT_SUPPORT,"-14":ui.TIME_OUT},iOS:{"-9":ui.DECODE_FAILED,"-5":ui.CLIENT_NOT_SUPPORT,"-14":ui.TIME_OUT}},vi={android:12100571,iOS:400,wp:0,unknown:0},fi={android:12100615,iOS:460,wp:0,unknown:0},gi=[pi.GET_DOWNLOADED_STICKER.name,pi.OPEN_SHARE_STICKER.name,pi.OPEN_PROFILE.name,pi.OPEN_FEED_DETAIL.name,pi.OPEN_FRIEND_RADA.name,pi.OPEN_INAPP.name,pi.OPEN_OUTAPP.name,pi.OPEN_PAGE.name,pi.OPEN_PHOTODETAIL.name,pi.OPEN_GALARY.name,pi.OPEN_GAMECENTER.name,pi.OPEN_GAMENEWS.name,pi.OPEN_TAB_CONTACT.name,pi.OPEN_TAB_SOCIAL.name,pi.OPEN_FRIENDSUGGEST.name,pi.OPEN_GROUPLIST.name,pi.OPEN_NEARBY.name,pi.OPEN_ROOM.name,pi.OPEN_STICKERSTORE.name,pi.OPEN_CREATECHAT.name,pi.COPY_LINK_CATESTICKER.name,pi.REQUEST_BUY_STICKER.name,pi.OPEN_CHAT.name,pi.OPEN_TAB_CHAT.name,pi.OPEN_CHATGROUP.name,pi.OPEN_ADDFRIEND.name,pi.OPEN_TAB_MORE.name,pi.OPEN_POSTFEED.name,pi.OPEN_LOGINDEVICES.name,pi.OPEN_SENDSTICKER.name,pi.REPORT_ABUSE.name,pi.FOLLOW_OA.name,pi.UNFOLLOW_OA.name,pi.OPEN_GAMEDETAIL.name,pi.OPEN_SHARESHEET.name,pi.REQUEST_PERMISSION_CAMERA.name,pi.CHANGE_TITLE_HEADER.name,pi.WEBVIEW_CLEARCACHE.name,pi.WEBVIEW_CONFIRMCACHE.name,pi.WEBVIEW_ISVISIBLE.name,pi.WEBVIEW_NETWORKTYPE.name,pi.CHANGE_BUTTON_HEADER.name,pi.CREATE_OPTIONS_MENU.name,pi.CREATE_SHORTCUT.name,pi.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE.name,pi.WINDOW_CLOSE.name,pi.WEBVIEW_CHECKRESERROR.name,pi.IAP_REQUESTPAYMENT.name,pi.ZBROWSER_GETSTATS.name,pi.ZBROWSER_JSBRIDGE.name,pi.PROMPT_AUTHENTICATION.name,pi.CHANGE_ACTIONBAR_COLOR.name,pi.PROMPT_AUTHENTICATION_CHECK_STATE.name,pi.OPEN_APPSTORE.name,pi.GET_LOCATION.name,pi.QUERY_LOCATION_HIDE.name,pi.SHOW_TOAST.name,pi.OPEN_APP.name,pi.HIDE_KEYBOARD.name,pi.OPEN_PHONE.name,pi.OPEN_QR.name,pi.OPEN_SMS.name,pi.VIEW_MYQR.name,pi.KEEP_SCREEN.name,pi.CHANGE_AUTOROTATE.name,pi.CHECK_APP_INSTALLED.name,pi.QUERY_SHOW.name,pi.QUERY_HIDE.name,pi.OPEN_INAPPRW.name,pi.ZALORUN_GETTRACKINGSTATUS.name,pi.ZALORUN_SETTRACKINGSTATUS.name,pi.ZALORUN_GETDAYSTEP.name,pi.ZALORUN_FORCESUBMITDATA.name,pi.ZALORUN_SETWEIGHT.name,pi.OPEN_PROFILE_EXT.name,pi.DOWNLOAD_CATE.name,pi.JUMP_LOGIN.name,pi.OPEN_ADTIMA_ADS_INTERSTITIAL.name,pi.OPEN_ADTIMA_ADS.name,pi.GET_ADIDCLIENT.name,pi.SCAN_IBEACON.name,pi.SAVE_IMAGE_GALLERY.name,pi.OPEN_MP.name,pi.CHANGE_ACTIONBAR.name,pi.INTERACTIVE_VIBRATION.name,pi.ZBROWSER_MPDS.name],mi=0,yi=3,_i=1,Si=0,Ei="https://payment-mini.zalo.me/api/order/create",Oi="https://payment-mini.zalo.me/api/transaction";class Ai{constructor(e,t,i){this.code=e,this.message=t,this.api=i}toString(){return`api: ${String(this.api)}; code: ${this.code}; message: ${this.message}`}toJSON(){return{code:this.code,message:this.message,api:this.api}}}const Ti=(e,t)=>e instanceof Ai?((e,t)=>(e.api=t,e.toJSON()))(e,t):((e,t)=>e instanceof Error?new Ai(oi,e.message,t).toJSON():new Ai(oi,di.UNKNOWN_ERROR,t).toJSON())(e,t),bi=(e,t)=>({code:ni,message:t||di.SUCCESS,data:e||{}}),wi={badRequest:e=>new Ai(ri,e),loginFailed:e=>new Ai(si,`${di.LOGIN_FAILED}: ${e}`),loginRequired:()=>new Ai(si,di.LOGIN_REQUIRED),missingParam:e=>new Ai(ri,`Missing required argument: ${e}`),wrongTypeParam:(e,t,i)=>new Ai(ri,`Wrong type of parameter '${e}'. Expected ${t}, but got ${i}`),cannotGetShareInfo:()=>new Ai(ai,"Can not get app info to share"),lengthInvalid:e=>new Ai(ri,`${e} length is invalid.`)};const Ni={encode:function(e){var t=[];for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];if(void 0===n)return;if(null===n)return void t.push(i);t.push(encodeURIComponent(i)+"="+encodeURIComponent(n))}return t.join("&")},decode:function(e,t){var i={};if(""===e)return i;for(var n=e.split("&"),o=0;o<n.length;o++){var r=n[o].split("=",2),a=decodeURIComponent(r[0]);if(t&&Object.prototype.hasOwnProperty.call(i,a))throw new URIError("Duplicate key: "+a);i[a]=2===r.length?decodeURIComponent(r[1]):null}return i},appendToUrl:function(e,t){return e+(-1!==e.indexOf("?")?"&":"?")+("string"==typeof t?t:Ni.encode(t))},getParameterByName:function(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");var i=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null},getParamsAsObject:function(e){var t={};return e?(e.split("&").map((function(e){var i=e.split("=");i&&2==i.length&&(t[i[0]]=decodeURIComponent(i[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),i=[];return t.map((function(t){var n=e[t],o=[t,n="object"==(void 0===n?"undefined":typeof n)?JSON.stringify(n):encodeURIComponent(n)].join("=");i.push(o)})),i.join("&")}},Ci=new RegExp("[\\u0300-\\u036f]","g"),Ii=new RegExp("[đ|Đ]","g"),Pi=new RegExp("\\s","g"),ki=Ut("zmp:utils:common"),Ri=e=>{try{new URL(e)}catch(e){return!1}return!0},Di=()=>navigator.userAgent||navigator.vendor||window.opera,Bi=()=>{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)}},ji=e=>{const t=document.getElementsByTagName("meta");for(let i=0;i<t.length;i++)if(t[i].getAttribute("name")===e||t[i].getAttribute("property")===e)return t[i].getAttribute("content");return""},xi=()=>{const e=Di().toLowerCase().split("zalo")[1];if(e){return e.replace(" ","").split("/")[1]||""}return""},Ui=()=>{let e=Bi();return e.isWP?exports.PlatformType.wp:e.isAndroid?exports.PlatformType.android:e.isIOS?exports.PlatformType.iOS:exports.PlatformType.unknown},Mi=(e,t)=>{const i=t.toLowerCase(),n=i.split(/[<>]/i),o="array"===n[0];return!!("url"===i&&Ri(e)||o&&("array"===i&&Array.isArray(e)||((e,t)=>Array.isArray(t)&&!t.some((t=>"url"===e?!Ri(t):typeof t!==e)))(n[1],e))||!Array.isArray(e)&&typeof e===t)},Li=e=>(e=>{let t=Lt(e);return t||(t=Wt(e),t)?t:Mt(e)})(e),Wi=e=>{if(xt.isObject(JSON)&&JSON.parse&&xt.isString(e)){const t=e.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\x00/g,"");return JSON.parse(t,((e,t)=>t))}return xt.isObject(e)?e:new Function("return "+e)()},zi=e=>{if(xt.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 i=e.length,n=0;n<i;n++)t.push(zi(e[n]));return"["+t.join(",")+"]"}if("object"==typeof e){for(var o in t=new Array,e)t.push('"'+o+'":'+zi(e[o]));return"{"+t.join(",")+"}"}return e.toString()},Ji=()=>{try{const e=Number(xi()),t=Ui();return e>=vi[t]}catch(e){return!0}},Fi=e=>JSON.stringify(e).replace(/"/g,'\\"').replace(/'/g,"&#39;"),Ki=e=>{try{if(e){ki(e);const t=e.replace(/\\/g,"").replace(/&#39;/g,"'");return ki("formattedValue",t,JSON.parse(t),typeof JSON.parse(t)),JSON.parse(t)}return null}catch(t){return ki("parse json error:",t),e}},Gi=(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 d=yield fetch("https://h5.zalo.me/openapi/create-sharelink",Object.assign({method:"POST",body:s},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})),u=yield d.json();if(!u||0!==u.err)throw wi.cannotGetShareInfo();return l.search=`${l.search}&zshareId=${u.data.shareId}`,Object.assign(Object.assign({},u.data),{shareableLink:l.href})})),Hi=(e,t)=>i=>{if(!(Array.isArray(e)?e.some((e=>Mi(i,e))):Mi(i,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(i)),errorMessage:null==t?void 0:t.values.toString()};if(xt.isNumber(null==t?void 0:t.maxLength))return{error:xt.isString(i)&&i.length>(null==t?void 0:t.maxLength),errorMessage:`data length must <= ${null==t?void 0:t.maxLength}`};if(xt.isNumber(null==t?void 0:t.min)&&xt.isNumber(null==t?void 0:t.max))return{error:i<(null==t?void 0:t.min)||i>(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(xt.isNumber(null==t?void 0:t.min))return{error:i<(null==t?void 0:t.min),errorMessage:`data must >= ${null==t?void 0:t.min}`};if(xt.isNumber(null==t?void 0:t.max))return{error:i>(null==t?void 0:t.max),errorMessage:`data must <= ${null==t?void 0:t.max}`};if(xt.isRegExp(null==t?void 0:t.regex))return{error:!t.regex.test(i),errorMessage:"data must valid"}}return{error:!1}},$i=(e,t,n)=>i(void 0,void 0,void 0,(function*(){const i={appId:e,versionStatus:t};xt.isUndefined(n)||(i.currentVersion=n);const o=Ni.appendToUrl(ei,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 Vi=u((function(e){var t=Object.prototype.hasOwnProperty,i="~";function n(){}function o(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function r(e,t,n,r,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new o(n,r||e,a),c=i?i+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 n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),s.prototype.eventNames=function(){var e,n,o=[];if(0===this._eventsCount)return o;for(n in e=this._events)t.call(e,n)&&o.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},s.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,r=n.length,a=new Array(r);o<r;o++)a[o]=n[o].fn;return a},s.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,o,r,a){var s=i?i+e:e;if(!this._events[s])return!1;var c,l,d=this._events[s],u=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),u){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,n),!0;case 4:return d.fn.call(d.context,t,n,o),!0;case 5:return d.fn.call(d.context,t,n,o,r),!0;case 6:return d.fn.call(d.context,t,n,o,r,a),!0}for(l=1,c=new Array(u-1);l<u;l++)c[l-1]=arguments[l];d.fn.apply(d.context,c)}else{var p,h=d.length;for(l=0;l<h;l++)switch(d[l].once&&this.removeListener(e,d[l].fn,void 0,!0),u){case 1:d[l].fn.call(d[l].context);break;case 2:d[l].fn.call(d[l].context,t);break;case 3:d[l].fn.call(d[l].context,t,n);break;case 4:d[l].fn.call(d[l].context,t,n,o);break;default:if(!c)for(p=1,c=new Array(u-1);p<u;p++)c[p-1]=arguments[p];d[l].fn.apply(d[l].context,c)}}return!0},s.prototype.on=function(e,t,i){return r(this,e,t,i,!1)},s.prototype.once=function(e,t,i){return r(this,e,t,i,!0)},s.prototype.removeListener=function(e,t,n,o){var r=i?i+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||n&&s.context!==n||a(this,r);else{for(var c=0,l=[],d=s.length;c<d;c++)(s[c].fn!==t||o&&!s[c].once||n&&s[c].context!==n)&&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=i?i+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=i,s.EventEmitter=s,e.exports=s}));class Zi extends Vi{constructor(){super(),this.debug=Ut("zmp:event-emitter")}static getInstance(){return Zi.instance||(Zi.instance=new Zi),Zi.instance}h5ConfirmHandleEvent(e,t,i){ZaloJavaScriptInterface.jsH5EventCallback(e,t,i||"")}on(e,t,i){this.debug(`register ${e}: ${i}`);return super.on(e,((n,o)=>{this.h5ConfirmHandleEvent(n,e,i),t(o)}),i)}once(e,t,i){this.debug(`register once ${e}: ${i}`);return super.once(e,((n,o)=>{this.h5ConfirmHandleEvent(n,e,i),t(o)}),i)}}var qi,Qi,Yi,Xi,en;class tn{static getVersion(){return"2.22.2"}static getSystemInfo(){return{version:ji("version-id")||"",apiVersion:"2.22.2",zaloVersion:xi(),platform:Ui(),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 $i(e,0,t.version)}))}}class nn{static setNavigationBarTitle(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.CHANGE_TITLE_HEADER,{title:e.title},{haveTimeout:!1})}))}static setNavigationBarColor(e){return i(this,void 0,void 0,(function*(){const t={};let i;xt.isEmpty(e.textColor)||(t.textColor=e.textColor),xt.isString(e.color)&&e.color.length>0?(xt.isEmpty(e.color)||(t.backgroundColor=e.color),i=5):(xt.isEmpty(e.statusBarColor)||(t.backgroundColor=e.statusBarColor),i=6),this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{actionbarType:i,dataConfig:Object.assign(Object.assign({},e.dataConfig),t)}))),yield this.getJSBridge().callNative(pi.CHANGE_ACTIONBAR,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarLeftButton(e,t){return i(this,void 0,void 0,(function*(){let i,n;xt.isString(e)&&(i="none"===e||"home"===e?yi:mi,n="home"===e||"both"===e?_i:Si),this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{buttonType:xt.isNumber(i)?i:e.buttonType,dataConfig:Object.assign(Object.assign({},e.dataConfig),{confirmToExit:xt.isNumber(t)?t:e.dataConfig.confirmToExit,viewInLeftType:xt.isNumber(i)?i:e.dataConfig.viewInLeftType}),homeConfig:Object.assign(Object.assign({},e.homeConfig),{enable:xt.isNumber(n)?n:e.homeConfig.enable})}))),yield this.getJSBridge().callNative(pi.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBar(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.CHANGE_ACTIONBAR,{data:e},{haveTimeout:!1})}))}}class on{static setBackgroundColor(e){return i(this,void 0,void 0,(function*(){xt.isString(e.backgroundColor)&&e.backgroundColor.length>0&&(yield this.getJSBridge().callNative(pi.CHANGE_ACTIONBAR,{actionbarType:this.isShowNavBar?5:6,dataConfig:{backgroundColor:e.backgroundColor,textColor:e.textColor}}))}))}}class rn{constructor(e,t,i,n){this.title=n,this.severity=t;const o=new Date;if(this.time=o.toLocaleTimeString(),this.content=e,i>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(" ")}}qi=new WeakMap,Qi=new WeakMap,Yi=new WeakMap,Xi=new WeakMap,en=new WeakMap;const an=new class{constructor(){qi.set(this,3),Qi.set(this,["none","error","warn","info"]),Yi.set(this,"[zmp] > "),Xi.set(this,{error:0,warn:0,info:0,firstError:null,lastError:null}),en.set(this,((e,t,i)=>{n(this,Xi,"f")[n(this,Qi,"f")[e]]++;const r=n(this,Qi,"f")[e];if(o(this,Yi,n(this,Yi,"f")+("string"!=typeof t?new rn(t,r,e,i).toString():t),"f"),!(e>n(this,qi,"f")))switch(e){case 1:console.error(n(this,Yi,"f"));break;case 2:console.warn(n(this,Yi,"f"));break;case 3:console.info(n(this,Yi,"f"));break;default:throw new Error("internal")}}))}setLogLevel(e){o(this,qi,e,"f")}info(e){n(this,en,"f").call(this,3,e)}warn(e,t){n(this,en,"f").call(this,2,e,t)}error(e,t){n(this,en,"f").call(this,1,e,t)}getMetrics(){return n(this,Xi,"f")}};class sn{static setDeviceOrientation(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.CHANGE_AUTOROTATE,{autoRotate:exports.OrientationType[e.rotate]})}))}static getNetworkType(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.WEBVIEW_NETWORKTYPE,{url:window.location.href,featureId:""}).then((e=>{const t=e.network;let i;const n=Bi().isAndroid;switch(t){case ii(n).NONE:i=exports.NetworkType.none;break;case ii(n).WIFI:i=exports.NetworkType.wifi;break;case ii(n)["2G"]:case ii(n)["3G"]:case ii(n)["4G"]:i=exports.NetworkType.cellular;break;default:i=exports.NetworkType.unknown}return{networkType:i}}))}))}static onNetworkStatusChange(e){return i(this,void 0,void 0,(function*(){yield this.events.on(exports.Events.NetworkChanged,(t=>{const i=t&&t.state;this.getNetworkType().then((t=>{const n={isConnected:"CONNECTED"===i,networkType:t&&t.networkType};e(n)})).catch((e=>{an.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:xt.isNumber(null==e?void 0:e.scanningType)?e.scanningType:0,data:{scan_from_source:xt.isString(null==e?void 0:e.scanFromSource)?e.scanFromSource:"",expire:xt.isNumber(null==e?void 0:e.expire)?e.expire:3e3,monitor_interval:xt.isNumber(null==e?void 0:e.monitorInterval)?e.monitorInterval:60,domain:xt.isString(null==e?void 0:e.domain)?e.domain:"",scan_config:{scan_time:xt.isNumber(null===(t=null==e?void 0:e.scanConfig)||void 0===t?void 0:t.scanTime)?e.scanConfig.scanTime:15e3,time_between_scan:xt.isNumber(null===(n=null==e?void 0:e.scanConfig)||void 0===n?void 0:n.timeBetweenScan)?e.scanConfig.timeBetweenScan:1e4,beacon_timeout:xt.isNumber(null===(o=null==e?void 0:e.scanConfig)||void 0===o?void 0:o.beaconTimeout)?e.scanConfig.beaconTimeout:3e4,delayCheckConnectedTimeout:xt.isNumber(null===(r=null==e?void 0:e.scanConfig)||void 0===r?void 0:r.delayCheckConnectedTimeout)?e.scanConfig.delayCheckConnectedTimeout:5e3,beaconConnectedTimeout:xt.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.getJSBridge().callNative(pi.SCAN_IBEACON,Object.assign({},i)),!0}))}static stopBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.SCAN_IBEACON,Object.assign({},{subaction:2})),!0}))}static getBeacons(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.SCAN_IBEACON,Object.assign({},{subaction:1}),{isMultiCallback:!0}).then((e=>{const t={beacons:[]};return Array.isArray(e)&&e.forEach((e=>{const i={uuid:e.uuid,major:e.major,minor:e.minor,distance:e.distance,rssi:e.rssi};t.beacons.push(i)})),t}))}))}static stopBluetoothDevicesDiscovery(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static startBluetoothDevicesDiscovery(e){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},Object.assign({},e))}))}static openBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static onBluetoothDeviceFound(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().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.getJSBridge().callNative({name:""},t)}))}static getBluetoothDevices(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static getBluetoothAdapterState(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static closeBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static scanQRCode(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.OPEN_QR,{skipOpenLink:!0})}))}static showToast(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.SHOW_TOAST,{toast:e.message})}))}static hideKeyboard(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.HIDE_KEYBOARD,{})}))}static openPhone(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.OPEN_PHONE,{phoneNum:e.phoneNumber,phoneCode:e.phoneNumber})}))}static openSMS(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.OPEN_SMS,{content:e.content,phoneCode:e.phoneNumber})}))}static keepScreen(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.KEEP_SCREEN,{data:{keep_screen_on:e.keepScreenOn?1:0}})}))}static openBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.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,i,n,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===(i=null==e?void 0:e.data)||void 0===i?void 0:i.error_code,message:null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.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.getJSBridge().callNative(pi.PROMPT_AUTHENTICATION_CHECK_STATE,{}).then((e=>({bioState:null==e?void 0:e.bio_state})))}))}static vibrate(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.INTERACTIVE_VIBRATION,{type:exports.VibrateType[e.type],vibrate_time:e.milliseconds})}))}static connectWifi(e){return i(this,void 0,void 0,(function*(){let t="open";return xt.isString(e.password)&&e.password.length>0&&(t="wpa_wpa2"),yield this.getJSBridge().callNative(pi.MP_JOIN_WIFI,{ssid:e.SSID,securityType:t,password:e.password,hiddenSsid:e.hiddenSSID})}))}static openAppStore(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.OPEN_APPSTORE,e)}))}}var cn,ln,dn;class un{constructor(e){cn.set(this,localStorage),ln.set(this,void 0),dn.set(this,void 0),Bi(),o(this,dn,{keys:new Set,currentSize:0,limitSize:5242880},"f"),o(this,ln,e,"f"),this.findAllCurrentDataByApp(e)}findAllCurrentDataByApp(e){try{let t;for(t in n(this,cn,"f")){if(e){if(t.split("_")[0]!==e)continue}n(this,dn,"f").keys.add(t)}}catch(e){an.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 n(this,ln,"f")&&(e=`${n(this,ln,"f")}_${e}`),n(this,dn,"f").keys.has(e)?n(this,cn,"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){n(this,ln,"f")&&(e=`${n(this,ln,"f")}_${e}`),n(this,cn,"f").setItem(e,t),n(this,dn,"f").keys.add(e)}getInfo(){return i(this,void 0,void 0,(function*(){return Promise.resolve(this.getInfoSync())}))}getInfoSync(){const e=((e,t)=>{let i,n,o=0;for(n in e){const r=n.split("_")[0];e.hasOwnProperty(n)&&(t&&r!==t||(i=2*(e[n].length+n.length),o+=i))}return o})(n(this,cn,"f"),n(this,ln,"f"));return{currentSize:xt.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){n(this,ln,"f")&&(e=`${n(this,ln,"f")}_${e}`),n(this,dn,"f").keys.has(e)&&(n(this,cn,"f").removeItem(e),n(this,dn,"f").keys.delete(e))}clear(){return i(this,void 0,void 0,(function*(){return Promise.resolve(this.clearSync())}))}clearSync(){n(this,dn,"f").keys.forEach((e=>{n(this,ln,"f")&&e.indexOf(n(this,ln,"f"))<0||(n(this,cn,"f").removeItem(e),n(this,dn,"f").keys.delete(e))}))}}cn=new WeakMap,ln=new WeakMap,dn=new WeakMap;var pn={},hn=function(e,t,i){var n=t||"default";return function(){var t=n in pn?pn[n](e,i):e;return t.apply(this,arguments)}};hn.setWrapper=function(e){var t=arguments.length<=1||void 0===arguments[1]?"default":arguments[1];pn[t]=e};var vn={error:{code:1,error_subcode:1357046,message:"Received Invalid JSON reply.",type:"http"}};function fn(e){try{return null===e?vn:JSON.parse(e)}catch(e){return vn}}var gn,mn,yn,_n,Sn,En,On,An,Tn,bn,wn,Nn,Cn,In,Pn,kn,Rn,Dn,Bn,jn,xn,Un,Mn,Ln,Wn,zn,Jn,Fn,Kn,Gn,Hn={execute:function(e,t,i,n){i.suppress_http_code=1;var o=Ni.encode(i);"post"!=t&&(e=Ni.appendToUrl(e,o),o="");var r=function(e,t){if(!self.XMLHttpRequest)return null;var i=new XMLHttpRequest,n=function(){};if(!("withCredentials"in i))return null;i.open(e,t,!0),i.setRequestHeader("Content-type","application/x-www-form-urlencoded");var o={send:function(e){i.send(e)}},r=hn((function(){r=n,"onload"in o&&o.onload(i)}),"entry","XMLHttpRequest:load"),a=hn((function(){a=n,"onerror"in o&&o.onerror(i)}),"entry","XMLHttpRequest:error");return i.onload=function(){r()},i.onerror=function(){a()},i.onreadystatechange=function(){4==i.readyState&&(200==i.status?r():a())},o}(t,e);return!!r&&(r.onload=function(e){n(fn(e.responseText))},r.onerror=function(e){e.responseText?n(fn(e.responseText)):n({error:{code:1,error_subcode:1357045,message:"unknown error (empty response)",status:e.status,type:"http"}})},r.send(o),!0)}};class $n extends Vi{constructor(){super(),gn.add(this),this.debug=Ut("zmp:ZaloJSBridge"),this.events=Zi.getInstance(),this._accessTk=Li("zacc_session")||"DEFAULT_ACCESS_TOKEN",this._jsAccessTk=Li("zlink3rd")||"DEFAULT_JS_TOKEN",this.results=[],this._userAgent=Di(),this._device=Bi(),this.isJumped=!1,mn.set(this,null),yn.set(this,void 0),this.jump=()=>new Promise(((e,t)=>{xt.isUndefined(n(this,mn,"f"))||xt.isNull(n(this,mn,"f"))?this.callNative(pi.JUMP_LOGIN,{}).then((t=>{const i=t&&t.cookiesOAuthLogins||[],r=t&&t.actionPermission||[];Object.entries(r).forEach((e=>{const t=e[0],i=e[1]||{perm:0,decode:0};n(this,yn,"f")[t]||(n(this,yn,"f")[t]={permission:!1,support:!1}),n(this,yn,"f")[t].permission=1===i.perm}));const a=i.find((e=>e.name===Gt));a&&(this.jsAccessTk=a.value,window.ZJSBridge.setJSToken&&window.ZJSBridge.setJSToken(a.value)),o(this,mn,i,"f"),this.isJumped=!0,e(i)})).catch((e=>{this.isJumped=!1,t(e)})):e(n(this,mn,"f"))})),this._jsCallFuncCallbacks={},o(this,yn,{},"f"),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 $n.instance||($n.instance=new $n),$n.instance}set accessTk(e){this._accessTk=e}set jsAccessTk(e){this._jsAccessTk=e}sendLogData(e){try{const t=e.map((e=>({action:e.action,error:e.error})));Hn.execute(ti,"post",{appId:window.APP_ID,data:JSON.stringify(t)},(e=>{})),window.zmpSentry&&window.zmpSentry.captureMessage("Result from native",{extra:{data:e}})}catch(e){}}onJSCall(e,t){try{this.debug("onJSCall",e,t);const i=Wi(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,n=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,i)}catch(e){console.error("Call callback error",e)}n&&clearTimeout(n),this._jsCallFuncCallbacks[e]=null,delete this._jsCallFuncCallbacks[e]}}this.results.push({action:i.action,error:i.error_code,message:i.error_message})}catch(e){console.log("onJSCall","error",e)}}onMultiJSCall(e,t){try{this.debug("onMultiJSCall",e,t);const i=Wi(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,n=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,i)}catch(e){console.error("Call callback error",e)}n&&clearTimeout(n)}}this.results.push({action:i.action,error:i.error_code,message:i.error_message})}catch(e){console.log("onMultiJSCall","error",e)}}nativeEventHandler(e,t,i){this.debug(`eventId: ${e}, eventName: ${t}, eventData: ${i}`);const n=Ki(i);this.debug(n);const o=this.handleEventData(t,n);this.events.emit(t,e,o)}handleEventData(e,t){try{switch(e){case exports.Events.OpenApp:const{url:e}=t,i=new URL(e),n=i.pathname.split(`/zapps/${Jt}`)[1];return{path:`${n||"/"}${i.search}`};default:return t}}catch(e){return t}}defaultCallback(e){null!=e&&(e=Wi(e))}callNative(e,t,o){return this.debug(e.name,t),new Promise(((r,a)=>{const s=t=>i(this,void 0,void 0,(function*(){var i,n,s,c,l,d,u,p;try{if(xt.isUndefined(t)||xt.isNull(t))return a(new Error("Native callback is null"));if(0!==t.error_code){let o=new Ai(t.error_code,t.error_message);const r=Ui();if(e===pi.JUMP_LOGIN)o=new Ai(oi,`Can not get auth code: ${t.error_message}`);else if(this.isJumped||e.skip_jump){if("permission required!"===String(o.message).toLowerCase()||"no permission!"===String(o.message).toLowerCase())o=new Ai(ui.FORBIDDEN.code,ui.FORBIDDEN.message);else if(hi[r][t.error_code])o=new Ai(hi[r][t.error_code].code,hi[r][t.error_code].message);else if(null===(n=null===(i=e.error_list)||void 0===i?void 0:i[r])||void 0===n?void 0:n[String(t.error_code)]){let i=e.error_list[r][String(t.error_code)].map_to.message;(null===(l=null===(c=null===(s=e.error_list)||void 0===s?void 0:s[r])||void 0===c?void 0:c[String(t.error_code)])||void 0===l?void 0:l.need_more_detail)&&(i=`${null===(p=null===(u=null===(d=e.error_list)||void 0===d?void 0:d[r])||void 0===u?void 0:u[String(t.error_code)])||void 0===p?void 0:p.map_to.message}: ${t.error_message}`),o=new Ai(e.error_list[r][String(t.error_code)].map_to.code,i)}}else o=new Ai(ui.UNAUTHORIZED.code,ui.UNAUTHORIZED.message);return a(o)}if(null==o?void 0:o.successCallback){const e=yield o.successCallback(t.data);return r(e)}r(t.data||{})}catch(e){return a(e)}})),c=Bi().isIOS,l=(e=>{var t;const i=xi(),n=(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))||i>=n})(e);if(c&&!l){const e=new Ai(-5,"Client isn't support this action");return a(e)}(null==o?void 0:o.delay)?setTimeout((()=>{n(this,gn,"m",_n).call(this,e,t,s,null==o?void 0:o.isMultiCallback,null==o?void 0:o.nRetry,null==o?void 0:o.haveTimeout)}),o.delay):n(this,gn,"m",_n).call(this,e,t,s,null==o?void 0:o.isMultiCallback,null==o?void 0:o.nRetry,null==o?void 0:o.haveTimeout)}))}}mn=new WeakMap,yn=new WeakMap,gn=new WeakSet,_n=function e(t,i,o,r=!1,a=3,s=!0){try{const c=t.name,l=((e="")=>`${e.normalize("NFD").replace(Ci,"").replace(Ii,"d").replace(Pi,"").toLowerCase()}_${Math.random().toString(36).substr(2,4)}`)(c);if(!this._device.isMobile||xt.isEmpty(c))return this.onJSCall(l,{error_code:-13,error_message:"params invalid!",data:{device:this._device.isMobile,jsToken:this._jsAccessTk,access_token:this._accessTk},action:c}),!1;null==i&&(i={}),o||(o=this.defaultCallback);const d={error_code:-14,error_message:"Request Timeout!",data:{},action:c};this._jsCallFuncCallbacks[l]={timeout:s&&t.have_callback&&setTimeout((()=>{this.onJSCall(l,d)}),8e3),callback:o};try{return i=zi(i),r?this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,window.onMultiJSCall(l)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,`window.onMultiJSCall('${l}')`):this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,window.onJSCall(l)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,`window.onJSCall('${l}')`)}catch(s){if(!(a-- >0)){const e={error_code:-5,error_message:"Not ready!",data:{userAgent:this._userAgent,options:i,jsToken:this._jsAccessTk,access_token:this._accessTk},action:c,js_error:s};return this.onJSCall(l,e),!1}setTimeout((()=>{n(this,gn,"m",e).call(this,t,i,o,r,a)}),500)}}catch(e){console.log("jsCall","error",e)}return!1};class Vn{constructor(e){Sn.set(this,void 0),En.set(this,void 0),On.set(this,void 0),o(this,En,{keys:new Set,currentSize:0,limitSize:5242880},"f"),o(this,Sn,e,"f"),o(this,On,$n.getInstance(),"f")}get(e){return i(this,void 0,void 0,(function*(){return yield n(this,On,"f").callNative(pi.ZBROWSER_MPDS,{mpds_action:"mpds.get",mpds_data:{keys:e},appId:n(this,Sn,"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 n(this,On,"f").callNative(pi.ZBROWSER_MPDS,{mpds_action:"mpds.set",mpds_data:{map:e},appId:n(this,Sn,"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 n(this,On,"f").callNative(pi.ZBROWSER_MPDS,{mpds_action:"mpds.get.size",mpds_data:{},appId:n(this,Sn,"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:xt.isNumber(e)?Number(e/1024):0,limitSize:Number(5120)}}))}remove(e){return i(this,void 0,void 0,(function*(){return{errorKeys:yield n(this,On,"f").callNative(pi.ZBROWSER_MPDS,{mpds_action:"mpds.remove.key",mpds_data:{keys:e},appId:n(this,Sn,"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 n(this,On,"f").callNative(pi.ZBROWSER_MPDS,{mpds_action:"mpds.clear.appData",mpds_data:{},appId:n(this,Sn,"f")})}))}}Sn=new WeakMap,En=new WeakMap,On=new WeakMap;class Zn{getDataFromStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance(),i=yield t.get(e),n={};return i.forEach(((e,t)=>{n[t]=Ki(e)})),n}))}putDataToStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance(),i={};return Object.entries(e).forEach((([e,t])=>{xt.isUndefined(t)||xt.isNull(t)||(i[e]=Fi(t))})),yield t.set(i)}))}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 qn extends Zn{constructor(e){super(),An.set(this,void 0),o(this,An,e,"f")}getInstance(){return new un(n(this,An,"f"))}}An=new WeakMap;class Qn extends Zn{constructor(e){super(),Tn.set(this,void 0),o(this,Tn,e,"f")}getInstance(){return new Vn(n(this,Tn,"f"))}}Tn=new WeakMap;class Yn{static setStorage(e){return i(this,void 0,void 0,(function*(){let t=new qn(this.getAppId());return Ji()&&(t=new Qn(this.getAppId())),yield t.putDataToStorage(e.data)}))}static getStorage(e){return i(this,void 0,void 0,(function*(){let t=new qn(this.getAppId());Ji()&&(t=new Qn(this.getAppId()));return yield t.getDataFromStorage(e.keys)}))}static getStorageInfo(e){return i(this,void 0,void 0,(function*(){let e=new qn(this.getAppId());return Ji()&&(e=new Qn(this.getAppId())),yield e.getStorageInfo()}))}static removeStorage(e){return i(this,void 0,void 0,(function*(){let t=new qn(this.getAppId());return Ji()&&(t=new Qn(this.getAppId())),yield t.removeDataFromStorage(e.keys)}))}static clearStorage(e={}){return i(this,void 0,void 0,(function*(){let e=new qn(this.getAppId());Ji()&&(e=new Qn(this.getAppId())),yield e.clearStorage()}))}}class Xn{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(`${qt}?fields=${n}`,{headers:{access_token:t||""}}).then((e=>i(this,void 0,void 0,(function*(){const t=yield e.json(),i={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"),i}))))}}))}static getPhoneNumber(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.MP_GET_NUMBER,{},{isMultiCallback:!0,successCallback:e=>{const t={number:e};return Promise.resolve(t)},delay:this.isIOS?400:0})}))}}class eo{static closeApp(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.WINDOW_CLOSE,{})}))}static openMiniApp(e){return i(this,void 0,void 0,(function*(){const t=null==e?void 0:e.appId,i=(null==e?void 0:e.params)||{},n=Object.entries(i).map((function([e,t]){return[e,t].join("=")})).join("&");let o;try{o=yield $i(t,0)}catch(e){}const r={appId:t};o&&(r.appName=o.name,r.appAvtUrl=o.logoUrl),yield this.getJSBridge().callNative(pi.OPEN_MP,{mpUrl:`https://h5.zdn.vn/zapps/${t}/${n.length>0?"?"+n:""}`,mpInfo:r})}))}static openWebview(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.OPEN_INAPP,{url:e})}))}static closeLoading(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.MP_CLOSE_LOADINGVIEW,{at:(new Date).getTime(),when:e,url:location.href})}))}}class to{static getLocation(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.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,successCallback:e=>{const t={latitude:e.latitude,longitude:e.longitude,timestamp:e.timestamp,provider:e.provider};return Promise.resolve(t)},delay:this.isIOS?400:0})}))}static sendLocation(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.QUERY_LOCATION_HIDE,{title:e.title,touserid:e.toUserId,zapp:this.getZAppId()})}))}}class io{static requestCameraPermission(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.REQUEST_PERMISSION_CAMERA,{},{successCallback:()=>Promise.resolve({userAllow:!0,message:"User Allow"})})}))}static saveImageToPhotosAlbum(e){return i(this,void 0,void 0,(function*(){let t={};return xt.isEmpty(e.imageBase64Data)?xt.isEmpty(e.imageUrl)||(t={imageUrl:e.imageUrl}):t={imageBase64Data:e.imageBase64Data},yield this.getJSBridge().callNative(pi.SAVE_IMAGE_GALLERY,Object.assign({},t))}))}}class no{static viewOAQr(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.VIEW_MYQR,{dpn:e.displayName,uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openProfile(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.OPEN_PROFILE,{uId:e.id,type:exports.ProfileType[e.type],zapp:this.getZAppId(),sourceId:e.sourceId,sourceIndex:e.sourceIndex})}))}static openChat(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.OPEN_CHAT,{uId:e.id,type:exports.ChatType[e.type],msg:e.message||"",zapp:this.getZAppId(),sourceId:e.sourceId,sourceIndex:e.sourceIndex})}))}static openPostFeed(e){return i(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.getJSBridge().callNative(pi.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 i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(pi.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.getJSBridge().callNative(pi.UNFOLLOW_OA,{uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openShareSheet(e){return i(this,void 0,void 0,(function*(){let t={},i=e.type;switch(e.type){case"image":let n=[];const o=xi(),r=Ui();o>=fi[r]&&(i="multi_image"),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 a=yield this.getAccessToken(),s=yield Gi(this.getAppId(),a||"",e.data.title||"",e.data.description||"",e.data.thumbnail||"",e.data.path);window.forceShareZMP?t={data:{ZInstantAPIInfo:{url:`${s.zinstantApi}`,zinstantdata_id:`templateId=${s.ztemplateId}&appId=${this.getAppId()}&shareId=${s.shareId}`},previewMsgText:{msg:{en:"Zalo Mini Program",vi:"Chương trình nhỏ"}},enableReactions:1}}:(t={link:s.shareableLink,chatOnly:e.data.chatOnly?1:0},e.type="link")}return yield this.getJSBridge().callNative(pi.OPEN_SHARESHEET,Object.assign(Object.assign({type:exports.ShareSheetType[i]},t),{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.getJSBridge().callNative(pi.CREATE_SHORTCUT,{url:e,title:t,iconUrl:n})}))}static openProfilePicker(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.MP_OPEN_PROFILE_PICKER,{maxProfile:e},{isMultiCallback:!0,successCallback:e=>{if(Array.isArray(e))return Promise.resolve(e.map((e=>e.id)))}})}))}static getActionsSupported(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.GET_SUPPORTED_ACTIONS,{},{isMultiCallback:!1,successCallback:e=>{const t=Ui();if(Array.isArray(e.actions)&&e.actions.length>0){const t=Object.keys(pi).filter((e=>pi[e].skip_jump)),i={actions:[...e.actions,...t]};return Promise.resolve(i)}if(t===exports.PlatformType.iOS){const e={actions:gi};return Promise.resolve(e)}}})}))}static openMediaPicker(e,t,n,o,r,a){return i(this,void 0,void 0,(function*(){const i={type:0,url:t,maxSize:n||1048576};return yield this.getJSBridge().callNative(pi.PICK_MEDIA,{media_type:exports.MediaPickerType[e],edit_view:Object.assign(Object.assign({},{enable:1,aspect_ratio:"1:1"}),o),silent_request:r,upload:i,max_select_items:a},{isMultiCallback:!0,successCallback:e=>{const t={data:null==e?void 0:e.result_content};return Promise.resolve(t)}})}))}static openOutApp(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(pi.OPEN_OUTAPP,{url:e})}))}}class oo{static getRouteParams(){let e={};const t=window.location.href;try{let i=new URL(t).searchParams.toString();i&&(e=Ni.getParamsAsObject(i))}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.getJSBridge().callNative(pi.WEBVIEW_SET_RESULT,{result:Fi(e.data)})}))}static onCallbackData(e){return i(this,void 0,void 0,(function*(){yield this.events.on(exports.Events.OnDataCallback,(t=>{e({data:t})}))}))}}class ro{constructor(){var e,t,i,r,a,s,c,l,d,u,p,h,v,f,g,m,y;bn.set(this,zt),wn.set(this,Jt),Nn.set(this,Ft),Cn.set(this,void 0),In.set(this,void 0),Pn.set(this,void 0),kn.set(this,null),Rn.set(this,{timer:{getToken:0}}),Dn.set(this,void 0),Bn.set(this,void 0),jn.set(this,void 0),xn.set(this,void 0),Un.set(this,void 0),this.events=Zi.getInstance(),this.isIOS=Bi().isIOS,Mn.set(this,void 0),this.getActionBarConfig=()=>n(this,Mn,"f"),this.setActionBarConfig=e=>{o(this,Mn,e(n(this,Mn,"f")),"f")},this.getVersion=tn.getVersion,this.getSystemInfo=tn.getSystemInfo,this.setNavigationBarTitle=nn.setNavigationBarTitle,this.setNavigationBarColor=nn.setNavigationBarColor,this.setNavigationBarLeftButton=nn.setNavigationBarLeftButton,this.setBackgroundColor=on.setBackgroundColor,this.setDeviceOrientation=sn.setDeviceOrientation,this.setStorage=Yn.setStorage,this.getStorage=Yn.getStorage,this.getStorageInfo=Yn.getStorageInfo,this.removeStorage=Yn.removeStorage,this.clearStorage=Yn.clearStorage,this.getUserInfo=Xn.getUserInfo,this.getNetworkType=sn.getNetworkType,this.onNetworkStatusChange=sn.onNetworkStatusChange,this.startBeaconDiscovery=sn.startBeaconDiscovery,this.stopBeaconDiscovery=sn.stopBeaconDiscovery,this.getBeacons=sn.getBeacons,this.closeApp=eo.closeApp,this.getLocation=to.getLocation,this.stopBluetoothDevicesDiscovery=sn.stopBluetoothDevicesDiscovery,this.startBluetoothDevicesDiscovery=sn.stopBluetoothDevicesDiscovery,this.openBluetoothAdapter=sn.openBluetoothAdapter,this.onBluetoothDeviceFound=sn.onBluetoothDeviceFound,this.onBluetoothAdapterStateChange=sn.onBluetoothAdapterStateChange,this.getConnectedBluetoothDevices=sn.getConnectedBluetoothDevices,this.getBluetoothDevices=sn.getBluetoothDevices,this.getBluetoothAdapterState=sn.getBluetoothAdapterState,this.closeBluetoothAdapter=sn.closeBluetoothAdapter,this.scanQRCode=sn.scanQRCode,this.openProfile=no.openProfile,this.openChat=no.openChat,this.openPostFeed=no.openPostFeed,this.followOA=no.followOA,this.unFollowOA=no.unfollowOA,this.openShareSheet=no.openShareSheet,this.requestCameraPermission=io.requestCameraPermission,this.createShortcut=no.createShortcut,this.openBioAuthentication=sn.openBioAuthentication,this.checkStateBioAuthentication=sn.checkStateBioAuthentication,this.sendLocation=to.sendLocation,this.showToast=sn.showToast,this.hideKeyboard=sn.hideKeyboard,this.openPhone=sn.openPhone,this.openSMS=sn.openSMS,this.viewOAQr=no.viewOAQr,this.keepScreen=sn.keepScreen,this.saveImageToPhotosAlbum=io.saveImageToPhotosAlbum,this.openMiniApp=eo.openMiniApp,this.vibrate=sn.vibrate,this.openWebview=eo.openWebview,this.getRouteParams=oo.getRouteParams,this.getAppInfo=tn.getAppInfo,this.sendDataToPreviousMiniApp=oo.sendDataToPreviousMiniApp,this.onCallbackData=oo.onCallbackData,this.getPhoneNumber=Xn.getPhoneNumber,this.openProfilePicker=no.openProfilePicker,Ln.set(this,no.getActionsSupported),this.connectWifi=sn.connectWifi,this.openMediaPicker=no.openMediaPicker,this.openOutApp=no.openOutApp,this.closeLoading=eo.closeLoading,this.openAppStore=sn.openAppStore,o(this,Cn,null,"f"),o(this,In,null,"f"),o(this,Pn,null,"f"),this.isShowNavBar=!0,o(this,Bn,0,"f"),o(this,jn,0,"f"),o(this,xn,"","f"),o(this,Un,null,"f"),o(this,Dn,$n.getInstance(),"f");const _="home"===(null===(t=null===(e=n(this,Nn,"f"))||void 0===e?void 0:e.app)||void 0===t?void 0:t.leftButton)||"both"===(null===(r=null===(i=n(this,Nn,"f"))||void 0===i?void 0:i.app)||void 0===r?void 0:r.leftButton)?_i:Si,S=new URL(location.href),E=xt.isString(null===(s=null===(a=n(this,Nn,"f"))||void 0===a?void 0:a.app)||void 0===s?void 0:s.headerColor)&&(null===(d=null===(l=null===(c=n(this,Nn,"f"))||void 0===c?void 0:c.app)||void 0===l?void 0:l.headerColor)||void 0===d?void 0:d.length)>0?5:6,O="none"===(null===(p=null===(u=n(this,Nn,"f"))||void 0===u?void 0:u.app)||void 0===p?void 0:p.leftButton)||"home"===(null===(v=null===(h=n(this,Nn,"f"))||void 0===h?void 0:h.app)||void 0===v?void 0:v.leftButton)?yi:mi;o(this,Mn,{actionbarType:E,buttonType:O,dataConfig:{backgroundColor:(null===(g=null===(f=n(this,Nn,"f"))||void 0===f?void 0:f.app)||void 0===g?void 0:g.headerColor)||"",textColor:(null===(y=null===(m=n(this,Nn,"f"))||void 0===m?void 0:m.app)||void 0===y?void 0:y.textColor)||"",viewInLeftType:O,confirmToExit:1},homeConfig:{enable:_,url:`https://h5.zdn.vn/zapps/${this.getAppId()}/${S.search}`}},"f")}static getInstance(){return ro.instance||(ro.instance=new ro),ro.instance}getLoginStatus(){return xt.isString(n(this,Pn,"f"))&&n(this,Pn,"f").length>0}getAppId(){return n(this,wn,"f")}getZAppId(){return n(this,bn,"f")}getDeviceId(){return n(this,xn,"f")}getContext(){return n(this,Un,"f")}getJSBridge(){return n(this,Dn,"f")}login(e){return i(this,void 0,void 0,(function*(){const e=(new Date).getTime()-n(this,Bn,"f");if(n(this,Pn,"f")&&e<n(this,jn,"f"))return n(this,Pn,"f");const t=yield n(this,Dn,"f").jump(),i=t.find((e=>e.name===$t)),r=t.find((e=>e.name===Vt)),a=t.find((e=>e.name===Zt));i&&o(this,xn,i.value,"f"),r&&a&&o(this,Un,{id:r.value,type:a.value},"f");const s=t.find((e=>e.name===Kt)),c=t.find((e=>e.name===Ht));if(!xt.isUndefined(s)&&!xt.isNull(s)&&xt.isString(s.value)){if(o(this,Cn,s.value,"f"),xt.isUndefined(c)||xt.isNull(c)||!xt.isString(c.value)?yield this.loginZaloV3():(o(this,In,c.value,"f"),yield this.loginZaloV4()),!n(this,Pn,"f"))throw wi.loginFailed("Invalid authorization code");return n(this,Pn,"f")}throw wi.loginFailed("Zalo app has not been activated")}))}loginZaloV3(){return i(this,void 0,void 0,(function*(){return yield fetch(`${Yt}?app_id=${n(this,bn,"f")}&redirect_uri=https://h5.zdn.vn/zapps/${n(this,wn,"f")}/&code=${n(this,Cn,"f")}&isSDK=true`).then((e=>i(this,void 0,void 0,(function*(){let t=yield e.json();if(t.access_token){o(this,Pn,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return o(this,jn,e,"f"),o(this,Bn,(new Date).getTime(),"f"),n(this,Dn,"f").accessTk=n(this,Pn,"f")||"",window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(n(this,Pn,"f")||""),n(this,Pn,"f")}return null}))))}))}loginZaloV4(){return i(this,void 0,void 0,(function*(){const e=new URLSearchParams;e.append("app_id",n(this,wn,"f")),e.append("code",n(this,Cn,"f")||""),e.append("code_verifier",n(this,In,"f")||""),xt.isNull(n(this,kn,"f"))?e.append("grant_type","authorization_code"):(e.append("grant_type","refresh_token"),e.append("refresh_token",n(this,kn,"f")||""));return yield fetch(Qt,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&&o(this,kn,t.refresh_token,"f"),t.access_token){o(this,Pn,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return o(this,jn,e,"f"),o(this,Bn,(new Date).getTime(),"f"),n(this,Dn,"f").accessTk=n(this,Pn,"f")||"",window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(n(this,Pn,"f")||""),n(this,Pn,"f")}return null}))))}))}getAccessToken(e){return i(this,void 0,void 0,(function*(){const e=(new Date).getTime()-n(this,Bn,"f");if(!n(this,Pn,"f"))throw wi.loginRequired();return e<n(this,jn,"f")?n(this,Pn,"f"):yield this.login()}))}}bn=new WeakMap,wn=new WeakMap,Nn=new WeakMap,Cn=new WeakMap,In=new WeakMap,Pn=new WeakMap,kn=new WeakMap,Rn=new WeakMap,Dn=new WeakMap,Bn=new WeakMap,jn=new WeakMap,xn=new WeakMap,Un=new WeakMap,Mn=new WeakMap,Ln=new WeakMap;class ao{constructor(){Wn.set(this,zt),zn.set(this,Ft),Jn.set(this,"DEFAULT ZOAUTH"),Fn.set(this,"DEFAULT ACCESS TOKEN"),Kn.set(this,{timer:{getToken:0}}),Gn.set(this,!1),this.getLoginStatus=()=>n(this,Gn,"f"),this.getAppId=()=>n(this,Wn,"f"),this.getDeviceId=()=>"",this.login=()=>(o(this,Gn,!0,"f"),Promise.resolve(n(this,Jn,"f"))),this.getAccessToken=()=>Promise.resolve(n(this,Fn,"f")),this.getVersion=tn.getVersion,this.getSystemInfo=tn.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 qn(this.getAppId());return yield t.putDataToStorage(e.data),{errorKeys:[]}})),this.getStorage=e=>i(this,void 0,void 0,(function*(){const t=new qn(this.getAppId());return yield t.getDataFromStorage(e.keys)})),this.getStorageInfo=e=>i(this,void 0,void 0,(function*(){const e=new qn(this.getAppId());return yield e.getStorageInfo()})),this.removeStorage=e=>i(this,void 0,void 0,(function*(){const t=new qn(this.getAppId());return yield t.removeDataFromStorage(e.keys)})),this.clearStorage=e=>i(this,void 0,void 0,(function*(){const e=new qn(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,i=t.effectiveType;return t.addEventListener("change",(function(){let t;switch(i){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),Promise.resolve()),this.getRouteParams=oo.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(),this.openAppStore=e=>Promise.resolve()}getContext(){return null}on(e,t,i){throw new Error("Method not implemented.")}once(e,t,i){throw new Error("Method not implemented.")}off(e,t,i,n){throw new Error("Method not implemented.")}removeAllListeners(e){throw new Error("Method not implemented.")}openMediaPicker(e,t,i,n,o,r){return console.warn("This api only works on zalo app"),Promise.resolve({data:""})}}Wn=new WeakMap,zn=new WeakMap,Jn=new WeakMap,Fn=new WeakMap,Kn=new WeakMap,Gn=new WeakMap;const so=Symbol("required"),co=Symbol("checkType"),lo=(e,t)=>(i,n,o)=>{let r=Reflect.getOwnMetadata(so,i,n)||[];r.push({parameterIndex:o,fields:e,option:t}),Reflect.defineMetadata(so,r,i,n)},uo=(e,t,i)=>(n,o,r)=>{let a=Reflect.getOwnMetadata(co,n,o)||[];a.push({parameterIndex:r,type:e,properties:t,defaultValue:i}),Reflect.defineMetadata(co,a,n,o)};function po(e,t){Reflect.getMetadataKeys(e).map((i=>{const n=Reflect.getMetadata(i,e);Reflect.defineMetadata(i,n,t)}))}const ho=(e,t={})=>i=>{var n;let o=Object.getOwnPropertyDescriptors(i.prototype);if(t.deep){let e=Object.getPrototypeOf(i);for(;e.prototype;){const t=Object.getOwnPropertyDescriptors(e.prototype);o=Object.assign(Object.assign({},t),o),e=Object.getPrototypeOf(e)}}for(const[r,a]of Object.entries(o)){const o="function"==typeof a.value&&"constructor"!=r;if(null===(n=t.exclude)||void 0===n?void 0:n.includes(r))continue;if(t.excludePrefix&&r.startsWith(t.excludePrefix))continue;if(!o)continue;const s=a.value;e(i,r,a),s!=a.value&&po(s,a.value),Object.defineProperty(i.prototype,r,a)}},vo=(e,t,i)=>{const n=i.value,o=function(e){return e.toString().match(/\(.*?\)/)[0].replace(/[()]/gi,"").replace(/\s/gi,"").split(",")}(n);return i.value=function(...i){try{const r=Reflect.getOwnMetadata(so,e.prototype,t),a=Reflect.getOwnMetadata(co,e.prototype,t);a&&a.forEach((e=>{const{parameterIndex:t,type:n,properties:r,defaultValue:a}=e;let s=i[t],c=o[t];const l=typeof s;if(!xt.isUndefined(s)){if(!Mi(s,n))throw wi.wrongTypeParam(c,n,Array.isArray(s)?"array":null===s?"null":l);"object"===n&&Object.entries(r).forEach((([e,n])=>{const o=e.split("?")[0],r=xt.get(s,o);if(xt.isUndefined(r)||xt.isNull(r)){if(!e.includes("?"))throw wi.missingParam(e);xt.get(s,o.split(".")[0])||!a||xt.isUndefined(xt.get(a,o))||xt.set(i[t],o,xt.get(a,o))}else if(xt.isFunction(n)){const e=n(r);if(e&&e.error)throw wi.wrongTypeParam(`${c}.${o}`,e.errorMessage,typeof r)}}))}})),r&&r.forEach((e=>{const{parameterIndex:t,option:n,fields:o}=e,r=i[t],a=null==n?void 0:n.if,s=null==n?void 0:n.defaultValue;let c=!0;a&&(c=Object.keys(a).every((e=>xt.get(r,e)===a[e]))),c&&o.forEach((e=>{const n=e=>{let n=!1;return xt.isEmpty(xt.get(r,e))&&(xt.isUndefined(xt.get(s,e))||xt.set(i[t],e,xt.get(s,e)),n=!0),n};if(Array.isArray(e)&&e.length>0&&e.every(n))throw wi.missingParam(e.join(" or "));if(xt.isString(e)&&n(e))throw wi.missingParam(e)}))}));const s=n.call(this,...i);if(xt.isPromise(s)){const{success:e,fail:n}=Array.isArray(i)&&i.length>0&&i[0];return new Promise(((i,o)=>{s.then((t=>{!xt.isNull(e)&&xt.isFunction(e)?e.call(null,t,this):i(s)})).catch((e=>{const i=Ti(e,t);!xt.isNull(n)&&xt.isFunction(n)?n.call(null,i,this):o(i)}))}))}return s}catch(e){throw Ti(e,t)}},i};var fo,go,mo,yo,_o;exports.SDKCreator=class{constructor(){this.events=Zi.getInstance(),fo.set(this,void 0),o(this,fo,this.getServiceInstance(),"f"),this.events.addListener=(e,t,i)=>{const n=e;return this.events.addListener(exports.Events[n],t,i)}}login(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").login(e)}))}getLoginStatus(){return n(this,fo,"f").getLoginStatus()}getAccessToken(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getAccessToken(e)}))}getVersion(){return n(this,fo,"f").getVersion()}getSystemInfo(){return n(this,fo,"f").getSystemInfo()}setNavigationBarTitle(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").setNavigationBarTitle(e)}))}setNavigationBarColor(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").setNavigationBarColor(e)}))}setBackgroundColor(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").setBackgroundColor(e)}))}setNavigationBarLeftButton(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").setNavigationBarLeftButton(e.type)}))}setDeviceOrientation(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").setDeviceOrientation(e)}))}setStorage(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").setStorage(e)}))}getStorage(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getStorage(e)}))}getStorageInfo(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getStorageInfo(e)}))}removeStorage(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").removeStorage(e)}))}clearStorage(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").clearStorage(e)}))}getUserInfo(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getUserInfo(e)}))}getNetworkType(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getNetworkType(e)}))}onNetworkStatusChange(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").onNetworkStatusChange(e)}))}startBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").startBeaconDiscovery(e)}))}stopBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").stopBeaconDiscovery(e)}))}getBeacons(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getBeacons(e)}))}closeApp(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").closeApp(e)}))}getLocation(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getLocation(e)}))}stopBluetoothDevicesDiscovery(){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").stopBluetoothDevicesDiscovery()}))}startBluetoothDevicesDiscovery(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").startBluetoothDevicesDiscovery(e)}))}openBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").openBluetoothAdapter()}))}onBluetoothDeviceFound(){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").onBluetoothDeviceFound()}))}onBluetoothAdapterStateChange(){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").onBluetoothAdapterStateChange()}))}getConnectedBluetoothDevices(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getConnectedBluetoothDevices(e)}))}getBluetoothDevices(){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getBluetoothDevices()}))}getBluetoothAdapterState(){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getBluetoothAdapterState()}))}closeBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").closeBluetoothAdapter()}))}scanQRCode(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").scanQRCode(e)}))}openProfile(e){return i(this,void 0,void 0,(function*(){yield n(this,fo,"f").openProfile(e)}))}openChat(e){return i(this,void 0,void 0,(function*(){yield n(this,fo,"f").openChat(e)}))}openPostFeed(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").openPostFeed(e)}))}followOA(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").followOA(e)}))}unfollowOA(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").unFollowOA(e)}))}openShareSheet(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").openShareSheet(e)}))}requestCameraPermission(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").requestCameraPermission(e)}))}createShortcut(e){return i(this,void 0,void 0,(function*(){const t=yield $i(Jt,0),i=Bi().isIOS,o=t.logoUrl||ji("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"),i){a.append("appId",Jt),a.append("appName",r),a.append("appIcon",o);const e=`https://mini.zalo.me/shortcut.html?${a.toString()}`;yield n(this,fo,"f").openOutApp(encodeURI(e))}else yield n(this,fo,"f").createShortcut(`https://zalo.me/app/link/zapps/${Jt}/?${a.toString()}`,r,o);return bi()}))}openBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").openBioAuthentication(e)}))}checkStateBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").checkStateBioAuthentication(e)}))}sendLocation(e){return i(this,void 0,void 0,(function*(){yield n(this,fo,"f").sendLocation(e)}))}showToast(e){return i(this,void 0,void 0,(function*(){yield n(this,fo,"f").showToast(e)}))}hideKeyboard(e){return i(this,void 0,void 0,(function*(){yield n(this,fo,"f").hideKeyboard(e)}))}openPhone(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").openPhone(e)}))}openSMS(e){return i(this,void 0,void 0,(function*(){yield n(this,fo,"f").openSMS(e)}))}viewOAQr(e){return i(this,void 0,void 0,(function*(){yield n(this,fo,"f").viewOAQr(e)}))}keepScreen(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").keepScreen(e)}))}saveImageToGallery(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").saveImageToPhotosAlbum(e)}))}saveImageToPhotosAlbum(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").saveImageToPhotosAlbum(e)}))}openMiniApp(e){return i(this,void 0,void 0,(function*(){if(!xt.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 n(this,fo,"f").openMiniApp(e)}))}vibrate(e){return i(this,void 0,void 0,(function*(){console.log(e),yield n(this,fo,"f").vibrate(e)}))}openWebview(e){return i(this,void 0,void 0,(function*(){const t=new URL(e.url),i=t.searchParams.get("typeInapp");xt.isEmpty(i)&&t.searchParams.set("typeInapp","1"),yield n(this,fo,"f").openWebview(t.href)}))}getRouteParams(){return n(this,fo,"f").getRouteParams()}getAppInfo(e){return n(this,fo,"f").getAppInfo()}sendDataToPreviousMiniApp(e){return n(this,fo,"f").sendDataToPreviousMiniApp(e)}onCallbackData(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").onCallbackData(e)}))}getPhoneNumber(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").getPhoneNumber()}))}openProfilePicker(e){return i(this,void 0,void 0,(function*(){const t=yield n(this,fo,"f").openProfilePicker(e.maxProfile);let i;if(t.length>0)try{const e=yield this.getAccessToken(),n=yield fetch(Xt,{method:"POST",headers:{"Content-Type":"application/json",access_token:e||""},body:JSON.stringify({fields:"id,name,picture",user_ids:t})}),o=yield n.json();if(0!==o.error||!o.data)throw new Error(o.message);i=t.map((e=>{var t,i,n,r,a,s,c,l,d,u,p;return{id:(null===(i=null===(t=o.data[e])||void 0===t?void 0:t.user_info)||void 0===i?void 0:i.user_id_by_app)||"",profile:{name:null===(r=null===(n=o.data[e])||void 0===n?void 0:n.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===(d=o.data[e])||void 0===d?void 0:d.error)?-1:0,message:`Get profile: ${xt.isUndefined(null===(u=o.data[e])||void 0===u?void 0:u.message)?"Unknown error":null===(p=o.data[e])||void 0===p?void 0:p.message}`}}))}catch(e){i=t.map((t=>({id:t,profile:{name:"",avatar:""},code:-1,message:`Can't get profile: ${e.message}`})))}return{users:i||[]}}))}connectWifi(e){return i(this,void 0,void 0,(function*(){return yield n(this,fo,"f").connectWifi(e)}))}openMediaPicker(e){var t,o,r;return i(this,void 0,void 0,(function*(){const i={};xt.isUndefined(null===(t=e.editView)||void 0===t?void 0:t.enable)||(null===(o=e.editView)||void 0===o?void 0:o.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 n(this,fo,"f").openMediaPicker(e.type,e.serverUploadUrl,e.maxItemSize,i,a,s)}))}getShareableLink(e){return i(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();return(yield Gi(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 n(this,fo,"f").closeLoading("user action")}))}requestUpdateZalo(e){return i(this,void 0,void 0,(function*(){const e=Bi().isIOS?"https://apps.apple.com/vn/app/zalo/id579523206":"https://play.google.com/store/apps/details?id=com.zing.zalo";return yield n(this,fo,"f").openOutApp(e)}))}onConfirmToExit(e){this.events.on(exports.Events.AppClose,e,'{"handle_h5": 1}'),n(this,fo,"f").setNavigationBarLeftButton(void 0,2)}offConfirmToExit(){this.events.off(exports.Events.AppClose),n(this,fo,"f").setNavigationBarLeftButton(void 0,0)}getDeviceId(){return n(this,fo,"f").getDeviceId()}getContext(){return n(this,fo,"f").getContext()}},fo=new WeakMap,e([t(0,uo("object",{title:Hi("string")}))],exports.SDKCreator.prototype,"setNavigationBarTitle",null),e([t(0,uo("object",{color:Hi("string"),"textColor?":Hi("string",{values:["white","black"]}),"statusBarColor?":Hi("string")}))],exports.SDKCreator.prototype,"setNavigationBarColor",null),e([t(0,uo("object",{backgroundColor:Hi("string"),"textColor?":Hi("string",{values:["white","black"]})}))],exports.SDKCreator.prototype,"setBackgroundColor",null),e([t(0,uo("object",{type:Hi("string",{values:["none","back","home","both"]})}))],exports.SDKCreator.prototype,"setNavigationBarLeftButton",null),e([t(0,uo("object",{rotate:Hi("string",{values:["auto","portrait","landscape"]})}))],exports.SDKCreator.prototype,"setDeviceOrientation",null),e([t(0,uo("object",{data:Hi("object")}))],exports.SDKCreator.prototype,"setStorage",null),e([t(0,uo("object",{keys:Hi("array<string>")}))],exports.SDKCreator.prototype,"getStorage",null),e([t(0,uo("object",{keys:Hi("array<string>")}))],exports.SDKCreator.prototype,"removeStorage",null),e([t(0,uo("object",{"avatarType?":Hi("string",{values:["small","normal","large"]})}))],exports.SDKCreator.prototype,"getUserInfo",null),e([t(0,uo("object",{type:Hi("string",{values:["user","oa","aliasOA"]}),id:Hi("string")}))],exports.SDKCreator.prototype,"openProfile",null),e([t(0,uo("object",{type:Hi("string",{values:["user","oa"]}),id:Hi("string"),"message?":Hi("string")}))],exports.SDKCreator.prototype,"openChat",null),e([t(0,lo(["data.imageUrl"],{if:{type:"image"}})),t(0,lo(["data.link"],{if:{type:"link"}})),t(0,lo(["data.id"],{if:{type:"profile"}})),t(0,uo("object",{type:Hi("string",{values:["image","link","profile"]}),data:Hi("object"),"data.imageUrl?":Hi("url"),"data.link?":Hi("url"),"data.title?":Hi("string"),"data.thumb?":Hi("url"),"data.description?":Hi("string"),"data.avatar?":Hi("url"),"data.id?":Hi("string"),"data.displayName?":Hi("string")}))],exports.SDKCreator.prototype,"openPostFeed",null),e([t(0,uo("object",{id:Hi("string"),"showDialogConfirm?":Hi("boolean")}))],exports.SDKCreator.prototype,"followOA",null),e([t(0,uo("object",{id:Hi("string")}))],exports.SDKCreator.prototype,"unfollowOA",null),e([t(0,lo([["data.imageUrl","data.imageUrls"]],{if:{type:"image"}})),t(0,lo(["data.link"],{if:{type:"link"}})),t(0,lo(["data.id"],{if:{type:"oa"}})),t(0,lo(["data.gifUrl"],{if:{type:"gif"}})),t(0,lo(["data.videoThumb","data.videoUrl"],{if:{type:"video"}})),t(0,lo(["data.thumbnail","data.title","data.description"],{if:{type:"zmp"},defaultValue:{data:{description:""}}})),t(0,uo("object",{type:Hi("string",{values:["image","gif","video","link","oa","zmp"]}),data:Hi("object"),"data.imageUrl?":Hi("url"),"data.imageUrls?":Hi("array<url>",{maxLength:10}),"data.caption?":Hi("string"),"data.gifUrl?":Hi("url"),"data.width?":Hi("number"),"data.height?":Hi("number"),"data.videoThumb?":Hi("url"),"data.videoUrl?":Hi("url"),"data.link?":Hi("url"),"data.chatOnly?":Hi("boolean"),"data.id?":Hi("string"),"data.thumbnail?":Hi("url"),"data.path?":Hi("string"),"data.title?":Hi("string",{maxLength:100}),"data.description?":Hi(["string"],{maxLength:400})}))],exports.SDKCreator.prototype,"openShareSheet",null),e([t(0,uo("object",{secretData:Hi("string"),"ui?":Hi("object"),"ui.title?":Hi("string"),"ui.subTitle?":Hi("string"),"ui.negativeButtonText?":Hi("string"),"requireFingerprint?":Hi("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"}}))],exports.SDKCreator.prototype,"openBioAuthentication",null),e([t(0,uo("object",{toUserId:Hi("string"),"title?":Hi("string")}))],exports.SDKCreator.prototype,"sendLocation",null),e([t(0,uo("object",{message:Hi("string")}))],exports.SDKCreator.prototype,"showToast",null),e([t(0,uo("object",{phoneNumber:Hi("string")}))],exports.SDKCreator.prototype,"openPhone",null),e([t(0,uo("object",{content:Hi("string"),phoneNumber:Hi("string",{regex:/^\+?\d+$/})}))],exports.SDKCreator.prototype,"openSMS",null),e([t(0,uo("object",{id:Hi("string"),"displayName?":Hi("string")},{displayName:""}))],exports.SDKCreator.prototype,"viewOAQr",null),e([t(0,uo("object",{"imageBase64Data?":Hi("string"),"imageUrl?":Hi("url")}))],exports.SDKCreator.prototype,"saveImageToGallery",null),e([t(0,uo("object",{"imageBase64Data?":Hi("string"),"imageUrl?":Hi("url")}))],exports.SDKCreator.prototype,"saveImageToPhotosAlbum",null),e([t(0,uo("object",{appId:Hi("string"),"params?":Hi("object")}))],exports.SDKCreator.prototype,"openMiniApp",null),e([t(0,uo("object",{"type?":Hi("string",{values:["oneShot"]}),"milliseconds?":Hi("number")},{type:"oneShot",milliseconds:500}))],exports.SDKCreator.prototype,"vibrate",null),e([t(0,uo("object",{url:Hi("url")}))],exports.SDKCreator.prototype,"openWebview",null),e([t(0,uo("object",{"maxProfile?":Hi("number",{min:1,max:10})},{maxProfile:1}))],exports.SDKCreator.prototype,"openProfilePicker",null),e([t(0,lo(["SSID"])),t(0,uo("object",{SSID:Hi("string"),"password?":Hi("string"),"hiddenSSID?":Hi("boolean")}))],exports.SDKCreator.prototype,"connectWifi",null),e([t(0,uo("object",{type:Hi("string",{values:["photo","video","file"]}),serverUploadUrl:Hi("url"),"maxItemSize?":Hi("number",{min:0}),"editView?":Hi("object"),"editView.enable?":Hi("boolean"),"editView.aspectRatio?":Hi("string",{regex:/^\d+:\d+$/}),"silentRequest?":Hi("boolean"),"maxSelectItem?":Hi("number",{min:1})}))],exports.SDKCreator.prototype,"openMediaPicker",null),e([t(0,uo("object",{title:Hi("string",{maxLength:100}),"thumbnail?":Hi("url"),"path?":Hi("string"),description:Hi(["string"],{maxLength:400})},{description:""}))],exports.SDKCreator.prototype,"getShareableLink",null),exports.SDKCreator=e([ho(vo)],exports.SDKCreator);class So extends exports.SDKCreator{getServiceInstance(){return ro.getInstance()}}class Eo extends exports.SDKCreator{getServiceInstance(){return new ao}}class Oo{constructor(){go.set(this,Jt)}static getInstance(){return Oo.instance||(Oo.instance=new Oo),Oo.instance}createOrder(e,t){return i(this,void 0,void 0,(function*(){const i=n(this,go,"f"),o=new URLSearchParams;o.append("amount",t.amount.toString()),o.append("item",encodeURIComponent(JSON.stringify(t.item))),o.append("appId",i),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 n=yield e.getAccessToken({fail:e=>{throw wi.loginRequired}});r.headers.authorization=`Bearer ${n}`;const a=yield fetch(Ei,Object.assign(Object.assign({method:"POST"},r),{body:o})),s=yield a.json();if(!s.data||0!==s.err)throw wi.badRequest(s.msg);const c=s.data.id,l=s.data.jwt,d=window.APP_VERSION,u=window.APP_ENV,p={miniAppId:i,orderId:c};l&&(p.token=l),d&&(p.version=d),u&&(p.env=u),t.method&&(p.method=t.method);const h=Ni.encode(p),v=new URL(`?${h}`,"https://payment-mini.zalo.me").toString();return yield e.openWebview({url:v,fail:e=>{throw e}}),{orderId:c}}catch(e){throw e}}))}checkTransaction(e,t){return i(this,void 0,void 0,(function*(){try{let i,{data:o}=t;if(o||(o=e.getRouteParams()),"object"==typeof o&&(i=o.appTransID||o.orderId||o.apptransid),"string"==typeof o){const e=Ni.getParameterByName("orderId",o),t=Ni.getParameterByName("appTransID",o)||Ni.getParameterByName("apptransid",o);i=e||t}const r={headers:{authorization:"Bearer "}},a=yield e.getAccessToken({fail:e=>{throw wi.loginRequired}});r.headers.authorization=`Bearer ${a}`;const s=new URL(Oi),c={transId:i||"",appId:n(this,go,"f")};s.search=new URLSearchParams(c).toString();const l=yield fetch(s.toString(),r),d=yield l.json();if(!d.data||0!==d.err)throw wi.badRequest(d.msg);const u=d.data||{};return{msg:u.resultMessage,orderId:u.orderId,resultCode:u.resultCode,transTime:u.transTime,createdAt:u.createAt,transId:u.transId}}catch(e){throw e}}))}}go=new WeakMap;class Ao{constructor(){mo.set(this,zt)}static getInstance(){return Ao.instance||(Ao.instance=new Ao),Ao.instance}createOrder(e,t){return Promise.resolve({orderId:""})}checkTransaction(e,t){const i={msg:"Success",orderId:"",resultCode:1,transTime:(new Date).getTime().toString(),createdAt:(new Date).getTime().toString(),transId:""};return Promise.resolve(i)}}mo=new WeakMap;let To=class{constructor(e){yo.set(this,void 0),_o.set(this,void 0),o(this,yo,this.getInstance(),"f"),o(this,_o,e,"f")}createOrder(e){return n(this,yo,"f").createOrder(n(this,_o,"f"),e)}checkTransaction(e){return n(this,yo,"f").checkTransaction(n(this,_o,"f"),e)}};yo=new WeakMap,_o=new WeakMap,e([t(0,uo("object",{amount:Hi(["string","number"]),desc:Hi("string"),"method?":Hi("string",{values:["MOMO","ZALOPAY","MOMO_SANDBOX","ZALOPAY_SANDBOX","CC","CC_SANDBOX","ATM","ATM_SANDBOX"]})}))],To.prototype,"createOrder",null),To=e([ho(vo)],To);class bo extends To{getInstance(){return Oo.getInstance()}}class wo extends To{getInstance(){return Ao.getInstance()}}const No=Bi();exports.default=void 0,window.onJSCall=e=>function(t){$n.getInstance().onJSCall(e,t)},window.onMultiJSCall=e=>function(t){$n.getInstance().onMultiJSCall(e,t)},window.zaloJSV2={zalo_h5_event_handler:function(e,t,i){$n.getInstance().nativeEventHandler(e,t,i)}},exports.Payment=void 0,No.isZalo?(exports.default=new So,exports.Payment=new bo(exports.default)):(exports.default=new Eo,exports.Payment=new wo(exports.default)),window.ZaloMiniAppSDK=exports.default,exports.default=exports.default;
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,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a}function i(e,t){return function(i,n){t(i,n,e)}}function n(e,t,i,n){return new(i||(i=Promise))((function(o,r){function a(e){try{c(n.next(e))}catch(e){r(e)}}function s(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function o(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)}function r(e,t,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!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"===n?o.call(e,i):o?o.value=i:t.set(e,i),i}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(i){return e(t(i))}}(Object.keys,Object),l=Object.prototype.hasOwnProperty;var d=function(e){if(!s(e))return c(e);var t=[];for(var i in Object(e))l.call(e,i)&&"constructor"!=i&&t.push(i);return t},u="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 p="object"==typeof u&&u&&u.Object===Object&&u,v="object"==typeof self&&self&&self.Object===Object&&self,f=p||v||Function("return this")(),g=f.Symbol,m=Object.prototype,y=m.hasOwnProperty,_=m.toString,S=g?g.toStringTag:void 0;var E=function(e){var t=y.call(e,S),i=e[S];try{e[S]=void 0;var n=!0}catch(e){}var o=_.call(e);return n&&(t?e[S]=i:delete e[S]),o},O=Object.prototype.toString;var A=function(e){return O.call(e)},T=g?g.toStringTag:void 0;var b=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":T&&T in Object(e)?E(e):A(e)};var w=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var N,C=function(e){if(!w(e))return!1;var t=b(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},I=f["__core-js_shared__"],P=(N=/[^.]+$/.exec(I&&I.keys&&I.keys.IE_PROTO||""))?"Symbol(src)_1."+N:"";var k=function(e){return!!P&&P in e},R=Function.prototype.toString;var D=function(e){if(null!=e){try{return R.call(e)}catch(e){}try{return e+""}catch(e){}}return""},B=/^\[object .+?Constructor\]$/,j=Function.prototype,U=Object.prototype,L=j.toString,M=U.hasOwnProperty,x=RegExp("^"+L.call(M).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var W=function(e){return!(!w(e)||k(e))&&(C(e)?x:B).test(D(e))};var z=function(e,t){return null==e?void 0:e[t]};var J=function(e,t){var i=z(e,t);return W(i)?i:void 0},F=J(f,"DataView"),K=J(f,"Map"),G=J(f,"Promise"),H=J(f,"Set"),$=J(f,"WeakMap"),V="[object Map]",Z="[object Promise]",q="[object Set]",Q="[object WeakMap]",Y="[object DataView]",X=D(F),ee=D(K),te=D(G),ie=D(H),ne=D($),oe=b;(F&&oe(new F(new ArrayBuffer(1)))!=Y||K&&oe(new K)!=V||G&&oe(G.resolve())!=Z||H&&oe(new H)!=q||$&&oe(new $)!=Q)&&(oe=function(e){var t=b(e),i="[object Object]"==t?e.constructor:void 0,n=i?D(i):"";if(n)switch(n){case X:return Y;case ee:return V;case te:return Z;case ie:return q;case ne:return Q}return t});var re=oe;var ae=function(e){return null!=e&&"object"==typeof e};var se=function(e){return ae(e)&&"[object Arguments]"==b(e)},ce=Object.prototype,le=ce.hasOwnProperty,de=ce.propertyIsEnumerable,ue=se(function(){return arguments}())?se:function(e){return ae(e)&&le.call(e,"callee")&&!de.call(e,"callee")},he=Array.isArray;var pe=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var ve=function(e){return null!=e&&pe(e.length)&&!C(e)};var fe=function(){return!1},ge=h((function(e,t){var i=t&&!t.nodeType&&t,n=i&&e&&!e.nodeType&&e,o=n&&n.exports===i?f.Buffer:void 0,r=(o?o.isBuffer:void 0)||fe;e.exports=r})),me={};me["[object Float32Array]"]=me["[object Float64Array]"]=me["[object Int8Array]"]=me["[object Int16Array]"]=me["[object Int32Array]"]=me["[object Uint8Array]"]=me["[object Uint8ClampedArray]"]=me["[object Uint16Array]"]=me["[object Uint32Array]"]=!0,me["[object Arguments]"]=me["[object Array]"]=me["[object ArrayBuffer]"]=me["[object Boolean]"]=me["[object DataView]"]=me["[object Date]"]=me["[object Error]"]=me["[object Function]"]=me["[object Map]"]=me["[object Number]"]=me["[object Object]"]=me["[object RegExp]"]=me["[object Set]"]=me["[object String]"]=me["[object WeakMap]"]=!1;var ye=function(e){return ae(e)&&pe(e.length)&&!!me[b(e)]};var _e=function(e){return function(t){return e(t)}},Se=h((function(e,t){var i=t&&!t.nodeType&&t,n=i&&e&&!e.nodeType&&e,o=n&&n.exports===i&&p.process,r=function(){try{var e=n&&n.require&&n.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=r})),Ee=Se&&Se.isTypedArray,Oe=Ee?_e(Ee):ye,Ae=Object.prototype.hasOwnProperty;var Te=function(e){if(null==e)return!0;if(ve(e)&&(he(e)||"string"==typeof e||"function"==typeof e.splice||ge(e)||Oe(e)||ue(e)))return!e.length;var t=re(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(s(e))return!d(e).length;for(var i in e)if(Ae.call(e,i))return!1;return!0};var be=function(e){return void 0===e};var we=function(e){return null===e};var Ne=function(e){return"string"==typeof e||!he(e)&&ae(e)&&"[object String]"==b(e)};var Ce=function(e){return"number"==typeof e||ae(e)&&"[object Number]"==b(e)};var Ie=function(e){return ae(e)&&"[object RegExp]"==b(e)},Pe=Se&&Se.isRegExp,ke=Pe?_e(Pe):Ie;var Re=function(e){return"symbol"==typeof e||ae(e)&&"[object Symbol]"==b(e)},De=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Be=/^\w*$/;var je=function(e,t){if(he(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!Re(e))||(Be.test(e)||!De.test(e)||null!=t&&e in Object(t))},Ue=J(Object,"create");var Le=function(){this.__data__=Ue?Ue(null):{},this.size=0};var Me=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},xe=Object.prototype.hasOwnProperty;var We=function(e){var t=this.__data__;if(Ue){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return xe.call(t,e)?t[e]:void 0},ze=Object.prototype.hasOwnProperty;var Je=function(e){var t=this.__data__;return Ue?void 0!==t[e]:ze.call(t,e)};var Fe=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=Ue&&void 0===t?"__lodash_hash_undefined__":t,this};function Ke(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}Ke.prototype.clear=Le,Ke.prototype.delete=Me,Ke.prototype.get=We,Ke.prototype.has=Je,Ke.prototype.set=Fe;var Ge=Ke;var He=function(){this.__data__=[],this.size=0};var $e=function(e,t){return e===t||e!=e&&t!=t};var Ve=function(e,t){for(var i=e.length;i--;)if($e(e[i][0],t))return i;return-1},Ze=Array.prototype.splice;var qe=function(e){var t=this.__data__,i=Ve(t,e);return!(i<0)&&(i==t.length-1?t.pop():Ze.call(t,i,1),--this.size,!0)};var Qe=function(e){var t=this.__data__,i=Ve(t,e);return i<0?void 0:t[i][1]};var Ye=function(e){return Ve(this.__data__,e)>-1};var Xe=function(e,t){var i=this.__data__,n=Ve(i,e);return n<0?(++this.size,i.push([e,t])):i[n][1]=t,this};function et(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}et.prototype.clear=He,et.prototype.delete=qe,et.prototype.get=Qe,et.prototype.has=Ye,et.prototype.set=Xe;var tt=et;var it=function(){this.size=0,this.__data__={hash:new Ge,map:new(K||tt),string:new Ge}};var nt=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var ot=function(e,t){var i=e.__data__;return nt(t)?i["string"==typeof t?"string":"hash"]:i.map};var rt=function(e){var t=ot(this,e).delete(e);return this.size-=t?1:0,t};var at=function(e){return ot(this,e).get(e)};var st=function(e){return ot(this,e).has(e)};var ct=function(e,t){var i=ot(this,e),n=i.size;return i.set(e,t),this.size+=i.size==n?0:1,this};function lt(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}lt.prototype.clear=it,lt.prototype.delete=rt,lt.prototype.get=at,lt.prototype.has=st,lt.prototype.set=ct;var dt=lt;function ut(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var i=function(){var n=arguments,o=t?t.apply(this,n):n[0],r=i.cache;if(r.has(o))return r.get(o);var a=e.apply(this,n);return i.cache=r.set(o,a)||r,a};return i.cache=new(ut.Cache||dt),i}ut.Cache=dt;var ht=ut;var pt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vt=/\\(\\)?/g,ft=function(e){var t=ht(e,(function(e){return 500===i.size&&i.clear(),e})),i=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(pt,(function(e,i,n,o){t.push(n?o.replace(vt,"$1"):i||e)})),t}));var gt=function(e,t){for(var i=-1,n=null==e?0:e.length,o=Array(n);++i<n;)o[i]=t(e[i],i,e);return o},mt=g?g.prototype:void 0,yt=mt?mt.toString:void 0;var _t=function e(t){if("string"==typeof t)return t;if(he(t))return gt(t,e)+"";if(Re(t))return yt?yt.call(t):"";var i=t+"";return"0"==i&&1/t==-Infinity?"-0":i};var St=function(e){return null==e?"":_t(e)};var Et=function(e,t){return he(e)?e:je(e,t)?[e]:ft(St(e))};var Ot=function(e){if("string"==typeof e||Re(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var At=function(e,t){for(var i=0,n=(t=Et(t,e)).length;null!=e&&i<n;)e=e[Ot(t[i++])];return i&&i==n?e:void 0};var Tt=function(e,t,i){var n=null==e?void 0:At(e,t);return void 0===n?i:n},bt=function(){try{var e=J(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var wt=function(e,t,i){"__proto__"==t&&bt?bt(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i},Nt=Object.prototype.hasOwnProperty;var Ct=function(e,t,i){var n=e[t];Nt.call(e,t)&&$e(n,i)&&(void 0!==i||t in e)||wt(e,t,i)},It=/^(?:0|[1-9]\d*)$/;var Pt=function(e,t){var i=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==i||"symbol"!=i&&It.test(e))&&e>-1&&e%1==0&&e<t};var kt=function(e,t,i,n){if(!w(e))return e;for(var o=-1,r=(t=Et(t,e)).length,a=r-1,s=e;null!=s&&++o<r;){var c=Ot(t[o]),l=i;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(o!=a){var d=s[c];void 0===(l=n?n(d,c,s):void 0)&&(l=w(d)?d:Pt(t[o+1])?[]:{})}Ct(s,c,l),s=s[c]}return e};var Rt,Dt,Bt,jt,Ut,Lt,Mt,xt,Wt,zt,Jt={isEmpty:Te,isNull:we,isUndefined:be,isFunction:C,isObject:w,isString:Ne,isNumber:Ce,isArray:he,isRegExp:ke,get:Tt,set:function(e,t,i){return null==e?e:kt(e,t,i)},isPromise:e=>!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then};function Ft(e){return"function"==typeof window.Debug?window.Debug(e):function(...e){process.env.NODE_ENV}}e.NetworkType=void 0,(Rt=e.NetworkType||(e.NetworkType={})).none="none",Rt.wifi="wifi",Rt.cellular="cellular",Rt.unknown="unknown",e.PlatformType=void 0,(Dt=e.PlatformType||(e.PlatformType={})).wp="wp",Dt.android="android",Dt.iOS="iOS",Dt.unknown="unknown",e.ProfileType=void 0,(Bt=e.ProfileType||(e.ProfileType={}))[Bt.user=1]="user",Bt[Bt.oa=0]="oa",Bt[Bt.aliasOA=2]="aliasOA",e.ChatType=void 0,(jt=e.ChatType||(e.ChatType={}))[jt.user=1]="user",jt[jt.oa=0]="oa",e.PostFeedType=void 0,(Ut=e.PostFeedType||(e.PostFeedType={}))[Ut.image=1]="image",Ut[Ut.link=4]="link",Ut[Ut.profile=5]="profile",e.ShareSheetType=void 0,(Lt=e.ShareSheetType||(e.ShareSheetType={}))[Lt.image=1]="image",Lt[Lt.gif=11]="gif",Lt[Lt.video=12]="video",Lt[Lt.link=4]="link",Lt[Lt.oa=5]="oa",Lt[Lt.zmp=20]="zmp",Lt[Lt.multi_image=21]="multi_image",e.OrientationType=void 0,(Mt=e.OrientationType||(e.OrientationType={}))[Mt.auto=1]="auto",Mt[Mt.portrait=2]="portrait",Mt[Mt.landscape=3]="landscape",e.VibrateType=void 0,(xt=e.VibrateType||(e.VibrateType={}))[xt.oneShot=0]="oneShot",e.Events=void 0,(Wt=e.Events||(e.Events={})).AppPaused="h5.event.paused",Wt.AppResumed="h5.event.resumed",Wt.NetworkChanged="h5.event.connection.changed",Wt.OnDataCallback="h5.event.webview.result",Wt.OpenApp="h5.event.open.mp",Wt.AppClose="h5.event.action.close",e.MediaPickerType=void 0,(zt=e.MediaPickerType||(e.MediaPickerType={}))[zt.photo=4]="photo",zt[zt.video=5]="video",zt[zt.file=6]="file";const Kt=e=>{const t=document.cookie;if(t){const o=t.split("; ");if(o&&o.length>0)for(var i=e.length+1,n=o.length-1;n>=0;n--){let t=o[n];if(t&&0===t.indexOf(e)&&(t=t.substring(i,t.length),t))return t=t.replace(/["']/g,""),t}}return null},Gt=e=>Kt(`${window.location.host}_`+e),Ht=e=>Kt((()=>{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),$t=1048576,Vt=window.zAppID,Zt=window.APP_ID,qt=window.APP_CONFIG||{},Qt="h5.zdn.vn_zoauth",Yt="h5.zdn.vn_zlink3rd",Xt="h5.zdn.vn_zoauth_vrf",ei="h5.zdn.vn_deviceID",ti="h5.zdn.vn_contextID",ii="h5.zdn.vn_contextType",ni="https://graph.zalo.me/v2.0/me",oi="https://h5.zalo.me/openapi/access_token",ri="https://oauth.zaloapp.com/v3/access_token",ai="https://graph.zalo.me/v2.0/me/friends/list",si="https://h5.zalo.me/apps/get-info",ci="https://h5.zalo.me/log/async",li=5*$t,di=e=>({NONE:e?-2:0,WIFI:e?0:1,"2G":2,"3G":e?15:2,"4G":e?13:2}),ui=0,hi=-2e3,pi=-1400,vi=-1500,fi=-1401,gi=-2004,mi=-2005,yi={SUCCESS:"Success",UNKNOWN_ERROR:"Unknown error. Please try again later.",TIME_OUT:"Request timeout. Please try again later.",LOGIN_REQUIRED:"Please login (https://miniapp.zalo.me/docs/api/login) before to call this api",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 id. Please check your params again.",INVALID_PARAM:"Invalid parameter",USER_DENIED:"User denied",USER_CANCEL:"User cancel",MEDIA_PICKER_FAIL:"Unable to pick media",SAVE_IMAGE_FAIL:"Unable to save image"},_i={SUCCESS:{code:ui,message:yi.SUCCESS},UNKNOWN_ERROR:{code:hi,message:yi.UNKNOWN_ERROR},UNAUTHORIZED:{code:fi,message:yi.LOGIN_REQUIRED},FORBIDDEN:{code:-1403,message:yi.NOT_PERMISSION},CLIENT_NOT_SUPPORT:{code:-1404,message:yi.CLIENT_NOT_SUPPORT},DECODE_FAILED:{code:-2001,message:yi.DECODE_FAILED},TIME_OUT:{code:-1408,message:yi.TIME_OUT},USER_DENIED:{code:-2002,message:yi.USER_DENIED},USER_CANCEL:{code:-2003,message:yi.USER_CANCEL}},Si={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",error_list:{android:{"-2":{map_to:_i.USER_DENIED}},iOS:{"-2":{map_to:_i.USER_DENIED}}}},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,error_list:{android:{"-1":{map_to:_i.USER_DENIED}},iOS:{"-1":{map_to:_i.USER_DENIED}}}},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},error_list:{android:{"-101":{map_to:{code:mi,message:yi.SAVE_IMAGE_FAIL},need_more_detail:!0},"-102":{map_to:{code:mi,message:yi.SAVE_IMAGE_FAIL},need_more_detail:!0}},iOS:{"-10":{map_to:{code:mi,message:yi.SAVE_IMAGE_FAIL},need_more_detail:!0}}}},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},error_list:{android:{"-1":{map_to:_i.USER_DENIED},"-101":{map_to:_i.USER_DENIED}},iOS:{"-1":{map_to:_i.USER_DENIED},"-10":{map_to:_i.USER_DENIED}}}},MP_OPEN_PROFILE_PICKER:{name:"action.mp.open.profile.picker",version_live:{iOS:432},error_list:{android:{"-101":{map_to:_i.USER_CANCEL}},iOS:{"-101":{map_to:_i.USER_CANCEL}}}},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:440},error_list:{android:{"-101":{map_to:_i.USER_CANCEL},999:{map_to:{code:gi,message:yi.MEDIA_PICKER_FAIL},need_more_detail:!0}},iOS:{"-10":{map_to:{code:gi,message:yi.MEDIA_PICKER_FAIL}}}}},MP_CLOSE_LOADINGVIEW:{name:"action.mp.close.loadingview"}},Ei={android:{"-4":_i.DECODE_FAILED,"-5":_i.CLIENT_NOT_SUPPORT,"-14":_i.TIME_OUT},iOS:{"-9":_i.DECODE_FAILED,"-5":_i.CLIENT_NOT_SUPPORT,"-14":_i.TIME_OUT}},Oi={android:12100571,iOS:400,wp:0,unknown:0},Ai={android:12100641,iOS:460,wp:0,unknown:0},Ti=[Si.GET_DOWNLOADED_STICKER.name,Si.OPEN_SHARE_STICKER.name,Si.OPEN_PROFILE.name,Si.OPEN_FEED_DETAIL.name,Si.OPEN_FRIEND_RADA.name,Si.OPEN_INAPP.name,Si.OPEN_OUTAPP.name,Si.OPEN_PAGE.name,Si.OPEN_PHOTODETAIL.name,Si.OPEN_GALARY.name,Si.OPEN_GAMECENTER.name,Si.OPEN_GAMENEWS.name,Si.OPEN_TAB_CONTACT.name,Si.OPEN_TAB_SOCIAL.name,Si.OPEN_FRIENDSUGGEST.name,Si.OPEN_GROUPLIST.name,Si.OPEN_NEARBY.name,Si.OPEN_ROOM.name,Si.OPEN_STICKERSTORE.name,Si.OPEN_CREATECHAT.name,Si.COPY_LINK_CATESTICKER.name,Si.REQUEST_BUY_STICKER.name,Si.OPEN_CHAT.name,Si.OPEN_TAB_CHAT.name,Si.OPEN_CHATGROUP.name,Si.OPEN_ADDFRIEND.name,Si.OPEN_TAB_MORE.name,Si.OPEN_POSTFEED.name,Si.OPEN_LOGINDEVICES.name,Si.OPEN_SENDSTICKER.name,Si.REPORT_ABUSE.name,Si.FOLLOW_OA.name,Si.UNFOLLOW_OA.name,Si.OPEN_GAMEDETAIL.name,Si.OPEN_SHARESHEET.name,Si.REQUEST_PERMISSION_CAMERA.name,Si.CHANGE_TITLE_HEADER.name,Si.WEBVIEW_CLEARCACHE.name,Si.WEBVIEW_CONFIRMCACHE.name,Si.WEBVIEW_ISVISIBLE.name,Si.WEBVIEW_NETWORKTYPE.name,Si.CHANGE_BUTTON_HEADER.name,Si.CREATE_OPTIONS_MENU.name,Si.CREATE_SHORTCUT.name,Si.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE.name,Si.WINDOW_CLOSE.name,Si.WEBVIEW_CHECKRESERROR.name,Si.IAP_REQUESTPAYMENT.name,Si.ZBROWSER_GETSTATS.name,Si.ZBROWSER_JSBRIDGE.name,Si.PROMPT_AUTHENTICATION.name,Si.CHANGE_ACTIONBAR_COLOR.name,Si.PROMPT_AUTHENTICATION_CHECK_STATE.name,Si.OPEN_APPSTORE.name,Si.GET_LOCATION.name,Si.QUERY_LOCATION_HIDE.name,Si.SHOW_TOAST.name,Si.OPEN_APP.name,Si.HIDE_KEYBOARD.name,Si.OPEN_PHONE.name,Si.OPEN_QR.name,Si.OPEN_SMS.name,Si.VIEW_MYQR.name,Si.KEEP_SCREEN.name,Si.CHANGE_AUTOROTATE.name,Si.CHECK_APP_INSTALLED.name,Si.QUERY_SHOW.name,Si.QUERY_HIDE.name,Si.OPEN_INAPPRW.name,Si.ZALORUN_GETTRACKINGSTATUS.name,Si.ZALORUN_SETTRACKINGSTATUS.name,Si.ZALORUN_GETDAYSTEP.name,Si.ZALORUN_FORCESUBMITDATA.name,Si.ZALORUN_SETWEIGHT.name,Si.OPEN_PROFILE_EXT.name,Si.DOWNLOAD_CATE.name,Si.JUMP_LOGIN.name,Si.OPEN_ADTIMA_ADS_INTERSTITIAL.name,Si.OPEN_ADTIMA_ADS.name,Si.GET_ADIDCLIENT.name,Si.SCAN_IBEACON.name,Si.SAVE_IMAGE_GALLERY.name,Si.OPEN_MP.name,Si.CHANGE_ACTIONBAR.name,Si.INTERACTIVE_VIBRATION.name,Si.ZBROWSER_MPDS.name],bi=0,wi=3,Ni=1,Ci=0,Ii="https://payment-mini.zalo.me/api/order/create",Pi="https://payment-mini.zalo.me/api/transaction";class ki{constructor(e,t,i){this.code=e,this.message=t,this.api=i}toString(){return`api: ${String(this.api)}; code: ${this.code}; message: ${this.message}`}toJSON(){return{code:this.code,message:this.message,api:this.api}}}const Ri=(e,t)=>e instanceof ki?((e,t)=>(e.api=t,e.toJSON()))(e,t):((e,t)=>e instanceof Error?new ki(hi,e.message,t).toJSON():new ki(hi,yi.UNKNOWN_ERROR,t).toJSON())(e,t),Di=(e,t)=>({code:ui,message:t||yi.SUCCESS,data:e||{}}),Bi={badRequest:e=>new ki(pi,e),loginFailed:e=>new ki(fi,`${yi.LOGIN_FAILED}: ${e}`),loginRequired:()=>new ki(fi,yi.LOGIN_REQUIRED),missingParam:e=>new ki(pi,`Missing required argument: ${e}`),wrongTypeParam:(e,t,i)=>new ki(pi,`Wrong type of parameter '${e}'. Expected ${t}, but got ${i}`),cannotGetShareInfo:()=>new ki(vi,"Can not get app info to share"),lengthInvalid:e=>new ki(pi,`${e} length is invalid.`)};const ji={encode:function(e){var t=[];for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];if(void 0===n)return;if(null===n)return void t.push(i);t.push(encodeURIComponent(i)+"="+encodeURIComponent(n))}return t.join("&")},decode:function(e,t){var i={};if(""===e)return i;for(var n=e.split("&"),o=0;o<n.length;o++){var r=n[o].split("=",2),a=decodeURIComponent(r[0]);if(t&&Object.prototype.hasOwnProperty.call(i,a))throw new URIError("Duplicate key: "+a);i[a]=2===r.length?decodeURIComponent(r[1]):null}return i},appendToUrl:function(e,t){return e+(-1!==e.indexOf("?")?"&":"?")+("string"==typeof t?t:ji.encode(t))},getParameterByName:function(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");var i=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null},getParamsAsObject:function(e){var t={};return e?(e.split("&").map((function(e){var i=e.split("=");i&&2==i.length&&(t[i[0]]=decodeURIComponent(i[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),i=[];return t.map((function(t){var n=e[t],o=[t,n="object"==(void 0===n?"undefined":typeof n)?JSON.stringify(n):encodeURIComponent(n)].join("=");i.push(o)})),i.join("&")}},Ui=new RegExp("[\\u0300-\\u036f]","g"),Li=new RegExp("[đ|Đ]","g"),Mi=new RegExp("\\s","g"),xi=Ft("zmp:utils:common"),Wi=e=>{try{new URL(e)}catch(e){return!1}return!0},zi=()=>navigator.userAgent||navigator.vendor||window.opera,Ji=()=>{const e=zi().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)}},Fi=e=>{const t=document.getElementsByTagName("meta");for(let i=0;i<t.length;i++)if(t[i].getAttribute("name")===e||t[i].getAttribute("property")===e)return t[i].getAttribute("content");return""},Ki=()=>{const e=zi().toLowerCase().split("zalo")[1];if(e){return e.replace(" ","").split("/")[1]||""}return""},Gi=()=>{let t=Ji();return t.isWP?e.PlatformType.wp:t.isAndroid?e.PlatformType.android:t.isIOS?e.PlatformType.iOS:e.PlatformType.unknown},Hi=(e,t)=>{const i=t.toLowerCase(),n=i.split(/[<>]/i),o="array"===n[0];return!!("url"===i&&Wi(e)||o&&("array"===i&&Array.isArray(e)||((e,t)=>Array.isArray(t)&&!t.some((t=>"url"===e?!Wi(t):typeof t!==e)))(n[1],e))||!Array.isArray(e)&&typeof e===t)},$i=e=>(e=>{let t=Gt(e);return t||(t=Ht(e),t)?t:Kt(e)})(e),Vi=e=>{if(Jt.isObject(JSON)&&JSON.parse&&Jt.isString(e)){const t=e.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\x00/g,"");return JSON.parse(t,((e,t)=>t))}return Jt.isObject(e)?e:new Function("return "+e)()},Zi=e=>{if(Jt.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 i=e.length,n=0;n<i;n++)t.push(Zi(e[n]));return"["+t.join(",")+"]"}if("object"==typeof e){for(var o in t=new Array,e)t.push('"'+o+'":'+Zi(e[o]));return"{"+t.join(",")+"}"}return e.toString()},qi=()=>{try{const e=Number(Ki()),t=Gi();return e>=Oi[t]}catch(e){return!0}},Qi=e=>JSON.stringify(e).replace(/"/g,'\\"').replace(/'/g,"&#39;"),Yi=e=>{try{if(e){xi(e);const t=e.replace(/\\/g,"").replace(/&#39;/g,"'");return xi("formattedValue",t,JSON.parse(t),typeof JSON.parse(t)),JSON.parse(t)}return null}catch(t){return xi("parse json error:",t),e}},Xi=(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 d=yield fetch("https://h5.zalo.me/openapi/create-sharelink",Object.assign({method:"POST",body:s},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})),u=yield d.json();if(!u||0!==u.err)throw Bi.cannotGetShareInfo();return l.search=`${l.search}&zshareId=${u.data.shareId}`,Object.assign(Object.assign({},u.data),{shareableLink:l.href})})),en=(e,t)=>i=>{if(!(Array.isArray(e)?e.some((e=>Hi(i,e))):Hi(i,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(i)),errorMessage:null==t?void 0:t.values.toString()};if(Jt.isNumber(null==t?void 0:t.maxLength))return{error:Jt.isString(i)&&i.length>(null==t?void 0:t.maxLength),errorMessage:`data length must <= ${null==t?void 0:t.maxLength}`};if(Jt.isNumber(null==t?void 0:t.min)&&Jt.isNumber(null==t?void 0:t.max))return{error:i<(null==t?void 0:t.min)||i>(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(Jt.isNumber(null==t?void 0:t.min))return{error:i<(null==t?void 0:t.min),errorMessage:`data must >= ${null==t?void 0:t.min}`};if(Jt.isNumber(null==t?void 0:t.max))return{error:i>(null==t?void 0:t.max),errorMessage:`data must <= ${null==t?void 0:t.max}`};if(Jt.isRegExp(null==t?void 0:t.regex))return{error:!t.regex.test(i),errorMessage:"data must valid"}}return{error:!1}},tn=(e,t,i)=>n(void 0,void 0,void 0,(function*(){const n={appId:e,versionStatus:t};Jt.isUndefined(i)||(n.currentVersion=i);const o=ji.appendToUrl(si,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 nn=h((function(e){var t=Object.prototype.hasOwnProperty,i="~";function n(){}function o(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function r(e,t,n,r,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new o(n,r||e,a),c=i?i+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 n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),s.prototype.eventNames=function(){var e,n,o=[];if(0===this._eventsCount)return o;for(n in e=this._events)t.call(e,n)&&o.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},s.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,r=n.length,a=new Array(r);o<r;o++)a[o]=n[o].fn;return a},s.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,o,r,a){var s=i?i+e:e;if(!this._events[s])return!1;var c,l,d=this._events[s],u=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),u){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,n),!0;case 4:return d.fn.call(d.context,t,n,o),!0;case 5:return d.fn.call(d.context,t,n,o,r),!0;case 6:return d.fn.call(d.context,t,n,o,r,a),!0}for(l=1,c=new Array(u-1);l<u;l++)c[l-1]=arguments[l];d.fn.apply(d.context,c)}else{var h,p=d.length;for(l=0;l<p;l++)switch(d[l].once&&this.removeListener(e,d[l].fn,void 0,!0),u){case 1:d[l].fn.call(d[l].context);break;case 2:d[l].fn.call(d[l].context,t);break;case 3:d[l].fn.call(d[l].context,t,n);break;case 4:d[l].fn.call(d[l].context,t,n,o);break;default:if(!c)for(h=1,c=new Array(u-1);h<u;h++)c[h-1]=arguments[h];d[l].fn.apply(d[l].context,c)}}return!0},s.prototype.on=function(e,t,i){return r(this,e,t,i,!1)},s.prototype.once=function(e,t,i){return r(this,e,t,i,!0)},s.prototype.removeListener=function(e,t,n,o){var r=i?i+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||n&&s.context!==n||a(this,r);else{for(var c=0,l=[],d=s.length;c<d;c++)(s[c].fn!==t||o&&!s[c].once||n&&s[c].context!==n)&&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=i?i+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=i,s.EventEmitter=s,e.exports=s}));class on extends nn{constructor(){super(),this.debug=Ft("zmp:event-emitter")}static getInstance(){return on.instance||(on.instance=new on),on.instance}h5ConfirmHandleEvent(e,t,i){ZaloJavaScriptInterface.jsH5EventCallback(e,t,i||"")}on(e,t,i){this.debug(`register ${e}: ${i}`);return super.on(e,((n,o)=>{this.h5ConfirmHandleEvent(n,e,i),t(o)}),i)}once(e,t,i){this.debug(`register once ${e}: ${i}`);return super.once(e,((n,o)=>{this.h5ConfirmHandleEvent(n,e,i),t(o)}),i)}}var rn,an,sn,cn,ln,dn="2.22.1";class un{static getVersion(){return dn}static getSystemInfo(){return{version:Fi("version-id")||"",apiVersion:dn,zaloVersion:Ki(),platform:Gi(),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 tn(e,0,t.version)}))}}class hn{static setNavigationBarTitle(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.CHANGE_TITLE_HEADER,{title:e.title},{haveTimeout:!1})}))}static setNavigationBarColor(e){return n(this,void 0,void 0,(function*(){const t={};let i;Jt.isEmpty(e.textColor)||(t.textColor=e.textColor),Jt.isString(e.color)&&e.color.length>0?(Jt.isEmpty(e.color)||(t.backgroundColor=e.color),i=5):(Jt.isEmpty(e.statusBarColor)||(t.backgroundColor=e.statusBarColor),i=6),this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{actionbarType:i,dataConfig:Object.assign(Object.assign({},e.dataConfig),t)}))),yield this.getJSBridge().callNative(Si.CHANGE_ACTIONBAR,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarLeftButton(e,t){return n(this,void 0,void 0,(function*(){let i,n;Jt.isString(e)&&(i="none"===e||"home"===e?wi:bi,n="home"===e||"both"===e?Ni:Ci),this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{buttonType:Jt.isNumber(i)?i:e.buttonType,dataConfig:Object.assign(Object.assign({},e.dataConfig),{confirmToExit:Jt.isNumber(t)?t:e.dataConfig.confirmToExit,viewInLeftType:Jt.isNumber(i)?i:e.dataConfig.viewInLeftType}),homeConfig:Object.assign(Object.assign({},e.homeConfig),{enable:Jt.isNumber(n)?n:e.homeConfig.enable})}))),yield this.getJSBridge().callNative(Si.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBar(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.CHANGE_ACTIONBAR,{data:e},{haveTimeout:!1})}))}}class pn{static setBackgroundColor(e){return n(this,void 0,void 0,(function*(){Jt.isString(e.backgroundColor)&&e.backgroundColor.length>0&&(yield this.getJSBridge().callNative(Si.CHANGE_ACTIONBAR,{actionbarType:this.isShowNavBar?5:6,dataConfig:{backgroundColor:e.backgroundColor,textColor:e.textColor}}))}))}}class vn{constructor(e,t,i,n){this.title=n,this.severity=t;const o=new Date;if(this.time=o.toLocaleTimeString(),this.content=e,i>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(" ")}}rn=new WeakMap,an=new WeakMap,sn=new WeakMap,cn=new WeakMap,ln=new WeakMap;const fn=new class{constructor(){rn.set(this,3),an.set(this,["none","error","warn","info"]),sn.set(this,"[zmp] > "),cn.set(this,{error:0,warn:0,info:0,firstError:null,lastError:null}),ln.set(this,((e,t,i)=>{o(this,cn,"f")[o(this,an,"f")[e]]++;const n=o(this,an,"f")[e];if(r(this,sn,o(this,sn,"f")+("string"!=typeof t?new vn(t,n,e,i).toString():t),"f"),!(e>o(this,rn,"f")))switch(e){case 1:console.error(o(this,sn,"f"));break;case 2:console.warn(o(this,sn,"f"));break;case 3:console.info(o(this,sn,"f"));break;default:throw new Error("internal")}}))}setLogLevel(e){r(this,rn,e,"f")}info(e){o(this,ln,"f").call(this,3,e)}warn(e,t){o(this,ln,"f").call(this,2,e,t)}error(e,t){o(this,ln,"f").call(this,1,e,t)}getMetrics(){return o(this,cn,"f")}};class gn{static setDeviceOrientation(t){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.CHANGE_AUTOROTATE,{autoRotate:e.OrientationType[t.rotate]})}))}static getNetworkType(t){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.WEBVIEW_NETWORKTYPE,{url:window.location.href,featureId:""}).then((t=>{const i=t.network;let n;const o=Ji().isAndroid;switch(i){case di(o).NONE:n=e.NetworkType.none;break;case di(o).WIFI:n=e.NetworkType.wifi;break;case di(o)["2G"]:case di(o)["3G"]:case di(o)["4G"]:n=e.NetworkType.cellular;break;default:n=e.NetworkType.unknown}return{networkType:n}}))}))}static onNetworkStatusChange(t){return n(this,void 0,void 0,(function*(){yield this.events.on(e.Events.NetworkChanged,(e=>{const i=e&&e.state;this.getNetworkType().then((e=>{const n={isConnected:"CONNECTED"===i,networkType:e&&e.networkType};t(n)})).catch((e=>{fn.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:Jt.isNumber(null==e?void 0:e.scanningType)?e.scanningType:0,data:{scan_from_source:Jt.isString(null==e?void 0:e.scanFromSource)?e.scanFromSource:"",expire:Jt.isNumber(null==e?void 0:e.expire)?e.expire:3e3,monitor_interval:Jt.isNumber(null==e?void 0:e.monitorInterval)?e.monitorInterval:60,domain:Jt.isString(null==e?void 0:e.domain)?e.domain:"",scan_config:{scan_time:Jt.isNumber(null===(t=null==e?void 0:e.scanConfig)||void 0===t?void 0:t.scanTime)?e.scanConfig.scanTime:15e3,time_between_scan:Jt.isNumber(null===(i=null==e?void 0:e.scanConfig)||void 0===i?void 0:i.timeBetweenScan)?e.scanConfig.timeBetweenScan:1e4,beacon_timeout:Jt.isNumber(null===(o=null==e?void 0:e.scanConfig)||void 0===o?void 0:o.beaconTimeout)?e.scanConfig.beaconTimeout:3e4,delayCheckConnectedTimeout:Jt.isNumber(null===(r=null==e?void 0:e.scanConfig)||void 0===r?void 0:r.delayCheckConnectedTimeout)?e.scanConfig.delayCheckConnectedTimeout:5e3,beaconConnectedTimeout:Jt.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.getJSBridge().callNative(Si.SCAN_IBEACON,Object.assign({},n)),!0}))}static stopBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.SCAN_IBEACON,Object.assign({},{subaction:2})),!0}))}static getBeacons(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.SCAN_IBEACON,Object.assign({},{subaction:1}),{isMultiCallback:!0}).then((e=>{const t={beacons:[]};return Array.isArray(e)&&e.forEach((e=>{const i={uuid:e.uuid,major:e.major,minor:e.minor,distance:e.distance,rssi:e.rssi};t.beacons.push(i)})),t}))}))}static stopBluetoothDevicesDiscovery(){return n(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static startBluetoothDevicesDiscovery(e){return n(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},Object.assign({},e))}))}static openBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static onBluetoothDeviceFound(){return n(this,void 0,void 0,(function*(){return this.getJSBridge().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.getJSBridge().callNative({name:""},t)}))}static getBluetoothDevices(){return n(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static getBluetoothAdapterState(){return n(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static closeBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static scanQRCode(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.OPEN_QR,{skipOpenLink:!0})}))}static showToast(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.SHOW_TOAST,{toast:e.message})}))}static hideKeyboard(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.HIDE_KEYBOARD,{})}))}static openPhone(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.OPEN_PHONE,{phoneNum:e.phoneNumber,phoneCode:e.phoneNumber})}))}static openSMS(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.OPEN_SMS,{content:e.content,phoneCode:e.phoneNumber})}))}static keepScreen(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.KEEP_SCREEN,{data:{keep_screen_on:e.keepScreenOn?1:0}})}))}static openBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.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,i,n,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===(i=null==e?void 0:e.data)||void 0===i?void 0:i.error_code,message:null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.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.getJSBridge().callNative(Si.PROMPT_AUTHENTICATION_CHECK_STATE,{}).then((e=>({bioState:null==e?void 0:e.bio_state})))}))}static vibrate(t){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.INTERACTIVE_VIBRATION,{type:e.VibrateType[t.type],vibrate_time:t.milliseconds})}))}static connectWifi(e){return n(this,void 0,void 0,(function*(){let t="open";return Jt.isString(e.password)&&e.password.length>0&&(t="wpa_wpa2"),yield this.getJSBridge().callNative(Si.MP_JOIN_WIFI,{ssid:e.SSID,securityType:t,password:e.password,hiddenSsid:e.hiddenSSID})}))}static openAppStore(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.OPEN_APPSTORE,e)}))}}var mn,yn,_n;class Sn{constructor(e){mn.set(this,localStorage),yn.set(this,void 0),_n.set(this,void 0),Ji(),r(this,_n,{keys:new Set,currentSize:0,limitSize:li},"f"),r(this,yn,e,"f"),this.findAllCurrentDataByApp(e)}findAllCurrentDataByApp(e){try{let t;for(t in o(this,mn,"f")){if(e){if(t.split("_")[0]!==e)continue}o(this,_n,"f").keys.add(t)}}catch(e){fn.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,yn,"f")&&(e=`${o(this,yn,"f")}_${e}`),o(this,_n,"f").keys.has(e)?o(this,mn,"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){o(this,yn,"f")&&(e=`${o(this,yn,"f")}_${e}`),o(this,mn,"f").setItem(e,t),o(this,_n,"f").keys.add(e)}getInfo(){return n(this,void 0,void 0,(function*(){return Promise.resolve(this.getInfoSync())}))}getInfoSync(){const e=((e,t)=>{let i,n,o=0;for(n in e){const r=n.split("_")[0];e.hasOwnProperty(n)&&(t&&r!==t||(i=2*(e[n].length+n.length),o+=i))}return o})(o(this,mn,"f"),o(this,yn,"f"));return{currentSize:Jt.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){o(this,yn,"f")&&(e=`${o(this,yn,"f")}_${e}`),o(this,_n,"f").keys.has(e)&&(o(this,mn,"f").removeItem(e),o(this,_n,"f").keys.delete(e))}clear(){return n(this,void 0,void 0,(function*(){return Promise.resolve(this.clearSync())}))}clearSync(){o(this,_n,"f").keys.forEach((e=>{o(this,yn,"f")&&e.indexOf(o(this,yn,"f"))<0||(o(this,mn,"f").removeItem(e),o(this,_n,"f").keys.delete(e))}))}}mn=new WeakMap,yn=new WeakMap,_n=new WeakMap;var En={},On=function(e,t,i){var n=t||"default";return function(){var t=n in En?En[n](e,i):e;return t.apply(this,arguments)}};On.setWrapper=function(e){var t=arguments.length<=1||void 0===arguments[1]?"default":arguments[1];En[t]=e};var An={error:{code:1,error_subcode:1357046,message:"Received Invalid JSON reply.",type:"http"}};function Tn(e){try{return null===e?An:JSON.parse(e)}catch(e){return An}}var bn,wn,Nn,Cn,In,Pn,kn,Rn,Dn,Bn,jn,Un,Ln,Mn,xn,Wn,zn,Jn,Fn,Kn,Gn,Hn,$n,Vn,Zn,qn,Qn,Yn,Xn,eo,to={execute:function(e,t,i,n){i.suppress_http_code=1;var o=ji.encode(i);"post"!=t&&(e=ji.appendToUrl(e,o),o="");var r=function(e,t){if(!self.XMLHttpRequest)return null;var i=new XMLHttpRequest,n=function(){};if(!("withCredentials"in i))return null;i.open(e,t,!0),i.setRequestHeader("Content-type","application/x-www-form-urlencoded");var o={send:function(e){i.send(e)}},r=On((function(){r=n,"onload"in o&&o.onload(i)}),"entry","XMLHttpRequest:load"),a=On((function(){a=n,"onerror"in o&&o.onerror(i)}),"entry","XMLHttpRequest:error");return i.onload=function(){r()},i.onerror=function(){a()},i.onreadystatechange=function(){4==i.readyState&&(200==i.status?r():a())},o}(t,e);return!!r&&(r.onload=function(e){n(Tn(e.responseText))},r.onerror=function(e){e.responseText?n(Tn(e.responseText)):n({error:{code:1,error_subcode:1357045,message:"unknown error (empty response)",status:e.status,type:"http"}})},r.send(o),!0)}};class io extends nn{constructor(){super(),bn.add(this),this.debug=Ft("zmp:ZaloJSBridge"),this.events=on.getInstance(),this._accessTk=$i("zacc_session")||"DEFAULT_ACCESS_TOKEN",this._jsAccessTk=$i("zlink3rd")||"DEFAULT_JS_TOKEN",this.results=[],this._userAgent=zi(),this._device=Ji(),this.isJumped=!1,wn.set(this,null),Nn.set(this,void 0),this.jump=()=>new Promise(((e,t)=>{Jt.isUndefined(o(this,wn,"f"))||Jt.isNull(o(this,wn,"f"))?this.callNative(Si.JUMP_LOGIN,{}).then((t=>{const i=t&&t.cookiesOAuthLogins||[],n=t&&t.actionPermission||[];Object.entries(n).forEach((e=>{const t=e[0],i=e[1]||{perm:0,decode:0};o(this,Nn,"f")[t]||(o(this,Nn,"f")[t]={permission:!1,support:!1}),o(this,Nn,"f")[t].permission=1===i.perm}));const a=i.find((e=>e.name===Yt));a&&(this.jsAccessTk=a.value,window.ZJSBridge.setJSToken&&window.ZJSBridge.setJSToken(a.value)),r(this,wn,i,"f"),this.isJumped=!0,e(i)})).catch((e=>{this.isJumped=!1,t(e)})):e(o(this,wn,"f"))})),this._jsCallFuncCallbacks={},r(this,Nn,{},"f"),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 io.instance||(io.instance=new io),io.instance}set accessTk(e){this._accessTk=e}set jsAccessTk(e){this._jsAccessTk=e}sendLogData(e){try{const t=e.map((e=>({action:e.action,error:e.error})));to.execute(ci,"post",{appId:window.APP_ID,data:JSON.stringify(t)},(e=>{})),window.zmpSentry&&window.zmpSentry.captureMessage("Result from native",{extra:{data:e}})}catch(e){}}onJSCall(e,t){try{this.debug("onJSCall",e,t);const i=Vi(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,n=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,i)}catch(e){console.error("Call callback error",e)}n&&clearTimeout(n),this._jsCallFuncCallbacks[e]=null,delete this._jsCallFuncCallbacks[e]}}this.results.push({action:i.action,error:i.error_code,message:i.error_message})}catch(e){console.log("onJSCall","error",e)}}onMultiJSCall(e,t){try{this.debug("onMultiJSCall",e,t);const i=Vi(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,n=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,i)}catch(e){console.error("Call callback error",e)}n&&clearTimeout(n)}}this.results.push({action:i.action,error:i.error_code,message:i.error_message})}catch(e){console.log("onMultiJSCall","error",e)}}nativeEventHandler(e,t,i){this.debug(`eventId: ${e}, eventName: ${t}, eventData: ${i}`);const n=Yi(i);this.debug(n);const o=this.handleEventData(t,n);this.events.emit(t,e,o)}handleEventData(t,i){try{switch(t){case e.Events.OpenApp:const{url:t}=i,n=new URL(t),o=n.pathname.split(`/zapps/${Zt}`)[1];return{path:`${o||"/"}${n.search}`};default:return i}}catch(e){return i}}defaultCallback(e){null!=e&&(e=Vi(e))}callNative(e,t,i){return this.debug(e.name,t),new Promise(((r,a)=>{const s=t=>n(this,void 0,void 0,(function*(){var n,o,s,c,l,d,u,h;try{if(Jt.isUndefined(t)||Jt.isNull(t))return a(new Error("Native callback is null"));if(0!==t.error_code){let i=new ki(t.error_code,t.error_message);const r=Gi();if(e===Si.JUMP_LOGIN)i=new ki(hi,`Can not get auth code: ${t.error_message}`);else if(this.isJumped||e.skip_jump){if("permission required!"===String(i.message).toLowerCase()||"no permission!"===String(i.message).toLowerCase())i=new ki(_i.FORBIDDEN.code,_i.FORBIDDEN.message);else if(Ei[r][t.error_code])i=new ki(Ei[r][t.error_code].code,Ei[r][t.error_code].message);else if(null===(o=null===(n=e.error_list)||void 0===n?void 0:n[r])||void 0===o?void 0:o[String(t.error_code)]){let n=e.error_list[r][String(t.error_code)].map_to.message;(null===(l=null===(c=null===(s=e.error_list)||void 0===s?void 0:s[r])||void 0===c?void 0:c[String(t.error_code)])||void 0===l?void 0:l.need_more_detail)&&(n=`${null===(h=null===(u=null===(d=e.error_list)||void 0===d?void 0:d[r])||void 0===u?void 0:u[String(t.error_code)])||void 0===h?void 0:h.map_to.message}: ${t.error_message}`),i=new ki(e.error_list[r][String(t.error_code)].map_to.code,n)}}else i=new ki(_i.UNAUTHORIZED.code,_i.UNAUTHORIZED.message);return a(i)}if(null==i?void 0:i.successCallback){const e=yield i.successCallback(t.data);return r(e)}r(t.data||{})}catch(e){return a(e)}})),c=Ji().isIOS,l=(e=>{var t;const i=Ki(),n=(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))||i>=n})(e);if(c&&!l){const e=new ki(-5,"Client isn't support this action");return a(e)}(null==i?void 0:i.delay)?setTimeout((()=>{o(this,bn,"m",Cn).call(this,e,t,s,null==i?void 0:i.isMultiCallback,null==i?void 0:i.nRetry,null==i?void 0:i.haveTimeout)}),i.delay):o(this,bn,"m",Cn).call(this,e,t,s,null==i?void 0:i.isMultiCallback,null==i?void 0:i.nRetry,null==i?void 0:i.haveTimeout)}))}}wn=new WeakMap,Nn=new WeakMap,bn=new WeakSet,Cn=function e(t,i,n,r=!1,a=3,s=!0){try{const c=t.name,l=((e="")=>`${e.normalize("NFD").replace(Ui,"").replace(Li,"d").replace(Mi,"").toLowerCase()}_${Math.random().toString(36).substr(2,4)}`)(c);if(!this._device.isMobile||Jt.isEmpty(c))return this.onJSCall(l,{error_code:-13,error_message:"params invalid!",data:{device:this._device.isMobile,jsToken:this._jsAccessTk,access_token:this._accessTk},action:c}),!1;null==i&&(i={}),n||(n=this.defaultCallback);const d={error_code:-14,error_message:"Request Timeout!",data:{},action:c};this._jsCallFuncCallbacks[l]={timeout:s&&t.have_callback&&setTimeout((()=>{this.onJSCall(l,d)}),8e3),callback:n};try{return i=Zi(i),r?this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,window.onMultiJSCall(l)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,`window.onMultiJSCall('${l}')`):this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,window.onJSCall(l)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,`window.onJSCall('${l}')`)}catch(s){if(!(a-- >0)){const e={error_code:-5,error_message:"Not ready!",data:{userAgent:this._userAgent,options:i,jsToken:this._jsAccessTk,access_token:this._accessTk},action:c,js_error:s};return this.onJSCall(l,e),!1}setTimeout((()=>{o(this,bn,"m",e).call(this,t,i,n,r,a)}),500)}}catch(e){console.log("jsCall","error",e)}return!1};class no{constructor(e){In.set(this,void 0),Pn.set(this,void 0),kn.set(this,void 0),r(this,Pn,{keys:new Set,currentSize:0,limitSize:li},"f"),r(this,In,e,"f"),r(this,kn,io.getInstance(),"f")}get(e){return n(this,void 0,void 0,(function*(){return yield o(this,kn,"f").callNative(Si.ZBROWSER_MPDS,{mpds_action:"mpds.get",mpds_data:{keys:e},appId:o(this,In,"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 o(this,kn,"f").callNative(Si.ZBROWSER_MPDS,{mpds_action:"mpds.set",mpds_data:{map:e},appId:o(this,In,"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 o(this,kn,"f").callNative(Si.ZBROWSER_MPDS,{mpds_action:"mpds.get.size",mpds_data:{},appId:o(this,In,"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:Jt.isNumber(e)?Number(e/1024):0,limitSize:Number(5120)}}))}remove(e){return n(this,void 0,void 0,(function*(){return{errorKeys:yield o(this,kn,"f").callNative(Si.ZBROWSER_MPDS,{mpds_action:"mpds.remove.key",mpds_data:{keys:e},appId:o(this,In,"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 o(this,kn,"f").callNative(Si.ZBROWSER_MPDS,{mpds_action:"mpds.clear.appData",mpds_data:{},appId:o(this,In,"f")})}))}}In=new WeakMap,Pn=new WeakMap,kn=new WeakMap;class oo{getDataFromStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance(),i=yield t.get(e),n={};return i.forEach(((e,t)=>{n[t]=Yi(e)})),n}))}putDataToStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance(),i={};return Object.entries(e).forEach((([e,t])=>{Jt.isUndefined(t)||Jt.isNull(t)||(i[e]=Qi(t))})),yield t.set(i)}))}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 ro extends oo{constructor(e){super(),Rn.set(this,void 0),r(this,Rn,e,"f")}getInstance(){return new Sn(o(this,Rn,"f"))}}Rn=new WeakMap;class ao extends oo{constructor(e){super(),Dn.set(this,void 0),r(this,Dn,e,"f")}getInstance(){return new no(o(this,Dn,"f"))}}Dn=new WeakMap;class so{static setStorage(e){return n(this,void 0,void 0,(function*(){let t=new ro(this.getAppId());return qi()&&(t=new ao(this.getAppId())),yield t.putDataToStorage(e.data)}))}static getStorage(e){return n(this,void 0,void 0,(function*(){let t=new ro(this.getAppId());qi()&&(t=new ao(this.getAppId()));return yield t.getDataFromStorage(e.keys)}))}static getStorageInfo(e){return n(this,void 0,void 0,(function*(){let e=new ro(this.getAppId());return qi()&&(e=new ao(this.getAppId())),yield e.getStorageInfo()}))}static removeStorage(e){return n(this,void 0,void 0,(function*(){let t=new ro(this.getAppId());return qi()&&(t=new ao(this.getAppId())),yield t.removeDataFromStorage(e.keys)}))}static clearStorage(e={}){return n(this,void 0,void 0,(function*(){let e=new ro(this.getAppId());qi()&&(e=new ao(this.getAppId())),yield e.clearStorage()}))}}class co{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(`${ni}?fields=${i}`,{headers:{access_token:t||""}}).then((e=>n(this,void 0,void 0,(function*(){const t=yield e.json(),i={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"),i}))))}}))}static getPhoneNumber(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.MP_GET_NUMBER,{},{isMultiCallback:!0,successCallback:e=>{const t={number:e};return Promise.resolve(t)},delay:this.isIOS?400:0})}))}}class lo{static closeApp(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.WINDOW_CLOSE,{})}))}static openMiniApp(e){return n(this,void 0,void 0,(function*(){const t=null==e?void 0:e.appId,i=(null==e?void 0:e.params)||{},n=Object.entries(i).map((function([e,t]){return[e,t].join("=")})).join("&");let o;try{o=yield tn(t,0)}catch(e){}const r={appId:t};o&&(r.appName=o.name,r.appAvtUrl=o.logoUrl),yield this.getJSBridge().callNative(Si.OPEN_MP,{mpUrl:`https://h5.zdn.vn/zapps/${t}/${n.length>0?"?"+n:""}`,mpInfo:r})}))}static openWebview(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.OPEN_INAPP,{url:e})}))}static closeLoading(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.MP_CLOSE_LOADINGVIEW,{at:(new Date).getTime(),when:e,url:location.href})}))}}class uo{static getLocation(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.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,successCallback:e=>{const t={latitude:e.latitude,longitude:e.longitude,timestamp:e.timestamp,provider:e.provider};return Promise.resolve(t)},delay:this.isIOS?400:0})}))}static sendLocation(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.QUERY_LOCATION_HIDE,{title:e.title,touserid:e.toUserId,zapp:this.getZAppId()})}))}}class ho{static requestCameraPermission(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.REQUEST_PERMISSION_CAMERA,{},{successCallback:()=>Promise.resolve({userAllow:!0,message:"User Allow"})})}))}static saveImageToPhotosAlbum(e){return n(this,void 0,void 0,(function*(){let t={};return Jt.isEmpty(e.imageBase64Data)?Jt.isEmpty(e.imageUrl)||(t={imageUrl:e.imageUrl}):t={imageBase64Data:e.imageBase64Data},yield this.getJSBridge().callNative(Si.SAVE_IMAGE_GALLERY,Object.assign({},t))}))}}class po{static viewOAQr(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.VIEW_MYQR,{dpn:e.displayName,uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openProfile(t){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.OPEN_PROFILE,{uId:t.id,type:e.ProfileType[t.type],zapp:this.getZAppId(),sourceId:t.sourceId,sourceIndex:t.sourceIndex})}))}static openChat(t){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.OPEN_CHAT,{uId:t.id,type:e.ChatType[t.type],msg:t.message||"",zapp:this.getZAppId(),sourceId:t.sourceId,sourceIndex:t.sourceIndex})}))}static openPostFeed(t){return n(this,void 0,void 0,(function*(){let i={};switch(t.type){case"image":i={photoUrl:t.data.imageUrl};break;case"link":i={link:t.data.link,title:t.data.title,thumb:t.data.thumb,description:t.data.description};break;case"profile":i={avt:t.data.avatar,uid:t.data.id,dpn:t.data.displayName}}return yield this.getJSBridge().callNative(Si.OPEN_POSTFEED,Object.assign(Object.assign({type:e.PostFeedType[t.type]},i),{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.getJSBridge().callNative(Si.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.getJSBridge().callNative(Si.UNFOLLOW_OA,{uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openShareSheet(t){return n(this,void 0,void 0,(function*(){let i={},n=t.type;switch(t.type){case"image":let e=[];const o=Ki(),r=Gi();o>=Ai[r]&&(n="multi_image"),Array.isArray(t.data.imageUrls)&&t.data.imageUrls.length>0?e=t.data.imageUrls:e.push(t.data.imageUrl),i={photoUrls:e,photoUrl:t.data.imageUrl,caption:t.data.caption};break;case"gif":i={photoUrl:t.data.imageUrl,gifUrl:t.data.gifUrl,width:t.data.width,height:t.data.height};break;case"video":i={videoThumb:t.data.videoThumb,videoUrl:t.data.videoUrl,width:t.data.width,height:t.data.height};break;case"link":i={link:t.data.link,chatOnly:t.data.chatOnly?1:0};break;case"oa":i={uid:t.data.id};break;case"zmp":const a=yield this.getAccessToken(),s=yield Xi(this.getAppId(),a||"",t.data.title||"",t.data.description||"",t.data.thumbnail||"",t.data.path);window.forceShareZMP?i={data:{ZInstantAPIInfo:{url:`${s.zinstantApi}`,zinstantdata_id:`templateId=${s.ztemplateId}&appId=${this.getAppId()}&shareId=${s.shareId}`},previewMsgText:{msg:{en:"Zalo Mini Program",vi:"Chương trình nhỏ"}},enableReactions:1}}:(i={link:s.shareableLink,chatOnly:t.data.chatOnly?1:0},t.type="link")}return yield this.getJSBridge().callNative(Si.OPEN_SHARESHEET,Object.assign(Object.assign({type:e.ShareSheetType[n]},i),{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.getJSBridge().callNative(Si.CREATE_SHORTCUT,{url:e,title:t,iconUrl:i})}))}static openProfilePicker(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.MP_OPEN_PROFILE_PICKER,{maxProfile:e},{isMultiCallback:!0,successCallback:e=>{if(Array.isArray(e))return Promise.resolve(e.map((e=>e.id)))}})}))}static getActionsSupported(t){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.GET_SUPPORTED_ACTIONS,{},{isMultiCallback:!1,successCallback:t=>{const i=Gi();if(Array.isArray(t.actions)&&t.actions.length>0){const e=Object.keys(Si).filter((e=>Si[e].skip_jump)),i={actions:[...t.actions,...e]};return Promise.resolve(i)}if(i===e.PlatformType.iOS){const e={actions:Ti};return Promise.resolve(e)}}})}))}static openMediaPicker(t,i,o,r,a,s){return n(this,void 0,void 0,(function*(){const n={type:0,url:i,maxSize:o||1048576};return yield this.getJSBridge().callNative(Si.PICK_MEDIA,{media_type:e.MediaPickerType[t],edit_view:Object.assign(Object.assign({},{enable:1,aspect_ratio:"1:1"}),r),silent_request:a,upload:n,max_select_items:s},{isMultiCallback:!0,successCallback:e=>{const t={data:null==e?void 0:e.result_content};return Promise.resolve(t)}})}))}static openOutApp(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.OPEN_OUTAPP,{url:e})}))}}class vo{static getRouteParams(){let e={};const t=window.location.href;try{let i=new URL(t).searchParams.toString();i&&(e=ji.getParamsAsObject(i))}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.getJSBridge().callNative(Si.WEBVIEW_SET_RESULT,{result:Qi(e.data)})}))}static onCallbackData(t){return n(this,void 0,void 0,(function*(){yield this.events.on(e.Events.OnDataCallback,(e=>{t({data:e})}))}))}}class fo{constructor(){var e,t,i,n,a,s,c,l,d,u,h,p,v,f,g,m,y;Bn.set(this,Vt),jn.set(this,Zt),Un.set(this,qt),Ln.set(this,void 0),Mn.set(this,void 0),xn.set(this,void 0),Wn.set(this,null),zn.set(this,{timer:{getToken:0}}),Jn.set(this,void 0),Fn.set(this,void 0),Kn.set(this,void 0),Gn.set(this,void 0),Hn.set(this,void 0),this.events=on.getInstance(),this.isIOS=Ji().isIOS,$n.set(this,void 0),this.getActionBarConfig=()=>o(this,$n,"f"),this.setActionBarConfig=e=>{r(this,$n,e(o(this,$n,"f")),"f")},this.getVersion=un.getVersion,this.getSystemInfo=un.getSystemInfo,this.setNavigationBarTitle=hn.setNavigationBarTitle,this.setNavigationBarColor=hn.setNavigationBarColor,this.setNavigationBarLeftButton=hn.setNavigationBarLeftButton,this.setBackgroundColor=pn.setBackgroundColor,this.setDeviceOrientation=gn.setDeviceOrientation,this.setStorage=so.setStorage,this.getStorage=so.getStorage,this.getStorageInfo=so.getStorageInfo,this.removeStorage=so.removeStorage,this.clearStorage=so.clearStorage,this.getUserInfo=co.getUserInfo,this.getNetworkType=gn.getNetworkType,this.onNetworkStatusChange=gn.onNetworkStatusChange,this.startBeaconDiscovery=gn.startBeaconDiscovery,this.stopBeaconDiscovery=gn.stopBeaconDiscovery,this.getBeacons=gn.getBeacons,this.closeApp=lo.closeApp,this.getLocation=uo.getLocation,this.stopBluetoothDevicesDiscovery=gn.stopBluetoothDevicesDiscovery,this.startBluetoothDevicesDiscovery=gn.stopBluetoothDevicesDiscovery,this.openBluetoothAdapter=gn.openBluetoothAdapter,this.onBluetoothDeviceFound=gn.onBluetoothDeviceFound,this.onBluetoothAdapterStateChange=gn.onBluetoothAdapterStateChange,this.getConnectedBluetoothDevices=gn.getConnectedBluetoothDevices,this.getBluetoothDevices=gn.getBluetoothDevices,this.getBluetoothAdapterState=gn.getBluetoothAdapterState,this.closeBluetoothAdapter=gn.closeBluetoothAdapter,this.scanQRCode=gn.scanQRCode,this.openProfile=po.openProfile,this.openChat=po.openChat,this.openPostFeed=po.openPostFeed,this.followOA=po.followOA,this.unFollowOA=po.unfollowOA,this.openShareSheet=po.openShareSheet,this.requestCameraPermission=ho.requestCameraPermission,this.createShortcut=po.createShortcut,this.openBioAuthentication=gn.openBioAuthentication,this.checkStateBioAuthentication=gn.checkStateBioAuthentication,this.sendLocation=uo.sendLocation,this.showToast=gn.showToast,this.hideKeyboard=gn.hideKeyboard,this.openPhone=gn.openPhone,this.openSMS=gn.openSMS,this.viewOAQr=po.viewOAQr,this.keepScreen=gn.keepScreen,this.saveImageToPhotosAlbum=ho.saveImageToPhotosAlbum,this.openMiniApp=lo.openMiniApp,this.vibrate=gn.vibrate,this.openWebview=lo.openWebview,this.getRouteParams=vo.getRouteParams,this.getAppInfo=un.getAppInfo,this.sendDataToPreviousMiniApp=vo.sendDataToPreviousMiniApp,this.onCallbackData=vo.onCallbackData,this.getPhoneNumber=co.getPhoneNumber,this.openProfilePicker=po.openProfilePicker,Vn.set(this,po.getActionsSupported),this.connectWifi=gn.connectWifi,this.openMediaPicker=po.openMediaPicker,this.openOutApp=po.openOutApp,this.closeLoading=lo.closeLoading,this.openAppStore=gn.openAppStore,r(this,Ln,null,"f"),r(this,Mn,null,"f"),r(this,xn,null,"f"),this.isShowNavBar=!0,r(this,Fn,0,"f"),r(this,Kn,0,"f"),r(this,Gn,"","f"),r(this,Hn,null,"f"),r(this,Jn,io.getInstance(),"f");const _="home"===(null===(t=null===(e=o(this,Un,"f"))||void 0===e?void 0:e.app)||void 0===t?void 0:t.leftButton)||"both"===(null===(n=null===(i=o(this,Un,"f"))||void 0===i?void 0:i.app)||void 0===n?void 0:n.leftButton)?Ni:Ci,S=new URL(location.href),E=Jt.isString(null===(s=null===(a=o(this,Un,"f"))||void 0===a?void 0:a.app)||void 0===s?void 0:s.headerColor)&&(null===(d=null===(l=null===(c=o(this,Un,"f"))||void 0===c?void 0:c.app)||void 0===l?void 0:l.headerColor)||void 0===d?void 0:d.length)>0?5:6,O="none"===(null===(h=null===(u=o(this,Un,"f"))||void 0===u?void 0:u.app)||void 0===h?void 0:h.leftButton)||"home"===(null===(v=null===(p=o(this,Un,"f"))||void 0===p?void 0:p.app)||void 0===v?void 0:v.leftButton)?wi:bi;r(this,$n,{actionbarType:E,buttonType:O,dataConfig:{backgroundColor:(null===(g=null===(f=o(this,Un,"f"))||void 0===f?void 0:f.app)||void 0===g?void 0:g.headerColor)||"",textColor:(null===(y=null===(m=o(this,Un,"f"))||void 0===m?void 0:m.app)||void 0===y?void 0:y.textColor)||"",viewInLeftType:O,confirmToExit:1},homeConfig:{enable:_,url:`https://h5.zdn.vn/zapps/${this.getAppId()}/${S.search}`}},"f")}static getInstance(){return fo.instance||(fo.instance=new fo),fo.instance}getLoginStatus(){return Jt.isString(o(this,xn,"f"))&&o(this,xn,"f").length>0}getAppId(){return o(this,jn,"f")}getZAppId(){return o(this,Bn,"f")}getDeviceId(){return o(this,Gn,"f")}getContext(){return o(this,Hn,"f")}getJSBridge(){return o(this,Jn,"f")}login(e){return n(this,void 0,void 0,(function*(){const e=(new Date).getTime()-o(this,Fn,"f");if(o(this,xn,"f")&&e<o(this,Kn,"f"))return o(this,xn,"f");const t=yield o(this,Jn,"f").jump(),i=t.find((e=>e.name===ei)),n=t.find((e=>e.name===ti)),a=t.find((e=>e.name===ii));i&&r(this,Gn,i.value,"f"),n&&a&&r(this,Hn,{id:n.value,type:a.value},"f");const s=t.find((e=>e.name===Qt)),c=t.find((e=>e.name===Xt));if(!Jt.isUndefined(s)&&!Jt.isNull(s)&&Jt.isString(s.value)){if(r(this,Ln,s.value,"f"),Jt.isUndefined(c)||Jt.isNull(c)||!Jt.isString(c.value)?yield this.loginZaloV3():(r(this,Mn,c.value,"f"),yield this.loginZaloV4()),!o(this,xn,"f"))throw Bi.loginFailed("Invalid authorization code");return o(this,xn,"f")}throw Bi.loginFailed("Zalo app has not been activated")}))}loginZaloV3(){return n(this,void 0,void 0,(function*(){return yield fetch(`${ri}?app_id=${o(this,Bn,"f")}&redirect_uri=https://h5.zdn.vn/zapps/${o(this,jn,"f")}/&code=${o(this,Ln,"f")}&isSDK=true`).then((e=>n(this,void 0,void 0,(function*(){let t=yield e.json();if(t.access_token){r(this,xn,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return r(this,Kn,e,"f"),r(this,Fn,(new Date).getTime(),"f"),o(this,Jn,"f").accessTk=o(this,xn,"f")||"",window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(o(this,xn,"f")||""),o(this,xn,"f")}return null}))))}))}loginZaloV4(){return n(this,void 0,void 0,(function*(){const e=new URLSearchParams;e.append("app_id",o(this,jn,"f")),e.append("code",o(this,Ln,"f")||""),e.append("code_verifier",o(this,Mn,"f")||""),Jt.isNull(o(this,Wn,"f"))?e.append("grant_type","authorization_code"):(e.append("grant_type","refresh_token"),e.append("refresh_token",o(this,Wn,"f")||""));return yield fetch(oi,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&&r(this,Wn,t.refresh_token,"f"),t.access_token){r(this,xn,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return r(this,Kn,e,"f"),r(this,Fn,(new Date).getTime(),"f"),o(this,Jn,"f").accessTk=o(this,xn,"f")||"",window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(o(this,xn,"f")||""),o(this,xn,"f")}return null}))))}))}getAccessToken(e){return n(this,void 0,void 0,(function*(){const e=(new Date).getTime()-o(this,Fn,"f");if(!o(this,xn,"f"))throw Bi.loginRequired();return e<o(this,Kn,"f")?o(this,xn,"f"):yield this.login()}))}}Bn=new WeakMap,jn=new WeakMap,Un=new WeakMap,Ln=new WeakMap,Mn=new WeakMap,xn=new WeakMap,Wn=new WeakMap,zn=new WeakMap,Jn=new WeakMap,Fn=new WeakMap,Kn=new WeakMap,Gn=new WeakMap,Hn=new WeakMap,$n=new WeakMap,Vn=new WeakMap;class go{constructor(){Zn.set(this,Vt),qn.set(this,qt),Qn.set(this,"DEFAULT ZOAUTH"),Yn.set(this,"DEFAULT ACCESS TOKEN"),Xn.set(this,{timer:{getToken:0}}),eo.set(this,!1),this.getLoginStatus=()=>o(this,eo,"f"),this.getAppId=()=>o(this,Zn,"f"),this.getDeviceId=()=>"",this.login=()=>(r(this,eo,!0,"f"),Promise.resolve(o(this,Qn,"f"))),this.getAccessToken=()=>Promise.resolve(o(this,Yn,"f")),this.getVersion=un.getVersion,this.getSystemInfo=un.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 ro(this.getAppId());return yield t.putDataToStorage(e.data),{errorKeys:[]}})),this.getStorage=e=>n(this,void 0,void 0,(function*(){const t=new ro(this.getAppId());return yield t.getDataFromStorage(e.keys)})),this.getStorageInfo=e=>n(this,void 0,void 0,(function*(){const e=new ro(this.getAppId());return yield e.getStorageInfo()})),this.removeStorage=e=>n(this,void 0,void 0,(function*(){const t=new ro(this.getAppId());return yield t.removeDataFromStorage(e.keys)})),this.clearStorage=e=>n(this,void 0,void 0,(function*(){const e=new ro(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 i={networkType:t};return Promise.resolve(i)},this.onNetworkStatusChange=t=>{const i=navigator.connection||navigator.mozConnection||navigator.webkitConnection,n=i.effectiveType;return i.addEventListener("change",(function(){let i;switch(n){case"none":i=e.NetworkType.none;break;case"4g":i=e.NetworkType.wifi;break;case"3g":case"2g":i=e.NetworkType.cellular;break;default:i=e.NetworkType.unknown}t({isConnected:!0,networkType:i})})),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),Promise.resolve()),this.getRouteParams=vo.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(),this.openAppStore=e=>Promise.resolve()}getContext(){return null}on(e,t,i){throw new Error("Method not implemented.")}once(e,t,i){throw new Error("Method not implemented.")}off(e,t,i,n){throw new Error("Method not implemented.")}removeAllListeners(e){throw new Error("Method not implemented.")}openMediaPicker(e,t,i,n,o,r){return console.warn("This api only works on zalo app"),Promise.resolve({data:""})}}Zn=new WeakMap,qn=new WeakMap,Qn=new WeakMap,Yn=new WeakMap,Xn=new WeakMap,eo=new WeakMap;const mo=Symbol("required"),yo=Symbol("checkType"),_o=(e,t)=>(i,n,o)=>{let r=Reflect.getOwnMetadata(mo,i,n)||[];r.push({parameterIndex:o,fields:e,option:t}),Reflect.defineMetadata(mo,r,i,n)},So=(e,t,i)=>(n,o,r)=>{let a=Reflect.getOwnMetadata(yo,n,o)||[];a.push({parameterIndex:r,type:e,properties:t,defaultValue:i}),Reflect.defineMetadata(yo,a,n,o)};function Eo(e,t){Reflect.getMetadataKeys(e).map((i=>{const n=Reflect.getMetadata(i,e);Reflect.defineMetadata(i,n,t)}))}const Oo=(e,t={})=>i=>{var n;let o=Object.getOwnPropertyDescriptors(i.prototype);if(t.deep){let e=Object.getPrototypeOf(i);for(;e.prototype;){const t=Object.getOwnPropertyDescriptors(e.prototype);o=Object.assign(Object.assign({},t),o),e=Object.getPrototypeOf(e)}}for(const[r,a]of Object.entries(o)){const o="function"==typeof a.value&&"constructor"!=r;if(null===(n=t.exclude)||void 0===n?void 0:n.includes(r))continue;if(t.excludePrefix&&r.startsWith(t.excludePrefix))continue;if(!o)continue;const s=a.value;e(i,r,a),s!=a.value&&Eo(s,a.value),Object.defineProperty(i.prototype,r,a)}},Ao=(e,t,i)=>{const n=i.value,o=function(e){return e.toString().match(/\(.*?\)/)[0].replace(/[()]/gi,"").replace(/\s/gi,"").split(",")}(n);return i.value=function(...i){try{const r=Reflect.getOwnMetadata(mo,e.prototype,t),a=Reflect.getOwnMetadata(yo,e.prototype,t);a&&a.forEach((e=>{const{parameterIndex:t,type:n,properties:r,defaultValue:a}=e;let s=i[t],c=o[t];const l=typeof s;if(!Jt.isUndefined(s)){if(!Hi(s,n))throw Bi.wrongTypeParam(c,n,Array.isArray(s)?"array":null===s?"null":l);"object"===n&&Object.entries(r).forEach((([e,n])=>{const o=e.split("?")[0],r=Jt.get(s,o);if(Jt.isUndefined(r)||Jt.isNull(r)){if(!e.includes("?"))throw Bi.missingParam(e);Jt.get(s,o.split(".")[0])||!a||Jt.isUndefined(Jt.get(a,o))||Jt.set(i[t],o,Jt.get(a,o))}else if(Jt.isFunction(n)){const e=n(r);if(e&&e.error)throw Bi.wrongTypeParam(`${c}.${o}`,e.errorMessage,typeof r)}}))}})),r&&r.forEach((e=>{const{parameterIndex:t,option:n,fields:o}=e,r=i[t],a=null==n?void 0:n.if,s=null==n?void 0:n.defaultValue;let c=!0;a&&(c=Object.keys(a).every((e=>Jt.get(r,e)===a[e]))),c&&o.forEach((e=>{const n=e=>{let n=!1;return Jt.isEmpty(Jt.get(r,e))&&(Jt.isUndefined(Jt.get(s,e))||Jt.set(i[t],e,Jt.get(s,e)),n=!0),n};if(Array.isArray(e)&&e.length>0&&e.every(n))throw Bi.missingParam(e.join(" or "));if(Jt.isString(e)&&n(e))throw Bi.missingParam(e)}))}));const s=n.call(this,...i);if(Jt.isPromise(s)){const{success:e,fail:n}=Array.isArray(i)&&i.length>0&&i[0];return new Promise(((i,o)=>{s.then((t=>{!Jt.isNull(e)&&Jt.isFunction(e)?e.call(null,t,this):i(s)})).catch((e=>{const i=Ri(e,t);!Jt.isNull(n)&&Jt.isFunction(n)?n.call(null,i,this):o(i)}))}))}return s}catch(e){throw Ri(e,t)}},i};var To,bo,wo,No,Co;e.SDKCreator=class{constructor(){this.events=on.getInstance(),To.set(this,void 0),r(this,To,this.getServiceInstance(),"f"),this.events.addListener=(t,i,n)=>{const o=t;return this.events.addListener(e.Events[o],i,n)}}login(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").login(e)}))}getLoginStatus(){return o(this,To,"f").getLoginStatus()}getAccessToken(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getAccessToken(e)}))}getVersion(){return o(this,To,"f").getVersion()}getSystemInfo(){return o(this,To,"f").getSystemInfo()}setNavigationBarTitle(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").setNavigationBarTitle(e)}))}setNavigationBarColor(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").setNavigationBarColor(e)}))}setBackgroundColor(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").setBackgroundColor(e)}))}setNavigationBarLeftButton(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").setNavigationBarLeftButton(e.type)}))}setDeviceOrientation(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").setDeviceOrientation(e)}))}setStorage(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").setStorage(e)}))}getStorage(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getStorage(e)}))}getStorageInfo(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getStorageInfo(e)}))}removeStorage(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").removeStorage(e)}))}clearStorage(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").clearStorage(e)}))}getUserInfo(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getUserInfo(e)}))}getNetworkType(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getNetworkType(e)}))}onNetworkStatusChange(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").onNetworkStatusChange(e)}))}startBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").startBeaconDiscovery(e)}))}stopBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").stopBeaconDiscovery(e)}))}getBeacons(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getBeacons(e)}))}closeApp(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").closeApp(e)}))}getLocation(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getLocation(e)}))}stopBluetoothDevicesDiscovery(){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").stopBluetoothDevicesDiscovery()}))}startBluetoothDevicesDiscovery(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").startBluetoothDevicesDiscovery(e)}))}openBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").openBluetoothAdapter()}))}onBluetoothDeviceFound(){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").onBluetoothDeviceFound()}))}onBluetoothAdapterStateChange(){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").onBluetoothAdapterStateChange()}))}getConnectedBluetoothDevices(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getConnectedBluetoothDevices(e)}))}getBluetoothDevices(){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getBluetoothDevices()}))}getBluetoothAdapterState(){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getBluetoothAdapterState()}))}closeBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").closeBluetoothAdapter()}))}scanQRCode(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").scanQRCode(e)}))}openProfile(e){return n(this,void 0,void 0,(function*(){yield o(this,To,"f").openProfile(e)}))}openChat(e){return n(this,void 0,void 0,(function*(){yield o(this,To,"f").openChat(e)}))}openPostFeed(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").openPostFeed(e)}))}followOA(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").followOA(e)}))}unfollowOA(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").unFollowOA(e)}))}openShareSheet(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").openShareSheet(e)}))}requestCameraPermission(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").requestCameraPermission(e)}))}createShortcut(e){return n(this,void 0,void 0,(function*(){const t=yield tn(Zt,0),i=Ji().isIOS,n=t.logoUrl||Fi("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"),i){a.append("appId",Zt),a.append("appName",r),a.append("appIcon",n);const e=`https://mini.zalo.me/shortcut.html?${a.toString()}`;yield o(this,To,"f").openOutApp(encodeURI(e))}else yield o(this,To,"f").createShortcut(`https://zalo.me/app/link/zapps/${Zt}/?${a.toString()}`,r,n);return Di()}))}openBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").openBioAuthentication(e)}))}checkStateBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").checkStateBioAuthentication(e)}))}sendLocation(e){return n(this,void 0,void 0,(function*(){yield o(this,To,"f").sendLocation(e)}))}showToast(e){return n(this,void 0,void 0,(function*(){yield o(this,To,"f").showToast(e)}))}hideKeyboard(e){return n(this,void 0,void 0,(function*(){yield o(this,To,"f").hideKeyboard(e)}))}openPhone(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").openPhone(e)}))}openSMS(e){return n(this,void 0,void 0,(function*(){yield o(this,To,"f").openSMS(e)}))}viewOAQr(e){return n(this,void 0,void 0,(function*(){yield o(this,To,"f").viewOAQr(e)}))}keepScreen(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").keepScreen(e)}))}saveImageToGallery(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").saveImageToPhotosAlbum(e)}))}saveImageToPhotosAlbum(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").saveImageToPhotosAlbum(e)}))}openMiniApp(e){return n(this,void 0,void 0,(function*(){if(!Jt.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,To,"f").openMiniApp(e)}))}vibrate(e){return n(this,void 0,void 0,(function*(){console.log(e),yield o(this,To,"f").vibrate(e)}))}openWebview(e){return n(this,void 0,void 0,(function*(){const t=new URL(e.url),i=t.searchParams.get("typeInapp");Jt.isEmpty(i)&&t.searchParams.set("typeInapp","1"),yield o(this,To,"f").openWebview(t.href)}))}getRouteParams(){return o(this,To,"f").getRouteParams()}getAppInfo(e){return o(this,To,"f").getAppInfo()}sendDataToPreviousMiniApp(e){return o(this,To,"f").sendDataToPreviousMiniApp(e)}onCallbackData(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").onCallbackData(e)}))}getPhoneNumber(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getPhoneNumber()}))}openProfilePicker(e){return n(this,void 0,void 0,(function*(){const t=yield o(this,To,"f").openProfilePicker(e.maxProfile);let i;if(t.length>0)try{const e=yield this.getAccessToken(),n=yield fetch(ai,{method:"POST",headers:{"Content-Type":"application/json",access_token:e||""},body:JSON.stringify({fields:"id,name,picture",user_ids:t})}),o=yield n.json();if(0!==o.error||!o.data)throw new Error(o.message);i=t.map((e=>{var t,i,n,r,a,s,c,l,d,u,h;return{id:(null===(i=null===(t=o.data[e])||void 0===t?void 0:t.user_info)||void 0===i?void 0:i.user_id_by_app)||"",profile:{name:null===(r=null===(n=o.data[e])||void 0===n?void 0:n.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===(d=o.data[e])||void 0===d?void 0:d.error)?-1:0,message:`Get profile: ${Jt.isUndefined(null===(u=o.data[e])||void 0===u?void 0:u.message)?"Unknown error":null===(h=o.data[e])||void 0===h?void 0:h.message}`}}))}catch(e){i=t.map((t=>({id:t,profile:{name:"",avatar:""},code:-1,message:`Can't get profile: ${e.message}`})))}return{users:i||[]}}))}connectWifi(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").connectWifi(e)}))}openMediaPicker(e){var t,i,r;return n(this,void 0,void 0,(function*(){const n={};Jt.isUndefined(null===(t=e.editView)||void 0===t?void 0:t.enable)||(null===(i=e.editView)||void 0===i?void 0:i.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 o(this,To,"f").openMediaPicker(e.type,e.serverUploadUrl,e.maxItemSize,n,a,s)}))}getShareableLink(e){return n(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();return(yield Xi(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 o(this,To,"f").closeLoading("user action")}))}requestUpdateZalo(e){return n(this,void 0,void 0,(function*(){const e=Ji().isIOS?"https://apps.apple.com/vn/app/zalo/id579523206":"https://play.google.com/store/apps/details?id=com.zing.zalo";return yield o(this,To,"f").openOutApp(e)}))}onConfirmToExit(t){this.events.on(e.Events.AppClose,t,'{"handle_h5": 1}'),o(this,To,"f").setNavigationBarLeftButton(void 0,2)}offConfirmToExit(){this.events.off(e.Events.AppClose),o(this,To,"f").setNavigationBarLeftButton(void 0,0)}getDeviceId(){return o(this,To,"f").getDeviceId()}getContext(){return o(this,To,"f").getContext()}},To=new WeakMap,t([i(0,So("object",{title:en("string")}))],e.SDKCreator.prototype,"setNavigationBarTitle",null),t([i(0,So("object",{color:en("string"),"textColor?":en("string",{values:["white","black"]}),"statusBarColor?":en("string")}))],e.SDKCreator.prototype,"setNavigationBarColor",null),t([i(0,So("object",{backgroundColor:en("string"),"textColor?":en("string",{values:["white","black"]})}))],e.SDKCreator.prototype,"setBackgroundColor",null),t([i(0,So("object",{type:en("string",{values:["none","back","home","both"]})}))],e.SDKCreator.prototype,"setNavigationBarLeftButton",null),t([i(0,So("object",{rotate:en("string",{values:["auto","portrait","landscape"]})}))],e.SDKCreator.prototype,"setDeviceOrientation",null),t([i(0,So("object",{data:en("object")}))],e.SDKCreator.prototype,"setStorage",null),t([i(0,So("object",{keys:en("array<string>")}))],e.SDKCreator.prototype,"getStorage",null),t([i(0,So("object",{keys:en("array<string>")}))],e.SDKCreator.prototype,"removeStorage",null),t([i(0,So("object",{"avatarType?":en("string",{values:["small","normal","large"]})}))],e.SDKCreator.prototype,"getUserInfo",null),t([i(0,So("object",{type:en("string",{values:["user","oa","aliasOA"]}),id:en("string")}))],e.SDKCreator.prototype,"openProfile",null),t([i(0,So("object",{type:en("string",{values:["user","oa"]}),id:en("string"),"message?":en("string")}))],e.SDKCreator.prototype,"openChat",null),t([i(0,_o(["data.imageUrl"],{if:{type:"image"}})),i(0,_o(["data.link"],{if:{type:"link"}})),i(0,_o(["data.id"],{if:{type:"profile"}})),i(0,So("object",{type:en("string",{values:["image","link","profile"]}),data:en("object"),"data.imageUrl?":en("url"),"data.link?":en("url"),"data.title?":en("string"),"data.thumb?":en("url"),"data.description?":en("string"),"data.avatar?":en("url"),"data.id?":en("string"),"data.displayName?":en("string")}))],e.SDKCreator.prototype,"openPostFeed",null),t([i(0,So("object",{id:en("string"),"showDialogConfirm?":en("boolean")}))],e.SDKCreator.prototype,"followOA",null),t([i(0,So("object",{id:en("string")}))],e.SDKCreator.prototype,"unfollowOA",null),t([i(0,_o([["data.imageUrl","data.imageUrls"]],{if:{type:"image"}})),i(0,_o(["data.link"],{if:{type:"link"}})),i(0,_o(["data.id"],{if:{type:"oa"}})),i(0,_o(["data.gifUrl"],{if:{type:"gif"}})),i(0,_o(["data.videoThumb","data.videoUrl"],{if:{type:"video"}})),i(0,_o(["data.thumbnail","data.title","data.description"],{if:{type:"zmp"},defaultValue:{data:{description:""}}})),i(0,So("object",{type:en("string",{values:["image","gif","video","link","oa","zmp"]}),data:en("object"),"data.imageUrl?":en("url"),"data.imageUrls?":en("array<url>",{maxLength:10}),"data.caption?":en("string"),"data.gifUrl?":en("url"),"data.width?":en("number"),"data.height?":en("number"),"data.videoThumb?":en("url"),"data.videoUrl?":en("url"),"data.link?":en("url"),"data.chatOnly?":en("boolean"),"data.id?":en("string"),"data.thumbnail?":en("url"),"data.path?":en("string"),"data.title?":en("string",{maxLength:100}),"data.description?":en(["string"],{maxLength:400})}))],e.SDKCreator.prototype,"openShareSheet",null),t([i(0,So("object",{secretData:en("string"),"ui?":en("object"),"ui.title?":en("string"),"ui.subTitle?":en("string"),"ui.negativeButtonText?":en("string"),"requireFingerprint?":en("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"}}))],e.SDKCreator.prototype,"openBioAuthentication",null),t([i(0,So("object",{toUserId:en("string"),"title?":en("string")}))],e.SDKCreator.prototype,"sendLocation",null),t([i(0,So("object",{message:en("string")}))],e.SDKCreator.prototype,"showToast",null),t([i(0,So("object",{phoneNumber:en("string")}))],e.SDKCreator.prototype,"openPhone",null),t([i(0,So("object",{content:en("string"),phoneNumber:en("string",{regex:/^\+?\d+$/})}))],e.SDKCreator.prototype,"openSMS",null),t([i(0,So("object",{id:en("string"),"displayName?":en("string")},{displayName:""}))],e.SDKCreator.prototype,"viewOAQr",null),t([i(0,So("object",{"imageBase64Data?":en("string"),"imageUrl?":en("url")}))],e.SDKCreator.prototype,"saveImageToGallery",null),t([i(0,So("object",{"imageBase64Data?":en("string"),"imageUrl?":en("url")}))],e.SDKCreator.prototype,"saveImageToPhotosAlbum",null),t([i(0,So("object",{appId:en("string"),"params?":en("object")}))],e.SDKCreator.prototype,"openMiniApp",null),t([i(0,So("object",{"type?":en("string",{values:["oneShot"]}),"milliseconds?":en("number")},{type:"oneShot",milliseconds:500}))],e.SDKCreator.prototype,"vibrate",null),t([i(0,So("object",{url:en("url")}))],e.SDKCreator.prototype,"openWebview",null),t([i(0,So("object",{"maxProfile?":en("number",{min:1,max:10})},{maxProfile:1}))],e.SDKCreator.prototype,"openProfilePicker",null),t([i(0,_o(["SSID"])),i(0,So("object",{SSID:en("string"),"password?":en("string"),"hiddenSSID?":en("boolean")}))],e.SDKCreator.prototype,"connectWifi",null),t([i(0,So("object",{type:en("string",{values:["photo","video","file"]}),serverUploadUrl:en("url"),"maxItemSize?":en("number",{min:0}),"editView?":en("object"),"editView.enable?":en("boolean"),"editView.aspectRatio?":en("string",{regex:/^\d+:\d+$/}),"silentRequest?":en("boolean"),"maxSelectItem?":en("number",{min:1})}))],e.SDKCreator.prototype,"openMediaPicker",null),t([i(0,So("object",{title:en("string",{maxLength:100}),"thumbnail?":en("url"),"path?":en("string"),description:en(["string"],{maxLength:400})},{description:""}))],e.SDKCreator.prototype,"getShareableLink",null),e.SDKCreator=t([Oo(Ao)],e.SDKCreator);class Io extends e.SDKCreator{getServiceInstance(){return fo.getInstance()}}class Po extends e.SDKCreator{getServiceInstance(){return new go}}class ko{constructor(){bo.set(this,Zt)}static getInstance(){return ko.instance||(ko.instance=new ko),ko.instance}createOrder(e,t){return n(this,void 0,void 0,(function*(){const i=o(this,bo,"f"),n=new URLSearchParams;n.append("amount",t.amount.toString()),n.append("item",encodeURIComponent(JSON.stringify(t.item))),n.append("appId",i),t.desc&&n.append("desc",encodeURIComponent(t.desc)),t.extradata&&n.append("extradata",encodeURIComponent(JSON.stringify(t.extradata))),t.method&&n.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 Bi.loginRequired}});r.headers.authorization=`Bearer ${o}`;const a=yield fetch(Ii,Object.assign(Object.assign({method:"POST"},r),{body:n})),s=yield a.json();if(!s.data||0!==s.err)throw Bi.badRequest(s.msg);const c=s.data.id,l=s.data.jwt,d=window.APP_VERSION,u=window.APP_ENV,h={miniAppId:i,orderId:c};l&&(h.token=l),d&&(h.version=d),u&&(h.env=u),t.method&&(h.method=t.method);const p=ji.encode(h),v=new URL(`?${p}`,"https://payment-mini.zalo.me").toString();return yield e.openWebview({url:v,fail:e=>{throw e}}),{orderId:c}}catch(e){throw e}}))}checkTransaction(e,t){return n(this,void 0,void 0,(function*(){try{let i,{data:n}=t;if(n||(n=e.getRouteParams()),"object"==typeof n&&(i=n.appTransID||n.orderId||n.apptransid),"string"==typeof n){const e=ji.getParameterByName("orderId",n),t=ji.getParameterByName("appTransID",n)||ji.getParameterByName("apptransid",n);i=e||t}const r={headers:{authorization:"Bearer "}},a=yield e.getAccessToken({fail:e=>{throw Bi.loginRequired}});r.headers.authorization=`Bearer ${a}`;const s=new URL(Pi),c={transId:i||"",appId:o(this,bo,"f")};s.search=new URLSearchParams(c).toString();const l=yield fetch(s.toString(),r),d=yield l.json();if(!d.data||0!==d.err)throw Bi.badRequest(d.msg);const u=d.data||{};return{msg:u.resultMessage,orderId:u.orderId,resultCode:u.resultCode,transTime:u.transTime,createdAt:u.createAt,transId:u.transId}}catch(e){throw e}}))}}bo=new WeakMap;class Ro{constructor(){wo.set(this,Vt)}static getInstance(){return Ro.instance||(Ro.instance=new Ro),Ro.instance}createOrder(e,t){return Promise.resolve({orderId:""})}checkTransaction(e,t){const i={msg:"Success",orderId:"",resultCode:1,transTime:(new Date).getTime().toString(),createdAt:(new Date).getTime().toString(),transId:""};return Promise.resolve(i)}}wo=new WeakMap;let Do=class{constructor(e){No.set(this,void 0),Co.set(this,void 0),r(this,No,this.getInstance(),"f"),r(this,Co,e,"f")}createOrder(e){return o(this,No,"f").createOrder(o(this,Co,"f"),e)}checkTransaction(e){return o(this,No,"f").checkTransaction(o(this,Co,"f"),e)}};No=new WeakMap,Co=new WeakMap,t([i(0,So("object",{amount:en(["string","number"]),desc:en("string"),"method?":en("string",{values:["MOMO","ZALOPAY","MOMO_SANDBOX","ZALOPAY_SANDBOX","CC","CC_SANDBOX","ATM","ATM_SANDBOX"]})}))],Do.prototype,"createOrder",null),Do=t([Oo(Ao)],Do);class Bo extends Do{getInstance(){return ko.getInstance()}}class jo extends Do{getInstance(){return Ro.getInstance()}}const Uo=Ji();e.default=void 0,window.onJSCall=e=>function(t){io.getInstance().onJSCall(e,t)},window.onMultiJSCall=e=>function(t){io.getInstance().onMultiJSCall(e,t)},window.zaloJSV2={zalo_h5_event_handler:function(e,t,i){io.getInstance().nativeEventHandler(e,t,i)}},e.Payment=void 0,Uo.isZalo?(e.default=new Io,e.Payment=new Bo(e.default)):(e.default=new Po,e.Payment=new jo(e.default)),window.ZaloMiniAppSDK=e.default,e.default=e.default,Object.defineProperty(e,"__esModule",{value:!0})}));
15
+ ***************************************************************************** */function t(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a}function i(e,t){return function(i,n){t(i,n,e)}}function n(e,t,i,n){return new(i||(i=Promise))((function(o,r){function a(e){try{c(n.next(e))}catch(e){r(e)}}function s(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function o(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)}function r(e,t,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!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"===n?o.call(e,i):o?o.value=i:t.set(e,i),i}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(i){return e(t(i))}}(Object.keys,Object),l=Object.prototype.hasOwnProperty;var d=function(e){if(!s(e))return c(e);var t=[];for(var i in Object(e))l.call(e,i)&&"constructor"!=i&&t.push(i);return t},u="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 p="object"==typeof u&&u&&u.Object===Object&&u,v="object"==typeof self&&self&&self.Object===Object&&self,f=p||v||Function("return this")(),g=f.Symbol,m=Object.prototype,y=m.hasOwnProperty,_=m.toString,S=g?g.toStringTag:void 0;var E=function(e){var t=y.call(e,S),i=e[S];try{e[S]=void 0;var n=!0}catch(e){}var o=_.call(e);return n&&(t?e[S]=i:delete e[S]),o},O=Object.prototype.toString;var A=function(e){return O.call(e)},T=g?g.toStringTag:void 0;var b=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":T&&T in Object(e)?E(e):A(e)};var w=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var N,C=function(e){if(!w(e))return!1;var t=b(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},I=f["__core-js_shared__"],P=(N=/[^.]+$/.exec(I&&I.keys&&I.keys.IE_PROTO||""))?"Symbol(src)_1."+N:"";var k=function(e){return!!P&&P in e},R=Function.prototype.toString;var D=function(e){if(null!=e){try{return R.call(e)}catch(e){}try{return e+""}catch(e){}}return""},B=/^\[object .+?Constructor\]$/,j=Function.prototype,U=Object.prototype,L=j.toString,M=U.hasOwnProperty,x=RegExp("^"+L.call(M).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var W=function(e){return!(!w(e)||k(e))&&(C(e)?x:B).test(D(e))};var z=function(e,t){return null==e?void 0:e[t]};var J=function(e,t){var i=z(e,t);return W(i)?i:void 0},F=J(f,"DataView"),K=J(f,"Map"),G=J(f,"Promise"),H=J(f,"Set"),$=J(f,"WeakMap"),V="[object Map]",Z="[object Promise]",q="[object Set]",Q="[object WeakMap]",Y="[object DataView]",X=D(F),ee=D(K),te=D(G),ie=D(H),ne=D($),oe=b;(F&&oe(new F(new ArrayBuffer(1)))!=Y||K&&oe(new K)!=V||G&&oe(G.resolve())!=Z||H&&oe(new H)!=q||$&&oe(new $)!=Q)&&(oe=function(e){var t=b(e),i="[object Object]"==t?e.constructor:void 0,n=i?D(i):"";if(n)switch(n){case X:return Y;case ee:return V;case te:return Z;case ie:return q;case ne:return Q}return t});var re=oe;var ae=function(e){return null!=e&&"object"==typeof e};var se=function(e){return ae(e)&&"[object Arguments]"==b(e)},ce=Object.prototype,le=ce.hasOwnProperty,de=ce.propertyIsEnumerable,ue=se(function(){return arguments}())?se:function(e){return ae(e)&&le.call(e,"callee")&&!de.call(e,"callee")},he=Array.isArray;var pe=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var ve=function(e){return null!=e&&pe(e.length)&&!C(e)};var fe=function(){return!1},ge=h((function(e,t){var i=t&&!t.nodeType&&t,n=i&&e&&!e.nodeType&&e,o=n&&n.exports===i?f.Buffer:void 0,r=(o?o.isBuffer:void 0)||fe;e.exports=r})),me={};me["[object Float32Array]"]=me["[object Float64Array]"]=me["[object Int8Array]"]=me["[object Int16Array]"]=me["[object Int32Array]"]=me["[object Uint8Array]"]=me["[object Uint8ClampedArray]"]=me["[object Uint16Array]"]=me["[object Uint32Array]"]=!0,me["[object Arguments]"]=me["[object Array]"]=me["[object ArrayBuffer]"]=me["[object Boolean]"]=me["[object DataView]"]=me["[object Date]"]=me["[object Error]"]=me["[object Function]"]=me["[object Map]"]=me["[object Number]"]=me["[object Object]"]=me["[object RegExp]"]=me["[object Set]"]=me["[object String]"]=me["[object WeakMap]"]=!1;var ye=function(e){return ae(e)&&pe(e.length)&&!!me[b(e)]};var _e=function(e){return function(t){return e(t)}},Se=h((function(e,t){var i=t&&!t.nodeType&&t,n=i&&e&&!e.nodeType&&e,o=n&&n.exports===i&&p.process,r=function(){try{var e=n&&n.require&&n.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=r})),Ee=Se&&Se.isTypedArray,Oe=Ee?_e(Ee):ye,Ae=Object.prototype.hasOwnProperty;var Te=function(e){if(null==e)return!0;if(ve(e)&&(he(e)||"string"==typeof e||"function"==typeof e.splice||ge(e)||Oe(e)||ue(e)))return!e.length;var t=re(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(s(e))return!d(e).length;for(var i in e)if(Ae.call(e,i))return!1;return!0};var be=function(e){return void 0===e};var we=function(e){return null===e};var Ne=function(e){return"string"==typeof e||!he(e)&&ae(e)&&"[object String]"==b(e)};var Ce=function(e){return"number"==typeof e||ae(e)&&"[object Number]"==b(e)};var Ie=function(e){return ae(e)&&"[object RegExp]"==b(e)},Pe=Se&&Se.isRegExp,ke=Pe?_e(Pe):Ie;var Re=function(e){return"symbol"==typeof e||ae(e)&&"[object Symbol]"==b(e)},De=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Be=/^\w*$/;var je=function(e,t){if(he(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!Re(e))||(Be.test(e)||!De.test(e)||null!=t&&e in Object(t))},Ue=J(Object,"create");var Le=function(){this.__data__=Ue?Ue(null):{},this.size=0};var Me=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},xe=Object.prototype.hasOwnProperty;var We=function(e){var t=this.__data__;if(Ue){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return xe.call(t,e)?t[e]:void 0},ze=Object.prototype.hasOwnProperty;var Je=function(e){var t=this.__data__;return Ue?void 0!==t[e]:ze.call(t,e)};var Fe=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=Ue&&void 0===t?"__lodash_hash_undefined__":t,this};function Ke(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}Ke.prototype.clear=Le,Ke.prototype.delete=Me,Ke.prototype.get=We,Ke.prototype.has=Je,Ke.prototype.set=Fe;var Ge=Ke;var He=function(){this.__data__=[],this.size=0};var $e=function(e,t){return e===t||e!=e&&t!=t};var Ve=function(e,t){for(var i=e.length;i--;)if($e(e[i][0],t))return i;return-1},Ze=Array.prototype.splice;var qe=function(e){var t=this.__data__,i=Ve(t,e);return!(i<0)&&(i==t.length-1?t.pop():Ze.call(t,i,1),--this.size,!0)};var Qe=function(e){var t=this.__data__,i=Ve(t,e);return i<0?void 0:t[i][1]};var Ye=function(e){return Ve(this.__data__,e)>-1};var Xe=function(e,t){var i=this.__data__,n=Ve(i,e);return n<0?(++this.size,i.push([e,t])):i[n][1]=t,this};function et(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}et.prototype.clear=He,et.prototype.delete=qe,et.prototype.get=Qe,et.prototype.has=Ye,et.prototype.set=Xe;var tt=et;var it=function(){this.size=0,this.__data__={hash:new Ge,map:new(K||tt),string:new Ge}};var nt=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var ot=function(e,t){var i=e.__data__;return nt(t)?i["string"==typeof t?"string":"hash"]:i.map};var rt=function(e){var t=ot(this,e).delete(e);return this.size-=t?1:0,t};var at=function(e){return ot(this,e).get(e)};var st=function(e){return ot(this,e).has(e)};var ct=function(e,t){var i=ot(this,e),n=i.size;return i.set(e,t),this.size+=i.size==n?0:1,this};function lt(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}lt.prototype.clear=it,lt.prototype.delete=rt,lt.prototype.get=at,lt.prototype.has=st,lt.prototype.set=ct;var dt=lt;function ut(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var i=function(){var n=arguments,o=t?t.apply(this,n):n[0],r=i.cache;if(r.has(o))return r.get(o);var a=e.apply(this,n);return i.cache=r.set(o,a)||r,a};return i.cache=new(ut.Cache||dt),i}ut.Cache=dt;var ht=ut;var pt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vt=/\\(\\)?/g,ft=function(e){var t=ht(e,(function(e){return 500===i.size&&i.clear(),e})),i=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(pt,(function(e,i,n,o){t.push(n?o.replace(vt,"$1"):i||e)})),t}));var gt=function(e,t){for(var i=-1,n=null==e?0:e.length,o=Array(n);++i<n;)o[i]=t(e[i],i,e);return o},mt=g?g.prototype:void 0,yt=mt?mt.toString:void 0;var _t=function e(t){if("string"==typeof t)return t;if(he(t))return gt(t,e)+"";if(Re(t))return yt?yt.call(t):"";var i=t+"";return"0"==i&&1/t==-Infinity?"-0":i};var St=function(e){return null==e?"":_t(e)};var Et=function(e,t){return he(e)?e:je(e,t)?[e]:ft(St(e))};var Ot=function(e){if("string"==typeof e||Re(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var At=function(e,t){for(var i=0,n=(t=Et(t,e)).length;null!=e&&i<n;)e=e[Ot(t[i++])];return i&&i==n?e:void 0};var Tt=function(e,t,i){var n=null==e?void 0:At(e,t);return void 0===n?i:n},bt=function(){try{var e=J(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var wt=function(e,t,i){"__proto__"==t&&bt?bt(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i},Nt=Object.prototype.hasOwnProperty;var Ct=function(e,t,i){var n=e[t];Nt.call(e,t)&&$e(n,i)&&(void 0!==i||t in e)||wt(e,t,i)},It=/^(?:0|[1-9]\d*)$/;var Pt=function(e,t){var i=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==i||"symbol"!=i&&It.test(e))&&e>-1&&e%1==0&&e<t};var kt=function(e,t,i,n){if(!w(e))return e;for(var o=-1,r=(t=Et(t,e)).length,a=r-1,s=e;null!=s&&++o<r;){var c=Ot(t[o]),l=i;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(o!=a){var d=s[c];void 0===(l=n?n(d,c,s):void 0)&&(l=w(d)?d:Pt(t[o+1])?[]:{})}Ct(s,c,l),s=s[c]}return e};var Rt,Dt,Bt,jt,Ut,Lt,Mt,xt,Wt,zt,Jt={isEmpty:Te,isNull:we,isUndefined:be,isFunction:C,isObject:w,isString:Ne,isNumber:Ce,isArray:he,isRegExp:ke,get:Tt,set:function(e,t,i){return null==e?e:kt(e,t,i)},isPromise:e=>!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then};function Ft(e){return"function"==typeof window.Debug?window.Debug(e):function(...e){process.env.NODE_ENV}}e.NetworkType=void 0,(Rt=e.NetworkType||(e.NetworkType={})).none="none",Rt.wifi="wifi",Rt.cellular="cellular",Rt.unknown="unknown",e.PlatformType=void 0,(Dt=e.PlatformType||(e.PlatformType={})).wp="wp",Dt.android="android",Dt.iOS="iOS",Dt.unknown="unknown",e.ProfileType=void 0,(Bt=e.ProfileType||(e.ProfileType={}))[Bt.user=1]="user",Bt[Bt.oa=0]="oa",Bt[Bt.aliasOA=2]="aliasOA",e.ChatType=void 0,(jt=e.ChatType||(e.ChatType={}))[jt.user=1]="user",jt[jt.oa=0]="oa",e.PostFeedType=void 0,(Ut=e.PostFeedType||(e.PostFeedType={}))[Ut.image=1]="image",Ut[Ut.link=4]="link",Ut[Ut.profile=5]="profile",e.ShareSheetType=void 0,(Lt=e.ShareSheetType||(e.ShareSheetType={}))[Lt.image=1]="image",Lt[Lt.gif=11]="gif",Lt[Lt.video=12]="video",Lt[Lt.link=4]="link",Lt[Lt.oa=5]="oa",Lt[Lt.zmp=20]="zmp",Lt[Lt.multi_image=21]="multi_image",e.OrientationType=void 0,(Mt=e.OrientationType||(e.OrientationType={}))[Mt.auto=1]="auto",Mt[Mt.portrait=2]="portrait",Mt[Mt.landscape=3]="landscape",e.VibrateType=void 0,(xt=e.VibrateType||(e.VibrateType={}))[xt.oneShot=0]="oneShot",e.Events=void 0,(Wt=e.Events||(e.Events={})).AppPaused="h5.event.paused",Wt.AppResumed="h5.event.resumed",Wt.NetworkChanged="h5.event.connection.changed",Wt.OnDataCallback="h5.event.webview.result",Wt.OpenApp="h5.event.open.mp",Wt.AppClose="h5.event.action.close",e.MediaPickerType=void 0,(zt=e.MediaPickerType||(e.MediaPickerType={}))[zt.photo=4]="photo",zt[zt.video=5]="video",zt[zt.file=6]="file";const Kt=e=>{const t=document.cookie;if(t){const o=t.split("; ");if(o&&o.length>0)for(var i=e.length+1,n=o.length-1;n>=0;n--){let t=o[n];if(t&&0===t.indexOf(e)&&(t=t.substring(i,t.length),t))return t=t.replace(/["']/g,""),t}}return null},Gt=e=>Kt(`${window.location.host}_`+e),Ht=e=>Kt((()=>{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),$t=1048576,Vt=window.zAppID,Zt=window.APP_ID,qt=window.APP_CONFIG||{},Qt="h5.zdn.vn_zoauth",Yt="h5.zdn.vn_zlink3rd",Xt="h5.zdn.vn_zoauth_vrf",ei="h5.zdn.vn_deviceID",ti="h5.zdn.vn_contextID",ii="h5.zdn.vn_contextType",ni="https://graph.zalo.me/v2.0/me",oi="https://h5.zalo.me/openapi/access_token",ri="https://oauth.zaloapp.com/v3/access_token",ai="https://graph.zalo.me/v2.0/me/friends/list",si="https://h5.zalo.me/apps/get-info",ci="https://h5.zalo.me/log/async",li=5*$t,di=e=>({NONE:e?-2:0,WIFI:e?0:1,"2G":2,"3G":e?15:2,"4G":e?13:2}),ui=0,hi=-2e3,pi=-1400,vi=-1500,fi=-1401,gi=-2004,mi=-2005,yi={SUCCESS:"Success",UNKNOWN_ERROR:"Unknown error. Please try again later.",TIME_OUT:"Request timeout. Please try again later.",LOGIN_REQUIRED:"Please login (https://miniapp.zalo.me/docs/api/login) before to call this api",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 id. Please check your params again.",INVALID_PARAM:"Invalid parameter",USER_DENIED:"User denied",USER_CANCEL:"User cancel",MEDIA_PICKER_FAIL:"Unable to pick media",SAVE_IMAGE_FAIL:"Unable to save image"},_i={SUCCESS:{code:ui,message:yi.SUCCESS},UNKNOWN_ERROR:{code:hi,message:yi.UNKNOWN_ERROR},UNAUTHORIZED:{code:fi,message:yi.LOGIN_REQUIRED},FORBIDDEN:{code:-1403,message:yi.NOT_PERMISSION},CLIENT_NOT_SUPPORT:{code:-1404,message:yi.CLIENT_NOT_SUPPORT},DECODE_FAILED:{code:-2001,message:yi.DECODE_FAILED},TIME_OUT:{code:-1408,message:yi.TIME_OUT},USER_DENIED:{code:-2002,message:yi.USER_DENIED},USER_CANCEL:{code:-2003,message:yi.USER_CANCEL}},Si={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",error_list:{android:{"-2":{map_to:_i.USER_DENIED}},iOS:{"-2":{map_to:_i.USER_DENIED}}}},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,error_list:{android:{"-1":{map_to:_i.USER_DENIED}},iOS:{"-1":{map_to:_i.USER_DENIED}}}},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},error_list:{android:{"-101":{map_to:{code:mi,message:yi.SAVE_IMAGE_FAIL},need_more_detail:!0},"-102":{map_to:{code:mi,message:yi.SAVE_IMAGE_FAIL},need_more_detail:!0}},iOS:{"-10":{map_to:{code:mi,message:yi.SAVE_IMAGE_FAIL},need_more_detail:!0}}}},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},error_list:{android:{"-1":{map_to:_i.USER_DENIED},"-101":{map_to:_i.USER_DENIED}},iOS:{"-1":{map_to:_i.USER_DENIED},"-10":{map_to:_i.USER_DENIED}}}},MP_OPEN_PROFILE_PICKER:{name:"action.mp.open.profile.picker",version_live:{iOS:432},error_list:{android:{"-101":{map_to:_i.USER_CANCEL}},iOS:{"-101":{map_to:_i.USER_CANCEL}}}},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:440},error_list:{android:{"-101":{map_to:_i.USER_CANCEL},999:{map_to:{code:gi,message:yi.MEDIA_PICKER_FAIL},need_more_detail:!0}},iOS:{"-10":{map_to:{code:gi,message:yi.MEDIA_PICKER_FAIL}}}}},MP_CLOSE_LOADINGVIEW:{name:"action.mp.close.loadingview"}},Ei={android:{"-4":_i.DECODE_FAILED,"-5":_i.CLIENT_NOT_SUPPORT,"-14":_i.TIME_OUT},iOS:{"-9":_i.DECODE_FAILED,"-5":_i.CLIENT_NOT_SUPPORT,"-14":_i.TIME_OUT}},Oi={android:12100571,iOS:400,wp:0,unknown:0},Ai={android:12100615,iOS:460,wp:0,unknown:0},Ti=[Si.GET_DOWNLOADED_STICKER.name,Si.OPEN_SHARE_STICKER.name,Si.OPEN_PROFILE.name,Si.OPEN_FEED_DETAIL.name,Si.OPEN_FRIEND_RADA.name,Si.OPEN_INAPP.name,Si.OPEN_OUTAPP.name,Si.OPEN_PAGE.name,Si.OPEN_PHOTODETAIL.name,Si.OPEN_GALARY.name,Si.OPEN_GAMECENTER.name,Si.OPEN_GAMENEWS.name,Si.OPEN_TAB_CONTACT.name,Si.OPEN_TAB_SOCIAL.name,Si.OPEN_FRIENDSUGGEST.name,Si.OPEN_GROUPLIST.name,Si.OPEN_NEARBY.name,Si.OPEN_ROOM.name,Si.OPEN_STICKERSTORE.name,Si.OPEN_CREATECHAT.name,Si.COPY_LINK_CATESTICKER.name,Si.REQUEST_BUY_STICKER.name,Si.OPEN_CHAT.name,Si.OPEN_TAB_CHAT.name,Si.OPEN_CHATGROUP.name,Si.OPEN_ADDFRIEND.name,Si.OPEN_TAB_MORE.name,Si.OPEN_POSTFEED.name,Si.OPEN_LOGINDEVICES.name,Si.OPEN_SENDSTICKER.name,Si.REPORT_ABUSE.name,Si.FOLLOW_OA.name,Si.UNFOLLOW_OA.name,Si.OPEN_GAMEDETAIL.name,Si.OPEN_SHARESHEET.name,Si.REQUEST_PERMISSION_CAMERA.name,Si.CHANGE_TITLE_HEADER.name,Si.WEBVIEW_CLEARCACHE.name,Si.WEBVIEW_CONFIRMCACHE.name,Si.WEBVIEW_ISVISIBLE.name,Si.WEBVIEW_NETWORKTYPE.name,Si.CHANGE_BUTTON_HEADER.name,Si.CREATE_OPTIONS_MENU.name,Si.CREATE_SHORTCUT.name,Si.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE.name,Si.WINDOW_CLOSE.name,Si.WEBVIEW_CHECKRESERROR.name,Si.IAP_REQUESTPAYMENT.name,Si.ZBROWSER_GETSTATS.name,Si.ZBROWSER_JSBRIDGE.name,Si.PROMPT_AUTHENTICATION.name,Si.CHANGE_ACTIONBAR_COLOR.name,Si.PROMPT_AUTHENTICATION_CHECK_STATE.name,Si.OPEN_APPSTORE.name,Si.GET_LOCATION.name,Si.QUERY_LOCATION_HIDE.name,Si.SHOW_TOAST.name,Si.OPEN_APP.name,Si.HIDE_KEYBOARD.name,Si.OPEN_PHONE.name,Si.OPEN_QR.name,Si.OPEN_SMS.name,Si.VIEW_MYQR.name,Si.KEEP_SCREEN.name,Si.CHANGE_AUTOROTATE.name,Si.CHECK_APP_INSTALLED.name,Si.QUERY_SHOW.name,Si.QUERY_HIDE.name,Si.OPEN_INAPPRW.name,Si.ZALORUN_GETTRACKINGSTATUS.name,Si.ZALORUN_SETTRACKINGSTATUS.name,Si.ZALORUN_GETDAYSTEP.name,Si.ZALORUN_FORCESUBMITDATA.name,Si.ZALORUN_SETWEIGHT.name,Si.OPEN_PROFILE_EXT.name,Si.DOWNLOAD_CATE.name,Si.JUMP_LOGIN.name,Si.OPEN_ADTIMA_ADS_INTERSTITIAL.name,Si.OPEN_ADTIMA_ADS.name,Si.GET_ADIDCLIENT.name,Si.SCAN_IBEACON.name,Si.SAVE_IMAGE_GALLERY.name,Si.OPEN_MP.name,Si.CHANGE_ACTIONBAR.name,Si.INTERACTIVE_VIBRATION.name,Si.ZBROWSER_MPDS.name],bi=0,wi=3,Ni=1,Ci=0,Ii="https://payment-mini.zalo.me/api/order/create",Pi="https://payment-mini.zalo.me/api/transaction";class ki{constructor(e,t,i){this.code=e,this.message=t,this.api=i}toString(){return`api: ${String(this.api)}; code: ${this.code}; message: ${this.message}`}toJSON(){return{code:this.code,message:this.message,api:this.api}}}const Ri=(e,t)=>e instanceof ki?((e,t)=>(e.api=t,e.toJSON()))(e,t):((e,t)=>e instanceof Error?new ki(hi,e.message,t).toJSON():new ki(hi,yi.UNKNOWN_ERROR,t).toJSON())(e,t),Di=(e,t)=>({code:ui,message:t||yi.SUCCESS,data:e||{}}),Bi={badRequest:e=>new ki(pi,e),loginFailed:e=>new ki(fi,`${yi.LOGIN_FAILED}: ${e}`),loginRequired:()=>new ki(fi,yi.LOGIN_REQUIRED),missingParam:e=>new ki(pi,`Missing required argument: ${e}`),wrongTypeParam:(e,t,i)=>new ki(pi,`Wrong type of parameter '${e}'. Expected ${t}, but got ${i}`),cannotGetShareInfo:()=>new ki(vi,"Can not get app info to share"),lengthInvalid:e=>new ki(pi,`${e} length is invalid.`)};const ji={encode:function(e){var t=[];for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];if(void 0===n)return;if(null===n)return void t.push(i);t.push(encodeURIComponent(i)+"="+encodeURIComponent(n))}return t.join("&")},decode:function(e,t){var i={};if(""===e)return i;for(var n=e.split("&"),o=0;o<n.length;o++){var r=n[o].split("=",2),a=decodeURIComponent(r[0]);if(t&&Object.prototype.hasOwnProperty.call(i,a))throw new URIError("Duplicate key: "+a);i[a]=2===r.length?decodeURIComponent(r[1]):null}return i},appendToUrl:function(e,t){return e+(-1!==e.indexOf("?")?"&":"?")+("string"==typeof t?t:ji.encode(t))},getParameterByName:function(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");var i=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null},getParamsAsObject:function(e){var t={};return e?(e.split("&").map((function(e){var i=e.split("=");i&&2==i.length&&(t[i[0]]=decodeURIComponent(i[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),i=[];return t.map((function(t){var n=e[t],o=[t,n="object"==(void 0===n?"undefined":typeof n)?JSON.stringify(n):encodeURIComponent(n)].join("=");i.push(o)})),i.join("&")}},Ui=new RegExp("[\\u0300-\\u036f]","g"),Li=new RegExp("[đ|Đ]","g"),Mi=new RegExp("\\s","g"),xi=Ft("zmp:utils:common"),Wi=e=>{try{new URL(e)}catch(e){return!1}return!0},zi=()=>navigator.userAgent||navigator.vendor||window.opera,Ji=()=>{const e=zi().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)}},Fi=e=>{const t=document.getElementsByTagName("meta");for(let i=0;i<t.length;i++)if(t[i].getAttribute("name")===e||t[i].getAttribute("property")===e)return t[i].getAttribute("content");return""},Ki=()=>{const e=zi().toLowerCase().split("zalo")[1];if(e){return e.replace(" ","").split("/")[1]||""}return""},Gi=()=>{let t=Ji();return t.isWP?e.PlatformType.wp:t.isAndroid?e.PlatformType.android:t.isIOS?e.PlatformType.iOS:e.PlatformType.unknown},Hi=(e,t)=>{const i=t.toLowerCase(),n=i.split(/[<>]/i),o="array"===n[0];return!!("url"===i&&Wi(e)||o&&("array"===i&&Array.isArray(e)||((e,t)=>Array.isArray(t)&&!t.some((t=>"url"===e?!Wi(t):typeof t!==e)))(n[1],e))||!Array.isArray(e)&&typeof e===t)},$i=e=>(e=>{let t=Gt(e);return t||(t=Ht(e),t)?t:Kt(e)})(e),Vi=e=>{if(Jt.isObject(JSON)&&JSON.parse&&Jt.isString(e)){const t=e.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\x00/g,"");return JSON.parse(t,((e,t)=>t))}return Jt.isObject(e)?e:new Function("return "+e)()},Zi=e=>{if(Jt.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 i=e.length,n=0;n<i;n++)t.push(Zi(e[n]));return"["+t.join(",")+"]"}if("object"==typeof e){for(var o in t=new Array,e)t.push('"'+o+'":'+Zi(e[o]));return"{"+t.join(",")+"}"}return e.toString()},qi=()=>{try{const e=Number(Ki()),t=Gi();return e>=Oi[t]}catch(e){return!0}},Qi=e=>JSON.stringify(e).replace(/"/g,'\\"').replace(/'/g,"&#39;"),Yi=e=>{try{if(e){xi(e);const t=e.replace(/\\/g,"").replace(/&#39;/g,"'");return xi("formattedValue",t,JSON.parse(t),typeof JSON.parse(t)),JSON.parse(t)}return null}catch(t){return xi("parse json error:",t),e}},Xi=(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 d=yield fetch("https://h5.zalo.me/openapi/create-sharelink",Object.assign({method:"POST",body:s},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})),u=yield d.json();if(!u||0!==u.err)throw Bi.cannotGetShareInfo();return l.search=`${l.search}&zshareId=${u.data.shareId}`,Object.assign(Object.assign({},u.data),{shareableLink:l.href})})),en=(e,t)=>i=>{if(!(Array.isArray(e)?e.some((e=>Hi(i,e))):Hi(i,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(i)),errorMessage:null==t?void 0:t.values.toString()};if(Jt.isNumber(null==t?void 0:t.maxLength))return{error:Jt.isString(i)&&i.length>(null==t?void 0:t.maxLength),errorMessage:`data length must <= ${null==t?void 0:t.maxLength}`};if(Jt.isNumber(null==t?void 0:t.min)&&Jt.isNumber(null==t?void 0:t.max))return{error:i<(null==t?void 0:t.min)||i>(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(Jt.isNumber(null==t?void 0:t.min))return{error:i<(null==t?void 0:t.min),errorMessage:`data must >= ${null==t?void 0:t.min}`};if(Jt.isNumber(null==t?void 0:t.max))return{error:i>(null==t?void 0:t.max),errorMessage:`data must <= ${null==t?void 0:t.max}`};if(Jt.isRegExp(null==t?void 0:t.regex))return{error:!t.regex.test(i),errorMessage:"data must valid"}}return{error:!1}},tn=(e,t,i)=>n(void 0,void 0,void 0,(function*(){const n={appId:e,versionStatus:t};Jt.isUndefined(i)||(n.currentVersion=i);const o=ji.appendToUrl(si,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 nn=h((function(e){var t=Object.prototype.hasOwnProperty,i="~";function n(){}function o(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function r(e,t,n,r,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new o(n,r||e,a),c=i?i+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 n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),s.prototype.eventNames=function(){var e,n,o=[];if(0===this._eventsCount)return o;for(n in e=this._events)t.call(e,n)&&o.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},s.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,r=n.length,a=new Array(r);o<r;o++)a[o]=n[o].fn;return a},s.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,o,r,a){var s=i?i+e:e;if(!this._events[s])return!1;var c,l,d=this._events[s],u=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),u){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,n),!0;case 4:return d.fn.call(d.context,t,n,o),!0;case 5:return d.fn.call(d.context,t,n,o,r),!0;case 6:return d.fn.call(d.context,t,n,o,r,a),!0}for(l=1,c=new Array(u-1);l<u;l++)c[l-1]=arguments[l];d.fn.apply(d.context,c)}else{var h,p=d.length;for(l=0;l<p;l++)switch(d[l].once&&this.removeListener(e,d[l].fn,void 0,!0),u){case 1:d[l].fn.call(d[l].context);break;case 2:d[l].fn.call(d[l].context,t);break;case 3:d[l].fn.call(d[l].context,t,n);break;case 4:d[l].fn.call(d[l].context,t,n,o);break;default:if(!c)for(h=1,c=new Array(u-1);h<u;h++)c[h-1]=arguments[h];d[l].fn.apply(d[l].context,c)}}return!0},s.prototype.on=function(e,t,i){return r(this,e,t,i,!1)},s.prototype.once=function(e,t,i){return r(this,e,t,i,!0)},s.prototype.removeListener=function(e,t,n,o){var r=i?i+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||n&&s.context!==n||a(this,r);else{for(var c=0,l=[],d=s.length;c<d;c++)(s[c].fn!==t||o&&!s[c].once||n&&s[c].context!==n)&&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=i?i+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=i,s.EventEmitter=s,e.exports=s}));class on extends nn{constructor(){super(),this.debug=Ft("zmp:event-emitter")}static getInstance(){return on.instance||(on.instance=new on),on.instance}h5ConfirmHandleEvent(e,t,i){ZaloJavaScriptInterface.jsH5EventCallback(e,t,i||"")}on(e,t,i){this.debug(`register ${e}: ${i}`);return super.on(e,((n,o)=>{this.h5ConfirmHandleEvent(n,e,i),t(o)}),i)}once(e,t,i){this.debug(`register once ${e}: ${i}`);return super.once(e,((n,o)=>{this.h5ConfirmHandleEvent(n,e,i),t(o)}),i)}}var rn,an,sn,cn,ln,dn="2.22.2";class un{static getVersion(){return dn}static getSystemInfo(){return{version:Fi("version-id")||"",apiVersion:dn,zaloVersion:Ki(),platform:Gi(),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 tn(e,0,t.version)}))}}class hn{static setNavigationBarTitle(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.CHANGE_TITLE_HEADER,{title:e.title},{haveTimeout:!1})}))}static setNavigationBarColor(e){return n(this,void 0,void 0,(function*(){const t={};let i;Jt.isEmpty(e.textColor)||(t.textColor=e.textColor),Jt.isString(e.color)&&e.color.length>0?(Jt.isEmpty(e.color)||(t.backgroundColor=e.color),i=5):(Jt.isEmpty(e.statusBarColor)||(t.backgroundColor=e.statusBarColor),i=6),this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{actionbarType:i,dataConfig:Object.assign(Object.assign({},e.dataConfig),t)}))),yield this.getJSBridge().callNative(Si.CHANGE_ACTIONBAR,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarLeftButton(e,t){return n(this,void 0,void 0,(function*(){let i,n;Jt.isString(e)&&(i="none"===e||"home"===e?wi:bi,n="home"===e||"both"===e?Ni:Ci),this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{buttonType:Jt.isNumber(i)?i:e.buttonType,dataConfig:Object.assign(Object.assign({},e.dataConfig),{confirmToExit:Jt.isNumber(t)?t:e.dataConfig.confirmToExit,viewInLeftType:Jt.isNumber(i)?i:e.dataConfig.viewInLeftType}),homeConfig:Object.assign(Object.assign({},e.homeConfig),{enable:Jt.isNumber(n)?n:e.homeConfig.enable})}))),yield this.getJSBridge().callNative(Si.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBar(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.CHANGE_ACTIONBAR,{data:e},{haveTimeout:!1})}))}}class pn{static setBackgroundColor(e){return n(this,void 0,void 0,(function*(){Jt.isString(e.backgroundColor)&&e.backgroundColor.length>0&&(yield this.getJSBridge().callNative(Si.CHANGE_ACTIONBAR,{actionbarType:this.isShowNavBar?5:6,dataConfig:{backgroundColor:e.backgroundColor,textColor:e.textColor}}))}))}}class vn{constructor(e,t,i,n){this.title=n,this.severity=t;const o=new Date;if(this.time=o.toLocaleTimeString(),this.content=e,i>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(" ")}}rn=new WeakMap,an=new WeakMap,sn=new WeakMap,cn=new WeakMap,ln=new WeakMap;const fn=new class{constructor(){rn.set(this,3),an.set(this,["none","error","warn","info"]),sn.set(this,"[zmp] > "),cn.set(this,{error:0,warn:0,info:0,firstError:null,lastError:null}),ln.set(this,((e,t,i)=>{o(this,cn,"f")[o(this,an,"f")[e]]++;const n=o(this,an,"f")[e];if(r(this,sn,o(this,sn,"f")+("string"!=typeof t?new vn(t,n,e,i).toString():t),"f"),!(e>o(this,rn,"f")))switch(e){case 1:console.error(o(this,sn,"f"));break;case 2:console.warn(o(this,sn,"f"));break;case 3:console.info(o(this,sn,"f"));break;default:throw new Error("internal")}}))}setLogLevel(e){r(this,rn,e,"f")}info(e){o(this,ln,"f").call(this,3,e)}warn(e,t){o(this,ln,"f").call(this,2,e,t)}error(e,t){o(this,ln,"f").call(this,1,e,t)}getMetrics(){return o(this,cn,"f")}};class gn{static setDeviceOrientation(t){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.CHANGE_AUTOROTATE,{autoRotate:e.OrientationType[t.rotate]})}))}static getNetworkType(t){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.WEBVIEW_NETWORKTYPE,{url:window.location.href,featureId:""}).then((t=>{const i=t.network;let n;const o=Ji().isAndroid;switch(i){case di(o).NONE:n=e.NetworkType.none;break;case di(o).WIFI:n=e.NetworkType.wifi;break;case di(o)["2G"]:case di(o)["3G"]:case di(o)["4G"]:n=e.NetworkType.cellular;break;default:n=e.NetworkType.unknown}return{networkType:n}}))}))}static onNetworkStatusChange(t){return n(this,void 0,void 0,(function*(){yield this.events.on(e.Events.NetworkChanged,(e=>{const i=e&&e.state;this.getNetworkType().then((e=>{const n={isConnected:"CONNECTED"===i,networkType:e&&e.networkType};t(n)})).catch((e=>{fn.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:Jt.isNumber(null==e?void 0:e.scanningType)?e.scanningType:0,data:{scan_from_source:Jt.isString(null==e?void 0:e.scanFromSource)?e.scanFromSource:"",expire:Jt.isNumber(null==e?void 0:e.expire)?e.expire:3e3,monitor_interval:Jt.isNumber(null==e?void 0:e.monitorInterval)?e.monitorInterval:60,domain:Jt.isString(null==e?void 0:e.domain)?e.domain:"",scan_config:{scan_time:Jt.isNumber(null===(t=null==e?void 0:e.scanConfig)||void 0===t?void 0:t.scanTime)?e.scanConfig.scanTime:15e3,time_between_scan:Jt.isNumber(null===(i=null==e?void 0:e.scanConfig)||void 0===i?void 0:i.timeBetweenScan)?e.scanConfig.timeBetweenScan:1e4,beacon_timeout:Jt.isNumber(null===(o=null==e?void 0:e.scanConfig)||void 0===o?void 0:o.beaconTimeout)?e.scanConfig.beaconTimeout:3e4,delayCheckConnectedTimeout:Jt.isNumber(null===(r=null==e?void 0:e.scanConfig)||void 0===r?void 0:r.delayCheckConnectedTimeout)?e.scanConfig.delayCheckConnectedTimeout:5e3,beaconConnectedTimeout:Jt.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.getJSBridge().callNative(Si.SCAN_IBEACON,Object.assign({},n)),!0}))}static stopBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.SCAN_IBEACON,Object.assign({},{subaction:2})),!0}))}static getBeacons(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.SCAN_IBEACON,Object.assign({},{subaction:1}),{isMultiCallback:!0}).then((e=>{const t={beacons:[]};return Array.isArray(e)&&e.forEach((e=>{const i={uuid:e.uuid,major:e.major,minor:e.minor,distance:e.distance,rssi:e.rssi};t.beacons.push(i)})),t}))}))}static stopBluetoothDevicesDiscovery(){return n(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static startBluetoothDevicesDiscovery(e){return n(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},Object.assign({},e))}))}static openBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static onBluetoothDeviceFound(){return n(this,void 0,void 0,(function*(){return this.getJSBridge().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.getJSBridge().callNative({name:""},t)}))}static getBluetoothDevices(){return n(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static getBluetoothAdapterState(){return n(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static closeBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static scanQRCode(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.OPEN_QR,{skipOpenLink:!0})}))}static showToast(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.SHOW_TOAST,{toast:e.message})}))}static hideKeyboard(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.HIDE_KEYBOARD,{})}))}static openPhone(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.OPEN_PHONE,{phoneNum:e.phoneNumber,phoneCode:e.phoneNumber})}))}static openSMS(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.OPEN_SMS,{content:e.content,phoneCode:e.phoneNumber})}))}static keepScreen(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.KEEP_SCREEN,{data:{keep_screen_on:e.keepScreenOn?1:0}})}))}static openBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.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,i,n,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===(i=null==e?void 0:e.data)||void 0===i?void 0:i.error_code,message:null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.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.getJSBridge().callNative(Si.PROMPT_AUTHENTICATION_CHECK_STATE,{}).then((e=>({bioState:null==e?void 0:e.bio_state})))}))}static vibrate(t){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.INTERACTIVE_VIBRATION,{type:e.VibrateType[t.type],vibrate_time:t.milliseconds})}))}static connectWifi(e){return n(this,void 0,void 0,(function*(){let t="open";return Jt.isString(e.password)&&e.password.length>0&&(t="wpa_wpa2"),yield this.getJSBridge().callNative(Si.MP_JOIN_WIFI,{ssid:e.SSID,securityType:t,password:e.password,hiddenSsid:e.hiddenSSID})}))}static openAppStore(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.OPEN_APPSTORE,e)}))}}var mn,yn,_n;class Sn{constructor(e){mn.set(this,localStorage),yn.set(this,void 0),_n.set(this,void 0),Ji(),r(this,_n,{keys:new Set,currentSize:0,limitSize:li},"f"),r(this,yn,e,"f"),this.findAllCurrentDataByApp(e)}findAllCurrentDataByApp(e){try{let t;for(t in o(this,mn,"f")){if(e){if(t.split("_")[0]!==e)continue}o(this,_n,"f").keys.add(t)}}catch(e){fn.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,yn,"f")&&(e=`${o(this,yn,"f")}_${e}`),o(this,_n,"f").keys.has(e)?o(this,mn,"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){o(this,yn,"f")&&(e=`${o(this,yn,"f")}_${e}`),o(this,mn,"f").setItem(e,t),o(this,_n,"f").keys.add(e)}getInfo(){return n(this,void 0,void 0,(function*(){return Promise.resolve(this.getInfoSync())}))}getInfoSync(){const e=((e,t)=>{let i,n,o=0;for(n in e){const r=n.split("_")[0];e.hasOwnProperty(n)&&(t&&r!==t||(i=2*(e[n].length+n.length),o+=i))}return o})(o(this,mn,"f"),o(this,yn,"f"));return{currentSize:Jt.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){o(this,yn,"f")&&(e=`${o(this,yn,"f")}_${e}`),o(this,_n,"f").keys.has(e)&&(o(this,mn,"f").removeItem(e),o(this,_n,"f").keys.delete(e))}clear(){return n(this,void 0,void 0,(function*(){return Promise.resolve(this.clearSync())}))}clearSync(){o(this,_n,"f").keys.forEach((e=>{o(this,yn,"f")&&e.indexOf(o(this,yn,"f"))<0||(o(this,mn,"f").removeItem(e),o(this,_n,"f").keys.delete(e))}))}}mn=new WeakMap,yn=new WeakMap,_n=new WeakMap;var En={},On=function(e,t,i){var n=t||"default";return function(){var t=n in En?En[n](e,i):e;return t.apply(this,arguments)}};On.setWrapper=function(e){var t=arguments.length<=1||void 0===arguments[1]?"default":arguments[1];En[t]=e};var An={error:{code:1,error_subcode:1357046,message:"Received Invalid JSON reply.",type:"http"}};function Tn(e){try{return null===e?An:JSON.parse(e)}catch(e){return An}}var bn,wn,Nn,Cn,In,Pn,kn,Rn,Dn,Bn,jn,Un,Ln,Mn,xn,Wn,zn,Jn,Fn,Kn,Gn,Hn,$n,Vn,Zn,qn,Qn,Yn,Xn,eo,to={execute:function(e,t,i,n){i.suppress_http_code=1;var o=ji.encode(i);"post"!=t&&(e=ji.appendToUrl(e,o),o="");var r=function(e,t){if(!self.XMLHttpRequest)return null;var i=new XMLHttpRequest,n=function(){};if(!("withCredentials"in i))return null;i.open(e,t,!0),i.setRequestHeader("Content-type","application/x-www-form-urlencoded");var o={send:function(e){i.send(e)}},r=On((function(){r=n,"onload"in o&&o.onload(i)}),"entry","XMLHttpRequest:load"),a=On((function(){a=n,"onerror"in o&&o.onerror(i)}),"entry","XMLHttpRequest:error");return i.onload=function(){r()},i.onerror=function(){a()},i.onreadystatechange=function(){4==i.readyState&&(200==i.status?r():a())},o}(t,e);return!!r&&(r.onload=function(e){n(Tn(e.responseText))},r.onerror=function(e){e.responseText?n(Tn(e.responseText)):n({error:{code:1,error_subcode:1357045,message:"unknown error (empty response)",status:e.status,type:"http"}})},r.send(o),!0)}};class io extends nn{constructor(){super(),bn.add(this),this.debug=Ft("zmp:ZaloJSBridge"),this.events=on.getInstance(),this._accessTk=$i("zacc_session")||"DEFAULT_ACCESS_TOKEN",this._jsAccessTk=$i("zlink3rd")||"DEFAULT_JS_TOKEN",this.results=[],this._userAgent=zi(),this._device=Ji(),this.isJumped=!1,wn.set(this,null),Nn.set(this,void 0),this.jump=()=>new Promise(((e,t)=>{Jt.isUndefined(o(this,wn,"f"))||Jt.isNull(o(this,wn,"f"))?this.callNative(Si.JUMP_LOGIN,{}).then((t=>{const i=t&&t.cookiesOAuthLogins||[],n=t&&t.actionPermission||[];Object.entries(n).forEach((e=>{const t=e[0],i=e[1]||{perm:0,decode:0};o(this,Nn,"f")[t]||(o(this,Nn,"f")[t]={permission:!1,support:!1}),o(this,Nn,"f")[t].permission=1===i.perm}));const a=i.find((e=>e.name===Yt));a&&(this.jsAccessTk=a.value,window.ZJSBridge.setJSToken&&window.ZJSBridge.setJSToken(a.value)),r(this,wn,i,"f"),this.isJumped=!0,e(i)})).catch((e=>{this.isJumped=!1,t(e)})):e(o(this,wn,"f"))})),this._jsCallFuncCallbacks={},r(this,Nn,{},"f"),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 io.instance||(io.instance=new io),io.instance}set accessTk(e){this._accessTk=e}set jsAccessTk(e){this._jsAccessTk=e}sendLogData(e){try{const t=e.map((e=>({action:e.action,error:e.error})));to.execute(ci,"post",{appId:window.APP_ID,data:JSON.stringify(t)},(e=>{})),window.zmpSentry&&window.zmpSentry.captureMessage("Result from native",{extra:{data:e}})}catch(e){}}onJSCall(e,t){try{this.debug("onJSCall",e,t);const i=Vi(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,n=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,i)}catch(e){console.error("Call callback error",e)}n&&clearTimeout(n),this._jsCallFuncCallbacks[e]=null,delete this._jsCallFuncCallbacks[e]}}this.results.push({action:i.action,error:i.error_code,message:i.error_message})}catch(e){console.log("onJSCall","error",e)}}onMultiJSCall(e,t){try{this.debug("onMultiJSCall",e,t);const i=Vi(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,n=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,i)}catch(e){console.error("Call callback error",e)}n&&clearTimeout(n)}}this.results.push({action:i.action,error:i.error_code,message:i.error_message})}catch(e){console.log("onMultiJSCall","error",e)}}nativeEventHandler(e,t,i){this.debug(`eventId: ${e}, eventName: ${t}, eventData: ${i}`);const n=Yi(i);this.debug(n);const o=this.handleEventData(t,n);this.events.emit(t,e,o)}handleEventData(t,i){try{switch(t){case e.Events.OpenApp:const{url:t}=i,n=new URL(t),o=n.pathname.split(`/zapps/${Zt}`)[1];return{path:`${o||"/"}${n.search}`};default:return i}}catch(e){return i}}defaultCallback(e){null!=e&&(e=Vi(e))}callNative(e,t,i){return this.debug(e.name,t),new Promise(((r,a)=>{const s=t=>n(this,void 0,void 0,(function*(){var n,o,s,c,l,d,u,h;try{if(Jt.isUndefined(t)||Jt.isNull(t))return a(new Error("Native callback is null"));if(0!==t.error_code){let i=new ki(t.error_code,t.error_message);const r=Gi();if(e===Si.JUMP_LOGIN)i=new ki(hi,`Can not get auth code: ${t.error_message}`);else if(this.isJumped||e.skip_jump){if("permission required!"===String(i.message).toLowerCase()||"no permission!"===String(i.message).toLowerCase())i=new ki(_i.FORBIDDEN.code,_i.FORBIDDEN.message);else if(Ei[r][t.error_code])i=new ki(Ei[r][t.error_code].code,Ei[r][t.error_code].message);else if(null===(o=null===(n=e.error_list)||void 0===n?void 0:n[r])||void 0===o?void 0:o[String(t.error_code)]){let n=e.error_list[r][String(t.error_code)].map_to.message;(null===(l=null===(c=null===(s=e.error_list)||void 0===s?void 0:s[r])||void 0===c?void 0:c[String(t.error_code)])||void 0===l?void 0:l.need_more_detail)&&(n=`${null===(h=null===(u=null===(d=e.error_list)||void 0===d?void 0:d[r])||void 0===u?void 0:u[String(t.error_code)])||void 0===h?void 0:h.map_to.message}: ${t.error_message}`),i=new ki(e.error_list[r][String(t.error_code)].map_to.code,n)}}else i=new ki(_i.UNAUTHORIZED.code,_i.UNAUTHORIZED.message);return a(i)}if(null==i?void 0:i.successCallback){const e=yield i.successCallback(t.data);return r(e)}r(t.data||{})}catch(e){return a(e)}})),c=Ji().isIOS,l=(e=>{var t;const i=Ki(),n=(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))||i>=n})(e);if(c&&!l){const e=new ki(-5,"Client isn't support this action");return a(e)}(null==i?void 0:i.delay)?setTimeout((()=>{o(this,bn,"m",Cn).call(this,e,t,s,null==i?void 0:i.isMultiCallback,null==i?void 0:i.nRetry,null==i?void 0:i.haveTimeout)}),i.delay):o(this,bn,"m",Cn).call(this,e,t,s,null==i?void 0:i.isMultiCallback,null==i?void 0:i.nRetry,null==i?void 0:i.haveTimeout)}))}}wn=new WeakMap,Nn=new WeakMap,bn=new WeakSet,Cn=function e(t,i,n,r=!1,a=3,s=!0){try{const c=t.name,l=((e="")=>`${e.normalize("NFD").replace(Ui,"").replace(Li,"d").replace(Mi,"").toLowerCase()}_${Math.random().toString(36).substr(2,4)}`)(c);if(!this._device.isMobile||Jt.isEmpty(c))return this.onJSCall(l,{error_code:-13,error_message:"params invalid!",data:{device:this._device.isMobile,jsToken:this._jsAccessTk,access_token:this._accessTk},action:c}),!1;null==i&&(i={}),n||(n=this.defaultCallback);const d={error_code:-14,error_message:"Request Timeout!",data:{},action:c};this._jsCallFuncCallbacks[l]={timeout:s&&t.have_callback&&setTimeout((()=>{this.onJSCall(l,d)}),8e3),callback:n};try{return i=Zi(i),r?this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,window.onMultiJSCall(l)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,`window.onMultiJSCall('${l}')`):this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,window.onJSCall(l)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,`window.onJSCall('${l}')`)}catch(s){if(!(a-- >0)){const e={error_code:-5,error_message:"Not ready!",data:{userAgent:this._userAgent,options:i,jsToken:this._jsAccessTk,access_token:this._accessTk},action:c,js_error:s};return this.onJSCall(l,e),!1}setTimeout((()=>{o(this,bn,"m",e).call(this,t,i,n,r,a)}),500)}}catch(e){console.log("jsCall","error",e)}return!1};class no{constructor(e){In.set(this,void 0),Pn.set(this,void 0),kn.set(this,void 0),r(this,Pn,{keys:new Set,currentSize:0,limitSize:li},"f"),r(this,In,e,"f"),r(this,kn,io.getInstance(),"f")}get(e){return n(this,void 0,void 0,(function*(){return yield o(this,kn,"f").callNative(Si.ZBROWSER_MPDS,{mpds_action:"mpds.get",mpds_data:{keys:e},appId:o(this,In,"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 o(this,kn,"f").callNative(Si.ZBROWSER_MPDS,{mpds_action:"mpds.set",mpds_data:{map:e},appId:o(this,In,"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 o(this,kn,"f").callNative(Si.ZBROWSER_MPDS,{mpds_action:"mpds.get.size",mpds_data:{},appId:o(this,In,"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:Jt.isNumber(e)?Number(e/1024):0,limitSize:Number(5120)}}))}remove(e){return n(this,void 0,void 0,(function*(){return{errorKeys:yield o(this,kn,"f").callNative(Si.ZBROWSER_MPDS,{mpds_action:"mpds.remove.key",mpds_data:{keys:e},appId:o(this,In,"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 o(this,kn,"f").callNative(Si.ZBROWSER_MPDS,{mpds_action:"mpds.clear.appData",mpds_data:{},appId:o(this,In,"f")})}))}}In=new WeakMap,Pn=new WeakMap,kn=new WeakMap;class oo{getDataFromStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance(),i=yield t.get(e),n={};return i.forEach(((e,t)=>{n[t]=Yi(e)})),n}))}putDataToStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance(),i={};return Object.entries(e).forEach((([e,t])=>{Jt.isUndefined(t)||Jt.isNull(t)||(i[e]=Qi(t))})),yield t.set(i)}))}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 ro extends oo{constructor(e){super(),Rn.set(this,void 0),r(this,Rn,e,"f")}getInstance(){return new Sn(o(this,Rn,"f"))}}Rn=new WeakMap;class ao extends oo{constructor(e){super(),Dn.set(this,void 0),r(this,Dn,e,"f")}getInstance(){return new no(o(this,Dn,"f"))}}Dn=new WeakMap;class so{static setStorage(e){return n(this,void 0,void 0,(function*(){let t=new ro(this.getAppId());return qi()&&(t=new ao(this.getAppId())),yield t.putDataToStorage(e.data)}))}static getStorage(e){return n(this,void 0,void 0,(function*(){let t=new ro(this.getAppId());qi()&&(t=new ao(this.getAppId()));return yield t.getDataFromStorage(e.keys)}))}static getStorageInfo(e){return n(this,void 0,void 0,(function*(){let e=new ro(this.getAppId());return qi()&&(e=new ao(this.getAppId())),yield e.getStorageInfo()}))}static removeStorage(e){return n(this,void 0,void 0,(function*(){let t=new ro(this.getAppId());return qi()&&(t=new ao(this.getAppId())),yield t.removeDataFromStorage(e.keys)}))}static clearStorage(e={}){return n(this,void 0,void 0,(function*(){let e=new ro(this.getAppId());qi()&&(e=new ao(this.getAppId())),yield e.clearStorage()}))}}class co{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(`${ni}?fields=${i}`,{headers:{access_token:t||""}}).then((e=>n(this,void 0,void 0,(function*(){const t=yield e.json(),i={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"),i}))))}}))}static getPhoneNumber(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.MP_GET_NUMBER,{},{isMultiCallback:!0,successCallback:e=>{const t={number:e};return Promise.resolve(t)},delay:this.isIOS?400:0})}))}}class lo{static closeApp(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.WINDOW_CLOSE,{})}))}static openMiniApp(e){return n(this,void 0,void 0,(function*(){const t=null==e?void 0:e.appId,i=(null==e?void 0:e.params)||{},n=Object.entries(i).map((function([e,t]){return[e,t].join("=")})).join("&");let o;try{o=yield tn(t,0)}catch(e){}const r={appId:t};o&&(r.appName=o.name,r.appAvtUrl=o.logoUrl),yield this.getJSBridge().callNative(Si.OPEN_MP,{mpUrl:`https://h5.zdn.vn/zapps/${t}/${n.length>0?"?"+n:""}`,mpInfo:r})}))}static openWebview(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.OPEN_INAPP,{url:e})}))}static closeLoading(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.MP_CLOSE_LOADINGVIEW,{at:(new Date).getTime(),when:e,url:location.href})}))}}class uo{static getLocation(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.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,successCallback:e=>{const t={latitude:e.latitude,longitude:e.longitude,timestamp:e.timestamp,provider:e.provider};return Promise.resolve(t)},delay:this.isIOS?400:0})}))}static sendLocation(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.QUERY_LOCATION_HIDE,{title:e.title,touserid:e.toUserId,zapp:this.getZAppId()})}))}}class ho{static requestCameraPermission(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.REQUEST_PERMISSION_CAMERA,{},{successCallback:()=>Promise.resolve({userAllow:!0,message:"User Allow"})})}))}static saveImageToPhotosAlbum(e){return n(this,void 0,void 0,(function*(){let t={};return Jt.isEmpty(e.imageBase64Data)?Jt.isEmpty(e.imageUrl)||(t={imageUrl:e.imageUrl}):t={imageBase64Data:e.imageBase64Data},yield this.getJSBridge().callNative(Si.SAVE_IMAGE_GALLERY,Object.assign({},t))}))}}class po{static viewOAQr(e){return n(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(Si.VIEW_MYQR,{dpn:e.displayName,uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openProfile(t){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.OPEN_PROFILE,{uId:t.id,type:e.ProfileType[t.type],zapp:this.getZAppId(),sourceId:t.sourceId,sourceIndex:t.sourceIndex})}))}static openChat(t){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.OPEN_CHAT,{uId:t.id,type:e.ChatType[t.type],msg:t.message||"",zapp:this.getZAppId(),sourceId:t.sourceId,sourceIndex:t.sourceIndex})}))}static openPostFeed(t){return n(this,void 0,void 0,(function*(){let i={};switch(t.type){case"image":i={photoUrl:t.data.imageUrl};break;case"link":i={link:t.data.link,title:t.data.title,thumb:t.data.thumb,description:t.data.description};break;case"profile":i={avt:t.data.avatar,uid:t.data.id,dpn:t.data.displayName}}return yield this.getJSBridge().callNative(Si.OPEN_POSTFEED,Object.assign(Object.assign({type:e.PostFeedType[t.type]},i),{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.getJSBridge().callNative(Si.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.getJSBridge().callNative(Si.UNFOLLOW_OA,{uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openShareSheet(t){return n(this,void 0,void 0,(function*(){let i={},n=t.type;switch(t.type){case"image":let e=[];const o=Ki(),r=Gi();o>=Ai[r]&&(n="multi_image"),Array.isArray(t.data.imageUrls)&&t.data.imageUrls.length>0?e=t.data.imageUrls:e.push(t.data.imageUrl),i={photoUrls:e,photoUrl:t.data.imageUrl,caption:t.data.caption};break;case"gif":i={photoUrl:t.data.imageUrl,gifUrl:t.data.gifUrl,width:t.data.width,height:t.data.height};break;case"video":i={videoThumb:t.data.videoThumb,videoUrl:t.data.videoUrl,width:t.data.width,height:t.data.height};break;case"link":i={link:t.data.link,chatOnly:t.data.chatOnly?1:0};break;case"oa":i={uid:t.data.id};break;case"zmp":const a=yield this.getAccessToken(),s=yield Xi(this.getAppId(),a||"",t.data.title||"",t.data.description||"",t.data.thumbnail||"",t.data.path);window.forceShareZMP?i={data:{ZInstantAPIInfo:{url:`${s.zinstantApi}`,zinstantdata_id:`templateId=${s.ztemplateId}&appId=${this.getAppId()}&shareId=${s.shareId}`},previewMsgText:{msg:{en:"Zalo Mini Program",vi:"Chương trình nhỏ"}},enableReactions:1}}:(i={link:s.shareableLink,chatOnly:t.data.chatOnly?1:0},t.type="link")}return yield this.getJSBridge().callNative(Si.OPEN_SHARESHEET,Object.assign(Object.assign({type:e.ShareSheetType[n]},i),{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.getJSBridge().callNative(Si.CREATE_SHORTCUT,{url:e,title:t,iconUrl:i})}))}static openProfilePicker(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.MP_OPEN_PROFILE_PICKER,{maxProfile:e},{isMultiCallback:!0,successCallback:e=>{if(Array.isArray(e))return Promise.resolve(e.map((e=>e.id)))}})}))}static getActionsSupported(t){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.GET_SUPPORTED_ACTIONS,{},{isMultiCallback:!1,successCallback:t=>{const i=Gi();if(Array.isArray(t.actions)&&t.actions.length>0){const e=Object.keys(Si).filter((e=>Si[e].skip_jump)),i={actions:[...t.actions,...e]};return Promise.resolve(i)}if(i===e.PlatformType.iOS){const e={actions:Ti};return Promise.resolve(e)}}})}))}static openMediaPicker(t,i,o,r,a,s){return n(this,void 0,void 0,(function*(){const n={type:0,url:i,maxSize:o||1048576};return yield this.getJSBridge().callNative(Si.PICK_MEDIA,{media_type:e.MediaPickerType[t],edit_view:Object.assign(Object.assign({},{enable:1,aspect_ratio:"1:1"}),r),silent_request:a,upload:n,max_select_items:s},{isMultiCallback:!0,successCallback:e=>{const t={data:null==e?void 0:e.result_content};return Promise.resolve(t)}})}))}static openOutApp(e){return n(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(Si.OPEN_OUTAPP,{url:e})}))}}class vo{static getRouteParams(){let e={};const t=window.location.href;try{let i=new URL(t).searchParams.toString();i&&(e=ji.getParamsAsObject(i))}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.getJSBridge().callNative(Si.WEBVIEW_SET_RESULT,{result:Qi(e.data)})}))}static onCallbackData(t){return n(this,void 0,void 0,(function*(){yield this.events.on(e.Events.OnDataCallback,(e=>{t({data:e})}))}))}}class fo{constructor(){var e,t,i,n,a,s,c,l,d,u,h,p,v,f,g,m,y;Bn.set(this,Vt),jn.set(this,Zt),Un.set(this,qt),Ln.set(this,void 0),Mn.set(this,void 0),xn.set(this,void 0),Wn.set(this,null),zn.set(this,{timer:{getToken:0}}),Jn.set(this,void 0),Fn.set(this,void 0),Kn.set(this,void 0),Gn.set(this,void 0),Hn.set(this,void 0),this.events=on.getInstance(),this.isIOS=Ji().isIOS,$n.set(this,void 0),this.getActionBarConfig=()=>o(this,$n,"f"),this.setActionBarConfig=e=>{r(this,$n,e(o(this,$n,"f")),"f")},this.getVersion=un.getVersion,this.getSystemInfo=un.getSystemInfo,this.setNavigationBarTitle=hn.setNavigationBarTitle,this.setNavigationBarColor=hn.setNavigationBarColor,this.setNavigationBarLeftButton=hn.setNavigationBarLeftButton,this.setBackgroundColor=pn.setBackgroundColor,this.setDeviceOrientation=gn.setDeviceOrientation,this.setStorage=so.setStorage,this.getStorage=so.getStorage,this.getStorageInfo=so.getStorageInfo,this.removeStorage=so.removeStorage,this.clearStorage=so.clearStorage,this.getUserInfo=co.getUserInfo,this.getNetworkType=gn.getNetworkType,this.onNetworkStatusChange=gn.onNetworkStatusChange,this.startBeaconDiscovery=gn.startBeaconDiscovery,this.stopBeaconDiscovery=gn.stopBeaconDiscovery,this.getBeacons=gn.getBeacons,this.closeApp=lo.closeApp,this.getLocation=uo.getLocation,this.stopBluetoothDevicesDiscovery=gn.stopBluetoothDevicesDiscovery,this.startBluetoothDevicesDiscovery=gn.stopBluetoothDevicesDiscovery,this.openBluetoothAdapter=gn.openBluetoothAdapter,this.onBluetoothDeviceFound=gn.onBluetoothDeviceFound,this.onBluetoothAdapterStateChange=gn.onBluetoothAdapterStateChange,this.getConnectedBluetoothDevices=gn.getConnectedBluetoothDevices,this.getBluetoothDevices=gn.getBluetoothDevices,this.getBluetoothAdapterState=gn.getBluetoothAdapterState,this.closeBluetoothAdapter=gn.closeBluetoothAdapter,this.scanQRCode=gn.scanQRCode,this.openProfile=po.openProfile,this.openChat=po.openChat,this.openPostFeed=po.openPostFeed,this.followOA=po.followOA,this.unFollowOA=po.unfollowOA,this.openShareSheet=po.openShareSheet,this.requestCameraPermission=ho.requestCameraPermission,this.createShortcut=po.createShortcut,this.openBioAuthentication=gn.openBioAuthentication,this.checkStateBioAuthentication=gn.checkStateBioAuthentication,this.sendLocation=uo.sendLocation,this.showToast=gn.showToast,this.hideKeyboard=gn.hideKeyboard,this.openPhone=gn.openPhone,this.openSMS=gn.openSMS,this.viewOAQr=po.viewOAQr,this.keepScreen=gn.keepScreen,this.saveImageToPhotosAlbum=ho.saveImageToPhotosAlbum,this.openMiniApp=lo.openMiniApp,this.vibrate=gn.vibrate,this.openWebview=lo.openWebview,this.getRouteParams=vo.getRouteParams,this.getAppInfo=un.getAppInfo,this.sendDataToPreviousMiniApp=vo.sendDataToPreviousMiniApp,this.onCallbackData=vo.onCallbackData,this.getPhoneNumber=co.getPhoneNumber,this.openProfilePicker=po.openProfilePicker,Vn.set(this,po.getActionsSupported),this.connectWifi=gn.connectWifi,this.openMediaPicker=po.openMediaPicker,this.openOutApp=po.openOutApp,this.closeLoading=lo.closeLoading,this.openAppStore=gn.openAppStore,r(this,Ln,null,"f"),r(this,Mn,null,"f"),r(this,xn,null,"f"),this.isShowNavBar=!0,r(this,Fn,0,"f"),r(this,Kn,0,"f"),r(this,Gn,"","f"),r(this,Hn,null,"f"),r(this,Jn,io.getInstance(),"f");const _="home"===(null===(t=null===(e=o(this,Un,"f"))||void 0===e?void 0:e.app)||void 0===t?void 0:t.leftButton)||"both"===(null===(n=null===(i=o(this,Un,"f"))||void 0===i?void 0:i.app)||void 0===n?void 0:n.leftButton)?Ni:Ci,S=new URL(location.href),E=Jt.isString(null===(s=null===(a=o(this,Un,"f"))||void 0===a?void 0:a.app)||void 0===s?void 0:s.headerColor)&&(null===(d=null===(l=null===(c=o(this,Un,"f"))||void 0===c?void 0:c.app)||void 0===l?void 0:l.headerColor)||void 0===d?void 0:d.length)>0?5:6,O="none"===(null===(h=null===(u=o(this,Un,"f"))||void 0===u?void 0:u.app)||void 0===h?void 0:h.leftButton)||"home"===(null===(v=null===(p=o(this,Un,"f"))||void 0===p?void 0:p.app)||void 0===v?void 0:v.leftButton)?wi:bi;r(this,$n,{actionbarType:E,buttonType:O,dataConfig:{backgroundColor:(null===(g=null===(f=o(this,Un,"f"))||void 0===f?void 0:f.app)||void 0===g?void 0:g.headerColor)||"",textColor:(null===(y=null===(m=o(this,Un,"f"))||void 0===m?void 0:m.app)||void 0===y?void 0:y.textColor)||"",viewInLeftType:O,confirmToExit:1},homeConfig:{enable:_,url:`https://h5.zdn.vn/zapps/${this.getAppId()}/${S.search}`}},"f")}static getInstance(){return fo.instance||(fo.instance=new fo),fo.instance}getLoginStatus(){return Jt.isString(o(this,xn,"f"))&&o(this,xn,"f").length>0}getAppId(){return o(this,jn,"f")}getZAppId(){return o(this,Bn,"f")}getDeviceId(){return o(this,Gn,"f")}getContext(){return o(this,Hn,"f")}getJSBridge(){return o(this,Jn,"f")}login(e){return n(this,void 0,void 0,(function*(){const e=(new Date).getTime()-o(this,Fn,"f");if(o(this,xn,"f")&&e<o(this,Kn,"f"))return o(this,xn,"f");const t=yield o(this,Jn,"f").jump(),i=t.find((e=>e.name===ei)),n=t.find((e=>e.name===ti)),a=t.find((e=>e.name===ii));i&&r(this,Gn,i.value,"f"),n&&a&&r(this,Hn,{id:n.value,type:a.value},"f");const s=t.find((e=>e.name===Qt)),c=t.find((e=>e.name===Xt));if(!Jt.isUndefined(s)&&!Jt.isNull(s)&&Jt.isString(s.value)){if(r(this,Ln,s.value,"f"),Jt.isUndefined(c)||Jt.isNull(c)||!Jt.isString(c.value)?yield this.loginZaloV3():(r(this,Mn,c.value,"f"),yield this.loginZaloV4()),!o(this,xn,"f"))throw Bi.loginFailed("Invalid authorization code");return o(this,xn,"f")}throw Bi.loginFailed("Zalo app has not been activated")}))}loginZaloV3(){return n(this,void 0,void 0,(function*(){return yield fetch(`${ri}?app_id=${o(this,Bn,"f")}&redirect_uri=https://h5.zdn.vn/zapps/${o(this,jn,"f")}/&code=${o(this,Ln,"f")}&isSDK=true`).then((e=>n(this,void 0,void 0,(function*(){let t=yield e.json();if(t.access_token){r(this,xn,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return r(this,Kn,e,"f"),r(this,Fn,(new Date).getTime(),"f"),o(this,Jn,"f").accessTk=o(this,xn,"f")||"",window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(o(this,xn,"f")||""),o(this,xn,"f")}return null}))))}))}loginZaloV4(){return n(this,void 0,void 0,(function*(){const e=new URLSearchParams;e.append("app_id",o(this,jn,"f")),e.append("code",o(this,Ln,"f")||""),e.append("code_verifier",o(this,Mn,"f")||""),Jt.isNull(o(this,Wn,"f"))?e.append("grant_type","authorization_code"):(e.append("grant_type","refresh_token"),e.append("refresh_token",o(this,Wn,"f")||""));return yield fetch(oi,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&&r(this,Wn,t.refresh_token,"f"),t.access_token){r(this,xn,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return r(this,Kn,e,"f"),r(this,Fn,(new Date).getTime(),"f"),o(this,Jn,"f").accessTk=o(this,xn,"f")||"",window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(o(this,xn,"f")||""),o(this,xn,"f")}return null}))))}))}getAccessToken(e){return n(this,void 0,void 0,(function*(){const e=(new Date).getTime()-o(this,Fn,"f");if(!o(this,xn,"f"))throw Bi.loginRequired();return e<o(this,Kn,"f")?o(this,xn,"f"):yield this.login()}))}}Bn=new WeakMap,jn=new WeakMap,Un=new WeakMap,Ln=new WeakMap,Mn=new WeakMap,xn=new WeakMap,Wn=new WeakMap,zn=new WeakMap,Jn=new WeakMap,Fn=new WeakMap,Kn=new WeakMap,Gn=new WeakMap,Hn=new WeakMap,$n=new WeakMap,Vn=new WeakMap;class go{constructor(){Zn.set(this,Vt),qn.set(this,qt),Qn.set(this,"DEFAULT ZOAUTH"),Yn.set(this,"DEFAULT ACCESS TOKEN"),Xn.set(this,{timer:{getToken:0}}),eo.set(this,!1),this.getLoginStatus=()=>o(this,eo,"f"),this.getAppId=()=>o(this,Zn,"f"),this.getDeviceId=()=>"",this.login=()=>(r(this,eo,!0,"f"),Promise.resolve(o(this,Qn,"f"))),this.getAccessToken=()=>Promise.resolve(o(this,Yn,"f")),this.getVersion=un.getVersion,this.getSystemInfo=un.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 ro(this.getAppId());return yield t.putDataToStorage(e.data),{errorKeys:[]}})),this.getStorage=e=>n(this,void 0,void 0,(function*(){const t=new ro(this.getAppId());return yield t.getDataFromStorage(e.keys)})),this.getStorageInfo=e=>n(this,void 0,void 0,(function*(){const e=new ro(this.getAppId());return yield e.getStorageInfo()})),this.removeStorage=e=>n(this,void 0,void 0,(function*(){const t=new ro(this.getAppId());return yield t.removeDataFromStorage(e.keys)})),this.clearStorage=e=>n(this,void 0,void 0,(function*(){const e=new ro(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 i={networkType:t};return Promise.resolve(i)},this.onNetworkStatusChange=t=>{const i=navigator.connection||navigator.mozConnection||navigator.webkitConnection,n=i.effectiveType;return i.addEventListener("change",(function(){let i;switch(n){case"none":i=e.NetworkType.none;break;case"4g":i=e.NetworkType.wifi;break;case"3g":case"2g":i=e.NetworkType.cellular;break;default:i=e.NetworkType.unknown}t({isConnected:!0,networkType:i})})),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),Promise.resolve()),this.getRouteParams=vo.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(),this.openAppStore=e=>Promise.resolve()}getContext(){return null}on(e,t,i){throw new Error("Method not implemented.")}once(e,t,i){throw new Error("Method not implemented.")}off(e,t,i,n){throw new Error("Method not implemented.")}removeAllListeners(e){throw new Error("Method not implemented.")}openMediaPicker(e,t,i,n,o,r){return console.warn("This api only works on zalo app"),Promise.resolve({data:""})}}Zn=new WeakMap,qn=new WeakMap,Qn=new WeakMap,Yn=new WeakMap,Xn=new WeakMap,eo=new WeakMap;const mo=Symbol("required"),yo=Symbol("checkType"),_o=(e,t)=>(i,n,o)=>{let r=Reflect.getOwnMetadata(mo,i,n)||[];r.push({parameterIndex:o,fields:e,option:t}),Reflect.defineMetadata(mo,r,i,n)},So=(e,t,i)=>(n,o,r)=>{let a=Reflect.getOwnMetadata(yo,n,o)||[];a.push({parameterIndex:r,type:e,properties:t,defaultValue:i}),Reflect.defineMetadata(yo,a,n,o)};function Eo(e,t){Reflect.getMetadataKeys(e).map((i=>{const n=Reflect.getMetadata(i,e);Reflect.defineMetadata(i,n,t)}))}const Oo=(e,t={})=>i=>{var n;let o=Object.getOwnPropertyDescriptors(i.prototype);if(t.deep){let e=Object.getPrototypeOf(i);for(;e.prototype;){const t=Object.getOwnPropertyDescriptors(e.prototype);o=Object.assign(Object.assign({},t),o),e=Object.getPrototypeOf(e)}}for(const[r,a]of Object.entries(o)){const o="function"==typeof a.value&&"constructor"!=r;if(null===(n=t.exclude)||void 0===n?void 0:n.includes(r))continue;if(t.excludePrefix&&r.startsWith(t.excludePrefix))continue;if(!o)continue;const s=a.value;e(i,r,a),s!=a.value&&Eo(s,a.value),Object.defineProperty(i.prototype,r,a)}},Ao=(e,t,i)=>{const n=i.value,o=function(e){return e.toString().match(/\(.*?\)/)[0].replace(/[()]/gi,"").replace(/\s/gi,"").split(",")}(n);return i.value=function(...i){try{const r=Reflect.getOwnMetadata(mo,e.prototype,t),a=Reflect.getOwnMetadata(yo,e.prototype,t);a&&a.forEach((e=>{const{parameterIndex:t,type:n,properties:r,defaultValue:a}=e;let s=i[t],c=o[t];const l=typeof s;if(!Jt.isUndefined(s)){if(!Hi(s,n))throw Bi.wrongTypeParam(c,n,Array.isArray(s)?"array":null===s?"null":l);"object"===n&&Object.entries(r).forEach((([e,n])=>{const o=e.split("?")[0],r=Jt.get(s,o);if(Jt.isUndefined(r)||Jt.isNull(r)){if(!e.includes("?"))throw Bi.missingParam(e);Jt.get(s,o.split(".")[0])||!a||Jt.isUndefined(Jt.get(a,o))||Jt.set(i[t],o,Jt.get(a,o))}else if(Jt.isFunction(n)){const e=n(r);if(e&&e.error)throw Bi.wrongTypeParam(`${c}.${o}`,e.errorMessage,typeof r)}}))}})),r&&r.forEach((e=>{const{parameterIndex:t,option:n,fields:o}=e,r=i[t],a=null==n?void 0:n.if,s=null==n?void 0:n.defaultValue;let c=!0;a&&(c=Object.keys(a).every((e=>Jt.get(r,e)===a[e]))),c&&o.forEach((e=>{const n=e=>{let n=!1;return Jt.isEmpty(Jt.get(r,e))&&(Jt.isUndefined(Jt.get(s,e))||Jt.set(i[t],e,Jt.get(s,e)),n=!0),n};if(Array.isArray(e)&&e.length>0&&e.every(n))throw Bi.missingParam(e.join(" or "));if(Jt.isString(e)&&n(e))throw Bi.missingParam(e)}))}));const s=n.call(this,...i);if(Jt.isPromise(s)){const{success:e,fail:n}=Array.isArray(i)&&i.length>0&&i[0];return new Promise(((i,o)=>{s.then((t=>{!Jt.isNull(e)&&Jt.isFunction(e)?e.call(null,t,this):i(s)})).catch((e=>{const i=Ri(e,t);!Jt.isNull(n)&&Jt.isFunction(n)?n.call(null,i,this):o(i)}))}))}return s}catch(e){throw Ri(e,t)}},i};var To,bo,wo,No,Co;e.SDKCreator=class{constructor(){this.events=on.getInstance(),To.set(this,void 0),r(this,To,this.getServiceInstance(),"f"),this.events.addListener=(t,i,n)=>{const o=t;return this.events.addListener(e.Events[o],i,n)}}login(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").login(e)}))}getLoginStatus(){return o(this,To,"f").getLoginStatus()}getAccessToken(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getAccessToken(e)}))}getVersion(){return o(this,To,"f").getVersion()}getSystemInfo(){return o(this,To,"f").getSystemInfo()}setNavigationBarTitle(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").setNavigationBarTitle(e)}))}setNavigationBarColor(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").setNavigationBarColor(e)}))}setBackgroundColor(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").setBackgroundColor(e)}))}setNavigationBarLeftButton(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").setNavigationBarLeftButton(e.type)}))}setDeviceOrientation(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").setDeviceOrientation(e)}))}setStorage(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").setStorage(e)}))}getStorage(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getStorage(e)}))}getStorageInfo(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getStorageInfo(e)}))}removeStorage(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").removeStorage(e)}))}clearStorage(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").clearStorage(e)}))}getUserInfo(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getUserInfo(e)}))}getNetworkType(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getNetworkType(e)}))}onNetworkStatusChange(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").onNetworkStatusChange(e)}))}startBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").startBeaconDiscovery(e)}))}stopBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").stopBeaconDiscovery(e)}))}getBeacons(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getBeacons(e)}))}closeApp(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").closeApp(e)}))}getLocation(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getLocation(e)}))}stopBluetoothDevicesDiscovery(){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").stopBluetoothDevicesDiscovery()}))}startBluetoothDevicesDiscovery(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").startBluetoothDevicesDiscovery(e)}))}openBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").openBluetoothAdapter()}))}onBluetoothDeviceFound(){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").onBluetoothDeviceFound()}))}onBluetoothAdapterStateChange(){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").onBluetoothAdapterStateChange()}))}getConnectedBluetoothDevices(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getConnectedBluetoothDevices(e)}))}getBluetoothDevices(){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getBluetoothDevices()}))}getBluetoothAdapterState(){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getBluetoothAdapterState()}))}closeBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").closeBluetoothAdapter()}))}scanQRCode(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").scanQRCode(e)}))}openProfile(e){return n(this,void 0,void 0,(function*(){yield o(this,To,"f").openProfile(e)}))}openChat(e){return n(this,void 0,void 0,(function*(){yield o(this,To,"f").openChat(e)}))}openPostFeed(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").openPostFeed(e)}))}followOA(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").followOA(e)}))}unfollowOA(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").unFollowOA(e)}))}openShareSheet(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").openShareSheet(e)}))}requestCameraPermission(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").requestCameraPermission(e)}))}createShortcut(e){return n(this,void 0,void 0,(function*(){const t=yield tn(Zt,0),i=Ji().isIOS,n=t.logoUrl||Fi("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"),i){a.append("appId",Zt),a.append("appName",r),a.append("appIcon",n);const e=`https://mini.zalo.me/shortcut.html?${a.toString()}`;yield o(this,To,"f").openOutApp(encodeURI(e))}else yield o(this,To,"f").createShortcut(`https://zalo.me/app/link/zapps/${Zt}/?${a.toString()}`,r,n);return Di()}))}openBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").openBioAuthentication(e)}))}checkStateBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").checkStateBioAuthentication(e)}))}sendLocation(e){return n(this,void 0,void 0,(function*(){yield o(this,To,"f").sendLocation(e)}))}showToast(e){return n(this,void 0,void 0,(function*(){yield o(this,To,"f").showToast(e)}))}hideKeyboard(e){return n(this,void 0,void 0,(function*(){yield o(this,To,"f").hideKeyboard(e)}))}openPhone(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").openPhone(e)}))}openSMS(e){return n(this,void 0,void 0,(function*(){yield o(this,To,"f").openSMS(e)}))}viewOAQr(e){return n(this,void 0,void 0,(function*(){yield o(this,To,"f").viewOAQr(e)}))}keepScreen(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").keepScreen(e)}))}saveImageToGallery(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").saveImageToPhotosAlbum(e)}))}saveImageToPhotosAlbum(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").saveImageToPhotosAlbum(e)}))}openMiniApp(e){return n(this,void 0,void 0,(function*(){if(!Jt.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,To,"f").openMiniApp(e)}))}vibrate(e){return n(this,void 0,void 0,(function*(){console.log(e),yield o(this,To,"f").vibrate(e)}))}openWebview(e){return n(this,void 0,void 0,(function*(){const t=new URL(e.url),i=t.searchParams.get("typeInapp");Jt.isEmpty(i)&&t.searchParams.set("typeInapp","1"),yield o(this,To,"f").openWebview(t.href)}))}getRouteParams(){return o(this,To,"f").getRouteParams()}getAppInfo(e){return o(this,To,"f").getAppInfo()}sendDataToPreviousMiniApp(e){return o(this,To,"f").sendDataToPreviousMiniApp(e)}onCallbackData(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").onCallbackData(e)}))}getPhoneNumber(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").getPhoneNumber()}))}openProfilePicker(e){return n(this,void 0,void 0,(function*(){const t=yield o(this,To,"f").openProfilePicker(e.maxProfile);let i;if(t.length>0)try{const e=yield this.getAccessToken(),n=yield fetch(ai,{method:"POST",headers:{"Content-Type":"application/json",access_token:e||""},body:JSON.stringify({fields:"id,name,picture",user_ids:t})}),o=yield n.json();if(0!==o.error||!o.data)throw new Error(o.message);i=t.map((e=>{var t,i,n,r,a,s,c,l,d,u,h;return{id:(null===(i=null===(t=o.data[e])||void 0===t?void 0:t.user_info)||void 0===i?void 0:i.user_id_by_app)||"",profile:{name:null===(r=null===(n=o.data[e])||void 0===n?void 0:n.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===(d=o.data[e])||void 0===d?void 0:d.error)?-1:0,message:`Get profile: ${Jt.isUndefined(null===(u=o.data[e])||void 0===u?void 0:u.message)?"Unknown error":null===(h=o.data[e])||void 0===h?void 0:h.message}`}}))}catch(e){i=t.map((t=>({id:t,profile:{name:"",avatar:""},code:-1,message:`Can't get profile: ${e.message}`})))}return{users:i||[]}}))}connectWifi(e){return n(this,void 0,void 0,(function*(){return yield o(this,To,"f").connectWifi(e)}))}openMediaPicker(e){var t,i,r;return n(this,void 0,void 0,(function*(){const n={};Jt.isUndefined(null===(t=e.editView)||void 0===t?void 0:t.enable)||(null===(i=e.editView)||void 0===i?void 0:i.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 o(this,To,"f").openMediaPicker(e.type,e.serverUploadUrl,e.maxItemSize,n,a,s)}))}getShareableLink(e){return n(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();return(yield Xi(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 o(this,To,"f").closeLoading("user action")}))}requestUpdateZalo(e){return n(this,void 0,void 0,(function*(){const e=Ji().isIOS?"https://apps.apple.com/vn/app/zalo/id579523206":"https://play.google.com/store/apps/details?id=com.zing.zalo";return yield o(this,To,"f").openOutApp(e)}))}onConfirmToExit(t){this.events.on(e.Events.AppClose,t,'{"handle_h5": 1}'),o(this,To,"f").setNavigationBarLeftButton(void 0,2)}offConfirmToExit(){this.events.off(e.Events.AppClose),o(this,To,"f").setNavigationBarLeftButton(void 0,0)}getDeviceId(){return o(this,To,"f").getDeviceId()}getContext(){return o(this,To,"f").getContext()}},To=new WeakMap,t([i(0,So("object",{title:en("string")}))],e.SDKCreator.prototype,"setNavigationBarTitle",null),t([i(0,So("object",{color:en("string"),"textColor?":en("string",{values:["white","black"]}),"statusBarColor?":en("string")}))],e.SDKCreator.prototype,"setNavigationBarColor",null),t([i(0,So("object",{backgroundColor:en("string"),"textColor?":en("string",{values:["white","black"]})}))],e.SDKCreator.prototype,"setBackgroundColor",null),t([i(0,So("object",{type:en("string",{values:["none","back","home","both"]})}))],e.SDKCreator.prototype,"setNavigationBarLeftButton",null),t([i(0,So("object",{rotate:en("string",{values:["auto","portrait","landscape"]})}))],e.SDKCreator.prototype,"setDeviceOrientation",null),t([i(0,So("object",{data:en("object")}))],e.SDKCreator.prototype,"setStorage",null),t([i(0,So("object",{keys:en("array<string>")}))],e.SDKCreator.prototype,"getStorage",null),t([i(0,So("object",{keys:en("array<string>")}))],e.SDKCreator.prototype,"removeStorage",null),t([i(0,So("object",{"avatarType?":en("string",{values:["small","normal","large"]})}))],e.SDKCreator.prototype,"getUserInfo",null),t([i(0,So("object",{type:en("string",{values:["user","oa","aliasOA"]}),id:en("string")}))],e.SDKCreator.prototype,"openProfile",null),t([i(0,So("object",{type:en("string",{values:["user","oa"]}),id:en("string"),"message?":en("string")}))],e.SDKCreator.prototype,"openChat",null),t([i(0,_o(["data.imageUrl"],{if:{type:"image"}})),i(0,_o(["data.link"],{if:{type:"link"}})),i(0,_o(["data.id"],{if:{type:"profile"}})),i(0,So("object",{type:en("string",{values:["image","link","profile"]}),data:en("object"),"data.imageUrl?":en("url"),"data.link?":en("url"),"data.title?":en("string"),"data.thumb?":en("url"),"data.description?":en("string"),"data.avatar?":en("url"),"data.id?":en("string"),"data.displayName?":en("string")}))],e.SDKCreator.prototype,"openPostFeed",null),t([i(0,So("object",{id:en("string"),"showDialogConfirm?":en("boolean")}))],e.SDKCreator.prototype,"followOA",null),t([i(0,So("object",{id:en("string")}))],e.SDKCreator.prototype,"unfollowOA",null),t([i(0,_o([["data.imageUrl","data.imageUrls"]],{if:{type:"image"}})),i(0,_o(["data.link"],{if:{type:"link"}})),i(0,_o(["data.id"],{if:{type:"oa"}})),i(0,_o(["data.gifUrl"],{if:{type:"gif"}})),i(0,_o(["data.videoThumb","data.videoUrl"],{if:{type:"video"}})),i(0,_o(["data.thumbnail","data.title","data.description"],{if:{type:"zmp"},defaultValue:{data:{description:""}}})),i(0,So("object",{type:en("string",{values:["image","gif","video","link","oa","zmp"]}),data:en("object"),"data.imageUrl?":en("url"),"data.imageUrls?":en("array<url>",{maxLength:10}),"data.caption?":en("string"),"data.gifUrl?":en("url"),"data.width?":en("number"),"data.height?":en("number"),"data.videoThumb?":en("url"),"data.videoUrl?":en("url"),"data.link?":en("url"),"data.chatOnly?":en("boolean"),"data.id?":en("string"),"data.thumbnail?":en("url"),"data.path?":en("string"),"data.title?":en("string",{maxLength:100}),"data.description?":en(["string"],{maxLength:400})}))],e.SDKCreator.prototype,"openShareSheet",null),t([i(0,So("object",{secretData:en("string"),"ui?":en("object"),"ui.title?":en("string"),"ui.subTitle?":en("string"),"ui.negativeButtonText?":en("string"),"requireFingerprint?":en("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"}}))],e.SDKCreator.prototype,"openBioAuthentication",null),t([i(0,So("object",{toUserId:en("string"),"title?":en("string")}))],e.SDKCreator.prototype,"sendLocation",null),t([i(0,So("object",{message:en("string")}))],e.SDKCreator.prototype,"showToast",null),t([i(0,So("object",{phoneNumber:en("string")}))],e.SDKCreator.prototype,"openPhone",null),t([i(0,So("object",{content:en("string"),phoneNumber:en("string",{regex:/^\+?\d+$/})}))],e.SDKCreator.prototype,"openSMS",null),t([i(0,So("object",{id:en("string"),"displayName?":en("string")},{displayName:""}))],e.SDKCreator.prototype,"viewOAQr",null),t([i(0,So("object",{"imageBase64Data?":en("string"),"imageUrl?":en("url")}))],e.SDKCreator.prototype,"saveImageToGallery",null),t([i(0,So("object",{"imageBase64Data?":en("string"),"imageUrl?":en("url")}))],e.SDKCreator.prototype,"saveImageToPhotosAlbum",null),t([i(0,So("object",{appId:en("string"),"params?":en("object")}))],e.SDKCreator.prototype,"openMiniApp",null),t([i(0,So("object",{"type?":en("string",{values:["oneShot"]}),"milliseconds?":en("number")},{type:"oneShot",milliseconds:500}))],e.SDKCreator.prototype,"vibrate",null),t([i(0,So("object",{url:en("url")}))],e.SDKCreator.prototype,"openWebview",null),t([i(0,So("object",{"maxProfile?":en("number",{min:1,max:10})},{maxProfile:1}))],e.SDKCreator.prototype,"openProfilePicker",null),t([i(0,_o(["SSID"])),i(0,So("object",{SSID:en("string"),"password?":en("string"),"hiddenSSID?":en("boolean")}))],e.SDKCreator.prototype,"connectWifi",null),t([i(0,So("object",{type:en("string",{values:["photo","video","file"]}),serverUploadUrl:en("url"),"maxItemSize?":en("number",{min:0}),"editView?":en("object"),"editView.enable?":en("boolean"),"editView.aspectRatio?":en("string",{regex:/^\d+:\d+$/}),"silentRequest?":en("boolean"),"maxSelectItem?":en("number",{min:1})}))],e.SDKCreator.prototype,"openMediaPicker",null),t([i(0,So("object",{title:en("string",{maxLength:100}),"thumbnail?":en("url"),"path?":en("string"),description:en(["string"],{maxLength:400})},{description:""}))],e.SDKCreator.prototype,"getShareableLink",null),e.SDKCreator=t([Oo(Ao)],e.SDKCreator);class Io extends e.SDKCreator{getServiceInstance(){return fo.getInstance()}}class Po extends e.SDKCreator{getServiceInstance(){return new go}}class ko{constructor(){bo.set(this,Zt)}static getInstance(){return ko.instance||(ko.instance=new ko),ko.instance}createOrder(e,t){return n(this,void 0,void 0,(function*(){const i=o(this,bo,"f"),n=new URLSearchParams;n.append("amount",t.amount.toString()),n.append("item",encodeURIComponent(JSON.stringify(t.item))),n.append("appId",i),t.desc&&n.append("desc",encodeURIComponent(t.desc)),t.extradata&&n.append("extradata",encodeURIComponent(JSON.stringify(t.extradata))),t.method&&n.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 Bi.loginRequired}});r.headers.authorization=`Bearer ${o}`;const a=yield fetch(Ii,Object.assign(Object.assign({method:"POST"},r),{body:n})),s=yield a.json();if(!s.data||0!==s.err)throw Bi.badRequest(s.msg);const c=s.data.id,l=s.data.jwt,d=window.APP_VERSION,u=window.APP_ENV,h={miniAppId:i,orderId:c};l&&(h.token=l),d&&(h.version=d),u&&(h.env=u),t.method&&(h.method=t.method);const p=ji.encode(h),v=new URL(`?${p}`,"https://payment-mini.zalo.me").toString();return yield e.openWebview({url:v,fail:e=>{throw e}}),{orderId:c}}catch(e){throw e}}))}checkTransaction(e,t){return n(this,void 0,void 0,(function*(){try{let i,{data:n}=t;if(n||(n=e.getRouteParams()),"object"==typeof n&&(i=n.appTransID||n.orderId||n.apptransid),"string"==typeof n){const e=ji.getParameterByName("orderId",n),t=ji.getParameterByName("appTransID",n)||ji.getParameterByName("apptransid",n);i=e||t}const r={headers:{authorization:"Bearer "}},a=yield e.getAccessToken({fail:e=>{throw Bi.loginRequired}});r.headers.authorization=`Bearer ${a}`;const s=new URL(Pi),c={transId:i||"",appId:o(this,bo,"f")};s.search=new URLSearchParams(c).toString();const l=yield fetch(s.toString(),r),d=yield l.json();if(!d.data||0!==d.err)throw Bi.badRequest(d.msg);const u=d.data||{};return{msg:u.resultMessage,orderId:u.orderId,resultCode:u.resultCode,transTime:u.transTime,createdAt:u.createAt,transId:u.transId}}catch(e){throw e}}))}}bo=new WeakMap;class Ro{constructor(){wo.set(this,Vt)}static getInstance(){return Ro.instance||(Ro.instance=new Ro),Ro.instance}createOrder(e,t){return Promise.resolve({orderId:""})}checkTransaction(e,t){const i={msg:"Success",orderId:"",resultCode:1,transTime:(new Date).getTime().toString(),createdAt:(new Date).getTime().toString(),transId:""};return Promise.resolve(i)}}wo=new WeakMap;let Do=class{constructor(e){No.set(this,void 0),Co.set(this,void 0),r(this,No,this.getInstance(),"f"),r(this,Co,e,"f")}createOrder(e){return o(this,No,"f").createOrder(o(this,Co,"f"),e)}checkTransaction(e){return o(this,No,"f").checkTransaction(o(this,Co,"f"),e)}};No=new WeakMap,Co=new WeakMap,t([i(0,So("object",{amount:en(["string","number"]),desc:en("string"),"method?":en("string",{values:["MOMO","ZALOPAY","MOMO_SANDBOX","ZALOPAY_SANDBOX","CC","CC_SANDBOX","ATM","ATM_SANDBOX"]})}))],Do.prototype,"createOrder",null),Do=t([Oo(Ao)],Do);class Bo extends Do{getInstance(){return ko.getInstance()}}class jo extends Do{getInstance(){return Ro.getInstance()}}const Uo=Ji();e.default=void 0,window.onJSCall=e=>function(t){io.getInstance().onJSCall(e,t)},window.onMultiJSCall=e=>function(t){io.getInstance().onMultiJSCall(e,t)},window.zaloJSV2={zalo_h5_event_handler:function(e,t,i){io.getInstance().nativeEventHandler(e,t,i)}},e.Payment=void 0,Uo.isZalo?(e.default=new Io,e.Payment=new Bo(e.default)):(e.default=new Po,e.Payment=new jo(e.default)),window.ZaloMiniAppSDK=e.default,e.default=e.default,Object.defineProperty(e,"__esModule",{value:!0})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmp-sdk",
3
- "version": "2.22.1",
3
+ "version": "2.22.2",
4
4
  "description": "Zalo Mini App SDK",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",