"use strict";(globalThis.webpackChunkacadlix=globalThis.webpackChunkacadlix||[]).push([["admin_quiz_free_prerequisite_options"],{"./src/free/admin/quiz/tabs/general/PrerequisiteOptions.js":(e,s,i)=>{i.r(s),i.d(s,{default:()=>j});var t=i("react"),l=i.n(t),a=i("./src/components/GridItem1.js"),r=i("./node_modules/@mui/material/esm/Autocomplete/Autocomplete.js"),o=i("./node_modules/@mui/material/esm/TextField/TextField.js"),d=i("./node_modules/@mui/material/esm/Button/Button.js"),n=i("./node_modules/@mui/material/esm/List/List.js"),m=i("./node_modules/@mui/material/esm/ListItem/ListItem.js"),u=i("./node_modules/@mui/material/esm/ListItemText/ListItemText.js"),c=i("./node_modules/@mui/material/esm/Box/Box.js"),p=i("@wordpress/i18n"),x=i("react/jsx-runtime");const j=e=>{const[s,i]=l().useState(null),t=s=>{e?.setValue("prerequisite",e?.watch("prerequisite").filter((e,i)=>i!==s))};return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(a.A,{size:{xs:12,sm:6,lg:3},sx:{display:"flex",gap:2},children:[(0,x.jsx)(r.A,{size:"small",fullWidth:!0,disabled:!0,options:e?.watch("quizzes")?.length>0?e?.watch("quizzes")?.filter(s=>!e?.watch("prerequisite")?.some(e=>e?.ID===s?.ID)):[],getOptionLabel:e=>e?.post_title||"",isOptionEqualToValue:(e,s)=>e?.ID===s?.ID,renderInput:e=>(0,x.jsx)(o.A,{...e,slotProps:{input:{...e.InputProps,autoComplete:"prerequisite"}},variant:"outlined",label:(0,p.__)("Select Quiz","acadlix")})}),(0,x.jsx)(d.A,{disabled:!0,variant:"contained",color:"primary",size:"small",children:(0,p.__)("Add","acadlix")})]}),(0,x.jsx)(a.A,{size:{xs:12,sm:12,lg:6}}),(0,x.jsx)(a.A,{size:{xs:12,sm:6,lg:3},children:(0,x.jsx)(n.A,{children:e?.watch("prerequisite").map((e,s)=>(0,x.jsx)(m.Ay,{disableGutters:!0,disabled:!0,secondaryAction:(0,x.jsx)(l().Fragment,{children:(0,x.jsx)(c.A,{sx:{display:"flex",gap:1},children:(0,x.jsx)(d.A,{variant:"outlined",color:"error",size:"small",onClick:t.bind(void 0,s),children:(0,p.__)("Delete","acadlix")})})}),children:(0,x.jsx)(u.A,{primary:e?.post_title})},s))})})]})}}}]);