(()=>{"use strict";const e=window.qf.blocks,t=window.qf.adminComponents,l=window.React,o=window.wp.i18n,a=window.emotion,n=window.lodash,r={color:"#9B89B3",icon:()=>React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 16 16"},React.createElement("text",{x:"2",y:"8",fontSize:"7",fontWeight:"bold",fill:"currentColor",textAnchor:"middle"},"A"),React.createElement("rect",{x:"7",y:"5.2",width:"8",height:"1.6",rx:"0.8",fill:"currentColor"}),React.createElement("text",{x:"2",y:"15",fontSize:"7",fontWeight:"bold",fill:"currentColor",textAnchor:"middle"},"B"),React.createElement("rect",{x:"7",y:"11.2",width:"8",height:"1.6",rx:"0.8",fill:"currentColor"})),entryDetails:({id:e,attributes:t,value:l})=>{const{choices:o}=t;return l=(0,n.castArray)(l),console.log(l),React.createElement("div",{className:a.css`
				display: flex;
				flex-wrap: wrap;
				flex-direction: column;
				align-items: flex-start;
			`},l.map(((e,t)=>{const l=o.findIndex((t=>t.value===e));let n;return-1===l?n="other"===e.type&&e.value?e.value:null:(n="Choice "+(l+1),o[l].label&&(n=o[l].label)),React.createElement("div",{key:t,className:a.css`
							display: inline-flex;
							margin-bottom: 8px;
							padding: 5px 8px;
							border: 1px solid rgb( 184 184 184 );
							border-radius: 3px;
						`},n)})))},controls:e=>{const{attributes:{multiple:a,verticalAlign:n,choices:r,min:c,max:i,other:m,otherText:s,otherPlaceholder:h,deselectAllWhenOtherSelected:u},setAttributes:p}=e;return React.createElement(l.Fragment,null,React.createElement(t.BaseControl,null,React.createElement(t.ControlWrapper,{orientation:"horizontal"},React.createElement(t.ControlLabel,{label:(0,o.__)("Multiple","quillforms")}),React.createElement(t.ToggleControl,{checked:a,onChange:()=>p({multiple:!a})}))),a&&React.createElement(React.Fragment,null,React.createElement(t.BaseControl,null,React.createElement(t.ControlWrapper,{orientation:"horizontal"},React.createElement(t.ControlLabel,{label:(0,o.__)("Minimum limit for choices","quillforms")}),React.createElement(t.ToggleControl,{checked:c,onChange:()=>{p({min:!1===c&&1})}})),!1!==c&&React.createElement(t.TextControl,{type:"number",value:c,onChange:e=>{p({min:e})}})),React.createElement(t.BaseControl,null,React.createElement(t.ControlWrapper,{orientation:"horizontal"},React.createElement(t.ControlLabel,{label:(0,o.__)("Maximum limit for choices","quillforms")}),React.createElement(t.ToggleControl,{checked:i,onChange:()=>{p({max:!1===i&&5})}})),!1!==i&&React.createElement(t.TextControl,{type:"number",value:i,onChange:e=>{p({max:e})}}))),React.createElement(t.BaseControl,null,React.createElement(t.ControlWrapper,{orientation:"horizontal"},React.createElement(t.ControlLabel,{label:(0,o.__)("Vertical Align","quillforms")}),React.createElement(t.ToggleControl,{checked:n,onChange:()=>p({verticalAlign:!n})}))),React.createElement(t.BaseControl,null,React.createElement(t.ControlWrapper,{orientation:"horizontal"},React.createElement(t.ControlLabel,{label:(0,o.__)("Other Option","quillforms"),isNew:!0}),React.createElement(t.ToggleControl,{checked:m,onChange:()=>p({other:!m})}))),m&&React.createElement(React.Fragment,null,React.createElement(t.BaseControl,null,React.createElement(t.ControlWrapper,{orientation:"vertical"},React.createElement(t.ControlLabel,{label:(0,o.__)("Other Text","quillforms")}),React.createElement(t.TextControl,{value:s,onChange:e=>{p({otherText:e})}}))),React.createElement(t.BaseControl,null,React.createElement(t.ControlWrapper,{orientation:"vertical"},React.createElement(t.ControlLabel,{label:(0,o.__)("Other Placeholder","quillforms")}),React.createElement(t.TextControl,{value:h,onChange:e=>{p({otherPlaceholder:e})}}))),a&&React.createElement(t.BaseControl,null,React.createElement(t.ControlWrapper,{orientation:"horizontal"},React.createElement(t.ControlLabel,{label:(0,o.__)("Deselect All When Other Selected","quillforms")}),React.createElement(t.ToggleControl,{checked:u,onChange:()=>p({deselectAllWhenOtherSelected:!u})})))),React.createElement(t.BaseControl,null,React.createElement(t.ControlWrapper,{orientation:"horizontal"},React.createElement(t.ControlLabel,{label:(0,o.__)("Choices","quillforms")}),React.createElement(t.ChoicesBulkBtn,{choices:r,setChoices:e=>{p({choices:e})}})),React.createElement(t.ControlWrapper,{orientation:"vertical"},React.createElement(t.ChoicesInserter,{choices:r,setChoices:e=>{p({choices:e})}}))))},logicControl:({attributes:e,value:o,setValue:n,removeCondition:r})=>{const{choices:c}=e;(0,l.useEffect)((()=>{o?c.some((e=>e.value===o))||r():n(c[0].value)}),[]);const i=c.map(((e,t)=>({key:e.value,name:e.label?e.label:`Choice ${t+1}`})));return React.createElement(t.SelectControl,{className:a.css`
				margin-top: 10px;
				margin-bottom: 10px;
			`,value:i.find((e=>e.key===o)),onChange:e=>{n(e.selectedItem.key)},options:i})},title:(0,o.__)("Multiple Choice","quillforms"),order:5,getChoices:({attributes:e})=>{var t,l;const o=null!==(t=e?.choices)&&void 0!==t?t:[];return null!==(l=e?.other)&&void 0!==l&&l&&o.push({type:"other",label:"Other"}),o}},{name:c}={name:"multiple-choice",supports:{editable:!0,required:!0,attachment:!0,description:!0,logic:!0,theme:!0,points:!0,payments:!0,choices:!0,correctAnswers:!0},attributes:{choices:{type:"array",items:{type:"object",properties:{value:{type:"string"},label:{type:"string"}}},default:[{value:"124e4567e89b",label:"Choice 1"}]},max:{type:["number","boolean"],default:!1},min:{type:["number","boolean"],default:!1},verticalAlign:{type:"boolean",default:!1},multiple:{type:"boolean"},other:{type:"boolean",default:!1},otherText:{type:"string",default:"Other"},otherPlaceholder:{type:"string",default:"Please specify"},deselectAllWhenOtherSelected:{type:"boolean",default:!1}},logicalOperators:["is","is_not"]};(0,e.setBlockAdminSettings)(c,r),(window.qf=window.qf||{}).blocklibMultipleChoiceBlockAdmin={}})();