zmp-sdk 2.19.0 → 2.19.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/dist/browser.min.js +2 -2
- package/dist/index.es.js +2 -2
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/browser.min.js
CHANGED
|
@@ -4061,7 +4061,7 @@
|
|
|
4061
4061
|
}
|
|
4062
4062
|
_ZJSBridgeProvider_bridge = new WeakMap();
|
|
4063
4063
|
|
|
4064
|
-
var version = "2.19.
|
|
4064
|
+
var version = "2.19.1";
|
|
4065
4065
|
|
|
4066
4066
|
class Basics {
|
|
4067
4067
|
/**
|
|
@@ -6042,7 +6042,7 @@
|
|
|
6042
6042
|
edit_view: Object.assign(Object.assign({}, defaultEditView), editView),
|
|
6043
6043
|
silent_request: silentRequest,
|
|
6044
6044
|
upload: uploadSetting,
|
|
6045
|
-
|
|
6045
|
+
max_select_items: maxSelectItem
|
|
6046
6046
|
}, {
|
|
6047
6047
|
isMultiCallback: true,
|
|
6048
6048
|
callback: (nativeData, error) => {
|
package/dist/index.es.js
CHANGED
|
@@ -4058,7 +4058,7 @@ class ZJSBridgeProvider {
|
|
|
4058
4058
|
}
|
|
4059
4059
|
_ZJSBridgeProvider_bridge = new WeakMap();
|
|
4060
4060
|
|
|
4061
|
-
var version$1 = "2.19.
|
|
4061
|
+
var version$1 = "2.19.1";
|
|
4062
4062
|
|
|
4063
4063
|
class Basics {
|
|
4064
4064
|
/**
|
|
@@ -6039,7 +6039,7 @@ class Zalo {
|
|
|
6039
6039
|
edit_view: Object.assign(Object.assign({}, defaultEditView), editView),
|
|
6040
6040
|
silent_request: silentRequest,
|
|
6041
6041
|
upload: uploadSetting,
|
|
6042
|
-
|
|
6042
|
+
max_select_items: maxSelectItem
|
|
6043
6043
|
}, {
|
|
6044
6044
|
isMultiCallback: true,
|
|
6045
6045
|
callback: (nativeData, error) => {
|
package/dist/index.js
CHANGED
|
@@ -13,4 +13,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
15
|
***************************************************************************** */
|
|
16
|
-
function e(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a}function t(e,t){return function(n,i){t(n,i,e)}}function n(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))}function i(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function o(e,t,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(e,n):o?o.value=n:t.set(e,n),n}Object.defineProperty(exports,"__esModule",{value:!0});var r=Object.prototype;var a=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||r)};var s=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),l=Object.prototype.hasOwnProperty;var c=function(e){if(!a(e))return s(e);var t=[];for(var n in Object(e))l.call(e,n)&&"constructor"!=n&&t.push(n);return t},u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function d(e,t){return e(t={exports:{}},t.exports),t.exports}var p="object"==typeof u&&u&&u.Object===Object&&u,h="object"==typeof self&&self&&self.Object===Object&&self,v=p||h||Function("return this")(),f=v.Symbol,m=Object.prototype,g=m.hasOwnProperty,y=m.toString,_=f?f.toStringTag:void 0;var E=function(e){var t=g.call(e,_),n=e[_];try{e[_]=void 0;var i=!0}catch(e){}var o=y.call(e);return i&&(t?e[_]=n:delete e[_]),o},S=Object.prototype.toString;var A=function(e){return S.call(e)},O=f?f.toStringTag:void 0;var T=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":O&&O in Object(e)?E(e):A(e)};var b=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var w,N=function(e){if(!b(e))return!1;var t=T(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},P=v["__core-js_shared__"],I=(w=/[^.]+$/.exec(P&&P.keys&&P.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"";var C=function(e){return!!I&&I in e},k=Function.prototype.toString;var R=function(e){if(null!=e){try{return k.call(e)}catch(e){}try{return e+""}catch(e){}}return""},B=/^\[object .+?Constructor\]$/,D=Function.prototype,j=Object.prototype,M=D.toString,x=j.hasOwnProperty,L=RegExp("^"+M.call(x).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var U=function(e){return!(!b(e)||C(e))&&(N(e)?L:B).test(R(e))};var W=function(e,t){return null==e?void 0:e[t]};var z=function(e,t){var n=W(e,t);return U(n)?n:void 0},F=z(v,"DataView"),G=z(v,"Map"),H=z(v,"Promise"),$=z(v,"Set"),V=z(v,"WeakMap"),Z=R(F),J=R(G),K=R(H),q=R($),Q=R(V),Y=T;(F&&"[object DataView]"!=Y(new F(new ArrayBuffer(1)))||G&&"[object Map]"!=Y(new G)||H&&"[object Promise]"!=Y(H.resolve())||$&&"[object Set]"!=Y(new $)||V&&"[object WeakMap]"!=Y(new V))&&(Y=function(e){var t=T(e),n="[object Object]"==t?e.constructor:void 0,i=n?R(n):"";if(i)switch(i){case Z:return"[object DataView]";case J:return"[object Map]";case K:return"[object Promise]";case q:return"[object Set]";case Q:return"[object WeakMap]"}return t});var X=Y;var ee=function(e){return null!=e&&"object"==typeof e};var te=function(e){return ee(e)&&"[object Arguments]"==T(e)},ne=Object.prototype,ie=ne.hasOwnProperty,oe=ne.propertyIsEnumerable,re=te(function(){return arguments}())?te:function(e){return ee(e)&&ie.call(e,"callee")&&!oe.call(e,"callee")},ae=Array.isArray;var se=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var le=function(e){return null!=e&&se(e.length)&&!N(e)};var ce=function(){return!1},ue=d((function(e,t){var n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,o=i&&i.exports===n?v.Buffer:void 0,r=(o?o.isBuffer:void 0)||ce;e.exports=r})),de={};de["[object Float32Array]"]=de["[object Float64Array]"]=de["[object Int8Array]"]=de["[object Int16Array]"]=de["[object Int32Array]"]=de["[object Uint8Array]"]=de["[object Uint8ClampedArray]"]=de["[object Uint16Array]"]=de["[object Uint32Array]"]=!0,de["[object Arguments]"]=de["[object Array]"]=de["[object ArrayBuffer]"]=de["[object Boolean]"]=de["[object DataView]"]=de["[object Date]"]=de["[object Error]"]=de["[object Function]"]=de["[object Map]"]=de["[object Number]"]=de["[object Object]"]=de["[object RegExp]"]=de["[object Set]"]=de["[object String]"]=de["[object WeakMap]"]=!1;var pe=function(e){return ee(e)&&se(e.length)&&!!de[T(e)]};var he=function(e){return function(t){return e(t)}},ve=d((function(e,t){var n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,o=i&&i.exports===n&&p.process,r=function(){try{var e=i&&i.require&&i.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=r})),fe=ve&&ve.isTypedArray,me=fe?he(fe):pe,ge=Object.prototype.hasOwnProperty;var ye=function(e){if(null==e)return!0;if(le(e)&&(ae(e)||"string"==typeof e||"function"==typeof e.splice||ue(e)||me(e)||re(e)))return!e.length;var t=X(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(a(e))return!c(e).length;for(var n in e)if(ge.call(e,n))return!1;return!0};var _e=function(e){return void 0===e};var Ee=function(e){return null===e};var Se=function(e){return"string"==typeof e||!ae(e)&&ee(e)&&"[object String]"==T(e)};var Ae=function(e){return"number"==typeof e||ee(e)&&"[object Number]"==T(e)};var Oe=function(e){return ee(e)&&"[object RegExp]"==T(e)},Te=ve&&ve.isRegExp,be=Te?he(Te):Oe;var we=function(e){return"symbol"==typeof e||ee(e)&&"[object Symbol]"==T(e)},Ne=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Pe=/^\w*$/;var Ie=function(e,t){if(ae(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!we(e))||(Pe.test(e)||!Ne.test(e)||null!=t&&e in Object(t))},Ce=z(Object,"create");var ke=function(){this.__data__=Ce?Ce(null):{},this.size=0};var Re=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Be=Object.prototype.hasOwnProperty;var De=function(e){var t=this.__data__;if(Ce){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Be.call(t,e)?t[e]:void 0},je=Object.prototype.hasOwnProperty;var Me=function(e){var t=this.__data__;return Ce?void 0!==t[e]:je.call(t,e)};var xe=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ce&&void 0===t?"__lodash_hash_undefined__":t,this};function Le(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Le.prototype.clear=ke,Le.prototype.delete=Re,Le.prototype.get=De,Le.prototype.has=Me,Le.prototype.set=xe;var Ue=Le;var We=function(){this.__data__=[],this.size=0};var ze=function(e,t){return e===t||e!=e&&t!=t};var Fe=function(e,t){for(var n=e.length;n--;)if(ze(e[n][0],t))return n;return-1},Ge=Array.prototype.splice;var He=function(e){var t=this.__data__,n=Fe(t,e);return!(n<0)&&(n==t.length-1?t.pop():Ge.call(t,n,1),--this.size,!0)};var $e=function(e){var t=this.__data__,n=Fe(t,e);return n<0?void 0:t[n][1]};var Ve=function(e){return Fe(this.__data__,e)>-1};var Ze=function(e,t){var n=this.__data__,i=Fe(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};function Je(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Je.prototype.clear=We,Je.prototype.delete=He,Je.prototype.get=$e,Je.prototype.has=Ve,Je.prototype.set=Ze;var Ke=Je;var qe=function(){this.size=0,this.__data__={hash:new Ue,map:new(G||Ke),string:new Ue}};var Qe=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Ye=function(e,t){var n=e.__data__;return Qe(t)?n["string"==typeof t?"string":"hash"]:n.map};var Xe=function(e){var t=Ye(this,e).delete(e);return this.size-=t?1:0,t};var et=function(e){return Ye(this,e).get(e)};var tt=function(e){return Ye(this,e).has(e)};var nt=function(e,t){var n=Ye(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};function it(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}it.prototype.clear=qe,it.prototype.delete=Xe,it.prototype.get=et,it.prototype.has=tt,it.prototype.set=nt;var ot=it;function rt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var i=arguments,o=t?t.apply(this,i):i[0],r=n.cache;if(r.has(o))return r.get(o);var a=e.apply(this,i);return n.cache=r.set(o,a)||r,a};return n.cache=new(rt.Cache||ot),n}rt.Cache=ot;var at=rt;var st=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,lt=/\\(\\)?/g,ct=function(e){var t=at(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(st,(function(e,n,i,o){t.push(i?o.replace(lt,"$1"):n||e)})),t}));var ut=function(e,t){for(var n=-1,i=null==e?0:e.length,o=Array(i);++n<i;)o[n]=t(e[n],n,e);return o},dt=f?f.prototype:void 0,pt=dt?dt.toString:void 0;var ht=function e(t){if("string"==typeof t)return t;if(ae(t))return ut(t,e)+"";if(we(t))return pt?pt.call(t):"";var n=t+"";return"0"==n&&1/t==-Infinity?"-0":n};var vt=function(e){return null==e?"":ht(e)};var ft=function(e,t){return ae(e)?e:Ie(e,t)?[e]:ct(vt(e))};var mt=function(e){if("string"==typeof e||we(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var gt=function(e,t){for(var n=0,i=(t=ft(t,e)).length;null!=e&&n<i;)e=e[mt(t[n++])];return n&&n==i?e:void 0};var yt=function(e,t,n){var i=null==e?void 0:gt(e,t);return void 0===i?n:i},_t=function(){try{var e=z(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var Et=function(e,t,n){"__proto__"==t&&_t?_t(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},St=Object.prototype.hasOwnProperty;var At=function(e,t,n){var i=e[t];St.call(e,t)&&ze(i,n)&&(void 0!==n||t in e)||Et(e,t,n)},Ot=/^(?:0|[1-9]\d*)$/;var Tt=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Ot.test(e))&&e>-1&&e%1==0&&e<t};var bt=function(e,t,n,i){if(!b(e))return e;for(var o=-1,r=(t=ft(t,e)).length,a=r-1,s=e;null!=s&&++o<r;){var l=mt(t[o]),c=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(o!=a){var u=s[l];void 0===(c=i?i(u,l,s):void 0)&&(c=b(u)?u:Tt(t[o+1])?[]:{})}At(s,l,c),s=s[l]}return e};var wt,Nt,Pt,It,Ct,kt,Rt,Bt,Dt,jt,Mt,xt={isEmpty:ye,isNull:Ee,isUndefined:_e,isFunction:N,isObject:b,isString:Se,isNumber:Ae,isArray:ae,isRegExp:be,get:yt,set:function(e,t,n){return null==e?e:bt(e,t,n)}};function Lt(e){return"function"==typeof window.Debug?window.Debug(e):function(...e){process.env.NODE_ENV}}exports.NetworkType=void 0,(wt=exports.NetworkType||(exports.NetworkType={})).none="none",wt.wifi="wifi",wt.cellular="cellular",wt.unknown="unknown",exports.PlatformType=void 0,(Nt=exports.PlatformType||(exports.PlatformType={})).wp="wp",Nt.android="android",Nt.iOS="iOS",Nt.unknown="unknown",exports.ProfileType=void 0,(Pt=exports.ProfileType||(exports.ProfileType={}))[Pt.user=1]="user",Pt[Pt.oa=0]="oa",Pt[Pt.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,(Ct=exports.PostFeedType||(exports.PostFeedType={}))[Ct.image=1]="image",Ct[Ct.link=4]="link",Ct[Ct.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",exports.OrientationType=void 0,(Rt=exports.OrientationType||(exports.OrientationType={}))[Rt.auto=1]="auto",Rt[Rt.portrait=2]="portrait",Rt[Rt.landscape=3]="landscape",exports.VibrateType=void 0,(Bt=exports.VibrateType||(exports.VibrateType={}))[Bt.oneShot=0]="oneShot",exports.NativeCode=void 0,(Dt=exports.NativeCode||(exports.NativeCode={}))[Dt.token_invalid=-2]="token_invalid",Dt[Dt.not_permission=-1]="not_permission",Dt[Dt.client_not_support=-5]="client_not_support",Dt[Dt.decode_failed=-4]="decode_failed",exports.Events=void 0,(jt=exports.Events||(exports.Events={})).AppPaused="h5.event.paused",jt.AppResumed="h5.event.resumed",jt.NetworkChanged="h5.event.connection.changed",jt.OnDataCallback="h5.event.webview.result",jt.OpenApp="h5.event.open.mp",exports.MediaPickerType=void 0,(Mt=exports.MediaPickerType||(exports.MediaPickerType={}))[Mt.photo=4]="photo",Mt[Mt.video=5]="video",Mt[Mt.file=6]="file";const Ut=e=>{const t=document.cookie;if(t){const o=t.split("; ");if(o&&o.length>0)for(var n=e.length+1,i=o.length-1;i>=0;i--){let t=o[i];if(t&&0===t.indexOf(e)&&(t=t.substring(n,t.length),t))return t=t.replace(/["']/g,""),t}}return null},Wt=e=>Ut(`${window.location.host}_`+e),zt=e=>Ut((()=>{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),Ft=window.zAppID,Gt=window.APP_ID,Ht=window.APP_CONFIG||{},$t="h5.zdn.vn_zoauth",Vt="h5.zdn.vn_zlink3rd",Zt="h5.zdn.vn_zoauth_vrf",Jt="https://graph.zalo.me/v2.0/me",Kt="https://h5.zalo.me/openapi/access_token",qt="https://oauth.zaloapp.com/v3/access_token",Qt="https://graph.zalo.me/v2.0/me/friends/list",Yt=e=>({NONE:e?-2:0,WIFI:e?0:1,"2G":2,"3G":e?15:2,"4G":e?13:2}),Xt={GET_DOWNLOADED_STICKER:{name:"action.get.downloaded.sticker",have_callback:!0},OPEN_SHARE_STICKER:{name:"action.open.share.sticker"},OPEN_PROFILE:{name:"action.open.profile"},OPEN_FEED_DETAIL:{name:"action.open.feeddetail"},OPEN_FRIEND_RADA:{name:"action.open.friendrada"},OPEN_INAPP:{name:"action.open.inapp"},OPEN_OUTAPP:{name:"action.open.outapp"},OPEN_PAGE:{name:"action.open.page"},OPEN_PHOTODETAIL:{name:"action.open.photodetail"},OPEN_GALARY:{name:"action.open.galary"},OPEN_GAMECENTER:{name:"action.open.gamecenter"},OPEN_GAMENEWS:{name:"action.open.gamenews"},OPEN_TAB_CONTACT:{name:"action.open.tab.contact"},OPEN_TAB_SOCIAL:{name:"action.open.tab.social"},OPEN_FRIENDSUGGEST:{name:"action.open.friendsuggest"},OPEN_GROUPLIST:{name:"action.open.grouplist"},OPEN_NEARBY:{name:"action.open.nearby"},OPEN_ROOM:{name:"action.open.room"},OPEN_STICKERSTORE:{name:"action.open.stickerstore"},OPEN_CREATECHAT:{name:"action.open.createchat"},COPY_LINK_CATESTICKER:{name:"action.copy.link.catesticker"},REQUEST_BUY_STICKER:{name:"action.request.buy.sticker"},OPEN_CHAT:{name:"action.open.chat"},OPEN_TAB_CHAT:{name:"action.open.tab.chat"},OPEN_CHATGROUP:{name:"action.open.chatgroup"},OPEN_ADDFRIEND:{name:"action.open.addfriend"},OPEN_TAB_MORE:{name:"action.open.tab.more"},OPEN_POSTFEED:{name:"action.open.postfeed"},OPEN_LOGINDEVICES:{name:"action.open.logindevices"},OPEN_SENDSTICKER:{name:"action.open.sendsticker"},REPORT_ABUSE:{name:"action.report.abuse",have_callback:!0},FOLLOW_OA:{name:"action.follow.oa",have_callback:!0},UNFOLLOW_OA:{name:"action.unfollow.oa",have_callback:!0},OPEN_GAMEDETAIL:{name:"action.open.gamedetail"},OPEN_SHARESHEET:{name:"action.open.sharesheet",have_callback:!0},REQUEST_PERMISSION_CAMERA:{name:"action.request.permission.camera"},CHANGE_TITLE_HEADER:{name:"action.change.title.header",skip_jump:!0},WEBVIEW_CLEARCACHE:{name:"action.webview.clearcache"},WEBVIEW_CONFIRMCACHE:{name:"action.webview.confirmcache"},WEBVIEW_ISVISIBLE:{name:"action.webview.isvisible"},WEBVIEW_NETWORKTYPE:{name:"action.webview.networktype",skip_jump:!0},CHANGE_BUTTON_HEADER:{name:"action.change.button.header"},CREATE_OPTIONS_MENU:{name:"action.create.options.menu",skip_jump:!0,have_callback:!0},CREATE_SHORTCUT:{name:"action.create.shortcut"},CHANGE_ACTIONBAR_LEFTBUTTON_TYPE:{name:"action.change.actionbar.leftbutton.type",skip_jump:!0,have_callback:!0},WINDOW_CLOSE:{name:"action.window.close",skip_jump:!0,have_callback:!0},WEBVIEW_CHECKRESERROR:{name:"action.webview.checkResError"},IAP_REQUESTPAYMENT:{name:"action.iap.requestpayment"},ZBROWSER_GETSTATS:{name:"action.zbrowser.getstats"},ZBROWSER_JSBRIDGE:{name:"action.zbrowser.jsbridge",skip_jump:!0,have_callback:!0},PROMPT_AUTHENTICATION:{name:"action.prompt.authentication"},CHANGE_ACTIONBAR_COLOR:{name:"action.change.actionbar.color",skip_jump:!0},PROMPT_AUTHENTICATION_CHECK_STATE:{name:"action.prompt.authentication.check_state"},OPEN_APPSTORE:{name:"action.open.appstore"},GET_LOCATION:{name:"action.get.location",have_callback:!0},QUERY_LOCATION_HIDE:{name:"action.query.location.hide",have_callback:!0},SHOW_TOAST:{name:"action.show.toast",have_callback:!0},OPEN_APP:{name:"action.open.app"},HIDE_KEYBOARD:{name:"action.hide.keyboard"},OPEN_PHONE:{name:"action.open.phone"},OPEN_QR:{name:"action.open.qr"},OPEN_SMS:{name:"action.open.sms"},VIEW_MYQR:{name:"action.view.myqr",have_callback:!0},KEEP_SCREEN:{name:"action.keep.screen",have_callback:!0},CHANGE_AUTOROTATE:{name:"action.change.autorotate",skip_jump:!0},CHECK_APP_INSTALLED:{name:"action.check.app.installed"},QUERY_SHOW:{name:"action.query.show"},QUERY_HIDE:{name:"action.query.hide"},OPEN_INAPPRW:{name:"action.open.inapprw"},ZALORUN_GETTRACKINGSTATUS:{name:"action.zalorun.getTrackingStatus",have_callback:!0},ZALORUN_SETTRACKINGSTATUS:{name:"action.zalorun.setTrackingStatus",have_callback:!0},ZALORUN_GETDAYSTEP:{name:"action.zalorun.getDayStep",have_callback:!0},ZALORUN_FORCESUBMITDATA:{name:"action.zalorun.forceSubmitData",have_callback:!0},ZALORUN_SETWEIGHT:{name:"action.zalorun.setWeight",have_callback:!0},OPEN_PROFILE_EXT:{name:"action.open.profile.ext"},DOWNLOAD_CATE:{name:"action.download.cate",have_callback:!0},JUMP_LOGIN:{name:"action.jump.login",skip_jump:!0,white_list:!0},OPEN_ADTIMA_ADS_INTERSTITIAL:{name:"action.open.adtima.ads.interstitial"},OPEN_ADTIMA_ADS:{name:"action.open.adtima.ads"},GET_ADIDCLIENT:{name:"action.get.adidclient"},SCAN_IBEACON:{name:"action.scan.ibeacon"},INTERACTIVE_VIBRATION:{name:"action.interactive.vibration"},SAVE_IMAGE_GALLERY:{name:"action.save.image.gallery",version_live:{iOS:408}},OPEN_MP:{name:"action.open.mp",version_live:{iOS:402}},CHANGE_ACTIONBAR:{name:"action.change.actionbar",version_live:{iOS:402},skip_jump:!0},ZBROWSER_MPDS:{name:"action.zbrowser.mpds",version_live:{iOS:402}},WEBVIEW_SET_RESULT:{name:"action.webview.set.result",version_live:{iOS:416}},MP_GET_NUMBER:{name:"action.mp.get.number",version_live:{iOS:416}},MP_OPEN_PROFILE_PICKER:{name:"action.mp.open.profile.picker",version_live:{iOS:432}},GET_SUPPORTED_ACTIONS:{name:"action.get.supported.actions",white_list:!0},MP_JOIN_WIFI:{name:"action.mp.join.wifi",version_live:{android:0,iOS:999},have_permission:!1,white_list:!1},PICK_MEDIA:{name:"action.pick.media",version_live:{iOS:440}},MP_CLOSE_LOADINGVIEW:{name:"action.mp.close.loadingview"}},en=0,tn=-1400,nn=-1500,on=-1401,rn=-1403,an=-1404,sn={SUCCESS:"Success",READ_MORE:"Read more at: https://miniapp.zalo.me/docs/api",LOGIN_REQUIRED:"Please login before to call this api. Read more at: https://miniapp.zalo.me/docs/api/login",LOGIN_FAILED:"Login failed.",NOT_PERMISSION:"You don't have permission to call this api",CLIENT_NOT_SUPPORT:"This API is not supported in this Zalo version",DECODE_FAILED:"Can not decode your data. Read more at: https://miniapp.zalo.me/docs/api/error"},ln="apps/get-info",cn={android:12100571,iOS:400,wp:0,unknown:0},un=[Xt.GET_DOWNLOADED_STICKER.name,Xt.OPEN_SHARE_STICKER.name,Xt.OPEN_PROFILE.name,Xt.OPEN_FEED_DETAIL.name,Xt.OPEN_FRIEND_RADA.name,Xt.OPEN_INAPP.name,Xt.OPEN_OUTAPP.name,Xt.OPEN_PAGE.name,Xt.OPEN_PHOTODETAIL.name,Xt.OPEN_GALARY.name,Xt.OPEN_GAMECENTER.name,Xt.OPEN_GAMENEWS.name,Xt.OPEN_TAB_CONTACT.name,Xt.OPEN_TAB_SOCIAL.name,Xt.OPEN_FRIENDSUGGEST.name,Xt.OPEN_GROUPLIST.name,Xt.OPEN_NEARBY.name,Xt.OPEN_ROOM.name,Xt.OPEN_STICKERSTORE.name,Xt.OPEN_CREATECHAT.name,Xt.COPY_LINK_CATESTICKER.name,Xt.REQUEST_BUY_STICKER.name,Xt.OPEN_CHAT.name,Xt.OPEN_TAB_CHAT.name,Xt.OPEN_CHATGROUP.name,Xt.OPEN_ADDFRIEND.name,Xt.OPEN_TAB_MORE.name,Xt.OPEN_POSTFEED.name,Xt.OPEN_LOGINDEVICES.name,Xt.OPEN_SENDSTICKER.name,Xt.REPORT_ABUSE.name,Xt.FOLLOW_OA.name,Xt.UNFOLLOW_OA.name,Xt.OPEN_GAMEDETAIL.name,Xt.OPEN_SHARESHEET.name,Xt.REQUEST_PERMISSION_CAMERA.name,Xt.CHANGE_TITLE_HEADER.name,Xt.WEBVIEW_CLEARCACHE.name,Xt.WEBVIEW_CONFIRMCACHE.name,Xt.WEBVIEW_ISVISIBLE.name,Xt.WEBVIEW_NETWORKTYPE.name,Xt.CHANGE_BUTTON_HEADER.name,Xt.CREATE_OPTIONS_MENU.name,Xt.CREATE_SHORTCUT.name,Xt.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE.name,Xt.WINDOW_CLOSE.name,Xt.WEBVIEW_CHECKRESERROR.name,Xt.IAP_REQUESTPAYMENT.name,Xt.ZBROWSER_GETSTATS.name,Xt.ZBROWSER_JSBRIDGE.name,Xt.PROMPT_AUTHENTICATION.name,Xt.CHANGE_ACTIONBAR_COLOR.name,Xt.PROMPT_AUTHENTICATION_CHECK_STATE.name,Xt.OPEN_APPSTORE.name,Xt.GET_LOCATION.name,Xt.QUERY_LOCATION_HIDE.name,Xt.SHOW_TOAST.name,Xt.OPEN_APP.name,Xt.HIDE_KEYBOARD.name,Xt.OPEN_PHONE.name,Xt.OPEN_QR.name,Xt.OPEN_SMS.name,Xt.VIEW_MYQR.name,Xt.KEEP_SCREEN.name,Xt.CHANGE_AUTOROTATE.name,Xt.CHECK_APP_INSTALLED.name,Xt.QUERY_SHOW.name,Xt.QUERY_HIDE.name,Xt.OPEN_INAPPRW.name,Xt.ZALORUN_GETTRACKINGSTATUS.name,Xt.ZALORUN_SETTRACKINGSTATUS.name,Xt.ZALORUN_GETDAYSTEP.name,Xt.ZALORUN_FORCESUBMITDATA.name,Xt.ZALORUN_SETWEIGHT.name,Xt.OPEN_PROFILE_EXT.name,Xt.DOWNLOAD_CATE.name,Xt.JUMP_LOGIN.name,Xt.OPEN_ADTIMA_ADS_INTERSTITIAL.name,Xt.OPEN_ADTIMA_ADS.name,Xt.GET_ADIDCLIENT.name,Xt.SCAN_IBEACON.name,Xt.SAVE_IMAGE_GALLERY.name,Xt.OPEN_MP.name,Xt.CHANGE_ACTIONBAR.name,Xt.INTERACTIVE_VIBRATION.name,Xt.ZBROWSER_MPDS.name],dn=0,pn=3,hn=1,vn=0,fn="https://payment-mini.zalo.me/api/order/create",mn="https://payment-mini.zalo.me/api/transaction";class gn{constructor(e,t,n){this.code=e,this.message=t,this.api=n}toString(){return`api: ${this.api}; code: ${this.code}; message: ${this.message}`}}class yn extends gn{constructor(e,t){super(e,t),this.message=`${t}. ${sn.READ_MORE}`,this.handler()}handler(){switch(this.code){case exports.NativeCode.token_invalid:this.code=on,this.message=sn.LOGIN_REQUIRED;break;case exports.NativeCode.not_permission:this.code=rn,this.message=sn.NOT_PERMISSION;break;case exports.NativeCode.client_not_support:this.code=an,this.message=sn.CLIENT_NOT_SUPPORT;break;case exports.NativeCode.decode_failed:this.message=sn.DECODE_FAILED}}}const _n={handler:null,setHandler(e){this.handler=e}};_n.setHandler(((e,t)=>t instanceof gn?(t.api=e,t):new gn(-2001,xt.isNull(t.message)?"Unknown Error":t.message,e)));const En=(e,t,i)=>{const o=i.value;return i.value=function(...e){return n(this,void 0,void 0,(function*(){const{success:i,fail:r}=Array.isArray(e)&&e.length>0&&e[0];return new Promise(((a,s)=>n(this,void 0,void 0,(function*(){try{const t=yield o.apply(this,e);!xt.isNull(i)&&xt.isFunction(i)?i.call(null,t,this):a(t)}catch(e){if("login"!==(null==e?void 0:e.api)&&((null==e?void 0:e.code)===on||(null==e?void 0:e.code)===rn)){let t=!1;this instanceof uo&&(t=this.getLoginStatus()),t||(e=new gn(on,sn.LOGIN_REQUIRED))}const{handler:n}=_n,i=n.call(null,t,e,this);window.zmpSentry&&window.zmpSentry.throwError(i.toString()),!xt.isNull(r)&&xt.isFunction(r)?r.call(null,i,this):s(i)}}))))}))},i},Sn=(e,t,n)=>{const i=n.value;return n.value=function(...e){try{return i.apply(this,e)}catch(e){if("login"!==(null==e?void 0:e.api)&&((null==e?void 0:e.code)===on||(null==e?void 0:e.code)===rn)){let t=!1;this instanceof uo&&(t=this.getLoginStatus()),t||(e=new gn(on,sn.LOGIN_REQUIRED))}const{handler:n}=_n,i=n.call(null,t,e,this);throw window.zmpSentry&&window.zmpSentry.throwError(i.toString()),i}},n},An=(e,t)=>({code:en,message:t||sn.SUCCESS,data:e||{}}),On={badRequest:e=>new gn(tn,e),loginFailed:()=>new gn(tn,sn.LOGIN_FAILED),loginRequired:()=>new gn(on,sn.LOGIN_REQUIRED),missingParam:e=>new gn(tn,`Missing required argument: ${e}`),wrongTypeParam:(e,t,n)=>new gn(tn,`Wrong type of parameter '${e}'. Expected ${t}, but got ${n}`),cannotGetShareInfo:()=>new gn(nn,"Can not get app info to share"),lengthInvalid:e=>new gn(tn,`${e} length is invalid.`)};const Tn={encode:function(e){var t=[];for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];if(void 0===i)return;if(null===i)return void t.push(n);t.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}return t.join("&")},decode:function(e,t){var n={};if(""===e)return n;for(var i=e.split("&"),o=0;o<i.length;o++){var r=i[o].split("=",2),a=decodeURIComponent(r[0]);if(t&&Object.prototype.hasOwnProperty.call(n,a))throw new URIError("Duplicate key: "+a);n[a]=2===r.length?decodeURIComponent(r[1]):null}return n},appendToUrl:function(e,t){return e+(-1!==e.indexOf("?")?"&":"?")+("string"==typeof t?t:Tn.encode(t))},getParameterByName:function(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");var n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return n?n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"":null},getParamsAsObject:function(e){var t={};return e?(e.split("&").map((function(e){var n=e.split("=");n&&2==n.length&&(t[n[0]]=decodeURIComponent(n[1].replace(/\+/g," ")))})),t):t},toQueryString:function(e){if(!e)return"";if("object"!=(void 0===e?"undefined":typeof e))return e;var t=Object.keys(e),n=[];return t.map((function(t){var i=e[t],o=[t,i="object"==(void 0===i?"undefined":typeof i)?JSON.stringify(i):encodeURIComponent(i)].join("=");n.push(o)})),n.join("&")}},bn=new RegExp("[\\u0300-\\u036f]","g"),wn=new RegExp("[đ|Đ]","g"),Nn=new RegExp("\\s","g"),Pn=Lt("zmp:utils:common"),In=e=>{try{new URL(e)}catch(e){return!1}return!0},Cn=()=>navigator.userAgent||navigator.vendor||window.opera,kn=()=>{const e=Cn().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)}},Rn=e=>{const t=document.getElementsByTagName("meta");for(let n=0;n<t.length;n++)if(t[n].getAttribute("name")===e||t[n].getAttribute("property")===e)return t[n].getAttribute("content");return""},Bn=()=>{const e=Cn().toLowerCase().split("zalo")[1];if(e){return e.replace(" ","").split("/")[1]||""}return""},Dn=()=>{let e=kn();return e.isWP?exports.PlatformType.wp:e.isAndroid?exports.PlatformType.android:e.isIOS?exports.PlatformType.iOS:exports.PlatformType.unknown},jn=(e,t)=>{const n=t.toLowerCase(),i=n.split(/[<>]/i),o="array"===i[0];return!!("url"===n&&In(e)||o&&("array"===n&&Array.isArray(e)||((e,t)=>Array.isArray(t)&&!t.some((t=>"url"===e?!In(t):typeof t!==e)))(i[1],e))||!Array.isArray(e)&&typeof e===t)},Mn=e=>(e=>{let t=Wt(e);return t||(t=zt(e),t)?t:Ut(e)})(e),xn=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");return JSON.parse(t,((e,t)=>t))}return xt.isObject(e)?e:new Function("return "+e)()},Ln=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 n=e.length,i=0;i<n;i++)t.push(Ln(e[i]));return"["+t.join(",")+"]"}if("object"==typeof e){for(var o in t=new Array,e)t.push('"'+o+'":'+Ln(e[o]));return"{"+t.join(",")+"}"}return e.toString()},Un=()=>{try{const e=Number(Bn()),t=Dn();return e>=cn[t]}catch(e){return!0}},Wn=e=>JSON.stringify(e).replace(/"/g,'\\"').replace(/'/g,"'"),zn=e=>{try{if(e){Pn(e);const t=e.replace(/\\/g,"").replace(/'/g,"'");return Pn("formattedValue",t,JSON.parse(t),typeof JSON.parse(t)),JSON.parse(t)}return null}catch(t){return Pn("parse json error:",t),e}},Fn=(e,t,i,o,r,a)=>n(void 0,void 0,void 0,(function*(){const n=new URL(location.href),s=new URLSearchParams;let l=`${n.pathname}${n.search}`;a&&(l=`/zapps/${e}${"/"===a[0]?"":"/"}${a}`);const c=new URL(`https://zalo.me/app/link${l}`);s.append("title",i),s.append("description",o||""),s.append("thumbnail",r),s.append("url",c.href),s.append("accessToken",t||"");const u=yield fetch("https://h5.zalo.me/openapi/create-sharelink",Object.assign({method:"POST",body:s},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})),d=yield u.json();if(!d||0!==d.err)throw On.cannotGetShareInfo();return c.search=`${c.search}&zshareId=${d.data.shareId}`,Object.assign(Object.assign({},d.data),{shareableLink:c.href})})),Gn=(e,t)=>n=>{if(!(Array.isArray(e)?e.some((e=>jn(n,e))):jn(n,e)))return{error:!0,errorMessage:e};if(t){if(Array.isArray(null==t?void 0:t.values))return{error:!(null==t?void 0:t.values.includes(n)),errorMessage:null==t?void 0:t.values.toString()};if(xt.isNumber(null==t?void 0:t.maxLength))return{error:xt.isString(n)&&n.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:n<(null==t?void 0:t.min)||n>(null==t?void 0:t.max),errorMessage:`data must be in between ${null==t?void 0:t.min} and ${null==t?void 0:t.max}`};if(xt.isNumber(null==t?void 0:t.min))return{error:n<(null==t?void 0:t.min),errorMessage:`data must >= ${null==t?void 0:t.min}`};if(xt.isNumber(null==t?void 0:t.max))return{error:n>(null==t?void 0:t.max),errorMessage:`data must <= ${null==t?void 0:t.max}`};if(xt.isRegExp(null==t?void 0:t.regex))return{error:!t.regex.test(n),errorMessage:"data must valid"}}return{error:!1}},Hn=(e,t,i)=>n(void 0,void 0,void 0,(function*(){const n={appId:e,versionStatus:t};xt.isUndefined(i)||(n.currentVersion=i);const o=Tn.appendToUrl(`https://h5.zalo.me/${ln}`,n),r=yield fetch(o,{credentials:"include"});if(r.ok){const e=yield r.json();if(e.err<0||!e.data)throw new Error(e);return{name:e.data.name,version:e.data.version,description:e.data.description,appUrl:e.data.appUrl,qrCodeUrl:e.data.qrCodeUrl,logoUrl:e.data.logoUrl}}throw new Error("Can't get app info")}));var $n=d((function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function r(e,t,i,r,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new o(i,r||e,a),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],s]:e._events[l].push(s):(e._events[l]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,i,o=[];if(0===this._eventsCount)return o;for(i in e=this._events)t.call(e,i)&&o.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},s.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var o=0,r=i.length,a=new Array(r);o<r;o++)a[o]=i[o].fn;return a},s.prototype.listenerCount=function(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},s.prototype.emit=function(e,t,i,o,r,a){var s=n?n+e:e;if(!this._events[s])return!1;var l,c,u=this._events[s],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,i),!0;case 4:return u.fn.call(u.context,t,i,o),!0;case 5:return u.fn.call(u.context,t,i,o,r),!0;case 6:return u.fn.call(u.context,t,i,o,r,a),!0}for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var p,h=u.length;for(c=0;c<h;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,i);break;case 4:u[c].fn.call(u[c].context,t,i,o);break;default:if(!l)for(p=1,l=new Array(d-1);p<d;p++)l[p-1]=arguments[p];u[c].fn.apply(u[c].context,l)}}return!0},s.prototype.on=function(e,t,n){return r(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return r(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,i,o){var r=n?n+e:e;if(!this._events[r])return this;if(!t)return a(this,r),this;var s=this._events[r];if(s.fn)s.fn!==t||o&&!s.once||i&&s.context!==i||a(this,r);else{for(var l=0,c=[],u=s.length;l<u;l++)(s[l].fn!==t||o&&!s[l].once||i&&s[l].context!==i)&&c.push(s[l]);c.length?this._events[r]=1===c.length?c[0]:c:a(this,r)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new i,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s}));class Vn extends $n{constructor(){super(),this.debug=Lt("zmp:event-emitter")}static getInstance(){return Vn.instance||(Vn.instance=new Vn),Vn.instance}h5ConfirmHandleEvent(e,t,n){ZaloJavaScriptInterface.jsH5EventCallback(e,t,n||"")}on(e,t,n){this.debug(`register ${e}: ${n}`);return super.on(e,((i,o)=>{this.h5ConfirmHandleEvent(i,e,n),t(o)}),n)}once(e,t,n){this.debug(`register once ${e}: ${n}`);return super.once(e,((i,o)=>{this.h5ConfirmHandleEvent(i,e,n),t(o)}),n)}}var Zn={},Jn=function(e,t,n){var i=t||"default";return function(){var t=i in Zn?Zn[i](e,n):e;return t.apply(this,arguments)}};Jn.setWrapper=function(e){var t=arguments.length<=1||void 0===arguments[1]?"default":arguments[1];Zn[t]=e};var Kn={error:{code:1,error_subcode:1357046,message:"Received Invalid JSON reply.",type:"http"}};function qn(e){try{return null===e?Kn:JSON.parse(e)}catch(e){return Kn}}var Qn,Yn={execute:function(e,t,n,i){n.suppress_http_code=1;var o=Tn.encode(n);"post"!=t&&(e=Tn.appendToUrl(e,o),o="");var r=function(e,t){if(!self.XMLHttpRequest)return null;var n=new XMLHttpRequest,i=function(){};if(!("withCredentials"in n))return null;n.open(e,t,!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded");var o={send:function(e){n.send(e)}},r=Jn((function(){r=i,"onload"in o&&o.onload(n)}),"entry","XMLHttpRequest:load"),a=Jn((function(){a=i,"onerror"in o&&o.onerror(n)}),"entry","XMLHttpRequest:error");return n.onload=function(){r()},n.onerror=function(){a()},n.onreadystatechange=function(){4==n.readyState&&(200==n.status?r():a())},o}(t,e);return!!r&&(r.onload=function(e){i(qn(e.responseText))},r.onerror=function(e){e.responseText?i(qn(e.responseText)):i({error:{code:1,error_subcode:1357045,message:"unknown error (empty response)",status:e.status,type:"http"}})},r.send(o),!0)}};class Xn extends $n{constructor(){super(),this.debug=Lt("zmp:ZaloJSBridge"),this.events=Vn.getInstance(),this._accessTk=Mn("zacc_session")||"DEFAULT_ACCESS_TOKEN",this._jsAccessTk=Mn("zlink3rd")||"DEFAULT_JS_TOKEN",this.results=[],this._userAgent=Cn(),this._device=kn(),this._jsCallFuncCallbacks={},this.events.on(exports.Events.AppPaused,(()=>{if(this.results.length>0){let e=this.results;this.results=[];try{this.sendLogData(e)}catch(e){}}})),this.sendLogTimer?clearInterval(this.sendLogTimer):this.sendLogTimer=setInterval((()=>{if(this.results.length>0){let e=this.results;this.results=[];try{this.sendLogData(e)}catch(e){}}}),5e3)}static getInstance(){return Xn.instance||(Xn.instance=new Xn),Xn.instance}set accessTk(e){this._accessTk=e}set jsAccessTk(e){this._jsAccessTk=e}sendLogData(e){try{Yn.execute("https://h5.zalo.me/log/async","post",{appId:window.APP_ID,data:JSON.stringify(e)},(e=>{}))}catch(e){}}onJSCall(e,t){try{this.debug("onJSCall",e,t);const n=xn(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,i=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,n)}catch(e){console.error("Call callback error",e)}i&&clearTimeout(i),this._jsCallFuncCallbacks[e]=null,delete this._jsCallFuncCallbacks[e]}}this.results.push({action:n.action,error:n.error_code})}catch(e){console.log("onJSCall","error",e)}}onMultiJSCall(e,t){try{this.debug("onMultiJSCall",e,t);const n=xn(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,i=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,n)}catch(e){console.error("Call callback error",e)}i&&clearTimeout(i)}}this.results.push({action:n.action,error:n.error_code})}catch(e){console.log("onMultiJSCall","error",e)}}nativeEventHandler(e,t,n){this.debug(`eventId: ${e}, eventName: ${t}, eventData: ${n}`);const i=zn(n);this.debug(i);const o=this.handleEventData(t,i);this.events.emit(t,e,o)}handleEventData(e,t){try{switch(e){case exports.Events.OpenApp:const{url:e}=t,n=new URL(e),i=n.pathname.split(`/zapps/${Gt}`)[1];return{path:`${i||"/"}${n.search}`};default:return t}}catch(e){return t}}defaultCallback(e){null!=e&&(e=xn(e))}jsCall(e,t,n,i=!1,o=3,r=!0){try{const a=e.name,s=((e="")=>`${e.normalize("NFD").replace(bn,"").replace(wn,"d").replace(Nn,"").toLowerCase()}_${Math.random().toString(36).substr(2,4)}`)(a);if(!this._device.isMobile||xt.isEmpty(a))return this.onJSCall(s,{error_code:-13,error_message:"params invalid!",data:{device:this._device.isMobile,jsToken:this._jsAccessTk,access_token:this._accessTk},action:a}),!1;null==t&&(t={}),n||(n=this.defaultCallback);const l={error_code:-14,error_message:"Request Timeout!",data:{},action:a};this._jsCallFuncCallbacks[s]={timeout:r&&e.have_callback&&setTimeout((()=>{this.onJSCall(s,l)}),8e3),callback:n};try{return t=Ln(t),i?this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,window.onMultiJSCall(s)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,`window.onMultiJSCall('${s}')`):this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,window.onJSCall(s)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,`window.onJSCall('${s}')`)}catch(r){if(!(o-- >0)){const e={error_code:-5,error_message:"Not ready!",data:{userAgent:this._userAgent,options:t,jsToken:this._jsAccessTk,access_token:this._accessTk},action:a,js_error:r};return this.onJSCall(s,e),!1}setTimeout((()=>{this.jsCall(e,t,n,i,o)}),500)}}catch(e){console.log("jsCall","error",e)}return!1}}class ei{constructor(){this.debug=Lt("zmp:ZJSBridgeProvider"),Qn.set(this,void 0),o(this,Qn,Xn.getInstance(),"f")}setZAccSession(e){i(this,Qn,"f").accessTk=e}setJSToken(e){i(this,Qn,"f").jsAccessTk=e}callNative(e,t,o){return this.debug(e.name,t),new Promise(((r,a)=>{const s=i=>n(this,void 0,void 0,(function*(){try{const n=new yn(i.error_code,`${i.action}: ${i.error_message}`);if(null==o?void 0:o.callback){const e=yield o.callback(i,n);return r(e)}if(i&&i.error_code>=0)r(i.data||{});else if(i&&i.error_code<0){try{window.zmpSentry&&window.zmpSentry.captureMessage(`${e.name}: call native fail`,{extra:{data:t,rs:i}})}catch(e){}return a(n)}}catch(e){return a(e)}})),l=kn().isIOS,c=(e=>{var t;const n=Bn(),i=(null===(t=null==e?void 0:e.version_live)||void 0===t?void 0:t.iOS)||0;return!!(Array.isArray(window.ignoreCheckSupport)&&window.ignoreCheckSupport.length>0&&window.ignoreCheckSupport.includes(e.name))||n>=i})(e);if(l&&!c){const t=new yn(-5,`${e}: Client isn't support this action`);return a(t)}(null==o?void 0:o.delay)?setTimeout((()=>{i(this,Qn,"f").jsCall(e,t,s,null==o?void 0:o.isMultiCallback,null==o?void 0:o.nRetry,null==o?void 0:o.haveTimeout)}),o.delay):i(this,Qn,"f").jsCall(e,t,s,null==o?void 0:o.isMultiCallback,null==o?void 0:o.nRetry,null==o?void 0:o.haveTimeout)}))}}Qn=new WeakMap;var ti,ni,ii,oi,ri;class ai{static getVersion(){return"2.19.0"}static getSystemInfo(){return{version:Rn("version-id")||"",apiVersion:"2.19.0",zaloVersion:Bn(),platform:Dn(),language:navigator.language,zaloLanguage:window.zLanguage||"vi",zaloTheme:window.zTheme||"light"}}static getAppInfo(){return n(this,void 0,void 0,(function*(){const e=this.getAppId(),t=this.getSystemInfo();return yield Hn(e,0,t.version)}))}}class si{static setNavigationBarTitle(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.CHANGE_TITLE_HEADER,{title:e.title},{haveTimeout:!1})}))}static setNavigationBarColor(e){return n(this,void 0,void 0,(function*(){const t={};let n;xt.isEmpty(e.textColor)||(t.textColor=e.textColor),xt.isString(e.color)&&e.color.length>0?(xt.isEmpty(e.color)||(t.backgroundColor=e.color),n=5):(xt.isEmpty(e.statusBarColor)||(t.backgroundColor=e.statusBarColor),n=6),this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{actionbarType:n,dataConfig:Object.assign(Object.assign({},e.dataConfig),t)}))),yield this.callNative(Xt.CHANGE_ACTIONBAR,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarLeftButton(e){return n(this,void 0,void 0,(function*(){const t="none"===e.type||"home"===e.type?pn:dn,n="home"===e.type||"both"===e.type?hn:vn;this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{buttonType:t,dataConfig:Object.assign(Object.assign({},e.dataConfig),{viewInLeftType:t}),homeConfig:Object.assign(Object.assign({},e.homeConfig),{enable:n})}))),yield this.callNative(Xt.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarRightButton(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.CREATE_OPTIONS_MENU,{supportToolBar:e.supportToolBar,reset:e.reset,menuListItems:e.menuListItems,zapp:this.getAppId()})}))}}class li{static setBackgroundColor(e){return n(this,void 0,void 0,(function*(){xt.isString(e.backgroundColor)&&e.backgroundColor.length>0&&(yield this.callNative(Xt.CHANGE_ACTIONBAR,{actionbarType:this.isShowNavBar?5:6,dataConfig:{backgroundColor:e.backgroundColor,textColor:e.textColor}}))}))}}class ci{constructor(e,t,n,i){this.title=i,this.severity=t;const o=new Date;if(this.time=o.toLocaleTimeString(),this.content=e,n>0){const e=(new Error).stack;this.stack=e?e.replace("Error\n",""):""}}toString(){return(this.content.stack?[this.title,this.severity.toUpperCase(),this.time,this.content,this.content.stack.replace("Error:","")]:[this.title,this.severity.toUpperCase(),this.time,JSON.stringify(this.content),this.stack]).join(" ")}}ti=new WeakMap,ni=new WeakMap,ii=new WeakMap,oi=new WeakMap,ri=new WeakMap;const ui=new class{constructor(){ti.set(this,3),ni.set(this,["none","error","warn","info"]),ii.set(this,"[zmp] > "),oi.set(this,{error:0,warn:0,info:0,firstError:null,lastError:null}),ri.set(this,((e,t,n)=>{i(this,oi,"f")[i(this,ni,"f")[e]]++;const r=i(this,ni,"f")[e];if(o(this,ii,i(this,ii,"f")+("string"!=typeof t?new ci(t,r,e,n).toString():t),"f"),!(e>i(this,ti,"f")))switch(e){case 1:console.error(i(this,ii,"f"));break;case 2:console.warn(i(this,ii,"f"));break;case 3:console.info(i(this,ii,"f"));break;default:throw new Error("internal")}}))}setLogLevel(e){o(this,ti,e,"f")}info(e){i(this,ri,"f").call(this,3,e)}warn(e,t){i(this,ri,"f").call(this,2,e,t)}error(e,t){i(this,ri,"f").call(this,1,e,t)}getMetrics(){return i(this,oi,"f")}};class di{static setDeviceOrientation(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.CHANGE_AUTOROTATE,{autoRotate:exports.OrientationType[e.rotate]})}))}static getNetworkType(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.WEBVIEW_NETWORKTYPE,{url:window.location.href,featureId:""}).then((e=>{const t=e.network;let n;const i=kn().isAndroid;switch(t){case Yt(i).NONE:n=exports.NetworkType.none;break;case Yt(i).WIFI:n=exports.NetworkType.wifi;break;case Yt(i)["2G"]:case Yt(i)["3G"]:case Yt(i)["4G"]:n=exports.NetworkType.cellular;break;default:n=exports.NetworkType.unknown}return{networkType:n}}))}))}static onNetworkStatusChange(e){return n(this,void 0,void 0,(function*(){yield this.events.on(exports.Events.NetworkChanged,(t=>{const n=t&&t.state;this.getNetworkType().then((t=>{const i={isConnected:"CONNECTED"===n,networkType:t&&t.networkType};e(i)})).catch((e=>{ui.error(e,"onNetworkStatusChange")}))}))}))}static startBeaconDiscovery(e){var t,i,o,r,a;return n(this,void 0,void 0,(function*(){const n={subaction:0,scanning_type: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===(i=null==e?void 0:e.scanConfig)||void 0===i?void 0:i.timeBetweenScan)?e.scanConfig.timeBetweenScan:1e4,beacon_timeout:xt.isNumber(null===(o=null==e?void 0:e.scanConfig)||void 0===o?void 0:o.beaconTimeout)?e.scanConfig.beaconTimeout:3e4,delayCheckConnectedTimeout:xt.isNumber(null===(r=null==e?void 0:e.scanConfig)||void 0===r?void 0:r.delayCheckConnectedTimeout)?e.scanConfig.delayCheckConnectedTimeout:5e3,beaconConnectedTimeout:xt.isNumber(null===(a=null==e?void 0:e.scanConfig)||void 0===a?void 0:a.beaconConnectedTimeout)?e.scanConfig.beaconConnectedTimeout:6e5},items:Array.isArray(null==e?void 0:e.items)?null==e?void 0:e.items:[]}};return yield this.callNative(Xt.SCAN_IBEACON,Object.assign({},n)),!0}))}static stopBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.SCAN_IBEACON,Object.assign({},{subaction:2})),!0}))}static getBeacons(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.SCAN_IBEACON,Object.assign({},{subaction:1}),{isMultiCallback:!0}).then((e=>{const t={beacons:[]};return Array.isArray(e)&&e.forEach((e=>{const n={uuid:e.uuid,major:e.major,minor:e.minor,distance:e.distance,rssi:e.rssi};t.beacons.push(n)})),t}))}))}static stopBluetoothDevicesDiscovery(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static startBluetoothDevicesDiscovery(e){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},Object.assign({},e))}))}static openBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static onBluetoothDeviceFound(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static onBluetoothAdapterStateChange(){return n(this,void 0,void 0,(function*(){return Promise.resolve()}))}static getConnectedBluetoothDevices(e){return n(this,void 0,void 0,(function*(){const t={services:e.services||[]};return this.callNative({name:""},t)}))}static getBluetoothDevices(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static getBluetoothAdapterState(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static closeBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static scanQRCode(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.OPEN_QR,{skipOpenLink:!0})}))}static showToast(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.SHOW_TOAST,{toast:e.message})}))}static hideKeyboard(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.HIDE_KEYBOARD,{})}))}static openPhone(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.OPEN_PHONE,{phoneNum:e.phoneNumber,phoneCode:e.phoneNumber})}))}static openSMS(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.OPEN_SMS,{content:e.content,phoneCode:e.phoneNumber})}))}static keepScreen(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.KEEP_SCREEN,{data:{keep_screen_on:e.keepScreenOn?1:0}})}))}static openBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.PROMPT_AUTHENTICATION,{secret_data:e.secretData,app_id:this.getZAppId(),ui:{title:e.ui.title,sub_title:e.ui.subTitle,negative_text:e.ui.negativeButtonText},require_fingerprint:e.requireFingerprint?1:0}).then((e=>{var t,n,i,o;return{code:null==e?void 0:e.error_code,message:null==e?void 0:e.error_message,data:{domain:null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.domain,code:null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.error_code,message:null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.error_message,payToken:null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.pay_token}}}))}))}static checkStateBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.PROMPT_AUTHENTICATION_CHECK_STATE,{}).then((e=>({bioState:null==e?void 0:e.bio_state})))}))}static vibrate(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.INTERACTIVE_VIBRATION,{type:exports.VibrateType[e.type],vibrate_time:e.milliseconds})}))}static connectWifi(e){return n(this,void 0,void 0,(function*(){let t="open";return xt.isString(e.password)&&e.password.length>0&&(t="wpa_wpa2"),yield this.callNative(Xt.MP_JOIN_WIFI,{ssid:e.SSID,securityType:t,password:e.password,hiddenSsid:e.hiddenSSID})}))}static openAppStore(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.OPEN_APPSTORE,e)}))}}var pi,hi,vi,fi,mi,gi,yi,_i,Ei,Si,Ai,Oi,Ti,bi,wi,Ni,Pi,Ii,Ci,ki,Ri,Bi,Di,ji,Mi,xi,Li,Ui;class Wi{constructor(e){pi.set(this,localStorage),hi.set(this,void 0),vi.set(this,void 0),kn(),o(this,vi,{keys:new Set,currentSize:0,limitSize:5242880},"f"),o(this,hi,e,"f"),this.findAllCurrentDataByApp(e)}findAllCurrentDataByApp(e){try{let t;for(t in i(this,pi,"f")){if(e){if(t.split("_")[0]!==e)continue}i(this,vi,"f").keys.add(t)}}catch(e){ui.error(e,"LocalResourceStorage > findAllCurrentDataByApp")}}get(e){let t=new Map;return e.forEach((e=>{t.set(e,this.getSync(e))})),Promise.resolve(t)}getSync(e){return i(this,hi,"f")&&(e=`${i(this,hi,"f")}_${e}`),i(this,vi,"f").keys.has(e)?i(this,pi,"f").getItem(e):null}set(e){return n(this,void 0,void 0,(function*(){return Object.entries(e).forEach((([e,t])=>{this.setSync(e,t.replace(/\\"/g,'"'))})),Promise.resolve({errorKeys:[]})}))}setSync(e,t){i(this,hi,"f")&&(e=`${i(this,hi,"f")}_${e}`),i(this,pi,"f").setItem(e,t),i(this,vi,"f").keys.add(e)}getInfo(){return n(this,void 0,void 0,(function*(){return Promise.resolve(this.getInfoSync())}))}getInfoSync(){const e=((e,t)=>{let n,i,o=0;for(i in e){const r=i.split("_")[0];e.hasOwnProperty(i)&&(t&&r!==t||(n=2*(e[i].length+i.length),o+=n))}return o})(i(this,pi,"f"),i(this,hi,"f"));return{currentSize:xt.isNumber(e)?Number((e/1024).toFixed(2)):0,limitSize:Number(5120..toFixed(2))}}remove(e){return n(this,void 0,void 0,(function*(){return e.forEach((e=>{this.removeSync(e)})),Promise.resolve({errorKeys:[]})}))}removeSync(e){i(this,hi,"f")&&(e=`${i(this,hi,"f")}_${e}`),i(this,vi,"f").keys.has(e)&&(i(this,pi,"f").removeItem(e),i(this,vi,"f").keys.delete(e))}clear(){return n(this,void 0,void 0,(function*(){return Promise.resolve(this.clearSync())}))}clearSync(){i(this,vi,"f").keys.forEach((e=>{i(this,hi,"f")&&e.indexOf(i(this,hi,"f"))<0||(i(this,pi,"f").removeItem(e),i(this,vi,"f").keys.delete(e))}))}}pi=new WeakMap,hi=new WeakMap,vi=new WeakMap;class zi extends ei{constructor(e){super(),fi.set(this,void 0),mi.set(this,void 0),o(this,mi,{keys:new Set,currentSize:0,limitSize:5242880},"f"),o(this,fi,e,"f")}get(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.ZBROWSER_MPDS,{mpds_action:"mpds.get",mpds_data:{keys:e},appId:i(this,fi,"f")},{isMultiCallback:!1}).then((e=>{let t=new Map;return e&&e.mpds_data&&e.mpds_data.map&&(t=new Map(Object.entries(e.mpds_data.map))),t}))}))}set(e){return n(this,void 0,void 0,(function*(){return{errorKeys:yield this.callNative(Xt.ZBROWSER_MPDS,{mpds_action:"mpds.set",mpds_data:{map:e},appId:i(this,fi,"f")},{isMultiCallback:!1}).then((e=>{let t=[];return e&&e.mpds_data&&e.mpds_data.error_keys&&(t=e.mpds_data.error_keys),t}))}}))}getInfo(){return n(this,void 0,void 0,(function*(){const e=yield this.callNative(Xt.ZBROWSER_MPDS,{mpds_action:"mpds.get.size",mpds_data:{},appId:i(this,fi,"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 n(this,void 0,void 0,(function*(){return{errorKeys:yield this.callNative(Xt.ZBROWSER_MPDS,{mpds_action:"mpds.remove.key",mpds_data:{keys:e},appId:i(this,fi,"f")},{isMultiCallback:!1}).then((e=>{let t=[];return e&&e.mpds_data&&e.mpds_data.error_keys&&(t=e.mpds_data.error_keys),t}))}}))}clear(){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.ZBROWSER_MPDS,{mpds_action:"mpds.clear.appData",mpds_data:{},appId:i(this,fi,"f")})}))}}fi=new WeakMap,mi=new WeakMap;class Fi{getDataFromStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance(),n=yield t.get(e),i={};return n.forEach(((e,t)=>{i[t]=zn(e)})),i}))}putDataToStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance(),n={};return Object.entries(e).forEach((([e,t])=>{xt.isUndefined(t)||xt.isNull(t)||(n[e]=Wn(t))})),yield t.set(n)}))}removeDataFromStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance();return yield t.remove(e)}))}clearStorage(){return n(this,void 0,void 0,(function*(){const e=this.getInstance();yield e.clear()}))}getStorageInfo(){return n(this,void 0,void 0,(function*(){const e=this.getInstance();return yield e.getInfo()}))}}class Gi extends Fi{constructor(e){super(),gi.set(this,void 0),o(this,gi,e,"f")}getInstance(){return new Wi(i(this,gi,"f"))}}gi=new WeakMap;class Hi extends Fi{constructor(e){super(),yi.set(this,void 0),o(this,yi,e,"f")}getInstance(){return new zi(i(this,yi,"f"))}}yi=new WeakMap;class $i{static setStorage(e){return n(this,void 0,void 0,(function*(){let t=new Gi(this.getAppId());return Un()&&(t=new Hi(this.getAppId())),yield t.putDataToStorage(e.data)}))}static getStorage(e){return n(this,void 0,void 0,(function*(){let t=new Gi(this.getAppId());Un()&&(t=new Hi(this.getAppId()));return yield t.getDataFromStorage(e.keys)}))}static getStorageInfo(e){return n(this,void 0,void 0,(function*(){let e=new Gi(this.getAppId());return Un()&&(e=new Hi(this.getAppId())),yield e.getStorageInfo()}))}static removeStorage(e){return n(this,void 0,void 0,(function*(){let t=new Gi(this.getAppId());return Un()&&(t=new Hi(this.getAppId())),yield t.removeDataFromStorage(e.keys)}))}static clearStorage(e={}){return n(this,void 0,void 0,(function*(){let e=new Gi(this.getAppId());Un()&&(e=new Hi(this.getAppId())),yield e.clearStorage()}))}}class Vi{static getUserInfo(e){return n(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();let i="id,name,picture";(null==e?void 0:e.avatarType)&&(i=`${i}.type(${null==e?void 0:e.avatarType})`);return{userInfo:yield fetch(`${Jt}?fields=${i}`,{headers:{access_token:t||""}}).then((e=>n(this,void 0,void 0,(function*(){const t=yield e.json(),n={id:t.id,name:t.name,birthday:"",gender:"",avatar:t.picture&&t.picture.data&&t.picture.data.url};return console.warn("'birthday' and 'gender' are deprecated"),n}))))}}))}static getPhoneNumber(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.MP_GET_NUMBER,{},{isMultiCallback:!0,callback:(e,t)=>{if(0===e.error_code){const t={number:e.data};return Promise.resolve(t)}return Promise.reject(t)},delay:this.isIOS?400:0})}))}}class Zi{static closeApp(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.WINDOW_CLOSE,{})}))}static openMiniApp(e){return n(this,void 0,void 0,(function*(){const t=null==e?void 0:e.appId,n=(null==e?void 0:e.params)||{},i=Object.entries(n).map((function([e,t]){return[e,t].join("=")})).join("&");let o;try{o=yield Hn(t,0)}catch(e){}const r={appId:t};o&&(r.appName=o.name,r.appAvtUrl=o.logoUrl),yield this.callNative(Xt.OPEN_MP,{mpUrl:`https://h5.zdn.vn/zapps/${t}/${i.length>0?"?"+i:""}`,mpInfo:r})}))}static openWebview(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.OPEN_INAPP,{url:e})}))}static closeLoading(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.MP_CLOSE_LOADINGVIEW,{at:(new Date).getTime(),when:e,url:location.href})}))}}class Ji{static getLocation(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.GET_LOCATION,{silent_request:!1,permission_description:"Cho phép Zalo truy cập vào vị trí của thiết bị này?"},{isMultiCallback:!0,haveTimeout:!1,callback:(e,t)=>{if(0===e.error_code){const t=e.data,n={latitude:t.latitude,longitude:t.longitude,timestamp:t.timestamp,provider:t.provider};return Promise.resolve(n)}return Promise.reject(t)},delay:this.isIOS?400:0})}))}static sendLocation(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.QUERY_LOCATION_HIDE,{title:e.title,touserid:e.toUserId,zapp:this.getZAppId()})}))}}class Ki{static requestCameraPermission(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.REQUEST_PERMISSION_CAMERA,{},{callback:(e,t)=>-2===e.error_code||e.error_code>=0?Promise.resolve({userAllow:-2!==e.error_code,message:e.error_message}):Promise.reject(t)})}))}static saveImageToPhotosAlbum(e){return n(this,void 0,void 0,(function*(){let t={};return xt.isEmpty(e.imageBase64Data)?xt.isEmpty(e.imageUrl)||(t={imageUrl:e.imageUrl}):t={imageBase64Data:e.imageBase64Data},yield this.callNative(Xt.SAVE_IMAGE_GALLERY,Object.assign({},t))}))}}class qi{static viewOAQr(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.VIEW_MYQR,{dpn:e.displayName,uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openProfile(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.OPEN_PROFILE,{uId:e.id,type:exports.ProfileType[e.type],zapp:this.getZAppId(),sourceId:e.sourceId,sourceIndex:e.sourceIndex})}))}static openChat(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.OPEN_CHAT,{uId:e.id,type:exports.ChatType[e.type],zapp:this.getZAppId(),sourceId:e.sourceId,sourceIndex:e.sourceIndex})}))}static openPostFeed(e){return n(this,void 0,void 0,(function*(){let t={};switch(e.type){case"image":t={photoUrl:e.data.imageUrl};break;case"link":t={link:e.data.link,title:e.data.title,thumb:e.data.thumb,description:e.data.description};break;case"profile":t={avt:e.data.avatar,uid:e.data.id,dpn:e.data.displayName}}return yield this.callNative(Xt.OPEN_POSTFEED,Object.assign(Object.assign({type:exports.PostFeedType[e.type]},t),{zapp:this.getZAppId()})).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static followOA(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.FOLLOW_OA,{uid:e.id,showDialogConfirm:!0,zapp:this.getZAppId()},{haveTimeout:!1})}))}static unfollowOA(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.UNFOLLOW_OA,{uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openShareSheet(e){return n(this,void 0,void 0,(function*(){let t={};switch(e.type){case"image":let n=[];Array.isArray(e.data.imageUrls)&&e.data.imageUrls.length>0?n=e.data.imageUrls:n.push(e.data.imageUrl),t={photoUrls:n,photoUrl:e.data.imageUrl,caption:e.data.caption};break;case"gif":t={photoUrl:e.data.imageUrl,gifUrl:e.data.gifUrl,width:e.data.width,height:e.data.height};break;case"video":t={videoThumb:e.data.videoThumb,videoUrl:e.data.videoUrl,width:e.data.width,height:e.data.height};break;case"link":t={link:e.data.link,chatOnly:e.data.chatOnly?1:0};break;case"oa":t={uid:e.data.id};break;case"zmp":const i=yield this.getAccessToken(),o=yield Fn(this.getAppId(),i||"",e.data.title||"",e.data.description||"",e.data.thumbnail||"",e.data.path);window.forceShareZMP?t={data:{ZInstantAPIInfo:{url:`${o.zinstantApi}`,zinstantdata_id:`templateId=${o.ztemplateId}&appId=${this.getAppId()}&shareId=${o.shareId}`},previewMsgText:{msg:{en:"Zalo Mini Program",vi:"Chương trình nhỏ"}},enableReactions:1}}:(t={link:o.shareableLink,chatOnly:e.data.chatOnly?1:0},e.type="link")}return yield this.callNative(Xt.OPEN_SHARESHEET,Object.assign(Object.assign({type:exports.ShareSheetType[e.type]},t),{zapp:this.getZAppId()}),{haveTimeout:!1}).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static createShortcut(e,t,i){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.CREATE_SHORTCUT,{url:e,title:t,iconUrl:i})}))}static openProfilePicker(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.MP_OPEN_PROFILE_PICKER,{maxProfile:e},{isMultiCallback:!0,callback:(e,t)=>0===e.error_code&&Array.isArray(e.data)?Promise.resolve(e.data.map((e=>e.id))):Promise.reject(t)})}))}static getActionsSupported(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.GET_SUPPORTED_ACTIONS,{},{isMultiCallback:!1,callback:(e,t)=>{const n=Dn();if(Array.isArray(e.actions)&&e.actions.length>0){const t=Object.keys(Xt).filter((e=>Xt[e].skip_jump)),n={actions:[...e.actions,...t]};return Promise.resolve(n)}if(n===exports.PlatformType.iOS){const e={actions:un};return Promise.resolve(e)}return Promise.reject(t)}})}))}static openMediaPicker(e,t,i,o,r,a){return n(this,void 0,void 0,(function*(){const n={type:0,url:t,maxSize:i||1048576};return yield this.callNative(Xt.PICK_MEDIA,{media_type:exports.MediaPickerType[e],edit_view:Object.assign(Object.assign({},{enable:1,aspect_ratio:"1:1"}),o),silent_request:r,upload:n,max_select_item:a},{isMultiCallback:!0,callback:(e,t)=>{var n;if(0===e.error_code){const t={data:null===(n=e.data)||void 0===n?void 0:n.result_content};return Promise.resolve(t)}return Promise.reject(t)}})}))}static openOutApp(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.OPEN_OUTAPP,{url:e})}))}}class Qi{static getRouteParams(){let e={};const t=window.location.href;try{let n=new URL(t).searchParams.toString();n&&(e=Tn.getParamsAsObject(n))}catch(e){throw new Error("Url không hợp lệ")}return e}static sendDataToPreviousMiniApp(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.WEBVIEW_SET_RESULT,{result:Wn(e.data)})}))}static onCallbackData(e){return n(this,void 0,void 0,(function*(){yield this.events.on(exports.Events.OnDataCallback,(t=>{e({data:t})}))}))}}class Yi extends ei{constructor(){var e,t,n,r,a,s,l,c,u,d,p,h,v,f,m,g,y;super(),_i.set(this,Ft),Ei.set(this,Gt),Si.set(this,Ht),Ai.set(this,void 0),Oi.set(this,void 0),Ti.set(this,void 0),bi.set(this,null),wi.set(this,{timer:{getToken:0}}),Ni.set(this,void 0),Pi.set(this,void 0),Ii.set(this,null),this.events=Vn.getInstance(),this.isIOS=kn().isIOS,Ci.set(this,void 0),this.getActionBarConfig=()=>i(this,Ci,"f"),this.setActionBarConfig=e=>{o(this,Ci,e(i(this,Ci,"f")),"f")},ki.set(this,(()=>new Promise(((e,t)=>{xt.isUndefined(i(this,Ii,"f"))||xt.isNull(i(this,Ii,"f"))?this.callNative(Xt.JUMP_LOGIN,{}).then((t=>{const n=t&&t.cookiesOAuthLogins||[],i=n.find((e=>e.name===Vt));i&&(this.setJSToken(i.value),window.ZJSBridge.setJSToken&&window.ZJSBridge.setJSToken(i.value)),o(this,Ii,n,"f"),e(n)})).catch((e=>{t(e)})):e(i(this,Ii,"f"))})))),Ri.set(this,si.setNavigationBarRightButton),this.getVersion=ai.getVersion,this.getSystemInfo=ai.getSystemInfo,this.setNavigationBarTitle=si.setNavigationBarTitle,this.setNavigationBarColor=si.setNavigationBarColor,this.setNavigationBarLeftButton=si.setNavigationBarLeftButton,this.setBackgroundColor=li.setBackgroundColor,this.setDeviceOrientation=di.setDeviceOrientation,this.setStorage=$i.setStorage,this.getStorage=$i.getStorage,this.getStorageInfo=$i.getStorageInfo,this.removeStorage=$i.removeStorage,this.clearStorage=$i.clearStorage,this.getUserInfo=Vi.getUserInfo,this.getNetworkType=di.getNetworkType,this.onNetworkStatusChange=di.onNetworkStatusChange,this.startBeaconDiscovery=di.startBeaconDiscovery,this.stopBeaconDiscovery=di.stopBeaconDiscovery,this.getBeacons=di.getBeacons,this.closeApp=Zi.closeApp,this.getLocation=Ji.getLocation,this.stopBluetoothDevicesDiscovery=di.stopBluetoothDevicesDiscovery,this.startBluetoothDevicesDiscovery=di.stopBluetoothDevicesDiscovery,this.openBluetoothAdapter=di.openBluetoothAdapter,this.onBluetoothDeviceFound=di.onBluetoothDeviceFound,this.onBluetoothAdapterStateChange=di.onBluetoothAdapterStateChange,this.getConnectedBluetoothDevices=di.getConnectedBluetoothDevices,this.getBluetoothDevices=di.getBluetoothDevices,this.getBluetoothAdapterState=di.getBluetoothAdapterState,this.closeBluetoothAdapter=di.closeBluetoothAdapter,this.scanQRCode=di.scanQRCode,this.openProfile=qi.openProfile,this.openChat=qi.openChat,this.openPostFeed=qi.openPostFeed,this.followOA=qi.followOA,this.unFollowOA=qi.unfollowOA,this.openShareSheet=qi.openShareSheet,this.requestCameraPermission=Ki.requestCameraPermission,this.createShortcut=qi.createShortcut,this.openBioAuthentication=di.openBioAuthentication,this.checkStateBioAuthentication=di.checkStateBioAuthentication,this.sendLocation=Ji.sendLocation,this.showToast=di.showToast,this.hideKeyboard=di.hideKeyboard,this.openPhone=di.openPhone,this.openSMS=di.openSMS,this.viewOAQr=qi.viewOAQr,this.keepScreen=di.keepScreen,this.saveImageToPhotosAlbum=Ki.saveImageToPhotosAlbum,this.openMiniApp=Zi.openMiniApp,this.vibrate=di.vibrate,this.openWebview=Zi.openWebview,this.getRouteParams=Qi.getRouteParams,this.getAppInfo=ai.getAppInfo,this.sendDataToPreviousMiniApp=Qi.sendDataToPreviousMiniApp,this.onCallbackData=Qi.onCallbackData,this.getPhoneNumber=Vi.getPhoneNumber,this.openProfilePicker=qi.openProfilePicker,Bi.set(this,qi.getActionsSupported),this.connectWifi=di.connectWifi,this.openMediaPicker=qi.openMediaPicker,this.openOutApp=qi.openOutApp,this.closeLoading=Zi.closeLoading,this.openAppStore=di.openAppStore,o(this,Ai,null,"f"),o(this,Oi,null,"f"),o(this,Ti,null,"f"),this.isShowNavBar=!0,o(this,Ni,0,"f"),o(this,Pi,0,"f");const _="home"===(null===(t=null===(e=i(this,Si,"f"))||void 0===e?void 0:e.app)||void 0===t?void 0:t.leftButton)||"both"===(null===(r=null===(n=i(this,Si,"f"))||void 0===n?void 0:n.app)||void 0===r?void 0:r.leftButton)?hn:vn,E=new URL(location.href),S=xt.isString(null===(s=null===(a=i(this,Si,"f"))||void 0===a?void 0:a.app)||void 0===s?void 0:s.headerColor)&&(null===(u=null===(c=null===(l=i(this,Si,"f"))||void 0===l?void 0:l.app)||void 0===c?void 0:c.headerColor)||void 0===u?void 0:u.length)>0?5:6,A="none"===(null===(p=null===(d=i(this,Si,"f"))||void 0===d?void 0:d.app)||void 0===p?void 0:p.leftButton)||"home"===(null===(v=null===(h=i(this,Si,"f"))||void 0===h?void 0:h.app)||void 0===v?void 0:v.leftButton)?pn:dn;o(this,Ci,{actionbarType:S,buttonType:A,dataConfig:{backgroundColor:(null===(m=null===(f=i(this,Si,"f"))||void 0===f?void 0:f.app)||void 0===m?void 0:m.headerColor)||"",textColor:(null===(y=null===(g=i(this,Si,"f"))||void 0===g?void 0:g.app)||void 0===y?void 0:y.textColor)||"",viewInLeftType:A,confirmToExit:1},homeConfig:{enable:_,url:`https://h5.zdn.vn/zapps/${this.getAppId()}/${E.search}`}},"f")}static getInstance(){return Yi.instance||(Yi.instance=new Yi),Yi.instance}getLoginStatus(){return xt.isString(i(this,Ti,"f"))&&i(this,Ti,"f").length>0}getAppId(){return i(this,Ei,"f")}getZAppId(){return i(this,_i,"f")}login(e){return n(this,void 0,void 0,(function*(){const e=yield i(this,ki,"f").call(this),t=e.find((e=>e.name===$t)),n=e.find((e=>e.name===Zt));if(!xt.isUndefined(t)&&!xt.isNull(t)&&xt.isString(t.value)){if(o(this,Ai,t.value,"f"),xt.isUndefined(n)||xt.isNull(n)||!xt.isString(n.value)?yield this.loginZaloV3():(o(this,Oi,n.value,"f"),yield this.loginZaloV4()),!i(this,Ti,"f"))throw On.loginFailed();return i(this,Ti,"f")}throw On.loginFailed()}))}loginZaloV3(){return n(this,void 0,void 0,(function*(){return yield fetch(`${qt}?app_id=${i(this,_i,"f")}&redirect_uri=https://h5.zdn.vn/zapps/${i(this,Ei,"f")}/&code=${i(this,Ai,"f")}&isSDK=true123`).then((e=>n(this,void 0,void 0,(function*(){let t=yield e.json();if(t.access_token){o(this,Ti,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return o(this,Pi,e,"f"),o(this,Ni,(new Date).getTime(),"f"),this.setZAccSession(i(this,Ti,"f")||""),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(i(this,Ti,"f")||""),i(this,Ti,"f")}return null}))))}))}loginZaloV4(){return n(this,void 0,void 0,(function*(){const e=new URLSearchParams;e.append("app_id",i(this,Ei,"f")),e.append("code",i(this,Ai,"f")||""),e.append("code_verifier",i(this,Oi,"f")||""),xt.isNull(i(this,bi,"f"))?e.append("grant_type","authorization_code"):(e.append("grant_type","refresh_token"),e.append("refresh_token",i(this,bi,"f")||""));return yield fetch(Kt,Object.assign({method:"POST",body:e},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).then((e=>n(this,void 0,void 0,(function*(){const t=yield e.json();if(t.refresh_token&&o(this,bi,t.refresh_token,"f"),t.access_token){o(this,Ti,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return o(this,Pi,e,"f"),o(this,Ni,(new Date).getTime(),"f"),this.setZAccSession(i(this,Ti,"f")||""),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(i(this,Ti,"f")||""),i(this,Ti,"f")}return null}))))}))}getAccessToken(e){return n(this,void 0,void 0,(function*(){const e=(new Date).getTime()-i(this,Ni,"f");if(!i(this,Ti,"f"))throw On.loginRequired();return e<i(this,Pi,"f")?i(this,Ti,"f"):yield this.login()}))}}_i=new WeakMap,Ei=new WeakMap,Si=new WeakMap,Ai=new WeakMap,Oi=new WeakMap,Ti=new WeakMap,bi=new WeakMap,wi=new WeakMap,Ni=new WeakMap,Pi=new WeakMap,Ii=new WeakMap,Ci=new WeakMap,ki=new WeakMap,Ri=new WeakMap,Bi=new WeakMap;class Xi{constructor(){Di.set(this,Ft),ji.set(this,Ht),Mi.set(this,"DEFAULT ZOAUTH"),xi.set(this,"DEFAULT ACCESS TOKEN"),Li.set(this,{timer:{getToken:0}}),Ui.set(this,!1),this.getLoginStatus=()=>i(this,Ui,"f"),this.getAppId=()=>i(this,Di,"f"),this.login=()=>(o(this,Ui,!0,"f"),Promise.resolve(i(this,Mi,"f"))),this.getAccessToken=()=>Promise.resolve(i(this,xi,"f")),this.getVersion=ai.getVersion,this.getSystemInfo=ai.getSystemInfo,this.setNavigationBarTitle=()=>Promise.resolve(),this.setNavigationBarColor=()=>Promise.resolve(),this.setBackgroundColor=()=>Promise.resolve(),this.setNavigationBarLeftButton=()=>Promise.resolve(),this.setDeviceOrientation=()=>Promise.resolve(),this.setStorage=e=>n(this,void 0,void 0,(function*(){const t=new Gi(this.getAppId());return yield t.putDataToStorage(e.data),{errorKeys:[]}})),this.getStorage=e=>n(this,void 0,void 0,(function*(){const t=new Gi(this.getAppId());return yield t.getDataFromStorage(e.keys)})),this.getStorageInfo=e=>n(this,void 0,void 0,(function*(){const e=new Gi(this.getAppId());return yield e.getStorageInfo()})),this.removeStorage=e=>n(this,void 0,void 0,(function*(){const t=new Gi(this.getAppId());return yield t.removeDataFromStorage(e.keys)})),this.clearStorage=e=>n(this,void 0,void 0,(function*(){const e=new Gi(this.getAppId());return yield e.clearStorage()})),this.getUserInfo=()=>(console.warn("birthday and gender are deprecated"),Promise.resolve({userInfo:{id:"3368637342326461234",name:"User Name",avatar:"https://h5.zdn.vn/static/images/avatar.png"}})),this.getNetworkType=()=>{let e;switch((navigator.connection||navigator.mozConnection||navigator.webkitConnection).effectiveType){case"none":e=exports.NetworkType.none;break;case"4g":e=exports.NetworkType.wifi;break;case"3g":case"2g":e=exports.NetworkType.cellular;break;default:e=exports.NetworkType.unknown}const t={networkType:e};return Promise.resolve(t)},this.onNetworkStatusChange=e=>{const t=navigator.connection||navigator.mozConnection||navigator.webkitConnection,n=t.effectiveType;return t.addEventListener("change",(function(){let t;switch(n){case"none":t=exports.NetworkType.none;break;case"4g":t=exports.NetworkType.wifi;break;case"3g":case"2g":t=exports.NetworkType.cellular;break;default:t=exports.NetworkType.unknown}e({isConnected:!0,networkType:t})})),Promise.resolve()},this.startBeaconDiscovery=e=>Promise.resolve(!0),this.stopBeaconDiscovery=e=>Promise.resolve(!0),this.getBeacons=e=>Promise.resolve({beacons:[]}),this.closeApp=()=>Promise.resolve(),this.getLocation=()=>Promise.resolve({longitude:"105.788026",latitude:"21.0258773",timestamp:(new Date).getTime().toString(),provider:"fused"}),this.onBackButtonClick=()=>Promise.resolve(),this.stopBluetoothDevicesDiscovery=()=>Promise.resolve(),this.startBluetoothDevicesDiscovery=()=>Promise.resolve(),this.openBluetoothAdapter=()=>Promise.resolve(),this.onBluetoothDeviceFound=()=>Promise.resolve(),this.onBluetoothAdapterStateChange=()=>Promise.resolve(),this.getConnectedBluetoothDevices=()=>Promise.resolve(),this.getBluetoothDevices=()=>Promise.resolve(),this.getBluetoothAdapterState=()=>Promise.resolve(),this.closeBluetoothAdapter=()=>Promise.resolve(),this.scanQRCode=()=>Promise.resolve({content:"132"}),this.openProfile=()=>Promise.resolve(),this.openChat=()=>Promise.resolve(),this.openPostFeed=()=>Promise.resolve({status:1,shareType:0,numberOfUser:0}),this.followOA=()=>Promise.resolve(),this.unFollowOA=()=>Promise.resolve(),this.openShareSheet=()=>Promise.resolve({status:2,shareType:0,numberOfUser:0}),this.requestCameraPermission=()=>Promise.resolve({userAllow:!0,message:"Success"}),this.createShortcut=()=>Promise.resolve(),this.openBioAuthentication=()=>Promise.resolve({code:0,message:"OK",data:{domain:"",code:0,message:"",payToken:""}}),this.checkStateBioAuthentication=()=>Promise.resolve({bioState:""}),this.sendLocation=()=>Promise.resolve(),this.showToast=()=>Promise.resolve(),this.hideKeyboard=()=>Promise.resolve(),this.openPhone=()=>Promise.resolve(),this.openSMS=()=>Promise.resolve(),this.viewOAQr=()=>Promise.resolve(),this.keepScreen=()=>Promise.resolve(),this.saveImageToPhotosAlbum=()=>Promise.resolve(),this.openMiniApp=e=>Promise.resolve(),this.vibrate=()=>Promise.resolve(),this.openWebview=e=>(location.replace(e),Promise.resolve()),this.getRouteParams=Qi.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()}on(e,t,n){throw new Error("Method not implemented.")}once(e,t,n){throw new Error("Method not implemented.")}off(e,t,n,i){throw new Error("Method not implemented.")}removeAllListeners(e){throw new Error("Method not implemented.")}openMediaPicker(e,t,n,i,o,r){return console.warn("This api only works on zalo app"),Promise.resolve({data:""})}}Di=new WeakMap,ji=new WeakMap,Mi=new WeakMap,xi=new WeakMap,Li=new WeakMap,Ui=new WeakMap;const eo=Symbol("required"),to=Symbol("checkType"),no=(e,t)=>(n,i,o)=>{let r=Reflect.getOwnMetadata(eo,n,i)||[];r.push({parameterIndex:o,fields:e,option:t}),Reflect.defineMetadata(eo,r,n,i)},io=(e,t,n)=>(i,o,r)=>{let a=Reflect.getOwnMetadata(to,i,o)||[];a.push({parameterIndex:r,type:e,properties:t,defaultValue:n}),Reflect.defineMetadata(to,a,i,o)};const oo=(e,t,n)=>{const i=n.value,o=i.toString().match(/\(.*?\)/)[0].replace(/[()]/gi,"").replace(/\s/gi,"").split(",");return n.value=function(){const n=Reflect.getOwnMetadata(eo,e,t),r=Reflect.getOwnMetadata(to,e,t);return r&&r.forEach((e=>{const{parameterIndex:t,type:n,properties:i,defaultValue:r}=e;let a=arguments[t],s=o[t];const l=typeof a;if(!xt.isUndefined(a)){if(!jn(a,n))throw On.wrongTypeParam(s,n,Array.isArray(a)?"array":null===a?"null":l);"object"===n&&Object.entries(i).forEach((([e,n])=>{const i=e.split("?")[0],o=xt.get(a,i);if(xt.isUndefined(o)||xt.isNull(o)){if(!e.includes("?"))throw On.missingParam(e);xt.isObject(xt.get(a,i.split(".")[0]))&&r&&!xt.isUndefined(xt.get(r,i))&&xt.set(arguments[t],i,xt.get(r,i))}else if(xt.isFunction(n)){const e=n(o);if(e&&e.error)throw On.wrongTypeParam(`${s}.${i}`,e.errorMessage,typeof o)}}))}})),n&&n.forEach((e=>{const{parameterIndex:t,option:n,fields:i}=e,o=arguments[t],r=null==n?void 0:n.if,a=null==n?void 0:n.defaultValue;let s=!0;r&&(s=Object.keys(r).every((e=>xt.get(o,e)===r[e]))),s&&i.forEach((e=>{const n=e=>{let n=!1;return xt.isEmpty(xt.get(o,e))&&(xt.isUndefined(xt.get(a,e))||xt.set(arguments[t],e,xt.get(a,e)),n=!0),n};if(Array.isArray(e)&&e.length>0&&e.every(n))throw On.missingParam(e.join(" or "));if(xt.isString(e)&&n(e))throw On.missingParam(e)}))})),i.apply(this,arguments)},n};var ro,ao,so,lo,co;class uo{constructor(){this.events=Vn.getInstance(),ro.set(this,void 0),o(this,ro,this.getServiceInstance(),"f"),this.events.addListener=(e,t,n)=>{const i=e;return this.events.addListener(exports.Events[i],t,n)}}login(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").login(e)}))}getLoginStatus(){return i(this,ro,"f").getLoginStatus()}getAccessToken(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getAccessToken(e)}))}getVersion(){return i(this,ro,"f").getVersion()}getSystemInfo(){return i(this,ro,"f").getSystemInfo()}setNavigationBarTitle(e){return n(this,void 0,void 0,(function*(){return i(this,ro,"f").setNavigationBarTitle(e)}))}setNavigationBarColor(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").setNavigationBarColor(e)}))}setBackgroundColor(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").setBackgroundColor(e)}))}setNavigationBarLeftButton(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").setNavigationBarLeftButton(e)}))}setDeviceOrientation(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").setDeviceOrientation(e)}))}setStorage(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").setStorage(e)}))}getStorage(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getStorage(e)}))}getStorageInfo(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getStorageInfo(e)}))}removeStorage(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").removeStorage(e)}))}clearStorage(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").clearStorage(e)}))}getUserInfo(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getUserInfo(e)}))}getNetworkType(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getNetworkType(e)}))}onNetworkStatusChange(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").onNetworkStatusChange(e)}))}startBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").startBeaconDiscovery(e)}))}stopBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").stopBeaconDiscovery(e)}))}getBeacons(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getBeacons(e)}))}closeApp(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").closeApp(e)}))}getLocation(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getLocation(e)}))}stopBluetoothDevicesDiscovery(){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").stopBluetoothDevicesDiscovery()}))}startBluetoothDevicesDiscovery(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").startBluetoothDevicesDiscovery(e)}))}openBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").openBluetoothAdapter()}))}onBluetoothDeviceFound(){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").onBluetoothDeviceFound()}))}onBluetoothAdapterStateChange(){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").onBluetoothAdapterStateChange()}))}getConnectedBluetoothDevices(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getConnectedBluetoothDevices(e)}))}getBluetoothDevices(){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getBluetoothDevices()}))}getBluetoothAdapterState(){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getBluetoothAdapterState()}))}closeBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").closeBluetoothAdapter()}))}scanQRCode(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").scanQRCode(e)}))}openProfile(e){return n(this,void 0,void 0,(function*(){yield i(this,ro,"f").openProfile(e)}))}openChat(e){return n(this,void 0,void 0,(function*(){yield i(this,ro,"f").openChat(e)}))}openPostFeed(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").openPostFeed(e)}))}followOA(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").followOA(e)}))}unfollowOA(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").unFollowOA(e)}))}openShareSheet(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").openShareSheet(e)}))}requestCameraPermission(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").requestCameraPermission(e)}))}createShortcut(e){return n(this,void 0,void 0,(function*(){const t=yield Hn(Gt,0),n=kn().isIOS,o=t.logoUrl||Rn("og:image:url")||"",r=t.name||document.title,a=e.params?new URLSearchParams(e.params):new URLSearchParams;if(a.append("utm_source","zalo-shortcut"),a.append("utm_medium","default"),a.append("utm_campaign","default"),n){a.append("appId",Gt),a.append("appName",r),a.append("appIcon",o);const e=`https://mini.zalo.me/shortcut.html?${a.toString()}`;yield i(this,ro,"f").openOutApp(encodeURI(e))}else yield i(this,ro,"f").createShortcut(`https://zalo.me/app/link/zapps/${Gt}/?${a.toString()}`,r,o);return An()}))}openBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").openBioAuthentication(e)}))}checkStateBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").checkStateBioAuthentication(e)}))}sendLocation(e){return n(this,void 0,void 0,(function*(){yield i(this,ro,"f").sendLocation(e)}))}showToast(e){return n(this,void 0,void 0,(function*(){yield i(this,ro,"f").showToast(e)}))}hideKeyboard(e){return n(this,void 0,void 0,(function*(){yield i(this,ro,"f").hideKeyboard(e)}))}openPhone(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").openPhone(e)}))}openSMS(e){return n(this,void 0,void 0,(function*(){yield i(this,ro,"f").openSMS(e)}))}viewOAQr(e){return n(this,void 0,void 0,(function*(){yield i(this,ro,"f").viewOAQr(e)}))}keepScreen(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").keepScreen(e)}))}saveImageToGallery(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").saveImageToPhotosAlbum(e)}))}saveImageToPhotosAlbum(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").saveImageToPhotosAlbum(e)}))}openMiniApp(e){return n(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 i(this,ro,"f").openMiniApp(e)}))}vibrate(e){return n(this,void 0,void 0,(function*(){yield i(this,ro,"f").vibrate(e)}))}openWebview(e){return n(this,void 0,void 0,(function*(){const t=new URL(e.url),n=t.searchParams.get("typeInapp");xt.isEmpty(n)&&t.searchParams.set("typeInapp","1"),yield i(this,ro,"f").openWebview(t.href)}))}getRouteParams(){return i(this,ro,"f").getRouteParams()}getAppInfo(e){return i(this,ro,"f").getAppInfo()}sendDataToPreviousMiniApp(e){return i(this,ro,"f").sendDataToPreviousMiniApp(e)}onCallbackData(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").onCallbackData(e)}))}getPhoneNumber(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getPhoneNumber()}))}openProfilePicker(e){return n(this,void 0,void 0,(function*(){const t=yield i(this,ro,"f").openProfilePicker(e.maxProfile);let n;if(t.length>0)try{const e=yield this.getAccessToken(),i=yield fetch(Qt,{method:"POST",headers:{"Content-Type":"application/json",access_token:e||""},body:JSON.stringify({fields:"id,name,picture",user_ids:t})}),o=yield i.json();if(0!==o.error||!o.data)throw new Error(o.message);n=t.map((e=>{var t,n,i,r,a,s,l,c,u,d,p;return{id:(null===(n=null===(t=o.data[e])||void 0===t?void 0:t.user_info)||void 0===n?void 0:n.user_id_by_app)||"",profile:{name:null===(r=null===(i=o.data[e])||void 0===i?void 0:i.user_info)||void 0===r?void 0:r.name,avatar:null===(c=null===(l=null===(s=null===(a=o.data[e])||void 0===a?void 0:a.user_info)||void 0===s?void 0:s.picture)||void 0===l?void 0:l.data)||void 0===c?void 0:c.url},code:0!==(null===(u=o.data[e])||void 0===u?void 0:u.error)?-1:0,message:`Get profile: ${xt.isUndefined(null===(d=o.data[e])||void 0===d?void 0:d.message)?"Unknown error":null===(p=o.data[e])||void 0===p?void 0:p.message}`}}))}catch(e){n=t.map((t=>({id:t,profile:{name:"",avatar:""},code:-1,message:`Can't get profile: ${e.message}`})))}return{users:n||[]}}))}connectWifi(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").connectWifi(e)}))}openMediaPicker(e){var t,o,r;return n(this,void 0,void 0,(function*(){const n={};xt.isUndefined(null===(t=e.editView)||void 0===t?void 0:t.enable)||(null===(o=e.editView)||void 0===o?void 0:o.enable)?n.enable=1:n.enable=0,n.aspect_ratio=null===(r=e.editView)||void 0===r?void 0:r.aspectRatio;const a=!0===e.silentRequest?1:0,s=e.maxSelectItem;return yield i(this,ro,"f").openMediaPicker(e.type,e.serverUploadUrl,e.maxItemSize,n,a,s)}))}getShareableLink(e){return n(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();return(yield Fn(window.APP_ID,t||"",e.title,e.description,e.thumbnail,e.path)).shareableLink}))}closeLoading(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").closeLoading("user action")}))}requestUpdateZalo(e){return n(this,void 0,void 0,(function*(){const e=kn().isIOS?"https://apps.apple.com/vn/app/zalo/id579523206":"https://play.google.com/store/apps/details?id=com.zing.zalo";return yield i(this,ro,"f").openOutApp(e)}))}}ro=new WeakMap,e([En],uo.prototype,"login",null),e([Sn],uo.prototype,"getLoginStatus",null),e([En],uo.prototype,"getAccessToken",null),e([Sn],uo.prototype,"getVersion",null),e([Sn],uo.prototype,"getSystemInfo",null),e([En,oo,t(0,io("object",{title:Gn("string")}))],uo.prototype,"setNavigationBarTitle",null),e([En,oo,t(0,io("object",{color:Gn("string"),"textColor?":Gn("string",{values:["white","black"]}),"statusBarColor?":Gn("string")}))],uo.prototype,"setNavigationBarColor",null),e([En,oo,t(0,io("object",{backgroundColor:Gn("string"),"textColor?":Gn("string",{values:["white","black"]})}))],uo.prototype,"setBackgroundColor",null),e([En,oo,t(0,io("object",{type:Gn("string",{values:["none","back","home","both"]})}))],uo.prototype,"setNavigationBarLeftButton",null),e([En,oo,t(0,io("object",{rotate:Gn("string",{values:["auto","portrait","landscape"]})}))],uo.prototype,"setDeviceOrientation",null),e([En,oo,t(0,io("object",{data:Gn("object")}))],uo.prototype,"setStorage",null),e([En,oo,t(0,io("object",{keys:Gn("array<string>")}))],uo.prototype,"getStorage",null),e([En],uo.prototype,"getStorageInfo",null),e([En,oo,t(0,io("object",{keys:Gn("array<string>")}))],uo.prototype,"removeStorage",null),e([En],uo.prototype,"clearStorage",null),e([En,oo,t(0,io("object",{"avatarType?":Gn("string",{values:["small","normal","large"]})}))],uo.prototype,"getUserInfo",null),e([En],uo.prototype,"getNetworkType",null),e([En],uo.prototype,"onNetworkStatusChange",null),e([En],uo.prototype,"startBeaconDiscovery",null),e([En],uo.prototype,"stopBeaconDiscovery",null),e([En],uo.prototype,"getBeacons",null),e([En],uo.prototype,"closeApp",null),e([En],uo.prototype,"getLocation",null),e([En],uo.prototype,"stopBluetoothDevicesDiscovery",null),e([En],uo.prototype,"startBluetoothDevicesDiscovery",null),e([En],uo.prototype,"openBluetoothAdapter",null),e([En],uo.prototype,"onBluetoothDeviceFound",null),e([En],uo.prototype,"onBluetoothAdapterStateChange",null),e([En],uo.prototype,"getConnectedBluetoothDevices",null),e([En],uo.prototype,"getBluetoothDevices",null),e([En],uo.prototype,"getBluetoothAdapterState",null),e([En],uo.prototype,"closeBluetoothAdapter",null),e([En],uo.prototype,"scanQRCode",null),e([En,oo,t(0,io("object",{type:Gn("string",{values:["user","oa","aliasOA"]}),id:Gn("string")}))],uo.prototype,"openProfile",null),e([En,oo,t(0,io("object",{type:Gn("string",{values:["user","oa"]}),id:Gn("string")}))],uo.prototype,"openChat",null),e([En,oo,t(0,no(["data.imageUrl"],{if:{type:"image"}})),t(0,no(["data.link"],{if:{type:"link"}})),t(0,no(["data.id"],{if:{type:"profile"}})),t(0,io("object",{type:Gn("string",{values:["image","link","profile"]}),data:Gn("object"),"data.imageUrl?":Gn("url"),"data.link?":Gn("url"),"data.title?":Gn("string"),"data.thumb?":Gn("url"),"data.description?":Gn("string"),"data.avatar?":Gn("url"),"data.id?":Gn("string"),"data.displayName?":Gn("string")}))],uo.prototype,"openPostFeed",null),e([En,oo,t(0,io("object",{id:Gn("string"),"showDialogConfirm?":Gn("boolean")}))],uo.prototype,"followOA",null),e([En,oo,t(0,io("object",{id:Gn("string")}))],uo.prototype,"unfollowOA",null),e([En,oo,t(0,no([["data.imageUrl","data.imageUrls"]],{if:{type:"image"}})),t(0,no(["data.link"],{if:{type:"link"}})),t(0,no(["data.id"],{if:{type:"oa"}})),t(0,no(["data.gifUrl"],{if:{type:"gif"}})),t(0,no(["data.videoThumb","data.videoUrl"],{if:{type:"video"}})),t(0,no(["data.thumbnail","data.title","data.description"],{if:{type:"zmp"},defaultValue:{data:{description:""}}})),t(0,io("object",{type:Gn("string",{values:["image","gif","video","link","oa","zmp"]}),data:Gn("object"),"data.imageUrl?":Gn("url"),"data.imageUrls?":Gn("array<url>",{maxLength:10}),"data.caption?":Gn("string"),"data.gifUrl?":Gn("url"),"data.width?":Gn("number"),"data.height?":Gn("number"),"data.videoThumb?":Gn("url"),"data.videoUrl?":Gn("url"),"data.link?":Gn("url"),"data.chatOnly?":Gn("boolean"),"data.id?":Gn("string"),"data.thumbnail?":Gn("url"),"data.path?":Gn("string"),"data.title?":Gn("string",{maxLength:100}),"data.description?":Gn(["string"],{maxLength:400})}))],uo.prototype,"openShareSheet",null),e([En],uo.prototype,"requestCameraPermission",null),e([En],uo.prototype,"createShortcut",null),e([En,oo,t(0,io("object",{secretData:Gn("string"),"ui?":Gn("object"),"ui.title?":Gn("string"),"ui.subTitle?":Gn("string"),"ui.negativeButtonText?":Gn("string"),"requireFingerprint?":Gn("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"}}))],uo.prototype,"openBioAuthentication",null),e([En],uo.prototype,"checkStateBioAuthentication",null),e([En,oo,t(0,io("object",{toUserId:Gn("string"),"title?":Gn("string")}))],uo.prototype,"sendLocation",null),e([En,oo,t(0,io("object",{message:Gn("string")}))],uo.prototype,"showToast",null),e([En],uo.prototype,"hideKeyboard",null),e([En,oo,t(0,io("object",{phoneNumber:Gn("string")}))],uo.prototype,"openPhone",null),e([En,oo,t(0,io("object",{content:Gn("string"),phoneNumber:Gn("string",{regex:/^\+?\d+$/})}))],uo.prototype,"openSMS",null),e([En,oo,t(0,io("object",{id:Gn("string"),"displayName?":Gn("string")},{displayName:""}))],uo.prototype,"viewOAQr",null),e([En],uo.prototype,"keepScreen",null),e([En,oo,t(0,io("object",{"imageBase64Data?":Gn("string"),"imageUrl?":Gn("url")}))],uo.prototype,"saveImageToGallery",null),e([En,oo,t(0,io("object",{"imageBase64Data?":Gn("string"),"imageUrl?":Gn("url")}))],uo.prototype,"saveImageToPhotosAlbum",null),e([En,oo,t(0,io("object",{appId:Gn("string"),"params?":Gn("object")}))],uo.prototype,"openMiniApp",null),e([En,oo,t(0,io("object",{"type?":Gn("string",{values:["oneShot"]}),"milliseconds?":Gn("number")},{type:"oneShot",milliseconds:500}))],uo.prototype,"vibrate",null),e([En,oo,t(0,io("object",{url:Gn("url")}))],uo.prototype,"openWebview",null),e([Sn],uo.prototype,"getRouteParams",null),e([En],uo.prototype,"getAppInfo",null),e([En],uo.prototype,"sendDataToPreviousMiniApp",null),e([En],uo.prototype,"onCallbackData",null),e([En],uo.prototype,"getPhoneNumber",null),e([En,oo,t(0,io("object",{"maxProfile?":Gn("number",{min:1,max:10})},{maxProfile:1}))],uo.prototype,"openProfilePicker",null),e([En,oo,t(0,no(["SSID"])),t(0,io("object",{SSID:Gn("string"),"password?":Gn("string"),"hiddenSSID?":Gn("boolean")}))],uo.prototype,"connectWifi",null),e([En,oo,t(0,io("object",{type:Gn("string",{values:["photo","video","file"]}),serverUploadUrl:Gn("url"),"maxItemSize?":Gn("number",{min:0}),"editView?":Gn("object"),"editView.enable?":Gn("boolean"),"editView.aspectRatio?":Gn("string",{regex:/^\d+:\d+$/}),"silentRequest?":Gn("boolean"),"maxSelectItem?":Gn("number",{min:1})}))],uo.prototype,"openMediaPicker",null),e([En,oo,t(0,io("object",{title:Gn("string",{maxLength:100}),"thumbnail?":Gn("url"),"path?":Gn("string"),description:Gn(["string"],{maxLength:400})},{description:""}))],uo.prototype,"getShareableLink",null),e([En,oo],uo.prototype,"closeLoading",null),e([En,oo],uo.prototype,"requestUpdateZalo",null);class po extends uo{getServiceInstance(){return Yi.getInstance()}}class ho extends uo{getServiceInstance(){return new Xi}}class vo{constructor(){ao.set(this,Gt)}static getInstance(){return vo.instance||(vo.instance=new vo),vo.instance}createOrder(e,t){return n(this,void 0,void 0,(function*(){const n=i(this,ao,"f"),o=new URLSearchParams;o.append("amount",t.amount.toString()),o.append("item",encodeURIComponent(JSON.stringify(t.item))),o.append("appId",n),t.desc&&o.append("desc",encodeURIComponent(t.desc)),t.extradata&&o.append("extradata",encodeURIComponent(JSON.stringify(t.extradata))),t.method&&o.append("method",t.method);const r={headers:{"Content-Type":"application/x-www-form-urlencoded",authorization:"Bearer "}};try{const i=yield e.getAccessToken({fail:e=>{throw On.loginRequired}});r.headers.authorization=`Bearer ${i}`;const a=yield fetch(fn,Object.assign(Object.assign({method:"POST"},r),{body:o})),s=yield a.json();if(!s.data||0!==s.err)throw On.badRequest(s.msg);const l=s.data.id,c=s.data.jwt,u=window.APP_VERSION,d=window.APP_ENV,p={miniAppId:n,orderId:l};c&&(p.token=c),u&&(p.version=u),d&&(p.env=d),t.method&&(p.method=t.method);const h=Tn.encode(p),v=new URL(`?${h}`,"https://payment-mini.zalo.me").toString();return yield e.openWebview({url:v,fail:e=>{throw e}}),{orderId:l}}catch(e){throw e}}))}checkTransaction(e,t){return n(this,void 0,void 0,(function*(){try{let n,{data:o}=t;if(o||(o=e.getRouteParams()),"object"==typeof o&&(n=o.appTransID||o.orderId||o.apptransid),"string"==typeof o){const e=Tn.getParameterByName("orderId",o),t=Tn.getParameterByName("appTransID",o)||Tn.getParameterByName("apptransid",o);n=e||t}const r={headers:{authorization:"Bearer "}},a=yield e.getAccessToken({fail:e=>{throw On.loginRequired}});r.headers.authorization=`Bearer ${a}`;const s=new URL(mn),l={transId:n||"",appId:i(this,ao,"f")};s.search=new URLSearchParams(l).toString();const c=yield fetch(s.toString(),r),u=yield c.json();if(!u.data||0!==u.err)throw On.badRequest(u.msg);const d=u.data||{};return{msg:d.resultMessage,orderId:d.orderId,resultCode:d.resultCode,transTime:d.transTime,createdAt:d.createAt,transId:d.transId}}catch(e){throw e}}))}}ao=new WeakMap;class fo{constructor(){so.set(this,Ft)}static getInstance(){return fo.instance||(fo.instance=new fo),fo.instance}createOrder(e,t){return Promise.resolve({orderId:""})}checkTransaction(e,t){const n={msg:"Success",orderId:"",resultCode:1,transTime:(new Date).getTime().toString(),createdAt:(new Date).getTime().toString(),transId:""};return Promise.resolve(n)}}so=new WeakMap;class mo{constructor(e){lo.set(this,void 0),co.set(this,void 0),o(this,lo,this.getInstance(),"f"),o(this,co,e,"f")}createOrder(e){return i(this,lo,"f").createOrder(i(this,co,"f"),e)}checkTransaction(e){return i(this,lo,"f").checkTransaction(i(this,co,"f"),e)}}lo=new WeakMap,co=new WeakMap,e([En,oo,t(0,io("object",{amount:Gn(["string","number"]),desc:Gn("string"),"method?":Gn("string",{values:["MOMO","ZALOPAY","MOMO_SANDBOX","ZALOPAY_SANDBOX","CC","CC_SANDBOX","ATM","ATM_SANDBOX"]})}))],mo.prototype,"createOrder",null),e([En,oo],mo.prototype,"checkTransaction",null);class go extends mo{getInstance(){return vo.getInstance()}}class yo extends mo{getInstance(){return fo.getInstance()}}const _o=kn();exports.default=void 0,window.onJSCall=e=>function(t){Xn.getInstance().onJSCall(e,t)},window.onMultiJSCall=e=>function(t){Xn.getInstance().onMultiJSCall(e,t)},window.zaloJSV2={zalo_h5_event_handler:function(e,t,n){Xn.getInstance().nativeEventHandler(e,t,n)}},exports.Payment=void 0,_o.isZalo?(exports.default=new po,exports.Payment=new go(exports.default)):(exports.default=new ho,exports.Payment=new yo(exports.default)),window.ZaloMiniAppSDK=exports.default,exports.SDKCreator=uo,exports.default=exports.default;
|
|
16
|
+
function e(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a}function t(e,t){return function(n,i){t(n,i,e)}}function n(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))}function i(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function o(e,t,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(e,n):o?o.value=n:t.set(e,n),n}Object.defineProperty(exports,"__esModule",{value:!0});var r=Object.prototype;var a=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||r)};var s=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),l=Object.prototype.hasOwnProperty;var c=function(e){if(!a(e))return s(e);var t=[];for(var n in Object(e))l.call(e,n)&&"constructor"!=n&&t.push(n);return t},u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function d(e,t){return e(t={exports:{}},t.exports),t.exports}var p="object"==typeof u&&u&&u.Object===Object&&u,h="object"==typeof self&&self&&self.Object===Object&&self,v=p||h||Function("return this")(),f=v.Symbol,m=Object.prototype,g=m.hasOwnProperty,y=m.toString,_=f?f.toStringTag:void 0;var E=function(e){var t=g.call(e,_),n=e[_];try{e[_]=void 0;var i=!0}catch(e){}var o=y.call(e);return i&&(t?e[_]=n:delete e[_]),o},S=Object.prototype.toString;var A=function(e){return S.call(e)},O=f?f.toStringTag:void 0;var T=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":O&&O in Object(e)?E(e):A(e)};var b=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var w,N=function(e){if(!b(e))return!1;var t=T(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},P=v["__core-js_shared__"],I=(w=/[^.]+$/.exec(P&&P.keys&&P.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"";var C=function(e){return!!I&&I in e},k=Function.prototype.toString;var R=function(e){if(null!=e){try{return k.call(e)}catch(e){}try{return e+""}catch(e){}}return""},B=/^\[object .+?Constructor\]$/,D=Function.prototype,j=Object.prototype,M=D.toString,x=j.hasOwnProperty,L=RegExp("^"+M.call(x).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var U=function(e){return!(!b(e)||C(e))&&(N(e)?L:B).test(R(e))};var W=function(e,t){return null==e?void 0:e[t]};var z=function(e,t){var n=W(e,t);return U(n)?n:void 0},F=z(v,"DataView"),G=z(v,"Map"),H=z(v,"Promise"),$=z(v,"Set"),V=z(v,"WeakMap"),Z=R(F),J=R(G),K=R(H),q=R($),Q=R(V),Y=T;(F&&"[object DataView]"!=Y(new F(new ArrayBuffer(1)))||G&&"[object Map]"!=Y(new G)||H&&"[object Promise]"!=Y(H.resolve())||$&&"[object Set]"!=Y(new $)||V&&"[object WeakMap]"!=Y(new V))&&(Y=function(e){var t=T(e),n="[object Object]"==t?e.constructor:void 0,i=n?R(n):"";if(i)switch(i){case Z:return"[object DataView]";case J:return"[object Map]";case K:return"[object Promise]";case q:return"[object Set]";case Q:return"[object WeakMap]"}return t});var X=Y;var ee=function(e){return null!=e&&"object"==typeof e};var te=function(e){return ee(e)&&"[object Arguments]"==T(e)},ne=Object.prototype,ie=ne.hasOwnProperty,oe=ne.propertyIsEnumerable,re=te(function(){return arguments}())?te:function(e){return ee(e)&&ie.call(e,"callee")&&!oe.call(e,"callee")},ae=Array.isArray;var se=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var le=function(e){return null!=e&&se(e.length)&&!N(e)};var ce=function(){return!1},ue=d((function(e,t){var n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,o=i&&i.exports===n?v.Buffer:void 0,r=(o?o.isBuffer:void 0)||ce;e.exports=r})),de={};de["[object Float32Array]"]=de["[object Float64Array]"]=de["[object Int8Array]"]=de["[object Int16Array]"]=de["[object Int32Array]"]=de["[object Uint8Array]"]=de["[object Uint8ClampedArray]"]=de["[object Uint16Array]"]=de["[object Uint32Array]"]=!0,de["[object Arguments]"]=de["[object Array]"]=de["[object ArrayBuffer]"]=de["[object Boolean]"]=de["[object DataView]"]=de["[object Date]"]=de["[object Error]"]=de["[object Function]"]=de["[object Map]"]=de["[object Number]"]=de["[object Object]"]=de["[object RegExp]"]=de["[object Set]"]=de["[object String]"]=de["[object WeakMap]"]=!1;var pe=function(e){return ee(e)&&se(e.length)&&!!de[T(e)]};var he=function(e){return function(t){return e(t)}},ve=d((function(e,t){var n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,o=i&&i.exports===n&&p.process,r=function(){try{var e=i&&i.require&&i.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=r})),fe=ve&&ve.isTypedArray,me=fe?he(fe):pe,ge=Object.prototype.hasOwnProperty;var ye=function(e){if(null==e)return!0;if(le(e)&&(ae(e)||"string"==typeof e||"function"==typeof e.splice||ue(e)||me(e)||re(e)))return!e.length;var t=X(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(a(e))return!c(e).length;for(var n in e)if(ge.call(e,n))return!1;return!0};var _e=function(e){return void 0===e};var Ee=function(e){return null===e};var Se=function(e){return"string"==typeof e||!ae(e)&&ee(e)&&"[object String]"==T(e)};var Ae=function(e){return"number"==typeof e||ee(e)&&"[object Number]"==T(e)};var Oe=function(e){return ee(e)&&"[object RegExp]"==T(e)},Te=ve&&ve.isRegExp,be=Te?he(Te):Oe;var we=function(e){return"symbol"==typeof e||ee(e)&&"[object Symbol]"==T(e)},Ne=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Pe=/^\w*$/;var Ie=function(e,t){if(ae(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!we(e))||(Pe.test(e)||!Ne.test(e)||null!=t&&e in Object(t))},Ce=z(Object,"create");var ke=function(){this.__data__=Ce?Ce(null):{},this.size=0};var Re=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Be=Object.prototype.hasOwnProperty;var De=function(e){var t=this.__data__;if(Ce){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Be.call(t,e)?t[e]:void 0},je=Object.prototype.hasOwnProperty;var Me=function(e){var t=this.__data__;return Ce?void 0!==t[e]:je.call(t,e)};var xe=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ce&&void 0===t?"__lodash_hash_undefined__":t,this};function Le(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Le.prototype.clear=ke,Le.prototype.delete=Re,Le.prototype.get=De,Le.prototype.has=Me,Le.prototype.set=xe;var Ue=Le;var We=function(){this.__data__=[],this.size=0};var ze=function(e,t){return e===t||e!=e&&t!=t};var Fe=function(e,t){for(var n=e.length;n--;)if(ze(e[n][0],t))return n;return-1},Ge=Array.prototype.splice;var He=function(e){var t=this.__data__,n=Fe(t,e);return!(n<0)&&(n==t.length-1?t.pop():Ge.call(t,n,1),--this.size,!0)};var $e=function(e){var t=this.__data__,n=Fe(t,e);return n<0?void 0:t[n][1]};var Ve=function(e){return Fe(this.__data__,e)>-1};var Ze=function(e,t){var n=this.__data__,i=Fe(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};function Je(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Je.prototype.clear=We,Je.prototype.delete=He,Je.prototype.get=$e,Je.prototype.has=Ve,Je.prototype.set=Ze;var Ke=Je;var qe=function(){this.size=0,this.__data__={hash:new Ue,map:new(G||Ke),string:new Ue}};var Qe=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Ye=function(e,t){var n=e.__data__;return Qe(t)?n["string"==typeof t?"string":"hash"]:n.map};var Xe=function(e){var t=Ye(this,e).delete(e);return this.size-=t?1:0,t};var et=function(e){return Ye(this,e).get(e)};var tt=function(e){return Ye(this,e).has(e)};var nt=function(e,t){var n=Ye(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};function it(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}it.prototype.clear=qe,it.prototype.delete=Xe,it.prototype.get=et,it.prototype.has=tt,it.prototype.set=nt;var ot=it;function rt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var i=arguments,o=t?t.apply(this,i):i[0],r=n.cache;if(r.has(o))return r.get(o);var a=e.apply(this,i);return n.cache=r.set(o,a)||r,a};return n.cache=new(rt.Cache||ot),n}rt.Cache=ot;var at=rt;var st=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,lt=/\\(\\)?/g,ct=function(e){var t=at(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(st,(function(e,n,i,o){t.push(i?o.replace(lt,"$1"):n||e)})),t}));var ut=function(e,t){for(var n=-1,i=null==e?0:e.length,o=Array(i);++n<i;)o[n]=t(e[n],n,e);return o},dt=f?f.prototype:void 0,pt=dt?dt.toString:void 0;var ht=function e(t){if("string"==typeof t)return t;if(ae(t))return ut(t,e)+"";if(we(t))return pt?pt.call(t):"";var n=t+"";return"0"==n&&1/t==-Infinity?"-0":n};var vt=function(e){return null==e?"":ht(e)};var ft=function(e,t){return ae(e)?e:Ie(e,t)?[e]:ct(vt(e))};var mt=function(e){if("string"==typeof e||we(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var gt=function(e,t){for(var n=0,i=(t=ft(t,e)).length;null!=e&&n<i;)e=e[mt(t[n++])];return n&&n==i?e:void 0};var yt=function(e,t,n){var i=null==e?void 0:gt(e,t);return void 0===i?n:i},_t=function(){try{var e=z(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var Et=function(e,t,n){"__proto__"==t&&_t?_t(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},St=Object.prototype.hasOwnProperty;var At=function(e,t,n){var i=e[t];St.call(e,t)&&ze(i,n)&&(void 0!==n||t in e)||Et(e,t,n)},Ot=/^(?:0|[1-9]\d*)$/;var Tt=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Ot.test(e))&&e>-1&&e%1==0&&e<t};var bt=function(e,t,n,i){if(!b(e))return e;for(var o=-1,r=(t=ft(t,e)).length,a=r-1,s=e;null!=s&&++o<r;){var l=mt(t[o]),c=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(o!=a){var u=s[l];void 0===(c=i?i(u,l,s):void 0)&&(c=b(u)?u:Tt(t[o+1])?[]:{})}At(s,l,c),s=s[l]}return e};var wt,Nt,Pt,It,Ct,kt,Rt,Bt,Dt,jt,Mt,xt={isEmpty:ye,isNull:Ee,isUndefined:_e,isFunction:N,isObject:b,isString:Se,isNumber:Ae,isArray:ae,isRegExp:be,get:yt,set:function(e,t,n){return null==e?e:bt(e,t,n)}};function Lt(e){return"function"==typeof window.Debug?window.Debug(e):function(...e){process.env.NODE_ENV}}exports.NetworkType=void 0,(wt=exports.NetworkType||(exports.NetworkType={})).none="none",wt.wifi="wifi",wt.cellular="cellular",wt.unknown="unknown",exports.PlatformType=void 0,(Nt=exports.PlatformType||(exports.PlatformType={})).wp="wp",Nt.android="android",Nt.iOS="iOS",Nt.unknown="unknown",exports.ProfileType=void 0,(Pt=exports.ProfileType||(exports.ProfileType={}))[Pt.user=1]="user",Pt[Pt.oa=0]="oa",Pt[Pt.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,(Ct=exports.PostFeedType||(exports.PostFeedType={}))[Ct.image=1]="image",Ct[Ct.link=4]="link",Ct[Ct.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",exports.OrientationType=void 0,(Rt=exports.OrientationType||(exports.OrientationType={}))[Rt.auto=1]="auto",Rt[Rt.portrait=2]="portrait",Rt[Rt.landscape=3]="landscape",exports.VibrateType=void 0,(Bt=exports.VibrateType||(exports.VibrateType={}))[Bt.oneShot=0]="oneShot",exports.NativeCode=void 0,(Dt=exports.NativeCode||(exports.NativeCode={}))[Dt.token_invalid=-2]="token_invalid",Dt[Dt.not_permission=-1]="not_permission",Dt[Dt.client_not_support=-5]="client_not_support",Dt[Dt.decode_failed=-4]="decode_failed",exports.Events=void 0,(jt=exports.Events||(exports.Events={})).AppPaused="h5.event.paused",jt.AppResumed="h5.event.resumed",jt.NetworkChanged="h5.event.connection.changed",jt.OnDataCallback="h5.event.webview.result",jt.OpenApp="h5.event.open.mp",exports.MediaPickerType=void 0,(Mt=exports.MediaPickerType||(exports.MediaPickerType={}))[Mt.photo=4]="photo",Mt[Mt.video=5]="video",Mt[Mt.file=6]="file";const Ut=e=>{const t=document.cookie;if(t){const o=t.split("; ");if(o&&o.length>0)for(var n=e.length+1,i=o.length-1;i>=0;i--){let t=o[i];if(t&&0===t.indexOf(e)&&(t=t.substring(n,t.length),t))return t=t.replace(/["']/g,""),t}}return null},Wt=e=>Ut(`${window.location.host}_`+e),zt=e=>Ut((()=>{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),Ft=window.zAppID,Gt=window.APP_ID,Ht=window.APP_CONFIG||{},$t="h5.zdn.vn_zoauth",Vt="h5.zdn.vn_zlink3rd",Zt="h5.zdn.vn_zoauth_vrf",Jt="https://graph.zalo.me/v2.0/me",Kt="https://h5.zalo.me/openapi/access_token",qt="https://oauth.zaloapp.com/v3/access_token",Qt="https://graph.zalo.me/v2.0/me/friends/list",Yt=e=>({NONE:e?-2:0,WIFI:e?0:1,"2G":2,"3G":e?15:2,"4G":e?13:2}),Xt={GET_DOWNLOADED_STICKER:{name:"action.get.downloaded.sticker",have_callback:!0},OPEN_SHARE_STICKER:{name:"action.open.share.sticker"},OPEN_PROFILE:{name:"action.open.profile"},OPEN_FEED_DETAIL:{name:"action.open.feeddetail"},OPEN_FRIEND_RADA:{name:"action.open.friendrada"},OPEN_INAPP:{name:"action.open.inapp"},OPEN_OUTAPP:{name:"action.open.outapp"},OPEN_PAGE:{name:"action.open.page"},OPEN_PHOTODETAIL:{name:"action.open.photodetail"},OPEN_GALARY:{name:"action.open.galary"},OPEN_GAMECENTER:{name:"action.open.gamecenter"},OPEN_GAMENEWS:{name:"action.open.gamenews"},OPEN_TAB_CONTACT:{name:"action.open.tab.contact"},OPEN_TAB_SOCIAL:{name:"action.open.tab.social"},OPEN_FRIENDSUGGEST:{name:"action.open.friendsuggest"},OPEN_GROUPLIST:{name:"action.open.grouplist"},OPEN_NEARBY:{name:"action.open.nearby"},OPEN_ROOM:{name:"action.open.room"},OPEN_STICKERSTORE:{name:"action.open.stickerstore"},OPEN_CREATECHAT:{name:"action.open.createchat"},COPY_LINK_CATESTICKER:{name:"action.copy.link.catesticker"},REQUEST_BUY_STICKER:{name:"action.request.buy.sticker"},OPEN_CHAT:{name:"action.open.chat"},OPEN_TAB_CHAT:{name:"action.open.tab.chat"},OPEN_CHATGROUP:{name:"action.open.chatgroup"},OPEN_ADDFRIEND:{name:"action.open.addfriend"},OPEN_TAB_MORE:{name:"action.open.tab.more"},OPEN_POSTFEED:{name:"action.open.postfeed"},OPEN_LOGINDEVICES:{name:"action.open.logindevices"},OPEN_SENDSTICKER:{name:"action.open.sendsticker"},REPORT_ABUSE:{name:"action.report.abuse",have_callback:!0},FOLLOW_OA:{name:"action.follow.oa",have_callback:!0},UNFOLLOW_OA:{name:"action.unfollow.oa",have_callback:!0},OPEN_GAMEDETAIL:{name:"action.open.gamedetail"},OPEN_SHARESHEET:{name:"action.open.sharesheet",have_callback:!0},REQUEST_PERMISSION_CAMERA:{name:"action.request.permission.camera"},CHANGE_TITLE_HEADER:{name:"action.change.title.header",skip_jump:!0},WEBVIEW_CLEARCACHE:{name:"action.webview.clearcache"},WEBVIEW_CONFIRMCACHE:{name:"action.webview.confirmcache"},WEBVIEW_ISVISIBLE:{name:"action.webview.isvisible"},WEBVIEW_NETWORKTYPE:{name:"action.webview.networktype",skip_jump:!0},CHANGE_BUTTON_HEADER:{name:"action.change.button.header"},CREATE_OPTIONS_MENU:{name:"action.create.options.menu",skip_jump:!0,have_callback:!0},CREATE_SHORTCUT:{name:"action.create.shortcut"},CHANGE_ACTIONBAR_LEFTBUTTON_TYPE:{name:"action.change.actionbar.leftbutton.type",skip_jump:!0,have_callback:!0},WINDOW_CLOSE:{name:"action.window.close",skip_jump:!0,have_callback:!0},WEBVIEW_CHECKRESERROR:{name:"action.webview.checkResError"},IAP_REQUESTPAYMENT:{name:"action.iap.requestpayment"},ZBROWSER_GETSTATS:{name:"action.zbrowser.getstats"},ZBROWSER_JSBRIDGE:{name:"action.zbrowser.jsbridge",skip_jump:!0,have_callback:!0},PROMPT_AUTHENTICATION:{name:"action.prompt.authentication"},CHANGE_ACTIONBAR_COLOR:{name:"action.change.actionbar.color",skip_jump:!0},PROMPT_AUTHENTICATION_CHECK_STATE:{name:"action.prompt.authentication.check_state"},OPEN_APPSTORE:{name:"action.open.appstore"},GET_LOCATION:{name:"action.get.location",have_callback:!0},QUERY_LOCATION_HIDE:{name:"action.query.location.hide",have_callback:!0},SHOW_TOAST:{name:"action.show.toast",have_callback:!0},OPEN_APP:{name:"action.open.app"},HIDE_KEYBOARD:{name:"action.hide.keyboard"},OPEN_PHONE:{name:"action.open.phone"},OPEN_QR:{name:"action.open.qr"},OPEN_SMS:{name:"action.open.sms"},VIEW_MYQR:{name:"action.view.myqr",have_callback:!0},KEEP_SCREEN:{name:"action.keep.screen",have_callback:!0},CHANGE_AUTOROTATE:{name:"action.change.autorotate",skip_jump:!0},CHECK_APP_INSTALLED:{name:"action.check.app.installed"},QUERY_SHOW:{name:"action.query.show"},QUERY_HIDE:{name:"action.query.hide"},OPEN_INAPPRW:{name:"action.open.inapprw"},ZALORUN_GETTRACKINGSTATUS:{name:"action.zalorun.getTrackingStatus",have_callback:!0},ZALORUN_SETTRACKINGSTATUS:{name:"action.zalorun.setTrackingStatus",have_callback:!0},ZALORUN_GETDAYSTEP:{name:"action.zalorun.getDayStep",have_callback:!0},ZALORUN_FORCESUBMITDATA:{name:"action.zalorun.forceSubmitData",have_callback:!0},ZALORUN_SETWEIGHT:{name:"action.zalorun.setWeight",have_callback:!0},OPEN_PROFILE_EXT:{name:"action.open.profile.ext"},DOWNLOAD_CATE:{name:"action.download.cate",have_callback:!0},JUMP_LOGIN:{name:"action.jump.login",skip_jump:!0,white_list:!0},OPEN_ADTIMA_ADS_INTERSTITIAL:{name:"action.open.adtima.ads.interstitial"},OPEN_ADTIMA_ADS:{name:"action.open.adtima.ads"},GET_ADIDCLIENT:{name:"action.get.adidclient"},SCAN_IBEACON:{name:"action.scan.ibeacon"},INTERACTIVE_VIBRATION:{name:"action.interactive.vibration"},SAVE_IMAGE_GALLERY:{name:"action.save.image.gallery",version_live:{iOS:408}},OPEN_MP:{name:"action.open.mp",version_live:{iOS:402}},CHANGE_ACTIONBAR:{name:"action.change.actionbar",version_live:{iOS:402},skip_jump:!0},ZBROWSER_MPDS:{name:"action.zbrowser.mpds",version_live:{iOS:402}},WEBVIEW_SET_RESULT:{name:"action.webview.set.result",version_live:{iOS:416}},MP_GET_NUMBER:{name:"action.mp.get.number",version_live:{iOS:416}},MP_OPEN_PROFILE_PICKER:{name:"action.mp.open.profile.picker",version_live:{iOS:432}},GET_SUPPORTED_ACTIONS:{name:"action.get.supported.actions",white_list:!0},MP_JOIN_WIFI:{name:"action.mp.join.wifi",version_live:{android:0,iOS:999},have_permission:!1,white_list:!1},PICK_MEDIA:{name:"action.pick.media",version_live:{iOS:440}},MP_CLOSE_LOADINGVIEW:{name:"action.mp.close.loadingview"}},en=0,tn=-1400,nn=-1500,on=-1401,rn=-1403,an=-1404,sn={SUCCESS:"Success",READ_MORE:"Read more at: https://miniapp.zalo.me/docs/api",LOGIN_REQUIRED:"Please login before to call this api. Read more at: https://miniapp.zalo.me/docs/api/login",LOGIN_FAILED:"Login failed.",NOT_PERMISSION:"You don't have permission to call this api",CLIENT_NOT_SUPPORT:"This API is not supported in this Zalo version",DECODE_FAILED:"Can not decode your data. Read more at: https://miniapp.zalo.me/docs/api/error"},ln="apps/get-info",cn={android:12100571,iOS:400,wp:0,unknown:0},un=[Xt.GET_DOWNLOADED_STICKER.name,Xt.OPEN_SHARE_STICKER.name,Xt.OPEN_PROFILE.name,Xt.OPEN_FEED_DETAIL.name,Xt.OPEN_FRIEND_RADA.name,Xt.OPEN_INAPP.name,Xt.OPEN_OUTAPP.name,Xt.OPEN_PAGE.name,Xt.OPEN_PHOTODETAIL.name,Xt.OPEN_GALARY.name,Xt.OPEN_GAMECENTER.name,Xt.OPEN_GAMENEWS.name,Xt.OPEN_TAB_CONTACT.name,Xt.OPEN_TAB_SOCIAL.name,Xt.OPEN_FRIENDSUGGEST.name,Xt.OPEN_GROUPLIST.name,Xt.OPEN_NEARBY.name,Xt.OPEN_ROOM.name,Xt.OPEN_STICKERSTORE.name,Xt.OPEN_CREATECHAT.name,Xt.COPY_LINK_CATESTICKER.name,Xt.REQUEST_BUY_STICKER.name,Xt.OPEN_CHAT.name,Xt.OPEN_TAB_CHAT.name,Xt.OPEN_CHATGROUP.name,Xt.OPEN_ADDFRIEND.name,Xt.OPEN_TAB_MORE.name,Xt.OPEN_POSTFEED.name,Xt.OPEN_LOGINDEVICES.name,Xt.OPEN_SENDSTICKER.name,Xt.REPORT_ABUSE.name,Xt.FOLLOW_OA.name,Xt.UNFOLLOW_OA.name,Xt.OPEN_GAMEDETAIL.name,Xt.OPEN_SHARESHEET.name,Xt.REQUEST_PERMISSION_CAMERA.name,Xt.CHANGE_TITLE_HEADER.name,Xt.WEBVIEW_CLEARCACHE.name,Xt.WEBVIEW_CONFIRMCACHE.name,Xt.WEBVIEW_ISVISIBLE.name,Xt.WEBVIEW_NETWORKTYPE.name,Xt.CHANGE_BUTTON_HEADER.name,Xt.CREATE_OPTIONS_MENU.name,Xt.CREATE_SHORTCUT.name,Xt.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE.name,Xt.WINDOW_CLOSE.name,Xt.WEBVIEW_CHECKRESERROR.name,Xt.IAP_REQUESTPAYMENT.name,Xt.ZBROWSER_GETSTATS.name,Xt.ZBROWSER_JSBRIDGE.name,Xt.PROMPT_AUTHENTICATION.name,Xt.CHANGE_ACTIONBAR_COLOR.name,Xt.PROMPT_AUTHENTICATION_CHECK_STATE.name,Xt.OPEN_APPSTORE.name,Xt.GET_LOCATION.name,Xt.QUERY_LOCATION_HIDE.name,Xt.SHOW_TOAST.name,Xt.OPEN_APP.name,Xt.HIDE_KEYBOARD.name,Xt.OPEN_PHONE.name,Xt.OPEN_QR.name,Xt.OPEN_SMS.name,Xt.VIEW_MYQR.name,Xt.KEEP_SCREEN.name,Xt.CHANGE_AUTOROTATE.name,Xt.CHECK_APP_INSTALLED.name,Xt.QUERY_SHOW.name,Xt.QUERY_HIDE.name,Xt.OPEN_INAPPRW.name,Xt.ZALORUN_GETTRACKINGSTATUS.name,Xt.ZALORUN_SETTRACKINGSTATUS.name,Xt.ZALORUN_GETDAYSTEP.name,Xt.ZALORUN_FORCESUBMITDATA.name,Xt.ZALORUN_SETWEIGHT.name,Xt.OPEN_PROFILE_EXT.name,Xt.DOWNLOAD_CATE.name,Xt.JUMP_LOGIN.name,Xt.OPEN_ADTIMA_ADS_INTERSTITIAL.name,Xt.OPEN_ADTIMA_ADS.name,Xt.GET_ADIDCLIENT.name,Xt.SCAN_IBEACON.name,Xt.SAVE_IMAGE_GALLERY.name,Xt.OPEN_MP.name,Xt.CHANGE_ACTIONBAR.name,Xt.INTERACTIVE_VIBRATION.name,Xt.ZBROWSER_MPDS.name],dn=0,pn=3,hn=1,vn=0,fn="https://payment-mini.zalo.me/api/order/create",mn="https://payment-mini.zalo.me/api/transaction";class gn{constructor(e,t,n){this.code=e,this.message=t,this.api=n}toString(){return`api: ${this.api}; code: ${this.code}; message: ${this.message}`}}class yn extends gn{constructor(e,t){super(e,t),this.message=`${t}. ${sn.READ_MORE}`,this.handler()}handler(){switch(this.code){case exports.NativeCode.token_invalid:this.code=on,this.message=sn.LOGIN_REQUIRED;break;case exports.NativeCode.not_permission:this.code=rn,this.message=sn.NOT_PERMISSION;break;case exports.NativeCode.client_not_support:this.code=an,this.message=sn.CLIENT_NOT_SUPPORT;break;case exports.NativeCode.decode_failed:this.message=sn.DECODE_FAILED}}}const _n={handler:null,setHandler(e){this.handler=e}};_n.setHandler(((e,t)=>t instanceof gn?(t.api=e,t):new gn(-2001,xt.isNull(t.message)?"Unknown Error":t.message,e)));const En=(e,t,i)=>{const o=i.value;return i.value=function(...e){return n(this,void 0,void 0,(function*(){const{success:i,fail:r}=Array.isArray(e)&&e.length>0&&e[0];return new Promise(((a,s)=>n(this,void 0,void 0,(function*(){try{const t=yield o.apply(this,e);!xt.isNull(i)&&xt.isFunction(i)?i.call(null,t,this):a(t)}catch(e){if("login"!==(null==e?void 0:e.api)&&((null==e?void 0:e.code)===on||(null==e?void 0:e.code)===rn)){let t=!1;this instanceof uo&&(t=this.getLoginStatus()),t||(e=new gn(on,sn.LOGIN_REQUIRED))}const{handler:n}=_n,i=n.call(null,t,e,this);window.zmpSentry&&window.zmpSentry.throwError(i.toString()),!xt.isNull(r)&&xt.isFunction(r)?r.call(null,i,this):s(i)}}))))}))},i},Sn=(e,t,n)=>{const i=n.value;return n.value=function(...e){try{return i.apply(this,e)}catch(e){if("login"!==(null==e?void 0:e.api)&&((null==e?void 0:e.code)===on||(null==e?void 0:e.code)===rn)){let t=!1;this instanceof uo&&(t=this.getLoginStatus()),t||(e=new gn(on,sn.LOGIN_REQUIRED))}const{handler:n}=_n,i=n.call(null,t,e,this);throw window.zmpSentry&&window.zmpSentry.throwError(i.toString()),i}},n},An=(e,t)=>({code:en,message:t||sn.SUCCESS,data:e||{}}),On={badRequest:e=>new gn(tn,e),loginFailed:()=>new gn(tn,sn.LOGIN_FAILED),loginRequired:()=>new gn(on,sn.LOGIN_REQUIRED),missingParam:e=>new gn(tn,`Missing required argument: ${e}`),wrongTypeParam:(e,t,n)=>new gn(tn,`Wrong type of parameter '${e}'. Expected ${t}, but got ${n}`),cannotGetShareInfo:()=>new gn(nn,"Can not get app info to share"),lengthInvalid:e=>new gn(tn,`${e} length is invalid.`)};const Tn={encode:function(e){var t=[];for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];if(void 0===i)return;if(null===i)return void t.push(n);t.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}return t.join("&")},decode:function(e,t){var n={};if(""===e)return n;for(var i=e.split("&"),o=0;o<i.length;o++){var r=i[o].split("=",2),a=decodeURIComponent(r[0]);if(t&&Object.prototype.hasOwnProperty.call(n,a))throw new URIError("Duplicate key: "+a);n[a]=2===r.length?decodeURIComponent(r[1]):null}return n},appendToUrl:function(e,t){return e+(-1!==e.indexOf("?")?"&":"?")+("string"==typeof t?t:Tn.encode(t))},getParameterByName:function(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");var n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return n?n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"":null},getParamsAsObject:function(e){var t={};return e?(e.split("&").map((function(e){var n=e.split("=");n&&2==n.length&&(t[n[0]]=decodeURIComponent(n[1].replace(/\+/g," ")))})),t):t},toQueryString:function(e){if(!e)return"";if("object"!=(void 0===e?"undefined":typeof e))return e;var t=Object.keys(e),n=[];return t.map((function(t){var i=e[t],o=[t,i="object"==(void 0===i?"undefined":typeof i)?JSON.stringify(i):encodeURIComponent(i)].join("=");n.push(o)})),n.join("&")}},bn=new RegExp("[\\u0300-\\u036f]","g"),wn=new RegExp("[đ|Đ]","g"),Nn=new RegExp("\\s","g"),Pn=Lt("zmp:utils:common"),In=e=>{try{new URL(e)}catch(e){return!1}return!0},Cn=()=>navigator.userAgent||navigator.vendor||window.opera,kn=()=>{const e=Cn().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)}},Rn=e=>{const t=document.getElementsByTagName("meta");for(let n=0;n<t.length;n++)if(t[n].getAttribute("name")===e||t[n].getAttribute("property")===e)return t[n].getAttribute("content");return""},Bn=()=>{const e=Cn().toLowerCase().split("zalo")[1];if(e){return e.replace(" ","").split("/")[1]||""}return""},Dn=()=>{let e=kn();return e.isWP?exports.PlatformType.wp:e.isAndroid?exports.PlatformType.android:e.isIOS?exports.PlatformType.iOS:exports.PlatformType.unknown},jn=(e,t)=>{const n=t.toLowerCase(),i=n.split(/[<>]/i),o="array"===i[0];return!!("url"===n&&In(e)||o&&("array"===n&&Array.isArray(e)||((e,t)=>Array.isArray(t)&&!t.some((t=>"url"===e?!In(t):typeof t!==e)))(i[1],e))||!Array.isArray(e)&&typeof e===t)},Mn=e=>(e=>{let t=Wt(e);return t||(t=zt(e),t)?t:Ut(e)})(e),xn=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");return JSON.parse(t,((e,t)=>t))}return xt.isObject(e)?e:new Function("return "+e)()},Ln=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 n=e.length,i=0;i<n;i++)t.push(Ln(e[i]));return"["+t.join(",")+"]"}if("object"==typeof e){for(var o in t=new Array,e)t.push('"'+o+'":'+Ln(e[o]));return"{"+t.join(",")+"}"}return e.toString()},Un=()=>{try{const e=Number(Bn()),t=Dn();return e>=cn[t]}catch(e){return!0}},Wn=e=>JSON.stringify(e).replace(/"/g,'\\"').replace(/'/g,"'"),zn=e=>{try{if(e){Pn(e);const t=e.replace(/\\/g,"").replace(/'/g,"'");return Pn("formattedValue",t,JSON.parse(t),typeof JSON.parse(t)),JSON.parse(t)}return null}catch(t){return Pn("parse json error:",t),e}},Fn=(e,t,i,o,r,a)=>n(void 0,void 0,void 0,(function*(){const n=new URL(location.href),s=new URLSearchParams;let l=`${n.pathname}${n.search}`;a&&(l=`/zapps/${e}${"/"===a[0]?"":"/"}${a}`);const c=new URL(`https://zalo.me/app/link${l}`);s.append("title",i),s.append("description",o||""),s.append("thumbnail",r),s.append("url",c.href),s.append("accessToken",t||"");const u=yield fetch("https://h5.zalo.me/openapi/create-sharelink",Object.assign({method:"POST",body:s},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})),d=yield u.json();if(!d||0!==d.err)throw On.cannotGetShareInfo();return c.search=`${c.search}&zshareId=${d.data.shareId}`,Object.assign(Object.assign({},d.data),{shareableLink:c.href})})),Gn=(e,t)=>n=>{if(!(Array.isArray(e)?e.some((e=>jn(n,e))):jn(n,e)))return{error:!0,errorMessage:e};if(t){if(Array.isArray(null==t?void 0:t.values))return{error:!(null==t?void 0:t.values.includes(n)),errorMessage:null==t?void 0:t.values.toString()};if(xt.isNumber(null==t?void 0:t.maxLength))return{error:xt.isString(n)&&n.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:n<(null==t?void 0:t.min)||n>(null==t?void 0:t.max),errorMessage:`data must be in between ${null==t?void 0:t.min} and ${null==t?void 0:t.max}`};if(xt.isNumber(null==t?void 0:t.min))return{error:n<(null==t?void 0:t.min),errorMessage:`data must >= ${null==t?void 0:t.min}`};if(xt.isNumber(null==t?void 0:t.max))return{error:n>(null==t?void 0:t.max),errorMessage:`data must <= ${null==t?void 0:t.max}`};if(xt.isRegExp(null==t?void 0:t.regex))return{error:!t.regex.test(n),errorMessage:"data must valid"}}return{error:!1}},Hn=(e,t,i)=>n(void 0,void 0,void 0,(function*(){const n={appId:e,versionStatus:t};xt.isUndefined(i)||(n.currentVersion=i);const o=Tn.appendToUrl(`https://h5.zalo.me/${ln}`,n),r=yield fetch(o,{credentials:"include"});if(r.ok){const e=yield r.json();if(e.err<0||!e.data)throw new Error(e);return{name:e.data.name,version:e.data.version,description:e.data.description,appUrl:e.data.appUrl,qrCodeUrl:e.data.qrCodeUrl,logoUrl:e.data.logoUrl}}throw new Error("Can't get app info")}));var $n=d((function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function r(e,t,i,r,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new o(i,r||e,a),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],s]:e._events[l].push(s):(e._events[l]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,i,o=[];if(0===this._eventsCount)return o;for(i in e=this._events)t.call(e,i)&&o.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},s.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var o=0,r=i.length,a=new Array(r);o<r;o++)a[o]=i[o].fn;return a},s.prototype.listenerCount=function(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},s.prototype.emit=function(e,t,i,o,r,a){var s=n?n+e:e;if(!this._events[s])return!1;var l,c,u=this._events[s],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,i),!0;case 4:return u.fn.call(u.context,t,i,o),!0;case 5:return u.fn.call(u.context,t,i,o,r),!0;case 6:return u.fn.call(u.context,t,i,o,r,a),!0}for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var p,h=u.length;for(c=0;c<h;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,i);break;case 4:u[c].fn.call(u[c].context,t,i,o);break;default:if(!l)for(p=1,l=new Array(d-1);p<d;p++)l[p-1]=arguments[p];u[c].fn.apply(u[c].context,l)}}return!0},s.prototype.on=function(e,t,n){return r(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return r(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,i,o){var r=n?n+e:e;if(!this._events[r])return this;if(!t)return a(this,r),this;var s=this._events[r];if(s.fn)s.fn!==t||o&&!s.once||i&&s.context!==i||a(this,r);else{for(var l=0,c=[],u=s.length;l<u;l++)(s[l].fn!==t||o&&!s[l].once||i&&s[l].context!==i)&&c.push(s[l]);c.length?this._events[r]=1===c.length?c[0]:c:a(this,r)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new i,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s}));class Vn extends $n{constructor(){super(),this.debug=Lt("zmp:event-emitter")}static getInstance(){return Vn.instance||(Vn.instance=new Vn),Vn.instance}h5ConfirmHandleEvent(e,t,n){ZaloJavaScriptInterface.jsH5EventCallback(e,t,n||"")}on(e,t,n){this.debug(`register ${e}: ${n}`);return super.on(e,((i,o)=>{this.h5ConfirmHandleEvent(i,e,n),t(o)}),n)}once(e,t,n){this.debug(`register once ${e}: ${n}`);return super.once(e,((i,o)=>{this.h5ConfirmHandleEvent(i,e,n),t(o)}),n)}}var Zn={},Jn=function(e,t,n){var i=t||"default";return function(){var t=i in Zn?Zn[i](e,n):e;return t.apply(this,arguments)}};Jn.setWrapper=function(e){var t=arguments.length<=1||void 0===arguments[1]?"default":arguments[1];Zn[t]=e};var Kn={error:{code:1,error_subcode:1357046,message:"Received Invalid JSON reply.",type:"http"}};function qn(e){try{return null===e?Kn:JSON.parse(e)}catch(e){return Kn}}var Qn,Yn={execute:function(e,t,n,i){n.suppress_http_code=1;var o=Tn.encode(n);"post"!=t&&(e=Tn.appendToUrl(e,o),o="");var r=function(e,t){if(!self.XMLHttpRequest)return null;var n=new XMLHttpRequest,i=function(){};if(!("withCredentials"in n))return null;n.open(e,t,!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded");var o={send:function(e){n.send(e)}},r=Jn((function(){r=i,"onload"in o&&o.onload(n)}),"entry","XMLHttpRequest:load"),a=Jn((function(){a=i,"onerror"in o&&o.onerror(n)}),"entry","XMLHttpRequest:error");return n.onload=function(){r()},n.onerror=function(){a()},n.onreadystatechange=function(){4==n.readyState&&(200==n.status?r():a())},o}(t,e);return!!r&&(r.onload=function(e){i(qn(e.responseText))},r.onerror=function(e){e.responseText?i(qn(e.responseText)):i({error:{code:1,error_subcode:1357045,message:"unknown error (empty response)",status:e.status,type:"http"}})},r.send(o),!0)}};class Xn extends $n{constructor(){super(),this.debug=Lt("zmp:ZaloJSBridge"),this.events=Vn.getInstance(),this._accessTk=Mn("zacc_session")||"DEFAULT_ACCESS_TOKEN",this._jsAccessTk=Mn("zlink3rd")||"DEFAULT_JS_TOKEN",this.results=[],this._userAgent=Cn(),this._device=kn(),this._jsCallFuncCallbacks={},this.events.on(exports.Events.AppPaused,(()=>{if(this.results.length>0){let e=this.results;this.results=[];try{this.sendLogData(e)}catch(e){}}})),this.sendLogTimer?clearInterval(this.sendLogTimer):this.sendLogTimer=setInterval((()=>{if(this.results.length>0){let e=this.results;this.results=[];try{this.sendLogData(e)}catch(e){}}}),5e3)}static getInstance(){return Xn.instance||(Xn.instance=new Xn),Xn.instance}set accessTk(e){this._accessTk=e}set jsAccessTk(e){this._jsAccessTk=e}sendLogData(e){try{Yn.execute("https://h5.zalo.me/log/async","post",{appId:window.APP_ID,data:JSON.stringify(e)},(e=>{}))}catch(e){}}onJSCall(e,t){try{this.debug("onJSCall",e,t);const n=xn(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,i=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,n)}catch(e){console.error("Call callback error",e)}i&&clearTimeout(i),this._jsCallFuncCallbacks[e]=null,delete this._jsCallFuncCallbacks[e]}}this.results.push({action:n.action,error:n.error_code})}catch(e){console.log("onJSCall","error",e)}}onMultiJSCall(e,t){try{this.debug("onMultiJSCall",e,t);const n=xn(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,i=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,n)}catch(e){console.error("Call callback error",e)}i&&clearTimeout(i)}}this.results.push({action:n.action,error:n.error_code})}catch(e){console.log("onMultiJSCall","error",e)}}nativeEventHandler(e,t,n){this.debug(`eventId: ${e}, eventName: ${t}, eventData: ${n}`);const i=zn(n);this.debug(i);const o=this.handleEventData(t,i);this.events.emit(t,e,o)}handleEventData(e,t){try{switch(e){case exports.Events.OpenApp:const{url:e}=t,n=new URL(e),i=n.pathname.split(`/zapps/${Gt}`)[1];return{path:`${i||"/"}${n.search}`};default:return t}}catch(e){return t}}defaultCallback(e){null!=e&&(e=xn(e))}jsCall(e,t,n,i=!1,o=3,r=!0){try{const a=e.name,s=((e="")=>`${e.normalize("NFD").replace(bn,"").replace(wn,"d").replace(Nn,"").toLowerCase()}_${Math.random().toString(36).substr(2,4)}`)(a);if(!this._device.isMobile||xt.isEmpty(a))return this.onJSCall(s,{error_code:-13,error_message:"params invalid!",data:{device:this._device.isMobile,jsToken:this._jsAccessTk,access_token:this._accessTk},action:a}),!1;null==t&&(t={}),n||(n=this.defaultCallback);const l={error_code:-14,error_message:"Request Timeout!",data:{},action:a};this._jsCallFuncCallbacks[s]={timeout:r&&e.have_callback&&setTimeout((()=>{this.onJSCall(s,l)}),8e3),callback:n};try{return t=Ln(t),i?this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,window.onMultiJSCall(s)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,`window.onMultiJSCall('${s}')`):this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,window.onJSCall(s)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,`window.onJSCall('${s}')`)}catch(r){if(!(o-- >0)){const e={error_code:-5,error_message:"Not ready!",data:{userAgent:this._userAgent,options:t,jsToken:this._jsAccessTk,access_token:this._accessTk},action:a,js_error:r};return this.onJSCall(s,e),!1}setTimeout((()=>{this.jsCall(e,t,n,i,o)}),500)}}catch(e){console.log("jsCall","error",e)}return!1}}class ei{constructor(){this.debug=Lt("zmp:ZJSBridgeProvider"),Qn.set(this,void 0),o(this,Qn,Xn.getInstance(),"f")}setZAccSession(e){i(this,Qn,"f").accessTk=e}setJSToken(e){i(this,Qn,"f").jsAccessTk=e}callNative(e,t,o){return this.debug(e.name,t),new Promise(((r,a)=>{const s=i=>n(this,void 0,void 0,(function*(){try{const n=new yn(i.error_code,`${i.action}: ${i.error_message}`);if(null==o?void 0:o.callback){const e=yield o.callback(i,n);return r(e)}if(i&&i.error_code>=0)r(i.data||{});else if(i&&i.error_code<0){try{window.zmpSentry&&window.zmpSentry.captureMessage(`${e.name}: call native fail`,{extra:{data:t,rs:i}})}catch(e){}return a(n)}}catch(e){return a(e)}})),l=kn().isIOS,c=(e=>{var t;const n=Bn(),i=(null===(t=null==e?void 0:e.version_live)||void 0===t?void 0:t.iOS)||0;return!!(Array.isArray(window.ignoreCheckSupport)&&window.ignoreCheckSupport.length>0&&window.ignoreCheckSupport.includes(e.name))||n>=i})(e);if(l&&!c){const t=new yn(-5,`${e}: Client isn't support this action`);return a(t)}(null==o?void 0:o.delay)?setTimeout((()=>{i(this,Qn,"f").jsCall(e,t,s,null==o?void 0:o.isMultiCallback,null==o?void 0:o.nRetry,null==o?void 0:o.haveTimeout)}),o.delay):i(this,Qn,"f").jsCall(e,t,s,null==o?void 0:o.isMultiCallback,null==o?void 0:o.nRetry,null==o?void 0:o.haveTimeout)}))}}Qn=new WeakMap;var ti,ni,ii,oi,ri;class ai{static getVersion(){return"2.19.1"}static getSystemInfo(){return{version:Rn("version-id")||"",apiVersion:"2.19.1",zaloVersion:Bn(),platform:Dn(),language:navigator.language,zaloLanguage:window.zLanguage||"vi",zaloTheme:window.zTheme||"light"}}static getAppInfo(){return n(this,void 0,void 0,(function*(){const e=this.getAppId(),t=this.getSystemInfo();return yield Hn(e,0,t.version)}))}}class si{static setNavigationBarTitle(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.CHANGE_TITLE_HEADER,{title:e.title},{haveTimeout:!1})}))}static setNavigationBarColor(e){return n(this,void 0,void 0,(function*(){const t={};let n;xt.isEmpty(e.textColor)||(t.textColor=e.textColor),xt.isString(e.color)&&e.color.length>0?(xt.isEmpty(e.color)||(t.backgroundColor=e.color),n=5):(xt.isEmpty(e.statusBarColor)||(t.backgroundColor=e.statusBarColor),n=6),this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{actionbarType:n,dataConfig:Object.assign(Object.assign({},e.dataConfig),t)}))),yield this.callNative(Xt.CHANGE_ACTIONBAR,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarLeftButton(e){return n(this,void 0,void 0,(function*(){const t="none"===e.type||"home"===e.type?pn:dn,n="home"===e.type||"both"===e.type?hn:vn;this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{buttonType:t,dataConfig:Object.assign(Object.assign({},e.dataConfig),{viewInLeftType:t}),homeConfig:Object.assign(Object.assign({},e.homeConfig),{enable:n})}))),yield this.callNative(Xt.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarRightButton(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.CREATE_OPTIONS_MENU,{supportToolBar:e.supportToolBar,reset:e.reset,menuListItems:e.menuListItems,zapp:this.getAppId()})}))}}class li{static setBackgroundColor(e){return n(this,void 0,void 0,(function*(){xt.isString(e.backgroundColor)&&e.backgroundColor.length>0&&(yield this.callNative(Xt.CHANGE_ACTIONBAR,{actionbarType:this.isShowNavBar?5:6,dataConfig:{backgroundColor:e.backgroundColor,textColor:e.textColor}}))}))}}class ci{constructor(e,t,n,i){this.title=i,this.severity=t;const o=new Date;if(this.time=o.toLocaleTimeString(),this.content=e,n>0){const e=(new Error).stack;this.stack=e?e.replace("Error\n",""):""}}toString(){return(this.content.stack?[this.title,this.severity.toUpperCase(),this.time,this.content,this.content.stack.replace("Error:","")]:[this.title,this.severity.toUpperCase(),this.time,JSON.stringify(this.content),this.stack]).join(" ")}}ti=new WeakMap,ni=new WeakMap,ii=new WeakMap,oi=new WeakMap,ri=new WeakMap;const ui=new class{constructor(){ti.set(this,3),ni.set(this,["none","error","warn","info"]),ii.set(this,"[zmp] > "),oi.set(this,{error:0,warn:0,info:0,firstError:null,lastError:null}),ri.set(this,((e,t,n)=>{i(this,oi,"f")[i(this,ni,"f")[e]]++;const r=i(this,ni,"f")[e];if(o(this,ii,i(this,ii,"f")+("string"!=typeof t?new ci(t,r,e,n).toString():t),"f"),!(e>i(this,ti,"f")))switch(e){case 1:console.error(i(this,ii,"f"));break;case 2:console.warn(i(this,ii,"f"));break;case 3:console.info(i(this,ii,"f"));break;default:throw new Error("internal")}}))}setLogLevel(e){o(this,ti,e,"f")}info(e){i(this,ri,"f").call(this,3,e)}warn(e,t){i(this,ri,"f").call(this,2,e,t)}error(e,t){i(this,ri,"f").call(this,1,e,t)}getMetrics(){return i(this,oi,"f")}};class di{static setDeviceOrientation(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.CHANGE_AUTOROTATE,{autoRotate:exports.OrientationType[e.rotate]})}))}static getNetworkType(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.WEBVIEW_NETWORKTYPE,{url:window.location.href,featureId:""}).then((e=>{const t=e.network;let n;const i=kn().isAndroid;switch(t){case Yt(i).NONE:n=exports.NetworkType.none;break;case Yt(i).WIFI:n=exports.NetworkType.wifi;break;case Yt(i)["2G"]:case Yt(i)["3G"]:case Yt(i)["4G"]:n=exports.NetworkType.cellular;break;default:n=exports.NetworkType.unknown}return{networkType:n}}))}))}static onNetworkStatusChange(e){return n(this,void 0,void 0,(function*(){yield this.events.on(exports.Events.NetworkChanged,(t=>{const n=t&&t.state;this.getNetworkType().then((t=>{const i={isConnected:"CONNECTED"===n,networkType:t&&t.networkType};e(i)})).catch((e=>{ui.error(e,"onNetworkStatusChange")}))}))}))}static startBeaconDiscovery(e){var t,i,o,r,a;return n(this,void 0,void 0,(function*(){const n={subaction:0,scanning_type: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===(i=null==e?void 0:e.scanConfig)||void 0===i?void 0:i.timeBetweenScan)?e.scanConfig.timeBetweenScan:1e4,beacon_timeout:xt.isNumber(null===(o=null==e?void 0:e.scanConfig)||void 0===o?void 0:o.beaconTimeout)?e.scanConfig.beaconTimeout:3e4,delayCheckConnectedTimeout:xt.isNumber(null===(r=null==e?void 0:e.scanConfig)||void 0===r?void 0:r.delayCheckConnectedTimeout)?e.scanConfig.delayCheckConnectedTimeout:5e3,beaconConnectedTimeout:xt.isNumber(null===(a=null==e?void 0:e.scanConfig)||void 0===a?void 0:a.beaconConnectedTimeout)?e.scanConfig.beaconConnectedTimeout:6e5},items:Array.isArray(null==e?void 0:e.items)?null==e?void 0:e.items:[]}};return yield this.callNative(Xt.SCAN_IBEACON,Object.assign({},n)),!0}))}static stopBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.SCAN_IBEACON,Object.assign({},{subaction:2})),!0}))}static getBeacons(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.SCAN_IBEACON,Object.assign({},{subaction:1}),{isMultiCallback:!0}).then((e=>{const t={beacons:[]};return Array.isArray(e)&&e.forEach((e=>{const n={uuid:e.uuid,major:e.major,minor:e.minor,distance:e.distance,rssi:e.rssi};t.beacons.push(n)})),t}))}))}static stopBluetoothDevicesDiscovery(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static startBluetoothDevicesDiscovery(e){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},Object.assign({},e))}))}static openBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static onBluetoothDeviceFound(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static onBluetoothAdapterStateChange(){return n(this,void 0,void 0,(function*(){return Promise.resolve()}))}static getConnectedBluetoothDevices(e){return n(this,void 0,void 0,(function*(){const t={services:e.services||[]};return this.callNative({name:""},t)}))}static getBluetoothDevices(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static getBluetoothAdapterState(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static closeBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static scanQRCode(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.OPEN_QR,{skipOpenLink:!0})}))}static showToast(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.SHOW_TOAST,{toast:e.message})}))}static hideKeyboard(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.HIDE_KEYBOARD,{})}))}static openPhone(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.OPEN_PHONE,{phoneNum:e.phoneNumber,phoneCode:e.phoneNumber})}))}static openSMS(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.OPEN_SMS,{content:e.content,phoneCode:e.phoneNumber})}))}static keepScreen(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.KEEP_SCREEN,{data:{keep_screen_on:e.keepScreenOn?1:0}})}))}static openBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.PROMPT_AUTHENTICATION,{secret_data:e.secretData,app_id:this.getZAppId(),ui:{title:e.ui.title,sub_title:e.ui.subTitle,negative_text:e.ui.negativeButtonText},require_fingerprint:e.requireFingerprint?1:0}).then((e=>{var t,n,i,o;return{code:null==e?void 0:e.error_code,message:null==e?void 0:e.error_message,data:{domain:null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.domain,code:null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.error_code,message:null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.error_message,payToken:null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.pay_token}}}))}))}static checkStateBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.PROMPT_AUTHENTICATION_CHECK_STATE,{}).then((e=>({bioState:null==e?void 0:e.bio_state})))}))}static vibrate(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.INTERACTIVE_VIBRATION,{type:exports.VibrateType[e.type],vibrate_time:e.milliseconds})}))}static connectWifi(e){return n(this,void 0,void 0,(function*(){let t="open";return xt.isString(e.password)&&e.password.length>0&&(t="wpa_wpa2"),yield this.callNative(Xt.MP_JOIN_WIFI,{ssid:e.SSID,securityType:t,password:e.password,hiddenSsid:e.hiddenSSID})}))}static openAppStore(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.OPEN_APPSTORE,e)}))}}var pi,hi,vi,fi,mi,gi,yi,_i,Ei,Si,Ai,Oi,Ti,bi,wi,Ni,Pi,Ii,Ci,ki,Ri,Bi,Di,ji,Mi,xi,Li,Ui;class Wi{constructor(e){pi.set(this,localStorage),hi.set(this,void 0),vi.set(this,void 0),kn(),o(this,vi,{keys:new Set,currentSize:0,limitSize:5242880},"f"),o(this,hi,e,"f"),this.findAllCurrentDataByApp(e)}findAllCurrentDataByApp(e){try{let t;for(t in i(this,pi,"f")){if(e){if(t.split("_")[0]!==e)continue}i(this,vi,"f").keys.add(t)}}catch(e){ui.error(e,"LocalResourceStorage > findAllCurrentDataByApp")}}get(e){let t=new Map;return e.forEach((e=>{t.set(e,this.getSync(e))})),Promise.resolve(t)}getSync(e){return i(this,hi,"f")&&(e=`${i(this,hi,"f")}_${e}`),i(this,vi,"f").keys.has(e)?i(this,pi,"f").getItem(e):null}set(e){return n(this,void 0,void 0,(function*(){return Object.entries(e).forEach((([e,t])=>{this.setSync(e,t.replace(/\\"/g,'"'))})),Promise.resolve({errorKeys:[]})}))}setSync(e,t){i(this,hi,"f")&&(e=`${i(this,hi,"f")}_${e}`),i(this,pi,"f").setItem(e,t),i(this,vi,"f").keys.add(e)}getInfo(){return n(this,void 0,void 0,(function*(){return Promise.resolve(this.getInfoSync())}))}getInfoSync(){const e=((e,t)=>{let n,i,o=0;for(i in e){const r=i.split("_")[0];e.hasOwnProperty(i)&&(t&&r!==t||(n=2*(e[i].length+i.length),o+=n))}return o})(i(this,pi,"f"),i(this,hi,"f"));return{currentSize:xt.isNumber(e)?Number((e/1024).toFixed(2)):0,limitSize:Number(5120..toFixed(2))}}remove(e){return n(this,void 0,void 0,(function*(){return e.forEach((e=>{this.removeSync(e)})),Promise.resolve({errorKeys:[]})}))}removeSync(e){i(this,hi,"f")&&(e=`${i(this,hi,"f")}_${e}`),i(this,vi,"f").keys.has(e)&&(i(this,pi,"f").removeItem(e),i(this,vi,"f").keys.delete(e))}clear(){return n(this,void 0,void 0,(function*(){return Promise.resolve(this.clearSync())}))}clearSync(){i(this,vi,"f").keys.forEach((e=>{i(this,hi,"f")&&e.indexOf(i(this,hi,"f"))<0||(i(this,pi,"f").removeItem(e),i(this,vi,"f").keys.delete(e))}))}}pi=new WeakMap,hi=new WeakMap,vi=new WeakMap;class zi extends ei{constructor(e){super(),fi.set(this,void 0),mi.set(this,void 0),o(this,mi,{keys:new Set,currentSize:0,limitSize:5242880},"f"),o(this,fi,e,"f")}get(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.ZBROWSER_MPDS,{mpds_action:"mpds.get",mpds_data:{keys:e},appId:i(this,fi,"f")},{isMultiCallback:!1}).then((e=>{let t=new Map;return e&&e.mpds_data&&e.mpds_data.map&&(t=new Map(Object.entries(e.mpds_data.map))),t}))}))}set(e){return n(this,void 0,void 0,(function*(){return{errorKeys:yield this.callNative(Xt.ZBROWSER_MPDS,{mpds_action:"mpds.set",mpds_data:{map:e},appId:i(this,fi,"f")},{isMultiCallback:!1}).then((e=>{let t=[];return e&&e.mpds_data&&e.mpds_data.error_keys&&(t=e.mpds_data.error_keys),t}))}}))}getInfo(){return n(this,void 0,void 0,(function*(){const e=yield this.callNative(Xt.ZBROWSER_MPDS,{mpds_action:"mpds.get.size",mpds_data:{},appId:i(this,fi,"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 n(this,void 0,void 0,(function*(){return{errorKeys:yield this.callNative(Xt.ZBROWSER_MPDS,{mpds_action:"mpds.remove.key",mpds_data:{keys:e},appId:i(this,fi,"f")},{isMultiCallback:!1}).then((e=>{let t=[];return e&&e.mpds_data&&e.mpds_data.error_keys&&(t=e.mpds_data.error_keys),t}))}}))}clear(){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.ZBROWSER_MPDS,{mpds_action:"mpds.clear.appData",mpds_data:{},appId:i(this,fi,"f")})}))}}fi=new WeakMap,mi=new WeakMap;class Fi{getDataFromStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance(),n=yield t.get(e),i={};return n.forEach(((e,t)=>{i[t]=zn(e)})),i}))}putDataToStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance(),n={};return Object.entries(e).forEach((([e,t])=>{xt.isUndefined(t)||xt.isNull(t)||(n[e]=Wn(t))})),yield t.set(n)}))}removeDataFromStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance();return yield t.remove(e)}))}clearStorage(){return n(this,void 0,void 0,(function*(){const e=this.getInstance();yield e.clear()}))}getStorageInfo(){return n(this,void 0,void 0,(function*(){const e=this.getInstance();return yield e.getInfo()}))}}class Gi extends Fi{constructor(e){super(),gi.set(this,void 0),o(this,gi,e,"f")}getInstance(){return new Wi(i(this,gi,"f"))}}gi=new WeakMap;class Hi extends Fi{constructor(e){super(),yi.set(this,void 0),o(this,yi,e,"f")}getInstance(){return new zi(i(this,yi,"f"))}}yi=new WeakMap;class $i{static setStorage(e){return n(this,void 0,void 0,(function*(){let t=new Gi(this.getAppId());return Un()&&(t=new Hi(this.getAppId())),yield t.putDataToStorage(e.data)}))}static getStorage(e){return n(this,void 0,void 0,(function*(){let t=new Gi(this.getAppId());Un()&&(t=new Hi(this.getAppId()));return yield t.getDataFromStorage(e.keys)}))}static getStorageInfo(e){return n(this,void 0,void 0,(function*(){let e=new Gi(this.getAppId());return Un()&&(e=new Hi(this.getAppId())),yield e.getStorageInfo()}))}static removeStorage(e){return n(this,void 0,void 0,(function*(){let t=new Gi(this.getAppId());return Un()&&(t=new Hi(this.getAppId())),yield t.removeDataFromStorage(e.keys)}))}static clearStorage(e={}){return n(this,void 0,void 0,(function*(){let e=new Gi(this.getAppId());Un()&&(e=new Hi(this.getAppId())),yield e.clearStorage()}))}}class Vi{static getUserInfo(e){return n(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();let i="id,name,picture";(null==e?void 0:e.avatarType)&&(i=`${i}.type(${null==e?void 0:e.avatarType})`);return{userInfo:yield fetch(`${Jt}?fields=${i}`,{headers:{access_token:t||""}}).then((e=>n(this,void 0,void 0,(function*(){const t=yield e.json(),n={id:t.id,name:t.name,birthday:"",gender:"",avatar:t.picture&&t.picture.data&&t.picture.data.url};return console.warn("'birthday' and 'gender' are deprecated"),n}))))}}))}static getPhoneNumber(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.MP_GET_NUMBER,{},{isMultiCallback:!0,callback:(e,t)=>{if(0===e.error_code){const t={number:e.data};return Promise.resolve(t)}return Promise.reject(t)},delay:this.isIOS?400:0})}))}}class Zi{static closeApp(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.WINDOW_CLOSE,{})}))}static openMiniApp(e){return n(this,void 0,void 0,(function*(){const t=null==e?void 0:e.appId,n=(null==e?void 0:e.params)||{},i=Object.entries(n).map((function([e,t]){return[e,t].join("=")})).join("&");let o;try{o=yield Hn(t,0)}catch(e){}const r={appId:t};o&&(r.appName=o.name,r.appAvtUrl=o.logoUrl),yield this.callNative(Xt.OPEN_MP,{mpUrl:`https://h5.zdn.vn/zapps/${t}/${i.length>0?"?"+i:""}`,mpInfo:r})}))}static openWebview(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.OPEN_INAPP,{url:e})}))}static closeLoading(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.MP_CLOSE_LOADINGVIEW,{at:(new Date).getTime(),when:e,url:location.href})}))}}class Ji{static getLocation(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.GET_LOCATION,{silent_request:!1,permission_description:"Cho phép Zalo truy cập vào vị trí của thiết bị này?"},{isMultiCallback:!0,haveTimeout:!1,callback:(e,t)=>{if(0===e.error_code){const t=e.data,n={latitude:t.latitude,longitude:t.longitude,timestamp:t.timestamp,provider:t.provider};return Promise.resolve(n)}return Promise.reject(t)},delay:this.isIOS?400:0})}))}static sendLocation(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.QUERY_LOCATION_HIDE,{title:e.title,touserid:e.toUserId,zapp:this.getZAppId()})}))}}class Ki{static requestCameraPermission(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.REQUEST_PERMISSION_CAMERA,{},{callback:(e,t)=>-2===e.error_code||e.error_code>=0?Promise.resolve({userAllow:-2!==e.error_code,message:e.error_message}):Promise.reject(t)})}))}static saveImageToPhotosAlbum(e){return n(this,void 0,void 0,(function*(){let t={};return xt.isEmpty(e.imageBase64Data)?xt.isEmpty(e.imageUrl)||(t={imageUrl:e.imageUrl}):t={imageBase64Data:e.imageBase64Data},yield this.callNative(Xt.SAVE_IMAGE_GALLERY,Object.assign({},t))}))}}class qi{static viewOAQr(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.VIEW_MYQR,{dpn:e.displayName,uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openProfile(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.OPEN_PROFILE,{uId:e.id,type:exports.ProfileType[e.type],zapp:this.getZAppId(),sourceId:e.sourceId,sourceIndex:e.sourceIndex})}))}static openChat(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.OPEN_CHAT,{uId:e.id,type:exports.ChatType[e.type],zapp:this.getZAppId(),sourceId:e.sourceId,sourceIndex:e.sourceIndex})}))}static openPostFeed(e){return n(this,void 0,void 0,(function*(){let t={};switch(e.type){case"image":t={photoUrl:e.data.imageUrl};break;case"link":t={link:e.data.link,title:e.data.title,thumb:e.data.thumb,description:e.data.description};break;case"profile":t={avt:e.data.avatar,uid:e.data.id,dpn:e.data.displayName}}return yield this.callNative(Xt.OPEN_POSTFEED,Object.assign(Object.assign({type:exports.PostFeedType[e.type]},t),{zapp:this.getZAppId()})).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static followOA(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.FOLLOW_OA,{uid:e.id,showDialogConfirm:!0,zapp:this.getZAppId()},{haveTimeout:!1})}))}static unfollowOA(e){return n(this,void 0,void 0,(function*(){yield this.callNative(Xt.UNFOLLOW_OA,{uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openShareSheet(e){return n(this,void 0,void 0,(function*(){let t={};switch(e.type){case"image":let n=[];Array.isArray(e.data.imageUrls)&&e.data.imageUrls.length>0?n=e.data.imageUrls:n.push(e.data.imageUrl),t={photoUrls:n,photoUrl:e.data.imageUrl,caption:e.data.caption};break;case"gif":t={photoUrl:e.data.imageUrl,gifUrl:e.data.gifUrl,width:e.data.width,height:e.data.height};break;case"video":t={videoThumb:e.data.videoThumb,videoUrl:e.data.videoUrl,width:e.data.width,height:e.data.height};break;case"link":t={link:e.data.link,chatOnly:e.data.chatOnly?1:0};break;case"oa":t={uid:e.data.id};break;case"zmp":const i=yield this.getAccessToken(),o=yield Fn(this.getAppId(),i||"",e.data.title||"",e.data.description||"",e.data.thumbnail||"",e.data.path);window.forceShareZMP?t={data:{ZInstantAPIInfo:{url:`${o.zinstantApi}`,zinstantdata_id:`templateId=${o.ztemplateId}&appId=${this.getAppId()}&shareId=${o.shareId}`},previewMsgText:{msg:{en:"Zalo Mini Program",vi:"Chương trình nhỏ"}},enableReactions:1}}:(t={link:o.shareableLink,chatOnly:e.data.chatOnly?1:0},e.type="link")}return yield this.callNative(Xt.OPEN_SHARESHEET,Object.assign(Object.assign({type:exports.ShareSheetType[e.type]},t),{zapp:this.getZAppId()}),{haveTimeout:!1}).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static createShortcut(e,t,i){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.CREATE_SHORTCUT,{url:e,title:t,iconUrl:i})}))}static openProfilePicker(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.MP_OPEN_PROFILE_PICKER,{maxProfile:e},{isMultiCallback:!0,callback:(e,t)=>0===e.error_code&&Array.isArray(e.data)?Promise.resolve(e.data.map((e=>e.id))):Promise.reject(t)})}))}static getActionsSupported(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.GET_SUPPORTED_ACTIONS,{},{isMultiCallback:!1,callback:(e,t)=>{const n=Dn();if(Array.isArray(e.actions)&&e.actions.length>0){const t=Object.keys(Xt).filter((e=>Xt[e].skip_jump)),n={actions:[...e.actions,...t]};return Promise.resolve(n)}if(n===exports.PlatformType.iOS){const e={actions:un};return Promise.resolve(e)}return Promise.reject(t)}})}))}static openMediaPicker(e,t,i,o,r,a){return n(this,void 0,void 0,(function*(){const n={type:0,url:t,maxSize:i||1048576};return yield this.callNative(Xt.PICK_MEDIA,{media_type:exports.MediaPickerType[e],edit_view:Object.assign(Object.assign({},{enable:1,aspect_ratio:"1:1"}),o),silent_request:r,upload:n,max_select_items:a},{isMultiCallback:!0,callback:(e,t)=>{var n;if(0===e.error_code){const t={data:null===(n=e.data)||void 0===n?void 0:n.result_content};return Promise.resolve(t)}return Promise.reject(t)}})}))}static openOutApp(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.OPEN_OUTAPP,{url:e})}))}}class Qi{static getRouteParams(){let e={};const t=window.location.href;try{let n=new URL(t).searchParams.toString();n&&(e=Tn.getParamsAsObject(n))}catch(e){throw new Error("Url không hợp lệ")}return e}static sendDataToPreviousMiniApp(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(Xt.WEBVIEW_SET_RESULT,{result:Wn(e.data)})}))}static onCallbackData(e){return n(this,void 0,void 0,(function*(){yield this.events.on(exports.Events.OnDataCallback,(t=>{e({data:t})}))}))}}class Yi extends ei{constructor(){var e,t,n,r,a,s,l,c,u,d,p,h,v,f,m,g,y;super(),_i.set(this,Ft),Ei.set(this,Gt),Si.set(this,Ht),Ai.set(this,void 0),Oi.set(this,void 0),Ti.set(this,void 0),bi.set(this,null),wi.set(this,{timer:{getToken:0}}),Ni.set(this,void 0),Pi.set(this,void 0),Ii.set(this,null),this.events=Vn.getInstance(),this.isIOS=kn().isIOS,Ci.set(this,void 0),this.getActionBarConfig=()=>i(this,Ci,"f"),this.setActionBarConfig=e=>{o(this,Ci,e(i(this,Ci,"f")),"f")},ki.set(this,(()=>new Promise(((e,t)=>{xt.isUndefined(i(this,Ii,"f"))||xt.isNull(i(this,Ii,"f"))?this.callNative(Xt.JUMP_LOGIN,{}).then((t=>{const n=t&&t.cookiesOAuthLogins||[],i=n.find((e=>e.name===Vt));i&&(this.setJSToken(i.value),window.ZJSBridge.setJSToken&&window.ZJSBridge.setJSToken(i.value)),o(this,Ii,n,"f"),e(n)})).catch((e=>{t(e)})):e(i(this,Ii,"f"))})))),Ri.set(this,si.setNavigationBarRightButton),this.getVersion=ai.getVersion,this.getSystemInfo=ai.getSystemInfo,this.setNavigationBarTitle=si.setNavigationBarTitle,this.setNavigationBarColor=si.setNavigationBarColor,this.setNavigationBarLeftButton=si.setNavigationBarLeftButton,this.setBackgroundColor=li.setBackgroundColor,this.setDeviceOrientation=di.setDeviceOrientation,this.setStorage=$i.setStorage,this.getStorage=$i.getStorage,this.getStorageInfo=$i.getStorageInfo,this.removeStorage=$i.removeStorage,this.clearStorage=$i.clearStorage,this.getUserInfo=Vi.getUserInfo,this.getNetworkType=di.getNetworkType,this.onNetworkStatusChange=di.onNetworkStatusChange,this.startBeaconDiscovery=di.startBeaconDiscovery,this.stopBeaconDiscovery=di.stopBeaconDiscovery,this.getBeacons=di.getBeacons,this.closeApp=Zi.closeApp,this.getLocation=Ji.getLocation,this.stopBluetoothDevicesDiscovery=di.stopBluetoothDevicesDiscovery,this.startBluetoothDevicesDiscovery=di.stopBluetoothDevicesDiscovery,this.openBluetoothAdapter=di.openBluetoothAdapter,this.onBluetoothDeviceFound=di.onBluetoothDeviceFound,this.onBluetoothAdapterStateChange=di.onBluetoothAdapterStateChange,this.getConnectedBluetoothDevices=di.getConnectedBluetoothDevices,this.getBluetoothDevices=di.getBluetoothDevices,this.getBluetoothAdapterState=di.getBluetoothAdapterState,this.closeBluetoothAdapter=di.closeBluetoothAdapter,this.scanQRCode=di.scanQRCode,this.openProfile=qi.openProfile,this.openChat=qi.openChat,this.openPostFeed=qi.openPostFeed,this.followOA=qi.followOA,this.unFollowOA=qi.unfollowOA,this.openShareSheet=qi.openShareSheet,this.requestCameraPermission=Ki.requestCameraPermission,this.createShortcut=qi.createShortcut,this.openBioAuthentication=di.openBioAuthentication,this.checkStateBioAuthentication=di.checkStateBioAuthentication,this.sendLocation=Ji.sendLocation,this.showToast=di.showToast,this.hideKeyboard=di.hideKeyboard,this.openPhone=di.openPhone,this.openSMS=di.openSMS,this.viewOAQr=qi.viewOAQr,this.keepScreen=di.keepScreen,this.saveImageToPhotosAlbum=Ki.saveImageToPhotosAlbum,this.openMiniApp=Zi.openMiniApp,this.vibrate=di.vibrate,this.openWebview=Zi.openWebview,this.getRouteParams=Qi.getRouteParams,this.getAppInfo=ai.getAppInfo,this.sendDataToPreviousMiniApp=Qi.sendDataToPreviousMiniApp,this.onCallbackData=Qi.onCallbackData,this.getPhoneNumber=Vi.getPhoneNumber,this.openProfilePicker=qi.openProfilePicker,Bi.set(this,qi.getActionsSupported),this.connectWifi=di.connectWifi,this.openMediaPicker=qi.openMediaPicker,this.openOutApp=qi.openOutApp,this.closeLoading=Zi.closeLoading,this.openAppStore=di.openAppStore,o(this,Ai,null,"f"),o(this,Oi,null,"f"),o(this,Ti,null,"f"),this.isShowNavBar=!0,o(this,Ni,0,"f"),o(this,Pi,0,"f");const _="home"===(null===(t=null===(e=i(this,Si,"f"))||void 0===e?void 0:e.app)||void 0===t?void 0:t.leftButton)||"both"===(null===(r=null===(n=i(this,Si,"f"))||void 0===n?void 0:n.app)||void 0===r?void 0:r.leftButton)?hn:vn,E=new URL(location.href),S=xt.isString(null===(s=null===(a=i(this,Si,"f"))||void 0===a?void 0:a.app)||void 0===s?void 0:s.headerColor)&&(null===(u=null===(c=null===(l=i(this,Si,"f"))||void 0===l?void 0:l.app)||void 0===c?void 0:c.headerColor)||void 0===u?void 0:u.length)>0?5:6,A="none"===(null===(p=null===(d=i(this,Si,"f"))||void 0===d?void 0:d.app)||void 0===p?void 0:p.leftButton)||"home"===(null===(v=null===(h=i(this,Si,"f"))||void 0===h?void 0:h.app)||void 0===v?void 0:v.leftButton)?pn:dn;o(this,Ci,{actionbarType:S,buttonType:A,dataConfig:{backgroundColor:(null===(m=null===(f=i(this,Si,"f"))||void 0===f?void 0:f.app)||void 0===m?void 0:m.headerColor)||"",textColor:(null===(y=null===(g=i(this,Si,"f"))||void 0===g?void 0:g.app)||void 0===y?void 0:y.textColor)||"",viewInLeftType:A,confirmToExit:1},homeConfig:{enable:_,url:`https://h5.zdn.vn/zapps/${this.getAppId()}/${E.search}`}},"f")}static getInstance(){return Yi.instance||(Yi.instance=new Yi),Yi.instance}getLoginStatus(){return xt.isString(i(this,Ti,"f"))&&i(this,Ti,"f").length>0}getAppId(){return i(this,Ei,"f")}getZAppId(){return i(this,_i,"f")}login(e){return n(this,void 0,void 0,(function*(){const e=yield i(this,ki,"f").call(this),t=e.find((e=>e.name===$t)),n=e.find((e=>e.name===Zt));if(!xt.isUndefined(t)&&!xt.isNull(t)&&xt.isString(t.value)){if(o(this,Ai,t.value,"f"),xt.isUndefined(n)||xt.isNull(n)||!xt.isString(n.value)?yield this.loginZaloV3():(o(this,Oi,n.value,"f"),yield this.loginZaloV4()),!i(this,Ti,"f"))throw On.loginFailed();return i(this,Ti,"f")}throw On.loginFailed()}))}loginZaloV3(){return n(this,void 0,void 0,(function*(){return yield fetch(`${qt}?app_id=${i(this,_i,"f")}&redirect_uri=https://h5.zdn.vn/zapps/${i(this,Ei,"f")}/&code=${i(this,Ai,"f")}&isSDK=true123`).then((e=>n(this,void 0,void 0,(function*(){let t=yield e.json();if(t.access_token){o(this,Ti,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return o(this,Pi,e,"f"),o(this,Ni,(new Date).getTime(),"f"),this.setZAccSession(i(this,Ti,"f")||""),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(i(this,Ti,"f")||""),i(this,Ti,"f")}return null}))))}))}loginZaloV4(){return n(this,void 0,void 0,(function*(){const e=new URLSearchParams;e.append("app_id",i(this,Ei,"f")),e.append("code",i(this,Ai,"f")||""),e.append("code_verifier",i(this,Oi,"f")||""),xt.isNull(i(this,bi,"f"))?e.append("grant_type","authorization_code"):(e.append("grant_type","refresh_token"),e.append("refresh_token",i(this,bi,"f")||""));return yield fetch(Kt,Object.assign({method:"POST",body:e},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).then((e=>n(this,void 0,void 0,(function*(){const t=yield e.json();if(t.refresh_token&&o(this,bi,t.refresh_token,"f"),t.access_token){o(this,Ti,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return o(this,Pi,e,"f"),o(this,Ni,(new Date).getTime(),"f"),this.setZAccSession(i(this,Ti,"f")||""),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(i(this,Ti,"f")||""),i(this,Ti,"f")}return null}))))}))}getAccessToken(e){return n(this,void 0,void 0,(function*(){const e=(new Date).getTime()-i(this,Ni,"f");if(!i(this,Ti,"f"))throw On.loginRequired();return e<i(this,Pi,"f")?i(this,Ti,"f"):yield this.login()}))}}_i=new WeakMap,Ei=new WeakMap,Si=new WeakMap,Ai=new WeakMap,Oi=new WeakMap,Ti=new WeakMap,bi=new WeakMap,wi=new WeakMap,Ni=new WeakMap,Pi=new WeakMap,Ii=new WeakMap,Ci=new WeakMap,ki=new WeakMap,Ri=new WeakMap,Bi=new WeakMap;class Xi{constructor(){Di.set(this,Ft),ji.set(this,Ht),Mi.set(this,"DEFAULT ZOAUTH"),xi.set(this,"DEFAULT ACCESS TOKEN"),Li.set(this,{timer:{getToken:0}}),Ui.set(this,!1),this.getLoginStatus=()=>i(this,Ui,"f"),this.getAppId=()=>i(this,Di,"f"),this.login=()=>(o(this,Ui,!0,"f"),Promise.resolve(i(this,Mi,"f"))),this.getAccessToken=()=>Promise.resolve(i(this,xi,"f")),this.getVersion=ai.getVersion,this.getSystemInfo=ai.getSystemInfo,this.setNavigationBarTitle=()=>Promise.resolve(),this.setNavigationBarColor=()=>Promise.resolve(),this.setBackgroundColor=()=>Promise.resolve(),this.setNavigationBarLeftButton=()=>Promise.resolve(),this.setDeviceOrientation=()=>Promise.resolve(),this.setStorage=e=>n(this,void 0,void 0,(function*(){const t=new Gi(this.getAppId());return yield t.putDataToStorage(e.data),{errorKeys:[]}})),this.getStorage=e=>n(this,void 0,void 0,(function*(){const t=new Gi(this.getAppId());return yield t.getDataFromStorage(e.keys)})),this.getStorageInfo=e=>n(this,void 0,void 0,(function*(){const e=new Gi(this.getAppId());return yield e.getStorageInfo()})),this.removeStorage=e=>n(this,void 0,void 0,(function*(){const t=new Gi(this.getAppId());return yield t.removeDataFromStorage(e.keys)})),this.clearStorage=e=>n(this,void 0,void 0,(function*(){const e=new Gi(this.getAppId());return yield e.clearStorage()})),this.getUserInfo=()=>(console.warn("birthday and gender are deprecated"),Promise.resolve({userInfo:{id:"3368637342326461234",name:"User Name",avatar:"https://h5.zdn.vn/static/images/avatar.png"}})),this.getNetworkType=()=>{let e;switch((navigator.connection||navigator.mozConnection||navigator.webkitConnection).effectiveType){case"none":e=exports.NetworkType.none;break;case"4g":e=exports.NetworkType.wifi;break;case"3g":case"2g":e=exports.NetworkType.cellular;break;default:e=exports.NetworkType.unknown}const t={networkType:e};return Promise.resolve(t)},this.onNetworkStatusChange=e=>{const t=navigator.connection||navigator.mozConnection||navigator.webkitConnection,n=t.effectiveType;return t.addEventListener("change",(function(){let t;switch(n){case"none":t=exports.NetworkType.none;break;case"4g":t=exports.NetworkType.wifi;break;case"3g":case"2g":t=exports.NetworkType.cellular;break;default:t=exports.NetworkType.unknown}e({isConnected:!0,networkType:t})})),Promise.resolve()},this.startBeaconDiscovery=e=>Promise.resolve(!0),this.stopBeaconDiscovery=e=>Promise.resolve(!0),this.getBeacons=e=>Promise.resolve({beacons:[]}),this.closeApp=()=>Promise.resolve(),this.getLocation=()=>Promise.resolve({longitude:"105.788026",latitude:"21.0258773",timestamp:(new Date).getTime().toString(),provider:"fused"}),this.onBackButtonClick=()=>Promise.resolve(),this.stopBluetoothDevicesDiscovery=()=>Promise.resolve(),this.startBluetoothDevicesDiscovery=()=>Promise.resolve(),this.openBluetoothAdapter=()=>Promise.resolve(),this.onBluetoothDeviceFound=()=>Promise.resolve(),this.onBluetoothAdapterStateChange=()=>Promise.resolve(),this.getConnectedBluetoothDevices=()=>Promise.resolve(),this.getBluetoothDevices=()=>Promise.resolve(),this.getBluetoothAdapterState=()=>Promise.resolve(),this.closeBluetoothAdapter=()=>Promise.resolve(),this.scanQRCode=()=>Promise.resolve({content:"132"}),this.openProfile=()=>Promise.resolve(),this.openChat=()=>Promise.resolve(),this.openPostFeed=()=>Promise.resolve({status:1,shareType:0,numberOfUser:0}),this.followOA=()=>Promise.resolve(),this.unFollowOA=()=>Promise.resolve(),this.openShareSheet=()=>Promise.resolve({status:2,shareType:0,numberOfUser:0}),this.requestCameraPermission=()=>Promise.resolve({userAllow:!0,message:"Success"}),this.createShortcut=()=>Promise.resolve(),this.openBioAuthentication=()=>Promise.resolve({code:0,message:"OK",data:{domain:"",code:0,message:"",payToken:""}}),this.checkStateBioAuthentication=()=>Promise.resolve({bioState:""}),this.sendLocation=()=>Promise.resolve(),this.showToast=()=>Promise.resolve(),this.hideKeyboard=()=>Promise.resolve(),this.openPhone=()=>Promise.resolve(),this.openSMS=()=>Promise.resolve(),this.viewOAQr=()=>Promise.resolve(),this.keepScreen=()=>Promise.resolve(),this.saveImageToPhotosAlbum=()=>Promise.resolve(),this.openMiniApp=e=>Promise.resolve(),this.vibrate=()=>Promise.resolve(),this.openWebview=e=>(location.replace(e),Promise.resolve()),this.getRouteParams=Qi.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()}on(e,t,n){throw new Error("Method not implemented.")}once(e,t,n){throw new Error("Method not implemented.")}off(e,t,n,i){throw new Error("Method not implemented.")}removeAllListeners(e){throw new Error("Method not implemented.")}openMediaPicker(e,t,n,i,o,r){return console.warn("This api only works on zalo app"),Promise.resolve({data:""})}}Di=new WeakMap,ji=new WeakMap,Mi=new WeakMap,xi=new WeakMap,Li=new WeakMap,Ui=new WeakMap;const eo=Symbol("required"),to=Symbol("checkType"),no=(e,t)=>(n,i,o)=>{let r=Reflect.getOwnMetadata(eo,n,i)||[];r.push({parameterIndex:o,fields:e,option:t}),Reflect.defineMetadata(eo,r,n,i)},io=(e,t,n)=>(i,o,r)=>{let a=Reflect.getOwnMetadata(to,i,o)||[];a.push({parameterIndex:r,type:e,properties:t,defaultValue:n}),Reflect.defineMetadata(to,a,i,o)};const oo=(e,t,n)=>{const i=n.value,o=i.toString().match(/\(.*?\)/)[0].replace(/[()]/gi,"").replace(/\s/gi,"").split(",");return n.value=function(){const n=Reflect.getOwnMetadata(eo,e,t),r=Reflect.getOwnMetadata(to,e,t);return r&&r.forEach((e=>{const{parameterIndex:t,type:n,properties:i,defaultValue:r}=e;let a=arguments[t],s=o[t];const l=typeof a;if(!xt.isUndefined(a)){if(!jn(a,n))throw On.wrongTypeParam(s,n,Array.isArray(a)?"array":null===a?"null":l);"object"===n&&Object.entries(i).forEach((([e,n])=>{const i=e.split("?")[0],o=xt.get(a,i);if(xt.isUndefined(o)||xt.isNull(o)){if(!e.includes("?"))throw On.missingParam(e);xt.isObject(xt.get(a,i.split(".")[0]))&&r&&!xt.isUndefined(xt.get(r,i))&&xt.set(arguments[t],i,xt.get(r,i))}else if(xt.isFunction(n)){const e=n(o);if(e&&e.error)throw On.wrongTypeParam(`${s}.${i}`,e.errorMessage,typeof o)}}))}})),n&&n.forEach((e=>{const{parameterIndex:t,option:n,fields:i}=e,o=arguments[t],r=null==n?void 0:n.if,a=null==n?void 0:n.defaultValue;let s=!0;r&&(s=Object.keys(r).every((e=>xt.get(o,e)===r[e]))),s&&i.forEach((e=>{const n=e=>{let n=!1;return xt.isEmpty(xt.get(o,e))&&(xt.isUndefined(xt.get(a,e))||xt.set(arguments[t],e,xt.get(a,e)),n=!0),n};if(Array.isArray(e)&&e.length>0&&e.every(n))throw On.missingParam(e.join(" or "));if(xt.isString(e)&&n(e))throw On.missingParam(e)}))})),i.apply(this,arguments)},n};var ro,ao,so,lo,co;class uo{constructor(){this.events=Vn.getInstance(),ro.set(this,void 0),o(this,ro,this.getServiceInstance(),"f"),this.events.addListener=(e,t,n)=>{const i=e;return this.events.addListener(exports.Events[i],t,n)}}login(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").login(e)}))}getLoginStatus(){return i(this,ro,"f").getLoginStatus()}getAccessToken(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getAccessToken(e)}))}getVersion(){return i(this,ro,"f").getVersion()}getSystemInfo(){return i(this,ro,"f").getSystemInfo()}setNavigationBarTitle(e){return n(this,void 0,void 0,(function*(){return i(this,ro,"f").setNavigationBarTitle(e)}))}setNavigationBarColor(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").setNavigationBarColor(e)}))}setBackgroundColor(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").setBackgroundColor(e)}))}setNavigationBarLeftButton(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").setNavigationBarLeftButton(e)}))}setDeviceOrientation(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").setDeviceOrientation(e)}))}setStorage(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").setStorage(e)}))}getStorage(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getStorage(e)}))}getStorageInfo(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getStorageInfo(e)}))}removeStorage(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").removeStorage(e)}))}clearStorage(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").clearStorage(e)}))}getUserInfo(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getUserInfo(e)}))}getNetworkType(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getNetworkType(e)}))}onNetworkStatusChange(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").onNetworkStatusChange(e)}))}startBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").startBeaconDiscovery(e)}))}stopBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").stopBeaconDiscovery(e)}))}getBeacons(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getBeacons(e)}))}closeApp(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").closeApp(e)}))}getLocation(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getLocation(e)}))}stopBluetoothDevicesDiscovery(){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").stopBluetoothDevicesDiscovery()}))}startBluetoothDevicesDiscovery(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").startBluetoothDevicesDiscovery(e)}))}openBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").openBluetoothAdapter()}))}onBluetoothDeviceFound(){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").onBluetoothDeviceFound()}))}onBluetoothAdapterStateChange(){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").onBluetoothAdapterStateChange()}))}getConnectedBluetoothDevices(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getConnectedBluetoothDevices(e)}))}getBluetoothDevices(){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getBluetoothDevices()}))}getBluetoothAdapterState(){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getBluetoothAdapterState()}))}closeBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").closeBluetoothAdapter()}))}scanQRCode(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").scanQRCode(e)}))}openProfile(e){return n(this,void 0,void 0,(function*(){yield i(this,ro,"f").openProfile(e)}))}openChat(e){return n(this,void 0,void 0,(function*(){yield i(this,ro,"f").openChat(e)}))}openPostFeed(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").openPostFeed(e)}))}followOA(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").followOA(e)}))}unfollowOA(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").unFollowOA(e)}))}openShareSheet(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").openShareSheet(e)}))}requestCameraPermission(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").requestCameraPermission(e)}))}createShortcut(e){return n(this,void 0,void 0,(function*(){const t=yield Hn(Gt,0),n=kn().isIOS,o=t.logoUrl||Rn("og:image:url")||"",r=t.name||document.title,a=e.params?new URLSearchParams(e.params):new URLSearchParams;if(a.append("utm_source","zalo-shortcut"),a.append("utm_medium","default"),a.append("utm_campaign","default"),n){a.append("appId",Gt),a.append("appName",r),a.append("appIcon",o);const e=`https://mini.zalo.me/shortcut.html?${a.toString()}`;yield i(this,ro,"f").openOutApp(encodeURI(e))}else yield i(this,ro,"f").createShortcut(`https://zalo.me/app/link/zapps/${Gt}/?${a.toString()}`,r,o);return An()}))}openBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").openBioAuthentication(e)}))}checkStateBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").checkStateBioAuthentication(e)}))}sendLocation(e){return n(this,void 0,void 0,(function*(){yield i(this,ro,"f").sendLocation(e)}))}showToast(e){return n(this,void 0,void 0,(function*(){yield i(this,ro,"f").showToast(e)}))}hideKeyboard(e){return n(this,void 0,void 0,(function*(){yield i(this,ro,"f").hideKeyboard(e)}))}openPhone(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").openPhone(e)}))}openSMS(e){return n(this,void 0,void 0,(function*(){yield i(this,ro,"f").openSMS(e)}))}viewOAQr(e){return n(this,void 0,void 0,(function*(){yield i(this,ro,"f").viewOAQr(e)}))}keepScreen(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").keepScreen(e)}))}saveImageToGallery(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").saveImageToPhotosAlbum(e)}))}saveImageToPhotosAlbum(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").saveImageToPhotosAlbum(e)}))}openMiniApp(e){return n(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 i(this,ro,"f").openMiniApp(e)}))}vibrate(e){return n(this,void 0,void 0,(function*(){yield i(this,ro,"f").vibrate(e)}))}openWebview(e){return n(this,void 0,void 0,(function*(){const t=new URL(e.url),n=t.searchParams.get("typeInapp");xt.isEmpty(n)&&t.searchParams.set("typeInapp","1"),yield i(this,ro,"f").openWebview(t.href)}))}getRouteParams(){return i(this,ro,"f").getRouteParams()}getAppInfo(e){return i(this,ro,"f").getAppInfo()}sendDataToPreviousMiniApp(e){return i(this,ro,"f").sendDataToPreviousMiniApp(e)}onCallbackData(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").onCallbackData(e)}))}getPhoneNumber(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").getPhoneNumber()}))}openProfilePicker(e){return n(this,void 0,void 0,(function*(){const t=yield i(this,ro,"f").openProfilePicker(e.maxProfile);let n;if(t.length>0)try{const e=yield this.getAccessToken(),i=yield fetch(Qt,{method:"POST",headers:{"Content-Type":"application/json",access_token:e||""},body:JSON.stringify({fields:"id,name,picture",user_ids:t})}),o=yield i.json();if(0!==o.error||!o.data)throw new Error(o.message);n=t.map((e=>{var t,n,i,r,a,s,l,c,u,d,p;return{id:(null===(n=null===(t=o.data[e])||void 0===t?void 0:t.user_info)||void 0===n?void 0:n.user_id_by_app)||"",profile:{name:null===(r=null===(i=o.data[e])||void 0===i?void 0:i.user_info)||void 0===r?void 0:r.name,avatar:null===(c=null===(l=null===(s=null===(a=o.data[e])||void 0===a?void 0:a.user_info)||void 0===s?void 0:s.picture)||void 0===l?void 0:l.data)||void 0===c?void 0:c.url},code:0!==(null===(u=o.data[e])||void 0===u?void 0:u.error)?-1:0,message:`Get profile: ${xt.isUndefined(null===(d=o.data[e])||void 0===d?void 0:d.message)?"Unknown error":null===(p=o.data[e])||void 0===p?void 0:p.message}`}}))}catch(e){n=t.map((t=>({id:t,profile:{name:"",avatar:""},code:-1,message:`Can't get profile: ${e.message}`})))}return{users:n||[]}}))}connectWifi(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").connectWifi(e)}))}openMediaPicker(e){var t,o,r;return n(this,void 0,void 0,(function*(){const n={};xt.isUndefined(null===(t=e.editView)||void 0===t?void 0:t.enable)||(null===(o=e.editView)||void 0===o?void 0:o.enable)?n.enable=1:n.enable=0,n.aspect_ratio=null===(r=e.editView)||void 0===r?void 0:r.aspectRatio;const a=!0===e.silentRequest?1:0,s=e.maxSelectItem;return yield i(this,ro,"f").openMediaPicker(e.type,e.serverUploadUrl,e.maxItemSize,n,a,s)}))}getShareableLink(e){return n(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();return(yield Fn(window.APP_ID,t||"",e.title,e.description,e.thumbnail,e.path)).shareableLink}))}closeLoading(e){return n(this,void 0,void 0,(function*(){return yield i(this,ro,"f").closeLoading("user action")}))}requestUpdateZalo(e){return n(this,void 0,void 0,(function*(){const e=kn().isIOS?"https://apps.apple.com/vn/app/zalo/id579523206":"https://play.google.com/store/apps/details?id=com.zing.zalo";return yield i(this,ro,"f").openOutApp(e)}))}}ro=new WeakMap,e([En],uo.prototype,"login",null),e([Sn],uo.prototype,"getLoginStatus",null),e([En],uo.prototype,"getAccessToken",null),e([Sn],uo.prototype,"getVersion",null),e([Sn],uo.prototype,"getSystemInfo",null),e([En,oo,t(0,io("object",{title:Gn("string")}))],uo.prototype,"setNavigationBarTitle",null),e([En,oo,t(0,io("object",{color:Gn("string"),"textColor?":Gn("string",{values:["white","black"]}),"statusBarColor?":Gn("string")}))],uo.prototype,"setNavigationBarColor",null),e([En,oo,t(0,io("object",{backgroundColor:Gn("string"),"textColor?":Gn("string",{values:["white","black"]})}))],uo.prototype,"setBackgroundColor",null),e([En,oo,t(0,io("object",{type:Gn("string",{values:["none","back","home","both"]})}))],uo.prototype,"setNavigationBarLeftButton",null),e([En,oo,t(0,io("object",{rotate:Gn("string",{values:["auto","portrait","landscape"]})}))],uo.prototype,"setDeviceOrientation",null),e([En,oo,t(0,io("object",{data:Gn("object")}))],uo.prototype,"setStorage",null),e([En,oo,t(0,io("object",{keys:Gn("array<string>")}))],uo.prototype,"getStorage",null),e([En],uo.prototype,"getStorageInfo",null),e([En,oo,t(0,io("object",{keys:Gn("array<string>")}))],uo.prototype,"removeStorage",null),e([En],uo.prototype,"clearStorage",null),e([En,oo,t(0,io("object",{"avatarType?":Gn("string",{values:["small","normal","large"]})}))],uo.prototype,"getUserInfo",null),e([En],uo.prototype,"getNetworkType",null),e([En],uo.prototype,"onNetworkStatusChange",null),e([En],uo.prototype,"startBeaconDiscovery",null),e([En],uo.prototype,"stopBeaconDiscovery",null),e([En],uo.prototype,"getBeacons",null),e([En],uo.prototype,"closeApp",null),e([En],uo.prototype,"getLocation",null),e([En],uo.prototype,"stopBluetoothDevicesDiscovery",null),e([En],uo.prototype,"startBluetoothDevicesDiscovery",null),e([En],uo.prototype,"openBluetoothAdapter",null),e([En],uo.prototype,"onBluetoothDeviceFound",null),e([En],uo.prototype,"onBluetoothAdapterStateChange",null),e([En],uo.prototype,"getConnectedBluetoothDevices",null),e([En],uo.prototype,"getBluetoothDevices",null),e([En],uo.prototype,"getBluetoothAdapterState",null),e([En],uo.prototype,"closeBluetoothAdapter",null),e([En],uo.prototype,"scanQRCode",null),e([En,oo,t(0,io("object",{type:Gn("string",{values:["user","oa","aliasOA"]}),id:Gn("string")}))],uo.prototype,"openProfile",null),e([En,oo,t(0,io("object",{type:Gn("string",{values:["user","oa"]}),id:Gn("string")}))],uo.prototype,"openChat",null),e([En,oo,t(0,no(["data.imageUrl"],{if:{type:"image"}})),t(0,no(["data.link"],{if:{type:"link"}})),t(0,no(["data.id"],{if:{type:"profile"}})),t(0,io("object",{type:Gn("string",{values:["image","link","profile"]}),data:Gn("object"),"data.imageUrl?":Gn("url"),"data.link?":Gn("url"),"data.title?":Gn("string"),"data.thumb?":Gn("url"),"data.description?":Gn("string"),"data.avatar?":Gn("url"),"data.id?":Gn("string"),"data.displayName?":Gn("string")}))],uo.prototype,"openPostFeed",null),e([En,oo,t(0,io("object",{id:Gn("string"),"showDialogConfirm?":Gn("boolean")}))],uo.prototype,"followOA",null),e([En,oo,t(0,io("object",{id:Gn("string")}))],uo.prototype,"unfollowOA",null),e([En,oo,t(0,no([["data.imageUrl","data.imageUrls"]],{if:{type:"image"}})),t(0,no(["data.link"],{if:{type:"link"}})),t(0,no(["data.id"],{if:{type:"oa"}})),t(0,no(["data.gifUrl"],{if:{type:"gif"}})),t(0,no(["data.videoThumb","data.videoUrl"],{if:{type:"video"}})),t(0,no(["data.thumbnail","data.title","data.description"],{if:{type:"zmp"},defaultValue:{data:{description:""}}})),t(0,io("object",{type:Gn("string",{values:["image","gif","video","link","oa","zmp"]}),data:Gn("object"),"data.imageUrl?":Gn("url"),"data.imageUrls?":Gn("array<url>",{maxLength:10}),"data.caption?":Gn("string"),"data.gifUrl?":Gn("url"),"data.width?":Gn("number"),"data.height?":Gn("number"),"data.videoThumb?":Gn("url"),"data.videoUrl?":Gn("url"),"data.link?":Gn("url"),"data.chatOnly?":Gn("boolean"),"data.id?":Gn("string"),"data.thumbnail?":Gn("url"),"data.path?":Gn("string"),"data.title?":Gn("string",{maxLength:100}),"data.description?":Gn(["string"],{maxLength:400})}))],uo.prototype,"openShareSheet",null),e([En],uo.prototype,"requestCameraPermission",null),e([En],uo.prototype,"createShortcut",null),e([En,oo,t(0,io("object",{secretData:Gn("string"),"ui?":Gn("object"),"ui.title?":Gn("string"),"ui.subTitle?":Gn("string"),"ui.negativeButtonText?":Gn("string"),"requireFingerprint?":Gn("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"}}))],uo.prototype,"openBioAuthentication",null),e([En],uo.prototype,"checkStateBioAuthentication",null),e([En,oo,t(0,io("object",{toUserId:Gn("string"),"title?":Gn("string")}))],uo.prototype,"sendLocation",null),e([En,oo,t(0,io("object",{message:Gn("string")}))],uo.prototype,"showToast",null),e([En],uo.prototype,"hideKeyboard",null),e([En,oo,t(0,io("object",{phoneNumber:Gn("string")}))],uo.prototype,"openPhone",null),e([En,oo,t(0,io("object",{content:Gn("string"),phoneNumber:Gn("string",{regex:/^\+?\d+$/})}))],uo.prototype,"openSMS",null),e([En,oo,t(0,io("object",{id:Gn("string"),"displayName?":Gn("string")},{displayName:""}))],uo.prototype,"viewOAQr",null),e([En],uo.prototype,"keepScreen",null),e([En,oo,t(0,io("object",{"imageBase64Data?":Gn("string"),"imageUrl?":Gn("url")}))],uo.prototype,"saveImageToGallery",null),e([En,oo,t(0,io("object",{"imageBase64Data?":Gn("string"),"imageUrl?":Gn("url")}))],uo.prototype,"saveImageToPhotosAlbum",null),e([En,oo,t(0,io("object",{appId:Gn("string"),"params?":Gn("object")}))],uo.prototype,"openMiniApp",null),e([En,oo,t(0,io("object",{"type?":Gn("string",{values:["oneShot"]}),"milliseconds?":Gn("number")},{type:"oneShot",milliseconds:500}))],uo.prototype,"vibrate",null),e([En,oo,t(0,io("object",{url:Gn("url")}))],uo.prototype,"openWebview",null),e([Sn],uo.prototype,"getRouteParams",null),e([En],uo.prototype,"getAppInfo",null),e([En],uo.prototype,"sendDataToPreviousMiniApp",null),e([En],uo.prototype,"onCallbackData",null),e([En],uo.prototype,"getPhoneNumber",null),e([En,oo,t(0,io("object",{"maxProfile?":Gn("number",{min:1,max:10})},{maxProfile:1}))],uo.prototype,"openProfilePicker",null),e([En,oo,t(0,no(["SSID"])),t(0,io("object",{SSID:Gn("string"),"password?":Gn("string"),"hiddenSSID?":Gn("boolean")}))],uo.prototype,"connectWifi",null),e([En,oo,t(0,io("object",{type:Gn("string",{values:["photo","video","file"]}),serverUploadUrl:Gn("url"),"maxItemSize?":Gn("number",{min:0}),"editView?":Gn("object"),"editView.enable?":Gn("boolean"),"editView.aspectRatio?":Gn("string",{regex:/^\d+:\d+$/}),"silentRequest?":Gn("boolean"),"maxSelectItem?":Gn("number",{min:1})}))],uo.prototype,"openMediaPicker",null),e([En,oo,t(0,io("object",{title:Gn("string",{maxLength:100}),"thumbnail?":Gn("url"),"path?":Gn("string"),description:Gn(["string"],{maxLength:400})},{description:""}))],uo.prototype,"getShareableLink",null),e([En,oo],uo.prototype,"closeLoading",null),e([En,oo],uo.prototype,"requestUpdateZalo",null);class po extends uo{getServiceInstance(){return Yi.getInstance()}}class ho extends uo{getServiceInstance(){return new Xi}}class vo{constructor(){ao.set(this,Gt)}static getInstance(){return vo.instance||(vo.instance=new vo),vo.instance}createOrder(e,t){return n(this,void 0,void 0,(function*(){const n=i(this,ao,"f"),o=new URLSearchParams;o.append("amount",t.amount.toString()),o.append("item",encodeURIComponent(JSON.stringify(t.item))),o.append("appId",n),t.desc&&o.append("desc",encodeURIComponent(t.desc)),t.extradata&&o.append("extradata",encodeURIComponent(JSON.stringify(t.extradata))),t.method&&o.append("method",t.method);const r={headers:{"Content-Type":"application/x-www-form-urlencoded",authorization:"Bearer "}};try{const i=yield e.getAccessToken({fail:e=>{throw On.loginRequired}});r.headers.authorization=`Bearer ${i}`;const a=yield fetch(fn,Object.assign(Object.assign({method:"POST"},r),{body:o})),s=yield a.json();if(!s.data||0!==s.err)throw On.badRequest(s.msg);const l=s.data.id,c=s.data.jwt,u=window.APP_VERSION,d=window.APP_ENV,p={miniAppId:n,orderId:l};c&&(p.token=c),u&&(p.version=u),d&&(p.env=d),t.method&&(p.method=t.method);const h=Tn.encode(p),v=new URL(`?${h}`,"https://payment-mini.zalo.me").toString();return yield e.openWebview({url:v,fail:e=>{throw e}}),{orderId:l}}catch(e){throw e}}))}checkTransaction(e,t){return n(this,void 0,void 0,(function*(){try{let n,{data:o}=t;if(o||(o=e.getRouteParams()),"object"==typeof o&&(n=o.appTransID||o.orderId||o.apptransid),"string"==typeof o){const e=Tn.getParameterByName("orderId",o),t=Tn.getParameterByName("appTransID",o)||Tn.getParameterByName("apptransid",o);n=e||t}const r={headers:{authorization:"Bearer "}},a=yield e.getAccessToken({fail:e=>{throw On.loginRequired}});r.headers.authorization=`Bearer ${a}`;const s=new URL(mn),l={transId:n||"",appId:i(this,ao,"f")};s.search=new URLSearchParams(l).toString();const c=yield fetch(s.toString(),r),u=yield c.json();if(!u.data||0!==u.err)throw On.badRequest(u.msg);const d=u.data||{};return{msg:d.resultMessage,orderId:d.orderId,resultCode:d.resultCode,transTime:d.transTime,createdAt:d.createAt,transId:d.transId}}catch(e){throw e}}))}}ao=new WeakMap;class fo{constructor(){so.set(this,Ft)}static getInstance(){return fo.instance||(fo.instance=new fo),fo.instance}createOrder(e,t){return Promise.resolve({orderId:""})}checkTransaction(e,t){const n={msg:"Success",orderId:"",resultCode:1,transTime:(new Date).getTime().toString(),createdAt:(new Date).getTime().toString(),transId:""};return Promise.resolve(n)}}so=new WeakMap;class mo{constructor(e){lo.set(this,void 0),co.set(this,void 0),o(this,lo,this.getInstance(),"f"),o(this,co,e,"f")}createOrder(e){return i(this,lo,"f").createOrder(i(this,co,"f"),e)}checkTransaction(e){return i(this,lo,"f").checkTransaction(i(this,co,"f"),e)}}lo=new WeakMap,co=new WeakMap,e([En,oo,t(0,io("object",{amount:Gn(["string","number"]),desc:Gn("string"),"method?":Gn("string",{values:["MOMO","ZALOPAY","MOMO_SANDBOX","ZALOPAY_SANDBOX","CC","CC_SANDBOX","ATM","ATM_SANDBOX"]})}))],mo.prototype,"createOrder",null),e([En,oo],mo.prototype,"checkTransaction",null);class go extends mo{getInstance(){return vo.getInstance()}}class yo extends mo{getInstance(){return fo.getInstance()}}const _o=kn();exports.default=void 0,window.onJSCall=e=>function(t){Xn.getInstance().onJSCall(e,t)},window.onMultiJSCall=e=>function(t){Xn.getInstance().onMultiJSCall(e,t)},window.zaloJSV2={zalo_h5_event_handler:function(e,t,n){Xn.getInstance().nativeEventHandler(e,t,n)}},exports.Payment=void 0,_o.isZalo?(exports.default=new po,exports.Payment=new go(exports.default)):(exports.default=new ho,exports.Payment=new yo(exports.default)),window.ZaloMiniAppSDK=exports.default,exports.SDKCreator=uo,exports.default=exports.default;
|
package/dist/index.umd.js
CHANGED
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */function t(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a}function n(e,t){return function(n,i){t(n,i,e)}}function i(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))}function o(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function r(e,t,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(e,n):o?o.value=n:t.set(e,n),n}var a=Object.prototype;var s=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||a)};var l=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),c=Object.prototype.hasOwnProperty;var u=function(e){if(!s(e))return l(e);var t=[];for(var n in Object(e))c.call(e,n)&&"constructor"!=n&&t.push(n);return t},d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function p(e,t){return e(t={exports:{}},t.exports),t.exports}var h="object"==typeof d&&d&&d.Object===Object&&d,v="object"==typeof self&&self&&self.Object===Object&&self,f=h||v||Function("return this")(),m=f.Symbol,g=Object.prototype,y=g.hasOwnProperty,_=g.toString,E=m?m.toStringTag:void 0;var S=function(e){var t=y.call(e,E),n=e[E];try{e[E]=void 0;var i=!0}catch(e){}var o=_.call(e);return i&&(t?e[E]=n:delete e[E]),o},A=Object.prototype.toString;var O=function(e){return A.call(e)},T=m?m.toStringTag:void 0;var b=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":T&&T in Object(e)?S(e):O(e)};var w=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var N,P=function(e){if(!w(e))return!1;var t=b(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},I=f["__core-js_shared__"],C=(N=/[^.]+$/.exec(I&&I.keys&&I.keys.IE_PROTO||""))?"Symbol(src)_1."+N:"";var k=function(e){return!!C&&C in e},R=Function.prototype.toString;var B=function(e){if(null!=e){try{return R.call(e)}catch(e){}try{return e+""}catch(e){}}return""},D=/^\[object .+?Constructor\]$/,j=Function.prototype,M=Object.prototype,L=j.toString,U=M.hasOwnProperty,W=RegExp("^"+L.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var x=function(e){return!(!w(e)||k(e))&&(P(e)?W:D).test(B(e))};var z=function(e,t){return null==e?void 0:e[t]};var F=function(e,t){var n=z(e,t);return x(n)?n:void 0},G=F(f,"DataView"),H=F(f,"Map"),$=F(f,"Promise"),V=F(f,"Set"),Z=F(f,"WeakMap"),J="[object Map]",K="[object Promise]",q="[object Set]",Q="[object WeakMap]",Y="[object DataView]",X=B(G),ee=B(H),te=B($),ne=B(V),ie=B(Z),oe=b;(G&&oe(new G(new ArrayBuffer(1)))!=Y||H&&oe(new H)!=J||$&&oe($.resolve())!=K||V&&oe(new V)!=q||Z&&oe(new Z)!=Q)&&(oe=function(e){var t=b(e),n="[object Object]"==t?e.constructor:void 0,i=n?B(n):"";if(i)switch(i){case X:return Y;case ee:return J;case te:return K;case ne:return q;case ie:return Q}return t});var re=oe;var ae=function(e){return null!=e&&"object"==typeof e};var se=function(e){return ae(e)&&"[object Arguments]"==b(e)},le=Object.prototype,ce=le.hasOwnProperty,ue=le.propertyIsEnumerable,de=se(function(){return arguments}())?se:function(e){return ae(e)&&ce.call(e,"callee")&&!ue.call(e,"callee")},pe=Array.isArray;var he=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var ve=function(e){return null!=e&&he(e.length)&&!P(e)};var fe=function(){return!1},me=p((function(e,t){var n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,o=i&&i.exports===n?f.Buffer:void 0,r=(o?o.isBuffer:void 0)||fe;e.exports=r})),ge={};ge["[object Float32Array]"]=ge["[object Float64Array]"]=ge["[object Int8Array]"]=ge["[object Int16Array]"]=ge["[object Int32Array]"]=ge["[object Uint8Array]"]=ge["[object Uint8ClampedArray]"]=ge["[object Uint16Array]"]=ge["[object Uint32Array]"]=!0,ge["[object Arguments]"]=ge["[object Array]"]=ge["[object ArrayBuffer]"]=ge["[object Boolean]"]=ge["[object DataView]"]=ge["[object Date]"]=ge["[object Error]"]=ge["[object Function]"]=ge["[object Map]"]=ge["[object Number]"]=ge["[object Object]"]=ge["[object RegExp]"]=ge["[object Set]"]=ge["[object String]"]=ge["[object WeakMap]"]=!1;var ye=function(e){return ae(e)&&he(e.length)&&!!ge[b(e)]};var _e=function(e){return function(t){return e(t)}},Ee=p((function(e,t){var n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,o=i&&i.exports===n&&h.process,r=function(){try{var e=i&&i.require&&i.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=r})),Se=Ee&&Ee.isTypedArray,Ae=Se?_e(Se):ye,Oe=Object.prototype.hasOwnProperty;var Te=function(e){if(null==e)return!0;if(ve(e)&&(pe(e)||"string"==typeof e||"function"==typeof e.splice||me(e)||Ae(e)||de(e)))return!e.length;var t=re(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(s(e))return!u(e).length;for(var n in e)if(Oe.call(e,n))return!1;return!0};var be=function(e){return void 0===e};var we=function(e){return null===e};var Ne=function(e){return"string"==typeof e||!pe(e)&&ae(e)&&"[object String]"==b(e)};var Pe=function(e){return"number"==typeof e||ae(e)&&"[object Number]"==b(e)};var Ie=function(e){return ae(e)&&"[object RegExp]"==b(e)},Ce=Ee&&Ee.isRegExp,ke=Ce?_e(Ce):Ie;var Re=function(e){return"symbol"==typeof e||ae(e)&&"[object Symbol]"==b(e)},Be=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,De=/^\w*$/;var je=function(e,t){if(pe(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Re(e))||(De.test(e)||!Be.test(e)||null!=t&&e in Object(t))},Me=F(Object,"create");var Le=function(){this.__data__=Me?Me(null):{},this.size=0};var Ue=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},We=Object.prototype.hasOwnProperty;var xe=function(e){var t=this.__data__;if(Me){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return We.call(t,e)?t[e]:void 0},ze=Object.prototype.hasOwnProperty;var Fe=function(e){var t=this.__data__;return Me?void 0!==t[e]:ze.call(t,e)};var Ge=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Me&&void 0===t?"__lodash_hash_undefined__":t,this};function He(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}He.prototype.clear=Le,He.prototype.delete=Ue,He.prototype.get=xe,He.prototype.has=Fe,He.prototype.set=Ge;var $e=He;var Ve=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 n=e.length;n--;)if(Ze(e[n][0],t))return n;return-1},Ke=Array.prototype.splice;var qe=function(e){var t=this.__data__,n=Je(t,e);return!(n<0)&&(n==t.length-1?t.pop():Ke.call(t,n,1),--this.size,!0)};var Qe=function(e){var t=this.__data__,n=Je(t,e);return n<0?void 0:t[n][1]};var Ye=function(e){return Je(this.__data__,e)>-1};var Xe=function(e,t){var n=this.__data__,i=Je(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};function et(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}et.prototype.clear=Ve,et.prototype.delete=qe,et.prototype.get=Qe,et.prototype.has=Ye,et.prototype.set=Xe;var tt=et;var nt=function(){this.size=0,this.__data__={hash:new $e,map:new(H||tt),string:new $e}};var it=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var ot=function(e,t){var n=e.__data__;return it(t)?n["string"==typeof t?"string":"hash"]:n.map};var rt=function(e){var t=ot(this,e).delete(e);return this.size-=t?1:0,t};var at=function(e){return ot(this,e).get(e)};var st=function(e){return ot(this,e).has(e)};var lt=function(e,t){var n=ot(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};function ct(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}ct.prototype.clear=nt,ct.prototype.delete=rt,ct.prototype.get=at,ct.prototype.has=st,ct.prototype.set=lt;var ut=ct;function dt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var i=arguments,o=t?t.apply(this,i):i[0],r=n.cache;if(r.has(o))return r.get(o);var a=e.apply(this,i);return n.cache=r.set(o,a)||r,a};return n.cache=new(dt.Cache||ut),n}dt.Cache=ut;var pt=dt;var ht=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vt=/\\(\\)?/g,ft=function(e){var t=pt(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ht,(function(e,n,i,o){t.push(i?o.replace(vt,"$1"):n||e)})),t}));var mt=function(e,t){for(var n=-1,i=null==e?0:e.length,o=Array(i);++n<i;)o[n]=t(e[n],n,e);return o},gt=m?m.prototype:void 0,yt=gt?gt.toString:void 0;var _t=function e(t){if("string"==typeof t)return t;if(pe(t))return mt(t,e)+"";if(Re(t))return yt?yt.call(t):"";var n=t+"";return"0"==n&&1/t==-Infinity?"-0":n};var Et=function(e){return null==e?"":_t(e)};var St=function(e,t){return pe(e)?e:je(e,t)?[e]:ft(Et(e))};var At=function(e){if("string"==typeof e||Re(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var Ot=function(e,t){for(var n=0,i=(t=St(t,e)).length;null!=e&&n<i;)e=e[At(t[n++])];return n&&n==i?e:void 0};var Tt=function(e,t,n){var i=null==e?void 0:Ot(e,t);return void 0===i?n:i},bt=function(){try{var e=F(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var wt=function(e,t,n){"__proto__"==t&&bt?bt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Nt=Object.prototype.hasOwnProperty;var Pt=function(e,t,n){var i=e[t];Nt.call(e,t)&&Ze(i,n)&&(void 0!==n||t in e)||wt(e,t,n)},It=/^(?:0|[1-9]\d*)$/;var Ct=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&It.test(e))&&e>-1&&e%1==0&&e<t};var kt=function(e,t,n,i){if(!w(e))return e;for(var o=-1,r=(t=St(t,e)).length,a=r-1,s=e;null!=s&&++o<r;){var l=At(t[o]),c=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(o!=a){var u=s[l];void 0===(c=i?i(u,l,s):void 0)&&(c=w(u)?u:Ct(t[o+1])?[]:{})}Pt(s,l,c),s=s[l]}return e};var Rt,Bt,Dt,jt,Mt,Lt,Ut,Wt,xt,zt,Ft,Gt={isEmpty:Te,isNull:we,isUndefined:be,isFunction:P,isObject:w,isString:Ne,isNumber:Pe,isArray:pe,isRegExp:ke,get:Tt,set:function(e,t,n){return null==e?e:kt(e,t,n)}};function Ht(e){return"function"==typeof window.Debug?window.Debug(e):function(...e){process.env.NODE_ENV}}e.NetworkType=void 0,(Rt=e.NetworkType||(e.NetworkType={})).none="none",Rt.wifi="wifi",Rt.cellular="cellular",Rt.unknown="unknown",e.PlatformType=void 0,(Bt=e.PlatformType||(e.PlatformType={})).wp="wp",Bt.android="android",Bt.iOS="iOS",Bt.unknown="unknown",e.ProfileType=void 0,(Dt=e.ProfileType||(e.ProfileType={}))[Dt.user=1]="user",Dt[Dt.oa=0]="oa",Dt[Dt.aliasOA=2]="aliasOA",e.ChatType=void 0,(jt=e.ChatType||(e.ChatType={}))[jt.user=1]="user",jt[jt.oa=0]="oa",e.PostFeedType=void 0,(Mt=e.PostFeedType||(e.PostFeedType={}))[Mt.image=1]="image",Mt[Mt.link=4]="link",Mt[Mt.profile=5]="profile",e.ShareSheetType=void 0,(Lt=e.ShareSheetType||(e.ShareSheetType={}))[Lt.image=1]="image",Lt[Lt.gif=11]="gif",Lt[Lt.video=12]="video",Lt[Lt.link=4]="link",Lt[Lt.oa=5]="oa",Lt[Lt.zmp=20]="zmp",e.OrientationType=void 0,(Ut=e.OrientationType||(e.OrientationType={}))[Ut.auto=1]="auto",Ut[Ut.portrait=2]="portrait",Ut[Ut.landscape=3]="landscape",e.VibrateType=void 0,(Wt=e.VibrateType||(e.VibrateType={}))[Wt.oneShot=0]="oneShot",e.NativeCode=void 0,(xt=e.NativeCode||(e.NativeCode={}))[xt.token_invalid=-2]="token_invalid",xt[xt.not_permission=-1]="not_permission",xt[xt.client_not_support=-5]="client_not_support",xt[xt.decode_failed=-4]="decode_failed",e.Events=void 0,(zt=e.Events||(e.Events={})).AppPaused="h5.event.paused",zt.AppResumed="h5.event.resumed",zt.NetworkChanged="h5.event.connection.changed",zt.OnDataCallback="h5.event.webview.result",zt.OpenApp="h5.event.open.mp",e.MediaPickerType=void 0,(Ft=e.MediaPickerType||(e.MediaPickerType={}))[Ft.photo=4]="photo",Ft[Ft.video=5]="video",Ft[Ft.file=6]="file";const $t=e=>{const t=document.cookie;if(t){const o=t.split("; ");if(o&&o.length>0)for(var n=e.length+1,i=o.length-1;i>=0;i--){let t=o[i];if(t&&0===t.indexOf(e)&&(t=t.substring(n,t.length),t))return t=t.replace(/["']/g,""),t}}return null},Vt=e=>$t(`${window.location.host}_`+e),Zt=e=>$t((()=>{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),Jt=1048576,Kt=window.zAppID,qt=window.APP_ID,Qt=window.APP_CONFIG||{},Yt="h5.zdn.vn_zoauth",Xt="h5.zdn.vn_zlink3rd",en="h5.zdn.vn_zoauth_vrf",tn="https://graph.zalo.me/v2.0/me",nn="https://h5.zalo.me/openapi/access_token",on="https://oauth.zaloapp.com/v3/access_token",rn="https://graph.zalo.me/v2.0/me/friends/list",an=5*Jt,sn=e=>({NONE:e?-2:0,WIFI:e?0:1,"2G":2,"3G":e?15:2,"4G":e?13:2}),ln={GET_DOWNLOADED_STICKER:{name:"action.get.downloaded.sticker",have_callback:!0},OPEN_SHARE_STICKER:{name:"action.open.share.sticker"},OPEN_PROFILE:{name:"action.open.profile"},OPEN_FEED_DETAIL:{name:"action.open.feeddetail"},OPEN_FRIEND_RADA:{name:"action.open.friendrada"},OPEN_INAPP:{name:"action.open.inapp"},OPEN_OUTAPP:{name:"action.open.outapp"},OPEN_PAGE:{name:"action.open.page"},OPEN_PHOTODETAIL:{name:"action.open.photodetail"},OPEN_GALARY:{name:"action.open.galary"},OPEN_GAMECENTER:{name:"action.open.gamecenter"},OPEN_GAMENEWS:{name:"action.open.gamenews"},OPEN_TAB_CONTACT:{name:"action.open.tab.contact"},OPEN_TAB_SOCIAL:{name:"action.open.tab.social"},OPEN_FRIENDSUGGEST:{name:"action.open.friendsuggest"},OPEN_GROUPLIST:{name:"action.open.grouplist"},OPEN_NEARBY:{name:"action.open.nearby"},OPEN_ROOM:{name:"action.open.room"},OPEN_STICKERSTORE:{name:"action.open.stickerstore"},OPEN_CREATECHAT:{name:"action.open.createchat"},COPY_LINK_CATESTICKER:{name:"action.copy.link.catesticker"},REQUEST_BUY_STICKER:{name:"action.request.buy.sticker"},OPEN_CHAT:{name:"action.open.chat"},OPEN_TAB_CHAT:{name:"action.open.tab.chat"},OPEN_CHATGROUP:{name:"action.open.chatgroup"},OPEN_ADDFRIEND:{name:"action.open.addfriend"},OPEN_TAB_MORE:{name:"action.open.tab.more"},OPEN_POSTFEED:{name:"action.open.postfeed"},OPEN_LOGINDEVICES:{name:"action.open.logindevices"},OPEN_SENDSTICKER:{name:"action.open.sendsticker"},REPORT_ABUSE:{name:"action.report.abuse",have_callback:!0},FOLLOW_OA:{name:"action.follow.oa",have_callback:!0},UNFOLLOW_OA:{name:"action.unfollow.oa",have_callback:!0},OPEN_GAMEDETAIL:{name:"action.open.gamedetail"},OPEN_SHARESHEET:{name:"action.open.sharesheet",have_callback:!0},REQUEST_PERMISSION_CAMERA:{name:"action.request.permission.camera"},CHANGE_TITLE_HEADER:{name:"action.change.title.header",skip_jump:!0},WEBVIEW_CLEARCACHE:{name:"action.webview.clearcache"},WEBVIEW_CONFIRMCACHE:{name:"action.webview.confirmcache"},WEBVIEW_ISVISIBLE:{name:"action.webview.isvisible"},WEBVIEW_NETWORKTYPE:{name:"action.webview.networktype",skip_jump:!0},CHANGE_BUTTON_HEADER:{name:"action.change.button.header"},CREATE_OPTIONS_MENU:{name:"action.create.options.menu",skip_jump:!0,have_callback:!0},CREATE_SHORTCUT:{name:"action.create.shortcut"},CHANGE_ACTIONBAR_LEFTBUTTON_TYPE:{name:"action.change.actionbar.leftbutton.type",skip_jump:!0,have_callback:!0},WINDOW_CLOSE:{name:"action.window.close",skip_jump:!0,have_callback:!0},WEBVIEW_CHECKRESERROR:{name:"action.webview.checkResError"},IAP_REQUESTPAYMENT:{name:"action.iap.requestpayment"},ZBROWSER_GETSTATS:{name:"action.zbrowser.getstats"},ZBROWSER_JSBRIDGE:{name:"action.zbrowser.jsbridge",skip_jump:!0,have_callback:!0},PROMPT_AUTHENTICATION:{name:"action.prompt.authentication"},CHANGE_ACTIONBAR_COLOR:{name:"action.change.actionbar.color",skip_jump:!0},PROMPT_AUTHENTICATION_CHECK_STATE:{name:"action.prompt.authentication.check_state"},OPEN_APPSTORE:{name:"action.open.appstore"},GET_LOCATION:{name:"action.get.location",have_callback:!0},QUERY_LOCATION_HIDE:{name:"action.query.location.hide",have_callback:!0},SHOW_TOAST:{name:"action.show.toast",have_callback:!0},OPEN_APP:{name:"action.open.app"},HIDE_KEYBOARD:{name:"action.hide.keyboard"},OPEN_PHONE:{name:"action.open.phone"},OPEN_QR:{name:"action.open.qr"},OPEN_SMS:{name:"action.open.sms"},VIEW_MYQR:{name:"action.view.myqr",have_callback:!0},KEEP_SCREEN:{name:"action.keep.screen",have_callback:!0},CHANGE_AUTOROTATE:{name:"action.change.autorotate",skip_jump:!0},CHECK_APP_INSTALLED:{name:"action.check.app.installed"},QUERY_SHOW:{name:"action.query.show"},QUERY_HIDE:{name:"action.query.hide"},OPEN_INAPPRW:{name:"action.open.inapprw"},ZALORUN_GETTRACKINGSTATUS:{name:"action.zalorun.getTrackingStatus",have_callback:!0},ZALORUN_SETTRACKINGSTATUS:{name:"action.zalorun.setTrackingStatus",have_callback:!0},ZALORUN_GETDAYSTEP:{name:"action.zalorun.getDayStep",have_callback:!0},ZALORUN_FORCESUBMITDATA:{name:"action.zalorun.forceSubmitData",have_callback:!0},ZALORUN_SETWEIGHT:{name:"action.zalorun.setWeight",have_callback:!0},OPEN_PROFILE_EXT:{name:"action.open.profile.ext"},DOWNLOAD_CATE:{name:"action.download.cate",have_callback:!0},JUMP_LOGIN:{name:"action.jump.login",skip_jump:!0,white_list:!0},OPEN_ADTIMA_ADS_INTERSTITIAL:{name:"action.open.adtima.ads.interstitial"},OPEN_ADTIMA_ADS:{name:"action.open.adtima.ads"},GET_ADIDCLIENT:{name:"action.get.adidclient"},SCAN_IBEACON:{name:"action.scan.ibeacon"},INTERACTIVE_VIBRATION:{name:"action.interactive.vibration"},SAVE_IMAGE_GALLERY:{name:"action.save.image.gallery",version_live:{iOS:408}},OPEN_MP:{name:"action.open.mp",version_live:{iOS:402}},CHANGE_ACTIONBAR:{name:"action.change.actionbar",version_live:{iOS:402},skip_jump:!0},ZBROWSER_MPDS:{name:"action.zbrowser.mpds",version_live:{iOS:402}},WEBVIEW_SET_RESULT:{name:"action.webview.set.result",version_live:{iOS:416}},MP_GET_NUMBER:{name:"action.mp.get.number",version_live:{iOS:416}},MP_OPEN_PROFILE_PICKER:{name:"action.mp.open.profile.picker",version_live:{iOS:432}},GET_SUPPORTED_ACTIONS:{name:"action.get.supported.actions",white_list:!0},MP_JOIN_WIFI:{name:"action.mp.join.wifi",version_live:{android:0,iOS:999},have_permission:!1,white_list:!1},PICK_MEDIA:{name:"action.pick.media",version_live:{iOS:440}},MP_CLOSE_LOADINGVIEW:{name:"action.mp.close.loadingview"}},cn=0,un=-1400,dn=-1500,pn=-1401,hn=-1403,vn=-1404,fn={SUCCESS:"Success",READ_MORE:"Read more at: https://miniapp.zalo.me/docs/api",LOGIN_REQUIRED:"Please login before to call this api. Read more at: https://miniapp.zalo.me/docs/api/login",LOGIN_FAILED:"Login failed.",NOT_PERMISSION:"You don't have permission to call this api",CLIENT_NOT_SUPPORT:"This API is not supported in this Zalo version",DECODE_FAILED:"Can not decode your data. Read more at: https://miniapp.zalo.me/docs/api/error"},mn="apps/get-info",gn={android:12100571,iOS:400,wp:0,unknown:0},yn=[ln.GET_DOWNLOADED_STICKER.name,ln.OPEN_SHARE_STICKER.name,ln.OPEN_PROFILE.name,ln.OPEN_FEED_DETAIL.name,ln.OPEN_FRIEND_RADA.name,ln.OPEN_INAPP.name,ln.OPEN_OUTAPP.name,ln.OPEN_PAGE.name,ln.OPEN_PHOTODETAIL.name,ln.OPEN_GALARY.name,ln.OPEN_GAMECENTER.name,ln.OPEN_GAMENEWS.name,ln.OPEN_TAB_CONTACT.name,ln.OPEN_TAB_SOCIAL.name,ln.OPEN_FRIENDSUGGEST.name,ln.OPEN_GROUPLIST.name,ln.OPEN_NEARBY.name,ln.OPEN_ROOM.name,ln.OPEN_STICKERSTORE.name,ln.OPEN_CREATECHAT.name,ln.COPY_LINK_CATESTICKER.name,ln.REQUEST_BUY_STICKER.name,ln.OPEN_CHAT.name,ln.OPEN_TAB_CHAT.name,ln.OPEN_CHATGROUP.name,ln.OPEN_ADDFRIEND.name,ln.OPEN_TAB_MORE.name,ln.OPEN_POSTFEED.name,ln.OPEN_LOGINDEVICES.name,ln.OPEN_SENDSTICKER.name,ln.REPORT_ABUSE.name,ln.FOLLOW_OA.name,ln.UNFOLLOW_OA.name,ln.OPEN_GAMEDETAIL.name,ln.OPEN_SHARESHEET.name,ln.REQUEST_PERMISSION_CAMERA.name,ln.CHANGE_TITLE_HEADER.name,ln.WEBVIEW_CLEARCACHE.name,ln.WEBVIEW_CONFIRMCACHE.name,ln.WEBVIEW_ISVISIBLE.name,ln.WEBVIEW_NETWORKTYPE.name,ln.CHANGE_BUTTON_HEADER.name,ln.CREATE_OPTIONS_MENU.name,ln.CREATE_SHORTCUT.name,ln.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE.name,ln.WINDOW_CLOSE.name,ln.WEBVIEW_CHECKRESERROR.name,ln.IAP_REQUESTPAYMENT.name,ln.ZBROWSER_GETSTATS.name,ln.ZBROWSER_JSBRIDGE.name,ln.PROMPT_AUTHENTICATION.name,ln.CHANGE_ACTIONBAR_COLOR.name,ln.PROMPT_AUTHENTICATION_CHECK_STATE.name,ln.OPEN_APPSTORE.name,ln.GET_LOCATION.name,ln.QUERY_LOCATION_HIDE.name,ln.SHOW_TOAST.name,ln.OPEN_APP.name,ln.HIDE_KEYBOARD.name,ln.OPEN_PHONE.name,ln.OPEN_QR.name,ln.OPEN_SMS.name,ln.VIEW_MYQR.name,ln.KEEP_SCREEN.name,ln.CHANGE_AUTOROTATE.name,ln.CHECK_APP_INSTALLED.name,ln.QUERY_SHOW.name,ln.QUERY_HIDE.name,ln.OPEN_INAPPRW.name,ln.ZALORUN_GETTRACKINGSTATUS.name,ln.ZALORUN_SETTRACKINGSTATUS.name,ln.ZALORUN_GETDAYSTEP.name,ln.ZALORUN_FORCESUBMITDATA.name,ln.ZALORUN_SETWEIGHT.name,ln.OPEN_PROFILE_EXT.name,ln.DOWNLOAD_CATE.name,ln.JUMP_LOGIN.name,ln.OPEN_ADTIMA_ADS_INTERSTITIAL.name,ln.OPEN_ADTIMA_ADS.name,ln.GET_ADIDCLIENT.name,ln.SCAN_IBEACON.name,ln.SAVE_IMAGE_GALLERY.name,ln.OPEN_MP.name,ln.CHANGE_ACTIONBAR.name,ln.INTERACTIVE_VIBRATION.name,ln.ZBROWSER_MPDS.name],_n=0,En=3,Sn=1,An=0,On="https://payment-mini.zalo.me/api/order/create",Tn="https://payment-mini.zalo.me/api/transaction";class bn{constructor(e,t,n){this.code=e,this.message=t,this.api=n}toString(){return`api: ${this.api}; code: ${this.code}; message: ${this.message}`}}class wn extends bn{constructor(e,t){super(e,t),this.message=`${t}. ${fn.READ_MORE}`,this.handler()}handler(){switch(this.code){case e.NativeCode.token_invalid:this.code=pn,this.message=fn.LOGIN_REQUIRED;break;case e.NativeCode.not_permission:this.code=hn,this.message=fn.NOT_PERMISSION;break;case e.NativeCode.client_not_support:this.code=vn,this.message=fn.CLIENT_NOT_SUPPORT;break;case e.NativeCode.decode_failed:this.message=fn.DECODE_FAILED}}}const Nn={handler:null,setHandler(e){this.handler=e}};Nn.setHandler(((e,t)=>t instanceof bn?(t.api=e,t):new bn(-2001,Gt.isNull(t.message)?"Unknown Error":t.message,e)));const Pn=(e,t,n)=>{const o=n.value;return n.value=function(...e){return i(this,void 0,void 0,(function*(){const{success:n,fail:r}=Array.isArray(e)&&e.length>0&&e[0];return new Promise(((a,s)=>i(this,void 0,void 0,(function*(){try{const t=yield o.apply(this,e);!Gt.isNull(n)&&Gt.isFunction(n)?n.call(null,t,this):a(t)}catch(e){if("login"!==(null==e?void 0:e.api)&&((null==e?void 0:e.code)===pn||(null==e?void 0:e.code)===hn)){let t=!1;this instanceof Eo&&(t=this.getLoginStatus()),t||(e=new bn(pn,fn.LOGIN_REQUIRED))}const{handler:n}=Nn,i=n.call(null,t,e,this);window.zmpSentry&&window.zmpSentry.throwError(i.toString()),!Gt.isNull(r)&&Gt.isFunction(r)?r.call(null,i,this):s(i)}}))))}))},n},In=(e,t,n)=>{const i=n.value;return n.value=function(...e){try{return i.apply(this,e)}catch(e){if("login"!==(null==e?void 0:e.api)&&((null==e?void 0:e.code)===pn||(null==e?void 0:e.code)===hn)){let t=!1;this instanceof Eo&&(t=this.getLoginStatus()),t||(e=new bn(pn,fn.LOGIN_REQUIRED))}const{handler:n}=Nn,i=n.call(null,t,e,this);throw window.zmpSentry&&window.zmpSentry.throwError(i.toString()),i}},n},Cn=(e,t)=>({code:cn,message:t||fn.SUCCESS,data:e||{}}),kn={badRequest:e=>new bn(un,e),loginFailed:()=>new bn(un,fn.LOGIN_FAILED),loginRequired:()=>new bn(pn,fn.LOGIN_REQUIRED),missingParam:e=>new bn(un,`Missing required argument: ${e}`),wrongTypeParam:(e,t,n)=>new bn(un,`Wrong type of parameter '${e}'. Expected ${t}, but got ${n}`),cannotGetShareInfo:()=>new bn(dn,"Can not get app info to share"),lengthInvalid:e=>new bn(un,`${e} length is invalid.`)};const Rn={encode:function(e){var t=[];for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];if(void 0===i)return;if(null===i)return void t.push(n);t.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}return t.join("&")},decode:function(e,t){var n={};if(""===e)return n;for(var i=e.split("&"),o=0;o<i.length;o++){var r=i[o].split("=",2),a=decodeURIComponent(r[0]);if(t&&Object.prototype.hasOwnProperty.call(n,a))throw new URIError("Duplicate key: "+a);n[a]=2===r.length?decodeURIComponent(r[1]):null}return n},appendToUrl:function(e,t){return e+(-1!==e.indexOf("?")?"&":"?")+("string"==typeof t?t:Rn.encode(t))},getParameterByName:function(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");var n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return n?n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"":null},getParamsAsObject:function(e){var t={};return e?(e.split("&").map((function(e){var n=e.split("=");n&&2==n.length&&(t[n[0]]=decodeURIComponent(n[1].replace(/\+/g," ")))})),t):t},toQueryString:function(e){if(!e)return"";if("object"!=(void 0===e?"undefined":typeof e))return e;var t=Object.keys(e),n=[];return t.map((function(t){var i=e[t],o=[t,i="object"==(void 0===i?"undefined":typeof i)?JSON.stringify(i):encodeURIComponent(i)].join("=");n.push(o)})),n.join("&")}},Bn=new RegExp("[\\u0300-\\u036f]","g"),Dn=new RegExp("[đ|Đ]","g"),jn=new RegExp("\\s","g"),Mn=Ht("zmp:utils:common"),Ln=e=>{try{new URL(e)}catch(e){return!1}return!0},Un=()=>navigator.userAgent||navigator.vendor||window.opera,Wn=()=>{const e=Un().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)}},xn=e=>{const t=document.getElementsByTagName("meta");for(let n=0;n<t.length;n++)if(t[n].getAttribute("name")===e||t[n].getAttribute("property")===e)return t[n].getAttribute("content");return""},zn=()=>{const e=Un().toLowerCase().split("zalo")[1];if(e){return e.replace(" ","").split("/")[1]||""}return""},Fn=()=>{let t=Wn();return t.isWP?e.PlatformType.wp:t.isAndroid?e.PlatformType.android:t.isIOS?e.PlatformType.iOS:e.PlatformType.unknown},Gn=(e,t)=>{const n=t.toLowerCase(),i=n.split(/[<>]/i),o="array"===i[0];return!!("url"===n&&Ln(e)||o&&("array"===n&&Array.isArray(e)||((e,t)=>Array.isArray(t)&&!t.some((t=>"url"===e?!Ln(t):typeof t!==e)))(i[1],e))||!Array.isArray(e)&&typeof e===t)},Hn=e=>(e=>{let t=Vt(e);return t||(t=Zt(e),t)?t:$t(e)})(e),$n=e=>{if(Gt.isObject(JSON)&&JSON.parse&&Gt.isString(e)){const t=e.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");return JSON.parse(t,((e,t)=>t))}return Gt.isObject(e)?e:new Function("return "+e)()},Vn=e=>{if(Gt.isObject(JSON)&&JSON.stringify)return JSON.stringify(e);if(void 0===e)return"undefined";if(null===e)return"null";try{if("string"==typeof e||null!==e.constructor.toString().match(/string/i))return'"'+e.replace(/"/g,'\\"')+'"'}catch(e){console.log(e)}var t;if(null!==Object.prototype.toString.call(e).match(/array/i)){t=new Array;for(var n=e.length,i=0;i<n;i++)t.push(Vn(e[i]));return"["+t.join(",")+"]"}if("object"==typeof e){for(var o in t=new Array,e)t.push('"'+o+'":'+Vn(e[o]));return"{"+t.join(",")+"}"}return e.toString()},Zn=()=>{try{const e=Number(zn()),t=Fn();return e>=gn[t]}catch(e){return!0}},Jn=e=>JSON.stringify(e).replace(/"/g,'\\"').replace(/'/g,"'"),Kn=e=>{try{if(e){Mn(e);const t=e.replace(/\\/g,"").replace(/'/g,"'");return Mn("formattedValue",t,JSON.parse(t),typeof JSON.parse(t)),JSON.parse(t)}return null}catch(t){return Mn("parse json error:",t),e}},qn=(e,t,n,o,r,a)=>i(void 0,void 0,void 0,(function*(){const i=new URL(location.href),s=new URLSearchParams;let l=`${i.pathname}${i.search}`;a&&(l=`/zapps/${e}${"/"===a[0]?"":"/"}${a}`);const c=new URL(`https://zalo.me/app/link${l}`);s.append("title",n),s.append("description",o||""),s.append("thumbnail",r),s.append("url",c.href),s.append("accessToken",t||"");const u=yield fetch("https://h5.zalo.me/openapi/create-sharelink",Object.assign({method:"POST",body:s},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})),d=yield u.json();if(!d||0!==d.err)throw kn.cannotGetShareInfo();return c.search=`${c.search}&zshareId=${d.data.shareId}`,Object.assign(Object.assign({},d.data),{shareableLink:c.href})})),Qn=(e,t)=>n=>{if(!(Array.isArray(e)?e.some((e=>Gn(n,e))):Gn(n,e)))return{error:!0,errorMessage:e};if(t){if(Array.isArray(null==t?void 0:t.values))return{error:!(null==t?void 0:t.values.includes(n)),errorMessage:null==t?void 0:t.values.toString()};if(Gt.isNumber(null==t?void 0:t.maxLength))return{error:Gt.isString(n)&&n.length>(null==t?void 0:t.maxLength),errorMessage:`data length must <= ${null==t?void 0:t.maxLength}`};if(Gt.isNumber(null==t?void 0:t.min)&&Gt.isNumber(null==t?void 0:t.max))return{error:n<(null==t?void 0:t.min)||n>(null==t?void 0:t.max),errorMessage:`data must be in between ${null==t?void 0:t.min} and ${null==t?void 0:t.max}`};if(Gt.isNumber(null==t?void 0:t.min))return{error:n<(null==t?void 0:t.min),errorMessage:`data must >= ${null==t?void 0:t.min}`};if(Gt.isNumber(null==t?void 0:t.max))return{error:n>(null==t?void 0:t.max),errorMessage:`data must <= ${null==t?void 0:t.max}`};if(Gt.isRegExp(null==t?void 0:t.regex))return{error:!t.regex.test(n),errorMessage:"data must valid"}}return{error:!1}},Yn=(e,t,n)=>i(void 0,void 0,void 0,(function*(){const i={appId:e,versionStatus:t};Gt.isUndefined(n)||(i.currentVersion=n);const o=Rn.appendToUrl(`https://h5.zalo.me/${mn}`,i),r=yield fetch(o,{credentials:"include"});if(r.ok){const e=yield r.json();if(e.err<0||!e.data)throw new Error(e);return{name:e.data.name,version:e.data.version,description:e.data.description,appUrl:e.data.appUrl,qrCodeUrl:e.data.qrCodeUrl,logoUrl:e.data.logoUrl}}throw new Error("Can't get app info")}));var Xn=p((function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function r(e,t,i,r,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new o(i,r||e,a),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],s]:e._events[l].push(s):(e._events[l]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,i,o=[];if(0===this._eventsCount)return o;for(i in e=this._events)t.call(e,i)&&o.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},s.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var o=0,r=i.length,a=new Array(r);o<r;o++)a[o]=i[o].fn;return a},s.prototype.listenerCount=function(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},s.prototype.emit=function(e,t,i,o,r,a){var s=n?n+e:e;if(!this._events[s])return!1;var l,c,u=this._events[s],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,i),!0;case 4:return u.fn.call(u.context,t,i,o),!0;case 5:return u.fn.call(u.context,t,i,o,r),!0;case 6:return u.fn.call(u.context,t,i,o,r,a),!0}for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var p,h=u.length;for(c=0;c<h;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,i);break;case 4:u[c].fn.call(u[c].context,t,i,o);break;default:if(!l)for(p=1,l=new Array(d-1);p<d;p++)l[p-1]=arguments[p];u[c].fn.apply(u[c].context,l)}}return!0},s.prototype.on=function(e,t,n){return r(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return r(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,i,o){var r=n?n+e:e;if(!this._events[r])return this;if(!t)return a(this,r),this;var s=this._events[r];if(s.fn)s.fn!==t||o&&!s.once||i&&s.context!==i||a(this,r);else{for(var l=0,c=[],u=s.length;l<u;l++)(s[l].fn!==t||o&&!s[l].once||i&&s[l].context!==i)&&c.push(s[l]);c.length?this._events[r]=1===c.length?c[0]:c:a(this,r)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new i,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s}));class ei extends Xn{constructor(){super(),this.debug=Ht("zmp:event-emitter")}static getInstance(){return ei.instance||(ei.instance=new ei),ei.instance}h5ConfirmHandleEvent(e,t,n){ZaloJavaScriptInterface.jsH5EventCallback(e,t,n||"")}on(e,t,n){this.debug(`register ${e}: ${n}`);return super.on(e,((i,o)=>{this.h5ConfirmHandleEvent(i,e,n),t(o)}),n)}once(e,t,n){this.debug(`register once ${e}: ${n}`);return super.once(e,((i,o)=>{this.h5ConfirmHandleEvent(i,e,n),t(o)}),n)}}var ti={},ni=function(e,t,n){var i=t||"default";return function(){var t=i in ti?ti[i](e,n):e;return t.apply(this,arguments)}};ni.setWrapper=function(e){var t=arguments.length<=1||void 0===arguments[1]?"default":arguments[1];ti[t]=e};var ii={error:{code:1,error_subcode:1357046,message:"Received Invalid JSON reply.",type:"http"}};function oi(e){try{return null===e?ii:JSON.parse(e)}catch(e){return ii}}var ri,ai={execute:function(e,t,n,i){n.suppress_http_code=1;var o=Rn.encode(n);"post"!=t&&(e=Rn.appendToUrl(e,o),o="");var r=function(e,t){if(!self.XMLHttpRequest)return null;var n=new XMLHttpRequest,i=function(){};if(!("withCredentials"in n))return null;n.open(e,t,!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded");var o={send:function(e){n.send(e)}},r=ni((function(){r=i,"onload"in o&&o.onload(n)}),"entry","XMLHttpRequest:load"),a=ni((function(){a=i,"onerror"in o&&o.onerror(n)}),"entry","XMLHttpRequest:error");return n.onload=function(){r()},n.onerror=function(){a()},n.onreadystatechange=function(){4==n.readyState&&(200==n.status?r():a())},o}(t,e);return!!r&&(r.onload=function(e){i(oi(e.responseText))},r.onerror=function(e){e.responseText?i(oi(e.responseText)):i({error:{code:1,error_subcode:1357045,message:"unknown error (empty response)",status:e.status,type:"http"}})},r.send(o),!0)}};class si extends Xn{constructor(){super(),this.debug=Ht("zmp:ZaloJSBridge"),this.events=ei.getInstance(),this._accessTk=Hn("zacc_session")||"DEFAULT_ACCESS_TOKEN",this._jsAccessTk=Hn("zlink3rd")||"DEFAULT_JS_TOKEN",this.results=[],this._userAgent=Un(),this._device=Wn(),this._jsCallFuncCallbacks={},this.events.on(e.Events.AppPaused,(()=>{if(this.results.length>0){let e=this.results;this.results=[];try{this.sendLogData(e)}catch(e){}}})),this.sendLogTimer?clearInterval(this.sendLogTimer):this.sendLogTimer=setInterval((()=>{if(this.results.length>0){let e=this.results;this.results=[];try{this.sendLogData(e)}catch(e){}}}),5e3)}static getInstance(){return si.instance||(si.instance=new si),si.instance}set accessTk(e){this._accessTk=e}set jsAccessTk(e){this._jsAccessTk=e}sendLogData(e){try{ai.execute("https://h5.zalo.me/log/async","post",{appId:window.APP_ID,data:JSON.stringify(e)},(e=>{}))}catch(e){}}onJSCall(e,t){try{this.debug("onJSCall",e,t);const n=$n(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,i=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,n)}catch(e){console.error("Call callback error",e)}i&&clearTimeout(i),this._jsCallFuncCallbacks[e]=null,delete this._jsCallFuncCallbacks[e]}}this.results.push({action:n.action,error:n.error_code})}catch(e){console.log("onJSCall","error",e)}}onMultiJSCall(e,t){try{this.debug("onMultiJSCall",e,t);const n=$n(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,i=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,n)}catch(e){console.error("Call callback error",e)}i&&clearTimeout(i)}}this.results.push({action:n.action,error:n.error_code})}catch(e){console.log("onMultiJSCall","error",e)}}nativeEventHandler(e,t,n){this.debug(`eventId: ${e}, eventName: ${t}, eventData: ${n}`);const i=Kn(n);this.debug(i);const o=this.handleEventData(t,i);this.events.emit(t,e,o)}handleEventData(t,n){try{switch(t){case e.Events.OpenApp:const{url:t}=n,i=new URL(t),o=i.pathname.split(`/zapps/${qt}`)[1];return{path:`${o||"/"}${i.search}`};default:return n}}catch(e){return n}}defaultCallback(e){null!=e&&(e=$n(e))}jsCall(e,t,n,i=!1,o=3,r=!0){try{const a=e.name,s=((e="")=>`${e.normalize("NFD").replace(Bn,"").replace(Dn,"d").replace(jn,"").toLowerCase()}_${Math.random().toString(36).substr(2,4)}`)(a);if(!this._device.isMobile||Gt.isEmpty(a))return this.onJSCall(s,{error_code:-13,error_message:"params invalid!",data:{device:this._device.isMobile,jsToken:this._jsAccessTk,access_token:this._accessTk},action:a}),!1;null==t&&(t={}),n||(n=this.defaultCallback);const l={error_code:-14,error_message:"Request Timeout!",data:{},action:a};this._jsCallFuncCallbacks[s]={timeout:r&&e.have_callback&&setTimeout((()=>{this.onJSCall(s,l)}),8e3),callback:n};try{return t=Vn(t),i?this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,window.onMultiJSCall(s)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,`window.onMultiJSCall('${s}')`):this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,window.onJSCall(s)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,`window.onJSCall('${s}')`)}catch(r){if(!(o-- >0)){const e={error_code:-5,error_message:"Not ready!",data:{userAgent:this._userAgent,options:t,jsToken:this._jsAccessTk,access_token:this._accessTk},action:a,js_error:r};return this.onJSCall(s,e),!1}setTimeout((()=>{this.jsCall(e,t,n,i,o)}),500)}}catch(e){console.log("jsCall","error",e)}return!1}}class li{constructor(){this.debug=Ht("zmp:ZJSBridgeProvider"),ri.set(this,void 0),r(this,ri,si.getInstance(),"f")}setZAccSession(e){o(this,ri,"f").accessTk=e}setJSToken(e){o(this,ri,"f").jsAccessTk=e}callNative(e,t,n){return this.debug(e.name,t),new Promise(((r,a)=>{const s=o=>i(this,void 0,void 0,(function*(){try{const i=new wn(o.error_code,`${o.action}: ${o.error_message}`);if(null==n?void 0:n.callback){const e=yield n.callback(o,i);return r(e)}if(o&&o.error_code>=0)r(o.data||{});else if(o&&o.error_code<0){try{window.zmpSentry&&window.zmpSentry.captureMessage(`${e.name}: call native fail`,{extra:{data:t,rs:o}})}catch(e){}return a(i)}}catch(e){return a(e)}})),l=Wn().isIOS,c=(e=>{var t;const n=zn(),i=(null===(t=null==e?void 0:e.version_live)||void 0===t?void 0:t.iOS)||0;return!!(Array.isArray(window.ignoreCheckSupport)&&window.ignoreCheckSupport.length>0&&window.ignoreCheckSupport.includes(e.name))||n>=i})(e);if(l&&!c){const t=new wn(-5,`${e}: Client isn't support this action`);return a(t)}(null==n?void 0:n.delay)?setTimeout((()=>{o(this,ri,"f").jsCall(e,t,s,null==n?void 0:n.isMultiCallback,null==n?void 0:n.nRetry,null==n?void 0:n.haveTimeout)}),n.delay):o(this,ri,"f").jsCall(e,t,s,null==n?void 0:n.isMultiCallback,null==n?void 0:n.nRetry,null==n?void 0:n.haveTimeout)}))}}ri=new WeakMap;var ci,ui,di,pi,hi,vi="2.19.0";class fi{static getVersion(){return vi}static getSystemInfo(){return{version:xn("version-id")||"",apiVersion:vi,zaloVersion:zn(),platform:Fn(),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 Yn(e,0,t.version)}))}}class mi{static setNavigationBarTitle(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.CHANGE_TITLE_HEADER,{title:e.title},{haveTimeout:!1})}))}static setNavigationBarColor(e){return i(this,void 0,void 0,(function*(){const t={};let n;Gt.isEmpty(e.textColor)||(t.textColor=e.textColor),Gt.isString(e.color)&&e.color.length>0?(Gt.isEmpty(e.color)||(t.backgroundColor=e.color),n=5):(Gt.isEmpty(e.statusBarColor)||(t.backgroundColor=e.statusBarColor),n=6),this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{actionbarType:n,dataConfig:Object.assign(Object.assign({},e.dataConfig),t)}))),yield this.callNative(ln.CHANGE_ACTIONBAR,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarLeftButton(e){return i(this,void 0,void 0,(function*(){const t="none"===e.type||"home"===e.type?En:_n,n="home"===e.type||"both"===e.type?Sn:An;this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{buttonType:t,dataConfig:Object.assign(Object.assign({},e.dataConfig),{viewInLeftType:t}),homeConfig:Object.assign(Object.assign({},e.homeConfig),{enable:n})}))),yield this.callNative(ln.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarRightButton(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.CREATE_OPTIONS_MENU,{supportToolBar:e.supportToolBar,reset:e.reset,menuListItems:e.menuListItems,zapp:this.getAppId()})}))}}class gi{static setBackgroundColor(e){return i(this,void 0,void 0,(function*(){Gt.isString(e.backgroundColor)&&e.backgroundColor.length>0&&(yield this.callNative(ln.CHANGE_ACTIONBAR,{actionbarType:this.isShowNavBar?5:6,dataConfig:{backgroundColor:e.backgroundColor,textColor:e.textColor}}))}))}}class yi{constructor(e,t,n,i){this.title=i,this.severity=t;const o=new Date;if(this.time=o.toLocaleTimeString(),this.content=e,n>0){const e=(new Error).stack;this.stack=e?e.replace("Error\n",""):""}}toString(){return(this.content.stack?[this.title,this.severity.toUpperCase(),this.time,this.content,this.content.stack.replace("Error:","")]:[this.title,this.severity.toUpperCase(),this.time,JSON.stringify(this.content),this.stack]).join(" ")}}ci=new WeakMap,ui=new WeakMap,di=new WeakMap,pi=new WeakMap,hi=new WeakMap;const _i=new class{constructor(){ci.set(this,3),ui.set(this,["none","error","warn","info"]),di.set(this,"[zmp] > "),pi.set(this,{error:0,warn:0,info:0,firstError:null,lastError:null}),hi.set(this,((e,t,n)=>{o(this,pi,"f")[o(this,ui,"f")[e]]++;const i=o(this,ui,"f")[e];if(r(this,di,o(this,di,"f")+("string"!=typeof t?new yi(t,i,e,n).toString():t),"f"),!(e>o(this,ci,"f")))switch(e){case 1:console.error(o(this,di,"f"));break;case 2:console.warn(o(this,di,"f"));break;case 3:console.info(o(this,di,"f"));break;default:throw new Error("internal")}}))}setLogLevel(e){r(this,ci,e,"f")}info(e){o(this,hi,"f").call(this,3,e)}warn(e,t){o(this,hi,"f").call(this,2,e,t)}error(e,t){o(this,hi,"f").call(this,1,e,t)}getMetrics(){return o(this,pi,"f")}};class Ei{static setDeviceOrientation(t){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.CHANGE_AUTOROTATE,{autoRotate:e.OrientationType[t.rotate]})}))}static getNetworkType(t){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.WEBVIEW_NETWORKTYPE,{url:window.location.href,featureId:""}).then((t=>{const n=t.network;let i;const o=Wn().isAndroid;switch(n){case sn(o).NONE:i=e.NetworkType.none;break;case sn(o).WIFI:i=e.NetworkType.wifi;break;case sn(o)["2G"]:case sn(o)["3G"]:case sn(o)["4G"]:i=e.NetworkType.cellular;break;default:i=e.NetworkType.unknown}return{networkType:i}}))}))}static onNetworkStatusChange(t){return i(this,void 0,void 0,(function*(){yield this.events.on(e.Events.NetworkChanged,(e=>{const n=e&&e.state;this.getNetworkType().then((e=>{const i={isConnected:"CONNECTED"===n,networkType:e&&e.networkType};t(i)})).catch((e=>{_i.error(e,"onNetworkStatusChange")}))}))}))}static startBeaconDiscovery(e){var t,n,o,r,a;return i(this,void 0,void 0,(function*(){const i={subaction:0,scanning_type:Gt.isNumber(null==e?void 0:e.scanningType)?e.scanningType:0,data:{scan_from_source:Gt.isString(null==e?void 0:e.scanFromSource)?e.scanFromSource:"",expire:Gt.isNumber(null==e?void 0:e.expire)?e.expire:3e3,monitor_interval:Gt.isNumber(null==e?void 0:e.monitorInterval)?e.monitorInterval:60,domain:Gt.isString(null==e?void 0:e.domain)?e.domain:"",scan_config:{scan_time:Gt.isNumber(null===(t=null==e?void 0:e.scanConfig)||void 0===t?void 0:t.scanTime)?e.scanConfig.scanTime:15e3,time_between_scan:Gt.isNumber(null===(n=null==e?void 0:e.scanConfig)||void 0===n?void 0:n.timeBetweenScan)?e.scanConfig.timeBetweenScan:1e4,beacon_timeout:Gt.isNumber(null===(o=null==e?void 0:e.scanConfig)||void 0===o?void 0:o.beaconTimeout)?e.scanConfig.beaconTimeout:3e4,delayCheckConnectedTimeout:Gt.isNumber(null===(r=null==e?void 0:e.scanConfig)||void 0===r?void 0:r.delayCheckConnectedTimeout)?e.scanConfig.delayCheckConnectedTimeout:5e3,beaconConnectedTimeout:Gt.isNumber(null===(a=null==e?void 0:e.scanConfig)||void 0===a?void 0:a.beaconConnectedTimeout)?e.scanConfig.beaconConnectedTimeout:6e5},items:Array.isArray(null==e?void 0:e.items)?null==e?void 0:e.items:[]}};return yield this.callNative(ln.SCAN_IBEACON,Object.assign({},i)),!0}))}static stopBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.SCAN_IBEACON,Object.assign({},{subaction:2})),!0}))}static getBeacons(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.SCAN_IBEACON,Object.assign({},{subaction:1}),{isMultiCallback:!0}).then((e=>{const t={beacons:[]};return Array.isArray(e)&&e.forEach((e=>{const n={uuid:e.uuid,major:e.major,minor:e.minor,distance:e.distance,rssi:e.rssi};t.beacons.push(n)})),t}))}))}static stopBluetoothDevicesDiscovery(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static startBluetoothDevicesDiscovery(e){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},Object.assign({},e))}))}static openBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static onBluetoothDeviceFound(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static onBluetoothAdapterStateChange(){return i(this,void 0,void 0,(function*(){return Promise.resolve()}))}static getConnectedBluetoothDevices(e){return i(this,void 0,void 0,(function*(){const t={services:e.services||[]};return this.callNative({name:""},t)}))}static getBluetoothDevices(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static getBluetoothAdapterState(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static closeBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static scanQRCode(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.OPEN_QR,{skipOpenLink:!0})}))}static showToast(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.SHOW_TOAST,{toast:e.message})}))}static hideKeyboard(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.HIDE_KEYBOARD,{})}))}static openPhone(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.OPEN_PHONE,{phoneNum:e.phoneNumber,phoneCode:e.phoneNumber})}))}static openSMS(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.OPEN_SMS,{content:e.content,phoneCode:e.phoneNumber})}))}static keepScreen(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.KEEP_SCREEN,{data:{keep_screen_on:e.keepScreenOn?1:0}})}))}static openBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.PROMPT_AUTHENTICATION,{secret_data:e.secretData,app_id:this.getZAppId(),ui:{title:e.ui.title,sub_title:e.ui.subTitle,negative_text:e.ui.negativeButtonText},require_fingerprint:e.requireFingerprint?1:0}).then((e=>{var t,n,i,o;return{code:null==e?void 0:e.error_code,message:null==e?void 0:e.error_message,data:{domain:null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.domain,code:null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.error_code,message:null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.error_message,payToken:null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.pay_token}}}))}))}static checkStateBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.PROMPT_AUTHENTICATION_CHECK_STATE,{}).then((e=>({bioState:null==e?void 0:e.bio_state})))}))}static vibrate(t){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.INTERACTIVE_VIBRATION,{type:e.VibrateType[t.type],vibrate_time:t.milliseconds})}))}static connectWifi(e){return i(this,void 0,void 0,(function*(){let t="open";return Gt.isString(e.password)&&e.password.length>0&&(t="wpa_wpa2"),yield this.callNative(ln.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.callNative(ln.OPEN_APPSTORE,e)}))}}var Si,Ai,Oi,Ti,bi,wi,Ni,Pi,Ii,Ci,ki,Ri,Bi,Di,ji,Mi,Li,Ui,Wi,xi,zi,Fi,Gi,Hi,$i,Vi,Zi,Ji;class Ki{constructor(e){Si.set(this,localStorage),Ai.set(this,void 0),Oi.set(this,void 0),Wn(),r(this,Oi,{keys:new Set,currentSize:0,limitSize:an},"f"),r(this,Ai,e,"f"),this.findAllCurrentDataByApp(e)}findAllCurrentDataByApp(e){try{let t;for(t in o(this,Si,"f")){if(e){if(t.split("_")[0]!==e)continue}o(this,Oi,"f").keys.add(t)}}catch(e){_i.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,Ai,"f")&&(e=`${o(this,Ai,"f")}_${e}`),o(this,Oi,"f").keys.has(e)?o(this,Si,"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,Ai,"f")&&(e=`${o(this,Ai,"f")}_${e}`),o(this,Si,"f").setItem(e,t),o(this,Oi,"f").keys.add(e)}getInfo(){return i(this,void 0,void 0,(function*(){return Promise.resolve(this.getInfoSync())}))}getInfoSync(){const e=((e,t)=>{let n,i,o=0;for(i in e){const r=i.split("_")[0];e.hasOwnProperty(i)&&(t&&r!==t||(n=2*(e[i].length+i.length),o+=n))}return o})(o(this,Si,"f"),o(this,Ai,"f"));return{currentSize:Gt.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,Ai,"f")&&(e=`${o(this,Ai,"f")}_${e}`),o(this,Oi,"f").keys.has(e)&&(o(this,Si,"f").removeItem(e),o(this,Oi,"f").keys.delete(e))}clear(){return i(this,void 0,void 0,(function*(){return Promise.resolve(this.clearSync())}))}clearSync(){o(this,Oi,"f").keys.forEach((e=>{o(this,Ai,"f")&&e.indexOf(o(this,Ai,"f"))<0||(o(this,Si,"f").removeItem(e),o(this,Oi,"f").keys.delete(e))}))}}Si=new WeakMap,Ai=new WeakMap,Oi=new WeakMap;class qi extends li{constructor(e){super(),Ti.set(this,void 0),bi.set(this,void 0),r(this,bi,{keys:new Set,currentSize:0,limitSize:an},"f"),r(this,Ti,e,"f")}get(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.ZBROWSER_MPDS,{mpds_action:"mpds.get",mpds_data:{keys:e},appId:o(this,Ti,"f")},{isMultiCallback:!1}).then((e=>{let t=new Map;return e&&e.mpds_data&&e.mpds_data.map&&(t=new Map(Object.entries(e.mpds_data.map))),t}))}))}set(e){return i(this,void 0,void 0,(function*(){return{errorKeys:yield this.callNative(ln.ZBROWSER_MPDS,{mpds_action:"mpds.set",mpds_data:{map:e},appId:o(this,Ti,"f")},{isMultiCallback:!1}).then((e=>{let t=[];return e&&e.mpds_data&&e.mpds_data.error_keys&&(t=e.mpds_data.error_keys),t}))}}))}getInfo(){return i(this,void 0,void 0,(function*(){const e=yield this.callNative(ln.ZBROWSER_MPDS,{mpds_action:"mpds.get.size",mpds_data:{},appId:o(this,Ti,"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:Gt.isNumber(e)?Number(e/1024):0,limitSize:Number(5120)}}))}remove(e){return i(this,void 0,void 0,(function*(){return{errorKeys:yield this.callNative(ln.ZBROWSER_MPDS,{mpds_action:"mpds.remove.key",mpds_data:{keys:e},appId:o(this,Ti,"f")},{isMultiCallback:!1}).then((e=>{let t=[];return e&&e.mpds_data&&e.mpds_data.error_keys&&(t=e.mpds_data.error_keys),t}))}}))}clear(){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.ZBROWSER_MPDS,{mpds_action:"mpds.clear.appData",mpds_data:{},appId:o(this,Ti,"f")})}))}}Ti=new WeakMap,bi=new WeakMap;class Qi{getDataFromStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance(),n=yield t.get(e),i={};return n.forEach(((e,t)=>{i[t]=Kn(e)})),i}))}putDataToStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance(),n={};return Object.entries(e).forEach((([e,t])=>{Gt.isUndefined(t)||Gt.isNull(t)||(n[e]=Jn(t))})),yield t.set(n)}))}removeDataFromStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance();return yield t.remove(e)}))}clearStorage(){return i(this,void 0,void 0,(function*(){const e=this.getInstance();yield e.clear()}))}getStorageInfo(){return i(this,void 0,void 0,(function*(){const e=this.getInstance();return yield e.getInfo()}))}}class Yi extends Qi{constructor(e){super(),wi.set(this,void 0),r(this,wi,e,"f")}getInstance(){return new Ki(o(this,wi,"f"))}}wi=new WeakMap;class Xi extends Qi{constructor(e){super(),Ni.set(this,void 0),r(this,Ni,e,"f")}getInstance(){return new qi(o(this,Ni,"f"))}}Ni=new WeakMap;class eo{static setStorage(e){return i(this,void 0,void 0,(function*(){let t=new Yi(this.getAppId());return Zn()&&(t=new Xi(this.getAppId())),yield t.putDataToStorage(e.data)}))}static getStorage(e){return i(this,void 0,void 0,(function*(){let t=new Yi(this.getAppId());Zn()&&(t=new Xi(this.getAppId()));return yield t.getDataFromStorage(e.keys)}))}static getStorageInfo(e){return i(this,void 0,void 0,(function*(){let e=new Yi(this.getAppId());return Zn()&&(e=new Xi(this.getAppId())),yield e.getStorageInfo()}))}static removeStorage(e){return i(this,void 0,void 0,(function*(){let t=new Yi(this.getAppId());return Zn()&&(t=new Xi(this.getAppId())),yield t.removeDataFromStorage(e.keys)}))}static clearStorage(e={}){return i(this,void 0,void 0,(function*(){let e=new Yi(this.getAppId());Zn()&&(e=new Xi(this.getAppId())),yield e.clearStorage()}))}}class to{static getUserInfo(e){return i(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();let n="id,name,picture";(null==e?void 0:e.avatarType)&&(n=`${n}.type(${null==e?void 0:e.avatarType})`);return{userInfo:yield fetch(`${tn}?fields=${n}`,{headers:{access_token:t||""}}).then((e=>i(this,void 0,void 0,(function*(){const t=yield e.json(),n={id:t.id,name:t.name,birthday:"",gender:"",avatar:t.picture&&t.picture.data&&t.picture.data.url};return console.warn("'birthday' and 'gender' are deprecated"),n}))))}}))}static getPhoneNumber(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.MP_GET_NUMBER,{},{isMultiCallback:!0,callback:(e,t)=>{if(0===e.error_code){const t={number:e.data};return Promise.resolve(t)}return Promise.reject(t)},delay:this.isIOS?400:0})}))}}class no{static closeApp(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.WINDOW_CLOSE,{})}))}static openMiniApp(e){return i(this,void 0,void 0,(function*(){const t=null==e?void 0:e.appId,n=(null==e?void 0:e.params)||{},i=Object.entries(n).map((function([e,t]){return[e,t].join("=")})).join("&");let o;try{o=yield Yn(t,0)}catch(e){}const r={appId:t};o&&(r.appName=o.name,r.appAvtUrl=o.logoUrl),yield this.callNative(ln.OPEN_MP,{mpUrl:`https://h5.zdn.vn/zapps/${t}/${i.length>0?"?"+i:""}`,mpInfo:r})}))}static openWebview(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.OPEN_INAPP,{url:e})}))}static closeLoading(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.MP_CLOSE_LOADINGVIEW,{at:(new Date).getTime(),when:e,url:location.href})}))}}class io{static getLocation(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.GET_LOCATION,{silent_request:!1,permission_description:"Cho phép Zalo truy cập vào vị trí của thiết bị này?"},{isMultiCallback:!0,haveTimeout:!1,callback:(e,t)=>{if(0===e.error_code){const t=e.data,n={latitude:t.latitude,longitude:t.longitude,timestamp:t.timestamp,provider:t.provider};return Promise.resolve(n)}return Promise.reject(t)},delay:this.isIOS?400:0})}))}static sendLocation(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.QUERY_LOCATION_HIDE,{title:e.title,touserid:e.toUserId,zapp:this.getZAppId()})}))}}class oo{static requestCameraPermission(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.REQUEST_PERMISSION_CAMERA,{},{callback:(e,t)=>-2===e.error_code||e.error_code>=0?Promise.resolve({userAllow:-2!==e.error_code,message:e.error_message}):Promise.reject(t)})}))}static saveImageToPhotosAlbum(e){return i(this,void 0,void 0,(function*(){let t={};return Gt.isEmpty(e.imageBase64Data)?Gt.isEmpty(e.imageUrl)||(t={imageUrl:e.imageUrl}):t={imageBase64Data:e.imageBase64Data},yield this.callNative(ln.SAVE_IMAGE_GALLERY,Object.assign({},t))}))}}class ro{static viewOAQr(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.VIEW_MYQR,{dpn:e.displayName,uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openProfile(t){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.OPEN_PROFILE,{uId:t.id,type:e.ProfileType[t.type],zapp:this.getZAppId(),sourceId:t.sourceId,sourceIndex:t.sourceIndex})}))}static openChat(t){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.OPEN_CHAT,{uId:t.id,type:e.ChatType[t.type],zapp:this.getZAppId(),sourceId:t.sourceId,sourceIndex:t.sourceIndex})}))}static openPostFeed(t){return i(this,void 0,void 0,(function*(){let n={};switch(t.type){case"image":n={photoUrl:t.data.imageUrl};break;case"link":n={link:t.data.link,title:t.data.title,thumb:t.data.thumb,description:t.data.description};break;case"profile":n={avt:t.data.avatar,uid:t.data.id,dpn:t.data.displayName}}return yield this.callNative(ln.OPEN_POSTFEED,Object.assign(Object.assign({type:e.PostFeedType[t.type]},n),{zapp:this.getZAppId()})).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static followOA(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.FOLLOW_OA,{uid:e.id,showDialogConfirm:!0,zapp:this.getZAppId()},{haveTimeout:!1})}))}static unfollowOA(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.UNFOLLOW_OA,{uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openShareSheet(t){return i(this,void 0,void 0,(function*(){let n={};switch(t.type){case"image":let e=[];Array.isArray(t.data.imageUrls)&&t.data.imageUrls.length>0?e=t.data.imageUrls:e.push(t.data.imageUrl),n={photoUrls:e,photoUrl:t.data.imageUrl,caption:t.data.caption};break;case"gif":n={photoUrl:t.data.imageUrl,gifUrl:t.data.gifUrl,width:t.data.width,height:t.data.height};break;case"video":n={videoThumb:t.data.videoThumb,videoUrl:t.data.videoUrl,width:t.data.width,height:t.data.height};break;case"link":n={link:t.data.link,chatOnly:t.data.chatOnly?1:0};break;case"oa":n={uid:t.data.id};break;case"zmp":const i=yield this.getAccessToken(),o=yield qn(this.getAppId(),i||"",t.data.title||"",t.data.description||"",t.data.thumbnail||"",t.data.path);window.forceShareZMP?n={data:{ZInstantAPIInfo:{url:`${o.zinstantApi}`,zinstantdata_id:`templateId=${o.ztemplateId}&appId=${this.getAppId()}&shareId=${o.shareId}`},previewMsgText:{msg:{en:"Zalo Mini Program",vi:"Chương trình nhỏ"}},enableReactions:1}}:(n={link:o.shareableLink,chatOnly:t.data.chatOnly?1:0},t.type="link")}return yield this.callNative(ln.OPEN_SHARESHEET,Object.assign(Object.assign({type:e.ShareSheetType[t.type]},n),{zapp:this.getZAppId()}),{haveTimeout:!1}).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static createShortcut(e,t,n){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.CREATE_SHORTCUT,{url:e,title:t,iconUrl:n})}))}static openProfilePicker(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.MP_OPEN_PROFILE_PICKER,{maxProfile:e},{isMultiCallback:!0,callback:(e,t)=>0===e.error_code&&Array.isArray(e.data)?Promise.resolve(e.data.map((e=>e.id))):Promise.reject(t)})}))}static getActionsSupported(t){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.GET_SUPPORTED_ACTIONS,{},{isMultiCallback:!1,callback:(t,n)=>{const i=Fn();if(Array.isArray(t.actions)&&t.actions.length>0){const e=Object.keys(ln).filter((e=>ln[e].skip_jump)),n={actions:[...t.actions,...e]};return Promise.resolve(n)}if(i===e.PlatformType.iOS){const e={actions:yn};return Promise.resolve(e)}return Promise.reject(n)}})}))}static openMediaPicker(t,n,o,r,a,s){return i(this,void 0,void 0,(function*(){const i={type:0,url:n,maxSize:o||1048576};return yield this.callNative(ln.PICK_MEDIA,{media_type:e.MediaPickerType[t],edit_view:Object.assign(Object.assign({},{enable:1,aspect_ratio:"1:1"}),r),silent_request:a,upload:i,max_select_item:s},{isMultiCallback:!0,callback:(e,t)=>{var n;if(0===e.error_code){const t={data:null===(n=e.data)||void 0===n?void 0:n.result_content};return Promise.resolve(t)}return Promise.reject(t)}})}))}static openOutApp(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.OPEN_OUTAPP,{url:e})}))}}class ao{static getRouteParams(){let e={};const t=window.location.href;try{let n=new URL(t).searchParams.toString();n&&(e=Rn.getParamsAsObject(n))}catch(e){throw new Error("Url không hợp lệ")}return e}static sendDataToPreviousMiniApp(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.WEBVIEW_SET_RESULT,{result:Jn(e.data)})}))}static onCallbackData(t){return i(this,void 0,void 0,(function*(){yield this.events.on(e.Events.OnDataCallback,(e=>{t({data:e})}))}))}}class so extends li{constructor(){var e,t,n,i,a,s,l,c,u,d,p,h,v,f,m,g,y;super(),Pi.set(this,Kt),Ii.set(this,qt),Ci.set(this,Qt),ki.set(this,void 0),Ri.set(this,void 0),Bi.set(this,void 0),Di.set(this,null),ji.set(this,{timer:{getToken:0}}),Mi.set(this,void 0),Li.set(this,void 0),Ui.set(this,null),this.events=ei.getInstance(),this.isIOS=Wn().isIOS,Wi.set(this,void 0),this.getActionBarConfig=()=>o(this,Wi,"f"),this.setActionBarConfig=e=>{r(this,Wi,e(o(this,Wi,"f")),"f")},xi.set(this,(()=>new Promise(((e,t)=>{Gt.isUndefined(o(this,Ui,"f"))||Gt.isNull(o(this,Ui,"f"))?this.callNative(ln.JUMP_LOGIN,{}).then((t=>{const n=t&&t.cookiesOAuthLogins||[],i=n.find((e=>e.name===Xt));i&&(this.setJSToken(i.value),window.ZJSBridge.setJSToken&&window.ZJSBridge.setJSToken(i.value)),r(this,Ui,n,"f"),e(n)})).catch((e=>{t(e)})):e(o(this,Ui,"f"))})))),zi.set(this,mi.setNavigationBarRightButton),this.getVersion=fi.getVersion,this.getSystemInfo=fi.getSystemInfo,this.setNavigationBarTitle=mi.setNavigationBarTitle,this.setNavigationBarColor=mi.setNavigationBarColor,this.setNavigationBarLeftButton=mi.setNavigationBarLeftButton,this.setBackgroundColor=gi.setBackgroundColor,this.setDeviceOrientation=Ei.setDeviceOrientation,this.setStorage=eo.setStorage,this.getStorage=eo.getStorage,this.getStorageInfo=eo.getStorageInfo,this.removeStorage=eo.removeStorage,this.clearStorage=eo.clearStorage,this.getUserInfo=to.getUserInfo,this.getNetworkType=Ei.getNetworkType,this.onNetworkStatusChange=Ei.onNetworkStatusChange,this.startBeaconDiscovery=Ei.startBeaconDiscovery,this.stopBeaconDiscovery=Ei.stopBeaconDiscovery,this.getBeacons=Ei.getBeacons,this.closeApp=no.closeApp,this.getLocation=io.getLocation,this.stopBluetoothDevicesDiscovery=Ei.stopBluetoothDevicesDiscovery,this.startBluetoothDevicesDiscovery=Ei.stopBluetoothDevicesDiscovery,this.openBluetoothAdapter=Ei.openBluetoothAdapter,this.onBluetoothDeviceFound=Ei.onBluetoothDeviceFound,this.onBluetoothAdapterStateChange=Ei.onBluetoothAdapterStateChange,this.getConnectedBluetoothDevices=Ei.getConnectedBluetoothDevices,this.getBluetoothDevices=Ei.getBluetoothDevices,this.getBluetoothAdapterState=Ei.getBluetoothAdapterState,this.closeBluetoothAdapter=Ei.closeBluetoothAdapter,this.scanQRCode=Ei.scanQRCode,this.openProfile=ro.openProfile,this.openChat=ro.openChat,this.openPostFeed=ro.openPostFeed,this.followOA=ro.followOA,this.unFollowOA=ro.unfollowOA,this.openShareSheet=ro.openShareSheet,this.requestCameraPermission=oo.requestCameraPermission,this.createShortcut=ro.createShortcut,this.openBioAuthentication=Ei.openBioAuthentication,this.checkStateBioAuthentication=Ei.checkStateBioAuthentication,this.sendLocation=io.sendLocation,this.showToast=Ei.showToast,this.hideKeyboard=Ei.hideKeyboard,this.openPhone=Ei.openPhone,this.openSMS=Ei.openSMS,this.viewOAQr=ro.viewOAQr,this.keepScreen=Ei.keepScreen,this.saveImageToPhotosAlbum=oo.saveImageToPhotosAlbum,this.openMiniApp=no.openMiniApp,this.vibrate=Ei.vibrate,this.openWebview=no.openWebview,this.getRouteParams=ao.getRouteParams,this.getAppInfo=fi.getAppInfo,this.sendDataToPreviousMiniApp=ao.sendDataToPreviousMiniApp,this.onCallbackData=ao.onCallbackData,this.getPhoneNumber=to.getPhoneNumber,this.openProfilePicker=ro.openProfilePicker,Fi.set(this,ro.getActionsSupported),this.connectWifi=Ei.connectWifi,this.openMediaPicker=ro.openMediaPicker,this.openOutApp=ro.openOutApp,this.closeLoading=no.closeLoading,this.openAppStore=Ei.openAppStore,r(this,ki,null,"f"),r(this,Ri,null,"f"),r(this,Bi,null,"f"),this.isShowNavBar=!0,r(this,Mi,0,"f"),r(this,Li,0,"f");const _="home"===(null===(t=null===(e=o(this,Ci,"f"))||void 0===e?void 0:e.app)||void 0===t?void 0:t.leftButton)||"both"===(null===(i=null===(n=o(this,Ci,"f"))||void 0===n?void 0:n.app)||void 0===i?void 0:i.leftButton)?Sn:An,E=new URL(location.href),S=Gt.isString(null===(s=null===(a=o(this,Ci,"f"))||void 0===a?void 0:a.app)||void 0===s?void 0:s.headerColor)&&(null===(u=null===(c=null===(l=o(this,Ci,"f"))||void 0===l?void 0:l.app)||void 0===c?void 0:c.headerColor)||void 0===u?void 0:u.length)>0?5:6,A="none"===(null===(p=null===(d=o(this,Ci,"f"))||void 0===d?void 0:d.app)||void 0===p?void 0:p.leftButton)||"home"===(null===(v=null===(h=o(this,Ci,"f"))||void 0===h?void 0:h.app)||void 0===v?void 0:v.leftButton)?En:_n;r(this,Wi,{actionbarType:S,buttonType:A,dataConfig:{backgroundColor:(null===(m=null===(f=o(this,Ci,"f"))||void 0===f?void 0:f.app)||void 0===m?void 0:m.headerColor)||"",textColor:(null===(y=null===(g=o(this,Ci,"f"))||void 0===g?void 0:g.app)||void 0===y?void 0:y.textColor)||"",viewInLeftType:A,confirmToExit:1},homeConfig:{enable:_,url:`https://h5.zdn.vn/zapps/${this.getAppId()}/${E.search}`}},"f")}static getInstance(){return so.instance||(so.instance=new so),so.instance}getLoginStatus(){return Gt.isString(o(this,Bi,"f"))&&o(this,Bi,"f").length>0}getAppId(){return o(this,Ii,"f")}getZAppId(){return o(this,Pi,"f")}login(e){return i(this,void 0,void 0,(function*(){const e=yield o(this,xi,"f").call(this),t=e.find((e=>e.name===Yt)),n=e.find((e=>e.name===en));if(!Gt.isUndefined(t)&&!Gt.isNull(t)&&Gt.isString(t.value)){if(r(this,ki,t.value,"f"),Gt.isUndefined(n)||Gt.isNull(n)||!Gt.isString(n.value)?yield this.loginZaloV3():(r(this,Ri,n.value,"f"),yield this.loginZaloV4()),!o(this,Bi,"f"))throw kn.loginFailed();return o(this,Bi,"f")}throw kn.loginFailed()}))}loginZaloV3(){return i(this,void 0,void 0,(function*(){return yield fetch(`${on}?app_id=${o(this,Pi,"f")}&redirect_uri=https://h5.zdn.vn/zapps/${o(this,Ii,"f")}/&code=${o(this,ki,"f")}&isSDK=true123`).then((e=>i(this,void 0,void 0,(function*(){let t=yield e.json();if(t.access_token){r(this,Bi,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return r(this,Li,e,"f"),r(this,Mi,(new Date).getTime(),"f"),this.setZAccSession(o(this,Bi,"f")||""),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(o(this,Bi,"f")||""),o(this,Bi,"f")}return null}))))}))}loginZaloV4(){return i(this,void 0,void 0,(function*(){const e=new URLSearchParams;e.append("app_id",o(this,Ii,"f")),e.append("code",o(this,ki,"f")||""),e.append("code_verifier",o(this,Ri,"f")||""),Gt.isNull(o(this,Di,"f"))?e.append("grant_type","authorization_code"):(e.append("grant_type","refresh_token"),e.append("refresh_token",o(this,Di,"f")||""));return yield fetch(nn,Object.assign({method:"POST",body:e},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).then((e=>i(this,void 0,void 0,(function*(){const t=yield e.json();if(t.refresh_token&&r(this,Di,t.refresh_token,"f"),t.access_token){r(this,Bi,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return r(this,Li,e,"f"),r(this,Mi,(new Date).getTime(),"f"),this.setZAccSession(o(this,Bi,"f")||""),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(o(this,Bi,"f")||""),o(this,Bi,"f")}return null}))))}))}getAccessToken(e){return i(this,void 0,void 0,(function*(){const e=(new Date).getTime()-o(this,Mi,"f");if(!o(this,Bi,"f"))throw kn.loginRequired();return e<o(this,Li,"f")?o(this,Bi,"f"):yield this.login()}))}}Pi=new WeakMap,Ii=new WeakMap,Ci=new WeakMap,ki=new WeakMap,Ri=new WeakMap,Bi=new WeakMap,Di=new WeakMap,ji=new WeakMap,Mi=new WeakMap,Li=new WeakMap,Ui=new WeakMap,Wi=new WeakMap,xi=new WeakMap,zi=new WeakMap,Fi=new WeakMap;class lo{constructor(){Gi.set(this,Kt),Hi.set(this,Qt),$i.set(this,"DEFAULT ZOAUTH"),Vi.set(this,"DEFAULT ACCESS TOKEN"),Zi.set(this,{timer:{getToken:0}}),Ji.set(this,!1),this.getLoginStatus=()=>o(this,Ji,"f"),this.getAppId=()=>o(this,Gi,"f"),this.login=()=>(r(this,Ji,!0,"f"),Promise.resolve(o(this,$i,"f"))),this.getAccessToken=()=>Promise.resolve(o(this,Vi,"f")),this.getVersion=fi.getVersion,this.getSystemInfo=fi.getSystemInfo,this.setNavigationBarTitle=()=>Promise.resolve(),this.setNavigationBarColor=()=>Promise.resolve(),this.setBackgroundColor=()=>Promise.resolve(),this.setNavigationBarLeftButton=()=>Promise.resolve(),this.setDeviceOrientation=()=>Promise.resolve(),this.setStorage=e=>i(this,void 0,void 0,(function*(){const t=new Yi(this.getAppId());return yield t.putDataToStorage(e.data),{errorKeys:[]}})),this.getStorage=e=>i(this,void 0,void 0,(function*(){const t=new Yi(this.getAppId());return yield t.getDataFromStorage(e.keys)})),this.getStorageInfo=e=>i(this,void 0,void 0,(function*(){const e=new Yi(this.getAppId());return yield e.getStorageInfo()})),this.removeStorage=e=>i(this,void 0,void 0,(function*(){const t=new Yi(this.getAppId());return yield t.removeDataFromStorage(e.keys)})),this.clearStorage=e=>i(this,void 0,void 0,(function*(){const e=new Yi(this.getAppId());return yield e.clearStorage()})),this.getUserInfo=()=>(console.warn("birthday and gender are deprecated"),Promise.resolve({userInfo:{id:"3368637342326461234",name:"User Name",avatar:"https://h5.zdn.vn/static/images/avatar.png"}})),this.getNetworkType=()=>{let t;switch((navigator.connection||navigator.mozConnection||navigator.webkitConnection).effectiveType){case"none":t=e.NetworkType.none;break;case"4g":t=e.NetworkType.wifi;break;case"3g":case"2g":t=e.NetworkType.cellular;break;default:t=e.NetworkType.unknown}const n={networkType:t};return Promise.resolve(n)},this.onNetworkStatusChange=t=>{const n=navigator.connection||navigator.mozConnection||navigator.webkitConnection,i=n.effectiveType;return n.addEventListener("change",(function(){let n;switch(i){case"none":n=e.NetworkType.none;break;case"4g":n=e.NetworkType.wifi;break;case"3g":case"2g":n=e.NetworkType.cellular;break;default:n=e.NetworkType.unknown}t({isConnected:!0,networkType:n})})),Promise.resolve()},this.startBeaconDiscovery=e=>Promise.resolve(!0),this.stopBeaconDiscovery=e=>Promise.resolve(!0),this.getBeacons=e=>Promise.resolve({beacons:[]}),this.closeApp=()=>Promise.resolve(),this.getLocation=()=>Promise.resolve({longitude:"105.788026",latitude:"21.0258773",timestamp:(new Date).getTime().toString(),provider:"fused"}),this.onBackButtonClick=()=>Promise.resolve(),this.stopBluetoothDevicesDiscovery=()=>Promise.resolve(),this.startBluetoothDevicesDiscovery=()=>Promise.resolve(),this.openBluetoothAdapter=()=>Promise.resolve(),this.onBluetoothDeviceFound=()=>Promise.resolve(),this.onBluetoothAdapterStateChange=()=>Promise.resolve(),this.getConnectedBluetoothDevices=()=>Promise.resolve(),this.getBluetoothDevices=()=>Promise.resolve(),this.getBluetoothAdapterState=()=>Promise.resolve(),this.closeBluetoothAdapter=()=>Promise.resolve(),this.scanQRCode=()=>Promise.resolve({content:"132"}),this.openProfile=()=>Promise.resolve(),this.openChat=()=>Promise.resolve(),this.openPostFeed=()=>Promise.resolve({status:1,shareType:0,numberOfUser:0}),this.followOA=()=>Promise.resolve(),this.unFollowOA=()=>Promise.resolve(),this.openShareSheet=()=>Promise.resolve({status:2,shareType:0,numberOfUser:0}),this.requestCameraPermission=()=>Promise.resolve({userAllow:!0,message:"Success"}),this.createShortcut=()=>Promise.resolve(),this.openBioAuthentication=()=>Promise.resolve({code:0,message:"OK",data:{domain:"",code:0,message:"",payToken:""}}),this.checkStateBioAuthentication=()=>Promise.resolve({bioState:""}),this.sendLocation=()=>Promise.resolve(),this.showToast=()=>Promise.resolve(),this.hideKeyboard=()=>Promise.resolve(),this.openPhone=()=>Promise.resolve(),this.openSMS=()=>Promise.resolve(),this.viewOAQr=()=>Promise.resolve(),this.keepScreen=()=>Promise.resolve(),this.saveImageToPhotosAlbum=()=>Promise.resolve(),this.openMiniApp=e=>Promise.resolve(),this.vibrate=()=>Promise.resolve(),this.openWebview=e=>(location.replace(e),Promise.resolve()),this.getRouteParams=ao.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()}on(e,t,n){throw new Error("Method not implemented.")}once(e,t,n){throw new Error("Method not implemented.")}off(e,t,n,i){throw new Error("Method not implemented.")}removeAllListeners(e){throw new Error("Method not implemented.")}openMediaPicker(e,t,n,i,o,r){return console.warn("This api only works on zalo app"),Promise.resolve({data:""})}}Gi=new WeakMap,Hi=new WeakMap,$i=new WeakMap,Vi=new WeakMap,Zi=new WeakMap,Ji=new WeakMap;const co=Symbol("required"),uo=Symbol("checkType"),po=(e,t)=>(n,i,o)=>{let r=Reflect.getOwnMetadata(co,n,i)||[];r.push({parameterIndex:o,fields:e,option:t}),Reflect.defineMetadata(co,r,n,i)},ho=(e,t,n)=>(i,o,r)=>{let a=Reflect.getOwnMetadata(uo,i,o)||[];a.push({parameterIndex:r,type:e,properties:t,defaultValue:n}),Reflect.defineMetadata(uo,a,i,o)};const vo=(e,t,n)=>{const i=n.value,o=i.toString().match(/\(.*?\)/)[0].replace(/[()]/gi,"").replace(/\s/gi,"").split(",");return n.value=function(){const n=Reflect.getOwnMetadata(co,e,t),r=Reflect.getOwnMetadata(uo,e,t);return r&&r.forEach((e=>{const{parameterIndex:t,type:n,properties:i,defaultValue:r}=e;let a=arguments[t],s=o[t];const l=typeof a;if(!Gt.isUndefined(a)){if(!Gn(a,n))throw kn.wrongTypeParam(s,n,Array.isArray(a)?"array":null===a?"null":l);"object"===n&&Object.entries(i).forEach((([e,n])=>{const i=e.split("?")[0],o=Gt.get(a,i);if(Gt.isUndefined(o)||Gt.isNull(o)){if(!e.includes("?"))throw kn.missingParam(e);Gt.isObject(Gt.get(a,i.split(".")[0]))&&r&&!Gt.isUndefined(Gt.get(r,i))&&Gt.set(arguments[t],i,Gt.get(r,i))}else if(Gt.isFunction(n)){const e=n(o);if(e&&e.error)throw kn.wrongTypeParam(`${s}.${i}`,e.errorMessage,typeof o)}}))}})),n&&n.forEach((e=>{const{parameterIndex:t,option:n,fields:i}=e,o=arguments[t],r=null==n?void 0:n.if,a=null==n?void 0:n.defaultValue;let s=!0;r&&(s=Object.keys(r).every((e=>Gt.get(o,e)===r[e]))),s&&i.forEach((e=>{const n=e=>{let n=!1;return Gt.isEmpty(Gt.get(o,e))&&(Gt.isUndefined(Gt.get(a,e))||Gt.set(arguments[t],e,Gt.get(a,e)),n=!0),n};if(Array.isArray(e)&&e.length>0&&e.every(n))throw kn.missingParam(e.join(" or "));if(Gt.isString(e)&&n(e))throw kn.missingParam(e)}))})),i.apply(this,arguments)},n};var fo,mo,go,yo,_o;class Eo{constructor(){this.events=ei.getInstance(),fo.set(this,void 0),r(this,fo,this.getServiceInstance(),"f"),this.events.addListener=(t,n,i)=>{const o=t;return this.events.addListener(e.Events[o],n,i)}}login(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").login(e)}))}getLoginStatus(){return o(this,fo,"f").getLoginStatus()}getAccessToken(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getAccessToken(e)}))}getVersion(){return o(this,fo,"f").getVersion()}getSystemInfo(){return o(this,fo,"f").getSystemInfo()}setNavigationBarTitle(e){return i(this,void 0,void 0,(function*(){return o(this,fo,"f").setNavigationBarTitle(e)}))}setNavigationBarColor(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").setNavigationBarColor(e)}))}setBackgroundColor(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").setBackgroundColor(e)}))}setNavigationBarLeftButton(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").setNavigationBarLeftButton(e)}))}setDeviceOrientation(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").setDeviceOrientation(e)}))}setStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").setStorage(e)}))}getStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getStorage(e)}))}getStorageInfo(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getStorageInfo(e)}))}removeStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").removeStorage(e)}))}clearStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").clearStorage(e)}))}getUserInfo(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getUserInfo(e)}))}getNetworkType(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getNetworkType(e)}))}onNetworkStatusChange(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").onNetworkStatusChange(e)}))}startBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").startBeaconDiscovery(e)}))}stopBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").stopBeaconDiscovery(e)}))}getBeacons(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getBeacons(e)}))}closeApp(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").closeApp(e)}))}getLocation(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getLocation(e)}))}stopBluetoothDevicesDiscovery(){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").stopBluetoothDevicesDiscovery()}))}startBluetoothDevicesDiscovery(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").startBluetoothDevicesDiscovery(e)}))}openBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").openBluetoothAdapter()}))}onBluetoothDeviceFound(){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").onBluetoothDeviceFound()}))}onBluetoothAdapterStateChange(){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").onBluetoothAdapterStateChange()}))}getConnectedBluetoothDevices(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getConnectedBluetoothDevices(e)}))}getBluetoothDevices(){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getBluetoothDevices()}))}getBluetoothAdapterState(){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getBluetoothAdapterState()}))}closeBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").closeBluetoothAdapter()}))}scanQRCode(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").scanQRCode(e)}))}openProfile(e){return i(this,void 0,void 0,(function*(){yield o(this,fo,"f").openProfile(e)}))}openChat(e){return i(this,void 0,void 0,(function*(){yield o(this,fo,"f").openChat(e)}))}openPostFeed(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").openPostFeed(e)}))}followOA(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").followOA(e)}))}unfollowOA(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").unFollowOA(e)}))}openShareSheet(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").openShareSheet(e)}))}requestCameraPermission(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").requestCameraPermission(e)}))}createShortcut(e){return i(this,void 0,void 0,(function*(){const t=yield Yn(qt,0),n=Wn().isIOS,i=t.logoUrl||xn("og:image:url")||"",r=t.name||document.title,a=e.params?new URLSearchParams(e.params):new URLSearchParams;if(a.append("utm_source","zalo-shortcut"),a.append("utm_medium","default"),a.append("utm_campaign","default"),n){a.append("appId",qt),a.append("appName",r),a.append("appIcon",i);const e=`https://mini.zalo.me/shortcut.html?${a.toString()}`;yield o(this,fo,"f").openOutApp(encodeURI(e))}else yield o(this,fo,"f").createShortcut(`https://zalo.me/app/link/zapps/${qt}/?${a.toString()}`,r,i);return Cn()}))}openBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").openBioAuthentication(e)}))}checkStateBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").checkStateBioAuthentication(e)}))}sendLocation(e){return i(this,void 0,void 0,(function*(){yield o(this,fo,"f").sendLocation(e)}))}showToast(e){return i(this,void 0,void 0,(function*(){yield o(this,fo,"f").showToast(e)}))}hideKeyboard(e){return i(this,void 0,void 0,(function*(){yield o(this,fo,"f").hideKeyboard(e)}))}openPhone(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").openPhone(e)}))}openSMS(e){return i(this,void 0,void 0,(function*(){yield o(this,fo,"f").openSMS(e)}))}viewOAQr(e){return i(this,void 0,void 0,(function*(){yield o(this,fo,"f").viewOAQr(e)}))}keepScreen(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").keepScreen(e)}))}saveImageToGallery(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").saveImageToPhotosAlbum(e)}))}saveImageToPhotosAlbum(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").saveImageToPhotosAlbum(e)}))}openMiniApp(e){return i(this,void 0,void 0,(function*(){if(!Gt.isEmpty(e.params)){const t=e.params||{};Object.keys(t).forEach((e=>{"object"==typeof t[e]&&(t[e]=JSON.stringify(t[e])),t[e]=""+encodeURIComponent(t[e])})),e.params=t}yield o(this,fo,"f").openMiniApp(e)}))}vibrate(e){return i(this,void 0,void 0,(function*(){yield o(this,fo,"f").vibrate(e)}))}openWebview(e){return i(this,void 0,void 0,(function*(){const t=new URL(e.url),n=t.searchParams.get("typeInapp");Gt.isEmpty(n)&&t.searchParams.set("typeInapp","1"),yield o(this,fo,"f").openWebview(t.href)}))}getRouteParams(){return o(this,fo,"f").getRouteParams()}getAppInfo(e){return o(this,fo,"f").getAppInfo()}sendDataToPreviousMiniApp(e){return o(this,fo,"f").sendDataToPreviousMiniApp(e)}onCallbackData(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").onCallbackData(e)}))}getPhoneNumber(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getPhoneNumber()}))}openProfilePicker(e){return i(this,void 0,void 0,(function*(){const t=yield o(this,fo,"f").openProfilePicker(e.maxProfile);let n;if(t.length>0)try{const e=yield this.getAccessToken(),i=yield fetch(rn,{method:"POST",headers:{"Content-Type":"application/json",access_token:e||""},body:JSON.stringify({fields:"id,name,picture",user_ids:t})}),o=yield i.json();if(0!==o.error||!o.data)throw new Error(o.message);n=t.map((e=>{var t,n,i,r,a,s,l,c,u,d,p;return{id:(null===(n=null===(t=o.data[e])||void 0===t?void 0:t.user_info)||void 0===n?void 0:n.user_id_by_app)||"",profile:{name:null===(r=null===(i=o.data[e])||void 0===i?void 0:i.user_info)||void 0===r?void 0:r.name,avatar:null===(c=null===(l=null===(s=null===(a=o.data[e])||void 0===a?void 0:a.user_info)||void 0===s?void 0:s.picture)||void 0===l?void 0:l.data)||void 0===c?void 0:c.url},code:0!==(null===(u=o.data[e])||void 0===u?void 0:u.error)?-1:0,message:`Get profile: ${Gt.isUndefined(null===(d=o.data[e])||void 0===d?void 0:d.message)?"Unknown error":null===(p=o.data[e])||void 0===p?void 0:p.message}`}}))}catch(e){n=t.map((t=>({id:t,profile:{name:"",avatar:""},code:-1,message:`Can't get profile: ${e.message}`})))}return{users:n||[]}}))}connectWifi(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").connectWifi(e)}))}openMediaPicker(e){var t,n,r;return i(this,void 0,void 0,(function*(){const i={};Gt.isUndefined(null===(t=e.editView)||void 0===t?void 0:t.enable)||(null===(n=e.editView)||void 0===n?void 0:n.enable)?i.enable=1:i.enable=0,i.aspect_ratio=null===(r=e.editView)||void 0===r?void 0:r.aspectRatio;const a=!0===e.silentRequest?1:0,s=e.maxSelectItem;return yield o(this,fo,"f").openMediaPicker(e.type,e.serverUploadUrl,e.maxItemSize,i,a,s)}))}getShareableLink(e){return i(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();return(yield qn(window.APP_ID,t||"",e.title,e.description,e.thumbnail,e.path)).shareableLink}))}closeLoading(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").closeLoading("user action")}))}requestUpdateZalo(e){return i(this,void 0,void 0,(function*(){const e=Wn().isIOS?"https://apps.apple.com/vn/app/zalo/id579523206":"https://play.google.com/store/apps/details?id=com.zing.zalo";return yield o(this,fo,"f").openOutApp(e)}))}}fo=new WeakMap,t([Pn],Eo.prototype,"login",null),t([In],Eo.prototype,"getLoginStatus",null),t([Pn],Eo.prototype,"getAccessToken",null),t([In],Eo.prototype,"getVersion",null),t([In],Eo.prototype,"getSystemInfo",null),t([Pn,vo,n(0,ho("object",{title:Qn("string")}))],Eo.prototype,"setNavigationBarTitle",null),t([Pn,vo,n(0,ho("object",{color:Qn("string"),"textColor?":Qn("string",{values:["white","black"]}),"statusBarColor?":Qn("string")}))],Eo.prototype,"setNavigationBarColor",null),t([Pn,vo,n(0,ho("object",{backgroundColor:Qn("string"),"textColor?":Qn("string",{values:["white","black"]})}))],Eo.prototype,"setBackgroundColor",null),t([Pn,vo,n(0,ho("object",{type:Qn("string",{values:["none","back","home","both"]})}))],Eo.prototype,"setNavigationBarLeftButton",null),t([Pn,vo,n(0,ho("object",{rotate:Qn("string",{values:["auto","portrait","landscape"]})}))],Eo.prototype,"setDeviceOrientation",null),t([Pn,vo,n(0,ho("object",{data:Qn("object")}))],Eo.prototype,"setStorage",null),t([Pn,vo,n(0,ho("object",{keys:Qn("array<string>")}))],Eo.prototype,"getStorage",null),t([Pn],Eo.prototype,"getStorageInfo",null),t([Pn,vo,n(0,ho("object",{keys:Qn("array<string>")}))],Eo.prototype,"removeStorage",null),t([Pn],Eo.prototype,"clearStorage",null),t([Pn,vo,n(0,ho("object",{"avatarType?":Qn("string",{values:["small","normal","large"]})}))],Eo.prototype,"getUserInfo",null),t([Pn],Eo.prototype,"getNetworkType",null),t([Pn],Eo.prototype,"onNetworkStatusChange",null),t([Pn],Eo.prototype,"startBeaconDiscovery",null),t([Pn],Eo.prototype,"stopBeaconDiscovery",null),t([Pn],Eo.prototype,"getBeacons",null),t([Pn],Eo.prototype,"closeApp",null),t([Pn],Eo.prototype,"getLocation",null),t([Pn],Eo.prototype,"stopBluetoothDevicesDiscovery",null),t([Pn],Eo.prototype,"startBluetoothDevicesDiscovery",null),t([Pn],Eo.prototype,"openBluetoothAdapter",null),t([Pn],Eo.prototype,"onBluetoothDeviceFound",null),t([Pn],Eo.prototype,"onBluetoothAdapterStateChange",null),t([Pn],Eo.prototype,"getConnectedBluetoothDevices",null),t([Pn],Eo.prototype,"getBluetoothDevices",null),t([Pn],Eo.prototype,"getBluetoothAdapterState",null),t([Pn],Eo.prototype,"closeBluetoothAdapter",null),t([Pn],Eo.prototype,"scanQRCode",null),t([Pn,vo,n(0,ho("object",{type:Qn("string",{values:["user","oa","aliasOA"]}),id:Qn("string")}))],Eo.prototype,"openProfile",null),t([Pn,vo,n(0,ho("object",{type:Qn("string",{values:["user","oa"]}),id:Qn("string")}))],Eo.prototype,"openChat",null),t([Pn,vo,n(0,po(["data.imageUrl"],{if:{type:"image"}})),n(0,po(["data.link"],{if:{type:"link"}})),n(0,po(["data.id"],{if:{type:"profile"}})),n(0,ho("object",{type:Qn("string",{values:["image","link","profile"]}),data:Qn("object"),"data.imageUrl?":Qn("url"),"data.link?":Qn("url"),"data.title?":Qn("string"),"data.thumb?":Qn("url"),"data.description?":Qn("string"),"data.avatar?":Qn("url"),"data.id?":Qn("string"),"data.displayName?":Qn("string")}))],Eo.prototype,"openPostFeed",null),t([Pn,vo,n(0,ho("object",{id:Qn("string"),"showDialogConfirm?":Qn("boolean")}))],Eo.prototype,"followOA",null),t([Pn,vo,n(0,ho("object",{id:Qn("string")}))],Eo.prototype,"unfollowOA",null),t([Pn,vo,n(0,po([["data.imageUrl","data.imageUrls"]],{if:{type:"image"}})),n(0,po(["data.link"],{if:{type:"link"}})),n(0,po(["data.id"],{if:{type:"oa"}})),n(0,po(["data.gifUrl"],{if:{type:"gif"}})),n(0,po(["data.videoThumb","data.videoUrl"],{if:{type:"video"}})),n(0,po(["data.thumbnail","data.title","data.description"],{if:{type:"zmp"},defaultValue:{data:{description:""}}})),n(0,ho("object",{type:Qn("string",{values:["image","gif","video","link","oa","zmp"]}),data:Qn("object"),"data.imageUrl?":Qn("url"),"data.imageUrls?":Qn("array<url>",{maxLength:10}),"data.caption?":Qn("string"),"data.gifUrl?":Qn("url"),"data.width?":Qn("number"),"data.height?":Qn("number"),"data.videoThumb?":Qn("url"),"data.videoUrl?":Qn("url"),"data.link?":Qn("url"),"data.chatOnly?":Qn("boolean"),"data.id?":Qn("string"),"data.thumbnail?":Qn("url"),"data.path?":Qn("string"),"data.title?":Qn("string",{maxLength:100}),"data.description?":Qn(["string"],{maxLength:400})}))],Eo.prototype,"openShareSheet",null),t([Pn],Eo.prototype,"requestCameraPermission",null),t([Pn],Eo.prototype,"createShortcut",null),t([Pn,vo,n(0,ho("object",{secretData:Qn("string"),"ui?":Qn("object"),"ui.title?":Qn("string"),"ui.subTitle?":Qn("string"),"ui.negativeButtonText?":Qn("string"),"requireFingerprint?":Qn("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"}}))],Eo.prototype,"openBioAuthentication",null),t([Pn],Eo.prototype,"checkStateBioAuthentication",null),t([Pn,vo,n(0,ho("object",{toUserId:Qn("string"),"title?":Qn("string")}))],Eo.prototype,"sendLocation",null),t([Pn,vo,n(0,ho("object",{message:Qn("string")}))],Eo.prototype,"showToast",null),t([Pn],Eo.prototype,"hideKeyboard",null),t([Pn,vo,n(0,ho("object",{phoneNumber:Qn("string")}))],Eo.prototype,"openPhone",null),t([Pn,vo,n(0,ho("object",{content:Qn("string"),phoneNumber:Qn("string",{regex:/^\+?\d+$/})}))],Eo.prototype,"openSMS",null),t([Pn,vo,n(0,ho("object",{id:Qn("string"),"displayName?":Qn("string")},{displayName:""}))],Eo.prototype,"viewOAQr",null),t([Pn],Eo.prototype,"keepScreen",null),t([Pn,vo,n(0,ho("object",{"imageBase64Data?":Qn("string"),"imageUrl?":Qn("url")}))],Eo.prototype,"saveImageToGallery",null),t([Pn,vo,n(0,ho("object",{"imageBase64Data?":Qn("string"),"imageUrl?":Qn("url")}))],Eo.prototype,"saveImageToPhotosAlbum",null),t([Pn,vo,n(0,ho("object",{appId:Qn("string"),"params?":Qn("object")}))],Eo.prototype,"openMiniApp",null),t([Pn,vo,n(0,ho("object",{"type?":Qn("string",{values:["oneShot"]}),"milliseconds?":Qn("number")},{type:"oneShot",milliseconds:500}))],Eo.prototype,"vibrate",null),t([Pn,vo,n(0,ho("object",{url:Qn("url")}))],Eo.prototype,"openWebview",null),t([In],Eo.prototype,"getRouteParams",null),t([Pn],Eo.prototype,"getAppInfo",null),t([Pn],Eo.prototype,"sendDataToPreviousMiniApp",null),t([Pn],Eo.prototype,"onCallbackData",null),t([Pn],Eo.prototype,"getPhoneNumber",null),t([Pn,vo,n(0,ho("object",{"maxProfile?":Qn("number",{min:1,max:10})},{maxProfile:1}))],Eo.prototype,"openProfilePicker",null),t([Pn,vo,n(0,po(["SSID"])),n(0,ho("object",{SSID:Qn("string"),"password?":Qn("string"),"hiddenSSID?":Qn("boolean")}))],Eo.prototype,"connectWifi",null),t([Pn,vo,n(0,ho("object",{type:Qn("string",{values:["photo","video","file"]}),serverUploadUrl:Qn("url"),"maxItemSize?":Qn("number",{min:0}),"editView?":Qn("object"),"editView.enable?":Qn("boolean"),"editView.aspectRatio?":Qn("string",{regex:/^\d+:\d+$/}),"silentRequest?":Qn("boolean"),"maxSelectItem?":Qn("number",{min:1})}))],Eo.prototype,"openMediaPicker",null),t([Pn,vo,n(0,ho("object",{title:Qn("string",{maxLength:100}),"thumbnail?":Qn("url"),"path?":Qn("string"),description:Qn(["string"],{maxLength:400})},{description:""}))],Eo.prototype,"getShareableLink",null),t([Pn,vo],Eo.prototype,"closeLoading",null),t([Pn,vo],Eo.prototype,"requestUpdateZalo",null);class So extends Eo{getServiceInstance(){return so.getInstance()}}class Ao extends Eo{getServiceInstance(){return new lo}}class Oo{constructor(){mo.set(this,qt)}static getInstance(){return Oo.instance||(Oo.instance=new Oo),Oo.instance}createOrder(e,t){return i(this,void 0,void 0,(function*(){const n=o(this,mo,"f"),i=new URLSearchParams;i.append("amount",t.amount.toString()),i.append("item",encodeURIComponent(JSON.stringify(t.item))),i.append("appId",n),t.desc&&i.append("desc",encodeURIComponent(t.desc)),t.extradata&&i.append("extradata",encodeURIComponent(JSON.stringify(t.extradata))),t.method&&i.append("method",t.method);const r={headers:{"Content-Type":"application/x-www-form-urlencoded",authorization:"Bearer "}};try{const o=yield e.getAccessToken({fail:e=>{throw kn.loginRequired}});r.headers.authorization=`Bearer ${o}`;const a=yield fetch(On,Object.assign(Object.assign({method:"POST"},r),{body:i})),s=yield a.json();if(!s.data||0!==s.err)throw kn.badRequest(s.msg);const l=s.data.id,c=s.data.jwt,u=window.APP_VERSION,d=window.APP_ENV,p={miniAppId:n,orderId:l};c&&(p.token=c),u&&(p.version=u),d&&(p.env=d),t.method&&(p.method=t.method);const h=Rn.encode(p),v=new URL(`?${h}`,"https://payment-mini.zalo.me").toString();return yield e.openWebview({url:v,fail:e=>{throw e}}),{orderId:l}}catch(e){throw e}}))}checkTransaction(e,t){return i(this,void 0,void 0,(function*(){try{let n,{data:i}=t;if(i||(i=e.getRouteParams()),"object"==typeof i&&(n=i.appTransID||i.orderId||i.apptransid),"string"==typeof i){const e=Rn.getParameterByName("orderId",i),t=Rn.getParameterByName("appTransID",i)||Rn.getParameterByName("apptransid",i);n=e||t}const r={headers:{authorization:"Bearer "}},a=yield e.getAccessToken({fail:e=>{throw kn.loginRequired}});r.headers.authorization=`Bearer ${a}`;const s=new URL(Tn),l={transId:n||"",appId:o(this,mo,"f")};s.search=new URLSearchParams(l).toString();const c=yield fetch(s.toString(),r),u=yield c.json();if(!u.data||0!==u.err)throw kn.badRequest(u.msg);const d=u.data||{};return{msg:d.resultMessage,orderId:d.orderId,resultCode:d.resultCode,transTime:d.transTime,createdAt:d.createAt,transId:d.transId}}catch(e){throw e}}))}}mo=new WeakMap;class To{constructor(){go.set(this,Kt)}static getInstance(){return To.instance||(To.instance=new To),To.instance}createOrder(e,t){return Promise.resolve({orderId:""})}checkTransaction(e,t){const n={msg:"Success",orderId:"",resultCode:1,transTime:(new Date).getTime().toString(),createdAt:(new Date).getTime().toString(),transId:""};return Promise.resolve(n)}}go=new WeakMap;class bo{constructor(e){yo.set(this,void 0),_o.set(this,void 0),r(this,yo,this.getInstance(),"f"),r(this,_o,e,"f")}createOrder(e){return o(this,yo,"f").createOrder(o(this,_o,"f"),e)}checkTransaction(e){return o(this,yo,"f").checkTransaction(o(this,_o,"f"),e)}}yo=new WeakMap,_o=new WeakMap,t([Pn,vo,n(0,ho("object",{amount:Qn(["string","number"]),desc:Qn("string"),"method?":Qn("string",{values:["MOMO","ZALOPAY","MOMO_SANDBOX","ZALOPAY_SANDBOX","CC","CC_SANDBOX","ATM","ATM_SANDBOX"]})}))],bo.prototype,"createOrder",null),t([Pn,vo],bo.prototype,"checkTransaction",null);class wo extends bo{getInstance(){return Oo.getInstance()}}class No extends bo{getInstance(){return To.getInstance()}}const Po=Wn();e.default=void 0,window.onJSCall=e=>function(t){si.getInstance().onJSCall(e,t)},window.onMultiJSCall=e=>function(t){si.getInstance().onMultiJSCall(e,t)},window.zaloJSV2={zalo_h5_event_handler:function(e,t,n){si.getInstance().nativeEventHandler(e,t,n)}},e.Payment=void 0,Po.isZalo?(e.default=new So,e.Payment=new wo(e.default)):(e.default=new Ao,e.Payment=new No(e.default)),window.ZaloMiniAppSDK=e.default,e.SDKCreator=Eo,e.default=e.default,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
15
|
+
***************************************************************************** */function t(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a}function n(e,t){return function(n,i){t(n,i,e)}}function i(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))}function o(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function r(e,t,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(e,n):o?o.value=n:t.set(e,n),n}var a=Object.prototype;var s=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||a)};var l=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),c=Object.prototype.hasOwnProperty;var u=function(e){if(!s(e))return l(e);var t=[];for(var n in Object(e))c.call(e,n)&&"constructor"!=n&&t.push(n);return t},d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function p(e,t){return e(t={exports:{}},t.exports),t.exports}var h="object"==typeof d&&d&&d.Object===Object&&d,v="object"==typeof self&&self&&self.Object===Object&&self,f=h||v||Function("return this")(),m=f.Symbol,g=Object.prototype,y=g.hasOwnProperty,_=g.toString,E=m?m.toStringTag:void 0;var S=function(e){var t=y.call(e,E),n=e[E];try{e[E]=void 0;var i=!0}catch(e){}var o=_.call(e);return i&&(t?e[E]=n:delete e[E]),o},A=Object.prototype.toString;var O=function(e){return A.call(e)},T=m?m.toStringTag:void 0;var b=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":T&&T in Object(e)?S(e):O(e)};var w=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var N,P=function(e){if(!w(e))return!1;var t=b(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},I=f["__core-js_shared__"],C=(N=/[^.]+$/.exec(I&&I.keys&&I.keys.IE_PROTO||""))?"Symbol(src)_1."+N:"";var k=function(e){return!!C&&C in e},R=Function.prototype.toString;var B=function(e){if(null!=e){try{return R.call(e)}catch(e){}try{return e+""}catch(e){}}return""},D=/^\[object .+?Constructor\]$/,j=Function.prototype,M=Object.prototype,L=j.toString,U=M.hasOwnProperty,W=RegExp("^"+L.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var x=function(e){return!(!w(e)||k(e))&&(P(e)?W:D).test(B(e))};var z=function(e,t){return null==e?void 0:e[t]};var F=function(e,t){var n=z(e,t);return x(n)?n:void 0},G=F(f,"DataView"),H=F(f,"Map"),$=F(f,"Promise"),V=F(f,"Set"),Z=F(f,"WeakMap"),J="[object Map]",K="[object Promise]",q="[object Set]",Q="[object WeakMap]",Y="[object DataView]",X=B(G),ee=B(H),te=B($),ne=B(V),ie=B(Z),oe=b;(G&&oe(new G(new ArrayBuffer(1)))!=Y||H&&oe(new H)!=J||$&&oe($.resolve())!=K||V&&oe(new V)!=q||Z&&oe(new Z)!=Q)&&(oe=function(e){var t=b(e),n="[object Object]"==t?e.constructor:void 0,i=n?B(n):"";if(i)switch(i){case X:return Y;case ee:return J;case te:return K;case ne:return q;case ie:return Q}return t});var re=oe;var ae=function(e){return null!=e&&"object"==typeof e};var se=function(e){return ae(e)&&"[object Arguments]"==b(e)},le=Object.prototype,ce=le.hasOwnProperty,ue=le.propertyIsEnumerable,de=se(function(){return arguments}())?se:function(e){return ae(e)&&ce.call(e,"callee")&&!ue.call(e,"callee")},pe=Array.isArray;var he=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var ve=function(e){return null!=e&&he(e.length)&&!P(e)};var fe=function(){return!1},me=p((function(e,t){var n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,o=i&&i.exports===n?f.Buffer:void 0,r=(o?o.isBuffer:void 0)||fe;e.exports=r})),ge={};ge["[object Float32Array]"]=ge["[object Float64Array]"]=ge["[object Int8Array]"]=ge["[object Int16Array]"]=ge["[object Int32Array]"]=ge["[object Uint8Array]"]=ge["[object Uint8ClampedArray]"]=ge["[object Uint16Array]"]=ge["[object Uint32Array]"]=!0,ge["[object Arguments]"]=ge["[object Array]"]=ge["[object ArrayBuffer]"]=ge["[object Boolean]"]=ge["[object DataView]"]=ge["[object Date]"]=ge["[object Error]"]=ge["[object Function]"]=ge["[object Map]"]=ge["[object Number]"]=ge["[object Object]"]=ge["[object RegExp]"]=ge["[object Set]"]=ge["[object String]"]=ge["[object WeakMap]"]=!1;var ye=function(e){return ae(e)&&he(e.length)&&!!ge[b(e)]};var _e=function(e){return function(t){return e(t)}},Ee=p((function(e,t){var n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,o=i&&i.exports===n&&h.process,r=function(){try{var e=i&&i.require&&i.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=r})),Se=Ee&&Ee.isTypedArray,Ae=Se?_e(Se):ye,Oe=Object.prototype.hasOwnProperty;var Te=function(e){if(null==e)return!0;if(ve(e)&&(pe(e)||"string"==typeof e||"function"==typeof e.splice||me(e)||Ae(e)||de(e)))return!e.length;var t=re(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(s(e))return!u(e).length;for(var n in e)if(Oe.call(e,n))return!1;return!0};var be=function(e){return void 0===e};var we=function(e){return null===e};var Ne=function(e){return"string"==typeof e||!pe(e)&&ae(e)&&"[object String]"==b(e)};var Pe=function(e){return"number"==typeof e||ae(e)&&"[object Number]"==b(e)};var Ie=function(e){return ae(e)&&"[object RegExp]"==b(e)},Ce=Ee&&Ee.isRegExp,ke=Ce?_e(Ce):Ie;var Re=function(e){return"symbol"==typeof e||ae(e)&&"[object Symbol]"==b(e)},Be=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,De=/^\w*$/;var je=function(e,t){if(pe(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Re(e))||(De.test(e)||!Be.test(e)||null!=t&&e in Object(t))},Me=F(Object,"create");var Le=function(){this.__data__=Me?Me(null):{},this.size=0};var Ue=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},We=Object.prototype.hasOwnProperty;var xe=function(e){var t=this.__data__;if(Me){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return We.call(t,e)?t[e]:void 0},ze=Object.prototype.hasOwnProperty;var Fe=function(e){var t=this.__data__;return Me?void 0!==t[e]:ze.call(t,e)};var Ge=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Me&&void 0===t?"__lodash_hash_undefined__":t,this};function He(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}He.prototype.clear=Le,He.prototype.delete=Ue,He.prototype.get=xe,He.prototype.has=Fe,He.prototype.set=Ge;var $e=He;var Ve=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 n=e.length;n--;)if(Ze(e[n][0],t))return n;return-1},Ke=Array.prototype.splice;var qe=function(e){var t=this.__data__,n=Je(t,e);return!(n<0)&&(n==t.length-1?t.pop():Ke.call(t,n,1),--this.size,!0)};var Qe=function(e){var t=this.__data__,n=Je(t,e);return n<0?void 0:t[n][1]};var Ye=function(e){return Je(this.__data__,e)>-1};var Xe=function(e,t){var n=this.__data__,i=Je(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};function et(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}et.prototype.clear=Ve,et.prototype.delete=qe,et.prototype.get=Qe,et.prototype.has=Ye,et.prototype.set=Xe;var tt=et;var nt=function(){this.size=0,this.__data__={hash:new $e,map:new(H||tt),string:new $e}};var it=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var ot=function(e,t){var n=e.__data__;return it(t)?n["string"==typeof t?"string":"hash"]:n.map};var rt=function(e){var t=ot(this,e).delete(e);return this.size-=t?1:0,t};var at=function(e){return ot(this,e).get(e)};var st=function(e){return ot(this,e).has(e)};var lt=function(e,t){var n=ot(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};function ct(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}ct.prototype.clear=nt,ct.prototype.delete=rt,ct.prototype.get=at,ct.prototype.has=st,ct.prototype.set=lt;var ut=ct;function dt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var i=arguments,o=t?t.apply(this,i):i[0],r=n.cache;if(r.has(o))return r.get(o);var a=e.apply(this,i);return n.cache=r.set(o,a)||r,a};return n.cache=new(dt.Cache||ut),n}dt.Cache=ut;var pt=dt;var ht=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vt=/\\(\\)?/g,ft=function(e){var t=pt(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ht,(function(e,n,i,o){t.push(i?o.replace(vt,"$1"):n||e)})),t}));var mt=function(e,t){for(var n=-1,i=null==e?0:e.length,o=Array(i);++n<i;)o[n]=t(e[n],n,e);return o},gt=m?m.prototype:void 0,yt=gt?gt.toString:void 0;var _t=function e(t){if("string"==typeof t)return t;if(pe(t))return mt(t,e)+"";if(Re(t))return yt?yt.call(t):"";var n=t+"";return"0"==n&&1/t==-Infinity?"-0":n};var Et=function(e){return null==e?"":_t(e)};var St=function(e,t){return pe(e)?e:je(e,t)?[e]:ft(Et(e))};var At=function(e){if("string"==typeof e||Re(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var Ot=function(e,t){for(var n=0,i=(t=St(t,e)).length;null!=e&&n<i;)e=e[At(t[n++])];return n&&n==i?e:void 0};var Tt=function(e,t,n){var i=null==e?void 0:Ot(e,t);return void 0===i?n:i},bt=function(){try{var e=F(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var wt=function(e,t,n){"__proto__"==t&&bt?bt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Nt=Object.prototype.hasOwnProperty;var Pt=function(e,t,n){var i=e[t];Nt.call(e,t)&&Ze(i,n)&&(void 0!==n||t in e)||wt(e,t,n)},It=/^(?:0|[1-9]\d*)$/;var Ct=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&It.test(e))&&e>-1&&e%1==0&&e<t};var kt=function(e,t,n,i){if(!w(e))return e;for(var o=-1,r=(t=St(t,e)).length,a=r-1,s=e;null!=s&&++o<r;){var l=At(t[o]),c=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(o!=a){var u=s[l];void 0===(c=i?i(u,l,s):void 0)&&(c=w(u)?u:Ct(t[o+1])?[]:{})}Pt(s,l,c),s=s[l]}return e};var Rt,Bt,Dt,jt,Mt,Lt,Ut,Wt,xt,zt,Ft,Gt={isEmpty:Te,isNull:we,isUndefined:be,isFunction:P,isObject:w,isString:Ne,isNumber:Pe,isArray:pe,isRegExp:ke,get:Tt,set:function(e,t,n){return null==e?e:kt(e,t,n)}};function Ht(e){return"function"==typeof window.Debug?window.Debug(e):function(...e){process.env.NODE_ENV}}e.NetworkType=void 0,(Rt=e.NetworkType||(e.NetworkType={})).none="none",Rt.wifi="wifi",Rt.cellular="cellular",Rt.unknown="unknown",e.PlatformType=void 0,(Bt=e.PlatformType||(e.PlatformType={})).wp="wp",Bt.android="android",Bt.iOS="iOS",Bt.unknown="unknown",e.ProfileType=void 0,(Dt=e.ProfileType||(e.ProfileType={}))[Dt.user=1]="user",Dt[Dt.oa=0]="oa",Dt[Dt.aliasOA=2]="aliasOA",e.ChatType=void 0,(jt=e.ChatType||(e.ChatType={}))[jt.user=1]="user",jt[jt.oa=0]="oa",e.PostFeedType=void 0,(Mt=e.PostFeedType||(e.PostFeedType={}))[Mt.image=1]="image",Mt[Mt.link=4]="link",Mt[Mt.profile=5]="profile",e.ShareSheetType=void 0,(Lt=e.ShareSheetType||(e.ShareSheetType={}))[Lt.image=1]="image",Lt[Lt.gif=11]="gif",Lt[Lt.video=12]="video",Lt[Lt.link=4]="link",Lt[Lt.oa=5]="oa",Lt[Lt.zmp=20]="zmp",e.OrientationType=void 0,(Ut=e.OrientationType||(e.OrientationType={}))[Ut.auto=1]="auto",Ut[Ut.portrait=2]="portrait",Ut[Ut.landscape=3]="landscape",e.VibrateType=void 0,(Wt=e.VibrateType||(e.VibrateType={}))[Wt.oneShot=0]="oneShot",e.NativeCode=void 0,(xt=e.NativeCode||(e.NativeCode={}))[xt.token_invalid=-2]="token_invalid",xt[xt.not_permission=-1]="not_permission",xt[xt.client_not_support=-5]="client_not_support",xt[xt.decode_failed=-4]="decode_failed",e.Events=void 0,(zt=e.Events||(e.Events={})).AppPaused="h5.event.paused",zt.AppResumed="h5.event.resumed",zt.NetworkChanged="h5.event.connection.changed",zt.OnDataCallback="h5.event.webview.result",zt.OpenApp="h5.event.open.mp",e.MediaPickerType=void 0,(Ft=e.MediaPickerType||(e.MediaPickerType={}))[Ft.photo=4]="photo",Ft[Ft.video=5]="video",Ft[Ft.file=6]="file";const $t=e=>{const t=document.cookie;if(t){const o=t.split("; ");if(o&&o.length>0)for(var n=e.length+1,i=o.length-1;i>=0;i--){let t=o[i];if(t&&0===t.indexOf(e)&&(t=t.substring(n,t.length),t))return t=t.replace(/["']/g,""),t}}return null},Vt=e=>$t(`${window.location.host}_`+e),Zt=e=>$t((()=>{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),Jt=1048576,Kt=window.zAppID,qt=window.APP_ID,Qt=window.APP_CONFIG||{},Yt="h5.zdn.vn_zoauth",Xt="h5.zdn.vn_zlink3rd",en="h5.zdn.vn_zoauth_vrf",tn="https://graph.zalo.me/v2.0/me",nn="https://h5.zalo.me/openapi/access_token",on="https://oauth.zaloapp.com/v3/access_token",rn="https://graph.zalo.me/v2.0/me/friends/list",an=5*Jt,sn=e=>({NONE:e?-2:0,WIFI:e?0:1,"2G":2,"3G":e?15:2,"4G":e?13:2}),ln={GET_DOWNLOADED_STICKER:{name:"action.get.downloaded.sticker",have_callback:!0},OPEN_SHARE_STICKER:{name:"action.open.share.sticker"},OPEN_PROFILE:{name:"action.open.profile"},OPEN_FEED_DETAIL:{name:"action.open.feeddetail"},OPEN_FRIEND_RADA:{name:"action.open.friendrada"},OPEN_INAPP:{name:"action.open.inapp"},OPEN_OUTAPP:{name:"action.open.outapp"},OPEN_PAGE:{name:"action.open.page"},OPEN_PHOTODETAIL:{name:"action.open.photodetail"},OPEN_GALARY:{name:"action.open.galary"},OPEN_GAMECENTER:{name:"action.open.gamecenter"},OPEN_GAMENEWS:{name:"action.open.gamenews"},OPEN_TAB_CONTACT:{name:"action.open.tab.contact"},OPEN_TAB_SOCIAL:{name:"action.open.tab.social"},OPEN_FRIENDSUGGEST:{name:"action.open.friendsuggest"},OPEN_GROUPLIST:{name:"action.open.grouplist"},OPEN_NEARBY:{name:"action.open.nearby"},OPEN_ROOM:{name:"action.open.room"},OPEN_STICKERSTORE:{name:"action.open.stickerstore"},OPEN_CREATECHAT:{name:"action.open.createchat"},COPY_LINK_CATESTICKER:{name:"action.copy.link.catesticker"},REQUEST_BUY_STICKER:{name:"action.request.buy.sticker"},OPEN_CHAT:{name:"action.open.chat"},OPEN_TAB_CHAT:{name:"action.open.tab.chat"},OPEN_CHATGROUP:{name:"action.open.chatgroup"},OPEN_ADDFRIEND:{name:"action.open.addfriend"},OPEN_TAB_MORE:{name:"action.open.tab.more"},OPEN_POSTFEED:{name:"action.open.postfeed"},OPEN_LOGINDEVICES:{name:"action.open.logindevices"},OPEN_SENDSTICKER:{name:"action.open.sendsticker"},REPORT_ABUSE:{name:"action.report.abuse",have_callback:!0},FOLLOW_OA:{name:"action.follow.oa",have_callback:!0},UNFOLLOW_OA:{name:"action.unfollow.oa",have_callback:!0},OPEN_GAMEDETAIL:{name:"action.open.gamedetail"},OPEN_SHARESHEET:{name:"action.open.sharesheet",have_callback:!0},REQUEST_PERMISSION_CAMERA:{name:"action.request.permission.camera"},CHANGE_TITLE_HEADER:{name:"action.change.title.header",skip_jump:!0},WEBVIEW_CLEARCACHE:{name:"action.webview.clearcache"},WEBVIEW_CONFIRMCACHE:{name:"action.webview.confirmcache"},WEBVIEW_ISVISIBLE:{name:"action.webview.isvisible"},WEBVIEW_NETWORKTYPE:{name:"action.webview.networktype",skip_jump:!0},CHANGE_BUTTON_HEADER:{name:"action.change.button.header"},CREATE_OPTIONS_MENU:{name:"action.create.options.menu",skip_jump:!0,have_callback:!0},CREATE_SHORTCUT:{name:"action.create.shortcut"},CHANGE_ACTIONBAR_LEFTBUTTON_TYPE:{name:"action.change.actionbar.leftbutton.type",skip_jump:!0,have_callback:!0},WINDOW_CLOSE:{name:"action.window.close",skip_jump:!0,have_callback:!0},WEBVIEW_CHECKRESERROR:{name:"action.webview.checkResError"},IAP_REQUESTPAYMENT:{name:"action.iap.requestpayment"},ZBROWSER_GETSTATS:{name:"action.zbrowser.getstats"},ZBROWSER_JSBRIDGE:{name:"action.zbrowser.jsbridge",skip_jump:!0,have_callback:!0},PROMPT_AUTHENTICATION:{name:"action.prompt.authentication"},CHANGE_ACTIONBAR_COLOR:{name:"action.change.actionbar.color",skip_jump:!0},PROMPT_AUTHENTICATION_CHECK_STATE:{name:"action.prompt.authentication.check_state"},OPEN_APPSTORE:{name:"action.open.appstore"},GET_LOCATION:{name:"action.get.location",have_callback:!0},QUERY_LOCATION_HIDE:{name:"action.query.location.hide",have_callback:!0},SHOW_TOAST:{name:"action.show.toast",have_callback:!0},OPEN_APP:{name:"action.open.app"},HIDE_KEYBOARD:{name:"action.hide.keyboard"},OPEN_PHONE:{name:"action.open.phone"},OPEN_QR:{name:"action.open.qr"},OPEN_SMS:{name:"action.open.sms"},VIEW_MYQR:{name:"action.view.myqr",have_callback:!0},KEEP_SCREEN:{name:"action.keep.screen",have_callback:!0},CHANGE_AUTOROTATE:{name:"action.change.autorotate",skip_jump:!0},CHECK_APP_INSTALLED:{name:"action.check.app.installed"},QUERY_SHOW:{name:"action.query.show"},QUERY_HIDE:{name:"action.query.hide"},OPEN_INAPPRW:{name:"action.open.inapprw"},ZALORUN_GETTRACKINGSTATUS:{name:"action.zalorun.getTrackingStatus",have_callback:!0},ZALORUN_SETTRACKINGSTATUS:{name:"action.zalorun.setTrackingStatus",have_callback:!0},ZALORUN_GETDAYSTEP:{name:"action.zalorun.getDayStep",have_callback:!0},ZALORUN_FORCESUBMITDATA:{name:"action.zalorun.forceSubmitData",have_callback:!0},ZALORUN_SETWEIGHT:{name:"action.zalorun.setWeight",have_callback:!0},OPEN_PROFILE_EXT:{name:"action.open.profile.ext"},DOWNLOAD_CATE:{name:"action.download.cate",have_callback:!0},JUMP_LOGIN:{name:"action.jump.login",skip_jump:!0,white_list:!0},OPEN_ADTIMA_ADS_INTERSTITIAL:{name:"action.open.adtima.ads.interstitial"},OPEN_ADTIMA_ADS:{name:"action.open.adtima.ads"},GET_ADIDCLIENT:{name:"action.get.adidclient"},SCAN_IBEACON:{name:"action.scan.ibeacon"},INTERACTIVE_VIBRATION:{name:"action.interactive.vibration"},SAVE_IMAGE_GALLERY:{name:"action.save.image.gallery",version_live:{iOS:408}},OPEN_MP:{name:"action.open.mp",version_live:{iOS:402}},CHANGE_ACTIONBAR:{name:"action.change.actionbar",version_live:{iOS:402},skip_jump:!0},ZBROWSER_MPDS:{name:"action.zbrowser.mpds",version_live:{iOS:402}},WEBVIEW_SET_RESULT:{name:"action.webview.set.result",version_live:{iOS:416}},MP_GET_NUMBER:{name:"action.mp.get.number",version_live:{iOS:416}},MP_OPEN_PROFILE_PICKER:{name:"action.mp.open.profile.picker",version_live:{iOS:432}},GET_SUPPORTED_ACTIONS:{name:"action.get.supported.actions",white_list:!0},MP_JOIN_WIFI:{name:"action.mp.join.wifi",version_live:{android:0,iOS:999},have_permission:!1,white_list:!1},PICK_MEDIA:{name:"action.pick.media",version_live:{iOS:440}},MP_CLOSE_LOADINGVIEW:{name:"action.mp.close.loadingview"}},cn=0,un=-1400,dn=-1500,pn=-1401,hn=-1403,vn=-1404,fn={SUCCESS:"Success",READ_MORE:"Read more at: https://miniapp.zalo.me/docs/api",LOGIN_REQUIRED:"Please login before to call this api. Read more at: https://miniapp.zalo.me/docs/api/login",LOGIN_FAILED:"Login failed.",NOT_PERMISSION:"You don't have permission to call this api",CLIENT_NOT_SUPPORT:"This API is not supported in this Zalo version",DECODE_FAILED:"Can not decode your data. Read more at: https://miniapp.zalo.me/docs/api/error"},mn="apps/get-info",gn={android:12100571,iOS:400,wp:0,unknown:0},yn=[ln.GET_DOWNLOADED_STICKER.name,ln.OPEN_SHARE_STICKER.name,ln.OPEN_PROFILE.name,ln.OPEN_FEED_DETAIL.name,ln.OPEN_FRIEND_RADA.name,ln.OPEN_INAPP.name,ln.OPEN_OUTAPP.name,ln.OPEN_PAGE.name,ln.OPEN_PHOTODETAIL.name,ln.OPEN_GALARY.name,ln.OPEN_GAMECENTER.name,ln.OPEN_GAMENEWS.name,ln.OPEN_TAB_CONTACT.name,ln.OPEN_TAB_SOCIAL.name,ln.OPEN_FRIENDSUGGEST.name,ln.OPEN_GROUPLIST.name,ln.OPEN_NEARBY.name,ln.OPEN_ROOM.name,ln.OPEN_STICKERSTORE.name,ln.OPEN_CREATECHAT.name,ln.COPY_LINK_CATESTICKER.name,ln.REQUEST_BUY_STICKER.name,ln.OPEN_CHAT.name,ln.OPEN_TAB_CHAT.name,ln.OPEN_CHATGROUP.name,ln.OPEN_ADDFRIEND.name,ln.OPEN_TAB_MORE.name,ln.OPEN_POSTFEED.name,ln.OPEN_LOGINDEVICES.name,ln.OPEN_SENDSTICKER.name,ln.REPORT_ABUSE.name,ln.FOLLOW_OA.name,ln.UNFOLLOW_OA.name,ln.OPEN_GAMEDETAIL.name,ln.OPEN_SHARESHEET.name,ln.REQUEST_PERMISSION_CAMERA.name,ln.CHANGE_TITLE_HEADER.name,ln.WEBVIEW_CLEARCACHE.name,ln.WEBVIEW_CONFIRMCACHE.name,ln.WEBVIEW_ISVISIBLE.name,ln.WEBVIEW_NETWORKTYPE.name,ln.CHANGE_BUTTON_HEADER.name,ln.CREATE_OPTIONS_MENU.name,ln.CREATE_SHORTCUT.name,ln.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE.name,ln.WINDOW_CLOSE.name,ln.WEBVIEW_CHECKRESERROR.name,ln.IAP_REQUESTPAYMENT.name,ln.ZBROWSER_GETSTATS.name,ln.ZBROWSER_JSBRIDGE.name,ln.PROMPT_AUTHENTICATION.name,ln.CHANGE_ACTIONBAR_COLOR.name,ln.PROMPT_AUTHENTICATION_CHECK_STATE.name,ln.OPEN_APPSTORE.name,ln.GET_LOCATION.name,ln.QUERY_LOCATION_HIDE.name,ln.SHOW_TOAST.name,ln.OPEN_APP.name,ln.HIDE_KEYBOARD.name,ln.OPEN_PHONE.name,ln.OPEN_QR.name,ln.OPEN_SMS.name,ln.VIEW_MYQR.name,ln.KEEP_SCREEN.name,ln.CHANGE_AUTOROTATE.name,ln.CHECK_APP_INSTALLED.name,ln.QUERY_SHOW.name,ln.QUERY_HIDE.name,ln.OPEN_INAPPRW.name,ln.ZALORUN_GETTRACKINGSTATUS.name,ln.ZALORUN_SETTRACKINGSTATUS.name,ln.ZALORUN_GETDAYSTEP.name,ln.ZALORUN_FORCESUBMITDATA.name,ln.ZALORUN_SETWEIGHT.name,ln.OPEN_PROFILE_EXT.name,ln.DOWNLOAD_CATE.name,ln.JUMP_LOGIN.name,ln.OPEN_ADTIMA_ADS_INTERSTITIAL.name,ln.OPEN_ADTIMA_ADS.name,ln.GET_ADIDCLIENT.name,ln.SCAN_IBEACON.name,ln.SAVE_IMAGE_GALLERY.name,ln.OPEN_MP.name,ln.CHANGE_ACTIONBAR.name,ln.INTERACTIVE_VIBRATION.name,ln.ZBROWSER_MPDS.name],_n=0,En=3,Sn=1,An=0,On="https://payment-mini.zalo.me/api/order/create",Tn="https://payment-mini.zalo.me/api/transaction";class bn{constructor(e,t,n){this.code=e,this.message=t,this.api=n}toString(){return`api: ${this.api}; code: ${this.code}; message: ${this.message}`}}class wn extends bn{constructor(e,t){super(e,t),this.message=`${t}. ${fn.READ_MORE}`,this.handler()}handler(){switch(this.code){case e.NativeCode.token_invalid:this.code=pn,this.message=fn.LOGIN_REQUIRED;break;case e.NativeCode.not_permission:this.code=hn,this.message=fn.NOT_PERMISSION;break;case e.NativeCode.client_not_support:this.code=vn,this.message=fn.CLIENT_NOT_SUPPORT;break;case e.NativeCode.decode_failed:this.message=fn.DECODE_FAILED}}}const Nn={handler:null,setHandler(e){this.handler=e}};Nn.setHandler(((e,t)=>t instanceof bn?(t.api=e,t):new bn(-2001,Gt.isNull(t.message)?"Unknown Error":t.message,e)));const Pn=(e,t,n)=>{const o=n.value;return n.value=function(...e){return i(this,void 0,void 0,(function*(){const{success:n,fail:r}=Array.isArray(e)&&e.length>0&&e[0];return new Promise(((a,s)=>i(this,void 0,void 0,(function*(){try{const t=yield o.apply(this,e);!Gt.isNull(n)&&Gt.isFunction(n)?n.call(null,t,this):a(t)}catch(e){if("login"!==(null==e?void 0:e.api)&&((null==e?void 0:e.code)===pn||(null==e?void 0:e.code)===hn)){let t=!1;this instanceof Eo&&(t=this.getLoginStatus()),t||(e=new bn(pn,fn.LOGIN_REQUIRED))}const{handler:n}=Nn,i=n.call(null,t,e,this);window.zmpSentry&&window.zmpSentry.throwError(i.toString()),!Gt.isNull(r)&&Gt.isFunction(r)?r.call(null,i,this):s(i)}}))))}))},n},In=(e,t,n)=>{const i=n.value;return n.value=function(...e){try{return i.apply(this,e)}catch(e){if("login"!==(null==e?void 0:e.api)&&((null==e?void 0:e.code)===pn||(null==e?void 0:e.code)===hn)){let t=!1;this instanceof Eo&&(t=this.getLoginStatus()),t||(e=new bn(pn,fn.LOGIN_REQUIRED))}const{handler:n}=Nn,i=n.call(null,t,e,this);throw window.zmpSentry&&window.zmpSentry.throwError(i.toString()),i}},n},Cn=(e,t)=>({code:cn,message:t||fn.SUCCESS,data:e||{}}),kn={badRequest:e=>new bn(un,e),loginFailed:()=>new bn(un,fn.LOGIN_FAILED),loginRequired:()=>new bn(pn,fn.LOGIN_REQUIRED),missingParam:e=>new bn(un,`Missing required argument: ${e}`),wrongTypeParam:(e,t,n)=>new bn(un,`Wrong type of parameter '${e}'. Expected ${t}, but got ${n}`),cannotGetShareInfo:()=>new bn(dn,"Can not get app info to share"),lengthInvalid:e=>new bn(un,`${e} length is invalid.`)};const Rn={encode:function(e){var t=[];for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];if(void 0===i)return;if(null===i)return void t.push(n);t.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}return t.join("&")},decode:function(e,t){var n={};if(""===e)return n;for(var i=e.split("&"),o=0;o<i.length;o++){var r=i[o].split("=",2),a=decodeURIComponent(r[0]);if(t&&Object.prototype.hasOwnProperty.call(n,a))throw new URIError("Duplicate key: "+a);n[a]=2===r.length?decodeURIComponent(r[1]):null}return n},appendToUrl:function(e,t){return e+(-1!==e.indexOf("?")?"&":"?")+("string"==typeof t?t:Rn.encode(t))},getParameterByName:function(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");var n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return n?n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"":null},getParamsAsObject:function(e){var t={};return e?(e.split("&").map((function(e){var n=e.split("=");n&&2==n.length&&(t[n[0]]=decodeURIComponent(n[1].replace(/\+/g," ")))})),t):t},toQueryString:function(e){if(!e)return"";if("object"!=(void 0===e?"undefined":typeof e))return e;var t=Object.keys(e),n=[];return t.map((function(t){var i=e[t],o=[t,i="object"==(void 0===i?"undefined":typeof i)?JSON.stringify(i):encodeURIComponent(i)].join("=");n.push(o)})),n.join("&")}},Bn=new RegExp("[\\u0300-\\u036f]","g"),Dn=new RegExp("[đ|Đ]","g"),jn=new RegExp("\\s","g"),Mn=Ht("zmp:utils:common"),Ln=e=>{try{new URL(e)}catch(e){return!1}return!0},Un=()=>navigator.userAgent||navigator.vendor||window.opera,Wn=()=>{const e=Un().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)}},xn=e=>{const t=document.getElementsByTagName("meta");for(let n=0;n<t.length;n++)if(t[n].getAttribute("name")===e||t[n].getAttribute("property")===e)return t[n].getAttribute("content");return""},zn=()=>{const e=Un().toLowerCase().split("zalo")[1];if(e){return e.replace(" ","").split("/")[1]||""}return""},Fn=()=>{let t=Wn();return t.isWP?e.PlatformType.wp:t.isAndroid?e.PlatformType.android:t.isIOS?e.PlatformType.iOS:e.PlatformType.unknown},Gn=(e,t)=>{const n=t.toLowerCase(),i=n.split(/[<>]/i),o="array"===i[0];return!!("url"===n&&Ln(e)||o&&("array"===n&&Array.isArray(e)||((e,t)=>Array.isArray(t)&&!t.some((t=>"url"===e?!Ln(t):typeof t!==e)))(i[1],e))||!Array.isArray(e)&&typeof e===t)},Hn=e=>(e=>{let t=Vt(e);return t||(t=Zt(e),t)?t:$t(e)})(e),$n=e=>{if(Gt.isObject(JSON)&&JSON.parse&&Gt.isString(e)){const t=e.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");return JSON.parse(t,((e,t)=>t))}return Gt.isObject(e)?e:new Function("return "+e)()},Vn=e=>{if(Gt.isObject(JSON)&&JSON.stringify)return JSON.stringify(e);if(void 0===e)return"undefined";if(null===e)return"null";try{if("string"==typeof e||null!==e.constructor.toString().match(/string/i))return'"'+e.replace(/"/g,'\\"')+'"'}catch(e){console.log(e)}var t;if(null!==Object.prototype.toString.call(e).match(/array/i)){t=new Array;for(var n=e.length,i=0;i<n;i++)t.push(Vn(e[i]));return"["+t.join(",")+"]"}if("object"==typeof e){for(var o in t=new Array,e)t.push('"'+o+'":'+Vn(e[o]));return"{"+t.join(",")+"}"}return e.toString()},Zn=()=>{try{const e=Number(zn()),t=Fn();return e>=gn[t]}catch(e){return!0}},Jn=e=>JSON.stringify(e).replace(/"/g,'\\"').replace(/'/g,"'"),Kn=e=>{try{if(e){Mn(e);const t=e.replace(/\\/g,"").replace(/'/g,"'");return Mn("formattedValue",t,JSON.parse(t),typeof JSON.parse(t)),JSON.parse(t)}return null}catch(t){return Mn("parse json error:",t),e}},qn=(e,t,n,o,r,a)=>i(void 0,void 0,void 0,(function*(){const i=new URL(location.href),s=new URLSearchParams;let l=`${i.pathname}${i.search}`;a&&(l=`/zapps/${e}${"/"===a[0]?"":"/"}${a}`);const c=new URL(`https://zalo.me/app/link${l}`);s.append("title",n),s.append("description",o||""),s.append("thumbnail",r),s.append("url",c.href),s.append("accessToken",t||"");const u=yield fetch("https://h5.zalo.me/openapi/create-sharelink",Object.assign({method:"POST",body:s},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})),d=yield u.json();if(!d||0!==d.err)throw kn.cannotGetShareInfo();return c.search=`${c.search}&zshareId=${d.data.shareId}`,Object.assign(Object.assign({},d.data),{shareableLink:c.href})})),Qn=(e,t)=>n=>{if(!(Array.isArray(e)?e.some((e=>Gn(n,e))):Gn(n,e)))return{error:!0,errorMessage:e};if(t){if(Array.isArray(null==t?void 0:t.values))return{error:!(null==t?void 0:t.values.includes(n)),errorMessage:null==t?void 0:t.values.toString()};if(Gt.isNumber(null==t?void 0:t.maxLength))return{error:Gt.isString(n)&&n.length>(null==t?void 0:t.maxLength),errorMessage:`data length must <= ${null==t?void 0:t.maxLength}`};if(Gt.isNumber(null==t?void 0:t.min)&&Gt.isNumber(null==t?void 0:t.max))return{error:n<(null==t?void 0:t.min)||n>(null==t?void 0:t.max),errorMessage:`data must be in between ${null==t?void 0:t.min} and ${null==t?void 0:t.max}`};if(Gt.isNumber(null==t?void 0:t.min))return{error:n<(null==t?void 0:t.min),errorMessage:`data must >= ${null==t?void 0:t.min}`};if(Gt.isNumber(null==t?void 0:t.max))return{error:n>(null==t?void 0:t.max),errorMessage:`data must <= ${null==t?void 0:t.max}`};if(Gt.isRegExp(null==t?void 0:t.regex))return{error:!t.regex.test(n),errorMessage:"data must valid"}}return{error:!1}},Yn=(e,t,n)=>i(void 0,void 0,void 0,(function*(){const i={appId:e,versionStatus:t};Gt.isUndefined(n)||(i.currentVersion=n);const o=Rn.appendToUrl(`https://h5.zalo.me/${mn}`,i),r=yield fetch(o,{credentials:"include"});if(r.ok){const e=yield r.json();if(e.err<0||!e.data)throw new Error(e);return{name:e.data.name,version:e.data.version,description:e.data.description,appUrl:e.data.appUrl,qrCodeUrl:e.data.qrCodeUrl,logoUrl:e.data.logoUrl}}throw new Error("Can't get app info")}));var Xn=p((function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function r(e,t,i,r,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new o(i,r||e,a),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],s]:e._events[l].push(s):(e._events[l]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,i,o=[];if(0===this._eventsCount)return o;for(i in e=this._events)t.call(e,i)&&o.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},s.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var o=0,r=i.length,a=new Array(r);o<r;o++)a[o]=i[o].fn;return a},s.prototype.listenerCount=function(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},s.prototype.emit=function(e,t,i,o,r,a){var s=n?n+e:e;if(!this._events[s])return!1;var l,c,u=this._events[s],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,i),!0;case 4:return u.fn.call(u.context,t,i,o),!0;case 5:return u.fn.call(u.context,t,i,o,r),!0;case 6:return u.fn.call(u.context,t,i,o,r,a),!0}for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var p,h=u.length;for(c=0;c<h;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,i);break;case 4:u[c].fn.call(u[c].context,t,i,o);break;default:if(!l)for(p=1,l=new Array(d-1);p<d;p++)l[p-1]=arguments[p];u[c].fn.apply(u[c].context,l)}}return!0},s.prototype.on=function(e,t,n){return r(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return r(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,i,o){var r=n?n+e:e;if(!this._events[r])return this;if(!t)return a(this,r),this;var s=this._events[r];if(s.fn)s.fn!==t||o&&!s.once||i&&s.context!==i||a(this,r);else{for(var l=0,c=[],u=s.length;l<u;l++)(s[l].fn!==t||o&&!s[l].once||i&&s[l].context!==i)&&c.push(s[l]);c.length?this._events[r]=1===c.length?c[0]:c:a(this,r)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new i,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s}));class ei extends Xn{constructor(){super(),this.debug=Ht("zmp:event-emitter")}static getInstance(){return ei.instance||(ei.instance=new ei),ei.instance}h5ConfirmHandleEvent(e,t,n){ZaloJavaScriptInterface.jsH5EventCallback(e,t,n||"")}on(e,t,n){this.debug(`register ${e}: ${n}`);return super.on(e,((i,o)=>{this.h5ConfirmHandleEvent(i,e,n),t(o)}),n)}once(e,t,n){this.debug(`register once ${e}: ${n}`);return super.once(e,((i,o)=>{this.h5ConfirmHandleEvent(i,e,n),t(o)}),n)}}var ti={},ni=function(e,t,n){var i=t||"default";return function(){var t=i in ti?ti[i](e,n):e;return t.apply(this,arguments)}};ni.setWrapper=function(e){var t=arguments.length<=1||void 0===arguments[1]?"default":arguments[1];ti[t]=e};var ii={error:{code:1,error_subcode:1357046,message:"Received Invalid JSON reply.",type:"http"}};function oi(e){try{return null===e?ii:JSON.parse(e)}catch(e){return ii}}var ri,ai={execute:function(e,t,n,i){n.suppress_http_code=1;var o=Rn.encode(n);"post"!=t&&(e=Rn.appendToUrl(e,o),o="");var r=function(e,t){if(!self.XMLHttpRequest)return null;var n=new XMLHttpRequest,i=function(){};if(!("withCredentials"in n))return null;n.open(e,t,!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded");var o={send:function(e){n.send(e)}},r=ni((function(){r=i,"onload"in o&&o.onload(n)}),"entry","XMLHttpRequest:load"),a=ni((function(){a=i,"onerror"in o&&o.onerror(n)}),"entry","XMLHttpRequest:error");return n.onload=function(){r()},n.onerror=function(){a()},n.onreadystatechange=function(){4==n.readyState&&(200==n.status?r():a())},o}(t,e);return!!r&&(r.onload=function(e){i(oi(e.responseText))},r.onerror=function(e){e.responseText?i(oi(e.responseText)):i({error:{code:1,error_subcode:1357045,message:"unknown error (empty response)",status:e.status,type:"http"}})},r.send(o),!0)}};class si extends Xn{constructor(){super(),this.debug=Ht("zmp:ZaloJSBridge"),this.events=ei.getInstance(),this._accessTk=Hn("zacc_session")||"DEFAULT_ACCESS_TOKEN",this._jsAccessTk=Hn("zlink3rd")||"DEFAULT_JS_TOKEN",this.results=[],this._userAgent=Un(),this._device=Wn(),this._jsCallFuncCallbacks={},this.events.on(e.Events.AppPaused,(()=>{if(this.results.length>0){let e=this.results;this.results=[];try{this.sendLogData(e)}catch(e){}}})),this.sendLogTimer?clearInterval(this.sendLogTimer):this.sendLogTimer=setInterval((()=>{if(this.results.length>0){let e=this.results;this.results=[];try{this.sendLogData(e)}catch(e){}}}),5e3)}static getInstance(){return si.instance||(si.instance=new si),si.instance}set accessTk(e){this._accessTk=e}set jsAccessTk(e){this._jsAccessTk=e}sendLogData(e){try{ai.execute("https://h5.zalo.me/log/async","post",{appId:window.APP_ID,data:JSON.stringify(e)},(e=>{}))}catch(e){}}onJSCall(e,t){try{this.debug("onJSCall",e,t);const n=$n(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,i=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,n)}catch(e){console.error("Call callback error",e)}i&&clearTimeout(i),this._jsCallFuncCallbacks[e]=null,delete this._jsCallFuncCallbacks[e]}}this.results.push({action:n.action,error:n.error_code})}catch(e){console.log("onJSCall","error",e)}}onMultiJSCall(e,t){try{this.debug("onMultiJSCall",e,t);const n=$n(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,i=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,n)}catch(e){console.error("Call callback error",e)}i&&clearTimeout(i)}}this.results.push({action:n.action,error:n.error_code})}catch(e){console.log("onMultiJSCall","error",e)}}nativeEventHandler(e,t,n){this.debug(`eventId: ${e}, eventName: ${t}, eventData: ${n}`);const i=Kn(n);this.debug(i);const o=this.handleEventData(t,i);this.events.emit(t,e,o)}handleEventData(t,n){try{switch(t){case e.Events.OpenApp:const{url:t}=n,i=new URL(t),o=i.pathname.split(`/zapps/${qt}`)[1];return{path:`${o||"/"}${i.search}`};default:return n}}catch(e){return n}}defaultCallback(e){null!=e&&(e=$n(e))}jsCall(e,t,n,i=!1,o=3,r=!0){try{const a=e.name,s=((e="")=>`${e.normalize("NFD").replace(Bn,"").replace(Dn,"d").replace(jn,"").toLowerCase()}_${Math.random().toString(36).substr(2,4)}`)(a);if(!this._device.isMobile||Gt.isEmpty(a))return this.onJSCall(s,{error_code:-13,error_message:"params invalid!",data:{device:this._device.isMobile,jsToken:this._jsAccessTk,access_token:this._accessTk},action:a}),!1;null==t&&(t={}),n||(n=this.defaultCallback);const l={error_code:-14,error_message:"Request Timeout!",data:{},action:a};this._jsCallFuncCallbacks[s]={timeout:r&&e.have_callback&&setTimeout((()=>{this.onJSCall(s,l)}),8e3),callback:n};try{return t=Vn(t),i?this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,window.onMultiJSCall(s)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,`window.onMultiJSCall('${s}')`):this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,window.onJSCall(s)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,`window.onJSCall('${s}')`)}catch(r){if(!(o-- >0)){const e={error_code:-5,error_message:"Not ready!",data:{userAgent:this._userAgent,options:t,jsToken:this._jsAccessTk,access_token:this._accessTk},action:a,js_error:r};return this.onJSCall(s,e),!1}setTimeout((()=>{this.jsCall(e,t,n,i,o)}),500)}}catch(e){console.log("jsCall","error",e)}return!1}}class li{constructor(){this.debug=Ht("zmp:ZJSBridgeProvider"),ri.set(this,void 0),r(this,ri,si.getInstance(),"f")}setZAccSession(e){o(this,ri,"f").accessTk=e}setJSToken(e){o(this,ri,"f").jsAccessTk=e}callNative(e,t,n){return this.debug(e.name,t),new Promise(((r,a)=>{const s=o=>i(this,void 0,void 0,(function*(){try{const i=new wn(o.error_code,`${o.action}: ${o.error_message}`);if(null==n?void 0:n.callback){const e=yield n.callback(o,i);return r(e)}if(o&&o.error_code>=0)r(o.data||{});else if(o&&o.error_code<0){try{window.zmpSentry&&window.zmpSentry.captureMessage(`${e.name}: call native fail`,{extra:{data:t,rs:o}})}catch(e){}return a(i)}}catch(e){return a(e)}})),l=Wn().isIOS,c=(e=>{var t;const n=zn(),i=(null===(t=null==e?void 0:e.version_live)||void 0===t?void 0:t.iOS)||0;return!!(Array.isArray(window.ignoreCheckSupport)&&window.ignoreCheckSupport.length>0&&window.ignoreCheckSupport.includes(e.name))||n>=i})(e);if(l&&!c){const t=new wn(-5,`${e}: Client isn't support this action`);return a(t)}(null==n?void 0:n.delay)?setTimeout((()=>{o(this,ri,"f").jsCall(e,t,s,null==n?void 0:n.isMultiCallback,null==n?void 0:n.nRetry,null==n?void 0:n.haveTimeout)}),n.delay):o(this,ri,"f").jsCall(e,t,s,null==n?void 0:n.isMultiCallback,null==n?void 0:n.nRetry,null==n?void 0:n.haveTimeout)}))}}ri=new WeakMap;var ci,ui,di,pi,hi,vi="2.19.1";class fi{static getVersion(){return vi}static getSystemInfo(){return{version:xn("version-id")||"",apiVersion:vi,zaloVersion:zn(),platform:Fn(),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 Yn(e,0,t.version)}))}}class mi{static setNavigationBarTitle(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.CHANGE_TITLE_HEADER,{title:e.title},{haveTimeout:!1})}))}static setNavigationBarColor(e){return i(this,void 0,void 0,(function*(){const t={};let n;Gt.isEmpty(e.textColor)||(t.textColor=e.textColor),Gt.isString(e.color)&&e.color.length>0?(Gt.isEmpty(e.color)||(t.backgroundColor=e.color),n=5):(Gt.isEmpty(e.statusBarColor)||(t.backgroundColor=e.statusBarColor),n=6),this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{actionbarType:n,dataConfig:Object.assign(Object.assign({},e.dataConfig),t)}))),yield this.callNative(ln.CHANGE_ACTIONBAR,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarLeftButton(e){return i(this,void 0,void 0,(function*(){const t="none"===e.type||"home"===e.type?En:_n,n="home"===e.type||"both"===e.type?Sn:An;this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{buttonType:t,dataConfig:Object.assign(Object.assign({},e.dataConfig),{viewInLeftType:t}),homeConfig:Object.assign(Object.assign({},e.homeConfig),{enable:n})}))),yield this.callNative(ln.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarRightButton(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.CREATE_OPTIONS_MENU,{supportToolBar:e.supportToolBar,reset:e.reset,menuListItems:e.menuListItems,zapp:this.getAppId()})}))}}class gi{static setBackgroundColor(e){return i(this,void 0,void 0,(function*(){Gt.isString(e.backgroundColor)&&e.backgroundColor.length>0&&(yield this.callNative(ln.CHANGE_ACTIONBAR,{actionbarType:this.isShowNavBar?5:6,dataConfig:{backgroundColor:e.backgroundColor,textColor:e.textColor}}))}))}}class yi{constructor(e,t,n,i){this.title=i,this.severity=t;const o=new Date;if(this.time=o.toLocaleTimeString(),this.content=e,n>0){const e=(new Error).stack;this.stack=e?e.replace("Error\n",""):""}}toString(){return(this.content.stack?[this.title,this.severity.toUpperCase(),this.time,this.content,this.content.stack.replace("Error:","")]:[this.title,this.severity.toUpperCase(),this.time,JSON.stringify(this.content),this.stack]).join(" ")}}ci=new WeakMap,ui=new WeakMap,di=new WeakMap,pi=new WeakMap,hi=new WeakMap;const _i=new class{constructor(){ci.set(this,3),ui.set(this,["none","error","warn","info"]),di.set(this,"[zmp] > "),pi.set(this,{error:0,warn:0,info:0,firstError:null,lastError:null}),hi.set(this,((e,t,n)=>{o(this,pi,"f")[o(this,ui,"f")[e]]++;const i=o(this,ui,"f")[e];if(r(this,di,o(this,di,"f")+("string"!=typeof t?new yi(t,i,e,n).toString():t),"f"),!(e>o(this,ci,"f")))switch(e){case 1:console.error(o(this,di,"f"));break;case 2:console.warn(o(this,di,"f"));break;case 3:console.info(o(this,di,"f"));break;default:throw new Error("internal")}}))}setLogLevel(e){r(this,ci,e,"f")}info(e){o(this,hi,"f").call(this,3,e)}warn(e,t){o(this,hi,"f").call(this,2,e,t)}error(e,t){o(this,hi,"f").call(this,1,e,t)}getMetrics(){return o(this,pi,"f")}};class Ei{static setDeviceOrientation(t){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.CHANGE_AUTOROTATE,{autoRotate:e.OrientationType[t.rotate]})}))}static getNetworkType(t){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.WEBVIEW_NETWORKTYPE,{url:window.location.href,featureId:""}).then((t=>{const n=t.network;let i;const o=Wn().isAndroid;switch(n){case sn(o).NONE:i=e.NetworkType.none;break;case sn(o).WIFI:i=e.NetworkType.wifi;break;case sn(o)["2G"]:case sn(o)["3G"]:case sn(o)["4G"]:i=e.NetworkType.cellular;break;default:i=e.NetworkType.unknown}return{networkType:i}}))}))}static onNetworkStatusChange(t){return i(this,void 0,void 0,(function*(){yield this.events.on(e.Events.NetworkChanged,(e=>{const n=e&&e.state;this.getNetworkType().then((e=>{const i={isConnected:"CONNECTED"===n,networkType:e&&e.networkType};t(i)})).catch((e=>{_i.error(e,"onNetworkStatusChange")}))}))}))}static startBeaconDiscovery(e){var t,n,o,r,a;return i(this,void 0,void 0,(function*(){const i={subaction:0,scanning_type:Gt.isNumber(null==e?void 0:e.scanningType)?e.scanningType:0,data:{scan_from_source:Gt.isString(null==e?void 0:e.scanFromSource)?e.scanFromSource:"",expire:Gt.isNumber(null==e?void 0:e.expire)?e.expire:3e3,monitor_interval:Gt.isNumber(null==e?void 0:e.monitorInterval)?e.monitorInterval:60,domain:Gt.isString(null==e?void 0:e.domain)?e.domain:"",scan_config:{scan_time:Gt.isNumber(null===(t=null==e?void 0:e.scanConfig)||void 0===t?void 0:t.scanTime)?e.scanConfig.scanTime:15e3,time_between_scan:Gt.isNumber(null===(n=null==e?void 0:e.scanConfig)||void 0===n?void 0:n.timeBetweenScan)?e.scanConfig.timeBetweenScan:1e4,beacon_timeout:Gt.isNumber(null===(o=null==e?void 0:e.scanConfig)||void 0===o?void 0:o.beaconTimeout)?e.scanConfig.beaconTimeout:3e4,delayCheckConnectedTimeout:Gt.isNumber(null===(r=null==e?void 0:e.scanConfig)||void 0===r?void 0:r.delayCheckConnectedTimeout)?e.scanConfig.delayCheckConnectedTimeout:5e3,beaconConnectedTimeout:Gt.isNumber(null===(a=null==e?void 0:e.scanConfig)||void 0===a?void 0:a.beaconConnectedTimeout)?e.scanConfig.beaconConnectedTimeout:6e5},items:Array.isArray(null==e?void 0:e.items)?null==e?void 0:e.items:[]}};return yield this.callNative(ln.SCAN_IBEACON,Object.assign({},i)),!0}))}static stopBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.SCAN_IBEACON,Object.assign({},{subaction:2})),!0}))}static getBeacons(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.SCAN_IBEACON,Object.assign({},{subaction:1}),{isMultiCallback:!0}).then((e=>{const t={beacons:[]};return Array.isArray(e)&&e.forEach((e=>{const n={uuid:e.uuid,major:e.major,minor:e.minor,distance:e.distance,rssi:e.rssi};t.beacons.push(n)})),t}))}))}static stopBluetoothDevicesDiscovery(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static startBluetoothDevicesDiscovery(e){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},Object.assign({},e))}))}static openBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static onBluetoothDeviceFound(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static onBluetoothAdapterStateChange(){return i(this,void 0,void 0,(function*(){return Promise.resolve()}))}static getConnectedBluetoothDevices(e){return i(this,void 0,void 0,(function*(){const t={services:e.services||[]};return this.callNative({name:""},t)}))}static getBluetoothDevices(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static getBluetoothAdapterState(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static closeBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static scanQRCode(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.OPEN_QR,{skipOpenLink:!0})}))}static showToast(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.SHOW_TOAST,{toast:e.message})}))}static hideKeyboard(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.HIDE_KEYBOARD,{})}))}static openPhone(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.OPEN_PHONE,{phoneNum:e.phoneNumber,phoneCode:e.phoneNumber})}))}static openSMS(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.OPEN_SMS,{content:e.content,phoneCode:e.phoneNumber})}))}static keepScreen(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.KEEP_SCREEN,{data:{keep_screen_on:e.keepScreenOn?1:0}})}))}static openBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.PROMPT_AUTHENTICATION,{secret_data:e.secretData,app_id:this.getZAppId(),ui:{title:e.ui.title,sub_title:e.ui.subTitle,negative_text:e.ui.negativeButtonText},require_fingerprint:e.requireFingerprint?1:0}).then((e=>{var t,n,i,o;return{code:null==e?void 0:e.error_code,message:null==e?void 0:e.error_message,data:{domain:null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.domain,code:null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.error_code,message:null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.error_message,payToken:null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.pay_token}}}))}))}static checkStateBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.PROMPT_AUTHENTICATION_CHECK_STATE,{}).then((e=>({bioState:null==e?void 0:e.bio_state})))}))}static vibrate(t){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.INTERACTIVE_VIBRATION,{type:e.VibrateType[t.type],vibrate_time:t.milliseconds})}))}static connectWifi(e){return i(this,void 0,void 0,(function*(){let t="open";return Gt.isString(e.password)&&e.password.length>0&&(t="wpa_wpa2"),yield this.callNative(ln.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.callNative(ln.OPEN_APPSTORE,e)}))}}var Si,Ai,Oi,Ti,bi,wi,Ni,Pi,Ii,Ci,ki,Ri,Bi,Di,ji,Mi,Li,Ui,Wi,xi,zi,Fi,Gi,Hi,$i,Vi,Zi,Ji;class Ki{constructor(e){Si.set(this,localStorage),Ai.set(this,void 0),Oi.set(this,void 0),Wn(),r(this,Oi,{keys:new Set,currentSize:0,limitSize:an},"f"),r(this,Ai,e,"f"),this.findAllCurrentDataByApp(e)}findAllCurrentDataByApp(e){try{let t;for(t in o(this,Si,"f")){if(e){if(t.split("_")[0]!==e)continue}o(this,Oi,"f").keys.add(t)}}catch(e){_i.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,Ai,"f")&&(e=`${o(this,Ai,"f")}_${e}`),o(this,Oi,"f").keys.has(e)?o(this,Si,"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,Ai,"f")&&(e=`${o(this,Ai,"f")}_${e}`),o(this,Si,"f").setItem(e,t),o(this,Oi,"f").keys.add(e)}getInfo(){return i(this,void 0,void 0,(function*(){return Promise.resolve(this.getInfoSync())}))}getInfoSync(){const e=((e,t)=>{let n,i,o=0;for(i in e){const r=i.split("_")[0];e.hasOwnProperty(i)&&(t&&r!==t||(n=2*(e[i].length+i.length),o+=n))}return o})(o(this,Si,"f"),o(this,Ai,"f"));return{currentSize:Gt.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,Ai,"f")&&(e=`${o(this,Ai,"f")}_${e}`),o(this,Oi,"f").keys.has(e)&&(o(this,Si,"f").removeItem(e),o(this,Oi,"f").keys.delete(e))}clear(){return i(this,void 0,void 0,(function*(){return Promise.resolve(this.clearSync())}))}clearSync(){o(this,Oi,"f").keys.forEach((e=>{o(this,Ai,"f")&&e.indexOf(o(this,Ai,"f"))<0||(o(this,Si,"f").removeItem(e),o(this,Oi,"f").keys.delete(e))}))}}Si=new WeakMap,Ai=new WeakMap,Oi=new WeakMap;class qi extends li{constructor(e){super(),Ti.set(this,void 0),bi.set(this,void 0),r(this,bi,{keys:new Set,currentSize:0,limitSize:an},"f"),r(this,Ti,e,"f")}get(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.ZBROWSER_MPDS,{mpds_action:"mpds.get",mpds_data:{keys:e},appId:o(this,Ti,"f")},{isMultiCallback:!1}).then((e=>{let t=new Map;return e&&e.mpds_data&&e.mpds_data.map&&(t=new Map(Object.entries(e.mpds_data.map))),t}))}))}set(e){return i(this,void 0,void 0,(function*(){return{errorKeys:yield this.callNative(ln.ZBROWSER_MPDS,{mpds_action:"mpds.set",mpds_data:{map:e},appId:o(this,Ti,"f")},{isMultiCallback:!1}).then((e=>{let t=[];return e&&e.mpds_data&&e.mpds_data.error_keys&&(t=e.mpds_data.error_keys),t}))}}))}getInfo(){return i(this,void 0,void 0,(function*(){const e=yield this.callNative(ln.ZBROWSER_MPDS,{mpds_action:"mpds.get.size",mpds_data:{},appId:o(this,Ti,"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:Gt.isNumber(e)?Number(e/1024):0,limitSize:Number(5120)}}))}remove(e){return i(this,void 0,void 0,(function*(){return{errorKeys:yield this.callNative(ln.ZBROWSER_MPDS,{mpds_action:"mpds.remove.key",mpds_data:{keys:e},appId:o(this,Ti,"f")},{isMultiCallback:!1}).then((e=>{let t=[];return e&&e.mpds_data&&e.mpds_data.error_keys&&(t=e.mpds_data.error_keys),t}))}}))}clear(){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.ZBROWSER_MPDS,{mpds_action:"mpds.clear.appData",mpds_data:{},appId:o(this,Ti,"f")})}))}}Ti=new WeakMap,bi=new WeakMap;class Qi{getDataFromStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance(),n=yield t.get(e),i={};return n.forEach(((e,t)=>{i[t]=Kn(e)})),i}))}putDataToStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance(),n={};return Object.entries(e).forEach((([e,t])=>{Gt.isUndefined(t)||Gt.isNull(t)||(n[e]=Jn(t))})),yield t.set(n)}))}removeDataFromStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance();return yield t.remove(e)}))}clearStorage(){return i(this,void 0,void 0,(function*(){const e=this.getInstance();yield e.clear()}))}getStorageInfo(){return i(this,void 0,void 0,(function*(){const e=this.getInstance();return yield e.getInfo()}))}}class Yi extends Qi{constructor(e){super(),wi.set(this,void 0),r(this,wi,e,"f")}getInstance(){return new Ki(o(this,wi,"f"))}}wi=new WeakMap;class Xi extends Qi{constructor(e){super(),Ni.set(this,void 0),r(this,Ni,e,"f")}getInstance(){return new qi(o(this,Ni,"f"))}}Ni=new WeakMap;class eo{static setStorage(e){return i(this,void 0,void 0,(function*(){let t=new Yi(this.getAppId());return Zn()&&(t=new Xi(this.getAppId())),yield t.putDataToStorage(e.data)}))}static getStorage(e){return i(this,void 0,void 0,(function*(){let t=new Yi(this.getAppId());Zn()&&(t=new Xi(this.getAppId()));return yield t.getDataFromStorage(e.keys)}))}static getStorageInfo(e){return i(this,void 0,void 0,(function*(){let e=new Yi(this.getAppId());return Zn()&&(e=new Xi(this.getAppId())),yield e.getStorageInfo()}))}static removeStorage(e){return i(this,void 0,void 0,(function*(){let t=new Yi(this.getAppId());return Zn()&&(t=new Xi(this.getAppId())),yield t.removeDataFromStorage(e.keys)}))}static clearStorage(e={}){return i(this,void 0,void 0,(function*(){let e=new Yi(this.getAppId());Zn()&&(e=new Xi(this.getAppId())),yield e.clearStorage()}))}}class to{static getUserInfo(e){return i(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();let n="id,name,picture";(null==e?void 0:e.avatarType)&&(n=`${n}.type(${null==e?void 0:e.avatarType})`);return{userInfo:yield fetch(`${tn}?fields=${n}`,{headers:{access_token:t||""}}).then((e=>i(this,void 0,void 0,(function*(){const t=yield e.json(),n={id:t.id,name:t.name,birthday:"",gender:"",avatar:t.picture&&t.picture.data&&t.picture.data.url};return console.warn("'birthday' and 'gender' are deprecated"),n}))))}}))}static getPhoneNumber(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.MP_GET_NUMBER,{},{isMultiCallback:!0,callback:(e,t)=>{if(0===e.error_code){const t={number:e.data};return Promise.resolve(t)}return Promise.reject(t)},delay:this.isIOS?400:0})}))}}class no{static closeApp(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.WINDOW_CLOSE,{})}))}static openMiniApp(e){return i(this,void 0,void 0,(function*(){const t=null==e?void 0:e.appId,n=(null==e?void 0:e.params)||{},i=Object.entries(n).map((function([e,t]){return[e,t].join("=")})).join("&");let o;try{o=yield Yn(t,0)}catch(e){}const r={appId:t};o&&(r.appName=o.name,r.appAvtUrl=o.logoUrl),yield this.callNative(ln.OPEN_MP,{mpUrl:`https://h5.zdn.vn/zapps/${t}/${i.length>0?"?"+i:""}`,mpInfo:r})}))}static openWebview(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.OPEN_INAPP,{url:e})}))}static closeLoading(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.MP_CLOSE_LOADINGVIEW,{at:(new Date).getTime(),when:e,url:location.href})}))}}class io{static getLocation(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.GET_LOCATION,{silent_request:!1,permission_description:"Cho phép Zalo truy cập vào vị trí của thiết bị này?"},{isMultiCallback:!0,haveTimeout:!1,callback:(e,t)=>{if(0===e.error_code){const t=e.data,n={latitude:t.latitude,longitude:t.longitude,timestamp:t.timestamp,provider:t.provider};return Promise.resolve(n)}return Promise.reject(t)},delay:this.isIOS?400:0})}))}static sendLocation(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.QUERY_LOCATION_HIDE,{title:e.title,touserid:e.toUserId,zapp:this.getZAppId()})}))}}class oo{static requestCameraPermission(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.REQUEST_PERMISSION_CAMERA,{},{callback:(e,t)=>-2===e.error_code||e.error_code>=0?Promise.resolve({userAllow:-2!==e.error_code,message:e.error_message}):Promise.reject(t)})}))}static saveImageToPhotosAlbum(e){return i(this,void 0,void 0,(function*(){let t={};return Gt.isEmpty(e.imageBase64Data)?Gt.isEmpty(e.imageUrl)||(t={imageUrl:e.imageUrl}):t={imageBase64Data:e.imageBase64Data},yield this.callNative(ln.SAVE_IMAGE_GALLERY,Object.assign({},t))}))}}class ro{static viewOAQr(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.VIEW_MYQR,{dpn:e.displayName,uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openProfile(t){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.OPEN_PROFILE,{uId:t.id,type:e.ProfileType[t.type],zapp:this.getZAppId(),sourceId:t.sourceId,sourceIndex:t.sourceIndex})}))}static openChat(t){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.OPEN_CHAT,{uId:t.id,type:e.ChatType[t.type],zapp:this.getZAppId(),sourceId:t.sourceId,sourceIndex:t.sourceIndex})}))}static openPostFeed(t){return i(this,void 0,void 0,(function*(){let n={};switch(t.type){case"image":n={photoUrl:t.data.imageUrl};break;case"link":n={link:t.data.link,title:t.data.title,thumb:t.data.thumb,description:t.data.description};break;case"profile":n={avt:t.data.avatar,uid:t.data.id,dpn:t.data.displayName}}return yield this.callNative(ln.OPEN_POSTFEED,Object.assign(Object.assign({type:e.PostFeedType[t.type]},n),{zapp:this.getZAppId()})).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static followOA(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.FOLLOW_OA,{uid:e.id,showDialogConfirm:!0,zapp:this.getZAppId()},{haveTimeout:!1})}))}static unfollowOA(e){return i(this,void 0,void 0,(function*(){yield this.callNative(ln.UNFOLLOW_OA,{uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openShareSheet(t){return i(this,void 0,void 0,(function*(){let n={};switch(t.type){case"image":let e=[];Array.isArray(t.data.imageUrls)&&t.data.imageUrls.length>0?e=t.data.imageUrls:e.push(t.data.imageUrl),n={photoUrls:e,photoUrl:t.data.imageUrl,caption:t.data.caption};break;case"gif":n={photoUrl:t.data.imageUrl,gifUrl:t.data.gifUrl,width:t.data.width,height:t.data.height};break;case"video":n={videoThumb:t.data.videoThumb,videoUrl:t.data.videoUrl,width:t.data.width,height:t.data.height};break;case"link":n={link:t.data.link,chatOnly:t.data.chatOnly?1:0};break;case"oa":n={uid:t.data.id};break;case"zmp":const i=yield this.getAccessToken(),o=yield qn(this.getAppId(),i||"",t.data.title||"",t.data.description||"",t.data.thumbnail||"",t.data.path);window.forceShareZMP?n={data:{ZInstantAPIInfo:{url:`${o.zinstantApi}`,zinstantdata_id:`templateId=${o.ztemplateId}&appId=${this.getAppId()}&shareId=${o.shareId}`},previewMsgText:{msg:{en:"Zalo Mini Program",vi:"Chương trình nhỏ"}},enableReactions:1}}:(n={link:o.shareableLink,chatOnly:t.data.chatOnly?1:0},t.type="link")}return yield this.callNative(ln.OPEN_SHARESHEET,Object.assign(Object.assign({type:e.ShareSheetType[t.type]},n),{zapp:this.getZAppId()}),{haveTimeout:!1}).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static createShortcut(e,t,n){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.CREATE_SHORTCUT,{url:e,title:t,iconUrl:n})}))}static openProfilePicker(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.MP_OPEN_PROFILE_PICKER,{maxProfile:e},{isMultiCallback:!0,callback:(e,t)=>0===e.error_code&&Array.isArray(e.data)?Promise.resolve(e.data.map((e=>e.id))):Promise.reject(t)})}))}static getActionsSupported(t){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.GET_SUPPORTED_ACTIONS,{},{isMultiCallback:!1,callback:(t,n)=>{const i=Fn();if(Array.isArray(t.actions)&&t.actions.length>0){const e=Object.keys(ln).filter((e=>ln[e].skip_jump)),n={actions:[...t.actions,...e]};return Promise.resolve(n)}if(i===e.PlatformType.iOS){const e={actions:yn};return Promise.resolve(e)}return Promise.reject(n)}})}))}static openMediaPicker(t,n,o,r,a,s){return i(this,void 0,void 0,(function*(){const i={type:0,url:n,maxSize:o||1048576};return yield this.callNative(ln.PICK_MEDIA,{media_type:e.MediaPickerType[t],edit_view:Object.assign(Object.assign({},{enable:1,aspect_ratio:"1:1"}),r),silent_request:a,upload:i,max_select_items:s},{isMultiCallback:!0,callback:(e,t)=>{var n;if(0===e.error_code){const t={data:null===(n=e.data)||void 0===n?void 0:n.result_content};return Promise.resolve(t)}return Promise.reject(t)}})}))}static openOutApp(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.OPEN_OUTAPP,{url:e})}))}}class ao{static getRouteParams(){let e={};const t=window.location.href;try{let n=new URL(t).searchParams.toString();n&&(e=Rn.getParamsAsObject(n))}catch(e){throw new Error("Url không hợp lệ")}return e}static sendDataToPreviousMiniApp(e){return i(this,void 0,void 0,(function*(){return yield this.callNative(ln.WEBVIEW_SET_RESULT,{result:Jn(e.data)})}))}static onCallbackData(t){return i(this,void 0,void 0,(function*(){yield this.events.on(e.Events.OnDataCallback,(e=>{t({data:e})}))}))}}class so extends li{constructor(){var e,t,n,i,a,s,l,c,u,d,p,h,v,f,m,g,y;super(),Pi.set(this,Kt),Ii.set(this,qt),Ci.set(this,Qt),ki.set(this,void 0),Ri.set(this,void 0),Bi.set(this,void 0),Di.set(this,null),ji.set(this,{timer:{getToken:0}}),Mi.set(this,void 0),Li.set(this,void 0),Ui.set(this,null),this.events=ei.getInstance(),this.isIOS=Wn().isIOS,Wi.set(this,void 0),this.getActionBarConfig=()=>o(this,Wi,"f"),this.setActionBarConfig=e=>{r(this,Wi,e(o(this,Wi,"f")),"f")},xi.set(this,(()=>new Promise(((e,t)=>{Gt.isUndefined(o(this,Ui,"f"))||Gt.isNull(o(this,Ui,"f"))?this.callNative(ln.JUMP_LOGIN,{}).then((t=>{const n=t&&t.cookiesOAuthLogins||[],i=n.find((e=>e.name===Xt));i&&(this.setJSToken(i.value),window.ZJSBridge.setJSToken&&window.ZJSBridge.setJSToken(i.value)),r(this,Ui,n,"f"),e(n)})).catch((e=>{t(e)})):e(o(this,Ui,"f"))})))),zi.set(this,mi.setNavigationBarRightButton),this.getVersion=fi.getVersion,this.getSystemInfo=fi.getSystemInfo,this.setNavigationBarTitle=mi.setNavigationBarTitle,this.setNavigationBarColor=mi.setNavigationBarColor,this.setNavigationBarLeftButton=mi.setNavigationBarLeftButton,this.setBackgroundColor=gi.setBackgroundColor,this.setDeviceOrientation=Ei.setDeviceOrientation,this.setStorage=eo.setStorage,this.getStorage=eo.getStorage,this.getStorageInfo=eo.getStorageInfo,this.removeStorage=eo.removeStorage,this.clearStorage=eo.clearStorage,this.getUserInfo=to.getUserInfo,this.getNetworkType=Ei.getNetworkType,this.onNetworkStatusChange=Ei.onNetworkStatusChange,this.startBeaconDiscovery=Ei.startBeaconDiscovery,this.stopBeaconDiscovery=Ei.stopBeaconDiscovery,this.getBeacons=Ei.getBeacons,this.closeApp=no.closeApp,this.getLocation=io.getLocation,this.stopBluetoothDevicesDiscovery=Ei.stopBluetoothDevicesDiscovery,this.startBluetoothDevicesDiscovery=Ei.stopBluetoothDevicesDiscovery,this.openBluetoothAdapter=Ei.openBluetoothAdapter,this.onBluetoothDeviceFound=Ei.onBluetoothDeviceFound,this.onBluetoothAdapterStateChange=Ei.onBluetoothAdapterStateChange,this.getConnectedBluetoothDevices=Ei.getConnectedBluetoothDevices,this.getBluetoothDevices=Ei.getBluetoothDevices,this.getBluetoothAdapterState=Ei.getBluetoothAdapterState,this.closeBluetoothAdapter=Ei.closeBluetoothAdapter,this.scanQRCode=Ei.scanQRCode,this.openProfile=ro.openProfile,this.openChat=ro.openChat,this.openPostFeed=ro.openPostFeed,this.followOA=ro.followOA,this.unFollowOA=ro.unfollowOA,this.openShareSheet=ro.openShareSheet,this.requestCameraPermission=oo.requestCameraPermission,this.createShortcut=ro.createShortcut,this.openBioAuthentication=Ei.openBioAuthentication,this.checkStateBioAuthentication=Ei.checkStateBioAuthentication,this.sendLocation=io.sendLocation,this.showToast=Ei.showToast,this.hideKeyboard=Ei.hideKeyboard,this.openPhone=Ei.openPhone,this.openSMS=Ei.openSMS,this.viewOAQr=ro.viewOAQr,this.keepScreen=Ei.keepScreen,this.saveImageToPhotosAlbum=oo.saveImageToPhotosAlbum,this.openMiniApp=no.openMiniApp,this.vibrate=Ei.vibrate,this.openWebview=no.openWebview,this.getRouteParams=ao.getRouteParams,this.getAppInfo=fi.getAppInfo,this.sendDataToPreviousMiniApp=ao.sendDataToPreviousMiniApp,this.onCallbackData=ao.onCallbackData,this.getPhoneNumber=to.getPhoneNumber,this.openProfilePicker=ro.openProfilePicker,Fi.set(this,ro.getActionsSupported),this.connectWifi=Ei.connectWifi,this.openMediaPicker=ro.openMediaPicker,this.openOutApp=ro.openOutApp,this.closeLoading=no.closeLoading,this.openAppStore=Ei.openAppStore,r(this,ki,null,"f"),r(this,Ri,null,"f"),r(this,Bi,null,"f"),this.isShowNavBar=!0,r(this,Mi,0,"f"),r(this,Li,0,"f");const _="home"===(null===(t=null===(e=o(this,Ci,"f"))||void 0===e?void 0:e.app)||void 0===t?void 0:t.leftButton)||"both"===(null===(i=null===(n=o(this,Ci,"f"))||void 0===n?void 0:n.app)||void 0===i?void 0:i.leftButton)?Sn:An,E=new URL(location.href),S=Gt.isString(null===(s=null===(a=o(this,Ci,"f"))||void 0===a?void 0:a.app)||void 0===s?void 0:s.headerColor)&&(null===(u=null===(c=null===(l=o(this,Ci,"f"))||void 0===l?void 0:l.app)||void 0===c?void 0:c.headerColor)||void 0===u?void 0:u.length)>0?5:6,A="none"===(null===(p=null===(d=o(this,Ci,"f"))||void 0===d?void 0:d.app)||void 0===p?void 0:p.leftButton)||"home"===(null===(v=null===(h=o(this,Ci,"f"))||void 0===h?void 0:h.app)||void 0===v?void 0:v.leftButton)?En:_n;r(this,Wi,{actionbarType:S,buttonType:A,dataConfig:{backgroundColor:(null===(m=null===(f=o(this,Ci,"f"))||void 0===f?void 0:f.app)||void 0===m?void 0:m.headerColor)||"",textColor:(null===(y=null===(g=o(this,Ci,"f"))||void 0===g?void 0:g.app)||void 0===y?void 0:y.textColor)||"",viewInLeftType:A,confirmToExit:1},homeConfig:{enable:_,url:`https://h5.zdn.vn/zapps/${this.getAppId()}/${E.search}`}},"f")}static getInstance(){return so.instance||(so.instance=new so),so.instance}getLoginStatus(){return Gt.isString(o(this,Bi,"f"))&&o(this,Bi,"f").length>0}getAppId(){return o(this,Ii,"f")}getZAppId(){return o(this,Pi,"f")}login(e){return i(this,void 0,void 0,(function*(){const e=yield o(this,xi,"f").call(this),t=e.find((e=>e.name===Yt)),n=e.find((e=>e.name===en));if(!Gt.isUndefined(t)&&!Gt.isNull(t)&&Gt.isString(t.value)){if(r(this,ki,t.value,"f"),Gt.isUndefined(n)||Gt.isNull(n)||!Gt.isString(n.value)?yield this.loginZaloV3():(r(this,Ri,n.value,"f"),yield this.loginZaloV4()),!o(this,Bi,"f"))throw kn.loginFailed();return o(this,Bi,"f")}throw kn.loginFailed()}))}loginZaloV3(){return i(this,void 0,void 0,(function*(){return yield fetch(`${on}?app_id=${o(this,Pi,"f")}&redirect_uri=https://h5.zdn.vn/zapps/${o(this,Ii,"f")}/&code=${o(this,ki,"f")}&isSDK=true123`).then((e=>i(this,void 0,void 0,(function*(){let t=yield e.json();if(t.access_token){r(this,Bi,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return r(this,Li,e,"f"),r(this,Mi,(new Date).getTime(),"f"),this.setZAccSession(o(this,Bi,"f")||""),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(o(this,Bi,"f")||""),o(this,Bi,"f")}return null}))))}))}loginZaloV4(){return i(this,void 0,void 0,(function*(){const e=new URLSearchParams;e.append("app_id",o(this,Ii,"f")),e.append("code",o(this,ki,"f")||""),e.append("code_verifier",o(this,Ri,"f")||""),Gt.isNull(o(this,Di,"f"))?e.append("grant_type","authorization_code"):(e.append("grant_type","refresh_token"),e.append("refresh_token",o(this,Di,"f")||""));return yield fetch(nn,Object.assign({method:"POST",body:e},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).then((e=>i(this,void 0,void 0,(function*(){const t=yield e.json();if(t.refresh_token&&r(this,Di,t.refresh_token,"f"),t.access_token){r(this,Bi,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return r(this,Li,e,"f"),r(this,Mi,(new Date).getTime(),"f"),this.setZAccSession(o(this,Bi,"f")||""),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(o(this,Bi,"f")||""),o(this,Bi,"f")}return null}))))}))}getAccessToken(e){return i(this,void 0,void 0,(function*(){const e=(new Date).getTime()-o(this,Mi,"f");if(!o(this,Bi,"f"))throw kn.loginRequired();return e<o(this,Li,"f")?o(this,Bi,"f"):yield this.login()}))}}Pi=new WeakMap,Ii=new WeakMap,Ci=new WeakMap,ki=new WeakMap,Ri=new WeakMap,Bi=new WeakMap,Di=new WeakMap,ji=new WeakMap,Mi=new WeakMap,Li=new WeakMap,Ui=new WeakMap,Wi=new WeakMap,xi=new WeakMap,zi=new WeakMap,Fi=new WeakMap;class lo{constructor(){Gi.set(this,Kt),Hi.set(this,Qt),$i.set(this,"DEFAULT ZOAUTH"),Vi.set(this,"DEFAULT ACCESS TOKEN"),Zi.set(this,{timer:{getToken:0}}),Ji.set(this,!1),this.getLoginStatus=()=>o(this,Ji,"f"),this.getAppId=()=>o(this,Gi,"f"),this.login=()=>(r(this,Ji,!0,"f"),Promise.resolve(o(this,$i,"f"))),this.getAccessToken=()=>Promise.resolve(o(this,Vi,"f")),this.getVersion=fi.getVersion,this.getSystemInfo=fi.getSystemInfo,this.setNavigationBarTitle=()=>Promise.resolve(),this.setNavigationBarColor=()=>Promise.resolve(),this.setBackgroundColor=()=>Promise.resolve(),this.setNavigationBarLeftButton=()=>Promise.resolve(),this.setDeviceOrientation=()=>Promise.resolve(),this.setStorage=e=>i(this,void 0,void 0,(function*(){const t=new Yi(this.getAppId());return yield t.putDataToStorage(e.data),{errorKeys:[]}})),this.getStorage=e=>i(this,void 0,void 0,(function*(){const t=new Yi(this.getAppId());return yield t.getDataFromStorage(e.keys)})),this.getStorageInfo=e=>i(this,void 0,void 0,(function*(){const e=new Yi(this.getAppId());return yield e.getStorageInfo()})),this.removeStorage=e=>i(this,void 0,void 0,(function*(){const t=new Yi(this.getAppId());return yield t.removeDataFromStorage(e.keys)})),this.clearStorage=e=>i(this,void 0,void 0,(function*(){const e=new Yi(this.getAppId());return yield e.clearStorage()})),this.getUserInfo=()=>(console.warn("birthday and gender are deprecated"),Promise.resolve({userInfo:{id:"3368637342326461234",name:"User Name",avatar:"https://h5.zdn.vn/static/images/avatar.png"}})),this.getNetworkType=()=>{let t;switch((navigator.connection||navigator.mozConnection||navigator.webkitConnection).effectiveType){case"none":t=e.NetworkType.none;break;case"4g":t=e.NetworkType.wifi;break;case"3g":case"2g":t=e.NetworkType.cellular;break;default:t=e.NetworkType.unknown}const n={networkType:t};return Promise.resolve(n)},this.onNetworkStatusChange=t=>{const n=navigator.connection||navigator.mozConnection||navigator.webkitConnection,i=n.effectiveType;return n.addEventListener("change",(function(){let n;switch(i){case"none":n=e.NetworkType.none;break;case"4g":n=e.NetworkType.wifi;break;case"3g":case"2g":n=e.NetworkType.cellular;break;default:n=e.NetworkType.unknown}t({isConnected:!0,networkType:n})})),Promise.resolve()},this.startBeaconDiscovery=e=>Promise.resolve(!0),this.stopBeaconDiscovery=e=>Promise.resolve(!0),this.getBeacons=e=>Promise.resolve({beacons:[]}),this.closeApp=()=>Promise.resolve(),this.getLocation=()=>Promise.resolve({longitude:"105.788026",latitude:"21.0258773",timestamp:(new Date).getTime().toString(),provider:"fused"}),this.onBackButtonClick=()=>Promise.resolve(),this.stopBluetoothDevicesDiscovery=()=>Promise.resolve(),this.startBluetoothDevicesDiscovery=()=>Promise.resolve(),this.openBluetoothAdapter=()=>Promise.resolve(),this.onBluetoothDeviceFound=()=>Promise.resolve(),this.onBluetoothAdapterStateChange=()=>Promise.resolve(),this.getConnectedBluetoothDevices=()=>Promise.resolve(),this.getBluetoothDevices=()=>Promise.resolve(),this.getBluetoothAdapterState=()=>Promise.resolve(),this.closeBluetoothAdapter=()=>Promise.resolve(),this.scanQRCode=()=>Promise.resolve({content:"132"}),this.openProfile=()=>Promise.resolve(),this.openChat=()=>Promise.resolve(),this.openPostFeed=()=>Promise.resolve({status:1,shareType:0,numberOfUser:0}),this.followOA=()=>Promise.resolve(),this.unFollowOA=()=>Promise.resolve(),this.openShareSheet=()=>Promise.resolve({status:2,shareType:0,numberOfUser:0}),this.requestCameraPermission=()=>Promise.resolve({userAllow:!0,message:"Success"}),this.createShortcut=()=>Promise.resolve(),this.openBioAuthentication=()=>Promise.resolve({code:0,message:"OK",data:{domain:"",code:0,message:"",payToken:""}}),this.checkStateBioAuthentication=()=>Promise.resolve({bioState:""}),this.sendLocation=()=>Promise.resolve(),this.showToast=()=>Promise.resolve(),this.hideKeyboard=()=>Promise.resolve(),this.openPhone=()=>Promise.resolve(),this.openSMS=()=>Promise.resolve(),this.viewOAQr=()=>Promise.resolve(),this.keepScreen=()=>Promise.resolve(),this.saveImageToPhotosAlbum=()=>Promise.resolve(),this.openMiniApp=e=>Promise.resolve(),this.vibrate=()=>Promise.resolve(),this.openWebview=e=>(location.replace(e),Promise.resolve()),this.getRouteParams=ao.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()}on(e,t,n){throw new Error("Method not implemented.")}once(e,t,n){throw new Error("Method not implemented.")}off(e,t,n,i){throw new Error("Method not implemented.")}removeAllListeners(e){throw new Error("Method not implemented.")}openMediaPicker(e,t,n,i,o,r){return console.warn("This api only works on zalo app"),Promise.resolve({data:""})}}Gi=new WeakMap,Hi=new WeakMap,$i=new WeakMap,Vi=new WeakMap,Zi=new WeakMap,Ji=new WeakMap;const co=Symbol("required"),uo=Symbol("checkType"),po=(e,t)=>(n,i,o)=>{let r=Reflect.getOwnMetadata(co,n,i)||[];r.push({parameterIndex:o,fields:e,option:t}),Reflect.defineMetadata(co,r,n,i)},ho=(e,t,n)=>(i,o,r)=>{let a=Reflect.getOwnMetadata(uo,i,o)||[];a.push({parameterIndex:r,type:e,properties:t,defaultValue:n}),Reflect.defineMetadata(uo,a,i,o)};const vo=(e,t,n)=>{const i=n.value,o=i.toString().match(/\(.*?\)/)[0].replace(/[()]/gi,"").replace(/\s/gi,"").split(",");return n.value=function(){const n=Reflect.getOwnMetadata(co,e,t),r=Reflect.getOwnMetadata(uo,e,t);return r&&r.forEach((e=>{const{parameterIndex:t,type:n,properties:i,defaultValue:r}=e;let a=arguments[t],s=o[t];const l=typeof a;if(!Gt.isUndefined(a)){if(!Gn(a,n))throw kn.wrongTypeParam(s,n,Array.isArray(a)?"array":null===a?"null":l);"object"===n&&Object.entries(i).forEach((([e,n])=>{const i=e.split("?")[0],o=Gt.get(a,i);if(Gt.isUndefined(o)||Gt.isNull(o)){if(!e.includes("?"))throw kn.missingParam(e);Gt.isObject(Gt.get(a,i.split(".")[0]))&&r&&!Gt.isUndefined(Gt.get(r,i))&&Gt.set(arguments[t],i,Gt.get(r,i))}else if(Gt.isFunction(n)){const e=n(o);if(e&&e.error)throw kn.wrongTypeParam(`${s}.${i}`,e.errorMessage,typeof o)}}))}})),n&&n.forEach((e=>{const{parameterIndex:t,option:n,fields:i}=e,o=arguments[t],r=null==n?void 0:n.if,a=null==n?void 0:n.defaultValue;let s=!0;r&&(s=Object.keys(r).every((e=>Gt.get(o,e)===r[e]))),s&&i.forEach((e=>{const n=e=>{let n=!1;return Gt.isEmpty(Gt.get(o,e))&&(Gt.isUndefined(Gt.get(a,e))||Gt.set(arguments[t],e,Gt.get(a,e)),n=!0),n};if(Array.isArray(e)&&e.length>0&&e.every(n))throw kn.missingParam(e.join(" or "));if(Gt.isString(e)&&n(e))throw kn.missingParam(e)}))})),i.apply(this,arguments)},n};var fo,mo,go,yo,_o;class Eo{constructor(){this.events=ei.getInstance(),fo.set(this,void 0),r(this,fo,this.getServiceInstance(),"f"),this.events.addListener=(t,n,i)=>{const o=t;return this.events.addListener(e.Events[o],n,i)}}login(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").login(e)}))}getLoginStatus(){return o(this,fo,"f").getLoginStatus()}getAccessToken(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getAccessToken(e)}))}getVersion(){return o(this,fo,"f").getVersion()}getSystemInfo(){return o(this,fo,"f").getSystemInfo()}setNavigationBarTitle(e){return i(this,void 0,void 0,(function*(){return o(this,fo,"f").setNavigationBarTitle(e)}))}setNavigationBarColor(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").setNavigationBarColor(e)}))}setBackgroundColor(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").setBackgroundColor(e)}))}setNavigationBarLeftButton(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").setNavigationBarLeftButton(e)}))}setDeviceOrientation(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").setDeviceOrientation(e)}))}setStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").setStorage(e)}))}getStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getStorage(e)}))}getStorageInfo(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getStorageInfo(e)}))}removeStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").removeStorage(e)}))}clearStorage(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").clearStorage(e)}))}getUserInfo(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getUserInfo(e)}))}getNetworkType(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getNetworkType(e)}))}onNetworkStatusChange(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").onNetworkStatusChange(e)}))}startBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").startBeaconDiscovery(e)}))}stopBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").stopBeaconDiscovery(e)}))}getBeacons(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getBeacons(e)}))}closeApp(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").closeApp(e)}))}getLocation(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getLocation(e)}))}stopBluetoothDevicesDiscovery(){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").stopBluetoothDevicesDiscovery()}))}startBluetoothDevicesDiscovery(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").startBluetoothDevicesDiscovery(e)}))}openBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").openBluetoothAdapter()}))}onBluetoothDeviceFound(){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").onBluetoothDeviceFound()}))}onBluetoothAdapterStateChange(){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").onBluetoothAdapterStateChange()}))}getConnectedBluetoothDevices(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getConnectedBluetoothDevices(e)}))}getBluetoothDevices(){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getBluetoothDevices()}))}getBluetoothAdapterState(){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getBluetoothAdapterState()}))}closeBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").closeBluetoothAdapter()}))}scanQRCode(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").scanQRCode(e)}))}openProfile(e){return i(this,void 0,void 0,(function*(){yield o(this,fo,"f").openProfile(e)}))}openChat(e){return i(this,void 0,void 0,(function*(){yield o(this,fo,"f").openChat(e)}))}openPostFeed(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").openPostFeed(e)}))}followOA(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").followOA(e)}))}unfollowOA(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").unFollowOA(e)}))}openShareSheet(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").openShareSheet(e)}))}requestCameraPermission(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").requestCameraPermission(e)}))}createShortcut(e){return i(this,void 0,void 0,(function*(){const t=yield Yn(qt,0),n=Wn().isIOS,i=t.logoUrl||xn("og:image:url")||"",r=t.name||document.title,a=e.params?new URLSearchParams(e.params):new URLSearchParams;if(a.append("utm_source","zalo-shortcut"),a.append("utm_medium","default"),a.append("utm_campaign","default"),n){a.append("appId",qt),a.append("appName",r),a.append("appIcon",i);const e=`https://mini.zalo.me/shortcut.html?${a.toString()}`;yield o(this,fo,"f").openOutApp(encodeURI(e))}else yield o(this,fo,"f").createShortcut(`https://zalo.me/app/link/zapps/${qt}/?${a.toString()}`,r,i);return Cn()}))}openBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").openBioAuthentication(e)}))}checkStateBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").checkStateBioAuthentication(e)}))}sendLocation(e){return i(this,void 0,void 0,(function*(){yield o(this,fo,"f").sendLocation(e)}))}showToast(e){return i(this,void 0,void 0,(function*(){yield o(this,fo,"f").showToast(e)}))}hideKeyboard(e){return i(this,void 0,void 0,(function*(){yield o(this,fo,"f").hideKeyboard(e)}))}openPhone(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").openPhone(e)}))}openSMS(e){return i(this,void 0,void 0,(function*(){yield o(this,fo,"f").openSMS(e)}))}viewOAQr(e){return i(this,void 0,void 0,(function*(){yield o(this,fo,"f").viewOAQr(e)}))}keepScreen(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").keepScreen(e)}))}saveImageToGallery(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").saveImageToPhotosAlbum(e)}))}saveImageToPhotosAlbum(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").saveImageToPhotosAlbum(e)}))}openMiniApp(e){return i(this,void 0,void 0,(function*(){if(!Gt.isEmpty(e.params)){const t=e.params||{};Object.keys(t).forEach((e=>{"object"==typeof t[e]&&(t[e]=JSON.stringify(t[e])),t[e]=""+encodeURIComponent(t[e])})),e.params=t}yield o(this,fo,"f").openMiniApp(e)}))}vibrate(e){return i(this,void 0,void 0,(function*(){yield o(this,fo,"f").vibrate(e)}))}openWebview(e){return i(this,void 0,void 0,(function*(){const t=new URL(e.url),n=t.searchParams.get("typeInapp");Gt.isEmpty(n)&&t.searchParams.set("typeInapp","1"),yield o(this,fo,"f").openWebview(t.href)}))}getRouteParams(){return o(this,fo,"f").getRouteParams()}getAppInfo(e){return o(this,fo,"f").getAppInfo()}sendDataToPreviousMiniApp(e){return o(this,fo,"f").sendDataToPreviousMiniApp(e)}onCallbackData(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").onCallbackData(e)}))}getPhoneNumber(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").getPhoneNumber()}))}openProfilePicker(e){return i(this,void 0,void 0,(function*(){const t=yield o(this,fo,"f").openProfilePicker(e.maxProfile);let n;if(t.length>0)try{const e=yield this.getAccessToken(),i=yield fetch(rn,{method:"POST",headers:{"Content-Type":"application/json",access_token:e||""},body:JSON.stringify({fields:"id,name,picture",user_ids:t})}),o=yield i.json();if(0!==o.error||!o.data)throw new Error(o.message);n=t.map((e=>{var t,n,i,r,a,s,l,c,u,d,p;return{id:(null===(n=null===(t=o.data[e])||void 0===t?void 0:t.user_info)||void 0===n?void 0:n.user_id_by_app)||"",profile:{name:null===(r=null===(i=o.data[e])||void 0===i?void 0:i.user_info)||void 0===r?void 0:r.name,avatar:null===(c=null===(l=null===(s=null===(a=o.data[e])||void 0===a?void 0:a.user_info)||void 0===s?void 0:s.picture)||void 0===l?void 0:l.data)||void 0===c?void 0:c.url},code:0!==(null===(u=o.data[e])||void 0===u?void 0:u.error)?-1:0,message:`Get profile: ${Gt.isUndefined(null===(d=o.data[e])||void 0===d?void 0:d.message)?"Unknown error":null===(p=o.data[e])||void 0===p?void 0:p.message}`}}))}catch(e){n=t.map((t=>({id:t,profile:{name:"",avatar:""},code:-1,message:`Can't get profile: ${e.message}`})))}return{users:n||[]}}))}connectWifi(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").connectWifi(e)}))}openMediaPicker(e){var t,n,r;return i(this,void 0,void 0,(function*(){const i={};Gt.isUndefined(null===(t=e.editView)||void 0===t?void 0:t.enable)||(null===(n=e.editView)||void 0===n?void 0:n.enable)?i.enable=1:i.enable=0,i.aspect_ratio=null===(r=e.editView)||void 0===r?void 0:r.aspectRatio;const a=!0===e.silentRequest?1:0,s=e.maxSelectItem;return yield o(this,fo,"f").openMediaPicker(e.type,e.serverUploadUrl,e.maxItemSize,i,a,s)}))}getShareableLink(e){return i(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();return(yield qn(window.APP_ID,t||"",e.title,e.description,e.thumbnail,e.path)).shareableLink}))}closeLoading(e){return i(this,void 0,void 0,(function*(){return yield o(this,fo,"f").closeLoading("user action")}))}requestUpdateZalo(e){return i(this,void 0,void 0,(function*(){const e=Wn().isIOS?"https://apps.apple.com/vn/app/zalo/id579523206":"https://play.google.com/store/apps/details?id=com.zing.zalo";return yield o(this,fo,"f").openOutApp(e)}))}}fo=new WeakMap,t([Pn],Eo.prototype,"login",null),t([In],Eo.prototype,"getLoginStatus",null),t([Pn],Eo.prototype,"getAccessToken",null),t([In],Eo.prototype,"getVersion",null),t([In],Eo.prototype,"getSystemInfo",null),t([Pn,vo,n(0,ho("object",{title:Qn("string")}))],Eo.prototype,"setNavigationBarTitle",null),t([Pn,vo,n(0,ho("object",{color:Qn("string"),"textColor?":Qn("string",{values:["white","black"]}),"statusBarColor?":Qn("string")}))],Eo.prototype,"setNavigationBarColor",null),t([Pn,vo,n(0,ho("object",{backgroundColor:Qn("string"),"textColor?":Qn("string",{values:["white","black"]})}))],Eo.prototype,"setBackgroundColor",null),t([Pn,vo,n(0,ho("object",{type:Qn("string",{values:["none","back","home","both"]})}))],Eo.prototype,"setNavigationBarLeftButton",null),t([Pn,vo,n(0,ho("object",{rotate:Qn("string",{values:["auto","portrait","landscape"]})}))],Eo.prototype,"setDeviceOrientation",null),t([Pn,vo,n(0,ho("object",{data:Qn("object")}))],Eo.prototype,"setStorage",null),t([Pn,vo,n(0,ho("object",{keys:Qn("array<string>")}))],Eo.prototype,"getStorage",null),t([Pn],Eo.prototype,"getStorageInfo",null),t([Pn,vo,n(0,ho("object",{keys:Qn("array<string>")}))],Eo.prototype,"removeStorage",null),t([Pn],Eo.prototype,"clearStorage",null),t([Pn,vo,n(0,ho("object",{"avatarType?":Qn("string",{values:["small","normal","large"]})}))],Eo.prototype,"getUserInfo",null),t([Pn],Eo.prototype,"getNetworkType",null),t([Pn],Eo.prototype,"onNetworkStatusChange",null),t([Pn],Eo.prototype,"startBeaconDiscovery",null),t([Pn],Eo.prototype,"stopBeaconDiscovery",null),t([Pn],Eo.prototype,"getBeacons",null),t([Pn],Eo.prototype,"closeApp",null),t([Pn],Eo.prototype,"getLocation",null),t([Pn],Eo.prototype,"stopBluetoothDevicesDiscovery",null),t([Pn],Eo.prototype,"startBluetoothDevicesDiscovery",null),t([Pn],Eo.prototype,"openBluetoothAdapter",null),t([Pn],Eo.prototype,"onBluetoothDeviceFound",null),t([Pn],Eo.prototype,"onBluetoothAdapterStateChange",null),t([Pn],Eo.prototype,"getConnectedBluetoothDevices",null),t([Pn],Eo.prototype,"getBluetoothDevices",null),t([Pn],Eo.prototype,"getBluetoothAdapterState",null),t([Pn],Eo.prototype,"closeBluetoothAdapter",null),t([Pn],Eo.prototype,"scanQRCode",null),t([Pn,vo,n(0,ho("object",{type:Qn("string",{values:["user","oa","aliasOA"]}),id:Qn("string")}))],Eo.prototype,"openProfile",null),t([Pn,vo,n(0,ho("object",{type:Qn("string",{values:["user","oa"]}),id:Qn("string")}))],Eo.prototype,"openChat",null),t([Pn,vo,n(0,po(["data.imageUrl"],{if:{type:"image"}})),n(0,po(["data.link"],{if:{type:"link"}})),n(0,po(["data.id"],{if:{type:"profile"}})),n(0,ho("object",{type:Qn("string",{values:["image","link","profile"]}),data:Qn("object"),"data.imageUrl?":Qn("url"),"data.link?":Qn("url"),"data.title?":Qn("string"),"data.thumb?":Qn("url"),"data.description?":Qn("string"),"data.avatar?":Qn("url"),"data.id?":Qn("string"),"data.displayName?":Qn("string")}))],Eo.prototype,"openPostFeed",null),t([Pn,vo,n(0,ho("object",{id:Qn("string"),"showDialogConfirm?":Qn("boolean")}))],Eo.prototype,"followOA",null),t([Pn,vo,n(0,ho("object",{id:Qn("string")}))],Eo.prototype,"unfollowOA",null),t([Pn,vo,n(0,po([["data.imageUrl","data.imageUrls"]],{if:{type:"image"}})),n(0,po(["data.link"],{if:{type:"link"}})),n(0,po(["data.id"],{if:{type:"oa"}})),n(0,po(["data.gifUrl"],{if:{type:"gif"}})),n(0,po(["data.videoThumb","data.videoUrl"],{if:{type:"video"}})),n(0,po(["data.thumbnail","data.title","data.description"],{if:{type:"zmp"},defaultValue:{data:{description:""}}})),n(0,ho("object",{type:Qn("string",{values:["image","gif","video","link","oa","zmp"]}),data:Qn("object"),"data.imageUrl?":Qn("url"),"data.imageUrls?":Qn("array<url>",{maxLength:10}),"data.caption?":Qn("string"),"data.gifUrl?":Qn("url"),"data.width?":Qn("number"),"data.height?":Qn("number"),"data.videoThumb?":Qn("url"),"data.videoUrl?":Qn("url"),"data.link?":Qn("url"),"data.chatOnly?":Qn("boolean"),"data.id?":Qn("string"),"data.thumbnail?":Qn("url"),"data.path?":Qn("string"),"data.title?":Qn("string",{maxLength:100}),"data.description?":Qn(["string"],{maxLength:400})}))],Eo.prototype,"openShareSheet",null),t([Pn],Eo.prototype,"requestCameraPermission",null),t([Pn],Eo.prototype,"createShortcut",null),t([Pn,vo,n(0,ho("object",{secretData:Qn("string"),"ui?":Qn("object"),"ui.title?":Qn("string"),"ui.subTitle?":Qn("string"),"ui.negativeButtonText?":Qn("string"),"requireFingerprint?":Qn("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"}}))],Eo.prototype,"openBioAuthentication",null),t([Pn],Eo.prototype,"checkStateBioAuthentication",null),t([Pn,vo,n(0,ho("object",{toUserId:Qn("string"),"title?":Qn("string")}))],Eo.prototype,"sendLocation",null),t([Pn,vo,n(0,ho("object",{message:Qn("string")}))],Eo.prototype,"showToast",null),t([Pn],Eo.prototype,"hideKeyboard",null),t([Pn,vo,n(0,ho("object",{phoneNumber:Qn("string")}))],Eo.prototype,"openPhone",null),t([Pn,vo,n(0,ho("object",{content:Qn("string"),phoneNumber:Qn("string",{regex:/^\+?\d+$/})}))],Eo.prototype,"openSMS",null),t([Pn,vo,n(0,ho("object",{id:Qn("string"),"displayName?":Qn("string")},{displayName:""}))],Eo.prototype,"viewOAQr",null),t([Pn],Eo.prototype,"keepScreen",null),t([Pn,vo,n(0,ho("object",{"imageBase64Data?":Qn("string"),"imageUrl?":Qn("url")}))],Eo.prototype,"saveImageToGallery",null),t([Pn,vo,n(0,ho("object",{"imageBase64Data?":Qn("string"),"imageUrl?":Qn("url")}))],Eo.prototype,"saveImageToPhotosAlbum",null),t([Pn,vo,n(0,ho("object",{appId:Qn("string"),"params?":Qn("object")}))],Eo.prototype,"openMiniApp",null),t([Pn,vo,n(0,ho("object",{"type?":Qn("string",{values:["oneShot"]}),"milliseconds?":Qn("number")},{type:"oneShot",milliseconds:500}))],Eo.prototype,"vibrate",null),t([Pn,vo,n(0,ho("object",{url:Qn("url")}))],Eo.prototype,"openWebview",null),t([In],Eo.prototype,"getRouteParams",null),t([Pn],Eo.prototype,"getAppInfo",null),t([Pn],Eo.prototype,"sendDataToPreviousMiniApp",null),t([Pn],Eo.prototype,"onCallbackData",null),t([Pn],Eo.prototype,"getPhoneNumber",null),t([Pn,vo,n(0,ho("object",{"maxProfile?":Qn("number",{min:1,max:10})},{maxProfile:1}))],Eo.prototype,"openProfilePicker",null),t([Pn,vo,n(0,po(["SSID"])),n(0,ho("object",{SSID:Qn("string"),"password?":Qn("string"),"hiddenSSID?":Qn("boolean")}))],Eo.prototype,"connectWifi",null),t([Pn,vo,n(0,ho("object",{type:Qn("string",{values:["photo","video","file"]}),serverUploadUrl:Qn("url"),"maxItemSize?":Qn("number",{min:0}),"editView?":Qn("object"),"editView.enable?":Qn("boolean"),"editView.aspectRatio?":Qn("string",{regex:/^\d+:\d+$/}),"silentRequest?":Qn("boolean"),"maxSelectItem?":Qn("number",{min:1})}))],Eo.prototype,"openMediaPicker",null),t([Pn,vo,n(0,ho("object",{title:Qn("string",{maxLength:100}),"thumbnail?":Qn("url"),"path?":Qn("string"),description:Qn(["string"],{maxLength:400})},{description:""}))],Eo.prototype,"getShareableLink",null),t([Pn,vo],Eo.prototype,"closeLoading",null),t([Pn,vo],Eo.prototype,"requestUpdateZalo",null);class So extends Eo{getServiceInstance(){return so.getInstance()}}class Ao extends Eo{getServiceInstance(){return new lo}}class Oo{constructor(){mo.set(this,qt)}static getInstance(){return Oo.instance||(Oo.instance=new Oo),Oo.instance}createOrder(e,t){return i(this,void 0,void 0,(function*(){const n=o(this,mo,"f"),i=new URLSearchParams;i.append("amount",t.amount.toString()),i.append("item",encodeURIComponent(JSON.stringify(t.item))),i.append("appId",n),t.desc&&i.append("desc",encodeURIComponent(t.desc)),t.extradata&&i.append("extradata",encodeURIComponent(JSON.stringify(t.extradata))),t.method&&i.append("method",t.method);const r={headers:{"Content-Type":"application/x-www-form-urlencoded",authorization:"Bearer "}};try{const o=yield e.getAccessToken({fail:e=>{throw kn.loginRequired}});r.headers.authorization=`Bearer ${o}`;const a=yield fetch(On,Object.assign(Object.assign({method:"POST"},r),{body:i})),s=yield a.json();if(!s.data||0!==s.err)throw kn.badRequest(s.msg);const l=s.data.id,c=s.data.jwt,u=window.APP_VERSION,d=window.APP_ENV,p={miniAppId:n,orderId:l};c&&(p.token=c),u&&(p.version=u),d&&(p.env=d),t.method&&(p.method=t.method);const h=Rn.encode(p),v=new URL(`?${h}`,"https://payment-mini.zalo.me").toString();return yield e.openWebview({url:v,fail:e=>{throw e}}),{orderId:l}}catch(e){throw e}}))}checkTransaction(e,t){return i(this,void 0,void 0,(function*(){try{let n,{data:i}=t;if(i||(i=e.getRouteParams()),"object"==typeof i&&(n=i.appTransID||i.orderId||i.apptransid),"string"==typeof i){const e=Rn.getParameterByName("orderId",i),t=Rn.getParameterByName("appTransID",i)||Rn.getParameterByName("apptransid",i);n=e||t}const r={headers:{authorization:"Bearer "}},a=yield e.getAccessToken({fail:e=>{throw kn.loginRequired}});r.headers.authorization=`Bearer ${a}`;const s=new URL(Tn),l={transId:n||"",appId:o(this,mo,"f")};s.search=new URLSearchParams(l).toString();const c=yield fetch(s.toString(),r),u=yield c.json();if(!u.data||0!==u.err)throw kn.badRequest(u.msg);const d=u.data||{};return{msg:d.resultMessage,orderId:d.orderId,resultCode:d.resultCode,transTime:d.transTime,createdAt:d.createAt,transId:d.transId}}catch(e){throw e}}))}}mo=new WeakMap;class To{constructor(){go.set(this,Kt)}static getInstance(){return To.instance||(To.instance=new To),To.instance}createOrder(e,t){return Promise.resolve({orderId:""})}checkTransaction(e,t){const n={msg:"Success",orderId:"",resultCode:1,transTime:(new Date).getTime().toString(),createdAt:(new Date).getTime().toString(),transId:""};return Promise.resolve(n)}}go=new WeakMap;class bo{constructor(e){yo.set(this,void 0),_o.set(this,void 0),r(this,yo,this.getInstance(),"f"),r(this,_o,e,"f")}createOrder(e){return o(this,yo,"f").createOrder(o(this,_o,"f"),e)}checkTransaction(e){return o(this,yo,"f").checkTransaction(o(this,_o,"f"),e)}}yo=new WeakMap,_o=new WeakMap,t([Pn,vo,n(0,ho("object",{amount:Qn(["string","number"]),desc:Qn("string"),"method?":Qn("string",{values:["MOMO","ZALOPAY","MOMO_SANDBOX","ZALOPAY_SANDBOX","CC","CC_SANDBOX","ATM","ATM_SANDBOX"]})}))],bo.prototype,"createOrder",null),t([Pn,vo],bo.prototype,"checkTransaction",null);class wo extends bo{getInstance(){return Oo.getInstance()}}class No extends bo{getInstance(){return To.getInstance()}}const Po=Wn();e.default=void 0,window.onJSCall=e=>function(t){si.getInstance().onJSCall(e,t)},window.onMultiJSCall=e=>function(t){si.getInstance().onMultiJSCall(e,t)},window.zaloJSV2={zalo_h5_event_handler:function(e,t,n){si.getInstance().nativeEventHandler(e,t,n)}},e.Payment=void 0,Po.isZalo?(e.default=new So,e.Payment=new wo(e.default)):(e.default=new Ao,e.Payment=new No(e.default)),window.ZaloMiniAppSDK=e.default,e.SDKCreator=Eo,e.default=e.default,Object.defineProperty(e,"__esModule",{value:!0})}));
|