var N=Object.defineProperty;var g=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var v=(t,a,e)=>a in t?N(t,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[a]=e,h=(t,a)=>{for(var e in a||(a={}))b.call(a,e)&&v(t,e,a[e]);if(g)for(var e of g(a))_.call(a,e)&&v(t,e,a[e]);return t};import{h as y,j as l}from"./main-333.js";import{j as w,_ as c,k as A,l as M,o as $}from"./bi.636.93.js";import{g as k,z as R}from"./bi.994.808.js";import{T as S}from"./bi.535.730.js";const V=(t,a,e)=>{const s=h({},a);s.field_map.splice(t,0,{}),e(h({},s))},q=(t,a,e)=>{const s=h({},a);s.field_map.length>1&&s.field_map.splice(t,1),e(h({},s))},F=(t,a,e,s)=>{const d=h({},e);d.field_map[a][t.target.name]=t.target.value,t.target.value==="custom"&&(d.field_map[a].customValue=""),s(h({},d))};function T({i:t,formFields:a,field:e,zoomWebinarConf:s,setZoomWebinarConf:d}){var p,j;if(((p=s==null?void 0:s.field_map)==null?void 0:p.length)===1&&e.zoomField===""){const i=h({},s),m=k(i);i.field_map=m,d(i)}const n=(s==null?void 0:s.zoomWebinarFields.filter(i=>i.required===!0))||[],x=(s==null?void 0:s.zoomWebinarFields.filter(i=>i.required===!1))||[],u=y(w),{isPro:r}=u;return l.jsx("div",{className:"flx mt-2 mr-1",children:l.jsxs("div",{className:"pos-rel flx",children:[l.jsxs("div",{className:"flx integ-fld-wrp",children:[l.jsxs("select",{className:"btcd-paper-inp mr-2",name:"formField",value:e.formField||"",onChange:i=>F(i,t,s,d),children:[l.jsx("option",{value:"",children:c("Select Field","bit-integrations")}),l.jsx("optgroup",{label:"Form Fields",children:a==null?void 0:a.map(i=>l.jsx("option",{value:i.name,children:i.label},`ff-rm-${i.name}`))}),l.jsx("option",{value:"custom",children:c("Custom...","bit-integrations")}),l.jsx("optgroup",{label:`General Smart Codes ${r?"":"(PRO)"}`,children:r&&((j=A)==null?void 0:j.map(i=>l.jsx("option",{value:i.name,children:i.label},`ff-rm-${i.name}`)))})]}),e.formField==="custom"&&l.jsx(S,{onChange:i=>M(i,t,biginConf,setBiginConf),label:c("Custom Value","bit-integrations"),className:"mr-2",type:"text",value:e.customValue,placeholder:c("Custom Value","bit-integrations"),formFields:a}),l.jsxs("select",{className:"btcd-paper-inp",disabled:t<n.length,name:"zoomField",value:t<n.length?n[t].key||"":e.zoomField||"",onChange:i=>F(i,t,s,d),children:[l.jsx("option",{value:"",children:c("Select Field","bit-integrations")}),t<n.length?l.jsx("option",{value:n[t].key,children:n[t].label},n[t].key):x.map(({key:i,label:m})=>l.jsx("option",{value:i,children:m},i))]})]}),t>=n.length&&l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>V(t,s,d),className:"icn-btn sh-sm ml-2 mr-1",type:"button",children:"+"}),l.jsx("button",{onClick:()=>q(t,s,d),className:"icn-btn sh-sm ml-1",type:"button","aria-label":"btn",children:l.jsx("span",{className:"btcd-icn icn-trash-2"})})]})]})})}function L({formFields:t,handleInput:a,zoomWebinarConf:e,setZoomWebinarConf:s,isLoading:d,setIsLoading:n,setSnackbar:x}){var u;return l.jsxs(l.Fragment,{children:[l.jsx("br",{}),l.jsx("b",{className:"wdt-200 d-in-b",children:c("All Webinars:","bit-integrations")}),l.jsxs("select",{onChange:a,name:"id",value:e.id,className:"btcd-paper-inp w-5",children:[l.jsx("option",{value:"",children:c("Select Webinar","bit-integrations")}),((u=e==null?void 0:e.default)==null?void 0:u.allWebinar)&&e.default.allWebinar.map(({id:r,topic:p})=>l.jsx("option",{value:r,children:p},r))]}),l.jsx("button",{onClick:()=>R(null,e,s,n,x),className:"icn-btn sh-sm ml-2 mr-2 tooltip",style:{"--tooltip-txt":`'${c("Fetch All Recipients","bit-integrations")}'`},type:"button",disabled:d,children:"↻"}),l.jsx("br",{}),l.jsx("br",{}),l.jsx("b",{className:"wdt-200 d-in-b",children:c("Action:","bit-integrations")}),l.jsxs("select",{onChange:a,name:"selectedActions",value:e.selectedActions,className:"btcd-paper-inp w-5",children:[l.jsx("option",{value:"",children:c("Select Action","bit-integrations")}),(e==null?void 0:e.allActions)&&e.allActions.map(({key:r,value:p})=>l.jsx("option",{value:p,children:p},r))]}),l.jsx("div",{className:"mt-5",children:l.jsx("b",{className:"wdt-100",children:c("Field Map","bit-integrations")})}),l.jsx("div",{className:"btcd-hr mt-1"}),l.jsxs("div",{className:"flx flx-around mt-2 mb-1",children:[l.jsx("div",{className:"txt-dp",children:l.jsx("b",{children:c("Form Fields","bit-integrations")})}),l.jsx("div",{className:"txt-dp",children:l.jsx("b",{children:c("ZoomWebinar Fields","bit-integrations")})})]}),e==null?void 0:e.field_map.map((r,p)=>l.jsx(T,{i:p,field:r,zoomWebinarConf:e,formFields:t,setZoomWebinarConf:s,setSnackbar:x},`rp-m-${p+9}`)),l.jsx("div",{className:"txt-center  mt-2",style:{marginRight:85},children:l.jsx("button",{onClick:()=>$(e.field_map.length,e,s,!1),className:"icn-btn sh-sm",type:"button",children:"+"})}),l.jsx("br",{}),l.jsx("br",{})]})}export{L as Z};
