import{s as b,aM as g,a3 as y,t as m,y as v,v as h,w as V,f as u,a4 as C,z as p,P as f,Q as o,bM as B,co as O,a1 as _}from"./index-DT8qTvyx.js";var E=function(i){b(r,i);function r(){return i!==null&&i.apply(this,arguments)||this}return r.prototype.renderEtrValue=function(e,t){return this.props.render("inline",Object.assign({},e,{label:!1,inputOnly:!0,changeImmediately:!0}),t)},r.prototype.renderPickerIcon=function(){var e=this.props,t=e.render,n=e.pickerIcon;return n?t("picker-icon",n):void 0},r.prototype.getAddBtnVisible=function(e){var t=this.props,n=t.data,a=t.addBtnVisibleOn;return typeof a=="string"&&a?g(a,y(n,e)):!0},r.prototype.getAddGroupBtnVisible=function(e){var t=this.props,n=t.data,a=t.addGroupBtnVisibleOn;return typeof a=="string"&&a?g(a,y(n,e)):!0},r.prototype.validate=function(){var e,t=this.props,n=t.value,a=t.required,l=t.translate;if(a){if(!n||!n.children)return l("Condition.isRequired");var d=!0,s=["is_empty","is_not_empty"];return(e=n==null?void 0:n.children)===null||e===void 0||e.forEach(function(c){if(c.op&&(c.right||~s.indexOf(c.op))){d=!1;return}}),d?l("Condition.isRequired"):null}},r.prototype.render=function(){var e=this.props,t=e.className,n=e.classnames;e.style,e.pickerIcon;var a=e.env,l=e.popOverContainer,d=m(e,["className","classnames","style","pickerIcon","env","popOverContainer"]),s=this.props.formula?v({},this.props.formula):void 0;return s&&s.variables&&h(s.variables)&&(s.variables=V(s.variables,this.props.data,"| raw")),u.createElement("div",{className:n("ConditionBuilderControl",{"is-mobile":C()},t)},u.createElement(A,v({renderEtrValue:this.renderEtrValue,pickerIcon:this.renderPickerIcon(),isAddBtnVisibleOn:this.getAddBtnVisible,isAddGroupBtnVisibleOn:this.getAddGroupBtnVisible,popOverContainer:l||a.getModalContainer},d,{formula:s})))},p([f,o("design:type",Function),o("design:paramtypes",[Object,Object]),o("design:returntype",void 0)],r.prototype,"renderEtrValue",null),p([f,o("design:type",Function),o("design:paramtypes",[Object]),o("design:returntype",void 0)],r.prototype,"getAddBtnVisible",null),p([f,o("design:type",Function),o("design:paramtypes",[Object]),o("design:returntype",void 0)],r.prototype,"getAddGroupBtnVisible",null),r}(u.PureComponent),A=B({adaptor:function(i){return i.fields||i}})(function(i){b(r,i);function r(){return i!==null&&i.apply(this,arguments)||this}return r.prototype.render=function(){var e=this.props,t=e.loading,n=e.config;e.deferLoad;var a=e.disabled,l=e.renderEtrValue,d=m(e,["loading","config","deferLoad","disabled","renderEtrValue"]);return u.createElement(O,v({},d,{fields:n||d.fields||[],disabled:a||t,renderEtrValue:l}))},r}(u.Component)),k=function(i){b(r,i);function r(){return i!==null&&i.apply(this,arguments)||this}return r=p([_({type:"condition-builder",strictMode:!1})],r),r}(E);export{k as ConditionBuilderRenderer,E as default};