/*! For license information please see oc-cache-settings.js.LICENSE.txt */ (()=>{var e={530:()=>{var e=Object.defineProperty,t=(t,n,r)=>(((t,n,r)=>{n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r})(t,"symbol"!=typeof n?n+"":n,r),r);const n={};async function r(e){if(n.hasOwnProperty(e))return n[e];let t;return t=e.startsWith("data:")||!("caches"in self)?fetch(e).then((e=>e.text())):caches.open("gravity").then((async t=>{let n=await t.match(e);return n||(n=await fetch(e),n.ok&&await t.put(e,n.clone())),n.text()})),n[e]=t,t}class o extends HTMLElement{static get observedAttributes(){return["src"]}fetchFlag(e){e&&r(e).then((e=>this.innerHTML=e))}connectedCallback(){this.fetchFlag(this.getAttribute("src"))}attributeChangedCallback(e,t,n){"src"===e&&t!==n&&this.fetchFlag(n)}}t(o,"TAG_NAME","gv-flag");class i extends HTMLElement{static get observedAttributes(){return["src"]}fetchIcon(e){e&&r(e).then((e=>this.innerHTML=e))}connectedCallback(){this.fetchIcon(this.getAttribute("src"))}attributeChangedCallback(e,t,n){"src"===e&&t!==n&&this.fetchIcon(n)}}t(i,"TAG_NAME","gv-icon");class a extends HTMLElement{static get observedAttributes(){return["src"]}fetchIllustration(e){e&&r(e).then((e=>this.innerHTML=e))}connectedCallback(){this.fetchIllustration(this.getAttribute("src"))}attributeChangedCallback(e,t,n){"src"===e&&t!==n&&this.fetchIllustration(n)}}t(a,"TAG_NAME","gv-illustration");class c extends HTMLElement{static get observedAttributes(){return["src"]}fetchIndicator(e){e&&r(e).then((e=>this.innerHTML=e))}connectedCallback(){this.fetchIndicator(this.getAttribute("src"))}attributeChangedCallback(e,t,n){"src"===e&&t!==n&&this.fetchIndicator(n)}}t(c,"TAG_NAME","gv-indicator");class s extends HTMLElement{static get observedAttributes(){return["src"]}fetchLoader(e){e&&r(e).then((e=>this.innerHTML=e))}connectedCallback(){this.fetchLoader(this.getAttribute("src"))}attributeChangedCallback(e,t,n){"src"===e&&t!==n&&this.fetchLoader(n)}}t(s,"TAG_NAME","gv-loader");class l extends HTMLElement{static get observedAttributes(){return["src"]}fetchLogo(e){e&&r(e).then((e=>this.innerHTML=e))}connectedCallback(){this.fetchLogo(this.getAttribute("src"))}attributeChangedCallback(e,t,n){"src"===e&&t!==n&&this.fetchLogo(n)}}t(l,"TAG_NAME","gv-logo");class u extends HTMLElement{static get observedAttributes(){return["src"]}fetchPayIcon(e){e&&r(e).then((e=>this.innerHTML=e))}connectedCallback(){this.fetchPayIcon(this.getAttribute("src"))}attributeChangedCallback(e,t,n){"src"===e&&t!==n&&this.fetchPayIcon(n)}}t(u,"TAG_NAME","gv-pay-icon");class f extends HTMLElement{static get observedAttributes(){return["src"]}fetchTile(e){e&&r(e).then((e=>this.innerHTML=e))}connectedCallback(){this.fetchTile(this.getAttribute("src"))}attributeChangedCallback(e,t,n){"src"===e&&t!==n&&this.fetchTile(n)}}function h(e,t){customElements.get(e)||customElements.define(e,t)}t(f,"TAG_NAME","gv-tile"),h(o.TAG_NAME,o),h(i.TAG_NAME,i),h(a.TAG_NAME,a),h(c.TAG_NAME,c),h(s.TAG_NAME,s),h(l.TAG_NAME,l),h(u.TAG_NAME,u),h(f.TAG_NAME,f)},7:e=>{"use strict";var t,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}e.exports=i,e.exports.once=function(e,t){return new Promise((function(n,r){function o(n){e.removeListener(t,i),r(n)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),n([].slice.call(arguments))}d(e,t,i,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&d(e,"error",t,{once:!0})}(e,o)}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var a=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function s(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function l(e,t,n,r){var o,i,a,l;if(c(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),a=i[t]),void 0===a)a=i[t]=n,++e._eventsCount;else if("function"==typeof a?a=i[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(o=s(e))>0&&a.length>o&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,l=u,console&&console.warn&&console.warn(l)}return e}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=u.bind(r);return o.listener=n,r.wrapFn=o,o}function h(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(a=t[0]),a instanceof Error)throw a;var c=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw c.context=a,c}var s=i[e];if(void 0===s)return!1;if("function"==typeof s)r(s,this,t);else{var l=s.length,u=p(s,l);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},i.prototype.listeners=function(e){return h(this,e,!0)},i.prototype.rawListeners=function(e){return h(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):v.call(e,t)},i.prototype.listenerCount=v,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},338:(e,t,n)=>{"use strict";var r=n(206);t.H=r.createRoot,r.hydrateRoot},206:e=>{"use strict";e.exports=ReactDOM}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}(()=>{"use strict";const e=wp.element;n(530);var t=n(338);const r=new(n(7).EventEmitter),o=function(e){var t=e.type,n=void 0===t?"button":t,r=e.className,o=void 0===r?"gv-button":r,i=e.onClick,a=e.disabled,c=void 0!==a&&a,s=e.children,l=e.iconSrc,u=e.title,f=e.dataUpsell,h=void 0===f?"":f;return React.createElement("button",{type:n,className:o,onClick:i,disabled:c,title:u,"data-upsell-btn-event":h},s,l&&React.createElement("gv-icon",{src:l}))};function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function a(){a=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},c="function"==typeof Symbol?Symbol:{},s=c.iterator||"@@iterator",l=c.asyncIterator||"@@asyncIterator",u=c.toStringTag||"@@toStringTag";function f(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,n){return e[t]=n}}function h(e,t,n,r){var i=t&&t.prototype instanceof b?t:b,a=Object.create(i.prototype),c=new O(r||[]);return o(a,"_invoke",{value:N(e,n,c)}),a}function v(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var p="suspendedStart",d="suspendedYield",g="executing",m="completed",y={};function b(){}function w(){}function E(){}var _={};f(_,s,(function(){return this}));var L=Object.getPrototypeOf,S=L&&L(L(j([])));S&&S!==n&&r.call(S,s)&&(_=S);var x=E.prototype=b.prototype=Object.create(_);function C(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,t){function n(o,a,c,s){var l=v(e[o],e,a);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==i(f)&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,c,s)}),(function(e){n("throw",e,c,s)})):t.resolve(f).then((function(e){u.value=e,c(u)}),(function(e){return n("throw",e,c,s)}))}s(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function N(t,n,r){var o=p;return function(i,a){if(o===g)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var c=r.delegate;if(c){var s=T(c,r);if(s){if(s===y)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=g;var l=v(t,n,r);if("normal"===l.type){if(o=r.done?m:d,l.arg===y)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(o=m,r.method="throw",r.arg=l.arg)}}}function T(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var i=v(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,y;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function R(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(R,this),this.reset(!0)}function j(t){if(t||""===t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),M(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;M(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:j(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function c(e,t,n,r,o,i,a){try{var c=e[i](a),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,o)}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],s=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);ne.length)&&(t=e.length);for(var n=0,r=Array(t);nwindow.innerHeight)&&e.scrollIntoView({behavior:"smooth",block:"start"})}}),100)};return r.on("showNotice",e),function(){r.off("showNotice",e)}}),[]),a.isVisible?React.createElement("div",{className:"gv-notice ".concat(a.noticeClass," gv-mb-lg")},React.createElement("gv-icon",{class:"gv-notice-icon",src:a.icon}),React.createElement("p",{className:"gv-notice-content"},a.message),React.createElement(o,{className:"gv-notice-close",onClick:function(){return c({isVisible:!1,message:"",noticeClass:"",icon:""})},iconSrc:"".concat("undefined"!=typeof CdnSettings?CdnSettings.imageDIR:vcacheSettings.imageDIR,"assets/images/close.svg")})):null},v=function(e){var t=e.selectedValue,n=e.onChange,r=e.activeLabel,o=void 0===r?"Active":r,i=e.inactiveLabel,a=void 0===i?"Inactive":i,c=e.name,s=void 0===c?"statusSelector":c;return React.createElement(React.Fragment,null,React.createElement("p",{className:"gv-text-sm gv-text-bold gv-mb-sm"},"Status"),React.createElement("div",{className:"gv-mode-condensed"},React.createElement("div",{className:"gv-form-option gv-mb-md"},React.createElement("div",{className:"gv-option-inline"},React.createElement("input",{id:"".concat(s,"-active"),type:"radio",name:s,value:"1",className:"gv-radio ".concat("cdnStatus"===s?"ocwp_ocpc_cdn_active_selected_event":"ocwp_ocpc_cache_active_selected_event"),checked:"1"===t,onChange:function(e){n(e.target.value)}}),React.createElement("label",{htmlFor:"".concat(s,"-active"),className:"gv-label"},o))),React.createElement("div",{className:"gv-form-option"},React.createElement("div",{className:"gv-option-inline"},React.createElement("input",{id:"".concat(s,"-inactive"),type:"radio",name:s,className:"gv-radio ".concat("cdnStatus"===s?"ocwp_ocpc_cdn_inactive_selected_event":"ocwp_ocpc_cache_inactive_selected_event"),value:"0",checked:"0"===t,onChange:function(e){n(e.target.value)}}),React.createElement("label",{htmlFor:"".concat(s,"-inactive"),className:"gv-label"},a)))))};function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);ne.length)&&(t=e.length);for(var n=0,r=Array(t);n=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),M(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;M(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:j(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function E(e,t,n,r,o,i,a){try{var c=e[i](a),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,o)}var _=function(){var e,t=(e=w().mark((function e(t){var n,o,i,a,c,s,l;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.cacheTtl,o=t.vcstate,i=t.csrfToken,a=t.frequency,c=t.setCacheTtlError,s=t.setIsLoading,!(!n.trim()||isNaN(n)||parseInt(n,10)<=0)){e.next=4;break}return c(vcacheSettings.ttlValidationMsg),e.abrupt("return");case 4:return s(!0),e.prev=5,e.next=8,fetch(vcacheSettings.ajax_url,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"oc_set_vc_state",vc_state:o,oc_csrf:i,vc_ttl:n,vc_ttl_unit:a})});case 8:if((l=e.sent).ok){e.next=11;break}throw new Error("HTTP error! Status: ".concat(l.status));case 11:return e.next=13,l.json();case 13:"success"===e.sent.status?r.emit("showNotice",{message:vcacheSettings.settingsSaveMessage.success,icon:"".concat(vcacheSettings.imageDIR,"assets/images/check_circle.svg"),noticeClass:"gv-notice-success"}):r.emit("showNotice",{message:vcacheSettings.settingsSaveMessage.failure,icon:"".concat(vcacheSettings.imageDIR,"assets/images/error.svg"),noticeClass:"gv-notice-alert"}),e.next=20;break;case 17:e.prev=17,e.t0=e.catch(5),r.emit("showNotice",{message:vcacheSettings.settingsSaveMessage.failure,icon:"".concat(vcacheSettings.imageDIR,"assets/images/error.svg"),noticeClass:"gv-notice-alert"});case 20:return e.prev=20,s(!1),e.finish(20);case 23:case"end":return e.stop()}}),e,null,[[5,17,20,23]])})),function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){E(i,r,o,a,c,"next",e)}function c(e){E(i,r,o,a,c,"throw",e)}a(void 0)}))});return function(e){return t.apply(this,arguments)}}();function L(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],s=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return S(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?S(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&E("")},placeholder:vcacheSettings.Ttlplaceholder,validationMessageId:"oc-TTL-validation-msg",validationMessage:w}),React.createElement(y,{frequency:s,setFrequency:l,isLoading:d,handleSave:function(){_({cacheTtl:i,vcstate:n,csrfToken:f,frequency:s,setCacheTtlError:E,setIsLoading:m})},frequencyLabel:x,frequencyOptions:S}))};var T=document.getElementById("vcache-root");T?(0,e.createRoot)(T).render(React.createElement(e.StrictMode,null,React.createElement(N,null))):console.error("Error: root not found in the DOM")})()})(); //# sourceMappingURL=oc-cache-settings.js.map