@prosopo/procaptcha-pow 0.3.1

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.
Files changed (35) hide show
  1. package/dist/Services/Manager.d.ts +22 -0
  2. package/dist/Services/Manager.d.ts.map +1 -0
  3. package/dist/Services/Manager.js +56 -0
  4. package/dist/Services/Manager.js.map +1 -0
  5. package/dist/Services/SolverService.d.ts +2 -0
  6. package/dist/Services/SolverService.d.ts.map +1 -0
  7. package/dist/Services/SolverService.js +17 -0
  8. package/dist/Services/SolverService.js.map +1 -0
  9. package/dist/cjs/Services/Manager.cjs +78 -0
  10. package/dist/cjs/Services/SolverService.cjs +17 -0
  11. package/dist/cjs/account/dist/extension/Extension.cjs +5 -0
  12. package/dist/cjs/account/dist/extension/ExtensionWeb2.cjs +100 -0
  13. package/dist/cjs/account/dist/index.cjs +6 -0
  14. package/dist/cjs/components/Captcha.cjs +156 -0
  15. package/dist/cjs/components/ProcaptchaPoW.cjs +10 -0
  16. package/dist/cjs/index.cjs +5 -0
  17. package/dist/cjs/web-components/dist/CaptchaPlaceholder.cjs +79 -0
  18. package/dist/cjs/web-components/dist/Checkbox.cjs +45 -0
  19. package/dist/cjs/web-components/dist/LoadingSpinner.cjs +30 -0
  20. package/dist/cjs/web-components/dist/index.cjs +11 -0
  21. package/dist/cjs/web-components/dist/theme.cjs +44 -0
  22. package/dist/components/Captcha.d.ts +20 -0
  23. package/dist/components/Captcha.d.ts.map +1 -0
  24. package/dist/components/Captcha.js +90 -0
  25. package/dist/components/Captcha.js.map +1 -0
  26. package/dist/components/ProcaptchaPoW.d.ts +6 -0
  27. package/dist/components/ProcaptchaPoW.d.ts.map +1 -0
  28. package/dist/components/ProcaptchaPoW.js +6 -0
  29. package/dist/components/ProcaptchaPoW.js.map +1 -0
  30. package/dist/index.d.ts +3 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +3 -0
  33. package/dist/index.js.map +1 -0
  34. package/package.json +65 -0
  35. package/vite.cjs.config.ts +6 -0
@@ -0,0 +1,22 @@
1
+ import { ProcaptchaClientConfigInput } from '@prosopo/types';
2
+ type ProcaptchaPowOutput = {
3
+ user: string;
4
+ dapp: string;
5
+ commitmentId?: string | undefined;
6
+ providerUrl?: string | undefined;
7
+ blockNumber?: number | undefined;
8
+ };
9
+ export interface ProcaptchaEvents {
10
+ onError: (error: Error) => void;
11
+ onAccountNotFound: (address: string) => void;
12
+ onHuman: (output: ProcaptchaPowOutput) => void;
13
+ onExtensionNotFound: () => void;
14
+ onChallengeExpired: () => void;
15
+ onExpired: () => void;
16
+ onFailed: () => void;
17
+ onOpen: () => void;
18
+ onClose: () => void;
19
+ }
20
+ export declare const Manager: (configInput: ProcaptchaClientConfigInput) => Promise<import("@prosopo/api").PowCaptchaSolutionResponse>;
21
+ export {};
22
+ //# sourceMappingURL=Manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Manager.d.ts","sourceRoot":"","sources":["../../src/Services/Manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,2BAA2B,EAAwD,MAAM,gBAAgB,CAAA;AASlH,KAAK,mBAAmB,GAAG;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACnC,CAAA;AAED,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAC/B,iBAAiB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5C,OAAO,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAA;IAC9C,mBAAmB,EAAE,MAAM,IAAI,CAAA;IAC/B,kBAAkB,EAAE,MAAM,IAAI,CAAA;IAC9B,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,OAAO,EAAE,MAAM,IAAI,CAAA;CACtB;AAED,eAAO,MAAM,OAAO,gBAAuB,2BAA2B,+DAmFrE,CAAA"}
@@ -0,0 +1,56 @@
1
+ import { ApiPromise } from '@polkadot/api/promise/Api';
2
+ import { ExtensionWeb2 } from '@prosopo/account';
3
+ import { Keyring } from '@polkadot/keyring';
4
+ import { ProcaptchaConfigSchema } from '@prosopo/types';
5
+ import { ProsopoCaptchaContract, wrapQuery } from '@prosopo/contract';
6
+ import { ProsopoEnvError, trimProviderUrl } from '@prosopo/common';
7
+ import { ProviderApi } from '@prosopo/api';
8
+ import { WsProvider } from '@polkadot/rpc-provider/ws';
9
+ import { ContractAbi as abiJson } from '@prosopo/captcha-contract/contract-info';
10
+ import { solvePoW } from './SolverService.js';
11
+ export const Manager = async (configInput) => {
12
+ const getConfig = () => {
13
+ const config = {
14
+ userAccountAddress: '',
15
+ ...configInput,
16
+ };
17
+ return ProcaptchaConfigSchema.parse(config);
18
+ };
19
+ const getNetwork = (config) => {
20
+ const network = config.networks[config.defaultNetwork];
21
+ if (!network) {
22
+ throw new ProsopoEnvError('DEVELOPER.NETWORK_NOT_FOUND', {
23
+ context: { error: `No network found for environment ${config.defaultEnvironment}` },
24
+ });
25
+ }
26
+ return network;
27
+ };
28
+ const loadContract = async () => {
29
+ const network = getNetwork(getConfig());
30
+ const api = await ApiPromise.create({ provider: new WsProvider(network.endpoint), initWasm: false });
31
+ const type = 'sr25519';
32
+ const keyring = new Keyring({ type, ss58Format: api.registry.chainSS58 });
33
+ return new ProsopoCaptchaContract(api, JSON.parse(abiJson), network.contract.address, 'prosopo', 0, keyring.addFromAddress(getConfig().account.address || ''));
34
+ };
35
+ const config = getConfig();
36
+ if (!config.web2 && !config.userAccountAddress) {
37
+ throw new ProsopoEnvError('GENERAL.ACCOUNT_NOT_FOUND', {
38
+ context: { error: 'Account address has not been set for web3 mode' },
39
+ });
40
+ }
41
+ const ext = new ExtensionWeb2();
42
+ const account = await ext.getAccount(config);
43
+ const contract = await loadContract();
44
+ const getRandomProviderResponse = await wrapQuery(contract.query.getRandomActiveProvider, contract.query)(account.account.address, configInput.account.address || '');
45
+ const providerUrl = trimProviderUrl(getRandomProviderResponse.provider.url.toString());
46
+ const providerApi = new ProviderApi(getNetwork(getConfig()), providerUrl, configInput.account.address || '');
47
+ const challenge = await providerApi.getPowCaptchaChallenge(account.account.address, configInput.account.address || '');
48
+ console.log('challenge', challenge);
49
+ console.log('challenge', challenge.challenge);
50
+ console.log('challenge', challenge.difficulty);
51
+ const solution = solvePoW(challenge.challenge, challenge.difficulty);
52
+ console.log('solution', solution);
53
+ const verifiedSolution = await providerApi.submitPowCaptchaSolution(challenge, account.account.address, configInput.account.address || '', getRandomProviderResponse, solution);
54
+ return verifiedSolution;
55
+ };
56
+ //# sourceMappingURL=Manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Manager.js","sourceRoot":"","sources":["../../src/Services/Manager.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ export declare const solvePoW: (data: string, difficulty: number) => number;
2
+ //# sourceMappingURL=SolverService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SolverService.d.ts","sourceRoot":"","sources":["../../src/Services/SolverService.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,SAAU,MAAM,cAAc,MAAM,KAAG,MAe3D,CAAA"}
@@ -0,0 +1,17 @@
1
+ import { sha256 } from '@noble/hashes/sha256';
2
+ export const solvePoW = (data, difficulty) => {
3
+ let nonce = 0;
4
+ const prefix = '0'.repeat(difficulty);
5
+ while (true) {
6
+ const message = new TextEncoder().encode(nonce + data);
7
+ const hashHex = bufferToHex(sha256(message));
8
+ if (hashHex.startsWith(prefix)) {
9
+ return nonce;
10
+ }
11
+ nonce += 1;
12
+ }
13
+ };
14
+ const bufferToHex = (buffer) => Array.from(buffer)
15
+ .map((byte) => byte.toString(16).padStart(2, '0'))
16
+ .join('');
17
+ //# sourceMappingURL=SolverService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SolverService.js","sourceRoot":"","sources":["../../src/Services/SolverService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAE7C,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,UAAkB,EAAU,EAAE;IACjE,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;IAGrC,OAAO,IAAI,EAAE;QACT,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,CAAA;QACtD,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;QAE5C,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;YAC5B,OAAO,KAAK,CAAA;SACf;QAED,KAAK,IAAI,CAAC,CAAA;KACb;AACL,CAAC,CAAA;AAED,MAAM,WAAW,GAAG,CAAC,MAAkB,EAAU,EAAE,CAC/C,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;KACb,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;KACjD,IAAI,CAAC,EAAE,CAAC,CAAA"}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const Api = require("@polkadot/api/promise/Api");
4
+ require("../account/dist/index.cjs");
5
+ const keyring = require("@polkadot/keyring");
6
+ const types = require("@prosopo/types");
7
+ const contract = require("@prosopo/contract");
8
+ const common = require("@prosopo/common");
9
+ const api = require("@prosopo/api");
10
+ const ws = require("@polkadot/rpc-provider/ws");
11
+ const contractInfo = require("@prosopo/captcha-contract/contract-info");
12
+ const SolverService = require("./SolverService.cjs");
13
+ const ExtensionWeb2 = require("../account/dist/extension/ExtensionWeb2.cjs");
14
+ const Manager = async (configInput) => {
15
+ const getConfig = () => {
16
+ const config2 = {
17
+ userAccountAddress: "",
18
+ ...configInput
19
+ };
20
+ return types.ProcaptchaConfigSchema.parse(config2);
21
+ };
22
+ const getNetwork = (config2) => {
23
+ const network = config2.networks[config2.defaultNetwork];
24
+ if (!network) {
25
+ throw new common.ProsopoEnvError("DEVELOPER.NETWORK_NOT_FOUND", {
26
+ context: { error: `No network found for environment ${config2.defaultEnvironment}` }
27
+ });
28
+ }
29
+ return network;
30
+ };
31
+ const loadContract = async () => {
32
+ const network = getNetwork(getConfig());
33
+ const api2 = await Api.ApiPromise.create({ provider: new ws.WsProvider(network.endpoint), initWasm: false });
34
+ const type = "sr25519";
35
+ const keyring$1 = new keyring.Keyring({ type, ss58Format: api2.registry.chainSS58 });
36
+ return new contract.ProsopoCaptchaContract(
37
+ api2,
38
+ JSON.parse(contractInfo.ContractAbi),
39
+ network.contract.address,
40
+ "prosopo",
41
+ 0,
42
+ keyring$1.addFromAddress(getConfig().account.address || "")
43
+ );
44
+ };
45
+ const config = getConfig();
46
+ if (!config.web2 && !config.userAccountAddress) {
47
+ throw new common.ProsopoEnvError("GENERAL.ACCOUNT_NOT_FOUND", {
48
+ context: { error: "Account address has not been set for web3 mode" }
49
+ });
50
+ }
51
+ const ext = new ExtensionWeb2.ExtensionWeb2();
52
+ const account = await ext.getAccount(config);
53
+ const contract$1 = await loadContract();
54
+ const getRandomProviderResponse = await contract.wrapQuery(
55
+ contract$1.query.getRandomActiveProvider,
56
+ contract$1.query
57
+ )(account.account.address, configInput.account.address || "");
58
+ const providerUrl = common.trimProviderUrl(getRandomProviderResponse.provider.url.toString());
59
+ const providerApi = new api.ProviderApi(getNetwork(getConfig()), providerUrl, configInput.account.address || "");
60
+ const challenge = await providerApi.getPowCaptchaChallenge(
61
+ account.account.address,
62
+ configInput.account.address || ""
63
+ );
64
+ console.log("challenge", challenge);
65
+ console.log("challenge", challenge.challenge);
66
+ console.log("challenge", challenge.difficulty);
67
+ const solution = SolverService.solvePoW(challenge.challenge, challenge.difficulty);
68
+ console.log("solution", solution);
69
+ const verifiedSolution = await providerApi.submitPowCaptchaSolution(
70
+ challenge,
71
+ account.account.address,
72
+ configInput.account.address || "",
73
+ getRandomProviderResponse,
74
+ solution
75
+ );
76
+ return verifiedSolution;
77
+ };
78
+ exports.Manager = Manager;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const sha256 = require("@noble/hashes/sha256");
4
+ const solvePoW = (data, difficulty) => {
5
+ let nonce = 0;
6
+ const prefix = "0".repeat(difficulty);
7
+ while (true) {
8
+ const message = new TextEncoder().encode(nonce + data);
9
+ const hashHex = bufferToHex(sha256.sha256(message));
10
+ if (hashHex.startsWith(prefix)) {
11
+ return nonce;
12
+ }
13
+ nonce += 1;
14
+ }
15
+ };
16
+ const bufferToHex = (buffer) => Array.from(buffer).map((byte) => byte.toString(16).padStart(2, "0")).join("");
17
+ exports.solvePoW = solvePoW;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ class Extension {
4
+ }
5
+ exports.Extension = Extension;
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const Api = require("@polkadot/api/promise/Api");
4
+ const Extension = require("./Extension.cjs");
5
+ const keyring = require("@polkadot/keyring");
6
+ const common = require("@prosopo/common");
7
+ const ws = require("@polkadot/rpc-provider/ws");
8
+ const address = require("@polkadot/util-crypto/address");
9
+ const bip39 = require("@polkadot/util-crypto/mnemonic/bip39");
10
+ const fingerprintjs = require("@fingerprintjs/fingerprintjs");
11
+ const util = require("@prosopo/util");
12
+ const string = require("@polkadot/util/string");
13
+ const u8a = require("@polkadot/util/u8a");
14
+ const Signer = require("@polkadot/extension-base/page/Signer");
15
+ class ExtensionWeb2 extends Extension.Extension {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.getNetwork = (config) => {
19
+ const network = config.networks[config.defaultNetwork];
20
+ if (!network) {
21
+ throw new common.ProsopoEnvError("DEVELOPER.NETWORK_NOT_FOUND", {
22
+ context: { error: `No network found for environment ${config.defaultEnvironment}` }
23
+ });
24
+ }
25
+ return network;
26
+ };
27
+ }
28
+ async getAccount(config) {
29
+ const network = this.getNetwork(config);
30
+ const wsProvider = new ws.WsProvider(network.endpoint);
31
+ const account = await this.createAccount(wsProvider);
32
+ const extension = await this.createExtension(account);
33
+ return {
34
+ account,
35
+ extension
36
+ };
37
+ }
38
+ async createExtension(account) {
39
+ const signer = new Signer(async () => {
40
+ return;
41
+ });
42
+ signer.signRaw = async (payload) => {
43
+ const signature = account.keypair.sign(payload.data);
44
+ return {
45
+ id: 1,
46
+ signature: u8a.u8aToHex(signature)
47
+ };
48
+ };
49
+ return {
50
+ accounts: {
51
+ get: async () => {
52
+ return [account];
53
+ },
54
+ subscribe: () => {
55
+ return () => {
56
+ return;
57
+ };
58
+ }
59
+ },
60
+ name: "procaptcha-web2",
61
+ version: "0.1.11",
62
+ signer
63
+ };
64
+ }
65
+ async createAccount(wsProvider) {
66
+ const params = {
67
+ area: { width: 300, height: 300 },
68
+ offsetParameter: 2001000001,
69
+ multiplier: 15e3,
70
+ fontSizeFactor: 1.5,
71
+ maxShadowBlur: 50,
72
+ numberOfRounds: 5,
73
+ seed: 42
74
+ };
75
+ const browserEntropy = await this.getFingerprint();
76
+ const canvasEntropy = util.picassoCanvas(params.numberOfRounds, params.seed, params);
77
+ const entropy = common.hexHash([canvasEntropy, browserEntropy].join(""), 128).slice(2);
78
+ const u8Entropy = string.stringToU8a(entropy);
79
+ const mnemonic = bip39.entropyToMnemonic(u8Entropy);
80
+ const api = await Api.ApiPromise.create({ provider: wsProvider, initWasm: false });
81
+ const type = "ed25519";
82
+ const keyring$1 = new keyring.Keyring({ type, ss58Format: api.registry.chainSS58 });
83
+ const keypair = keyring$1.addFromMnemonic(mnemonic);
84
+ const address$1 = keypair.address.length === 42 ? keypair.address : address.encodeAddress(address.decodeAddress(keypair.address), api.registry.chainSS58);
85
+ return {
86
+ address: address$1,
87
+ type,
88
+ name: address$1,
89
+ keypair
90
+ };
91
+ }
92
+ async getFingerprint() {
93
+ const fpPromise = fingerprintjs.load();
94
+ const fp = await fpPromise;
95
+ const result = await fp.get();
96
+ const { screenFrame, ...componentsReduced } = result.components;
97
+ return fingerprintjs.hashComponents(componentsReduced);
98
+ }
99
+ }
100
+ exports.ExtensionWeb2 = ExtensionWeb2;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const Extension = require("./extension/Extension.cjs");
4
+ const ExtensionWeb2 = require("./extension/ExtensionWeb2.cjs");
5
+ exports.Extension = Extension.Extension;
6
+ exports.ExtensionWeb2 = ExtensionWeb2.ExtensionWeb2;
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ const jsxRuntime = require("@emotion/react/jsx-runtime");
3
+ require("../web-components/dist/index.cjs");
4
+ const Manager = require("../Services/Manager.cjs");
5
+ const react = require("@emotion/react");
6
+ const react$1 = require("react");
7
+ const theme = require("../web-components/dist/theme.cjs");
8
+ const LoadingSpinner = require("../web-components/dist/LoadingSpinner.cjs");
9
+ const Checkbox = require("../web-components/dist/Checkbox.cjs");
10
+ const logoStyle = react.css`
11
+ align-items: center;
12
+ justify-content: flex-end;
13
+ display: flex;
14
+ padding: 8px;
15
+
16
+ @media (max-width: 245px) {
17
+ &:nth-of-type(1),
18
+ &:nth-of-type(2) {
19
+ display: none;
20
+ } /* Both logos hidden */
21
+ }
22
+
23
+ @media (min-width: 245px) and (max-width: 400px) {
24
+ &:nth-of-type(1) {
25
+ display: flex;
26
+ } /* logoWithText */
27
+ &:nth-of-type(2) {
28
+ display: none;
29
+ } /* logoWithoutText */
30
+ }
31
+
32
+ @media (min-width: 401px) {
33
+ &:nth-of-type(1) {
34
+ display: none;
35
+ } /* logoWithText */
36
+ &:nth-of-type(2) {
37
+ display: flex;
38
+ } /* logoWithoutText */
39
+ }
40
+ `;
41
+ const Procaptcha = (props) => {
42
+ const [checked, setChecked] = react$1.useState(false);
43
+ const [loading, setLoading] = react$1.useState(false);
44
+ const darkMode = props.config.theme;
45
+ const styleWidth = { maxWidth: "400px", minWidth: "200px", margin: "8px" };
46
+ const themeColor = darkMode ? "light" : "dark";
47
+ const theme$1 = react$1.useMemo(() => darkMode === "light" ? theme.lightTheme : theme.darkTheme, [darkMode]);
48
+ const handlePowCaptcha = async () => {
49
+ setLoading(true);
50
+ Manager.Manager(props.config).then((verified) => {
51
+ if (verified.verified) {
52
+ console.log("verified");
53
+ setChecked(true);
54
+ }
55
+ setLoading(false);
56
+ });
57
+ };
58
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { maxWidth: "100%", maxHeight: "100%", overflowX: "auto" }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: styleWidth, "data-cy": "button-human", children: [
59
+ " ",
60
+ /* @__PURE__ */ jsxRuntime.jsxs(
61
+ "div",
62
+ {
63
+ style: {
64
+ padding: "8px",
65
+ border: "1px solid",
66
+ backgroundColor: theme$1.palette.background.default,
67
+ borderColor: theme$1.palette.grey[300],
68
+ borderRadius: "8px",
69
+ display: "flex",
70
+ justifyContent: "space-between",
71
+ alignItems: "center",
72
+ flexWrap: "wrap"
73
+ },
74
+ children: [
75
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
76
+ "div",
77
+ {
78
+ style: {
79
+ display: "flex",
80
+ justifyContent: "flex-start",
81
+ alignItems: "center",
82
+ flexWrap: "wrap"
83
+ },
84
+ children: [
85
+ /* @__PURE__ */ jsxRuntime.jsx(
86
+ "div",
87
+ {
88
+ style: {
89
+ height: "50px",
90
+ width: "50px",
91
+ display: "flex",
92
+ alignItems: "center",
93
+ justifyContent: "center",
94
+ flexDirection: "column",
95
+ verticalAlign: "middle"
96
+ },
97
+ children: /* @__PURE__ */ jsxRuntime.jsx(
98
+ "div",
99
+ {
100
+ style: {
101
+ display: "flex"
102
+ },
103
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1 }, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner.LoadingSpinner, { themeColor }) : /* @__PURE__ */ jsxRuntime.jsx(
104
+ Checkbox.Checkbox,
105
+ {
106
+ checked,
107
+ onChange: handlePowCaptcha,
108
+ themeColor: props.config.theme || "light"
109
+ }
110
+ ) })
111
+ }
112
+ )
113
+ }
114
+ ),
115
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: theme$1.palette.background.contrastText, paddingLeft: "4px" }, children: "I am a human" }) })
116
+ ]
117
+ }
118
+ ) }),
119
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
120
+ "a",
121
+ {
122
+ href: "https://www.prosopo.io/#features?ref=accounts.prosopo.io&utm_campaign=widget&utm_medium=checkbox",
123
+ target: "_blank",
124
+ "aria-label": "Visit prosopo.io to learn more about the service and its accessibility options.",
125
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
126
+ /* @__PURE__ */ jsxRuntime.jsx(
127
+ "div",
128
+ {
129
+ css: logoStyle,
130
+ dangerouslySetInnerHTML: {
131
+ __html: darkMode === "light" ? logoWithoutTextBlack : logoWithoutTextWhite
132
+ }
133
+ }
134
+ ),
135
+ /* @__PURE__ */ jsxRuntime.jsx(
136
+ "div",
137
+ {
138
+ css: logoStyle,
139
+ dangerouslySetInnerHTML: {
140
+ __html: darkMode === "light" ? logoWithTextBlack : logoWithTextWhite
141
+ }
142
+ }
143
+ )
144
+ ] }) })
145
+ }
146
+ ) })
147
+ ]
148
+ }
149
+ )
150
+ ] }) }) });
151
+ };
152
+ const logoWithTextBlack = '<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2062.63 468.67" height="35px" width="140px"><defs><style>.cls-1{fill:#1d1d1b;}</style></defs><title>Prosopo Logo Black</title><path class="cls-1" d="M335.55,1825.19A147.75,147.75,0,0,1,483.3,1972.94h50.5c0-109.49-88.76-198.25-198.25-198.25v50.5Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M269.36,1891.39A147.74,147.74,0,0,1,417.1,2039.13h50.5c0-109.49-88.75-198.24-198.24-198.24v50.5Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M414,2157.17a147.75,147.75,0,0,1-147.74-147.74h-50.5c0,109.49,88.75,198.24,198.24,198.24v-50.5Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M480.17,2091a147.74,147.74,0,0,1-147.74-147.75H281.92c0,109.49,88.76,198.25,198.25,198.25V2091Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M862.8,2017.5q-27.39,22.86-78.25,22.86h-65v112.19H654.82v-312h134q46.32,0,73.86,24.13t27.55,74.72Q890.2,1994.64,862.8,2017.5ZM813,1905.1q-12.37-10.36-34.7-10.38H719.59v91.87h58.75q22.32,0,34.7-11.22t12.39-35.56Q825.43,1915.48,813,1905.1Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1045.69,1916.42c.78.08,2.51.19,5.19.32v61.81c-3.81-.42-7.2-.71-10.16-.85s-5.36-.21-7.2-.21q-36.4,0-48.89,23.71-7,13.33-7,41.06v110.29H916.89V1921.82h57.58V1962q14-23.07,24.34-31.54,16.94-14.18,44-14.18C1044,1916.32,1044.92,1916.35,1045.69,1916.42Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1265.64,2124.32q-29.21,36.06-88.69,36.06t-88.69-36.06Q1059,2088.26,1059,2037.5q0-49.9,29.22-86.5t88.69-36.59q59.47,0,88.69,36.59t29.21,86.5Q1294.85,2088.26,1265.64,2124.32ZM1217.38,2091q14.17-18.81,14.18-53.48t-14.18-53.37q-14.19-18.7-40.64-18.71T1136,1984.13q-14.29,18.72-14.29,53.37T1136,2091q14.28,18.81,40.75,18.81T1217.38,2091Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1371.81,2078.88q1.92,16.1,8.29,22.87,11.28,12.06,41.7,12.06,17.85,0,28.39-5.29t10.53-15.88a17.12,17.12,0,0,0-8.48-15.45q-8.49-5.28-63.12-18.2-39.33-9.73-55.41-24.35-16.08-14.39-16.09-41.49,0-32,25.14-54.93t70.75-23q43.26,0,70.53,17.25t31.29,59.59H1455q-1.27-11.64-6.58-18.42-10-12.27-34-12.28-19.74,0-28.13,6.14t-8.38,14.4c0,6.91,3,11.93,8.92,15q8.89,4.89,63,16.73,36,8.46,54.05,25.61,17.77,17.35,17.78,43.39,0,34.3-25.56,56t-79,21.7q-54.51,0-80.49-23t-26-58.53Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1745.54,2124.32q-29.22,36.06-88.7,36.06t-88.69-36.06q-29.2-36.06-29.21-86.82,0-49.9,29.21-86.5t88.69-36.59q59.49,0,88.7,36.59t29.21,86.5Q1774.75,2088.26,1745.54,2124.32ZM1697.27,2091q14.19-18.81,14.19-53.48t-14.19-53.37q-14.18-18.7-40.64-18.71t-40.75,18.71q-14.28,18.72-14.28,53.37t14.28,53.48q14.3,18.81,40.75,18.81T1697.27,2091Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1992.75,1946.59q28.24,29.84,28.23,87.63,0,61-27.58,92.93t-71.06,32q-27.69,0-46-13.76-10-7.62-19.6-22.23v120.24H1797V1921.82h57.79v34.08q9.79-15,20.88-23.71,20.23-15.43,48.15-15.45Q1964.53,1916.74,1992.75,1946.59Zm-46.3,43.39q-12.3-20.52-39.88-20.53-33.15,0-45.54,31.11-6.43,16.51-6.42,41.92,0,40.21,21.58,56.51,12.82,9.53,30.37,9.53,25.45,0,38.83-19.48t13.36-51.86Q1958.75,2010.51,1946.45,1990Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M2249.14,2124.32q-29.2,36.06-88.69,36.06t-88.69-36.06q-29.22-36.06-29.21-86.82,0-49.9,29.21-86.5t88.69-36.59q59.49,0,88.69,36.59t29.22,86.5Q2278.36,2088.26,2249.14,2124.32ZM2200.88,2091q14.19-18.81,14.18-53.48t-14.18-53.37q-14.18-18.7-40.64-18.71t-40.75,18.71q-14.28,18.72-14.29,53.37t14.29,53.48q14.3,18.81,40.75,18.81T2200.88,2091Z" transform="translate(-215.73 -1774.69)"/></svg>';
153
+ const logoWithTextWhite = '<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2062.63 468.67" height="35px" width="140px"><defs><style>.cls-1{fill:#fff;}</style></defs><title>Prosopo Logo Black</title><path class="cls-1" d="M335.55,1825.19A147.75,147.75,0,0,1,483.3,1972.94h50.5c0-109.49-88.76-198.25-198.25-198.25v50.5Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M269.36,1891.39A147.74,147.74,0,0,1,417.1,2039.13h50.5c0-109.49-88.75-198.24-198.24-198.24v50.5Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M414,2157.17a147.75,147.75,0,0,1-147.74-147.74h-50.5c0,109.49,88.75,198.24,198.24,198.24v-50.5Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M480.17,2091a147.74,147.74,0,0,1-147.74-147.75H281.92c0,109.49,88.76,198.25,198.25,198.25V2091Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M862.8,2017.5q-27.39,22.86-78.25,22.86h-65v112.19H654.82v-312h134q46.32,0,73.86,24.13t27.55,74.72Q890.2,1994.64,862.8,2017.5ZM813,1905.1q-12.37-10.36-34.7-10.38H719.59v91.87h58.75q22.32,0,34.7-11.22t12.39-35.56Q825.43,1915.48,813,1905.1Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1045.69,1916.42c.78.08,2.51.19,5.19.32v61.81c-3.81-.42-7.2-.71-10.16-.85s-5.36-.21-7.2-.21q-36.4,0-48.89,23.71-7,13.33-7,41.06v110.29H916.89V1921.82h57.58V1962q14-23.07,24.34-31.54,16.94-14.18,44-14.18C1044,1916.32,1044.92,1916.35,1045.69,1916.42Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1265.64,2124.32q-29.21,36.06-88.69,36.06t-88.69-36.06Q1059,2088.26,1059,2037.5q0-49.9,29.22-86.5t88.69-36.59q59.47,0,88.69,36.59t29.21,86.5Q1294.85,2088.26,1265.64,2124.32ZM1217.38,2091q14.17-18.81,14.18-53.48t-14.18-53.37q-14.19-18.7-40.64-18.71T1136,1984.13q-14.29,18.72-14.29,53.37T1136,2091q14.28,18.81,40.75,18.81T1217.38,2091Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1371.81,2078.88q1.92,16.1,8.29,22.87,11.28,12.06,41.7,12.06,17.85,0,28.39-5.29t10.53-15.88a17.12,17.12,0,0,0-8.48-15.45q-8.49-5.28-63.12-18.2-39.33-9.73-55.41-24.35-16.08-14.39-16.09-41.49,0-32,25.14-54.93t70.75-23q43.26,0,70.53,17.25t31.29,59.59H1455q-1.27-11.64-6.58-18.42-10-12.27-34-12.28-19.74,0-28.13,6.14t-8.38,14.4c0,6.91,3,11.93,8.92,15q8.89,4.89,63,16.73,36,8.46,54.05,25.61,17.77,17.35,17.78,43.39,0,34.3-25.56,56t-79,21.7q-54.51,0-80.49-23t-26-58.53Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1745.54,2124.32q-29.22,36.06-88.7,36.06t-88.69-36.06q-29.2-36.06-29.21-86.82,0-49.9,29.21-86.5t88.69-36.59q59.49,0,88.7,36.59t29.21,86.5Q1774.75,2088.26,1745.54,2124.32ZM1697.27,2091q14.19-18.81,14.19-53.48t-14.19-53.37q-14.18-18.7-40.64-18.71t-40.75,18.71q-14.28,18.72-14.28,53.37t14.28,53.48q14.3,18.81,40.75,18.81T1697.27,2091Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1992.75,1946.59q28.24,29.84,28.23,87.63,0,61-27.58,92.93t-71.06,32q-27.69,0-46-13.76-10-7.62-19.6-22.23v120.24H1797V1921.82h57.79v34.08q9.79-15,20.88-23.71,20.23-15.43,48.15-15.45Q1964.53,1916.74,1992.75,1946.59Zm-46.3,43.39q-12.3-20.52-39.88-20.53-33.15,0-45.54,31.11-6.43,16.51-6.42,41.92,0,40.21,21.58,56.51,12.82,9.53,30.37,9.53,25.45,0,38.83-19.48t13.36-51.86Q1958.75,2010.51,1946.45,1990Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M2249.14,2124.32q-29.2,36.06-88.69,36.06t-88.69-36.06q-29.22-36.06-29.21-86.82,0-49.9,29.21-86.5t88.69-36.59q59.49,0,88.69,36.59t29.22,86.5Q2278.36,2088.26,2249.14,2124.32ZM2200.88,2091q14.19-18.81,14.18-53.48t-14.18-53.37q-14.18-18.7-40.64-18.71t-40.75,18.71q-14.28,18.72-14.29,53.37t14.29,53.48q14.3,18.81,40.75,18.81T2200.88,2091Z" transform="translate(-215.73 -1774.69)"/></svg>';
154
+ const logoWithoutTextWhite = '<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 260 348" height="35px"><path id="Vector" d="M95.7053 40.2707C127.005 40.2707 157.022 52.6841 179.154 74.78C201.286 96.8759 213.719 126.844 213.719 158.093H254.056C254.056 70.7808 183.16 -4.57764e-05 95.7053 -4.57764e-05V40.2707Z" fill="#fff"/><path id="Vector_2" d="M42.8365 93.0614C58.3333 93.0614 73.6784 96.1087 87.9955 102.029C102.313 107.95 115.322 116.628 126.279 127.568C137.237 138.508 145.93 151.496 151.86 165.79C157.79 180.084 160.843 195.404 160.843 210.875H201.179C201.179 123.564 130.291 52.7906 42.8365 52.7906V93.0614Z" fill="#fff"/><path id="Vector_3" d="M158.367 305.005C127.07 305.003 97.056 292.59 74.926 270.496C52.796 248.402 40.3626 218.437 40.3604 187.191H0.0239563C0.0239563 274.503 70.9123 345.276 158.367 345.276V305.005Z" fill="#fff"/><path id="Vector_4" d="M211.219 252.239C195.722 252.239 180.376 249.191 166.059 243.27C151.741 237.349 138.732 228.67 127.774 217.729C116.816 206.788 108.123 193.799 102.194 179.505C96.2637 165.21 93.2121 149.889 93.2132 134.417H52.8687C52.8687 221.729 123.765 292.509 211.219 292.509V252.239Z" fill="#fff"/></g><defs><clipPath id="clip0_1_2"><rect width="254" height="345" fill="white"/></clipPath></defs></svg>';
155
+ const logoWithoutTextBlack = '<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 260 348" height="35px"><path id="Vector" d="M95.7053 40.2707C127.005 40.2707 157.022 52.6841 179.154 74.78C201.286 96.8759 213.719 126.844 213.719 158.093H254.056C254.056 70.7808 183.16 -4.57764e-05 95.7053 -4.57764e-05V40.2707Z" fill="#000000"/><path id="Vector_2" d="M42.8365 93.0614C58.3333 93.0614 73.6784 96.1087 87.9955 102.029C102.313 107.95 115.322 116.628 126.279 127.568C137.237 138.508 145.93 151.496 151.86 165.79C157.79 180.084 160.843 195.404 160.843 210.875H201.179C201.179 123.564 130.291 52.7906 42.8365 52.7906V93.0614Z" fill="#000000"/><path id="Vector_3" d="M158.367 305.005C127.07 305.003 97.056 292.59 74.926 270.496C52.796 248.402 40.3626 218.437 40.3604 187.191H0.0239563C0.0239563 274.503 70.9123 345.276 158.367 345.276V305.005Z" fill="#000000"/><path id="Vector_4" d="M211.219 252.239C195.722 252.239 180.376 249.191 166.059 243.27C151.741 237.349 138.732 228.67 127.774 217.729C116.816 206.788 108.123 193.799 102.194 179.505C96.2637 165.21 93.2121 149.889 93.2132 134.417H52.8687C52.8687 221.729 123.765 292.509 211.219 292.509V252.239Z" fill="#000000"/></g><defs><clipPath id="clip0_1_2"><rect width="254" height="345" fill="white"/></clipPath></defs></svg>';
156
+ module.exports = Procaptcha;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("@emotion/react/jsx-runtime");
4
+ require("../web-components/dist/index.cjs");
5
+ const react = require("react");
6
+ const CaptchaPlaceholder = require("../web-components/dist/CaptchaPlaceholder.cjs");
7
+ const _interopNamespaceDefaultOnly = (e) => Object.freeze(Object.defineProperty({ __proto__: null, default: e }, Symbol.toStringTag, { value: "Module" }));
8
+ const ProcaptchaWidget = react.lazy(async () => Promise.resolve().then(() => /* @__PURE__ */ _interopNamespaceDefaultOnly(require("./Captcha.cjs"))));
9
+ const ProcaptchaPow = (props) => /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(CaptchaPlaceholder.ProcaptchaPlaceholder, { darkMode: props.config.theme }), children: /* @__PURE__ */ jsxRuntime.jsx(ProcaptchaWidget, { config: props.config, callbacks: props.callbacks }) });
10
+ exports.ProcaptchaPow = ProcaptchaPow;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ require("./components/Captcha.cjs");
4
+ const ProcaptchaPoW = require("./components/ProcaptchaPoW.cjs");
5
+ exports.ProcaptchaPow = ProcaptchaPoW.ProcaptchaPow;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("@emotion/react/jsx-runtime");
4
+ const LoadingSpinner = require("./LoadingSpinner.cjs");
5
+ const react = require("@emotion/react");
6
+ const theme = require("./theme.cjs");
7
+ const react$1 = require("react");
8
+ const logoStyle = react.css`
9
+ align-items: center;
10
+ justify-content: flex-end;
11
+ display: flex;
12
+ padding: 8px;
13
+
14
+ @media (max-width: 245px) {
15
+ &:nth-of-type(1),
16
+ &:nth-of-type(2) {
17
+ display: none;
18
+ } /* Both logos hidden */
19
+ }
20
+
21
+ @media (min-width: 245px) and (max-width: 400px) {
22
+ &:nth-of-type(1) {
23
+ display: flex;
24
+ } /* logoWithText */
25
+ &:nth-of-type(2) {
26
+ display: none;
27
+ } /* logoWithoutText */
28
+ }
29
+
30
+ @media (min-width: 401px) {
31
+ &:nth-of-type(1) {
32
+ display: none;
33
+ } /* logoWithText */
34
+ &:nth-of-type(2) {
35
+ display: flex;
36
+ } /* logoWithoutText */
37
+ }
38
+ `;
39
+ const ProcaptchaPlaceholder = (props) => {
40
+ const darkMode = props.darkMode;
41
+ const styleWidth = { maxWidth: "400px", minWidth: "200px", margin: "8px" };
42
+ const themeColor = darkMode ? "light" : "dark";
43
+ const theme$1 = react$1.useMemo(() => darkMode === "light" ? theme.lightTheme : theme.darkTheme, [darkMode]);
44
+ return jsxRuntime.jsx("div", { children: jsxRuntime.jsx("div", { style: { maxWidth: "100%", maxHeight: "100%", overflowX: "auto" }, children: jsxRuntime.jsxs("div", { style: styleWidth, "data-cy": "button-human", children: [" ", jsxRuntime.jsxs("div", { style: {
45
+ padding: "8px",
46
+ border: "1px solid",
47
+ backgroundColor: theme$1.palette.background.default,
48
+ borderColor: theme$1.palette.grey[300],
49
+ borderRadius: "8px",
50
+ display: "flex",
51
+ justifyContent: "space-between",
52
+ alignItems: "center",
53
+ flexWrap: "wrap"
54
+ }, children: [jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column" }, children: jsxRuntime.jsx("div", { style: {
55
+ display: "flex",
56
+ justifyContent: "flex-start",
57
+ alignItems: "center",
58
+ flexWrap: "wrap"
59
+ }, children: jsxRuntime.jsx("div", { style: {
60
+ height: "50px",
61
+ width: "50px",
62
+ display: "flex",
63
+ alignItems: "center",
64
+ justifyContent: "center",
65
+ flexDirection: "column",
66
+ verticalAlign: "middle"
67
+ }, children: jsxRuntime.jsx("div", { style: {
68
+ display: "flex"
69
+ }, children: jsxRuntime.jsx("div", { style: { flex: 1 }, children: jsxRuntime.jsx(LoadingSpinner.LoadingSpinner, { themeColor }) }) }) }) }) }), jsxRuntime.jsx("div", { children: jsxRuntime.jsx("a", { href: "https://www.prosopo.io/#features?ref=accounts.prosopo.io&utm_campaign=widget&utm_medium=checkbox", target: "_blank", "aria-label": "Visit prosopo.io to learn more about the service and its accessibility options.", children: jsxRuntime.jsx("div", { children: jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { css: logoStyle, dangerouslySetInnerHTML: {
70
+ __html: darkMode === "light" ? logoWithoutTextBlack : logoWithoutTextWhite
71
+ } }), jsxRuntime.jsx("div", { css: logoStyle, dangerouslySetInnerHTML: {
72
+ __html: darkMode === "light" ? logoWithTextBlack : logoWithTextWhite
73
+ } })] }) }) }) })] })] }) }) });
74
+ };
75
+ const logoWithTextBlack = '<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2062.63 468.67" height="35px" width="140px"><defs><style>.cls-1{fill:#1d1d1b;}</style></defs><title>Prosopo Logo Black</title><path class="cls-1" d="M335.55,1825.19A147.75,147.75,0,0,1,483.3,1972.94h50.5c0-109.49-88.76-198.25-198.25-198.25v50.5Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M269.36,1891.39A147.74,147.74,0,0,1,417.1,2039.13h50.5c0-109.49-88.75-198.24-198.24-198.24v50.5Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M414,2157.17a147.75,147.75,0,0,1-147.74-147.74h-50.5c0,109.49,88.75,198.24,198.24,198.24v-50.5Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M480.17,2091a147.74,147.74,0,0,1-147.74-147.75H281.92c0,109.49,88.76,198.25,198.25,198.25V2091Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M862.8,2017.5q-27.39,22.86-78.25,22.86h-65v112.19H654.82v-312h134q46.32,0,73.86,24.13t27.55,74.72Q890.2,1994.64,862.8,2017.5ZM813,1905.1q-12.37-10.36-34.7-10.38H719.59v91.87h58.75q22.32,0,34.7-11.22t12.39-35.56Q825.43,1915.48,813,1905.1Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1045.69,1916.42c.78.08,2.51.19,5.19.32v61.81c-3.81-.42-7.2-.71-10.16-.85s-5.36-.21-7.2-.21q-36.4,0-48.89,23.71-7,13.33-7,41.06v110.29H916.89V1921.82h57.58V1962q14-23.07,24.34-31.54,16.94-14.18,44-14.18C1044,1916.32,1044.92,1916.35,1045.69,1916.42Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1265.64,2124.32q-29.21,36.06-88.69,36.06t-88.69-36.06Q1059,2088.26,1059,2037.5q0-49.9,29.22-86.5t88.69-36.59q59.47,0,88.69,36.59t29.21,86.5Q1294.85,2088.26,1265.64,2124.32ZM1217.38,2091q14.17-18.81,14.18-53.48t-14.18-53.37q-14.19-18.7-40.64-18.71T1136,1984.13q-14.29,18.72-14.29,53.37T1136,2091q14.28,18.81,40.75,18.81T1217.38,2091Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1371.81,2078.88q1.92,16.1,8.29,22.87,11.28,12.06,41.7,12.06,17.85,0,28.39-5.29t10.53-15.88a17.12,17.12,0,0,0-8.48-15.45q-8.49-5.28-63.12-18.2-39.33-9.73-55.41-24.35-16.08-14.39-16.09-41.49,0-32,25.14-54.93t70.75-23q43.26,0,70.53,17.25t31.29,59.59H1455q-1.27-11.64-6.58-18.42-10-12.27-34-12.28-19.74,0-28.13,6.14t-8.38,14.4c0,6.91,3,11.93,8.92,15q8.89,4.89,63,16.73,36,8.46,54.05,25.61,17.77,17.35,17.78,43.39,0,34.3-25.56,56t-79,21.7q-54.51,0-80.49-23t-26-58.53Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1745.54,2124.32q-29.22,36.06-88.7,36.06t-88.69-36.06q-29.2-36.06-29.21-86.82,0-49.9,29.21-86.5t88.69-36.59q59.49,0,88.7,36.59t29.21,86.5Q1774.75,2088.26,1745.54,2124.32ZM1697.27,2091q14.19-18.81,14.19-53.48t-14.19-53.37q-14.18-18.7-40.64-18.71t-40.75,18.71q-14.28,18.72-14.28,53.37t14.28,53.48q14.3,18.81,40.75,18.81T1697.27,2091Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1992.75,1946.59q28.24,29.84,28.23,87.63,0,61-27.58,92.93t-71.06,32q-27.69,0-46-13.76-10-7.62-19.6-22.23v120.24H1797V1921.82h57.79v34.08q9.79-15,20.88-23.71,20.23-15.43,48.15-15.45Q1964.53,1916.74,1992.75,1946.59Zm-46.3,43.39q-12.3-20.52-39.88-20.53-33.15,0-45.54,31.11-6.43,16.51-6.42,41.92,0,40.21,21.58,56.51,12.82,9.53,30.37,9.53,25.45,0,38.83-19.48t13.36-51.86Q1958.75,2010.51,1946.45,1990Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M2249.14,2124.32q-29.2,36.06-88.69,36.06t-88.69-36.06q-29.22-36.06-29.21-86.82,0-49.9,29.21-86.5t88.69-36.59q59.49,0,88.69,36.59t29.22,86.5Q2278.36,2088.26,2249.14,2124.32ZM2200.88,2091q14.19-18.81,14.18-53.48t-14.18-53.37q-14.18-18.7-40.64-18.71t-40.75,18.71q-14.28,18.72-14.29,53.37t14.29,53.48q14.3,18.81,40.75,18.81T2200.88,2091Z" transform="translate(-215.73 -1774.69)"/></svg>';
76
+ const logoWithTextWhite = '<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2062.63 468.67" height="35px" width="140px"><defs><style>.cls-1{fill:#fff;}</style></defs><title>Prosopo Logo Black</title><path class="cls-1" d="M335.55,1825.19A147.75,147.75,0,0,1,483.3,1972.94h50.5c0-109.49-88.76-198.25-198.25-198.25v50.5Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M269.36,1891.39A147.74,147.74,0,0,1,417.1,2039.13h50.5c0-109.49-88.75-198.24-198.24-198.24v50.5Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M414,2157.17a147.75,147.75,0,0,1-147.74-147.74h-50.5c0,109.49,88.75,198.24,198.24,198.24v-50.5Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M480.17,2091a147.74,147.74,0,0,1-147.74-147.75H281.92c0,109.49,88.76,198.25,198.25,198.25V2091Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M862.8,2017.5q-27.39,22.86-78.25,22.86h-65v112.19H654.82v-312h134q46.32,0,73.86,24.13t27.55,74.72Q890.2,1994.64,862.8,2017.5ZM813,1905.1q-12.37-10.36-34.7-10.38H719.59v91.87h58.75q22.32,0,34.7-11.22t12.39-35.56Q825.43,1915.48,813,1905.1Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1045.69,1916.42c.78.08,2.51.19,5.19.32v61.81c-3.81-.42-7.2-.71-10.16-.85s-5.36-.21-7.2-.21q-36.4,0-48.89,23.71-7,13.33-7,41.06v110.29H916.89V1921.82h57.58V1962q14-23.07,24.34-31.54,16.94-14.18,44-14.18C1044,1916.32,1044.92,1916.35,1045.69,1916.42Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1265.64,2124.32q-29.21,36.06-88.69,36.06t-88.69-36.06Q1059,2088.26,1059,2037.5q0-49.9,29.22-86.5t88.69-36.59q59.47,0,88.69,36.59t29.21,86.5Q1294.85,2088.26,1265.64,2124.32ZM1217.38,2091q14.17-18.81,14.18-53.48t-14.18-53.37q-14.19-18.7-40.64-18.71T1136,1984.13q-14.29,18.72-14.29,53.37T1136,2091q14.28,18.81,40.75,18.81T1217.38,2091Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1371.81,2078.88q1.92,16.1,8.29,22.87,11.28,12.06,41.7,12.06,17.85,0,28.39-5.29t10.53-15.88a17.12,17.12,0,0,0-8.48-15.45q-8.49-5.28-63.12-18.2-39.33-9.73-55.41-24.35-16.08-14.39-16.09-41.49,0-32,25.14-54.93t70.75-23q43.26,0,70.53,17.25t31.29,59.59H1455q-1.27-11.64-6.58-18.42-10-12.27-34-12.28-19.74,0-28.13,6.14t-8.38,14.4c0,6.91,3,11.93,8.92,15q8.89,4.89,63,16.73,36,8.46,54.05,25.61,17.77,17.35,17.78,43.39,0,34.3-25.56,56t-79,21.7q-54.51,0-80.49-23t-26-58.53Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1745.54,2124.32q-29.22,36.06-88.7,36.06t-88.69-36.06q-29.2-36.06-29.21-86.82,0-49.9,29.21-86.5t88.69-36.59q59.49,0,88.7,36.59t29.21,86.5Q1774.75,2088.26,1745.54,2124.32ZM1697.27,2091q14.19-18.81,14.19-53.48t-14.19-53.37q-14.18-18.7-40.64-18.71t-40.75,18.71q-14.28,18.72-14.28,53.37t14.28,53.48q14.3,18.81,40.75,18.81T1697.27,2091Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1992.75,1946.59q28.24,29.84,28.23,87.63,0,61-27.58,92.93t-71.06,32q-27.69,0-46-13.76-10-7.62-19.6-22.23v120.24H1797V1921.82h57.79v34.08q9.79-15,20.88-23.71,20.23-15.43,48.15-15.45Q1964.53,1916.74,1992.75,1946.59Zm-46.3,43.39q-12.3-20.52-39.88-20.53-33.15,0-45.54,31.11-6.43,16.51-6.42,41.92,0,40.21,21.58,56.51,12.82,9.53,30.37,9.53,25.45,0,38.83-19.48t13.36-51.86Q1958.75,2010.51,1946.45,1990Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M2249.14,2124.32q-29.2,36.06-88.69,36.06t-88.69-36.06q-29.22-36.06-29.21-86.82,0-49.9,29.21-86.5t88.69-36.59q59.49,0,88.69,36.59t29.22,86.5Q2278.36,2088.26,2249.14,2124.32ZM2200.88,2091q14.19-18.81,14.18-53.48t-14.18-53.37q-14.18-18.7-40.64-18.71t-40.75,18.71q-14.28,18.72-14.29,53.37t14.29,53.48q14.3,18.81,40.75,18.81T2200.88,2091Z" transform="translate(-215.73 -1774.69)"/></svg>';
77
+ const logoWithoutTextWhite = '<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 260 348" height="35px"><path id="Vector" d="M95.7053 40.2707C127.005 40.2707 157.022 52.6841 179.154 74.78C201.286 96.8759 213.719 126.844 213.719 158.093H254.056C254.056 70.7808 183.16 -4.57764e-05 95.7053 -4.57764e-05V40.2707Z" fill="#fff"/><path id="Vector_2" d="M42.8365 93.0614C58.3333 93.0614 73.6784 96.1087 87.9955 102.029C102.313 107.95 115.322 116.628 126.279 127.568C137.237 138.508 145.93 151.496 151.86 165.79C157.79 180.084 160.843 195.404 160.843 210.875H201.179C201.179 123.564 130.291 52.7906 42.8365 52.7906V93.0614Z" fill="#fff"/><path id="Vector_3" d="M158.367 305.005C127.07 305.003 97.056 292.59 74.926 270.496C52.796 248.402 40.3626 218.437 40.3604 187.191H0.0239563C0.0239563 274.503 70.9123 345.276 158.367 345.276V305.005Z" fill="#fff"/><path id="Vector_4" d="M211.219 252.239C195.722 252.239 180.376 249.191 166.059 243.27C151.741 237.349 138.732 228.67 127.774 217.729C116.816 206.788 108.123 193.799 102.194 179.505C96.2637 165.21 93.2121 149.889 93.2132 134.417H52.8687C52.8687 221.729 123.765 292.509 211.219 292.509V252.239Z" fill="#fff"/></g><defs><clipPath id="clip0_1_2"><rect width="254" height="345" fill="white"/></clipPath></defs></svg>';
78
+ const logoWithoutTextBlack = '<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 260 348" height="35px"><path id="Vector" d="M95.7053 40.2707C127.005 40.2707 157.022 52.6841 179.154 74.78C201.286 96.8759 213.719 126.844 213.719 158.093H254.056C254.056 70.7808 183.16 -4.57764e-05 95.7053 -4.57764e-05V40.2707Z" fill="#000000"/><path id="Vector_2" d="M42.8365 93.0614C58.3333 93.0614 73.6784 96.1087 87.9955 102.029C102.313 107.95 115.322 116.628 126.279 127.568C137.237 138.508 145.93 151.496 151.86 165.79C157.79 180.084 160.843 195.404 160.843 210.875H201.179C201.179 123.564 130.291 52.7906 42.8365 52.7906V93.0614Z" fill="#000000"/><path id="Vector_3" d="M158.367 305.005C127.07 305.003 97.056 292.59 74.926 270.496C52.796 248.402 40.3626 218.437 40.3604 187.191H0.0239563C0.0239563 274.503 70.9123 345.276 158.367 345.276V305.005Z" fill="#000000"/><path id="Vector_4" d="M211.219 252.239C195.722 252.239 180.376 249.191 166.059 243.27C151.741 237.349 138.732 228.67 127.774 217.729C116.816 206.788 108.123 193.799 102.194 179.505C96.2637 165.21 93.2121 149.889 93.2132 134.417H52.8687C52.8687 221.729 123.765 292.509 211.219 292.509V252.239Z" fill="#000000"/></g><defs><clipPath id="clip0_1_2"><rect width="254" height="345" fill="white"/></clipPath></defs></svg>';
79
+ exports.ProcaptchaPlaceholder = ProcaptchaPlaceholder;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const jsxRuntime = require("@emotion/react/jsx-runtime");
4
+ const react = require("@emotion/react");
5
+ const theme = require("./theme.cjs");
6
+ const react$1 = require("react");
7
+ const checkboxBefore = react.css`{
8
+ &:before {
9
+ content: '""';
10
+ position: absolute;
11
+ height: 100%;
12
+ width: 100%;
13
+ }
14
+ }`;
15
+ const baseStyle = {
16
+ width: "2.2em",
17
+ height: "2.2em",
18
+ top: "auto",
19
+ left: "auto",
20
+ opacity: "1",
21
+ borderRadius: "12.5%",
22
+ appearance: "none",
23
+ cursor: "pointer",
24
+ margin: "0",
25
+ borderStyle: "solid",
26
+ borderWidth: "1px"
27
+ };
28
+ const Checkbox = ({ themeColor, onChange, checked }) => {
29
+ const theme$1 = react$1.useMemo(() => themeColor === "light" ? theme.lightTheme : theme.darkTheme, [themeColor]);
30
+ const checkboxStyleBase = {
31
+ ...baseStyle,
32
+ border: `1px solid ${theme$1.palette.background.contrastText}`
33
+ };
34
+ const [hover, setHover] = react$1.useState(false);
35
+ const checkboxStyle = react$1.useMemo(() => {
36
+ return {
37
+ ...checkboxStyleBase,
38
+ borderColor: hover ? theme$1.palette.background.contrastText : theme$1.palette.grey[400],
39
+ appearance: checked ? "auto" : "none"
40
+ };
41
+ }, [hover, theme$1, checked]);
42
+ return jsxRuntime.jsx("input", { onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false), css: checkboxBefore, type: "checkbox", "aria-live": "assertive", "aria-haspopup": "true", onChange, checked, style: checkboxStyle });
43
+ };
44
+ exports.Checkbox = Checkbox;
45
+ exports.default = Checkbox;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const jsxRuntime = require("@emotion/react/jsx-runtime");
4
+ const theme = require("./theme.cjs");
5
+ const react = require("react");
6
+ const styled = require("@emotion/styled");
7
+ const LoadingSpinner = ({ themeColor }) => {
8
+ const theme$1 = react.useMemo(() => themeColor === "light" ? theme.lightTheme : theme.darkTheme, [themeColor]);
9
+ const StyledDiv = styled.div`
10
+ width: 2em;
11
+ height: 2em;
12
+ border: 4px solid ${theme$1.palette.background.contrastText};
13
+ border-bottom-color: transparent;
14
+ border-radius: 50%;
15
+ display: inherit;
16
+ box-sizing: border-box;
17
+ animation: rotation 1s linear infinite;
18
+ @keyframes rotation {
19
+ 0% {
20
+ transform: rotate(0deg);
21
+ }
22
+ 100% {
23
+ transform: rotate(360deg);
24
+ }
25
+ }
26
+ `;
27
+ return jsxRuntime.jsx(StyledDiv, {});
28
+ };
29
+ exports.LoadingSpinner = LoadingSpinner;
30
+ exports.default = LoadingSpinner;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const CaptchaPlaceholder = require("./CaptchaPlaceholder.cjs");
4
+ const LoadingSpinner = require("./LoadingSpinner.cjs");
5
+ const theme = require("./theme.cjs");
6
+ const Checkbox = require("./Checkbox.cjs");
7
+ exports.ProcaptchaPlaceholder = CaptchaPlaceholder.ProcaptchaPlaceholder;
8
+ exports.LoadingSpinner = LoadingSpinner.LoadingSpinner;
9
+ exports.darkTheme = theme.darkTheme;
10
+ exports.lightTheme = theme.lightTheme;
11
+ exports.Checkbox = Checkbox.Checkbox;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const grey = {
4
+ 0: "#fff",
5
+ 100: "#f5f5f5",
6
+ 200: "#eeeeee",
7
+ 300: "#e0e0e0",
8
+ 400: "#bdbdbd",
9
+ 500: "#9e9e9e",
10
+ 600: "#757575",
11
+ 700: "#616161",
12
+ 800: "#424242",
13
+ 900: "#212121"
14
+ };
15
+ const lightTheme = {
16
+ palette: {
17
+ mode: "light",
18
+ primary: {
19
+ main: "#487DFA",
20
+ contrastText: "#fff"
21
+ },
22
+ background: {
23
+ default: "#fff",
24
+ contrastText: "#000"
25
+ },
26
+ grey
27
+ }
28
+ };
29
+ const darkTheme = {
30
+ palette: {
31
+ mode: "dark",
32
+ primary: {
33
+ main: "#487DFA",
34
+ contrastText: "#fff"
35
+ },
36
+ background: {
37
+ default: "#303030",
38
+ contrastText: "#fff"
39
+ },
40
+ grey
41
+ }
42
+ };
43
+ exports.darkTheme = darkTheme;
44
+ exports.lightTheme = lightTheme;
@@ -0,0 +1,20 @@
1
+ import { ProcaptchaClientConfigInput, ProcaptchaOutput } from '@prosopo/types';
2
+ export type ProcaptchaCallbacks = Partial<ProcaptchaEvents>;
3
+ export interface ProcaptchaEvents {
4
+ onError: (error: Error) => void;
5
+ onAccountNotFound: (address: string) => void;
6
+ onHuman: (output: ProcaptchaOutput) => void;
7
+ onExtensionNotFound: () => void;
8
+ onChallengeExpired: () => void;
9
+ onExpired: () => void;
10
+ onFailed: () => void;
11
+ onOpen: () => void;
12
+ onClose: () => void;
13
+ }
14
+ export interface ProcaptchaProps {
15
+ config: ProcaptchaClientConfigInput;
16
+ callbacks?: Partial<ProcaptchaCallbacks>;
17
+ }
18
+ declare const Procaptcha: (props: ProcaptchaProps) => import("@emotion/react/jsx-runtime").JSX.Element;
19
+ export default Procaptcha;
20
+ //# sourceMappingURL=Captcha.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Captcha.d.ts","sourceRoot":"","sources":["../../src/components/Captcha.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAoC9E,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAK3D,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAC/B,iBAAiB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5C,OAAO,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAA;IAC3C,mBAAmB,EAAE,MAAM,IAAI,CAAA;IAC/B,kBAAkB,EAAE,MAAM,IAAI,CAAA;IAC9B,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,OAAO,EAAE,MAAM,IAAI,CAAA;CACtB;AAED,MAAM,WAAW,eAAe;IAE5B,MAAM,EAAE,2BAA2B,CAAA;IAEnC,SAAS,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAA;CAC3C;AAED,QAAA,MAAM,UAAU,UAAW,eAAe,qDAiHzC,CAAA;AAcD,eAAe,UAAU,CAAA"}
@@ -0,0 +1,90 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
+ import { Checkbox, LoadingSpinner, darkTheme, lightTheme } from '@prosopo/web-components';
3
+ import { Manager } from '../Services/Manager.js';
4
+ import { css } from '@emotion/react';
5
+ import { useMemo, useState } from 'react';
6
+ const logoStyle = css `
7
+ align-items: center;
8
+ justify-content: flex-end;
9
+ display: flex;
10
+ padding: 8px;
11
+
12
+ @media (max-width: 245px) {
13
+ &:nth-of-type(1),
14
+ &:nth-of-type(2) {
15
+ display: none;
16
+ } /* Both logos hidden */
17
+ }
18
+
19
+ @media (min-width: 245px) and (max-width: 400px) {
20
+ &:nth-of-type(1) {
21
+ display: flex;
22
+ } /* logoWithText */
23
+ &:nth-of-type(2) {
24
+ display: none;
25
+ } /* logoWithoutText */
26
+ }
27
+
28
+ @media (min-width: 401px) {
29
+ &:nth-of-type(1) {
30
+ display: none;
31
+ } /* logoWithText */
32
+ &:nth-of-type(2) {
33
+ display: flex;
34
+ } /* logoWithoutText */
35
+ }
36
+ `;
37
+ const Procaptcha = (props) => {
38
+ const [checked, setChecked] = useState(false);
39
+ const [loading, setLoading] = useState(false);
40
+ const darkMode = props.config.theme;
41
+ const styleWidth = { maxWidth: '400px', minWidth: '200px', margin: '8px' };
42
+ const themeColor = darkMode ? 'light' : 'dark';
43
+ const theme = useMemo(() => (darkMode === 'light' ? lightTheme : darkTheme), [darkMode]);
44
+ const handlePowCaptcha = async () => {
45
+ setLoading(true);
46
+ Manager(props.config).then((verified) => {
47
+ if (verified.verified) {
48
+ console.log('verified');
49
+ setChecked(true);
50
+ }
51
+ setLoading(false);
52
+ });
53
+ };
54
+ return (_jsx("div", { children: _jsx("div", { style: { maxWidth: '100%', maxHeight: '100%', overflowX: 'auto' }, children: _jsxs("div", { style: styleWidth, "data-cy": 'button-human', children: [' ', _jsxs("div", { style: {
55
+ padding: '8px',
56
+ border: '1px solid',
57
+ backgroundColor: theme.palette.background.default,
58
+ borderColor: theme.palette.grey[300],
59
+ borderRadius: '8px',
60
+ display: 'flex',
61
+ justifyContent: 'space-between',
62
+ alignItems: 'center',
63
+ flexWrap: 'wrap',
64
+ }, children: [_jsx("div", { style: { display: 'flex', flexDirection: 'column' }, children: _jsxs("div", { style: {
65
+ display: 'flex',
66
+ justifyContent: 'flex-start',
67
+ alignItems: 'center',
68
+ flexWrap: 'wrap',
69
+ }, children: [_jsx("div", { style: {
70
+ height: '50px',
71
+ width: '50px',
72
+ display: 'flex',
73
+ alignItems: 'center',
74
+ justifyContent: 'center',
75
+ flexDirection: 'column',
76
+ verticalAlign: 'middle',
77
+ }, children: _jsx("div", { style: {
78
+ display: 'flex',
79
+ }, children: _jsx("div", { style: { flex: 1 }, children: loading ? (_jsx(LoadingSpinner, { themeColor: themeColor })) : (_jsx(Checkbox, { checked: checked, onChange: handlePowCaptcha, themeColor: props.config.theme || 'light' })) }) }) }), _jsx("div", { style: { padding: 1 }, children: _jsx("span", { style: { color: theme.palette.background.contrastText, paddingLeft: '4px' }, children: "I am a human" }) })] }) }), _jsx("div", { children: _jsx("a", { href: "https://www.prosopo.io/#features?ref=accounts.prosopo.io&utm_campaign=widget&utm_medium=checkbox", target: "_blank", "aria-label": "Visit prosopo.io to learn more about the service and its accessibility options.", children: _jsx("div", { children: _jsxs("div", { children: [_jsx("div", { css: logoStyle, dangerouslySetInnerHTML: {
80
+ __html: darkMode === 'light' ? logoWithoutTextBlack : logoWithoutTextWhite,
81
+ } }), _jsx("div", { css: logoStyle, dangerouslySetInnerHTML: {
82
+ __html: darkMode === 'light' ? logoWithTextBlack : logoWithTextWhite,
83
+ } })] }) }) }) })] })] }) }) }));
84
+ };
85
+ const logoWithTextBlack = '<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2062.63 468.67" height="35px" width="140px"><defs><style>.cls-1{fill:#1d1d1b;}</style></defs><title>Prosopo Logo Black</title><path class="cls-1" d="M335.55,1825.19A147.75,147.75,0,0,1,483.3,1972.94h50.5c0-109.49-88.76-198.25-198.25-198.25v50.5Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M269.36,1891.39A147.74,147.74,0,0,1,417.1,2039.13h50.5c0-109.49-88.75-198.24-198.24-198.24v50.5Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M414,2157.17a147.75,147.75,0,0,1-147.74-147.74h-50.5c0,109.49,88.75,198.24,198.24,198.24v-50.5Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M480.17,2091a147.74,147.74,0,0,1-147.74-147.75H281.92c0,109.49,88.76,198.25,198.25,198.25V2091Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M862.8,2017.5q-27.39,22.86-78.25,22.86h-65v112.19H654.82v-312h134q46.32,0,73.86,24.13t27.55,74.72Q890.2,1994.64,862.8,2017.5ZM813,1905.1q-12.37-10.36-34.7-10.38H719.59v91.87h58.75q22.32,0,34.7-11.22t12.39-35.56Q825.43,1915.48,813,1905.1Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1045.69,1916.42c.78.08,2.51.19,5.19.32v61.81c-3.81-.42-7.2-.71-10.16-.85s-5.36-.21-7.2-.21q-36.4,0-48.89,23.71-7,13.33-7,41.06v110.29H916.89V1921.82h57.58V1962q14-23.07,24.34-31.54,16.94-14.18,44-14.18C1044,1916.32,1044.92,1916.35,1045.69,1916.42Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1265.64,2124.32q-29.21,36.06-88.69,36.06t-88.69-36.06Q1059,2088.26,1059,2037.5q0-49.9,29.22-86.5t88.69-36.59q59.47,0,88.69,36.59t29.21,86.5Q1294.85,2088.26,1265.64,2124.32ZM1217.38,2091q14.17-18.81,14.18-53.48t-14.18-53.37q-14.19-18.7-40.64-18.71T1136,1984.13q-14.29,18.72-14.29,53.37T1136,2091q14.28,18.81,40.75,18.81T1217.38,2091Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1371.81,2078.88q1.92,16.1,8.29,22.87,11.28,12.06,41.7,12.06,17.85,0,28.39-5.29t10.53-15.88a17.12,17.12,0,0,0-8.48-15.45q-8.49-5.28-63.12-18.2-39.33-9.73-55.41-24.35-16.08-14.39-16.09-41.49,0-32,25.14-54.93t70.75-23q43.26,0,70.53,17.25t31.29,59.59H1455q-1.27-11.64-6.58-18.42-10-12.27-34-12.28-19.74,0-28.13,6.14t-8.38,14.4c0,6.91,3,11.93,8.92,15q8.89,4.89,63,16.73,36,8.46,54.05,25.61,17.77,17.35,17.78,43.39,0,34.3-25.56,56t-79,21.7q-54.51,0-80.49-23t-26-58.53Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1745.54,2124.32q-29.22,36.06-88.7,36.06t-88.69-36.06q-29.2-36.06-29.21-86.82,0-49.9,29.21-86.5t88.69-36.59q59.49,0,88.7,36.59t29.21,86.5Q1774.75,2088.26,1745.54,2124.32ZM1697.27,2091q14.19-18.81,14.19-53.48t-14.19-53.37q-14.18-18.7-40.64-18.71t-40.75,18.71q-14.28,18.72-14.28,53.37t14.28,53.48q14.3,18.81,40.75,18.81T1697.27,2091Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1992.75,1946.59q28.24,29.84,28.23,87.63,0,61-27.58,92.93t-71.06,32q-27.69,0-46-13.76-10-7.62-19.6-22.23v120.24H1797V1921.82h57.79v34.08q9.79-15,20.88-23.71,20.23-15.43,48.15-15.45Q1964.53,1916.74,1992.75,1946.59Zm-46.3,43.39q-12.3-20.52-39.88-20.53-33.15,0-45.54,31.11-6.43,16.51-6.42,41.92,0,40.21,21.58,56.51,12.82,9.53,30.37,9.53,25.45,0,38.83-19.48t13.36-51.86Q1958.75,2010.51,1946.45,1990Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M2249.14,2124.32q-29.2,36.06-88.69,36.06t-88.69-36.06q-29.22-36.06-29.21-86.82,0-49.9,29.21-86.5t88.69-36.59q59.49,0,88.69,36.59t29.22,86.5Q2278.36,2088.26,2249.14,2124.32ZM2200.88,2091q14.19-18.81,14.18-53.48t-14.18-53.37q-14.18-18.7-40.64-18.71t-40.75,18.71q-14.28,18.72-14.29,53.37t14.29,53.48q14.3,18.81,40.75,18.81T2200.88,2091Z" transform="translate(-215.73 -1774.69)"/></svg>';
86
+ const logoWithTextWhite = '<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2062.63 468.67" height="35px" width="140px"><defs><style>.cls-1{fill:#fff;}</style></defs><title>Prosopo Logo Black</title><path class="cls-1" d="M335.55,1825.19A147.75,147.75,0,0,1,483.3,1972.94h50.5c0-109.49-88.76-198.25-198.25-198.25v50.5Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M269.36,1891.39A147.74,147.74,0,0,1,417.1,2039.13h50.5c0-109.49-88.75-198.24-198.24-198.24v50.5Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M414,2157.17a147.75,147.75,0,0,1-147.74-147.74h-50.5c0,109.49,88.75,198.24,198.24,198.24v-50.5Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M480.17,2091a147.74,147.74,0,0,1-147.74-147.75H281.92c0,109.49,88.76,198.25,198.25,198.25V2091Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M862.8,2017.5q-27.39,22.86-78.25,22.86h-65v112.19H654.82v-312h134q46.32,0,73.86,24.13t27.55,74.72Q890.2,1994.64,862.8,2017.5ZM813,1905.1q-12.37-10.36-34.7-10.38H719.59v91.87h58.75q22.32,0,34.7-11.22t12.39-35.56Q825.43,1915.48,813,1905.1Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1045.69,1916.42c.78.08,2.51.19,5.19.32v61.81c-3.81-.42-7.2-.71-10.16-.85s-5.36-.21-7.2-.21q-36.4,0-48.89,23.71-7,13.33-7,41.06v110.29H916.89V1921.82h57.58V1962q14-23.07,24.34-31.54,16.94-14.18,44-14.18C1044,1916.32,1044.92,1916.35,1045.69,1916.42Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1265.64,2124.32q-29.21,36.06-88.69,36.06t-88.69-36.06Q1059,2088.26,1059,2037.5q0-49.9,29.22-86.5t88.69-36.59q59.47,0,88.69,36.59t29.21,86.5Q1294.85,2088.26,1265.64,2124.32ZM1217.38,2091q14.17-18.81,14.18-53.48t-14.18-53.37q-14.19-18.7-40.64-18.71T1136,1984.13q-14.29,18.72-14.29,53.37T1136,2091q14.28,18.81,40.75,18.81T1217.38,2091Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1371.81,2078.88q1.92,16.1,8.29,22.87,11.28,12.06,41.7,12.06,17.85,0,28.39-5.29t10.53-15.88a17.12,17.12,0,0,0-8.48-15.45q-8.49-5.28-63.12-18.2-39.33-9.73-55.41-24.35-16.08-14.39-16.09-41.49,0-32,25.14-54.93t70.75-23q43.26,0,70.53,17.25t31.29,59.59H1455q-1.27-11.64-6.58-18.42-10-12.27-34-12.28-19.74,0-28.13,6.14t-8.38,14.4c0,6.91,3,11.93,8.92,15q8.89,4.89,63,16.73,36,8.46,54.05,25.61,17.77,17.35,17.78,43.39,0,34.3-25.56,56t-79,21.7q-54.51,0-80.49-23t-26-58.53Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1745.54,2124.32q-29.22,36.06-88.7,36.06t-88.69-36.06q-29.2-36.06-29.21-86.82,0-49.9,29.21-86.5t88.69-36.59q59.49,0,88.7,36.59t29.21,86.5Q1774.75,2088.26,1745.54,2124.32ZM1697.27,2091q14.19-18.81,14.19-53.48t-14.19-53.37q-14.18-18.7-40.64-18.71t-40.75,18.71q-14.28,18.72-14.28,53.37t14.28,53.48q14.3,18.81,40.75,18.81T1697.27,2091Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1992.75,1946.59q28.24,29.84,28.23,87.63,0,61-27.58,92.93t-71.06,32q-27.69,0-46-13.76-10-7.62-19.6-22.23v120.24H1797V1921.82h57.79v34.08q9.79-15,20.88-23.71,20.23-15.43,48.15-15.45Q1964.53,1916.74,1992.75,1946.59Zm-46.3,43.39q-12.3-20.52-39.88-20.53-33.15,0-45.54,31.11-6.43,16.51-6.42,41.92,0,40.21,21.58,56.51,12.82,9.53,30.37,9.53,25.45,0,38.83-19.48t13.36-51.86Q1958.75,2010.51,1946.45,1990Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M2249.14,2124.32q-29.2,36.06-88.69,36.06t-88.69-36.06q-29.22-36.06-29.21-86.82,0-49.9,29.21-86.5t88.69-36.59q59.49,0,88.69,36.59t29.22,86.5Q2278.36,2088.26,2249.14,2124.32ZM2200.88,2091q14.19-18.81,14.18-53.48t-14.18-53.37q-14.18-18.7-40.64-18.71t-40.75,18.71q-14.28,18.72-14.29,53.37t14.29,53.48q14.3,18.81,40.75,18.81T2200.88,2091Z" transform="translate(-215.73 -1774.69)"/></svg>';
87
+ const logoWithoutTextWhite = '<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 260 348" height="35px"><path id="Vector" d="M95.7053 40.2707C127.005 40.2707 157.022 52.6841 179.154 74.78C201.286 96.8759 213.719 126.844 213.719 158.093H254.056C254.056 70.7808 183.16 -4.57764e-05 95.7053 -4.57764e-05V40.2707Z" fill="#fff"/><path id="Vector_2" d="M42.8365 93.0614C58.3333 93.0614 73.6784 96.1087 87.9955 102.029C102.313 107.95 115.322 116.628 126.279 127.568C137.237 138.508 145.93 151.496 151.86 165.79C157.79 180.084 160.843 195.404 160.843 210.875H201.179C201.179 123.564 130.291 52.7906 42.8365 52.7906V93.0614Z" fill="#fff"/><path id="Vector_3" d="M158.367 305.005C127.07 305.003 97.056 292.59 74.926 270.496C52.796 248.402 40.3626 218.437 40.3604 187.191H0.0239563C0.0239563 274.503 70.9123 345.276 158.367 345.276V305.005Z" fill="#fff"/><path id="Vector_4" d="M211.219 252.239C195.722 252.239 180.376 249.191 166.059 243.27C151.741 237.349 138.732 228.67 127.774 217.729C116.816 206.788 108.123 193.799 102.194 179.505C96.2637 165.21 93.2121 149.889 93.2132 134.417H52.8687C52.8687 221.729 123.765 292.509 211.219 292.509V252.239Z" fill="#fff"/></g><defs><clipPath id="clip0_1_2"><rect width="254" height="345" fill="white"/></clipPath></defs></svg>';
88
+ const logoWithoutTextBlack = '<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 260 348" height="35px"><path id="Vector" d="M95.7053 40.2707C127.005 40.2707 157.022 52.6841 179.154 74.78C201.286 96.8759 213.719 126.844 213.719 158.093H254.056C254.056 70.7808 183.16 -4.57764e-05 95.7053 -4.57764e-05V40.2707Z" fill="#000000"/><path id="Vector_2" d="M42.8365 93.0614C58.3333 93.0614 73.6784 96.1087 87.9955 102.029C102.313 107.95 115.322 116.628 126.279 127.568C137.237 138.508 145.93 151.496 151.86 165.79C157.79 180.084 160.843 195.404 160.843 210.875H201.179C201.179 123.564 130.291 52.7906 42.8365 52.7906V93.0614Z" fill="#000000"/><path id="Vector_3" d="M158.367 305.005C127.07 305.003 97.056 292.59 74.926 270.496C52.796 248.402 40.3626 218.437 40.3604 187.191H0.0239563C0.0239563 274.503 70.9123 345.276 158.367 345.276V305.005Z" fill="#000000"/><path id="Vector_4" d="M211.219 252.239C195.722 252.239 180.376 249.191 166.059 243.27C151.741 237.349 138.732 228.67 127.774 217.729C116.816 206.788 108.123 193.799 102.194 179.505C96.2637 165.21 93.2121 149.889 93.2132 134.417H52.8687C52.8687 221.729 123.765 292.509 211.219 292.509V252.239Z" fill="#000000"/></g><defs><clipPath id="clip0_1_2"><rect width="254" height="345" fill="white"/></clipPath></defs></svg>';
89
+ export default Procaptcha;
90
+ //# sourceMappingURL=Captcha.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Captcha.js","sourceRoot":"","sources":["../../src/components/Captcha.tsx"],"names":[],"mappings":"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"}
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare const ProcaptchaWidget: import("react").LazyExoticComponent<(props: import("./Captcha.js").ProcaptchaProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
3
+ type ProcaptchaProps = React.ComponentProps<typeof ProcaptchaWidget>;
4
+ export declare const ProcaptchaPow: (props: ProcaptchaProps) => import("@emotion/react/jsx-runtime").JSX.Element;
5
+ export {};
6
+ //# sourceMappingURL=ProcaptchaPoW.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProcaptchaPoW.d.ts","sourceRoot":"","sources":["../../src/components/ProcaptchaPoW.tsx"],"names":[],"mappings":";AAGA,QAAA,MAAM,gBAAgB,0IAA2C,CAAA;AACjE,KAAK,eAAe,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEpE,eAAO,MAAM,aAAa,UAAW,eAAe,qDAInD,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
+ import { ProcaptchaPlaceholder } from '@prosopo/web-components';
3
+ import { Suspense, lazy } from 'react';
4
+ const ProcaptchaWidget = lazy(async () => import('./Captcha.js'));
5
+ export const ProcaptchaPow = (props) => (_jsx(Suspense, { fallback: _jsx(ProcaptchaPlaceholder, { darkMode: props.config.theme }), children: _jsx(ProcaptchaWidget, { config: props.config, callbacks: props.callbacks }) }));
6
+ //# sourceMappingURL=ProcaptchaPoW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProcaptchaPoW.js","sourceRoot":"","sources":["../../src/components/ProcaptchaPoW.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAA;AAGjE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAsB,EAAE,EAAE,CAAC,CACrD,KAAC,QAAQ,IAAC,QAAQ,EAAE,KAAC,qBAAqB,IAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,GAAI,YACvE,KAAC,gBAAgB,IAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,GAAqB,GAChF,CACd,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from './components/Captcha.js';
2
+ export * from './components/ProcaptchaPoW.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,+BAA+B,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from './components/Captcha.js';
2
+ export * from './components/ProcaptchaPoW.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,+BAA+B,CAAA"}
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@prosopo/procaptcha-pow",
3
+ "version": "0.3.1",
4
+ "author": "PROSOPO LIMITED <info@prosopo.io>",
5
+ "license": "Apache-2.0",
6
+ "main": "./dist/index.js",
7
+ "type": "module",
8
+ "sideEffects": false,
9
+ "engines": {
10
+ "node": ">=18",
11
+ "npm": ">=9"
12
+ },
13
+ "exports": {
14
+ ".": {
15
+ "import": "./dist/index.js",
16
+ "require": "./dist/cjs/index.cjs"
17
+ }
18
+ },
19
+ "types": "./dist/index.d.ts",
20
+ "source": "./src/index.ts",
21
+ "scripts": {
22
+ "clean": "tsc --build --clean",
23
+ "build": "tsc --build --verbose tsconfig.json",
24
+ "build:cjs": "npx vite --config vite.cjs.config.ts build",
25
+ "eslint": "npx eslint . --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore",
26
+ "eslint:fix": "npm run eslint -- --fix",
27
+ "prettier": "npx prettier . --check --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore",
28
+ "prettier:fix": "npm run prettier -- --write",
29
+ "lint": "npm run eslint && npm run prettier",
30
+ "lint:fix": "npm run eslint:fix && npm run prettier:fix"
31
+ },
32
+ "browserslist": [
33
+ "> 0.5%, last 2 versions, not dead"
34
+ ],
35
+ "dependencies": {
36
+ "@emotion/react": "^11.11.1",
37
+ "@emotion/styled": "^11.11.0",
38
+ "@noble/hashes": "^1.3.3",
39
+ "@polkadot/extension-inject": "0.46.6",
40
+ "@prosopo/account": "0.3.1",
41
+ "@prosopo/api": "0.3.1",
42
+ "@prosopo/common": "0.3.1",
43
+ "@prosopo/procaptcha": "0.3.1",
44
+ "@prosopo/types": "0.3.1",
45
+ "@prosopo/util": "0.3.1",
46
+ "@prosopo/web-components": "0.3.1",
47
+ "react": "^18.2.0"
48
+ },
49
+ "devDependencies": {
50
+ "tslib": "2.6.2",
51
+ "typescript": "5.1.6"
52
+ },
53
+ "repository": {
54
+ "type": "git",
55
+ "url": "git+https://github.com/prosopo/captcha.git"
56
+ },
57
+ "bugs": {
58
+ "url": "https://github.com/prosopo/captcha/issues"
59
+ },
60
+ "homepage": "https://github.com/prosopo/captcha#readme",
61
+ "description": "",
62
+ "publishConfig": {
63
+ "registry": "https://registry.npmjs.org"
64
+ }
65
+ }
@@ -0,0 +1,6 @@
1
+ import { ViteCommonJSConfig } from '@prosopo/config'
2
+ import path from 'path'
3
+
4
+ export default function () {
5
+ return ViteCommonJSConfig('procaptcha-pow', path.resolve('./tsconfig.cjs.json'))
6
+ }