"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),n=require("react"),s=require("lucide-react"),r=require("./TooltipComponent.js");exports.default=function(t){var o,d,l=t.title,a=t.subtitle,p=t.children,x=t.defaultOpen,c=void 0===x||x,g=t.footerData,f=t.readOnly,u=void 0!==f&&f,h=t.variant,_=void 0===h?"default":h,v=t.expanded,j=t.onToggle,y=t.actionButtons,b=t.isAiStreaming,F=t.editFlow,m=void 0!==F&&F,w=n.useState(c),C=w[0],D=w[1];n.useEffect(function(){D(c)},[c]);var E=void 0!==v,S=E?v:C,z=function(){E?null==j||j():D(!S)},k="variant"===l.type,I="other"===l.type,B="tier-header"===_,R="rule-behavior"===_,A={padding:"12px 14px 0px 14px",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",borderRadius:B?"0px":"8px",borderBottom:B?"1px solid #E2E8F0":"none"},T={alignItems:"center",gap:"8px",margin:0,fontSize:"12px",fontWeight:600,padding:I?"":"6px 10px",borderRadius:"4px",color:u?"#717b8c":B&&S?"#2563EB":"#19213D",backgroundColor:R&&!l.isNewVariant?"#F7F8FA":k?"#FDF2F8":l.isDefault?"#F7F8FA":"transparent",border:k?"1px solid #FCE7F3":l.isDefault?"1px solid #F0F2F5":"none"},W={fontSize:"12px",fontWeight:400,color:"#666F8D",paddingLeft:I?"0px":"10px"},q={badge:{display:"inline-flex",alignItems:"center",gap:"8px",backgroundColor:"#f0fdf4",color:"#367c46",padding:"6px 10px",borderRadius:"8px",border:"1px solid #e1f6e8",fontSize:"12px",fontWeight:"600",lineHeight:"1.2",width:"fit-content"},defaultTag:{backgroundColor:"#f0f4f8",color:"#475569",fontSize:"11px",fontWeight:"600",padding:"2px 8px",borderRadius:"4px",textTransform:"uppercase",border:"1px solid #cbd5e1"},modifiedTag:{boxSizing:"border-box",display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",padding:"2px 8px",backgroundColor:"#FFFAE3",border:"1px solid #FDEDAA",borderRadius:"4px",color:"#854D0E",fontSize:"11px",fontWeight:"700",letterSpacing:"0.5px"}},L={width:"100%",backgroundColor:"#ffffff",overflow:"hidden",border:B?"none":R&&S?"1px solid #2563EB":"1px solid #E2E8F0",borderRadius:"8px",marginBottom:"0px"};return i.jsxs("div",e.__assign({style:L},{children:[i.jsxs("div",e.__assign({onClick:z,style:A},{children:[i.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"4px",margin:0,fontSize:"12px",fontWeight:600,borderRadius:"4px"}},{children:[!l.isNewVariant&&i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[i.jsx("div",e.__assign({style:T},{children:l.label})),l.isDefault&&i.jsx("span",e.__assign({style:q.defaultTag},{children:"Default"})),l.isModified&&i.jsx("span",e.__assign({style:q.modifiedTag},{children:"MODIFIED"}))]})),i.jsx("div",{children:l.isNewVariant&&i.jsxs("div",e.__assign({style:q.badge},{children:[i.jsx("svg",e.__assign({width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor"},{children:i.jsx("path",{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"})})),i.jsx("div",{children:"New Variant"})]}))}),a&&i.jsx("div",e.__assign({style:W},{children:a}))]})),i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px",paddingRight:"4px"}},{children:[y&&!b&&(m?i.jsx(r.default,e.__assign({description:"Coming Soon"},{children:i.jsx("div",e.__assign({onClick:function(e){return e.stopPropagation()},style:{cursor:"not-allowed",opacity:.6}},{children:i.jsx("div",e.__assign({style:{pointerEvents:"none"}},{children:y(S,function(){})}))}))})):i.jsx("div",e.__assign({onClick:function(e){return e.stopPropagation()}},{children:y(S,z)}))),i.jsx("div",e.__assign({onClick:z,style:{cursor:"pointer",display:"flex",alignItems:"center"}},{children:S?i.jsx(s.ChevronUp,{size:18,color:B?"#2563EB":"#64748B"}):i.jsx(s.ChevronDown,{size:18,color:"#64748B"})}))]}))]})),!S&&g&&i.jsx("div",e.__assign({style:{fontSize:"12px",color:"#475569",fontWeight:400,padding:"0 16px 12px 16px",display:"flex",alignItems:"center",gap:"8px"}},{children:I?i.jsxs(i.Fragment,{children:[i.jsx("span",e.__assign({style:{fontWeight:500,color:"#475569"}},{children:g.ruleTitle||""})),(null!==(d=null===(o=g.tiers)||void 0===o?void 0:o.length)&&void 0!==d?d:0)>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{width:"4px",height:"4px",backgroundColor:"#676970",borderRadius:"50%"}}),i.jsx("span",{children:Array.isArray(g.tiers)?g.tiers.join(", "):g.tiers})]})]}):i.jsx("span",e.__assign({style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},{children:g.description}))})),S&&i.jsx("div",e.__assign({style:{padding:"12px"}},{children:p}))]}))};
//# sourceMappingURL=AccordianSection.js.map
