zmp-sdk 2.23.1 → 2.23.2-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +377 -6
- package/dist/browser.min.js +6 -2
- package/dist/index.es.js +6 -2
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/types/src/types/enum.d.ts +4 -0
- package/package.json +1 -1
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,o){var n,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(r<3?n(a):r>3?n(t,i,a):n(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a}function t(e,t){return function(i,o){t(i,o,e)}}function i(e,t,i,o){return new(i||(i=Promise))((function(n,r){function a(e){try{c(o.next(e))}catch(e){r(e)}}function s(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}c((o=o.apply(e,t||[])).next())}))}function o(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)}function n(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.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 o=!0}catch(e){}var n=y.call(e);return o&&(t?e[_]=i:delete e[_]),n},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 C,w=function(e){if(!b(e))return!1;var t=T(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},N=v["__core-js_shared__"],I=(C=/[^.]+$/.exec(N&&N.keys&&N.keys.IE_PROTO||""))?"Symbol(src)_1."+C:"";var P=function(e){return!!I&&I in e},k=Function.prototype.toString;var D=function(e){if(null!=e){try{return k.call(e)}catch(e){}try{return e+""}catch(e){}}return""},R=/^\[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))&&(w(e)?M:R).test(D(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"),H=z(v,"Set"),G=z(v,"WeakMap"),$=D(J),V=D(F),Z=D(K),q=D(H),Y=D(G),Q=T;(J&&"[object DataView]"!=Q(new J(new ArrayBuffer(1)))||F&&"[object Map]"!=Q(new F)||K&&"[object Promise]"!=Q(K.resolve())||H&&"[object Set]"!=Q(new H)||G&&"[object WeakMap]"!=Q(new G))&&(Q=function(e){var t=T(e),i="[object Object]"==t?e.constructor:void 0,o=i?D(i):"";if(o)switch(o){case $:return"[object DataView]";case V:return"[object Map]";case Z:return"[object Promise]";case q:return"[object Set]";case Y:return"[object WeakMap]"}return t});var X=Q;var ee=function(e){return null!=e&&"object"==typeof e};var te=function(e){return ee(e)&&"[object Arguments]"==T(e)},ie=Object.prototype,oe=ie.hasOwnProperty,ne=ie.propertyIsEnumerable,re=te(function(){return arguments}())?te:function(e){return ee(e)&&oe.call(e,"callee")&&!ne.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)&&!w(e)};var le=function(){return!1},de=u((function(e,t){var i=t&&!t.nodeType&&t,o=i&&e&&!e.nodeType&&e,n=o&&o.exports===i?v.Buffer:void 0,r=(n?n.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,o=i&&e&&!e.nodeType&&e,n=o&&o.exports===i&&p.process,r=function(){try{var e=o&&o.require&&o.require("util").types;return e||n&&n.binding&&n.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 Ce=function(e){return"symbol"==typeof e||ee(e)&&"[object Symbol]"==T(e)},we=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ne=/^\w*$/;var Ie=function(e,t){if(ae(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!Ce(e))||(Ne.test(e)||!we.test(e)||null!=t&&e in Object(t))},Pe=z(Object,"create");var ke=function(){this.__data__=Pe?Pe(null):{},this.size=0};var De=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Re=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 Re.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 o=e[t];this.set(o[0],o[1])}}Me.prototype.clear=ke,Me.prototype.delete=De,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 He=function(e){var t=this.__data__,i=Je(t,e);return i<0?void 0:t[i][1]};var Ge=function(e){return Je(this.__data__,e)>-1};var $e=function(e,t){var i=this.__data__,o=Je(i,e);return o<0?(++this.size,i.push([e,t])):i[o][1]=t,this};function Ve(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var o=e[t];this.set(o[0],o[1])}}Ve.prototype.clear=We,Ve.prototype.delete=Ke,Ve.prototype.get=He,Ve.prototype.has=Ge,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 Ye=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Qe=function(e,t){var i=e.__data__;return Ye(t)?i["string"==typeof t?"string":"hash"]:i.map};var Xe=function(e){var t=Qe(this,e).delete(e);return this.size-=t?1:0,t};var et=function(e){return Qe(this,e).get(e)};var tt=function(e){return Qe(this,e).has(e)};var it=function(e,t){var i=Qe(this,e),o=i.size;return i.set(e,t),this.size+=i.size==o?0:1,this};function ot(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var o=e[t];this.set(o[0],o[1])}}ot.prototype.clear=qe,ot.prototype.delete=Xe,ot.prototype.get=et,ot.prototype.has=tt,ot.prototype.set=it;var nt=ot;function rt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var i=function(){var o=arguments,n=t?t.apply(this,o):o[0],r=i.cache;if(r.has(n))return r.get(n);var a=e.apply(this,o);return i.cache=r.set(n,a)||r,a};return i.cache=new(rt.Cache||nt),i}rt.Cache=nt;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,o,n){t.push(o?n.replace(ct,"$1"):i||e)})),t}));var dt=function(e,t){for(var i=-1,o=null==e?0:e.length,n=Array(o);++i<o;)n[i]=t(e[i],i,e);return n},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(Ce(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||Ce(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var mt=function(e,t){for(var i=0,o=(t=ft(t,e)).length;null!=e&&i<o;)e=e[gt(t[i++])];return i&&i==o?e:void 0};var yt=function(e,t,i){var o=null==e?void 0:mt(e,t);return void 0===o?i:o},_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 o=e[t];Et.call(e,t)&&ze(o,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,o){if(!b(e))return e;for(var n=-1,r=(t=ft(t,e)).length,a=r-1,s=e;null!=s&&++n<r;){var c=gt(t[n]),l=i;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(n!=a){var d=s[c];void 0===(l=o?o(d,c,s):void 0)&&(l=b(d)?d:Tt(t[n+1])?[]:{})}Ot(s,c,l),s=s[c]}return e};var Ct,wt,Nt,It,Pt,kt,Dt,Rt,Bt,jt,xt={isEmpty:ye,isNull:Se,isUndefined:_e,isFunction:w,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,(Ct=exports.NetworkType||(exports.NetworkType={})).none="none",Ct.wifi="wifi",Ct.cellular="cellular",Ct.unknown="unknown",exports.PlatformType=void 0,(wt=exports.PlatformType||(exports.PlatformType={})).wp="wp",wt.android="android",wt.iOS="iOS",wt.unknown="unknown",exports.ProfileType=void 0,(Nt=exports.ProfileType||(exports.ProfileType={}))[Nt.user=1]="user",Nt[Nt.oa=0]="oa",Nt[Nt.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,(Dt=exports.OrientationType||(exports.OrientationType={}))[Dt.auto=1]="auto",Dt[Dt.portrait=2]="portrait",Dt[Dt.landscape=3]="landscape",exports.VibrateType=void 0,(Rt=exports.VibrateType||(exports.VibrateType={}))[Rt.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 n=t.split("; ");if(n&&n.length>0)for(var i=e.length+1,o=n.length-1;o>=0;o--){let t=n[o];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={ZOAUTH:"h5.zdn.vn_zoauth",ZACC_SESSiON:"h5.zdn.vn_zacc_session",JS_TOKEN:"h5.zdn.vn_zlink3rd",ZOAUTH_VRF:"h5.zdn.vn_zoauth_vrf",DEVICE_ID:"h5.zdn.vn_deviceID",CONTEXT_ID:"h5.zdn.vn_contextID",CONTEXT_TYPE:"h5.zdn.vn_contextType"},Ht="https://graph.zalo.me/v2.0/me",Gt="https://h5.zalo.me/openapi/access_token",$t="https://oauth.zaloapp.com/v3/access_token",Vt="https://graph.zalo.me/v2.0/me/friends/list",Zt="https://h5.zalo.me/apps/get-info",qt="https://h5.zalo.me/log/async",Yt=e=>({NONE:e?-2:0,WIFI:e?0:1,"2G":2,"3G":e?15:2,"4G":e?13:2}),Qt=0,Xt=-2e3,ei=-1400,ti=-1500,ii=-1401,oi=-2004,ni=-2005,ri={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"},ai={SUCCESS:{code:Qt,message:ri.SUCCESS},UNKNOWN_ERROR:{code:Xt,message:ri.UNKNOWN_ERROR},UNAUTHORIZED:{code:ii,message:ri.LOGIN_REQUIRED},FORBIDDEN:{code:-1403,message:ri.NOT_PERMISSION},CLIENT_NOT_SUPPORT:{code:-1404,message:ri.CLIENT_NOT_SUPPORT},DECODE_FAILED:{code:-2001,message:ri.DECODE_FAILED},TIME_OUT:{code:-1408,message:ri.TIME_OUT},USER_DENIED:{code:-2002,message:ri.USER_DENIED},USER_CANCEL:{code:-2003,message:ri.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:ai.USER_DENIED}},iOS:{"-2":{map_to:ai.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:ai.USER_DENIED}},iOS:{"-1":{map_to:ai.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:ni,message:ri.SAVE_IMAGE_FAIL},need_more_detail:!0},"-102":{map_to:{code:ni,message:ri.SAVE_IMAGE_FAIL},need_more_detail:!0}},iOS:{"-10":{map_to:{code:ni,message:ri.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:ai.USER_DENIED},"-101":{map_to:ai.USER_DENIED}},iOS:{"-1":{map_to:ai.USER_DENIED},"-10":{map_to:ai.USER_DENIED}}}},MP_OPEN_PROFILE_PICKER:{name:"action.mp.open.profile.picker",version_live:{iOS:432},error_list:{android:{"-101":{map_to:ai.USER_CANCEL}},iOS:{"-101":{map_to:ai.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:ai.USER_CANCEL},999:{map_to:{code:oi,message:ri.MEDIA_PICKER_FAIL},need_more_detail:!0}},iOS:{"-10":{map_to:{code:oi,message:ri.MEDIA_PICKER_FAIL}}}}},MP_CLOSE_LOADINGVIEW:{name:"action.mp.close.loadingview"}},ci={android:{"-4":ai.DECODE_FAILED,"-5":ai.CLIENT_NOT_SUPPORT,"-14":ai.TIME_OUT},iOS:{"-9":ai.DECODE_FAILED,"-5":ai.CLIENT_NOT_SUPPORT,"-14":ai.TIME_OUT}},li={android:12100571,iOS:400,wp:0,unknown:0},di={android:12100615,iOS:460,wp:0,unknown:0},ui=[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],pi=0,hi=3,vi=1,fi=0,gi="https://payment-mini.zalo.me/api/order/create",mi="https://payment-mini.zalo.me/api/transaction";class yi{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 _i=(e,t)=>e instanceof yi?((e,t)=>(e.api=t,e.toJSON()))(e,t):((e,t)=>e instanceof Error?new yi(Xt,e.message,t).toJSON():new yi(Xt,ri.UNKNOWN_ERROR,t).toJSON())(e,t),Si=(e,t)=>({code:Qt,message:t||ri.SUCCESS,data:e||{}}),Ei={badRequest:e=>new yi(ei,e),loginFailed:e=>new yi(ii,`${ri.LOGIN_FAILED}: ${e}`),loginRequired:()=>new yi(ii,ri.LOGIN_REQUIRED),missingParam:e=>new yi(ei,`Missing required argument: ${e}`),wrongTypeParam:(e,t,i)=>new yi(ei,`Wrong type of parameter '${e}'. Expected ${t}, but got ${i}`),cannotGetShareInfo:()=>new yi(ti,"Can not get app info to share"),lengthInvalid:e=>new yi(ei,`${e} length is invalid.`)};const Oi={encode:function(e){var t=[];for(var i in e)if(e.hasOwnProperty(i)){var o=e[i];if(void 0===o)return;if(null===o)return void t.push(i);t.push(encodeURIComponent(i)+"="+encodeURIComponent(o))}return t.join("&")},decode:function(e,t){var i={};if(""===e)return i;for(var o=e.split("&"),n=0;n<o.length;n++){var r=o[n].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:Oi.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 o=e[t],n=[t,o="object"==(void 0===o?"undefined":typeof o)?JSON.stringify(o):encodeURIComponent(o)].join("=");i.push(n)})),i.join("&")}},Ai=new RegExp("[\\u0300-\\u036f]","g"),Ti=new RegExp("[đ|Đ]","g"),bi=new RegExp("\\s","g"),Ci=Ut("zmp:utils:common"),wi=e=>{try{new URL(e)}catch(e){return!1}return!0},Ni=()=>navigator.userAgent||navigator.vendor||window.opera,Ii=()=>{const e=Ni().toLowerCase();return{isWP:/iemobile/.test(e),isAndroid:/android/i.test(e)&&!/iemobile/.test(e),isIOS:/iphone|ios|ipad|ipod/.test(e)&&!/iemobile/.test(e),isMobile:/android|iphone|ios|ipad|ipod|iemobile/.test(e),isZalo:/zalo/.test(e)}},Pi=e=>{const t=document.getElementsByTagName("meta");for(let 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=Ni().toLowerCase().split("zalo")[1];if(e){return e.replace(" ","").split("/")[1]||""}return""},Di=()=>{let e=Ii();return e.isWP?exports.PlatformType.wp:e.isAndroid?exports.PlatformType.android:e.isIOS?exports.PlatformType.iOS:exports.PlatformType.unknown},Ri=(e,t)=>{const i=t.toLowerCase(),o=i.split(/[<>]/i),n="array"===o[0];return!!("url"===i&&wi(e)||n&&("array"===i&&Array.isArray(e)||((e,t)=>Array.isArray(t)&&!t.some((t=>"url"===e?!wi(t):typeof t!==e)))(o[1],e))||!Array.isArray(e)&&typeof e===t)},Bi=e=>(e=>{let t=Lt(e);return t||(t=Wt(e),t)?t:Mt(e)})(e),ji=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)()},xi=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,o=0;o<i;o++)t.push(xi(e[o]));return"["+t.join(",")+"]"}if("object"==typeof e){for(var n in t=new Array,e)t.push('"'+n+'":'+xi(e[n]));return"{"+t.join(",")+"}"}return e.toString()},Ui=()=>{try{const e=Number(ki()),t=Di();return e>=li[t]}catch(e){return!0}},Mi=e=>JSON.stringify(e).replace(/"/g,'\\"').replace(/'/g,"'"),Li=e=>{try{if(e){Ci(e);const t=e.replace(/\\/g,"").replace(/'/g,"'");return Ci("formattedValue",t,JSON.parse(t),typeof JSON.parse(t)),JSON.parse(t)}return null}catch(t){return Ci("parse json error:",t),e}},Wi=(e,t,o,n,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",o),s.append("description",n||""),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 Ei.cannotGetShareInfo();return l.search=`${l.search}&zshareId=${u.data.shareId}`,Object.assign(Object.assign({},u.data),{shareableLink:l.href})})),zi=(e,t)=>i=>{if(!(Array.isArray(e)?e.some((e=>Ri(i,e))):Ri(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}},Ji=(e,t,o)=>i(void 0,void 0,void 0,(function*(){const i={appId:e,versionStatus:t};xt.isUndefined(o)||(i.currentVersion=o);const n=Oi.appendToUrl(Zt,i),r=yield fetch(n,{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 Fi=u((function(e){var t=Object.prototype.hasOwnProperty,i="~";function o(){}function n(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function r(e,t,o,r,a){if("function"!=typeof o)throw new TypeError("The listener must be a function");var s=new n(o,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 o:delete e._events[t]}function s(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(i=!1)),s.prototype.eventNames=function(){var e,o,n=[];if(0===this._eventsCount)return n;for(o in e=this._events)t.call(e,o)&&n.push(i?o.slice(1):o);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},s.prototype.listeners=function(e){var t=i?i+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var n=0,r=o.length,a=new Array(r);n<r;n++)a[n]=o[n].fn;return a},s.prototype.listenerCount=function(e){var t=i?i+e:e,o=this._events[t];return o?o.fn?1:o.length:0},s.prototype.emit=function(e,t,o,n,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,o),!0;case 4:return d.fn.call(d.context,t,o,n),!0;case 5:return d.fn.call(d.context,t,o,n,r),!0;case 6:return d.fn.call(d.context,t,o,n,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,o);break;case 4:d[l].fn.call(d[l].context,t,o,n);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,o,n){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||n&&!s.once||o&&s.context!==o||a(this,r);else{for(var c=0,l=[],d=s.length;c<d;c++)(s[c].fn!==t||n&&!s[c].once||o&&s[c].context!==o)&&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 o,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 Ki extends Fi{constructor(){super(),this.debug=Ut("zmp:event-emitter")}static getInstance(){return Ki.instance||(Ki.instance=new Ki),Ki.instance}h5ConfirmHandleEvent(e,t,i){ZaloJavaScriptInterface.jsH5EventCallback(e,t,i||"")}on(e,t,i){this.debug(`register ${e}: ${i}`);return super.on(e,((o,n)=>{this.h5ConfirmHandleEvent(o,e,i),t(n)}),i)}once(e,t,i){this.debug(`register once ${e}: ${i}`);return super.once(e,((o,n)=>{this.h5ConfirmHandleEvent(o,e,i),t(n)}),i)}}var Hi,Gi,$i,Vi,Zi;class qi{static getVersion(){return"2.23.1"}static getSystemInfo(){return{version:Pi("version-id")||"",apiVersion:"2.23.1",zaloVersion:ki(),platform:Di(),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 Ji(e,0,t.version)}))}}class Yi{static setNavigationBarTitle(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(si.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(si.CHANGE_ACTIONBAR,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarLeftButton(e,t){return i(this,void 0,void 0,(function*(){let i,o;xt.isString(e)&&(i="none"===e||"home"===e?hi:pi,o="home"===e||"both"===e?vi:fi),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(o)?o:e.homeConfig.enable})}))),yield this.getJSBridge().callNative(si.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(si.CHANGE_ACTIONBAR,{data:e},{haveTimeout:!1})}))}}class Qi{static setBackgroundColor(e){return i(this,void 0,void 0,(function*(){xt.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 Xi{constructor(e,t,i,o){this.title=o,this.severity=t;const n=new Date;if(this.time=n.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(" ")}}Hi=new WeakMap,Gi=new WeakMap,$i=new WeakMap,Vi=new WeakMap,Zi=new WeakMap;const eo=new class{constructor(){Hi.set(this,3),Gi.set(this,["none","error","warn","info"]),$i.set(this,"[zmp] > "),Vi.set(this,{error:0,warn:0,info:0,firstError:null,lastError:null}),Zi.set(this,((e,t,i)=>{o(this,Vi,"f")[o(this,Gi,"f")[e]]++;const r=o(this,Gi,"f")[e];if(n(this,$i,o(this,$i,"f")+("string"!=typeof t?new Xi(t,r,e,i).toString():t),"f"),!(e>o(this,Hi,"f")))switch(e){case 1:console.error(o(this,$i,"f"));break;case 2:console.warn(o(this,$i,"f"));break;case 3:console.info(o(this,$i,"f"));break;default:throw new Error("internal")}}))}setLogLevel(e){n(this,Hi,e,"f")}info(e){o(this,Zi,"f").call(this,3,e)}warn(e,t){o(this,Zi,"f").call(this,2,e,t)}error(e,t){o(this,Zi,"f").call(this,1,e,t)}getMetrics(){return o(this,Vi,"f")}};class to{static setDeviceOrientation(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(si.CHANGE_AUTOROTATE,{autoRotate:exports.OrientationType[e.rotate]})}))}static getNetworkType(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(si.WEBVIEW_NETWORKTYPE,{url:window.location.href,featureId:""}).then((e=>{const t=e.network;let i;const o=Ii().isAndroid;switch(t){case Yt(o).NONE:i=exports.NetworkType.none;break;case Yt(o).WIFI:i=exports.NetworkType.wifi;break;case Yt(o)["2G"]:case Yt(o)["3G"]:case Yt(o)["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 o={isConnected:"CONNECTED"===i,networkType:t&&t.networkType};e(o)})).catch((e=>{eo.error(e,"onNetworkStatusChange")}))}))}))}static startBeaconDiscovery(e){var t,o,n,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===(o=null==e?void 0:e.scanConfig)||void 0===o?void 0:o.timeBetweenScan)?e.scanConfig.timeBetweenScan:1e4,beacon_timeout:xt.isNumber(null===(n=null==e?void 0:e.scanConfig)||void 0===n?void 0:n.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(si.SCAN_IBEACON,Object.assign({},i)),!0}))}static stopBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(si.SCAN_IBEACON,Object.assign({},{subaction:2})),!0}))}static getBeacons(e){return i(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 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(si.OPEN_QR,{skipOpenLink:!0})}))}static showToast(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(si.SHOW_TOAST,{toast:e.message})}))}static hideKeyboard(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(si.HIDE_KEYBOARD,{})}))}static openPhone(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(si.OPEN_PHONE,{phoneNum:e.phoneNumber,phoneCode:e.phoneNumber})}))}static openSMS(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(si.OPEN_SMS,{content:e.content,phoneCode:e.phoneNumber})}))}static keepScreen(e){return i(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 i(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,o,n;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===(o=null==e?void 0:e.data)||void 0===o?void 0:o.error_message,payToken:null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.pay_token}}}))}))}static checkStateBioAuthentication(e){return i(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(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(si.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(si.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(si.OPEN_APPSTORE,e)}))}}var io,oo,no;class ro{constructor(e){io.set(this,localStorage),oo.set(this,void 0),no.set(this,void 0),Ii(),n(this,no,{keys:new Set,currentSize:0,limitSize:5242880},"f"),n(this,oo,e,"f"),this.findAllCurrentDataByApp(e)}findAllCurrentDataByApp(e){try{let t;for(t in o(this,io,"f")){if(e){if(t.split("_")[0]!==e)continue}o(this,no,"f").keys.add(t)}}catch(e){eo.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,oo,"f")&&(e=`${o(this,oo,"f")}_${e}`),o(this,no,"f").keys.has(e)?o(this,io,"f").getItem(e):null}set(e){return i(this,void 0,void 0,(function*(){return Object.entries(e).forEach((([e,t])=>{this.setSync(e,t.replace(/\\"/g,'"'))})),Promise.resolve({errorKeys:[]})}))}setSync(e,t){o(this,oo,"f")&&(e=`${o(this,oo,"f")}_${e}`),o(this,io,"f").setItem(e,t),o(this,no,"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,o,n=0;for(o in e){const r=o.split("_")[0];e.hasOwnProperty(o)&&(t&&r!==t||(i=2*(e[o].length+o.length),n+=i))}return n})(o(this,io,"f"),o(this,oo,"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){o(this,oo,"f")&&(e=`${o(this,oo,"f")}_${e}`),o(this,no,"f").keys.has(e)&&(o(this,io,"f").removeItem(e),o(this,no,"f").keys.delete(e))}clear(){return i(this,void 0,void 0,(function*(){return Promise.resolve(this.clearSync())}))}clearSync(){o(this,no,"f").keys.forEach((e=>{o(this,oo,"f")&&e.indexOf(o(this,oo,"f"))<0||(o(this,io,"f").removeItem(e),o(this,no,"f").keys.delete(e))}))}}io=new WeakMap,oo=new WeakMap,no=new WeakMap;var ao={},so=function(e,t,i){var o=t||"default";return function(){var t=o in ao?ao[o](e,i):e;return t.apply(this,arguments)}};so.setWrapper=function(e){var t=arguments.length<=1||void 0===arguments[1]?"default":arguments[1];ao[t]=e};var co={error:{code:1,error_subcode:1357046,message:"Received Invalid JSON reply.",type:"http"}};function lo(e){try{return null===e?co:JSON.parse(e)}catch(e){return co}}var uo,po,ho,vo,fo,go,mo,yo,_o,So,Eo,Oo,Ao,To,bo,Co,wo,No,Io,Po,ko,Do,Ro,Bo,jo,xo,Uo,Mo,Lo,Wo,zo,Jo,Fo,Ko={execute:function(e,t,i,o){i.suppress_http_code=1;var n=Oi.encode(i);"post"!=t&&(e=Oi.appendToUrl(e,n),n="");var r=function(e,t){if(!self.XMLHttpRequest)return null;var i=new XMLHttpRequest,o=function(){};if(!("withCredentials"in i))return null;i.open(e,t,!0),i.setRequestHeader("Content-type","application/x-www-form-urlencoded");var n={send:function(e){i.send(e)}},r=so((function(){r=o,"onload"in n&&n.onload(i)}),"entry","XMLHttpRequest:load"),a=so((function(){a=o,"onerror"in n&&n.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())},n}(t,e);return!!r&&(r.onload=function(e){o(lo(e.responseText))},r.onerror=function(e){e.responseText?o(lo(e.responseText)):o({error:{code:1,error_subcode:1357045,message:"unknown error (empty response)",status:e.status,type:"http"}})},r.send(n),!0)}};class Ho extends Fi{constructor(){super(),uo.add(this),this.debug=Ut("zmp:ZaloJSBridge"),this.events=Ki.getInstance(),this._accessTk=Bi("zacc_session")||"DEFAULT_ACCESS_TOKEN",this._jsAccessTk=Bi("zlink3rd")||"DEFAULT_JS_TOKEN",this.results=[],this._userAgent=Ni(),this._device=Ii(),this.isJumped=!1,po.set(this,void 0),ho.set(this,[]),vo.set(this,void 0),this.getCookie=e=>i(this,void 0,void 0,(function*(){var t;yield this.jump();return null===(t=o(this,ho,"f"))||void 0===t?void 0:t.find((t=>t.name===e))})),this.getCookieSync=e=>{var t;return null===(t=o(this,ho,"f"))||void 0===t?void 0:t.find((t=>t.name===e))},this._jsCallFuncCallbacks={},n(this,vo,{},"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),n(this,po,0,"f")}static getInstance(){return Ho.instance||(Ho.instance=new Ho),Ho.instance}set accessTk(e){this._accessTk=e}set jsAccessTk(e){this._jsAccessTk=e}jump(){return i(this,void 0,void 0,(function*(){const e=this;return n(this,po,+o(this,po,"f")+1,"f"),o(this,po,"f")>1&&(yield function(){return i(this,void 0,void 0,(function*(){return yield new Promise((t=>{const i=setInterval((()=>{(o(e,po,"f")<=1||e.isJumped)&&(t("done"),clearInterval(i))}),200)}))}))}()),new Promise(((e,t)=>{this.isJumped?(e(o(this,ho,"f")),n(this,po,+o(this,po,"f")-1,"f")):(this.debug("******** call jump ********"),this.callNative(si.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};o(this,vo,"f")[t]||(o(this,vo,"f")[t]={permission:!1,support:!1}),o(this,vo,"f")[t].permission=1===i.perm}));const a=i.find((e=>e.name===Kt.JS_TOKEN));a&&(this.jsAccessTk=a.value,window.ZJSBridge.setJSToken&&window.ZJSBridge.setJSToken(a.value)),n(this,ho,i,"f"),this.isJumped=!0,e(i)})).catch((e=>{this.isJumped=!1,t(e)})).finally((()=>{n(this,po,+o(this,po,"f")-1,"f")})))}))}))}sendLogData(e){try{const t=e.map((e=>({action:e.action,error:e.error})));Ko.execute(qt,"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=ji(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,o=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,i)}catch(e){console.error("Call callback error",e)}o&&clearTimeout(o),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=ji(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,o=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,i)}catch(e){console.error("Call callback error",e)}o&&clearTimeout(o)}}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 o=Li(i);this.debug(o);const n=this.handleEventData(t,o);this.events.emit(t,e,n)}handleEventData(e,t){try{switch(e){case exports.Events.OpenApp:const{url:e}=t,i=new URL(e),o=i.pathname.split(`/zapps/${Jt}`)[1];return{path:`${o||"/"}${i.search}`};default:return t}}catch(e){return t}}defaultCallback(e){null!=e&&(e=ji(e))}callNative(e,t,n){return this.debug(e.name,t),new Promise(((r,a)=>i(this,void 0,void 0,(function*(){const s=t=>i(this,void 0,void 0,(function*(){var i,o,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 n=new yi(t.error_code,t.error_message);const r=Di();if(e===si.JUMP_LOGIN)n=new yi(Xt,`Can not get auth code: ${t.error_message}`);else if(this.isJumped||e.skip_jump){if("permission required!"===String(n.message).toLowerCase()||"no permission!"===String(n.message).toLowerCase())n=new yi(ai.FORBIDDEN.code,ai.FORBIDDEN.message);else if(ci[r][t.error_code])n=new yi(ci[r][t.error_code].code,ci[r][t.error_code].message);else if(null===(o=null===(i=e.error_list)||void 0===i?void 0:i[r])||void 0===o?void 0:o[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}`),n=new yi(e.error_list[r][String(t.error_code)].map_to.code,i)}}else n=new yi(ai.UNAUTHORIZED.code,ai.UNAUTHORIZED.message);return a(n)}if(null==n?void 0:n.successCallback){const e=yield n.successCallback(t.data);return r(e)}r(t.data||{})}catch(e){return a(e)}}));e.skip_jump||(yield this.jump());const c=Ii().isIOS,l=(e=>{var t;const i=ki(),o=(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>=o})(e);if(c&&!l){const e=new yi(-5,"Client isn't support this action");return a(e)}(null==n?void 0:n.delay)?setTimeout((()=>{o(this,uo,"m",fo).call(this,e,t,s,null==n?void 0:n.isMultiCallback,null==n?void 0:n.nRetry,null==n?void 0:n.haveTimeout)}),n.delay):o(this,uo,"m",fo).call(this,e,t,s,null==n?void 0:n.isMultiCallback,null==n?void 0:n.nRetry,null==n?void 0:n.haveTimeout)}))))}}po=new WeakMap,ho=new WeakMap,vo=new WeakMap,uo=new WeakSet,fo=function e(t,i,n,r=!1,a=3,s=!0){try{const c=t.name,l=((e="")=>`${e.normalize("NFD").replace(Ai,"").replace(Ti,"d").replace(bi,"").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={}),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=xi(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,uo,"m",e).call(this,t,i,n,r,a)}),500)}}catch(e){console.log("jsCall","error",e)}return!1};class Go{constructor(e){go.set(this,void 0),mo.set(this,void 0),yo.set(this,void 0),n(this,mo,{keys:new Set,currentSize:0,limitSize:5242880},"f"),n(this,go,e,"f"),n(this,yo,Ho.getInstance(),"f")}get(e){return i(this,void 0,void 0,(function*(){return yield o(this,yo,"f").callNative(si.ZBROWSER_MPDS,{mpds_action:"mpds.get",mpds_data:{keys:e},appId:o(this,go,"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 o(this,yo,"f").callNative(si.ZBROWSER_MPDS,{mpds_action:"mpds.set",mpds_data:{map:e},appId:o(this,go,"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 o(this,yo,"f").callNative(si.ZBROWSER_MPDS,{mpds_action:"mpds.get.size",mpds_data:{},appId:o(this,go,"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 o(this,yo,"f").callNative(si.ZBROWSER_MPDS,{mpds_action:"mpds.remove.key",mpds_data:{keys:e},appId:o(this,go,"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 o(this,yo,"f").callNative(si.ZBROWSER_MPDS,{mpds_action:"mpds.clear.appData",mpds_data:{},appId:o(this,go,"f")})}))}}go=new WeakMap,mo=new WeakMap,yo=new WeakMap;class $o{getDataFromStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance(),i=yield t.get(e),o={};return i.forEach(((e,t)=>{o[t]=Li(e)})),o}))}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]=Mi(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 Vo extends $o{constructor(e){super(),_o.set(this,void 0),n(this,_o,e,"f")}getInstance(){return new ro(o(this,_o,"f"))}}_o=new WeakMap;class Zo extends $o{constructor(e){super(),So.set(this,void 0),n(this,So,e,"f")}getInstance(){return new Go(o(this,So,"f"))}}So=new WeakMap;class qo{static setStorage(e){return i(this,void 0,void 0,(function*(){let t=new Vo(this.getAppId());return Ui()&&(t=new Zo(this.getAppId())),yield t.putDataToStorage(e.data)}))}static getStorage(e){return i(this,void 0,void 0,(function*(){let t=new Vo(this.getAppId());Ui()&&(t=new Zo(this.getAppId()));return yield t.getDataFromStorage(e.keys)}))}static getStorageInfo(e){return i(this,void 0,void 0,(function*(){let e=new Vo(this.getAppId());return Ui()&&(e=new Zo(this.getAppId())),yield e.getStorageInfo()}))}static removeStorage(e){return i(this,void 0,void 0,(function*(){let t=new Vo(this.getAppId());return Ui()&&(t=new Zo(this.getAppId())),yield t.removeDataFromStorage(e.keys)}))}static clearStorage(e={}){return i(this,void 0,void 0,(function*(){let e=new Vo(this.getAppId());Ui()&&(e=new Zo(this.getAppId())),yield e.clearStorage()}))}}class Yo{static getUserInfo(e){return i(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();let o="id,name,picture";(null==e?void 0:e.avatarType)&&(o=`${o}.type(${null==e?void 0:e.avatarType})`);return{userInfo:yield fetch(`${Ht}?fields=${o}`,{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(si.MP_GET_NUMBER,{},{isMultiCallback:!0,successCallback:e=>{const t={number:e};return Promise.resolve(t)},delay:this.isIOS?400:0})}))}}class Qo{static closeApp(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(si.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)||{},o=Object.entries(i).map((function([e,t]){return[e,t].join("=")})).join("&");let n;try{n=yield Ji(t,0)}catch(e){}const r={appId:t};n&&(r.appName=n.name,r.appAvtUrl=n.logoUrl),yield this.getJSBridge().callNative(si.OPEN_MP,{mpUrl:`https://h5.zdn.vn/zapps/${t}/${o.length>0?"?"+o:""}`,mpInfo:r})}))}static openWebview(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(si.OPEN_INAPP,{url:e})}))}static closeLoading(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(si.MP_CLOSE_LOADINGVIEW,{at:(new Date).getTime(),when:e,url:location.href})}))}}class Xo{static getLocation(e){return i(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 i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(si.QUERY_LOCATION_HIDE,{title:e.title,touserid:e.toUserId,zapp:this.getZAppId()})}))}}class en{static requestCameraPermission(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(si.REQUEST_PERMISSION_CAMERA,{},{successCallback:e=>Promise.resolve({userAllow:(null==e?void 0:e.error_code)>=0,message:null==e?void 0:e.error_message})})}))}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(si.SAVE_IMAGE_GALLERY,Object.assign({},t))}))}}class tn{static viewOAQr(e){return i(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(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(si.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(si.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(si.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(si.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(si.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 o=[];const n=ki(),r=Di();n>=di[r]&&(i="multi_image"),Array.isArray(e.data.imageUrls)&&e.data.imageUrls.length>0?o=e.data.imageUrls:o.push(e.data.imageUrl),t={photoUrls:o,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 Wi(this.getAppId(),a||"",e.data.title||"",e.data.description||"",e.data.thumbnail||"",e.data.path);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}}}return yield this.getJSBridge().callNative(si.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,o){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(si.CREATE_SHORTCUT,{url:e,title:t,iconUrl:o})}))}static openProfilePicker(e){return i(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(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(si.GET_SUPPORTED_ACTIONS,{},{isMultiCallback:!1,successCallback:e=>{const t=Di();if(Array.isArray(e.actions)&&e.actions.length>0){const t=Object.keys(si).filter((e=>si[e].skip_jump)),i={actions:[...e.actions,...t]};return Promise.resolve(i)}if(t===exports.PlatformType.iOS){const e={actions:ui};return Promise.resolve(e)}}})}))}static openMediaPicker(e,t,o,n,r,a){return i(this,void 0,void 0,(function*(){const i={type:0,url:t,maxSize:o||1048576};return yield this.getJSBridge().callNative(si.PICK_MEDIA,{media_type:exports.MediaPickerType[e],edit_view:Object.assign(Object.assign({},{enable:1,aspect_ratio:"1:1"}),n),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(si.OPEN_OUTAPP,{url:e})}))}}class on{static getRouteParams(){let e={};const t=window.location.href;try{let i=new URL(t).searchParams.toString();i&&(e=Oi.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(si.WEBVIEW_SET_RESULT,{result:Mi(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 nn{constructor(){var e,t,r,a,s,c,l,d,u,p,h,v,f,g,m,y,_;Eo.set(this,zt),Oo.set(this,Jt),Ao.set(this,Ft),To.set(this,void 0),bo.set(this,void 0),Co.set(this,void 0),wo.set(this,null),No.set(this,{timer:{getToken:0}}),Io.set(this,void 0),Po.set(this,void 0),ko.set(this,void 0),Do.set(this,void 0),Ro.set(this,void 0),this.events=Ki.getInstance(),this.isIOS=Ii().isIOS,Bo.set(this,void 0),jo.set(this,void 0),xo.set(this,void 0),this.getActionBarConfig=()=>o(this,Bo,"f"),this.setActionBarConfig=e=>{n(this,Bo,e(o(this,Bo,"f")),"f")},this.getAuthCode=()=>i(this,void 0,void 0,(function*(){var e,t;return{authCode:null===(e=yield o(this,Io,"f").getCookie(Kt.ZOAUTH))||void 0===e?void 0:e.value,authCodeVerify:null===(t=yield o(this,Io,"f").getCookie(Kt.ZOAUTH_VRF))||void 0===t?void 0:t.value}})),this.setAccessToken=e=>{n(this,xo,!1,"f"),n(this,Co,e,"f"),o(this,Io,"f").accessTk=e,window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(e)},this.getVersion=qi.getVersion,this.getSystemInfo=qi.getSystemInfo,this.setNavigationBarTitle=Yi.setNavigationBarTitle,this.setNavigationBarColor=Yi.setNavigationBarColor,this.setNavigationBarLeftButton=Yi.setNavigationBarLeftButton,this.setBackgroundColor=Qi.setBackgroundColor,this.setDeviceOrientation=to.setDeviceOrientation,this.setStorage=qo.setStorage,this.getStorage=qo.getStorage,this.getStorageInfo=qo.getStorageInfo,this.removeStorage=qo.removeStorage,this.clearStorage=qo.clearStorage,this.getUserInfo=Yo.getUserInfo,this.getNetworkType=to.getNetworkType,this.onNetworkStatusChange=to.onNetworkStatusChange,this.startBeaconDiscovery=to.startBeaconDiscovery,this.stopBeaconDiscovery=to.stopBeaconDiscovery,this.getBeacons=to.getBeacons,this.closeApp=Qo.closeApp,this.getLocation=Xo.getLocation,this.stopBluetoothDevicesDiscovery=to.stopBluetoothDevicesDiscovery,this.startBluetoothDevicesDiscovery=to.stopBluetoothDevicesDiscovery,this.openBluetoothAdapter=to.openBluetoothAdapter,this.onBluetoothDeviceFound=to.onBluetoothDeviceFound,this.onBluetoothAdapterStateChange=to.onBluetoothAdapterStateChange,this.getConnectedBluetoothDevices=to.getConnectedBluetoothDevices,this.getBluetoothDevices=to.getBluetoothDevices,this.getBluetoothAdapterState=to.getBluetoothAdapterState,this.closeBluetoothAdapter=to.closeBluetoothAdapter,this.scanQRCode=to.scanQRCode,this.openProfile=tn.openProfile,this.openChat=tn.openChat,this.openPostFeed=tn.openPostFeed,this.followOA=tn.followOA,this.unFollowOA=tn.unfollowOA,this.openShareSheet=tn.openShareSheet,this.requestCameraPermission=en.requestCameraPermission,this.createShortcut=tn.createShortcut,this.openBioAuthentication=to.openBioAuthentication,this.checkStateBioAuthentication=to.checkStateBioAuthentication,this.sendLocation=Xo.sendLocation,this.showToast=to.showToast,this.hideKeyboard=to.hideKeyboard,this.openPhone=to.openPhone,this.openSMS=to.openSMS,this.viewOAQr=tn.viewOAQr,this.keepScreen=to.keepScreen,this.saveImageToPhotosAlbum=en.saveImageToPhotosAlbum,this.openMiniApp=Qo.openMiniApp,this.vibrate=to.vibrate,this.openWebview=Qo.openWebview,this.getRouteParams=on.getRouteParams,this.getAppInfo=qi.getAppInfo,this.sendDataToPreviousMiniApp=on.sendDataToPreviousMiniApp,this.onCallbackData=on.onCallbackData,this.getPhoneNumber=Yo.getPhoneNumber,this.openProfilePicker=tn.openProfilePicker,Uo.set(this,tn.getActionsSupported),this.connectWifi=to.connectWifi,this.openMediaPicker=tn.openMediaPicker,this.openOutApp=tn.openOutApp,this.closeLoading=Qo.closeLoading,this.openAppStore=to.openAppStore,n(this,To,null,"f"),n(this,bo,null,"f"),n(this,Co,null,"f"),this.isShowNavBar=!0,n(this,Po,(new Date).getTime(),"f"),n(this,ko,0,"f"),n(this,Do,"","f"),n(this,Ro,null,"f"),n(this,Io,Ho.getInstance(),"f"),n(this,jo,0,"f"),n(this,xo,!1,"f");const S="home"===(null===(t=null===(e=o(this,Ao,"f"))||void 0===e?void 0:e.app)||void 0===t?void 0:t.leftButton)||"both"===(null===(a=null===(r=o(this,Ao,"f"))||void 0===r?void 0:r.app)||void 0===a?void 0:a.leftButton)?vi:fi,E=new URL(location.href),O=xt.isString(null===(c=null===(s=o(this,Ao,"f"))||void 0===s?void 0:s.app)||void 0===c?void 0:c.headerColor)&&(null===(u=null===(d=null===(l=o(this,Ao,"f"))||void 0===l?void 0:l.app)||void 0===d?void 0:d.headerColor)||void 0===u?void 0:u.length)>0?5:6,A="none"===(null===(h=null===(p=o(this,Ao,"f"))||void 0===p?void 0:p.app)||void 0===h?void 0:h.leftButton)||"home"===(null===(f=null===(v=o(this,Ao,"f"))||void 0===v?void 0:v.app)||void 0===f?void 0:f.leftButton)?hi:pi;n(this,Bo,{actionbarType:O,buttonType:A,dataConfig:{backgroundColor:(null===(m=null===(g=o(this,Ao,"f"))||void 0===g?void 0:g.app)||void 0===m?void 0:m.headerColor)||"",textColor:(null===(_=null===(y=o(this,Ao,"f"))||void 0===y?void 0:y.app)||void 0===_?void 0:_.textColor)||"",viewInLeftType:A,confirmToExit:1},homeConfig:{enable:S,url:`https://h5.zdn.vn/zapps/${this.getAppId()}/${E.search}`}},"f")}static getInstance(){return nn.instance||(nn.instance=new nn),nn.instance}getLoginStatus(){return xt.isString(o(this,Co,"f"))&&o(this,Co,"f").length>0}getAppId(){return o(this,Oo,"f")}getZAppId(){return o(this,Eo,"f")}getDeviceId(){var e;return i(this,void 0,void 0,(function*(){return null===(e=yield o(this,Io,"f").getCookie(Kt.DEVICE_ID))||void 0===e?void 0:e.value}))}getDeviceIdSync(){var e;return null===(e=o(this,Io,"f").getCookieSync(Kt.DEVICE_ID))||void 0===e?void 0:e.value}getContext(){var e,t;return i(this,void 0,void 0,(function*(){const i=null===(e=yield o(this,Io,"f").getCookie(Kt.CONTEXT_ID))||void 0===e?void 0:e.value;return{type:null===(t=yield o(this,Io,"f").getCookie(Kt.CONTEXT_TYPE))||void 0===t?void 0:t.value,id:i}}))}getContextSync(){var e,t;const i=null===(e=o(this,Io,"f").getCookieSync(Kt.CONTEXT_ID))||void 0===e?void 0:e.value;return{type:null===(t=o(this,Io,"f").getCookieSync(Kt.CONTEXT_TYPE))||void 0===t?void 0:t.value,id:i}}getJSBridge(){return o(this,Io,"f")}login(e){return i(this,void 0,void 0,(function*(){n(this,xo,!0,"f");let e=(new Date).getTime()-o(this,Po,"f");const t=this;if(n(this,jo,+o(this,jo,"f")+1,"f"),o(this,jo,"f")>1&&(yield function(){return i(this,void 0,void 0,(function*(){return yield new Promise((e=>{const i=setInterval((()=>{(o(t,jo,"f")<=1||o(t,Co,"f"))&&(e("done"),clearInterval(i))}),200)}))}))}()),e=(new Date).getTime()-o(this,Po,"f"),o(this,Co,"f")&&e<o(this,ko,"f"))return n(this,jo,+o(this,jo,"f")-1,"f"),o(this,Co,"f");const r=yield(yield this.getAuthCode()).authCode,a=yield(yield this.getAuthCode()).authCodeVerify;if(r){if(n(this,To,r,"f"),a?(n(this,bo,a,"f"),yield this.loginZaloV4()):yield this.loginZaloV3(),n(this,jo,+o(this,jo,"f")-1,"f"),!o(this,Co,"f"))throw Ei.loginFailed("Invalid authorization code");return o(this,Co,"f")}throw n(this,jo,+o(this,jo,"f")-1,"f"),Ei.loginFailed("Zalo app has not been activated")}))}loginZaloV3(){return i(this,void 0,void 0,(function*(){return yield fetch(`${$t}?app_id=${o(this,Eo,"f")}&redirect_uri=https://h5.zdn.vn/zapps/${o(this,Oo,"f")}/&code=${o(this,To,"f")}&isSDK=true`).then((e=>i(this,void 0,void 0,(function*(){let t=yield e.json();if(t.access_token){n(this,Co,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return n(this,ko,e,"f"),n(this,Po,(new Date).getTime(),"f"),o(this,Io,"f").accessTk=o(this,Co,"f")||"",window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(o(this,Co,"f")||""),o(this,Co,"f")}return null}))))}))}loginZaloV4(){return i(this,void 0,void 0,(function*(){const e=new URLSearchParams;e.append("app_id",o(this,Oo,"f")),e.append("code",o(this,To,"f")||""),e.append("code_verifier",o(this,bo,"f")||""),xt.isNull(o(this,wo,"f"))?e.append("grant_type","authorization_code"):(e.append("grant_type","refresh_token"),e.append("refresh_token",o(this,wo,"f")||""));return yield fetch(Gt,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&&n(this,wo,t.refresh_token,"f"),t.access_token){n(this,Co,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return n(this,ko,e,"f"),n(this,Po,(new Date).getTime(),"f"),o(this,Io,"f").accessTk=o(this,Co,"f")||"",window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(o(this,Co,"f")||""),o(this,Co,"f")}return null}))))}))}getAccessToken(e){return i(this,void 0,void 0,(function*(){const e=(new Date).getTime()-o(this,Po,"f");if(o(this,xo,"f"))return o(this,Co,"f")&&e<o(this,ko,"f")?o(this,Co,"f"):(n(this,Co,"","f"),yield this.login());if(!o(this,Co,"f"))throw Ei.loginRequired();return o(this,Co,"f")}))}}Eo=new WeakMap,Oo=new WeakMap,Ao=new WeakMap,To=new WeakMap,bo=new WeakMap,Co=new WeakMap,wo=new WeakMap,No=new WeakMap,Io=new WeakMap,Po=new WeakMap,ko=new WeakMap,Do=new WeakMap,Ro=new WeakMap,Bo=new WeakMap,jo=new WeakMap,xo=new WeakMap,Uo=new WeakMap;class rn{constructor(){Mo.set(this,zt),Lo.set(this,Ft),Wo.set(this,"DEFAULT ZOAUTH"),zo.set(this,"DEFAULT ACCESS TOKEN"),Jo.set(this,{timer:{getToken:0}}),Fo.set(this,!1),this.getLoginStatus=()=>o(this,Fo,"f"),this.getAppId=()=>o(this,Mo,"f"),this.getDeviceId=()=>i(this,void 0,void 0,(function*(){return Promise.resolve("")})),this.getDeviceIdSync=()=>"",this.login=()=>(n(this,Fo,!0,"f"),Promise.resolve(o(this,Wo,"f"))),this.getAccessToken=()=>Promise.resolve(o(this,zo,"f")),this.getVersion=qi.getVersion,this.getSystemInfo=qi.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 Vo(this.getAppId());return yield t.putDataToStorage(e.data),{errorKeys:[]}})),this.getStorage=e=>i(this,void 0,void 0,(function*(){const t=new Vo(this.getAppId());return yield t.getDataFromStorage(e.keys)})),this.getStorageInfo=e=>i(this,void 0,void 0,(function*(){const e=new Vo(this.getAppId());return yield e.getStorageInfo()})),this.removeStorage=e=>i(this,void 0,void 0,(function*(){const t=new Vo(this.getAppId());return yield t.removeDataFromStorage(e.keys)})),this.clearStorage=e=>i(this,void 0,void 0,(function*(){const e=new Vo(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=on.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(),this.getAuthCode=()=>Promise.resolve({authCode:"",authCodeVerify:""})}getContext(){return i(this,void 0,void 0,(function*(){return Promise.resolve(null)}))}getContextSync(){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,o){throw new Error("Method not implemented.")}removeAllListeners(e){throw new Error("Method not implemented.")}openMediaPicker(e,t,i,o,n,r){return console.warn("This api only works on zalo app"),Promise.resolve({data:""})}setAccessToken(e){}}Mo=new WeakMap,Lo=new WeakMap,Wo=new WeakMap,zo=new WeakMap,Jo=new WeakMap,Fo=new WeakMap;const an=Symbol("required"),sn=Symbol("checkType"),cn=(e,t)=>(i,o,n)=>{let r=Reflect.getOwnMetadata(an,i,o)||[];r.push({parameterIndex:n,fields:e,option:t}),Reflect.defineMetadata(an,r,i,o)},ln=(e,t,i)=>(o,n,r)=>{let a=Reflect.getOwnMetadata(sn,o,n)||[];a.push({parameterIndex:r,type:e,properties:t,defaultValue:i}),Reflect.defineMetadata(sn,a,o,n)};function dn(e,t){Reflect.getMetadataKeys(e).map((i=>{const o=Reflect.getMetadata(i,e);Reflect.defineMetadata(i,o,t)}))}const un=(e,t={})=>i=>{var o;let n=Object.getOwnPropertyDescriptors(i.prototype);if(t.deep){let e=Object.getPrototypeOf(i);for(;e.prototype;){const t=Object.getOwnPropertyDescriptors(e.prototype);n=Object.assign(Object.assign({},t),n),e=Object.getPrototypeOf(e)}}for(const[r,a]of Object.entries(n)){const n="function"==typeof a.value&&"constructor"!=r;if(null===(o=t.exclude)||void 0===o?void 0:o.includes(r))continue;if(t.excludePrefix&&r.startsWith(t.excludePrefix))continue;if(!n)continue;const s=a.value;e(i,r,a),s!=a.value&&dn(s,a.value),Object.defineProperty(i.prototype,r,a)}},pn=(e,t,i)=>{const o=i.value,n=function(e){return e.toString().match(/\(.*?\)/)[0].replace(/[()]/gi,"").replace(/\s/gi,"").split(",")}(o);return i.value=function(...i){try{const r=Reflect.getOwnMetadata(an,e.prototype,t),a=Reflect.getOwnMetadata(sn,e.prototype,t);a&&a.forEach((e=>{const{parameterIndex:t,type:o,properties:r,defaultValue:a}=e;let s=i[t],c=n[t];const l=typeof s;if(!xt.isUndefined(s)){if(!Ri(s,o))throw Ei.wrongTypeParam(c,o,Array.isArray(s)?"array":null===s?"null":l);"object"===o&&Object.entries(r).forEach((([e,o])=>{const n=e.split("?")[0],r=xt.get(s,n);if(xt.isUndefined(r)||xt.isNull(r)){if(!e.includes("?"))throw Ei.missingParam(e);xt.get(s,n.split(".")[0])||!a||xt.isUndefined(xt.get(a,n))||xt.set(i[t],n,xt.get(a,n))}else if(xt.isFunction(o)){const e=o(r);if(e&&e.error)throw Ei.wrongTypeParam(`${c}.${n}`,e.errorMessage,typeof r)}}))}})),r&&r.forEach((e=>{const{parameterIndex:t,option:o,fields:n}=e,r=i[t],a=null==o?void 0:o.if,s=null==o?void 0:o.defaultValue;let c=!0;a&&(c=Object.keys(a).every((e=>xt.get(r,e)===a[e]))),c&&n.forEach((e=>{const o=e=>{let o=!1;return xt.isEmpty(xt.get(r,e))&&(xt.isUndefined(xt.get(s,e))||xt.set(i[t],e,xt.get(s,e)),o=!0),o};if(Array.isArray(e)&&e.length>0&&e.every(o))throw Ei.missingParam(e.join(" or "));if(xt.isString(e)&&o(e))throw Ei.missingParam(e)}))}));const s=o.call(this,...i);if(xt.isPromise(s)){const{success:e,fail:o}=Array.isArray(i)&&i.length>0&&i[0];return new Promise(((i,n)=>{s.then((t=>{!xt.isNull(e)&&xt.isFunction(e)?e.call(null,t,this):i(s)})).catch((e=>{const i=_i(e,t);!xt.isNull(o)&&xt.isFunction(o)?o.call(null,i,this):n(i)}))}))}return s}catch(e){throw _i(e,t)}},i};var hn,vn,fn,gn,mn;exports.SDKCreator=class{constructor(){this.events=Ki.getInstance(),hn.set(this,void 0),n(this,hn,this.getServiceInstance(),"f"),this.events.addListener=(e,t,i)=>{const o=e;return this.events.addListener(exports.Events[o],t,i)}}login(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").login(e)}))}getLoginStatus(){return o(this,hn,"f").getLoginStatus()}getAccessToken(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getAccessToken(e)}))}getVersion(){return o(this,hn,"f").getVersion()}getSystemInfo(){return o(this,hn,"f").getSystemInfo()}setNavigationBarTitle(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").setNavigationBarTitle(e)}))}setNavigationBarColor(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").setNavigationBarColor(e)}))}setBackgroundColor(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").setBackgroundColor(e)}))}setNavigationBarLeftButton(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").setNavigationBarLeftButton(e.type)}))}setDeviceOrientation(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").setDeviceOrientation(e)}))}setStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").setStorage(e)}))}getStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getStorage(e)}))}getStorageInfo(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getStorageInfo(e)}))}removeStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").removeStorage(e)}))}clearStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").clearStorage(e)}))}getUserInfo(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getUserInfo(e)}))}getNetworkType(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getNetworkType(e)}))}onNetworkStatusChange(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").onNetworkStatusChange(e)}))}startBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").startBeaconDiscovery(e)}))}stopBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").stopBeaconDiscovery(e)}))}getBeacons(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getBeacons(e)}))}closeApp(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").closeApp(e)}))}getLocation(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getLocation(e)}))}stopBluetoothDevicesDiscovery(){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").stopBluetoothDevicesDiscovery()}))}startBluetoothDevicesDiscovery(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").startBluetoothDevicesDiscovery(e)}))}openBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").openBluetoothAdapter()}))}onBluetoothDeviceFound(){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").onBluetoothDeviceFound()}))}onBluetoothAdapterStateChange(){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").onBluetoothAdapterStateChange()}))}getConnectedBluetoothDevices(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getConnectedBluetoothDevices(e)}))}getBluetoothDevices(){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getBluetoothDevices()}))}getBluetoothAdapterState(){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getBluetoothAdapterState()}))}closeBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").closeBluetoothAdapter()}))}scanQRCode(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").scanQRCode(e)}))}openProfile(e){return i(this,void 0,void 0,(function*(){yield o(this,hn,"f").openProfile(e)}))}openChat(e){return i(this,void 0,void 0,(function*(){yield o(this,hn,"f").openChat(e)}))}openPostFeed(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").openPostFeed(e)}))}followOA(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").followOA(e)}))}unfollowOA(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").unFollowOA(e)}))}openShareSheet(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").openShareSheet(e)}))}requestCameraPermission(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").requestCameraPermission(e)}))}createShortcut(e){return i(this,void 0,void 0,(function*(){const t=yield Ji(Jt,0),i=Ii().isIOS,n=t.logoUrl||Pi("og:image:url")||"",r=t.name||document.title,a=e.params?new URLSearchParams(e.params):new URLSearchParams;if(a.append("utm_source","zalo-shortcut"),a.append("utm_medium","default"),a.append("utm_campaign","default"),i){a.append("appId",Jt),a.append("appName",r),a.append("appIcon",n);const e=`https://mini.zalo.me/shortcut.html?${a.toString()}`;yield o(this,hn,"f").openOutApp(encodeURI(e))}else yield o(this,hn,"f").createShortcut(`https://zalo.me/app/link/zapps/${Jt}/?${a.toString()}`,r,n);return Si()}))}openBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").openBioAuthentication(e)}))}checkStateBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").checkStateBioAuthentication(e)}))}sendLocation(e){return i(this,void 0,void 0,(function*(){yield o(this,hn,"f").sendLocation(e)}))}showToast(e){return i(this,void 0,void 0,(function*(){yield o(this,hn,"f").showToast(e)}))}hideKeyboard(e){return i(this,void 0,void 0,(function*(){yield o(this,hn,"f").hideKeyboard(e)}))}openPhone(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").openPhone(e)}))}openSMS(e){return i(this,void 0,void 0,(function*(){yield o(this,hn,"f").openSMS(e)}))}viewOAQr(e){return i(this,void 0,void 0,(function*(){yield o(this,hn,"f").viewOAQr(e)}))}keepScreen(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").keepScreen(e)}))}saveImageToGallery(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").saveImageToPhotosAlbum(e)}))}saveImageToPhotosAlbum(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"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 o(this,hn,"f").openMiniApp(e)}))}vibrate(e){return i(this,void 0,void 0,(function*(){yield o(this,hn,"f").vibrate(e)}))}openWebview(e){return i(this,void 0,void 0,(function*(){const t=new URL(e.url),i=t.href.includes("vnpay"),n=t.searchParams.get("typeInapp");!i&&xt.isEmpty(n)&&t.searchParams.set("typeInapp","1"),yield o(this,hn,"f").openWebview(t.href)}))}getRouteParams(){return o(this,hn,"f").getRouteParams()}getAppInfo(e){return o(this,hn,"f").getAppInfo()}sendDataToPreviousMiniApp(e){return o(this,hn,"f").sendDataToPreviousMiniApp(e)}onCallbackData(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").onCallbackData(e)}))}getPhoneNumber(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getPhoneNumber()}))}openProfilePicker(e){return i(this,void 0,void 0,(function*(){const t=yield o(this,hn,"f").openProfilePicker(e.maxProfile);let i;if(t.length>0)try{const e=yield this.getAccessToken(),o=yield fetch(Vt,{method:"POST",headers:{"Content-Type":"application/json",access_token:e||""},body:JSON.stringify({fields:"id,name,picture",user_ids:t})}),n=yield o.json();if(0!==n.error||!n.data)throw new Error(n.message);i=t.map((e=>{var t,i,o,r,a,s,c,l,d,u,p;return{id:(null===(i=null===(t=n.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===(o=n.data[e])||void 0===o?void 0:o.user_info)||void 0===r?void 0:r.name,avatar:null===(l=null===(c=null===(s=null===(a=n.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=n.data[e])||void 0===d?void 0:d.error)?-1:0,message:`Get profile: ${xt.isUndefined(null===(u=n.data[e])||void 0===u?void 0:u.message)?"Unknown error":null===(p=n.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 o(this,hn,"f").connectWifi(e)}))}openMediaPicker(e){var t,n,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===(n=e.editView)||void 0===n?void 0:n.enable)?i.enable=1:i.enable=0,i.aspect_ratio=null===(r=e.editView)||void 0===r?void 0:r.aspectRatio;const a=!0===e.silentRequest?1:0,s=e.maxSelectItem;return yield o(this,hn,"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 Wi(window.APP_ID,t||"",e.title,e.description,e.thumbnail,e.path)).shareableLink}))}closeLoading(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").closeLoading("user action")}))}requestUpdateZalo(e){return i(this,void 0,void 0,(function*(){const e=Ii().isIOS?"https://apps.apple.com/vn/app/zalo/id579523206":"https://play.google.com/store/apps/details?id=com.zing.zalo";return yield o(this,hn,"f").openOutApp(e)}))}onConfirmToExit(e){this.events.on(exports.Events.AppClose,e,'{"handle_h5": 1}'),o(this,hn,"f").setNavigationBarLeftButton(void 0,2)}offConfirmToExit(){this.events.off(exports.Events.AppClose),o(this,hn,"f").setNavigationBarLeftButton(void 0,0)}getDeviceId(){return o(this,hn,"f").getDeviceIdSync()}getDeviceIdAsync(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getDeviceId()}))}getContext(){return o(this,hn,"f").getContextSync()}getContextAsync(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getContext()}))}getAuthCode(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getAuthCode()}))}setAccessToken(e){return o(this,hn,"f").setAccessToken(e)}},hn=new WeakMap,e([t(0,ln("object",{title:zi("string")}))],exports.SDKCreator.prototype,"setNavigationBarTitle",null),e([t(0,ln("object",{color:zi("string"),"textColor?":zi("string",{values:["white","black"]}),"statusBarColor?":zi("string")}))],exports.SDKCreator.prototype,"setNavigationBarColor",null),e([t(0,ln("object",{backgroundColor:zi("string"),"textColor?":zi("string",{values:["white","black"]})}))],exports.SDKCreator.prototype,"setBackgroundColor",null),e([t(0,ln("object",{type:zi("string",{values:["none","back","home","both"]})}))],exports.SDKCreator.prototype,"setNavigationBarLeftButton",null),e([t(0,ln("object",{rotate:zi("string",{values:["auto","portrait","landscape"]})}))],exports.SDKCreator.prototype,"setDeviceOrientation",null),e([t(0,ln("object",{data:zi("object")}))],exports.SDKCreator.prototype,"setStorage",null),e([t(0,ln("object",{keys:zi("array<string>")}))],exports.SDKCreator.prototype,"getStorage",null),e([t(0,ln("object",{keys:zi("array<string>")}))],exports.SDKCreator.prototype,"removeStorage",null),e([t(0,ln("object",{"avatarType?":zi("string",{values:["small","normal","large"]})}))],exports.SDKCreator.prototype,"getUserInfo",null),e([t(0,ln("object",{type:zi("string",{values:["user","oa","aliasOA"]}),id:zi("string")}))],exports.SDKCreator.prototype,"openProfile",null),e([t(0,ln("object",{type:zi("string",{values:["user","oa"]}),id:zi("string"),"message?":zi("string")}))],exports.SDKCreator.prototype,"openChat",null),e([t(0,cn(["data.imageUrl"],{if:{type:"image"}})),t(0,cn(["data.link"],{if:{type:"link"}})),t(0,cn(["data.id"],{if:{type:"profile"}})),t(0,ln("object",{type:zi("string",{values:["image","link","profile"]}),data:zi("object"),"data.imageUrl?":zi("url"),"data.link?":zi("url"),"data.title?":zi("string"),"data.thumb?":zi("url"),"data.description?":zi("string"),"data.avatar?":zi("url"),"data.id?":zi("string"),"data.displayName?":zi("string")}))],exports.SDKCreator.prototype,"openPostFeed",null),e([t(0,ln("object",{id:zi("string"),"showDialogConfirm?":zi("boolean")}))],exports.SDKCreator.prototype,"followOA",null),e([t(0,ln("object",{id:zi("string")}))],exports.SDKCreator.prototype,"unfollowOA",null),e([t(0,cn([["data.imageUrl","data.imageUrls"]],{if:{type:"image"}})),t(0,cn(["data.link"],{if:{type:"link"}})),t(0,cn(["data.id"],{if:{type:"oa"}})),t(0,cn(["data.gifUrl"],{if:{type:"gif"}})),t(0,cn(["data.videoThumb","data.videoUrl"],{if:{type:"video"}})),t(0,cn(["data.thumbnail","data.title","data.description"],{if:{type:"zmp"},defaultValue:{data:{description:""}}})),t(0,ln("object",{type:zi("string",{values:["image","gif","video","link","oa","zmp"]}),data:zi("object"),"data.imageUrl?":zi("url"),"data.imageUrls?":zi("array<url>",{maxLength:10}),"data.caption?":zi("string"),"data.gifUrl?":zi("url"),"data.width?":zi("number"),"data.height?":zi("number"),"data.videoThumb?":zi("url"),"data.videoUrl?":zi("url"),"data.link?":zi("url"),"data.chatOnly?":zi("boolean"),"data.id?":zi("string"),"data.thumbnail?":zi("url"),"data.path?":zi("string"),"data.title?":zi("string",{maxLength:100}),"data.description?":zi(["string"],{maxLength:400})}))],exports.SDKCreator.prototype,"openShareSheet",null),e([t(0,ln("object",{secretData:zi("string"),"ui?":zi("object"),"ui.title?":zi("string"),"ui.subTitle?":zi("string"),"ui.negativeButtonText?":zi("string"),"requireFingerprint?":zi("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,ln("object",{toUserId:zi("string"),"title?":zi("string")}))],exports.SDKCreator.prototype,"sendLocation",null),e([t(0,ln("object",{message:zi("string")}))],exports.SDKCreator.prototype,"showToast",null),e([t(0,ln("object",{phoneNumber:zi("string")}))],exports.SDKCreator.prototype,"openPhone",null),e([t(0,ln("object",{content:zi("string"),phoneNumber:zi("string",{regex:/^\+?\d+$/})}))],exports.SDKCreator.prototype,"openSMS",null),e([t(0,ln("object",{id:zi("string"),"displayName?":zi("string")},{displayName:""}))],exports.SDKCreator.prototype,"viewOAQr",null),e([t(0,ln("object",{"imageBase64Data?":zi("string"),"imageUrl?":zi("url")}))],exports.SDKCreator.prototype,"saveImageToGallery",null),e([t(0,ln("object",{"imageBase64Data?":zi("string"),"imageUrl?":zi("url")}))],exports.SDKCreator.prototype,"saveImageToPhotosAlbum",null),e([t(0,ln("object",{appId:zi("string"),"params?":zi("object")}))],exports.SDKCreator.prototype,"openMiniApp",null),e([t(0,ln("object",{"type?":zi("string",{values:["oneShot"]}),"milliseconds?":zi("number")},{type:"oneShot",milliseconds:500}))],exports.SDKCreator.prototype,"vibrate",null),e([t(0,ln("object",{url:zi("url")}))],exports.SDKCreator.prototype,"openWebview",null),e([t(0,ln("object",{"maxProfile?":zi("number",{min:1,max:10})},{maxProfile:1}))],exports.SDKCreator.prototype,"openProfilePicker",null),e([t(0,cn(["SSID"])),t(0,ln("object",{SSID:zi("string"),"password?":zi("string"),"hiddenSSID?":zi("boolean")}))],exports.SDKCreator.prototype,"connectWifi",null),e([t(0,ln("object",{type:zi("string",{values:["photo","video","file"]}),serverUploadUrl:zi("url"),"maxItemSize?":zi("number",{min:0}),"editView?":zi("object"),"editView.enable?":zi("boolean"),"editView.aspectRatio?":zi("string",{regex:/^\d+:\d+$/}),"silentRequest?":zi("boolean"),"maxSelectItem?":zi("number",{min:1})}))],exports.SDKCreator.prototype,"openMediaPicker",null),e([t(0,ln("object",{title:zi("string",{maxLength:100}),"thumbnail?":zi("url"),"path?":zi("string"),description:zi(["string"],{maxLength:400})},{description:""}))],exports.SDKCreator.prototype,"getShareableLink",null),exports.SDKCreator=e([un(pn)],exports.SDKCreator);class yn extends exports.SDKCreator{getServiceInstance(){return nn.getInstance()}}class _n extends exports.SDKCreator{getServiceInstance(){return new rn}}class Sn{constructor(){vn.set(this,Jt)}static getInstance(){return Sn.instance||(Sn.instance=new Sn),Sn.instance}createOrder(e,t){return i(this,void 0,void 0,(function*(){const i=o(this,vn,"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 Ei.loginRequired}});r.headers.authorization=`Bearer ${o}`;const a=yield fetch(gi,Object.assign(Object.assign({method:"POST"},r),{body:n})),s=yield a.json();if(!s.data||0!==s.err)throw Ei.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=Oi.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:n}=t;if(n||(n=e.getRouteParams()),"object"==typeof n&&(i=n.appTransID||n.orderId||n.apptransid),"string"==typeof n){const e=Oi.getParameterByName("orderId",n),t=Oi.getParameterByName("appTransID",n)||Oi.getParameterByName("apptransid",n);i=e||t}const r={headers:{authorization:"Bearer "}},a=yield e.getAccessToken({fail:e=>{throw Ei.loginRequired}});r.headers.authorization=`Bearer ${a}`;const s=new URL(mi),c={transId:i||"",appId:o(this,vn,"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 Ei.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}}))}}vn=new WeakMap;class En{constructor(){fn.set(this,zt)}static getInstance(){return En.instance||(En.instance=new En),En.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)}}fn=new WeakMap;let On=class{constructor(e){gn.set(this,void 0),mn.set(this,void 0),n(this,gn,this.getInstance(),"f"),n(this,mn,e,"f")}createOrder(e){return o(this,gn,"f").createOrder(o(this,mn,"f"),e)}checkTransaction(e){return o(this,gn,"f").checkTransaction(o(this,mn,"f"),e)}};gn=new WeakMap,mn=new WeakMap,e([t(0,ln("object",{amount:zi(["string","number"]),desc:zi("string"),"method?":zi("string",{values:["MOMO","ZALOPAY","MOMO_SANDBOX","ZALOPAY_SANDBOX","CC","CC_SANDBOX","ATM","ATM_SANDBOX"]})}))],On.prototype,"createOrder",null),On=e([un(pn)],On);class An extends On{getInstance(){return Sn.getInstance()}}class Tn extends On{getInstance(){return En.getInstance()}}const bn=Ii();exports.default=void 0,window.onJSCall=e=>function(t){Ho.getInstance().onJSCall(e,t)},window.onMultiJSCall=e=>function(t){Ho.getInstance().onMultiJSCall(e,t)},window.zaloJSV2={zalo_h5_event_handler:function(e,t,i){Ho.getInstance().nativeEventHandler(e,t,i)}},exports.Payment=void 0,bn.isZalo?(exports.default=new yn,exports.Payment=new An(exports.default)):(exports.default=new _n,exports.Payment=new Tn(exports.default)),window.ZaloMiniAppSDK=exports.default,exports.default=exports.default;
|
|
16
|
+
function e(e,t,i,o){var n,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(r<3?n(a):r>3?n(t,i,a):n(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a}function t(e,t){return function(i,o){t(i,o,e)}}function i(e,t,i,o){return new(i||(i=Promise))((function(n,r){function a(e){try{c(o.next(e))}catch(e){r(e)}}function s(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}c((o=o.apply(e,t||[])).next())}))}function o(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)}function n(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.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 o=!0}catch(e){}var n=y.call(e);return o&&(t?e[_]=i:delete e[_]),n},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 C,w=function(e){if(!b(e))return!1;var t=T(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},N=v["__core-js_shared__"],I=(C=/[^.]+$/.exec(N&&N.keys&&N.keys.IE_PROTO||""))?"Symbol(src)_1."+C:"";var P=function(e){return!!I&&I in e},k=Function.prototype.toString;var D=function(e){if(null!=e){try{return k.call(e)}catch(e){}try{return e+""}catch(e){}}return""},R=/^\[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))&&(w(e)?M:R).test(D(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"),H=z(v,"Set"),G=z(v,"WeakMap"),$=D(J),V=D(F),Z=D(K),q=D(H),Y=D(G),Q=T;(J&&"[object DataView]"!=Q(new J(new ArrayBuffer(1)))||F&&"[object Map]"!=Q(new F)||K&&"[object Promise]"!=Q(K.resolve())||H&&"[object Set]"!=Q(new H)||G&&"[object WeakMap]"!=Q(new G))&&(Q=function(e){var t=T(e),i="[object Object]"==t?e.constructor:void 0,o=i?D(i):"";if(o)switch(o){case $:return"[object DataView]";case V:return"[object Map]";case Z:return"[object Promise]";case q:return"[object Set]";case Y:return"[object WeakMap]"}return t});var X=Q;var ee=function(e){return null!=e&&"object"==typeof e};var te=function(e){return ee(e)&&"[object Arguments]"==T(e)},ie=Object.prototype,oe=ie.hasOwnProperty,ne=ie.propertyIsEnumerable,re=te(function(){return arguments}())?te:function(e){return ee(e)&&oe.call(e,"callee")&&!ne.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)&&!w(e)};var le=function(){return!1},de=u((function(e,t){var i=t&&!t.nodeType&&t,o=i&&e&&!e.nodeType&&e,n=o&&o.exports===i?v.Buffer:void 0,r=(n?n.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,o=i&&e&&!e.nodeType&&e,n=o&&o.exports===i&&p.process,r=function(){try{var e=o&&o.require&&o.require("util").types;return e||n&&n.binding&&n.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 Ce=function(e){return"symbol"==typeof e||ee(e)&&"[object Symbol]"==T(e)},we=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ne=/^\w*$/;var Ie=function(e,t){if(ae(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!Ce(e))||(Ne.test(e)||!we.test(e)||null!=t&&e in Object(t))},Pe=z(Object,"create");var ke=function(){this.__data__=Pe?Pe(null):{},this.size=0};var De=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Re=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 Re.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 o=e[t];this.set(o[0],o[1])}}Me.prototype.clear=ke,Me.prototype.delete=De,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 He=function(e){var t=this.__data__,i=Je(t,e);return i<0?void 0:t[i][1]};var Ge=function(e){return Je(this.__data__,e)>-1};var $e=function(e,t){var i=this.__data__,o=Je(i,e);return o<0?(++this.size,i.push([e,t])):i[o][1]=t,this};function Ve(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var o=e[t];this.set(o[0],o[1])}}Ve.prototype.clear=We,Ve.prototype.delete=Ke,Ve.prototype.get=He,Ve.prototype.has=Ge,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 Ye=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Qe=function(e,t){var i=e.__data__;return Ye(t)?i["string"==typeof t?"string":"hash"]:i.map};var Xe=function(e){var t=Qe(this,e).delete(e);return this.size-=t?1:0,t};var et=function(e){return Qe(this,e).get(e)};var tt=function(e){return Qe(this,e).has(e)};var it=function(e,t){var i=Qe(this,e),o=i.size;return i.set(e,t),this.size+=i.size==o?0:1,this};function ot(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var o=e[t];this.set(o[0],o[1])}}ot.prototype.clear=qe,ot.prototype.delete=Xe,ot.prototype.get=et,ot.prototype.has=tt,ot.prototype.set=it;var nt=ot;function rt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var i=function(){var o=arguments,n=t?t.apply(this,o):o[0],r=i.cache;if(r.has(n))return r.get(n);var a=e.apply(this,o);return i.cache=r.set(n,a)||r,a};return i.cache=new(rt.Cache||nt),i}rt.Cache=nt;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,o,n){t.push(o?n.replace(ct,"$1"):i||e)})),t}));var dt=function(e,t){for(var i=-1,o=null==e?0:e.length,n=Array(o);++i<o;)n[i]=t(e[i],i,e);return n},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(Ce(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||Ce(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var mt=function(e,t){for(var i=0,o=(t=ft(t,e)).length;null!=e&&i<o;)e=e[gt(t[i++])];return i&&i==o?e:void 0};var yt=function(e,t,i){var o=null==e?void 0:mt(e,t);return void 0===o?i:o},_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 o=e[t];Et.call(e,t)&&ze(o,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,o){if(!b(e))return e;for(var n=-1,r=(t=ft(t,e)).length,a=r-1,s=e;null!=s&&++n<r;){var c=gt(t[n]),l=i;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(n!=a){var d=s[c];void 0===(l=o?o(d,c,s):void 0)&&(l=b(d)?d:Tt(t[n+1])?[]:{})}Ot(s,c,l),s=s[c]}return e};var Ct,wt,Nt,It,Pt,kt,Dt,Rt,Bt,jt,xt={isEmpty:ye,isNull:Se,isUndefined:_e,isFunction:w,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,(Ct=exports.NetworkType||(exports.NetworkType={})).none="none",Ct.wifi="wifi",Ct.cellular="cellular",Ct.unknown="unknown",exports.PlatformType=void 0,(wt=exports.PlatformType||(exports.PlatformType={})).wp="wp",wt.android="android",wt.iOS="iOS",wt.unknown="unknown",exports.ProfileType=void 0,(Nt=exports.ProfileType||(exports.ProfileType={}))[Nt.user=1]="user",Nt[Nt.oa=0]="oa",Nt[Nt.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,(Dt=exports.OrientationType||(exports.OrientationType={}))[Dt.auto=1]="auto",Dt[Dt.portrait=2]="portrait",Dt[Dt.landscape=3]="landscape",exports.VibrateType=void 0,(Rt=exports.VibrateType||(exports.VibrateType={}))[Rt.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.zcamera=3]="zcamera",jt[jt.zcamera_photo=1]="zcamera_photo",jt[jt.zcamera_video=2]="zcamera_video",jt[jt.zcamera_scan=7]="zcamera_scan",jt[jt.photo=4]="photo",jt[jt.video=5]="video",jt[jt.file=6]="file";const Mt=e=>{const t=document.cookie;if(t){const n=t.split("; ");if(n&&n.length>0)for(var i=e.length+1,o=n.length-1;o>=0;o--){let t=n[o];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={ZOAUTH:"h5.zdn.vn_zoauth",ZACC_SESSiON:"h5.zdn.vn_zacc_session",JS_TOKEN:"h5.zdn.vn_zlink3rd",ZOAUTH_VRF:"h5.zdn.vn_zoauth_vrf",DEVICE_ID:"h5.zdn.vn_deviceID",CONTEXT_ID:"h5.zdn.vn_contextID",CONTEXT_TYPE:"h5.zdn.vn_contextType"},Ht="https://graph.zalo.me/v2.0/me",Gt="https://h5.zalo.me/openapi/access_token",$t="https://oauth.zaloapp.com/v3/access_token",Vt="https://graph.zalo.me/v2.0/me/friends/list",Zt="https://h5.zalo.me/apps/get-info",qt="https://h5.zalo.me/log/async",Yt=e=>({NONE:e?-2:0,WIFI:e?0:1,"2G":2,"3G":e?15:2,"4G":e?13:2}),Qt=0,Xt=-2e3,ei=-1400,ti=-1500,ii=-1401,oi=-2004,ni=-2005,ri={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"},ai={SUCCESS:{code:Qt,message:ri.SUCCESS},UNKNOWN_ERROR:{code:Xt,message:ri.UNKNOWN_ERROR},UNAUTHORIZED:{code:ii,message:ri.LOGIN_REQUIRED},FORBIDDEN:{code:-1403,message:ri.NOT_PERMISSION},CLIENT_NOT_SUPPORT:{code:-1404,message:ri.CLIENT_NOT_SUPPORT},DECODE_FAILED:{code:-2001,message:ri.DECODE_FAILED},TIME_OUT:{code:-1408,message:ri.TIME_OUT},USER_DENIED:{code:-2002,message:ri.USER_DENIED},USER_CANCEL:{code:-2003,message:ri.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:ai.USER_DENIED}},iOS:{"-2":{map_to:ai.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:ai.USER_DENIED}},iOS:{"-1":{map_to:ai.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:ni,message:ri.SAVE_IMAGE_FAIL},need_more_detail:!0},"-102":{map_to:{code:ni,message:ri.SAVE_IMAGE_FAIL},need_more_detail:!0}},iOS:{"-10":{map_to:{code:ni,message:ri.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:ai.USER_DENIED},"-101":{map_to:ai.USER_DENIED}},iOS:{"-1":{map_to:ai.USER_DENIED},"-10":{map_to:ai.USER_DENIED}}}},MP_OPEN_PROFILE_PICKER:{name:"action.mp.open.profile.picker",version_live:{iOS:432},error_list:{android:{"-101":{map_to:ai.USER_CANCEL}},iOS:{"-101":{map_to:ai.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:ai.USER_CANCEL},999:{map_to:{code:oi,message:ri.MEDIA_PICKER_FAIL},need_more_detail:!0}},iOS:{"-10":{map_to:{code:oi,message:ri.MEDIA_PICKER_FAIL}}}}},MP_CLOSE_LOADINGVIEW:{name:"action.mp.close.loadingview"}},ci={android:{"-4":ai.DECODE_FAILED,"-5":ai.CLIENT_NOT_SUPPORT,"-14":ai.TIME_OUT},iOS:{"-9":ai.DECODE_FAILED,"-5":ai.CLIENT_NOT_SUPPORT,"-14":ai.TIME_OUT}},li={android:12100571,iOS:400,wp:0,unknown:0},di={android:12100615,iOS:460,wp:0,unknown:0},ui=[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],pi=0,hi=3,vi=1,fi=0,gi="https://payment-mini.zalo.me/api/order/create",mi="https://payment-mini.zalo.me/api/transaction";class yi{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 _i=(e,t)=>e instanceof yi?((e,t)=>(e.api=t,e.toJSON()))(e,t):((e,t)=>e instanceof Error?new yi(Xt,e.message,t).toJSON():new yi(Xt,ri.UNKNOWN_ERROR,t).toJSON())(e,t),Si=(e,t)=>({code:Qt,message:t||ri.SUCCESS,data:e||{}}),Ei={badRequest:e=>new yi(ei,e),loginFailed:e=>new yi(ii,`${ri.LOGIN_FAILED}: ${e}`),loginRequired:()=>new yi(ii,ri.LOGIN_REQUIRED),missingParam:e=>new yi(ei,`Missing required argument: ${e}`),wrongTypeParam:(e,t,i)=>new yi(ei,`Wrong type of parameter '${e}'. Expected ${t}, but got ${i}`),cannotGetShareInfo:()=>new yi(ti,"Can not get app info to share"),lengthInvalid:e=>new yi(ei,`${e} length is invalid.`)};const Oi={encode:function(e){var t=[];for(var i in e)if(e.hasOwnProperty(i)){var o=e[i];if(void 0===o)return;if(null===o)return void t.push(i);t.push(encodeURIComponent(i)+"="+encodeURIComponent(o))}return t.join("&")},decode:function(e,t){var i={};if(""===e)return i;for(var o=e.split("&"),n=0;n<o.length;n++){var r=o[n].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:Oi.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 o=e[t],n=[t,o="object"==(void 0===o?"undefined":typeof o)?JSON.stringify(o):encodeURIComponent(o)].join("=");i.push(n)})),i.join("&")}},Ai=new RegExp("[\\u0300-\\u036f]","g"),Ti=new RegExp("[đ|Đ]","g"),bi=new RegExp("\\s","g"),Ci=Ut("zmp:utils:common"),wi=e=>{try{new URL(e)}catch(e){return!1}return!0},Ni=()=>navigator.userAgent||navigator.vendor||window.opera,Ii=()=>{const e=Ni().toLowerCase();return{isWP:/iemobile/.test(e),isAndroid:/android/i.test(e)&&!/iemobile/.test(e),isIOS:/iphone|ios|ipad|ipod/.test(e)&&!/iemobile/.test(e),isMobile:/android|iphone|ios|ipad|ipod|iemobile/.test(e),isZalo:/zalo/.test(e)}},Pi=e=>{const t=document.getElementsByTagName("meta");for(let 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=Ni().toLowerCase().split("zalo")[1];if(e){return e.replace(" ","").split("/")[1]||""}return""},Di=()=>{let e=Ii();return e.isWP?exports.PlatformType.wp:e.isAndroid?exports.PlatformType.android:e.isIOS?exports.PlatformType.iOS:exports.PlatformType.unknown},Ri=(e,t)=>{const i=t.toLowerCase(),o=i.split(/[<>]/i),n="array"===o[0];return!!("url"===i&&wi(e)||n&&("array"===i&&Array.isArray(e)||((e,t)=>Array.isArray(t)&&!t.some((t=>"url"===e?!wi(t):typeof t!==e)))(o[1],e))||!Array.isArray(e)&&typeof e===t)},Bi=e=>(e=>{let t=Lt(e);return t||(t=Wt(e),t)?t:Mt(e)})(e),ji=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)()},xi=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,o=0;o<i;o++)t.push(xi(e[o]));return"["+t.join(",")+"]"}if("object"==typeof e){for(var n in t=new Array,e)t.push('"'+n+'":'+xi(e[n]));return"{"+t.join(",")+"}"}return e.toString()},Ui=()=>{try{const e=Number(ki()),t=Di();return e>=li[t]}catch(e){return!0}},Mi=e=>JSON.stringify(e).replace(/"/g,'\\"').replace(/'/g,"'"),Li=e=>{try{if(e){Ci(e);const t=e.replace(/\\/g,"").replace(/'/g,"'");return Ci("formattedValue",t,JSON.parse(t),typeof JSON.parse(t)),JSON.parse(t)}return null}catch(t){return Ci("parse json error:",t),e}},Wi=(e,t,o,n,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",o),s.append("description",n||""),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 Ei.cannotGetShareInfo();return l.search=`${l.search}&zshareId=${u.data.shareId}`,Object.assign(Object.assign({},u.data),{shareableLink:l.href})})),zi=(e,t)=>i=>{if(!(Array.isArray(e)?e.some((e=>Ri(i,e))):Ri(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}},Ji=(e,t,o)=>i(void 0,void 0,void 0,(function*(){const i={appId:e,versionStatus:t};xt.isUndefined(o)||(i.currentVersion=o);const n=Oi.appendToUrl(Zt,i),r=yield fetch(n,{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 Fi=u((function(e){var t=Object.prototype.hasOwnProperty,i="~";function o(){}function n(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function r(e,t,o,r,a){if("function"!=typeof o)throw new TypeError("The listener must be a function");var s=new n(o,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 o:delete e._events[t]}function s(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(i=!1)),s.prototype.eventNames=function(){var e,o,n=[];if(0===this._eventsCount)return n;for(o in e=this._events)t.call(e,o)&&n.push(i?o.slice(1):o);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},s.prototype.listeners=function(e){var t=i?i+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var n=0,r=o.length,a=new Array(r);n<r;n++)a[n]=o[n].fn;return a},s.prototype.listenerCount=function(e){var t=i?i+e:e,o=this._events[t];return o?o.fn?1:o.length:0},s.prototype.emit=function(e,t,o,n,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,o),!0;case 4:return d.fn.call(d.context,t,o,n),!0;case 5:return d.fn.call(d.context,t,o,n,r),!0;case 6:return d.fn.call(d.context,t,o,n,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,o);break;case 4:d[l].fn.call(d[l].context,t,o,n);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,o,n){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||n&&!s.once||o&&s.context!==o||a(this,r);else{for(var c=0,l=[],d=s.length;c<d;c++)(s[c].fn!==t||n&&!s[c].once||o&&s[c].context!==o)&&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 o,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 Ki extends Fi{constructor(){super(),this.debug=Ut("zmp:event-emitter")}static getInstance(){return Ki.instance||(Ki.instance=new Ki),Ki.instance}h5ConfirmHandleEvent(e,t,i){ZaloJavaScriptInterface.jsH5EventCallback(e,t,i||"")}on(e,t,i){this.debug(`register ${e}: ${i}`);return super.on(e,((o,n)=>{this.h5ConfirmHandleEvent(o,e,i),t(n)}),i)}once(e,t,i){this.debug(`register once ${e}: ${i}`);return super.once(e,((o,n)=>{this.h5ConfirmHandleEvent(o,e,i),t(n)}),i)}}var Hi,Gi,$i,Vi,Zi;class qi{static getVersion(){return"2.23.2-1"}static getSystemInfo(){return{version:Pi("version-id")||"",apiVersion:"2.23.2-1",zaloVersion:ki(),platform:Di(),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 Ji(e,0,t.version)}))}}class Yi{static setNavigationBarTitle(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(si.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(si.CHANGE_ACTIONBAR,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarLeftButton(e,t){return i(this,void 0,void 0,(function*(){let i,o;xt.isString(e)&&(i="none"===e||"home"===e?hi:pi,o="home"===e||"both"===e?vi:fi),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(o)?o:e.homeConfig.enable})}))),yield this.getJSBridge().callNative(si.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(si.CHANGE_ACTIONBAR,{data:e},{haveTimeout:!1})}))}}class Qi{static setBackgroundColor(e){return i(this,void 0,void 0,(function*(){xt.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 Xi{constructor(e,t,i,o){this.title=o,this.severity=t;const n=new Date;if(this.time=n.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(" ")}}Hi=new WeakMap,Gi=new WeakMap,$i=new WeakMap,Vi=new WeakMap,Zi=new WeakMap;const eo=new class{constructor(){Hi.set(this,3),Gi.set(this,["none","error","warn","info"]),$i.set(this,"[zmp] > "),Vi.set(this,{error:0,warn:0,info:0,firstError:null,lastError:null}),Zi.set(this,((e,t,i)=>{o(this,Vi,"f")[o(this,Gi,"f")[e]]++;const r=o(this,Gi,"f")[e];if(n(this,$i,o(this,$i,"f")+("string"!=typeof t?new Xi(t,r,e,i).toString():t),"f"),!(e>o(this,Hi,"f")))switch(e){case 1:console.error(o(this,$i,"f"));break;case 2:console.warn(o(this,$i,"f"));break;case 3:console.info(o(this,$i,"f"));break;default:throw new Error("internal")}}))}setLogLevel(e){n(this,Hi,e,"f")}info(e){o(this,Zi,"f").call(this,3,e)}warn(e,t){o(this,Zi,"f").call(this,2,e,t)}error(e,t){o(this,Zi,"f").call(this,1,e,t)}getMetrics(){return o(this,Vi,"f")}};class to{static setDeviceOrientation(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(si.CHANGE_AUTOROTATE,{autoRotate:exports.OrientationType[e.rotate]})}))}static getNetworkType(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(si.WEBVIEW_NETWORKTYPE,{url:window.location.href,featureId:""}).then((e=>{const t=e.network;let i;const o=Ii().isAndroid;switch(t){case Yt(o).NONE:i=exports.NetworkType.none;break;case Yt(o).WIFI:i=exports.NetworkType.wifi;break;case Yt(o)["2G"]:case Yt(o)["3G"]:case Yt(o)["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 o={isConnected:"CONNECTED"===i,networkType:t&&t.networkType};e(o)})).catch((e=>{eo.error(e,"onNetworkStatusChange")}))}))}))}static startBeaconDiscovery(e){var t,o,n,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===(o=null==e?void 0:e.scanConfig)||void 0===o?void 0:o.timeBetweenScan)?e.scanConfig.timeBetweenScan:1e4,beacon_timeout:xt.isNumber(null===(n=null==e?void 0:e.scanConfig)||void 0===n?void 0:n.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(si.SCAN_IBEACON,Object.assign({},i)),!0}))}static stopBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(si.SCAN_IBEACON,Object.assign({},{subaction:2})),!0}))}static getBeacons(e){return i(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 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(si.OPEN_QR,{skipOpenLink:!0})}))}static showToast(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(si.SHOW_TOAST,{toast:e.message})}))}static hideKeyboard(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(si.HIDE_KEYBOARD,{})}))}static openPhone(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(si.OPEN_PHONE,{phoneNum:e.phoneNumber,phoneCode:e.phoneNumber})}))}static openSMS(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(si.OPEN_SMS,{content:e.content,phoneCode:e.phoneNumber})}))}static keepScreen(e){return i(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 i(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,o,n;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===(o=null==e?void 0:e.data)||void 0===o?void 0:o.error_message,payToken:null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.pay_token}}}))}))}static checkStateBioAuthentication(e){return i(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(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(si.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(si.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(si.OPEN_APPSTORE,e)}))}}var io,oo,no;class ro{constructor(e){io.set(this,localStorage),oo.set(this,void 0),no.set(this,void 0),Ii(),n(this,no,{keys:new Set,currentSize:0,limitSize:5242880},"f"),n(this,oo,e,"f"),this.findAllCurrentDataByApp(e)}findAllCurrentDataByApp(e){try{let t;for(t in o(this,io,"f")){if(e){if(t.split("_")[0]!==e)continue}o(this,no,"f").keys.add(t)}}catch(e){eo.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,oo,"f")&&(e=`${o(this,oo,"f")}_${e}`),o(this,no,"f").keys.has(e)?o(this,io,"f").getItem(e):null}set(e){return i(this,void 0,void 0,(function*(){return Object.entries(e).forEach((([e,t])=>{this.setSync(e,t.replace(/\\"/g,'"'))})),Promise.resolve({errorKeys:[]})}))}setSync(e,t){o(this,oo,"f")&&(e=`${o(this,oo,"f")}_${e}`),o(this,io,"f").setItem(e,t),o(this,no,"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,o,n=0;for(o in e){const r=o.split("_")[0];e.hasOwnProperty(o)&&(t&&r!==t||(i=2*(e[o].length+o.length),n+=i))}return n})(o(this,io,"f"),o(this,oo,"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){o(this,oo,"f")&&(e=`${o(this,oo,"f")}_${e}`),o(this,no,"f").keys.has(e)&&(o(this,io,"f").removeItem(e),o(this,no,"f").keys.delete(e))}clear(){return i(this,void 0,void 0,(function*(){return Promise.resolve(this.clearSync())}))}clearSync(){o(this,no,"f").keys.forEach((e=>{o(this,oo,"f")&&e.indexOf(o(this,oo,"f"))<0||(o(this,io,"f").removeItem(e),o(this,no,"f").keys.delete(e))}))}}io=new WeakMap,oo=new WeakMap,no=new WeakMap;var ao={},so=function(e,t,i){var o=t||"default";return function(){var t=o in ao?ao[o](e,i):e;return t.apply(this,arguments)}};so.setWrapper=function(e){var t=arguments.length<=1||void 0===arguments[1]?"default":arguments[1];ao[t]=e};var co={error:{code:1,error_subcode:1357046,message:"Received Invalid JSON reply.",type:"http"}};function lo(e){try{return null===e?co:JSON.parse(e)}catch(e){return co}}var uo,po,ho,vo,fo,go,mo,yo,_o,So,Eo,Oo,Ao,To,bo,Co,wo,No,Io,Po,ko,Do,Ro,Bo,jo,xo,Uo,Mo,Lo,Wo,zo,Jo,Fo,Ko={execute:function(e,t,i,o){i.suppress_http_code=1;var n=Oi.encode(i);"post"!=t&&(e=Oi.appendToUrl(e,n),n="");var r=function(e,t){if(!self.XMLHttpRequest)return null;var i=new XMLHttpRequest,o=function(){};if(!("withCredentials"in i))return null;i.open(e,t,!0),i.setRequestHeader("Content-type","application/x-www-form-urlencoded");var n={send:function(e){i.send(e)}},r=so((function(){r=o,"onload"in n&&n.onload(i)}),"entry","XMLHttpRequest:load"),a=so((function(){a=o,"onerror"in n&&n.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())},n}(t,e);return!!r&&(r.onload=function(e){o(lo(e.responseText))},r.onerror=function(e){e.responseText?o(lo(e.responseText)):o({error:{code:1,error_subcode:1357045,message:"unknown error (empty response)",status:e.status,type:"http"}})},r.send(n),!0)}};class Ho extends Fi{constructor(){super(),uo.add(this),this.debug=Ut("zmp:ZaloJSBridge"),this.events=Ki.getInstance(),this._accessTk=Bi("zacc_session")||"DEFAULT_ACCESS_TOKEN",this._jsAccessTk=Bi("zlink3rd")||"DEFAULT_JS_TOKEN",this.results=[],this._userAgent=Ni(),this._device=Ii(),this.isJumped=!1,po.set(this,void 0),ho.set(this,[]),vo.set(this,void 0),this.getCookie=e=>i(this,void 0,void 0,(function*(){var t;yield this.jump();return null===(t=o(this,ho,"f"))||void 0===t?void 0:t.find((t=>t.name===e))})),this.getCookieSync=e=>{var t;return null===(t=o(this,ho,"f"))||void 0===t?void 0:t.find((t=>t.name===e))},this._jsCallFuncCallbacks={},n(this,vo,{},"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),n(this,po,0,"f")}static getInstance(){return Ho.instance||(Ho.instance=new Ho),Ho.instance}set accessTk(e){this._accessTk=e}set jsAccessTk(e){this._jsAccessTk=e}jump(){return i(this,void 0,void 0,(function*(){const e=this;return n(this,po,+o(this,po,"f")+1,"f"),o(this,po,"f")>1&&(yield function(){return i(this,void 0,void 0,(function*(){return yield new Promise((t=>{const i=setInterval((()=>{(o(e,po,"f")<=1||e.isJumped)&&(t("done"),clearInterval(i))}),200)}))}))}()),new Promise(((e,t)=>{this.isJumped?(e(o(this,ho,"f")),n(this,po,+o(this,po,"f")-1,"f")):(this.debug("******** call jump ********"),this.callNative(si.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};o(this,vo,"f")[t]||(o(this,vo,"f")[t]={permission:!1,support:!1}),o(this,vo,"f")[t].permission=1===i.perm}));const a=i.find((e=>e.name===Kt.JS_TOKEN));a&&(this.jsAccessTk=a.value,window.ZJSBridge.setJSToken&&window.ZJSBridge.setJSToken(a.value)),n(this,ho,i,"f"),this.isJumped=!0,e(i)})).catch((e=>{this.isJumped=!1,t(e)})).finally((()=>{n(this,po,+o(this,po,"f")-1,"f")})))}))}))}sendLogData(e){try{const t=e.map((e=>({action:e.action,error:e.error})));Ko.execute(qt,"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=ji(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,o=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,i)}catch(e){console.error("Call callback error",e)}o&&clearTimeout(o),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=ji(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,o=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,i)}catch(e){console.error("Call callback error",e)}o&&clearTimeout(o)}}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 o=Li(i);this.debug(o);const n=this.handleEventData(t,o);this.events.emit(t,e,n)}handleEventData(e,t){try{switch(e){case exports.Events.OpenApp:const{url:e}=t,i=new URL(e),o=i.pathname.split(`/zapps/${Jt}`)[1];return{path:`${o||"/"}${i.search}`};default:return t}}catch(e){return t}}defaultCallback(e){null!=e&&(e=ji(e))}callNative(e,t,n){return this.debug(e.name,t),new Promise(((r,a)=>i(this,void 0,void 0,(function*(){const s=t=>i(this,void 0,void 0,(function*(){var i,o,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 n=new yi(t.error_code,t.error_message);const r=Di();if(e===si.JUMP_LOGIN)n=new yi(Xt,`Can not get auth code: ${t.error_message}`);else if(this.isJumped||e.skip_jump){if("permission required!"===String(n.message).toLowerCase()||"no permission!"===String(n.message).toLowerCase())n=new yi(ai.FORBIDDEN.code,ai.FORBIDDEN.message);else if(ci[r][t.error_code])n=new yi(ci[r][t.error_code].code,ci[r][t.error_code].message);else if(null===(o=null===(i=e.error_list)||void 0===i?void 0:i[r])||void 0===o?void 0:o[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}`),n=new yi(e.error_list[r][String(t.error_code)].map_to.code,i)}}else n=new yi(ai.UNAUTHORIZED.code,ai.UNAUTHORIZED.message);return a(n)}if(null==n?void 0:n.successCallback){const e=yield n.successCallback(t.data);return r(e)}r(t.data||{})}catch(e){return a(e)}}));e.skip_jump||(yield this.jump());const c=Ii().isIOS,l=(e=>{var t;const i=ki(),o=(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>=o})(e);if(c&&!l){const e=new yi(-5,"Client isn't support this action");return a(e)}(null==n?void 0:n.delay)?setTimeout((()=>{o(this,uo,"m",fo).call(this,e,t,s,null==n?void 0:n.isMultiCallback,null==n?void 0:n.nRetry,null==n?void 0:n.haveTimeout)}),n.delay):o(this,uo,"m",fo).call(this,e,t,s,null==n?void 0:n.isMultiCallback,null==n?void 0:n.nRetry,null==n?void 0:n.haveTimeout)}))))}}po=new WeakMap,ho=new WeakMap,vo=new WeakMap,uo=new WeakSet,fo=function e(t,i,n,r=!1,a=3,s=!0){try{const c=t.name,l=((e="")=>`${e.normalize("NFD").replace(Ai,"").replace(Ti,"d").replace(bi,"").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={}),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=xi(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,uo,"m",e).call(this,t,i,n,r,a)}),500)}}catch(e){console.log("jsCall","error",e)}return!1};class Go{constructor(e){go.set(this,void 0),mo.set(this,void 0),yo.set(this,void 0),n(this,mo,{keys:new Set,currentSize:0,limitSize:5242880},"f"),n(this,go,e,"f"),n(this,yo,Ho.getInstance(),"f")}get(e){return i(this,void 0,void 0,(function*(){return yield o(this,yo,"f").callNative(si.ZBROWSER_MPDS,{mpds_action:"mpds.get",mpds_data:{keys:e},appId:o(this,go,"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 o(this,yo,"f").callNative(si.ZBROWSER_MPDS,{mpds_action:"mpds.set",mpds_data:{map:e},appId:o(this,go,"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 o(this,yo,"f").callNative(si.ZBROWSER_MPDS,{mpds_action:"mpds.get.size",mpds_data:{},appId:o(this,go,"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 o(this,yo,"f").callNative(si.ZBROWSER_MPDS,{mpds_action:"mpds.remove.key",mpds_data:{keys:e},appId:o(this,go,"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 o(this,yo,"f").callNative(si.ZBROWSER_MPDS,{mpds_action:"mpds.clear.appData",mpds_data:{},appId:o(this,go,"f")})}))}}go=new WeakMap,mo=new WeakMap,yo=new WeakMap;class $o{getDataFromStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance(),i=yield t.get(e),o={};return i.forEach(((e,t)=>{o[t]=Li(e)})),o}))}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]=Mi(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 Vo extends $o{constructor(e){super(),_o.set(this,void 0),n(this,_o,e,"f")}getInstance(){return new ro(o(this,_o,"f"))}}_o=new WeakMap;class Zo extends $o{constructor(e){super(),So.set(this,void 0),n(this,So,e,"f")}getInstance(){return new Go(o(this,So,"f"))}}So=new WeakMap;class qo{static setStorage(e){return i(this,void 0,void 0,(function*(){let t=new Vo(this.getAppId());return Ui()&&(t=new Zo(this.getAppId())),yield t.putDataToStorage(e.data)}))}static getStorage(e){return i(this,void 0,void 0,(function*(){let t=new Vo(this.getAppId());Ui()&&(t=new Zo(this.getAppId()));return yield t.getDataFromStorage(e.keys)}))}static getStorageInfo(e){return i(this,void 0,void 0,(function*(){let e=new Vo(this.getAppId());return Ui()&&(e=new Zo(this.getAppId())),yield e.getStorageInfo()}))}static removeStorage(e){return i(this,void 0,void 0,(function*(){let t=new Vo(this.getAppId());return Ui()&&(t=new Zo(this.getAppId())),yield t.removeDataFromStorage(e.keys)}))}static clearStorage(e={}){return i(this,void 0,void 0,(function*(){let e=new Vo(this.getAppId());Ui()&&(e=new Zo(this.getAppId())),yield e.clearStorage()}))}}class Yo{static getUserInfo(e){return i(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();let o="id,name,picture";(null==e?void 0:e.avatarType)&&(o=`${o}.type(${null==e?void 0:e.avatarType})`);return{userInfo:yield fetch(`${Ht}?fields=${o}`,{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(si.MP_GET_NUMBER,{},{isMultiCallback:!0,successCallback:e=>{const t={number:e};return Promise.resolve(t)},delay:this.isIOS?400:0})}))}}class Qo{static closeApp(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(si.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)||{},o=Object.entries(i).map((function([e,t]){return[e,t].join("=")})).join("&");let n;try{n=yield Ji(t,0)}catch(e){}const r={appId:t};n&&(r.appName=n.name,r.appAvtUrl=n.logoUrl),yield this.getJSBridge().callNative(si.OPEN_MP,{mpUrl:`https://h5.zdn.vn/zapps/${t}/${o.length>0?"?"+o:""}`,mpInfo:r})}))}static openWebview(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(si.OPEN_INAPP,{url:e})}))}static closeLoading(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(si.MP_CLOSE_LOADINGVIEW,{at:(new Date).getTime(),when:e,url:location.href})}))}}class Xo{static getLocation(e){return i(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 i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(si.QUERY_LOCATION_HIDE,{title:e.title,touserid:e.toUserId,zapp:this.getZAppId()})}))}}class en{static requestCameraPermission(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(si.REQUEST_PERMISSION_CAMERA,{},{successCallback:e=>Promise.resolve({userAllow:(null==e?void 0:e.error_code)>=0,message:null==e?void 0:e.error_message})})}))}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(si.SAVE_IMAGE_GALLERY,Object.assign({},t))}))}}class tn{static viewOAQr(e){return i(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(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(si.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(si.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(si.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(si.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(si.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 o=[];const n=ki(),r=Di();n>=di[r]&&(i="multi_image"),Array.isArray(e.data.imageUrls)&&e.data.imageUrls.length>0?o=e.data.imageUrls:o.push(e.data.imageUrl),t={photoUrls:o,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 Wi(this.getAppId(),a||"",e.data.title||"",e.data.description||"",e.data.thumbnail||"",e.data.path);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}}}return yield this.getJSBridge().callNative(si.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,o){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(si.CREATE_SHORTCUT,{url:e,title:t,iconUrl:o})}))}static openProfilePicker(e){return i(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(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(si.GET_SUPPORTED_ACTIONS,{},{isMultiCallback:!1,successCallback:e=>{const t=Di();if(Array.isArray(e.actions)&&e.actions.length>0){const t=Object.keys(si).filter((e=>si[e].skip_jump)),i={actions:[...e.actions,...t]};return Promise.resolve(i)}if(t===exports.PlatformType.iOS){const e={actions:ui};return Promise.resolve(e)}}})}))}static openMediaPicker(e,t,o,n,r,a){return i(this,void 0,void 0,(function*(){const i={type:0,url:t,maxSize:o||1048576};return yield this.getJSBridge().callNative(si.PICK_MEDIA,{media_type:exports.MediaPickerType[e],edit_view:Object.assign(Object.assign({},{enable:1,aspect_ratio:"1:1"}),n),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(si.OPEN_OUTAPP,{url:e})}))}}class on{static getRouteParams(){let e={};const t=window.location.href;try{let i=new URL(t).searchParams.toString();i&&(e=Oi.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(si.WEBVIEW_SET_RESULT,{result:Mi(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 nn{constructor(){var e,t,r,a,s,c,l,d,u,p,h,v,f,g,m,y,_;Eo.set(this,zt),Oo.set(this,Jt),Ao.set(this,Ft),To.set(this,void 0),bo.set(this,void 0),Co.set(this,void 0),wo.set(this,null),No.set(this,{timer:{getToken:0}}),Io.set(this,void 0),Po.set(this,void 0),ko.set(this,void 0),Do.set(this,void 0),Ro.set(this,void 0),this.events=Ki.getInstance(),this.isIOS=Ii().isIOS,Bo.set(this,void 0),jo.set(this,void 0),xo.set(this,void 0),this.getActionBarConfig=()=>o(this,Bo,"f"),this.setActionBarConfig=e=>{n(this,Bo,e(o(this,Bo,"f")),"f")},this.getAuthCode=()=>i(this,void 0,void 0,(function*(){var e,t;return{authCode:null===(e=yield o(this,Io,"f").getCookie(Kt.ZOAUTH))||void 0===e?void 0:e.value,authCodeVerify:null===(t=yield o(this,Io,"f").getCookie(Kt.ZOAUTH_VRF))||void 0===t?void 0:t.value}})),this.setAccessToken=e=>{n(this,xo,!1,"f"),n(this,Co,e,"f"),o(this,Io,"f").accessTk=e,window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(e)},this.getVersion=qi.getVersion,this.getSystemInfo=qi.getSystemInfo,this.setNavigationBarTitle=Yi.setNavigationBarTitle,this.setNavigationBarColor=Yi.setNavigationBarColor,this.setNavigationBarLeftButton=Yi.setNavigationBarLeftButton,this.setBackgroundColor=Qi.setBackgroundColor,this.setDeviceOrientation=to.setDeviceOrientation,this.setStorage=qo.setStorage,this.getStorage=qo.getStorage,this.getStorageInfo=qo.getStorageInfo,this.removeStorage=qo.removeStorage,this.clearStorage=qo.clearStorage,this.getUserInfo=Yo.getUserInfo,this.getNetworkType=to.getNetworkType,this.onNetworkStatusChange=to.onNetworkStatusChange,this.startBeaconDiscovery=to.startBeaconDiscovery,this.stopBeaconDiscovery=to.stopBeaconDiscovery,this.getBeacons=to.getBeacons,this.closeApp=Qo.closeApp,this.getLocation=Xo.getLocation,this.stopBluetoothDevicesDiscovery=to.stopBluetoothDevicesDiscovery,this.startBluetoothDevicesDiscovery=to.stopBluetoothDevicesDiscovery,this.openBluetoothAdapter=to.openBluetoothAdapter,this.onBluetoothDeviceFound=to.onBluetoothDeviceFound,this.onBluetoothAdapterStateChange=to.onBluetoothAdapterStateChange,this.getConnectedBluetoothDevices=to.getConnectedBluetoothDevices,this.getBluetoothDevices=to.getBluetoothDevices,this.getBluetoothAdapterState=to.getBluetoothAdapterState,this.closeBluetoothAdapter=to.closeBluetoothAdapter,this.scanQRCode=to.scanQRCode,this.openProfile=tn.openProfile,this.openChat=tn.openChat,this.openPostFeed=tn.openPostFeed,this.followOA=tn.followOA,this.unFollowOA=tn.unfollowOA,this.openShareSheet=tn.openShareSheet,this.requestCameraPermission=en.requestCameraPermission,this.createShortcut=tn.createShortcut,this.openBioAuthentication=to.openBioAuthentication,this.checkStateBioAuthentication=to.checkStateBioAuthentication,this.sendLocation=Xo.sendLocation,this.showToast=to.showToast,this.hideKeyboard=to.hideKeyboard,this.openPhone=to.openPhone,this.openSMS=to.openSMS,this.viewOAQr=tn.viewOAQr,this.keepScreen=to.keepScreen,this.saveImageToPhotosAlbum=en.saveImageToPhotosAlbum,this.openMiniApp=Qo.openMiniApp,this.vibrate=to.vibrate,this.openWebview=Qo.openWebview,this.getRouteParams=on.getRouteParams,this.getAppInfo=qi.getAppInfo,this.sendDataToPreviousMiniApp=on.sendDataToPreviousMiniApp,this.onCallbackData=on.onCallbackData,this.getPhoneNumber=Yo.getPhoneNumber,this.openProfilePicker=tn.openProfilePicker,Uo.set(this,tn.getActionsSupported),this.connectWifi=to.connectWifi,this.openMediaPicker=tn.openMediaPicker,this.openOutApp=tn.openOutApp,this.closeLoading=Qo.closeLoading,this.openAppStore=to.openAppStore,n(this,To,null,"f"),n(this,bo,null,"f"),n(this,Co,null,"f"),this.isShowNavBar=!0,n(this,Po,(new Date).getTime(),"f"),n(this,ko,0,"f"),n(this,Do,"","f"),n(this,Ro,null,"f"),n(this,Io,Ho.getInstance(),"f"),n(this,jo,0,"f"),n(this,xo,!1,"f");const S="home"===(null===(t=null===(e=o(this,Ao,"f"))||void 0===e?void 0:e.app)||void 0===t?void 0:t.leftButton)||"both"===(null===(a=null===(r=o(this,Ao,"f"))||void 0===r?void 0:r.app)||void 0===a?void 0:a.leftButton)?vi:fi,E=new URL(location.href),O=xt.isString(null===(c=null===(s=o(this,Ao,"f"))||void 0===s?void 0:s.app)||void 0===c?void 0:c.headerColor)&&(null===(u=null===(d=null===(l=o(this,Ao,"f"))||void 0===l?void 0:l.app)||void 0===d?void 0:d.headerColor)||void 0===u?void 0:u.length)>0?5:6,A="none"===(null===(h=null===(p=o(this,Ao,"f"))||void 0===p?void 0:p.app)||void 0===h?void 0:h.leftButton)||"home"===(null===(f=null===(v=o(this,Ao,"f"))||void 0===v?void 0:v.app)||void 0===f?void 0:f.leftButton)?hi:pi;n(this,Bo,{actionbarType:O,buttonType:A,dataConfig:{backgroundColor:(null===(m=null===(g=o(this,Ao,"f"))||void 0===g?void 0:g.app)||void 0===m?void 0:m.headerColor)||"",textColor:(null===(_=null===(y=o(this,Ao,"f"))||void 0===y?void 0:y.app)||void 0===_?void 0:_.textColor)||"",viewInLeftType:A,confirmToExit:1},homeConfig:{enable:S,url:`https://h5.zdn.vn/zapps/${this.getAppId()}/${E.search}`}},"f")}static getInstance(){return nn.instance||(nn.instance=new nn),nn.instance}getLoginStatus(){return xt.isString(o(this,Co,"f"))&&o(this,Co,"f").length>0}getAppId(){return o(this,Oo,"f")}getZAppId(){return o(this,Eo,"f")}getDeviceId(){var e;return i(this,void 0,void 0,(function*(){return null===(e=yield o(this,Io,"f").getCookie(Kt.DEVICE_ID))||void 0===e?void 0:e.value}))}getDeviceIdSync(){var e;return null===(e=o(this,Io,"f").getCookieSync(Kt.DEVICE_ID))||void 0===e?void 0:e.value}getContext(){var e,t;return i(this,void 0,void 0,(function*(){const i=null===(e=yield o(this,Io,"f").getCookie(Kt.CONTEXT_ID))||void 0===e?void 0:e.value;return{type:null===(t=yield o(this,Io,"f").getCookie(Kt.CONTEXT_TYPE))||void 0===t?void 0:t.value,id:i}}))}getContextSync(){var e,t;const i=null===(e=o(this,Io,"f").getCookieSync(Kt.CONTEXT_ID))||void 0===e?void 0:e.value;return{type:null===(t=o(this,Io,"f").getCookieSync(Kt.CONTEXT_TYPE))||void 0===t?void 0:t.value,id:i}}getJSBridge(){return o(this,Io,"f")}login(e){return i(this,void 0,void 0,(function*(){n(this,xo,!0,"f");let e=(new Date).getTime()-o(this,Po,"f");const t=this;if(n(this,jo,+o(this,jo,"f")+1,"f"),o(this,jo,"f")>1&&(yield function(){return i(this,void 0,void 0,(function*(){return yield new Promise((e=>{const i=setInterval((()=>{(o(t,jo,"f")<=1||o(t,Co,"f"))&&(e("done"),clearInterval(i))}),200)}))}))}()),e=(new Date).getTime()-o(this,Po,"f"),o(this,Co,"f")&&e<o(this,ko,"f"))return n(this,jo,+o(this,jo,"f")-1,"f"),o(this,Co,"f");const r=yield(yield this.getAuthCode()).authCode,a=yield(yield this.getAuthCode()).authCodeVerify;if(r){if(n(this,To,r,"f"),a?(n(this,bo,a,"f"),yield this.loginZaloV4()):yield this.loginZaloV3(),n(this,jo,+o(this,jo,"f")-1,"f"),!o(this,Co,"f"))throw Ei.loginFailed("Invalid authorization code");return o(this,Co,"f")}throw n(this,jo,+o(this,jo,"f")-1,"f"),Ei.loginFailed("Zalo app has not been activated")}))}loginZaloV3(){return i(this,void 0,void 0,(function*(){return yield fetch(`${$t}?app_id=${o(this,Eo,"f")}&redirect_uri=https://h5.zdn.vn/zapps/${o(this,Oo,"f")}/&code=${o(this,To,"f")}&isSDK=true`).then((e=>i(this,void 0,void 0,(function*(){let t=yield e.json();if(t.access_token){n(this,Co,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return n(this,ko,e,"f"),n(this,Po,(new Date).getTime(),"f"),o(this,Io,"f").accessTk=o(this,Co,"f")||"",window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(o(this,Co,"f")||""),o(this,Co,"f")}return null}))))}))}loginZaloV4(){return i(this,void 0,void 0,(function*(){const e=new URLSearchParams;e.append("app_id",o(this,Oo,"f")),e.append("code",o(this,To,"f")||""),e.append("code_verifier",o(this,bo,"f")||""),xt.isNull(o(this,wo,"f"))?e.append("grant_type","authorization_code"):(e.append("grant_type","refresh_token"),e.append("refresh_token",o(this,wo,"f")||""));return yield fetch(Gt,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&&n(this,wo,t.refresh_token,"f"),t.access_token){n(this,Co,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return n(this,ko,e,"f"),n(this,Po,(new Date).getTime(),"f"),o(this,Io,"f").accessTk=o(this,Co,"f")||"",window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(o(this,Co,"f")||""),o(this,Co,"f")}return null}))))}))}getAccessToken(e){return i(this,void 0,void 0,(function*(){const e=(new Date).getTime()-o(this,Po,"f");if(o(this,xo,"f"))return o(this,Co,"f")&&e<o(this,ko,"f")?o(this,Co,"f"):(n(this,Co,"","f"),yield this.login());if(!o(this,Co,"f"))throw Ei.loginRequired();return o(this,Co,"f")}))}}Eo=new WeakMap,Oo=new WeakMap,Ao=new WeakMap,To=new WeakMap,bo=new WeakMap,Co=new WeakMap,wo=new WeakMap,No=new WeakMap,Io=new WeakMap,Po=new WeakMap,ko=new WeakMap,Do=new WeakMap,Ro=new WeakMap,Bo=new WeakMap,jo=new WeakMap,xo=new WeakMap,Uo=new WeakMap;class rn{constructor(){Mo.set(this,zt),Lo.set(this,Ft),Wo.set(this,"DEFAULT ZOAUTH"),zo.set(this,"DEFAULT ACCESS TOKEN"),Jo.set(this,{timer:{getToken:0}}),Fo.set(this,!1),this.getLoginStatus=()=>o(this,Fo,"f"),this.getAppId=()=>o(this,Mo,"f"),this.getDeviceId=()=>i(this,void 0,void 0,(function*(){return Promise.resolve("")})),this.getDeviceIdSync=()=>"",this.login=()=>(n(this,Fo,!0,"f"),Promise.resolve(o(this,Wo,"f"))),this.getAccessToken=()=>Promise.resolve(o(this,zo,"f")),this.getVersion=qi.getVersion,this.getSystemInfo=qi.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 Vo(this.getAppId());return yield t.putDataToStorage(e.data),{errorKeys:[]}})),this.getStorage=e=>i(this,void 0,void 0,(function*(){const t=new Vo(this.getAppId());return yield t.getDataFromStorage(e.keys)})),this.getStorageInfo=e=>i(this,void 0,void 0,(function*(){const e=new Vo(this.getAppId());return yield e.getStorageInfo()})),this.removeStorage=e=>i(this,void 0,void 0,(function*(){const t=new Vo(this.getAppId());return yield t.removeDataFromStorage(e.keys)})),this.clearStorage=e=>i(this,void 0,void 0,(function*(){const e=new Vo(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=on.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(),this.getAuthCode=()=>Promise.resolve({authCode:"",authCodeVerify:""})}getContext(){return i(this,void 0,void 0,(function*(){return Promise.resolve(null)}))}getContextSync(){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,o){throw new Error("Method not implemented.")}removeAllListeners(e){throw new Error("Method not implemented.")}openMediaPicker(e,t,i,o,n,r){return console.warn("This api only works on zalo app"),Promise.resolve({data:""})}setAccessToken(e){}}Mo=new WeakMap,Lo=new WeakMap,Wo=new WeakMap,zo=new WeakMap,Jo=new WeakMap,Fo=new WeakMap;const an=Symbol("required"),sn=Symbol("checkType"),cn=(e,t)=>(i,o,n)=>{let r=Reflect.getOwnMetadata(an,i,o)||[];r.push({parameterIndex:n,fields:e,option:t}),Reflect.defineMetadata(an,r,i,o)},ln=(e,t,i)=>(o,n,r)=>{let a=Reflect.getOwnMetadata(sn,o,n)||[];a.push({parameterIndex:r,type:e,properties:t,defaultValue:i}),Reflect.defineMetadata(sn,a,o,n)};function dn(e,t){Reflect.getMetadataKeys(e).map((i=>{const o=Reflect.getMetadata(i,e);Reflect.defineMetadata(i,o,t)}))}const un=(e,t={})=>i=>{var o;let n=Object.getOwnPropertyDescriptors(i.prototype);if(t.deep){let e=Object.getPrototypeOf(i);for(;e.prototype;){const t=Object.getOwnPropertyDescriptors(e.prototype);n=Object.assign(Object.assign({},t),n),e=Object.getPrototypeOf(e)}}for(const[r,a]of Object.entries(n)){const n="function"==typeof a.value&&"constructor"!=r;if(null===(o=t.exclude)||void 0===o?void 0:o.includes(r))continue;if(t.excludePrefix&&r.startsWith(t.excludePrefix))continue;if(!n)continue;const s=a.value;e(i,r,a),s!=a.value&&dn(s,a.value),Object.defineProperty(i.prototype,r,a)}},pn=(e,t,i)=>{const o=i.value,n=function(e){return e.toString().match(/\(.*?\)/)[0].replace(/[()]/gi,"").replace(/\s/gi,"").split(",")}(o);return i.value=function(...i){try{const r=Reflect.getOwnMetadata(an,e.prototype,t),a=Reflect.getOwnMetadata(sn,e.prototype,t);a&&a.forEach((e=>{const{parameterIndex:t,type:o,properties:r,defaultValue:a}=e;let s=i[t],c=n[t];const l=typeof s;if(!xt.isUndefined(s)){if(!Ri(s,o))throw Ei.wrongTypeParam(c,o,Array.isArray(s)?"array":null===s?"null":l);"object"===o&&Object.entries(r).forEach((([e,o])=>{const n=e.split("?")[0],r=xt.get(s,n);if(xt.isUndefined(r)||xt.isNull(r)){if(!e.includes("?"))throw Ei.missingParam(e);xt.get(s,n.split(".")[0])||!a||xt.isUndefined(xt.get(a,n))||xt.set(i[t],n,xt.get(a,n))}else if(xt.isFunction(o)){const e=o(r);if(e&&e.error)throw Ei.wrongTypeParam(`${c}.${n}`,e.errorMessage,typeof r)}}))}})),r&&r.forEach((e=>{const{parameterIndex:t,option:o,fields:n}=e,r=i[t],a=null==o?void 0:o.if,s=null==o?void 0:o.defaultValue;let c=!0;a&&(c=Object.keys(a).every((e=>xt.get(r,e)===a[e]))),c&&n.forEach((e=>{const o=e=>{let o=!1;return xt.isEmpty(xt.get(r,e))&&(xt.isUndefined(xt.get(s,e))||xt.set(i[t],e,xt.get(s,e)),o=!0),o};if(Array.isArray(e)&&e.length>0&&e.every(o))throw Ei.missingParam(e.join(" or "));if(xt.isString(e)&&o(e))throw Ei.missingParam(e)}))}));const s=o.call(this,...i);if(xt.isPromise(s)){const{success:e,fail:o}=Array.isArray(i)&&i.length>0&&i[0];return new Promise(((i,n)=>{s.then((t=>{!xt.isNull(e)&&xt.isFunction(e)?e.call(null,t,this):i(s)})).catch((e=>{const i=_i(e,t);!xt.isNull(o)&&xt.isFunction(o)?o.call(null,i,this):n(i)}))}))}return s}catch(e){throw _i(e,t)}},i};var hn,vn,fn,gn,mn;exports.SDKCreator=class{constructor(){this.events=Ki.getInstance(),hn.set(this,void 0),n(this,hn,this.getServiceInstance(),"f"),this.events.addListener=(e,t,i)=>{const o=e;return this.events.addListener(exports.Events[o],t,i)}}login(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").login(e)}))}getLoginStatus(){return o(this,hn,"f").getLoginStatus()}getAccessToken(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getAccessToken(e)}))}getVersion(){return o(this,hn,"f").getVersion()}getSystemInfo(){return o(this,hn,"f").getSystemInfo()}setNavigationBarTitle(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").setNavigationBarTitle(e)}))}setNavigationBarColor(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").setNavigationBarColor(e)}))}setBackgroundColor(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").setBackgroundColor(e)}))}setNavigationBarLeftButton(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").setNavigationBarLeftButton(e.type)}))}setDeviceOrientation(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").setDeviceOrientation(e)}))}setStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").setStorage(e)}))}getStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getStorage(e)}))}getStorageInfo(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getStorageInfo(e)}))}removeStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").removeStorage(e)}))}clearStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").clearStorage(e)}))}getUserInfo(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getUserInfo(e)}))}getNetworkType(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getNetworkType(e)}))}onNetworkStatusChange(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").onNetworkStatusChange(e)}))}startBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").startBeaconDiscovery(e)}))}stopBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").stopBeaconDiscovery(e)}))}getBeacons(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getBeacons(e)}))}closeApp(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").closeApp(e)}))}getLocation(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getLocation(e)}))}stopBluetoothDevicesDiscovery(){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").stopBluetoothDevicesDiscovery()}))}startBluetoothDevicesDiscovery(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").startBluetoothDevicesDiscovery(e)}))}openBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").openBluetoothAdapter()}))}onBluetoothDeviceFound(){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").onBluetoothDeviceFound()}))}onBluetoothAdapterStateChange(){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").onBluetoothAdapterStateChange()}))}getConnectedBluetoothDevices(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getConnectedBluetoothDevices(e)}))}getBluetoothDevices(){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getBluetoothDevices()}))}getBluetoothAdapterState(){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getBluetoothAdapterState()}))}closeBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").closeBluetoothAdapter()}))}scanQRCode(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").scanQRCode(e)}))}openProfile(e){return i(this,void 0,void 0,(function*(){yield o(this,hn,"f").openProfile(e)}))}openChat(e){return i(this,void 0,void 0,(function*(){yield o(this,hn,"f").openChat(e)}))}openPostFeed(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").openPostFeed(e)}))}followOA(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").followOA(e)}))}unfollowOA(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").unFollowOA(e)}))}openShareSheet(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").openShareSheet(e)}))}requestCameraPermission(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").requestCameraPermission(e)}))}createShortcut(e){return i(this,void 0,void 0,(function*(){const t=yield Ji(Jt,0),i=Ii().isIOS,n=t.logoUrl||Pi("og:image:url")||"",r=t.name||document.title,a=e.params?new URLSearchParams(e.params):new URLSearchParams;if(a.append("utm_source","zalo-shortcut"),a.append("utm_medium","default"),a.append("utm_campaign","default"),i){a.append("appId",Jt),a.append("appName",r),a.append("appIcon",n);const e=`https://mini.zalo.me/shortcut.html?${a.toString()}`;yield o(this,hn,"f").openOutApp(encodeURI(e))}else yield o(this,hn,"f").createShortcut(`https://zalo.me/app/link/zapps/${Jt}/?${a.toString()}`,r,n);return Si()}))}openBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").openBioAuthentication(e)}))}checkStateBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").checkStateBioAuthentication(e)}))}sendLocation(e){return i(this,void 0,void 0,(function*(){yield o(this,hn,"f").sendLocation(e)}))}showToast(e){return i(this,void 0,void 0,(function*(){yield o(this,hn,"f").showToast(e)}))}hideKeyboard(e){return i(this,void 0,void 0,(function*(){yield o(this,hn,"f").hideKeyboard(e)}))}openPhone(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").openPhone(e)}))}openSMS(e){return i(this,void 0,void 0,(function*(){yield o(this,hn,"f").openSMS(e)}))}viewOAQr(e){return i(this,void 0,void 0,(function*(){yield o(this,hn,"f").viewOAQr(e)}))}keepScreen(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").keepScreen(e)}))}saveImageToGallery(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").saveImageToPhotosAlbum(e)}))}saveImageToPhotosAlbum(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"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 o(this,hn,"f").openMiniApp(e)}))}vibrate(e){return i(this,void 0,void 0,(function*(){yield o(this,hn,"f").vibrate(e)}))}openWebview(e){return i(this,void 0,void 0,(function*(){const t=new URL(e.url),i=t.href.includes("vnpay"),n=t.searchParams.get("typeInapp");!i&&xt.isEmpty(n)&&t.searchParams.set("typeInapp","1"),yield o(this,hn,"f").openWebview(t.href)}))}getRouteParams(){return o(this,hn,"f").getRouteParams()}getAppInfo(e){return o(this,hn,"f").getAppInfo()}sendDataToPreviousMiniApp(e){return o(this,hn,"f").sendDataToPreviousMiniApp(e)}onCallbackData(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").onCallbackData(e)}))}getPhoneNumber(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getPhoneNumber()}))}openProfilePicker(e){return i(this,void 0,void 0,(function*(){const t=yield o(this,hn,"f").openProfilePicker(e.maxProfile);let i;if(t.length>0)try{const e=yield this.getAccessToken(),o=yield fetch(Vt,{method:"POST",headers:{"Content-Type":"application/json",access_token:e||""},body:JSON.stringify({fields:"id,name,picture",user_ids:t})}),n=yield o.json();if(0!==n.error||!n.data)throw new Error(n.message);i=t.map((e=>{var t,i,o,r,a,s,c,l,d,u,p;return{id:(null===(i=null===(t=n.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===(o=n.data[e])||void 0===o?void 0:o.user_info)||void 0===r?void 0:r.name,avatar:null===(l=null===(c=null===(s=null===(a=n.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=n.data[e])||void 0===d?void 0:d.error)?-1:0,message:`Get profile: ${xt.isUndefined(null===(u=n.data[e])||void 0===u?void 0:u.message)?"Unknown error":null===(p=n.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 o(this,hn,"f").connectWifi(e)}))}openMediaPicker(e){var t,n,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===(n=e.editView)||void 0===n?void 0:n.enable)?i.enable=1:i.enable=0,i.aspect_ratio=null===(r=e.editView)||void 0===r?void 0:r.aspectRatio;const a=!0===e.silentRequest?1:0,s=e.maxSelectItem;return yield o(this,hn,"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 Wi(window.APP_ID,t||"",e.title,e.description,e.thumbnail,e.path)).shareableLink}))}closeLoading(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").closeLoading("user action")}))}requestUpdateZalo(e){return i(this,void 0,void 0,(function*(){const e=Ii().isIOS?"https://apps.apple.com/vn/app/zalo/id579523206":"https://play.google.com/store/apps/details?id=com.zing.zalo";return yield o(this,hn,"f").openOutApp(e)}))}onConfirmToExit(e){this.events.on(exports.Events.AppClose,e,'{"handle_h5": 1}'),o(this,hn,"f").setNavigationBarLeftButton(void 0,2)}offConfirmToExit(){this.events.off(exports.Events.AppClose),o(this,hn,"f").setNavigationBarLeftButton(void 0,0)}getDeviceId(){return o(this,hn,"f").getDeviceIdSync()}getDeviceIdAsync(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getDeviceId()}))}getContext(){return o(this,hn,"f").getContextSync()}getContextAsync(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getContext()}))}getAuthCode(e){return i(this,void 0,void 0,(function*(){return yield o(this,hn,"f").getAuthCode()}))}setAccessToken(e){return o(this,hn,"f").setAccessToken(e)}},hn=new WeakMap,e([t(0,ln("object",{title:zi("string")}))],exports.SDKCreator.prototype,"setNavigationBarTitle",null),e([t(0,ln("object",{color:zi("string"),"textColor?":zi("string",{values:["white","black"]}),"statusBarColor?":zi("string")}))],exports.SDKCreator.prototype,"setNavigationBarColor",null),e([t(0,ln("object",{backgroundColor:zi("string"),"textColor?":zi("string",{values:["white","black"]})}))],exports.SDKCreator.prototype,"setBackgroundColor",null),e([t(0,ln("object",{type:zi("string",{values:["none","back","home","both"]})}))],exports.SDKCreator.prototype,"setNavigationBarLeftButton",null),e([t(0,ln("object",{rotate:zi("string",{values:["auto","portrait","landscape"]})}))],exports.SDKCreator.prototype,"setDeviceOrientation",null),e([t(0,ln("object",{data:zi("object")}))],exports.SDKCreator.prototype,"setStorage",null),e([t(0,ln("object",{keys:zi("array<string>")}))],exports.SDKCreator.prototype,"getStorage",null),e([t(0,ln("object",{keys:zi("array<string>")}))],exports.SDKCreator.prototype,"removeStorage",null),e([t(0,ln("object",{"avatarType?":zi("string",{values:["small","normal","large"]})}))],exports.SDKCreator.prototype,"getUserInfo",null),e([t(0,ln("object",{type:zi("string",{values:["user","oa","aliasOA"]}),id:zi("string")}))],exports.SDKCreator.prototype,"openProfile",null),e([t(0,ln("object",{type:zi("string",{values:["user","oa"]}),id:zi("string"),"message?":zi("string")}))],exports.SDKCreator.prototype,"openChat",null),e([t(0,cn(["data.imageUrl"],{if:{type:"image"}})),t(0,cn(["data.link"],{if:{type:"link"}})),t(0,cn(["data.id"],{if:{type:"profile"}})),t(0,ln("object",{type:zi("string",{values:["image","link","profile"]}),data:zi("object"),"data.imageUrl?":zi("url"),"data.link?":zi("url"),"data.title?":zi("string"),"data.thumb?":zi("url"),"data.description?":zi("string"),"data.avatar?":zi("url"),"data.id?":zi("string"),"data.displayName?":zi("string")}))],exports.SDKCreator.prototype,"openPostFeed",null),e([t(0,ln("object",{id:zi("string"),"showDialogConfirm?":zi("boolean")}))],exports.SDKCreator.prototype,"followOA",null),e([t(0,ln("object",{id:zi("string")}))],exports.SDKCreator.prototype,"unfollowOA",null),e([t(0,cn([["data.imageUrl","data.imageUrls"]],{if:{type:"image"}})),t(0,cn(["data.link"],{if:{type:"link"}})),t(0,cn(["data.id"],{if:{type:"oa"}})),t(0,cn(["data.gifUrl"],{if:{type:"gif"}})),t(0,cn(["data.videoThumb","data.videoUrl"],{if:{type:"video"}})),t(0,cn(["data.thumbnail","data.title","data.description"],{if:{type:"zmp"},defaultValue:{data:{description:""}}})),t(0,ln("object",{type:zi("string",{values:["image","gif","video","link","oa","zmp"]}),data:zi("object"),"data.imageUrl?":zi("url"),"data.imageUrls?":zi("array<url>",{maxLength:10}),"data.caption?":zi("string"),"data.gifUrl?":zi("url"),"data.width?":zi("number"),"data.height?":zi("number"),"data.videoThumb?":zi("url"),"data.videoUrl?":zi("url"),"data.link?":zi("url"),"data.chatOnly?":zi("boolean"),"data.id?":zi("string"),"data.thumbnail?":zi("url"),"data.path?":zi("string"),"data.title?":zi("string",{maxLength:100}),"data.description?":zi(["string"],{maxLength:400})}))],exports.SDKCreator.prototype,"openShareSheet",null),e([t(0,ln("object",{secretData:zi("string"),"ui?":zi("object"),"ui.title?":zi("string"),"ui.subTitle?":zi("string"),"ui.negativeButtonText?":zi("string"),"requireFingerprint?":zi("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,ln("object",{toUserId:zi("string"),"title?":zi("string")}))],exports.SDKCreator.prototype,"sendLocation",null),e([t(0,ln("object",{message:zi("string")}))],exports.SDKCreator.prototype,"showToast",null),e([t(0,ln("object",{phoneNumber:zi("string")}))],exports.SDKCreator.prototype,"openPhone",null),e([t(0,ln("object",{content:zi("string"),phoneNumber:zi("string",{regex:/^\+?\d+$/})}))],exports.SDKCreator.prototype,"openSMS",null),e([t(0,ln("object",{id:zi("string"),"displayName?":zi("string")},{displayName:""}))],exports.SDKCreator.prototype,"viewOAQr",null),e([t(0,ln("object",{"imageBase64Data?":zi("string"),"imageUrl?":zi("url")}))],exports.SDKCreator.prototype,"saveImageToGallery",null),e([t(0,ln("object",{"imageBase64Data?":zi("string"),"imageUrl?":zi("url")}))],exports.SDKCreator.prototype,"saveImageToPhotosAlbum",null),e([t(0,ln("object",{appId:zi("string"),"params?":zi("object")}))],exports.SDKCreator.prototype,"openMiniApp",null),e([t(0,ln("object",{"type?":zi("string",{values:["oneShot"]}),"milliseconds?":zi("number")},{type:"oneShot",milliseconds:500}))],exports.SDKCreator.prototype,"vibrate",null),e([t(0,ln("object",{url:zi("url")}))],exports.SDKCreator.prototype,"openWebview",null),e([t(0,ln("object",{"maxProfile?":zi("number",{min:1,max:10})},{maxProfile:1}))],exports.SDKCreator.prototype,"openProfilePicker",null),e([t(0,cn(["SSID"])),t(0,ln("object",{SSID:zi("string"),"password?":zi("string"),"hiddenSSID?":zi("boolean")}))],exports.SDKCreator.prototype,"connectWifi",null),e([t(0,ln("object",{type:zi("string",{values:["photo","video","file","zcamera","zcamera_photo","zcamera_video","zcamera_scan"]}),serverUploadUrl:zi("url"),"maxItemSize?":zi("number",{min:0}),"editView?":zi("object"),"editView.enable?":zi("boolean"),"editView.aspectRatio?":zi("string",{regex:/^\d+:\d+$/}),"silentRequest?":zi("boolean"),"maxSelectItem?":zi("number",{min:1})}))],exports.SDKCreator.prototype,"openMediaPicker",null),e([t(0,ln("object",{title:zi("string",{maxLength:100}),"thumbnail?":zi("url"),"path?":zi("string"),description:zi(["string"],{maxLength:400})},{description:""}))],exports.SDKCreator.prototype,"getShareableLink",null),exports.SDKCreator=e([un(pn)],exports.SDKCreator);class yn extends exports.SDKCreator{getServiceInstance(){return nn.getInstance()}}class _n extends exports.SDKCreator{getServiceInstance(){return new rn}}class Sn{constructor(){vn.set(this,Jt)}static getInstance(){return Sn.instance||(Sn.instance=new Sn),Sn.instance}createOrder(e,t){return i(this,void 0,void 0,(function*(){const i=o(this,vn,"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 Ei.loginRequired}});r.headers.authorization=`Bearer ${o}`;const a=yield fetch(gi,Object.assign(Object.assign({method:"POST"},r),{body:n})),s=yield a.json();if(!s.data||0!==s.err)throw Ei.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=Oi.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:n}=t;if(n||(n=e.getRouteParams()),"object"==typeof n&&(i=n.appTransID||n.orderId||n.apptransid),"string"==typeof n){const e=Oi.getParameterByName("orderId",n),t=Oi.getParameterByName("appTransID",n)||Oi.getParameterByName("apptransid",n);i=e||t}const r={headers:{authorization:"Bearer "}},a=yield e.getAccessToken({fail:e=>{throw Ei.loginRequired}});r.headers.authorization=`Bearer ${a}`;const s=new URL(mi),c={transId:i||"",appId:o(this,vn,"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 Ei.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}}))}}vn=new WeakMap;class En{constructor(){fn.set(this,zt)}static getInstance(){return En.instance||(En.instance=new En),En.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)}}fn=new WeakMap;let On=class{constructor(e){gn.set(this,void 0),mn.set(this,void 0),n(this,gn,this.getInstance(),"f"),n(this,mn,e,"f")}createOrder(e){return o(this,gn,"f").createOrder(o(this,mn,"f"),e)}checkTransaction(e){return o(this,gn,"f").checkTransaction(o(this,mn,"f"),e)}};gn=new WeakMap,mn=new WeakMap,e([t(0,ln("object",{amount:zi(["string","number"]),desc:zi("string"),"method?":zi("string",{values:["MOMO","ZALOPAY","MOMO_SANDBOX","ZALOPAY_SANDBOX","CC","CC_SANDBOX","ATM","ATM_SANDBOX"]})}))],On.prototype,"createOrder",null),On=e([un(pn)],On);class An extends On{getInstance(){return Sn.getInstance()}}class Tn extends On{getInstance(){return En.getInstance()}}const bn=Ii();exports.default=void 0,window.onJSCall=e=>function(t){Ho.getInstance().onJSCall(e,t)},window.onMultiJSCall=e=>function(t){Ho.getInstance().onMultiJSCall(e,t)},window.zaloJSV2={zalo_h5_event_handler:function(e,t,i){Ho.getInstance().nativeEventHandler(e,t,i)}},exports.Payment=void 0,bn.isZalo?(exports.default=new yn,exports.Payment=new An(exports.default)):(exports.default=new _n,exports.Payment=new Tn(exports.default)),window.ZaloMiniAppSDK=exports.default,exports.default=exports.default;
|