import{a as M,g as v,i as C,aH as F,r as H,H as y,j as s,_ as a,W as L,bs as N,M as S,ed as _,f,bG as k,ba as E}from"./main-634.js";import{F as h}from"./bf-767-388.js";import{O as I,a as K}from"./bf-178-233.js";import"./bf-692-111.js";import"./bf-400-72.js";import"./bf-25-81.js";import"./bf-438-114.js";import"./bf-982-242.js";import"./bf-497-246.js";import"./bf-641-107.js";import"./bf-486-243.js";import"./bf-723-244.js";import"./bf-299-245.js";import"./bf-534-247.js";import"./bf-962-248.js";import"./bf-343-249.js";import"./bf-791-250.js";import"./bf-570-251.js";import"./bf-838-80.js";import"./bf-297-103.js";import"./bf-284-252.js";import"./bf-17-106.js";import"./bf-671-253.js";import"./bf-334-254.js";import"./bf-710-385.js";import"./bf-676-386.js";import"./bf-638-271.js";import"./bf-247-269.js";import"./bf-423-273.js";import"./bf-457-387.js";import"./bf-577-275.js";import"./bf-288-389.js";import"./bf-939-390.js";function gt({showUpload:g}){const{css:p}=M(),{fieldKey:t}=v(),[n,d]=C(F),[c,m]=H.useState(!1);if(!t)return null;const o=y(n[t]),u=y(n[t].opt),x=o.adminLbl||"",O=()=>{m(!0)},j=()=>{m(!1)},q=i=>{const r=i.filter(e=>e.req);r.length&&_({target:{checked:!0}});const l=f(n,e=>{e[t].opt=i,r.length&&e[t].err.req?(e[t].err.req.custom=!0,e[t].err.req.msg=`<p style="margin:0">${r.map(T=>T.lbl).join(",")} is required</p>`):e[t].err.req&&(e[t].err.req.msg=`<p style="margin:0">${a("This field is required")}</p>`)});d(l),k({event:`Options List Moddified: ${o.lbl||x||t}`,type:"option_list_modify",state:{fields:l,fldKey:t}}),E(t)},b=i=>{d(r=>f(r,l=>{l[t].customType=i}))};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:p(h.fieldSection),children:[s.jsx("div",{className:p(h.fieldSectionTitle),children:a("Options")}),s.jsx(I,{options:u,onClick:()=>m(!0)}),s.jsxs(L,{dataTestId:"edt-opt-stng",variant:"primary-outline",size:"sm",className:p({mt:10}),onClick:O,children:[a("Add/Edit Options"),s.jsx("span",{className:p($.plsIcn),children:s.jsx(N,{size:"13",stroke:"3"})})]})]}),s.jsx(S,{autoHeight:!0,show:c,setModal:j,className:"o-v",title:a("Options"),width:"755px",children:s.jsx(K,{optionMdl:c,options:u,setOptions:i=>q(i),lblKey:"lbl",valKey:"val",type:o.typ,isRating:o.typ,showUpload:g,customType:o.customType,setCustomType:b})})]})}const $={plsIcn:{ml:3,mt:3,tm:"rotate(45deg)"}};export{gt as default};
