"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),o=require("react/jsx-runtime"),e=require("react"),t=require("@mui/material"),a=require("@mui/icons-material/KeyboardArrowDown"),i=require("@mui/material/Tooltip"),r=require("lucide-react");function s(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var c=s(a),l=s(i);exports.default=function(a){var i,s,u=a.conflictingConditions,d=function(n){var o={};return n.forEach(function(n){var e="".concat(n.conflictType,"_").concat(n.reason);o[e]||(o[e]=[]),o[e].push(n)}),o},p=(null==u?void 0:u.filter(function(n){return n.condition_wta||n.condition_wnta}))||[],f=(i=d(p),s=[],Object.values(i).forEach(function(n){n.length>0&&s.push(n[0])}),s),x=e.useState(function(){return f.map(function(n,o){return o})}),h=x[0],g=x[1];return p&&0!==p.length?o.jsxs(t.Box,n.__assign({sx:{backgroundColor:"#FEF2F2",border:"1px solid #FCA5A5",boxShadow:"0 1px 4px rgba(0, 0, 0, 0.04)",padding:3,borderRadius:2,mt:3,mb:3,fontFamily:"Plus Jakarta Sans"}},{children:[o.jsxs(t.Box,n.__assign({sx:{display:"flex",alignItems:"center",mb:2}},{children:[o.jsx(t.Typography,n.__assign({sx:{fontSize:"1.15rem",fontWeight:700,color:"#B91C1C",fontFamily:"Plus Jakarta Sans"}},{children:"Conflicting Conditions Found"})),o.jsx(l.default,n.__assign({title:"The current learning contains conditions that conflicting. Please review and adjust them to ensure consistency.",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:o.jsx(r.Info,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),o.jsx(t.Box,n.__assign({sx:{maxHeight:360,overflowY:"auto",pr:1.5}},{children:f.map(function(e,a){var i=[],r=function(n){return n.map(function(n,o){return"".concat(o+1,". ").concat(n)}).join("\n\n")},s=[],l=[],u=d(p)["".concat(e.conflictType,"_").concat(e.reason)]||[];u.length>1?u.forEach(function(n){n.condition_wta&&s.push(n.condition_wta),n.condition_wnta&&l.push(n.condition_wnta)}):(e.condition_wta&&s.push(e.condition_wta),e.condition_wnta&&l.push(e.condition_wnta)),s.length>0&&i.push({label:"When To Apply",value:r(s)}),l.length>0&&i.push({label:"When Not To Apply",value:r(l)});var f=h.includes(a);return o.jsxs(t.Accordion,n.__assign({expanded:f,onChange:function(){return function(o){g(function(e){return e.includes(o)?e.filter(function(n){return n!==o}):n.__spreadArray(n.__spreadArray([],e,!0),[o],!1)})}(a)},disableGutters:!0,sx:{mb:2,border:"1px solid #FCA5A5",fontFamily:"Plus Jakarta Sans",borderRadius:2,"&::before":{display:"none"}}},{children:[o.jsx(t.AccordionSummary,n.__assign({expandIcon:o.jsx(c.default,{style:{color:"#991B1B",transition:"transform 0.3s ease-in-out"}}),"aria-controls":"panel-".concat(a,"-content"),id:"panel-".concat(a,"-header"),sx:{fontFamily:"Plus Jakarta Sans",color:"#991B1B",fontWeight:600,px:2,py:1.5}},{children:"Conflict in current conditions"})),o.jsxs(t.AccordionDetails,n.__assign({sx:{px:2,pb:2}},{children:[o.jsx(t.Box,n.__assign({sx:{display:"flex",flexDirection:{xs:"column",sm:2===i.length?"row":"column"},gap:2,mb:2}},{children:i.map(function(e,a){return o.jsxs(t.Box,n.__assign({sx:{flex:2===i.length?1:"none",border:"1px solid #FCA5A5",borderRadius:2,padding:2,backgroundColor:"#FFFFFF"}},{children:[o.jsx(t.Typography,n.__assign({variant:"caption",sx:{fontSize:"0.9rem",color:"#6B7280",fontWeight:600,mb:.5,display:"block",fontFamily:"Plus Jakarta Sans"}},{children:e.label})),o.jsx(t.Typography,n.__assign({variant:"body2",sx:{fontSize:"1rem",color:"#374151",whiteSpace:"pre-line",fontFamily:"Plus Jakarta Sans"}},{children:e.value}))]}),a)})})),o.jsxs(t.Typography,n.__assign({variant:"body2",sx:{fontSize:"1rem",color:"#1F2937",lineHeight:1.6,fontFamily:"Plus Jakarta Sans"}},{children:[o.jsx("strong",{children:"Reason:"})," ",e.reason]}))]}))]}),a)})}))]})):null};
//# sourceMappingURL=ConflictingLearningWarnCard.js.map
