var tt=function(){"use strict";function e(){function t(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}function n(e,t,n,i){var a=t&&t.prototype instanceof o?t:o,c=Object.create(a.prototype),u=new p(i||[]);return c._invoke=function(e,t,n){var o="suspendedStart";return function(i,a){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===i)throw a;return h()}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=f(c,n);if(u){if(u===L)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===o)throw o="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o="executing";var s=r(e,t,n);if("normal"===s.type){if(o=n.done?"completed":"suspendedYield",s.arg===L)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o="completed",n.method="throw",n.arg=s.arg)}}}(e,n,u),c}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function o(){}function i(){}function a(){}function c(e){["next","throw","return"].forEach(function(n){t(e,n,function(e){return this._invoke(n,e)})})}function u(e,t){function n(o,i,a,c){var u=r(e[o],e,i);if("throw"!==u.type){var f=u.arg,s=f.value;return s&&"object"==typeof s&&w.call(s,"__await")?t.resolve(s.__await).then(function(e){n("next",e,a,c)},function(e){n("throw",e,a,c)}):t.resolve(s).then(function(e){f.value=e,a(f)},function(e){return n("throw",e,a,c)})}c(u.arg)}var o;this._invoke=function(e,r){function i(){return new t(function(t,o){n(e,r,t,o)})}return o=o?o.then(i,i):i()}}function f(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,f(e,t),"throw"===t.method))return L;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return L}var o=r(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,L;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,L):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,L)}function s(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function l(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function p(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(s,this),this.reset(!0)}function v(e){if(e){var t=e[m];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n=0;--r){var o=this.tryEntries[r],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=w.call(o,"catchLoc"),c=w.call(o,"finallyLoc");if(a&&c){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&w.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),l(n),L}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;l(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:v(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),L}},d}function t(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function n(e){return function(){var n=this,r=arguments;return new Promise(function(o,i){function a(e){t(u,o,i,a,c,"next",e)}function c(e){t(u,o,i,a,c,"throw",e)}var u=e.apply(n,r);a(void 0)})}}function r(e){for(var t="",n=new Uint8Array(e),r=n.byteLength,o=0;o0){for(var a=0;a-1?B[e]:J[e];"function"==typeof o&&o(t,n,r)}}function m(e){e()}function b(){var e=Array.prototype.slice.call(arguments);e[1]={data:e[1],options:{timestamp:Date.now()}},m(function(){R.publish.apply(R,e)})}function E(){var e=Array.prototype.slice.call(arguments),t=e[1];e[1]=function(e,n){"string"==typeof e&&(e=JSON.parse(e));var r=e.data;"function"==typeof t&&t(r,n)},m(function(){R.subscribe.apply(R,e)})}function L(e){var t=e.name,n=void 0===e.type?"sdk":e.type,r=void 0===e.args?{}:e.args,o=void 0===e.ext?{}:e.ext;U[G]={success:r.success||V,fail:r.fail||V,complete:r.complete||V},H[G]={beforeAll:o.beforeAll||V,beforeSuccess:o.beforeSuccess||V,afterSuccess:o.afterSuccess||V,beforeFail:o.beforeFail||V,afterFail:o.afterFail||V,afterAll:o.afterAll||V},b("invokeAppServiceMethod",{name:t,type:n,args:r,callbackId:G}),G+=1}var S=new Function("return this;")(),k=S.ttJSCore,x=S.webkit;S.ttJSCore&&(S.ttJSCore={onDocumentReady:function(){return k.onDocumentReady()}});var A=navigator.userAgent.toLocaleLowerCase().includes("toutiaomicroapp");S.webkit&&A&&(S.webkit={messageHandlers:{onDocumentReady:{postMessage:function(){return x.messageHandlers.onDocumentReady.postMessage("")}}}});var _="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",P=P||function(e){for(var t,n,r=String(e),o="",i=0,a=_;r.charAt(0|i)||(a="=",i%1);o+=a.charAt(63&t>>8-i%1*8)){if((n=r.charCodeAt(i+=.75))>255)throw new Error('"btoa" failed');t=t<<8|n}return o},F=F||function(e){var t=String(e).replace(/=+$/,""),n="";if(t.length%4==1)throw new Error('"atob" failed');for(var r,o,i=0,a=0;o=t.charAt(a++);~o&&(r=i%4?64*r+o:o,i++%4)?n+=String.fromCharCode(255&r>>(-2*i&6)):0)o=_.indexOf(o);return n},C={new:i,get:a,pack:u,unpack:f},O={},I=0,J={},B={},N=[],j=!1,T=[],D={onAppEnterBackground:"onAppEnterBackground",onAppEnterForeground:"onAppEnterForeground"},M={needCache:["showModal","showToast","showActionSheet","hideToast"],needDisabled:["onAccelerometerChange","onCompassChange"]},R={on:d,publish:g,invoke:v,subscribe:w};S.ttJSBridge={get invokeHandler(){return h},get subscribeHandler(){return y}};var G=0,U=[],H=[],V=function(){};E("callbackAppServiceMethod",function(e){var t=e.res,n=e.isSuccess,r=e.callbackId,o=U[r],i=H[r];i.beforeAll(t),n?(i.beforeSuccess(t),o.success(t),i.afterSuccess(t)):(i.beforeFail(t),o.fail(t),i.afterFail(t)),o.complete(t),i.afterAll(t)});var Y={previewShowLiveRoomEvent:"onPreviewShowLiveRoom",previewJumpIntoLiveRoomEvent:"onPreviewJumpIntoLiveRoom",previewErrorEvent:"onPreviewError",previewShowFollowBtnEvent:"onPreviewShowFollowBtn",previewJumpIntoAwemePageEvent:"onPreviewJumpIntoAwemePage",previewFollowUpEvent:"onPreviewFollowUp",previewComponentDestroyedEvent:"onPreviewComponentDestroyed"},q=new Map,z=function(e,t){q.set(e,t)};E("livePreviewContextEvent",function(e){var t=e.eventName,n=e.payload,r=void 0===n?void 0:n;q.get(t)(r)});var K=function(e,t,n){L({name:e,args:t,ext:n,type:"jssdk"})};return{miniProgram:{createLivePreview:function(t){var r,o,i=new Promise(function(e,t){r=e,o=t});return K("createLivePreview",t,{beforeSuccess:function(){r()},beforeFail:function(e){o(e)}}),{show:function(){function t(){return r.apply(this,arguments)}var r=n(e().mark(function t(){return e().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,i;case 3:K("livePreviewContextShow"),e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(0),new Error(e.t0);case 9:case"end":return e.stop()}},t,null,[[0,6]])}));return t}(),destroy:function(){function t(){return r.apply(this,arguments)}var r=n(e().mark(function t(){return e().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,i;case 3:K("livePreviewContextDestroy"),e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(0),new Error(e.t0);case 9:case"end":return e.stop()}},t,null,[[0,6]])}));return t}(),onShowLiveRoom:function(e){z(Y.previewShowLiveRoomEvent,e)},onJumpIntoLiveRoom:function(e){z(Y.previewJumpIntoLiveRoomEvent,e)},onError:function(e){z(Y.previewErrorEvent,e)},onShowFollowBtn:function(e){z(Y.previewShowFollowBtnEvent,e)},onJumpIntoAwemePage:function(e){z(Y.previewJumpIntoAwemePageEvent,e)},onFollowUp:function(e){z(Y.previewFollowUpEvent,e)},onComponentDestroyed:function(e){z(Y.previewComponentDestroyedEvent,e)}}},redirectTo:function(e){K("redirectTo",e)},navigateTo:function(e){K("navigateTo",e)},switchTab:function(e){K("switchTab",e)},reLaunch:function(e){K("reLaunch",e)},navigateBack:function(e){K("navigateBack",e)},postMessage:function(e){e&&K("postMessage",e)},setSwipeBackModeSync:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;K("setSwipeBackMode",{mode:e})},checkJsApi:function(e){K("checkJsApi",e)},getEnv:function(e){if(!A)return e({miniProgram:!1});K("getEnv",{useCache:!0,complete:function(t){e({systemInfo:t,miniprogram:A})}})},chooseImage:function(e){K("chooseImage",e)},compressImage:function(e){K("compressImage",e)},previewImage:function(e){K("previewImage",e)},uploadFile:function(e){K("uploadFile",e)},getNetworkType:function(e){K("getNetworkType",e)},openLocation:function(e){K("openLocation",e)},getLocation:function(e){K("getLocation",e)},getVersionInfo:function(){return{jssdkVersion:"1.2.1"}}}}}();