diff --git a/.github/actions/make-constants-doc/action.yml b/.github/actions/make-constants-doc/action.yml new file mode 100644 index 000000000..9ec3ec0f4 --- /dev/null +++ b/.github/actions/make-constants-doc/action.yml @@ -0,0 +1,27 @@ +name: Make constants documentation +description: Regenerate and commit the beta constants reference + +inputs: + source_file: + description: PHP class containing documented configuration constants + required: false + default: lib/Cleantalk/ApbctWP/Constant.php + output_file: + description: Generated Markdown reference + required: false + default: docs/CONSTANT.MD + target_branch: + description: Branch to push the documentation commit to + required: false + default: beta + +runs: + using: composite + steps: + - name: Rebuild constants reference + shell: bash + run: bash "${{ github.action_path }}/entrypoint.sh" + env: + INPUT_SOURCE_FILE: ${{ inputs.source_file }} + INPUT_OUTPUT_FILE: ${{ inputs.output_file }} + INPUT_TARGET_BRANCH: ${{ inputs.target_branch }} diff --git a/.github/actions/make-constants-doc/entrypoint.sh b/.github/actions/make-constants-doc/entrypoint.sh new file mode 100644 index 000000000..6c42afd38 --- /dev/null +++ b/.github/actions/make-constants-doc/entrypoint.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +set -Eeuo pipefail +trap 'echo "::error::Command failed on line ${LINENO}: ${BASH_COMMAND}"' ERR + +SOURCE_FILE="${INPUT_SOURCE_FILE:-lib/Cleantalk/ApbctWP/Constant.php}" +OUTPUT_FILE="${INPUT_OUTPUT_FILE:-docs/CONSTANT.MD}" +TARGET_BRANCH="${INPUT_TARGET_BRANCH:-beta}" +SCRIPT_DIR="${GITHUB_ACTION_PATH:-$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)}" + +generate_document() { + python3 "$SCRIPT_DIR/generate.py" --source "$SOURCE_FILE" --output "$OUTPUT_FILE" +} + +# Returns 1 when the generated reference has no changes. +# Errors must exit explicitly: errexit is suspended when called from an `if` condition. +commit_document() { + generate_document || exit 1 + git add -- "$OUTPUT_FILE" || exit 1 + if git diff --cached --quiet -- "$OUTPUT_FILE"; then + return 1 + fi + git commit --only -m 'docs: update constants reference [skip ci]' -- "$OUTPUT_FILE" || exit 1 +} + +git config user.name 'github-actions[bot]' +git config user.email 'github-actions[bot]@users.noreply.github.com' + +if ! commit_document; then + echo "Constants reference is up to date." + exit 0 +fi + +for attempt in 1 2 3; do + if git push origin "HEAD:${TARGET_BRANCH}"; then + exit 0 + fi + if [ "$attempt" -eq 3 ]; then + echo "::error::Could not push constants reference to ${TARGET_BRANCH}." + exit 1 + fi + git fetch origin "$TARGET_BRANCH" + # Rebuild on top of the fresh branch instead of rebasing a stale generated commit. + git reset --hard "origin/${TARGET_BRANCH}" + if ! commit_document; then + echo "Constants reference is up to date." + exit 0 + fi +done diff --git a/.github/actions/make-constants-doc/generate.py b/.github/actions/make-constants-doc/generate.py new file mode 100644 index 000000000..eba46eb9c --- /dev/null +++ b/.github/actions/make-constants-doc/generate.py @@ -0,0 +1,134 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import argparse +import os +import re +from dataclasses import dataclass +from pathlib import Path + + +DECLARATION_RE = re.compile( + r'^\s*(?:(?:public|protected|private|final)\s+)*const\s+(\w+)\s*=', + re.MULTILINE, +) +DOCUMENTED_CONSTANT_RE = re.compile( + r'/\*\*(?P(?:(?!\*/).)*)\*/\s*' + r'(?:(?:public|protected|private|final)\s+)*' + r"const\s+(?P\w+)\s*=\s*['\"](?P\w+)['\"]\s*;", + re.DOTALL, +) + + +@dataclass +class Constant: + name: str + value: str + description: str + type_name: str + deprecated: str | None + line: int + + +def parse_constants(source: str) -> list[Constant]: + constants: list[Constant] = [] + for match in DOCUMENTED_CONSTANT_RE.finditer(source): + description: list[str] = [] + tags: dict[str, str] = {} + in_tags = False + for raw_line in match['doc'].splitlines(): + line = re.sub(r'^\s*\* ?', '', raw_line).strip() + if line.startswith('@'): + tag, _, value = line.partition(' ') + tags[tag] = value.strip() + in_tags = True + elif not in_tags: + description.append(line) + + constants.append(Constant( + name=match['name'], + value=match['value'], + description='\n'.join(description).strip(), + type_name=tags.get('@var', ''), + deprecated=tags.get('@deprecated'), + line=source.count('\n', 0, match.start('name')) + 1, + )) + + declarations = DECLARATION_RE.findall(source) + names = [constant.name for constant in constants] + if not declarations: + raise ValueError('No class constants found') + if len(names) != len(set(names)): + raise ValueError('Duplicate constant declarations') + missing = set(declarations) - set(names) + if missing: + raise ValueError('Missing docblock or unsupported declaration: ' + ', '.join(sorted(missing))) + + canonical = {constant.name for constant in constants if constant.deprecated is None} + for constant in constants: + if constant.deprecated is not None: + if ( + constant.value not in canonical + or constant.deprecated != 'Use self::' + constant.value + ): + raise ValueError('Invalid deprecated alias: ' + constant.name) + elif ( + constant.value != constant.name + or not constant.description + or not constant.type_name + ): + raise ValueError('Canonical constant needs a description and @var type: ' + constant.name) + return constants + + +def render_document(constants: list[Constant], source_link: str) -> str: + lines = [ + '# CleanTalk Anti-Spam configuration constants', + '', + '', + '', + 'Define configuration constants in `wp-config.php` before WordPress loads the plugin. ' + 'Use the global names below, not the class constants.', + '', + 'Values must match the documented PHP types. The registry ignores values of the wrong type. ' + 'When both a current name and a deprecated alias are defined, the registry prefers the current name. ' + 'Direct legacy reads are noted in the descriptions.', + '', + ] + for constant in constants: + if constant.deprecated is not None: + continue + aliases = [alias.name for alias in constants if alias.deprecated is not None and alias.value == constant.name] + lines.extend([ + '## `' + constant.name + '`', + '', + constant.description, + '', + '- **Type:** `' + constant.type_name + '`.', + f'- **Declaration:** [Constant.php:{constant.line}]({source_link}#L{constant.line}).', + '- **Deprecated names:** ' + (', '.join('`' + alias + '`' for alias in aliases) if aliases else 'none') + '.', + '', + ]) + return '\n'.join(lines) + + +def main() -> int: + parser = argparse.ArgumentParser(description='Build the constants reference from PHP docblocks.') + parser.add_argument('--source', required=True, type=Path) + parser.add_argument('--output', required=True, type=Path) + args = parser.parse_args() + + try: + constants = parse_constants(args.source.read_text(encoding='utf-8')) + source_link = Path(os.path.relpath(args.source.resolve(), args.output.parent.resolve())).as_posix() + document = render_document(constants, source_link) + args.output.parent.mkdir(parents=True, exist_ok=True) + with args.output.open('w', encoding='utf-8', newline='\n') as output: + output.write(document) + except (OSError, ValueError) as error: + parser.error(str(error)) + return 0 + + +if __name__ == '__main__': + raise SystemExit(main()) diff --git a/.github/actions/make-constants-doc/test_generate.py b/.github/actions/make-constants-doc/test_generate.py new file mode 100644 index 000000000..015a0ae94 --- /dev/null +++ b/.github/actions/make-constants-doc/test_generate.py @@ -0,0 +1,207 @@ +from __future__ import annotations + +import os +import shutil +import subprocess +import sys +import tempfile +import unittest +from pathlib import Path + +from generate import parse_constants, render_document + + +SOURCE = """ None: + """Verify that Markdown includes the docblock text, type, legacy alias and declaration link.""" + constants = parse_constants(SOURCE) + document = render_document(constants, '../Constant.php') + self.assertIn('Enable the example feature.\nFalse disables it.', document) + self.assertIn('**Type:** `bool`', document) + self.assertIn('**Deprecated names:** `OLD_NAME`', document) + self.assertIn('(../Constant.php#L10)', document) + self.assertEqual(document.count('## `'), 1) + + def test_description_change_is_reflected_without_changing_the_generator(self) -> None: + """Verify that editing a source description replaces its previous text in Markdown.""" + changed = SOURCE.replace('Enable the example feature.', 'Use the updated behavior.') + document = render_document(parse_constants(changed), 'Constant.php') + self.assertIn('Use the updated behavior.', document) + self.assertNotIn('Enable the example feature.', document) + + def test_new_and_removed_constants_are_reflected(self) -> None: + """Verify that regeneration includes new constants and removes deleted constants and aliases.""" + changed = SOURCE + """ +/** + * A new configuration parameter. + * + * @var int + */ +const NEW_NAME = 'NEW_NAME'; +""" + document = render_document(parse_constants(changed), 'Constant.php') + self.assertIn('## `NEW_NAME`', document) + self.assertIn('**Type:** `int`', document) + new_only = changed[changed.index('/**\n * A new'):] + document = render_document(parse_constants(new_only), 'Constant.php') + self.assertNotIn('CURRENT_NAME', document) + self.assertNotIn('OLD_NAME', document) + + def test_multiline_public_declaration_and_crlf(self) -> None: + """Verify parsing of public constants with multiline assignments and Windows line endings.""" + changed = SOURCE.replace( + "const CURRENT_NAME = 'CURRENT_NAME';", + 'public const CURRENT_NAME =\n "CURRENT_NAME";', + ).replace('\n', '\r\n') + self.assertEqual(parse_constants(changed)[0].name, 'CURRENT_NAME') + + def test_incomplete_or_invalid_source_fails_explicitly(self) -> None: + """Verify that missing metadata, invalid aliases and unsupported declarations raise ValueError.""" + invalid_sources = [ + '', + SOURCE.replace(' * @var bool\n', ''), + SOURCE.replace(' /**', ' /*', 1), + SOURCE.replace('Use self::CURRENT_NAME', 'Use self::MISSING_NAME'), + SOURCE.replace("const CURRENT_NAME = 'CURRENT_NAME';", "const CURRENT_NAME = 'OTHER';"), + SOURCE + "\nconst UNDOCUMENTED = 'UNDOCUMENTED';\n", + SOURCE + "\n/** Unsupported value. */\nconst NUMBER = 1;\n", + ] + for source in invalid_sources: + with self.subTest(source=source): + with self.assertRaises(ValueError): + parse_constants(source) + + def test_cli_regenerates_the_document_outside_a_git_repository(self) -> None: + """Verify deterministic CLI output and description updates without requiring a Git repository.""" + script = Path(__file__).with_name('generate.py') + with tempfile.TemporaryDirectory() as directory: + root = Path(directory) + source = root / 'Constant.php' + output = root / 'docs' / 'CONSTANT.MD' + source.write_text(SOURCE, encoding='utf-8') + command = [ + sys.executable, str(script), + '--source', str(source), '--output', str(output), + ] + subprocess.run(command, cwd=root, check=True, capture_output=True, text=True) + first = output.read_bytes() + subprocess.run(command, cwd=root, check=True, capture_output=True, text=True) + self.assertEqual(first, output.read_bytes()) + self.assertNotIn(b'\r', first) + source.write_text(SOURCE.replace('Enable the example feature.', 'New description.'), encoding='utf-8') + subprocess.run(command, cwd=root, check=True, capture_output=True, text=True) + self.assertIn('New description.', output.read_text(encoding='utf-8')) + self.assertNotIn('Enable the example feature.', output.read_text(encoding='utf-8')) + self.assertIn('(../Constant.php#L10)', output.read_text(encoding='utf-8')) + + def test_invalid_source_does_not_overwrite_the_document(self) -> None: + """Verify that invalid CLI input reports an error without replacing existing documentation.""" + script = Path(__file__).with_name('generate.py') + with tempfile.TemporaryDirectory() as directory: + root = Path(directory) + source = root / 'Constant.php' + output = root / 'CONSTANT.MD' + source.write_text(' None: + """Verify commits, pushes and no-change handling using temporary local Git repositories only.""" + bash = shutil.which('bash') + if bash is None and os.name == 'nt': + git = shutil.which('git') + if git: + candidate = Path(git).parent.parent / 'bin' / 'bash.exe' + if candidate.is_file(): + bash = str(candidate) + if bash is None or shutil.which('git') is None: + self.skipTest('Git and Bash are required for the action integration test') + + with tempfile.TemporaryDirectory() as directory: + root = Path(directory) + work = root / 'work' + work.mkdir() + remote = root / 'origin.git' + env = dict(os.environ) + env['GIT_CONFIG_GLOBAL'] = os.devnull + env['GIT_CONFIG_NOSYSTEM'] = '1' + env['GITHUB_ACTION_PATH'] = Path(__file__).parent.as_posix() + env['PYTHON_FOR_TESTS'] = Path(sys.executable).as_posix() + for name in ('INPUT_SOURCE_FILE', 'INPUT_OUTPUT_FILE', 'INPUT_TARGET_BRANCH'): + env.pop(name, None) + + def git_command(*args: str) -> str: + return subprocess.run( + ['git', *args], cwd=work, env=env, + check=True, capture_output=True, text=True, + ).stdout.strip() + + git_command('init', '--bare', str(remote)) + git_command('init', '-b', 'beta') + git_command('config', 'user.name', 'Fixture') + git_command('config', 'user.email', 'fixture@example.com') + source = work / 'lib' / 'Cleantalk' / 'ApbctWP' / 'Constant.php' + source.parent.mkdir(parents=True) + source.write_text(SOURCE, encoding='utf-8') + git_command('add', '.') + message = 'Fixture\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>' + git_command('commit', '-m', message) + git_command('remote', 'add', 'origin', str(remote)) + git_command('push', '-u', 'origin', 'beta') + + def run_action() -> str: + result = subprocess.run( + [bash, '-c', 'python3() { "$PYTHON_FOR_TESTS" "$@"; }; ' + 'export -f python3; bash "$GITHUB_ACTION_PATH/entrypoint.sh"'], + cwd=work, env=env, capture_output=True, text=True, + ) + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + return result.stdout + + run_action() + head = git_command('rev-parse', 'HEAD') + self.assertEqual(git_command('--git-dir', str(remote), 'rev-parse', 'beta'), head) + self.assertIn('[skip ci]', git_command('log', '-1', '--format=%s')) + self.assertIn('Enable the example feature.', git_command('show', 'HEAD:docs/CONSTANT.MD')) + self.assertEqual(git_command('status', '--porcelain'), '') + self.assertIn('up to date', run_action()) + self.assertEqual(git_command('rev-parse', 'HEAD'), head) + + source.write_text(SOURCE.replace('Enable the example feature.', 'Updated from source.'), encoding='utf-8') + git_command('add', '.') + git_command('commit', '-m', message) + git_command('push', 'origin', 'beta') + run_action() + document = git_command('--git-dir', str(remote), 'show', 'beta:docs/CONSTANT.MD') + self.assertIn('Updated from source.', document) + self.assertNotIn('Enable the example feature.', document) + + +if __name__ == '__main__': + unittest.main() diff --git a/.github/instructions/skip-tests.instructions.md b/.github/instructions/skip-tests.instructions.md new file mode 100644 index 000000000..92490ba0c --- /dev/null +++ b/.github/instructions/skip-tests.instructions.md @@ -0,0 +1,8 @@ +--- +applyTo: "**/tests/**" +excludeAgent: "cloud-agent" +--- + +Do not review or leave comments on files in tests directories. +These are unit tests; skip them entirely during code review: no style +remarks, no suggestions about test structure, naming, mocks or coverage. diff --git a/.github/workflows/make_asset_beta_and_changelog.yml b/.github/workflows/make_asset_beta_and_changelog.yml index 5a0363a30..31673c3f9 100644 --- a/.github/workflows/make_asset_beta_and_changelog.yml +++ b/.github/workflows/make_asset_beta_and_changelog.yml @@ -12,9 +12,13 @@ env: PLUGIN_NAME: cleantalk-spam-protect jobs: - make-changelog: + # Both generators share one job so a replaced pending run cannot skip either of them. + make-generated-files: if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }} runs-on: ubuntu-latest + concurrency: + group: beta-generated-files + cancel-in-progress: false steps: - name: Checkout repository @@ -23,6 +27,11 @@ jobs: ref: beta fetch-depth: 0 + - name: Configure Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Build changelog files uses: ./.github/actions/make-changelog with: @@ -38,9 +47,15 @@ jobs: matrix_room: ${{ secrets.MATRIX_GITHUB_WORKFLOW_FEED }} matrix_token: ${{ secrets.MATRIX_USER_TOKEN }} + - name: Test constants generator + run: python3 -B -m unittest discover -s .github/actions/make-constants-doc -p test_generate.py -v + + - name: Build constants reference + uses: ./.github/actions/make-constants-doc + build-release-zip: - needs: make-changelog - if: ${{ !cancelled() && !contains(github.event.head_commit.message, '[skip ci]') }} + needs: make-generated-files + if: ${{ success() && !contains(github.event.head_commit.message, '[skip ci]') }} runs-on: ubuntu-latest steps: diff --git a/README.md b/README.md index e0750ee99..25718d7e8 100644 --- a/README.md +++ b/README.md @@ -524,6 +524,9 @@ https://cleantalk.org/faq#feedback_spam = Is the plugin fast? = We develop plugin to do it as optimized as possible, CleanTalk doesn't downgrade response time in backend or frontend. The plugin proccess only POST requests to WordPress core, it tackes less than 1 second to return results. += Configuration constants = +For supported values and deprecated names, see the [constants reference](docs/CONSTANT.MD). + = Related open-source projects by CleanTalk = Not on WordPress, or need bot filtering in your own PHP code? See our libraries on GitHub: php-anticrawler - blocks scrapers, SEO crawlers and bad bots by User-Agent, IP block lists and allow lists, no captcha for real visitors. diff --git a/changelog.txt b/changelog.txt index 866aba6d4..d2645126e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,23 @@ == Changelog == += 6.91 27.10.2026 = +* Fix. Settings. Improve hide function. +* Fix. SFW. AC/AF pass cookie value fixed. (#917) +* Upd. Firewall. Improve fw check. +* Fix. Settings. Getting brief fixed. (#914) +* Fix.code.improve statement (#912) +* Upd. Code. Editing token validation for ipv6 +* Upd. Code. Editing the definition of an authorized user +* Fix. Code. Set cookie expires attribute fixed. +* Fix. Anti Flood. Passed cookie fixed. (#910) +* Fix. Integration. Brevo (Sendinblue) integration fixed. (#911) +* Fix. Cookies. Sync event token on refresh events. +* Fix. Alt Sessions. Removed duplicated request. +* Fix. Contact Encoder. Fixed mobile layout. +* Upd. Cleantalk.php. Rotate moderate. Now use CURLOPT_RESOLVE for IP instead of converting IP as string if IP is used as fallback. (#894) +* New. Integration. LeakyPaywall plugin. +* Fix. Code. Fix getID multi sign. + = 6.90 13.10.2026 = * Fix. Comments checker. Feedback success message fixed. (#907) * Fix. Force protection. Checking bot detector fixed. diff --git a/cleantalk.php b/cleantalk.php index 256c45410..d1a8ef6f8 100644 --- a/cleantalk.php +++ b/cleantalk.php @@ -4,7 +4,7 @@ Plugin Name: Anti-Spam by CleanTalk Plugin URI: https://cleantalk.org Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms. - Version: 6.90 + Version: 6.91 Author: CleanTalk - Anti-Spam Protection Author URI: https://cleantalk.org Text Domain: cleantalk-spam-protect @@ -624,6 +624,11 @@ function apbct_write_js_errors($data) ); }); +// Emergency firewall bypass: the control panel posts a signed token to admin-post.php. +// SpamFireWall checks only GET requests on the public side, so this POST is never blocked by it. +add_action('admin_post_nopriv_' . FirewallBypass::JWT_ACTION, array(FirewallBypass::class, 'handleJwtRequest')); +add_action('admin_post_' . FirewallBypass::JWT_ACTION, array(FirewallBypass::class, 'handleJwtRequest')); + // Public actions if ( ! is_admin() && ! apbct_is_ajax() && ! apbct_is_customize_preview() ) { $sci = new CleantalkScriptsIntegrator(); @@ -704,6 +709,9 @@ function apbct_wpms__delete_blog(WP_Site $old_site) // After plugin loaded - to load locale as described in manual add_action('init', 'apbct_plugin_loaded'); +// Extract and clear browser state data from POST +add_action('plugins_loaded', array(BotDetectorService::class, 'extractBrowserStateFromPOST'), 0); + // SiteGround Speed Optimizer: skip cache for URLs with apbct_no_cache. add_action('plugins_loaded', 'apbct_sgo_optimizer__register_bypass_query_params', 1); @@ -777,14 +785,17 @@ function apbct_wpms__delete_blog(WP_Site $old_site) // if User is not logged in // if Unknown action or Known action with mandatory check if ( - ( ! apbct_is_user_logged_in() || $apbct->settings['data__protect_logged_in'] == 1) && Post::get('action') !== '' && ( ! in_array(Post::get('action'), $_cleantalk_hooked_actions) || in_array(Post::get('action'), $_cleantalk_ajax_actions_to_check) ) ) { - add_action('plugins_loaded', 'ct_ajax_hook'); + add_action('plugins_loaded', function () use ($apbct) { + if ( ! apbct_is_user_logged_in() || $apbct->settings['data__protect_logged_in'] == 1 ) { + ct_ajax_hook(); + } + }); } //QAEngine Theme answers @@ -913,7 +924,12 @@ function apbct_sfw__check() ); Cookie::set( 'ct_sfw_pass_key', - md5(Server::get('REMOTE_ADDR') . $apbct->api_key . $apbct->data['salt']), + SFW::makePassKey( + TT::toString(Server::get('REMOTE_ADDR')), + TT::toString($apbct->api_key), + TT::toString($apbct->data['salt']), + '0' + ), time() + 1200, '/', '' @@ -1001,7 +1017,6 @@ function apbct_sfw__check() APBCT_TBL_FIREWALL_LOG, APBCT_TBL_AC_LOG, array( - 'api_key' => $apbct->api_key, 'view_limit' => $apbct->settings['sfw__anti_flood__view_limit'], 'apbct' => $apbct, ) diff --git a/css/cleantalk-email-decoder.min.css b/css/cleantalk-email-decoder.min.css index 8cae5bc44..43eb1a7ca 100644 --- a/css/cleantalk-email-decoder.min.css +++ b/css/cleantalk-email-decoder.min.css @@ -1 +1 @@ -.apbct-email-encoder-popup{width:30vw;min-width:400px;font-size:16px}.apbct-email-encoder--popup-header{font-size:16px;color:#333}.apbct-email-encoder-elements_center{display:flex;flex-direction:column;justify-content:center;align-items:center;font-size:16px!important;color:#000!important}.top-margin-long{margin-top:5px}.apbct-tooltip{display:none}.apbct-email-encoder{position:relative}.apbct-blur{filter:blur(5px);transition:filter 2s}.apbct-email-encoder.no-blur .apbct-blur{filter:none}.apbct-email-encoder-select-whole-email{-webkit-user-select:all;user-select:all}.apbct-email-encoder-got-it-button{all:unset;margin-top:10px;padding:5px 10px;border-radius:5px;background-color:#333;color:#fff;cursor:pointer;transition:background-color .3s}.apbct-ee-animation-wrapper{display:flex;height:60px;justify-content:center;font-size:16px;align-items:center}.apbct_dog{margin:0 5px;color:transparent;text-shadow:0 0 2px #aaa}.apbct_dog_one{animation-duration:1.5s;animation-iteration-count:infinite;animation-delay:0s;animation-name:apbct_dog}.apbct_dog_two{animation-duration:1.5s;animation-iteration-count:infinite;animation-delay:.5s;animation-name:apbct_dog}.apbct_dog_three{animation-duration:1.5s;animation-iteration-count:infinite;animation-delay:1s;animation-name:apbct_dog}@keyframes apbct_dog{0%{scale:100%;color:transparent;text-shadow:0 0 2px #aaa}25%{scale:200%;color:unset;text-shadow:unset}75%{scale:100%;color:transparent;text-shadow:0 0 2px #aaa}100%{scale:100%;color:transparent;text-shadow:0 0 2px #aaa}}.apbct-email-encoder--settings_example_encoded{position:relative}@media screen and (max-width:782px){.apbct-email-encoder--settings_example_encoded{position:relative;display:block}.apbct-email-encoder-popup{width:20vw;min-width:200px;font-size:16px;top:20%;left:75%}.apbct-email-encoder-elements_center{flex-direction:column!important;text-align:center}} \ No newline at end of file +.apbct-popup.apbct-email-encoder-popup{position:fixed;top:50%;left:50%;margin-left:0;transform:translate(-50%,-50%);width:30vw;min-width:400px;font-size:16px}.apbct-email-encoder-popup__close{position:absolute;top:12px;right:12px;display:none;width:12px;height:12px;border:0;padding:0;border-radius:50%;background:#f3f4f6;color:#4b5563;font-size:22px;font-weight:600;line-height:1;cursor:pointer;align-items:center;justify-content:center;transition:background-color .2s ease,color .2s ease}.apbct-email-encoder-popup__close:hover{background:#e5e7eb;color:#111827}.apbct-email-encoder-popup__close--visible{display:inline-flex}.apbct-email-encoder--popup-header{font-size:16px;color:#333}.apbct-email-encoder-elements_center{display:flex;flex-direction:column;justify-content:center;align-items:center;font-size:16px!important;color:#000!important}.top-margin-long{margin-top:5px}.apbct-tooltip{display:none}.apbct-email-encoder{position:relative}.apbct-blur{filter:blur(5px);transition:filter 2s}.apbct-email-encoder.no-blur .apbct-blur{filter:none}.apbct-email-encoder-select-whole-email{-webkit-user-select:all;user-select:all}.apbct-email-encoder-got-it-button{all:unset;margin-top:10px;padding:5px 10px;border-radius:5px;background-color:#333;color:#fff;cursor:pointer;transition:background-color .3s}.apbct-ee-animation-wrapper{display:flex;height:60px;justify-content:center;font-size:16px;align-items:center}.apbct_dog{margin:0 5px;color:transparent;text-shadow:0 0 2px #aaa}.apbct_dog_one{animation-duration:1.5s;animation-iteration-count:infinite;animation-delay:0s;animation-name:apbct_dog}.apbct_dog_two{animation-duration:1.5s;animation-iteration-count:infinite;animation-delay:.5s;animation-name:apbct_dog}.apbct_dog_three{animation-duration:1.5s;animation-iteration-count:infinite;animation-delay:1s;animation-name:apbct_dog}@keyframes apbct_dog{0%{scale:100%;color:transparent;text-shadow:0 0 2px #aaa}25%{scale:200%;color:unset;text-shadow:unset}75%{scale:100%;color:transparent;text-shadow:0 0 2px #aaa}100%{scale:100%;color:transparent;text-shadow:0 0 2px #aaa}}.apbct-email-encoder--settings_example_encoded{position:relative}@media screen and (max-width:782px){.apbct-email-encoder--settings_example_encoded{position:relative;display:block}.apbct-popup.apbct-email-encoder-popup{width:calc(90vw - 32px);min-width:200px;max-width:360px}.apbct-email-encoder-elements_center{flex-direction:column!important;text-align:center}} \ No newline at end of file diff --git a/css/src/cleantalk-email-decoder.css b/css/src/cleantalk-email-decoder.css index 8f8a1c379..54b54104f 100644 --- a/css/src/cleantalk-email-decoder.css +++ b/css/src/cleantalk-email-decoder.css @@ -1,8 +1,40 @@ -.apbct-email-encoder-popup { +.apbct-popup.apbct-email-encoder-popup { + position: fixed; + top: 50%; + left: 50%; + margin-left: 0; + transform: translate(-50%, -50%); width: 30vw; min-width: 400px; font-size: 16px; } +.apbct-email-encoder-popup__close { + position: absolute; + top: 12px; + right: 12px; + display: none; + width: 12px; + height: 12px; + border: 0; + padding: 0; + border-radius: 50%; + background: #f3f4f6; + color: #4b5563; + font-size: 22px; + font-weight: 600; + line-height: 1; + cursor: pointer; + align-items: center; + justify-content: center; + transition: background-color 0.2s ease, color 0.2s ease; +} +.apbct-email-encoder-popup__close:hover { + background: #e5e7eb; + color: #111827; +} +.apbct-email-encoder-popup__close--visible { + display: inline-flex; +} .apbct-email-encoder--popup-header { font-size: 16px; color: #333; @@ -116,12 +148,10 @@ display: block; } - .apbct-email-encoder-popup { - width: 20vw; + .apbct-popup.apbct-email-encoder-popup { + width: calc(90vw - 32px); min-width: 200px; - font-size: 16px; - top: 20%; - left: 75%; + max-width: 360px; } .apbct-email-encoder-elements_center { @@ -129,7 +159,3 @@ text-align: center; } } - - - - diff --git a/docs/CONSTANT.MD b/docs/CONSTANT.MD new file mode 100644 index 000000000..19f38a457 --- /dev/null +++ b/docs/CONSTANT.MD @@ -0,0 +1,165 @@ +# CleanTalk Anti-Spam configuration constants + + + +Define configuration constants in `wp-config.php` before WordPress loads the plugin. Use the global names below, not the class constants. + +Values must match the documented PHP types. The registry ignores values of the wrong type. When both a current name and a deprecated alias are defined, the registry prefers the current name. Direct legacy reads are noted in the descriptions. + +## `APBCT_SERVICE__DISABLE_EMPTY_EMAIL_EXCEPTION` + +Disable the exception that skips POST data checks when no email address is found. +Defining either true or false activates this behavior. The "Check all POST data" +setting takes precedence. Without this constant, normal exception handling applies. + +- **Type:** `bool`. +- **Declaration:** [Constant.php:27](../lib/Cleantalk/ApbctWP/Constant.php#L27). +- **Deprecated names:** none. + +## `APBCT_SERVICE__SKIP_ANTICRAWLER_ON_RSS_FEED` + +Skip Anti-Crawler checks for requests whose URI contains "feed". +Defining either true or false enables this additional RSS exception. +Without this constant, the normal Anti-Crawler exclusions apply. + +- **Type:** `bool`. +- **Declaration:** [Constant.php:36](../lib/Cleantalk/ApbctWP/Constant.php#L36). +- **Deprecated names:** `APBCT_ANTICRAWLER_EXLC_FEED`. + +## `APBCT_SERVICE__SET_AJAX_ROUTE_TYPE` + +Force the AJAX route to 'rest' or 'admin_ajax'. +Other strings leave automatic route selection unchanged. + +- **Type:** `string`. +- **Declaration:** [Constant.php:50](../lib/Cleantalk/ApbctWP/Constant.php#L50). +- **Deprecated names:** `APBCT_SET_AJAX_ROUTE_TYPE`. + +## `APBCT_SERVICE__SELF_OWNED_ACCESS_KEY` + +Supply a site-owned access key and override the key field in the settings. +Any string is accepted by the registry, including an empty string; use a valid key. +Its presence also affects database-prefix selection. The network updater still +reads only the deprecated CLEANTALK_ACCESS_KEY name directly. + +- **Type:** `string`. +- **Declaration:** [Constant.php:66](../lib/Cleantalk/ApbctWP/Constant.php#L66). +- **Deprecated names:** `CLEANTALK_ACCESS_KEY`. + +## `APBCT_SERVICE__BOT_DETECTOR_ENABLED` + +Force Bot Detector on with true or off with false. +Without this constant, the saved Bot Detector settings apply. + +- **Type:** `bool`. +- **Declaration:** [Constant.php:80](../lib/Cleantalk/ApbctWP/Constant.php#L80). +- **Deprecated names:** none. + +## `APBCT_SERVICE__PLACE_PUBLIC_JS_SCRIPTS_IN_FOOTER` + +Place public JavaScript files in the page footer when the value is true. +False or an absent constant leaves normal script placement unchanged. + +- **Type:** `bool`. +- **Declaration:** [Constant.php:88](../lib/Cleantalk/ApbctWP/Constant.php#L88). +- **Deprecated names:** `CLEANTALK_PLACE_PUBLIC_JS_SCRIPTS_IN_FOOTER`. + +## `APBCT_SERVICE__WHITELABEL_FAQ_LINK` + +Override the white-label FAQ link with a string, sanitized using esc_url. +Without this constant, the existing FAQ link is retained. + +- **Type:** `string`. +- **Declaration:** [Constant.php:102](../lib/Cleantalk/ApbctWP/Constant.php#L102). +- **Deprecated names:** `APBCT_WHITELABEL_FAQ_LINK`. + +## `APBCT_SERVICE__WHITELABEL_PLUGIN_DESCRIPTION` + +Override the white-label plugin description with a string, escaped using esc_html. +Without this constant, the existing description is retained. + +- **Type:** `string`. +- **Declaration:** [Constant.php:116](../lib/Cleantalk/ApbctWP/Constant.php#L116). +- **Deprecated names:** `APBCT_WHITELABEL_PLUGIN_DESCRIPTION`. + +## `APBCT_SERVICE__WHITELABEL_ENABLED` + +Register the white-label mode switch. +The network updater currently reads only APBCT_WHITELABEL directly: +true enables the mode and false disables it. Defining the current name alone +does not activate that legacy code path. + +- **Type:** `bool`. +- **Declaration:** [Constant.php:132](../lib/Cleantalk/ApbctWP/Constant.php#L132). +- **Deprecated names:** `APBCT_WHITELABEL`. + +## `APBCT_SERVICE__WHITELABEL_PRODUCT_NAME` + +Register a custom white-label product name. +The network updater currently reads only APBCT_WHITELABEL_NAME directly, +when APBCT_WHITELABEL is defined. The current name alone does not change +the product name in that legacy code path. + +- **Type:** `string`. +- **Declaration:** [Constant.php:148](../lib/Cleantalk/ApbctWP/Constant.php#L148). +- **Deprecated names:** `APBCT_WHITELABEL_NAME`. + +## `APBCT_SERVICE__SFW_FORCE_DIRECT_UPDATE` + +Force direct SFW updates instead of the update queue. +Defining either true or false activates this behavior. +Useful when remote calls fail; remove the definition to restore automatic selection. + +- **Type:** `bool`. +- **Declaration:** [Constant.php:163](../lib/Cleantalk/ApbctWP/Constant.php#L163). +- **Deprecated names:** `APBCT_SFW_FORCE_DIRECT_UPDATE`. + +## `APBCT_SERVICE__DISABLE_BLOCKING_TITLE` + +Hide the CleanTalk title on blocking pages and rejected-comment messages with true. +False or an absent constant preserves the title. + +- **Type:** `bool`. +- **Declaration:** [Constant.php:177](../lib/Cleantalk/ApbctWP/Constant.php#L177). +- **Deprecated names:** `CLEANTALK_DISABLE_BLOCKING_TITLE`. + +## `APBCT_SERVICE__SKIP_ON_APPROVED_COMMENTS_NUMBER` + +Set the approved-comment count required to skip checking an author's comments, +when the corresponding comment-checking setting is enabled. +The default is 3. The registry checks the integer type but not its range. + +- **Type:** `int`. +- **Declaration:** [Constant.php:192](../lib/Cleantalk/ApbctWP/Constant.php#L192). +- **Deprecated names:** `CLEANTALK_CHECK_COMMENTS_NUMBER`. + +## `APBCT_SERVICE__DO_NOT_COLLECT_FRONTEND_DATA_LOGS` + +Disable frontend-data log collection for debugging. +Defining either true or false disables collection and sets the frontend log flag to 0. +Without this constant, normal log collection applies. + +- **Type:** `bool`. +- **Declaration:** [Constant.php:207](../lib/Cleantalk/ApbctWP/Constant.php#L207). +- **Deprecated names:** `APBCT_DO_NOT_COLLECT_FRONTEND_DATA_LOGS`. + +## `APBCT_SERVICE__PREDEFINED_CLEANTALK_SERVER_URL` + +Register a custom CleanTalk server domain. +Bootstrap currently reads only CLEANTALK_SERVER directly, building +https://moderate. and, unless CLEANTALK_API_URL is already defined, +https://api.. Use a domain, not a complete URL. +Defining the current name alone does not change those endpoints. + +- **Type:** `string`. +- **Declaration:** [Constant.php:224](../lib/Cleantalk/ApbctWP/Constant.php#L224). +- **Deprecated names:** `CLEANTALK_SERVER`. + +## `APBCT_SERVICE__DISABLE_INTEGRATION_METRICS` + +Disable integration metrics when defined as either true or false. +Remove the definition to allow normal metric collection. + +- **Type:** `bool`. +- **Declaration:** [Constant.php:238](../lib/Cleantalk/ApbctWP/Constant.php#L238). +- **Deprecated names:** none. diff --git a/inc/cleantalk-admin.php b/inc/cleantalk-admin.php index a1a9636c5..af4a96777 100644 --- a/inc/cleantalk-admin.php +++ b/inc/cleantalk-admin.php @@ -152,9 +152,6 @@ function ct_dashboard_statistics_widget_output($_post, $_callback_args) "" ); ?> -
- -

@@ -364,10 +361,8 @@ function apbct_admin__init() } } - // Getting dashboard widget statistics - if ( Post::getInt('ct_brief_refresh') === 1 ) { - cleantalk_get_brief_data($apbct->api_key); - } + // Dashboard widget statistics refresh (authenticated AJAX only) + add_action('wp_ajax_apbct_brief_refresh', 'apbct_brief_refresh'); // Getting Access key like a hoster. Only once! if ( @@ -605,6 +600,8 @@ function apbct_admin__enqueue_scripts($hook) $widget_handler = ApbctEnqueue::getInstance()->js('cleantalk-dashboard-widget.js', array($widget_chart_handler)); wp_localize_script($widget_handler, 'apbctDashboardWidget', array( 'data' => $to_chart, + 'ajax_url' => admin_url('admin-ajax.php'), + 'nonce' => wp_create_nonce(AJAXService::$admin_nonce_id), )); } @@ -1532,6 +1529,17 @@ function apbct__manage_sites_custom_column_action($column_name, $site_id) add_action('manage_sites_custom_column', 'apbct__manage_sites_custom_column_action', 10, 2); +function apbct_brief_refresh() +{ + global $apbct; + + AJAXService::checkNonceRestrictingNonAdmins('security'); + + cleantalk_get_brief_data($apbct->api_key); + + wp_send_json_success(); +} + add_action('wp_ajax_apbct_action_adjust_change', 'apbct_action_adjust_change'); function apbct_action_adjust_change() { diff --git a/inc/cleantalk-common.php b/inc/cleantalk-common.php index 5967935cb..ae84769ab 100644 --- a/inc/cleantalk-common.php +++ b/inc/cleantalk-common.php @@ -263,6 +263,7 @@ function apbct_base_call($params = array(), $reg_flag = false) $config = ct_get_server(); $ct->server_url = APBCT_MODERATE_URL; $ct->work_url = isset($config['ct_work_url']) && preg_match('/https:\/\/.+/', $config['ct_work_url']) ? $config['ct_work_url'] : null; + $ct->work_ip = isset($config['ct_work_ip']) ? $config['ct_work_ip'] : null; $ct->server_ttl = isset($config['ct_server_ttl']) ? $config['ct_server_ttl'] : null; $ct->server_changed = isset($config['ct_server_changed']) ? $config['ct_server_changed'] : null; @@ -285,6 +286,7 @@ function apbct_base_call($params = array(), $reg_flag = false) 'cleantalk_server', array( 'ct_work_url' => $ct->work_url, + 'ct_work_ip' => $ct->work_ip, 'ct_server_ttl' => $ct->server_ttl, 'ct_server_changed' => time(), ) @@ -330,6 +332,7 @@ function apbct_rotate_moderate() 'cleantalk_server', array( 'ct_work_url' => $ct->work_url, + 'ct_work_ip' => $ct->work_ip, 'ct_server_ttl' => $ct->server_ttl, 'ct_server_changed' => time(), ) @@ -972,6 +975,7 @@ function ct_get_server() if ( ! is_array($ct_server) ) { $ct_server = array( 'ct_work_url' => null, + 'ct_work_ip' => null, 'ct_server_ttl' => null, 'ct_server_changed' => null ); @@ -979,6 +983,12 @@ function ct_get_server() $ct_server['ct_work_url'] = Sanitize::sanitizeCleantalkServerUrl(TT::getArrayValueAsString($ct_server, 'ct_work_url')); + // The node is selected by IP, so a stored value must be a usable IPv4 literal. + $stored_ip = TT::getArrayValueAsString($ct_server, 'ct_work_ip'); + $ct_server['ct_work_ip'] = filter_var($stored_ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) + ? $stored_ip + : null; + return $ct_server; } @@ -1078,6 +1088,7 @@ function ct_send_feedback($feedback_request = null) $config = ct_get_server(); $ct->server_url = APBCT_MODERATE_URL; $ct->work_url = isset($config['ct_work_url']) && preg_match('/http:\/\/.+/', $config['ct_work_url']) ? $config['ct_work_url'] : null; + $ct->work_ip = isset($config['ct_work_ip']) ? $config['ct_work_ip'] : null; $ct->server_ttl = isset($config['ct_server_ttl']) ? $config['ct_server_ttl'] : null; $ct->server_changed = isset($config['ct_server_changed']) ? $config['ct_server_changed'] : null; @@ -1092,6 +1103,7 @@ function ct_send_feedback($feedback_request = null) 'cleantalk_server', array( 'ct_work_url' => $ct->work_url, + 'ct_work_ip' => $ct->work_ip, 'ct_server_ttl' => $ct->server_ttl, 'ct_server_changed' => time(), ) diff --git a/inc/cleantalk-integrations-by-route.php b/inc/cleantalk-integrations-by-route.php index 13a82715d..22ab558ca 100644 --- a/inc/cleantalk-integrations-by-route.php +++ b/inc/cleantalk-integrations-by-route.php @@ -26,6 +26,11 @@ 'setting' => 'forms__registrations_test', 'rest' => true, ), + 'LeakyPaywallRegister' => array( + 'rest_route' => '/lp-list-builder/v1/signup', + 'setting' => 'forms__registrations_test', + 'rest' => true, + ), ); add_filter('rest_pre_dispatch', function ($result, $_, $request) use ($apbct_active_rest_integrations) { diff --git a/inc/cleantalk-pluggable.php b/inc/cleantalk-pluggable.php index f1876b3a8..71b5b43aa 100644 --- a/inc/cleantalk-pluggable.php +++ b/inc/cleantalk-pluggable.php @@ -4,6 +4,8 @@ use Cleantalk\ApbctWP\Constant; use Cleantalk\ApbctWP\Helper; use Cleantalk\ApbctWP\RemoteCalls; +use Cleantalk\ApbctWP\Variables\AltSessions; +use Cleantalk\ApbctWP\Variables\Cookie; use Cleantalk\ApbctWP\Variables\Get; use Cleantalk\ApbctWP\Variables\Post; use Cleantalk\ApbctWP\Variables\Request; @@ -82,6 +84,10 @@ function apbct_wp_set_current_user($user = null) */ function apbct_wp_validate_auth_cookie($cookie = '', $scheme = '') { + if ( function_exists('wp_validate_auth_cookie') ) { + return wp_validate_auth_cookie($cookie, $scheme); + } + $cookie_elements = apbct_wp_parse_auth_cookie($cookie, $scheme); if (!is_array($cookie_elements) || empty($cookie_elements)) { @@ -109,17 +115,8 @@ function apbct_wp_validate_auth_cookie($cookie = '', $scheme = '') $algo = function_exists('hash') ? 'sha256' : 'sha1'; $hash = hash_hmac($algo, $username . '|' . $expiration . '|' . $token, $key); if ( hash_equals($hash, $hmac) && is_object($user) ) { - $sessions = get_user_meta($user->ID, 'session_tokens', true); - $sessions = is_array($sessions) ? current($sessions) : $sessions; - if ( is_array($sessions) ) { - if ( isset($sessions['expiration']) && is_int($sessions['expiration']) && $sessions['expiration'] > time() ) { - return $user->ID; - } else { - return false; - } - } else { - return false; - } + // The session of this very token must be active, not just any session of the user. + return WP_Session_Tokens::get_instance($user->ID)->verify($token) ? $user->ID : false; } else { return false; } @@ -412,16 +409,18 @@ function apbct_is_cli() } /** - * Checks if the user is logged in + * Checks WordPress authentication. Before pluggable functions load, no user is trusted. * * @return bool */ function apbct_is_user_logged_in() { - $siteurl = get_site_option('siteurl'); - $cookiehash = $siteurl ? md5($siteurl) : ''; + if ( did_action('set_current_user') && function_exists('is_user_logged_in') ) { + return is_user_logged_in(); + } - return count($_COOKIE) && isset($_COOKIE['wordpress_logged_in_' . $cookiehash]); + // Resolving the current user here would freeze it before themes/plugins add determine_current_user filters. + return function_exists('wp_validate_auth_cookie') && (bool)wp_validate_auth_cookie('', 'logged_in'); } function apbct_is_post() @@ -2297,7 +2296,8 @@ function apbct__is_wordpress_loopback_request() } /** - * Generates MD5 hash for email encoder pass key + * Generates MD5 hash for email encoder pass key. + * The key is public, so it only hints that the visitor may have passed the decoding check. * * @return string */ @@ -2305,7 +2305,33 @@ function apbct_get_email_encoder_pass_key() { global $apbct; - return md5(Helper::ipGet() . $apbct->api_key . 'email_encoder'); + return md5(Helper::ipGet('real', false) . $apbct->api_key . 'email_encoder'); +} + +/** + * Remembers on the server side that the visitor passed the contact decoding check. + * + * @return void + */ +function apbct_email_encoder_set_passed() +{ + AltSessions::set('apbct_email_encoder_verified', '1'); +} + +/** + * Checks whether contacts may be shown without encoding to the visitor who passed the decoding check. + * + * @return bool + */ +function apbct_is_email_encoder_passed() +{ + // Cheap check first, so the sessions storage is queried only for visitors who decoded contacts. + if ( Cookie::get('apbct_email_encoder_passed') !== apbct_get_email_encoder_pass_key() ) { + return false; + } + + // The verified mark is not in the list of values a visitor can set remotely. + return AltSessions::get('apbct_email_encoder_verified') === '1'; } /** diff --git a/inc/cleantalk-public-integrations.php b/inc/cleantalk-public-integrations.php index 3368fc2ba..007fae066 100644 --- a/inc/cleantalk-public-integrations.php +++ b/inc/cleantalk-public-integrations.php @@ -1543,7 +1543,7 @@ function apbct_form__contactForm7__testSpam($spam, $_submission = null) ) { $apbct->sender_email = $sender_email; $apbct->sender_ip = Helper::ipGet(); - add_filter('wpcf7_mail_components', 'apbct_form__contactForm7__changeMailNotification'); + add_filter('wpcf7_mail_components', 'apbct_form__contactForm7__changeMailNotification', 10, 3); } if ( $ct_result->allow == 0 ) { @@ -1604,13 +1604,27 @@ function apbct_form__contactForm7__showResponse($message, $status = 'spam') * Changes email notification for success subscription for Contact Form 7 * * @param array $component Arguments for email notification + * @param object|null $_contact_form WPCF7_ContactForm + * @param object|null $mail WPCF7_Mail * * @return array Arguments for email notification + * @psalm-suppress PossiblyUnusedParam */ -function apbct_form__contactForm7__changeMailNotification($component) +function apbct_form__contactForm7__changeMailNotification($component, $_contact_form = null, $mail = null) { global $apbct; + // Only the main mail goes to the site owner, Mail (2) is an autoresponder to the visitor + if ( is_object($mail) && method_exists($mail, 'name') && $mail->name() !== 'mail' ) { + return $component; + } + if ( + isset($component['recipient']) && + \Cleantalk\ApbctWP\Validate::isEmailInRecipients($component['recipient'], (string)$apbct->sender_email) + ) { + return $component; + } + $original_body = isset($component['body']) ? $component['body'] : ''; $component['body'] = @@ -1621,7 +1635,7 @@ function apbct_form__contactForm7__changeMailNotification($component) . PHP_EOL . sprintf( //HANDLE LINK __('If you want to be sure activate protection in your Anti-Spam Dashboard: %s.', 'clentalk'), - 'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=cf7_activate_antispam&user_token=' . $apbct->user_token + 'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=cf7_activate_antispam' ) . PHP_EOL . '---' . PHP_EOL . PHP_EOL . $original_body; diff --git a/inc/cleantalk-public-validate.php b/inc/cleantalk-public-validate.php index 5cb669792..08e9ce029 100644 --- a/inc/cleantalk-public-validate.php +++ b/inc/cleantalk-public-validate.php @@ -98,7 +98,7 @@ function ct_contact_form_validate() } // Do not execute anti-spam test for logged in users. - if ( defined('LOGGED_IN_COOKIE') && isset($_COOKIE[LOGGED_IN_COOKIE]) && $apbct->settings['data__protect_logged_in'] != 1 ) { + if ( $apbct->settings['data__protect_logged_in'] != 1 && apbct_is_user_logged_in() ) { do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST); return null; @@ -372,8 +372,7 @@ function ct_contact_form_validate() ); die(); } elseif ( - (int)$apbct->settings['forms__check_internal'] === 1 - && !empty($_POST) + !empty($_POST) && apbct_is_ajax() && Post::equal('sib_form_action', 'subscribe_form_submit') && apbct_is_plugin_active('mailin/sendinblue.php') diff --git a/inc/cleantalk-public.php b/inc/cleantalk-public.php index 5d2e9c8c1..9f766dcc1 100644 --- a/inc/cleantalk-public.php +++ b/inc/cleantalk-public.php @@ -361,8 +361,7 @@ class_exists('Jetpack', false) && * Internal Forms - Sendinblue Integration https://wordpress.org/plugins/mailin/ */ if ( - (int)$apbct->settings['forms__check_internal'] === 1 - && !empty($_POST) + !empty($_POST) && Post::equal('sib_form_action', 'subscribe_form_submit') && apbct_is_plugin_active('mailin/sendinblue.php') ) { diff --git a/js/apbct-public-bundle.min.js b/js/apbct-public-bundle.min.js index 03207ac7e..e85a8d62b 100644 --- a/js/apbct-public-bundle.min.js +++ b/js/apbct-public-bundle.min.js @@ -1 +1 @@ -function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;et||r=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(r.data.forEach(function(e){e.encoded_email===a[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===a[t].href||0!==a[t].href.indexOf("mailto:")&&0!==a[t].href.indexOf("tel:"))a[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a[t])},2e3);else{if(0===a[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==a[t].href.indexOf("tel:"))return 0;e="tel:"}var o=a[t].href.replace(e,"");ctReplaceInTextNodes(a[t],o,ctHtmlToText(n.decoded_email)),a[t].href=e+n.decoded_email,a[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";r.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.textContent=ctHtmlToText(n)})}a[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=r.data[0];a.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a)},2e3),a.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctReplaceInTextNodes(e,t,n){if(t){e.normalize();for(var o,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);o=a.nextNode();)if(-1!==o.nodeValue.indexOf(t))return void(o.nodeValue=o.nodeValue.replace(t,function(){return n}))}}function ctHtmlToText(e){return e?(new DOMParser).parseFromString(String(e),"text/html").documentElement.textContent:""}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}var ctEmailDecoderIsInitialized=!1,cleantalkModal=(document.addEventListener("DOMContentLoaded",function(){if(!ctEmailDecoderIsInitialized){ctEmailDecoderIsInitialized=!0;var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1')):(r.innerHTML="Loading...",t&&this.load(t)),r.setAttribute("id","cleantalk-modal-content"),n.append(r),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions._ajax_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(unescape(encodeURIComponent(JSON.stringify(t)))),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(unescape(encodeURIComponent(n))),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function p(){_classCallCheck(this,p)}return _createClass(p,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0{var n=_asyncToGenerator(_regenerator().m(function e(t,n){var o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(+ctPublic.settings__forms__check_external){e.n=1;break}return e.a(2,!1);case 1:o=_createForOfIteratorHelper(r),e.p=2,o.s();case 3:if((a=o.n()).done)e.n=6;else{if((a=a.value).matches(t,n))return a=a.getForm(),e.n=4,i(a);e.n=5}break;case 4:if(e.v)return e.a(2,!0);e.n=5;break;case 5:e.n=3;break;case 6:e.n=8;break;case 7:e.p=7,a=e.v,o.e(a);case 8:return e.p=8,o.f(),e.f(8);case 9:return e.a(2,!1)}},e,null,[[2,7,8,9]])}));return function(e,t){return n.apply(this,arguments)}})(),r=[{name:"bitrix24",matches:function(e,t){return document.querySelector(".b24-form")&&e.includes("bitrix/services/main/ajax.php?action=crm.site.form.fill")&&t[1].body instanceof FormData},getForm:function(){return document.querySelector(".b24-form form")}},{name:"sender",matches:function(e,t){return e.includes("stats.sender.net/forms")&&"string"==typeof t[1].body},getForm:function(){for(var e=document.querySelectorAll("iframe"),t=0;t{var t=_asyncToGenerator(_regenerator().m(function e(t){var n,o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t){e.n=1;break}return e.a(2,!1);case 1:return n=c(t),b=!0,e.p=2,e.n=3,new Promise(function(e,t){apbct_public_sendAJAX(n,{async:!0,callback:e,onErrorCallback:t})});case 3:return o=e.v,(a=void 0!==o.apbct&&+o.apbct.blocked||void 0!==o.data&&void 0!==o.data.message)&&(new ApbctShowForbidden).parseBlockMessage(o),e.a(2,a);case 4:return e.p=4,e.a(2,!1);case 5:return e.p=5,b=!1,e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(e){return t.apply(this,arguments)}})(),c=function(e){var t,n={action:"cleantalk_force_ajax_check"},o=_createForOfIteratorHelper(e.elements);try{for(o.s();!(t=o.n()).done;){var a=t.value;a.name&&(n[a.name]=a.value)}}catch(e){o.e(e)}finally{o.f()}return+ctPublic.bot_detector_enabled?n.ct_bot_detector_event_token=apbctLocalStorage.get("bot_detector_event_token"):n.ct_no_cookie_hidden_field=getNoCookieData(),n};window.fetch=_asyncToGenerator(_regenerator().m(function e(){var t,n,o,a,r,i,c,l,s,u,d,p=arguments;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:for(t=p.length,n=new Array(t),o=0;o!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))(a="string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.a(2,h.apply(this,n));e.n=2;break;case 2:if(n&&n[0]&&n[1]&&n[1].body){e.n=3;break}return e.a(2,h.apply(this,n));case 3:return e.n=4,m.processFetch(n);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=_(n[1].body,f(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,r=t.querySelector('[name*="apbct__email_id__"]'),i=null,c=(null!==r&&null!==r.value&&(i=r.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===c&&null===r&&null===l||(e.preventDefault(),n=function(){null!==r&&r.parentNode.removeChild(r),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=c,null!==i&&(o.apbct_search_form__honeypot_value=i),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,r=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var r=o.value,i=this.findParentContainer(r);if(i){var c=this.getIdFromHTML(i);if(c===n){var l=i.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t{function o(){_classCallCheck(this,o)}return _createClass(o,null,[{key:"getFrontendDataLog",value:function(){var e=("undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.cookiePrefix?ctPublicFunctions.cookiePrefix:"")+o.LOG_KEY,t=o.LOG_KEY;if(void 0!==apbctLocalStorage&&apbctLocalStorage.get){var n=apbctLocalStorage.get(e)||apbctLocalStorage.get(t)||null;if(n&&"string"==typeof n)try{return JSON.parse(n)}catch(e){return""}return n}n=(n=localStorage.getItem(e))||localStorage.getItem(t)||null;try{return"string"==typeof n?JSON.parse(n):n}catch(e){return""}}},{key:"asDTO",value:function(){return{botd_logic_loaded:o.botdLogicLoaded,botd_wrapper_loaded:o.botdWrapperLoaded,frontend_data_log:"",transport_enabled:1}}},{key:"detectScripts",value:function(){if(o.botdWrapperLoaded&&o.botdLogicLoaded)return!0;for(var e=document.getElementsByTagName("script"),t=0;t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,r,i,c,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(c=document.createElement("strong")).append(d.phrases.trpHeading),(r=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),(i=document.createElement("div")).append(" "),i.append(c),i.append(d.phrases.trpContent1),(c=document.createElement("div")).style.display="flex",c.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),c.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),c.append(l)),r.append(i,c),a.append(r),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})})))}); \ No newline at end of file +function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;et||r=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(r.data.forEach(function(e){e.encoded_email===a[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===a[t].href||0!==a[t].href.indexOf("mailto:")&&0!==a[t].href.indexOf("tel:"))a[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a[t])},2e3);else{if(0===a[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==a[t].href.indexOf("tel:"))return 0;e="tel:"}var o=a[t].href.replace(e,"");ctReplaceInTextNodes(a[t],o,ctHtmlToText(n.decoded_email)),a[t].href=e+n.decoded_email,a[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";r.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.textContent=ctHtmlToText(n)})}a[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=r.data[0];a.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a)},2e3),a.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctReplaceInTextNodes(e,t,n){if(t){e.normalize();for(var o,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);o=a.nextNode();)if(-1!==o.nodeValue.indexOf(t))return void(o.nodeValue=o.nodeValue.replace(t,function(){return n}))}}function ctHtmlToText(e){return e?(new DOMParser).parseFromString(String(e),"text/html").documentElement.textContent:""}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){for(var n=null,o=0;o$1')):(r.innerHTML="Loading...",t&&this.load(t)),r.setAttribute("id","cleantalk-modal-content"),n.append(r),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions._ajax_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(unescape(encodeURIComponent(JSON.stringify(t)))),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(unescape(encodeURIComponent(n))),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function p(){_classCallCheck(this,p)}return _createClass(p,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0{var n=_asyncToGenerator(_regenerator().m(function e(t,n){var o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(+ctPublic.settings__forms__check_external){e.n=1;break}return e.a(2,!1);case 1:o=_createForOfIteratorHelper(r),e.p=2,o.s();case 3:if((a=o.n()).done)e.n=6;else{if((a=a.value).matches(t,n))return a=a.getForm(),e.n=4,i(a);e.n=5}break;case 4:if(e.v)return e.a(2,!0);e.n=5;break;case 5:e.n=3;break;case 6:e.n=8;break;case 7:e.p=7,a=e.v,o.e(a);case 8:return e.p=8,o.f(),e.f(8);case 9:return e.a(2,!1)}},e,null,[[2,7,8,9]])}));return function(e,t){return n.apply(this,arguments)}})(),r=[{name:"bitrix24",matches:function(e,t){return document.querySelector(".b24-form")&&e.includes("bitrix/services/main/ajax.php?action=crm.site.form.fill")&&t[1].body instanceof FormData},getForm:function(){return document.querySelector(".b24-form form")}},{name:"sender",matches:function(e,t){return e.includes("stats.sender.net/forms")&&"string"==typeof t[1].body},getForm:function(){for(var e=document.querySelectorAll("iframe"),t=0;t{var t=_asyncToGenerator(_regenerator().m(function e(t){var n,o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t){e.n=1;break}return e.a(2,!1);case 1:return n=c(t),b=!0,e.p=2,e.n=3,new Promise(function(e,t){apbct_public_sendAJAX(n,{async:!0,callback:e,onErrorCallback:t})});case 3:return o=e.v,(a=void 0!==o.apbct&&+o.apbct.blocked||void 0!==o.data&&void 0!==o.data.message)&&(new ApbctShowForbidden).parseBlockMessage(o),e.a(2,a);case 4:return e.p=4,e.a(2,!1);case 5:return e.p=5,b=!1,e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(e){return t.apply(this,arguments)}})(),c=function(e){var t,n={action:"cleantalk_force_ajax_check"},o=_createForOfIteratorHelper(e.elements);try{for(o.s();!(t=o.n()).done;){var a=t.value;a.name&&(n[a.name]=a.value)}}catch(e){o.e(e)}finally{o.f()}return+ctPublic.bot_detector_enabled?n.ct_bot_detector_event_token=apbctLocalStorage.get("bot_detector_event_token"):n.ct_no_cookie_hidden_field=getNoCookieData(),n};window.fetch=_asyncToGenerator(_regenerator().m(function e(){var t,n,o,a,r,i,c,l,s,u,d,p=arguments;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:for(t=p.length,n=new Array(t),o=0;o!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))(a="string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.a(2,h.apply(this,n));e.n=2;break;case 2:if(n&&n[0]&&n[1]&&n[1].body){e.n=3;break}return e.a(2,h.apply(this,n));case 3:return e.n=4,m.processFetch(n);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=_(n[1].body,f(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,r=t.querySelector('[name*="apbct__email_id__"]'),i=null,c=(null!==r&&null!==r.value&&(i=r.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===c&&null===r&&null===l||(e.preventDefault(),n=function(){null!==r&&r.parentNode.removeChild(r),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=c,null!==i&&(o.apbct_search_form__honeypot_value=i),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,r=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var r=o.value,i=this.findParentContainer(r);if(i){var c=this.getIdFromHTML(i);if(c===n){var l=i.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t{function o(){_classCallCheck(this,o)}return _createClass(o,null,[{key:"getFrontendDataLog",value:function(){var e=("undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.cookiePrefix?ctPublicFunctions.cookiePrefix:"")+o.LOG_KEY,t=o.LOG_KEY;if(void 0!==apbctLocalStorage&&apbctLocalStorage.get){var n=apbctLocalStorage.get(e)||apbctLocalStorage.get(t)||null;if(n&&"string"==typeof n)try{return JSON.parse(n)}catch(e){return""}return n}n=(n=localStorage.getItem(e))||localStorage.getItem(t)||null;try{return"string"==typeof n?JSON.parse(n):n}catch(e){return""}}},{key:"asDTO",value:function(){return{botd_logic_loaded:o.botdLogicLoaded,botd_wrapper_loaded:o.botdWrapperLoaded,frontend_data_log:"",transport_enabled:1}}},{key:"detectScripts",value:function(){if(o.botdWrapperLoaded&&o.botdLogicLoaded)return!0;for(var e=document.getElementsByTagName("script"),t=0;t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,r,i,c,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(c=document.createElement("strong")).append(d.phrases.trpHeading),(r=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),(i=document.createElement("div")).append(" "),i.append(c),i.append(d.phrases.trpContent1),(c=document.createElement("div")).style.display="flex",c.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),c.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),c.append(l)),r.append(i,c),a.append(r),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})})))}); \ No newline at end of file diff --git a/js/apbct-public-bundle_ext-protection.min.js b/js/apbct-public-bundle_ext-protection.min.js index 1ebc889ab..6400fa55c 100644 --- a/js/apbct-public-bundle_ext-protection.min.js +++ b/js/apbct-public-bundle_ext-protection.min.js @@ -1 +1 @@ -function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;et||r=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(r.data.forEach(function(e){e.encoded_email===a[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===a[t].href||0!==a[t].href.indexOf("mailto:")&&0!==a[t].href.indexOf("tel:"))a[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a[t])},2e3);else{if(0===a[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==a[t].href.indexOf("tel:"))return 0;e="tel:"}var o=a[t].href.replace(e,"");ctReplaceInTextNodes(a[t],o,ctHtmlToText(n.decoded_email)),a[t].href=e+n.decoded_email,a[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";r.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.textContent=ctHtmlToText(n)})}a[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=r.data[0];a.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a)},2e3),a.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctReplaceInTextNodes(e,t,n){if(t){e.normalize();for(var o,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);o=a.nextNode();)if(-1!==o.nodeValue.indexOf(t))return void(o.nodeValue=o.nodeValue.replace(t,function(){return n}))}}function ctHtmlToText(e){return e?(new DOMParser).parseFromString(String(e),"text/html").documentElement.textContent:""}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}var ctEmailDecoderIsInitialized=!1,cleantalkModal=(document.addEventListener("DOMContentLoaded",function(){if(!ctEmailDecoderIsInitialized){ctEmailDecoderIsInitialized=!0;var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1')):(r.innerHTML="Loading...",t&&this.load(t)),r.setAttribute("id","cleantalk-modal-content"),n.append(r),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions._ajax_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(unescape(encodeURIComponent(JSON.stringify(t)))),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(unescape(encodeURIComponent(n))),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function p(){_classCallCheck(this,p)}return _createClass(p,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0{var n=_asyncToGenerator(_regenerator().m(function e(t,n){var o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(+ctPublic.settings__forms__check_external){e.n=1;break}return e.a(2,!1);case 1:o=_createForOfIteratorHelper(r),e.p=2,o.s();case 3:if((a=o.n()).done)e.n=6;else{if((a=a.value).matches(t,n))return a=a.getForm(),e.n=4,i(a);e.n=5}break;case 4:if(e.v)return e.a(2,!0);e.n=5;break;case 5:e.n=3;break;case 6:e.n=8;break;case 7:e.p=7,a=e.v,o.e(a);case 8:return e.p=8,o.f(),e.f(8);case 9:return e.a(2,!1)}},e,null,[[2,7,8,9]])}));return function(e,t){return n.apply(this,arguments)}})(),r=[{name:"bitrix24",matches:function(e,t){return document.querySelector(".b24-form")&&e.includes("bitrix/services/main/ajax.php?action=crm.site.form.fill")&&t[1].body instanceof FormData},getForm:function(){return document.querySelector(".b24-form form")}},{name:"sender",matches:function(e,t){return e.includes("stats.sender.net/forms")&&"string"==typeof t[1].body},getForm:function(){for(var e=document.querySelectorAll("iframe"),t=0;t{var t=_asyncToGenerator(_regenerator().m(function e(t){var n,o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t){e.n=1;break}return e.a(2,!1);case 1:return n=c(t),b=!0,e.p=2,e.n=3,new Promise(function(e,t){apbct_public_sendAJAX(n,{async:!0,callback:e,onErrorCallback:t})});case 3:return o=e.v,(a=void 0!==o.apbct&&+o.apbct.blocked||void 0!==o.data&&void 0!==o.data.message)&&(new ApbctShowForbidden).parseBlockMessage(o),e.a(2,a);case 4:return e.p=4,e.a(2,!1);case 5:return e.p=5,b=!1,e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(e){return t.apply(this,arguments)}})(),c=function(e){var t,n={action:"cleantalk_force_ajax_check"},o=_createForOfIteratorHelper(e.elements);try{for(o.s();!(t=o.n()).done;){var a=t.value;a.name&&(n[a.name]=a.value)}}catch(e){o.e(e)}finally{o.f()}return+ctPublic.bot_detector_enabled?n.ct_bot_detector_event_token=apbctLocalStorage.get("bot_detector_event_token"):n.ct_no_cookie_hidden_field=getNoCookieData(),n};window.fetch=_asyncToGenerator(_regenerator().m(function e(){var t,n,o,a,r,i,c,l,s,u,d,p=arguments;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:for(t=p.length,n=new Array(t),o=0;o!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))(a="string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.a(2,h.apply(this,n));e.n=2;break;case 2:if(n&&n[0]&&n[1]&&n[1].body){e.n=3;break}return e.a(2,h.apply(this,n));case 3:return e.n=4,_.processFetch(n);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=m(n[1].body,f(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,r=t.querySelector('[name*="apbct__email_id__"]'),i=null,c=(null!==r&&null!==r.value&&(i=r.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===c&&null===r&&null===l||(e.preventDefault(),n=function(){null!==r&&r.parentNode.removeChild(r),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=c,null!==i&&(o.apbct_search_form__honeypot_value=i),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,r=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var r=o.value,i=this.findParentContainer(r);if(i){var c=this.getIdFromHTML(i);if(c===n){var l=i.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t{function o(){_classCallCheck(this,o)}return _createClass(o,null,[{key:"getFrontendDataLog",value:function(){var e=("undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.cookiePrefix?ctPublicFunctions.cookiePrefix:"")+o.LOG_KEY,t=o.LOG_KEY;if(void 0!==apbctLocalStorage&&apbctLocalStorage.get){var n=apbctLocalStorage.get(e)||apbctLocalStorage.get(t)||null;if(n&&"string"==typeof n)try{return JSON.parse(n)}catch(e){return""}return n}n=(n=localStorage.getItem(e))||localStorage.getItem(t)||null;try{return"string"==typeof n?JSON.parse(n):n}catch(e){return""}}},{key:"asDTO",value:function(){return{botd_logic_loaded:o.botdLogicLoaded,botd_wrapper_loaded:o.botdWrapperLoaded,frontend_data_log:"",transport_enabled:1}}},{key:"detectScripts",value:function(){if(o.botdWrapperLoaded&&o.botdLogicLoaded)return!0;for(var e=document.getElementsByTagName("script"),t=0;t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,r,i,c,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(c=document.createElement("strong")).append(d.phrases.trpHeading),(r=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),(i=document.createElement("div")).append(" "),i.append(c),i.append(d.phrases.trpContent1),(c=document.createElement("div")).style.display="flex",c.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),c.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),c.append(l)),r.append(i,c),a.append(r),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})})))}); \ No newline at end of file +function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;et||r=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(r.data.forEach(function(e){e.encoded_email===a[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===a[t].href||0!==a[t].href.indexOf("mailto:")&&0!==a[t].href.indexOf("tel:"))a[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a[t])},2e3);else{if(0===a[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==a[t].href.indexOf("tel:"))return 0;e="tel:"}var o=a[t].href.replace(e,"");ctReplaceInTextNodes(a[t],o,ctHtmlToText(n.decoded_email)),a[t].href=e+n.decoded_email,a[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";r.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.textContent=ctHtmlToText(n)})}a[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=r.data[0];a.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a)},2e3),a.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctReplaceInTextNodes(e,t,n){if(t){e.normalize();for(var o,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);o=a.nextNode();)if(-1!==o.nodeValue.indexOf(t))return void(o.nodeValue=o.nodeValue.replace(t,function(){return n}))}}function ctHtmlToText(e){return e?(new DOMParser).parseFromString(String(e),"text/html").documentElement.textContent:""}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){for(var n=null,o=0;o$1')):(r.innerHTML="Loading...",t&&this.load(t)),r.setAttribute("id","cleantalk-modal-content"),n.append(r),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions._ajax_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(unescape(encodeURIComponent(JSON.stringify(t)))),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(unescape(encodeURIComponent(n))),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function p(){_classCallCheck(this,p)}return _createClass(p,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0{var n=_asyncToGenerator(_regenerator().m(function e(t,n){var o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(+ctPublic.settings__forms__check_external){e.n=1;break}return e.a(2,!1);case 1:o=_createForOfIteratorHelper(r),e.p=2,o.s();case 3:if((a=o.n()).done)e.n=6;else{if((a=a.value).matches(t,n))return a=a.getForm(),e.n=4,i(a);e.n=5}break;case 4:if(e.v)return e.a(2,!0);e.n=5;break;case 5:e.n=3;break;case 6:e.n=8;break;case 7:e.p=7,a=e.v,o.e(a);case 8:return e.p=8,o.f(),e.f(8);case 9:return e.a(2,!1)}},e,null,[[2,7,8,9]])}));return function(e,t){return n.apply(this,arguments)}})(),r=[{name:"bitrix24",matches:function(e,t){return document.querySelector(".b24-form")&&e.includes("bitrix/services/main/ajax.php?action=crm.site.form.fill")&&t[1].body instanceof FormData},getForm:function(){return document.querySelector(".b24-form form")}},{name:"sender",matches:function(e,t){return e.includes("stats.sender.net/forms")&&"string"==typeof t[1].body},getForm:function(){for(var e=document.querySelectorAll("iframe"),t=0;t{var t=_asyncToGenerator(_regenerator().m(function e(t){var n,o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t){e.n=1;break}return e.a(2,!1);case 1:return n=c(t),b=!0,e.p=2,e.n=3,new Promise(function(e,t){apbct_public_sendAJAX(n,{async:!0,callback:e,onErrorCallback:t})});case 3:return o=e.v,(a=void 0!==o.apbct&&+o.apbct.blocked||void 0!==o.data&&void 0!==o.data.message)&&(new ApbctShowForbidden).parseBlockMessage(o),e.a(2,a);case 4:return e.p=4,e.a(2,!1);case 5:return e.p=5,b=!1,e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(e){return t.apply(this,arguments)}})(),c=function(e){var t,n={action:"cleantalk_force_ajax_check"},o=_createForOfIteratorHelper(e.elements);try{for(o.s();!(t=o.n()).done;){var a=t.value;a.name&&(n[a.name]=a.value)}}catch(e){o.e(e)}finally{o.f()}return+ctPublic.bot_detector_enabled?n.ct_bot_detector_event_token=apbctLocalStorage.get("bot_detector_event_token"):n.ct_no_cookie_hidden_field=getNoCookieData(),n};window.fetch=_asyncToGenerator(_regenerator().m(function e(){var t,n,o,a,r,i,c,l,s,u,d,p=arguments;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:for(t=p.length,n=new Array(t),o=0;o!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))(a="string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.a(2,h.apply(this,n));e.n=2;break;case 2:if(n&&n[0]&&n[1]&&n[1].body){e.n=3;break}return e.a(2,h.apply(this,n));case 3:return e.n=4,_.processFetch(n);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=m(n[1].body,f(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,r=t.querySelector('[name*="apbct__email_id__"]'),i=null,c=(null!==r&&null!==r.value&&(i=r.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===c&&null===r&&null===l||(e.preventDefault(),n=function(){null!==r&&r.parentNode.removeChild(r),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=c,null!==i&&(o.apbct_search_form__honeypot_value=i),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,r=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var r=o.value,i=this.findParentContainer(r);if(i){var c=this.getIdFromHTML(i);if(c===n){var l=i.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t{function o(){_classCallCheck(this,o)}return _createClass(o,null,[{key:"getFrontendDataLog",value:function(){var e=("undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.cookiePrefix?ctPublicFunctions.cookiePrefix:"")+o.LOG_KEY,t=o.LOG_KEY;if(void 0!==apbctLocalStorage&&apbctLocalStorage.get){var n=apbctLocalStorage.get(e)||apbctLocalStorage.get(t)||null;if(n&&"string"==typeof n)try{return JSON.parse(n)}catch(e){return""}return n}n=(n=localStorage.getItem(e))||localStorage.getItem(t)||null;try{return"string"==typeof n?JSON.parse(n):n}catch(e){return""}}},{key:"asDTO",value:function(){return{botd_logic_loaded:o.botdLogicLoaded,botd_wrapper_loaded:o.botdWrapperLoaded,frontend_data_log:"",transport_enabled:1}}},{key:"detectScripts",value:function(){if(o.botdWrapperLoaded&&o.botdLogicLoaded)return!0;for(var e=document.getElementsByTagName("script"),t=0;t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,r,i,c,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(c=document.createElement("strong")).append(d.phrases.trpHeading),(r=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),(i=document.createElement("div")).append(" "),i.append(c),i.append(d.phrases.trpContent1),(c=document.createElement("div")).style.display="flex",c.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),c.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),c.append(l)),r.append(i,c),a.append(r),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})})))}); \ No newline at end of file diff --git a/js/apbct-public-bundle_ext-protection_gathering.min.js b/js/apbct-public-bundle_ext-protection_gathering.min.js index c5b56f98d..2993755b9 100644 --- a/js/apbct-public-bundle_ext-protection_gathering.min.js +++ b/js/apbct-public-bundle_ext-protection_gathering.min.js @@ -1 +1 @@ -function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;et||c=e.length?{done:!0}:{done:!1,value:e[c++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(c.data.forEach(function(e){e.encoded_email===a[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===a[t].href||0!==a[t].href.indexOf("mailto:")&&0!==a[t].href.indexOf("tel:"))a[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a[t])},2e3);else{if(0===a[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==a[t].href.indexOf("tel:"))return 0;e="tel:"}var o=a[t].href.replace(e,"");ctReplaceInTextNodes(a[t],o,ctHtmlToText(n.decoded_email)),a[t].href=e+n.decoded_email,a[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";c.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.textContent=ctHtmlToText(n)})}a[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=c.data[0];a.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a)},2e3),a.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctReplaceInTextNodes(e,t,n){if(t){e.normalize();for(var o,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);o=a.nextNode();)if(-1!==o.nodeValue.indexOf(t))return void(o.nodeValue=o.nodeValue.replace(t,function(){return n}))}}function ctHtmlToText(e){return e?(new DOMParser).parseFromString(String(e),"text/html").documentElement.textContent:""}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}var ctEmailDecoderIsInitialized=!1,cleantalkModal=(document.addEventListener("DOMContentLoaded",function(){if(!ctEmailDecoderIsInitialized){ctEmailDecoderIsInitialized=!0;var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1')):(c.innerHTML="Loading...",t&&this.load(t)),c.setAttribute("id","cleantalk-modal-content"),n.append(c),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions._ajax_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(unescape(encodeURIComponent(JSON.stringify(t)))),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(unescape(encodeURIComponent(n))),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function p(){_classCallCheck(this,p)}return _createClass(p,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0{var n=_asyncToGenerator(_regenerator().m(function e(t,n){var o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(+ctPublic.settings__forms__check_external){e.n=1;break}return e.a(2,!1);case 1:o=_createForOfIteratorHelper(c),e.p=2,o.s();case 3:if((a=o.n()).done)e.n=6;else{if((a=a.value).matches(t,n))return a=a.getForm(),e.n=4,r(a);e.n=5}break;case 4:if(e.v)return e.a(2,!0);e.n=5;break;case 5:e.n=3;break;case 6:e.n=8;break;case 7:e.p=7,a=e.v,o.e(a);case 8:return e.p=8,o.f(),e.f(8);case 9:return e.a(2,!1)}},e,null,[[2,7,8,9]])}));return function(e,t){return n.apply(this,arguments)}})(),c=[{name:"bitrix24",matches:function(e,t){return document.querySelector(".b24-form")&&e.includes("bitrix/services/main/ajax.php?action=crm.site.form.fill")&&t[1].body instanceof FormData},getForm:function(){return document.querySelector(".b24-form form")}},{name:"sender",matches:function(e,t){return e.includes("stats.sender.net/forms")&&"string"==typeof t[1].body},getForm:function(){for(var e=document.querySelectorAll("iframe"),t=0;t{var t=_asyncToGenerator(_regenerator().m(function e(t){var n,o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t){e.n=1;break}return e.a(2,!1);case 1:return n=i(t),b=!0,e.p=2,e.n=3,new Promise(function(e,t){apbct_public_sendAJAX(n,{async:!0,callback:e,onErrorCallback:t})});case 3:return o=e.v,(a=void 0!==o.apbct&&+o.apbct.blocked||void 0!==o.data&&void 0!==o.data.message)&&(new ApbctShowForbidden).parseBlockMessage(o),e.a(2,a);case 4:return e.p=4,e.a(2,!1);case 5:return e.p=5,b=!1,e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(e){return t.apply(this,arguments)}})(),i=function(e){var t,n={action:"cleantalk_force_ajax_check"},o=_createForOfIteratorHelper(e.elements);try{for(o.s();!(t=o.n()).done;){var a=t.value;a.name&&(n[a.name]=a.value)}}catch(e){o.e(e)}finally{o.f()}return+ctPublic.bot_detector_enabled?n.ct_bot_detector_event_token=apbctLocalStorage.get("bot_detector_event_token"):n.ct_no_cookie_hidden_field=getNoCookieData(),n};window.fetch=_asyncToGenerator(_regenerator().m(function e(){var t,n,o,a,c,r,i,l,s,u,d,p=arguments;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:for(t=p.length,n=new Array(t),o=0;o!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))(a="string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.a(2,h.apply(this,n));e.n=2;break;case 2:if(n&&n[0]&&n[1]&&n[1].body){e.n=3;break}return e.a(2,h.apply(this,n));case 3:return e.n=4,m.processFetch(n);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=_(n[1].body,f(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,c=t.querySelector('[name*="apbct__email_id__"]'),r=null,i=(null!==c&&null!==c.value&&(r=c.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===i&&null===c&&null===l||(e.preventDefault(),n=function(){null!==c&&c.parentNode.removeChild(c),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=i,null!==r&&(o.apbct_search_form__honeypot_value=r),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,c=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var c=o.value,r=this.findParentContainer(c);if(r){var i=this.getIdFromHTML(r);if(i===n){var l=r.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t_createClass(function e(){_classCallCheck(this,e)},[{key:"setSessionId",value:function(){var e;apbctSessionStorage.isSet("apbct_session_id")?apbctLocalStorage.set("apbct_page_hits",Number(apbctLocalStorage.get("apbct_page_hits"))+1):(e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10),apbctSessionStorage.set("apbct_session_id",e,!1),apbctLocalStorage.set("apbct_page_hits",1),document.referrer&&new URL(document.referrer).host!==location.host&&apbctSessionStorage.set("apbct_site_referer",document.referrer,!1))}},{key:"writeReferrersToSessionStorage",value:function(){var e=apbctSessionStorage.get("apbct_session_current_page");!1!==e&&document.location.href!==e&&apbctSessionStorage.set("apbct_prev_referer",e,!1),apbctSessionStorage.set("apbct_session_current_page",document.location.href,!1)}},{key:"setCookiesType",value:function(){var e=apbctLocalStorage.get("ct_cookies_type");e&&e===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled"))}},{key:"startFieldsListening",value:function(){if(!apbctLocalStorage.isSet("ct_has_key_up")&&!apbctLocalStorage.get("ct_has_key_up")||!apbctLocalStorage.isSet("ct_has_input_focused")&&!apbctLocalStorage.get("ct_has_input_focused")||"native"!==ctPublic.data__cookies_type||void 0===ctGetCookie("ct_has_input_focused")||void 0===ctGetCookie("ct_has_key_up")){var e=ctGetPageForms();if(ctPublic.handled_fields=[],0_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"elementBody",document.querySelector("body")),_defineProperty(this,"collectionForms",document.forms),this.setListeners()},[{key:"setListeners",value:function(){var t=this;this.elementBody.addEventListener("click",function(e){t.checkElementInForms(e,"addClicks")}),this.elementBody.addEventListener("mouseup",function(e){"Range"==document.getSelection().type.toString()&&t.addSelected()}),this.elementBody.addEventListener("mousemove",function(e){t.checkElementInForms(e,"trackMouseMovement")})}},{key:"checkElementInForms",value:function(e,t){for(var n,o=0;o_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"fieldData",{isAutoFill:!1,isUseBuffer:!1,speedDelta:0,firstKeyTimestamp:0,lastKeyTimestamp:0,lastDelta:0,countOfKey:0}),_defineProperty(this,"fields",document.querySelectorAll("textarea[name=comment]")),_defineProperty(this,"data",[])},[{key:"gatheringFields",value:function(){var n=this;Array.prototype.slice.call(this.fields).forEach(function(e,t){n.data.push(Object.assign({},n.fieldData))})}},{key:"setListeners",value:function(){var o=this;this.fields.forEach(function(e,t){e.addEventListener("paste",function(){o.data[t].isUseBuffer=!0})}),this.fields.forEach(function(e,t){e.addEventListener("onautocomplete",function(){o.data[t].isAutoFill=!0})}),this.fields.forEach(function(e,n){e.addEventListener("input",function(){o.data[n].countOfKey++;var e,t=+new Date;1===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].firstKeyTimestamp=t):(e=t-o.data[n].lastKeyTimestamp,2===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].lastDelta=e):2{function o(){_classCallCheck(this,o)}return _createClass(o,null,[{key:"getFrontendDataLog",value:function(){var e=("undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.cookiePrefix?ctPublicFunctions.cookiePrefix:"")+o.LOG_KEY,t=o.LOG_KEY;if(void 0!==apbctLocalStorage&&apbctLocalStorage.get){var n=apbctLocalStorage.get(e)||apbctLocalStorage.get(t)||null;if(n&&"string"==typeof n)try{return JSON.parse(n)}catch(e){return""}return n}n=(n=localStorage.getItem(e))||localStorage.getItem(t)||null;try{return"string"==typeof n?JSON.parse(n):n}catch(e){return""}}},{key:"asDTO",value:function(){return{botd_logic_loaded:o.botdLogicLoaded,botd_wrapper_loaded:o.botdWrapperLoaded,frontend_data_log:"",transport_enabled:1}}},{key:"detectScripts",value:function(){if(o.botdWrapperLoaded&&o.botdLogicLoaded)return!0;for(var e=document.getElementsByTagName("script"),t=0;t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,c,r,i,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(i=document.createElement("strong")).append(d.phrases.trpHeading),(c=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),(r=document.createElement("div")).append(" "),r.append(i),r.append(d.phrases.trpContent1),(i=document.createElement("div")).style.display="flex",i.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),i.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),i.append(l)),c.append(r,i),a.append(c),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})})))}); \ No newline at end of file +function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;et||c=e.length?{done:!0}:{done:!1,value:e[c++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(c.data.forEach(function(e){e.encoded_email===a[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===a[t].href||0!==a[t].href.indexOf("mailto:")&&0!==a[t].href.indexOf("tel:"))a[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a[t])},2e3);else{if(0===a[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==a[t].href.indexOf("tel:"))return 0;e="tel:"}var o=a[t].href.replace(e,"");ctReplaceInTextNodes(a[t],o,ctHtmlToText(n.decoded_email)),a[t].href=e+n.decoded_email,a[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";c.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.textContent=ctHtmlToText(n)})}a[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=c.data[0];a.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a)},2e3),a.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctReplaceInTextNodes(e,t,n){if(t){e.normalize();for(var o,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);o=a.nextNode();)if(-1!==o.nodeValue.indexOf(t))return void(o.nodeValue=o.nodeValue.replace(t,function(){return n}))}}function ctHtmlToText(e){return e?(new DOMParser).parseFromString(String(e),"text/html").documentElement.textContent:""}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){for(var n=null,o=0;o$1')):(c.innerHTML="Loading...",t&&this.load(t)),c.setAttribute("id","cleantalk-modal-content"),n.append(c),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions._ajax_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(unescape(encodeURIComponent(JSON.stringify(t)))),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(unescape(encodeURIComponent(n))),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function p(){_classCallCheck(this,p)}return _createClass(p,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0{var n=_asyncToGenerator(_regenerator().m(function e(t,n){var o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(+ctPublic.settings__forms__check_external){e.n=1;break}return e.a(2,!1);case 1:o=_createForOfIteratorHelper(c),e.p=2,o.s();case 3:if((a=o.n()).done)e.n=6;else{if((a=a.value).matches(t,n))return a=a.getForm(),e.n=4,r(a);e.n=5}break;case 4:if(e.v)return e.a(2,!0);e.n=5;break;case 5:e.n=3;break;case 6:e.n=8;break;case 7:e.p=7,a=e.v,o.e(a);case 8:return e.p=8,o.f(),e.f(8);case 9:return e.a(2,!1)}},e,null,[[2,7,8,9]])}));return function(e,t){return n.apply(this,arguments)}})(),c=[{name:"bitrix24",matches:function(e,t){return document.querySelector(".b24-form")&&e.includes("bitrix/services/main/ajax.php?action=crm.site.form.fill")&&t[1].body instanceof FormData},getForm:function(){return document.querySelector(".b24-form form")}},{name:"sender",matches:function(e,t){return e.includes("stats.sender.net/forms")&&"string"==typeof t[1].body},getForm:function(){for(var e=document.querySelectorAll("iframe"),t=0;t{var t=_asyncToGenerator(_regenerator().m(function e(t){var n,o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t){e.n=1;break}return e.a(2,!1);case 1:return n=i(t),b=!0,e.p=2,e.n=3,new Promise(function(e,t){apbct_public_sendAJAX(n,{async:!0,callback:e,onErrorCallback:t})});case 3:return o=e.v,(a=void 0!==o.apbct&&+o.apbct.blocked||void 0!==o.data&&void 0!==o.data.message)&&(new ApbctShowForbidden).parseBlockMessage(o),e.a(2,a);case 4:return e.p=4,e.a(2,!1);case 5:return e.p=5,b=!1,e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(e){return t.apply(this,arguments)}})(),i=function(e){var t,n={action:"cleantalk_force_ajax_check"},o=_createForOfIteratorHelper(e.elements);try{for(o.s();!(t=o.n()).done;){var a=t.value;a.name&&(n[a.name]=a.value)}}catch(e){o.e(e)}finally{o.f()}return+ctPublic.bot_detector_enabled?n.ct_bot_detector_event_token=apbctLocalStorage.get("bot_detector_event_token"):n.ct_no_cookie_hidden_field=getNoCookieData(),n};window.fetch=_asyncToGenerator(_regenerator().m(function e(){var t,n,o,a,c,r,i,l,s,u,d,p=arguments;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:for(t=p.length,n=new Array(t),o=0;o!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))(a="string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.a(2,h.apply(this,n));e.n=2;break;case 2:if(n&&n[0]&&n[1]&&n[1].body){e.n=3;break}return e.a(2,h.apply(this,n));case 3:return e.n=4,m.processFetch(n);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=_(n[1].body,f(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,c=t.querySelector('[name*="apbct__email_id__"]'),r=null,i=(null!==c&&null!==c.value&&(r=c.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===i&&null===c&&null===l||(e.preventDefault(),n=function(){null!==c&&c.parentNode.removeChild(c),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=i,null!==r&&(o.apbct_search_form__honeypot_value=r),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,c=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var c=o.value,r=this.findParentContainer(c);if(r){var i=this.getIdFromHTML(r);if(i===n){var l=r.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t_createClass(function e(){_classCallCheck(this,e)},[{key:"setSessionId",value:function(){var e;apbctSessionStorage.isSet("apbct_session_id")?apbctLocalStorage.set("apbct_page_hits",Number(apbctLocalStorage.get("apbct_page_hits"))+1):(e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10),apbctSessionStorage.set("apbct_session_id",e,!1),apbctLocalStorage.set("apbct_page_hits",1),document.referrer&&new URL(document.referrer).host!==location.host&&apbctSessionStorage.set("apbct_site_referer",document.referrer,!1))}},{key:"writeReferrersToSessionStorage",value:function(){var e=apbctSessionStorage.get("apbct_session_current_page");!1!==e&&document.location.href!==e&&apbctSessionStorage.set("apbct_prev_referer",e,!1),apbctSessionStorage.set("apbct_session_current_page",document.location.href,!1)}},{key:"setCookiesType",value:function(){var e=apbctLocalStorage.get("ct_cookies_type");e&&e===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled"))}},{key:"startFieldsListening",value:function(){if(!apbctLocalStorage.isSet("ct_has_key_up")&&!apbctLocalStorage.get("ct_has_key_up")||!apbctLocalStorage.isSet("ct_has_input_focused")&&!apbctLocalStorage.get("ct_has_input_focused")||"native"!==ctPublic.data__cookies_type||void 0===ctGetCookie("ct_has_input_focused")||void 0===ctGetCookie("ct_has_key_up")){var e=ctGetPageForms();if(ctPublic.handled_fields=[],0_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"elementBody",document.querySelector("body")),_defineProperty(this,"collectionForms",document.forms),this.setListeners()},[{key:"setListeners",value:function(){var t=this;this.elementBody.addEventListener("click",function(e){t.checkElementInForms(e,"addClicks")}),this.elementBody.addEventListener("mouseup",function(e){"Range"==document.getSelection().type.toString()&&t.addSelected()}),this.elementBody.addEventListener("mousemove",function(e){t.checkElementInForms(e,"trackMouseMovement")})}},{key:"checkElementInForms",value:function(e,t){for(var n,o=0;o_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"fieldData",{isAutoFill:!1,isUseBuffer:!1,speedDelta:0,firstKeyTimestamp:0,lastKeyTimestamp:0,lastDelta:0,countOfKey:0}),_defineProperty(this,"fields",document.querySelectorAll("textarea[name=comment]")),_defineProperty(this,"data",[])},[{key:"gatheringFields",value:function(){var n=this;Array.prototype.slice.call(this.fields).forEach(function(e,t){n.data.push(Object.assign({},n.fieldData))})}},{key:"setListeners",value:function(){var o=this;this.fields.forEach(function(e,t){e.addEventListener("paste",function(){o.data[t].isUseBuffer=!0})}),this.fields.forEach(function(e,t){e.addEventListener("onautocomplete",function(){o.data[t].isAutoFill=!0})}),this.fields.forEach(function(e,n){e.addEventListener("input",function(){o.data[n].countOfKey++;var e,t=+new Date;1===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].firstKeyTimestamp=t):(e=t-o.data[n].lastKeyTimestamp,2===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].lastDelta=e):2{function o(){_classCallCheck(this,o)}return _createClass(o,null,[{key:"getFrontendDataLog",value:function(){var e=("undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.cookiePrefix?ctPublicFunctions.cookiePrefix:"")+o.LOG_KEY,t=o.LOG_KEY;if(void 0!==apbctLocalStorage&&apbctLocalStorage.get){var n=apbctLocalStorage.get(e)||apbctLocalStorage.get(t)||null;if(n&&"string"==typeof n)try{return JSON.parse(n)}catch(e){return""}return n}n=(n=localStorage.getItem(e))||localStorage.getItem(t)||null;try{return"string"==typeof n?JSON.parse(n):n}catch(e){return""}}},{key:"asDTO",value:function(){return{botd_logic_loaded:o.botdLogicLoaded,botd_wrapper_loaded:o.botdWrapperLoaded,frontend_data_log:"",transport_enabled:1}}},{key:"detectScripts",value:function(){if(o.botdWrapperLoaded&&o.botdLogicLoaded)return!0;for(var e=document.getElementsByTagName("script"),t=0;t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,c,r,i,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(i=document.createElement("strong")).append(d.phrases.trpHeading),(c=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),(r=document.createElement("div")).append(" "),r.append(i),r.append(d.phrases.trpContent1),(i=document.createElement("div")).style.display="flex",i.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),i.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),i.append(l)),c.append(r,i),a.append(c),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})})))}); \ No newline at end of file diff --git a/js/apbct-public-bundle_full-protection.min.js b/js/apbct-public-bundle_full-protection.min.js index bde2dcbf5..e9007958f 100644 --- a/js/apbct-public-bundle_full-protection.min.js +++ b/js/apbct-public-bundle_full-protection.min.js @@ -1 +1 @@ -function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;et||r=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(r.data.forEach(function(e){e.encoded_email===a[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===a[t].href||0!==a[t].href.indexOf("mailto:")&&0!==a[t].href.indexOf("tel:"))a[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a[t])},2e3);else{if(0===a[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==a[t].href.indexOf("tel:"))return 0;e="tel:"}var o=a[t].href.replace(e,"");ctReplaceInTextNodes(a[t],o,ctHtmlToText(n.decoded_email)),a[t].href=e+n.decoded_email,a[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";r.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.textContent=ctHtmlToText(n)})}a[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=r.data[0];a.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a)},2e3),a.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctReplaceInTextNodes(e,t,n){if(t){e.normalize();for(var o,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);o=a.nextNode();)if(-1!==o.nodeValue.indexOf(t))return void(o.nodeValue=o.nodeValue.replace(t,function(){return n}))}}function ctHtmlToText(e){return e?(new DOMParser).parseFromString(String(e),"text/html").documentElement.textContent:""}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}var ctEmailDecoderIsInitialized=!1,cleantalkModal=(document.addEventListener("DOMContentLoaded",function(){if(!ctEmailDecoderIsInitialized){ctEmailDecoderIsInitialized=!0;var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1')):(r.innerHTML="Loading...",t&&this.load(t)),r.setAttribute("id","cleantalk-modal-content"),n.append(r),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions._ajax_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(unescape(encodeURIComponent(JSON.stringify(t)))),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(unescape(encodeURIComponent(n))),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function p(){_classCallCheck(this,p)}return _createClass(p,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0{var n=_asyncToGenerator(_regenerator().m(function e(t,n){var o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(+ctPublic.settings__forms__check_external){e.n=1;break}return e.a(2,!1);case 1:o=_createForOfIteratorHelper(r),e.p=2,o.s();case 3:if((a=o.n()).done)e.n=6;else{if((a=a.value).matches(t,n))return a=a.getForm(),e.n=4,c(a);e.n=5}break;case 4:if(e.v)return e.a(2,!0);e.n=5;break;case 5:e.n=3;break;case 6:e.n=8;break;case 7:e.p=7,a=e.v,o.e(a);case 8:return e.p=8,o.f(),e.f(8);case 9:return e.a(2,!1)}},e,null,[[2,7,8,9]])}));return function(e,t){return n.apply(this,arguments)}})(),r=[{name:"bitrix24",matches:function(e,t){return document.querySelector(".b24-form")&&e.includes("bitrix/services/main/ajax.php?action=crm.site.form.fill")&&t[1].body instanceof FormData},getForm:function(){return document.querySelector(".b24-form form")}},{name:"sender",matches:function(e,t){return e.includes("stats.sender.net/forms")&&"string"==typeof t[1].body},getForm:function(){for(var e=document.querySelectorAll("iframe"),t=0;t{var t=_asyncToGenerator(_regenerator().m(function e(t){var n,o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t){e.n=1;break}return e.a(2,!1);case 1:return n=i(t),b=!0,e.p=2,e.n=3,new Promise(function(e,t){apbct_public_sendAJAX(n,{async:!0,callback:e,onErrorCallback:t})});case 3:return o=e.v,(a=void 0!==o.apbct&&+o.apbct.blocked||void 0!==o.data&&void 0!==o.data.message)&&(new ApbctShowForbidden).parseBlockMessage(o),e.a(2,a);case 4:return e.p=4,e.a(2,!1);case 5:return e.p=5,b=!1,e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(e){return t.apply(this,arguments)}})(),i=function(e){var t,n={action:"cleantalk_force_ajax_check"},o=_createForOfIteratorHelper(e.elements);try{for(o.s();!(t=o.n()).done;){var a=t.value;a.name&&(n[a.name]=a.value)}}catch(e){o.e(e)}finally{o.f()}return+ctPublic.bot_detector_enabled?n.ct_bot_detector_event_token=apbctLocalStorage.get("bot_detector_event_token"):n.ct_no_cookie_hidden_field=getNoCookieData(),n};window.fetch=_asyncToGenerator(_regenerator().m(function e(){var t,n,o,a,r,c,i,l,s,u,d,p=arguments;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:for(t=p.length,n=new Array(t),o=0;o!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))(a="string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.a(2,h.apply(this,n));e.n=2;break;case 2:if(n&&n[0]&&n[1]&&n[1].body){e.n=3;break}return e.a(2,h.apply(this,n));case 3:return e.n=4,_.processFetch(n);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=m(n[1].body,f(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,r=t.querySelector('[name*="apbct__email_id__"]'),c=null,i=(null!==r&&null!==r.value&&(c=r.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===i&&null===r&&null===l||(e.preventDefault(),n=function(){null!==r&&r.parentNode.removeChild(r),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=i,null!==c&&(o.apbct_search_form__honeypot_value=c),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,r=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var r=o.value,c=this.findParentContainer(r);if(c){var i=this.getIdFromHTML(c);if(i===n){var l=c.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"wrappers",[]),this.wrappers=this.findWrappers(),this.wrappers.length<1||this.checkBot()},[{key:"findWrappers",value:function(){return document.querySelectorAll("div.ct-encoded-form-wrapper")}},{key:"checkBot",value:function(){var t=this,e={post_url:document.location.href,referrer:document.referrer};+ctPublic.bot_detector_enabled?e.event_token=apbctLocalStorage.get("bot_detector_event_token"):e.event_javascript_data=getJavascriptClientData(),"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("force_protection_check_bot",{data:e,method:"POST",callback:function(e){return t.checkBotCallback(e)}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&(e.action="apbct_force_protection_check_bot",apbct_public_sendAJAX(e,{callback:function(e){return t.checkBotCallback(e)}}))}},{key:"checkBotCallback",value:function(e){if(e.data&&e.data.status&&200!==e.data.status)console.log("ApbctForceProtection connection error occurred"),this.decodeForms();else{if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return console.log("ApbctForceProtection decodeForms error",e),void this.decodeForms()}"object"===_typeof(e)&&e.allow&&1===e.allow?(this.decodeForms(),document.dispatchEvent(new Event("apbctForceProtectionAllowed"))):this.showMessageForBot(e.message)}}},{key:"decodeForms",value:function(){var n;this.wrappers.forEach(function(e){n=e.querySelector("div.ct-encoded-form").dataset.encodedForm;try{var t;n&&"string"==typeof n&&(t=decodeURIComponent(n),e.outerHTML=atob(t))}catch(e){console.log(e)}})}},{key:"showMessageForBot",value:function(t){this.wrappers.forEach(function(e){e.querySelector("div.ct-encoded-form").dataset.encodedForm&&(e.outerHTML='
'+t+"
")})}}]))(),apbctForceProtectionIsInitialized=!1;function apbctForceProtect(){apbctForceProtectionIsInitialized||(apbctForceProtectionIsInitialized=!0,+ctPublic.settings__forms__force_protection&&void 0!==ApbctForceProtection&&new ApbctForceProtection)}function ctCheckInternal(t){var e,n={},o=t.elements;for(e in o)"submit"!==o[e].type&&void 0!==o[e].value&&""!==o[e].value&&(n[o[e].name]=t.elements[e].value);n.action="ct_check_internal",apbct_public_sendAJAX(n,{url:ctPublicFunctions._ajax_url,callback:function(e){if(!0!==e.success)return alert(e.data),!1;t.origSubmit()}})}ctPublic.data__key_is_ok&&("loading"!==document.readyState?apbctForceProtect():apbct_attach_event_handler(document,"DOMContentLoaded",apbctForceProtect));var ctInternalFormsIsInitialized=!1;function ctProtectInternalForms(){for(var e,t="",n="",o=0;o{function o(){_classCallCheck(this,o)}return _createClass(o,null,[{key:"getFrontendDataLog",value:function(){var e=("undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.cookiePrefix?ctPublicFunctions.cookiePrefix:"")+o.LOG_KEY,t=o.LOG_KEY;if(void 0!==apbctLocalStorage&&apbctLocalStorage.get){var n=apbctLocalStorage.get(e)||apbctLocalStorage.get(t)||null;if(n&&"string"==typeof n)try{return JSON.parse(n)}catch(e){return""}return n}n=(n=localStorage.getItem(e))||localStorage.getItem(t)||null;try{return"string"==typeof n?JSON.parse(n):n}catch(e){return""}}},{key:"asDTO",value:function(){return{botd_logic_loaded:o.botdLogicLoaded,botd_wrapper_loaded:o.botdWrapperLoaded,frontend_data_log:"",transport_enabled:1}}},{key:"detectScripts",value:function(){if(o.botdWrapperLoaded&&o.botdLogicLoaded)return!0;for(var e=document.getElementsByTagName("script"),t=0;t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,r,c,i,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(i=document.createElement("strong")).append(d.phrases.trpHeading),(r=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),(c=document.createElement("div")).append(" "),c.append(i),c.append(d.phrases.trpContent1),(i=document.createElement("div")).style.display="flex",i.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),i.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),i.append(l)),r.append(c,i),a.append(r),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})})))}); \ No newline at end of file +function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;et||r=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(r.data.forEach(function(e){e.encoded_email===a[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===a[t].href||0!==a[t].href.indexOf("mailto:")&&0!==a[t].href.indexOf("tel:"))a[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a[t])},2e3);else{if(0===a[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==a[t].href.indexOf("tel:"))return 0;e="tel:"}var o=a[t].href.replace(e,"");ctReplaceInTextNodes(a[t],o,ctHtmlToText(n.decoded_email)),a[t].href=e+n.decoded_email,a[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";r.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.textContent=ctHtmlToText(n)})}a[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=r.data[0];a.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a)},2e3),a.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctReplaceInTextNodes(e,t,n){if(t){e.normalize();for(var o,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);o=a.nextNode();)if(-1!==o.nodeValue.indexOf(t))return void(o.nodeValue=o.nodeValue.replace(t,function(){return n}))}}function ctHtmlToText(e){return e?(new DOMParser).parseFromString(String(e),"text/html").documentElement.textContent:""}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){for(var n=null,o=0;o$1')):(r.innerHTML="Loading...",t&&this.load(t)),r.setAttribute("id","cleantalk-modal-content"),n.append(r),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions._ajax_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(unescape(encodeURIComponent(JSON.stringify(t)))),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(unescape(encodeURIComponent(n))),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function p(){_classCallCheck(this,p)}return _createClass(p,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0{var n=_asyncToGenerator(_regenerator().m(function e(t,n){var o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(+ctPublic.settings__forms__check_external){e.n=1;break}return e.a(2,!1);case 1:o=_createForOfIteratorHelper(r),e.p=2,o.s();case 3:if((a=o.n()).done)e.n=6;else{if((a=a.value).matches(t,n))return a=a.getForm(),e.n=4,c(a);e.n=5}break;case 4:if(e.v)return e.a(2,!0);e.n=5;break;case 5:e.n=3;break;case 6:e.n=8;break;case 7:e.p=7,a=e.v,o.e(a);case 8:return e.p=8,o.f(),e.f(8);case 9:return e.a(2,!1)}},e,null,[[2,7,8,9]])}));return function(e,t){return n.apply(this,arguments)}})(),r=[{name:"bitrix24",matches:function(e,t){return document.querySelector(".b24-form")&&e.includes("bitrix/services/main/ajax.php?action=crm.site.form.fill")&&t[1].body instanceof FormData},getForm:function(){return document.querySelector(".b24-form form")}},{name:"sender",matches:function(e,t){return e.includes("stats.sender.net/forms")&&"string"==typeof t[1].body},getForm:function(){for(var e=document.querySelectorAll("iframe"),t=0;t{var t=_asyncToGenerator(_regenerator().m(function e(t){var n,o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t){e.n=1;break}return e.a(2,!1);case 1:return n=i(t),b=!0,e.p=2,e.n=3,new Promise(function(e,t){apbct_public_sendAJAX(n,{async:!0,callback:e,onErrorCallback:t})});case 3:return o=e.v,(a=void 0!==o.apbct&&+o.apbct.blocked||void 0!==o.data&&void 0!==o.data.message)&&(new ApbctShowForbidden).parseBlockMessage(o),e.a(2,a);case 4:return e.p=4,e.a(2,!1);case 5:return e.p=5,b=!1,e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(e){return t.apply(this,arguments)}})(),i=function(e){var t,n={action:"cleantalk_force_ajax_check"},o=_createForOfIteratorHelper(e.elements);try{for(o.s();!(t=o.n()).done;){var a=t.value;a.name&&(n[a.name]=a.value)}}catch(e){o.e(e)}finally{o.f()}return+ctPublic.bot_detector_enabled?n.ct_bot_detector_event_token=apbctLocalStorage.get("bot_detector_event_token"):n.ct_no_cookie_hidden_field=getNoCookieData(),n};window.fetch=_asyncToGenerator(_regenerator().m(function e(){var t,n,o,a,r,c,i,l,s,u,d,p=arguments;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:for(t=p.length,n=new Array(t),o=0;o!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))(a="string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.a(2,h.apply(this,n));e.n=2;break;case 2:if(n&&n[0]&&n[1]&&n[1].body){e.n=3;break}return e.a(2,h.apply(this,n));case 3:return e.n=4,_.processFetch(n);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=m(n[1].body,f(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,r=t.querySelector('[name*="apbct__email_id__"]'),c=null,i=(null!==r&&null!==r.value&&(c=r.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===i&&null===r&&null===l||(e.preventDefault(),n=function(){null!==r&&r.parentNode.removeChild(r),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=i,null!==c&&(o.apbct_search_form__honeypot_value=c),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,r=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var r=o.value,c=this.findParentContainer(r);if(c){var i=this.getIdFromHTML(c);if(i===n){var l=c.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"wrappers",[]),this.wrappers=this.findWrappers(),this.wrappers.length<1||this.checkBot()},[{key:"findWrappers",value:function(){var t=ctPublic.force_protection_wrapper_token;return t&&"string"==typeof t?Array.prototype.filter.call(document.querySelectorAll("div.ct-encoded-form-wrapper"),function(e){return e.getAttribute("data-ct-wrapper-token")===t}):[]}},{key:"checkBot",value:function(){var t=this,e={post_url:document.location.href,referrer:document.referrer};+ctPublic.bot_detector_enabled?e.event_token=apbctLocalStorage.get("bot_detector_event_token"):e.event_javascript_data=getJavascriptClientData(),"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("force_protection_check_bot",{data:e,method:"POST",callback:function(e){return t.checkBotCallback(e)}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&(e.action="apbct_force_protection_check_bot",apbct_public_sendAJAX(e,{callback:function(e){return t.checkBotCallback(e)}}))}},{key:"checkBotCallback",value:function(e){if(e.data&&e.data.status&&200!==e.data.status)console.log("ApbctForceProtection connection error occurred"),this.decodeForms();else{if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return console.log("ApbctForceProtection decodeForms error",e),void this.decodeForms()}"object"===_typeof(e)&&e.allow&&1===e.allow?(this.decodeForms(),document.dispatchEvent(new Event("apbctForceProtectionAllowed"))):this.showMessageForBot(e.message)}}},{key:"decodeForms",value:function(){var n;this.wrappers.forEach(function(e){n=e.querySelector("div.ct-encoded-form").dataset.encodedForm;try{var t;n&&"string"==typeof n&&(t=decodeURIComponent(n),e.outerHTML=atob(t))}catch(e){console.log(e)}})}},{key:"showMessageForBot",value:function(n){this.wrappers.forEach(function(e){var t;e.querySelector("div.ct-encoded-form").dataset.encodedForm&&((t=document.createElement("div")).className="ct-encoded-form-forbidden",t.textContent=n?String(n):"",e.parentNode.replaceChild(t,e))})}}]))(),apbctForceProtectionIsInitialized=!1;function apbctForceProtect(){apbctForceProtectionIsInitialized||(apbctForceProtectionIsInitialized=!0,+ctPublic.settings__forms__force_protection&&void 0!==ApbctForceProtection&&new ApbctForceProtection)}function ctCheckInternal(t){var e,n={},o=t.elements;for(e in o)"submit"!==o[e].type&&void 0!==o[e].value&&""!==o[e].value&&(n[o[e].name]=t.elements[e].value);n.action="ct_check_internal",apbct_public_sendAJAX(n,{url:ctPublicFunctions._ajax_url,callback:function(e){if(!0!==e.success)return alert(e.data),!1;t.origSubmit()}})}ctPublic.data__key_is_ok&&("loading"!==document.readyState?apbctForceProtect():apbct_attach_event_handler(document,"DOMContentLoaded",apbctForceProtect));var ctInternalFormsIsInitialized=!1;function ctProtectInternalForms(){for(var e,t="",n="",o=0;o{function o(){_classCallCheck(this,o)}return _createClass(o,null,[{key:"getFrontendDataLog",value:function(){var e=("undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.cookiePrefix?ctPublicFunctions.cookiePrefix:"")+o.LOG_KEY,t=o.LOG_KEY;if(void 0!==apbctLocalStorage&&apbctLocalStorage.get){var n=apbctLocalStorage.get(e)||apbctLocalStorage.get(t)||null;if(n&&"string"==typeof n)try{return JSON.parse(n)}catch(e){return""}return n}n=(n=localStorage.getItem(e))||localStorage.getItem(t)||null;try{return"string"==typeof n?JSON.parse(n):n}catch(e){return""}}},{key:"asDTO",value:function(){return{botd_logic_loaded:o.botdLogicLoaded,botd_wrapper_loaded:o.botdWrapperLoaded,frontend_data_log:"",transport_enabled:1}}},{key:"detectScripts",value:function(){if(o.botdWrapperLoaded&&o.botdLogicLoaded)return!0;for(var e=document.getElementsByTagName("script"),t=0;t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,r,c,i,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(i=document.createElement("strong")).append(d.phrases.trpHeading),(r=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),(c=document.createElement("div")).append(" "),c.append(i),c.append(d.phrases.trpContent1),(i=document.createElement("div")).style.display="flex",i.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),i.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),i.append(l)),r.append(c,i),a.append(r),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})})))}); \ No newline at end of file diff --git a/js/apbct-public-bundle_full-protection_gathering.min.js b/js/apbct-public-bundle_full-protection_gathering.min.js index 482ccb524..d7a1cc061 100644 --- a/js/apbct-public-bundle_full-protection_gathering.min.js +++ b/js/apbct-public-bundle_full-protection_gathering.min.js @@ -1 +1 @@ -function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;et||c=e.length?{done:!0}:{done:!1,value:e[c++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(c.data.forEach(function(e){e.encoded_email===a[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===a[t].href||0!==a[t].href.indexOf("mailto:")&&0!==a[t].href.indexOf("tel:"))a[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a[t])},2e3);else{if(0===a[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==a[t].href.indexOf("tel:"))return 0;e="tel:"}var o=a[t].href.replace(e,"");ctReplaceInTextNodes(a[t],o,ctHtmlToText(n.decoded_email)),a[t].href=e+n.decoded_email,a[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";c.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.textContent=ctHtmlToText(n)})}a[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=c.data[0];a.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a)},2e3),a.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctReplaceInTextNodes(e,t,n){if(t){e.normalize();for(var o,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);o=a.nextNode();)if(-1!==o.nodeValue.indexOf(t))return void(o.nodeValue=o.nodeValue.replace(t,function(){return n}))}}function ctHtmlToText(e){return e?(new DOMParser).parseFromString(String(e),"text/html").documentElement.textContent:""}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}var ctEmailDecoderIsInitialized=!1,cleantalkModal=(document.addEventListener("DOMContentLoaded",function(){if(!ctEmailDecoderIsInitialized){ctEmailDecoderIsInitialized=!0;var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1')):(c.innerHTML="Loading...",t&&this.load(t)),c.setAttribute("id","cleantalk-modal-content"),n.append(c),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions._ajax_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(unescape(encodeURIComponent(JSON.stringify(t)))),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(unescape(encodeURIComponent(n))),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function p(){_classCallCheck(this,p)}return _createClass(p,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0{var n=_asyncToGenerator(_regenerator().m(function e(t,n){var o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(+ctPublic.settings__forms__check_external){e.n=1;break}return e.a(2,!1);case 1:o=_createForOfIteratorHelper(c),e.p=2,o.s();case 3:if((a=o.n()).done)e.n=6;else{if((a=a.value).matches(t,n))return a=a.getForm(),e.n=4,r(a);e.n=5}break;case 4:if(e.v)return e.a(2,!0);e.n=5;break;case 5:e.n=3;break;case 6:e.n=8;break;case 7:e.p=7,a=e.v,o.e(a);case 8:return e.p=8,o.f(),e.f(8);case 9:return e.a(2,!1)}},e,null,[[2,7,8,9]])}));return function(e,t){return n.apply(this,arguments)}})(),c=[{name:"bitrix24",matches:function(e,t){return document.querySelector(".b24-form")&&e.includes("bitrix/services/main/ajax.php?action=crm.site.form.fill")&&t[1].body instanceof FormData},getForm:function(){return document.querySelector(".b24-form form")}},{name:"sender",matches:function(e,t){return e.includes("stats.sender.net/forms")&&"string"==typeof t[1].body},getForm:function(){for(var e=document.querySelectorAll("iframe"),t=0;t{var t=_asyncToGenerator(_regenerator().m(function e(t){var n,o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t){e.n=1;break}return e.a(2,!1);case 1:return n=i(t),b=!0,e.p=2,e.n=3,new Promise(function(e,t){apbct_public_sendAJAX(n,{async:!0,callback:e,onErrorCallback:t})});case 3:return o=e.v,(a=void 0!==o.apbct&&+o.apbct.blocked||void 0!==o.data&&void 0!==o.data.message)&&(new ApbctShowForbidden).parseBlockMessage(o),e.a(2,a);case 4:return e.p=4,e.a(2,!1);case 5:return e.p=5,b=!1,e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(e){return t.apply(this,arguments)}})(),i=function(e){var t,n={action:"cleantalk_force_ajax_check"},o=_createForOfIteratorHelper(e.elements);try{for(o.s();!(t=o.n()).done;){var a=t.value;a.name&&(n[a.name]=a.value)}}catch(e){o.e(e)}finally{o.f()}return+ctPublic.bot_detector_enabled?n.ct_bot_detector_event_token=apbctLocalStorage.get("bot_detector_event_token"):n.ct_no_cookie_hidden_field=getNoCookieData(),n};window.fetch=_asyncToGenerator(_regenerator().m(function e(){var t,n,o,a,c,r,i,l,s,u,d,p=arguments;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:for(t=p.length,n=new Array(t),o=0;o!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))(a="string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.a(2,h.apply(this,n));e.n=2;break;case 2:if(n&&n[0]&&n[1]&&n[1].body){e.n=3;break}return e.a(2,h.apply(this,n));case 3:return e.n=4,m.processFetch(n);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=_(n[1].body,f(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,c=t.querySelector('[name*="apbct__email_id__"]'),r=null,i=(null!==c&&null!==c.value&&(r=c.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===i&&null===c&&null===l||(e.preventDefault(),n=function(){null!==c&&c.parentNode.removeChild(c),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=i,null!==r&&(o.apbct_search_form__honeypot_value=r),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,c=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var c=o.value,r=this.findParentContainer(c);if(r){var i=this.getIdFromHTML(r);if(i===n){var l=r.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"wrappers",[]),this.wrappers=this.findWrappers(),this.wrappers.length<1||this.checkBot()},[{key:"findWrappers",value:function(){return document.querySelectorAll("div.ct-encoded-form-wrapper")}},{key:"checkBot",value:function(){var t=this,e={post_url:document.location.href,referrer:document.referrer};+ctPublic.bot_detector_enabled?e.event_token=apbctLocalStorage.get("bot_detector_event_token"):e.event_javascript_data=getJavascriptClientData(),"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("force_protection_check_bot",{data:e,method:"POST",callback:function(e){return t.checkBotCallback(e)}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&(e.action="apbct_force_protection_check_bot",apbct_public_sendAJAX(e,{callback:function(e){return t.checkBotCallback(e)}}))}},{key:"checkBotCallback",value:function(e){if(e.data&&e.data.status&&200!==e.data.status)console.log("ApbctForceProtection connection error occurred"),this.decodeForms();else{if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return console.log("ApbctForceProtection decodeForms error",e),void this.decodeForms()}"object"===_typeof(e)&&e.allow&&1===e.allow?(this.decodeForms(),document.dispatchEvent(new Event("apbctForceProtectionAllowed"))):this.showMessageForBot(e.message)}}},{key:"decodeForms",value:function(){var n;this.wrappers.forEach(function(e){n=e.querySelector("div.ct-encoded-form").dataset.encodedForm;try{var t;n&&"string"==typeof n&&(t=decodeURIComponent(n),e.outerHTML=atob(t))}catch(e){console.log(e)}})}},{key:"showMessageForBot",value:function(t){this.wrappers.forEach(function(e){e.querySelector("div.ct-encoded-form").dataset.encodedForm&&(e.outerHTML='
'+t+"
")})}}]))(),apbctForceProtectionIsInitialized=!1;function apbctForceProtect(){apbctForceProtectionIsInitialized||(apbctForceProtectionIsInitialized=!0,+ctPublic.settings__forms__force_protection&&void 0!==ApbctForceProtection&&new ApbctForceProtection)}ctPublic.data__key_is_ok&&("loading"!==document.readyState?apbctForceProtect():apbct_attach_event_handler(document,"DOMContentLoaded",apbctForceProtect));var ctMouseReadInterval,ctMouseWriteDataInterval,ApbctGatheringData=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"setSessionId",value:function(){var e;apbctSessionStorage.isSet("apbct_session_id")?apbctLocalStorage.set("apbct_page_hits",Number(apbctLocalStorage.get("apbct_page_hits"))+1):(e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10),apbctSessionStorage.set("apbct_session_id",e,!1),apbctLocalStorage.set("apbct_page_hits",1),document.referrer&&new URL(document.referrer).host!==location.host&&apbctSessionStorage.set("apbct_site_referer",document.referrer,!1))}},{key:"writeReferrersToSessionStorage",value:function(){var e=apbctSessionStorage.get("apbct_session_current_page");!1!==e&&document.location.href!==e&&apbctSessionStorage.set("apbct_prev_referer",e,!1),apbctSessionStorage.set("apbct_session_current_page",document.location.href,!1)}},{key:"setCookiesType",value:function(){var e=apbctLocalStorage.get("ct_cookies_type");e&&e===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled"))}},{key:"startFieldsListening",value:function(){if(!apbctLocalStorage.isSet("ct_has_key_up")&&!apbctLocalStorage.get("ct_has_key_up")||!apbctLocalStorage.isSet("ct_has_input_focused")&&!apbctLocalStorage.get("ct_has_input_focused")||"native"!==ctPublic.data__cookies_type||void 0===ctGetCookie("ct_has_input_focused")||void 0===ctGetCookie("ct_has_key_up")){var e=ctGetPageForms();if(ctPublic.handled_fields=[],0_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"elementBody",document.querySelector("body")),_defineProperty(this,"collectionForms",document.forms),this.setListeners()},[{key:"setListeners",value:function(){var t=this;this.elementBody.addEventListener("click",function(e){t.checkElementInForms(e,"addClicks")}),this.elementBody.addEventListener("mouseup",function(e){"Range"==document.getSelection().type.toString()&&t.addSelected()}),this.elementBody.addEventListener("mousemove",function(e){t.checkElementInForms(e,"trackMouseMovement")})}},{key:"checkElementInForms",value:function(e,t){for(var n,o=0;o_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"fieldData",{isAutoFill:!1,isUseBuffer:!1,speedDelta:0,firstKeyTimestamp:0,lastKeyTimestamp:0,lastDelta:0,countOfKey:0}),_defineProperty(this,"fields",document.querySelectorAll("textarea[name=comment]")),_defineProperty(this,"data",[])},[{key:"gatheringFields",value:function(){var n=this;Array.prototype.slice.call(this.fields).forEach(function(e,t){n.data.push(Object.assign({},n.fieldData))})}},{key:"setListeners",value:function(){var o=this;this.fields.forEach(function(e,t){e.addEventListener("paste",function(){o.data[t].isUseBuffer=!0})}),this.fields.forEach(function(e,t){e.addEventListener("onautocomplete",function(){o.data[t].isAutoFill=!0})}),this.fields.forEach(function(e,n){e.addEventListener("input",function(){o.data[n].countOfKey++;var e,t=+new Date;1===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].firstKeyTimestamp=t):(e=t-o.data[n].lastKeyTimestamp,2===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].lastDelta=e):2{function o(){_classCallCheck(this,o)}return _createClass(o,null,[{key:"getFrontendDataLog",value:function(){var e=("undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.cookiePrefix?ctPublicFunctions.cookiePrefix:"")+o.LOG_KEY,t=o.LOG_KEY;if(void 0!==apbctLocalStorage&&apbctLocalStorage.get){var n=apbctLocalStorage.get(e)||apbctLocalStorage.get(t)||null;if(n&&"string"==typeof n)try{return JSON.parse(n)}catch(e){return""}return n}n=(n=localStorage.getItem(e))||localStorage.getItem(t)||null;try{return"string"==typeof n?JSON.parse(n):n}catch(e){return""}}},{key:"asDTO",value:function(){return{botd_logic_loaded:o.botdLogicLoaded,botd_wrapper_loaded:o.botdWrapperLoaded,frontend_data_log:"",transport_enabled:1}}},{key:"detectScripts",value:function(){if(o.botdWrapperLoaded&&o.botdLogicLoaded)return!0;for(var e=document.getElementsByTagName("script"),t=0;t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,c,r,i,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(i=document.createElement("strong")).append(d.phrases.trpHeading),(c=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),(r=document.createElement("div")).append(" "),r.append(i),r.append(d.phrases.trpContent1),(i=document.createElement("div")).style.display="flex",i.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),i.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),i.append(l)),c.append(r,i),a.append(c),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})})))}); \ No newline at end of file +function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;et||c=e.length?{done:!0}:{done:!1,value:e[c++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(c.data.forEach(function(e){e.encoded_email===a[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===a[t].href||0!==a[t].href.indexOf("mailto:")&&0!==a[t].href.indexOf("tel:"))a[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a[t])},2e3);else{if(0===a[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==a[t].href.indexOf("tel:"))return 0;e="tel:"}var o=a[t].href.replace(e,"");ctReplaceInTextNodes(a[t],o,ctHtmlToText(n.decoded_email)),a[t].href=e+n.decoded_email,a[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";c.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.textContent=ctHtmlToText(n)})}a[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=c.data[0];a.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a)},2e3),a.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctReplaceInTextNodes(e,t,n){if(t){e.normalize();for(var o,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);o=a.nextNode();)if(-1!==o.nodeValue.indexOf(t))return void(o.nodeValue=o.nodeValue.replace(t,function(){return n}))}}function ctHtmlToText(e){return e?(new DOMParser).parseFromString(String(e),"text/html").documentElement.textContent:""}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){for(var n=null,o=0;o$1')):(c.innerHTML="Loading...",t&&this.load(t)),c.setAttribute("id","cleantalk-modal-content"),n.append(c),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions._ajax_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(unescape(encodeURIComponent(JSON.stringify(t)))),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(unescape(encodeURIComponent(n))),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function p(){_classCallCheck(this,p)}return _createClass(p,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0{var n=_asyncToGenerator(_regenerator().m(function e(t,n){var o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(+ctPublic.settings__forms__check_external){e.n=1;break}return e.a(2,!1);case 1:o=_createForOfIteratorHelper(c),e.p=2,o.s();case 3:if((a=o.n()).done)e.n=6;else{if((a=a.value).matches(t,n))return a=a.getForm(),e.n=4,r(a);e.n=5}break;case 4:if(e.v)return e.a(2,!0);e.n=5;break;case 5:e.n=3;break;case 6:e.n=8;break;case 7:e.p=7,a=e.v,o.e(a);case 8:return e.p=8,o.f(),e.f(8);case 9:return e.a(2,!1)}},e,null,[[2,7,8,9]])}));return function(e,t){return n.apply(this,arguments)}})(),c=[{name:"bitrix24",matches:function(e,t){return document.querySelector(".b24-form")&&e.includes("bitrix/services/main/ajax.php?action=crm.site.form.fill")&&t[1].body instanceof FormData},getForm:function(){return document.querySelector(".b24-form form")}},{name:"sender",matches:function(e,t){return e.includes("stats.sender.net/forms")&&"string"==typeof t[1].body},getForm:function(){for(var e=document.querySelectorAll("iframe"),t=0;t{var t=_asyncToGenerator(_regenerator().m(function e(t){var n,o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t){e.n=1;break}return e.a(2,!1);case 1:return n=i(t),b=!0,e.p=2,e.n=3,new Promise(function(e,t){apbct_public_sendAJAX(n,{async:!0,callback:e,onErrorCallback:t})});case 3:return o=e.v,(a=void 0!==o.apbct&&+o.apbct.blocked||void 0!==o.data&&void 0!==o.data.message)&&(new ApbctShowForbidden).parseBlockMessage(o),e.a(2,a);case 4:return e.p=4,e.a(2,!1);case 5:return e.p=5,b=!1,e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(e){return t.apply(this,arguments)}})(),i=function(e){var t,n={action:"cleantalk_force_ajax_check"},o=_createForOfIteratorHelper(e.elements);try{for(o.s();!(t=o.n()).done;){var a=t.value;a.name&&(n[a.name]=a.value)}}catch(e){o.e(e)}finally{o.f()}return+ctPublic.bot_detector_enabled?n.ct_bot_detector_event_token=apbctLocalStorage.get("bot_detector_event_token"):n.ct_no_cookie_hidden_field=getNoCookieData(),n};window.fetch=_asyncToGenerator(_regenerator().m(function e(){var t,n,o,a,c,r,i,l,s,u,d,p=arguments;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:for(t=p.length,n=new Array(t),o=0;o!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))(a="string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.a(2,h.apply(this,n));e.n=2;break;case 2:if(n&&n[0]&&n[1]&&n[1].body){e.n=3;break}return e.a(2,h.apply(this,n));case 3:return e.n=4,m.processFetch(n);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=_(n[1].body,f(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,c=t.querySelector('[name*="apbct__email_id__"]'),r=null,i=(null!==c&&null!==c.value&&(r=c.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===i&&null===c&&null===l||(e.preventDefault(),n=function(){null!==c&&c.parentNode.removeChild(c),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=i,null!==r&&(o.apbct_search_form__honeypot_value=r),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,c=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var c=o.value,r=this.findParentContainer(c);if(r){var i=this.getIdFromHTML(r);if(i===n){var l=r.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"wrappers",[]),this.wrappers=this.findWrappers(),this.wrappers.length<1||this.checkBot()},[{key:"findWrappers",value:function(){var t=ctPublic.force_protection_wrapper_token;return t&&"string"==typeof t?Array.prototype.filter.call(document.querySelectorAll("div.ct-encoded-form-wrapper"),function(e){return e.getAttribute("data-ct-wrapper-token")===t}):[]}},{key:"checkBot",value:function(){var t=this,e={post_url:document.location.href,referrer:document.referrer};+ctPublic.bot_detector_enabled?e.event_token=apbctLocalStorage.get("bot_detector_event_token"):e.event_javascript_data=getJavascriptClientData(),"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("force_protection_check_bot",{data:e,method:"POST",callback:function(e){return t.checkBotCallback(e)}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&(e.action="apbct_force_protection_check_bot",apbct_public_sendAJAX(e,{callback:function(e){return t.checkBotCallback(e)}}))}},{key:"checkBotCallback",value:function(e){if(e.data&&e.data.status&&200!==e.data.status)console.log("ApbctForceProtection connection error occurred"),this.decodeForms();else{if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return console.log("ApbctForceProtection decodeForms error",e),void this.decodeForms()}"object"===_typeof(e)&&e.allow&&1===e.allow?(this.decodeForms(),document.dispatchEvent(new Event("apbctForceProtectionAllowed"))):this.showMessageForBot(e.message)}}},{key:"decodeForms",value:function(){var n;this.wrappers.forEach(function(e){n=e.querySelector("div.ct-encoded-form").dataset.encodedForm;try{var t;n&&"string"==typeof n&&(t=decodeURIComponent(n),e.outerHTML=atob(t))}catch(e){console.log(e)}})}},{key:"showMessageForBot",value:function(n){this.wrappers.forEach(function(e){var t;e.querySelector("div.ct-encoded-form").dataset.encodedForm&&((t=document.createElement("div")).className="ct-encoded-form-forbidden",t.textContent=n?String(n):"",e.parentNode.replaceChild(t,e))})}}]))(),apbctForceProtectionIsInitialized=!1;function apbctForceProtect(){apbctForceProtectionIsInitialized||(apbctForceProtectionIsInitialized=!0,+ctPublic.settings__forms__force_protection&&void 0!==ApbctForceProtection&&new ApbctForceProtection)}ctPublic.data__key_is_ok&&("loading"!==document.readyState?apbctForceProtect():apbct_attach_event_handler(document,"DOMContentLoaded",apbctForceProtect));var ctMouseReadInterval,ctMouseWriteDataInterval,ApbctGatheringData=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"setSessionId",value:function(){var e;apbctSessionStorage.isSet("apbct_session_id")?apbctLocalStorage.set("apbct_page_hits",Number(apbctLocalStorage.get("apbct_page_hits"))+1):(e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10),apbctSessionStorage.set("apbct_session_id",e,!1),apbctLocalStorage.set("apbct_page_hits",1),document.referrer&&new URL(document.referrer).host!==location.host&&apbctSessionStorage.set("apbct_site_referer",document.referrer,!1))}},{key:"writeReferrersToSessionStorage",value:function(){var e=apbctSessionStorage.get("apbct_session_current_page");!1!==e&&document.location.href!==e&&apbctSessionStorage.set("apbct_prev_referer",e,!1),apbctSessionStorage.set("apbct_session_current_page",document.location.href,!1)}},{key:"setCookiesType",value:function(){var e=apbctLocalStorage.get("ct_cookies_type");e&&e===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled"))}},{key:"startFieldsListening",value:function(){if(!apbctLocalStorage.isSet("ct_has_key_up")&&!apbctLocalStorage.get("ct_has_key_up")||!apbctLocalStorage.isSet("ct_has_input_focused")&&!apbctLocalStorage.get("ct_has_input_focused")||"native"!==ctPublic.data__cookies_type||void 0===ctGetCookie("ct_has_input_focused")||void 0===ctGetCookie("ct_has_key_up")){var e=ctGetPageForms();if(ctPublic.handled_fields=[],0_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"elementBody",document.querySelector("body")),_defineProperty(this,"collectionForms",document.forms),this.setListeners()},[{key:"setListeners",value:function(){var t=this;this.elementBody.addEventListener("click",function(e){t.checkElementInForms(e,"addClicks")}),this.elementBody.addEventListener("mouseup",function(e){"Range"==document.getSelection().type.toString()&&t.addSelected()}),this.elementBody.addEventListener("mousemove",function(e){t.checkElementInForms(e,"trackMouseMovement")})}},{key:"checkElementInForms",value:function(e,t){for(var n,o=0;o_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"fieldData",{isAutoFill:!1,isUseBuffer:!1,speedDelta:0,firstKeyTimestamp:0,lastKeyTimestamp:0,lastDelta:0,countOfKey:0}),_defineProperty(this,"fields",document.querySelectorAll("textarea[name=comment]")),_defineProperty(this,"data",[])},[{key:"gatheringFields",value:function(){var n=this;Array.prototype.slice.call(this.fields).forEach(function(e,t){n.data.push(Object.assign({},n.fieldData))})}},{key:"setListeners",value:function(){var o=this;this.fields.forEach(function(e,t){e.addEventListener("paste",function(){o.data[t].isUseBuffer=!0})}),this.fields.forEach(function(e,t){e.addEventListener("onautocomplete",function(){o.data[t].isAutoFill=!0})}),this.fields.forEach(function(e,n){e.addEventListener("input",function(){o.data[n].countOfKey++;var e,t=+new Date;1===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].firstKeyTimestamp=t):(e=t-o.data[n].lastKeyTimestamp,2===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].lastDelta=e):2{function o(){_classCallCheck(this,o)}return _createClass(o,null,[{key:"getFrontendDataLog",value:function(){var e=("undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.cookiePrefix?ctPublicFunctions.cookiePrefix:"")+o.LOG_KEY,t=o.LOG_KEY;if(void 0!==apbctLocalStorage&&apbctLocalStorage.get){var n=apbctLocalStorage.get(e)||apbctLocalStorage.get(t)||null;if(n&&"string"==typeof n)try{return JSON.parse(n)}catch(e){return""}return n}n=(n=localStorage.getItem(e))||localStorage.getItem(t)||null;try{return"string"==typeof n?JSON.parse(n):n}catch(e){return""}}},{key:"asDTO",value:function(){return{botd_logic_loaded:o.botdLogicLoaded,botd_wrapper_loaded:o.botdWrapperLoaded,frontend_data_log:"",transport_enabled:1}}},{key:"detectScripts",value:function(){if(o.botdWrapperLoaded&&o.botdLogicLoaded)return!0;for(var e=document.getElementsByTagName("script"),t=0;t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,c,r,i,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(i=document.createElement("strong")).append(d.phrases.trpHeading),(c=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),(r=document.createElement("div")).append(" "),r.append(i),r.append(d.phrases.trpContent1),(i=document.createElement("div")).style.display="flex",i.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),i.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),i.append(l)),c.append(r,i),a.append(c),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})})))}); \ No newline at end of file diff --git a/js/apbct-public-bundle_gathering.min.js b/js/apbct-public-bundle_gathering.min.js index 1c57c4a73..b34337345 100644 --- a/js/apbct-public-bundle_gathering.min.js +++ b/js/apbct-public-bundle_gathering.min.js @@ -1 +1 @@ -function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;et||r=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(r.data.forEach(function(e){e.encoded_email===a[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===a[t].href||0!==a[t].href.indexOf("mailto:")&&0!==a[t].href.indexOf("tel:"))a[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a[t])},2e3);else{if(0===a[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==a[t].href.indexOf("tel:"))return 0;e="tel:"}var o=a[t].href.replace(e,"");ctReplaceInTextNodes(a[t],o,ctHtmlToText(n.decoded_email)),a[t].href=e+n.decoded_email,a[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";r.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.textContent=ctHtmlToText(n)})}a[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=r.data[0];a.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a)},2e3),a.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctReplaceInTextNodes(e,t,n){if(t){e.normalize();for(var o,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);o=a.nextNode();)if(-1!==o.nodeValue.indexOf(t))return void(o.nodeValue=o.nodeValue.replace(t,function(){return n}))}}function ctHtmlToText(e){return e?(new DOMParser).parseFromString(String(e),"text/html").documentElement.textContent:""}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}var ctEmailDecoderIsInitialized=!1,cleantalkModal=(document.addEventListener("DOMContentLoaded",function(){if(!ctEmailDecoderIsInitialized){ctEmailDecoderIsInitialized=!0;var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1')):(r.innerHTML="Loading...",t&&this.load(t)),r.setAttribute("id","cleantalk-modal-content"),n.append(r),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions._ajax_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(unescape(encodeURIComponent(JSON.stringify(t)))),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(unescape(encodeURIComponent(n))),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function p(){_classCallCheck(this,p)}return _createClass(p,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0{var n=_asyncToGenerator(_regenerator().m(function e(t,n){var o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(+ctPublic.settings__forms__check_external){e.n=1;break}return e.a(2,!1);case 1:o=_createForOfIteratorHelper(r),e.p=2,o.s();case 3:if((a=o.n()).done)e.n=6;else{if((a=a.value).matches(t,n))return a=a.getForm(),e.n=4,c(a);e.n=5}break;case 4:if(e.v)return e.a(2,!0);e.n=5;break;case 5:e.n=3;break;case 6:e.n=8;break;case 7:e.p=7,a=e.v,o.e(a);case 8:return e.p=8,o.f(),e.f(8);case 9:return e.a(2,!1)}},e,null,[[2,7,8,9]])}));return function(e,t){return n.apply(this,arguments)}})(),r=[{name:"bitrix24",matches:function(e,t){return document.querySelector(".b24-form")&&e.includes("bitrix/services/main/ajax.php?action=crm.site.form.fill")&&t[1].body instanceof FormData},getForm:function(){return document.querySelector(".b24-form form")}},{name:"sender",matches:function(e,t){return e.includes("stats.sender.net/forms")&&"string"==typeof t[1].body},getForm:function(){for(var e=document.querySelectorAll("iframe"),t=0;t{var t=_asyncToGenerator(_regenerator().m(function e(t){var n,o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t){e.n=1;break}return e.a(2,!1);case 1:return n=i(t),m=!0,e.p=2,e.n=3,new Promise(function(e,t){apbct_public_sendAJAX(n,{async:!0,callback:e,onErrorCallback:t})});case 3:return o=e.v,(a=void 0!==o.apbct&&+o.apbct.blocked||void 0!==o.data&&void 0!==o.data.message)&&(new ApbctShowForbidden).parseBlockMessage(o),e.a(2,a);case 4:return e.p=4,e.a(2,!1);case 5:return e.p=5,m=!1,e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(e){return t.apply(this,arguments)}})(),i=function(e){var t,n={action:"cleantalk_force_ajax_check"},o=_createForOfIteratorHelper(e.elements);try{for(o.s();!(t=o.n()).done;){var a=t.value;a.name&&(n[a.name]=a.value)}}catch(e){o.e(e)}finally{o.f()}return+ctPublic.bot_detector_enabled?n.ct_bot_detector_event_token=apbctLocalStorage.get("bot_detector_event_token"):n.ct_no_cookie_hidden_field=getNoCookieData(),n};window.fetch=_asyncToGenerator(_regenerator().m(function e(){var t,n,o,a,r,c,i,l,s,u,d,p=arguments;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:for(t=p.length,n=new Array(t),o=0;o!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))(a="string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.a(2,h.apply(this,n));e.n=2;break;case 2:if(n&&n[0]&&n[1]&&n[1].body){e.n=3;break}return e.a(2,h.apply(this,n));case 3:return e.n=4,b.processFetch(n);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=f(n[1].body,_(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,r=t.querySelector('[name*="apbct__email_id__"]'),c=null,i=(null!==r&&null!==r.value&&(c=r.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===i&&null===r&&null===l||(e.preventDefault(),n=function(){null!==r&&r.parentNode.removeChild(r),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=i,null!==c&&(o.apbct_search_form__honeypot_value=c),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,r=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var r=o.value,c=this.findParentContainer(r);if(c){var i=this.getIdFromHTML(c);if(i===n){var l=c.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t_createClass(function e(){_classCallCheck(this,e)},[{key:"setSessionId",value:function(){var e;apbctSessionStorage.isSet("apbct_session_id")?apbctLocalStorage.set("apbct_page_hits",Number(apbctLocalStorage.get("apbct_page_hits"))+1):(e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10),apbctSessionStorage.set("apbct_session_id",e,!1),apbctLocalStorage.set("apbct_page_hits",1),document.referrer&&new URL(document.referrer).host!==location.host&&apbctSessionStorage.set("apbct_site_referer",document.referrer,!1))}},{key:"writeReferrersToSessionStorage",value:function(){var e=apbctSessionStorage.get("apbct_session_current_page");!1!==e&&document.location.href!==e&&apbctSessionStorage.set("apbct_prev_referer",e,!1),apbctSessionStorage.set("apbct_session_current_page",document.location.href,!1)}},{key:"setCookiesType",value:function(){var e=apbctLocalStorage.get("ct_cookies_type");e&&e===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled"))}},{key:"startFieldsListening",value:function(){if(!apbctLocalStorage.isSet("ct_has_key_up")&&!apbctLocalStorage.get("ct_has_key_up")||!apbctLocalStorage.isSet("ct_has_input_focused")&&!apbctLocalStorage.get("ct_has_input_focused")||"native"!==ctPublic.data__cookies_type||void 0===ctGetCookie("ct_has_input_focused")||void 0===ctGetCookie("ct_has_key_up")){var e=ctGetPageForms();if(ctPublic.handled_fields=[],0_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"elementBody",document.querySelector("body")),_defineProperty(this,"collectionForms",document.forms),this.setListeners()},[{key:"setListeners",value:function(){var t=this;this.elementBody.addEventListener("click",function(e){t.checkElementInForms(e,"addClicks")}),this.elementBody.addEventListener("mouseup",function(e){"Range"==document.getSelection().type.toString()&&t.addSelected()}),this.elementBody.addEventListener("mousemove",function(e){t.checkElementInForms(e,"trackMouseMovement")})}},{key:"checkElementInForms",value:function(e,t){for(var n,o=0;o_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"fieldData",{isAutoFill:!1,isUseBuffer:!1,speedDelta:0,firstKeyTimestamp:0,lastKeyTimestamp:0,lastDelta:0,countOfKey:0}),_defineProperty(this,"fields",document.querySelectorAll("textarea[name=comment]")),_defineProperty(this,"data",[])},[{key:"gatheringFields",value:function(){var n=this;Array.prototype.slice.call(this.fields).forEach(function(e,t){n.data.push(Object.assign({},n.fieldData))})}},{key:"setListeners",value:function(){var o=this;this.fields.forEach(function(e,t){e.addEventListener("paste",function(){o.data[t].isUseBuffer=!0})}),this.fields.forEach(function(e,t){e.addEventListener("onautocomplete",function(){o.data[t].isAutoFill=!0})}),this.fields.forEach(function(e,n){e.addEventListener("input",function(){o.data[n].countOfKey++;var e,t=+new Date;1===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].firstKeyTimestamp=t):(e=t-o.data[n].lastKeyTimestamp,2===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].lastDelta=e):2{function o(){_classCallCheck(this,o)}return _createClass(o,null,[{key:"getFrontendDataLog",value:function(){var e=("undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.cookiePrefix?ctPublicFunctions.cookiePrefix:"")+o.LOG_KEY,t=o.LOG_KEY;if(void 0!==apbctLocalStorage&&apbctLocalStorage.get){var n=apbctLocalStorage.get(e)||apbctLocalStorage.get(t)||null;if(n&&"string"==typeof n)try{return JSON.parse(n)}catch(e){return""}return n}n=(n=localStorage.getItem(e))||localStorage.getItem(t)||null;try{return"string"==typeof n?JSON.parse(n):n}catch(e){return""}}},{key:"asDTO",value:function(){return{botd_logic_loaded:o.botdLogicLoaded,botd_wrapper_loaded:o.botdWrapperLoaded,frontend_data_log:"",transport_enabled:1}}},{key:"detectScripts",value:function(){if(o.botdWrapperLoaded&&o.botdLogicLoaded)return!0;for(var e=document.getElementsByTagName("script"),t=0;t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,r,c,i,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(i=document.createElement("strong")).append(d.phrases.trpHeading),(r=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),(c=document.createElement("div")).append(" "),c.append(i),c.append(d.phrases.trpContent1),(i=document.createElement("div")).style.display="flex",i.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),i.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),i.append(l)),r.append(c,i),a.append(r),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})})))}); \ No newline at end of file +function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;et||c=e.length?{done:!0}:{done:!1,value:e[c++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(c.data.forEach(function(e){e.encoded_email===a[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===a[t].href||0!==a[t].href.indexOf("mailto:")&&0!==a[t].href.indexOf("tel:"))a[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a[t])},2e3);else{if(0===a[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==a[t].href.indexOf("tel:"))return 0;e="tel:"}var o=a[t].href.replace(e,"");ctReplaceInTextNodes(a[t],o,ctHtmlToText(n.decoded_email)),a[t].href=e+n.decoded_email,a[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";c.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.textContent=ctHtmlToText(n)})}a[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=c.data[0];a.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a)},2e3),a.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctReplaceInTextNodes(e,t,n){if(t){e.normalize();for(var o,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);o=a.nextNode();)if(-1!==o.nodeValue.indexOf(t))return void(o.nodeValue=o.nodeValue.replace(t,function(){return n}))}}function ctHtmlToText(e){return e?(new DOMParser).parseFromString(String(e),"text/html").documentElement.textContent:""}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){for(var n=null,o=0;o$1')):(c.innerHTML="Loading...",t&&this.load(t)),c.setAttribute("id","cleantalk-modal-content"),n.append(c),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions._ajax_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(unescape(encodeURIComponent(JSON.stringify(t)))),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(unescape(encodeURIComponent(n))),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function p(){_classCallCheck(this,p)}return _createClass(p,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0{var n=_asyncToGenerator(_regenerator().m(function e(t,n){var o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(+ctPublic.settings__forms__check_external){e.n=1;break}return e.a(2,!1);case 1:o=_createForOfIteratorHelper(c),e.p=2,o.s();case 3:if((a=o.n()).done)e.n=6;else{if((a=a.value).matches(t,n))return a=a.getForm(),e.n=4,r(a);e.n=5}break;case 4:if(e.v)return e.a(2,!0);e.n=5;break;case 5:e.n=3;break;case 6:e.n=8;break;case 7:e.p=7,a=e.v,o.e(a);case 8:return e.p=8,o.f(),e.f(8);case 9:return e.a(2,!1)}},e,null,[[2,7,8,9]])}));return function(e,t){return n.apply(this,arguments)}})(),c=[{name:"bitrix24",matches:function(e,t){return document.querySelector(".b24-form")&&e.includes("bitrix/services/main/ajax.php?action=crm.site.form.fill")&&t[1].body instanceof FormData},getForm:function(){return document.querySelector(".b24-form form")}},{name:"sender",matches:function(e,t){return e.includes("stats.sender.net/forms")&&"string"==typeof t[1].body},getForm:function(){for(var e=document.querySelectorAll("iframe"),t=0;t{var t=_asyncToGenerator(_regenerator().m(function e(t){var n,o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t){e.n=1;break}return e.a(2,!1);case 1:return n=i(t),m=!0,e.p=2,e.n=3,new Promise(function(e,t){apbct_public_sendAJAX(n,{async:!0,callback:e,onErrorCallback:t})});case 3:return o=e.v,(a=void 0!==o.apbct&&+o.apbct.blocked||void 0!==o.data&&void 0!==o.data.message)&&(new ApbctShowForbidden).parseBlockMessage(o),e.a(2,a);case 4:return e.p=4,e.a(2,!1);case 5:return e.p=5,m=!1,e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(e){return t.apply(this,arguments)}})(),i=function(e){var t,n={action:"cleantalk_force_ajax_check"},o=_createForOfIteratorHelper(e.elements);try{for(o.s();!(t=o.n()).done;){var a=t.value;a.name&&(n[a.name]=a.value)}}catch(e){o.e(e)}finally{o.f()}return+ctPublic.bot_detector_enabled?n.ct_bot_detector_event_token=apbctLocalStorage.get("bot_detector_event_token"):n.ct_no_cookie_hidden_field=getNoCookieData(),n};window.fetch=_asyncToGenerator(_regenerator().m(function e(){var t,n,o,a,c,r,i,l,s,u,d,p=arguments;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:for(t=p.length,n=new Array(t),o=0;o!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))(a="string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.a(2,h.apply(this,n));e.n=2;break;case 2:if(n&&n[0]&&n[1]&&n[1].body){e.n=3;break}return e.a(2,h.apply(this,n));case 3:return e.n=4,b.processFetch(n);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=f(n[1].body,_(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,c=t.querySelector('[name*="apbct__email_id__"]'),r=null,i=(null!==c&&null!==c.value&&(r=c.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===i&&null===c&&null===l||(e.preventDefault(),n=function(){null!==c&&c.parentNode.removeChild(c),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=i,null!==r&&(o.apbct_search_form__honeypot_value=r),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,c=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var c=o.value,r=this.findParentContainer(c);if(r){var i=this.getIdFromHTML(r);if(i===n){var l=r.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t_createClass(function e(){_classCallCheck(this,e)},[{key:"setSessionId",value:function(){var e;apbctSessionStorage.isSet("apbct_session_id")?apbctLocalStorage.set("apbct_page_hits",Number(apbctLocalStorage.get("apbct_page_hits"))+1):(e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10),apbctSessionStorage.set("apbct_session_id",e,!1),apbctLocalStorage.set("apbct_page_hits",1),document.referrer&&new URL(document.referrer).host!==location.host&&apbctSessionStorage.set("apbct_site_referer",document.referrer,!1))}},{key:"writeReferrersToSessionStorage",value:function(){var e=apbctSessionStorage.get("apbct_session_current_page");!1!==e&&document.location.href!==e&&apbctSessionStorage.set("apbct_prev_referer",e,!1),apbctSessionStorage.set("apbct_session_current_page",document.location.href,!1)}},{key:"setCookiesType",value:function(){var e=apbctLocalStorage.get("ct_cookies_type");e&&e===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled"))}},{key:"startFieldsListening",value:function(){if(!apbctLocalStorage.isSet("ct_has_key_up")&&!apbctLocalStorage.get("ct_has_key_up")||!apbctLocalStorage.isSet("ct_has_input_focused")&&!apbctLocalStorage.get("ct_has_input_focused")||"native"!==ctPublic.data__cookies_type||void 0===ctGetCookie("ct_has_input_focused")||void 0===ctGetCookie("ct_has_key_up")){var e=ctGetPageForms();if(ctPublic.handled_fields=[],0_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"elementBody",document.querySelector("body")),_defineProperty(this,"collectionForms",document.forms),this.setListeners()},[{key:"setListeners",value:function(){var t=this;this.elementBody.addEventListener("click",function(e){t.checkElementInForms(e,"addClicks")}),this.elementBody.addEventListener("mouseup",function(e){"Range"==document.getSelection().type.toString()&&t.addSelected()}),this.elementBody.addEventListener("mousemove",function(e){t.checkElementInForms(e,"trackMouseMovement")})}},{key:"checkElementInForms",value:function(e,t){for(var n,o=0;o_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"fieldData",{isAutoFill:!1,isUseBuffer:!1,speedDelta:0,firstKeyTimestamp:0,lastKeyTimestamp:0,lastDelta:0,countOfKey:0}),_defineProperty(this,"fields",document.querySelectorAll("textarea[name=comment]")),_defineProperty(this,"data",[])},[{key:"gatheringFields",value:function(){var n=this;Array.prototype.slice.call(this.fields).forEach(function(e,t){n.data.push(Object.assign({},n.fieldData))})}},{key:"setListeners",value:function(){var o=this;this.fields.forEach(function(e,t){e.addEventListener("paste",function(){o.data[t].isUseBuffer=!0})}),this.fields.forEach(function(e,t){e.addEventListener("onautocomplete",function(){o.data[t].isAutoFill=!0})}),this.fields.forEach(function(e,n){e.addEventListener("input",function(){o.data[n].countOfKey++;var e,t=+new Date;1===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].firstKeyTimestamp=t):(e=t-o.data[n].lastKeyTimestamp,2===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].lastDelta=e):2{function o(){_classCallCheck(this,o)}return _createClass(o,null,[{key:"getFrontendDataLog",value:function(){var e=("undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.cookiePrefix?ctPublicFunctions.cookiePrefix:"")+o.LOG_KEY,t=o.LOG_KEY;if(void 0!==apbctLocalStorage&&apbctLocalStorage.get){var n=apbctLocalStorage.get(e)||apbctLocalStorage.get(t)||null;if(n&&"string"==typeof n)try{return JSON.parse(n)}catch(e){return""}return n}n=(n=localStorage.getItem(e))||localStorage.getItem(t)||null;try{return"string"==typeof n?JSON.parse(n):n}catch(e){return""}}},{key:"asDTO",value:function(){return{botd_logic_loaded:o.botdLogicLoaded,botd_wrapper_loaded:o.botdWrapperLoaded,frontend_data_log:"",transport_enabled:1}}},{key:"detectScripts",value:function(){if(o.botdWrapperLoaded&&o.botdLogicLoaded)return!0;for(var e=document.getElementsByTagName("script"),t=0;t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,c,r,i,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(i=document.createElement("strong")).append(d.phrases.trpHeading),(c=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),(r=document.createElement("div")).append(" "),r.append(i),r.append(d.phrases.trpContent1),(i=document.createElement("div")).style.display="flex",i.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),i.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),i.append(l)),c.append(r,i),a.append(c),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})})))}); \ No newline at end of file diff --git a/js/apbct-public-bundle_int-protection.min.js b/js/apbct-public-bundle_int-protection.min.js index 700be4969..2d4d088a7 100644 --- a/js/apbct-public-bundle_int-protection.min.js +++ b/js/apbct-public-bundle_int-protection.min.js @@ -1 +1 @@ -function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;et||r=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(r.data.forEach(function(e){e.encoded_email===a[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===a[t].href||0!==a[t].href.indexOf("mailto:")&&0!==a[t].href.indexOf("tel:"))a[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a[t])},2e3);else{if(0===a[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==a[t].href.indexOf("tel:"))return 0;e="tel:"}var o=a[t].href.replace(e,"");ctReplaceInTextNodes(a[t],o,ctHtmlToText(n.decoded_email)),a[t].href=e+n.decoded_email,a[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";r.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.textContent=ctHtmlToText(n)})}a[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=r.data[0];a.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a)},2e3),a.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctReplaceInTextNodes(e,t,n){if(t){e.normalize();for(var o,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);o=a.nextNode();)if(-1!==o.nodeValue.indexOf(t))return void(o.nodeValue=o.nodeValue.replace(t,function(){return n}))}}function ctHtmlToText(e){return e?(new DOMParser).parseFromString(String(e),"text/html").documentElement.textContent:""}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}var ctEmailDecoderIsInitialized=!1,cleantalkModal=(document.addEventListener("DOMContentLoaded",function(){if(!ctEmailDecoderIsInitialized){ctEmailDecoderIsInitialized=!0;var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1')):(r.innerHTML="Loading...",t&&this.load(t)),r.setAttribute("id","cleantalk-modal-content"),n.append(r),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions._ajax_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(unescape(encodeURIComponent(JSON.stringify(t)))),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(unescape(encodeURIComponent(n))),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function p(){_classCallCheck(this,p)}return _createClass(p,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0{var n=_asyncToGenerator(_regenerator().m(function e(t,n){var o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(+ctPublic.settings__forms__check_external){e.n=1;break}return e.a(2,!1);case 1:o=_createForOfIteratorHelper(r),e.p=2,o.s();case 3:if((a=o.n()).done)e.n=6;else{if((a=a.value).matches(t,n))return a=a.getForm(),e.n=4,i(a);e.n=5}break;case 4:if(e.v)return e.a(2,!0);e.n=5;break;case 5:e.n=3;break;case 6:e.n=8;break;case 7:e.p=7,a=e.v,o.e(a);case 8:return e.p=8,o.f(),e.f(8);case 9:return e.a(2,!1)}},e,null,[[2,7,8,9]])}));return function(e,t){return n.apply(this,arguments)}})(),r=[{name:"bitrix24",matches:function(e,t){return document.querySelector(".b24-form")&&e.includes("bitrix/services/main/ajax.php?action=crm.site.form.fill")&&t[1].body instanceof FormData},getForm:function(){return document.querySelector(".b24-form form")}},{name:"sender",matches:function(e,t){return e.includes("stats.sender.net/forms")&&"string"==typeof t[1].body},getForm:function(){for(var e=document.querySelectorAll("iframe"),t=0;t{var t=_asyncToGenerator(_regenerator().m(function e(t){var n,o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t){e.n=1;break}return e.a(2,!1);case 1:return n=c(t),b=!0,e.p=2,e.n=3,new Promise(function(e,t){apbct_public_sendAJAX(n,{async:!0,callback:e,onErrorCallback:t})});case 3:return o=e.v,(a=void 0!==o.apbct&&+o.apbct.blocked||void 0!==o.data&&void 0!==o.data.message)&&(new ApbctShowForbidden).parseBlockMessage(o),e.a(2,a);case 4:return e.p=4,e.a(2,!1);case 5:return e.p=5,b=!1,e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(e){return t.apply(this,arguments)}})(),c=function(e){var t,n={action:"cleantalk_force_ajax_check"},o=_createForOfIteratorHelper(e.elements);try{for(o.s();!(t=o.n()).done;){var a=t.value;a.name&&(n[a.name]=a.value)}}catch(e){o.e(e)}finally{o.f()}return+ctPublic.bot_detector_enabled?n.ct_bot_detector_event_token=apbctLocalStorage.get("bot_detector_event_token"):n.ct_no_cookie_hidden_field=getNoCookieData(),n};window.fetch=_asyncToGenerator(_regenerator().m(function e(){var t,n,o,a,r,i,c,l,s,u,d,p=arguments;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:for(t=p.length,n=new Array(t),o=0;o!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))(a="string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.a(2,h.apply(this,n));e.n=2;break;case 2:if(n&&n[0]&&n[1]&&n[1].body){e.n=3;break}return e.a(2,h.apply(this,n));case 3:return e.n=4,m.processFetch(n);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=_(n[1].body,f(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,r=t.querySelector('[name*="apbct__email_id__"]'),i=null,c=(null!==r&&null!==r.value&&(i=r.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===c&&null===r&&null===l||(e.preventDefault(),n=function(){null!==r&&r.parentNode.removeChild(r),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=c,null!==i&&(o.apbct_search_form__honeypot_value=i),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,r=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var r=o.value,i=this.findParentContainer(r);if(i){var c=this.getIdFromHTML(i);if(c===n){var l=i.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t{function o(){_classCallCheck(this,o)}return _createClass(o,null,[{key:"getFrontendDataLog",value:function(){var e=("undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.cookiePrefix?ctPublicFunctions.cookiePrefix:"")+o.LOG_KEY,t=o.LOG_KEY;if(void 0!==apbctLocalStorage&&apbctLocalStorage.get){var n=apbctLocalStorage.get(e)||apbctLocalStorage.get(t)||null;if(n&&"string"==typeof n)try{return JSON.parse(n)}catch(e){return""}return n}n=(n=localStorage.getItem(e))||localStorage.getItem(t)||null;try{return"string"==typeof n?JSON.parse(n):n}catch(e){return""}}},{key:"asDTO",value:function(){return{botd_logic_loaded:o.botdLogicLoaded,botd_wrapper_loaded:o.botdWrapperLoaded,frontend_data_log:"",transport_enabled:1}}},{key:"detectScripts",value:function(){if(o.botdWrapperLoaded&&o.botdLogicLoaded)return!0;for(var e=document.getElementsByTagName("script"),t=0;t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,r,i,c,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(c=document.createElement("strong")).append(d.phrases.trpHeading),(r=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),(i=document.createElement("div")).append(" "),i.append(c),i.append(d.phrases.trpContent1),(c=document.createElement("div")).style.display="flex",c.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),c.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),c.append(l)),r.append(i,c),a.append(r),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})})))}); \ No newline at end of file +function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;et||r=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(r.data.forEach(function(e){e.encoded_email===a[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===a[t].href||0!==a[t].href.indexOf("mailto:")&&0!==a[t].href.indexOf("tel:"))a[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a[t])},2e3);else{if(0===a[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==a[t].href.indexOf("tel:"))return 0;e="tel:"}var o=a[t].href.replace(e,"");ctReplaceInTextNodes(a[t],o,ctHtmlToText(n.decoded_email)),a[t].href=e+n.decoded_email,a[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";r.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.textContent=ctHtmlToText(n)})}a[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=r.data[0];a.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a)},2e3),a.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctReplaceInTextNodes(e,t,n){if(t){e.normalize();for(var o,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);o=a.nextNode();)if(-1!==o.nodeValue.indexOf(t))return void(o.nodeValue=o.nodeValue.replace(t,function(){return n}))}}function ctHtmlToText(e){return e?(new DOMParser).parseFromString(String(e),"text/html").documentElement.textContent:""}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){for(var n=null,o=0;o$1')):(r.innerHTML="Loading...",t&&this.load(t)),r.setAttribute("id","cleantalk-modal-content"),n.append(r),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions._ajax_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(unescape(encodeURIComponent(JSON.stringify(t)))),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(unescape(encodeURIComponent(n))),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function p(){_classCallCheck(this,p)}return _createClass(p,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0{var n=_asyncToGenerator(_regenerator().m(function e(t,n){var o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(+ctPublic.settings__forms__check_external){e.n=1;break}return e.a(2,!1);case 1:o=_createForOfIteratorHelper(r),e.p=2,o.s();case 3:if((a=o.n()).done)e.n=6;else{if((a=a.value).matches(t,n))return a=a.getForm(),e.n=4,i(a);e.n=5}break;case 4:if(e.v)return e.a(2,!0);e.n=5;break;case 5:e.n=3;break;case 6:e.n=8;break;case 7:e.p=7,a=e.v,o.e(a);case 8:return e.p=8,o.f(),e.f(8);case 9:return e.a(2,!1)}},e,null,[[2,7,8,9]])}));return function(e,t){return n.apply(this,arguments)}})(),r=[{name:"bitrix24",matches:function(e,t){return document.querySelector(".b24-form")&&e.includes("bitrix/services/main/ajax.php?action=crm.site.form.fill")&&t[1].body instanceof FormData},getForm:function(){return document.querySelector(".b24-form form")}},{name:"sender",matches:function(e,t){return e.includes("stats.sender.net/forms")&&"string"==typeof t[1].body},getForm:function(){for(var e=document.querySelectorAll("iframe"),t=0;t{var t=_asyncToGenerator(_regenerator().m(function e(t){var n,o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t){e.n=1;break}return e.a(2,!1);case 1:return n=c(t),b=!0,e.p=2,e.n=3,new Promise(function(e,t){apbct_public_sendAJAX(n,{async:!0,callback:e,onErrorCallback:t})});case 3:return o=e.v,(a=void 0!==o.apbct&&+o.apbct.blocked||void 0!==o.data&&void 0!==o.data.message)&&(new ApbctShowForbidden).parseBlockMessage(o),e.a(2,a);case 4:return e.p=4,e.a(2,!1);case 5:return e.p=5,b=!1,e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(e){return t.apply(this,arguments)}})(),c=function(e){var t,n={action:"cleantalk_force_ajax_check"},o=_createForOfIteratorHelper(e.elements);try{for(o.s();!(t=o.n()).done;){var a=t.value;a.name&&(n[a.name]=a.value)}}catch(e){o.e(e)}finally{o.f()}return+ctPublic.bot_detector_enabled?n.ct_bot_detector_event_token=apbctLocalStorage.get("bot_detector_event_token"):n.ct_no_cookie_hidden_field=getNoCookieData(),n};window.fetch=_asyncToGenerator(_regenerator().m(function e(){var t,n,o,a,r,i,c,l,s,u,d,p=arguments;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:for(t=p.length,n=new Array(t),o=0;o!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))(a="string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.a(2,h.apply(this,n));e.n=2;break;case 2:if(n&&n[0]&&n[1]&&n[1].body){e.n=3;break}return e.a(2,h.apply(this,n));case 3:return e.n=4,m.processFetch(n);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=_(n[1].body,f(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,r=t.querySelector('[name*="apbct__email_id__"]'),i=null,c=(null!==r&&null!==r.value&&(i=r.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===c&&null===r&&null===l||(e.preventDefault(),n=function(){null!==r&&r.parentNode.removeChild(r),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=c,null!==i&&(o.apbct_search_form__honeypot_value=i),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,r=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var r=o.value,i=this.findParentContainer(r);if(i){var c=this.getIdFromHTML(i);if(c===n){var l=i.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t{function o(){_classCallCheck(this,o)}return _createClass(o,null,[{key:"getFrontendDataLog",value:function(){var e=("undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.cookiePrefix?ctPublicFunctions.cookiePrefix:"")+o.LOG_KEY,t=o.LOG_KEY;if(void 0!==apbctLocalStorage&&apbctLocalStorage.get){var n=apbctLocalStorage.get(e)||apbctLocalStorage.get(t)||null;if(n&&"string"==typeof n)try{return JSON.parse(n)}catch(e){return""}return n}n=(n=localStorage.getItem(e))||localStorage.getItem(t)||null;try{return"string"==typeof n?JSON.parse(n):n}catch(e){return""}}},{key:"asDTO",value:function(){return{botd_logic_loaded:o.botdLogicLoaded,botd_wrapper_loaded:o.botdWrapperLoaded,frontend_data_log:"",transport_enabled:1}}},{key:"detectScripts",value:function(){if(o.botdWrapperLoaded&&o.botdLogicLoaded)return!0;for(var e=document.getElementsByTagName("script"),t=0;t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,r,i,c,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(c=document.createElement("strong")).append(d.phrases.trpHeading),(r=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),(i=document.createElement("div")).append(" "),i.append(c),i.append(d.phrases.trpContent1),(c=document.createElement("div")).style.display="flex",c.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),c.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),c.append(l)),r.append(i,c),a.append(r),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})})))}); \ No newline at end of file diff --git a/js/apbct-public-bundle_int-protection_gathering.min.js b/js/apbct-public-bundle_int-protection_gathering.min.js index 0462ab313..1352ed318 100644 --- a/js/apbct-public-bundle_int-protection_gathering.min.js +++ b/js/apbct-public-bundle_int-protection_gathering.min.js @@ -1 +1 @@ -function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;et||r=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(r.data.forEach(function(e){e.encoded_email===a[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===a[t].href||0!==a[t].href.indexOf("mailto:")&&0!==a[t].href.indexOf("tel:"))a[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a[t])},2e3);else{if(0===a[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==a[t].href.indexOf("tel:"))return 0;e="tel:"}var o=a[t].href.replace(e,"");ctReplaceInTextNodes(a[t],o,ctHtmlToText(n.decoded_email)),a[t].href=e+n.decoded_email,a[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";r.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.textContent=ctHtmlToText(n)})}a[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=r.data[0];a.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a)},2e3),a.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctReplaceInTextNodes(e,t,n){if(t){e.normalize();for(var o,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);o=a.nextNode();)if(-1!==o.nodeValue.indexOf(t))return void(o.nodeValue=o.nodeValue.replace(t,function(){return n}))}}function ctHtmlToText(e){return e?(new DOMParser).parseFromString(String(e),"text/html").documentElement.textContent:""}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}var ctEmailDecoderIsInitialized=!1,cleantalkModal=(document.addEventListener("DOMContentLoaded",function(){if(!ctEmailDecoderIsInitialized){ctEmailDecoderIsInitialized=!0;var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1')):(r.innerHTML="Loading...",t&&this.load(t)),r.setAttribute("id","cleantalk-modal-content"),n.append(r),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions._ajax_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(unescape(encodeURIComponent(JSON.stringify(t)))),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(unescape(encodeURIComponent(n))),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function p(){_classCallCheck(this,p)}return _createClass(p,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0{var n=_asyncToGenerator(_regenerator().m(function e(t,n){var o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(+ctPublic.settings__forms__check_external){e.n=1;break}return e.a(2,!1);case 1:o=_createForOfIteratorHelper(r),e.p=2,o.s();case 3:if((a=o.n()).done)e.n=6;else{if((a=a.value).matches(t,n))return a=a.getForm(),e.n=4,c(a);e.n=5}break;case 4:if(e.v)return e.a(2,!0);e.n=5;break;case 5:e.n=3;break;case 6:e.n=8;break;case 7:e.p=7,a=e.v,o.e(a);case 8:return e.p=8,o.f(),e.f(8);case 9:return e.a(2,!1)}},e,null,[[2,7,8,9]])}));return function(e,t){return n.apply(this,arguments)}})(),r=[{name:"bitrix24",matches:function(e,t){return document.querySelector(".b24-form")&&e.includes("bitrix/services/main/ajax.php?action=crm.site.form.fill")&&t[1].body instanceof FormData},getForm:function(){return document.querySelector(".b24-form form")}},{name:"sender",matches:function(e,t){return e.includes("stats.sender.net/forms")&&"string"==typeof t[1].body},getForm:function(){for(var e=document.querySelectorAll("iframe"),t=0;t{var t=_asyncToGenerator(_regenerator().m(function e(t){var n,o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t){e.n=1;break}return e.a(2,!1);case 1:return n=i(t),m=!0,e.p=2,e.n=3,new Promise(function(e,t){apbct_public_sendAJAX(n,{async:!0,callback:e,onErrorCallback:t})});case 3:return o=e.v,(a=void 0!==o.apbct&&+o.apbct.blocked||void 0!==o.data&&void 0!==o.data.message)&&(new ApbctShowForbidden).parseBlockMessage(o),e.a(2,a);case 4:return e.p=4,e.a(2,!1);case 5:return e.p=5,m=!1,e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(e){return t.apply(this,arguments)}})(),i=function(e){var t,n={action:"cleantalk_force_ajax_check"},o=_createForOfIteratorHelper(e.elements);try{for(o.s();!(t=o.n()).done;){var a=t.value;a.name&&(n[a.name]=a.value)}}catch(e){o.e(e)}finally{o.f()}return+ctPublic.bot_detector_enabled?n.ct_bot_detector_event_token=apbctLocalStorage.get("bot_detector_event_token"):n.ct_no_cookie_hidden_field=getNoCookieData(),n};window.fetch=_asyncToGenerator(_regenerator().m(function e(){var t,n,o,a,r,c,i,l,s,u,d,p=arguments;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:for(t=p.length,n=new Array(t),o=0;o!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))(a="string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.a(2,h.apply(this,n));e.n=2;break;case 2:if(n&&n[0]&&n[1]&&n[1].body){e.n=3;break}return e.a(2,h.apply(this,n));case 3:return e.n=4,b.processFetch(n);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=f(n[1].body,_(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,r=t.querySelector('[name*="apbct__email_id__"]'),c=null,i=(null!==r&&null!==r.value&&(c=r.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===i&&null===r&&null===l||(e.preventDefault(),n=function(){null!==r&&r.parentNode.removeChild(r),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=i,null!==c&&(o.apbct_search_form__honeypot_value=c),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,r=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var r=o.value,c=this.findParentContainer(r);if(c){var i=this.getIdFromHTML(c);if(i===n){var l=c.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t_createClass(function e(){_classCallCheck(this,e)},[{key:"setSessionId",value:function(){var e;apbctSessionStorage.isSet("apbct_session_id")?apbctLocalStorage.set("apbct_page_hits",Number(apbctLocalStorage.get("apbct_page_hits"))+1):(e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10),apbctSessionStorage.set("apbct_session_id",e,!1),apbctLocalStorage.set("apbct_page_hits",1),document.referrer&&new URL(document.referrer).host!==location.host&&apbctSessionStorage.set("apbct_site_referer",document.referrer,!1))}},{key:"writeReferrersToSessionStorage",value:function(){var e=apbctSessionStorage.get("apbct_session_current_page");!1!==e&&document.location.href!==e&&apbctSessionStorage.set("apbct_prev_referer",e,!1),apbctSessionStorage.set("apbct_session_current_page",document.location.href,!1)}},{key:"setCookiesType",value:function(){var e=apbctLocalStorage.get("ct_cookies_type");e&&e===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled"))}},{key:"startFieldsListening",value:function(){if(!apbctLocalStorage.isSet("ct_has_key_up")&&!apbctLocalStorage.get("ct_has_key_up")||!apbctLocalStorage.isSet("ct_has_input_focused")&&!apbctLocalStorage.get("ct_has_input_focused")||"native"!==ctPublic.data__cookies_type||void 0===ctGetCookie("ct_has_input_focused")||void 0===ctGetCookie("ct_has_key_up")){var e=ctGetPageForms();if(ctPublic.handled_fields=[],0_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"elementBody",document.querySelector("body")),_defineProperty(this,"collectionForms",document.forms),this.setListeners()},[{key:"setListeners",value:function(){var t=this;this.elementBody.addEventListener("click",function(e){t.checkElementInForms(e,"addClicks")}),this.elementBody.addEventListener("mouseup",function(e){"Range"==document.getSelection().type.toString()&&t.addSelected()}),this.elementBody.addEventListener("mousemove",function(e){t.checkElementInForms(e,"trackMouseMovement")})}},{key:"checkElementInForms",value:function(e,t){for(var n,o=0;o_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"fieldData",{isAutoFill:!1,isUseBuffer:!1,speedDelta:0,firstKeyTimestamp:0,lastKeyTimestamp:0,lastDelta:0,countOfKey:0}),_defineProperty(this,"fields",document.querySelectorAll("textarea[name=comment]")),_defineProperty(this,"data",[])},[{key:"gatheringFields",value:function(){var n=this;Array.prototype.slice.call(this.fields).forEach(function(e,t){n.data.push(Object.assign({},n.fieldData))})}},{key:"setListeners",value:function(){var o=this;this.fields.forEach(function(e,t){e.addEventListener("paste",function(){o.data[t].isUseBuffer=!0})}),this.fields.forEach(function(e,t){e.addEventListener("onautocomplete",function(){o.data[t].isAutoFill=!0})}),this.fields.forEach(function(e,n){e.addEventListener("input",function(){o.data[n].countOfKey++;var e,t=+new Date;1===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].firstKeyTimestamp=t):(e=t-o.data[n].lastKeyTimestamp,2===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].lastDelta=e):2{function o(){_classCallCheck(this,o)}return _createClass(o,null,[{key:"getFrontendDataLog",value:function(){var e=("undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.cookiePrefix?ctPublicFunctions.cookiePrefix:"")+o.LOG_KEY,t=o.LOG_KEY;if(void 0!==apbctLocalStorage&&apbctLocalStorage.get){var n=apbctLocalStorage.get(e)||apbctLocalStorage.get(t)||null;if(n&&"string"==typeof n)try{return JSON.parse(n)}catch(e){return""}return n}n=(n=localStorage.getItem(e))||localStorage.getItem(t)||null;try{return"string"==typeof n?JSON.parse(n):n}catch(e){return""}}},{key:"asDTO",value:function(){return{botd_logic_loaded:o.botdLogicLoaded,botd_wrapper_loaded:o.botdWrapperLoaded,frontend_data_log:"",transport_enabled:1}}},{key:"detectScripts",value:function(){if(o.botdWrapperLoaded&&o.botdLogicLoaded)return!0;for(var e=document.getElementsByTagName("script"),t=0;t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,r,c,i,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(i=document.createElement("strong")).append(d.phrases.trpHeading),(r=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),(c=document.createElement("div")).append(" "),c.append(i),c.append(d.phrases.trpContent1),(i=document.createElement("div")).style.display="flex",i.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),i.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),i.append(l)),r.append(c,i),a.append(r),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})})))}); \ No newline at end of file +function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;et||c=e.length?{done:!0}:{done:!1,value:e[c++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(c.data.forEach(function(e){e.encoded_email===a[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===a[t].href||0!==a[t].href.indexOf("mailto:")&&0!==a[t].href.indexOf("tel:"))a[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a[t])},2e3);else{if(0===a[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==a[t].href.indexOf("tel:"))return 0;e="tel:"}var o=a[t].href.replace(e,"");ctReplaceInTextNodes(a[t],o,ctHtmlToText(n.decoded_email)),a[t].href=e+n.decoded_email,a[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";c.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.textContent=ctHtmlToText(n)})}a[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=c.data[0];a.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,a)},2e3),a.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctReplaceInTextNodes(e,t,n){if(t){e.normalize();for(var o,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);o=a.nextNode();)if(-1!==o.nodeValue.indexOf(t))return void(o.nodeValue=o.nodeValue.replace(t,function(){return n}))}}function ctHtmlToText(e){return e?(new DOMParser).parseFromString(String(e),"text/html").documentElement.textContent:""}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){for(var n=null,o=0;o$1')):(c.innerHTML="Loading...",t&&this.load(t)),c.setAttribute("id","cleantalk-modal-content"),n.append(c),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions._ajax_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(unescape(encodeURIComponent(JSON.stringify(t)))),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(unescape(encodeURIComponent(n))),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function p(){_classCallCheck(this,p)}return _createClass(p,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0{var n=_asyncToGenerator(_regenerator().m(function e(t,n){var o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(+ctPublic.settings__forms__check_external){e.n=1;break}return e.a(2,!1);case 1:o=_createForOfIteratorHelper(c),e.p=2,o.s();case 3:if((a=o.n()).done)e.n=6;else{if((a=a.value).matches(t,n))return a=a.getForm(),e.n=4,r(a);e.n=5}break;case 4:if(e.v)return e.a(2,!0);e.n=5;break;case 5:e.n=3;break;case 6:e.n=8;break;case 7:e.p=7,a=e.v,o.e(a);case 8:return e.p=8,o.f(),e.f(8);case 9:return e.a(2,!1)}},e,null,[[2,7,8,9]])}));return function(e,t){return n.apply(this,arguments)}})(),c=[{name:"bitrix24",matches:function(e,t){return document.querySelector(".b24-form")&&e.includes("bitrix/services/main/ajax.php?action=crm.site.form.fill")&&t[1].body instanceof FormData},getForm:function(){return document.querySelector(".b24-form form")}},{name:"sender",matches:function(e,t){return e.includes("stats.sender.net/forms")&&"string"==typeof t[1].body},getForm:function(){for(var e=document.querySelectorAll("iframe"),t=0;t{var t=_asyncToGenerator(_regenerator().m(function e(t){var n,o,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t){e.n=1;break}return e.a(2,!1);case 1:return n=i(t),m=!0,e.p=2,e.n=3,new Promise(function(e,t){apbct_public_sendAJAX(n,{async:!0,callback:e,onErrorCallback:t})});case 3:return o=e.v,(a=void 0!==o.apbct&&+o.apbct.blocked||void 0!==o.data&&void 0!==o.data.message)&&(new ApbctShowForbidden).parseBlockMessage(o),e.a(2,a);case 4:return e.p=4,e.a(2,!1);case 5:return e.p=5,m=!1,e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(e){return t.apply(this,arguments)}})(),i=function(e){var t,n={action:"cleantalk_force_ajax_check"},o=_createForOfIteratorHelper(e.elements);try{for(o.s();!(t=o.n()).done;){var a=t.value;a.name&&(n[a.name]=a.value)}}catch(e){o.e(e)}finally{o.f()}return+ctPublic.bot_detector_enabled?n.ct_bot_detector_event_token=apbctLocalStorage.get("bot_detector_event_token"):n.ct_no_cookie_hidden_field=getNoCookieData(),n};window.fetch=_asyncToGenerator(_regenerator().m(function e(){var t,n,o,a,c,r,i,l,s,u,d,p=arguments;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:for(t=p.length,n=new Array(t),o=0;o!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))(a="string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.a(2,h.apply(this,n));e.n=2;break;case 2:if(n&&n[0]&&n[1]&&n[1].body){e.n=3;break}return e.a(2,h.apply(this,n));case 3:return e.n=4,b.processFetch(n);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=f(n[1].body,_(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,c=t.querySelector('[name*="apbct__email_id__"]'),r=null,i=(null!==c&&null!==c.value&&(r=c.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===i&&null===c&&null===l||(e.preventDefault(),n=function(){null!==c&&c.parentNode.removeChild(c),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=i,null!==r&&(o.apbct_search_form__honeypot_value=r),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,c=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var c=o.value,r=this.findParentContainer(c);if(r){var i=this.getIdFromHTML(r);if(i===n){var l=r.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t_createClass(function e(){_classCallCheck(this,e)},[{key:"setSessionId",value:function(){var e;apbctSessionStorage.isSet("apbct_session_id")?apbctLocalStorage.set("apbct_page_hits",Number(apbctLocalStorage.get("apbct_page_hits"))+1):(e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10),apbctSessionStorage.set("apbct_session_id",e,!1),apbctLocalStorage.set("apbct_page_hits",1),document.referrer&&new URL(document.referrer).host!==location.host&&apbctSessionStorage.set("apbct_site_referer",document.referrer,!1))}},{key:"writeReferrersToSessionStorage",value:function(){var e=apbctSessionStorage.get("apbct_session_current_page");!1!==e&&document.location.href!==e&&apbctSessionStorage.set("apbct_prev_referer",e,!1),apbctSessionStorage.set("apbct_session_current_page",document.location.href,!1)}},{key:"setCookiesType",value:function(){var e=apbctLocalStorage.get("ct_cookies_type");e&&e===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled"))}},{key:"startFieldsListening",value:function(){if(!apbctLocalStorage.isSet("ct_has_key_up")&&!apbctLocalStorage.get("ct_has_key_up")||!apbctLocalStorage.isSet("ct_has_input_focused")&&!apbctLocalStorage.get("ct_has_input_focused")||"native"!==ctPublic.data__cookies_type||void 0===ctGetCookie("ct_has_input_focused")||void 0===ctGetCookie("ct_has_key_up")){var e=ctGetPageForms();if(ctPublic.handled_fields=[],0_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"elementBody",document.querySelector("body")),_defineProperty(this,"collectionForms",document.forms),this.setListeners()},[{key:"setListeners",value:function(){var t=this;this.elementBody.addEventListener("click",function(e){t.checkElementInForms(e,"addClicks")}),this.elementBody.addEventListener("mouseup",function(e){"Range"==document.getSelection().type.toString()&&t.addSelected()}),this.elementBody.addEventListener("mousemove",function(e){t.checkElementInForms(e,"trackMouseMovement")})}},{key:"checkElementInForms",value:function(e,t){for(var n,o=0;o_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"fieldData",{isAutoFill:!1,isUseBuffer:!1,speedDelta:0,firstKeyTimestamp:0,lastKeyTimestamp:0,lastDelta:0,countOfKey:0}),_defineProperty(this,"fields",document.querySelectorAll("textarea[name=comment]")),_defineProperty(this,"data",[])},[{key:"gatheringFields",value:function(){var n=this;Array.prototype.slice.call(this.fields).forEach(function(e,t){n.data.push(Object.assign({},n.fieldData))})}},{key:"setListeners",value:function(){var o=this;this.fields.forEach(function(e,t){e.addEventListener("paste",function(){o.data[t].isUseBuffer=!0})}),this.fields.forEach(function(e,t){e.addEventListener("onautocomplete",function(){o.data[t].isAutoFill=!0})}),this.fields.forEach(function(e,n){e.addEventListener("input",function(){o.data[n].countOfKey++;var e,t=+new Date;1===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].firstKeyTimestamp=t):(e=t-o.data[n].lastKeyTimestamp,2===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].lastDelta=e):2{function o(){_classCallCheck(this,o)}return _createClass(o,null,[{key:"getFrontendDataLog",value:function(){var e=("undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.cookiePrefix?ctPublicFunctions.cookiePrefix:"")+o.LOG_KEY,t=o.LOG_KEY;if(void 0!==apbctLocalStorage&&apbctLocalStorage.get){var n=apbctLocalStorage.get(e)||apbctLocalStorage.get(t)||null;if(n&&"string"==typeof n)try{return JSON.parse(n)}catch(e){return""}return n}n=(n=localStorage.getItem(e))||localStorage.getItem(t)||null;try{return"string"==typeof n?JSON.parse(n):n}catch(e){return""}}},{key:"asDTO",value:function(){return{botd_logic_loaded:o.botdLogicLoaded,botd_wrapper_loaded:o.botdWrapperLoaded,frontend_data_log:"",transport_enabled:1}}},{key:"detectScripts",value:function(){if(o.botdWrapperLoaded&&o.botdLogicLoaded)return!0;for(var e=document.getElementsByTagName("script"),t=0;t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,c,r,i,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(i=document.createElement("strong")).append(d.phrases.trpHeading),(c=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),(r=document.createElement("div")).append(" "),r.append(i),r.append(d.phrases.trpContent1),(i=document.createElement("div")).style.display="flex",i.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),i.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),i.append(l)),c.append(r,i),a.append(c),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})})))}); \ No newline at end of file diff --git a/js/cleantalk-admin.min.js b/js/cleantalk-admin.min.js index 8c359e2ac..e62169847 100644 --- a/js/cleantalk-admin.min.js +++ b/js/cleantalk-admin.min.js @@ -1,2 +1,2 @@ -function apbctSetEmailDecoderPopupAnimation(){var t=["apbct_dog_one","apbct_dog_two","apbct_dog_three"],n=document.createElement("div");n.classList="apbct-ee-animation-wrapper";for(let e=0;e{e.encoded_email===i.dataset.originalString&&(t=e)}),e=t.decoded_email.split(/[&?]/)[0]}else e=o.data[0].decoded_email;var n=t.querySelector("#apbct_email_ecoder__popup_text_node_first"),c=document.createElement("b"),c=(c.setAttribute("class","apbct-email-encoder-select-whole-email"),c.innerText=e,"undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.text__ee_click_to_select?c.title=ctPublicFunctions.text__ee_click_to_select:c.title=ctAdminCommon.text__ee_click_to_select,n&&("undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.text__ee_original_email?n.innerHTML=ctPublicFunctions.text__ee_original_email+" "+c.outerHTML:n.innerHTML=ctAdminCommon.text__ee_original_email+" "+c.outerHTML,n.setAttribute("style","flex-direction: row;")),t.querySelector(".apbct-ee-animation-wrapper")),n=(c&&c.remove(),t.querySelector("#apbct_email_ecoder__popup_text_node_second")),c=(n&&n.remove(),document.createElement("span"));c.classList="apbct-email-encoder-elements_center top-margin-long",document.querySelector(".apbct-email-encoder-got-it-button")||(n=document.createElement("button"),"undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.text__ee_got_it?n.innerText=ctPublicFunctions.text__ee_got_it:n.innerText=ctAdminCommon.text__ee_got_it,n.classList="apbct-email-encoder-got-it-button",n.addEventListener("click",function(){document.body.classList.remove("apbct-popup-fade"),t.setAttribute("style","display:none"),fillDecodedNodes(a,o),"undefined"!=typeof ctPublic&&ctPublic.encodedEmailNodesIsMixed&&i&&i.click()}),c.append(n),t.append(c))}},3e3);else if(i){let e="unknown_error";o.hasOwnProperty("data")&&0{e.encoded_email===c[n].dataset.originalString&&(t=e)}),!1===t.is_allowed)return;if(void 0===c[n].href||0!==c[n].href.indexOf("mailto:")&&0!==c[n].href.indexOf("tel:"))c[n].classList.add("no-blur"),setTimeout(()=>{ctProcessDecodedDataResult(t,c[n])},2e3);else{let e;if(0===c[n].href.indexOf("mailto:"))e="mailto:";else{if(0!==c[n].href.indexOf("tel:"))continue;e="tel:"}var a=c[n].href.replace(e,"");ctReplaceInTextNodes(c[n],a,ctHtmlToText(t.decoded_email)),c[n].href=e+t.decoded_email,c[n].querySelectorAll("span.apbct-email-encoder").forEach(t=>{let n="";o.data.forEach(e=>{e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.textContent=ctHtmlToText(n)})}c[n].removeEventListener("click",ctFillDecodedEmailHandler)}else{let e=o.data[0];c.classList.add("no-blur"),setTimeout(()=>{ctProcessDecodedDataResult(e,c)},2e3),c.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctReplaceInTextNodes(e,t,n){if(t){e.normalize();for(var c,o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);c=o.nextNode();)if(-1!==c.nodeValue.indexOf(t))return void(c.nodeValue=c.nodeValue.replace(t,()=>n))}}function ctHtmlToText(e){return e?(new DOMParser).parseFromString(String(e),"text/html").documentElement.textContent:""}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}(()=>{let d=wp.i18n.__;function n(t,n,c){let o=n.callback||null,a=n.callback_context||null,i=n.callback_params||null;var e=n.async||!0;let l=n.notJson||null;var d=n.timeout||15e3,c=c||null;let r=n.button||null,s=n.spinner||null,u=n.progressbar||null;"string"==typeof t?t=t+"&_ajax_nonce="+ctAdminCommon._ajax_nonce+"&no_cache="+Math.random():(t._ajax_nonce=ctAdminCommon._ajax_nonce,t.no_cache=Math.random()),r&&(r.setAttribute("disabled","disabled"),r.style.cursor="not-allowed"),s&&jQuery(s).css("display","inline"),jQuery.ajax({type:"POST",url:ctAdminCommon._ajax_url,data:t,async:e,success:function(e){r&&(r.removeAttribute("disabled"),r.style.cursor="pointer"),s&&jQuery(s).css("display","none"),(e=l?e:JSON.parse(e)).error?(setTimeout(function(){u&&u.fadeOut("slow")},1e3),"undefined"!=typeof cleantalkModal?(cleantalkModal.loaded="Error:
"+e.error.toString(),cleantalkModal.open()):alert("Error happens: "+(e.error||"Unkown"))):o&&(i?o.apply(a,i.concat(e,t,n,c)):o(e,t,n,c))},error:function(e,t,n){r&&(r.removeAttribute("disabled"),r.style.cursor="pointer"),s&&jQuery(s).css("display","none"),console.log("APBCT_AJAX_ERROR"),console.log(e),console.log(t),console.log(n)},timeout:d})}jQuery(document).ready(function(i){jQuery(".apbct_update_notice").on("click","button",function(){var e=new Date((new Date).getTime()+2592e6),t="https:"===location.protocol?"; secure":"";document.cookie="apbct_update_banner_closed=1; path=/; expires="+e.toUTCString()+"; samesite=lax"+t}),jQuery('li a[href="options-general.php?page=cleantalk"]').css("white-space","nowrap").css("display","inline-block"),jQuery("body").on("click",".apbct-notice .notice-dismiss",function(e){e=jQuery(e.target).parent().attr("id");e&&n({action:"cleantalk_dismiss_notice",notice_id:e},{callback:null,notJson:!0})}),jQuery(".ct_username .row-actions .delete a").on("click",function(e){e.preventDefault(),confirm(ctAdminCommon.notice_when_deleting_user_text)&&(window.location=this.href)});let t=document.querySelector("#apbct_setting_forms__force_protection__On");var e;t&&t.addEventListener("click",function(e){t.checked&&!confirm(ctAdminCommon.apbctNoticeForceProtectionOn)&&e.preventDefault()}),i(".apbct-restore-spam-order-button").click(function(){var e=i(this).data("spam-order-id"),e={action:"apbct_restore_spam_order",_ajax_nonce:ctAdminCommon._ajax_nonce,order_id:e};i.ajax({type:"POST",url:ctAdminCommon._ajax_url,data:e,success:function(e){e.success?window.location.reload():alert(e.data.message)}})}),i(".apbct-details-spam-order-button").click(function(){var e=i(this).data("spam-order-id"),e={action:"apbct_details_spam_order",_ajax_nonce:ctAdminCommon._ajax_nonce,order_id:e};"undefined"!=typeof cleantalkModal?(cleantalkModal.loaded=!1,cleantalkModal.open(!1),i.ajax({type:"POST",url:ctAdminCommon._ajax_url,data:e,success:function(e){var t,n,c,o,a=i("#cleantalk-modal-content");a.empty(),e.success&&e.data?(t=(e=>{var t=document.createElement("div");function n(e,t){var n,c,o=document.createElement("div"),a=(o.className="apbct_wc_details__table-wrapper-inner",document.createElement("h4")),t=(a.textContent=t,o.appendChild(a),document.createElement("table")),i=(t.className="apbct_wc_details__table",document.createElement("tbody"));for([n,c]of Object.entries(e)){var l=document.createElement("tr"),d=document.createElement("td"),r=(d.className="apbct_wc_details__table-key-cell",d.textContent=n,document.createElement("td"));r.className="apbct_wc_details__table-value-cell","object"==typeof c&&null!==c?(r.textContent=JSON.stringify(c,null,2),r.classList.add("apbct_wc_details__table-value-cell--json")):r.textContent=null!=c?c:"—",l.appendChild(d),l.appendChild(r),i.appendChild(l)}return t.appendChild(i),o.appendChild(t),o}if(t.className="apbct_wc_details__wrapper",e.order_details){var c,o,a=e.order_details;for([c,o]of Object.entries(a)){var i=a[c]&&"string"==typeof a[c].product_name?a[c].product_name:d("Unknown product name","cleantalk-spam-protect"),l=d("Order Details for","cleantalk-spam-protect");t.appendChild(n(o,l+" "+i))}}return e.customer_details&&t.appendChild(n(e.customer_details,"Customer Details")),t})(e.data),n=document.createElement("h3"),o=document.createElement("a"),c=document.createElement("p"),n.className="apbct_wc_details__table-container_header",n.textContent=d("WooCommerce spam order details","cleantalk-spam-protect"),o.href=new URL("https://cleantalk.org/my/show_requests?allow=0&request_type=order").toString(),o.rel="noopener noreferrer",o.target="_blank",o.textContent=o.href,c.textContent=d("Visit CleanTalk Cloud Dashboard to see all of denied requests: ","cleantalk-spam-protect"),c.style.textAlign="center",c.appendChild(o),a.append(n),a.append(c),a.append(t)):(o=e&&e.data&&e.data.error?e.data.error:d("Unknown error occurred","cleantalk-spam-protect"),a.text(o)),cleantalkModal.loaded=!0},error:function(e,t,n){console.error("AJAX Error:",n),alert(d("An error occurred while processing your request, see console for details.","cleantalk-spam-protect"))}})):alert(d("Can not initialize CleanTalk modal window.","cleantalk-spam-protect"))}),window.location.href.includes("options-general.php?page=cleantalk")&&(e=document.querySelector("[data-original-string]"))&&((ctAdminCommon.encodedEmailNode=e).style.cursor="pointer",e.addEventListener("click",ctFillDecodedEmailHandler))}),window.apbct_admin_sendAJAX=n})();let ctEmailDecoderIsInitialized=!1;document.addEventListener("DOMContentLoaded",function(){if(!ctEmailDecoderIsInitialized){ctEmailDecoderIsInitialized=!0;var t=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=t),t.length)for(let e=0;e{let d=wp.i18n.__;function n(t,n,c){let o=n.callback||null,a=n.callback_context||null,l=n.callback_params||null;var e=n.async||!0;let i=n.notJson||null;var d=n.timeout||15e3,c=c||null;let r=n.button||null,s=n.spinner||null,p=n.progressbar||null;"string"==typeof t?t=t+"&_ajax_nonce="+ctAdminCommon._ajax_nonce+"&no_cache="+Math.random():(t._ajax_nonce=ctAdminCommon._ajax_nonce,t.no_cache=Math.random()),r&&(r.setAttribute("disabled","disabled"),r.style.cursor="not-allowed"),s&&jQuery(s).css("display","inline"),jQuery.ajax({type:"POST",url:ctAdminCommon._ajax_url,data:t,async:e,success:function(e){r&&(r.removeAttribute("disabled"),r.style.cursor="pointer"),s&&jQuery(s).css("display","none"),(e=i?e:JSON.parse(e)).error?(setTimeout(function(){p&&p.fadeOut("slow")},1e3),"undefined"!=typeof cleantalkModal?(cleantalkModal.loaded="Error:
"+e.error.toString(),cleantalkModal.open()):alert("Error happens: "+(e.error||"Unkown"))):o&&(l?o.apply(a,l.concat(e,t,n,c)):o(e,t,n,c))},error:function(e,t,n){r&&(r.removeAttribute("disabled"),r.style.cursor="pointer"),s&&jQuery(s).css("display","none"),console.log("APBCT_AJAX_ERROR"),console.log(e),console.log(t),console.log(n)},timeout:d})}jQuery(document).ready(function(l){jQuery(".apbct_update_notice").on("click","button",function(){var e=new Date((new Date).getTime()+2592e6),t="https:"===location.protocol?"; secure":"";document.cookie="apbct_update_banner_closed=1; path=/; expires="+e.toUTCString()+"; samesite=lax"+t}),jQuery('li a[href="options-general.php?page=cleantalk"]').css("white-space","nowrap").css("display","inline-block"),jQuery("body").on("click",".apbct-notice .notice-dismiss",function(e){e=jQuery(e.target).parent().attr("id");e&&n({action:"cleantalk_dismiss_notice",notice_id:e},{callback:null,notJson:!0})}),jQuery(".ct_username .row-actions .delete a").on("click",function(e){e.preventDefault(),confirm(ctAdminCommon.notice_when_deleting_user_text)&&(window.location=this.href)});let t=document.querySelector("#apbct_setting_forms__force_protection__On");var e;t&&t.addEventListener("click",function(e){t.checked&&!confirm(ctAdminCommon.apbctNoticeForceProtectionOn)&&e.preventDefault()}),l(".apbct-restore-spam-order-button").click(function(){var e=l(this).data("spam-order-id"),e={action:"apbct_restore_spam_order",_ajax_nonce:ctAdminCommon._ajax_nonce,order_id:e};l.ajax({type:"POST",url:ctAdminCommon._ajax_url,data:e,success:function(e){e.success?window.location.reload():alert(e.data.message)}})}),l(".apbct-details-spam-order-button").click(function(){var e=l(this).data("spam-order-id"),e={action:"apbct_details_spam_order",_ajax_nonce:ctAdminCommon._ajax_nonce,order_id:e};"undefined"!=typeof cleantalkModal?(cleantalkModal.loaded=!1,cleantalkModal.open(!1),l.ajax({type:"POST",url:ctAdminCommon._ajax_url,data:e,success:function(e){var t,n,c,o,a=l("#cleantalk-modal-content");a.empty(),e.success&&e.data?(t=(e=>{var t=document.createElement("div");function n(e,t){var n,c,o=document.createElement("div"),a=(o.className="apbct_wc_details__table-wrapper-inner",document.createElement("h4")),t=(a.textContent=t,o.appendChild(a),document.createElement("table")),l=(t.className="apbct_wc_details__table",document.createElement("tbody"));for([n,c]of Object.entries(e)){var i=document.createElement("tr"),d=document.createElement("td"),r=(d.className="apbct_wc_details__table-key-cell",d.textContent=n,document.createElement("td"));r.className="apbct_wc_details__table-value-cell","object"==typeof c&&null!==c?(r.textContent=JSON.stringify(c,null,2),r.classList.add("apbct_wc_details__table-value-cell--json")):r.textContent=null!=c?c:"—",i.appendChild(d),i.appendChild(r),l.appendChild(i)}return t.appendChild(l),o.appendChild(t),o}if(t.className="apbct_wc_details__wrapper",e.order_details){var c,o,a=e.order_details;for([c,o]of Object.entries(a)){var l=a[c]&&"string"==typeof a[c].product_name?a[c].product_name:d("Unknown product name","cleantalk-spam-protect"),i=d("Order Details for","cleantalk-spam-protect");t.appendChild(n(o,i+" "+l))}}return e.customer_details&&t.appendChild(n(e.customer_details,"Customer Details")),t})(e.data),n=document.createElement("h3"),o=document.createElement("a"),c=document.createElement("p"),n.className="apbct_wc_details__table-container_header",n.textContent=d("WooCommerce spam order details","cleantalk-spam-protect"),o.href=new URL("https://cleantalk.org/my/show_requests?allow=0&request_type=order").toString(),o.rel="noopener noreferrer",o.target="_blank",o.textContent=o.href,c.textContent=d("Visit CleanTalk Cloud Dashboard to see all of denied requests: ","cleantalk-spam-protect"),c.style.textAlign="center",c.appendChild(o),a.append(n),a.append(c),a.append(t)):(o=e&&e.data&&e.data.error?e.data.error:d("Unknown error occurred","cleantalk-spam-protect"),a.text(o)),cleantalkModal.loaded=!0},error:function(e,t,n){console.error("AJAX Error:",n),alert(d("An error occurred while processing your request, see console for details.","cleantalk-spam-protect"))}})):alert(d("Can not initialize CleanTalk modal window.","cleantalk-spam-protect"))}),window.location.href.includes("options-general.php?page=cleantalk")&&(e=document.querySelector("[data-original-string]"))&&((ctAdminCommon.encodedEmailNode=e).style.cursor="pointer",e.addEventListener("click",ctFillDecodedEmailHandler))}),window.apbct_admin_sendAJAX=n})();let apbctEmailEncoderOnClose=null;function apbctEmailEncoderClosePopup(){var e=apbctEmailEncoderOnClose,t=(document.body.classList.remove("apbct-popup-fade"),document.getElementById("apbct_popup"));t&&(apbctEmailEncoderUnbindPopupEvents(t),t.style.display="none"),e&&(apbctEmailEncoderOnClose=null,e())}function apbctEmailEncoderBackdropClickHandler(e){var t=document.getElementById("apbct_popup");t&&"none"!==t.style.display&&document.body.classList.contains("apbct-popup-fade")&&!t.contains(e.target)&&apbctEmailEncoderClosePopup()}function apbctEmailEncoderBindPopupEvents(e,t){apbctEmailEncoderOnClose=t;t=e.querySelector(".apbct-email-encoder-popup__close");t&&(t.classList.add("apbct-email-encoder-popup__close--visible"),t.addEventListener("click",apbctEmailEncoderClosePopup)),document.body.addEventListener("click",apbctEmailEncoderBackdropClickHandler)}function apbctEmailEncoderUnbindPopupEvents(e){apbctEmailEncoderOnClose=null;e=e.querySelector(".apbct-email-encoder-popup__close");e&&(e.classList.remove("apbct-email-encoder-popup__close--visible"),e.removeEventListener("click",apbctEmailEncoderClosePopup)),document.body.removeEventListener("click",apbctEmailEncoderBackdropClickHandler)}function ctFillDecodedEmailHandler(e=!1){let t=!1,n="",c="",o=("undefined"!=typeof ctPublic?(this.removeEventListener("click",ctFillDecodedEmailHandler),t=this,ctPublic.encodedEmailNodesIsMixed=!1,n=ctPublic.wl_brandname,c=ctPublic.encodedEmailNodes):"undefined"!=typeof ctAdminCommon&&(n=ctAdminCommon.plugin_name,c=ctAdminCommon.encodedEmailNode),document.body.classList.add("apbct-popup-fade"),document.getElementById("apbct_popup"));var a,l,i,d,r,s;o?(o.setAttribute("style","display: inherit"),"undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.text__ee_wait_for_decoding?document.getElementById("apbct_popup_text").innerHTML=ctPublicFunctions.text__ee_wait_for_decoding:document.getElementById("apbct_popup_text").innerHTML=ctAdminCommon.text__ee_wait_for_decoding):((a=document.createElement("div")).setAttribute("class","apbct-popup apbct-email-encoder-popup"),a.setAttribute("id","apbct_popup"),(l=document.createElement("button")).type="button",l.className="apbct-email-encoder-popup__close",l.setAttribute("aria-label","Close popup"),l.innerHTML="×",(i=document.createElement("span")).classList="apbct-email-encoder-elements_center",(d=document.createElement("p")).innerText=n,d.setAttribute("class","apbct-email-encoder--popup-header"),i.append(d),(d=document.createElement("div")).setAttribute("id","apbct_popup_text"),d.setAttribute("class","apbct-email-encoder-elements_center"),d.style.color="black",(r=document.createElement("p")).id="apbct_email_ecoder__popup_text_node_first","undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.text__ee_wait_for_decoding?r.innerText=ctPublicFunctions.text__ee_wait_for_decoding:r.innerText=ctAdminCommon.text__ee_wait_for_decoding,r.setAttribute("class","apbct-email-encoder-elements_center"),(s=document.createElement("p")).id="apbct_email_ecoder__popup_text_node_second","undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.text__ee_decoding_process?s.innerText=ctPublicFunctions.text__ee_decoding_process:s.innerText=ctAdminCommon.text__ee_decoding_process,a.append(l),d.append(r),d.append(s),a.append(i),a.append(d),a.append(apbctSetEmailDecoderPopupAnimation()),document.body.append(a),o=a),apbctEmailEncoderUnbindPopupEvents(o),apbctAjaxEmailDecodeBulk(e,c,t)}function apbctAjaxEmailDecodeBulk(t,n,c){if(t&&c){var e={post_url:document.location.href,referrer:document.referrer,encodedEmails:""},o=(+ctPublic.bot_detector_enabled?e.event_token=apbctLocalStorage.get("bot_detector_event_token"):e.event_javascript_data=getJavascriptClientData(),{});for(let e=0;e{e.encoded_email===l.dataset.originalString&&(t=e)}),e=t.decoded_email.split(/[&?]/)[0]}else e=o.data[0].decoded_email;var n=t.querySelector("#apbct_email_ecoder__popup_text_node_first"),c=document.createElement("b"),c=(c.setAttribute("class","apbct-email-encoder-select-whole-email"),c.innerText=e,"undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.text__ee_click_to_select?c.title=ctPublicFunctions.text__ee_click_to_select:c.title=ctAdminCommon.text__ee_click_to_select,n&&("undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.text__ee_original_email?n.innerHTML=ctPublicFunctions.text__ee_original_email+" "+c.outerHTML:n.innerHTML=ctAdminCommon.text__ee_original_email+" "+c.outerHTML,n.setAttribute("style","flex-direction: row;")),t.querySelector(".apbct-ee-animation-wrapper")),n=(c&&c.remove(),t.querySelector("#apbct_email_ecoder__popup_text_node_second")),c=(n&&n.remove(),document.createElement("span"));c.classList="apbct-email-encoder-elements_center top-margin-long",document.querySelector(".apbct-email-encoder-got-it-button")||(n=document.createElement("button"),"undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.text__ee_got_it?n.innerText=ctPublicFunctions.text__ee_got_it:n.innerText=ctAdminCommon.text__ee_got_it,n.classList="apbct-email-encoder-got-it-button",n.addEventListener("click",function(){apbctEmailEncoderClosePopup(),"undefined"!=typeof ctPublic&&ctPublic.encodedEmailNodesIsMixed&&l&&l.click()}),c.append(n),t.append(c)),apbctEmailEncoderBindPopupEvents(t,function(){fillDecodedNodes(a,o)})}},3e3);else if(l){let e="unknown_error";o.hasOwnProperty("data")&&0{e.encoded_email===c[n].dataset.originalString&&(t=e)}),!1===t.is_allowed)return;if(void 0===c[n].href||0!==c[n].href.indexOf("mailto:")&&0!==c[n].href.indexOf("tel:"))c[n].classList.add("no-blur"),setTimeout(()=>{ctProcessDecodedDataResult(t,c[n])},2e3);else{let e;if(0===c[n].href.indexOf("mailto:"))e="mailto:";else{if(0!==c[n].href.indexOf("tel:"))continue;e="tel:"}var a=c[n].href.replace(e,"");ctReplaceInTextNodes(c[n],a,ctHtmlToText(t.decoded_email)),c[n].href=e+t.decoded_email,c[n].querySelectorAll("span.apbct-email-encoder").forEach(t=>{let n="";o.data.forEach(e=>{e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.textContent=ctHtmlToText(n)})}c[n].removeEventListener("click",ctFillDecodedEmailHandler)}else{let e=o.data[0];c.classList.add("no-blur"),setTimeout(()=>{ctProcessDecodedDataResult(e,c)},2e3),c.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctReplaceInTextNodes(e,t,n){if(t){e.normalize();for(var c,o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);c=o.nextNode();)if(-1!==c.nodeValue.indexOf(t))return void(c.nodeValue=c.nodeValue.replace(t,()=>n))}}function ctHtmlToText(e){return e?(new DOMParser).parseFromString(String(e),"text/html").documentElement.textContent:""}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(t,e){let n=null;for(let e=0;e {\n if (row.encoded_email === clickSource.dataset.originalString) {\n currentResultData = row;\n }\n });\n\n email = currentResultData.decoded_email.split(/[&?]/)[0];\n } else {\n email = result.data[0].decoded_email;\n }\n // handle first node\n let firstNode = popup.querySelector('#apbct_email_ecoder__popup_text_node_first');\n // get email selectable by click\n let selectableEmail = document.createElement('b');\n selectableEmail.setAttribute('class', 'apbct-email-encoder-select-whole-email');\n selectableEmail.innerText = email;\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_click_to_select) {\n selectableEmail.title = ctPublicFunctions.text__ee_click_to_select;\n } else {\n selectableEmail.title = ctAdminCommon.text__ee_click_to_select;\n }\n // add email to the first node\n if (firstNode) {\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_original_email) {\n firstNode.innerHTML = ctPublicFunctions.text__ee_original_email +\n ' ' + selectableEmail.outerHTML;\n } else {\n firstNode.innerHTML = ctAdminCommon.text__ee_original_email +\n ' ' + selectableEmail.outerHTML;\n }\n\n firstNode.setAttribute('style', 'flex-direction: row;');\n }\n // remove animation\n let wrapper = popup.querySelector('.apbct-ee-animation-wrapper');\n if (wrapper) {\n wrapper.remove();\n }\n // remove second node\n let secondNode = popup.querySelector('#apbct_email_ecoder__popup_text_node_second');\n if (secondNode) {\n secondNode.remove();\n }\n // add button\n let buttonWrapper = document.createElement('span');\n buttonWrapper.classList = 'apbct-email-encoder-elements_center top-margin-long';\n if (!document.querySelector('.apbct-email-encoder-got-it-button')) {\n let button = document.createElement('button');\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_got_it) {\n button.innerText = ctPublicFunctions.text__ee_got_it;\n } else {\n button.innerText = ctAdminCommon.text__ee_got_it;\n }\n button.classList = 'apbct-email-encoder-got-it-button';\n button.addEventListener('click', function() {\n document.body.classList.remove('apbct-popup-fade');\n popup.setAttribute('style', 'display:none');\n fillDecodedNodes(encodedEmailNodes, result);\n // click on mailto if so\n if (typeof ctPublic !== 'undefined' && ctPublic.encodedEmailNodesIsMixed && clickSource) {\n clickSource.click();\n }\n });\n buttonWrapper.append(button);\n popup.append(buttonWrapper);\n }\n }\n }, 3000);\n } else {\n if (clickSource) {\n let comment = 'unknown_error';\n if (\n result.hasOwnProperty('data') &&\n result.data.length > 0 &&\n typeof result.data[0] === 'object' &&\n typeof result.data[0].comment === 'string'\n ) {\n comment = result.data[0].comment;\n }\n if (result.success) {\n resetEncodedNodes();\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_blocked) {\n ctShowDecodeComment(ctPublicFunctions.text__ee_blocked + ': ' + comment);\n } else {\n ctShowDecodeComment(ctAdminCommon.text__ee_blocked + ': ' + comment);\n }\n } else {\n resetEncodedNodes();\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_cannot_connect) {\n ctShowDecodeComment(ctPublicFunctions.text__ee_cannot_connect + ': ' + comment);\n } else {\n ctShowDecodeComment(ctAdminCommon.text__ee_cannot_connect + ': ' + comment);\n }\n }\n } else {\n console.log('result', result);\n }\n }\n}\n\n/**\n * Reset click event for encoded email\n */\nfunction resetEncodedNodes() {\n if (typeof ctPublic.encodedEmailNodes !== 'undefined') {\n ctPublic.encodedEmailNodes.forEach(function(element) {\n element.addEventListener('click', ctFillDecodedEmailHandler);\n });\n }\n}\n\n/**\n * Show Decode Comment\n * @param {string} comment\n */\nfunction ctShowDecodeComment(comment) {\n if ( ! comment ) {\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_cannot_decode) {\n comment = ctPublicFunctions.text__ee_cannot_decode;\n } else {\n comment = ctAdminCommon.text__ee_cannot_decode;\n }\n }\n\n let popup = document.getElementById('apbct_popup');\n let popupText = document.getElementById('apbct_popup_text');\n if (popup !== null) {\n document.body.classList.remove('apbct-popup-fade');\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_email_decoder) {\n popupText.innerText = ctPublicFunctions.text__ee_email_decoder + ': ' + comment;\n } else {\n popupText.innerText = ctAdminCommon.text__ee_email_decoder + ': ' + comment;\n }\n setTimeout(function() {\n popup.setAttribute('style', 'display:none');\n }, 3000);\n }\n}\n\n/**\n * Run filling for every node with decoding result.\n * @param {mixed} encodedNodes\n * @param {mixed} decodingResult\n */\nfunction fillDecodedNodes(encodedNodes, decodingResult) {\n if (encodedNodes.length > 0) {\n for (let i = 0; i < encodedNodes.length; i++) {\n // chek what is what\n let currentResultData;\n decodingResult.data.forEach((row) => {\n if (row.encoded_email === encodedNodes[i].dataset.originalString) {\n currentResultData = row;\n }\n });\n // quit case on cloud block\n if (currentResultData.is_allowed === false) {\n return;\n }\n // handler for mailto\n if (\n typeof encodedNodes[i].href !== 'undefined' &&\n (\n encodedNodes[i].href.indexOf('mailto:') === 0 ||\n encodedNodes[i].href.indexOf('tel:') === 0\n )\n ) {\n let linkTypePrefix;\n if (encodedNodes[i].href.indexOf('mailto:') === 0) {\n linkTypePrefix = 'mailto:';\n } else if (encodedNodes[i].href.indexOf('tel:') === 0) {\n linkTypePrefix = 'tel:';\n } else {\n continue;\n }\n let encodedEmail = encodedNodes[i].href.replace(linkTypePrefix, '');\n ctReplaceInTextNodes(\n encodedNodes[i],\n encodedEmail,\n ctHtmlToText(currentResultData.decoded_email),\n );\n encodedNodes[i].href = linkTypePrefix + currentResultData.decoded_email;\n\n encodedNodes[i].querySelectorAll('span.apbct-email-encoder').forEach((el) => {\n let encodedEmailTextInsideMailto = '';\n decodingResult.data.forEach((row) => {\n if (row.encoded_email === el.dataset.originalString) {\n encodedEmailTextInsideMailto = row.decoded_email;\n }\n });\n el.textContent = ctHtmlToText(encodedEmailTextInsideMailto);\n });\n } else {\n encodedNodes[i].classList.add('no-blur');\n // fill the nodes\n setTimeout(() => {\n ctProcessDecodedDataResult(currentResultData, encodedNodes[i]);\n }, 2000);\n }\n // remove listeners\n encodedNodes[i].removeEventListener('click', ctFillDecodedEmailHandler);\n }\n } else {\n let currentResultData = decodingResult.data[0];\n encodedNodes.classList.add('no-blur');\n // fill the nodes\n setTimeout(() => {\n ctProcessDecodedDataResult(currentResultData, encodedNodes);\n }, 2000);\n encodedNodes.removeEventListener('click', ctFillDecodedEmailHandler);\n }\n}\n\n/**\n * Replace the first occurrence of search in element text only, never in markup or attributes.\n * @param {HTMLElement} element\n * @param {string} search\n * @param {string} replacement\n */\nfunction ctReplaceInTextNodes(element, search, replacement) {\n if (!search) {\n return;\n }\n // Merge adjacent text nodes so a token split between them is still found.\n element.normalize();\n const walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT);\n let node;\n while ((node = walker.nextNode())) {\n if (node.nodeValue.indexOf(search) !== -1) {\n node.nodeValue = node.nodeValue.replace(search, () => replacement);\n return;\n }\n }\n}\n\n/**\n * Convert server HTML to plain text without rendering it.\n * @param {string} html\n * @return {string}\n */\nfunction ctHtmlToText(html) {\n if (!html) {\n return '';\n }\n // DOMParser documents are inert: no scripts run and no event handlers fire.\n return new DOMParser().parseFromString(String(html), 'text/html').documentElement.textContent;\n}\n\n/**\n * @param {mixed} response\n * @param {mixed} targetElement\n */\nfunction ctProcessDecodedDataResult(response, targetElement) {\n targetElement.setAttribute('title', '');\n targetElement.removeAttribute('style');\n ctFillDecodedEmail(targetElement, response.decoded_email);\n}\n\n/**\n * @param {mixed} target\n * @param {string} email\n */\nfunction ctFillDecodedEmail(target, email) {\n target.innerHTML = target.innerHTML.replace(/.+?(
)/, email + '$1');\n}\n\nlet ctEmailDecoderIsInitialized = false;\n\n// Listen clicks on encoded emails\ndocument.addEventListener('DOMContentLoaded', function() {\n // Some plugins dispatch a synthetic DOMContentLoaded, listeners must not be attached twice\n if (ctEmailDecoderIsInitialized) {\n return;\n }\n ctEmailDecoderIsInitialized = true;\n\n let encodedEmailNodes = document.querySelectorAll('[data-original-string]');\n if (typeof ctPublic !== 'undefined') {\n ctPublic.encodedEmailNodes = encodedEmailNodes;\n }\n if (encodedEmailNodes.length) {\n for (let i = 0; i < encodedEmailNodes.length; ++i) {\n const node = encodedEmailNodes[i];\n if (\n node.parentNode &&\n node.parentNode.tagName === 'A' &&\n node.parentNode.getAttribute('href')?.includes('mailto:') &&\n node.parentNode.hasAttribute('data-original-string')\n ) {\n // This node was skipped from listeners\n continue;\n }\n node.addEventListener('click', ctFillDecodedEmailHandler);\n }\n }\n});\n","(function() {\n const {__} = wp.i18n;\n jQuery(document).ready(function($) {\n // Auto update banner close handler\n jQuery('.apbct_update_notice').on('click', 'button', function() {\n let ctDate = new Date(new Date().getTime() + 1000 * 86400 * 30 );\n let ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = 'apbct_update_banner_closed=1; path=/; expires=' +\n ctDate.toUTCString() + '; samesite=lax' + ctSecure;\n });\n\n jQuery('li a[href=\"options-general.php?page=cleantalk\"]').css('white-space', 'nowrap')\n .css('display', 'inline-block');\n\n jQuery('body').on('click', '.apbct-notice .notice-dismiss', function(e) {\n let apbctNoticeName = jQuery(e.target).parent().attr('id');\n if ( apbctNoticeName ) {\n apbct_admin_sendAJAX(\n {\n 'action': 'cleantalk_dismiss_notice',\n 'notice_id': apbctNoticeName,\n },\n {\n 'callback': null,\n 'notJson': true,\n },\n );\n }\n });\n\n // Notice when deleting user\n jQuery('.ct_username .row-actions .delete a').on('click', function(e) {\n e.preventDefault();\n\n let result = confirm(ctAdminCommon.notice_when_deleting_user_text);\n\n if (result) {\n window.location = this.href;\n }\n });\n\n let btnForceProtectionOn = document.querySelector('#apbct_setting_forms__force_protection__On');\n if (btnForceProtectionOn) {\n btnForceProtectionOn.addEventListener('click', function(e) {\n if (btnForceProtectionOn.checked) {\n let result = confirm(ctAdminCommon.apbctNoticeForceProtectionOn);\n\n if (!result) {\n e.preventDefault();\n }\n }\n });\n }\n // Restore spam order\n $('.apbct-restore-spam-order-button').click(function() {\n const spmOrderId = $(this).data('spam-order-id');\n let data = {\n action: 'apbct_restore_spam_order',\n _ajax_nonce: ctAdminCommon._ajax_nonce,\n order_id: spmOrderId,\n };\n $.ajax({\n type: 'POST',\n url: ctAdminCommon._ajax_url,\n data: data,\n success: function(result) {\n if (result.success) {\n window.location.reload();\n } else {\n alert(result.data.message);\n }\n },\n });\n });\n\n // Extended spam order details show via modal\n $('.apbct-details-spam-order-button').click(function() {\n const spmOrderId = $(this).data('spam-order-id');\n let data = {\n action: 'apbct_details_spam_order',\n _ajax_nonce: ctAdminCommon._ajax_nonce,\n order_id: spmOrderId,\n };\n if (typeof cleantalkModal !== 'undefined') {\n cleantalkModal.loaded = false;\n cleantalkModal.open(false);\n $.ajax({\n type: 'POST',\n url: ctAdminCommon._ajax_url,\n data: data,\n success: function(result) {\n const modalContent = $('#cleantalk-modal-content');\n modalContent.empty();\n if (result.success && result.data) {\n const container = apbctGetWCOrderDetailsModalContainer(result.data);\n const containerHeader = document.createElement('h3');\n const linkHeader = document.createElement('a');\n const linkHeaderWrapper = document.createElement('p');\n containerHeader.className = 'apbct_wc_details__table-container_header';\n containerHeader.textContent = __(\n 'WooCommerce spam order details',\n 'cleantalk-spam-protect',\n );\n linkHeader.href = new URL(\n 'https://cleantalk.org/my/show_requests?allow=0&request_type=order',\n ).toString();\n linkHeader.rel = 'noopener noreferrer';\n linkHeader.target = '_blank';\n linkHeader.textContent = linkHeader.href;\n linkHeaderWrapper.textContent = __(\n 'Visit CleanTalk Cloud Dashboard to see all of denied requests: ',\n 'cleantalk-spam-protect',\n );\n linkHeaderWrapper.style.textAlign ='center';\n linkHeaderWrapper.appendChild(linkHeader);\n\n modalContent.append(containerHeader);\n modalContent.append(linkHeaderWrapper);\n modalContent.append(container);\n } else {\n const error = (result && result.data && result.data.error) ?\n result.data.error :\n __('Unknown error occurred', 'cleantalk-spam-protect');\n modalContent.text(error);\n }\n cleantalkModal.loaded = true;\n },\n error: function(xhr, status, error) {\n console.error('AJAX Error:', error);\n alert(\n __(\n 'An error occurred while processing your request, see console for details.',\n 'cleantalk-spam-protect',\n ),\n );\n },\n });\n } else {\n alert(\n __(\n 'Can not initialize CleanTalk modal window.',\n 'cleantalk-spam-protect',\n ),\n );\n }\n });\n\n // Email decoder example\n if (window.location.href.includes('options-general.php?page=cleantalk')) {\n let encodedEmailNode = document.querySelector('[data-original-string]');\n if (encodedEmailNode) {\n ctAdminCommon.encodedEmailNode = encodedEmailNode;\n encodedEmailNode.style.cursor = 'pointer';\n encodedEmailNode.addEventListener('click', ctFillDecodedEmailHandler);\n }\n }\n });\n\n /**\n * apbctGetWCOrderDetailsModalContainer\n * @param {object} wcOrderData\n * @return {HTMLDivElement}\n */\n function apbctGetWCOrderDetailsModalContainer(wcOrderData) {\n const container = document.createElement('div');\n container.className = 'apbct_wc_details__wrapper';\n\n /**\n * createTableFromObject\n * @param {object} obj\n * @param {string} title\n * @return {HTMLDivElement}\n */\n function createTableFromObject(obj, title) {\n const tableWrapperInner = document.createElement('div');\n tableWrapperInner.className = 'apbct_wc_details__table-wrapper-inner';\n\n const header = document.createElement('h4');\n header.textContent = title;\n tableWrapperInner.appendChild(header);\n\n const table = document.createElement('table');\n table.className = 'apbct_wc_details__table';\n\n const tbody = document.createElement('tbody');\n\n for (const [key, value] of Object.entries(obj)) {\n const row = document.createElement('tr');\n\n const keyCell = document.createElement('td');\n keyCell.className = 'apbct_wc_details__table-key-cell';\n keyCell.textContent = key;\n\n const valueCell = document.createElement('td');\n valueCell.className = 'apbct_wc_details__table-value-cell';\n\n if (typeof value === 'object' && value !== null) {\n valueCell.textContent = JSON.stringify(value, null, 2);\n valueCell.classList.add('apbct_wc_details__table-value-cell--json');\n } else {\n valueCell.textContent = value !== null && value !== undefined ? value : '—';\n }\n\n row.appendChild(keyCell);\n row.appendChild(valueCell);\n tbody.appendChild(row);\n }\n\n table.appendChild(tbody);\n tableWrapperInner.appendChild(table);\n return tableWrapperInner;\n }\n\n if (wcOrderData.order_details) {\n const orderDetails = wcOrderData.order_details;\n for (const [key, value] of Object.entries(orderDetails)) {\n const productName = orderDetails[key] && typeof orderDetails[key]['product_name'] === 'string' ?\n orderDetails[key]['product_name'] :\n __('Unknown product name', 'cleantalk-spam-protect');\n const header = __('Order Details for', 'cleantalk-spam-protect');\n container.appendChild(createTableFromObject(value, `${header} ${productName}`));\n }\n }\n\n if (wcOrderData.customer_details) {\n container.appendChild(\n createTableFromObject(wcOrderData.customer_details, 'Customer Details'),\n );\n }\n\n return container;\n }\n // eslint-disable-next-line camelcase,require-jsdoc,no-unused-vars\n function apbct_admin_sendAJAX(data, params, obj) {\n // Default params\n let callback = params.callback || null;\n let callbackContext = params.callback_context || null;\n let callbackParams = params.callback_params || null;\n let async = params.async || true;\n let notJson = params.notJson || null;\n let timeout = params.timeout || 15000;\n var obj = obj || null; // eslint-disable-line no-var\n let button = params.button || null;\n let spinner = params.spinner || null;\n let progressbar = params.progressbar || null;\n\n if (typeof (data) === 'string') {\n data = data + '&_ajax_nonce=' + ctAdminCommon._ajax_nonce + '&no_cache=' + Math.random();\n } else {\n data._ajax_nonce = ctAdminCommon._ajax_nonce;\n data.no_cache = Math.random();\n }\n // Button and spinner\n if (button) {\n button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed';\n }\n if (spinner) jQuery(spinner).css('display', 'inline');\n\n jQuery.ajax({\n type: 'POST',\n url: ctAdminCommon._ajax_url,\n data: data,\n async: async,\n success: function(result) {\n if (button) {\n button.removeAttribute('disabled'); button.style.cursor = 'pointer';\n }\n if (spinner) jQuery(spinner).css('display', 'none');\n if (!notJson) result = JSON.parse(result);\n if (result.error) {\n setTimeout(function() {\n if (progressbar) progressbar.fadeOut('slow');\n }, 1000);\n if ( typeof cleantalkModal !== 'undefined' ) {\n // Show the result by modal\n cleantalkModal.loaded = 'Error:
' + result.error.toString();\n cleantalkModal.open();\n } else {\n alert('Error happens: ' + (result.error || 'Unkown'));\n }\n } else {\n if (callback) {\n if (callbackParams) {\n callback.apply( callbackContext, callbackParams.concat( result, data, params, obj ) );\n } else {\n callback(result, data, params, obj);\n }\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown) {\n if (button) {\n button.removeAttribute('disabled'); button.style.cursor = 'pointer';\n }\n if (spinner) jQuery(spinner).css('display', 'none');\n console.log('APBCT_AJAX_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log(errorThrown);\n },\n timeout: timeout,\n });\n }\n\n // Keep AJAX helper global — used by settings page and other admin scripts.\n // eslint-disable-next-line camelcase\n window.apbct_admin_sendAJAX = apbct_admin_sendAJAX;\n})();\n"]} \ No newline at end of file +{"version":3,"sources":["common-decoder.js","cleantalk-admin.js"],"names":["apbctSetEmailDecoderPopupAnimation","animationElements","animationWrapper","document","createElement","classList","let","i","length","apbctEEAnimationDogOne","innerText","append","__","wp","i18n","apbct_admin_sendAJAX","data","params","obj","callback","callbackContext","callback_context","callbackParams","callback_params","async","notJson","timeout","button","spinner","progressbar","ctAdminCommon","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_ajax_url","success","result","removeAttribute","JSON","parse","error","setTimeout","fadeOut","cleantalkModal","loaded","toString","open","alert","apply","concat","jqXHR","textStatus","errorThrown","console","log","ready","$","on","ctDate","Date","getTime","ctSecure","location","protocol","cookie","toUTCString","e","apbctNoticeName","target","parent","attr","action","notice_id","preventDefault","confirm","notice_when_deleting_user_text","window","this","href","btnForceProtectionOn","querySelector","encodedEmailNode","addEventListener","checked","apbctNoticeForceProtectionOn","click","spmOrderId","order_id","reload","message","container","containerHeader","linkHeaderWrapper","modalContent","empty","wcOrderData","createTableFromObject","title","key","value","tableWrapperInner","header","className","table","textContent","appendChild","tbody","Object","entries","row","keyCell","valueCell","stringify","add","order_details","orderDetails","productName","customer_details","linkHeader","URL","rel","textAlign","text","xhr","status","includes","ctFillDecodedEmailHandler","apbctEmailEncoderOnClose","apbctEmailEncoderClosePopup","onClose","popup","body","remove","getElementById","apbctEmailEncoderUnbindPopupEvents","display","apbctEmailEncoderBackdropClickHandler","event","contains","apbctEmailEncoderBindPopupEvents","closeButton","removeEventListener","clickSource","ctWlBrandname","encodedEmail","encoderPopup","ctPublic","encodedEmailNodesIsMixed","wl_brandname","encodedEmailNodes","plugin_name","waitingPopup","popupHeaderWrapper","popupTextWrapper","popupTextWaiting","popupTextDecoding","ctPublicFunctions","text__ee_wait_for_decoding","innerHTML","popupHeader","color","id","text__ee_decoding_process","apbctAjaxEmailDecodeBulk","post_url","referrer","encodedEmails","encodedEmailsCollection","bot_detector_enabled","event_token","apbctLocalStorage","get","event_javascript_data","getJavascriptClientData","indexOf","apbctTooltip","apbct","dataset","originalString","data__ajax_type","apbct_public_sendREST","method","ctSetCookie","emailEncoderPassKey","apbctEmailEncoderCallbackBulk","onErrorCallback","res","resetEncodedNodes","ctShowDecodeComment","apbct_public_sendAJAX","0","is_allowed","email","currentResultData","forEach","encoded_email","decoded_email","split","firstNode","selectableEmail","wrapper","text__ee_click_to_select","text__ee_original_email","outerHTML","secondNode","buttonWrapper","text__ee_got_it","fillDecodedNodes","comment","hasOwnProperty","text__ee_blocked","text__ee_cannot_connect","element","text__ee_cannot_decode","popupText","text__ee_email_decoder","encodedNodes","decodingResult","ctProcessDecodedDataResult","linkTypePrefix","replace","ctReplaceInTextNodes","ctHtmlToText","querySelectorAll","encodedEmailTextInsideMailto","el","search","replacement","normalize","node","walker","createTreeWalker","NodeFilter","SHOW_TEXT","nextNode","nodeValue","html","DOMParser","parseFromString","String","documentElement","response","targetElement","ctFillDecodedEmail","tooltip","children","previousSibling","removeChild","nodes","childNodes","insertBefore","importNode","ctEmailDecoderIsInitialized","parentNode","tagName","getAttribute","hasAttribute"],"mappings":"AAGA,SAAAA,qCACA,IAAAC,EAAA,CAAA,gBAAA,gBAAA,mBACAC,EAAAC,SAAAC,cAAA,KAAA,EACAF,EAAAG,UAAA,6BACA,IAAAC,IAAAC,EAAA,EAAAA,EAAAN,EAAAO,OAAAD,CAAA,GAAA,CACA,IAAAE,EAAAN,SAAAC,cAAA,MAAA,EACAK,EAAAJ,UAAA,aAAAJ,EAAAM,GACAE,EAAAC,UAAA,IACAR,EAAAS,OAAAF,CAAA,CACA,CACA,OAAAP,CACA,ECdA,KACA,IAAAU,EAAAC,GAAAC,KAAA,GAwOA,SAAAC,EAAAC,EAAAC,EAAAC,GAEAZ,IAAAa,EAAAF,EAAAE,UAAA,KACAC,EAAAH,EAAAI,kBAAA,KACAC,EAAAL,EAAAM,iBAAA,KACAjB,IAAAkB,EAAAP,EAAAO,OAAA,CAAA,EACAlB,IAAAmB,EAAAR,EAAAQ,SAAA,KACAnB,IAAAoB,EAAAT,EAAAS,SAAA,KACAR,EAAAA,GAAA,KACAZ,IAAAqB,EAAAV,EAAAU,QAAA,KACAC,EAAAX,EAAAW,SAAA,KACAC,EAAAZ,EAAAY,aAAA,KAEA,UAAA,OAAA,EACAb,EAAAA,EAAA,gBAAAc,cAAAC,YAAA,aAAAC,KAAAC,OAAA,GAEAjB,EAAAe,YAAAD,cAAAC,YACAf,EAAAkB,SAAAF,KAAAC,OAAA,GAGAN,IACAA,EAAAQ,aAAA,WAAA,UAAA,EAAAR,EAAAS,MAAAC,OAAA,eAEAT,GAAAU,OAAAV,CAAA,EAAAW,IAAA,UAAA,QAAA,EAEAD,OAAAE,KAAA,CACAC,KAAA,OACAC,IAAAZ,cAAAa,UACA3B,KAAAA,EACAQ,MAAAA,EACAoB,QAAA,SAAAC,GACAlB,IACAA,EAAAmB,gBAAA,UAAA,EAAAnB,EAAAS,MAAAC,OAAA,WAEAT,GAAAU,OAAAV,CAAA,EAAAW,IAAA,UAAA,MAAA,GACAM,EAAApB,EACAoB,EADAE,KAAAC,MAAAH,CAAA,GACAI,OACAC,WAAA,WACArB,GAAAA,EAAAsB,QAAA,MAAA,CACA,EAAA,GAAA,EACA,aAAA,OAAAC,gBAEAA,eAAAC,OAAA,aAAAR,EAAAI,MAAAK,SAAA,EACAF,eAAAG,KAAA,GAEAC,MAAA,mBAAAX,EAAAI,OAAA,SAAA,GAGA9B,IACAG,EACAH,EAAAsC,MAAArC,EAAAE,EAAAoC,OAAAb,EAAA7B,EAAAC,EAAAC,CAAA,CAAA,EAEAC,EAAA0B,EAAA7B,EAAAC,EAAAC,CAAA,EAIA,EACA+B,MAAA,SAAAU,EAAAC,EAAAC,GACAlC,IACAA,EAAAmB,gBAAA,UAAA,EAAAnB,EAAAS,MAAAC,OAAA,WAEAT,GAAAU,OAAAV,CAAA,EAAAW,IAAA,UAAA,MAAA,EACAuB,QAAAC,IAAA,kBAAA,EACAD,QAAAC,IAAAJ,CAAA,EACAG,QAAAC,IAAAH,CAAA,EACAE,QAAAC,IAAAF,CAAA,CACA,EACAnC,QAAAA,CACA,CAAA,CACA,CA5SAY,OAAAnC,QAAA,EAAA6D,MAAA,SAAAC,GAEA3B,OAAA,sBAAA,EAAA4B,GAAA,QAAA,SAAA,WACA5D,IAAA6D,EAAA,IAAAC,MAAA,IAAAA,MAAAC,QAAA,EAAA,MAAA,EACAC,EAAA,WAAAC,SAAAC,SAAA,WAAA,GACArE,SAAAsE,OAAA,iDACAN,EAAAO,YAAA,EAAA,iBAAAJ,CACA,CAAA,EAEAhC,OAAA,iDAAA,EAAAC,IAAA,cAAA,QAAA,EACAA,IAAA,UAAA,cAAA,EAEAD,OAAA,MAAA,EAAA4B,GAAA,QAAA,gCAAA,SAAAS,GACAC,EAAAtC,OAAAqC,EAAAE,MAAA,EAAAC,OAAA,EAAAC,KAAA,IAAA,EACAH,GACA7D,EACA,CACAiE,OAAA,2BACAC,UAAAL,CACA,EACA,CACAzD,SAAA,KACAM,QAAA,CAAA,CACA,CACA,CAEA,CAAA,EAGAa,OAAA,qCAAA,EAAA4B,GAAA,QAAA,SAAAS,GACAA,EAAAO,eAAA,EAEAC,QAAArD,cAAAsD,8BAAA,IAGAC,OAAAd,SAAAe,KAAAC,KAEA,CAAA,EAEAjF,IAAAkF,EAAArF,SAAAsF,cAAA,4CAAA,EA2GA,IACAC,EA3GAF,GACAA,EAAAG,iBAAA,QAAA,SAAAhB,GACAa,EAAAI,SACAT,CAAAA,QAAArD,cAAA+D,4BAAA,GAGAlB,EAAAO,eAAA,CAGA,CAAA,EAGAjB,EAAA,kCAAA,EAAA6B,MAAA,WACA,IAAAC,EAAA9B,EAAAqB,IAAA,EAAAtE,KAAA,eAAA,EACAA,EAAA,CACAgE,OAAA,2BACAjD,YAAAD,cAAAC,YACAiE,SAAAD,CACA,EACA9B,EAAAzB,KAAA,CACAC,KAAA,OACAC,IAAAZ,cAAAa,UACA3B,KAAAA,EACA4B,QAAA,SAAAC,GACAA,EAAAD,QACAyC,OAAAd,SAAA0B,OAAA,EAEAzC,MAAAX,EAAA7B,KAAAkF,OAAA,CAEA,CACA,CAAA,CACA,CAAA,EAGAjC,EAAA,kCAAA,EAAA6B,MAAA,WACA,IAAAC,EAAA9B,EAAAqB,IAAA,EAAAtE,KAAA,eAAA,EACAA,EAAA,CACAgE,OAAA,2BACAjD,YAAAD,cAAAC,YACAiE,SAAAD,CACA,EACA,aAAA,OAAA3C,gBACAA,eAAAC,OAAA,CAAA,EACAD,eAAAG,KAAA,CAAA,CAAA,EACAU,EAAAzB,KAAA,CACAC,KAAA,OACAC,IAAAZ,cAAAa,UACA3B,KAAAA,EACA4B,QAAA,SAAAC,GACA,IAGAsD,EACAC,EAEAC,EAuBApD,EA7BAqD,EAAArC,EAAA,0BAAA,EACAqC,EAAAC,MAAA,EACA1D,EAAAD,SAAAC,EAAA7B,MACAmF,GAqEAK,IACA,IAAAL,EAAAhG,SAAAC,cAAA,KAAA,EASA,SAAAqG,EAAAvF,EAAAwF,GACA,IAYAC,EAAAC,EAZAC,EAAA1G,SAAAC,cAAA,KAAA,EAGA0G,GAFAD,EAAAE,UAAA,wCAEA5G,SAAAC,cAAA,IAAA,GAIA4G,GAHAF,EAAAG,YAAAP,EACAG,EAAAK,YAAAJ,CAAA,EAEA3G,SAAAC,cAAA,OAAA,GAGA+G,GAFAH,EAAAD,UAAA,0BAEA5G,SAAAC,cAAA,OAAA,GAEA,IAAA,CAAAuG,EAAAC,KAAAQ,OAAAC,QAAAnG,CAAA,EAAA,CACA,IAAAoG,EAAAnH,SAAAC,cAAA,IAAA,EAEAmH,EAAApH,SAAAC,cAAA,IAAA,EAIAoH,GAHAD,EAAAR,UAAA,mCACAQ,EAAAN,YAAAN,EAEAxG,SAAAC,cAAA,IAAA,GACAoH,EAAAT,UAAA,qCAEA,UAAA,OAAAH,GAAA,OAAAA,GACAY,EAAAP,YAAAlE,KAAA0E,UAAAb,EAAA,KAAA,CAAA,EACAY,EAAAnH,UAAAqH,IAAA,0CAAA,GAEAF,EAAAP,YAAAL,MAAAA,EAAAA,EAAA,IAGAU,EAAAJ,YAAAK,CAAA,EACAD,EAAAJ,YAAAM,CAAA,EACAL,EAAAD,YAAAI,CAAA,CACA,CAIA,OAFAN,EAAAE,YAAAC,CAAA,EACAN,EAAAK,YAAAF,CAAA,EACAH,CACA,CAEA,GAhDAV,EAAAY,UAAA,4BAgDAP,EAAAmB,cAAA,CACA,IACAhB,EAAAC,EADAgB,EAAApB,EAAAmB,cACA,IAAA,CAAAhB,EAAAC,KAAAQ,OAAAC,QAAAO,CAAA,EAAA,CACA,IAAAC,EAAAD,EAAAjB,IAAA,UAAA,OAAAiB,EAAAjB,GAAA,aACAiB,EAAAjB,GAAA,aACA/F,EAAA,uBAAA,wBAAA,EACAkG,EAAAlG,EAAA,oBAAA,wBAAA,EACAuF,EAAAe,YAAAT,EAAAG,EAAAE,EAAA,IAAAe,CAAA,CAAA,CACA,CACA,CAQA,OANArB,EAAAsB,kBACA3B,EAAAe,YACAT,EAAAD,EAAAsB,iBAAA,kBAAA,CACA,EAGA3B,CACA,GAzIAtD,EAAA7B,IAAA,EACAoF,EAAAjG,SAAAC,cAAA,IAAA,EACA2H,EAAA5H,SAAAC,cAAA,GAAA,EACAiG,EAAAlG,SAAAC,cAAA,GAAA,EACAgG,EAAAW,UAAA,2CACAX,EAAAa,YAAArG,EACA,iCACA,wBACA,EACAmH,EAAAxC,KAAA,IAAAyC,IACA,mEACA,EAAA1E,SAAA,EACAyE,EAAAE,IAAA,sBACAF,EAAAlD,OAAA,SACAkD,EAAAd,YAAAc,EAAAxC,KACAc,EAAAY,YAAArG,EACA,kEACA,wBACA,EACAyF,EAAAjE,MAAA8F,UAAA,SACA7B,EAAAa,YAAAa,CAAA,EAEAzB,EAAA3F,OAAAyF,CAAA,EACAE,EAAA3F,OAAA0F,CAAA,EACAC,EAAA3F,OAAAwF,CAAA,IAEAlD,EAAAJ,GAAAA,EAAA7B,MAAA6B,EAAA7B,KAAAiC,MACAJ,EAAA7B,KAAAiC,MACArC,EAAA,yBAAA,wBAAA,EACA0F,EAAA6B,KAAAlF,CAAA,GAEAG,eAAAC,OAAA,CAAA,CACA,EACAJ,MAAA,SAAAmF,EAAAC,EAAApF,GACAa,QAAAb,MAAA,cAAAA,CAAA,EACAO,MACA5C,EACA,4EACA,wBACA,CACA,CACA,CACA,CAAA,GAEA4C,MACA5C,EACA,6CACA,wBACA,CACA,CAEA,CAAA,EAGAyE,OAAAd,SAAAgB,KAAA+C,SAAA,oCAAA,IACA5C,EAAAvF,SAAAsF,cAAA,wBAAA,MAEA3D,cAAA4D,iBAAAA,GACAtD,MAAAC,OAAA,UACAqD,EAAAC,iBAAA,QAAA4C,yBAAA,EAGA,CAAA,EAsJAlD,OAAAtE,qBAAAA,CACA,GAAA,EDnSAT,IAAAkI,yBAAA,KAKA,SAAAC,8BACA,IAAAC,EAAAF,yBAEAG,GADAxI,SAAAyI,KAAAvI,UAAAwI,OAAA,kBAAA,EACA1I,SAAA2I,eAAA,aAAA,GACAH,IACAI,mCAAAJ,CAAA,EACAA,EAAAvG,MAAA4G,QAAA,QAEAN,IACAF,yBAAA,KACAE,EAAA,EAEA,CAKA,SAAAO,sCAAAC,GACA,IAAAP,EAAAxI,SAAA2I,eAAA,aAAA,EAEAH,GACA,SAAAA,EAAAvG,MAAA4G,SACA7I,SAAAyI,KAAAvI,UAAA8I,SAAA,kBAAA,GACA,CAAAR,EAAAQ,SAAAD,EAAArE,MAAA,GAEA4D,4BAAA,CAEA,CAMA,SAAAW,iCAAAT,EAAAD,GACAF,yBAAAE,EACAW,EAAAV,EAAAlD,cAAA,mCAAA,EACA4D,IACAA,EAAAhJ,UAAAqH,IAAA,2CAAA,EACA2B,EAAA1D,iBAAA,QAAA8C,2BAAA,GAGAtI,SAAAyI,KAAAjD,iBAAA,QAAAsD,qCAAA,CACA,CAKA,SAAAF,mCAAAJ,GACAH,yBAAA,KACAa,EAAAV,EAAAlD,cAAA,mCAAA,EACA4D,IACAA,EAAAhJ,UAAAwI,OAAA,2CAAA,EACAQ,EAAAC,oBAAA,QAAAb,2BAAA,GAGAtI,SAAAyI,KAAAU,oBAAA,QAAAL,qCAAA,CACA,CAKA,SAAAV,0BAAAW,EAAA,CAAA,GACA5I,IAAAiJ,EAAA,CAAA,EACAC,EAAA,GACAC,EAAA,GAiBAC,GAhBA,aAAA,OAAAC,UACArE,KAAAgE,oBAAA,QAAAf,yBAAA,EAEAgB,EAAAjE,KAEAqE,SAAAC,yBAAA,CAAA,EACAJ,EAAAG,SAAAE,aACAJ,EAAAE,SAAAG,mBACA,aAAA,OAAAhI,gBACA0H,EAAA1H,cAAAiI,YACAN,EAAA3H,cAAA4D,kBAIAvF,SAAAyI,KAAAvI,UAAAqH,IAAA,kBAAA,EAEAvH,SAAA2I,eAAA,aAAA,GACA,IAEAkB,EAIAX,EAOAY,EAQAC,EAOAC,EAWAC,EAvCAV,GAyDAA,EAAAvH,aAAA,QAAA,kBAAA,EACA,aAAA,OAAAkI,mBAAAA,kBAAAC,2BACAnK,SAAA2I,eAAA,kBAAA,EAAAyB,UAAAF,kBAAAC,2BAEAnK,SAAA2I,eAAA,kBAAA,EAAAyB,UAAAzI,cAAAwI,8BA3DAN,EAAA7J,SAAAC,cAAA,KAAA,GACA+B,aAAA,QAAA,uCAAA,EACA6H,EAAA7H,aAAA,KAAA,aAAA,GAEAkH,EAAAlJ,SAAAC,cAAA,QAAA,GACAqC,KAAA,SACA4G,EAAAtC,UAAA,mCACAsC,EAAAlH,aAAA,aAAA,aAAA,EACAkH,EAAAkB,UAAA,WAGAN,EAAA9J,SAAAC,cAAA,MAAA,GACAC,UAAA,uCACAmK,EAAArK,SAAAC,cAAA,GAAA,GACAM,UAAA8I,EACAgB,EAAArI,aAAA,QAAA,mCAAA,EACA8H,EAAAtJ,OAAA6J,CAAA,GAGAN,EAAA/J,SAAAC,cAAA,KAAA,GACA+B,aAAA,KAAA,kBAAA,EACA+H,EAAA/H,aAAA,QAAA,qCAAA,EACA+H,EAAA9H,MAAAqI,MAAA,SAIAN,EAAAhK,SAAAC,cAAA,GAAA,GACAsK,GAAA,4CACA,aAAA,OAAAL,mBAAAA,kBAAAC,2BACAH,EAAAzJ,UAAA2J,kBAAAC,2BAEAH,EAAAzJ,UAAAoB,cAAAwI,2BAEAH,EAAAhI,aAAA,QAAA,qCAAA,GAIAiI,EAAAjK,SAAAC,cAAA,GAAA,GACAsK,GAAA,6CACA,aAAA,OAAAL,mBAAAA,kBAAAM,0BACAP,EAAA1J,UAAA2J,kBAAAM,0BAEAP,EAAA1J,UAAAoB,cAAA6I,0BAIAX,EAAArJ,OAAA0I,CAAA,EACAa,EAAAvJ,OAAAwJ,CAAA,EACAD,EAAAvJ,OAAAyJ,CAAA,EACAJ,EAAArJ,OAAAsJ,CAAA,EACAD,EAAArJ,OAAAuJ,CAAA,EACAF,EAAArJ,OAAAX,mCAAA,CAAA,EACAG,SAAAyI,KAAAjI,OAAAqJ,CAAA,EACAN,EAAAM,GASAjB,mCAAAW,CAAA,EAEAkB,yBAAA1B,EAAAO,EAAAF,CAAA,CACA,CAOA,SAAAqB,yBAAA1B,EAAAY,EAAAP,GACA,GAAAL,GAAAK,EAAA,CAEAjJ,IAAAU,EAAA,CACA6J,SAAA1K,SAAAoE,SAAAgB,KACAuF,SAAA3K,SAAA2K,SACAC,cAAA,EACA,EAOAC,GANA,CAAArB,SAAAsB,qBACAjK,EAAAkK,YAAAC,kBAAAC,IAAA,0BAAA,EAEApK,EAAAqK,sBAAAC,wBAAA,EAGA,IACA,IAAAhL,IAAAC,EAAA,EAAAA,EAAAuJ,EAAAtJ,OAAAD,CAAA,GAAA,CAGA,KAAA,IAAAuJ,EAAAvJ,GAAAgF,MACA,IAAAuE,EAAAvJ,GAAAgF,KAAAgG,QAAA,SAAA,IAEArC,EAAAhE,eAAA,EACAyE,SAAAC,yBAAA,CAAA,GAIAtJ,IAAAkL,EAAArL,SAAAC,cAAA,KAAA,EACAoL,EAAArJ,aAAA,QAAA,eAAA,EACAsJ,MAAA3B,EAAAvJ,EAAA,EAAAI,OAAA6K,CAAA,EAGAR,EAAAzK,GAAAuJ,EAAAvJ,GAAAmL,QAAAC,cACA,CAGA3K,EAAA+J,cAAAhI,KAAA0E,UAAAuD,CAAA,EAGA,SAAAX,kBAAAuB,gBACAC,sBACA,qBACA,CACA7K,KAAAA,EACA8K,OAAA,OACA3K,SAAA,SAAA0B,GAEAkJ,YAAA,6BAAApC,SAAAqC,oBAAA,EAAA,EACAC,8BAAApJ,EAAAiH,EAAAP,CAAA,CACA,EACA2C,gBAAA,SAAAC,GACAC,kBAAA,EACAC,oBAAAF,CAAA,CACA,CACA,CACA,GAIAnL,EAAAgE,OAAA,qBACAsH,sBACAtL,EACA,CACAS,QAAA,CAAA,EACAN,SAAA,SAAA0B,GAEAkJ,YAAA,6BAAApC,SAAAqC,oBAAA,EAAA,EACAC,8BAAApJ,EAAAiH,EAAAP,CAAA,CACA,EACA2C,gBAAA,SAAAC,GACAC,kBAAA,EACAC,oBAAAF,CAAA,CACA,CACA,CACA,EAEA,KAAA,CACA,IAAA1C,EAAAK,EAAA4B,QAAAC,eACA3K,EAAA,CACA+J,cAAAhI,KAAA0E,UAAA,CAAA8E,EAAA9C,CAAA,CAAA,CACA,EAGA+B,EAAArL,SAAAC,cAAA,KAAA,EACAoL,EAAArJ,aAAA,QAAA,eAAA,EACA2H,EAAA5C,YAAAsE,CAAA,EAEAzK,qBACA,CACAiE,OAAA,qBACA+F,cAAA/J,EAAA+J,aACA,EACA,CACA5J,SAAA,SAAA0B,GACAoJ,8BAAApJ,EAAAiH,EAAA,CAAA,CAAA,CACA,EACArI,QAAA,CAAA,CACA,CACA,CACA,CACA,CAOA,SAAAwK,8BAAApJ,EAAAiH,EAAAP,EAAA,CAAA,GACA,GAAA1G,EAAAD,SAAA,CAAA,IAAAC,EAAA7B,KAAA,GAAAwL,WAEAtJ,WAAA,WAEA5C,IAAAqI,EAAAxI,SAAA2I,eAAA,aAAA,EACA,GAAA,OAAAH,EAAA,CACArI,IAAAmM,EAAA,GACA,GAAAlD,EAAA,CACAjJ,IAAAoM,EACA7J,EAAA7B,KAAA2L,QAAA,IACArF,EAAAsF,gBAAArD,EAAAmC,QAAAC,iBACAe,EAAApF,EAEA,CAAA,EAEAmF,EAAAC,EAAAG,cAAAC,MAAA,MAAA,EAAA,EACA,MACAL,EAAA5J,EAAA7B,KAAA,GAAA6L,cAGAvM,IAAAyM,EAAApE,EAAAlD,cAAA,4CAAA,EAEAuH,EAAA7M,SAAAC,cAAA,GAAA,EAqBA6M,GApBAD,EAAA7K,aAAA,QAAA,wCAAA,EACA6K,EAAAtM,UAAA+L,EACA,aAAA,OAAApC,mBAAAA,kBAAA6C,yBACAF,EAAAtG,MAAA2D,kBAAA6C,yBAEAF,EAAAtG,MAAA5E,cAAAoL,yBAGAH,IACA,aAAA,OAAA1C,mBAAAA,kBAAA8C,wBACAJ,EAAAxC,UAAAF,kBAAA8C,wBACA,SAAAH,EAAAI,UAEAL,EAAAxC,UAAAzI,cAAAqL,wBACA,SAAAH,EAAAI,UAGAL,EAAA5K,aAAA,QAAA,sBAAA,GAGAwG,EAAAlD,cAAA,6BAAA,GAKA4H,GAJAJ,GACAA,EAAApE,OAAA,EAGAF,EAAAlD,cAAA,6CAAA,GAKA6H,GAJAD,GACAA,EAAAxE,OAAA,EAGA1I,SAAAC,cAAA,MAAA,GACAkN,EAAAjN,UAAA,sDACAF,SAAAsF,cAAA,oCAAA,IACA9D,EAAAxB,SAAAC,cAAA,QAAA,EACA,aAAA,OAAAiK,mBAAAA,kBAAAkD,gBACA5L,EAAAjB,UAAA2J,kBAAAkD,gBAEA5L,EAAAjB,UAAAoB,cAAAyL,gBAEA5L,EAAAtB,UAAA,oCACAsB,EAAAgE,iBAAA,QAAA,WACA8C,4BAAA,EAEA,aAAA,OAAAkB,UAAAA,SAAAC,0BAAAL,GACAA,EAAAzD,MAAA,CAEA,CAAA,EACAwH,EAAA3M,OAAAgB,CAAA,EACAgH,EAAAhI,OAAA2M,CAAA,GAEAlE,iCAAAT,EAAA,WACA6E,iBAAA1D,EAAAjH,CAAA,CACA,CAAA,CACA,CACA,EAAA,GAAA,OAEA,GAAA0G,EAAA,CACAjJ,IAAAmN,EAAA,gBAEA5K,EAAA6K,eAAA,MAAA,GACA,EAAA7K,EAAA7B,KAAAR,QACA,UAAA,OAAAqC,EAAA7B,KAAA,IACA,UAAA,OAAA6B,EAAA7B,KAAA,GAAAyM,UAEAA,EAAA5K,EAAA7B,KAAA,GAAAyM,SAEA5K,EAAAD,SACAwJ,kBAAA,EACA,aAAA,OAAA/B,mBAAAA,kBAAAsD,iBACAtB,oBAAAhC,kBAAAsD,iBAAA,KAAAF,CAAA,EAEApB,oBAAAvK,cAAA6L,iBAAA,KAAAF,CAAA,IAGArB,kBAAA,EACA,aAAA,OAAA/B,mBAAAA,kBAAAuD,wBACAvB,oBAAAhC,kBAAAuD,wBAAA,KAAAH,CAAA,EAEApB,oBAAAvK,cAAA8L,wBAAA,KAAAH,CAAA,EAGA,MACA3J,QAAAC,IAAA,SAAAlB,CAAA,CAGA,CAKA,SAAAuJ,oBACA,KAAA,IAAAzC,SAAAG,mBACAH,SAAAG,kBAAA6C,QAAA,SAAAkB,GACAA,EAAAlI,iBAAA,QAAA4C,yBAAA,CACA,CAAA,CAEA,CAMA,SAAA8D,oBAAAoB,GACAA,EAAAA,IACA,aAAA,OAAApD,mBAAAA,kBAAAyD,uBACAzD,kBAEAvI,eAFAgM,uBAMAxN,IAAAqI,EAAAxI,SAAA2I,eAAA,aAAA,EACAiF,EAAA5N,SAAA2I,eAAA,kBAAA,EACA,OAAAH,IACA,aAAA,OAAA0B,mBAAAA,kBAAA2D,uBACAD,EAAArN,UAAA2J,kBAAA2D,uBAAA,KAAAP,EAEAM,EAAArN,UAAAoB,cAAAkM,uBAAA,KAAAP,EAEAvK,WAAA,WACAuF,4BAAA,CACA,EAAA,GAAA,EAEA,CAOA,SAAA+E,iBAAAS,EAAAC,GACA,GAAA,EAAAD,EAAAzN,OACA,IAAAF,IAAAC,EAAA,EAAAA,EAAA0N,EAAAzN,OAAAD,CAAA,GAAA,CAEAD,IAAAoM,EAOA,GANAwB,EAAAlN,KAAA2L,QAAA,IACArF,EAAAsF,gBAAAqB,EAAA1N,GAAAmL,QAAAC,iBACAe,EAAApF,EAEA,CAAA,EAEA,CAAA,IAAAoF,EAAAF,WACA,OAGA,GACA,KAAA,IAAAyB,EAAA1N,GAAAgF,MAEA,IAAA0I,EAAA1N,GAAAgF,KAAAgG,QAAA,SAAA,GACA,IAAA0C,EAAA1N,GAAAgF,KAAAgG,QAAA,MAAA,EA6BA0C,EAAA1N,GAAAF,UAAAqH,IAAA,SAAA,EAEAxE,WAAA,KACAiL,2BAAAzB,EAAAuB,EAAA1N,EAAA,CACA,EAAA,GAAA,MA/BA,CACAD,IAAA8N,EACA,GAAA,IAAAH,EAAA1N,GAAAgF,KAAAgG,QAAA,SAAA,EACA6C,EAAA,cACA,CAAA,GAAA,IAAAH,EAAA1N,GAAAgF,KAAAgG,QAAA,MAAA,EAGA,SAFA6C,EAAA,MAGA,CACA9N,IAAAmJ,EAAAwE,EAAA1N,GAAAgF,KAAA8I,QAAAD,EAAA,EAAA,EACAE,qBACAL,EAAA1N,GACAkJ,EACA8E,aAAA7B,EAAAG,aAAA,CACA,EACAoB,EAAA1N,GAAAgF,KAAA6I,EAAA1B,EAAAG,cAEAoB,EAAA1N,GAAAiO,iBAAA,0BAAA,EAAA7B,QAAA,IACArM,IAAAmO,EAAA,GACAP,EAAAlN,KAAA2L,QAAA,IACArF,EAAAsF,gBAAA8B,EAAAhD,QAAAC,iBACA8C,EAAAnH,EAAAuF,cAEA,CAAA,EACA6B,EAAAzH,YAAAsH,aAAAE,CAAA,CACA,CAAA,CACA,CAQAR,EAAA1N,GAAA+I,oBAAA,QAAAf,yBAAA,CACA,KACA,CACAjI,IAAAoM,EAAAwB,EAAAlN,KAAA,GACAiN,EAAA5N,UAAAqH,IAAA,SAAA,EAEAxE,WAAA,KACAiL,2BAAAzB,EAAAuB,CAAA,CACA,EAAA,GAAA,EACAA,EAAA3E,oBAAA,QAAAf,yBAAA,CACA,CACA,CAQA,SAAA+F,qBAAAT,EAAAc,EAAAC,GACA,GAAAD,EAAA,CAIAd,EAAAgB,UAAA,EAGA,IAFA,IACAC,EADAC,EAAA5O,SAAA6O,iBAAAnB,EAAAoB,WAAAC,SAAA,EAEAJ,EAAAC,EAAAI,SAAA,GACA,GAAA,CAAA,IAAAL,EAAAM,UAAA7D,QAAAoD,CAAA,EAEA,OADAG,KAAAA,EAAAM,UAAAN,EAAAM,UAAAf,QAAAM,EAAA,IAAAC,CAAA,EAPA,CAWA,CAOA,SAAAL,aAAAc,GACA,OAAAA,GAIA,IAAAC,WAAAC,gBAAAC,OAAAH,CAAA,EAAA,WAAA,EAAAI,gBAAAxI,YAHA,EAIA,CAMA,SAAAkH,2BAAAuB,EAAAC,GACAA,EAAAxN,aAAA,QAAA,EAAA,EACAwN,EAAA7M,gBAAA,OAAA,EACA8M,mBAAAD,EAAAD,EAAA7C,aAAA,CACA,CAMA,SAAA+C,mBAAA/K,EAAA4H,GACAnM,IAAAuP,EAAA,KACA,IAAAvP,IAAAC,EAAA,EAAAA,EAAAsE,EAAAiL,SAAAtP,OAAAD,CAAA,GACA,GAAAsE,EAAAiL,SAAAvP,GAAAF,UAAA8I,SAAA,eAAA,EAAA,CACA0G,EAAAhL,EAAAiL,SAAAvP,GACA,KACA,CAEA,GAAAsP,EAAA,CAKA,KAAAA,EAAAE,iBACAlL,EAAAmL,YAAAH,EAAAE,eAAA,EAEA,IAAAE,GAAA,IAAAX,WAAAC,gBAAAC,OAAA/C,CAAA,EAAA,WAAA,EAAA7D,KAAAsH,WACA,IAAA5P,IAAAC,EAAA,EAAAA,EAAA0P,EAAAzP,OAAAD,CAAA,GACAsE,EAAAsL,aAAAhQ,SAAAiQ,WAAAH,EAAA1P,GAAA,CAAA,CAAA,EAAAsP,CAAA,CARA,CAUA,CAEAvP,IAAA+P,4BAAA,CAAA,EAGAlQ,SAAAwF,iBAAA,mBAAA,WAEA,GAAA0K,CAAAA,4BAAA,CAGAA,4BAAA,CAAA,EAEA/P,IAAAwJ,EAAA3J,SAAAqO,iBAAA,wBAAA,EAIA,GAHA,aAAA,OAAA7E,WACAA,SAAAG,kBAAAA,GAEAA,EAAAtJ,OACA,IAAAF,IAAAC,EAAA,EAAAA,EAAAuJ,EAAAtJ,OAAA,EAAAD,EAAA,CACA,IAAAuO,EAAAhF,EAAAvJ,GAEAuO,EAAAwB,YACA,MAAAxB,EAAAwB,WAAAC,SACAzB,EAAAwB,WAAAE,aAAA,MAAA,GAAAlI,SAAA,SAAA,GACAwG,EAAAwB,WAAAG,aAAA,sBAAA,GAKA3B,EAAAnJ,iBAAA,QAAA4C,yBAAA,CACA,CApBA,CAsBA,CAAA","file":"cleantalk-admin.min.js","sourcesContent":["/**\n * @return {HTMLElement} event\n */\nfunction apbctSetEmailDecoderPopupAnimation() {\n const animationElements = ['apbct_dog_one', 'apbct_dog_two', 'apbct_dog_three'];\n const animationWrapper = document.createElement('div');\n animationWrapper.classList = 'apbct-ee-animation-wrapper';\n for (let i = 0; i < animationElements.length; i++) {\n const apbctEEAnimationDogOne = document.createElement('span');\n apbctEEAnimationDogOne.classList = 'apbct_dog ' + animationElements[i];\n apbctEEAnimationDogOne.innerText = '@';\n animationWrapper.append(apbctEEAnimationDogOne);\n }\n return animationWrapper;\n}\n\nlet apbctEmailEncoderOnClose = null;\n\n/**\n * Close the popup and reveal decoded contacts once.\n */\nfunction apbctEmailEncoderClosePopup() {\n const onClose = apbctEmailEncoderOnClose;\n document.body.classList.remove('apbct-popup-fade');\n const popup = document.getElementById('apbct_popup');\n if (popup) {\n apbctEmailEncoderUnbindPopupEvents(popup);\n popup.style.display = 'none';\n }\n if (onClose) {\n apbctEmailEncoderOnClose = null;\n onClose();\n }\n}\n\n/**\n * @param {MouseEvent} event Backdrop click event.\n */\nfunction apbctEmailEncoderBackdropClickHandler(event) {\n const popup = document.getElementById('apbct_popup');\n if (\n popup &&\n popup.style.display !== 'none' &&\n document.body.classList.contains('apbct-popup-fade') &&\n !popup.contains(event.target)\n ) {\n apbctEmailEncoderClosePopup();\n }\n}\n\n/**\n * @param {HTMLElement} popup Popup with completed decoding.\n * @param {function()} onClose Callback to reveal decoded contacts.\n */\nfunction apbctEmailEncoderBindPopupEvents(popup, onClose) {\n apbctEmailEncoderOnClose = onClose;\n const closeButton = popup.querySelector('.apbct-email-encoder-popup__close');\n if (closeButton) {\n closeButton.classList.add('apbct-email-encoder-popup__close--visible');\n closeButton.addEventListener('click', apbctEmailEncoderClosePopup);\n }\n\n document.body.addEventListener('click', apbctEmailEncoderBackdropClickHandler);\n}\n\n/**\n * @param {HTMLElement} popup Popup awaiting decoding.\n */\nfunction apbctEmailEncoderUnbindPopupEvents(popup) {\n apbctEmailEncoderOnClose = null;\n const closeButton = popup.querySelector('.apbct-email-encoder-popup__close');\n if (closeButton) {\n closeButton.classList.remove('apbct-email-encoder-popup__close--visible');\n closeButton.removeEventListener('click', apbctEmailEncoderClosePopup);\n }\n\n document.body.removeEventListener('click', apbctEmailEncoderBackdropClickHandler);\n}\n\n/**\n * @param {mixed} event\n */\nfunction ctFillDecodedEmailHandler(event = false) {\n let clickSource = false;\n let ctWlBrandname = '';\n let encodedEmail = '';\n if (typeof ctPublic !== 'undefined') {\n this.removeEventListener('click', ctFillDecodedEmailHandler);\n // remember clickSource\n clickSource = this;\n // globally remember if emails is mixed with mailto\n ctPublic.encodedEmailNodesIsMixed = false;\n ctWlBrandname = ctPublic.wl_brandname;\n encodedEmail = ctPublic.encodedEmailNodes;\n } else if (typeof ctAdminCommon !== 'undefined') {\n ctWlBrandname = ctAdminCommon.plugin_name;\n encodedEmail = ctAdminCommon.encodedEmailNode;\n }\n\n // get fade\n document.body.classList.add('apbct-popup-fade');\n // popup show\n let encoderPopup = document.getElementById('apbct_popup');\n if (!encoderPopup) {\n // construct popup\n let waitingPopup = document.createElement('div');\n waitingPopup.setAttribute('class', 'apbct-popup apbct-email-encoder-popup');\n waitingPopup.setAttribute('id', 'apbct_popup');\n\n const closeButton = document.createElement('button');\n closeButton.type = 'button';\n closeButton.className = 'apbct-email-encoder-popup__close';\n closeButton.setAttribute('aria-label', 'Close popup');\n closeButton.innerHTML = '×';\n\n // construct text header\n let popupHeaderWrapper = document.createElement('span');\n popupHeaderWrapper.classList = 'apbct-email-encoder-elements_center';\n let popupHeader = document.createElement('p');\n popupHeader.innerText = ctWlBrandname;\n popupHeader.setAttribute('class', 'apbct-email-encoder--popup-header');\n popupHeaderWrapper.append(popupHeader);\n\n // construct text wrapper\n let popupTextWrapper = document.createElement('div');\n popupTextWrapper.setAttribute('id', 'apbct_popup_text');\n popupTextWrapper.setAttribute('class', 'apbct-email-encoder-elements_center');\n popupTextWrapper.style.color = 'black';\n\n // construct text first node\n // todo make translatable\n let popupTextWaiting = document.createElement('p');\n popupTextWaiting.id = 'apbct_email_ecoder__popup_text_node_first';\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_wait_for_decoding) {\n popupTextWaiting.innerText = ctPublicFunctions.text__ee_wait_for_decoding;\n } else {\n popupTextWaiting.innerText = ctAdminCommon.text__ee_wait_for_decoding;\n }\n popupTextWaiting.setAttribute('class', 'apbct-email-encoder-elements_center');\n\n // construct text second node\n // todo make translatable\n let popupTextDecoding = document.createElement('p');\n popupTextDecoding.id = 'apbct_email_ecoder__popup_text_node_second';\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_decoding_process) {\n popupTextDecoding.innerText = ctPublicFunctions.text__ee_decoding_process;\n } else {\n popupTextDecoding.innerText = ctAdminCommon.text__ee_decoding_process;\n }\n\n // appending\n waitingPopup.append(closeButton);\n popupTextWrapper.append(popupTextWaiting);\n popupTextWrapper.append(popupTextDecoding);\n waitingPopup.append(popupHeaderWrapper);\n waitingPopup.append(popupTextWrapper);\n waitingPopup.append(apbctSetEmailDecoderPopupAnimation());\n document.body.append(waitingPopup);\n encoderPopup = waitingPopup;\n } else {\n encoderPopup.setAttribute('style', 'display: inherit');\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_wait_for_decoding) {\n document.getElementById('apbct_popup_text').innerHTML = ctPublicFunctions.text__ee_wait_for_decoding;\n } else {\n document.getElementById('apbct_popup_text').innerHTML = ctAdminCommon.text__ee_wait_for_decoding;\n }\n }\n apbctEmailEncoderUnbindPopupEvents(encoderPopup);\n\n apbctAjaxEmailDecodeBulk(event, encodedEmail, clickSource);\n}\n\n/**\n * @param {mixed} event\n * @param {mixed} encodedEmailNodes\n * @param {mixed} clickSource\n */\nfunction apbctAjaxEmailDecodeBulk(event, encodedEmailNodes, clickSource) {\n if (event && clickSource) {\n // collect data\n let data = {\n post_url: document.location.href,\n referrer: document.referrer,\n encodedEmails: '',\n };\n if (+ctPublic.bot_detector_enabled) {\n data.event_token = apbctLocalStorage.get('bot_detector_event_token');\n } else {\n data.event_javascript_data = getJavascriptClientData();\n }\n\n let encodedEmailsCollection = {};\n for (let i = 0; i < encodedEmailNodes.length; i++) {\n // disable click for mailto\n if (\n typeof encodedEmailNodes[i].href !== 'undefined' &&\n encodedEmailNodes[i].href.indexOf('mailto:') === 0\n ) {\n event.preventDefault();\n ctPublic.encodedEmailNodesIsMixed = true;\n }\n\n // Adding a tooltip\n let apbctTooltip = document.createElement('div');\n apbctTooltip.setAttribute('class', 'apbct-tooltip');\n apbct(encodedEmailNodes[i]).append(apbctTooltip);\n\n // collect encoded email strings\n encodedEmailsCollection[i] = encodedEmailNodes[i].dataset.originalString;\n }\n\n // JSONify encoded email strings\n data.encodedEmails = JSON.stringify(encodedEmailsCollection);\n\n // Using REST API handler\n if ( ctPublicFunctions.data__ajax_type === 'rest' ) {\n apbct_public_sendREST(\n 'apbct_decode_email',\n {\n data: data,\n method: 'POST',\n callback: function(result) {\n // set alternative cookie to skip next pages encoding\n ctSetCookie('apbct_email_encoder_passed', ctPublic.emailEncoderPassKey, '');\n apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource);\n },\n onErrorCallback: function(res) {\n resetEncodedNodes();\n ctShowDecodeComment(res);\n },\n },\n );\n\n // Using AJAX request and handler\n } else {\n data.action = 'apbct_decode_email';\n apbct_public_sendAJAX(\n data,\n {\n notJson: false,\n callback: function(result) {\n // set alternative cookie to skip next pages encoding\n ctSetCookie('apbct_email_encoder_passed', ctPublic.emailEncoderPassKey, '');\n apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource);\n },\n onErrorCallback: function(res) {\n resetEncodedNodes();\n ctShowDecodeComment(res);\n },\n },\n );\n }\n } else {\n const encodedEmail = encodedEmailNodes.dataset.originalString;\n let data = {\n encodedEmails: JSON.stringify({0: encodedEmail}),\n };\n\n // Adding a tooltip\n let apbctTooltip = document.createElement('div');\n apbctTooltip.setAttribute('class', 'apbct-tooltip');\n encodedEmailNodes.appendChild(apbctTooltip);\n\n apbct_admin_sendAJAX(\n {\n 'action': 'apbct_decode_email',\n 'encodedEmails': data.encodedEmails,\n },\n {\n 'callback': function(result) {\n apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, false);\n },\n 'notJson': true,\n },\n );\n }\n}\n\n/**\n * @param {mixed} result\n * @param {mixed} encodedEmailNodes\n * @param {mixed} clickSource\n */\nfunction apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource = false) {\n if (result.success && result.data[0].is_allowed === true) {\n // start process of visual decoding\n setTimeout(function() {\n // popup remove\n let popup = document.getElementById('apbct_popup');\n if (popup !== null) {\n let email = '';\n if (clickSource) {\n let currentResultData;\n result.data.forEach((row) => {\n if (row.encoded_email === clickSource.dataset.originalString) {\n currentResultData = row;\n }\n });\n\n email = currentResultData.decoded_email.split(/[&?]/)[0];\n } else {\n email = result.data[0].decoded_email;\n }\n // handle first node\n let firstNode = popup.querySelector('#apbct_email_ecoder__popup_text_node_first');\n // get email selectable by click\n let selectableEmail = document.createElement('b');\n selectableEmail.setAttribute('class', 'apbct-email-encoder-select-whole-email');\n selectableEmail.innerText = email;\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_click_to_select) {\n selectableEmail.title = ctPublicFunctions.text__ee_click_to_select;\n } else {\n selectableEmail.title = ctAdminCommon.text__ee_click_to_select;\n }\n // add email to the first node\n if (firstNode) {\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_original_email) {\n firstNode.innerHTML = ctPublicFunctions.text__ee_original_email +\n ' ' + selectableEmail.outerHTML;\n } else {\n firstNode.innerHTML = ctAdminCommon.text__ee_original_email +\n ' ' + selectableEmail.outerHTML;\n }\n\n firstNode.setAttribute('style', 'flex-direction: row;');\n }\n // remove animation\n let wrapper = popup.querySelector('.apbct-ee-animation-wrapper');\n if (wrapper) {\n wrapper.remove();\n }\n // remove second node\n let secondNode = popup.querySelector('#apbct_email_ecoder__popup_text_node_second');\n if (secondNode) {\n secondNode.remove();\n }\n // add button\n let buttonWrapper = document.createElement('span');\n buttonWrapper.classList = 'apbct-email-encoder-elements_center top-margin-long';\n if (!document.querySelector('.apbct-email-encoder-got-it-button')) {\n let button = document.createElement('button');\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_got_it) {\n button.innerText = ctPublicFunctions.text__ee_got_it;\n } else {\n button.innerText = ctAdminCommon.text__ee_got_it;\n }\n button.classList = 'apbct-email-encoder-got-it-button';\n button.addEventListener('click', function() {\n apbctEmailEncoderClosePopup();\n // click on mailto if so\n if (typeof ctPublic !== 'undefined' && ctPublic.encodedEmailNodesIsMixed && clickSource) {\n clickSource.click();\n }\n });\n buttonWrapper.append(button);\n popup.append(buttonWrapper);\n }\n apbctEmailEncoderBindPopupEvents(popup, function() {\n fillDecodedNodes(encodedEmailNodes, result);\n });\n }\n }, 3000);\n } else {\n if (clickSource) {\n let comment = 'unknown_error';\n if (\n result.hasOwnProperty('data') &&\n result.data.length > 0 &&\n typeof result.data[0] === 'object' &&\n typeof result.data[0].comment === 'string'\n ) {\n comment = result.data[0].comment;\n }\n if (result.success) {\n resetEncodedNodes();\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_blocked) {\n ctShowDecodeComment(ctPublicFunctions.text__ee_blocked + ': ' + comment);\n } else {\n ctShowDecodeComment(ctAdminCommon.text__ee_blocked + ': ' + comment);\n }\n } else {\n resetEncodedNodes();\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_cannot_connect) {\n ctShowDecodeComment(ctPublicFunctions.text__ee_cannot_connect + ': ' + comment);\n } else {\n ctShowDecodeComment(ctAdminCommon.text__ee_cannot_connect + ': ' + comment);\n }\n }\n } else {\n console.log('result', result);\n }\n }\n}\n\n/**\n * Reset click event for encoded email\n */\nfunction resetEncodedNodes() {\n if (typeof ctPublic.encodedEmailNodes !== 'undefined') {\n ctPublic.encodedEmailNodes.forEach(function(element) {\n element.addEventListener('click', ctFillDecodedEmailHandler);\n });\n }\n}\n\n/**\n * Show Decode Comment\n * @param {string} comment\n */\nfunction ctShowDecodeComment(comment) {\n if ( ! comment ) {\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_cannot_decode) {\n comment = ctPublicFunctions.text__ee_cannot_decode;\n } else {\n comment = ctAdminCommon.text__ee_cannot_decode;\n }\n }\n\n let popup = document.getElementById('apbct_popup');\n let popupText = document.getElementById('apbct_popup_text');\n if (popup !== null) {\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_email_decoder) {\n popupText.innerText = ctPublicFunctions.text__ee_email_decoder + ': ' + comment;\n } else {\n popupText.innerText = ctAdminCommon.text__ee_email_decoder + ': ' + comment;\n }\n setTimeout(function() {\n apbctEmailEncoderClosePopup();\n }, 3000);\n }\n}\n\n/**\n * Run filling for every node with decoding result.\n * @param {mixed} encodedNodes\n * @param {mixed} decodingResult\n */\nfunction fillDecodedNodes(encodedNodes, decodingResult) {\n if (encodedNodes.length > 0) {\n for (let i = 0; i < encodedNodes.length; i++) {\n // chek what is what\n let currentResultData;\n decodingResult.data.forEach((row) => {\n if (row.encoded_email === encodedNodes[i].dataset.originalString) {\n currentResultData = row;\n }\n });\n // quit case on cloud block\n if (currentResultData.is_allowed === false) {\n return;\n }\n // handler for mailto\n if (\n typeof encodedNodes[i].href !== 'undefined' &&\n (\n encodedNodes[i].href.indexOf('mailto:') === 0 ||\n encodedNodes[i].href.indexOf('tel:') === 0\n )\n ) {\n let linkTypePrefix;\n if (encodedNodes[i].href.indexOf('mailto:') === 0) {\n linkTypePrefix = 'mailto:';\n } else if (encodedNodes[i].href.indexOf('tel:') === 0) {\n linkTypePrefix = 'tel:';\n } else {\n continue;\n }\n let encodedEmail = encodedNodes[i].href.replace(linkTypePrefix, '');\n ctReplaceInTextNodes(\n encodedNodes[i],\n encodedEmail,\n ctHtmlToText(currentResultData.decoded_email),\n );\n encodedNodes[i].href = linkTypePrefix + currentResultData.decoded_email;\n\n encodedNodes[i].querySelectorAll('span.apbct-email-encoder').forEach((el) => {\n let encodedEmailTextInsideMailto = '';\n decodingResult.data.forEach((row) => {\n if (row.encoded_email === el.dataset.originalString) {\n encodedEmailTextInsideMailto = row.decoded_email;\n }\n });\n el.textContent = ctHtmlToText(encodedEmailTextInsideMailto);\n });\n } else {\n encodedNodes[i].classList.add('no-blur');\n // fill the nodes\n setTimeout(() => {\n ctProcessDecodedDataResult(currentResultData, encodedNodes[i]);\n }, 2000);\n }\n // remove listeners\n encodedNodes[i].removeEventListener('click', ctFillDecodedEmailHandler);\n }\n } else {\n let currentResultData = decodingResult.data[0];\n encodedNodes.classList.add('no-blur');\n // fill the nodes\n setTimeout(() => {\n ctProcessDecodedDataResult(currentResultData, encodedNodes);\n }, 2000);\n encodedNodes.removeEventListener('click', ctFillDecodedEmailHandler);\n }\n}\n\n/**\n * Replace the first occurrence of search in element text only, never in markup or attributes.\n * @param {HTMLElement} element\n * @param {string} search\n * @param {string} replacement\n */\nfunction ctReplaceInTextNodes(element, search, replacement) {\n if (!search) {\n return;\n }\n // Merge adjacent text nodes so a token split between them is still found.\n element.normalize();\n const walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT);\n let node;\n while ((node = walker.nextNode())) {\n if (node.nodeValue.indexOf(search) !== -1) {\n node.nodeValue = node.nodeValue.replace(search, () => replacement);\n return;\n }\n }\n}\n\n/**\n * Convert server HTML to plain text without rendering it.\n * @param {string} html\n * @return {string}\n */\nfunction ctHtmlToText(html) {\n if (!html) {\n return '';\n }\n // DOMParser documents are inert: no scripts run and no event handlers fire.\n return new DOMParser().parseFromString(String(html), 'text/html').documentElement.textContent;\n}\n\n/**\n * @param {mixed} response\n * @param {mixed} targetElement\n */\nfunction ctProcessDecodedDataResult(response, targetElement) {\n targetElement.setAttribute('title', '');\n targetElement.removeAttribute('style');\n ctFillDecodedEmail(targetElement, response.decoded_email);\n}\n\n/**\n * @param {mixed} target\n * @param {string} email\n */\nfunction ctFillDecodedEmail(target, email) {\n let tooltip = null;\n for (let i = 0; i < target.children.length; i++) {\n if (target.children[i].classList.contains('apbct-tooltip')) {\n tooltip = target.children[i];\n break;\n }\n }\n if (!tooltip) {\n return;\n }\n // Replace everything before the tooltip. The decoded email is parsed separately,\n // so it can not be merged into the markup around it.\n while (tooltip.previousSibling) {\n target.removeChild(tooltip.previousSibling);\n }\n const nodes = new DOMParser().parseFromString(String(email), 'text/html').body.childNodes;\n for (let i = 0; i < nodes.length; i++) {\n target.insertBefore(document.importNode(nodes[i], true), tooltip);\n }\n}\n\nlet ctEmailDecoderIsInitialized = false;\n\n// Listen clicks on encoded emails\ndocument.addEventListener('DOMContentLoaded', function() {\n // Some plugins dispatch a synthetic DOMContentLoaded, listeners must not be attached twice\n if (ctEmailDecoderIsInitialized) {\n return;\n }\n ctEmailDecoderIsInitialized = true;\n\n let encodedEmailNodes = document.querySelectorAll('[data-original-string]');\n if (typeof ctPublic !== 'undefined') {\n ctPublic.encodedEmailNodes = encodedEmailNodes;\n }\n if (encodedEmailNodes.length) {\n for (let i = 0; i < encodedEmailNodes.length; ++i) {\n const node = encodedEmailNodes[i];\n if (\n node.parentNode &&\n node.parentNode.tagName === 'A' &&\n node.parentNode.getAttribute('href')?.includes('mailto:') &&\n node.parentNode.hasAttribute('data-original-string')\n ) {\n // This node was skipped from listeners\n continue;\n }\n node.addEventListener('click', ctFillDecodedEmailHandler);\n }\n }\n});\n","(function() {\n const {__} = wp.i18n;\n jQuery(document).ready(function($) {\n // Auto update banner close handler\n jQuery('.apbct_update_notice').on('click', 'button', function() {\n let ctDate = new Date(new Date().getTime() + 1000 * 86400 * 30 );\n let ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = 'apbct_update_banner_closed=1; path=/; expires=' +\n ctDate.toUTCString() + '; samesite=lax' + ctSecure;\n });\n\n jQuery('li a[href=\"options-general.php?page=cleantalk\"]').css('white-space', 'nowrap')\n .css('display', 'inline-block');\n\n jQuery('body').on('click', '.apbct-notice .notice-dismiss', function(e) {\n let apbctNoticeName = jQuery(e.target).parent().attr('id');\n if ( apbctNoticeName ) {\n apbct_admin_sendAJAX(\n {\n 'action': 'cleantalk_dismiss_notice',\n 'notice_id': apbctNoticeName,\n },\n {\n 'callback': null,\n 'notJson': true,\n },\n );\n }\n });\n\n // Notice when deleting user\n jQuery('.ct_username .row-actions .delete a').on('click', function(e) {\n e.preventDefault();\n\n let result = confirm(ctAdminCommon.notice_when_deleting_user_text);\n\n if (result) {\n window.location = this.href;\n }\n });\n\n let btnForceProtectionOn = document.querySelector('#apbct_setting_forms__force_protection__On');\n if (btnForceProtectionOn) {\n btnForceProtectionOn.addEventListener('click', function(e) {\n if (btnForceProtectionOn.checked) {\n let result = confirm(ctAdminCommon.apbctNoticeForceProtectionOn);\n\n if (!result) {\n e.preventDefault();\n }\n }\n });\n }\n // Restore spam order\n $('.apbct-restore-spam-order-button').click(function() {\n const spmOrderId = $(this).data('spam-order-id');\n let data = {\n action: 'apbct_restore_spam_order',\n _ajax_nonce: ctAdminCommon._ajax_nonce,\n order_id: spmOrderId,\n };\n $.ajax({\n type: 'POST',\n url: ctAdminCommon._ajax_url,\n data: data,\n success: function(result) {\n if (result.success) {\n window.location.reload();\n } else {\n alert(result.data.message);\n }\n },\n });\n });\n\n // Extended spam order details show via modal\n $('.apbct-details-spam-order-button').click(function() {\n const spmOrderId = $(this).data('spam-order-id');\n let data = {\n action: 'apbct_details_spam_order',\n _ajax_nonce: ctAdminCommon._ajax_nonce,\n order_id: spmOrderId,\n };\n if (typeof cleantalkModal !== 'undefined') {\n cleantalkModal.loaded = false;\n cleantalkModal.open(false);\n $.ajax({\n type: 'POST',\n url: ctAdminCommon._ajax_url,\n data: data,\n success: function(result) {\n const modalContent = $('#cleantalk-modal-content');\n modalContent.empty();\n if (result.success && result.data) {\n const container = apbctGetWCOrderDetailsModalContainer(result.data);\n const containerHeader = document.createElement('h3');\n const linkHeader = document.createElement('a');\n const linkHeaderWrapper = document.createElement('p');\n containerHeader.className = 'apbct_wc_details__table-container_header';\n containerHeader.textContent = __(\n 'WooCommerce spam order details',\n 'cleantalk-spam-protect',\n );\n linkHeader.href = new URL(\n 'https://cleantalk.org/my/show_requests?allow=0&request_type=order',\n ).toString();\n linkHeader.rel = 'noopener noreferrer';\n linkHeader.target = '_blank';\n linkHeader.textContent = linkHeader.href;\n linkHeaderWrapper.textContent = __(\n 'Visit CleanTalk Cloud Dashboard to see all of denied requests: ',\n 'cleantalk-spam-protect',\n );\n linkHeaderWrapper.style.textAlign ='center';\n linkHeaderWrapper.appendChild(linkHeader);\n\n modalContent.append(containerHeader);\n modalContent.append(linkHeaderWrapper);\n modalContent.append(container);\n } else {\n const error = (result && result.data && result.data.error) ?\n result.data.error :\n __('Unknown error occurred', 'cleantalk-spam-protect');\n modalContent.text(error);\n }\n cleantalkModal.loaded = true;\n },\n error: function(xhr, status, error) {\n console.error('AJAX Error:', error);\n alert(\n __(\n 'An error occurred while processing your request, see console for details.',\n 'cleantalk-spam-protect',\n ),\n );\n },\n });\n } else {\n alert(\n __(\n 'Can not initialize CleanTalk modal window.',\n 'cleantalk-spam-protect',\n ),\n );\n }\n });\n\n // Email decoder example\n if (window.location.href.includes('options-general.php?page=cleantalk')) {\n let encodedEmailNode = document.querySelector('[data-original-string]');\n if (encodedEmailNode) {\n ctAdminCommon.encodedEmailNode = encodedEmailNode;\n encodedEmailNode.style.cursor = 'pointer';\n encodedEmailNode.addEventListener('click', ctFillDecodedEmailHandler);\n }\n }\n });\n\n /**\n * apbctGetWCOrderDetailsModalContainer\n * @param {object} wcOrderData\n * @return {HTMLDivElement}\n */\n function apbctGetWCOrderDetailsModalContainer(wcOrderData) {\n const container = document.createElement('div');\n container.className = 'apbct_wc_details__wrapper';\n\n /**\n * createTableFromObject\n * @param {object} obj\n * @param {string} title\n * @return {HTMLDivElement}\n */\n function createTableFromObject(obj, title) {\n const tableWrapperInner = document.createElement('div');\n tableWrapperInner.className = 'apbct_wc_details__table-wrapper-inner';\n\n const header = document.createElement('h4');\n header.textContent = title;\n tableWrapperInner.appendChild(header);\n\n const table = document.createElement('table');\n table.className = 'apbct_wc_details__table';\n\n const tbody = document.createElement('tbody');\n\n for (const [key, value] of Object.entries(obj)) {\n const row = document.createElement('tr');\n\n const keyCell = document.createElement('td');\n keyCell.className = 'apbct_wc_details__table-key-cell';\n keyCell.textContent = key;\n\n const valueCell = document.createElement('td');\n valueCell.className = 'apbct_wc_details__table-value-cell';\n\n if (typeof value === 'object' && value !== null) {\n valueCell.textContent = JSON.stringify(value, null, 2);\n valueCell.classList.add('apbct_wc_details__table-value-cell--json');\n } else {\n valueCell.textContent = value !== null && value !== undefined ? value : '—';\n }\n\n row.appendChild(keyCell);\n row.appendChild(valueCell);\n tbody.appendChild(row);\n }\n\n table.appendChild(tbody);\n tableWrapperInner.appendChild(table);\n return tableWrapperInner;\n }\n\n if (wcOrderData.order_details) {\n const orderDetails = wcOrderData.order_details;\n for (const [key, value] of Object.entries(orderDetails)) {\n const productName = orderDetails[key] && typeof orderDetails[key]['product_name'] === 'string' ?\n orderDetails[key]['product_name'] :\n __('Unknown product name', 'cleantalk-spam-protect');\n const header = __('Order Details for', 'cleantalk-spam-protect');\n container.appendChild(createTableFromObject(value, `${header} ${productName}`));\n }\n }\n\n if (wcOrderData.customer_details) {\n container.appendChild(\n createTableFromObject(wcOrderData.customer_details, 'Customer Details'),\n );\n }\n\n return container;\n }\n // eslint-disable-next-line camelcase,require-jsdoc,no-unused-vars\n function apbct_admin_sendAJAX(data, params, obj) {\n // Default params\n let callback = params.callback || null;\n let callbackContext = params.callback_context || null;\n let callbackParams = params.callback_params || null;\n let async = params.async || true;\n let notJson = params.notJson || null;\n let timeout = params.timeout || 15000;\n var obj = obj || null; // eslint-disable-line no-var\n let button = params.button || null;\n let spinner = params.spinner || null;\n let progressbar = params.progressbar || null;\n\n if (typeof (data) === 'string') {\n data = data + '&_ajax_nonce=' + ctAdminCommon._ajax_nonce + '&no_cache=' + Math.random();\n } else {\n data._ajax_nonce = ctAdminCommon._ajax_nonce;\n data.no_cache = Math.random();\n }\n // Button and spinner\n if (button) {\n button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed';\n }\n if (spinner) jQuery(spinner).css('display', 'inline');\n\n jQuery.ajax({\n type: 'POST',\n url: ctAdminCommon._ajax_url,\n data: data,\n async: async,\n success: function(result) {\n if (button) {\n button.removeAttribute('disabled'); button.style.cursor = 'pointer';\n }\n if (spinner) jQuery(spinner).css('display', 'none');\n if (!notJson) result = JSON.parse(result);\n if (result.error) {\n setTimeout(function() {\n if (progressbar) progressbar.fadeOut('slow');\n }, 1000);\n if ( typeof cleantalkModal !== 'undefined' ) {\n // Show the result by modal\n cleantalkModal.loaded = 'Error:
' + result.error.toString();\n cleantalkModal.open();\n } else {\n alert('Error happens: ' + (result.error || 'Unkown'));\n }\n } else {\n if (callback) {\n if (callbackParams) {\n callback.apply( callbackContext, callbackParams.concat( result, data, params, obj ) );\n } else {\n callback(result, data, params, obj);\n }\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown) {\n if (button) {\n button.removeAttribute('disabled'); button.style.cursor = 'pointer';\n }\n if (spinner) jQuery(spinner).css('display', 'none');\n console.log('APBCT_AJAX_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log(errorThrown);\n },\n timeout: timeout,\n });\n }\n\n // Keep AJAX helper global — used by settings page and other admin scripts.\n // eslint-disable-next-line camelcase\n window.apbct_admin_sendAJAX = apbct_admin_sendAJAX;\n})();\n"]} \ No newline at end of file diff --git a/js/cleantalk-dashboard-widget.min.js b/js/cleantalk-dashboard-widget.min.js index 09a5e06b9..59ca4522a 100644 --- a/js/cleantalk-dashboard-widget.min.js +++ b/js/cleantalk-dashboard-widget.min.js @@ -1,2 +1,2 @@ -jQuery(document).ready(function(){jQuery(".ct_widget_refresh_link").on("click",function(){jQuery(".ct_preloader").show(),setTimeout(function(){window.scrollTo(0,jQuery("#ct_widget_wrapper").offset().top-130)},1),setTimeout(function(){jQuery("#ct_refresh_form").submit()},2500)}),"#ct_widget"==location.hash&&setTimeout(function(){window.scrollTo(0,jQuery("#ct_widget_wrapper").offset().top-130)},1),jQuery("#ct_widget_wrapper").parent().css("padding",0),locale=navigator.language||navigator.userLanguage;var o=new Intl.DateTimeFormat(locale,{month:"short",day:"numeric"});var e=document.getElementById("ct_widget_chart"),t=(t=>{var a={labels:[],counts:[]};for(let e=0;e{var a={labels:[],counts:[]};for(let e=0;e)/, email + '$1'); + let tooltip = null; + for (let i = 0; i < target.children.length; i++) { + if (target.children[i].classList.contains('apbct-tooltip')) { + tooltip = target.children[i]; + break; + } + } + if (!tooltip) { + return; + } + // Replace everything before the tooltip. The decoded email is parsed separately, + // so it can not be merged into the markup around it. + while (tooltip.previousSibling) { + target.removeChild(tooltip.previousSibling); + } + const nodes = new DOMParser().parseFromString(String(email), 'text/html').body.childNodes; + for (let i = 0; i < nodes.length; i++) { + target.insertBefore(document.importNode(nodes[i], true), tooltip); + } } let ctEmailDecoderIsInitialized = false; @@ -2344,7 +2434,7 @@ function ctSetCookie( cookies, value, expires='') { ctSetAlternativeCookie(cookies, {forceAltCookies: true}); } cookies.forEach( function(item) { - const _expires = typeof item[2] !== 'undefined' ? 'expires=' + expires + '; ' : ''; + const _expires = typeof item[2] !== 'undefined' ? 'expires=' + item[2] + '; ' : ''; let ctSecure = location.protocol === 'https:' ? '; secure' : ''; document.cookie = ctPublicFunctions.cookiePrefix + item[0] + @@ -2358,7 +2448,7 @@ function ctSetCookie( cookies, value, expires='') { // Using alternative cookies } else if ( ctPublicFunctions.data__cookies_type === 'alternative' && !skipAlt ) { - ctSetAlternativeCookie(cookies); + ctSetAlternativeCookie(cookies, {forceAltCookies: ctPublic.force_alt_cookies}); } } @@ -2373,10 +2463,13 @@ function ctSetAlternativeCookie(cookies, params) { console.log('APBCT ERROR: getJavascriptClientData() is not loaded'); } - // if cookies is array, convert it to object - if (Array.isArray(cookies) && cookies[0] && cookies[0][0] === 'apbct_bot_detector_exist') { + if ( + !(params && params.forceAltCookies) && + Array.isArray(cookies) && cookies[0] && cookies[0][0] === 'apbct_bot_detector_exist' + ) { cookies = {apbct_bot_detector_exist: cookies[0][1]}; } + // Only try to parse if cookies is a string (JSON) if (typeof cookies === 'string') { try { @@ -2391,6 +2484,13 @@ function ctSetAlternativeCookie(cookies, params) { const onErrorCallback = params && params.onErrorCallback || null; if ( params && params.forceAltCookies ) { + // Named array properties are omitted by JSON.stringify(). + if (Array.isArray(cookies)) { + cookies = cookies.reduce((result, cookie) => { + result[cookie[0]] = cookie[1]; + return result; + }, {}); + } cookies.apbct_force_alt_cookies = true; } @@ -2787,7 +2887,6 @@ function ctNoCookieAttachHiddenFieldsToForms() { } } - /** * Class for event token transport */ @@ -3919,6 +4018,25 @@ class ApbctHandler { } } + // === LeakyPaywall register=== + if ( + ( + document.querySelectorAll('form.lp-list-builder__form').length > 0 || + document.querySelectorAll('form.lp-list-builder-auth__form').length > 0 + ) && + typeof args[0].includes === 'function' && + args[0].includes('/wp-json/lp-list-builder/v1') + ) { + try { + args[1].body = attachFieldsToBody( + args[1].body, + selectFieldsData(+ctPublic.bot_detector_enabled), + ); + } catch (e) { + // Continue even if error + } + } + // === WooCommerce add to cart (direct add-item URL) === if ( ( @@ -5821,21 +5939,14 @@ async function apbct_ready() { handler.catchWCRestRequestAsMiddleware(); if (+ctPublic.bot_detector_enabled) { - let botDetectorEventTokenStored = false; + let lastStoredBotDetectorEventToken = null; window.addEventListener('botDetectorEventTokenUpdated', (event) => { const botDetectorEventToken = event.detail?.eventToken; - if (botDetectorEventToken && !botDetectorEventTokenStored) { + if (botDetectorEventToken && botDetectorEventToken !== lastStoredBotDetectorEventToken) { ctSetCookie([ ['ct_bot_detector_event_token', botDetectorEventToken], ]); - botDetectorEventTokenStored = true; - // @ToDo remove this block afret force_alt_cookies removed - if (typeof ctPublic.force_alt_cookies !== 'undefined' && ctPublic.force_alt_cookies) { - ctSetAlternativeCookie( - JSON.stringify({'ct_bot_detector_event_token': botDetectorEventToken}), - {forceAltCookies: true}, - ); - } + lastStoredBotDetectorEventToken = botDetectorEventToken; } }); } diff --git a/js/prebuild/apbct-public-bundle_ext-protection.js b/js/prebuild/apbct-public-bundle_ext-protection.js index 29474ae5e..e05255653 100644 --- a/js/prebuild/apbct-public-bundle_ext-protection.js +++ b/js/prebuild/apbct-public-bundle_ext-protection.js @@ -14,6 +14,69 @@ function apbctSetEmailDecoderPopupAnimation() { return animationWrapper; } +let apbctEmailEncoderOnClose = null; + +/** + * Close the popup and reveal decoded contacts once. + */ +function apbctEmailEncoderClosePopup() { + const onClose = apbctEmailEncoderOnClose; + document.body.classList.remove('apbct-popup-fade'); + const popup = document.getElementById('apbct_popup'); + if (popup) { + apbctEmailEncoderUnbindPopupEvents(popup); + popup.style.display = 'none'; + } + if (onClose) { + apbctEmailEncoderOnClose = null; + onClose(); + } +} + +/** + * @param {MouseEvent} event Backdrop click event. + */ +function apbctEmailEncoderBackdropClickHandler(event) { + const popup = document.getElementById('apbct_popup'); + if ( + popup && + popup.style.display !== 'none' && + document.body.classList.contains('apbct-popup-fade') && + !popup.contains(event.target) + ) { + apbctEmailEncoderClosePopup(); + } +} + +/** + * @param {HTMLElement} popup Popup with completed decoding. + * @param {function()} onClose Callback to reveal decoded contacts. + */ +function apbctEmailEncoderBindPopupEvents(popup, onClose) { + apbctEmailEncoderOnClose = onClose; + const closeButton = popup.querySelector('.apbct-email-encoder-popup__close'); + if (closeButton) { + closeButton.classList.add('apbct-email-encoder-popup__close--visible'); + closeButton.addEventListener('click', apbctEmailEncoderClosePopup); + } + + document.body.addEventListener('click', apbctEmailEncoderBackdropClickHandler); +} + +/** + * @param {HTMLElement} popup Popup awaiting decoding. + */ +function apbctEmailEncoderUnbindPopupEvents(popup) { + apbctEmailEncoderOnClose = null; + const closeButton = popup.querySelector('.apbct-email-encoder-popup__close'); + if (closeButton) { + closeButton.classList.remove('apbct-email-encoder-popup__close--visible'); + closeButton.removeEventListener('click', apbctEmailEncoderClosePopup); + } + + document.body.removeEventListener('click', apbctEmailEncoderBackdropClickHandler); +} + /** * @param {mixed} event */ @@ -44,6 +107,12 @@ function ctFillDecodedEmailHandler(event = false) { waitingPopup.setAttribute('class', 'apbct-popup apbct-email-encoder-popup'); waitingPopup.setAttribute('id', 'apbct_popup'); + const closeButton = document.createElement('button'); + closeButton.type = 'button'; + closeButton.className = 'apbct-email-encoder-popup__close'; + closeButton.setAttribute('aria-label', 'Close popup'); + closeButton.innerHTML = '×'; + // construct text header let popupHeaderWrapper = document.createElement('span'); popupHeaderWrapper.classList = 'apbct-email-encoder-elements_center'; @@ -80,12 +149,14 @@ function ctFillDecodedEmailHandler(event = false) { } // appending + waitingPopup.append(closeButton); popupTextWrapper.append(popupTextWaiting); popupTextWrapper.append(popupTextDecoding); waitingPopup.append(popupHeaderWrapper); waitingPopup.append(popupTextWrapper); waitingPopup.append(apbctSetEmailDecoderPopupAnimation()); document.body.append(waitingPopup); + encoderPopup = waitingPopup; } else { encoderPopup.setAttribute('style', 'display: inherit'); if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_wait_for_decoding) { @@ -94,6 +165,7 @@ function ctFillDecodedEmailHandler(event = false) { document.getElementById('apbct_popup_text').innerHTML = ctAdminCommon.text__ee_wait_for_decoding; } } + apbctEmailEncoderUnbindPopupEvents(encoderPopup); apbctAjaxEmailDecodeBulk(event, encodedEmail, clickSource); } @@ -274,9 +346,7 @@ function apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource = } button.classList = 'apbct-email-encoder-got-it-button'; button.addEventListener('click', function() { - document.body.classList.remove('apbct-popup-fade'); - popup.setAttribute('style', 'display:none'); - fillDecodedNodes(encodedEmailNodes, result); + apbctEmailEncoderClosePopup(); // click on mailto if so if (typeof ctPublic !== 'undefined' && ctPublic.encodedEmailNodesIsMixed && clickSource) { clickSource.click(); @@ -285,6 +355,9 @@ function apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource = buttonWrapper.append(button); popup.append(buttonWrapper); } + apbctEmailEncoderBindPopupEvents(popup, function() { + fillDecodedNodes(encodedEmailNodes, result); + }); } }, 3000); } else { @@ -346,14 +419,13 @@ function ctShowDecodeComment(comment) { let popup = document.getElementById('apbct_popup'); let popupText = document.getElementById('apbct_popup_text'); if (popup !== null) { - document.body.classList.remove('apbct-popup-fade'); if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_email_decoder) { popupText.innerText = ctPublicFunctions.text__ee_email_decoder + ': ' + comment; } else { popupText.innerText = ctAdminCommon.text__ee_email_decoder + ': ' + comment; } setTimeout(function() { - popup.setAttribute('style', 'display:none'); + apbctEmailEncoderClosePopup(); }, 3000); } } @@ -481,7 +553,25 @@ function ctProcessDecodedDataResult(response, targetElement) { * @param {string} email */ function ctFillDecodedEmail(target, email) { - target.innerHTML = target.innerHTML.replace(/.+?(
)/, email + '$1'); + let tooltip = null; + for (let i = 0; i < target.children.length; i++) { + if (target.children[i].classList.contains('apbct-tooltip')) { + tooltip = target.children[i]; + break; + } + } + if (!tooltip) { + return; + } + // Replace everything before the tooltip. The decoded email is parsed separately, + // so it can not be merged into the markup around it. + while (tooltip.previousSibling) { + target.removeChild(tooltip.previousSibling); + } + const nodes = new DOMParser().parseFromString(String(email), 'text/html').body.childNodes; + for (let i = 0; i < nodes.length; i++) { + target.insertBefore(document.importNode(nodes[i], true), tooltip); + } } let ctEmailDecoderIsInitialized = false; @@ -2344,7 +2434,7 @@ function ctSetCookie( cookies, value, expires='') { ctSetAlternativeCookie(cookies, {forceAltCookies: true}); } cookies.forEach( function(item) { - const _expires = typeof item[2] !== 'undefined' ? 'expires=' + expires + '; ' : ''; + const _expires = typeof item[2] !== 'undefined' ? 'expires=' + item[2] + '; ' : ''; let ctSecure = location.protocol === 'https:' ? '; secure' : ''; document.cookie = ctPublicFunctions.cookiePrefix + item[0] + @@ -2358,7 +2448,7 @@ function ctSetCookie( cookies, value, expires='') { // Using alternative cookies } else if ( ctPublicFunctions.data__cookies_type === 'alternative' && !skipAlt ) { - ctSetAlternativeCookie(cookies); + ctSetAlternativeCookie(cookies, {forceAltCookies: ctPublic.force_alt_cookies}); } } @@ -2373,10 +2463,13 @@ function ctSetAlternativeCookie(cookies, params) { console.log('APBCT ERROR: getJavascriptClientData() is not loaded'); } - // if cookies is array, convert it to object - if (Array.isArray(cookies) && cookies[0] && cookies[0][0] === 'apbct_bot_detector_exist') { + if ( + !(params && params.forceAltCookies) && + Array.isArray(cookies) && cookies[0] && cookies[0][0] === 'apbct_bot_detector_exist' + ) { cookies = {apbct_bot_detector_exist: cookies[0][1]}; } + // Only try to parse if cookies is a string (JSON) if (typeof cookies === 'string') { try { @@ -2391,6 +2484,13 @@ function ctSetAlternativeCookie(cookies, params) { const onErrorCallback = params && params.onErrorCallback || null; if ( params && params.forceAltCookies ) { + // Named array properties are omitted by JSON.stringify(). + if (Array.isArray(cookies)) { + cookies = cookies.reduce((result, cookie) => { + result[cookie[0]] = cookie[1]; + return result; + }, {}); + } cookies.apbct_force_alt_cookies = true; } @@ -2787,7 +2887,6 @@ function ctNoCookieAttachHiddenFieldsToForms() { } } - /** * Class for event token transport */ @@ -3919,6 +4018,25 @@ class ApbctHandler { } } + // === LeakyPaywall register=== + if ( + ( + document.querySelectorAll('form.lp-list-builder__form').length > 0 || + document.querySelectorAll('form.lp-list-builder-auth__form').length > 0 + ) && + typeof args[0].includes === 'function' && + args[0].includes('/wp-json/lp-list-builder/v1') + ) { + try { + args[1].body = attachFieldsToBody( + args[1].body, + selectFieldsData(+ctPublic.bot_detector_enabled), + ); + } catch (e) { + // Continue even if error + } + } + // === WooCommerce add to cart (direct add-item URL) === if ( ( @@ -5821,21 +5939,14 @@ async function apbct_ready() { handler.catchWCRestRequestAsMiddleware(); if (+ctPublic.bot_detector_enabled) { - let botDetectorEventTokenStored = false; + let lastStoredBotDetectorEventToken = null; window.addEventListener('botDetectorEventTokenUpdated', (event) => { const botDetectorEventToken = event.detail?.eventToken; - if (botDetectorEventToken && !botDetectorEventTokenStored) { + if (botDetectorEventToken && botDetectorEventToken !== lastStoredBotDetectorEventToken) { ctSetCookie([ ['ct_bot_detector_event_token', botDetectorEventToken], ]); - botDetectorEventTokenStored = true; - // @ToDo remove this block afret force_alt_cookies removed - if (typeof ctPublic.force_alt_cookies !== 'undefined' && ctPublic.force_alt_cookies) { - ctSetAlternativeCookie( - JSON.stringify({'ct_bot_detector_event_token': botDetectorEventToken}), - {forceAltCookies: true}, - ); - } + lastStoredBotDetectorEventToken = botDetectorEventToken; } }); } diff --git a/js/prebuild/apbct-public-bundle_ext-protection_gathering.js b/js/prebuild/apbct-public-bundle_ext-protection_gathering.js index bc0ea912e..feec6fa39 100644 --- a/js/prebuild/apbct-public-bundle_ext-protection_gathering.js +++ b/js/prebuild/apbct-public-bundle_ext-protection_gathering.js @@ -14,6 +14,69 @@ function apbctSetEmailDecoderPopupAnimation() { return animationWrapper; } +let apbctEmailEncoderOnClose = null; + +/** + * Close the popup and reveal decoded contacts once. + */ +function apbctEmailEncoderClosePopup() { + const onClose = apbctEmailEncoderOnClose; + document.body.classList.remove('apbct-popup-fade'); + const popup = document.getElementById('apbct_popup'); + if (popup) { + apbctEmailEncoderUnbindPopupEvents(popup); + popup.style.display = 'none'; + } + if (onClose) { + apbctEmailEncoderOnClose = null; + onClose(); + } +} + +/** + * @param {MouseEvent} event Backdrop click event. + */ +function apbctEmailEncoderBackdropClickHandler(event) { + const popup = document.getElementById('apbct_popup'); + if ( + popup && + popup.style.display !== 'none' && + document.body.classList.contains('apbct-popup-fade') && + !popup.contains(event.target) + ) { + apbctEmailEncoderClosePopup(); + } +} + +/** + * @param {HTMLElement} popup Popup with completed decoding. + * @param {function()} onClose Callback to reveal decoded contacts. + */ +function apbctEmailEncoderBindPopupEvents(popup, onClose) { + apbctEmailEncoderOnClose = onClose; + const closeButton = popup.querySelector('.apbct-email-encoder-popup__close'); + if (closeButton) { + closeButton.classList.add('apbct-email-encoder-popup__close--visible'); + closeButton.addEventListener('click', apbctEmailEncoderClosePopup); + } + + document.body.addEventListener('click', apbctEmailEncoderBackdropClickHandler); +} + +/** + * @param {HTMLElement} popup Popup awaiting decoding. + */ +function apbctEmailEncoderUnbindPopupEvents(popup) { + apbctEmailEncoderOnClose = null; + const closeButton = popup.querySelector('.apbct-email-encoder-popup__close'); + if (closeButton) { + closeButton.classList.remove('apbct-email-encoder-popup__close--visible'); + closeButton.removeEventListener('click', apbctEmailEncoderClosePopup); + } + + document.body.removeEventListener('click', apbctEmailEncoderBackdropClickHandler); +} + /** * @param {mixed} event */ @@ -44,6 +107,12 @@ function ctFillDecodedEmailHandler(event = false) { waitingPopup.setAttribute('class', 'apbct-popup apbct-email-encoder-popup'); waitingPopup.setAttribute('id', 'apbct_popup'); + const closeButton = document.createElement('button'); + closeButton.type = 'button'; + closeButton.className = 'apbct-email-encoder-popup__close'; + closeButton.setAttribute('aria-label', 'Close popup'); + closeButton.innerHTML = '×'; + // construct text header let popupHeaderWrapper = document.createElement('span'); popupHeaderWrapper.classList = 'apbct-email-encoder-elements_center'; @@ -80,12 +149,14 @@ function ctFillDecodedEmailHandler(event = false) { } // appending + waitingPopup.append(closeButton); popupTextWrapper.append(popupTextWaiting); popupTextWrapper.append(popupTextDecoding); waitingPopup.append(popupHeaderWrapper); waitingPopup.append(popupTextWrapper); waitingPopup.append(apbctSetEmailDecoderPopupAnimation()); document.body.append(waitingPopup); + encoderPopup = waitingPopup; } else { encoderPopup.setAttribute('style', 'display: inherit'); if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_wait_for_decoding) { @@ -94,6 +165,7 @@ function ctFillDecodedEmailHandler(event = false) { document.getElementById('apbct_popup_text').innerHTML = ctAdminCommon.text__ee_wait_for_decoding; } } + apbctEmailEncoderUnbindPopupEvents(encoderPopup); apbctAjaxEmailDecodeBulk(event, encodedEmail, clickSource); } @@ -274,9 +346,7 @@ function apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource = } button.classList = 'apbct-email-encoder-got-it-button'; button.addEventListener('click', function() { - document.body.classList.remove('apbct-popup-fade'); - popup.setAttribute('style', 'display:none'); - fillDecodedNodes(encodedEmailNodes, result); + apbctEmailEncoderClosePopup(); // click on mailto if so if (typeof ctPublic !== 'undefined' && ctPublic.encodedEmailNodesIsMixed && clickSource) { clickSource.click(); @@ -285,6 +355,9 @@ function apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource = buttonWrapper.append(button); popup.append(buttonWrapper); } + apbctEmailEncoderBindPopupEvents(popup, function() { + fillDecodedNodes(encodedEmailNodes, result); + }); } }, 3000); } else { @@ -346,14 +419,13 @@ function ctShowDecodeComment(comment) { let popup = document.getElementById('apbct_popup'); let popupText = document.getElementById('apbct_popup_text'); if (popup !== null) { - document.body.classList.remove('apbct-popup-fade'); if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_email_decoder) { popupText.innerText = ctPublicFunctions.text__ee_email_decoder + ': ' + comment; } else { popupText.innerText = ctAdminCommon.text__ee_email_decoder + ': ' + comment; } setTimeout(function() { - popup.setAttribute('style', 'display:none'); + apbctEmailEncoderClosePopup(); }, 3000); } } @@ -481,7 +553,25 @@ function ctProcessDecodedDataResult(response, targetElement) { * @param {string} email */ function ctFillDecodedEmail(target, email) { - target.innerHTML = target.innerHTML.replace(/.+?(
)/, email + '$1'); + let tooltip = null; + for (let i = 0; i < target.children.length; i++) { + if (target.children[i].classList.contains('apbct-tooltip')) { + tooltip = target.children[i]; + break; + } + } + if (!tooltip) { + return; + } + // Replace everything before the tooltip. The decoded email is parsed separately, + // so it can not be merged into the markup around it. + while (tooltip.previousSibling) { + target.removeChild(tooltip.previousSibling); + } + const nodes = new DOMParser().parseFromString(String(email), 'text/html').body.childNodes; + for (let i = 0; i < nodes.length; i++) { + target.insertBefore(document.importNode(nodes[i], true), tooltip); + } } let ctEmailDecoderIsInitialized = false; @@ -2344,7 +2434,7 @@ function ctSetCookie( cookies, value, expires='') { ctSetAlternativeCookie(cookies, {forceAltCookies: true}); } cookies.forEach( function(item) { - const _expires = typeof item[2] !== 'undefined' ? 'expires=' + expires + '; ' : ''; + const _expires = typeof item[2] !== 'undefined' ? 'expires=' + item[2] + '; ' : ''; let ctSecure = location.protocol === 'https:' ? '; secure' : ''; document.cookie = ctPublicFunctions.cookiePrefix + item[0] + @@ -2358,7 +2448,7 @@ function ctSetCookie( cookies, value, expires='') { // Using alternative cookies } else if ( ctPublicFunctions.data__cookies_type === 'alternative' && !skipAlt ) { - ctSetAlternativeCookie(cookies); + ctSetAlternativeCookie(cookies, {forceAltCookies: ctPublic.force_alt_cookies}); } } @@ -2373,10 +2463,13 @@ function ctSetAlternativeCookie(cookies, params) { console.log('APBCT ERROR: getJavascriptClientData() is not loaded'); } - // if cookies is array, convert it to object - if (Array.isArray(cookies) && cookies[0] && cookies[0][0] === 'apbct_bot_detector_exist') { + if ( + !(params && params.forceAltCookies) && + Array.isArray(cookies) && cookies[0] && cookies[0][0] === 'apbct_bot_detector_exist' + ) { cookies = {apbct_bot_detector_exist: cookies[0][1]}; } + // Only try to parse if cookies is a string (JSON) if (typeof cookies === 'string') { try { @@ -2391,6 +2484,13 @@ function ctSetAlternativeCookie(cookies, params) { const onErrorCallback = params && params.onErrorCallback || null; if ( params && params.forceAltCookies ) { + // Named array properties are omitted by JSON.stringify(). + if (Array.isArray(cookies)) { + cookies = cookies.reduce((result, cookie) => { + result[cookie[0]] = cookie[1]; + return result; + }, {}); + } cookies.apbct_force_alt_cookies = true; } @@ -2787,7 +2887,6 @@ function ctNoCookieAttachHiddenFieldsToForms() { } } - /** * Class for event token transport */ @@ -3919,6 +4018,25 @@ class ApbctHandler { } } + // === LeakyPaywall register=== + if ( + ( + document.querySelectorAll('form.lp-list-builder__form').length > 0 || + document.querySelectorAll('form.lp-list-builder-auth__form').length > 0 + ) && + typeof args[0].includes === 'function' && + args[0].includes('/wp-json/lp-list-builder/v1') + ) { + try { + args[1].body = attachFieldsToBody( + args[1].body, + selectFieldsData(+ctPublic.bot_detector_enabled), + ); + } catch (e) { + // Continue even if error + } + } + // === WooCommerce add to cart (direct add-item URL) === if ( ( @@ -5821,21 +5939,14 @@ async function apbct_ready() { handler.catchWCRestRequestAsMiddleware(); if (+ctPublic.bot_detector_enabled) { - let botDetectorEventTokenStored = false; + let lastStoredBotDetectorEventToken = null; window.addEventListener('botDetectorEventTokenUpdated', (event) => { const botDetectorEventToken = event.detail?.eventToken; - if (botDetectorEventToken && !botDetectorEventTokenStored) { + if (botDetectorEventToken && botDetectorEventToken !== lastStoredBotDetectorEventToken) { ctSetCookie([ ['ct_bot_detector_event_token', botDetectorEventToken], ]); - botDetectorEventTokenStored = true; - // @ToDo remove this block afret force_alt_cookies removed - if (typeof ctPublic.force_alt_cookies !== 'undefined' && ctPublic.force_alt_cookies) { - ctSetAlternativeCookie( - JSON.stringify({'ct_bot_detector_event_token': botDetectorEventToken}), - {forceAltCookies: true}, - ); - } + lastStoredBotDetectorEventToken = botDetectorEventToken; } }); } diff --git a/js/prebuild/apbct-public-bundle_full-protection.js b/js/prebuild/apbct-public-bundle_full-protection.js index 1844107a4..ece3f9271 100644 --- a/js/prebuild/apbct-public-bundle_full-protection.js +++ b/js/prebuild/apbct-public-bundle_full-protection.js @@ -14,6 +14,69 @@ function apbctSetEmailDecoderPopupAnimation() { return animationWrapper; } +let apbctEmailEncoderOnClose = null; + +/** + * Close the popup and reveal decoded contacts once. + */ +function apbctEmailEncoderClosePopup() { + const onClose = apbctEmailEncoderOnClose; + document.body.classList.remove('apbct-popup-fade'); + const popup = document.getElementById('apbct_popup'); + if (popup) { + apbctEmailEncoderUnbindPopupEvents(popup); + popup.style.display = 'none'; + } + if (onClose) { + apbctEmailEncoderOnClose = null; + onClose(); + } +} + +/** + * @param {MouseEvent} event Backdrop click event. + */ +function apbctEmailEncoderBackdropClickHandler(event) { + const popup = document.getElementById('apbct_popup'); + if ( + popup && + popup.style.display !== 'none' && + document.body.classList.contains('apbct-popup-fade') && + !popup.contains(event.target) + ) { + apbctEmailEncoderClosePopup(); + } +} + +/** + * @param {HTMLElement} popup Popup with completed decoding. + * @param {function()} onClose Callback to reveal decoded contacts. + */ +function apbctEmailEncoderBindPopupEvents(popup, onClose) { + apbctEmailEncoderOnClose = onClose; + const closeButton = popup.querySelector('.apbct-email-encoder-popup__close'); + if (closeButton) { + closeButton.classList.add('apbct-email-encoder-popup__close--visible'); + closeButton.addEventListener('click', apbctEmailEncoderClosePopup); + } + + document.body.addEventListener('click', apbctEmailEncoderBackdropClickHandler); +} + +/** + * @param {HTMLElement} popup Popup awaiting decoding. + */ +function apbctEmailEncoderUnbindPopupEvents(popup) { + apbctEmailEncoderOnClose = null; + const closeButton = popup.querySelector('.apbct-email-encoder-popup__close'); + if (closeButton) { + closeButton.classList.remove('apbct-email-encoder-popup__close--visible'); + closeButton.removeEventListener('click', apbctEmailEncoderClosePopup); + } + + document.body.removeEventListener('click', apbctEmailEncoderBackdropClickHandler); +} + /** * @param {mixed} event */ @@ -44,6 +107,12 @@ function ctFillDecodedEmailHandler(event = false) { waitingPopup.setAttribute('class', 'apbct-popup apbct-email-encoder-popup'); waitingPopup.setAttribute('id', 'apbct_popup'); + const closeButton = document.createElement('button'); + closeButton.type = 'button'; + closeButton.className = 'apbct-email-encoder-popup__close'; + closeButton.setAttribute('aria-label', 'Close popup'); + closeButton.innerHTML = '×'; + // construct text header let popupHeaderWrapper = document.createElement('span'); popupHeaderWrapper.classList = 'apbct-email-encoder-elements_center'; @@ -80,12 +149,14 @@ function ctFillDecodedEmailHandler(event = false) { } // appending + waitingPopup.append(closeButton); popupTextWrapper.append(popupTextWaiting); popupTextWrapper.append(popupTextDecoding); waitingPopup.append(popupHeaderWrapper); waitingPopup.append(popupTextWrapper); waitingPopup.append(apbctSetEmailDecoderPopupAnimation()); document.body.append(waitingPopup); + encoderPopup = waitingPopup; } else { encoderPopup.setAttribute('style', 'display: inherit'); if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_wait_for_decoding) { @@ -94,6 +165,7 @@ function ctFillDecodedEmailHandler(event = false) { document.getElementById('apbct_popup_text').innerHTML = ctAdminCommon.text__ee_wait_for_decoding; } } + apbctEmailEncoderUnbindPopupEvents(encoderPopup); apbctAjaxEmailDecodeBulk(event, encodedEmail, clickSource); } @@ -274,9 +346,7 @@ function apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource = } button.classList = 'apbct-email-encoder-got-it-button'; button.addEventListener('click', function() { - document.body.classList.remove('apbct-popup-fade'); - popup.setAttribute('style', 'display:none'); - fillDecodedNodes(encodedEmailNodes, result); + apbctEmailEncoderClosePopup(); // click on mailto if so if (typeof ctPublic !== 'undefined' && ctPublic.encodedEmailNodesIsMixed && clickSource) { clickSource.click(); @@ -285,6 +355,9 @@ function apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource = buttonWrapper.append(button); popup.append(buttonWrapper); } + apbctEmailEncoderBindPopupEvents(popup, function() { + fillDecodedNodes(encodedEmailNodes, result); + }); } }, 3000); } else { @@ -346,14 +419,13 @@ function ctShowDecodeComment(comment) { let popup = document.getElementById('apbct_popup'); let popupText = document.getElementById('apbct_popup_text'); if (popup !== null) { - document.body.classList.remove('apbct-popup-fade'); if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_email_decoder) { popupText.innerText = ctPublicFunctions.text__ee_email_decoder + ': ' + comment; } else { popupText.innerText = ctAdminCommon.text__ee_email_decoder + ': ' + comment; } setTimeout(function() { - popup.setAttribute('style', 'display:none'); + apbctEmailEncoderClosePopup(); }, 3000); } } @@ -481,7 +553,25 @@ function ctProcessDecodedDataResult(response, targetElement) { * @param {string} email */ function ctFillDecodedEmail(target, email) { - target.innerHTML = target.innerHTML.replace(/.+?(
)/, email + '$1'); + let tooltip = null; + for (let i = 0; i < target.children.length; i++) { + if (target.children[i].classList.contains('apbct-tooltip')) { + tooltip = target.children[i]; + break; + } + } + if (!tooltip) { + return; + } + // Replace everything before the tooltip. The decoded email is parsed separately, + // so it can not be merged into the markup around it. + while (tooltip.previousSibling) { + target.removeChild(tooltip.previousSibling); + } + const nodes = new DOMParser().parseFromString(String(email), 'text/html').body.childNodes; + for (let i = 0; i < nodes.length; i++) { + target.insertBefore(document.importNode(nodes[i], true), tooltip); + } } let ctEmailDecoderIsInitialized = false; @@ -2344,7 +2434,7 @@ function ctSetCookie( cookies, value, expires='') { ctSetAlternativeCookie(cookies, {forceAltCookies: true}); } cookies.forEach( function(item) { - const _expires = typeof item[2] !== 'undefined' ? 'expires=' + expires + '; ' : ''; + const _expires = typeof item[2] !== 'undefined' ? 'expires=' + item[2] + '; ' : ''; let ctSecure = location.protocol === 'https:' ? '; secure' : ''; document.cookie = ctPublicFunctions.cookiePrefix + item[0] + @@ -2358,7 +2448,7 @@ function ctSetCookie( cookies, value, expires='') { // Using alternative cookies } else if ( ctPublicFunctions.data__cookies_type === 'alternative' && !skipAlt ) { - ctSetAlternativeCookie(cookies); + ctSetAlternativeCookie(cookies, {forceAltCookies: ctPublic.force_alt_cookies}); } } @@ -2373,10 +2463,13 @@ function ctSetAlternativeCookie(cookies, params) { console.log('APBCT ERROR: getJavascriptClientData() is not loaded'); } - // if cookies is array, convert it to object - if (Array.isArray(cookies) && cookies[0] && cookies[0][0] === 'apbct_bot_detector_exist') { + if ( + !(params && params.forceAltCookies) && + Array.isArray(cookies) && cookies[0] && cookies[0][0] === 'apbct_bot_detector_exist' + ) { cookies = {apbct_bot_detector_exist: cookies[0][1]}; } + // Only try to parse if cookies is a string (JSON) if (typeof cookies === 'string') { try { @@ -2391,6 +2484,13 @@ function ctSetAlternativeCookie(cookies, params) { const onErrorCallback = params && params.onErrorCallback || null; if ( params && params.forceAltCookies ) { + // Named array properties are omitted by JSON.stringify(). + if (Array.isArray(cookies)) { + cookies = cookies.reduce((result, cookie) => { + result[cookie[0]] = cookie[1]; + return result; + }, {}); + } cookies.apbct_force_alt_cookies = true; } @@ -2787,7 +2887,6 @@ function ctNoCookieAttachHiddenFieldsToForms() { } } - /** * Class for event token transport */ @@ -3919,6 +4018,25 @@ class ApbctHandler { } } + // === LeakyPaywall register=== + if ( + ( + document.querySelectorAll('form.lp-list-builder__form').length > 0 || + document.querySelectorAll('form.lp-list-builder-auth__form').length > 0 + ) && + typeof args[0].includes === 'function' && + args[0].includes('/wp-json/lp-list-builder/v1') + ) { + try { + args[1].body = attachFieldsToBody( + args[1].body, + selectFieldsData(+ctPublic.bot_detector_enabled), + ); + } catch (e) { + // Continue even if error + } + } + // === WooCommerce add to cart (direct add-item URL) === if ( ( @@ -5821,21 +5939,14 @@ async function apbct_ready() { handler.catchWCRestRequestAsMiddleware(); if (+ctPublic.bot_detector_enabled) { - let botDetectorEventTokenStored = false; + let lastStoredBotDetectorEventToken = null; window.addEventListener('botDetectorEventTokenUpdated', (event) => { const botDetectorEventToken = event.detail?.eventToken; - if (botDetectorEventToken && !botDetectorEventTokenStored) { + if (botDetectorEventToken && botDetectorEventToken !== lastStoredBotDetectorEventToken) { ctSetCookie([ ['ct_bot_detector_event_token', botDetectorEventToken], ]); - botDetectorEventTokenStored = true; - // @ToDo remove this block afret force_alt_cookies removed - if (typeof ctPublic.force_alt_cookies !== 'undefined' && ctPublic.force_alt_cookies) { - ctSetAlternativeCookie( - JSON.stringify({'ct_bot_detector_event_token': botDetectorEventToken}), - {forceAltCookies: true}, - ); - } + lastStoredBotDetectorEventToken = botDetectorEventToken; } }); } @@ -7228,7 +7339,17 @@ class ApbctForceProtection { * @return {HTMLElement[]} */ findWrappers() { - return document.querySelectorAll('div.ct-encoded-form-wrapper'); + // Only wrappers generated by the plugin in this response have the token, + // wrappers planted in the content must not be decoded. + const token = ctPublic.force_protection_wrapper_token; + if (!token || typeof token !== 'string') { + return []; + } + + return Array.prototype.filter.call( + document.querySelectorAll('div.ct-encoded-form-wrapper'), + (wrapper) => wrapper.getAttribute('data-ct-wrapper-token') === token, + ); } /** @@ -7321,7 +7442,10 @@ class ApbctForceProtection { this.wrappers.forEach((wrapper) => { form = wrapper.querySelector('div.ct-encoded-form').dataset.encodedForm; if (form) { - wrapper.outerHTML = '
' + message + '
'; + const forbidden = document.createElement('div'); + forbidden.className = 'ct-encoded-form-forbidden'; + forbidden.textContent = message ? String(message) : ''; + wrapper.parentNode.replaceChild(forbidden, wrapper); } }); } diff --git a/js/prebuild/apbct-public-bundle_full-protection_gathering.js b/js/prebuild/apbct-public-bundle_full-protection_gathering.js index d1f89eb3e..8b794bea6 100644 --- a/js/prebuild/apbct-public-bundle_full-protection_gathering.js +++ b/js/prebuild/apbct-public-bundle_full-protection_gathering.js @@ -14,6 +14,69 @@ function apbctSetEmailDecoderPopupAnimation() { return animationWrapper; } +let apbctEmailEncoderOnClose = null; + +/** + * Close the popup and reveal decoded contacts once. + */ +function apbctEmailEncoderClosePopup() { + const onClose = apbctEmailEncoderOnClose; + document.body.classList.remove('apbct-popup-fade'); + const popup = document.getElementById('apbct_popup'); + if (popup) { + apbctEmailEncoderUnbindPopupEvents(popup); + popup.style.display = 'none'; + } + if (onClose) { + apbctEmailEncoderOnClose = null; + onClose(); + } +} + +/** + * @param {MouseEvent} event Backdrop click event. + */ +function apbctEmailEncoderBackdropClickHandler(event) { + const popup = document.getElementById('apbct_popup'); + if ( + popup && + popup.style.display !== 'none' && + document.body.classList.contains('apbct-popup-fade') && + !popup.contains(event.target) + ) { + apbctEmailEncoderClosePopup(); + } +} + +/** + * @param {HTMLElement} popup Popup with completed decoding. + * @param {function()} onClose Callback to reveal decoded contacts. + */ +function apbctEmailEncoderBindPopupEvents(popup, onClose) { + apbctEmailEncoderOnClose = onClose; + const closeButton = popup.querySelector('.apbct-email-encoder-popup__close'); + if (closeButton) { + closeButton.classList.add('apbct-email-encoder-popup__close--visible'); + closeButton.addEventListener('click', apbctEmailEncoderClosePopup); + } + + document.body.addEventListener('click', apbctEmailEncoderBackdropClickHandler); +} + +/** + * @param {HTMLElement} popup Popup awaiting decoding. + */ +function apbctEmailEncoderUnbindPopupEvents(popup) { + apbctEmailEncoderOnClose = null; + const closeButton = popup.querySelector('.apbct-email-encoder-popup__close'); + if (closeButton) { + closeButton.classList.remove('apbct-email-encoder-popup__close--visible'); + closeButton.removeEventListener('click', apbctEmailEncoderClosePopup); + } + + document.body.removeEventListener('click', apbctEmailEncoderBackdropClickHandler); +} + /** * @param {mixed} event */ @@ -44,6 +107,12 @@ function ctFillDecodedEmailHandler(event = false) { waitingPopup.setAttribute('class', 'apbct-popup apbct-email-encoder-popup'); waitingPopup.setAttribute('id', 'apbct_popup'); + const closeButton = document.createElement('button'); + closeButton.type = 'button'; + closeButton.className = 'apbct-email-encoder-popup__close'; + closeButton.setAttribute('aria-label', 'Close popup'); + closeButton.innerHTML = '×'; + // construct text header let popupHeaderWrapper = document.createElement('span'); popupHeaderWrapper.classList = 'apbct-email-encoder-elements_center'; @@ -80,12 +149,14 @@ function ctFillDecodedEmailHandler(event = false) { } // appending + waitingPopup.append(closeButton); popupTextWrapper.append(popupTextWaiting); popupTextWrapper.append(popupTextDecoding); waitingPopup.append(popupHeaderWrapper); waitingPopup.append(popupTextWrapper); waitingPopup.append(apbctSetEmailDecoderPopupAnimation()); document.body.append(waitingPopup); + encoderPopup = waitingPopup; } else { encoderPopup.setAttribute('style', 'display: inherit'); if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_wait_for_decoding) { @@ -94,6 +165,7 @@ function ctFillDecodedEmailHandler(event = false) { document.getElementById('apbct_popup_text').innerHTML = ctAdminCommon.text__ee_wait_for_decoding; } } + apbctEmailEncoderUnbindPopupEvents(encoderPopup); apbctAjaxEmailDecodeBulk(event, encodedEmail, clickSource); } @@ -274,9 +346,7 @@ function apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource = } button.classList = 'apbct-email-encoder-got-it-button'; button.addEventListener('click', function() { - document.body.classList.remove('apbct-popup-fade'); - popup.setAttribute('style', 'display:none'); - fillDecodedNodes(encodedEmailNodes, result); + apbctEmailEncoderClosePopup(); // click on mailto if so if (typeof ctPublic !== 'undefined' && ctPublic.encodedEmailNodesIsMixed && clickSource) { clickSource.click(); @@ -285,6 +355,9 @@ function apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource = buttonWrapper.append(button); popup.append(buttonWrapper); } + apbctEmailEncoderBindPopupEvents(popup, function() { + fillDecodedNodes(encodedEmailNodes, result); + }); } }, 3000); } else { @@ -346,14 +419,13 @@ function ctShowDecodeComment(comment) { let popup = document.getElementById('apbct_popup'); let popupText = document.getElementById('apbct_popup_text'); if (popup !== null) { - document.body.classList.remove('apbct-popup-fade'); if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_email_decoder) { popupText.innerText = ctPublicFunctions.text__ee_email_decoder + ': ' + comment; } else { popupText.innerText = ctAdminCommon.text__ee_email_decoder + ': ' + comment; } setTimeout(function() { - popup.setAttribute('style', 'display:none'); + apbctEmailEncoderClosePopup(); }, 3000); } } @@ -481,7 +553,25 @@ function ctProcessDecodedDataResult(response, targetElement) { * @param {string} email */ function ctFillDecodedEmail(target, email) { - target.innerHTML = target.innerHTML.replace(/.+?(
)/, email + '$1'); + let tooltip = null; + for (let i = 0; i < target.children.length; i++) { + if (target.children[i].classList.contains('apbct-tooltip')) { + tooltip = target.children[i]; + break; + } + } + if (!tooltip) { + return; + } + // Replace everything before the tooltip. The decoded email is parsed separately, + // so it can not be merged into the markup around it. + while (tooltip.previousSibling) { + target.removeChild(tooltip.previousSibling); + } + const nodes = new DOMParser().parseFromString(String(email), 'text/html').body.childNodes; + for (let i = 0; i < nodes.length; i++) { + target.insertBefore(document.importNode(nodes[i], true), tooltip); + } } let ctEmailDecoderIsInitialized = false; @@ -2344,7 +2434,7 @@ function ctSetCookie( cookies, value, expires='') { ctSetAlternativeCookie(cookies, {forceAltCookies: true}); } cookies.forEach( function(item) { - const _expires = typeof item[2] !== 'undefined' ? 'expires=' + expires + '; ' : ''; + const _expires = typeof item[2] !== 'undefined' ? 'expires=' + item[2] + '; ' : ''; let ctSecure = location.protocol === 'https:' ? '; secure' : ''; document.cookie = ctPublicFunctions.cookiePrefix + item[0] + @@ -2358,7 +2448,7 @@ function ctSetCookie( cookies, value, expires='') { // Using alternative cookies } else if ( ctPublicFunctions.data__cookies_type === 'alternative' && !skipAlt ) { - ctSetAlternativeCookie(cookies); + ctSetAlternativeCookie(cookies, {forceAltCookies: ctPublic.force_alt_cookies}); } } @@ -2373,10 +2463,13 @@ function ctSetAlternativeCookie(cookies, params) { console.log('APBCT ERROR: getJavascriptClientData() is not loaded'); } - // if cookies is array, convert it to object - if (Array.isArray(cookies) && cookies[0] && cookies[0][0] === 'apbct_bot_detector_exist') { + if ( + !(params && params.forceAltCookies) && + Array.isArray(cookies) && cookies[0] && cookies[0][0] === 'apbct_bot_detector_exist' + ) { cookies = {apbct_bot_detector_exist: cookies[0][1]}; } + // Only try to parse if cookies is a string (JSON) if (typeof cookies === 'string') { try { @@ -2391,6 +2484,13 @@ function ctSetAlternativeCookie(cookies, params) { const onErrorCallback = params && params.onErrorCallback || null; if ( params && params.forceAltCookies ) { + // Named array properties are omitted by JSON.stringify(). + if (Array.isArray(cookies)) { + cookies = cookies.reduce((result, cookie) => { + result[cookie[0]] = cookie[1]; + return result; + }, {}); + } cookies.apbct_force_alt_cookies = true; } @@ -2787,7 +2887,6 @@ function ctNoCookieAttachHiddenFieldsToForms() { } } - /** * Class for event token transport */ @@ -3919,6 +4018,25 @@ class ApbctHandler { } } + // === LeakyPaywall register=== + if ( + ( + document.querySelectorAll('form.lp-list-builder__form').length > 0 || + document.querySelectorAll('form.lp-list-builder-auth__form').length > 0 + ) && + typeof args[0].includes === 'function' && + args[0].includes('/wp-json/lp-list-builder/v1') + ) { + try { + args[1].body = attachFieldsToBody( + args[1].body, + selectFieldsData(+ctPublic.bot_detector_enabled), + ); + } catch (e) { + // Continue even if error + } + } + // === WooCommerce add to cart (direct add-item URL) === if ( ( @@ -5821,21 +5939,14 @@ async function apbct_ready() { handler.catchWCRestRequestAsMiddleware(); if (+ctPublic.bot_detector_enabled) { - let botDetectorEventTokenStored = false; + let lastStoredBotDetectorEventToken = null; window.addEventListener('botDetectorEventTokenUpdated', (event) => { const botDetectorEventToken = event.detail?.eventToken; - if (botDetectorEventToken && !botDetectorEventTokenStored) { + if (botDetectorEventToken && botDetectorEventToken !== lastStoredBotDetectorEventToken) { ctSetCookie([ ['ct_bot_detector_event_token', botDetectorEventToken], ]); - botDetectorEventTokenStored = true; - // @ToDo remove this block afret force_alt_cookies removed - if (typeof ctPublic.force_alt_cookies !== 'undefined' && ctPublic.force_alt_cookies) { - ctSetAlternativeCookie( - JSON.stringify({'ct_bot_detector_event_token': botDetectorEventToken}), - {forceAltCookies: true}, - ); - } + lastStoredBotDetectorEventToken = botDetectorEventToken; } }); } @@ -7228,7 +7339,17 @@ class ApbctForceProtection { * @return {HTMLElement[]} */ findWrappers() { - return document.querySelectorAll('div.ct-encoded-form-wrapper'); + // Only wrappers generated by the plugin in this response have the token, + // wrappers planted in the content must not be decoded. + const token = ctPublic.force_protection_wrapper_token; + if (!token || typeof token !== 'string') { + return []; + } + + return Array.prototype.filter.call( + document.querySelectorAll('div.ct-encoded-form-wrapper'), + (wrapper) => wrapper.getAttribute('data-ct-wrapper-token') === token, + ); } /** @@ -7321,7 +7442,10 @@ class ApbctForceProtection { this.wrappers.forEach((wrapper) => { form = wrapper.querySelector('div.ct-encoded-form').dataset.encodedForm; if (form) { - wrapper.outerHTML = '
' + message + '
'; + const forbidden = document.createElement('div'); + forbidden.className = 'ct-encoded-form-forbidden'; + forbidden.textContent = message ? String(message) : ''; + wrapper.parentNode.replaceChild(forbidden, wrapper); } }); } diff --git a/js/prebuild/apbct-public-bundle_gathering.js b/js/prebuild/apbct-public-bundle_gathering.js index 0e5b59cb5..d4bd9be78 100644 --- a/js/prebuild/apbct-public-bundle_gathering.js +++ b/js/prebuild/apbct-public-bundle_gathering.js @@ -14,6 +14,69 @@ function apbctSetEmailDecoderPopupAnimation() { return animationWrapper; } +let apbctEmailEncoderOnClose = null; + +/** + * Close the popup and reveal decoded contacts once. + */ +function apbctEmailEncoderClosePopup() { + const onClose = apbctEmailEncoderOnClose; + document.body.classList.remove('apbct-popup-fade'); + const popup = document.getElementById('apbct_popup'); + if (popup) { + apbctEmailEncoderUnbindPopupEvents(popup); + popup.style.display = 'none'; + } + if (onClose) { + apbctEmailEncoderOnClose = null; + onClose(); + } +} + +/** + * @param {MouseEvent} event Backdrop click event. + */ +function apbctEmailEncoderBackdropClickHandler(event) { + const popup = document.getElementById('apbct_popup'); + if ( + popup && + popup.style.display !== 'none' && + document.body.classList.contains('apbct-popup-fade') && + !popup.contains(event.target) + ) { + apbctEmailEncoderClosePopup(); + } +} + +/** + * @param {HTMLElement} popup Popup with completed decoding. + * @param {function()} onClose Callback to reveal decoded contacts. + */ +function apbctEmailEncoderBindPopupEvents(popup, onClose) { + apbctEmailEncoderOnClose = onClose; + const closeButton = popup.querySelector('.apbct-email-encoder-popup__close'); + if (closeButton) { + closeButton.classList.add('apbct-email-encoder-popup__close--visible'); + closeButton.addEventListener('click', apbctEmailEncoderClosePopup); + } + + document.body.addEventListener('click', apbctEmailEncoderBackdropClickHandler); +} + +/** + * @param {HTMLElement} popup Popup awaiting decoding. + */ +function apbctEmailEncoderUnbindPopupEvents(popup) { + apbctEmailEncoderOnClose = null; + const closeButton = popup.querySelector('.apbct-email-encoder-popup__close'); + if (closeButton) { + closeButton.classList.remove('apbct-email-encoder-popup__close--visible'); + closeButton.removeEventListener('click', apbctEmailEncoderClosePopup); + } + + document.body.removeEventListener('click', apbctEmailEncoderBackdropClickHandler); +} + /** * @param {mixed} event */ @@ -44,6 +107,12 @@ function ctFillDecodedEmailHandler(event = false) { waitingPopup.setAttribute('class', 'apbct-popup apbct-email-encoder-popup'); waitingPopup.setAttribute('id', 'apbct_popup'); + const closeButton = document.createElement('button'); + closeButton.type = 'button'; + closeButton.className = 'apbct-email-encoder-popup__close'; + closeButton.setAttribute('aria-label', 'Close popup'); + closeButton.innerHTML = '×'; + // construct text header let popupHeaderWrapper = document.createElement('span'); popupHeaderWrapper.classList = 'apbct-email-encoder-elements_center'; @@ -80,12 +149,14 @@ function ctFillDecodedEmailHandler(event = false) { } // appending + waitingPopup.append(closeButton); popupTextWrapper.append(popupTextWaiting); popupTextWrapper.append(popupTextDecoding); waitingPopup.append(popupHeaderWrapper); waitingPopup.append(popupTextWrapper); waitingPopup.append(apbctSetEmailDecoderPopupAnimation()); document.body.append(waitingPopup); + encoderPopup = waitingPopup; } else { encoderPopup.setAttribute('style', 'display: inherit'); if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_wait_for_decoding) { @@ -94,6 +165,7 @@ function ctFillDecodedEmailHandler(event = false) { document.getElementById('apbct_popup_text').innerHTML = ctAdminCommon.text__ee_wait_for_decoding; } } + apbctEmailEncoderUnbindPopupEvents(encoderPopup); apbctAjaxEmailDecodeBulk(event, encodedEmail, clickSource); } @@ -274,9 +346,7 @@ function apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource = } button.classList = 'apbct-email-encoder-got-it-button'; button.addEventListener('click', function() { - document.body.classList.remove('apbct-popup-fade'); - popup.setAttribute('style', 'display:none'); - fillDecodedNodes(encodedEmailNodes, result); + apbctEmailEncoderClosePopup(); // click on mailto if so if (typeof ctPublic !== 'undefined' && ctPublic.encodedEmailNodesIsMixed && clickSource) { clickSource.click(); @@ -285,6 +355,9 @@ function apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource = buttonWrapper.append(button); popup.append(buttonWrapper); } + apbctEmailEncoderBindPopupEvents(popup, function() { + fillDecodedNodes(encodedEmailNodes, result); + }); } }, 3000); } else { @@ -346,14 +419,13 @@ function ctShowDecodeComment(comment) { let popup = document.getElementById('apbct_popup'); let popupText = document.getElementById('apbct_popup_text'); if (popup !== null) { - document.body.classList.remove('apbct-popup-fade'); if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_email_decoder) { popupText.innerText = ctPublicFunctions.text__ee_email_decoder + ': ' + comment; } else { popupText.innerText = ctAdminCommon.text__ee_email_decoder + ': ' + comment; } setTimeout(function() { - popup.setAttribute('style', 'display:none'); + apbctEmailEncoderClosePopup(); }, 3000); } } @@ -481,7 +553,25 @@ function ctProcessDecodedDataResult(response, targetElement) { * @param {string} email */ function ctFillDecodedEmail(target, email) { - target.innerHTML = target.innerHTML.replace(/.+?(
)/, email + '$1'); + let tooltip = null; + for (let i = 0; i < target.children.length; i++) { + if (target.children[i].classList.contains('apbct-tooltip')) { + tooltip = target.children[i]; + break; + } + } + if (!tooltip) { + return; + } + // Replace everything before the tooltip. The decoded email is parsed separately, + // so it can not be merged into the markup around it. + while (tooltip.previousSibling) { + target.removeChild(tooltip.previousSibling); + } + const nodes = new DOMParser().parseFromString(String(email), 'text/html').body.childNodes; + for (let i = 0; i < nodes.length; i++) { + target.insertBefore(document.importNode(nodes[i], true), tooltip); + } } let ctEmailDecoderIsInitialized = false; @@ -2344,7 +2434,7 @@ function ctSetCookie( cookies, value, expires='') { ctSetAlternativeCookie(cookies, {forceAltCookies: true}); } cookies.forEach( function(item) { - const _expires = typeof item[2] !== 'undefined' ? 'expires=' + expires + '; ' : ''; + const _expires = typeof item[2] !== 'undefined' ? 'expires=' + item[2] + '; ' : ''; let ctSecure = location.protocol === 'https:' ? '; secure' : ''; document.cookie = ctPublicFunctions.cookiePrefix + item[0] + @@ -2358,7 +2448,7 @@ function ctSetCookie( cookies, value, expires='') { // Using alternative cookies } else if ( ctPublicFunctions.data__cookies_type === 'alternative' && !skipAlt ) { - ctSetAlternativeCookie(cookies); + ctSetAlternativeCookie(cookies, {forceAltCookies: ctPublic.force_alt_cookies}); } } @@ -2373,10 +2463,13 @@ function ctSetAlternativeCookie(cookies, params) { console.log('APBCT ERROR: getJavascriptClientData() is not loaded'); } - // if cookies is array, convert it to object - if (Array.isArray(cookies) && cookies[0] && cookies[0][0] === 'apbct_bot_detector_exist') { + if ( + !(params && params.forceAltCookies) && + Array.isArray(cookies) && cookies[0] && cookies[0][0] === 'apbct_bot_detector_exist' + ) { cookies = {apbct_bot_detector_exist: cookies[0][1]}; } + // Only try to parse if cookies is a string (JSON) if (typeof cookies === 'string') { try { @@ -2391,6 +2484,13 @@ function ctSetAlternativeCookie(cookies, params) { const onErrorCallback = params && params.onErrorCallback || null; if ( params && params.forceAltCookies ) { + // Named array properties are omitted by JSON.stringify(). + if (Array.isArray(cookies)) { + cookies = cookies.reduce((result, cookie) => { + result[cookie[0]] = cookie[1]; + return result; + }, {}); + } cookies.apbct_force_alt_cookies = true; } @@ -2787,7 +2887,6 @@ function ctNoCookieAttachHiddenFieldsToForms() { } } - /** * Class for event token transport */ @@ -3919,6 +4018,25 @@ class ApbctHandler { } } + // === LeakyPaywall register=== + if ( + ( + document.querySelectorAll('form.lp-list-builder__form').length > 0 || + document.querySelectorAll('form.lp-list-builder-auth__form').length > 0 + ) && + typeof args[0].includes === 'function' && + args[0].includes('/wp-json/lp-list-builder/v1') + ) { + try { + args[1].body = attachFieldsToBody( + args[1].body, + selectFieldsData(+ctPublic.bot_detector_enabled), + ); + } catch (e) { + // Continue even if error + } + } + // === WooCommerce add to cart (direct add-item URL) === if ( ( @@ -5821,21 +5939,14 @@ async function apbct_ready() { handler.catchWCRestRequestAsMiddleware(); if (+ctPublic.bot_detector_enabled) { - let botDetectorEventTokenStored = false; + let lastStoredBotDetectorEventToken = null; window.addEventListener('botDetectorEventTokenUpdated', (event) => { const botDetectorEventToken = event.detail?.eventToken; - if (botDetectorEventToken && !botDetectorEventTokenStored) { + if (botDetectorEventToken && botDetectorEventToken !== lastStoredBotDetectorEventToken) { ctSetCookie([ ['ct_bot_detector_event_token', botDetectorEventToken], ]); - botDetectorEventTokenStored = true; - // @ToDo remove this block afret force_alt_cookies removed - if (typeof ctPublic.force_alt_cookies !== 'undefined' && ctPublic.force_alt_cookies) { - ctSetAlternativeCookie( - JSON.stringify({'ct_bot_detector_event_token': botDetectorEventToken}), - {forceAltCookies: true}, - ); - } + lastStoredBotDetectorEventToken = botDetectorEventToken; } }); } diff --git a/js/prebuild/apbct-public-bundle_int-protection.js b/js/prebuild/apbct-public-bundle_int-protection.js index fa0b6e18d..3257972f7 100644 --- a/js/prebuild/apbct-public-bundle_int-protection.js +++ b/js/prebuild/apbct-public-bundle_int-protection.js @@ -14,6 +14,69 @@ function apbctSetEmailDecoderPopupAnimation() { return animationWrapper; } +let apbctEmailEncoderOnClose = null; + +/** + * Close the popup and reveal decoded contacts once. + */ +function apbctEmailEncoderClosePopup() { + const onClose = apbctEmailEncoderOnClose; + document.body.classList.remove('apbct-popup-fade'); + const popup = document.getElementById('apbct_popup'); + if (popup) { + apbctEmailEncoderUnbindPopupEvents(popup); + popup.style.display = 'none'; + } + if (onClose) { + apbctEmailEncoderOnClose = null; + onClose(); + } +} + +/** + * @param {MouseEvent} event Backdrop click event. + */ +function apbctEmailEncoderBackdropClickHandler(event) { + const popup = document.getElementById('apbct_popup'); + if ( + popup && + popup.style.display !== 'none' && + document.body.classList.contains('apbct-popup-fade') && + !popup.contains(event.target) + ) { + apbctEmailEncoderClosePopup(); + } +} + +/** + * @param {HTMLElement} popup Popup with completed decoding. + * @param {function()} onClose Callback to reveal decoded contacts. + */ +function apbctEmailEncoderBindPopupEvents(popup, onClose) { + apbctEmailEncoderOnClose = onClose; + const closeButton = popup.querySelector('.apbct-email-encoder-popup__close'); + if (closeButton) { + closeButton.classList.add('apbct-email-encoder-popup__close--visible'); + closeButton.addEventListener('click', apbctEmailEncoderClosePopup); + } + + document.body.addEventListener('click', apbctEmailEncoderBackdropClickHandler); +} + +/** + * @param {HTMLElement} popup Popup awaiting decoding. + */ +function apbctEmailEncoderUnbindPopupEvents(popup) { + apbctEmailEncoderOnClose = null; + const closeButton = popup.querySelector('.apbct-email-encoder-popup__close'); + if (closeButton) { + closeButton.classList.remove('apbct-email-encoder-popup__close--visible'); + closeButton.removeEventListener('click', apbctEmailEncoderClosePopup); + } + + document.body.removeEventListener('click', apbctEmailEncoderBackdropClickHandler); +} + /** * @param {mixed} event */ @@ -44,6 +107,12 @@ function ctFillDecodedEmailHandler(event = false) { waitingPopup.setAttribute('class', 'apbct-popup apbct-email-encoder-popup'); waitingPopup.setAttribute('id', 'apbct_popup'); + const closeButton = document.createElement('button'); + closeButton.type = 'button'; + closeButton.className = 'apbct-email-encoder-popup__close'; + closeButton.setAttribute('aria-label', 'Close popup'); + closeButton.innerHTML = '×'; + // construct text header let popupHeaderWrapper = document.createElement('span'); popupHeaderWrapper.classList = 'apbct-email-encoder-elements_center'; @@ -80,12 +149,14 @@ function ctFillDecodedEmailHandler(event = false) { } // appending + waitingPopup.append(closeButton); popupTextWrapper.append(popupTextWaiting); popupTextWrapper.append(popupTextDecoding); waitingPopup.append(popupHeaderWrapper); waitingPopup.append(popupTextWrapper); waitingPopup.append(apbctSetEmailDecoderPopupAnimation()); document.body.append(waitingPopup); + encoderPopup = waitingPopup; } else { encoderPopup.setAttribute('style', 'display: inherit'); if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_wait_for_decoding) { @@ -94,6 +165,7 @@ function ctFillDecodedEmailHandler(event = false) { document.getElementById('apbct_popup_text').innerHTML = ctAdminCommon.text__ee_wait_for_decoding; } } + apbctEmailEncoderUnbindPopupEvents(encoderPopup); apbctAjaxEmailDecodeBulk(event, encodedEmail, clickSource); } @@ -274,9 +346,7 @@ function apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource = } button.classList = 'apbct-email-encoder-got-it-button'; button.addEventListener('click', function() { - document.body.classList.remove('apbct-popup-fade'); - popup.setAttribute('style', 'display:none'); - fillDecodedNodes(encodedEmailNodes, result); + apbctEmailEncoderClosePopup(); // click on mailto if so if (typeof ctPublic !== 'undefined' && ctPublic.encodedEmailNodesIsMixed && clickSource) { clickSource.click(); @@ -285,6 +355,9 @@ function apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource = buttonWrapper.append(button); popup.append(buttonWrapper); } + apbctEmailEncoderBindPopupEvents(popup, function() { + fillDecodedNodes(encodedEmailNodes, result); + }); } }, 3000); } else { @@ -346,14 +419,13 @@ function ctShowDecodeComment(comment) { let popup = document.getElementById('apbct_popup'); let popupText = document.getElementById('apbct_popup_text'); if (popup !== null) { - document.body.classList.remove('apbct-popup-fade'); if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_email_decoder) { popupText.innerText = ctPublicFunctions.text__ee_email_decoder + ': ' + comment; } else { popupText.innerText = ctAdminCommon.text__ee_email_decoder + ': ' + comment; } setTimeout(function() { - popup.setAttribute('style', 'display:none'); + apbctEmailEncoderClosePopup(); }, 3000); } } @@ -481,7 +553,25 @@ function ctProcessDecodedDataResult(response, targetElement) { * @param {string} email */ function ctFillDecodedEmail(target, email) { - target.innerHTML = target.innerHTML.replace(/.+?(
)/, email + '$1'); + let tooltip = null; + for (let i = 0; i < target.children.length; i++) { + if (target.children[i].classList.contains('apbct-tooltip')) { + tooltip = target.children[i]; + break; + } + } + if (!tooltip) { + return; + } + // Replace everything before the tooltip. The decoded email is parsed separately, + // so it can not be merged into the markup around it. + while (tooltip.previousSibling) { + target.removeChild(tooltip.previousSibling); + } + const nodes = new DOMParser().parseFromString(String(email), 'text/html').body.childNodes; + for (let i = 0; i < nodes.length; i++) { + target.insertBefore(document.importNode(nodes[i], true), tooltip); + } } let ctEmailDecoderIsInitialized = false; @@ -2344,7 +2434,7 @@ function ctSetCookie( cookies, value, expires='') { ctSetAlternativeCookie(cookies, {forceAltCookies: true}); } cookies.forEach( function(item) { - const _expires = typeof item[2] !== 'undefined' ? 'expires=' + expires + '; ' : ''; + const _expires = typeof item[2] !== 'undefined' ? 'expires=' + item[2] + '; ' : ''; let ctSecure = location.protocol === 'https:' ? '; secure' : ''; document.cookie = ctPublicFunctions.cookiePrefix + item[0] + @@ -2358,7 +2448,7 @@ function ctSetCookie( cookies, value, expires='') { // Using alternative cookies } else if ( ctPublicFunctions.data__cookies_type === 'alternative' && !skipAlt ) { - ctSetAlternativeCookie(cookies); + ctSetAlternativeCookie(cookies, {forceAltCookies: ctPublic.force_alt_cookies}); } } @@ -2373,10 +2463,13 @@ function ctSetAlternativeCookie(cookies, params) { console.log('APBCT ERROR: getJavascriptClientData() is not loaded'); } - // if cookies is array, convert it to object - if (Array.isArray(cookies) && cookies[0] && cookies[0][0] === 'apbct_bot_detector_exist') { + if ( + !(params && params.forceAltCookies) && + Array.isArray(cookies) && cookies[0] && cookies[0][0] === 'apbct_bot_detector_exist' + ) { cookies = {apbct_bot_detector_exist: cookies[0][1]}; } + // Only try to parse if cookies is a string (JSON) if (typeof cookies === 'string') { try { @@ -2391,6 +2484,13 @@ function ctSetAlternativeCookie(cookies, params) { const onErrorCallback = params && params.onErrorCallback || null; if ( params && params.forceAltCookies ) { + // Named array properties are omitted by JSON.stringify(). + if (Array.isArray(cookies)) { + cookies = cookies.reduce((result, cookie) => { + result[cookie[0]] = cookie[1]; + return result; + }, {}); + } cookies.apbct_force_alt_cookies = true; } @@ -2787,7 +2887,6 @@ function ctNoCookieAttachHiddenFieldsToForms() { } } - /** * Class for event token transport */ @@ -3919,6 +4018,25 @@ class ApbctHandler { } } + // === LeakyPaywall register=== + if ( + ( + document.querySelectorAll('form.lp-list-builder__form').length > 0 || + document.querySelectorAll('form.lp-list-builder-auth__form').length > 0 + ) && + typeof args[0].includes === 'function' && + args[0].includes('/wp-json/lp-list-builder/v1') + ) { + try { + args[1].body = attachFieldsToBody( + args[1].body, + selectFieldsData(+ctPublic.bot_detector_enabled), + ); + } catch (e) { + // Continue even if error + } + } + // === WooCommerce add to cart (direct add-item URL) === if ( ( @@ -5821,21 +5939,14 @@ async function apbct_ready() { handler.catchWCRestRequestAsMiddleware(); if (+ctPublic.bot_detector_enabled) { - let botDetectorEventTokenStored = false; + let lastStoredBotDetectorEventToken = null; window.addEventListener('botDetectorEventTokenUpdated', (event) => { const botDetectorEventToken = event.detail?.eventToken; - if (botDetectorEventToken && !botDetectorEventTokenStored) { + if (botDetectorEventToken && botDetectorEventToken !== lastStoredBotDetectorEventToken) { ctSetCookie([ ['ct_bot_detector_event_token', botDetectorEventToken], ]); - botDetectorEventTokenStored = true; - // @ToDo remove this block afret force_alt_cookies removed - if (typeof ctPublic.force_alt_cookies !== 'undefined' && ctPublic.force_alt_cookies) { - ctSetAlternativeCookie( - JSON.stringify({'ct_bot_detector_event_token': botDetectorEventToken}), - {forceAltCookies: true}, - ); - } + lastStoredBotDetectorEventToken = botDetectorEventToken; } }); } diff --git a/js/prebuild/apbct-public-bundle_int-protection_gathering.js b/js/prebuild/apbct-public-bundle_int-protection_gathering.js index cf52274f1..e05aba0be 100644 --- a/js/prebuild/apbct-public-bundle_int-protection_gathering.js +++ b/js/prebuild/apbct-public-bundle_int-protection_gathering.js @@ -14,6 +14,69 @@ function apbctSetEmailDecoderPopupAnimation() { return animationWrapper; } +let apbctEmailEncoderOnClose = null; + +/** + * Close the popup and reveal decoded contacts once. + */ +function apbctEmailEncoderClosePopup() { + const onClose = apbctEmailEncoderOnClose; + document.body.classList.remove('apbct-popup-fade'); + const popup = document.getElementById('apbct_popup'); + if (popup) { + apbctEmailEncoderUnbindPopupEvents(popup); + popup.style.display = 'none'; + } + if (onClose) { + apbctEmailEncoderOnClose = null; + onClose(); + } +} + +/** + * @param {MouseEvent} event Backdrop click event. + */ +function apbctEmailEncoderBackdropClickHandler(event) { + const popup = document.getElementById('apbct_popup'); + if ( + popup && + popup.style.display !== 'none' && + document.body.classList.contains('apbct-popup-fade') && + !popup.contains(event.target) + ) { + apbctEmailEncoderClosePopup(); + } +} + +/** + * @param {HTMLElement} popup Popup with completed decoding. + * @param {function()} onClose Callback to reveal decoded contacts. + */ +function apbctEmailEncoderBindPopupEvents(popup, onClose) { + apbctEmailEncoderOnClose = onClose; + const closeButton = popup.querySelector('.apbct-email-encoder-popup__close'); + if (closeButton) { + closeButton.classList.add('apbct-email-encoder-popup__close--visible'); + closeButton.addEventListener('click', apbctEmailEncoderClosePopup); + } + + document.body.addEventListener('click', apbctEmailEncoderBackdropClickHandler); +} + +/** + * @param {HTMLElement} popup Popup awaiting decoding. + */ +function apbctEmailEncoderUnbindPopupEvents(popup) { + apbctEmailEncoderOnClose = null; + const closeButton = popup.querySelector('.apbct-email-encoder-popup__close'); + if (closeButton) { + closeButton.classList.remove('apbct-email-encoder-popup__close--visible'); + closeButton.removeEventListener('click', apbctEmailEncoderClosePopup); + } + + document.body.removeEventListener('click', apbctEmailEncoderBackdropClickHandler); +} + /** * @param {mixed} event */ @@ -44,6 +107,12 @@ function ctFillDecodedEmailHandler(event = false) { waitingPopup.setAttribute('class', 'apbct-popup apbct-email-encoder-popup'); waitingPopup.setAttribute('id', 'apbct_popup'); + const closeButton = document.createElement('button'); + closeButton.type = 'button'; + closeButton.className = 'apbct-email-encoder-popup__close'; + closeButton.setAttribute('aria-label', 'Close popup'); + closeButton.innerHTML = '×'; + // construct text header let popupHeaderWrapper = document.createElement('span'); popupHeaderWrapper.classList = 'apbct-email-encoder-elements_center'; @@ -80,12 +149,14 @@ function ctFillDecodedEmailHandler(event = false) { } // appending + waitingPopup.append(closeButton); popupTextWrapper.append(popupTextWaiting); popupTextWrapper.append(popupTextDecoding); waitingPopup.append(popupHeaderWrapper); waitingPopup.append(popupTextWrapper); waitingPopup.append(apbctSetEmailDecoderPopupAnimation()); document.body.append(waitingPopup); + encoderPopup = waitingPopup; } else { encoderPopup.setAttribute('style', 'display: inherit'); if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_wait_for_decoding) { @@ -94,6 +165,7 @@ function ctFillDecodedEmailHandler(event = false) { document.getElementById('apbct_popup_text').innerHTML = ctAdminCommon.text__ee_wait_for_decoding; } } + apbctEmailEncoderUnbindPopupEvents(encoderPopup); apbctAjaxEmailDecodeBulk(event, encodedEmail, clickSource); } @@ -274,9 +346,7 @@ function apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource = } button.classList = 'apbct-email-encoder-got-it-button'; button.addEventListener('click', function() { - document.body.classList.remove('apbct-popup-fade'); - popup.setAttribute('style', 'display:none'); - fillDecodedNodes(encodedEmailNodes, result); + apbctEmailEncoderClosePopup(); // click on mailto if so if (typeof ctPublic !== 'undefined' && ctPublic.encodedEmailNodesIsMixed && clickSource) { clickSource.click(); @@ -285,6 +355,9 @@ function apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource = buttonWrapper.append(button); popup.append(buttonWrapper); } + apbctEmailEncoderBindPopupEvents(popup, function() { + fillDecodedNodes(encodedEmailNodes, result); + }); } }, 3000); } else { @@ -346,14 +419,13 @@ function ctShowDecodeComment(comment) { let popup = document.getElementById('apbct_popup'); let popupText = document.getElementById('apbct_popup_text'); if (popup !== null) { - document.body.classList.remove('apbct-popup-fade'); if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_email_decoder) { popupText.innerText = ctPublicFunctions.text__ee_email_decoder + ': ' + comment; } else { popupText.innerText = ctAdminCommon.text__ee_email_decoder + ': ' + comment; } setTimeout(function() { - popup.setAttribute('style', 'display:none'); + apbctEmailEncoderClosePopup(); }, 3000); } } @@ -481,7 +553,25 @@ function ctProcessDecodedDataResult(response, targetElement) { * @param {string} email */ function ctFillDecodedEmail(target, email) { - target.innerHTML = target.innerHTML.replace(/.+?(
)/, email + '$1'); + let tooltip = null; + for (let i = 0; i < target.children.length; i++) { + if (target.children[i].classList.contains('apbct-tooltip')) { + tooltip = target.children[i]; + break; + } + } + if (!tooltip) { + return; + } + // Replace everything before the tooltip. The decoded email is parsed separately, + // so it can not be merged into the markup around it. + while (tooltip.previousSibling) { + target.removeChild(tooltip.previousSibling); + } + const nodes = new DOMParser().parseFromString(String(email), 'text/html').body.childNodes; + for (let i = 0; i < nodes.length; i++) { + target.insertBefore(document.importNode(nodes[i], true), tooltip); + } } let ctEmailDecoderIsInitialized = false; @@ -2344,7 +2434,7 @@ function ctSetCookie( cookies, value, expires='') { ctSetAlternativeCookie(cookies, {forceAltCookies: true}); } cookies.forEach( function(item) { - const _expires = typeof item[2] !== 'undefined' ? 'expires=' + expires + '; ' : ''; + const _expires = typeof item[2] !== 'undefined' ? 'expires=' + item[2] + '; ' : ''; let ctSecure = location.protocol === 'https:' ? '; secure' : ''; document.cookie = ctPublicFunctions.cookiePrefix + item[0] + @@ -2358,7 +2448,7 @@ function ctSetCookie( cookies, value, expires='') { // Using alternative cookies } else if ( ctPublicFunctions.data__cookies_type === 'alternative' && !skipAlt ) { - ctSetAlternativeCookie(cookies); + ctSetAlternativeCookie(cookies, {forceAltCookies: ctPublic.force_alt_cookies}); } } @@ -2373,10 +2463,13 @@ function ctSetAlternativeCookie(cookies, params) { console.log('APBCT ERROR: getJavascriptClientData() is not loaded'); } - // if cookies is array, convert it to object - if (Array.isArray(cookies) && cookies[0] && cookies[0][0] === 'apbct_bot_detector_exist') { + if ( + !(params && params.forceAltCookies) && + Array.isArray(cookies) && cookies[0] && cookies[0][0] === 'apbct_bot_detector_exist' + ) { cookies = {apbct_bot_detector_exist: cookies[0][1]}; } + // Only try to parse if cookies is a string (JSON) if (typeof cookies === 'string') { try { @@ -2391,6 +2484,13 @@ function ctSetAlternativeCookie(cookies, params) { const onErrorCallback = params && params.onErrorCallback || null; if ( params && params.forceAltCookies ) { + // Named array properties are omitted by JSON.stringify(). + if (Array.isArray(cookies)) { + cookies = cookies.reduce((result, cookie) => { + result[cookie[0]] = cookie[1]; + return result; + }, {}); + } cookies.apbct_force_alt_cookies = true; } @@ -2787,7 +2887,6 @@ function ctNoCookieAttachHiddenFieldsToForms() { } } - /** * Class for event token transport */ @@ -3919,6 +4018,25 @@ class ApbctHandler { } } + // === LeakyPaywall register=== + if ( + ( + document.querySelectorAll('form.lp-list-builder__form').length > 0 || + document.querySelectorAll('form.lp-list-builder-auth__form').length > 0 + ) && + typeof args[0].includes === 'function' && + args[0].includes('/wp-json/lp-list-builder/v1') + ) { + try { + args[1].body = attachFieldsToBody( + args[1].body, + selectFieldsData(+ctPublic.bot_detector_enabled), + ); + } catch (e) { + // Continue even if error + } + } + // === WooCommerce add to cart (direct add-item URL) === if ( ( @@ -5821,21 +5939,14 @@ async function apbct_ready() { handler.catchWCRestRequestAsMiddleware(); if (+ctPublic.bot_detector_enabled) { - let botDetectorEventTokenStored = false; + let lastStoredBotDetectorEventToken = null; window.addEventListener('botDetectorEventTokenUpdated', (event) => { const botDetectorEventToken = event.detail?.eventToken; - if (botDetectorEventToken && !botDetectorEventTokenStored) { + if (botDetectorEventToken && botDetectorEventToken !== lastStoredBotDetectorEventToken) { ctSetCookie([ ['ct_bot_detector_event_token', botDetectorEventToken], ]); - botDetectorEventTokenStored = true; - // @ToDo remove this block afret force_alt_cookies removed - if (typeof ctPublic.force_alt_cookies !== 'undefined' && ctPublic.force_alt_cookies) { - ctSetAlternativeCookie( - JSON.stringify({'ct_bot_detector_event_token': botDetectorEventToken}), - {forceAltCookies: true}, - ); - } + lastStoredBotDetectorEventToken = botDetectorEventToken; } }); } diff --git a/js/src/cleantalk-dashboard-widget.js b/js/src/cleantalk-dashboard-widget.js index e5280cdad..d7d52add1 100644 --- a/js/src/cleantalk-dashboard-widget.js +++ b/js/src/cleantalk-dashboard-widget.js @@ -4,7 +4,13 @@ jQuery(document).ready(function(){ jQuery(".ct_widget_refresh_link").on('click', function(){ jQuery('.ct_preloader').show(); setTimeout(function(){window.scrollTo(0, jQuery('#ct_widget_wrapper').offset().top - 130);}, 1); - setTimeout(function(){jQuery("#ct_refresh_form").submit();}, 2500); + jQuery.post(apbctDashboardWidget.ajax_url, { + action: 'apbct_brief_refresh', + security: apbctDashboardWidget.nonce + }).always(function(){ + location.href = location.pathname + location.search + '#ct_widget'; + location.reload(); + }); }); if(location.hash == '#ct_widget') @@ -88,4 +94,4 @@ jQuery(document).ready(function(){ } }); -}); \ No newline at end of file +}); diff --git a/js/src/common-decoder.js b/js/src/common-decoder.js index e1008cdd8..d8d7f4df0 100644 --- a/js/src/common-decoder.js +++ b/js/src/common-decoder.js @@ -14,6 +14,69 @@ function apbctSetEmailDecoderPopupAnimation() { return animationWrapper; } +let apbctEmailEncoderOnClose = null; + +/** + * Close the popup and reveal decoded contacts once. + */ +function apbctEmailEncoderClosePopup() { + const onClose = apbctEmailEncoderOnClose; + document.body.classList.remove('apbct-popup-fade'); + const popup = document.getElementById('apbct_popup'); + if (popup) { + apbctEmailEncoderUnbindPopupEvents(popup); + popup.style.display = 'none'; + } + if (onClose) { + apbctEmailEncoderOnClose = null; + onClose(); + } +} + +/** + * @param {MouseEvent} event Backdrop click event. + */ +function apbctEmailEncoderBackdropClickHandler(event) { + const popup = document.getElementById('apbct_popup'); + if ( + popup && + popup.style.display !== 'none' && + document.body.classList.contains('apbct-popup-fade') && + !popup.contains(event.target) + ) { + apbctEmailEncoderClosePopup(); + } +} + +/** + * @param {HTMLElement} popup Popup with completed decoding. + * @param {function()} onClose Callback to reveal decoded contacts. + */ +function apbctEmailEncoderBindPopupEvents(popup, onClose) { + apbctEmailEncoderOnClose = onClose; + const closeButton = popup.querySelector('.apbct-email-encoder-popup__close'); + if (closeButton) { + closeButton.classList.add('apbct-email-encoder-popup__close--visible'); + closeButton.addEventListener('click', apbctEmailEncoderClosePopup); + } + + document.body.addEventListener('click', apbctEmailEncoderBackdropClickHandler); +} + +/** + * @param {HTMLElement} popup Popup awaiting decoding. + */ +function apbctEmailEncoderUnbindPopupEvents(popup) { + apbctEmailEncoderOnClose = null; + const closeButton = popup.querySelector('.apbct-email-encoder-popup__close'); + if (closeButton) { + closeButton.classList.remove('apbct-email-encoder-popup__close--visible'); + closeButton.removeEventListener('click', apbctEmailEncoderClosePopup); + } + + document.body.removeEventListener('click', apbctEmailEncoderBackdropClickHandler); +} + /** * @param {mixed} event */ @@ -44,6 +107,12 @@ function ctFillDecodedEmailHandler(event = false) { waitingPopup.setAttribute('class', 'apbct-popup apbct-email-encoder-popup'); waitingPopup.setAttribute('id', 'apbct_popup'); + const closeButton = document.createElement('button'); + closeButton.type = 'button'; + closeButton.className = 'apbct-email-encoder-popup__close'; + closeButton.setAttribute('aria-label', 'Close popup'); + closeButton.innerHTML = '×'; + // construct text header let popupHeaderWrapper = document.createElement('span'); popupHeaderWrapper.classList = 'apbct-email-encoder-elements_center'; @@ -80,12 +149,14 @@ function ctFillDecodedEmailHandler(event = false) { } // appending + waitingPopup.append(closeButton); popupTextWrapper.append(popupTextWaiting); popupTextWrapper.append(popupTextDecoding); waitingPopup.append(popupHeaderWrapper); waitingPopup.append(popupTextWrapper); waitingPopup.append(apbctSetEmailDecoderPopupAnimation()); document.body.append(waitingPopup); + encoderPopup = waitingPopup; } else { encoderPopup.setAttribute('style', 'display: inherit'); if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_wait_for_decoding) { @@ -94,6 +165,7 @@ function ctFillDecodedEmailHandler(event = false) { document.getElementById('apbct_popup_text').innerHTML = ctAdminCommon.text__ee_wait_for_decoding; } } + apbctEmailEncoderUnbindPopupEvents(encoderPopup); apbctAjaxEmailDecodeBulk(event, encodedEmail, clickSource); } @@ -274,9 +346,7 @@ function apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource = } button.classList = 'apbct-email-encoder-got-it-button'; button.addEventListener('click', function() { - document.body.classList.remove('apbct-popup-fade'); - popup.setAttribute('style', 'display:none'); - fillDecodedNodes(encodedEmailNodes, result); + apbctEmailEncoderClosePopup(); // click on mailto if so if (typeof ctPublic !== 'undefined' && ctPublic.encodedEmailNodesIsMixed && clickSource) { clickSource.click(); @@ -285,6 +355,9 @@ function apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource = buttonWrapper.append(button); popup.append(buttonWrapper); } + apbctEmailEncoderBindPopupEvents(popup, function() { + fillDecodedNodes(encodedEmailNodes, result); + }); } }, 3000); } else { @@ -346,14 +419,13 @@ function ctShowDecodeComment(comment) { let popup = document.getElementById('apbct_popup'); let popupText = document.getElementById('apbct_popup_text'); if (popup !== null) { - document.body.classList.remove('apbct-popup-fade'); if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_email_decoder) { popupText.innerText = ctPublicFunctions.text__ee_email_decoder + ': ' + comment; } else { popupText.innerText = ctAdminCommon.text__ee_email_decoder + ': ' + comment; } setTimeout(function() { - popup.setAttribute('style', 'display:none'); + apbctEmailEncoderClosePopup(); }, 3000); } } @@ -481,7 +553,25 @@ function ctProcessDecodedDataResult(response, targetElement) { * @param {string} email */ function ctFillDecodedEmail(target, email) { - target.innerHTML = target.innerHTML.replace(/.+?(
)/, email + '$1'); + let tooltip = null; + for (let i = 0; i < target.children.length; i++) { + if (target.children[i].classList.contains('apbct-tooltip')) { + tooltip = target.children[i]; + break; + } + } + if (!tooltip) { + return; + } + // Replace everything before the tooltip. The decoded email is parsed separately, + // so it can not be merged into the markup around it. + while (tooltip.previousSibling) { + target.removeChild(tooltip.previousSibling); + } + const nodes = new DOMParser().parseFromString(String(email), 'text/html').body.childNodes; + for (let i = 0; i < nodes.length; i++) { + target.insertBefore(document.importNode(nodes[i], true), tooltip); + } } let ctEmailDecoderIsInitialized = false; diff --git a/js/src/public-1-functions.js b/js/src/public-1-functions.js index e32ba7998..301cbfa9c 100644 --- a/js/src/public-1-functions.js +++ b/js/src/public-1-functions.js @@ -146,7 +146,7 @@ function ctSetCookie( cookies, value, expires='') { ctSetAlternativeCookie(cookies, {forceAltCookies: true}); } cookies.forEach( function(item) { - const _expires = typeof item[2] !== 'undefined' ? 'expires=' + expires + '; ' : ''; + const _expires = typeof item[2] !== 'undefined' ? 'expires=' + item[2] + '; ' : ''; let ctSecure = location.protocol === 'https:' ? '; secure' : ''; document.cookie = ctPublicFunctions.cookiePrefix + item[0] + @@ -160,7 +160,7 @@ function ctSetCookie( cookies, value, expires='') { // Using alternative cookies } else if ( ctPublicFunctions.data__cookies_type === 'alternative' && !skipAlt ) { - ctSetAlternativeCookie(cookies); + ctSetAlternativeCookie(cookies, {forceAltCookies: ctPublic.force_alt_cookies}); } } @@ -175,10 +175,13 @@ function ctSetAlternativeCookie(cookies, params) { console.log('APBCT ERROR: getJavascriptClientData() is not loaded'); } - // if cookies is array, convert it to object - if (Array.isArray(cookies) && cookies[0] && cookies[0][0] === 'apbct_bot_detector_exist') { + if ( + !(params && params.forceAltCookies) && + Array.isArray(cookies) && cookies[0] && cookies[0][0] === 'apbct_bot_detector_exist' + ) { cookies = {apbct_bot_detector_exist: cookies[0][1]}; } + // Only try to parse if cookies is a string (JSON) if (typeof cookies === 'string') { try { @@ -193,6 +196,13 @@ function ctSetAlternativeCookie(cookies, params) { const onErrorCallback = params && params.onErrorCallback || null; if ( params && params.forceAltCookies ) { + // Named array properties are omitted by JSON.stringify(). + if (Array.isArray(cookies)) { + cookies = cookies.reduce((result, cookie) => { + result[cookie[0]] = cookie[1]; + return result; + }, {}); + } cookies.apbct_force_alt_cookies = true; } @@ -588,4 +598,3 @@ function ctNoCookieAttachHiddenFieldsToForms() { } } } - diff --git a/js/src/public-1-main.js b/js/src/public-1-main.js index fb12fb311..f03c01b8f 100644 --- a/js/src/public-1-main.js +++ b/js/src/public-1-main.js @@ -1129,6 +1129,25 @@ class ApbctHandler { } } + // === LeakyPaywall register=== + if ( + ( + document.querySelectorAll('form.lp-list-builder__form').length > 0 || + document.querySelectorAll('form.lp-list-builder-auth__form').length > 0 + ) && + typeof args[0].includes === 'function' && + args[0].includes('/wp-json/lp-list-builder/v1') + ) { + try { + args[1].body = attachFieldsToBody( + args[1].body, + selectFieldsData(+ctPublic.bot_detector_enabled), + ); + } catch (e) { + // Continue even if error + } + } + // === WooCommerce add to cart (direct add-item URL) === if ( ( @@ -3031,21 +3050,14 @@ async function apbct_ready() { handler.catchWCRestRequestAsMiddleware(); if (+ctPublic.bot_detector_enabled) { - let botDetectorEventTokenStored = false; + let lastStoredBotDetectorEventToken = null; window.addEventListener('botDetectorEventTokenUpdated', (event) => { const botDetectorEventToken = event.detail?.eventToken; - if (botDetectorEventToken && !botDetectorEventTokenStored) { + if (botDetectorEventToken && botDetectorEventToken !== lastStoredBotDetectorEventToken) { ctSetCookie([ ['ct_bot_detector_event_token', botDetectorEventToken], ]); - botDetectorEventTokenStored = true; - // @ToDo remove this block afret force_alt_cookies removed - if (typeof ctPublic.force_alt_cookies !== 'undefined' && ctPublic.force_alt_cookies) { - ctSetAlternativeCookie( - JSON.stringify({'ct_bot_detector_event_token': botDetectorEventToken}), - {forceAltCookies: true}, - ); - } + lastStoredBotDetectorEventToken = botDetectorEventToken; } }); } diff --git a/js/src/public-2-force-protection.js b/js/src/public-2-force-protection.js index 13f4d31f7..4568cdb1b 100644 --- a/js/src/public-2-force-protection.js +++ b/js/src/public-2-force-protection.js @@ -22,7 +22,17 @@ class ApbctForceProtection { * @return {HTMLElement[]} */ findWrappers() { - return document.querySelectorAll('div.ct-encoded-form-wrapper'); + // Only wrappers generated by the plugin in this response have the token, + // wrappers planted in the content must not be decoded. + const token = ctPublic.force_protection_wrapper_token; + if (!token || typeof token !== 'string') { + return []; + } + + return Array.prototype.filter.call( + document.querySelectorAll('div.ct-encoded-form-wrapper'), + (wrapper) => wrapper.getAttribute('data-ct-wrapper-token') === token, + ); } /** @@ -115,7 +125,10 @@ class ApbctForceProtection { this.wrappers.forEach((wrapper) => { form = wrapper.querySelector('div.ct-encoded-form').dataset.encodedForm; if (form) { - wrapper.outerHTML = '
' + message + '
'; + const forbidden = document.createElement('div'); + forbidden.className = 'ct-encoded-form-forbidden'; + forbidden.textContent = message ? String(message) : ''; + wrapper.parentNode.replaceChild(forbidden, wrapper); } }); } diff --git a/lib/Cleantalk/Antispam/Cleantalk.php b/lib/Cleantalk/Antispam/Cleantalk.php index 097ca0f7c..a3ceaec2f 100644 --- a/lib/Cleantalk/Antispam/Cleantalk.php +++ b/lib/Cleantalk/Antispam/Cleantalk.php @@ -5,6 +5,7 @@ use Cleantalk\ApbctWP\Helper; use Cleantalk\ApbctWP\HTTP\Request; use Cleantalk\Common\DNS; +use Cleantalk\Common\TT; /** * Cleantalk base class @@ -50,6 +51,16 @@ class Cleantalk */ public $work_url; + /** + * IP of the node the work url is pinned to. + * + * The URL always carries the pool hostname, so it alone does not identify a node. + * This IP is what actually selects the server, via CURLOPT_RESOLVE. + * + * @var string|null + */ + public $work_ip; + /** * Work url ttl * @var int @@ -105,6 +116,14 @@ class Cleantalk */ private $downServers; + /** + * IPs already picked by the IP fallback during the current request cycle. + * The pool hostname is shared by every node, so only the IP identifies a server there. + * + * @var array + */ + private $down_ips = array(); + /** * Function checks whether it is possible to publish the message * @@ -247,9 +266,10 @@ private function compressData($data = null) public function httpRequest($msg) { $failed_urls = null; - // Using current server without changing it + // Using current server without changing it. + // work_ip pins the node the URL was resolved to last time, see selectModerateNode(). $result = ! empty($this->work_url) && $this->server_changed + 86400 > time() - ? $this->sendRequest($msg, $this->work_url, $this->server_timeout) + ? $this->sendRequest($msg, $this->work_url, $this->server_timeout, $this->work_ip ?: false) : false; // Changing server if no work_url or request has an error @@ -260,29 +280,35 @@ public function httpRequest($msg) // Getting type of error $type_error = $this->getTypeError($result); - $failed_urls = $this->work_url; + // The URL always carries the pool hostname, so the node that just failed + // is identified by its IP. Keep it out of the next rotation. + if ( ! empty($this->work_ip) && ! in_array($this->work_ip, $this->down_ips, true) ) { + $this->down_ips[] = $this->work_ip; + } + + $failed_urls = $this->describeWorkServer(); if ( ! empty($this->work_url) ) { $this->downServers[] = $this->work_url; } if ( ($type_error === 'getaddrinfo_error' || $type_error === 'connection_timeout') && $attempt === 1 ) { - $this->rotateModerateAndUseIP(); - //exit if next sendRequest failed, because change dns->ip is only way to fix errors above + $ip_to_resolve = $this->rotateModerateAndUseIP(); + // Exit if next sendRequest failed, because bypassing DNS is the last retry. $attempt = $attempt + 2; } else { - $this->rotateModerate(); + $ip_to_resolve = $this->rotateModerate(); //try change server again if next sendRequest failed $attempt = $attempt + 1; } - $result = $this->sendRequest($msg, $this->work_url, $this->server_timeout); + $result = $this->sendRequest($msg, $this->work_url, $this->server_timeout, $ip_to_resolve); /** @psalm-suppress PossiblyInvalidPropertyFetch */ if ( $result !== false && $result->errno === 0 ) { $this->server_change = true; break; } - $failed_urls .= ', ' . $this->work_url; + $failed_urls .= ', ' . $this->describeWorkServer(); } /** @psalm-suppress PossiblyInvalidArgument */ $response = new CleantalkResponse($result, $failed_urls); @@ -303,9 +329,19 @@ public function httpRequest($msg) } /** - * * @todo Refactor / fix logic errors + * Selects the next moderate node that has not failed yet in the current cycle. + * + * The URL always keeps the pool hostname from server_url. It is the only name + * known to match the API certificate, and deriving it from DNS (a PTR record) + * would let a poisoned resolver choose the very name TLS is validated against. + * The node is selected by IP instead and has to be pinned with CURLOPT_RESOLVE. + * + * getServersIp() returns the candidates sorted by ping, so the first usable + * entry is the closest responding node. + * + * @return string|false Selected node IP, false when no candidate is left. */ - public function rotateModerate() + private function selectModerateNode() { // Split server url to parts preg_match("/^(https?:\/\/)([^\/:]+)(.*)/i", $this->server_url, $matches); @@ -317,68 +353,71 @@ public function rotateModerate() $servers = $this->getServersIp($url_host); if ( ! $servers ) { - return; + return false; } // Loop until find work server foreach ( $servers as $server ) { - $dns = Helper::ipResolve($server['ip']); - if ( ! $dns ) { - continue; - } + $ip = TT::getArrayValueAsString($server, 'ip'); - $this->work_url = $url_protocol . $dns . $url_suffix; - - // Do not checking previous down server - if ( ! empty($this->downServers) && in_array($this->work_url, $this->downServers) ) { + // The pool hostname is shared by every node, so only the IP identifies one. + // Skipping by URL here would discard all of the candidates at once. + if ( empty($ip) || in_array($ip, $this->down_ips, true) ) { continue; } - $this->server_ttl = $server['ttl']; + $this->work_url = $url_protocol . $url_host . $url_suffix; + $this->work_ip = $ip; + $this->down_ips[] = $ip; + $this->server_ttl = TT::getArrayValueAsInt($server, 'ttl'); $this->server_change = true; - break; + + return $ip; } + + return false; } /** - * * @todo Refactor / fix logic errors + * Renders the current server for connection reports. + * + * Every node now shares the pool hostname, so the URL alone no longer tells + * which server was contacted. The pinned IP is appended to keep the report + * able to answer that. + * + * @return string */ - public function rotateModerateAndUseIP() + private function describeWorkServer() { - // Split server url to parts - global $apbct; - preg_match("/^(https?:\/\/)([^\/:]+)(.*)/i", $this->server_url, $matches); - - $url_protocol = isset($matches[1]) ? $matches[1] : ''; - $url_host = isset($matches[2]) ? $matches[2] : ''; - $url_suffix = isset($matches[3]) ? $matches[3] : ''; - - $servers = $this->getServersIp($url_host); - - if ( ! $servers ) { - return; + if ( empty($this->work_url) ) { + return ''; } - $apbct->settings['wp__use_builtin_http_api'] = false; - - // Loop until find work server - foreach ( $servers as $server ) { - $dns = Helper::ipResolve($server['ip']); - if ( ! $dns ) { - continue; - } - - $this->work_url = $url_protocol . $server['ip'] . $url_suffix; + return empty($this->work_ip) + ? $this->work_url + : $this->work_url . ' (' . $this->work_ip . ')'; + } - // Do not checking previous down server - if ( ! empty($this->downServers) && in_array($this->work_url, $this->downServers) ) { - continue; - } + /** + * Rotates to the closest responding moderate node. + * + * @return string|false Selected node IP, false when no candidate is left. + */ + public function rotateModerate() + { + return $this->selectModerateNode(); + } - $this->server_ttl = $server['ttl']; - $this->server_change = true; - break; - } + /** + * Rotates to the closest responding moderate node when DNS for the pool + * hostname is unusable. Identical to rotateModerate(), kept as a separate + * entry point because the caller treats this as the last retry. + * + * @return string|false Selected node IP, false when no candidate is left. + */ + public function rotateModerateAndUseIP() + { + return $this->selectModerateNode(); } /** @@ -510,11 +549,12 @@ public function httpPing($host) * @param string|array $data * @param string $url * @param int $server_timeout + * @param string|false $ip_to_resolve IP address to use for the URL hostname without changing the URL. * * @return boolean|CleantalkResponse * @throws \Exception */ - private function sendRequest($data, $url, $server_timeout = 3) + private function sendRequest($data, $url, $server_timeout = 3, $ip_to_resolve = false) { //Cleaning from 'null' values $tmp_data = array(); @@ -552,12 +592,28 @@ private function sendRequest($data, $url, $server_timeout = 3) ? $url . '/' . $this->method_uri : $url; + $options = array('timeout' => $server_timeout); + $connection_resolve_string = $ip_to_resolve + ? $this->maybeResolveIPInsteadOfHost($url, $ip_to_resolve) + : false; + + if ($connection_resolve_string && defined('CURLOPT_RESOLVE')) { + $options[CURLOPT_RESOLVE] = array($connection_resolve_string); + } + + // CURLOPT_RESOLVE is a cURL option, the WordPress HTTP API silently drops it. + // Without it the hostname would be resolved by DNS again and the node + // selection would be lost, so force the cURL transport for pinned requests. + $http_api_state = $this->disableBuiltInHttpApi(defined('CURLOPT_RESOLVE') && isset($options[CURLOPT_RESOLVE])); + $result = $http->setUrl($url) ->setData($data) ->setPresets($presets) - ->setOptions(['timeout' => $server_timeout]) + ->setOptions($options) ->request(); + $this->restoreBuiltInHttpApi($http_api_state); + $errstr = null; $response = is_string($result) ? json_decode($result) : false; if ( $result !== false && is_object($response) ) { @@ -583,6 +639,66 @@ private function sendRequest($data, $url, $server_timeout = 3) return $response; } + /** + * @param string $url + * @param string $ip_to_resolve + * @return false|string + */ + public function maybeResolveIPInsteadOfHost(string $url, string $ip_to_resolve) + { + if ( + filter_var($ip_to_resolve, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) + ) { + $url_parts = parse_url($url); + $host = TT::getArrayValueAsString($url_parts, 'host'); + $port = TT::getArrayValueAsInt($url_parts, 'port'); + $is_ssl = TT::getArrayValueAsString($url_parts, 'scheme') !== 'http'; + if (!empty($host)) { + // URL may omit the port, then it is defined by the scheme + $port = !empty($port) ? $port : ($is_ssl ? 443 : 80); + return $host . ':' . $port . ':' . $ip_to_resolve; + } + } + return false; + } + + /** + * Forces the cURL transport when a request has to be pinned to an IP. + * + * @param bool $needed + * + * @return bool|null Previous setting value, null when nothing was changed. + */ + private function disableBuiltInHttpApi($needed) + { + global $apbct; + + if ( ! $needed || ! isset($apbct->settings['wp__use_builtin_http_api']) ) { + return null; + } + + $previous = $apbct->settings['wp__use_builtin_http_api']; + $apbct->settings['wp__use_builtin_http_api'] = false; + + return $previous; + } + + /** + * @param bool|null $previous Value returned by disableBuiltInHttpApi(). + * + * @return void + */ + private function restoreBuiltInHttpApi($previous) + { + global $apbct; + + if ( $previous === null || ! isset($apbct->settings) ) { + return; + } + + $apbct->settings['wp__use_builtin_http_api'] = $previous; + } + /** * Call check_bot API method * diff --git a/lib/Cleantalk/Antispam/Integrations/LeakyPaywallRegister.php b/lib/Cleantalk/Antispam/Integrations/LeakyPaywallRegister.php new file mode 100644 index 000000000..6f01d4145 --- /dev/null +++ b/lib/Cleantalk/Antispam/Integrations/LeakyPaywallRegister.php @@ -0,0 +1,37 @@ + ' . __FUNCTION__ . '(leaky paywall registration integration):' . __LINE__, $_POST); + return null; + } + + $event_token = $argument['ct_bot_detector_event_token'] ?? null; + $email = $argument['email']; + + $dto = ct_gfa_dto($argument, $email); + $dto->register = true; + $data = $dto->getArray(); + $data['event_token'] = $event_token; + + return $data; + } + + /** + * @inheritDoc + */ + public function doBlock($message) + { + wp_die($message, '', ['response' => 403]); + } +} diff --git a/lib/Cleantalk/Antispam/Integrations/NinjaForms.php b/lib/Cleantalk/Antispam/Integrations/NinjaForms.php index 5c0fc0d4d..07781aede 100644 --- a/lib/Cleantalk/Antispam/Integrations/NinjaForms.php +++ b/lib/Cleantalk/Antispam/Integrations/NinjaForms.php @@ -7,6 +7,7 @@ use Cleantalk\ApbctWP\Escape; use Cleantalk\ApbctWP\GetFieldsAny; use Cleantalk\ApbctWP\Helper; +use Cleantalk\ApbctWP\Validate; use Cleantalk\ApbctWP\Variables\Get; use Cleantalk\ApbctWP\Variables\Post; use Cleantalk\Common\TT; @@ -171,10 +172,12 @@ public function doFinalActions($argument) return true; } - if (!empty($this->base_call_result)) { + $base_call_result = TT::toArray($this->base_call_result); + $ct_result = isset($base_call_result['ct_result']) ? $base_call_result['ct_result'] : null; + if (is_object($ct_result)) { // Change mail notification if license is out of date if ( $apbct->data['moderate'] == 0 && - ($this->base_call_result->fast_submit == 1 || $this->base_call_result->blacklisted == 1 || $this->base_call_result->js_disabled == 1) + ($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1) ) { $apbct->sender_email = $this->sender_email; $apbct->sender_ip = Helper::ipGet(); @@ -440,7 +443,9 @@ public static function hookChangeMailNotification($message, $_data, $action_sett { global $apbct; - if ( $action_settings['to'] !== $apbct->sender_email ) { + // Do not change the mail sent to the visitor + $to = isset($action_settings['to']) ? $action_settings['to'] : ''; + if ( ! Validate::isEmailInRecipients($to, (string)$apbct->sender_email) ) { $message .= wpautop( PHP_EOL . '---' . PHP_EOL @@ -451,7 +456,7 @@ public static function hookChangeMailNotification($message, $_data, $action_sett . PHP_EOL . __('If you want to be sure activate protection in your Anti-Spam Dashboard: ', 'clentalk') . //HANDLE LINK - 'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=ninjaform_activate_antispam' . $apbct->user_token + 'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=ninjaform_activate_antispam' ); } diff --git a/lib/Cleantalk/Antispam/IntegrationsByClass/Woocommerce.php b/lib/Cleantalk/Antispam/IntegrationsByClass/Woocommerce.php index f509dc662..b0e9d5338 100644 --- a/lib/Cleantalk/Antispam/IntegrationsByClass/Woocommerce.php +++ b/lib/Cleantalk/Antispam/IntegrationsByClass/Woocommerce.php @@ -1456,6 +1456,7 @@ public function ordersSendFeedback(array $spam_ids, $orders_status = '0') $config = ct_get_server(); $ct->server_url = APBCT_MODERATE_URL; $ct->work_url = isset($config['ct_work_url']) && preg_match('/http:\/\/.+/', $config['ct_work_url']) ? $config['ct_work_url'] : null; + $ct->work_ip = isset($config['ct_work_ip']) ? $config['ct_work_ip'] : null; $ct->server_ttl = isset($config['ct_server_ttl']) ? $config['ct_server_ttl'] : null; $ct->server_changed = isset($config['ct_server_changed']) ? $config['ct_server_changed'] : null; diff --git a/lib/Cleantalk/ApbctWP/Antispam/ForceProtection.php b/lib/Cleantalk/ApbctWP/Antispam/ForceProtection.php index 6520edf9f..715ef00d0 100644 --- a/lib/Cleantalk/ApbctWP/Antispam/ForceProtection.php +++ b/lib/Cleantalk/ApbctWP/Antispam/ForceProtection.php @@ -3,8 +3,10 @@ namespace Cleantalk\ApbctWP\Antispam; use Cleantalk\ApbctWP\BotDetectorService; +use Cleantalk\ApbctWP\ContactsEncoder\PlaceholderNonce; use Cleantalk\ApbctWP\Helper; use Cleantalk\ApbctWP\RequestParameters\RequestParameters; +use Cleantalk\ApbctWP\Variables\AltSessions; use Cleantalk\Variables\Post; use Cleantalk\Antispam\CleantalkRequest; use Cleantalk\Antispam\Cleantalk; @@ -15,6 +17,11 @@ class ForceProtection { use Singleton; + /** + * @var string Token of wrappers generated in the current response + */ + private $wrapper_token = ''; + /** * @return void */ @@ -88,6 +95,7 @@ public function checkBot() $config = ct_get_server(); $ct->server_url = APBCT_MODERATE_URL; $ct->work_url = isset($config['ct_work_url']) && preg_match('/https:\/\/.+/', $config['ct_work_url']) ? $config['ct_work_url'] : null; + $ct->work_ip = isset($config['ct_work_ip']) ? $config['ct_work_ip'] : null; $ct->server_ttl = isset($config['ct_server_ttl']) ? $config['ct_server_ttl'] : null; $ct->server_changed = isset($config['ct_server_changed']) ? $config['ct_server_changed'] : null; $api_response = $ct->checkBot($ct_request); @@ -102,7 +110,12 @@ public function checkBot() ), )); } - RequestParameters::set('apbct_force_protection_check', TT::toString($api_response->allow)); + $pass_token = '0'; + if ( (int)$api_response->allow === 1 ) { + $expires = time() + DAY_IN_SECONDS; + $pass_token = $expires . '.' . $this->getPassSignature($expires); + } + RequestParameters::set('apbct_force_protection_check', $pass_token); return json_encode(array( 'allow' => $api_response->allow, @@ -119,11 +132,15 @@ public function checkBot() */ private function checkIframeForms($content) { - $content = preg_replace_callback('#]*>.*?<\/iframe>#is', function ($matches) { + $is_passed = null; + $content = preg_replace_callback('#]*>.*?<\/iframe>#is', function ($matches) use (&$is_passed) { $iframe = isset($matches[0]) ? $matches[0] : ''; - if ( RequestParameters::get('apbct_force_protection_check') ) { + if ( $is_passed === null ) { + $is_passed = $this->hasValidPassToken(); + } + if ( $is_passed ) { return $iframe; } @@ -148,6 +165,42 @@ private function checkIframeForms($content) return $content; } + /** + * @return bool + */ + private function hasValidPassToken() + { + $token = RequestParameters::get('apbct_force_protection_check'); + if ( + ! is_string($token) || + ! preg_match('/^([0-9]{1,10})\.([a-f0-9]{64})$/D', $token, $parts) || + ! isset($parts[1], $parts[2]) + ) { + return false; + } + + $expires = (int)$parts[1]; + if ( $expires <= time() || $expires > time() + DAY_IN_SECONDS ) { + return false; + } + + return hash_equals($this->getPassSignature($expires), $parts[2]); + } + + /** + * Bind a successful challenge to this site, visitor and expiration time. + * + * @param int $expires + * @return string + */ + private function getPassSignature($expires) + { + $data = 'apbct_force_protection_check|' + . get_home_url() . '|' . AltSessions::getID() . '|' . $expires; + + return hash_hmac('sha256', $data, wp_salt('auth')); + } + /** * Check external forms. * @@ -293,11 +346,36 @@ private function getFormAction($form) private function generateWrapper($form) { $encoded_form = urlencode(base64_encode($form)); - $wrapper = '
' + $wrapper = '
' . '
' . '
' . '
'; return $wrapper; } + + /** + * Whether force protection was started for the current request (valid key, frontend). + * + * @return bool + */ + public static function isInitialized() + { + return isset(static::$instance[static::class]); + } + + /** + * Random token of the current response. JS decodes only wrappers with this token, + * so a wrapper planted in post content is never decoded. + * + * @return string + */ + public function getWrapperToken() + { + if ($this->wrapper_token === '') { + $this->wrapper_token = PlaceholderNonce::generate(); + } + + return $this->wrapper_token; + } } diff --git a/lib/Cleantalk/ApbctWP/BotDetectorService.php b/lib/Cleantalk/ApbctWP/BotDetectorService.php index a8bc2ccca..2852e1202 100644 --- a/lib/Cleantalk/ApbctWP/BotDetectorService.php +++ b/lib/Cleantalk/ApbctWP/BotDetectorService.php @@ -10,6 +10,11 @@ class BotDetectorService { + /** + * @var array|null POST sources captured once per request. + */ + private static $captured_sources = null; + private static $default_browser_state = array( 'frontend_data_log' => [], 'botd_logic_loaded' => 0, @@ -150,7 +155,53 @@ public static function isNoScripFlow() } /** - * Return bot detector frontend data log from Alt Sessions if data found. + * Capture POST browser state before form processing and remove its fields. + * + * @return void + */ + public static function extractBrowserStateFromPOST() + { + if ( self::$captured_sources === null ) { + $post_browser_state = Post::getString('apbct_browser_state'); + $post_data = Post::getArray('data'); + self::$captured_sources = array( + 'post_browser_state' => $post_browser_state, + 'post_data' => isset($post_data['apbct_browser_state']) + ? array('apbct_browser_state' => $post_data['apbct_browser_state']) + : array(), + ); + } + + unset($_POST['apbct_browser_state']); + if ( isset($_POST['data']) && is_array($_POST['data']) ) { + unset($_POST['data']['apbct_browser_state']); + } + + // Post keeps its own cached copy of each field. + $post = Post::getInstance(); + unset($post->variables['apbct_browser_state']); + if ( isset($post->variables['data']) && is_array($post->variables['data']) ) { + unset($post->variables['data']['apbct_browser_state']); + } + } + + /** + * Combine current request parameters with the POST sources captured at plugins_loaded. + * Read request parameters late because NoCookie data is populated during form processing. + * + * @return array + */ + private static function getBrowserStateSources() + { + return array( + 'request_parameters' => RequestParameters::get('apbct_browser_state'), + 'post_browser_state' => self::$captured_sources['post_browser_state'] ?? '', + 'post_data' => self::$captured_sources['post_data'] ?? array(), + ); + } + + /** + * Return bot detector frontend data log from request parameters or captured POST sources. * Format: JSON. * * @return string JSON encoded bot detector frontend data log. @@ -173,13 +224,7 @@ public static function getFrontendDataLog() throw new \Exception('bot detector library usage is disabled'); } - $sources = array( - 'request_parameters' => RequestParameters::get('apbct_browser_state'), // NoCookie hidden field or alternative sessions are both covered by RequestParameters - 'post_browser_state' => Post::getString('apbct_browser_state'), // XHR interception transport - look at the POST directly - 'post_data' => Post::getArray('data'), //XHR interception transport - the state could be wrapped to the data[] array - ); - - $browser_state = self::getBrowserState($sources); + $browser_state = self::getBrowserState(self::getBrowserStateSources()); if ( empty($browser_state) ) { throw new \Exception('no browser state provided by the transport'); @@ -208,27 +253,22 @@ public static function getFrontendDataLog() * * The state comes with the transport the site is currently configured to use: * NoCookie hidden field or alternative sessions are both covered by RequestParameters, - * the XHR interception passes the state as a plain POST field. + * the XHR interception passes the state through POST fields captured at plugins_loaded. * Native cookies do not store the state in cookies (cookie size limits) * + * Prefer captured top-level POST, then nested POST, then request parameters. + * POST captures reflect the submitted form; request parameters may contain an earlier snapshot. + * * @return array Empty array if no state provided. */ public static function getBrowserState(array $sources = array()) { - $raw_state = null; $log_source = 'unknown'; - if (!empty($sources['request_parameters'])) { - $raw_state = $sources['request_parameters']; - $log_source = 'request_parameters'; - } - - // XHR interception transport - look at the POST directly - if ( empty($raw_state) ) { - $raw_state = $sources['post_browser_state'] ?? null; - if ($raw_state) { - $log_source = 'post_browser_state'; - } + // XHR interception transport - use the captured POST field + $raw_state = $sources['post_browser_state'] ?? null; + if ($raw_state) { + $log_source = 'post_browser_state'; } // XHR interception transport - the state could be wrapped to the data[] array @@ -240,6 +280,11 @@ public static function getBrowserState(array $sources = array()) } } + if ( empty($raw_state) && ! empty($sources['request_parameters']) ) { + $raw_state = $sources['request_parameters']; + $log_source = 'request_parameters'; + } + if ( empty($raw_state) ) { return array(); } diff --git a/lib/Cleantalk/ApbctWP/ConnectionReports.php b/lib/Cleantalk/ApbctWP/ConnectionReports.php index e53011daf..42774401b 100644 --- a/lib/Cleantalk/ApbctWP/ConnectionReports.php +++ b/lib/Cleantalk/ApbctWP/ConnectionReports.php @@ -266,12 +266,20 @@ private function addReportToDb( $request_content = array(), $post_blocked_via_js_check = false ) { + $auth_key = $request_content['auth_key'] ?? ''; + unset($request_content['auth_key']); + $request_content = json_encode(esc_sql($request_content)); + if ($auth_key !== '') { + // The same key can also occur in nested JSON strings such as sender_info.ct_options. + $request_content = str_replace($auth_key, '[************]', $request_content); + } + $cr_data = array( 'date' => time(), 'page_url' => get_site_url() . TT::toString(Server::get('REQUEST_URI')), 'lib_report' => $lib_report, 'failed_work_urls' => $failed_work_urls, - 'request_content' => json_encode(esc_sql($request_content)), + 'request_content' => $request_content, 'js_block' => $post_blocked_via_js_check ? '1' : '0' ); diff --git a/lib/Cleantalk/ApbctWP/Constant.php b/lib/Cleantalk/ApbctWP/Constant.php index 6fb93df9f..aeca3fecf 100644 --- a/lib/Cleantalk/ApbctWP/Constant.php +++ b/lib/Cleantalk/ApbctWP/Constant.php @@ -18,12 +18,20 @@ class Constant { /** - * If set, do not skip POST data from check if no email address found. + * Disable the exception that skips POST data checks when no email address is found. + * Defining either true or false activates this behavior. The "Check all POST data" + * setting takes precedence. Without this constant, normal exception handling applies. + * + * @var bool */ const APBCT_SERVICE__DISABLE_EMPTY_EMAIL_EXCEPTION = 'APBCT_SERVICE__DISABLE_EMPTY_EMAIL_EXCEPTION'; /** - * Pass anti-crawler check on RSS feed service. + * Skip Anti-Crawler checks for requests whose URI contains "feed". + * Defining either true or false enables this additional RSS exception. + * Without this constant, the normal Anti-Crawler exclusions apply. + * + * @var bool */ const APBCT_SERVICE__SKIP_ANTICRAWLER_ON_RSS_FEED = 'APBCT_SERVICE__SKIP_ANTICRAWLER_ON_RSS_FEED'; @@ -34,7 +42,10 @@ class Constant const APBCT_ANTICRAWLER_EXLC_FEED = 'APBCT_SERVICE__SKIP_ANTICRAWLER_ON_RSS_FEED'; /** - * Provides AJAX route type. Expected values: 'rest', 'admin_ajax'. + * Force the AJAX route to 'rest' or 'admin_ajax'. + * Other strings leave automatic route selection unchanged. + * + * @var string */ const APBCT_SERVICE__SET_AJAX_ROUTE_TYPE = 'APBCT_SERVICE__SET_AJAX_ROUTE_TYPE'; @@ -45,7 +56,12 @@ class Constant const APBCT_SET_AJAX_ROUTE_TYPE = 'APBCT_SERVICE__SET_AJAX_ROUTE_TYPE'; /** - * Provides user own access key. + * Supply a site-owned access key and override the key field in the settings. + * Any string is accepted by the registry, including an empty string; use a valid key. + * Its presence also affects database-prefix selection. The network updater still + * reads only the deprecated CLEANTALK_ACCESS_KEY name directly. + * + * @var string */ const APBCT_SERVICE__SELF_OWNED_ACCESS_KEY = 'APBCT_SERVICE__SELF_OWNED_ACCESS_KEY'; @@ -56,12 +72,18 @@ class Constant const CLEANTALK_ACCESS_KEY = 'APBCT_SERVICE__SELF_OWNED_ACCESS_KEY'; /** - * Allows to set Bot-Detector enabled/disabled. + * Force Bot Detector on with true or off with false. + * Without this constant, the saved Bot Detector settings apply. + * + * @var bool */ const APBCT_SERVICE__BOT_DETECTOR_ENABLED = 'APBCT_SERVICE__BOT_DETECTOR_ENABLED'; /** - * If isset, any public scripts will be placed in a page footer. + * Place public JavaScript files in the page footer when the value is true. + * False or an absent constant leaves normal script placement unchanged. + * + * @var bool */ const APBCT_SERVICE__PLACE_PUBLIC_JS_SCRIPTS_IN_FOOTER = 'APBCT_SERVICE__PLACE_PUBLIC_JS_SCRIPTS_IN_FOOTER'; @@ -72,7 +94,10 @@ class Constant const CLEANTALK_PLACE_PUBLIC_JS_SCRIPTS_IN_FOOTER = 'APBCT_SERVICE__PLACE_PUBLIC_JS_SCRIPTS_IN_FOOTER'; /** - * Provides whitelabel-mode FAQ link. + * Override the white-label FAQ link with a string, sanitized using esc_url. + * Without this constant, the existing FAQ link is retained. + * + * @var string */ const APBCT_SERVICE__WHITELABEL_FAQ_LINK = 'APBCT_SERVICE__WHITELABEL_FAQ_LINK'; @@ -83,7 +108,10 @@ class Constant const APBCT_WHITELABEL_FAQ_LINK = 'APBCT_SERVICE__WHITELABEL_FAQ_LINK'; /** - * Provides whitelabel-mode plugin description. + * Override the white-label plugin description with a string, escaped using esc_html. + * Without this constant, the existing description is retained. + * + * @var string */ const APBCT_SERVICE__WHITELABEL_PLUGIN_DESCRIPTION = 'APBCT_SERVICE__WHITELABEL_PLUGIN_DESCRIPTION'; @@ -94,7 +122,12 @@ class Constant const APBCT_WHITELABEL_PLUGIN_DESCRIPTION = 'APBCT_SERVICE__WHITELABEL_PLUGIN_DESCRIPTION'; /** - * If defined, plugin will be in whitelabel mode. + * Register the white-label mode switch. + * The network updater currently reads only APBCT_WHITELABEL directly: + * true enables the mode and false disables it. Defining the current name alone + * does not activate that legacy code path. + * + * @var bool */ const APBCT_SERVICE__WHITELABEL_ENABLED = 'APBCT_SERVICE__WHITELABEL_ENABLED'; @@ -105,7 +138,12 @@ class Constant const APBCT_WHITELABEL = 'APBCT_SERVICE__WHITELABEL_ENABLED'; /** - * Provides product name for whitelabel mode. + * Register a custom white-label product name. + * The network updater currently reads only APBCT_WHITELABEL_NAME directly, + * when APBCT_WHITELABEL is defined. The current name alone does not change + * the product name in that legacy code path. + * + * @var string */ const APBCT_SERVICE__WHITELABEL_PRODUCT_NAME = 'APBCT_SERVICE__WHITELABEL_PRODUCT_NAME'; @@ -116,7 +154,11 @@ class Constant const APBCT_WHITELABEL_NAME = 'APBCT_SERVICE__WHITELABEL_PRODUCT_NAME'; /** - * If defined, SFW update mode is always DIRECT. Helpful if update queue fails due remote calls. + * Force direct SFW updates instead of the update queue. + * Defining either true or false activates this behavior. + * Useful when remote calls fail; remove the definition to restore automatic selection. + * + * @var bool */ const APBCT_SERVICE__SFW_FORCE_DIRECT_UPDATE = 'APBCT_SERVICE__SFW_FORCE_DIRECT_UPDATE'; @@ -127,7 +169,10 @@ class Constant const APBCT_SFW_FORCE_DIRECT_UPDATE = 'APBCT_SERVICE__SFW_FORCE_DIRECT_UPDATE'; /** - * If defined, no title will be provided for blocking page. + * Hide the CleanTalk title on blocking pages and rejected-comment messages with true. + * False or an absent constant preserves the title. + * + * @var bool */ const APBCT_SERVICE__DISABLE_BLOCKING_TITLE = 'APBCT_SERVICE__DISABLE_BLOCKING_TITLE'; @@ -138,7 +183,11 @@ class Constant const CLEANTALK_DISABLE_BLOCKING_TITLE = 'APBCT_SERVICE__DISABLE_BLOCKING_TITLE'; /** - * Redefine how many comments should be approved before skip checking. + * Set the approved-comment count required to skip checking an author's comments, + * when the corresponding comment-checking setting is enabled. + * The default is 3. The registry checks the integer type but not its range. + * + * @var int */ const APBCT_SERVICE__SKIP_ON_APPROVED_COMMENTS_NUMBER = 'APBCT_SERVICE__SKIP_ON_APPROVED_COMMENTS_NUMBER'; @@ -149,7 +198,11 @@ class Constant const CLEANTALK_CHECK_COMMENTS_NUMBER = 'APBCT_SERVICE__SKIP_ON_APPROVED_COMMENTS_NUMBER'; /** - * If defined, no frontend-data logs will be collected. Debugging case usage. + * Disable frontend-data log collection for debugging. + * Defining either true or false disables collection and sets the frontend log flag to 0. + * Without this constant, normal log collection applies. + * + * @var bool */ const APBCT_SERVICE__DO_NOT_COLLECT_FRONTEND_DATA_LOGS = 'APBCT_SERVICE__DO_NOT_COLLECT_FRONTEND_DATA_LOGS'; @@ -160,7 +213,13 @@ class Constant const APBCT_DO_NOT_COLLECT_FRONTEND_DATA_LOGS = 'APBCT_SERVICE__DO_NOT_COLLECT_FRONTEND_DATA_LOGS'; /** - * Provides own URL of API server. + * Register a custom CleanTalk server domain. + * Bootstrap currently reads only CLEANTALK_SERVER directly, building + * https://moderate. and, unless CLEANTALK_API_URL is already defined, + * https://api.. Use a domain, not a complete URL. + * Defining the current name alone does not change those endpoints. + * + * @var string */ const APBCT_SERVICE__PREDEFINED_CLEANTALK_SERVER_URL = 'APBCT_SERVICE__PREDEFINED_CLEANTALK_SERVER_URL'; @@ -171,7 +230,10 @@ class Constant const CLEANTALK_SERVER = 'APBCT_SERVICE__PREDEFINED_CLEANTALK_SERVER_URL'; /** - * If defined, integration metrics will be disabled. + * Disable integration metrics when defined as either true or false. + * Remove the definition to allow normal metric collection. + * + * @var bool */ const APBCT_SERVICE__DISABLE_INTEGRATION_METRICS = 'APBCT_SERVICE__DISABLE_INTEGRATION_METRICS'; /** diff --git a/lib/Cleantalk/ApbctWP/ContactsEncoder/ContactsEncoder.php b/lib/Cleantalk/ApbctWP/ContactsEncoder/ContactsEncoder.php index d7211516d..3594aa7a4 100644 --- a/lib/Cleantalk/ApbctWP/ContactsEncoder/ContactsEncoder.php +++ b/lib/Cleantalk/ApbctWP/ContactsEncoder/ContactsEncoder.php @@ -46,9 +46,15 @@ class ContactsEncoder extends \Cleantalk\Common\ContactsEncoder\ContactsEncoder */ private $comment; + /** + * @var Params + */ + private $params; + public function init($params) { parent::init($params); + $this->params = $params; $this->exclusions = new ExclusionsService($params); $this->shortcodes = new ShortCodesService($params); $this->grid_builder_integration = new CEIntegrationGridBuilder(); @@ -56,6 +62,25 @@ public function init($params) $this->shortcodes->registerAll(); $this->registerHookHandler(); + + // The instance is created on plugin load, before WordPress authenticates the visitor. + add_action('set_current_user', array($this, 'syncLoggedInState')); + } + + /** + * @return void + */ + public function syncLoggedInState() + { + $is_logged_in = apbct_is_user_logged_in(); + if ( $is_logged_in === $this->is_logged_in ) { + return; + } + + // Params are shared with the exclusion services. + $this->params->is_logged_in = $is_logged_in; + $this->is_logged_in = $is_logged_in; + $this->encoder->useSSL(! $is_logged_in); } /** @@ -150,13 +175,37 @@ public function runEncoding($content = '') public function modifyFormFieldDisplay($html, $field, $display_context, $post_id) { if (mb_stripos($html, 'mailto:') !== false) { - $html = html_entity_decode($html); + $html = self::decodeEmailEntities($html); return $this->modifyContent($html); } return $html; } + /** + * Business Directory obfuscates emails with numeric HTML entities. + * Decode only entities of characters allowed in email, other entities stay escaped. + * + * @param string $html + * @return string + */ + public static function decodeEmailEntities($html) + { + return (string)preg_replace_callback( + '/&#(?:0*([0-9]{1,3})|[xX]0*([0-9a-fA-F]{1,2}));/', + function ($matches) { + $decimal = TT::getArrayValueAsString($matches, 1); + $code = $decimal !== '' + ? (int)$decimal + : (int)hexdec(TT::getArrayValueAsString($matches, 2)); + return $code < 128 && preg_match('/^[a-z0-9._%+@-]$/i', chr($code)) + ? chr($code) + : TT::getArrayValueAsString($matches, 0); + }, + $html + ); + } + /** * Skip email encoding inside
'; - $column_content .= '

' . $item['ct_comment']->comment_content . '

'; + $column_content .= '

' . Escape::escKsesPost($item['ct_comment']->comment_content) . '

'; $column_content .= '
'; diff --git a/lib/Cleantalk/ApbctWP/Firewall/AntiFlood.php b/lib/Cleantalk/ApbctWP/Firewall/AntiFlood.php index b05e4cfe3..308c47a94 100644 --- a/lib/Cleantalk/ApbctWP/Firewall/AntiFlood.php +++ b/lib/Cleantalk/ApbctWP/Firewall/AntiFlood.php @@ -16,12 +16,13 @@ */ class AntiFlood extends \Cleantalk\Common\Firewall\FirewallModule { + const PASS_TOKEN_TTL = 60; + public $module_name = 'ANTIFLOOD'; private $db__table__ac_logs; private $db__table__ac_ua_bl; - private $api_key = ''; private $view_limit = 20; private $apbct = array(); private $store_interval = 60; @@ -112,13 +113,14 @@ public function check() } // Passed - if (Cookie::get('apbct_antiflood_passed') === md5($current_ip . $this->api_key)) { + if ($this->consumePassToken(Cookie::get('apbct_antiflood_passed'), $current_ip)) { if ( ! headers_sent()) { Cookie::set('apbct_antiflood_passed', '0', time() - 86400, '/', '', null, true); } // Do logging an one passed request $this->updateLog($current_ip, 'PASS_ANTIFLOOD'); + $this->updateAcLog(); $results[] = array('ip' => $current_ip, 'is_personal' => false, 'status' => 'PASS_ANTIFLOOD',); @@ -229,6 +231,7 @@ public function diePage($result) // File exists? if (file_exists(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/ApbctWP/Firewall/die_page_antiflood.html')) { + $pass_token = $this->createPassToken($result['ip']); $this->sfw_die_page = file_get_contents( CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/ApbctWP/Firewall/die_page_antiflood.html' ); @@ -269,7 +272,7 @@ public function diePage($result) '{SERVICE_ID}' => esc_html($this->apbct->data['service_id']) . ', ' . esc_html($net_count), '{HOST}' => get_home_url() . ', ' . APBCT_VERSION, '{GENERATED}' => '

The page was generated at ' . date('D, d M Y H:i:s') . "

", - '{COOKIE_ANTIFLOOD_PASSED}' => md5($result['ip'] . $this->api_key), + '{COOKIE_ANTIFLOOD_PASSED}' => $pass_token, '{SCRIPT_URL}' => esc_url($js_url), // Custom Logo @@ -332,6 +335,65 @@ public function printDiePage() die("IP BLACKLISTED. Blocked by AntiFlood " . $this->apbct->stats['last_sfw_block']['ip']); } + /** + * Issue a short-lived pass token and persist it for a single atomic use. + * + * @param string $ip + * @return string + */ + private function createPassToken($ip) + { + if (function_exists('random_bytes')) { + $token = bin2hex(random_bytes(32)); + } else { + $token = hash('sha256', wp_generate_password(64, false, false)); + } + + $token_id = md5('antiflood_pass:' . $token); + $expires = time() + self::PASS_TOKEN_TTL; + $query = "INSERT INTO " . $this->db__table__ac_logs . " + SET id = %s, ip = %s, entries = 0, interval_start = %d, ua = ''"; + + $this->db->prepare($query, array($token_id, $ip, $expires)); + $result = $this->db->execute($this->db->getQuery()); + + if ( ! is_int($result) || $result < 1) { + error_log('CleanTalk AntiFlood: failed to store a one-time pass token.'); + return ''; + } + + return $token; + } + + /** + * Atomically consume a pass token bound to the issuing IP. + * + * @param mixed $token + * @param string $ip + * @return bool + */ + private function consumePassToken($token, $ip) + { + if ( ! is_string($token) || ! preg_match('/^[a-f0-9]{64}$/i', $token)) { + return false; + } + + $token_id = md5('antiflood_pass:' . strtolower($token)); + $query = "DELETE FROM " . $this->db__table__ac_logs . " + WHERE id = %s AND ip = %s AND interval_start > %d AND entries = 0 + LIMIT 1"; + + $this->db->prepare($query, array($token_id, $ip, time())); + $result = $this->db->execute($this->db->getQuery()); + + if ($result === false) { + error_log('CleanTalk AntiFlood: failed to consume a one-time pass token.'); + return false; + } + + return $result === 1; + } + private function checkExclusions() { $allowed_roles = array('administrator', 'editor'); diff --git a/lib/Cleantalk/ApbctWP/Firewall/FirewallBypass.php b/lib/Cleantalk/ApbctWP/Firewall/FirewallBypass.php index 9c1173e3b..1a550f16c 100644 --- a/lib/Cleantalk/ApbctWP/Firewall/FirewallBypass.php +++ b/lib/Cleantalk/ApbctWP/Firewall/FirewallBypass.php @@ -3,7 +3,9 @@ namespace Cleantalk\ApbctWP\Firewall; use Cleantalk\ApbctWP\Escape; +use Cleantalk\ApbctWP\Helper; use Cleantalk\ApbctWP\Variables\Cookie; +use Cleantalk\ApbctWP\Variables\Post; use Cleantalk\ApbctWP\Variables\Request; use Cleantalk\Common\TT; @@ -17,6 +19,10 @@ * issued to the browser as an HttpOnly cookie, while only its SHA-256 hash is kept on the server. * 3. Every following request is matched by the cookie secret. The firewall is skipped on match. * + * Alternative entry point instead of steps 1-2: the control panel posts a signed token (JWT HS256) + * to admin-post.php with the `ct_fw_bypass` action. The token is signed with the access key and bound + * to the site, the visitor IP and a short lifetime. A valid token grants the same cookie secret as the link. + * * The bypass is bound to a secret known only to the browser that opened the link. * It is intentionally NOT bound to IP/User-Agent because both of them are spoofable. */ @@ -64,6 +70,47 @@ class FirewallBypass */ private const USER_COOKIE_NAME = self::PLUGIN_PREFIX . 'fw_bypass'; + /** + * The admin-post.php action the control panel posts the signed token to. Shared by both plugins. + */ + public const JWT_ACTION = 'ct_fw_bypass'; + + /** + * POST parameter carrying the signed token. + */ + private const JWT_REQUEST_PARAM = 'ct_fw_bypass_jwt'; + + /** + * Service the token must be issued for to be processed by this plugin. + */ + private const JWT_SERVICE = 'antispam'; + + /** + * Services of both plugins. A token for the other one is left to its own handler. + */ + private const JWT_KNOWN_SERVICES = array('antispam', 'security'); + + /** + * Longer values are rejected before any decoding. + */ + private const JWT_MAX_LENGTH = 2048; + + /** + * Maximal lifetime of the token in seconds. + */ + private const JWT_LIFETIME = 300; + + /** + * Allowed clock difference between the control panel and the site in seconds. + */ + private const JWT_CLOCK_SKEW = 60; + + /** + * Prefix of the options claiming the used token IDs (jti). Makes every token single use. + * The value is the timestamp the claim may be dropped after. + */ + private const JWT_USED_ID_OPTION_PREFIX = self::PLUGIN_PREFIX . 'fw_bypass_jti_'; + /** * Entry point of the `send_fw_bypass_email` remote call. * @@ -169,6 +216,323 @@ public static function maybeSetUserToken() } } + /** + * Handler of the `admin_post(_nopriv)_ct_fw_bypass` actions: the control panel posts the signed token here. + * + * @return void + */ + public static function handleJwtRequest() + { + $redirect_url = self::processJwtRequest(); + + // The token is issued for the other plugin, its handler is next on the same action. + if ( $redirect_url === null ) { + return; + } + + // 303 makes the browser follow with GET, so a page reload does not resubmit the form. + wp_safe_redirect($redirect_url, 303); + exit; + } + + /** + * Validates the signed token from the request and grants the bypass to the current browser on success. + * + * @return string|null URL to send the browser to: the admin area on success, the home page on failure. + * Null when the token is issued for the other plugin. + */ + public static function processJwtRequest() + { + global $apbct; + + self::$last_error = null; + $failure_url = home_url('/'); + + try { + $jwt = Post::getString(self::JWT_REQUEST_PARAM); + if ( $jwt === '' || strlen($jwt) > self::JWT_MAX_LENGTH ) { + throw new \Exception('The token is missing or too long.'); + } + + $segments = explode('.', $jwt); + if ( count($segments) !== 3 ) { + throw new \Exception('The token is malformed.'); + } + list($header_segment, $payload_segment, $signature_segment) = $segments; + + $payload = self::decodeJwtSegment($payload_segment); + if ( + ! is_array($payload) || + ! isset($payload['svc']) || + ! in_array($payload['svc'], self::JWT_KNOWN_SERVICES, true) + ) { + throw new \Exception('The token service is unknown.'); + } + + // Routing only, nothing is granted before the signature is verified below. + // Checking the signature first would reject the other plugin's token, it is signed with another key. + if ( $payload['svc'] !== self::JWT_SERVICE ) { + return null; + } + + $key = TT::toString($apbct->api_key); + self::verifyJwtSignature($header_segment, $payload_segment, $signature_segment, $key); + $claims = self::validateJwtPayload($payload); + + // Burn the token before the bypass is granted, so a parallel request can not reuse it. + self::claimJwtId($claims['jti'], $claims['exp']); + + $user_secret = self::generateToken(); + if ( ! is_string($user_secret) ) { + throw new \Exception('Failed to generate bypass user secret.'); + } + + self::setUserToken($user_secret); + + // The secret is stored and visible to the current request, otherwise the admin area stays blocked. + if ( ! self::bypassByUserToken() ) { + return $failure_url; + } + + return admin_url(); + } catch (\Exception $e) { + self::$last_error = $e->getMessage(); + return $failure_url; + } + } + + /** + * Checks the token header and the HMAC-SHA256 signature. + * + * @param string $header_segment + * @param string $payload_segment + * @param string $signature_segment + * @param string $key Access key the token is signed with. + * + * @return void + * @throws \Exception + */ + private static function verifyJwtSignature($header_segment, $payload_segment, $signature_segment, $key) + { + if ( $key === '' ) { + throw new \Exception('The access key is not set.'); + } + + // Strict header: any other algorithm, including "none", is rejected. + $header = self::decodeJwtSegment($header_segment); + if ( ! isset($header['alg'], $header['typ']) || $header['alg'] !== 'HS256' || $header['typ'] !== 'JWT' ) { + throw new \Exception('The token header is not supported.'); + } + + $expected_signature = self::encodeJwtSegment( + hash_hmac('sha256', $header_segment . '.' . $payload_segment, $key, true) + ); + + // Constant time comparison to exclude any timing side channel. + if ( ! hash_equals($expected_signature, $signature_segment) ) { + throw new \Exception('The token signature is invalid.'); + } + } + + /** + * Checks the claims of the token with the verified signature. + * + * @param array $payload + * + * @return array{jti: string, exp: int} The claims needed to burn the token. + * @throws \Exception + */ + private static function validateJwtPayload($payload) + { + $now = time(); + $expiration = isset($payload['exp']) && is_int($payload['exp']) ? $payload['exp'] : 0; + if ( + $expiration < $now - self::JWT_CLOCK_SKEW || + // There is no issue time in the token, so the lifetime is limited by the expiration itself. + $expiration > $now + self::JWT_LIFETIME + self::JWT_CLOCK_SKEW + ) { + throw new \Exception('The token is expired or its lifetime is too long.'); + } + + // One key may serve several sites, the token must not work on another one. + $site_audience = self::getSiteJwtAudience(); + if ( + ! isset($payload['aud']) || + ! is_string($payload['aud']) || + $site_audience === '' || + self::normalizeJwtAudience($payload['aud']) !== $site_audience + ) { + throw new \Exception('The token is issued for another site.'); + } + + // The same IP the firewall checks. + $request_ip = self::canonicalizeJwtIp(TT::toString(Helper::ipGet('real', false))); + if ( + ! isset($payload['ip']) || + ! is_string($payload['ip']) || + $request_ip === '' || + self::canonicalizeJwtIp($payload['ip']) !== $request_ip + ) { + throw new \Exception('The token is issued for another IP.'); + } + + $jti = isset($payload['jti']) && is_string($payload['jti']) ? $payload['jti'] : ''; + if ( ! preg_match('/^[a-f0-9]{32}$/', $jti) ) { + throw new \Exception('The token ID is malformed.'); + } + + return array('jti' => $jti, 'exp' => $expiration); + } + + /** + * Claims the token ID, so the token can be used only once. + * + * The claim is a single INSERT IGNORE on the unique option name: of several parallel requests + * with the same token exactly one inserts the row. Transients can not do this, a check and a write + * there are separate queries. Any storage failure rejects the token. + * + * @param string $jti + * @param int $expiration Token expiration timestamp. + * + * @return void + * @throws \Exception + */ + private static function claimJwtId($jti, $expiration) + { + global $wpdb; + + // The expired claims are useless, drop them to keep the table clean. + $wpdb->query( + $wpdb->prepare( + "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s AND CAST(option_value AS UNSIGNED) < %d", + $wpdb->esc_like(self::JWT_USED_ID_OPTION_PREFIX) . '%', + time() + ) + ); + + $claimed = $wpdb->query( + $wpdb->prepare( + "INSERT IGNORE INTO {$wpdb->options} (option_name, option_value, autoload) VALUES (%s, %s, 'no')", + self::JWT_USED_ID_OPTION_PREFIX . hash('sha256', $jti), + (string)($expiration + self::JWT_CLOCK_SKEW) + ) + ); + + if ( $claimed === false ) { + throw new \Exception('Failed to claim the token ID.'); + } + + if ( $claimed !== 1 ) { + throw new \Exception('The token has already been used.'); + } + } + + /** + * Decodes a base64url encoded JSON segment of the token. + * + * @param string $segment + * + * @return array|null Null if the segment is not a valid base64url JSON object. + */ + private static function decodeJwtSegment($segment) + { + if ( ! preg_match('/^[A-Za-z0-9_-]+$/', $segment) ) { + return null; + } + + $remainder = strlen($segment) % 4; + if ( $remainder ) { + $segment .= str_repeat('=', 4 - $remainder); + } + + $json = base64_decode(strtr($segment, '-_', '+/'), true); + if ( $json === false ) { + return null; + } + + $data = json_decode($json, true); + + return is_array($data) ? $data : null; + } + + /** + * @param string $data Raw binary data. + * + * @return string Base64url without padding. + */ + private static function encodeJwtSegment($data) + { + return rtrim(strtr(base64_encode($data), '+/', '-_'), '='); + } + + /** + * The audience the token must be issued for: the host with the path of the site home URL. + * + * The path matters: subsites of a subdirectory multisite share the host and the access key, + * so a token for "example.com/site-a" must not work on "example.com/site-b". + * A site in the root of the domain has no path, its audience is the host only. + * + * @return string Empty string if the home URL has no host. + */ + private static function getSiteJwtAudience() + { + $home_url = home_url(); + $host = parse_url($home_url, PHP_URL_HOST); + $path = parse_url($home_url, PHP_URL_PATH); + + if ( ! is_string($host) || $host === '' ) { + return ''; + } + + return self::normalizeJwtAudience($host . (is_string($path) ? $path : '')); + } + + /** + * Brings the audience to the form the control panel puts into the token: + * lower case, without "www." and the trailing slash, e.g. "example.com" or "example.com/site-a". + * + * @param string $audience + * + * @return string + */ + private static function normalizeJwtAudience($audience) + { + $audience = strtolower(trim($audience, " \n\r\t\v\x00")); + $audience = strpos($audience, 'www.') === 0 ? substr($audience, 4) : $audience; + + return rtrim($audience, '/'); + } + + /** + * Brings the IP to the canonical comparable form: the packed binary address in hex. + * + * Equivalent notations ("2001:DB8::1", "2001:0db8:0:0:0:0:0:1") give the same result. + * An IPv4-mapped IPv6 address ("::ffff:203.0.113.10") is the same client as the plain IPv4 one. + * + * @param string $ip + * + * @return string Empty string for an invalid IP. + */ + private static function canonicalizeJwtIp($ip) + { + $ip = trim($ip, " \n\r\t\v\x00"); + if ( filter_var($ip, FILTER_VALIDATE_IP) === false ) { + return ''; + } + + $packed = inet_pton($ip); + if ( $packed === false ) { + return ''; + } + + $ipv4_mapped_prefix = str_repeat("\x00", 10) . "\xff\xff"; + if ( strlen($packed) === 16 && strpos($packed, $ipv4_mapped_prefix) === 0 ) { + $packed = substr($packed, 12); + } + + return bin2hex($packed); + } + /** * Grants the bypass: stores the hash of the secret on the server and gives the secret to the browser. * diff --git a/lib/Cleantalk/ApbctWP/Firewall/SFW.php b/lib/Cleantalk/ApbctWP/Firewall/SFW.php index 4a13f0121..d4596df0a 100644 --- a/lib/Cleantalk/ApbctWP/Firewall/SFW.php +++ b/lib/Cleantalk/ApbctWP/Firewall/SFW.php @@ -124,7 +124,6 @@ public function check() global $apbct; $results = array(); - $status = 0; if (empty($apbct->key_is_ok) || empty($apbct->api_key)) { return $results; @@ -143,12 +142,16 @@ public function check() } // Skip by cookie + $pass_key = Cookie::getString('ct_sfw_pass_key'); foreach ($this->ip_array as $current_ip) { - if ( - TT::toString(Cookie::get('ct_sfw_pass_key')) - && strpos(TT::toString(Cookie::get('ct_sfw_pass_key')), md5($current_ip . $this->api_key . $apbct->data['salt'])) === 0 - ) { - if (Cookie::get('ct_sfw_passed')) { + $status = self::getPassKeyStatus( + $pass_key, + TT::toString($current_ip), + TT::toString($this->api_key), + TT::toString($apbct->data['salt']) + ); + if ($status !== null) { + if (Cookie::getString('ct_sfw_passed')) { if ( ! headers_sent()) { Cookie::set( 'ct_sfw_passed', @@ -176,11 +179,7 @@ public function check() } } - if (strlen(TT::toString(Cookie::get('ct_sfw_pass_key'))) > 32) { - $status = substr(TT::toString(Cookie::get('ct_sfw_pass_key')), -1); - } - - if ($status) { + if ($status === '1') { $results[] = array( 'ip' => $current_ip, 'is_personal' => false, @@ -277,6 +276,47 @@ public function check() return $results; } + /** + * Builds the ct_sfw_pass_key cookie value. The status is signed together with the IP. + * + * @param string $ip + * @param string $api_key + * @param string $salt + * @param string $status '1' - whitelisted, '0' - passed + * + * @return string + */ + public static function makePassKey($ip, $api_key, $salt, $status) + { + $status = $status === '1' ? '1' : '0'; + + return md5($ip . $api_key . $salt . $status) . $status; + } + + /** + * Validates the ct_sfw_pass_key cookie value. + * + * @param string $pass_key + * @param string $ip + * @param string $api_key + * @param string $salt + * + * @return string|null '1' or '0' for a valid key, null otherwise + */ + public static function getPassKeyStatus($pass_key, $ip, $api_key, $salt) + { + if (strlen($pass_key) !== 33) { + return null; + } + + $status = substr($pass_key, -1); + if ($status !== '0' && $status !== '1') { + return null; + } + + return hash_equals(self::makePassKey($ip, $api_key, $salt, $status), $pass_key) ? $status : null; + } + /** * Add entry to SFW log. * Writes to database. @@ -360,7 +400,12 @@ public function actionsForPassed($result) global $apbct; if ($this->data__cookies_type === 'native' && ! headers_sent()) { $status = $result['status'] === 'PASS_SFW__BY_WHITELIST' ? '1' : '0'; - $cookie_val = md5($result['ip'] . $this->api_key . $apbct->data['salt']) . $status; + $cookie_val = self::makePassKey( + TT::toString($result['ip']), + TT::toString($this->api_key), + TT::toString($apbct->data['salt']), + $status + ); Cookie::setNativeCookie( 'ct_sfw_pass_key', $cookie_val, @@ -399,7 +444,12 @@ public function diePage($result) $net_count = $apbct->stats['sfw']['entries']; $status = $result['status'] === 'PASS_SFW__BY_WHITELIST' ? '1' : '0'; - $cookie_val = md5($result['ip'] . $this->api_key . $apbct->data['salt']) . $status; + $cookie_val = self::makePassKey( + TT::toString($result['ip']), + TT::toString($this->api_key), + TT::toString($apbct->data['salt']), + $status + ); $block_message = sprintf( esc_html__('SpamFireWall is checking your browser and IP %s for spam bots', 'cleantalk-spam-protect'), @@ -447,7 +497,7 @@ public function diePage($result) '{SERVICE_ID}' => esc_html($apbct->data['service_id']) . ', ' . esc_html($net_count), '{HOST}' => get_home_url() . ', ' . APBCT_VERSION, '{GENERATED}' => '

The page was generated at ' . date('D, d M Y H:i:s') . '

', - '{REQUEST_URI}' => esc_url($request_uri), + '{REQUEST_URI}' => self::getLocalUrl($request_uri), // Cookie '{COOKIE_PREFIX}' => '', @@ -592,6 +642,20 @@ public function printDiePage() * * @return array|bool array('error' => STRING) */ + /** + * Escaped URL of the current site for the request URI. + * Leading slashes and backslashes are collapsed to one, so "//host/path" can not lead to an external host. + * + * @param string $request_uri + * + * @return string + */ + public static function getLocalUrl($request_uri) + { + // Double-encode entities, otherwise "//host" is decoded by the browser to "//host" + return htmlspecialchars('/' . ltrim(esc_url_raw($request_uri), '/\\'), ENT_QUOTES, 'UTF-8', true); + } + public static function sendLog($db, $log_table, $ct_key) { //Getting logs diff --git a/lib/Cleantalk/ApbctWP/Firewall/die_page_antiflood.html b/lib/Cleantalk/ApbctWP/Firewall/die_page_antiflood.html index faa0b12fe..eb687670b 100644 --- a/lib/Cleantalk/ApbctWP/Firewall/die_page_antiflood.html +++ b/lib/Cleantalk/ApbctWP/Firewall/die_page_antiflood.html @@ -230,7 +230,7 @@

{SFW_DIE_NOTICE_IP} apbct_is_varnish_cache_exists(), 'wc_ajax_add_to_cart' => get_option('woocommerce_enable_ajax_add_to_cart') === 'yes', ); + // Only when force protection was started in cleantalk.php, do not start it from here + if ( ForceProtection::isInitialized() ) { + $localize_array['force_protection_wrapper_token'] = ForceProtection::getInstance()->getWrapperToken(); + } if ( $apbct->settings['comments__the_real_person'] ) { $localize_array = array_merge($localize_array, CleantalkRealPerson::getLocalizingData()); } diff --git a/lib/Cleantalk/ApbctWP/RemoteCalls.php b/lib/Cleantalk/ApbctWP/RemoteCalls.php index 2dfaeeaa4..4a4ab2fda 100644 --- a/lib/Cleantalk/ApbctWP/RemoteCalls.php +++ b/lib/Cleantalk/ApbctWP/RemoteCalls.php @@ -481,6 +481,8 @@ public static function action__debug() // phpcs:ignore PSR1.Methods.CamelCapsMet $out = [$show_only => $out[$show_only]]; } + $out = static::hideSensitiveData($out); + if ( Request::equal('out', 'json') ) { die(json_encode($out)); } @@ -494,8 +496,6 @@ public static function action__debug() // phpcs:ignore PSR1.Methods.CamelCapsMet } }); - $out = static::hideSensitiveData($out); - $out = print_r($out, true); $out = str_replace("\n", "
", $out); $out = preg_replace("/[^\S]{4}/", "    ", $out); @@ -769,11 +769,21 @@ private static function checkToken($token) private static function hideSensitiveData($data) { + // State options ($apbct->data, stats, etc.) are ArrayObject instances + if ( $data instanceof \ArrayObject ) { + $data = $data->getArrayCopy(); + } + if ( ! is_array($data) ) { return $data; } foreach ( $data as $key => $value ) { + if ( $value instanceof \ArrayObject ) { + $value = $value->getArrayCopy(); + $data[$key] = $value; + } + if ( is_array($value) ) { $data[$key] = self::hideSensitiveData($value); } diff --git a/lib/Cleantalk/ApbctWP/Validate.php b/lib/Cleantalk/ApbctWP/Validate.php index 85ed9bc90..ab91a7a62 100644 --- a/lib/Cleantalk/ApbctWP/Validate.php +++ b/lib/Cleantalk/ApbctWP/Validate.php @@ -2,6 +2,8 @@ namespace Cleantalk\ApbctWP; +use Cleantalk\Common\TT; + class Validate extends \Cleantalk\Common\Validate { public static function isEmail($variable) @@ -13,4 +15,44 @@ public static function isValidFilePath($variable) { return validate_file($variable); } + + /** + * Whether the email is one of the recipients. + * Compares complete mailboxes: "min@example.com" is not found in "admin@example.com", + * and an email-like display name is not a recipient. + * + * @param string|array $recipients "Name , b@example.com" or a list of such strings + * @param string $email + * + * @return bool + */ + public static function isEmailInRecipients($recipients, $email) + { + $whitespace = " \t\n\r\0\x0B"; + $email = strtolower(trim((string)$email, $whitespace)); + if ( $email === '' ) { + return false; + } + + if ( is_array($recipients) ) { + $recipients = implode(',', array_filter($recipients, 'is_scalar')); + } + + // Split by "," or ";" outside of quoted display names, \" inside quotes is not a delimiter + $entries = TT::toArray( + preg_split('/[,;](?=(?:[^"\\\\]|\\\\.|"(?:[^"\\\\]|\\\\.)*")*$)/', (string)$recipients) + ); + foreach ( $entries as $entry ) { + $entry = trim(TT::toString($entry), $whitespace); + // "Display name " - only the part in angle brackets is the address + $address = preg_match('/<([^<>]*)>$/', $entry, $matches) + ? TT::getArrayValueAsString($matches, 1) + : $entry; + if ( strtolower(trim($address, $whitespace)) === $email ) { + return true; + } + } + + return false; + } } diff --git a/lib/Cleantalk/ApbctWP/Variables/AltSessions.php b/lib/Cleantalk/ApbctWP/Variables/AltSessions.php index 9e68edeb3..19d07903d 100644 --- a/lib/Cleantalk/ApbctWP/Variables/AltSessions.php +++ b/lib/Cleantalk/ApbctWP/Variables/AltSessions.php @@ -54,9 +54,8 @@ class AltSessions public static function getID() { - $id = Helper::ipGet() - . Server::getString('HTTP_USER_AGENT') - . Server::getString('HTTP_ACCEPT_LANGUAGE'); + // Accept-Language is omitted: XHR and document POST often send different headers. + $id = Helper::ipGet('real', false) . Server::getString('HTTP_USER_AGENT'); return substr(hash('sha256', $id), -16); } diff --git a/lib/Cleantalk/Common/ContactsEncoder/assets/contacts_encoder.css b/lib/Cleantalk/Common/ContactsEncoder/assets/contacts_encoder.css index 43454457e..113182b7e 100644 --- a/lib/Cleantalk/Common/ContactsEncoder/assets/contacts_encoder.css +++ b/lib/Cleantalk/Common/ContactsEncoder/assets/contacts_encoder.css @@ -29,11 +29,43 @@ .apbct-email-encoder.no-blur .apbct-blur{ filter: none; } -.apbct-email-encoder-popup { +.apbct-popup.apbct-email-encoder-popup { + position: fixed; + top: 50%; + left: 50%; + margin-left: 0; + transform: translate(-50%, -50%); width: 30vw; min-width: 400px; font-size: 16px; } +.apbct-email-encoder-popup__close { + position: absolute; + top: 12px; + right: 12px; + display: none; + width: 12px; + height: 12px; + border: 0; + padding: 0; + border-radius: 50%; + background: #f3f4f6; + color: #4b5563; + font-size: 22px; + font-weight: 600; + line-height: 1; + cursor: pointer; + align-items: center; + justify-content: center; + transition: background-color 0.2s ease, color 0.2s ease; +} +.apbct-email-encoder-popup__close:hover { + background: #e5e7eb; + color: #111827; +} +.apbct-email-encoder-popup__close--visible { + display: inline-flex; +} .apbct-email-encoder--popup-header { font-size: 16px; color: #333; @@ -147,12 +179,10 @@ display: block; } - .apbct-email-encoder-popup { - width: 20vw; + .apbct-popup.apbct-email-encoder-popup { + width: calc(90vw - 32px); min-width: 200px; - font-size: 16px; - top: 20%; - left: 75%; + max-width: 360px; } .apbct-email-encoder-elements_center { diff --git a/lib/Cleantalk/Common/ContactsEncoder/assets/contacts_encoder.js b/lib/Cleantalk/Common/ContactsEncoder/assets/contacts_encoder.js index 2cfbe8007..12c859d2f 100644 --- a/lib/Cleantalk/Common/ContactsEncoder/assets/contacts_encoder.js +++ b/lib/Cleantalk/Common/ContactsEncoder/assets/contacts_encoder.js @@ -49,6 +49,8 @@ class ContactsEncoder { encodedEmailNodesIsMixed = false; + popupOnClose = null; + /** * @param {ContactsEncoderConfig} config */ @@ -89,6 +91,8 @@ class ContactsEncoder { bindMethods() { this.decodeContactsHandler = this.decodeContactsHandler.bind(this); + this.closePopup = this.closePopup.bind(this); + this.handlePopupBackdropClick = this.handlePopupBackdropClick.bind(this); } showPopup() { @@ -107,6 +111,7 @@ class ContactsEncoder { `; } } + this.unbindPopupEvents(popup); popup.style.display = 'block'; } @@ -116,6 +121,7 @@ class ContactsEncoder { popup.id = 'apbct_popup'; popup.innerHTML = ` +

${this.config.serviceData.brandName}

@@ -138,6 +144,54 @@ class ContactsEncoder { return `
${elements}
`; } + bindPopupEvents(popup, onClose) { + this.popupOnClose = onClose; + const closeButton = popup.querySelector('.apbct-email-encoder-popup__close'); + if (closeButton) { + closeButton.classList.add('apbct-email-encoder-popup__close--visible'); + closeButton.addEventListener('click', this.closePopup); + } + + document.body.addEventListener('click', this.handlePopupBackdropClick); + } + + unbindPopupEvents(popup) { + this.popupOnClose = null; + const closeButton = popup.querySelector('.apbct-email-encoder-popup__close'); + if (closeButton) { + closeButton.classList.remove('apbct-email-encoder-popup__close--visible'); + closeButton.removeEventListener('click', this.closePopup); + } + + document.body.removeEventListener('click', this.handlePopupBackdropClick); + } + + closePopup() { + const onClose = this.popupOnClose; + document.body.classList.remove('apbct-popup-fade'); + const popup = document.getElementById('apbct_popup'); + if (popup) { + this.unbindPopupEvents(popup); + popup.style.display = 'none'; + } + if (onClose) { + this.popupOnClose = null; + onClose(); + } + } + + handlePopupBackdropClick(event) { + const popup = document.getElementById('apbct_popup'); + if ( + popup && + popup.style.display !== 'none' && + document.body.classList.contains('apbct-popup-fade') && + !popup.contains(event.target) + ) { + this.closePopup(); + } + } + /** * Handler for decoding contacts * Removes the click event listener, shows a popup, executes the decode contacts request, and handles the result or error @@ -240,9 +294,7 @@ class ContactsEncoder { button.innerText = this.config.texts.gotIt; button.classList = 'apbct-email-encoder-got-it-button'; button.addEventListener('click', () => { - document.body.classList.remove('apbct-popup-fade'); - popup.setAttribute('style', 'display:none'); - this.fillDecodedNodes(encodedEmailNodes, result); + this.closePopup(); // click on mailto if so if (this.encodedEmailNodesIsMixed && clickSource) { clickSource.click(); @@ -251,6 +303,9 @@ class ContactsEncoder { buttonWrapper.append(button); popup.append(buttonWrapper); } + this.bindPopupEvents(popup, () => { + this.fillDecodedNodes(encodedEmailNodes, result); + }); } }, 3000); } else { @@ -290,10 +345,9 @@ class ContactsEncoder { let popup = document.getElementById('apbct_popup'); let popupText = document.getElementById('apbct_popup_text'); if (popup !== null) { - document.body.classList.remove('apbct-popup-fade'); popupText.innerText = this.config.texts.contactsEncoder + ': ' + comment; setTimeout(() => { - popup.setAttribute('style', 'display:none'); + this.closePopup(); }, 3000); } } diff --git a/readme.txt b/readme.txt index b06464148..7a4a97e0c 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: spam, antispam, anti-spam, comments, firewall Requires at least: 4.7 Tested up to: 7.1 Requires PHP: 7.2 -Stable tag: 6.90 +Stable tag: 6.91 License: GPLv2 Advanced antispam for comments, registrations & contact forms. No CAPTCHA, plus email validation and honeypot. We catch spam others miss! @@ -424,6 +424,24 @@ CleanTalk stops up to 99.998% of spam bots, so you can disable other anti-spam p == Changelog == += 6.91 27.10.2026 = +* Fix. Settings. Improve hide function. +* Fix. SFW. AC/AF pass cookie value fixed. (#917) +* Upd. Firewall. Improve fw check. +* Fix. Settings. Getting brief fixed. (#914) +* Fix.code.improve statement (#912) +* Upd. Code. Editing token validation for ipv6 +* Upd. Code. Editing the definition of an authorized user +* Fix. Code. Set cookie expires attribute fixed. +* Fix. Anti Flood. Passed cookie fixed. (#910) +* Fix. Integration. Brevo (Sendinblue) integration fixed. (#911) +* Fix. Cookies. Sync event token on refresh events. +* Fix. Alt Sessions. Removed duplicated request. +* Fix. Contact Encoder. Fixed mobile layout. +* Upd. Cleantalk.php. Rotate moderate. Now use CURLOPT_RESOLVE for IP instead of converting IP as string if IP is used as fallback. (#894) +* New. Integration. LeakyPaywall plugin. +* Fix. Code. Fix getID multi sign. + = 6.90 13.10.2026 = * Fix. Comments checker. Feedback success message fixed. (#907) * Fix. Force protection. Checking bot detector fixed. diff --git a/tests/Antispam/Integrations/TestNinjaFormsMailNotification.php b/tests/Antispam/Integrations/TestNinjaFormsMailNotification.php new file mode 100644 index 000000000..80449b5d2 --- /dev/null +++ b/tests/Antispam/Integrations/TestNinjaFormsMailNotification.php @@ -0,0 +1,56 @@ +user_token = 'secretusertoken0123456789abcdef0'; + $apbct->sender_email = 'visitor@example.com'; + $apbct->sender_ip = '10.0.0.1'; + } + + public function testAdminMailGetsNoticeWithoutUserToken() + { + $result = NinjaForms::hookChangeMailNotification('Original body', array(), array('to' => 'admin@example.com')); + + $this->assertStringContainsString('CleanTalk Anti-Spam: This message could be spam.', $result); + $this->assertStringContainsString('Original body', $result); + $this->assertStringNotContainsString('secretusertoken0123456789abcdef0', $result); + } + + public function testAdminMailGetsNoticeWhenSenderIsSubstringOfRecipient() + { + global $apbct; + $apbct->sender_email = 'min@example.com'; + + $result = NinjaForms::hookChangeMailNotification('Original body', array(), array('to' => 'admin@example.com')); + + $this->assertStringContainsString('CleanTalk Anti-Spam: This message could be spam.', $result); + } + + public function testVisitorMailWithEmailLikeDisplayNameIsDetected() + { + global $apbct; + $apbct->sender_email = "o'connor@example.com"; + + $to_visitor = NinjaForms::hookChangeMailNotification('Thank you', array(), array('to' => "O'Connor ")); + $to_admin = NinjaForms::hookChangeMailNotification('Original body', array(), array('to' => "\"o'connor@example.com\" ")); + + $this->assertSame('Thank you', $to_visitor); + $this->assertStringContainsString('CleanTalk Anti-Spam: This message could be spam.', $to_admin); + } + + public function testMailToSenderIsNotChanged() + { + $result = NinjaForms::hookChangeMailNotification('Thank you', array(), array('to' => 'admin@example.com,visitor@example.com')); + + $this->assertSame('Thank you', $result); + } +} diff --git a/tests/Antispam/TestCleantalkResolveIP.php b/tests/Antispam/TestCleantalkResolveIP.php new file mode 100644 index 000000000..c10260d50 --- /dev/null +++ b/tests/Antispam/TestCleantalkResolveIP.php @@ -0,0 +1,345 @@ + PTR hostname. Missing key means the IP has no usable PTR. + */ + public $ptr_map = array(); + + public function getServersIp($host) + { + return $this->servers_fixture; + } + + protected function resolvePtr($ip) + { + return isset($this->ptr_map[$ip]) ? $this->ptr_map[$ip] : false; + } +} + +/** + * Exposes prepared cURL options without performing a network request. + */ +class ApbctResolveOptionsHarness extends CommonRequest +{ + public function prepareOptionsForTest() + { + $convert = new \ReflectionMethod(CommonRequest::class, 'convertOptionsTocURLFormat'); + $convert->setAccessible(true); + $convert->invoke($this); + + $this->appendOptionsObligatory(); + $this->processPresets(); + + return $this->options; + } +} + +/** + * Regression guard for the DNS-failure fallback. + * + * When moderate*.cleantalk.org can not be resolved, the plugin must keep the hostname + * in the URL and pin it to the selected IP via CURLOPT_RESOLVE, so SNI and the TLS + * certificate hostname check keep working. + * + * Historical bugs covered here: + * - the request was sent to https://, which fails with + * "SSL: no alternative certificate subject name matches target host name"; + * - the literal IP request was made with TLS verification switched off; + * - CURLOPT_RESOLVE was never set, because the guard required an explicit port + * that a normal API URL does not have, so the fallback was dead code; + * - an explicit non-default port was overwritten with 443; + * - an IP without a PTR record was skipped, even though it is a valid A record + * of the pool hostname and the fallback pins it by IP anyway; + * - deduplication of failed nodes by URL discards every candidate as soon as the + * URL stops being node-specific. + */ +class TestCleantalkResolveIP extends ApbctTestCase +{ + const IP = '167.71.167.197'; + const HOST = 'moderate2.cleantalk.org'; + const IP_SECOND = '159.69.57.9'; + const HOST_SECOND = 'moderate8.cleantalk.org'; + const POOL_HOST = 'moderate.cleantalk.org'; + const POOL_URL = 'https://moderate.cleantalk.org'; + + /** + * @var Cleantalk + */ + private $ct; + + public function setUp(): void + { + $this->ct = new Cleantalk(); + } + + /** + * The main regression: a normal API URL has no explicit port, so the mapping + * must fall back to the scheme default instead of being skipped. + */ + public function testHttpsUrlWithoutPortIsPinnedToIpOnDefaultPort() + { + $this->assertSame( + self::HOST . ':443:' . self::IP, + $this->ct->maybeResolveIPInsteadOfHost('https://' . self::HOST . '/api2.0', self::IP) + ); + } + + public function testExplicitPortIsPreserved() + { + $this->assertSame( + self::HOST . ':8443:' . self::IP, + $this->ct->maybeResolveIPInsteadOfHost('https://' . self::HOST . ':8443/api2.0', self::IP) + ); + } + + public function testPlainHttpUrlUsesPort80() + { + $this->assertSame( + self::HOST . ':80:' . self::IP, + $this->ct->maybeResolveIPInsteadOfHost('http://' . self::HOST . '/api2.0', self::IP) + ); + } + + /** + * The hostname must stay in the mapping: it is what SNI and the certificate + * check are validated against. + */ + public function testHostnameIsKeptAndNotReplacedByIp() + { + $resolve = $this->ct->maybeResolveIPInsteadOfHost('https://' . self::HOST . '/api2.0', self::IP); + + $this->assertStringStartsWith(self::HOST . ':', $resolve); + $this->assertStringEndsWith(':' . self::IP, $resolve); + } + + /** + * @dataProvider unusableInputProvider + */ + public function testUnusableInputProducesNoMapping($url, $ip) + { + $this->assertFalse($this->ct->maybeResolveIPInsteadOfHost($url, $ip)); + } + + public function unusableInputProvider() + { + return array( + 'not an IP' => array('https://' . self::HOST . '/api2.0', self::HOST), + 'empty IP' => array('https://' . self::HOST . '/api2.0', ''), + 'malformed IP' => array('https://' . self::HOST . '/api2.0', '167.71.167'), + 'IPv6 is not supported by CURLOPT_RESOLVE mapping' => array( + 'https://' . self::HOST . '/api2.0', + '2a03:6f00:1::1', + ), + 'URL without host' => array('/api2.0', self::IP), + 'empty URL' => array('', self::IP), + ); + } + + /** + * Pinning the host to an IP must never weaken TLS: the fallback used to send the + * request with CURLOPT_SSL_VERIFYPEER=false and CURLOPT_SSL_VERIFYHOST=0. + */ + public function testResolveMappingKeepsTlsVerificationEnabled() + { + $resolve = $this->ct->maybeResolveIPInsteadOfHost( + 'https://' . self::HOST . '/api2.0', + self::IP + ); + + $request = new ApbctResolveOptionsHarness(); + $request + ->setUrl('https://' . self::HOST . '/api2.0') + ->setOptions(array('timeout' => 15, CURLOPT_RESOLVE => array($resolve))); + + $options = $request->prepareOptionsForTest(); + + $this->assertSame(array($resolve), $options[CURLOPT_RESOLVE]); + $this->assertTrue($options[CURLOPT_SSL_VERIFYPEER]); + $this->assertSame(2, $options[CURLOPT_SSL_VERIFYHOST]); + $this->assertSame('https://' . self::HOST . '/api2.0', $options[CURLOPT_URL]); + } + + /** + * @param array $servers + * @param array $ptr_map + * @param array $down_servers + * @param array $down_ips + * + * @return ApbctRotateModerateStub + */ + private function makeRotateStub( + array $servers, + array $ptr_map = array(), + array $down_servers = array(), + array $down_ips = array() + ) { + $ct = new ApbctRotateModerateStub(); + $ct->server_url = self::POOL_URL; + $ct->servers_fixture = $servers; + $ct->ptr_map = $ptr_map; + + if ($down_servers) { + $this->setPrivate($ct, 'downServers', $down_servers); + } + + if ($down_ips) { + $this->setPrivate($ct, 'down_ips', $down_ips); + } + + return $ct; + } + + private function setPrivate($object, $name, $value) + { + $property = new \ReflectionProperty(Cleantalk::class, $name); + $property->setAccessible(true); + $property->setValue($object, $value); + } + + private function server($ip, $ttl = 300) + { + return array('ip' => $ip, 'host' => self::POOL_HOST, 'ttl' => $ttl); + } + + /** + * The URL must never be derived from DNS: a poisoned resolver would then pick + * the very name TLS is validated against. The pool hostname is the only name + * known to match the API certificate. + */ + public function testUrlKeepsPoolHostnameEvenWhenPtrIsAvailable() + { + $ct = $this->makeRotateStub( + array($this->server(self::IP)), + array(self::IP => self::HOST) + ); + + $this->assertSame(self::IP, $ct->rotateModerateAndUseIP()); + $this->assertSame(self::POOL_URL, $ct->work_url); + $this->assertSame(self::IP, $ct->work_ip); + } + + /** + * Regression: an IP without a PTR used to be skipped entirely, which silently + * disabled the fallback. The pool hostname is a valid SNI/certificate name, + * so such an IP must still be usable. + */ + public function testIpWithoutPtrFallsBackToPoolHostnameInsteadOfBeingSkipped() + { + $ct = $this->makeRotateStub(array($this->server(self::IP))); + + $this->assertSame(self::IP, $ct->rotateModerateAndUseIP()); + $this->assertSame(self::POOL_URL, $ct->work_url); + } + + /** + * The first candidate must be taken even if only later ones have a PTR. + */ + public function testFirstIpIsTakenEvenWhenOnlyLaterNodesHavePtr() + { + $ct = $this->makeRotateStub( + array($this->server(self::IP), $this->server(self::IP_SECOND)), + array(self::IP_SECOND => self::HOST_SECOND) + ); + + $this->assertSame(self::IP, $ct->rotateModerateAndUseIP()); + $this->assertSame(self::POOL_URL, $ct->work_url); + } + + /** + * A node that already failed must not be picked again. It is identified by IP, + * because every node now shares the pool hostname. + */ + public function testNodeThatAlreadyFailedIsSkipped() + { + $ct = $this->makeRotateStub( + array($this->server(self::IP), $this->server(self::IP_SECOND)), + array(), + array(), + array(self::IP) + ); + + $this->assertSame(self::IP_SECOND, $ct->rotateModerateAndUseIP()); + $this->assertSame(self::POOL_URL, $ct->work_url); + } + + /** + * Regression: the pool hostname is shared by every node, so matching it against + * the list of failed URLs must not discard the candidates. Deduplicating the + * fallback by URL instead of by IP would return false here and kill the retry. + */ + public function testFailedPoolUrlDoesNotDiscardCandidates() + { + $ct = $this->makeRotateStub( + array($this->server(self::IP), $this->server(self::IP_SECOND)), + array(), + array(self::POOL_URL) + ); + + $this->assertSame(self::IP, $ct->rotateModerateAndUseIP()); + $this->assertSame(self::POOL_URL, $ct->work_url); + } + + /** + * The same IP must not be handed out twice within one request cycle. + */ + public function testAlreadyUsedIpIsNotReturnedTwice() + { + $ct = $this->makeRotateStub( + array($this->server(self::IP), $this->server(self::IP_SECOND)) + ); + + $this->assertSame(self::IP, $ct->rotateModerateAndUseIP()); + $this->assertSame(self::IP_SECOND, $ct->rotateModerateAndUseIP()); + $this->assertFalse($ct->rotateModerateAndUseIP()); + } + + /** + * getServersIp() returns a null IP when it could not obtain any record. + */ + public function testEntriesWithoutIpAreSkipped() + { + $ct = $this->makeRotateStub( + array($this->server(null), $this->server(''), $this->server(self::IP)) + ); + + $this->assertSame(self::IP, $ct->rotateModerateAndUseIP()); + } + + public function testNoServersMeansNoFallback() + { + $ct = $this->makeRotateStub(array()); + + $this->assertFalse($ct->rotateModerateAndUseIP()); + } + + /** + * End to end of the two halves: the rotation always settles on the pool + * hostname, and the mapping must pin exactly that hostname to the returned IP. + */ + public function testSelectedIpAndWorkUrlProduceConsistentMapping() + { + foreach (array(array(self::IP => self::HOST), array()) as $ptr_map) { + $ct = $this->makeRotateStub(array($this->server(self::IP)), $ptr_map); + $ip = $ct->rotateModerateAndUseIP(); + + $this->assertSame(self::IP, $ip); + $this->assertSame( + self::POOL_HOST . ':443:' . self::IP, + $ct->maybeResolveIPInsteadOfHost($ct->work_url, $ip) + ); + } + } +} diff --git a/tests/ApbctWP/Antispam/ForceProtectionTest.php b/tests/ApbctWP/Antispam/ForceProtectionTest.php new file mode 100644 index 000000000..a1019c90a --- /dev/null +++ b/tests/ApbctWP/Antispam/ForceProtectionTest.php @@ -0,0 +1,226 @@ +'; + + protected function setUp(): void + { + parent::setUp(); + global $apbct; + + $this->original_cookies = $_COOKIE; + $this->original_server = $_SERVER; + $this->original_no_cookies = NoCookie::$no_cookies_data; + $this->original_user_id = get_current_user_id(); + $this->original_cookies_type = $apbct->data['cookies_type']; + wp_set_current_user(0); + $_COOKIE = array(); + NoCookie::$no_cookies_data = array(); + $this->resetRequestCache(); + $this->protection = new ForceProtection(); + } + + protected function tearDown(): void + { + global $apbct; + + remove_filter('the_content', array($this->protection, 'modifyContent')); + $_COOKIE = $this->original_cookies; + $_SERVER = $this->original_server; + $this->resetIpCache(); + NoCookie::$no_cookies_data = $this->original_no_cookies; + $apbct->data['cookies_type'] = $this->original_cookies_type; + wp_set_current_user($this->original_user_id); + $this->resetRequestCache(); + parent::tearDown(); + } + + private function resetRequestCache() + { + Cookie::getInstance()->variables = array(); + Server::getInstance()->variables = array(); + } + + private function resetIpCache() + { + $property = new \ReflectionProperty(\Cleantalk\Common\Helper::class, 'ips_stored'); + $property->setAccessible(true); + $property->setValue(Helper::getInstance(), array()); + Server::getInstance()->variables = array(); + } + + private function setPassToken($mode, $token) + { + global $apbct; + $apbct->data['cookies_type'] = $mode; + if ( $mode === 'native' ) { + $_COOKIE[apbct__get_cookie_prefix() . 'apbct_force_protection_check'] = $token; + $this->resetRequestCache(); + } else { + $this->assertNotFalse(RequestParameters::set('apbct_force_protection_check', $token)); + } + } + + private function signToken($expires) + { + $method = new \ReflectionMethod(ForceProtection::class, 'getPassSignature'); + $method->setAccessible(true); + + return $expires . '.' . $method->invoke($this->protection, $expires); + } + + public function storageModes() + { + return array( + 'native' => array('native'), + 'alternative' => array('alternative'), + 'no cookies' => array('none'), + ); + } + + /** + * @dataProvider storageModes + */ + public function testUnsignedAndInvalidPassTokensAreRejected($mode) + { + $expires = time() + HOUR_IN_SECONDS; + $valid_token = $this->signToken($expires); + $invalid_tokens = array( + '0', + '1', + 'forged', + $expires . '.' . str_repeat('0', 64), + $this->signToken(time() - 1), + $this->signToken(time() + 2 * DAY_IN_SECONDS), + ($expires + 1) . substr($valid_token, strpos($valid_token, '.')), + $valid_token . '.extra', + ); + + foreach ( $invalid_tokens as $token ) { + $this->setPassToken($mode, $token); + $this->assertStringContainsString( + 'ct-encoded-form-wrapper', + $this->protection->modifyContent(self::IFRAME), + $token + ); + } + } + + /** + * @dataProvider storageModes + */ + public function testValidPassTokenPreservesIframe($mode) + { + $this->setPassToken($mode, $this->signToken(time() + HOUR_IN_SECONDS)); + + $this->assertSame(self::IFRAME, $this->protection->modifyContent(self::IFRAME)); + } + + /** + * @dataProvider storageModes + */ + public function testPassTokenCannotBeReusedByAnotherVisitor($mode) + { + $this->setPassToken($mode, $this->signToken(time() + HOUR_IN_SECONDS)); + $_SERVER['HTTP_USER_AGENT'] = 'another-visitor'; + $this->resetRequestCache(); + + $this->assertStringContainsString( + 'ct-encoded-form-wrapper', + $this->protection->modifyContent(self::IFRAME) + ); + } + + public function testPassTokenIsBoundToSite() + { + $this->setPassToken('native', $this->signToken(time() + HOUR_IN_SECONDS)); + $other_site = function () { + return 'https://another-site.example'; + }; + add_filter('home_url', $other_site); + try { + $this->assertStringContainsString( + 'ct-encoded-form-wrapper', + $this->protection->modifyContent(self::IFRAME) + ); + } finally { + remove_filter('home_url', $other_site); + } + } + + /** + * @dataProvider storageModes + */ + public function testPassTokenSurvivesIpLookupOrderForIpv6Visitor($mode) + { + $_SERVER['REMOTE_ADDR'] = '2001:db8::10'; + $this->resetIpCache(); + + // The challenge request resolves the IPv6 address before the token is issued. + Helper::ipGet('real', false); + $token = $this->signToken(time() + HOUR_IN_SECONDS); + if ( $mode === 'alternative' ) { + $this->setPassToken($mode, $token); + } + + // A page request may only run the default IPv4-only lookup. + $this->resetIpCache(); + Helper::ipGet('real'); + if ( $mode !== 'alternative' ) { + $this->setPassToken($mode, $token); + } + + $this->assertSame(self::IFRAME, $this->protection->modifyContent(self::IFRAME)); + } + + public function testForgedLoginCookieDoesNotBypassProtection() + { + $_COOKIE[LOGGED_IN_COOKIE] = 'x'; + $_COOKIE['wordpress_logged_in_' . md5(get_site_option('siteurl'))] = 'x'; + + $this->assertStringContainsString( + 'ct-encoded-form-wrapper', + $this->protection->modifyContent(self::IFRAME) + ); + } + + public function testAuthenticatedUserStillSkipsProtection() + { + $user_id = wp_insert_user(array( + 'user_login' => 'force-protection-auth-test', + 'user_pass' => 'test-password', + )); + $this->assertFalse(is_wp_error($user_id)); + wp_set_current_user($user_id); + try { + $this->assertSame(self::IFRAME, $this->protection->modifyContent(self::IFRAME)); + } finally { + wp_set_current_user(0); + wp_delete_user($user_id); + } + } + + public function testUnrelatedIframeIsUnchanged() + { + $iframe = ''; + + $this->assertSame($iframe, $this->protection->modifyContent($iframe)); + } +} diff --git a/tests/ApbctWP/Antispam/TestForceProtection.php b/tests/ApbctWP/Antispam/TestForceProtection.php new file mode 100644 index 000000000..dd9b89af0 --- /dev/null +++ b/tests/ApbctWP/Antispam/TestForceProtection.php @@ -0,0 +1,78 @@ +settings['forms__force_protection'] = 1; + } + + public function testWrapperHasTokenOfCurrentResponse() + { + $fp = ForceProtection::getInstance(); + $content = '
'; + + $result = $fp->modifyContent($content); + + $token = $fp->getWrapperToken(); + $this->assertSame(1, preg_match('/^[0-9a-f]{32}$/', $token)); + $this->assertStringContainsString( + '
', + $result + ); + $this->assertSame($token, $fp->getWrapperToken()); + } + + public function testPlantedWrapperIsNotChanged() + { + $planted = '
' + . '
'; + + $result = ForceProtection::getInstance()->modifyContent($planted); + + $this->assertSame($planted, $result); + } + + /** + * Invalid key: cleantalk.php does not start force protection, localization must not start it either. + */ + public function testNotInitializedForceProtectionIsNotStartedByLocalize() + { + $this->resetInstance(); + + $localize_data = CtPublicLocalize::getData(); + + $this->assertArrayNotHasKey('force_protection_wrapper_token', $localize_data); + $this->assertFalse(ForceProtection::isInitialized()); + } + + public function testTokenIsLocalizedForJs() + { + ForceProtection::getInstance(); + + $localize_data = CtPublicLocalize::getData(); + + $this->assertArrayHasKey('force_protection_wrapper_token', $localize_data); + $this->assertSame( + ForceProtection::getInstance()->getWrapperToken(), + $localize_data['force_protection_wrapper_token'] + ); + } + + private function resetInstance() + { + $property = new \ReflectionProperty(ForceProtection::class, 'instance'); + $property->setAccessible(true); + $instances = (array)$property->getValue(); + unset($instances[ForceProtection::class]); + $property->setValue(null, $instances); + } +} diff --git a/tests/ApbctWP/ContactsEncoder/TestContactsEncoder.php b/tests/ApbctWP/ContactsEncoder/TestContactsEncoder.php index fbbb45853..299fc527d 100644 --- a/tests/ApbctWP/ContactsEncoder/TestContactsEncoder.php +++ b/tests/ApbctWP/ContactsEncoder/TestContactsEncoder.php @@ -43,6 +43,7 @@ private function clearDecoderPassedCookie(): void { $cookie_name = apbct__get_cookie_prefix() . 'apbct_email_encoder_passed'; unset($_COOKIE[$cookie_name]); + \Cleantalk\ApbctWP\Variables\AltSessions::wipe(); $cookie_instance = Cookie::getInstance(); $ref = new \ReflectionClass($cookie_instance); @@ -71,6 +72,8 @@ private function setDecoderPassedCookie(): string $this->clearDecoderPassedCookie(); $_COOKIE[$cookie_name] = $pass_key; Cookie::set('apbct_email_encoder_passed', $pass_key); + // The cookie alone is public, the server mark is set after a successful decoding check. + apbct_email_encoder_set_passed(); return $pass_key; } @@ -231,6 +234,51 @@ public function testModifyContentSkipsEmailsInsideOptionTags() $this->assertStringContainsString('apbct-email-encoder', $result); } + /** + * Placeholder planted in content must not be replaced with a protected '; + $content = '

link public@example.com

' + . ''; + + $result = $this->contacts_encoder->modifyContent($content); + + $this->assertStringContainsString('title="%%APBCT_OPTION_SKIP_0%%"', $result); + $this->assertStringNotContainsString('title="assertSame(1, substr_count($result, $option)); + } + + /** + * Placeholder planted in content must not be replaced with a protected WP Grid Builder region. + */ + public function testModifyBufferDoesNotReplacePlantedWpGridBuilderPlaceholder() + { + global $apbct; + + $apbct->settings['data__email_decoder_buffer'] = true; + $apbct->settings['data__email_decoder_encode_email_addresses'] = 1; + $apbct->saveSettings(); + $this->contacts_encoder->dropInstance(); + $this->contacts_encoder = apbctGetContactsEncoder(); + $this->contacts_encoder->runEncoding(); + + $wpgb_script = + ''; + $apbct->buffer = + 'test' . + '

link contact@example.com

' . + $wpgb_script . + ''; + + $this->contacts_encoder->modifyBuffer(); + + $this->assertStringContainsString('title="%%APBCT_WPGB_REGION_0%%"', $apbct->buffer); + $this->assertStringNotContainsString('title="buffer); + $this->assertSame(1, substr_count($apbct->buffer, $wpgb_script)); + } + /** * Settings skip list keeps listed emails plain, including in title-like strings. */ @@ -1349,4 +1397,38 @@ public function tearDown() : void $this->read_css_fixture_files = array(); } + + /** + * decodeEmailEntities() decodes numeric entities of email characters only. + */ + public function testDecodeEmailEntitiesDecodesOnlyEmailChars() + { + // Business Directory obfuscation of "info@test.com" + $obfuscated = 'info@test.com'; + $this->assertSame('info@test.com', ContactsEncoder::decodeEmailEntities($obfuscated)); + + // Fully obfuscated, hexadecimal and zero-padded entities + $this->assertSame('info@test.com', ContactsEncoder::decodeEmailEntities('info@test.com')); + $this->assertSame('info@test.com', ContactsEncoder::decodeEmailEntities('info@test.com')); + $this->assertSame('info@test.com', ContactsEncoder::decodeEmailEntities('info@test.com')); + + $escaped = '<img src=x onerror=alert(1)> <script> "' &#60; <img> <'; + $this->assertSame($escaped, ContactsEncoder::decodeEmailEntities($escaped)); + } + + /** + * modifyFormFieldDisplay() must not unescape Business Directory field HTML. + */ + public function testModifyFormFieldDisplayKeepsEscapedHtml() + { + $html = '

Contact us via mailto: link. <img src=x onerror=alert(1)>

' + . '' + . 'info@test.com'; + + $result = $this->contacts_encoder->modifyFormFieldDisplay($html, null, 'listing', 1); + + $this->assertStringNotContainsString('assertStringContainsString('<img src=x onerror=alert(1)>', $result); + $this->assertStringNotContainsString('info@test.com', $result); + } } diff --git a/tests/ApbctWP/ContactsEncoder/TestContactsEncoderShortCodeEncode.php b/tests/ApbctWP/ContactsEncoder/TestContactsEncoderShortCodeEncode.php index e0435a63c..c3e8e23a8 100644 --- a/tests/ApbctWP/ContactsEncoder/TestContactsEncoderShortCodeEncode.php +++ b/tests/ApbctWP/ContactsEncoder/TestContactsEncoderShortCodeEncode.php @@ -48,6 +48,7 @@ private function clearDecoderPassedCookie(): void { $cookie_name = apbct__get_cookie_prefix() . 'apbct_email_encoder_passed'; unset($_COOKIE[$cookie_name]); + \Cleantalk\ApbctWP\Variables\AltSessions::wipe(); $cookie_instance = Cookie::getInstance(); $ref = new \ReflectionClass($cookie_instance); @@ -75,6 +76,7 @@ private function setDecoderPassedCookie(): void $this->clearDecoderPassedCookie(); $_COOKIE[$cookie_name] = $pass_key; Cookie::set('apbct_email_encoder_passed', $pass_key); + apbct_email_encoder_set_passed(); } public function testCallbackEncodesContent() diff --git a/tests/ApbctWP/FindSpam/ListTable/TestComments.php b/tests/ApbctWP/FindSpam/ListTable/TestComments.php index 85da300bb..01ef3f666 100644 --- a/tests/ApbctWP/FindSpam/ListTable/TestComments.php +++ b/tests/ApbctWP/FindSpam/ListTable/TestComments.php @@ -146,5 +146,76 @@ public function testColumnCtAuthorShowsEmailWithCleantalkLinkWhenNotWhiteLabel() $this->assertStringContainsString('mailto:test@example.com', $result); $this->assertStringContainsString('cleantalk.org/blacklists/test@example.com', $result); } + + /** + * column_ct_author escapes quotes in email, so it can not break out of the href attribute. + */ + public function testColumnCtAuthorEscapesEmail(): void + { + global $apbct; + $apbct->white_label = false; + + $comment = (object)[ + 'comment_author' => 'Test Author', + 'comment_author_email' => "x'class='apbct_dog_one'onanimationstart='alert(1)'@ev.il", + 'comment_author_IP' => '192.168.1.1', + ]; + $item = ['ct_comment' => $comment]; + + $result = $this->columnCtAuthor->invoke($this->instance, $item); + + $this->assertStringNotContainsString("'class='", $result); + $this->assertStringNotContainsString("onanimationstart='", $result); + $this->assertStringContainsString('mailto:x'class='apbct_dog_one'', $result); + $this->assertStringContainsString('cleantalk.org/blacklists/x'class='', $result); + } + + /** + * column_ct_author escapes author name and IP. + */ + public function testColumnCtAuthorEscapesAuthorAndIp(): void + { + global $apbct; + $apbct->white_label = false; + + $comment = (object)[ + 'comment_author' => '', + 'comment_author_email' => 'test@example.com', + 'comment_author_IP' => "1.1.1.1' onmouseover='alert(1)", + ]; + $item = ['ct_comment' => $comment]; + + $result = $this->columnCtAuthor->invoke($this->instance, $item); + + $this->assertStringNotContainsString('