@vkontakte/js-sdk
Advanced tools
Comparing version 0.2.6 to 0.2.8
@@ -1,1 +0,1 @@ | ||
!function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=3)}([function(e,t){!function(t){var o=[],n=void 0!==t&&!t.AndroidBridge&&!t.webkit,r=n?"message":"VKWebAppEvent";void 0!==t&&(t.CustomEvent||function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var o=document.createEvent("CustomEvent");return o.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),o}e.prototype=t.Event.prototype,t.CustomEvent=e}(),t.addEventListener(r,function(){var e=Array.prototype.slice.call(arguments),t=o.slice();n?t.forEach(function(t){t({detail:e[0].data})}):t.forEach(function(t){t.apply(null,e)})})),e.exports={send:function(e,o){o||(o={});var n=void 0!==t,r=n&&t.AndroidBridge,i=n&&t.webkit&&t.webkit.messageHandlers,a=!r&&!i;r&&"function"==typeof r[e]&&r[e](JSON.stringify(o)),i&&i[e]&&"function"==typeof i[e].postMessage&&i[e].postMessage(o),a&&parent.postMessage({handler:e,params:o,type:"vk-connect"},"*")},subscribe:function(e){o.push(e)},unsubscribe:function(e){var t=o.indexOf(e);t>-1&&o.splice(t,1)},supports:function(e){var o=void 0!==t,n=o&&t.AndroidBridge,r=o&&t.webkit&&t.webkit.messageHandlers;return!(!n||"function"!=typeof n[e])||(!(!r||!r[e]||"function"!=typeof r[e].postMessage)||!(r||n||!~["VKWebAppGetAuthToken","VKWebAppCallAPIMethod","VKWebAppGetGeodata","VKWebAppGetUserInfo","VKWebAppGetPhoneNumber","VKWebAppGetClientVersion","VKWebAppOpenPayForm","VKWebAppShare","VKWebAppAllowNotifications","VKWebAppDenyNotifications","VKWebAppShowWallPostBox","VKWebAppGetEmail","VKWebAppAllowMessagesFromGroup","VKWebAppJoinGroup","VKWebAppOpenApp","VKWebAppSetLocation","VKWebAppScroll","VKWebAppResizeWindow"].indexOf(e)))}}}(window)},function(e,t,o){"use strict";var n=o(0),r=o.n(n);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=[],n=!0,r=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(o.push(a.value),!t||o.length!==t);n=!0);}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}return o}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function a(e){return e&&"[object Function]"===Object.prototype.toString.call(e)}function u(){return window.AndroidBridge}function s(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return"";var o=[],n=t?"?":"";for(var r in e)if(e.hasOwnProperty(r)){var i=e[r=encodeURIComponent(r)]||"";i=i.toString(),i=encodeURIComponent(i),o.push("".concat(r,"=").concat(i))}return o.length?n+o.join("&"):""}function c(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var p=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.proxy=t,this.methodName="",this.deprecatedMethodName="",this.successEvent="",this.failedEvent="",this.resultEvents=[],this.params2QsForDepredcated=!0}var t,o,n;return t=e,(o=[{key:"getResultEvents",value:function(){return this.resultEvents.length||(this.successEvent&&this.resultEvents.push(this.successEvent),this.failedEvent&&this.resultEvents.push(this.failedEvent)),this.resultEvents}},{key:"request",value:function(){throw new Error("Method ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"response",value:function(e){throw new Error("Response event handler for ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"deprecatedResponse",value:function(){throw new Error("Response handler for ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"eventToStatus",value:function(e){var t=e.type;return e=e.data,t===this.successEvent?"success":e.error_data.error_reason||"fail"}}])&&c(t.prototype,o),n&&c(t,n),e}();function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function y(e,t){return!t||"object"!==l(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var b=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=y(this,d(t).call(this,e))).successEvent=t.successEven,o.failedEvent=t.failedEvent,o.methodName=t.methodName,o.deprecatedMethodName="VKWebAppApiCall",o.params2QsForDepredcated=!1,o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e,o,n){var i=r.a.supports(this.methodName),u=(new Date).getUTCMilliseconds().toString();o.access_token=this.proxy.getQueryParam("access_token");var c={method:e,request_id:u,params:o};i||(c.callbackId=u,c.query=s(c.params),delete c.params,delete c.request_id),a(n)&&(t.callbacks[u]=n),i?this.proxy.call(this,c):this.proxy.apiCall(this,c)}},{key:"response",value:function(e){var o=e.data,n=t.callbacks[o.request_id];a(n)&&n(o),delete t.callbacks[o.request_id]}}])&&f(o.prototype,n),i&&f(o,i),t}();b.methodName="VKWebAppCallAPIMethod",b.successEven="VKWebAppCallAPIMethodResult",b.failedEvent="VKWebAppCallAPIMethodFailed",b.callbacks={};var v,m={};function w(e){if(a(m[e])){for(var t=arguments.length,o=new Array(t>1?t-1:0),n=1;n<t;n++)o[n-1]=arguments[n];m[e].apply(m,o)}}function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function O(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _(e,t){return!t||"object"!==g(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function k(e){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function S(e,t){return(S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function x(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var E=(x(v={},2,"friends"),x(v,4,"photos"),x(v,16,"video"),x(v,64,"stories"),x(v,128,"pages"),x(v,1024,"status"),x(v,2048,"notes"),x(v,8192,"wall"),x(v,32768,"ads"),x(v,1<<17,"docs"),x(v,1<<18,"groups"),x(v,1<<20,"stats"),x(v,1<<27,"market"),v),A=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=_(this,k(t).call(this,e))).methodName="VKWebAppGetAuthToken",o.deprecatedMethodName="showSettingsBox",o.successEvent="VKWebAppAccessTokenReceived",o.failedEvent="VKWebAppAccessTokenFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&S(e,t)}(t,p),o=t,(n=[{key:"maskToScope",value:function(e){var t=[];for(var o in E)E.hasOwnProperty(o)&&+o&+e&&t.push(E[o]);return t.join(",")}},{key:"request",value:function(e){if(e<0)throw new Error("Mask must be more 0");var t;t=r.a.supports(this.methodName)?{scope:this.maskToScope(e),app_id:+this.proxy.getQueryParam("vk_app_id")||+this.proxy.getQueryParam("api_id")}:{mask:e,access_token:this.proxy.getQueryParam("access_token")},this.proxy.call(this,t)}},{key:"tokenRequest",value:function(){this.proxy.call(this,{app_id:+this.proxy.getQueryParam("vk_app_id")||+this.proxy.getQueryParam("api_id"),scope:this.proxy.getQueryParam("vk_access_token_settings")||this.maskToScope(this.proxy.getQueryParam("api_settings"))||""})}},{key:"deprecatedResponse",value:function(e,t){"success"===e&&t&&this.proxy.setQueryParam("access_token",t),w("onSettingsBoxDone",e,t)}},{key:"response",value:function(e){var t=this.eventToStatus(e);"success"===t&&this.proxy.setQueryParam("access_token",e.data.access_token),w("onSettingsBoxDone",t,e.data.access_token)}}])&&O(o.prototype,n),i&&O(o,i),t}();function P(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function j(){var e=document.getElementById("debug");if(e){for(var t=arguments.length,o=new Array(t),n=0;n<t;n++)o[n]=arguments[n];e.innerHTML+=JSON.stringify(o)+"<br>"}}var M=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.queryParams=t,this.methods={},this.methodEvents={},this.initVkUiConnectListener()}var t,o,n;return t=e,(o=[{key:"initVkUiConnectApp",value:function(){if(this.isVKUiConnectSupport()&&(j("init vk connect"),r.a.send("VKWebAppInit",{}),!this.getQueryParam("access_token"))){var e=new A(this);this.addMethod(e),this.addMethod(e),e.tokenRequest()}}},{key:"initVkUiConnectListener",value:function(){var e=this;r.a.subscribe(function(t){var o=t.detail||{},n=o.type;j("eventName",n),j("eventData",o),e.methodEvents[n]&&e.methodEvents[n].response(o)})}},{key:"addPublicMethods",value:function(e){var t=this;Object.keys(e).forEach(function(o){var n=e[o];t.addMethod(n)})}},{key:"addMethod",value:function(e){var t=this,o=e.getResultEvents();o.length&&o.forEach(function(o){t.methodEvents[o]=e}),this.methods[e.methodName]=e,e.deprecatedMethodName&&(this.methods[e.deprecatedMethodName]=e)}},{key:"setQueryParam",value:function(e,t){this.queryParams[e]=t}},{key:"getQueryParam",value:function(e){return this.queryParams[e]}},{key:"call",value:function(e,t){if(j("proxy.call",e.methodName,t),r.a.supports(e.methodName))j("proxy.call - vk ui connect",e.methodName,t),r.a.send(e.methodName,t);else if(e.deprecatedMethodName&&!this.isVKUiConnectSupport()){var o=e.params2QsForDepredcated?s(t):t;u()?(j("proxy.call - old android",e.deprecatedMethodName,o),window.AndroidBridge.callMethod(e.deprecatedMethodName,o)):(j("proxy.call - old ios/web",e.deprecatedMethodName,o),r.a.send(e.deprecatedMethodName,o))}else j(e.methodName,"is not implemented"),e.response({type:e.failedEvent,data:{error_type:"client",error_data:{error_code:1,error_reason:"not_implemented",error_description:"This method not implemented"}}})}},{key:"apiCall",value:function(e,t){j("proxy.apiCall",e.methodName,t),u()?window.AndroidBridge.apiCall(t.method,t.query,t.callbackId):this.call(e,t)}},{key:"response",value:function(e){for(var t,o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];if(j.apply(void 0,["proxy.response",e].concat(n)),!this.methods[e])throw new Error("Method "+e+" is undefined or invalid");(t=this.methods[e]).deprecatedResponse.apply(t,n)}},{key:"apiResponse",value:function(e,t){j("proxy.apiResponse",e,t);var o={type:b.successEven,data:{request_id:e,response:t.response}};this.methods[b.methodName].response(o)}},{key:"isVKUiConnectSupport",value:function(){return r.a.supports("VKWebAppInit")||r.a.supports("VKWebAppGetAuthToken")}}])&&P(t.prototype,o),n&&P(t,n),e}();function V(e){return(V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function K(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function N(e,t){return!t||"object"!==V(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function W(e,t){return(W=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var B=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=N(this,T(t).call(this,e))).methodName="VKWebAppShowInviteBox",o.deprecatedMethodName="showInviteBox",o.successEvent="VKWebAppShowInviteBoxResult",o.failedEvent="VKWebAppShowInviteBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&W(e,t)}(t,p),o=t,(n=[{key:"request",value:function(){this.proxy.call(this,{})}},{key:"deprecatedResponse",value:function(e,t){w("onInviteBoxDone",e,t=t||[])}},{key:"response",value:function(e){w("onInviteBoxDone",this.eventToStatus(e),e.data.notSentIds||[])}}])&&K(o.prototype,n),r&&K(o,r),t}();function C(e){return(C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function R(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function q(e,t){return!t||"object"!==C(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function F(e){return(F=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function I(e,t){return(I=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var D=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=q(this,F(t).call(this,e))).methodName="VKWebAppShowRequestBox",o.deprecatedMethodName="showRequestBox",o.successEvent="VKWebAppShowRequestBoxResult",o.failedEvent="VKWebAppShowRequestBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&I(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e,t,o){if(e<=0)throw new Error("UID must be more 0");this.proxy.call(this,{uid:e,message:t,requestKey:o})}},{key:"deprecatedResponse",value:function(e,t){w("onRequestBoxDone",e,t)}},{key:"response",value:function(e){w("onRequestBoxDone",this.eventToStatus(e),e.data.request_id)}}])&&R(o.prototype,n),r&&R(o,r),t}();function Q(e){return(Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function G(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function U(e,t){return!t||"object"!==Q(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function H(e,t){return(H=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var J=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=U(this,L(t).call(this,e))).methodName="VKWebAppShowOrderBox",o.deprecatedMethodName="showOrderBox",o.successEvent="VKWebAppShowOrderBoxResult",o.failedEvent="VKWebAppShowOrderBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&H(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e){var t={};if("object"!==Q(e))throw new Error("Order box params must be object");if(void 0===e.type)throw new Error("Order box param type must be string");switch(e.type){case"votes":if("number"!=typeof e.votes)throw new Error("Order box param votes must be int");t.type="votes",t.votes=e.votes;break;case"item":if("string"!=typeof e.item)throw new Error("Order box param item must be string");t.type="item",t.item=e.item;break;default:throw new Error("Order box param type with invalid value")}this.proxy.call(this,t)}},{key:"deprecatedResponse",value:function(e){w("onOrderBoxDone",e)}},{key:"response",value:function(e){w("onOrderBoxDone",this.eventToStatus(e))}}])&&G(o.prototype,n),r&&G(o,r),t}();function z(e){return(z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function X(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Y(e,t){return!t||"object"!==z(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Z(e){return(Z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $(e,t){return($=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ee=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=Y(this,Z(t).call(this,e))).methodName="VKWebAppShare",o.deprecatedMethodName="showShareBox",o.successEvent="VKWebAppShareResult",o.failedEvent="VKWebAppShareFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&$(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e,t,o){var n;n=r.a.supports(this.methodName)?{}:{message:e,attachments:t,target:o||"wall"},this.proxy.call(this,n)}},{key:"response",value:function(e){w("onShareBoxDone",this.eventToStatus(e))}},{key:"deprecatedResponse",value:function(e){w("onShareBoxDone",e)}}])&&X(o.prototype,n),i&&X(o,i),t}();function te(e){return(te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function oe(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ne(e,t){return!t||"object"!==te(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function re(e){return(re=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ie(e,t){return(ie=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ae=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=ne(this,re(t).call(this,e))).methodName="VKWebAppShowLeaderBoardBox",o.deprecatedMethodName="showLeaderboardBox",o.successEvent="VKWebAppShowLeaderBoardBoxResult",o.failedEvent="VKWebAppShowLeaderBoardBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ie(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e){var t={user_result:e};this.proxy.call(this,t)}},{key:"deprecatedResponse",value:function(e){w("onLeaderboardBoxDone",e)}},{key:"response",value:function(e){w("onLeaderboardBoxDone",this.eventToStatus(e))}}])&&oe(o.prototype,n),r&&oe(o,r),t}();function ue(e){return(ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function se(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ce(e,t){return!t||"object"!==ue(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function pe(e){return(pe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function le(e,t){return(le=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var fe=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=ce(this,pe(t).call(this,e))).methodName="VKWebAppAddToFavorites",o.deprecatedMethodName="addToMenu",o.successEvent="VKWebAppAddToFavoritesResult",o.failedEvent="VKWebAppAddToFavoritesFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&le(e,t)}(t,p),o=t,(n=[{key:"request",value:function(){this.proxy.call(this,{})}},{key:"response",value:function(e){w("onAddToMenuDone",this.eventToStatus(e))}},{key:"deprecatedResponse",value:function(e){w("onAddToMenuDone",e)}}])&&se(o.prototype,n),r&&se(o,r),t}();function ye(e){return(ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function de(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function he(e,t){return!t||"object"!==ye(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function be(e){return(be=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ve(e,t){return(ve=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var me=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=he(this,be(t).call(this,e))).methodName="VKWebAppAllowMessagesFromGroup",o.deprecatedMethodName="showAllowMessagesFromCommunityBox",o.successEvent="VKWebAppAllowMessagesFromGroupResult",o.failedEvent="VKWebAppAllowMessagesFromGroupFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ve(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e){var t={};r.a.supports(this.methodName)?t.group_id=+e:t.groupId=+e,this.proxy.call(this,t)}},{key:"response",value:function(e){"success"===this.eventToStatus(e)?w("onAllowMessagesFromCommunity"):w("onAllowMessagesFromCommunityCancel")}},{key:"deprecatedResponse",value:function(e){w("success"===e?"onAllowMessagesFromCommunity":"onAllowMessagesFromCommunityCancel")}}])&&de(o.prototype,n),i&&de(o,i),t}();function we(){return(we=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function ge(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=[],n=!0,r=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(o.push(a.value),!t||o.length!==t);n=!0);}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}return o}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Oe(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}o.d(t,"a",function(){return _e});var _e=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.version=null,this.funcs={},this.proxy=null}var t,o,n;return t=e,(o=[{key:"init",value:function(e,t,o,n){var r=this.initQueryParams(n);r?(o&&(this.version=o),this.proxy=new M(r),this.initMethods(),this.proxy.initVkUiConnectApp(),a(e)&&e()):a(t)&&t()}},{key:"initMethods",value:function(){this.apiMethod=new b(this.proxy),this.proxy.addMethod(this.apiMethod),this.funcs.showSettingsBox=new A(this.proxy),this.funcs.showInviteBox=new B(this.proxy),this.funcs.showRequestBox=new D(this.proxy),this.funcs.showOrderBox=new J(this.proxy),this.funcs.showLeaderboardBox=new ae(this.proxy),this.funcs.showShareBox=new ee(this.proxy),this.funcs.addToMenu=new fe(this.proxy),this.funcs.showAllowMessagesFromCommunityBox=new me(this.proxy),this.proxy.addPublicMethods(this.funcs)}},{key:"initQueryParams",value:function(e){if(~(e=e||window.location.search).indexOf("?")){var t=e.split("?");e=ge(t,2)[1]}return!!e.length&&function(e){var t={};return(e=e.toString().trim()).length?(e.split("&").forEach(function(e){var o=i(e.split("="),2),n=o[0],r=o[1];n=decodeURIComponent(n),r=decodeURIComponent(r||""),t[n]=r}),t):t}(e)}},{key:"addCallback",value:function(e,t){!function(e,t){a(t)&&(m[e]=t)}(e,t)}},{key:"removeCallback",value:function(e){!function(e){delete m[e]}(e)}},{key:"callMethod",value:function(e){if(!this.proxy)throw new Error("Sdk is not init");var t=this.funcs[e];if(void 0===t||!a(t.request))throw new Error("Method "+e+" is not supported or invalid");for(var o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];t.request.apply(t,n)}},{key:"api",value:function(e,t,o){we(t=t||{},{v:t.v||this.version}),this.apiMethod.request(e,t,o)}}])&&Oe(t.prototype,o),n&&Oe(t,n),e}()},,function(e,t,o){"use strict";o.r(t);var n=o(1);o.d(t,"MobileSdk",function(){return n.a})}]); | ||
!function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=3)}([function(e,t,o){!function(){function t(e){return"function"==typeof e}var o=[],n=null,r="undefined"!=typeof window,i=r&&window.AndroidBridge,a=r&&window.webkit&&window.webkit.messageHandlers,u=r&&!window.AndroidBridge&&!window.webkit,s=u?"message":"VKWebAppEvent";r&&(window.CustomEvent||function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var o=document.createEvent("CustomEvent");return o.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),o}e.prototype=window.Event.prototype,window.CustomEvent=e}(),window.addEventListener(s,function(){var e=Array.prototype.slice.call(arguments),t=o.slice();u?(Object.prototype.hasOwnProperty.call(e[0].data,"webFrameId")&&delete e[0].data.webFrameId,Object.prototype.hasOwnProperty.call(e[0].data,"connectVersion")&&delete e[0].data.connectVersion,e[0].data.type&&"VKWebAppSettings"===e[0].data.type?n=e[0].data.frameId:t.forEach(function(t){t({detail:e[0].data})})):t.forEach(function(t){t.apply(null,e)})}));var c={send:function(e,o){o||(o={}),i&&t(i[e])&&i[e](JSON.stringify(o)),a&&a[e]&&t(a[e].postMessage)&&a[e].postMessage(o),u&&parent.postMessage({handler:e,params:o,type:"vk-connect",webFrameId:n,connectVersion:"1.4.0"},"*")},subscribe:function(e){o.push(e)},unsubscribe:function(e){var t=o.indexOf(e);t>-1&&o.splice(t,1)},isWebView:function(){return!(!i&&!a)},supports:function(e){return!(!i||!t(i[e]))||(!!(a&&a[e]&&t(a[e].postMessage))||!(a||i||!~["VKWebAppInit","VKWebAppGetCommunityAuthToken","VKWebAppAddToCommunity","VKWebAppGetUserInfo","VKWebAppSetLocation","VKWebAppGetClientVersion","VKWebAppGetPhoneNumber","VKWebAppGetEmail","VKWebAppGetGeodata","VKWebAppSetTitle","VKWebAppGetAuthToken","VKWebAppCallAPIMethod","VKWebAppJoinGroup","VKWebAppAllowMessagesFromGroup","VKWebAppDenyNotifications","VKWebAppAllowNotifications","VKWebAppOpenPayForm","VKWebAppOpenApp","VKWebAppShare","VKWebAppShowWallPostBox","VKWebAppScroll","VKWebAppResizeWindow","VKWebAppShowOrderBox","VKWebAppShowLeaderBoardBox","VKWebAppShowInviteBox","VKWebAppShowRequestBox","VKWebAppAddToFavorites"].indexOf(e)))}};e.exports=c}()},function(e,t,o){"use strict";var n=o(0),r=o.n(n);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=[],n=!0,r=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(o.push(a.value),!t||o.length!==t);n=!0);}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}return o}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function a(e){return e&&"[object Function]"===Object.prototype.toString.call(e)}function u(){return window.AndroidBridge}function s(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return"";var o=[],n=t?"?":"";for(var r in e)if(e.hasOwnProperty(r)){var i=e[r=encodeURIComponent(r)]||"";i=i.toString(),i=encodeURIComponent(i),o.push("".concat(r,"=").concat(i))}return o.length?n+o.join("&"):""}function c(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var p=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.proxy=t,this.methodName="",this.deprecatedMethodName="",this.successEvent="",this.failedEvent="",this.resultEvents=[],this.params2QsForDepredcated=!0}var t,o,n;return t=e,(o=[{key:"getResultEvents",value:function(){return this.resultEvents.length||(this.successEvent&&this.resultEvents.push(this.successEvent),this.failedEvent&&this.resultEvents.push(this.failedEvent)),this.resultEvents}},{key:"request",value:function(){throw new Error("Method ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"response",value:function(e){throw new Error("Response event handler for ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"deprecatedResponse",value:function(){throw new Error("Response handler for ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"eventToStatus",value:function(e){var t=e.type;return e=e.data,t===this.successEvent?"success":e.error_data.error_reason||"fail"}}])&&c(t.prototype,o),n&&c(t,n),e}();function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function y(e,t){return!t||"object"!==l(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var b=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=y(this,d(t).call(this,e))).successEvent=t.successEven,o.failedEvent=t.failedEvent,o.methodName=t.methodName,o.deprecatedMethodName="VKWebAppApiCall",o.params2QsForDepredcated=!1,o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e,o,n){var i=r.a.supports(this.methodName),u=(new Date).getUTCMilliseconds().toString();o.access_token=this.proxy.getQueryParam("access_token");var c={method:e,request_id:u,params:o};i||(c.callbackId=u,c.query=s(c.params),delete c.params,delete c.request_id),a(n)&&(t.callbacks[u]=n),i?this.proxy.call(this,c):this.proxy.apiCall(this,c)}},{key:"response",value:function(e){var o=e.data,n=t.callbacks[o.request_id];a(n)&&n(o),delete t.callbacks[o.request_id]}}])&&f(o.prototype,n),i&&f(o,i),t}();b.methodName="VKWebAppCallAPIMethod",b.successEven="VKWebAppCallAPIMethodResult",b.failedEvent="VKWebAppCallAPIMethodFailed",b.callbacks={};var m,v={};function w(e){if(a(v[e])){for(var t=arguments.length,o=new Array(t>1?t-1:0),n=1;n<t;n++)o[n-1]=arguments[n];v[e].apply(v,o)}}function O(e){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function g(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function S(e,t){return!t||"object"!==O(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function k(e,t){return(k=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function x(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var A=(x(m={},2,"friends"),x(m,4,"photos"),x(m,16,"video"),x(m,64,"stories"),x(m,128,"pages"),x(m,1024,"status"),x(m,2048,"notes"),x(m,8192,"wall"),x(m,32768,"ads"),x(m,1<<17,"docs"),x(m,1<<18,"groups"),x(m,1<<20,"stats"),x(m,1<<27,"market"),m),E=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=S(this,_(t).call(this,e))).methodName="VKWebAppGetAuthToken",o.deprecatedMethodName="showSettingsBox",o.successEvent="VKWebAppAccessTokenReceived",o.failedEvent="VKWebAppAccessTokenFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&k(e,t)}(t,p),o=t,(n=[{key:"maskToScope",value:function(e){var t=[];for(var o in A)A.hasOwnProperty(o)&&+o&+e&&t.push(A[o]);return t.join(",")}},{key:"request",value:function(e){if(e<0)throw new Error("Mask must be more 0");var t;t=r.a.supports(this.methodName)?{scope:this.maskToScope(e),app_id:+this.proxy.getQueryParam("vk_app_id")||+this.proxy.getQueryParam("api_id")}:{mask:e,access_token:this.proxy.getQueryParam("access_token")},this.proxy.call(this,t)}},{key:"tokenRequest",value:function(){this.proxy.call(this,{app_id:+this.proxy.getQueryParam("vk_app_id")||+this.proxy.getQueryParam("api_id"),scope:this.proxy.getQueryParam("vk_access_token_settings")||this.maskToScope(this.proxy.getQueryParam("api_settings"))||""})}},{key:"deprecatedResponse",value:function(e,t){"success"===e&&t&&this.proxy.setQueryParam("access_token",t),w("onSettingsBoxDone",e,t)}},{key:"response",value:function(e){var t=this.eventToStatus(e);"success"===t&&this.proxy.setQueryParam("access_token",e.data.access_token),w("onSettingsBoxDone",t,e.data.access_token)}}])&&g(o.prototype,n),i&&g(o,i),t}();function P(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function j(){var e=document.getElementById("debug");if(e){for(var t=arguments.length,o=new Array(t),n=0;n<t;n++)o[n]=arguments[n];e.innerHTML+=JSON.stringify(o)+"<br>"}}var V=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.queryParams=t,this.methods={},this.methodEvents={},this.initVkUiConnectListener()}var t,o,n;return t=e,(o=[{key:"initVkUiConnectApp",value:function(){if(this.isVKUiConnectSupport()&&(j("init vk connect"),r.a.send("VKWebAppInit",{}),!this.getQueryParam("access_token"))){var e=new E(this);this.addMethod(e),this.addMethod(e),e.tokenRequest()}}},{key:"initVkUiConnectListener",value:function(){var e=this;r.a.subscribe(function(t){var o=t.detail||{},n=o.type;j("eventName",n),j("eventData",o),e.methodEvents[n]&&e.methodEvents[n].response(o)})}},{key:"addPublicMethods",value:function(e){var t=this;Object.keys(e).forEach(function(o){var n=e[o];t.addMethod(n)})}},{key:"addMethod",value:function(e){var t=this,o=e.getResultEvents();o.length&&o.forEach(function(o){t.methodEvents[o]=e}),this.methods[e.methodName]=e,e.deprecatedMethodName&&(this.methods[e.deprecatedMethodName]=e)}},{key:"setQueryParam",value:function(e,t){this.queryParams[e]=t}},{key:"getQueryParam",value:function(e){return this.queryParams[e]}},{key:"call",value:function(e,t){if(j("proxy.call",e.methodName,t),r.a.supports(e.methodName))j("proxy.call - vk ui connect",e.methodName,t),r.a.send(e.methodName,t);else if(e.deprecatedMethodName&&!this.isVKUiConnectSupport()){var o=e.params2QsForDepredcated?s(t):t;u()?(j("proxy.call - old android",e.deprecatedMethodName,o),window.AndroidBridge.callMethod(e.deprecatedMethodName,o)):(j("proxy.call - old ios/web",e.deprecatedMethodName,o),r.a.send(e.deprecatedMethodName,o))}else j(e.methodName,"is not implemented"),e.response({type:e.failedEvent,data:{error_type:"client",error_data:{error_code:1,error_reason:"not_implemented",error_description:"This method not implemented"}}})}},{key:"apiCall",value:function(e,t){j("proxy.apiCall",e.methodName,t),u()?window.AndroidBridge.apiCall(t.method,t.query,t.callbackId):this.call(e,t)}},{key:"response",value:function(e){for(var t,o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];if(j.apply(void 0,["proxy.response",e].concat(n)),!this.methods[e])throw new Error("Method "+e+" is undefined or invalid");(t=this.methods[e]).deprecatedResponse.apply(t,n)}},{key:"apiResponse",value:function(e,t){j("proxy.apiResponse",e,t);var o={type:b.successEven,data:{request_id:e,response:t.response}};this.methods[b.methodName].response(o)}},{key:"isVKUiConnectSupport",value:function(){return r.a.supports("VKWebAppInit")||r.a.supports("VKWebAppGetAuthToken")}}])&&P(t.prototype,o),n&&P(t,n),e}();function M(e){return(M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function K(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function W(e,t){return!t||"object"!==M(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function B(e,t){return(B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var N=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=W(this,T(t).call(this,e))).methodName="VKWebAppShowInviteBox",o.deprecatedMethodName="showInviteBox",o.successEvent="VKWebAppShowInviteBoxResult",o.failedEvent="VKWebAppShowInviteBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&B(e,t)}(t,p),o=t,(n=[{key:"request",value:function(){this.proxy.call(this,{})}},{key:"deprecatedResponse",value:function(e,t){w("onInviteBoxDone",e,t=t||[])}},{key:"response",value:function(e){w("onInviteBoxDone",this.eventToStatus(e),e.data.notSentIds||[])}}])&&K(o.prototype,n),r&&K(o,r),t}();function C(e){return(C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function R(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function q(e,t){return!t||"object"!==C(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function I(e){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function F(e,t){return(F=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var D=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=q(this,I(t).call(this,e))).methodName="VKWebAppShowRequestBox",o.deprecatedMethodName="showRequestBox",o.successEvent="VKWebAppShowRequestBoxResult",o.failedEvent="VKWebAppShowRequestBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&F(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e,t,o){if(e<=0)throw new Error("UID must be more 0");this.proxy.call(this,{uid:e,message:t,requestKey:o})}},{key:"deprecatedResponse",value:function(e,t){w("onRequestBoxDone",e,t)}},{key:"response",value:function(e){w("onRequestBoxDone",this.eventToStatus(e),e.data.request_id)}}])&&R(o.prototype,n),r&&R(o,r),t}();function Q(e){return(Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function G(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function U(e,t){return!t||"object"!==Q(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function J(e,t){return(J=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var H=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=U(this,L(t).call(this,e))).methodName="VKWebAppShowOrderBox",o.deprecatedMethodName="showOrderBox",o.successEvent="VKWebAppShowOrderBoxResult",o.failedEvent="VKWebAppShowOrderBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&J(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e){var t={};if("object"!==Q(e))throw new Error("Order box params must be object");if(void 0===e.type)throw new Error("Order box param type must be string");switch(e.type){case"votes":if("number"!=typeof e.votes)throw new Error("Order box param votes must be int");t.type="votes",t.votes=e.votes;break;case"item":if("string"!=typeof e.item)throw new Error("Order box param item must be string");t.type="item",t.item=e.item;break;default:throw new Error("Order box param type with invalid value")}this.proxy.call(this,t)}},{key:"deprecatedResponse",value:function(e){w("onOrderBoxDone",e)}},{key:"response",value:function(e){w("onOrderBoxDone",this.eventToStatus(e))}}])&&G(o.prototype,n),r&&G(o,r),t}();function z(e){return(z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function X(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Y(e,t){return!t||"object"!==z(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Z(e){return(Z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $(e,t){return($=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ee=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=Y(this,Z(t).call(this,e))).methodName="VKWebAppShare",o.deprecatedMethodName="showShareBox",o.successEvent="VKWebAppShareResult",o.failedEvent="VKWebAppShareFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&$(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e,t,o){var n;n=r.a.supports(this.methodName)?{}:{message:e,attachments:t,target:o||"wall"},this.proxy.call(this,n)}},{key:"response",value:function(e){w("onShareBoxDone",this.eventToStatus(e))}},{key:"deprecatedResponse",value:function(e){w("onShareBoxDone",e)}}])&&X(o.prototype,n),i&&X(o,i),t}();function te(e){return(te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function oe(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ne(e,t){return!t||"object"!==te(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function re(e){return(re=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ie(e,t){return(ie=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ae=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=ne(this,re(t).call(this,e))).methodName="VKWebAppShowLeaderBoardBox",o.deprecatedMethodName="showLeaderboardBox",o.successEvent="VKWebAppShowLeaderBoardBoxResult",o.failedEvent="VKWebAppShowLeaderBoardBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ie(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e){var t={user_result:e};this.proxy.call(this,t)}},{key:"deprecatedResponse",value:function(e){w("onLeaderboardBoxDone",e)}},{key:"response",value:function(e){w("onLeaderboardBoxDone",this.eventToStatus(e))}}])&&oe(o.prototype,n),r&&oe(o,r),t}();function ue(e){return(ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function se(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ce(e,t){return!t||"object"!==ue(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function pe(e){return(pe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function le(e,t){return(le=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var fe=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=ce(this,pe(t).call(this,e))).methodName="VKWebAppAddToFavorites",o.deprecatedMethodName="addToMenu",o.successEvent="VKWebAppAddToFavoritesResult",o.failedEvent="VKWebAppAddToFavoritesFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&le(e,t)}(t,p),o=t,(n=[{key:"request",value:function(){this.proxy.call(this,{})}},{key:"response",value:function(e){w("onAddToMenuDone",this.eventToStatus(e))}},{key:"deprecatedResponse",value:function(e){w("onAddToMenuDone",e)}}])&&se(o.prototype,n),r&&se(o,r),t}();function ye(e){return(ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function de(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function he(e,t){return!t||"object"!==ye(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function be(e){return(be=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function me(e,t){return(me=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ve=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=he(this,be(t).call(this,e))).methodName="VKWebAppAllowMessagesFromGroup",o.deprecatedMethodName="showAllowMessagesFromCommunityBox",o.successEvent="VKWebAppAllowMessagesFromGroupResult",o.failedEvent="VKWebAppAllowMessagesFromGroupFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&me(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e){var t={};r.a.supports(this.methodName)?t.group_id=+e:t.groupId=+e,this.proxy.call(this,t)}},{key:"response",value:function(e){"success"===this.eventToStatus(e)?w("onAllowMessagesFromCommunity"):w("onAllowMessagesFromCommunityCancel")}},{key:"deprecatedResponse",value:function(e){w("success"===e?"onAllowMessagesFromCommunity":"onAllowMessagesFromCommunityCancel")}}])&&de(o.prototype,n),i&&de(o,i),t}();function we(){return(we=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function Oe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=[],n=!0,r=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(o.push(a.value),!t||o.length!==t);n=!0);}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}return o}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function ge(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}o.d(t,"a",function(){return Se});var Se=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.version=null,this.funcs={},this.proxy=null}var t,o,n;return t=e,(o=[{key:"init",value:function(e,t,o,n){var r=this.initQueryParams(n);r?(o&&(this.version=o),this.proxy=new V(r),this.initMethods(),this.proxy.initVkUiConnectApp(),a(e)&&e()):a(t)&&t()}},{key:"initMethods",value:function(){this.apiMethod=new b(this.proxy),this.proxy.addMethod(this.apiMethod),this.funcs.showSettingsBox=new E(this.proxy),this.funcs.showInviteBox=new N(this.proxy),this.funcs.showRequestBox=new D(this.proxy),this.funcs.showOrderBox=new H(this.proxy),this.funcs.showLeaderboardBox=new ae(this.proxy),this.funcs.showShareBox=new ee(this.proxy),this.funcs.addToMenu=new fe(this.proxy),this.funcs.showAllowMessagesFromCommunityBox=new ve(this.proxy),this.proxy.addPublicMethods(this.funcs)}},{key:"initQueryParams",value:function(e){if(~(e=e||window.location.search).indexOf("?")){var t=e.split("?");e=Oe(t,2)[1]}return!!e.length&&function(e){var t={};return(e=e.toString().trim()).length?(e.split("&").forEach(function(e){var o=i(e.split("="),2),n=o[0],r=o[1];n=decodeURIComponent(n),r=decodeURIComponent(r||""),t[n]=r}),t):t}(e)}},{key:"addCallback",value:function(e,t){!function(e,t){a(t)&&(v[e]=t)}(e,t)}},{key:"removeCallback",value:function(e){!function(e){delete v[e]}(e)}},{key:"callMethod",value:function(e){if(!this.proxy)throw new Error("Sdk is not init");var t=this.funcs[e];if(void 0===t||!a(t.request))throw new Error("Method "+e+" is not supported or invalid");for(var o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];t.request.apply(t,n)}},{key:"api",value:function(e,t,o){we(t=t||{},{v:t.v||this.version}),this.apiMethod.request(e,t,o)}}])&&ge(t.prototype,o),n&&ge(t,n),e}()},,function(e,t,o){"use strict";o.r(t);var n=o(1);o.d(t,"MobileSdk",function(){return n.a})}]); |
@@ -1,1 +0,1 @@ | ||
!function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=2)}([function(e,t){!function(t){var o=[],n=void 0!==t&&!t.AndroidBridge&&!t.webkit,r=n?"message":"VKWebAppEvent";void 0!==t&&(t.CustomEvent||function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var o=document.createEvent("CustomEvent");return o.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),o}e.prototype=t.Event.prototype,t.CustomEvent=e}(),t.addEventListener(r,function(){var e=Array.prototype.slice.call(arguments),t=o.slice();n?t.forEach(function(t){t({detail:e[0].data})}):t.forEach(function(t){t.apply(null,e)})})),e.exports={send:function(e,o){o||(o={});var n=void 0!==t,r=n&&t.AndroidBridge,i=n&&t.webkit&&t.webkit.messageHandlers,a=!r&&!i;r&&"function"==typeof r[e]&&r[e](JSON.stringify(o)),i&&i[e]&&"function"==typeof i[e].postMessage&&i[e].postMessage(o),a&&parent.postMessage({handler:e,params:o,type:"vk-connect"},"*")},subscribe:function(e){o.push(e)},unsubscribe:function(e){var t=o.indexOf(e);t>-1&&o.splice(t,1)},supports:function(e){var o=void 0!==t,n=o&&t.AndroidBridge,r=o&&t.webkit&&t.webkit.messageHandlers;return!(!n||"function"!=typeof n[e])||(!(!r||!r[e]||"function"!=typeof r[e].postMessage)||!(r||n||!~["VKWebAppGetAuthToken","VKWebAppCallAPIMethod","VKWebAppGetGeodata","VKWebAppGetUserInfo","VKWebAppGetPhoneNumber","VKWebAppGetClientVersion","VKWebAppOpenPayForm","VKWebAppShare","VKWebAppAllowNotifications","VKWebAppDenyNotifications","VKWebAppShowWallPostBox","VKWebAppGetEmail","VKWebAppAllowMessagesFromGroup","VKWebAppJoinGroup","VKWebAppOpenApp","VKWebAppSetLocation","VKWebAppScroll","VKWebAppResizeWindow"].indexOf(e)))}}}(window)},function(e,t,o){"use strict";var n=o(0),r=o.n(n);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=[],n=!0,r=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(o.push(a.value),!t||o.length!==t);n=!0);}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}return o}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function a(e){return e&&"[object Function]"===Object.prototype.toString.call(e)}function u(){return window.AndroidBridge}function s(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return"";var o=[],n=t?"?":"";for(var r in e)if(e.hasOwnProperty(r)){var i=e[r=encodeURIComponent(r)]||"";i=i.toString(),i=encodeURIComponent(i),o.push("".concat(r,"=").concat(i))}return o.length?n+o.join("&"):""}function c(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var p=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.proxy=t,this.methodName="",this.deprecatedMethodName="",this.successEvent="",this.failedEvent="",this.resultEvents=[],this.params2QsForDepredcated=!0}var t,o,n;return t=e,(o=[{key:"getResultEvents",value:function(){return this.resultEvents.length||(this.successEvent&&this.resultEvents.push(this.successEvent),this.failedEvent&&this.resultEvents.push(this.failedEvent)),this.resultEvents}},{key:"request",value:function(){throw new Error("Method ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"response",value:function(e){throw new Error("Response event handler for ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"deprecatedResponse",value:function(){throw new Error("Response handler for ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"eventToStatus",value:function(e){var t=e.type;return e=e.data,t===this.successEvent?"success":e.error_data.error_reason||"fail"}}])&&c(t.prototype,o),n&&c(t,n),e}();function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function y(e,t){return!t||"object"!==l(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var b=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=y(this,d(t).call(this,e))).successEvent=t.successEven,o.failedEvent=t.failedEvent,o.methodName=t.methodName,o.deprecatedMethodName="VKWebAppApiCall",o.params2QsForDepredcated=!1,o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e,o,n){var i=r.a.supports(this.methodName),u=(new Date).getUTCMilliseconds().toString();o.access_token=this.proxy.getQueryParam("access_token");var c={method:e,request_id:u,params:o};i||(c.callbackId=u,c.query=s(c.params),delete c.params,delete c.request_id),a(n)&&(t.callbacks[u]=n),i?this.proxy.call(this,c):this.proxy.apiCall(this,c)}},{key:"response",value:function(e){var o=e.data,n=t.callbacks[o.request_id];a(n)&&n(o),delete t.callbacks[o.request_id]}}])&&f(o.prototype,n),i&&f(o,i),t}();b.methodName="VKWebAppCallAPIMethod",b.successEven="VKWebAppCallAPIMethodResult",b.failedEvent="VKWebAppCallAPIMethodFailed",b.callbacks={};var v,m={};function w(e){if(a(m[e])){for(var t=arguments.length,o=new Array(t>1?t-1:0),n=1;n<t;n++)o[n-1]=arguments[n];m[e].apply(m,o)}}function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function O(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _(e,t){return!t||"object"!==g(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function k(e){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function S(e,t){return(S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function x(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var E=(x(v={},2,"friends"),x(v,4,"photos"),x(v,16,"video"),x(v,64,"stories"),x(v,128,"pages"),x(v,1024,"status"),x(v,2048,"notes"),x(v,8192,"wall"),x(v,32768,"ads"),x(v,1<<17,"docs"),x(v,1<<18,"groups"),x(v,1<<20,"stats"),x(v,1<<27,"market"),v),A=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=_(this,k(t).call(this,e))).methodName="VKWebAppGetAuthToken",o.deprecatedMethodName="showSettingsBox",o.successEvent="VKWebAppAccessTokenReceived",o.failedEvent="VKWebAppAccessTokenFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&S(e,t)}(t,p),o=t,(n=[{key:"maskToScope",value:function(e){var t=[];for(var o in E)E.hasOwnProperty(o)&&+o&+e&&t.push(E[o]);return t.join(",")}},{key:"request",value:function(e){if(e<0)throw new Error("Mask must be more 0");var t;t=r.a.supports(this.methodName)?{scope:this.maskToScope(e),app_id:+this.proxy.getQueryParam("vk_app_id")||+this.proxy.getQueryParam("api_id")}:{mask:e,access_token:this.proxy.getQueryParam("access_token")},this.proxy.call(this,t)}},{key:"tokenRequest",value:function(){this.proxy.call(this,{app_id:+this.proxy.getQueryParam("vk_app_id")||+this.proxy.getQueryParam("api_id"),scope:this.proxy.getQueryParam("vk_access_token_settings")||this.maskToScope(this.proxy.getQueryParam("api_settings"))||""})}},{key:"deprecatedResponse",value:function(e,t){"success"===e&&t&&this.proxy.setQueryParam("access_token",t),w("onSettingsBoxDone",e,t)}},{key:"response",value:function(e){var t=this.eventToStatus(e);"success"===t&&this.proxy.setQueryParam("access_token",e.data.access_token),w("onSettingsBoxDone",t,e.data.access_token)}}])&&O(o.prototype,n),i&&O(o,i),t}();function P(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function j(){var e=document.getElementById("debug");if(e){for(var t=arguments.length,o=new Array(t),n=0;n<t;n++)o[n]=arguments[n];e.innerHTML+=JSON.stringify(o)+"<br>"}}var M=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.queryParams=t,this.methods={},this.methodEvents={},this.initVkUiConnectListener()}var t,o,n;return t=e,(o=[{key:"initVkUiConnectApp",value:function(){if(this.isVKUiConnectSupport()&&(j("init vk connect"),r.a.send("VKWebAppInit",{}),!this.getQueryParam("access_token"))){var e=new A(this);this.addMethod(e),this.addMethod(e),e.tokenRequest()}}},{key:"initVkUiConnectListener",value:function(){var e=this;r.a.subscribe(function(t){var o=t.detail||{},n=o.type;j("eventName",n),j("eventData",o),e.methodEvents[n]&&e.methodEvents[n].response(o)})}},{key:"addPublicMethods",value:function(e){var t=this;Object.keys(e).forEach(function(o){var n=e[o];t.addMethod(n)})}},{key:"addMethod",value:function(e){var t=this,o=e.getResultEvents();o.length&&o.forEach(function(o){t.methodEvents[o]=e}),this.methods[e.methodName]=e,e.deprecatedMethodName&&(this.methods[e.deprecatedMethodName]=e)}},{key:"setQueryParam",value:function(e,t){this.queryParams[e]=t}},{key:"getQueryParam",value:function(e){return this.queryParams[e]}},{key:"call",value:function(e,t){if(j("proxy.call",e.methodName,t),r.a.supports(e.methodName))j("proxy.call - vk ui connect",e.methodName,t),r.a.send(e.methodName,t);else if(e.deprecatedMethodName&&!this.isVKUiConnectSupport()){var o=e.params2QsForDepredcated?s(t):t;u()?(j("proxy.call - old android",e.deprecatedMethodName,o),window.AndroidBridge.callMethod(e.deprecatedMethodName,o)):(j("proxy.call - old ios/web",e.deprecatedMethodName,o),r.a.send(e.deprecatedMethodName,o))}else j(e.methodName,"is not implemented"),e.response({type:e.failedEvent,data:{error_type:"client",error_data:{error_code:1,error_reason:"not_implemented",error_description:"This method not implemented"}}})}},{key:"apiCall",value:function(e,t){j("proxy.apiCall",e.methodName,t),u()?window.AndroidBridge.apiCall(t.method,t.query,t.callbackId):this.call(e,t)}},{key:"response",value:function(e){for(var t,o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];if(j.apply(void 0,["proxy.response",e].concat(n)),!this.methods[e])throw new Error("Method "+e+" is undefined or invalid");(t=this.methods[e]).deprecatedResponse.apply(t,n)}},{key:"apiResponse",value:function(e,t){j("proxy.apiResponse",e,t);var o={type:b.successEven,data:{request_id:e,response:t.response}};this.methods[b.methodName].response(o)}},{key:"isVKUiConnectSupport",value:function(){return r.a.supports("VKWebAppInit")||r.a.supports("VKWebAppGetAuthToken")}}])&&P(t.prototype,o),n&&P(t,n),e}();function V(e){return(V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function K(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function N(e,t){return!t||"object"!==V(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function W(e,t){return(W=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var B=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=N(this,T(t).call(this,e))).methodName="VKWebAppShowInviteBox",o.deprecatedMethodName="showInviteBox",o.successEvent="VKWebAppShowInviteBoxResult",o.failedEvent="VKWebAppShowInviteBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&W(e,t)}(t,p),o=t,(n=[{key:"request",value:function(){this.proxy.call(this,{})}},{key:"deprecatedResponse",value:function(e,t){w("onInviteBoxDone",e,t=t||[])}},{key:"response",value:function(e){w("onInviteBoxDone",this.eventToStatus(e),e.data.notSentIds||[])}}])&&K(o.prototype,n),r&&K(o,r),t}();function C(e){return(C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function R(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function q(e,t){return!t||"object"!==C(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function F(e){return(F=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function I(e,t){return(I=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var D=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=q(this,F(t).call(this,e))).methodName="VKWebAppShowRequestBox",o.deprecatedMethodName="showRequestBox",o.successEvent="VKWebAppShowRequestBoxResult",o.failedEvent="VKWebAppShowRequestBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&I(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e,t,o){if(e<=0)throw new Error("UID must be more 0");this.proxy.call(this,{uid:e,message:t,requestKey:o})}},{key:"deprecatedResponse",value:function(e,t){w("onRequestBoxDone",e,t)}},{key:"response",value:function(e){w("onRequestBoxDone",this.eventToStatus(e),e.data.request_id)}}])&&R(o.prototype,n),r&&R(o,r),t}();function Q(e){return(Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function G(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function U(e,t){return!t||"object"!==Q(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function H(e,t){return(H=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var J=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=U(this,L(t).call(this,e))).methodName="VKWebAppShowOrderBox",o.deprecatedMethodName="showOrderBox",o.successEvent="VKWebAppShowOrderBoxResult",o.failedEvent="VKWebAppShowOrderBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&H(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e){var t={};if("object"!==Q(e))throw new Error("Order box params must be object");if(void 0===e.type)throw new Error("Order box param type must be string");switch(e.type){case"votes":if("number"!=typeof e.votes)throw new Error("Order box param votes must be int");t.type="votes",t.votes=e.votes;break;case"item":if("string"!=typeof e.item)throw new Error("Order box param item must be string");t.type="item",t.item=e.item;break;default:throw new Error("Order box param type with invalid value")}this.proxy.call(this,t)}},{key:"deprecatedResponse",value:function(e){w("onOrderBoxDone",e)}},{key:"response",value:function(e){w("onOrderBoxDone",this.eventToStatus(e))}}])&&G(o.prototype,n),r&&G(o,r),t}();function z(e){return(z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function X(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Y(e,t){return!t||"object"!==z(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Z(e){return(Z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $(e,t){return($=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ee=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=Y(this,Z(t).call(this,e))).methodName="VKWebAppShare",o.deprecatedMethodName="showShareBox",o.successEvent="VKWebAppShareResult",o.failedEvent="VKWebAppShareFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&$(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e,t,o){var n;n=r.a.supports(this.methodName)?{}:{message:e,attachments:t,target:o||"wall"},this.proxy.call(this,n)}},{key:"response",value:function(e){w("onShareBoxDone",this.eventToStatus(e))}},{key:"deprecatedResponse",value:function(e){w("onShareBoxDone",e)}}])&&X(o.prototype,n),i&&X(o,i),t}();function te(e){return(te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function oe(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ne(e,t){return!t||"object"!==te(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function re(e){return(re=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ie(e,t){return(ie=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ae=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=ne(this,re(t).call(this,e))).methodName="VKWebAppShowLeaderBoardBox",o.deprecatedMethodName="showLeaderboardBox",o.successEvent="VKWebAppShowLeaderBoardBoxResult",o.failedEvent="VKWebAppShowLeaderBoardBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ie(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e){var t={user_result:e};this.proxy.call(this,t)}},{key:"deprecatedResponse",value:function(e){w("onLeaderboardBoxDone",e)}},{key:"response",value:function(e){w("onLeaderboardBoxDone",this.eventToStatus(e))}}])&&oe(o.prototype,n),r&&oe(o,r),t}();function ue(e){return(ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function se(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ce(e,t){return!t||"object"!==ue(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function pe(e){return(pe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function le(e,t){return(le=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var fe=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=ce(this,pe(t).call(this,e))).methodName="VKWebAppAddToFavorites",o.deprecatedMethodName="addToMenu",o.successEvent="VKWebAppAddToFavoritesResult",o.failedEvent="VKWebAppAddToFavoritesFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&le(e,t)}(t,p),o=t,(n=[{key:"request",value:function(){this.proxy.call(this,{})}},{key:"response",value:function(e){w("onAddToMenuDone",this.eventToStatus(e))}},{key:"deprecatedResponse",value:function(e){w("onAddToMenuDone",e)}}])&&se(o.prototype,n),r&&se(o,r),t}();function ye(e){return(ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function de(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function he(e,t){return!t||"object"!==ye(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function be(e){return(be=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ve(e,t){return(ve=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var me=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=he(this,be(t).call(this,e))).methodName="VKWebAppAllowMessagesFromGroup",o.deprecatedMethodName="showAllowMessagesFromCommunityBox",o.successEvent="VKWebAppAllowMessagesFromGroupResult",o.failedEvent="VKWebAppAllowMessagesFromGroupFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ve(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e){var t={};r.a.supports(this.methodName)?t.group_id=+e:t.groupId=+e,this.proxy.call(this,t)}},{key:"response",value:function(e){"success"===this.eventToStatus(e)?w("onAllowMessagesFromCommunity"):w("onAllowMessagesFromCommunityCancel")}},{key:"deprecatedResponse",value:function(e){w("success"===e?"onAllowMessagesFromCommunity":"onAllowMessagesFromCommunityCancel")}}])&&de(o.prototype,n),i&&de(o,i),t}();function we(){return(we=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function ge(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=[],n=!0,r=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(o.push(a.value),!t||o.length!==t);n=!0);}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}return o}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Oe(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}o.d(t,"a",function(){return _e});var _e=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.version=null,this.funcs={},this.proxy=null}var t,o,n;return t=e,(o=[{key:"init",value:function(e,t,o,n){var r=this.initQueryParams(n);r?(o&&(this.version=o),this.proxy=new M(r),this.initMethods(),this.proxy.initVkUiConnectApp(),a(e)&&e()):a(t)&&t()}},{key:"initMethods",value:function(){this.apiMethod=new b(this.proxy),this.proxy.addMethod(this.apiMethod),this.funcs.showSettingsBox=new A(this.proxy),this.funcs.showInviteBox=new B(this.proxy),this.funcs.showRequestBox=new D(this.proxy),this.funcs.showOrderBox=new J(this.proxy),this.funcs.showLeaderboardBox=new ae(this.proxy),this.funcs.showShareBox=new ee(this.proxy),this.funcs.addToMenu=new fe(this.proxy),this.funcs.showAllowMessagesFromCommunityBox=new me(this.proxy),this.proxy.addPublicMethods(this.funcs)}},{key:"initQueryParams",value:function(e){if(~(e=e||window.location.search).indexOf("?")){var t=e.split("?");e=ge(t,2)[1]}return!!e.length&&function(e){var t={};return(e=e.toString().trim()).length?(e.split("&").forEach(function(e){var o=i(e.split("="),2),n=o[0],r=o[1];n=decodeURIComponent(n),r=decodeURIComponent(r||""),t[n]=r}),t):t}(e)}},{key:"addCallback",value:function(e,t){!function(e,t){a(t)&&(m[e]=t)}(e,t)}},{key:"removeCallback",value:function(e){!function(e){delete m[e]}(e)}},{key:"callMethod",value:function(e){if(!this.proxy)throw new Error("Sdk is not init");var t=this.funcs[e];if(void 0===t||!a(t.request))throw new Error("Method "+e+" is not supported or invalid");for(var o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];t.request.apply(t,n)}},{key:"api",value:function(e,t,o){we(t=t||{},{v:t.v||this.version}),this.apiMethod.request(e,t,o)}}])&&Oe(t.prototype,o),n&&Oe(t,n),e}()},function(e,t,o){"use strict";o.r(t);var n=o(1);window.VK||(window.VK=new n.a)}]); | ||
!function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=2)}([function(e,t,o){!function(){function t(e){return"function"==typeof e}var o=[],n=null,r="undefined"!=typeof window,i=r&&window.AndroidBridge,a=r&&window.webkit&&window.webkit.messageHandlers,u=r&&!window.AndroidBridge&&!window.webkit,s=u?"message":"VKWebAppEvent";r&&(window.CustomEvent||function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var o=document.createEvent("CustomEvent");return o.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),o}e.prototype=window.Event.prototype,window.CustomEvent=e}(),window.addEventListener(s,function(){var e=Array.prototype.slice.call(arguments),t=o.slice();u?(Object.prototype.hasOwnProperty.call(e[0].data,"webFrameId")&&delete e[0].data.webFrameId,Object.prototype.hasOwnProperty.call(e[0].data,"connectVersion")&&delete e[0].data.connectVersion,e[0].data.type&&"VKWebAppSettings"===e[0].data.type?n=e[0].data.frameId:t.forEach(function(t){t({detail:e[0].data})})):t.forEach(function(t){t.apply(null,e)})}));var c={send:function(e,o){o||(o={}),i&&t(i[e])&&i[e](JSON.stringify(o)),a&&a[e]&&t(a[e].postMessage)&&a[e].postMessage(o),u&&parent.postMessage({handler:e,params:o,type:"vk-connect",webFrameId:n,connectVersion:"1.4.0"},"*")},subscribe:function(e){o.push(e)},unsubscribe:function(e){var t=o.indexOf(e);t>-1&&o.splice(t,1)},isWebView:function(){return!(!i&&!a)},supports:function(e){return!(!i||!t(i[e]))||(!!(a&&a[e]&&t(a[e].postMessage))||!(a||i||!~["VKWebAppInit","VKWebAppGetCommunityAuthToken","VKWebAppAddToCommunity","VKWebAppGetUserInfo","VKWebAppSetLocation","VKWebAppGetClientVersion","VKWebAppGetPhoneNumber","VKWebAppGetEmail","VKWebAppGetGeodata","VKWebAppSetTitle","VKWebAppGetAuthToken","VKWebAppCallAPIMethod","VKWebAppJoinGroup","VKWebAppAllowMessagesFromGroup","VKWebAppDenyNotifications","VKWebAppAllowNotifications","VKWebAppOpenPayForm","VKWebAppOpenApp","VKWebAppShare","VKWebAppShowWallPostBox","VKWebAppScroll","VKWebAppResizeWindow","VKWebAppShowOrderBox","VKWebAppShowLeaderBoardBox","VKWebAppShowInviteBox","VKWebAppShowRequestBox","VKWebAppAddToFavorites"].indexOf(e)))}};e.exports=c}()},function(e,t,o){"use strict";var n=o(0),r=o.n(n);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=[],n=!0,r=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(o.push(a.value),!t||o.length!==t);n=!0);}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}return o}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function a(e){return e&&"[object Function]"===Object.prototype.toString.call(e)}function u(){return window.AndroidBridge}function s(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return"";var o=[],n=t?"?":"";for(var r in e)if(e.hasOwnProperty(r)){var i=e[r=encodeURIComponent(r)]||"";i=i.toString(),i=encodeURIComponent(i),o.push("".concat(r,"=").concat(i))}return o.length?n+o.join("&"):""}function c(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var p=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.proxy=t,this.methodName="",this.deprecatedMethodName="",this.successEvent="",this.failedEvent="",this.resultEvents=[],this.params2QsForDepredcated=!0}var t,o,n;return t=e,(o=[{key:"getResultEvents",value:function(){return this.resultEvents.length||(this.successEvent&&this.resultEvents.push(this.successEvent),this.failedEvent&&this.resultEvents.push(this.failedEvent)),this.resultEvents}},{key:"request",value:function(){throw new Error("Method ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"response",value:function(e){throw new Error("Response event handler for ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"deprecatedResponse",value:function(){throw new Error("Response handler for ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"eventToStatus",value:function(e){var t=e.type;return e=e.data,t===this.successEvent?"success":e.error_data.error_reason||"fail"}}])&&c(t.prototype,o),n&&c(t,n),e}();function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function y(e,t){return!t||"object"!==l(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var b=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=y(this,d(t).call(this,e))).successEvent=t.successEven,o.failedEvent=t.failedEvent,o.methodName=t.methodName,o.deprecatedMethodName="VKWebAppApiCall",o.params2QsForDepredcated=!1,o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e,o,n){var i=r.a.supports(this.methodName),u=(new Date).getUTCMilliseconds().toString();o.access_token=this.proxy.getQueryParam("access_token");var c={method:e,request_id:u,params:o};i||(c.callbackId=u,c.query=s(c.params),delete c.params,delete c.request_id),a(n)&&(t.callbacks[u]=n),i?this.proxy.call(this,c):this.proxy.apiCall(this,c)}},{key:"response",value:function(e){var o=e.data,n=t.callbacks[o.request_id];a(n)&&n(o),delete t.callbacks[o.request_id]}}])&&f(o.prototype,n),i&&f(o,i),t}();b.methodName="VKWebAppCallAPIMethod",b.successEven="VKWebAppCallAPIMethodResult",b.failedEvent="VKWebAppCallAPIMethodFailed",b.callbacks={};var m,v={};function w(e){if(a(v[e])){for(var t=arguments.length,o=new Array(t>1?t-1:0),n=1;n<t;n++)o[n-1]=arguments[n];v[e].apply(v,o)}}function O(e){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function g(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function S(e,t){return!t||"object"!==O(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function k(e,t){return(k=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function x(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var A=(x(m={},2,"friends"),x(m,4,"photos"),x(m,16,"video"),x(m,64,"stories"),x(m,128,"pages"),x(m,1024,"status"),x(m,2048,"notes"),x(m,8192,"wall"),x(m,32768,"ads"),x(m,1<<17,"docs"),x(m,1<<18,"groups"),x(m,1<<20,"stats"),x(m,1<<27,"market"),m),E=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=S(this,_(t).call(this,e))).methodName="VKWebAppGetAuthToken",o.deprecatedMethodName="showSettingsBox",o.successEvent="VKWebAppAccessTokenReceived",o.failedEvent="VKWebAppAccessTokenFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&k(e,t)}(t,p),o=t,(n=[{key:"maskToScope",value:function(e){var t=[];for(var o in A)A.hasOwnProperty(o)&&+o&+e&&t.push(A[o]);return t.join(",")}},{key:"request",value:function(e){if(e<0)throw new Error("Mask must be more 0");var t;t=r.a.supports(this.methodName)?{scope:this.maskToScope(e),app_id:+this.proxy.getQueryParam("vk_app_id")||+this.proxy.getQueryParam("api_id")}:{mask:e,access_token:this.proxy.getQueryParam("access_token")},this.proxy.call(this,t)}},{key:"tokenRequest",value:function(){this.proxy.call(this,{app_id:+this.proxy.getQueryParam("vk_app_id")||+this.proxy.getQueryParam("api_id"),scope:this.proxy.getQueryParam("vk_access_token_settings")||this.maskToScope(this.proxy.getQueryParam("api_settings"))||""})}},{key:"deprecatedResponse",value:function(e,t){"success"===e&&t&&this.proxy.setQueryParam("access_token",t),w("onSettingsBoxDone",e,t)}},{key:"response",value:function(e){var t=this.eventToStatus(e);"success"===t&&this.proxy.setQueryParam("access_token",e.data.access_token),w("onSettingsBoxDone",t,e.data.access_token)}}])&&g(o.prototype,n),i&&g(o,i),t}();function P(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function j(){var e=document.getElementById("debug");if(e){for(var t=arguments.length,o=new Array(t),n=0;n<t;n++)o[n]=arguments[n];e.innerHTML+=JSON.stringify(o)+"<br>"}}var V=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.queryParams=t,this.methods={},this.methodEvents={},this.initVkUiConnectListener()}var t,o,n;return t=e,(o=[{key:"initVkUiConnectApp",value:function(){if(this.isVKUiConnectSupport()&&(j("init vk connect"),r.a.send("VKWebAppInit",{}),!this.getQueryParam("access_token"))){var e=new E(this);this.addMethod(e),this.addMethod(e),e.tokenRequest()}}},{key:"initVkUiConnectListener",value:function(){var e=this;r.a.subscribe(function(t){var o=t.detail||{},n=o.type;j("eventName",n),j("eventData",o),e.methodEvents[n]&&e.methodEvents[n].response(o)})}},{key:"addPublicMethods",value:function(e){var t=this;Object.keys(e).forEach(function(o){var n=e[o];t.addMethod(n)})}},{key:"addMethod",value:function(e){var t=this,o=e.getResultEvents();o.length&&o.forEach(function(o){t.methodEvents[o]=e}),this.methods[e.methodName]=e,e.deprecatedMethodName&&(this.methods[e.deprecatedMethodName]=e)}},{key:"setQueryParam",value:function(e,t){this.queryParams[e]=t}},{key:"getQueryParam",value:function(e){return this.queryParams[e]}},{key:"call",value:function(e,t){if(j("proxy.call",e.methodName,t),r.a.supports(e.methodName))j("proxy.call - vk ui connect",e.methodName,t),r.a.send(e.methodName,t);else if(e.deprecatedMethodName&&!this.isVKUiConnectSupport()){var o=e.params2QsForDepredcated?s(t):t;u()?(j("proxy.call - old android",e.deprecatedMethodName,o),window.AndroidBridge.callMethod(e.deprecatedMethodName,o)):(j("proxy.call - old ios/web",e.deprecatedMethodName,o),r.a.send(e.deprecatedMethodName,o))}else j(e.methodName,"is not implemented"),e.response({type:e.failedEvent,data:{error_type:"client",error_data:{error_code:1,error_reason:"not_implemented",error_description:"This method not implemented"}}})}},{key:"apiCall",value:function(e,t){j("proxy.apiCall",e.methodName,t),u()?window.AndroidBridge.apiCall(t.method,t.query,t.callbackId):this.call(e,t)}},{key:"response",value:function(e){for(var t,o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];if(j.apply(void 0,["proxy.response",e].concat(n)),!this.methods[e])throw new Error("Method "+e+" is undefined or invalid");(t=this.methods[e]).deprecatedResponse.apply(t,n)}},{key:"apiResponse",value:function(e,t){j("proxy.apiResponse",e,t);var o={type:b.successEven,data:{request_id:e,response:t.response}};this.methods[b.methodName].response(o)}},{key:"isVKUiConnectSupport",value:function(){return r.a.supports("VKWebAppInit")||r.a.supports("VKWebAppGetAuthToken")}}])&&P(t.prototype,o),n&&P(t,n),e}();function K(e){return(K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function M(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function W(e,t){return!t||"object"!==K(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function B(e,t){return(B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var N=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=W(this,T(t).call(this,e))).methodName="VKWebAppShowInviteBox",o.deprecatedMethodName="showInviteBox",o.successEvent="VKWebAppShowInviteBoxResult",o.failedEvent="VKWebAppShowInviteBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&B(e,t)}(t,p),o=t,(n=[{key:"request",value:function(){this.proxy.call(this,{})}},{key:"deprecatedResponse",value:function(e,t){w("onInviteBoxDone",e,t=t||[])}},{key:"response",value:function(e){w("onInviteBoxDone",this.eventToStatus(e),e.data.notSentIds||[])}}])&&M(o.prototype,n),r&&M(o,r),t}();function C(e){return(C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function R(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function q(e,t){return!t||"object"!==C(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function I(e){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function F(e,t){return(F=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var D=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=q(this,I(t).call(this,e))).methodName="VKWebAppShowRequestBox",o.deprecatedMethodName="showRequestBox",o.successEvent="VKWebAppShowRequestBoxResult",o.failedEvent="VKWebAppShowRequestBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&F(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e,t,o){if(e<=0)throw new Error("UID must be more 0");this.proxy.call(this,{uid:e,message:t,requestKey:o})}},{key:"deprecatedResponse",value:function(e,t){w("onRequestBoxDone",e,t)}},{key:"response",value:function(e){w("onRequestBoxDone",this.eventToStatus(e),e.data.request_id)}}])&&R(o.prototype,n),r&&R(o,r),t}();function Q(e){return(Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function G(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function U(e,t){return!t||"object"!==Q(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function J(e,t){return(J=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var H=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=U(this,L(t).call(this,e))).methodName="VKWebAppShowOrderBox",o.deprecatedMethodName="showOrderBox",o.successEvent="VKWebAppShowOrderBoxResult",o.failedEvent="VKWebAppShowOrderBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&J(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e){var t={};if("object"!==Q(e))throw new Error("Order box params must be object");if(void 0===e.type)throw new Error("Order box param type must be string");switch(e.type){case"votes":if("number"!=typeof e.votes)throw new Error("Order box param votes must be int");t.type="votes",t.votes=e.votes;break;case"item":if("string"!=typeof e.item)throw new Error("Order box param item must be string");t.type="item",t.item=e.item;break;default:throw new Error("Order box param type with invalid value")}this.proxy.call(this,t)}},{key:"deprecatedResponse",value:function(e){w("onOrderBoxDone",e)}},{key:"response",value:function(e){w("onOrderBoxDone",this.eventToStatus(e))}}])&&G(o.prototype,n),r&&G(o,r),t}();function z(e){return(z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function X(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Y(e,t){return!t||"object"!==z(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Z(e){return(Z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $(e,t){return($=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ee=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=Y(this,Z(t).call(this,e))).methodName="VKWebAppShare",o.deprecatedMethodName="showShareBox",o.successEvent="VKWebAppShareResult",o.failedEvent="VKWebAppShareFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&$(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e,t,o){var n;n=r.a.supports(this.methodName)?{}:{message:e,attachments:t,target:o||"wall"},this.proxy.call(this,n)}},{key:"response",value:function(e){w("onShareBoxDone",this.eventToStatus(e))}},{key:"deprecatedResponse",value:function(e){w("onShareBoxDone",e)}}])&&X(o.prototype,n),i&&X(o,i),t}();function te(e){return(te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function oe(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ne(e,t){return!t||"object"!==te(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function re(e){return(re=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ie(e,t){return(ie=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ae=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=ne(this,re(t).call(this,e))).methodName="VKWebAppShowLeaderBoardBox",o.deprecatedMethodName="showLeaderboardBox",o.successEvent="VKWebAppShowLeaderBoardBoxResult",o.failedEvent="VKWebAppShowLeaderBoardBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ie(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e){var t={user_result:e};this.proxy.call(this,t)}},{key:"deprecatedResponse",value:function(e){w("onLeaderboardBoxDone",e)}},{key:"response",value:function(e){w("onLeaderboardBoxDone",this.eventToStatus(e))}}])&&oe(o.prototype,n),r&&oe(o,r),t}();function ue(e){return(ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function se(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ce(e,t){return!t||"object"!==ue(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function pe(e){return(pe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function le(e,t){return(le=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var fe=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=ce(this,pe(t).call(this,e))).methodName="VKWebAppAddToFavorites",o.deprecatedMethodName="addToMenu",o.successEvent="VKWebAppAddToFavoritesResult",o.failedEvent="VKWebAppAddToFavoritesFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&le(e,t)}(t,p),o=t,(n=[{key:"request",value:function(){this.proxy.call(this,{})}},{key:"response",value:function(e){w("onAddToMenuDone",this.eventToStatus(e))}},{key:"deprecatedResponse",value:function(e){w("onAddToMenuDone",e)}}])&&se(o.prototype,n),r&&se(o,r),t}();function ye(e){return(ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function de(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function he(e,t){return!t||"object"!==ye(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function be(e){return(be=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function me(e,t){return(me=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ve=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=he(this,be(t).call(this,e))).methodName="VKWebAppAllowMessagesFromGroup",o.deprecatedMethodName="showAllowMessagesFromCommunityBox",o.successEvent="VKWebAppAllowMessagesFromGroupResult",o.failedEvent="VKWebAppAllowMessagesFromGroupFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&me(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e){var t={};r.a.supports(this.methodName)?t.group_id=+e:t.groupId=+e,this.proxy.call(this,t)}},{key:"response",value:function(e){"success"===this.eventToStatus(e)?w("onAllowMessagesFromCommunity"):w("onAllowMessagesFromCommunityCancel")}},{key:"deprecatedResponse",value:function(e){w("success"===e?"onAllowMessagesFromCommunity":"onAllowMessagesFromCommunityCancel")}}])&&de(o.prototype,n),i&&de(o,i),t}();function we(){return(we=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function Oe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=[],n=!0,r=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(o.push(a.value),!t||o.length!==t);n=!0);}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}return o}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function ge(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}o.d(t,"a",function(){return Se});var Se=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.version=null,this.funcs={},this.proxy=null}var t,o,n;return t=e,(o=[{key:"init",value:function(e,t,o,n){var r=this.initQueryParams(n);r?(o&&(this.version=o),this.proxy=new V(r),this.initMethods(),this.proxy.initVkUiConnectApp(),a(e)&&e()):a(t)&&t()}},{key:"initMethods",value:function(){this.apiMethod=new b(this.proxy),this.proxy.addMethod(this.apiMethod),this.funcs.showSettingsBox=new E(this.proxy),this.funcs.showInviteBox=new N(this.proxy),this.funcs.showRequestBox=new D(this.proxy),this.funcs.showOrderBox=new H(this.proxy),this.funcs.showLeaderboardBox=new ae(this.proxy),this.funcs.showShareBox=new ee(this.proxy),this.funcs.addToMenu=new fe(this.proxy),this.funcs.showAllowMessagesFromCommunityBox=new ve(this.proxy),this.proxy.addPublicMethods(this.funcs)}},{key:"initQueryParams",value:function(e){if(~(e=e||window.location.search).indexOf("?")){var t=e.split("?");e=Oe(t,2)[1]}return!!e.length&&function(e){var t={};return(e=e.toString().trim()).length?(e.split("&").forEach(function(e){var o=i(e.split("="),2),n=o[0],r=o[1];n=decodeURIComponent(n),r=decodeURIComponent(r||""),t[n]=r}),t):t}(e)}},{key:"addCallback",value:function(e,t){!function(e,t){a(t)&&(v[e]=t)}(e,t)}},{key:"removeCallback",value:function(e){!function(e){delete v[e]}(e)}},{key:"callMethod",value:function(e){if(!this.proxy)throw new Error("Sdk is not init");var t=this.funcs[e];if(void 0===t||!a(t.request))throw new Error("Method "+e+" is not supported or invalid");for(var o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];t.request.apply(t,n)}},{key:"api",value:function(e,t,o){we(t=t||{},{v:t.v||this.version}),this.apiMethod.request(e,t,o)}}])&&ge(t.prototype,o),n&&ge(t,n),e}()},function(e,t,o){"use strict";o.r(t);var n=o(1);window.VK||(window.VK=new n.a)}]); |
{ | ||
"name": "@vkontakte/js-sdk", | ||
"version": "0.2.6", | ||
"version": "0.2.8", | ||
"description": "JavaScript sdk for vk.com", | ||
@@ -11,3 +11,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@vkontakte/vkui-connect": "^1.0.0" | ||
"@vkontakte/vkui-connect": "^1.5.0" | ||
}, | ||
@@ -14,0 +14,0 @@ "devDependencies": { |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
57602