var g=Object.defineProperty;var x=Object.getOwnPropertySymbols;var u=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var h=(s,l,t)=>l in s?g(s,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[l]=t,c=(s,l)=>{for(var t in l||(l={}))u.call(l,t)&&h(s,t,l[t]);if(x)for(var t of x(l))F.call(l,t)&&h(s,t,l[t]);return s};import{h as f,j as e}from"./main-333.js";import{j as N,_ as n,k as v,Q as _,m as w}from"./bi.636.93.js";import{g as k}from"./bi.973.867.js";const j=(s,l,t)=>{const i=c({},l);i.field_map.splice(s,0,{}),t(c({},i))},y=(s,l,t)=>{const i=c({},l);i.field_map.length>1&&i.field_map.splice(s,1),t(c({},i))};function $({i:s,formFields:l,field:t,pCloudConf:i,setPCloudConf:r}){var b;const{isPro:d}=f(N),m=(a,o)=>{const p=c({},i);p.field_map[o][a.target.name]=a.target.value,r(c({},p))};return e.jsx("div",{className:"flx mt-2 mb-2 btcbi-field-map",children:e.jsxs("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:t.formField||"",onChange:a=>m(a,s),children:[e.jsx("option",{value:"",children:n("Select Field","bit-integrations")}),e.jsx("optgroup",{label:"Form Fields",children:l==null?void 0:l.filter(a=>a.type==="file").map(a=>e.jsx("option",{value:a.name,children:a.label},`ff-rm-${a.name}`))}),e.jsx("optgroup",{label:`General Smart Codes ${d?"":"(PRO)"}`,children:d&&((b=v)==null?void 0:b.map(a=>e.jsx("option",{value:a.name,children:a.label},`ff-rm-${a.name}`)))})]}),e.jsxs("select",{className:"btcd-paper-inp",name:"pCloudFormField",value:t.pCloudFormField,onChange:a=>m(a,s),children:[e.jsx("option",{value:"",children:n("Select Folder","bit-integrations")}),e.jsx("option",{value:"0",children:n("Root Folder","bit-integrations")}),_(i.foldersList,"name","ASC").map(({name:a,id:o})=>e.jsx("option",{value:o,children:a},o))]})]}),e.jsx("button",{onClick:()=>j(s,i,r),className:"icn-btn sh-sm ml-2 mr-1",type:"button",children:"+"}),e.jsx("button",{onClick:()=>y(s,i,r),className:"icn-btn sh-sm ml-1",type:"button","aria-label":"btn",children:e.jsx("span",{className:"btcd-icn icn-trash-2"})})]})})}function M({pCloudConf:s,setPCloudConf:l}){var i;const t=(r,d)=>{const m=c({},s);d==="deleteFile"&&(r.target.checked?m.actions.delete_from_wp=!0:delete m.actions.delete_from_wp),l(c({},m))};return e.jsx("div",{className:"pos-rel d-flx w-8",children:e.jsx(w,{checked:((i=s.actions)==null?void 0:i.delete_from_wp)||!1,onChange:r=>t(r,"deleteFile"),className:"mt-4 mr-2",value:"delete_from_wp",title:n("Delete File From Wordpress","bit-integrations"),subTitle:n("Delete file from Wordpress after upload in PCloud","bit-integrations")})})}function D({flowID:s,formFields:l,pCloudConf:t,setPCloudConf:i}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-5",children:[e.jsx("b",{className:"wdt-100",children:n("Field Map","bit-integrations")}),e.jsx("button",{onClick:()=>k(t,i,"refresh"),className:"icn-btn sh-sm ml-2 mr-2 tooltip",style:{"--tooltip-txt":`'${n("Fetch All PCloud Folders","bit-integrations")}'`},type:"button",children:"↻"})]}),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:n("File Input","bit-integrations")})}),e.jsx("div",{className:"txt-dp",children:e.jsx("b",{children:n("PCloud Folder","bit-integrations")})})]}),t==null?void 0:t.field_map.map((r,d)=>e.jsx($,{i:d,field:r,formFields:l,pCloudConf:t,setPCloudConf:i},`rp-m-${d+9}`)),e.jsx("div",{className:"txt-center btcbi-field-map-button mt-2",children:e.jsx("button",{onClick:()=>j(t.field_map.length,t,i),className:"icn-btn sh-sm",type:"button",children:"+"})}),e.jsx("br",{}),e.jsx("br",{}),e.jsx("div",{className:"mt-4",children:e.jsx("b",{className:"wdt-100",children:n("Utilities","bit-integrations")})}),e.jsx("div",{className:"btcd-hr mt-1"}),e.jsx(M,{pCloudConf:t,setPCloudConf:i})]})}export{D as P};
