var j=Object.defineProperty;var u=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var x=(l,a,s)=>a in l?j(l,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):l[a]=s,d=(l,a)=>{for(var s in a||(a={}))b.call(a,s)&&x(l,s,a[s]);if(u)for(var s of u(a))v.call(a,s)&&x(l,s,a[s]);return l};import{u as g,j as e,_ as c,$ as F}from"./main-634.js";import{n as N}from"./bf-25-81.js";import{M as V}from"./bf-438-114.js";const o=(l,a,s,m)=>{const r=d({},s);r.field_map[a][l.target.name]=l.target.value,l.target.value==="custom"&&(r.field_map[a].customValue=""),m(d({},r))},_=(l,a,s,m)=>{const r=d({},s);r.field_map[a].customValue=l.target.value,m(d({},r))};function $({i:l,formFields:a,field:s,twilioConf:m,setTwilioConf:r}){var p;const n=g(F),{isPro:i}=n;return e.jsx("div",{className:"flx mt-2 mb-2 btcbi-field-map",children:e.jsx("div",{className:"pos-rel flx",children:e.jsxs("div",{className:"flx integ-fld-wrp",children:[e.jsxs("select",{className:"btcd-paper-inp mr-2",name:"formField",value:s.formField||"",onChange:t=>o(t,l,m,r),children:[e.jsx("option",{value:"",children:c("Select Field")}),e.jsx("optgroup",{label:"Form Fields",children:a==null?void 0:a.map(t=>e.jsx("option",{value:t.key,children:t.name},`ff-rm-${t.key}`))}),e.jsx("option",{value:"custom",children:c("Custom...")}),e.jsx("optgroup",{label:`General Smart Codes ${i?"":"(PRO)"}`,children:i&&((p=N)==null?void 0:p.map(t=>e.jsx("option",{value:t.name,children:t.label},`ff-rm-${t.name}`)))})]}),s.formField==="custom"&&e.jsx(V,{onChange:t=>_(t,l,m,r),label:c("Custom Value"),className:"mr-2",type:"text",value:s.customValue,placeholder:c("Custom Value")}),e.jsxs("select",{className:"btcd-paper-inp",disabled:!0,name:"twilioField",value:s.twilioField,onChange:t=>o(t,l,m,r),children:[e.jsx("option",{value:"",children:c("Select Field")}),m==null?void 0:m.twilioFields.map(({key:t,label:h})=>e.jsx("option",{value:t,children:h},t))]})]})})})}function T({formFields:l,twilioConf:a,setTwilioConf:s,setSnackbar:m}){return e.jsxs(e.Fragment,{children:[e.jsx("br",{}),e.jsx("div",{className:"mt-5",children:e.jsx("b",{className:"wdt-100",children:c("Field Map")})}),e.jsx("div",{className:"btcd-hr mt-1"}),e.jsxs("div",{className:"flx flx-around mt-2 mb-2 btcbi-field-map-label",children:[e.jsx("div",{className:"txt-dp",children:e.jsx("b",{children:c("Form Fields")})}),e.jsx("div",{className:"txt-dp",children:e.jsx("b",{children:c("Twilio Fields")})})]}),a==null?void 0:a.field_map.map((r,n)=>e.jsx($,{i:n,field:r,twilioConf:a,formFields:l,setTwilioConf:s,setSnackbar:m},`rp-m-${n+9}`)),e.jsx("br",{})]})}export{T};
