diff --git a/cleantalk.php b/cleantalk.php index 71219dea9..4b883bd5f 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.88 + Version: 6.89 Author: CleanTalk - Anti-Spam Protection Author URI: https://cleantalk.org Text Domain: cleantalk-spam-protect @@ -29,6 +29,7 @@ use Cleantalk\ApbctWP\Deactivator; use Cleantalk\ApbctWP\Firewall\AntiCrawler; use Cleantalk\ApbctWP\Firewall\AntiFlood; +use Cleantalk\ApbctWP\Firewall\FirewallBypass; use Cleantalk\ApbctWP\Firewall\SFW; use Cleantalk\ApbctWP\Firewall\SFWUpdateHelper; use Cleantalk\ApbctWP\Helper; @@ -898,7 +899,7 @@ function apbct_sfw__check() } } - // Skip the check + // Skip the check (legacy way, remove in future) if ( ! empty(Get::get('access')) ) { $spbc_settings = get_option('spbc_settings'); $spbc_key = ! empty($spbc_settings['spbc_key']) ? $spbc_settings['spbc_key'] : false; @@ -938,6 +939,12 @@ function apbct_sfw__check() return; } + // Emergency bypass: consume the one-time link from the admin email, then check the granted bypass. + FirewallBypass::maybeSetUserToken(); + if (FirewallBypass::bypassByUserToken()) { + return; + } + $firewall = new Firewall( DB::getInstance() ); diff --git a/css/cleantalk-admin-settings-page.min.css b/css/cleantalk-admin-settings-page.min.css index dbba03e03..ce92c121a 100644 --- a/css/cleantalk-admin-settings-page.min.css +++ b/css/cleantalk-admin-settings-page.min.css @@ -1 +1 @@ -.apbct_settings-page{padding-right:10px}.apbct_settings-field_content,.cleantalk_link-auto,.cleantalk_link-manual,.ct-warning-test-failed,.ct_rate_block,.ct_settings_banner,i.animate-spin{display:inline-block}#apbctTopWarning{margin-bottom:5px}#apbctTopWarning h3{margin:10px 0 5px 0}#apbctTopWarning h4{margin:10px}#apbctTopWarning h4 span{margin-top:5px}.apbct_settings-subtitle{position:relative;top:-15px;margin:0}.apbct_settings-field_wrapper{margin:15px 0}.apbct_settings-field_wrapper--sub{margin-left:30px!important}.apbct_settings__label{margin-right:10px;font-size:17px;vertical-align:text-bottom}.apbct_settings-field_content{display:inline-block}.apbct_settings-field_content--radio,.apbct_settings-field_wrapper>.apbct_settings-field_description{width:70%;padding-bottom:10px}.apbct_settings-field_title--select,.apbct_settings-field_title--textarea{margin:0;width:210px;padding-right:10px;padding-bottom:10px;font-size:14px;vertical-align:top}.apbct_settings-field_title--with-help{width:auto;white-space:nowrap}.apbct_settings-field_title--radio{display:inline-block;margin:0;width:210px;padding-right:10px;font-size:14px;vertical-align:top}.apbct_input_text{min-width:255px;width:400px}.apbct_settings-long_description---show:hover{color:#aaa;cursor:pointer}.apbct_setting_textarea{min-width:300px}.cleantalk_link{text-decoration:none;font-size:13px;line-height:26px;margin:10px 0 0 0;padding:0 10px 1px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.cleantalk_link-auto{background:#ccc;border-color:#999;-webkit-box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);color:#000;display:inline-block;height:28px;-webkit-border-radius:2px;border-radius:2px}.cleantalk_link-auto:hover{color:#fff}.cleantalk_link-auto.cleantalk_link_text_center{text-align:center}.cleantalk_link-manual{background:#2ea2cc;border-color:#0074a2;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);color:#fff;display:inline-block;-webkit-border-radius:3px;border-radius:3px;text-align:center}.cleantalk_link-manual:hover{color:#000}.cleantalk_link[disabled=disabled]{background:#5d9db5;color:#000}.apbct_status_icon{vertical-align:text-bottom;margin:0 5px 0 8px}.apbct-icon-upload-cloud{margin-left:3px}a.ct_support_link{color:#666;margin-right:.5em;font-size:10pt;font-weight:400}.ct-warning-test-failed{display:inline-block;position:relative;padding:5px;margin:4px;border:3px solid #f03232;border-radius:5px;background-color:#ffc8c8}.ct_settings_banner{text-align:right;display:inline-block;width:100%;margin:1em 0;vertical-align:top}#ct_translate_plugin{margin-left:0}.ct_rate_block{display:inline-block;width:370px;margin-right:3em;padding:.8em .8em 15px .8em;text-align:center;border:1px dashed #666}#ct_translate_plugin .apbct_button_rate{margin-bottom:10px}.apbct_long_desc{position:absolute;background:#5a5a5a;min-width:80px;min-height:80px;max-width:500px;padding:10px;color:#fff;z-index:10}.apbct_long_desc a{color:#78c8e6}i.animate-spin{-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear;display:inline-block;margin:0 auto;font-size:25px;line-height:20px;color:#78c8e6;margin:25px}@keyframes spin{to{transform:rotate(359deg)}}.apbct_long_desc__cancel{position:absolute;top:5px;right:5px;color:rgba(255,255,255,.5)}.apbct_long_desc__cancel:hover{color:#fff}.apbct_long_desc__angle{position:absolute;top:5px;left:-17px;width:10px;height:10px;background:#5a5a5a;-webkit-transform:rotate(135deg);-ms-transform:rotate(135deg);transform:rotate(135deg);-webkit-transform-origin:100% 100%;-ms-transform-origin:100% 100%;transform-origin:100% 100%}.apbct_long_desc__title{color:#78c8e6;margin:0}.--hide{display:none}.apbct_preloader_button{height:15px;margin-left:5px;vertical-align:text-top;display:none}.--invisible{visibility:hidden}.apbct_preloader{height:1em;width:1em;margin-left:.5em;display:inline-block}.key_changed_sync{font-size:1.5em;line-height:2em;vertical-align:middle}.key_changed_success{font-size:1.5em;line-height:2em;vertical-align:middle}.--upper-case{text-transform:uppercase}#cleantalk-modal-content{text-align:center}#cleantalk-modal-content>*{display:block;width:100%}.cleantalk-confirm-modal_header{font-size:15px;font-weight:500}.cleantalk-confirm-modal_text-block{padding:10px 0}.cleantalk-confirm-modal_buttons-block{display:flex!important;gap:10px;justify-content:center}button.ct_support_link{border:none;background:0 0;color:#666;text-decoration:underline;cursor:pointer}.apbct-btn-as-link{padding:0;margin:0;vertical-align:baseline;color:gray;border:0 none;border-bottom:1px solid;cursor:pointer}#apbct-account-email[contenteditable=true]{padding:6px;background-color:#fff;border:1px solid #ccc}button[value=save_changes]:disabled{color:#2271b1;border-color:#2271b1;background:#f6f7f7}#apbct_settings__advanced_settings{position:relative}#apbct_settings__advanced_settings_inner{width:70%}#apbct_hidden_section_nav{position:absolute;top:0;right:0;width:200px}#apbct_hidden_section_nav ul{z-index:9999;width:100%;top:40px}.apbct_settings__position_main_save_button{text-align:right;margin-right:40px}#apbct_settings__after_advanced_settings{margin-bottom:20px;width:70%}#apbct_settings__button_section{position:static;z-index:9999;padding-bottom:40px;bottom:0}.apbct_highlighted{outline-offset:5px;outline-color:red;outline-width:3px!important;outline-style:solid!important}.apbct_notice_inner{display:flex;margin-top:10px!important}.apbct_notification__advanced_settings{margin:20px 0;font-weight:400}.apbct_settings_top_info__div{float:right;padding:0 20px 0 0;font-size:13px;position:relative}.apbct_settings_top_info__p{padding:0;margin:2px}.apbct_settings_top_info__btn{display:inline-flex;gap:10px}.apbct_hidden_section_nav_mob_btn{display:none;background-image:url(images/menu.svg);background-repeat:no-repeat;background-size:contain;background-position-y:center}.apbct_hidden_section_nav_mob_btn-close{display:none}.apbct_settings__footer{background:#c2c2c2;position:absolute;left:0;padding-bottom:30px;padding-left:21px;z-index:-1}.apbct_settings_top_info__sub_btn{display:flex;flex-wrap:wrap;gap:10px;margin:15px 0}.apbct_settings__key_line{display:flex;align-items:center;justify-content:flex-start;flex-direction:row}.apbct_settings__key_line__elements{margin-right:10px}.apbct_setting__key_line__buttons{margin:0}.apbct_setting__key_line__get_key_manual_chunk{margin:10px 0 10px 0;border:1px solid #d3d3d3;border-radius:3px;padding:10px;background:#fff}.apbct_settings__key_line__service_block{margin-left:10px}#apbct_settings__public_offer{margin-top:10px;display:flex;align-items:center}#cleantalk_apikey_wrapper{max-width:65%}.apcbt_contact_data_encoder__line{max-width:70%;display:flex;flex-wrap:wrap;flex-direction:row}.apbct_warning_red_point{display:inline-block;width:4px;height:4px;background:red;border-radius:100%;margin:0 10px 3px 3px;vertical-align:middle;position:relative}.apbct_warning_red_point::after{content:'';position:absolute;left:50%;top:50%;width:12px;height:12px;border:1.5px solid rgba(255,2,2,.65);border-radius:50%;animation:apbct_pulsate 1.2s ease-out infinite;opacity:.7;pointer-events:none;transform:translate(-50%,-50%)}#apbct_summary_and_support{display:flex;flex-wrap:wrap;width:-webkit-fill-available;border:1px solid #ddd;border-radius:3px;padding:10px;background:#ededed;margin-top:4em}#apbct_summary_and_support-left_side{width:69%;padding:0 20px 0 0}#apbct_summary_and_support-right_side{width:31%;padding:0 20px;border-left:1px solid #dcdcde}#apbct_summary_and_support-sides_wrap{display:flex;flex-direction:row;margin:10px 0 10px;width:100%}.apbct_summary_and_support-side_header{margin:.5em 0}.apbct_summary_and_support-inner_header{margin:2em 0 .5em;font-size:medium}.apbct_summary_and_support-inner_header::after{content:'';display:block;width:100%;height:1px;background:linear-gradient(90deg,#d3d3d357 0,rgba(211,211,211,.14) 10%,transparent 100%);margin-top:5px}.apbct_summary_and_support-support_buttons_wrapper{display:flex;flex-direction:column}#apbct_summary_and_support-create_user_button{display:inline-flex;flex-direction:row;align-items:center;justify-content:center}.apbct_summary_and_support-user_creation_result{background:#eee;margin-top:10px;padding:5px;border:1px solid #d3d3d3;display:none}.apbct_summary-list_of_items{display:flex;flex-direction:column}.apbct_summary_list_item{margin-bottom:2px}.apbct-green{color:green}.apbct-red{color:red}#apbct_negative_reports_table{width:100%;border-collapse:collapse;margin:10px 5px}#apbct_sending_report_div{display:flex;flex-direction:row;justify-content:flex-end;align-items:center;flex-wrap:nowrap}#apbct_sending_report_disabled_notice{margin-right:5px}.apbct-real-user-popup-img{align-self:start;margin:0!important;height:1.1em;vertical-align:initial}@keyframes apbct_pulsate{0%{transform:translate(-50%,-50%) scale(1);opacity:.7}100%{transform:translate(-50%,-50%) scale(1.5);opacity:0}}@media (max-width:768px){.apbct_settings_top_info__btn{display:inline-grid;width:100%;gap:5px}#apbct_settings__advanced_settings_inner,#apbct_settings__after_advanced_settings{width:100%}.apbct_settings-field_content--radio,.apbct_settings-field_wrapper>.apbct_settings-field_description{width:100%}.apbct_settings_top_info__sub_btn .apbct_bottom_links--left,.apbct_settings_top_info__sub_btn .apbct_bottom_links--other{margin-left:0;margin-right:0}#apbct_hidden_section_nav ul{display:none;background-color:#dadee3bd;margin:0;padding:10px;border-radius:3px;right:0;width:auto}#apbct_hidden_section_nav{right:0;min-width:167px}.apbct_setting_radio::before{height:6px!important;width:6px!important;margin:4px!important}.apbct_setting_checkbox::before{height:15px!important;width:15px!important;margin:0 -.05rem!important}.apbct_setting_checkbox,.apbct_setting_radio{height:16px!important;width:16px!important}.apbct_hidden_section_nav_mob_btn{display:block;width:32px;height:28px;right:20px;top:20px;position:fixed}.apbct_hidden_section_nav_mob_btn-close{display:block;position:relative;float:right;width:20px;height:22px;top:-5px;right:-5px;background-image:url(images/cancel.svg);background-repeat:no-repeat;background-size:contain;background-position-y:center;text-align:center}.apbct_long_desc{left:-2%!important;max-width:95%;margin-top:10%}.apbct_long_desc__angle{display:none}.ct_rate_block{max-width:240px;margin-right:20px}.apbct_settings__key_line{display:flex;align-items:flex-start;flex-direction:column;width:100%}.apbct_settings__key_line__elements{margin:5px 0 5px 0}#apbct_setting_apikey,.apbct_setting__key_line__buttons,.apbct_settings__key_line__elements{width:100%}#cleantalk_apikey_wrapper{max-width:100%}#apbct_settings__button_section{position:fixed;right:20px}.apcbt_contact_data_encoder__line{max-width:100%;margin-top:5px}#apbct_summary_and_support-right_side{border-top:1px solid #dcdcde;border-left:0;margin:35px 0 0;padding:0;width:-webkit-fill-available}#apbct_summary_and_support-left_side{border-top:1px solid #dcdcde;width:-webkit-fill-available}#apbct_summary_and_support-sides_wrap{flex-direction:column}}.apbct-trial-renew-fullpage{display:flex;position:fixed;width:stretch;top:0;bottom:0;overflow-y:auto;justify-content:center;align-items:flex-start;font-family:Inter,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;color:#444;background-color:#f0f0f0;z-index:99}.apbct-trial-renew-fullpage-notice{padding:32px 64px 64px 64px!important;margin-top:5em!important;margin-bottom:5em!important}.apbct-trial-renew-fullpage-body{margin-top:32px;margin-left:32px}.apbct-banner-header{display:flex;justify-content:space-between}.apbct-trial-renew-fullpage-body .apbct-banner-button-wrapper{display:flex;margin:0}.apbct-trial-renew-fullpage-image{flex:1 1 0;min-width:0;max-width:576px;height:auto;object-fit:contain;margin:auto 0;align-self:flex-start}.apbct-banner-desc-block-row{line-height:22px}.apbct-banner-red-point{display:inline-block;width:8px;height:8px;background-color:#bb3323;border-radius:50%;margin-right:8px;vertical-align:middle}.apbct-banner-error{background-color:#fff!important;box-shadow:0 4px 15px #84848440!important;border-left-color:#bb3323!important}.apbct-banner-background-container{display:grid;max-width:644px;gap:16px;padding:32px;background-color:#f3f6f9;border-radius:8px}.apbct-banner-desc-block-title{font-size:18px;font-weight:700;line-height:22px;color:#0a0a0a;margin-bottom:8px}.apbct-banner-stat-value{margin-bottom:0;color:#444;vertical-align:middle}.apbct-banner-desc-block-text{font-size:14px;line-height:22px;color:#717182;margin-left:12px;margin-top:0;vertical-align:middle}.apbct-banner-desc-blocks{display:grid;gap:16px;flex:1 1 0;min-width:0}.apbct-banner-desc-blocks-content{display:flex;gap:72px;flex-wrap:wrap;justify-content:center;margin:32px 0}.apbct-banner-check{vertical-align:middle}.apbct-trial-renew-upgrade{display:none;text-align:center}.apbct-trial-renew-upgrade-link{font-size:16px;line-height:22px;letter-spacing:0;text-decoration:underline solid 0 #026e88!important;text-underline-offset:25%;color:#026e88!important}@media (max-width:1366px){.apbct-banner-header{display:grid;gap:16px}.apbct-banner-desc-blocks-content{display:grid;gap:38px;place-items:center}.apbct-trial-renew-upgrade{display:block}}@media (max-width:1200px){.apbct-banner-desc-blocks-content{gap:32px}}@media (max-width:782px){.apbct-trial-renew-fullpage{padding-top:50px;padding-bottom:50px}.apbct-trial-renew-fullpage-notice{padding:24px 24px 32px 24px!important}.apbct-trial-renew-fullpage-body{margin-top:20px;margin-left:0}.apbct-banner-desc-blocks-content{gap:24px}.apbct-banner-background-container{padding:20px}.apbct-trial-renew-fullpage-image{width:100%}}@media (max-width:480px){.apbct-trial-renew-fullpage-notice{padding:16px 12px 24px 12px!important}.apbct-banner-background-container{padding:16px}.apbct-banner-desc-blocks-content{gap:16px}.apbct-banner-desc-block-title{font-size:16px}} \ No newline at end of file +.apbct_settings-page{padding-right:10px}.apbct_settings-field_content,.cleantalk_link-auto,.cleantalk_link-manual,.ct-warning-test-failed,.ct_rate_block,.ct_settings_banner,i.animate-spin{display:inline-block}#apbctTopWarning{margin-bottom:5px}#apbctTopWarning h3{margin:10px 0 5px 0}#apbctTopWarning h4{margin:10px}#apbctTopWarning h4 span{margin-top:5px}.apbct_settings-subtitle{position:relative;top:-15px;margin:0}.apbct_settings-field_wrapper{margin:15px 0}.apbct_settings-field_wrapper--sub{margin-left:30px!important}.apbct_settings-field_wrapper--sub-sub{margin-left:60px!important}.apbct_settings__label{margin-right:10px;font-size:17px;vertical-align:text-bottom}.apbct_settings-field_content{display:inline-block}.apbct_settings-field_content--radio,.apbct_settings-field_wrapper>.apbct_settings-field_description{width:70%;padding-bottom:10px}.apbct_settings-field_title--select,.apbct_settings-field_title--textarea{margin:0;width:210px;padding-right:10px;padding-bottom:10px;font-size:14px;vertical-align:top}.apbct_settings-field_title--with-help{width:auto;white-space:nowrap}.apbct_settings-field_title--radio{display:inline-block;margin:0;width:210px;padding-right:10px;font-size:14px;vertical-align:top}.apbct_input_text{min-width:255px;width:400px}.apbct_settings-long_description---show:hover{color:#aaa;cursor:pointer}.apbct_setting_textarea{min-width:300px}.cleantalk_link{text-decoration:none;font-size:13px;line-height:26px;margin:10px 0 0 0;padding:0 10px 1px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.cleantalk_link-auto{background:#ccc;border-color:#999;-webkit-box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);color:#000;display:inline-block;height:28px;-webkit-border-radius:2px;border-radius:2px}.cleantalk_link-auto:hover{color:#fff}.cleantalk_link-auto.cleantalk_link_text_center{text-align:center}.cleantalk_link-manual{background:#2ea2cc;border-color:#0074a2;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);color:#fff;display:inline-block;-webkit-border-radius:3px;border-radius:3px;text-align:center}.cleantalk_link-manual:hover{color:#000}.cleantalk_link[disabled=disabled]{background:#5d9db5;color:#000}.apbct_status_icon{vertical-align:text-bottom;margin:0 5px 0 8px}.apbct-icon-upload-cloud{margin-left:3px}a.ct_support_link{color:#666;margin-right:.5em;font-size:10pt;font-weight:400}.ct-warning-test-failed{display:inline-block;position:relative;padding:5px;margin:4px;border:3px solid #f03232;border-radius:5px;background-color:#ffc8c8}.ct_settings_banner{text-align:right;display:inline-block;width:100%;margin:1em 0;vertical-align:top}#ct_translate_plugin{margin-left:0}.ct_rate_block{display:inline-block;width:370px;margin-right:3em;padding:.8em .8em 15px .8em;text-align:center;border:1px dashed #666}#ct_translate_plugin .apbct_button_rate{margin-bottom:10px}.apbct_long_desc{position:absolute;background:#5a5a5a;min-width:80px;min-height:80px;max-width:500px;padding:10px;color:#fff;z-index:10}.apbct_long_desc a{color:#78c8e6}i.animate-spin{-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear;display:inline-block;margin:0 auto;font-size:25px;line-height:20px;color:#78c8e6;margin:25px}@keyframes spin{to{transform:rotate(359deg)}}.apbct_long_desc__cancel{position:absolute;top:5px;right:5px;color:rgba(255,255,255,.5)}.apbct_long_desc__cancel:hover{color:#fff}.apbct_long_desc__angle{position:absolute;top:5px;left:-17px;width:10px;height:10px;background:#5a5a5a;-webkit-transform:rotate(135deg);-ms-transform:rotate(135deg);transform:rotate(135deg);-webkit-transform-origin:100% 100%;-ms-transform-origin:100% 100%;transform-origin:100% 100%}.apbct_long_desc__title{color:#78c8e6;margin:0}.--hide{display:none}.apbct_preloader_button{height:15px;margin-left:5px;vertical-align:text-top;display:none}.--invisible{visibility:hidden}.apbct_preloader{height:1em;width:1em;margin-left:.5em;display:inline-block}.key_changed_sync{font-size:1.5em;line-height:2em;vertical-align:middle}.key_changed_success{font-size:1.5em;line-height:2em;vertical-align:middle}.--upper-case{text-transform:uppercase}#cleantalk-modal-content{text-align:center}#cleantalk-modal-content>*{display:block;width:100%}.cleantalk-confirm-modal_header{font-size:15px;font-weight:500}.cleantalk-confirm-modal_text-block{padding:10px 0}.cleantalk-confirm-modal_buttons-block{display:flex!important;gap:10px;justify-content:center}button.ct_support_link{border:none;background:0 0;color:#666;text-decoration:underline;cursor:pointer}.apbct-btn-as-link{padding:0;margin:0;vertical-align:baseline;color:gray;border:0 none;border-bottom:1px solid;cursor:pointer}#apbct-account-email[contenteditable=true]{padding:6px;background-color:#fff;border:1px solid #ccc}button[value=save_changes]:disabled{color:#2271b1;border-color:#2271b1;background:#f6f7f7}#apbct_settings__advanced_settings{position:relative}#apbct_settings__advanced_settings_inner{width:70%}#apbct_hidden_section_nav{position:absolute;top:0;right:0;width:200px}#apbct_hidden_section_nav ul{z-index:9999;width:100%;top:40px}.apbct_settings__position_main_save_button{text-align:right;margin-right:40px}#apbct_settings__after_advanced_settings{margin-bottom:20px;width:70%}#apbct_settings__button_section{position:static;z-index:9999;padding-bottom:40px;bottom:0}.apbct_highlighted{outline-offset:5px;outline-color:red;outline-width:3px!important;outline-style:solid!important}.apbct_notice_inner{display:flex;margin-top:10px!important}.apbct_notification__advanced_settings{margin:20px 0;font-weight:400}.apbct_settings_top_info__div{float:right;padding:0 20px 0 0;font-size:13px;position:relative}.apbct_settings_top_info__p{padding:0;margin:2px}.apbct_settings_top_info__btn{display:inline-flex;gap:10px}.apbct_hidden_section_nav_mob_btn{display:none;background-image:url(images/menu.svg);background-repeat:no-repeat;background-size:contain;background-position-y:center}.apbct_hidden_section_nav_mob_btn-close{display:none}.apbct_settings__footer{background:#c2c2c2;position:absolute;left:0;padding-bottom:30px;padding-left:21px;z-index:-1}.apbct_settings_top_info__sub_btn{display:flex;flex-wrap:wrap;gap:10px;margin:15px 0}.apbct_settings__key_line{display:flex;align-items:center;justify-content:flex-start;flex-direction:row}.apbct_settings__key_line__elements{margin-right:10px}.apbct_setting__key_line__buttons{margin:0}.apbct_setting__key_line__get_key_manual_chunk{margin:10px 0 10px 0;border:1px solid #d3d3d3;border-radius:3px;padding:10px;background:#fff}.apbct_settings__key_line__service_block{margin-left:10px}#apbct_settings__public_offer{margin-top:10px;display:flex;align-items:center}#cleantalk_apikey_wrapper{max-width:65%}.apcbt_contact_data_encoder__line{max-width:70%;display:flex;flex-wrap:wrap;flex-direction:row}.apbct_warning_red_point{display:inline-block;width:4px;height:4px;background:red;border-radius:100%;margin:0 10px 3px 3px;vertical-align:middle;position:relative}.apbct_warning_red_point::after{content:'';position:absolute;left:50%;top:50%;width:12px;height:12px;border:1.5px solid rgba(255,2,2,.65);border-radius:50%;animation:apbct_pulsate 1.2s ease-out infinite;opacity:.7;pointer-events:none;transform:translate(-50%,-50%)}#apbct_summary_and_support{display:flex;flex-wrap:wrap;width:-webkit-fill-available;border:1px solid #ddd;border-radius:3px;padding:10px;background:#ededed;margin-top:4em}#apbct_summary_and_support-left_side{width:69%;padding:0 20px 0 0}#apbct_summary_and_support-right_side{width:31%;padding:0 20px;border-left:1px solid #dcdcde}#apbct_summary_and_support-sides_wrap{display:flex;flex-direction:row;margin:10px 0 10px;width:100%}.apbct_summary_and_support-side_header{margin:.5em 0}.apbct_summary_and_support-inner_header{margin:2em 0 .5em;font-size:medium}.apbct_summary_and_support-inner_header::after{content:'';display:block;width:100%;height:1px;background:linear-gradient(90deg,#d3d3d357 0,rgba(211,211,211,.14) 10%,transparent 100%);margin-top:5px}.apbct_summary_and_support-support_buttons_wrapper{display:flex;flex-direction:column}#apbct_summary_and_support-create_user_button{display:inline-flex;flex-direction:row;align-items:center;justify-content:center}.apbct_summary_and_support-user_creation_result{background:#eee;margin-top:10px;padding:5px;border:1px solid #d3d3d3;display:none}.apbct_summary-list_of_items{display:flex;flex-direction:column}.apbct_summary_list_item{margin-bottom:2px}.apbct-green{color:green}.apbct-red{color:red}#apbct_negative_reports_table{width:100%;border-collapse:collapse;margin:10px 5px}#apbct_sending_report_div{display:flex;flex-direction:row;justify-content:flex-end;align-items:center;flex-wrap:nowrap}#apbct_sending_report_disabled_notice{margin-right:5px}.apbct-real-user-popup-img{align-self:start;margin:0!important;height:1.1em;vertical-align:initial}@keyframes apbct_pulsate{0%{transform:translate(-50%,-50%) scale(1);opacity:.7}100%{transform:translate(-50%,-50%) scale(1.5);opacity:0}}@media (max-width:768px){.apbct_settings_top_info__btn{display:inline-grid;width:100%;gap:5px}#apbct_settings__advanced_settings_inner,#apbct_settings__after_advanced_settings{width:100%}.apbct_settings-field_content--radio,.apbct_settings-field_wrapper>.apbct_settings-field_description{width:100%}.apbct_settings_top_info__sub_btn .apbct_bottom_links--left,.apbct_settings_top_info__sub_btn .apbct_bottom_links--other{margin-left:0;margin-right:0}#apbct_hidden_section_nav ul{display:none;background-color:#dadee3bd;margin:0;padding:10px;border-radius:3px;right:0;width:auto}#apbct_hidden_section_nav{right:0;min-width:167px}.apbct_setting_radio::before{height:6px!important;width:6px!important;margin:4px!important}.apbct_setting_checkbox::before{height:15px!important;width:15px!important;margin:0 -.05rem!important}.apbct_setting_checkbox,.apbct_setting_radio{height:16px!important;width:16px!important}.apbct_hidden_section_nav_mob_btn{display:block;width:32px;height:28px;right:20px;top:20px;position:fixed}.apbct_hidden_section_nav_mob_btn-close{display:block;position:relative;float:right;width:20px;height:22px;top:-5px;right:-5px;background-image:url(images/cancel.svg);background-repeat:no-repeat;background-size:contain;background-position-y:center;text-align:center}.apbct_long_desc{left:-2%!important;max-width:95%;margin-top:10%}.apbct_long_desc__angle{display:none}.ct_rate_block{max-width:240px;margin-right:20px}.apbct_settings__key_line{display:flex;align-items:flex-start;flex-direction:column;width:100%}.apbct_settings__key_line__elements{margin:5px 0 5px 0}#apbct_setting_apikey,.apbct_setting__key_line__buttons,.apbct_settings__key_line__elements{width:100%}#cleantalk_apikey_wrapper{max-width:100%}#apbct_settings__button_section{position:fixed;right:20px}.apcbt_contact_data_encoder__line{max-width:100%;margin-top:5px}#apbct_summary_and_support-right_side{border-top:1px solid #dcdcde;border-left:0;margin:35px 0 0;padding:0;width:-webkit-fill-available}#apbct_summary_and_support-left_side{border-top:1px solid #dcdcde;width:-webkit-fill-available}#apbct_summary_and_support-sides_wrap{flex-direction:column}}.apbct-trial-renew-fullpage{display:flex;position:fixed;width:stretch;top:0;bottom:0;overflow-y:auto;justify-content:center;align-items:flex-start;font-family:Inter,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;color:#444;background-color:#f0f0f0;z-index:99}.apbct-trial-renew-fullpage-notice{padding:32px 64px 64px 64px!important;margin-top:5em!important;margin-bottom:5em!important}.apbct-trial-renew-fullpage-body{margin-top:32px;margin-left:32px}.apbct-banner-header{display:flex;justify-content:space-between}.apbct-trial-renew-fullpage-body .apbct-banner-button-wrapper{display:flex;margin:0}.apbct-trial-renew-fullpage-image{flex:1 1 0;min-width:0;max-width:576px;height:auto;object-fit:contain;margin:auto 0;align-self:flex-start}.apbct-banner-desc-block-row{line-height:22px}.apbct-banner-red-point{display:inline-block;width:8px;height:8px;background-color:#bb3323;border-radius:50%;margin-right:8px;vertical-align:middle}.apbct-banner-error{background-color:#fff!important;box-shadow:0 4px 15px #84848440!important;border-left-color:#bb3323!important}.apbct-banner-background-container{display:grid;max-width:644px;gap:16px;padding:32px;background-color:#f3f6f9;border-radius:8px}.apbct-banner-desc-block-title{font-size:18px;font-weight:700;line-height:22px;color:#0a0a0a;margin-bottom:8px}.apbct-banner-stat-value{margin-bottom:0;color:#444;vertical-align:middle}.apbct-banner-desc-block-text{font-size:14px;line-height:22px;color:#717182;margin-left:12px;margin-top:0;vertical-align:middle}.apbct-banner-desc-blocks{display:grid;gap:16px;flex:1 1 0;min-width:0}.apbct-banner-desc-blocks-content{display:flex;gap:72px;flex-wrap:wrap;justify-content:center;margin:32px 0}.apbct-banner-check{vertical-align:middle}.apbct-trial-renew-upgrade{display:none;text-align:center}.apbct-trial-renew-upgrade-link{font-size:16px;line-height:22px;letter-spacing:0;text-decoration:underline solid 0 #026e88!important;text-underline-offset:25%;color:#026e88!important}@media (max-width:1366px){.apbct-banner-header{display:grid;gap:16px}.apbct-banner-desc-blocks-content{display:grid;gap:38px;place-items:center}.apbct-trial-renew-upgrade{display:block}}@media (max-width:1200px){.apbct-banner-desc-blocks-content{gap:32px}}@media (max-width:782px){.apbct-trial-renew-fullpage{padding-top:50px;padding-bottom:50px}.apbct-trial-renew-fullpage-notice{padding:24px 24px 32px 24px!important}.apbct-trial-renew-fullpage-body{margin-top:20px;margin-left:0}.apbct-banner-desc-blocks-content{gap:24px}.apbct-banner-background-container{padding:20px}.apbct-trial-renew-fullpage-image{width:100%}}@media (max-width:480px){.apbct-trial-renew-fullpage-notice{padding:16px 12px 24px 12px!important}.apbct-banner-background-container{padding:16px}.apbct-banner-desc-blocks-content{gap:16px}.apbct-banner-desc-block-title{font-size:16px}} \ No newline at end of file diff --git a/css/cleantalk-admin.min.css b/css/cleantalk-admin.min.css index daf049497..c2c7a6d27 100644 --- a/css/cleantalk-admin.min.css +++ b/css/cleantalk-admin.min.css @@ -1 +1 @@ -:disabled{cursor:not-allowed!important}.apbct_color--gray{color:gray}.apbct_display--none{display:none}.apbct_bottom_links--left{margin-right:2pc}.apbct_bottom_links--other{margin-right:2pc;margin-left:2pc}.ct_translate_links{color:#969614}.ct_support_links{color:#961414}.ct_faq_links{color:#149614}.ct_setting_links{color:#141496}.ct_translate_links:hover{color:#d2d214!important}.ct_support_links:hover{color:#fa1414!important}.ct_faq_links:hover{color:#14fa14!important}.ct_setting_links:hover{color:#1414fa!important}.ct_link_new_tab img{float:none!important;margin:0 2px;border:0}#negative_reports_table tr td{padding:7px 5px!important}#wp-admin-bar-cleantalk_admin_bar__parent_node{margin-right:5px}#wp-admin-bar-cleantalk_admin_bar__parent_node span{display:inline-block}#wp-admin-bar-cleantalk_admin_bar__parent_node .apbct-icon-attention-alt{background:#d63638;color:#fff;border-radius:50%;font-size:12px}#wp-admin-bar-cleantalk_admin_bar__parent_node img.cleantalk_admin_bar__spbc_icon{width:14px;height:17px;margin-top:7px}#wp-admin-bar-cleantalk_admin_bar__parent_node img.cleantalk_admin_bar__apbct_icon{width:18px;height:18px;margin-top:7px}#wp-admin-bar-cleantalk_admin_bar__parent_node div.cleantalk_admin_bar__sum_counter{color:#999;display:inline;padding:2px 5px!important}.cleantalk_admin_bar__blocked div{cursor:not-allowed!important}.cleantalk_admin_bar__blocked div a{color:#777!important}.cleantalk_admin_bar__title{vertical-align:top}.cleantalk_admin_bar__separator{height:0!important}.cleantalk-admin_bar--list_wrapper .ab-sub-wrapper ul:last-child{margin-bottom:5px!important}.apbct-plugin-errors{margin-left:0;margin-bottom:20px}#cleantalk_notice_review .caption{margin:0 0 15px;color:gray}#cleantalk_notice_review .button{margin-bottom:20px}.apbct-details-spam-order-button,.apbct-restore-spam-order-button{cursor:pointer}.apbct-details-spam-order-button{color:gray}.ct-modal-buttons{display:flex;align-items:center;padding:20px 0;justify-content:space-between}.ct-modal-message{font-weight:700;font-size:16px;line-height:2rem}.apbct-popup-fade:before{content:'';background:#000;position:fixed;left:0;top:0;width:100%;height:100%;opacity:.7;z-index:9999}.apbct-popup{position:fixed;top:20%;left:50%;padding:20px;width:360px;margin-left:-200px;background:#fff;border:1px solid;border-radius:4px;z-index:99999;opacity:1}.apbct-table-actions-wrapper{background:#fcfcfc;background:#fcfcfc;border-radius:2px;padding:5px!important;border:1px solid #d3d3d3;margin:0 5px 5px 0!important}.apbct_wc_details__table-container_header{text-align:center}.apbct_wc_details__wrapper{display:flex;flex-direction:column;scroll-behavior:smooth;overflow-y:auto;max-height:400px;min-width:50pc;position:relative}.apbct_wc_details__table-wrapper-inner{margin-bottom:25px;background:#f9f9f9;border-radius:8px;box-shadow:0 2px 4px rgba(0,0,0,.08);position:relative;padding:0 15px}.apbct_wc_details__table-wrapper-inner h4{margin:0 0 12px 0;color:#333;font-size:16px;font-weight:600;padding:10px 0 8px 0;border-bottom:2px solid #e0e0e0;position:sticky;top:0;background:#f9f9f9;z-index:10}.apbct_wc_details__table{width:100%;border-collapse:collapse;background:#fff;border-radius:6px;overflow:hidden}.apbct_wc_details__table-key-cell{border:1px solid #e8e8e8;padding:10px 12px;font-weight:600;background:#f5f7fa;color:#2c3e50;width:35%;font-size:13px}.apbct_wc_details__table-value-cell{border:1px solid #e8e8e8;padding:10px 12px;color:#34495e;font-size:13px;word-break:break-word}.apbct_wc_details__table tbody tr:hover{background:#fafbfc}.apbct_wc_details__table tbody tr:last-child td{border-bottom:none}.apbct_wc_details__table-value-cell--json{font-family:monospace;font-size:12px;white-space:pre-wrap}@supports (position:sticky){.apbct_wc_details__table th,.apbct_wc_details__table-wrapper-inner h4{position:sticky}}@media screen and (max-width:1120px){.apbct-tablenav{display:flex;flex-direction:column;flex-wrap:nowrap;height:100%;max-width:50%}}.apbct-notice.apbct-banner-success{padding:16px 32px!important;background-color:#fff!important;box-shadow:0 4px 15px #84848440!important;border-left-color:#00bb5d!important}.apbct-banner-content{display:flex;flex-wrap:wrap;justify-content:space-between;row-gap:16px}.apbct-banner-content-wrapper{display:flex;flex-wrap:wrap;gap:16px;justify-content:space-between}.apbct-banner-text-wrapper{margin-top:16px;margin-left:32px}.apbct-banner-button{display:block;padding:17px 53px;color:#fff!important;border-radius:8px;font-size:16px;font-weight:500;text-decoration:none!important;text-align:center;align-content:center}.apbct-banner-button-wrapper{display:grid;gap:12px;align-content:center;text-align:center;margin-right:24px;margin-left:32px}.apbct-banner-title{font-size:24px;line-height:29px;font-weight:500;color:#000}.apbct-banner-subtitle{font-size:14px;line-height:22px;font-weight:400;color:#444;margin-top:8px}.apbct-banner-big-subtitle{font-size:16px}.apbct-banner-link{font-size:16px;line-height:24px;font-weight:400;color:#026e88!important}.apbct-banner-dismiss-link{font-weight:400;font-size:14px;line-height:22px;color:#646464!important}.apbct-notice.apbct-banner-error{padding:16px 32px!important;background-color:#fff!important;box-shadow:0 4px 15px #84848440!important;border-left-color:#bb3323!important}.apbct-notice.apbct-banner-error .notice-dismiss::before{color:#646464}.apbct-banner-button-green{background-color:#00bb5d!important}.apbct-banner-button-green:hover{background-color:#00a34f!important}.apbct-banner-button-red{background-color:#bb3323!important}.apbct-banner-button-red:hover{background-color:#a82e20!important} \ No newline at end of file +:disabled{cursor:not-allowed!important}.apbct_color--gray{color:gray}.apbct_display--none{display:none}.apbct_bottom_links--left{margin-right:2pc}.apbct_bottom_links--other{margin-right:2pc;margin-left:2pc}.ct_translate_links{color:#969614}.ct_support_links{color:#961414}.ct_faq_links{color:#149614}.ct_setting_links{color:#141496}.ct_translate_links:hover{color:#d2d214!important}.ct_support_links:hover{color:#fa1414!important}.ct_faq_links:hover{color:#14fa14!important}.ct_setting_links:hover{color:#1414fa!important}.ct_link_new_tab img{float:none!important;margin:0 2px;border:0}#negative_reports_table tr td{padding:7px 5px!important}#wp-admin-bar-cleantalk_admin_bar__parent_node{margin-right:5px}#wp-admin-bar-cleantalk_admin_bar__parent_node span{display:inline-block}#wp-admin-bar-cleantalk_admin_bar__parent_node .apbct-icon-attention-alt{background:#d63638;color:#fff;border-radius:50%;font-size:12px}#wp-admin-bar-cleantalk_admin_bar__parent_node img.cleantalk_admin_bar__spbc_icon{width:14px;height:17px;margin-top:7px}#wp-admin-bar-cleantalk_admin_bar__parent_node img.cleantalk_admin_bar__apbct_icon{width:18px;height:18px;margin-top:7px}#wp-admin-bar-cleantalk_admin_bar__parent_node div.cleantalk_admin_bar__sum_counter{color:#999;display:inline;padding:2px 5px!important}.cleantalk_admin_bar__blocked div{cursor:not-allowed!important}.cleantalk_admin_bar__blocked div a{color:#777!important}.cleantalk_admin_bar__title{vertical-align:top}.cleantalk_admin_bar__separator{height:0!important}.cleantalk-admin_bar--list_wrapper .ab-sub-wrapper ul:last-child{margin-bottom:5px!important}.apbct-plugin-errors{margin-left:0;margin-bottom:20px}#cleantalk_notice_review .caption{margin:0 0 15px;color:gray}#cleantalk_notice_review .button{margin-bottom:20px}.apbct-details-spam-order-button,.apbct-restore-spam-order-button{cursor:pointer}.apbct-details-spam-order-button{color:gray}.wp-list-table.wc_spam_orders .column-ct_order_date,.wp-list-table.wc_spam_orders .column-ct_status,.wp-list-table.wc_spam_orders .column-ct_total{width:15%}.wp-list-table.wc_spam_orders td{vertical-align:middle}.wp-list-table.wc_spam_orders .apbct-order-view{color:#2271b1;text-decoration:none}.wp-list-table.wc_spam_orders .apbct-order-view:hover{color:#135e96}.apbct-order-status{display:inline-flex;line-height:2.5em;color:#454545;background:#e5e5e5;border-radius:4px;border-bottom:1px solid rgba(0,0,0,.05);margin:-.25em 0;cursor:inherit!important;white-space:nowrap;max-width:100%}.apbct-order-status>span{margin:0 1em;overflow:hidden;text-overflow:ellipsis}.apbct-order-status--spam{background:#eba3a3;color:#570000}.ct-modal-buttons{display:flex;align-items:center;padding:20px 0;justify-content:space-between}.ct-modal-message{font-weight:700;font-size:16px;line-height:2rem}.apbct-popup-fade:before{content:'';background:#000;position:fixed;left:0;top:0;width:100%;height:100%;opacity:.7;z-index:9999}.apbct-popup{position:fixed;top:20%;left:50%;padding:20px;width:360px;margin-left:-200px;background:#fff;border:1px solid;border-radius:4px;z-index:99999;opacity:1}.apbct-table-actions-wrapper{background:#fcfcfc;background:#fcfcfc;border-radius:2px;padding:5px!important;border:1px solid #d3d3d3;margin:0 5px 5px 0!important}.apbct_wc_details__table-container_header{text-align:center}.apbct_wc_details__wrapper{display:flex;flex-direction:column;scroll-behavior:smooth;overflow-y:auto;max-height:400px;min-width:50pc;position:relative}.apbct_wc_details__table-wrapper-inner{margin-bottom:25px;background:#f9f9f9;border-radius:8px;box-shadow:0 2px 4px rgba(0,0,0,.08);position:relative;padding:0 15px}.apbct_wc_details__table-wrapper-inner h4{margin:0 0 12px 0;color:#333;font-size:16px;font-weight:600;padding:10px 0 8px 0;border-bottom:2px solid #e0e0e0;position:sticky;top:0;background:#f9f9f9;z-index:10}.apbct_wc_details__table{width:100%;border-collapse:collapse;background:#fff;border-radius:6px;overflow:hidden}.apbct_wc_details__table-key-cell{border:1px solid #e8e8e8;padding:10px 12px;font-weight:600;background:#f5f7fa;color:#2c3e50;width:35%;font-size:13px}.apbct_wc_details__table-value-cell{border:1px solid #e8e8e8;padding:10px 12px;color:#34495e;font-size:13px;word-break:break-word}.apbct_wc_details__table tbody tr:hover{background:#fafbfc}.apbct_wc_details__table tbody tr:last-child td{border-bottom:none}.apbct_wc_details__table-value-cell--json{font-family:monospace;font-size:12px;white-space:pre-wrap}@supports (position:sticky){.apbct_wc_details__table th,.apbct_wc_details__table-wrapper-inner h4{position:sticky}}@media screen and (max-width:1120px){.apbct-tablenav{display:flex;flex-direction:column;flex-wrap:nowrap;height:100%;max-width:50%}}.apbct-notice.apbct-banner-success{padding:16px 32px!important;background-color:#fff!important;box-shadow:0 4px 15px #84848440!important;border-left-color:#00bb5d!important}.apbct-banner-content{display:flex;flex-wrap:wrap;justify-content:space-between;row-gap:16px}.apbct-banner-content-wrapper{display:flex;flex-wrap:wrap;gap:16px;justify-content:space-between}.apbct-banner-text-wrapper{margin-top:16px;margin-left:32px}.apbct-banner-button{display:block;padding:17px 53px;color:#fff!important;border-radius:8px;font-size:16px;font-weight:500;text-decoration:none!important;text-align:center;align-content:center}.apbct-banner-button-wrapper{display:grid;gap:12px;align-content:center;text-align:center;margin-right:24px;margin-left:32px}.apbct-banner-title{font-size:24px;line-height:29px;font-weight:500;color:#000}.apbct-banner-subtitle{font-size:14px;line-height:22px;font-weight:400;color:#444;margin-top:8px}.apbct-banner-big-subtitle{font-size:16px}.apbct-banner-link{font-size:16px;line-height:24px;font-weight:400;color:#026e88!important}.apbct-banner-dismiss-link{font-weight:400;font-size:14px;line-height:22px;color:#646464!important}.apbct-notice.apbct-banner-error{padding:16px 32px!important;background-color:#fff!important;box-shadow:0 4px 15px #84848440!important;border-left-color:#bb3323!important}.apbct-notice.apbct-banner-error .notice-dismiss::before{color:#646464}.apbct-banner-button-green{background-color:#00bb5d!important}.apbct-banner-button-green:hover{background-color:#00a34f!important}.apbct-banner-button-red{background-color:#bb3323!important}.apbct-banner-button-red:hover{background-color:#a82e20!important} \ No newline at end of file diff --git a/css/src/cleantalk-admin-settings-page.css b/css/src/cleantalk-admin-settings-page.css index 2922bd8a6..28a2b9ce9 100644 --- a/css/src/cleantalk-admin-settings-page.css +++ b/css/src/cleantalk-admin-settings-page.css @@ -30,6 +30,7 @@ i.animate-spin { margin: 15px 0; } .apbct_settings-field_wrapper--sub{ margin-left: 30px !important; } +.apbct_settings-field_wrapper--sub-sub{ margin-left: 60px !important; } .apbct_settings-field_title{ } .apbct_settings__label{ diff --git a/css/src/cleantalk-admin.css b/css/src/cleantalk-admin.css index 815b371aa..09ff7c189 100644 --- a/css/src/cleantalk-admin.css +++ b/css/src/cleantalk-admin.css @@ -105,6 +105,51 @@ .apbct-details-spam-order-button { color: gray; } + +/* WooCommerce orders list alike view of the spam orders table. + The order column has no width, so it takes all the space left. */ +.wp-list-table.wc_spam_orders .column-ct_order_date, +.wp-list-table.wc_spam_orders .column-ct_status, +.wp-list-table.wc_spam_orders .column-ct_total { + width: 15%; +} + +.wp-list-table.wc_spam_orders td { + vertical-align: middle; +} + +.wp-list-table.wc_spam_orders .apbct-order-view { + color: #2271b1; + text-decoration: none; +} + +.wp-list-table.wc_spam_orders .apbct-order-view:hover { + color: #135e96; +} + +.apbct-order-status { + display: inline-flex; + line-height: 2.5em; + color: #454545; + background: #e5e5e5; + border-radius: 4px; + border-bottom: 1px solid rgba(0, 0, 0, .05); + margin: -.25em 0; + cursor: inherit !important; + white-space: nowrap; + max-width: 100%; +} + +.apbct-order-status > span { + margin: 0 1em; + overflow: hidden; + text-overflow: ellipsis; +} + +.apbct-order-status--spam { + background: #eba3a3; + color: #570000; +} .ct-modal-buttons { display: flex; align-items: center; diff --git a/inc/cleantalk-admin.php b/inc/cleantalk-admin.php index 2c5695653..ad98a6cbb 100644 --- a/inc/cleantalk-admin.php +++ b/inc/cleantalk-admin.php @@ -6,6 +6,7 @@ use Cleantalk\ApbctWP\CleantalkSettingsTemplates; use Cleantalk\ApbctWP\ContactsEncoder\ContactsEncoder; use Cleantalk\ApbctWP\Escape; +use Cleantalk\ApbctWP\UpdateChangelogNotice; use Cleantalk\ApbctWP\Variables\Get; use Cleantalk\ApbctWP\Variables\Post; use Cleantalk\ApbctWP\Variables\Server; @@ -35,6 +36,7 @@ add_action('comment_spam_to_unapproved', 'apbct_comment__remove_meta_approved', 10, 1); add_action('comment_trash_to_unapproved', 'apbct_comment__remove_meta_approved', 10, 1); +UpdateChangelogNotice::register(); /** * Crunch for Anti-Bot * Hooked by 'admin_head' @@ -1194,11 +1196,17 @@ function apbct_admin__admin_bar__add_child_nodes($wp_admin_bar) // Add a child item to our parent item. Bulk checks. if ( ! is_network_admin() && apbct_is_plugin_active('woocommerce/woocommerce.php') ) { + // HPOS installations render the spam orders view inline on the wc-orders screen; + // legacy (posts table) installations get a separate fallback admin page instead. + $spam_orders_page = function_exists('wc_get_page_screen_id') && wc_get_page_screen_id('shop_order') !== 'shop_order' + ? 'wc-orders&status=wc-spamorder' + : 'apbct_wc_spam_orders'; + $wp_admin_bar->add_node( array( 'parent' => 'apbct__parent_node', 'id' => 'ct_settings_bulk_orders', - 'title' => '' + 'title' => '' . __('WooCommerce spam orders', 'cleantalk-spam-protect') . '', ) ); diff --git a/inc/cleantalk-ajax.php b/inc/cleantalk-ajax.php index e8b9be86a..3baaa088d 100644 --- a/inc/cleantalk-ajax.php +++ b/inc/cleantalk-ajax.php @@ -118,6 +118,9 @@ /* The Fluent Form have the direct integration */ $_cleantalk_hooked_actions[] = 'fluentform_submit'; +/* WooCommerce Stripe UPE confirms the card on Add payment method. Direct integration. */ +$_cleantalk_hooked_actions[] = 'wc_stripe_create_and_confirm_setup_intent'; + /* Estimation Forms have the direct integration */ if ( class_exists('LFB_Core') ) { $_cleantalk_hooked_actions[] = 'send_email'; @@ -556,6 +559,9 @@ function ct_ajax_hook($message_obj = null) $base_call_result = apbct_base_call($base_call_params, $reg_flag); + // Remove service fields from POST before any early return. + apbct_clear_post_service_data_after_base_call(); + if (!isset($base_call_result['ct_result'])) { return null; } diff --git a/inc/cleantalk-integrations-by-hook.php b/inc/cleantalk-integrations-by-hook.php index 7649defa3..928c5de04 100755 --- a/inc/cleantalk-integrations-by-hook.php +++ b/inc/cleantalk-integrations-by-hook.php @@ -47,6 +47,11 @@ 'setting' => 'forms__contact_forms_test', 'ajax' => true ), + 'Pagelayer' => array( + 'hook' => 'pagelayer_contact_submit_start', + 'setting' => 'forms__contact_forms_test', + 'ajax' => false + ), 'EstimationForm' => array('hook' => 'send_email', 'setting' => 'forms__contact_forms_test', 'ajax' => true), 'LandingPageBuilder' => array( 'hook' => 'ulpb_formBuilderEmail_ajax', diff --git a/inc/cleantalk-pluggable.php b/inc/cleantalk-pluggable.php index 236895221..f1876b3a8 100644 --- a/inc/cleantalk-pluggable.php +++ b/inc/cleantalk-pluggable.php @@ -2128,6 +2128,15 @@ class_exists('Cleantalk\Antispam\Integrations\CleantalkInternalForms') return 'Nex Forms'; } + // Pagelayer contact form has the direct integration. + // The form posts to admin-ajax.php?action=..., so the action arrives via GET. + if ( + apbct_is_plugin_active('pagelayer/pagelayer.php') && + Request::getString('action') === 'pagelayer_contact_submit' + ) { + return 'Pagelayer contact form - has the direct integration'; + } + return false; } @@ -2168,7 +2177,7 @@ function apbct_settings__get_ajax_type() $localize = null; if ( is_string($frontend_body) ) { - preg_match_all('@const ctPublicFunctions.*{(.*)}@', $frontend_body, $matches); + preg_match_all('@var ctPublicFunctions.*{(.*)}@', $frontend_body, $matches); if ( isset($matches[1][0]) ) { $localize = json_decode('{' . $matches[1][0] . '}', true); } diff --git a/inc/cleantalk-public-validate-skip-functions.php b/inc/cleantalk-public-validate-skip-functions.php index 30fd693e7..0777ec20e 100755 --- a/inc/cleantalk-public-validate-skip-functions.php +++ b/inc/cleantalk-public-validate-skip-functions.php @@ -54,6 +54,7 @@ function skip_for_ct_contact_form_validate_postdata() apbct_is_in_uri('/wc-api') || apbct_is_in_uri('wc-api=WC_Gateway_Tpay_Basic') || // Tpay payment Gateway plugin (isset($_POST['wc_reset_password'], $_POST['_wpnonce'], $_POST['_wp_http_referer'])) || //WooCommerce recovery password form + apbct_is_woocommerce_add_payment_method_form() || // WooCommerce Add payment method, checked as an order (isset($_POST['woocommerce-login-nonce'], $_POST['login'], $_POST['password'], $_POST['_wp_http_referer'])) || //WooCommerce login form (isset($_POST['provider'], $_POST['authcode']) && $_POST['provider'] === 'Two_Factor_Totp') || //TwoFactor authorization (isset($_GET['wc-ajax']) && $_GET['wc-ajax'] === 'sa_wc_buy_now_get_ajax_buy_now_button') || //BuyNow add to cart @@ -74,6 +75,38 @@ function skip_for_ct_contact_form_validate_postdata() return false; } +/** + * Real WooCommerce "Add payment method" submit. + * + * The dedicated check sends the account email as an order. Skipping it here keeps the + * general checker from marking the request done. A single POST field is not enough: + * the request must hit this endpoint and carry the form nonce. + * + * @return bool + */ +function apbct_is_woocommerce_add_payment_method_form() +{ + if ( + ! apbct_is_plugin_active('woocommerce/woocommerce.php') || + ! apbct_is_in_uri('add-payment-method') || + ! isset($_POST['woocommerce_add_payment_method'], $_POST['payment_method']) + ) { + return false; + } + + $nonce = ''; + if ( + isset($_REQUEST['woocommerce-add-payment-method-nonce']) && + is_string($_REQUEST['woocommerce-add-payment-method-nonce']) + ) { + $nonce = $_REQUEST['woocommerce-add-payment-method-nonce']; + } elseif ( isset($_REQUEST['_wpnonce']) && is_string($_REQUEST['_wpnonce']) ) { + $nonce = $_REQUEST['_wpnonce']; + } + + return wp_verify_nonce($nonce, 'woocommerce-add-payment-method') !== false; +} + /** * Function for skip in ct_contact_form_validate(). Returns false if no exclusions found, or the key of the exclusion. * @return false|string @@ -304,6 +337,8 @@ function skip_for_ct_contact_form_validate() (isset($_POST['pass']) && isset($_POST['_pass'])) ) ), + // WooCommerce Add payment method. Direct check uses the account email and type "order". + '103' => apbct_is_woocommerce_add_payment_method_form(), ); foreach ( $exclusions as $exclusion_key => $state ) { diff --git a/inc/cleantalk-public-validate.php b/inc/cleantalk-public-validate.php index 1ba477999..5cb669792 100644 --- a/inc/cleantalk-public-validate.php +++ b/inc/cleantalk-public-validate.php @@ -69,6 +69,18 @@ function ct_contact_form_validate() Get::getString('wc-ajax') === 'wc_stripe_normalize_address' && apbct_is_plugin_active('woocommerce-gateway-stripe/woocommerce-gateway-stripe.php') && 1 == check_ajax_referer('wc-stripe-express-checkout-normalize-address', 'security', false) + ) || + // Add payment method is checked on its own, with the account email and type "order". + ( + apbct_is_plugin_active('woocommerce/woocommerce.php') && + ! empty($_POST) && + apbct_is_plugin_active('woocommerce-gateway-stripe/woocommerce-gateway-stripe.php') && + apbct_is_in_referer('add-payment-method') && + ( + Get::getString('wc-ajax') === 'wc_stripe_create_setup_intent' || + Get::getString('wc-ajax') === 'wc_stripe_init_setup_intent' || + Post::getString('action') === 'wc_stripe_create_and_confirm_setup_intent' + ) ) ) { do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . 'WOOCOMMERCE_SERVICES', $_POST); diff --git a/inc/cleantalk-settings.php b/inc/cleantalk-settings.php index 69b0ca5ea..d55ff7189 100644 --- a/inc/cleantalk-settings.php +++ b/inc/cleantalk-settings.php @@ -348,6 +348,27 @@ function apbct_settings__set_fields() 'class' => 'apbct_settings-field_wrapper--sub', 'reverse_trigger' => true, ), + 'data__wc_store_blocked_orders' => array( + 'title' => __('Store blocked orders', 'cleantalk-spam-protect'), + 'description' => __('Orders blocked by Anti-Spam will be stored and can be restored manually later if needed. To test the spam protection, place an order using s@cleantalk.org as the customer’s email address. Then check WooCommerce → Orders → Spam.', 'cleantalk-spam-protect'), + 'class' => 'apbct_settings-field_wrapper--sub', + 'childrens' => array('forms__wc_hide_rejection_message'), + 'options' => array( + array('val' => 1, 'label' => __('On'), 'childrens_enable' => 1), + array('val' => 0, 'label' => __('Off'), 'childrens_enable' => 0), + ), + ), + 'forms__wc_hide_rejection_message' => array( + 'title' => __('Hide rejection message from customers', 'cleantalk-spam-protect'), + 'description' => __('This message tells the customer why their order was filtered, allowing them to fix the issue that caused it. However, this may result in multiple orders from the same customer because all rejected orders are saved in the Spam folder. By default, this option is ON.', 'cleantalk-spam-protect'), + 'class' => 'apbct_settings-field_wrapper--sub-sub', + 'parent' => 'data__wc_store_blocked_orders', + 'options' => array( + array('val' => 1, 'label' => __('On')), + array('val' => 0, 'label' => __('Off')), + ), + 'reverse_trigger' => false, + ), 'forms__wc_add_to_cart' => array( 'title' => __( 'Check anonymous users when they add new items to the cart', @@ -358,19 +379,10 @@ function apbct_settings__set_fields() 'cleantalk-spam-protect' ), 'reverse_trigger' => false, - 'class' => 'apbct_settings-field_wrapper--sub', + 'class' => 'apbct_settings-field_wrapper', 'options' => array( - array('val' => 1, 'label' => __('On')), - array('val' => 0, 'label' => __('Off')), - ), - ), - 'data__wc_store_blocked_orders' => array( - 'title' => __('Store blocked orders', 'cleantalk-spam-protect'), - 'description' => __('The orders which was blocked by the Anti-Spam will be stored and could be restored manually later if its needed.', 'cleantalk-spam-protect'), - 'class' => 'apbct_settings-field_wrapper--sub', - 'options' => array( - array('val' => 1, 'label' => __('On')), - array('val' => 0, 'label' => __('Off')), + array('val' => 1, 'label' => __('On')), + array('val' => 0, 'label' => __('Off')), ), ), ), @@ -462,7 +474,7 @@ function apbct_settings__set_fields() 'data__protect_logged_in' => array( 'title' => __("Protect logged in Users", 'cleantalk-spam-protect'), 'description' => __( - 'Turn this option on to check for spam any submissions (comments, contact forms and etc.) from registered Users.', + 'Turn this option on to check for spam any submissions (comments, contact forms and etc.) from registered Users. WooCommerce Add payment method is checked as an order.', 'cleantalk-spam-protect' ), ), @@ -2187,8 +2199,14 @@ function apbct_settings__field__action_buttons() if ( apbct_is_plugin_active('woocommerce/woocommerce.php') ) { add_filter('apbct_settings_action_buttons', function ($buttons_array) { + // HPOS installations render the spam orders view inline on the wc-orders screen; + // legacy (posts table) installations get a separate fallback admin page instead. + $spam_orders_page = function_exists('wc_get_page_screen_id') && wc_get_page_screen_id('shop_order') !== 'shop_order' + ? 'wc-orders&status=wc-spamorder' + : 'apbct_wc_spam_orders'; + $buttons_array[] = - '' + '' . __('WooCommerce spam orders', 'cleantalk-spam-protect') . ''; return $buttons_array; diff --git a/inc/cleantalk-updater.php b/inc/cleantalk-updater.php index d4c865378..20ef1737b 100644 --- a/inc/cleantalk-updater.php +++ b/inc/cleantalk-updater.php @@ -1388,3 +1388,19 @@ function apbct_update_to_6_76_0() $apbct->saveData(); } } + +/** + * Preserve the legacy WooCommerce checkout behavior (rejection message shown to the customer) + * for users who already had "Store blocked orders" enabled before the new option was introduced. + * + * @return void + */ +function apbct_update_to_6_89_0() +{ + global $apbct; + + if ( ! empty($apbct->settings['data__wc_store_blocked_orders']) ) { + $apbct->settings['forms__wc_hide_rejection_message'] = 0; + $apbct->saveSettings(); + } +} diff --git a/js/apbct-public-bundle.min.js b/js/apbct-public-bundle.min.js index a75211562..56d47fb11 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(i.data.forEach(function(e){e.encoded_email===r[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===r[t].href||0!==r[t].href.indexOf("mailto:")&&0!==r[t].href.indexOf("tel:"))r[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r[t])},2e3);else{if(0===r[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==r[t].href.indexOf("tel:"))return 0;e="tel:"}var o=r[t].href.replace(e,""),a=r[t].innerHTML;r[t].innerHTML=a.replace(o,n.decoded_email),r[t].href=e+n.decoded_email,r[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";i.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.innerHTML=n})}r[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=i.data[0];r.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r)},2e3),r.removeEventListener("click",ctFillDecodedEmailHandler)}}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")}document.addEventListener("DOMContentLoaded",function(){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.host_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(i.data.forEach(function(e){e.encoded_email===r[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===r[t].href||0!==r[t].href.indexOf("mailto:")&&0!==r[t].href.indexOf("tel:"))r[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r[t])},2e3);else{if(0===r[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==r[t].href.indexOf("tel:"))return 0;e="tel:"}var o=r[t].href.replace(e,""),a=r[t].innerHTML;r[t].innerHTML=a.replace(o,n.decoded_email),r[t].href=e+n.decoded_email,r[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";i.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.innerHTML=n})}r[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=i.data[0];r.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r)},2e3),r.removeEventListener("click",ctFillDecodedEmailHandler)}}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 diff --git a/js/apbct-public-bundle_ext-protection.min.js b/js/apbct-public-bundle_ext-protection.min.js index 2495d0f51..621410ba8 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(i.data.forEach(function(e){e.encoded_email===r[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===r[t].href||0!==r[t].href.indexOf("mailto:")&&0!==r[t].href.indexOf("tel:"))r[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r[t])},2e3);else{if(0===r[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==r[t].href.indexOf("tel:"))return 0;e="tel:"}var o=r[t].href.replace(e,""),a=r[t].innerHTML;r[t].innerHTML=a.replace(o,n.decoded_email),r[t].href=e+n.decoded_email,r[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";i.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.innerHTML=n})}r[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=i.data[0];r.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r)},2e3),r.removeEventListener("click",ctFillDecodedEmailHandler)}}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")}document.addEventListener("DOMContentLoaded",function(){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.host_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(i.data.forEach(function(e){e.encoded_email===r[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===r[t].href||0!==r[t].href.indexOf("mailto:")&&0!==r[t].href.indexOf("tel:"))r[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r[t])},2e3);else{if(0===r[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==r[t].href.indexOf("tel:"))return 0;e="tel:"}var o=r[t].href.replace(e,""),a=r[t].innerHTML;r[t].innerHTML=a.replace(o,n.decoded_email),r[t].href=e+n.decoded_email,r[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";i.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.innerHTML=n})}r[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=i.data[0];r.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r)},2e3),r.removeEventListener("click",ctFillDecodedEmailHandler)}}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 diff --git a/js/apbct-public-bundle_ext-protection_gathering.min.js b/js/apbct-public-bundle_ext-protection_gathering.min.js index c7c09ae4e..d24774946 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(r.data.forEach(function(e){e.encoded_email===c[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===c[t].href||0!==c[t].href.indexOf("mailto:")&&0!==c[t].href.indexOf("tel:"))c[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,c[t])},2e3);else{if(0===c[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==c[t].href.indexOf("tel:"))return 0;e="tel:"}var o=c[t].href.replace(e,""),a=c[t].innerHTML;c[t].innerHTML=a.replace(o,n.decoded_email),c[t].href=e+n.decoded_email,c[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.innerHTML=n})}c[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=r.data[0];c.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,c)},2e3),c.removeEventListener("click",ctFillDecodedEmailHandler)}}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")}document.addEventListener("DOMContentLoaded",function(){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.host_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(r.data.forEach(function(e){e.encoded_email===c[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===c[t].href||0!==c[t].href.indexOf("mailto:")&&0!==c[t].href.indexOf("tel:"))c[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,c[t])},2e3);else{if(0===c[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==c[t].href.indexOf("tel:"))return 0;e="tel:"}var o=c[t].href.replace(e,""),a=c[t].innerHTML;c[t].innerHTML=a.replace(o,n.decoded_email),c[t].href=e+n.decoded_email,c[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.innerHTML=n})}c[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=r.data[0];c.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,c)},2e3),c.removeEventListener("click",ctFillDecodedEmailHandler)}}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 diff --git a/js/apbct-public-bundle_full-protection.min.js b/js/apbct-public-bundle_full-protection.min.js index 0a443cba6..d7a4c3849 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(c.data.forEach(function(e){e.encoded_email===r[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===r[t].href||0!==r[t].href.indexOf("mailto:")&&0!==r[t].href.indexOf("tel:"))r[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r[t])},2e3);else{if(0===r[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==r[t].href.indexOf("tel:"))return 0;e="tel:"}var o=r[t].href.replace(e,""),a=r[t].innerHTML;r[t].innerHTML=a.replace(o,n.decoded_email),r[t].href=e+n.decoded_email,r[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.innerHTML=n})}r[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=c.data[0];r.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r)},2e3),r.removeEventListener("click",ctFillDecodedEmailHandler)}}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")}document.addEventListener("DOMContentLoaded",function(){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.host_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+"
")})}}]))();function apbctForceProtect(){+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()}})}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(c.data.forEach(function(e){e.encoded_email===r[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===r[t].href||0!==r[t].href.indexOf("mailto:")&&0!==r[t].href.indexOf("tel:"))r[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r[t])},2e3);else{if(0===r[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==r[t].href.indexOf("tel:"))return 0;e="tel:"}var o=r[t].href.replace(e,""),a=r[t].innerHTML;r[t].innerHTML=a.replace(o,n.decoded_email),r[t].href=e+n.decoded_email,r[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.innerHTML=n})}r[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=c.data[0];r.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r)},2e3),r.removeEventListener("click",ctFillDecodedEmailHandler)}}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 diff --git a/js/apbct-public-bundle_full-protection_gathering.min.js b/js/apbct-public-bundle_full-protection_gathering.min.js index 0fc9cc71f..246094bbd 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(r.data.forEach(function(e){e.encoded_email===c[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===c[t].href||0!==c[t].href.indexOf("mailto:")&&0!==c[t].href.indexOf("tel:"))c[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,c[t])},2e3);else{if(0===c[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==c[t].href.indexOf("tel:"))return 0;e="tel:"}var o=c[t].href.replace(e,""),a=c[t].innerHTML;c[t].innerHTML=a.replace(o,n.decoded_email),c[t].href=e+n.decoded_email,c[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.innerHTML=n})}c[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=r.data[0];c.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,c)},2e3),c.removeEventListener("click",ctFillDecodedEmailHandler)}}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")}document.addEventListener("DOMContentLoaded",function(){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.host_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+"
")})}}]))();function apbctForceProtect(){+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(r.data.forEach(function(e){e.encoded_email===c[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===c[t].href||0!==c[t].href.indexOf("mailto:")&&0!==c[t].href.indexOf("tel:"))c[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,c[t])},2e3);else{if(0===c[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==c[t].href.indexOf("tel:"))return 0;e="tel:"}var o=c[t].href.replace(e,""),a=c[t].innerHTML;c[t].innerHTML=a.replace(o,n.decoded_email),c[t].href=e+n.decoded_email,c[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.innerHTML=n})}c[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=r.data[0];c.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,c)},2e3),c.removeEventListener("click",ctFillDecodedEmailHandler)}}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 diff --git a/js/apbct-public-bundle_gathering.min.js b/js/apbct-public-bundle_gathering.min.js index 0b3932296..2c1bc6848 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(c.data.forEach(function(e){e.encoded_email===r[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===r[t].href||0!==r[t].href.indexOf("mailto:")&&0!==r[t].href.indexOf("tel:"))r[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r[t])},2e3);else{if(0===r[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==r[t].href.indexOf("tel:"))return 0;e="tel:"}var o=r[t].href.replace(e,""),a=r[t].innerHTML;r[t].innerHTML=a.replace(o,n.decoded_email),r[t].href=e+n.decoded_email,r[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.innerHTML=n})}r[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=c.data[0];r.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r)},2e3),r.removeEventListener("click",ctFillDecodedEmailHandler)}}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")}document.addEventListener("DOMContentLoaded",function(){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.host_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||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(c.data.forEach(function(e){e.encoded_email===r[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===r[t].href||0!==r[t].href.indexOf("mailto:")&&0!==r[t].href.indexOf("tel:"))r[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r[t])},2e3);else{if(0===r[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==r[t].href.indexOf("tel:"))return 0;e="tel:"}var o=r[t].href.replace(e,""),a=r[t].innerHTML;r[t].innerHTML=a.replace(o,n.decoded_email),r[t].href=e+n.decoded_email,r[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.innerHTML=n})}r[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=c.data[0];r.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r)},2e3),r.removeEventListener("click",ctFillDecodedEmailHandler)}}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 diff --git a/js/apbct-public-bundle_int-protection.min.js b/js/apbct-public-bundle_int-protection.min.js index 0ade9e80c..38ae1f0ad 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(i.data.forEach(function(e){e.encoded_email===r[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===r[t].href||0!==r[t].href.indexOf("mailto:")&&0!==r[t].href.indexOf("tel:"))r[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r[t])},2e3);else{if(0===r[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==r[t].href.indexOf("tel:"))return 0;e="tel:"}var o=r[t].href.replace(e,""),a=r[t].innerHTML;r[t].innerHTML=a.replace(o,n.decoded_email),r[t].href=e+n.decoded_email,r[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";i.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.innerHTML=n})}r[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=i.data[0];r.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r)},2e3),r.removeEventListener("click",ctFillDecodedEmailHandler)}}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")}document.addEventListener("DOMContentLoaded",function(){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.host_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(i.data.forEach(function(e){e.encoded_email===r[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===r[t].href||0!==r[t].href.indexOf("mailto:")&&0!==r[t].href.indexOf("tel:"))r[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r[t])},2e3);else{if(0===r[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==r[t].href.indexOf("tel:"))return 0;e="tel:"}var o=r[t].href.replace(e,""),a=r[t].innerHTML;r[t].innerHTML=a.replace(o,n.decoded_email),r[t].href=e+n.decoded_email,r[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";i.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.innerHTML=n})}r[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=i.data[0];r.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r)},2e3),r.removeEventListener("click",ctFillDecodedEmailHandler)}}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 diff --git a/js/apbct-public-bundle_int-protection_gathering.min.js b/js/apbct-public-bundle_int-protection_gathering.min.js index ad981d2ae..cd4b27eff 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(c.data.forEach(function(e){e.encoded_email===r[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===r[t].href||0!==r[t].href.indexOf("mailto:")&&0!==r[t].href.indexOf("tel:"))r[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r[t])},2e3);else{if(0===r[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==r[t].href.indexOf("tel:"))return 0;e="tel:"}var o=r[t].href.replace(e,""),a=r[t].innerHTML;r[t].innerHTML=a.replace(o,n.decoded_email),r[t].href=e+n.decoded_email,r[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.innerHTML=n})}r[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=c.data[0];r.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r)},2e3),r.removeEventListener("click",ctFillDecodedEmailHandler)}}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")}document.addEventListener("DOMContentLoaded",function(){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.host_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||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(c.data.forEach(function(e){e.encoded_email===r[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===r[t].href||0!==r[t].href.indexOf("mailto:")&&0!==r[t].href.indexOf("tel:"))r[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r[t])},2e3);else{if(0===r[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==r[t].href.indexOf("tel:"))return 0;e="tel:"}var o=r[t].href.replace(e,""),a=r[t].innerHTML;r[t].innerHTML=a.replace(o,n.decoded_email),r[t].href=e+n.decoded_email,r[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.innerHTML=n})}r[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=c.data[0];r.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r)},2e3),r.removeEventListener("click",ctFillDecodedEmailHandler)}}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 diff --git a/js/cleantalk-admin.min.js b/js/cleantalk-admin.min.js index 0b11813d0..ad3da0640 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,""),i=c[n].innerHTML;c[n].innerHTML=i.replace(a,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.innerHTML=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 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})(),document.addEventListener("DOMContentLoaded",function(){var t=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=t),t.length)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,""),i=c[n].innerHTML;c[n].innerHTML=i.replace(a,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.innerHTML=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 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 {\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 let baseElementContent = encodedNodes[i].innerHTML;\n encodedNodes[i].innerHTML = baseElementContent.replace(\n encodedEmail,\n 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.innerHTML = 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 * @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\n// Listen clicks on encoded emails\ndocument.addEventListener('DOMContentLoaded', function() {\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","ctFillDecodedEmailHandler","event","clickSource","ctWlBrandname","encodedEmail","ctPublic","this","removeEventListener","encodedEmailNodesIsMixed","wl_brandname","encodedEmailNodes","ctAdminCommon","plugin_name","encodedEmailNode","body","add","popupHeaderWrapper","popupTextWrapper","popupTextWaiting","popupTextDecoding","encoderPopup","getElementById","setAttribute","ctPublicFunctions","text__ee_wait_for_decoding","innerHTML","waitingPopup","popupHeader","style","color","id","text__ee_decoding_process","apbctAjaxEmailDecodeBulk","data","post_url","location","href","referrer","encodedEmails","encodedEmailsCollection","bot_detector_enabled","event_token","apbctLocalStorage","get","event_javascript_data","getJavascriptClientData","indexOf","preventDefault","apbctTooltip","apbct","dataset","originalString","JSON","stringify","data__ajax_type","apbct_public_sendREST","method","callback","result","ctSetCookie","emailEncoderPassKey","apbctEmailEncoderCallbackBulk","onErrorCallback","res","resetEncodedNodes","ctShowDecodeComment","action","apbct_public_sendAJAX","notJson","0","appendChild","apbct_admin_sendAJAX","success","is_allowed","setTimeout","popup","email","currentResultData","forEach","row","encoded_email","decoded_email","split","firstNode","querySelector","selectableEmail","wrapper","text__ee_click_to_select","title","text__ee_original_email","outerHTML","secondNode","remove","buttonWrapper","button","text__ee_got_it","addEventListener","fillDecodedNodes","click","comment","hasOwnProperty","text__ee_blocked","text__ee_cannot_connect","console","log","element","text__ee_cannot_decode","popupText","text__ee_email_decoder","encodedNodes","decodingResult","ctProcessDecodedDataResult","linkTypePrefix","replace","baseElementContent","querySelectorAll","encodedEmailTextInsideMailto","el","response","targetElement","removeAttribute","ctFillDecodedEmail","target","__","wp","i18n","params","obj","callbackContext","callback_context","callbackParams","callback_params","async","timeout","spinner","progressbar","_ajax_nonce","Math","random","no_cache","cursor","jQuery","css","ajax","type","url","_ajax_url","parse","error","fadeOut","cleantalkModal","loaded","toString","open","alert","apply","concat","jqXHR","textStatus","errorThrown","ready","$","on","ctDate","Date","getTime","ctSecure","protocol","cookie","toUTCString","e","apbctNoticeName","parent","attr","notice_id","confirm","notice_when_deleting_user_text","window","btnForceProtectionOn","checked","apbctNoticeForceProtectionOn","spmOrderId","order_id","reload","message","container","containerHeader","linkHeaderWrapper","modalContent","empty","wcOrderData","createTableFromObject","key","value","tableWrapperInner","header","className","table","textContent","tbody","Object","entries","keyCell","valueCell","order_details","orderDetails","productName","customer_details","linkHeader","URL","rel","textAlign","text","xhr","status","includes","ctEmailDecoderIsInitialized","node","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,CAKA,SAAAU,0BAAAC,EAAA,CAAA,GACAP,IAAAQ,EAAA,CAAA,EACAC,EAAA,GACAC,EAAA,GACA,aAAA,OAAAC,UACAC,KAAAC,oBAAA,QAAAP,yBAAA,EAEAE,EAAAI,KAEAD,SAAAG,yBAAA,CAAA,EACAL,EAAAE,SAAAI,aACAL,EAAAC,SAAAK,mBACA,aAAA,OAAAC,gBACAR,EAAAQ,cAAAC,YACAR,EAAAO,cAAAE,kBAIAtB,SAAAuB,KAAArB,UAAAsB,IAAA,kBAAA,EAEArB,IAQAsB,EAQAC,EAOAC,EAWAC,EAlCAC,EAAA7B,SAAA8B,eAAA,aAAA,EACAD,GAiDAA,EAAAE,aAAA,QAAA,kBAAA,EACA,aAAA,OAAAC,mBAAAA,kBAAAC,2BACAjC,SAAA8B,eAAA,kBAAA,EAAAI,UAAAF,kBAAAC,2BAEAjC,SAAA8B,eAAA,kBAAA,EAAAI,UAAAd,cAAAa,8BAnDAE,EAAAnC,SAAAC,cAAA,KAAA,GACA8B,aAAA,QAAA,uCAAA,EACAI,EAAAJ,aAAA,KAAA,aAAA,GAGAN,EAAAzB,SAAAC,cAAA,MAAA,GACAC,UAAA,uCACAkC,EAAApC,SAAAC,cAAA,GAAA,GACAM,UAAAK,EACAwB,EAAAL,aAAA,QAAA,mCAAA,EACAN,EAAAjB,OAAA4B,CAAA,GAGAV,EAAA1B,SAAAC,cAAA,KAAA,GACA8B,aAAA,KAAA,kBAAA,EACAL,EAAAK,aAAA,QAAA,qCAAA,EACAL,EAAAW,MAAAC,MAAA,SAIAX,EAAA3B,SAAAC,cAAA,GAAA,GACAsC,GAAA,4CACA,aAAA,OAAAP,mBAAAA,kBAAAC,2BACAN,EAAApB,UAAAyB,kBAAAC,2BAEAN,EAAApB,UAAAa,cAAAa,2BAEAN,EAAAI,aAAA,QAAA,qCAAA,GAIAH,EAAA5B,SAAAC,cAAA,GAAA,GACAsC,GAAA,6CACA,aAAA,OAAAP,mBAAAA,kBAAAQ,0BACAZ,EAAArB,UAAAyB,kBAAAQ,0BAEAZ,EAAArB,UAAAa,cAAAoB,0BAIAd,EAAAlB,OAAAmB,CAAA,EACAD,EAAAlB,OAAAoB,CAAA,EACAO,EAAA3B,OAAAiB,CAAA,EACAU,EAAA3B,OAAAkB,CAAA,EACAS,EAAA3B,OAAAX,mCAAA,CAAA,EACAG,SAAAuB,KAAAf,OAAA2B,CAAA,GAUAM,yBAAA/B,EAAAG,EAAAF,CAAA,CACA,CAOA,SAAA8B,yBAAA/B,EAAAS,EAAAR,GACA,GAAAD,GAAAC,EAAA,CAEAR,IAAAuC,EAAA,CACAC,SAAA3C,SAAA4C,SAAAC,KACAC,SAAA9C,SAAA8C,SACAC,cAAA,EACA,EAOAC,GANA,CAAAlC,SAAAmC,qBACAP,EAAAQ,YAAAC,kBAAAC,IAAA,0BAAA,EAEAV,EAAAW,sBAAAC,wBAAA,EAGA,IACA,IAAAnD,IAAAC,EAAA,EAAAA,EAAAe,EAAAd,OAAAD,CAAA,GAAA,CAGA,KAAA,IAAAe,EAAAf,GAAAyC,MACA,IAAA1B,EAAAf,GAAAyC,KAAAU,QAAA,SAAA,IAEA7C,EAAA8C,eAAA,EACA1C,SAAAG,yBAAA,CAAA,GAIAd,IAAAsD,EAAAzD,SAAAC,cAAA,KAAA,EACAwD,EAAA1B,aAAA,QAAA,eAAA,EACA2B,MAAAvC,EAAAf,EAAA,EAAAI,OAAAiD,CAAA,EAGAT,EAAA5C,GAAAe,EAAAf,GAAAuD,QAAAC,cACA,CAGAlB,EAAAK,cAAAc,KAAAC,UAAAd,CAAA,EAGA,SAAAhB,kBAAA+B,gBACAC,sBACA,qBACA,CACAtB,KAAAA,EACAuB,OAAA,OACAC,SAAA,SAAAC,GAEAC,YAAA,6BAAAtD,SAAAuD,oBAAA,EAAA,EACAC,8BAAAH,EAAAhD,EAAAR,CAAA,CACA,EACA4D,gBAAA,SAAAC,GACAC,kBAAA,EACAC,oBAAAF,CAAA,CACA,CACA,CACA,GAIA9B,EAAAiC,OAAA,qBACAC,sBACAlC,EACA,CACAmC,QAAA,CAAA,EACAX,SAAA,SAAAC,GAEAC,YAAA,6BAAAtD,SAAAuD,oBAAA,EAAA,EACAC,8BAAAH,EAAAhD,EAAAR,CAAA,CACA,EACA4D,gBAAA,SAAAC,GACAC,kBAAA,EACAC,oBAAAF,CAAA,CACA,CACA,CACA,EAEA,KAAA,CACA,IAAA3D,EAAAM,EAAAwC,QAAAC,eACAlB,EAAA,CACAK,cAAAc,KAAAC,UAAA,CAAAgB,EAAAjE,CAAA,CAAA,CACA,EAGA4C,EAAAzD,SAAAC,cAAA,KAAA,EACAwD,EAAA1B,aAAA,QAAA,eAAA,EACAZ,EAAA4D,YAAAtB,CAAA,EAEAuB,qBACA,CACAL,OAAA,qBACA5B,cAAAL,EAAAK,aACA,EACA,CACAmB,SAAA,SAAAC,GACAG,8BAAAH,EAAAhD,EAAA,CAAA,CAAA,CACA,EACA0D,QAAA,CAAA,CACA,CACA,CACA,CACA,CAOA,SAAAP,8BAAAH,EAAAhD,EAAAR,EAAA,CAAA,GACA,GAAAwD,EAAAc,SAAA,CAAA,IAAAd,EAAAzB,KAAA,GAAAwC,WAEAC,WAAA,WAEAhF,IAAAiF,EAAApF,SAAA8B,eAAA,aAAA,EACA,GAAA,OAAAsD,EAAA,CACAjF,IAAAkF,EAAA,GACA,GAAA1E,EAAA,CACAR,IAAAmF,EACAnB,EAAAzB,KAAA6C,QAAA,IACAC,EAAAC,gBAAA9E,EAAAgD,QAAAC,iBACA0B,EAAAE,EAEA,CAAA,EAEAH,EAAAC,EAAAI,cAAAC,MAAA,MAAA,EAAA,EACA,MACAN,EAAAlB,EAAAzB,KAAA,GAAAgD,cAGAvF,IAAAyF,EAAAR,EAAAS,cAAA,4CAAA,EAEAC,EAAA9F,SAAAC,cAAA,GAAA,EAqBA8F,GApBAD,EAAA/D,aAAA,QAAA,wCAAA,EACA+D,EAAAvF,UAAA8E,EACA,aAAA,OAAArD,mBAAAA,kBAAAgE,yBACAF,EAAAG,MAAAjE,kBAAAgE,yBAEAF,EAAAG,MAAA7E,cAAA4E,yBAGAJ,IACA,aAAA,OAAA5D,mBAAAA,kBAAAkE,wBACAN,EAAA1D,UAAAF,kBAAAkE,wBACA,SAAAJ,EAAAK,UAEAP,EAAA1D,UAAAd,cAAA8E,wBACA,SAAAJ,EAAAK,UAGAP,EAAA7D,aAAA,QAAA,sBAAA,GAGAqD,EAAAS,cAAA,6BAAA,GAKAO,GAJAL,GACAA,EAAAM,OAAA,EAGAjB,EAAAS,cAAA,6CAAA,GAKAS,GAJAF,GACAA,EAAAC,OAAA,EAGArG,SAAAC,cAAA,MAAA,GACAqG,EAAApG,UAAA,sDACAF,SAAA6F,cAAA,oCAAA,IACAU,EAAAvG,SAAAC,cAAA,QAAA,EACA,aAAA,OAAA+B,mBAAAA,kBAAAwE,gBACAD,EAAAhG,UAAAyB,kBAAAwE,gBAEAD,EAAAhG,UAAAa,cAAAoF,gBAEAD,EAAArG,UAAA,oCACAqG,EAAAE,iBAAA,QAAA,WACAzG,SAAAuB,KAAArB,UAAAmG,OAAA,kBAAA,EACAjB,EAAArD,aAAA,QAAA,cAAA,EACA2E,iBAAAvF,EAAAgD,CAAA,EAEA,aAAA,OAAArD,UAAAA,SAAAG,0BAAAN,GACAA,EAAAgG,MAAA,CAEA,CAAA,EACAL,EAAA9F,OAAA+F,CAAA,EACAnB,EAAA5E,OAAA8F,CAAA,EAEA,CACA,EAAA,GAAA,OAEA,GAAA3F,EAAA,CACAR,IAAAyG,EAAA,gBAEAzC,EAAA0C,eAAA,MAAA,GACA,EAAA1C,EAAAzB,KAAArC,QACA,UAAA,OAAA8D,EAAAzB,KAAA,IACA,UAAA,OAAAyB,EAAAzB,KAAA,GAAAkE,UAEAA,EAAAzC,EAAAzB,KAAA,GAAAkE,SAEAzC,EAAAc,SACAR,kBAAA,EACA,aAAA,OAAAzC,mBAAAA,kBAAA8E,iBACApC,oBAAA1C,kBAAA8E,iBAAA,KAAAF,CAAA,EAEAlC,oBAAAtD,cAAA0F,iBAAA,KAAAF,CAAA,IAGAnC,kBAAA,EACA,aAAA,OAAAzC,mBAAAA,kBAAA+E,wBACArC,oBAAA1C,kBAAA+E,wBAAA,KAAAH,CAAA,EAEAlC,oBAAAtD,cAAA2F,wBAAA,KAAAH,CAAA,EAGA,MACAI,QAAAC,IAAA,SAAA9C,CAAA,CAGA,CAKA,SAAAM,oBACA,KAAA,IAAA3D,SAAAK,mBACAL,SAAAK,kBAAAoE,QAAA,SAAA2B,GACAA,EAAAT,iBAAA,QAAAhG,yBAAA,CACA,CAAA,CAEA,CAMA,SAAAiE,oBAAAkC,GACAA,EAAAA,IACA,aAAA,OAAA5E,mBAAAA,kBAAAmF,uBACAnF,kBAEAZ,eAFA+F,uBAMAhH,IAAAiF,EAAApF,SAAA8B,eAAA,aAAA,EACA3B,IAAAiH,EAAApH,SAAA8B,eAAA,kBAAA,EACA,OAAAsD,IACApF,SAAAuB,KAAArB,UAAAmG,OAAA,kBAAA,EACA,aAAA,OAAArE,mBAAAA,kBAAAqF,uBACAD,EAAA7G,UAAAyB,kBAAAqF,uBAAA,KAAAT,EAEAQ,EAAA7G,UAAAa,cAAAiG,uBAAA,KAAAT,EAEAzB,WAAA,WACAC,EAAArD,aAAA,QAAA,cAAA,CACA,EAAA,GAAA,EAEA,CAOA,SAAA2E,iBAAAY,EAAAC,GACA,GAAA,EAAAD,EAAAjH,OACA,IAAAF,IAAAC,EAAA,EAAAA,EAAAkH,EAAAjH,OAAAD,CAAA,GAAA,CAEAD,IAAAmF,EAOA,GANAiC,EAAA7E,KAAA6C,QAAA,IACAC,EAAAC,gBAAA6B,EAAAlH,GAAAuD,QAAAC,iBACA0B,EAAAE,EAEA,CAAA,EAEA,CAAA,IAAAF,EAAAJ,WACA,OAGA,GACA,KAAA,IAAAoC,EAAAlH,GAAAyC,MAEA,IAAAyE,EAAAlH,GAAAyC,KAAAU,QAAA,SAAA,GACA,IAAA+D,EAAAlH,GAAAyC,KAAAU,QAAA,MAAA,EA6BA+D,EAAAlH,GAAAF,UAAAsB,IAAA,SAAA,EAEA2D,WAAA,KACAqC,2BAAAlC,EAAAgC,EAAAlH,EAAA,CACA,EAAA,GAAA,MA/BA,CACAD,IAAAsH,EACA,GAAA,IAAAH,EAAAlH,GAAAyC,KAAAU,QAAA,SAAA,EACAkE,EAAA,cACA,CAAA,GAAA,IAAAH,EAAAlH,GAAAyC,KAAAU,QAAA,MAAA,EAGA,SAFAkE,EAAA,MAGA,CACAtH,IAAAU,EAAAyG,EAAAlH,GAAAyC,KAAA6E,QAAAD,EAAA,EAAA,EACAE,EAAAL,EAAAlH,GAAA8B,UACAoF,EAAAlH,GAAA8B,UAAAyF,EAAAD,QACA7G,EACAyE,EAAAI,aACA,EACA4B,EAAAlH,GAAAyC,KAAA4E,EAAAnC,EAAAI,cAEA4B,EAAAlH,GAAAwH,iBAAA,0BAAA,EAAArC,QAAA,IACApF,IAAA0H,EAAA,GACAN,EAAA7E,KAAA6C,QAAA,IACAC,EAAAC,gBAAAqC,EAAAnE,QAAAC,iBACAiE,EAAArC,EAAAE,cAEA,CAAA,EACAoC,EAAA5F,UAAA2F,CACA,CAAA,CACA,CAQAP,EAAAlH,GAAAY,oBAAA,QAAAP,yBAAA,CACA,KACA,CACAN,IAAAmF,EAAAiC,EAAA7E,KAAA,GACA4E,EAAApH,UAAAsB,IAAA,SAAA,EAEA2D,WAAA,KACAqC,2BAAAlC,EAAAgC,CAAA,CACA,EAAA,GAAA,EACAA,EAAAtG,oBAAA,QAAAP,yBAAA,CACA,CACA,CAMA,SAAA+G,2BAAAO,EAAAC,GACAA,EAAAjG,aAAA,QAAA,EAAA,EACAiG,EAAAC,gBAAA,OAAA,EACAC,mBAAAF,EAAAD,EAAArC,aAAA,CACA,CAMA,SAAAwC,mBAAAC,EAAA9C,GACA8C,EAAAjG,UAAAiG,EAAAjG,UAAAwF,QAAA,kDAAArC,EAAA,IAAA,CACA,ECjcA,KACA,IAAA+C,EAAAC,GAAAC,KAAA,GAwOA,SAAAtD,EAAAtC,EAAA6F,EAAAC,GAEArI,IAAA+D,EAAAqE,EAAArE,UAAA,KACAuE,EAAAF,EAAAG,kBAAA,KACAC,EAAAJ,EAAAK,iBAAA,KACAzI,IAAA0I,EAAAN,EAAAM,OAAA,CAAA,EACA1I,IAAA0E,EAAA0D,EAAA1D,SAAA,KACA1E,IAAA2I,EAAAP,EAAAO,SAAA,KACAN,EAAAA,GAAA,KACArI,IAAAoG,EAAAgC,EAAAhC,QAAA,KACAwC,EAAAR,EAAAQ,SAAA,KACAC,EAAAT,EAAAS,aAAA,KAEA,UAAA,OAAA,EACAtG,EAAAA,EAAA,gBAAAtB,cAAA6H,YAAA,aAAAC,KAAAC,OAAA,GAEAzG,EAAAuG,YAAA7H,cAAA6H,YACAvG,EAAA0G,SAAAF,KAAAC,OAAA,GAGA5C,IACAA,EAAAxE,aAAA,WAAA,UAAA,EAAAwE,EAAAlE,MAAAgH,OAAA,eAEAN,GAAAO,OAAAP,CAAA,EAAAQ,IAAA,UAAA,QAAA,EAEAD,OAAAE,KAAA,CACAC,KAAA,OACAC,IAAAtI,cAAAuI,UACAjH,KAAAA,EACAmG,MAAAA,EACA5D,QAAA,SAAAd,GACAoC,IACAA,EAAA0B,gBAAA,UAAA,EAAA1B,EAAAlE,MAAAgH,OAAA,WAEAN,GAAAO,OAAAP,CAAA,EAAAQ,IAAA,UAAA,MAAA,GACApF,EAAAU,EACAV,EADAN,KAAA+F,MAAAzF,CAAA,GACA0F,OACA1E,WAAA,WACA6D,GAAAA,EAAAc,QAAA,MAAA,CACA,EAAA,GAAA,EACA,aAAA,OAAAC,gBAEAA,eAAAC,OAAA,aAAA7F,EAAA0F,MAAAI,SAAA,EACAF,eAAAG,KAAA,GAEAC,MAAA,mBAAAhG,EAAA0F,OAAA,SAAA,GAGA3F,IACAyE,EACAzE,EAAAkG,MAAA3B,EAAAE,EAAA0B,OAAAlG,EAAAzB,EAAA6F,EAAAC,CAAA,CAAA,EAEAtE,EAAAC,EAAAzB,EAAA6F,EAAAC,CAAA,EAIA,EACAqB,MAAA,SAAAS,EAAAC,EAAAC,GACAjE,IACAA,EAAA0B,gBAAA,UAAA,EAAA1B,EAAAlE,MAAAgH,OAAA,WAEAN,GAAAO,OAAAP,CAAA,EAAAQ,IAAA,UAAA,MAAA,EACAvC,QAAAC,IAAA,kBAAA,EACAD,QAAAC,IAAAqD,CAAA,EACAtD,QAAAC,IAAAsD,CAAA,EACAvD,QAAAC,IAAAuD,CAAA,CACA,EACA1B,QAAAA,CACA,CAAA,CACA,CA5SAQ,OAAAtJ,QAAA,EAAAyK,MAAA,SAAAC,GAEApB,OAAA,sBAAA,EAAAqB,GAAA,QAAA,SAAA,WACAxK,IAAAyK,EAAA,IAAAC,MAAA,IAAAA,MAAAC,QAAA,EAAA,MAAA,EACAC,EAAA,WAAAnI,SAAAoI,SAAA,WAAA,GACAhL,SAAAiL,OAAA,iDACAL,EAAAM,YAAA,EAAA,iBAAAH,CACA,CAAA,EAEAzB,OAAA,iDAAA,EAAAC,IAAA,cAAA,QAAA,EACAA,IAAA,UAAA,cAAA,EAEAD,OAAA,MAAA,EAAAqB,GAAA,QAAA,gCAAA,SAAAQ,GACAC,EAAA9B,OAAA6B,EAAAhD,MAAA,EAAAkD,OAAA,EAAAC,KAAA,IAAA,EACAF,GACApG,EACA,CACAL,OAAA,2BACA4G,UAAAH,CACA,EACA,CACAlH,SAAA,KACAW,QAAA,CAAA,CACA,CACA,CAEA,CAAA,EAGAyE,OAAA,qCAAA,EAAAqB,GAAA,QAAA,SAAAQ,GACAA,EAAA3H,eAAA,EAEAgI,QAAApK,cAAAqK,8BAAA,IAGAC,OAAA9I,SAAA7B,KAAA8B,KAEA,CAAA,EAEA1C,IAAAwL,EAAA3L,SAAA6F,cAAA,4CAAA,EA2GA,IACAvE,EA3GAqK,GACAA,EAAAlF,iBAAA,QAAA,SAAA0E,GACAQ,EAAAC,SACAJ,CAAAA,QAAApK,cAAAyK,4BAAA,GAGAV,EAAA3H,eAAA,CAGA,CAAA,EAGAkH,EAAA,kCAAA,EAAA/D,MAAA,WACA,IAAAmF,EAAApB,EAAA3J,IAAA,EAAA2B,KAAA,eAAA,EACAA,EAAA,CACAiC,OAAA,2BACAsE,YAAA7H,cAAA6H,YACA8C,SAAAD,CACA,EACApB,EAAAlB,KAAA,CACAC,KAAA,OACAC,IAAAtI,cAAAuI,UACAjH,KAAAA,EACAuC,QAAA,SAAAd,GACAA,EAAAc,QACAyG,OAAA9I,SAAAoJ,OAAA,EAEA7B,MAAAhG,EAAAzB,KAAAuJ,OAAA,CAEA,CACA,CAAA,CACA,CAAA,EAGAvB,EAAA,kCAAA,EAAA/D,MAAA,WACA,IAAAmF,EAAApB,EAAA3J,IAAA,EAAA2B,KAAA,eAAA,EACAA,EAAA,CACAiC,OAAA,2BACAsE,YAAA7H,cAAA6H,YACA8C,SAAAD,CACA,EACA,aAAA,OAAA/B,gBACAA,eAAAC,OAAA,CAAA,EACAD,eAAAG,KAAA,CAAA,CAAA,EACAQ,EAAAlB,KAAA,CACAC,KAAA,OACAC,IAAAtI,cAAAuI,UACAjH,KAAAA,EACAuC,QAAA,SAAAd,GACA,IAGA+H,EACAC,EAEAC,EAuBAvC,EA7BAwC,EAAA3B,EAAA,0BAAA,EACA2B,EAAAC,MAAA,EACAnI,EAAAc,SAAAd,EAAAzB,MACAwJ,GAqEAK,IACA,IAAAL,EAAAlM,SAAAC,cAAA,KAAA,EASA,SAAAuM,EAAAhE,EAAAvC,GACA,IAYAwG,EAAAC,EAZAC,EAAA3M,SAAAC,cAAA,KAAA,EAGA2M,GAFAD,EAAAE,UAAA,wCAEA7M,SAAAC,cAAA,IAAA,GAIA6M,GAHAF,EAAAG,YAAA9G,EACA0G,EAAA5H,YAAA6H,CAAA,EAEA5M,SAAAC,cAAA,OAAA,GAGA+M,GAFAF,EAAAD,UAAA,0BAEA7M,SAAAC,cAAA,OAAA,GAEA,IAAA,CAAAwM,EAAAC,KAAAO,OAAAC,QAAA1E,CAAA,EAAA,CACA,IAAAhD,EAAAxF,SAAAC,cAAA,IAAA,EAEAkN,EAAAnN,SAAAC,cAAA,IAAA,EAIAmN,GAHAD,EAAAN,UAAA,mCACAM,EAAAJ,YAAAN,EAEAzM,SAAAC,cAAA,IAAA,GACAmN,EAAAP,UAAA,qCAEA,UAAA,OAAAH,GAAA,OAAAA,GACAU,EAAAL,YAAAlJ,KAAAC,UAAA4I,EAAA,KAAA,CAAA,EACAU,EAAAlN,UAAAsB,IAAA,0CAAA,GAEA4L,EAAAL,YAAAL,MAAAA,EAAAA,EAAA,IAGAlH,EAAAT,YAAAoI,CAAA,EACA3H,EAAAT,YAAAqI,CAAA,EACAJ,EAAAjI,YAAAS,CAAA,CACA,CAIA,OAFAsH,EAAA/H,YAAAiI,CAAA,EACAL,EAAA5H,YAAA+H,CAAA,EACAH,CACA,CAEA,GAhDAT,EAAAW,UAAA,4BAgDAN,EAAAc,cAAA,CACA,IACAZ,EAAAC,EADAY,EAAAf,EAAAc,cACA,IAAA,CAAAZ,EAAAC,KAAAO,OAAAC,QAAAI,CAAA,EAAA,CACA,IAAAC,EAAAD,EAAAb,IAAA,UAAA,OAAAa,EAAAb,GAAA,aACAa,EAAAb,GAAA,aACArE,EAAA,uBAAA,wBAAA,EACAwE,EAAAxE,EAAA,oBAAA,wBAAA,EACA8D,EAAAnH,YAAAyH,EAAAE,EAAAE,EAAA,IAAAW,CAAA,CAAA,CACA,CACA,CAQA,OANAhB,EAAAiB,kBACAtB,EAAAnH,YACAyH,EAAAD,EAAAiB,iBAAA,kBAAA,CACA,EAGAtB,CACA,GAzIA/H,EAAAzB,IAAA,EACAyJ,EAAAnM,SAAAC,cAAA,IAAA,EACAwN,EAAAzN,SAAAC,cAAA,GAAA,EACAmM,EAAApM,SAAAC,cAAA,GAAA,EACAkM,EAAAU,UAAA,2CACAV,EAAAY,YAAA3E,EACA,iCACA,wBACA,EACAqF,EAAA5K,KAAA,IAAA6K,IACA,mEACA,EAAAzD,SAAA,EACAwD,EAAAE,IAAA,sBACAF,EAAAtF,OAAA,SACAsF,EAAAV,YAAAU,EAAA5K,KACAuJ,EAAAW,YAAA3E,EACA,kEACA,wBACA,EACAgE,EAAA/J,MAAAuL,UAAA,SACAxB,EAAArH,YAAA0I,CAAA,EAEApB,EAAA7L,OAAA2L,CAAA,EACAE,EAAA7L,OAAA4L,CAAA,EACAC,EAAA7L,OAAA0L,CAAA,IAEArC,EAAA1F,GAAAA,EAAAzB,MAAAyB,EAAAzB,KAAAmH,MACA1F,EAAAzB,KAAAmH,MACAzB,EAAA,yBAAA,wBAAA,EACAiE,EAAAwB,KAAAhE,CAAA,GAEAE,eAAAC,OAAA,CAAA,CACA,EACAH,MAAA,SAAAiE,EAAAC,EAAAlE,GACA7C,QAAA6C,MAAA,cAAAA,CAAA,EACAM,MACA/B,EACA,4EACA,wBACA,CACA,CACA,CACA,CAAA,GAEA+B,MACA/B,EACA,6CACA,wBACA,CACA,CAEA,CAAA,EAGAsD,OAAA9I,SAAAC,KAAAmL,SAAA,oCAAA,IACA1M,EAAAtB,SAAA6F,cAAA,wBAAA,MAEAzE,cAAAE,iBAAAA,GACAe,MAAAgH,OAAA,UACA/H,EAAAmF,iBAAA,QAAAhG,yBAAA,EAGA,CAAA,EAsJAiL,OAAA1G,qBAAAA,CACA,GAAA,EDgJA7E,IAAA8N,4BAAA,CAAA,EAGAjO,SAAAyG,iBAAA,mBAAA,WAEA,GAAAwH,CAAAA,4BAAA,CAGAA,4BAAA,CAAA,EAEA9N,IAAAgB,EAAAnB,SAAA4H,iBAAA,wBAAA,EAIA,GAHA,aAAA,OAAA9G,WACAA,SAAAK,kBAAAA,GAEAA,EAAAd,OACA,IAAAF,IAAAC,EAAA,EAAAA,EAAAe,EAAAd,OAAA,EAAAD,EAAA,CACA,IAAA8N,EAAA/M,EAAAf,GAEA8N,EAAAC,YACA,MAAAD,EAAAC,WAAAC,SACAF,EAAAC,WAAAE,aAAA,MAAA,GAAAL,SAAA,SAAA,GACAE,EAAAC,WAAAG,aAAA,sBAAA,GAKAJ,EAAAzH,iBAAA,QAAAhG,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\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 // 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 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 } 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\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 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 let baseElementContent = encodedNodes[i].innerHTML;\n encodedNodes[i].innerHTML = baseElementContent.replace(\n encodedEmail,\n 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.innerHTML = 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 * @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 diff --git a/js/prebuild/apbct-public-bundle.js b/js/prebuild/apbct-public-bundle.js index 9748b2dab..392d7018a 100644 --- a/js/prebuild/apbct-public-bundle.js +++ b/js/prebuild/apbct-public-bundle.js @@ -449,8 +449,16 @@ function ctFillDecodedEmail(target, email) { target.innerHTML = target.innerHTML.replace(/.+?(
)/, email + '$1'); } +let ctEmailDecoderIsInitialized = false; + // Listen clicks on encoded emails document.addEventListener('DOMContentLoaded', function() { + // Some plugins dispatch a synthetic DOMContentLoaded, listeners must not be attached twice + if (ctEmailDecoderIsInitialized) { + return; + } + ctEmailDecoderIsInitialized = true; + let encodedEmailNodes = document.querySelectorAll('[data-original-string]'); if (typeof ctPublic !== 'undefined') { ctPublic.encodedEmailNodes = encodedEmailNodes; @@ -1753,7 +1761,7 @@ class ApbctXhr { 'initial_request_params': initialRequestParams, }; params.notJson = true; - params.url = ctPublicFunctions.host_url; + params.url = ctPublicFunctions._ajax_url; // this callback will rerun the XHR with initial params params.callback = function(...args) { // the refresh result itself @@ -3199,6 +3207,21 @@ class ApbctHandler { return false; } + /** + * Forms with an inline onsubmit whose returned value controls the submit. + * A deferred call loses that value and lets the form submit natively. + * @param {object} form + * @return {boolean} + */ + prevCallSyncRequired(form) { + if (form.classList === undefined) { + return false; + } + + // Pagelayer contact form: onsubmit="return pagelayer_contact_submit(this, event)" + return form.classList.contains('pagelayer-contact-form'); + } + /** * Catch main * @param {object} form @@ -3206,6 +3229,12 @@ class ApbctHandler { * @return {void} */ catchMain(form, index) { + // Third-party plugins may re-fire DOMContentLoaded. Double wrapping makes onsubmit_prev recursive. + if (form.apbctCatchMainAttached) { + return; + } + form.apbctCatchMainAttached = true; + form.onsubmit_prev = form.onsubmit; form.ctFormIndex = index; @@ -3218,6 +3247,9 @@ class ApbctHandler { if (event.target.classList !== undefined && event.target.classList.contains('brave_form_form')) { event.preventDefault(); } + if (handler.prevCallSyncRequired(event.target)) { + return event.target.onsubmit_prev.call(event.target, event); + } setTimeout(function() { event.target.onsubmit_prev.call(event.target, event); }, 0); @@ -4488,6 +4520,13 @@ class ApbctHandler { sourceSign.keepUnwrapped = true; } + // WooCommerce Stripe UPE confirms the card on Add payment method before the form is posted. + // Keep the token unwrapped: PHP reads the top-level POST field. + if ( dataString.indexOf('action=wc_stripe_create_and_confirm_setup_intent') !== -1 ) { + sourceSign.found = 'action=wc_stripe_create_and_confirm_setup_intent'; + sourceSign.keepUnwrapped = true; + } + // woocommerce add to cart is based on URL if ( typeof ajaxObject.url === 'string' && ajaxObject.url.indexOf('wc-ajax=add_to_cart') !== -1 ) { sourceSign.found = 'wc-ajax=add_to_cart'; @@ -5627,11 +5666,19 @@ async function apbctImportScript(scriptAbsolutePath) { }); } +let apbctReadyIsDone = false; + /** * Ready function */ // eslint-disable-next-line camelcase,require-jsdoc async function apbct_ready() { + // Some plugins dispatch a synthetic DOMContentLoaded, so the whole init must not run twice + if (apbctReadyIsDone) { + return; + } + apbctReadyIsDone = true; + // Only set ct_checkjs if the key is actually provided (not on block pages) if (typeof ctPublic.ct_checkjs_key !== 'undefined' && ctPublic.ct_checkjs_key !== null) { apbctLocalStorage.set('ct_checkjs', ctPublic.ct_checkjs_key, true); @@ -6295,6 +6342,10 @@ function apbctIntegrateDynamicEmailCheck({ // eslint-disable-line no-unused-vars // If there are email inputs inside the added node node.querySelectorAll && node.querySelectorAll(emailSelector).forEach(function(input) { + // do not touch inputs outside of the integrated form + if (!input.closest(formSelector)) { + return; + } if (!input.hasAttribute(attribute)) { input.addEventListener('blur', ctDebounceFuncExec(handler, debounce)); input.setAttribute(attribute, '1'); @@ -6364,7 +6415,15 @@ if (Math.floor(Math.random() * 100) === 1) { }; } +let ctTrpIsInitialized = false; + document.addEventListener('DOMContentLoaded', function() { + // Some plugins dispatch a synthetic DOMContentLoaded, badges must not be built twice + if (ctTrpIsInitialized) { + return; + } + ctTrpIsInitialized = true; + let ctTrpLocalize = undefined; let ctTrpIsAdminCommentsList = false; diff --git a/js/prebuild/apbct-public-bundle_ext-protection.js b/js/prebuild/apbct-public-bundle_ext-protection.js index 8518e1712..9dcaa02e0 100644 --- a/js/prebuild/apbct-public-bundle_ext-protection.js +++ b/js/prebuild/apbct-public-bundle_ext-protection.js @@ -449,8 +449,16 @@ function ctFillDecodedEmail(target, email) { target.innerHTML = target.innerHTML.replace(/.+?(
)/, email + '$1'); } +let ctEmailDecoderIsInitialized = false; + // Listen clicks on encoded emails document.addEventListener('DOMContentLoaded', function() { + // Some plugins dispatch a synthetic DOMContentLoaded, listeners must not be attached twice + if (ctEmailDecoderIsInitialized) { + return; + } + ctEmailDecoderIsInitialized = true; + let encodedEmailNodes = document.querySelectorAll('[data-original-string]'); if (typeof ctPublic !== 'undefined') { ctPublic.encodedEmailNodes = encodedEmailNodes; @@ -1753,7 +1761,7 @@ class ApbctXhr { 'initial_request_params': initialRequestParams, }; params.notJson = true; - params.url = ctPublicFunctions.host_url; + params.url = ctPublicFunctions._ajax_url; // this callback will rerun the XHR with initial params params.callback = function(...args) { // the refresh result itself @@ -3199,6 +3207,21 @@ class ApbctHandler { return false; } + /** + * Forms with an inline onsubmit whose returned value controls the submit. + * A deferred call loses that value and lets the form submit natively. + * @param {object} form + * @return {boolean} + */ + prevCallSyncRequired(form) { + if (form.classList === undefined) { + return false; + } + + // Pagelayer contact form: onsubmit="return pagelayer_contact_submit(this, event)" + return form.classList.contains('pagelayer-contact-form'); + } + /** * Catch main * @param {object} form @@ -3206,6 +3229,12 @@ class ApbctHandler { * @return {void} */ catchMain(form, index) { + // Third-party plugins may re-fire DOMContentLoaded. Double wrapping makes onsubmit_prev recursive. + if (form.apbctCatchMainAttached) { + return; + } + form.apbctCatchMainAttached = true; + form.onsubmit_prev = form.onsubmit; form.ctFormIndex = index; @@ -3218,6 +3247,9 @@ class ApbctHandler { if (event.target.classList !== undefined && event.target.classList.contains('brave_form_form')) { event.preventDefault(); } + if (handler.prevCallSyncRequired(event.target)) { + return event.target.onsubmit_prev.call(event.target, event); + } setTimeout(function() { event.target.onsubmit_prev.call(event.target, event); }, 0); @@ -4488,6 +4520,13 @@ class ApbctHandler { sourceSign.keepUnwrapped = true; } + // WooCommerce Stripe UPE confirms the card on Add payment method before the form is posted. + // Keep the token unwrapped: PHP reads the top-level POST field. + if ( dataString.indexOf('action=wc_stripe_create_and_confirm_setup_intent') !== -1 ) { + sourceSign.found = 'action=wc_stripe_create_and_confirm_setup_intent'; + sourceSign.keepUnwrapped = true; + } + // woocommerce add to cart is based on URL if ( typeof ajaxObject.url === 'string' && ajaxObject.url.indexOf('wc-ajax=add_to_cart') !== -1 ) { sourceSign.found = 'wc-ajax=add_to_cart'; @@ -5627,11 +5666,19 @@ async function apbctImportScript(scriptAbsolutePath) { }); } +let apbctReadyIsDone = false; + /** * Ready function */ // eslint-disable-next-line camelcase,require-jsdoc async function apbct_ready() { + // Some plugins dispatch a synthetic DOMContentLoaded, so the whole init must not run twice + if (apbctReadyIsDone) { + return; + } + apbctReadyIsDone = true; + // Only set ct_checkjs if the key is actually provided (not on block pages) if (typeof ctPublic.ct_checkjs_key !== 'undefined' && ctPublic.ct_checkjs_key !== null) { apbctLocalStorage.set('ct_checkjs', ctPublic.ct_checkjs_key, true); @@ -6190,8 +6237,10 @@ function apbctReplaceInputsValuesFromOtherForm(formSource, formTarget) { formSource.outerHTML.indexOf('class="et_pb_contact_form') !== -1 || formSource.outerHTML.indexOf('action="https://api.kit.com') !== -1 || formSource.outerHTML.indexOf('activehosted.com') !== -1 || + formSource.outerHTML.indexOf('aweber.com') !== -1 || formSource.outerHTML.indexOf('action="https://crm.zoho.com') !== -1 ) && + elemSource.name !== '' && elemSource.name === elemTarget.name // sequence by name ) || ( @@ -7636,6 +7685,10 @@ function apbctIntegrateDynamicEmailCheck({ // eslint-disable-line no-unused-vars // If there are email inputs inside the added node node.querySelectorAll && node.querySelectorAll(emailSelector).forEach(function(input) { + // do not touch inputs outside of the integrated form + if (!input.closest(formSelector)) { + return; + } if (!input.hasAttribute(attribute)) { input.addEventListener('blur', ctDebounceFuncExec(handler, debounce)); input.setAttribute(attribute, '1'); @@ -7705,7 +7758,15 @@ if (Math.floor(Math.random() * 100) === 1) { }; } +let ctTrpIsInitialized = false; + document.addEventListener('DOMContentLoaded', function() { + // Some plugins dispatch a synthetic DOMContentLoaded, badges must not be built twice + if (ctTrpIsInitialized) { + return; + } + ctTrpIsInitialized = true; + let ctTrpLocalize = undefined; let ctTrpIsAdminCommentsList = false; diff --git a/js/prebuild/apbct-public-bundle_ext-protection_gathering.js b/js/prebuild/apbct-public-bundle_ext-protection_gathering.js index 0124e8837..72b725e69 100644 --- a/js/prebuild/apbct-public-bundle_ext-protection_gathering.js +++ b/js/prebuild/apbct-public-bundle_ext-protection_gathering.js @@ -449,8 +449,16 @@ function ctFillDecodedEmail(target, email) { target.innerHTML = target.innerHTML.replace(/.+?(
)/, email + '$1'); } +let ctEmailDecoderIsInitialized = false; + // Listen clicks on encoded emails document.addEventListener('DOMContentLoaded', function() { + // Some plugins dispatch a synthetic DOMContentLoaded, listeners must not be attached twice + if (ctEmailDecoderIsInitialized) { + return; + } + ctEmailDecoderIsInitialized = true; + let encodedEmailNodes = document.querySelectorAll('[data-original-string]'); if (typeof ctPublic !== 'undefined') { ctPublic.encodedEmailNodes = encodedEmailNodes; @@ -1753,7 +1761,7 @@ class ApbctXhr { 'initial_request_params': initialRequestParams, }; params.notJson = true; - params.url = ctPublicFunctions.host_url; + params.url = ctPublicFunctions._ajax_url; // this callback will rerun the XHR with initial params params.callback = function(...args) { // the refresh result itself @@ -3199,6 +3207,21 @@ class ApbctHandler { return false; } + /** + * Forms with an inline onsubmit whose returned value controls the submit. + * A deferred call loses that value and lets the form submit natively. + * @param {object} form + * @return {boolean} + */ + prevCallSyncRequired(form) { + if (form.classList === undefined) { + return false; + } + + // Pagelayer contact form: onsubmit="return pagelayer_contact_submit(this, event)" + return form.classList.contains('pagelayer-contact-form'); + } + /** * Catch main * @param {object} form @@ -3206,6 +3229,12 @@ class ApbctHandler { * @return {void} */ catchMain(form, index) { + // Third-party plugins may re-fire DOMContentLoaded. Double wrapping makes onsubmit_prev recursive. + if (form.apbctCatchMainAttached) { + return; + } + form.apbctCatchMainAttached = true; + form.onsubmit_prev = form.onsubmit; form.ctFormIndex = index; @@ -3218,6 +3247,9 @@ class ApbctHandler { if (event.target.classList !== undefined && event.target.classList.contains('brave_form_form')) { event.preventDefault(); } + if (handler.prevCallSyncRequired(event.target)) { + return event.target.onsubmit_prev.call(event.target, event); + } setTimeout(function() { event.target.onsubmit_prev.call(event.target, event); }, 0); @@ -4488,6 +4520,13 @@ class ApbctHandler { sourceSign.keepUnwrapped = true; } + // WooCommerce Stripe UPE confirms the card on Add payment method before the form is posted. + // Keep the token unwrapped: PHP reads the top-level POST field. + if ( dataString.indexOf('action=wc_stripe_create_and_confirm_setup_intent') !== -1 ) { + sourceSign.found = 'action=wc_stripe_create_and_confirm_setup_intent'; + sourceSign.keepUnwrapped = true; + } + // woocommerce add to cart is based on URL if ( typeof ajaxObject.url === 'string' && ajaxObject.url.indexOf('wc-ajax=add_to_cart') !== -1 ) { sourceSign.found = 'wc-ajax=add_to_cart'; @@ -5627,11 +5666,19 @@ async function apbctImportScript(scriptAbsolutePath) { }); } +let apbctReadyIsDone = false; + /** * Ready function */ // eslint-disable-next-line camelcase,require-jsdoc async function apbct_ready() { + // Some plugins dispatch a synthetic DOMContentLoaded, so the whole init must not run twice + if (apbctReadyIsDone) { + return; + } + apbctReadyIsDone = true; + // Only set ct_checkjs if the key is actually provided (not on block pages) if (typeof ctPublic.ct_checkjs_key !== 'undefined' && ctPublic.ct_checkjs_key !== null) { apbctLocalStorage.set('ct_checkjs', ctPublic.ct_checkjs_key, true); @@ -6190,8 +6237,10 @@ function apbctReplaceInputsValuesFromOtherForm(formSource, formTarget) { formSource.outerHTML.indexOf('class="et_pb_contact_form') !== -1 || formSource.outerHTML.indexOf('action="https://api.kit.com') !== -1 || formSource.outerHTML.indexOf('activehosted.com') !== -1 || + formSource.outerHTML.indexOf('aweber.com') !== -1 || formSource.outerHTML.indexOf('action="https://crm.zoho.com') !== -1 ) && + elemSource.name !== '' && elemSource.name === elemTarget.name // sequence by name ) || ( @@ -8480,6 +8529,10 @@ function apbctIntegrateDynamicEmailCheck({ // eslint-disable-line no-unused-vars // If there are email inputs inside the added node node.querySelectorAll && node.querySelectorAll(emailSelector).forEach(function(input) { + // do not touch inputs outside of the integrated form + if (!input.closest(formSelector)) { + return; + } if (!input.hasAttribute(attribute)) { input.addEventListener('blur', ctDebounceFuncExec(handler, debounce)); input.setAttribute(attribute, '1'); @@ -8549,7 +8602,15 @@ if (Math.floor(Math.random() * 100) === 1) { }; } +let ctTrpIsInitialized = false; + document.addEventListener('DOMContentLoaded', function() { + // Some plugins dispatch a synthetic DOMContentLoaded, badges must not be built twice + if (ctTrpIsInitialized) { + return; + } + ctTrpIsInitialized = true; + let ctTrpLocalize = undefined; let ctTrpIsAdminCommentsList = false; diff --git a/js/prebuild/apbct-public-bundle_full-protection.js b/js/prebuild/apbct-public-bundle_full-protection.js index 6bfd6c33a..ec2298f55 100644 --- a/js/prebuild/apbct-public-bundle_full-protection.js +++ b/js/prebuild/apbct-public-bundle_full-protection.js @@ -449,8 +449,16 @@ function ctFillDecodedEmail(target, email) { target.innerHTML = target.innerHTML.replace(/.+?(
)/, email + '$1'); } +let ctEmailDecoderIsInitialized = false; + // Listen clicks on encoded emails document.addEventListener('DOMContentLoaded', function() { + // Some plugins dispatch a synthetic DOMContentLoaded, listeners must not be attached twice + if (ctEmailDecoderIsInitialized) { + return; + } + ctEmailDecoderIsInitialized = true; + let encodedEmailNodes = document.querySelectorAll('[data-original-string]'); if (typeof ctPublic !== 'undefined') { ctPublic.encodedEmailNodes = encodedEmailNodes; @@ -1753,7 +1761,7 @@ class ApbctXhr { 'initial_request_params': initialRequestParams, }; params.notJson = true; - params.url = ctPublicFunctions.host_url; + params.url = ctPublicFunctions._ajax_url; // this callback will rerun the XHR with initial params params.callback = function(...args) { // the refresh result itself @@ -3199,6 +3207,21 @@ class ApbctHandler { return false; } + /** + * Forms with an inline onsubmit whose returned value controls the submit. + * A deferred call loses that value and lets the form submit natively. + * @param {object} form + * @return {boolean} + */ + prevCallSyncRequired(form) { + if (form.classList === undefined) { + return false; + } + + // Pagelayer contact form: onsubmit="return pagelayer_contact_submit(this, event)" + return form.classList.contains('pagelayer-contact-form'); + } + /** * Catch main * @param {object} form @@ -3206,6 +3229,12 @@ class ApbctHandler { * @return {void} */ catchMain(form, index) { + // Third-party plugins may re-fire DOMContentLoaded. Double wrapping makes onsubmit_prev recursive. + if (form.apbctCatchMainAttached) { + return; + } + form.apbctCatchMainAttached = true; + form.onsubmit_prev = form.onsubmit; form.ctFormIndex = index; @@ -3218,6 +3247,9 @@ class ApbctHandler { if (event.target.classList !== undefined && event.target.classList.contains('brave_form_form')) { event.preventDefault(); } + if (handler.prevCallSyncRequired(event.target)) { + return event.target.onsubmit_prev.call(event.target, event); + } setTimeout(function() { event.target.onsubmit_prev.call(event.target, event); }, 0); @@ -4488,6 +4520,13 @@ class ApbctHandler { sourceSign.keepUnwrapped = true; } + // WooCommerce Stripe UPE confirms the card on Add payment method before the form is posted. + // Keep the token unwrapped: PHP reads the top-level POST field. + if ( dataString.indexOf('action=wc_stripe_create_and_confirm_setup_intent') !== -1 ) { + sourceSign.found = 'action=wc_stripe_create_and_confirm_setup_intent'; + sourceSign.keepUnwrapped = true; + } + // woocommerce add to cart is based on URL if ( typeof ajaxObject.url === 'string' && ajaxObject.url.indexOf('wc-ajax=add_to_cart') !== -1 ) { sourceSign.found = 'wc-ajax=add_to_cart'; @@ -5627,11 +5666,19 @@ async function apbctImportScript(scriptAbsolutePath) { }); } +let apbctReadyIsDone = false; + /** * Ready function */ // eslint-disable-next-line camelcase,require-jsdoc async function apbct_ready() { + // Some plugins dispatch a synthetic DOMContentLoaded, so the whole init must not run twice + if (apbctReadyIsDone) { + return; + } + apbctReadyIsDone = true; + // Only set ct_checkjs if the key is actually provided (not on block pages) if (typeof ctPublic.ct_checkjs_key !== 'undefined' && ctPublic.ct_checkjs_key !== null) { apbctLocalStorage.set('ct_checkjs', ctPublic.ct_checkjs_key, true); @@ -6190,8 +6237,10 @@ function apbctReplaceInputsValuesFromOtherForm(formSource, formTarget) { formSource.outerHTML.indexOf('class="et_pb_contact_form') !== -1 || formSource.outerHTML.indexOf('action="https://api.kit.com') !== -1 || formSource.outerHTML.indexOf('activehosted.com') !== -1 || + formSource.outerHTML.indexOf('aweber.com') !== -1 || formSource.outerHTML.indexOf('action="https://crm.zoho.com') !== -1 ) && + elemSource.name !== '' && elemSource.name === elemTarget.name // sequence by name ) || ( @@ -7227,10 +7276,18 @@ class ApbctForceProtection { } } +let apbctForceProtectionIsInitialized = false; + /** * Force protection */ function apbctForceProtect() { + // Some plugins dispatch a synthetic DOMContentLoaded, the check must be sent only once + if (apbctForceProtectionIsInitialized) { + return; + } + apbctForceProtectionIsInitialized = true; + if (+ctPublic.settings__forms__force_protection && typeof ApbctForceProtection !== 'undefined') { new ApbctForceProtection(); } @@ -7280,7 +7337,15 @@ function ctCheckInternal(currForm) { ); } +let ctInternalFormsIsInitialized = false; + document.addEventListener('DOMContentLoaded', function() { + // Some plugins dispatch a synthetic DOMContentLoaded, forms must not be re-wrapped + if (ctInternalFormsIsInitialized) { + return; + } + ctInternalFormsIsInitialized = true; + if ( ! +ctPublic.settings__forms__check_internal ) { return; } @@ -7880,6 +7945,10 @@ function apbctIntegrateDynamicEmailCheck({ // eslint-disable-line no-unused-vars // If there are email inputs inside the added node node.querySelectorAll && node.querySelectorAll(emailSelector).forEach(function(input) { + // do not touch inputs outside of the integrated form + if (!input.closest(formSelector)) { + return; + } if (!input.hasAttribute(attribute)) { input.addEventListener('blur', ctDebounceFuncExec(handler, debounce)); input.setAttribute(attribute, '1'); @@ -7949,7 +8018,15 @@ if (Math.floor(Math.random() * 100) === 1) { }; } +let ctTrpIsInitialized = false; + document.addEventListener('DOMContentLoaded', function() { + // Some plugins dispatch a synthetic DOMContentLoaded, badges must not be built twice + if (ctTrpIsInitialized) { + return; + } + ctTrpIsInitialized = true; + let ctTrpLocalize = undefined; let ctTrpIsAdminCommentsList = false; diff --git a/js/prebuild/apbct-public-bundle_full-protection_gathering.js b/js/prebuild/apbct-public-bundle_full-protection_gathering.js index 70ab6bb1b..15f2bab94 100644 --- a/js/prebuild/apbct-public-bundle_full-protection_gathering.js +++ b/js/prebuild/apbct-public-bundle_full-protection_gathering.js @@ -449,8 +449,16 @@ function ctFillDecodedEmail(target, email) { target.innerHTML = target.innerHTML.replace(/.+?(
)/, email + '$1'); } +let ctEmailDecoderIsInitialized = false; + // Listen clicks on encoded emails document.addEventListener('DOMContentLoaded', function() { + // Some plugins dispatch a synthetic DOMContentLoaded, listeners must not be attached twice + if (ctEmailDecoderIsInitialized) { + return; + } + ctEmailDecoderIsInitialized = true; + let encodedEmailNodes = document.querySelectorAll('[data-original-string]'); if (typeof ctPublic !== 'undefined') { ctPublic.encodedEmailNodes = encodedEmailNodes; @@ -1753,7 +1761,7 @@ class ApbctXhr { 'initial_request_params': initialRequestParams, }; params.notJson = true; - params.url = ctPublicFunctions.host_url; + params.url = ctPublicFunctions._ajax_url; // this callback will rerun the XHR with initial params params.callback = function(...args) { // the refresh result itself @@ -3199,6 +3207,21 @@ class ApbctHandler { return false; } + /** + * Forms with an inline onsubmit whose returned value controls the submit. + * A deferred call loses that value and lets the form submit natively. + * @param {object} form + * @return {boolean} + */ + prevCallSyncRequired(form) { + if (form.classList === undefined) { + return false; + } + + // Pagelayer contact form: onsubmit="return pagelayer_contact_submit(this, event)" + return form.classList.contains('pagelayer-contact-form'); + } + /** * Catch main * @param {object} form @@ -3206,6 +3229,12 @@ class ApbctHandler { * @return {void} */ catchMain(form, index) { + // Third-party plugins may re-fire DOMContentLoaded. Double wrapping makes onsubmit_prev recursive. + if (form.apbctCatchMainAttached) { + return; + } + form.apbctCatchMainAttached = true; + form.onsubmit_prev = form.onsubmit; form.ctFormIndex = index; @@ -3218,6 +3247,9 @@ class ApbctHandler { if (event.target.classList !== undefined && event.target.classList.contains('brave_form_form')) { event.preventDefault(); } + if (handler.prevCallSyncRequired(event.target)) { + return event.target.onsubmit_prev.call(event.target, event); + } setTimeout(function() { event.target.onsubmit_prev.call(event.target, event); }, 0); @@ -4488,6 +4520,13 @@ class ApbctHandler { sourceSign.keepUnwrapped = true; } + // WooCommerce Stripe UPE confirms the card on Add payment method before the form is posted. + // Keep the token unwrapped: PHP reads the top-level POST field. + if ( dataString.indexOf('action=wc_stripe_create_and_confirm_setup_intent') !== -1 ) { + sourceSign.found = 'action=wc_stripe_create_and_confirm_setup_intent'; + sourceSign.keepUnwrapped = true; + } + // woocommerce add to cart is based on URL if ( typeof ajaxObject.url === 'string' && ajaxObject.url.indexOf('wc-ajax=add_to_cart') !== -1 ) { sourceSign.found = 'wc-ajax=add_to_cart'; @@ -5627,11 +5666,19 @@ async function apbctImportScript(scriptAbsolutePath) { }); } +let apbctReadyIsDone = false; + /** * Ready function */ // eslint-disable-next-line camelcase,require-jsdoc async function apbct_ready() { + // Some plugins dispatch a synthetic DOMContentLoaded, so the whole init must not run twice + if (apbctReadyIsDone) { + return; + } + apbctReadyIsDone = true; + // Only set ct_checkjs if the key is actually provided (not on block pages) if (typeof ctPublic.ct_checkjs_key !== 'undefined' && ctPublic.ct_checkjs_key !== null) { apbctLocalStorage.set('ct_checkjs', ctPublic.ct_checkjs_key, true); @@ -6190,8 +6237,10 @@ function apbctReplaceInputsValuesFromOtherForm(formSource, formTarget) { formSource.outerHTML.indexOf('class="et_pb_contact_form') !== -1 || formSource.outerHTML.indexOf('action="https://api.kit.com') !== -1 || formSource.outerHTML.indexOf('activehosted.com') !== -1 || + formSource.outerHTML.indexOf('aweber.com') !== -1 || formSource.outerHTML.indexOf('action="https://crm.zoho.com') !== -1 ) && + elemSource.name !== '' && elemSource.name === elemTarget.name // sequence by name ) || ( @@ -7227,10 +7276,18 @@ class ApbctForceProtection { } } +let apbctForceProtectionIsInitialized = false; + /** * Force protection */ function apbctForceProtect() { + // Some plugins dispatch a synthetic DOMContentLoaded, the check must be sent only once + if (apbctForceProtectionIsInitialized) { + return; + } + apbctForceProtectionIsInitialized = true; + if (+ctPublic.settings__forms__force_protection && typeof ApbctForceProtection !== 'undefined') { new ApbctForceProtection(); } @@ -8124,7 +8181,15 @@ function ctCheckInternal(currForm) { ); } +let ctInternalFormsIsInitialized = false; + document.addEventListener('DOMContentLoaded', function() { + // Some plugins dispatch a synthetic DOMContentLoaded, forms must not be re-wrapped + if (ctInternalFormsIsInitialized) { + return; + } + ctInternalFormsIsInitialized = true; + if ( ! +ctPublic.settings__forms__check_internal ) { return; } @@ -8724,6 +8789,10 @@ function apbctIntegrateDynamicEmailCheck({ // eslint-disable-line no-unused-vars // If there are email inputs inside the added node node.querySelectorAll && node.querySelectorAll(emailSelector).forEach(function(input) { + // do not touch inputs outside of the integrated form + if (!input.closest(formSelector)) { + return; + } if (!input.hasAttribute(attribute)) { input.addEventListener('blur', ctDebounceFuncExec(handler, debounce)); input.setAttribute(attribute, '1'); @@ -8793,7 +8862,15 @@ if (Math.floor(Math.random() * 100) === 1) { }; } +let ctTrpIsInitialized = false; + document.addEventListener('DOMContentLoaded', function() { + // Some plugins dispatch a synthetic DOMContentLoaded, badges must not be built twice + if (ctTrpIsInitialized) { + return; + } + ctTrpIsInitialized = true; + let ctTrpLocalize = undefined; let ctTrpIsAdminCommentsList = false; diff --git a/js/prebuild/apbct-public-bundle_gathering.js b/js/prebuild/apbct-public-bundle_gathering.js index 62d6987d4..de73d51e2 100644 --- a/js/prebuild/apbct-public-bundle_gathering.js +++ b/js/prebuild/apbct-public-bundle_gathering.js @@ -449,8 +449,16 @@ function ctFillDecodedEmail(target, email) { target.innerHTML = target.innerHTML.replace(/.+?(
)/, email + '$1'); } +let ctEmailDecoderIsInitialized = false; + // Listen clicks on encoded emails document.addEventListener('DOMContentLoaded', function() { + // Some plugins dispatch a synthetic DOMContentLoaded, listeners must not be attached twice + if (ctEmailDecoderIsInitialized) { + return; + } + ctEmailDecoderIsInitialized = true; + let encodedEmailNodes = document.querySelectorAll('[data-original-string]'); if (typeof ctPublic !== 'undefined') { ctPublic.encodedEmailNodes = encodedEmailNodes; @@ -1753,7 +1761,7 @@ class ApbctXhr { 'initial_request_params': initialRequestParams, }; params.notJson = true; - params.url = ctPublicFunctions.host_url; + params.url = ctPublicFunctions._ajax_url; // this callback will rerun the XHR with initial params params.callback = function(...args) { // the refresh result itself @@ -3199,6 +3207,21 @@ class ApbctHandler { return false; } + /** + * Forms with an inline onsubmit whose returned value controls the submit. + * A deferred call loses that value and lets the form submit natively. + * @param {object} form + * @return {boolean} + */ + prevCallSyncRequired(form) { + if (form.classList === undefined) { + return false; + } + + // Pagelayer contact form: onsubmit="return pagelayer_contact_submit(this, event)" + return form.classList.contains('pagelayer-contact-form'); + } + /** * Catch main * @param {object} form @@ -3206,6 +3229,12 @@ class ApbctHandler { * @return {void} */ catchMain(form, index) { + // Third-party plugins may re-fire DOMContentLoaded. Double wrapping makes onsubmit_prev recursive. + if (form.apbctCatchMainAttached) { + return; + } + form.apbctCatchMainAttached = true; + form.onsubmit_prev = form.onsubmit; form.ctFormIndex = index; @@ -3218,6 +3247,9 @@ class ApbctHandler { if (event.target.classList !== undefined && event.target.classList.contains('brave_form_form')) { event.preventDefault(); } + if (handler.prevCallSyncRequired(event.target)) { + return event.target.onsubmit_prev.call(event.target, event); + } setTimeout(function() { event.target.onsubmit_prev.call(event.target, event); }, 0); @@ -4488,6 +4520,13 @@ class ApbctHandler { sourceSign.keepUnwrapped = true; } + // WooCommerce Stripe UPE confirms the card on Add payment method before the form is posted. + // Keep the token unwrapped: PHP reads the top-level POST field. + if ( dataString.indexOf('action=wc_stripe_create_and_confirm_setup_intent') !== -1 ) { + sourceSign.found = 'action=wc_stripe_create_and_confirm_setup_intent'; + sourceSign.keepUnwrapped = true; + } + // woocommerce add to cart is based on URL if ( typeof ajaxObject.url === 'string' && ajaxObject.url.indexOf('wc-ajax=add_to_cart') !== -1 ) { sourceSign.found = 'wc-ajax=add_to_cart'; @@ -5627,11 +5666,19 @@ async function apbctImportScript(scriptAbsolutePath) { }); } +let apbctReadyIsDone = false; + /** * Ready function */ // eslint-disable-next-line camelcase,require-jsdoc async function apbct_ready() { + // Some plugins dispatch a synthetic DOMContentLoaded, so the whole init must not run twice + if (apbctReadyIsDone) { + return; + } + apbctReadyIsDone = true; + // Only set ct_checkjs if the key is actually provided (not on block pages) if (typeof ctPublic.ct_checkjs_key !== 'undefined' && ctPublic.ct_checkjs_key !== null) { apbctLocalStorage.set('ct_checkjs', ctPublic.ct_checkjs_key, true); @@ -7139,6 +7186,10 @@ function apbctIntegrateDynamicEmailCheck({ // eslint-disable-line no-unused-vars // If there are email inputs inside the added node node.querySelectorAll && node.querySelectorAll(emailSelector).forEach(function(input) { + // do not touch inputs outside of the integrated form + if (!input.closest(formSelector)) { + return; + } if (!input.hasAttribute(attribute)) { input.addEventListener('blur', ctDebounceFuncExec(handler, debounce)); input.setAttribute(attribute, '1'); @@ -7208,7 +7259,15 @@ if (Math.floor(Math.random() * 100) === 1) { }; } +let ctTrpIsInitialized = false; + document.addEventListener('DOMContentLoaded', function() { + // Some plugins dispatch a synthetic DOMContentLoaded, badges must not be built twice + if (ctTrpIsInitialized) { + return; + } + ctTrpIsInitialized = true; + let ctTrpLocalize = undefined; let ctTrpIsAdminCommentsList = false; diff --git a/js/prebuild/apbct-public-bundle_int-protection.js b/js/prebuild/apbct-public-bundle_int-protection.js index 1eac108d8..b2bd726c3 100644 --- a/js/prebuild/apbct-public-bundle_int-protection.js +++ b/js/prebuild/apbct-public-bundle_int-protection.js @@ -449,8 +449,16 @@ function ctFillDecodedEmail(target, email) { target.innerHTML = target.innerHTML.replace(/.+?(
)/, email + '$1'); } +let ctEmailDecoderIsInitialized = false; + // Listen clicks on encoded emails document.addEventListener('DOMContentLoaded', function() { + // Some plugins dispatch a synthetic DOMContentLoaded, listeners must not be attached twice + if (ctEmailDecoderIsInitialized) { + return; + } + ctEmailDecoderIsInitialized = true; + let encodedEmailNodes = document.querySelectorAll('[data-original-string]'); if (typeof ctPublic !== 'undefined') { ctPublic.encodedEmailNodes = encodedEmailNodes; @@ -1753,7 +1761,7 @@ class ApbctXhr { 'initial_request_params': initialRequestParams, }; params.notJson = true; - params.url = ctPublicFunctions.host_url; + params.url = ctPublicFunctions._ajax_url; // this callback will rerun the XHR with initial params params.callback = function(...args) { // the refresh result itself @@ -3199,6 +3207,21 @@ class ApbctHandler { return false; } + /** + * Forms with an inline onsubmit whose returned value controls the submit. + * A deferred call loses that value and lets the form submit natively. + * @param {object} form + * @return {boolean} + */ + prevCallSyncRequired(form) { + if (form.classList === undefined) { + return false; + } + + // Pagelayer contact form: onsubmit="return pagelayer_contact_submit(this, event)" + return form.classList.contains('pagelayer-contact-form'); + } + /** * Catch main * @param {object} form @@ -3206,6 +3229,12 @@ class ApbctHandler { * @return {void} */ catchMain(form, index) { + // Third-party plugins may re-fire DOMContentLoaded. Double wrapping makes onsubmit_prev recursive. + if (form.apbctCatchMainAttached) { + return; + } + form.apbctCatchMainAttached = true; + form.onsubmit_prev = form.onsubmit; form.ctFormIndex = index; @@ -3218,6 +3247,9 @@ class ApbctHandler { if (event.target.classList !== undefined && event.target.classList.contains('brave_form_form')) { event.preventDefault(); } + if (handler.prevCallSyncRequired(event.target)) { + return event.target.onsubmit_prev.call(event.target, event); + } setTimeout(function() { event.target.onsubmit_prev.call(event.target, event); }, 0); @@ -4488,6 +4520,13 @@ class ApbctHandler { sourceSign.keepUnwrapped = true; } + // WooCommerce Stripe UPE confirms the card on Add payment method before the form is posted. + // Keep the token unwrapped: PHP reads the top-level POST field. + if ( dataString.indexOf('action=wc_stripe_create_and_confirm_setup_intent') !== -1 ) { + sourceSign.found = 'action=wc_stripe_create_and_confirm_setup_intent'; + sourceSign.keepUnwrapped = true; + } + // woocommerce add to cart is based on URL if ( typeof ajaxObject.url === 'string' && ajaxObject.url.indexOf('wc-ajax=add_to_cart') !== -1 ) { sourceSign.found = 'wc-ajax=add_to_cart'; @@ -5627,11 +5666,19 @@ async function apbctImportScript(scriptAbsolutePath) { }); } +let apbctReadyIsDone = false; + /** * Ready function */ // eslint-disable-next-line camelcase,require-jsdoc async function apbct_ready() { + // Some plugins dispatch a synthetic DOMContentLoaded, so the whole init must not run twice + if (apbctReadyIsDone) { + return; + } + apbctReadyIsDone = true; + // Only set ct_checkjs if the key is actually provided (not on block pages) if (typeof ctPublic.ct_checkjs_key !== 'undefined' && ctPublic.ct_checkjs_key !== null) { apbctLocalStorage.set('ct_checkjs', ctPublic.ct_checkjs_key, true); @@ -5799,7 +5846,15 @@ function ctCheckInternal(currForm) { ); } +let ctInternalFormsIsInitialized = false; + document.addEventListener('DOMContentLoaded', function() { + // Some plugins dispatch a synthetic DOMContentLoaded, forms must not be re-wrapped + if (ctInternalFormsIsInitialized) { + return; + } + ctInternalFormsIsInitialized = true; + if ( ! +ctPublic.settings__forms__check_internal ) { return; } @@ -6399,6 +6454,10 @@ function apbctIntegrateDynamicEmailCheck({ // eslint-disable-line no-unused-vars // If there are email inputs inside the added node node.querySelectorAll && node.querySelectorAll(emailSelector).forEach(function(input) { + // do not touch inputs outside of the integrated form + if (!input.closest(formSelector)) { + return; + } if (!input.hasAttribute(attribute)) { input.addEventListener('blur', ctDebounceFuncExec(handler, debounce)); input.setAttribute(attribute, '1'); @@ -6468,7 +6527,15 @@ if (Math.floor(Math.random() * 100) === 1) { }; } +let ctTrpIsInitialized = false; + document.addEventListener('DOMContentLoaded', function() { + // Some plugins dispatch a synthetic DOMContentLoaded, badges must not be built twice + if (ctTrpIsInitialized) { + return; + } + ctTrpIsInitialized = true; + let ctTrpLocalize = undefined; let ctTrpIsAdminCommentsList = false; diff --git a/js/prebuild/apbct-public-bundle_int-protection_gathering.js b/js/prebuild/apbct-public-bundle_int-protection_gathering.js index d2b5e069d..a777c37e9 100644 --- a/js/prebuild/apbct-public-bundle_int-protection_gathering.js +++ b/js/prebuild/apbct-public-bundle_int-protection_gathering.js @@ -449,8 +449,16 @@ function ctFillDecodedEmail(target, email) { target.innerHTML = target.innerHTML.replace(/.+?(
)/, email + '$1'); } +let ctEmailDecoderIsInitialized = false; + // Listen clicks on encoded emails document.addEventListener('DOMContentLoaded', function() { + // Some plugins dispatch a synthetic DOMContentLoaded, listeners must not be attached twice + if (ctEmailDecoderIsInitialized) { + return; + } + ctEmailDecoderIsInitialized = true; + let encodedEmailNodes = document.querySelectorAll('[data-original-string]'); if (typeof ctPublic !== 'undefined') { ctPublic.encodedEmailNodes = encodedEmailNodes; @@ -1753,7 +1761,7 @@ class ApbctXhr { 'initial_request_params': initialRequestParams, }; params.notJson = true; - params.url = ctPublicFunctions.host_url; + params.url = ctPublicFunctions._ajax_url; // this callback will rerun the XHR with initial params params.callback = function(...args) { // the refresh result itself @@ -3199,6 +3207,21 @@ class ApbctHandler { return false; } + /** + * Forms with an inline onsubmit whose returned value controls the submit. + * A deferred call loses that value and lets the form submit natively. + * @param {object} form + * @return {boolean} + */ + prevCallSyncRequired(form) { + if (form.classList === undefined) { + return false; + } + + // Pagelayer contact form: onsubmit="return pagelayer_contact_submit(this, event)" + return form.classList.contains('pagelayer-contact-form'); + } + /** * Catch main * @param {object} form @@ -3206,6 +3229,12 @@ class ApbctHandler { * @return {void} */ catchMain(form, index) { + // Third-party plugins may re-fire DOMContentLoaded. Double wrapping makes onsubmit_prev recursive. + if (form.apbctCatchMainAttached) { + return; + } + form.apbctCatchMainAttached = true; + form.onsubmit_prev = form.onsubmit; form.ctFormIndex = index; @@ -3218,6 +3247,9 @@ class ApbctHandler { if (event.target.classList !== undefined && event.target.classList.contains('brave_form_form')) { event.preventDefault(); } + if (handler.prevCallSyncRequired(event.target)) { + return event.target.onsubmit_prev.call(event.target, event); + } setTimeout(function() { event.target.onsubmit_prev.call(event.target, event); }, 0); @@ -4488,6 +4520,13 @@ class ApbctHandler { sourceSign.keepUnwrapped = true; } + // WooCommerce Stripe UPE confirms the card on Add payment method before the form is posted. + // Keep the token unwrapped: PHP reads the top-level POST field. + if ( dataString.indexOf('action=wc_stripe_create_and_confirm_setup_intent') !== -1 ) { + sourceSign.found = 'action=wc_stripe_create_and_confirm_setup_intent'; + sourceSign.keepUnwrapped = true; + } + // woocommerce add to cart is based on URL if ( typeof ajaxObject.url === 'string' && ajaxObject.url.indexOf('wc-ajax=add_to_cart') !== -1 ) { sourceSign.found = 'wc-ajax=add_to_cart'; @@ -5627,11 +5666,19 @@ async function apbctImportScript(scriptAbsolutePath) { }); } +let apbctReadyIsDone = false; + /** * Ready function */ // eslint-disable-next-line camelcase,require-jsdoc async function apbct_ready() { + // Some plugins dispatch a synthetic DOMContentLoaded, so the whole init must not run twice + if (apbctReadyIsDone) { + return; + } + apbctReadyIsDone = true; + // Only set ct_checkjs if the key is actually provided (not on block pages) if (typeof ctPublic.ct_checkjs_key !== 'undefined' && ctPublic.ct_checkjs_key !== null) { apbctLocalStorage.set('ct_checkjs', ctPublic.ct_checkjs_key, true); @@ -5799,7 +5846,15 @@ function ctCheckInternal(currForm) { ); } +let ctInternalFormsIsInitialized = false; + document.addEventListener('DOMContentLoaded', function() { + // Some plugins dispatch a synthetic DOMContentLoaded, forms must not be re-wrapped + if (ctInternalFormsIsInitialized) { + return; + } + ctInternalFormsIsInitialized = true; + if ( ! +ctPublic.settings__forms__check_internal ) { return; } @@ -7243,6 +7298,10 @@ function apbctIntegrateDynamicEmailCheck({ // eslint-disable-line no-unused-vars // If there are email inputs inside the added node node.querySelectorAll && node.querySelectorAll(emailSelector).forEach(function(input) { + // do not touch inputs outside of the integrated form + if (!input.closest(formSelector)) { + return; + } if (!input.hasAttribute(attribute)) { input.addEventListener('blur', ctDebounceFuncExec(handler, debounce)); input.setAttribute(attribute, '1'); @@ -7312,7 +7371,15 @@ if (Math.floor(Math.random() * 100) === 1) { }; } +let ctTrpIsInitialized = false; + document.addEventListener('DOMContentLoaded', function() { + // Some plugins dispatch a synthetic DOMContentLoaded, badges must not be built twice + if (ctTrpIsInitialized) { + return; + } + ctTrpIsInitialized = true; + let ctTrpLocalize = undefined; let ctTrpIsAdminCommentsList = false; diff --git a/js/public-3-trp.min.js b/js/public-3-trp.min.js index 96b66da7f..01fa1553f 100644 --- a/js/public-3-trp.min.js +++ b/js/public-3-trp.min.js @@ -1,2 +1,2 @@ -function closeAllPopupTRP(){var e=document.querySelectorAll(".apbct-real-user-popup.visible");0{e.classList.remove("visible")})}document.addEventListener("DOMContentLoaded",function(){let d=void 0,u=!1;if("undefined"==typeof ctPublic&&"undefined"==typeof ctTrpAdminLocalize||void 0===(d="undefined"!=typeof ctPublic&&ctPublic.theRealPerson?ctPublic.theRealPerson:d)&&"undefined"!=typeof ctTrpAdminLocalize&&ctTrpAdminLocalize.theRealPerson&&(d=ctTrpAdminLocalize.theRealPerson,u=!0),d){let e='.apbct-trp > .comment-body *[class*="comment-author"]';document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]');var t=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong');0!==t.length&&(t.forEach((e,t)=>{var n,a,s,i,c,r,l,o,p;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"),(a=document.createElement("img")).setAttribute("src",d.imgPersonUrl),a.setAttribute("class","apbct-real-user-popup-img"),(s=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(r=document.createElement("strong")).append(d.phrases.trpHeading),(i=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),(c=document.createElement("div")).append(" "),c.append(r),c.append(d.phrases.trpContent1),(r=document.createElement("div")).style.display="flex",r.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),r.append(l),u&&(l=document.createElement("div"),(o=document.createElement("a")).setAttribute("href",d.trpContentLink),o.setAttribute("target","_blank"),(p=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),p.setAttribute("alt","New window"),p.setAttribute("style","padding-top:3px"),o.append(p),l.append(o),r.append(l)),i.append(c,r),s.append(i),n.append(a),e.append(n),e.append(s))}),document.querySelectorAll(".apbct-real-user-badge").forEach(n=>{let a=void 0,e=(this.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),n.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),n.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),n.addEventListener("mouseleave",function(){a=setTimeout(()=>{var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),n.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(()=>{e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),n.addEventListener("touchend",function(){a=setTimeout(()=>{var e=this.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(()=>{var e=n.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})}))}}); +let ctTrpIsInitialized=!1;function closeAllPopupTRP(){var e=document.querySelectorAll(".apbct-real-user-popup.visible");0{e.classList.remove("visible")})}document.addEventListener("DOMContentLoaded",function(){if(!ctTrpIsInitialized){ctTrpIsInitialized=!0;let d=void 0,u=!1;if("undefined"==typeof ctPublic&&"undefined"==typeof ctTrpAdminLocalize||void 0===(d="undefined"!=typeof ctPublic&&ctPublic.theRealPerson?ctPublic.theRealPerson:d)&&"undefined"!=typeof ctTrpAdminLocalize&&ctTrpAdminLocalize.theRealPerson&&(d=ctTrpAdminLocalize.theRealPerson,u=!0),d){let e='.apbct-trp > .comment-body *[class*="comment-author"]';document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]');var t=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong');0!==t.length&&(t.forEach((e,t)=>{var n,a,i,s,c,l,r,o,p;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"),(a=document.createElement("img")).setAttribute("src",d.imgPersonUrl),a.setAttribute("class","apbct-real-user-popup-img"),(i=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(l=document.createElement("strong")).append(d.phrases.trpHeading),(s=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),(c=document.createElement("div")).append(" "),c.append(l),c.append(d.phrases.trpContent1),(l=document.createElement("div")).style.display="flex",l.style.gap="5px",(r=document.createElement("div")).append(d.phrases.trpContent2),l.append(r),u&&(r=document.createElement("div"),(o=document.createElement("a")).setAttribute("href",d.trpContentLink),o.setAttribute("target","_blank"),(p=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),p.setAttribute("alt","New window"),p.setAttribute("style","padding-top:3px"),o.append(p),r.append(o),l.append(r)),s.append(c,l),i.append(s),n.append(a),e.append(n),e.append(i))}),document.querySelectorAll(".apbct-real-user-badge").forEach(n=>{let a=void 0,e=(this.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),n.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),n.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),n.addEventListener("mouseleave",function(){a=setTimeout(()=>{var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),n.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(()=>{e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),n.addEventListener("touchend",function(){a=setTimeout(()=>{var e=this.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(()=>{var e=n.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})}))}}}); //# sourceMappingURL=public-3-trp.min.js.map diff --git a/js/public-3-trp.min.js.map b/js/public-3-trp.min.js.map index 84fae438e..377fd3ea4 100644 --- a/js/public-3-trp.min.js.map +++ b/js/public-3-trp.min.js.map @@ -1 +1 @@ -{"version":3,"file":"public-3-trp.min.js","sources":["public-3-trp.js"],"sourcesContent":["document.addEventListener('DOMContentLoaded', function() {\n let ctTrpLocalize = undefined;\n let ctTrpIsAdminCommentsList = false;\n\n if ( typeof ctPublic !== 'undefined' || typeof ctTrpAdminLocalize !== 'undefined' ) {\n if ( typeof ctPublic !== 'undefined' && ctPublic.theRealPerson ) {\n ctTrpLocalize = ctPublic.theRealPerson;\n }\n if (\n typeof ctTrpLocalize === 'undefined' &&\n typeof ctTrpAdminLocalize !== 'undefined' &&\n ctTrpAdminLocalize.theRealPerson\n ) {\n ctTrpLocalize = ctTrpAdminLocalize.theRealPerson;\n ctTrpIsAdminCommentsList = true;\n }\n }\n\n if ( ! ctTrpLocalize ) {\n return;\n }\n\n // Selectors. Try to handle the WIDE range of themes.\n let themesCommentsSelector = '.apbct-trp > .comment-body *[class*=\"comment-author\"]';\n // For Twenty Twenty-Five theme\n let twentyTwentyFiveCommentsSelector = '.apbct-trp > .wp-block-group *[class*=\"comment-author\"]';\n if ( document.querySelector('.apbct-trp .comment-author .comment-author-link') ) {\n // For Spacious theme\n themesCommentsSelector = '.apbct-trp *[class*=\"comment-author-link\"]';\n }\n let woocommerceReviewsSelector = '.apbct-trp *[class*=\"review__author\"]';\n let adminCommentsListSelector = '.apbct-trp td[class*=\"column-author\"] > strong';\n const trpComments = document.querySelectorAll(\n themesCommentsSelector + ',' +\n twentyTwentyFiveCommentsSelector + ',' +\n woocommerceReviewsSelector + ',' +\n adminCommentsListSelector);\n\n if ( trpComments.length === 0 ) {\n return;\n }\n\n trpComments.forEach(( element, index ) => {\n // Exceptions for items that are included in the selection\n if (\n element.className.indexOf('review') < 0 &&\n typeof pagenow == 'undefined' &&\n element.parentElement.className.indexOf('group') < 0 &&\n element.tagName != 'DIV'\n ) {\n return;\n }\n\n // Do not add a badge if there is one inside the element .comment-metadata\n if (element.querySelector('.comment-metadata')) return;\n\n let trpLayout = document.createElement('div');\n trpLayout.setAttribute('class', 'apbct-real-user-badge');\n\n let trpImage = document.createElement('img');\n trpImage.setAttribute('src', ctTrpLocalize.imgPersonUrl);\n trpImage.setAttribute('class', 'apbct-real-user-popup-img');\n\n let trpDescription = document.createElement('div');\n trpDescription.setAttribute('class', 'apbct-real-user-popup');\n\n let trpDescriptionHeading = document.createElement('strong');\n trpDescriptionHeading.append(ctTrpLocalize.phrases.trpHeading);\n\n let trpDescriptionContent = document.createElement('div');\n trpDescriptionContent.setAttribute('class', 'apbct-real-user-popup-content_row');\n\n let trpDescriptionContentFirstLine = document.createElement('div');\n trpDescriptionContentFirstLine.append(' ');\n trpDescriptionContentFirstLine.append(trpDescriptionHeading);\n trpDescriptionContentFirstLine.append(ctTrpLocalize.phrases.trpContent1);\n\n let trpDescriptionContentSecondLine = document.createElement('div');\n trpDescriptionContentSecondLine.style.display = 'flex';\n trpDescriptionContentSecondLine.style.gap = '5px';\n let trpDescriptionContentSecondLineTxt = document.createElement('div');\n trpDescriptionContentSecondLineTxt.append(ctTrpLocalize.phrases.trpContent2);\n trpDescriptionContentSecondLine.append(trpDescriptionContentSecondLineTxt);\n\n if (ctTrpIsAdminCommentsList) {\n let learnMoreLinkWrap = document.createElement('div');\n let learnMoreLink = document.createElement('a');\n learnMoreLink.setAttribute('href', ctTrpLocalize.trpContentLink);\n learnMoreLink.setAttribute('target', '_blank');\n let learnMoreLinkImg = document.createElement('img');\n learnMoreLinkImg.setAttribute('src', ctAdminCommon.new_window_gif);\n learnMoreLinkImg.setAttribute('alt', 'New window');\n learnMoreLinkImg.setAttribute('style', 'padding-top:3px');\n learnMoreLink.append(learnMoreLinkImg);\n learnMoreLinkWrap.append(learnMoreLink);\n trpDescriptionContentSecondLine.append(learnMoreLinkWrap);\n }\n\n trpDescriptionContent.append(trpDescriptionContentFirstLine, trpDescriptionContentSecondLine);\n\n trpDescription.append(trpDescriptionContent);\n trpLayout.append(trpImage);\n element.append(trpLayout);\n element.append(trpDescription);\n });\n\n const badges = document.querySelectorAll('.apbct-real-user-badge');\n\n badges.forEach((badge) => {\n let hideTimeout = undefined;\n\n this.body.addEventListener('click', function(e) {\n if (\n e.target.className.indexOf('apbct-real-user') == -1 &&\n e.target.parentElement.className.indexOf('apbct-real-user') == -1\n ) {\n closeAllPopupTRP();\n }\n });\n\n badge.addEventListener('click', function() {\n const popup = this.nextElementSibling;\n if (popup && popup.classList.contains('apbct-real-user-popup')) {\n popup.classList.toggle('visible');\n }\n });\n\n badge.addEventListener('mouseenter', function() {\n closeAllPopupTRP();\n const popup = this.nextElementSibling;\n if (popup && popup.classList.contains('apbct-real-user-popup')) {\n popup.classList.add('visible');\n }\n });\n\n badge.addEventListener('mouseleave', function() {\n hideTimeout = setTimeout(() => {\n const popup = this.nextElementSibling;\n if (popup && popup.classList.contains('apbct-real-user-popup')) {\n popup.classList.remove('visible');\n }\n }, 1000);\n });\n\n const popup = badge.nextElementSibling;\n popup.addEventListener('mouseenter', function() {\n clearTimeout(hideTimeout);\n popup.classList.add('visible');\n });\n\n popup.addEventListener('mouseleave', function() {\n hideTimeout = setTimeout(() => {\n if (popup.classList.contains('apbct-real-user-popup')) {\n popup.classList.remove('visible');\n }\n }, 1000);\n });\n\n // For mobile devices\n badge.addEventListener('touchend', function() {\n hideTimeout = setTimeout(() => {\n const popup = this.nextElementSibling;\n const selection = window.getSelection();\n // Check if no text is selected\n if (popup && selection && popup.classList.contains('apbct-real-user-popup') &&\n selection.toString().length === 0\n ) {\n popup.classList.remove('visible');\n } else {\n clearTimeout(hideTimeout);\n document.addEventListener('selectionchange', function onSelectionChange() {\n const selection = window.getSelection();\n if (selection && selection.toString().length === 0) {\n // Restart the hide timeout when selection is cleared\n hideTimeout = setTimeout(() => {\n const popup = badge.nextElementSibling;\n if (popup && popup.classList.contains('apbct-real-user-popup')) {\n popup.classList.remove('visible');\n }\n }, 3000);\n document.removeEventListener('selectionchange', onSelectionChange);\n }\n });\n }\n }, 3000);\n });\n });\n});\n\n/**\n * Closing all TRP popup\n */\nfunction closeAllPopupTRP() {\n let allDisplayPopup = document.querySelectorAll('.apbct-real-user-popup.visible');\n if (allDisplayPopup.length > 0) {\n allDisplayPopup.forEach((element) => {\n element.classList.remove('visible');\n });\n }\n}\n"],"names":["closeAllPopupTRP","let","allDisplayPopup","document","querySelectorAll","length","forEach","element","classList","remove","addEventListener","ctTrpLocalize","undefined","ctTrpIsAdminCommentsList","ctPublic","ctTrpAdminLocalize","theRealPerson","themesCommentsSelector","querySelector","trpComments","index","trpLayout","trpImage","trpDescription","trpDescriptionContent","trpDescriptionContentFirstLine","trpDescriptionContentSecondLine","learnMoreLinkWrap","learnMoreLink","learnMoreLinkImg","className","indexOf","pagenow","parentElement","tagName","createElement","setAttribute","imgPersonUrl","trpDescriptionHeading","append","phrases","trpHeading","trpContent1","style","display","gap","trpDescriptionContentSecondLineTxt","trpContent2","trpContentLink","ctAdminCommon","new_window_gif","hideTimeout","popup","this","body","e","target","badge","nextElementSibling","contains","toggle","add","setTimeout","clearTimeout","selection","window","getSelection","toString","onSelectionChange","removeEventListener"],"mappings":"AAgMA,SAASA,mBACLC,IAAIC,EAAkBC,SAASC,iBAAiB,gCAAgC,EACnD,EAAzBF,EAAgBG,QAChBH,EAAgBI,QAAQ,IACpBC,EAAQC,UAAUC,OAAO,SAAS,CACtC,CAAC,CAET,CAvMAN,SAASO,iBAAiB,mBAAoB,WAC1CT,IAAIU,EAAgBC,KAAAA,EAChBC,EAA2B,CAAA,EAgB/B,GAdyB,aAApB,OAAOC,UAA0D,aAA9B,OAAOC,oBAKd,KAAA,KAHzBJ,EADqB,aAApB,OAAOG,UAA4BA,SAASE,cAC7BF,SAASE,cAGlBL,IACuB,aAA9B,OAAOI,oBACPA,mBAAmBC,gBAEnBL,EAAgBI,mBAAmBC,cACnCH,EAA2B,CAAA,GAI5BF,EAAP,CAKAV,IAAIgB,EAAyB,wDAGxBd,SAASe,cAAc,iDAAiD,IAEzED,EAAyB,8CAH7BhB,IAOMkB,EAAchB,SAASC,iBACzBa,EAF4B,+IAKH,EAED,IAAvBE,EAAYd,SAIjBc,EAAYb,QAAQ,CAAEC,EAASa,KAE3B,IAYIC,EAGAC,EAIAC,EAMAC,EAGAC,EAKAC,EAQIC,EACAC,EAGAC,EA5CJtB,EAAQuB,UAAUC,QAAQ,QAAQ,EAAI,GACpB,aAAlB,OAAOC,SACPzB,EAAQ0B,cAAcH,UAAUC,QAAQ,OAAO,EAAI,GAChC,OAAnBxB,EAAQ2B,SAMR3B,EAAQW,cAAc,mBAAmB,KAEzCG,EAAYlB,SAASgC,cAAc,KAAK,GAClCC,aAAa,QAAS,uBAAuB,GAEnDd,EAAWnB,SAASgC,cAAc,KAAK,GAClCC,aAAa,MAAOzB,EAAc0B,YAAY,EACvDf,EAASc,aAAa,QAAS,2BAA2B,GAEtDb,EAAiBpB,SAASgC,cAAc,KAAK,GAClCC,aAAa,QAAS,uBAAuB,GAExDE,EAAwBnC,SAASgC,cAAc,QAAQ,GACrCI,OAAO5B,EAAc6B,QAAQC,UAAU,GAEzDjB,EAAwBrB,SAASgC,cAAc,KAAK,GAClCC,aAAa,QAAS,mCAAmC,GAE3EX,EAAiCtB,SAASgC,cAAc,KAAK,GAClCI,OAAO,GAAG,EACzCd,EAA+Bc,OAAOD,CAAqB,EAC3Db,EAA+Bc,OAAO5B,EAAc6B,QAAQE,WAAW,GAEnEhB,EAAkCvB,SAASgC,cAAc,KAAK,GAClCQ,MAAMC,QAAU,OAChDlB,EAAgCiB,MAAME,IAAM,OACxCC,EAAqC3C,SAASgC,cAAc,KAAK,GAClCI,OAAO5B,EAAc6B,QAAQO,WAAW,EAC3ErB,EAAgCa,OAAOO,CAAkC,EAErEjC,IACIc,EAAoBxB,SAASgC,cAAc,KAAK,GAChDP,EAAgBzB,SAASgC,cAAc,GAAG,GAChCC,aAAa,OAAQzB,EAAcqC,cAAc,EAC/DpB,EAAcQ,aAAa,SAAU,QAAQ,GACzCP,EAAmB1B,SAASgC,cAAc,KAAK,GAClCC,aAAa,MAAOa,cAAcC,cAAc,EACjErB,EAAiBO,aAAa,MAAO,YAAY,EACjDP,EAAiBO,aAAa,QAAS,iBAAiB,EACxDR,EAAcW,OAAOV,CAAgB,EACrCF,EAAkBY,OAAOX,CAAa,EACtCF,EAAgCa,OAAOZ,CAAiB,GAG5DH,EAAsBe,OAAOd,EAAgCC,CAA+B,EAE5FH,EAAegB,OAAOf,CAAqB,EAC3CH,EAAUkB,OAAOjB,CAAQ,EACzBf,EAAQgC,OAAOlB,CAAS,EACxBd,EAAQgC,OAAOhB,CAAc,EACjC,CAAC,EAEcpB,SAASC,iBAAiB,wBAAwB,EAE1DE,QAAQ,IACXL,IAAIkD,EAAcvC,KAAAA,EAmCZwC,GAjCNC,KAAKC,KAAK5C,iBAAiB,QAAS,SAAS6C,GAEY,CAAC,GAAlDA,EAAEC,OAAO1B,UAAUC,QAAQ,iBAAiB,GACmB,CAAC,GAAhEwB,EAAEC,OAAOvB,cAAcH,UAAUC,QAAQ,iBAAiB,GAE1D/B,iBAAiB,CAEzB,CAAC,EAEDyD,EAAM/C,iBAAiB,QAAS,WAC5B,IAAM0C,EAAQC,KAAKK,mBACfN,GAASA,EAAM5C,UAAUmD,SAAS,uBAAuB,GACzDP,EAAM5C,UAAUoD,OAAO,SAAS,CAExC,CAAC,EAEDH,EAAM/C,iBAAiB,aAAc,WACjCV,iBAAiB,EACjB,IAAMoD,EAAQC,KAAKK,mBACfN,GAASA,EAAM5C,UAAUmD,SAAS,uBAAuB,GACzDP,EAAM5C,UAAUqD,IAAI,SAAS,CAErC,CAAC,EAEDJ,EAAM/C,iBAAiB,aAAc,WACjCyC,EAAcW,WAAW,KACrB,IAAMV,EAAQC,KAAKK,mBACfN,GAASA,EAAM5C,UAAUmD,SAAS,uBAAuB,GACzDP,EAAM5C,UAAUC,OAAO,SAAS,CAExC,EAAG,GAAI,CACX,CAAC,EAEagD,EAAMC,oBACpBN,EAAM1C,iBAAiB,aAAc,WACjCqD,aAAaZ,CAAW,EACxBC,EAAM5C,UAAUqD,IAAI,SAAS,CACjC,CAAC,EAEDT,EAAM1C,iBAAiB,aAAc,WACjCyC,EAAcW,WAAW,KACjBV,EAAM5C,UAAUmD,SAAS,uBAAuB,GAChDP,EAAM5C,UAAUC,OAAO,SAAS,CAExC,EAAG,GAAI,CACX,CAAC,EAGDgD,EAAM/C,iBAAiB,WAAY,WAC/ByC,EAAcW,WAAW,KACrB,IAAMV,EAAQC,KAAKK,mBACbM,EAAYC,OAAOC,aAAa,EAElCd,GAASY,GAAaZ,EAAM5C,UAAUmD,SAAS,uBAAuB,GACtC,IAAhCK,EAAUG,SAAS,EAAE9D,OAErB+C,EAAM5C,UAAUC,OAAO,SAAS,GAEhCsD,aAAaZ,CAAW,EACxBhD,SAASO,iBAAiB,kBAAmB,SAAS0D,IAClD,IAAMJ,EAAYC,OAAOC,aAAa,EAClCF,GAA6C,IAAhCA,EAAUG,SAAS,EAAE9D,SAElC8C,EAAcW,WAAW,KACrB,IAAMV,EAAQK,EAAMC,mBAChBN,GAASA,EAAM5C,UAAUmD,SAAS,uBAAuB,GACzDP,EAAM5C,UAAUC,OAAO,SAAS,CAExC,EAAG,GAAI,EACPN,SAASkE,oBAAoB,kBAAmBD,CAAiB,EAEzE,CAAC,EAET,EAAG,GAAI,CACX,CAAC,CACL,CAAC,EAtKD,CAuKJ,CAAC"} \ No newline at end of file +{"version":3,"file":"public-3-trp.min.js","sources":["public-3-trp.js"],"sourcesContent":["let ctTrpIsInitialized = false;\n\ndocument.addEventListener('DOMContentLoaded', function() {\n // Some plugins dispatch a synthetic DOMContentLoaded, badges must not be built twice\n if (ctTrpIsInitialized) {\n return;\n }\n ctTrpIsInitialized = true;\n\n let ctTrpLocalize = undefined;\n let ctTrpIsAdminCommentsList = false;\n\n if ( typeof ctPublic !== 'undefined' || typeof ctTrpAdminLocalize !== 'undefined' ) {\n if ( typeof ctPublic !== 'undefined' && ctPublic.theRealPerson ) {\n ctTrpLocalize = ctPublic.theRealPerson;\n }\n if (\n typeof ctTrpLocalize === 'undefined' &&\n typeof ctTrpAdminLocalize !== 'undefined' &&\n ctTrpAdminLocalize.theRealPerson\n ) {\n ctTrpLocalize = ctTrpAdminLocalize.theRealPerson;\n ctTrpIsAdminCommentsList = true;\n }\n }\n\n if ( ! ctTrpLocalize ) {\n return;\n }\n\n // Selectors. Try to handle the WIDE range of themes.\n let themesCommentsSelector = '.apbct-trp > .comment-body *[class*=\"comment-author\"]';\n // For Twenty Twenty-Five theme\n let twentyTwentyFiveCommentsSelector = '.apbct-trp > .wp-block-group *[class*=\"comment-author\"]';\n if ( document.querySelector('.apbct-trp .comment-author .comment-author-link') ) {\n // For Spacious theme\n themesCommentsSelector = '.apbct-trp *[class*=\"comment-author-link\"]';\n }\n let woocommerceReviewsSelector = '.apbct-trp *[class*=\"review__author\"]';\n let adminCommentsListSelector = '.apbct-trp td[class*=\"column-author\"] > strong';\n const trpComments = document.querySelectorAll(\n themesCommentsSelector + ',' +\n twentyTwentyFiveCommentsSelector + ',' +\n woocommerceReviewsSelector + ',' +\n adminCommentsListSelector);\n\n if ( trpComments.length === 0 ) {\n return;\n }\n\n trpComments.forEach(( element, index ) => {\n // Exceptions for items that are included in the selection\n if (\n element.className.indexOf('review') < 0 &&\n typeof pagenow == 'undefined' &&\n element.parentElement.className.indexOf('group') < 0 &&\n element.tagName != 'DIV'\n ) {\n return;\n }\n\n // Do not add a badge if there is one inside the element .comment-metadata\n if (element.querySelector('.comment-metadata')) return;\n\n let trpLayout = document.createElement('div');\n trpLayout.setAttribute('class', 'apbct-real-user-badge');\n\n let trpImage = document.createElement('img');\n trpImage.setAttribute('src', ctTrpLocalize.imgPersonUrl);\n trpImage.setAttribute('class', 'apbct-real-user-popup-img');\n\n let trpDescription = document.createElement('div');\n trpDescription.setAttribute('class', 'apbct-real-user-popup');\n\n let trpDescriptionHeading = document.createElement('strong');\n trpDescriptionHeading.append(ctTrpLocalize.phrases.trpHeading);\n\n let trpDescriptionContent = document.createElement('div');\n trpDescriptionContent.setAttribute('class', 'apbct-real-user-popup-content_row');\n\n let trpDescriptionContentFirstLine = document.createElement('div');\n trpDescriptionContentFirstLine.append(' ');\n trpDescriptionContentFirstLine.append(trpDescriptionHeading);\n trpDescriptionContentFirstLine.append(ctTrpLocalize.phrases.trpContent1);\n\n let trpDescriptionContentSecondLine = document.createElement('div');\n trpDescriptionContentSecondLine.style.display = 'flex';\n trpDescriptionContentSecondLine.style.gap = '5px';\n let trpDescriptionContentSecondLineTxt = document.createElement('div');\n trpDescriptionContentSecondLineTxt.append(ctTrpLocalize.phrases.trpContent2);\n trpDescriptionContentSecondLine.append(trpDescriptionContentSecondLineTxt);\n\n if (ctTrpIsAdminCommentsList) {\n let learnMoreLinkWrap = document.createElement('div');\n let learnMoreLink = document.createElement('a');\n learnMoreLink.setAttribute('href', ctTrpLocalize.trpContentLink);\n learnMoreLink.setAttribute('target', '_blank');\n let learnMoreLinkImg = document.createElement('img');\n learnMoreLinkImg.setAttribute('src', ctAdminCommon.new_window_gif);\n learnMoreLinkImg.setAttribute('alt', 'New window');\n learnMoreLinkImg.setAttribute('style', 'padding-top:3px');\n learnMoreLink.append(learnMoreLinkImg);\n learnMoreLinkWrap.append(learnMoreLink);\n trpDescriptionContentSecondLine.append(learnMoreLinkWrap);\n }\n\n trpDescriptionContent.append(trpDescriptionContentFirstLine, trpDescriptionContentSecondLine);\n\n trpDescription.append(trpDescriptionContent);\n trpLayout.append(trpImage);\n element.append(trpLayout);\n element.append(trpDescription);\n });\n\n const badges = document.querySelectorAll('.apbct-real-user-badge');\n\n badges.forEach((badge) => {\n let hideTimeout = undefined;\n\n this.body.addEventListener('click', function(e) {\n if (\n e.target.className.indexOf('apbct-real-user') == -1 &&\n e.target.parentElement.className.indexOf('apbct-real-user') == -1\n ) {\n closeAllPopupTRP();\n }\n });\n\n badge.addEventListener('click', function() {\n const popup = this.nextElementSibling;\n if (popup && popup.classList.contains('apbct-real-user-popup')) {\n popup.classList.toggle('visible');\n }\n });\n\n badge.addEventListener('mouseenter', function() {\n closeAllPopupTRP();\n const popup = this.nextElementSibling;\n if (popup && popup.classList.contains('apbct-real-user-popup')) {\n popup.classList.add('visible');\n }\n });\n\n badge.addEventListener('mouseleave', function() {\n hideTimeout = setTimeout(() => {\n const popup = this.nextElementSibling;\n if (popup && popup.classList.contains('apbct-real-user-popup')) {\n popup.classList.remove('visible');\n }\n }, 1000);\n });\n\n const popup = badge.nextElementSibling;\n popup.addEventListener('mouseenter', function() {\n clearTimeout(hideTimeout);\n popup.classList.add('visible');\n });\n\n popup.addEventListener('mouseleave', function() {\n hideTimeout = setTimeout(() => {\n if (popup.classList.contains('apbct-real-user-popup')) {\n popup.classList.remove('visible');\n }\n }, 1000);\n });\n\n // For mobile devices\n badge.addEventListener('touchend', function() {\n hideTimeout = setTimeout(() => {\n const popup = this.nextElementSibling;\n const selection = window.getSelection();\n // Check if no text is selected\n if (popup && selection && popup.classList.contains('apbct-real-user-popup') &&\n selection.toString().length === 0\n ) {\n popup.classList.remove('visible');\n } else {\n clearTimeout(hideTimeout);\n document.addEventListener('selectionchange', function onSelectionChange() {\n const selection = window.getSelection();\n if (selection && selection.toString().length === 0) {\n // Restart the hide timeout when selection is cleared\n hideTimeout = setTimeout(() => {\n const popup = badge.nextElementSibling;\n if (popup && popup.classList.contains('apbct-real-user-popup')) {\n popup.classList.remove('visible');\n }\n }, 3000);\n document.removeEventListener('selectionchange', onSelectionChange);\n }\n });\n }\n }, 3000);\n });\n });\n});\n\n/**\n * Closing all TRP popup\n */\nfunction closeAllPopupTRP() {\n let allDisplayPopup = document.querySelectorAll('.apbct-real-user-popup.visible');\n if (allDisplayPopup.length > 0) {\n allDisplayPopup.forEach((element) => {\n element.classList.remove('visible');\n });\n }\n}\n"],"names":["let","ctTrpIsInitialized","closeAllPopupTRP","allDisplayPopup","document","querySelectorAll","length","forEach","element","classList","remove","addEventListener","ctTrpLocalize","undefined","ctTrpIsAdminCommentsList","ctPublic","ctTrpAdminLocalize","theRealPerson","themesCommentsSelector","querySelector","trpComments","index","trpLayout","trpImage","trpDescription","trpDescriptionContent","trpDescriptionContentFirstLine","trpDescriptionContentSecondLine","learnMoreLinkWrap","learnMoreLink","learnMoreLinkImg","className","indexOf","pagenow","parentElement","tagName","createElement","setAttribute","imgPersonUrl","trpDescriptionHeading","append","phrases","trpHeading","trpContent1","style","display","gap","trpDescriptionContentSecondLineTxt","trpContent2","trpContentLink","ctAdminCommon","new_window_gif","hideTimeout","popup","this","body","e","target","badge","nextElementSibling","contains","toggle","add","setTimeout","clearTimeout","selection","window","getSelection","toString","onSelectionChange","removeEventListener"],"mappings":"AAAAA,IAAIC,mBAAqB,CAAA,EAwMzB,SAASC,mBACLF,IAAIG,EAAkBC,SAASC,iBAAiB,gCAAgC,EACnD,EAAzBF,EAAgBG,QAChBH,EAAgBI,QAAQ,IACpBC,EAAQC,UAAUC,OAAO,SAAS,CACtC,CAAC,CAET,CA7MAN,SAASO,iBAAiB,mBAAoB,WAE1C,GAAIV,CAAAA,mBAAJ,CAGAA,mBAAqB,CAAA,EAErBD,IAAIY,EAAgBC,KAAAA,EAChBC,EAA2B,CAAA,EAgB/B,GAdyB,aAApB,OAAOC,UAA0D,aAA9B,OAAOC,oBAKd,KAAA,KAHzBJ,EADqB,aAApB,OAAOG,UAA4BA,SAASE,cAC7BF,SAASE,cAGlBL,IACuB,aAA9B,OAAOI,oBACPA,mBAAmBC,gBAEnBL,EAAgBI,mBAAmBC,cACnCH,EAA2B,CAAA,GAI5BF,EAAP,CAKAZ,IAAIkB,EAAyB,wDAGxBd,SAASe,cAAc,iDAAiD,IAEzED,EAAyB,8CAH7BlB,IAOMoB,EAAchB,SAASC,iBACzBa,EAF4B,+IAKH,EAED,IAAvBE,EAAYd,SAIjBc,EAAYb,QAAQ,CAAEC,EAASa,KAE3B,IAYIC,EAGAC,EAIAC,EAMAC,EAGAC,EAKAC,EAQIC,EACAC,EAGAC,EA5CJtB,EAAQuB,UAAUC,QAAQ,QAAQ,EAAI,GACpB,aAAlB,OAAOC,SACPzB,EAAQ0B,cAAcH,UAAUC,QAAQ,OAAO,EAAI,GAChC,OAAnBxB,EAAQ2B,SAMR3B,EAAQW,cAAc,mBAAmB,KAEzCG,EAAYlB,SAASgC,cAAc,KAAK,GAClCC,aAAa,QAAS,uBAAuB,GAEnDd,EAAWnB,SAASgC,cAAc,KAAK,GAClCC,aAAa,MAAOzB,EAAc0B,YAAY,EACvDf,EAASc,aAAa,QAAS,2BAA2B,GAEtDb,EAAiBpB,SAASgC,cAAc,KAAK,GAClCC,aAAa,QAAS,uBAAuB,GAExDE,EAAwBnC,SAASgC,cAAc,QAAQ,GACrCI,OAAO5B,EAAc6B,QAAQC,UAAU,GAEzDjB,EAAwBrB,SAASgC,cAAc,KAAK,GAClCC,aAAa,QAAS,mCAAmC,GAE3EX,EAAiCtB,SAASgC,cAAc,KAAK,GAClCI,OAAO,GAAG,EACzCd,EAA+Bc,OAAOD,CAAqB,EAC3Db,EAA+Bc,OAAO5B,EAAc6B,QAAQE,WAAW,GAEnEhB,EAAkCvB,SAASgC,cAAc,KAAK,GAClCQ,MAAMC,QAAU,OAChDlB,EAAgCiB,MAAME,IAAM,OACxCC,EAAqC3C,SAASgC,cAAc,KAAK,GAClCI,OAAO5B,EAAc6B,QAAQO,WAAW,EAC3ErB,EAAgCa,OAAOO,CAAkC,EAErEjC,IACIc,EAAoBxB,SAASgC,cAAc,KAAK,GAChDP,EAAgBzB,SAASgC,cAAc,GAAG,GAChCC,aAAa,OAAQzB,EAAcqC,cAAc,EAC/DpB,EAAcQ,aAAa,SAAU,QAAQ,GACzCP,EAAmB1B,SAASgC,cAAc,KAAK,GAClCC,aAAa,MAAOa,cAAcC,cAAc,EACjErB,EAAiBO,aAAa,MAAO,YAAY,EACjDP,EAAiBO,aAAa,QAAS,iBAAiB,EACxDR,EAAcW,OAAOV,CAAgB,EACrCF,EAAkBY,OAAOX,CAAa,EACtCF,EAAgCa,OAAOZ,CAAiB,GAG5DH,EAAsBe,OAAOd,EAAgCC,CAA+B,EAE5FH,EAAegB,OAAOf,CAAqB,EAC3CH,EAAUkB,OAAOjB,CAAQ,EACzBf,EAAQgC,OAAOlB,CAAS,EACxBd,EAAQgC,OAAOhB,CAAc,EACjC,CAAC,EAEcpB,SAASC,iBAAiB,wBAAwB,EAE1DE,QAAQ,IACXP,IAAIoD,EAAcvC,KAAAA,EAmCZwC,GAjCNC,KAAKC,KAAK5C,iBAAiB,QAAS,SAAS6C,GAEY,CAAC,GAAlDA,EAAEC,OAAO1B,UAAUC,QAAQ,iBAAiB,GACmB,CAAC,GAAhEwB,EAAEC,OAAOvB,cAAcH,UAAUC,QAAQ,iBAAiB,GAE1D9B,iBAAiB,CAEzB,CAAC,EAEDwD,EAAM/C,iBAAiB,QAAS,WAC5B,IAAM0C,EAAQC,KAAKK,mBACfN,GAASA,EAAM5C,UAAUmD,SAAS,uBAAuB,GACzDP,EAAM5C,UAAUoD,OAAO,SAAS,CAExC,CAAC,EAEDH,EAAM/C,iBAAiB,aAAc,WACjCT,iBAAiB,EACjB,IAAMmD,EAAQC,KAAKK,mBACfN,GAASA,EAAM5C,UAAUmD,SAAS,uBAAuB,GACzDP,EAAM5C,UAAUqD,IAAI,SAAS,CAErC,CAAC,EAEDJ,EAAM/C,iBAAiB,aAAc,WACjCyC,EAAcW,WAAW,KACrB,IAAMV,EAAQC,KAAKK,mBACfN,GAASA,EAAM5C,UAAUmD,SAAS,uBAAuB,GACzDP,EAAM5C,UAAUC,OAAO,SAAS,CAExC,EAAG,GAAI,CACX,CAAC,EAEagD,EAAMC,oBACpBN,EAAM1C,iBAAiB,aAAc,WACjCqD,aAAaZ,CAAW,EACxBC,EAAM5C,UAAUqD,IAAI,SAAS,CACjC,CAAC,EAEDT,EAAM1C,iBAAiB,aAAc,WACjCyC,EAAcW,WAAW,KACjBV,EAAM5C,UAAUmD,SAAS,uBAAuB,GAChDP,EAAM5C,UAAUC,OAAO,SAAS,CAExC,EAAG,GAAI,CACX,CAAC,EAGDgD,EAAM/C,iBAAiB,WAAY,WAC/ByC,EAAcW,WAAW,KACrB,IAAMV,EAAQC,KAAKK,mBACbM,EAAYC,OAAOC,aAAa,EAElCd,GAASY,GAAaZ,EAAM5C,UAAUmD,SAAS,uBAAuB,GACtC,IAAhCK,EAAUG,SAAS,EAAE9D,OAErB+C,EAAM5C,UAAUC,OAAO,SAAS,GAEhCsD,aAAaZ,CAAW,EACxBhD,SAASO,iBAAiB,kBAAmB,SAAS0D,IAClD,IAAMJ,EAAYC,OAAOC,aAAa,EAClCF,GAA6C,IAAhCA,EAAUG,SAAS,EAAE9D,SAElC8C,EAAcW,WAAW,KACrB,IAAMV,EAAQK,EAAMC,mBAChBN,GAASA,EAAM5C,UAAUmD,SAAS,uBAAuB,GACzDP,EAAM5C,UAAUC,OAAO,SAAS,CAExC,EAAG,GAAI,EACPN,SAASkE,oBAAoB,kBAAmBD,CAAiB,EAEzE,CAAC,EAET,EAAG,GAAI,CACX,CAAC,CACL,CAAC,EAtKD,CAtBA,CA6LJ,CAAC"} \ No newline at end of file diff --git a/js/public/apbct-react-bundle.js b/js/public/apbct-react-bundle.js index d5bc29471..0f6416195 100644 --- a/js/public/apbct-react-bundle.js +++ b/js/public/apbct-react-bundle.js @@ -1,2 +1,2 @@ /*! For license information please see apbct-react-bundle.js.LICENSE.txt */ -(()=>{"use strict";var e={606(e,n,t){var r=t(601),a=t.n(r),l=t(314),o=t.n(l),i=t(417),u=t.n(i),c=new URL(t(199),t.b),s=o()(a()),f=u()(c);s.push([e.id,`.apbct-signup-wizard {\n display: flex;\n position: fixed;\n width: stretch;\n top: 0;\n bottom: 0;\n overflow-y: auto;\n justify-content: center;\n align-items: center;\n min-height: 100vh;\n background: #F0F0F1;\n font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;\n color: #444444;\n}\n.apbct-signup-wizard * {\n box-sizing: border-box;\n}\n.apbct-signup-wizard-card {\n background: #ffffff;\n border-radius: 8px;\n box-shadow: 0 4px 15px rgba(132, 132, 132, 0.25);\n width: 60%;\n padding: 32px;\n display: flex;\n justify-content: space-between;\n}\n@media (max-width: 1600px) {\n .apbct-signup-wizard-card {\n width: 80%;\n }\n}\n@media (max-width: 1024px) {\n .apbct-signup-wizard-card {\n width: 100%;\n padding: 24px;\n }\n}\n.apbct-signup-wizard-card.existing-user,\n.apbct-signup-wizard-card.apbct-signup-wizard-card-error,\n.apbct-signup-wizard-card.apbct-signup-wizard-card-success {\n flex-direction: column;\n}\n\n.apbct-signup-wizard-title {\n font-size: 20px;\n font-weight: 500;\n color: #000;\n margin: 0;\n margin-bottom: 32px;\n}\n.apbct-signup-wizard-subtitle {\n font-size: 18px;\n line-height: 22px;\n font-weight: 600;\n color: #000;\n margin-bottom: 12px;\n}\n.apbct-signup-wizard-card > div {\n width: 50%;\n border-radius: 8px;\n}\n.apbct-signup-wizard-card.existing-user > div,\n.apbct-signup-wizard-card.apbct-signup-wizard-card-error > div,\n.apbct-signup-wizard-card.apbct-signup-wizard-card-success > div\n{\n width: 100%;\n}\n.apbct-signup-wizard-checked-ico {\n display: inline-block;\n width: 18px;\n height: 18px;\n position: relative;\n padding: 2px 12px 0 0;\n margin-right: 12px;\n}\n.apbct-signup-wizard-checked-ico::after {\n content: '';\n position: absolute;\n left: 4px;\n top: 1px;\n width: 8px;\n height: 13px;\n border: solid #026E88;\n border-width: 0 2.5px 2.5px 0;\n transform: rotate(45deg);\n}\n.apbct-signup-wizard-card-left > svg {\n margin-bottom: 22px;\n}\n.apbct-signup-wizard-card-left > div {\n padding: 0 32px;\n}\n.apbct-signup-wizard-card-left p {\n font-size: 16px;\n line-height: 22px;\n display: flex;\n margin: 0 0 18px 0;\n}\n.apbct-signup-wizard-card .apbct-signup-wizard-beautiful-digits {\n font-size: 16px;\n line-height: 22px;\n}\n.apbct-signup-wizard-card-left p.apbct-signup-wizard-title {\n font-size: 24px;\n font-weight: 500;\n line-height: 29px;\n color: #000;\n}\n.apbct-signup-wizard-card-left .apbct-signup-wizard-what-next {\n margin-top: 64px;\n}\n.apbct-signup-wizard-card-left .apbct-signup-wizard-what-next-title {\n display: inline-block;\n background: #F3F6F9;\n border-radius: 18px;\n padding: 8px 16px;\n font-size: 16px;\n font-weight: 500;\n line-height: 19px;\n color: #000;\n}\n.apbct-signup-wizard-card-left .apbct-signup-wizard-what-next-hint{\n display: inline-block;\n font-size: 14px;\n line-height: 22px;\n margin-top: 8px;\n}\n.apbct-signup-wizard-card-right {\n background: #F3F6F9;\n padding: 48px 62px;\n text-align: center;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n}\n.apbct-signup-wizard-form-group {\n position: relative;\n margin-bottom: 12px;\n}\n.apbct-signup-wizard-form-group input,\n.apbct-signup-wizard-form-group button {\n width: 100%;\n height: 44px;\n}\n.apbct-signup-wizard-form-group input[type="email"],\n.apbct-signup-wizard-form-group input[type="text"] {\n border: 1px solid #026E88;\n border-radius: 7px;\n box-shadow: none;\n}\n.apbct-signup-wizard-form-group .apbct-signup-wizard-input-title {\n color: #026E88;\n font-size: 12px;\n position: absolute;\n top: -1px;\n left: 10px;\n background: #F3F6F9;\n height: 2px;\n line-height: 0;\n padding: 0 5px;\n}\n.apbct-signup-wizard-form-group.checkbox-block {\n text-align: left;\n height: 18px;\n}\n.apbct-signup-wizard-form-group.checkbox-block input[type="checkbox"] {\n position: absolute;\n opacity: 0;\n width: 0;\n height: 0;\n margin: 0;\n}\n.apbct-signup-wizard-form-group.checkbox-block input[type="checkbox"] + label {\n display: inline-flex;\n align-items: center;\n gap: 10px;\n cursor: pointer;\n user-select: none;\n height: 18px;\n color: #646464;\n}\n.apbct-signup-wizard-form-group.checkbox-block input[type="checkbox"] + label:before {\n content: '';\n width: 16px;\n height: 16px;\n background-color: #fff;\n border: 1px solid #026E88;\n border-radius: 4px;\n transition: all 0.2s ease;\n}\n.apbct-signup-wizard-form-group.checkbox-block input[type="checkbox"]:checked + label:before {\n background-color: #026E88;\n border-color: #026E88;\n background-image: url(${f});\n background-repeat: no-repeat;\n background-position: center;\n background-size: 14px;\n}\n.apbct-signup-wizard-form-group.checkbox-block input[type="checkbox"] + label:hover::before {\n border-color: #026E88;\n}\n.apbct-signup-wizard-form-group.checkbox-block a {\n color: #646464;\n text-decoration: none;\n transition: color .1s cubic-bezier(.39,.575,.565,1)\n}\n.apbct-signup-wizard-form-group.checkbox-block a:hover {\n color: #026E88;\n}\n.apbct-signup-wizard-form-group button,\n.apbct-signup-wizard-form-group a.apbct-signup-wizard-link-button {\n transition: opacity .1s cubic-bezier(.39,.575,.565,1);\n font-size: 16px;\n font-weight: 500;\n border-radius: 8px;\n margin-bottom: 20px;\n cursor: pointer;\n}\n.apbct-signup-wizard-form-group button:hover,\n.apbct-signup-wizard-form-group a.apbct-signup-wizard-link-button:hover {\n opacity: .75;\n}\n.apbct-signup-wizard-form-group button[type="submit"] {\n background: #026E88;\n color: #FFFFFF;\n border: none;\n font-weight: 400;\n}\n.apbct-signup-wizard-form-group.apbct-signup-wizard-subtitle {\n text-align: left;\n}\n.apbct-signup-wizard-form-group button[name="existingUser"] {\n background: #DFE4E9;\n border: 1px solid #D6D8DB;\n color: #444444;\n}\n.apbct-signup-wizard-card .apbct-signup-wizard-skip-wizard-link,\n.apbct-signup-wizard-card .apbct-signup-wizard-skip-wizard-link:hover {\n color: #646464;\n font-size: 14px;\n font-weight: 400;\n line-height: 22px;\n}\n.apbct-signup-wizard-card.existing-user a {\n text-decoration: none;\n display: flex;\n gap: 4px;\n}\n.apbct-signup-wizard-card.existing-user a:hover,\n.apbct-signup-wizard-card.existing-user a:focus {\n text-decoration: underline;\n}\n.apbct-signup-wizard-card.existing-user p {\n font-size: 16px;\n}\n.apbct-signup-wizard-card.existing-user p a.apbct-signup-wizard-inline-link {\n display: inline;\n color: #646464;\n text-decoration: underline;\n transition: color .1s cubic-bezier(.39,.575,.565,1);\n}\n.apbct-signup-wizard-card.existing-user p a.apbct-signup-wizard-inline-link:hover,\n.apbct-signup-wizard-card.existing-user p a.apbct-signup-wizard-inline-link:focus {\n color: #026E88;\n}\n.apbct-signup-wizard-card.existing-user .apbct-signup-wizard-card-inner {\n padding: 32px;\n}\n.apbct-signup-wizard-card.existing-user .apbct-signup-wizard-title {\n font-weight: 500;\n font-size: 24px;\n line-height: 29px;\n margin-bottom: 16px;\n}\n.apbct-signup-wizard-card.existing-user form {\n background: #F3F6F9;\n border-radius: 8px;\n padding: 32px;\n display: flex;\n gap: 24px;\n}\n.apbct-signup-wizard-card.existing-user .apbct-signup-wizard-form-group,\n.apbct-signup-wizard-card.existing-user .apbct-signup-wizard-form-group input,\n.apbct-signup-wizard-card.existing-user .apbct-signup-wizard-form-group button {\n margin: 0;\n}\n.apbct-signup-wizard-card.existing-user .apbct-signup-wizard-form-group:first-child {\n flex-grow: 1;\n}\n.apbct-signup-wizard-card.existing-user .apbct-signup-wizard-form-group button {\n padding: 0 48px;\n}\n.apbct-signup-wizard-card.apbct-signup-wizard-card-error .apbct-signup-wizard-error-head,\n.apbct-signup-wizard-card.apbct-signup-wizard-card-success .apbct-signup-wizard-success-head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n.apbct-signup-wizard-card.apbct-signup-wizard-card-error .apbct-signup-wizard-error-title {\n display: flex;\n align-items: center;\n}\n.apbct-signup-wizard-card.apbct-signup-wizard-card-error .apbct-signup-wizard-error-title svg {\n margin-right: 12px;\n}\n.apbct-signup-wizard-card.apbct-signup-wizard-card-error .apbct-signup-wizard-error-title h2 {\n font-size: 24px;\n font-weight: 500;\n color: #A94442;\n margin: 0;\n}\n.apbct-signup-wizard-card.apbct-signup-wizard-card-error .apbct-signup-wizard-title {\n padding: 32px;\n color: #000;\n font-size: 16px;\n font-weight: 400;\n line-height: 22px;\n}\n.apbct-signup-wizard-card.apbct-signup-wizard-card-error .apbct-signup-wizard-error-links a {\n color: #444444;\n margin-right: 16px;\n font-size: 14px;\n font-weight: 400;\n line-height: 22px;\n}\n.apbct-signup-wizard-card.apbct-signup-wizard-card-success p {\n margin: 0 0 32px;\n text-align: center;\n font-size: 16px;\n}\n.apbct-signup-wizard-card.apbct-signup-wizard-card-success p.apbct-signup-wizard-title {\n margin-bottom: 14px;\n margin-top: 18px;\n font-size: 24px;\n}\n.apbct-signup-wizard-card.apbct-signup-wizard-card-success p.apbct-signup-wizard-title svg {\n margin-right: 8px;\n}\n.apbct-signup-wizard-card.apbct-signup-wizard-card-success .apbct-signup-wizard-form-group {\n text-align: center;\n margin-bottom: 0;\n}\n.apbct-signup-wizard-card.apbct-signup-wizard-card-success .apbct-signup-wizard-form-group a.apbct-signup-wizard-link-button {\n background: #026E88;\n color: #FFF;\n border: none;\n font-weight: 400;\n width: auto;\n padding: 10px 20px;\n margin-bottom: 0;\n text-decoration: none;\n outline: none;\n}\n.apbct-signup-wizard-connecting-gif img {\n width: 100%;\n border-radius: 8px;\n}\n.apbct-signup-wizard-card-left > div.apbct-signup-wizard-connecting-gif {\n padding: 0 24px;\n}\n.apbct-signup-wizard-card.apbct-signup-wizard-card-connecting {\n padding-bottom: 64px;\n}\n.apbct-signup-wizard-card.apbct-signup-wizard-card-connecting .apbct-signup-wizard-card-inner {\n padding: 0 24px;\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n.apbct-signup-wizard-card.apbct-signup-wizard-card-connecting .apbct-signup-wizard-title {\n font-size: 24px;\n font-weight: 500;\n line-height: 29px;\n margin-bottom: 24px;\n}\n.apbct-signup-wizard-card .apbct-signup-wizard-progressbar-legend {\n font-size: 14px;\n display: flex;\n justify-content: space-between;\n margin-bottom: 8px;\n}\n.apbct-signup-wizard-card .apbct-signup-wizard-progressbar-legend .apbct-signup-wizard-progressbar-legend-percent {\n color: #026E88;\n}\n.apbct-signup-wizard-card .apbct-signup-wizard-progressbar {\n height: 10px;\n border-radius: 5px;\n background: #E1ECF1;\n position: relative;\n}\n.apbct-signup-wizard-card .apbct-signup-wizard-progressbar div {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 10px;\n border-radius: 5px;\n background-image: linear-gradient(to right, #BAB9F9, #026E88);\n background-size: 500px 100%;\n background-repeat: no-repeat;\n transition: width .3s cubic-bezier(.39,.575,.565,1);\n}\n`,""]);const d=s;t.d(n,["A",0,d])},567(e,n,t){var r=t(601),a=t.n(r),l=t(314),o=t.n(l)()(a());o.push([e.id,".apbct-signup-wizard-shell {\n max-width: 720px;\n margin: 24px 0 40px;\n padding: 32px 36px;\n background: #fff;\n border: 1px solid #dce4ea;\n border-radius: 12px;\n box-shadow: 0 8px 24px rgba(30, 42, 50, 0.06);\n}\n\n.apbct-signup-wizard-shell__title {\n margin: 0 0 8px;\n font-size: 22px;\n line-height: 1.3;\n color: #1e2a32;\n}\n\n.apbct-signup-wizard-shell__hint {\n margin: 0;\n font-size: 14px;\n color: #5c6b76;\n}\n",""]);const i=o;t.d(n,["A",0,i])},314(e){e.exports=function(e){var n=[];return n.toString=function(){return this.map(function(n){var t="",r=void 0!==n[5];return n[4]&&(t+="@supports (".concat(n[4],") {")),n[2]&&(t+="@media ".concat(n[2]," {")),r&&(t+="@layer".concat(n[5].length>0?" ".concat(n[5]):""," {")),t+=e(n),r&&(t+="}"),n[2]&&(t+="}"),n[4]&&(t+="}"),t}).join("")},n.i=function(e,t,r,a,l){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(r)for(var i=0;i0?" ".concat(s[5]):""," {").concat(s[1],"}")),s[5]=l),t&&(s[2]?(s[1]="@media ".concat(s[2]," {").concat(s[1],"}"),s[2]=t):s[2]=t),a&&(s[4]?(s[1]="@supports (".concat(s[4],") {").concat(s[1],"}"),s[4]=a):s[4]="".concat(a)),n.push(s))}},n}},417(e){e.exports=function(e,n){return n||(n={}),e?(e=String(e.__esModule?e.default:e),/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),n.hash&&(e+=n.hash),/["'() \t\n]|(%20)/.test(e)||n.needQuotes?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e):e}},601(e){e.exports=function(e){return e[1]}},551(e,n,t){var r=t(540),a=t(982);function l(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,t=1;t
', $position, strlen('

')); + } + + /** + * Version offered by the WordPress updates transient. + * + * @param string $plugin_file + * + * @return string empty string when no update is available + */ + protected function getOfferedVersion($plugin_file) + { + $updates = get_site_transient('update_plugins'); + + return isset($updates->response[$plugin_file]->new_version) + ? (string)$updates->response[$plugin_file]->new_version + : ''; + } + + /** + * Returns the sanitized changelog of the given version. Result is cached, + * including the negative one, to avoid hammering remote sources. + * + * @param string $version + * + * @return string empty string when the changelog can not be obtained + */ + protected function getChangelogHtml($version) + { + $cache_key = static::CACHE_PREFIX . md5($this->getSlug() . '|' . $version); + $cached = $this->getCache($cache_key); + + if ( $cached !== false ) { + return is_string($cached) ? $cached : ''; + } + + $html = $this->fetchFromWpOrg($version); + + if ( $html === '' ) { + $html = $this->fetchFromGitHub($version); + } + + $this->setCache( + $cache_key, + $html, + $html !== '' ? static::CACHE_TTL_SUCCESS : static::CACHE_TTL_FAIL + ); + + return $html; + } + + /** + * Primary source: WordPress.org plugin information API. + * + * @param string $version + * + * @return string + */ + protected function fetchFromWpOrg($version) + { + $info = $this->requestPluginInformation(); + + if ( is_wp_error($info) ) { + return ''; + } + + $info = (array) $info; + $sections = $info['sections'] ?? []; + + if ( ! is_array($sections) ) { + return ''; + } + + $changelog = $sections['changelog'] ?? ''; + + if ( ! is_string($changelog) || $changelog === '' ) { + return ''; + } + + return $this->extractVersionBlock($changelog, $version); + } + + /** + * Fallback source: GitHub release notes of the tag equal to the offered version. + * + * @param string $version + * + * @return string + */ + protected function fetchFromGitHub($version) + { + $repo = $this->getGithubRepo(); + + if ( ! is_string($repo) || $repo === '' ) { + return ''; + } + + $repo_path = implode('/', array_map('rawurlencode', explode('/', $repo))); + + // Only the exact tag is requested: any "latest release" fallback could show + // the notes of an unrelated (or pre-) release under the offered version. + $body = $this->doRequest( + 'https://api.github.com/repos/' . $repo_path . '/releases/tags/' . rawurlencode($version) + ); + + if ( $body === '' ) { + return ''; + } + + $data = json_decode($body, true); + + if ( ! is_array($data) || ! isset($data['body']) || ! is_string($data['body']) || $data['body'] === '' ) { + return ''; + } + + // Double check that the release really belongs to the offered version. + $tag_name = isset($data['tag_name']) && is_string($data['tag_name']) ? $data['tag_name'] : ''; + + if ( ltrim($tag_name, 'vV') !== ltrim($version, 'vV') ) { + return ''; + } + + return $this->readmeToHtml($data['body']); + } + + /** + * Seam: the only call to the WordPress.org API. + * + * @return array|object|\WP_Error + */ + protected function requestPluginInformation() + { + if ( ! function_exists('plugins_api') ) { + require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; + } + + return plugins_api('plugin_information', array( + 'slug' => $this->getSlug(), + 'fields' => array( + 'sections' => true, + 'banners' => false, + 'screenshots' => false, + 'reviews' => false, + 'contributors' => false, + ), + )); + } + + /** + * Seam: the only outgoing HTTP request. + * + * @param string $url + * + * @return string response body or empty string on any failure + */ + protected function doRequest($url) + { + $response = wp_remote_get($url, array( + 'timeout' => static::HTTP_TIMEOUT, + 'headers' => array( + 'Accept' => 'application/vnd.github+json', + 'User-Agent' => 'WordPress/' . $this->getSlug(), + ), + )); + + if ( is_wp_error($response) || (int)wp_remote_retrieve_response_code($response) !== 200 ) { + return ''; + } + + return (string)wp_remote_retrieve_body($response); + } + + /** + * @param string $key + * + * @return mixed false when the cache is empty + */ + protected function getCache($key) + { + return get_transient($key); + } + + /** + * @param string $key + * @param string $value + * @param int $ttl + * + * @return void + */ + protected function setCache($key, $value, $ttl) + { + set_transient($key, $value, (int)$ttl); + } + + /** + * Picks a single version block from the WordPress.org changelog HTML. + * Falls back to the first (newest) block when the exact version is not found. + * + * @param string $changelog_html + * @param string $version + * + * @return string sanitized HTML + */ + protected function extractVersionBlock($changelog_html, $version) + { + $parts = preg_split( + '/(]*>.*?<\/h[1-6]>)/is', + $changelog_html, + -1, + PREG_SPLIT_DELIM_CAPTURE + ); + + if ( ! is_array($parts) ) { + return ''; + } + + $blocks = array(); + $parts_count = count($parts); + + for ( $i = 1; $i < $parts_count; $i += 2 ) { + $blocks[] = array( + 'title' => wp_strip_all_tags($parts[$i]), + 'body' => isset($parts[$i + 1]) ? $parts[$i + 1] : '', + ); + } + + if ( empty($blocks) ) { + return ''; + } + + $chosen = $blocks[0]; + + foreach ( $blocks as $block ) { + if ( preg_match('/(?sanitize($this->normalizeChangelogBody($chosen['body'])); + } + + /** + * WordPress.org returns the changelog body in two shapes: + * - a ready-made list: "
  • ...
  • ...
"; + * - a flat block of lines separated by "
" (or plain newlines). + * + * The flat shape is normalized into a list so both variants render + * identically and never leak bare "

" tags (which would duplicate + * the native update icon rendered via ".update-message p:before"). + * + * @param string $body + * + * @return string + */ + protected function normalizeChangelogBody($body) + { + if ( ! is_string($body) || trim($body, " \f\n\r\t\v\x00") === '' ) { + return ''; + } + + // Already a list, nothing to do. + if ( stripos($body, '|\R/i', $body); + + if ( ! is_array($lines) ) { + return $body; + } + + $items = array(); + + foreach ( $lines as $line ) { + $line = trim($line, " \f\n\r\t\v\x00"); + + if ( $line === '' ) { + continue; + } + + $items[] = '

  • ' . $line . '
  • '; + } + + return $items ? '
      ' . implode('', $items) . '
    ' : $body; + } + + /** + * Converts a readme-style changelog block ("= 2.188 ... =" and "* item" lines) + * to a plain list. The source text is escaped before links are generated. + * + * @param string $text + * + * @return string sanitized HTML + */ + protected function readmeToHtml($text) + { + $lines = preg_split('/\R/', $text); + + if ( ! is_array($lines) ) { + return ''; + } + + $items = array(); + + foreach ( $lines as $line ) { + $line = trim($line, " \f\n\r\t\v\x00"); + + if ( $line === '' || strpos($line, '=') === 0 || strpos($line, '#') === 0 ) { + continue; + } + + $line = ltrim($line, "*-+ \t"); + + if ( $line === '' ) { + continue; + } + + $items[] = '
  • ' . esc_html($line) . '
  • '; + } + + return $items + ? $this->sanitize('
      ' . implode('', $items) . '
    ') + : ''; + } + + /** + * Strict whitelist for the third-party changelog HTML. Dangerous elements are + * dropped together with their content, the rest is escaped by the child. + * + * @param string $html + * + * @return string + */ + protected function sanitize($html) + { + if ( ! is_string($html) || $html === '' ) { + return ''; + } + + // Drop dangerous elements together with their content: + // kses strips the tags but keeps the inner text. + $stripped = preg_replace( + '#<(script|style|iframe|object|embed|svg|math|template|noscript|frameset|frame|applet)\b[^>]*>.*?#is', + '', + $html + ); + $html = is_string($stripped) ? $stripped : ''; + + $stripped = preg_replace( + '#<(script|style|iframe|object|embed|svg|math|template|noscript|frameset|frame|applet)\b[^>]*/?>#is', + '', + $html + ); + $html = is_string($stripped) ? $stripped : ''; + + return $this->escapeChangelogHtml($this->forceDiscListStyle($this->removeLinks($html))); + } + + /** + * Forces visible round bullets on every "
      " of the changelog, regardless + * of its source (wp.org markup, our own normalized list or the GitHub + * markdown conversion). Admin themes commonly reset "ul { list-style: none }", + * so the marker is set inline to guarantee it survives everywhere. + * + * The longhand "list-style-type" is used on purpose: the "list-style" shorthand + * is not in the default WordPress "safe_style_css" allowlist and would be + * stripped by kses. + * + * @param string $html + * + * @return string + */ + protected function forceDiscListStyle($html) + { + if ( ! is_string($html) || $html === '' ) { + return $html; + } + + $result = preg_replace_callback( + '#]*)>#i', + static function ($matches) { + $attrs = isset($matches[1]) ? $matches[1] : ''; + + if ( + preg_match('/\bstyle\s*=\s*(["\'])(.*?)\1/i', $attrs, $style_match) + && isset($style_match[2]) + ) { + $style = rtrim(trim($style_match[2], " \f\n\r\t\v\x00"), ';') + . '; list-style-type: disc; padding-left: 20px;'; + $new_attrs = preg_replace( + '/\bstyle\s*=\s*(["\']).*?\1/i', + 'style="' . $style . '"', + $attrs, + 1 + ); + } else { + $new_attrs = $attrs . ' style="list-style-type: disc; padding-left: 20px;"'; + } + + return ''; + }, + $html + ); + + return is_string($result) ? $result : $html; + } + + /** + * Removes every link from the changelog: anchors are unwrapped and bare URLs + * are cut out, so the notice body never contains links. + * + * @param string $html + * + * @return string + */ + protected function removeLinks($html) + { + // text -> text + $result = preg_replace('#]*>(.*?)#is', '$1', $html); + $html = is_string($result) ? $result : $html; + + // Leftover unclosed anchors. + $result = preg_replace('#]*>#i', '', $html); + $html = is_string($result) ? $result : $html; + + // Bare URLs, including the www-style ones. + $result = preg_replace('#\b(?:https?://|www\.)[^\s<"\']+#i', '', $html); + $html = is_string($result) ? $result : $html; + + // Clean up separators left after the removal. + $result = preg_replace('#[ \t]+([.,;:])#', '$1', $html); + $html = is_string($result) ? $result : $html; + + $result = preg_replace('#[ \t]{2,}#', ' ', $html); + $html = is_string($result) ? $result : $html; + + $result = preg_replace('#[ \t]+(temp_content = $content; - $content = self::dropAttributesContainEmail($content, self::$attributes_to_drop); + $content = $this->dropAttributesContainEmail($content, self::$attributes_to_drop); // Main logic @@ -299,14 +299,17 @@ public function modifyGlobalEmails($content) } $this->temp_content = $content; + $this->helper->indexMarkup($this->temp_content); $match_cursor = 0; - $replacing_result = preg_replace_callback($this->global_email_pattern, function ($matches) use (&$match_cursor) { + $match_offsets = $this->collectMatchOffsets($this->global_email_pattern, $content); + $match_offset_index = 0; + $replacing_result = preg_replace_callback($this->global_email_pattern, function ($matches) use ($match_offsets, &$match_offset_index, &$match_cursor) { if ( ! isset($matches[0]) ) { return ''; } - $position = $this->advanceMatchCursor($matches[0], $match_cursor); + $position = $this->resolveNextMatchOffset($matches[0], $match_offsets, $match_offset_index, $match_cursor); if ( $this->exclusions->isContactExcluded($matches[0]) ) { return $matches[0]; @@ -316,26 +319,35 @@ public function modifyGlobalEmails($content) return $matches[0]; } - //chek if email is placed in excluded attributes and return unchanged if so - if ( $this->helper->hasAttributeExclusions($matches[0], $this->temp_content, $position) ) { + // Raw text of script/style/template blocks is never markup we may rewrite. + if ( $this->helper->isInsideRawTextTag($matches[0], $this->temp_content, $position) ) { return $matches[0]; } - // skip encoding if the content in script tag - if ( $this->helper->isInsideScriptTag($matches[0], $this->temp_content, $position) ) { - return $matches[0]; + // Drop the cc=/bcc= copies before the markup guards take them out of the flow. + if ( $this->helper->isMailtoAdditionalCopy($matches[0], $this->temp_content, $position) ) { + return ''; } - if ( $this->helper->isInsideOptionTag($matches[0], $this->temp_content, $position) ) { + // mailto: links are encoded in place inside the href attribute, so they bypass the markup guards. + if ( $this->helper->isMailto($matches[0]) ) { + $position = $position === false ? 0 : $position; + + return $this->encodeMailtoLink($matches[0], $position); + } + + //chek if email is placed in excluded attributes and return unchanged if so + if ( $this->helper->hasAttributeExclusions($matches[0], $this->temp_content, $position) ) { return $matches[0]; } - if ( $this->helper->isMailtoAdditionalCopy($matches[0], $this->temp_content, $position) ) { - return ''; + // Encoding injects a , which is only valid in a text node. + if ( $this->helper->isInsideAttributeValue($matches[0], $this->temp_content, $position) ) { + return $matches[0]; } - if ( $this->helper->isMailto($matches[0]) ) { - return $this->encodeMailtoLink($matches[0]); + if ( $this->helper->isInsideOptionTag($matches[0], $this->temp_content, $position) ) { + return $matches[0]; } return $this->encodePlainEmail($matches[0]); @@ -364,24 +376,35 @@ public function modifyGlobalPhoneNumbers($content) } $this->temp_content = $content; + $this->helper->indexMarkup($this->temp_content); $phones_pattern = $this->global_phones_pattern; $match_cursor = 0; + $match_offsets = $this->collectMatchOffsets($phones_pattern, $content); + $match_offset_index = 0; $replacing_result = preg_replace_callback( $phones_pattern, - function ($matches) use (&$match_cursor) { + function ($matches) use ($match_offsets, &$match_offset_index, &$match_cursor) { if ( ! isset($matches[0]) ) { return ''; } - $position = $this->advanceMatchCursor($matches[0], $match_cursor); + $position = $this->resolveNextMatchOffset($matches[0], $match_offsets, $match_offset_index, $match_cursor); if ( $this->exclusions->isContactExcluded($matches[0]) ) { return $matches[0]; } + // Raw text of script/style/template blocks is never markup we may rewrite. + if ( $this->helper->isInsideRawTextTag($matches[0], $this->temp_content, $position) ) { + return $matches[0]; + } + + // tel: links are encoded in place inside the href attribute, so they bypass the markup guards. if ( $this->helper->isTelTag($matches[0]) ) { - return $this->encodeTelLink($matches[0]); + $position = $position === false ? 0 : $position; + + return $this->encodeTelLink($matches[0], $position); } // symbols clearance @@ -397,8 +420,8 @@ function ($matches) use (&$match_cursor) { return $matches[0]; } - // check if in script - if ( $this->helper->isInsideScriptTag($matches[0], $this->temp_content, $position) ) { + // Encoding injects a , which is only valid in a text node. + if ( $this->helper->isInsideAttributeValue($matches[0], $this->temp_content, $position) ) { return $matches[0]; } @@ -421,22 +444,66 @@ function ($matches) use (&$match_cursor) { } /** - * Advance the left-to-right cursor so repeated contacts use their own offset. + * Resolve the real offset of the current match. + * + * The offsets are collected up front with PREG_OFFSET_CAPTURE and consumed in order, because + * preg_match_all() and preg_replace_callback() walk the same pattern over the same subject and + * therefore produce the same sequence of matches. Looking the match up with strpos() instead + * would land on an earlier literal occurrence that the pattern did not match, e.g. the address + * inside `` shadowing a real one further down. * * @param string $match + * @param int[] $offsets + * @param int $offset_index * @param int $cursor * @return int|false */ - private function advanceMatchCursor($match, &$cursor) + private function resolveNextMatchOffset($match, $offsets, &$offset_index, &$cursor) { + $length = strlen($match); + + if ( isset($offsets[$offset_index]) ) { + $position = $offsets[$offset_index]; + $offset_index++; + + if ( substr($this->temp_content, $position, $length) === $match ) { + $cursor = $position + $length; + + return $position; + } + } + + // The pre-collected offsets are unusable, fall back to a left-to-right scan. $position = strpos($this->temp_content, $match, $cursor); if ( $position !== false ) { - $cursor = $position + strlen($match); + $cursor = $position + $length; } return $position; } + /** + * Collect the real offset of every match of the pattern in the content. + * + * @param string $pattern + * @param string $content + * @return int[] + */ + private function collectMatchOffsets($pattern, $content) + { + $offsets = array(); + + if ( preg_match_all($pattern, $content, $matches, PREG_OFFSET_CAPTURE) && isset($matches[0]) ) { + foreach ( $matches[0] as $match ) { + if ( isset($match[1]) ) { + $offsets[] = $match[1]; + } + } + } + + return $offsets; + } + /* * =============== ENCODE ENTITIES =============== */ @@ -504,10 +571,11 @@ protected function encodeAny($string, $mode = Params::OBFUSCATION_MODE_BLUR, $re * Method to process mailto: links. * * @param string $mailto_link_str + * @param int $position Offset of the match inside the content being processed. * * @return string */ - private function encodeMailtoLink($mailto_link_str) + private function encodeMailtoLink($mailto_link_str, $position = 0) { // Get inner tag text and place it in $matches[1] preg_match($this->global_mailto_pattern, $mailto_link_str, $matches); @@ -523,17 +591,18 @@ private function encodeMailtoLink($mailto_link_str) $text = isset($mailto_inner_text) ? $mailto_inner_text : $mailto_link_str; - return 'mailto:' . $text . '" data-original-string="' . $encoded . '" title="' . htmlspecialchars($this->getTooltip(), ENT_QUOTES, 'UTF-8'); + return 'mailto:' . $text . $this->buildSchemeLinkAttributes($encoded, $position); } /** * Method to process tel: links. * * @param string $tel_link_str + * @param int $position Offset of the match inside the content being processed. * * @return string */ - private function encodeTelLink($tel_link_str) + private function encodeTelLink($tel_link_str, $position = 0) { // Get inner tag text and place it in $matches[1] preg_match($this->global_tel_pattern, $tel_link_str, $matches); @@ -550,7 +619,32 @@ private function encodeTelLink($tel_link_str) $text = isset($tel_inner_text) ? $tel_inner_text : $tel_link_str; - return 'tel:' . $text . '" data-original-string="' . $encoded . '" title="' . htmlspecialchars($this->getTooltip(), ENT_QUOTES, 'UTF-8'); + return 'tel:' . $text . $this->buildSchemeLinkAttributes($encoded, $position); + } + + /** + * Builds the attribute tail appended to an opening tag when a scheme link is encoded in place. + * + * The tail intentionally leaves the last attribute value unclosed: the quote that used to close + * the original href value closes it instead. The tooltip is skipped when the tag already carries + * a title attribute, otherwise the markup would end up with a duplicated attribute and the + * author's own title would be wiped by the decoder script. + * + * @param string $encoded Encoded original string. + * @param int $position Offset of the match inside the content being processed. + * + * @return string + */ + private function buildSchemeLinkAttributes($encoded, $position) + { + $has_own_title = $this->helper->enclosingTagHasAttribute($this->temp_content, (int)$position, 'title'); + + if ( $has_own_title ) { + return '" data-original-string="' . $encoded; + } + + return '" title="' . htmlspecialchars($this->getTooltip(), ENT_QUOTES, 'UTF-8') + . '" data-original-string="' . $encoded; } /** @@ -823,24 +917,75 @@ protected static function getDefaultReplacingText() * Example: Email * Will be turned to Email * + * The attribute is dropped wherever the address sits inside its value, so + * title="Write to example1@mail.com" is handled as well. Matching is scoped to a + * single tag and a single quoted value, otherwise a greedy match would swallow the rest of the + * markup along with it. + * * @param string $content The content to process. * @return string The content with attributes removed. */ - private static function dropAttributesContainEmail($content, $tags) + private function dropAttributesContainEmail($content, $tags) { - $attribute_content_chunk = '[\s]{0,}=[\s]{0,}[\"\']\b[_A-Za-z0-9-\.]+@[_A-Za-z0-9-\.]+\..*\b[\"\']'; + $email_pattern = '/' . self::EMAIL_PATTERN . '/'; + $this->helper->indexMarkup($content); + foreach ($tags as $tag => $attribute) { - // Regular expression to match the attribute without the tag - $regexp_chunk_without_tag = "/{$attribute}{$attribute_content_chunk}/"; - // Regular expression to match the attribute with the tag - $regexp_chunk_with_tag = "/<{$tag}.*{$attribute}{$attribute_content_chunk}/"; - // Find all matches of the attribute with the tag in the content - preg_match_all($regexp_chunk_with_tag, $content, $matches); - if (!empty($matches[0])) { - // Remove the attribute without the tag from the content - $content = preg_replace($regexp_chunk_without_tag, '', $content, count($matches[0])); + if ( ! is_string($tag) || $tag === '' || ! is_string($attribute) || $attribute === '' ) { + continue; + } + + // A whole tag, with quoted attribute values consumed as a unit so `>` inside them is kept. + $tag_pattern = '/<' . preg_quote($tag, '/') . '\b(?:[^>"\']|"[^"]*"|\'[^\']*\')*>/i'; + // The target attribute inside that tag, value limited to its own quotes. + $attribute_pattern = '/\s' . preg_quote($attribute, '/') . '\s*=\s*(["\'])(.*?)\1/is'; + + $replaced = preg_replace_callback( + $tag_pattern, + function ($tag_match) use ($attribute_pattern, $email_pattern, $content) { + if ( ! isset($tag_match[0]) || ! is_array($tag_match[0]) || ! isset($tag_match[0][0], $tag_match[0][1]) ) { + return ''; + } + + $opening_tag = $tag_match[0][0]; + $tag_offset = $tag_match[0][1]; + + if ( ! is_string($opening_tag) || ! is_int($tag_offset) ) { + return ''; + } + + if ( $this->helper->isInsideRawTextTag($opening_tag, $content, $tag_offset) ) { + return $opening_tag; + } + + $stripped = preg_replace_callback( + $attribute_pattern, + static function ($attribute_match) use ($email_pattern) { + if ( ! isset($attribute_match[0], $attribute_match[2]) ) { + return ''; + } + + return preg_match($email_pattern, $attribute_match[2]) + ? '' + : $attribute_match[0]; + }, + $opening_tag + ); + + return $stripped === null ? $opening_tag : $stripped; + }, + $content, + -1, + $count, + PREG_OFFSET_CAPTURE + ); + + if ( $replaced !== null && $count > 0 ) { + $content = $replaced; + $this->helper->indexMarkup($content); } } + return $content; } diff --git a/lib/Cleantalk/Common/ContactsEncoder/Helper/ContactsEncoderHelper.php b/lib/Cleantalk/Common/ContactsEncoder/Helper/ContactsEncoderHelper.php index 8b9a91288..8e2e2c9e6 100644 --- a/lib/Cleantalk/Common/ContactsEncoder/Helper/ContactsEncoderHelper.php +++ b/lib/Cleantalk/Common/ContactsEncoder/Helper/ContactsEncoderHelper.php @@ -31,6 +31,103 @@ class ContactsEncoderHelper */ private $attribute_exclusions_list = array(); + /** + * Tag names whose inner text is not markup and must never be rewritten. + * @var string[] + */ + private $raw_text_tags = array('script', 'style', 'template', 'noscript'); + + /** + * Content the offset indexes below were built for. + * @var string|null + */ + private $indexed_content; + + /** + * Sorted list of [start, end) offsets of every raw text block in the indexed content. + * @var array[] + */ + private $raw_text_ranges = array(); + + /** + * Sorted list of [start, end) offsets of every attribute value in the indexed content. + * @var array[] + */ + private $attribute_value_ranges = array(); + + /** + * Checks whether the tag enclosing the given offset already declares the attribute. + * + * Scheme links are rewritten from the inside of the href value, so the encoder appends its own + * attributes to the opening tag. This lookup prevents emitting a duplicate of an attribute the + * author has already set, e.g. `title` on ``. + * + * @param string $content Whole content being processed. + * @param int $position Offset of the match inside $content. + * @param string $attribute Attribute name to look for. + * + * @return bool + */ + public function enclosingTagHasAttribute($content, $position, $attribute) + { + if ( ! is_string($content) || ! is_int($position) || $position < 0 ) { + return false; + } + + $tag_start = strrpos(substr($content, 0, $position), '<'); + if ( $tag_start === false ) { + return false; + } + + $opening_tag = $this->readOpeningTag($content, $tag_start); + if ( $opening_tag === '' ) { + return false; + } + + return (bool)preg_match('/[\s\'"]' . preg_quote($attribute, '/') . '\s*=/i', $opening_tag); + } + + /** + * Reads an opening tag starting at the given offset, honouring quoted attribute values so that + * a `>` inside a value does not terminate the tag prematurely. + * + * @param string $content + * @param int $tag_start Offset of the `<` character. + * + * @return string Empty string when the tag is not closed. + */ + private function readOpeningTag($content, $tag_start) + { + $length = strlen($content); + $quote = null; + + for ( $i = $tag_start + 1; $i < $length; $i++ ) { + $char = $content[$i]; + + if ( $quote !== null ) { + if ( $char === $quote ) { + $quote = null; + } + continue; + } + + if ( $char === '"' || $char === "'" ) { + $quote = $char; + continue; + } + + if ( $char === '>' ) { + return substr($content, $tag_start, $i - $tag_start + 1); + } + + if ( $char === '<' ) { + return ''; + } + } + + return ''; + } + /** * Checking if the string contains mailto: link * @@ -125,28 +222,225 @@ public function isInsideOptionTag($email, $content, $position = null) * @param string $content The full content * @param int|false|null $position Known match offset; null looks up the first occurrence * @return bool + * @psalm-suppress PossiblyUnusedMethod */ public function isInsideScriptTag($email, $content, $position = null) { - $pos = $this->resolveMatchPosition($email, $content, $position); - if ($pos === false) { + return $this->isInsideRawTextTag($email, $content, $position, array('script')); + } + + /** + * Check whether the match sits inside the raw text of a tag whose content is not markup + * (script, style, template, noscript). Covers inline scripts, JSON-LD and CSS at once. + * + * @param string $needle The matched contact + * @param string $content The full content + * @param int|false|null $position Known match offset; null looks up the first occurrence + * @param string[]|null $tags Restrict the check to these tags; null uses the full raw text list + * @return bool + */ + public function isInsideRawTextTag($needle, $content, $position = null, $tags = null) + { + $pos = $this->resolveMatchPosition($needle, $content, $position); + if ( $pos === false ) { return false; } - // Find the last script opening tag before the email - $last_script_start = strrpos(substr($content, 0, $pos), 'indexMarkup($content); + + $index = $this->findRangeIndex($this->raw_text_ranges, $pos); + if ( $index === false || ! isset($this->raw_text_ranges[$index][2]) ) { + return false; + } + + $range_tag = $this->raw_text_ranges[$index][2]; + + return $tags === null || in_array($range_tag, $tags, true); + } + + /** + * Build the raw text offset index for the given content once. + * Repeated calls with the same content reuse the cached index. + * + * @param string $content + * @return void + */ + public function indexMarkup($content) + { + if ( ! is_string($content) ) { + return; + } + + if ( $this->indexed_content !== null && $this->indexed_content === $content ) { + return; + } + + $this->indexed_content = $content; + $this->raw_text_ranges = $this->buildRawTextRanges($content); + $this->attribute_value_ranges = $this->buildAttributeValueRanges($content); + } + + /** + * Check whether the match sits inside an HTML attribute value. + * + * Encoding wraps the match into a , which is only valid in a text node. Inside an + * attribute value the markup would be consumed by the attribute itself and the quotes of the + * injected span would terminate the value early, swallowing the rest of the tag and whatever + * follows it until the next quote in the document. + * + * @param string $needle The matched contact + * @param string $content The full content + * @param int|false|null $position Known match offset; null looks up the first occurrence + * @return bool + */ + public function isInsideAttributeValue($needle, $content, $position = null) + { + $pos = $this->resolveMatchPosition($needle, $content, $position); + if ( $pos === false ) { return false; } - // Find the first script closing tag after the last opening tag - $script_end = strpos($content, '', $last_script_start); - if ($script_end === false) { + $this->indexMarkup($content); + + return $this->findRangeIndex($this->attribute_value_ranges, $pos) !== false; + } + + /** + * Offsets of every attribute value of every tag in the content. + * + * Tags are matched as a whole first, so a `>` inside a quoted value cannot terminate the tag + * early. Attribute values are then located within the tag and their offsets translated back + * into offsets of the whole content. + * + * @param string $content + * @return array[] list of [start, end] + */ + private function buildAttributeValueRanges($content) + { + $ranges = array(); + + $tag_pattern = '/<[a-zA-Z][\w:-]*(?:[^>"\']|"[^"]*"|\'[^\']*\')*>/'; + if ( ! preg_match_all($tag_pattern, $content, $tag_matches, PREG_OFFSET_CAPTURE) ) { + return $ranges; + } + + // Quoted values keep their own quotes out of the range, unquoted values stop at whitespace. + $attribute_pattern = '/[\s\/][^\s=\/>]+\s*=\s*(?:"([^"]*)"|\'([^\']*)\'|([^\s"\'>]+))/'; + + if (!isset($tag_matches[0])) { + return $ranges; + } + + foreach ( $tag_matches[0] as $tag_match ) { + if ( ! isset($tag_match[0], $tag_match[1]) ) { + continue; + } + + $tag = $tag_match[0]; + $tag_offset = $tag_match[1]; + + if ( ! preg_match_all($attribute_pattern, $tag, $attribute_matches, PREG_OFFSET_CAPTURE) ) { + continue; + } + + foreach ( array(1, 2, 3) as $group ) { + if ( ! isset($attribute_matches[$group]) ) { + continue; + } + + foreach ( $attribute_matches[$group] as $value_match ) { + if ( ! isset($value_match[0], $value_match[1]) || $value_match[1] < 0 ) { + continue; + } + + $start = $tag_offset + $value_match[1]; + $ranges[] = array($start, $start + strlen($value_match[0])); + } + } + } + + usort($ranges, static function ($left, $right) { + if ( $left[0] === $right[0] ) { + return 0; + } + + return $left[0] < $right[0] ? -1 : 1; + }); + + return $ranges; + } + + /** + * Offsets of the inner text of every raw text tag. + * + * @param string $content + * @return array[] list of [start, end, tag] + */ + private function buildRawTextRanges($content) + { + $ranges = array(); + if ( empty($this->raw_text_tags) ) { + return $ranges; + } + + $tags = array(); + foreach ( $this->raw_text_tags as $tag ) { + if ( is_string($tag) && $tag !== '' ) { + $tags[] = preg_quote($tag, '/'); + } + } + + if ( empty($tags) ) { + return $ranges; + } + + $pattern = '/<(' . implode('|', $tags) . ')\b(?:[^>"\']|"[^"]*"|\'[^\']*\')*>(.*?)<\/\1\s*>/is'; + + if ( preg_match_all($pattern, $content, $matches, PREG_OFFSET_CAPTURE) && isset($matches[2]) ) { + foreach ( $matches[2] as $index => $match ) { + if ( ! isset($match[0], $match[1]) || $match[1] < 0 ) { + continue; + } + $tag = isset($matches[1][$index][0]) ? strtolower($matches[1][$index][0]) : ''; + $ranges[] = array($match[1], $match[1] + strlen($match[0]), $tag); + } + } + + return $ranges; + } + + /** + * Index of the range containing the offset, or false when the offset is outside all of them. + * + * @param array[] $ranges + * @param int $position + * @return int|false + */ + private function findRangeIndex($ranges, $position) + { + if ( ! is_array($ranges) || empty($ranges) ) { return false; } - // The email is inside a script tag if its position is between the opening and closing tags - return ($pos > $last_script_start && $pos < $script_end); + $low = 0; + $high = count($ranges) - 1; + + while ( $low <= $high ) { + $middle = intdiv($low + $high, 2); + if ( ! isset($ranges[$middle][0], $ranges[$middle][1]) ) { + return false; + } + + if ( $position < $ranges[$middle][0] ) { + $high = $middle - 1; + } elseif ( $position >= $ranges[$middle][1] ) { + $low = $middle + 1; + } else { + return $middle; + } + } + + return false; } /** @@ -351,12 +645,12 @@ private function isMatchInsideAttribute($quoted_match, $attribute, $content, $ta : '<' . preg_quote($tag, '/') . '\s+[^>]*'; $pattern = '/' - . $tag_prefix - . '\b' - . $quoted_attribute - . '\s*=\s*(["\'])[^"\']*' - . $quoted_match - . '[^"\']*\1/'; + . $tag_prefix + . '\b' + . $quoted_attribute + . '\s*=\s*(["\'])[^"\']*' + . $quoted_match + . '[^"\']*\1/'; if ( $position === null ) { return (bool) preg_match($pattern, $content); diff --git a/readme.txt b/readme.txt index 07b324b1a..06aa8e140 100644 --- a/readme.txt +++ b/readme.txt @@ -3,8 +3,8 @@ Contributors: glomberg, alexandergull, sergefcleantalk, antonv1 Tags: anti-spam, spam protection, contact form spam, spam, captcha Requires at least: 4.7 Tested up to: 7.1 -Requires PHP: 5.6 -Stable tag: 6.88 +Requires PHP: 7.2 +Stable tag: 6.89 License: GPLv2 Stop spam in contact forms, comments, registrations, and WooCommerce automatically. CAPTCHA free antispam plugin that works in the background. @@ -262,7 +262,7 @@ Go to Dashboard at the cl = Does CleanTalk work without CAPTCHA or reCAPTCHA? = Yes, CleanTalk works completely without CAPTCHA, puzzles, or manual user challenges. -= Does CleanTalk stop contact form spam? = += Does CleanTalk stop contact form spam? = Yes, CleanTalk stops spam in contact forms, registration forms, comments, and other forms on your website. It uses a combination of algorithms and a cloud-based database to identify and block spam submissions in real-time. = Does CleanTalk protect WooCommerce from fake orders and spam registrations? = @@ -452,6 +452,20 @@ CleanTalk stops up to 99.998% of spam bots, so you can disable other anti-spam p == Changelog == += 6.89 05.10.2026 = +New. Integration. Integration with Pagelayer. +New. WooCommerce. Spam orders admin list table redesigned: statuses, bulk actions, sortable totals. +Upd. ContactsEncoder. Lot of search logic updates. +New. Plugins page. Show changelog in the update notice. +Upd. WooCommerce. New option to manage if rejection message have to be shown for blocked visitor. +Upd. Firewall. Emergency bypass logic updated to token-via-email model. +Fix. SimpleMembership. Editing the integration for working with a multi-site. +Fix. ExternalForms. Editing changes to form fields, checking whether they belong to the formSelector. +Fix. Contacts Encoder. Simple precheck content before high-cost logic run. +Fix. Code. Checking ajax_type and editing ctPublicFunctions search. +Fix. Code. Deleting service fields after checking for spam. +Fix. JS. Flag for logic initiation in case of a one-time DOMContentLoaded event. + = 6.88 16.09.2026 = New. ContactEncoder. Add option to exclude selected contact data. New. Code. IMetric service. Integrations performance metrics. diff --git a/tests/Antispam/IntegrationsByClass/TestWoocommerceAddPaymentMethod.php b/tests/Antispam/IntegrationsByClass/TestWoocommerceAddPaymentMethod.php new file mode 100644 index 000000000..0834ddc9f --- /dev/null +++ b/tests/Antispam/IntegrationsByClass/TestWoocommerceAddPaymentMethod.php @@ -0,0 +1,109 @@ +apbct_backup = $apbct; + $apbct = new State('cleantalk', array('settings', 'data', 'errors', 'remote_calls', 'stats', 'fw_stats')); + + $this->integration = new Woocommerce(); + } + + public function tearDown(): void + { + global $apbct; + + $apbct = $this->apbct_backup; + + parent::tearDown(); + } + + /** + * The check is tied to "Protect logged in Users", not to the checkout option. + */ + public function testAddPaymentMethodIsSkippedWhenLoggedInProtectionIsOff() + { + global $apbct; + $apbct->settings['data__protect_logged_in'] = 0; + $apbct->settings['forms__wc_checkout_test'] = 1; + + $this->assertTrue($this->integration->isAddPaymentMethodAllowed()); + $this->assertTrue($this->integration->filterAddPaymentMethodFormIsValid(true)); + } + + /** + * Guests cannot reach the form, and a missing session must not call the cloud. + */ + public function testAddPaymentMethodIsSkippedWhenNobodyIsLoggedIn() + { + global $apbct; + $apbct->settings['data__protect_logged_in'] = 1; + + $this->assertFalse(is_user_logged_in()); + $this->assertTrue($this->integration->isAddPaymentMethodAllowed()); + } + + /** + * WooCommerce already rejected the form. Do not replace that decision. + */ + public function testFilterKeepsAnInvalidFormInvalid() + { + global $apbct; + $apbct->settings['data__protect_logged_in'] = 1; + + $this->assertFalse($this->integration->filterAddPaymentMethodFormIsValid(false)); + } + + /** + * Checkout setup intents must not be treated as Add payment method. + */ + public function testStripeAjaxFromCheckoutIsLeftAlone() + { + $_SERVER['HTTP_REFERER'] = 'http://blog.loc/checkout/'; + $_SERVER['REQUEST_URI'] = '/?wc-ajax=wc_stripe_init_setup_intent'; + + $this->assertNull($this->integration->blockStripeAddPaymentMethodAjax()); + } + + /** + * The UPE confirm action belongs to Add payment method even without that slug in the URL. + * Logged-out requests must not call the cloud. + */ + public function testUpeConfirmSetupIntentIsSkippedWhenNobodyIsLoggedIn() + { + global $apbct; + $apbct->settings['data__protect_logged_in'] = 1; + $_SERVER['HTTP_REFERER'] = 'http://blog.loc/'; + $_SERVER['REQUEST_URI'] = '/wp-admin/admin-ajax.php'; + $_POST['action'] = 'wc_stripe_create_and_confirm_setup_intent'; + + $this->assertFalse(is_user_logged_in()); + $this->assertNull($this->integration->blockStripeCreateAndConfirmSetupIntentAjax()); + } +} diff --git a/tests/Antispam/IntegrationsByClass/TestWoocommerceAdminListTableHooks.php b/tests/Antispam/IntegrationsByClass/TestWoocommerceAdminListTableHooks.php new file mode 100644 index 000000000..48f375812 --- /dev/null +++ b/tests/Antispam/IntegrationsByClass/TestWoocommerceAdminListTableHooks.php @@ -0,0 +1,403 @@ +id = $id; + } + + public function update_status($new_status) // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps + { + self::$update_status_calls[] = array($this->id, $new_status); + + return true; + } + } + } +} + +namespace Antispam\IntegrationsByClass { + + use Cleantalk\Antispam\IntegrationsByClass\Woocommerce; + use Cleantalk\ApbctWP\State; + use Cleantalk\ApbctWP\UpdatePlugin\DbAnalyzer; + use Cleantalk\ApbctWP\Variables\Get; + use Cleantalk\ApbctWP\Variables\Post; + use PHPUnit\Framework\TestCase; + + /** + * Unit tests for the admin/list-table hooks of the WooCommerce integration: + * the HPOS 'Spam' view wiring, the legacy status filters and the bulk actions. + */ + class TestWoocommerceAdminListTableHooks extends TestCase + { + /** + * @var Woocommerce + */ + private $integration; + + /** + * @var mixed + */ + private $apbct_backup; + + public function setUp(): void + { + global $apbct, $wpdb; + parent::setUp(); + + $this->apbct_backup = $apbct; + $apbct = new State('cleantalk', array('settings', 'data', 'errors', 'remote_calls', 'stats', 'fw_stats')); + + Get::getInstance()->variables = array(); + Post::getInstance()->variables = array(); + \WC_Order::$update_status_calls = array(); + + $this->integration = new Woocommerce(); + } + + public static function setUpBeforeClass(): void + { + global $wpdb; + + $creator = new \Cleantalk\ApbctWP\UpdatePlugin\DbTablesCreator(); + $creator->createAllTables(); + $wpdb->query('TRUNCATE TABLE ' . APBCT_TBL_WC_SPAM_ORDERS); + } + + public function tearDown(): void + { + global $apbct, $wpdb; + + $apbct = $this->apbct_backup; + $wpdb->query('TRUNCATE TABLE ' . APBCT_TBL_WC_SPAM_ORDERS); + + Get::getInstance()->variables = array(); + Post::getInstance()->variables = array(); + unset($GLOBALS['post_status'], $_GET['status']); + + parent::tearDown(); + } + + /** + * @return \ReflectionMethod + */ + private function getMethod($name) + { + $method = new \ReflectionMethod(Woocommerce::class, $name); + $method->setAccessible(true); + + return $method; + } + + // ------------------------------------------------------------------- + // addOrdersListStatusViews() + // ------------------------------------------------------------------- + + public function testAddOrdersListStatusViewsReturnsEarlyWithoutAScreenId() + { + $this->assertNull( + $this->integration->addOrdersListStatusViews(new \stdClass()) + ); + } + + public function testAddOrdersListStatusViewsReturnsEarlyWithoutHposFunction() + { + $this->assertFalse(function_exists('wc_get_page_screen_id')); + + $screen = new \stdClass(); + $screen->id = 'edit-shop_order'; + + $this->assertNull($this->integration->addOrdersListStatusViews($screen)); + } + + // ------------------------------------------------------------------- + // addOrdersListStatusLinks() + // ------------------------------------------------------------------- + + public function testAddOrdersListStatusLinksReturnsNonArrayInputUnchanged() + { + $this->assertSame('not-an-array', $this->integration->addOrdersListStatusLinks('not-an-array')); + $this->assertNull($this->integration->addOrdersListStatusLinks(null)); + } + + public function testAddOrdersListStatusLinksLeavesArrayUnchangedWithoutWooCommerce() + { + $this->assertFalse(function_exists('wc_get_order_statuses')); + + $views = array('all' => 'All'); + + $this->assertSame($views, $this->integration->addOrdersListStatusLinks($views)); + } + + // ------------------------------------------------------------------- + // getOrdersListViews() (private) + // ------------------------------------------------------------------- + + public function testGetOrdersListViewsReturnsEmptyArrayWithoutWooCommerce() + { + $this->assertFalse(function_exists('wc_get_order_statuses')); + + $result = $this->getMethod('getOrdersListViews')->invoke($this->integration); + + $this->assertSame(array(), $result); + } + + // ------------------------------------------------------------------- + // keepOrdersListWhenSpamOrdersExist() + // ------------------------------------------------------------------- + + public function testKeepOrdersListWhenSpamOrdersExistPassesThroughWithNoSpamOrders() + { + $this->assertNull($this->integration->keepOrdersListWhenSpamOrdersExist(null)); + $this->assertTrue($this->integration->keepOrdersListWhenSpamOrdersExist(true)); + } + + public function testKeepOrdersListWhenSpamOrdersExistForcesFalseWithStoredSpamOrders() + { + global $wpdb; + + $wpdb->insert( + APBCT_TBL_WC_SPAM_ORDERS, + array( + 'order_details' => '[]', + 'customer_details' => '[]', + 'order_date' => time(), + ) + ); + + $this->assertFalse($this->integration->keepOrdersListWhenSpamOrdersExist(true)); + $this->assertFalse($this->integration->keepOrdersListWhenSpamOrdersExist(null)); + } + + // ------------------------------------------------------------------- + // replaceOrdersListRenderer() (private) + // ------------------------------------------------------------------- + + public function testReplaceOrdersListRendererReturnsEarlyWhenPageHookIsUnknown() + { + $this->getMethod('replaceOrdersListRenderer')->invoke($this->integration, 'no_such_page_hook'); + + $this->assertFalse(has_action('no_such_page_hook', array($this->integration, 'renderSpamOrdersPage'))); + } + + public function testReplaceOrdersListRendererReplacesThePageController() + { + $page_hook = 'apbct_test_page_hook'; + $controller = new WcOrdersPageControllerStub(); + + add_action($page_hook, array($controller, 'output')); + + $this->getMethod('replaceOrdersListRenderer')->invoke($this->integration, $page_hook); + + $this->assertFalse( + has_action($page_hook, array($controller, 'output')), + 'The original WooCommerce page controller must be removed.' + ); + $this->assertNotFalse( + has_action($page_hook, array($this->integration, 'renderSpamOrdersPage')), + 'The spam orders renderer must take over the page hook.' + ); + + remove_action($page_hook, array($this->integration, 'renderSpamOrdersPage')); + } + + public function testReplaceOrdersListRendererLeavesUnrelatedCallbacksAlone() + { + $page_hook = 'apbct_test_page_hook_unrelated'; + $unrelated = new \stdClass(); + $unrelated_callback = function () { + }; + + add_action($page_hook, $unrelated_callback); + + $this->getMethod('replaceOrdersListRenderer')->invoke($this->integration, $page_hook); + + $this->assertNotFalse(has_action($page_hook, $unrelated_callback)); + $this->assertFalse(has_action($page_hook, array($this->integration, 'renderSpamOrdersPage'))); + + remove_action($page_hook, $unrelated_callback); + } + + // ------------------------------------------------------------------- + // addOrdersSpamStatus() / addOrdersSpamStatusSelect() / addOrdersSpamStatusHideFromList() + // ------------------------------------------------------------------- + + public function testAddOrdersSpamStatusRegistersTheSpamStatus() + { + $result = $this->integration->addOrdersSpamStatus(array('wc-processing' => 'Processing')); + + $this->assertArrayHasKey('wc-spamorder', $result); + $this->assertSame('Spam', $result['wc-spamorder']['label']); + $this->assertTrue($result['wc-spamorder']['show_in_admin_all_list']); + } + + public function testAddOrdersSpamStatusSelectRegistersTheSpamOption() + { + $result = $this->integration->addOrdersSpamStatusSelect(array('wc-processing' => 'Processing')); + + $this->assertSame('Spam', $result['wc-spamorder']); + } + + public function testAddOrdersSpamStatusHideFromListRemovesTheSpamStatusOnTheOrdersScreen() + { + global $pagenow; + + $pagenow_backup = $pagenow; + $pagenow = 'edit.php'; + + $query = new \stdClass(); + $query->query_vars = array( + 'post_type' => 'shop_order', + 'post_status' => array('wc-processing', 'wc-spamorder'), + ); + + $this->integration->addOrdersSpamStatusHideFromList($query); + + $this->assertSame(array('wc-processing'), array_values($query->query_vars['post_status'])); + + $pagenow = $pagenow_backup; + } + + public function testAddOrdersSpamStatusHideFromListLeavesOtherScreensAlone() + { + global $pagenow; + + $pagenow_backup = $pagenow; + $pagenow = 'index.php'; + + $query = new \stdClass(); + $query->query_vars = array( + 'post_type' => 'shop_order', + 'post_status' => array('wc-processing', 'wc-spamorder'), + ); + + $this->integration->addOrdersSpamStatusHideFromList($query); + + $this->assertContains('wc-spamorder', $query->query_vars['post_status']); + + $pagenow = $pagenow_backup; + } + + // ------------------------------------------------------------------- + // addSpamActionToBulk() + // ------------------------------------------------------------------- + + public function testAddSpamActionToBulkOffersMarkAsSpamByDefault() + { + $result = $this->integration->addSpamActionToBulk(array()); + + $this->assertArrayHasKey('spamorder', $result); + $this->assertArrayNotHasKey('unspamorder', $result); + } + + public function testAddSpamActionToBulkOffersUnmarkOnTheSpamScreen() + { + set_query_var('post_status', 'wc-spamorder'); + + $result = $this->integration->addSpamActionToBulk(array()); + + $this->assertArrayHasKey('unspamorder', $result); + $this->assertArrayNotHasKey('spamorder', $result); + + set_query_var('post_status', null); + } + + // ------------------------------------------------------------------- + // addSpamActionToBulkHandle() + // ------------------------------------------------------------------- + + public function testAddSpamActionToBulkHandleIgnoresUnrelatedActions() + { + $redirect = 'https://example.test/wp-admin/edit.php'; + + $result = $this->integration->addSpamActionToBulkHandle($redirect, 'trash', array(1, 2)); + + $this->assertSame($redirect, $result); + $this->assertSame(array(), \WC_Order::$update_status_calls); + } + + public function testAddSpamActionToBulkHandleMarksOrdersAsSpam() + { + $redirect = 'https://example.test/wp-admin/edit.php'; + + $result = $this->integration->addSpamActionToBulkHandle($redirect, 'spamorder', array(11, 12)); + + $this->assertSame( + array(array(11, 'wc-spamorder'), array(12, 'wc-spamorder')), + \WC_Order::$update_status_calls + ); + $this->assertStringContainsString('bulk_action=marked_spamorder', $result); + $this->assertStringContainsString('changed=2', $result); + } + + public function testAddSpamActionToBulkHandleUnmarksOrders() + { + $redirect = 'https://example.test/wp-admin/edit.php'; + + $result = $this->integration->addSpamActionToBulkHandle($redirect, 'unspamorder', array(21)); + + $this->assertSame(array(array(21, 'wc-on-hold')), \WC_Order::$update_status_calls); + $this->assertStringContainsString('bulk_action=marked_unspamorder', $result); + $this->assertStringContainsString('changed=1', $result); + } + + // ------------------------------------------------------------------- + // renderSpamOrdersPage() + // ------------------------------------------------------------------- + + public function testRenderSpamOrdersPagePrintsTheWrapperMarkup() + { + ob_start(); + $this->integration->renderSpamOrdersPage(); + $output = ob_get_clean(); + + $this->assertStringContainsString('class="wrap"', $output); + $this->assertStringContainsString('Spam orders', $output); + $this->assertStringContainsString('integration = new Woocommerce(); + + $this->forgetKey(); + } + + public function tearDown(): void + { + delete_transient(self::TRANSIENT_PREFIX . self::KEY); + + $this->forgetKey(); + + parent::tearDown(); + } + + /** + * The key is read through the cached variables storage, so both have to be set. + * + * @param string $key + * + * @return void + */ + private function setKey($key) + { + $_GET['key'] = $key; + + Get::getInstance()->variables = array(); + } + + /** + * @return void + */ + private function forgetKey() + { + unset($_GET['key']); + + Get::getInstance()->variables = array(); + } + + /** + * @return void + */ + private function storeOverview() + { + set_transient( + self::TRANSIENT_PREFIX . self::KEY, + array( + 'date' => 'September 23, 2026', + 'total' => '99.00', + 'payment_method' => 'Cash on delivery', + ), + HOUR_IN_SECONDS + ); + } + + // ------------------------------------------------------------------- + // appendBlockedOrderOverviewToBlock() - the block theme entry point + // ------------------------------------------------------------------- + + public function testOverviewIsAppendedToTheOrderConfirmationStatusBlock() + { + $this->storeOverview(); + $this->setKey(self::KEY); + + $result = $this->integration->appendBlockedOrderOverviewToBlock( + 'STATUS', + array('blockName' => self::STATUS_BLOCK) + ); + + $this->assertStringStartsWith('STATUS', $result, 'The original block content must be kept.'); + $this->assertStringContainsString('woocommerce-order-overview', $result); + $this->assertStringContainsString('September 23, 2026', $result); + $this->assertStringContainsString('99.00', $result); + $this->assertStringContainsString('Cash on delivery', $result); + } + + public function testUnrelatedBlocksAreLeftUntouched() + { + $this->storeOverview(); + $this->setKey(self::KEY); + + $result = $this->integration->appendBlockedOrderOverviewToBlock( + 'PARAGRAPH', + array('blockName' => 'core/paragraph') + ); + + $this->assertSame('PARAGRAPH', $result); + } + + public function testBlockWithoutNameIsLeftUntouched() + { + $this->storeOverview(); + $this->setKey(self::KEY); + + $result = $this->integration->appendBlockedOrderOverviewToBlock('RAW', array()); + + $this->assertSame('RAW', $result); + } + + public function testNothingIsAppendedWithoutTheKey() + { + $this->storeOverview(); + $this->forgetKey(); + + $result = $this->integration->appendBlockedOrderOverviewToBlock( + 'STATUS', + array('blockName' => self::STATUS_BLOCK) + ); + + $this->assertSame('STATUS', $result); + } + + public function testNothingIsAppendedWhenTheDetailsAreGone() + { + // The transient is deliberately not stored - it expires an hour after the block + $this->setKey(self::KEY); + + $result = $this->integration->appendBlockedOrderOverviewToBlock( + 'STATUS', + array('blockName' => self::STATUS_BLOCK) + ); + + $this->assertSame('STATUS', $result); + } + + public function testPaymentMethodRowIsOmittedWhenUnknown() + { + set_transient( + self::TRANSIENT_PREFIX . self::KEY, + array('date' => 'September 23, 2026', 'total' => '10.00'), + HOUR_IN_SECONDS + ); + $this->setKey(self::KEY); + + $result = $this->integration->appendBlockedOrderOverviewToBlock( + 'STATUS', + array('blockName' => self::STATUS_BLOCK) + ); + + $this->assertStringContainsString('woocommerce-order-overview__date', $result); + $this->assertStringContainsString('woocommerce-order-overview__total', $result); + $this->assertStringNotContainsString('woocommerce-order-overview__method', $result); + } + + // ------------------------------------------------------------------- + // renderBlockedOrderOverview() - the classic theme entry point + // ------------------------------------------------------------------- + + public function testOverviewIsPrintedAfterTheThankYouTemplate() + { + $this->storeOverview(); + $this->setKey(self::KEY); + + ob_start(); + $this->integration->renderBlockedOrderOverview('checkout/thankyou.php', '', '', array('order' => false)); + $output = ob_get_clean(); + + $this->assertStringContainsString('woocommerce-order-overview', $output); + $this->assertStringContainsString('September 23, 2026', $output); + } + + public function testNothingIsPrintedForAnotherTemplate() + { + $this->storeOverview(); + $this->setKey(self::KEY); + + ob_start(); + $this->integration->renderBlockedOrderOverview('checkout/form-checkout.php', '', '', array()); + $output = ob_get_clean(); + + $this->assertSame('', $output); + } + + public function testNothingIsPrintedWhenARealOrderStandsBehindThePage() + { + $this->storeOverview(); + $this->setKey(self::KEY); + + ob_start(); + $this->integration->renderBlockedOrderOverview( + 'checkout/thankyou.php', + '', + '', + array('order' => new \stdClass()) + ); + $output = ob_get_clean(); + + $this->assertSame('', $output); + } + + /** + * Both entry points have to show the very same details. + */ + public function testBothEntryPointsProduceTheSameMarkup() + { + $this->storeOverview(); + $this->setKey(self::KEY); + + ob_start(); + $this->integration->renderBlockedOrderOverview('checkout/thankyou.php', '', '', array('order' => false)); + $printed = ob_get_clean(); + + $appended = $this->integration->appendBlockedOrderOverviewToBlock( + '', + array('blockName' => self::STATUS_BLOCK) + ); + + $this->assertSame($printed, $appended); + } +} diff --git a/tests/Antispam/IntegrationsByClass/TestWoocommerceCheckoutGuards.php b/tests/Antispam/IntegrationsByClass/TestWoocommerceCheckoutGuards.php new file mode 100644 index 000000000..9bed18a0e --- /dev/null +++ b/tests/Antispam/IntegrationsByClass/TestWoocommerceCheckoutGuards.php @@ -0,0 +1,126 @@ +apbct_backup = $apbct; + $apbct = new State('cleantalk', array('settings', 'data', 'errors', 'remote_calls', 'stats', 'fw_stats')); + + $this->integration = new Woocommerce(); + } + + public function tearDown(): void + { + global $apbct; + + $apbct = $this->apbct_backup; + + parent::tearDown(); + } + + /** + * Minimal stand-in for the WP_Error object passed by woocommerce_after_checkout_validation. + * + * @param array $errors + * + * @return object + */ + private function makeErrors($errors = array()) + { + $holder = new \stdClass(); + $holder->errors = $errors; + + return $holder; + } + + /** + * WooCommerce reports its own validation errors first, the anti-spam check is skipped then. + */ + public function testCheckoutCheckReturnsEarlyWhenWooCommerceAlreadyFoundErrors() + { + global $apbct; + $apbct->settings['data__wc_store_blocked_orders'] = 1; + + $this->assertNull( + $this->integration->checkoutCheck( + array(), + $this->makeErrors(array('billing_email' => array('Invalid email'))) + ) + ); + } + + /** + * The storage option must not disable the anti-spam check itself, it only controls + * whether a blocked order is kept in the Spam folder. + */ + public function testCheckoutCheckIsNotGatedByTheStorageOption() + { + $source = file_get_contents( + CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/IntegrationsByClass/Woocommerce.php' + ); + + $this->assertStringNotContainsString( + 'if ( ! $apbct->settings[\'data__wc_store_blocked_orders\'] ) {', + $source + ); + } + + /** + * Anything that is not a WC_Order can not be checked, so the call is dropped. + */ + public function testCheckoutCheckFromRestReturnsEarlyWithoutAnOrder() + { + global $apbct; + $apbct->settings['data__wc_store_blocked_orders'] = 1; + + $this->assertNull($this->integration->checkoutCheckFromRest(null)); + $this->assertNull($this->integration->checkoutCheckFromRest(new \stdClass())); + } + + /** + * The order is not checkable regardless of the storage option value. + */ + public function testCheckoutCheckFromRestReturnsEarlyWithoutAnOrderWhenStorageIsOff() + { + global $apbct; + $apbct->settings['data__wc_store_blocked_orders'] = 0; + + $this->assertNull($this->integration->checkoutCheckFromRest(null)); + $this->assertNull($this->integration->checkoutCheckFromRest(new \stdClass())); + } + + /** + * Both checkout handlers stay attached to their WooCommerce hooks. + */ + public function testCheckoutHandlersAreCallable() + { + $this->assertTrue(is_callable(array($this->integration, 'checkoutCheck'))); + $this->assertTrue(is_callable(array($this->integration, 'checkoutCheckFromRest'))); + } +} diff --git a/tests/Antispam/IntegrationsByClass/TestWoocommerceLegacySpamOrdersMenuPage.php b/tests/Antispam/IntegrationsByClass/TestWoocommerceLegacySpamOrdersMenuPage.php new file mode 100644 index 000000000..0f112a706 --- /dev/null +++ b/tests/Antispam/IntegrationsByClass/TestWoocommerceLegacySpamOrdersMenuPage.php @@ -0,0 +1,109 @@ +submenu_backup = $submenu; + $submenu = array(); + + // Grant the capability required by add_submenu_page() regardless of the current user. + add_filter('user_has_cap', array($this, 'grantManageOptionsCap')); + + $this->integration = new Woocommerce(); + } + + public function tearDown(): void + { + global $submenu; + + $submenu = $this->submenu_backup; + remove_filter('user_has_cap', array($this, 'grantManageOptionsCap')); + + parent::tearDown(); + } + + /** + * @param array $allcaps + * + * @return array + */ + public function grantManageOptionsCap($allcaps) + { + $allcaps['manage_options'] = true; + + return $allcaps; + } + + /** + * Without wc_get_page_screen_id() (older WooCommerce, or the function unavailable + * as is the case in this test environment) the fallback page must still be registered. + */ + public function testAddsTheFallbackPageWhenTheHposScreenIdCanNotBeResolved() + { + $this->assertFalse(function_exists('wc_get_page_screen_id')); + + $this->integration->addLegacySpamOrdersMenuPage(); + + global $submenu; + + $this->assertArrayHasKey('woocommerce', $submenu); + + $found = false; + foreach ( $submenu['woocommerce'] as $item ) { + if ( $item[2] === 'apbct_wc_spam_orders' ) { + $found = true; + } + } + + $this->assertTrue($found, 'The apbct_wc_spam_orders submenu page was not registered.'); + } + + /** + * Regression guard: the fallback must stay conditional on the HPOS screen id, otherwise + * two competing "Spam" views would be registered on HPOS stores. + */ + public function testFallbackStaysConditionalOnTheHposScreenId() + { + $source = file_get_contents( + CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/IntegrationsByClass/Woocommerce.php' + ); + + $this->assertStringContainsString( + "function_exists('wc_get_page_screen_id') && wc_get_page_screen_id('shop_order') !== 'shop_order'", + $source + ); + } + + public function testHandlerIsCallable() + { + $this->assertTrue(is_callable(array($this->integration, 'addLegacySpamOrdersMenuPage'))); + } +} diff --git a/tests/Antispam/IntegrationsByClass/TestWoocommerceSimpleGetters.php b/tests/Antispam/IntegrationsByClass/TestWoocommerceSimpleGetters.php new file mode 100644 index 000000000..5ab7c39c0 --- /dev/null +++ b/tests/Antispam/IntegrationsByClass/TestWoocommerceSimpleGetters.php @@ -0,0 +1,262 @@ +formatted_total; + } + + public function get_payment_method_title() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps + { + return $this->payment_method_title; + } + } +} + +namespace Antispam\IntegrationsByClass { + + use Cleantalk\Antispam\IntegrationsByClass\Woocommerce; + use Cleantalk\ApbctWP\State; + use Cleantalk\ApbctWP\Variables\Post; + use PHPUnit\Framework\TestCase; + use WcOrderStub; + + /** + * Unit tests for the small getter methods of the WooCommerce integration. + * + * WooCommerce itself is never loaded in the test environment, so every getter is exercised + * through the "WooCommerce is not active" branch, plus the WC_Order branch using the + * minimal WcOrderStub declared at the top of this file. + */ + class TestWoocommerceSimpleGetters extends TestCase + { + /** + * @var Woocommerce + */ + private $integration; + + /** + * @var mixed + */ + private $apbct_backup; + + /** + * @var array Backup of the 'active_plugins' option to restore after the test. + */ + private $active_plugins_backup; + + public function setUp(): void + { + global $apbct; + parent::setUp(); + + $this->apbct_backup = $apbct; + $apbct = new State('cleantalk', array('settings', 'data', 'errors', 'remote_calls', 'stats', 'fw_stats')); + + $this->active_plugins_backup = get_option('active_plugins'); + + // Reflected variables cache their values for the process lifetime, drop it + // before every test so $_POST changes actually take effect. + Post::getInstance()->variables = array(); + + $this->integration = new Woocommerce(); + } + + public function tearDown(): void + { + global $apbct; + + $apbct = $this->apbct_backup; + update_option('active_plugins', $this->active_plugins_backup); + Post::getInstance()->variables = array(); + unset($_POST['payment_method']); + + parent::tearDown(); + } + + /** + * @return \ReflectionMethod + */ + private function getMethod($name) + { + $method = new \ReflectionMethod(Woocommerce::class, $name); + $method->setAccessible(true); + + return $method; + } + + // ------------------------------------------------------------------- + // getCompletedOrders() + // ------------------------------------------------------------------- + + public function testGetCompletedOrdersReturnsEmptyStringWhenWooCommerceIsNotActive() + { + update_option('active_plugins', array()); + + $this->assertSame('', Woocommerce::getCompletedOrders()); + } + + public function testGetCompletedOrdersReturnsSqlFragmentWhenWooCommerceIsActive() + { + update_option('active_plugins', array('woocommerce/woocommerce.php')); + + $result = Woocommerce::getCompletedOrders(); + + $this->assertIsString($result); + $this->assertNotSame('', $result); + $this->assertStringContainsString('wc-completed', $result); + } + + // ------------------------------------------------------------------- + // getBlockedOrderTotal() + // ------------------------------------------------------------------- + + public function testGetBlockedOrderTotalReturnsEmptyStringWithoutAnOrderAndWithoutWooCommerce() + { + $result = $this->getMethod('getBlockedOrderTotal')->invoke($this->integration, null); + + $this->assertSame('', $result); + } + + public function testGetBlockedOrderTotalUsesTheOrderWhenGiven() + { + $order = new WcOrderStub(); + $order->formatted_total = '$25.00'; + + $result = $this->getMethod('getBlockedOrderTotal')->invoke($this->integration, $order); + + $this->assertSame('$25.00', $result); + } + + // ------------------------------------------------------------------- + // getBlockedOrderPaymentMethod() + // ------------------------------------------------------------------- + + public function testGetBlockedOrderPaymentMethodReturnsEmptyStringWithoutAnOrderAndWithoutAChosenMethod() + { + $result = $this->getMethod('getBlockedOrderPaymentMethod')->invoke($this->integration, null); + + $this->assertSame('', $result); + } + + public function testGetBlockedOrderPaymentMethodReturnsEmptyStringWithoutAnOrderWhenWooCommerceIsNotActive() + { + $_POST['payment_method'] = 'bacs'; + + $result = $this->getMethod('getBlockedOrderPaymentMethod')->invoke($this->integration, null); + + // WC() is never defined in the test environment, so the gateway title can not be resolved. + $this->assertSame('', $result); + } + + public function testGetBlockedOrderPaymentMethodUsesTheOrderWhenGiven() + { + $order = new WcOrderStub(); + $order->payment_method_title = 'Direct bank transfer'; + + $result = $this->getMethod('getBlockedOrderPaymentMethod')->invoke($this->integration, $order); + + $this->assertSame('Direct bank transfer', $result); + } + + // ------------------------------------------------------------------- + // getOrdersListStatusCount() + // ------------------------------------------------------------------- + + public function testGetOrdersListStatusCountReturnsZeroWhenWooCommerceIsNotActive() + { + $result = $this->getMethod('getOrdersListStatusCount')->invoke($this->integration, 'wc-processing'); + + $this->assertSame(0, $result); + } + + public function testGetOrdersListStatusCountReadsTheSpamTableForTheSpamStatus() + { + $result = $this->getMethod('getOrdersListStatusCount')->invoke($this->integration, 'wc-spamorder'); + + // No WooCommerce/spam table is guaranteed in the test environment, only the type matters here. + $this->assertIsInt($result); + $this->assertGreaterThanOrEqual(0, $result); + } + + // ------------------------------------------------------------------- + // getOrdersListStatusLink() + // ------------------------------------------------------------------- + + public function testGetOrdersListStatusLinkRendersAnAnchorWithTheGivenCount() + { + $result = $this->getMethod('getOrdersListStatusLink')->invoke( + $this->integration, + 'wc-processing', + 'Processing', + false, + 7 + ); + + $this->assertStringContainsString('assertStringContainsString('Processing', $result); + $this->assertStringContainsString('(7)', $result); + $this->assertStringNotContainsString('class="current"', $result); + } + + public function testGetOrdersListStatusLinkMarksTheCurrentStatus() + { + $result = $this->getMethod('getOrdersListStatusLink')->invoke( + $this->integration, + 'wc-spamorder', + 'Spam', + true, + 3 + ); + + $this->assertStringContainsString('class="current"', $result); + } + + public function testGetOrdersListStatusLinkOmitsTheStatusQueryArgForAll() + { + $result = $this->getMethod('getOrdersListStatusLink')->invoke( + $this->integration, + '', + 'All', + true, + 42 + ); + + $this->assertStringNotContainsString('status=', $result); + $this->assertStringContainsString('(42)', $result); + } + + public function testGetOrdersListStatusLinkCountsTheStatusWhenNotGiven() + { + $result = $this->getMethod('getOrdersListStatusLink')->invoke( + $this->integration, + 'wc-processing', + 'Processing', + false, + null + ); + + // Without WooCommerce active the count resolves to 0 via getOrdersListStatusCount(). + $this->assertStringContainsString('(0)', $result); + } + } +} diff --git a/tests/Antispam/IntegrationsByHook/TestPagelayer.php b/tests/Antispam/IntegrationsByHook/TestPagelayer.php new file mode 100644 index 000000000..851373191 --- /dev/null +++ b/tests/Antispam/IntegrationsByHook/TestPagelayer.php @@ -0,0 +1,215 @@ +post_backup = $_POST; + $this->get_backup = $_GET; + } + + protected function tearDown(): void + { + $_POST = $this->post_backup; + $_GET = $this->get_backup; + $this->resetVariablesCache(); + } + + public function testGetDataForCheckingExcludesServiceFields() + { + $this->setPost($this->getContactFormPost()); + + $data = (new Pagelayer())->getDataForChecking(1); + $message = isset($data['message']) && is_array($data['message']) ? $data['message'] : array(); + + foreach ( self::$service_fields as $service_field ) { + $this->assertArrayNotHasKey( + $service_field, + $message, + 'Service field "' . $service_field . '" must not be sent for checking' + ); + } + } + + public function testGetDataForCheckingExcludesServiceValues() + { + $this->setPost($this->getContactFormPost()); + + $encoded = json_encode((new Pagelayer())->getDataForChecking(1)); + + $this->assertStringNotContainsString('https://example.com/thank-you/', $encoded); + $this->assertStringNotContainsString('pagelayer_nonce_value', $encoded); + $this->assertStringNotContainsString('test_vfields', $encoded); + } + + public function testGetDataForCheckingKeepsUserData() + { + $this->setPost($this->getContactFormPost()); + + $data = (new Pagelayer())->getDataForChecking(1); + + $this->assertSame('john@example.com', $data['email']); + $this->assertStringContainsString('Please call me back', json_encode($data['message'])); + } + + public function testGetDataForCheckingPassesEventToken() + { + $token = str_repeat('a', 64); + $post = $this->getContactFormPost(); + $post['ct_bot_detector_event_token'] = $token; + $this->setPost($post); + + $data = (new Pagelayer())->getDataForChecking(1); + + $this->assertSame($token, $data['event_token']); + } + + /** + * Pagelayer stops on empty($continue), so the allowed value has to stay truthy + */ + public function testAllowLetsPagelayerContinue() + { + $this->assertNotEmpty((new Pagelayer())->allow()); + } + + public function testDoFinalActionsClearsServiceFieldsFromPost() + { + $this->setPost($this->getContactFormPost()); + + $returned = (new Pagelayer())->doFinalActions(1); + + $this->assertSame(1, $returned, 'The filtered value must be passed through untouched'); + $this->assertArrayNotHasKey('ct_bot_detector_event_token', $_POST); + $this->assertArrayNotHasKey('apbct_visible_fields', $_POST); + $this->assertArrayNotHasKey('ct_no_cookie_hidden_field', $_POST); + $this->assertArrayHasKey('email', $_POST, 'User data must stay in $_POST for Pagelayer'); + } + + public function testIntegrationIsRegisteredOnPagelayerFilter() + { + $integrations = $this->loadIntegrationsRegistry(); + + $this->assertArrayHasKey('Pagelayer', $integrations); + $this->assertSame( + 'pagelayer_contact_submit_start', + $integrations['Pagelayer']['hook'], + 'The filter runs before Pagelayer copies $_POST into $formdata' + ); + $this->assertFalse( + $integrations['Pagelayer']['ajax'], + 'The hook is a filter, not a wp_ajax_ action' + ); + } + + /** + * The registry file declares $apbct_active_integrations at its own scope + * + * @return array + */ + private function loadIntegrationsRegistry() + { + include CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-integrations-by-hook.php'; + + return $apbct_active_integrations; + } + + /** + * Pagelayer posts to admin-ajax.php?action=pagelayer_contact_submit, so the action is GET only + */ + public function testSkipRequestDetectsActionPassedViaGet() + { + $post = $this->getContactFormPost(); + unset($post['action']); + $this->setPost($post); + $_GET['action'] = 'pagelayer_contact_submit'; + $this->resetVariablesCache(); + + $result = $this->callSkipRequestWithPagelayerActive(); + + $this->assertSame('Pagelayer contact form - has the direct integration', $result); + } + + public function testSkipRequestIgnoresForeignAction() + { + $_POST = array(); + $_GET['action'] = 'some_other_action'; + $this->resetVariablesCache(); + + $this->assertFalse($this->callSkipRequestWithPagelayerActive()); + } + + private function callSkipRequestWithPagelayerActive() + { + $active_plugins = static function () { + return array('pagelayer/pagelayer.php'); + }; + + add_filter('pre_option_active_plugins', $active_plugins); + $result = apbct_is_skip_request(false); + remove_filter('pre_option_active_plugins', $active_plugins); + + return $result; + } + + private function getContactFormPost() + { + return array( + 'name' => 'John', + 'email' => 'john@example.com', + 'Subject' => 'Lawn care', + 'message' => 'Please call me back', + 'action' => 'pagelayer_contact_submit', + 'pagelayer_nonce' => 'pagelayer_nonce_value', + 'pagelayer-contact-submit' => 'Submit', + 'cfa-pagelayer-id' => 'mwt2449', + 'cfa-post-id' => '43', + 'cfa-custom-template' => 'true', + 'cfa-redirect' => 'https://example.com/thank-you/', + 'apbct_visible_fields' => 'test_vfields', + 'ct_bot_detector_event_token' => str_repeat('a', 64), + 'ct_no_cookie_hidden_field' => '_ct_no_cookie_data_test', + ); + } + + private function setPost(array $post) + { + $_POST = $post; + $this->resetVariablesCache(); + } + + /** + * Post/Get/Request keep every read value in the singleton for the whole process + */ + private function resetVariablesCache() + { + Post::getInstance()->variables = array(); + Get::getInstance()->variables = array(); + Request::getInstance()->variables = array(); + } +} diff --git a/tests/ApbctWP/ContactsEncoder/Helper/TestContactsEncoderHelper.php b/tests/ApbctWP/ContactsEncoder/Helper/TestContactsEncoderHelper.php index 0371db721..9672c807d 100644 --- a/tests/ApbctWP/ContactsEncoder/Helper/TestContactsEncoderHelper.php +++ b/tests/ApbctWP/ContactsEncoder/Helper/TestContactsEncoderHelper.php @@ -75,4 +75,50 @@ public function testHasAttributeExclusionsReturnsFalseForEmptyMatch() { $this->assertFalse($this->helper->hasAttributeExclusions('', '')); } + + public function testIsInsideRawTextTagDetectsStyleAndJsonLd() + { + $email = 'user@example.com'; + + $style = ''; + $this->assertTrue($this->helper->isInsideRawTextTag($email, $style, strpos($style, $email))); + + $json_ld = ''; + $this->assertTrue($this->helper->isInsideRawTextTag($email, $json_ld, strpos($json_ld, $email))); + + $noscript = ''; + $this->assertTrue($this->helper->isInsideRawTextTag($email, $noscript, strpos($noscript, $email))); + } + + public function testIsInsideRawTextTagCanBeRestrictedToGivenTags() + { + $email = 'user@example.com'; + $content = ''; + + $this->assertFalse( + $this->helper->isInsideRawTextTag($email, $content, strpos($content, $email), array('script')) + ); + } + + public function testIsInsideScriptTagStillMatchesOnlyScripts() + { + $email = 'user@example.com'; + + $script = ''; + $this->assertTrue($this->helper->isInsideScriptTag($email, $script, strpos($script, $email))); + + $style = ''; + $this->assertFalse($this->helper->isInsideScriptTag($email, $style, strpos($style, $email))); + } + + public function testRawTextIndexIsRebuiltWhenContentChanges() + { + $email = 'user@example.com'; + + $first = ''; + $this->assertTrue($this->helper->isInsideRawTextTag($email, $first, strpos($first, $email))); + + $second = '

      Write to ' . $email . ' today

      '; + $this->assertFalse($this->helper->isInsideRawTextTag($email, $second, strpos($second, $email))); + } } diff --git a/tests/ApbctWP/ContactsEncoder/Shortcodes/EmailEncoderShortCodePrecheckTest.php b/tests/ApbctWP/ContactsEncoder/Shortcodes/EmailEncoderShortCodePrecheckTest.php new file mode 100644 index 000000000..c1f65851c --- /dev/null +++ b/tests/ApbctWP/ContactsEncoder/Shortcodes/EmailEncoderShortCodePrecheckTest.php @@ -0,0 +1,260 @@ +api_key = 'testapikey'; + + $this->encode_sc = new EncodeContentSC(new Params()); + $this->exclude_sc = new ExcludedEncodeContentSC(); + } + + /** + * Call a protected method on the given object. + * + * @param object $object + * @param string $method + * @param array $args + * + * @return mixed + */ + private function callProtected($object, $method, array $args) + { + $reflection = new \ReflectionMethod($object, $method); + $reflection->setAccessible(true); + + return $reflection->invokeArgs($object, $args); + } + + /** + * @return array + */ + public function encodeShortcodePrecheckProvider() + { + return array( + 'plain text' => array('Just a plain sentence with no shortcodes.', false), + 'email without shortcode' => array('Contact us at test@example.com please.', false), + 'html without shortcode' => array('

      Some markup here.

      ', false), + 'other plugin shortcode' => array('[gallery ids="1,2,3"]', false), + 'similar but different name' => array('[apbct_encode_data_other]x[/apbct_encode_data_other]', true), + 'bare opening tag' => array('[apbct_encode_data]', true), + 'full shortcode' => array('[apbct_encode_data]a@b.com[/apbct_encode_data]', true), + 'shortcode with attributes' => array('[apbct_encode_data mode="blur"]a@b.com[/apbct_encode_data]', true), + ); + } + + /** + * @dataProvider encodeShortcodePrecheckProvider + * + * @param string $content + * @param bool $expected + */ + public function testContentMayContainShortcodeForEncodeSC($content, $expected): void + { + $this->assertSame( + $expected, + $this->callProtected($this->encode_sc, 'contentMayContainShortcode', array($content)) + ); + } + + /** + * The pre-check must reject every non-string and empty value without touching a regex. + * + * @return array + */ + public function nonStringProvider() + { + return array( + 'null' => array(null), + 'empty string' => array(''), + 'false' => array(false), + 'integer' => array(10), + 'array' => array(array('[apbct_encode_data]')), + 'object' => array(new \stdClass()), + ); + } + + /** + * @dataProvider nonStringProvider + * + * @param mixed $content + */ + public function testContentMayContainShortcodeRejectsNonStrings($content): void + { + $this->assertFalse( + $this->callProtected($this->encode_sc, 'contentMayContainShortcode', array($content)) + ); + $this->assertFalse( + $this->callProtected($this->exclude_sc, 'contentMayContainShortcode', array($content)) + ); + } + + /** + * Each subclass must match only its own tag. + */ + public function testPrecheckIsScopedToOwnShortcodeName(): void + { + $encode_tag = '[apbct_encode_data]a@b.com[/apbct_encode_data]'; + $exclude_tag = '[apbct_skip_encoding]a@b.com[/apbct_skip_encoding]'; + + $this->assertTrue( + $this->callProtected($this->encode_sc, 'contentMayContainShortcode', array($encode_tag)) + ); + $this->assertFalse( + $this->callProtected($this->encode_sc, 'contentMayContainShortcode', array($exclude_tag)) + ); + + $this->assertTrue( + $this->callProtected($this->exclude_sc, 'contentMayContainShortcode', array($exclude_tag)) + ); + $this->assertFalse( + $this->callProtected($this->exclude_sc, 'contentMayContainShortcode', array($encode_tag)) + ); + } + + /** + * A closing tag alone is not a valid pair, so the pre-check must skip it. + */ + public function testPrecheckIgnoresOrphanClosingTag(): void + { + $this->assertFalse( + $this->callProtected($this->encode_sc, 'contentMayContainShortcode', array('text [/apbct_encode_data]')) + ); + } + + /** + * Fast path: content without the shortcode must come back byte-identical. + */ + public function testChangeContentBeforeEncoderModifyReturnsContentWithoutShortcodeUntouched(): void + { + $content = '

      Hello, reach us at test@example.com or [gallery id="2"].

      '; + + $this->assertSame($content, $this->encode_sc->changeContentBeforeEncoderModify($content)); + $this->assertSame($content, $this->exclude_sc->changeContentBeforeEncoderModify($content)); + } + + /** + * Slow path must still work: the shortcode is replaced by a placeholder. + */ + public function testChangeContentBeforeEncoderModifyStillProcessesShortcode(): void + { + $encode_result = $this->encode_sc->changeContentBeforeEncoderModify( + 'Mail: [apbct_encode_data]a@b.com[/apbct_encode_data]' + ); + $this->assertStringContainsString('APBCT_SHORT_CODE_INCLUDE', $encode_result); + $this->assertStringNotContainsString('[apbct_encode_data]', $encode_result); + + $exclude_result = $this->exclude_sc->changeContentBeforeEncoderModify( + 'Mail: [apbct_skip_encoding]a@b.com[/apbct_skip_encoding]' + ); + $this->assertStringContainsString('APBCT_SHORT_CODE_SKIP', $exclude_result); + $this->assertStringNotContainsString('[apbct_skip_encoding]', $exclude_result); + } + + /** + * WP passes null to get_header/get_footer hooks - the guard must survive it. + */ + public function testChangeContentBeforeEncoderModifyHandlesNull(): void + { + $this->assertNull($this->encode_sc->changeContentBeforeEncoderModify(null)); + $this->assertNull($this->exclude_sc->changeContentBeforeEncoderModify(null)); + } + + /** + * The "after" pass must short-circuit when there is nothing to restore and no shortcode left. + */ + public function testChangeContentAfterEncoderModifyShortCircuitsWithoutReplacements(): void + { + $this->encode_sc->resetShortcodeReplacements(); + + $content = '

      Nothing to do here, test@example.com.

      '; + + $this->assertSame($content, $this->encode_sc->changeContentAfterEncoderModify($content)); + } + + /** + * The short-circuit must not drop pending placeholders. + */ + public function testChangeContentAfterEncoderModifyRestoresPendingPlaceholders(): void + { + $this->encode_sc->resetShortcodeReplacements(); + + $before = $this->encode_sc->changeContentBeforeEncoderModify( + 'Mail: [apbct_encode_data]a@b.com[/apbct_encode_data]' + ); + + $this->assertNotEmpty($this->encode_sc->shortcode_replacements); + + $after = $this->encode_sc->changeContentAfterEncoderModify($before); + + $this->assertStringNotContainsString('APBCT_SHORT_CODE_INCLUDE', $after); + } + + /** + * Round-trip on shortcode-free content must be a no-op through both passes. + */ + public function testFullRoundTripIsNoOpForContentWithoutShortcodes(): void + { + $this->encode_sc->resetShortcodeReplacements(); + + $content = '
      Plain content, no shortcodes at all.
      '; + + $processed = $this->encode_sc->changeContentBeforeEncoderModify($content); + $processed = $this->encode_sc->changeContentAfterEncoderModify($processed); + + $this->assertSame($content, $processed); + } + + /** + * The pre-check must not change the "shortcode inside an HTML tag" detection result. + */ + public function testIsShortcodeInsideHtmlTagStillDetectsAttributeContext(): void + { + $inside = 'x'; + $outside = '

      [apbct_encode_data]a@b.com[/apbct_encode_data]

      '; + + $this->assertTrue($this->callProtected($this->encode_sc, 'isShortcodeInsideHtmlTag', array($inside))); + $this->assertFalse($this->callProtected($this->encode_sc, 'isShortcodeInsideHtmlTag', array($outside))); + } + + /** + * Guarded early return: no shortcode at all means "not inside a tag", and no regex is run. + */ + public function testIsShortcodeInsideHtmlTagReturnsFalseWithoutShortcode(): void + { + $this->assertFalse( + $this->callProtected($this->encode_sc, 'isShortcodeInsideHtmlTag', array('x')) + ); + $this->assertFalse( + $this->callProtected($this->encode_sc, 'isShortcodeInsideHtmlTag', array(null)) + ); + } +} diff --git a/tests/ApbctWP/ContactsEncoder/TestContactsEncoder.php b/tests/ApbctWP/ContactsEncoder/TestContactsEncoder.php index b767ed4b8..fbbb45853 100644 --- a/tests/ApbctWP/ContactsEncoder/TestContactsEncoder.php +++ b/tests/ApbctWP/ContactsEncoder/TestContactsEncoder.php @@ -23,12 +23,19 @@ class TestEmailEncoder extends TestCase */ private $read_css_fixture_files = array(); + /** + * @var string|null + */ + private $original_cookies_type = null; + public function setUp(): void { global $apbct; $apbct->api_key = 'testapikey'; $this->contacts_encoder = apbctGetContactsEncoder(); $this->read_css_fixture_files = array(); + $this->original_cookies_type = isset($apbct->data['cookies_type']) ? $apbct->data['cookies_type'] : null; + $apbct->data['cookies_type'] = 'native'; $this->clearDecoderPassedCookie(); } @@ -1097,12 +1104,243 @@ public function testAttributeExclusionsSignsFilter() $this->assertStringContainsString('apbct-email-encoder', $result); } + /** + * Regression fixture for the markup guards. Exclusions are an allowlist: preset attributes, + * attributes added through the filter, raw text blocks and aria-label. Everything else stays + * encodable by design. + */ + public function testPresetAndHookExclusionsSurviveRepeatedContacts() + { + global $apbct; + + $apbct->settings['data__email_decoder_obfuscation_mode'] = Params::OBFUSCATION_MODE_BLUR; + $apbct->settings['data__email_decoder_encode_phone_numbers'] = 1; + $apbct->saveSettings(); + $this->contacts_encoder->dropInstance(); + $this->contacts_encoder = apbctGetContactsEncoder(); + + add_filter('apbct_email_encoder_attribute_exclusions_signs', function ($signs) { + $signs['div'][] = 'data-contact'; + return $signs; + }); + + $email = 'user@example.com'; + $phone = '(800) 555-1234'; + + $untouchable = array( + 'aria-label' => '', + 'preset input placeholder' => '', + 'preset img alt' => '' . $email . '', + 'hook added attribute' => '
      ok
      ', + 'json-ld' => '', + 'inline script' => '', + 'style block' => '', + ); + + $content = '

      Contact us: ' . $email . ' or ' . $phone . '

      ' . implode('', $untouchable); + + $result = $this->contacts_encoder->modifyContent($content); + + remove_all_filters('apbct_email_encoder_attribute_exclusions_signs'); + + foreach ( $untouchable as $case => $markup ) { + $this->assertStringContainsString( + $markup, + $result, + 'Markup must stay untouched for case: ' . $case + ); + } + + $this->assertStringContainsString('apbct-email-encoder', $result); + $this->assertStringNotContainsString('

      Contact us: ' . $email, $result); + $this->assertStringNotContainsString($phone . '

      ', $result); + } + + /** + * The preset a => title drop must fire wherever the address sits inside the value, and it must + * never eat the surrounding markup while doing so. + */ + public function testAnchorTitleWithEmailIsDroppedRegardlessOfPosition() + { + global $apbct; + + $apbct->settings['data__email_decoder_obfuscation_mode'] = Params::OBFUSCATION_MODE_BLUR; + $apbct->settings['data__email_decoder_encode_phone_numbers'] = 0; + $apbct->saveSettings(); + $this->contacts_encoder->dropInstance(); + $this->contacts_encoder = apbctGetContactsEncoder(); + + $email = 'user@example.com'; + + $leading = $this->contacts_encoder->modifyContent( + 'text' + ); + $this->assertSame('text', $leading); + + $trailing = $this->contacts_encoder->modifyContent( + 'text' + ); + $this->assertSame('text', $trailing); + + $neighbours = $this->contacts_encoder->modifyContent( + 'texttail' + ); + $this->assertSame( + 'texttail', + $neighbours + ); + + $without_email = 'text'; + $this->assertSame($without_email, $this->contacts_encoder->modifyContent($without_email)); + } + + /** + * A contact repeated on the page must be judged per occurrence, not by the position of the + * first one found in the document. + */ + public function testGuardsAreEvaluatedPerOccurrenceNotPerPage() + { + global $apbct; + + $apbct->settings['data__email_decoder_obfuscation_mode'] = Params::OBFUSCATION_MODE_BLUR; + $apbct->settings['data__email_decoder_encode_phone_numbers'] = 0; + $apbct->saveSettings(); + $this->contacts_encoder->dropInstance(); + $this->contacts_encoder = apbctGetContactsEncoder(); + + $email = 'repeated@example.com'; + $content = '' + . '

      ' . $email . '

      ' + . '' + . '' . $email . ''; + + $result = $this->contacts_encoder->modifyContent($content); + + $this->assertStringContainsString('var e="' . $email . '";', $result); + $this->assertStringContainsString('placeholder="' . $email . '"', $result); + $this->assertSame(2, substr_count($result, 'apbct-email-encoder')); + } + + /** + * mailto: and tel: links are rewritten in place inside the href attribute, so the markup + * guards must not swallow them. + */ + public function testSchemeLinksAreStillEncodedInsideHref() + { + global $apbct; + + $apbct->settings['data__email_decoder_obfuscation_mode'] = Params::OBFUSCATION_MODE_BLUR; + $apbct->settings['data__email_decoder_encode_phone_numbers'] = 1; + $apbct->saveSettings(); + $this->contacts_encoder->dropInstance(); + $this->contacts_encoder = apbctGetContactsEncoder(); + + $email = 'mail-link@example.com'; + $content = 'writecall'; + + $result = $this->contacts_encoder->modifyContent($content); + + $this->assertStringNotContainsString('mailto:' . $email, $result); + $this->assertStringNotContainsString('tel:+15551234567', $result); + $this->assertSame(2, substr_count($result, 'data-original-string=')); + } + + /** + * A literal occurrence the pattern did not match must not shadow the real match further down + * the document, e.g. `user@example.com1` inside a script before a genuine address in the body. + */ + public function testUnmatchedLiteralDoesNotShadowRealMatchOffset() + { + global $apbct; + + $apbct->settings['data__email_decoder_obfuscation_mode'] = Params::OBFUSCATION_MODE_BLUR; + $apbct->settings['data__email_decoder_encode_phone_numbers'] = 1; + $apbct->saveSettings(); + $this->contacts_encoder->dropInstance(); + $this->contacts_encoder = apbctGetContactsEncoder(); + + $email = 'shadowed@example.com'; + $content = '

      ' . $email . '

      '; + + $result = $this->contacts_encoder->modifyContent($content); + + $this->assertStringContainsString('var t="' . $email . '1";', $result); + $this->assertStringContainsString('apbct-email-encoder', $result); + $this->assertStringNotContainsString('

      ' . $email . '

      ', $result); + } + + /** + * Scheme links are rewritten from the inside of the href value, so the encoder appends its own + * attributes to the opening tag. It must not emit a second title when the author already set one. + */ + public function testSchemeLinkDoesNotDuplicateExistingTitleAttribute() + { + global $apbct; + + $apbct->settings['data__email_decoder_obfuscation_mode'] = Params::OBFUSCATION_MODE_BLUR; + $apbct->settings['data__email_decoder_encode_phone_numbers'] = 1; + $apbct->saveSettings(); + $this->contacts_encoder->dropInstance(); + $this->contacts_encoder = apbctGetContactsEncoder(); + + $cases = array( + 'title before href' => 'mail', + 'title after href' => 'mail', + 'single quoted title' => "mail", + 'tel link' => 'call', + ); + + foreach ( $cases as $case => $markup ) { + $result = $this->contacts_encoder->modifyContent($markup); + + $this->assertSame(1, substr_count($result, 'title='), 'Duplicated title for case: ' . $case); + $this->assertRegExp('/title=["\']' . ($case === 'tel link' ? 'Call us' : 'Write to us') . '["\']/', $result); + $this->assertStringContainsString('data-original-string="', $result); + } + + $without_title = $this->contacts_encoder->modifyContent( + 'mail' + ); + $this->assertSame(1, substr_count($without_title, 'title=')); + $this->assertStringContainsString('This contact has been encoded', $without_title); + $this->assertStringContainsString('data-original-string="', $without_title); + } + + /** + * When the preset a => title drop removes the author's title, the encoder tooltip must be added + * back, because there is no attribute left to collide with. + */ + public function testSchemeLinkKeepsTooltipWhenTitleWasDropped() + { + global $apbct; + + $apbct->settings['data__email_decoder_obfuscation_mode'] = Params::OBFUSCATION_MODE_BLUR; + $apbct->settings['data__email_decoder_encode_phone_numbers'] = 0; + $apbct->saveSettings(); + $this->contacts_encoder->dropInstance(); + $this->contacts_encoder = apbctGetContactsEncoder(); + + $result = $this->contacts_encoder->modifyContent( + 'mail' + ); + + $this->assertStringNotContainsString('Write to u@example.com', $result); + $this->assertSame(1, substr_count($result, 'title=')); + $this->assertStringContainsString('This contact has been encoded', $result); + } + public function tearDown() : void { global $apbct; $apbct->buffer = ''; $this->clearDecoderPassedCookie(); + if ( $this->original_cookies_type === null ) { + unset($apbct->data['cookies_type']); + } else { + $apbct->data['cookies_type'] = $this->original_cookies_type; + } + foreach ( $this->read_css_fixture_files as $fixture_file ) { if ( is_string($fixture_file) && is_file($fixture_file) ) { unlink($fixture_file); diff --git a/tests/ApbctWP/EscapeTest.php b/tests/ApbctWP/EscapeTest.php new file mode 100644 index 000000000..eee3f0bb2 --- /dev/null +++ b/tests/ApbctWP/EscapeTest.php @@ -0,0 +1,45 @@ +Title' + . '
      • Item one
      ' + . ''; + + $result = Escape::escKsesPreset($html, 'apbct_update_changelog_notice'); + + $this->assertSame($html, $result); + } + + public function testEscKsesPresetStripsDisallowedTags() + { + $html = '

      paragraph

      • ok
      '; + + $result = Escape::escKsesPreset($html, 'apbct_update_changelog_notice'); + + //

      was intentionally removed from the whitelist (it caused the + // ".update-message p:before" update icon to be duplicated). + $this->assertStringNotContainsString('

      ', $result); + $this->assertStringNotContainsString('assertStringContainsString('

        ', $result); + $this->assertStringContainsString('
      • ok
      • ', $result); + } + + public function testEscKsesPresetKeepsListStyleDeclaration() + { + // wp_kses filters "style" attribute values against the safe_style_css + // whitelist. "list-style" must survive it, otherwise the bullets + // disappear on admin themes that reset "ul { list-style: none }". + $html = '
        • a
        '; + + $result = Escape::escKsesPreset($html, 'apbct_update_changelog_notice'); + + $this->assertStringContainsString('list-style: disc', $result); + $this->assertStringContainsString('padding-left: 20px', $result); + } +} diff --git a/tests/ApbctWP/FindSpam/ListTable/TestComments.php b/tests/ApbctWP/FindSpam/ListTable/TestComments.php index 52ee273fb..85da300bb 100644 --- a/tests/ApbctWP/FindSpam/ListTable/TestComments.php +++ b/tests/ApbctWP/FindSpam/ListTable/TestComments.php @@ -8,7 +8,7 @@ /** * Tests for Comments list table column_ct_author method. */ -class TestComments extends TestCase +class TestComments extends \ApbctTestCase { /** * @var Comments @@ -23,18 +23,15 @@ class TestComments extends TestCase protected function setUp(): void { global $apbct; - + $reflection = new \ReflectionClass(Comments::class); $this->instance = $reflection->newInstanceWithoutConstructor(); $this->columnCtAuthor = $reflection->getMethod('column_ct_author'); $this->columnCtAuthor->setAccessible(true); - // Set both instance property and global variable - $apbct = (object)[ - 'white_label' => true, - ]; - + $apbct->white_label = true; + // Use reflection to set the protected property $apbctProperty = $reflection->getProperty('apbct'); $apbctProperty->setAccessible(true); @@ -105,7 +102,7 @@ public function testColumnCtAuthorShowsNoIpWhenEmpty(): void public function testColumnCtAuthorShowsEmailWithoutCleantalkLinkWhenWhiteLabel(): void { global $apbct; - + $comment = (object)[ 'comment_author' => 'Test Author', 'comment_author_email' => 'test@example.com', @@ -125,10 +122,10 @@ public function testColumnCtAuthorShowsEmailWithoutCleantalkLinkWhenWhiteLabel() public function testColumnCtAuthorShowsEmailWithCleantalkLinkWhenNotWhiteLabel(): void { global $apbct; - + // Update global apbct $apbct->white_label = false; - + // Update instance apbct using reflection $reflection = new \ReflectionClass(Comments::class); $apbctProperty = $reflection->getProperty('apbct'); diff --git a/tests/ApbctWP/FindSpam/ListTable/TestUsers.php b/tests/ApbctWP/FindSpam/ListTable/TestUsers.php index 95a25a2e2..4d24bf5c2 100644 --- a/tests/ApbctWP/FindSpam/ListTable/TestUsers.php +++ b/tests/ApbctWP/FindSpam/ListTable/TestUsers.php @@ -1,154 +1,152 @@ -instance = $reflection->newInstanceWithoutConstructor(); - - $this->columnCtUsername = $reflection->getMethod('column_ct_username'); - $this->columnCtUsername->setAccessible(true); - - // Mock apbct: white_label and login_ip_keeper (object with getIP method) - $ipKeeper = $this->getMockBuilder(\stdClass::class) - ->addMethods(['getIP']) - ->getMock(); - $ipKeeper->method('getIP')->willReturn(null); - - // Set both instance property and global variable - $apbct = (object)[ - 'white_label' => true, - 'login_ip_keeper' => $ipKeeper, - ]; - - // Use reflection to set the protected property - $apbctProperty = $reflection->getProperty('apbct'); - $apbctProperty->setAccessible(true); - $apbctProperty->setValue($this->instance, $apbct); - } - - /** - * column_ct_username contains user login and row actions with nonce. - */ - public function testColumnCtUsernameContainsLoginAndActionsWithNonce(): void - { - $_GET['page'] = 'ct_check_users'; - - $user = (object)[ - 'ID' => 42, - 'user_login' => 'testuser', - 'user_email' => 'test@example.com', - ]; - $item = ['ct_username' => $user]; - - $result = $this->columnCtUsername->invoke($this->instance, $item); - - $this->assertStringContainsString('testuser', $result); - $this->assertStringContainsString('test@example.com', $result); - $this->assertStringContainsString('mailto:test@example.com', $result); - $this->assertStringContainsString('Approve', $result); - $this->assertStringContainsString('Delete', $result); - $this->assertStringContainsString('_wpnonce=', $result); - $this->assertStringContainsString('action=approve', $result); - $this->assertStringContainsString('action=delete', $result); - $this->assertStringContainsString('spam=42', $result); - } - - /** - * column_ct_username shows "No email" when user has no email. - */ - public function testColumnCtUsernameShowsNoEmailWhenEmpty(): void - { - $_GET['page'] = 'ct_check_users'; - - $user = (object)[ - 'ID' => 1, - 'user_login' => 'noemailuser', - 'user_email' => '', - ]; - $item = ['ct_username' => $user]; - - $result = $this->columnCtUsername->invoke($this->instance, $item); - - $this->assertStringContainsString('noemailuser', $result); - $this->assertStringContainsString('No email', $result); - } - - /** - * column_ct_username shows IP and link when login_ip_keeper returns IP. - */ - public function testColumnCtUsernameShowsIpWhenKeeperReturnsIp(): void - { - global $apbct; - - $_GET['page'] = 'ct_check_users'; - - $ipKeeper = $this->getMockBuilder(\stdClass::class) - ->addMethods(['getIP']) - ->getMock(); - $ipKeeper->method('getIP')->with(99)->willReturn('192.168.1.1'); - - // Update global apbct - $apbct->login_ip_keeper = $ipKeeper; - - // Update instance apbct using reflection - $reflection = new \ReflectionClass(Users::class); - $apbctProperty = $reflection->getProperty('apbct'); - $apbctProperty->setAccessible(true); - $instanceApbct = $apbctProperty->getValue($this->instance); - $instanceApbct->login_ip_keeper = $ipKeeper; - $apbctProperty->setValue($this->instance, $instanceApbct); - - $user = (object)[ - 'ID' => 99, - 'user_login' => 'ipuser', - 'user_email' => 'ip@test.com', - ]; - $item = ['ct_username' => $user]; - - $result = $this->columnCtUsername->invoke($this->instance, $item); - - $this->assertStringContainsString('192.168.1.1', $result); - $this->assertStringContainsString('user-edit.php?user_id=99', $result); - } - - /** - * column_ct_username shows "No IP adress" when keeper returns null. - */ - public function testColumnCtUsernameShowsNoIpWhenKeeperReturnsNull(): void - { - $_GET['page'] = 'ct_check_users'; - - $user = (object)[ - 'ID' => 1, - 'user_login' => 'noipuser', - 'user_email' => 'a@b.com', - ]; - $item = ['ct_username' => $user]; - - $result = $this->columnCtUsername->invoke($this->instance, $item); - - $this->assertStringContainsString('No IP adress', $result); - } -} +instance = $reflection->newInstanceWithoutConstructor(); + + $this->columnCtUsername = $reflection->getMethod('column_ct_username'); + $this->columnCtUsername->setAccessible(true); + + // Mock apbct: white_label and login_ip_keeper (object with getIP method) + $ipKeeper = $this->getMockBuilder(\stdClass::class) + ->addMethods(['getIP']) + ->getMock(); + $ipKeeper->method('getIP')->willReturn(null); + + // Set both instance property and global variable + $apbct->white_label = true; + $apbct->login_ip_keeper = $ipKeeper; + + // Use reflection to set the protected property + $apbctProperty = $reflection->getProperty('apbct'); + $apbctProperty->setAccessible(true); + $apbctProperty->setValue($this->instance, $apbct); + } + + /** + * column_ct_username contains user login and row actions with nonce. + */ + public function testColumnCtUsernameContainsLoginAndActionsWithNonce(): void + { + $_GET['page'] = 'ct_check_users'; + + $user = (object)[ + 'ID' => 42, + 'user_login' => 'testuser', + 'user_email' => 'test@example.com', + ]; + $item = ['ct_username' => $user]; + + $result = $this->columnCtUsername->invoke($this->instance, $item); + + $this->assertStringContainsString('testuser', $result); + $this->assertStringContainsString('test@example.com', $result); + $this->assertStringContainsString('mailto:test@example.com', $result); + $this->assertStringContainsString('Approve', $result); + $this->assertStringContainsString('Delete', $result); + $this->assertStringContainsString('_wpnonce=', $result); + $this->assertStringContainsString('action=approve', $result); + $this->assertStringContainsString('action=delete', $result); + $this->assertStringContainsString('spam=42', $result); + } + + /** + * column_ct_username shows "No email" when user has no email. + */ + public function testColumnCtUsernameShowsNoEmailWhenEmpty(): void + { + $_GET['page'] = 'ct_check_users'; + + $user = (object)[ + 'ID' => 1, + 'user_login' => 'noemailuser', + 'user_email' => '', + ]; + $item = ['ct_username' => $user]; + + $result = $this->columnCtUsername->invoke($this->instance, $item); + + $this->assertStringContainsString('noemailuser', $result); + $this->assertStringContainsString('No email', $result); + } + + /** + * column_ct_username shows IP and link when login_ip_keeper returns IP. + */ + public function testColumnCtUsernameShowsIpWhenKeeperReturnsIp(): void + { + global $apbct; + + $_GET['page'] = 'ct_check_users'; + + $ipKeeper = $this->getMockBuilder(\stdClass::class) + ->addMethods(['getIP']) + ->getMock(); + $ipKeeper->method('getIP')->with(99)->willReturn('192.168.1.1'); + + // Update global apbct + $apbct->login_ip_keeper = $ipKeeper; + + // Update instance apbct using reflection + $reflection = new \ReflectionClass(Users::class); + $apbctProperty = $reflection->getProperty('apbct'); + $apbctProperty->setAccessible(true); + $instanceApbct = $apbctProperty->getValue($this->instance); + $instanceApbct->login_ip_keeper = $ipKeeper; + $apbctProperty->setValue($this->instance, $instanceApbct); + + $user = (object)[ + 'ID' => 99, + 'user_login' => 'ipuser', + 'user_email' => 'ip@test.com', + ]; + $item = ['ct_username' => $user]; + + $result = $this->columnCtUsername->invoke($this->instance, $item); + + $this->assertStringContainsString('192.168.1.1', $result); + $this->assertStringContainsString('user-edit.php?user_id=99', $result); + } + + /** + * column_ct_username shows "No IP adress" when keeper returns null. + */ + public function testColumnCtUsernameShowsNoIpWhenKeeperReturnsNull(): void + { + $_GET['page'] = 'ct_check_users'; + + $user = (object)[ + 'ID' => 1, + 'user_login' => 'noipuser', + 'user_email' => 'a@b.com', + ]; + $item = ['ct_username' => $user]; + + $result = $this->columnCtUsername->invoke($this->instance, $item); + + $this->assertStringContainsString('No IP adress', $result); + } +} diff --git a/tests/ApbctWP/FindSpam/ListTable/TestWcSpamOrdersListTable.php b/tests/ApbctWP/FindSpam/ListTable/TestWcSpamOrdersListTable.php index bf4e1e287..7a57708dd 100644 --- a/tests/ApbctWP/FindSpam/ListTable/TestWcSpamOrdersListTable.php +++ b/tests/ApbctWP/FindSpam/ListTable/TestWcSpamOrdersListTable.php @@ -28,7 +28,7 @@ class TestWcSpamOrdersListTable extends TestCase protected function setUp(): void { global $apbct; - + $reflection = new \ReflectionClass(WcSpamOrdersListTable::class); $this->instance = $reflection->newInstanceWithoutConstructor(); @@ -38,11 +38,8 @@ protected function setUp(): void $this->renderCustomerDetailsColumn = $reflection->getMethod('renderCustomerDetailsColumn'); $this->renderCustomerDetailsColumn->setAccessible(true); - // Set both instance property and global variable - $apbct = (object)[ - 'white_label' => true, - ]; - + $apbct->white_label = true; + // Use reflection to set the protected property $apbctProperty = $reflection->getProperty('apbct'); $apbctProperty->setAccessible(true); diff --git a/tests/ApbctWP/Firewall/FirewallBypassTest.php b/tests/ApbctWP/Firewall/FirewallBypassTest.php new file mode 100644 index 000000000..a775cef98 --- /dev/null +++ b/tests/ApbctWP/Firewall/FirewallBypassTest.php @@ -0,0 +1,460 @@ +wpdb = $wpdb; + + $reflection = new ReflectionClass(FirewallBypass::class); + $constants = $reflection->getConstants(); + $this->ready_token_key = $constants['GENERATION_TOKEN_TRANSIENT_KEY']; + $this->user_token_key = $constants['USER_TOKEN_TRANSIENT_KEY']; + $this->request_param = $constants['GENERATION_REQUEST_PARAM']; + $this->cookie_name = $constants['USER_COOKIE_NAME']; + + $this->original_rc_running = $apbct->rc_running; + $apbct->rc_running = false; + + $this->original_cookies_type = $apbct->data['cookies_type']; + + $this->resetEnvironment(); + reset_phpmailer_instance(); + } + + protected function tearDown(): void + { + global $apbct; + + $apbct->rc_running = $this->original_rc_running; + $apbct->data['cookies_type'] = $this->original_cookies_type; + + $this->resetEnvironment(); + reset_phpmailer_instance(); + FirewallBypass::$last_error = null; + + parent::tearDown(); + } + + /** + * Brings the request and the storage to the state of a clean anonymous visit. + * + * @return void + */ + private function resetEnvironment() + { + delete_transient($this->ready_token_key); + delete_transient($this->user_token_key); + + unset($_GET[$this->request_param], $_REQUEST[$this->request_param], $_COOKIE[$this->cookie_name]); + + $this->resetRequestCache(); + } + + /** + * The variable handlers cache the values, drop the cache between the request emulations. + * + * @return void + */ + private function resetRequestCache() + { + Request::getInstance()->variables = array(); + Get::getInstance()->variables = array(); + Cookie::getInstance()->variables = array(); + } + + /** + * Emulates the cookie sent by the browser. Null removes the cookie. + * + * @param string|array|null $value + * + * @return void + */ + private function emulateCookie($value = null) + { + if ( $value === null ) { + unset($_COOKIE[$this->cookie_name]); + } else { + $_COOKIE[$this->cookie_name] = $value; + } + + $this->resetRequestCache(); + } + + /** + * Emulates a request carrying the bypass parameter. + * + * @param string $token + * + * @return void + */ + private function emulateRequestWithToken($token) + { + $this->resetRequestCache(); + + $_GET[$this->request_param] = $token; + } + + /** + * Runs the generation remote call in the verified remote call context. + * + * @return bool + */ + private function runGenerationRemoteCall() + { + global $apbct; + + $apbct->rc_running = true; + $result = FirewallBypass::processGenerationRemoteCall(); + $apbct->rc_running = false; + + return $result; + } + + /** + * Extracts the one-time token from the last sent email. + * + * @return string + */ + private function getTokenFromSentEmail() + { + $mailer = tests_retrieve_phpmailer_instance(); + $sent = $mailer->get_sent(); + + $this->assertNotFalse($sent, 'The notification email has not been sent.'); + $this->assertRegExp('/' . preg_quote($this->request_param, '/') . '=[a-f0-9]{64}/', $sent->body); + + preg_match('/' . preg_quote($this->request_param, '/') . '=([a-f0-9]{64})/', $sent->body, $matches); + + return $matches[1]; + } + + /** + * The happy path of the generation: the token is stored and the link is emailed. + */ + public function testGenerationStoresTokenAndSendsEmail() + { + $this->assertTrue($this->runGenerationRemoteCall()); + + $stored_token = get_transient($this->ready_token_key); + $this->assertIsString($stored_token); + $this->assertSame($stored_token, $this->getTokenFromSentEmail(), 'The emailed token must match the stored one.'); + } + + /** + * The token must be a 256 bit random value and must differ from call to call. + */ + public function testGeneratedTokensAreStrongAndUnique() + { + $this->runGenerationRemoteCall(); + $first_token = get_transient($this->ready_token_key); + + $this->runGenerationRemoteCall(); + $second_token = get_transient($this->ready_token_key); + + $this->assertRegExp('/^[a-f0-9]{64}$/', $first_token); + $this->assertRegExp('/^[a-f0-9]{64}$/', $second_token); + $this->assertNotSame($first_token, $second_token); + } + + /** + * A token that could not be delivered must not stay usable. + */ + public function testTokenIsDroppedWhenEmailFails() + { + $fail_mail = static function () { + return false; + }; + + add_filter('pre_wp_mail', $fail_mail); + $result = $this->runGenerationRemoteCall(); + remove_filter('pre_wp_mail', $fail_mail); + + $this->assertFalse($result); + $this->assertFalse(get_transient($this->ready_token_key)); + $this->assertSame('Failed to send admin email.', FirewallBypass::$last_error); + } + + /** + * A regular request without the parameter must not consume the token nor grant anything. + */ + public function testRegularRequestDoesNotConsumeToken() + { + $this->runGenerationRemoteCall(); + $token = get_transient($this->ready_token_key); + + FirewallBypass::maybeSetUserToken(); + + $this->assertSame($token, get_transient($this->ready_token_key)); + $this->assertArrayNotHasKey($this->cookie_name, $_COOKIE); + $this->assertFalse(FirewallBypass::bypassByUserToken()); + } + + /** + * A wrong token must neither grant the bypass nor invalidate the pending one. + */ + public function testWrongTokenIsRejected() + { + $this->runGenerationRemoteCall(); + $token = get_transient($this->ready_token_key); + + $this->emulateRequestWithToken(str_repeat('0', 64)); + FirewallBypass::maybeSetUserToken(); + + $this->assertArrayNotHasKey($this->cookie_name, $_COOKIE); + $this->assertFalse(FirewallBypass::bypassByUserToken()); + $this->assertSame($token, get_transient($this->ready_token_key), 'A wrong guess must not burn the token.'); + } + + /** + * The valid link grants the bypass to the browser that has opened it. + */ + public function testValidTokenGrantsBypass() + { + $this->runGenerationRemoteCall(); + $token = get_transient($this->ready_token_key); + + $this->emulateRequestWithToken($token); + FirewallBypass::maybeSetUserToken(); + + $this->assertArrayHasKey($this->cookie_name, $_COOKIE); + $this->assertRegExp('/^[a-f0-9]{64}$/', $_COOKIE[$this->cookie_name]); + $this->assertTrue(FirewallBypass::bypassByUserToken(), 'The bypass must work within the activating request.'); + } + + /** + * The bypass must not depend on the plugin's cookie mode setting: reading and granting + * the secret must work identically whether the admin picked "native", "alternative" or + * "none" cookies mode. + * + * @dataProvider cookiesTypeProvider + */ + public function testValidTokenGrantsBypassRegardlessOfCookiesType($cookies_type) + { + global $apbct; + $apbct->data['cookies_type'] = $cookies_type; + + $this->runGenerationRemoteCall(); + $token = get_transient($this->ready_token_key); + + $this->emulateRequestWithToken($token); + FirewallBypass::maybeSetUserToken(); + + $this->assertArrayHasKey( + $this->cookie_name, + $_COOKIE, + "The bypass cookie must be set even when cookies_type is '{$cookies_type}'." + ); + $this->assertRegExp('/^[a-f0-9]{64}$/', $_COOKIE[$this->cookie_name]); + $this->assertTrue( + FirewallBypass::bypassByUserToken(), + "The bypass must work within the activating request when cookies_type is '{$cookies_type}'." + ); + } + + /** + * @return array> + */ + public function cookiesTypeProvider() + { + return array( + 'native' => array('native'), + 'alternative' => array('alternative'), + 'none' => array('none'), + ); + } + + /** + * The secret itself must never be persisted, only its hash. + */ + public function testOnlyHashOfSecretIsStored() + { + $this->runGenerationRemoteCall(); + $this->emulateRequestWithToken(get_transient($this->ready_token_key)); + FirewallBypass::maybeSetUserToken(); + + $secret = $_COOKIE[$this->cookie_name]; + $stored_hash = get_transient($this->user_token_key); + + $this->assertNotSame($secret, $stored_hash); + $this->assertSame(hash('sha256', $secret), $stored_hash); + } + + /** + * The link is single use, a replay must not grant a second bypass. + */ + public function testReadyTokenIsSingleUse() + { + $this->runGenerationRemoteCall(); + $token = get_transient($this->ready_token_key); + + $this->emulateRequestWithToken($token); + FirewallBypass::maybeSetUserToken(); + + $this->assertFalse(get_transient($this->ready_token_key), 'The token must be consumed on the first use.'); + + // An attacker replays the very same link from another browser. + $this->emulateCookie(null); + $this->emulateRequestWithToken($token); + FirewallBypass::maybeSetUserToken(); + + $this->assertArrayNotHasKey($this->cookie_name, $_COOKIE); + $this->assertFalse(FirewallBypass::bypassByUserToken()); + } + + /** + * A visitor without the secret must not be bypassed even while a bypass is active. + */ + public function testVisitorWithoutCookieIsDenied() + { + $this->runGenerationRemoteCall(); + $this->emulateRequestWithToken(get_transient($this->ready_token_key)); + FirewallBypass::maybeSetUserToken(); + + $this->emulateCookie(null); + + $this->assertFalse(FirewallBypass::bypassByUserToken()); + } + + /** + * Forged and malformed cookies must be rejected. + * + * @dataProvider invalidCookieProvider + * + * @param string $cookie_value + */ + public function testInvalidCookieIsDenied($cookie_value) + { + $this->runGenerationRemoteCall(); + $this->emulateRequestWithToken(get_transient($this->ready_token_key)); + FirewallBypass::maybeSetUserToken(); + + $this->emulateCookie($cookie_value); + + $this->assertFalse(FirewallBypass::bypassByUserToken()); + } + + /** + * @return array[] + */ + public function invalidCookieProvider() + { + return array( + 'well formed but wrong' => array(str_repeat('a', 64)), + 'empty' => array(''), + 'too short' => array('deadbeef'), + 'uppercase hex' => array(str_repeat('A', 64)), + 'path traversal' => array('../../../etc/passwd'), + 'sql injection' => array("' OR 1=1 -- "), + 'wildcard' => array('%'), + ); + } + + /** + * An array cookie must not break the check. + */ + public function testArrayCookieIsDenied() + { + $this->runGenerationRemoteCall(); + $this->emulateRequestWithToken(get_transient($this->ready_token_key)); + FirewallBypass::maybeSetUserToken(); + + $this->emulateCookie(array('injected')); + + $this->assertFalse(FirewallBypass::bypassByUserToken()); + } + + /** + * The bypass must stop working as soon as the server side record is gone. + */ + public function testBypassStopsWhenServerRecordExpires() + { + $this->runGenerationRemoteCall(); + $this->emulateRequestWithToken(get_transient($this->ready_token_key)); + FirewallBypass::maybeSetUserToken(); + + $this->assertTrue(FirewallBypass::bypassByUserToken()); + + // Emulates the expiration of the granted bypass. + delete_transient($this->user_token_key); + + $this->assertFalse(FirewallBypass::bypassByUserToken()); + } + + /** + * A newly granted bypass must revoke the previous one, only one bypass per site is allowed. + */ + public function testNewBypassRevokesThePreviousOne() + { + $this->runGenerationRemoteCall(); + $this->emulateRequestWithToken(get_transient($this->ready_token_key)); + FirewallBypass::maybeSetUserToken(); + $first_secret = $_COOKIE[$this->cookie_name]; + + $this->emulateCookie(null); + $this->runGenerationRemoteCall(); + $this->emulateRequestWithToken(get_transient($this->ready_token_key)); + FirewallBypass::maybeSetUserToken(); + $second_secret = $_COOKIE[$this->cookie_name]; + + $this->assertNotSame($first_secret, $second_secret); + + $this->emulateCookie($first_secret); + $this->assertFalse(FirewallBypass::bypassByUserToken(), 'The replaced secret must not work anymore.'); + + $this->emulateCookie($second_secret); + $this->assertTrue(FirewallBypass::bypassByUserToken()); + } +} diff --git a/tests/ApbctWP/TestRequirementsChecker.php b/tests/ApbctWP/TestRequirementsChecker.php index 30a560475..a03481c92 100644 --- a/tests/ApbctWP/TestRequirementsChecker.php +++ b/tests/ApbctWP/TestRequirementsChecker.php @@ -125,7 +125,7 @@ public function testCheckRequirementsWithOldPhpVersion() $warnings = $checker->checkRequirements(); $this->assertNotEmpty($warnings, 'Warnings should be returned for old PHP version.'); - $this->assertStringContainsString('PHP version must be at least 5.6', $warnings[0]); + $this->assertStringContainsString('PHP version must be at least 7.2', $warnings[0]); } public function testCheckRequirementsWithoutCurlSupport() diff --git a/tests/ApbctWP/TestWcHideRejectionMessageOption.php b/tests/ApbctWP/TestWcHideRejectionMessageOption.php new file mode 100644 index 000000000..b6798d235 --- /dev/null +++ b/tests/ApbctWP/TestWcHideRejectionMessageOption.php @@ -0,0 +1,116 @@ +apbct_backup = $apbct; + $apbct = new State('cleantalk', array('settings', 'data', 'errors', 'remote_calls', 'stats', 'fw_stats')); + } + + public function tearDown(): void + { + global $apbct; + + $apbct = $this->apbct_backup; + + parent::tearDown(); + } + + /** + * @return array + */ + private function getWcFields() + { + $fields = apbct_settings__set_fields(); + + $this->assertArrayHasKey('wc', $fields); + $this->assertArrayHasKey('fields', $fields['wc']); + + return $fields['wc']['fields']; + } + + public function testOptionIsEnabledByDefault() + { + $state = new State('cleantalk', array('settings', 'data', 'errors', 'remote_calls', 'stats', 'fw_stats')); + + $this->assertArrayHasKey(self::OPTION, $state->default_settings); + $this->assertSame(1, $state->default_settings[self::OPTION]); + } + + public function testStoreBlockedOrdersStaysEnabledByDefault() + { + $state = new State('cleantalk', array('settings', 'data', 'errors', 'remote_calls', 'stats', 'fw_stats')); + + $this->assertArrayHasKey(self::STORE_BLOCKED_ORDERS_OPTION, $state->default_settings); + $this->assertSame(1, $state->default_settings[self::STORE_BLOCKED_ORDERS_OPTION]); + } + + public function testOptionIsRegisteredInWooCommerceSettingsSection() + { + $wc_fields = $this->getWcFields(); + + $this->assertArrayHasKey(self::OPTION, $wc_fields); + $this->assertSame( + 'Hide rejection message from customers', + $wc_fields[self::OPTION]['title'] + ); + } + + public function testOptionHasOnAndOffChoicesOnly() + { + $wc_fields = $this->getWcFields(); + + $this->assertArrayHasKey('options', $wc_fields[self::OPTION]); + + $values = array_column($wc_fields[self::OPTION]['options'], 'val'); + + $this->assertSame(array(1, 0), $values); + } + + public function testOptionIsRenderedAsSubFieldOfTheCheckoutGroup() + { + $wc_fields = $this->getWcFields(); + + $this->assertSame( + 'apbct_settings-field_wrapper--sub-sub', + $wc_fields[self::OPTION]['class'] + ); + } + + public function testOptionIsPlacedRightAfterStoreBlockedOrders() + { + $wc_fields = $this->getWcFields(); + $keys = array_keys($wc_fields); + + $store_position = array_search(self::STORE_BLOCKED_ORDERS_OPTION, $keys, true); + $message_position = array_search(self::OPTION, $keys, true); + + $this->assertNotFalse($store_position); + $this->assertNotFalse($message_position); + $this->assertSame($store_position + 1, $message_position); + } +} diff --git a/tests/ApbctWP/TestWcSpamOrdersListTable.php b/tests/ApbctWP/TestWcSpamOrdersListTable.php index efdeadda5..605ac4030 100644 --- a/tests/ApbctWP/TestWcSpamOrdersListTable.php +++ b/tests/ApbctWP/TestWcSpamOrdersListTable.php @@ -182,4 +182,91 @@ public function testRenderCustomerDetailsColumnEmptyValues() $expectedCount = substr_count($result, ''); $this->assertEquals(3, $expectedCount); } + + /** + * Resets the memory of the request variables handler so that $_POST is read again. + * + * @return void + */ + private function resetPostMemory() + { + \Cleantalk\ApbctWP\Variables\Post::getInstance()->variables = array(); + } + + /** + * Test the action parameters are named so that the HPOS page controller ignores them. + */ + public function testActionParamsAreNamespaced() + { + $this->assertEquals('apbct_bulk_action', WcSpamOrdersListTable::BULK_ACTION_PARAM); + $this->assertEquals('apbct_row_action', WcSpamOrdersListTable::ROW_ACTION_PARAM); + $this->assertEquals('apbct_row_nonce', WcSpamOrdersListTable::ROW_NONCE_PARAM); + + foreach ( array('action', '_wpnonce', '_wp_http_referer') as $reserved ) { + $this->assertNotEquals($reserved, WcSpamOrdersListTable::BULK_ACTION_PARAM); + $this->assertNotEquals($reserved, WcSpamOrdersListTable::ROW_ACTION_PARAM); + $this->assertNotEquals($reserved, WcSpamOrdersListTable::ROW_NONCE_PARAM); + } + } + + /** + * Test current_action reads the select of the top tablenav. + */ + public function testCurrentActionReadsTopSelect() + { + $_POST = array(WcSpamOrdersListTable::BULK_ACTION_PARAM => 'delete'); + $this->resetPostMemory(); + + $this->assertEquals('delete', $this->instance->current_action()); + } + + /** + * Test current_action falls back to the select of the bottom tablenav. + */ + public function testCurrentActionReadsBottomSelect() + { + $_POST = array( + WcSpamOrdersListTable::BULK_ACTION_PARAM => '-1', + WcSpamOrdersListTable::BULK_ACTION_PARAM . '2' => 'delete', + ); + $this->resetPostMemory(); + + $this->assertEquals('delete', $this->instance->current_action()); + } + + /** + * Test current_action ignores the placeholder option of the selects. + */ + public function testCurrentActionIgnoresPlaceholder() + { + $_POST = array( + WcSpamOrdersListTable::BULK_ACTION_PARAM => '-1', + WcSpamOrdersListTable::BULK_ACTION_PARAM . '2' => '-1', + ); + $this->resetPostMemory(); + + $this->assertFalse($this->instance->current_action()); + } + + /** + * Test current_action reports no action when the selects were not submitted. + */ + public function testCurrentActionWithoutSubmission() + { + $_POST = array(); + $this->resetPostMemory(); + + $this->assertFalse($this->instance->current_action()); + } + + /** + * Test current_action stays blind to the 'action' parameter of the WooCommerce orders screen. + */ + public function testCurrentActionIgnoresWooCommerceActionParam() + { + $_POST = array('action' => 'delete', 'action2' => 'delete'); + $this->resetPostMemory(); + + $this->assertFalse($this->instance->current_action()); + } } diff --git a/tests/Common/AbstractUpdateChangelogNoticeTest.php b/tests/Common/AbstractUpdateChangelogNoticeTest.php new file mode 100644 index 000000000..5cf9288c4 --- /dev/null +++ b/tests/Common/AbstractUpdateChangelogNoticeTest.php @@ -0,0 +1,134 @@ +' . $version . '' . $changelog_html . ''; + } + + protected function escapeChangelogHtml($html) + { + // No WP kses whitelist here on purpose: keeps the test focused on + // this class's own logic (normalization / disc style injection). + return $html; + } +} + +class AbstractUpdateChangelogNoticeTest extends TestCase +{ + /** + * @return UpdateChangelogNoticeStub + */ + private function makeInstance() + { + return new UpdateChangelogNoticeStub(); + } + + /** + * @return \ReflectionMethod + */ + private function getMethod($name) + { + $method = new \ReflectionMethod(UpdateChangelogNoticeStub::class, $name); + $method->setAccessible(true); + + return $method; + } + + public function testNormalizeChangelogBodyConvertsFlatBrSeparatedLinesToList() + { + $body = "\nNew. Feature added.
        \nFix. Bug fixed.
        \nUpd. Something updated."; + + $result = $this->getMethod('normalizeChangelogBody')->invoke($this->makeInstance(), $body); + + $this->assertSame( + '
        • New. Feature added.
        • Fix. Bug fixed.
        • Upd. Something updated.
        ', + $result + ); + } + + public function testNormalizeChangelogBodyLeavesReadyMadeListUntouched() + { + $body = "\n
          \n
        • Fix. Code. Re-minify JS.
        • \n
        • Upd. Scan. Improve UX.
        • \n
        \n"; + + $result = $this->getMethod('normalizeChangelogBody')->invoke($this->makeInstance(), $body); + + $this->assertSame($body, $result); + } + + public function testNormalizeChangelogBodyReturnsEmptyStringForBlankInput() + { + $result = $this->getMethod('normalizeChangelogBody')->invoke($this->makeInstance(), " \n "); + + $this->assertSame('', $result); + } + + public function testForceDiscListStyleAddsStyleWhenMissing() + { + $result = $this->getMethod('forceDiscListStyle')->invoke($this->makeInstance(), '
        • a
        '); + + $this->assertSame('
        • a
        ', $result); + } + + public function testForceDiscListStyleMergesWithExistingStyle() + { + $result = $this->getMethod('forceDiscListStyle')->invoke( + $this->makeInstance(), + '
        • a
        ' + ); + + $this->assertSame( + '
        • a
        ', + $result + ); + } + + public function testForceDiscListStyleIgnoresContentWithoutUl() + { + $html = '

        no lists here

        '; + + $result = $this->getMethod('forceDiscListStyle')->invoke($this->makeInstance(), $html); + + $this->assertSame($html, $result); + } + + public function testInjectNoticeReturnsRowUnchangedWhenNoUpdateMessageFound() + { + $row = '
        '; + + $result = $this->getMethod('injectNotice')->invoke( + $this->makeInstance(), + $row, + 'cleantalk-spam-protect/cleantalk.php' + ); + + $this->assertSame($row, $result); + } + + public function testInjectNoticeReturnsRowUnchangedWhenNoUpdateIsOffered() + { + // No update_plugins transient is set, so getOfferedVersion() yields ''. + $row = '

        Update available.

        '; + + $result = $this->getMethod('injectNotice')->invoke( + $this->makeInstance(), + $row, + 'cleantalk-spam-protect/cleantalk.php' + ); + + $this->assertSame($row, $result); + } +} diff --git a/tests/Inc/TestCleantalkUpdater.php b/tests/Inc/TestCleantalkUpdater.php index c0b3d2280..a23357e02 100644 --- a/tests/Inc/TestCleantalkUpdater.php +++ b/tests/Inc/TestCleantalkUpdater.php @@ -16,4 +16,79 @@ public function testApbctUpdateTo_6_76_0() // Assert $this->assertEquals('1', $apbct_rebuilt->data['bot_detector_enabled']); } + + /** + * Users who already stored blocked orders have to keep the legacy checkout behavior, + * so the rejection message stays visible for them after the update. + */ + public function testApbctUpdateTo_6_89_0_EnablesRejectionMessageWhenBlockedOrdersAreStored() + { + // Arrange + global $apbct; + $apbct->settings['data__wc_store_blocked_orders'] = 1; + $apbct->settings['forms__wc_hide_rejection_message'] = 1; + $apbct->saveSettings(); + + // Act + apbct_update_to_6_89_0(); + $apbct_rebuilt = new State('cleantalk', array('settings', 'data', 'errors', 'remote_calls', 'stats', 'fw_stats')); + + // Assert + $this->assertEquals(0, $apbct_rebuilt->settings['forms__wc_hide_rejection_message']); + } + + /** + * Sites without the stored blocked orders get the new silent behavior, so the option stays off. + */ + public function testApbctUpdateTo_6_89_0_KeepsRejectionMessageOffWhenBlockedOrdersAreNotStored() + { + // Arrange + global $apbct; + $apbct->settings['data__wc_store_blocked_orders'] = 0; + $apbct->settings['forms__wc_hide_rejection_message'] = 0; + $apbct->saveSettings(); + + // Act + apbct_update_to_6_89_0(); + $apbct_rebuilt = new State('cleantalk', array('settings', 'data', 'errors', 'remote_calls', 'stats', 'fw_stats')); + + // Assert + $this->assertEquals(0, $apbct_rebuilt->settings['forms__wc_hide_rejection_message']); + } + + /** + * The migration must not be triggered by an empty or missing setting value. + */ + public function testApbctUpdateTo_6_89_0_DoesNothingWhenBlockedOrdersSettingIsMissing() + { + // Arrange + global $apbct; + unset($apbct->settings['data__wc_store_blocked_orders']); + $apbct->settings['forms__wc_hide_rejection_message'] = 1; + $apbct->saveSettings(); + + // Act + apbct_update_to_6_89_0(); + $apbct_rebuilt = new State('cleantalk', array('settings', 'data', 'errors', 'remote_calls', 'stats', 'fw_stats')); + + // Assert + $this->assertEquals(1, $apbct_rebuilt->settings['forms__wc_hide_rejection_message']); + } + + /** + * The migration is registered under a version that the updater loop actually reaches. + */ + public function testApbctUpdateTo_6_89_0_IsReachableByTheUpdaterLoop() + { + $this->assertTrue(function_exists('apbct_update_to_6_89_0')); + + $version_arr = apbct_version_standardization('6.89.0'); + + $this->assertSame(6, $version_arr[0]); + $this->assertSame(89, $version_arr[1]); + $this->assertSame(0, $version_arr[2]); + + // The loop iterates minor versions up to 300, so 6.89.0 is inside the scanned range + $this->assertLessThanOrEqual(300, $version_arr[1]); + } }