-
Notifications
You must be signed in to change notification settings - Fork 0
/
fp.js
1 lines (1 loc) · 11.6 KB
/
fp.js
1
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.aliMiniUmfp=t():e.aliMiniUmfp=t()}(window,(function(){return function(e){var t={};function r(a){if(t[a])return t[a].exports;var n=t[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(a,n,function(t){return e[t]}.bind(null,n));return a},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="./",r(r.s=0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){"use strict";function a(){return"undefined"!=typeof wx?wx:"undefined"!=typeof my?my:window}function n(){return"undefined"!=typeof wx?"wx":"undefined"!=typeof my?"my":"h5"}r.r(t),r.d(t,"getToken",(function(){return S})),r.d(t,"version",(function(){return w})),r.d(t,"setFpConfig",(function(){return v})),r.d(t,"fp",(function(){return E}));var o=function(e,t){if(Array.prototype.forEach&&e.forEach===Array.prototype.forEach)e.forEach(t);else if(e.length===+e.length)for(var r=0,a=e.length;r<a;r++)t(e[r],r,e);else for(var n in e)e.hasOwnProperty(n)&&t(e[n],n,e)},i=function(e){var t=e.getExtension("WEBGL_lose_context");null!=t&&t.loseContext()},s=function(){var e,t=function(t){return e.clearColor(0,0,0,1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),"["+t[0]+", "+t[1]+"]"};if(!(e=function(){var e=wx.createOffscreenCanvas(),t=null;try{t=e.getContext("webgl")}catch(e){}return t||(t=null),t}()))return null;var r=[],a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a);var n=new Float32Array([-.2,-.9,0,.4,-.26,0,0,.732134444,0]);e.bufferData(e.ARRAY_BUFFER,n,e.STATIC_DRAW),a.itemSize=3,a.numItems=3;var s=e.createProgram(),u=e.createShader(e.VERTEX_SHADER);e.shaderSource(u,"attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){varyinTexCoordinate=attrVertex+uniformOffset;gl_Position=vec4(attrVertex,0,1);}"),e.compileShader(u);var c=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(c,"precision mediump float;varying vec2 varyinTexCoordinate;void main() {gl_FragColor=vec4(varyinTexCoordinate,0,1);}"),e.compileShader(c),e.attachShader(s,u),e.attachShader(s,c),e.linkProgram(s),e.useProgram(s),s.vertexPosAttrib=e.getAttribLocation(s,"attrVertex"),s.offsetUniform=e.getUniformLocation(s,"uniformOffset"),e.vertexAttribPointer(s.vertexPosAttrib,a.itemSize,e.FLOAT,!1,0,0),e.uniform2f(s.offsetUniform,1,1),e.drawArrays(e.TRIANGLE_STRIP,0,a.numItems);try{r.push(e.canvas.toDataURL())}catch(e){}r.push("extensions:"+(e.getSupportedExtensions()||[]).join(";")),r.push("webgl aliased line width range:"+t(e.getParameter(e.ALIASED_LINE_WIDTH_RANGE))),r.push("webgl aliased point size range:"+t(e.getParameter(e.ALIASED_POINT_SIZE_RANGE))),r.push("webgl alpha bits:"+e.getParameter(e.ALPHA_BITS)),r.push("webgl antialiasing:"+(e.getContextAttributes().antialias?"yes":"no")),r.push("webgl blue bits:"+e.getParameter(e.BLUE_BITS)),r.push("webgl depth bits:"+e.getParameter(e.DEPTH_BITS)),r.push("webgl green bits:"+e.getParameter(e.GREEN_BITS)),r.push("webgl max anisotropy:"+function(e){var t=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic");if(t){var r=e.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT);return 0===r&&(r=2),r}return null}(e)),r.push("webgl max combined texture image units:"+e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS)),r.push("webgl max cube map texture size:"+e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE)),r.push("webgl max fragment uniform vectors:"+e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS)),r.push("webgl max render buffer size:"+e.getParameter(e.MAX_RENDERBUFFER_SIZE)),r.push("webgl max texture image units:"+e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS)),r.push("webgl max texture size:"+e.getParameter(e.MAX_TEXTURE_SIZE)),r.push("webgl max varying vectors:"+e.getParameter(e.MAX_VARYING_VECTORS)),r.push("webgl max vertex attribs:"+e.getParameter(e.MAX_VERTEX_ATTRIBS)),r.push("webgl max vertex texture image units:"+e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)),r.push("webgl max vertex uniform vectors:"+e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS)),r.push("webgl max viewport dims:"+t(e.getParameter(e.MAX_VIEWPORT_DIMS))),r.push("webgl red bits:"+e.getParameter(e.RED_BITS)),r.push("webgl renderer:"+e.getParameter(e.RENDERER)),r.push("webgl shading language version:"+e.getParameter(e.SHADING_LANGUAGE_VERSION)),r.push("webgl stencil bits:"+e.getParameter(e.STENCIL_BITS)),r.push("webgl vendor:"+e.getParameter(e.VENDOR)),r.push("webgl version:"+e.getParameter(e.VERSION));try{var f=e.getExtension("WEBGL_debug_renderer_info");f&&(r.push("webgl unmasked vendor:"+e.getParameter(f.UNMASKED_VENDOR_WEBGL)),r.push("webgl unmasked renderer:"+e.getParameter(f.UNMASKED_RENDERER_WEBGL)))}catch(e){}return e.getShaderPrecisionFormat?(o(["FLOAT","INT"],(function(t){o(["VERTEX","FRAGMENT"],(function(a){o(["HIGH","MEDIUM","LOW"],(function(n){o(["precision","rangeMin","rangeMax"],(function(o){var i=e.getShaderPrecisionFormat(e[a+"_SHADER"],e[n+"_"+t])[o];"precision"!==o&&(o="precision "+o);var s=["webgl ",a.toLowerCase()," shader ",n.toLowerCase()," ",t.toLowerCase()," ",o,":",i].join("");r.push(s)}))}))}))})),i(e),r):(i(e),r)},u=a().getSystemInfoSync(),c=n();var f=function(){var e=[];return"wx"===c?(e.push("pixelRatio~"+u.pixelRatio),e.push("statusBarHeight~"+u.statusBarHeight),e.push("screenHeight~"+u.screenHeight),e.push("screenWidth~"+u.screenWidth),e.push("model~"+u.model),e.push("system~"+u.system),e.push("safeArea~"+u.safeArea.top+" "+u.safeArea.right+" "+u.safeArea.bottom+" "+u.safeArea.left+" "+u.safeArea.width+" "+u.safeArea.height),e.push("benchmarkLevel~"+u.benchmarkLevel),e.push("brand~"+u.brand),e.push("platform~"+u.platform),e.push("abi~"+u.abi)):"my"===c&&(e.push("pixelRatio~"+u.pixelRatio),e.push("statusBarHeight~"+u.statusBarHeight),e.push("screenHeight~"+u.screenHeight),e.push("screenWidth~"+u.screenWidth),void 0!==u.safeArea&&e.push("safeArea~"+u.safeArea.top+" "+u.safeArea.right+" "+u.safeArea.bottom+" "+u.safeArea.left+" "+u.safeArea.width+" "+u.safeArea.height),e.push("microphoneAuthorized~"+u.microphoneAuthorized),e.push("locationAuthorized~"+u.locationAuthorized),e.push("locationEnabled~"+u.locationEnabled),e.push("isIphoneXSeries~"+u.isIphoneXSeries),e.push("cameraAuthorized~"+u.cameraAuthorized),e.push("albumAuthorized~"+u.albumAuthorized),e.push("titleBarHeight~"+u.titleBarHeight),e.push("brand~"+u.brand),e.push("model~"+u.model),e.push("system~"+u.system),e.push("platform~"+u.platform)),e},h=function(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var r=[0,0,0,0];return r[3]+=e[3]+t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]+t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]+t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]+t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]},l=function(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var r=[0,0,0,0];return r[3]+=e[3]*t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]*t[3],r[1]+=r[2]>>>16,r[2]&=65535,r[2]+=e[3]*t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]*t[3],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[2]*t[2],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[3]*t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]},d=function(e,t){return 32===(t%=64)?[e[1],e[0]]:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t|e[0]>>>32-t]:(t-=32,[e[1]<<t|e[0]>>>32-t,e[0]<<t|e[1]>>>32-t])},g=function(e,t){return 0===(t%=64)?e:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t]:[e[1]<<t-32,0]},p=function(e,t){return[e[0]^t[0],e[1]^t[1]]},m=function(e){return e=p(e,[0,e[0]>>>1]),e=l(e,[4283543511,3981806797]),e=p(e,[0,e[0]>>>1]),e=l(e,[3301882366,444984403]),e=p(e,[0,e[0]>>>1])},A=function(e,t){t=t||0;for(var r=(e=e||"").length%16,a=e.length-r,n=[0,t],o=[0,t],i=[0,0],s=[0,0],u=[2277735313,289559509],c=[1291169091,658871167],f=0;f<a;f+=16)i=[255&e.charCodeAt(f+4)|(255&e.charCodeAt(f+5))<<8|(255&e.charCodeAt(f+6))<<16|(255&e.charCodeAt(f+7))<<24,255&e.charCodeAt(f)|(255&e.charCodeAt(f+1))<<8|(255&e.charCodeAt(f+2))<<16|(255&e.charCodeAt(f+3))<<24],s=[255&e.charCodeAt(f+12)|(255&e.charCodeAt(f+13))<<8|(255&e.charCodeAt(f+14))<<16|(255&e.charCodeAt(f+15))<<24,255&e.charCodeAt(f+8)|(255&e.charCodeAt(f+9))<<8|(255&e.charCodeAt(f+10))<<16|(255&e.charCodeAt(f+11))<<24],i=l(i,u),i=d(i,31),i=l(i,c),n=p(n,i),n=d(n,27),n=h(n,o),n=h(l(n,[0,5]),[0,1390208809]),s=l(s,c),s=d(s,33),s=l(s,u),o=p(o,s),o=d(o,31),o=h(o,n),o=h(l(o,[0,5]),[0,944331445]);switch(i=[0,0],s=[0,0],r){case 15:s=p(s,g([0,e.charCodeAt(f+14)],48));case 14:s=p(s,g([0,e.charCodeAt(f+13)],40));case 13:s=p(s,g([0,e.charCodeAt(f+12)],32));case 12:s=p(s,g([0,e.charCodeAt(f+11)],24));case 11:s=p(s,g([0,e.charCodeAt(f+10)],16));case 10:s=p(s,g([0,e.charCodeAt(f+9)],8));case 9:s=p(s,[0,e.charCodeAt(f+8)]),s=l(s,c),s=d(s,33),s=l(s,u),o=p(o,s);case 8:i=p(i,g([0,e.charCodeAt(f+7)],56));case 7:i=p(i,g([0,e.charCodeAt(f+6)],48));case 6:i=p(i,g([0,e.charCodeAt(f+5)],40));case 5:i=p(i,g([0,e.charCodeAt(f+4)],32));case 4:i=p(i,g([0,e.charCodeAt(f+3)],24));case 3:i=p(i,g([0,e.charCodeAt(f+2)],16));case 2:i=p(i,g([0,e.charCodeAt(f+1)],8));case 1:i=p(i,[0,e.charCodeAt(f)]),i=l(i,u),i=d(i,31),i=l(i,c),n=p(n,i)}return n=p(n,[0,e.length]),o=p(o,[0,e.length]),n=h(n,o),o=h(o,n),n=m(n),o=m(o),n=h(n,o),o=h(o,n),("00000000"+(n[0]>>>0).toString(16)).slice(-8)+("00000000"+(n[1]>>>0).toString(16)).slice(-8)+("00000000"+(o[0]>>>0).toString(16)).slice(-8)+("00000000"+(o[1]>>>0).toString(16)).slice(-8)};function E(e){try{var t=n(),r=[];"wx"===t?r=s().concat(f()):"my"===t&&(r=f()),e(A(r.join("~~~"),31))}catch(t){e(""),console.warn(t)}}var _={endpoint:"https://htw2.wrating.com",timeout:5e3,accessKey:"",storageKey:"_umfp"};function b(){return _}function v(e){return function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1;r<arguments.length;r++){var a=arguments[r];if(null!=a)for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t}(_,e)}var T="",x=a();function y(e,t){var r=b(),a=r.storageKey,n="function"==typeof e?e:function(){};E((function(e){var o={};e?(console.log("wid",e),x.request({url:r.endpoint+"/api/v1/init?requestId="+((+new Date).toString(36)+Math.random().toString(36).substr(2)),method:"POST",timeout:r.timeout||5e3,data:{header:{ztoken:t||"",sdkType:"wxmp",siteId:r.accessKey,canvasHashCode:e||""},accessKey:r.accessKey},success:function(e){console.log(e),(200===e.status||200===e.statusCode)&&e.data&&e.data.data&&200===e.data.code&&!0===e.data.success&&e.data.data.token?(T=e.data.data.token,o=e.data.data,x.setStorage({key:a,data:o})):(T="",x.removeStorage({key:a,success:function(e){console.log(e)}}),console.warn("Token get failed",e))},fail:function(e){console.log(e),console.warn("Token get failed",e)},complete:function(){n(o)}})):n(o)}))}function S(e){var t=b().storageKey,r="";T?y(e,T):x.getStorage({key:t,success:function(e){console.log("success",e.data),e.data&&e.data.token&&(r=e.data.token)},fail:function(e){console.log(e,"f")},complete:function(){console.log("complete"),y(e,r)}})}var w="SDK_VERSION"}])}));