(()=>{"use strict";const e=window.React,t=window.wp.element,n=window.jfb.components,{CurrentActionEditContext:l,ActionFieldsMapContext:o,CurrentPropertyMapContext:r}=JetFBComponents,i=function(){const{FieldSelect:i,property:a}=(0,t.useContext)(r),{setMapField:s,getMapField:c}=(0,t.useContext)(l),{name:d,index:m}=(0,t.useContext)(o);return"user_meta"===a?(0,e.createElement)("div",{className:"components-base-control jet-margin-bottom-wrapper"},i,(0,e.createElement)(n.StyledTextControl,{key:d+m+"_text",value:c({name:d}),onChange:e=>s({nameField:d,value:e})})):i},a=window.jfb.blocksToActions,s=window.jfb.actions,c=window.wp.components,d=window.wp.i18n,{ActionFieldsMap:m,WrapperRequiredControl:u,DynamicPropertySelect:p}=JetFBComponents,w=window.wp.primitives,f=(0,e.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(w.Path,{fillRule:"evenodd",d:"M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z",clipRule:"evenodd"})),C={type:"update_user",label:(0,d.__)("Update User","jet-form-builder"),edit:function(t){const l=(0,s.convertListToFieldsMap)((0,a.useFields)({withInner:!1})),{settings:o,onChangeSetting:r,source:w,label:f}=t;(0,a.useSanitizeFieldsMap)();const{hasError:C}=(0,s.useActionValidatorProvider)({isSupported:e=>"field_id"===e?.property});return(0,e.createElement)(c.Flex,{direction:"column"},(0,e.createElement)(m,{label:f("fields_map"),fields:l,customHelp:()=>C&&(0,e.createElement)(n.IconText,null,(0,d.__)("Please select a field for User ID","jet-form-builder"))},(0,e.createElement)(u,null,(0,e.createElement)(p,{dynamic:["user_meta"]},(0,e.createElement)(i,null)))),(0,e.createElement)(n.WideLine,null),(0,e.createElement)(n.RowControl,null,(({id:t})=>(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.Label,{htmlFor:t},(0,d.__)("User role","jet-form-builder")),(0,e.createElement)(n.StyledSelectControl,{multiple:!0,id:t,value:o.user_role,options:w.userRoles,onChange:e=>r(e,"user_role"),help:(0,d.__)("Hold Ctrl (Windows) or Command (Mac) to select multiple roles.","jet-form-builder")})))),(0,e.createElement)(n.WideLine,null),(0,e.createElement)(s.ActionMessages,{...t}))},icon:f,docHref:"https://jetformbuilder.com/features/update-user/",category:"user",validators:[({settings:e})=>{var t;return!Object.values(null!==(t=e?.fields_map)&&void 0!==t?t:{}).some((e=>"ID"===e))&&{type:"empty",property:"field_id"}}]};(0,s.registerAction)(C)})();