!function(){var e={184:function(e,t){var n;
/*!
  Copyright (c) 2017 Jed Watson.
  Licensed under the MIT License (MIT), see
  http://jedwatson.github.io/classnames
*/!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)&&n.length){var i=r.apply(null,n);i&&e.push(i)}else if("object"===a)for(var c in n)o.call(n,c)&&n[c]&&e.push(c)}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()},496:function(e){for(var t=self.crypto||self.msCrypto,n="-_",o=36;o--;)n+=o.toString(36);for(o=36;o---10;)n+=o.toString(36).toUpperCase();e.exports=function(e){var r="",a=t.getRandomValues(new Uint8Array(e||21));for(o=e||21;o--;)r+=n[63&a[o]];return r}},539:function(e,t){var n,o,r;
/*!
 * php-unserialize-js JavaScript Library
 * https://github.com/bd808/php-unserialize-js
 *
 * Copyright 2013 Bryan Davis and contributors
 * Released under the MIT license
 * http://www.opensource.org/licenses/MIT
 */!function(a,i){"use strict";o=[],void 0===(r="function"==typeof(n=function(){return function(e){var t,n=0,o=[],r=0,a=function(){var t=e.indexOf(":",n),o=e.substring(n,t);return n=t+2,parseInt(o,10)},i=function(){var t=e.indexOf(";",n),o=e.substring(n,t);return n=t+1,parseInt(o,10)},c=function(){var e=i();return o[r++]=e,e},l=function(){var t=e.indexOf(";",n),a=e.substring(n,t);return n=t+1,a=parseFloat(a),o[r++]=a,a},s=function(){var t=e.indexOf(";",n),a=e.substring(n,t);return n=t+1,a="1"===a,o[r++]=a,a},u=function(t='"'){for(var o,r,i=a(),c=0,l=0;l<i;)(o=e.charCodeAt(n+c++))<=127?l++:l+=o>2047?3:2;return e.charAt(n+c)!==t&&(c+=e.indexOf('"',n+c)-n-c),r=e.substring(n,n+c),n+=c+2,r},d=function(){var e=u();return o[r++]=e,e},p=function(){var t=e.charAt(n);return n+=2,t},m=function(){var e=p();switch(e){case"i":return i();case"s":return u();default:throw new Error("Unknown key type '"+e+"' at position "+(n-2))}},f=function(){var e,i,c,l,s,u=a(),d=[],p={},f=d,y=r++;o[y]=f;try{for(c=0;c<u;c++)if(e=m(),i=t(),f===d&&e+""==c+"")d.push(i);else{if(f!==p){for(l=0,s=d.length;l<s;l++)p[l]=d[l];f=p,o[y]=f}p[e]=i}}catch(e){throw e.state=f,e}return n++,f},y=function(e,t){var o,r,a;if("\0"===e.charAt(0)){if((a=e.indexOf("\0",1))>0)return o=e.substring(1,a),r=e.substr(a+1),"*"===o||t===o?r:o+"::"+r;var i="Expected two <NUL> characters in non-public property name '"+e+"' at position "+(n-e.length-2);throw new Error(i)}return e},h=function(){var e,i,c,l,s={},d=r++,p=u();o[d]=s,e=a();try{for(l=0;l<e;l++)i=y(m(),p),c=t(),s[i]=c}catch(e){throw e.state=s,e}return n++,s},v=function(){return{__PHP_Incomplete_Class_Name:u(),serialized:u("}")}},b=function(){var e=i(),t=o[e-1];return o[r++]=t,t},_=function(){var e=i();return o[e-1]},g=function(){var e=null;return o[r++]=e,e};return(t=function(){var e=p();switch(e){case"i":return c();case"d":return l();case"b":return s();case"s":return d();case"a":return f();case"O":return h();case"C":return v();case"r":return b();case"R":return _();case"N":return g();default:throw new Error("Unknown type '"+e+"' at position "+(n-2))}})()}})?n.apply(t,o):n)||(e.exports=r)}()},459:function(e,t,n){var o=n(967);function r(e,t,n,o,a){var i=new Error(n,o,a);return i.name="UseFetchError",i.status=e,i.statusText=t,Object.setPrototypeOf(i,Object.getPrototypeOf(this)),Error.captureStackTrace&&Error.captureStackTrace(i,r),i}r.prototype=Object.create(Error.prototype,{constructor:{value:Error,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf(r,Error),e.exports=function(e,t,n){var a=(n&&n.depends||t&&t.depends||[]).reduce((function(e,t){return e||!t}),!1);return o(!a&&function(e,t,n){return fetch(e,t).then(n&&n.formatter||t&&t.formatter||function(e){if(!e.ok)throw new r(e.status,e.statusText,"Fetch error");return e.json()})},e,t||{},n||{})}},967:function(e,t,n){var o=n(313),r=n(923);e.exports=function(e){var t=Array.prototype.slice.call(arguments,[1]),n=o.useState({isLoading:!!e});return o.useEffect((function(){e&&(!n[0].isLoading&&n[1]({data:n[0].data,isLoading:!0}),e.apply(null,t).then((function(e){n[1]({data:e,isLoading:!1})})).catch((function(e){n[1]({error:e,isLoading:!1})})))}),r(t)),n[0]}},923:function(e){e.exports=function e(){for(var t=[],n=0;n<arguments.length;n++){var o=arguments[n];if(o instanceof Array)for(var r=0;r<o.length;r++)t=t.concat(e(o[r]));else if("undefined"!=typeof URL&&o instanceof URL)t=t.concat(o.toJSON());else if(o instanceof Object)for(var a=Object.keys(o),i=0;i<a.length;i++){var c=a[i];t=t.concat([c]).concat(e(o[c]))}else t=t.concat(o)}return t}},616:function(e,t,n){var o=n(496);e.exports=function(){var e=function(){e.id=o(),e.subscribers.forEach((function(e){e()}))};return e.id=o(),e.subscribers=[],e.subscribe=function(t){e.subscribers.push(t)},e.unsubscribe=function(t){e.subscribers.indexOf(t)>=0&&e.subscribers.splice(e.subscribers.indexOf(t),1)},e}},382:function(e,t,n){var o=n(313);e.exports=function(e){var t=o.useState(e.id),n=function(){return t[1](e.id)};return o.useEffect((function(){return e.subscribe(n),function(){return e.unsubscribe(n)}}),[]),t[0]}},313:function(e){"use strict";e.exports=window.React},61:function(e,t,n){var o=n(698).default;function r(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */e.exports=r=function(){return n},e.exports.__esModule=!0,e.exports.default=e.exports;var t,n={},a=Object.prototype,i=a.hasOwnProperty,c=Object.defineProperty||function(e,t,n){e[t]=n.value},l="function"==typeof Symbol?Symbol:{},s=l.iterator||"@@iterator",u=l.asyncIterator||"@@asyncIterator",d=l.toStringTag||"@@toStringTag";function p(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{p({},"")}catch(t){p=function(e,t,n){return e[t]=n}}function m(e,t,n,o){var r=t&&t.prototype instanceof g?t:g,a=Object.create(r.prototype),i=new L(o||[]);return c(a,"_invoke",{value:N(e,n,i)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}n.wrap=m;var y="suspendedStart",h="suspendedYield",v="executing",b="completed",_={};function g(){}function E(){}function w(){}var O={};p(O,s,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(A([])));x&&x!==a&&i.call(x,s)&&(O=x);var C=w.prototype=g.prototype=Object.create(O);function j(e){["next","throw","return"].forEach((function(t){p(e,t,(function(e){return this._invoke(t,e)}))}))}function P(e,t){function n(r,a,c,l){var s=f(e[r],e,a);if("throw"!==s.type){var u=s.arg,d=u.value;return d&&"object"==o(d)&&i.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,c,l)}),(function(e){n("throw",e,c,l)})):t.resolve(d).then((function(e){u.value=e,c(u)}),(function(e){return n("throw",e,c,l)}))}l(s.arg)}var r;c(this,"_invoke",{value:function(e,o){function a(){return new t((function(t,r){n(e,o,t,r)}))}return r=r?r.then(a,a):a()}})}function N(e,n,o){var r=y;return function(a,i){if(r===v)throw Error("Generator is already running");if(r===b){if("throw"===a)throw i;return{value:t,done:!0}}for(o.method=a,o.arg=i;;){var c=o.delegate;if(c){var l=S(c,o);if(l){if(l===_)continue;return l}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if(r===y)throw r=b,o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);r=v;var s=f(e,n,o);if("normal"===s.type){if(r=o.done?b:h,s.arg===_)continue;return{value:s.arg,done:o.done}}"throw"===s.type&&(r=b,o.method="throw",o.arg=s.arg)}}}function S(e,n){var o=n.method,r=e.iterator[o];if(r===t)return n.delegate=null,"throw"===o&&e.iterator.return&&(n.method="return",n.arg=t,S(e,n),"throw"===n.method)||"return"!==o&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+o+"' method")),_;var a=f(r,e.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,_;var i=a.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,_):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,_)}function D(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 T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(D,this),this.reset(!0)}function A(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function n(){for(;++r<e.length;)if(i.call(e,r))return n.value=e[r],n.done=!1,n;return n.value=t,n.done=!0,n};return a.next=a}}throw new TypeError(o(e)+" is not iterable")}return E.prototype=w,c(C,"constructor",{value:w,configurable:!0}),c(w,"constructor",{value:E,configurable:!0}),E.displayName=p(w,d,"GeneratorFunction"),n.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===E||"GeneratorFunction"===(t.displayName||t.name))},n.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,p(e,d,"GeneratorFunction")),e.prototype=Object.create(C),e},n.awrap=function(e){return{__await:e}},j(P.prototype),p(P.prototype,u,(function(){return this})),n.AsyncIterator=P,n.async=function(e,t,o,r,a){void 0===a&&(a=Promise);var i=new P(m(e,t,o,r),a);return n.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},j(C),p(C,d,"Generator"),p(C,s,(function(){return this})),p(C,"toString",(function(){return"[object Generator]"})),n.keys=function(e){var t=Object(e),n=[];for(var o in t)n.push(o);return n.reverse(),function e(){for(;n.length;){var o=n.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},n.values=A,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(o,r){return c.type="throw",c.arg=e,n.next=o,r&&(n.method="next",n.arg=t),!!r}for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=i.call(a,"catchLoc"),s=i.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&i.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var r=o;break}}r&&("break"===e||"continue"===e)&&r.tryLoc<=t&&t<=r.finallyLoc&&(r=null);var a=r?r.completion:{};return a.type=e,a.arg=t,r?(this.method="next",this.next=r.finallyLoc,_):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),_},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),T(n),_}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var r=o.arg;T(n)}return r}}throw Error("illegal catch attempt")},delegateYield:function(e,n,o){return this.delegate={iterator:A(e),resultName:n,nextLoc:o},"next"===this.method&&(this.arg=t),_}},n}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},698:function(e){function t(n){return e.exports=t="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},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},687:function(e,t,n){var o=n(61)();e.exports=o;try{regeneratorRuntime=o}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var a=t[o]={exports:{}};return e[o].call(a.exports,a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";var e=window.wp.element,t=window.wp.components;function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function r(e,t){if(e){if("string"==typeof e)return o(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)?o(e,t):void 0}}function a(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 o,r,a,i,c=[],l=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(o=a.call(n)).done)&&(c.push(o.value),c.length!==t);l=!0);}catch(e){s=!0,r=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw r}}return c}}(e,t)||r(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.")}()}var i=window.wp.i18n,c=window.blocksyOptions;function l(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||r(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e){return s="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},s(e)}function u(e){var t=function(e,t){if("object"!=s(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=s(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==s(t)?t:t+""}function d(e,t,n){return(t=u(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var p=n(184),m=n.n(p);function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach((function(t){d(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=(0,e.useContext)(L),o=n.isAdvancedMode,r=n.remoteConditions,a=n.allLanguages,i=r;return{isAdvancedMode:o,allRules:i.reduce((function(e,t){var n=t.rules,o=t.title;return[].concat(l(e),l(n.map((function(e){return y(y({},e),{},{group:o})}))))}),[]).reduce((function(e,n){var o=n.title,r=n.id,a=n.sub_ids,i=void 0===a?[]:a,c=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.includes(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(n,["title","id","sub_ids"]);return[].concat(l(e),[y({key:t&&i.length>0&&i.find((function(e){return e.id===t.rule}))?t.rule:r,value:o,sub_ids:i},c)])}),[]),rulesToUse:i,allLanguages:a}};function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},v.apply(null,arguments)}function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function _(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?b(Object(n),!0).forEach((function(t){d(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var g=function(t){var n=t.onChange,o=t.condition,r=a((0,e.useState)("start"),2),l=r[0],s=r[1],u=(0,e.useRef)(),p=a((0,e.useState)(!1),2),f=p[0],y=p[1],h=(0,c.usePopoverMaker)({ref:u,defaultHeight:228,shouldCalculate:!0}),b=h.styles,g=h.popoverProps,E=o.payload.start||new Date,w=o.payload.end||new Date,O=[wp.date.format("j/n/Y",E),wp.date.format("j/n/Y",w)];return O[0]===O[1]&&(O=[wp.date.format(wp.date.getSettings().formats.time,E),wp.date.format(wp.date.getSettings().formats.time,w)]),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(c.OutsideClickHandler,{className:"ct-select-input",wrapperProps:{ref:u,role:"combobox","aria-expanded":f,"aria-haspopup":"listbox",onClick:function(){y(!f)}},onOutsideClick:function(e){e.target.closest(".ct-select-dropdown")||y(!1)}},(0,e.createElement)("input",{value:O.join(" - "),onChange:function(){},readOnly:!0})),f&&(0,e.createPortal)((0,e.createElement)("div",v({className:m()("ct-select-dropdown ct-date-time-picker-dropdown",{"ct-fixed":!0})},g,{style:b}),(0,e.createElement)("div",{className:"ct-start-end-date-switcher components-button-group"},["start","end"].map((function(t){return(0,e.createElement)("button",{key:t,className:m()("components-button",{"is-primary":t===l}),onClick:function(){s(t)}},"start"===t?"Start Date":"Expiration Date")}))),(0,e.createElement)(c.DateTimePicker,{value:(o.payload||{})[l]||new Date,onChange:function(e){"end"===l&&new Date(e).getTime()<(o.payload.start?new Date(o.payload.start).getTime():(new Date).getTime())&&(e=o.payload.start,alert((0,i.__)("The expiration date cannot be set earlier than the start date.","blocksy-companion"))),"start"===l&&new Date(e).getTime()>(o.payload.end?new Date(o.payload.end).getTime():(new Date).getTime())&&(o.payload.end=e),n(_(_({},o),{},{payload:_(_(_({},o.payload),o.payload.start?{}:{start:E}),{},d({},l,e))}))}})),document.body))},E=window.wp.date;function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){d(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var k=function(n){var o=n.onChange,r=n.condition,l=(0,e.useRef)(),s=a((0,e.useState)(!1),2),u=s[0],p=s[1],f=(0,c.usePopoverMaker)({ref:l,defaultHeight:228,shouldCalculate:!0}),y=f.styles,h=f.popoverProps,b={monday:!0,tuesday:!0,wednesday:!0,thursday:!0,friday:!0,saturday:!0,sunday:!0},_=Object.keys(b).filter((function(e){return(r.payload.days||b)[e]})),g="Only "+_.map((function(e){return function(e){return{monday:(0,i.__)("Mon","blocksy-companion"),tuesday:(0,i.__)("Tue","blocksy-companion"),wednesday:(0,i.__)("Wed","blocksy-companion"),thursday:(0,i.__)("Thu","blocksy-companion"),friday:(0,i.__)("Fri","blocksy-companion"),saturday:(0,i.__)("Sat","blocksy-companion"),sunday:(0,i.__)("Sun","blocksy-companion")}[e]}(e)})).join(", ");7===_.length&&(g=(0,i.__)("Every day","blocksy-companion")),2===_.length&&_.includes("saturday")&&_.includes("sunday")&&(g=(0,i.__)("Only weekends","blocksy-companion")),5!==_.length||_.includes("saturday")||_.includes("sunday")||(g=(0,i.__)("Only weekdays","blocksy-companion")),0===_.length&&(g=(0,i.__)("Never","blocksy-companion"));var w=r.payload.time_start||"00:00",k=r.payload.time_end||"23:59",x=new Date;x.setHours(w.split(":")[0]),x.setMinutes(w.split(":")[1],0,0);var C=new Date;C.setHours(k.split(":")[0]),C.setMinutes(k.split(":")[1],0,0);var j=(0,E.getSettings)(),P=/a(?!\\)/i.test(j.formats.time.toLowerCase().replace(/\\\\/g,"").split("").reverse().join(""));return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(c.OutsideClickHandler,{className:"ct-select-input",wrapperProps:{ref:l,role:"combobox","aria-expanded":u,"aria-haspopup":"listbox",onClick:function(){p(!u)}},onOutsideClick:function(e){e.target.closest(".ct-select-dropdown")||p(!1)}},(0,e.createElement)("input",{value:g,onChange:function(){},readOnly:!0})),u&&(0,e.createPortal)((0,e.createElement)("div",v({className:m()("ct-select-dropdown ct-recurring-scheduling-dropdown",{"ct-fixed":!0})},h,{style:y}),(0,e.createElement)("div",{className:"ct-recurring-scheduling-days"},(0,e.createElement)("label",{className:"ct-label"},(0,i.__)("Recurring Days","blocksy-companion")),[{key:"monday",value:(0,i.__)("Monday","blocksy-companion")},{key:"tuesday",value:(0,i.__)("Tuesday","blocksy-companion")},{key:"wednesday",value:(0,i.__)("Wednesday","blocksy-companion")},{key:"thursday",value:(0,i.__)("Thursday","blocksy-companion")},{key:"friday",value:(0,i.__)("Friday","blocksy-companion")},{key:"saturday",value:(0,i.__)("Saturday","blocksy-companion")},{key:"sunday",value:(0,i.__)("Sunday","blocksy-companion")}].map((function(n){var a=n.key,i=n.value;return(0,e.createElement)(t.CheckboxControl,{label:i,checked:(r.payload.days||b)[a],onChange:function(){o(O(O({},r),{},{payload:O(O({},r.payload),{},{days:O(O({},r.payload.days||b),{},d({},a,!(r.payload.days||b)[a]))})}))}})}))),(0,e.createElement)("div",{className:"ct-recurring-scheduling-time"},(0,e.createElement)("div",{className:"ct-recurring-start-time"},(0,e.createElement)("label",{className:"ct-label"},(0,i.__)("Start Time","blocksy-companion")),(0,e.createElement)(t.TimePicker,{is12Hour:P,currentTime:x,onChange:function(e){o(O(O({},r),{},{payload:O(O({},r.payload),{},{time_start:wp.date.format("H:i",e)})}))}})),(0,e.createElement)("div",{className:"ct-recurring-stop-time"},(0,e.createElement)("label",{className:"ct-label"},(0,i.__)("Stop Time","blocksy-companion")),(0,e.createElement)(t.TimePicker,{is12Hour:P,currentTime:C,onChange:function(e){o(O(O({},r),{},{payload:O(O({},r.payload),{},{time_end:wp.date.format("H:i",e)})}))}})))),document.body))};function x(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function C(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?x(Object(n),!0).forEach((function(t){d(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var j=function(t){var n=t.className,o=void 0===n?"":n,r=t.condition,a=t.onRemove,l=t.onChange;r=C(C({},r),{},{payload:C({},r.payload)});var s=h(r),u=s.allRules,d=s.allLanguages,p=u.find((function(e){return e.key===r.rule})),f="post_ids"===r.rule||"page_ids"===r.rule||"product_ids"===r.rule||"custom_post_type_ids"===r.rule||"taxonomy_ids"===r.rule||"post_with_taxonomy_ids"===r.rule||"card_product_with_taxonomy_ids"===r.rule||"card_post_with_taxonomy_ids"===r.rule||"product_with_taxonomy_ids"===r.rule||"product_taxonomy_ids"===r.rule||"current_language"===r.rule||"user_post_author_id"===r.rule||"author"===r.rule||"start_end_date"===r.rule||"schedule_date"===r.rule||"request_referer"===r.rule||"request_cookie"===r.rule||"request_url"===r.rule||p&&p.sub_ids&&p.sub_ids.length>0||p&&p.is_custom_rule&&p.has_text_field||p&&p.is_custom_rule&&p.choices;return(0,e.createElement)("div",{className:m()("ct-condition-group",o,{"ct-cols-3":f,"ct-cols-2":!f})},(0,e.createElement)(c.Select,{key:"first",option:{inputClassName:"ct-condition-type",selectInputStart:function(){return"include"===r.type?(0,e.createElement)("span",{className:"ct-include"},(0,e.createElement)("svg",{width:"8",height:"8",fill:"currentColor",viewBox:"0 0 20 20"},(0,e.createElement)("path",{d:"M20,11h-9v9H9v-9H0V9h9V0h2v9h9V11z"}))):"exclude"===r.type?(0,e.createElement)("span",{className:"ct-exclude"},(0,e.createElement)("svg",{width:"8",height:"8",fill:"currentColor",viewBox:"0 0 20 20"},(0,e.createElement)("path",{d:"M20,9v2H0V9H20z"}))):null},placeholder:(0,i.__)("Select variation","blocksy-companion"),choices:{include:(0,i.__)("Include","blocksy-companion"),exclude:(0,i.__)("Exclude","blocksy-companion")}},value:r.type,onChange:function(e){l(C(C({},r),{},{type:e}))}}),(0,e.createElement)(c.Select,{key:"second",option:{appendToBody:!0,placeholder:(0,i.__)("Select rule","blocksy-companion"),choices:u,search:!0},value:r.rule,onChange:function(e){var t=u.find((function(t){return t.key===e}));t.sub_ids&&t.sub_ids.length>0?l(C(C({},r),{},{rule:t.sub_ids[0].id})):l(C(C({},r),{},{rule:e}))}}),("post_ids"===r.rule||"custom_post_type_ids"===r.rule||"product_ids"===r.rule||"page_ids"===r.rule)&&(0,e.createElement)(c.EntityIdPicker,{option:{placeholder:"post_ids"===r.rule?(0,i.__)("Select post","blocksy-companion"):"page_ids"===r.rule?(0,i.__)("Select page","blocksy-companion"):"product_ids"===r.rule?(0,i.__)("Select product","blocksy-companion"):(0,i.__)("Custom Post Type ID","blocksy-companion"),entity:"posts",post_type:{post_ids:"post",page_ids:"page",product_ids:"product",custom_post_type_ids:"ct_cpt"}[r.rule]},value:(r.payload||{}).post_id||"",onChange:function(e){l(C(C({},r),{},{payload:C(C({},r.payload),{},{post_id:e})}))}}),("taxonomy_ids"===r.rule||"post_with_taxonomy_ids"===r.rule||"card_post_with_taxonomy_ids"===r.rule)&&(0,e.createElement)(c.EntityIdPicker,{option:{placeholder:(0,i.__)("Select taxonomy","blocksy-companion"),entity:"taxonomies"},value:(r.payload||{}).taxonomy_id||"",onChange:function(e){l(C(C({},r),{},{payload:C(C({},r.payload),{},{taxonomy_id:e})}))}}),("product_with_taxonomy_ids"===r.rule||"product_taxonomy_ids"===r.rule||"card_product_with_taxonomy_ids"===r.rule)&&(0,e.createElement)(c.EntityIdPicker,{option:{placeholder:(0,i.__)("Select taxonomy","blocksy-companion"),entity:"taxonomies",post_type:"product"},value:(r.payload||{}).taxonomy_id||"",onChange:function(e){l(C(C({},r),{},{payload:C(C({},r.payload),{},{taxonomy_id:e})}))}}),"current_language"===r.rule&&(0,e.createElement)(c.Select,{option:{appendToBody:!0,defaultToFirstItem:!1,placeholder:(0,i.__)("Select language","blocksy-companion"),choices:d.map((function(e){return{key:e.id,value:e.name}})),search:!0},value:(r.payload||{}).language||"",onChange:function(e){l(C(C({},r),{},{payload:C(C({},r.payload),{},{language:e})}))}}),"user_post_author_id"===r.rule&&(0,e.createElement)(c.EntityIdPicker,{option:{placeholder:(0,i.__)("Select user","blocksy-companion"),entity:"users",additionOptions:[{key:"current_user",value:(0,i.__)("Current user","blocksy-companion")}]},value:(r.payload||{}).user_id||"",onChange:function(e){l(C(C({},r),{},{payload:C(C({},r.payload),{},{user_id:e})}))}}),"author"===r.rule&&(0,e.createElement)(c.EntityIdPicker,{option:{placeholder:(0,i.__)("Select user","blocksy-companion"),entity:"users",additionOptions:[{key:"all_users",value:(0,i.__)("All authors","blocksy-companion")}]},value:(r.payload||{}).user_id||"all_users",onChange:function(e){l(C(C({},r),{},{payload:C(C({},r.payload),{},{user_id:e})}))}}),p&&p.sub_ids&&p.sub_ids.length>0&&(0,e.createElement)(c.Select,{option:{appendToBody:!0,placeholder:(0,i.__)("Select sub field","blocksy-companion"),choices:p.sub_ids.map((function(e){return{key:e.id,value:e.title}})),search:!0,inputClassName:"ct-dropdown-normal-width"},value:r.rule,onChange:function(e){l(C(C({},r),{},{rule:e}))}}),"start_end_date"===r.rule&&(0,e.createElement)(g,{condition:r,onChange:l}),"schedule_date"===r.rule&&(0,e.createElement)(k,{condition:r,onChange:l}),"request_referer"===r.rule&&(0,e.createElement)("div",{className:"ct-option-input"},(0,e.createElement)("input",{type:"text",placeholder:"website.com",value:r.payload.referer,onChange:function(e){l(C(C({},r),{},{payload:C(C({},r.payload),{},{referer:e.target.value})}))}}),(0,e.createElement)("span",{className:"ct-condition-info","data-tooltip-reveal":"top"},(0,e.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 24 24"},(0,e.createElement)("path",{d:"M12,2C6.477,2,2,6.477,2,12s4.477,10,10,10s10-4.477,10-10S17.523,2,12,2z M12,17L12,17c-0.552,0-1-0.448-1-1v-4 c0-0.552,0.448-1,1-1h0c0.552,0,1,0.448,1,1v4C13,16.552,12.552,17,12,17z M12.5,9h-1C11.224,9,11,8.776,11,8.5v-1 C11,7.224,11.224,7,11.5,7h1C12.776,7,13,7.224,13,7.5v1C13,8.776,12.776,9,12.5,9z"})),(0,e.createElement)("i",{className:"ct-tooltip"},(0,i.__)("Display based on referer domain","blocksy-companion")))),"request_cookie"===r.rule&&(0,e.createElement)("div",{className:"ct-option-input"},(0,e.createElement)("input",{type:"text",placeholder:"cookie_name",value:(r.payload||{}).cookie||"",onChange:function(e){l(C(C({},r),{},{payload:C(C({},r.payload),{},{cookie:e.target.value})}))}}),(0,e.createElement)("span",{className:"ct-condition-info","data-tooltip-reveal":"top"},(0,e.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 24 24"},(0,e.createElement)("path",{d:"M12,2C6.477,2,2,6.477,2,12s4.477,10,10,10s10-4.477,10-10S17.523,2,12,2z M12,17L12,17c-0.552,0-1-0.448-1-1v-4 c0-0.552,0.448-1,1-1h0c0.552,0,1,0.448,1,1v4C13,16.552,12.552,17,12,17z M12.5,9h-1C11.224,9,11,8.776,11,8.5v-1 C11,7.224,11.224,7,11.5,7h1C12.776,7,13,7.224,13,7.5v1C13,8.776,12.776,9,12.5,9z"})),(0,e.createElement)("i",{className:"ct-tooltip"},(0,i.__)("Display if cookie is present","blocksy-companion")))),"request_url"===r.rule&&(0,e.createElement)("div",{className:"ct-option-input"},(0,e.createElement)("input",{type:"text",placeholder:"example=campaignID",value:r.payload.url||"",onChange:function(e){l(C(C({},r),{},{payload:C(C({},r.payload),{},{url:e.target.value})}))}}),(0,e.createElement)("span",{className:"ct-condition-info","data-tooltip-reveal":"top"},(0,e.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 24 24"},(0,e.createElement)("path",{d:"M12,2C6.477,2,2,6.477,2,12s4.477,10,10,10s10-4.477,10-10S17.523,2,12,2z M12,17L12,17c-0.552,0-1-0.448-1-1v-4 c0-0.552,0.448-1,1-1h0c0.552,0,1,0.448,1,1v4C13,16.552,12.552,17,12,17z M12.5,9h-1C11.224,9,11,8.776,11,8.5v-1 C11,7.224,11.224,7,11.5,7h1C12.776,7,13,7.224,13,7.5v1C13,8.776,12.776,9,12.5,9z"})),(0,e.createElement)("i",{className:"ct-tooltip"},(0,i.__)("Display if query string is present in URL","blocksy-companion")))),p&&p.is_custom_rule&&p.has_text_field&&(0,e.createElement)("div",{className:"ct-option-input"},(0,e.createElement)("input",{type:"text",placeholder:"",value:r.payload.value||"",onChange:function(e){l(C(C({},r),{},{payload:C(C({},r.payload),{},{value:e.target.value})}))}})),p&&p.is_custom_rule&&p.choices&&(0,e.createElement)(c.Select,{option:{appendToBody:!0,placeholder:(0,i.__)("Select value","blocksy-companion"),choices:p.choices,search:!0,inputClassName:"ct-dropdown-normal-width"},value:r.payload.value||p.choices[0].key,onChange:function(e){l(C(C({},r),{},{payload:C(C({},r.payload),{},{value:e})}))}}),(0,e.createElement)("button",{type:"button",className:"ct-remove-condition-group",onClick:function(e){e.preventDefault(),a()}},(0,e.createElement)("svg",{width:"7px",height:"7px",fill:"currentColor",viewBox:"0 0 24 24"},(0,e.createElement)("path",{d:"m12 14.7 9.3 9.3 2.7-2.7-9.3-9.3L24 2.7 21.3 0 12 9.3 2.7 0 0 2.7 9.3 12 0 21.3 2.7 24l9.3-9.3z"}))))};function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function N(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?P(Object(n),!0).forEach((function(t){d(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var S=function t(n){var o=n.conditionsListDescriptor,r=n.onChange,i=n.extractRulesIntoRoot,c=void 0===i?null:i,s=n.className,u=void 0===s?"":s,d=a((0,e.useState)(null),2),p=d[0],f=d[1],y=h(),v=y.rulesToUse,b=y.isAdvancedMode;if(0===o.conditions.length)return null;var _=o.conditions.map((function(n,a){var i=null,s="";return p!==a&&p-1!==a||(s="ct-hovered"),n.relation&&(i=(0,e.createElement)(t,{className:s,key:a,conditionsListDescriptor:n,extractRulesIntoRoot:function(e){var t=[].concat(l(n.conditions.slice(0,e-1)),l(n.conditions.slice(e+1)));r([].concat(l(o.conditions.slice(0,a)),l(n.conditions.slice(e-1,e+1)),l(t.length>0?[N(N({},n),{},{conditions:t})]:[]),l(o.conditions.slice(a+1))))},onChange:function(e){0===e.length?r([].concat(l(o.conditions.slice(0,a)),l(o.conditions.slice(a+1)))):r(o.conditions.map((function(t,n){return N({},n===a?N(N({},t),{},{conditions:e}):t)})))}})),n.relation||(i=(0,e.createElement)(j,{className:s,condition:n,onChange:function(e){r(o.conditions.map((function(t,n){return N({},n===a?e:t)})))},onAdd:function(){"OR"!==o.relation?r([].concat(l(o.conditions),[{type:"include",rule:v[0].rules[0].id,payload:{}}])):r(o.conditions.map((function(e,t){return N({},t===a?{relation:"AND",conditions:[e,{type:"include",rule:v[0].rules[0].id,payload:{}}]}:e)})))},onRemove:function(){r([].concat(l(o.conditions.slice(0,a)),l(o.conditions.slice(a+1))))}})),(0,e.createElement)(e.Fragment,{key:a},b&&a>0&&(0,e.createElement)("div",{className:m()("ct-condition-relation",{"ct-hovered":p===a})},(0,e.createElement)("ul",{onMouseEnter:function(){f(a)},onMouseLeave:function(){f(null)}},"AND"===o.relation&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("li",{onClick:function(){c&&(f(null),c(a))}},(0,e.createElement)("span",null,"OR")),(0,e.createElement)("li",{className:"active"},(0,e.createElement)("span",null,"AND"))),"OR"===o.relation&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("li",{className:"active"},(0,e.createElement)("span",null,"OR")),(0,e.createElement)("li",{onClick:function(){f(null),r([].concat(l(o.conditions.slice(0,a-1)),[{relation:"AND",conditions:o.conditions.slice(a-1,a+1).reduce((function(e,t){return[].concat(l(e),l(t.conditions?t.conditions:[t]))}),[])}],l(o.conditions.slice(a+1,o.conditions.length))))}},(0,e.createElement)("span",null,"AND"))))),i)}));return"OR"===o.relation&&1===o.conditions.length||!b?_:(0,e.createElement)("div",{className:m()("ct-relation-group",u),"data-relation":o.relation},_,"AND"===o.relation&&(0,e.createElement)("div",{className:"ct-condition-relation ct-add-and-relation"},(0,e.createElement)("span",{onClick:function(){r([].concat(l(o.conditions),[{type:"include",rule:v[0].rules[0].id,payload:{}}]))}},(0,e.createElement)("svg",{width:"8",height:"8",fill:"currentColor",viewBox:"0 0 20 20"},(0,e.createElement)("path",{d:"M20,11h-9v9H9v-9H0V9h9V0h2v9h9V11z"})))))};function D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D(Object(n),!0).forEach((function(t){d(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var L=(0,e.createContext)({allLanguages:[],remoteConditions:[]}),A=[],z=[],R=function(t){var n=t.value,o=t.onChange,r=t.filter,s=void 0===r?"all":r,u=t.addConditionButtonLabel,d=a((0,e.useState)(A),2),p=d[0],m=d[1],f=a((0,e.useState)(z),2),y=f[0],h=f[1],v=a((0,e.useState)("__EMPTY__"),2),b=v[0],_=v[1];(0,e.useEffect)((function(){fetch("".concat(wp.ajax.settings.url,"?action=blc_retrieve_conditions_data&filter=").concat(s),{headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"}).then((function(e){return e.json()})).then((function(e){var t=e.data,n=t.languages,o=t.conditions;m(n),A=n,h(o),z=o}))}),[]);var g=Array.isArray(n)?{relation:"OR",conditions:n}:n,E="__EMPTY__"!==b&&b;return g.conditions.find((function(e){return e.relation}))&&(E=!0),(0,e.createElement)(L.Provider,{value:{allLanguages:p,remoteConditions:y,isAdvancedMode:E}},(0,e.createElement)("div",{className:"ct-display-conditions"},(0,e.createElement)(S,{conditionsListDescriptor:g,onChange:function(e){o(T(T({},g),{},{conditions:e}))}}),(0,e.createElement)("div",{className:"ct-conditions-actions"},(0,e.createElement)("button",{type:"button",className:"button add-condition",onClick:function(e){e.preventDefault(),0!==y.length&&o(T(T({},g),{},{conditions:[].concat(l(g.conditions),[{type:"include",rule:y[0].rules[0].id,payload:{}}])}))}},u),(g.conditions.length>1||g.conditions.find((function(e){return e.relation})))&&(0,e.createElement)("span",null,(0,i.__)("Advanced Mode","blocksy-companion"),(0,e.createElement)(c.Switch,{value:E,onChange:function(e){g.conditions.find((function(e){return e.relation}))&&o(T(T({},g),{},{conditions:g.conditions.reduce((function(e,t){return[].concat(l(e),l(t.conditions?t.conditions:[t]))}),[])})),_(e)},option:{behavior:"boolean"}})))))},M=function(t){var n=t.option,o=n.display,r=void 0===o?"inline":o,l=n.filter,s=void 0===l?"all":l,u=n.modalTitle,d=void 0===u?(0,i.__)("Transparent Header Display Conditions","blocksy-companion"):u,p=n.modalDescription,m=void 0===p?(0,i.__)("Add one or more conditions to display the transparent header.","blocksy-companion"):p,f=n.addConditionButtonLabel,y=void 0===f?(0,i.__)("Add Display Condition","blocksy-companion"):f,h=t.value,v=t.onChange,b=a((0,e.useState)(!1),2),_=b[0],g=b[1],E=a((0,e.useState)(null),2),w=E[0],O=E[1];return"inline"===r?(0,e.createElement)(R,{filter:s,value:h,onChange:v,addConditionButtonLabel:y}):(0,e.createElement)(e.Fragment,null,(0,e.createElement)("button",{className:"button-primary",style:{width:"100%"},onClick:function(e){e.preventDefault(),g(!0),O(null)}},Object.keys(h).length>0?(0,i.__)("Edit Conditions","blocksy-companion"):(0,i.__)("Add Conditions","blocksy-companion")),(0,e.createElement)(c.Overlay,{items:_,className:"ct-admin-modal ct-builder-conditions-modal",onDismiss:function(){g(!1),O(null)},render:function(){return(0,e.createElement)("div",{className:"ct-modal-content"},(0,e.createElement)("h2",null,d),(0,e.createElement)("p",null,m),(0,e.createElement)("div",{className:"ct-modal-scroll"},(0,e.createElement)(R,{filter:s,value:w||h,onChange:function(e){O(e)},addConditionButtonLabel:y})),(0,e.createElement)("div",{className:"ct-modal-actions has-divider"},(0,e.createElement)("button",{className:"button-primary",disabled:!w,onClick:function(){v(w),g(!1)}},(0,i.__)("Save Conditions","blocksy-companion"))))}}))},F="object"===("undefined"==typeof window?"undefined":s(window))&&window.window===window?window:"object"===("undefined"==typeof self?"undefined":s(self))&&self.self===self?self:"object"===(void 0===n.g?"undefined":s(n.g))&&n.g.global===n.g?n.g:void 0;function I(e,t,n){var o=new XMLHttpRequest;o.open("GET",e),o.responseType="blob",o.onload=function(){U(o.response,t,n)},o.onerror=function(){console.error("could not download file")},o.send()}function B(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return t.status>=200&&t.status<=299}function H(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(n){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var U="object"!==("undefined"==typeof window?"undefined":s(window))||window!==F?function(){}:"download"in HTMLAnchorElement.prototype?function(e,t,n){var o=F.URL||F.webkitURL,r=document.createElement("a");t=t||e.name||"download",r.download=t,r.rel="noopener","string"==typeof e?(r.href=e,r.origin!==location.origin?B(r.href)?I(e,t,n):H(r,r.target="_blank"):H(r)):(r.href=o.createObjectURL(e),setTimeout((function(){o.revokeObjectURL(r.href)}),4e4),setTimeout((function(){H(r)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,t,n){if(t=t||e.name||"download","string"==typeof e)if(B(e))I(e,t,n);else{var o=document.createElement("a");o.href=e,o.target="_blank",setTimeout((function(){H(o)}))}else navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!==s(t)&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e}(e,n),t)}:function(e,t,n,o){if((o=o||open("","_blank"))&&(o.document.title=o.document.body.innerText="downloading..."),"string"==typeof e)return I(e,t,n);var r="application/octet-stream"===e.type,a=/constructor/i.test(F.HTMLElement)||F.safari,i=/CriOS\/[\d]+/.test(navigator.userAgent);if((i||r&&a)&&"object"===("undefined"==typeof FileReader?"undefined":s(FileReader))){var c=new FileReader;c.onloadend=function(){var e=c.result;e=i?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),o?o.location.href=e:location=e,o=null},c.readAsDataURL(e)}else{var l=F.URL||F.webkitURL,u=l.createObjectURL(e);o?o.location=u:location.href=u,o=null,setTimeout((function(){l.revokeObjectURL(u)}),4e4)}},V=U,G=n(539),Y=n.n(G),q=function(){return new Promise((function(e){var t=new FormData;t.append("action","blocksy_customizer_wipe_caches"),t.append("wp_customize","on"),fetch(window.ajaxurl,{method:"POST",body:t}).then((function(t){200===t.status&&t.json().then((function(t){t.success,t.data;e()}))}))}))},W=function(){var t=a((0,e.useState)(null),2),n=t[0],o=t[1],r=a((0,e.useState)(null),2),s=r[0],u=r[1],d=a((0,e.useState)(!1),2),p=d[0],f=d[1],y=a((0,e.useState)(!1),2),h=y[0],v=y[1],b=a((0,e.useState)(!1),2),_=b[0],g=b[1],E=a((0,e.useState)(["options"]),2),w=E[0],O=E[1],k=(0,e.useRef)(),x=(0,e.useRef)();return(0,e.useEffect)((function(){var e=function(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer.dropEffect="copy",f(!0)},t=function(e){e.stopPropagation(),e.preventDefault(),f(!1)},n=function(e){e.stopPropagation(),e.preventDefault(),f(!1);var t=Array.from(e.dataTransfer.files||[]);if(Array.from(e.dataTransfer.items||[]).length>0){var n=e.dataTransfer.items[0].getAsFile();o(n)}else t.length>0&&o(t[0])};return x.current.addEventListener("dragover",e,!1),x.current.addEventListener("dragleave",t,!1),x.current.addEventListener("drop",n,!1),function(){x.current&&(x.current.removeEventListener("dragover",e,!1),x.current.removeEventListener("dragleave",t,!1),x.current.removeEventListener("drop",n,!1))}}),[]),(0,e.createElement)("div",{className:"ct-import-export"},(0,e.createElement)("div",{className:"ct-title","data-type":"simple"},(0,e.createElement)("h3",null,(0,i.__)("Export Options","blocksy-companion")),(0,e.createElement)("div",{className:"ct-option-description"},(0,i.__)("Easily export the theme customizer settings.","blocksy-companion"))),(0,e.createElement)("div",{className:"ct-control","data-design":"block"},(0,e.createElement)("header",null),(0,e.createElement)("section",null,(0,e.createElement)("button",{className:"button-primary",onClick:function(e){e.preventDefault(),v(!0)}},(0,i.__)("Export Customizations","blocksy-companion")))),(0,e.createElement)("div",{className:"ct-title","data-type":"simple"},(0,e.createElement)("h3",null,(0,i.__)("Import Options","blocksy-companion")),(0,e.createElement)("div",{className:"ct-option-description"},(0,i.__)("Easily import the theme customizer settings.","blocksy-companion"))),(0,e.createElement)("div",{className:"ct-control","data-design":"block"},(0,e.createElement)("header",null),(0,e.createElement)("section",null,(0,e.createElement)("div",{className:"ct-file-upload"},(0,e.createElement)("div",{className:"ct-attachment"},(0,e.createElement)("button",{type:"button",className:m()("ct-upload-button",{active:p}),ref:x,onClick:function(){k.current.click()}},n?n.name:(0,i.__)("Click or drop to upload a file...","blocksy-companion"))),(0,e.createElement)("input",{ref:k,type:"file",onChange:function(e){var t=a(e.target.files,1)[0];o(t)}}),(0,e.createElement)("button",{className:m()("button-primary",{"ct-loading":_}),disabled:!n,onClick:function(e){if(e.preventDefault(),n){g(!0);var t=new FileReader;t.readAsText(n,"UTF-8"),t.onload=function(e){try{fetch("".concat(window.ajaxurl,"?action=blocksy_customizer_import&wp_customize=on&nonce=").concat(ct_customizer_localizations.customizer_reset_none),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(Y()(e.target.result))}).then((function(e){200===e.status&&e.json().then((function(e){e.success,e.data;q().then((function(){location.reload()}))}))}))}catch(e){}}}}},_?(0,e.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 100 100"},(0,e.createElement)("g",{transform:"translate(50,50)"},(0,e.createElement)("g",{transform:"scale(1)"},(0,e.createElement)("circle",{cx:"0",cy:"0",r:"50",fill:"currentColor"}),(0,e.createElement)("circle",{cx:"0",cy:"-26",r:"12",fill:"var(--ui-accent-color)",transform:"rotate(161.634)"},(0,e.createElement)("animateTransform",{attributeName:"transform",type:"rotate",calcMode:"linear",values:"0 0 0;360 0 0",keyTimes:"0;1",dur:"1s",begin:"0s",repeatCount:"indefinite"}))))):(0,i.__)("Import Customizations","blocksy-companion"))))),ct_customizer_localizations.has_child_theme&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"ct-title","data-type":"simple"},(0,e.createElement)("h3",null,(0,i.__)("Copy Options","blocksy-companion")),(0,e.createElement)("div",{className:"ct-option-description"},(0,i.__)("Copy and import your customizations from parent or child theme.","blocksy-companion"))),ct_customizer_localizations.is_parent_theme&&(0,e.createElement)("div",{className:"ct-control","data-design":"block"},(0,e.createElement)("header",null),(0,e.createElement)("section",null,(0,e.createElement)("button",{className:"button-primary",onClick:function(e){e.preventDefault(),u("child")}},(0,i.__)("Copy From Child Theme","blocksy-companion")))),!ct_customizer_localizations.is_parent_theme&&(0,e.createElement)("div",{className:"ct-control","data-design":"block"},(0,e.createElement)("header",null),(0,e.createElement)("section",null,(0,e.createElement)("button",{className:"button-primary",onClick:function(e){e.preventDefault(),u("parent")}},(0,i.__)("Copy From Parent Theme","blocksy-companion"))))),(0,e.createElement)(c.Overlay,{items:s,className:"ct-admin-modal ct-import-export-modal",onDismiss:function(){return u(!1)},render:function(){return(0,e.createElement)("div",{className:"ct-modal-content"},(0,e.createElement)("h2",{className:"ct-modal-title"},!ct_customizer_localizations.is_parent_theme&&(0,i.__)("Copy From Parent Theme","blocksy-companion"),ct_customizer_localizations.is_parent_theme&&(0,i.__)("Copy From Child Theme","blocksy-companion")),(0,e.createElement)("p",null,!ct_customizer_localizations.is_parent_theme&&(0,i.__)("You are about to copy all the settings from your parent theme into the child theme. Are you sure you want to continue?","blocksy-companion"),ct_customizer_localizations.is_parent_theme&&(0,i.__)("You are about to copy all the settings from your child theme into the parent theme. Are you sure you want to continue?","blocksy-companion")),(0,e.createElement)("div",{className:"ct-modal-actions has-divider","data-buttons":"2"},(0,e.createElement)("button",{onClick:function(e){e.preventDefault(),e.stopPropagation(),u(!1)},className:"button"},(0,i.__)("Cancel","blocksy-companion")),(0,e.createElement)("button",{className:"button button-primary",onClick:function(e){e.preventDefault();var t=new FormData;t.append("action","blocksy_customizer_copy_options"),t.append("wp_customize","on"),t.append("strategy",s);try{fetch(window.ajaxurl,{method:"POST",body:t}).then((function(e){200===e.status&&e.json().then((function(e){e.success,e.data;q().then((function(){location.reload()}))}))}))}catch(e){}}},(0,i.__)("Yes, I am sure","blocksy-companion"))))}}),(0,e.createElement)(c.Overlay,{items:h,className:"ct-admin-modal ct-export-modal",onDismiss:function(){return v(!1)},render:function(){return(0,e.createElement)("div",{className:"ct-modal-content"},(0,e.createElement)("h2",{className:"ct-modal-title"},(0,i.__)("Export Settings","blocksy-companion")),(0,e.createElement)("p",null,(0,i.__)("Choose what set of settings you want to export.","blocksy-companion")),(0,e.createElement)("div",{className:"ct-checkboxes-container","data-type":"grid:bordered"},["options","widgets"].map((function(t){return(0,e.createElement)("div",{className:"ct-checkbox-container",onClick:function(){1===w.length&&w[0]===t||O((function(e){return e.includes(t)?e.filter((function(e){return e!==t})):[].concat(l(e),[t])}))}},(0,e.createElement)("span",{className:m()("ct-checkbox",{active:w.includes(t)})},(0,e.createElement)("svg",{width:"10",height:"8",viewBox:"0 0 11.2 9.1"},(0,e.createElement)("polyline",{className:"check",points:"1.2,4.8 4.4,7.9 9.9,1.2 "}))),{options:(0,i.__)("Customizer settings","blocksy-companion"),widgets:(0,i.__)("Widgets settings","blocksy-companion")}[t])}))),(0,e.createElement)("div",{className:"ct-modal-actions has-divider","data-buttons":"2"},(0,e.createElement)("button",{onClick:function(e){e.preventDefault(),e.stopPropagation(),v(!1)},className:"button"},(0,i.__)("Cancel","blocksy-companion")),(0,e.createElement)("button",{className:"button button-primary",onClick:function(e){e.preventDefault();var t=new FormData;t.append("action","blocksy_customizer_export"),t.append("strategy",w.join(":")),t.append("wp_customize","on");try{fetch(window.ajaxurl,{method:"POST",body:t}).then((function(e){200===e.status&&e.json().then((function(e){var t=e.success,n=e.data;if(t){var o=new Blob([n.data],{type:"application/octet-stream;charset=utf-8"});V(o,"".concat(n.site_url.replace("http://","").replace("https://","").replace(".","-").replace("/","-"),"-export.dat")),v(!1)}}))}))}catch(e){}}},(0,i.__)("Export","blocksy-companion"))))}}))},J=window.ctEvents,X=n.n(J),K=window.wp.hooks;function $(e,t,n,o,r,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(o,r)}var Q=n(687),Z=n.n(Q),ee=n(459),te=n.n(ee),ne=n(616),oe=n.n(ne),re=n(382),ae=n.n(re),ie=oe()(),ce=function(t){t.forcedEdit;var n,o,r=t.headerId,s=a((0,e.useState)(!1),2),u=s[0],p=s[1],m=a((0,e.useState)(null),2),f=m[0],y=m[1],h=(0,e.useContext)(c.PlacementsDragDropContext),v=(h.builderValueCollection,h.builderValueDispatch,(0,e.useRef)()),b=ae()(ie),_=te()("".concat(blocksy_admin.ajax_url,"?action=blocksy_header_get_all_conditions"),{method:"POST",formatter:(n=Z().mark((function e(t){var n,o,r;return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.json();case 2:if(n=e.sent,o=n.success,r=n.data,o&&r.conditions){e.next=7;break}throw new Error;case 7:return e.abrupt("return",r.conditions);case 8:case"end":return e.stop()}}),e)})),o=function(){var e=this,t=arguments;return new Promise((function(o,r){var a=n.apply(e,t);function i(e){$(a,o,r,i,c,"next",e)}function c(e){$(a,o,r,i,c,"throw",e)}i(void 0)}))},function(e){return o.apply(this,arguments)}),depends:[b]}),g=_.data,E=_.isLoading;_.error;return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("button",{className:"button-primary",style:{width:"100%"},onClick:function(e){e.preventDefault(),e.stopPropagation(),E||p(!0)}},(0,i.__)("Add/Edit Conditions","blocksy-companion")),(0,e.createElement)(c.Overlay,{items:u,initialFocusRef:v,className:"ct-admin-modal ct-builder-conditions-modal",onDismiss:function(){p(!1),y(null)},render:function(){var t;return(0,e.createElement)("div",{className:"ct-modal-content",ref:v},(0,e.createElement)("h2",null,sprintf((0,i.__)("Display Conditions","blocksy-companion"))),(0,e.createElement)("p",null,(0,i.__)("Add one or more conditions in order to display your header.","blocksy-companion")),(0,e.createElement)("div",{className:"ct-modal-scroll"},(0,e.createElement)(c.OptionsPanel,{onChange:function(e,t){y((function(e){return[].concat(l((e||g).filter((function(e){return e.id!==r}))),[{id:r,conditions:t}])}))},options:{conditions:(t={type:"blocksy-display-condition",design:"none",value:[]},d(t,"design","none"),d(t,"label",!1),t)},value:{conditions:((f||g).find((function(e){return e.id===r}))||{conditions:[]}).conditions},hasRevertButton:!1})),(0,e.createElement)("div",{className:"ct-modal-actions has-divider"},(0,e.createElement)("button",{className:"button-primary",disabled:!f,onClick:function(){fetch("".concat(wp.ajax.settings.url,"?action=blocksy_header_update_all_conditions"),{headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST",body:JSON.stringify(f)}).then((function(e){return e.json()})).then((function(){ie(),p(!1)}))}},(0,i.__)("Save Conditions","blocksy-companion"))))}}))};function le(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function se(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?le(Object(n),!0).forEach((function(t){d(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):le(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ue=function(){var n=a((0,e.useState)(!1),2),o=n[0],r=n[1],l=(ct_customizer_localizations.header_builder_data.secondary_items.header,ct_customizer_localizations.header_builder_data.header,(0,e.useContext)(c.PlacementsDragDropContext)),s=l.builderValueDispatch,u=l.builderValue,d=(l.option,l.builderValueCollection),p=l.panelsActions,f=(0,K.applyFilters)("blocksy.header.available-sections",null,d.sections)||d.sections.filter((function(e){var t=e.id;return"type-2"!==t&&"type-3"!==t&&-1===t.indexOf("ct-custom")}));return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("ul",{className:m()("ct-panels-manager")},f.map((function(t){var n=t.name,o=t.id,a=n||{"type-1":(0,i.__)("Global Header","blocksy-companion")}[o]||o,l="builder_header_panel_".concat(o),d=ct_customizer_localizations.header_builder_data.header_data.header_options,f={label:a,"inner-options":se(se({},o.indexOf("ct-custom")>-1?{conditions_button:{label:(0,i.__)("Edit Conditions","blocksy-companion"),type:"jsx",design:"block",render:function(){return(0,e.createElement)(ce,{headerId:o})}},divider:{type:"ct-divider"}}:{}),d)};return(0,e.createElement)(c.PanelMetaWrapper,v({id:l,key:o,option:f},p,{getActualOption:function(t){var n=t.open;return(0,e.createElement)(e.Fragment,null,o===u.id&&(0,e.createElement)(c.Panel,{id:l,getValues:function(){return se({id:o},u.settings||{})},option:f,onChangeFor:function(e,t){s({type:"BUILDER_GLOBAL_SETTING_ON_CHANGE",payload:{optionId:e,optionValue:t,values:(0,c.getValueFromInput)(d,Array.isArray(u.settings)?{}:u.settings||{})}})},view:"simple"}),(0,e.createElement)("li",{className:m()({active:o===u.id,"ct-global":"type-1"===o}),onClick:function(){o===u.id?n():s({type:"PICK_BUILDER_SECTION",payload:{id:o}})}},(0,e.createElement)("span",{className:"ct-panel-name"},a),o.indexOf("ct-custom")>-1&&o!==u.id&&(0,e.createElement)("span",{className:"ct-remove-instance","data-tooltip-reveal":"top",onClick:function(e){e.preventDefault(),e.stopPropagation(),r(o)}},(0,e.createElement)("svg",{width:"11px",height:"11px",viewBox:"0 0 24 24"},(0,e.createElement)("path",{d:"M9.6,0l0,1.2H1.2v2.4h21.6V1.2h-8.4l0-1.2H9.6z M2.8,6l1.8,15.9C4.8,23.1,5.9,24,7.1,24h9.9c1.2,0,2.2-0.9,2.4-2.1L21.2,6H2.8z"})),(0,e.createElement)("i",{className:"ct-tooltip"},(0,i.__)("Remove header","blocksy-companion")))))}}))}))),(0,e.createElement)(t.Slot,{name:"PlacementsBuilderPanelsManagerAfter"},(function(e){return 0===e.length?null:e})),(0,e.createElement)(c.Overlay,{items:o,className:"ct-admin-modal ct-reset-options",onDismiss:function(){return r(!1)},render:function(){return(0,e.createElement)("div",{className:"ct-modal-content"},(0,e.createElement)("h2",{className:"ct-modal-title"},(0,i.__)("Remove Header","blocksy-companion")),(0,e.createElement)("p",null,(0,i.__)("You are about to remove a custom header, are you sure you want to continue?","blocksy-companion")),(0,e.createElement)("div",{className:"ct-modal-actions has-divider","data-buttons":"2"},(0,e.createElement)("button",{onClick:function(e){e.preventDefault(),e.stopPropagation(),r(!1)},className:"button"},(0,i.__)("Cancel","blocksy-companion")),(0,e.createElement)("button",{className:"button button-primary",onClick:function(e){e.preventDefault(),s({type:"REMOVE_BUILDER_SECTION",payload:{id:o}}),r(!1)}},(0,i.__)("Confirm","blocksy-companion"))))}}))};X().on("blocksy:options:before-option",(function(n){if(n.option&&"ct-header-builder"===n.option.type){var o=n.content;n.content=(0,e.createElement)(e.Fragment,null,o,(0,e.createElement)(t.Fill,{name:"PlacementsBuilderPanelsManager"},(0,e.createElement)(ue,null)))}})),X().on("blocksy:options:register",(function(e){e["blocksy-display-condition"]=M,e["blocksy-customizer-options-manager"]=W}))}()}();