(()=>{"use strict";var e={20:(e,t,o)=>{var n=o(609),r=Symbol.for("react.element"),s=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,o){var n,l={},c=null,p=null;for(n in void 0!==o&&(c=""+o),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(p=t.ref),t)s.call(t,n)&&!a.hasOwnProperty(n)&&(l[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===l[n]&&(l[n]=t[n]);return{$$typeof:r,type:e,key:c,ref:p,props:l,_owner:i.current}}},609:e=>{e.exports=window.React},848:(e,t,o)=>{e.exports=o(20)}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,o),s.exports}var n=o(609);const r=window.wp.hooks,s=window.wp.i18n,i=window.wp.components,a=window.wp.primitives;var l=o(848);const c=(0,l.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,l.jsx)(a.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})}),p=(0,l.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,l.jsx)(a.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M7.404 16.596a6.5 6.5 0 1 0 9.192-9.192 6.5 6.5 0 0 0-9.192 9.192ZM6.344 6.343a8 8 0 1 0 11.313 11.314A8 8 0 0 0 6.343 6.343Zm4.906 9.407v-3h-3v-1.5h3v-3h1.5v3h3v1.5h-3v3h-1.5Z"})}),u=e=>[Object,Array].includes((e||{}).constructor)&&!Object.entries(e||{}).length;(0,r.addFilter)("personalizeWP.hasRequiredFields","personalizewp/check-for-woocommerce-subscriptions-plans",(e,t)=>!!(Object.hasOwn(t,"integrations")&&"woocommerce-subscriptions"==t?.integrations?.plugin&&Object.hasOwn(t?.integrations,"woocommerce_subscriptions_plans")&&0<t?.integrations?.woocommerce_subscriptions_plans?.filter(Boolean).length)||e),(0,r.addFilter)("personalizeWP.integrations.attributes","personalizewp/add-woocommerce-subscriptions-integrations-attributes",function(e){return e.woocommerce_subscriptions_plans={type:"array",default:[]},e}),(0,r.addFilter)("personalizeWP.additionalIntegrationsControls","personalizewp/add-woocommerce-subscriptions-inspector-integrations-controls",function(e,t,o,r){var a;const{blockAtts:l,setPersonalizeWPAtts:w,settings:d}=t;if(!d?.integrations?.plugins&&!d?.integrations?.woocommerce_subscriptions_plans)return e;if("woocommerce-subscriptions"!==o)return e;const m=[{value:0,label:(0,s.__)("-- Select subscriptions --","personalizewp")}].concat(...Array.from(d.integrations.woocommerce_subscriptions_plans).map(function(e){return{value:parseInt(e.value,10),label:e.label}}));let _=null!==(a=l?.integrations?.woocommerce_subscriptions_plans)&&void 0!==a?a:[];_&&!u(_)||(_=[0]);const v=e=>{let t=(o=(o=e).map(e=>parseInt(e,10)),[...new Set(o)]);var o;u(t)?r({}):r({woocommerce_subscriptions_plans:t})};return(0,n.createElement)(n.Fragment,null,_.map((e,t)=>(0,n.createElement)(i.Flex,{direction:"row","data-key":"i"+t,key:"pwp-subscriptions-"+t,className:"select-integration-plan"},(0,n.createElement)(i.SelectControl,{label:0===t?(0,s.__)("Plans","personalizewp"):"",hideLabelFromVision:!0,value:String(e),options:m,onChange:e=>{((e,t)=>{_[e]=t,v(_)})(t,e)},__nextHasNoMarginBottom:!0}),1<_.length&&(0,n.createElement)(i.Button,{label:(0,s.__)("Delete field","personalizewp"),icon:c,onClick:()=>{(e=>{_.splice(e,1),v(_)})(t)}}))),(0,n.createElement)("div",{className:"woocommerce-subscriptions-plan-rule-set__add-rule"},(0,n.createElement)(i.Flex,{direction:"row",align:"center",justify:"flex-end"},0!==_[_.length-1]&&(0,n.createElement)(i.Button,{label:(0,s.__)("Add another","personalizewp"),icon:p,onClick:()=>{_.splice(_.length,0,0),v(_)}}))))})})();