@blazes/captcha 1.0.22 → 1.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +85 -0
- package/dist/api.d.ts +0 -1
- package/dist/captcha.d.ts +2 -0
- package/dist/image-url.d.ts +8 -7
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -15
- package/dist/index.js.map +1 -1
- package/dist/lang.d.ts +51 -0
- package/dist/style.css +1 -1
- package/dist/template.d.ts +5 -4
- package/dist/type.d.ts +4 -4
- package/dist/utils.d.ts +0 -17
- package/package.json +15 -4
package/Readme.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# 背景
|
|
2
|
+
|
|
3
|
+
点击发送验证码按钮时候,用户需要将图片滑动至指定位置,才会真正发送。
|
|
4
|
+
防止玩家或者脚本等频繁调用验证码接口。
|
|
5
|
+
|
|
6
|
+
# 安装
|
|
7
|
+
|
|
8
|
+
npm
|
|
9
|
+
|
|
10
|
+
```shell
|
|
11
|
+
npm install @blazes/captcha
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
yarn
|
|
15
|
+
|
|
16
|
+
```shell
|
|
17
|
+
yarn add @blazes/captcha
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
CDN
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<head>
|
|
24
|
+
...
|
|
25
|
+
<link
|
|
26
|
+
rel="stylesheet"
|
|
27
|
+
href="https://captcha.resource.pandadagames.com/statics/style.css"
|
|
28
|
+
/>
|
|
29
|
+
</head>
|
|
30
|
+
<body></body>
|
|
31
|
+
<script src="https://captcha.resource.pandadagames.com/statics/index.js"></script>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
# API
|
|
35
|
+
|
|
36
|
+
## 实例化参数
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
| 属性 | 说明 | 必填 | 类型 |
|
|
41
|
+
| --- | ---- | --- | --- |
|
|
42
|
+
| appId | 接入的应用 id | 是 | string |
|
|
43
|
+
| version | 版本信息,不同版本产生背景图不一样,目前只有 v1 | 是 | string |
|
|
44
|
+
| baseUrl | 后端地址,需要配置 cors | 是 | string |
|
|
45
|
+
| success | 验证成功后的回调函数 | 是 | (token: string) => string |
|
|
46
|
+
| lang | 语言 | 是 | 枚举,hans | hant | ja | en | ko |
|
|
47
|
+
|
|
48
|
+
## 方法
|
|
49
|
+
|
|
50
|
+
| 名称 | 说明 | 入参 | 回参 |
|
|
51
|
+
| --- | --- | --- | --- |
|
|
52
|
+
| show | 显示验证码。验证成功会返回 token 的 promise | 无 | Promise<string> |
|
|
53
|
+
| resetConfig | 重置配置 | 和实例化传入参数一致,但都是选填。 | 无 |
|
|
54
|
+
|
|
55
|
+
# 使用
|
|
56
|
+
|
|
57
|
+
## CDN 引入
|
|
58
|
+
|
|
59
|
+
```Typescript
|
|
60
|
+
const myCaptcha = new yh_captcha.Captcha({
|
|
61
|
+
appId: "giftcode",
|
|
62
|
+
version: "v1",
|
|
63
|
+
baseUrl: "http://52.74.243.209:18081"
|
|
64
|
+
success: function (token) {},
|
|
65
|
+
lang: "ja",
|
|
66
|
+
});
|
|
67
|
+
myCaptcha.show().then(() => {});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## npm引入
|
|
71
|
+
|
|
72
|
+
```Typescript
|
|
73
|
+
import { Captcha, Language } from "@blazes/captcha";
|
|
74
|
+
import "@blazes/captcha/dist/style.css";
|
|
75
|
+
|
|
76
|
+
const myCaptcha = new Captcha({
|
|
77
|
+
appId: "giftcode",
|
|
78
|
+
version: "v1",
|
|
79
|
+
baseUrl: "http://52.74.243.209:18081",
|
|
80
|
+
success: function (token) {},
|
|
81
|
+
lang: Language.JA,
|
|
82
|
+
});
|
|
83
|
+
myCaptcha.show().then(() => {});
|
|
84
|
+
```
|
|
85
|
+
|
package/dist/api.d.ts
CHANGED
package/dist/captcha.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export declare class Captcha {
|
|
|
9
9
|
private resolve;
|
|
10
10
|
private apiInstance;
|
|
11
11
|
constructor(config: ICaptchaConfig);
|
|
12
|
+
private setConfig;
|
|
13
|
+
resetConfig(config: Partial<ICaptchaConfig>): void;
|
|
12
14
|
private initEventNames;
|
|
13
15
|
private initRoot;
|
|
14
16
|
show(): Promise<string>;
|
package/dist/image-url.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
1
|
+
import { Language } from "./lang";
|
|
2
|
+
export declare const CloseImage: string;
|
|
3
|
+
export declare const ErrorImage: string;
|
|
4
|
+
export declare const WaitingImage: string;
|
|
5
|
+
export declare const LogoImage: (lang: Language) => string;
|
|
6
|
+
export declare const RefreshImage: string;
|
|
7
|
+
export declare const RetryImage: string;
|
|
8
|
+
export declare const LoadingImage: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InRecord, Version } from "./type";
|
|
2
|
+
import { Language } from "./lang";
|
|
2
3
|
import { Captcha } from "./captcha";
|
|
3
4
|
declare global {
|
|
4
5
|
interface Window {
|
|
5
6
|
yh_captcha: {
|
|
6
7
|
Captcha: Captcha;
|
|
7
|
-
AppId: InRecord<typeof AppId>;
|
|
8
8
|
Version: InRecord<typeof Version>;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
export { Captcha,
|
|
12
|
+
export { Captcha, Language, Version };
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.yh_captcha=e():t.yh_captcha=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=11)}([function(t,e,n){(function(e){var r;t.exports=(r=r||function(t,r){var i;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&void 0!==e&&e.crypto&&(i=e.crypto),!i)try{i=n(6)}catch(t){}var a=function(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),s={},c=s.lib={},u=c.Base={extend:function(t){var e=o(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},d=c.WordArray=u.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||l).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,i=t.sigBytes;if(this.clamp(),r%4)for(var a=0;a<i;a++){var o=n[a>>>2]>>>24-a%4*8&255;e[r+a>>>2]|=o<<24-(r+a)%4*8}else for(var s=0;s<i;s+=4)e[r+s>>>2]=n[s>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=u.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],n=0;n<t;n+=4)e.push(a());return new d.init(e,t)}}),f=s.enc={},l=f.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i<n;i++){var a=e[i>>>2]>>>24-i%4*8&255;r.push((a>>>4).toString(16)),r.push((15&a).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new d.init(n,e/2)}},h=f.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i<n;i++){var a=e[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(a))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new d.init(n,e)}},p=f.Utf8={stringify:function(t){try{return decodeURIComponent(escape(h.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return h.parse(unescape(encodeURIComponent(t)))}},v=c.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new d.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=p.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n,r=this._data,i=r.words,a=r.sigBytes,o=this.blockSize,s=a/(4*o),c=(s=e?t.ceil(s):t.max((0|s)-this._minBufferSize,0))*o,u=t.min(4*c,a);if(c){for(var f=0;f<c;f+=o)this._doProcessBlock(i,f);n=i.splice(0,c),r.sigBytes-=u}return new d.init(n,u)},clone:function(){var t=u.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),y=(c.Hasher=v.extend({cfg:u.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){v.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new y.HMAC.init(t,n).finalize(e)}}}),s.algo={});return s}(Math),r)}).call(this,n(5))},function(t,e,n){!function(t){"use strict";
|
|
2
|
-
/*! *****************************************************************************
|
|
3
|
-
Copyright (c) Microsoft Corporation.
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted.
|
|
7
|
-
|
|
8
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */var e=function(){return(e=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},r=n(0);n(3);var i={};n(7);var a=n(3),o=n(4),s=n(8),c=n(0);function u(){var t=(new Date).toISOString().replace(/\-|:|\./g,"");return t.slice(0,-4).concat(t.slice(-1))}function d(){return a.stringify(r.lib.WordArray.random(16))}function f(t,e){return t>e?1:-1}function l(t,e,n,r){return t===n?f(e,r):f(t,n)}function h(t){var e="string"==typeof t?t:Object.keys(t).reduce((function(e,n){return e.push(n+"="+t[n]),e}),[]).join("&");return e?e.split("&").map((function(t){var e,n=null===(e=t.match(/=/))||void 0===e?void 0:e.index;return null!=n?[t.slice(0,n),t.slice(n+1)]:[t]})).sort((function(t,e){return l(t[0],t[1],e[0],e[1])})).reduce((function(t,e){return t.push(e[0]+"="+(e[1]||"")),t}),[]).join("&"):""}function p(t){return o(t).toString(a)}function v(t){return"string"==typeof t?Promise.resolve(p(t)):t instanceof Blob?t.arrayBuffer().then((function(t){return e=t,o(c.lib.WordArray.create(e)).toString(a);var e})):new Promise((function(e){var n=[];t.forEach((function(t,e){n.push(new Promise((function(n){var r=e+"=";if(t instanceof File){var i=new FileReader;i.onload=function(t){n(r+p(c.lib.WordArray.create(t.target.result)))},i.readAsArrayBuffer(t.slice(0,1024))}else n(r+t)})))})),Promise.all(n).then((function(t){e(h(t.join("&")))}))}))}function y(t,e){if(!(e=e||i.sign))throw new Error("没有签名秘钥");var n=t.verb,r=t.path,o=t.host,c=t.header,u=t.body,d=t.query,f=t.log;return v(u).then((function(t){var i=function(t){return Object.keys(t).sort((function(e,n){return l(e.toLowerCase(),t[e],n.toLowerCase(),t[n])})).reduce((function(e,n){return e.push(n.toLowerCase()+":"+t[n]),e}),[]).join("\n")}(c),u=h(d),p=n+"\n"+o+"\n"+r+"\n"+u+"\n"+i+"\n"+t;return f&&console.log(p),s(p,a.parse(e)).toString(a)}))}t.SIGN_AUTHORIZATION="YH ",t.getDate=u,t.getRandom16Nonce=d,t.intercepeReq=function(t,n,r){var i=n,a=i.method,o=i.url,s=i.params,c=i.data,f=i.headers,l=i.log,h=e({"x-yh-date":u(),"x-yh-nonce":d(),"x-yh-traceid":d()},Object.keys(f).reduce((function(t,e){return e.startsWith("x-yh")&&(t[e]=f[e]),t}),{}));return y({verb:a.toUpperCase(),host:t,path:o,query:s||"",header:h,body:c?c instanceof FormData?c:JSON.stringify(c):"",log:l},r).then((function(t){return n.headers=e(e(e({},f),h),{Authorization:"YH "+t}),n}))},t.sign=y,Object.defineProperty(t,"__esModule",{value:!0})}(e)},function(t,e,n){"use strict";var r,i,a;Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.WEBVIEW="WebView",t.ACCOUNT="Account"}(r||(r={})),function(t){t.OPEN_URL="openUrl",t.CLOSE_WEBVIEW="closeWebView",t.GET_TOKEN="getToken"}(i||(i={})),function(t){t.SDK="sdk",t.UNITY="unity"}(a||(a={})),e.isAndriod=function(){return!!navigator.userAgent.match(/Android/i)},e.isInWebview=function(){return!!navigator.userAgent.match("YHSDK")},e.isIos=function(){return!!navigator.userAgent.match(/iPhone|iPad|iPod|Mac OS/i)&&"ontouchend"in document}},function(t,e,n){var r,i,a;t.exports=(a=n(0),i=(r=a).lib.WordArray,r.enc.Base64={stringify:function(t){var e=t.words,n=t.sigBytes,r=this._map;t.clamp();for(var i=[],a=0;a<n;a+=3)for(var o=(e[a>>>2]>>>24-a%4*8&255)<<16|(e[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|e[a+2>>>2]>>>24-(a+2)%4*8&255,s=0;s<4&&a+.75*s<n;s++)i.push(r.charAt(o>>>6*(3-s)&63));var c=r.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(t){var e=t.length,n=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var a=0;a<n.length;a++)r[n.charCodeAt(a)]=a}var o=n.charAt(64);if(o){var s=t.indexOf(o);-1!==s&&(e=s)}return function(t,e,n){for(var r=[],a=0,o=0;o<e;o++)if(o%4){var s=n[t.charCodeAt(o-1)]<<o%4*2,c=n[t.charCodeAt(o)]>>>6-o%4*2,u=s|c;r[a>>>2]|=u<<24-a%4*8,a++}return i.create(r,a)}(t,e,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},a.enc.Base64)},function(t,e,n){var r,i,a,o,s,c,u,d;t.exports=(d=n(0),i=(r=d).lib,a=i.WordArray,o=i.Hasher,s=r.algo,c=[],u=s.SHA1=o.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],u=0;u<80;u++){if(u<16)c[u]=0|t[e+u];else{var d=c[u-3]^c[u-8]^c[u-14]^c[u-16];c[u]=d<<1|d>>>31}var f=(r<<5|r>>>27)+s+c[u];f+=u<20?1518500249+(i&a|~i&o):u<40?1859775393+(i^a^o):u<60?(i&a|i&o|a&o)-1894007588:(i^a^o)-899497514,s=o,o=a,a=i<<30|i>>>2,i=r,r=f}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+a|0,n[3]=n[3]+o|0,n[4]=n[4]+s|0},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;return e[r>>>5]|=128<<24-r%32,e[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),e[15+(r+64>>>9<<4)]=n,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}}),r.SHA1=o._createHelper(u),r.HmacSHA1=o._createHmacHelper(u),d.SHA1)},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){},function(t,e,n){var r;t.exports=(r=n(0),function(){if("function"==typeof ArrayBuffer){var t=r.lib.WordArray,e=t.init;(t.init=function(t){if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){for(var n=t.byteLength,r=[],i=0;i<n;i++)r[i>>>2]|=t[i]<<24-i%4*8;e.call(this,r,n)}else e.apply(this,arguments)}).prototype=t}}(),r.lib.WordArray)},function(t,e,n){var r;t.exports=(r=n(0),n(4),n(9),r.HmacSHA1)},function(t,e,n){var r,i,a,o;t.exports=(r=n(0),a=(i=r).lib.Base,o=i.enc.Utf8,void(i.algo.HMAC=a.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=o.parse(e));var n=t.blockSize,r=4*n;e.sigBytes>r&&(e=t.finalize(e)),e.clamp();for(var i=this._oKey=e.clone(),a=this._iKey=e.clone(),s=i.words,c=a.words,u=0;u<n;u++)s[u]^=1549556828,c[u]^=909522486;i.sigBytes=a.sigBytes=r,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,n=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(n))}})))},function(t,e,n){},function(t,e,n){"use strict";n.r(e),n.d(e,"Captcha",(function(){return w})),n.d(e,"AppId",(function(){return i})),n.d(e,"Version",(function(){return r}));var r={V1:"v1"},i={NINJA3:"ninja3"},a=n(2),o=n(1);devicePixelRatio;function s(t,e){var n,r=function(){var e=Math.ceil(Math.random()*t);return e===t?e-1:e};return function(){for(var t=r();t===n||e&&e(t);)t=r();return n=t,t}}s(250,(function(t){return t<60})),s(100,(function(t){return t<50}));function c(t){return+getComputedStyle(t).left.match(/\d+/)[0]}function u(t,e){var n,r=new Promise((function(t){return n=t})),i=new Image;return i.onload=function(){null==e||e(i),n(i)},i.src=t,r}var d="ZWjJ1B7dCoB1ZqDFLm7Ix77GBsnCAyv2wcqg6sA5QAI=",f="356959";function l(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var h=function(){function t(e){var n,r,i;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),i=void 0,(r="config")in(n=this)?Object.defineProperty(n,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[r]=i,this.config=e}var e,n,r;return e=t,(n=[{key:"request",value:function(t,e){var n=this;return new Promise((function(r,i){var a=e.method,s=e.body,c=n.config.baseUrl,u=d,l=f,h=new XMLHttpRequest;h.open(a.toLocaleUpperCase(),"".concat(c).concat(t),!0),h.setRequestHeader("Content-type","application/json; charset=utf-8"),h.onreadystatechange=function(){if(4===h.readyState){200!==h.status&&i("请求错误");var t=JSON.parse(h.responseText),e=t.code,n=t.msg,a=void 0===n?"":n,o=t.data;0===e?r(o):i(a)}},h.onerror=function(){i("网络错误")},h.ontimeout=function(){i("请求超时")};var p={"x-yh-date":Object(o.getDate)(),"x-yh-nonce":Object(o.getRandom16Nonce)(),"x-yh-traceid":Object(o.getRandom16Nonce)(),"x-yh-appid":l};Object(o.sign)({host:n.getHost(c),path:t,verb:a.toLocaleUpperCase(),query:"",body:JSON.stringify(s)||"",header:p,log:!0},u).then((function(t){h.setRequestHeader("Authorization","".concat(o.SIGN_AUTHORIZATION).concat(t)),Object.keys(p).forEach((function(t){h.setRequestHeader(t,p[t])})),h.send(s?JSON.stringify(s):"")}))}))}},{key:"getCaptcha",value:function(t){return this.request("/apis/v1/apps/".concat(t.appId,"/versions/").concat(t.version,"/captchas"),{method:"get"})}},{key:"postValidate",value:function(t,e){return this.request("/apis/v1/tokens/".concat(t,"/validate"),{method:"post",body:e})}},{key:"getHost",value:function(t){return t.replace(/http[s]:\/\//,"")}}])&&l(e.prototype,n),r&&l(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}(),p=(n(10),"https://captcha-res.pandadastudio.com/static/img/refresh.png"),v='\n <div class="dx-captcha-header">\n <img src='.concat("https://captcha-res.pandadastudio.com/static/img/close.png",' />\n </div>\n <div class="dx-captcha-body">\n <canvas></canvas>\n <img class="dx-captcha-body-slider" draggable="false" />\n <img class="dx-captcha-body-refresh" src=').concat(p,' width="16px" height="16px" />\n <img class="dx-captcha-body-logo" src=').concat("https://captcha-res.pandadastudio.com/static/img/logo.png",' width="78px" height="30px" />\n <div class="dx-captcha-body-loading display-none">\n <div>\n <img class="dx-captcha-body-loading-img" src=').concat("https://captcha-res.pandadastudio.com/static/img/loading.gif",' />\n <div class="dx-captcha-body-loading-text">加载中...</div>\n </div>\n </div>\n </div>\n <div class="dx-captcha-bar">\n <div class="dx-captcha-bar-slider"></div>\n <div class="dx-captcha-bar-progress"></div>\n <span class="dx-captcha-bar-text">\n 请<span style="color:#F56A00;">拖动</span>左侧滑块将图片还原\n </span>\n </div>\n'),y='\n <div class="dx-captcha-mask"></div>\n <div class="dx-captcha-wrap">\n '.concat(v,"\n </div>\n"),g='\n <div class="dx-captcha-retry">\n <img class="dx-captcha-retry-img" src='.concat("https://captcha-res.pandadastudio.com/static/img/retry.jpg",' />\n <div>加载失败,<a class="dx-captcha-retry-link">请点击重试!</a></div>\n </div>\n');function m(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function b(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var w=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),b(this,"root",void 0),b(this,"refs",void 0),b(this,"token",void 0),b(this,"eventNames",void 0),b(this,"config",void 0),b(this,"resolve",void 0),b(this,"apiInstance",void 0),this.config=Object.assign({},e),this.apiInstance=new h({baseUrl:e.baseUrl}),this.initEventNames()}var e,n,r;return e=t,(n=[{key:"initEventNames",value:function(){Object(a.isAndriod)()||Object(a.isIos)()?this.eventNames={down:"touchstart",up:"touchend",move:"touchmove"}:this.eventNames={down:"mousedown",up:"mouseup",move:"mousemove"}}},{key:"initRoot",value:function(){var t=document.createElement("div");return t.classList.add("dx-captcha-root"),document.body.appendChild(t),t}},{key:"show",value:function(){var t=this;this.root||(this.root=this.initRoot());var e=new Promise((function(e){return t.resolve=e}));return this.render(),e}},{key:"render",value:function(){var t=this;this.root.innerHTML=y,this.queryRef(),this.handleHeader(),this.handleBody().then((function(e){t.token=e,t.handleBar()}))}},{key:"queryRef",value:function(){var t=this,e=function(e){return t.root.querySelector(e)},n=e(".dx-captcha-wrap"),r=e(".dx-captcha-header img"),i=e("canvas"),a=e(".dx-captcha-bar"),o=e(".dx-captcha-bar-slider"),s=e(".dx-captcha-body-slider"),c=e(".dx-captcha-body-refresh"),u=e(".dx-captcha-body-logo"),d=e(".dx-captcha-bar-progress"),f=e(".dx-captcha-bar-text"),l=e(".dx-captcha-body-loading");this.refs={wrapper:n,close:r,canvas:i,fragment:s,bar:a,slider:o,progress:d,infoText:f,refresh:c,logo:u,loading:l}}},{key:"close",value:function(){var t=this,e=this.refs.wrapper;e.style.top="0",e.style.opacity="0",setTimeout((function(){t.root.innerHTML=""}),300)}},{key:"retry",value:function(){var t=this;this.refs.wrapper.innerHTML=g,this.refs.wrapper.querySelector(".dx-captcha-retry-link").addEventListener("click",(function(){t.render()}))}},{key:"handleHeader",value:function(){var t=this;this.refs.close.addEventListener("click",(function(){t.close()}))}},{key:"handleBody",value:function(){return this.addRefresh(),this.drawBackground()}},{key:"drawBackground",value:function(){var t=this,e=this.refs,n=this.apiInstance,r=this.config,i=e.canvas,a=e.loading,o=e.fragment;i.width=300*devicePixelRatio,i.height=150*devicePixelRatio;var s,c=i.getContext("2d"),d=new Promise((function(t){return s=t}));return a.classList.remove("display-none"),n.getCaptcha({appId:r.appId,version:r.version}).then((function(t){var e=t.y,n=t.token,r=t.bgUrl,d=t.fgUrl;u(r,(function(t){a.classList.add("display-none"),c.drawImage(t,0,0,i.width,i.height),o.src=d,o.style.top="".concat(e,"px"),s(n)}))})).catch((function(){t.retry()})),d}},{key:"addRefresh",value:function(){var t=this,e=this.refs.refresh;e.src=p,e.addEventListener("click",(function(){t.reset()}))}},{key:"reset",value:function(){var t=this;this.clearCanvas(),this.drawBackground().then((function(e){t.token=e}));var e=this.refs,n=e.slider,r=e.progress;this.loopBar((function(t){t.style.transitionDuration="0s"})),n.style.backgroundImage="url(".concat("https://captcha-res.pandadastudio.com/static/img/waiting.png",")"),r.classList.remove("error"),r.classList.add("success")}},{key:"clearCanvas",value:function(){var t=this.refs.canvas;t.getContext("2d").clearRect(0,0,t.width,t.height)}},{key:"handleBar",value:function(){var t,e,n=this,r=this.eventNames,i=r.down,a=r.move,o=r.up,s=this.refs,u=s.bar,d=s.fragment,f=s.slider,l=s.progress,h=u.getBoundingClientRect().width-f.getBoundingClientRect().width,p={value:!1},v=function(r){r.preventDefault();var i=n.getClientX(r)-t+e;i>h||i<0||n.moveBar(i)},y=function t(){document.body.removeEventListener(a,v),document.body.removeEventListener(o,t);var e=c(d);n.apiInstance.postValidate(n.token,{x:e}).then((function(){n.verifySuccess()})).catch((function(){n.verifyFail(p)}))};f.addEventListener(i,(function(r){p.value||(t=n.getClientX(r),e=c(d),l.classList.add("success"),document.body.addEventListener(a,v),document.body.addEventListener(o,y))}))}},{key:"getClientX",value:function(t){return t.clientX||t.touches[0].clientX}},{key:"verifyFail",value:function(t){var e=this;t.value=!0;var n=this.refs,r=n.slider,i=n.progress;r.style.backgroundImage="url(".concat("https://captcha-res.pandadastudio.com/static/img/error.png",")"),i.classList.remove("success"),i.classList.add("error"),this.fallbackBar(),setTimeout((function(){e.reset(),t.value=!1}),500)}},{key:"verifySuccess",value:function(){var t=this,e=this.refs,n=this.token,r=this.config,i=e.bar;i.innerHTML='\n <span class="dx-captcha-bar-text">\n 验证成功\n </span>\n',i.classList.add("success"),setTimeout((function(){var e;t.close(),null===(e=r.success)||void 0===e||e.call(r,n),t.resolve(n)}))}},{key:"moveBar",value:function(t){var e=this;this.loopBar((function(n){n.style[e.getChangeProperty(n)]="".concat(t,"px")}))}},{key:"fallbackBar",value:function(){var t=this;this.loopBar((function(e){e.style.transitionDuration="".concat(.5,"s"),e.style[t.getChangeProperty(e)]="0"}))}},{key:"getChangeProperty",value:function(t){return t.classList.contains("dx-captcha-bar-progress")?"width":"left"}},{key:"loopBar",value:function(t){var e=this.refs;[e.fragment,e.slider,e.progress].forEach((function(e){return t(e)}))}}])&&m(e.prototype,n),r&&m(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}()}])}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.yh_captcha=t():e.yh_captcha=t()}(this,(function(){return function(e){var t={};function n(a){if(t[a])return t[a].exports;var r=t[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(a,r,function(t){return e[t]}.bind(null,r));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){"use strict";var a,r,i;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.WEBVIEW="WebView",e.ACCOUNT="Account"}(a||(a={})),function(e){e.OPEN_URL="openUrl",e.CLOSE_WEBVIEW="closeWebView",e.GET_TOKEN="getToken"}(r||(r={})),function(e){e.SDK="sdk",e.UNITY="unity"}(i||(i={})),t.isAndriod=function(){return!!navigator.userAgent.match(/Android/i)},t.isInWebview=function(){return!!navigator.userAgent.match("YHSDK")},t.isIos=function(){return!!navigator.userAgent.match(/iPhone|iPad|iPod|Mac OS/i)&&"ontouchend"in document}},function(e,t,n){},function(e,t,n){"use strict";n.r(t),n.d(t,"Captcha",(function(){return A})),n.d(t,"Language",(function(){return u})),n.d(t,"Version",(function(){return l}));var a,r,i,o,c,s,u,d,l={V1:"v1"};function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e){e.HANT="hant",e.HANS="hans",e.JA="ja",e.EN="en",e.KO="ko"}(u||(u={})),function(e){e.DRAG="drag",e.LOADING="loading",e.SUCCESS="success",e.FAIL="fail",e.RETRY="retry"}(d||(d={}));var h=(f(s={},u.HANS,(f(a={},d.DRAG,"拖动左侧滑块将图片还原"),f(a,d.LOADING,"加载中... "),f(a,d.SUCCESS,"验证成功"),f(a,d.FAIL,"加载失败,"),f(a,d.RETRY,"请点击重试!"),a)),f(s,u.HANT,(f(r={},d.DRAG,"拖動左側滑塊將圖片還原"),f(r,d.LOADING,"加載中... "),f(r,d.SUCCESS,"驗證成功"),f(r,d.FAIL,"加載失敗,"),f(r,d.RETRY,"請點擊重試!"),r)),f(s,u.JA,(f(i={},d.DRAG,"矢印を右にスライドしてください"),f(i,d.LOADING,"ロード中... "),f(i,d.SUCCESS,"認証成功"),f(i,d.FAIL,"ロードに失敗、"),f(i,d.RETRY,"再度お試してください"),i)),f(s,u.KO,(f(o={},d.DRAG,"왼쪽 이미지를 끌어 그림을 복원해 주세요."),f(o,d.LOADING,"로드 중... "),f(o,d.SUCCESS,"인증 성공"),f(o,d.FAIL,"로드 실패,"),f(o,d.RETRY,"재시도해 주세요!"),o)),f(s,u.EN,(f(c={},d.DRAG,"Slide from left to right to complete the image"),f(c,d.LOADING,"Uploading"),f(c,d.SUCCESS,"Verification Successful"),f(c,d.FAIL,"Failed to load,"),f(c,d.RETRY,"please tap to retry!"),c)),s),v=n(0);function p(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var g=function(){function e(t){var n,a,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),r=void 0,(a="config")in(n=this)?Object.defineProperty(n,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[a]=r,this.config=t}var t,n,a;return t=e,(n=[{key:"request",value:function(e,t){var n=this;return new Promise((function(a,r){var i=t.method,o=t.body,c=new XMLHttpRequest;c.open(i.toLocaleUpperCase(),"".concat(n.config.baseUrl).concat(e),!0),c.setRequestHeader("Content-type","application/json; charset=utf-8"),c.onreadystatechange=function(){if(4===c.readyState){200!==c.status&&r("请求错误");var e=JSON.parse(c.responseText),t=e.code,n=e.msg,i=void 0===n?"":n,o=e.data;0===t?a(o):r(i)}},c.onerror=function(){r("网络错误")},c.ontimeout=function(){r("请求超时")},c.send(o?JSON.stringify(o):"")}))}},{key:"getCaptcha",value:function(e){return this.request("/apis/v1/apps/".concat(e.appId,"/versions/").concat(e.version,"/captchas"),{method:"get"})}},{key:"postValidate",value:function(e,t){return this.request("/apis/v1/tokens/".concat(e,"/validate"),{method:"post",body:t})}}])&&p(t.prototype,n),a&&p(t,a),Object.defineProperty(t,"prototype",{writable:!1}),e}();function y(e){return+getComputedStyle(e).left.match(/\d+/)[0]}n(1);var b="https://captcha.resource.pandadagames.com/images/",m="".concat(b,"close.png"),x="".concat(b,"error.png"),k="".concat(b,"waiting.png"),w="".concat(b,"refresh.png"),S="".concat(b,"retry.jpeg"),C="".concat(b,"loading.gif"),L=function(e){return'\n <div class="dx-captcha-header">\n <img src='.concat(m,' />\n </div>\n <div class="dx-captcha-body">\n <canvas></canvas>\n <img class="dx-captcha-body-slider" draggable="false" />\n <img class="dx-captcha-body-refresh" src=').concat(w,' width="16px" height="16px" />\n <img class="dx-captcha-body-logo" src=').concat(function(e){return"".concat(b).concat(e,"_logo.png")}(e),' width="50px" />\n <div class="dx-captcha-body-loading display-none">\n <div>\n <img class="dx-captcha-body-loading-img" src=').concat(C,' />\n <div class="dx-captcha-body-loading-text">').concat(h[e][d.LOADING],'</div>\n </div>\n </div>\n </div>\n <div class="dx-captcha-bar">\n <div class="dx-captcha-bar-slider"></div>\n <div class="dx-captcha-bar-progress"></div>\n <span class="dx-captcha-bar-text">\n ').concat(h[e][d.DRAG],"\n </span>\n </div>\n")};function E(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var A=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),O(this,"root",void 0),O(this,"refs",void 0),O(this,"token",void 0),O(this,"eventNames",void 0),O(this,"config",void 0),O(this,"resolve",void 0),O(this,"apiInstance",void 0),this.setConfig(t),this.apiInstance=new g({baseUrl:t.baseUrl}),this.initEventNames()}var t,n,a;return t=e,(n=[{key:"setConfig",value:function(e){if(!Object.values(u).includes(e.lang))throw new Error("传入的lang ".concat(e.lang," 不正确"));this.config=Object.assign({},e)}},{key:"resetConfig",value:function(e){this.config=Object.assign(this.config,e)}},{key:"initEventNames",value:function(){Object(v.isAndriod)()||Object(v.isIos)()?this.eventNames={down:"touchstart",up:"touchend",move:"touchmove"}:this.eventNames={down:"mousedown",up:"mouseup",move:"mousemove"}}},{key:"initRoot",value:function(){var e=document.createElement("div");return e.classList.add("dx-captcha-root"),document.body.appendChild(e),e}},{key:"show",value:function(){var e=this;this.root||(this.root=this.initRoot());var t=new Promise((function(t){return e.resolve=t}));return this.render(),t}},{key:"render",value:function(){var e,t=this;this.root.innerHTML=(e=this.config.lang,'\n <div class="dx-captcha-mask"></div>\n <div class="dx-captcha-wrap">\n '.concat(L(e),"\n </div>\n")),this.queryRef(),this.handleHeader(),this.handleBody().then((function(e){t.token=e,t.handleBar()}))}},{key:"queryRef",value:function(){var e=this,t=function(t){return e.root.querySelector(t)},n=t(".dx-captcha-wrap"),a=t(".dx-captcha-header img"),r=t("canvas"),i=t(".dx-captcha-bar"),o=t(".dx-captcha-bar-slider"),c=t(".dx-captcha-body-slider"),s=t(".dx-captcha-body-refresh"),u=t(".dx-captcha-body-logo"),d=t(".dx-captcha-bar-progress"),l=t(".dx-captcha-bar-text"),f=t(".dx-captcha-body-loading");this.refs={wrapper:n,close:a,canvas:r,fragment:c,bar:i,slider:o,progress:d,infoText:l,refresh:s,logo:u,loading:f}}},{key:"close",value:function(){var e=this,t=this.refs.wrapper;t.style.top="0",t.style.opacity="0",setTimeout((function(){e.root.innerHTML=""}),300)}},{key:"retry",value:function(){var e,t=this;this.refs.wrapper.innerHTML=(e=this.config.lang,'\n <div class="dx-captcha-retry">\n <img class="dx-captcha-retry-img" src='.concat(S," />\n <div>").concat(h[e][d.FAIL],'<a class="dx-captcha-retry-link">').concat(h[e][d.RETRY],"</a></div>\n </div>\n")),this.refs.wrapper.querySelector(".dx-captcha-retry-link").addEventListener("click",(function(){t.render()}))}},{key:"handleHeader",value:function(){var e=this;this.refs.close.addEventListener("click",(function(){e.close()}))}},{key:"handleBody",value:function(){return this.addRefresh(),this.drawBackground()}},{key:"drawBackground",value:function(){var e=this,t=this.refs,n=this.apiInstance,a=this.config,r=t.canvas,i=t.loading,o=t.fragment;r.width=300*devicePixelRatio,r.height=150*devicePixelRatio;var c,s=r.getContext("2d"),u=new Promise((function(e){return c=e}));return i.classList.remove("display-none"),n.getCaptcha({appId:a.appId,version:a.version}).then((function(e){var t=e.y,n=e.token,a=e.bgUrl,u=e.fgUrl;!function(e,t){new Promise((function(e){return n=e}));var n,a=new Image;a.onload=function(){null==t||t(a),n(a)},a.src=e}(a,(function(e){i.classList.add("display-none"),s.drawImage(e,0,0,r.width,r.height),o.src=u,o.style.top="".concat(t,"px"),c(n)}))})).catch((function(){e.retry()})),u}},{key:"addRefresh",value:function(){var e=this,t=this.refs.refresh;t.src=w,t.addEventListener("click",(function(){e.reset()}))}},{key:"reset",value:function(){var e=this;this.clearCanvas(),this.drawBackground().then((function(t){e.token=t}));var t=this.refs,n=t.slider,a=t.progress;this.loopBar((function(e){e.style.transitionDuration="0s"})),n.style.backgroundImage="url(".concat(k,")"),a.classList.remove("error"),a.classList.add("success")}},{key:"clearCanvas",value:function(){var e=this.refs.canvas;e.getContext("2d").clearRect(0,0,e.width,e.height)}},{key:"handleBar",value:function(){var e,t,n=this,a=this.eventNames,r=a.down,i=a.move,o=a.up,c=this.refs,s=c.bar,u=c.fragment,d=c.slider,l=c.progress,f=s.getBoundingClientRect().width-d.getBoundingClientRect().width,h={value:!1},v=function(a){a.preventDefault();var r=n.getClientX(a)-e+t;r>f||r<0||n.moveBar(r)},p=function e(){document.body.removeEventListener(i,v),document.body.removeEventListener(o,e);var t=y(u);n.apiInstance.postValidate(n.token,{x:t}).then((function(){n.verifySuccess()})).catch((function(){n.verifyFail(h)}))};d.addEventListener(r,(function(a){h.value||(e=n.getClientX(a),t=y(u),l.classList.add("success"),document.body.addEventListener(i,v),document.body.addEventListener(o,p))}))}},{key:"getClientX",value:function(e){return e.clientX||e.touches[0].clientX}},{key:"verifyFail",value:function(e){var t=this;e.value=!0;var n=this.refs,a=n.slider,r=n.progress;a.style.backgroundImage="url(".concat(x,")"),r.classList.remove("success"),r.classList.add("error"),this.fallbackBar(),setTimeout((function(){t.reset(),e.value=!1}),500)}},{key:"verifySuccess",value:function(){var e,t=this,n=this.refs,a=this.token,r=this.config,i=n.bar;i.innerHTML=(e=this.config.lang,'\n <span class="dx-captcha-bar-text">\n '.concat(h[e][d.SUCCESS],"\n </span>\n")),i.classList.add("success"),setTimeout((function(){var e;t.close(),null===(e=r.success)||void 0===e||e.call(r,a),t.resolve(a)}))}},{key:"moveBar",value:function(e){var t=this;this.loopBar((function(n){n.style[t.getChangeProperty(n)]="".concat(e,"px")}))}},{key:"fallbackBar",value:function(){var e=this;this.loopBar((function(t){t.style.transitionDuration="".concat(.5,"s"),t.style[e.getChangeProperty(t)]="0"}))}},{key:"getChangeProperty",value:function(e){return e.classList.contains("dx-captcha-bar-progress")?"width":"left"}},{key:"loopBar",value:function(e){var t=this.refs;[t.fragment,t.slider,t.progress].forEach((function(t){return e(t)}))}}])&&E(t.prototype,n),a&&E(t,a),Object.defineProperty(t,"prototype",{writable:!1}),e}()}])}));
|
|
16
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://yh_captcha/webpack/universalModuleDefinition","webpack://yh_captcha/webpack/bootstrap","webpack://yh_captcha/./node_modules/crypto-js/core.js","webpack://yh_captcha/./node_modules/@blazes/crypto/dist/sign.js","webpack://yh_captcha/./node_modules/@blazes/webview-sdk/dist/env.js","webpack://yh_captcha/./node_modules/crypto-js/enc-base64.js","webpack://yh_captcha/./node_modules/crypto-js/sha1.js","webpack://yh_captcha/(webpack)/buildin/global.js","webpack://yh_captcha/./node_modules/crypto-js/lib-typedarrays.js","webpack://yh_captcha/./node_modules/crypto-js/hmac-sha1.js","webpack://yh_captcha/./node_modules/crypto-js/hmac.js","webpack://yh_captcha/./src/type.ts","webpack://yh_captcha/./src/draw.ts","webpack://yh_captcha/./src/utils.ts","webpack://yh_captcha/./src/api.ts","webpack://yh_captcha/./src/image-url.ts","webpack://yh_captcha/./src/template.ts","webpack://yh_captcha/./src/captcha.ts"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","CryptoJS","Math","undefined","crypto","self","globalThis","msCrypto","global","err","cryptoSecureRandomInt","getRandomValues","Uint32Array","randomBytes","readInt32LE","Error","F","obj","subtype","C","C_lib","lib","Base","extend","overrides","this","mixIn","init","$super","apply","arguments","instance","properties","propertyName","toString","clone","WordArray","words","sigBytes","length","encoder","Hex","stringify","concat","wordArray","thisWords","thatWords","thisSigBytes","thatSigBytes","clamp","thatByte","j","ceil","slice","random","nBytes","push","C_enc","enc","hexChars","bite","join","parse","hexStr","hexStrLength","parseInt","substr","Latin1","latin1Chars","String","fromCharCode","latin1Str","latin1StrLength","charCodeAt","Utf8","decodeURIComponent","escape","e","utf8Str","unescape","encodeURIComponent","BufferedBlockAlgorithm","reset","_data","_nDataBytes","_append","data","_process","doFlush","processedWords","dataWords","dataSigBytes","blockSize","nBlocksReady","nWordsReady","max","_minBufferSize","nBytesReady","min","offset","_doProcessBlock","splice","C_algo","Hasher","cfg","_doReset","update","messageUpdate","finalize","_doFinalize","_createHelper","hasher","message","_createHmacHelper","HMAC","algo","assign","u","a","Date","toISOString","replace","f","y","keys","reduce","split","map","match","index","sort","Promise","resolve","Blob","arrayBuffer","then","forEach","File","FileReader","onload","target","result","readAsArrayBuffer","all","h","sign","verb","path","host","header","body","query","log","toLowerCase","console","SIGN_AUTHORIZATION","getDate","getRandom16Nonce","intercepeReq","method","url","params","headers","startsWith","toUpperCase","FormData","JSON","Authorization","WEBVIEW","ACCOUNT","OPEN_URL","CLOSE_WEBVIEW","GET_TOKEN","SDK","UNITY","isAndriod","navigator","userAgent","isInWebview","isIos","document","Base64","_map","base64Chars","triplet","charAt","paddingChar","base64Str","base64StrLength","reverseMap","_reverseMap","paddingIndex","indexOf","bits1","bits2","bitsCombined","parseLoop","W","SHA1","_hash","M","H","b","nBitsTotal","nBitsLeft","floor","HmacSHA1","g","Function","ArrayBuffer","superInit","typedArray","Uint8Array","Int8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Float32Array","Float64Array","buffer","byteOffset","byteLength","typedArrayByteLength","_hasher","hasherBlockSize","hasherBlockSizeBytes","oKey","_oKey","iKey","_iKey","oKeyWords","iKeyWords","innerHash","Version","V1","AppId","NINJA3","devicePixelRatio","total","test","latest","calRandom","num","BACK_WIDTH","BACK_HEIGHT","getLeft","el","getComputedStyle","left","loadImage","img","callback","resolved","promise","imgEl","Image","src","SIGN","ApiInstance","config","reject","baseUrl","secret","appid","xhr","XMLHttpRequest","open","toLocaleUpperCase","setRequestHeader","onreadystatechange","readyState","status","responseText","code","msg","respData","onerror","ontimeout","getHost","authorization","send","request","appId","version","token","origin","RefreshImage","wrapTemplate","defaultTemplate","retryTemplate","Captcha","apiInstance","initEventNames","eventNames","down","up","move","createElement","classList","add","appendChild","initRoot","render","innerHTML","queryRef","handleHeader","handleBody","handleBar","selector","querySelector","wrapper","close","canvas","bar","slider","fragment","refresh","logo","progress","infoText","loading","refs","style","top","opacity","setTimeout","addEventListener","addRefresh","drawBackground","width","height","ctx","getContext","remove","getCaptcha","bgUrl","fgUrl","drawImage","catch","retry","clearCanvas","loopBar","transitionDuration","backgroundImage","clearRect","originX","curOffset","maxLeft","getBoundingClientRect","fallbacking","moveBar","event","preventDefault","getClientX","upMouse","removeEventListener","postValidate","x","verifySuccess","verifyFail","clientX","touches","fallbackBar","FALLBACK_DRUATION","success","getChangeProperty","contains"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAoB,WAAID,IAExBD,EAAiB,WAAIC,IARvB,CASGK,QAAQ,WACX,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,O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YAAW,WAAM,MACf,EAAKd,QACL,UAAApD,EAAOyG,eAAP,cAAAzG,EAAiByB,GACjB,EAAKzJ,QAAQyJ,QAtQnB,qBA0QE,SAAgB1L,GAAgB,WAC9B1E,KAAK6T,SAAQ,SAAC/F,GACZA,EAAG4E,MAAM,EAAK2C,kBAAkBvH,IAAhC,UAA0CpJ,EAA1C,WA5QN,yBAgRE,WAAsB,WACpB1E,KAAK6T,SAAQ,SAAC/F,GACZA,EAAG4E,MAAMoB,mBAAT,UApRoB,GAoRpB,KACAhG,EAAG4E,MAAM,EAAK2C,kBAAkBvH,IAAO,SAnR7C,+BAuRE,SAA0BA,GACxB,OAAOA,EAAGoD,UAAUoE,SAAS,2BAA6B,QAAU,SAxRxE,qBA2RE,SAAgBnH,GACd,MAAuCnO,KAAKyS,KAC5C,CADA,EAAQN,SAAR,EAAkBD,OAAlB,EAA0BI,UACGvL,SAAQ,SAAC+G,GAAD,OAAQK,EAASL,W,8EA7R1D","file":"index.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"yh_captcha\"] = factory();\n\telse\n\t\troot[\"yh_captcha\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 11);\n",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory();\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\troot.CryptoJS = factory();\n\t}\n}(this, function () {\n\n\t/*globals window, global, require*/\n\n\t/**\n\t * CryptoJS core components.\n\t */\n\tvar CryptoJS = CryptoJS || (function (Math, undefined) {\n\n\t var crypto;\n\n\t // Native crypto from window (Browser)\n\t if (typeof window !== 'undefined' && window.crypto) {\n\t crypto = window.crypto;\n\t }\n\n\t // Native crypto in web worker (Browser)\n\t if (typeof self !== 'undefined' && self.crypto) {\n\t crypto = self.crypto;\n\t }\n\n\t // Native crypto from worker\n\t if (typeof globalThis !== 'undefined' && globalThis.crypto) {\n\t crypto = globalThis.crypto;\n\t }\n\n\t // Native (experimental IE 11) crypto from window (Browser)\n\t if (!crypto && typeof window !== 'undefined' && window.msCrypto) {\n\t crypto = window.msCrypto;\n\t }\n\n\t // Native crypto from global (NodeJS)\n\t if (!crypto && typeof global !== 'undefined' && global.crypto) {\n\t crypto = global.crypto;\n\t }\n\n\t // Native crypto import via require (NodeJS)\n\t if (!crypto && typeof require === 'function') {\n\t try {\n\t crypto = require('crypto');\n\t } catch (err) {}\n\t }\n\n\t /*\n\t * Cryptographically secure pseudorandom number generator\n\t *\n\t * As Math.random() is cryptographically not safe to use\n\t */\n\t var cryptoSecureRandomInt = function () {\n\t if (crypto) {\n\t // Use getRandomValues method (Browser)\n\t if (typeof crypto.getRandomValues === 'function') {\n\t try {\n\t return crypto.getRandomValues(new Uint32Array(1))[0];\n\t } catch (err) {}\n\t }\n\n\t // Use randomBytes method (NodeJS)\n\t if (typeof crypto.randomBytes === 'function') {\n\t try {\n\t return crypto.randomBytes(4).readInt32LE();\n\t } catch (err) {}\n\t }\n\t }\n\n\t throw new Error('Native crypto module could not be used to get secure random number.');\n\t };\n\n\t /*\n\t * Local polyfill of Object.create\n\n\t */\n\t var create = Object.create || (function () {\n\t function F() {}\n\n\t return function (obj) {\n\t var subtype;\n\n\t F.prototype = obj;\n\n\t subtype = new F();\n\n\t F.prototype = null;\n\n\t return subtype;\n\t };\n\t }());\n\n\t /**\n\t * CryptoJS namespace.\n\t */\n\t var C = {};\n\n\t /**\n\t * Library namespace.\n\t */\n\t var C_lib = C.lib = {};\n\n\t /**\n\t * Base object for prototypal inheritance.\n\t */\n\t var Base = C_lib.Base = (function () {\n\n\n\t return {\n\t /**\n\t * Creates a new object that inherits from this object.\n\t *\n\t * @param {Object} overrides Properties to copy into the new object.\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * field: 'value',\n\t *\n\t * method: function () {\n\t * }\n\t * });\n\t */\n\t extend: function (overrides) {\n\t // Spawn\n\t var subtype = create(this);\n\n\t // Augment\n\t if (overrides) {\n\t subtype.mixIn(overrides);\n\t }\n\n\t // Create default initializer\n\t if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {\n\t subtype.init = function () {\n\t subtype.$super.init.apply(this, arguments);\n\t };\n\t }\n\n\t // Initializer's prototype is the subtype object\n\t subtype.init.prototype = subtype;\n\n\t // Reference supertype\n\t subtype.$super = this;\n\n\t return subtype;\n\t },\n\n\t /**\n\t * Extends this object and runs the init method.\n\t * Arguments to create() will be passed to init().\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var instance = MyType.create();\n\t */\n\t create: function () {\n\t var instance = this.extend();\n\t instance.init.apply(instance, arguments);\n\n\t return instance;\n\t },\n\n\t /**\n\t * Initializes a newly created object.\n\t * Override this method to add some logic when your objects are created.\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * init: function () {\n\t * // ...\n\t * }\n\t * });\n\t */\n\t init: function () {\n\t },\n\n\t /**\n\t * Copies properties into this object.\n\t *\n\t * @param {Object} properties The properties to mix in.\n\t *\n\t * @example\n\t *\n\t * MyType.mixIn({\n\t * field: 'value'\n\t * });\n\t */\n\t mixIn: function (properties) {\n\t for (var propertyName in properties) {\n\t if (properties.hasOwnProperty(propertyName)) {\n\t this[propertyName] = properties[propertyName];\n\t }\n\t }\n\n\t // IE won't copy toString using the loop above\n\t if (properties.hasOwnProperty('toString')) {\n\t this.toString = properties.toString;\n\t }\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = instance.clone();\n\t */\n\t clone: function () {\n\t return this.init.prototype.extend(this);\n\t }\n\t };\n\t }());\n\n\t /**\n\t * An array of 32-bit words.\n\t *\n\t * @property {Array} words The array of 32-bit words.\n\t * @property {number} sigBytes The number of significant bytes in this word array.\n\t */\n\t var WordArray = C_lib.WordArray = Base.extend({\n\t /**\n\t * Initializes a newly created word array.\n\t *\n\t * @param {Array} words (Optional) An array of 32-bit words.\n\t * @param {number} sigBytes (Optional) The number of significant bytes in the words.\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.create();\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);\n\t */\n\t init: function (words, sigBytes) {\n\t words = this.words = words || [];\n\n\t if (sigBytes != undefined) {\n\t this.sigBytes = sigBytes;\n\t } else {\n\t this.sigBytes = words.length * 4;\n\t }\n\t },\n\n\t /**\n\t * Converts this word array to a string.\n\t *\n\t * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\n\t *\n\t * @return {string} The stringified word array.\n\t *\n\t * @example\n\t *\n\t * var string = wordArray + '';\n\t * var string = wordArray.toString();\n\t * var string = wordArray.toString(CryptoJS.enc.Utf8);\n\t */\n\t toString: function (encoder) {\n\t return (encoder || Hex).stringify(this);\n\t },\n\n\t /**\n\t * Concatenates a word array to this word array.\n\t *\n\t * @param {WordArray} wordArray The word array to append.\n\t *\n\t * @return {WordArray} This word array.\n\t *\n\t * @example\n\t *\n\t * wordArray1.concat(wordArray2);\n\t */\n\t concat: function (wordArray) {\n\t // Shortcuts\n\t var thisWords = this.words;\n\t var thatWords = wordArray.words;\n\t var thisSigBytes = this.sigBytes;\n\t var thatSigBytes = wordArray.sigBytes;\n\n\t // Clamp excess bits\n\t this.clamp();\n\n\t // Concat\n\t if (thisSigBytes % 4) {\n\t // Copy one byte at a time\n\t for (var i = 0; i < thatSigBytes; i++) {\n\t var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);\n\t }\n\t } else {\n\t // Copy one word at a time\n\t for (var j = 0; j < thatSigBytes; j += 4) {\n\t thisWords[(thisSigBytes + j) >>> 2] = thatWords[j >>> 2];\n\t }\n\t }\n\t this.sigBytes += thatSigBytes;\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Removes insignificant bits.\n\t *\n\t * @example\n\t *\n\t * wordArray.clamp();\n\t */\n\t clamp: function () {\n\t // Shortcuts\n\t var words = this.words;\n\t var sigBytes = this.sigBytes;\n\n\t // Clamp\n\t words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);\n\t words.length = Math.ceil(sigBytes / 4);\n\t },\n\n\t /**\n\t * Creates a copy of this word array.\n\t *\n\t * @return {WordArray} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = wordArray.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone.words = this.words.slice(0);\n\n\t return clone;\n\t },\n\n\t /**\n\t * Creates a word array filled with random bytes.\n\t *\n\t * @param {number} nBytes The number of random bytes to generate.\n\t *\n\t * @return {WordArray} The random word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.random(16);\n\t */\n\t random: function (nBytes) {\n\t var words = [];\n\n\t for (var i = 0; i < nBytes; i += 4) {\n\t words.push(cryptoSecureRandomInt());\n\t }\n\n\t return new WordArray.init(words, nBytes);\n\t }\n\t });\n\n\t /**\n\t * Encoder namespace.\n\t */\n\t var C_enc = C.enc = {};\n\n\t /**\n\t * Hex encoding strategy.\n\t */\n\t var Hex = C_enc.Hex = {\n\t /**\n\t * Converts a word array to a hex string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The hex string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hexString = CryptoJS.enc.Hex.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var hexChars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t hexChars.push((bite >>> 4).toString(16));\n\t hexChars.push((bite & 0x0f).toString(16));\n\t }\n\n\t return hexChars.join('');\n\t },\n\n\t /**\n\t * Converts a hex string to a word array.\n\t *\n\t * @param {string} hexStr The hex string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Hex.parse(hexString);\n\t */\n\t parse: function (hexStr) {\n\t // Shortcut\n\t var hexStrLength = hexStr.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < hexStrLength; i += 2) {\n\t words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);\n\t }\n\n\t return new WordArray.init(words, hexStrLength / 2);\n\t }\n\t };\n\n\t /**\n\t * Latin1 encoding strategy.\n\t */\n\t var Latin1 = C_enc.Latin1 = {\n\t /**\n\t * Converts a word array to a Latin1 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The Latin1 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var latin1Chars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t latin1Chars.push(String.fromCharCode(bite));\n\t }\n\n\t return latin1Chars.join('');\n\t },\n\n\t /**\n\t * Converts a Latin1 string to a word array.\n\t *\n\t * @param {string} latin1Str The Latin1 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);\n\t */\n\t parse: function (latin1Str) {\n\t // Shortcut\n\t var latin1StrLength = latin1Str.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < latin1StrLength; i++) {\n\t words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);\n\t }\n\n\t return new WordArray.init(words, latin1StrLength);\n\t }\n\t };\n\n\t /**\n\t * UTF-8 encoding strategy.\n\t */\n\t var Utf8 = C_enc.Utf8 = {\n\t /**\n\t * Converts a word array to a UTF-8 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The UTF-8 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t try {\n\t return decodeURIComponent(escape(Latin1.stringify(wordArray)));\n\t } catch (e) {\n\t throw new Error('Malformed UTF-8 data');\n\t }\n\t },\n\n\t /**\n\t * Converts a UTF-8 string to a word array.\n\t *\n\t * @param {string} utf8Str The UTF-8 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);\n\t */\n\t parse: function (utf8Str) {\n\t return Latin1.parse(unescape(encodeURIComponent(utf8Str)));\n\t }\n\t };\n\n\t /**\n\t * Abstract buffered block algorithm template.\n\t *\n\t * The property blockSize must be implemented in a concrete subtype.\n\t *\n\t * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0\n\t */\n\t var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({\n\t /**\n\t * Resets this block algorithm's data buffer to its initial state.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm.reset();\n\t */\n\t reset: function () {\n\t // Initial values\n\t this._data = new WordArray.init();\n\t this._nDataBytes = 0;\n\t },\n\n\t /**\n\t * Adds new data to this block algorithm's buffer.\n\t *\n\t * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm._append('data');\n\t * bufferedBlockAlgorithm._append(wordArray);\n\t */\n\t _append: function (data) {\n\t // Convert string to WordArray, else assume WordArray already\n\t if (typeof data == 'string') {\n\t data = Utf8.parse(data);\n\t }\n\n\t // Append\n\t this._data.concat(data);\n\t this._nDataBytes += data.sigBytes;\n\t },\n\n\t /**\n\t * Processes available data blocks.\n\t *\n\t * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\n\t *\n\t * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.\n\t *\n\t * @return {WordArray} The processed data.\n\t *\n\t * @example\n\t *\n\t * var processedData = bufferedBlockAlgorithm._process();\n\t * var processedData = bufferedBlockAlgorithm._process(!!'flush');\n\t */\n\t _process: function (doFlush) {\n\t var processedWords;\n\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\t var dataSigBytes = data.sigBytes;\n\t var blockSize = this.blockSize;\n\t var blockSizeBytes = blockSize * 4;\n\n\t // Count blocks ready\n\t var nBlocksReady = dataSigBytes / blockSizeBytes;\n\t if (doFlush) {\n\t // Round up to include partial blocks\n\t nBlocksReady = Math.ceil(nBlocksReady);\n\t } else {\n\t // Round down to include only full blocks,\n\t // less the number of blocks that must remain in the buffer\n\t nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);\n\t }\n\n\t // Count words ready\n\t var nWordsReady = nBlocksReady * blockSize;\n\n\t // Count bytes ready\n\t var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);\n\n\t // Process blocks\n\t if (nWordsReady) {\n\t for (var offset = 0; offset < nWordsReady; offset += blockSize) {\n\t // Perform concrete-algorithm logic\n\t this._doProcessBlock(dataWords, offset);\n\t }\n\n\t // Remove processed words\n\t processedWords = dataWords.splice(0, nWordsReady);\n\t data.sigBytes -= nBytesReady;\n\t }\n\n\t // Return processed words\n\t return new WordArray.init(processedWords, nBytesReady);\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = bufferedBlockAlgorithm.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone._data = this._data.clone();\n\n\t return clone;\n\t },\n\n\t _minBufferSize: 0\n\t });\n\n\t /**\n\t * Abstract hasher template.\n\t *\n\t * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)\n\t */\n\t var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({\n\t /**\n\t * Configuration options.\n\t */\n\t cfg: Base.extend(),\n\n\t /**\n\t * Initializes a newly created hasher.\n\t *\n\t * @param {Object} cfg (Optional) The configuration options to use for this hash computation.\n\t *\n\t * @example\n\t *\n\t * var hasher = CryptoJS.algo.SHA256.create();\n\t */\n\t init: function (cfg) {\n\t // Apply config defaults\n\t this.cfg = this.cfg.extend(cfg);\n\n\t // Set initial values\n\t this.reset();\n\t },\n\n\t /**\n\t * Resets this hasher to its initial state.\n\t *\n\t * @example\n\t *\n\t * hasher.reset();\n\t */\n\t reset: function () {\n\t // Reset data buffer\n\t BufferedBlockAlgorithm.reset.call(this);\n\n\t // Perform concrete-hasher logic\n\t this._doReset();\n\t },\n\n\t /**\n\t * Updates this hasher with a message.\n\t *\n\t * @param {WordArray|string} messageUpdate The message to append.\n\t *\n\t * @return {Hasher} This hasher.\n\t *\n\t * @example\n\t *\n\t * hasher.update('message');\n\t * hasher.update(wordArray);\n\t */\n\t update: function (messageUpdate) {\n\t // Append\n\t this._append(messageUpdate);\n\n\t // Update the hash\n\t this._process();\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Finalizes the hash computation.\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\n\t *\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @example\n\t *\n\t * var hash = hasher.finalize();\n\t * var hash = hasher.finalize('message');\n\t * var hash = hasher.finalize(wordArray);\n\t */\n\t finalize: function (messageUpdate) {\n\t // Final message update\n\t if (messageUpdate) {\n\t this._append(messageUpdate);\n\t }\n\n\t // Perform concrete-hasher logic\n\t var hash = this._doFinalize();\n\n\t return hash;\n\t },\n\n\t blockSize: 512/32,\n\n\t /**\n\t * Creates a shortcut function to a hasher's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to create a helper for.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHelper: function (hasher) {\n\t return function (message, cfg) {\n\t return new hasher.init(cfg).finalize(message);\n\t };\n\t },\n\n\t /**\n\t * Creates a shortcut function to the HMAC's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to use in this HMAC helper.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHmacHelper: function (hasher) {\n\t return function (message, key) {\n\t return new C_algo.HMAC.init(hasher, key).finalize(message);\n\t };\n\t }\n\t });\n\n\t /**\n\t * Algorithm namespace.\n\t */\n\t var C_algo = C.algo = {};\n\n\t return C;\n\t}(Math));\n\n\n\treturn CryptoJS;\n\n}));","!function(e,r){\"object\"==typeof exports&&\"undefined\"!=typeof module?r(exports):\"function\"==typeof define&&define.amd?define([\"exports\"],r):r((e=\"undefined\"!=typeof globalThis?globalThis:e||self).yh_crypto_sign={})}(this,(function(e){\"use strict\";\n/*! *****************************************************************************\n Copyright (c) Microsoft Corporation.\n\n Permission to use, copy, modify, and/or distribute this software for any\n purpose with or without fee is hereby granted.\n\n THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n PERFORMANCE OF THIS SOFTWARE.\n ***************************************************************************** */var r=function(){return r=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var o in r=arguments[n])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},r.apply(this,arguments)},n=require(\"crypto-js/core\");require(\"crypto-js/enc-base64\");var t={};require(\"crypto-js/lib-typedarrays\");var o=require(\"crypto-js/enc-base64\"),i=require(\"crypto-js/sha1\"),u=require(\"crypto-js/hmac-sha1\"),a=require(\"crypto-js/core\");function c(){var e=(new Date).toISOString().replace(/\\-|:|\\./g,\"\");return e.slice(0,-4).concat(e.slice(-1))}function s(){return o.stringify(n.lib.WordArray.random(16))}function f(e,r){return e>r?1:-1}function l(e,r,n,t){return e===n?f(r,t):f(e,n)}function y(e){var r=\"string\"==typeof e?e:Object.keys(e).reduce((function(r,n){return r.push(n+\"=\"+e[n]),r}),[]).join(\"&\");return r?r.split(\"&\").map((function(e){var r,n=null===(r=e.match(/=/))||void 0===r?void 0:r.index;return null!=n?[e.slice(0,n),e.slice(n+1)]:[e]})).sort((function(e,r){return l(e[0],e[1],r[0],r[1])})).reduce((function(e,r){return e.push(r[0]+\"=\"+(r[1]||\"\")),e}),[]).join(\"&\"):\"\"}function p(e){return i(e).toString(o)}function d(e){return\"string\"==typeof e?Promise.resolve(p(e)):e instanceof Blob?e.arrayBuffer().then((function(e){return r=e,i(a.lib.WordArray.create(r)).toString(o);var r})):new Promise((function(r){var n=[];e.forEach((function(e,r){n.push(new Promise((function(n){var t=r+\"=\";if(e instanceof File){var o=new FileReader;o.onload=function(e){n(t+p(a.lib.WordArray.create(e.target.result)))},o.readAsArrayBuffer(e.slice(0,1024))}else n(t+e)})))})),Promise.all(n).then((function(e){r(y(e.join(\"&\")))}))}))}function h(e,r){if(!(r=r||t.sign))throw new Error(\"没有签名秘钥\");var n=e.verb,i=e.path,a=e.host,c=e.header,s=e.body,f=e.query,p=e.log;return d(s).then((function(e){var t=function(e){return Object.keys(e).sort((function(r,n){return l(r.toLowerCase(),e[r],n.toLowerCase(),e[n])})).reduce((function(r,n){return r.push(n.toLowerCase()+\":\"+e[n]),r}),[]).join(\"\\n\")}(c),s=y(f),d=n+\"\\n\"+a+\"\\n\"+i+\"\\n\"+s+\"\\n\"+t+\"\\n\"+e;return p&&console.log(d),u(d,o.parse(r)).toString(o)}))}e.SIGN_AUTHORIZATION=\"YH \",e.getDate=c,e.getRandom16Nonce=s,e.intercepeReq=function(e,n,t){var o=n,i=o.method,u=o.url,a=o.params,f=o.data,l=o.headers,y=o.log,p=r({\"x-yh-date\":c(),\"x-yh-nonce\":s(),\"x-yh-traceid\":s()},Object.keys(l).reduce((function(e,r){return r.startsWith(\"x-yh\")&&(e[r]=l[r]),e}),{}));return h({verb:i.toUpperCase(),host:e,path:u,query:a||\"\",header:p,body:f?f instanceof FormData?f:JSON.stringify(f):\"\",log:y},t).then((function(e){return n.headers=r(r(r({},l),p),{Authorization:\"YH \"+e}),n}))},e.sign=h,Object.defineProperty(e,\"__esModule\",{value:!0})}));\n//# sourceMappingURL=sign.js.map\n","\"use strict\";Object.defineProperty(exports,\"__esModule\",{value:!0});var e,n,t;!function(e){e.WEBVIEW=\"WebView\",e.ACCOUNT=\"Account\"}(e||(e={})),function(e){e.OPEN_URL=\"openUrl\",e.CLOSE_WEBVIEW=\"closeWebView\",e.GET_TOKEN=\"getToken\"}(n||(n={})),function(e){e.SDK=\"sdk\",e.UNITY=\"unity\"}(t||(t={})),exports.isAndriod=function(){return!!navigator.userAgent.match(/Android/i)},exports.isInWebview=function(){return!!navigator.userAgent.match(\"YHSDK\")},exports.isIos=function(){return!!navigator.userAgent.match(/iPhone|iPad|iPod|Mac OS/i)&&\"ontouchend\"in document};\n//# sourceMappingURL=env.js.map\n",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var WordArray = C_lib.WordArray;\n\t var C_enc = C.enc;\n\n\t /**\n\t * Base64 encoding strategy.\n\t */\n\t var Base64 = C_enc.Base64 = {\n\t /**\n\t * Converts a word array to a Base64 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The Base64 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var base64String = CryptoJS.enc.Base64.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\t var map = this._map;\n\n\t // Clamp excess bits\n\t wordArray.clamp();\n\n\t // Convert\n\t var base64Chars = [];\n\t for (var i = 0; i < sigBytes; i += 3) {\n\t var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;\n\t var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;\n\n\t var triplet = (byte1 << 16) | (byte2 << 8) | byte3;\n\n\t for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {\n\t base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));\n\t }\n\t }\n\n\t // Add padding\n\t var paddingChar = map.charAt(64);\n\t if (paddingChar) {\n\t while (base64Chars.length % 4) {\n\t base64Chars.push(paddingChar);\n\t }\n\t }\n\n\t return base64Chars.join('');\n\t },\n\n\t /**\n\t * Converts a Base64 string to a word array.\n\t *\n\t * @param {string} base64Str The Base64 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Base64.parse(base64String);\n\t */\n\t parse: function (base64Str) {\n\t // Shortcuts\n\t var base64StrLength = base64Str.length;\n\t var map = this._map;\n\t var reverseMap = this._reverseMap;\n\n\t if (!reverseMap) {\n\t reverseMap = this._reverseMap = [];\n\t for (var j = 0; j < map.length; j++) {\n\t reverseMap[map.charCodeAt(j)] = j;\n\t }\n\t }\n\n\t // Ignore padding\n\t var paddingChar = map.charAt(64);\n\t if (paddingChar) {\n\t var paddingIndex = base64Str.indexOf(paddingChar);\n\t if (paddingIndex !== -1) {\n\t base64StrLength = paddingIndex;\n\t }\n\t }\n\n\t // Convert\n\t return parseLoop(base64Str, base64StrLength, reverseMap);\n\n\t },\n\n\t _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='\n\t };\n\n\t function parseLoop(base64Str, base64StrLength, reverseMap) {\n\t var words = [];\n\t var nBytes = 0;\n\t for (var i = 0; i < base64StrLength; i++) {\n\t if (i % 4) {\n\t var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);\n\t var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);\n\t var bitsCombined = bits1 | bits2;\n\t words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8);\n\t nBytes++;\n\t }\n\t }\n\t return WordArray.create(words, nBytes);\n\t }\n\t}());\n\n\n\treturn CryptoJS.enc.Base64;\n\n}));",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var WordArray = C_lib.WordArray;\n\t var Hasher = C_lib.Hasher;\n\t var C_algo = C.algo;\n\n\t // Reusable object\n\t var W = [];\n\n\t /**\n\t * SHA-1 hash algorithm.\n\t */\n\t var SHA1 = C_algo.SHA1 = Hasher.extend({\n\t _doReset: function () {\n\t this._hash = new WordArray.init([\n\t 0x67452301, 0xefcdab89,\n\t 0x98badcfe, 0x10325476,\n\t 0xc3d2e1f0\n\t ]);\n\t },\n\n\t _doProcessBlock: function (M, offset) {\n\t // Shortcut\n\t var H = this._hash.words;\n\n\t // Working variables\n\t var a = H[0];\n\t var b = H[1];\n\t var c = H[2];\n\t var d = H[3];\n\t var e = H[4];\n\n\t // Computation\n\t for (var i = 0; i < 80; i++) {\n\t if (i < 16) {\n\t W[i] = M[offset + i] | 0;\n\t } else {\n\t var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];\n\t W[i] = (n << 1) | (n >>> 31);\n\t }\n\n\t var t = ((a << 5) | (a >>> 27)) + e + W[i];\n\t if (i < 20) {\n\t t += ((b & c) | (~b & d)) + 0x5a827999;\n\t } else if (i < 40) {\n\t t += (b ^ c ^ d) + 0x6ed9eba1;\n\t } else if (i < 60) {\n\t t += ((b & c) | (b & d) | (c & d)) - 0x70e44324;\n\t } else /* if (i < 80) */ {\n\t t += (b ^ c ^ d) - 0x359d3e2a;\n\t }\n\n\t e = d;\n\t d = c;\n\t c = (b << 30) | (b >>> 2);\n\t b = a;\n\t a = t;\n\t }\n\n\t // Intermediate hash value\n\t H[0] = (H[0] + a) | 0;\n\t H[1] = (H[1] + b) | 0;\n\t H[2] = (H[2] + c) | 0;\n\t H[3] = (H[3] + d) | 0;\n\t H[4] = (H[4] + e) | 0;\n\t },\n\n\t _doFinalize: function () {\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\n\t var nBitsTotal = this._nDataBytes * 8;\n\t var nBitsLeft = data.sigBytes * 8;\n\n\t // Add padding\n\t dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;\n\t data.sigBytes = dataWords.length * 4;\n\n\t // Hash final blocks\n\t this._process();\n\n\t // Return final computed hash\n\t return this._hash;\n\t },\n\n\t clone: function () {\n\t var clone = Hasher.clone.call(this);\n\t clone._hash = this._hash.clone();\n\n\t return clone;\n\t }\n\t });\n\n\t /**\n\t * Shortcut function to the hasher's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hash = CryptoJS.SHA1('message');\n\t * var hash = CryptoJS.SHA1(wordArray);\n\t */\n\t C.SHA1 = Hasher._createHelper(SHA1);\n\n\t /**\n\t * Shortcut function to the HMAC's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t * @param {WordArray|string} key The secret key.\n\t *\n\t * @return {WordArray} The HMAC.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hmac = CryptoJS.HmacSHA1(message, key);\n\t */\n\t C.HmacSHA1 = Hasher._createHmacHelper(SHA1);\n\t}());\n\n\n\treturn CryptoJS.SHA1;\n\n}));","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Check if typed arrays are supported\n\t if (typeof ArrayBuffer != 'function') {\n\t return;\n\t }\n\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var WordArray = C_lib.WordArray;\n\n\t // Reference original init\n\t var superInit = WordArray.init;\n\n\t // Augment WordArray.init to handle typed arrays\n\t var subInit = WordArray.init = function (typedArray) {\n\t // Convert buffers to uint8\n\t if (typedArray instanceof ArrayBuffer) {\n\t typedArray = new Uint8Array(typedArray);\n\t }\n\n\t // Convert other array views to uint8\n\t if (\n\t typedArray instanceof Int8Array ||\n\t (typeof Uint8ClampedArray !== \"undefined\" && typedArray instanceof Uint8ClampedArray) ||\n\t typedArray instanceof Int16Array ||\n\t typedArray instanceof Uint16Array ||\n\t typedArray instanceof Int32Array ||\n\t typedArray instanceof Uint32Array ||\n\t typedArray instanceof Float32Array ||\n\t typedArray instanceof Float64Array\n\t ) {\n\t typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);\n\t }\n\n\t // Handle Uint8Array\n\t if (typedArray instanceof Uint8Array) {\n\t // Shortcut\n\t var typedArrayByteLength = typedArray.byteLength;\n\n\t // Extract bytes\n\t var words = [];\n\t for (var i = 0; i < typedArrayByteLength; i++) {\n\t words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8);\n\t }\n\n\t // Initialize this word array\n\t superInit.call(this, words, typedArrayByteLength);\n\t } else {\n\t // Else call normal init\n\t superInit.apply(this, arguments);\n\t }\n\t };\n\n\t subInit.prototype = WordArray;\n\t}());\n\n\n\treturn CryptoJS.lib.WordArray;\n\n}));",";(function (root, factory, undef) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"), require(\"./sha1\"), require(\"./hmac\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\", \"./sha1\", \"./hmac\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\treturn CryptoJS.HmacSHA1;\n\n}));",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var Base = C_lib.Base;\n\t var C_enc = C.enc;\n\t var Utf8 = C_enc.Utf8;\n\t var C_algo = C.algo;\n\n\t /**\n\t * HMAC algorithm.\n\t */\n\t var HMAC = C_algo.HMAC = Base.extend({\n\t /**\n\t * Initializes a newly created HMAC.\n\t *\n\t * @param {Hasher} hasher The hash algorithm to use.\n\t * @param {WordArray|string} key The secret key.\n\t *\n\t * @example\n\t *\n\t * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);\n\t */\n\t init: function (hasher, key) {\n\t // Init hasher\n\t hasher = this._hasher = new hasher.init();\n\n\t // Convert string to WordArray, else assume WordArray already\n\t if (typeof key == 'string') {\n\t key = Utf8.parse(key);\n\t }\n\n\t // Shortcuts\n\t var hasherBlockSize = hasher.blockSize;\n\t var hasherBlockSizeBytes = hasherBlockSize * 4;\n\n\t // Allow arbitrary length keys\n\t if (key.sigBytes > hasherBlockSizeBytes) {\n\t key = hasher.finalize(key);\n\t }\n\n\t // Clamp excess bits\n\t key.clamp();\n\n\t // Clone key for inner and outer pads\n\t var oKey = this._oKey = key.clone();\n\t var iKey = this._iKey = key.clone();\n\n\t // Shortcuts\n\t var oKeyWords = oKey.words;\n\t var iKeyWords = iKey.words;\n\n\t // XOR keys with pad constants\n\t for (var i = 0; i < hasherBlockSize; i++) {\n\t oKeyWords[i] ^= 0x5c5c5c5c;\n\t iKeyWords[i] ^= 0x36363636;\n\t }\n\t oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;\n\n\t // Set initial values\n\t this.reset();\n\t },\n\n\t /**\n\t * Resets this HMAC to its initial state.\n\t *\n\t * @example\n\t *\n\t * hmacHasher.reset();\n\t */\n\t reset: function () {\n\t // Shortcut\n\t var hasher = this._hasher;\n\n\t // Reset\n\t hasher.reset();\n\t hasher.update(this._iKey);\n\t },\n\n\t /**\n\t * Updates this HMAC with a message.\n\t *\n\t * @param {WordArray|string} messageUpdate The message to append.\n\t *\n\t * @return {HMAC} This HMAC instance.\n\t *\n\t * @example\n\t *\n\t * hmacHasher.update('message');\n\t * hmacHasher.update(wordArray);\n\t */\n\t update: function (messageUpdate) {\n\t this._hasher.update(messageUpdate);\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Finalizes the HMAC computation.\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\n\t *\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\n\t *\n\t * @return {WordArray} The HMAC.\n\t *\n\t * @example\n\t *\n\t * var hmac = hmacHasher.finalize();\n\t * var hmac = hmacHasher.finalize('message');\n\t * var hmac = hmacHasher.finalize(wordArray);\n\t */\n\t finalize: function (messageUpdate) {\n\t // Shortcut\n\t var hasher = this._hasher;\n\n\t // Compute HMAC\n\t var innerHash = hasher.finalize(messageUpdate);\n\t hasher.reset();\n\t var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));\n\n\t return hmac;\n\t }\n\t });\n\t}());\n\n\n}));","export const Version = {\n V1: \"v1\",\n} as const;\nexport const AppId = {\n NINJA3: \"ninja3\",\n} as const;\nexport type InRecord<T> = Record<keyof T, T[keyof T]>;\ntype ValueOf<T> = T[keyof T];\n\nexport interface IPostValidate {\n x: number;\n}\n\nexport interface IGetCaptcha {\n appId: string;\n version: string;\n}\n\nexport interface ICaptcha {\n token: string;\n bgUrl: string;\n fgUrl: string;\n y: number;\n}\n\nexport interface ICaptchaConfig {\n appId: ValueOf<typeof AppId>;\n success?: (token: string) => void;\n baseUrl: string;\n version: ValueOf<typeof Version>;\n}\n\nexport interface IResponse<T> {\n code: number;\n msg: string;\n data: T;\n}\n","const SMALLER_WIDTH = 4;\nexport const IMG_SIZE = 50 * devicePixelRatio;\n\nexport function triangleDraw(\n ctx: CanvasRenderingContext2D,\n x: number,\n y: number,\n size: \"small\" | \"normal\" = \"normal\"\n) {\n const sideLength = 44 * devicePixelRatio;\n ctx.beginPath();\n if (size === \"normal\") {\n ctx.moveTo(x, y);\n ctx.lineTo(x + sideLength, y);\n ctx.lineTo(x + sideLength, y + sideLength);\n } else {\n ctx.moveTo(x + SMALLER_WIDTH * 2.5, y + SMALLER_WIDTH );\n ctx.lineTo(x + sideLength - SMALLER_WIDTH , y + SMALLER_WIDTH );\n ctx.lineTo(x + sideLength - SMALLER_WIDTH , y + sideLength - SMALLER_WIDTH * 2.5);\n }\n ctx.closePath();\n\n return { left: 3, top: 3 };\n}\n","import { IMG_SIZE, triangleDraw } from \"./draw\";\n\nexport function random(total: number, test?: (result: number) => boolean) {\n let latest: number;\n\n const calRandom = () => {\n const num = Math.ceil(Math.random() * total);\n return num === total ? num - 1 : num;\n };\n return function () {\n let result = calRandom();\n while (result === latest || (test && test(result))) {\n result = calRandom();\n }\n latest = result;\n\n return result;\n };\n}\n\nexport const BACK_WIDTH = 300;\nexport const BACK_HEIGHT = 150;\n\nexport const leftRandom = random(BACK_WIDTH - 50, (result) => result < 60);\nexport const topRandom = random(BACK_HEIGHT - 50, (result) => result < 50);\n\nexport function getLeft(el: HTMLElement) {\n return +getComputedStyle(el).left.match(/\\d+/)![0];\n}\n\nexport function loadImage(\n img: any,\n callback?: (img: HTMLImageElement) => void\n) {\n let resolved: (img: HTMLImageElement) => void;\n const promise = new Promise<HTMLImageElement>((r) => (resolved = r));\n const imgEl = new Image();\n imgEl.onload = () => {\n callback?.(imgEl);\n resolved(imgEl);\n };\n imgEl.src = img;\n\n return promise;\n}\n\nexport async function addBorder(\n canvas: HTMLCanvasElement,\n x: number,\n y: number,\n options: {\n shadowColor: string;\n fillStyle: string;\n reFillStyle?: string;\n }\n) {\n const ctx = canvas.getContext(\"2d\");\n const { shadowColor, fillStyle, reFillStyle } = options;\n triangleDraw(ctx, x, y);\n ctx.globalCompositeOperation = \"destination-in\";\n ctx.fill();\n\n const borderCanvas = canvas.cloneNode() as HTMLCanvasElement;\n const borderCtx = borderCanvas.getContext(\"2d\");\n triangleDraw(borderCtx, x, y);\n borderCtx.shadowBlur = 2;\n borderCtx.shadowColor = shadowColor;\n borderCtx.fillStyle = fillStyle;\n borderCtx.strokeStyle = shadowColor;\n borderCtx.fill();\n // borderCtx.lineWidth = 0.5;\n // borderCtx.stroke();\n\n triangleDraw(borderCtx, x, y, \"small\");\n borderCtx.shadowBlur = 0;\n borderCtx.globalCompositeOperation = \"destination-out\";\n borderCtx.fill();\n if (reFillStyle) {\n triangleDraw(borderCtx, x, y, \"small\");\n borderCtx.globalCompositeOperation = \"source-over\";\n borderCtx.fillStyle = reFillStyle;\n borderCtx.fill();\n }\n const url = await loadImage(canvasToPng(borderCanvas));\n ctx.globalCompositeOperation = \"source-over\";\n ctx.drawImage(url, 0, 0);\n\n return {\n left: x,\n top: y,\n };\n}\n\nexport function canvasToPng(canvas: HTMLCanvasElement) {\n return canvas.toDataURL(\"image/png\");\n}\n\nexport function coverCanvas(canvas: HTMLCanvasElement, x: number, y: number) {\n const ctx = canvas.getContext(\"2d\");\n const data = ctx.getImageData(x, y, IMG_SIZE, IMG_SIZE);\n canvas.width = IMG_SIZE;\n canvas.height = IMG_SIZE;\n ctx.putImageData(data, 0, 0);\n\n return canvas;\n}\n\nexport const SIGN = {\n secret: \"ZWjJ1B7dCoB1ZqDFLm7Ix77GBsnCAyv2wcqg6sA5QAI=\",\n appid: \"356959\",\n};\n","import {\n SIGN_AUTHORIZATION,\n getDate,\n getRandom16Nonce,\n sign,\n} from \"@blazes/crypto/dist/sign\";\nimport { IGetCaptcha, ICaptcha, IPostValidate, IResponse } from \"./type\";\nimport { SIGN } from \"./utils\";\n\ninterface IRequestConfig {\n method: \"get\" | \"post\";\n body?: Record<string, any>;\n}\n\ninterface ApiInstanceConfig {\n baseUrl: string;\n}\n\nexport class ApiInstance {\n private config: ApiInstanceConfig;\n constructor(config: ApiInstanceConfig) {\n this.config = config;\n }\n\n private request<T>(url: string, config: IRequestConfig) {\n return new Promise<T>((resolve, reject) => {\n const { method, body } = config;\n const { baseUrl } = this.config;\n const { secret, appid } = SIGN;\n const xhr = new XMLHttpRequest();\n\n xhr.open(method.toLocaleUpperCase(), `${baseUrl}${url}`, true);\n xhr.setRequestHeader(\"Content-type\", \"application/json; charset=utf-8\");\n\n xhr.onreadystatechange = function () {\n if (xhr.readyState !== 4) {\n return;\n }\n if (xhr.status !== 200) {\n reject(\"请求错误\");\n }\n const data = JSON.parse(xhr.responseText) as IResponse<T>;\n const { code, msg = \"\", data: respData } = data;\n if (code === 0) {\n resolve(respData);\n } else {\n reject(msg);\n }\n };\n xhr.onerror = function handleError() {\n reject(\"网络错误\");\n };\n xhr.ontimeout = function handleTimeout() {\n reject(\"请求超时\");\n };\n\n const header: Record<string, string> = {\n \"x-yh-date\": getDate(),\n \"x-yh-nonce\": getRandom16Nonce(),\n \"x-yh-traceid\": getRandom16Nonce(),\n \"x-yh-appid\": appid,\n };\n\n sign(\n {\n host: this.getHost(baseUrl),\n path: url,\n verb: method.toLocaleUpperCase(),\n query: \"\",\n body: JSON.stringify(body) || \"\",\n header,\n log: true,\n },\n secret\n ).then((authorization) => {\n xhr.setRequestHeader(\n \"Authorization\",\n `${SIGN_AUTHORIZATION}${authorization}`\n );\n const keys = Object.keys(header);\n keys.forEach((key) => {\n xhr.setRequestHeader(key, header[key]);\n });\n\n xhr.send(body ? JSON.stringify(body) : \"\");\n });\n });\n }\n\n getCaptcha(params: IGetCaptcha): Promise<ICaptcha> {\n return this.request(\n `/apis/v1/apps/${params.appId}/versions/${params.version}/captchas`,\n {\n method: \"get\",\n }\n );\n }\n\n postValidate(token: string, params: IPostValidate): Promise<null> {\n return this.request(`/apis/v1/tokens/${token}/validate`, {\n method: \"post\",\n body: params,\n });\n }\n\n getHost(origin: string) {\n return origin.replace(/http[s]:\\/\\//, \"\");\n }\n}\n","export const CloseImage =\n \"https://captcha-res.pandadastudio.com/static/img/close.png\";\nexport const ErrorImage =\n \"https://captcha-res.pandadastudio.com/static/img/error.png\";\nexport const WaitingImage =\n \"https://captcha-res.pandadastudio.com/static/img/waiting.png\";\nexport const LogoImage =\n \"https://captcha-res.pandadastudio.com/static/img/logo.png\";\nexport const RefreshImage =\n \"https://captcha-res.pandadastudio.com/static/img/refresh.png\";\nexport const RetryImage =\n \"https://captcha-res.pandadastudio.com/static/img/retry.jpg\";\nexport const LoadingImage =\n \"https://captcha-res.pandadastudio.com/static/img/loading.gif\";\n","import {\n CloseImage,\n RefreshImage,\n LogoImage,\n LoadingImage,\n RetryImage,\n} from \"./image-url\";\n\nexport const wrapTemplate = `\n <div class=\"dx-captcha-header\">\n <img src=${CloseImage} />\n </div>\n <div class=\"dx-captcha-body\">\n <canvas></canvas>\n <img class=\"dx-captcha-body-slider\" draggable=\"false\" />\n <img class=\"dx-captcha-body-refresh\" src=${RefreshImage} width=\"16px\" height=\"16px\" />\n <img class=\"dx-captcha-body-logo\" src=${LogoImage} width=\"78px\" height=\"30px\" />\n <div class=\"dx-captcha-body-loading display-none\">\n <div>\n <img class=\"dx-captcha-body-loading-img\" src=${LoadingImage} />\n <div class=\"dx-captcha-body-loading-text\">加载中...</div>\n </div>\n </div>\n </div>\n <div class=\"dx-captcha-bar\">\n <div class=\"dx-captcha-bar-slider\"></div>\n <div class=\"dx-captcha-bar-progress\"></div>\n <span class=\"dx-captcha-bar-text\">\n 请<span style=\"color:#F56A00;\">拖动</span>左侧滑块将图片还原\n </span>\n </div>\n`;\n\nexport const defaultTemplate = `\n <div class=\"dx-captcha-mask\"></div>\n <div class=\"dx-captcha-wrap\">\n ${wrapTemplate}\n </div>\n`;\n\nexport const successBarTemplate = `\n <span class=\"dx-captcha-bar-text\">\n 验证成功\n </span>\n`;\n\nexport const retryTemplate = `\n <div class=\"dx-captcha-retry\">\n <img class=\"dx-captcha-retry-img\" src=${RetryImage} />\n <div>加载失败,<a class=\"dx-captcha-retry-link\">请点击重试!</a></div>\n </div>\n`;\n","import { isAndriod, isIos } from \"@blazes/webview-sdk/dist/env\";\nimport { ApiInstance } from \"./api\";\nimport { ICaptchaConfig } from \"./type\";\nimport { getLeft, loadImage, BACK_WIDTH, BACK_HEIGHT } from \"./utils\";\nimport \"./assets/style/index.less\";\nimport { defaultTemplate, retryTemplate, successBarTemplate } from \"./template\";\nimport { RefreshImage, WaitingImage, ErrorImage } from \"./image-url\";\n\nconst FALLBACK_DRUATION = 0.5;\n\nexport class Captcha {\n private root: HTMLDivElement;\n private refs: {\n wrapper: HTMLDivElement;\n close: HTMLImageElement;\n canvas: HTMLCanvasElement;\n fragment: HTMLImageElement;\n refresh: HTMLImageElement;\n logo: HTMLImageElement;\n bar: HTMLDivElement;\n slider: HTMLDivElement;\n progress: HTMLDivElement;\n infoText: HTMLSpanElement;\n loading: HTMLElement;\n };\n private token: string;\n private eventNames: {\n down: string;\n up: string;\n move: string;\n };\n private config: ICaptchaConfig;\n private resolve: (token: string) => void;\n private apiInstance: ApiInstance;\n\n constructor(config: ICaptchaConfig) {\n this.config = Object.assign({}, config);\n this.apiInstance = new ApiInstance({ baseUrl: config.baseUrl });\n this.initEventNames();\n }\n\n private initEventNames() {\n if (isAndriod() || isIos()) {\n this.eventNames = {\n down: \"touchstart\",\n up: \"touchend\",\n move: \"touchmove\",\n };\n } else {\n this.eventNames = {\n down: \"mousedown\",\n up: \"mouseup\",\n move: \"mousemove\",\n };\n }\n }\n\n private initRoot() {\n const root = document.createElement(\"div\");\n root.classList.add(\"dx-captcha-root\");\n document.body.appendChild(root);\n\n return root;\n }\n\n show() {\n if (!this.root) {\n this.root = this.initRoot();\n }\n const p = new Promise<string>((r) => (this.resolve = r));\n this.render();\n return p;\n }\n\n private render() {\n this.root.innerHTML = defaultTemplate;\n this.queryRef();\n this.handleHeader();\n this.handleBody().then((token) => {\n this.token = token;\n this.handleBar();\n });\n }\n\n private queryRef() {\n const query = <T>(selector: string): T =>\n this.root.querySelector(selector) as unknown as T;\n const wrapper = query<HTMLDivElement>(\".dx-captcha-wrap\");\n const close = query<HTMLImageElement>(\".dx-captcha-header img\");\n const canvas = query<HTMLCanvasElement>(\"canvas\");\n const bar = query<HTMLDivElement>(\".dx-captcha-bar\");\n const slider = query<HTMLDivElement>(\".dx-captcha-bar-slider\");\n const fragment = query<HTMLImageElement>(\".dx-captcha-body-slider\");\n const refresh = query<HTMLImageElement>(\".dx-captcha-body-refresh\");\n const logo = query<HTMLImageElement>(\".dx-captcha-body-logo\");\n const progress = query<HTMLDivElement>(\".dx-captcha-bar-progress\");\n const infoText = query<HTMLSpanElement>(\".dx-captcha-bar-text\");\n const loading = query<HTMLSpanElement>(\".dx-captcha-body-loading\");\n\n this.refs = {\n wrapper,\n close,\n canvas,\n fragment,\n bar,\n slider,\n progress,\n infoText,\n refresh,\n logo,\n loading,\n };\n }\n\n close() {\n const wrapper = this.refs.wrapper;\n wrapper.style.top = \"0\";\n wrapper.style.opacity = \"0\";\n setTimeout(() => {\n this.root.innerHTML = \"\";\n }, 300);\n }\n\n private retry() {\n this.refs.wrapper.innerHTML = retryTemplate;\n const retryLink = this.refs.wrapper.querySelector(\n \".dx-captcha-retry-link\"\n ) as HTMLLinkElement;\n retryLink.addEventListener(\"click\", () => {\n this.render();\n });\n }\n\n private handleHeader() {\n const closeEl = this.refs.close;\n closeEl.addEventListener(\"click\", () => {\n this.close();\n });\n }\n\n private handleBody() {\n this.addRefresh();\n return this.drawBackground();\n }\n\n private drawBackground() {\n const { refs, apiInstance, config } = this;\n const { canvas, loading, fragment } = refs;\n canvas.width = BACK_WIDTH * devicePixelRatio;\n canvas.height = BACK_HEIGHT * devicePixelRatio;\n const ctx = canvas.getContext(\"2d\");\n let resolved: (token: string) => void;\n const p = new Promise<string>((r) => (resolved = r));\n\n loading.classList.remove(\"display-none\");\n apiInstance\n .getCaptcha({ appId: config.appId, version: config.version })\n .then(({ y, token, bgUrl, fgUrl }) => {\n loadImage(bgUrl, (url) => {\n loading.classList.add(\"display-none\");\n ctx.drawImage(url, 0, 0, canvas.width, canvas.height);\n fragment.src = fgUrl;\n fragment.style.top = `${y}px`;\n\n resolved(token);\n });\n })\n .catch(() => {\n this.retry();\n });\n\n return p;\n }\n\n private addRefresh() {\n const refresh = this.refs.refresh;\n refresh.src = RefreshImage;\n refresh.addEventListener(\"click\", () => {\n this.reset();\n });\n }\n\n reset() {\n this.clearCanvas();\n this.drawBackground().then((token) => {\n this.token = token;\n });\n const { slider, progress } = this.refs;\n this.loopBar((el) => {\n el.style.transitionDuration = \"0s\";\n });\n slider.style.backgroundImage = `url(${WaitingImage})`;\n progress.classList.remove(\"error\");\n progress.classList.add(\"success\");\n }\n\n private clearCanvas() {\n const canvas = this.refs.canvas;\n const ctx = canvas.getContext(\"2d\");\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n }\n\n private handleBar() {\n const { down, move, up } = this.eventNames;\n const { bar, fragment, slider, progress } = this.refs;\n const maxLeft =\n bar.getBoundingClientRect().width - slider.getBoundingClientRect().width;\n\n let originX: number, curOffset: number;\n const fallbacking = { value: false };\n const moveBar = (event: MouseEvent | TouchEvent) => {\n event.preventDefault();\n const offset = this.getClientX(event) - originX + curOffset;\n if (offset > maxLeft || offset < 0) {\n return;\n }\n this.moveBar(offset);\n };\n const upMouse = () => {\n document.body.removeEventListener(move, moveBar);\n document.body.removeEventListener(up, upMouse);\n const left = getLeft(fragment);\n this.apiInstance\n .postValidate(this.token, {\n x: left,\n })\n .then(() => {\n this.verifySuccess();\n })\n .catch(() => {\n this.verifyFail(fallbacking);\n });\n };\n slider.addEventListener(down, (event: MouseEvent | TouchEvent) => {\n if (fallbacking.value) {\n return;\n }\n originX = this.getClientX(event);\n curOffset = getLeft(fragment);\n progress.classList.add(\"success\");\n document.body.addEventListener(move, moveBar);\n document.body.addEventListener(up, upMouse);\n });\n }\n\n private getClientX(event: MouseEvent | TouchEvent) {\n return (\n (event as MouseEvent).clientX || (event as TouchEvent).touches[0].clientX\n );\n }\n\n private verifyFail(fallbacking: { value: boolean }) {\n fallbacking.value = true;\n const { slider, progress } = this.refs;\n slider.style.backgroundImage = `url(${ErrorImage})`;\n progress.classList.remove(\"success\");\n progress.classList.add(\"error\");\n this.fallbackBar();\n setTimeout(() => {\n this.reset();\n fallbacking.value = false;\n }, FALLBACK_DRUATION * 1000);\n }\n\n private verifySuccess() {\n const { refs, token, config } = this;\n const bar = refs.bar;\n bar.innerHTML = successBarTemplate;\n bar.classList.add(\"success\");\n setTimeout(() => {\n this.close();\n config.success?.(token);\n this.resolve(token);\n });\n }\n\n private moveBar(offset: number) {\n this.loopBar((el) => {\n el.style[this.getChangeProperty(el)] = `${offset}px`;\n });\n }\n\n private fallbackBar() {\n this.loopBar((el) => {\n el.style.transitionDuration = `${FALLBACK_DRUATION}s`;\n el.style[this.getChangeProperty(el)] = \"0\";\n });\n }\n\n private getChangeProperty(el: HTMLElement) {\n return el.classList.contains(\"dx-captcha-bar-progress\") ? \"width\" : \"left\";\n }\n\n private loopBar(callback: (el: HTMLElement) => void) {\n const { fragment, slider, progress } = this.refs;\n [fragment, slider, progress].forEach((el) => callback(el));\n }\n}\n\nexport interface Captcha {\n new (config: ICaptchaConfig): Captcha;\n}\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack://yh_captcha/webpack/universalModuleDefinition","webpack://yh_captcha/webpack/bootstrap","webpack://yh_captcha/./node_modules/@blazes/webview-sdk/dist/env.js","webpack://yh_captcha/./src/type.ts","webpack://yh_captcha/./src/lang.ts","webpack://yh_captcha/./src/api.ts","webpack://yh_captcha/./src/utils.ts","webpack://yh_captcha/./src/image-url.ts","webpack://yh_captcha/./src/template.ts","webpack://yh_captcha/./src/captcha.ts"],"names":["root","factory","exports","module","define","amd","this","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","e","WEBVIEW","ACCOUNT","OPEN_URL","CLOSE_WEBVIEW","GET_TOKEN","SDK","UNITY","isAndriod","navigator","userAgent","match","isInWebview","isIos","document","Language","Translate","Version","V1","resources","HANS","DRAG","LOADING","SUCCESS","FAIL","RETRY","HANT","JA","KO","EN","ApiInstance","config","url","Promise","resolve","reject","method","body","xhr","XMLHttpRequest","open","toLocaleUpperCase","baseUrl","setRequestHeader","onreadystatechange","readyState","status","data","JSON","parse","responseText","code","msg","respData","onerror","ontimeout","send","stringify","params","request","appId","version","token","getLeft","el","getComputedStyle","left","host","CloseImage","ErrorImage","WaitingImage","RefreshImage","RetryImage","LoadingImage","wrapTemplate","lang","LogoImage","Captcha","setConfig","apiInstance","initEventNames","values","includes","Error","assign","eventNames","down","up","move","createElement","classList","add","appendChild","initRoot","render","innerHTML","queryRef","handleHeader","handleBody","then","handleBar","query","selector","querySelector","wrapper","close","canvas","bar","slider","fragment","refresh","logo","progress","infoText","loading","refs","style","top","opacity","setTimeout","addEventListener","addRefresh","drawBackground","width","devicePixelRatio","height","resolved","ctx","getContext","remove","getCaptcha","y","bgUrl","fgUrl","img","callback","imgEl","Image","onload","src","loadImage","drawImage","catch","retry","reset","clearCanvas","loopBar","transitionDuration","backgroundImage","clearRect","originX","curOffset","maxLeft","getBoundingClientRect","fallbacking","moveBar","event","preventDefault","offset","getClientX","upMouse","removeEventListener","postValidate","x","verifySuccess","verifyFail","clientX","touches","fallbackBar","FALLBACK_DRUATION","success","getChangeProperty","contains","forEach"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAoB,WAAID,IAExBD,EAAiB,WAAIC,IARvB,CASGK,MAAM,WACT,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUP,QAGnC,IAAIC,EAASI,EAAiBE,GAAY,CACzCC,EAAGD,EACHE,GAAG,EACHT,QAAS,IAUV,OANAU,EAAQH,GAAUI,KAAKV,EAAOD,QAASC,EAAQA,EAAOD,QAASM,GAG/DL,EAAOQ,GAAI,EAGJR,EAAOD,QA0Df,OArDAM,EAAoBM,EAAIF,EAGxBJ,EAAoBO,EAAIR,EAGxBC,EAAoBQ,EAAI,SAASd,EAASe,EAAMC,GAC3CV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B,OAAOA,EAAG0B,UAAUkF,SAAS,2BAA6B,QAAU,SACrE,qBAED,SAAgBrC,GACd,MAAuC3K,KAAKuJ,KAC5C,CADgB,EAARN,SAAgB,EAAND,OAAgB,EAARI,UACG6D,SAAQ,SAAC7G,GAAE,OAAKuE,EAASvE,W,8EACvD,EAzSiB","file":"index.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"yh_captcha\"] = factory();\n\telse\n\t\troot[\"yh_captcha\"] = factory();\n})(this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n","\"use strict\";Object.defineProperty(exports,\"__esModule\",{value:!0});var e,n,t;!function(e){e.WEBVIEW=\"WebView\",e.ACCOUNT=\"Account\"}(e||(e={})),function(e){e.OPEN_URL=\"openUrl\",e.CLOSE_WEBVIEW=\"closeWebView\",e.GET_TOKEN=\"getToken\"}(n||(n={})),function(e){e.SDK=\"sdk\",e.UNITY=\"unity\"}(t||(t={})),exports.isAndriod=function(){return!!navigator.userAgent.match(/Android/i)},exports.isInWebview=function(){return!!navigator.userAgent.match(\"YHSDK\")},exports.isIos=function(){return!!navigator.userAgent.match(/iPhone|iPad|iPod|Mac OS/i)&&\"ontouchend\"in document};\n//# sourceMappingURL=env.js.map\n","import { Language } from \"./lang\";\n\nexport const Version = {\n V1: \"v1\",\n} as const;\nexport const AppId = {\n NINJA3: \"ninja3\",\n} as const;\nexport type InRecord<T> = Record<keyof T, T[keyof T]>;\ntype ValueOf<T> = T[keyof T];\n\nexport interface IPostValidate {\n x: number;\n}\n\nexport interface IGetCaptcha {\n appId: string;\n version: string;\n}\n\nexport interface ICaptcha {\n token: string;\n bgUrl: string;\n fgUrl: string;\n y: number;\n}\n\nexport interface ICaptchaConfig {\n appId: string;\n success?: (token: string) => void;\n baseUrl: string;\n version: string;\n lang: Language;\n}\n\nexport interface IResponse<T> {\n code: number;\n msg: string;\n data: T;\n}\n","export enum Language {\n HANT = \"hant\",\n HANS = \"hans\",\n JA = \"ja\",\n EN = \"en\",\n KO = \"ko\",\n}\n\nexport enum Translate {\n DRAG = \"drag\",\n LOADING = \"loading\",\n SUCCESS = \"success\",\n FAIL = \"fail\",\n RETRY = \"retry\",\n}\n\nexport const resources = {\n [Language.HANS]: {\n [Translate.DRAG]: \"拖动左侧滑块将图片还原\",\n [Translate.LOADING]: \"加载中... \",\n [Translate.SUCCESS]: \"验证成功\",\n [Translate.FAIL]: \"加载失败,\",\n [Translate.RETRY]: \"请点击重试!\",\n },\n [Language.HANT]: {\n [Translate.DRAG]: \"拖動左側滑塊將圖片還原\",\n [Translate.LOADING]: \"加載中... \",\n [Translate.SUCCESS]: \"驗證成功\",\n [Translate.FAIL]: \"加載失敗,\",\n [Translate.RETRY]: \"請點擊重試!\",\n },\n [Language.JA]: {\n [Translate.DRAG]:\n \"矢印を右にスライドしてください\",\n [Translate.LOADING]: \"ロード中... \",\n [Translate.SUCCESS]: \"認証成功\",\n [Translate.FAIL]: \"ロードに失敗、\",\n [Translate.RETRY]: \"再度お試してください\",\n },\n [Language.KO]: {\n [Translate.DRAG]: \"왼쪽 이미지를 끌어 그림을 복원해 주세요.\",\n [Translate.LOADING]: \"로드 중... \",\n [Translate.SUCCESS]: \"인증 성공\",\n [Translate.FAIL]: \"로드 실패,\",\n [Translate.RETRY]: \"재시도해 주세요!\",\n },\n [Language.EN]: {\n [Translate.DRAG]: \"Slide from left to right to complete the image\",\n [Translate.LOADING]: \"Uploading\",\n [Translate.SUCCESS]: \"Verification Successful\",\n [Translate.FAIL]: \"Failed to load,\",\n [Translate.RETRY]: \"please tap to retry!\",\n },\n};\n","import {\n IGetCaptcha,\n ICaptcha,\n IPostValidate,\n IResponse,\n} from \"./type\";\n\ninterface IRequestConfig {\n method: \"get\" | \"post\";\n body?: Record<string, any>;\n}\n\ninterface ApiInstanceConfig {\n baseUrl: string;\n}\n\nexport class ApiInstance {\n private config: ApiInstanceConfig;\n constructor(config: ApiInstanceConfig) {\n this.config = config;\n }\n\n private request<T>(url: string, config: IRequestConfig) {\n return new Promise<T>((resolve, reject) => {\n const { method, body } = config;\n const xhr = new XMLHttpRequest();\n\n xhr.open(\n method.toLocaleUpperCase(),\n `${this.config.baseUrl}${url}`,\n true\n );\n xhr.setRequestHeader(\"Content-type\", \"application/json; charset=utf-8\");\n\n xhr.onreadystatechange = function () {\n if (xhr.readyState !== 4) {\n return;\n }\n if (xhr.status !== 200) {\n reject(\"请求错误\");\n }\n const data = JSON.parse(xhr.responseText) as IResponse<T>;\n const { code, msg = \"\", data: respData } = data;\n if (code === 0) {\n resolve(respData);\n } else {\n reject(msg);\n }\n };\n xhr.onerror = function handleError() {\n reject(\"网络错误\");\n };\n xhr.ontimeout = function handleTimeout() {\n reject(\"请求超时\");\n };\n\n xhr.send(body ? JSON.stringify(body) : \"\");\n });\n }\n\n getCaptcha(params: IGetCaptcha): Promise<ICaptcha> {\n return this.request(\n `/apis/v1/apps/${params.appId}/versions/${params.version}/captchas`,\n {\n method: \"get\",\n }\n );\n }\n\n postValidate(token: string, params: IPostValidate): Promise<null> {\n return this.request(`/apis/v1/tokens/${token}/validate`, {\n method: \"post\",\n body: params,\n });\n }\n}\n","// export function random(total: number, test?: (result: number) => boolean) {\n// let latest: number;\n\n// const calRandom = () => {\n// const num = Math.ceil(Math.random() * total);\n// return num === total ? num - 1 : num;\n// };\n// return function () {\n// let result = calRandom();\n// while (result === latest || (test && test(result))) {\n// result = calRandom();\n// }\n// latest = result;\n\n// return result;\n// };\n// }\n\nexport const BACK_WIDTH = 300;\nexport const BACK_HEIGHT = 150;\n\n// export const leftRandom = random(BACK_WIDTH - 50, (result) => result < 60);\n// export const topRandom = random(BACK_HEIGHT - 50, (result) => result < 50);\n\nexport function getLeft(el: HTMLElement) {\n return +getComputedStyle(el).left.match(/\\d+/)![0];\n}\n\nexport function loadImage(\n img: any,\n callback?: (img: HTMLImageElement) => void\n) {\n let resolved: (img: HTMLImageElement) => void;\n const promise = new Promise<HTMLImageElement>((r) => (resolved = r));\n const imgEl = new Image();\n imgEl.onload = () => {\n callback?.(imgEl);\n resolved(imgEl);\n };\n imgEl.src = img;\n\n return promise;\n}\n\n// export async function addBorder(\n// canvas: HTMLCanvasElement,\n// x: number,\n// y: number,\n// options: {\n// shadowColor: string;\n// fillStyle: string;\n// reFillStyle?: string;\n// }\n// ) {\n// const ctx = canvas.getContext(\"2d\");\n// const { shadowColor, fillStyle, reFillStyle } = options;\n// triangleDraw(ctx, x, y);\n// ctx.globalCompositeOperation = \"destination-in\";\n// ctx.fill();\n\n// const borderCanvas = canvas.cloneNode() as HTMLCanvasElement;\n// const borderCtx = borderCanvas.getContext(\"2d\");\n// triangleDraw(borderCtx, x, y);\n// borderCtx.shadowBlur = 2;\n// borderCtx.shadowColor = shadowColor;\n// borderCtx.fillStyle = fillStyle;\n// borderCtx.strokeStyle = shadowColor;\n// borderCtx.fill();\n// // borderCtx.lineWidth = 0.5;\n// // borderCtx.stroke();\n\n// triangleDraw(borderCtx, x, y, \"small\");\n// borderCtx.shadowBlur = 0;\n// borderCtx.globalCompositeOperation = \"destination-out\";\n// borderCtx.fill();\n// if (reFillStyle) {\n// triangleDraw(borderCtx, x, y, \"small\");\n// borderCtx.globalCompositeOperation = \"source-over\";\n// borderCtx.fillStyle = reFillStyle;\n// borderCtx.fill();\n// }\n// const url = await loadImage(canvasToPng(borderCanvas));\n// ctx.globalCompositeOperation = \"source-over\";\n// ctx.drawImage(url, 0, 0);\n\n// return {\n// left: x,\n// top: y,\n// };\n// }\n\n// export function canvasToPng(canvas: HTMLCanvasElement) {\n// return canvas.toDataURL(\"image/png\");\n// }\n\n// export function coverCanvas(canvas: HTMLCanvasElement, x: number, y: number) {\n// const ctx = canvas.getContext(\"2d\");\n// const data = ctx.getImageData(x, y, IMG_SIZE, IMG_SIZE);\n// canvas.width = IMG_SIZE;\n// canvas.height = IMG_SIZE;\n// ctx.putImageData(data, 0, 0);\n\n// return canvas;\n// }\n","import { Language } from \"./lang\";\n\nconst host = \"https://captcha.resource.pandadagames.com/images/\";\n\nexport const CloseImage = `${host}close.png`;\nexport const ErrorImage = `${host}error.png`;\nexport const WaitingImage = `${host}waiting.png`;\nexport const LogoImage = (lang: Language) => `${host}${lang}_logo.png`;\nexport const RefreshImage = `${host}refresh.png`;\nexport const RetryImage = `${host}retry.jpeg`;\nexport const LoadingImage = `${host}loading.gif`;\n","import {\n CloseImage,\n RefreshImage,\n LogoImage,\n LoadingImage,\n RetryImage,\n} from \"./image-url\";\nimport { Language, resources, Translate } from \"./lang\";\n\nexport const wrapTemplate = (lang: Language) => `\n <div class=\"dx-captcha-header\">\n <img src=${CloseImage} />\n </div>\n <div class=\"dx-captcha-body\">\n <canvas></canvas>\n <img class=\"dx-captcha-body-slider\" draggable=\"false\" />\n <img class=\"dx-captcha-body-refresh\" src=${RefreshImage} width=\"16px\" height=\"16px\" />\n <img class=\"dx-captcha-body-logo\" src=${LogoImage(lang)} width=\"50px\" />\n <div class=\"dx-captcha-body-loading display-none\">\n <div>\n <img class=\"dx-captcha-body-loading-img\" src=${LoadingImage} />\n <div class=\"dx-captcha-body-loading-text\">${\n resources[lang][Translate.LOADING]\n }</div>\n </div>\n </div>\n </div>\n <div class=\"dx-captcha-bar\">\n <div class=\"dx-captcha-bar-slider\"></div>\n <div class=\"dx-captcha-bar-progress\"></div>\n <span class=\"dx-captcha-bar-text\">\n ${resources[lang][Translate.DRAG]}\n </span>\n </div>\n`;\n\nexport const defaultTemplate = (lang: Language) => `\n <div class=\"dx-captcha-mask\"></div>\n <div class=\"dx-captcha-wrap\">\n ${wrapTemplate(lang)}\n </div>\n`;\n\nexport const successBarTemplate = (lang: Language) => `\n <span class=\"dx-captcha-bar-text\">\n ${resources[lang][Translate.SUCCESS]}\n </span>\n`;\n\nexport const retryTemplate = (lang: Language) => `\n <div class=\"dx-captcha-retry\">\n <img class=\"dx-captcha-retry-img\" src=${RetryImage} />\n <div>${\n resources[lang][Translate.FAIL]\n }<a class=\"dx-captcha-retry-link\">${\n resources[lang][Translate.RETRY]\n}</a></div>\n </div>\n`;\n","import { isAndriod, isIos } from \"@blazes/webview-sdk/dist/env\";\nimport { ApiInstance } from \"./api\";\nimport { ICaptchaConfig } from \"./type\";\nimport { getLeft, loadImage, BACK_WIDTH, BACK_HEIGHT } from \"./utils\";\nimport \"./assets/style/index.less\";\nimport { defaultTemplate, retryTemplate, successBarTemplate } from \"./template\";\nimport { RefreshImage, WaitingImage, ErrorImage } from \"./image-url\";\nimport { Language } from \"./lang\";\n\nconst FALLBACK_DRUATION = 0.5;\n\nexport class Captcha {\n private root: HTMLDivElement;\n private refs: {\n wrapper: HTMLDivElement;\n close: HTMLImageElement;\n canvas: HTMLCanvasElement;\n fragment: HTMLImageElement;\n refresh: HTMLImageElement;\n logo: HTMLImageElement;\n bar: HTMLDivElement;\n slider: HTMLDivElement;\n progress: HTMLDivElement;\n infoText: HTMLSpanElement;\n loading: HTMLElement;\n };\n private token: string;\n private eventNames: {\n down: string;\n up: string;\n move: string;\n };\n private config: ICaptchaConfig;\n private resolve: (token: string) => void;\n private apiInstance: ApiInstance;\n\n constructor(config: ICaptchaConfig) {\n this.setConfig(config);\n this.apiInstance = new ApiInstance({ baseUrl: config.baseUrl });\n this.initEventNames();\n }\n\n private setConfig(config: ICaptchaConfig) {\n if (!Object.values(Language).includes(config.lang)) {\n throw new Error(`传入的lang ${config.lang} 不正确`);\n }\n this.config = Object.assign({}, config);\n }\n\n resetConfig(config: Partial<ICaptchaConfig>) {\n this.config = Object.assign(this.config, config);\n }\n\n private initEventNames() {\n if (isAndriod() || isIos()) {\n this.eventNames = {\n down: \"touchstart\",\n up: \"touchend\",\n move: \"touchmove\",\n };\n } else {\n this.eventNames = {\n down: \"mousedown\",\n up: \"mouseup\",\n move: \"mousemove\",\n };\n }\n }\n\n private initRoot() {\n const root = document.createElement(\"div\");\n root.classList.add(\"dx-captcha-root\");\n document.body.appendChild(root);\n\n return root;\n }\n\n show() {\n if (!this.root) {\n this.root = this.initRoot();\n }\n const p = new Promise<string>((r) => (this.resolve = r));\n this.render();\n return p;\n }\n\n private render() {\n this.root.innerHTML = defaultTemplate(this.config.lang);\n this.queryRef();\n this.handleHeader();\n this.handleBody().then((token) => {\n this.token = token;\n this.handleBar();\n });\n }\n\n private queryRef() {\n const query = <T>(selector: string): T =>\n this.root.querySelector(selector) as unknown as T;\n const wrapper = query<HTMLDivElement>(\".dx-captcha-wrap\");\n const close = query<HTMLImageElement>(\".dx-captcha-header img\");\n const canvas = query<HTMLCanvasElement>(\"canvas\");\n const bar = query<HTMLDivElement>(\".dx-captcha-bar\");\n const slider = query<HTMLDivElement>(\".dx-captcha-bar-slider\");\n const fragment = query<HTMLImageElement>(\".dx-captcha-body-slider\");\n const refresh = query<HTMLImageElement>(\".dx-captcha-body-refresh\");\n const logo = query<HTMLImageElement>(\".dx-captcha-body-logo\");\n const progress = query<HTMLDivElement>(\".dx-captcha-bar-progress\");\n const infoText = query<HTMLSpanElement>(\".dx-captcha-bar-text\");\n const loading = query<HTMLSpanElement>(\".dx-captcha-body-loading\");\n\n this.refs = {\n wrapper,\n close,\n canvas,\n fragment,\n bar,\n slider,\n progress,\n infoText,\n refresh,\n logo,\n loading,\n };\n }\n\n close() {\n const wrapper = this.refs.wrapper;\n wrapper.style.top = \"0\";\n wrapper.style.opacity = \"0\";\n setTimeout(() => {\n this.root.innerHTML = \"\";\n }, 300);\n }\n\n private retry() {\n this.refs.wrapper.innerHTML = retryTemplate(this.config.lang);\n const retryLink = this.refs.wrapper.querySelector(\n \".dx-captcha-retry-link\"\n ) as HTMLLinkElement;\n retryLink.addEventListener(\"click\", () => {\n this.render();\n });\n }\n\n private handleHeader() {\n const closeEl = this.refs.close;\n closeEl.addEventListener(\"click\", () => {\n this.close();\n });\n }\n\n private handleBody() {\n this.addRefresh();\n return this.drawBackground();\n }\n\n private drawBackground() {\n const { refs, apiInstance, config } = this;\n const { canvas, loading, fragment } = refs;\n canvas.width = BACK_WIDTH * devicePixelRatio;\n canvas.height = BACK_HEIGHT * devicePixelRatio;\n const ctx = canvas.getContext(\"2d\");\n let resolved: (token: string) => void;\n const p = new Promise<string>((r) => (resolved = r));\n\n loading.classList.remove(\"display-none\");\n apiInstance\n .getCaptcha({ appId: config.appId, version: config.version })\n .then(({ y, token, bgUrl, fgUrl }) => {\n loadImage(bgUrl, (url) => {\n loading.classList.add(\"display-none\");\n ctx.drawImage(url, 0, 0, canvas.width, canvas.height);\n fragment.src = fgUrl;\n fragment.style.top = `${y}px`;\n\n resolved(token);\n });\n })\n .catch(() => {\n this.retry();\n });\n\n return p;\n }\n\n private addRefresh() {\n const refresh = this.refs.refresh;\n refresh.src = RefreshImage;\n refresh.addEventListener(\"click\", () => {\n this.reset();\n });\n }\n\n reset() {\n this.clearCanvas();\n this.drawBackground().then((token) => {\n this.token = token;\n });\n const { slider, progress } = this.refs;\n this.loopBar((el) => {\n el.style.transitionDuration = \"0s\";\n });\n slider.style.backgroundImage = `url(${WaitingImage})`;\n progress.classList.remove(\"error\");\n progress.classList.add(\"success\");\n }\n\n private clearCanvas() {\n const canvas = this.refs.canvas;\n const ctx = canvas.getContext(\"2d\");\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n }\n\n private handleBar() {\n const { down, move, up } = this.eventNames;\n const { bar, fragment, slider, progress } = this.refs;\n const maxLeft =\n bar.getBoundingClientRect().width - slider.getBoundingClientRect().width;\n\n let originX: number, curOffset: number;\n const fallbacking = { value: false };\n const moveBar = (event: MouseEvent | TouchEvent) => {\n event.preventDefault();\n const offset = this.getClientX(event) - originX + curOffset;\n if (offset > maxLeft || offset < 0) {\n return;\n }\n this.moveBar(offset);\n };\n const upMouse = () => {\n document.body.removeEventListener(move, moveBar);\n document.body.removeEventListener(up, upMouse);\n const left = getLeft(fragment);\n this.apiInstance\n .postValidate(this.token, {\n x: left,\n })\n .then(() => {\n this.verifySuccess();\n })\n .catch(() => {\n this.verifyFail(fallbacking);\n });\n };\n slider.addEventListener(down, (event: MouseEvent | TouchEvent) => {\n if (fallbacking.value) {\n return;\n }\n originX = this.getClientX(event);\n curOffset = getLeft(fragment);\n progress.classList.add(\"success\");\n document.body.addEventListener(move, moveBar);\n document.body.addEventListener(up, upMouse);\n });\n }\n\n private getClientX(event: MouseEvent | TouchEvent) {\n return (\n (event as MouseEvent).clientX || (event as TouchEvent).touches[0].clientX\n );\n }\n\n private verifyFail(fallbacking: { value: boolean }) {\n fallbacking.value = true;\n const { slider, progress } = this.refs;\n slider.style.backgroundImage = `url(${ErrorImage})`;\n progress.classList.remove(\"success\");\n progress.classList.add(\"error\");\n this.fallbackBar();\n setTimeout(() => {\n this.reset();\n fallbacking.value = false;\n }, FALLBACK_DRUATION * 1000);\n }\n\n private verifySuccess() {\n const { refs, token, config } = this;\n const bar = refs.bar;\n bar.innerHTML = successBarTemplate(this.config.lang);\n bar.classList.add(\"success\");\n setTimeout(() => {\n this.close();\n config.success?.(token);\n this.resolve(token);\n });\n }\n\n private moveBar(offset: number) {\n this.loopBar((el) => {\n el.style[this.getChangeProperty(el)] = `${offset}px`;\n });\n }\n\n private fallbackBar() {\n this.loopBar((el) => {\n el.style.transitionDuration = `${FALLBACK_DRUATION}s`;\n el.style[this.getChangeProperty(el)] = \"0\";\n });\n }\n\n private getChangeProperty(el: HTMLElement) {\n return el.classList.contains(\"dx-captcha-bar-progress\") ? \"width\" : \"left\";\n }\n\n private loopBar(callback: (el: HTMLElement) => void) {\n const { fragment, slider, progress } = this.refs;\n [fragment, slider, progress].forEach((el) => callback(el));\n }\n}\n\nexport interface Captcha {\n new (config: ICaptchaConfig): Captcha;\n}\n"],"sourceRoot":""}
|
package/dist/lang.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export declare enum Language {
|
|
2
|
+
HANT = "hant",
|
|
3
|
+
HANS = "hans",
|
|
4
|
+
JA = "ja",
|
|
5
|
+
EN = "en",
|
|
6
|
+
KO = "ko"
|
|
7
|
+
}
|
|
8
|
+
export declare enum Translate {
|
|
9
|
+
DRAG = "drag",
|
|
10
|
+
LOADING = "loading",
|
|
11
|
+
SUCCESS = "success",
|
|
12
|
+
FAIL = "fail",
|
|
13
|
+
RETRY = "retry"
|
|
14
|
+
}
|
|
15
|
+
export declare const resources: {
|
|
16
|
+
hans: {
|
|
17
|
+
drag: string;
|
|
18
|
+
loading: string;
|
|
19
|
+
success: string;
|
|
20
|
+
fail: string;
|
|
21
|
+
retry: string;
|
|
22
|
+
};
|
|
23
|
+
hant: {
|
|
24
|
+
drag: string;
|
|
25
|
+
loading: string;
|
|
26
|
+
success: string;
|
|
27
|
+
fail: string;
|
|
28
|
+
retry: string;
|
|
29
|
+
};
|
|
30
|
+
ja: {
|
|
31
|
+
drag: string;
|
|
32
|
+
loading: string;
|
|
33
|
+
success: string;
|
|
34
|
+
fail: string;
|
|
35
|
+
retry: string;
|
|
36
|
+
};
|
|
37
|
+
ko: {
|
|
38
|
+
drag: string;
|
|
39
|
+
loading: string;
|
|
40
|
+
success: string;
|
|
41
|
+
fail: string;
|
|
42
|
+
retry: string;
|
|
43
|
+
};
|
|
44
|
+
en: {
|
|
45
|
+
drag: string;
|
|
46
|
+
loading: string;
|
|
47
|
+
success: string;
|
|
48
|
+
fail: string;
|
|
49
|
+
retry: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.dx-captcha-mask{background-color:#00000073;bottom:0;height:100%;left:0;position:fixed;right:0;top:0;z-index:1010}.dx-captcha-wrap{background:#fff;border-radius:4px;box-shadow:0 4px 12px #00000026;left:50%;padding:12px 20px;position:fixed;top:50%;transform:translate(-50%,-50%);transition:all .3s;z-index:1010}.dx-captcha-header{text-align:right}.dx-captcha-header img{cursor:pointer;height:14px;-
|
|
1
|
+
.dx-captcha-mask{background-color:#00000073;bottom:0;height:100%;left:0;position:fixed;right:0;top:0;z-index:1010}.dx-captcha-wrap{background:#fff;border-radius:4px;box-shadow:0 4px 12px #00000026;left:50%;padding:12px 20px;position:fixed;top:50%;transform:translate(-50%,-50%);transition:all .3s;z-index:1010}.dx-captcha-header{text-align:right}.dx-captcha-header img{cursor:pointer;height:14px;-ms-user-select:none;user-select:none;width:14px}.dx-captcha-body{margin-top:4px;position:relative}.dx-captcha-body-slider{height:60px;left:10px;top:50%;transition-property:left;width:60px}.dx-captcha-body-refresh,.dx-captcha-body-slider{position:absolute;-ms-user-select:none;user-select:none}.dx-captcha-body-refresh{cursor:pointer;left:275px;top:125px}.dx-captcha-body-logo{left:0;position:absolute;top:5px;-ms-user-select:none;user-select:none}.dx-captcha-body canvas{height:150px;width:300px}.dx-captcha-body-loading{align-items:center;background:#fff;border:1px solid #e9e9e9;border-radius:4px;box-sizing:content-box;display:flex;flex-wrap:wrap;font-size:12px;height:146px;justify-content:center;left:0;margin-top:8px;position:absolute;text-align:center;top:0;width:298px}.dx-captcha-body-loading-img{width:24px}.dx-captcha-body-loading-text{margin-top:8px}.dx-captcha-bar{background:#f7f7f7;border:1px solid #d2d2d2;border-radius:4px;color:#999;font-size:14px;height:38px;line-height:38px;margin-top:8px;position:relative;text-align:center;touch-action:none}.dx-captcha-bar-slider{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAABMCAYAAACmj3NpAAAGcklEQVR4Ae2c1ZPjyhXGvyMZhhfDzHCZwszMe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AAAAElFTkSuQmCC);background-repeat:no-repeat;background-size:contain;border-radius:4px;box-shadow:0 0 3px #bcbcbc;cursor:move;height:38px;left:0;opacity:.7;position:absolute;transition-property:left;width:60px}.dx-captcha-bar-text{margin-left:22px;-ms-user-select:none;user-select:none}.dx-captcha-bar-progress{bottom:0;left:0;position:absolute;top:0;transition-property:width}.dx-captcha-bar-progress.success{background:#d0fbee}.dx-captcha-bar-progress.error{background:#fa96a0}.dx-captcha-bar.success{background:#d4fff2;color:#01c7b5}.dx-captcha-bar.success .dx-captcha-bar-text{margin-left:0}.dx-captcha-retry{border:1px solid #e9e9e9;border-radius:4px;box-sizing:content-box;font-size:12px;height:186px;line-height:24px;margin-top:8px;overflow:hidden;text-align:center;width:100%}.dx-captcha-retry-img{margin:23px 60px 0;width:178px}.dx-captcha-retry a{color:#1f8efa;cursor:pointer}body{margin:0}.display-none{display:none}
|
package/dist/template.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
1
|
+
import { Language } from "./lang";
|
|
2
|
+
export declare const wrapTemplate: (lang: Language) => string;
|
|
3
|
+
export declare const defaultTemplate: (lang: Language) => string;
|
|
4
|
+
export declare const successBarTemplate: (lang: Language) => string;
|
|
5
|
+
export declare const retryTemplate: (lang: Language) => string;
|
package/dist/type.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Language } from "./lang";
|
|
1
2
|
export declare const Version: {
|
|
2
3
|
readonly V1: "v1";
|
|
3
4
|
};
|
|
@@ -5,7 +6,6 @@ export declare const AppId: {
|
|
|
5
6
|
readonly NINJA3: "ninja3";
|
|
6
7
|
};
|
|
7
8
|
export declare type InRecord<T> = Record<keyof T, T[keyof T]>;
|
|
8
|
-
declare type ValueOf<T> = T[keyof T];
|
|
9
9
|
export interface IPostValidate {
|
|
10
10
|
x: number;
|
|
11
11
|
}
|
|
@@ -20,14 +20,14 @@ export interface ICaptcha {
|
|
|
20
20
|
y: number;
|
|
21
21
|
}
|
|
22
22
|
export interface ICaptchaConfig {
|
|
23
|
-
appId:
|
|
23
|
+
appId: string;
|
|
24
24
|
success?: (token: string) => void;
|
|
25
25
|
baseUrl: string;
|
|
26
|
-
version:
|
|
26
|
+
version: string;
|
|
27
|
+
lang: Language;
|
|
27
28
|
}
|
|
28
29
|
export interface IResponse<T> {
|
|
29
30
|
code: number;
|
|
30
31
|
msg: string;
|
|
31
32
|
data: T;
|
|
32
33
|
}
|
|
33
|
-
export {};
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
export declare function random(total: number, test?: (result: number) => boolean): () => number;
|
|
2
1
|
export declare const BACK_WIDTH = 300;
|
|
3
2
|
export declare const BACK_HEIGHT = 150;
|
|
4
|
-
export declare const leftRandom: () => number;
|
|
5
|
-
export declare const topRandom: () => number;
|
|
6
3
|
export declare function getLeft(el: HTMLElement): number;
|
|
7
4
|
export declare function loadImage(img: any, callback?: (img: HTMLImageElement) => void): Promise<HTMLImageElement>;
|
|
8
|
-
export declare function addBorder(canvas: HTMLCanvasElement, x: number, y: number, options: {
|
|
9
|
-
shadowColor: string;
|
|
10
|
-
fillStyle: string;
|
|
11
|
-
reFillStyle?: string;
|
|
12
|
-
}): Promise<{
|
|
13
|
-
left: number;
|
|
14
|
-
top: number;
|
|
15
|
-
}>;
|
|
16
|
-
export declare function canvasToPng(canvas: HTMLCanvasElement): string;
|
|
17
|
-
export declare function coverCanvas(canvas: HTMLCanvasElement, x: number, y: number): HTMLCanvasElement;
|
|
18
|
-
export declare const SIGN: {
|
|
19
|
-
secret: string;
|
|
20
|
-
appid: string;
|
|
21
|
-
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blazes/captcha",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"description": "滑动验证块",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
14
|
"serve": "webpack-dev-server --config build/webpack.config.dev.js",
|
|
15
|
-
"build": "webpack --config build/webpack.config.prod.js && tsc --emitDeclarationOnly"
|
|
15
|
+
"build": "webpack --config build/webpack.config.prod.js && tsc --emitDeclarationOnly",
|
|
16
|
+
"cm": "git-cz"
|
|
16
17
|
},
|
|
17
18
|
"author": "",
|
|
18
19
|
"license": "ISC",
|
|
19
20
|
"dependencies": {
|
|
20
|
-
"@blazes/
|
|
21
|
-
"@blazes/webview-sdk": "^1.0.35"
|
|
21
|
+
"@blazes/webview-sdk": "^1.0.37"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@babel/core": "^7.17.9",
|
|
@@ -27,8 +27,10 @@
|
|
|
27
27
|
"autoprefixer": "^9.8.0",
|
|
28
28
|
"babel-loader": "^8.2.5",
|
|
29
29
|
"clean-webpack-plugin": "^3.0.0",
|
|
30
|
+
"commitizen": "^4.2.4",
|
|
30
31
|
"copy-webpack-plugin": "^6.0.4",
|
|
31
32
|
"css-loader": "^3.5.3",
|
|
33
|
+
"cz-conventional-changelog": "^3.3.0",
|
|
32
34
|
"file-loader": "^4.2.0",
|
|
33
35
|
"html-webpack-plugin": "^3.2.0",
|
|
34
36
|
"less": "^3.0.4",
|
|
@@ -44,5 +46,14 @@
|
|
|
44
46
|
"webpack-cli": "^3.3.10",
|
|
45
47
|
"webpack-dev-server": "^3.11.0",
|
|
46
48
|
"webpack-merge": "^4.2.2"
|
|
49
|
+
},
|
|
50
|
+
"config": {
|
|
51
|
+
"commitizen": {
|
|
52
|
+
"path": "./node_modules/cz-conventional-changelog"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"volta": {
|
|
56
|
+
"node": "16.20.2",
|
|
57
|
+
"yarn": "1.22.19"
|
|
47
58
|
}
|
|
48
59
|
}
|