import{al as w,aG as b,u as m,ei as y,r as n,j as e,B as r,bH as k,b4 as c,bb as g,at as C,bs as E}from"./index-C1DmWO_C.js";import{C as H}from"./CardLabels-DGyYjA4N.js";w().shape({keyword:b.label("Keyword name")});const G=({value:s,onSave:i,isDisabled:o=!1,isSaving:l=!1,editRestrictionText:x})=>{const{id:h}=m(),{currentData:p=[]}=y(h),[a,d]=n.useState(s),[u,t]=n.useState(!1),f=n.useCallback(async()=>{t(!0),await i(a),t(!1)},[a,i]),j=n.useCallback(()=>{d(s),t(!1)},[s]);return u?e.jsxs(r,{gap:"10px",children:[e.jsx(r,{flex:"1",width:"100%",children:e.jsx(k,{isMulti:!0,value:a,options:p,placeholder:"keywords",variant:"white",onChange:d,noDataMessage:"No keywords defined"})}),e.jsxs(r,{gap:"10px",maxHeight:"33px",flex:"0 1 min-content",children:[e.jsx(c,{disabled:l,onClick:j,intent:"secondary",children:"Cancel"}),e.jsx(c,{"data-test":"save-keyword",onClick:f,isLoading:l,children:"Save"})]})]}):e.jsxs(r,{alignItems:"baseline",children:[s!=null&&s.length?e.jsx(H,{flexGrow:1,flexWrap:"wrap",labels:a}):e.jsx(g,{value:"No keywords"}),e.jsx(C,{disabled:!o,mainText:x??"You have no edit right on the feature store",children:e.jsx(E,{height:"20px",mt:"-7px",intent:"inline",disabled:o,onClick:()=>t(!0),children:"edit keywords"})})]})};export{G as K};
