"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),s=require("react/jsx-runtime"),i=require("react"),n=require("lucide-react"),a=require("./OverrideTimeline.js"),t=require("./HistorySkeleton.js"),l=require("../styles/RuleAccordion.module.css.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=o(i);exports.default=function(i){var o=i.type,c=i.conditions,r=i.isOpen,u=i.onToggle,p=i.showOverrideHistory,f=void 0!==p&&p,j=i.isLoadingHistory,m=void 0!==j&&j,x=i.historyError,_=i.overrideHistoryData,h=i.labelText,v=i.noConditionsText,g=void 0===v?"No conditions":v,y=null!=h?h:"apply"===o?"When to Apply":"When Not to Apply",N="apply"===o?"".concat(l.default.conditionBlock," ").concat(l.default.conditionBlockApply):"".concat(l.default.conditionBlock," ").concat(l.default.conditionBlockNotApply),A="apply"===o?l.default.conditionIconApply:l.default.conditionIconNotApply,k=d.default.useMemo(function(){return c?Array.isArray(c)?c:c.split(" OR ").map(function(e){return e.trim()}):[]},[c]);return s.jsxs("div",e.__assign({className:N},{children:["apply"===o&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:l.default.verticalLine}),s.jsx("div",{className:l.default.horizontalLine})]}),"notApply"===o&&s.jsx("div",{className:l.default.curvedLine}),s.jsxs("div",e.__assign({className:l.default.conditionContent},{children:[s.jsx("div",e.__assign({className:l.default.conditionHeader,onClick:u},{children:s.jsxs("div",e.__assign({className:l.default.conditionIconWrapper},{children:[s.jsx("div",e.__assign({className:A},{children:"apply"===o?s.jsx(n.Check,{size:10,strokeWidth:3}):s.jsx(n.X,{size:10,strokeWidth:3})})),s.jsx("span",e.__assign({className:l.default.conditionLabel},{children:y})),s.jsx("button",e.__assign({className:l.default.conditionToggleButton},{children:s.jsx(n.ChevronUp,{size:16,className:r?l.default.chevronOpen:l.default.chevronClosed})}))]}))})),r&&s.jsx("div",e.__assign({className:l.default.conditionItems},{children:k.length>0?s.jsxs("div",e.__assign({className:l.default.conditionItemContainer},{children:[s.jsx("div",e.__assign({className:l.default.conditionItemHeader},{children:s.jsx("div",e.__assign({className:l.default.conditionItemContent},{children:s.jsx("ol",e.__assign({className:l.default.conditionList},{children:k.map(function(i,n){return s.jsx("li",e.__assign({className:l.default.conditionListItem},{children:i}),n)})}))}))})),f?m?s.jsx(t.HistorySkeleton,{}):x?s.jsxs("div",e.__assign({className:l.default.errorMessage},{children:[s.jsx(n.AlertTriangle,{size:14}),s.jsx("span",{children:x})]})):_?s.jsx(a.default,{changeLog:_}):null:null]})):s.jsx("div",e.__assign({className:l.default.noConditions},{children:g}))})),!r&&s.jsx("div",{className:l.default.collapsedPadding})]}))]}))};
//# sourceMappingURL=RuleConditionBlock.js.map
