Plugin Directory

Changeset 3292137


Ignore:
Timestamp:
05/12/2025 09:04:54 PM (9 months ago)
Author:
wickedplugins
Message:

Update to version 1.2.5 from GitHub

Location:
wicked-block-conditions
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wicked-block-conditions/tags/1.2.5/classes/class-wicked-block-conditions.php

    r2956915 r3292137  
    137137    public function enqueue_block_editor_assets() {
    138138        $script = plugin_dir_url( dirname( __FILE__ ) ) . 'dist/index.js';
     139        $deps = array( 'wp-blocks', 'wp-element', 'wp-data', 'wp-components', 'wp-i18n', 'lodash', 'wp-block-editor' );
    139140
    140141        if ( defined( 'WICKED_BLOCK_CONDITIONS_DEV' ) && WICKED_BLOCK_CONDITIONS_DEV ) {
     
    148149        // );
    149150
    150         wp_enqueue_script( 'wicked-block-conditions', $script, array( 'wp-blocks', 'wp-element', 'wp-editor', 'wp-data', 'wp-components', 'wp-i18n', 'lodash' ), Wicked_Block_Conditions::plugin_version() );
     151        wp_enqueue_script( 'wicked-block-conditions', $script, $deps, Wicked_Block_Conditions::plugin_version() );
    151152        //wp_localize_script( 'wicked-block-conditions', 'wickedBlockConditions', $data );
    152153
  • wicked-block-conditions/tags/1.2.5/dist/index.js

    r2941036 r3292137  
    11/*! For license information please see index.js.LICENSE.txt */
    2 (()=>{var e={607:()=>{function e(t){return e="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(t)}function t(){"use strict";t=function(){return n};var n={},o=Object.prototype,i=o.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},c="function"==typeof Symbol?Symbol:{},a=c.iterator||"@@iterator",l=c.asyncIterator||"@@asyncIterator",s=c.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,o){var i=t&&t.prototype instanceof m?t:m,c=Object.create(i.prototype),a=new S(o||[]);return r(c,"_invoke",{value:R(e,n,a)}),c}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}n.wrap=d;var f={};function m(){}function h(){}function b(){}var v={};u(v,a,(function(){return this}));var w=Object.getPrototypeOf,g=w&&w(w(_([])));g&&g!==o&&i.call(g,a)&&(v=g);var k=b.prototype=m.prototype=Object.create(v);function y(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function E(t,n){function o(r,c,a,l){var s=p(t[r],t,c);if("throw"!==s.type){var u=s.arg,d=u.value;return d&&"object"==e(d)&&i.call(d,"__await")?n.resolve(d.__await).then((function(e){o("next",e,a,l)}),(function(e){o("throw",e,a,l)})):n.resolve(d).then((function(e){u.value=e,a(u)}),(function(e){return o("throw",e,a,l)}))}l(s.arg)}var c;r(this,"_invoke",{value:function(e,t){function i(){return new n((function(n,i){o(e,t,n,i)}))}return c=c?c.then(i,i):i()}})}function R(e,t,n){var o="suspendedStart";return function(i,r){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===i)throw r;return{value:void 0,done:!0}}for(n.method=i,n.arg=r;;){var c=n.delegate;if(c){var a=C(c,n);if(a){if(a===f)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===o)throw o="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o="executing";var l=p(e,t,n);if("normal"===l.type){if(o=n.done?"completed":"suspendedYield",l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o="completed",n.method="throw",n.arg=l.arg)}}}function C(e,t){var n=t.method,o=e.iterator[n];if(void 0===o)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,C(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var i=p(o,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,f;var r=i.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function x(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 O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function _(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(i.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:P}}function P(){return{value:void 0,done:!0}}return h.prototype=b,r(k,"constructor",{value:b,configurable:!0}),r(b,"constructor",{value:h,configurable:!0}),h.displayName=u(b,s,"GeneratorFunction"),n.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},n.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,u(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},n.awrap=function(e){return{__await:e}},y(E.prototype),u(E.prototype,l,(function(){return this})),n.AsyncIterator=E,n.async=function(e,t,o,i,r){void 0===r&&(r=Promise);var c=new E(d(e,t,o,i),r);return n.isGeneratorFunction(t)?c:c.next().then((function(e){return e.done?e.value:c.next()}))},y(k),u(k,s,"Generator"),u(k,a,(function(){return this})),u(k,"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=_,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},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 t=this;function n(n,o){return c.type="throw",c.arg=e,t.next=n,o&&(t.method="next",t.arg=void 0),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var r=this.tryEntries[o],c=r.completion;if("root"===r.tryLoc)return n("end");if(r.tryLoc<=this.prev){var a=i.call(r,"catchLoc"),l=i.call(r,"finallyLoc");if(a&&l){if(this.prev<r.catchLoc)return n(r.catchLoc,!0);if(this.prev<r.finallyLoc)return n(r.finallyLoc)}else if(a){if(this.prev<r.catchLoc)return n(r.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return n(r.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 c=r?r.completion:{};return c.type=e,c.arg=t,r?(this.method="next",this.next=r.finallyLoc,f):this.complete(c)},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),f},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),O(n),f}},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 i=o.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:_(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},n}function n(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 o=null!=arguments[t]?arguments[t]:{};t%2?n(Object(o),!0).forEach((function(t){i(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function i(t,n,o){return(n=function(t){var n=function(t,n){if("object"!==e(t)||null===t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var i=o.call(t,"string");if("object"!==e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===e(n)?n:String(n)}(n))in t?Object.defineProperty(t,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[n]=o,t}var r=wp.apiFetch,c=wp.data,a=c.registerStore,l=(c.withSelect,{setUserRoles:function(e){return{type:"SET_USER_ROLES",userRoles:e}},receiveUserRoles:function(e){return{type:"RECEIVE_USER_ROLES",path:e}}});a("wicked-plugins/wicked-block-conditions",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{userRoles:{}},t=arguments.length>1?arguments[1]:void 0;return"SET_USER_ROLES"===t.type?o(o({},e),{},{userRoles:t.userRoles}):e},actions:l,selectors:{receiveUserRoles:function(e){return e.userRoles}},controls:{RECEIVE_USER_ROLES:function(e){return r({path:e.path})}},resolvers:{receiveUserRoles:t().mark((function e(n){var o;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l.receiveUserRoles("/wicked-block-conditions/v1/user-roles/");case 2:return o=e.sent,e.abrupt("return",l.setUserRoles(o));case 4:case"end":return e.stop()}}),e)}))}})}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}(()=>{"use strict";var e=lodash,t=e.find,o=e.forEach,i=e.isUndefined,r=e.filter,c=function e(n,i){var r=!1;return(r=t(n,(function(e){return e.guid==i})))||o(n,(function(t){var n=e(t.conditions,i);n&&(r=n)})),r},a=function e(t,n){return t.map((function(t){return t.guid==n.guid?n:(i(t.conditions)||(t.conditions=e(t.conditions,n)),t)}))},l=function e(t,n){return r(t,(function(e){return e.guid!=n.guid})).map((function(t){return i(t.conditions)||(t.conditions=e(t.conditions,n)),t}))},s=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))},u=wp.i18n.__,d=wp.components.RadioControl;const p=function(e){var t=e.option,n=e.onChange;return React.createElement(d,{label:u("When conditions are met:","wicked-block-conditions"),selected:t,options:[{label:u("Show this block","wicked-block-conditions"),value:"show"},{label:u("Hide this block","wicked-block-conditions"),value:"hide"}],onChange:function(e){n(e)}})};var f=wp.i18n.__,m=wp.components,h=m.Button,b=m.Icon;const v=function(e){var t,n=e.condition,o=n.type,i=0!=e.index&&React.createElement("div",{className:"wbc-operator"},React.createElement("div",null,React.createElement("select",{defaultValue:n.operator,onChange:function(t){var n=Object.assign({},e.condition);n.operator=t.target.value,e.onChange(n)}},React.createElement("option",{value:"and"},f("And","wicked-block-conditions")),React.createElement("option",{value:"or"},f("Or","wicked-block-conditions")))));return t=n.conditions.length?React.createElement(g,{setState:e.setState,conditions:n.conditions,onChange:function(t){var n=Object.assign({},e.condition);n.conditions=t,e.onChange(n)}}):React.createElement("p",{className:"wbc-empty-group"},f("This group does not have any conditions yet.","wicked-block-conditions")),"group"==o?React.createElement("li",{className:"wbc-group-condition","data-guid":n.guid},i,React.createElement("div",{className:"wbc-content"},React.createElement("div",{className:"wbc-head"},React.createElement("h3",null,f("Condition Group","wicked-block-conditions"))),React.createElement("div",{className:"wbc-body"},t),React.createElement("div",{className:"wbc-foot"},React.createElement(h,{isLink:!0,onClick:function(){!function(t){e.setState((function(e){return{action:"select-condition",group:t.guid}}))}(n)}},f("Add Condition","wicked-block-conditions")),React.createElement("span",{className:"wbc-separator"},"|"),React.createElement(h,{isLink:!0,onClick:function(){n.conditions.length?confirm(f("This will delete all conditions in the group.  Are you sure?","wicked-block-conditions"))&&e.onDelete(n):e.onDelete(n)}},f("Delete Group","wicked-block-conditions"))))):React.createElement("li",{className:"wbc-condition","data-guid":n.guid},i,React.createElement("div",{className:"wbc-content"},n.label),React.createElement("div",{className:"wbc-edit"},React.createElement(h,{onClick:function(){e.setState((function(e){return{action:"edit-condition",activeCondition:n.guid}}))}},React.createElement(b,{icon:"admin-generic",size:"20"}))))};function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},w.apply(this,arguments)}const g=function(e){var t=function(t){var n=e.conditions.map((function(e){return e.guid==t.guid?t:e}));e.onChange(n)},n=function(t){var n=e.conditions.filter((function(e){return e.guid!=t.guid}));e.onChange(n)},o=e.conditions.map((function(o,i){return React.createElement(v,w({},e,{key:o.guid,index:i,condition:o,onChange:t,onDelete:n}))}));return React.createElement("ul",{className:e.className||""},o)};var k=wp.i18n.__,y=lodash.assign,E=wp.element.Fragment,R=wp.components.Button;const C=function(e){var t=e.attributes.wickedBlockConditions,n=t.action,o=t.conditions,i=y({},e.attributes.wickedBlockConditions);return o.length?React.createElement(E,null,React.createElement(p,{option:n,onChange:function(t){i.action=t,e.setAttributes({wickedBlockConditions:i})}}),React.createElement(g,{setState:e.setState,conditions:o,onChange:function(t){i.conditions=t,e.setAttributes({wickedBlockConditions:i})},className:"wbc-conditions"}),React.createElement("p",null,React.createElement(R,{isLink:!0,onClick:function(){var t;t={guid:s(),type:"group",label:k("Condition Group","wicked-block-conditions"),operator:"and",conditions:[]},i.conditions=i.conditions.slice(0),i.conditions.push(t),e.setAttributes({wickedBlockConditions:i})}},k("Add Condition Group","wicked-block-conditions")))):React.createElement("div",{className:"wbc-start"},React.createElement("p",null,k("Show or hide this block based on conditions.  Add a condition to get started.","wicked-block-conditions")),React.createElement("p",null,React.createElement(R,{isLink:!0,onClick:function(){e.setState((function(e){return{action:"select-condition"}}))}},k("Add Condition","wicked-block-conditions"))))};var x=wp.i18n.__,O=lodash,S=O.assign,_=O.chain,P=(O.find,wp.element.Fragment),j=wp.components.Button;const L=function(e){var t=_(e.wickedBlockConditions.conditions).groupBy("group").map((function(e,t){return{name:t,conditions:e}})).value().map((function(t){var n=t.conditions.map((function(t){return React.createElement("li",null,React.createElement(j,{isLink:!0,onClick:function(){!function(t){var n={action:e.attributes.wickedBlockConditions.action,conditions:e.attributes.wickedBlockConditions.conditions.slice(0)},o=c(n.conditions,e.group),i=S({guid:s(),type:t.type,label:t.label,operator:"and",conditions:[]},t.default);o||(o={guid:s(),type:"group",label:x("Condition Group","wicked-block-conditions"),operator:"and",conditions:[]},n.conditions.push(o)),o.conditions.push(i),n.conditions=a(n.conditions,o),e.setAttributes({wickedBlockConditions:n}),t.bypassConfig?e.setState((function(e){return{action:"view-conditions"}})):e.setState((function(e){return{action:"edit-condition",activeCondition:i.guid}}))}(t)}},t.label))}));return React.createElement(P,null,React.createElement("h3",null,t.name),React.createElement("ul",null,n))}));return React.createElement("div",{className:"wbc-select-condition"},React.createElement("p",null,x("Select a condition to add:","wicked-block-conditions")),t,React.createElement(j,{variant:"secondary",onClick:function(){e.setState((function(e){return{action:"view-conditions"}}))}},x("Cancel","wicked-block-conditions")))};var T=wp.i18n.__,N=wp.components,D=N.TextControl,B=N.ToggleControl,A=N.Button,F=lodash,I=F.find,U=F.assign;const G=function(e){var t=c(e.attributes.wickedBlockConditions.conditions,e.activeCondition),n=I(e.wickedBlockConditions.conditions,{type:t.type}),o=Object.assign({},e.attributes.wickedBlockConditions),i=n.edit,r=function(){o.conditions=a(o.conditions,t),e.setAttributes({wickedBlockConditions:o})};return React.createElement("div",{className:"wbc-edit-condition"},React.createElement("h3",null,e.isNew?T("Add Condition","wicked-block-conditions"):T("Edit Condition","wicked-block-conditions"),": ",n.label),React.createElement("p",null,n.description),React.createElement(D,{label:T("Label","wicked-block-conditions"),help:T("Briefly explain what this condition does.","wicked-block-conditions"),value:t.label,onChange:function(e){return n=e,t.label=n,void r();var n}}),React.createElement(B,{label:T("Negate condition","wicked-block-conditions"),checked:t.negate,help:T("Reverses the outcome of the condition.","wicked-block-conditions"),onChange:function(e){t.negate=e,r()}}),React.createElement(i,{condition:t,onChange:function(e){t=U({},t,e),r()}}),React.createElement("div",{className:"wbc-foot"},React.createElement("div",{className:"wbc-save"},React.createElement(A,{isPrimary:!0,onClick:function(){e.setState((function(e){return{action:"view-conditions",activeCondition:null}}))}},T("Save","wicked-block-conditions"))),React.createElement("div",{className:"wbc-delete"},React.createElement(A,{variant:"secondary",isDestructive:!0,onClick:function(){o.conditions=l(o.conditions,t),e.setAttributes({wickedBlockConditions:o}),e.setState((function(e){return{action:"view-conditions",activeCondition:null}}))}},T("Delete","wicked-block-conditions")))))};var H=wp.element.Fragment,V=function(e){var t=e.children,n=e.activePanel,o=t.map((function(e,t){if(n==e.props.name)return React.createElement("div",{key:t,className:"wicked-slider-panel"},e)}));return React.createElement("div",{className:"wicked-slider-panels"},o)},Y=function(e){var t=e.children;return React.createElement(H,null,t)},q=wp.i18n.__,z=lodash,M=z.map,Q=z.filter,W=wp.data.withSelect,$=wp.components.SelectControl;const J=W((function(e){var t=e("core/editor").getCurrentPost();return{post:t,taxonomies:t?e("core").getTaxonomies():void 0}}))((function(e){var t=e.taxonomies,n=e.post,o=e.selectedTaxonomy,i=e.onChange;if(t){var r=Q(t,(function(e){return-1!==e.types.indexOf(n.type)})),c=M(r,(function(e){return{value:e.slug,label:e.name}}));return c.unshift({value:"",label:q("Select a taxonomy","wicked-block-conditions")}),r.length?React.createElement($,{label:q("Taxonomy","wicked-block-conditions"),value:o,onChange:i,options:c}):React.createElement("p",null,q("No terms can be selected because this post type does not have any taxonomies assigned to it.","wicked-block-conditions"))}return React.createElement("div",null,q("Loading...","wicked-block-conditions"))}));var K=wp.i18n.__,X=lodash,Z=X.map,ee=X.filter,te=X.find,ne=X.union,oe=X.without,ie=wp.data.withSelect,re=wp.components,ce=re.CheckboxControl,ae=re.FormTokenField;const le=ie((function(e,t){var n=t.taxonomy,o=e("core"),i=o.getTaxonomy,r=o.getEntityRecords;return{taxonomyObject:n?i(n):void 0,terms:n?r("taxonomy",n):void 0}}))((function(e){e.taxonomy;var t=e.selectedTerms,n=void 0===t?[]:t,o=e.taxonomyObject,i=e.terms,r=e.onChange;if(o&&i){if(o.hierarchical)return React.createElement("div",{class:"wbc-terms"},React.createElement("h3",null,K("Terms","wicked-block-conditions")),function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return Z(i,(function(o){return o.parent==t&&React.createElement("div",{key:o.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},React.createElement(ce,{label:o.name,checked:-1!==n.indexOf(o.slug),onChange:function(e){return t=o.slug,i=e?ne(n,[t]):oe(n,t),void r(i);var t,i}}),React.createElement("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},e(o.id)))}))}());var c=Z(i,(function(e){return e.name})),a=Z(ee(i,(function(e){return-1!==n.indexOf(e.slug)})),(function(e){return e.name}));return React.createElement("div",{class:"wbc-terms"},React.createElement(ae,{value:a,suggestions:c,maxSuggestions:20,label:K("Tags","wicked-block-conditions"),onChange:function(e){var t=Z(e,(function(e){var t=te(i,{name:e});return t?t.slug:e}));r(t)}}))}return!1}));var se=wp.element.Fragment;var ue=wp.i18n.__,de=wp.components.TextControl;var pe=wp.i18n.__,fe=wp.components.TextControl;var me=wp.i18n.__,he=wp.components.RadioControl;var be=wp.i18n.__,ve=lodash.assign,we=wp.date,ge=we.dateI18n,ke=we.__experimentalGetSettings,ye=(wp.element.Fragment,wp.components),Ee=ye.RadioControl,Re=ye.DatePicker,Ce=ye.DateTimePicker,xe=ye.Button,Oe=ye.Dropdown,Se=ye.PanelRow;wp.i18n.__;var _e=lodash,Pe=_e.map,je=_e.union,Le=_e.without,Te=wp.data.withSelect,Ne=wp.components,De=Ne.CheckboxControl,Be=Ne.Spinner;const Ae=Te((function(e,t){return t.roles,{roles:(0,e("wicked-plugins/wicked-block-conditions").receiveUserRoles)()}}))((function(e){var t=e.selectedRoles,n=void 0===t?[]:t,o=e.roles,i=e.onChange;if(o){var r=Pe(o,(function(e){return React.createElement(De,{label:e.label,checked:-1!==n.indexOf(e.value),onChange:function(t){return function(e,t){var o=t?je(n,[e]):Le(n,e);i(o)}(e.value,t)}})}));return React.createElement("div",{class:"wbc-user-roles"},r)}return React.createElement(Be,null)}));var Fe=wp.i18n.__,Ie=wp.components.TextControl;var Ue=wp.i18n.__,Ge=wp.components.TextControl;var He=wp.i18n.__,Ve=wp.date.date,Ye=function(){return!1},qe=[];function ze(e){return ze="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},ze(e)}function Me(){return Me=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Me.apply(this,arguments)}function Qe(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 We(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qe(Object(n),!0).forEach((function(t){$e(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function $e(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==ze(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!==ze(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===ze(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Je(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,i,r,c,a=[],l=!0,s=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(o=r.call(n)).done)&&(a.push(o.value),a.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(c=n.return(),Object(c)!==c))return}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ke(e,t);var n=Object.prototype.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)?Ke(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ke(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}qe.push({type:"user_is_logged_in",label:He("User Is Logged In","wicked-block-conditions"),group:He("User Conditions","wicked-block-conditions"),description:He("Returns true if a user is logged in.","wicked-block-conditions"),bypassConfig:!0,edit:Ye}),qe.push({type:"user_is_not_logged_in",label:He("User Is Not Logged In","wicked-block-conditions"),group:He("User Conditions","wicked-block-conditions"),description:He("Returns true if a user is not logged in.","wicked-block-conditions"),bypassConfig:!0,edit:Ye}),qe.push({type:"user_has_role",label:He("User Has Role","wicked-block-conditions"),group:He("User Conditions","wicked-block-conditions"),description:He("Returns true if the user is assigned to any of the selected roles.","wicked-block-conditions"),edit:function(e){var t=e.condition,n=e.onChange,o=t.roles;return React.createElement(Ae,{selectedRoles:o,onChange:function(e){n({roles:e})}})}}),qe.push({type:"post_id",label:He("Check Post ID","wicked-block-conditions"),group:He("Post Conditions","wicked-block-conditions"),description:He("Returns true if the post has the specified ID.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.postId;return React.createElement(de,{label:ue("Post ID","wicked-block-conditions"),type:"number",min:1,step:1,value:o,onChange:function(e){n({postId:parseInt(e)})}})}}),qe.push({type:"post_slug",label:He("Check Post Slug","wicked-block-conditions"),group:He("Post Conditions","wicked-block-conditions"),description:He("Returns true if the post has the specified slug.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.slug;return React.createElement(fe,{label:pe("Post Slug","wicked-block-conditions"),value:o,onChange:function(e){n({slug:e})}})}}),qe.push({type:"post_has_term",label:He("Post Has a Term","wicked-block-conditions"),group:He("Post Conditions","wicked-block-conditions"),description:He("Returns true if the post has the selected term(s) assigned.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.taxonomy,i=t.terms;return React.createElement(se,null,React.createElement(J,{selectedTaxonomy:o,onChange:function(e){n({taxonomy:e,terms:i})}}),React.createElement(le,{taxonomy:o,selectedTerms:i,onChange:function(e){n({taxonomy:o,terms:e})}}))}}),qe.push({type:"post_status",label:He("Check Post Status","wicked-block-conditions"),group:He("Post Conditions","wicked-block-conditions"),description:He("Returns true if post status matches the selected option.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.status;return React.createElement(he,{label:me("Post Status","wicked-block-conditions"),selected:o,options:[{label:me("Published","wicked-block-conditions"),value:"publish"},{label:me("Pending","wicked-block-conditions"),value:"pending"},{label:me("Draft","wicked-block-conditions"),value:"draft"},{label:me("Future","wicked-block-conditions"),value:"future"},{label:me("Private","wicked-block-conditions"),value:"private"},{label:me("Password Protected","wicked-block-conditions"),value:"password"}],onChange:function(e){!function(e){n({status:e})}(e)}})},default:{status:"publish"}}),qe.push({type:"current_date",label:He("Check The Date","wicked-block-conditions"),group:He("Date Conditions","wicked-block-conditions"),description:He("Returns true if the current date matches the specified conditions.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.onChange,n=ve({},e.condition),o=n.compare,i=n.date,r=be("between"==o?"Start Date":"Date","wicked-block-conditions"),c=ke(),a="same day"==o?c.formats.date:c.formats.datetimeAbbreviated,l=function(e){n.date=e,t(n)};return React.createElement("div",{className:"wbc-current-date-condition"},React.createElement(Ee,{label:be("Current date is:","wicked-block-conditions"),selected:o,options:[{label:be("Before","wicked-block-conditions"),value:"before"},{label:be("After","wicked-block-conditions"),value:"after"},{label:be("The same as","wicked-block-conditions"),value:"same day"}],onChange:function(e){!function(e){n.compare=e,t(n)}(e)}}),React.createElement(Se,null,React.createElement("span",null,r),React.createElement("div",null,React.createElement(Oe,{className:"wbc-date-popup",contentClassName:"wbc-date-popup-content",position:"bottom right",renderToggle:function(e){var t=e.isOpen,n=e.onToggle;return React.createElement(xe,{onClick:n,"aria-expanded":t,isLink:!0},ge(a,i))},renderContent:function(){return React.createElement("div",null,"same day"==o?React.createElement(Re,{currentDate:i,is12Hour:!0,onChange:function(e){l(e)}}):React.createElement(Ce,{currentDate:i,is12Hour:!0,onChange:function(e){l(e)}}))}}))),React.createElement(Se,null,React.createElement("em",null,be("Note: Be sure that a timezone has been set for your site on the Settings > General page and that the date you select above is for that timezone.","wicked-block-conditions"))),"between"==o&&React.createElement(Se,null,React.createElement("span",null,be("End date","wicked-block-conditions")),React.createElement("div",null,React.createElement(Oe,{className:"wbc-date-popup",contentClassName:"wbc-date-popup-content",position:"bottom right",renderToggle:function(e){var t=e.isOpen,n=e.onToggle;return React.createElement(xe,{onClick:n,"aria-expanded":t,isLink:!0},ge(a,dateTwo))},renderContent:function(){return React.createElement("div",null,React.createElement(Ce,{currentDate:dateTwo,is12Hour:!0,onChange:function(e){handleChangeDateTwo(e)}}))}}))))},default:{compare:"before",date:Ve("Y-m-d H:i:00",new Date)}}),qe.push({type:"user_function",label:He("Check a User-Defined Function","wicked-block-conditions"),group:He("Advanced","wicked-block-conditions"),description:He("Returns the result of a user-defined function.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.function;return React.createElement(Ie,{label:Fe("Function","wicked-block-conditions"),help:Fe("Enter the name of a PHP function to call.  Your function should return a value of true or false.  Any value other than true will be considered false.","wicked-block-conditions"),value:o,onChange:function(e){return function(e){n({function:e})}(e)}})}}),qe.push({type:"query_string",label:He("Check a Query String Value","wicked-block-conditions"),group:He("Advanced","wicked-block-conditions"),description:He("Returns true if the specified query string parameter is matched.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.parameter,i=t.value;return React.createElement(React.Fragment,null,React.createElement(Ge,{label:Ue("Parameter","wicked-block-conditions"),help:Ue("The name of the query string parameter to check.","wicked-block-conditions"),value:o,onChange:function(e){return function(e){n({parameter:e,value:i})}(e)}}),React.createElement(Ge,{label:Ue("Value","wicked-block-conditions"),help:Ue("The value to check for.","wicked-block-conditions"),value:i,onChange:function(e){return function(e){n({parameter:o,value:e})}(e)}}))},default:{parameter:"",value:""}}),n(607);var Xe=wp.i18n.__,Ze=lodash.assign,et=wp.element,tt=et.Fragment,nt=et.useState,ot=wp.components.PanelBody,it=wp.compose.createHigherOrderComponent,rt=wp.blockEditor.InspectorControls,ct=wp.hooks,at=ct.addFilter,lt=ct.applyFilters;at("blocks.registerBlockType","wicked-block-conditions/add-attribute",(function(e){return e.attributes=Ze(e.attributes,{wickedBlockConditions:{type:"object",default:{action:"show",conditions:[]}}}),e})),at("blocks.getSaveContent.extraProps","wicked-block-conditions/add-props",(function(e,t,n){return e.wickedBlockConditions=n.wickedBlockConditions,e}));var st=function(e){var t=Je(nt(!1),2),n=t[0],o=t[1],i=Je(nt("view-conditions"),2),r=i[0],c=i[1],a=Je(nt(null),2),l=a[0],s=a[1],u=Je(nt(null),2),d=u[0],p=u[1],f=We(We({},e),{},{action:r,activeCondition:l,group:d,setState:function(e){var t=e();t.hasOwnProperty("action")&&c(t.action),t.hasOwnProperty("activeCondition")&&s(t.activeCondition),t.hasOwnProperty("group")&&p(t.group)}});return React.createElement(rt,null,React.createElement(ot,{title:Xe("Display Conditions","wicked-block-conditions"),initialOpen:n,onToggle:function(){o(!n)}},React.createElement(V,{activePanel:r},React.createElement(Y,{name:"view-conditions"},React.createElement(C,f)),React.createElement(Y,{name:"select-condition"},React.createElement(L,f)),React.createElement(Y,{name:"edit-condition"},React.createElement(G,f)))))};const ut=it((function(e){var t={conditions:lt("wickedBlockConditions.conditions",qe)};return function(n){return React.createElement(tt,null,React.createElement(e,n),React.createElement(st,Me({},n,{wickedBlockConditions:t})))}}),"withConditions");var dt=wp.hooks,pt=dt.addFilter;dt.removeFilter,pt("editor.BlockEdit","wicked-block-conditions/with-conditions",ut)})()})();
     2(()=>{var e={446:()=>{function e(t){return e="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(t)}function t(){"use strict";t=function(){return o};var n,o={},i=Object.prototype,r=i.hasOwnProperty,c="function"==typeof Symbol?Symbol:{},a=c.iterator||"@@iterator",s=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function u(e,t,n,o){return Object.defineProperty(e,t,{value:n,enumerable:!o,configurable:!o,writable:!o})}try{u({},"")}catch(n){u=function(e,t,n){return e[t]=n}}function d(e,t,o,i){var r=t&&t.prototype instanceof m?t:m,c=Object.create(r.prototype);return u(c,"_invoke",function(e,t,o){var i=1;return function(r,c){if(3===i)throw Error("Generator is already running");if(4===i){if("throw"===r)throw c;return{value:n,done:!0}}for(o.method=r,o.arg=c;;){var a=o.delegate;if(a){var s=R(a,o);if(s){if(s===f)continue;return s}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if(1===i)throw i=4,o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);i=3;var l=p(e,t,o);if("normal"===l.type){if(i=o.done?4:2,l.arg===f)continue;return{value:l.arg,done:o.done}}"throw"===l.type&&(i=4,o.method="throw",o.arg=l.arg)}}}(e,o,new O(i||[])),!0),c}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}o.wrap=d;var f={};function m(){}function h(){}function b(){}var w={};u(w,a,(function(){return this}));var v=Object.getPrototypeOf,g=v&&v(v(_([])));g&&g!==i&&r.call(g,a)&&(w=g);var k=b.prototype=m.prototype=Object.create(w);function y(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function E(t,n){function o(i,c,a,s){var l=p(t[i],t,c);if("throw"!==l.type){var u=l.arg,d=u.value;return d&&"object"==e(d)&&r.call(d,"__await")?n.resolve(d.__await).then((function(e){o("next",e,a,s)}),(function(e){o("throw",e,a,s)})):n.resolve(d).then((function(e){u.value=e,a(u)}),(function(e){return o("throw",e,a,s)}))}s(l.arg)}var i;u(this,"_invoke",(function(e,t){function r(){return new n((function(n,i){o(e,t,n,i)}))}return i=i?i.then(r,r):r()}),!0)}function R(e,t){var o=t.method,i=e.i[o];if(i===n)return t.delegate=null,"throw"===o&&e.i.return&&(t.method="return",t.arg=n,R(e,t),"throw"===t.method)||"return"!==o&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+o+"' method")),f;var r=p(i,e.i,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,f;var c=r.arg;return c?c.done?(t[e.r]=c.value,t.next=e.n,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,f):c:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function C(e){this.tryEntries.push(e)}function x(e){var t=e[4]||{};t.type="normal",t.arg=n,e[4]=t}function O(e){this.tryEntries=[[-1]],e.forEach(C,this),this.reset(!0)}function _(t){if(null!=t){var o=t[a];if(o)return o.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,c=function e(){for(;++i<t.length;)if(r.call(t,i))return e.value=t[i],e.done=!1,e;return e.value=n,e.done=!0,e};return c.next=c}}throw new TypeError(e(t)+" is not iterable")}return h.prototype=b,u(k,"constructor",b),u(b,"constructor",h),h.displayName=u(b,l,"GeneratorFunction"),o.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},o.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,u(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},o.awrap=function(e){return{__await:e}},y(E.prototype),u(E.prototype,s,(function(){return this})),o.AsyncIterator=E,o.async=function(e,t,n,i,r){void 0===r&&(r=Promise);var c=new E(d(e,t,n,i),r);return o.isGeneratorFunction(t)?c:c.next().then((function(e){return e.done?e.value:c.next()}))},y(k),u(k,l,"Generator"),u(k,a,(function(){return this})),u(k,"toString",(function(){return"[object Generator]"})),o.keys=function(e){var t=Object(e),n=[];for(var o in t)n.unshift(o);return function e(){for(;n.length;)if((o=n.pop())in t)return e.value=o,e.done=!1,e;return e.done=!0,e}},o.values=_,O.prototype={constructor:O,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0][4];if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function o(n){c.type="throw",c.arg=e,t.next=n}for(var i=t.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i],c=r[4],a=this.prev,s=r[1],l=r[2];if(-1===r[0])return o("end"),!1;if(!s&&!l)throw Error("try statement without catch or finally");if(null!=r[0]&&r[0]<=a){if(a<s)return this.method="next",this.arg=n,o(s),!0;if(a<l)return o(l),!1}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o[0]>-1&&o[0]<=this.prev&&this.prev<o[2]){var i=o;break}}i&&("break"===e||"continue"===e)&&i[0]<=t&&t<=i[2]&&(i=null);var r=i?i[4]:{};return r.type=e,r.arg=t,i?(this.method="next",this.next=i[2],f):this.complete(r)},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),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[2]===e)return this.complete(n[4],n[3]),x(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[0]===e){var o=n[4];if("throw"===o.type){var i=o.arg;x(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,t,o){return this.delegate={i:_(e),r:t,n:o},"next"===this.method&&(this.arg=n),f}},o}function n(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 o=null!=arguments[t]?arguments[t]:{};t%2?n(Object(o),!0).forEach((function(t){i(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function i(t,n,o){return(n=function(t){var n=function(t){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,"string");if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(n)?n:n+""}(n))in t?Object.defineProperty(t,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[n]=o,t}var r=wp.apiFetch,c=wp.data,a=c.registerStore,s=(c.withSelect,{setUserRoles:function(e){return{type:"SET_USER_ROLES",userRoles:e}},receiveUserRoles:function(e){return{type:"RECEIVE_USER_ROLES",path:e}}});a("wicked-plugins/wicked-block-conditions",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{userRoles:{}},t=arguments.length>1?arguments[1]:void 0;return"SET_USER_ROLES"===t.type?o(o({},e),{},{userRoles:t.userRoles}):e},actions:s,selectors:{receiveUserRoles:function(e){return e.userRoles}},controls:{RECEIVE_USER_ROLES:function(e){return r({path:e.path})}},resolvers:{receiveUserRoles:t().mark((function e(n){var o;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.receiveUserRoles("/wicked-block-conditions/v1/user-roles/");case 2:return o=e.sent,e.abrupt("return",s.setUserRoles(o));case 4:case"end":return e.stop()}}),e)}))}})}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}(()=>{"use strict";var e=lodash,t=e.find,o=e.forEach,i=e.isUndefined,r=e.filter,c=function(e,n){var i=!1;return(i=t(e,(function(e){return e.guid==n})))||o(e,(function(e){var t=c(e.conditions,n);t&&(i=t)})),i},a=function(e,t){return e.map((function(e){return e.guid==t.guid?t:(i(e.conditions)||(e.conditions=a(e.conditions,t)),e)}))},s=function(e,t){return r(e,(function(e){return e.guid!=t.guid})).map((function(e){return i(e.conditions)||(e.conditions=s(e.conditions,t)),e}))},l=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))},u=wp.i18n.__,d=wp.components.RadioControl;const p=function(e){var t=e.option,n=e.onChange;return React.createElement(d,{label:u("When conditions are met:","wicked-block-conditions"),selected:t,options:[{label:u("Show this block","wicked-block-conditions"),value:"show"},{label:u("Hide this block","wicked-block-conditions"),value:"hide"}],onChange:function(e){n(e)}})};var f=wp.i18n.__,m=wp.components,h=m.Button,b=m.Icon;const w=function(e){var t,n=e.condition,o=n.type,i=0!=e.index&&React.createElement("div",{className:"wbc-operator"},React.createElement("div",null,React.createElement("select",{defaultValue:n.operator,onChange:function(t){var n=Object.assign({},e.condition);n.operator=t.target.value,e.onChange(n)}},React.createElement("option",{value:"and"},f("And","wicked-block-conditions")),React.createElement("option",{value:"or"},f("Or","wicked-block-conditions")))));return t=n.conditions.length?React.createElement(g,{setState:e.setState,conditions:n.conditions,onChange:function(t){var n=Object.assign({},e.condition);n.conditions=t,e.onChange(n)}}):React.createElement("p",{className:"wbc-empty-group"},f("This group does not have any conditions yet.","wicked-block-conditions")),"group"==o?React.createElement("li",{className:"wbc-group-condition","data-guid":n.guid},i,React.createElement("div",{className:"wbc-content"},React.createElement("div",{className:"wbc-head"},React.createElement("h3",null,f("Condition Group","wicked-block-conditions"))),React.createElement("div",{className:"wbc-body"},t),React.createElement("div",{className:"wbc-foot"},React.createElement(h,{isLink:!0,onClick:function(){!function(t){e.setState((function(e){return{action:"select-condition",group:t.guid}}))}(n)}},f("Add Condition","wicked-block-conditions")),React.createElement("span",{className:"wbc-separator"},"|"),React.createElement(h,{isLink:!0,onClick:function(){n.conditions.length?confirm(f("This will delete all conditions in the group.  Are you sure?","wicked-block-conditions"))&&e.onDelete(n):e.onDelete(n)}},f("Delete Group","wicked-block-conditions"))))):React.createElement("li",{className:"wbc-condition","data-guid":n.guid},i,React.createElement("div",{className:"wbc-content"},n.label),React.createElement("div",{className:"wbc-edit"},React.createElement(h,{onClick:function(){e.setState((function(e){return{action:"edit-condition",activeCondition:n.guid}}))}},React.createElement(b,{icon:"admin-generic",size:"20"}))))};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)}const g=function(e){var t=function(t){var n=e.conditions.map((function(e){return e.guid==t.guid?t:e}));e.onChange(n)},n=function(t){var n=e.conditions.filter((function(e){return e.guid!=t.guid}));e.onChange(n)},o=e.conditions.map((function(o,i){return React.createElement(w,v({},e,{key:o.guid,index:i,condition:o,onChange:t,onDelete:n}))}));return React.createElement("ul",{className:e.className||""},o)};var k=wp.i18n.__,y=lodash.assign,E=wp.element.Fragment,R=wp.components.Button;const C=function(e){var t=e.attributes.wickedBlockConditions,n=t.action,o=t.conditions,i=y({},e.attributes.wickedBlockConditions);return o.length?React.createElement(E,null,React.createElement(p,{option:n,onChange:function(t){i.action=t,e.setAttributes({wickedBlockConditions:i})}}),React.createElement(g,{setState:e.setState,conditions:o,onChange:function(t){i.conditions=t,e.setAttributes({wickedBlockConditions:i})},className:"wbc-conditions"}),React.createElement("p",null,React.createElement(R,{isLink:!0,onClick:function(){var t;t={guid:l(),type:"group",label:k("Condition Group","wicked-block-conditions"),operator:"and",conditions:[]},i.conditions=i.conditions.slice(0),i.conditions.push(t),e.setAttributes({wickedBlockConditions:i})}},k("Add Condition Group","wicked-block-conditions")))):React.createElement("div",{className:"wbc-start"},React.createElement("p",null,k("Show or hide this block based on conditions.  Add a condition to get started.","wicked-block-conditions")),React.createElement("p",null,React.createElement(R,{isLink:!0,onClick:function(){e.setState((function(e){return{action:"select-condition"}}))}},k("Add Condition","wicked-block-conditions"))))};var x=wp.i18n.__,O=lodash,_=O.assign,S=O.chain,P=(O.find,wp.element.Fragment),j=wp.components.Button;const T=function(e){var t=S(e.wickedBlockConditions.conditions).groupBy("group").map((function(e,t){return{name:t,conditions:e}})).value().map((function(t){var n=t.conditions.map((function(t){return React.createElement("li",null,React.createElement(j,{isLink:!0,onClick:function(){!function(t){var n={action:e.attributes.wickedBlockConditions.action,conditions:e.attributes.wickedBlockConditions.conditions.slice(0)},o=c(n.conditions,e.group),i=_({guid:l(),type:t.type,label:t.label,operator:"and",conditions:[]},t.default);o||(o={guid:l(),type:"group",label:x("Condition Group","wicked-block-conditions"),operator:"and",conditions:[]},n.conditions.push(o)),o.conditions.push(i),n.conditions=a(n.conditions,o),e.setAttributes({wickedBlockConditions:n}),t.bypassConfig?e.setState((function(e){return{action:"view-conditions"}})):e.setState((function(e){return{action:"edit-condition",activeCondition:i.guid}}))}(t)}},t.label))}));return React.createElement(P,null,React.createElement("h3",null,t.name),React.createElement("ul",null,n))}));return React.createElement("div",{className:"wbc-select-condition"},React.createElement("p",null,x("Select a condition to add:","wicked-block-conditions")),t,React.createElement(j,{variant:"secondary",onClick:function(){e.setState((function(e){return{action:"view-conditions"}}))}},x("Cancel","wicked-block-conditions")))};var N=wp.i18n.__,D=wp.components,B=D.TextControl,A=D.ToggleControl,F=D.Button,I=lodash,U=I.find,G=I.assign;const L=function(e){var t=c(e.attributes.wickedBlockConditions.conditions,e.activeCondition),n=U(e.wickedBlockConditions.conditions,{type:t.type}),o=Object.assign({},e.attributes.wickedBlockConditions),i=n.edit,r=function(){o.conditions=a(o.conditions,t),e.setAttributes({wickedBlockConditions:o})};return React.createElement("div",{className:"wbc-edit-condition"},React.createElement("h3",null,e.isNew?N("Add Condition","wicked-block-conditions"):N("Edit Condition","wicked-block-conditions"),": ",n.label),React.createElement("p",null,n.description),React.createElement(B,{label:N("Label","wicked-block-conditions"),help:N("Briefly explain what this condition does.","wicked-block-conditions"),value:t.label,onChange:function(e){return n=e,t.label=n,void r();var n}}),React.createElement(A,{label:N("Negate condition","wicked-block-conditions"),checked:t.negate,help:N("Reverses the outcome of the condition.","wicked-block-conditions"),onChange:function(e){t.negate=e,r()}}),React.createElement(i,{condition:t,onChange:function(e){t=G({},t,e),r()}}),React.createElement("div",{className:"wbc-foot"},React.createElement("div",{className:"wbc-save"},React.createElement(F,{isPrimary:!0,onClick:function(){e.setState((function(e){return{action:"view-conditions",activeCondition:null}}))}},N("Save","wicked-block-conditions"))),React.createElement("div",{className:"wbc-delete"},React.createElement(F,{variant:"secondary",isDestructive:!0,onClick:function(){o.conditions=s(o.conditions,t),e.setAttributes({wickedBlockConditions:o}),e.setState((function(e){return{action:"view-conditions",activeCondition:null}}))}},N("Delete","wicked-block-conditions")))))};var H=wp.element.Fragment,V=function(e){var t=e.children,n=e.activePanel,o=t.map((function(e,t){if(n==e.props.name)return React.createElement("div",{key:t,className:"wicked-slider-panel"},e)}));return React.createElement("div",{className:"wicked-slider-panels"},o)},q=function(e){var t=e.children;return React.createElement(H,null,t)},z=wp.i18n.__,Y=lodash,M=Y.map,Q=Y.filter,W=wp.data.withSelect,$=wp.components.SelectControl;const J=W((function(e){var t=e("core/editor").getCurrentPost();return{post:t,taxonomies:t?e("core").getTaxonomies():void 0}}))((function(e){var t=e.taxonomies,n=e.post,o=e.selectedTaxonomy,i=e.onChange;if(t){var r=Q(t,(function(e){return-1!==e.types.indexOf(n.type)})),c=M(r,(function(e){return{value:e.slug,label:e.name}}));return c.unshift({value:"",label:z("Select a taxonomy","wicked-block-conditions")}),r.length?React.createElement($,{label:z("Taxonomy","wicked-block-conditions"),value:o,onChange:i,options:c}):React.createElement("p",null,z("No terms can be selected because this post type does not have any taxonomies assigned to it.","wicked-block-conditions"))}return React.createElement("div",null,z("Loading...","wicked-block-conditions"))}));var K=wp.i18n.__,X=lodash,Z=X.map,ee=X.filter,te=X.find,ne=X.union,oe=X.without,ie=wp.data.withSelect,re=wp.components,ce=re.CheckboxControl,ae=re.FormTokenField;const se=ie((function(e,t){var n=t.taxonomy,o=e("core"),i=o.getTaxonomy,r=o.getEntityRecords;return{taxonomyObject:n?i(n):void 0,terms:n?r("taxonomy",n):void 0}}))((function(e){e.taxonomy;var t=e.selectedTerms,n=void 0===t?[]:t,o=e.taxonomyObject,i=e.terms,r=e.onChange,c=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return Z(i,(function(t){return t.parent==e&&React.createElement("div",{key:t.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},React.createElement(ce,{label:t.name,checked:-1!==n.indexOf(t.slug),onChange:function(e){return o=t.slug,i=e?ne(n,[o]):oe(n,o),void r(i);var o,i}}),React.createElement("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},c(t.id)))}))};if(o&&i){if(o.hierarchical)return React.createElement("div",{class:"wbc-terms"},React.createElement("h3",null,K("Terms","wicked-block-conditions")),c());var a=Z(i,(function(e){return e.name})),s=Z(ee(i,(function(e){return-1!==n.indexOf(e.slug)})),(function(e){return e.name}));return React.createElement("div",{class:"wbc-terms"},React.createElement(ae,{value:s,suggestions:a,maxSuggestions:20,label:K("Tags","wicked-block-conditions"),onChange:function(e){var t=Z(e,(function(e){var t=te(i,{name:e});return t?t.slug:e}));r(t)}}))}return!1}));var le=wp.element.Fragment;var ue=wp.i18n.__,de=wp.components.TextControl;var pe=wp.i18n.__,fe=wp.components.TextControl;var me=wp.i18n.__,he=wp.components.RadioControl;var be=wp.i18n.__,we=lodash.assign,ve=wp.date,ge=ve.dateI18n,ke=ve.__experimentalGetSettings,ye=(wp.element.Fragment,wp.components),Ee=ye.RadioControl,Re=ye.DatePicker,Ce=ye.DateTimePicker,xe=ye.Button,Oe=ye.Dropdown,_e=ye.PanelRow;wp.i18n.__;var Se=lodash,Pe=Se.map,je=Se.union,Te=Se.without,Ne=wp.data.withSelect,De=wp.components,Be=De.CheckboxControl,Ae=De.Spinner;const Fe=Ne((function(e,t){return t.roles,{roles:(0,e("wicked-plugins/wicked-block-conditions").receiveUserRoles)()}}))((function(e){var t=e.selectedRoles,n=void 0===t?[]:t,o=e.roles,i=e.onChange;if(o){var r=Pe(o,(function(e){return React.createElement(Be,{label:e.label,checked:-1!==n.indexOf(e.value),onChange:function(t){return function(e,t){var o=t?je(n,[e]):Te(n,e);i(o)}(e.value,t)}})}));return React.createElement("div",{class:"wbc-user-roles"},r)}return React.createElement(Ae,null)}));var Ie=wp.i18n.__,Ue=wp.components.TextControl;var Ge=wp.i18n.__,Le=wp.components.TextControl;var He=wp.i18n.__,Ve=wp.date.date,qe=function(){return!1},ze=[];function Ye(e){return Ye="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},Ye(e)}function Me(){return Me=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},Me.apply(null,arguments)}function Qe(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 We(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qe(Object(n),!0).forEach((function(t){$e(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function $e(e,t,n){return(t=function(e){var t=function(e){if("object"!=Ye(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ye(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ye(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Je(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,i,r,c,a=[],s=!0,l=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(o=r.call(n)).done)&&(a.push(o.value),a.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(c=n.return(),Object(c)!==c))return}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ke(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)?Ke(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ke(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}ze.push({type:"user_is_logged_in",label:He("User Is Logged In","wicked-block-conditions"),group:He("User Conditions","wicked-block-conditions"),description:He("Returns true if a user is logged in.","wicked-block-conditions"),bypassConfig:!0,edit:qe}),ze.push({type:"user_is_not_logged_in",label:He("User Is Not Logged In","wicked-block-conditions"),group:He("User Conditions","wicked-block-conditions"),description:He("Returns true if a user is not logged in.","wicked-block-conditions"),bypassConfig:!0,edit:qe}),ze.push({type:"user_has_role",label:He("User Has Role","wicked-block-conditions"),group:He("User Conditions","wicked-block-conditions"),description:He("Returns true if the user is assigned to any of the selected roles.","wicked-block-conditions"),edit:function(e){var t=e.condition,n=e.onChange,o=t.roles;return React.createElement(Fe,{selectedRoles:o,onChange:function(e){n({roles:e})}})}}),ze.push({type:"post_id",label:He("Check Post ID","wicked-block-conditions"),group:He("Post Conditions","wicked-block-conditions"),description:He("Returns true if the post has the specified ID.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.postId;return React.createElement(de,{label:ue("Post ID","wicked-block-conditions"),type:"number",min:1,step:1,value:o,onChange:function(e){n({postId:parseInt(e)})}})}}),ze.push({type:"post_slug",label:He("Check Post Slug","wicked-block-conditions"),group:He("Post Conditions","wicked-block-conditions"),description:He("Returns true if the post has the specified slug.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.slug;return React.createElement(fe,{label:pe("Post Slug","wicked-block-conditions"),value:o,onChange:function(e){n({slug:e})}})}}),ze.push({type:"post_has_term",label:He("Post Has a Term","wicked-block-conditions"),group:He("Post Conditions","wicked-block-conditions"),description:He("Returns true if the post has the selected term(s) assigned.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.taxonomy,i=t.terms;return React.createElement(le,null,React.createElement(J,{selectedTaxonomy:o,onChange:function(e){n({taxonomy:e,terms:i})}}),React.createElement(se,{taxonomy:o,selectedTerms:i,onChange:function(e){n({taxonomy:o,terms:e})}}))}}),ze.push({type:"post_status",label:He("Check Post Status","wicked-block-conditions"),group:He("Post Conditions","wicked-block-conditions"),description:He("Returns true if post status matches the selected option.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.status;return React.createElement(he,{label:me("Post Status","wicked-block-conditions"),selected:o,options:[{label:me("Published","wicked-block-conditions"),value:"publish"},{label:me("Pending","wicked-block-conditions"),value:"pending"},{label:me("Draft","wicked-block-conditions"),value:"draft"},{label:me("Future","wicked-block-conditions"),value:"future"},{label:me("Private","wicked-block-conditions"),value:"private"},{label:me("Password Protected","wicked-block-conditions"),value:"password"}],onChange:function(e){!function(e){n({status:e})}(e)}})},default:{status:"publish"}}),ze.push({type:"current_date",label:He("Check The Date","wicked-block-conditions"),group:He("Date Conditions","wicked-block-conditions"),description:He("Returns true if the current date matches the specified conditions.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.onChange,n=we({},e.condition),o=n.compare,i=n.date,r=be("between"==o?"Start Date":"Date","wicked-block-conditions"),c=ke(),a="same day"==o?c.formats.date:c.formats.datetimeAbbreviated,s=function(e){n.date=e,t(n)};return React.createElement("div",{className:"wbc-current-date-condition"},React.createElement(Ee,{label:be("Current date is:","wicked-block-conditions"),selected:o,options:[{label:be("Before","wicked-block-conditions"),value:"before"},{label:be("After","wicked-block-conditions"),value:"after"},{label:be("The same as","wicked-block-conditions"),value:"same day"}],onChange:function(e){!function(e){n.compare=e,t(n)}(e)}}),React.createElement(_e,null,React.createElement("span",null,r),React.createElement("div",null,React.createElement(Oe,{className:"wbc-date-popup",contentClassName:"wbc-date-popup-content",position:"bottom right",renderToggle:function(e){var t=e.isOpen,n=e.onToggle;return React.createElement(xe,{onClick:n,"aria-expanded":t,isLink:!0},ge(a,i))},renderContent:function(){return React.createElement("div",null,"same day"==o?React.createElement(Re,{currentDate:i,is12Hour:!0,onChange:function(e){s(e)}}):React.createElement(Ce,{currentDate:i,is12Hour:!0,onChange:function(e){s(e)}}))}}))),React.createElement(_e,null,React.createElement("em",null,be("Note: Be sure that a timezone has been set for your site on the Settings > General page and that the date you select above is for that timezone.","wicked-block-conditions"))),"between"==o&&React.createElement(_e,null,React.createElement("span",null,be("End date","wicked-block-conditions")),React.createElement("div",null,React.createElement(Oe,{className:"wbc-date-popup",contentClassName:"wbc-date-popup-content",position:"bottom right",renderToggle:function(e){var t=e.isOpen,n=e.onToggle;return React.createElement(xe,{onClick:n,"aria-expanded":t,isLink:!0},ge(a,dateTwo))},renderContent:function(){return React.createElement("div",null,React.createElement(Ce,{currentDate:dateTwo,is12Hour:!0,onChange:function(e){handleChangeDateTwo(e)}}))}}))))},default:{compare:"before",date:Ve("Y-m-d H:i:00",new Date)}}),ze.push({type:"user_function",label:He("Check a User-Defined Function","wicked-block-conditions"),group:He("Advanced","wicked-block-conditions"),description:He("Returns the result of a user-defined function.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.function;return React.createElement(Ue,{label:Ie("Function","wicked-block-conditions"),help:Ie("Enter the name of a PHP function to call.  Your function should return a value of true or false.  Any value other than true will be considered false.","wicked-block-conditions"),value:o,onChange:function(e){return function(e){n({function:e})}(e)}})}}),ze.push({type:"query_string",label:He("Check a Query String Value","wicked-block-conditions"),group:He("Advanced","wicked-block-conditions"),description:He("Returns true if the specified query string parameter is matched.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.parameter,i=t.value;return React.createElement(React.Fragment,null,React.createElement(Le,{label:Ge("Parameter","wicked-block-conditions"),help:Ge("The name of the query string parameter to check.","wicked-block-conditions"),value:o,onChange:function(e){return function(e){n({parameter:e,value:i})}(e)}}),React.createElement(Le,{label:Ge("Value","wicked-block-conditions"),help:Ge("The value to check for.","wicked-block-conditions"),value:i,onChange:function(e){return function(e){n({parameter:o,value:e})}(e)}}))},default:{parameter:"",value:""}}),n(446);var Xe=wp.i18n.__,Ze=lodash.assign,et=wp.element,tt=et.Fragment,nt=et.useState,ot=wp.components.PanelBody,it=wp.compose.createHigherOrderComponent,rt=wp.blockEditor.InspectorControls,ct=wp.hooks,at=ct.addFilter,st=ct.applyFilters;at("blocks.registerBlockType","wicked-block-conditions/add-attribute",(function(e){return e.attributes=Ze(e.attributes,{wickedBlockConditions:{type:"object",default:{action:"show",conditions:[]}}}),e})),at("blocks.getSaveContent.extraProps","wicked-block-conditions/add-props",(function(e,t,n){return e.wickedBlockConditions=n.wickedBlockConditions,e}));var lt=function(e){var t=Je(nt(!1),2),n=t[0],o=t[1],i=Je(nt("view-conditions"),2),r=i[0],c=i[1],a=Je(nt(null),2),s=a[0],l=a[1],u=Je(nt(null),2),d=u[0],p=u[1],f=We(We({},e),{},{action:r,activeCondition:s,group:d,setState:function(e){var t=e();t.hasOwnProperty("action")&&c(t.action),t.hasOwnProperty("activeCondition")&&l(t.activeCondition),t.hasOwnProperty("group")&&p(t.group)}});return React.createElement(rt,null,React.createElement(ot,{title:Xe("Display Conditions","wicked-block-conditions"),initialOpen:n,onToggle:function(){o(!n)}},React.createElement(V,{activePanel:r},React.createElement(q,{name:"view-conditions"},React.createElement(C,f)),React.createElement(q,{name:"select-condition"},React.createElement(T,f)),React.createElement(q,{name:"edit-condition"},React.createElement(L,f)))))};const ut=it((function(e){var t={conditions:st("wickedBlockConditions.conditions",ze)};return function(n){return React.createElement(tt,null,React.createElement(e,n),React.createElement(lt,Me({},n,{wickedBlockConditions:t})))}}),"withConditions");var dt=wp.hooks,pt=dt.addFilter;dt.removeFilter,pt("editor.BlockEdit","wicked-block-conditions/with-conditions",ut)})()})();
  • wicked-block-conditions/tags/1.2.5/dist/index.js.LICENSE.txt

    r3193711 r3292137  
    1 /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
     1/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
  • wicked-block-conditions/tags/1.2.5/readme.txt

    r3193711 r3292137  
    44Requires at least: 5.0
    55Tested up to: 6.7
    6 Stable tag: 1.2.4
     6Stable tag: 1.2.5
    77Requires PHP: 7.4
    88License: GPLv2 or later
     
    7676== Changelog ==
    7777
     78= 1.2.5 (May 12, 2025)
     79* Fix: 'store “core/interface” is already registered' error
     80* Fix: wp_enqueue_script doing-it-wrong warning message when debugging is enabled
     81
    7882= 1.2.4 (November 20, 2024) =
    7983* Tweak: clean up plugin to exclude configuration and source files
  • wicked-block-conditions/tags/1.2.5/wicked-block-conditions.php

    r3193711 r3292137  
    55Plugin URI: https://wickedplugins.com/wicked-block-conditions/
    66Description: Show or hide blocks based on conditions.
    7 Version: 1.2.4
     7Version: 1.2.5
    88Author: Wicked Plugins
    99Author URI: https://wickedplugins.com/
  • wicked-block-conditions/trunk/classes/class-wicked-block-conditions.php

    r2956915 r3292137  
    137137    public function enqueue_block_editor_assets() {
    138138        $script = plugin_dir_url( dirname( __FILE__ ) ) . 'dist/index.js';
     139        $deps = array( 'wp-blocks', 'wp-element', 'wp-data', 'wp-components', 'wp-i18n', 'lodash', 'wp-block-editor' );
    139140
    140141        if ( defined( 'WICKED_BLOCK_CONDITIONS_DEV' ) && WICKED_BLOCK_CONDITIONS_DEV ) {
     
    148149        // );
    149150
    150         wp_enqueue_script( 'wicked-block-conditions', $script, array( 'wp-blocks', 'wp-element', 'wp-editor', 'wp-data', 'wp-components', 'wp-i18n', 'lodash' ), Wicked_Block_Conditions::plugin_version() );
     151        wp_enqueue_script( 'wicked-block-conditions', $script, $deps, Wicked_Block_Conditions::plugin_version() );
    151152        //wp_localize_script( 'wicked-block-conditions', 'wickedBlockConditions', $data );
    152153
  • wicked-block-conditions/trunk/dist/index.js

    r2941036 r3292137  
    11/*! For license information please see index.js.LICENSE.txt */
    2 (()=>{var e={607:()=>{function e(t){return e="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(t)}function t(){"use strict";t=function(){return n};var n={},o=Object.prototype,i=o.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},c="function"==typeof Symbol?Symbol:{},a=c.iterator||"@@iterator",l=c.asyncIterator||"@@asyncIterator",s=c.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,o){var i=t&&t.prototype instanceof m?t:m,c=Object.create(i.prototype),a=new S(o||[]);return r(c,"_invoke",{value:R(e,n,a)}),c}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}n.wrap=d;var f={};function m(){}function h(){}function b(){}var v={};u(v,a,(function(){return this}));var w=Object.getPrototypeOf,g=w&&w(w(_([])));g&&g!==o&&i.call(g,a)&&(v=g);var k=b.prototype=m.prototype=Object.create(v);function y(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function E(t,n){function o(r,c,a,l){var s=p(t[r],t,c);if("throw"!==s.type){var u=s.arg,d=u.value;return d&&"object"==e(d)&&i.call(d,"__await")?n.resolve(d.__await).then((function(e){o("next",e,a,l)}),(function(e){o("throw",e,a,l)})):n.resolve(d).then((function(e){u.value=e,a(u)}),(function(e){return o("throw",e,a,l)}))}l(s.arg)}var c;r(this,"_invoke",{value:function(e,t){function i(){return new n((function(n,i){o(e,t,n,i)}))}return c=c?c.then(i,i):i()}})}function R(e,t,n){var o="suspendedStart";return function(i,r){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===i)throw r;return{value:void 0,done:!0}}for(n.method=i,n.arg=r;;){var c=n.delegate;if(c){var a=C(c,n);if(a){if(a===f)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===o)throw o="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o="executing";var l=p(e,t,n);if("normal"===l.type){if(o=n.done?"completed":"suspendedYield",l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o="completed",n.method="throw",n.arg=l.arg)}}}function C(e,t){var n=t.method,o=e.iterator[n];if(void 0===o)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,C(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var i=p(o,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,f;var r=i.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function x(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 O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function _(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(i.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:P}}function P(){return{value:void 0,done:!0}}return h.prototype=b,r(k,"constructor",{value:b,configurable:!0}),r(b,"constructor",{value:h,configurable:!0}),h.displayName=u(b,s,"GeneratorFunction"),n.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},n.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,u(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},n.awrap=function(e){return{__await:e}},y(E.prototype),u(E.prototype,l,(function(){return this})),n.AsyncIterator=E,n.async=function(e,t,o,i,r){void 0===r&&(r=Promise);var c=new E(d(e,t,o,i),r);return n.isGeneratorFunction(t)?c:c.next().then((function(e){return e.done?e.value:c.next()}))},y(k),u(k,s,"Generator"),u(k,a,(function(){return this})),u(k,"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=_,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},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 t=this;function n(n,o){return c.type="throw",c.arg=e,t.next=n,o&&(t.method="next",t.arg=void 0),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var r=this.tryEntries[o],c=r.completion;if("root"===r.tryLoc)return n("end");if(r.tryLoc<=this.prev){var a=i.call(r,"catchLoc"),l=i.call(r,"finallyLoc");if(a&&l){if(this.prev<r.catchLoc)return n(r.catchLoc,!0);if(this.prev<r.finallyLoc)return n(r.finallyLoc)}else if(a){if(this.prev<r.catchLoc)return n(r.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return n(r.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 c=r?r.completion:{};return c.type=e,c.arg=t,r?(this.method="next",this.next=r.finallyLoc,f):this.complete(c)},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),f},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),O(n),f}},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 i=o.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:_(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},n}function n(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 o=null!=arguments[t]?arguments[t]:{};t%2?n(Object(o),!0).forEach((function(t){i(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function i(t,n,o){return(n=function(t){var n=function(t,n){if("object"!==e(t)||null===t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var i=o.call(t,"string");if("object"!==e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===e(n)?n:String(n)}(n))in t?Object.defineProperty(t,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[n]=o,t}var r=wp.apiFetch,c=wp.data,a=c.registerStore,l=(c.withSelect,{setUserRoles:function(e){return{type:"SET_USER_ROLES",userRoles:e}},receiveUserRoles:function(e){return{type:"RECEIVE_USER_ROLES",path:e}}});a("wicked-plugins/wicked-block-conditions",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{userRoles:{}},t=arguments.length>1?arguments[1]:void 0;return"SET_USER_ROLES"===t.type?o(o({},e),{},{userRoles:t.userRoles}):e},actions:l,selectors:{receiveUserRoles:function(e){return e.userRoles}},controls:{RECEIVE_USER_ROLES:function(e){return r({path:e.path})}},resolvers:{receiveUserRoles:t().mark((function e(n){var o;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l.receiveUserRoles("/wicked-block-conditions/v1/user-roles/");case 2:return o=e.sent,e.abrupt("return",l.setUserRoles(o));case 4:case"end":return e.stop()}}),e)}))}})}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}(()=>{"use strict";var e=lodash,t=e.find,o=e.forEach,i=e.isUndefined,r=e.filter,c=function e(n,i){var r=!1;return(r=t(n,(function(e){return e.guid==i})))||o(n,(function(t){var n=e(t.conditions,i);n&&(r=n)})),r},a=function e(t,n){return t.map((function(t){return t.guid==n.guid?n:(i(t.conditions)||(t.conditions=e(t.conditions,n)),t)}))},l=function e(t,n){return r(t,(function(e){return e.guid!=n.guid})).map((function(t){return i(t.conditions)||(t.conditions=e(t.conditions,n)),t}))},s=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))},u=wp.i18n.__,d=wp.components.RadioControl;const p=function(e){var t=e.option,n=e.onChange;return React.createElement(d,{label:u("When conditions are met:","wicked-block-conditions"),selected:t,options:[{label:u("Show this block","wicked-block-conditions"),value:"show"},{label:u("Hide this block","wicked-block-conditions"),value:"hide"}],onChange:function(e){n(e)}})};var f=wp.i18n.__,m=wp.components,h=m.Button,b=m.Icon;const v=function(e){var t,n=e.condition,o=n.type,i=0!=e.index&&React.createElement("div",{className:"wbc-operator"},React.createElement("div",null,React.createElement("select",{defaultValue:n.operator,onChange:function(t){var n=Object.assign({},e.condition);n.operator=t.target.value,e.onChange(n)}},React.createElement("option",{value:"and"},f("And","wicked-block-conditions")),React.createElement("option",{value:"or"},f("Or","wicked-block-conditions")))));return t=n.conditions.length?React.createElement(g,{setState:e.setState,conditions:n.conditions,onChange:function(t){var n=Object.assign({},e.condition);n.conditions=t,e.onChange(n)}}):React.createElement("p",{className:"wbc-empty-group"},f("This group does not have any conditions yet.","wicked-block-conditions")),"group"==o?React.createElement("li",{className:"wbc-group-condition","data-guid":n.guid},i,React.createElement("div",{className:"wbc-content"},React.createElement("div",{className:"wbc-head"},React.createElement("h3",null,f("Condition Group","wicked-block-conditions"))),React.createElement("div",{className:"wbc-body"},t),React.createElement("div",{className:"wbc-foot"},React.createElement(h,{isLink:!0,onClick:function(){!function(t){e.setState((function(e){return{action:"select-condition",group:t.guid}}))}(n)}},f("Add Condition","wicked-block-conditions")),React.createElement("span",{className:"wbc-separator"},"|"),React.createElement(h,{isLink:!0,onClick:function(){n.conditions.length?confirm(f("This will delete all conditions in the group.  Are you sure?","wicked-block-conditions"))&&e.onDelete(n):e.onDelete(n)}},f("Delete Group","wicked-block-conditions"))))):React.createElement("li",{className:"wbc-condition","data-guid":n.guid},i,React.createElement("div",{className:"wbc-content"},n.label),React.createElement("div",{className:"wbc-edit"},React.createElement(h,{onClick:function(){e.setState((function(e){return{action:"edit-condition",activeCondition:n.guid}}))}},React.createElement(b,{icon:"admin-generic",size:"20"}))))};function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},w.apply(this,arguments)}const g=function(e){var t=function(t){var n=e.conditions.map((function(e){return e.guid==t.guid?t:e}));e.onChange(n)},n=function(t){var n=e.conditions.filter((function(e){return e.guid!=t.guid}));e.onChange(n)},o=e.conditions.map((function(o,i){return React.createElement(v,w({},e,{key:o.guid,index:i,condition:o,onChange:t,onDelete:n}))}));return React.createElement("ul",{className:e.className||""},o)};var k=wp.i18n.__,y=lodash.assign,E=wp.element.Fragment,R=wp.components.Button;const C=function(e){var t=e.attributes.wickedBlockConditions,n=t.action,o=t.conditions,i=y({},e.attributes.wickedBlockConditions);return o.length?React.createElement(E,null,React.createElement(p,{option:n,onChange:function(t){i.action=t,e.setAttributes({wickedBlockConditions:i})}}),React.createElement(g,{setState:e.setState,conditions:o,onChange:function(t){i.conditions=t,e.setAttributes({wickedBlockConditions:i})},className:"wbc-conditions"}),React.createElement("p",null,React.createElement(R,{isLink:!0,onClick:function(){var t;t={guid:s(),type:"group",label:k("Condition Group","wicked-block-conditions"),operator:"and",conditions:[]},i.conditions=i.conditions.slice(0),i.conditions.push(t),e.setAttributes({wickedBlockConditions:i})}},k("Add Condition Group","wicked-block-conditions")))):React.createElement("div",{className:"wbc-start"},React.createElement("p",null,k("Show or hide this block based on conditions.  Add a condition to get started.","wicked-block-conditions")),React.createElement("p",null,React.createElement(R,{isLink:!0,onClick:function(){e.setState((function(e){return{action:"select-condition"}}))}},k("Add Condition","wicked-block-conditions"))))};var x=wp.i18n.__,O=lodash,S=O.assign,_=O.chain,P=(O.find,wp.element.Fragment),j=wp.components.Button;const L=function(e){var t=_(e.wickedBlockConditions.conditions).groupBy("group").map((function(e,t){return{name:t,conditions:e}})).value().map((function(t){var n=t.conditions.map((function(t){return React.createElement("li",null,React.createElement(j,{isLink:!0,onClick:function(){!function(t){var n={action:e.attributes.wickedBlockConditions.action,conditions:e.attributes.wickedBlockConditions.conditions.slice(0)},o=c(n.conditions,e.group),i=S({guid:s(),type:t.type,label:t.label,operator:"and",conditions:[]},t.default);o||(o={guid:s(),type:"group",label:x("Condition Group","wicked-block-conditions"),operator:"and",conditions:[]},n.conditions.push(o)),o.conditions.push(i),n.conditions=a(n.conditions,o),e.setAttributes({wickedBlockConditions:n}),t.bypassConfig?e.setState((function(e){return{action:"view-conditions"}})):e.setState((function(e){return{action:"edit-condition",activeCondition:i.guid}}))}(t)}},t.label))}));return React.createElement(P,null,React.createElement("h3",null,t.name),React.createElement("ul",null,n))}));return React.createElement("div",{className:"wbc-select-condition"},React.createElement("p",null,x("Select a condition to add:","wicked-block-conditions")),t,React.createElement(j,{variant:"secondary",onClick:function(){e.setState((function(e){return{action:"view-conditions"}}))}},x("Cancel","wicked-block-conditions")))};var T=wp.i18n.__,N=wp.components,D=N.TextControl,B=N.ToggleControl,A=N.Button,F=lodash,I=F.find,U=F.assign;const G=function(e){var t=c(e.attributes.wickedBlockConditions.conditions,e.activeCondition),n=I(e.wickedBlockConditions.conditions,{type:t.type}),o=Object.assign({},e.attributes.wickedBlockConditions),i=n.edit,r=function(){o.conditions=a(o.conditions,t),e.setAttributes({wickedBlockConditions:o})};return React.createElement("div",{className:"wbc-edit-condition"},React.createElement("h3",null,e.isNew?T("Add Condition","wicked-block-conditions"):T("Edit Condition","wicked-block-conditions"),": ",n.label),React.createElement("p",null,n.description),React.createElement(D,{label:T("Label","wicked-block-conditions"),help:T("Briefly explain what this condition does.","wicked-block-conditions"),value:t.label,onChange:function(e){return n=e,t.label=n,void r();var n}}),React.createElement(B,{label:T("Negate condition","wicked-block-conditions"),checked:t.negate,help:T("Reverses the outcome of the condition.","wicked-block-conditions"),onChange:function(e){t.negate=e,r()}}),React.createElement(i,{condition:t,onChange:function(e){t=U({},t,e),r()}}),React.createElement("div",{className:"wbc-foot"},React.createElement("div",{className:"wbc-save"},React.createElement(A,{isPrimary:!0,onClick:function(){e.setState((function(e){return{action:"view-conditions",activeCondition:null}}))}},T("Save","wicked-block-conditions"))),React.createElement("div",{className:"wbc-delete"},React.createElement(A,{variant:"secondary",isDestructive:!0,onClick:function(){o.conditions=l(o.conditions,t),e.setAttributes({wickedBlockConditions:o}),e.setState((function(e){return{action:"view-conditions",activeCondition:null}}))}},T("Delete","wicked-block-conditions")))))};var H=wp.element.Fragment,V=function(e){var t=e.children,n=e.activePanel,o=t.map((function(e,t){if(n==e.props.name)return React.createElement("div",{key:t,className:"wicked-slider-panel"},e)}));return React.createElement("div",{className:"wicked-slider-panels"},o)},Y=function(e){var t=e.children;return React.createElement(H,null,t)},q=wp.i18n.__,z=lodash,M=z.map,Q=z.filter,W=wp.data.withSelect,$=wp.components.SelectControl;const J=W((function(e){var t=e("core/editor").getCurrentPost();return{post:t,taxonomies:t?e("core").getTaxonomies():void 0}}))((function(e){var t=e.taxonomies,n=e.post,o=e.selectedTaxonomy,i=e.onChange;if(t){var r=Q(t,(function(e){return-1!==e.types.indexOf(n.type)})),c=M(r,(function(e){return{value:e.slug,label:e.name}}));return c.unshift({value:"",label:q("Select a taxonomy","wicked-block-conditions")}),r.length?React.createElement($,{label:q("Taxonomy","wicked-block-conditions"),value:o,onChange:i,options:c}):React.createElement("p",null,q("No terms can be selected because this post type does not have any taxonomies assigned to it.","wicked-block-conditions"))}return React.createElement("div",null,q("Loading...","wicked-block-conditions"))}));var K=wp.i18n.__,X=lodash,Z=X.map,ee=X.filter,te=X.find,ne=X.union,oe=X.without,ie=wp.data.withSelect,re=wp.components,ce=re.CheckboxControl,ae=re.FormTokenField;const le=ie((function(e,t){var n=t.taxonomy,o=e("core"),i=o.getTaxonomy,r=o.getEntityRecords;return{taxonomyObject:n?i(n):void 0,terms:n?r("taxonomy",n):void 0}}))((function(e){e.taxonomy;var t=e.selectedTerms,n=void 0===t?[]:t,o=e.taxonomyObject,i=e.terms,r=e.onChange;if(o&&i){if(o.hierarchical)return React.createElement("div",{class:"wbc-terms"},React.createElement("h3",null,K("Terms","wicked-block-conditions")),function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return Z(i,(function(o){return o.parent==t&&React.createElement("div",{key:o.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},React.createElement(ce,{label:o.name,checked:-1!==n.indexOf(o.slug),onChange:function(e){return t=o.slug,i=e?ne(n,[t]):oe(n,t),void r(i);var t,i}}),React.createElement("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},e(o.id)))}))}());var c=Z(i,(function(e){return e.name})),a=Z(ee(i,(function(e){return-1!==n.indexOf(e.slug)})),(function(e){return e.name}));return React.createElement("div",{class:"wbc-terms"},React.createElement(ae,{value:a,suggestions:c,maxSuggestions:20,label:K("Tags","wicked-block-conditions"),onChange:function(e){var t=Z(e,(function(e){var t=te(i,{name:e});return t?t.slug:e}));r(t)}}))}return!1}));var se=wp.element.Fragment;var ue=wp.i18n.__,de=wp.components.TextControl;var pe=wp.i18n.__,fe=wp.components.TextControl;var me=wp.i18n.__,he=wp.components.RadioControl;var be=wp.i18n.__,ve=lodash.assign,we=wp.date,ge=we.dateI18n,ke=we.__experimentalGetSettings,ye=(wp.element.Fragment,wp.components),Ee=ye.RadioControl,Re=ye.DatePicker,Ce=ye.DateTimePicker,xe=ye.Button,Oe=ye.Dropdown,Se=ye.PanelRow;wp.i18n.__;var _e=lodash,Pe=_e.map,je=_e.union,Le=_e.without,Te=wp.data.withSelect,Ne=wp.components,De=Ne.CheckboxControl,Be=Ne.Spinner;const Ae=Te((function(e,t){return t.roles,{roles:(0,e("wicked-plugins/wicked-block-conditions").receiveUserRoles)()}}))((function(e){var t=e.selectedRoles,n=void 0===t?[]:t,o=e.roles,i=e.onChange;if(o){var r=Pe(o,(function(e){return React.createElement(De,{label:e.label,checked:-1!==n.indexOf(e.value),onChange:function(t){return function(e,t){var o=t?je(n,[e]):Le(n,e);i(o)}(e.value,t)}})}));return React.createElement("div",{class:"wbc-user-roles"},r)}return React.createElement(Be,null)}));var Fe=wp.i18n.__,Ie=wp.components.TextControl;var Ue=wp.i18n.__,Ge=wp.components.TextControl;var He=wp.i18n.__,Ve=wp.date.date,Ye=function(){return!1},qe=[];function ze(e){return ze="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},ze(e)}function Me(){return Me=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Me.apply(this,arguments)}function Qe(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 We(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qe(Object(n),!0).forEach((function(t){$e(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function $e(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==ze(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!==ze(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===ze(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Je(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,i,r,c,a=[],l=!0,s=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(o=r.call(n)).done)&&(a.push(o.value),a.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(c=n.return(),Object(c)!==c))return}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ke(e,t);var n=Object.prototype.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)?Ke(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ke(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}qe.push({type:"user_is_logged_in",label:He("User Is Logged In","wicked-block-conditions"),group:He("User Conditions","wicked-block-conditions"),description:He("Returns true if a user is logged in.","wicked-block-conditions"),bypassConfig:!0,edit:Ye}),qe.push({type:"user_is_not_logged_in",label:He("User Is Not Logged In","wicked-block-conditions"),group:He("User Conditions","wicked-block-conditions"),description:He("Returns true if a user is not logged in.","wicked-block-conditions"),bypassConfig:!0,edit:Ye}),qe.push({type:"user_has_role",label:He("User Has Role","wicked-block-conditions"),group:He("User Conditions","wicked-block-conditions"),description:He("Returns true if the user is assigned to any of the selected roles.","wicked-block-conditions"),edit:function(e){var t=e.condition,n=e.onChange,o=t.roles;return React.createElement(Ae,{selectedRoles:o,onChange:function(e){n({roles:e})}})}}),qe.push({type:"post_id",label:He("Check Post ID","wicked-block-conditions"),group:He("Post Conditions","wicked-block-conditions"),description:He("Returns true if the post has the specified ID.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.postId;return React.createElement(de,{label:ue("Post ID","wicked-block-conditions"),type:"number",min:1,step:1,value:o,onChange:function(e){n({postId:parseInt(e)})}})}}),qe.push({type:"post_slug",label:He("Check Post Slug","wicked-block-conditions"),group:He("Post Conditions","wicked-block-conditions"),description:He("Returns true if the post has the specified slug.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.slug;return React.createElement(fe,{label:pe("Post Slug","wicked-block-conditions"),value:o,onChange:function(e){n({slug:e})}})}}),qe.push({type:"post_has_term",label:He("Post Has a Term","wicked-block-conditions"),group:He("Post Conditions","wicked-block-conditions"),description:He("Returns true if the post has the selected term(s) assigned.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.taxonomy,i=t.terms;return React.createElement(se,null,React.createElement(J,{selectedTaxonomy:o,onChange:function(e){n({taxonomy:e,terms:i})}}),React.createElement(le,{taxonomy:o,selectedTerms:i,onChange:function(e){n({taxonomy:o,terms:e})}}))}}),qe.push({type:"post_status",label:He("Check Post Status","wicked-block-conditions"),group:He("Post Conditions","wicked-block-conditions"),description:He("Returns true if post status matches the selected option.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.status;return React.createElement(he,{label:me("Post Status","wicked-block-conditions"),selected:o,options:[{label:me("Published","wicked-block-conditions"),value:"publish"},{label:me("Pending","wicked-block-conditions"),value:"pending"},{label:me("Draft","wicked-block-conditions"),value:"draft"},{label:me("Future","wicked-block-conditions"),value:"future"},{label:me("Private","wicked-block-conditions"),value:"private"},{label:me("Password Protected","wicked-block-conditions"),value:"password"}],onChange:function(e){!function(e){n({status:e})}(e)}})},default:{status:"publish"}}),qe.push({type:"current_date",label:He("Check The Date","wicked-block-conditions"),group:He("Date Conditions","wicked-block-conditions"),description:He("Returns true if the current date matches the specified conditions.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.onChange,n=ve({},e.condition),o=n.compare,i=n.date,r=be("between"==o?"Start Date":"Date","wicked-block-conditions"),c=ke(),a="same day"==o?c.formats.date:c.formats.datetimeAbbreviated,l=function(e){n.date=e,t(n)};return React.createElement("div",{className:"wbc-current-date-condition"},React.createElement(Ee,{label:be("Current date is:","wicked-block-conditions"),selected:o,options:[{label:be("Before","wicked-block-conditions"),value:"before"},{label:be("After","wicked-block-conditions"),value:"after"},{label:be("The same as","wicked-block-conditions"),value:"same day"}],onChange:function(e){!function(e){n.compare=e,t(n)}(e)}}),React.createElement(Se,null,React.createElement("span",null,r),React.createElement("div",null,React.createElement(Oe,{className:"wbc-date-popup",contentClassName:"wbc-date-popup-content",position:"bottom right",renderToggle:function(e){var t=e.isOpen,n=e.onToggle;return React.createElement(xe,{onClick:n,"aria-expanded":t,isLink:!0},ge(a,i))},renderContent:function(){return React.createElement("div",null,"same day"==o?React.createElement(Re,{currentDate:i,is12Hour:!0,onChange:function(e){l(e)}}):React.createElement(Ce,{currentDate:i,is12Hour:!0,onChange:function(e){l(e)}}))}}))),React.createElement(Se,null,React.createElement("em",null,be("Note: Be sure that a timezone has been set for your site on the Settings > General page and that the date you select above is for that timezone.","wicked-block-conditions"))),"between"==o&&React.createElement(Se,null,React.createElement("span",null,be("End date","wicked-block-conditions")),React.createElement("div",null,React.createElement(Oe,{className:"wbc-date-popup",contentClassName:"wbc-date-popup-content",position:"bottom right",renderToggle:function(e){var t=e.isOpen,n=e.onToggle;return React.createElement(xe,{onClick:n,"aria-expanded":t,isLink:!0},ge(a,dateTwo))},renderContent:function(){return React.createElement("div",null,React.createElement(Ce,{currentDate:dateTwo,is12Hour:!0,onChange:function(e){handleChangeDateTwo(e)}}))}}))))},default:{compare:"before",date:Ve("Y-m-d H:i:00",new Date)}}),qe.push({type:"user_function",label:He("Check a User-Defined Function","wicked-block-conditions"),group:He("Advanced","wicked-block-conditions"),description:He("Returns the result of a user-defined function.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.function;return React.createElement(Ie,{label:Fe("Function","wicked-block-conditions"),help:Fe("Enter the name of a PHP function to call.  Your function should return a value of true or false.  Any value other than true will be considered false.","wicked-block-conditions"),value:o,onChange:function(e){return function(e){n({function:e})}(e)}})}}),qe.push({type:"query_string",label:He("Check a Query String Value","wicked-block-conditions"),group:He("Advanced","wicked-block-conditions"),description:He("Returns true if the specified query string parameter is matched.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.parameter,i=t.value;return React.createElement(React.Fragment,null,React.createElement(Ge,{label:Ue("Parameter","wicked-block-conditions"),help:Ue("The name of the query string parameter to check.","wicked-block-conditions"),value:o,onChange:function(e){return function(e){n({parameter:e,value:i})}(e)}}),React.createElement(Ge,{label:Ue("Value","wicked-block-conditions"),help:Ue("The value to check for.","wicked-block-conditions"),value:i,onChange:function(e){return function(e){n({parameter:o,value:e})}(e)}}))},default:{parameter:"",value:""}}),n(607);var Xe=wp.i18n.__,Ze=lodash.assign,et=wp.element,tt=et.Fragment,nt=et.useState,ot=wp.components.PanelBody,it=wp.compose.createHigherOrderComponent,rt=wp.blockEditor.InspectorControls,ct=wp.hooks,at=ct.addFilter,lt=ct.applyFilters;at("blocks.registerBlockType","wicked-block-conditions/add-attribute",(function(e){return e.attributes=Ze(e.attributes,{wickedBlockConditions:{type:"object",default:{action:"show",conditions:[]}}}),e})),at("blocks.getSaveContent.extraProps","wicked-block-conditions/add-props",(function(e,t,n){return e.wickedBlockConditions=n.wickedBlockConditions,e}));var st=function(e){var t=Je(nt(!1),2),n=t[0],o=t[1],i=Je(nt("view-conditions"),2),r=i[0],c=i[1],a=Je(nt(null),2),l=a[0],s=a[1],u=Je(nt(null),2),d=u[0],p=u[1],f=We(We({},e),{},{action:r,activeCondition:l,group:d,setState:function(e){var t=e();t.hasOwnProperty("action")&&c(t.action),t.hasOwnProperty("activeCondition")&&s(t.activeCondition),t.hasOwnProperty("group")&&p(t.group)}});return React.createElement(rt,null,React.createElement(ot,{title:Xe("Display Conditions","wicked-block-conditions"),initialOpen:n,onToggle:function(){o(!n)}},React.createElement(V,{activePanel:r},React.createElement(Y,{name:"view-conditions"},React.createElement(C,f)),React.createElement(Y,{name:"select-condition"},React.createElement(L,f)),React.createElement(Y,{name:"edit-condition"},React.createElement(G,f)))))};const ut=it((function(e){var t={conditions:lt("wickedBlockConditions.conditions",qe)};return function(n){return React.createElement(tt,null,React.createElement(e,n),React.createElement(st,Me({},n,{wickedBlockConditions:t})))}}),"withConditions");var dt=wp.hooks,pt=dt.addFilter;dt.removeFilter,pt("editor.BlockEdit","wicked-block-conditions/with-conditions",ut)})()})();
     2(()=>{var e={446:()=>{function e(t){return e="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(t)}function t(){"use strict";t=function(){return o};var n,o={},i=Object.prototype,r=i.hasOwnProperty,c="function"==typeof Symbol?Symbol:{},a=c.iterator||"@@iterator",s=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function u(e,t,n,o){return Object.defineProperty(e,t,{value:n,enumerable:!o,configurable:!o,writable:!o})}try{u({},"")}catch(n){u=function(e,t,n){return e[t]=n}}function d(e,t,o,i){var r=t&&t.prototype instanceof m?t:m,c=Object.create(r.prototype);return u(c,"_invoke",function(e,t,o){var i=1;return function(r,c){if(3===i)throw Error("Generator is already running");if(4===i){if("throw"===r)throw c;return{value:n,done:!0}}for(o.method=r,o.arg=c;;){var a=o.delegate;if(a){var s=R(a,o);if(s){if(s===f)continue;return s}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if(1===i)throw i=4,o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);i=3;var l=p(e,t,o);if("normal"===l.type){if(i=o.done?4:2,l.arg===f)continue;return{value:l.arg,done:o.done}}"throw"===l.type&&(i=4,o.method="throw",o.arg=l.arg)}}}(e,o,new O(i||[])),!0),c}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}o.wrap=d;var f={};function m(){}function h(){}function b(){}var w={};u(w,a,(function(){return this}));var v=Object.getPrototypeOf,g=v&&v(v(_([])));g&&g!==i&&r.call(g,a)&&(w=g);var k=b.prototype=m.prototype=Object.create(w);function y(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function E(t,n){function o(i,c,a,s){var l=p(t[i],t,c);if("throw"!==l.type){var u=l.arg,d=u.value;return d&&"object"==e(d)&&r.call(d,"__await")?n.resolve(d.__await).then((function(e){o("next",e,a,s)}),(function(e){o("throw",e,a,s)})):n.resolve(d).then((function(e){u.value=e,a(u)}),(function(e){return o("throw",e,a,s)}))}s(l.arg)}var i;u(this,"_invoke",(function(e,t){function r(){return new n((function(n,i){o(e,t,n,i)}))}return i=i?i.then(r,r):r()}),!0)}function R(e,t){var o=t.method,i=e.i[o];if(i===n)return t.delegate=null,"throw"===o&&e.i.return&&(t.method="return",t.arg=n,R(e,t),"throw"===t.method)||"return"!==o&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+o+"' method")),f;var r=p(i,e.i,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,f;var c=r.arg;return c?c.done?(t[e.r]=c.value,t.next=e.n,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,f):c:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function C(e){this.tryEntries.push(e)}function x(e){var t=e[4]||{};t.type="normal",t.arg=n,e[4]=t}function O(e){this.tryEntries=[[-1]],e.forEach(C,this),this.reset(!0)}function _(t){if(null!=t){var o=t[a];if(o)return o.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,c=function e(){for(;++i<t.length;)if(r.call(t,i))return e.value=t[i],e.done=!1,e;return e.value=n,e.done=!0,e};return c.next=c}}throw new TypeError(e(t)+" is not iterable")}return h.prototype=b,u(k,"constructor",b),u(b,"constructor",h),h.displayName=u(b,l,"GeneratorFunction"),o.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},o.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,u(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},o.awrap=function(e){return{__await:e}},y(E.prototype),u(E.prototype,s,(function(){return this})),o.AsyncIterator=E,o.async=function(e,t,n,i,r){void 0===r&&(r=Promise);var c=new E(d(e,t,n,i),r);return o.isGeneratorFunction(t)?c:c.next().then((function(e){return e.done?e.value:c.next()}))},y(k),u(k,l,"Generator"),u(k,a,(function(){return this})),u(k,"toString",(function(){return"[object Generator]"})),o.keys=function(e){var t=Object(e),n=[];for(var o in t)n.unshift(o);return function e(){for(;n.length;)if((o=n.pop())in t)return e.value=o,e.done=!1,e;return e.done=!0,e}},o.values=_,O.prototype={constructor:O,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0][4];if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function o(n){c.type="throw",c.arg=e,t.next=n}for(var i=t.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i],c=r[4],a=this.prev,s=r[1],l=r[2];if(-1===r[0])return o("end"),!1;if(!s&&!l)throw Error("try statement without catch or finally");if(null!=r[0]&&r[0]<=a){if(a<s)return this.method="next",this.arg=n,o(s),!0;if(a<l)return o(l),!1}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o[0]>-1&&o[0]<=this.prev&&this.prev<o[2]){var i=o;break}}i&&("break"===e||"continue"===e)&&i[0]<=t&&t<=i[2]&&(i=null);var r=i?i[4]:{};return r.type=e,r.arg=t,i?(this.method="next",this.next=i[2],f):this.complete(r)},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),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[2]===e)return this.complete(n[4],n[3]),x(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[0]===e){var o=n[4];if("throw"===o.type){var i=o.arg;x(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,t,o){return this.delegate={i:_(e),r:t,n:o},"next"===this.method&&(this.arg=n),f}},o}function n(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 o=null!=arguments[t]?arguments[t]:{};t%2?n(Object(o),!0).forEach((function(t){i(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function i(t,n,o){return(n=function(t){var n=function(t){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,"string");if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(n)?n:n+""}(n))in t?Object.defineProperty(t,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[n]=o,t}var r=wp.apiFetch,c=wp.data,a=c.registerStore,s=(c.withSelect,{setUserRoles:function(e){return{type:"SET_USER_ROLES",userRoles:e}},receiveUserRoles:function(e){return{type:"RECEIVE_USER_ROLES",path:e}}});a("wicked-plugins/wicked-block-conditions",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{userRoles:{}},t=arguments.length>1?arguments[1]:void 0;return"SET_USER_ROLES"===t.type?o(o({},e),{},{userRoles:t.userRoles}):e},actions:s,selectors:{receiveUserRoles:function(e){return e.userRoles}},controls:{RECEIVE_USER_ROLES:function(e){return r({path:e.path})}},resolvers:{receiveUserRoles:t().mark((function e(n){var o;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.receiveUserRoles("/wicked-block-conditions/v1/user-roles/");case 2:return o=e.sent,e.abrupt("return",s.setUserRoles(o));case 4:case"end":return e.stop()}}),e)}))}})}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}(()=>{"use strict";var e=lodash,t=e.find,o=e.forEach,i=e.isUndefined,r=e.filter,c=function(e,n){var i=!1;return(i=t(e,(function(e){return e.guid==n})))||o(e,(function(e){var t=c(e.conditions,n);t&&(i=t)})),i},a=function(e,t){return e.map((function(e){return e.guid==t.guid?t:(i(e.conditions)||(e.conditions=a(e.conditions,t)),e)}))},s=function(e,t){return r(e,(function(e){return e.guid!=t.guid})).map((function(e){return i(e.conditions)||(e.conditions=s(e.conditions,t)),e}))},l=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))},u=wp.i18n.__,d=wp.components.RadioControl;const p=function(e){var t=e.option,n=e.onChange;return React.createElement(d,{label:u("When conditions are met:","wicked-block-conditions"),selected:t,options:[{label:u("Show this block","wicked-block-conditions"),value:"show"},{label:u("Hide this block","wicked-block-conditions"),value:"hide"}],onChange:function(e){n(e)}})};var f=wp.i18n.__,m=wp.components,h=m.Button,b=m.Icon;const w=function(e){var t,n=e.condition,o=n.type,i=0!=e.index&&React.createElement("div",{className:"wbc-operator"},React.createElement("div",null,React.createElement("select",{defaultValue:n.operator,onChange:function(t){var n=Object.assign({},e.condition);n.operator=t.target.value,e.onChange(n)}},React.createElement("option",{value:"and"},f("And","wicked-block-conditions")),React.createElement("option",{value:"or"},f("Or","wicked-block-conditions")))));return t=n.conditions.length?React.createElement(g,{setState:e.setState,conditions:n.conditions,onChange:function(t){var n=Object.assign({},e.condition);n.conditions=t,e.onChange(n)}}):React.createElement("p",{className:"wbc-empty-group"},f("This group does not have any conditions yet.","wicked-block-conditions")),"group"==o?React.createElement("li",{className:"wbc-group-condition","data-guid":n.guid},i,React.createElement("div",{className:"wbc-content"},React.createElement("div",{className:"wbc-head"},React.createElement("h3",null,f("Condition Group","wicked-block-conditions"))),React.createElement("div",{className:"wbc-body"},t),React.createElement("div",{className:"wbc-foot"},React.createElement(h,{isLink:!0,onClick:function(){!function(t){e.setState((function(e){return{action:"select-condition",group:t.guid}}))}(n)}},f("Add Condition","wicked-block-conditions")),React.createElement("span",{className:"wbc-separator"},"|"),React.createElement(h,{isLink:!0,onClick:function(){n.conditions.length?confirm(f("This will delete all conditions in the group.  Are you sure?","wicked-block-conditions"))&&e.onDelete(n):e.onDelete(n)}},f("Delete Group","wicked-block-conditions"))))):React.createElement("li",{className:"wbc-condition","data-guid":n.guid},i,React.createElement("div",{className:"wbc-content"},n.label),React.createElement("div",{className:"wbc-edit"},React.createElement(h,{onClick:function(){e.setState((function(e){return{action:"edit-condition",activeCondition:n.guid}}))}},React.createElement(b,{icon:"admin-generic",size:"20"}))))};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)}const g=function(e){var t=function(t){var n=e.conditions.map((function(e){return e.guid==t.guid?t:e}));e.onChange(n)},n=function(t){var n=e.conditions.filter((function(e){return e.guid!=t.guid}));e.onChange(n)},o=e.conditions.map((function(o,i){return React.createElement(w,v({},e,{key:o.guid,index:i,condition:o,onChange:t,onDelete:n}))}));return React.createElement("ul",{className:e.className||""},o)};var k=wp.i18n.__,y=lodash.assign,E=wp.element.Fragment,R=wp.components.Button;const C=function(e){var t=e.attributes.wickedBlockConditions,n=t.action,o=t.conditions,i=y({},e.attributes.wickedBlockConditions);return o.length?React.createElement(E,null,React.createElement(p,{option:n,onChange:function(t){i.action=t,e.setAttributes({wickedBlockConditions:i})}}),React.createElement(g,{setState:e.setState,conditions:o,onChange:function(t){i.conditions=t,e.setAttributes({wickedBlockConditions:i})},className:"wbc-conditions"}),React.createElement("p",null,React.createElement(R,{isLink:!0,onClick:function(){var t;t={guid:l(),type:"group",label:k("Condition Group","wicked-block-conditions"),operator:"and",conditions:[]},i.conditions=i.conditions.slice(0),i.conditions.push(t),e.setAttributes({wickedBlockConditions:i})}},k("Add Condition Group","wicked-block-conditions")))):React.createElement("div",{className:"wbc-start"},React.createElement("p",null,k("Show or hide this block based on conditions.  Add a condition to get started.","wicked-block-conditions")),React.createElement("p",null,React.createElement(R,{isLink:!0,onClick:function(){e.setState((function(e){return{action:"select-condition"}}))}},k("Add Condition","wicked-block-conditions"))))};var x=wp.i18n.__,O=lodash,_=O.assign,S=O.chain,P=(O.find,wp.element.Fragment),j=wp.components.Button;const T=function(e){var t=S(e.wickedBlockConditions.conditions).groupBy("group").map((function(e,t){return{name:t,conditions:e}})).value().map((function(t){var n=t.conditions.map((function(t){return React.createElement("li",null,React.createElement(j,{isLink:!0,onClick:function(){!function(t){var n={action:e.attributes.wickedBlockConditions.action,conditions:e.attributes.wickedBlockConditions.conditions.slice(0)},o=c(n.conditions,e.group),i=_({guid:l(),type:t.type,label:t.label,operator:"and",conditions:[]},t.default);o||(o={guid:l(),type:"group",label:x("Condition Group","wicked-block-conditions"),operator:"and",conditions:[]},n.conditions.push(o)),o.conditions.push(i),n.conditions=a(n.conditions,o),e.setAttributes({wickedBlockConditions:n}),t.bypassConfig?e.setState((function(e){return{action:"view-conditions"}})):e.setState((function(e){return{action:"edit-condition",activeCondition:i.guid}}))}(t)}},t.label))}));return React.createElement(P,null,React.createElement("h3",null,t.name),React.createElement("ul",null,n))}));return React.createElement("div",{className:"wbc-select-condition"},React.createElement("p",null,x("Select a condition to add:","wicked-block-conditions")),t,React.createElement(j,{variant:"secondary",onClick:function(){e.setState((function(e){return{action:"view-conditions"}}))}},x("Cancel","wicked-block-conditions")))};var N=wp.i18n.__,D=wp.components,B=D.TextControl,A=D.ToggleControl,F=D.Button,I=lodash,U=I.find,G=I.assign;const L=function(e){var t=c(e.attributes.wickedBlockConditions.conditions,e.activeCondition),n=U(e.wickedBlockConditions.conditions,{type:t.type}),o=Object.assign({},e.attributes.wickedBlockConditions),i=n.edit,r=function(){o.conditions=a(o.conditions,t),e.setAttributes({wickedBlockConditions:o})};return React.createElement("div",{className:"wbc-edit-condition"},React.createElement("h3",null,e.isNew?N("Add Condition","wicked-block-conditions"):N("Edit Condition","wicked-block-conditions"),": ",n.label),React.createElement("p",null,n.description),React.createElement(B,{label:N("Label","wicked-block-conditions"),help:N("Briefly explain what this condition does.","wicked-block-conditions"),value:t.label,onChange:function(e){return n=e,t.label=n,void r();var n}}),React.createElement(A,{label:N("Negate condition","wicked-block-conditions"),checked:t.negate,help:N("Reverses the outcome of the condition.","wicked-block-conditions"),onChange:function(e){t.negate=e,r()}}),React.createElement(i,{condition:t,onChange:function(e){t=G({},t,e),r()}}),React.createElement("div",{className:"wbc-foot"},React.createElement("div",{className:"wbc-save"},React.createElement(F,{isPrimary:!0,onClick:function(){e.setState((function(e){return{action:"view-conditions",activeCondition:null}}))}},N("Save","wicked-block-conditions"))),React.createElement("div",{className:"wbc-delete"},React.createElement(F,{variant:"secondary",isDestructive:!0,onClick:function(){o.conditions=s(o.conditions,t),e.setAttributes({wickedBlockConditions:o}),e.setState((function(e){return{action:"view-conditions",activeCondition:null}}))}},N("Delete","wicked-block-conditions")))))};var H=wp.element.Fragment,V=function(e){var t=e.children,n=e.activePanel,o=t.map((function(e,t){if(n==e.props.name)return React.createElement("div",{key:t,className:"wicked-slider-panel"},e)}));return React.createElement("div",{className:"wicked-slider-panels"},o)},q=function(e){var t=e.children;return React.createElement(H,null,t)},z=wp.i18n.__,Y=lodash,M=Y.map,Q=Y.filter,W=wp.data.withSelect,$=wp.components.SelectControl;const J=W((function(e){var t=e("core/editor").getCurrentPost();return{post:t,taxonomies:t?e("core").getTaxonomies():void 0}}))((function(e){var t=e.taxonomies,n=e.post,o=e.selectedTaxonomy,i=e.onChange;if(t){var r=Q(t,(function(e){return-1!==e.types.indexOf(n.type)})),c=M(r,(function(e){return{value:e.slug,label:e.name}}));return c.unshift({value:"",label:z("Select a taxonomy","wicked-block-conditions")}),r.length?React.createElement($,{label:z("Taxonomy","wicked-block-conditions"),value:o,onChange:i,options:c}):React.createElement("p",null,z("No terms can be selected because this post type does not have any taxonomies assigned to it.","wicked-block-conditions"))}return React.createElement("div",null,z("Loading...","wicked-block-conditions"))}));var K=wp.i18n.__,X=lodash,Z=X.map,ee=X.filter,te=X.find,ne=X.union,oe=X.without,ie=wp.data.withSelect,re=wp.components,ce=re.CheckboxControl,ae=re.FormTokenField;const se=ie((function(e,t){var n=t.taxonomy,o=e("core"),i=o.getTaxonomy,r=o.getEntityRecords;return{taxonomyObject:n?i(n):void 0,terms:n?r("taxonomy",n):void 0}}))((function(e){e.taxonomy;var t=e.selectedTerms,n=void 0===t?[]:t,o=e.taxonomyObject,i=e.terms,r=e.onChange,c=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return Z(i,(function(t){return t.parent==e&&React.createElement("div",{key:t.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},React.createElement(ce,{label:t.name,checked:-1!==n.indexOf(t.slug),onChange:function(e){return o=t.slug,i=e?ne(n,[o]):oe(n,o),void r(i);var o,i}}),React.createElement("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},c(t.id)))}))};if(o&&i){if(o.hierarchical)return React.createElement("div",{class:"wbc-terms"},React.createElement("h3",null,K("Terms","wicked-block-conditions")),c());var a=Z(i,(function(e){return e.name})),s=Z(ee(i,(function(e){return-1!==n.indexOf(e.slug)})),(function(e){return e.name}));return React.createElement("div",{class:"wbc-terms"},React.createElement(ae,{value:s,suggestions:a,maxSuggestions:20,label:K("Tags","wicked-block-conditions"),onChange:function(e){var t=Z(e,(function(e){var t=te(i,{name:e});return t?t.slug:e}));r(t)}}))}return!1}));var le=wp.element.Fragment;var ue=wp.i18n.__,de=wp.components.TextControl;var pe=wp.i18n.__,fe=wp.components.TextControl;var me=wp.i18n.__,he=wp.components.RadioControl;var be=wp.i18n.__,we=lodash.assign,ve=wp.date,ge=ve.dateI18n,ke=ve.__experimentalGetSettings,ye=(wp.element.Fragment,wp.components),Ee=ye.RadioControl,Re=ye.DatePicker,Ce=ye.DateTimePicker,xe=ye.Button,Oe=ye.Dropdown,_e=ye.PanelRow;wp.i18n.__;var Se=lodash,Pe=Se.map,je=Se.union,Te=Se.without,Ne=wp.data.withSelect,De=wp.components,Be=De.CheckboxControl,Ae=De.Spinner;const Fe=Ne((function(e,t){return t.roles,{roles:(0,e("wicked-plugins/wicked-block-conditions").receiveUserRoles)()}}))((function(e){var t=e.selectedRoles,n=void 0===t?[]:t,o=e.roles,i=e.onChange;if(o){var r=Pe(o,(function(e){return React.createElement(Be,{label:e.label,checked:-1!==n.indexOf(e.value),onChange:function(t){return function(e,t){var o=t?je(n,[e]):Te(n,e);i(o)}(e.value,t)}})}));return React.createElement("div",{class:"wbc-user-roles"},r)}return React.createElement(Ae,null)}));var Ie=wp.i18n.__,Ue=wp.components.TextControl;var Ge=wp.i18n.__,Le=wp.components.TextControl;var He=wp.i18n.__,Ve=wp.date.date,qe=function(){return!1},ze=[];function Ye(e){return Ye="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},Ye(e)}function Me(){return Me=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},Me.apply(null,arguments)}function Qe(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 We(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qe(Object(n),!0).forEach((function(t){$e(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function $e(e,t,n){return(t=function(e){var t=function(e){if("object"!=Ye(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ye(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ye(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Je(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,i,r,c,a=[],s=!0,l=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(o=r.call(n)).done)&&(a.push(o.value),a.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(c=n.return(),Object(c)!==c))return}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ke(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)?Ke(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ke(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}ze.push({type:"user_is_logged_in",label:He("User Is Logged In","wicked-block-conditions"),group:He("User Conditions","wicked-block-conditions"),description:He("Returns true if a user is logged in.","wicked-block-conditions"),bypassConfig:!0,edit:qe}),ze.push({type:"user_is_not_logged_in",label:He("User Is Not Logged In","wicked-block-conditions"),group:He("User Conditions","wicked-block-conditions"),description:He("Returns true if a user is not logged in.","wicked-block-conditions"),bypassConfig:!0,edit:qe}),ze.push({type:"user_has_role",label:He("User Has Role","wicked-block-conditions"),group:He("User Conditions","wicked-block-conditions"),description:He("Returns true if the user is assigned to any of the selected roles.","wicked-block-conditions"),edit:function(e){var t=e.condition,n=e.onChange,o=t.roles;return React.createElement(Fe,{selectedRoles:o,onChange:function(e){n({roles:e})}})}}),ze.push({type:"post_id",label:He("Check Post ID","wicked-block-conditions"),group:He("Post Conditions","wicked-block-conditions"),description:He("Returns true if the post has the specified ID.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.postId;return React.createElement(de,{label:ue("Post ID","wicked-block-conditions"),type:"number",min:1,step:1,value:o,onChange:function(e){n({postId:parseInt(e)})}})}}),ze.push({type:"post_slug",label:He("Check Post Slug","wicked-block-conditions"),group:He("Post Conditions","wicked-block-conditions"),description:He("Returns true if the post has the specified slug.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.slug;return React.createElement(fe,{label:pe("Post Slug","wicked-block-conditions"),value:o,onChange:function(e){n({slug:e})}})}}),ze.push({type:"post_has_term",label:He("Post Has a Term","wicked-block-conditions"),group:He("Post Conditions","wicked-block-conditions"),description:He("Returns true if the post has the selected term(s) assigned.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.taxonomy,i=t.terms;return React.createElement(le,null,React.createElement(J,{selectedTaxonomy:o,onChange:function(e){n({taxonomy:e,terms:i})}}),React.createElement(se,{taxonomy:o,selectedTerms:i,onChange:function(e){n({taxonomy:o,terms:e})}}))}}),ze.push({type:"post_status",label:He("Check Post Status","wicked-block-conditions"),group:He("Post Conditions","wicked-block-conditions"),description:He("Returns true if post status matches the selected option.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.status;return React.createElement(he,{label:me("Post Status","wicked-block-conditions"),selected:o,options:[{label:me("Published","wicked-block-conditions"),value:"publish"},{label:me("Pending","wicked-block-conditions"),value:"pending"},{label:me("Draft","wicked-block-conditions"),value:"draft"},{label:me("Future","wicked-block-conditions"),value:"future"},{label:me("Private","wicked-block-conditions"),value:"private"},{label:me("Password Protected","wicked-block-conditions"),value:"password"}],onChange:function(e){!function(e){n({status:e})}(e)}})},default:{status:"publish"}}),ze.push({type:"current_date",label:He("Check The Date","wicked-block-conditions"),group:He("Date Conditions","wicked-block-conditions"),description:He("Returns true if the current date matches the specified conditions.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.onChange,n=we({},e.condition),o=n.compare,i=n.date,r=be("between"==o?"Start Date":"Date","wicked-block-conditions"),c=ke(),a="same day"==o?c.formats.date:c.formats.datetimeAbbreviated,s=function(e){n.date=e,t(n)};return React.createElement("div",{className:"wbc-current-date-condition"},React.createElement(Ee,{label:be("Current date is:","wicked-block-conditions"),selected:o,options:[{label:be("Before","wicked-block-conditions"),value:"before"},{label:be("After","wicked-block-conditions"),value:"after"},{label:be("The same as","wicked-block-conditions"),value:"same day"}],onChange:function(e){!function(e){n.compare=e,t(n)}(e)}}),React.createElement(_e,null,React.createElement("span",null,r),React.createElement("div",null,React.createElement(Oe,{className:"wbc-date-popup",contentClassName:"wbc-date-popup-content",position:"bottom right",renderToggle:function(e){var t=e.isOpen,n=e.onToggle;return React.createElement(xe,{onClick:n,"aria-expanded":t,isLink:!0},ge(a,i))},renderContent:function(){return React.createElement("div",null,"same day"==o?React.createElement(Re,{currentDate:i,is12Hour:!0,onChange:function(e){s(e)}}):React.createElement(Ce,{currentDate:i,is12Hour:!0,onChange:function(e){s(e)}}))}}))),React.createElement(_e,null,React.createElement("em",null,be("Note: Be sure that a timezone has been set for your site on the Settings > General page and that the date you select above is for that timezone.","wicked-block-conditions"))),"between"==o&&React.createElement(_e,null,React.createElement("span",null,be("End date","wicked-block-conditions")),React.createElement("div",null,React.createElement(Oe,{className:"wbc-date-popup",contentClassName:"wbc-date-popup-content",position:"bottom right",renderToggle:function(e){var t=e.isOpen,n=e.onToggle;return React.createElement(xe,{onClick:n,"aria-expanded":t,isLink:!0},ge(a,dateTwo))},renderContent:function(){return React.createElement("div",null,React.createElement(Ce,{currentDate:dateTwo,is12Hour:!0,onChange:function(e){handleChangeDateTwo(e)}}))}}))))},default:{compare:"before",date:Ve("Y-m-d H:i:00",new Date)}}),ze.push({type:"user_function",label:He("Check a User-Defined Function","wicked-block-conditions"),group:He("Advanced","wicked-block-conditions"),description:He("Returns the result of a user-defined function.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.function;return React.createElement(Ue,{label:Ie("Function","wicked-block-conditions"),help:Ie("Enter the name of a PHP function to call.  Your function should return a value of true or false.  Any value other than true will be considered false.","wicked-block-conditions"),value:o,onChange:function(e){return function(e){n({function:e})}(e)}})}}),ze.push({type:"query_string",label:He("Check a Query String Value","wicked-block-conditions"),group:He("Advanced","wicked-block-conditions"),description:He("Returns true if the specified query string parameter is matched.","wicked-block-conditions"),bypassConfig:!1,edit:function(e){var t=e.condition,n=e.onChange,o=t.parameter,i=t.value;return React.createElement(React.Fragment,null,React.createElement(Le,{label:Ge("Parameter","wicked-block-conditions"),help:Ge("The name of the query string parameter to check.","wicked-block-conditions"),value:o,onChange:function(e){return function(e){n({parameter:e,value:i})}(e)}}),React.createElement(Le,{label:Ge("Value","wicked-block-conditions"),help:Ge("The value to check for.","wicked-block-conditions"),value:i,onChange:function(e){return function(e){n({parameter:o,value:e})}(e)}}))},default:{parameter:"",value:""}}),n(446);var Xe=wp.i18n.__,Ze=lodash.assign,et=wp.element,tt=et.Fragment,nt=et.useState,ot=wp.components.PanelBody,it=wp.compose.createHigherOrderComponent,rt=wp.blockEditor.InspectorControls,ct=wp.hooks,at=ct.addFilter,st=ct.applyFilters;at("blocks.registerBlockType","wicked-block-conditions/add-attribute",(function(e){return e.attributes=Ze(e.attributes,{wickedBlockConditions:{type:"object",default:{action:"show",conditions:[]}}}),e})),at("blocks.getSaveContent.extraProps","wicked-block-conditions/add-props",(function(e,t,n){return e.wickedBlockConditions=n.wickedBlockConditions,e}));var lt=function(e){var t=Je(nt(!1),2),n=t[0],o=t[1],i=Je(nt("view-conditions"),2),r=i[0],c=i[1],a=Je(nt(null),2),s=a[0],l=a[1],u=Je(nt(null),2),d=u[0],p=u[1],f=We(We({},e),{},{action:r,activeCondition:s,group:d,setState:function(e){var t=e();t.hasOwnProperty("action")&&c(t.action),t.hasOwnProperty("activeCondition")&&l(t.activeCondition),t.hasOwnProperty("group")&&p(t.group)}});return React.createElement(rt,null,React.createElement(ot,{title:Xe("Display Conditions","wicked-block-conditions"),initialOpen:n,onToggle:function(){o(!n)}},React.createElement(V,{activePanel:r},React.createElement(q,{name:"view-conditions"},React.createElement(C,f)),React.createElement(q,{name:"select-condition"},React.createElement(T,f)),React.createElement(q,{name:"edit-condition"},React.createElement(L,f)))))};const ut=it((function(e){var t={conditions:st("wickedBlockConditions.conditions",ze)};return function(n){return React.createElement(tt,null,React.createElement(e,n),React.createElement(lt,Me({},n,{wickedBlockConditions:t})))}}),"withConditions");var dt=wp.hooks,pt=dt.addFilter;dt.removeFilter,pt("editor.BlockEdit","wicked-block-conditions/with-conditions",ut)})()})();
  • wicked-block-conditions/trunk/dist/index.js.LICENSE.txt

    r3193711 r3292137  
    1 /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
     1/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
  • wicked-block-conditions/trunk/readme.txt

    r3193711 r3292137  
    44Requires at least: 5.0
    55Tested up to: 6.7
    6 Stable tag: 1.2.4
     6Stable tag: 1.2.5
    77Requires PHP: 7.4
    88License: GPLv2 or later
     
    7676== Changelog ==
    7777
     78= 1.2.5 (May 12, 2025)
     79* Fix: 'store “core/interface” is already registered' error
     80* Fix: wp_enqueue_script doing-it-wrong warning message when debugging is enabled
     81
    7882= 1.2.4 (November 20, 2024) =
    7983* Tweak: clean up plugin to exclude configuration and source files
  • wicked-block-conditions/trunk/wicked-block-conditions.php

    r3193711 r3292137  
    55Plugin URI: https://wickedplugins.com/wicked-block-conditions/
    66Description: Show or hide blocks based on conditions.
    7 Version: 1.2.4
     7Version: 1.2.5
    88Author: Wicked Plugins
    99Author URI: https://wickedplugins.com/
Note: See TracChangeset for help on using the changeset viewer.