oont-contents/plugins/webp-converter-for-media/assets/build/js/scripts.js
2025-04-06 08:34:48 +02:00

1 line
No EOL
39 KiB
JavaScript

!function(){var t,e={12:function(t){"use strict";t.exports=function(t,e){return function(){for(var r=new Array(arguments.length),s=0;s<r.length;s++)r[s]=arguments[s];return t.apply(e,r)}}},15:function(t,e,r){"use strict";var s=r(516),n=r(12),i=r(155),o=r(343);function a(t){var e=new i(t),r=n(i.prototype.request,e);return s.extend(r,i.prototype,e),s.extend(r,e),r}var c=a(r(987));c.Axios=i,c.create=function(t){return a(o(c.defaults,t))},c.Cancel=r(928),c.CancelToken=r(191),c.isCancel=r(864),c.all=function(t){return Promise.all(t)},c.spread=r(980),c.isAxiosError=r(19),t.exports=c,t.exports.default=c},18:function(t,e,r){"use strict";var s=r(516);t.exports=function(t,e){s.forEach(t,(function(r,s){s!==e&&s.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[s])}))}},19:function(t){"use strict";t.exports=function(t){return"object"==typeof t&&!0===t.isAxiosError}},106:function(t,e,r){"use strict";var s=r(516);function n(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(t,e,r){if(!e)return t;var i;if(r)i=r(e);else if(s.isURLSearchParams(e))i=e.toString();else{var o=[];s.forEach(e,(function(t,e){null!=t&&(s.isArray(t)?e+="[]":t=[t],s.forEach(t,(function(t){s.isDate(t)?t=t.toISOString():s.isObject(t)&&(t=JSON.stringify(t)),o.push(n(e)+"="+n(t))})))})),i=o.join("&")}if(i){var a=t.indexOf("#");-1!==a&&(t=t.slice(0,a)),t+=(-1===t.indexOf("?")?"?":"&")+i}return t}},137:function(t){"use strict";t.exports=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}},155:function(t,e,r){"use strict";var s=r(516),n=r(106),i=r(471),o=r(490),a=r(343),c=r(841),u=c.validators;function h(t){this.defaults=t,this.interceptors={request:new i,response:new i}}h.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=t.transitional;void 0!==e&&c.assertOptions(e,{silentJSONParsing:u.transitional(u.boolean,"1.0.0"),forcedJSONParsing:u.transitional(u.boolean,"1.0.0"),clarifyTimeoutError:u.transitional(u.boolean,"1.0.0")},!1);var r=[],s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var n,i=[];if(this.interceptors.response.forEach((function(t){i.push(t.fulfilled,t.rejected)})),!s){var h=[o,void 0];for(Array.prototype.unshift.apply(h,r),h=h.concat(i),n=Promise.resolve(t);h.length;)n=n.then(h.shift(),h.shift());return n}for(var l=t;r.length;){var p=r.shift(),d=r.shift();try{l=p(l)}catch(t){d(t);break}}try{n=o(l)}catch(t){return Promise.reject(t)}for(;i.length;)n=n.then(i.shift(),i.shift());return n},h.prototype.getUri=function(t){return t=a(this.defaults,t),n(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},s.forEach(["delete","get","head","options"],(function(t){h.prototype[t]=function(e,r){return this.request(a(r||{},{method:t,url:e,data:(r||{}).data}))}})),s.forEach(["post","put","patch"],(function(t){h.prototype[t]=function(e,r,s){return this.request(a(s||{},{method:t,url:e,data:r}))}})),t.exports=h},191:function(t,e,r){"use strict";var s=r(928);function n(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var r=this;t((function(t){r.reason||(r.reason=new s(t),e(r.reason))}))}n.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},n.source=function(){var t;return{token:new n((function(e){t=e})),cancel:t}},t.exports=n},198:function(t){"use strict";t.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')},202:function(t,e,r){"use strict";var s=r(516);t.exports=s.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(t){var s=t;return e&&(r.setAttribute("href",s),s=r.href),r.setAttribute("href",s),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return t=n(window.location.href),function(e){var r=s.isString(e)?n(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0}},343:function(t,e,r){"use strict";var s=r(516);t.exports=function(t,e){e=e||{};var r={},n=["url","method","data"],i=["headers","auth","proxy","params"],o=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function c(t,e){return s.isPlainObject(t)&&s.isPlainObject(e)?s.merge(t,e):s.isPlainObject(e)?s.merge({},e):s.isArray(e)?e.slice():e}function u(n){s.isUndefined(e[n])?s.isUndefined(t[n])||(r[n]=c(void 0,t[n])):r[n]=c(t[n],e[n])}s.forEach(n,(function(t){s.isUndefined(e[t])||(r[t]=c(void 0,e[t]))})),s.forEach(i,u),s.forEach(o,(function(n){s.isUndefined(e[n])?s.isUndefined(t[n])||(r[n]=c(void 0,t[n])):r[n]=c(void 0,e[n])})),s.forEach(a,(function(s){s in e?r[s]=c(t[s],e[s]):s in t&&(r[s]=c(void 0,t[s]))}));var h=n.concat(i).concat(o).concat(a),l=Object.keys(t).concat(Object.keys(e)).filter((function(t){return-1===h.indexOf(t)}));return s.forEach(l,u),r}},449:function(t){"use strict";t.exports=function(t,e,r,s,n){return t.config=e,r&&(t.code=r),t.request=s,t.response=n,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},t}},461:function(t,e,r){"use strict";var s=r(505),n=r.n(s);class i{constructor(t){this.notice=t,this.set_vars()&&this.set_events()}set_vars(){return this.settings={ajax_action:this.notice.getAttribute("data-notice-action"),ajax_url:this.notice.getAttribute("data-notice-url"),button_close_class:".notice-dismiss",button_hide_class:"[data-permanently]"},this.events={click_on_close:this.click_on_close.bind(this)},!0}set_events(){this.notice.addEventListener("click",this.events.click_on_close)}click_on_close(t){const{button_close_class:e,button_hide_class:r}=this.settings;t.target.matches(e)?(this.notice.removeEventListener("click",this.events.click_on_close),this.hide_notice(!1)):t.target.matches(r)&&(this.notice.removeEventListener("click",this.events.click_on_close),this.hide_notice(!0))}hide_notice(t){const{button_close_class:e}=this.settings;this.send_request(t),t&&this.notice.querySelector(e).click()}send_request(t){const{ajax_url:e}=this.settings;n()({method:"POST",url:e,data:this.get_data_for_request(t)})}get_data_for_request(t){const{ajax_action:e}=this.settings,r=new FormData;return r.append("action",e),r.append("is_permanently",t?1:0),r}}class o{constructor(){const t=document.querySelectorAll('.notice[data-notice="webp-converter-for-media"][data-notice-action]'),{length:e}=t;for(let r=0;r<e;r++)new i(t[r])}}class a{constructor(){this.set_vars()&&this.set_events()}set_vars(){return this.settings={api_path_attr:"data-api-path",wrapper_id:"%s-wrapper",spinner_id:"%s-spinner",spinner_active:"is-active"},!0}set_events(){window.webpcConvertAttachment=this.start_conversion.bind(this)}start_conversion(t,e){const r=t.getAttribute("id"),s=document.getElementById(this.settings.wrapper_id.replace("%s",r)),n=document.getElementById(this.settings.spinner_id.replace("%s",r)),i=t.getAttribute(this.settings.api_path_attr).split("|")[0],o=t.getAttribute(this.settings.api_path_attr).split("|")[1];t.setAttribute("disabled","disabled"),n.classList.add(this.settings.spinner_active),this.send_request(i,o,e,t.value,s)}send_request(t,e,r,s,i){n()({method:"POST",url:t,data:{post_id:r,quality_level:s},headers:{"X-WP-Nonce":e}}).then((t=>{t.data&&t.data.output_html&&(i.innerHTML=t.data.output_html)})).catch((t=>{}))}}class c{constructor(){this.status=this.set_vars()}set_vars(){if(this.counter_webp=document.querySelector('[data-counter="webp"]'),this.counter_avif=document.querySelector('[data-counter="avif"]'),this.counter_webp&&this.counter_avif)return this.counter_webp_percent=this.counter_webp.querySelector("[data-counter-percent]"),this.counter_webp_images=this.counter_webp.querySelector("[data-counter-left]"),this.counter_webp_loader=this.counter_webp.querySelector("[data-counter-loader]"),this.counter_avif_percent=this.counter_avif.querySelector("[data-counter-percent]"),this.counter_avif_images=this.counter_avif.querySelector("[data-counter-left]"),this.counter_avif_loader=this.counter_avif.querySelector("[data-counter-loader]"),this.data={webp_converted:0,webp_unconverted:0,webp_all:0,avif_converted:0,avif_unconverted:0,avif_all:0},this.atts={counter_percent:"data-percent"},!0}set_files_webp(t,e){this.status&&(this.data.webp_converted+=t,this.data.webp_unconverted=e-t,this.data.webp_all=e||this.data.webp_all,this.refresh_stats())}reset_files_webp(){this.status&&(this.data.webp_converted=0,this.data.webp_unconverted=this.data.webp_all,this.refresh_stats())}set_files_avif(t,e){this.status&&(this.data.avif_converted+=t,this.data.avif_unconverted=e-t,this.data.avif_all=e,this.refresh_stats())}set_error(){this.counter_webp_loader.setAttribute("hidden","hidden"),this.counter_avif_loader.setAttribute("hidden","hidden")}reset_files_avif(){this.status&&(this.data.avif_converted=0,this.data.avif_unconverted=this.data.avif_all,this.refresh_stats())}add_files_webp(t){this.status&&(this.data.webp_converted+=t,this.data.webp_unconverted-=t,this.refresh_stats())}add_files_avif(t){this.status&&(this.data.avif_converted+=t,this.data.avif_unconverted-=t,this.refresh_stats())}refresh_stats(){const{webp_converted:t,webp_unconverted:e,webp_all:r,avif_converted:s,avif_unconverted:n,avif_all:i}=this.data,{counter_percent:o}=this.atts,a=r>0?Math.floor(t/r*100):0,c=i>0?Math.floor(s/i*100):0;this.counter_webp.setAttribute(o,a),this.counter_webp_percent.innerText=a,this.counter_webp_images.innerText=Math.max(e,0).toString().replace(/\B(?=(\d{3})+(?!\d))/g," "),this.counter_avif.setAttribute(o,c),this.counter_avif_percent.innerText=c,this.counter_avif_images.innerText=Math.max(n,0).toString().replace(/\B(?=(\d{3})+(?!\d))/g," ")}}class u{constructor(){this.set_vars()&&this.set_events()}set_vars(){return this.triggers=document.querySelectorAll("[data-toggle-trigger]"),!!this.triggers.length&&(this.outputs=document.querySelectorAll("[data-toggle-output-values]"),!0)}set_events(){const{length:t}=this.triggers;for(let e=0;e<t;e++)this.triggers[e].addEventListener("change",this.toggle_output.bind(this))}toggle_output(t){const e=t.currentTarget.getAttribute("name"),r="checkbox"===t.currentTarget.getAttribute("type")?this.get_checkbox_value(e):this.get_radio_value(e),{length:s}=this.outputs;for(let t=0;t<s;t++)if(this.outputs[t].getAttribute("data-toggle-output")===e){const e=this.outputs[t].getAttribute("data-toggle-output-attr");this.validate_output(this.outputs[t],r)?this.outputs[t].removeAttribute(e):this.outputs[t].setAttribute(e,e)}}get_checkbox_value(t){const e=[],{length:r}=this.triggers;for(let s=0;s<r;s++)this.triggers[s].getAttribute("name")===t&&this.triggers[s].checked&&e.push(this.triggers[s].getAttribute("value"));return e}get_radio_value(t){const{length:e}=this.triggers;for(let r=0;r<e;r++)if(this.triggers[r].getAttribute("name")===t&&this.triggers[r].checked)return[this.triggers[r].getAttribute("value")];return[]}validate_output(t,e){const r=t.getAttribute("data-toggle-output-values").split(";"),{length:s}=e;for(let t=0;t<s;t++)if(r.indexOf(e[t])>=0)return!0;return!1}}class h{constructor(t){this.conversion_stats_manager=t,this.set_vars()&&this.set_events()}set_vars(){if(this.section=document.querySelector(".webpcLoader"),this.section&&(this.wrapper_status=this.section.querySelector("[data-status]"),this.wrapper_status))return this.progress=this.wrapper_status.querySelector("[data-status-progress]"),this.progress_size=this.section.querySelector("[data-status-count-size]"),this.progress_success=this.section.querySelector("[data-status-count-success]"),this.progress_failed=this.section.querySelector("[data-status-count-error]"),this.wrapper_errors=this.section.querySelector("[data-errors]"),this.errors_output=this.wrapper_errors.querySelector("[data-errors-output]"),this.wrapper_success=this.section.querySelector("[data-success]"),this.option_force=this.section.querySelector('input[name="regenerate_force"]'),this.submit_button=this.section.querySelector("[data-submit]"),this.data={count:0,max:0,items:[],size:{before:0,after:0},files_counter:{all:0,converted:0},errors:0},this.settings={is_disabled:!1,ajax:{url_paths:this.section.getAttribute("data-api-paths").split("|")[0],url_paths_nonce:this.section.getAttribute("data-api-paths").split("|")[1],url_regenerate:this.section.getAttribute("data-api-regenerate").split("|")[0],url_regenerate_nonce:this.section.getAttribute("data-api-regenerate").split("|")[1],error_message:this.section.getAttribute("data-api-error-message")},units:["kB","MB","GB"],max_errors:1e3,connection_timeout:6e4},this.atts={progress:"data-percent",counter_percent:"data-percent"},this.classes={progress_error:"webpcLoader__statusProgress--error",button_disabled:"webpcLoader__button--disabled",error_message:"webpcLoader__errorsContentError"},!0}set_events(){this.submit_button.addEventListener("click",this.init_regeneration.bind(this))}init_regeneration(t){t.preventDefault(),this.settings.is_disabled||(this.settings.is_disabled=!0,this.submit_button.classList.add(this.classes.button_disabled),this.option_force.setAttribute("disabled","disabled"),this.wrapper_status.removeAttribute("hidden"),this.send_request_for_paths())}send_request_for_paths(){const{url_paths:t,url_paths_nonce:e}=this.settings.ajax;n()({method:"POST",url:t,data:{regenerate_force:this.option_force.checked?1:0},headers:{"X-WP-Nonce":e}}).then((t=>{const e=this.parse_files_paths(t.data);this.data.items=e,this.data.max=e.length,this.option_force.checked&&(this.conversion_stats_manager.reset_files_webp(),this.conversion_stats_manager.reset_files_avif()),this.regenerate_next_images()})).catch((t=>{this.catch_request_error(t,!0)}))}parse_files_paths(t){const e=[];for(const r in t){const{length:s}=t[r].files;for(let n=0;n<s;n++){const s=[];for(let e=0;e<t[r].files[n].length;e++)s.push(t[r].path+"/"+t[r].files[n][e]);e.push(s)}}return e}regenerate_next_images(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(0===this.data.max&&this.update_progress(),this.data.count>=this.data.max)return;t>=3?t=0:t>0&&this.data.count--;const e=this.data.items[this.data.count];this.data.count++,this.send_request_for_regeneration(e,t)}send_request_for_regeneration(t,e){const{url_regenerate:r,url_regenerate_nonce:s}=this.settings.ajax;n()({method:"POST",url:r,data:{regenerate_force:this.option_force.checked?1:0,paths:t},headers:{"X-WP-Nonce":s},timeout:this.settings.connection_timeout}).then((t=>{const{is_fatal_error:e}=t.data;this.update_errors(t.data.errors,e),e||(this.update_size(t.data),this.update_files_count(t.data),this.update_progress(),this.regenerate_next_images())})).catch((r=>{r.response?(this.catch_request_error(r,!1,t),setTimeout(this.regenerate_next_images.bind(this),1e3)):setTimeout(this.regenerate_next_images.bind(this,e+1),1e3)}))}update_errors(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.data.errors>this.settings.max_errors&&(this.data.errors=0,this.errors_output.innerHTML="");const r=this.get_date();for(let s=0;s<t.length;s++)this.print_error_message(t[s],e,!1,r),this.data.errors++;e&&this.set_fatal_error()}get_date(){const t=new Date;return`${("0"+t.getHours()).substr(-2)}:${("0"+t.getMinutes()).substr(-2)}:${("0"+t.getSeconds()).substr(-2)}`}set_fatal_error(){this.progress.classList.add(this.classes.progress_error)}catch_request_error(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e&&(this.print_error_message([this.settings.ajax.error_message],!0,!1),this.set_fatal_error());const s=null!==r?`["${r.join('", "')}"]`:"";this.print_error_message(`${t.response.status} - ${t.response.statusText} (${t.response.config.url}) ${s}`,!0,!0)}print_error_message(t,e,r){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const n=document.createElement("p"),i=s||this.get_date();if(r){const e=document.createElement("pre");e.innerText=t,n.appendChild(e)}else n.innerHTML=`<strong>${i}</strong> - ${t}`;e&&n.classList.add(this.classes.error_message),this.wrapper_errors.removeAttribute("hidden"),this.errors_output.appendChild(n)}update_size(t){const{size:e}=this.data;e.before+=t.size.before,e.after+=t.size.after;let r=e.before-e.after;if(r<0&&(r=0),0===r)return;let s=Math.round(100*(1-e.after/e.before));s<0&&(s=0);let n=-1;do{n++,r/=1024}while(r>1024);const i=r.toFixed(2),o=this.settings.units[n];this.progress_size.innerHTML=`${i} ${o} (${s}%)`}update_files_count(t){const{files_counter:e}=this.data,{files:r}=t;this.conversion_stats_manager.add_files_webp(r.webp_available),this.conversion_stats_manager.add_files_avif(r.avif_available),e.converted+=r.webp_converted+r.avif_converted,e.all+=r.webp_available+r.avif_available,this.progress_success.innerText=e.converted.toString().replace(/\B(?=(\d{3})+(?!\d))/g," "),this.progress_failed.innerText=(e.all-e.converted).toString().replace(/\B(?=(\d{3})+(?!\d))/g," ")}update_progress(){let t=this.data.max>0?Math.floor(this.data.count/this.data.max*100):100;t>100&&(t=100),100===t&&this.wrapper_success.removeAttribute("hidden"),this.progress.setAttribute(this.atts.progress,t.toString())}}class l{constructor(t,e,r){this.conversion_stats_manager=t,this.images_tree_generator=e,this.plans_button_generator=r,this.set_vars()&&this.send_request()}set_vars(){if(this.section=document.querySelector("[data-api-stats]"),this.section)return this.error_output=this.section.querySelector("[data-api-stats-error]"),this.settings={ajax_url:this.section.getAttribute("data-api-stats").split("|")[0],ajax_nonce:this.section.getAttribute("data-api-stats").split("|")[1]},!0}send_request(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t>=3)return this.conversion_stats_manager.set_error(),this.images_tree_generator.set_error(),void this.plans_button_generator.set_error();const e=new Date;n()({method:"GET",url:this.settings.ajax_url,headers:{"X-WP-Nonce":this.settings.ajax_nonce}}).then((r=>{if(r.data){const t=r.data.value_webp_all||0,e=r.data.value_webp_converted||0,s=r.data.value_avif_all||0,n=r.data.value_avif_converted||0;this.conversion_stats_manager.set_files_webp(e,t),this.conversion_stats_manager.set_files_avif(n,s),this.images_tree_generator.generate_tree(r.data.tree),this.plans_button_generator.show_button(t-e,s-n)}else this.send_request(t+1),this.show_request_error(e,r)})).catch((r=>{this.send_request(t+1),r.response&&this.show_request_error(e,r.response)}))}show_request_error(t,e){const r=(new Date-t)/1e3,s=e.status,n=JSON.stringify(e.data);this.error_output.innerText=`HTTP Error ${s} (${r}s): ${n}`,this.error_output.removeAttribute("hidden")}}class p{constructor(){this.status=this.set_vars()}set_vars(){if(this.section=document.querySelector("[data-tree]"),this.section)return this.loader=this.section.querySelector("[data-tree-loader]"),this.toggle_button=document.querySelector("[data-tree-toggle-button]"),this.settings={max_items:1e3,message_files_count:this.section.getAttribute("data-tree-files-count"),message_input_tooltip:this.section.getAttribute("data-tree-input-tooltip")},!0}generate_tree(t){if(!this.status)return;this.loader=null,this.section.innerHTML=this.draw_tree(t);const e=this.section.querySelectorAll(".webpcTree__itemCheckbox");for(let t=0;t<e.length;t++)e[t].addEventListener("change",this.hide_child_items.bind(this));this.toggle_button&&(this.toggle_button.removeAttribute("hidden"),this.toggle_button.addEventListener("click",this.toggle_all_items.bind(this)))}set_error(){this.loader&&this.loader.setAttribute("hidden","hidden")}draw_tree(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"tree",s="";const{length:n}=t;if(!n)return s;0===e&&(s+='<ul class="webpcTree__items">');for(let i=0;i<n;i++){const n=`${r}-${t[i].name}`.replace(/\s/g,""),o=t[i].files.length,a=t[i].items?t[i].items.length:0;s+='<li class="webpcTree__item">',s+=`<input type="checkbox" id="${n}" class="webpcTree__itemCheckbox ${a?"webpcTree__itemCheckbox--hasItems":""}">`,s+=`<label for="${n}" class="webpcTree__itemLabel" title="${this.settings.message_input_tooltip}">`,s+=`${t[i].name} <strong>(${t[i].count.toString().replace(/\B(?=(\d{3})+(?!\d))/g," ")})</strong>`,s+="</label>",s+='<ul class="webpcTree__items">',a&&(s+=this.draw_tree(t[i].items,e+1,n));for(let e=0;e<o&&e!==this.settings.max_items;e++)s+='<li class="webpcTree__item">',s+=`<span class="webpcTree__itemName">${t[i].files[e]}</span>`,s+="</li>";if(o>this.settings.max_items){const t=(o-this.settings.max_items).toString().replace(/\B(?=(\d{3})+(?!\d))/g," ");s+='<li class="webpcTree__item">',s+=`<span class="webpcTree__itemName webpcTree__itemName--text">${this.settings.message_files_count.replace("%s",t)}</span>`,s+="</li>"}s+="</ul>",s+="</li>"}return 0===e&&(s+="</ul>"),s}hide_child_items(t){if(t.currentTarget.checked)return;const e=t.currentTarget.parentNode.querySelectorAll(".webpcTree__itemCheckbox");for(let t=0;t<e.length;t++)e[t].checked=!1}toggle_all_items(t){t.preventDefault();if(this.section.querySelector(".webpcTree__itemCheckbox--hasItems:checked")){const t=this.section.querySelectorAll(".webpcTree__itemCheckbox");for(let e=0;e<t.length;e++)t[e].checked=!1}else{const t=this.section.querySelectorAll(".webpcTree__itemCheckbox--hasItems");for(let e=0;e<t.length;e++)t[e].checked=!0}}}class d{constructor(t){this.section=t,this.set_vars()&&this.set_events()}set_vars(){return this.button=this.section.querySelector("[data-plans-button]"),this.loader=this.section.querySelector("[data-plans-loader]"),this.settings={button_url:this.button.getAttribute("href")},!0}set_events(){}show_button(t,e){const r=this.settings.button_url.replace("webp=0",`webp=${t}`).replace("avif=0",`avif=${e}`);this.button.setAttribute("href",r),this.loader&&(this.button.removeAttribute("hidden"),this.loader.setAttribute("hidden","hidden"))}set_error(){this.loader&&(this.button.removeAttribute("hidden"),this.loader.setAttribute("hidden","hidden"))}}class f{constructor(){const t=document.querySelectorAll(".webpcPage [data-plans]");this.instances=[];for(let e=0;e<t.length;e++)this.instances.push(new d(t[e]))}show_button(t,e){for(let r=0;r<this.instances.length;r++)this.instances[r].show_button(t,e)}set_error(){for(let t=0;t<this.instances.length;t++)this.instances[t].set_error()}}class _{constructor(t){this.popup_wrapper=t,this.set_vars()&&this.set_events()}set_vars(){return this.popup_id=this.popup_wrapper.getAttribute("data-popup"),!!this.popup_id&&(this.button=document.querySelector('[data-open-popup="'+this.popup_id+'"]'),!!this.button&&(this.settings={content_page_attr:"data-popup-page",button_page_attr:"data-popup-button-page"},this.close_buttons=this.popup_wrapper.querySelectorAll("[data-popup-close]"),this.content_pages=this.popup_wrapper.querySelectorAll(`[${this.settings.content_page_attr}]`),this.page_buttons=this.popup_wrapper.querySelectorAll(`[${this.settings.button_page_attr}]`),this.data={is_button_clicked:!1},this.events={open_popup:this.open_popup.bind(this)},!0))}set_events(){this.button.addEventListener("click",this.events.open_popup);for(let t=0;t<this.close_buttons.length;t++)this.close_buttons[t].addEventListener("click",this.close_popup.bind(this));for(let t=0;t<this.page_buttons.length;t++)this.page_buttons[t].addEventListener("click",this.set_content_page.bind(this))}open_popup(t){t.preventDefault(),t.stopImmediatePropagation(),this.button.removeEventListener("click",this.events.open_popup),this.popup_wrapper.removeAttribute("hidden")}close_popup(){this.popup_wrapper.setAttribute("hidden","hidden"),setTimeout((()=>{this.button.click()}),0)}set_content_page(t){for(let t=0;t<this.content_pages.length;t++)this.content_pages[t].setAttribute("hidden","hidden");const e=t.currentTarget.getAttribute(this.settings.button_page_attr);this.popup_wrapper.querySelector(`[${this.settings.content_page_attr}="${e}"]`).removeAttribute("hidden")}}class g{constructor(){const t=document.querySelectorAll(".webpcPage [data-popup]"),{length:e}=t;for(let r=0;r<e;r++)new _(t[r])}}new class{constructor(){const t=new c,e=new p,r=new f;new g,new o,new a,new h(t),new l(t,e,r),new u}}},471:function(t,e,r){"use strict";var s=r(516);function n(){this.handlers=[]}n.prototype.use=function(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},n.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},n.prototype.forEach=function(t){s.forEach(this.handlers,(function(e){null!==e&&t(e)}))},t.exports=n},490:function(t,e,r){"use strict";var s=r(516),n=r(881),i=r(864),o=r(987);function a(t){t.cancelToken&&t.cancelToken.throwIfRequested()}t.exports=function(t){return a(t),t.headers=t.headers||{},t.data=n.call(t,t.data,t.headers,t.transformRequest),t.headers=s.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),s.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||o.adapter)(t).then((function(e){return a(t),e.data=n.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return i(e)||(a(t),e&&e.response&&(e.response.data=n.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))}},505:function(t,e,r){t.exports=r(15)},516:function(t,e,r){"use strict";var s=r(12),n=Object.prototype.toString;function i(t){return"[object Array]"===n.call(t)}function o(t){return void 0===t}function a(t){return null!==t&&"object"==typeof t}function c(t){if("[object Object]"!==n.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function u(t){return"[object Function]"===n.call(t)}function h(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),i(t))for(var r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.call(null,t[n],n,t)}t.exports={isArray:i,isArrayBuffer:function(t){return"[object ArrayBuffer]"===n.call(t)},isBuffer:function(t){return null!==t&&!o(t)&&null!==t.constructor&&!o(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:a,isPlainObject:c,isUndefined:o,isDate:function(t){return"[object Date]"===n.call(t)},isFile:function(t){return"[object File]"===n.call(t)},isBlob:function(t){return"[object Blob]"===n.call(t)},isFunction:u,isStream:function(t){return a(t)&&u(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:h,merge:function t(){var e={};function r(r,s){c(e[s])&&c(r)?e[s]=t(e[s],r):c(r)?e[s]=t({},r):i(r)?e[s]=r.slice():e[s]=r}for(var s=0,n=arguments.length;s<n;s++)h(arguments[s],r);return e},extend:function(t,e,r){return h(e,(function(e,n){t[n]=r&&"function"==typeof e?s(e,r):e})),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t}}},522:function(t,e,r){"use strict";var s=r(763);t.exports=function(t,e,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?e(s("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)}},592:function(t,e,r){"use strict";var s=r(516),n=r(522),i=r(948),o=r(106),a=r(615),c=r(631),u=r(202),h=r(763);t.exports=function(t){return new Promise((function(e,r){var l=t.data,p=t.headers,d=t.responseType;s.isFormData(l)&&delete p["Content-Type"];var f=new XMLHttpRequest;if(t.auth){var _=t.auth.username||"",g=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";p.Authorization="Basic "+btoa(_+":"+g)}var m=a(t.baseURL,t.url);function v(){if(f){var s="getAllResponseHeaders"in f?c(f.getAllResponseHeaders()):null,i={data:d&&"text"!==d&&"json"!==d?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:s,config:t,request:f};n(e,r,i),f=null}}if(f.open(t.method.toUpperCase(),o(m,t.params,t.paramsSerializer),!0),f.timeout=t.timeout,"onloadend"in f?f.onloadend=v:f.onreadystatechange=function(){f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))&&setTimeout(v)},f.onabort=function(){f&&(r(h("Request aborted",t,"ECONNABORTED",f)),f=null)},f.onerror=function(){r(h("Network Error",t,null,f)),f=null},f.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(h(e,t,t.transitional&&t.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",f)),f=null},s.isStandardBrowserEnv()){var b=(t.withCredentials||u(m))&&t.xsrfCookieName?i.read(t.xsrfCookieName):void 0;b&&(p[t.xsrfHeaderName]=b)}"setRequestHeader"in f&&s.forEach(p,(function(t,e){void 0===l&&"content-type"===e.toLowerCase()?delete p[e]:f.setRequestHeader(e,t)})),s.isUndefined(t.withCredentials)||(f.withCredentials=!!t.withCredentials),d&&"json"!==d&&(f.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&f.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&f.upload&&f.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then((function(t){f&&(f.abort(),r(t),f=null)})),l||(l=null),f.send(l)}))}},606:function(t){var e,r,s=t.exports={};function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(t){if(e===setTimeout)return setTimeout(t,0);if((e===n||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(r){try{return e.call(null,t,0)}catch(r){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:n}catch(t){e=n}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(t){r=i}}();var a,c=[],u=!1,h=-1;function l(){u&&a&&(u=!1,a.length?c=a.concat(c):h=-1,c.length&&p())}function p(){if(!u){var t=o(l);u=!0;for(var e=c.length;e;){for(a=c,c=[];++h<e;)a&&a[h].run();h=-1,e=c.length}a=null,u=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===i||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{return r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function f(){}s.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new d(t,e)),1!==c.length||u||o(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=f,s.addListener=f,s.once=f,s.off=f,s.removeListener=f,s.removeAllListeners=f,s.emit=f,s.prependListener=f,s.prependOnceListener=f,s.listeners=function(t){return[]},s.binding=function(t){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(t){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},615:function(t,e,r){"use strict";var s=r(137),n=r(680);t.exports=function(t,e){return t&&!s(e)?n(t,e):e}},631:function(t,e,r){"use strict";var s=r(516),n=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];t.exports=function(t){var e,r,i,o={};return t?(s.forEach(t.split("\n"),(function(t){if(i=t.indexOf(":"),e=s.trim(t.substr(0,i)).toLowerCase(),r=s.trim(t.substr(i+1)),e){if(o[e]&&n.indexOf(e)>=0)return;o[e]="set-cookie"===e?(o[e]?o[e]:[]).concat([r]):o[e]?o[e]+", "+r:r}})),o):o}},656:function(){},680:function(t){"use strict";t.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}},763:function(t,e,r){"use strict";var s=r(449);t.exports=function(t,e,r,n,i){var o=new Error(t);return s(o,e,r,n,i)}},841:function(t,e,r){"use strict";var s=r(198),n={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){n[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));var i={},o=s.version.split(".");function a(t,e){for(var r=e?e.split("."):o,s=t.split("."),n=0;n<3;n++){if(r[n]>s[n])return!0;if(r[n]<s[n])return!1}return!1}n.transitional=function(t,e,r){var n=e&&a(e);return function(o,a,c){if(!1===t)throw new Error(function(t,e){return"[Axios v"+s.version+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}(a," has been removed in "+e));return n&&!i[a]&&(i[a]=!0),!t||t(o,a,c)}},t.exports={isOlderVersion:a,assertOptions:function(t,e,r){if("object"!=typeof t)throw new TypeError("options must be an object");for(var s=Object.keys(t),n=s.length;n-- >0;){var i=s[n],o=e[i];if(o){var a=t[i],c=void 0===a||o(a,i,t);if(!0!==c)throw new TypeError("option "+i+" must be "+c)}else if(!0!==r)throw Error("Unknown option "+i)}},validators:n}},864:function(t){"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},881:function(t,e,r){"use strict";var s=r(516),n=r(987);t.exports=function(t,e,r){var i=this||n;return s.forEach(r,(function(r){t=r.call(i,t,e)})),t}},928:function(t){"use strict";function e(t){this.message=t}e.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},e.prototype.__CANCEL__=!0,t.exports=e},948:function(t,e,r){"use strict";var s=r(516);t.exports=s.isStandardBrowserEnv()?{write:function(t,e,r,n,i,o){var a=[];a.push(t+"="+encodeURIComponent(e)),s.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),s.isString(n)&&a.push("path="+n),s.isString(i)&&a.push("domain="+i),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},980:function(t){"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},987:function(t,e,r){"use strict";var s=r(606),n=r(516),i=r(18),o=r(449),a={"Content-Type":"application/x-www-form-urlencoded"};function c(t,e){!n.isUndefined(t)&&n.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var u,h={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==s&&"[object process]"===Object.prototype.toString.call(s))&&(u=r(592)),u),transformRequest:[function(t,e){return i(e,"Accept"),i(e,"Content-Type"),n.isFormData(t)||n.isArrayBuffer(t)||n.isBuffer(t)||n.isStream(t)||n.isFile(t)||n.isBlob(t)?t:n.isArrayBufferView(t)?t.buffer:n.isURLSearchParams(t)?(c(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):n.isObject(t)||e&&"application/json"===e["Content-Type"]?(c(e,"application/json"),function(t,e,r){if(n.isString(t))try{return(e||JSON.parse)(t),n.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional,r=e&&e.silentJSONParsing,s=e&&e.forcedJSONParsing,i=!r&&"json"===this.responseType;if(i||s&&n.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(i){if("SyntaxError"===t.name)throw o(t,this,"E_JSON_PARSE");throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300}};h.headers={common:{Accept:"application/json, text/plain, */*"}},n.forEach(["delete","get","head"],(function(t){h.headers[t]={}})),n.forEach(["post","put","patch"],(function(t){h.headers[t]=n.merge(a)})),t.exports=h}},r={};function s(t){var n=r[t];if(void 0!==n)return n.exports;var i=r[t]={exports:{}};return e[t](i,i.exports,s),i.exports}s.m=e,t=[],s.O=function(e,r,n,i){if(!r){var o=1/0;for(h=0;h<t.length;h++){r=t[h][0],n=t[h][1],i=t[h][2];for(var a=!0,c=0;c<r.length;c++)(!1&i||o>=i)&&Object.keys(s.O).every((function(t){return s.O[t](r[c])}))?r.splice(c--,1):(a=!1,i<o&&(o=i));if(a){t.splice(h--,1);var u=n();void 0!==u&&(e=u)}}return e}i=i||0;for(var h=t.length;h>0&&t[h-1][2]>i;h--)t[h]=t[h-1];t[h]=[r,n,i]},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,{a:e}),e},s.d=function(t,e){for(var r in e)s.o(e,r)&&!s.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},function(){var t={671:0,2:0};s.O.j=function(e){return 0===t[e]};var e=function(e,r){var n,i,o=r[0],a=r[1],c=r[2],u=0;if(o.some((function(e){return 0!==t[e]}))){for(n in a)s.o(a,n)&&(s.m[n]=a[n]);if(c)var h=c(s)}for(e&&e(r);u<o.length;u++)i=o[u],s.o(t,i)&&t[i]&&t[i][0](),t[i]=0;return s.O(h)},r=self.webpackChunkwebp_converter_for_media=self.webpackChunkwebp_converter_for_media||[];r.forEach(e.bind(null,0)),r.push=e.bind(null,r.push.bind(r))}(),s.O(void 0,[2],(function(){return s(461)}));var n=s.O(void 0,[2],(function(){return s(656)}));n=s.O(n)}();