You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
zhishifufei_php/public/static/js/jssdk-1.2.1.js

1 lines
14 KiB

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<e.length;)if(w.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:h}}function h(){return{value:void 0,done:!0}}e=function(){return d};var d={},g=Object.prototype,w=g.hasOwnProperty,y="function"==typeof Symbol?Symbol:{},m=y.iterator||"@@iterator",b=y.asyncIterator||"@@asyncIterator",E=y.toStringTag||"@@toStringTag";try{t({},"")}catch(e){t=function(e,t,n){return e[t]=n}}d.wrap=n;var L={},S={};t(S,m,function(){return this});var k=Object.getPrototypeOf,x=k&&k(k(v([])));x&&x!==g&&w.call(x,m)&&(S=x);var A=a.prototype=o.prototype=Object.create(S);return i.prototype=a,t(A,"constructor",a),t(a,"constructor",i),i.displayName=t(a,E,"GeneratorFunction"),d.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===i||"GeneratorFunction"===(t.displayName||t.name))},d.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,t(e,E,"GeneratorFunction")),e.prototype=Object.create(A),e},d.awrap=function(e){return{__await:e}},c(u.prototype),t(u.prototype,b,function(){return this}),d.AsyncIterator=u,d.async=function(e,t,r,o,i){void 0===i&&(i=Promise);var a=new u(n(e,t,r,o),i);return d.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},c(A),t(A,E,"Generator"),t(A,m,function(){return this}),t(A,"toString",function(){return"[object Generator]"}),d.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},d.values=v,p.prototype={constructor:p,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(l),!e)for(var t in this)"t"===t.charAt(0)&&w.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){function t(t,r){return i.type="throw",i.arg=e,n.next=t,r&&(n.method="next",n.arg=void 0),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=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<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&w.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,L):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),L},finish:function(e){for(var t=this.tryEntries.length-1;t>=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;o<r;o++)t+=String.fromCharCode(n[o]);return P(t)}function o(e){for(var t=F(e),n=t.length,r=new Uint8Array(n),o=0;o<n;o++)r[o]=t.charCodeAt(o);return r.buffer}function i(e){return{base64:r(e)}}function a(e){if(null!=e)return e.base64?o(e.base64):void 0}function c(e){return function(t){return Object.prototype.toString.call(t).toLowerCase()===("[object "+e+"]").toLowerCase()}}function u(e){if(!1===c("Object")(e))return e;var t=[];for(var n in e){var r=e[n];if(void 0!==r&&r instanceof ArrayBuffer&&void 0!==r.byteLength){var o=i(r);o.key=n,t.push(o)}}if(t.length>0){for(var a=0;a<t.length;a++)delete e[t[a].key];e.__nativeBuffers__=t}return e}function f(e){if(!1===c("Object")(e)||null==e.__nativeBuffers__)return e;var t=e.__nativeBuffers__;delete e.__nativeBuffers__;for(var n=0;n<t.length;n++){var r=t[n];if(null!=r){var o=a(r);void 0!==o&&o instanceof ArrayBuffer&&(e[r.key]=o)}}return e}function s(e,t){if(void 0!==e&&"function"==typeof O[t]&&""!==e&&null!==e){try{e=JSON.parse(e),e=C.unpack(e)}catch(t){e={}}O[t](e),delete O[t]}}function l(e,t,n){if(j&&M.needCache.find(function(t){return t===e}))return void N.push([e,t,n]);if(k)s(k.invoke(e,t,n),n);else{var r={event:e,paramsString:t,callbackId:n};x.messageHandlers.invoke.postMessage(r)}}function p(e,t,n){k?k.publish(e,t,n):x.messageHandlers.publish.postMessage({event:e,paramsString:t,webviewIds:n})}function v(e,t,n){t=C.pack(t);var r=JSON.stringify(t||{}),o=++I;O[o]=n,"openSchema"===e&&T.push(o),l(e,r,o)}function h(e,t){"string"==typeof t&&(t=JSON.parse(t)),t=C.unpack(t);var n=O[e];"function"==typeof n&&n(t),-1===T.indexOf(e)&&delete O[e]}function d(e,t){J[e]=t}function g(e,t,n){n=n||[],n=JSON.stringify(n),p("custom_event_"+e,JSON.stringify(t),n)}function w(e,t){B["custom_event_"+e]=t}function y(e,t,n,r){if(e===D.onAppEnterBackground)j=!0;else if(e===D.onAppEnterForeground)for(j=!1;N.length;)l.apply(null,N.shift());if(!j||!M.needDisabled.find(function(t){return t===e})){"string"==typeof t&&(t=JSON.parse(t)),t=C.unpack(t);var o=e.indexOf("custom_event_")>-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"}}}}}();