var I=Object.defineProperty;var N=Object.getOwnPropertySymbols;var g=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var _=(a,e,l)=>e in a?I(a,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):a[e]=l,o=(a,e)=>{for(var l in e||(e={}))g.call(e,l)&&_(a,l,e[l]);if(N)for(var l of N(e))T.call(e,l)&&_(a,l,e[l]);return a};import{h as $,j as t}from"./main-333.js";import{j as f,_ as d,k as M,l as R,T as S,O as V,o as k}from"./bi.636.93.js";import{T as q}from"./bi.535.730.js";function O({i:a,formFields:e,field:l,enchargeConf:i,setEnchargeConf:p}){var j,v,F,h;const n=l.required,c=((j=i==null?void 0:i.default)==null?void 0:j.fields)&&Object.values((v=i==null?void 0:i.default)==null?void 0:v.fields).filter(s=>!s.required),r=s=>{const m=o({},i);m.field_map.splice(s,0,{}),p(m)},w=s=>{const m=o({},i);m.field_map.length>1&&m.field_map.splice(s,1),p(m)},b=(s,m)=>{const u=o({},i);u.field_map[m][s.target.name]=s.target.value,s.target.value==="custom"&&(u.field_map[m].customValue=""),p(u)},y=$(f),{isPro:x}=y;return t.jsxs("div",{className:n?"mt-2 mr-1 flx w-9":"flx mt-2 mb-2 btcbi-field-map",children:[t.jsxs("select",{className:"btcd-paper-inp mr-2",name:"formField",value:l.formField||"",onChange:s=>b(s,a),children:[t.jsxs("optgroup",{label:"Form Fields",children:[t.jsx("option",{value:"",children:d("Select Field","bit-integrations")}),e.map(s=>s.type!=="file"&&t.jsx("option",{value:s.name,children:s.label},`ff-zhcrm-${s.name}`))]}),t.jsx("option",{value:"custom",children:d("Custom...","bit-integrations")}),t.jsx("optgroup",{label:`General Smart Codes ${x?"":"(PRO)"}`,children:x&&((F=M)==null?void 0:F.map(s=>t.jsx("option",{value:s.name,children:s.label},`ff-rm-${s.name}`)))})]}),l.formField==="custom"&&t.jsx(q,{onChange:s=>R(s,a,i,p),label:d("Custom Value","bit-integrations"),className:"mr-2",type:"text",value:l.customValue,placeholder:d("Custom Value","bit-integrations"),formFields:e}),t.jsxs("select",{className:"btcd-paper-inp",name:"enChargeFields",value:l.enChargeFields,onChange:s=>b(s,a),disabled:n,children:[t.jsx("option",{value:"",children:d("Select Field","bit-integrations")}),n?((h=i==null?void 0:i.default)==null?void 0:h.fields)&&Object.values(i.default.fields).map(s=>t.jsx("option",{value:s.fieldId,children:s.fieldName},`${s.fieldId}-1`)):c&&c.map(s=>t.jsx("option",{value:s.fieldId,children:s.fieldName},`${s.fieldId}-1`))]}),!n&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>r(a),className:"icn-btn sh-sm ml-2",type:"button",children:"+"}),t.jsx("button",{onClick:()=>w(a),className:"icn-btn sh-sm ml-2",type:"button","aria-label":"btn",children:t.jsx(S,{})})]})]})}function L({formID:a,formFields:e,enchargeConf:l,setEnchargeConf:i}){var n;const p=c=>{const r=o({},l);r[c.target.name]=c.target.value,i(r)};return t.jsxs(t.Fragment,{children:[t.jsx("br",{}),t.jsxs("div",{className:"flx",children:[t.jsx("b",{className:"wdt-200 d-in-b",children:d("Tags:","bit-integrations")}),t.jsx("input",{className:"btcd-paper-inp w-5 mt-1",onChange:p,name:"tags",value:l.tags||"",type:"text",placeholder:d("tag-1, tag-2","bit-integrations")}),t.jsx(V,{width:250,icnSize:17,className:"ml-2",children:t.jsx("div",{className:"txt-body",children:"Tags separate with comma"})})]}),((n=l==null?void 0:l.default)==null?void 0:n.fields)!==0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"mt-4",children:t.jsx("b",{className:"wdt-100",children:d("Map Fields","bit-integrations")})}),t.jsx("div",{className:"btcd-hr mt-1"}),t.jsxs("div",{className:"flx flx-around mt-2 mb-2 btcbi-field-map-label",children:[t.jsx("div",{className:"txt-dp",children:t.jsx("b",{children:d("Form Fields","bit-integrations")})}),t.jsx("div",{className:"txt-dp",children:t.jsx("b",{children:d("Encharge Fields","bit-integrations")})})]}),l.field_map.map((c,r)=>t.jsx(O,{i:r,field:c,enchargeConf:l,formFields:e,setEnchargeConf:i},`sendinblue-m-${r+9}`)),t.jsx("div",{className:"txt-center btcbi-field-map-button mt-2",children:t.jsx("button",{onClick:()=>k(l.field_map.length,l,i),className:"icn-btn sh-sm",type:"button",children:"+"})}),t.jsx("br",{}),t.jsx("br",{})]})]})}export{L as E};
