!function(){var e={763(e,t){var n,o,a;
/*!
* 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(){"use strict";o=[],void 0===(a="function"==typeof(n=function(){return function(e){var t,n=0,o=[],a=0,c=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)},r=function(){var e=i();return o[a++]=e,e},l=function(){var t=e.indexOf(";",n),c=e.substring(n,t);return n=t+1,c=parseFloat(c),o[a++]=c,c},s=function(){var t=e.indexOf(";",n),c=e.substring(n,t);return n=t+1,c="1"===c,o[a++]=c,c},u=function(t){t=void 0!==t?t:'"';for(var o,a,i=c(),r=0,l=0;l2047?3:2;return e.charAt(n+r)!==t&&(r+=e.indexOf('"',n+r)-n-r),a=e.substring(n,n+r),n+=r+2,a},d=function(){var e=u();return o[a++]=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))}},y=function(){var e,i,r,l,s,u=c(),d=[],p={},y=d,f=a++;o[f]=y;try{for(r=0;r0)return o=e.substring(1,c),a=e.substr(c+1),"*"===o||t===o?a:o+"::"+a;var i="Expected two characters in non-public property name '"+e+"' at position "+(n-e.length-2);throw new Error(i)}return e},_=function(){var e,i,r,l,s={},d=a++,p=u();o[d]=s,e=c();try{for(l=0;l0&&a.find(function(e){return e.id===t.rule})?t.rule:o,value:n,sub_ids:a,...c}]},[]),rulesToUse:c,allLanguages:a}};function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t(n.payload.end?new Date(n.payload.end).getTime():(new Date).getTime())&&(n.payload.end=e),t({...n,payload:{...n.payload,...n.payload.start?{}:{start:y},[c]:e}})}})),document.body))},u=window.wp.date;var d=function({onChange:n,condition:c}){const r=(0,e.useRef)(),[s,d]=(0,e.useState)(!1),{styles:p,popoverProps:m}=(0,a.usePopoverMaker)({ref:r,defaultHeight:228,shouldCalculate:!0}),y={monday:!0,tuesday:!0,wednesday:!0,thursday:!0,friday:!0,saturday:!0,sunday:!0},f=Object.keys(y).filter(function(e){return(c.payload.days||y)[e]});let _="Only "+f.map(function(e){return function(e){return{monday:(0,o.__)("Mon","blocksy-companion"),tuesday:(0,o.__)("Tue","blocksy-companion"),wednesday:(0,o.__)("Wed","blocksy-companion"),thursday:(0,o.__)("Thu","blocksy-companion"),friday:(0,o.__)("Fri","blocksy-companion"),saturday:(0,o.__)("Sat","blocksy-companion"),sunday:(0,o.__)("Sun","blocksy-companion")}[e]}(e)}).join(", ");7===f.length&&(_=(0,o.__)("Every day","blocksy-companion")),2===f.length&&f.includes("saturday")&&f.includes("sunday")&&(_=(0,o.__)("Only weekends","blocksy-companion")),5!==f.length||f.includes("saturday")||f.includes("sunday")||(_=(0,o.__)("Only weekdays","blocksy-companion")),0===f.length&&(_=(0,o.__)("Never","blocksy-companion"));const h=c.payload.time_start||"00:00",v=c.payload.time_end||"23:59",b=new Date;b.setHours(h.split(":")[0]),b.setMinutes(h.split(":")[1],0,0);const g=new Date;g.setHours(v.split(":")[0]),g.setMinutes(v.split(":")[1],0,0);const E=(0,u.getSettings)(),k=/a(?!\\)/i.test(E.formats.time.toLowerCase().replace(/\\\\/g,"").split("").reverse().join(""));return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(a.OutsideClickHandler,{className:"ct-select-input",wrapperProps:{ref:r,role:"combobox","aria-expanded":s,"aria-haspopup":"listbox",onClick:function(){d(!s)}},onOutsideClick:function(e){e.target.closest(".ct-select-dropdown")||d(!1)}},(0,e.createElement)("input",{value:_,onChange:function(){},readOnly:!0})),s&&(0,e.createPortal)((0,e.createElement)("div",l({className:i()("ct-select-dropdown ct-recurring-scheduling-dropdown",{"ct-fixed":!0})},m,{style:p}),(0,e.createElement)("div",{className:"ct-recurring-scheduling-days"},(0,e.createElement)("label",{className:"ct-label"},(0,o.__)("Recurring Days","blocksy-companion")),[{key:"monday",value:(0,o.__)("Monday","blocksy-companion")},{key:"tuesday",value:(0,o.__)("Tuesday","blocksy-companion")},{key:"wednesday",value:(0,o.__)("Wednesday","blocksy-companion")},{key:"thursday",value:(0,o.__)("Thursday","blocksy-companion")},{key:"friday",value:(0,o.__)("Friday","blocksy-companion")},{key:"saturday",value:(0,o.__)("Saturday","blocksy-companion")},{key:"sunday",value:(0,o.__)("Sunday","blocksy-companion")}].map(function({key:o,value:a}){return(0,e.createElement)(t.CheckboxControl,{label:a,checked:(c.payload.days||y)[o],onChange:function(){n({...c,payload:{...c.payload,days:{...c.payload.days||y,[o]:!(c.payload.days||y)[o]}}})}})})),(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,o.__)("Start Time","blocksy-companion")),(0,e.createElement)(t.TimePicker,{is12Hour:k,currentTime:b,onChange:function(e){n({...c,payload:{...c.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,o.__)("Stop Time","blocksy-companion")),(0,e.createElement)(t.TimePicker,{is12Hour:k,currentTime:g,onChange:function(e){n({...c,payload:{...c.payload,time_end:wp.date.format("H:i",e)}})}})))),document.body))};var p=function({className:t="",condition:n,onRemove:c,onChange:l}){n={...n,payload:{...n.payload}};const{allRules:u,allLanguages:p}=r(n),m=u.find(function({key:e}){return e===n.rule}),y="post_ids"===n.rule||"page_ids"===n.rule||"product_ids"===n.rule||"custom_post_type_ids"===n.rule||"taxonomy_ids"===n.rule||"post_with_taxonomy_ids"===n.rule||"card_product_with_taxonomy_ids"===n.rule||"card_post_with_taxonomy_ids"===n.rule||"product_with_taxonomy_ids"===n.rule||"product_taxonomy_ids"===n.rule||"current_language"===n.rule||"user_post_author_id"===n.rule||"author"===n.rule||"start_end_date"===n.rule||"schedule_date"===n.rule||"request_referer"===n.rule||"request_cookie"===n.rule||"request_url"===n.rule||m&&m.sub_ids&&m.sub_ids.length>0||m&&m.is_custom_rule&&m.has_text_field||m&&m.is_custom_rule&&m.choices;return(0,e.createElement)("div",{className:i()("ct-condition-group",t,{"ct-cols-3":y,"ct-cols-2":!y})},(0,e.createElement)(a.Select,{key:"first",option:{inputClassName:"ct-condition-type",selectInputStart:function(){return"include"===n.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"===n.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,o.__)("Select variation","blocksy-companion"),choices:{include:(0,o.__)("Include","blocksy-companion"),exclude:(0,o.__)("Exclude","blocksy-companion")}},value:n.type,onChange:function(e){l({...n,type:e})}}),(0,e.createElement)(a.Select,{key:"second",option:{appendToBody:!0,placeholder:(0,o.__)("Select rule","blocksy-companion"),choices:u,search:!0},value:n.rule,onChange:function(e){const t=u.find(function({key:t}){return t===e});t.sub_ids&&t.sub_ids.length>0?l({...n,rule:t.sub_ids[0].id}):l({...n,rule:e})}}),("post_ids"===n.rule||"custom_post_type_ids"===n.rule||"product_ids"===n.rule||"page_ids"===n.rule)&&(0,e.createElement)(a.EntityIdPicker,{option:{placeholder:"post_ids"===n.rule?(0,o.__)("Select post","blocksy-companion"):"page_ids"===n.rule?(0,o.__)("Select page","blocksy-companion"):"product_ids"===n.rule?(0,o.__)("Select product","blocksy-companion"):(0,o.__)("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"}[n.rule]},value:(n.payload||{}).post_id||"",onChange:function(e){l({...n,payload:{...n.payload,post_id:e}})}}),("taxonomy_ids"===n.rule||"post_with_taxonomy_ids"===n.rule||"card_post_with_taxonomy_ids"===n.rule)&&(0,e.createElement)(a.EntityIdPicker,{option:{placeholder:(0,o.__)("Select taxonomy","blocksy-companion"),entity:"taxonomies"},value:(n.payload||{}).taxonomy_id||"",onChange:function(e){l({...n,payload:{...n.payload,taxonomy_id:e}})}}),("product_with_taxonomy_ids"===n.rule||"product_taxonomy_ids"===n.rule||"card_product_with_taxonomy_ids"===n.rule)&&(0,e.createElement)(a.EntityIdPicker,{option:{placeholder:(0,o.__)("Select taxonomy","blocksy-companion"),entity:"taxonomies",post_type:"product"},value:(n.payload||{}).taxonomy_id||"",onChange:function(e){l({...n,payload:{...n.payload,taxonomy_id:e}})}}),"current_language"===n.rule&&(0,e.createElement)(a.Select,{option:{appendToBody:!0,defaultToFirstItem:!1,placeholder:(0,o.__)("Select language","blocksy-companion"),choices:p.map(function(e){return{key:e.id,value:e.name}}),search:!0},value:(n.payload||{}).language||"",onChange:function(e){l({...n,payload:{...n.payload,language:e}})}}),"user_post_author_id"===n.rule&&(0,e.createElement)(a.EntityIdPicker,{option:{placeholder:(0,o.__)("Select user","blocksy-companion"),entity:"users",additionOptions:[{key:"current_user",value:(0,o.__)("Current user","blocksy-companion")}]},value:(n.payload||{}).user_id||"",onChange:function(e){l({...n,payload:{...n.payload,user_id:e}})}}),"author"===n.rule&&(0,e.createElement)(a.EntityIdPicker,{option:{placeholder:(0,o.__)("Select user","blocksy-companion"),entity:"users",additionOptions:[{key:"all_users",value:(0,o.__)("All authors","blocksy-companion")}]},value:(n.payload||{}).user_id||"all_users",onChange:function(e){l({...n,payload:{...n.payload,user_id:e}})}}),m&&m.sub_ids&&m.sub_ids.length>0&&(0,e.createElement)(a.Select,{option:{appendToBody:!0,placeholder:(0,o.__)("Select sub field","blocksy-companion"),choices:m.sub_ids.map(function(e){return{key:e.id,value:e.title}}),search:!0,inputClassName:"ct-dropdown-normal-width"},value:n.rule,onChange:function(e){l({...n,rule:e})}}),"start_end_date"===n.rule&&(0,e.createElement)(s,{condition:n,onChange:l}),"schedule_date"===n.rule&&(0,e.createElement)(d,{condition:n,onChange:l}),"request_referer"===n.rule&&(0,e.createElement)("div",{className:"ct-option-input"},(0,e.createElement)("input",{type:"text",placeholder:"website.com",value:n.payload.referer,onChange:function(e){l({...n,payload:{...n.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,o.__)("Display based on referer domain","blocksy-companion")))),"request_cookie"===n.rule&&(0,e.createElement)("div",{className:"ct-option-input"},(0,e.createElement)("input",{type:"text",placeholder:"cookie_name",value:(n.payload||{}).cookie||"",onChange:function(e){l({...n,payload:{...n.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,o.__)("Display if cookie is present","blocksy-companion")))),"request_url"===n.rule&&(0,e.createElement)("div",{className:"ct-option-input"},(0,e.createElement)("input",{type:"text",placeholder:"example=campaignID",value:n.payload.url||"",onChange:function(e){l({...n,payload:{...n.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,o.__)("Display if query string is present in URL","blocksy-companion")))),m&&m.is_custom_rule&&m.has_text_field&&(0,e.createElement)("div",{className:"ct-option-input"},(0,e.createElement)("input",{type:"text",placeholder:"",value:n.payload.value||"",onChange:function(e){l({...n,payload:{...n.payload,value:e.target.value}})}})),m&&m.is_custom_rule&&m.choices&&(0,e.createElement)(a.Select,{option:{appendToBody:!0,placeholder:(0,o.__)("Select value","blocksy-companion"),choices:m.choices,search:!0,inputClassName:"ct-dropdown-normal-width"},value:n.payload.value||m.choices[0].key,onChange:function(e){l({...n,payload:{...n.payload,value:e}})}}),(0,e.createElement)("button",{type:"button",className:"ct-remove-condition-group",onClick:function(e){e.preventDefault(),c()}},(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"}))))};const m=function({conditionsListDescriptor:t,onChange:n,extractRulesIntoRoot:o=null,className:a=""}){const[c,l]=(0,e.useState)(null),{rulesToUse:s,isAdvancedMode:u}=r();if(0===t.conditions.length)return null;const d=t.conditions.map(function(a,r){let d=null,y="";return c!==r&&c-1!==r||(y="ct-hovered"),a.relation&&(d=(0,e.createElement)(m,{className:y,key:r,conditionsListDescriptor:a,extractRulesIntoRoot:function(e){const o=[...a.conditions.slice(0,e-1),...a.conditions.slice(e+1)];n([...t.conditions.slice(0,r),...a.conditions.slice(e-1,e+1),...o.length>0?[{...a,conditions:o}]:[],...t.conditions.slice(r+1)])},onChange:function(e){0===e.length?n([...t.conditions.slice(0,r),...t.conditions.slice(r+1)]):n(t.conditions.map(function(t,n){return{...n===r?{...t,conditions:e}:t}}))}})),a.relation||(d=(0,e.createElement)(p,{className:y,condition:a,onChange:function(e){n(t.conditions.map(function(t,n){return{...n===r?e:t}}))},onAdd:function(){"OR"!==t.relation?n([...t.conditions,{type:"include",rule:s[0].rules[0].id,payload:{}}]):n(t.conditions.map(function(e,t){return{...t===r?{relation:"AND",conditions:[e,{type:"include",rule:s[0].rules[0].id,payload:{}}]}:e}}))},onRemove:function(){n([...t.conditions.slice(0,r),...t.conditions.slice(r+1)])}})),(0,e.createElement)(e.Fragment,{key:r},u&&r>0&&(0,e.createElement)("div",{className:i()("ct-condition-relation",{"ct-hovered":c===r})},(0,e.createElement)("ul",{onMouseEnter:function(){l(r)},onMouseLeave:function(){l(null)}},"AND"===t.relation&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("li",{onClick:function(){o&&(l(null),o(r))}},(0,e.createElement)("span",null,"OR")),(0,e.createElement)("li",{className:"active"},(0,e.createElement)("span",null,"AND"))),"OR"===t.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(){l(null),n([...t.conditions.slice(0,r-1),{relation:"AND",conditions:t.conditions.slice(r-1,r+1).reduce(function(e,t){return[...e,...t.conditions?t.conditions:[t]]},[])},...t.conditions.slice(r+1,t.conditions.length)])}},(0,e.createElement)("span",null,"AND"))))),d)});return"OR"===t.relation&&1===t.conditions.length||!u?d:(0,e.createElement)("div",{className:i()("ct-relation-group",a),"data-relation":t.relation},d,"AND"===t.relation&&(0,e.createElement)("div",{className:"ct-condition-relation ct-add-and-relation"},(0,e.createElement)("span",{onClick:function(){n([...t.conditions,{type:"include",rule:s[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"})))))};var y=m;const f=(0,e.createContext)({allLanguages:[],remoteConditions:[]});let _=[],h=[];var v=function({value:t,onChange:n,filter:c="all",addConditionButtonLabel:i}){const[r,l]=(0,e.useState)(_),[s,u]=(0,e.useState)(h),[d,p]=(0,e.useState)("__EMPTY__");(0,e.useEffect)(function(){fetch(`${wp.ajax.settings.url}?action=blc_retrieve_conditions_data&filter=${c}`,{headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"}).then(function(e){return e.json()}).then(function({data:{languages:e,conditions:t}}){l(e),_=e,u(t),h=t})},[]);const m=Array.isArray(t)?{relation:"OR",conditions:t}:t;let v="__EMPTY__"!==d&&d;return m.conditions.find(function(e){return e.relation})&&(v=!0),(0,e.createElement)(f.Provider,{value:{allLanguages:r,remoteConditions:s,isAdvancedMode:v}},(0,e.createElement)("div",{className:"ct-display-conditions"},(0,e.createElement)(y,{conditionsListDescriptor:m,onChange:function(e){n({...m,conditions:e})}}),(0,e.createElement)("div",{className:"ct-conditions-actions"},(0,e.createElement)("button",{type:"button",className:"ct-ui-button add-condition",onClick:function(e){e.preventDefault(),0!==s.length&&n({...m,conditions:[...m.conditions,{type:"include",rule:s[0].rules[0].id,payload:{}}]})}},i),(m.conditions.length>1||m.conditions.find(function(e){return e.relation}))&&(0,e.createElement)("span",null,(0,o.__)("Advanced Mode","blocksy-companion"),(0,e.createElement)(a.Switch,{value:v,onChange:function(e){m.conditions.find(function(e){return e.relation})&&n({...m,conditions:m.conditions.reduce(function(e,t){return[...e,...t.conditions?t.conditions:[t]]},[])}),p(e)},option:{behavior:"boolean"}})))))};var b=function({option:{display:t="inline",filter:n="all",modalTitle:c=(0,o.__)("Transparent Header Display Conditions","blocksy-companion"),modalDescription:i=(0,o.__)("Add one or more conditions to display the transparent header.","blocksy-companion"),addConditionButtonLabel:r=(0,o.__)("Add Display Condition","blocksy-companion")},value:l,onChange:s}){const[u,d]=(0,e.useState)(!1),[p,m]=(0,e.useState)(null);return"inline"===t?(0,e.createElement)(v,{filter:n,value:l,onChange:s,addConditionButtonLabel:r}):(0,e.createElement)(e.Fragment,null,(0,e.createElement)("button",{className:"ct-ui-button ct-ui-button-primary",style:{width:"100%"},onClick:function(e){e.preventDefault(),d(!0),m(null)}},Object.keys(l).length>0?(0,o.__)("Edit Conditions","blocksy-companion"):(0,o.__)("Add Conditions","blocksy-companion")),(0,e.createElement)(a.Overlay,{items:u,className:"ct-admin-modal ct-builder-conditions-modal",onDismiss:function(){d(!1),m(null)},render:function(){return(0,e.createElement)("div",{className:"ct-modal-content"},(0,e.createElement)("h2",null,c),(0,e.createElement)("p",null,i),(0,e.createElement)("div",{className:"ct-modal-scroll"},(0,e.createElement)(v,{filter:n,value:p||l,onChange:function(e){m(e)},addConditionButtonLabel:r})),(0,e.createElement)("div",{className:"ct-modal-actions has-divider"},(0,e.createElement)("button",{className:"ct-ui-button ct-ui-button-primary",disabled:!p,onClick:function(){s(p),d(!1)}},(0,o.__)("Save Conditions","blocksy-companion"))))}}))},g="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof globalThis&&globalThis.global===globalThis?globalThis:void 0;function E(e,t,n){var o=new XMLHttpRequest;o.open("GET",e),o.responseType="blob",o.onload=function(){C(o.response,t,n)},o.onerror=function(){console.error("could not download file")},o.send()}function k(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return t.status>=200&&t.status<=299}function w(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 C="object"!=typeof window||window!==g?function(){}:"download"in HTMLAnchorElement.prototype?function(e,t,n){var o=g.URL||g.webkitURL,a=document.createElement("a");t=t||e.name||"download",a.download=t,a.rel="noopener","string"==typeof e?(a.href=e,a.origin!==location.origin?k(a.href)?E(e,t,n):w(a,a.target="_blank"):w(a)):(a.href=o.createObjectURL(e),setTimeout(function(){o.revokeObjectURL(a.href)},4e4),setTimeout(function(){w(a)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,n){if(t=t||e.name||"download","string"==typeof e)if(k(e))E(e,t,n);else{var o=document.createElement("a");o.href=e,o.target="_blank",setTimeout(function(){w(o)})}else navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof 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 E(e,t,n);var a="application/octet-stream"===e.type,c=/constructor/i.test(g.HTMLElement)||g.safari,i=/CriOS\/[\d]+/.test(navigator.userAgent);if((i||a&&c)&&"object"==typeof FileReader){var r=new FileReader;r.onloadend=function(){var e=r.result;e=i?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),o?o.location.href=e:location=e,o=null},r.readAsDataURL(e)}else{var l=g.URL||g.webkitURL,s=l.createObjectURL(e);o?o.location=s:location.href=s,o=null,setTimeout(function(){l.revokeObjectURL(s)},4e4)}},x=C,N=n(763),O=n.n(N);const S=function(e){const t=e.replace(/s:(\d+):"((?:\\.|[^"\\])*)";/g,function(e,t,n){if(n.includes("\n"))return`s:${t}:"${n}";`;var o;return`s:${o=n,"undefined"!=typeof TextEncoder?(new TextEncoder).encode(o).length:unescape(encodeURIComponent(o)).length}:"${n}";`});return O()(t)},T=function(){return new Promise(function(e){const 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({success:t,data:n}){e()})})})};var D=function(){const[t,n]=(0,e.useState)(null),[c,r]=(0,e.useState)(null),[l,s]=(0,e.useState)(!1),[u,d]=(0,e.useState)(!1),[p,m]=(0,e.useState)(!1),[y,f]=(0,e.useState)(["options"]),_=(0,e.useRef)(),h=(0,e.useRef)();return(0,e.useEffect)(function(){const e=function(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer.dropEffect="copy",s(!0)},t=function(e){e.stopPropagation(),e.preventDefault(),s(!1)},o=function(e){e.stopPropagation(),e.preventDefault(),s(!1);const t=Array.from(e.dataTransfer.files||[]);if(Array.from(e.dataTransfer.items||[]).length>0){const t=e.dataTransfer.items[0].getAsFile();n(t)}else t.length>0&&n(t[0])};return h.current.addEventListener("dragover",e,!1),h.current.addEventListener("dragleave",t,!1),h.current.addEventListener("drop",o,!1),function(){h.current&&(h.current.removeEventListener("dragover",e,!1),h.current.removeEventListener("dragleave",t,!1),h.current.removeEventListener("drop",o,!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,o.__)("Export Options","blocksy-companion")),(0,e.createElement)("div",{className:"ct-option-description"},(0,o.__)("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:"ct-ui-button ct-ui-button-primary",onClick:function(e){e.preventDefault(),d(!0)}},(0,o.__)("Export Customizations","blocksy-companion")))),(0,e.createElement)("div",{className:"ct-title","data-type":"simple"},(0,e.createElement)("h3",null,(0,o.__)("Import Options","blocksy-companion")),(0,e.createElement)("div",{className:"ct-option-description"},(0,o.__)("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:i()("ct-upload-button",{active:l}),ref:h,onClick:function(){_.current.click()}},t?t.name:(0,o.__)("Click or drop to upload a file...","blocksy-companion"))),(0,e.createElement)("input",{ref:_,type:"file",onChange:function({target:{files:[e]}}){n(e)}}),(0,e.createElement)("button",{className:i()("ct-ui-button ct-ui-button-primary",{"ct-loading":p}),disabled:!t,onClick:function(e){if(e.preventDefault(),t){m(!0);var n=new FileReader;n.readAsText(t,"UTF-8"),n.onload=function(e){const t=S(e.target.result);try{fetch(`${window.ajaxurl}?action=blocksy_customizer_import&wp_customize=on&nonce=${ct_customizer_localizations.customizer_reset_none}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)}).then(function(e){200===e.status&&e.json().then(function({success:e,data:t}){T().then(function(){location.reload()})})})}catch(e){}}}}},p?(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,o.__)("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,o.__)("Copy Options","blocksy-companion")),(0,e.createElement)("div",{className:"ct-option-description"},(0,o.__)("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(),r("child")}},(0,o.__)("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(),r("parent")}},(0,o.__)("Copy From Parent Theme","blocksy-companion"))))),(0,e.createElement)(a.Overlay,{items:c,className:"ct-admin-modal ct-import-export-modal",onDismiss:function(){return r(!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,o.__)("Copy From Parent Theme","blocksy-companion"),ct_customizer_localizations.is_parent_theme&&(0,o.__)("Copy From Child Theme","blocksy-companion")),(0,e.createElement)("p",null,!ct_customizer_localizations.is_parent_theme&&(0,o.__)("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,o.__)("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(),r(!1)},className:"button"},(0,o.__)("Cancel","blocksy-companion")),(0,e.createElement)("button",{className:"button button-primary",onClick:function(e){e.preventDefault();const t=new FormData;t.append("action","blocksy_customizer_copy_options"),t.append("wp_customize","on"),t.append("strategy",c);try{fetch(`${window.ajaxurl}?nonce=${ct_customizer_localizations.customizer_reset_none}`,{method:"POST",body:t}).then(function(e){200===e.status&&e.json().then(function({success:e,data:t}){T().then(function(){location.reload()})})})}catch(e){}}},(0,o.__)("Yes, I am sure","blocksy-companion"))))}}),(0,e.createElement)(a.Overlay,{items:u,className:"ct-admin-modal ct-export-modal",onDismiss:function(){return d(!1)},render:function(){return(0,e.createElement)("div",{className:"ct-modal-content"},(0,e.createElement)("h2",{className:"ct-modal-title"},(0,o.__)("Export Settings","blocksy-companion")),(0,e.createElement)("p",null,(0,o.__)("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===y.length&&y[0]===t||f(function(e){return e.includes(t)?e.filter(function(e){return e!==t}):[...e,t]})}},(0,e.createElement)("span",{className:i()("ct-checkbox",{active:y.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,o.__)("Customizer settings","blocksy-companion"),widgets:(0,o.__)("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(),d(!1)},className:"button"},(0,o.__)("Cancel","blocksy-companion")),(0,e.createElement)("button",{className:"button button-primary",onClick:function(e){e.preventDefault();const t=new FormData;t.append("action","blocksy_customizer_export"),t.append("strategy",y.join(":")),t.append("wp_customize","on");try{fetch(`${window.ajaxurl}?nonce=${ct_customizer_localizations.customizer_reset_none}`,{method:"POST",body:t}).then(function(e){200===e.status&&e.json().then(function({success:e,data:t}){if(e){var n=new Blob([t.data],{type:"application/octet-stream;charset=utf-8"});x(n,`${t.site_url.replace("http://","").replace("https://","").replace(".","-").replace("/","-")}-export.dat`),d(!1)}})})}catch(e){}}},(0,o.__)("Export","blocksy-companion"))))}}))},z=window.ctEvents,P=n.n(z),j=window.wp.hooks,L=n(523),A=n.n(L);let R=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&n[e]];return t};const M=((F=function(){F.id=R(),F.subscribers.forEach(function(e){e()})}).id=R(),F.subscribers=[],F.subscribe=function(e){F.subscribers.push(e)},F.unsubscribe=function(e){F.subscribers.indexOf(e)>=0&&F.subscribers.splice(F.subscribers.indexOf(e),1)},F);var F;var B=function({forcedEdit:t=!1,headerId:n}){const[c,i]=(0,e.useState)(!1),[r,l]=(0,e.useState)(null),{builderValueCollection:s,builderValueDispatch:u}=(0,e.useContext)(a.PlacementsDragDropContext),d=(0,e.useRef)(),p=function(t){const n=(0,e.useState)(t.id);var o=function(){return n[1](t.id)};return(0,e.useEffect)(function(){return t.subscribe(o),function(){return t.unsubscribe(o)}},[]),n[0]}(M),{data:m,isLoading:y,error:f}=A()(`${blocksy_admin.ajax_url}?action=blocksy_header_get_all_conditions`,{method:"POST",formatter:async function(e){const{success:t,data:n}=await e.json();if(!t||!n.conditions)throw new Error;return n.conditions},depends:[p]});return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("button",{className:"button-primary",style:{width:"100%"},onClick:function(e){e.preventDefault(),e.stopPropagation(),y||i(!0)}},(0,o.__)("Add/Edit Conditions","blocksy-companion")),(0,e.createElement)(a.Overlay,{items:c,initialFocusRef:d,className:"ct-admin-modal ct-builder-conditions-modal",onDismiss:function(){i(!1),l(null)},render:function(){return(0,e.createElement)("div",{className:"ct-modal-content",ref:d},(0,e.createElement)("h2",null,sprintf((0,o.__)("Display Conditions","blocksy-companion"))),(0,e.createElement)("p",null,(0,o.__)("Add one or more conditions in order to display your header.","blocksy-companion")),(0,e.createElement)("div",{className:"ct-modal-scroll"},(0,e.createElement)(a.OptionsPanel,{onChange:function(e,t){l(function(e){return[...(e||m).filter(function({id:e}){return e!==n}),{id:n,conditions:t}]})},options:{conditions:{type:"blocksy-display-condition",design:"none",value:[],design:"none",label:!1}},value:{conditions:((r||m).find(function({id:e}){return e===n})||{conditions:[]}).conditions},hasRevertButton:!1})),(0,e.createElement)("div",{className:"ct-modal-actions has-divider"},(0,e.createElement)("button",{className:"ct-ui-button ct-ui-button-primary",disabled:!r,onClick:function(){fetch(`${wp.ajax.settings.url}?action=blocksy_header_update_all_conditions`,{headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST",body:JSON.stringify(r)}).then(function(e){return e.json()}).then(function(){M(),i(!1)})}},(0,o.__)("Save Conditions","blocksy-companion"))))}}))};var I=function(){const[n,c]=(0,e.useState)(!1),{builderValueDispatch:r,builderValue:s,option:u,builderValueCollection:d,panelsActions:p}=(ct_customizer_localizations.header_builder_data.secondary_items.header,ct_customizer_localizations.header_builder_data.header,(0,e.useContext)(a.PlacementsDragDropContext)),m=(0,j.applyFilters)("blocksy.header.available-sections",null,d.sections)||d.sections.filter(function({id:e}){return"type-2"!==e&&"type-3"!==e&&-1===e.indexOf("ct-custom")});return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("ul",{className:i()("ct-panels-manager")},m.map(function({name:t,id:n}){let u=t||{"type-1":(0,o.__)("Global Header","blocksy-companion")}[n]||n;const d=`builder_header_panel_${n}`,m=ct_customizer_localizations.header_builder_data.header_data.header_options,y={label:u,"inner-options":{...n.indexOf("ct-custom")>-1?{conditions_button:{label:(0,o.__)("Edit Conditions","blocksy-companion"),type:"jsx",design:"block",render:function(){return(0,e.createElement)(B,{headerId:n})}},divider:{type:"ct-divider"}}:{},...m}};return(0,e.createElement)(a.PanelMetaWrapper,l({id:d,key:n,option:y},p,{getActualOption:function({open:t}){return(0,e.createElement)(e.Fragment,null,n===s.id&&(0,e.createElement)(a.Panel,{id:d,getValues:function(){return{id:n,...s.settings||{}}},option:y,onChangeFor:function(e,t){r({type:"BUILDER_GLOBAL_SETTING_ON_CHANGE",payload:{optionId:e,optionValue:t,values:(0,a.getValueFromInput)(m,Array.isArray(s.settings)?{}:s.settings||{})}})},view:"simple"}),(0,e.createElement)("li",{className:i()({active:n===s.id,"ct-global":"type-1"===n}),onClick:function(){n===s.id?t():r({type:"PICK_BUILDER_SECTION",payload:{id:n}})}},(0,e.createElement)("span",{className:"ct-panel-name"},u),n.indexOf("ct-custom")>-1&&n!==s.id&&(0,e.createElement)("span",{className:"ct-remove-instance","data-tooltip-reveal":"top",onClick:function(e){e.preventDefault(),e.stopPropagation(),c(n)}},(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,o.__)("Remove header","blocksy-companion")))))}}))})),(0,e.createElement)(t.Slot,{name:"PlacementsBuilderPanelsManagerAfter"},function(e){return 0===e.length?null:e}),(0,e.createElement)(a.Overlay,{items:n,className:"ct-admin-modal ct-reset-options",onDismiss:function(){return c(!1)},render:function(){return(0,e.createElement)("div",{className:"ct-modal-content"},(0,e.createElement)("h2",{className:"ct-modal-title"},(0,o.__)("Remove Header","blocksy-companion")),(0,e.createElement)("p",null,(0,o.__)("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(),c(!1)},className:"button"},(0,o.__)("Cancel","blocksy-companion")),(0,e.createElement)("button",{className:"button button-primary",onClick:function(e){e.preventDefault(),r({type:"REMOVE_BUILDER_SECTION",payload:{id:n}}),c(!1)}},(0,o.__)("Confirm","blocksy-companion"))))}}))};P().on("blocksy:options:before-option",function(n){if(n.option&&"ct-header-builder"===n.option.type){let o=n.content;n.content=(0,e.createElement)(e.Fragment,null,o,(0,e.createElement)(t.Fill,{name:"PlacementsBuilderPanelsManager"},(0,e.createElement)(I,null)))}}),P().on("blocksy:options:register",function(e){e["blocksy-display-condition"]=b,e["blocksy-customizer-options-manager"]=D})}()}();