@vectorize-io/hindsight-control-plane 0.5.6 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/package.json +1 -1
  2. package/standalone/.next/BUILD_ID +1 -1
  3. package/standalone/.next/build-manifest.json +3 -3
  4. package/standalone/.next/prerender-manifest.json +3 -3
  5. package/standalone/.next/server/app/_global-error.html +1 -1
  6. package/standalone/.next/server/app/_global-error.rsc +1 -1
  7. package/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  8. package/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  10. package/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  11. package/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  12. package/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  13. package/standalone/.next/server/app/_not-found.html +1 -1
  14. package/standalone/.next/server/app/_not-found.rsc +12 -12
  15. package/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +12 -12
  16. package/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  17. package/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +7 -7
  18. package/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  19. package/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  20. package/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  21. package/standalone/.next/server/app/banks/[bankId]/page_client-reference-manifest.js +1 -1
  22. package/standalone/.next/server/app/dashboard/page_client-reference-manifest.js +1 -1
  23. package/standalone/.next/server/app/dashboard.html +1 -1
  24. package/standalone/.next/server/app/dashboard.rsc +14 -14
  25. package/standalone/.next/server/app/dashboard.segments/_full.segment.rsc +14 -14
  26. package/standalone/.next/server/app/dashboard.segments/_head.segment.rsc +4 -4
  27. package/standalone/.next/server/app/dashboard.segments/_index.segment.rsc +7 -7
  28. package/standalone/.next/server/app/dashboard.segments/_tree.segment.rsc +1 -1
  29. package/standalone/.next/server/app/dashboard.segments/dashboard/__PAGE__.segment.rsc +4 -4
  30. package/standalone/.next/server/app/dashboard.segments/dashboard.segment.rsc +3 -3
  31. package/standalone/.next/server/app/index.html +1 -1
  32. package/standalone/.next/server/app/index.rsc +12 -12
  33. package/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  34. package/standalone/.next/server/app/index.segments/_full.segment.rsc +12 -12
  35. package/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
  36. package/standalone/.next/server/app/index.segments/_index.segment.rsc +7 -7
  37. package/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  38. package/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  39. package/standalone/.next/server/chunks/[root-of-the-server]__03i9r24._.js +1 -1
  40. package/standalone/.next/server/chunks/[root-of-the-server]__0lu.x0s._.js +1 -1
  41. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__09_g7l8._.js +2 -2
  42. package/standalone/.next/server/chunks/ssr/_0u45pfs._.js +1 -1
  43. package/standalone/.next/server/middleware-build-manifest.js +3 -3
  44. package/standalone/.next/server/pages/404.html +1 -1
  45. package/standalone/.next/server/pages/500.html +1 -1
  46. package/standalone/.next/server/server-reference-manifest.js +1 -1
  47. package/standalone/.next/server/server-reference-manifest.json +1 -1
  48. package/standalone/.next/static/chunks/{0r99ajy0ixo_s.js → 0tk5mcccp069w.js} +2 -2
  49. package/standalone/.next/static/chunks/{0-_tm3q7~~e~l.js → 14b8x85v-.9gx.js} +1 -1
  50. package/standalone/package.json +1 -1
  51. /package/standalone/.next/static/{jKGtYqSAMmgA-l9ZJqTuI → 3JRQG7ch5ssW2YtR-3Lf0}/_buildManifest.js +0 -0
  52. /package/standalone/.next/static/{jKGtYqSAMmgA-l9ZJqTuI → 3JRQG7ch5ssW2YtR-3Lf0}/_clientMiddlewareManifest.js +0 -0
  53. /package/standalone/.next/static/{jKGtYqSAMmgA-l9ZJqTuI → 3JRQG7ch5ssW2YtR-3Lf0}/_ssgManifest.js +0 -0
@@ -5,5 +5,5 @@ You can add a description to the \`${mb}\` by passing a \`${m_}\` component as a
5
5
  Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${mb}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
6
6
 
7
7
  For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return em.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null};let mP=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(my,{className:(0,eO.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));mP.displayName=my.displayName;let mD=em.forwardRef(({className:e,...t},n)=>(0,ep.jsxs)(mx,{children:[(0,ep.jsx)(mP,{}),(0,ep.jsx)(mk,{ref:n,className:(0,eO.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));mD.displayName=mk.displayName;let mL=({className:e,...t})=>(0,ep.jsx)("div",{className:(0,eO.cn)("flex flex-col space-y-2 text-center sm:text-left",e),...t});mL.displayName="AlertDialogHeader";let mI=({className:e,...t})=>(0,ep.jsx)("div",{className:(0,eO.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});mI.displayName="AlertDialogFooter";let mR=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(mC,{ref:n,className:(0,eO.cn)("text-lg font-semibold",e),...t}));mR.displayName=mC.displayName;let mB=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(mS,{ref:n,className:(0,eO.cn)("text-sm text-muted-foreground",e),...t}));mB.displayName=mS.displayName;let mz=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(mT,{ref:n,className:(0,eO.cn)((0,eL.buttonVariants)(),e),...t}));mz.displayName=mT.displayName;let mF=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(mO,{ref:n,className:(0,eO.cn)((0,eL.buttonVariants)({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));mF.displayName=mO.displayName;let mV=(0,eN.default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),mU=(0,eN.default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),mH=(0,eN.default)("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);var mW=e.i(64659);function mY(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return"just now";let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);if(i<30)return`${i}d ago`;let a=Math.floor(i/30);return a<12?`${a}mo ago`:`${Math.floor(a/12)}y ago`}function mG(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function m$({metadata:e}){let t=Object.entries(e);return 0===t.length?(0,ep.jsx)("span",{children:"-"}):(0,ep.jsxs)("div",{className:"flex flex-wrap gap-1",children:[t.slice(0,3).map(([e,t])=>(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-blue-500/10 text-blue-600 dark:text-blue-400 font-medium",children:[e,"=",String(t)]},e)),t.length>3&&(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 text-muted-foreground",children:["+",t.length-3]})]})}function mX({children:e}){return(0,ep.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground mb-1",children:e})}function mq({title:e,icon:t,children:n}){return(0,ep.jsxs)("div",{className:"rounded-lg border border-border bg-muted/20 overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5 px-4 py-2 border-b border-border bg-muted/40 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[t,e]}),(0,ep.jsx)("div",{className:"p-4 space-y-4",children:n})]})}function mK({label:e,value:t}){return(0,ep.jsxs)("div",{children:[(0,ep.jsx)(mX,{children:e}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:t})]})}function mZ({nodesByFactType:e}){let t=e??{world:0,experience:0,observation:0},n=t.world+t.experience+t.observation,r=[{name:"World",value:t.world,color:"#8b5cf6"},{name:"Experience",value:t.experience,color:"#ec4899"},{name:"Observations",value:t.observation,color:"#6366f1"}];return(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)("h4",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.08em]",children:"Memory composition"}),(0,ep.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:n.toLocaleString()})]}),0===n?(0,ep.jsx)("div",{className:"text-xs text-muted-foreground py-2",children:"No memories yet"}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"h-1.5 flex w-full rounded-full overflow-hidden bg-muted",children:r.filter(e=>e.value>0).map(e=>(0,ep.jsx)("div",{className:"h-full",style:{width:`${e.value/n*100}%`,backgroundColor:e.color},title:`${e.name}: ${e.value.toLocaleString()}`},e.name))}),(0,ep.jsx)("div",{className:"grid grid-cols-3 gap-3 text-sm",children:r.map(e=>(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px]",style:{backgroundColor:e.color}}),(0,ep.jsx)("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-medium",children:e.name})]}),(0,ep.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,ep.jsx)("span",{className:"text-base font-semibold tabular-nums",children:e.value.toLocaleString()}),(0,ep.jsx)("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:n>0?`${(e.value/n*100).toFixed(0)}%`:"0%"})]})]},e.name))})]})]})}function mQ({chunkFactType:e,setChunkFactType:t}){return(0,ep.jsx)("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border bg-muted/30",children:["world","experience","observation"].map(n=>(0,ep.jsx)("button",{onClick:()=>t(n),className:`px-2 py-0.5 rounded text-[11px] font-medium transition-colors ${e===n?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"observation"===n?"Obs":n.charAt(0).toUpperCase()+n.slice(1)},n))})}function mJ({chunk:e}){let[t,n]=(0,em.useState)(!1),[r,i]=(0,em.useState)(!1),[a,o]=(0,em.useState)("world"),s=e.chunk_text??"",l=s.length>150?s.slice(0,150)+"...":s;return(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("button",{className:"w-full flex items-center gap-3 px-4 py-2 text-left hover:bg-muted/30 transition-colors",onClick:()=>n(!t),children:[(0,ep.jsx)(mW.ChevronDown,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform ${t?"":"-rotate-90"}`}),(0,ep.jsxs)("span",{className:"text-xs font-mono text-muted-foreground shrink-0",children:["#",e.chunk_index]}),(0,ep.jsxs)("span",{className:"text-[11px] text-muted-foreground/60 shrink-0",children:[s.length.toLocaleString()," chars"]}),!t&&(0,ep.jsx)("span",{className:"text-xs text-foreground/50 truncate",children:l})]}),t&&(r?(0,ep.jsxs)("div",{style:{height:"500px"},className:"flex flex-col border-t border-border",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted/30 border-b border-border",children:[(0,ep.jsx)(mQ,{chunkFactType:a,setChunkFactType:o}),(0,ep.jsx)("div",{className:"flex-1"}),(0,ep.jsxs)(eL.Button,{variant:"ghost",size:"sm",onClick:()=>i(!1),className:"h-6 px-2 text-xs gap-1",children:[(0,ep.jsx)(eH,{className:"w-3 h-3"}),"Compact"]})]}),(0,ep.jsx)("div",{className:"flex-1 min-h-0",children:(0,ep.jsx)(fF,{factType:a,chunkId:e.chunk_id},`${e.chunk_id}-${a}-full`)})]}):(0,ep.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-border",style:{height:"350px"},children:[(0,ep.jsx)("div",{className:"overflow-y-auto",children:(0,ep.jsx)("pre",{className:"px-4 py-3 text-[11px] leading-5 text-foreground/80 whitespace-pre-wrap font-mono",children:s})}),(0,ep.jsxs)("div",{className:"flex flex-col overflow-hidden",children:[(0,ep.jsx)(mQ,{chunkFactType:a,setChunkFactType:o}),(0,ep.jsx)("div",{className:"flex-1 min-h-0",children:(0,ep.jsx)(fF,{factType:a,chunkId:e.chunk_id,compact:!0,onExpandToggle:()=>i(!0)},`${e.chunk_id}-${a}-compact`)})]})]}))]})}function m0(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(!1),[a,o]=(0,em.useState)(""),[s,l]=(0,em.useState)(0),[c,u]=(0,em.useState)(1),d=Math.ceil(s/50),h=(c-1)*50,[f,p]=(0,em.useState)(null),[g,v]=(0,em.useState)(!1),[x,y]=(0,em.useState)(null),[b,w]=(0,em.useState)(!1),[j,N]=(0,em.useState)(""),[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(""),[A,O]=(0,em.useState)(!1),[M,P]=(0,em.useState)([]),[D,L]=(0,em.useState)(0),[I,R]=(0,em.useState)(!1),[B,z]=(0,em.useState)(!1),[F,V]=(0,em.useState)(!1),[U,H]=(0,em.useState)(null),[W,Y]=(0,em.useState)(null),[G,$]=(0,em.useState)(null),X=async(t=1)=>{if(e){i(!0);try{let r=await eD.client.listDocuments({bank_id:e,q:a,limit:50,offset:(t-1)*50});n(r.items||[]),l(r.total||0)}catch(e){}finally{i(!1)}}},q=e=>{u(e),X(e)},K=async t=>{if(e){v(!0),p({id:t}),w(!1),N(""),_(!1),T(""),P([]),L(0),z(!1);try{let n=await eD.client.getDocument(t,e);p(n)}catch(e){p(null)}finally{v(!1)}}},Z=async t=>{if(e){R(!0);try{let n=await eD.client.listDocumentChunks({document_id:t,bank_id:e,limit:100});P(n.items||[]),L(n.total||0),z(!0)}catch(e){}finally{R(!1)}}},Q=async()=>{if(e&&f){V(!0);try{let t=await eD.client.reprocessDocument(f.id,e);H({success:!0,message:`Reprocessing started (operation: ${t.operation_id})`})}catch(e){H({success:!1,message:"Error reprocessing document: "+e.message})}finally{V(!1)}}},J=async()=>{if(!e||!W)return;let t=W.id;y(t),Y(null);try{let n=await eD.client.deleteDocument(t,e);$({success:!0,message:`Deleted document and ${n.memory_units_deleted} memory units.`}),f?.id===t&&p(null),X(c)}catch(e){console.error("Error deleting document:",e),$({success:!1,message:"Error deleting document: "+e.message})}finally{y(null)}},ee=()=>{w(!1),N("")},et=async()=>{if(!e||!f||!S.trim())return;let t=f.retain_params??{},n={content:S,document_id:f.id};t.context&&(n.context=t.context),t.event_date&&(n.timestamp=t.event_date),t.metadata&&Object.keys(t.metadata).length>0&&(n.metadata=t.metadata),f.tags&&f.tags.length>0&&(n.tags=f.tags),O(!0);try{await eD.client.retain({bank_id:e,items:[n],async:!1});let t=await eD.client.getDocument(f.id,e);p(t),_(!1),T(""),X(c)}catch(e){console.error("Error updating document content:",e)}finally{O(!1)}},en=async()=>{if(!e||!f)return;let t=j.split(",").map(e=>e.trim()).filter(e=>e.length>0);E(!0);try{await eD.client.updateDocument(f.id,e,t),p({...f,tags:t}),n(e=>e.map(e=>e.id===f.id?{...e,tags:t}:e)),w(!1),N("")}catch(e){console.error("Error updating document tags:",e)}finally{E(!1)}};return(0,em.useEffect)(()=>{e&&(u(1),X(1))},[e]),(0,em.useEffect)(()=>{if(!e)return;let t=setTimeout(()=>{u(1),X(1)},300);return()=>clearTimeout(t)},[a]),(0,ep.jsxs)("div",{children:[r?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading documents..."})]})}):t.length>0?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"mb-4 text-sm text-muted-foreground",children:[s," ",1===s?"document":"documents"]}),(0,ep.jsxs)("div",{className:"w-full",children:[(0,ep.jsx)("div",{className:"px-5 mb-4",children:(0,ep.jsx)(eI.Input,{type:"text",value:a,onChange:e=>o(e.target.value),placeholder:"Search documents (ID)...",className:"max-w-2xl"})}),(0,ep.jsx)("div",{className:"overflow-x-auto px-5 pb-5",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{children:"Document ID"}),(0,ep.jsx)(eJ,{children:"Created"}),(0,ep.jsx)(eJ,{children:"Updated"}),(0,ep.jsx)(eJ,{children:"Tags"}),(0,ep.jsx)(eJ,{children:"Metadata"}),(0,ep.jsx)(eJ,{children:"Size"}),(0,ep.jsx)(eJ,{children:"Memory Units"})]})}),(0,ep.jsx)(eZ,{children:t.length>0?t.map(e=>(0,ep.jsxs)(eQ,{className:`cursor-pointer hover:bg-muted/50 ${f?.id===e.id?"bg-primary/10":""}`,onClick:()=>K(e.id),children:[(0,ep.jsx)(e0,{className:"text-card-foreground font-mono text-xs break-all",children:e.id}),(0,ep.jsx)(e0,{className:"text-card-foreground",title:e.created_at?new Date(e.created_at).toLocaleString():"",children:e.created_at?mY(e.created_at):"N/A"}),(0,ep.jsx)(e0,{className:"text-card-foreground",title:e.updated_at?new Date(e.updated_at).toLocaleString():"",children:e.updated_at?mY(e.updated_at):"N/A"}),(0,ep.jsx)(e0,{className:"text-card-foreground",children:e.tags&&e.tags.length>0?(0,ep.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.tags.slice(0,3).map((e,t)=>(0,ep.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-amber-500/10 text-amber-600 dark:text-amber-400 font-medium",children:e},t)),e.tags.length>3&&(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 text-muted-foreground",children:["+",e.tags.length-3]})]}):"-"}),(0,ep.jsx)(e0,{className:"text-card-foreground",children:e.document_metadata&&Object.keys(e.document_metadata).length>0?(0,ep.jsx)(m$,{metadata:e.document_metadata}):"-"}),(0,ep.jsx)(e0,{className:"text-card-foreground",children:mG(e.text_length||0)}),(0,ep.jsx)(e0,{className:"text-card-foreground",children:e.memory_unit_count})]},e.id)):(0,ep.jsx)(eQ,{children:(0,ep.jsx)(e0,{colSpan:7,className:"text-center",children:'Click "Load Documents" to view data'})})})]})}),d>1&&(0,ep.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t px-5",children:[(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground",children:[h+1,"-",Math.min(h+50,s)," of ",s]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>q(1),disabled:1===c||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eF,{className:"h-3 w-3"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>q(c-1),disabled:1===c||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eS,{className:"h-3 w-3"})}),(0,ep.jsxs)("span",{className:"text-xs px-2",children:[c," / ",d]}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>q(c+1),disabled:c===d||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eT.ChevronRight,{className:"h-3 w-3"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>q(d),disabled:c===d||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eV,{className:"h-3 w-3"})})]})]})]})]}):(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"📄"}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"No documents found"})]})}),(0,ep.jsx)(tY.Dialog,{open:!!f,onOpenChange:e=>!e&&p(null),children:(0,ep.jsxs)(tY.DialogContent,{className:"w-[95vw] max-w-[95vw] h-[92vh] sm:max-w-[95vw] flex flex-col overflow-hidden",children:[(0,ep.jsx)(tY.DialogHeader,{className:"pr-10",children:(0,ep.jsx)(tY.DialogTitle,{className:"flex items-center gap-2",children:(0,ep.jsx)("span",{className:"truncate font-mono text-sm",children:f?.id??"Document"})})}),g?(0,ep.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading document..."})]})}):f?(0,ep.jsxs)(t$.Tabs,{defaultValue:"general",className:"flex-1 flex flex-col overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,ep.jsxs)(t$.TabsList,{className:"grid grid-cols-3 w-full max-w-md",children:[(0,ep.jsxs)(t$.TabsTrigger,{value:"general",className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eA,{className:"w-3.5 h-3.5"}),"General"]}),(0,ep.jsxs)(t$.TabsTrigger,{value:"content",className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5"}),"Content"]}),(0,ep.jsxs)(t$.TabsTrigger,{value:"chunks",className:"flex items-center gap-1.5",onClick:()=>{!B&&f?.id&&Z(f.id)},children:[(0,ep.jsx)(tX,{className:"w-3.5 h-3.5"}),"Chunks",B?` (${D})`:""]})]}),(0,ep.jsxs)(p5,{children:[(0,ep.jsx)(p4,{asChild:!0,children:(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 shrink-0",disabled:F,"aria-label":"Actions",children:(0,ep.jsx)(mH,{className:"h-4 w-4"})})}),(0,ep.jsxs)(ml,{align:"end",children:[(0,ep.jsxs)(mc,{onClick:Q,disabled:F,children:[(0,ep.jsx)(eW,{className:"h-4 w-4 mr-2"}),"Reprocess"]}),(0,ep.jsx)(mu,{}),(0,ep.jsxs)(mc,{onClick:()=>{Y({id:f.id,memoryCount:f.memory_unit_count})},className:"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400 focus:bg-red-500/10",children:[(0,ep.jsx)(mV,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]}),(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto mt-4",children:[(0,ep.jsx)(t$.TabsContent,{value:"content",className:"mt-0",children:void 0!==f.original_text&&(C?(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("div",{className:"flex items-center justify-end mb-2",children:(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsxs)(eL.Button,{size:"sm",onClick:et,disabled:A||!S.trim(),className:"h-7 px-3 gap-1 text-xs",children:[A?(0,ep.jsx)("span",{className:"animate-spin",children:"⏳"}):(0,ep.jsx)(tV.Check,{className:"h-3 w-3"}),"Save"]}),(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",onClick:()=>{_(!1),T("")},disabled:A,className:"h-7 px-3 gap-1 text-xs",children:[(0,ep.jsx)(tU.X,{className:"h-3 w-3"}),"Cancel"]})]})}),(0,ep.jsx)("textarea",{value:S,onChange:e=>T(e.target.value),className:"w-full min-h-[400px] max-h-[600px] p-4 bg-muted/50 rounded-lg border border-border text-sm font-mono leading-relaxed text-card-foreground resize-y",autoFocus:!0}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Saving will re-ingest this document via retain (upsert). Existing memory units for this document will be replaced."})]}):(0,ep.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-2 px-4 py-2 border-b border-border bg-muted/50 text-xs text-muted-foreground",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5"}),(0,ep.jsx)("span",{className:"font-semibold uppercase tracking-wide",children:"Stored content"}),(0,ep.jsxs)("span",{className:"text-muted-foreground/70",children:["·"," ",f.original_text?.length?.toLocaleString()??0," chars"]})]}),(0,ep.jsxs)(eL.Button,{variant:"ghost",size:"sm",onClick:()=>{T(f?.original_text??""),_(!0)},className:"h-6 px-2 gap-1 text-xs",children:[(0,ep.jsx)(mU,{className:"h-3 w-3"}),"Edit"]})]}),(0,ep.jsx)("pre",{className:"p-4 text-[11px] leading-5 text-foreground/80 whitespace-pre-wrap font-mono",children:f.original_text})]}))}),(0,ep.jsx)(t$.TabsContent,{value:"general",className:"mt-0",children:(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)(t$.Tabs,{defaultValue:"world",className:"flex flex-col",children:[(0,ep.jsxs)(t$.TabsList,{className:"w-fit",children:[(0,ep.jsx)(t$.TabsTrigger,{value:"world",children:"World"}),(0,ep.jsx)(t$.TabsTrigger,{value:"experience",children:"Experience"}),(0,ep.jsx)(t$.TabsTrigger,{value:"observation",children:"Observations"})]}),(0,ep.jsxs)("div",{className:"mt-2",children:[(0,ep.jsx)(t$.TabsContent,{value:"world",className:"mt-0",children:(0,ep.jsx)(fF,{factType:"world",documentId:f.id,compact:!0})}),(0,ep.jsx)(t$.TabsContent,{value:"experience",className:"mt-0",children:(0,ep.jsx)(fF,{factType:"experience",documentId:f.id,compact:!0})}),(0,ep.jsx)(t$.TabsContent,{value:"observation",className:"mt-0",children:(0,ep.jsx)(fF,{factType:"observation",documentId:f.id,compact:!0})})]})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ep.jsxs)(mq,{title:"Document",icon:(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5"}),children:[f.created_at&&(0,ep.jsx)(mK,{label:"Created",value:new Date(f.created_at).toLocaleString()}),f.updated_at&&(0,ep.jsx)(mK,{label:"Updated",value:new Date(f.updated_at).toLocaleString()}),f.original_text&&(0,ep.jsx)(mK,{label:"Size",value:mG(new Blob([f.original_text]).size)}),(0,ep.jsx)(mK,{label:"Tags",value:b?(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(eI.Input,{value:j,onChange:e=>N(e.target.value),placeholder:"tag1, tag2, tag3",className:"text-sm h-7 w-64",onKeyDown:e=>{"Enter"===e.key&&en(),"Escape"===e.key&&ee()},autoFocus:!0}),(0,ep.jsx)(eL.Button,{size:"sm",onClick:en,disabled:k,className:"h-7 w-7 p-0",children:k?(0,ep.jsx)("span",{className:"animate-spin text-xs",children:"⏳"}):(0,ep.jsx)(tV.Check,{className:"h-3 w-3"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:ee,disabled:k,className:"h-7 w-7 p-0",children:(0,ep.jsx)(tU.X,{className:"h-3 w-3"})})]}):(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[f.tags&&f.tags.length>0?(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:f.tags.map((e,t)=>(0,ep.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-amber-500/10 text-amber-600 dark:text-amber-400 font-medium",children:e},t))}):(0,ep.jsx)("span",{className:"text-sm text-muted-foreground italic",children:"none"}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",onClick:()=>{N((f?.tags??[]).join(", ")),w(!0)},className:"h-6 w-6 p-0",children:(0,ep.jsx)(mU,{className:"h-3 w-3"})})]})}),f.retain_params?.context&&(0,ep.jsx)(mK,{label:"Context",value:f.retain_params.context}),f.retain_params?.event_date&&(0,ep.jsx)(mK,{label:"Event Date",value:new Date(f.retain_params.event_date).toLocaleString()}),f.retain_params?.metadata&&Object.keys(f.retain_params.metadata).length>0&&(0,ep.jsx)(mK,{label:"Metadata",value:(0,ep.jsx)(m$,{metadata:f.retain_params.metadata})})]}),(0,ep.jsx)(mq,{title:"Memory Composition",icon:(0,ep.jsx)(e$,{className:"w-3.5 h-3.5"}),children:(0,ep.jsx)(mZ,{nodesByFactType:f.nodes_by_fact_type})})]})]})}),(0,ep.jsx)(t$.TabsContent,{value:"chunks",className:"mt-0",children:I?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading chunks..."})]})}):M.length>0?(0,ep.jsx)("div",{className:"rounded-lg border border-border overflow-hidden divide-y divide-border",children:M.map(e=>(0,ep.jsx)(mJ,{chunk:e},e.chunk_id))}):B?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"📄"}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"No chunks found for this document"})]})}):(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsx)("div",{className:"text-center",children:(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"Click the Chunks tab to load chunks"})})})})]})]}):null]})}),(0,ep.jsx)(mv,{open:!!W,onOpenChange:e=>!e&&Y(null),children:(0,ep.jsxs)(mD,{children:[(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mR,{children:"Delete Document"}),(0,ep.jsxs)(mB,{children:["Are you sure you want to delete document"," ",(0,ep.jsxs)("span",{className:"font-mono font-semibold",children:['"',W?.id,'"']}),"?",(0,ep.jsx)("br",{}),(0,ep.jsx)("br",{}),"This will also delete"," ",W?.memoryCount!==void 0?(0,ep.jsxs)("span",{className:"font-semibold",children:[W.memoryCount," memory units"]}):"all memory units"," ","extracted from this document.",(0,ep.jsx)("br",{}),(0,ep.jsx)("br",{}),(0,ep.jsx)("span",{className:"text-destructive font-semibold",children:"This action cannot be undone."})]})]}),(0,ep.jsxs)(mI,{children:[(0,ep.jsx)(mF,{children:"Cancel"}),(0,ep.jsx)(mz,{onClick:J,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),(0,ep.jsx)(mv,{open:!!G,onOpenChange:e=>!e&&$(null),children:(0,ep.jsxs)(mD,{children:[(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mR,{children:G?.success?"Document Deleted":"Error"}),(0,ep.jsx)(mB,{children:G?.message})]}),(0,ep.jsx)(mI,{children:(0,ep.jsx)(mz,{onClick:()=>$(null),children:"OK"})})]})}),(0,ep.jsx)(mv,{open:!!U,onOpenChange:e=>!e&&H(null),children:(0,ep.jsxs)(mD,{children:[(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mR,{children:U?.success?"Reprocessing Started":"Error"}),(0,ep.jsx)(mB,{children:U?.message})]}),(0,ep.jsx)(mI,{children:(0,ep.jsx)(mz,{onClick:()=>H(null),children:"OK"})})]})})]})}function m1(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(!1),[a,o]=(0,em.useState)(null),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)("relations"),[d,h]=(0,em.useState)(null),[f,p]=(0,em.useState)(!1),[g,v]=(0,em.useState)(1),[x,y]=(0,em.useState)(0),b=Math.ceil(x/50),w=(g-1)*50,j=async(t=1)=>{if(e){i(!0);try{let r=await eD.client.listEntities({bank_id:e,limit:50,offset:(t-1)*50});n(r.items||[]),y(r.total||0)}catch(e){}finally{i(!1)}}},N=async t=>{if(e){l(!0);try{let n=await eD.client.getEntity(t,e);o(n)}catch(e){}finally{l(!1)}}},k=e=>{v(e),j(e)},E=(0,em.useCallback)(async()=>{if(e){p(!0);try{let t=await eD.client.getEntityGraph({bank_id:e,limit:2e3,min_count:1});h(t)}catch(e){}finally{p(!1)}}},[e]);(0,em.useEffect)(()=>{e&&(v(1),j(1),o(null),h(null))},[e]),(0,em.useEffect)(()=>{"relations"!==c||!e||d||f||E()},[c,e,d,f,E]);let C=(0,em.useMemo)(()=>d?hX(d):{nodes:[],links:[]},[d]),_=(0,em.useMemo)(()=>{let e=new Map;for(let t of C.links){let n="number"==typeof t.weight&&t.weight>0?t.weight:1;e.set(t.source,(e.get(t.source)||0)+n),e.set(t.target,(e.get(t.target)||0)+n)}return e},[C]),S=(0,em.useMemo)(()=>{let e=1;for(let t of _.values())t>e&&(e=t);return e},[_]),T=(0,em.useCallback)(e=>3+11*Math.sqrt((_.get(e.id)||0)/S),[_,S]),A=(0,em.useMemo)(()=>{let e=d?.edges||[];if(!e.length)return null;let t=new Map,n=1/0,r=-1/0;for(let i of e){let e=i.data.lastCooccurred;if(!e)continue;let a=Date.parse(e);if(!Number.isNaN(a)){for(let e of[i.data.source,i.data.target]){let n=t.get(e);(void 0===n||a>n)&&t.set(e,a)}a<n&&(n=a),a>r&&(r=a)}}return Number.isFinite(n)&&Number.isFinite(r)&&r!==n?{times:t,minT:n,maxT:r}:null},[d]),O=(0,em.useCallback)(e=>{if(!A)return .5;let t=A.times.get(e.id);return void 0===t?0:(t-A.minT)/(A.maxT-A.minT)},[A]),M=(0,em.useCallback)(e=>{N(e.id)},[e]),P=e=>e?new Date(e).toLocaleDateString():"N/A";return(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"mb-4 flex items-center justify-end",children:(0,ep.jsxs)("div",{className:"flex items-center gap-2 bg-muted rounded-lg p-1",children:[(0,ep.jsxs)("button",{onClick:()=>u("relations"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"relations"===c?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(fB,{className:"w-4 h-4"}),"Relations"]}),(0,ep.jsxs)("button",{onClick:()=>u("list"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"list"===c?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(eX,{className:"w-4 h-4"}),"List"]})]})}),"relations"===c&&(0,ep.jsx)("div",{className:"border border-border rounded-lg overflow-hidden",children:f?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"..."}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading entity graph..."})]})}):C.nodes.length>0?(0,ep.jsx)(fI,{data:C,height:700,onNodeClick:M,nodeSizeFn:T,nodeHeatFn:A?O:void 0,heatLegendLabel:A?"recency · last co-occurrence":void 0,heatLegendEndpoints:A?[new Date(A.minT).toISOString().slice(0,10),new Date(A.maxT).toISOString().slice(0,10)]:void 0,sizeLegendLabel:"co-occurrences",compactLabels:!0}):(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"No entity co-occurrences yet"}),(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:"Two entities co-occur when they appear in the same memory."})]})})}),"list"===c&&(0,ep.jsx)("div",{children:r?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"..."}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading entities..."})]})}):t.length>0?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"mb-4 text-sm text-muted-foreground",children:[x," ",1===x?"entity":"entities"]}),(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{children:"Name"}),(0,ep.jsx)(eJ,{children:"Mentions"}),(0,ep.jsx)(eJ,{children:"First Seen"}),(0,ep.jsx)(eJ,{children:"Last Seen"})]})}),(0,ep.jsx)(eZ,{children:t.map(e=>(0,ep.jsxs)(eQ,{onClick:()=>N(e.id),className:`cursor-pointer hover:bg-muted/50 ${a?.id===e.id?"bg-primary/10":""}`,children:[(0,ep.jsx)(e0,{className:"font-medium text-card-foreground",children:e.canonical_name}),(0,ep.jsx)(e0,{className:"text-card-foreground",children:e.mention_count}),(0,ep.jsx)(e0,{className:"text-card-foreground",children:P(e.first_seen)}),(0,ep.jsx)(e0,{className:"text-card-foreground",children:P(e.last_seen)})]},e.id))})]})}),b>1&&(0,ep.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t",children:[(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground",children:[w+1,"-",Math.min(w+50,x)," of ",x]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>k(1),disabled:1===g||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eF,{className:"h-3 w-3"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>k(g-1),disabled:1===g||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eS,{className:"h-3 w-3"})}),(0,ep.jsxs)("span",{className:"text-xs px-2",children:[g," / ",b]}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>k(g+1),disabled:g===b||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eT.ChevronRight,{className:"h-3 w-3"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>k(b),disabled:g===b||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eV,{className:"h-3 w-3"})})]})]})]}):(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"..."}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"No entities found"}),(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:"Entities are extracted from facts when memories are added."})]})})}),a&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l-2 border-primary shadow-2xl z-50 overflow-y-auto animate-in slide-in-from-right duration-300 ease-out",children:(0,ep.jsxs)("div",{className:"p-5",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-center mb-6 pb-4 border-b border-border",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-xl font-bold text-card-foreground",children:a.canonical_name}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Entity details"})]}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",onClick:()=>o(null),className:"h-8 w-8 p-0",children:(0,ep.jsx)("span",{className:"text-lg",children:"x"})})]}),(0,ep.jsxs)("div",{className:"space-y-5",children:[(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Mentions"}),(0,ep.jsx)("div",{className:"text-lg font-semibold text-card-foreground",children:a.mention_count})]}),(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"First Seen"}),(0,ep.jsx)("div",{className:"text-sm font-medium text-card-foreground",children:P(a.first_seen)})]})]}),(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Entity ID"}),(0,ep.jsx)("code",{className:"text-xs font-mono break-all text-muted-foreground",children:a.id})]})]})]})})]})}var m2=e.i(32089);let m5=["world","experience","observation"],m3={world:{label:"World",active:"bg-violet-500/15 text-violet-700 border-violet-400 dark:text-violet-300 dark:border-violet-500",inactive:"border-border text-muted-foreground hover:border-violet-300 hover:text-violet-600 dark:hover:text-violet-400",dot:"bg-violet-500"},experience:{label:"Experience",active:"bg-pink-500/15 text-pink-700 border-pink-400 dark:text-pink-300 dark:border-pink-500",inactive:"border-border text-muted-foreground hover:border-pink-300 hover:text-pink-600 dark:hover:text-pink-400",dot:"bg-pink-500"},observation:{label:"Observation",active:"bg-indigo-500/15 text-indigo-700 border-indigo-400 dark:text-indigo-300 dark:border-indigo-500",inactive:"border-border text-muted-foreground hover:border-indigo-300 hover:text-indigo-600 dark:hover:text-indigo-400",dot:"bg-indigo-500"}};function m4({ft:e,active:t,onToggle:n}){let r=m3[e];return(0,ep.jsxs)("button",{type:"button",onClick:n,className:(0,eO.cn)("inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-all",t?r.active:r.inactive),children:[(0,ep.jsx)("span",{className:(0,eO.cn)("h-1.5 w-1.5 rounded-full",t?r.dot:"bg-muted-foreground/50")}),r.label]})}function m6({value:e,onChange:t,label:n="Fact types:"}){return(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[n&&(0,ep.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:n}),(0,ep.jsx)("div",{className:"flex gap-1.5",children:m5.map(n=>(0,ep.jsx)(m4,{ft:n,active:e.includes(n),onToggle:()=>t(e.includes(n)?e.filter(e=>e!==n):[...e,n])},n))})]})}function m8({value:e,onChange:t}){return(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:m5.map(n=>(0,ep.jsx)(m4,{ft:n,active:e.includes(n),onToggle:()=>t(e.includes(n)?e.filter(e=>e!==n):[...e,n])},n))})}let m7=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("rounded-xl bg-card text-card-foreground ring-1 ring-border/60 shadow-[0_1px_2px_rgba(0,0,0,0.04),0_2px_8px_-2px_rgba(0,0,0,0.06)] dark:ring-border/40 dark:shadow-[0_1px_2px_rgba(0,0,0,0.4),0_4px_16px_-4px_rgba(0,0,0,0.5)]",e),...t}));m7.displayName="Card";let m9=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("flex flex-col space-y-1.5 p-6",e),...t}));m9.displayName="CardHeader";let ge=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("text-2xl font-semibold leading-none tracking-tight",e),...t}));ge.displayName="CardTitle";let gt=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("text-sm text-muted-foreground",e),...t}));gt.displayName="CardDescription";let gn=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("p-6 pt-0",e),...t}));gn.displayName="CardContent",em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("flex items-center p-6 pt-0",e),...t})).displayName="CardFooter";var gr=e.i(52571);let gi=(0,eN.default)("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),ga=(0,eN.default)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]),go=(0,eN.default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),gs=(0,eN.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);var gl=e.i(1864);"function"==typeof SuppressedError&&SuppressedError;var gc=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach(function(t){e.addRange(t)}),t&&t.focus()}},gu={"text/plain":"Text","text/html":"Url",default:"Text"},gd=function(e,t){var n,r,i,a,o,s,l,c,u=!1;t||(t={}),i=t.debug||!1;try{if(o=gc(),s=document.createRange(),l=document.getSelection(),(c=document.createElement("span")).textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),void 0===n.clipboardData){i&&console.warn("unable to use e.clipboardData"),i&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var r=gu[t.format]||gu.default;window.clipboardData.setData(r,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))}),document.body.appendChild(c),s.selectNodeContents(c),l.addRange(s),!document.execCommand("copy"))throw Error("copy command was unsuccessful");u=!0}catch(o){i&&console.error("unable to copy using execCommand: ",o),i&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),u=!0}catch(o){i&&console.error("unable to copy using clipboardData: ",o),i&&console.error("falling back to prompt"),n="message"in t?t.message:"Copy to clipboard: #{key}, Enter",r=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C",a=n.replace(/#{\s*key\s*}/g,r),window.prompt(a,e)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(s):l.removeAllRanges()),c&&document.body.removeChild(c),o()}return u};function gh(e){return"[object Object]"===Object.prototype.toString.call(e)}function gf(e){return Array.isArray(e)?e.length:gh(e)?Object.keys(e).length:0}function gp(e,t,n,r,i,a){if(a&&void 0!==a.collapsed)return!!a.collapsed;if("boolean"==typeof r)return r;if("number"==typeof r&&t>r)return!0;let o=gf(e);if("function"==typeof r){let i=gv(r,[{node:e,depth:t,indexOrName:n,size:o}]);if("boolean"==typeof i)return i}return!!(Array.isArray(e)&&o>i||gh(e)&&o>i)}function gm(e,t,n,r,i,a){if(a&&void 0!==a.collapsed)return!!a.collapsed;if("boolean"==typeof r)return r;if("number"==typeof r&&t>r)return!0;let o=Math.ceil(e.length/100);if("function"==typeof r){let i=gv(r,[{node:e,depth:t,indexOrName:n,size:o}]);if("boolean"==typeof i)return i}return!!(Array.isArray(e)&&o>i||gh(e)&&o>i)}function gg(e,t,n){return"boolean"==typeof e?e:"number"==typeof e&&!!(t>e)||"collapsed"===e&&!!n||"expanded"===e&&!n}function gv(e,t){try{return e(...t)}catch(e){reportError(e)}}function gx(e){if(!0===e||gh(e)&&!0===e.add)return!0}function gy(e){if(!0===e||gh(e)&&!0===e.edit)return!0}function gb(e){if(!0===e||gh(e)&&!0===e.delete)return!0}function gw(e){return!e||void 0===e.add||!!e.add}function gj(e){return!e||void 0===e.edit||!!e.edit}function gN(e){return!e||void 0===e.delete||!!e.delete}function gk(e){return!e||void 0===e.enableClipboard||!!e.enableClipboard}function gE(){return(gE=Object.assign.bind()).apply(this,arguments)}var gC=function(e){return em.createElement("svg",gE({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),w||(w=em.createElement("path",{fill:"currentColor",d:"M12.473 5.806a.666.666 0 0 0-.946 0L8.473 8.86a.667.667 0 0 1-.946 0L4.473 5.806a.667.667 0 1 0-.946.94l3.06 3.06a2 2 0 0 0 2.826 0l3.06-3.06a.667.667 0 0 0 0-.94Z"})))};function g_(){return(g_=Object.assign.bind()).apply(this,arguments)}var gS=function(e){return em.createElement("svg",g_({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),j||(j=em.createElement("path",{fill:"currentColor",d:"M17.542 2.5h-4.75a3.963 3.963 0 0 0-3.959 3.958v4.75a3.963 3.963 0 0 0 3.959 3.959h4.75a3.963 3.963 0 0 0 3.958-3.959v-4.75A3.963 3.963 0 0 0 17.542 2.5Zm2.375 8.708a2.378 2.378 0 0 1-2.375 2.375h-4.75a2.378 2.378 0 0 1-2.375-2.375v-4.75a2.378 2.378 0 0 1 2.375-2.375h4.75a2.378 2.378 0 0 1 2.375 2.375v4.75Zm-4.75 6.334a3.963 3.963 0 0 1-3.959 3.958h-4.75A3.963 3.963 0 0 1 2.5 17.542v-4.75a3.963 3.963 0 0 1 3.958-3.959.791.791 0 1 1 0 1.584 2.378 2.378 0 0 0-2.375 2.375v4.75a2.378 2.378 0 0 0 2.375 2.375h4.75a2.378 2.378 0 0 0 2.375-2.375.792.792 0 1 1 1.584 0Z"})))};function gT(){return(gT=Object.assign.bind()).apply(this,arguments)}var gA=function(e){return em.createElement("svg",gT({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),N||(N=em.createElement("path",{fill:"currentColor",d:"M17.25 3H6.75A3.755 3.755 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.755 3.755 0 0 0 17.25 3Zm2.25 14.25a2.25 2.25 0 0 1-2.25 2.25H6.75a2.25 2.25 0 0 1-2.25-2.25V6.75A2.25 2.25 0 0 1 6.75 4.5h10.5a2.25 2.25 0 0 1 2.25 2.25v10.5Z"})),k||(k=em.createElement("path",{fill:"#14C786",d:"M10.312 14.45 7.83 11.906a.625.625 0 0 0-.896 0 .659.659 0 0 0 0 .918l2.481 2.546a1.264 1.264 0 0 0 .896.381 1.237 1.237 0 0 0 .895-.38l5.858-6.011a.658.658 0 0 0 0-.919.625.625 0 0 0-.896 0l-5.857 6.01Z"})))};function gO({node:e,nodeMeta:t}){let{customizeCopy:n,CopyComponent:r,CopiedComponent:i}=(0,em.useContext)(gZ),[a,o]=(0,em.useState)(!1),s=r=>{r.stopPropagation();let i=n(e,t);"string"==typeof i&&i&&function(e){var t,n,r,i;t=this,n=void 0,r=void 0,i=function*(){try{yield navigator.clipboard.writeText(e)}catch(t){gd(e)}},new(r||(r=Promise))(function(e,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(t){var n;t.done?e(t.value):((n=t.value)instanceof r?n:new r(function(e){e(n)})).then(o,s)}l((i=i.apply(t,n||[])).next())})}(i),o(!0),setTimeout(()=>o(!1),3e3)};return a?"function"==typeof i?(0,ep.jsx)(i,{className:"json-view--copy",style:{display:"inline-block"}}):(0,ep.jsx)(gA,{className:"json-view--copy",style:{display:"inline-block"}}):"function"==typeof r?(0,ep.jsx)(r,{onClick:s,className:"json-view--copy"}):(0,ep.jsx)(gS,{onClick:s,className:"json-view--copy"})}function gM({indexOrName:e,value:t,depth:n,deleteHandle:r,editHandle:i,parent:a,parentPath:o}){let{displayArrayIndex:s}=(0,em.useContext)(gZ),l=Array.isArray(a);return(0,ep.jsxs)("div",Object.assign({className:"json-view--pair"},{children:[!l||l&&s?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("span",Object.assign({className:"number"==typeof e?"json-view--index":"json-view--property"},{children:e})),":"," "]}):(0,ep.jsx)(ep.Fragment,{}),(0,ep.jsx)(gq,{node:t,depth:n+1,deleteHandle:(e,t)=>r(e,t),editHandle:(e,t,n,r)=>i(e,t,n,r),parent:a,indexOrName:e,parentPath:o})]}))}function gP(){return(gP=Object.assign.bind()).apply(this,arguments)}var gD=function(e){return em.createElement("svg",gP({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),E||(E=em.createElement("path",{fill:"currentColor",d:"M18.75 6h-2.325a3.757 3.757 0 0 0-3.675-3h-1.5a3.757 3.757 0 0 0-3.675 3H5.25a.75.75 0 0 0 0 1.5H6v9.75A3.754 3.754 0 0 0 9.75 21h4.5A3.754 3.754 0 0 0 18 17.25V7.5h.75a.75.75 0 1 0 0-1.5Zm-7.5-1.5h1.5A2.255 2.255 0 0 1 14.872 6H9.128a2.255 2.255 0 0 1 2.122-1.5Zm5.25 12.75a2.25 2.25 0 0 1-2.25 2.25h-4.5a2.25 2.25 0 0 1-2.25-2.25V7.5h9v9.75Z"})),C||(C=em.createElement("path",{fill:"#DA0000",d:"M10.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75ZM13.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75Z"})))};function gL(){return(gL=Object.assign.bind()).apply(this,arguments)}var gI=function(e){return em.createElement("svg",gL({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),_||(_=em.createElement("path",{fill:"currentColor",d:"M21 6.75v10.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3h10.5A3.754 3.754 0 0 1 21 6.75Zm-1.5 0c0-1.24-1.01-2.25-2.25-2.25H6.75C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25V6.75Z"})),S||(S=em.createElement("path",{fill:"#14C786",d:"M15 12.75a.75.75 0 1 0 0-1.5h-2.25V9a.75.75 0 1 0-1.5 0v2.25H9a.75.75 0 1 0 0 1.5h2.25V15a.75.75 0 1 0 1.5 0v-2.25H15Z"})))};function gR(){return(gR=Object.assign.bind()).apply(this,arguments)}var gB=function(e){return em.createElement("svg",gR({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),T||(T=em.createElement("path",{fill:"currentColor",d:"M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"})),A||(A=em.createElement("path",{fill:"#14C786",d:"m10.85 13.96-1.986-2.036a.5.5 0 0 0-.716 0 .527.527 0 0 0 0 .735l1.985 2.036a1.01 1.01 0 0 0 .717.305.99.99 0 0 0 .716-.305l4.686-4.808a.526.526 0 0 0 0-.735.5.5 0 0 0-.716 0l-4.687 4.809Z"})))};function gz(){return(gz=Object.assign.bind()).apply(this,arguments)}var gF=function(e){return em.createElement("svg",gz({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),O||(O=em.createElement("path",{fill:"#DA0000",d:"M15 9a.75.75 0 0 0-1.06 0L12 10.94 10.06 9A.75.75 0 0 0 9 10.06L10.94 12 9 13.94A.75.75 0 0 0 10.06 15L12 13.06 13.94 15A.75.75 0 0 0 15 13.94L13.06 12 15 10.06A.75.75 0 0 0 15 9Z"})),M||(M=em.createElement("path",{fill:"currentColor",d:"M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"})))};function gV({originNode:e,node:t,depth:n,index:r,deleteHandle:i,customOptions:a,startIndex:o,parent:s,parentPath:l}){let{enableClipboard:c,src:u,onEdit:d,onChange:h,forceUpdate:f,displaySize:p,CustomOperation:g}=(0,em.useContext)(gZ),v=[...l,String(r)],[x,y]=(0,em.useState)(!0),b=(0,em.useCallback)((t,r,i)=>{e[t]=r,d&&d({newValue:r,oldValue:i,depth:n,src:u,indexOrName:t,parentType:"array",parentPath:l}),h&&h({type:"edit",depth:n,src:u,indexOrName:t,parentType:"array",parentPath:l}),f()},[t,d,h,f]),w=t=>{e.splice(t,1),i&&i(t,l),f()},j=(0,ep.jsxs)(ep.Fragment,{children:[!x&&(0,ep.jsxs)("span",Object.assign({onClick:()=>y(!0),className:"jv-size-chevron"},{children:[gg(p,n,x)&&(0,ep.jsxs)("span",Object.assign({className:"jv-size"},{children:[gf(t)," Items"]})),(0,ep.jsx)(gC,{className:"jv-chevron"})]})),!x&&c&&gk(a)&&(0,ep.jsx)(gO,{node:t,nodeMeta:{depth:n,indexOrName:r,parent:s,parentPath:l,currentPath:v}}),"function"==typeof g?(0,ep.jsx)(g,{node:t}):null]});return(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{children:"["}),j,x?(0,ep.jsxs)("button",Object.assign({onClick:()=>y(!1),className:"jv-button"},{children:[o," ... ",o+t.length-1]})):(0,ep.jsx)("div",Object.assign({className:"jv-indent"},{children:t.map((e,i)=>(0,ep.jsx)(gM,{indexOrName:i+o,value:e,depth:n,parent:t,deleteHandle:w,editHandle:b,parentPath:l},String(r)+String(i)))})),(0,ep.jsx)("span",{children:"]"})]})}function gU({node:e,depth:t,deleteHandle:n,indexOrName:r,customOptions:i,parent:a,parentPath:o}){let s=void 0!==r?[...o,String(r)]:o,l=[];for(let t=0;t<e.length;t+=100)l.push(e.slice(t,t+100));let{collapsed:c,enableClipboard:u,collapseObjectsAfterLength:d,editable:h,onDelete:f,src:p,onAdd:g,CustomOperation:v,onChange:x,forceUpdate:y,displaySize:b}=(0,em.useContext)(gZ),[w,j]=(0,em.useState)(gm(e,t,r,c,d,i));(0,em.useEffect)(()=>{j(gm(e,t,r,c,d,i))},[c,d]);let[N,k]=(0,em.useState)(!1),[E,C]=(0,em.useState)(!1),_=()=>{e.push(null),g&&g({indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:o}),x&&x({type:"add",indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:o}),y()},S=N||E,T=(0,ep.jsxs)(ep.Fragment,{children:[!w&&!S&&(0,ep.jsxs)("span",Object.assign({onClick:()=>j(!0),className:"jv-size-chevron"},{children:[gg(b,t,w)&&(0,ep.jsxs)("span",Object.assign({className:"jv-size"},{children:[e.length," Items"]})),(0,ep.jsx)(gC,{className:"jv-chevron"})]})),S&&(0,ep.jsx)(gB,{className:"json-view--edit",style:{display:"inline-block"},onClick:E?_:()=>{k(!1),n&&n(r,o),f&&f({value:e,depth:t,src:p,indexOrName:r,parentType:"array",parentPath:o}),x&&x({type:"delete",depth:t,src:p,indexOrName:r,parentType:"array",parentPath:o})}}),S&&(0,ep.jsx)(gF,{className:"json-view--edit",style:{display:"inline-block"},onClick:()=>{k(!1),C(!1)}}),!w&&!S&&u&&gk(i)&&(0,ep.jsx)(gO,{node:e,nodeMeta:{depth:t,indexOrName:r,parent:a,parentPath:o,currentPath:s}}),!w&&!S&&gx(h)&&gw(i)&&(0,ep.jsx)(gI,{className:"json-view--edit",onClick:()=>{_()}}),!w&&!S&&gb(h)&&gN(i)&&n&&(0,ep.jsx)(gD,{className:"json-view--edit",onClick:()=>k(!0)}),"function"==typeof v?(0,ep.jsx)(v,{node:e}):null]});return(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("span",{children:"["}),T,w?(0,ep.jsx)("button",Object.assign({onClick:()=>j(!1),className:"jv-button"},{children:"..."})):(0,ep.jsx)("div",Object.assign({className:"jv-indent"},{children:l.map((a,s)=>(0,ep.jsx)(gV,{originNode:e,node:a,depth:t,index:s,startIndex:100*s,deleteHandle:n,customOptions:i,parentPath:o},String(r)+String(s)))})),(0,ep.jsx)("span",{children:"]"}),w&&gg(b,t,w)&&(0,ep.jsxs)("span",Object.assign({onClick:()=>j(!1),className:"jv-size"},{children:[e.length," Items"]}))]})}function gH({node:e,depth:t,indexOrName:n,deleteHandle:r,customOptions:i,parent:a,parentPath:o}){let{collapsed:s,onCollapse:l,enableClipboard:c,ignoreLargeArray:u,collapseObjectsAfterLength:d,editable:h,onDelete:f,src:p,onAdd:g,onEdit:v,onChange:x,forceUpdate:y,displaySize:b,CustomOperation:w}=(0,em.useContext)(gZ),j=void 0!==n?[...o,String(n)]:o;if(!u&&Array.isArray(e)&&e.length>100)return(0,ep.jsx)(gU,{node:e,depth:t,indexOrName:n,deleteHandle:r,customOptions:i,parentPath:j});let N=gh(e),[k,E]=(0,em.useState)(gp(e,t,n,s,d,i)),C=r=>{null==l||l({isCollapsing:!r,node:e,depth:t,indexOrName:n}),E(r)};(0,em.useEffect)(()=>{C(gp(e,t,n,s,d,i))},[s,d]);let _=(0,em.useCallback)((n,r,i)=>{Array.isArray(e)?e[+n]=r:e&&(e[n]=r),v&&v({newValue:r,oldValue:i,depth:t,src:p,indexOrName:n,parentType:N?"object":"array",parentPath:j}),x&&x({type:"edit",depth:t,src:p,indexOrName:n,parentType:N?"object":"array",parentPath:j}),y()},[e,v,x,y]),S=t=>{Array.isArray(e)?e.splice(+t,1):e&&delete e[t],y()},[T,A]=(0,em.useState)(!1),[O,M]=(0,em.useState)(!1),P=(0,em.useRef)(null),D=()=>{var n;if(N){let r=null==(n=P.current)?void 0:n.value;r&&(e[r]=null,P.current&&(P.current.value=""),M(!1),g&&g({indexOrName:r,depth:t,src:p,parentType:"object",parentPath:j}),x&&x({type:"add",indexOrName:r,depth:t,src:p,parentType:"object",parentPath:j}))}else Array.isArray(e)&&(e.push(null),g&&g({indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:j}),x&&x({type:"add",indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:j}));y()},L=T||O,I=()=>{A(!1),M(!1)},R=(0,ep.jsxs)(ep.Fragment,{children:[!k&&!L&&(0,ep.jsxs)("span",Object.assign({onClick:()=>C(!0),className:"jv-size-chevron"},{children:[gg(b,t,k)&&(0,ep.jsxs)("span",Object.assign({className:"jv-size"},{children:[gf(e)," Items"]})),(0,ep.jsx)(gC,{className:"jv-chevron"})]})),O&&N&&(0,ep.jsx)("input",{className:"json-view--input",placeholder:"property",ref:P,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),D()):"Escape"===e.key&&I()}}),L&&(0,ep.jsx)(gB,{className:"json-view--edit",style:{display:"inline-block"},onClick:O?D:()=>{A(!1),r&&r(n,j),f&&f({value:e,depth:t,src:p,indexOrName:n,parentType:N?"object":"array",parentPath:j}),x&&x({type:"delete",depth:t,src:p,indexOrName:n,parentType:N?"object":"array",parentPath:j})}}),L&&(0,ep.jsx)(gF,{className:"json-view--edit",style:{display:"inline-block"},onClick:I}),!k&&!L&&c&&gk(i)&&(0,ep.jsx)(gO,{node:e,nodeMeta:{depth:t,indexOrName:n,parent:a,parentPath:o,currentPath:j}}),!k&&!L&&gx(h)&&gw(i)&&(0,ep.jsx)(gI,{className:"json-view--edit",onClick:()=>{N?(M(!0),setTimeout(()=>{var e;return null==(e=P.current)?void 0:e.focus()})):D()}}),!k&&!L&&gb(h)&&gN(i)&&r&&(0,ep.jsx)(gD,{className:"json-view--edit",onClick:()=>A(!0)}),"function"==typeof w?(0,ep.jsx)(w,{node:e}):null]});return Array.isArray(e)?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("span",{children:"["}),R,k?(0,ep.jsx)("button",Object.assign({onClick:()=>C(!1),className:"jv-button"},{children:"..."})):(0,ep.jsx)("div",Object.assign({className:"jv-indent"},{children:e.map((r,i)=>(0,ep.jsx)(gM,{indexOrName:i,value:r,depth:t,parent:e,deleteHandle:S,editHandle:_,parentPath:j},String(n)+String(i)))})),(0,ep.jsx)("span",{children:"]"}),k&&gg(b,t,k)&&(0,ep.jsxs)("span",Object.assign({onClick:()=>C(!1),className:"jv-size"},{children:[gf(e)," Items"]}))]}):N?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("span",{children:"{"}),R,k?(0,ep.jsx)("button",Object.assign({onClick:()=>C(!1),className:"jv-button"},{children:"..."})):(0,ep.jsx)("div",Object.assign({className:"jv-indent"},{children:Object.entries(e).map(([r,i])=>(0,ep.jsx)(gM,{indexOrName:r,value:i,depth:t,parent:e,deleteHandle:S,editHandle:_,parentPath:j},String(n)+String(r)))})),(0,ep.jsx)("span",{children:"}"}),k&&gg(b,t,k)&&(0,ep.jsxs)("span",Object.assign({onClick:()=>C(!1),className:"jv-size"},{children:[gf(e)," Items"]}))]}):(0,ep.jsx)("span",{children:String(e)})}let gW=em.default.forwardRef(({str:e,className:t,ctrlClick:n},r)=>{let{collapseStringMode:i,collapseStringsAfterLength:a,customizeCollapseStringUI:o}=(0,em.useContext)(gZ),[s,l]=(0,em.useState)(!0),c=(0,em.useRef)(null);a=a>0?a:0;let u=e.replace(/\s+/g," "),d="function"==typeof o?o(u,s):"string"==typeof o?o:"...",h=e=>{var t;if((e.ctrlKey||e.metaKey)&&n)n(e);else{let e=window.getSelection();if(e&&e.anchorOffset!==e.focusOffset&&(null==(t=e.anchorNode)?void 0:t.parentElement)===c.current)return;l(!s)}};if(e.length<=a)return(0,ep.jsxs)("span",Object.assign({ref:c,className:t,onClick:n},{children:['"',e,'"']}));if("address"===i)return e.length<=10?(0,ep.jsxs)("span",Object.assign({ref:c,className:t,onClick:n},{children:['"',e,'"']})):(0,ep.jsxs)("span",Object.assign({ref:c,onClick:h,className:t+" cursor-pointer"},{children:['"',s?[u.slice(0,6),d,u.slice(-4)]:e,'"']}));if("directly"===i)return(0,ep.jsxs)("span",Object.assign({ref:c,onClick:h,className:t+" cursor-pointer"},{children:['"',s?[u.slice(0,a),d]:e,'"']}));if("word"===i){let n=a,r=a+1,i=u,o=1;for(;;){if(/\W/.test(e[n])){i=e.slice(0,n);break}if(/\W/.test(e[r])){i=e.slice(0,r);break}if(6===o){i=e.slice(0,a);break}o++,n--,r++}return(0,ep.jsxs)("span",Object.assign({ref:c,onClick:h,className:t+" cursor-pointer"},{children:['"',s?[i,d]:e,'"']}))}return(0,ep.jsxs)("span",Object.assign({ref:c,className:t},{children:['"',e,'"']}))});function gY(){return(gY=Object.assign.bind()).apply(this,arguments)}var gG=function(e){return em.createElement("svg",gY({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),P||(P=em.createElement("path",{fill:"currentColor",d:"M17.25 3H6.75A3.754 3.754 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.754 3.754 0 0 0 17.25 3Zm2.25 14.25c0 1.24-1.01 2.25-2.25 2.25H6.75c-1.24 0-2.25-1.01-2.25-2.25V6.75c0-1.24 1.01-2.25 2.25-2.25h10.5c1.24 0 2.25 1.01 2.25 2.25v10.5Zm-6.09-9.466-5.031 5.03a2.981 2.981 0 0 0-.879 2.121v1.19c0 .415.336.75.75.75h1.19c.8 0 1.554-.312 2.12-.879l5.03-5.03a2.252 2.252 0 0 0 0-3.182c-.85-.85-2.331-.85-3.18 0Zm-2.91 7.151c-.28.28-.666.44-1.06.44H9v-.44c0-.4.156-.777.44-1.06l3.187-3.188 1.06 1.061-3.187 3.188Zm5.03-5.03-.782.783-1.06-1.061.782-.782a.766.766 0 0 1 1.06 0 .75.75 0 0 1 0 1.06Z"})))};function g$(){return(g$=Object.assign.bind()).apply(this,arguments)}var gX=function(e){return em.createElement("svg",g$({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),D||(D=em.createElement("path",{fill:"currentColor",d:"M6.75 3h5.5v1.5h-5.5C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25v-5.5H21v5.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3Z"})),L||(L=em.createElement("path",{fill:"currentColor",d:"M20.013 3h-3.946a.987.987 0 0 0 0 1.973h1.564l-6.342 6.342a1.004 1.004 0 0 0 0 1.396 1.004 1.004 0 0 0 1.396 0l6.342-6.342v1.564a.987.987 0 0 0 1.973 0V3.987A.987.987 0 0 0 20.013 3Z"})))};function gq({node:e,depth:t,deleteHandle:n,indexOrName:r,parent:i,editHandle:a,parentPath:o}){let s,{collapseStringsAfterLength:l,enableClipboard:c,editable:u,src:d,onDelete:h,onChange:f,customizeNode:p,matchesURL:g,urlRegExp:v,EditComponent:x,DoneComponent:y,CancelComponent:b,CustomOperation:w}=(0,em.useContext)(gZ);if("function"==typeof p&&(s=gv(p,[{node:e,depth:t,indexOrName:r}])),s){if((0,em.isValidElement)(s))return s;else if("function"==typeof s){let n=s;return(0,ep.jsx)(n,{node:e,depth:t,indexOrName:r})}}if(Array.isArray(e)||gh(e))return(0,ep.jsx)(gH,{parent:i,node:e,depth:t,indexOrName:r,deleteHandle:n,parentPath:o,customOptions:"object"==typeof s?s:void 0});{var j;let p=typeof e,N=void 0!==r?[...o,String(r)]:o,[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(!1),S=(0,em.useRef)(null),T=()=>{E(!0),setTimeout(()=>{var e,t;null==(e=window.getSelection())||e.selectAllChildren(S.current),null==(t=S.current)||t.focus()})},A=(0,em.useCallback)(()=>{let t=S.current.innerText;try{let n=JSON.parse(t);a&&a(r,n,e,o)}catch(i){let n="string"===p?t.trim().replace(/^\"([\s\S]+?)\"$/,"$1"):t;a&&a(r,n,e,o)}E(!1)},[a,r,e,o,p]),O=()=>{E(!1),_(!1)},M=()=>{_(!1),n&&n(r,o),h&&h({value:e,depth:t,src:d,indexOrName:r,parentType:Array.isArray(i)?"array":"object",parentPath:o}),f&&f({depth:t,src:d,indexOrName:r,parentType:Array.isArray(i)?"array":"object",type:"delete",parentPath:o})},P=(0,em.useCallback)(e=>{"Enter"===e.key?(e.preventDefault(),A()):"Escape"===e.key&&O()},[A]),D=k||C,L=!D&&gy(u)&&gj(s)&&a?e=>{(e.ctrlKey||e.metaKey)&&T()}:void 0,I=(0,ep.jsxs)(ep.Fragment,{children:[D&&("function"==typeof y?(0,ep.jsx)(y,{className:"json-view--edit",style:{display:"inline-block"},onClick:C?M:A}):(0,ep.jsx)(gB,{className:"json-view--edit",style:{display:"inline-block"},onClick:C?M:A})),D&&("function"==typeof b?(0,ep.jsx)(b,{className:"json-view--edit",style:{display:"inline-block"},onClick:O}):(0,ep.jsx)(gF,{className:"json-view--edit",style:{display:"inline-block"},onClick:O})),!D&&c&&gk(s)&&(0,ep.jsx)(gO,{node:e,nodeMeta:{depth:t,indexOrName:r,parent:i,parentPath:o,currentPath:N}}),!D&&g&&"string"===p&&v.test(e)&&(!(j=s)||void 0===j.matchesURL||!!j.matchesURL)&&(0,ep.jsx)("a",Object.assign({href:e,target:"_blank",className:"json-view--link"},{children:(0,ep.jsx)(gX,{})})),!D&&gy(u)&&gj(s)&&a&&("function"==typeof x?(0,ep.jsx)(x,{className:"json-view--edit",onClick:T}):(0,ep.jsx)(gG,{className:"json-view--edit",onClick:T})),!D&&gb(u)&&gN(s)&&n&&(0,ep.jsx)(gD,{className:"json-view--edit",onClick:()=>_(!0)}),"function"==typeof w?(0,ep.jsx)(w,{node:e}):null]}),R="json-view--string";switch(p){case"number":case"bigint":R="json-view--number";break;case"boolean":R="json-view--boolean";break;case"object":R="json-view--null"}"string"==typeof(null==s?void 0:s.className)&&(R+=" "+s.className),C&&(R+=" json-view--deleting");let B=String(e);"bigint"===p&&(B+="n");let z=(0,em.useMemo)(()=>(0,ep.jsx)("span",{contentEditable:!0,className:R,dangerouslySetInnerHTML:{__html:"string"===p?`"${B}"`:B},ref:S,onKeyDown:P}),[B,p,P]);return"string"===p?(0,ep.jsxs)(ep.Fragment,{children:[k?z:e.length>l?(0,ep.jsx)(gW,{str:e,ref:S,className:R,ctrlClick:L}):(0,ep.jsxs)("span",Object.assign({className:R,onClick:L},{children:['"',B,'"']})),I]}):(0,ep.jsxs)(ep.Fragment,{children:[k?z:(0,ep.jsx)("span",Object.assign({className:R,onClick:L},{children:B})),I]})}}let gK=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,gZ=(0,em.createContext)({src:void 0,collapseStringsAfterLength:99,collapseStringMode:"directly",customizeCollapseStringUI:void 0,collapseObjectsAfterLength:20,collapsed:!1,onCollapse:void 0,enableClipboard:!0,editable:!1,onEdit:void 0,onDelete:void 0,onAdd:void 0,onChange:void 0,forceUpdate:()=>{},customizeNode:void 0,customizeCopy:()=>{},displaySize:void 0,displayArrayIndex:!0,matchesURL:!1,urlRegExp:gK,ignoreLargeArray:!1,CopyComponent:void 0,CopiedComponent:void 0,EditComponent:void 0,CancelComponent:void 0,DoneComponent:void 0,CustomOperation:void 0});function gQ({src:e,collapseStringsAfterLength:t=99,collapseStringMode:n="directly",customizeCollapseStringUI:r,collapseObjectsAfterLength:i=99,collapsed:a,onCollapse:o,enableClipboard:s=!0,editable:l=!1,onEdit:c,onDelete:u,onAdd:d,onChange:h,dark:f=!1,theme:p="default",customizeNode:g,customizeCopy:v=e=>(function(e){if("string"==typeof e)return e;try{return JSON.stringify(e,(e,t)=>{switch(typeof t){case"bigint":return String(t)+"n";case"number":case"boolean":case"object":case"string":return t;default:return String(t)}},void 0)}catch(e){return`${e.name}: ${e.message}`||"JSON.stringify failed"}})(e),displaySize:x,displayArrayIndex:y=!0,style:b,className:w,matchesURL:j=!1,urlRegExp:N=gK,ignoreLargeArray:k=!1,CopyComponent:E,CopiedComponent:C,EditComponent:_,CancelComponent:S,DoneComponent:T,CustomOperation:A}){let[O,M]=(0,em.useState)(0),P=(0,em.useCallback)(()=>M(e=>++e),[]),[D,L]=(0,em.useState)(e);return(0,em.useEffect)(()=>L(e),[e]),(0,ep.jsx)(gZ.Provider,Object.assign({value:{src:D,collapseStringsAfterLength:t,collapseStringMode:n,customizeCollapseStringUI:r,collapseObjectsAfterLength:i,collapsed:a,onCollapse:o,enableClipboard:s,editable:l,onEdit:c,onDelete:u,onAdd:d,onChange:h,forceUpdate:P,customizeNode:g,customizeCopy:v,displaySize:x,displayArrayIndex:y,matchesURL:j,urlRegExp:N,ignoreLargeArray:k,CopyComponent:E,CopiedComponent:C,EditComponent:_,CancelComponent:S,DoneComponent:T,CustomOperation:A}},{children:(0,ep.jsx)("code",Object.assign({className:"json-view"+(f?" dark":"")+(p&&"default"!==p?" json-view_"+p:"")+(w?" "+w:""),style:b},{children:(0,ep.jsx)(gq,{node:D,depth:1,editHandle:(e,t,n,r)=>{L(t),c&&c({newValue:t,oldValue:n,depth:1,src:D,indexOrName:e,parentType:null,parentPath:r}),h&&h({type:"edit",depth:1,src:D,indexOrName:e,parentType:null,parentPath:r})},deleteHandle:(e,t)=>{L(void 0),u&&u({value:D,depth:1,src:D,indexOrName:e,parentType:null,parentPath:t}),h&&h({depth:1,src:D,indexOrName:e,parentType:null,type:"delete",parentPath:t})},parentPath:[]})}))}))}var tH=tH;let gJ=(0,eN.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function g0(){}function g1(){}let g2=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,g5=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,g3={};function g4(e,t){return((t||g3).jsx?g5:g2).test(e)}let g6=/[ \t\n\f\r]/g;function g8(e){return""===e.replace(g6,"")}class g7{constructor(e,t){this.attribute=t,this.property=e}}g7.prototype.attribute="",g7.prototype.booleanish=!1,g7.prototype.boolean=!1,g7.prototype.commaOrSpaceSeparated=!1,g7.prototype.commaSeparated=!1,g7.prototype.defined=!1,g7.prototype.mustUseProperty=!1,g7.prototype.number=!1,g7.prototype.overloadedBoolean=!1,g7.prototype.property="",g7.prototype.spaceSeparated=!1,g7.prototype.space=void 0;let g9=0,ve=vs(),vt=vs(),vn=vs(),vr=vs(),vi=vs(),va=vs(),vo=vs();function vs(){return 2**++g9}e.s(["boolean",0,ve,"booleanish",0,vt,"commaOrSpaceSeparated",0,vo,"commaSeparated",0,va,"number",0,vr,"overloadedBoolean",0,vn,"spaceSeparated",0,vi],744);var vl=e.i(744);let vc=Object.keys(vl);class vu extends g7{constructor(e,t,n,r){let i=-1;if(super(e,t),function(e,t,n){n&&(e[t]=n)}(this,"space",r),"number"==typeof n)for(;++i<vc.length;){const e=vc[i];!function(e,t,n){n&&(e[t]=n)}(this,vc[i],(n&vl[e])===vl[e])}}}function vd(e){return e.toLowerCase()}vu.prototype.defined=!0;let vh=/[A-Z]/g,vf=/-[a-z]/g,vp=/^data[-\w.:]+$/i;function vm(e){return"-"+e.toLowerCase()}function vg(e){return e.charAt(1).toUpperCase()}let vv={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};class vx{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function vy(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new vx(n,r,t)}function vb(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new vu(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[vd(r)]=r,n[vd(a.attribute)]=r}return new vx(t,n,e.space)}vx.prototype.normal={},vx.prototype.property={},vx.prototype.space=void 0;let vw=vb({properties:{ariaActiveDescendant:null,ariaAtomic:vt,ariaAutoComplete:null,ariaBusy:vt,ariaChecked:vt,ariaColCount:vr,ariaColIndex:vr,ariaColSpan:vr,ariaControls:vi,ariaCurrent:null,ariaDescribedBy:vi,ariaDetails:null,ariaDisabled:vt,ariaDropEffect:vi,ariaErrorMessage:null,ariaExpanded:vt,ariaFlowTo:vi,ariaGrabbed:vt,ariaHasPopup:null,ariaHidden:vt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:vi,ariaLevel:vr,ariaLive:null,ariaModal:vt,ariaMultiLine:vt,ariaMultiSelectable:vt,ariaOrientation:null,ariaOwns:vi,ariaPlaceholder:null,ariaPosInSet:vr,ariaPressed:vt,ariaReadOnly:vt,ariaRelevant:null,ariaRequired:vt,ariaRoleDescription:vi,ariaRowCount:vr,ariaRowIndex:vr,ariaRowSpan:vr,ariaSelected:vt,ariaSetSize:vr,ariaSort:null,ariaValueMax:vr,ariaValueMin:vr,ariaValueNow:vr,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function vj(e,t){return t in e?e[t]:t}function vN(e,t){return vj(e,t.toLowerCase())}let vk=vb({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:va,acceptCharset:vi,accessKey:vi,action:null,allow:null,allowFullScreen:ve,allowPaymentRequest:ve,allowUserMedia:ve,alt:null,as:null,async:ve,autoCapitalize:null,autoComplete:vi,autoFocus:ve,autoPlay:ve,blocking:vi,capture:null,charSet:null,checked:ve,cite:null,className:vi,cols:vr,colSpan:null,content:null,contentEditable:vt,controls:ve,controlsList:vi,coords:vr|va,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ve,defer:ve,dir:null,dirName:null,disabled:ve,download:vn,draggable:vt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ve,formTarget:null,headers:vi,height:vr,hidden:vn,high:vr,href:null,hrefLang:null,htmlFor:vi,httpEquiv:vi,id:null,imageSizes:null,imageSrcSet:null,inert:ve,inputMode:null,integrity:null,is:null,isMap:ve,itemId:null,itemProp:vi,itemRef:vi,itemScope:ve,itemType:vi,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ve,low:vr,manifest:null,max:null,maxLength:vr,media:null,method:null,min:null,minLength:vr,multiple:ve,muted:ve,name:null,nonce:null,noModule:ve,noValidate:ve,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ve,optimum:vr,pattern:null,ping:vi,placeholder:null,playsInline:ve,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ve,referrerPolicy:null,rel:vi,required:ve,reversed:ve,rows:vr,rowSpan:vr,sandbox:vi,scope:null,scoped:ve,seamless:ve,selected:ve,shadowRootClonable:ve,shadowRootDelegatesFocus:ve,shadowRootMode:null,shape:null,size:vr,sizes:null,slot:null,span:vr,spellCheck:vt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:vr,step:null,style:null,tabIndex:vr,target:null,title:null,translate:null,type:null,typeMustMatch:ve,useMap:null,value:vt,width:vr,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:vi,axis:null,background:null,bgColor:null,border:vr,borderColor:null,bottomMargin:vr,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ve,declare:ve,event:null,face:null,frame:null,frameBorder:null,hSpace:vr,leftMargin:vr,link:null,longDesc:null,lowSrc:null,marginHeight:vr,marginWidth:vr,noResize:ve,noHref:ve,noShade:ve,noWrap:ve,object:null,profile:null,prompt:null,rev:null,rightMargin:vr,rules:null,scheme:null,scrolling:vt,standby:null,summary:null,text:null,topMargin:vr,valueType:null,version:null,vAlign:null,vLink:null,vSpace:vr,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ve,disableRemotePlayback:ve,prefix:null,property:null,results:vr,security:null,unselectable:null},space:"html",transform:vN}),vE=vb({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:vo,accentHeight:vr,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:vr,amplitude:vr,arabicForm:null,ascent:vr,attributeName:null,attributeType:null,azimuth:vr,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:vr,by:null,calcMode:null,capHeight:vr,className:vi,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:vr,diffuseConstant:vr,direction:null,display:null,dur:null,divisor:vr,dominantBaseline:null,download:ve,dx:null,dy:null,edgeMode:null,editable:null,elevation:vr,enableBackground:null,end:null,event:null,exponent:vr,externalResourcesRequired:null,fill:null,fillOpacity:vr,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:va,g2:va,glyphName:va,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:vr,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:vr,horizOriginX:vr,horizOriginY:vr,id:null,ideographic:vr,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:vr,k:vr,k1:vr,k2:vr,k3:vr,k4:vr,kernelMatrix:vo,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:vr,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:vr,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:vr,overlineThickness:vr,paintOrder:null,panose1:null,path:null,pathLength:vr,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:vi,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:vr,pointsAtY:vr,pointsAtZ:vr,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:vo,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:vo,rev:vo,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:vo,requiredFeatures:vo,requiredFonts:vo,requiredFormats:vo,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:vr,specularExponent:vr,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:vr,strikethroughThickness:vr,string:null,stroke:null,strokeDashArray:vo,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:vr,strokeOpacity:vr,strokeWidth:null,style:null,surfaceScale:vr,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:vo,tabIndex:vr,tableValues:null,target:null,targetX:vr,targetY:vr,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:vo,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:vr,underlineThickness:vr,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:vr,values:null,vAlphabetic:vr,vMathematical:vr,vectorEffect:null,vHanging:vr,vIdeographic:vr,version:null,vertAdvY:vr,vertOriginX:vr,vertOriginY:vr,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:vr,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:vj}),vC=vb({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),v_=vb({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:vN}),vS=vb({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),vT=vy([vw,vk,vC,v_,vS],"html"),vA=vy([vw,vE,vC,v_,vS],"svg");var vO=e.i(15511);let vM=vD("end"),vP=vD("start");function vD(e){return function(t){let n=t&&t.position&&t.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function vL(e){return e&&"object"==typeof e?"position"in e||"type"in e?vR(e.position):"start"in e||"end"in e?vR(e):"line"in e||"column"in e?vI(e):"":""}function vI(e){return vB(e&&e.line)+":"+vB(e&&e.column)}function vR(e){return vI(e&&e.start)+"-"+vI(e&&e.end)}function vB(e){return e&&"number"==typeof e?e:1}class vz extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",i={},a=!1;if(t&&(i="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){const e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=o?o.line:void 0,this.name=vL(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&"string"==typeof i.cause.stack?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}vz.prototype.file="",vz.prototype.name="",vz.prototype.reason="",vz.prototype.message="",vz.prototype.stack="",vz.prototype.column=void 0,vz.prototype.line=void 0,vz.prototype.ancestors=void 0,vz.prototype.cause=void 0,vz.prototype.fatal=void 0,vz.prototype.place=void 0,vz.prototype.ruleId=void 0,vz.prototype.source=void 0;let vF={}.hasOwnProperty,vV=new Map,vU=/[A-Z]/g,vH=new Set(["table","tbody","thead","tfoot","tr"]),vW=new Set(["td","th"]),vY="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function vG(e,t,n){var r,i,a,o,s,l,c,u,d;let h,f,p,g,v,x,y,b,w,j,N;return"element"===t.type?(r=e,i=t,a=n,f=h=r.schema,"svg"===i.tagName.toLowerCase()&&"html"===h.space&&(r.schema=vA),r.ancestors.push(i),p=vK(r,i.tagName,!1),g=function(e,t){let n,r,i={};for(r in t.properties)if("children"!==r&&vF.call(t.properties,r)){let a=function(e,t,n){let r=function(e,t){let n=vd(t),r=t,i=g7;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&vp.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(vf,vg);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!vf.test(e)){let n=e.replace(vh,vm);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}i=vu}return new i(r,t)}(e.schema,t);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){var i;let t;if(Array.isArray(n)&&(n=r.commaSeparated?(t={},(""===(i=n)[i.length-1]?[...i,""]:i).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()):n.join(" ").trim()),"style"===r.property){let t="object"==typeof n?n:function(e,t){try{return(0,vO.default)(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};let t=new vz("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=vY+"#cannot-parse-style-attribute",t}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){let t,n={};for(t in e)vF.call(e,t)&&(n[function(e){let t=e.replace(vU,vQ);return"ms-"===t.slice(0,3)&&(t="-"+t),t}(t)]=e[t]);return n}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?vv[r.property]||r.property:r.attribute,n]}}(e,r,t.properties[r]);if(a){let[r,o]=a;e.tableCellAlignToStyle&&"align"===r&&"string"==typeof o&&vW.has(t.tagName)?n=o:i[r]=o}}return n&&((i.style||(i.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=n),i}(r,i),v=vq(r,i),vH.has(i.tagName)&&(v=v.filter(function(e){return"string"!=typeof e||!("object"==typeof e?"text"===e.type&&g8(e.value):g8(e))})),v$(r,g,p,i),vX(g,v),r.ancestors.pop(),r.schema=h,r.create(i,p,g,a)):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return g0("ExpressionStatement"===n.type),e.evaluater.evaluateExpression(n.expression)}vZ(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?(o=e,s=t,l=n,y=x=o.schema,"svg"===s.name&&"html"===x.space&&(o.schema=vA),o.ancestors.push(s),b=null===s.name?o.Fragment:vK(o,s.name,!0),w=function(e,t){let n={};for(let r of t.attributes)if("mdxJsxExpressionAttribute"===r.type)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];g0("ExpressionStatement"===t.type);let i=t.expression;g0("ObjectExpression"===i.type);let a=i.properties[0];g0("SpreadElement"===a.type),Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else vZ(e,t.position);else{let i,a=r.name;if(r.value&&"object"==typeof r.value)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];g0("ExpressionStatement"===t.type),i=e.evaluater.evaluateExpression(t.expression)}else vZ(e,t.position);else i=null===r.value||r.value;n[a]=i}return n}(o,s),j=vq(o,s),v$(o,w,b,s),vX(w,j),o.ancestors.pop(),o.schema=x,o.create(s,b,w,l)):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);vZ(e,t.position)}(e,t):"root"===t.type?(c=e,u=t,d=n,vX(N={},vq(c,u)),c.create(u,c.Fragment,N,d)):"text"===t.type?t.value:void 0}function v$(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function vX(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function vq(e,t){let n=[],r=-1,i=e.passKeys?new Map:vV;for(;++r<t.children.length;){let a,o=t.children[r];if(e.passKeys){let e="element"===o.type?o.tagName:"mdxJsxFlowElement"===o.type||"mdxJsxTextElement"===o.type?o.name:void 0;if(e){let t=i.get(e)||0;a=e+"-"+t,i.set(e,t+1)}}let s=vG(e,o,a);void 0!==s&&n.push(s)}return n}function vK(e,t,n){let r;if(n)if(t.includes(".")){let e,n=t.split("."),i=-1;for(;++i<n.length;){let t=g4(n[i])?{type:"Identifier",name:n[i]}:{type:"Literal",value:n[i]};e=e?{type:"MemberExpression",object:e,property:t,computed:!!(i&&"Literal"===t.type),optional:!1}:t}g0(e,"always a result"),r=e}else r=g4(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else r={type:"Literal",value:t};if("Literal"===r.type){let t=r.value;return vF.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);vZ(e)}function vZ(e,t){let n=new vz("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=vY+"#cannot-handle-mdx-estrees-without-createevaluater",n}function vQ(e){return"-"+e.toLowerCase()}let vJ={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},v0={};function v1(e,t){let n=t||v0;return v2(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function v2(e,t,n){var r;if((r=e)&&"object"==typeof r){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return v5(e.children,t,n)}return Array.isArray(e)?v5(e,t,n):""}function v5(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=v2(e[i],t,n);return r.join("")}function v3(e,t,n,r){let i,a=e.length,o=0;if(t=t<0?-t>a?0:a+t:t>a?a:t,n=n>0?n:0,r.length<1e4)(i=Array.from(r)).unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);o<r.length;)(i=r.slice(o,o+1e4)).unshift(t,0),e.splice(...i),o+=1e4,t+=1e4}function v4(e,t){return e.length>0?(v3(e,e.length,0,t),e):t}let v6={}.hasOwnProperty;function v8(e){let t={},n=-1;for(;++n<e.length;)!function(e,t){let n;for(n in t){let r,i=(v6.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];if(a)for(r in a){v6.call(i,r)||(i[r]=[]);let e=a[r];!function(e,t){let n=-1,r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);v3(e,0,0,r)}(i[r],Array.isArray(e)?e:e?[e]:[])}}}(t,e[n]);return t}function v7(e){return null!==e&&e<-2}function v9(e){return -2===e||-1===e||32===e}function xe(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xt(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return v9(r)?(e.enter(n),function r(o){return v9(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}xe(/[A-Za-z]/),xe(/[\dA-Za-z]/),xe(/[#-'*+\--9=?A-Z^-~]/),xe(/\d/),xe(/[\dA-Fa-f]/),xe(/[!-/:-@[-`{-~]/),xe(/\p{P}|\p{S}/u),xe(/\s/);let xn={tokenize:function(e){let t,n=e.attempt(this.parser.constructs.contentInitial,function(t){return null===t?void e.consume(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),xt(e,n,"linePrefix"))},function(n){return e.enter("paragraph"),function n(r){let i=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=i),t=i,function t(r){if(null===r){e.exit("chunkText"),e.exit("paragraph"),e.consume(r);return}return v7(r)?(e.consume(r),e.exit("chunkText"),n):(e.consume(r),t)}(r)}(n)});return n}},xr={tokenize:function(e){let t,n,r,i=this,a=[],o=0;return s;function s(t){if(o<a.length){let n=a[o];return i.containerState=n[1],e.attempt(n[0].continuation,l,c)(t)}return c(t)}function l(e){if(o++,i.containerState._closeFlow){let n;i.containerState._closeFlow=void 0,t&&x();let r=i.events.length,a=r;for(;a--;)if("exit"===i.events[a][0]&&"chunkFlow"===i.events[a][1].type){n=i.events[a][1].end;break}v(o);let s=r;for(;s<i.events.length;)i.events[s][1].end={...n},s++;return v3(i.events,a+1,0,i.events.slice(r)),i.events.length=s,c(e)}return s(e)}function c(n){if(o===a.length){if(!t)return h(n);if(t.currentConstruct&&t.currentConstruct.concrete)return p(n);i.interrupt=!!(t.currentConstruct&&!t._gfmTableDynamicInterruptHack)}return i.containerState={},e.check(xi,u,d)(n)}function u(e){return t&&x(),v(o),h(e)}function d(e){return i.parser.lazy[i.now().line]=o!==a.length,r=i.now().offset,p(e)}function h(t){return i.containerState={},e.attempt(xi,f,p)(t)}function f(e){return o++,a.push([i.currentConstruct,i.containerState]),h(e)}function p(r){if(null===r){t&&x(),v(0),e.consume(r);return}return t=t||i.parser.flow(i.now()),e.enter("chunkFlow",{_tokenizer:t,contentType:"flow",previous:n}),function t(n){if(null===n){g(e.exit("chunkFlow"),!0),v(0),e.consume(n);return}return v7(n)?(e.consume(n),g(e.exit("chunkFlow")),o=0,i.interrupt=void 0,s):(e.consume(n),t)}(r)}function g(e,a){let s=i.sliceStream(e);if(a&&s.push(null),e.previous=n,n&&(n.next=e),n=e,t.defineSkip(e.start),t.write(s),i.parser.lazy[e.start.line]){let e,n,a=t.events.length;for(;a--;)if(t.events[a][1].start.offset<r&&(!t.events[a][1].end||t.events[a][1].end.offset>r))return;let s=i.events.length,l=s;for(;l--;)if("exit"===i.events[l][0]&&"chunkFlow"===i.events[l][1].type){if(e){n=i.events[l][1].end;break}e=!0}for(v(o),a=s;a<i.events.length;)i.events[a][1].end={...n},a++;v3(i.events,l+1,0,i.events.slice(s)),i.events.length=a}}function v(t){let n=a.length;for(;n-- >t;){let t=a[n];i.containerState=t[1],t[0].exit.call(i,e)}a.length=t}function x(){t.write([null]),n=void 0,t=void 0,i.containerState._closeFlow=void 0}}},xi={tokenize:function(e,t,n){return xt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},xa=xp(/[A-Za-z]/),xo=xp(/[\dA-Za-z]/),xs=xp(/[#-'*+\--9=?A-Z^-~]/),xl=xp(/\d/),xc=xp(/[\dA-Fa-f]/),xu=xp(/[!-/:-@[-`{-~]/);function xd(e){return null!==e&&e<-2}function xh(e){return null!==e&&(e<0||32===e)}function xf(e){return -2===e||-1===e||32===e}function xp(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xm(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return xf(r)?(e.enter(n),function r(o){return xf(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}xp(/\p{P}|\p{S}/u),xp(/\s/);let xg={partial:!0,tokenize:function(e,t,n){return function(t){return xf(t)?xm(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||xd(e)?t(e):n(e)}}};class xv{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=null==t?1/0:t;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){this.setCursor(Math.trunc(e));let r=this.right.splice(this.right.length-(t||0),1/0);return n&&xx(this.left,n),r.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),xx(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),xx(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length))if(e<this.left.length){let t=this.left.splice(e,1/0);xx(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);xx(this.left,t.reverse())}}}function xx(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function xy(e){let t,n,r,i,a,o,s,l={},c=-1,u=new xv(e);for(;++c<u.length;){for(;c in l;)c=l[c];if(t=u.get(c),c&&"chunkFlow"===t[1].type&&"listItemPrefix"===u.get(c-1)[1].type&&((r=0)<(o=t[1]._tokenizer.events).length&&"lineEndingBlank"===o[r][1].type&&(r+=2),r<o.length&&"content"===o[r][1].type))for(;++r<o.length&&"content"!==o[r][1].type;)"chunkText"===o[r][1].type&&(o[r][1]._isInFirstContentOfListItem=!0,r++);if("enter"===t[0])t[1].contentType&&(Object.assign(l,function(e,t){let n,r,i=e.get(t)[1],a=e.get(t)[2],o=t-1,s=[],l=i._tokenizer;!l&&(l=a.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));let c=l.events,u=[],d={},h=-1,f=i,p=0,g=0,v=[0];for(;f;){for(;e.get(++o)[1]!==f;);s.push(o),!f._tokenizer&&(n=a.sliceStream(f),f.next||n.push(null),r&&l.defineSkip(f.start),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(n),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),r=f,f=f.next}for(f=i;++h<c.length;)"exit"===c[h][0]&&"enter"===c[h-1][0]&&c[h][1].type===c[h-1][1].type&&c[h][1].start.line!==c[h][1].end.line&&(g=h+1,v.push(g),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(l.events=[],f?(f._tokenizer=void 0,f.previous=void 0):v.pop(),h=v.length;h--;){let t=c.slice(v[h],v[h+1]),n=s.pop();u.push([n,n+t.length-1]),e.splice(n,2,t)}for(u.reverse(),h=-1;++h<u.length;)d[p+u[h][0]]=p+u[h][1],p+=u[h][1]-u[h][0]-1;return d}(u,c)),c=l[c],s=!0);else if(t[1]._container){for(r=c,n=void 0;r--;)if("lineEnding"===(i=u.get(r))[1].type||"lineEndingBlank"===i[1].type)"enter"===i[0]&&(n&&(u.get(n)[1].type="lineEndingBlank"),i[1].type="lineEnding",n=r);else if("linePrefix"===i[1].type||"listItemIndent"===i[1].type);else break;n&&(t[1].end={...u.get(n)[1].start},(a=u.slice(n,c)).unshift(t),u.splice(n,c-n+1,a))}}return v3(e,0,1/0,u.slice(0)),!s}let xb={resolve:function(e){return xy(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?i(t):xd(t)?e.check(xw,a,i)(t):(e.consume(t),r)}function i(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function a(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},xw={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),xm(e,i,"linePrefix")};function i(i){if(null===i||xd(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}},xj={tokenize:function(e){let t=this,n=e.attempt(xg,function(r){return null===r?void e.consume(r):(e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n)},e.attempt(this.parser.constructs.flowInitial,r,xt(e,e.attempt(this.parser.constructs.flow,r,e.attempt(xb,r)),"linePrefix")));return n;function r(r){return null===r?void e.consume(r):(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n)}}},xN={resolveAll:x_()},xk=xC("string"),xE=xC("text");function xC(e){return{resolveAll:x_("text"===e?xS:void 0),tokenize:function(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return l(e)?i(e):o(e)}function o(e){return null===e?void t.consume(e):(t.enter("data"),t.consume(e),s)}function s(e){return l(e)?(t.exit("data"),i(e)):(t.consume(e),s)}function l(e){if(null===e)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function x_(e){return function(t,n){let r,i=-1;for(;++i<=t.length;)void 0===r?t[i]&&"data"===t[i][1].type&&(r=i,i++):t[i]&&"data"===t[i][1].type||(i!==r+2&&(t[r][1].end=t[i-1][1].end,t.splice(r+2,i-r-2),i=r+2),r=void 0);return e?e(t,n):t}}function xS(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){let r,i=e[n-1][1],a=t.sliceStream(i),o=a.length,s=-1,l=0;for(;o--;){let e=a[o];if("string"==typeof e){for(s=e.length;32===e.charCodeAt(s-1);)l++,s--;if(s)break;s=-1}else if(-2===e)r=!0,l++;else if(-1===e);else{o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){let a={type:n===e.length||r||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-l,offset:i.end.offset-l},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):(e.splice(n,0,["enter",a,t],["exit",a,t]),n+=2)}n++}return e}xO(/[A-Za-z]/),xO(/[\dA-Za-z]/),xO(/[#-'*+\--9=?A-Z^-~]/),xO(/\d/),xO(/[\dA-Fa-f]/),xO(/[!-/:-@[-`{-~]/);let xT=xO(/\p{P}|\p{S}/u),xA=xO(/\s/);function xO(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xM(e){return null===e||null!==e&&(e<0||32===e)||xA(e)?1:xT(e)?2:void 0}function xP(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}let xD={name:"attention",resolveAll:function(e,t){let n,r,i,a,o,s,l,c,u=-1;for(;++u<e.length;)if("enter"===e[u][0]&&"attentionSequence"===e[u][1].type&&e[u][1]._close){for(n=u;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[u][1]).charCodeAt(0)){if((e[n][1]._close||e[u][1]._open)&&(e[u][1].end.offset-e[u][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[u][1].end.offset-e[u][1].start.offset)%3))continue;s=e[n][1].end.offset-e[n][1].start.offset>1&&e[u][1].end.offset-e[u][1].start.offset>1?2:1;let d={...e[n][1].end},h={...e[u][1].start};xL(d,-s),xL(h,s),a={type:s>1?"strongSequence":"emphasisSequence",start:d,end:{...e[n][1].end}},o={type:s>1?"strongSequence":"emphasisSequence",start:{...e[u][1].start},end:h},i={type:s>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[u][1].start}},r={type:s>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[n][1].end={...a.start},e[u][1].start={...o.end},l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=v4(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=v4(l,[["enter",r,t],["enter",a,t],["exit",a,t],["enter",i,t]]),l=v4(l,xP(t.parser.constructs.insideSpan.null,e.slice(n+1,u),t)),l=v4(l,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",r,t]]),e[u][1].end.offset-e[u][1].start.offset?(c=2,l=v4(l,[["enter",e[u][1],t],["exit",e[u][1],t]])):c=0,v3(e,n-1,u-n+3,l),u=n+l.length-c-2;break}}for(u=-1;++u<e.length;)"attentionSequence"===e[u][1].type&&(e[u][1].type="data");return e},tokenize:function(e,t){let n,r=this.parser.constructs.attentionMarkers.null,i=this.previous,a=xM(i);return function(o){return n=o,e.enter("attentionSequence"),function o(s){if(s===n)return e.consume(s),o;let l=e.exit("attentionSequence"),c=xM(s),u=!c||2===c&&a||r.includes(s),d=!a||2===a&&c||r.includes(i);return l._open=!!(42===n?u:u&&(a||!d)),l._close=!!(42===n?d:d&&(c||!u)),t(s)}(o)}}};function xL(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}let xI={continuation:{tokenize:function(e,t,n){let r=this;return function(t){return xf(t)?xm(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):i(t)};function i(r){return e.attempt(xI,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){let r=this;return function(t){if(62===t){let n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),i}return n(t)};function i(n){return xf(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}},xR={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return xu(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}},xB=document.createElement("i");function xz(e){let t="&"+e+";";xB.innerHTML=t;let n=xB.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}let xF={name:"characterReference",tokenize:function(e,t,n){let r,i,a=this,o=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),s};function s(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),r=31,i=xo,c(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),r=6,i=xc,c):(e.enter("characterReferenceValue"),r=7,i=xl,c(t))}function c(s){if(59===s&&o){let r=e.exit("characterReferenceValue");return i!==xo||xz(a.sliceSerialize(r))?(e.enter("characterReferenceMarker"),e.consume(s),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(s)}return i(s)&&o++<r?(e.consume(s),c):n(s)}}},xV={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},xU={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){let r,i=this,a={partial:!0,tokenize:function(e,t,n){let a=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o};function o(t){return e.enter("codeFencedFence"),xf(t)?xm(e,l,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===r?(e.enter("codeFencedFenceSequence"),function t(i){return i===r?(a++,e.consume(i),t):a>=s?(e.exit("codeFencedFenceSequence"),xf(i)?xm(e,c,"whitespace")(i):c(i)):n(i)}(t)):n(t)}function c(r){return null===r||xd(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}},o=0,s=0;return function(t){var a;let c;return a=t,o=(c=i.events[i.events.length-1])&&"linePrefix"===c[1].type?c[2].sliceSerialize(c[1],!0).length:0,r=a,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(i){return i===r?(s++,e.consume(i),t):s<3?n(i):(e.exit("codeFencedFenceSequence"),xf(i)?xm(e,l,"whitespace")(i):l(i))}(a)};function l(a){return null===a||xd(a)?(e.exit("codeFencedFence"),i.interrupt?t(a):e.check(xV,u,p)(a)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||xd(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(i)):xf(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),xm(e,c,"whitespace")(i)):96===i&&i===r?n(i):(e.consume(i),t)}(a))}function c(t){return null===t||xd(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||xd(i)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(i)):96===i&&i===r?n(i):(e.consume(i),t)}(t))}function u(t){return e.attempt(a,p,d)(t)}function d(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),h}function h(t){return o>0&&xf(t)?xm(e,f,"linePrefix",o+1)(t):f(t)}function f(t){return null===t||xd(t)?e.check(xV,u,p)(t):(e.enter("codeFlowValue"),function t(n){return null===n||xd(n)?(e.exit("codeFlowValue"),f(n)):(e.consume(n),t)}(t))}function p(n){return e.exit("codeFenced"),t(n)}}},xH={name:"codeIndented",tokenize:function(e,t,n){let r=this;return function(t){return e.enter("codeIndented"),xm(e,i,"linePrefix",5)(t)};function i(t){let i=r.events[r.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?function t(n){return null===n?a(n):xd(n)?e.attempt(xW,t,a)(n):(e.enter("codeFlowValue"),function n(r){return null===r||xd(r)?(e.exit("codeFlowValue"),t(r)):(e.consume(r),n)}(n))}(t):n(t)}function a(n){return e.exit("codeIndented"),t(n)}}},xW={partial:!0,tokenize:function(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):xd(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):xm(e,a,"linePrefix",5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):xd(e)?i(e):n(e)}}};function xY(e){return null!==e&&(e<32||127===e)}function xG(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function x$(e,t,n,r,i,a,o,s,l){let c=l||1/0,u=0;return function(t){return 60===t?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),d):null===t||32===t||41===t||xY(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),p(t))};function d(n){return 62===n?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),h(n))}function h(t){return 62===t?(e.exit("chunkString"),e.exit(s),d(t)):null===t||60===t||null!==t&&t<-2?n(t):(e.consume(t),92===t?f:h)}function f(t){return 60===t||62===t||92===t?(e.consume(t),h):h(t)}function p(i){return!u&&(null===i||41===i||null!==i&&(i<0||32===i))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(r),t(i)):u<c&&40===i?(e.consume(i),u++,p):41===i?(e.consume(i),u--,p):null===i||32===i||40===i||xY(i)?n(i):(e.consume(i),92===i?g:p)}function g(t){return 40===t||41===t||92===t?(e.consume(t),p):p(t)}}function xX(e){return null!==e&&e<-2}function xq(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xK(e,t,n,r,i,a){let o,s=this,l=0;return function(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),c};function c(d){return l>999||null===d||91===d||93===d&&!o||94===d&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?n(d):93===d?(e.exit(a),e.enter(i),e.consume(d),e.exit(i),e.exit(r),t):xX(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),u(d))}function u(t){return null===t||91===t||93===t||xX(t)||l++>999?(e.exit("chunkString"),c(t)):(e.consume(t),o||(o=-2!==t&&-1!==t&&32!==t),92===t?d:u)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,u):u(t)}}function xZ(e){return null!==e&&e<-2}function xQ(e){return -2===e||-1===e||32===e}function xJ(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function x0(e,t,n,r,i,a){let o;return function(t){return 34===t||39===t||40===t?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=40===t?41:t,s):n(t)};function s(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){if(t===o)return e.exit(a),s(o);if(null===t)return n(t);if(xZ(t)){var r,i;let n,a;return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),r=l,i="linePrefix",n=1/0,a=0,function(t){return xQ(t)?(e.enter(i),function t(o){return xQ(o)&&a++<n?(e.consume(o),t):(e.exit(i),r(o))}(t)):r(t)}}return e.enter("chunkString",{contentType:"string"}),c(t)}function c(t){return t===o||null===t||xZ(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return t===o||92===t?(e.consume(t),c):c(t)}}function x1(e){return -2===e||-1===e||32===e}function x2(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function x5(e,t){let n;return function r(i){var a,o;if(null!==i&&i<-2)return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r;if(x1(i)){let t,s;return(a=r,o=n?"linePrefix":"lineSuffix",t=1/0,s=0,function(n){return x1(n)?(e.enter(o),function n(r){return x1(r)&&s++<t?(e.consume(r),n):(e.exit(o),a(r))}(n)):a(n)})(i)}return t(i)}}function x3(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}xG(/[A-Za-z]/),xG(/[\dA-Za-z]/),xG(/[#-'*+\--9=?A-Z^-~]/),xG(/\d/),xG(/[\dA-Fa-f]/),xG(/[!-/:-@[-`{-~]/),xG(/\p{P}|\p{S}/u),xG(/\s/),xq(/[A-Za-z]/),xq(/[\dA-Za-z]/),xq(/[#-'*+\--9=?A-Z^-~]/),xq(/\d/),xq(/[\dA-Fa-f]/),xq(/[!-/:-@[-`{-~]/),xq(/\p{P}|\p{S}/u),xq(/\s/),xJ(/[A-Za-z]/),xJ(/[\dA-Za-z]/),xJ(/[#-'*+\--9=?A-Z^-~]/),xJ(/\d/),xJ(/[\dA-Fa-f]/),xJ(/[!-/:-@[-`{-~]/),xJ(/\p{P}|\p{S}/u),xJ(/\s/),x2(/[A-Za-z]/),x2(/[\dA-Za-z]/),x2(/[#-'*+\--9=?A-Z^-~]/),x2(/\d/),x2(/[\dA-Fa-f]/),x2(/[!-/:-@[-`{-~]/),x2(/\p{P}|\p{S}/u),x2(/\s/);let x4={partial:!0,tokenize:function(e,t,n){return function(t){return xh(t)?x5(e,r)(t):n(t)};function r(t){return x0(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return xf(t)?xm(e,a,"whitespace")(t):a(t)}function a(e){return null===e||xd(e)?t(e):n(e)}}},x6=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],x8=["pre","script","style","textarea"],x7={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(xg,t,n)}}},x9={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return xd(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):n(t)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},ye={name:"labelEnd",resolveAll:function(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){let e="labelImage"===r.type?4:2;r.type="data",t+=e}}return e.length!==n.length&&v3(e,0,e.length,n),e},resolveTo:function(e,t){let n,r,i,a,o=e.length,s=0;for(;o--;)if(n=e[o][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[o][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(i){if("enter"===e[o][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=o,"labelLink"!==n.type)){s=2;break}}else"labelEnd"===n.type&&(i=o);let l={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[r][1].start},end:{...e[i][1].end}},u={type:"labelText",start:{...e[r+s+2][1].end},end:{...e[i-2][1].start}};return a=v4(a=[["enter",l,t],["enter",c,t]],e.slice(r+1,r+s+3)),a=v4(a,[["enter",u,t]]),a=v4(a,xP(t.parser.constructs.insideSpan.null,e.slice(r+s+4,i-3),t)),a=v4(a,[["exit",u,t],e[i-2],e[i-1],["exit",c,t]]),a=v4(a,e.slice(i+1)),a=v4(a,[["exit",l,t]]),v3(e,r,e.length,a),e},tokenize:function(e,t,n){let r,i,a=this,o=a.events.length;for(;o--;)if(("labelImage"===a.events[o][1].type||"labelLink"===a.events[o][1].type)&&!a.events[o][1]._balanced){r=a.events[o][1];break}return function(t){return r?r._inactive?u(t):(i=a.parser.defined.includes(x3(a.sliceSerialize({start:r.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),s):n(t)};function s(t){return 40===t?e.attempt(yt,c,i?c:u)(t):91===t?e.attempt(yn,c,i?l:u)(t):i?c(t):u(t)}function l(t){return e.attempt(yr,c,u)(t)}function c(e){return t(e)}function u(e){return r._balanced=!0,n(e)}}},yt={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return xh(t)?x5(e,i)(t):i(t)}function i(t){return 41===t?c(t):x$(e,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function a(t){return xh(t)?x5(e,s)(t):c(t)}function o(e){return n(e)}function s(t){return 34===t||39===t||40===t?x0(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function l(t){return xh(t)?x5(e,c)(t):c(t)}function c(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},yn={tokenize:function(e,t,n){let r=this;return function(t){return xK.call(r,e,i,a,"reference","referenceMarker","referenceString")(t)};function i(e){return r.parser.defined.includes(x3(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function a(e){return n(e)}}},yr={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}},yi={name:"labelStartImage",resolveAll:ye.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),i};function i(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),a):n(t)}function a(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},ya={name:"labelStartLink",resolveAll:ye.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),i};function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},yo={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),xm(e,t,"linePrefix")}}},ys={name:"thematicBreak",tokenize:function(e,t,n){let r,i=0;return function(a){var o;return e.enter("thematicBreak"),r=o=a,function a(o){return o===r?(e.enter("thematicBreakSequence"),function t(n){return n===r?(e.consume(n),i++,t):(e.exit("thematicBreakSequence"),xf(n)?xm(e,a,"whitespace")(n):a(n))}(o)):i>=3&&(null===o||xd(o))?(e.exit("thematicBreak"),t(o)):n(o)}(o)}}},yl={continuation:{tokenize:function(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(xg,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,xm(e,t,"listItemIndent",r.containerState.size+1)(n)},function(n){return r.containerState.furtherBlankLines||!xf(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(yu,t,i)(n))});function i(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,xm(e,e.attempt(yl,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,o=0;return function(t){let i=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===i?!r.containerState.marker||t===r.containerState.marker:xl(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),"listUnordered"===i)return e.enter("listItemPrefix"),42===t||45===t?e.check(ys,n,s)(t):s(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(i){return xl(i)&&++o<10?(e.consume(i),t):(!r.interrupt||o<2)&&(r.containerState.marker?i===r.containerState.marker:41===i||46===i)?(e.exit("listItemValue"),s(i)):n(i)}(t)}return n(t)};function s(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(xg,r.interrupt?n:l,e.attempt(yc,u,c))}function l(e){return r.containerState.initialBlankLine=!0,a++,u(e)}function c(t){return xf(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),u):n(t)}function u(n){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},yc={partial:!0,tokenize:function(e,t,n){let r=this;return xm(e,function(e){let i=r.events[r.events.length-1];return!xf(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},yu={partial:!0,tokenize:function(e,t,n){let r=this;return xm(e,function(e){let i=r.events[r.events.length-1];return i&&"listItemIndent"===i[1].type&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}},yd={name:"setextUnderline",resolveTo:function(e,t){let n,r,i,a=e.length;for(;a--;)if("enter"===e[a][0]){if("content"===e[a][1].type){n=a;break}"paragraph"===e[a][1].type&&(r=a)}else"content"===e[a][1].type&&e.splice(a,1),i||"definition"!==e[a][1].type||(i=a);let o={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",o,t]),e.splice(i+1,0,["exit",e[n][1],t]),e[n][1].end={...e[i][1].end}):e[n][1]=o,e.push(["exit",o,t]),e},tokenize:function(e,t,n){let r,i=this;return function(t){var o;let s,l=i.events.length;for(;l--;)if("lineEnding"!==i.events[l][1].type&&"linePrefix"!==i.events[l][1].type&&"content"!==i.events[l][1].type){s="paragraph"===i.events[l][1].type;break}return!i.parser.lazy[i.now().line]&&(i.interrupt||s)?(e.enter("setextHeadingLine"),r=t,o=t,e.enter("setextHeadingLineSequence"),function t(n){return n===r?(e.consume(n),t):(e.exit("setextHeadingLineSequence"),xf(n)?xm(e,a,"lineSuffix")(n):a(n))}(o)):n(t)};function a(r){return null===r||xd(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};e.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(e,t,n){let r,i=this;return function(t){var r;return e.enter("definition"),r=t,xK.call(i,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(r)};function a(t){return(r=x3(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),58===t)?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o):n(t)}function o(t){return xh(t)?x5(e,s)(t):s(t)}function s(t){return x$(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(x4,c,c)(t)}function c(t){return xf(t)?xm(e,u,"whitespace")(t):u(t)}function u(a){return null===a||xd(a)?(e.exit("definition"),i.parser.defined.push(r),t(a)):n(a)}}}},"disable",0,{null:[]},"document",0,{42:yl,43:yl,45:yl,48:yl,49:yl,50:yl,51:yl,52:yl,53:yl,54:yl,55:yl,56:yl,57:yl,62:xI},"flow",0,{35:{name:"headingAtx",resolve:function(e,t){let n,r,i=e.length-2,a=3;return"whitespace"===e[3][1].type&&(a+=2),i-2>a&&"whitespace"===e[i][1].type&&(i-=2),"atxHeadingSequence"===e[i][1].type&&(a===i-1||i-4>a&&"whitespace"===e[i-2][1].type)&&(i-=a+1===i?2:4),i>a&&(n={type:"atxHeadingText",start:e[a][1].start,end:e[i][1].end},r={type:"chunkText",start:e[a][1].start,end:e[i][1].end,contentType:"text"},v3(e,a,i-a+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e},tokenize:function(e,t,n){let r=0;return function(i){var a;return e.enter("atxHeading"),a=i,e.enter("atxHeadingSequence"),function i(a){return 35===a&&r++<6?(e.consume(a),i):null===a||xh(a)?(e.exit("atxHeadingSequence"),function n(r){return 35===r?(e.enter("atxHeadingSequence"),function t(r){return 35===r?(e.consume(r),t):(e.exit("atxHeadingSequence"),n(r))}(r)):null===r||xd(r)?(e.exit("atxHeading"),t(r)):xf(r)?xm(e,n,"whitespace")(r):(e.enter("atxHeadingText"),function t(r){return null===r||35===r||xh(r)?(e.exit("atxHeadingText"),n(r)):(e.consume(r),t)}(r))}(a)):n(a)}(a)}}},42:ys,45:[yd,ys],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},tokenize:function(e,t,n){let r,i,a,o,s,l=this;return function(t){var n;return n=t,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(n),c};function c(o){return 33===o?(e.consume(o),u):47===o?(e.consume(o),i=!0,f):63===o?(e.consume(o),r=3,l.interrupt?t:P):xa(o)?(e.consume(o),a=String.fromCharCode(o),p):n(o)}function u(i){return 45===i?(e.consume(i),r=2,d):91===i?(e.consume(i),r=5,o=0,h):xa(i)?(e.consume(i),r=4,l.interrupt?t:P):n(i)}function d(r){return 45===r?(e.consume(r),l.interrupt?t:P):n(r)}function h(r){let i="CDATA[";return r===i.charCodeAt(o++)?(e.consume(r),o===i.length)?l.interrupt?t:E:h:n(r)}function f(t){return xa(t)?(e.consume(t),a=String.fromCharCode(t),p):n(t)}function p(o){if(null===o||47===o||62===o||xh(o)){let s=47===o,c=a.toLowerCase();return!s&&!i&&x8.includes(c)?(r=1,l.interrupt?t(o):E(o)):x6.includes(a.toLowerCase())?(r=6,s)?(e.consume(o),g):l.interrupt?t(o):E(o):(r=7,l.interrupt&&!l.parser.lazy[l.now().line]?n(o):i?function t(n){return xf(n)?(e.consume(n),t):N(n)}(o):v(o))}return 45===o||xo(o)?(e.consume(o),a+=String.fromCharCode(o),p):n(o)}function g(r){return 62===r?(e.consume(r),l.interrupt?t:E):n(r)}function v(t){return 47===t?(e.consume(t),N):58===t||95===t||xa(t)?(e.consume(t),x):xf(t)?(e.consume(t),v):N(t)}function x(t){return 45===t||46===t||58===t||95===t||xo(t)?(e.consume(t),x):y(t)}function y(t){return 61===t?(e.consume(t),b):xf(t)?(e.consume(t),y):v(t)}function b(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),s=t,w):xf(t)?(e.consume(t),b):function t(n){return null===n||34===n||39===n||47===n||60===n||61===n||62===n||96===n||xh(n)?y(n):(e.consume(n),t)}(t)}function w(t){return t===s?(e.consume(t),s=null,j):null===t||xd(t)?n(t):(e.consume(t),w)}function j(e){return 47===e||62===e||xf(e)?v(e):n(e)}function N(t){return 62===t?(e.consume(t),k):n(t)}function k(t){return null===t||xd(t)?E(t):xf(t)?(e.consume(t),k):n(t)}function E(t){return 45===t&&2===r?(e.consume(t),T):60===t&&1===r?(e.consume(t),A):62===t&&4===r?(e.consume(t),D):63===t&&3===r?(e.consume(t),P):93===t&&5===r?(e.consume(t),M):xd(t)&&(6===r||7===r)?(e.exit("htmlFlowData"),e.check(x7,L,C)(t)):null===t||xd(t)?(e.exit("htmlFlowData"),C(t)):(e.consume(t),E)}function C(t){return e.check(x9,_,L)(t)}function _(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),S}function S(t){return null===t||xd(t)?C(t):(e.enter("htmlFlowData"),E(t))}function T(t){return 45===t?(e.consume(t),P):E(t)}function A(t){return 47===t?(e.consume(t),a="",O):E(t)}function O(t){if(62===t){let n=a.toLowerCase();return x8.includes(n)?(e.consume(t),D):E(t)}return xa(t)&&a.length<8?(e.consume(t),a+=String.fromCharCode(t),O):E(t)}function M(t){return 93===t?(e.consume(t),P):E(t)}function P(t){return 62===t?(e.consume(t),D):45===t&&2===r?(e.consume(t),P):E(t)}function D(t){return null===t||xd(t)?(e.exit("htmlFlowData"),L(t)):(e.consume(t),D)}function L(n){return e.exit("htmlFlow"),t(n)}}},61:yd,95:ys,96:xU,126:xU},"flowInitial",0,{[-2]:xH,[-1]:xH,32:xH},"insideSpan",0,{null:[xD,xN]},"string",0,{38:xF,92:xR},"text",0,{[-5]:yo,[-4]:yo,[-3]:yo,33:yi,38:xF,42:xD,60:[{name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i};function i(t){return xa(t)?(e.consume(t),a):64===t?n(t):s(t)}function a(t){return 43===t||45===t||46===t||xo(t)?(r=1,function t(n){return 58===n?(e.consume(n),r=0,o):(43===n||45===n||46===n||xo(n))&&r++<32?(e.consume(n),t):(r=0,s(n))}(t)):s(t)}function o(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||null!==r&&(r<32||127===r)?n(r):(e.consume(r),o)}function s(t){return 64===t?(e.consume(t),l):xs(t)?(e.consume(t),s):n(t)}function l(i){return xo(i)?function i(a){return 46===a?(e.consume(a),r=0,l):62===a?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(a),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(a){if((45===a||xo(a))&&r++<63){let n=45===a?t:i;return e.consume(a),n}return n(a)}(a)}(i):n(i)}}},{name:"htmlText",tokenize:function(e,t,n){let r,i,a,o=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),s};function s(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),w):63===t?(e.consume(t),y):xa(t)?(e.consume(t),N):n(t)}function l(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),i=0,f):xa(t)?(e.consume(t),x):n(t)}function c(t){return 45===t?(e.consume(t),h):n(t)}function u(t){return null===t?n(t):45===t?(e.consume(t),d):xd(t)?(a=u,O(t)):(e.consume(t),u)}function d(t){return 45===t?(e.consume(t),h):u(t)}function h(e){return 62===e?A(e):45===e?d(e):u(e)}function f(t){let r="CDATA[";return t===r.charCodeAt(i++)?(e.consume(t),i===r.length?p:f):n(t)}function p(t){return null===t?n(t):93===t?(e.consume(t),g):xd(t)?(a=p,O(t)):(e.consume(t),p)}function g(t){return 93===t?(e.consume(t),v):p(t)}function v(t){return 62===t?A(t):93===t?(e.consume(t),v):p(t)}function x(t){return null===t||62===t?A(t):xd(t)?(a=x,O(t)):(e.consume(t),x)}function y(t){return null===t?n(t):63===t?(e.consume(t),b):xd(t)?(a=y,O(t)):(e.consume(t),y)}function b(e){return 62===e?A(e):y(e)}function w(t){return xa(t)?(e.consume(t),j):n(t)}function j(t){return 45===t||xo(t)?(e.consume(t),j):function t(n){return xd(n)?(a=t,O(n)):xf(n)?(e.consume(n),t):A(n)}(t)}function N(t){return 45===t||xo(t)?(e.consume(t),N):47===t||62===t||xh(t)?k(t):n(t)}function k(t){return 47===t?(e.consume(t),A):58===t||95===t||xa(t)?(e.consume(t),E):xd(t)?(a=k,O(t)):xf(t)?(e.consume(t),k):A(t)}function E(t){return 45===t||46===t||58===t||95===t||xo(t)?(e.consume(t),E):function t(n){return 61===n?(e.consume(n),C):xd(n)?(a=t,O(n)):xf(n)?(e.consume(n),t):k(n)}(t)}function C(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),r=t,_):xd(t)?(a=C,O(t)):xf(t)?(e.consume(t),C):(e.consume(t),S)}function _(t){return t===r?(e.consume(t),r=void 0,T):null===t?n(t):xd(t)?(a=_,O(t)):(e.consume(t),_)}function S(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||xh(t)?k(t):(e.consume(t),S)}function T(e){return 47===e||62===e||xh(e)?k(e):n(e)}function A(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function O(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),M}function M(t){return xf(t)?xm(e,P,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):P(t)}function P(t){return e.enter("htmlTextData"),a(t)}}}],91:ya,92:[{name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return xd(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}},xR],93:ye,95:xD,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,i=3;if(("lineEnding"===e[3][1].type||"space"===e[i][1].type)&&("lineEnding"===e[r][1].type||"space"===e[r][1].type)){for(t=i;++t<r;)if("codeTextData"===e[t][1].type){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(t=i-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):(t===r||"lineEnding"===e[t][1].type)&&(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,i,a=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(n){return 96===n?(e.consume(n),a++,t):(e.exit("codeTextSequence"),o(n))}(t)};function o(l){return null===l?n(l):32===l?(e.enter("space"),e.consume(l),e.exit("space"),o):96===l?(i=e.enter("codeTextSequence"),r=0,function n(o){return 96===o?(e.consume(o),r++,n):r===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(o)):(i.type="codeTextData",s(o))}(l)):xd(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):(e.enter("codeTextData"),s(l))}function s(t){return null===t||32===t||96===t||xd(t)?(e.exit("codeTextData"),o(t)):(e.consume(t),s)}}}}],4127);var yh=e.i(4127);let yf=/[\0\t\n\r]/g;function yp(e,t){let n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(65535&n)==65535||(65535&n)==65534||n>1114111?"�":String.fromCodePoint(n)}let ym=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function yg(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){let e=n.charCodeAt(1),t=120===e||88===e;return yp(n.slice(t?2:1),t?16:10)}return xz(n)||e}let yv={}.hasOwnProperty;function yx(e){return{line:e.line,column:e.column,offset:e.offset}}function yy(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+vL({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+vL({start:t.start,end:t.end})+") is open");throw Error("Cannot close document, a token (`"+t.type+"`, "+vL({start:t.start,end:t.end})+") is still open")}function yb(e){let t=this;t.parser=function(n){var r,i;let a,o,s,l;return"string"!=typeof(r={...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})&&(i=r,r=void 0),(function(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:r(x),autolinkProtocol:c,autolinkEmail:c,atxHeading:r(p),blockQuote:r(function(){return{type:"blockquote",children:[]}}),characterEscape:c,characterReference:c,codeFenced:r(f),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:r(f,i),codeText:r(function(){return{type:"inlineCode",value:""}},i),codeTextData:c,data:c,codeFlowValue:c,definition:r(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:r(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:r(g),hardBreakTrailing:r(g),htmlFlow:r(v,i),htmlFlowData:c,htmlText:r(v,i),htmlTextData:c,image:r(function(){return{type:"image",title:null,url:"",alt:null}}),label:i,link:r(x),listItem:r(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:r(y,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:r(y),paragraph:r(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:r(p),strong:r(function(){return{type:"strong",children:[]}}),thematicBreak:r(function(){return{type:"thematicBreak"}})},exit:{atxHeading:o(),atxHeadingSequence:function(e){let t=this.stack[this.stack.length-1];t.depth||(t.depth=this.sliceSerialize(e).length)},autolink:o(),autolinkEmail:function(e){u.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){u.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:o(),characterEscapeValue:u,characterReferenceMarkerHexadecimal:h,characterReferenceMarkerNumeric:h,characterReferenceValue:function(e){let t,n=this.sliceSerialize(e),r=this.data.characterReferenceType;r?(t=yp(n,"characterReferenceMarkerNumeric"===r?10:16),this.data.characterReferenceType=void 0):t=xz(n);let i=this.stack[this.stack.length-1];i.value+=t},characterReference:function(e){this.stack.pop().position.end=yx(e.end)},codeFenced:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:u,codeIndented:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:u,data:u,definition:o(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=x3(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:o(),hardBreakEscape:o(d),hardBreakTrailing:o(d),htmlFlow:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:u,htmlText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:u,image:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===n.type?n.children=e.children:n.alt=t},labelText:function(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=t.replace(ym,yg),n.identifier=x3(t).toLowerCase()},lineEnding:function(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){n.children[n.children.length-1].position.end=yx(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(c.call(this,e),u.call(this,e))},link:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),listItem:o(),listOrdered:o(),listUnordered:o(),paragraph:o(),referenceString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=x3(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:o(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:o(),thematicBreak:o()}};!function e(t,n){let r=-1;for(;++r<n.length;){let i=n[r];Array.isArray(i)?e(t,i):function(e,t){let n;for(n in t)if(yv.call(t,n))switch(n){case"canContainEols":{let r=t[n];r&&e[n].push(...r);break}case"transforms":{let r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{let r=t[n];r&&Object.assign(e[n],r)}}}(t,i)}}(t,(e||{}).mdastExtensions||[]);let n={};return function(e){let r={type:"root",children:[]},o={stack:[r],tokenStack:[],config:t,enter:a,exit:s,buffer:i,resume:l,data:n},c=[],u=-1;for(;++u<e.length;)("listOrdered"===e[u][1].type||"listUnordered"===e[u][1].type)&&("enter"===e[u][0]?c.push(u):u=function(e,t,n){let r,i,a,o,s=t-1,l=-1,c=!1;for(;++s<=n;){let t=e[s];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,o=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!r||o||l||a||(a=s),o=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:o=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let o=s;for(i=void 0;o--;){let t=e[o];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;i&&(e[i][1].type="lineEndingBlank",c=!0),t[1].type="lineEnding",i=o}else if("linePrefix"===t[1].type||"blockQuotePrefix"===t[1].type||"blockQuotePrefixWhitespace"===t[1].type||"blockQuoteMarker"===t[1].type||"listItemIndent"===t[1].type);else break}a&&(!i||a<i)&&(r._spread=!0),r.end=Object.assign({},i?e[i][1].start:t[1].end),e.splice(i||s,0,["exit",r,t[2]]),s++,n++}if("listItemPrefix"===t[1].type){let i={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=i,e.splice(s,0,["enter",i,t[2]]),s++,n++,a=void 0,o=!0}}}return e[t][1]._spread=c,n}(e,c.pop(),u));for(u=-1;++u<e.length;){let n=t[e[u][0]];yv.call(n,e[u][1].type)&&n[e[u][1].type].call(Object.assign({sliceSerialize:e[u][2].sliceSerialize},o),e[u][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||yy).call(o,void 0,e[0])}for(r.position={start:yx(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:yx(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},u=-1;++u<t.transforms.length;)r=t.transforms[u](r)||r;return r};function r(e,t){return function(n){a.call(this,e(n),n),t&&t.call(this,n)}}function i(){this.stack.push({type:"fragment",children:[]})}function a(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:yx(t.start),end:void 0}}function o(e){return function(t){e&&e.call(this,t),s.call(this,t)}}function s(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||yy).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+vL({start:e.start,end:e.end})+"): it’s not open");n.position.end=yx(e.end)}function l(){return v1(this.stack.pop())}function c(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];n&&"text"===n.type||((n={type:"text",value:""}).position={start:yx(e.start),end:void 0},t.push(n)),this.stack.push(n)}function u(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=yx(e.end)}function d(){this.data.atHardBreak=!0}function h(e){this.data.characterReferenceType=e.type}function f(){return{type:"code",lang:null,meta:null,value:""}}function p(){return{type:"heading",depth:0,children:[]}}function g(){return{type:"break"}}function v(){return{type:"html",value:""}}function x(){return{type:"link",title:null,url:"",children:[]}}function y(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(i)(function(e){for(;!xy(e););return e}((function(e){let t={constructs:v8([yh,...(e||{}).extensions||[]]),content:n(xn),defined:[],document:n(xr),flow:n(xj),lazy:{},string:n(xk),text:n(xE)};return t;function n(e){return function(n){return function(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],l={attempt:p(function(e,t){g(e,t.from)}),check:p(f),consume:function(e){v7(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,v()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=e},enter:function(e,t){let n=t||{};return n.type=e,n.start=h(),c.events.push(["enter",n,c]),s.push(n),n},exit:function(e){let t=s.pop();return t.end=h(),c.events.push(["exit",t,c]),t},interrupt:p(f,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,v()},events:[],now:h,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n,r=-1,i=[];for(;++r<e.length;){let a,o=e[r];if("string"==typeof o)a=o;else switch(o){case -5:a="\r";break;case -4:a="\n";break;case -3:a="\r\n";break;case -2:a=t?" ":" ";break;case -1:if(!t&&n)continue;a=" ";break;default:a=String.fromCharCode(o)}n=-2===o,i.push(a)}return i.join("")}(d(e),t)},sliceStream:d,write:function(e){return(o=v4(o,e),function(){let e;for(;r._index<o.length;){let n=o[r._index];if("string"==typeof n)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<n.length;){var t;t=n.charCodeAt(r._bufferIndex),u=u(t)}else u=u(n)}}(),null!==o[o.length-1])?[]:(g(t,0),c.events=xP(a,c.events,c),c.events)}},u=t.tokenize.call(c,l);return t.resolveAll&&a.push(t),c;function d(e){return function(e,t){let n,r=t.start._index,i=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;if(r===a)n=[e[r].slice(i,o)];else{if(n=e.slice(r,a),i>-1){let e=n[0];"string"==typeof e?n[0]=e.slice(i):n.shift()}o>0&&n.push(e[a].slice(0,o))}return n}(o,e)}function h(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function f(e,t){t.restore()}function p(e,t){return function(n,i,a){var o;let u,d,f,p;return Array.isArray(n)?g(n):"tokenize"in n?g([n]):(o=n,function(e){let t=null!==e&&o[e],n=null!==e&&o.null;return g([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(n)?n:n?[n]:[]])(e)});function g(e){return(u=e,d=0,0===e.length)?a:x(e[d])}function x(e){return function(n){let i,a,o,u,d;return(i=h(),a=c.previous,o=c.currentConstruct,u=c.events.length,d=Array.from(s),p={from:u,restore:function(){r=i,c.previous=a,c.currentConstruct=o,c.events.length=u,s=d,v()}},f=e,e.partial||(c.currentConstruct=e),e.name&&c.parser.constructs.disable.null.includes(e.name))?b(n):e.tokenize.call(t?Object.assign(Object.create(c),t):c,l,y,b)(n)}}function y(t){return e(f,p),i}function b(e){return(p.restore(),++d<u.length)?x(u[d]):a}}}function g(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&v3(c.events,t,c.events.length-t,e.resolve(c.events.slice(t),c)),e.resolveTo&&(c.events=e.resolveTo(c.events,c))}function v(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}(t,e,n)}}})(i).document().write((o=1,s="",l=!0,function(e,t,n){let r,i,c,u,d,h=[];for(e=s+("string"==typeof e?e.toString():new TextDecoder(t||void 0).decode(e)),c=0,s="",l&&(65279===e.charCodeAt(0)&&c++,l=void 0);c<e.length;){if(yf.lastIndex=c,u=(r=yf.exec(e))&&void 0!==r.index?r.index:e.length,d=e.charCodeAt(u),!r){s=e.slice(c);break}if(10===d&&c===u&&a)h.push(-3),a=void 0;else switch(a&&(h.push(-5),a=void 0),c<u&&(h.push(e.slice(c,u)),o+=u-c),d){case 0:h.push(65533),o++;break;case 9:for(i=4*Math.ceil(o/4),h.push(-2);o++<i;)h.push(-1);break;case 10:h.push(-4),o=1;break;default:a=!0,o=1}c=u+1}return n&&(a&&h.push(-5),s&&h.push(s),h.push(null)),h})(n,r,!0))))}}let yw="object"==typeof self?self:globalThis,yj=e=>{var t;let n,r;return(t=new Map,n=(e,n)=>(t.set(n,e),e),r=i=>{if(t.has(i))return t.get(i);let[a,o]=e[i];switch(a){case 0:case -1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new yw[e](t),i)}case 8:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new yw[a](o),i)})(0)},{toString:yN}={},{keys:yk}=Object,yE=e=>{let t=typeof e;if("object"!==t||!e)return[0,t];let n=yN.call(e).slice(8,-1);switch(n){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},yC=([e,t])=>0===e&&("function"===t||"symbol"===t),y_=(e,{json:t,lossy:n}={})=>{var r,i,a;let o,s,l=[];return(r=!(t||n),i=!!t,a=new Map,o=(e,t)=>{let n=l.push(e)-1;return a.set(t,n),n},s=e=>{if(a.has(e))return a.get(e);let[t,n]=yE(e);switch(t){case 0:{let i=e;switch(n){case"bigint":t=8,i=e.toString();break;case"function":case"symbol":if(r)throw TypeError("unable to serialize "+n);i=null;break;case"undefined":return o([-1],e)}return o([t,i],e)}case 1:{if(n){let t=e;return"DataView"===n?t=new Uint8Array(e.buffer):"ArrayBuffer"===n&&(t=new Uint8Array(e)),o([n,[...t]],e)}let r=[],i=o([t,r],e);for(let t of e)r.push(s(t));return i}case 2:{if(n)switch(n){case"BigInt":return o([n,e.toString()],e);case"Boolean":case"Number":case"String":return o([n,e.valueOf()],e)}if(i&&"toJSON"in e)return s(e.toJSON());let a=[],l=o([t,a],e);for(let t of yk(e))(r||!yC(yE(e[t])))&&a.push([s(t),s(e[t])]);return l}case 3:return o([t,e.toISOString()],e);case 4:{let{source:n,flags:r}=e;return o([t,{source:n,flags:r}],e)}case 5:{let n=[],i=o([t,n],e);for(let[t,i]of e)(r||!(yC(yE(t))||yC(yE(i))))&&n.push([s(t),s(i)]);return i}case 6:{let n=[],i=o([t,n],e);for(let t of e)(r||!yC(yE(t)))&&n.push(s(t));return i}}let{message:l}=e;return o([t,{name:n,message:l}],e)})(e),l},yS="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?yj(y_(e,t)):structuredClone(e):(e,t)=>yj(y_(e,t));yA(/[A-Za-z]/);let yT=yA(/[\dA-Za-z]/);function yA(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function yO(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o="";if(37===a&&yT(e.charCodeAt(n+1))&&yT(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o="�"}else o=String.fromCharCode(a);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function yM(e,t){let n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function yP(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}yA(/[#-'*+\--9=?A-Z^-~]/),yA(/\d/),yA(/[\dA-Fa-f]/),yA(/[!-/:-@[-`{-~]/),yA(/\p{P}|\p{S}/u),yA(/\s/);let yD=function(e){var t,n;if(null==e)return yI;if("function"==typeof e)return yL(e);if("object"==typeof e){return Array.isArray(e)?function(e){let t=[],n=-1;for(;++n<e.length;)t[n]=yD(e[n]);return yL(function(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1})}(e):(t=e,yL(function(e){let n;for(n in t)if(e[n]!==t[n])return!1;return!0}))}if("string"==typeof e){return n=e,yL(function(e){return e&&e.type===n})}throw Error("Expected function, string, or object as test")};function yL(e){return function(t,n,r){return!!(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function yI(){return!0}let yR=[];function yB(e,t,n,r){let i;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):i=t;let a=yD(i),o=r?-1:1;(function e(i,s,l){let c=i&&"object"==typeof i?i:{};if("string"==typeof c.type){let e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(u,"name",{value:"node ("+i.type+(e?"<"+e+">":"")+")"})}return u;function u(){var c;let u,d,h,f=yR;if((!t||a(i,s,l[l.length-1]||void 0))&&!1===(f=Array.isArray(c=n(i,l))?c:"number"==typeof c?[!0,c]:null==c?yR:[c])[0])return f;if("children"in i&&i.children&&i.children&&"skip"!==f[0])for(d=(r?i.children.length:-1)+o,h=l.concat(i);d>-1&&d<i.children.length;){if(!1===(u=e(i.children[d],d,h)())[0])return u;d="number"==typeof u[1]?u[1]:d+o}return f}})(e,void 0,[])()}function yz(e,t,n,r){let i,a,o;"function"==typeof t&&"function"!=typeof n?(a=void 0,o=t,i=n):(a=t,o=n,i=r),yB(e,a,function(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)},i)}function yF(e,t){let n=t.referenceType,r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+r}];let i=e.all(t),a=i[0];a&&"text"===a.type?a.value="["+a.value:i.unshift({type:"text",value:"["});let o=i[i.length-1];return o&&"text"===o.type?o.value+=r:i.push({type:"text",value:r}),i}function yV(e){let t=e.spread;return null==t?e.children.length>1:t}function yU(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;9===t||32===t;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}let yH={blockquote:function(e,t){let n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function(e,t){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){let n=t.value?t.value+"\n":"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a={type:"element",tagName:"pre",properties:{},children:[a=e.applyData(t,a)]},e.patch(t,a),a},delete:function(e,t){let n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){let n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){let n,r="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),a=yO(i.toLowerCase()),o=e.footnoteOrder.indexOf(i),s=e.footnoteCounts.get(i);void 0===s?(s=0,e.footnoteOrder.push(i),n=e.footnoteOrder.length):n=o+1,s+=1,e.footnoteCounts.set(i,s);let l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+a,id:r+"fnref-"+a+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(n)}]};e.patch(t,l);let c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)},heading:function(e,t){let n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){let n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return yF(e,t);let i={src:yO(r.url||""),alt:t.alt};null!==r.title&&void 0!==r.title&&(i.title=r.title);let a={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)},image:function(e,t){let n={src:yO(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(e,t){let n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);let r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)},linkReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return yF(e,t);let i={href:yO(r.url||"")};null!==r.title&&void 0!==r.title&&(i.title=r.title);let a={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)},link:function(e,t){let n={href:yO(t.url)};null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},listItem:function(e,t,n){let r=e.all(t),i=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=yV(n[r])}return t}(n):yV(t),a={},o=[];if("boolean"==typeof t.checked){let e,n=r[0];n&&"element"===n.type&&"p"===n.tagName?e=n:(e={type:"element",tagName:"p",properties:{},children:[]},r.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let s=-1;for(;++s<r.length;){let e=r[s];(i||0!==s||"element"!==e.type||"p"!==e.tagName)&&o.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||i?o.push(e):o.push(...e.children)}let l=r[r.length-1];l&&(i||"element"!==l.type||"p"!==l.tagName)&&o.push({type:"text",value:"\n"});let c={type:"element",tagName:"li",properties:a,children:o};return e.patch(t,c),e.applyData(t,c)},list:function(e,t){let n={},r=e.all(t),i=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++i<r.length;){let e=r[i];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}let a={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)},paragraph:function(e,t){let n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){let n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){let n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=vP(t.children[1]),o=vM(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)},tableCell:function(e,t){let n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){let r=n?n.children:void 0,i=0===(r?r.indexOf(t):1)?"th":"td",a=n&&"table"===n.type?n.align:void 0,o=a?a.length:t.children.length,s=-1,l=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let c={type:"element",tagName:i,properties:r,children:[]};n&&(c.children=e.all(n),e.patch(n,c),c=e.applyData(n,c)),l.push(c)}let c={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,c),e.applyData(t,c)},text:function(e,t){let n={type:"text",value:function(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(yU(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(yU(t.slice(i),i>0,!1)),a.join("")}(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){let n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:yW,yaml:yW,definition:yW,footnoteDefinition:yW};function yW(){}let yY={}.hasOwnProperty,yG={};function y$(e,t){e.position&&(t.position=function(e){let t=vP(e),n=vM(e);if(t&&n)return{start:t,end:n}}(e))}function yX(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;"string"==typeof t&&("element"===n.type?n.tagName=t:n={type:"element",tagName:t,properties:{},children:"children"in n?n.children:[n]}),"element"===n.type&&i&&Object.assign(n.properties,yS(i)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function yq(e,t){let n=[],r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function yK(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function yZ(e,t){let n,r,i,a,o=(n=t||yG,r=new Map,i=new Map,a={all:function(e){let t=[];if("children"in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&"break"===n[r-1].type&&(Array.isArray(i)||"text"!==i.type||(i.value=yK(i.value)),!Array.isArray(i)&&"element"===i.type)){let e=i.children[0];e&&"text"===e.type&&(e.value=yK(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t},applyData:yX,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...yH,...n.handlers},one:function(e,t){let n=e.type,r=a.handlers[n];if(yY.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if("children"in e){let{children:t,...n}=e,r=yS(n);return r.children=a.all(e),r}return yS(e)}return(a.options.unknownHandler||function(e,t){let n=t.data||{},r="value"in t&&!(yY.call(n,"hProperties")||yY.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)})(a,e,t)},options:n,patch:y$,wrap:yq},yz(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let t="definition"===e.type?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a),s=o.one(e,void 0),l=function(e){let t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||yM,r=e.options.footnoteBackLabel||yP,i=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[],l=-1;for(;++l<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[l]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),c=yO(o.toLowerCase()),u=0,d=[],h=e.footnoteCounts.get(o);for(;void 0!==h&&++u<=h;){d.length>0&&d.push({type:"text",value:" "});let e="string"==typeof n?n:n(l,u);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+c+(u>1?"-"+u:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(l,u),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}let f=a[a.length-1];if(f&&"element"===f.type&&"p"===f.tagName){let e=f.children[f.children.length-1];e&&"text"===e.type?e.value+=" ":f.children.push({type:"text",value:" "}),f.children.push(...d)}else a.push(...d);let p={type:"element",tagName:"li",properties:{id:t+"fn-"+c},children:e.wrap(a,!0)};e.patch(i,p),s.push(p)}if(0!==s.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...yS(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!0)},{type:"text",value:"\n"}]}}(o),c=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&(g0("children"in c),c.children.push({type:"text",value:"\n"},l)),c}function yQ(e,t){return e&&"run"in e?async function(n,r){let i=yZ(n,{file:r,...t});await e.run(i,r)}:function(n,r){return yZ(n,{file:r,...e||t})}}function yJ(e){if(e)throw e}var y0=e.i(4100);function y1(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let y2=function(e,t){let n;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');y6(e);let r=0,i=-1,a=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;a--;)if(47===e.codePointAt(a)){if(n){r=a+1;break}}else i<0&&(n=!0,i=a+1);return i<0?"":e.slice(r,i)}if(t===e)return"";let o=-1,s=t.length-1;for(;a--;)if(47===e.codePointAt(a)){if(n){r=a+1;break}}else o<0&&(n=!0,o=a+1),s>-1&&(e.codePointAt(a)===t.codePointAt(s--)?s<0&&(i=a):(s=-1,i=o));return r===i?i=o:i<0&&(i=e.length),e.slice(r,i)},y5=function(e){let t;if(y6(e),0===e.length)return".";let n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},y3=function(e){let t;y6(e);let n=e.length,r=-1,i=0,a=-1,o=0;for(;n--;){let s=e.codePointAt(n);if(47===s){if(t){i=n+1;break}continue}r<0&&(t=!0,r=n+1),46===s?a<0?a=n:1!==o&&(o=1):a>-1&&(o=-1)}return a<0||r<0||0===o||1===o&&a===r-1&&a===i+1?"":e.slice(a,r)},y4=function(...e){var t;let n,r,i,a=-1;for(;++a<e.length;)y6(e[a]),e[a]&&(i=void 0===i?e[a]:i+"/"+e[a]);return void 0===i?".":(y6(t=i),n=47===t.codePointAt(0),0!==(r=function(e,t){let n,r,i="",a=0,o=-1,s=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.codePointAt(l);else if(47===n)break;else n=47;if(47===n){if(o===l-1||1===s);else if(o!==l-1&&2===s){if(i.length<2||2!==a||46!==i.codePointAt(i.length-1)||46!==i.codePointAt(i.length-2)){if(i.length>2){if((r=i.lastIndexOf("/"))!==i.length-1){r<0?(i="",a=0):a=(i=i.slice(0,r)).length-1-i.lastIndexOf("/"),o=l,s=0;continue}}else if(i.length>0){i="",a=0,o=l,s=0;continue}}t&&(i=i.length>0?i+"/..":"..",a=2)}else i.length>0?i+="/"+e.slice(o+1,l):i=e.slice(o+1,l),a=l-o-1;o=l,s=0}else 46===n&&s>-1?s++:s=-1}return i}(t,!n)).length||n||(r="."),r.length>0&&47===t.codePointAt(t.length-1)&&(r+="/"),n?"/"+r:r)};function y6(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function y8(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let y7=["history","path","basename","stem","extname","dirname"];class y9{constructor(e){let t,n;t=e?y8(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":"/",this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<y7.length;){const e=y7[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)y7.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?y2(this.path):void 0}set basename(e){bt(e,"basename"),be(e,"basename"),this.path=y4(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?y5(this.path):void 0}set dirname(e){bn(this.basename,"dirname"),this.path=y4(e||"",this.basename)}get extname(){return"string"==typeof this.path?y3(this.path):void 0}set extname(e){if(be(e,"extname"),bn(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=y4(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){y8(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!y8(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){let e=TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}let t=e.pathname,n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){let e=t.codePointAt(n+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),bt(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?y2(this.path,this.extname):void 0}set stem(e){bt(e,"stem"),be(e,"stem"),this.path=y4(this.dirname||"",e+(this.extname||""))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new vz(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function be(e,t){if(e&&e.includes("/"))throw Error("`"+t+"` cannot be a path: did not expect `/`")}function bt(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function bn(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}let br=function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},bi={}.hasOwnProperty;class ba extends br{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){let e=[],t={run:function(...t){let n=-1,r=t.pop();if("function"!=typeof r)throw TypeError("Expected function as last argument, not "+r);!function i(a,...o){let s=e[++n],l=-1;if(a)return void r(a);for(;++l<t.length;)(null===o[l]||void 0===o[l])&&(o[l]=t[l]);t=o,s?(function(e,t){let n;return function(...t){let a,o=e.length>t.length;o&&t.push(r);try{a=e.apply(this,t)}catch(e){if(o&&n)throw e;return r(e)}o||(a&&a.then&&"function"==typeof a.then?a.then(i,r):a instanceof Error?r(a):i(a))};function r(e,...i){n||(n=!0,t(e,...i))}function i(e){r(null,e)}})(s,i)(...o):r(null,...o)}(null,...t)},use:function(n){if("function"!=typeof n)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}()}copy(){let e=new ba,t=-1;for(;++t<this.attachers.length;){let n=this.attachers[t];e.use(...n)}return e.data((0,y0.default)(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2==arguments.length?(bc("data",this.frozen),this.namespace[e]=t,this):bi.call(this.namespace,e)&&this.namespace[e]||void 0:e?(bc("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...t]=this.attachers[this.freezeIndex];if(!1===t[0])continue;!0===t[0]&&(t[0]=void 0);let n=e.call(this,...t);"function"==typeof n&&this.transformers.use(n)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=bh(e),n=this.parser||this.Parser;return bs("parse",n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),bs("process",this.parser||this.Parser),bl("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=bh(e),o=n.parse(a);function s(e,n){e||!n?i(e):r?r(n):(g0(t,"`done` is defined if `resolve` is not"),t(void 0,n))}n.run(o,a,function(e,t,r){var i,a;if(e||!t||!r)return s(e);let o=n.stringify(t,r);"string"==typeof(i=o)||(a=i)&&"object"==typeof a&&"byteLength"in a&&"byteOffset"in a?r.value=o:r.result=o,s(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),bs("processSync",this.parser||this.Parser),bl("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,yJ(e),t=r}),bd("processSync","process",n),g0(t,"we either bailed on an error or have a tree"),t}run(e,t,n){bu(e),this.freeze();let r=this.transformers;return n||"function"!=typeof t||(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){g0("function"!=typeof t,"`file` can’t be a `done` anymore, we checked");let o=bh(t);r.run(e,o,function(t,r,o){let s=r||e;t?a(t):i?i(s):(g0(n,"`done` is defined if `resolve` is not"),n(void 0,s,o))})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){yJ(e),n=t,r=!0}),bd("runSync","run",r),g0(n,"we either bailed on an error or have a tree"),n}stringify(e,t){this.freeze();let n=bh(t),r=this.compiler||this.Compiler;return bl("stringify",r),bu(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(bc("use",this.frozen),null==e);else if("function"==typeof e)o(e,t);else if("object"==typeof e)Array.isArray(e)?a(e):i(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(!("plugins"in e)&&!("settings"in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(e.plugins),e.settings&&(r.settings=(0,y0.default)(!0,r.settings,e.settings))}function a(e){let t=-1;if(null==e);else if(Array.isArray(e))for(;++t<e.length;)!function(e){if("function"==typeof e)o(e,[]);else if("object"==typeof e)if(Array.isArray(e)){let[t,...n]=e;o(t,n)}else i(e);else throw TypeError("Expected usable value, not `"+e+"`")}(e[t]);else throw TypeError("Expected a list of plugins, not `"+e+"`")}function o(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(-1===i)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];y1(o)&&y1(r)&&(r=(0,y0.default)(!0,o,r)),n[i]=[e,r,...a]}}}}let bo=new ba().freeze();function bs(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `parser`")}function bl(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `compiler`")}function bc(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function bu(e){if(!y1(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function bd(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function bh(e){var t;return(t=e)&&"object"==typeof t&&"message"in t&&"messages"in t?e:new y9(e)}let bf=[],bp={allowDangerousHtml:!0},bm=/^(https?|ircs?|mailto|xmpp)$/i,bg=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function bv(e){var t;let n,r,i,a,o,s=(n=(t=e).rehypePlugins||bf,r=t.remarkPlugins||bf,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...bp}:bp,bo().use(yb).use(r).use(yQ,i).use(n)),l=(a=e.children||"",o=new y9,"string"==typeof a?o.value=a:g1("Unexpected value `"+a+"` for `children` prop, expected `string`"),o);return function(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,l=t.urlTransform||bx;for(let e of bg)Object.hasOwn(t,e.from)&&g1("Unexpected `"+e.from+"` prop, "+(e.to?"use `"+e.to+"` instead":"remove it")+" (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#"+e.id+"> for more info)");return n&&a&&g1("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),yz(e,function(e,t,i){if("raw"===e.type&&i&&"number"==typeof t)return o?i.children.splice(t,1):i.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in vJ)if(Object.hasOwn(vJ,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=vJ[t];(null===r||r.includes(e.tagName))&&(e.properties[t]=l(String(n||""),t,e))}}if("element"===e.type){let o=n?!n.includes(e.tagName):!!a&&a.includes(e.tagName);if(!o&&r&&"number"==typeof t&&(o=!r(e,t,i)),o&&i&&"number"==typeof t)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}),function(e,t){var n,r,i,a;let o;if(!t||void 0===t.Fragment)throw TypeError("Expected `Fragment` in options");let s=t.filePath||void 0;if(t.development){if("function"!=typeof t.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");n=s,r=t.jsxDEV,o=function(e,t,i,a){let o=Array.isArray(i.children),s=vP(e);return r(t,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:n,lineNumber:s?s.line:void 0},void 0)}}else{if("function"!=typeof t.jsx)throw TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw TypeError("Expected `jsxs` in production options");i=t.jsx,a=t.jsxs,o=function(e,t,n,r){let o=Array.isArray(n.children)?a:i;return r?o(t,n,r):o(t,n)}}let l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:o,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:s,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?vA:vT,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},c=vG(l,e,void 0);return c&&"string"!=typeof c?c:l.create(e,l.Fragment,{children:c||void 0},void 0)}(e,{Fragment:ep.Fragment,components:i,ignoreInvalidStyle:!0,jsx:ep.jsx,jsxs:ep.jsxs,passKeys:!0,passNode:!0})}(s.runSync(s.parse(l),l),e)}function bx(e){let t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return -1===t||-1!==i&&t>i||-1!==n&&t>n||-1!==r&&t>r||bm.test(e.slice(0,t))?e:""}function by(e,t){let n=String(e);if("string"!=typeof t)throw TypeError("Expected character");let r=0,i=n.indexOf(t);for(;-1!==i;)r++,i=n.indexOf(t,i+t.length);return r}bj(/[A-Za-z]/),bj(/[\dA-Za-z]/),bj(/[#-'*+\--9=?A-Z^-~]/),bj(/\d/),bj(/[\dA-Fa-f]/),bj(/[!-/:-@[-`{-~]/);let bb=bj(/\p{P}|\p{S}/u),bw=bj(/\s/);function bj(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}let bN="phrasing",bk=["autolink","link","image","label"];function bE(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function bC(e){this.config.enter.autolinkProtocol.call(this,e)}function b_(e){this.config.exit.autolinkProtocol.call(this,e)}function bS(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];g0("link"===t.type),t.url="http://"+this.sliceSerialize(e)}function bT(e){this.config.exit.autolinkEmail.call(this,e)}function bA(e){this.exit(e)}function bO(e){!function(e,t,n){let r=yD((n||{}).ignore||[]),i=function(e){let t=[];if(!Array.isArray(e))throw TypeError("Expected find and replace tuple or list of tuples");let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){var i;let e=n[r];t.push(["string"==typeof(i=e[0])?RegExp(function(e){if("string"!=typeof e)throw TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(i),"g"):i,function(e){return"function"==typeof e?e:function(){return e}}(e[1])])}return t}(t),a=-1;for(;++a<i.length;)yB(e,"text",o);function o(e,t){let n,o=-1;for(;++o<t.length;){let e=t[o],i=n?n.children:void 0;if(r(e,i?i.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,l=n.children.indexOf(e),c=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if("string"==typeof a&&(a=a.length>0?{type:"text",value:a}:void 0),!1===a?r.lastIndex=n+1:(s!==n&&u.push({type:"text",value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,c=!0),!r.global)break;d=r.exec(e.value)}return c?(s<e.value.length&&u.push({type:"text",value:e.value.slice(s)}),n.children.splice(l,1,...u)):u=[e],l+u.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,bM],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,bP]],{ignore:["link","linkReference"]})}function bM(e,t,n,r,i){let a,o="";if(!bD(i))return!1;if(/^w/i.test(t)&&(n=t+n,t="",o="http://"),(a=n.split(".")).length<2||a[a.length-1]&&(/_/.test(a[a.length-1])||!/[a-zA-Z\d]/.test(a[a.length-1]))||a[a.length-2]&&(/_/.test(a[a.length-2])||!/[a-zA-Z\d]/.test(a[a.length-2])))return!1;let s=function(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")"),i=by(e,"("),a=by(e,")");for(;-1!==r&&i>a;)e+=n.slice(0,r+1),r=(n=n.slice(r+1)).indexOf(")"),a++;return[e,n]}(n+r);if(!s[0])return!1;let l={type:"link",title:null,url:o+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[l,{type:"text",value:s[1]}]:l}function bP(e,t,n,r){return!(!bD(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function bD(e,t){let n=e.input.charCodeAt(e.index-1);return(0===e.index||bw(n)||bb(n))&&(!t||47!==n)}function bL(){this.buffer()}function bI(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function bR(){this.buffer()}function bB(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function bz(e){let t=this.resume(),n=this.stack[this.stack.length-1];g0("footnoteReference"===n.type),n.identifier=x3(this.sliceSerialize(e)).toLowerCase(),n.label=t}function bF(e){this.exit(e)}function bV(e){let t=this.resume(),n=this.stack[this.stack.length-1];g0("footnoteDefinition"===n.type),n.identifier=x3(this.sliceSerialize(e)).toLowerCase(),n.label=t}function bU(e){this.exit(e)}function bH(e,t,n,r){let i=n.createTracker(r),a=i.move("[^"),o=n.enter("footnoteReference"),s=n.enter("reference");return a+=i.move(n.safe(n.associationId(e),{after:"]",before:a})),s(),o(),a+=i.move("]")}function bW(e,t,n){return 0===t?e:bY(e,t,n)}function bY(e,t,n){return(n?"":" ")+e}bH.peek=function(){return"["};let bG=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function b$(e){this.enter({type:"delete",children:[]},e)}function bX(e){this.exit(e)}function bq(e,t,n,r){let i=n.createTracker(r),a=n.enter("strikethrough"),o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),a(),o}function bK(e){return e.length}function bZ(e){let t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:114*(82===t||114===t)}bq.peek=function(){return"~"};function bQ(e,t,n){let r=e.value||"",i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++a<n.unsafe.length;){let e,t=n.unsafe[a],i=n.compilePattern(t);if(t.atBreak)for(;e=i.exec(r);){let t=e.index;10===r.charCodeAt(t)&&13===r.charCodeAt(t-1)&&t--,r=r.slice(0,t)+" "+r.slice(e.index+1)}}return i+r+i}bQ.peek=function(){return"`"};yD(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let bJ=function(e,t,n,r){let i=function(e){let t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n),a=n.bulletCurrent||function(e){let t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}(n);t&&"list"===t.type&&t.ordered&&(a=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+a);let o=a.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(o=4*Math.ceil(o/4));let s=n.createTracker(r);s.move(a+" ".repeat(o-a.length)),s.shift(o);let l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,s.current()),function(e,t,n){return t?(n?"":" ".repeat(o))+e:(n?a:a+" ".repeat(o-a.length))+e});return l(),c};function b0(e){let t=e._align;g0(t,"expected `_align` on table"),this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function b1(e){this.exit(e),this.data.inTable=void 0}function b2(e){this.enter({type:"tableRow",children:[]},e)}function b5(e){this.exit(e)}function b3(e){this.enter({type:"tableCell",children:[]},e)}function b4(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,b6));let n=this.stack[this.stack.length-1];g0("inlineCode"===n.type),n.value=t,this.exit(e)}function b6(e,t){return"|"===t?t:e}function b8(e){let t=this.stack[this.stack.length-2];g0("listItem"===t.type),t.checked="taskListCheckValueChecked"===e.type}function b7(e){let t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){let e=this.stack[this.stack.length-1];g0("paragraph"===e.type);let n=e.children[0];if(n&&"text"===n.type){let r,i=t.children,a=-1;for(;++a<i.length;){let e=i[a];if("paragraph"===e.type){r=e;break}}r===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function b9(e,t,n,r){let i=e.children[0],a="boolean"==typeof e.checked&&i&&"paragraph"===i.type,o="["+(e.checked?"x":" ")+"] ",s=n.createTracker(r);a&&s.move(o);let l=bJ(e,t,n,{...r,...s.current()});return a&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+o})),l}let we=wa(/[A-Za-z]/),wt=wa(/[\dA-Za-z]/);function wn(e){return null!==e&&(e<0||32===e)}wa(/[#-'*+\--9=?A-Z^-~]/),wa(/\d/),wa(/[\dA-Fa-f]/),wa(/[!-/:-@[-`{-~]/);let wr=wa(/\p{P}|\p{S}/u),wi=wa(/\s/);function wa(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}let wo={tokenize:function(e,t,n){let r=0;return function t(a){return(87===a||119===a)&&r<3?(r++,e.consume(a),t):46===a&&3===r?(e.consume(a),i):n(a)};function i(e){return null===e?n(e):t(e)}},partial:!0},ws={tokenize:function(e,t,n){let r,i,a;return o;function o(t){return 46===t||95===t?e.check(wc,l,s)(t):null===t||wn(t)||wi(t)||45!==t&&wr(t)?l(t):(a=!0,e.consume(t),o)}function s(t){return 95===t?r=!0:(i=r,r=void 0),e.consume(t),o}function l(e){return i||r||!a?n(e):t(e)}},partial:!0},wl={tokenize:function(e,t){let n=0,r=0;return i;function i(o){return 40===o?(n++,e.consume(o),i):41===o&&r<n?a(o):33===o||34===o||38===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||60===o||63===o||93===o||95===o||126===o?e.check(wc,t,a)(o):null===o||wn(o)||wi(o)?t(o):(e.consume(o),i)}function a(t){return 41===t&&r++,e.consume(t),i}},partial:!0},wc={tokenize:function(e,t,n){return r;function r(o){return 33===o||34===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||63===o||95===o||126===o?(e.consume(o),r):38===o?(e.consume(o),a):93===o?(e.consume(o),i):60===o||null===o||wn(o)||wi(o)?t(o):n(o)}function i(e){return null===e||40===e||91===e||wn(e)||wi(e)?t(e):r(e)}function a(t){return we(t)?function t(i){return 59===i?(e.consume(i),r):we(i)?(e.consume(i),t):n(i)}(t):n(t)}},partial:!0},wu={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return wt(e)?n(e):t(e)}},partial:!0},wd={name:"wwwAutolink",tokenize:function(e,t,n){let r=this;return function(t){return 87!==t&&119!==t||!wg.call(r,r.previous)||wb(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(wo,e.attempt(ws,e.attempt(wl,i),n),n)(t))};function i(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:wg},wh={name:"protocolAutolink",tokenize:function(e,t,n){let r=this,i="",a=!1;return function(t){return(72===t||104===t)&&wv.call(r,r.previous)&&!wb(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(t),e.consume(t),o):n(t)};function o(t){if(we(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),o;if(58===t){let n=i.toLowerCase();if("http"===n||"https"===n)return e.consume(t),s}return n(t)}function s(t){return 47===t?(e.consume(t),a)?l:(a=!0,s):n(t)}function l(t){return null===t||null!==t&&(t<32||127===t)||wn(t)||wi(t)||wr(t)?n(t):e.attempt(ws,e.attempt(wl,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:wv},wf={name:"emailAutolink",tokenize:function(e,t,n){let r,i,a=this;return function(t){return!wy(t)||!wx.call(a,a.previous)||wb(a.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),function t(r){return wy(r)?(e.consume(r),t):64===r?(e.consume(r),o):n(r)}(t))};function o(t){return 46===t?e.check(wu,l,s)(t):45===t||95===t||wt(t)?(i=!0,e.consume(t),o):l(t)}function s(t){return e.consume(t),r=!0,o}function l(o){return i&&r&&we(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(o)):n(o)}},previous:wx},wp={},wm=48;for(;wm<123;)wp[wm]=wf,58==++wm?wm=65:91===wm&&(wm=97);function wg(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||wn(e)}function wv(e){return!we(e)}function wx(e){return!(47===e||wy(e))}function wy(e){return 43===e||45===e||46===e||95===e||wt(e)}function wb(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function ww(e){return null!==e&&(e<0||32===e)}function wj(e){return -2===e||-1===e||32===e}function wN(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function wk(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return wj(r)?(e.enter(n),function r(o){return wj(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}wp[43]=wf,wp[45]=wf,wp[46]=wf,wp[95]=wf,wp[72]=[wf,wh],wp[104]=[wf,wh],wp[87]=[wf,wd],wp[119]=[wf,wd],wN(/[A-Za-z]/),wN(/[\dA-Za-z]/),wN(/[#-'*+\--9=?A-Z^-~]/),wN(/\d/),wN(/[\dA-Fa-f]/),wN(/[!-/:-@[-`{-~]/),wN(/\p{P}|\p{S}/u),wN(/\s/);let wE={tokenize:function(e,t,n){let r=this;return wk(e,function(e){let i=r.events[r.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function wC(e,t,n){let r,i=this,a=i.events.length,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);for(;a--;){let e=i.events[a][1];if("labelImage"===e.type){r=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(a){if(!r||!r._balanced)return n(a);let s=x3(i.sliceSerialize({start:r.end,end:i.now()}));return 94===s.codePointAt(0)&&o.includes(s.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a)):n(a)}}function w_(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";let r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...s),e}function wS(e,t,n){let r,i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),o=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),s};function s(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(s){if(o>999||93===s&&!r||null===s||91===s||ww(s))return n(s);if(93===s){e.exit("chunkString");let r=e.exit("gfmFootnoteCallString");return a.includes(x3(i.sliceSerialize(r)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(s)}return ww(s)||(r=!0),o++,e.consume(s),92===s?c:l}function c(t){return 91===t||92===t||93===t?(e.consume(t),o++,l):l(t)}}function wT(e,t,n){let r,i,a=this,o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]),s=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(s>999||93===t&&!i||null===t||91===t||ww(t))return n(t);if(93===t){e.exit("chunkString");let n=e.exit("gfmFootnoteDefinitionLabelString");return r=x3(a.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return ww(t)||(i=!0),s++,e.consume(t),92===t?u:c}function u(t){return 91===t||92===t||93===t?(e.consume(t),s++,c):c(t)}function d(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o.includes(r)||o.push(r),wk(e,h,"gfmFootnoteDefinitionWhitespace")):n(t)}function h(e){return t(e)}}function wA(e,t,n){return e.check(xg,t,e.attempt(wE,t,n))}function wO(e){e.exit("gfmFootnoteDefinition")}function wM(e){return null!==e&&e<-2}function wP(e){return null!==e&&(e<0||32===e)}function wD(e){return -2===e||-1===e||32===e}function wL(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function wI(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return wD(r)?(e.enter(n),function r(o){return wD(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}wL(/[A-Za-z]/),wL(/[\dA-Za-z]/),wL(/[#-'*+\--9=?A-Z^-~]/),wL(/\d/),wL(/[\dA-Fa-f]/),wL(/[!-/:-@[-`{-~]/),wL(/\p{P}|\p{S}/u),wL(/\s/);class wR{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let i=0;if(0!==n||0!==r.length){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length,n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}}function wB(e,t,n){let r,i=this,a=0,o=0;return function(e){let t=i.events.length-1;for(;t>-1;){let e=i.events[t][1].type;if("lineEnding"===e||"linePrefix"===e)t--;else break}let r=t>-1?i.events[t][1].type:null,a="tableHead"===r||"tableRow"===r?y:s;return a===y&&i.parser.lazy[i.now().line]?n(e):a(e)};function s(t){var n;return e.enter("tableHead"),e.enter("tableRow"),124===(n=t)||(r=!0,o+=1),l(n)}function l(t){return null===t?n(t):wM(t)?o>1?(o=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):n(t):wD(t)?wI(e,l,"whitespace")(t):(o+=1,r&&(r=!1,a+=1),124===t)?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),r=!0,l):(e.enter("data"),c(t))}function c(t){return null===t||124===t||wP(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return 92===t||124===t?(e.consume(t),c):c(t)}function d(t){return(i.interrupt=!1,i.parser.lazy[i.now().line])?n(t):(e.enter("tableDelimiterRow"),r=!1,wD(t))?wI(e,h,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):h(t)}function h(t){return 45===t||58===t?p(t):124===t?(r=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),f):n(t)}function f(t){return wD(t)?wI(e,p,"whitespace")(t):p(t)}function p(t){return 58===t?(o+=1,r=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),g):45===t?(o+=1,g(t)):null===t||wM(t)?x(t):n(t)}function g(t){return 45===t?(e.enter("tableDelimiterFiller"),function t(n){return 45===n?(e.consume(n),t):58===n?(r=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(n),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(n))}(t)):n(t)}function v(t){return wD(t)?wI(e,x,"whitespace")(t):x(t)}function x(i){if(124===i)return h(i);if(null===i||wM(i))return r&&a===o?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(i)):n(i);return n(i)}function y(t){return e.enter("tableRow"),b(t)}function b(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),b):null===n||wM(n)?(e.exit("tableRow"),t(n)):wD(n)?wI(e,b,"whitespace")(n):(e.enter("data"),w(n))}function w(t){return null===t||124===t||wP(t)?(e.exit("data"),b(t)):(e.consume(t),92===t?j:w)}function j(t){return 92===t||124===t?(e.consume(t),w):w(t)}}function wz(e,t){let n,r,i,a=-1,o=!0,s=0,l=[0,0,0,0],c=[0,0,0,0],u=!1,d=0,h=new wR;for(;++a<e.length;){let f=e[a],p=f[1];"enter"===f[0]?"tableHead"===p.type?(u=!1,0!==d&&(wV(h,t,d,n,r),r=void 0,d=0),n={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},h.add(a,0,[["enter",n,t]])):"tableRow"===p.type||"tableDelimiterRow"===p.type?(o=!0,i=void 0,l=[0,0,0,0],c=[0,a+1,0,0],u&&(u=!1,r={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},h.add(a,0,[["enter",r,t]])),s="tableDelimiterRow"===p.type?2:r?3:1):s&&("data"===p.type||"tableDelimiterMarker"===p.type||"tableDelimiterFiller"===p.type)?(o=!1,0===c[2]&&(0!==l[1]&&(c[0]=c[1],i=wF(h,t,l,s,void 0,i),l=[0,0,0,0]),c[2]=a)):"tableCellDivider"===p.type&&(o?o=!1:(0!==l[1]&&(c[0]=c[1],i=wF(h,t,l,s,void 0,i)),c=[(l=c)[1],a,0,0])):"tableHead"===p.type?(u=!0,d=a):"tableRow"===p.type||"tableDelimiterRow"===p.type?(d=a,0!==l[1]?(c[0]=c[1],i=wF(h,t,l,s,a,i)):0!==c[1]&&(i=wF(h,t,c,s,a,i)),s=0):s&&("data"===p.type||"tableDelimiterMarker"===p.type||"tableDelimiterFiller"===p.type)&&(c[3]=a)}for(0!==d&&wV(h,t,d,n,r),h.consume(t.events),a=-1;++a<t.events.length;){let e=t.events[a];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=function(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if("enter"===i[0])"tableContent"===i[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===i[1].type){if("tableDelimiterMarker"===e[t-1][1].type){let e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===i[1].type)break}else"enter"===i[0]&&"tableDelimiterRow"===i[1].type&&(n=!0);t+=1}return r}(t.events,a))}return e}function wF(e,t,n,r,i,a){0!==n[0]&&(a.end=Object.assign({},wU(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));let o=wU(t.events,n[1]);if(a={type:1===r?"tableHeader":2===r?"tableDelimiter":"tableData",start:Object.assign({},o),end:Object.assign({},o)},e.add(n[1],0,[["enter",a,t]]),0!==n[2]){let i=wU(t.events,n[2]),a=wU(t.events,n[3]),o={type:"tableContent",start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[["enter",o,t]]),2!==r){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",o,t]])}return void 0!==i&&(a.end=Object.assign({},wU(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function wV(e,t,n,r,i){let a=[],o=wU(t.events,n);i&&(i.end=Object.assign({},o),a.push(["exit",i,t])),r.end=Object.assign({},o),a.push(["exit",r,t]),e.add(n+1,0,a)}function wU(e,t){let n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}function wH(e){return -2===e||-1===e||32===e}function wW(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}wW(/[A-Za-z]/),wW(/[\dA-Za-z]/),wW(/[#-'*+\--9=?A-Z^-~]/),wW(/\d/),wW(/[\dA-Fa-f]/),wW(/[!-/:-@[-`{-~]/),wW(/\p{P}|\p{S}/u),wW(/\s/);let wY={name:"tasklistCheck",tokenize:function(e,t,n){let r=this;return function(t){return null===r.previous&&r._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),i):n(t)};function i(t){return null!==t&&(t<0||32===t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),a):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),a):n(t)}function a(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(t)}function o(r){return null!==r&&r<-2?t(r):wH(r)?e.check({tokenize:wG},t,n)(r):n(r)}}};function wG(e,t,n){var r,i;let a,o;return r=function(e){return null===e?n(e):t(e)},i="whitespace",a=1/0,o=0,function(t){return wH(t)?(e.enter(i),function t(n){return wH(n)&&o++<a?(e.consume(n),t):(e.exit(i),r(n))}(t)):r(t)}}let w$={};function wX(e){let t,n,r,i=e||w$,a=this.data(),o=a.micromarkExtensions||(a.micromarkExtensions=[]),s=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),l=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);o.push(v8([{text:wp},{document:{91:{name:"gfmFootnoteDefinition",tokenize:wT,continuation:{tokenize:wA},exit:wO}},text:{91:{name:"gfmFootnoteCall",tokenize:wS},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:wC,resolveTo:w_}}},(t=(i||{}).singleTilde,n={name:"strikethrough",tokenize:function(e,n,r){let i=this.previous,a=this.events,o=0;return function(s){return 126===i&&"characterEscape"!==a[a.length-1][1].type?r(s):(e.enter("strikethroughSequenceTemporary"),function a(s){let l=xM(i);if(126===s)return o>1?r(s):(e.consume(s),o++,a);if(o<2&&!t)return r(s);let c=e.exit("strikethroughSequenceTemporary"),u=xM(s);return c._open=!u||2===u&&!!l,c._close=!l||2===l&&!!u,n(s)}(s))}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset==e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";let i={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[["enter",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",a,t]],s=t.parser.constructs.insideSpan.null;s&&v3(o,o.length,0,xP(s,e.slice(r+1,n),t)),v3(o,o.length,0,[["exit",a,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",i,t]]),v3(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}},null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}),{flow:{null:{name:"table",tokenize:wB,resolveAll:wz}}},{text:{91:wY}}])),s.push([{transforms:[bO],enter:{literalAutolink:bE,literalAutolinkEmail:bC,literalAutolinkHttp:bC,literalAutolinkWww:bC},exit:{literalAutolink:bA,literalAutolinkEmail:bT,literalAutolinkHttp:b_,literalAutolinkWww:bS}},{enter:{gfmFootnoteCallString:bL,gfmFootnoteCall:bI,gfmFootnoteDefinitionLabelString:bR,gfmFootnoteDefinition:bB},exit:{gfmFootnoteCallString:bz,gfmFootnoteCall:bF,gfmFootnoteDefinitionLabelString:bV,gfmFootnoteDefinition:bU}},{canContainEols:["delete"],enter:{strikethrough:b$},exit:{strikethrough:bX}},{enter:{table:b0,tableData:b3,tableHeader:b3,tableRow:b2},exit:{codeText:b4,table:b1,tableData:b5,tableHeader:b5,tableRow:b5}},{exit:{taskListCheckValueChecked:b8,taskListCheckValueUnchecked:b8,paragraph:b7}}]),l.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:bN,notInConstruct:bk},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:bN,notInConstruct:bk},{character:":",before:"[ps]",after:"\\/",inConstruct:bN,notInConstruct:bk}]},(r=!1,i&&i.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:function(e,t,n,i){let a=n.createTracker(i),o=a.move("[^"),s=n.enter("footnoteDefinition"),l=n.enter("label");return o+=a.move(n.safe(n.associationId(e),{before:o,after:"]"})),l(),o+=a.move("]:"),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((r?"\n":" ")+n.indentLines(n.containerFlow(e,a.current()),r?bY:bW))),s(),o},footnoteReference:bH},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:bG}],handlers:{delete:bq}},function(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=bQ(e,t,n);return n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&")),r},table:function(e,t,n,r){return s(function(e,t,n){let r=e.children,i=-1,a=[],o=t.enter("table");for(;++i<r.length;)a[i]=l(r[i],t,n);return o(),a}(e,n,r),e.align)},tableCell:o,tableRow:function(e,t,n,r){let i=s([l(e,n,r)]);return i.slice(0,i.indexOf("\n"))}}};function o(e,t,n,r){let i=n.enter("tableCell"),o=n.enter("phrasing"),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function s(e,t){return function(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||bK,a=[],o=[],s=[],l=[],c=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>c&&(c=e[u].length);++a<e[u].length;){var d;let o=null==(d=e[u][a])?"":String(d);if(!1!==n.alignDelimiters){let e=i(o);r[a]=e,(void 0===l[a]||e>l[a])&&(l[a]=e)}t.push(o)}o[u]=t,s[u]=r}let h=-1;if("object"==typeof r&&"length"in r)for(;++h<c;)a[h]=bZ(r[h]);else{let e=bZ(r);for(;++h<c;)a[h]=e}h=-1;let f=[],p=[];for(;++h<c;){let e=a[h],t="",r="";99===e?(t=":",r=":"):108===e?t=":":114===e&&(r=":");let i=!1===n.alignDelimiters?1:Math.max(1,l[h]-t.length-r.length),o=t+"-".repeat(i)+r;!1!==n.alignDelimiters&&((i=t.length+i+r.length)>l[h]&&(l[h]=i),p[h]=i),f[h]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let g=[];for(;++u<o.length;){let e=o[u],t=s[u];h=-1;let r=[];for(;++h<c;){let i=e[h]||"",o="",s="";if(!1!==n.alignDelimiters){let e=l[h]-(t[h]||0),n=a[h];114===n?o=" ".repeat(e):99===n?e%2?(o=" ".repeat(e/2+.5),s=" ".repeat(e/2-.5)):s=o=" ".repeat(e/2):s=" ".repeat(e)}!1===n.delimiterStart||h||r.push("|"),!1!==n.padding&&(!1!==n.alignDelimiters||""!==i)&&(!1!==n.delimiterStart||h)&&r.push(" "),!1!==n.alignDelimiters&&r.push(o),r.push(i),!1!==n.alignDelimiters&&r.push(s),!1!==n.padding&&r.push(" "),(!1!==n.delimiterEnd||h!==c-1)&&r.push("|")}g.push(!1===n.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return g.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function l(e,t,n){let r=e.children,i=-1,a=[],s=t.enter("tableRow");for(;++i<r.length;)a[i]=o(r[i],e,t,n);return s(),a}}(i),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:b9}}]})}function wq({children:e,className:t}){return(0,ep.jsx)("div",{className:(0,eO.cn)("text-[13px] leading-6 text-foreground/90 space-y-2 [&>:first-child]:mt-0",t),children:(0,ep.jsx)(bv,{remarkPlugins:[wX],components:{h1:e=>(0,ep.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-4 mb-1",...e}),h2:e=>(0,ep.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-4 mb-1",...e}),h3:e=>(0,ep.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-3 mb-1",...e}),h4:e=>(0,ep.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-3 mb-1",...e}),p:e=>(0,ep.jsx)("p",{className:"my-1.5",...e}),ul:e=>(0,ep.jsx)("ul",{className:"list-disc pl-5 my-1.5 space-y-0.5",...e}),ol:e=>(0,ep.jsx)("ol",{className:"list-decimal pl-5 my-1.5 space-y-0.5",...e}),li:e=>(0,ep.jsx)("li",{className:"leading-6",...e}),strong:e=>(0,ep.jsx)("strong",{className:"font-semibold text-foreground",...e}),code:e=>(0,ep.jsx)("code",{className:"text-[12px] font-mono bg-muted/70 px-1 py-0.5 rounded",...e}),a:e=>(0,ep.jsx)("a",{className:"text-primary underline",...e}),table:e=>(0,ep.jsx)("div",{className:"overflow-x-auto my-2",children:(0,ep.jsx)("table",{className:"text-[12px] border-collapse",...e})}),th:e=>(0,ep.jsx)("th",{className:"text-left font-semibold px-2 py-1 border-b border-border",...e}),td:e=>(0,ep.jsx)("td",{className:"px-2 py-1 border-b border-border/50",...e})},children:e})})}var wK=e.i(59411),tH=tH;function wZ({directiveId:e,onClose:t}){let n,{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)(null),[o,s]=(0,em.useState)(!1),[l,c]=(0,em.useState)(null);(0,em.useEffect)(()=>{e&&r&&(async()=>{s(!0),c(null),a(null);try{let t=await eD.client.getDirective(r,e);a(t)}catch(e){console.error("Error loading directive:",e),c(e.message)}finally{s(!1)}})()},[e,r]);let u=null!==e;return(0,ep.jsx)(tY.Dialog,{open:u,onOpenChange:e=>!e&&t(),children:(0,ep.jsxs)(tY.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col p-6",children:[(0,ep.jsx)(wK.VisuallyHidden,{children:(0,ep.jsx)(tY.DialogTitle,{children:"Directive Details"})}),o?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsx)(tH.default,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):l?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsx)("div",{className:"text-center text-destructive",children:(0,ep.jsxs)("div",{className:"text-sm",children:["Error: ",l]})})}):i?(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-6",children:[(0,ep.jsxs)("div",{className:"pb-5 border-b border-border",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("h3",{className:"text-xl font-bold text-foreground",children:i.name}),!i.is_active&&(0,ep.jsx)("span",{className:"px-2 py-0.5 rounded-full bg-red-500/10 text-red-600 dark:text-red-400 text-xs font-medium",children:"Inactive"})]}),(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground/70",children:i.id})]}),(0,ep.jsxs)("div",{className:"flex gap-8",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:"Created"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:(n=new Date(i.created_at),`${n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})} at ${n.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`)})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:"Priority"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:i.priority})]})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Content"}),(0,ep.jsx)("div",{className:"prose prose-base dark:prose-invert max-w-none",children:(0,ep.jsx)(bv,{remarkPlugins:[wX],children:i.content})})]}),i.tags&&i.tags.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Tags"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:i.tags.map((e,t)=>(0,ep.jsx)("span",{className:"px-2 py-0.5 bg-purple-500/10 text-purple-600 dark:text-purple-400 rounded text-xs",children:e},t))})]})]}):null]})})}function wQ(e){let t=new Date(e).getTime(),n=Math.round((Date.now()-t)/1e3);if(60>Math.abs(n))return n>=0?"just now":"in a moment";let r=n,i="second";for(let[e,t]of[[60,"second"],[60,"minute"],[24,"hour"],[7,"day"],[4.345,"week"],[12,"month"],[1/0,"year"]]){if(Math.abs(r)<e)break;r/=e,i=t}return new Intl.RelativeTimeFormat("en",{numeric:"auto"}).format(-Math.round(r),i)}function wJ(e){let t=new Date(e);return`${t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})} at ${t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`}function w0(e){return"directives"===e?{label:"directive",color:"bg-purple-500/10 text-purple-600 dark:text-purple-400"}:"mental-models"===e?{label:"mental model",color:"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400"}:"world"===e?{label:"world",color:"bg-blue-500/10 text-blue-600 dark:text-blue-400"}:"experience"===e?{label:"experience",color:"bg-green-500/10 text-green-600 dark:text-green-400"}:"observation"===e?{label:"observation",color:"bg-amber-500/10 text-amber-600 dark:text-amber-400"}:{label:e,color:"bg-slate-500/10 text-slate-600 dark:text-slate-400"}}let w1=["observation","experience","world","directives","mental-models"];function w2({based_on:e,onViewMemory:t,onViewDirective:n}){let r=(0,em.useMemo)(()=>{if(!e)return[];let t=Object.entries(e).map(([e,t])=>({factType:e,facts:t??[]})).filter(e=>e.facts.length>0);return t.sort((e,t)=>{let n=w1.indexOf(e.factType),r=w1.indexOf(t.factType);return(-1===n?999:n)-(-1===r?999:r)}),t},[e]);return 0===r.length?(0,ep.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"No based_on data."}):(0,ep.jsx)("div",{className:"space-y-4",children:r.map(e=>{let r=w0(e.factType);return(0,ep.jsxs)("div",{className:"rounded-lg border border-border/60 overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted/40 border-b border-border/60",children:[(0,ep.jsx)("span",{className:`px-2 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide ${r.color}`,children:r.label}),(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:e.facts.length})]}),(0,ep.jsx)("ul",{className:"divide-y divide-border/50",children:e.facts.map((r,i)=>{let a="directives"===e.factType&&!!n||"directives"!==e.factType&&"mental-models"!==e.factType&&!!t;return(0,ep.jsxs)("li",{className:"group flex items-start gap-3 px-3 py-2 hover:bg-muted/30",children:[(0,ep.jsxs)("p",{className:"text-sm text-foreground leading-relaxed flex-1 min-w-0",children:[r.text,r.context&&(0,ep.jsx)("span",{className:"block text-xs text-muted-foreground italic mt-0.5",children:r.context})]}),a&&(0,ep.jsx)("button",{className:"text-xs text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0 mt-0.5",onClick:()=>{"directives"===e.factType?n?.(r.id):t?.(r.id)},children:"View →"})]},r.id||i)})})]},e.factType)})})}function w5(e){return e.match(/\s+|[A-Za-z0-9_]+|[^\s\w]/g)||[]}function w3(e){return/^\s+$/.test(e)?" ":e}function w4(e,t){return e.map((e,n)=>"same"===e.type?(0,ep.jsx)("span",{children:e.text},n):(0,ep.jsx)("span",{className:"left"===t?"bg-red-500/25 text-red-800 dark:text-red-300 rounded-sm px-0.5":"bg-green-500/25 text-green-800 dark:text-green-300 rounded-sm px-0.5",children:e.text},n))}function w6({before:e,after:t}){let{left:n,right:r}=function(e,t){let n=e.split("\n"),r=t.split("\n"),i=n.length,a=r.length,o=Array.from({length:i+1},()=>Array(a+1).fill(0));for(let e=1;e<=i;e++)for(let t=1;t<=a;t++)o[e][t]=n[e-1]===r[t-1]?o[e-1][t-1]+1:Math.max(o[e-1][t],o[e][t-1]);let s=[],l=i,c=a;for(;l>0||c>0;)l>0&&c>0&&n[l-1]===r[c-1]?(s.push({type:"same",text:n[l-1]}),l--,c--):c>0&&(0===l||o[l][c-1]>=o[l-1][c])?(s.push({type:"added",text:r[c-1]}),c--):(s.push({type:"removed",text:n[l-1]}),l--);s.reverse();let u=[],d=[],h=0;for(;h<s.length;){let e=s[h];if("same"===e.type){u.push({type:"same",spans:[{type:"same",text:e.text}]}),d.push({type:"same",spans:[{type:"same",text:e.text}]}),h++;continue}let t=[],n=[];for(;h<s.length&&"same"!==s[h].type;)"removed"===s[h].type?t.push(s[h].text):n.push(s[h].text),h++;let r=Math.max(t.length,n.length);for(let e=0;e<r;e++){let r=e<t.length?t[e]:null,i=e<n.length?n[e]:null;if(null!==r&&null!==i){let e=function(e,t){let n=w5(e),r=w5(t),i=n.length,a=r.length,o=Array.from({length:i+1},()=>Array(a+1).fill(0));for(let e=1;e<=i;e++)for(let t=1;t<=a;t++)o[e][t]=w3(n[e-1])===w3(r[t-1])?o[e-1][t-1]+1:Math.max(o[e-1][t],o[e][t-1]);let s=[],l=[],c=i,u=a,d=[],h=[];for(;c>0||u>0;)if(c>0&&u>0&&w3(n[c-1])===w3(r[u-1]))d.push({type:"same",text:n[c-1]}),h.push({type:"same",text:r[u-1]}),c--,u--;else if(u>0&&(0===c||o[c][u-1]>=o[c-1][u])){let e=r[u-1];h.push({type:/^\s+$/.test(e)?"same":"added",text:e}),u--}else{let e=n[c-1];d.push({type:/^\s+$/.test(e)?"same":"removed",text:e}),c--}for(;d.length;)s.push(d.pop());for(;h.length;)l.push(h.pop());return{left:s,right:l}}(r,i),t=e.left.some(e=>"same"!==e.type)?"removed":"same",n=e.right.some(e=>"same"!==e.type)?"added":"same";u.push({type:t,spans:e.left}),d.push({type:n,spans:e.right})}else null!==r?(u.push({type:"removed",spans:[{type:"removed",text:r}]}),d.push({type:"same",spans:[{type:"same",text:""}]})):null!==i&&(u.push({type:"same",spans:[{type:"same",text:""}]}),d.push({type:"added",spans:[{type:"added",text:i}]}))}}return{left:u,right:d}}(e,t);return n.some(e=>"same"!==e.type)||r.some(e=>"same"!==e.type)?(0,ep.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-border border border-border rounded-md overflow-hidden text-xs font-mono",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"px-3 py-1.5 bg-muted text-muted-foreground font-sans font-semibold text-xs uppercase tracking-wide border-b border-border",children:"Before"}),n.map((e,t)=>(0,ep.jsx)("div",{className:`px-3 py-0.5 whitespace-pre-wrap leading-5 min-h-[1.25rem] ${"removed"===e.type?"bg-red-500/5":""}`,children:w4(e.spans,"left")},t))]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"px-3 py-1.5 bg-muted text-muted-foreground font-sans font-semibold text-xs uppercase tracking-wide border-b border-border",children:"After"}),r.map((e,t)=>(0,ep.jsx)("div",{className:`px-3 py-0.5 whitespace-pre-wrap leading-5 min-h-[1.25rem] ${"added"===e.type?"bg-green-500/5":""}`,children:w4(e.spans,"right")},t))]})]}):(0,ep.jsx)("span",{className:"text-sm text-muted-foreground italic",children:"unchanged"})}function w8({before:e,after:t,onViewMemory:n,onViewDirective:r}){let i=(0,em.useMemo)(()=>{let n=new Set([...Object.keys(e??{}),...Object.keys(t??{})]),r=[];for(let i of n){let n=(e?.[i]??[]).filter(Boolean),a=(t?.[i]??[]).filter(Boolean),o=new Set(n.map(e=>e.id)),s=new Set(a.map(e=>e.id)),l=a.filter(e=>!o.has(e.id)),c=n.filter(e=>!s.has(e.id)),u=a.filter(e=>o.has(e.id));(0!==l.length||0!==c.length||0!==u.length)&&r.push({factType:i,added:l,removed:c,kept:u})}return r.sort((e,t)=>{let n=w1.indexOf(e.factType),r=w1.indexOf(t.factType);return(-1===n?999:n)-(-1===r?999:r)}),r},[e,t]);if(0===i.length)return(0,ep.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"No based_on data."});let a=(e,t,i)=>(0,ep.jsxs)("li",{className:`group flex items-start gap-2 px-3 py-2 ${"added"===i?"bg-green-500/10 border-l-2 border-green-500":"removed"===i?"bg-red-500/10 border-l-2 border-red-500 text-muted-foreground line-through decoration-red-500/50":""}`,children:[(0,ep.jsx)("span",{className:`font-mono text-sm shrink-0 ${"added"===i?"text-green-600 dark:text-green-400":"removed"===i?"text-red-600 dark:text-red-400":"text-muted-foreground/40"}`,children:"added"===i?"+":"removed"===i?"−":" "}),(0,ep.jsxs)("p",{className:"text-sm leading-relaxed flex-1 min-w-0",children:[e.text,e.context&&(0,ep.jsx)("span",{className:"block text-xs text-muted-foreground italic mt-0.5 no-underline",children:e.context})]}),("directives"===t&&!!r||"directives"!==t&&"mental-models"!==t&&!!n)&&"removed"!==i&&(0,ep.jsx)("button",{className:"text-xs text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0 mt-0.5",onClick:()=>{"directives"===t?r(e.id):n(e.id)},children:"View →"})]},`${i}-${e.id}`);return(0,ep.jsx)("div",{className:"space-y-4",children:i.map(e=>{let t=w0(e.factType);return(0,ep.jsxs)("div",{className:"rounded-lg border border-border/60 overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted/40 border-b border-border/60",children:[(0,ep.jsx)("span",{className:`px-2 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide ${t.color}`,children:t.label}),e.added.length>0&&(0,ep.jsxs)("span",{className:"text-xs text-green-600 dark:text-green-400",children:["+",e.added.length]}),e.removed.length>0&&(0,ep.jsxs)("span",{className:"text-xs text-red-600 dark:text-red-400",children:["−",e.removed.length]}),e.kept.length>0&&(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e.kept.length," kept"]})]}),(0,ep.jsxs)("ul",{className:"divide-y divide-border/40",children:[e.added.map(t=>a(t,e.factType,"added")),e.removed.map(t=>a(t,e.factType,"removed")),e.kept.map(t=>a(t,e.factType,"kept"))]})]},e.factType)})})}function w7({history:e,currentContent:t,currentBasedOn:n,onViewMemory:r,onViewDirective:i}){let[a,o]=(0,em.useState)(0),s=e[a],l=0===a?t:e[a-1].previous_content??"",c=s.previous_reflect_response?.based_on,u=0===a?n:e[a-1].previous_reflect_response?.based_on,d=s.previous_reflect_response??null;return(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:[(0,ep.jsxs)("span",{className:"font-semibold text-foreground",children:["v",e.length-a]})," →"," ",(0,ep.jsxs)("span",{className:"font-semibold text-foreground",children:["v",e.length-a+1,0===a?" (current)":""]})," ","· changed ",new Date(s.changed_at).toLocaleString()]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:a===e.length-1,onClick:()=>o(a+1),children:(0,ep.jsx)(eS,{className:"h-3.5 w-3.5"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:0===a,onClick:()=>o(a-1),children:(0,ep.jsx)(eT.ChevronRight,{className:"h-3.5 w-3.5"})})]})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)(ji,{children:"Content diff"}),null!==s.previous_content?(0,ep.jsx)(w6,{before:s.previous_content,after:l}):(0,ep.jsx)("div",{className:"border border-border rounded-lg p-3",children:(0,ep.jsx)("span",{className:"text-sm text-muted-foreground italic",children:"Previous content not available"})})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)(ji,{children:"Based on diff"}),d?.based_on?(0,ep.jsx)(w8,{before:c,after:u,onViewMemory:r,onViewDirective:i}):(0,ep.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"Not captured for this version (recorded before reflect snapshots were tracked)."})]})]})}function w9({mentalModelId:e,onClose:t,onEdit:n,onDelete:r,onRefreshed:i,initialTab:a="content"}){let{currentBank:o}=(0,ey.useBank)(),[s,l]=(0,em.useState)(null),[c,u]=(0,em.useState)(!1),[d,h]=(0,em.useState)(null),[f,p]=(0,em.useState)(a),[g,v]=(0,em.useState)(!1),[x,y]=(0,em.useState)(!1),[b,w]=(0,em.useState)(null),[j,N]=(0,em.useState)(null),[k,E]=(0,em.useState)(null),[C,_]=(0,em.useState)(!1);(0,em.useEffect)(()=>{e&&o&&(async()=>{u(!0),h(null),l(null),E(null),p(a);try{let t=await eD.client.getMentalModel(o,e);l(t)}catch(e){console.error("Error loading mental model:",e),h(e.message)}finally{u(!1)}})()},[e,o,a]),(0,em.useEffect)(()=>{"history"===f&&s&&o&&null===k&&(async()=>{_(!0);try{let e=await eD.client.getMentalModelHistory(o,s.id);E(e)}catch(e){console.error("Error loading mental model history:",e),E([])}finally{_(!1)}})()},[f,s,o,k]);let S=async()=>{if(o&&s){y(!0);try{let e=await eD.client.getMentalModel(o,s.id);l(e),E(null)}catch(e){console.error("Error reloading mental model:",e)}finally{y(!1)}}},T=async()=>{if(!o||!s)return;v(!0);let e=s.last_refreshed_at;try{await eD.client.refreshMentalModel(o,s.id);let t=0,n=async()=>{t++;try{let r=await eD.client.getMentalModel(o,s.id);if(r.last_refreshed_at!==e){l(r),E(null),i?.(r),v(!1);return}if(t>=120){v(!1),ev.toast.error("Refresh timeout",{description:"Refresh is taking longer than expected. Check the operations list for status."});return}setTimeout(n,1e3)}catch(e){console.error("Error polling mental model:",e),v(!1)}};setTimeout(n,1e3)}catch{v(!1)}},A=null!==e,O=s?.reflect_response?.based_on,M=O?Object.values(O).reduce((e,t)=>e+(t?.length??0),0):0;return(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tY.Dialog,{open:A,onOpenChange:e=>!e&&t(),children:(0,ep.jsxs)(tY.DialogContent,{className:"w-[95vw] max-w-[95vw] h-[92vh] sm:max-w-[95vw] flex flex-col overflow-hidden",children:[(0,ep.jsx)(tY.DialogHeader,{className:"pr-10",children:(0,ep.jsxs)(tY.DialogTitle,{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"truncate",children:s?.name??"Mental Model"}),s&&(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:S,disabled:x,title:"Reload data",children:(0,ep.jsx)(eW,{className:`h-3.5 w-3.5 ${x?"animate-spin":""}`})}),s?.trigger?.refresh_after_consolidation&&(0,ep.jsxs)("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-full bg-green-500/10 text-green-600 dark:text-green-400 text-xs font-medium",children:[(0,ep.jsx)(gJ,{className:"w-3 h-3"}),"Auto refresh"]})]})}),c?(0,ep.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,ep.jsx)(tH.default,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):d?(0,ep.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,ep.jsx)("div",{className:"text-center text-destructive",children:(0,ep.jsxs)("div",{className:"text-sm",children:["Error: ",d]})})}):s?(0,ep.jsxs)(t$.Tabs,{value:f,onValueChange:e=>p(e),className:"flex-1 flex flex-col overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,ep.jsxs)(t$.TabsList,{className:"grid grid-cols-3 w-full max-w-md",children:[(0,ep.jsxs)(t$.TabsTrigger,{value:"content",className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5"}),"Content"]}),(0,ep.jsxs)(t$.TabsTrigger,{value:"configuration",className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eA,{className:"w-3.5 h-3.5"}),"Configuration"]}),(0,ep.jsxs)(t$.TabsTrigger,{value:"history",className:"flex items-center gap-1.5",children:[(0,ep.jsx)(tW,{className:"w-3.5 h-3.5"}),"History"]})]}),(0,ep.jsxs)(p5,{children:[(0,ep.jsx)(p4,{asChild:!0,children:(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 shrink-0",disabled:g,"aria-label":"Actions",children:(0,ep.jsx)(mH,{className:"h-4 w-4"})})}),(0,ep.jsxs)(ml,{align:"end",children:[n&&(0,ep.jsxs)(mc,{onClick:()=>n(s),children:[(0,ep.jsx)(mU,{className:"h-4 w-4 mr-2"}),"Edit"]}),(0,ep.jsxs)(mc,{onClick:T,disabled:g,children:[(0,ep.jsx)(eW,{className:"h-4 w-4 mr-2"}),"Refresh Manually"]}),r&&(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(mu,{}),(0,ep.jsxs)(mc,{onClick:()=>r(s),className:"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400 focus:bg-red-500/10",children:[(0,ep.jsx)(mV,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})]}),(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto mt-4",children:[(0,ep.jsxs)(t$.TabsContent,{value:"content",className:"mt-0 space-y-6",children:[(0,ep.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-2 px-4 py-2 border-b border-border bg-muted/50 text-xs text-muted-foreground",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5"}),(0,ep.jsx)("span",{className:"font-semibold uppercase tracking-wide",children:"Stored content"}),(0,ep.jsxs)("span",{className:"text-muted-foreground/70",children:["· ",s.content.length.toLocaleString()," chars"]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[!0===s.is_stale?(0,ep.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide bg-amber-500/15 text-amber-700 dark:text-amber-400",title:"New memories in this mental model's scope have been ingested since it was last refreshed",children:"Stale"}):!1===s.is_stale?(0,ep.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide bg-green-500/15 text-green-700 dark:text-green-400",title:"No new memories in this mental model's scope since it was last refreshed",children:"In sync"}):null,(0,ep.jsxs)("span",{title:wJ(s.last_refreshed_at),className:"flex items-center gap-1",children:[(0,ep.jsx)(eW,{className:"w-3 h-3"}),"Last refreshed ",wQ(s.last_refreshed_at)]})]})]}),(0,ep.jsx)(wq,{className:"p-4",children:s.content})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsxs)(ji,{children:["Based On",M>0?` (${M})`:""]}),s.reflect_response?(0,ep.jsx)(w2,{based_on:O,onViewMemory:e=>w(e),onViewDirective:e=>N(e)}):(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:'No source data available. Click "Refresh" to regenerate with source tracking.'})]})]}),(0,ep.jsx)(t$.TabsContent,{value:"configuration",className:"mt-0",children:(0,ep.jsx)(jr,{mentalModel:s})}),(0,ep.jsx)(t$.TabsContent,{value:"history",className:"mt-0",children:C?(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)(tH.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):k&&k.length>0?(0,ep.jsx)(w7,{history:k,currentContent:s.content,currentBasedOn:O,onViewMemory:e=>w(e),onViewDirective:e=>N(e)}):(0,ep.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"No history recorded yet."})})]})]}):null]})}),b&&(0,ep.jsx)(t0,{memoryId:b,onClose:()=>w(null)}),j&&(0,ep.jsx)(wZ,{directiveId:j,onClose:()=>N(null)})]})}function je({label:e,value:t}){return(0,ep.jsxs)("div",{children:[(0,ep.jsx)(ji,{children:e}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:t})]})}function jt({title:e,icon:t,children:n}){return(0,ep.jsxs)("div",{className:"rounded-lg border border-border bg-muted/20 overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5 px-4 py-2 border-b border-border bg-muted/40 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[t,e]}),(0,ep.jsx)("div",{className:"p-4 space-y-4",children:n})]})}function jn({label:e,color:t}){return(0,ep.jsx)("span",{className:`px-2 py-0.5 rounded text-xs ${t??"bg-muted text-foreground border border-border/60"}`,children:e})}function jr({mentalModel:e}){let t=e.trigger??{refresh_after_consolidation:!1},n=t.fact_types??[],r=t.tag_groups??[],i=t.exclude_mental_model_ids??[];return(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ep.jsxs)(jt,{title:"Identity",icon:(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5"}),children:[(0,ep.jsx)(je,{label:"ID",value:(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground break-all",children:e.id})}),(0,ep.jsx)(je,{label:"Name",value:e.name}),e.source_query&&(0,ep.jsx)(je,{label:"Source Query",value:e.source_query}),(0,ep.jsx)(je,{label:"Tags",value:e.tags?.length>0?(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.tags.map(e=>(0,ep.jsx)(jn,{label:e,color:"bg-amber-500/10 text-amber-600 dark:text-amber-400"},e))}):(0,ep.jsx)("span",{className:"text-muted-foreground italic text-sm",children:"none"})})]}),(0,ep.jsxs)(jt,{title:"Timing",icon:(0,ep.jsx)(eW,{className:"w-3.5 h-3.5"}),children:[(0,ep.jsx)(je,{label:"Created",value:wJ(e.created_at)}),(0,ep.jsx)(je,{label:"Last Refreshed",value:(0,ep.jsx)("span",{title:wJ(e.last_refreshed_at),children:wQ(e.last_refreshed_at)})}),(0,ep.jsx)(je,{label:"Max Tokens",value:e.max_tokens.toLocaleString()})]}),(0,ep.jsxs)(jt,{title:"Refresh Trigger",icon:(0,ep.jsx)(gJ,{className:"w-3.5 h-3.5"}),children:[(0,ep.jsx)(je,{label:"Refresh mode",value:"delta"===t.mode?(0,ep.jsx)(jn,{label:"Delta",color:"bg-purple-500/10 text-purple-600 dark:text-purple-400"}):(0,ep.jsx)(jn,{label:"Full"})}),(0,ep.jsx)(je,{label:"Auto-refresh after consolidation",value:t.refresh_after_consolidation?(0,ep.jsx)(jn,{label:"Enabled",color:"bg-green-500/10 text-green-600 dark:text-green-400"}):(0,ep.jsx)(jn,{label:"Disabled"})}),(0,ep.jsx)(je,{label:"Fact types",value:n.length>0?(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:n.map(e=>{let t=w0(e);return(0,ep.jsx)(jn,{label:t.label,color:t.color},e)})}):(0,ep.jsx)("span",{className:"text-muted-foreground italic text-sm",children:"all"})}),(0,ep.jsx)(je,{label:"Exclude mental models",value:t.exclude_mental_models?"Yes":"No"}),i.length>0&&(0,ep.jsx)(je,{label:"Excluded IDs",value:(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:i.map(e=>(0,ep.jsx)("code",{className:"text-xs font-mono px-1.5 py-0.5 rounded bg-muted border border-border/60",children:e},e))})})]}),(0,ep.jsxs)(jt,{title:"Recall Parameters",icon:(0,ep.jsx)(eA,{className:"w-3.5 h-3.5"}),children:[(0,ep.jsx)(je,{label:"Include chunks",value:null==t.include_chunks?"default":t.include_chunks?"Yes":"No"}),(0,ep.jsx)(je,{label:"Recall max tokens",value:null!=t.recall_max_tokens?t.recall_max_tokens.toLocaleString():"default"}),(0,ep.jsx)(je,{label:"Recall chunks max tokens",value:null!=t.recall_chunks_max_tokens?t.recall_chunks_max_tokens.toLocaleString():"default"}),(0,ep.jsx)(je,{label:"Tags match",value:t.tags_match?(0,ep.jsx)(jn,{label:t.tags_match}):"default"})]}),r.length>0&&(0,ep.jsx)("div",{className:"md:col-span-2",children:(0,ep.jsx)(jt,{title:"Tag Groups",icon:(0,ep.jsx)(eA,{className:"w-3.5 h-3.5"}),children:(0,ep.jsx)("pre",{className:"text-xs font-mono bg-muted/40 rounded p-3 overflow-x-auto border border-border/60",children:JSON.stringify(r,null,2)})})})]})}function ji({children:e}){return(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:e})}function ja(){let e,t,n,r,i,a,o,s,l,c,u,{currentBank:d}=(0,ey.useBank)(),[h,f]=(0,em.useState)(""),[p,g]=(0,em.useState)("mid"),[v,x]=(0,em.useState)(4096),[y,b]=(0,em.useState)(!0),[w,j]=(0,em.useState)(!0),[N,k]=(0,em.useState)("answer"),[E,C]=(0,em.useState)(null),[_,S]=(0,em.useState)(!1),[T,A]=(0,em.useState)(""),[O,M]=(0,em.useState)("any"),[P,D]=(0,em.useState)([]),[L,I]=(0,em.useState)(!1),[R,B]=(0,em.useState)(""),[z,F]=(0,em.useState)(""),[V,U]=(0,em.useState)(!1),[H,W]=(0,em.useState)(!1),[Y,G]=(0,em.useState)(null),[$,X]=(0,em.useState)(null),[q,K]=(0,em.useState)(null),[Z,Q]=(0,em.useState)(!1),[J,ee]=(0,em.useState)(null),[et,en]=(0,em.useState)(null),[er,ei]=(0,em.useState)(!1),[ea,eo]=(0,em.useState)(null),[es,el]=(0,em.useState)("world"),ec="General Feedback",eu=async e=>{if(ee(e),en(null),d&&e?.id){ei(!0);try{let t=await eD.client.listObservations(d),n=t.items?.find(t=>t.id===e.id);en(n||e)}catch(t){console.error("Failed to load observation:",t),en(e)}finally{ei(!1)}}},ed=async()=>{if(d&&z.trim()){U(!0);try{let e=await eD.client.listDirectives(d),t=e.items?.find(e=>e.name===ec);if(t){let e=t.content?`${t.content}
8
- ${z.trim()}`:z.trim();await eD.client.updateDirective(d,t.id,{content:e})}else await eD.client.createDirective(d,{name:ec,content:z.trim()});F(""),W(!0),setTimeout(()=>W(!1),3e3)}catch(e){}finally{U(!1)}}},eh=async()=>{if(d&&h){S(!0),k("answer");try{let e=T.split(",").map(e=>e.trim()).filter(e=>e.length>0),t=R.split(",").map(e=>e.trim()).filter(e=>e.length>0),n=await eD.client.reflect({bank_id:d,query:h,budget:p,max_tokens:v,include_facts:y,include_tool_calls:w,...e.length>0&&{tags:e,tags_match:O},...P.length>0&&{fact_types:P},...L&&{exclude_mental_models:!0},...t.length>0&&{exclude_mental_model_ids:t}});C(n)}catch(e){}finally{S(!1)}}};return d?(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(m7,{children:(0,ep.jsxs)(gn,{className:"pt-6",children:[(0,ep.jsxs)("div",{className:"flex gap-3",children:[(0,ep.jsxs)("div",{className:"flex-1 relative",children:[(0,ep.jsx)(ek,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,ep.jsx)(eI.Input,{type:"text",value:h,onChange:e=>f(e.target.value),placeholder:"What would you like to reflect on?",className:"pl-10 h-12 text-lg",onKeyDown:e=>"Enter"===e.key&&eh()})]}),(0,ep.jsx)(eL.Button,{onClick:eh,disabled:_||!h,className:"h-12 px-8",children:_?"Reflecting...":"Reflect"})]}),(0,ep.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Budget:"}),(0,ep.jsxs)(tR.Select,{value:p,onValueChange:e=>g(e),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-24 h-8",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"low",children:"Low"}),(0,ep.jsx)(tR.SelectItem,{value:"mid",children:"Mid"}),(0,ep.jsx)(tR.SelectItem,{value:"high",children:"High"})]})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-sm text-muted-foreground",children:"Tokens:"}),(0,ep.jsx)(eI.Input,{type:"number",value:v,onChange:e=>x(parseInt(e.target.value)||4096),className:"w-24 h-8"})]}),(0,ep.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(m2.Checkbox,{checked:y,onCheckedChange:e=>b(e)}),(0,ep.jsx)("span",{className:"text-sm",children:"Include Source"})]}),(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(m2.Checkbox,{checked:w,onCheckedChange:e=>j(e)}),(0,ep.jsx)("span",{className:"text-sm",children:"Include Tools"})]})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-4 mt-4 pt-4 border-t",children:[(0,ep.jsx)(tB,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("div",{className:"flex-1 max-w-md",children:(0,ep.jsx)(eI.Input,{type:"text",value:T,onChange:e=>A(e.target.value),placeholder:"Filter by tags (comma-separated)",className:"h-8"})}),(0,ep.jsxs)(tR.Select,{value:O,onValueChange:e=>M(e),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-40 h-8",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"any",children:"Any (incl. untagged)"}),(0,ep.jsx)(tR.SelectItem,{value:"all",children:"All (incl. untagged)"}),(0,ep.jsx)(tR.SelectItem,{value:"any_strict",children:"Any (strict)"}),(0,ep.jsx)(tR.SelectItem,{value:"all_strict",children:"All (strict)"})]})]})]}),(0,ep.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,ep.jsx)(m6,{value:P,onChange:D}),(0,ep.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(m2.Checkbox,{checked:L,onCheckedChange:e=>I(e)}),(0,ep.jsx)("span",{className:"text-sm",children:"Exclude mental models"})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-sm text-muted-foreground",children:"Exclude IDs:"}),(0,ep.jsx)(eI.Input,{type:"text",value:R,onChange:e=>B(e.target.value),placeholder:"model-a, model-b",className:"h-8 w-48"})]})]})]})}),_&&(0,ep.jsx)(m7,{children:(0,ep.jsxs)(gn,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mb-4"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Reflecting on memories..."})]})}),!_&&E&&(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[E.usage&&(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Input tokens:"}),(0,ep.jsx)("span",{className:"font-semibold",children:E.usage.input_tokens?.toLocaleString()})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Output tokens:"}),(0,ep.jsx)("span",{className:"font-semibold",children:E.usage.output_tokens?.toLocaleString()})]})]}),E.trace?.tool_calls&&(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Tool calls:"}),(0,ep.jsx)("span",{className:"font-semibold",children:E.trace.tool_calls.length}),(0,ep.jsxs)("span",{className:"text-muted-foreground",children:["(",E.trace.tool_calls.reduce((e,t)=>e+t.duration_ms,0),"ms)"]})]}),E.trace?.llm_calls&&(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"LLM calls:"}),(0,ep.jsx)("span",{className:"font-semibold",children:E.trace.llm_calls.length}),(0,ep.jsxs)("span",{className:"text-muted-foreground",children:["(",E.trace.llm_calls.reduce((e,t)=>e+t.duration_ms,0),"ms)"]})]}),(0,ep.jsx)("div",{className:"flex-1"}),(0,ep.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:["answer","trace","json"].map(e=>(0,ep.jsx)("button",{onClick:()=>k(e),className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${N===e?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"answer"===e?"Answer":"trace"===e?"Trace":"JSON"},e))})]}),"answer"===N&&(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsxs)(m7,{children:[(0,ep.jsx)(m9,{children:(0,ep.jsx)(ge,{children:"Answer"})}),(0,ep.jsx)(gn,{children:(0,ep.jsx)("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:(0,ep.jsx)(bv,{remarkPlugins:[wX],children:E.text})})})]}),(0,ep.jsxs)(m7,{className:"border-blue-200 dark:border-blue-800",children:[(0,ep.jsxs)(m9,{className:"py-4",children:[(0,ep.jsxs)(ge,{className:"flex items-center gap-2 text-base",children:[(0,ep.jsx)(ga,{className:"w-4 h-4"}),"Add Directive"]}),(0,ep.jsx)(gt,{className:"text-xs",children:"Hard rules injected into prompts that the agent must follow"})]}),(0,ep.jsx)(gn,{className:"pt-0",children:H?(0,ep.jsxs)("div",{className:"flex items-center gap-2 text-green-600 dark:text-green-400",children:[(0,ep.jsx)("span",{className:"text-lg",children:"✓"}),(0,ep.jsxs)("span",{className:"text-sm font-medium",children:["Directive saved to ",ec]})]}):(0,ep.jsxs)("div",{className:"flex gap-3",children:[(0,ep.jsx)(gl.Textarea,{value:z,onChange:e=>F(e.target.value),placeholder:"e.g., Always respond in formal English...",className:"flex-1 min-h-[60px] resize-none",onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&ed()}}),(0,ep.jsx)(eL.Button,{onClick:ed,disabled:V||!z.trim(),className:"self-end",children:V?"Saving...":"Save"})]})})]})]}),"trace"===N&&(0,ep.jsxs)("div",{className:"space-y-4",children:[E.observations_created&&E.observations_created.length>0&&(0,ep.jsxs)(m7,{className:"border-emerald-200 dark:border-emerald-800",children:[(0,ep.jsxs)(m9,{className:"bg-emerald-50 dark:bg-emerald-950 py-3",children:[(0,ep.jsxs)(ge,{className:"flex items-center gap-2 text-base",children:[(0,ep.jsx)(gi,{className:"w-4 h-4 text-emerald-600"}),"Observations Created (",E.observations_created.length,")"]}),(0,ep.jsx)(gt,{className:"text-xs",children:"New observations learned during this reflection"})]}),(0,ep.jsx)(gn,{className:"pt-4",children:(0,ep.jsx)("div",{className:"space-y-2",children:E.observations_created.map((e,t)=>(0,ep.jsxs)("div",{className:"p-3 bg-emerald-50 dark:bg-emerald-950/50 rounded-lg border border-emerald-200 dark:border-emerald-800",children:[(0,ep.jsx)("div",{className:"font-medium text-sm text-emerald-900 dark:text-emerald-100",children:e.name}),(0,ep.jsx)("div",{className:"text-xs text-emerald-700 dark:text-emerald-300 mt-1",children:e.description}),(0,ep.jsxs)("div",{className:"text-[10px] text-muted-foreground mt-2 font-mono",children:["ID: ",e.id]})]},t))})})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,ep.jsxs)(m7,{className:"h-fit",children:[(0,ep.jsxs)(m9,{className:"pb-3",children:[(0,ep.jsx)(ge,{className:"text-base",children:"Execution Trace"}),(0,ep.jsxs)(gt,{className:"text-xs",children:[E.iterations||0," iteration",1!==(E.iterations||0)?"s":""," •"," ",(E.trace?.llm_calls?.reduce((e,t)=>e+t.duration_ms,0)||0)+(E.trace?.tool_calls?.reduce((e,t)=>e+t.duration_ms,0)||0),"ms total"]})]}),(0,ep.jsx)(gn,{children:w?E.trace?.llm_calls&&E.trace.llm_calls.length>0||E.trace?.tool_calls&&E.trace.tool_calls.length>0?(0,ep.jsx)("div",{className:"max-h-[500px] overflow-y-auto pr-2",children:(e=E.trace?.llm_calls||[],t=E.trace?.tool_calls||[],n=[],e.forEach((r,i)=>{let a=t.filter(e=>e.iteration===i+1),o=i===e.length-1,s=r.scope.includes("final")||o&&0===a.length,l=s?e.length:i+1;n.push({type:"llm",llm:r,iteration:l,isFinal:s}),a.length>0&&n.push({type:"tools",tools:a,iteration:i+1})}),n.map((e,t)=>(0,ep.jsxs)("div",{className:"relative",children:[t<n.length-1&&(0,ep.jsx)("div",{className:"absolute left-3 top-6 bottom-0 w-0.5 bg-border"}),"llm"===e.type?(0,ep.jsxs)("div",{className:"flex items-start gap-3 pb-3",children:[(0,ep.jsx)("div",{className:`w-6 h-6 rounded-full flex items-center justify-center flex-shrink-0 ${e.isFinal?"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400":"bg-primary/10 text-primary"}`,children:e.isFinal?(0,ep.jsx)(tV.Check,{className:"w-3.5 h-3.5",strokeWidth:2.5}):(0,ep.jsx)("span",{className:"text-[10px] font-semibold",children:e.iteration})}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)("span",{className:"font-medium text-sm",children:e.isFinal?"Response generated":"Agent decided"}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[(0,ep.jsx)(eG,{className:"w-3 h-3"}),e.llm.duration_ms,"ms"]})]}),(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:e.isFinal?"Final answer":"Called tools below"})]})]}):(0,ep.jsxs)("div",{className:"flex items-start gap-3 pb-3",children:[(0,ep.jsx)("div",{className:"w-6 h-6 rounded-full flex items-center justify-center bg-blue-500/15 text-blue-600 dark:text-blue-400 flex-shrink-0",children:(0,ep.jsx)(gs,{className:"w-3 h-3",fill:"currentColor"})}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground",children:["Executing ",e.tools?.length," tool",e.tools?.length!==1?"s":""]}),e.tools?.map((e,t)=>(0,ep.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-muted/50",children:[(0,ep.jsx)("span",{className:"font-medium text-sm text-foreground",children:e.tool}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[(0,ep.jsx)(eG,{className:"w-3 h-3"}),e.duration_ms,"ms"]})]}),(0,ep.jsxs)("div",{className:"p-2 space-y-2",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-[10px] font-semibold text-muted-foreground mb-1",children:"Input:"}),(0,ep.jsx)("div",{className:"bg-muted p-1.5 rounded text-xs overflow-auto max-h-32",children:(0,ep.jsx)(gQ,{src:e.input,collapsed:1,theme:"default"})})]}),e.output&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-[10px] font-semibold text-muted-foreground mb-1",children:"Output:"}),(0,ep.jsx)("div",{className:"bg-muted p-1.5 rounded text-xs overflow-auto max-h-32",children:(0,ep.jsx)(gQ,{src:e.output,collapsed:1,theme:"default"})})]})]})]},t))]})]})]},t)))}):(0,ep.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,ep.jsx)(gr.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"font-medium text-sm text-foreground",children:"No operations"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"No LLM or tool calls were made during this reflection."})]})]}):(0,ep.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,ep.jsx)(gr.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"font-medium text-sm text-foreground",children:"Not included"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:'Enable "Include Tool Calls" to see trace.'})]})]})})]}),(0,ep.jsxs)(m7,{className:"h-fit",children:[(0,ep.jsxs)(m9,{className:"pb-3",children:[(0,ep.jsx)(ge,{className:"text-base",children:"Based On"}),(0,ep.jsxs)(gt,{className:"text-xs",children:[(E.based_on?.memories?.length||0)+(E.based_on?.observations?.filter(e=>"directive"!==e.subtype)?.length||0)+(E.based_on?.directives?.length||0)," ","items used"]})]}),(0,ep.jsx)(gn,{children:y?E.based_on?.memories&&E.based_on.memories.length>0||E.based_on?.mental_models&&E.based_on.mental_models.length>0||E.based_on?.directives&&E.based_on.directives.length>0||E.based_on?.observations&&E.based_on.observations.length>0?(i=(r=E.based_on?.memories||[]).filter(e=>"world"===e.type),a=r.filter(e=>"experience"===e.type),o=E.based_on?.mental_models||[],s=(E.based_on?.observations||[]).filter(e=>"directive"!==e.subtype),c=[{id:"directives",label:"Directives",count:(l=E.based_on?.directives||[]).length},{id:"mental_models",label:"Mental Models",count:o.length},{id:"observations",label:"Observations",count:s.length},{id:"world",label:"World",count:i.length},{id:"experience",label:"Experience",count:a.length}],u=(()=>{switch(es){case"directives":return l;case"mental_models":return o;case"observations":return s;case"world":return i;case"experience":return a;default:return[]}})(),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"flex items-center gap-1 bg-muted rounded-lg p-1 mb-4",children:c.map(e=>(0,ep.jsxs)("button",{onClick:()=>el(e.id),className:`flex-1 px-3 py-1.5 rounded-md text-sm font-medium transition-all ${es===e.id?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[e.label," (",e.count,")"]},e.id))}),u.length>0?(0,ep.jsx)("div",{className:"max-h-[400px] overflow-y-auto pr-2 space-y-3",children:u.map((e,t)=>{let n,r;return(0,ep.jsx)("div",{className:`p-4 bg-muted/50 rounded-lg border border-border/50 ${"directives"!==es?"cursor-pointer hover:bg-muted/80 transition-colors":""}`,onClick:()=>{"directives"!==es&&("observations"===es?eu(e):"mental_models"===es?eo(e.id):G(e.id))},children:"directives"===es?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"font-medium text-sm",children:e.name}),e.content&&(0,ep.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:e.content})]}):"observations"===es?(0,ep.jsx)("div",{className:"font-medium text-sm",children:e.name}):"mental_models"===es?(r=(n=e.text?.indexOf(": ")??-1)>0?e.text.slice(0,n):e.id,(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"font-medium text-sm",children:r}),(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground",children:e.id})]})):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("p",{className:"text-sm text-foreground leading-relaxed",children:e.text}),e.context&&(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mt-2",children:e.context})]})},e.id||t)})}):(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground text-center py-4",children:["No ",es," items"]})]})):(0,ep.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-amber-50 dark:bg-amber-950 border border-amber-200 dark:border-amber-800 rounded-lg",children:[(0,ep.jsx)(gr.Info,{className:"w-4 h-4 text-amber-600 dark:text-amber-400 mt-0.5 flex-shrink-0"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"font-medium text-sm text-amber-900 dark:text-amber-100",children:"No facts found"}),(0,ep.jsx)("p",{className:"text-xs text-amber-700 dark:text-amber-300 mt-0.5",children:"No memories were used to generate this answer."})]})]}):(0,ep.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,ep.jsx)(gr.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"font-medium text-sm text-foreground",children:"Not included"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:'Enable "Include Source" to see memories.'})]})]})})]})]})]}),"json"===N&&(0,ep.jsxs)(m7,{children:[(0,ep.jsx)(m9,{children:(0,ep.jsx)(ge,{className:"text-lg",children:"Raw Response"})}),(0,ep.jsx)(gn,{children:(0,ep.jsx)("div",{className:"bg-muted p-4 rounded-lg overflow-auto max-h-[600px]",children:(0,ep.jsx)(gQ,{src:E,collapsed:2,theme:"default"})})})]})]}),!_&&!E&&(0,ep.jsx)(m7,{className:"border-dashed",children:(0,ep.jsxs)(gn,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(ek,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ready to Reflect"}),(0,ep.jsx)("p",{className:"text-muted-foreground text-center max-w-md",children:"Enter a question above to query the memory bank and generate a disposition-aware response."})]})}),(0,ep.jsx)(t0,{memoryId:Y,onClose:()=>G(null)}),$&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,ep.jsxs)("div",{className:"p-6",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(go,{className:"w-5 h-5"}),(0,ep.jsx)("h2",{className:"text-lg font-semibold",children:"Directive"})]}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"icon",onClick:()=>{X(null),K(null)},children:(0,ep.jsx)(tU.X,{className:"w-4 h-4"})})]}),Z?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Name"}),(0,ep.jsx)("p",{className:"mt-1 font-medium",children:q?.name||$.name})]}),q?.description&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Description"}),(0,ep.jsx)("p",{className:"mt-1 text-sm",children:q.description})]}),q?.tags&&q.tags.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Tags"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-1",children:q.tags.map(e=>(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground flex items-center gap-1",children:[(0,ep.jsx)(tB,{className:"w-2.5 h-2.5"}),e]},e))})]}),(q?.content||$.content)&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Content"}),(0,ep.jsx)("div",{className:"p-3 bg-muted rounded-lg",children:(0,ep.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:q?.content||$.content})})]}),(0,ep.jsxs)("div",{className:"pt-2 border-t",children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),(0,ep.jsx)("p",{className:"mt-1 font-mono text-xs text-muted-foreground",children:$.id})]})]})]})}),J&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,ep.jsxs)("div",{className:"p-6",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(gi,{className:"w-5 h-5"}),(0,ep.jsx)("h2",{className:"text-lg font-semibold",children:"Observation"})]}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"icon",onClick:()=>{ee(null),en(null)},children:(0,ep.jsx)(tU.X,{className:"w-4 h-4"})})]}),er?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Text"}),(0,ep.jsx)("div",{className:"mt-1 prose prose-sm max-w-none dark:prose-invert",children:(0,ep.jsx)(bv,{remarkPlugins:[wX],children:et?.text||J.text})})]}),et?.tags&&et.tags.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Tags"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-1",children:et.tags.map(e=>(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground flex items-center gap-1",children:[(0,ep.jsx)(tB,{className:"w-2.5 h-2.5"}),e]},e))})]}),et?.source_memories&&et.source_memories.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:["Source Memories (",et.source_memories.length,")"]}),(0,ep.jsx)("div",{className:"space-y-2",children:et.source_memories.map((e,t)=>(0,ep.jsx)("div",{className:"p-3 bg-muted rounded-lg",children:(0,ep.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:e.text||("string"==typeof e?e:"")})},t))})]}),(0,ep.jsxs)("div",{className:"pt-2 border-t",children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),(0,ep.jsx)("p",{className:"mt-1 font-mono text-xs text-muted-foreground",children:J.id})]})]})]})}),(0,ep.jsx)(w9,{mentalModelId:ea,onClose:()=>eo(null)})]}):(0,ep.jsx)(m7,{className:"border-dashed",children:(0,ep.jsxs)(gn,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(eE,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("h3",{className:"text-xl font-semibold mb-2",children:"No Bank Selected"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Select a memory bank to start reflecting."})]})})}let jo=(0,eN.default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);function js(){let e,t,n,r,i,a,o,s,l,c,u,d,h,f,{currentBank:p}=(0,ey.useBank)(),[g,v]=(0,em.useState)(""),[x,y]=(0,em.useState)(["world"]),[b,w]=(0,em.useState)("mid"),[j,N]=(0,em.useState)(4096),[k,E]=(0,em.useState)(""),[C,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(!1),[A,O]=(0,em.useState)(""),[M,P]=(0,em.useState)("any"),[D,L]=(0,em.useState)(null),[I,R]=(0,em.useState)(null),[B,z]=(0,em.useState)(null),[F,V]=(0,em.useState)(null),[U,H]=(0,em.useState)(null),[W,Y]=(0,em.useState)(!1),[G,$]=(0,em.useState)("results"),[X,q]=(0,em.useState)(null),[K,Z]=(0,em.useState)(new Set),[Q,J]=(0,em.useState)(new Set),ee=e=>{Z(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},et=e=>{J(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},en=e=>{let t=e.id||e.node_id;q(D?.find(e=>e.id===t||e.node_id===t)||e)},er=async()=>{if(!p)return void ev.toast.error("Validation error",{description:"Please select a memory bank first"});if(g){if(0===x.length)return void ev.toast.error("Validation error",{description:"Please select at least one type (World, Experience, or Observations)"});Y(!0);try{let e=A.split(",").map(e=>e.trim()).filter(e=>e.length>0),t={bank_id:p,query:g,types:x,budget:b,max_tokens:j,trace:!0,include:{entities:S?{max_tokens:500}:null,chunks:C?{max_tokens:8192}:null},...k&&{query_timestamp:k},...e.length>0&&{tags:e,tags_match:M}},n=await eD.client.recall(t);L(n.results||[]),R(n.entities||null),z(n.chunks||null),V(n.observations||null),H(n.trace||null),$("results")}catch(e){}finally{Y(!1)}}};return p?(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(m7,{children:(0,ep.jsxs)(gn,{className:"pt-6",children:[(0,ep.jsxs)("div",{className:"flex gap-3",children:[(0,ep.jsxs)("div",{className:"flex-1 relative",children:[(0,ep.jsx)(ej.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,ep.jsx)(eI.Input,{type:"text",value:g,onChange:e=>v(e.target.value),placeholder:"What would you like to recall?",className:"pl-10 h-12 text-lg",onKeyDown:e=>"Enter"===e.key&&er()})]}),(0,ep.jsx)(eL.Button,{onClick:er,disabled:W||!g,className:"h-12 px-8",children:W?"Searching...":"Recall"})]}),(0,ep.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,ep.jsx)(m6,{value:x,onChange:y,label:"Types:"}),(0,ep.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(gJ,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsxs)(tR.Select,{value:b,onValueChange:e=>w(e),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-24 h-8",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"low",children:"Low"}),(0,ep.jsx)(tR.SelectItem,{value:"mid",children:"Mid"}),(0,ep.jsx)(tR.SelectItem,{value:"high",children:"High"})]})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-sm text-muted-foreground",children:"Tokens:"}),(0,ep.jsx)(eI.Input,{type:"number",value:j,onChange:e=>N(parseInt(e.target.value)),className:"w-24 h-8"})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(eG,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)(eI.Input,{type:"datetime-local",value:k,onChange:e=>E(e.target.value),className:"h-8",placeholder:"Query date"})]}),(0,ep.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(m2.Checkbox,{checked:C,onCheckedChange:e=>_(e)}),(0,ep.jsx)(eC.FileText,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("span",{className:"text-sm",children:"Chunks"})]}),(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(m2.Checkbox,{checked:S,onCheckedChange:e=>T(e)}),(0,ep.jsx)(e_,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("span",{className:"text-sm",children:"Entities"})]})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-4 mt-4 pt-4 border-t",children:[(0,ep.jsx)(tB,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("div",{className:"flex-1 max-w-md",children:(0,ep.jsx)(eI.Input,{type:"text",value:A,onChange:e=>O(e.target.value),placeholder:"Filter by tags (comma-separated)",className:"h-8"})}),(0,ep.jsxs)(tR.Select,{value:M,onValueChange:e=>P(e),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-40 h-8",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"any",children:"Any (incl. untagged)"}),(0,ep.jsx)(tR.SelectItem,{value:"all",children:"All (incl. untagged)"}),(0,ep.jsx)(tR.SelectItem,{value:"any_strict",children:"Any (strict)"}),(0,ep.jsx)(tR.SelectItem,{value:"all_strict",children:"All (strict)"})]})]})]})]})}),W&&(0,ep.jsx)(m7,{children:(0,ep.jsxs)(gn,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mb-4"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Searching memories..."})]})}),!W&&D&&(0,ep.jsxs)("div",{className:"space-y-4",children:[U?.summary&&(0,ep.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Results:"}),(0,ep.jsx)("span",{className:"font-semibold",children:D.length})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Duration:"}),(0,ep.jsxs)("span",{className:"font-semibold",children:[U.summary.total_duration_seconds?.toFixed(2),"s"]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Nodes visited:"}),(0,ep.jsx)("span",{className:"font-semibold",children:U.summary.total_nodes_visited})]}),(0,ep.jsx)("div",{className:"flex-1"}),(0,ep.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:["results","trace","json"].map(e=>(0,ep.jsx)("button",{onClick:()=>$(e),className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${G===e?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"results"===e?"Results":"trace"===e?"Trace":"JSON"},e))})]}),"results"===G&&(0,ep.jsxs)("div",{className:"space-y-4",children:[F&&F.length>0&&(0,ep.jsxs)(m7,{className:"border-orange-500/30 bg-orange-500/5",children:[(0,ep.jsx)(m9,{className:"py-3",children:(0,ep.jsxs)(ge,{className:"text-base flex items-center gap-2",children:[(0,ep.jsx)(eE,{className:"h-4 w-4 text-orange-500"}),(0,ep.jsx)("span",{children:"Observations"}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",F.length,")"]})]})}),(0,ep.jsx)(gn,{className:"pt-0 space-y-2",children:F.map((e,t)=>(0,ep.jsxs)("div",{className:"p-3 bg-background rounded-lg border border-orange-500/20",children:[(0,ep.jsx)("p",{className:"text-sm text-foreground",children:e.text}),(0,ep.jsxs)("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[(0,ep.jsx)("span",{className:"px-2 py-0.5 rounded bg-orange-500/10 text-orange-600",children:"Observation"}),(0,ep.jsxs)("span",{children:["Proof count: ",e.proof_count||1]}),(0,ep.jsxs)("span",{children:["Relevance: ",(e.relevance||0).toFixed(3)]})]})]},e.id||t))})]}),(0,ep.jsx)("div",{className:"space-y-3",children:0!==D.length||F&&0!==F.length?D.map((e,t)=>{let n=U?.visits?.find(t=>t.node_id===e.id),r=n?n.weights.final_weight:e.score||0;return(0,ep.jsx)(m7,{className:"cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>q(e),children:(0,ep.jsx)(gn,{className:"py-4",children:(0,ep.jsxs)("div",{className:"flex items-start gap-4",children:[(0,ep.jsx)("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center",children:(0,ep.jsx)("span",{className:"text-sm font-semibold text-primary",children:t+1})}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-foreground",children:e.text}),(0,ep.jsxs)("div",{className:"flex items-center gap-4 mt-2 text-xs text-muted-foreground",children:[(0,ep.jsx)("span",{className:"px-2 py-0.5 rounded bg-muted capitalize",children:e.type||"world"}),e.context&&(0,ep.jsx)("span",{className:"truncate max-w-xs",children:e.context}),e.occurred_start&&(0,ep.jsx)("span",{children:new Date(e.occurred_start).toLocaleDateString()})]})]}),(0,ep.jsxs)("div",{className:"flex-shrink-0 text-right",children:[(0,ep.jsx)("div",{className:"text-sm font-semibold",children:(r??0).toFixed(3)}),(0,ep.jsx)("div",{className:"text-xs text-muted-foreground",children:"score"})]}),(0,ep.jsx)(eT.ChevronRight,{className:"h-5 w-5 text-muted-foreground flex-shrink-0"})]})})},t)}):(0,ep.jsx)(m7,{children:(0,ep.jsxs)(gn,{className:"flex flex-col items-center justify-center py-12",children:[(0,ep.jsx)(ej.Search,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"No memories found for this query."})]})})})]}),"trace"===G&&U&&(0,ep.jsxs)("div",{className:"space-y-4",children:[U.retrieval_results&&U.retrieval_results.length>0&&(e={},U.retrieval_results.forEach(t=>{let n=t.fact_type||"all";e[n]||(e[n]=[]),e[n].push(t)}),t=Object.keys(e),(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"text-xs font-medium text-muted-foreground mb-3 flex items-center gap-2",children:[(0,ep.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,ep.jsx)("span",{children:"PARALLEL RETRIEVAL"}),(0,ep.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,ep.jsx)("div",{className:"space-y-2",children:t.map((t,n)=>{let r=e[t],i=`lane-${t}`,a=K.has(i),o=r.reduce((e,t)=>e+(t.results?.length||0),0),s=Math.max(...r.map(e=>e.duration_seconds||0)),l={world:{bg:"bg-blue-500/10",text:"text-blue-500",border:"border-blue-500/30"},experience:{bg:"bg-green-500/10",text:"text-green-500",border:"border-green-500/30"},opinion:{bg:"bg-purple-500/10",text:"text-purple-500",border:"border-purple-500/30"},all:{bg:"bg-gray-500/10",text:"text-gray-500",border:"border-gray-500/30"}},c=l[t]||l.all;return(0,ep.jsx)(m7,{className:`transition-colors ${a?"border-primary":c.border}`,children:(0,ep.jsxs)(gn,{className:"py-3 px-4",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-3 cursor-pointer",onClick:()=>ee(i),children:[(0,ep.jsx)("div",{className:`w-8 h-8 rounded-lg ${c.bg} flex items-center justify-center`,children:(0,ep.jsx)("span",{className:`text-sm font-bold ${c.text} capitalize`,children:t.charAt(0).toUpperCase()})}),(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-semibold text-foreground capitalize",children:t}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:[r.length," methods"]})]}),(0,ep.jsx)("div",{className:"flex gap-1.5 mt-1",children:r.map((e,t)=>(0,ep.jsxs)("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-muted text-muted-foreground capitalize",children:[e.method_name,": ",e.results?.length||0]},t))})]}),(0,ep.jsxs)("div",{className:"text-right",children:[(0,ep.jsx)("div",{className:"text-2xl font-bold text-foreground",children:o}),(0,ep.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:[s.toFixed(2),"s"]})]}),a?(0,ep.jsx)(mW.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ep.jsx)(eT.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]}),a&&(0,ep.jsx)("div",{className:"mt-4 pt-4 border-t border-border",children:(0,ep.jsx)("div",{className:`grid gap-3 ${1===r.length?"grid-cols-1":2===r.length?"grid-cols-2":3===r.length?"grid-cols-3":"grid-cols-4"}`,children:r.map((e,t)=>{let n,r,a,o,s=`${i}-method-${t}`,l=K.has(s),c=e.results||[];return(0,ep.jsxs)("div",{className:"flex flex-col",children:[(0,ep.jsxs)("div",{className:`p-3 rounded-lg cursor-pointer transition-colors ${l?"bg-primary/10 border border-primary":"bg-muted/50 hover:bg-muted"}`,onClick:e=>{e.stopPropagation(),ee(s)},children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-medium text-sm text-foreground capitalize",children:e.method_name}),"temporal"===e.method_name&&e.metadata?.constraint&&(0,ep.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[(0,ep.jsx)(eR,{className:"h-3 w-3"}),e.metadata.constraint.start?new Date(e.metadata.constraint.start).toLocaleDateString():"any"," → ",e.metadata.constraint.end?new Date(e.metadata.constraint.end).toLocaleDateString():"any"]})]}),l?(0,ep.jsx)(mW.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,ep.jsx)(eT.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),(0,ep.jsxs)("div",{className:"flex items-end justify-between",children:[(0,ep.jsx)("div",{className:"text-2xl font-bold text-foreground",children:c.length}),(0,ep.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:[e.duration_seconds?.toFixed(2),"s"]})]})]}),l&&c.length>0&&(n=`results-${s}`,a=(r=Q.has(n))?c:c.slice(0,5),o=c.length>5,(0,ep.jsxs)("div",{className:"mt-2 space-y-1.5 max-h-[300px] overflow-y-auto",children:[a.map((e,t)=>(0,ep.jsx)("div",{className:"p-2 bg-background rounded cursor-pointer hover:bg-muted/50 transition-colors border border-border",onClick:t=>{t.stopPropagation(),en(e)},children:(0,ep.jsxs)("div",{className:"flex items-start gap-2",children:[(0,ep.jsx)("span",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:t+1}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-xs text-foreground line-clamp-2",children:e.text}),(0,ep.jsx)("div",{className:"flex items-center gap-2 mt-1",children:(0,ep.jsx)("span",{className:"text-[10px] text-muted-foreground",children:(e.score||e.similarity||0).toFixed(4)})})]})]})},t)),o&&(0,ep.jsx)("button",{className:"w-full text-[10px] text-primary hover:text-primary/80 py-1.5 hover:bg-muted/50 rounded transition-colors",onClick:e=>{e.stopPropagation(),et(n)},children:r?"Show less":`View all ${c.length} results`})]}))]},s)})})})]})},i)})}),(0,ep.jsx)("div",{className:"flex justify-center py-2",children:(0,ep.jsx)("div",{className:"flex items-center gap-2",children:t.map((e,t)=>{let n={world:"bg-blue-500",experience:"bg-green-500",opinion:"bg-purple-500",all:"bg-gray-500"};return(0,ep.jsx)("div",{className:"flex flex-col items-center",children:(0,ep.jsx)("div",{className:`w-1 h-4 ${n[e]||n.all} rounded-full opacity-50`})},t)})})}),(0,ep.jsx)("div",{className:"flex justify-center",children:(0,ep.jsx)(jo,{className:"h-5 w-5 text-muted-foreground/50"})})]})),U.rrf_merged&&(n="rrf-merge",r=K.has(n),(0,ep.jsxs)("div",{children:[(0,ep.jsx)(m7,{className:`cursor-pointer transition-colors ${r?"border-primary":"hover:border-primary/50"}`,onClick:()=>ee(n),children:(0,ep.jsx)(gn,{className:"py-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-purple-500/10 flex items-center justify-center",children:(0,ep.jsx)("span",{className:"text-sm font-bold text-purple-500",children:"∪"})}),(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:"RRF Fusion"}),(0,ep.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:"merge"})]}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:"Reciprocal Rank Fusion of all retrieval results"})]}),(0,ep.jsx)("div",{className:"text-2xl font-bold text-foreground",children:U.rrf_merged.length}),r?(0,ep.jsx)(mW.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ep.jsx)(eT.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]})})}),r&&U.rrf_merged.length>0&&(i="results-rrf",o=(a=Q.has(i))?U.rrf_merged:U.rrf_merged.slice(0,5),s=U.rrf_merged.length>5,(0,ep.jsxs)("div",{className:"ml-6 mt-2 space-y-2 border-l-2 border-muted pl-4 max-h-[400px] overflow-y-auto",children:[o.map((e,t)=>(0,ep.jsx)("div",{className:"p-3 bg-muted/30 rounded-lg cursor-pointer hover:bg-muted/50 transition-colors",onClick:t=>{t.stopPropagation(),en(e)},children:(0,ep.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ep.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:t+1}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:e.text}),(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground mt-1",children:["RRF Score: ",(e.rrf_score||e.score||0).toFixed(4)]})]})]})},t)),s&&(0,ep.jsx)("button",{className:"w-full text-xs text-primary hover:text-primary/80 py-2 hover:bg-muted/50 rounded transition-colors",onClick:e=>{e.stopPropagation(),et(i)},children:a?"Show less":`View all ${U.rrf_merged.length} results`})]})),(0,ep.jsx)("div",{className:"flex justify-center py-2",children:(0,ep.jsx)(jo,{className:"h-4 w-4 text-muted-foreground/50"})})]})),U.reranked&&(l="reranking",c=K.has(l),(0,ep.jsxs)("div",{children:[(0,ep.jsx)(m7,{className:`cursor-pointer transition-colors ${c?"border-primary":"hover:border-primary/50"}`,onClick:()=>ee(l),children:(0,ep.jsx)(gn,{className:"py-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-amber-500/10 flex items-center justify-center",children:(0,ep.jsx)("span",{className:"text-sm font-bold text-amber-500",children:"⚡"})}),(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:"Combined Scoring"}),(0,ep.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:"rerank"})]}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:(0,ep.jsx)("span",{className:"font-mono text-xs",children:"ce × recency_boost(±10%) × temporal_boost(±10%)"})})]}),(0,ep.jsx)("div",{className:"text-2xl font-bold text-foreground",children:U.reranked.length}),c?(0,ep.jsx)(mW.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ep.jsx)(eT.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]})})}),c&&U.reranked.length>0&&(u="results-rerank",h=(d=Q.has(u))?U.reranked:U.reranked.slice(0,5),f=U.reranked.length>5,(0,ep.jsxs)("div",{className:"ml-6 mt-2 space-y-2 border-l-2 border-muted pl-4 max-h-[400px] overflow-y-auto",children:[h.map((e,t)=>{let n=e.score_components||{};return(0,ep.jsx)("div",{className:"p-3 bg-muted/30 rounded-lg cursor-pointer hover:bg-muted/50 transition-colors",onClick:t=>{t.stopPropagation(),en(e)},children:(0,ep.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ep.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:t+1}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:e.text}),(0,ep.jsxs)("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mt-2 text-[10px] text-muted-foreground font-mono",children:[(0,ep.jsxs)("span",{className:"font-semibold text-foreground",children:["= ",(e.rerank_score||e.score||0).toFixed(4)]}),void 0!==n.cross_encoder_score_normalized&&(0,ep.jsxs)("span",{title:"Cross-encoder score (primary relevance signal)",children:["CE: ",n.cross_encoder_score_normalized.toFixed(3)]}),void 0!==n.temporal&&.5!==n.temporal&&(0,ep.jsxs)("span",{title:"Temporal proximity boost (±10% — only active for temporal queries)",children:["Tmp: ",n.temporal.toFixed(3)]}),void 0!==n.recency&&(0,ep.jsxs)("span",{title:"Recency boost (±10% — based on memory age)",children:["Rec: ",n.recency.toFixed(3)]})]})]})]})},t)}),f&&(0,ep.jsx)("button",{className:"w-full text-xs text-primary hover:text-primary/80 py-2 hover:bg-muted/50 rounded transition-colors",onClick:e=>{e.stopPropagation(),et(u)},children:d?"Show less":`View all ${U.reranked.length} results`})]})),(0,ep.jsx)("div",{className:"flex justify-center py-2",children:(0,ep.jsx)(jo,{className:"h-4 w-4 text-muted-foreground/50"})})]})),(0,ep.jsx)(m7,{className:"border-primary bg-primary/5",children:(0,ep.jsx)(gn,{className:"py-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-primary/20 flex items-center justify-center",children:(0,ep.jsx)("span",{className:"text-sm font-bold text-primary",children:"✓"})}),(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:"Final Results"}),(0,ep.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-primary/20 text-primary",children:"output"})]}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:"Top results after all processing steps"})]}),(0,ep.jsx)("div",{className:"text-2xl font-bold text-primary",children:D?.length||0})]})})})]}),"json"===G&&(0,ep.jsxs)(m7,{children:[(0,ep.jsx)(m9,{children:(0,ep.jsx)(ge,{className:"text-lg",children:"Raw Response"})}),(0,ep.jsx)(gn,{children:(0,ep.jsx)("div",{className:"bg-muted p-4 rounded-lg overflow-auto max-h-[600px]",children:(0,ep.jsx)(gQ,{src:{results:D,...I&&{entities:I},...B&&{chunks:B},...F&&{observations:F},trace:U},collapsed:2,theme:"default"})})})]})]}),!W&&!D&&(0,ep.jsx)(m7,{className:"border-dashed",children:(0,ep.jsxs)(gn,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(ej.Search,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ready to Recall"}),(0,ep.jsx)("p",{className:"text-muted-foreground text-center max-w-md",children:"Enter a query above to search through your memories. Use filters to narrow down by fact type, budget, and more."})]})}),X&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,ep.jsx)(t1,{memory:X,onClose:()=>q(null),inPanel:!0,bankId:p||void 0})})]}):(0,ep.jsx)(m7,{className:"border-dashed",children:(0,ep.jsxs)(gn,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(eE,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("h3",{className:"text-xl font-semibold mb-2",children:"No Bank Selected"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Select a memory bank to start recalling."})]})})}let jl=(0,eN.default)("target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);var jc=e.i(82458),jc=jc,tH=tH;let ju={skepticism:{label:"Skepticism",shortLabel:"S",description:"How skeptical vs trusting when forming observations",lowLabel:"Trusting",highLabel:"Skeptical"},literalism:{label:"Literalism",shortLabel:"L",description:"How literally to interpret information when forming observations",lowLabel:"Flexible",highLabel:"Literal"},empathy:{label:"Empathy",shortLabel:"E",description:"How much to consider emotional context when forming observations",lowLabel:"Detached",highLabel:"Empathetic"}};function jd({hideReflectFields:e=!1}){let t=(0,eg.useRouter)(),{currentBank:n,setCurrentBank:r,loadBanks:i}=(0,ey.useBank)(),{features:a}=(0,ew.useFeatures)();a?.observations;let[o,s]=(0,em.useState)(null),[l,c]=(0,em.useState)(null),[u,d]=(0,em.useState)([]),[h,f]=(0,em.useState)(0),[p,g]=(0,em.useState)([]),[v,x]=(0,em.useState)(0),[y,b]=(0,em.useState)(!1),[w,j]=(0,em.useState)(!1),[N,k]=(0,em.useState)(!1),[E,C]=(0,em.useState)(!1),[_,S]=(0,em.useState)(null),[T,A]=(0,em.useState)(null),[O,M]=(0,em.useState)(!1),[P,D]=(0,em.useState)(!1),[L,I]=(0,em.useState)(!1),[R,B]=(0,em.useState)(!1),[z,F]=(0,em.useState)(!1),[V,U]=(0,em.useState)(!1),[H,W]=(0,em.useState)(null),[Y]=(0,em.useState)(10),[G,$]=(0,em.useState)(0),[X,q]=(0,em.useState)(null),K=async(e=H,t=G)=>{if(n)try{let r=await eD.client.listOperations(n,{status:e||void 0,limit:Y,offset:t});d(r.operations||[]),f(r.total||0)}catch(e){console.error("Error loading operations:",e)}},Z=async(e=!1)=>{if(n){if(e){try{let[e,t,r]=await Promise.all([eD.client.getBankStats(n),eD.client.listDirectives(n),eD.client.listMentalModels(n)]);c(e),g(t.items||[]),x(r.items?.length||0)}catch(e){console.error("Error refreshing stats:",e)}return}b(!0);try{let[e,t,r,i]=await Promise.all([eD.client.getBankProfile(n),eD.client.getBankStats(n),eD.client.listDirectives(n),eD.client.listMentalModels(n)]);s(e),c(t),g(r.items||[]),x(i.items?.length||0),await K()}catch(e){}finally{b(!1)}}},Q=async()=>{if(n){I(!0);try{await eD.client.deleteBank(n),D(!1),r(null),await i(),t.push("/")}catch(e){}finally{I(!1)}}},J=async()=>{if(n){F(!0);try{let e=await eD.client.clearObservations(n);B(!1),await Z(),ev.toast.success("Success",{description:e.message||"Observations cleared successfully"})}catch(e){}finally{F(!1)}}},ee=async()=>{if(n&&T){M(!0);try{await eD.client.deleteDirective(n,T.id),g(e=>e.filter(e=>e.id!==T.id)),_?.id===T.id&&S(null),A(null)}catch(e){}finally{M(!1)}}};return((0,em.useEffect)(()=>{if(n){Z();let e=setInterval(()=>Z(!0),5e3);return()=>clearInterval(e)}},[n]),(0,em.useEffect)(()=>{let e=e=>{"Escape"===e.key&&S(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),n)?y&&!o?(0,ep.jsx)(m7,{children:(0,ep.jsxs)(gn,{className:"text-center py-10",children:[(0,ep.jsx)(eG,{className:"w-12 h-12 mx-auto mb-3 text-muted-foreground animate-pulse"}),(0,ep.jsx)("div",{className:"text-lg text-muted-foreground",children:"Loading profile..."})]})}):(0,ep.jsxs)("div",{className:"space-y-6",children:[!e&&(0,ep.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,ep.jsxs)(m7,{children:[(0,ep.jsx)(m9,{className:"pb-2",children:(0,ep.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)(ge,{className:"flex items-center gap-2 text-lg",children:[(0,ep.jsx)(gi,{className:"w-5 h-5 text-primary"}),"Disposition Profile"]}),(0,ep.jsx)(gt,{children:"Traits that shape the reasoning and perspective"})]}),(0,ep.jsx)(eL.Button,{onClick:()=>j(!0),variant:"ghost",size:"sm",children:(0,ep.jsx)(mU,{className:"h-4 w-4"})})]})}),(0,ep.jsx)(gn,{children:o&&(0,ep.jsx)("div",{className:"space-y-4",children:Object.keys(ju).map(e=>(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:ju[e].label}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:ju[e].description})]}),(0,ep.jsxs)("span",{className:"text-sm font-bold text-primary",children:[o.disposition[e],"/5"]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:ju[e].lowLabel}),(0,ep.jsx)("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden",children:(0,ep.jsx)("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${(o.disposition[e]-1)/4*100}%`}})}),(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:ju[e].highLabel})]})]},e))})})]}),(0,ep.jsxs)(m7,{children:[(0,ep.jsx)(m9,{className:"pb-2",children:(0,ep.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)(ge,{className:"flex items-center gap-2 text-lg",children:[(0,ep.jsx)(jl,{className:"w-5 h-5 text-primary"}),"Mission"]}),(0,ep.jsx)(gt,{children:"Affects how observations, reflect, and mental models are created"})]}),(0,ep.jsx)(eL.Button,{onClick:()=>k(!0),variant:"ghost",size:"sm",children:(0,ep.jsx)(mU,{className:"h-4 w-4"})})]})}),(0,ep.jsx)(gn,{children:(0,ep.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap leading-relaxed",children:o?.mission||"No mission set. Set a mission to derive structural mental models and personalize reflect responses."})})]})]}),(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,ep.jsx)(jc.default,{className:"w-5 h-5 text-rose-500"}),"Directives"]}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:"Hard rules that must be followed during reflect"})]}),(0,ep.jsxs)(eL.Button,{onClick:()=>C(!0),variant:"outline",size:"sm",className:"h-8",children:[(0,ep.jsx)(fz.Plus,{className:"w-4 h-4 mr-1"}),"Add"]})]}),p.length>0?(0,ep.jsx)("div",{className:"grid grid-cols-2 gap-3",children:p.map(e=>(0,ep.jsx)(m7,{className:`cursor-pointer transition-colors border-rose-500/30 ${_?.id===e.id?"bg-rose-500/10 border-rose-500":"hover:bg-rose-500/5"}`,onClick:()=>S(e),children:(0,ep.jsx)(gn,{className:"p-3",children:(0,ep.jsxs)("div",{className:"flex items-start gap-2",children:[(0,ep.jsx)(jc.default,{className:"w-4 h-4 text-rose-500 shrink-0 mt-0.5"}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("span",{className:"font-medium text-sm text-foreground",children:e.name}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 mt-1",children:e.content}),e.tags&&e.tags.length>0&&(0,ep.jsxs)("div",{className:"flex items-center gap-1 mt-2 flex-wrap",children:[(0,ep.jsx)(tB,{className:"w-3 h-3 text-muted-foreground"}),e.tags.map(e=>(0,ep.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:e},e))]})]})]})})},e.id))}):(0,ep.jsxs)("div",{className:"p-6 border border-dashed border-rose-500/30 rounded-lg text-center",children:[(0,ep.jsx)(jc.default,{className:"w-6 h-6 mx-auto mb-2 text-rose-500/50"}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:"No directives yet. Directives are hard rules that must be followed during reflect."})]})]}),(0,ep.jsx)(mv,{open:P,onOpenChange:D,children:(0,ep.jsxs)(mD,{children:[(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mR,{children:"Delete Memory Bank"}),(0,ep.jsx)(mB,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to delete the memory bank"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:n}),"?"]}),(0,ep.jsx)("p",{className:"text-red-600 dark:text-red-400 font-medium",children:"This action cannot be undone. All memories, entities, documents, and the bank profile will be permanently deleted."}),l&&(0,ep.jsxs)("p",{children:["This will delete ",l.total_nodes," memories, ",l.total_documents," ","documents, and ",l.total_links," links."]})]})})]}),(0,ep.jsxs)(mI,{children:[(0,ep.jsx)(mF,{disabled:L,children:"Cancel"}),(0,ep.jsx)(mz,{onClick:Q,disabled:L,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:L?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eW,{className:"w-4 h-4 mr-2 animate-spin"}),"Deleting..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(mV,{className:"w-4 h-4 mr-2"}),"Delete Bank"]})})]})]})}),(0,ep.jsx)(mv,{open:R,onOpenChange:B,children:(0,ep.jsxs)(mD,{children:[(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mR,{children:"Clear Observations"}),(0,ep.jsx)(mB,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to clear all observations for"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:n}),"?"]}),(0,ep.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:"This will delete all consolidated knowledge. Observations will be regenerated the next time consolidation runs."}),l&&l.total_observations>0&&(0,ep.jsxs)("p",{children:["This will delete ",l.total_observations," observations."]})]})})]}),(0,ep.jsxs)(mI,{children:[(0,ep.jsx)(mF,{disabled:z,children:"Cancel"}),(0,ep.jsx)(mz,{onClick:J,disabled:z,className:"bg-amber-500 text-white hover:bg-amber-600",children:z?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Clearing..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(mV,{className:"w-4 h-4 mr-2"}),"Clear Observations"]})})]})]})}),(0,ep.jsx)(jp,{open:E,mode:"create",onClose:()=>C(!1),onCreated:e=>{g(t=>[e,...t]),C(!1)}}),(0,ep.jsx)(mv,{open:!!T,onOpenChange:e=>!e&&A(null),children:(0,ep.jsxs)(mD,{children:[(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mR,{children:"Delete Directive"}),(0,ep.jsxs)(mB,{children:["Are you sure you want to delete"," ",(0,ep.jsxs)("span",{className:"font-semibold",children:['"',T?.name,'"']}),"?",(0,ep.jsx)("br",{}),(0,ep.jsx)("br",{}),(0,ep.jsx)("span",{className:"text-destructive font-semibold",children:"This action cannot be undone."})]})]}),(0,ep.jsxs)(mI,{className:"flex-row justify-end space-x-2",children:[(0,ep.jsx)(mF,{className:"mt-0",children:"Cancel"}),(0,ep.jsxs)(mz,{onClick:ee,disabled:O,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[O?(0,ep.jsx)(tH.default,{className:"w-4 h-4 animate-spin mr-1"}):null,"Delete"]})]})]})}),_&&(0,ep.jsx)(jm,{directive:_,onClose:()=>S(null),onDelete:()=>A({id:_.id,name:_.name}),onUpdated:e=>{g(t=>t.map(t=>t.id===e.id?e:t)),S(e)}}),w&&o&&(0,ep.jsx)(jh,{disposition:o.disposition,onClose:()=>j(!1),onSaved:async()=>{await Z(),j(!1)}}),N&&o&&(0,ep.jsx)(jf,{mission:o.mission||"",onClose:()=>k(!1),onSaved:async()=>{await Z(),k(!1)}})]}):(0,ep.jsx)(m7,{children:(0,ep.jsxs)(gn,{className:"p-10 text-center",children:[(0,ep.jsx)("h3",{className:"text-xl font-semibold mb-2 text-card-foreground",children:"No Bank Selected"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Please select a memory bank from the dropdown above to view its profile."})]})})}function jh({disposition:e,onClose:t,onSaved:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)(!1),[o,s]=(0,em.useState)(e),l=async()=>{if(r){a(!0);try{await eD.client.updateBankConfig(r,{disposition_skepticism:o.skepticism,disposition_literalism:o.literalism,disposition_empathy:o.empathy}),n()}catch(e){}finally{a(!1)}}};return(0,ep.jsx)(tY.Dialog,{open:!0,onOpenChange:t,children:(0,ep.jsxs)(tY.DialogContent,{className:"max-w-xl",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsx)(tY.DialogTitle,{children:"Edit Disposition Traits"}),(0,ep.jsx)(tY.DialogDescription,{children:"Traits that shape the reasoning and perspective"})]}),(0,ep.jsx)("div",{className:"space-y-4 py-4",children:Object.keys(ju).map(e=>(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:ju[e].label}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:ju[e].description})]}),(0,ep.jsxs)("span",{className:"text-sm font-bold text-primary",children:[o[e],"/5"]})]}),(0,ep.jsxs)("div",{className:"flex justify-between text-[10px] text-muted-foreground",children:[(0,ep.jsx)("span",{children:ju[e].lowLabel}),(0,ep.jsx)("span",{children:ju[e].highLabel})]}),(0,ep.jsx)("input",{type:"range",min:"1",max:"5",step:"1",value:o[e],onChange:t=>s(n=>({...n,[e]:parseInt(t.target.value)})),className:"w-full h-2 bg-muted rounded-lg appearance-none cursor-pointer accent-primary"})]},e))}),(0,ep.jsxs)(tY.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{onClick:t,variant:"outline",disabled:i,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:l,disabled:i,children:i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eW,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})})}function jf({mission:e,onClose:t,onSaved:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)(!1),[o,s]=(0,em.useState)(e),l=async()=>{if(r){a(!0);try{await eD.client.updateBankConfig(r,{reflect_mission:o||null}),n()}catch(e){}finally{a(!1)}}};return(0,ep.jsx)(tY.Dialog,{open:!0,onOpenChange:t,children:(0,ep.jsxs)(tY.DialogContent,{className:"max-w-xl",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsx)(tY.DialogTitle,{children:"Edit Mission"}),(0,ep.jsx)(tY.DialogDescription,{children:"Affects how observations, reflect, and mental models are created"})]}),(0,ep.jsx)("div",{className:"space-y-2 py-4",children:(0,ep.jsx)(gl.Textarea,{value:o,onChange:e=>s(e.target.value),placeholder:"e.g., I am a PM for the engineering team. I help coordinate sprints and track project progress...",rows:8,className:"resize-none"})}),(0,ep.jsxs)(tY.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{onClick:t,variant:"outline",disabled:i,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:l,disabled:i,children:i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eW,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})})}function jp({open:e,mode:t,directive:n,onClose:r,onCreated:i,onSaved:a}){let{currentBank:o}=(0,ey.useBank)(),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)({name:"",content:"",tags:""});(0,em.useEffect)(()=>{"edit"===t&&n?u({name:n.name,content:n.content,tags:(n.tags||[]).join(", ")}):"create"===t&&u({name:"",content:"",tags:""})},[e,t,n]);let d=async()=>{if(o&&c.name.trim()&&c.content.trim()){l(!0);try{let e=c.tags.split(",").map(e=>e.trim()).filter(e=>e.length>0);if("create"===t){let t=await eD.client.createDirective(o,{name:c.name.trim(),content:c.content.trim(),tags:e.length>0?e:void 0});u({name:"",content:"",tags:""}),i?.(t)}else if(n){let t=await eD.client.updateDirective(o,n.id,{name:c.name.trim(),content:c.content.trim(),tags:e});a?.(t),r()}}catch(e){}finally{l(!1)}}},h=()=>{"create"===t&&u({name:"",content:"",tags:""}),r()};return(0,ep.jsx)(tY.Dialog,{open:e,onOpenChange:e=>!e&&h(),children:(0,ep.jsxs)(tY.DialogContent,{className:"sm:max-w-lg",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsxs)(tY.DialogTitle,{className:"flex items-center gap-2",children:[(0,ep.jsx)(jc.default,{className:"w-5 h-5 text-rose-500"}),"create"===t?"Create":"Edit"," Directive"]}),(0,ep.jsx)(tY.DialogDescription,{children:"Directives are hard rules that must be followed during reflect."})]}),(0,ep.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Name *"}),(0,ep.jsx)(eI.Input,{value:c.name,onChange:e=>u({...c,name:e.target.value}),placeholder:"e.g., Competitor Policy"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Rule *"}),(0,ep.jsx)(gl.Textarea,{value:c.content,onChange:e=>u({...c,content:e.target.value}),placeholder:"e.g., Never mention competitor products directly.",className:"min-h-[120px]"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("label",{className:"text-sm font-medium text-foreground",children:["Tags ",(0,ep.jsx)("span",{className:"text-muted-foreground font-normal",children:"(optional)"})]}),(0,ep.jsx)(eI.Input,{value:c.tags,onChange:e=>u({...c,tags:e.target.value}),placeholder:"e.g., project-x, team-alpha (comma-separated)"})]})]}),(0,ep.jsxs)(tY.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:h,disabled:s,children:"Cancel"}),(0,ep.jsxs)(eL.Button,{onClick:d,disabled:s||!c.name.trim()||!c.content.trim(),className:"bg-rose-500 hover:bg-rose-600",children:[s?(0,ep.jsx)(tH.default,{className:"w-4 h-4 animate-spin mr-1"}):null,"create"===t?"Create":"Save"]})]})]})})}function jm({directive:e,onClose:t,onDelete:n,onUpdated:r}){let[i,a]=(0,em.useState)(!1);return(0,ep.jsxs)("div",{className:"fixed right-0 top-0 h-screen w-1/2 bg-card border-l-2 border-rose-500 shadow-2xl z-50 overflow-y-auto animate-in slide-in-from-right duration-300 ease-out",children:[(0,ep.jsxs)("div",{className:"p-6",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-start mb-8 pb-5 border-b border-border",children:[(0,ep.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ep.jsx)(jc.default,{className:"w-5 h-5 text-rose-500"}),(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("h3",{className:"text-xl font-bold text-foreground",children:e.name}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",onClick:()=>a(!0),className:"h-7 w-7 p-0",children:(0,ep.jsx)(mU,{className:"h-3.5 w-3.5"})})]}),(0,ep.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-rose-500/10 text-rose-600 dark:text-rose-400",children:"directive"})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",onClick:n,className:"h-8 w-8 p-0 text-muted-foreground hover:text-rose-500",children:(0,ep.jsx)(mV,{className:"h-4 w-4"})}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",onClick:t,className:"h-8 w-8 p-0",children:(0,ep.jsx)(tU.X,{className:"h-4 w-4"})})]})]}),(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Rule"}),(0,ep.jsx)("div",{className:"prose prose-base dark:prose-invert max-w-none",children:(0,ep.jsx)(bv,{remarkPlugins:[wX],children:e.content})})]}),e.tags&&e.tags.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Tags"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-2",children:e.tags.map(e=>(0,ep.jsx)("span",{className:"px-2 py-1 rounded bg-muted text-muted-foreground text-sm",children:e},e))})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:"ID"}),(0,ep.jsx)("code",{className:"text-sm font-mono break-all text-muted-foreground",children:e.id})]})]})]}),(0,ep.jsx)(jp,{open:i,mode:"edit",directive:e,onClose:()=>a(!1),onSaved:r})]})}let jg=(0,e4.cva)("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),jv=em.forwardRef(({className:e,variant:t,...n},r)=>(0,ep.jsx)("div",{ref:r,role:"alert",className:(0,eO.cn)(jg({variant:t}),e),...n}));jv.displayName="Alert",em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("h5",{ref:n,className:(0,eO.cn)("mb-1 font-medium leading-none tracking-tight",e),...t})).displayName="AlertTitle";let jx=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("text-sm [&_p]:leading-relaxed",e),...t}));jx.displayName="AlertDescription";var tH=tH;let jy=(0,eN.default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),jb=[{value:"HARM_CATEGORY_HARASSMENT",label:"Harassment"},{value:"HARM_CATEGORY_HATE_SPEECH",label:"Hate Speech"},{value:"HARM_CATEGORY_SEXUALLY_EXPLICIT",label:"Sexually Explicit"},{value:"HARM_CATEGORY_DANGEROUS_CONTENT",label:"Dangerous Content"}],jw=[{value:"HARM_BLOCK_THRESHOLD_UNSPECIFIED",label:"Unspecified (use Gemini default)"},{value:"OFF",label:"Off (filter disabled)"},{value:"BLOCK_NONE",label:"Block none"},{value:"BLOCK_LOW_AND_ABOVE",label:"Block low & above"},{value:"BLOCK_MEDIUM_AND_ABOVE",label:"Block medium & above"},{value:"BLOCK_ONLY_HIGH",label:"Block only high"}],jj=jb.map(e=>({category:e.value,threshold:"BLOCK_NONE"})),jN=[{label:"Core",tools:["retain","sync_retain","recall","reflect"]},{label:"Bank management",tools:["list_banks","create_bank","get_bank","get_bank_stats","update_bank","delete_bank","clear_memories"]},{label:"Mental models",tools:["list_mental_models","get_mental_model","create_mental_model","update_mental_model","delete_mental_model","refresh_mental_model"]},{label:"Directives",tools:["list_directives","create_directive","delete_directive"]},{label:"Memories",tools:["list_memories","get_memory"]},{label:"Documents",tools:["list_documents","get_document","delete_document"]},{label:"Operations",tools:["list_operations","get_operation","cancel_operation"]},{label:"Tags",tools:["list_tags"]}],jk=jN.flatMap(e=>e.tools);function jE(e){return Array.isArray(e)?e:e&&"object"==typeof e&&Array.isArray(e.attributes)?e.attributes:null}function jC(e){return{retain_chunk_size:e.retain_chunk_size??null,retain_extraction_mode:e.retain_extraction_mode??null,retain_mission:e.retain_mission??null,retain_custom_instructions:e.retain_custom_instructions??null,entities_allow_free_form:e.entities_allow_free_form??null,entity_labels:jE(e.entity_labels)}}function j_(e){return{retain_default_strategy:e.retain_default_strategy??null,retain_strategies:e.retain_strategies??null}}function jS(e){return{enable_observations:e.enable_observations??null,consolidation_llm_batch_size:e.consolidation_llm_batch_size??null,consolidation_source_facts_max_tokens:e.consolidation_source_facts_max_tokens??null,consolidation_source_facts_max_tokens_per_observation:e.consolidation_source_facts_max_tokens_per_observation??null,observations_mission:e.observations_mission??null,max_observations_per_scope:e.max_observations_per_scope??null}}function jT(e){return{mcp_enabled_tools:e.mcp_enabled_tools??null}}function jA(e){return{llm_gemini_safety_settings:e.llm_gemini_safety_settings??null}}let jO={reflect_mission:"",disposition_skepticism:3,disposition_literalism:3,disposition_empathy:3};function jM(){let{currentBank:e}=(0,ey.useBank)(),{features:t}=(0,ew.useFeatures)(),n=t?.bank_config_api??!0,[r,i]=(0,em.useState)(!0),[a,o]=(0,em.useState)({}),[s,l]=(0,em.useState)(jO),[c,u]=(0,em.useState)(jC({})),[d,h]=(0,em.useState)(j_({})),[f,p]=(0,em.useState)(jS({})),[g,v]=(0,em.useState)(jO),[x,y]=(0,em.useState)(jT({})),[b,w]=(0,em.useState)(jA({})),[j,N]=(0,em.useState)(!1),[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(!1),[A,O]=(0,em.useState)(!1),[M,P]=(0,em.useState)(null),[D,L]=(0,em.useState)(null),[I,R]=(0,em.useState)(null),[B,z]=(0,em.useState)(null),[F,V]=(0,em.useState)(null),U=(0,em.useMemo)(()=>JSON.stringify(c)!==JSON.stringify(jC(a))||JSON.stringify(d)!==JSON.stringify(j_(a)),[c,d,a]),H=(0,em.useMemo)(()=>JSON.stringify(f)!==JSON.stringify(jS(a)),[f,a]),W=(0,em.useMemo)(()=>JSON.stringify(g)!==JSON.stringify(s),[g,s]),Y=(0,em.useMemo)(()=>JSON.stringify(x)!==JSON.stringify(jT(a)),[x,a]),G=(0,em.useMemo)(()=>JSON.stringify(b)!==JSON.stringify(jA(a)),[b,a]);(0,em.useEffect)(()=>{e&&$()},[e]);let $=async()=>{if(e){i(!0);try{let[t,n]=await Promise.all([eD.client.getBankConfig(e),eD.client.getBankProfile(e)]),r=t.config,i={reflect_mission:n.mission??"",disposition_skepticism:r.disposition_skepticism??n.disposition?.skepticism??3,disposition_literalism:r.disposition_literalism??n.disposition?.literalism??3,disposition_empathy:r.disposition_empathy??n.disposition?.empathy??3};o(r),l(i),u(jC(r)),h(j_(r)),p(jS(r)),v(i),y(jT(r)),w(jA(r))}catch(e){console.error("Failed to load bank data:",e)}finally{i(!1)}}},X=async()=>{if(e){N(!0),P(null);try{let t={...c,...d};await eD.client.updateBankConfig(e,t),o(e=>({...e,...t}))}catch(e){P(e.message||"Failed to save retain settings")}finally{N(!1)}}},q=async()=>{if(e){E(!0),L(null);try{await eD.client.updateBankConfig(e,f),o(e=>({...e,...f}))}catch(e){L(e.message||"Failed to save observations settings")}finally{E(!1)}}},K=async()=>{if(e){_(!0),R(null);try{await eD.client.updateBankConfig(e,{reflect_mission:g.reflect_mission||null,disposition_skepticism:g.disposition_skepticism,disposition_literalism:g.disposition_literalism,disposition_empathy:g.disposition_empathy}),l(g)}catch(e){R(e.message||"Failed to save reflect settings")}finally{_(!1)}}},Z=async()=>{if(e){T(!0),z(null);try{await eD.client.updateBankConfig(e,x),o(e=>({...e,...x}))}catch(e){z(e.message||"Failed to save MCP settings")}finally{T(!1)}}},Q=async()=>{if(e){O(!0),V(null);try{await eD.client.updateBankConfig(e,b),o(e=>({...e,...b}))}catch(e){V(e.message||"Failed to save Gemini settings")}finally{O(!1)}}};return e?n?r?(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)(tH.default,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,ep.jsx)(ep.Fragment,{children:(0,ep.jsxs)("div",{className:"space-y-8",children:[(0,ep.jsxs)(jz,{title:"Retain",description:"Default extraction settings and named strategies. Pass a strategy name on retain requests to override defaults per-item.",error:M,dirty:U,saving:j,onSave:X,children:[(0,ep.jsx)(jF,{label:"Default strategy",description:"Applied automatically when no strategy is specified on a request.",children:(0,ep.jsxs)(tR.Select,{value:d.retain_default_strategy??"__none__",onValueChange:e=>h(t=>({...t,retain_default_strategy:"__none__"===e?null:e})),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-full",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"__none__",children:(0,ep.jsx)("span",{className:"text-muted-foreground italic",children:"Default"})}),Object.keys(d.retain_strategies??{}).map(e=>(0,ep.jsx)(tR.SelectItem,{value:e,children:e},e))]})]})}),(0,ep.jsx)(jR,{defaultValues:c,onDefaultChange:e=>u(t=>({...t,...e})),strategies:d.retain_strategies,onStrategiesChange:e=>h(t=>({...t,retain_strategies:e}))})]}),(0,ep.jsxs)(jz,{title:"Observations",description:"Control how facts are synthesized into durable observations",error:D,dirty:H,saving:k,onSave:q,children:[(0,ep.jsx)(jF,{label:"Enable Observations",description:"Enable automatic consolidation of facts into observations",children:(0,ep.jsx)("div",{className:"flex justify-end",children:(0,ep.jsx)(tI.Switch,{checked:f.enable_observations??!1,onCheckedChange:e=>p(t=>({...t,enable_observations:e}))})})}),(0,ep.jsx)(jV,{label:"Mission",description:"What this bank should synthesise into durable observations. Replaces the built-in consolidation rules — leave blank to use the server default.",value:f.observations_mission??"",onChange:e=>p(t=>({...t,observations_mission:e||null})),placeholder:"e.g. Observations are stable facts about people and projects. Always include preferences, skills, and recurring patterns. Ignore one-off events and ephemeral state.",rows:3}),(0,ep.jsx)(jF,{label:"LLM Batch Size",description:"Number of facts sent to the LLM in a single consolidation call. Higher values reduce LLM calls at the cost of larger prompts. Leave blank to use the server default.",children:(0,ep.jsx)(eI.Input,{type:"number",min:1,max:64,value:f.consolidation_llm_batch_size??"",onChange:e=>p(t=>({...t,consolidation_llm_batch_size:e.target.value?parseInt(e.target.value,10):null})),placeholder:"Server default"})}),(0,ep.jsx)(jF,{label:"Source Facts Max Tokens",description:"Total token budget for source facts included with observations during consolidation. -1 = unlimited.",children:(0,ep.jsx)(eI.Input,{type:"number",min:-1,value:f.consolidation_source_facts_max_tokens??"",onChange:e=>p(t=>({...t,consolidation_source_facts_max_tokens:e.target.value?parseInt(e.target.value,10):null})),placeholder:"Server default"})}),(0,ep.jsx)(jF,{label:"Source Facts Max Tokens Per Observation",description:"Per-observation token cap for source facts during consolidation. Each observation gets at most this many tokens of source facts. -1 = unlimited.",children:(0,ep.jsx)(eI.Input,{type:"number",min:-1,value:f.consolidation_source_facts_max_tokens_per_observation??"",onChange:e=>p(t=>({...t,consolidation_source_facts_max_tokens_per_observation:e.target.value?parseInt(e.target.value,10):null})),placeholder:"Server default"})}),(0,ep.jsx)(jF,{label:"Max Observations Per Scope",description:"Maximum number of observations allowed per tag scope. When the limit is reached, only updates and deletes are allowed. Observations with no tags are not subject to this limit. -1 = unlimited.",children:(0,ep.jsx)(eI.Input,{type:"number",min:-1,value:f.max_observations_per_scope??"",onChange:e=>p(t=>({...t,max_observations_per_scope:e.target.value?parseInt(e.target.value,10):null})),placeholder:"Server default"})})]}),(0,ep.jsxs)(jz,{title:"Reflect",description:"Shape how the bank reasons and responds in reflect operations",error:I,dirty:W,saving:C,onSave:K,children:[(0,ep.jsx)(jV,{label:"Mission",description:"Agent identity and purpose. Used as framing context in reflect.",value:g.reflect_mission,onChange:e=>v(t=>({...t,reflect_mission:e})),placeholder:"e.g. You are a senior engineering assistant. Always ground answers in documented decisions and rationale. Ignore speculation. Be direct and precise.",rows:3}),(0,ep.jsx)(jU,{label:"Skepticism",description:"How skeptical vs trusting when evaluating claims",lowLabel:"Trusting",highLabel:"Skeptical",value:g.disposition_skepticism,onChange:e=>v(t=>({...t,disposition_skepticism:e}))}),(0,ep.jsx)(jU,{label:"Literalism",description:"How literally to interpret information",lowLabel:"Flexible",highLabel:"Literal",value:g.disposition_literalism,onChange:e=>v(t=>({...t,disposition_literalism:e}))}),(0,ep.jsx)(jU,{label:"Empathy",description:"How much to weight emotional context",lowLabel:"Detached",highLabel:"Empathetic",value:g.disposition_empathy,onChange:e=>v(t=>({...t,disposition_empathy:e}))})]}),(0,ep.jsxs)(jz,{title:"MCP Tools",description:"Restrict which MCP tools this bank exposes to agents",error:B,dirty:Y,saving:S,onSave:Z,children:[(0,ep.jsx)(jF,{label:"Restrict tools",description:"When off, all tools are available. When on, only the selected tools can be invoked for this bank.",children:(0,ep.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,ep.jsx)(tI.Switch,{checked:null!==x.mcp_enabled_tools,onCheckedChange:e=>y({mcp_enabled_tools:e?[...jk]:null})}),(0,ep.jsx)(e8,{className:"text-xs text-muted-foreground",children:null!==x.mcp_enabled_tools?"Enabled":"Disabled"})]})}),null!==x.mcp_enabled_tools&&(0,ep.jsx)(jB,{selected:x.mcp_enabled_tools,onChange:e=>y({mcp_enabled_tools:e})})]}),(0,ep.jsx)(jz,{title:"Models",description:"Provider-specific model settings",error:F,dirty:G,saving:A,onSave:Q,children:(0,ep.jsxs)("div",{className:"px-6 py-4 space-y-4",children:[(0,ep.jsx)("p",{className:"text-sm font-semibold",children:"Gemini / Vertex AI"}),(0,ep.jsxs)("div",{className:"pl-4 border-l-2 border-border/40 space-y-4",children:[(0,ep.jsx)(jF,{label:"Safety settings",description:(0,ep.jsxs)(ep.Fragment,{children:["When off, Gemini's default safety thresholds are used. When on, configure thresholds per harm category."," ",(0,ep.jsx)("a",{href:"https://ai.google.dev/gemini-api/docs/safety-settings",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground transition-colors",children:"Learn more"})]}),children:(0,ep.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,ep.jsx)(tI.Switch,{checked:null!==b.llm_gemini_safety_settings,onCheckedChange:e=>w({llm_gemini_safety_settings:e?[...jj]:null})}),(0,ep.jsx)(e8,{className:"text-xs text-muted-foreground",children:null!==b.llm_gemini_safety_settings?"Custom":"Default"})]})}),null!==b.llm_gemini_safety_settings&&(0,ep.jsx)(jW,{value:b.llm_gemini_safety_settings,onChange:e=>w({llm_gemini_safety_settings:e})})]})]})})]})}):(0,ep.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 gap-3 text-center",children:[(0,ep.jsx)("p",{className:"text-base font-medium text-foreground",children:"Bank configuration is disabled"}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground max-w-sm",children:["Set"," ",(0,ep.jsx)("code",{className:"font-mono text-xs bg-muted px-1 py-0.5 rounded",children:"HINDSIGHT_API_ENABLE_BANK_CONFIG_API=true"})," ","to enable per-bank configuration."]})]}):(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)("p",{className:"text-muted-foreground",children:"No bank selected"})})}let jP=["concise","verbose","verbatim","chunks","custom"],jD="__inherit__";function jL({values:e,onChange:t,isOverride:n=!1}){let r=e.retain_extraction_mode??(n?jD:""),i="custom"===e.retain_extraction_mode;return(0,ep.jsxs)("div",{className:"divide-y divide-border/40",children:[(0,ep.jsx)(jF,{label:"Extraction Mode",description:"How aggressively to extract facts. concise = selective, verbose = capture everything, verbatim = store chunks as-is (still extract entities/time), chunks = no LLM, custom = write your own rules.",children:(0,ep.jsxs)(tR.Select,{value:r,onValueChange:e=>t({retain_extraction_mode:e===jD?null:e||null}),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-full",children:(0,ep.jsx)(tR.SelectValue,{placeholder:n?"Inherited from default":void 0})}),(0,ep.jsxs)(tR.SelectContent,{children:[n&&(0,ep.jsx)(tR.SelectItem,{value:jD,children:(0,ep.jsx)("span",{className:"text-muted-foreground italic",children:"inherited"})}),jP.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e,children:e},e))]})]})}),(0,ep.jsx)(jF,{label:"Chunk Size",description:"Size of text chunks for processing (characters)",children:(0,ep.jsx)(eI.Input,{type:"number",min:500,max:8e3,value:e.retain_chunk_size??"",onChange:e=>t({retain_chunk_size:e.target.value?parseFloat(e.target.value):null}),placeholder:n?"Inherited from default":void 0})}),(0,ep.jsx)(jV,{label:"Mission",description:"What this bank should pay attention to during extraction. Steers the LLM without replacing the extraction rules.",value:e.retain_mission??"",onChange:e=>t({retain_mission:e||null}),placeholder:n?"Inherited from default":"e.g. Always include technical decisions, API design choices, and architectural trade-offs.",rows:3}),i&&(0,ep.jsx)(jV,{label:"Custom Extraction Prompt",description:"Replaces the built-in extraction rules entirely. Only active when Extraction Mode is set to custom.",value:e.retain_custom_instructions??"",onChange:e=>t({retain_custom_instructions:e||null}),rows:5}),(0,ep.jsx)(jF,{label:"Free Form Entities",description:"Extract regular named entities (people, places, concepts) alongside entity labels. Disable to restrict extraction to entity labels only.",children:(0,ep.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,ep.jsx)(e8,{className:"text-sm text-muted-foreground cursor-pointer select-none",children:e.entities_allow_free_form??!0?"Enabled":"Disabled"}),(0,ep.jsx)(tI.Switch,{checked:e.entities_allow_free_form??!0,onCheckedChange:e=>t({entities_allow_free_form:e})})]})}),(0,ep.jsx)(jH,{value:e.entity_labels??[],onChange:e=>t({entity_labels:e.length>0?e:null})})]})}function jI(e){return e?Object.entries(e).map(([e,t],n)=>({id:n,name:e,values:{retain_extraction_mode:t.retain_extraction_mode??null,retain_chunk_size:t.retain_chunk_size??null,retain_mission:t.retain_mission??null,retain_custom_instructions:t.retain_custom_instructions??null,entities_allow_free_form:t.entities_allow_free_form??null,entity_labels:jE(t.entity_labels)}})):[]}function jR({defaultValues:e,onDefaultChange:t,strategies:n,onStrategiesChange:r}){let[i,a]=(0,em.useState)(()=>jI(n)),[o,s]=(0,em.useState)("default"),[l,c]=(0,em.useState)(null),u=(0,em.useRef)(!1),d=JSON.stringify(n);(0,em.useEffect)(()=>{if(u.current){u.current=!1;return}a(jI(n))},[d]);let h=e=>{u.current=!0,a(e),r(function(e){let t={};for(let n of e){if(!n.name.trim())continue;let e={};null!==n.values.retain_extraction_mode&&(e.retain_extraction_mode=n.values.retain_extraction_mode),null!==n.values.retain_chunk_size&&(e.retain_chunk_size=n.values.retain_chunk_size),n.values.retain_mission&&(e.retain_mission=n.values.retain_mission),n.values.retain_custom_instructions&&(e.retain_custom_instructions=n.values.retain_custom_instructions),null!==n.values.entities_allow_free_form&&(e.entities_allow_free_form=n.values.entities_allow_free_form),null!==n.values.entity_labels&&(e.entity_labels=n.values.entity_labels),t[n.name.trim()]=e}return Object.keys(t).length>0?t:null}(e))},f=(e,t)=>{h(i.map(n=>n.id===e?{...n,...t}:n))},p="default"!==o?i.find(e=>e.id===o):null;return(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"border-b border-border px-6 flex items-stretch gap-1 flex-wrap",children:[(0,ep.jsx)("button",{type:"button",onClick:()=>s("default"),className:`relative py-3 px-4 text-sm font-semibold transition-colors border-b-2 -mb-px ${"default"===o?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,children:"Default"}),i.map(e=>(0,ep.jsxs)("div",{className:`relative flex items-center gap-2 py-3 px-4 text-sm font-semibold transition-colors border-b-2 -mb-px cursor-pointer ${o===e.id?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,onClick:()=>s(e.id),children:[(0,ep.jsx)("span",{className:"font-mono",children:e.name||(0,ep.jsx)("span",{className:"italic font-normal opacity-50",children:"unnamed"})}),(0,ep.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),c(e)},className:"opacity-40 hover:opacity-100 hover:text-destructive transition-opacity text-base leading-none",children:"×"})]},e.id)),(0,ep.jsxs)("button",{type:"button",onClick:()=>{let e=Date.now();h([...i,{id:e,name:"",values:{retain_extraction_mode:null,retain_chunk_size:null,retain_mission:null,retain_custom_instructions:null,entities_allow_free_form:null,entity_labels:null}}]),s(e)},className:"py-3 px-3 text-sm text-muted-foreground hover:text-primary transition-colors flex items-center gap-1.5",children:[(0,ep.jsx)(fz.Plus,{className:"h-3.5 w-3.5"}),"Add strategy"]})]}),(0,ep.jsx)("div",{children:"default"===o?(0,ep.jsx)(jL,{values:e,onChange:t}):p?(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"px-6 py-3 flex items-center gap-3 border-b border-border/40",children:[(0,ep.jsx)("label",{className:"text-xs text-muted-foreground shrink-0",children:"Name"}),(0,ep.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,ep.jsx)(eI.Input,{value:p.name,onChange:e=>f(p.id,{name:e.target.value}),placeholder:"strategy name (e.g. fast)",className:`h-7 text-xs font-mono max-w-[200px] ${!p.name.trim()?"border-destructive focus-visible:ring-destructive":""}`}),!p.name.trim()&&(0,ep.jsx)("p",{className:"text-xs text-destructive",children:"Name is required"})]})]}),(0,ep.jsx)(jL,{values:p.values,onChange:e=>f(p.id,{values:{...p.values,...e}}),isOverride:!0})]}):null}),(0,ep.jsx)(mv,{open:null!==l,onOpenChange:e=>{e||c(null)},children:(0,ep.jsxs)(mD,{children:[(0,ep.jsxs)(mL,{children:[(0,ep.jsxs)(mR,{children:["Delete strategy “",l?.name||"unnamed","”?"]}),(0,ep.jsx)(mB,{children:"This will remove the strategy and all its overrides. This cannot be undone."})]}),(0,ep.jsxs)(mI,{children:[(0,ep.jsx)(mF,{children:"Cancel"}),(0,ep.jsx)(mz,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{if(l){var e;e=l.id,h(i.filter(t=>t.id!==e)),o===e&&s("default"),c(null)}},children:"Delete"})]})]})})]})}function jB({selected:e,onChange:t}){let n=new Set(e),r=jk.every(e=>n.has(e)),i=0===e.length;return(0,ep.jsxs)("div",{className:"px-6 py-4 space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground",children:[e.length," of ",jk.length," tools enabled"]}),(0,ep.jsx)("button",{type:"button",onClick:()=>{t(r?[]:[...jk])},className:"text-xs text-primary hover:underline",children:r?"Deselect all":"Select all"})]}),(0,ep.jsx)("div",{className:"space-y-4",children:jN.map(e=>{let r=e.tools.filter(e=>n.has(e)).length===e.tools.length;return(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,ep.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:e.label}),(0,ep.jsx)("button",{type:"button",onClick:()=>{let i=new Set(n);r?e.tools.forEach(e=>i.delete(e)):e.tools.forEach(e=>i.add(e)),t(jk.filter(e=>i.has(e)))},className:"text-xs text-primary hover:underline",children:r?"Deselect":"Select all"})]}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-2",children:e.tools.map(e=>{let r=n.has(e);return(0,ep.jsx)("button",{type:"button",onClick:()=>{let r;(r=new Set(n)).has(e)?r.delete(e):r.add(e),t(jk.filter(e=>r.has(e)))},className:`px-2.5 py-1 rounded text-xs font-mono transition-colors border ${r?"bg-primary text-primary-foreground border-primary":"bg-muted/30 text-muted-foreground border-border/40 hover:border-primary/40"}`,children:e},e)})})]},e.label)})}),i&&(0,ep.jsx)("p",{className:"text-xs text-destructive",children:"Warning: no tools selected — agents will be blocked from all MCP calls for this bank."})]})}function jz({title:e,description:t,children:n,error:r,dirty:i,saving:a,onSave:o}){return(0,ep.jsxs)("section",{className:"space-y-3",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h2",{className:"text-lg font-semibold",children:e}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:t})]}),(0,ep.jsxs)(m7,{className:"bg-muted/20 border-border/40",children:[(0,ep.jsx)("div",{className:"divide-y divide-border/40",children:n}),r&&(0,ep.jsx)("div",{className:"px-6 pb-2 pt-2",children:(0,ep.jsxs)(jv,{variant:"destructive",children:[(0,ep.jsx)(jy,{className:"h-4 w-4"}),(0,ep.jsx)(jx,{children:r})]})}),(0,ep.jsx)("div",{className:"px-6 py-4 flex justify-end border-t border-border/40",children:(0,ep.jsx)(eL.Button,{size:"sm",disabled:!i||a,onClick:o,children:a?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.default,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):"Save changes"})})]})]})}function jF({label:e,description:t,children:n}){return(0,ep.jsx)("div",{className:"px-6 py-4",children:(0,ep.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsx)("p",{className:"text-sm font-medium",children:e}),t&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]}),(0,ep.jsx)("div",{className:"md:w-64 shrink-0",children:n})]})})}function jV({label:e,description:t,value:n,onChange:r,placeholder:i,rows:a}){return(0,ep.jsx)("div",{className:"px-6 py-4",children:(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm font-medium",children:e}),t&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]}),(0,ep.jsx)(gl.Textarea,{value:n,onChange:e=>r(e.target.value),placeholder:i,rows:a??3,className:"font-mono text-sm"})]})})}function jU({label:e,description:t,lowLabel:n,highLabel:r,value:i,onChange:a}){return(0,ep.jsx)("div",{className:"px-6 py-4",children:(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm font-medium",children:e}),t&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[n&&(0,ep.jsx)("span",{className:"text-xs text-muted-foreground w-16 text-right shrink-0",children:n}),(0,ep.jsx)("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(e=>(0,ep.jsx)("button",{type:"button",onClick:()=>a(e),className:`w-4 h-4 rounded-full transition-colors hover:opacity-80 ${e<=i?"bg-primary":"bg-muted"}`},e))}),r&&(0,ep.jsx)("span",{className:"text-xs text-muted-foreground w-20 shrink-0",children:r}),(0,ep.jsxs)("span",{className:"text-xs font-mono text-muted-foreground ml-1 shrink-0",children:[i,"/5"]})]})]})})}function jH({value:e,onChange:t}){let[n,r]=(0,em.useState)({}),i=(n,r)=>{t(e.map((e,t)=>t===n?{...e,...r}:e))},a=(t,n,r)=>{let a=e[t].values.map((e,t)=>t===n?{...e,...r}:e);i(t,{values:a})};return(0,ep.jsxs)("div",{className:"px-6 py-4 space-y-3",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm font-medium",children:"Entity Labels"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Classification labels extracted at retain time. Leave empty to disable."})]}),e.length>0&&(0,ep.jsxs)("span",{className:"text-xs bg-primary/10 text-primary px-2 py-0.5 rounded-full shrink-0",children:[e.length," group",1!==e.length?"s":""]})]}),0===e.length&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No entity labels defined."}),(0,ep.jsx)("div",{className:"space-y-2",children:e.map((o,s)=>{let l=n[s]??!1,c="text"===o.type,u=!c;return(0,ep.jsxs)("div",{className:"border border-border/50 rounded-md bg-background",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2",children:[(0,ep.jsx)("button",{type:"button",onClick:()=>r(e=>({...e,[s]:!l})),className:"text-muted-foreground hover:text-foreground shrink-0",disabled:c,children:l&&u?(0,ep.jsx)(mW.ChevronDown,{className:"h-4 w-4"}):(0,ep.jsx)(eT.ChevronRight,{className:`h-4 w-4 ${c?"opacity-30":""}`})}),(0,ep.jsx)(eI.Input,{placeholder:"key (e.g. pedagogy)",value:o.key,onChange:e=>i(s,{key:e.target.value}),className:"h-8 text-xs font-mono w-36 shrink-0"}),(0,ep.jsx)(eI.Input,{placeholder:c?"description / examples":"description",value:o.description,onChange:e=>i(s,{description:e.target.value}),className:"h-8 text-xs flex-1 min-w-0"}),(0,ep.jsxs)(tR.Select,{value:o.type,onValueChange:e=>i(s,{type:e,..."text"===e?{values:[]}:{}}),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"h-8 text-xs w-32 shrink-0",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"value",className:"text-xs",children:"Single value"}),(0,ep.jsx)(tR.SelectItem,{value:"multi-values",className:"text-xs",children:"Multi-values"}),(0,ep.jsx)(tR.SelectItem,{value:"text",className:"text-xs",children:"Free text"})]})]}),(0,ep.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0 cursor-pointer select-none",children:[(0,ep.jsx)(m2.Checkbox,{checked:o.tag,onCheckedChange:e=>i(s,{tag:!!e}),className:"h-4 w-4"}),"tag"]}),(0,ep.jsx)("button",{type:"button",onClick:()=>{t(e.filter((e,t)=>t!==s)),r(e=>{let t={...e};return delete t[s],t})},className:"text-muted-foreground hover:text-destructive shrink-0",children:(0,ep.jsx)(mV,{className:"h-3.5 w-3.5"})})]}),l&&u&&(0,ep.jsxs)("div",{className:"px-3 pb-3 space-y-1 border-t border-border/30 pt-2",children:[0===o.values.length&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground italic pl-5",children:"No values yet."}),o.values.map((t,n)=>(0,ep.jsxs)("div",{className:"flex items-center gap-2 pl-5",children:[(0,ep.jsx)(eI.Input,{placeholder:"value",value:t.value,onChange:e=>a(s,n,{value:e.target.value}),className:"h-8 text-xs font-mono w-32 shrink-0"}),(0,ep.jsx)(eI.Input,{placeholder:"description",value:t.description,onChange:e=>a(s,n,{description:e.target.value}),className:"h-8 text-xs flex-1 min-w-0"}),(0,ep.jsx)("button",{type:"button",onClick:()=>{i(s,{values:e[s].values.filter((e,t)=>t!==n)})},className:"text-muted-foreground hover:text-destructive shrink-0",children:(0,ep.jsx)(mV,{className:"h-3.5 w-3.5"})})]},n)),(0,ep.jsxs)("button",{type:"button",onClick:()=>{i(s,{values:[...e[s].values,{value:"",description:""}]})},className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground pl-5 mt-1",children:[(0,ep.jsx)(fz.Plus,{className:"h-3 w-3"}),"Add value"]})]})]},s)})}),(0,ep.jsxs)("button",{type:"button",onClick:()=>{let n=[...e,{key:"",description:"",type:"value",optional:!0,tag:!1,values:[]}];t(n),r(e=>({...e,[n.length-1]:!0}))},className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground",children:[(0,ep.jsx)(fz.Plus,{className:"h-3.5 w-3.5"}),"Add attribute"]})]})}function jW({value:e,onChange:t}){let n=t=>e.find(e=>e.category===t)?.threshold??"BLOCK_MEDIUM_AND_ABOVE";return(0,ep.jsxs)("div",{className:"px-6 py-4 space-y-3",children:[(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground",children:['Set the blocking threshold for each harm category. "Off" disables the filter entirely (default for Gemini 2.5+). Lower thresholds block more content.'," ",(0,ep.jsx)("a",{href:"https://ai.google.dev/gemini-api/docs/safety-settings",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground transition-colors",children:"Learn more"})]}),(0,ep.jsx)("div",{className:"space-y-2",children:jb.map(e=>(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,ep.jsx)("span",{className:"text-sm",children:e.label}),(0,ep.jsxs)(tR.Select,{value:n(e.value),onValueChange:r=>{var i;return i=e.value,void t(jb.map(e=>({category:e.value,threshold:e.value===i?r:n(e.value)})))},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-48 h-8 text-xs",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsx)(tR.SelectContent,{children:jw.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e.value,className:"text-xs",children:e.label},e.value))})]})]},e.value))})]})}let jY=(0,eN.default)("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]),jG=(0,eN.default)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),j$=(0,eN.default)("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);var jX=e.i(23287),jX=jX;let jq=(0,eN.default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),jK=(0,eN.default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.i(34471);var jZ=Symbol.for("immer-nothing"),jQ=Symbol.for("immer-draftable"),jJ=Symbol.for("immer-state");function j0(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var j1=Object,j2=j1.getPrototypeOf,j5="constructor",j3="prototype",j4="configurable",j6="enumerable",j8="writable",j7="value",j9=e=>!!e&&!!e[jJ];function Ne(e){return!!e&&(Nr(e)||Nc(e)||!!e[jQ]||!!e[j5]?.[jQ]||Nu(e)||Nd(e))}var Nt=j1[j3][j5].toString(),Nn=new WeakMap;function Nr(e){if(!e||!Nh(e))return!1;let t=j2(e);if(null===t||t===j1[j3])return!0;let n=j1.hasOwnProperty.call(t,j5)&&t[j5];if(n===Object)return!0;if(!Nf(n))return!1;let r=Nn.get(n);return void 0===r&&(r=Function.toString.call(n),Nn.set(n,r)),r===Nt}function Ni(e,t,n=!0){0===Na(e)?(n?Reflect.ownKeys(e):j1.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Na(e){let t=e[jJ];return t?t.type_:Nc(e)?1:Nu(e)?2:3*!!Nd(e)}var No=(e,t,n=Na(e))=>2===n?e.has(t):j1[j3].hasOwnProperty.call(e,t),Ns=(e,t,n=Na(e))=>2===n?e.get(t):e[t],Nl=(e,t,n,r=Na(e))=>{2===r?e.set(t,n):3===r?e.add(n):e[t]=n},Nc=Array.isArray,Nu=e=>e instanceof Map,Nd=e=>e instanceof Set,Nh=e=>"object"==typeof e,Nf=e=>"function"==typeof e,Np=e=>e.modified_?e.copy_:e.base_;function Nm(e,t){if(Nu(e))return new Map(e);if(Nd(e))return new Set(e);if(Nc(e))return Array[j3].slice.call(e);let n=Nr(e);if(!0!==t&&("class_only"!==t||n)){let t=j2(e);if(null!==t&&n)return{...e};let r=j1.create(t);return j1.assign(r,e)}{let t=j1.getOwnPropertyDescriptors(e);delete t[jJ];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];!1===a[j8]&&(a[j8]=!0,a[j4]=!0),(a.get||a.set)&&(t[i]={[j4]:!0,[j8]:!0,[j6]:a[j6],[j7]:e[i]})}return j1.create(j2(e),t)}}function Ng(e,t=!1){return Nx(e)||j9(e)||!Ne(e)||(Na(e)>1&&j1.defineProperties(e,{set:Nv,add:Nv,clear:Nv,delete:Nv}),j1.freeze(e),t&&Ni(e,(e,t)=>{Ng(t,!0)},!1)),e}var Nv={[j7]:function(){j0(2)}};function Nx(e){return!(null!==e&&Nh(e))||j1.isFrozen(e)}var Ny="MapSet",Nb="Patches",Nw="ArrayMethods",Nj={};function NN(e){let t=Nj[e];return t||j0(0,e),t}var Nk=e=>!!Nj[e];function NE(e,t){t&&(e.patchPlugin_=NN(Nb),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function NC(e){N_(e),e.drafts_.forEach(NT),e.drafts_=null}function N_(e){e===I&&(I=e.parent_)}var NS=e=>I={drafts_:[],parent_:I,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Nk(Ny)?NN(Ny):void 0,arrayMethodsPlugin_:Nk(Nw)?NN(Nw):void 0};function NT(e){let t=e[jJ];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function NA(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(void 0!==e&&e!==n){n[jJ].modified_&&(NC(t),j0(4)),Ne(e)&&(e=NO(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[jJ].base_,e,t)}else e=NO(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ng(t,n)}(t,e,!0),NC(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==jZ?e:void 0}function NO(e,t){if(Nx(t))return t;let n=t[jJ];if(!n)return NR(t,e.handledSet_,e);if(!NP(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);NI(n,e)}return n.copy_}function NM(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var NP=(e,t)=>e.scope_===t,ND=[];function NL(e,t,n,r){let i=e.copy_||e.base_,a=e.type_;if(void 0!==r&&Ns(i,r,a)===t)return void Nl(i,r,n,a);if(!e.draftLocations_){let t=e.draftLocations_=new Map;Ni(i,(e,n)=>{if(j9(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}for(let r of e.draftLocations_.get(t)??ND)Nl(i,r,n,a)}function NI(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}NM(e)}}function NR(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||j9(e)||t.has(e)||!Ne(e)||Nx(e)||(t.add(e),Ni(e,(r,i)=>{if(j9(i)){let t=i[jJ];NP(t,n)&&(Nl(e,r,Np(t),e.type_),NM(t))}else Ne(i)&&NR(i,t,n)})),e}var NB={get(e,t){let n;if(t===jJ)return e;let r=e.scope_.arrayMethodsPlugin_,i=1===e.type_&&"string"==typeof t;if(i&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);let a=e.copy_||e.base_;if(!No(a,t,e.type_)){var o;let n;return o=e,(n=NV(a,t))?j7 in n?n[j7]:n.get?.call(o.draft_):void 0}let s=a[t];if(e.finalized_||!Ne(s)||i&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Number.isInteger(n=+t)&&String(n)===t)return s;if(s===NF(e.base_,t)){NH(e);let n=1===e.type_?+t:t,r=NW(e.scope_,s,e,n);return e.copy_[n]=r}return s},has:(e,t)=>t in(e.copy_||e.base_),ownKeys:e=>Reflect.ownKeys(e.copy_||e.base_),set(e,t,n){let r=NV(e.copy_||e.base_,t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=NF(e.copy_||e.base_,t),i=r?.[jJ];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if((n===r?0!==n||1/n==1/r:n!=n&&r!=r)&&(void 0!==n||No(e.base_,t,e.type_)))return!0;NH(e),NU(e)}return!!(e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t]))||(e.copy_[t]=n,e.assigned_.set(t,!0),!function(e,t,n){let{scope_:r}=e;if(j9(n)){let i=n[jJ];NP(i,r)&&i.callbacks_.push(function(){NH(e),NL(e,n,Np(i),t)})}else Ne(n)&&e.callbacks_.push(function(){let i=e.copy_||e.base_;3===e.type_?i.has(n)&&NR(n,r.handledSet_,r):Ns(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&NR(Ns(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n),!0)},deleteProperty:(e,t)=>(NH(e),void 0!==NF(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),NU(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){let n=e.copy_||e.base_,r=Reflect.getOwnPropertyDescriptor(n,t);return r?{[j8]:!0,[j4]:1!==e.type_||"length"!==t,[j6]:r[j6],[j7]:n[t]}:r},defineProperty(){j0(11)},getPrototypeOf:e=>j2(e.base_),setPrototypeOf(){j0(12)}},Nz={};for(let e in NB){let t=NB[e];Nz[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function NF(e,t){let n=e[jJ];return(n?n.copy_||n.base_:e)[t]}function NV(e,t){if(!(t in e))return;let n=j2(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=j2(n)}}function NU(e){!e.modified_&&(e.modified_=!0,e.parent_&&NU(e.parent_))}function NH(e){e.copy_||(e.assigned_=new Map,e.copy_=Nm(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function NW(e,t,n,r){let[i,a]=Nu(t)?NN(Ny).proxyMap_(t,n):Nd(t)?NN(Ny).proxySet_(t,n):function(e,t){let n=Nc(e),r={type_:+!!n,scope_:t?t.scope_:I,modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=NB;n&&(i=[r],a=Nz);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}(t,n);if((n?.scope_??I).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&void 0!==r)n.callbacks_.push(function(e){if(!a||!NP(a,e))return;e.mapSetPlugin_?.fixSetContents(a);let t=Np(a);NL(n,a.draft_??a,t,r),NI(a,e)});else a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)});return i}function NY(e){return j9(e)||j0(10,e),function e(t){let n;if(!Ne(t)||Nx(t))return t;let r=t[jJ],i=!0;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=Nm(t,r.scope_.immer_.useStrictShallowCopy_),i=r.scope_.immer_.shouldUseStrictIteration()}else n=Nm(t,!0);return Ni(n,(t,r)=>{Nl(n,t,e(r))},i),r&&(r.finalized_=!1),n}(e)}Nz.deleteProperty=function(e,t){return Nz.set.call(this,e,t,void 0)},Nz.set=function(e,t,n){return NB.set.call(this,e[0],t,n,e[0])};var NG=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{let r;if(Nf(e)&&!Nf(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}if(Nf(t)||j0(6),void 0===n||Nf(n)||j0(7),Ne(e)){let i=NS(this),a=NW(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?NC(i):N_(i)}return NE(i,n),NA(r,i)}if(e&&Nh(e))j0(1,e);else{if(void 0===(r=t(e))&&(r=e),r===jZ&&(r=void 0),this.autoFreeze_&&Ng(r,!0),n){let t=[],i=[];NN(Nb).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}},this.produceWithPatches=(e,t)=>{let n,r;return Nf(e)?(t,...n)=>this.produceWithPatches(t,t=>e(t,...n)):[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},(e=>"boolean"==typeof e)(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),(e=>"boolean"==typeof e)(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),(e=>"boolean"==typeof e)(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Ne(e)||j0(8),j9(e)&&(e=NY(e));let t=NS(this),n=NW(t,e,void 0);return n[jJ].isManual_=!0,N_(t),n}finishDraft(e,t){let n=e&&e[jJ];n&&n.isManual_||j0(9);let{scope_:r}=n;return NE(r,t),NA(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=NN(Nb).applyPatches_;return j9(e)?r(e,t):this.produce(e,e=>r(e,t))}}().produce,N$=e=>Array.isArray(e)?e:[e],NX=0,Nq=class{revision=NX;_value;_lastValue;_isEqual=NK;constructor(e,t=NK){this._value=this._lastValue=e,this._isEqual=t}get value(){return this._value}set value(e){this.value!==e&&(this._value=e,this.revision=++NX)}};function NK(e,t){return e===t}function NZ(e){return e instanceof Nq||console.warn("Not a valid cell! ",e),e.value}var NQ=(e,t)=>!1;function NJ(){return function(e=NK){return new Nq(null,e)}(NQ)}var N0=e=>{let t=e.collectionTag;null===t&&(t=e.collectionTag=NJ()),NZ(t)};Symbol();var N1=0,N2=Object.getPrototypeOf({}),N5=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy(this,N3);tag=NJ();tags={};children={};collectionTag=null;id=N1++},N3={get:(e,t)=>(function(){let{value:n}=e,r=Reflect.get(n,t);if("symbol"==typeof t||t in N2)return r;if("object"==typeof r&&null!==r){var i;let n=e.children[t];return void 0===n&&(n=e.children[t]=Array.isArray(i=r)?new N4(i):new N5(i)),n.tag&&NZ(n.tag),n.proxy}{let n=e.tags[t];return void 0===n&&((n=e.tags[t]=NJ()).value=r),NZ(n),r}})(),ownKeys:e=>(N0(e),Reflect.ownKeys(e.value)),getOwnPropertyDescriptor:(e,t)=>Reflect.getOwnPropertyDescriptor(e.value,t),has:(e,t)=>Reflect.has(e.value,t)},N4=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy([this],N6);tag=NJ();tags={};children={};collectionTag=null;id=N1++},N6={get:([e],t)=>("length"===t&&N0(e),N3.get(e,t)),ownKeys:([e])=>N3.ownKeys(e),getOwnPropertyDescriptor:([e],t)=>N3.getOwnPropertyDescriptor(e,t),has:([e],t)=>N3.has(e,t)},N8="u">typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function N7(){return{s:0,v:void 0,o:null,p:null}}function N9(e,t={}){let n,r=N7(),{resultEqualityCheck:i}=t,a=0;function o(){let t,o=r,{length:s}=arguments;for(let e=0;e<s;e++){let t=arguments[e];if("function"==typeof t||"object"==typeof t&&null!==t){let e=o.o;null===e&&(o.o=e=new WeakMap);let n=e.get(t);void 0===n?(o=N7(),e.set(t,o)):o=n}else{let e=o.p;null===e&&(o.p=e=new Map);let n=e.get(t);void 0===n?(o=N7(),e.set(t,o)):o=n}}let l=o;if(1===o.s)t=o.v;else if(t=e.apply(null,arguments),a++,i){let e=n?.deref?.()??n;null!=e&&i(e,t)&&(t=e,0!==a&&a--),n="object"==typeof t&&null!==t||"function"==typeof t?new N8(t):t}return l.s=1,l.v=t,t}return o.clearCache=()=>{r=N7(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}var ke=function(e,...t){let n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r,i=0,a=0,o={},s=e.pop();"object"==typeof s&&(o=s,s=e.pop()),function(e,t=`expected a function, instead received ${typeof e}`){if("function"!=typeof e)throw TypeError(t)}(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);let{memoize:l,memoizeOptions:c=[],argsMemoize:u=N9,argsMemoizeOptions:d=[],devModeChecks:h={}}={...n,...o},f=N$(c),p=N$(d),g=(!function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(e=>"function"==typeof e)){let n=e.map(e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e).join(", ");throw TypeError(`${t}[${n}]`)}}(t=Array.isArray(e[0])?e[0]:e,"createSelector expects all input-selectors to be functions, but received the following types: "),t),v=l(function(){return i++,s.apply(null,arguments)},...f);return Object.assign(u(function(){a++;let e=function(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}(g,arguments);return r=v.apply(null,e)},...p),{resultFunc:s,memoizedResultFunc:v,dependencies:g,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>r,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:l,argsMemoize:u})};return Object.assign(r,{withTypes:()=>r}),r}(N9),kt=Object.assign((e,t=ke)=>{!function(e,t=`expected an object, instead received ${typeof e}`){if("object"!=typeof e)throw TypeError(t)}(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>kt});function kn(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var kr="function"==typeof Symbol&&Symbol.observable||"@@observable",ki=()=>Math.random().toString(36).substring(7).split("").join("."),ka={INIT:`@@redux/INIT${ki()}`,REPLACE:`@@redux/REPLACE${ki()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${ki()}`};function ko(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function ks(e){let t,n=Object.keys(e),r={};for(let t=0;t<n.length;t++){let i=n[t];"function"==typeof e[i]&&(r[i]=e[i])}let i=Object.keys(r);try{Object.keys(r).forEach(e=>{let t=r[e];if(void 0===t(void 0,{type:ka.INIT}))throw Error(kn(12));if(void 0===t(void 0,{type:ka.PROBE_UNKNOWN_ACTION()}))throw Error(kn(13))})}catch(e){t=e}return function(e={},n){if(t)throw t;let a=!1,o={};for(let t=0;t<i.length;t++){let s=i[t],l=r[s],c=e[s],u=l(c,n);if(void 0===u)throw n&&n.type,Error(kn(14));o[s]=u,a=a||u!==c}return(a=a||i.length!==Object.keys(e).length)?o:e}}function kl(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function kc(e){return ko(e)&&"type"in e&&"string"==typeof e.type}function ku(e){return({dispatch:t,getState:n})=>r=>i=>"function"==typeof i?i(t,n,e):r(i)}var kd=ku(),kh="u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!=arguments.length)return"object"==typeof arguments[0]?kl:kl.apply(null,arguments)};function kf(e,t){function n(...r){if(t){let n=t(...r);if(!n)throw Error(k2(0));return{type:e,payload:n.payload,..."meta"in n&&{meta:n.meta},..."error"in n&&{error:n.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>kc(t)&&t.type===e,n}"u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var kp=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function km(e){return Ne(e)?NG(e,()=>{}):e}function kg(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var kv="RTK_autoBatch",kx=()=>e=>({payload:e,meta:{[kv]:!0}}),ky=e=>t=>{setTimeout(t,e)},kb=(e={type:"raf"})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,l="tick"===e.type?queueMicrotask:"raf"===e.type?"u">typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:ky(10):"callback"===e.type?e.queueNotification:ky(e.timeout),c=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return(a=!(i=!e?.meta?.[kv]))&&!o&&(o=!0,l(c)),r.dispatch(e)}finally{i=!0}}})};function kw(e){let t,n={},r=[],i={addCase(e,t){let r="string"==typeof e?e:e.type;if(!r)throw Error(k2(28));if(r in n)throw Error(k2(29));return n[r]=t,i},addAsyncThunk:(e,t)=>(t.pending&&(n[e.pending.type]=t.pending),t.rejected&&(n[e.rejected.type]=t.rejected),t.fulfilled&&(n[e.fulfilled.type]=t.fulfilled),t.settled&&r.push({matcher:e.settled,reducer:t.settled}),i),addMatcher:(e,t)=>(r.push({matcher:e,reducer:t}),i),addDefaultCase:e=>(t=e,i)};return e(i),[n,r,t]}var kj=Symbol.for("rtk-slice-createasyncthunk"),kN=((c=kN||{}).reducer="reducer",c.reducerWithPrepare="reducerWithPrepare",c.asyncThunk="asyncThunk",c),kk=function({creators:e}={}){let t=e?.asyncThunk?.[kj];return function(e){let n,{name:r,reducerPath:i=r}=e;if(!r)throw Error(k2(11));let a=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},o=Object.keys(a),s={},l={},c={},u=[],d={addCase(e,t){let n="string"==typeof e?e:e.type;if(!n)throw Error(k2(12));if(n in l)throw Error(k2(13));return l[n]=t,d},addMatcher:(e,t)=>(u.push({matcher:e,reducer:t}),d),exposeAction:(e,t)=>(c[e]=t,d),exposeCaseReducer:(e,t)=>(s[e]=t,d)};function h(){let[t={},n=[],r]="function"==typeof e.extraReducers?kw(e.extraReducers):[e.extraReducers],i={...t,...l};return function(e,t){let n,[r,i,a]=kw(t);if("function"==typeof e)n=()=>km(e());else{let t=km(e);n=()=>t}function o(e=n(),t){let s=[r[t.type],...i.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return 0===s.filter(e=>!!e).length&&(s=[a]),s.reduce((e,n)=>{if(n)if(j9(e)){let r=n(e,t);return void 0===r?e:r}else{if(Ne(e))return NG(e,e=>n(e,t));let r=n(e,t);if(void 0===r){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}return e},e)}return o.getInitialState=n,o}(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of u)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}o.forEach(n=>{let i=a[n],o={reducerName:n,type:`${r}/${n}`,createNotation:"function"==typeof e.reducers};"asyncThunk"===i._reducerDefinitionType?function({type:e,reducerName:t},n,r,i){if(!i)throw Error(k2(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:l,settled:c,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),l&&r.addCase(d.rejected,l),c&&r.addMatcher(d.settled,c),r.exposeCaseReducer(t,{fulfilled:o||kE,pending:s||kE,rejected:l||kE,settled:c||kE})}(o,i,d,t):function({type:e,reducerName:t,createNotation:n},r,i){let a,o;if("reducer"in r){if(n&&"reducerWithPrepare"!==r._reducerDefinitionType)throw Error(k2(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?kf(e,o):kf(e))}(o,i,d)});let f=e=>e,p=new Map,g=new WeakMap;function v(e,t){return n||(n=h()),n(e,t)}function x(){return n||(n=h()),n.getInitialState()}function y(t,n=!1){function r(e){let i=e[t];return void 0===i&&n&&(i=kg(g,r,x)),i}function i(t=f){let r=kg(p,n,()=>new WeakMap);return kg(r,t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=function(e,t,n,r){function i(a,...o){let s=t(a);return void 0===s&&r&&(s=n()),e(s,...o)}return i.unwrapped=e,i}(a,t,()=>kg(g,t,x),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let b={name:r,reducer:v,actions:c,caseReducers:s,getInitialState:x,...y(i),injectInto(e,{reducerPath:t,...n}={}){let r=t??i;return e.inject({reducerPath:r,reducer:v},n),{...b,...y(r,!0)}}};return b}}();function kE(){}var kC="listener",k_="completed",kS="cancelled",kT=`task-${kS}`,kA=`task-${k_}`,kO=`${kC}-${kS}`,kM=`${kC}-${k_}`,kP=class{constructor(e){this.code=e,this.message=`task ${kS} (reason: ${e})`}name="TaskAbortError";message},kD=(e,t)=>{if("function"!=typeof e)throw TypeError(k2(32))},kL=()=>{},kI=(e,t=kL)=>(e.catch(t),e),kR=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),kB=e=>{if(e.aborted)throw new kP(e.reason)};function kz(e,t){let n=kL;return new Promise((r,i)=>{let a=()=>i(new kP(e.reason));e.aborted?a():(n=kR(e,a),t.finally(()=>n()).then(r,i))}).finally(()=>{n=kL})}var kF=async(e,t)=>{try{await Promise.resolve();let t=await e();return{status:"ok",value:t}}catch(e){return{status:e instanceof kP?"cancelled":"rejected",error:e}}finally{t?.()}},kV=e=>t=>kI(kz(e,t).then(t=>(kB(e),t))),kU=e=>{let t=kV(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:kH}=Object,kW={},kY="listenerMiddleware",kG=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=kf(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(i);else throw Error(k2(21));return kD(a,"options.listener"),{predicate:i,type:t,effect:a}},k$=kH(e=>{let{type:t,predicate:n,effect:r}=kG(e);return{id:((e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t})(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(k2(22))}}},{withTypes:()=>k$}),kX=(e,t)=>{let{type:n,effect:r,predicate:i}=kG(t);return Array.from(e.values()).find(e=>("string"==typeof n?e.type===n:e.predicate===i)&&e.effect===r)},kq=e=>{e.pending.forEach(e=>{e.abort(kO)})},kK=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},kZ=kH(kf(`${kY}/add`),{withTypes:()=>kZ}),kQ=kf(`${kY}/removeAll`),kJ=kH(kf(`${kY}/remove`),{withTypes:()=>kJ}),k0=(...e)=>{console.error(`${kY}/error`,...e)},k1=(e={})=>{let t=new Map,n=new Map,{extra:r,onError:i=k0}=e;kD(i,"onError");let a=e=>{var n;return(n=kX(t,e)??k$(e)).unsubscribe=()=>t.delete(n.id),t.set(n.id,n),e=>{n.unsubscribe(),e?.cancelActive&&kq(n)}};kH(a,{withTypes:()=>a});let o=e=>{let n=kX(t,e);return n&&(n.unsubscribe(),e.cancelActive&&kq(n)),!!n};kH(o,{withTypes:()=>o});let s=async(e,o,s,l)=>{var c,u;let d,h=new AbortController,f=(c=h.signal,d=async(e,t)=>{kB(c);let n=()=>{},r=[new Promise((t,r)=>{let i=a({predicate:e,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});n=()=>{i(),r()}})];null!=t&&r.push(new Promise(e=>setTimeout(e,t,null)));try{let e=await kz(c,Promise.race(r));return kB(c),e}finally{n()}},(e,t)=>kI(d(e,t))),p=[];try{let i;e.pending.add(h),i=n.get(e)??0,n.set(e,i+1),await Promise.resolve(e.effect(o,kH({},s,{getOriginalState:l,condition:(e,t)=>f(e,t).then(Boolean),take:f,delay:kU(h.signal),pause:kV(h.signal),extra:r,signal:h.signal,fork:(u=h.signal,(e,t)=>{kD(e,"taskExecutor");let n=new AbortController;kR(u,()=>n.abort(u.reason));let r=kF(async()=>{kB(u),kB(n.signal);let t=await e({pause:kV(n.signal),delay:kU(n.signal),signal:n.signal});return kB(n.signal),t},()=>n.abort(kA));return t?.autoJoin&&p.push(r.catch(kL)),{result:kV(u)(r),cancel(){n.abort(kT)}}}),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==h&&(e.abort(kO),n.delete(e))})},cancel:()=>{h.abort(kO),e.pending.delete(h)},throwIfCancelled:()=>{kB(h.signal)}})))}catch(e){e instanceof kP||kK(i,e,{raisedBy:"effect"})}finally{let t;await Promise.all(p),h.abort(kM),1===(t=n.get(e)??1)?n.delete(e):n.set(e,t-1),e.pending.delete(h)}},l=()=>{for(let e of n.keys())kq(e);t.clear()};return{middleware:e=>n=>r=>{let c;if(!kc(r))return n(r);if(kZ.match(r))return a(r.payload);if(kQ.match(r))return void l();if(kJ.match(r))return o(r.payload);let u=e.getState(),d=()=>{if(u===kW)throw Error(k2(23));return u};try{if(c=n(r),t.size>0){let n=e.getState();for(let a of Array.from(t.values())){let t=!1;try{t=a.predicate(r,n,u)}catch(e){t=!1,kK(i,e,{raisedBy:"predicate"})}t&&s(a,r,e,d)}}}finally{u=kW}return c},startListening:a,stopListening:o,clearListeners:l}};function k2(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}Symbol.for("rtk-state-proxy-original");var k5=e.i(92068);function k3(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function k4(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.reduce((e,t,r)=>{var i=n[r-1];return"string"==typeof i?e+i+t:void 0!==i?e+k3(i)+t:e+t},"")}var k6=e=>0===e?0:e>0?1:-1,k8=e=>"number"==typeof e&&e!=+e,k7=e=>"string"==typeof e&&e.indexOf("%")===e.length-1,k9=e=>("number"==typeof e||e instanceof Number)&&!k8(e),Ee=e=>k9(e)||"string"==typeof e,Et=0,En=e=>{var t=++Et;return"".concat(e||"").concat(t)},Er=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!k9(e)&&"string"!=typeof e)return r;if(k7(e)){if(null==t)return r;var a=e.indexOf("%");n=t*parseFloat(e.slice(0,a))/100}else n=+e;return k8(n)&&(n=r),i&&null!=t&&n>t&&(n=t),n},Ei=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(n[String(e[r])])return!0;else n[String(e[r])]=!0;return!1};function Ea(e,t,n){return k9(e)&&k9(t)?k3(e+n*(t-e)):t}function Eo(e,t,n){if(e&&e.length)return e.find(e=>e&&("function"==typeof t?t(e):(0,k5.default)(e,t))===n)}var Es=e=>null==e?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function El(e){return null!=e}function Ec(){}function Eu(e,t){if(t){var n=Number.parseInt(t,10);if(!k8(n))return null==e?void 0:e[n]}}var Ed=kk({name:"options",initialState:{chartName:"",tooltipPayloadSearcher:void 0,eventEmitter:void 0,defaultTooltipEventType:"axis"},reducers:{createEventEmitter:e=>{null==e.eventEmitter&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),Eh=Ed.reducer,{createEventEmitter:Ef}=Ed.actions,Ep=(e.i(13027),{notify(){},get:()=>[]}),Em="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Eg="u">typeof navigator&&"ReactNative"===navigator.product,Ev=Em||Eg?em.useLayoutEffect:em.useEffect;function Ex(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}var Ey=Symbol.for("react-redux-context"),Eb="u">typeof globalThis?globalThis:{},Ew=function(){if(!em.createContext)return{};let e=Eb[Ey]??=new Map,t=e.get(em.createContext);return t||(t=em.createContext(null),e.set(em.createContext,t)),t}(),Ej=function(e){let{children:t,context:n,serverState:r,store:i}=e,a=em.useMemo(()=>{let e=function(e){let t,n=Ep,r=0,i=!1;function a(){l.onStateChange&&l.onStateChange()}function o(){if(r++,!t){let r,i;t=e.subscribe(a),r=null,i=null,n={clear(){r=null,i=null},notify(){let e=r;for(;e;)e.callback(),e=e.next},get(){let e=[],t=r;for(;t;)e.push(t),t=t.next;return e},subscribe(e){let t=!0,n=i={callback:e,next:null,prev:i};return n.prev?n.prev.next=n:r=n,function(){t&&null!==r&&(t=!1,n.next?n.next.prev=n.prev:i=n.prev,n.prev?n.prev.next=n.next:r=n.next)}}}}}function s(){r--,t&&0===r&&(t(),t=void 0,n.clear(),n=Ep)}let l={addNestedSub:function(e){o();let t=n.subscribe(e),r=!1;return()=>{r||(r=!0,t(),s())}},notifyNestedSubs:function(){n.notify()},handleChangeWrapper:a,isSubscribed:function(){return i},trySubscribe:function(){i||(i=!0,o())},tryUnsubscribe:function(){i&&(i=!1,s())},getListeners:()=>n};return l}(i);return{store:i,subscription:e,getServerState:r?()=>r:void 0}},[i,r]),o=em.useMemo(()=>i.getState(),[i]);return Ev(()=>{let{subscription:e}=a;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),o!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[a,o]),em.createElement((n||Ew).Provider,{value:a},t)};function EN(e=Ew){return function(){return em.useContext(e)}}var Ek=EN(),EE=Symbol.for("immer-nothing"),EC=Symbol.for("immer-draftable"),E_=Symbol.for("immer-state");function ES(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ET=Object.getPrototypeOf;function EA(e){return!!e&&!!e[E_]}function EO(e){return!!e&&(ED(e)||Array.isArray(e)||!!e[EC]||!!e.constructor?.[EC]||Ez(e)||EF(e))}var EM=Object.prototype.constructor.toString(),EP=new WeakMap;function ED(e){if(!e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);if(null===t||t===Object.prototype)return!0;let n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if("function"!=typeof n)return!1;let r=EP.get(n);return void 0===r&&(r=Function.toString.call(n),EP.set(n,r)),r===EM}function EL(e,t,n=!0){0===EI(e)?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function EI(e){let t=e[E_];return t?t.type_:Array.isArray(e)?1:Ez(e)?2:3*!!EF(e)}function ER(e,t){return 2===EI(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function EB(e,t,n){let r=EI(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function Ez(e){return e instanceof Map}function EF(e){return e instanceof Set}function EV(e){return e.copy_||e.base_}function EU(e,t){if(Ez(e))return new Map(e);if(EF(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let n=ED(e);if(!0!==t&&("class_only"!==t||n)){let t=ET(e);return null!==t&&n?{...e}:Object.assign(Object.create(t),e)}{let t=Object.getOwnPropertyDescriptors(e);delete t[E_];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(ET(e),t)}}function EH(e,t=!1){return EY(e)||EA(e)||!EO(e)||(EI(e)>1&&Object.defineProperties(e,{set:EW,add:EW,clear:EW,delete:EW}),Object.freeze(e),t&&Object.values(e).forEach(e=>EH(e,!0))),e}var EW={value:function(){ES(2)}};function EY(e){return null===e||"object"!=typeof e||Object.isFrozen(e)}var EG={};function E$(e){let t=EG[e];return t||ES(0,e),t}function EX(e,t){t&&(E$("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Eq(e){EK(e),e.drafts_.forEach(EQ),e.drafts_=null}function EK(e){e===R&&(R=e.parent_)}function EZ(e){return R={drafts_:[],parent_:R,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function EQ(e){let t=e[E_];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function EJ(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];return void 0!==e&&e!==n?(n[E_].modified_&&(Eq(t),ES(4)),EO(e)&&(e=E0(t,e),t.parent_||E2(t,e)),t.patches_&&E$("Patches").generateReplacementPatches_(n[E_].base_,e,t.patches_,t.inversePatches_)):e=E0(t,n,[]),Eq(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==EE?e:void 0}function E0(e,t,n){if(EY(t))return t;let r=e.immer_.shouldUseStrictIteration(),i=t[E_];if(!i)return EL(t,(r,a)=>E1(e,i,t,r,a,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return E2(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;let t=i.copy_,a=t,o=!1;3===i.type_&&(a=new Set(t),t.clear(),o=!0),EL(a,(r,a)=>E1(e,i,t,r,a,n,o),r),E2(e,t,!1),n&&e.patches_&&E$("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function E1(e,t,n,r,i,a,o){if(null==i||"object"!=typeof i&&!o)return;let s=EY(i);if(!s||o){if(EA(i)){let o=E0(e,i,a&&t&&3!==t.type_&&!ER(t.assigned_,r)?a.concat(r):void 0);if(EB(n,r,o),!EA(o))return;e.canAutoFreeze_=!1}else o&&n.add(i);if(EO(i)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&s)return;E0(e,i),(!t||!t.scope_.parent_)&&"symbol"!=typeof r&&(Ez(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&E2(e,i)}}}function E2(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&EH(t,n)}var E5={get(e,t){if(t===E_)return e;let n=EV(e);if(!ER(n,t)){var r;let i;return r=e,(i=E6(n,t))?"value"in i?i.value:i.get?.call(r.draft_):void 0}let i=n[t];return e.finalized_||!EO(i)?i:i===E4(e.base_,t)?(E7(e),e.copy_[t]=Ce(i,e)):i},has:(e,t)=>t in EV(e),ownKeys:e=>Reflect.ownKeys(EV(e)),set(e,t,n){let r=E6(EV(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=E4(EV(e),t),i=r?.[E_];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if((n===r?0!==n||1/n==1/r:n!=n&&r!=r)&&(void 0!==n||ER(e.base_,t)))return!0;E7(e),E8(e)}return!!(e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t]))||(e.copy_[t]=n,e.assigned_[t]=!0,!0)},deleteProperty:(e,t)=>(void 0!==E4(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,E7(e),E8(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){let n=EV(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){ES(11)},getPrototypeOf:e=>ET(e.base_),setPrototypeOf(){ES(12)}},E3={};function E4(e,t){let n=e[E_];return(n?EV(n):e)[t]}function E6(e,t){if(!(t in e))return;let n=ET(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=ET(n)}}function E8(e){!e.modified_&&(e.modified_=!0,e.parent_&&E8(e.parent_))}function E7(e){e.copy_||(e.copy_=EU(e.base_,e.scope_.immer_.useStrictShallowCopy_))}EL(E5,(e,t)=>{E3[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),E3.deleteProperty=function(e,t){return E3.set.call(this,e,t,void 0)},E3.set=function(e,t,n){return E5.set.call(this,e[0],t,n,e[0])};var E9=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,t,n)=>{let r;if("function"==typeof e&&"function"!=typeof t){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}if("function"!=typeof t&&ES(6),void 0!==n&&"function"!=typeof n&&ES(7),EO(e)){let i=EZ(this),a=Ce(e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Eq(i):EK(i)}return EX(i,n),EJ(r,i)}if(e&&"object"==typeof e)ES(1,e);else{if(void 0===(r=t(e))&&(r=e),r===EE&&(r=void 0),this.autoFreeze_&&EH(r,!0),n){let t=[],i=[];E$("Patches").generateReplacementPatches_(e,r,t,i),n(t,i)}return r}},this.produceWithPatches=(e,t)=>{let n,r;return"function"==typeof e?(t,...n)=>this.produceWithPatches(t,t=>e(t,...n)):[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),"boolean"==typeof e?.useStrictIteration&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){var t;EO(e)||ES(8),EA(e)&&(EA(t=e)||ES(10,t),e=function e(t){let n;if(!EO(t)||EY(t))return t;let r=t[E_],i=!0;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=EU(t,r.scope_.immer_.useStrictShallowCopy_),i=r.scope_.immer_.shouldUseStrictIteration()}else n=EU(t,!0);return EL(n,(t,r)=>{EB(n,t,e(r))},i),r&&(r.finalized_=!1),n}(t));let n=EZ(this),r=Ce(e,void 0);return r[E_].isManual_=!0,EK(n),r}finishDraft(e,t){let n=e&&e[E_];n&&n.isManual_||ES(9);let{scope_:r}=n;return EX(r,t),EJ(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=E$("Patches").applyPatches_;return EA(e)?r(e,t):this.produce(e,e=>r(e,t))}};function Ce(e,t){let n=Ez(e)?E$("MapSet").proxyMap_(e,t):EF(e)?E$("MapSet").proxySet_(e,t):function(e,t){let n=Array.isArray(e),r={type_:+!!n,scope_:t?t.scope_:R,modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=r,a=E5;n&&(i=[r],a=E3);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,s}(e,t);return(t?t.scope_:R).drafts_.push(n),n}new E9().produce;var Ct={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},Cn=kk({name:"tooltip",initialState:{itemInteraction:{click:Ct,hover:Ct},axisInteraction:{click:Ct,hover:Ct},keyboardInteraction:Ct,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:kx()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NY(e).tooltipItemPayloads.indexOf(n);i>-1&&(e.tooltipItemPayloads[i]=r)},prepare:kx()},removeTooltipEntrySettings:{reducer(e,t){var n=NY(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:kx()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:Cr,replaceTooltipEntrySettings:Ci,removeTooltipEntrySettings:Ca,setTooltipSettingsState:Co,setActiveMouseOverItemIndex:Cs,mouseLeaveItem:Cl,mouseLeaveChart:Cc,setActiveClickItemIndex:Cu,setMouseOverAxisIndex:Cd,setMouseClickAxisIndex:Ch,setSyncInteraction:Cf,setKeyboardInteraction:Cp}=Cn.actions,Cm=Cn.reducer,Cg=kk({name:"chartData",initialState:{chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},reducers:{setChartData(e,t){if(e.chartData=t.payload,null==t.payload){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;null!=n&&(e.dataStartIndex=n),null!=r&&(e.dataEndIndex=r)}}}),{setChartData:Cv,setDataStartEndIndexes:Cx,setComputedData:Cy}=Cg.actions,Cb=Cg.reducer,Cw=kk({name:"chartLayout",initialState:{layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,i,a;e.margin.top=null!=(n=t.payload.top)?n:0,e.margin.right=null!=(r=t.payload.right)?r:0,e.margin.bottom=null!=(i=t.payload.bottom)?i:0,e.margin.left=null!=(a=t.payload.left)?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:Cj,setLayout:CN,setChartSize:Ck,setScale:CE}=Cw.actions,CC=Cw.reducer,C_=e.i(30224),CS=(0,em.createContext)(null),CT=e=>e,CA=()=>{var e=(0,em.useContext)(CS);return e?e.store.dispatch:CT},CO=()=>{},CM=()=>CO,CP=(e,t)=>e===t;function CD(e){var t=(0,em.useContext)(CS);return(0,C_.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:CM,t?t.store.getState:CO,t?t.store.getState:CO,t?e:CO,CP)}var CL=e.i(42342),CI=e=>e.legend.settings;function CR(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function CB(e){return function(){return e}}function Cz(e,t){if((i=e.length)>1)for(var n,r,i,a=1,o=e[t[0]],s=o.length;a<i;++a)for(r=o,o=e[t[a]],n=0;n<s;++n)o[n][1]+=o[n][0]=isNaN(r[n][1])?r[n][0]:r[n][1]}function CF(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function CV(e,t){return e[t]}function CU(e){let t=[];return t.key=e,t}function CH(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function CW(e){return Number.isFinite(e)}function CY(e){return"number"==typeof e&&e>0&&Number.isFinite(e)}function CG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function C$(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?CG(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CG(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function CX(e,t,n){return null==e||null==t?n:Ee(t)?(0,k5.default)(e,t,n):"function"==typeof t?t(e):n}ke([e=>e.legend.payload,CI],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?(0,CL.default)(r,n):r}),Array.prototype.slice;var Cq=(e,t)=>"horizontal"===e&&"xAxis"===t||"vertical"===e&&"yAxis"===t||"centric"===e&&"angleAxis"===t||"radial"===e&&"radiusAxis"===t,CK=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},CZ=(e,t,n)=>{if(!e)return null;var{duplicateDomain:r,type:i,range:a,scale:o,realScaleType:s,isCategorical:l,categoricalDomain:c,tickCount:u,ticks:d,niceTicks:h,axisType:f}=e;if(!o)return null;var p="scaleBand"===s&&o.bandwidth?o.bandwidth()/2:2,g=(t||n)&&"category"===i&&o.bandwidth?o.bandwidth()/p:0;return(g="angleAxis"===f&&a&&a.length>=2?2*k6(a[0]-a[1])*g:g,t&&(d||h))?(d||h||[]).map((e,t)=>({coordinate:o(r?r.indexOf(e):e)+g,value:e,offset:g,index:t})).filter(e=>!k8(e.coordinate)):l&&c?c.map((e,t)=>({coordinate:o(e)+g,value:e,index:t,offset:g})):o.ticks&&!n&&null!=u?o.ticks(u).map((e,t)=>({coordinate:o(e)+g,value:e,offset:g,index:t})):o.domain().map((e,t)=>({coordinate:o(e)+g,value:r?r[e]:e,index:t,offset:g}))},CQ={sign:e=>{var t,n=e.length;if(!(n<=0)){var r=null==(t=e[0])?void 0:t.length;if(null!=r&&!(r<=0))for(var i=0;i<r;++i)for(var a=0,o=0,s=0;s<n;++s){var l=e[s],c=null==l?void 0:l[i];if(null!=c){var u=c[1],d=c[0],h=k8(u)?d:u;h>=0?(c[0]=a,c[1]=a+h,a=u):(c[0]=o,c[1]=o+h,o=u)}}}},expand:function(e,t){if((r=e.length)>0){for(var n,r,i,a=0,o=e[0].length;a<o;++a){for(i=n=0;n<r;++n)i+=e[n][a][1]||0;if(i)for(n=0;n<r;++n)e[n][a][1]/=i}Cz(e,t)}},none:Cz,silhouette:function(e,t){if((n=e.length)>0){for(var n,r=0,i=e[t[0]],a=i.length;r<a;++r){for(var o=0,s=0;o<n;++o)s+=e[o][r][1]||0;i[r][1]+=i[r][0]=-s/2}Cz(e,t)}},wiggle:function(e,t){if((i=e.length)>0&&(r=(n=e[t[0]]).length)>0){for(var n,r,i,a=0,o=1;o<r;++o){for(var s=0,l=0,c=0;s<i;++s){for(var u=e[t[s]],d=u[o][1]||0,h=(d-(u[o-1][1]||0))/2,f=0;f<s;++f){var p=e[t[f]];h+=(p[o][1]||0)-(p[o-1][1]||0)}l+=d,c+=h*d}n[o-1][1]+=n[o-1][0]=a,l&&(a-=c/l)}n[o-1][1]+=n[o-1][0]=a,Cz(e,t)}},positive:e=>{var t,n=e.length;if(!(n<=0)){var r=null==(t=e[0])?void 0:t.length;if(null!=r&&!(r<=0))for(var i=0;i<r;++i)for(var a=0,o=0;o<n;++o){var s=e[o],l=null==s?void 0:s[i];if(null!=l){var c=k8(l[1])?l[0]:l[1];c>=0?(l[0]=a,l[1]=a+c,a=l[1]):(l[0]=0,l[1]=0)}}}}};function CJ(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:a,dataKey:o}=e;if("category"===t.type){if(!t.allowDuplicatedCategory&&t.dataKey&&null!=i[t.dataKey]){var s=Eo(n,"value",i[t.dataKey]);if(s)return s.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var l=CX(i,null==o?t.dataKey:o);return null==l?null:t.scale(l)}var C0=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,C1=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,C2=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=(0,CL.default)(t,e=>e.coordinate),a=1/0,o=1,s=i.length;o<s;o++){var l=i[o],c=i[o-1];a=Math.min(((null==l?void 0:l.coordinate)||0)-((null==c?void 0:c.coordinate)||0),a)}return a===1/0?0:a}return n?void 0:0};function C5(e){var{tooltipEntrySettings:t,dataKey:n,payload:r,value:i,name:a}=e;return C$(C$({},t),{},{dataKey:n,payload:r,value:i,name:a})}function C3(e,t){return e?String(e):"string"==typeof t?t:void 0}var C4=e=>e.layout.width,C6=e=>e.layout.height,C8=e=>e.layout.scale,C7=e=>e.layout.margin,C9=ke(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),_e=ke(e=>e.cartesianAxis.yAxis,e=>Object.values(e));function _t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_t(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_t(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var _r=ke([C4,C6,C7,e=>e.brush.height,function(e){return _e(e).reduce((e,t)=>"left"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return _e(e).reduce((e,t)=>"right"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return C9(e).reduce((e,t)=>"top"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},function(e){return C9(e).reduce((e,t)=>"bottom"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},CI,e=>e.legend.size],(e,t,n,r,i,a,o,s,l,c)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=_n(_n({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),h=d.bottom;d.bottom+=r;var f=e-(d=((e,t,n)=>{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:s}=t;if(("vertical"===s||"horizontal"===s&&"middle"===o)&&"center"!==a&&k9(e[a]))return C$(C$({},e),{},{[a]:e[a]+(r||0)});if(("horizontal"===s||"vertical"===s&&"center"===a)&&"middle"!==o&&k9(e[o]))return C$(C$({},e),{},{[o]:e[o]+(i||0)})}return e})(d,l,c)).left-d.right,p=t-d.top-d.bottom;return _n(_n({brushBottom:h},d),{},{width:Math.max(f,0),height:Math.max(p,0)})}),_i=ke(_r,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),_a=ke(C4,C6,(e,t)=>({x:0,y:0,width:e,height:t})),_o=(0,em.createContext)(null),_s=()=>null!=(0,em.useContext)(_o),_l=e=>e.brush,_c=ke([_l,_r,C7],(e,t,n)=>({height:e.height,x:k9(e.x)?e.x:t.left,y:k9(e.y)?e.y:t.top+t.height+t.brushBottom-((null==n?void 0:n.bottom)||0),width:k9(e.width)?e.width:t.width})),_u=e.i(7670),_d=e.i(58723),_h=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];if("u">typeof console&&console.warn&&(void 0===t&&console.warn("LogUtils requires an error message argument"),!e))if(void 0===t)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;console.warn(t.replace(/%s/g,()=>r[a++]))}},_f=(e,t,n)=>{var{width:r="100%",height:i="100%",aspect:a,maxHeight:o}=n,s=k7(r)?e:Number(r),l=k7(i)?t:Number(i);return a&&a>0&&(s?l=s/a:l&&(s=l*a),o&&null!=l&&l>o&&(l=o)),{calculatedWidth:s,calculatedHeight:l}},_p={width:0,height:0,overflow:"visible"},_m={width:0,overflowX:"visible"},_g={height:0,overflowY:"visible"},_v={};function _x(){return(_x=Object.assign.bind()).apply(null,arguments)}function _y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_y(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_y(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var _w=(0,em.createContext)({width:-1,height:-1});function _j(e){var{children:t,width:n,height:r}=e,i=(0,em.useMemo)(()=>({width:n,height:r}),[n,r]);return CY(i.width)&&CY(i.height)?em.createElement(_w.Provider,{value:i},t):null}var _N=()=>(0,em.useContext)(_w),_k=(0,em.forwardRef)((e,t)=>{var{aspect:n,initialDimension:r={width:-1,height:-1},width:i,height:a,minWidth:o=0,minHeight:s,maxHeight:l,children:c,debounce:u=0,id:d,className:h,onResize:f,style:p={}}=e,g=(0,em.useRef)(null),v=(0,em.useRef)();v.current=f,(0,em.useImperativeHandle)(t,()=>g.current);var[x,y]=(0,em.useState)({containerWidth:r.width,containerHeight:r.height}),b=(0,em.useCallback)((e,t)=>{y(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,em.useEffect)(()=>{if(null==g.current||"u"<typeof ResizeObserver)return Ec;var e=e=>{var t,{width:n,height:r}=e[0].contentRect;b(n,r),null==(t=v.current)||t.call(v,n,r)};u>0&&(e=(0,_d.default)(e,u,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),{width:n,height:r}=g.current.getBoundingClientRect();return b(n,r),t.observe(g.current),()=>{t.disconnect()}},[b,u]);var{containerWidth:w,containerHeight:j}=x;_h(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:N,calculatedHeight:k}=_f(w,j,{width:i,height:a,aspect:n,maxHeight:l});return _h(null!=N&&N>0||null!=k&&k>0,"The width(%s) and height(%s) of chart should be greater than 0,\n please check the style of container, or the props width(%s) and height(%s),\n or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the\n height and width.",N,k,i,a,o,s,n),em.createElement("div",{id:d?"".concat(d):void 0,className:(0,_u.clsx)("recharts-responsive-container",h),style:_b(_b({},p),{},{width:i,height:a,minWidth:o,minHeight:s,maxHeight:l}),ref:g},em.createElement("div",{style:(e=>{var{width:t,height:n}=e,r=k7(t),i=k7(n);return r&&i?_p:r?_m:i?_g:_v})({width:i,height:a})},em.createElement(_j,{width:N,height:k},c)))}),_E=(0,em.forwardRef)((e,t)=>{var n=_N();if(CY(n.width)&&CY(n.height))return e.children;var{width:r,height:i}=function(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return void 0===i&&void 0===a?(i="100%",a="100%"):void 0===i?i=r&&r>0?void 0:"100%":void 0===a&&(a=r&&r>0?void 0:"100%"),{width:i,height:a}}({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=_f(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return k9(a)&&k9(o)?em.createElement(_j,{width:a,height:o},e.children):em.createElement(_k,_x({},e,{width:r,height:i,ref:t}))});function _C(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var __=()=>{var e,t=_s(),n=CD(_i),r=CD(_c),i=null==(e=CD(_l))?void 0:e.padding;return t&&r&&i?{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}:n},_S={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},_T=()=>{var e;return null!=(e=CD(_r))?e:_S},_A=e=>e.layout.layoutType,_O=e=>{var t=CA(),n=_s(),{width:r,height:i}=e,a=_N(),o=r,s=i;return a&&(o=a.width>0?a.width:r,s=a.height>0?a.height:i),(0,em.useEffect)(()=>{!n&&CY(o)&&CY(s)&&t(Ck({width:o,height:s}))},[t,n,o,s]),null},_M=e.i(66814);function _P(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function _D(e,t){switch(arguments.length){case 0:break;case 1:"function"==typeof e?this.interpolator(e):this.range(e);break;default:this.domain(e),"function"==typeof t?this.interpolator(t):this.range(t)}return this}e.s([],25212),e.i(25212),e.s([],67155),e.i(67155);class _L extends Map{constructor(e,t=_R){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(const[t,n]of e)this.set(t,n)}get(e){return super.get(_I(this,e))}has(e){return super.has(_I(this,e))}set(e,t){return super.set(function({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}(this,e),t)}delete(e){return super.delete(function({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}(this,e))}}function _I({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function _R(e){return null!==e&&"object"==typeof e?e.valueOf():e}let _B=Symbol("implicit");function _z(){var e=new _L,t=[],n=[],r=_B;function i(i){let a=e.get(i);if(void 0===a){if(r!==_B)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();for(let r of(t=[],e=new _L,n))e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return _z(t,n).unknown(r)},_P.apply(i,arguments),i}function _F(){var e,t,n=_z().unknown(void 0),r=n.domain,i=n.range,a=0,o=1,s=!1,l=0,c=0,u=.5;function d(){var n=r().length,d=o<a,h=d?o:a,f=d?a:o;e=(f-h)/Math.max(1,n-l+2*c),s&&(e=Math.floor(e)),h+=(f-h-e*(n-l))*u,t=e*(1-l),s&&(h=Math.round(h),t=Math.round(t));var p=(function(e,t,n){e*=1,t*=1,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((t-e)/n)),a=Array(i);++r<i;)a[r]=e+r*n;return a})(n).map(function(t){return h+e*t});return i(d?p.reverse():p)}return delete n.unknown,n.domain=function(e){return arguments.length?(r(e),d()):r()},n.range=function(e){return arguments.length?([a,o]=e,a*=1,o*=1,d()):[a,o]},n.rangeRound=function(e){return[a,o]=e,a*=1,o*=1,s=!0,d()},n.bandwidth=function(){return t},n.step=function(){return e},n.round=function(e){return arguments.length?(s=!!e,d()):s},n.padding=function(e){return arguments.length?(l=Math.min(1,c=+e),d()):l},n.paddingInner=function(e){return arguments.length?(l=Math.min(1,e),d()):l},n.paddingOuter=function(e){return arguments.length?(c=+e,d()):c},n.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),d()):u},n.copy=function(){return _F(r(),[a,o]).round(s).paddingInner(l).paddingOuter(c).align(u)},_P.apply(d(),arguments)}function _V(){return function e(t){var n=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return e(n())},t}(_F.apply(null,arguments).paddingInner(1))}let _U=Math.sqrt(50),_H=Math.sqrt(10),_W=Math.sqrt(2);function _Y(e,t,n){let r,i,a,o=(t-e)/Math.max(0,n),s=Math.floor(Math.log10(o)),l=o/Math.pow(10,s),c=l>=_U?10:l>=_H?5:l>=_W?2:1;return(s<0?(r=Math.round(e*(a=Math.pow(10,-s)/c)),i=Math.round(t*a),r/a<e&&++r,i/a>t&&--i,a=-a):(r=Math.round(e/(a=Math.pow(10,s)*c)),i=Math.round(t/a),r*a<e&&++r,i*a>t&&--i),i<r&&.5<=n&&n<2)?_Y(e,t,2*n):[r,i,a]}function _G(e,t,n){if(t*=1,e*=1,!((n*=1)>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?_Y(t,e,n):_Y(e,t,n);if(!(a>=i))return[];let s=a-i+1,l=Array(s);if(r)if(o<0)for(let e=0;e<s;++e)l[e]=-((a-e)/o);else for(let e=0;e<s;++e)l[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)l[e]=-((i+e)/o);else for(let e=0;e<s;++e)l[e]=(i+e)*o;return l}function _$(e,t,n){return _Y(e*=1,t*=1,n*=1)[2]}function _X(e,t,n){t*=1,e*=1,n*=1;let r=t<e,i=r?_$(t,e,n):_$(e,t,n);return(r?-1:1)*(i<0?-(1/i):i)}function _q(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function _K(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function _Z(e){let t,n,r;function i(e,r,a=0,o=e.length){if(a<o){if(0!==t(r,r))return o;do{let t=a+o>>>1;0>n(e[t],r)?a=t+1:o=t}while(a<o)}return a}return 2!==e.length?(t=_q,n=(t,n)=>_q(e(t),n),r=(t,n)=>e(t)-n):(t=e===_q||e===_K?e:_Q,n=e,r=e),{left:i,center:function(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o},right:function(e,r,i=0,a=e.length){if(i<a){if(0!==t(r,r))return a;do{let t=i+a>>>1;0>=n(e[t],r)?i=t+1:a=t}while(i<a)}return i}}}function _Q(){return 0}function _J(e){return null===e?NaN:+e}let _0=_Z(_q),_1=_0.right;function _2(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function _5(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function _3(){}_0.left,_Z(_J).center;var _4="\\s*([+-]?\\d+)\\s*",_6="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_8="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_7=/^#([0-9a-f]{3,8})$/,_9=RegExp(`^rgb\\(${_4},${_4},${_4}\\)$`),Se=RegExp(`^rgb\\(${_8},${_8},${_8}\\)$`),St=RegExp(`^rgba\\(${_4},${_4},${_4},${_6}\\)$`),Sn=RegExp(`^rgba\\(${_8},${_8},${_8},${_6}\\)$`),Sr=RegExp(`^hsl\\(${_6},${_8},${_8}\\)$`),Si=RegExp(`^hsla\\(${_6},${_8},${_8},${_6}\\)$`),Sa={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32};function So(){return this.rgb().formatHex()}function Ss(){return this.rgb().formatRgb()}function Sl(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=_7.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?Sc(t):3===n?new Sh(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?Su(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?Su(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=_9.exec(e))?new Sh(t[1],t[2],t[3],1):(t=Se.exec(e))?new Sh(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=St.exec(e))?Su(t[1],t[2],t[3],t[4]):(t=Sn.exec(e))?Su(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Sr.exec(e))?Sx(t[1],t[2]/100,t[3]/100,1):(t=Si.exec(e))?Sx(t[1],t[2]/100,t[3]/100,t[4]):Sa.hasOwnProperty(e)?Sc(Sa[e]):"transparent"===e?new Sh(NaN,NaN,NaN,0):null}function Sc(e){return new Sh(e>>16&255,e>>8&255,255&e,1)}function Su(e,t,n,r){return r<=0&&(e=t=n=NaN),new Sh(e,t,n,r)}function Sd(e,t,n,r){var i;return 1==arguments.length?((i=e)instanceof _3||(i=Sl(i)),i)?new Sh((i=i.rgb()).r,i.g,i.b,i.opacity):new Sh:new Sh(e,t,n,null==r?1:r)}function Sh(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Sf(){return`#${Sv(this.r)}${Sv(this.g)}${Sv(this.b)}`}function Sp(){let e=Sm(this.opacity);return`${1===e?"rgb(":"rgba("}${Sg(this.r)}, ${Sg(this.g)}, ${Sg(this.b)}${1===e?")":`, ${e})`}`}function Sm(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Sg(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Sv(e){return((e=Sg(e))<16?"0":"")+e.toString(16)}function Sx(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Sb(e,t,n,r)}function Sy(e){if(e instanceof Sb)return new Sb(e.h,e.s,e.l,e.opacity);if(e instanceof _3||(e=Sl(e)),!e)return new Sb;if(e instanceof Sb)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,l=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=l<.5?a+i:2-a-i,o*=60):s=l>0&&l<1?0:o,new Sb(o,s,l,e.opacity)}function Sb(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Sw(e){return(e=(e||0)%360)<0?e+360:e}function Sj(e){return Math.max(0,Math.min(1,e||0))}function SN(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}function Sk(e,t,n,r,i){var a=e*e,o=a*e;return((1-3*e+3*a-o)*t+(4-6*a+3*o)*n+(1+3*e+3*a-3*o)*r+o*i)/6}_2(_3,Sl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:So,formatHex:So,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Sy(this).formatHsl()},formatRgb:Ss,toString:Ss}),_2(Sh,Sd,_5(_3,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new Sh(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new Sh(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Sh(Sg(this.r),Sg(this.g),Sg(this.b),Sm(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Sf,formatHex:Sf,formatHex8:function(){return`#${Sv(this.r)}${Sv(this.g)}${Sv(this.b)}${Sv((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:Sp,toString:Sp})),_2(Sb,function(e,t,n,r){return 1==arguments.length?Sy(e):new Sb(e,t,n,null==r?1:r)},_5(_3,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new Sb(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new Sb(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Sh(SN(e>=240?e-240:e+120,i,r),SN(e,i,r),SN(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Sb(Sw(this.h),Sj(this.s),Sj(this.l),Sm(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Sm(this.opacity);return`${1===e?"hsl(":"hsla("}${Sw(this.h)}, ${100*Sj(this.s)}%, ${100*Sj(this.l)}%${1===e?")":`, ${e})`}`}}));let SE=e=>()=>e;function SC(e,t){var n=t-e;return n?function(t){return e+t*n}:SE(isNaN(e)?t:e)}let S_=function e(t){var n,r=1==(n=+t)?SC:function(e,t){var r,i,a;return t-e?(r=e,i=t,r=Math.pow(r,a=n),i=Math.pow(i,a)-r,a=1/a,function(e){return Math.pow(r+e*i,a)}):SE(isNaN(e)?t:e)};function i(e,t){var n=r((e=Sd(e)).r,(t=Sd(t)).r),i=r(e.g,t.g),a=r(e.b,t.b),o=SC(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return i.gamma=e,i}(1);function SS(e){return function(t){var n,r,i=t.length,a=Array(i),o=Array(i),s=Array(i);for(n=0;n<i;++n)r=Sd(t[n]),a[n]=r.r||0,o[n]=r.g||0,s[n]=r.b||0;return a=e(a),o=e(o),s=e(s),r.opacity=1,function(e){return r.r=a(e),r.g=o(e),r.b=s(e),r+""}}}function ST(e,t){return e*=1,t*=1,function(n){return e*(1-n)+t*n}}SS(function(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],a=e[r+1],o=r>0?e[r-1]:2*i-a,s=r<t-1?e[r+2]:2*a-i;return Sk((n-r/t)*t,o,i,a,s)}}),SS(function(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),i=e[(r+t-1)%t],a=e[r%t],o=e[(r+1)%t],s=e[(r+2)%t];return Sk((n-r/t)*t,i,a,o,s)}});var SA=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,SO=RegExp(SA.source,"g");function SM(e,t){var n,r,i=typeof t;return null==t||"boolean"===i?SE(t):("number"===i?ST:"string"===i?(r=Sl(t))?(t=r,S_):function(e,t){var n,r,i,a,o,s=SA.lastIndex=SO.lastIndex=0,l=-1,c=[],u=[];for(e+="",t+="";(i=SA.exec(e))&&(a=SO.exec(t));)(o=a.index)>s&&(o=t.slice(s,o),c[l]?c[l]+=o:c[++l]=o),(i=i[0])===(a=a[0])?c[l]?c[l]+=a:c[++l]=a:(c[++l]=null,u.push({i:l,x:ST(i,a)})),s=SO.lastIndex;return s<t.length&&(o=t.slice(s),c[l]?c[l]+=o:c[++l]=o),c.length<2?u[0]?(n=u[0].x,function(e){return n(e)+""}):(r=t,function(){return r}):(t=u.length,function(e){for(var n,r=0;r<t;++r)c[(n=u[r]).i]=n.x(e);return c.join("")})}:t instanceof Sl?S_:t instanceof Date?function(e,t){var n=new Date;return e*=1,t*=1,function(r){return n.setTime(e*(1-r)+t*r),n}}:!ArrayBuffer.isView(n=t)||n instanceof DataView?Array.isArray(t)?function(e,t){var n,r=t?t.length:0,i=e?Math.min(r,e.length):0,a=Array(i),o=Array(r);for(n=0;n<i;++n)a[n]=SM(e[n],t[n]);for(;n<r;++n)o[n]=t[n];return function(e){for(n=0;n<i;++n)o[n]=a[n](e);return o}}:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?function(e,t){var n,r={},i={};for(n in(null===e||"object"!=typeof e)&&(e={}),(null===t||"object"!=typeof t)&&(t={}),t)n in e?r[n]=SM(e[n],t[n]):i[n]=t[n];return function(e){for(n in r)i[n]=r[n](e);return i}}:ST:function(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(n=0;n<r;++n)i[n]=e[n]*(1-a)+t[n]*a;return i}})(e,t)}function SP(e,t){return e*=1,t*=1,function(n){return Math.round(e*(1-n)+t*n)}}function SD(e){return+e}var SL=[0,1];function SI(e){return e}function SR(e,t){var n;return(t-=e*=1)?function(n){return(n-e)/t}:(n=isNaN(t)?NaN:.5,function(){return n})}function SB(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=SR(i,r),a=n(o,a)):(r=SR(r,i),a=n(a,o)),function(e){return a(r(e))}}function Sz(e,t,n){var r=Math.min(e.length,t.length)-1,i=Array(r),a=Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=SR(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=_1(e,t,1,r)-1;return a[n](i[n](t))}}function SF(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function SV(){var e,t,n,r,i,a,o=SL,s=SL,l=SM,c=SI;function u(){var e,t,n,l=Math.min(o.length,s.length);return c!==SI&&(e=o[0],t=o[l-1],e>t&&(n=e,e=t,t=n),c=function(n){return Math.max(e,Math.min(t,n))}),r=l>2?Sz:SB,i=a=null,d}function d(t){return null==t||isNaN(t*=1)?n:(i||(i=r(o.map(e),s,l)))(e(c(t)))}return d.invert=function(n){return c(t((a||(a=r(s,o.map(e),ST)))(n)))},d.domain=function(e){return arguments.length?(o=Array.from(e,SD),u()):o.slice()},d.range=function(e){return arguments.length?(s=Array.from(e),u()):s.slice()},d.rangeRound=function(e){return s=Array.from(e),l=SP,u()},d.clamp=function(e){return arguments.length?(c=!!e||SI,u()):c!==SI},d.interpolate=function(e){return arguments.length?(l=e,u()):l},d.unknown=function(e){return arguments.length?(n=e,d):n},function(n,r){return e=n,t=r,u()}}function SU(){return SV()(SI,SI)}function SH(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function SW(e){return(e=SH(Math.abs(e)))?e[1]:NaN}var SY=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function SG(e){var t;if(!(t=SY.exec(e)))throw Error("invalid format: "+e);return new S$({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function S$(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function SX(e,t){var n=SH(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+Array(i-r.length+2).join("0")}SG.prototype=S$.prototype,S$.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};let Sq={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>SX(100*e,t),r:SX,s:function(e,t){var n=SH(e,t);if(!n)return e+"";var r=n[0],i=n[1],a=i-(B=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+Array(1-a).join("0")+SH(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function SK(e){return e}var SZ=Array.prototype.map,SQ=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function SJ(e,t,n,r){var i,a,o=_X(e,t,n);switch((r=SG(null==r?",f":r)).type){case"s":var s=Math.max(Math.abs(e),Math.abs(t));return null!=r.precision||isNaN(a=Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(SW(s)/3)))-SW(Math.abs(o))))||(r.precision=a),V(r,s);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(a=Math.max(0,SW(Math.abs(Math.max(Math.abs(e),Math.abs(t)))-(i=Math.abs(i=o)))-SW(i))+1)||(r.precision=a-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(a=Math.max(0,-SW(Math.abs(o))))||(r.precision=a-("%"===r.type)*2)}return F(r)}function S0(e){var t=e.domain;return e.ticks=function(e){var n=t();return _G(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var r=t();return SJ(r[0],r[r.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var r,i,a=t(),o=0,s=a.length-1,l=a[o],c=a[s],u=10;for(c<l&&(i=l,l=c,c=i,i=o,o=s,s=i);u-- >0;){if((i=_$(l,c,n))===r)return a[o]=l,a[s]=c,t(a);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else if(i<0)l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i;else break;r=i}return e},e}function S1(){var e=SU();return e.copy=function(){return SF(e,S1())},_P.apply(e,arguments),S0(e)}function S2(e){var t;function n(e){return null==e||isNaN(e*=1)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,SD),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return S2(e).unknown(t)},e=arguments.length?Array.from(e,SD):[0,1],S0(n)}function S5(e,t){e=e.slice();var n,r=0,i=e.length-1,a=e[r],o=e[i];return o<a&&(n=r,r=i,i=n,n=a,a=o,o=n),e[r]=t.floor(a),e[i]=t.ceil(o),e}function S3(e){return Math.log(e)}function S4(e){return Math.exp(e)}function S6(e){return-Math.log(-e)}function S8(e){return-Math.exp(-e)}function S7(e){return isFinite(e)?+("1e"+e):e<0?0:e}function S9(e){return(t,n)=>-e(-t,n)}function Te(e){let t,n,r=e(S3,S4),i=r.domain,a=10;function o(){var o,s;return t=(o=a)===Math.E?Math.log:10===o&&Math.log10||2===o&&Math.log2||(o=Math.log(o),e=>Math.log(e)/o),n=10===(s=a)?S7:s===Math.E?Math.exp:e=>Math.pow(s,e),i()[0]<0?(t=S9(t),n=S9(n),e(S6,S8)):e(S3,S4),r}return r.base=function(e){return arguments.length?(a=+e,o()):a},r.domain=function(e){return arguments.length?(i(e),o()):i()},r.ticks=e=>{let r,o,s=i(),l=s[0],c=s[s.length-1],u=c<l;u&&([l,c]=[c,l]);let d=t(l),h=t(c),f=null==e?10:+e,p=[];if(!(a%1)&&h-d<f){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(r=1;r<a;++r)if(!((o=d<0?r/n(-d):r*n(d))<l)){if(o>c)break;p.push(o)}}else for(;d<=h;++d)for(r=a-1;r>=1;--r)if(!((o=d>0?r/n(-d):r*n(d))<l)){if(o>c)break;p.push(o)}2*p.length<f&&(p=_G(l,c,f))}else p=_G(d,h,Math.min(h-d,f)).map(n);return u?p.reverse():p},r.tickFormat=(e,i)=>{if(null==e&&(e=10),null==i&&(i=10===a?"s":","),"function"!=typeof i&&(a%1||null!=(i=SG(i)).precision||(i.trim=!0),i=F(i)),e===1/0)return i;let o=Math.max(1,a*e/r.ticks().length);return e=>{let r=e/n(Math.round(t(e)));return r*a<a-.5&&(r*=a),r<=o?i(e):""}},r.nice=()=>i(S5(i(),{floor:e=>n(Math.floor(t(e))),ceil:e=>n(Math.ceil(t(e)))})),r}function Tt(){let e=Te(SV()).domain([1,10]);return e.copy=()=>SF(e,Tt()).base(e.base()),_P.apply(e,arguments),e}function Tn(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Tr(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Ti(e){var t=1,n=e(Tn(1),Tr(t));return n.constant=function(n){return arguments.length?e(Tn(t=+n),Tr(t)):t},S0(n)}function Ta(){var e=Ti(SV());return e.copy=function(){return SF(e,Ta()).constant(e.constant())},_P.apply(e,arguments)}function To(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Ts(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Tl(e){return e<0?-e*e:e*e}function Tc(e){var t=e(SI,SI),n=1;return t.exponent=function(t){return arguments.length?1==(n=+t)?e(SI,SI):.5===n?e(Ts,Tl):e(To(n),To(1/n)):n},S0(t)}function Tu(){var e=Tc(SV());return e.copy=function(){return SF(e,Tu()).exponent(e.exponent())},_P.apply(e,arguments),e}function Td(){return Tu.apply(null,arguments).exponent(.5)}function Th(e){return Math.sign(e)*e*e}function Tf(){var e,t=SU(),n=[0,1],r=!1;function i(n){var i,a=Math.sign(i=t(n))*Math.sqrt(Math.abs(i));return isNaN(a)?e:r?Math.round(a):a}return i.invert=function(e){return t.invert(Th(e))},i.domain=function(e){return arguments.length?(t.domain(e),i):t.domain()},i.range=function(e){return arguments.length?(t.range((n=Array.from(e,SD)).map(Th)),i):n.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(r=!!e,i):r},i.clamp=function(e){return arguments.length?(t.clamp(e),i):t.clamp()},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return Tf(t.domain(),n).round(r).clamp(t.clamp()).unknown(e)},_P.apply(i,arguments),S0(i)}function Tp(e,t){let n;if(void 0===t)for(let t of e)null!=t&&(n<t||void 0===n&&t>=t)&&(n=t);else{let r=-1;for(let i of e)null!=(i=t(i,++r,e))&&(n<i||void 0===n&&i>=i)&&(n=i)}return n}function Tm(e,t){let n;if(void 0===t)for(let t of e)null!=t&&(n>t||void 0===n&&t>=t)&&(n=t);else{let r=-1;for(let i of e)null!=(i=t(i,++r,e))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function Tg(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(e<t?-1:+(e>t))}function Tv(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Tx(){var e,t=[],n=[],r=[];function i(){var e=0,i=Math.max(1,n.length);for(r=Array(i-1);++e<i;)r[e-1]=function(e,t,n=_J){if(!(!(r=e.length)||isNaN(t*=1))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(n(e[a+1],a+1,e)-o)*(i-a)}}(t,e/i);return a}function a(t){return null==t||isNaN(t*=1)?e:n[_1(r,t)]}return a.invertExtent=function(e){var i=n.indexOf(e);return i<0?[NaN,NaN]:[i>0?r[i-1]:t[0],i<r.length?r[i]:t[t.length-1]]},a.domain=function(e){if(!arguments.length)return t.slice();for(let n of(t=[],e))null==n||isNaN(n*=1)||t.push(n);return t.sort(_q),i()},a.range=function(e){return arguments.length?(n=Array.from(e),i()):n.slice()},a.unknown=function(t){return arguments.length?(e=t,a):e},a.quantiles=function(){return r.slice()},a.copy=function(){return Tx().domain(t).range(n).unknown(e)},_P.apply(a,arguments)}function Ty(){var e,t=0,n=1,r=1,i=[.5],a=[0,1];function o(t){return null!=t&&t<=t?a[_1(i,t,0,r)]:e}function s(){var e=-1;for(i=Array(r);++e<r;)i[e]=((e+1)*n-(e-r)*t)/(r+1);return o}return o.domain=function(e){return arguments.length?([t,n]=e,t*=1,n*=1,s()):[t,n]},o.range=function(e){return arguments.length?(r=(a=Array.from(e)).length-1,s()):a.slice()},o.invertExtent=function(e){var o=a.indexOf(e);return o<0?[NaN,NaN]:o<1?[t,i[0]]:o>=r?[i[r-1],n]:[i[o-1],i[o]]},o.unknown=function(t){return arguments.length&&(e=t),o},o.thresholds=function(){return i.slice()},o.copy=function(){return Ty().domain([t,n]).range(a).unknown(e)},_P.apply(S0(o),arguments)}function Tb(){var e,t=[.5],n=[0,1],r=1;function i(i){return null!=i&&i<=i?n[_1(t,i,0,r)]:e}return i.domain=function(e){return arguments.length?(r=Math.min((t=Array.from(e)).length,n.length-1),i):t.slice()},i.range=function(e){return arguments.length?(n=Array.from(e),r=Math.min(t.length,n.length-1),i):n.slice()},i.invertExtent=function(e){var r=n.indexOf(e);return[t[r-1],t[r]]},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return Tb().domain(t).range(n).unknown(e)},_P.apply(i,arguments)}F=(z=function(e){var t,n,r,i=void 0===e.grouping||void 0===e.thousands?SK:(t=SZ.call(e.grouping,Number),n=e.thousands+"",function(e,r){for(var i=e.length,a=[],o=0,s=t[0],l=0;i>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),a.push(e.substring(i-=s,i+s)),!((l+=s+1)>r));)s=t[o=(o+1)%t.length];return a.reverse().join(n)}),a=void 0===e.currency?"":e.currency[0]+"",o=void 0===e.currency?"":e.currency[1]+"",s=void 0===e.decimal?".":e.decimal+"",l=void 0===e.numerals?SK:(r=SZ.call(e.numerals,String),function(e){return e.replace(/[0-9]/g,function(e){return r[+e]})}),c=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"−":e.minus+"",d=void 0===e.nan?"NaN":e.nan+"";function h(e){var t=(e=SG(e)).fill,n=e.align,r=e.sign,h=e.symbol,f=e.zero,p=e.width,g=e.comma,v=e.precision,x=e.trim,y=e.type;"n"===y?(g=!0,y="g"):Sq[y]||(void 0===v&&(v=12),x=!0,y="g"),(f||"0"===t&&"="===n)&&(f=!0,t="0",n="=");var b="$"===h?a:"#"===h&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===h?o:/[%p]/.test(y)?c:"",j=Sq[y],N=/[defgprs%]/.test(y);function k(e){var a,o,c,h=b,k=w;if("c"===y)k=j(e)+k,e="";else{var E=(e*=1)<0||1/e<0;if(e=isNaN(e)?d:j(Math.abs(e),v),x&&(e=function(e){e:for(var t,n=e.length,r=1,i=-1;r<n;++r)switch(e[r]){case".":i=t=r;break;case"0":0===i&&(i=r),t=r;break;default:if(!+e[r])break e;i>0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),E&&0==+e&&"+"!==r&&(E=!1),h=(E?"("===r?r:u:"-"===r||"("===r?"":r)+h,k=("s"===y?SQ[8+B/3]:"")+k+(E&&"("===r?")":""),N){for(a=-1,o=e.length;++a<o;)if(48>(c=e.charCodeAt(a))||c>57){k=(46===c?s+e.slice(a+1):e.slice(a))+k,e=e.slice(0,a);break}}}g&&!f&&(e=i(e,1/0));var C=h.length+e.length+k.length,_=C<p?Array(p-C+1).join(t):"";switch(g&&f&&(e=i(_+e,_.length?p-k.length:1/0),_=""),n){case"<":e=h+e+k+_;break;case"=":e=h+_+e+k;break;case"^":e=_.slice(0,C=_.length>>1)+h+e+k+_.slice(C);break;default:e=_+h+e+k}return l(e)}return v=void 0===v?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),k.toString=function(){return e+""},k}return{format:h,formatPrefix:function(e,t){var n=h(((e=SG(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(SW(t)/3))),i=Math.pow(10,-r),a=SQ[8+r/3];return function(e){return n(i*e)+a}}}}({thousands:",",grouping:[3],currency:["$",""]})).format,V=z.formatPrefix;let Tw=new Date,Tj=new Date;function TN(e,t,n,r){function i(t){return e(t=0==arguments.length?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t<n-e?t:n},i.offset=(e,n)=>(t(e=new Date(+e),null==n?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o,s=[];if(n=i.ceil(n),a=null==a?1:Math.floor(a),!(n<r)||!(a>0))return s;do s.push(o=new Date(+n)),t(n,a),e(n);while(o<n&&n<r)return s},i.filter=n=>TN(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(Tw.setTime(+t),Tj.setTime(+r),e(Tw),e(Tj),Math.floor(n(Tw,Tj))),i.every=e=>isFinite(e=Math.floor(e))&&e>0?e>1?i.filter(r?t=>r(t)%e==0:t=>i.count(0,t)%e==0):i:null),i}let Tk=TN(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Tk.every=e=>isFinite(e=Math.floor(e))&&e>0?TN(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}):null,Tk.range;let TE=TN(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());TE.every=e=>isFinite(e=Math.floor(e))&&e>0?TN(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}):null,TE.range;let TC=TN(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());TC.range;let T_=TN(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());T_.range;function TS(e){return TN(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+7*t)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/6048e5)}let TT=TS(0),TA=TS(1),TO=TS(2),TM=TS(3),TP=TS(4),TD=TS(5),TL=TS(6);function TI(e){return TN(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)},(e,t)=>(t-e)/6048e5)}TT.range,TA.range,TO.range,TM.range,TP.range,TD.range,TL.range;let TR=TI(0),TB=TI(1),Tz=TI(2),TF=TI(3),TV=TI(4),TU=TI(5),TH=TI(6);TR.range,TB.range,Tz.range,TF.range,TV.range,TU.range,TH.range;let TW=TN(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1);TW.range;let TY=TN(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1);TY.range;let TG=TN(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5));TG.range;let T$=TN(e=>{e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds()-6e4*e.getMinutes())},(e,t)=>{e.setTime(+e+36e5*t)},(e,t)=>(t-e)/36e5,e=>e.getHours());T$.range;let TX=TN(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+36e5*t)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours());TX.range;let Tq=TN(e=>{e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds())},(e,t)=>{e.setTime(+e+6e4*t)},(e,t)=>(t-e)/6e4,e=>e.getMinutes());Tq.range;let TK=TN(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+6e4*t)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes());TK.range;let TZ=TN(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+1e3*t)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds());TZ.range;let TQ=TN(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);function TJ(e,t,n,r,i,a){let o=[[TZ,1,1e3],[TZ,5,5e3],[TZ,15,15e3],[TZ,30,3e4],[a,1,6e4],[a,5,3e5],[a,15,9e5],[a,30,18e5],[i,1,36e5],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,864e5],[r,2,1728e5],[n,1,6048e5],[t,1,2592e6],[t,3,7776e6],[e,1,31536e6]];function s(t,n,r){let i=Math.abs(n-t)/r,a=_Z(([,,e])=>e).right(o,i);if(a===o.length)return e.every(_X(t/31536e6,n/31536e6,r));if(0===a)return TQ.every(Math.max(_X(t,n,r),1));let[s,l]=o[i/o[a-1][2]<o[a][2]/i?a-1:a];return s.every(l)}return[function(e,t,n){let r=t<e;r&&([e,t]=[t,e]);let i=n&&"function"==typeof n.range?n:s(e,t,n),a=i?i.range(e,+t+1):[];return r?a.reverse():a},s]}TQ.every=e=>isFinite(e=Math.floor(e))&&e>0?e>1?TN(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):TQ:null,TQ.range;let[T0,T1]=TJ(TE,T_,TR,TG,TX,TK),[T2,T5]=TJ(Tk,TC,TT,TW,T$,Tq);function T3(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function T4(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function T6(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}var T8={"-":"",_:" ",0:"0"},T7=/^\s*\d+/,T9=/^%/,Ae=/[\\^$*+?|[\]().{}]/g;function At(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",a=i.length;return r+(a<n?Array(n-a+1).join(t)+i:i)}function An(e){return e.replace(Ae,"\\$&")}function Ar(e){return RegExp("^(?:"+e.map(An).join("|")+")","i")}function Ai(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function Aa(e,t,n){var r=T7.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Ao(e,t,n){var r=T7.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function As(e,t,n){var r=T7.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Al(e,t,n){var r=T7.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function Ac(e,t,n){var r=T7.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Au(e,t,n){var r=T7.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function Ad(e,t,n){var r=T7.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Ah(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Af(e,t,n){var r=T7.exec(t.slice(n,n+1));return r?(e.q=3*r[0]-3,n+r[0].length):-1}function Ap(e,t,n){var r=T7.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Am(e,t,n){var r=T7.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Ag(e,t,n){var r=T7.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Av(e,t,n){var r=T7.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Ax(e,t,n){var r=T7.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Ay(e,t,n){var r=T7.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Ab(e,t,n){var r=T7.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Aw(e,t,n){var r=T7.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Aj(e,t,n){var r=T9.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function AN(e,t,n){var r=T7.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Ak(e,t,n){var r=T7.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function AE(e,t){return At(e.getDate(),t,2)}function AC(e,t){return At(e.getHours(),t,2)}function A_(e,t){return At(e.getHours()%12||12,t,2)}function AS(e,t){return At(1+TW.count(Tk(e),e),t,3)}function AT(e,t){return At(e.getMilliseconds(),t,3)}function AA(e,t){return AT(e,t)+"000"}function AO(e,t){return At(e.getMonth()+1,t,2)}function AM(e,t){return At(e.getMinutes(),t,2)}function AP(e,t){return At(e.getSeconds(),t,2)}function AD(e){var t=e.getDay();return 0===t?7:t}function AL(e,t){return At(TT.count(Tk(e)-1,e),t,2)}function AI(e){var t=e.getDay();return t>=4||0===t?TP(e):TP.ceil(e)}function AR(e,t){return e=AI(e),At(TP.count(Tk(e),e)+(4===Tk(e).getDay()),t,2)}function AB(e){return e.getDay()}function Az(e,t){return At(TA.count(Tk(e)-1,e),t,2)}function AF(e,t){return At(e.getFullYear()%100,t,2)}function AV(e,t){return At((e=AI(e)).getFullYear()%100,t,2)}function AU(e,t){return At(e.getFullYear()%1e4,t,4)}function AH(e,t){var n=e.getDay();return At((e=n>=4||0===n?TP(e):TP.ceil(e)).getFullYear()%1e4,t,4)}function AW(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+At(t/60|0,"0",2)+At(t%60,"0",2)}function AY(e,t){return At(e.getUTCDate(),t,2)}function AG(e,t){return At(e.getUTCHours(),t,2)}function A$(e,t){return At(e.getUTCHours()%12||12,t,2)}function AX(e,t){return At(1+TY.count(TE(e),e),t,3)}function Aq(e,t){return At(e.getUTCMilliseconds(),t,3)}function AK(e,t){return Aq(e,t)+"000"}function AZ(e,t){return At(e.getUTCMonth()+1,t,2)}function AQ(e,t){return At(e.getUTCMinutes(),t,2)}function AJ(e,t){return At(e.getUTCSeconds(),t,2)}function A0(e){var t=e.getUTCDay();return 0===t?7:t}function A1(e,t){return At(TR.count(TE(e)-1,e),t,2)}function A2(e){var t=e.getUTCDay();return t>=4||0===t?TV(e):TV.ceil(e)}function A5(e,t){return e=A2(e),At(TV.count(TE(e),e)+(4===TE(e).getUTCDay()),t,2)}function A3(e){return e.getUTCDay()}function A4(e,t){return At(TB.count(TE(e)-1,e),t,2)}function A6(e,t){return At(e.getUTCFullYear()%100,t,2)}function A8(e,t){return At((e=A2(e)).getUTCFullYear()%100,t,2)}function A7(e,t){return At(e.getUTCFullYear()%1e4,t,4)}function A9(e,t){var n=e.getUTCDay();return At((e=n>=4||0===n?TV(e):TV.ceil(e)).getUTCFullYear()%1e4,t,4)}function Oe(){return"+0000"}function Ot(){return"%"}function On(e){return+e}function Or(e){return Math.floor(e/1e3)}function Oi(e){return new Date(e)}function Oa(e){return e instanceof Date?+e:+new Date(+e)}function Oo(e,t,n,r,i,a,o,s,l,c){var u=SU(),d=u.invert,h=u.domain,f=c(".%L"),p=c(":%S"),g=c("%I:%M"),v=c("%I %p"),x=c("%a %d"),y=c("%b %d"),b=c("%B"),w=c("%Y");function j(e){return(l(e)<e?f:s(e)<e?p:o(e)<e?g:a(e)<e?v:r(e)<e?i(e)<e?x:y:n(e)<e?b:w)(e)}return u.invert=function(e){return new Date(d(e))},u.domain=function(e){return arguments.length?h(Array.from(e,Oa)):h().map(Oi)},u.ticks=function(t){var n=h();return e(n[0],n[n.length-1],null==t?10:t)},u.tickFormat=function(e,t){return null==t?j:c(t)},u.nice=function(e){var n=h();return e&&"function"==typeof e.range||(e=t(n[0],n[n.length-1],null==e?10:e)),e?h(S5(n,e)):u},u.copy=function(){return SF(u,Oo(e,t,n,r,i,a,o,s,l,c))},u}function Os(){return _P.apply(Oo(T2,T5,Tk,TC,TT,TW,T$,Tq,TZ,H).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Ol(){return _P.apply(Oo(T0,T1,TE,T_,TR,TY,TX,TK,TZ,W).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Oc(){var e,t,n,r,i,a=0,o=1,s=SI,l=!1;function c(t){return null==t||isNaN(t*=1)?i:s(0===n?.5:(t=(r(t)-e)*n,l?Math.max(0,Math.min(1,t)):t))}function u(e){return function(t){var n,r;return arguments.length?([n,r]=t,s=e(n,r),c):[s(0),s(1)]}}return c.domain=function(i){return arguments.length?([a,o]=i,e=r(a*=1),t=r(o*=1),n=e===t?0:1/(t-e),c):[a,o]},c.clamp=function(e){return arguments.length?(l=!!e,c):l},c.interpolator=function(e){return arguments.length?(s=e,c):s},c.range=u(SM),c.rangeRound=u(SP),c.unknown=function(e){return arguments.length?(i=e,c):i},function(i){return r=i,e=i(a),t=i(o),n=e===t?0:1/(t-e),c}}function Ou(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Od(){var e=S0(Oc()(SI));return e.copy=function(){return Ou(e,Od())},_D.apply(e,arguments)}function Oh(){var e=Te(Oc()).domain([1,10]);return e.copy=function(){return Ou(e,Oh()).base(e.base())},_D.apply(e,arguments)}function Of(){var e=Ti(Oc());return e.copy=function(){return Ou(e,Of()).constant(e.constant())},_D.apply(e,arguments)}function Op(){var e=Tc(Oc());return e.copy=function(){return Ou(e,Op()).exponent(e.exponent())},_D.apply(e,arguments)}function Om(){return Op.apply(null,arguments).exponent(.5)}function Og(){var e=[],t=SI;function n(n){if(null!=n&&!isNaN(n*=1))return t((_1(e,n,1)-1)/(e.length-1))}return n.domain=function(t){if(!arguments.length)return e.slice();for(let n of(e=[],t))null==n||isNaN(n*=1)||e.push(n);return e.sort(_q),n},n.interpolator=function(e){return arguments.length?(t=e,n):t},n.range=function(){return e.map((n,r)=>t(r/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(n,r)=>(function(e,t){if(!(!(n=(e=Float64Array.from(function*(e,t){if(void 0===t)for(let t of e)null!=t&&(t*=1)>=t&&(yield t);else{let n=-1;for(let r of e)null!=(r=t(r,++n,e))&&(r*=1)>=r&&(yield r)}}(e,void 0))).length)||isNaN(t*=1))){if(t<=0||n<2)return Tm(e);if(t>=1)return Tp(e);var n,r=(n-1)*t,i=Math.floor(r),a=Tp((function e(t,n,r=0,i=1/0,a){if(n=Math.floor(n),r=Math.floor(Math.max(0,r)),i=Math.floor(Math.min(t.length-1,i)),!(r<=n&&n<=i))return t;for(a=void 0===a?Tg:function(e=_q){if(e===_q)return Tg;if("function"!=typeof e)throw TypeError("compare is not a function");return(t,n)=>{let r=e(t,n);return r||0===r?r:(0===e(n,n))-(0===e(t,t))}}(a);i>r;){if(i-r>600){let o=i-r+1,s=n-r+1,l=Math.log(o),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(o-c)/o)*(s-o/2<0?-1:1),d=Math.max(r,Math.floor(n-s*c/o+u)),h=Math.min(i,Math.floor(n+(o-s)*c/o+u));e(t,n,d,h,a)}let o=t[n],s=r,l=i;for(Tv(t,r,n),a(t[i],o)>0&&Tv(t,r,i);s<l;){for(Tv(t,s,l),++s,--l;0>a(t[s],o);)++s;for(;a(t[l],o)>0;)--l}0===a(t[r],o)?Tv(t,r,l):Tv(t,++l,i),l<=n&&(r=l+1),n<=l&&(i=l-1)}return t})(e,i).subarray(0,i+1));return a+(Tm(e.subarray(i+1))-a)*(r-i)}})(e,r/t))},n.copy=function(){return Og(t).domain(e)},_D.apply(n,arguments)}function Ov(){var e,t,n,r,i,a,o,s=0,l=.5,c=1,u=1,d=SI,h=!1;function f(e){return isNaN(e*=1)?o:(e=.5+((e=+a(e))-t)*(u*e<u*t?r:i),d(h?Math.max(0,Math.min(1,e)):e))}function p(e){return function(t){var n,r,i;return arguments.length?([n,r,i]=t,d=function(e,t){void 0===t&&(t=e,e=SM);for(var n=0,r=t.length-1,i=t[0],a=Array(r<0?0:r);n<r;)a[n]=e(i,i=t[++n]);return function(e){var t=Math.max(0,Math.min(r-1,Math.floor(e*=r)));return a[t](e-t)}}(e,[n,r,i]),f):[d(0),d(.5),d(1)]}}return f.domain=function(o){return arguments.length?([s,l,c]=o,e=a(s*=1),t=a(l*=1),n=a(c*=1),r=e===t?0:.5/(t-e),i=t===n?0:.5/(n-t),u=t<e?-1:1,f):[s,l,c]},f.clamp=function(e){return arguments.length?(h=!!e,f):h},f.interpolator=function(e){return arguments.length?(d=e,f):d},f.range=p(SM),f.rangeRound=p(SP),f.unknown=function(e){return arguments.length?(o=e,f):o},function(o){return a=o,e=o(s),t=o(l),n=o(c),r=e===t?0:.5/(t-e),i=t===n?0:.5/(n-t),u=t<e?-1:1,f}}function Ox(){var e=S0(Ov()(SI));return e.copy=function(){return Ou(e,Ox())},_D.apply(e,arguments)}function Oy(){var e=Te(Ov()).domain([.1,1,10]);return e.copy=function(){return Ou(e,Oy()).base(e.base())},_D.apply(e,arguments)}function Ob(){var e=Ti(Ov());return e.copy=function(){return Ou(e,Ob()).constant(e.constant())},_D.apply(e,arguments)}function Ow(){var e=Tc(Ov());return e.copy=function(){return Ou(e,Ow()).exponent(e.exponent())},_D.apply(e,arguments)}function Oj(){return Ow.apply(null,arguments).exponent(.5)}H=(U=function(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,o=e.shortDays,s=e.months,l=e.shortMonths,c=Ar(i),u=Ai(i),d=Ar(a),h=Ai(a),f=Ar(o),p=Ai(o),g=Ar(s),v=Ai(s),x=Ar(l),y=Ai(l),b={a:function(e){return o[e.getDay()]},A:function(e){return a[e.getDay()]},b:function(e){return l[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:null,d:AE,e:AE,f:AA,g:AV,G:AH,H:AC,I:A_,j:AS,L:AT,m:AO,M:AM,p:function(e){return i[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:On,s:Or,S:AP,u:AD,U:AL,V:AR,w:AB,W:Az,x:null,X:null,y:AF,Y:AU,Z:AW,"%":Ot},w={a:function(e){return o[e.getUTCDay()]},A:function(e){return a[e.getUTCDay()]},b:function(e){return l[e.getUTCMonth()]},B:function(e){return s[e.getUTCMonth()]},c:null,d:AY,e:AY,f:AK,g:A8,G:A9,H:AG,I:A$,j:AX,L:Aq,m:AZ,M:AQ,p:function(e){return i[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:On,s:Or,S:AJ,u:A0,U:A1,V:A5,w:A3,W:A4,x:null,X:null,y:A6,Y:A7,Z:Oe,"%":Ot},j={a:function(e,t,n){var r=f.exec(t.slice(n));return r?(e.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=h.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(e,t,n){var r=x.exec(t.slice(n));return r?(e.m=y.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(e,t,n){var r=g.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(e,n,r){return E(e,t,n,r)},d:Am,e:Am,f:Aw,g:Ad,G:Au,H:Av,I:Av,j:Ag,L:Ab,m:Ap,M:Ax,p:function(e,t,n){var r=c.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1},q:Af,Q:AN,s:Ak,S:Ay,u:Ao,U:As,V:Al,w:Aa,W:Ac,x:function(e,t,r){return E(e,n,t,r)},X:function(e,t,n){return E(e,r,t,n)},y:Ad,Y:Au,Z:Ah,"%":Aj};function N(e,t){return function(n){var r,i,a,o=[],s=-1,l=0,c=e.length;for(n instanceof Date||(n=new Date(+n));++s<c;)37===e.charCodeAt(s)&&(o.push(e.slice(l,s)),null!=(i=T8[r=e.charAt(++s)])?r=e.charAt(++s):i="e"===r?" ":"0",(a=t[r])&&(r=a(n,i)),o.push(r),l=s+1);return o.push(e.slice(l,s)),o.join("")}}function k(e,t){return function(n){var r,i,a=T6(1900,void 0,1);if(E(a,e,n+="",0)!=n.length)return null;if("Q"in a)return new Date(a.Q);if("s"in a)return new Date(1e3*a.s+("L"in a?a.L:0));if(!t||"Z"in a||(a.Z=0),"p"in a&&(a.H=a.H%12+12*a.p),void 0===a.m&&(a.m="q"in a?a.q:0),"V"in a){if(a.V<1||a.V>53)return null;"w"in a||(a.w=1),"Z"in a?(r=(i=(r=T4(T6(a.y,0,1))).getUTCDay())>4||0===i?TB.ceil(r):TB(r),r=TY.offset(r,(a.V-1)*7),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(r=(i=(r=T3(T6(a.y,0,1))).getDay())>4||0===i?TA.ceil(r):TA(r),r=TW.offset(r,(a.V-1)*7),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:+("W"in a)),i="Z"in a?T4(T6(a.y,0,1)).getUTCDay():T3(T6(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,T4(a)):T3(a)}}function E(e,t,n,r){for(var i,a,o=0,s=t.length,l=n.length;o<s;){if(r>=l)return -1;if(37===(i=t.charCodeAt(o++))){if(!(a=j[(i=t.charAt(o++))in T8?t.charAt(o++):i])||(r=a(e,n,r))<0)return -1}else if(i!=n.charCodeAt(r++))return -1}return r}return b.x=N(n,b),b.X=N(r,b),b.c=N(t,b),w.x=N(n,w),w.X=N(r,w),w.c=N(t,w),{format:function(e){var t=N(e+="",b);return t.toString=function(){return e},t},parse:function(e){var t=k(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=N(e+="",w);return t.toString=function(){return e},t},utcParse:function(e){var t=k(e+="",!0);return t.toString=function(){return e},t}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]})).format,U.parse,W=U.utcFormat,U.utcParse,e.s(["scaleBand",0,_F,"scaleDiverging",0,Ox,"scaleDivergingLog",0,Oy,"scaleDivergingPow",0,Ow,"scaleDivergingSqrt",0,Oj,"scaleDivergingSymlog",0,Ob,"scaleIdentity",0,S2,"scaleImplicit",0,_B,"scaleLinear",0,S1,"scaleLog",0,Tt,"scaleOrdinal",0,_z,"scalePoint",0,_V,"scalePow",0,Tu,"scaleQuantile",0,Tx,"scaleQuantize",0,Ty,"scaleRadial",0,Tf,"scaleSequential",0,Od,"scaleSequentialLog",0,Oh,"scaleSequentialPow",0,Op,"scaleSequentialQuantile",0,Og,"scaleSequentialSqrt",0,Om,"scaleSequentialSymlog",0,Of,"scaleSqrt",0,Td,"scaleSymlog",0,Ta,"scaleThreshold",0,Tb,"scaleTime",0,Os,"scaleUtc",0,Ol,"tickFormat",0,SJ],29061),e.i(29061),e.s(["scaleBand",0,_F,"scaleDiverging",0,Ox,"scaleDivergingLog",0,Oy,"scaleDivergingPow",0,Ow,"scaleDivergingSqrt",0,Oj,"scaleDivergingSymlog",0,Ob,"scaleIdentity",0,S2,"scaleImplicit",0,_B,"scaleLinear",0,S1,"scaleLog",0,Tt,"scaleOrdinal",0,_z,"scalePoint",0,_V,"scalePow",0,Tu,"scaleQuantile",0,Tx,"scaleQuantize",0,Ty,"scaleRadial",0,Tf,"scaleSequential",0,Od,"scaleSequentialLog",0,Oh,"scaleSequentialPow",0,Op,"scaleSequentialQuantile",0,Og,"scaleSequentialSqrt",0,Om,"scaleSequentialSymlog",0,Of,"scaleSqrt",0,Td,"scaleSymlog",0,Ta,"scaleThreshold",0,Tb,"scaleTime",0,Os,"scaleUtc",0,Ol,"tickFormat",0,SJ],79357);var ON=e.i(79357),Ok=e=>e.chartData,OE=ke([Ok],e=>{var t=null!=e.chartData?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),OC=(e,t,n,r)=>r?OE(e):Ok(e);function O_(e){if(Array.isArray(e)&&2===e.length){var[t,n]=e;if(CW(t)&&CW(n))return!0}return!1}function OS(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function OT(e,t){if(t&&"function"!=typeof e&&Array.isArray(e)&&2===e.length){var n,r,[i,a]=e;if(CW(i))n=i;else if("function"==typeof i)return;if(CW(a))r=a;else if("function"==typeof a)return;var o=[n,r];if(O_(o))return o}}var OA=e.i(51655),OO=e=>e,OM={},OP=e=>function t(){let n;return 0==arguments.length||1==arguments.length&&(n=arguments.length<=0?void 0:arguments[0],n===OM)?t:e(...arguments)},OD=(e,t)=>1===e?t:OP(function(){for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];var a=r.filter(e=>e!==OM).length;return a>=e?t(...r):OD(e-a,OP(function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return t(...r.map(e=>e===OM?n.shift():e),...n)}))}),OL=(e,t)=>{for(var n=[],r=e;r<t;++r)n[r-e]=r;return n},OI=OD((a=(e,t)=>Array.isArray(t)?t.map(e):Object.keys(t).map(e=>t[e]).map(e)).length,a),OR=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(!t.length)return OO;var r=t.reverse(),i=r[0],a=r.slice(1);return function(){return a.reduce((e,t)=>t(e),i(...arguments))}};function OB(e){return 0===e?1:Math.floor(new OA.default(e).abs().log(10).toNumber())+1}function Oz(e,t,n){for(var r=new OA.default(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var OF=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},OV=(e,t,n)=>{if(e.lte(0))return new OA.default(0);var r=OB(e.toNumber()),i=new OA.default(10).pow(r),a=e.div(i),o=1!==r?.05:.1,s=new OA.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return new OA.default(t?s.toNumber():Math.ceil(s.toNumber()))},OU=function(e,t,n,r){var i,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new OA.default(0),tickMin:new OA.default(0),tickMax:new OA.default(0)};var o=OV(new OA.default(t).sub(e).div(n-1),r,a),s=Math.ceil((i=e<=0&&t>=0?new OA.default(0):(i=new OA.default(e).add(t).div(2)).sub(new OA.default(i).mod(o))).sub(e).div(o).toNumber()),l=Math.ceil(new OA.default(t).sub(i).div(o).toNumber()),c=s+l+1;return c>n?OU(e,t,n,r,a+1):(c<n&&(l=t>0?l+(n-c):l,s=t>0?s:s+(n-c)),{step:o,tickMin:i.sub(new OA.default(s).mul(o)),tickMax:i.add(new OA.default(l).mul(o))})},OH=function(e){var[t,n]=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=Math.max(r,2),[o,s]=OF([t,n]);if(o===-1/0||s===1/0){var l=s===1/0?[o,...OL(0,r-1).map(()=>1/0)]:[...OL(0,r-1).map(()=>-1/0),s];return t>n?l.reverse():l}if(o===s){var c=new OA.default(1),u=new OA.default(o);if(!u.isint()&&i){var d=Math.abs(o);d<1?(c=new OA.default(10).pow(OB(o)-1),u=new OA.default(Math.floor(u.div(c).toNumber())).mul(c)):d>1&&(u=new OA.default(Math.floor(o)))}else 0===o?u=new OA.default(Math.floor((r-1)/2)):i||(u=new OA.default(Math.floor(o)));var h=Math.floor((r-1)/2);return OR(OI(e=>u.add(new OA.default(e-h).mul(c)).toNumber()),OL)(0,r)}var{step:f,tickMin:p,tickMax:g}=OU(o,s,a,i,0),v=Oz(p,g.add(new OA.default(.1).mul(f)),f);return t>n?v.reverse():v},OW=function(e,t){var[n,r]=e,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],[a,o]=OF([n,r]);if(a===-1/0||o===1/0)return[n,r];if(a===o)return[a];var s=Math.max(t,2),l=OV(new OA.default(o).sub(a).div(s-1),i,0),c=[...Oz(new OA.default(a),new OA.default(o),l),o];return!1===i&&(c=c.map(e=>Math.round(e))),n>r?c.reverse():c},OY=e=>e.rootProps.stackOffset,OG=e=>e.rootProps.reverseStackOrder,O$=e=>e.options.chartName,OX=e=>e.rootProps.syncId,Oq=e=>e.rootProps.syncMethod,OK=e=>e.options.eventEmitter;function OZ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function OQ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?OZ(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OZ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var OJ=Math.PI/180,O0=(e,t,n,r)=>({x:e+Math.cos(-OJ*r)*n,y:t+Math.sin(-OJ*r)*n}),O1={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},O2={allowDecimals:!1,allowDuplicatedCategory:!0,angleAxisId:0,axisLine:!0,axisLineType:"polygon",cx:0,cy:0,orientation:"outer",reversed:!1,scale:"auto",tick:!0,tickLine:!0,tickSize:8,type:"category",zIndex:O1.axis},O5={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,angle:0,axisLine:!0,includeHidden:!1,hide:!1,label:!1,orientation:"right",radiusAxisId:0,reversed:!1,scale:"auto",stroke:"#ccc",tick:!0,tickCount:5,type:"number",zIndex:O1.axis},O3=(e,t)=>{if(e&&t)return null!=e&&e.reversed?[t[1],t[0]]:t},O4={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:O2.angleAxisId,includeHidden:!1,name:void 0,reversed:O2.reversed,scale:O2.scale,tick:O2.tick,tickCount:void 0,ticks:void 0,type:O2.type,unit:void 0},O6={allowDataOverflow:O5.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:O5.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:O5.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:O5.scale,tick:O5.tick,tickCount:O5.tickCount,ticks:void 0,type:O5.type,unit:void 0},O8={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:O2.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:O2.angleAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:O2.scale,tick:O2.tick,tickCount:void 0,ticks:void 0,type:"number",unit:void 0},O7={allowDataOverflow:O5.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:O5.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:O5.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:O5.scale,tick:O5.tick,tickCount:O5.tickCount,ticks:void 0,type:"category",unit:void 0},O9=(e,t)=>null!=e.polarAxis.angleAxis[t]?e.polarAxis.angleAxis[t]:"radial"===e.layout.layoutType?O8:O4,Me=(e,t)=>null!=e.polarAxis.radiusAxis[t]?e.polarAxis.radiusAxis[t]:"radial"===e.layout.layoutType?O7:O6,Mt=e=>e.polarOptions,Mn=ke([C4,C6,_r],function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,right:0,bottom:0,left:0,width:0,height:0,brushBottom:0};return Math.min(Math.abs(e-(n.left||0)-(n.right||0)),Math.abs(t-(n.top||0)-(n.bottom||0)))/2}),Mr=ke([Mt,Mn],(e,t)=>{if(null!=e)return Er(e.innerRadius,t,0)}),Mi=ke([Mt,Mn],(e,t)=>{if(null!=e)return Er(e.outerRadius,t,.8*t)}),Ma=ke([Mt],e=>{if(null==e)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]});ke([O9,Ma],O3);var Mo=ke([Mn,Mr,Mi],(e,t,n)=>{if(null!=e&&null!=t&&null!=n)return[t,n]});ke([Me,Mo],O3);var Ms=ke([_A,Mt,Mr,Mi,C4,C6],(e,t,n,r,i,a)=>{if(("centric"===e||"radial"===e)&&null!=t&&null!=n&&null!=r){var{cx:o,cy:s,startAngle:l,endAngle:c}=t;return{cx:Er(o,i,i/2),cy:Er(s,a,a/2),innerRadius:n,outerRadius:r,startAngle:l,endAngle:c,clockWise:!1}}}),Ml=(e,t)=>t,Mc=(e,t,n)=>n;function Mu(e){return null==e?void 0:e.id}function Md(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=n,o=new Map;return e.forEach(e=>{var t,n=null!=(t=e.data)?t:r;if(null!=n&&0!==n.length){var s=Mu(e);n.forEach((t,n)=>{var r,l=null==a||i?n:String(CX(t,a,null)),c=CX(t,e.dataKey,0);Object.assign(r=o.has(l)?o.get(l):{},{[s]:c}),o.set(l,r)})}}),Array.from(o.values())}function Mh(e){return"stackId"in e&&null!=e.stackId&&null!=e.dataKey}var Mf=(e,t)=>e===t||null!=e&&null!=t&&e[0]===t[0]&&e[1]===t[1];function Mp(e,t){return!!(Array.isArray(e)&&Array.isArray(t))&&0===e.length&&0===t.length||e===t}var Mm=e=>{var t=_A(e);return"horizontal"===t?"xAxis":"vertical"===t?"yAxis":"centric"===t?"angleAxis":"radiusAxis"},Mg=e=>e.tooltip.settings.axisId;function Mv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Mx(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Mv(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mv(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var My=[0,"auto"],Mb={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"bottom",padding:{left:0,right:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"category",unit:void 0},Mw=(e,t)=>e.cartesianAxis.xAxis[t],Mj=(e,t)=>{var n=Mw(e,t);return null==n?Mb:n},MN={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:My,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:60},Mk=(e,t)=>e.cartesianAxis.yAxis[t],ME=(e,t)=>{var n=Mk(e,t);return null==n?MN:n},MC={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},M_=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return null==n?MC:n},MS=(e,t,n)=>{switch(t){case"xAxis":return Mj(e,n);case"yAxis":return ME(e,n);case"zAxis":return M_(e,n);case"angleAxis":return O9(e,n);case"radiusAxis":return Me(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},MT=(e,t,n)=>{switch(t){case"xAxis":return Mj(e,n);case"yAxis":return ME(e,n);case"angleAxis":return O9(e,n);case"radiusAxis":return Me(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},MA=e=>e.graphicalItems.cartesianItems.some(e=>"bar"===e.type)||e.graphicalItems.polarItems.some(e=>"radialBar"===e.type);function MO(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var MM=e=>e.graphicalItems.cartesianItems,MP=ke([Ml,Mc],MO),MD=(e,t,n)=>e.filter(n).filter(e=>(null==t?void 0:t.includeHidden)===!0||!e.hide),ML=ke([MM,MS,MP],MD,{memoizeOptions:{resultEqualityCheck:Mp}}),MI=ke([ML],e=>e.filter(e=>"area"===e.type||"bar"===e.type).filter(Mh)),MR=e=>e.filter(e=>!("stackId"in e)||void 0===e.stackId),MB=ke([ML],MR),Mz=e=>e.map(e=>e.data).filter(Boolean).flat(1),MF=ke([ML],Mz,{memoizeOptions:{resultEqualityCheck:Mp}}),MV=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},MU=ke([MF,OC],MV),MH=(e,t,n)=>(null==t?void 0:t.dataKey)!=null?e.map(e=>({value:CX(e,t.dataKey)})):n.length>0?n.map(e=>e.dataKey).flatMap(t=>e.map(e=>({value:CX(e,t)}))):e.map(e=>({value:e})),MW=ke([MU,MS,ML],MH);function MY(e,t){switch(e){case"xAxis":return"x"===t.direction;case"yAxis":return"y"===t.direction;default:return!1}}function MG(e){if(Ee(e)||e instanceof Date){var t=Number(e);if(CW(t))return t}}function M$(e){if(Array.isArray(e)){var t=[MG(e[0]),MG(e[1])];return O_(t)?t:void 0}var n=MG(e);if(null!=n)return[n,n]}function MX(e){return e.map(MG).filter(El)}var Mq=e=>{var t=Mm(e),n=Mg(e);return MT(e,t,n)},MK=ke([Mq],e=>null==e?void 0:e.dataKey),MZ=ke([MI,OC,Mq],Md),MQ=(e,t,n,r)=>Object.fromEntries(Object.entries(t.reduce((e,t)=>{if(null==t.stackId)return e;var n=e[t.stackId];return null==n&&(n=[]),n.push(t),e[t.stackId]=n,e},{})).map(t=>{var i,a,o,[s,l]=t,c=r?[...l].reverse():l,u=c.map(Mu);return[s,{stackedData:(a=null!=(i=CQ[n])?i:Cz,(o=(function(){var e=CB([]),t=CF,n=Cz,r=CV;function i(i){var a,o,s=Array.from(e.apply(this,arguments),CU),l=s.length,c=-1;for(let e of i)for(a=0,++c;a<l;++a)(s[a][c]=[0,+r(e,s[a].key,c,i)]).data=e;for(a=0,o=CR(t(s));a<l;++a)s[o[a]].index=a;return n(s,o),s}return i.keys=function(t){return arguments.length?(e="function"==typeof t?t:CB(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r="function"==typeof e?e:CB(+e),i):r},i.order=function(e){return arguments.length?(t=null==e?CF:"function"==typeof e?e:CB(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=null==e?Cz:e,i):n},i})().keys(u).value((e,t)=>Number(CX(e,t,0))).order(CF).offset(a)(e)).forEach((t,n)=>{t.forEach((t,r)=>{var i=CX(e[r],u[n],0);Array.isArray(i)&&2===i.length&&k9(i[0])&&k9(i[1])&&(t[0]=i[0],t[1]=i[1])})}),o),graphicalItems:c}]})),MJ=ke([MZ,MI,OY,OG],MQ),M0=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(null==r&&"zAxis"!==n){var o=((e,t,n)=>{if(null!=e){let r;return[(r=Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,s=o.reduce((e,r)=>{var i,a=[Math.min(...i=CH(r,t,n).flat(2).filter(k9)),Math.max(...i)];return CW(a[0])&&CW(a[1])?[Math.min(e[0],a[0]),Math.max(e[1],a[1])]:e},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))[0]===1/0?0:r[0],r[1]===-1/0?0:r[1]]}})(e,i,a);if(null==o||0!==o[0]||0!==o[1])return o}},M1=ke([MS],e=>e.allowDataOverflow),M2=e=>{var t;if(null==e||!("domain"in e))return My;if(null!=e.domain)return e.domain;if("ticks"in e&&null!=e.ticks){if("number"===e.type){var n=MX(e.ticks);return[Math.min(...n),Math.max(...n)]}if("category"===e.type)return e.ticks.map(String)}return null!=(t=null==e?void 0:e.domain)?t:My},M5=ke([MS],M2),M3=ke([M5,M1],OT),M4=ke([MJ,Ok,Ml,M3],M0,{memoizeOptions:{resultEqualityCheck:Mf}}),M6=e=>e.errorBars,M8=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.filter(Boolean);if(0!==r.length){var i=r.flat();return[Math.min(...i),Math.max(...i)]}},M7=(e,t,n,r,i)=>{var a,o;if(n.length>0&&e.forEach(e=>{n.forEach(n=>{var s,l,c=null==(s=r[n.id])?void 0:s.filter(e=>MY(i,e)),u=CX(e,null!=(l=t.dataKey)?l:n.dataKey),d=!(!c||"number"!=typeof u||k8(u))&&c.length?MX(c.flatMap(t=>{var n,r,i=CX(e,t.dataKey);if(Array.isArray(i)?[n,r]=i:n=r=i,CW(n)&&CW(r))return[u-n,u+r]})):[];if(d.length>=2){var h=Math.min(...d),f=Math.max(...d);(null==a||h<a)&&(a=h),(null==o||f>o)&&(o=f)}var p=M$(u);null!=p&&(a=null==a?p[0]:Math.min(a,p[0]),o=null==o?p[1]:Math.max(o,p[1]))})}),(null==t?void 0:t.dataKey)!=null&&e.forEach(e=>{var n=M$(CX(e,t.dataKey));null!=n&&(a=null==a?n[0]:Math.min(a,n[0]),o=null==o?n[1]:Math.max(o,n[1]))}),CW(a)&&CW(o))return[a,o]},M9=ke([MU,MS,MB,M6,Ml],M7,{memoizeOptions:{resultEqualityCheck:Mf}});function Pe(e){var{value:t}=e;if(Ee(t)||t instanceof Date)return t}var Pt=e=>e.referenceElements.dots,Pn=(e,t,n)=>e.filter(e=>"extendDomain"===e.ifOverflow).filter(e=>"xAxis"===t?e.xAxisId===n:e.yAxisId===n),Pr=ke([Pt,Ml,Mc],Pn),Pi=e=>e.referenceElements.areas,Pa=ke([Pi,Ml,Mc],Pn),Po=e=>e.referenceElements.lines,Ps=ke([Po,Ml,Mc],Pn),Pl=(e,t)=>{if(null!=e){var n=MX(e.map(e=>"xAxis"===t?e.x:e.y));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},Pc=ke(Pr,Ml,Pl),Pu=(e,t)=>{if(null!=e){var n=MX(e.flatMap(e=>["xAxis"===t?e.x1:e.y1,"xAxis"===t?e.x2:e.y2]));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},Pd=ke([Pa,Ml],Pu),Ph=(e,t)=>{if(null!=e){var n=e.flatMap(e=>"xAxis"===t?function(e){if(null!=e.x)return MX([e.x]);var t,n=null==(t=e.segment)?void 0:t.map(e=>e.x);return null==n||0===n.length?[]:MX(n)}(e):function(e){if(null!=e.y)return MX([e.y]);var t,n=null==(t=e.segment)?void 0:t.map(e=>e.y);return null==n||0===n.length?[]:MX(n)}(e));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},Pf=ke([Ps,Ml],Ph),Pp=ke(Pc,Pf,Pd,(e,t,n)=>M8(e,n,t)),Pm=(e,t,n,r,i,a,o,s)=>null!=n?n:function(e,t,n){if(n||null!=t){if("function"==typeof e&&null!=t)try{var r=e(t,n);if(O_(r))return OS(r,t,n)}catch(e){}if(Array.isArray(e)&&2===e.length){var i,a,[o,s]=e;if("auto"===o)null!=t&&(i=Math.min(...t));else if(k9(o))i=o;else if("function"==typeof o)try{null!=t&&(i=o(null==t?void 0:t[0]))}catch(e){}else if("string"==typeof o&&C0.test(o)){var l=C0.exec(o);if(null==l||null==l[1]||null==t)i=void 0;else{var c=+l[1];i=t[0]-c}}else i=null==t?void 0:t[0];if("auto"===s)null!=t&&(a=Math.max(...t));else if(k9(s))a=s;else if("function"==typeof s)try{null!=t&&(a=s(null==t?void 0:t[1]))}catch(e){}else if("string"==typeof s&&C1.test(s)){var u=C1.exec(s);if(null==u||null==u[1]||null==t)a=void 0;else{var d=+u[1];a=t[1]+d}}else a=null==t?void 0:t[1];var h=[i,a];if(O_(h))return null==t?h:OS(h,t,n)}}}(t,"vertical"===o&&"xAxis"===s||"horizontal"===o&&"yAxis"===s?M8(r,a,i):M8(a,i),e.allowDataOverflow),Pg=ke([MS,M5,M3,M4,M9,Pp,_A,Ml],Pm,{memoizeOptions:{resultEqualityCheck:Mf}}),Pv=[0,1],Px=(e,t,n,r,i,a,o)=>{if(null!=e&&null!=n&&0!==n.length||void 0!==o){var s,l,{dataKey:c,type:u}=e,d=Cq(t,a);return d&&null==c?(0,_M.default)(0,null!=(l=null==n?void 0:n.length)?l:0):"category"===u?(s=r.map(Pe).filter(e=>null!=e),d&&(null==e.dataKey||e.allowDuplicatedCategory&&Ei(s))?(0,_M.default)(0,r.length):e.allowDuplicatedCategory?s:Array.from(new Set(s))):"expand"===i?Pv:o}},Py=ke([MS,_A,MU,MW,OY,Ml,Pg],Px),Pb=(e,t,n,r,i)=>{if(null!=e){var{scale:a,type:o}=e;if("auto"===a)return"radial"===t&&"radiusAxis"===i?"band":"radial"===t&&"angleAxis"===i?"linear":"category"===o&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?"point":"category"===o?"band":"linear";if("string"==typeof a){var s="scale".concat(Es(a));return s in ON?s:"point"}}},Pw=ke([MS,_A,MA,O$,Ml],Pb);function Pj(e,t,n,r){if(null!=n&&null!=r){if("function"==typeof e.scale)return e.scale.copy().domain(n).range(r);var i=function(e){if(null!=e){if(e in ON)return ON[e]();var t="scale".concat(Es(e));if(t in ON)return ON[t]()}}(t);if(null!=i){var a=i.domain(n).range(r);return(e=>{var t=e.domain();if(t&&!(t.length<=2)){var n=t.length,r=e.range(),i=Math.min(r[0],r[1])-1e-4,a=Math.max(r[0],r[1])+1e-4,o=e(t[0]),s=e(t[n-1]);(o<i||o>a||s<i||s>a)&&e.domain([t[0],t[n-1]])}})(a),a}}}var PN=(e,t,n)=>{var r=M2(t);if("auto"===n||"linear"===n){if(null!=t&&t.tickCount&&Array.isArray(r)&&("auto"===r[0]||"auto"===r[1])&&O_(e))return OH(e,t.tickCount,t.allowDecimals);if(null!=t&&t.tickCount&&"number"===t.type&&O_(e))return OW(e,t.tickCount,t.allowDecimals)}},Pk=ke([Py,MT,Pw],PN),PE=(e,t,n,r)=>"angleAxis"!==r&&(null==e?void 0:e.type)==="number"&&O_(t)&&Array.isArray(n)&&n.length>0?[Math.min(t[0],n[0]),Math.max(t[1],n[n.length-1])]:t,PC=ke([MS,Py,Pk,Ml],PE),P_=ke(MW,MS,(e,t)=>{if(t&&"number"===t.type){var n=1/0,r=Array.from(MX(e.map(e=>e.value))).sort((e,t)=>e-t),i=r[0],a=r[r.length-1];if(null==i||null==a)return 1/0;var o=a-i;if(0===o)return 1/0;for(var s=0;s<r.length-1;s++){var l=r[s],c=r[s+1];null!=l&&null!=c&&(n=Math.min(n,c-l))}return n/o}}),PS=ke(P_,_A,e=>e.rootProps.barCategoryGap,_r,(e,t,n,r,i)=>i,(e,t,n,r,i)=>{if(!CW(e))return 0;var a="vertical"===t?r.height:r.width;if("gap"===i)return e*a/2;if("no-gap"===i){var o=Er(n,e*a),s=e*a/2;return s-o-(s-o)/a*o}return 0}),PT=ke(Mj,(e,t,n)=>{var r=Mj(e,t);return null==r||"string"!=typeof r.padding?0:PS(e,"xAxis",t,n,r.padding)},(e,t)=>{if(null==e)return{left:0,right:0};var n,r,{padding:i}=e;return"string"==typeof i?{left:t,right:t}:{left:(null!=(n=i.left)?n:0)+t,right:(null!=(r=i.right)?r:0)+t}}),PA=ke(ME,(e,t,n)=>{var r=ME(e,t);return null==r||"string"!=typeof r.padding?0:PS(e,"yAxis",t,n,r.padding)},(e,t)=>{if(null==e)return{top:0,bottom:0};var n,r,{padding:i}=e;return"string"==typeof i?{top:t,bottom:t}:{top:(null!=(n=i.top)?n:0)+t,bottom:(null!=(r=i.bottom)?r:0)+t}}),PO=ke([_r,PT,_c,_l,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:a}=r;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),PM=ke([_r,_A,PA,_c,_l,(e,t,n)=>n],(e,t,n,r,i,a)=>{var{padding:o}=i;return a?[r.height-o.bottom,o.top]:"horizontal"===t?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),PP=(e,t,n,r)=>{var i;switch(t){case"xAxis":return PO(e,n,r);case"yAxis":return PM(e,n,r);case"zAxis":return null==(i=M_(e,n))?void 0:i.range;case"angleAxis":return Ma(e);case"radiusAxis":return Mo(e,n);default:return}},PD=ke([MS,PP],O3),PL=ke([MS,Pw,PC,PD],Pj);function PI(e,t){return e.id<t.id?-1:+(e.id>t.id)}ke([ML,M6,Ml],(e,t,n)=>e.flatMap(e=>t[e.id]).filter(Boolean).filter(e=>MY(n,e)));var PR=(e,t)=>t,PB=(e,t,n)=>n,Pz=ke(C9,PR,PB,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(PI)),PF=ke(_e,PR,PB,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(PI)),PV=(e,t)=>({width:e.width,height:t.height}),PU=ke(_r,Mj,PV),PH=ke(C6,_r,Pz,PR,PB,(e,t,n,r,i)=>{var a,o={};return n.forEach(n=>{var s=PV(t,n);null==a&&(a=((e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}})(t,r,e));var l="top"===r&&!i||"bottom"===r&&i;o[n.id]=a-Number(l)*s.height,a+=(l?-1:1)*s.height}),o}),PW=ke(C4,_r,PF,PR,PB,(e,t,n,r,i)=>{var a,o={};return n.forEach(n=>{var s={width:"number"==typeof n.width?n.width:60,height:t.height};null==a&&(a=((e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}})(t,r,e));var l="left"===r&&!i||"right"===r&&i;o[n.id]=a-Number(l)*s.width,a+=(l?-1:1)*s.width}),o}),PY=ke([_r,Mj,(e,t)=>{var n=Mj(e,t);if(null!=n)return PH(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(null!=t){var i=null==n?void 0:n[r];return null==i?{x:e.left,y:0}:{x:e.left,y:i}}}),PG=ke([_r,ME,(e,t)=>{var n=ME(e,t);if(null!=n)return PW(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(null!=t){var i=null==n?void 0:n[r];return null==i?{x:0,y:e.top}:{x:i,y:e.top}}}),P$=ke(_r,ME,(e,t)=>({width:"number"==typeof t.width?t.width:60,height:e.height})),PX=(e,t,n,r)=>{if(null!=n){var{allowDuplicatedCategory:i,type:a,dataKey:o}=n,s=Cq(e,r),l=t.map(e=>e.value);if(o&&s&&"category"===a&&i&&Ei(l))return l}},Pq=ke([_A,MW,MS,Ml],PX),PK=(e,t,n,r)=>{if(null!=n&&null!=n.dataKey){var{type:i,scale:a}=n;if(Cq(e,r)&&("number"===i||"auto"!==a))return t.map(e=>e.value)}},PZ=ke([_A,MW,MT,Ml],PK),PQ=ke([_A,(e,t,n)=>{switch(t){case"xAxis":return Mj(e,n);case"yAxis":return ME(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},Pw,PL,Pq,PZ,PP,Pk,Ml],(e,t,n,r,i,a,o,s,l)=>{if(null!=t){var c=Cq(e,l);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:l,categoricalDomain:a,duplicateDomain:i,isCategorical:c,niceTicks:s,range:o,realScaleType:n,scale:r}}}),PJ=ke([_A,MT,Pw,PL,Pk,PP,Pq,PZ,Ml],(e,t,n,r,i,a,o,s,l)=>{if(null!=t&&null!=r){var c=Cq(e,l),{type:u,ticks:d,tickCount:h}=t,f="scaleBand"===n&&"function"==typeof r.bandwidth?r.bandwidth()/2:2,p="category"===u&&r.bandwidth?r.bandwidth()/f:0;p="angleAxis"===l&&null!=a&&a.length>=2?2*k6(a[0]-a[1])*p:p;var g=d||i;return g?g.map((e,t)=>({index:t,coordinate:r(o?o.indexOf(e):e)+p,value:e,offset:p})).filter(e=>CW(e.coordinate)):c&&s?s.map((e,t)=>({coordinate:r(e)+p,value:e,index:t,offset:p})).filter(e=>CW(e.coordinate)):r.ticks?r.ticks(h).map(e=>({coordinate:r(e)+p,value:e,offset:p})):r.domain().map((e,t)=>({coordinate:r(e)+p,value:o?o[e]:e,index:t,offset:p}))}}),P0=ke([_A,MT,PL,PP,Pq,PZ,Ml],(e,t,n,r,i,a,o)=>{if(null!=t&&null!=n&&null!=r&&r[0]!==r[1]){var s=Cq(e,o),{tickCount:l}=t,c=0;return(c="angleAxis"===o&&(null==r?void 0:r.length)>=2?2*k6(r[0]-r[1])*c:c,s&&a)?a.map((e,t)=>({coordinate:n(e)+c,value:e,index:t,offset:c})):n.ticks?n.ticks(l).map(e=>({coordinate:n(e)+c,value:e,offset:c})):n.domain().map((e,t)=>({coordinate:n(e)+c,value:i?i[e]:e,index:t,offset:c}))}}),P1=ke(MS,PL,(e,t)=>{if(null!=e&&null!=t)return Mx(Mx({},e),{},{scale:t})}),P2=ke([MS,Pw,Py,PD],Pj);ke((e,t,n)=>M_(e,n),P2,(e,t)=>{if(null!=e&&null!=t)return Mx(Mx({},e),{},{scale:t})});var P5=ke([_A,C9,_e],(e,t,n)=>{switch(e){case"horizontal":return t.some(e=>e.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(e=>e.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),P3=e=>e.options.defaultTooltipEventType,P4=e=>e.options.validateTooltipEventTypes;function P6(e,t,n){if(null==e)return t;var r=e?"axis":"item";return null==n?t:n.includes(r)?r:t}function P8(e,t){return P6(t,P3(e),P4(e))}var P7=(e,t)=>{var n,r=Number(t);if(!k8(r)&&null!=t)return r>=0?null==e||null==(n=e[r])?void 0:n.value:void 0};function P9(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function De(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?P9(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P9(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Dt=(e,t,n,r)=>{if(null==t)return Ct;var i,a,o,s=(i=e,a=t,o=n,"axis"===a?"click"===o?i.axisInteraction.click:i.axisInteraction.hover:"click"===o?i.itemInteraction.click:i.itemInteraction.hover);if(null==s)return Ct;if(s.active)return s;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&null!=e.syncInteraction.index)return e.syncInteraction;var l=!0===e.settings.active;if(null!=s.index){if(l)return De(De({},s),{},{active:!0})}else if(null!=r)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return De(De({},Ct),{},{coordinate:s.coordinate})},Dn=(e,t,n,r)=>{var i=null==e?void 0:e.index;if(null==i)return null;var a=Number(i);if(!CW(a))return i;var o=Infinity;t.length>0&&(o=t.length-1);var s=Math.max(0,Math.min(a,o)),l=t[s];return null==l?String(s):!function(e,t,n){if(null==n||null==t)return!0;var r=CX(e,t);return!(null!=r&&O_(n))||function(e,t){var n=function(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}(e),r=t[0],i=t[1];if(void 0===n)return!1;var a=Math.min(r,i),o=Math.max(r,i);return n>=a&&n<=o}(r,n)}(l,n,r)?null:String(s)},Dr=(e,t,n,r,i,a,o,s)=>{if(null!=a&&null!=s){var l=o[0],c=null==l?void 0:s(l.positions,a);if(null!=c)return c;var u=null==i?void 0:i[Number(a)];if(u)if("horizontal"===n)return{x:u.coordinate,y:(r.top+t)/2};else return{x:(r.left+e)/2,y:u.coordinate}}},Di=(e,t,n,r)=>{if("axis"===t)return e.tooltipItemPayloads;if(0===e.tooltipItemPayloads.length)return[];if(null==(i="hover"===n?e.itemInteraction.hover.graphicalItemId:e.itemInteraction.click.graphicalItemId)&&null!=r){var i,a=e.tooltipItemPayloads[0];return null!=a?[a]:[]}return e.tooltipItemPayloads.filter(e=>{var t;return(null==(t=e.settings)?void 0:t.graphicalItemId)===i})},Da=e=>e.options.tooltipPayloadSearcher,Do=e=>e.tooltip;function Ds(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Dl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ds(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ds(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Dc=(e,t,n,r,i,a,o)=>{if(null!=t&&null!=a){var{chartData:s,computedData:l,dataStartIndex:c,dataEndIndex:u}=n;return e.reduce((e,n)=>{var d,h,f,{dataDefinedOnItem:p,settings:g}=n,v=null!=p?p:s,x=Array.isArray(v)?CH(v,c,u):v,y=null!=(d=null==g?void 0:g.dataKey)?d:r,b=null==g?void 0:g.nameKey;return Array.isArray(h=r&&Array.isArray(x)&&!Array.isArray(x[0])&&"axis"===o?Eo(x,r,i):a(x,t,l,b))?h.forEach(t=>{var n=Dl(Dl({},g),{},{name:t.name,unit:t.unit,color:void 0,fill:void 0});e.push(C5({tooltipEntrySettings:n,dataKey:t.dataKey,payload:t.payload,value:CX(t.payload,t.dataKey),name:t.name}))}):e.push(C5({tooltipEntrySettings:g,dataKey:y,payload:h,value:CX(h,y),name:null!=(f=CX(h,b))?f:null==g?void 0:g.name})),e},[])}},Du=ke([Mq,_A,MA,O$,Mm],Pb),Dd=ke([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),Dh=ke([Mm,Mg],MO),Df=ke([Dd,Mq,Dh],MD,{memoizeOptions:{resultEqualityCheck:Mp}}),Dp=ke([Df],e=>e.filter(Mh)),Dm=ke([Df],Mz,{memoizeOptions:{resultEqualityCheck:Mp}}),Dg=ke([Dm,Ok],MV),Dv=ke([Dp,Ok,Mq],Md),Dx=ke([Dg,Mq,Df],MH),Dy=ke([Mq],M2),Db=ke([Mq],e=>e.allowDataOverflow),Dw=ke([Dy,Db],OT),Dj=ke([Df],e=>e.filter(Mh)),DN=ke([Dv,Dj,OY,OG],MQ),Dk=ke([DN,Ok,Mm,Dw],M0),DE=ke([Df],MR),DC=ke([Dg,Mq,DE,M6,Mm],M7,{memoizeOptions:{resultEqualityCheck:Mf}}),D_=ke([Pt,Mm,Mg],Pn),DS=ke([D_,Mm],Pl),DT=ke([Pi,Mm,Mg],Pn),DA=ke([DT,Mm],Pu),DO=ke([Po,Mm,Mg],Pn),DM=ke([DO,Mm],Ph),DP=ke([DS,DM,DA],M8),DD=ke([Mq,Dy,Dw,Dk,DC,DP,_A,Mm],Pm),DL=ke([Mq,_A,Dg,Dx,OY,Mm,DD],Px),DI=ke([DL,Mq,Du],PN),DR=ke([Mq,DL,DI,Mm],PE),DB=e=>{var t=Mm(e),n=Mg(e);return PP(e,t,n,!1)},Dz=ke([Mq,DB],O3),DF=ke([Mq,Du,DR,Dz],Pj),DV=ke([_A,Dx,Mq,Mm],PX),DU=ke([_A,Dx,Mq,Mm],PK),DH=ke([_A,Mq,Du,DF,DB,DV,DU,Mm],(e,t,n,r,i,a,o,s)=>{if(t){var{type:l}=t,c=Cq(e,s);if(r){var u="scaleBand"===n&&r.bandwidth?r.bandwidth()/2:2,d="category"===l&&r.bandwidth?r.bandwidth()/u:0;return(d="angleAxis"===s&&null!=i&&(null==i?void 0:i.length)>=2?2*k6(i[0]-i[1])*d:d,c&&o)?o.map((e,t)=>({coordinate:r(e)+d,value:e,index:t,offset:d})):r.domain().map((e,t)=>({coordinate:r(e)+d,value:a?a[e]:e,index:t,offset:d}))}}}),DW=ke([P3,P4,e=>e.tooltip.settings],(e,t,n)=>P6(n.shared,e,t)),DY=e=>e.tooltip.settings.trigger,DG=e=>e.tooltip.settings.defaultIndex,D$=ke([Do,DW,DY,DG],Dt),DX=ke([D$,Dg,MK,DL],Dn),Dq=ke([DH,DX],P7),DK=ke([D$],e=>{if(e)return e.dataKey});ke([D$],e=>{if(e)return e.graphicalItemId});var DZ=ke([Do,DW,DY,DG],Di),DQ=ke([C4,C6,_A,_r,DH,DG,DZ,Da],Dr),DJ=ke([D$,DQ],(e,t)=>null!=e&&e.coordinate?e.coordinate:t),D0=ke([D$],e=>{var t;return null!=(t=null==e?void 0:e.active)&&t}),D1=ke([DZ,DX,Ok,MK,Dq,Da,DW],Dc),D2=ke([D1],e=>{if(null!=e)return Array.from(new Set(e.map(e=>e.payload).filter(e=>null!=e)))});function D5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function D3(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D5(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D5(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var D4=(e,t,n,r,i)=>{var a=null!=(d=null==t?void 0:t.length)?d:0;if(a<=1||null==e)return 0;if("angleAxis"===r&&null!=i&&1e-6>=Math.abs(Math.abs(i[1]-i[0])-360))for(var o=0;o<a;o++){var s=o>0?null==(h=n[o-1])?void 0:h.coordinate:null==(f=n[a-1])?void 0:f.coordinate,l=null==(p=n[o])?void 0:p.coordinate,c=o>=a-1?null==(g=n[0])?void 0:g.coordinate:null==(v=n[o+1])?void 0:v.coordinate,u=void 0;if(null!=s&&null!=l&&null!=c)if(k6(l-s)!==k6(c-l)){var d,h,f,p,g,v,x,y=[];if(k6(c-l)===k6(i[1]-i[0])){u=c;var b=l+i[1]-i[0];y[0]=Math.min(b,(b+s)/2),y[1]=Math.max(b,(b+s)/2)}else{u=s;var w=c+i[1]-i[0];y[0]=Math.min(l,(w+l)/2),y[1]=Math.max(l,(w+l)/2)}var j=[Math.min(l,(u+l)/2),Math.max(l,(u+l)/2)];if(e>j[0]&&e<=j[1]||e>=y[0]&&e<=y[1])return null==(x=n[o])?void 0:x.index}else{var N,k=Math.min(s,c),E=Math.max(s,c);if(e>(k+l)/2&&e<=(E+l)/2)return null==(N=n[o])?void 0:N.index}}else if(t)for(var C=0;C<a;C++){var _=t[C];if(null!=_){var S=t[C+1],T=t[C-1];if(0===C&&null!=S&&e<=(_.coordinate+S.coordinate)/2||C===a-1&&null!=T&&e>(_.coordinate+T.coordinate)/2||C>0&&C<a-1&&null!=T&&null!=S&&e>(_.coordinate+T.coordinate)/2&&e<=(_.coordinate+S.coordinate)/2)return _.index}}return -1},D6=(e,t)=>t,D8=(e,t,n)=>n,D7=(e,t,n,r)=>r,D9=ke(DH,e=>(0,CL.default)(e,e=>e.coordinate)),Le=ke([Do,D6,D8,D7],Dt),Lt=ke([Le,Dg,MK,DL],Dn),Ln=ke([Do,D6,D8,D7],Di),Lr=ke([C4,C6,_A,_r,DH,D7,Ln,Da],Dr),Li=ke([Le,Lr],(e,t)=>{var n;return null!=(n=e.coordinate)?n:t}),La=ke([DH,Lt],P7),Lo=ke([Ln,Lt,Ok,MK,La,Da,D6],Dc),Ls=ke([Le,Lt],(e,t)=>({isActive:e.active&&null!=t,activeIndex:t})),Ll=ke([(e,t)=>t,_A,Ms,Mm,Dz,DH,D9,_r],(e,t,n,r,i,a,o,s)=>{if(e&&t&&r&&i&&a){if("horizontal"===t||"vertical"===t){if(!e||!r||!i||!a)return;if(function(e,t){var{chartX:n,chartY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}(e,s)){var l=D4("horizontal"===t?e.chartX:"vertical"===t?e.chartY:void 0,o,a,r,i),c=((e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if("horizontal"===e)return{x:i.coordinate,y:r.chartY};if("vertical"===e)return{x:r.chartX,y:i.coordinate}}return{x:0,y:0}})(t,a,l,e);return{activeIndex:String(l),activeCoordinate:c}}return}if(e&&r&&i&&a&&n){var u=((e,t)=>{var n,{chartX:r,chartY:i}=e,{radius:a,angle:o}=((e,t)=>{var{x:n,y:r}=e,{cx:i,cy:a}=t,o=((e,t)=>{var{x:n,y:r}=e,{x:i,y:a}=t;return Math.sqrt((n-i)**2+(r-a)**2)})({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var s=Math.acos((n-i)/o);return r>a&&(s=2*Math.PI-s),{radius:o,angle:180*s/Math.PI,angleInRadian:s}})({x:r,y:i},t),{innerRadius:s,outerRadius:l}=t;if(a<s||a>l||0===a)return null;var{startAngle:c,endAngle:u}=(e=>{var{startAngle:t,endAngle:n}=e,r=Math.min(Math.floor(t/360),Math.floor(n/360));return{startAngle:t-360*r,endAngle:n-360*r}})(t),d=o;if(c<=u){for(;d>u;)d-=360;for(;d<c;)d+=360;n=d>=c&&d<=u}else{for(;d>c;)d-=360;for(;d<u;)d+=360;n=d>=u&&d<=c}return n?OQ(OQ({},t),{},{radius:a,angle:((e,t)=>{var{startAngle:n,endAngle:r}=t;return e+360*Math.min(Math.floor(n/360),Math.floor(r/360))})(d,t)}):null})(e,n);if(u){var d=D4("centric"===t?u.angle:u.radius,o,a,r,i),h=((e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if("centric"===e){var a=i.coordinate,{radius:o}=r;return D3(D3(D3({},r),O0(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,{angle:l}=r;return D3(D3(D3({},r),O0(r.cx,r.cy,s,l)),{},{angle:l,radius:s})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}})(t,a,d,u);return{activeIndex:String(d),activeCoordinate:h}}return}}}),Lc=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},Lu=kf("mouseClick"),Ld=k1();Ld.startListening({actionCreator:Lu,effect:(e,t)=>{var n=e.payload,r=Ll(t.getState(),Lc(n));(null==r?void 0:r.activeIndex)!=null&&t.dispatch(Ch({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var Lh=kf("mouseMove"),Lf=k1(),Lp=null;function Lm(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":"children"===e&&"object"==typeof t&&null!==t?"<<CHILDREN>>":t}function Lg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Lv(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Lg(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lg(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}Lf.startListening({actionCreator:Lh,effect:(e,t)=>{var n=e.payload;null!==Lp&&cancelAnimationFrame(Lp);var r=Lc(n);Lp=requestAnimationFrame(()=>{var e=t.getState();if("axis"===P8(e,e.tooltip.settings.shared)){var n=Ll(e,r);(null==n?void 0:n.activeIndex)!=null?t.dispatch(Cd({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate})):t.dispatch(Cc())}Lp=null})}});var Lx=kk({name:"cartesianAxis",initialState:{xAxis:{},yAxis:{},zAxis:{}},reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:kx()},replaceXAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;void 0!==e.xAxis[n.id]&&(n.id!==r.id&&delete e.xAxis[n.id],e.xAxis[r.id]=r)},prepare:kx()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:kx()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:kx()},replaceYAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;void 0!==e.yAxis[n.id]&&(n.id!==r.id&&delete e.yAxis[n.id],e.yAxis[r.id]=r)},prepare:kx()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:kx()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:kx()},replaceZAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;void 0!==e.zAxis[n.id]&&(n.id!==r.id&&delete e.zAxis[n.id],e.zAxis[r.id]=r)},prepare:kx()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:kx()},updateYAxisWidth(e,t){var{id:n,width:r}=t.payload,i=e.yAxis[n];if(i){var a=i.widthHistory||[];if(3===a.length&&a[0]===a[2]&&r===a[1]&&r!==i.width&&1>=Math.abs(r-a[0]))return;var o=[...a,r].slice(-3);e.yAxis[n]=Lv(Lv({},e.yAxis[n]),{},{width:r,widthHistory:o})}}}}),{addXAxis:Ly,replaceXAxis:Lb,removeXAxis:Lw,addYAxis:Lj,replaceYAxis:LN,removeYAxis:Lk,addZAxis:LE,replaceZAxis:LC,removeZAxis:L_,updateYAxisWidth:LS}=Lx.actions,LT=Lx.reducer,LA=kk({name:"graphicalItems",initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:kx()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NY(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:kx()},removeCartesianGraphicalItem:{reducer(e,t){var n=NY(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:kx()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:kx()},removePolarGraphicalItem:{reducer(e,t){var n=NY(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:kx()}}}),{addCartesianGraphicalItem:LO,replaceCartesianGraphicalItem:LM,removeCartesianGraphicalItem:LP,addPolarGraphicalItem:LD,removePolarGraphicalItem:LL}=LA.actions,LI=LA.reducer,LR=kk({name:"referenceElements",initialState:{dots:[],areas:[],lines:[]},reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=NY(e).dots.findIndex(e=>e===t.payload);-1!==n&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=NY(e).areas.findIndex(e=>e===t.payload);-1!==n&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=NY(e).lines.findIndex(e=>e===t.payload);-1!==n&&e.lines.splice(n,1)}}}),{addDot:LB,removeDot:Lz,addArea:LF,removeArea:LV,addLine:LU,removeLine:LH}=LR.actions,LW=LR.reducer,LY={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},LG=kk({name:"brush",initialState:LY,reducers:{setBrushSettings:(e,t)=>null==t.payload?LY:t.payload}}),{setBrushSettings:L$}=LG.actions,LX=LG.reducer,Lq=kk({name:"legend",initialState:{settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:kx()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NY(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:kx()},removeLegendPayload:{reducer(e,t){var n=NY(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:kx()}}}),{setLegendSize:LK,setLegendSettings:LZ,addLegendPayload:LQ,replaceLegendPayload:LJ,removeLegendPayload:L0}=Lq.actions,L1=Lq.reducer,L2={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},L5=kk({name:"rootProps",initialState:L2,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=null!=(n=t.payload.barGap)?n:L2.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),L3=L5.reducer,{updateOptions:L4}=L5.actions,L6=kk({name:"polarAxis",initialState:{radiusAxis:{},angleAxis:{}},reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:L8,removeRadiusAxis:L7,addAngleAxis:L9,removeAngleAxis:Ie}=L6.actions,It=L6.reducer,In=kk({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(e,t)=>t.payload}}),{updatePolarOptions:Ir}=In.actions,Ii=In.reducer,Ia=kf("keyDown"),Io=kf("focus"),Is=k1();Is.startListening({actionCreator:Ia,effect:(e,t)=>{var n=t.getState();if(!1===n.rootProps.accessibilityLayer)return;var{keyboardInteraction:r}=n.tooltip,i=e.payload;if("ArrowRight"===i||"ArrowLeft"===i||"Enter"===i){var a=Dn(r,Dg(n),MK(n),DL(n)),o=null==a?-1:Number(a);if(Number.isFinite(o)&&!(o<0)){var s=DH(n);if("Enter"===i){var l=Lr(n,"axis","hover",String(r.index));t.dispatch(Cp({active:!r.active,activeIndex:r.index,activeCoordinate:l}));return}var c=o+("ArrowRight"===i?1:-1)*("left-to-right"===P5(n)?1:-1);if(null!=s&&!(c>=s.length)&&!(c<0)){var u=Lr(n,"axis","hover",String(c));t.dispatch(Cp({active:!0,activeIndex:c.toString(),activeCoordinate:u}))}}}}}),Is.startListening({actionCreator:Io,effect:(e,t)=>{var n=t.getState();if(!1!==n.rootProps.accessibilityLayer){var{keyboardInteraction:r}=n.tooltip;if(!r.active&&null==r.index){var i=Lr(n,"axis","hover",String("0"));t.dispatch(Cp({active:!0,activeIndex:"0",activeCoordinate:i}))}}}});var Il=kf("externalEvent"),Ic=k1(),Iu=new Map;Ic.startListening({actionCreator:Il,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(null!=n){r.persist();var i=r.type,a=Iu.get(i);void 0!==a&&cancelAnimationFrame(a);var o=requestAnimationFrame(()=>{try{var e=t.getState(),a={activeCoordinate:DJ(e),activeDataKey:DK(e),activeIndex:DX(e),activeLabel:Dq(e),activeTooltipIndex:DX(e),isTooltipActive:D0(e)};n(a,r)}finally{Iu.delete(i)}});Iu.set(i,o)}}});var Id=ke([Do],e=>e.tooltipItemPayloads),Ih=ke([Id,Da,(e,t)=>t,(e,t,n)=>n],(e,t,n,r)=>{var i=e.find(e=>e.settings.graphicalItemId===r);if(null!=i){var{positions:a}=i;if(null!=a)return t(a,n)}}),If=kf("touchMove"),Ip=k1();Ip.startListening({actionCreator:If,effect:(e,t)=>{var n=e.payload;if(null!=n.touches&&0!==n.touches.length){var r=t.getState(),i=P8(r,r.tooltip.settings.shared);if("axis"===i){var a=n.touches[0];if(null==a)return;var o=Ll(r,Lc({clientX:a.clientX,clientY:a.clientY,currentTarget:n.currentTarget}));(null==o?void 0:o.activeIndex)!=null&&t.dispatch(Cd({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if("item"===i){var s,l=n.touches[0];if(null==document.elementFromPoint||null==l)return;var c=document.elementFromPoint(l.clientX,l.clientY);if(!c||!c.getAttribute)return;var u=c.getAttribute("data-recharts-item-index"),d=null!=(s=c.getAttribute("data-recharts-item-id"))?s:void 0,h=Df(r).find(e=>e.id===d);if(null==u||null==h||null==d)return;var{dataKey:f}=h,p=Ih(r,u,d);t.dispatch(Cs({activeDataKey:f,activeIndex:u,activeCoordinate:p,activeGraphicalItemId:d}))}}}});var Im=kk({name:"errorBars",initialState:{},reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(e=>e.dataKey===r.dataKey&&e.direction===r.direction?i:e))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(e=>e.dataKey!==r.dataKey||e.direction!==r.direction))}}}),{addErrorBar:Ig,replaceErrorBar:Iv,removeErrorBar:Ix}=Im.actions,Iy=Im.reducer,Ib={devToolsEnabled:!0,isSsr:!("u">typeof window&&window.document&&window.document.createElement&&window.setTimeout)};function Iw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ij(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Iw(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Iw(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var IN={zIndexMap:Object.values(O1).reduce((e,t)=>Ij(Ij({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),{})},Ik=new Set(Object.values(O1)),IE=kk({name:"zIndex",initialState:IN,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:kx()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!Ik.has(n)&&delete e.zIndexMap[n])},prepare:kx()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=r:e.zIndexMap[n].element=r:e.zIndexMap[n]={consumers:0,element:i?void 0:r,panoramaElement:i?r:void 0}},prepare:kx()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:kx()}}}),{registerZIndexPortal:IC,unregisterZIndexPortal:I_,registerZIndexPortalElement:IS,unregisterZIndexPortalElement:IT}=IE.actions,IA=ks({brush:LX,cartesianAxis:LT,chartData:Cb,errorBars:Iy,graphicalItems:LI,layout:CC,legend:L1,options:Eh,polarAxis:It,polarOptions:Ii,referenceElements:LW,rootProps:L3,tooltip:Cm,zIndex:IE.reducer}),IO=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Chart";return function(e){let t,n,r,i=function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new kp;return t&&("boolean"==typeof t?a.push(kd):a.push(ku(t.extraArgument))),a},{reducer:a,middleware:o,devTools:s=!0,duplicateMiddlewareCheck:l=!0,preloadedState:c,enhancers:u}=e||{};if("function"==typeof a)t=a;else if(ko(a))t=ks(a);else throw Error(k2(1));n="function"==typeof o?o(i):i();let d=kl;s&&(d=kh({trace:!1,..."object"==typeof s&&s}));let h=(r=function(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(kn(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=kl(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}(...n),function(e){let{autoBatch:t=!0}=e??{},n=new kp(r);return t&&n.push(kb("object"==typeof t?t:void 0)),n});return function e(t,n,r){if("function"!=typeof t)throw Error(kn(2));if("function"==typeof n&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw Error(kn(0));if("function"==typeof n&&void 0===r&&(r=n,n=void 0),void 0!==r){if("function"!=typeof r)throw Error(kn(1));return r(e)(t,n)}let i=t,a=n,o=new Map,s=o,l=0,c=!1;function u(){s===o&&(s=new Map,o.forEach((e,t)=>{s.set(t,e)}))}function d(){if(c)throw Error(kn(3));return a}function h(e){if("function"!=typeof e)throw Error(kn(4));if(c)throw Error(kn(5));let t=!0;u();let n=l++;return s.set(n,e),function(){if(t){if(c)throw Error(kn(6));t=!1,u(),s.delete(n),o=null}}}function f(e){if(!ko(e))throw Error(kn(7));if(void 0===e.type)throw Error(kn(8));if("string"!=typeof e.type)throw Error(kn(17));if(c)throw Error(kn(9));try{c=!0,a=i(a,e)}finally{c=!1}return(o=s).forEach(e=>{e()}),e}return f({type:ka.INIT}),{dispatch:f,subscribe:h,getState:d,replaceReducer:function(e){if("function"!=typeof e)throw Error(kn(10));i=e,f({type:ka.REPLACE})},[kr]:function(){return{subscribe(e){if("object"!=typeof e||null===e)throw Error(kn(11));function t(){e.next&&e.next(d())}return t(),{unsubscribe:h(t)}},[kr](){return this}}}}}(t,c,d(..."function"==typeof u?u(h):h()))}({reducer:IA,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes("es6")}).concat([Ld.middleware,Lf.middleware,Is.middleware,Ic.middleware,Ip.middleware]),enhancers:e=>{var t=e;return"function"==typeof e&&(t=e()),t.concat(kb({type:"raf"}))},devTools:Ib.devToolsEnabled&&{serialize:{replacer:Lm},name:"recharts-".concat(t)}})};function IM(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=_s(),a=(0,em.useRef)(null);return i?n:(null==a.current&&(a.current=IO(t,r)),em.createElement(Ej,{context:CS,store:a.current},n))}var IP=e=>{var{chartData:t}=e,n=CA(),r=_s();return(0,em.useEffect)(()=>r?()=>{}:(n(Cv(t)),()=>{n(Cv(void 0))}),[t,n,r]),null},ID=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function IL(e,t){for(var n of new Set([...Object.keys(e),...Object.keys(t)]))if(ID.has(n)){if(null==e[n]&&null==t[n])continue;if(!function(e,t){if(Ex(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Ex(e[n[r]],t[n[r]]))return!1;return!0}(e[n],t[n]))return!1}else{var r,i;if(r=e[n],i=t[n],(null!=r||null!=i)&&("number"==typeof r&&"number"==typeof i?r!==i&&(r==r||i==i):r!==i))return!1}return!0}var II=(0,em.memo)(function(e){var{layout:t,margin:n}=e,r=CA(),i=_s();return(0,em.useEffect)(()=>{i||(r(CN(t)),r(Cj(n)))},[r,i,t,n]),null},IL);function IR(e){var t=CA();return(0,em.useEffect)(()=>{t(L4(e))},[t,e]),null}var IB=()=>{var e;return null==(e=CD(e=>e.rootProps.accessibilityLayer))||e},Iz=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function IF(e){return"string"==typeof e&&Iz.includes(e)}var IV=new Set(["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"]);function IU(e){return"string"==typeof e&&IV.has(e)}function IH(e){return"string"==typeof e&&e.startsWith("data-")}function IW(e){if("object"!=typeof e||null===e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(IU(n)||IH(n))&&(t[n]=e[n]);return t}function IY(e){return null==e?null:(0,em.isValidElement)(e)&&"object"==typeof e.props&&null!==e.props?IW(e.props):"object"!=typeof e||Array.isArray(e)?null:IW(e)}function IG(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(IU(n)||IH(n)||IF(n))&&(t[n]=e[n]);return t}var I$=["children","width","height","viewBox","className","style","title","desc"];function IX(){return(IX=Object.assign.bind()).apply(null,arguments)}var Iq=(0,em.forwardRef)((e,t)=>{var{children:n,width:r,height:i,viewBox:a,className:o,style:s,title:l,desc:c}=e,u=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,I$),d=a||{width:r,height:i,x:0,y:0},h=(0,_u.clsx)("recharts-surface",o);return em.createElement("svg",IX({},IG(u),{className:h,width:r,height:i,style:s,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height),ref:t}),em.createElement("title",null,l),em.createElement("desc",null,c),n)}),IK=ke(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(null!=t){var r=e[t];if(null!=r)return n?r.panoramaElement:r.element}}),IZ=ke(e=>e.zIndex.zIndexMap,e=>Array.from(new Set(Object.keys(e).map(e=>parseInt(e,10)).concat(Object.values(O1)))).sort((e,t)=>e-t),{memoizeOptions:{resultEqualityCheck:function(e,t){if(e.length===t.length){for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return!1}}});function IQ(e){var{zIndex:t,isPanorama:n}=e,r=(0,em.useRef)(null),i=CA();return(0,em.useLayoutEffect)(()=>(r.current&&i(IS({zIndex:t,element:r.current,isPanorama:n})),()=>{i(IT({zIndex:t,isPanorama:n}))}),[i,t,n]),em.createElement("g",{tabIndex:-1,ref:r})}function IJ(e){var{children:t,isPanorama:n}=e,r=CD(IZ);if(!r||0===r.length)return t;var i=r.filter(e=>e<0),a=r.filter(e=>e>0);return em.createElement(em.Fragment,null,i.map(e=>em.createElement(IQ,{key:e,zIndex:e,isPanorama:n})),t,a.map(e=>em.createElement(IQ,{key:e,zIndex:e,isPanorama:n})))}var I0=["children"];function I1(){return(I1=Object.assign.bind()).apply(null,arguments)}var I2={width:"100%",height:"100%",display:"block"},I5=(0,em.forwardRef)((e,t)=>{var n,r,i=CD(C4),a=CD(C6),o=IB();if(!CY(i)||!CY(a))return null;var{children:s,otherAttributes:l,title:c,desc:u}=e;return null!=l&&(n="number"==typeof l.tabIndex?l.tabIndex:o?0:void 0,r="string"==typeof l.role?l.role:o?"application":void 0),em.createElement(Iq,I1({},l,{title:c,desc:u,role:r,tabIndex:n,width:i,height:a,style:I2,ref:t}),s)}),I3=e=>{var{children:t}=e,n=CD(_c);if(!n)return null;var{width:r,height:i,y:a,x:o}=n;return em.createElement(Iq,{width:r,height:i,x:o,y:a},t)},I4=(0,em.forwardRef)((e,t)=>{var{children:n}=e,r=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,I0);return _s()?em.createElement(I3,null,em.createElement(IJ,{isPanorama:!0},n)):em.createElement(I5,I1({ref:t},r),em.createElement(IJ,{isPanorama:!1},n))}),I6=new(e.i(29942)).default,I8="recharts.syncEvent.tooltip",I7="recharts.syncEvent.brush";function I9(e){return e.tooltip.syncInteraction}var Re=["x","y"];function Rt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Rn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rt(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Rr=(0,em.createContext)(null),Ri=(0,em.createContext)(null);function Ra(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ro(){return(Ro=Object.assign.bind()).apply(null,arguments)}var Rs=()=>{var e,t,n,r,i,a,o,s,l,c,u,d;return e=CA(),(0,em.useEffect)(()=>{e(Ef())},[e]),t=CD(OX),n=CD(OK),r=CA(),i=CD(Oq),a=CD(DH),o=CD(_A),s=__(),l=CD(e=>e.rootProps.className),(0,em.useEffect)(()=>{if(null==t)return Ec;var e=(e,l,c)=>{if(n!==c&&t===e){if("index"===i){if(s&&null!=l&&null!=(u=l.payload)&&u.coordinate&&l.payload.sourceViewBox){var u,d,h=l.payload.coordinate,{x:f,y:p}=h,g=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(h,Re),{x:v,y:x,width:y,height:b}=l.payload.sourceViewBox,w=Rn(Rn({},g),{},{x:s.x+(y?(f-v)/y:0)*s.width,y:s.y+(b?(p-x)/b:0)*s.height});r(Rn(Rn({},l),{},{payload:Rn(Rn({},l.payload),{},{coordinate:w})}))}else r(l);return}if(null!=a){if("function"==typeof i){var j=i(a,{activeTooltipIndex:null==l.payload.index?void 0:Number(l.payload.index),isTooltipActive:l.payload.active,activeIndex:null==l.payload.index?void 0:Number(l.payload.index),activeLabel:l.payload.label,activeDataKey:l.payload.dataKey,activeCoordinate:l.payload.coordinate});d=a[j]}else"value"===i&&(d=a.find(e=>String(e.value)===l.payload.label));var{coordinate:N}=l.payload;if(null==d||!1===l.payload.active||null==N||null==s)return void r(Cf({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));var{x:k,y:E}=N,C=Math.min(k,s.x+s.width),_=Math.min(E,s.y+s.height),S={x:"horizontal"===o?d.coordinate:C,y:"horizontal"===o?_:d.coordinate};r(Cf({active:l.payload.active,coordinate:S,dataKey:l.payload.dataKey,index:String(d.index),label:l.payload.label,sourceViewBox:l.payload.sourceViewBox,graphicalItemId:l.payload.graphicalItemId}))}}};return I6.on(I8,e),()=>{I6.off(I8,e)}},[l,r,n,t,i,a,o,s]),c=CD(OX),u=CD(OK),d=CA(),(0,em.useEffect)(()=>{if(null==c)return Ec;var e=(e,t,n)=>{u!==n&&c===e&&d(Cx(t))};return I6.on(I7,e),()=>{I6.off(I7,e)}},[d,u,c]),null};function Rl(e){if("number"==typeof e)return e;if("string"==typeof e){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var Rc=(0,em.forwardRef)((e,t)=>{var n,r,i=(0,em.useRef)(null),[a,o]=(0,em.useState)({containerWidth:Rl(null==(n=e.style)?void 0:n.width),containerHeight:Rl(null==(r=e.style)?void 0:r.height)}),s=(0,em.useCallback)((e,t)=>{o(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),l=(0,em.useCallback)(e=>{if("function"==typeof t&&t(e),null!=e&&"u">typeof ResizeObserver){var{width:n,height:r}=e.getBoundingClientRect();s(n,r);var a=new ResizeObserver(e=>{var{width:t,height:n}=e[0].contentRect;s(t,n)});a.observe(e),i.current=a}},[t,s]);return(0,em.useEffect)(()=>()=>{var e=i.current;null!=e&&e.disconnect()},[s]),em.createElement(em.Fragment,null,em.createElement(_O,{width:a.containerWidth,height:a.containerHeight}),em.createElement("div",Ro({ref:l},e)))}),Ru=(0,em.forwardRef)((e,t)=>{var{width:n,height:r}=e,[i,a]=(0,em.useState)({containerWidth:Rl(n),containerHeight:Rl(r)}),o=(0,em.useCallback)((e,t)=>{a(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),s=(0,em.useCallback)(e=>{if("function"==typeof t&&t(e),null!=e){var{width:n,height:r}=e.getBoundingClientRect();o(n,r)}},[t,o]);return em.createElement(em.Fragment,null,em.createElement(_O,{width:i.containerWidth,height:i.containerHeight}),em.createElement("div",Ro({ref:s},e)))}),Rd=(0,em.forwardRef)((e,t)=>{var{width:n,height:r}=e;return em.createElement(em.Fragment,null,em.createElement(_O,{width:n,height:r}),em.createElement("div",Ro({ref:t},e)))}),Rh=(0,em.forwardRef)((e,t)=>{var{width:n,height:r}=e;return k7(n)||k7(r)?em.createElement(Ru,Ro({},e,{ref:t})):em.createElement(Rd,Ro({},e,{ref:t}))}),Rf=(0,em.forwardRef)((e,t)=>{var{children:n,className:r,height:i,onClick:a,onContextMenu:o,onDoubleClick:s,onMouseDown:l,onMouseEnter:c,onMouseLeave:u,onMouseMove:d,onMouseUp:h,onTouchEnd:f,onTouchMove:p,onTouchStart:g,style:v,width:x,responsive:y,dispatchTouchEvents:b=!0}=e,w=(0,em.useRef)(null),j=CA(),[N,k]=(0,em.useState)(null),[E,C]=(0,em.useState)(null),_=function(){var e=CA(),[t,n]=(0,em.useState)(null),r=CD(C8);return(0,em.useEffect)(()=>{if(null!=t){var n=t.getBoundingClientRect().width/t.offsetWidth;CW(n)&&n!==r&&e(CE(n))}},[t,e,r]),n}(),S=_N(),T=(null==S?void 0:S.width)>0?S.width:x,A=(null==S?void 0:S.height)>0?S.height:i,O=(0,em.useCallback)(e=>{_(e),"function"==typeof t&&t(e),k(e),C(e),null!=e&&(w.current=e)},[_,t,k,C]),M=(0,em.useCallback)(e=>{j(Lu(e)),j(Il({handler:a,reactEvent:e}))},[j,a]),P=(0,em.useCallback)(e=>{j(Lh(e)),j(Il({handler:c,reactEvent:e}))},[j,c]),D=(0,em.useCallback)(e=>{j(Cc()),j(Il({handler:u,reactEvent:e}))},[j,u]),L=(0,em.useCallback)(e=>{j(Lh(e)),j(Il({handler:d,reactEvent:e}))},[j,d]),I=(0,em.useCallback)(()=>{j(Io())},[j]),R=(0,em.useCallback)(e=>{j(Ia(e.key))},[j]),B=(0,em.useCallback)(e=>{j(Il({handler:o,reactEvent:e}))},[j,o]),z=(0,em.useCallback)(e=>{j(Il({handler:s,reactEvent:e}))},[j,s]),F=(0,em.useCallback)(e=>{j(Il({handler:l,reactEvent:e}))},[j,l]),V=(0,em.useCallback)(e=>{j(Il({handler:h,reactEvent:e}))},[j,h]),U=(0,em.useCallback)(e=>{j(Il({handler:g,reactEvent:e}))},[j,g]),H=(0,em.useCallback)(e=>{b&&j(If(e)),j(Il({handler:p,reactEvent:e}))},[j,b,p]),W=(0,em.useCallback)(e=>{j(Il({handler:f,reactEvent:e}))},[j,f]);return em.createElement(Rr.Provider,{value:N},em.createElement(Ri.Provider,{value:E},em.createElement(!0===y?Rc:Rh,{width:null!=T?T:null==v?void 0:v.width,height:null!=A?A:null==v?void 0:v.height,className:(0,_u.clsx)("recharts-wrapper",r),style:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ra(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ra(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({position:"relative",cursor:"default",width:T,height:A},v),onClick:M,onContextMenu:B,onDoubleClick:z,onFocus:I,onKeyDown:R,onMouseDown:F,onMouseEnter:P,onMouseLeave:D,onMouseMove:L,onMouseUp:V,onTouchEnd:W,onTouchMove:H,onTouchStart:U,ref:O},em.createElement(Rs,null),n)))}),Rp=ke([_r],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),Rm=ke([Rp,C4,C6],(e,t,n)=>{if(e&&null!=t&&null!=n)return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),Rg=(0,em.createContext)(void 0),Rv=e=>{var{children:t}=e,[n]=(0,em.useState)("".concat(En("recharts"),"-clip")),r=CD(Rm);if(null==r)return null;var{x:i,y:a,width:o,height:s}=r;return em.createElement(Rg.Provider,{value:n},em.createElement("defs",null,em.createElement("clipPath",{id:n},em.createElement("rect",{x:i,y:a,height:s,width:o}))),t)},Rx=["width","height","responsive","children","className","style","compact","title","desc"],Ry=(0,em.forwardRef)((e,t)=>{var{width:n,height:r,responsive:i,children:a,className:o,style:s,compact:l,title:c,desc:u}=e,d=IW(function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Rx));return l?em.createElement(em.Fragment,null,em.createElement(_O,{width:n,height:r}),em.createElement(I4,{otherAttributes:d,title:c,desc:u},a)):em.createElement(Rf,{className:o,style:s,width:n,height:r,responsive:null!=i&&i,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},em.createElement(I4,{otherAttributes:d,title:c,desc:u,ref:t},em.createElement(Rv,null,a)))});function Rb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Rw(e,t){var n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rb(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rb(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},e);return Object.keys(t).reduce((e,n)=>(void 0===e[n]&&void 0!==t[n]&&(e[n]=t[n]),e),n)}function Rj(){return(Rj=Object.assign.bind()).apply(null,arguments)}var RN={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:{top:5,right:5,bottom:5,left:5},responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},Rk=(0,em.forwardRef)(function(e,t){var n,r=Rw(e.categoricalChartProps,RN),{chartName:i,defaultTooltipEventType:a,validateTooltipEventTypes:o,tooltipPayloadSearcher:s,categoricalChartProps:l}=e;return em.createElement(IM,{preloadedState:{options:{chartName:i,defaultTooltipEventType:a,validateTooltipEventTypes:o,tooltipPayloadSearcher:s,eventEmitter:void 0}},reduxStoreName:null!=(n=l.id)?n:i},em.createElement(IP,{chartData:l.data}),em.createElement(II,{layout:r.layout,margin:r.margin}),em.createElement(IR,{baseValue:r.baseValue,accessibilityLayer:r.accessibilityLayer,barCategoryGap:r.barCategoryGap,maxBarSize:r.maxBarSize,stackOffset:r.stackOffset,barGap:r.barGap,barSize:r.barSize,syncId:r.syncId,syncMethod:r.syncMethod,className:r.className,reverseStackOrder:r.reverseStackOrder}),em.createElement(Ry,Rj({},r,{ref:t})))}),RE=["axis"],RC=(0,em.forwardRef)((e,t)=>em.createElement(Rk,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:RE,tooltipPayloadSearcher:Eu,categoricalChartProps:e,ref:t})),R_=em;function RS(e){this._context=e}function RT(e){return new RS(e)}RS.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};let RA=Math.PI,RO=2*RA,RM=RO-1e-6;function RP(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}class RD{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?RP:function(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return RP;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e*=1,t*=1,n*=1,r*=1,(i*=1)<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,l=r-t,c=a-e,u=o-t,d=c*c+u*u;if(null===this._x1)this._append`M${this._x1=e},${this._y1=t}`;else if(d>1e-6)if(Math.abs(u*s-l*c)>1e-6&&i){let h=n-a,f=r-o,p=s*s+l*l,g=Math.sqrt(p),v=Math.sqrt(d),x=i*Math.tan((RA-Math.acos((p+d-(h*h+f*f))/(2*g*v)))/2),y=x/v,b=x/g;Math.abs(y-1)>1e-6&&this._append`L${e+y*c},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*h>c*f)},${this._x1=e+b*s},${this._y1=t+b*l}`}else this._append`L${this._x1=e},${this._y1=t}`}arc(e,t,n,r,i,a){if(e*=1,t*=1,n*=1,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),l=e+o,c=t+s,u=1^a,d=a?r-i:i-r;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>1e-6||Math.abs(this._y1-c)>1e-6)&&this._append`L${l},${c}`,n&&(d<0&&(d=d%RO+RO),d>RM?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=l},${this._y1=c}`:d>1e-6&&this._append`A${n},${n},0,${+(d>=RA)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n*=1}v${+r}h${-n}Z`}toString(){return this._}}function RL(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(null==n)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new RD(t)}function RI(e){return e[0]}function RR(e){return e[1]}function RB(e,t){var n=CB(!0),r=null,i=RT,a=null,o=RL(s);function s(s){var l,c,u,d=(s=CR(s)).length,h=!1;for(null==r&&(a=i(u=o())),l=0;l<=d;++l)!(l<d&&n(c=s[l],l,s))===h&&((h=!h)?a.lineStart():a.lineEnd()),h&&a.point(+e(c,l,s),+t(c,l,s));if(u)return a=null,u+""||null}return e="function"==typeof e?e:void 0===e?RI:CB(e),t="function"==typeof t?t:void 0===t?RR:CB(t),s.x=function(t){return arguments.length?(e="function"==typeof t?t:CB(+t),s):e},s.y=function(e){return arguments.length?(t="function"==typeof e?e:CB(+e),s):t},s.defined=function(e){return arguments.length?(n="function"==typeof e?e:CB(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,null!=r&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(null==e?r=a=null:a=i(r=e),s):r},s}function Rz(e,t,n){var r=null,i=CB(!0),a=null,o=RT,s=null,l=RL(c);function c(c){var u,d,h,f,p,g=(c=CR(c)).length,v=!1,x=Array(g),y=Array(g);for(null==a&&(s=o(p=l())),u=0;u<=g;++u){if(!(u<g&&i(f=c[u],u,c))===v)if(v=!v)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),h=u-1;h>=d;--h)s.point(x[h],y[h]);s.lineEnd(),s.areaEnd()}v&&(x[u]=+e(f,u,c),y[u]=+t(f,u,c),s.point(r?+r(f,u,c):x[u],n?+n(f,u,c):y[u]))}if(p)return s=null,p+""||null}function u(){return RB().defined(i).curve(o).context(a)}return e="function"==typeof e?e:void 0===e?RI:CB(+e),t="function"==typeof t?t:void 0===t?CB(0):CB(+t),n="function"==typeof n?n:void 0===n?RR:CB(+n),c.x=function(t){return arguments.length?(e="function"==typeof t?t:CB(+t),r=null,c):e},c.x0=function(t){return arguments.length?(e="function"==typeof t?t:CB(+t),c):e},c.x1=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:CB(+e),c):r},c.y=function(e){return arguments.length?(t="function"==typeof e?e:CB(+e),n=null,c):t},c.y0=function(e){return arguments.length?(t="function"==typeof e?e:CB(+e),c):t},c.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:CB(+e),c):n},c.lineX0=c.lineY0=function(){return u().x(e).y(t)},c.lineY1=function(){return u().x(e).y(n)},c.lineX1=function(){return u().x(r).y(t)},c.defined=function(e){return arguments.length?(i="function"==typeof e?e:CB(!!e),c):i},c.curve=function(e){return arguments.length?(o=e,null!=a&&(s=o(a)),c):o},c.context=function(e){return arguments.length?(null==e?a=s=null:s=o(a=e),c):a},c}function RF(){}function RV(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function RU(e){this._context=e}function RH(e){this._context=e}function RW(e){this._context=e}RD.prototype,RU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:RV(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:RV(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},RH.prototype={areaStart:RF,areaEnd:RF,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:RV(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},RW.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:RV(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};class RY{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}}function RG(e){this._context=e}RG.prototype={areaStart:RF,areaEnd:RF,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e*=1,t*=1,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function R$(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0);return((a<0?-1:1)+(o<0?-1:1))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs((a*i+o*r)/(r+i)))||0}function RX(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Rq(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function RK(e){this._context=e}function RZ(e){this._context=new RQ(e)}function RQ(e){this._context=e}function RJ(e){this._context=e}function R0(e){var t,n,r=e.length-1,i=Array(r),a=Array(r),o=Array(r);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<r-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[r-1]=2,a[r-1]=7,o[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=i[t]/a[t-1],a[t]-=n,o[t]-=n*o[t-1];for(i[r-1]=o[r-1]/a[r-1],t=r-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(t=0,a[r-1]=(e[r]+i[r-1])/2;t<r-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function R1(e,t){this._context=e,this._t=t}RK.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Rq(this,this._t0,RX(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(t*=1,(e*=1)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Rq(this,RX(this,n=R$(this,e,t)),n);break;default:Rq(this,this._t0,n=R$(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(RZ.prototype=Object.create(RK.prototype)).point=function(e,t){RK.prototype.point.call(this,t,e)},RQ.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}},RJ.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),2===n)this._context.lineTo(e[1],t[1]);else for(var r=R0(e),i=R0(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}},R1.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};var R2=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,R5=(e,t)=>{if(!e||"function"==typeof e||"boolean"==typeof e)return null;var n=e;if((0,em.isValidElement)(e)&&(n=e.props),"object"!=typeof n&&"function"!=typeof n)return null;var r={};return Object.keys(n).forEach(e=>{IF(e)&&(r[e]=t||(t=>n[e](n,t)))}),r};function R3(){return(R3=Object.assign.bind()).apply(null,arguments)}function R4(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function R6(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R4(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R4(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var R8={curveBasisClosed:function(e){return new RH(e)},curveBasisOpen:function(e){return new RW(e)},curveBasis:function(e){return new RU(e)},curveBumpX:function(e){return new RY(e,!0)},curveBumpY:function(e){return new RY(e,!1)},curveLinearClosed:function(e){return new RG(e)},curveLinear:RT,curveMonotoneX:function(e){return new RK(e)},curveMonotoneY:function(e){return new RZ(e)},curveNatural:function(e){return new RJ(e)},curveStep:function(e){return new R1(e,.5)},curveStepAfter:function(e){return new R1(e,1)},curveStepBefore:function(e){return new R1(e,0)}},R7=e=>CW(e.x)&&CW(e.y),R9=e=>null!=e.base&&R7(e.base)&&R7(e),Be=e=>e.x,Bt=e=>e.y,Bn=e=>{var{className:t,points:n,path:r,pathRef:i}=e,a=CD(_A);if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},s=n&&n.length?(e=>{var{type:t="linear",points:n=[],baseLine:r,layout:i,connectNulls:a=!1}=e,o=((e,t)=>{if("function"==typeof e)return e;var n="curve".concat(Es(e));return("curveMonotone"===n||"curveBump"===n)&&t?R8["".concat(n).concat("vertical"===t?"Y":"X")]:R8[n]||RT})(t,i),s=a?n.filter(R7):n;if(Array.isArray(r)){var l=n.map((e,t)=>R6(R6({},e),{},{base:r[t]}));return("vertical"===i?Rz().y(Bt).x1(Be).x0(e=>e.base.x):Rz().x(Be).y1(Bt).y0(e=>e.base.y)).defined(R9).curve(o)(a?l.filter(R9):l)}return("vertical"===i&&k9(r)?Rz().y(Bt).x1(Be).x0(r):k9(r)?Rz().x(Be).y1(Bt).y0(r):RB().x(Be).y(Bt)).defined(R7).curve(o)(s)})(o):r;return em.createElement("path",R3({},IW(e),R5(e),{className:(0,_u.clsx)("recharts-curve",t),d:null===s?void 0:s,ref:i}))},Br=["children","className"];function Bi(){return(Bi=Object.assign.bind()).apply(null,arguments)}var Ba=em.forwardRef((e,t)=>{var{children:n,className:r}=e,i=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Br),a=(0,_u.clsx)("recharts-layer",r);return em.createElement("g",Bi({className:a},IG(i),{ref:t}),n)}),Bo=e.i(4178);function Bs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var Bl=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bs(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bs(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},{cacheSize:2e3,enableCache:!0}),Bc=new class{constructor(e){!function(e,t,n){var r;(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"cache",new Map),this.maxSize=e}get(e){var t=this.cache.get(e);return void 0!==t&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;null!=n&&this.cache.delete(n)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}}(Bl.cacheSize),Bu={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},Bd="recharts_measurement_span",Bh=(e,t)=>{try{var n=document.getElementById(Bd);n||((n=document.createElement("span")).setAttribute("id",Bd),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,Bu,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch(e){return{width:0,height:0}}},Bf=function(e){var t,n,r,i,a,o,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e||Ib.isSsr)return{width:0,height:0};if(!Bl.enableCache)return Bh(e,s);var l=(t=s.fontSize||"",n=s.fontFamily||"",r=s.fontWeight||"",i=s.fontStyle||"",a=s.letterSpacing||"",o=s.textTransform||"","".concat(e,"|").concat(t,"|").concat(n,"|").concat(r,"|").concat(i,"|").concat(a,"|").concat(o)),c=Bc.get(l);if(c)return c;var u=Bh(e,s);return Bc.set(l,u),u},Bp=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Bm=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Bg=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,Bv=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Bx={cm:96/2.54,mm:96/25.4,pt:96/72,pc:16,in:96,Q:96/101.6,px:1},By=["cm","mm","pt","pc","in","Q","px"];class Bb{static parse(e){var t,[,n,r]=null!=(t=Bv.exec(e))?t:[];return null==n?Bb.NaN:new Bb(parseFloat(n),null!=r?r:"")}constructor(e,t){this.num=e,this.unit=t,this.num=e,this.unit=t,k8(e)&&(this.unit=""),""===t||Bg.test(t)||(this.num=NaN,this.unit=""),function(e){return By.includes(e)}(t)&&(this.num=function(e,t){return e*Bx[t]}(e,t),this.unit="px")}add(e){return this.unit!==e.unit?new Bb(NaN,""):new Bb(this.num+e.num,this.unit)}subtract(e){return this.unit!==e.unit?new Bb(NaN,""):new Bb(this.num-e.num,this.unit)}multiply(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new Bb(NaN,""):new Bb(this.num*e.num,this.unit||e.unit)}divide(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new Bb(NaN,""):new Bb(this.num/e.num,this.unit||e.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return k8(this.num)}}function Bw(e){if(null==e||e.includes("NaN"))return"NaN";for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,a]=null!=(n=Bp.exec(t))?n:[],o=Bb.parse(null!=r?r:""),s=Bb.parse(null!=a?a:""),l="*"===i?o.multiply(s):o.divide(s);if(l.isNaN())return"NaN";t=t.replace(Bp,l.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var c,[,u,d,h]=null!=(c=Bm.exec(t))?c:[],f=Bb.parse(null!=u?u:""),p=Bb.parse(null!=h?h:""),g="+"===d?f.add(p):f.subtract(p);if(g.isNaN())return"NaN";t=t.replace(Bm,g.toString())}return t}u="NaN",d=new Bb(NaN,""),(u="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(u,"string"))?s:s+"")in Bb?Object.defineProperty(Bb,u,{value:d,enumerable:!0,configurable:!0,writable:!0}):Bb[u]=d;var Bj=/\(([^()]*)\)/;function BN(e){var t=function(e){try{var t;return t=e.replace(/\s+/g,""),t=function(e){for(var t,n=e;null!=(t=Bj.exec(n));){var[,r]=t;n=n.replace(Bj,Bw(r))}return n}(t),t=Bw(t)}catch(e){return"NaN"}}(e.slice(5,-1));return"NaN"===t?"":t}var Bk=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],BE=["dx","dy","angle","className","breakAll"];function BC(){return(BC=Object.assign.bind()).apply(null,arguments)}function B_(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var BS=/[ \f\n\r\t\v\u2028\u2029]+/,BT=e=>{var{children:t,breakAll:n,style:r}=e;try{var i=[];null!=t&&(i=n?t.toString().split(""):t.toString().split(BS));var a=i.map(e=>({word:e,width:Bf(e,r).width})),o=n?0:Bf(" ",r).width;return{wordsWithComputedWidth:a,spaceWidth:o}}catch(e){return null}},BA=(e,t,n,r)=>e.reduce((e,i)=>{var{word:a,width:o}=i,s=e[e.length-1];return s&&null!=o&&(null==t||r||s.width+o+n<Number(t))?(s.words.push(a),s.width+=o+n):e.push({words:[a],width:o}),e},[]),BO=e=>e.reduce((e,t)=>e.width>t.width?e:t),BM=(e,t,n,r,i,a,o,s)=>{var l=BT({breakAll:n,style:r,children:e.slice(0,t)+"…"});if(!l)return[!1,[]];var c=BA(l.wordsWithComputedWidth,a,o,s);return[c.length>i||BO(c).width>Number(a),c]},BP=e=>[{words:null==e?[]:e.toString().split(BS),width:void 0}],BD="#808080",BL={angle:0,breakAll:!1,capHeight:"0.71em",fill:BD,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},BI=(0,em.forwardRef)((e,t)=>{var n,r=Rw(e,BL),{x:i,y:a,lineHeight:o,capHeight:s,fill:l,scaleToFit:c,textAnchor:u,verticalAnchor:d}=r,h=B_(r,Bk),f=(0,em.useMemo)(()=>(e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:o}=e;if((t||n)&&!Ib.isSsr){var s=BT({breakAll:a,children:r,style:i});if(!s)return BP(r);var{wordsWithComputedWidth:l,spaceWidth:c}=s;return((e,t,n,r,i)=>{var a,{maxLines:o,children:s,style:l,breakAll:c}=e,u=k9(o),d=String(s),h=BA(t,r,n,i);if(!u||i||!(h.length>o||BO(h).width>Number(r)))return h;for(var f=0,p=d.length-1,g=0;f<=p&&g<=d.length-1;){var v=Math.floor((f+p)/2),[x,y]=BM(d,v-1,c,l,o,r,n,i),[b]=BM(d,v,c,l,o,r,n,i);if(x||b||(f=v+1),x&&b&&(p=v-1),!x&&b){a=y;break}g++}return a||h})({breakAll:a,children:r,maxLines:o,style:i},l,c,t,!!n)}return BP(r)})({breakAll:h.breakAll,children:h.children,maxLines:h.maxLines,scaleToFit:c,style:h.style,width:h.width}),[h.breakAll,h.children,h.maxLines,c,h.style,h.width]),{dx:p,dy:g,angle:v,className:x,breakAll:y}=h,b=B_(h,BE);if(!Ee(i)||!Ee(a)||0===f.length)return null;var w=Number(i)+(k9(p)?p:0),j=Number(a)+(k9(g)?g:0);if(!CW(w)||!CW(j))return null;switch(d){case"start":n=BN("calc(".concat(s,")"));break;case"middle":n=BN("calc(".concat((f.length-1)/2," * -").concat(o," + (").concat(s," / 2))"));break;default:n=BN("calc(".concat(f.length-1," * -").concat(o,")"))}var N=[];if(c){var k=f[0].width,{width:E}=h;N.push("scale(".concat(k9(E)&&k9(k)?E/k:1,")"))}return v&&N.push("rotate(".concat(v,", ").concat(w,", ").concat(j,")")),N.length&&(b.transform=N.join(" ")),em.createElement("text",BC({},IG(b),{ref:t,x:w,y:j,className:(0,_u.clsx)("recharts-text",x),textAnchor:u,fill:l.includes("url")?BD:l}),f.map((e,t)=>{var r=e.words.join(y?"":" ");return em.createElement("tspan",{x:w,dy:0===t?n:o,key:"".concat(r,"-").concat(t)},r)}))});function BR(e){var{zIndex:t,children:n}=e,r=void 0!==CD(_A)&&void 0!==t&&0!==t,i=_s(),a=CA();(0,em.useLayoutEffect)(()=>r?(a(IC({zIndex:t})),()=>{a(I_({zIndex:t}))}):Ec,[a,t,r]);var o=CD(e=>IK(e,t,i));return r?o?(0,e1.createPortal)(n,o):null:n}BI.displayName="Text";var BB=["labelRef"],Bz=["content"];function BF(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function BV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function BU(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?BV(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):BV(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function BH(){return(BH=Object.assign.bind()).apply(null,arguments)}var BW=(0,em.createContext)(null),BY=e=>{var{x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o,children:s}=e,l=(0,em.useMemo)(()=>({x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o}),[t,n,r,i,a,o]);return em.createElement(BW.Provider,{value:l},s)},BG=()=>{var e=(0,em.useContext)(BW),t=__();return e||_C(t)},B$=(0,em.createContext)(null),BX=e=>null!=e&&"function"==typeof e,Bq=e=>"cx"in e&&k9(e.cx),BK={angle:0,offset:5,zIndex:O1.label,position:"middle",textBreakAll:!1};function BZ(e){var t,n,r,i,a,o,s=Rw(e,BK),{viewBox:l,position:c,value:u,children:d,content:h,className:f="",textBreakAll:p,labelRef:g}=s,v=(t=(0,em.useContext)(B$),n=CD(Ms),t||n),x=BG();if(!(i=null==l?"center"===c?x:null!=v?v:x:Bq(l)?l:_C(l))||null==u&&null==d&&!(0,em.isValidElement)(h)&&"function"!=typeof h)return null;var y=BU(BU({},s),{},{viewBox:i});if((0,em.isValidElement)(h)){var{labelRef:b}=y,w=BF(y,BB);return(0,em.cloneElement)(h,w)}if("function"==typeof h){var{content:j}=y,N=BF(y,Bz);if(a=(0,em.createElement)(h,N),(0,em.isValidElement)(a))return a}else a=(e=>{var{value:t,formatter:n}=e,r=null==e.children?t:e.children;return"function"==typeof n?n(r):r})(s);var k=IG(s);if(Bq(i)){if("insideStart"===c||"insideEnd"===c||"end"===c)return((e,t,n,r,i)=>{var a,o,{offset:s,className:l}=e,{cx:c,cy:u,innerRadius:d,outerRadius:h,startAngle:f,endAngle:p,clockWise:g}=i,v=(d+h)/2,x=k6(p-f)*Math.min(Math.abs(p-f),360),y=x>=0?1:-1;switch(t){case"insideStart":a=f+y*s,o=g;break;case"insideEnd":a=p-y*s,o=!g;break;case"end":a=p+y*s,o=g;break;default:throw Error("Unsupported position ".concat(t))}o=x<=0?o:!o;var b=O0(c,u,v,a),w=O0(c,u,v,a+(o?1:-1)*359),j="M".concat(b.x,",").concat(b.y,"\n A").concat(v,",").concat(v,",0,1,").concat(+!o,",\n ").concat(w.x,",").concat(w.y),N=null==e.id?En("recharts-radial-line-"):e.id;return em.createElement("text",BH({},r,{dominantBaseline:"central",className:(0,_u.clsx)("recharts-radial-bar-label",l)}),em.createElement("defs",null,em.createElement("path",{id:N,d:j})),em.createElement("textPath",{xlinkHref:"#".concat(N)},n))})(s,c,a,k,i);o=((e,t,n)=>{var{cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:s,endAngle:l}=e,c=(s+l)/2;if("outside"===n){var{x:u,y:d}=O0(r,i,o+t,c);return{x:u,y:d,textAnchor:u>=r?"start":"end",verticalAnchor:"middle"}}if("center"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if("centerTop"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if("centerBottom"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var{x:h,y:f}=O0(r,i,(a+o)/2,c);return{x:h,y:f,textAnchor:"middle",verticalAnchor:"middle"}})(i,s.offset,s.position)}else o=((e,t)=>{var n,{parentViewBox:r,offset:i,position:a}=e;null==r||Bq(r)||(n=r);var{x:o,y:s,upperWidth:l,lowerWidth:c,height:u}=t,d=o+(l-c)/2,h=(o+d)/2,f=(l+c)/2,p=u>=0?1:-1,g=p*i,v=p>0?"end":"start",x=p>0?"start":"end",y=l>=0?1:-1,b=y*i,w=y>0?"end":"start",j=y>0?"start":"end";if("top"===a)return BU(BU({},{x:o+l/2,y:s-g,textAnchor:"middle",verticalAnchor:v}),n?{height:Math.max(s-n.y,0),width:l}:{});if("bottom"===a)return BU(BU({},{x:d+c/2,y:s+u+g,textAnchor:"middle",verticalAnchor:x}),n?{height:Math.max(n.y+n.height-(s+u),0),width:c}:{});if("left"===a){var N={x:h-b,y:s+u/2,textAnchor:w,verticalAnchor:"middle"};return BU(BU({},N),n?{width:Math.max(N.x-n.x,0),height:u}:{})}if("right"===a){var k={x:h+f+b,y:s+u/2,textAnchor:j,verticalAnchor:"middle"};return BU(BU({},k),n?{width:Math.max(n.x+n.width-k.x,0),height:u}:{})}var E=n?{width:f,height:u}:{};return"insideLeft"===a?BU({x:h+b,y:s+u/2,textAnchor:j,verticalAnchor:"middle"},E):"insideRight"===a?BU({x:h+f-b,y:s+u/2,textAnchor:w,verticalAnchor:"middle"},E):"insideTop"===a?BU({x:o+l/2,y:s+g,textAnchor:"middle",verticalAnchor:x},E):"insideBottom"===a?BU({x:d+c/2,y:s+u-g,textAnchor:"middle",verticalAnchor:v},E):"insideTopLeft"===a?BU({x:o+b,y:s+g,textAnchor:j,verticalAnchor:x},E):"insideTopRight"===a?BU({x:o+l-b,y:s+g,textAnchor:w,verticalAnchor:x},E):"insideBottomLeft"===a?BU({x:d+b,y:s+u-g,textAnchor:j,verticalAnchor:v},E):"insideBottomRight"===a?BU({x:d+c-b,y:s+u-g,textAnchor:w,verticalAnchor:v},E):a&&"object"==typeof a&&(k9(a.x)||k7(a.x))&&(k9(a.y)||k7(a.y))?BU({x:o+Er(a.x,f),y:s+Er(a.y,u),textAnchor:"end",verticalAnchor:"end"},E):BU({x:o+l/2,y:s+u/2,textAnchor:"middle",verticalAnchor:"middle"},E)})(s,i);return em.createElement(BR,{zIndex:s.zIndex},em.createElement(BI,BH({ref:g,className:(0,_u.clsx)("recharts-label",f)},k,o,{textAnchor:"start"===(r=k.textAnchor)||"middle"===r||"end"===r||"inherit"===r?k.textAnchor:o.textAnchor,breakAll:p}),a))}function BQ(e){var{label:t,labelRef:n}=e;return((e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return!0===e?em.createElement(BZ,BH({key:"label-implicit"},r)):Ee(e)?em.createElement(BZ,BH({key:"label-implicit",value:e},r)):(0,em.isValidElement)(e)?e.type===BZ?(0,em.cloneElement)(e,BU({key:"label-implicit"},r)):em.createElement(BZ,BH({key:"label-implicit",content:e},r)):BX(e)?em.createElement(BZ,BH({key:"label-implicit",content:e},r)):e&&"object"==typeof e?em.createElement(BZ,BH({},e,{key:"label-implicit"},r)):null})(t,BG(),n)||null}BZ.displayName="Label";var BJ=["valueAccessor"],B0=["dataKey","clockWise","id","textBreakAll","zIndex"];function B1(){return(B1=Object.assign.bind()).apply(null,arguments)}function B2(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var B5=e=>Array.isArray(e.value)?(0,Bo.default)(e.value):e.value,B3=(0,em.createContext)(void 0),B4=B3.Provider,B6=(0,em.createContext)(void 0);function B8(e){var{valueAccessor:t=B5}=e,n=B2(e,BJ),{dataKey:r,clockWise:i,id:a,textBreakAll:o,zIndex:s}=n,l=B2(n,B0),c=(0,em.useContext)(B3),u=(0,em.useContext)(B6),d=c||u;return d&&d.length?em.createElement(BR,{zIndex:null!=s?s:O1.label},em.createElement(Ba,{className:"recharts-label-list"},d.map((e,i)=>{var s,c=null==r?t(e,i):CX(e&&e.payload,r),u=null==a?{}:{id:"".concat(a,"-").concat(i)};return em.createElement(BZ,B1({key:"label-".concat(i)},IG(e),l,u,{fill:null!=(s=n.fill)?s:e.fill,parentViewBox:e.parentViewBox,value:c,textBreakAll:o,viewBox:e.viewBox,index:i,zIndex:0}))}))):null}function B7(e){var{label:t}=e;return t?!0===t?em.createElement(B8,{key:"labelList-implicit"}):em.isValidElement(t)||BX(t)?em.createElement(B8,{key:"labelList-implicit",content:t}):"object"==typeof t?em.createElement(B8,B1({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function B9(){return(B9=Object.assign.bind()).apply(null,arguments)}B6.Provider,B8.displayName="LabelList";var ze=e=>{var{cx:t,cy:n,r,className:i}=e,a=(0,_u.clsx)("recharts-dot",i);return k9(t)&&k9(n)&&k9(r)?em.createElement("circle",B9({},IW(e),R5(e),{className:a,cx:t,cy:n,r:r})):null},zt=(e.i(79684),e=>!e||"object"!=typeof e||!("clipDot"in e)||!!e.clipDot),zn=["points"];function zr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zr(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function za(){return(za=Object.assign.bind()).apply(null,arguments)}function zo(e){var{option:t,dotProps:n,className:r}=e;if((0,em.isValidElement)(t))return(0,em.cloneElement)(t,n);if("function"==typeof t)return t(n);var i=(0,_u.clsx)(r,"boolean"!=typeof t?t.className:""),a=null!=n?n:{},{points:o}=a,s=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(a,zn);return em.createElement(ze,za({},s,{className:i}))}function zs(e){var{points:t,dot:n,className:r,dotClassName:i,dataKey:a,baseProps:o,needClip:s,clipPathId:l,zIndex:c=O1.scatter}=e;if(null==t||!n&&1!==t.length)return null;var u=zt(n),d=null==n?null:(0,em.isValidElement)(n)?IG(n.props):"object"!=typeof n||Array.isArray(n)?null:IG(n),h=t.map((e,r)=>{var s,l,c=zi(zi(zi({r:3},o),d),{},{index:r,cx:null!=(s=e.x)?s:void 0,cy:null!=(l=e.y)?l:void 0,dataKey:a,value:e.value,payload:e.payload,points:t});return em.createElement(zo,{key:"dot-".concat(r),option:n,dotProps:c,className:i})}),f={};return s&&null!=l&&(f.clipPath="url(#clipPath-".concat(u?"":"dots-").concat(l,")")),em.createElement(BR,{zIndex:c},em.createElement(Ba,za({className:r},f),h))}function zl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zl(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var zu=e=>{var t,{point:n,childIndex:r,mainColor:i,activeDot:a,dataKey:o,clipPath:s}=e;if(!1===a||null==n.x||null==n.y)return null;var l=zc(zc(zc({},{index:r,dataKey:o,cx:n.x,cy:n.y,r:4,fill:null!=i?i:"none",strokeWidth:2,stroke:"#fff",payload:n.payload,value:n.value}),IY(a)),R5(a));return t=(0,em.isValidElement)(a)?(0,em.cloneElement)(a,l):"function"==typeof a?a(l):em.createElement(ze,l),em.createElement(Ba,{className:"recharts-active-dot",clipPath:s},t)};function zd(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:a,zIndex:o=O1.activeDot}=e,s=CD(DX),l=CD(D2);if(null==t||null==l)return null;var c=t.find(e=>l.includes(e.payload));return null==c?null:em.createElement(BR,{zIndex:o},em.createElement(zu,{point:c,childIndex:Number(s),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}function zh(e){var{tooltipEntrySettings:t}=e,n=CA(),r=_s(),i=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{r||(null===i.current?n(Cr(t)):i.current!==t&&n(Ci({prev:i.current,next:t})),i.current=t)},[t,n,r]),(0,em.useLayoutEffect)(()=>()=>{i.current&&(n(Ca(i.current)),i.current=null)},[n]),null}function zf(e,t){var n,r,i=CD(t=>Mj(t,e)),a=CD(e=>ME(e,t)),o=null!=(n=null==i?void 0:i.allowDataOverflow)?n:Mb.allowDataOverflow,s=null!=(r=null==a?void 0:a.allowDataOverflow)?r:MN.allowDataOverflow;return{needClip:o||s,needClipX:o,needClipY:s}}function zp(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=CD(Rm),{needClipX:a,needClipY:o,needClip:s}=zf(t,n);if(!s||!i)return null;var{x:l,y:c,width:u,height:d}=i;return em.createElement("clipPath",{id:"clipPath-".concat(r)},em.createElement("rect",{x:a?l:l-u/2,y:o?c:c-d/2,width:a?u:2*u,height:o?d:2*d}))}function zm(e,t){var n,r;return null!=(n=null==(r=e.graphicalItems.cartesianItems.find(e=>e.id===t))?void 0:r.xAxisId)?n:0}function zg(e,t){var n,r;return null!=(n=null==(r=e.graphicalItems.cartesianItems.find(e=>e.id===t))?void 0:r.yAxisId)?n:0}var zv=(e,t,n)=>P1(e,"xAxis",zm(e,t),n),zx=(e,t,n)=>P0(e,"xAxis",zm(e,t),n),zy=(e,t,n)=>P1(e,"yAxis",zg(e,t),n),zb=(e,t,n)=>P0(e,"yAxis",zg(e,t),n),zw=ke([_A,zv,zy,zx,zb],(e,t,n,r,i)=>Cq(e,"xAxis")?C2(t,r,!1):C2(n,i,!1)),zj=ke([MM,(e,t)=>t],(e,t)=>e.filter(e=>"area"===e.type).find(e=>e.id===t)),zN=e=>Cq(_A(e),"xAxis")?"yAxis":"xAxis",zk=ke([zj,(e,t,n)=>MJ(e,zN(e),"yAxis"===zN(e)?zg(e,t):zm(e,t),n)],(e,t)=>{if(null!=e&&null!=t){var n,{stackId:r}=e,i=Mu(e);if(null!=r&&null!=i){var a=null==(n=t[r])?void 0:n.stackedData,o=null==a?void 0:a.find(e=>e.key===i);if(null!=o)return o.map(e=>[e[0],e[1]])}}}),zE=ke([_A,zv,zy,zx,zb,zk,(e,t,n)=>n?OE(e):Ok(e),zw,zj,e=>e.rootProps.baseValue],(e,t,n,r,i,a,o,s,l,c)=>{var u,{chartData:d,dataStartIndex:h,dataEndIndex:f}=o;if(null!=l&&("horizontal"===e||"vertical"===e)&&null!=t&&null!=n&&null!=r&&null!=i&&0!==r.length&&0!==i.length&&null!=s){var{data:p}=l;if(null!=(u=p&&p.length>0?p:null==d?void 0:d.slice(h,f+1)))return function(e){var t,{areaSettings:{connectNulls:n,baseValue:r,dataKey:i},stackedData:a,layout:o,chartBaseValue:s,xAxis:l,yAxis:c,displayedData:u,dataStartIndex:d,xAxisTicks:h,yAxisTicks:f,bandSize:p}=e,g=a&&a.length,v=((e,t,n,r,i)=>{var a=null!=n?n:t;if(k9(a))return a;var o="horizontal"===e?i:r,s=o.scale.domain();if("number"===o.type){var l=Math.max(s[0],s[1]),c=Math.min(s[0],s[1]);return"dataMin"===a?c:"dataMax"===a||l<0?l:Math.max(Math.min(s[0],s[1]),0)}return"dataMin"===a?s[0]:"dataMax"===a?s[1]:s[0]})(o,s,r,l,c),x="horizontal"===o,y=!1,b=u.map((e,t)=>{if(g)s=a[d+t];else{var r,o,s,u=CX(e,i);Array.isArray(u)?(s=u,y=!0):s=[v,u]}var b=null!=(r=null==(o=s)?void 0:o[1])?r:null,w=null==b||g&&!n&&null==CX(e,i);return x?{x:CJ({axis:l,ticks:h,bandSize:p,entry:e,index:t}),y:w?null:c.scale(b),value:s,payload:e}:{x:w?null:l.scale(b),y:CJ({axis:c,ticks:f,bandSize:p,entry:e,index:t}),value:s,payload:e}});return t=g||y?b.map(e=>{var t=Array.isArray(e.value)?e.value[0]:null;return x?{x:e.x,y:null!=t&&null!=e.y?c.scale(t):null,payload:e.payload}:{x:null!=t?l.scale(t):null,y:e.y,payload:e.payload}}):x?c.scale(v):l.scale(v),{points:b,baseLine:t,isRange:y}}({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:h,areaSettings:l,stackedData:a,displayedData:u,chartBaseValue:c,bandSize:s})}});function zC(e){var{legendPayload:t}=e,n=CA(),r=_s(),i=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{r||(null===i.current?n(LQ(t)):i.current!==t&&n(LJ({prev:i.current,next:t})),i.current=t)},[n,r,t]),(0,em.useLayoutEffect)(()=>()=>{i.current&&(n(L0(i.current)),i.current=null)},[n]),null}function z_(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"animation-",n=(0,em.useRef)(En(t)),r=(0,em.useRef)(e);return r.current!==e&&(n.current=En(t),r.current=e),n.current}var zS=null!=(Y=em["useId".toString()])?Y:()=>{var[e]=em.useState(()=>En("uid-"));return e},zT=(0,em.createContext)(void 0),zA=e=>{var t,n,{id:r,type:i,children:a}=e,o=(t="recharts-".concat(i),n=zS(),r||(t?"".concat(t,"-").concat(n):n));return em.createElement(zT.Provider,{value:o},a(o))},zO=(0,em.memo)(e=>{var t=CA(),n=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{null===n.current?t(LO(e)):n.current!==e&&t(LM({prev:n.current,next:e})),n.current=e},[t,e]),(0,em.useLayoutEffect)(()=>()=>{n.current&&(t(LP(n.current)),n.current=null)},[t]),null});function zM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zP(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zM(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zM(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var zD=(e,t,n)=>e.map(e=>"".concat(e.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase()))," ").concat(t,"ms ").concat(n)).join(","),zL=(e,t)=>Object.keys(t).reduce((n,r)=>zP(zP({},n),{},{[r]:e(r,t[r])}),{});function zI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zR(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zI(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zI(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var zB=(e,t,n)=>e+(t-e)*n,zz=e=>{var{from:t,to:n}=e;return t!==n},zF=(e,t,n)=>{var r=zL((t,n)=>{if(zz(n)){var[r,i]=e(n.from,n.to,n.velocity);return zR(zR({},n),{},{from:r,velocity:i})}return n},t);return n<1?zL((e,t)=>zz(t)&&null!=r[e]?zR(zR({},t),{},{velocity:zB(t.velocity,r[e].velocity,n),from:zB(t.from,r[e].from,n)}):t,t):zF(e,r,n-1)},zV=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],zU=(e,t)=>e.map((e,n)=>e*t**n).reduce((e,t)=>e+t),zH=(e,t)=>n=>zU(zV(e,t),n),zW=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(1===t.length)switch(t[0]){case"linear":return[0,0,1,1];case"ease":return[.25,.1,.25,1];case"ease-in":return[.42,0,1,1];case"ease-out":return[.42,0,.58,1];case"ease-in-out":return[0,0,.58,1];default:var r=(e=>{var t,n=e.split("(");if(2!==n.length||"cubic-bezier"!==n[0])return null;var r=null==(t=n[1])||null==(t=t.split(")")[0])?void 0:t.split(",");if(null==r||4!==r.length)return null;var i=r.map(e=>parseFloat(e));return[i[0],i[1],i[2],i[3]]})(t[0]);if(r)return r}return 4===t.length?t:[0,0,1,1]},zY=function(){return((e,t,n,r)=>{var i=zH(e,n),a=zH(t,r),o=t=>zU([...zV(e,n).map((e,t)=>e*t).slice(1),0],t),s=e=>e>1?1:e<0?0:e,l=e=>{for(var t=e>1?1:e,n=t,r=0;r<8;++r){var l=i(n)-t,c=o(n);if(1e-4>Math.abs(l-t)||c<1e-4)break;n=s(n-l/c)}return a(n)};return l.isStepper=!1,l})(...zW(...arguments))},zG=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{stiff:t=100,damping:n=8,dt:r=17}=e,i=(e,i,a)=>{var o=a+(-(e-i)*t-a*n)*r/1e3,s=a*r/1e3+e;return 1e-4>Math.abs(s-i)&&1e-4>Math.abs(o)?[i,0]:[s,o]};return i.isStepper=!0,i.dt=r,i};class z${setTimeout(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=performance.now(),r=null,i=a=>{a-n>=t?e(a):"function"==typeof requestAnimationFrame&&(r=requestAnimationFrame(i))};return r=requestAnimationFrame(i),()=>{null!=r&&cancelAnimationFrame(r)}}}var zX=(0,em.createContext)(function(){var e,t,n,r,i;return e=new z$,t=()=>null,n=!1,r=null,i=a=>{if(!n){if(Array.isArray(a)){if(!a.length)return;var[o,...s]=a;if("number"==typeof o){r=e.setTimeout(i.bind(null,s),o);return}i(o),r=e.setTimeout(i.bind(null,s));return}"string"==typeof a&&t(a),"object"==typeof a&&t(a),"function"==typeof a&&a()}},{stop:()=>{n=!0},start:e=>{n=!1,r&&(r(),r=null),i(e)},subscribe:e=>(t=e,()=>{t=()=>null}),getTimeoutController:()=>e}}),zq={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},zK={t:0},zZ={t:1};function zQ(e){var t,n,r,i=Rw(e,zq),{isActive:a,canBegin:o,duration:s,easing:l,begin:c,onAnimationEnd:u,onAnimationStart:d,children:h}=i,f="auto"===a?!Ib.isSsr:a,p=(t=i.animationId,n=i.animationManager,r=(0,em.useContext)(zX),(0,em.useMemo)(()=>null!=n?n:r(t),[t,n,r])),[g,v]=(0,em.useState)(f?zK:zZ),x=(0,em.useRef)(null);return(0,em.useEffect)(()=>{f||v(zZ)},[f]),(0,em.useEffect)(()=>{if(!f||!o)return Ec;var e=((e,t,n,r,i,a)=>{var o,s,l,c,u,d,h,f,p=[Object.keys(e),Object.keys(t)].reduce((e,t)=>e.filter(e=>t.includes(e)));return null==n?()=>(i(zR(zR({},e),t)),()=>{}):!0===n.isStepper?(s=p.reduce((n,r)=>zR(zR({},n),{},{[r]:{from:e[r],velocity:0,to:t[r]}}),{}),l=null,c=r=>{o||(o=r);var u=(r-o)/n.dt;s=zF(n,s,u),i(zR(zR(zR({},e),t),zL((e,t)=>t.from,s))),o=r,Object.values(s).filter(zz).length&&(l=a.setTimeout(c))},()=>(l=a.setTimeout(c),()=>{var e;null==(e=l)||e()})):(d=null,h=p.reduce((n,r)=>{var i=e[r],a=t[r];return null==i||null==a?n:zR(zR({},n),{},{[r]:[i,a]})},{}),f=o=>{u||(u=o);var s=(o-u)/r,l=zL((e,t)=>zB(...t,n(s)),h);if(i(zR(zR(zR({},e),t),l)),s<1)d=a.setTimeout(f);else{var c=zL((e,t)=>zB(...t,n(1)),h);i(zR(zR(zR({},e),t),c))}},()=>(d=a.setTimeout(f),()=>{var e;null==(e=d)||e()}))})(zK,zZ,(e=>{if("string"==typeof e)switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return zY(e);case"spring":return zG();default:if("cubic-bezier"===e.split("(")[0])return zY(e)}return"function"==typeof e?e:null})(l),s,v,p.getTimeoutController());return p.start([d,c,()=>{x.current=e()},s,u]),()=>{p.stop(),x.current&&x.current(),u()}},[f,o,s,l,c,d,u,p]),h(g.t)}function zJ(e){var t=IY(e);if(null!=t){var{r:n,strokeWidth:r}=t,i=Number(n),a=Number(r);return(Number.isNaN(i)||i<0)&&(i=3),(Number.isNaN(a)||a<0)&&(a=2),{r:i,strokeWidth:a}}return{r:3,strokeWidth:2}}var z0=["id"],z1=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function z2(){return(z2=Object.assign.bind()).apply(null,arguments)}function z5(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function z3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function z4(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?z3(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z3(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function z6(e,t){return e&&"none"!==e?e:t}var z8=R_.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:l,tooltipType:c,id:u}=e,d={dataDefinedOnItem:n,positions:void 0,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:C3(o,t),hide:s,type:c,color:z6(r,a),unit:l,graphicalItemId:u}};return R_.createElement(zh,{tooltipEntrySettings:d})});function z7(e){var{clipPathId:t,points:n,props:r}=e,{needClip:i,dot:a,dataKey:o}=r,s=IW(r);return R_.createElement(zs,{points:n,dot:a,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:s,needClip:i,clipPathId:t})}function z9(e){var{showLabels:t,children:n,points:r}=e,i=r.map(e=>{var t,n,r={x:null!=(t=e.x)?t:0,y:null!=(n=e.y)?n:0,width:0,lowerWidth:0,upperWidth:0,height:0};return z4(z4({},r),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:r,fill:void 0})});return R_.createElement(B4,{value:t?i:void 0},n)}function Fe(e){var{points:t,baseLine:n,needClip:r,clipPathId:i,props:a}=e,{layout:o,type:s,stroke:l,connectNulls:c,isRange:u}=a,{id:d}=a,h=z5(a,z0),f=IW(h),p=IG(h);return R_.createElement(R_.Fragment,null,(null==t?void 0:t.length)>1&&R_.createElement(Ba,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},R_.createElement(Bn,z2({},p,{id:d,points:t,connectNulls:c,type:s,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),"none"!==l&&R_.createElement(Bn,z2({},f,{className:"recharts-area-curve",layout:o,type:s,connectNulls:c,fill:"none",points:t})),"none"!==l&&u&&R_.createElement(Bn,z2({},f,{className:"recharts-area-curve",layout:o,type:s,connectNulls:c,fill:"none",points:n}))),R_.createElement(z7,{points:t,props:h,clipPathId:i}))}function Ft(e){var t,n,{alpha:r,baseLine:i,points:a,strokeWidth:o}=e,s=null==(t=a[0])?void 0:t.y,l=null==(n=a[a.length-1])?void 0:n.y;if(!CW(s)||!CW(l))return null;var c=r*Math.abs(s-l),u=Math.max(...a.map(e=>e.x||0));return(k9(i)?u=Math.max(i,u):i&&Array.isArray(i)&&i.length&&(u=Math.max(...i.map(e=>e.x||0),u)),k9(u))?R_.createElement("rect",{x:0,y:s<l?s:s-c,width:u+(o?parseInt("".concat(o),10):1),height:Math.floor(c)}):null}function Fn(e){var t,n,{alpha:r,baseLine:i,points:a,strokeWidth:o}=e,s=null==(t=a[0])?void 0:t.x,l=null==(n=a[a.length-1])?void 0:n.x;if(!CW(s)||!CW(l))return null;var c=r*Math.abs(s-l),u=Math.max(...a.map(e=>e.y||0));return(k9(i)?u=Math.max(i,u):i&&Array.isArray(i)&&i.length&&(u=Math.max(...i.map(e=>e.y||0),u)),k9(u))?R_.createElement("rect",{x:s<l?s:s-c,y:0,width:c,height:Math.floor(u+(o?parseInt("".concat(o),10):1))}):null}function Fr(e){var{alpha:t,layout:n,points:r,baseLine:i,strokeWidth:a}=e;return"vertical"===n?R_.createElement(Ft,{alpha:t,points:r,baseLine:i,strokeWidth:a}):R_.createElement(Fn,{alpha:t,points:r,baseLine:i,strokeWidth:a})}function Fi(e){var{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a}=e,{points:o,baseLine:s,isAnimationActive:l,animationBegin:c,animationDuration:u,animationEasing:d,onAnimationStart:h,onAnimationEnd:f}=r,p=z_((0,R_.useMemo)(()=>({points:o,baseLine:s}),[o,s]),"recharts-area-"),g=(()=>{var e=CD(_A);if("horizontal"===e||"vertical"===e)return e})(),[v,x]=(0,R_.useState)(!1),y=(0,R_.useCallback)(()=>{"function"==typeof f&&f(),x(!1)},[f]),b=(0,R_.useCallback)(()=>{"function"==typeof h&&h(),x(!0)},[h]);if(null==g)return null;var w=i.current,j=a.current;return R_.createElement(z9,{showLabels:!v,points:o},r.children,R_.createElement(zQ,{animationId:p,begin:c,duration:u,isActive:l,easing:d,onAnimationEnd:y,onAnimationStart:b,key:p},e=>{if(w){var c,u=w.length/o.length,d=1===e?o:o.map((t,n)=>{var r=Math.floor(n*u);if(w[r]){var i=w[r];return z4(z4({},t),{},{x:Ea(i.x,t.x,e),y:Ea(i.y,t.y,e)})}return t});if(k9(s))c=Ea(j,s,e);else c=null==s||k8(s)?Ea(j,0,e):s.map((t,n)=>{var r=Math.floor(n*u);if(Array.isArray(j)&&j[r]){var i=j[r];return z4(z4({},t),{},{x:Ea(i.x,t.x,e),y:Ea(i.y,t.y,e)})}return t});return e>0&&(i.current=d,a.current=c),R_.createElement(Fe,{points:d,baseLine:c,needClip:t,clipPathId:n,props:r})}return e>0&&(i.current=o,a.current=s),R_.createElement(Ba,null,l&&R_.createElement("defs",null,R_.createElement("clipPath",{id:"animationClipPath-".concat(n)},R_.createElement(Fr,{alpha:e,points:o,baseLine:s,layout:g,strokeWidth:r.strokeWidth}))),R_.createElement(Ba,{clipPath:"url(#animationClipPath-".concat(n,")")},R_.createElement(Fe,{points:o,baseLine:s,needClip:t,clipPathId:n,props:r})))}),R_.createElement(B7,{label:r.label}))}function Fa(e){var{needClip:t,clipPathId:n,props:r}=e,i=(0,R_.useRef)(null),a=(0,R_.useRef)();return R_.createElement(Fi,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}class Fo extends R_.PureComponent{render(){var{hide:e,dot:t,points:n,className:r,top:i,left:a,needClip:o,xAxisId:s,yAxisId:l,width:c,height:u,id:d,baseLine:h,zIndex:f}=this.props;if(e)return null;var p=(0,_u.clsx)("recharts-area",r),{r:g,strokeWidth:v}=zJ(t),x=zt(t),y=2*g+v,b=o?"url(#clipPath-".concat(x?"":"dots-").concat(d,")"):void 0;return R_.createElement(BR,{zIndex:f},R_.createElement(Ba,{className:p},o&&R_.createElement("defs",null,R_.createElement(zp,{clipPathId:d,xAxisId:s,yAxisId:l}),!x&&R_.createElement("clipPath",{id:"clipPath-dots-".concat(d)},R_.createElement("rect",{x:a-y/2,y:i-y/2,width:c+y,height:u+y}))),R_.createElement(Fa,{needClip:o,clipPathId:d,props:this.props})),R_.createElement(zd,{points:n,mainColor:z6(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:b}),this.props.isRange&&Array.isArray(h)&&R_.createElement(zd,{points:h,mainColor:z6(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:b}))}}var Fs={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:O1.area};function Fl(e){var t,n=Rw(e,Fs),{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:s,dot:l,fill:c,fillOpacity:u,hide:d,isAnimationActive:h,legendType:f,stroke:p,xAxisId:g,yAxisId:v}=n,x=z5(n,z1),y=CD(_A),b=CD(O$),{needClip:w}=zf(g,v),j=_s(),{points:N,isRange:k,baseLine:E}=null!=(t=CD(t=>zE(t,e.id,j)))?t:{},C=CD(Rm);if("horizontal"!==y&&"vertical"!==y||null==C||"AreaChart"!==b&&"ComposedChart"!==b)return null;var{height:_,width:S,x:T,y:A}=C;return N&&N.length?R_.createElement(Fo,z2({},x,{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,baseLine:E,connectNulls:s,dot:l,fill:c,fillOpacity:u,height:_,hide:d,layout:y,isAnimationActive:"auto"===h?!Ib.isSsr:h,isRange:k,legendType:f,needClip:w,points:N,stroke:p,width:S,left:T,top:A,xAxisId:g,yAxisId:v})):null}var Fc=R_.memo(function(e){var t=Rw(e,Fs),n=_s();return R_.createElement(zA,{id:t.id,type:"area"},e=>{var r;return R_.createElement(R_.Fragment,null,R_.createElement(zC,{legendPayload:(e=>{var{dataKey:t,name:n,stroke:r,fill:i,legendType:a,hide:o}=e;return[{inactive:o,dataKey:t,type:a,color:z6(r,i),value:C3(n,t),payload:e}]})(t)}),R_.createElement(z8,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),R_.createElement(zO,{type:"area",id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:null==(r=t.stackId)?void 0:String(r),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),R_.createElement(Fl,z2({},t,{id:e})))})},IL);Fc.displayName="Area";class Fu{static create(e){return new Fu(e)}constructor(e){this.scale=e}get domain(){return this.scale.domain}get range(){return this.scale.range}get rangeMin(){return this.range()[0]}get rangeMax(){return this.range()[1]}get bandwidth(){return this.scale.bandwidth}apply(e){var{bandAware:t,position:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(void 0!==e){if(n)switch(n){case"start":default:return this.scale(e);case"middle":var r=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+r;case"end":var i=this.bandwidth?this.bandwidth():0;return this.scale(e)+i}if(t){var a=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+a}return this.scale(e)}}isInRange(e){var t=this.range(),n=t[0],r=t[t.length-1];return n<=r?e>=n&&e<=r:e>=r&&e<=n}}(h="symbol"==typeof(l=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(h="EPS","string"))?l:l+"")in Fu?Object.defineProperty(Fu,h,{value:1e-4,enumerable:!0,configurable:!0,writable:!0}):Fu[h]=1e-4;var Fd=function(e){var{width:t,height:n}=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(r%180+180)%180*Math.PI/180,a=Math.atan(n/t);return Math.abs(i>a&&i<Math.PI-a?n/Math.sin(i):t/Math.cos(i))};function Fh(e,t){if(t<1)return[];if(1===t)return e;for(var n=[],r=0;r<e.length;r+=t){var i=e[r];void 0!==i&&n.push(i)}return n}function Ff(e,t,n,r,i){if(e*t<e*r||e*t>e*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function Fp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Fm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fp(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fp(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Fg(e,t,n){var r,{tick:i,ticks:a,viewBox:o,minTickGap:s,orientation:l,interval:c,tickFormatter:u,unit:d,angle:h}=e;if(!a||!a.length||!i)return[];if(k9(c)||Ib.isSsr)return null!=(r=Fh(a,(k9(c)?c:0)+1))?r:[];var f="top"===l||"bottom"===l?"width":"height",p=d&&"width"===f?Bf(d,{fontSize:t,letterSpacing:n}):{width:0,height:0},g=(e,r)=>{var i,a="function"==typeof u?u(e.value,r):e.value;return"width"===f?(i=Bf(a,{fontSize:t,letterSpacing:n}),Fd({width:i.width+p.width,height:i.height+p.height},h)):Bf(a,{fontSize:t,letterSpacing:n})[f]},v=a.length>=2?k6(a[1].coordinate-a[0].coordinate):1,x=function(e,t,n){var r="width"===n,{x:i,y:a,width:o,height:s}=e;return 1===t?{start:r?i:a,end:r?i+o:a+s}:{start:r?i+o:a+s,end:r?i:a}}(o,v,f);return"equidistantPreserveStart"===c?function(e,t,n,r,i){for(var a,o=(r||[]).slice(),{start:s,end:l}=t,c=0,u=1,d=s;u<=o.length;)if(a=function(){var t,a=null==r?void 0:r[c];if(void 0===a)return{v:Fh(r,u)};var o=c,h=()=>(void 0===t&&(t=n(a,o)),t),f=a.coordinate,p=0===c||Ff(e,f,h,d,l);p||(c=0,d=s,u+=1),p&&(d=f+e*(h()/2+i),c+=u)}())return a.v;return[]}(v,x,g,a,s):"equidistantPreserveEnd"===c?function(e,t,n,r,i){var a=(r||[]).slice().length;if(0===a)return[];for(var{start:o,end:s}=t,l=1;l<=a;l++){for(var c=(a-1)%l,u=o,d=!0,h=c;h<a&&!function(){var t,a=r[h],o=h,l=()=>(void 0===t&&(t=n(a,o)),t),f=a.coordinate,p=h===c||Ff(e,f,l,u,s);if(!p)return d=!1,1;p&&(u=f+e*(l()/2+i))}();h+=l);if(d){for(var f=[],p=c;p<a;p+=l)f.push(r[p]);return f}}return[]}(v,x,g,a,s):("preserveStart"===c||"preserveStartEnd"===c?function(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,{start:l,end:c}=t;if(a){var u=r[s-1],d=n(u,s-1),h=e*(u.coordinate+e*d/2-c);o[s-1]=u=Fm(Fm({},u),{},{tickCoord:h>0?u.coordinate-h*e:u.coordinate}),null!=u.tickCoord&&Ff(e,u.tickCoord,()=>d,l,c)&&(c=u.tickCoord-e*(d/2+i),o[s-1]=Fm(Fm({},u),{},{isShow:!0}))}for(var f=a?s-1:s,p=function(t){var r,a=o[t],s=()=>(void 0===r&&(r=n(a,t)),r);if(0===t){var u=e*(a.coordinate-e*s()/2-l);o[t]=a=Fm(Fm({},a),{},{tickCoord:u<0?a.coordinate-u*e:a.coordinate})}else o[t]=a=Fm(Fm({},a),{},{tickCoord:a.coordinate});null!=a.tickCoord&&Ff(e,a.tickCoord,s,l,c)&&(l=a.tickCoord+e*(s()/2+i),o[t]=Fm(Fm({},a),{},{isShow:!0}))},g=0;g<f;g++)p(g);return o}(v,x,g,a,s,"preserveStartEnd"===c):function(e,t,n,r,i){for(var a=(r||[]).slice(),o=a.length,{start:s}=t,{end:l}=t,c=function(t){var r,c=a[t],u=()=>(void 0===r&&(r=n(c,t)),r);if(t===o-1){var d=e*(c.coordinate+e*u()/2-l);a[t]=c=Fm(Fm({},c),{},{tickCoord:d>0?c.coordinate-d*e:c.coordinate})}else a[t]=c=Fm(Fm({},c),{},{tickCoord:c.coordinate});null!=c.tickCoord&&Ff(e,c.tickCoord,u,s,l)&&(l=c.tickCoord-e*(u()/2+i),a[t]=Fm(Fm({},c),{},{isShow:!0}))},u=o-1;u>=0;u--)c(u);return a}(v,x,g,a,s)).filter(e=>e.isShow)}var Fv=["axisLine","width","height","className","hide","ticks","axisType"];function Fx(){return(Fx=Object.assign.bind()).apply(null,arguments)}function Fy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Fb(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fy(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fy(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Fw={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:O1.axis};function Fj(e){var{x:t,y:n,width:r,height:i,orientation:a,mirror:o,axisLine:s,otherSvgProps:l}=e;if(!s)return null;var c=Fb(Fb(Fb({},l),IW(s)),{},{fill:"none"});if("top"===a||"bottom"===a){var u=+("top"===a&&!o||"bottom"===a&&o);c=Fb(Fb({},c),{},{x1:t,y1:n+u*i,x2:t+r,y2:n+u*i})}else{var d=+("left"===a&&!o||"right"===a&&o);c=Fb(Fb({},c),{},{x1:t+d*r,y1:n,x2:t+d*r,y2:n+i})}return em.createElement("line",Fx({},c,{className:(0,_u.clsx)("recharts-cartesian-axis-line",(0,k5.default)(s,"className"))}))}function FN(e){var t,{option:n,tickProps:r,value:i}=e,a=(0,_u.clsx)(r.className,"recharts-cartesian-axis-tick-value");if(em.isValidElement(n))t=em.cloneElement(n,Fb(Fb({},r),{},{className:a}));else if("function"==typeof n)t=n(Fb(Fb({},r),{},{className:a}));else{var o="recharts-cartesian-axis-tick-value";"boolean"!=typeof n&&(o=(0,_u.clsx)(o,null==n?void 0:n.className)),t=em.createElement(BI,Fx({},r,{className:o}),i)}return t}var Fk=(0,em.forwardRef)((e,t)=>{var{ticks:n=[],tick:r,tickLine:i,stroke:a,tickFormatter:o,unit:s,padding:l,tickTextProps:c,orientation:u,mirror:d,x:h,y:f,width:p,height:g,tickSize:v,tickMargin:x,fontSize:y,letterSpacing:b,getTicksConfig:w,events:j,axisType:N}=e,k=Fg(Fb(Fb({},w),{},{ticks:n}),y,b),E=function(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}(u,d),C=function(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}(u,d),_=IW(w),S=IY(r),T={};"object"==typeof i&&(T=i);var A=Fb(Fb({},_),{},{fill:"none"},T),O=k.map(e=>Fb({entry:e},function(e,t,n,r,i,a,o,s,l){var c,u,d,h,f,p,g=s?-1:1,v=e.tickSize||o,x=k9(e.tickCoord)?e.tickCoord:e.coordinate;switch(a){case"top":c=u=e.coordinate,p=(d=(h=n+!s*i)-g*v)-g*l,f=x;break;case"left":d=h=e.coordinate,f=(c=(u=t+!s*r)-g*v)-g*l,p=x;break;case"right":d=h=e.coordinate,f=(c=(u=t+s*r)+g*v)+g*l,p=x;break;default:c=u=e.coordinate,p=(d=(h=n+s*i)+g*v)+g*l,f=x}return{line:{x1:c,y1:d,x2:u,y2:h},tick:{x:f,y:p}}}(e,h,f,p,g,u,v,d,x))),M=O.map(e=>{var{entry:t,line:n}=e;return em.createElement(Ba,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(t.value,"-").concat(t.coordinate,"-").concat(t.tickCoord)},i&&em.createElement("line",Fx({},A,n,{className:(0,_u.clsx)("recharts-cartesian-axis-tick-line",(0,k5.default)(i,"className"))})))}),P=O.map((e,t)=>{var{entry:n,tick:i}=e,u=Fb(Fb(Fb(Fb({textAnchor:E,verticalAnchor:C},_),{},{stroke:"none",fill:a},S),i),{},{index:t,payload:n,visibleTicksCount:k.length,tickFormatter:o,padding:l},c);return em.createElement(Ba,Fx({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(n.value,"-").concat(n.coordinate,"-").concat(n.tickCoord)},((e,t,n)=>{if(null===e||"object"!=typeof e&&"function"!=typeof e)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];IF(i)&&"function"==typeof a&&(r||(r={}),r[i]=e=>(a(t,n,e),null))}),r})(j,n,t)),r&&em.createElement(FN,{option:r,tickProps:u,value:"".concat("function"==typeof o?o(n.value,t):n.value).concat(s||"")}))});return em.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(N,"-ticks")},P.length>0&&em.createElement(BR,{zIndex:O1.label},em.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(N,"-tick-labels"),ref:t},P)),M.length>0&&em.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(N,"-tick-lines")},M))}),FE=(0,em.forwardRef)((e,t)=>{var{axisLine:n,width:r,height:i,className:a,hide:o,ticks:s,axisType:l}=e,c=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Fv),[u,d]=(0,em.useState)(""),[h,f]=(0,em.useState)(""),p=(0,em.useRef)(null);(0,em.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>{var t;return(e=>{var{ticks:t,label:n,labelGapWithTick:r=5,tickSize:i=0,tickMargin:a=0}=e,o=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.width>o&&(o=t.width)}});var s=n?n.getBoundingClientRect().width:0;return Math.round(o+(i+a)+s+(n?r:0))}return 0})({ticks:p.current,label:null==(t=e.labelRef)?void 0:t.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var g=(0,em.useCallback)(e=>{if(e){var t=e.getElementsByClassName("recharts-cartesian-axis-tick-value");p.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),i=r.fontSize,a=r.letterSpacing;(i!==u||a!==h)&&(d(i),f(a))}}},[u,h]);return o||null!=r&&r<=0||null!=i&&i<=0?null:em.createElement(BR,{zIndex:e.zIndex},em.createElement(Ba,{className:(0,_u.clsx)("recharts-cartesian-axis",a)},em.createElement(Fj,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:IW(e)}),em.createElement(Fk,{ref:g,axisType:l,events:c,fontSize:u,getTicksConfig:e,height:e.height,letterSpacing:h,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:s,unit:e.unit,width:e.width,x:e.x,y:e.y}),em.createElement(BY,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},em.createElement(BQ,{label:e.label,labelRef:e.labelRef}),e.children)))}),FC=em.forwardRef((e,t)=>{var n=Rw(e,Fw);return em.createElement(FE,Fx({},n,{ref:t}))});FC.displayName="CartesianAxis";var F_=["domain","range"],FS=["domain","range"];function FT(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function FA(e,t){return e===t||!!(Array.isArray(e)&&2===e.length&&Array.isArray(t))&&2===t.length&&e[0]===t[0]&&e[1]===t[1]}function FO(e,t){if(e===t)return!0;var{domain:n,range:r}=e,i=FT(e,F_),{domain:a,range:o}=t,s=FT(t,FS);return!!FA(n,a)&&!!FA(r,o)&&IL(i,s)}var FM=["dangerouslySetInnerHTML","ticks","scale"],FP=["id","scale"];function FD(){return(FD=Object.assign.bind()).apply(null,arguments)}function FL(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function FI(e){var t=CA(),n=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{null===n.current?t(Ly(e)):n.current!==e&&t(Lb({prev:n.current,next:e})),n.current=e},[e,t]),(0,em.useLayoutEffect)(()=>()=>{n.current&&(t(Lw(n.current)),n.current=null)},[t]),null}var FR=e=>{var{xAxisId:t,className:n}=e,r=CD(_a),i=_s(),a="xAxis",o=CD(e=>PJ(e,a,t,i)),s=CD(e=>PU(e,t)),l=CD(e=>PY(e,t)),c=CD(e=>Mw(e,t));if(null==s||null==l||null==c)return null;var{dangerouslySetInnerHTML:u,ticks:d,scale:h}=e,f=FL(e,FM),{id:p,scale:g}=c,v=FL(c,FP);return em.createElement(FC,FD({},f,v,{x:l.x,y:l.y,width:s.width,height:s.height,className:(0,_u.clsx)("recharts-".concat(a," ").concat(a),n),viewBox:r,ticks:o,axisType:a}))},FB={allowDataOverflow:Mb.allowDataOverflow,allowDecimals:Mb.allowDecimals,allowDuplicatedCategory:Mb.allowDuplicatedCategory,angle:Mb.angle,axisLine:Fw.axisLine,height:Mb.height,hide:!1,includeHidden:Mb.includeHidden,interval:Mb.interval,minTickGap:Mb.minTickGap,mirror:Mb.mirror,orientation:Mb.orientation,padding:Mb.padding,reversed:Mb.reversed,scale:Mb.scale,tick:Mb.tick,tickCount:Mb.tickCount,tickLine:Fw.tickLine,tickSize:Fw.tickSize,type:Mb.type,xAxisId:0},Fz=em.memo(e=>{var t=Rw(e,FB);return em.createElement(em.Fragment,null,em.createElement(FI,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit}),em.createElement(FR,t))},FO);Fz.displayName="XAxis";var FF=["dangerouslySetInnerHTML","ticks","scale"],FV=["id","scale"];function FU(){return(FU=Object.assign.bind()).apply(null,arguments)}function FH(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function FW(e){var t=CA(),n=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{null===n.current?t(Lj(e)):n.current!==e&&t(LN({prev:n.current,next:e})),n.current=e},[e,t]),(0,em.useLayoutEffect)(()=>()=>{n.current&&(t(Lk(n.current)),n.current=null)},[t]),null}var FY=e=>{var{yAxisId:t,className:n,width:r,label:i}=e,a=(0,em.useRef)(null),o=(0,em.useRef)(null),s=CD(_a),l=_s(),c=CA(),u="yAxis",d=CD(e=>P$(e,t)),h=CD(e=>PG(e,t)),f=CD(e=>PJ(e,u,t,l)),p=CD(e=>Mk(e,t));if((0,em.useLayoutEffect)(()=>{if(!("auto"!==r||!d||BX(i)||(0,em.isValidElement)(i))&&null!=p){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(d.width)!==Math.round(n)&&c(LS({id:t,width:n}))}}},[f,d,c,i,t,r,p]),null==d||null==h||null==p)return null;var{dangerouslySetInnerHTML:g,ticks:v,scale:x}=e,y=FH(e,FF),{id:b,scale:w}=p,j=FH(p,FV);return em.createElement(FC,FU({},y,j,{ref:a,labelRef:o,x:h.x,y:h.y,tickTextProps:"auto"===r?{width:void 0}:{width:r},width:d.width,height:d.height,className:(0,_u.clsx)("recharts-".concat(u," ").concat(u),n),viewBox:s,ticks:f,axisType:u}))},FG={allowDataOverflow:MN.allowDataOverflow,allowDecimals:MN.allowDecimals,allowDuplicatedCategory:MN.allowDuplicatedCategory,angle:MN.angle,axisLine:Fw.axisLine,hide:!1,includeHidden:MN.includeHidden,interval:MN.interval,minTickGap:MN.minTickGap,mirror:MN.mirror,orientation:MN.orientation,padding:MN.padding,reversed:MN.reversed,scale:MN.scale,tick:MN.tick,tickCount:MN.tickCount,tickLine:Fw.tickLine,tickSize:Fw.tickSize,type:MN.type,width:MN.width,yAxisId:0},F$=em.memo(e=>{var t=Rw(e,FG);return em.createElement(em.Fragment,null,em.createElement(FW,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter}),em.createElement(FY,t))},FO);function FX(){return(FX=Object.assign.bind()).apply(null,arguments)}function Fq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function FK(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fq(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fq(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function FZ(e){return Array.isArray(e)&&Ee(e[0])&&Ee(e[1])?e.join(" ~ "):e}F$.displayName="YAxis";var FQ=e=>{var{separator:t=" : ",contentStyle:n={},itemStyle:r={},labelStyle:i={},payload:a,formatter:o,itemSorter:s,wrapperClassName:l,labelClassName:c,label:u,labelFormatter:d,accessibilityLayer:h=!1}=e,f=FK({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},n),p=FK({margin:0},i),g=null!=u,v=g?u:"",x=(0,_u.clsx)("recharts-default-tooltip",l),y=(0,_u.clsx)("recharts-tooltip-label",c);return g&&d&&null!=a&&(v=d(u,a)),em.createElement("div",FX({className:x,style:f},h?{role:"status","aria-live":"assertive"}:{}),em.createElement("p",{className:y,style:p},em.isValidElement(v)?v:"".concat(v)),(()=>{if(a&&a.length){var e=(s?(0,CL.default)(a,s):a).map((e,n)=>{if("none"===e.type)return null;var i=e.formatter||o||FZ,{value:s,name:l}=e,c=s,u=l,d=i(s,l,e,n,a);if(Array.isArray(d))[c,u]=d;else{if(null==d)return null;c=d}var h=FK({display:"block",paddingTop:4,paddingBottom:4,color:e.color||"#000"},r);return em.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(n),style:h},Ee(u)?em.createElement("span",{className:"recharts-tooltip-item-name"},u):null,Ee(u)?em.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,em.createElement("span",{className:"recharts-tooltip-item-value"},c),em.createElement("span",{className:"recharts-tooltip-item-unit"},e.unit||""))});return em.createElement("ul",{className:"recharts-tooltip-item-list",style:{padding:0,margin:0}},e)}return null})())},FJ=em,F0="recharts-tooltip-wrapper",F1={visibility:"hidden"};function F2(e){var{allowEscapeViewBox:t,coordinate:n,key:r,offsetTopLeft:i,position:a,reverseDirection:o,tooltipDimension:s,viewBox:l,viewBoxDimension:c}=e;if(a&&k9(a[r]))return a[r];var u=n[r]-s-(i>0?i:0),d=n[r]+i;if(t[r])return o[r]?u:d;var h=l[r];return null==h?0:o[r]?u<h?Math.max(d,h):Math.max(u,h):null==c?0:d+s>h+c?Math.max(u,h):Math.max(d,h)}function F5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function F3(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F5(Object(n),!0).forEach(function(t){F4(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F5(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function F4(e,t,n){var r;return(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class F6 extends FJ.PureComponent{constructor(){super(...arguments),F4(this,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}),F4(this,"handleKeyDown",e=>{if("Escape"===e.key){var t,n,r,i;this.setState({dismissed:!0,dismissedAtCoordinate:{x:null!=(t=null==(n=this.props.coordinate)?void 0:n.x)?t:0,y:null!=(r=null==(i=this.props.coordinate)?void 0:i.y)?r:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var e,t;this.state.dismissed&&((null==(e=this.props.coordinate)?void 0:e.x)!==this.state.dismissedAtCoordinate.x||(null==(t=this.props.coordinate)?void 0:t.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:e,allowEscapeViewBox:t,animationDuration:n,animationEasing:r,children:i,coordinate:a,hasPayload:o,isAnimationActive:s,offset:l,position:c,reverseDirection:u,useTranslate3d:d,viewBox:h,wrapperStyle:f,lastBoundingBox:p,innerRef:g,hasPortalFromProps:v}=this.props,{cssClasses:x,cssProperties:y}=function(e){var t,n,r,{allowEscapeViewBox:i,coordinate:a,offsetTopLeft:o,position:s,reverseDirection:l,tooltipBox:c,useTranslate3d:u,viewBox:d}=e;return{cssProperties:t=c.height>0&&c.width>0&&a?function(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}({translateX:n=F2({allowEscapeViewBox:i,coordinate:a,key:"x",offsetTopLeft:o,position:s,reverseDirection:l,tooltipDimension:c.width,viewBox:d,viewBoxDimension:d.width}),translateY:r=F2({allowEscapeViewBox:i,coordinate:a,key:"y",offsetTopLeft:o,position:s,reverseDirection:l,tooltipDimension:c.height,viewBox:d,viewBoxDimension:d.height}),useTranslate3d:u}):F1,cssClasses:function(e){var{coordinate:t,translateX:n,translateY:r}=e;return(0,_u.clsx)(F0,{["".concat(F0,"-right")]:k9(n)&&t&&k9(t.x)&&n>=t.x,["".concat(F0,"-left")]:k9(n)&&t&&k9(t.x)&&n<t.x,["".concat(F0,"-bottom")]:k9(r)&&t&&k9(t.y)&&r>=t.y,["".concat(F0,"-top")]:k9(r)&&t&&k9(t.y)&&r<t.y})}({translateX:n,translateY:r,coordinate:a})}}({allowEscapeViewBox:t,coordinate:a,offsetTopLeft:l,position:c,reverseDirection:u,tooltipBox:{height:p.height,width:p.width},useTranslate3d:d,viewBox:h}),b=v?{}:F3(F3({transition:s&&e?"transform ".concat(n,"ms ").concat(r):void 0},y),{},{pointerEvents:"none",visibility:!this.state.dismissed&&e&&o?"visible":"hidden",position:"absolute",top:0,left:0}),w=F3(F3({},b),{},{visibility:!this.state.dismissed&&e&&o?"visible":"hidden"},f);return FJ.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:x,style:w,ref:g},i)}}var F8=e.i(92809),F7=["x","y","top","left","width","height","className"];function F9(){return(F9=Object.assign.bind()).apply(null,arguments)}function Ve(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var Vt=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:a=0,height:o=0,className:s}=e,l=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ve(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ve(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({x:t,y:n,top:r,left:i,width:a,height:o},function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,F7));return k9(t)&&k9(n)&&k9(a)&&k9(o)&&k9(r)&&k9(i)?em.createElement("path",F9({},IG(l),{className:(0,_u.clsx)("recharts-cross",s),d:"M".concat(t,",").concat(r,"v").concat(o,"M").concat(i,",").concat(n,"h").concat(a)})):null},Vn=["radius"],Vr=["radius"];function Vi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Va(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vi(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vo(){return(Vo=Object.assign.bind()).apply(null,arguments)}function Vs(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Vl(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Vc=(e,t,n,r,i)=>{var a,o=k3(n),s=k3(r),l=Math.min(Math.abs(o)/2,Math.abs(s)/2),c=s>=0?1:-1,u=o>=0?1:-1,d=+(s>=0&&o>=0||s<0&&o<0);if(l>0&&i instanceof Array){for(var h=[0,0,0,0],f=0;f<4;f++)h[f]=i[f]>l?l:i[f];a=k4(G||(G=Vl(["M",",",""])),e,t+c*h[0]),h[0]>0&&(a+=k4($||($=Vl(["A ",",",",0,0,",",",",",""])),h[0],h[0],d,e+u*h[0],t)),a+=k4(X||(X=Vl(["L ",",",""])),e+n-u*h[1],t),h[1]>0&&(a+=k4(q||(q=Vl(["A ",",",",0,0,",",\n ",",",""])),h[1],h[1],d,e+n,t+c*h[1])),a+=k4(K||(K=Vl(["L ",",",""])),e+n,t+r-c*h[2]),h[2]>0&&(a+=k4(Z||(Z=Vl(["A ",",",",0,0,",",\n ",",",""])),h[2],h[2],d,e+n-u*h[2],t+r)),a+=k4(Q||(Q=Vl(["L ",",",""])),e+u*h[3],t+r),h[3]>0&&(a+=k4(J||(J=Vl(["A ",",",",0,0,",",\n ",",",""])),h[3],h[3],d,e,t+r-c*h[3])),a+="Z"}else if(l>0&&i===+i&&i>0){var p=Math.min(l,i);a=k4(ee||(ee=Vl(["M ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",","," Z"])),e,t+c*p,p,p,d,e+u*p,t,e+n-u*p,t,p,p,d,e+n,t+c*p,e+n,t+r-c*p,p,p,d,e+n-u*p,t+r,e+u*p,t+r,p,p,d,e,t+r-c*p)}else a=k4(et||(et=Vl(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return a},Vu={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Vd=e=>{var t=Rw(e,Vu),n=(0,em.useRef)(null),[r,i]=(0,em.useState)(-1);(0,em.useEffect)(()=>{if(n.current&&n.current.getTotalLength)try{var e=n.current.getTotalLength();e&&i(e)}catch(e){}},[]);var{x:a,y:o,width:s,height:l,radius:c,className:u}=t,{animationEasing:d,animationDuration:h,animationBegin:f,isAnimationActive:p,isUpdateAnimationActive:g}=t,v=(0,em.useRef)(s),x=(0,em.useRef)(l),y=(0,em.useRef)(a),b=(0,em.useRef)(o),w=z_((0,em.useMemo)(()=>({x:a,y:o,width:s,height:l,radius:c}),[a,o,s,l,c]),"rectangle-");if(a!==+a||o!==+o||s!==+s||l!==+l||0===s||0===l)return null;var j=(0,_u.clsx)("recharts-rectangle",u);if(!g){var N=IG(t),{radius:k}=N,E=Vs(N,Vn);return em.createElement("path",Vo({},E,{x:k3(a),y:k3(o),width:k3(s),height:k3(l),radius:"number"==typeof c?c:void 0,className:j,d:Vc(a,o,s,l,c)}))}var C=v.current,_=x.current,S=y.current,T=b.current,A="0px ".concat(-1===r?1:r,"px"),O="".concat(r,"px 0px"),M=zD(["strokeDasharray"],h,"string"==typeof d?d:Vu.animationEasing);return em.createElement(zQ,{animationId:w,key:w,canBegin:r>0,duration:h,easing:d,isActive:g,begin:f},e=>{var r,i=Ea(C,s,e),u=Ea(_,l,e),d=Ea(S,a,e),h=Ea(T,o,e);n.current&&(v.current=i,x.current=u,y.current=d,b.current=h),r=p?e>0?{transition:M,strokeDasharray:O}:{strokeDasharray:A}:{strokeDasharray:O};var f=IG(t),{radius:g}=f,w=Vs(f,Vr);return em.createElement("path",Vo({},w,{radius:"number"==typeof c?c:void 0,className:j,d:Vc(d,h,i,u,c),ref:n,style:Va(Va({},r),t.style)}))})};function Vh(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:a}=e;return{points:[O0(t,n,r,i),O0(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}function Vf(){return(Vf=Object.assign.bind()).apply(null,arguments)}function Vp(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Vm=e=>{var{cx:t,cy:n,radius:r,angle:i,sign:a,isExternal:o,cornerRadius:s,cornerIsExternal:l}=e,c=s*(o?1:-1)+r,u=Math.asin(s/c)/OJ,d=l?i:i+a*u,h=O0(t,n,c,d);return{center:h,circleTangency:O0(t,n,r,d),lineTangency:O0(t,n,c*Math.cos(u*OJ),l?i-a*u:i),theta:u}},Vg=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:a,endAngle:o}=e,s=k6(o-a)*Math.min(Math.abs(o-a),359.999),l=a+s,c=O0(t,n,i,a),u=O0(t,n,i,l),d=k4(en||(en=Vp(["M ",",","\n A ",",",",0,\n ",",",",\n ",",","\n "])),c.x,c.y,i,i,+(Math.abs(s)>180),+(a>l),u.x,u.y);if(r>0){var h=O0(t,n,r,a),f=O0(t,n,r,l);d+=k4(er||(er=Vp(["L ",",","\n A ",",",",0,\n ",",",",\n ",","," Z"])),f.x,f.y,r,r,+(Math.abs(s)>180),+(a<=l),h.x,h.y)}else d+=k4(ei||(ei=Vp(["L ",","," Z"])),t,n);return d},Vv={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Vx=e=>{var t,n=Rw(e,Vv),{cx:r,cy:i,innerRadius:a,outerRadius:o,cornerRadius:s,forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d,className:h}=n;if(o<a||u===d)return null;var f=(0,_u.clsx)("recharts-sector",h),p=o-a,g=Er(s,p,0,!0);return t=g>0&&360>Math.abs(u-d)?(e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:a,forceCornerRadius:o,cornerIsExternal:s,startAngle:l,endAngle:c}=e,u=k6(c-l),{circleTangency:d,lineTangency:h,theta:f}=Vm({cx:t,cy:n,radius:i,angle:l,sign:u,cornerRadius:a,cornerIsExternal:s}),{circleTangency:p,lineTangency:g,theta:v}=Vm({cx:t,cy:n,radius:i,angle:c,sign:-u,cornerRadius:a,cornerIsExternal:s}),x=s?Math.abs(l-c):Math.abs(l-c)-f-v;if(x<0)return o?k4(ea||(ea=Vp(["M ",",","\n a",",",",0,0,1,",",0\n a",",",",0,0,1,",",0\n "])),h.x,h.y,a,a,2*a,a,a,-(2*a)):Vg({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:l,endAngle:c});var y=k4(eo||(eo=Vp(["M ",",","\n A",",",",0,0,",",",",","\n A",",",",0,",",",",",",","\n A",",",",0,0,",",",",","\n "])),h.x,h.y,a,a,+(u<0),d.x,d.y,i,i,+(x>180),+(u<0),p.x,p.y,a,a,+(u<0),g.x,g.y);if(r>0){var{circleTangency:b,lineTangency:w,theta:j}=Vm({cx:t,cy:n,radius:r,angle:l,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),{circleTangency:N,lineTangency:k,theta:E}=Vm({cx:t,cy:n,radius:r,angle:c,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),C=s?Math.abs(l-c):Math.abs(l-c)-j-E;if(C<0&&0===a)return"".concat(y,"L").concat(t,",").concat(n,"Z");y+=k4(es||(es=Vp(["L",",","\n A",",",",0,0,",",",",","\n A",",",",0,",",",",",",","\n A",",",",0,0,",",",",","Z"])),k.x,k.y,a,a,+(u<0),N.x,N.y,r,r,+(C>180),+(u>0),b.x,b.y,a,a,+(u<0),w.x,w.y)}else y+=k4(el||(el=Vp(["L",",","Z"])),t,n);return y})({cx:r,cy:i,innerRadius:a,outerRadius:o,cornerRadius:Math.min(g,p/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):Vg({cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:u,endAngle:d}),em.createElement("path",Vf({},IG(n),{className:f,d:t}))};function Vy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Vb(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vy(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vy(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vw(){return(Vw=Object.assign.bind()).apply(null,arguments)}function Vj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function VN(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vj(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vj(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vk(e){var{cursor:t,cursorComp:n,cursorProps:r}=e;return(0,em.isValidElement)(t)?(0,em.cloneElement)(t,r):(0,em.createElement)(n,r)}function VE(e){var t,n,r,i,a,{coordinate:o,payload:s,index:l,offset:c,tooltipAxisBandSize:u,layout:d,cursor:h,tooltipEventType:f,chartName:p}=e;if(!h||!o||"ScatterChart"!==p&&"axis"!==f)return null;if("ScatterChart"===p)r=o,i=Vt,a=O1.cursorLine;else if("BarChart"===p)t=u/2,r={stroke:"none",fill:"#ccc",x:"horizontal"===d?o.x-t:c.left+.5,y:"horizontal"===d?c.top+.5:o.y-t,width:"horizontal"===d?u:c.width-1,height:"horizontal"===d?c.height-1:u},i=Vd,a=O1.cursorRectangle;else if("radial"===d&&R2(o)){var{cx:g,cy:v,radius:x,startAngle:y,endAngle:b}=Vh(o);r={cx:g,cy:v,startAngle:y,endAngle:b,innerRadius:x,outerRadius:x},i=Vx,a=O1.cursorLine}else r={points:function(e,t,n){if("horizontal"===e)return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if("vertical"===e)return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(R2(t)){if("centric"===e){var{cx:r,cy:i,innerRadius:a,outerRadius:o,angle:s}=t,l=O0(r,i,a,s),c=O0(r,i,o,s);return[{x:l.x,y:l.y},{x:c.x,y:c.y}]}return Vh(t)}}(d,o,c)},i=Bn,a=O1.cursorLine;var w="object"==typeof h&&"className"in h?h.className:void 0,j=VN(VN(VN(VN({stroke:"#ccc",pointerEvents:"none"},c),r),IY(h)),{},{payload:s,payloadIndex:l,className:(0,_u.clsx)("recharts-tooltip-cursor",w)});return em.createElement(BR,{zIndex:null!=(n=e.zIndex)?n:a},em.createElement(Vk,{cursor:h,cursorComp:i,cursorProps:j}))}function VC(e){var t,n,r,i=(t=CD(Mq),n=CD(DH),r=CD(DF),t&&r?C2(Vb(Vb({},t),{},{scale:r}),n):C2(void 0,n)),a=_T(),o=CD(_A),s=CD(O$);return null==i||null==a||null==o||null==s?null:em.createElement(VE,Vw({},e,{offset:a,layout:o,tooltipAxisBandSize:i,chartName:s}))}function V_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function VS(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V_(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function VT(e){return e.dataKey}var VA=[],VO={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function VM(e){var t,n,r,i,a,o,s,l,c,u,d,h=Rw(e,VO),{active:f,allowEscapeViewBox:p,animationDuration:g,animationEasing:v,content:x,filterNull:y,isAnimationActive:b,offset:w,payloadUniqBy:j,position:N,reverseDirection:k,useTranslate3d:E,wrapperStyle:C,cursor:_,shared:S,trigger:T,defaultIndex:A,portal:O,axisId:M}=h,P=CA(),D="number"==typeof A?String(A):A;(0,em.useEffect)(()=>{P(Co({shared:S,trigger:T,axisId:M,active:f,defaultIndex:D}))},[P,S,T,M,f,D]);var L=__(),I=IB(),R=CD(e=>P8(e,S)),{activeIndex:B,isActive:z}=null!=(u=CD(e=>Ls(e,R,T,D)))?u:{},F=CD(e=>Lo(e,R,T,D)),V=CD(e=>La(e,R,T,D)),U=CD(e=>Li(e,R,T,D)),H=(0,em.useContext)(Rr),W=null!=(d=null!=f?f:z)&&d,[Y,G]=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],[t,n]=(0,em.useState)({height:0,left:0,top:0,width:0}),r=(0,em.useCallback)(e=>{if(null!=e){var r=e.getBoundingClientRect(),i={height:r.height,left:r.left,top:r.top,width:r.width};(Math.abs(i.height-t.height)>1||Math.abs(i.left-t.left)>1||Math.abs(i.top-t.top)>1||Math.abs(i.width-t.width)>1)&&n({height:i.height,left:i.left,top:i.top,width:i.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,r]}([F,W]),$="axis"===R?V:void 0;t=CD(e=>((e,t,n)=>{if(null!=t){var r=Do(e);return"axis"===t?"hover"===n?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:"hover"===n?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}})(e,R,T)),n=CD(OK),r=CD(OX),i=CD(Oq),o=null==(a=CD(I9))?void 0:a.active,s=__(),(0,em.useEffect)(()=>{if(!o&&null!=r&&null!=n){var e=Cf({active:W,coordinate:U,dataKey:t,index:B,label:"number"==typeof $?String($):$,sourceViewBox:s,graphicalItemId:void 0});I6.emit(I8,r,e,n)}},[o,U,t,B,$,n,r,i,W,s]);var X=null!=O?O:H;if(null==X||null==L||null==R)return null;var q=null!=F?F:VA;W||(q=VA),y&&q.length&&(l=q.filter(e=>null!=e.value&&(!0!==e.hide||h.includeHidden)),q=!0===j?(0,F8.default)(l,VT):"function"==typeof j?(0,F8.default)(l,j):l);var K=q.length>0,Z=em.createElement(F6,{allowEscapeViewBox:p,animationDuration:g,animationEasing:v,isAnimationActive:b,active:W,coordinate:U,hasPayload:K,offset:w,position:N,reverseDirection:k,useTranslate3d:E,viewBox:L,wrapperStyle:C,lastBoundingBox:Y,innerRef:G,hasPortalFromProps:!!O},(c=VS(VS({},h),{},{payload:q,label:$,active:W,activeIndex:B,coordinate:U,accessibilityLayer:I}),em.isValidElement(x)?em.cloneElement(x,c):"function"==typeof x?em.createElement(x,c):em.createElement(FQ,c)));return em.createElement(em.Fragment,null,(0,e1.createPortal)(Z,X),W&&em.createElement(VC,{cursor:_,tooltipEventType:R,coordinate:U,payload:q,index:B}))}var VP=["x1","y1","x2","y2","key"],VD=["offset"],VL=["xAxisId","yAxisId"],VI=["xAxisId","yAxisId"];function VR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function VB(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?VR(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VR(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vz(){return(Vz=Object.assign.bind()).apply(null,arguments)}function VF(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var VV=e=>{var{fill:t}=e;if(!t||"none"===t)return null;var{fillOpacity:n,x:r,y:i,width:a,height:o,ry:s}=e;return em.createElement("rect",{x:r,y:i,ry:s,width:a,height:o,stroke:"none",fill:t,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function VU(e){var{option:t,lineItemProps:n}=e;if(em.isValidElement(t))r=em.cloneElement(t,n);else if("function"==typeof t)r=t(n);else{var r,i,{x1:a,y1:o,x2:s,y2:l,key:c}=n,u=null!=(i=IW(VF(n,VP)))?i:{},{offset:d}=u,h=VF(u,VD);r=em.createElement("line",Vz({},h,{x1:a,y1:o,x2:s,y2:l,fill:"none",key:c}))}return r}function VH(e){var{x:t,width:n,horizontal:r=!0,horizontalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=VF(e,VL),l=i.map((e,i)=>{var a=VB(VB({},s),{},{x1:t,y1:e,x2:t+n,y2:e,key:"line-".concat(i),index:i});return em.createElement(VU,{key:"line-".concat(i),option:r,lineItemProps:a})});return em.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function VW(e){var{y:t,height:n,vertical:r=!0,verticalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=VF(e,VI),l=i.map((e,i)=>{var a=VB(VB({},s),{},{x1:e,y1:t,x2:e,y2:t+n,key:"line-".concat(i),index:i});return em.createElement(VU,{option:r,lineItemProps:a,key:"line-".concat(i)})});return em.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function VY(e){var{horizontalFill:t,fillOpacity:n,x:r,y:i,width:a,height:o,horizontalPoints:s,horizontal:l=!0}=e;if(!l||!t||!t.length||null==s)return null;var c=s.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==c[0]&&c.unshift(0);var u=c.map((e,s)=>{var l=c[s+1]?c[s+1]-e:i+o-e;if(l<=0)return null;var u=s%t.length;return em.createElement("rect",{key:"react-".concat(s),y:e,x:r,height:l,width:a,stroke:"none",fill:t[u],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return em.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},u)}function VG(e){var{vertical:t=!0,verticalFill:n,fillOpacity:r,x:i,y:a,width:o,height:s,verticalPoints:l}=e;if(!t||!n||!n.length)return null;var c=l.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==c[0]&&c.unshift(0);var u=c.map((e,t)=>{var l=c[t+1]?c[t+1]-e:i+o-e;if(l<=0)return null;var u=t%n.length;return em.createElement("rect",{key:"react-".concat(t),x:e,y:a,width:l,height:s,stroke:"none",fill:n[u],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return em.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},u)}var V$=(e,t)=>{var{xAxis:n,width:r,height:i,offset:a}=e;return CK(Fg(VB(VB(VB({},Fw),n),{},{ticks:CZ(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},VX=(e,t)=>{var{yAxis:n,width:r,height:i,offset:a}=e;return CK(Fg(VB(VB(VB({},Fw),n),{},{ticks:CZ(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},Vq={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:O1.grid};function VK(e){var t=CD(C4),n=CD(C6),r=_T(),i=VB(VB({},Rw(e,Vq)),{},{x:k9(e.x)?e.x:r.left,y:k9(e.y)?e.y:r.top,width:k9(e.width)?e.width:r.width,height:k9(e.height)?e.height:r.height}),{xAxisId:a,yAxisId:o,x:s,y:l,width:c,height:u,syncWithTicks:d,horizontalValues:h,verticalValues:f}=i,p=_s(),g=CD(e=>PQ(e,"xAxis",a,p)),v=CD(e=>PQ(e,"yAxis",o,p));if(!CY(c)||!CY(u)||!k9(s)||!k9(l))return null;var x=i.verticalCoordinatesGenerator||V$,y=i.horizontalCoordinatesGenerator||VX,{horizontalPoints:b,verticalPoints:w}=i;if((!b||!b.length)&&"function"==typeof y){var j=h&&h.length,N=y({yAxis:v?VB(VB({},v),{},{ticks:j?h:v.ticks}):void 0,width:null!=t?t:c,height:null!=n?n:u,offset:r},!!j||d);_h(Array.isArray(N),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof N,"]")),Array.isArray(N)&&(b=N)}if((!w||!w.length)&&"function"==typeof x){var k=f&&f.length,E=x({xAxis:g?VB(VB({},g),{},{ticks:k?f:g.ticks}):void 0,width:null!=t?t:c,height:null!=n?n:u,offset:r},!!k||d);_h(Array.isArray(E),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof E,"]")),Array.isArray(E)&&(w=E)}return em.createElement(BR,{zIndex:i.zIndex},em.createElement("g",{className:"recharts-cartesian-grid"},em.createElement(VV,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),em.createElement(VY,Vz({},i,{horizontalPoints:b})),em.createElement(VG,Vz({},i,{verticalPoints:w})),em.createElement(VH,Vz({},i,{offset:r,horizontalPoints:b,xAxis:g,yAxis:v})),em.createElement(VW,Vz({},i,{offset:r,verticalPoints:w,xAxis:g,yAxis:v}))))}VK.displayName="CartesianGrid";let VZ=["1h","12h","1d","7d","30d","90d"],VQ="#8b5cf6",VJ="#ec4899",V0="#6366f1",V1="var(--chart-5)",V2="var(--muted-foreground)",V5={world:{label:"World",color:VQ},experience:{label:"Experience",color:VJ},observation:{label:"Observations",color:V0}};function V3(e){if(e<1e3)return e.toString();if(e<1e6){let t=e/1e3;return`${t>=10?t.toFixed(0):t.toFixed(1).replace(/\.0$/,"")}k`}if(e<1e9){let t=e/1e6;return`${t>=10?t.toFixed(0):t.toFixed(1).replace(/\.0$/,"")}M`}let t=e/1e9;return`${t>=10?t.toFixed(0):t.toFixed(1).replace(/\.0$/,"")}B`}function V4({value:e,className:t}){return(0,ep.jsx)("span",{className:t,title:e.toLocaleString(),children:V3(e)})}function V6({active:e,payload:t,label:n,valueLabel:r}){return e&&t&&0!==t.length?(0,ep.jsxs)("div",{className:"rounded-lg border border-border/60 bg-popover/95 backdrop-blur-sm px-3 py-2 shadow-md",children:[null!=n&&(0,ep.jsx)("div",{className:"text-[11px] font-medium text-foreground mb-1.5",children:n}),(0,ep.jsx)("div",{className:"space-y-1",children:t.map((e,t)=>(0,ep.jsxs)("div",{className:"flex items-center gap-2 text-[11px]",children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px]",style:{backgroundColor:e.color||e.payload?.fill}}),(0,ep.jsx)("span",{className:"text-muted-foreground",children:e.name||r||"Value"}),(0,ep.jsx)("span",{className:"ml-auto pl-3 font-semibold tabular-nums text-foreground",children:(e.value??0).toLocaleString()})]},t))})]}):null}function V8({children:e}){return(0,ep.jsx)("h3",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.08em] mb-3",children:e})}function V7(e){if(!e)return"Never";let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let n=Math.floor(t/60);if(n<24)return`${n}h ago`;let r=Math.floor(n/24);return`${r}d ago`}function V9(e){return new Date(/[+Z-]$/.test(e)||/[+-]\d\d:?\d\d$/.test(e)?e:`${e}Z`)}function Ue({done:e,total:t,doneColor:n}){let r=Math.round(100*(t>0?e/t:0));return(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:[(0,ep.jsx)("span",{className:"tabular-nums font-semibold text-foreground text-sm",children:e.toLocaleString()}),(0,ep.jsxs)("span",{className:"text-muted-foreground",children:[" / ",t.toLocaleString()]})]}),(0,ep.jsxs)("span",{className:"text-xs font-semibold tabular-nums text-foreground",children:[r,"%"]})]}),(0,ep.jsx)("div",{className:"h-1.5 w-full rounded-full bg-muted overflow-hidden",children:(0,ep.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${r}%`,backgroundColor:n}})})]})}function Ut({title:e,items:t,emptyLabel:n}){let r=t.reduce((e,t)=>e+t.value,0);return(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)("h4",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.08em]",children:e}),(0,ep.jsx)(V4,{value:r,className:"text-xs text-muted-foreground tabular-nums"})]}),0===r?(0,ep.jsx)("div",{className:"text-xs text-muted-foreground py-2",children:n}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"h-1.5 flex w-full rounded-full overflow-hidden bg-muted",children:t.filter(e=>e.value>0).map(e=>(0,ep.jsx)("div",{className:"h-full",style:{width:`${e.value/r*100}%`,backgroundColor:e.color},title:`${e.name}: ${e.value.toLocaleString()}`},e.name))}),(0,ep.jsx)("div",{className:"grid grid-cols-3 gap-3 text-sm",children:t.map(e=>(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px]",style:{backgroundColor:e.color}}),(0,ep.jsx)("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-medium",children:e.name})]}),(0,ep.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,ep.jsx)(V4,{value:e.value,className:"text-base font-semibold tabular-nums"}),(0,ep.jsx)("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:r>0?`${(e.value/r*100).toFixed(0)}%`:"0%"})]})]},e.name))})]})]})}function Un({icon:e,label:t,value:n}){return(0,ep.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,ep.jsx)("div",{className:"p-2 rounded-md bg-muted",children:(0,ep.jsx)(e,{className:"w-4 h-4 text-muted-foreground"})}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:t}),(0,ep.jsx)(V4,{value:n,className:"text-2xl font-semibold text-foreground leading-tight tabular-nums block"})]})]})}let Ur=["completed","processing","pending","failed","cancelled"],Ui={completed:"#10b981",processing:"#3b82f6",pending:"#f59e0b",failed:"#ef4444",cancelled:"#6b7280"},Ua={completed:"completed",processing:"processing",pending:"pending",failed:"failed",cancelled:"cancelled"};function Uo({byStatus:e}){let t=Ur.map(t=>({status:t,label:Ua[t],value:e[t]||0,color:Ui[t]}));for(let[n,r]of Object.entries(e))Ur.includes(n)||t.push({status:n,label:n,value:r,color:V2});let n=t.reduce((e,t)=>e+t.value,0),r=t.filter(e=>e.value>0);return(0,ep.jsxs)(m7,{children:[(0,ep.jsxs)(m9,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,ep.jsxs)(ge,{className:"text-sm font-semibold flex items-center gap-2",children:[(0,ep.jsx)(j$,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Operations"]}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[(0,ep.jsx)(V4,{value:n})," total"]})]}),(0,ep.jsx)(gn,{children:0===n?(0,ep.jsx)("div",{className:"h-[100px] flex items-center justify-center text-sm text-muted-foreground",children:"No operations yet"}):(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsx)("div",{className:"h-1.5 flex w-full rounded-full overflow-hidden bg-muted",children:r.map(e=>(0,ep.jsx)("div",{className:"h-full",style:{width:`${e.value/n*100}%`,backgroundColor:e.color},title:`${e.label}: ${e.value.toLocaleString()}`},e.status))}),(0,ep.jsx)("div",{className:"space-y-1.5",children:r.map(e=>(0,ep.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px] flex-shrink-0",style:{backgroundColor:e.color}}),(0,ep.jsx)("span",{className:"text-muted-foreground flex-1",children:e.label}),(0,ep.jsx)(V4,{value:e.value,className:"font-semibold tabular-nums text-foreground"}),(0,ep.jsxs)("span",{className:"text-[10px] text-muted-foreground tabular-nums w-9 text-right",children:[(e.value/n*100).toFixed(0),"%"]})]},e.status))})]})})]})}function Us({done:e,pending:t,failed:n,total:r,lastConsolidatedAt:i}){let[a,o]=(0,em.useState)(!1),s=n>0;return(0,ep.jsxs)(m7,{children:[(0,ep.jsx)(m9,{className:"pb-2",children:(0,ep.jsx)(ge,{className:"text-sm font-semibold",children:"Consolidation"})}),(0,ep.jsxs)(gn,{className:"space-y-4",children:[(0,ep.jsx)(Ue,{done:e,total:r,doneColor:V1}),(0,ep.jsxs)("div",{className:"grid grid-cols-4 gap-3 pt-1",children:[(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jX.default,{className:"w-3 h-3 text-emerald-500"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Done"})]}),(0,ep.jsx)(V4,{value:e,className:"text-base font-semibold tabular-nums text-foreground block"})]}),(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jy,{className:"w-3 h-3 text-amber-500"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Pending"})]}),(0,ep.jsx)(V4,{value:t,className:"text-base font-semibold tabular-nums text-foreground block"})]}),(0,ep.jsxs)("button",{type:"button",onClick:()=>s&&o(!0),disabled:!s,className:`text-left space-y-0.5 rounded-md -mx-1 px-1 py-0.5 transition-colors ${s?"cursor-pointer hover:bg-red-500/10 focus:outline-none focus:ring-2 focus:ring-red-500/40":"cursor-default"}`,title:s?"View failed memories":void 0,children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jq,{className:`w-3 h-3 ${s?"text-red-600 dark:text-red-400":"text-muted-foreground/50"}`}),(0,ep.jsx)("span",{className:`text-[10px] uppercase tracking-wider font-medium ${s?"text-red-600 dark:text-red-400":"text-muted-foreground"}`,children:"Failed"})]}),(0,ep.jsxs)("span",{className:`text-base font-semibold tabular-nums block ${s?"text-red-600 dark:text-red-400":"text-foreground"}`,children:[(0,ep.jsx)(V4,{value:n}),s&&(0,ep.jsx)(jK,{className:"inline w-3 h-3 ml-1 opacity-70"})]})]}),(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eG,{className:"w-3 h-3 text-muted-foreground"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Last"})]}),(0,ep.jsx)("span",{className:"text-base font-semibold text-foreground block leading-tight",children:V7(i)})]})]})]}),(0,ep.jsx)(Ul,{open:a,onOpenChange:o})]})}function Ul({open:e,onOpenChange:t}){let{currentBank:n}=(0,ey.useBank)(),[r,i]=(0,em.useState)([]),[a,o]=(0,em.useState)(0),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)(!1),[d,h]=(0,em.useState)(0);(0,em.useEffect)(()=>{if(!e||!n)return;let t=!1;return l(!0),eD.client.listMemories(n,{consolidationState:"failed",limit:200}).then(e=>{t||(i(e.items),o(e.total))}).catch(()=>{}).finally(()=>{t||l(!1)}),()=>{t=!0}},[e,n,d]);let f=async()=>{if(n){u(!0);try{let e=await eD.client.recoverConsolidation(n);e.retried_count>0&&await eD.client.triggerConsolidation(n),ev.toast.success(`Queued ${e.retried_count} memor${1===e.retried_count?"y":"ies"} for re-consolidation`),h(e=>e+1)}catch{}finally{u(!1)}}};return(0,ep.jsx)(tY.Dialog,{open:e,onOpenChange:t,children:(0,ep.jsxs)(tY.DialogContent,{className:"max-w-4xl max-h-[80vh] flex flex-col",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsxs)(tY.DialogTitle,{className:"flex items-center gap-2",children:[(0,ep.jsx)(jq,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),"Failed consolidations"]}),(0,ep.jsx)(tY.DialogDescription,{children:"Source memories whose consolidation permanently failed. Recovery resets them so they are retried on the next consolidation run."})]}),(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-2 py-2",children:[(0,ep.jsx)("span",{className:"text-sm text-muted-foreground",children:s?"Loading…":`${a} failed`}),(0,ep.jsxs)(eL.Button,{size:"sm",onClick:f,disabled:c||s||0===a,children:[(0,ep.jsx)(eW,{className:`w-3.5 h-3.5 mr-1.5 ${c?"animate-spin":""}`}),"Recover all"]})]}),(0,ep.jsx)("div",{className:"flex-1 min-h-0 overflow-auto border border-border rounded-md",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-[140px]",children:"Failed at"}),(0,ep.jsx)(eJ,{className:"w-[100px]",children:"Type"}),(0,ep.jsx)(eJ,{children:"Text"})]})}),(0,ep.jsxs)(eZ,{children:[0===r.length&&!s&&(0,ep.jsx)(eQ,{children:(0,ep.jsx)(e0,{colSpan:3,className:"text-center text-muted-foreground py-8",children:"No failed consolidations."})}),r.map(e=>(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(e0,{className:"text-xs text-muted-foreground whitespace-nowrap",children:V7(e.consolidation_failed_at)}),(0,ep.jsx)(e0,{className:"text-xs capitalize",children:e.fact_type}),(0,ep.jsxs)(e0,{className:"text-sm",children:[(0,ep.jsx)("div",{className:"line-clamp-2",children:e.text}),e.context&&(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:e.context})]})]},e.id))]})]})})]})})}function Uc({models:e,lastConsolidatedAt:t}){let n=e.length,r=t?new Date(t).getTime():0,i=e.filter(e=>!r||!!e.last_refreshed_at&&new Date(e.last_refreshed_at).getTime()>=r).length,a=n-i;return(0,ep.jsxs)(m7,{children:[(0,ep.jsx)(m9,{className:"pb-2",children:(0,ep.jsxs)(ge,{className:"text-sm font-semibold flex items-center gap-2",children:[(0,ep.jsx)(gi,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Mental Models"]})}),(0,ep.jsx)(gn,{className:"space-y-4",children:0===n?(0,ep.jsx)("div",{className:"text-sm text-muted-foreground py-4",children:"No mental models"}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(Ue,{done:i,total:n,doneColor:V1}),(0,ep.jsxs)("div",{className:"grid grid-cols-3 gap-3 pt-1",children:[(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jX.default,{className:"w-3 h-3 text-emerald-500"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Up to date"})]}),(0,ep.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:i})]}),(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jy,{className:"w-3 h-3 text-amber-500"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Stale"})]}),(0,ep.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:a})]}),(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(gi,{className:"w-3 h-3 text-muted-foreground"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Total"})]}),(0,ep.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:n})]})]})]})})]})}let Uu={fontSize:11,fill:V2,fontWeight:500};function Ud(){let{currentBank:e}=(0,ey.useBank)(),{features:t}=(0,ew.useFeatures)(),n=t?.observations??!1,[r,i]=(0,em.useState)(null),[a,o]=(0,em.useState)([]),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)("7d"),[d,h]=(0,em.useState)({trunc:"day",buckets:[]}),[f,p]=(0,em.useState)({world:!0,experience:!0,observation:!0}),g=async()=>{if(e){l(!0);try{let[t,n]=await Promise.all([eD.client.getBankStats(e),eD.client.listMentalModels(e)]);i(t),o(n.items||[])}catch(e){console.error("Error loading bank stats:",e)}finally{l(!1)}}},v=async()=>{if(e)try{let t=await eD.client.getMemoriesTimeseries(e,c);h({trunc:t.trunc,buckets:t.buckets||[]})}catch(e){console.error("Error loading memories timeseries:",e)}};if((0,em.useEffect)(()=>{if(e){g();let e=setInterval(g,5e3);return()=>clearInterval(e)}},[e]),(0,em.useEffect)(()=>{if(e){v();let e=setInterval(v,5e3);return()=>clearInterval(e)}},[e,c]),s&&!r)return(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)(eG,{className:"w-12 h-12 mx-auto mb-3 text-muted-foreground animate-pulse"})});if(!r)return null;let x=n?["world","experience","observation"]:["world","experience"],y=d.buckets.map(e=>{var t,n,r,i;let a,o;return{...e,label:(t=e.time,n=d.trunc,a=V9(t),"day"===n?a.toLocaleDateString(void 0,{month:"short",day:"numeric"}):a.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})),tooltipLabel:(r=e.time,i=d.trunc,o=V9(r),"day"===i?o.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):o.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}))}}),b=y.reduce((e,t)=>e+x.reduce((e,n)=>e+(f[n]&&t[n]||0),0),0),w=Math.max(0,r.total_nodes-r.pending_consolidation);return(0,ep.jsxs)("div",{className:"space-y-8",children:[(0,ep.jsxs)("section",{children:[(0,ep.jsx)(V8,{children:"Memory store"}),(0,ep.jsx)(m7,{children:(0,ep.jsxs)(gn,{className:"p-0",children:[(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 md:divide-x divide-y md:divide-y-0 divide-border/60",children:[(0,ep.jsx)(Un,{icon:eE,label:"Memories",value:r.total_nodes}),(0,ep.jsx)(Un,{icon:jG,label:"Documents",value:r.total_documents}),(0,ep.jsx)(Un,{icon:jY,label:"Links",value:r.total_links})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 md:divide-x divide-y md:divide-y-0 divide-border/60 border-t border-border/60",children:[(0,ep.jsx)("div",{className:"p-5",children:(0,ep.jsx)(Ut,{title:"Memory composition",items:[{name:"World",value:r.nodes_by_fact_type?.world||0,color:VQ},{name:"Experience",value:r.nodes_by_fact_type?.experience||0,color:VJ},...n?[{name:"Observations",value:r.total_observations||0,color:V0}]:[]],emptyLabel:"No memories yet"})}),(0,ep.jsx)("div",{className:"p-5",children:(0,ep.jsx)(Ut,{title:"Link types",items:[{name:"Temporal",value:r.links_by_link_type?.temporal||0,color:"#009296"},{name:"Semantic",value:r.links_by_link_type?.semantic||0,color:"#0074d9"},{name:"Entity",value:r.links_by_link_type?.entity||0,color:"#f59e0b"}],emptyLabel:"No links yet"})})]})]})})]}),(0,ep.jsxs)("section",{children:[(0,ep.jsx)(V8,{children:"Consolidation"}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ep.jsx)(Us,{done:w,pending:r.pending_consolidation,failed:r.failed_consolidation??0,total:r.total_nodes,lastConsolidatedAt:r.last_consolidated_at}),(0,ep.jsx)(Uc,{models:a,lastConsolidatedAt:r.last_consolidated_at})]})]}),(0,ep.jsxs)("section",{children:[(0,ep.jsx)(V8,{children:"Activity"}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,ep.jsxs)(m7,{className:"lg:col-span-2",children:[(0,ep.jsxs)(m9,{className:"pb-2 space-y-2",children:[(0,ep.jsxs)("div",{className:"flex flex-row items-center justify-between",children:[(0,ep.jsx)(ge,{className:"text-sm font-semibold",children:"Memories ingested"}),(0,ep.jsx)("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:VZ.map(e=>(0,ep.jsx)("button",{onClick:()=>u(e),className:`px-2 py-0.5 text-[11px] font-medium rounded transition-colors tabular-nums ${c===e?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:e},e))})]}),(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)("div",{className:"flex items-center gap-1.5",children:x.map(e=>{let t=V5[e],n=f[e];return(0,ep.jsxs)("button",{onClick:()=>p(t=>({...t,[e]:!t[e]})),className:`flex items-center gap-1.5 px-2 py-0.5 rounded-md text-[11px] font-medium transition-all ${n?"bg-muted text-foreground":"bg-transparent text-muted-foreground/60 hover:text-muted-foreground"}`,children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px] transition-opacity",style:{backgroundColor:t.color,opacity:n?1:.3}}),t.label]},e)})}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[(0,ep.jsx)(V4,{value:b})," total"]})]})]}),(0,ep.jsx)(gn,{children:0===y.length||0===b?(0,ep.jsx)("div",{className:"h-[180px] flex items-center justify-center text-sm text-muted-foreground",children:"No memories ingested in this period"}):(0,ep.jsx)("div",{className:"h-[180px]",children:(0,ep.jsx)(_E,{width:"100%",height:"100%",children:(0,ep.jsxs)(RC,{data:y,margin:{top:8,right:8,bottom:0,left:-10},children:[(0,ep.jsx)("defs",{children:x.map(e=>(0,ep.jsxs)("linearGradient",{id:`grad-${e}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,ep.jsx)("stop",{offset:"0%",stopColor:V5[e].color,stopOpacity:.35}),(0,ep.jsx)("stop",{offset:"100%",stopColor:V5[e].color,stopOpacity:0})]},e))}),(0,ep.jsx)(VK,{vertical:!1,stroke:"var(--border)",strokeOpacity:.5,strokeDasharray:"2 4"}),(0,ep.jsx)(Fz,{dataKey:"label",tick:Uu,axisLine:!1,tickLine:!1,dy:4,minTickGap:20}),(0,ep.jsx)(F$,{tick:Uu,axisLine:!1,tickLine:!1,width:40,allowDecimals:!1,tickFormatter:e=>V3(e)}),(0,ep.jsx)(VM,{content:(0,ep.jsx)(V6,{}),labelFormatter:(e,t)=>t?.[0]?.payload?.tooltipLabel||"",cursor:{stroke:V2,strokeWidth:1,strokeDasharray:"3 3"}}),x.map(e=>f[e]?(0,ep.jsx)(Fc,{type:"monotone",dataKey:e,name:V5[e].label,stackId:"a",stroke:V5[e].color,strokeWidth:2,fill:`url(#grad-${e})`,isAnimationActive:!1},e):null)]})})})})]}),(0,ep.jsx)(Uo,{byStatus:r.operations_by_status||{}})]})]})]})}var tH=tH;let Uh=(0,eN.default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),Uf=(0,eN.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),Up=(0,eN.default)("ban",[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),Um=[{value:"all",label:"All types"},{value:"retain",label:"Retain"},{value:"consolidation",label:"Consolidation"},{value:"refresh_mental_model",label:"Mental Model Refresh"},{value:"file_convert_retain",label:"File Convert & Retain"},{value:"webhook_delivery",label:"Webhook Delivery"}];function Ug(){let e,t,n,{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)([]),[o,s]=(0,em.useState)(0),[l,c]=(0,em.useState)(null),[u,d]=(0,em.useState)(null),[h]=(0,em.useState)(10),[f,p]=(0,em.useState)(0),[g,v]=(0,em.useState)(null),[x,y]=(0,em.useState)(null),[b,w]=(0,em.useState)(!1),[j,N]=(0,em.useState)(null),[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(!1),[A,O]=(0,em.useState)(null),M=(0,em.useCallback)(async(e=l,t=f,n=u)=>{if(r){w(!0);try{let i=await eD.client.listOperations(r,{status:e||void 0,type:n||void 0,limit:h,offset:t,excludeParents:!0});a(i.operations||[]),s(i.total||0)}catch(e){console.error("Error loading operations:",e)}finally{w(!1)}}},[r,l,f,u,h]),P=e=>{p(e),M(l,e,u)},D=async e=>{if(r){v(e);try{await eD.client.cancelOperation(r,e),await M()}catch(e){}finally{v(null)}}},L=async e=>{if(r){y(e);try{await eD.client.retryOperation(r,e),await M()}catch(e){}finally{y(null)}}},I=async e=>{if(r){_(!0),E(!0),O(null);try{let t=await eD.client.getOperationStatus(r,e);N(t)}catch(e){console.error("Error loading operation details:",e),N({error:"Failed to load operation details"})}finally{_(!1)}}},R=async()=>{if(r&&j?.operation_id){T(!0);try{let e=j.operation_id,t=await eD.client.getOperationStatus(r,e,{includePayload:!0});N(t),O(e)}catch(e){console.error("Error loading raw payload:",e)}finally{T(!1)}}};return((0,em.useEffect)(()=>{if(r){M(l,f,u);let e=setInterval(()=>M(l,f,u),5e3);return()=>clearInterval(e)}},[r,l,f,u]),r)?(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("h3",{className:"text-lg font-semibold",children:"Background Operations"}),(0,ep.jsx)("button",{onClick:()=>M(),className:"p-1 rounded hover:bg-muted transition-colors",title:"Refresh operations",disabled:b,children:(0,ep.jsx)(eW,{className:`w-4 h-4 text-muted-foreground hover:text-foreground ${b?"animate-spin":""}`})})]}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground",children:[o," operation",1!==o?"s":"",l?` (${l})`:""]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsxs)(tR.Select,{value:u??"all",onValueChange:e=>{var t;d(t="all"===e?null:e),p(0),M(l,0,t)},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"h-9 w-[180px] text-sm",children:(0,ep.jsx)(tR.SelectValue,{placeholder:"All types"})}),(0,ep.jsx)(tR.SelectContent,{children:Um.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e.value,children:(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{children:e.label}),"all"!==e.value&&(0,ep.jsx)("div",{className:"text-xs text-muted-foreground font-mono",children:e.value})]})},e.value))})]}),(0,ep.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:[{value:null,label:"All"},{value:"pending",label:"Pending"},{value:"processing",label:"Processing"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"},{value:"cancelled",label:"Cancelled"}].map(e=>(0,ep.jsx)("button",{onClick:()=>{var t;c(t=e.value),p(0),M(t,0,u)},className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${l===e.value?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:e.label},e.value??"all"))})]})]}),(0,ep.jsx)("div",{children:i.length>0?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-[100px]",children:"ID"}),(0,ep.jsx)(eJ,{children:"Type"}),(0,ep.jsx)(eJ,{children:"Created"}),(0,ep.jsx)(eJ,{children:"Status"}),(0,ep.jsx)(eJ,{className:"w-[80px]"})]})}),(0,ep.jsx)(eZ,{children:i.map(e=>(0,ep.jsxs)(eQ,{className:`cursor-pointer hover:bg-muted/50 ${"failed"===e.status?"bg-red-500/5":""}`,onClick:()=>I(e.id),children:[(0,ep.jsx)(e0,{className:"font-mono text-xs text-muted-foreground",children:e.id.substring(0,8)}),(0,ep.jsx)(e0,{className:"font-medium",children:e.task_type}),(0,ep.jsx)(e0,{className:"text-sm text-muted-foreground",children:new Date(e.created_at).toLocaleString()}),(0,ep.jsxs)(e0,{children:["pending"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,ep.jsx)(eG,{className:"w-3 h-3"}),"pending"]}),"processing"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/20",children:[(0,ep.jsx)(tH.default,{className:"w-3 h-3 animate-spin"}),"processing"]}),"failed"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",title:e.error_message??void 0,children:[(0,ep.jsx)(jy,{className:"w-3 h-3"}),"failed"]}),"completed"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ep.jsx)(eY,{className:"w-3 h-3"}),"completed"]}),"cancelled"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-gray-500/10 text-gray-600 dark:text-gray-400 border border-gray-500/20",children:[(0,ep.jsx)(Up,{className:"w-3 h-3"}),"cancelled"]})]}),(0,ep.jsxs)(e0,{children:["pending"===e.status&&(0,ep.jsxs)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-red-600 dark:hover:text-red-400",onClick:t=>{t.stopPropagation(),D(e.id)},disabled:g===e.id,children:[g===e.id?(0,ep.jsx)(tH.default,{className:"w-3 h-3 animate-spin"}):(0,ep.jsx)(tU.X,{className:"w-3 h-3 mr-1"}),g===e.id?"":"Cancel"]}),("failed"===e.status||"cancelled"===e.status)&&(0,ep.jsxs)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-blue-600 dark:hover:text-blue-400",onClick:t=>{t.stopPropagation(),L(e.id)},disabled:x===e.id,children:[x===e.id?(0,ep.jsx)(tH.default,{className:"w-3 h-3 animate-spin"}):(0,ep.jsx)(Uh,{className:"w-3 h-3 mr-1"}),x===e.id?"":"Retry"]})]})]},e.id))})]})}),o>h&&(0,ep.jsxs)("div",{className:"flex items-center justify-between mt-4 pt-4 border-t",children:[(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Showing ",f+1,"-",Math.min(f+h,o)," of"," ",o]}),(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>P(Math.max(0,f-h)),disabled:0===f,children:"Previous"}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>P(f+h),disabled:f+h>=o,children:"Next"})]})]})]}):(0,ep.jsxs)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:["No ",l?`${l} `:"","operations"]})}),(0,ep.jsx)(tY.Dialog,{open:k,onOpenChange:E,children:(0,ep.jsxs)(tY.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsx)(tY.DialogTitle,{children:"Operation Details"}),(0,ep.jsx)(tY.DialogDescription,{children:j?.operation_id&&(0,ep.jsx)("span",{className:"font-mono text-xs",children:j.operation_id})})]}),C?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)(tH.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):j?(0,ep.jsx)("div",{className:"space-y-4",children:j.error?(0,ep.jsx)("div",{className:"text-red-600 dark:text-red-400",children:j.error}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Status"}),(0,ep.jsxs)("div",{className:"mt-1",children:["pending"===j.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,ep.jsx)(eG,{className:"w-3 h-3"}),"pending"]}),"processing"===j.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/20",children:[(0,ep.jsx)(tH.default,{className:"w-3 h-3 animate-spin"}),"processing"]}),"failed"===j.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,ep.jsx)(jy,{className:"w-3 h-3"}),"failed"]}),"completed"===j.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ep.jsx)(eY,{className:"w-3 h-3"}),"completed"]}),"cancelled"===j.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-gray-500/10 text-gray-600 dark:text-gray-400 border border-gray-500/20",children:[(0,ep.jsx)(Up,{className:"w-3 h-3"}),"cancelled"]})]})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Type"}),(0,ep.jsx)("div",{className:"mt-1 font-mono text-sm",children:j.operation_type})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Created"}),(0,ep.jsx)("div",{className:"mt-1 text-sm",children:j.created_at?new Date(j.created_at).toLocaleString():"N/A"})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Updated"}),(0,ep.jsx)("div",{className:"mt-1 text-sm",children:j.updated_at?new Date(j.updated_at).toLocaleString():"N/A"})]}),j.completed_at&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Completed"}),(0,ep.jsx)("div",{className:"mt-1 text-sm",children:new Date(j.completed_at).toLocaleString()})]}),j.result_metadata?.items_count!==void 0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Total Items"}),(0,ep.jsx)("div",{className:"mt-1 text-sm",children:j.result_metadata.items_count})]})]}),("pending"===j.status||"failed"===j.status||"cancelled"===j.status)&&(0,ep.jsxs)("div",{className:"flex gap-2",children:["pending"===j.status&&(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>D(j.operation_id),disabled:g===j.operation_id,children:[g===j.operation_id?(0,ep.jsx)(tH.default,{className:"w-3 h-3 animate-spin mr-1"}):(0,ep.jsx)(tU.X,{className:"w-3 h-3 mr-1"}),"Cancel"]}),("failed"===j.status||"cancelled"===j.status)&&(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>L(j.operation_id),disabled:x===j.operation_id,children:[x===j.operation_id?(0,ep.jsx)(tH.default,{className:"w-3 h-3 animate-spin mr-1"}):(0,ep.jsx)(Uh,{className:"w-3 h-3 mr-1"}),"Retry"]})]}),j.result_metadata&&Object.keys(j.result_metadata).length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Metadata"}),(0,ep.jsx)("pre",{className:"rounded-lg border bg-muted/30 p-3 text-xs font-mono overflow-x-auto max-h-96 whitespace-pre-wrap break-words",children:JSON.stringify(j.result_metadata,null,2)})]}),j.error_message&&(0,ep.jsxs)("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-3",children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-red-600 dark:text-red-400 mb-1",children:"Error"}),(0,ep.jsx)("div",{className:"text-sm text-red-600/80 dark:text-red-400/80 font-mono",children:j.error_message})]}),j.child_operations&&j.child_operations.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"text-sm font-medium text-muted-foreground mb-2",children:["Sub-batches (",j.result_metadata?.num_sub_batches||j.child_operations.length,")"]}),(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-[60px]",children:"Index"}),(0,ep.jsx)(eJ,{className:"w-[100px]",children:"ID"}),(0,ep.jsx)(eJ,{className:"w-[80px]",children:"Items"}),(0,ep.jsx)(eJ,{children:"Status"})]})}),(0,ep.jsx)(eZ,{children:j.child_operations.map(e=>(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(e0,{className:"text-sm",children:e.sub_batch_index}),(0,ep.jsx)(e0,{className:"font-mono text-xs text-muted-foreground",children:e.operation_id.substring(0,8)}),(0,ep.jsx)(e0,{className:"text-sm",children:e.items_count}),(0,ep.jsxs)(e0,{children:["pending"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400",children:[(0,ep.jsx)(eG,{className:"w-3 h-3"}),"pending"]}),"processing"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400",children:[(0,ep.jsx)(tH.default,{className:"w-3 h-3 animate-spin"}),"processing"]}),"failed"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400",title:e.error_message??void 0,children:[(0,ep.jsx)(jy,{className:"w-3 h-3"}),"failed"]}),"completed"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",children:[(0,ep.jsx)(eY,{className:"w-3 h-3"}),"completed"]}),"cancelled"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-gray-500/10 text-gray-600 dark:text-gray-400",children:[(0,ep.jsx)(Up,{className:"w-3 h-3"}),"cancelled"]})]})]},e.operation_id))})]})]}),(e=A===j.operation_id,t=!!j.task_payload,n=!!j.result_metadata?.is_parent,(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Raw payload"}),!e&&(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:R,disabled:S,children:[S?(0,ep.jsx)(tH.default,{className:"w-3 h-3 mr-1 animate-spin"}):(0,ep.jsx)(Uf,{className:"w-3 h-3 mr-1"}),"Load raw"]})]}),t?(0,ep.jsx)("pre",{className:"rounded-lg border bg-muted/30 p-3 text-xs font-mono overflow-x-auto max-h-96 whitespace-pre-wrap break-words",children:JSON.stringify(j.task_payload,null,2)}):e?(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:n?"This is a parent operation — the raw payload is stored on each sub-batch. Open a child operation to inspect its payload.":"No raw payload stored for this operation."}):(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Shows the full parameters the operation was submitted with (may be large)."})]}))]})}):null]})})]}):null}var tH=tH;let Uv=(0,eN.default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);function Ux(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(!1),[a,o]=(0,em.useState)("files"),[s,l]=(0,em.useState)(""),[c,u]=(0,em.useState)(1),[d,h]=(0,em.useState)(!1),[f,p]=(0,em.useState)(null),[g,v]=(0,em.useState)(null),[x,y]=(0,em.useState)([]),[b,w]=(0,em.useState)("any"),[j,N]=(0,em.useState)(!1),[k,E]=(0,em.useState)(null),[C,_]=(0,em.useState)(null),[S,T]=(0,em.useState)(!1),A=t.filter(e=>{if(!s)return!0;let t=s.toLowerCase();return e.id.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.source_query.toLowerCase().includes(t)||e.content.toLowerCase().includes(t)}),O=async()=>{if(e){i(!0);try{let t=await eD.client.listMentalModels(e,x.length>0?x:void 0,x.length>0?b:void 0);n(t.items||[])}catch(e){console.error("Error loading mental models:",e)}finally{i(!1)}}},[M,P]=(0,em.useState)(new Set),D=async t=>{if(!e)return;let r=t.last_refreshed_at;P(e=>new Set(e).add(t.id));try{await eD.client.refreshMentalModel(e,t.id);for(let i=0;i<120;i++){await new Promise(e=>setTimeout(e,1e3));let i=await eD.client.getMentalModel(e,t.id);if(i.last_refreshed_at!==r){n(e=>e.map(e=>e.id===t.id?i:e)),f?.id===t.id&&p(i),ev.toast.success("Mental model refreshed");return}}ev.toast.error("Refresh timeout")}catch{}finally{P(e=>{let n=new Set(e);return n.delete(t.id),n})}},L=async()=>{if(e&&C){T(!0);try{await eD.client.deleteMentalModel(e,C.id),n(e=>e.filter(e=>e.id!==C.id)),f?.id===C.id&&p(null),_(null)}catch(e){}finally{T(!1)}}};if((0,em.useEffect)(()=>{e&&O()},[e,x,b]),(0,em.useEffect)(()=>{let e=e=>{"Escape"===e.key&&p(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),(0,em.useEffect)(()=>{u(1)},[s,x,b]),!e)return(0,ep.jsx)(m7,{children:(0,ep.jsx)(gn,{className:"p-10 text-center",children:(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Select a memory bank to view mental models."})})});let I=Math.ceil(A.length/100),R=(c-1)*100,B=R+100,z=A.slice(R,B);return(0,ep.jsxs)("div",{children:[r?(0,ep.jsxs)("div",{className:"text-center py-12",children:[(0,ep.jsx)(eW,{className:"w-8 h-8 mx-auto mb-3 text-muted-foreground animate-spin"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Loading..."})]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"mb-4 flex items-center gap-3 flex-wrap",children:[(0,ep.jsx)(eI.Input,{type:"text",value:s,onChange:e=>l(e.target.value),placeholder:"Filter mental models by name, query, or content...",className:"w-80 h-9"}),(0,ep.jsx)(fR,{value:x,onChange:y,fetchSuggestions:async t=>{if(!e)return[];let n=t?`${t}*`:void 0;return(await eD.client.listTags(e,n,20,"mental_models")).items.map(e=>e.tag)},matchMode:b,onMatchModeChange:w,className:"flex-1 min-w-[260px]"}),(0,ep.jsxs)(eL.Button,{onClick:()=>h(!0),size:"sm",children:[(0,ep.jsx)(fz.Plus,{className:"w-4 h-4 mr-2"}),"Add Mental Model"]})]}),(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:s||x.length>0?`${A.length} of ${t.length} mental models`:`${t.length} mental model${1!==t.length?"s":""}`}),(0,ep.jsx)("div",{className:"flex items-center gap-3",children:(0,ep.jsxs)("div",{className:"flex items-center gap-2 bg-muted rounded-lg p-1",children:[(0,ep.jsxs)("button",{onClick:()=>o("files"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"files"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(jG,{className:"w-4 h-4"}),"List"]}),(0,ep.jsxs)("button",{onClick:()=>o("dashboard"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"dashboard"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(Uv,{className:"w-4 h-4"}),"Dashboard"]})]})})]}),A.length>0?(0,ep.jsxs)(ep.Fragment,{children:["dashboard"===a&&(0,ep.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:z.map(e=>(0,ep.jsx)(m7,{className:`cursor-pointer transition-all hover:shadow-md hover:border-primary/50 ${f?.id===e.id?"border-primary shadow-md":""}`,onClick:()=>p(e),children:(0,ep.jsxs)(gn,{className:"p-4",children:[(0,ep.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("h3",{className:"font-semibold text-foreground mb-1 truncate",children:e.name}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground truncate",children:e.id}),(0,ep.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium flex-shrink-0 ${e.trigger?.refresh_after_consolidation?"bg-green-500/10 text-green-600 dark:text-green-400":"bg-slate-500/10 text-slate-600 dark:text-slate-400"}`,children:e.trigger?.refresh_after_consolidation?"Auto Refresh":"Manual"})]})]}),(0,ep.jsx)(Uy,{m:e,refreshing:M.has(e.id),onEdit:e=>{E(e),N(!0)},onRefresh:D,onDelete:e=>_({id:e.id,name:e.name}),triggerClassName:"h-7 w-7 ml-2 flex-shrink-0"})]}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:e.source_query}),(0,ep.jsxs)("div",{className:"relative mb-3 border-t border-border pt-3 max-h-40 overflow-hidden",children:[(0,ep.jsx)(wq,{children:e.content}),(0,ep.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-card to-transparent"})]}),(0,ep.jsxs)("div",{className:"flex items-center justify-between text-xs border-t border-border pt-3",children:[(0,ep.jsx)("div",{className:"flex items-center gap-2",children:e.tags.length>0&&(0,ep.jsxs)("div",{className:"flex gap-1",children:[e.tags.slice(0,2).map(e=>(0,ep.jsx)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-blue-500/10 text-blue-600 dark:text-blue-400",children:e},e)),e.tags.length>2&&(0,ep.jsxs)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-muted text-muted-foreground",children:["+",e.tags.length-2]})]})}),(0,ep.jsx)("div",{className:"text-muted-foreground",title:wJ(e.last_refreshed_at),children:wQ(e.last_refreshed_at)})]})]})},e.id))}),"files"===a&&(0,ep.jsx)(Uj,{mentalModels:A,selectedId:g,onSelect:v,onOpenDetail:p,refreshingIds:M,onEdit:e=>{E(e),N(!0)},onRefresh:D,onDelete:e=>_({id:e.id,name:e.name})}),"files"!==a&&I>1&&(0,ep.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t",children:[(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground",children:[R+1,"-",Math.min(B,A.length)," of"," ",A.length]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>u(1),disabled:1===c,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eF,{className:"h-3 w-3"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>u(e=>Math.max(1,e-1)),disabled:1===c,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eS,{className:"h-3 w-3"})}),(0,ep.jsxs)("span",{className:"text-xs px-2",children:[c," / ",I]}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>u(e=>Math.min(I,e+1)),disabled:c===I,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eT.ChevronRight,{className:"h-3 w-3"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>u(I),disabled:c===I,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eV,{className:"h-3 w-3"})})]})]})]}):(0,ep.jsxs)("div",{className:"p-6 border border-dashed border-border rounded-lg text-center",children:[(0,ep.jsx)(ek,{className:"w-6 h-6 mx-auto mb-2 text-muted-foreground"}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:s?"No mental models match your filter":"No mental models yet. Create a mental model to generate and save a summary from your memories."})]})]}),(0,ep.jsx)(Ub,{open:d,onClose:()=>h(!1),onCreated:()=>{h(!1),O()}}),(0,ep.jsx)(mv,{open:!!C,onOpenChange:e=>!e&&_(null),children:(0,ep.jsxs)(mD,{children:[(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mR,{children:"Delete Mental Model"}),(0,ep.jsxs)(mB,{children:["Are you sure you want to delete"," ",(0,ep.jsxs)("span",{className:"font-semibold",children:['"',C?.name,'"']}),"?",(0,ep.jsx)("br",{}),(0,ep.jsx)("br",{}),(0,ep.jsx)("span",{className:"text-destructive font-semibold",children:"This action cannot be undone."})]})]}),(0,ep.jsxs)(mI,{className:"flex-row justify-end space-x-2",children:[(0,ep.jsx)(mF,{className:"mt-0",children:"Cancel"}),(0,ep.jsxs)(mz,{onClick:L,disabled:S,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[S?(0,ep.jsx)(tH.default,{className:"w-4 h-4 animate-spin mr-1"}):null,"Delete"]})]})]})}),(0,ep.jsx)(w9,{mentalModelId:f?.id??null,onClose:()=>p(null),onDelete:e=>_({id:e.id,name:e.name}),onEdit:e=>{E(e),N(!0)},onRefreshed:e=>{n(t=>t.map(t=>t.id===e.id?e:t)),p(e)}}),k&&(0,ep.jsx)(Uw,{open:j,mentalModel:k,onClose:()=>{N(!1),E(null)},onUpdated:e=>{n(t=>t.map(t=>t.id===e.id?e:t)),p(e),N(!1),E(null)}})]})}function Uy({m:e,refreshing:t,onEdit:n,onRefresh:r,onDelete:i,triggerClassName:a}){return(0,ep.jsxs)(p5,{children:[(0,ep.jsx)(p4,{asChild:!0,children:(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",className:`p-0 text-muted-foreground ${a??"h-8 w-8"}`,onClick:e=>e.stopPropagation(),"aria-label":"Actions",children:(0,ep.jsx)(mH,{className:"h-4 w-4"})})}),(0,ep.jsxs)(ml,{align:"end",onClick:e=>e.stopPropagation(),children:[(0,ep.jsxs)(mc,{onClick:()=>n(e),children:[(0,ep.jsx)(mU,{className:"h-4 w-4 mr-2"}),"Edit"]}),(0,ep.jsxs)(mc,{onClick:()=>r(e),disabled:t,children:[(0,ep.jsx)(eW,{className:`h-4 w-4 mr-2 ${t?"animate-spin":""}`}),"Refresh Manually"]}),(0,ep.jsx)(mu,{}),(0,ep.jsxs)(mc,{onClick:()=>i(e),className:"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400 focus:bg-red-500/10",children:[(0,ep.jsx)(mV,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})}function Ub({open:e,onClose:t,onCreated:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)(!1),[o,s]=(0,em.useState)({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),l=async()=>{if(r&&o.name.trim()&&o.sourceQuery.trim()){a(!0);try{let e,t=o.tags.split(",").map(e=>e.trim()).filter(e=>e.length>0),i=parseInt(o.maxTokens)||2048,a=o.excludeMentalModelIds.split(",").map(e=>e.trim()).filter(e=>e.length>0);if(o.tagGroups.trim())try{e=JSON.parse(o.tagGroups.trim())}catch{ev.toast.error("Invalid JSON in Tag Groups field");return}let l=o.recallMaxTokens.trim()?parseInt(o.recallMaxTokens,10):void 0,c=o.recallChunksMaxTokens.trim()?parseInt(o.recallChunksMaxTokens,10):void 0,u="true"===o.includeChunks||"false"!==o.includeChunks&&void 0;await eD.client.createMentalModel(r,{id:o.id.trim()||void 0,name:o.name.trim(),source_query:o.sourceQuery.trim(),tags:t.length>0?t:void 0,max_tokens:i,trigger:{mode:o.mode,refresh_after_consolidation:o.autoRefresh,fact_types:o.factTypes.length>0?o.factTypes:void 0,exclude_mental_models:o.excludeMentalModels||void 0,exclude_mental_model_ids:a.length>0?a:void 0,tags_match:o.tagsMatch||void 0,tag_groups:e,include_chunks:u,recall_max_tokens:l,recall_chunks_max_tokens:c}}),s({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),n()}catch(e){}finally{a(!1)}}};return(0,ep.jsx)(tY.Dialog,{open:e,onOpenChange:e=>{e||(s({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),t())},children:(0,ep.jsxs)(tY.DialogContent,{className:"sm:max-w-2xl max-h-[90vh] flex flex-col",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsx)(tY.DialogTitle,{children:"Create Mental Model"}),(0,ep.jsx)(tY.DialogDescription,{children:"Create a mental model by running a query. The content will be auto-generated and can be refreshed later."})]}),(0,ep.jsxs)(t$.Tabs,{defaultValue:"general",className:"py-2 flex-1 flex flex-col min-h-0 overflow-hidden",children:[(0,ep.jsxs)(t$.TabsList,{className:"w-full",children:[(0,ep.jsx)(t$.TabsTrigger,{value:"general",className:"flex-1",children:"General"}),(0,ep.jsx)(t$.TabsTrigger,{value:"options",className:"flex-1",children:"Options"})]}),(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto mt-2 pr-1",children:[(0,ep.jsxs)(t$.TabsContent,{value:"general",className:"space-y-4 pt-4",children:[(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"ID"}),(0,ep.jsx)(eI.Input,{value:o.id,onChange:e=>s({...o,id:e.target.value}),placeholder:"e.g., team-communication"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Name *"}),(0,ep.jsx)(eI.Input,{value:o.name,onChange:e=>s({...o,name:e.target.value}),placeholder:"e.g., Team Communication Preferences"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Source Query *"}),(0,ep.jsx)(eI.Input,{value:o.sourceQuery,onChange:e=>s({...o,sourceQuery:e.target.value}),placeholder:"e.g., How does the team prefer to communicate?"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Max Tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:o.maxTokens,onChange:e=>s({...o,maxTokens:e.target.value}),placeholder:"2048",min:"256",max:"8192"})]})]}),(0,ep.jsxs)(t$.TabsContent,{value:"options",className:"space-y-6 pt-4",children:[(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Refresh"}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(m2.Checkbox,{id:"auto-refresh",checked:o.autoRefresh,onCheckedChange:e=>s({...o,autoRefresh:!0===e})}),(0,ep.jsx)("label",{htmlFor:"auto-refresh",className:"text-sm font-medium text-foreground cursor-pointer",children:"Auto-refresh after consolidation"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Refresh mode"}),(0,ep.jsxs)(tR.Select,{value:o.mode,onValueChange:e=>s({...o,mode:e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"full",children:"Full — regenerate from scratch each refresh"}),(0,ep.jsx)(tR.SelectItem,{value:"delta",children:"Delta — surgical edits, preserve unchanged content"})]})]}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Delta mode applies minimal changes to the existing content. Falls back to a full rewrite on the first refresh and whenever the source query changes."})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Other Mental Models"}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(m2.Checkbox,{id:"exclude-mental-models",checked:o.excludeMentalModels,onCheckedChange:e=>s({...o,excludeMentalModels:!0===e})}),(0,ep.jsx)("label",{htmlFor:"exclude-mental-models",className:"text-sm font-medium text-foreground cursor-pointer",children:"Exclude all mental models"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Exclude Mental Model IDs"}),(0,ep.jsx)(eI.Input,{value:o.excludeMentalModelIds,onChange:e=>s({...o,excludeMentalModelIds:e.target.value}),placeholder:"e.g., model-a, model-b (comma-separated)"})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Tags"}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tags"}),(0,ep.jsx)(eI.Input,{value:o.tags,onChange:e=>s({...o,tags:e.target.value}),placeholder:"e.g., project-x, team-alpha (comma-separated)"}),(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Tags scope the model during reflect ",(0,ep.jsx)("strong",{children:"and"})," filter source memories during refresh (default ",(0,ep.jsx)("code",{children:"all_strict"}),": only memories carrying every listed tag are read). If no memories have these tags yet, refresh will produce empty content — backfill tags on memories, or adjust ",(0,ep.jsx)("em",{children:"Tags Match"})," /"," ",(0,ep.jsx)("em",{children:"Tag Groups"})," below."]})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tags Match"}),(0,ep.jsxs)(tR.Select,{value:o.tagsMatch,onValueChange:e=>s({...o,tagsMatch:"default"===e?"":e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{placeholder:"Default (all_strict when tags set)"})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"default",children:"Default (all_strict when tags set)"}),(0,ep.jsx)(tR.SelectItem,{value:"any",children:"any — OR matching, includes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"all",children:"all — AND matching, includes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"any_strict",children:"any_strict — OR matching, excludes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"all_strict",children:"all_strict — AND matching, excludes untagged"})]})]}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Controls how the model's tags filter memories during refresh."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tag Groups (JSON)"}),(0,ep.jsx)(gl.Textarea,{value:o.tagGroups,onChange:e=>s({...o,tagGroups:e.target.value}),placeholder:'e.g., [{"or": [{"tags": ["user:alice"], "match": "all_strict"}, {"tags": ["shared"]}]}]',rows:3,className:"font-mono text-xs"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Compound boolean tag expressions for refresh filtering. Overrides flat tags when set."})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Recall"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Override how the internal recall behaves when this model refreshes. Leave blank to inherit the bank/global default."}),(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Fact Types"}),(0,ep.jsx)(m8,{value:o.factTypes,onChange:e=>s({...o,factTypes:e})}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Leave empty to include all types."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Include chunks"}),(0,ep.jsxs)(tR.Select,{value:o.includeChunks||"default",onValueChange:e=>s({...o,includeChunks:"default"===e?"":e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"default",children:"Default (inherit)"}),(0,ep.jsx)(tR.SelectItem,{value:"true",children:"Yes — include raw chunk text"}),(0,ep.jsx)(tR.SelectItem,{value:"false",children:"No — skip chunks (smaller prompt)"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Recall max tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:o.recallMaxTokens,onChange:e=>s({...o,recallMaxTokens:e.target.value}),placeholder:"Default (inherit)",min:"0"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Token budget for facts returned by recall."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Recall chunks max tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:o.recallChunksMaxTokens,onChange:e=>s({...o,recallChunksMaxTokens:e.target.value}),placeholder:"Default (inherit)",min:"0"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Token budget for raw chunk text returned by recall."})]})]})]})]})]}),(0,ep.jsxs)(tY.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:t,disabled:i,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:l,disabled:i||!o.name.trim()||!o.sourceQuery.trim(),children:i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.default,{className:"w-4 h-4 animate-spin mr-1"}),"Generating..."]}):"Create"})]})]})})}function Uw({open:e,mentalModel:t,onClose:n,onUpdated:r}){let{currentBank:i}=(0,ey.useBank)(),[a,o]=(0,em.useState)(!1),s=()=>({name:t.name,sourceQuery:t.source_query,maxTokens:String(t.max_tokens||2048),tags:t.tags.join(", "),autoRefresh:t.trigger?.refresh_after_consolidation||!1,mode:t.trigger?.mode||"full",factTypes:t.trigger?.fact_types||[],excludeMentalModels:t.trigger?.exclude_mental_models||!1,excludeMentalModelIds:(t.trigger?.exclude_mental_model_ids||[]).join(", "),tagsMatch:t.trigger?.tags_match||"",tagGroups:t.trigger?.tag_groups?JSON.stringify(t.trigger.tag_groups,null,2):"",includeChunks:t.trigger?.include_chunks===!0?"true":t.trigger?.include_chunks===!1?"false":"",recallMaxTokens:t.trigger?.recall_max_tokens!=null?String(t.trigger.recall_max_tokens):"",recallChunksMaxTokens:t.trigger?.recall_chunks_max_tokens!=null?String(t.trigger.recall_chunks_max_tokens):""}),[l,c]=(0,em.useState)(s);(0,em.useEffect)(()=>{e&&c(s())},[e,t]);let u=async()=>{if(i&&l.name.trim()&&l.sourceQuery.trim()){o(!0);try{let e,a=l.tags.split(",").map(e=>e.trim()).filter(e=>e.length>0),o=parseInt(l.maxTokens)||2048,s=l.excludeMentalModelIds.split(",").map(e=>e.trim()).filter(e=>e.length>0);if(l.tagGroups.trim())try{e=JSON.parse(l.tagGroups.trim())}catch{ev.toast.error("Invalid JSON in Tag Groups field");return}let c=l.recallMaxTokens.trim()?parseInt(l.recallMaxTokens,10):void 0,u=l.recallChunksMaxTokens.trim()?parseInt(l.recallChunksMaxTokens,10):void 0,d="true"===l.includeChunks||"false"!==l.includeChunks&&void 0,h=await eD.client.updateMentalModel(i,t.id,{name:l.name.trim(),source_query:l.sourceQuery.trim(),tags:a.length>0?a:void 0,max_tokens:o,trigger:{mode:l.mode,refresh_after_consolidation:l.autoRefresh,fact_types:l.factTypes.length>0?l.factTypes:void 0,exclude_mental_models:l.excludeMentalModels||void 0,exclude_mental_model_ids:s.length>0?s:void 0,tags_match:l.tagsMatch||void 0,tag_groups:e,include_chunks:d,recall_max_tokens:c,recall_chunks_max_tokens:u}});r(h),n()}catch(e){}finally{o(!1)}}};return(0,ep.jsx)(tY.Dialog,{open:e,onOpenChange:e=>!e&&n(),children:(0,ep.jsxs)(tY.DialogContent,{className:"sm:max-w-2xl max-h-[90vh] flex flex-col",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsx)(tY.DialogTitle,{children:"Update Mental Model"}),(0,ep.jsx)(tY.DialogDescription,{children:"Update the mental model configuration. Changes will take effect immediately."})]}),(0,ep.jsxs)(t$.Tabs,{defaultValue:"general",className:"py-2 flex-1 flex flex-col min-h-0 overflow-hidden",children:[(0,ep.jsxs)(t$.TabsList,{className:"w-full",children:[(0,ep.jsx)(t$.TabsTrigger,{value:"general",className:"flex-1",children:"General"}),(0,ep.jsx)(t$.TabsTrigger,{value:"options",className:"flex-1",children:"Options"})]}),(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto mt-2 pr-1",children:[(0,ep.jsxs)(t$.TabsContent,{value:"general",className:"space-y-4 pt-4",children:[(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),(0,ep.jsx)(eI.Input,{value:t.id,disabled:!0,className:"bg-muted"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Name *"}),(0,ep.jsx)(eI.Input,{value:l.name,onChange:e=>c({...l,name:e.target.value}),placeholder:"e.g., Team Communication Preferences"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Source Query *"}),(0,ep.jsx)(eI.Input,{value:l.sourceQuery,onChange:e=>c({...l,sourceQuery:e.target.value}),placeholder:"e.g., How does the team prefer to communicate?"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Max Tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:l.maxTokens,onChange:e=>c({...l,maxTokens:e.target.value}),placeholder:"2048",min:"256",max:"8192"})]})]}),(0,ep.jsxs)(t$.TabsContent,{value:"options",className:"space-y-6 pt-4",children:[(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Refresh"}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(m2.Checkbox,{id:"update-auto-refresh",checked:l.autoRefresh,onCheckedChange:e=>c({...l,autoRefresh:!0===e})}),(0,ep.jsx)("label",{htmlFor:"update-auto-refresh",className:"text-sm font-medium text-foreground cursor-pointer",children:"Auto-refresh after consolidation"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Refresh mode"}),(0,ep.jsxs)(tR.Select,{value:l.mode,onValueChange:e=>c({...l,mode:e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"full",children:"Full — regenerate from scratch each refresh"}),(0,ep.jsx)(tR.SelectItem,{value:"delta",children:"Delta — surgical edits, preserve unchanged content"})]})]}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Delta mode applies minimal changes to the existing content. Falls back to a full rewrite on the first refresh and whenever the source query changes."})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Other Mental Models"}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(m2.Checkbox,{id:"update-exclude-mental-models",checked:l.excludeMentalModels,onCheckedChange:e=>c({...l,excludeMentalModels:!0===e})}),(0,ep.jsx)("label",{htmlFor:"update-exclude-mental-models",className:"text-sm font-medium text-foreground cursor-pointer",children:"Exclude all mental models"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Exclude Mental Model IDs"}),(0,ep.jsx)(eI.Input,{value:l.excludeMentalModelIds,onChange:e=>c({...l,excludeMentalModelIds:e.target.value}),placeholder:"e.g., model-a, model-b (comma-separated)"})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Tags"}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tags"}),(0,ep.jsx)(eI.Input,{value:l.tags,onChange:e=>c({...l,tags:e.target.value}),placeholder:"e.g., project-x, team-alpha (comma-separated)"}),(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Tags scope the model during reflect ",(0,ep.jsx)("strong",{children:"and"})," filter source memories during refresh (default ",(0,ep.jsx)("code",{children:"all_strict"}),": only memories carrying every listed tag are read). If no memories have these tags yet, refresh will produce empty content — backfill tags on memories, or adjust ",(0,ep.jsx)("em",{children:"Tags Match"})," /"," ",(0,ep.jsx)("em",{children:"Tag Groups"})," below."]})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tags Match"}),(0,ep.jsxs)(tR.Select,{value:l.tagsMatch||"default",onValueChange:e=>c({...l,tagsMatch:"default"===e?"":e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{placeholder:"Default (all_strict when tags set)"})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"default",children:"Default (all_strict when tags set)"}),(0,ep.jsx)(tR.SelectItem,{value:"any",children:"any — OR matching, includes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"all",children:"all — AND matching, includes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"any_strict",children:"any_strict — OR matching, excludes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"all_strict",children:"all_strict — AND matching, excludes untagged"})]})]}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Controls how the model's tags filter memories during refresh."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tag Groups (JSON)"}),(0,ep.jsx)(gl.Textarea,{value:l.tagGroups,onChange:e=>c({...l,tagGroups:e.target.value}),placeholder:'e.g., [{"or": [{"tags": ["user:alice"], "match": "all_strict"}, {"tags": ["shared"]}]}]',rows:3,className:"font-mono text-xs"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Compound boolean tag expressions for refresh filtering. Overrides flat tags when set."})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Recall"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Override how the internal recall behaves when this model refreshes. Leave blank to inherit the bank/global default."}),(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Fact Types"}),(0,ep.jsx)(m8,{value:l.factTypes,onChange:e=>c({...l,factTypes:e})}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Leave empty to include all types."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Include chunks"}),(0,ep.jsxs)(tR.Select,{value:l.includeChunks||"default",onValueChange:e=>c({...l,includeChunks:"default"===e?"":e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"default",children:"Default (inherit)"}),(0,ep.jsx)(tR.SelectItem,{value:"true",children:"Yes — include raw chunk text"}),(0,ep.jsx)(tR.SelectItem,{value:"false",children:"No — skip chunks (smaller prompt)"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Recall max tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:l.recallMaxTokens,onChange:e=>c({...l,recallMaxTokens:e.target.value}),placeholder:"Default (inherit)",min:"0"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Token budget for facts returned by recall."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Recall chunks max tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:l.recallChunksMaxTokens,onChange:e=>c({...l,recallChunksMaxTokens:e.target.value}),placeholder:"Default (inherit)",min:"0"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Token budget for raw chunk text returned by recall."})]})]})]})]})]}),(0,ep.jsxs)(tY.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:n,disabled:a,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:u,disabled:a||!l.name.trim()||!l.sourceQuery.trim(),children:a?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.default,{className:"w-4 h-4 animate-spin mr-1"}),"Updating..."]}):"Update"})]})]})})}function Uj({mentalModels:e,selectedId:t,onSelect:n,onOpenDetail:r,refreshingIds:i,onEdit:a,onRefresh:o,onDelete:s}){let l=t&&e.some(e=>e.id===t)?t:e[0]?.id??null,c=e.find(e=>e.id===l)??null;return(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-[320px_1fr] gap-0 overflow-hidden min-h-[600px]",children:[(0,ep.jsx)("aside",{className:"border-r border-border bg-muted/30 overflow-y-auto max-h-[calc(100vh-260px)]",children:(0,ep.jsx)("ul",{className:"py-1",children:e.map(e=>{let t=e.id===l;return(0,ep.jsx)("li",{children:(0,ep.jsxs)("button",{onClick:()=>n(e.id),className:`w-full flex items-start gap-2 px-3 py-2 text-left transition-colors border-l-2 ${t?"bg-primary/10 border-primary text-foreground":"border-transparent text-muted-foreground hover:bg-muted hover:text-foreground"}`,title:`${e.name}
9
- ${e.source_query}`,children:[(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5 flex-shrink-0 mt-0.5"}),(0,ep.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:`truncate text-sm font-medium ${t?"text-foreground":""}`,children:e.name}),(0,ep.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground flex-shrink-0",title:wJ(e.last_refreshed_at),children:wQ(e.last_refreshed_at)})]}),e.source_query&&(0,ep.jsx)("div",{className:"text-xs text-muted-foreground/80 truncate italic mt-0.5",children:e.source_query})]})]})},e.id)})})}),(0,ep.jsx)("section",{className:"overflow-y-auto max-h-[calc(100vh-260px)]",children:c?(0,ep.jsxs)("article",{className:"p-6",children:[(0,ep.jsx)("header",{className:"mb-4 pb-4 border-b border-border",children:(0,ep.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,ep.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ep.jsx)("h2",{className:"text-xl font-semibold text-foreground",children:c.name}),c.source_query&&(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground mt-1 italic",children:["“",c.source_query,"”"]}),(0,ep.jsxs)("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[(0,ep.jsxs)("span",{title:wJ(c.last_refreshed_at),children:["Refreshed ",wQ(c.last_refreshed_at)]}),c.tags.length>0&&(0,ep.jsx)("div",{className:"flex gap-1",children:c.tags.map(e=>(0,ep.jsx)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-blue-500/10 text-blue-600 dark:text-blue-400",children:e},e))})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>r(c),children:"Open"}),(0,ep.jsx)(Uy,{m:c,refreshing:i.has(c.id),onEdit:a,onRefresh:o,onDelete:s})]})]})}),c.content?(0,ep.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:(0,ep.jsx)(wq,{children:c.content})}):(0,ep.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"No content yet. Refresh this mental model to generate content."})]}):(0,ep.jsxs)("div",{className:"p-10 text-center text-muted-foreground",children:[(0,ep.jsx)(eC.FileText,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),(0,ep.jsx)("p",{className:"text-sm",children:"Select a mental model to view its content."})]})})]})}let UN=(0,eN.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var tH=tH;let Uk=["consolidation.completed","retain.completed"],UE={url:"",secret:"",event_types:["consolidation.completed"],enabled:!0,http_config:{method:"POST",timeout_seconds:30,headers:[],params:[]}};function UC(e){return Object.fromEntries(e.filter(e=>e.key.trim()).map(e=>[e.key,e.value]))}function U_(e){return{method:e.method,timeout_seconds:e.timeout_seconds,headers:UC(e.headers),params:UC(e.params)}}function US({label:e,pairs:t,onChange:n}){let r=(e,r,i)=>{n(t.map((t,n)=>n===e?{...t,[r]:i}:t))};return(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)(e8,{children:e}),(0,ep.jsxs)(eL.Button,{type:"button",variant:"ghost",size:"sm",className:"h-6 text-xs px-2",onClick:()=>n([...t,{key:"",value:""}]),children:[(0,ep.jsx)(fz.Plus,{className:"w-3 h-3 mr-1"}),"Add"]})]}),t.length>0&&(0,ep.jsx)("div",{className:"space-y-1.5",children:t.map((e,i)=>(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(eI.Input,{placeholder:"Key",value:e.key,onChange:e=>r(i,"key",e.target.value),className:"h-8 text-sm flex-1"}),(0,ep.jsx)(eI.Input,{placeholder:"Value",value:e.value,onChange:e=>r(i,"value",e.target.value),className:"h-8 text-sm flex-1"}),(0,ep.jsx)("button",{type:"button",onClick:()=>n(t.filter((e,t)=>t!==i)),className:"text-muted-foreground hover:text-foreground shrink-0",children:(0,ep.jsx)(tU.X,{className:"w-4 h-4"})})]},i))})]})}function UT({delivery:e,formatDate:t}){var n;let[r,i]=(0,em.useState)(!1),a=e.last_response_body||e.last_error;return(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)(eQ,{className:a?"cursor-pointer hover:bg-muted/40":void 0,onClick:()=>a&&i(e=>!e),children:[(0,ep.jsx)(e0,{className:"w-8 pl-3 pr-0",children:a?r?(0,ep.jsx)(mW.ChevronDown,{className:"w-4 h-4 text-muted-foreground"}):(0,ep.jsx)(eT.ChevronRight,{className:"w-4 h-4 text-muted-foreground"}):(0,ep.jsx)("span",{className:"w-4 h-4 inline-block"})}),(0,ep.jsx)(e0,{children:"completed"===(n=e.status)?(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ep.jsx)(eY,{className:"w-3 h-3"}),"delivered"]}):"pending"===n?(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,ep.jsx)(eG,{className:"w-3 h-3"}),"pending"]}):"failed"===n?(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,ep.jsx)(jy,{className:"w-3 h-3"}),"failed"]}):(0,ep.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground border border-border",children:n})}),(0,ep.jsx)(e0,{children:null!=e.last_response_status?(0,ep.jsx)("span",{className:`font-mono text-xs px-1.5 py-0.5 rounded border ${e.last_response_status>=200&&e.last_response_status<300?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20"}`,children:e.last_response_status}):(0,ep.jsx)("span",{className:"text-muted-foreground text-xs",children:"—"})}),(0,ep.jsx)(e0,{className:"text-center text-sm",children:e.attempts}),(0,ep.jsx)(e0,{className:"font-mono text-xs text-muted-foreground",children:e.event_type}),(0,ep.jsx)(e0,{className:"text-xs text-muted-foreground whitespace-nowrap",children:t(e.created_at)})]}),r&&a&&(0,ep.jsx)(eQ,{className:"bg-muted/20 hover:bg-muted/20",children:(0,ep.jsx)(e0,{colSpan:6,className:"px-4 py-3",children:(0,ep.jsxs)("div",{className:"space-y-3",children:[e.last_error&&(0,ep.jsxs)("div",{className:"space-y-1",children:[(0,ep.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Error"}),(0,ep.jsx)("p",{className:"font-mono text-xs text-red-600 dark:text-red-400 break-all",children:e.last_error})]}),e.last_response_body&&(0,ep.jsxs)("div",{className:"space-y-1",children:[(0,ep.jsxs)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:["Response Body",e.last_attempt_at&&(0,ep.jsxs)("span",{className:"ml-2 normal-case font-normal",children:["· ",t(e.last_attempt_at)]})]}),(0,ep.jsx)("pre",{className:"font-mono text-xs bg-background rounded p-2 overflow-x-auto whitespace-pre-wrap break-all max-h-40 overflow-y-auto border border-border",children:e.last_response_body})]})]})})})]})}function UA(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(!1),[a,o]=(0,em.useState)(!1),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)(null),[d,h]=(0,em.useState)(null),[f,p]=(0,em.useState)(!1),[g,v]=(0,em.useState)(UE),[x,y]=(0,em.useState)(!1),[b,w]=(0,em.useState)(null),[j,N]=(0,em.useState)(UE),[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(!1),[A,O]=(0,em.useState)(!1),[M,P]=(0,em.useState)(null),[D,L]=(0,em.useState)([]),[I,R]=(0,em.useState)(!1),[B,z]=(0,em.useState)(null),[F,V]=(0,em.useState)(!1),U=async()=>{if(e){i(!0);try{let t=await eD.client.listWebhooks(e);n(t.items||[])}catch(e){console.error("Error loading webhooks:",e)}finally{i(!1)}}};(0,em.useEffect)(()=>{e&&U()},[e]);let H=async()=>{if(e&&g.url){l(!0);try{await eD.client.createWebhook(e,{url:g.url,secret:g.secret||void 0,event_types:g.event_types.length>0?g.event_types:void 0,enabled:g.enabled,http_config:U_(g.http_config)}),o(!1),v(UE),p(!1),await U()}catch(e){}finally{l(!1)}}},W=async t=>{if(e){u(t),h(null);try{await eD.client.deleteWebhook(e,t),await U()}catch(e){}finally{u(null)}}},Y=async()=>{if(e&&b&&j.url){T(!0);try{let t={url:j.url,event_types:j.event_types,enabled:j.enabled,http_config:U_(j.http_config)};C?t.secret=null:j.secret&&(t.secret=j.secret),await eD.client.updateWebhook(e,b.id,t),y(!1),await U()}catch{}finally{T(!1)}}},G=async t=>{if(e){P(t),O(!0),L([]),z(null),R(!0);try{let n=await eD.client.listWebhookDeliveries(e,t.id,50);L(n.items||[]),z(n.next_cursor??null)}catch(e){console.error("Error loading deliveries:",e)}finally{R(!1)}}},$=async()=>{if(e&&M&&B){V(!0);try{let t=await eD.client.listWebhookDeliveries(e,M.id,50,B);L(e=>[...e,...t.items||[]]),z(t.next_cursor??null)}catch(e){console.error("Error loading more deliveries:",e)}finally{V(!1)}}},X=e=>e?new Date(e).toLocaleString():"N/A";return e?(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("h3",{className:"text-lg font-semibold",children:"Webhooks"}),(0,ep.jsx)("button",{onClick:()=>U(),className:"p-1 rounded hover:bg-muted transition-colors",title:"Refresh webhooks",disabled:r,children:(0,ep.jsx)(eW,{className:`w-4 h-4 text-muted-foreground hover:text-foreground ${r?"animate-spin":""}`})})]}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground",children:[t.length," webhook",1!==t.length?"s":""]})]}),(0,ep.jsxs)(eL.Button,{size:"sm",onClick:()=>o(!0),children:[(0,ep.jsx)(fz.Plus,{className:"w-4 h-4 mr-2"}),"Add Webhook"]})]}),t.length>0?(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{children:"URL"}),(0,ep.jsx)(eJ,{children:"Method"}),(0,ep.jsx)(eJ,{children:"Event Types"}),(0,ep.jsx)(eJ,{children:"Status"}),(0,ep.jsx)(eJ,{children:"Created At"}),(0,ep.jsx)(eJ,{className:"w-[120px]"})]})}),(0,ep.jsx)(eZ,{children:t.map(e=>(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(e0,{className:"font-mono text-sm max-w-[300px] truncate",children:(0,ep.jsx)("span",{title:e.url,children:e.url})}),(0,ep.jsx)(e0,{children:(0,ep.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-mono font-medium bg-muted text-muted-foreground border border-border",children:e.http_config?.method||"POST"})}),(0,ep.jsx)(e0,{children:(0,ep.jsx)("div",{className:"flex flex-wrap gap-1",children:e.event_types.length>0?e.event_types.map(e=>(0,ep.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/20",children:e},e)):(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:"All events"})})}),(0,ep.jsx)(e0,{children:e.enabled?(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ep.jsx)(eY,{className:"w-3 h-3"}),"Enabled"]}):(0,ep.jsx)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground border border-border",children:"Disabled"})}),(0,ep.jsx)(e0,{className:"text-sm text-muted-foreground",children:X(e.created_at)}),(0,ep.jsx)(e0,{children:(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsxs)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>G(e),title:"View deliveries",children:[(0,ep.jsx)(eH,{className:"w-3 h-3 mr-1"}),"Deliveries"]}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{let t;return w(e),void(N((t=e.http_config??{method:"POST",timeout_seconds:30,headers:{},params:{}},{url:e.url,secret:"",event_types:e.event_types,enabled:e.enabled,http_config:{method:t.method,timeout_seconds:t.timeout_seconds,headers:Object.entries(t.headers??{}).map(([e,t])=>({key:e,value:t})),params:Object.entries(t.params??{}).map(([e,t])=>({key:e,value:t}))}})),E(!1),_(!1),y(!0))},title:"Edit webhook",children:(0,ep.jsx)(mU,{className:"w-3 h-3"})}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-red-600 dark:hover:text-red-400",onClick:()=>h(e),disabled:c===e.id,title:"Delete webhook",children:c===e.id?(0,ep.jsx)(tH.default,{className:"w-3 h-3 animate-spin"}):(0,ep.jsx)(mV,{className:"w-3 h-3"})})]})})]},e.id))})]})}):(0,ep.jsx)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:"No webhooks configured. Add a webhook to receive event notifications."}),(0,ep.jsx)(tY.Dialog,{open:a,onOpenChange:e=>{e||(v(UE),p(!1)),o(e)},children:(0,ep.jsxs)(tY.DialogContent,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsx)(tY.DialogTitle,{children:"Add Webhook"}),(0,ep.jsx)(tY.DialogDescription,{children:"Configure a webhook endpoint to receive event notifications."})]}),(0,ep.jsxs)("div",{className:"space-y-4 py-2",children:[(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{children:"Type"}),(0,ep.jsx)("div",{className:"flex items-center h-9 px-3 rounded-md border border-border bg-muted text-sm text-muted-foreground",children:"HTTP"})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsxs)(e8,{htmlFor:"webhook-url",children:["URL ",(0,ep.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,ep.jsx)(eI.Input,{id:"webhook-url",type:"url",placeholder:"https://example.com/webhook",value:g.url,onChange:e=>v(t=>({...t,url:e.target.value}))})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{children:"Method"}),(0,ep.jsxs)(tR.Select,{value:g.http_config.method,onValueChange:e=>v(t=>({...t,http_config:{...t.http_config,method:e}})),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"POST",children:"POST"}),(0,ep.jsx)(tR.SelectItem,{value:"GET",children:"GET"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{htmlFor:"webhook-timeout",children:"Timeout (seconds)"}),(0,ep.jsx)(eI.Input,{id:"webhook-timeout",type:"number",min:1,max:300,value:g.http_config.timeout_seconds,onChange:e=>v(t=>({...t,http_config:{...t.http_config,timeout_seconds:parseInt(e.target.value)||30}}))})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsxs)(e8,{htmlFor:"webhook-secret",children:["Secret ",(0,ep.jsx)("span",{className:"text-muted-foreground text-xs",children:"(optional)"})]}),(0,ep.jsxs)("div",{className:"relative",children:[(0,ep.jsx)(eI.Input,{id:"webhook-secret",type:f?"text":"password",placeholder:"Signing secret",value:g.secret,onChange:e=>v(t=>({...t,secret:e.target.value})),className:"pr-10"}),(0,ep.jsx)("button",{type:"button",onClick:()=>p(e=>!e),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:f?(0,ep.jsx)(UN,{className:"w-4 h-4"}):(0,ep.jsx)(eH,{className:"w-4 h-4"})})]})]}),(0,ep.jsx)(US,{label:"Custom Headers",pairs:g.http_config.headers,onChange:e=>v(t=>({...t,http_config:{...t.http_config,headers:e}}))}),(0,ep.jsx)(US,{label:"Query Parameters",pairs:g.http_config.params,onChange:e=>v(t=>({...t,http_config:{...t.http_config,params:e}}))}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)(e8,{children:"Event Types"}),(0,ep.jsx)("div",{className:"space-y-2",children:Uk.map(e=>(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(m2.Checkbox,{id:`event-${e}`,checked:g.event_types.includes(e),onCheckedChange:()=>{v(t=>({...t,event_types:t.event_types.includes(e)?t.event_types.filter(t=>t!==e):[...t.event_types,e]}))}}),(0,ep.jsx)(e8,{htmlFor:`event-${e}`,className:"font-mono text-sm cursor-pointer",children:e})]},e))})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsx)(tI.Switch,{id:"webhook-enabled",checked:g.enabled,onCheckedChange:e=>v(t=>({...t,enabled:e}))}),(0,ep.jsx)(e8,{htmlFor:"webhook-enabled",children:"Enabled"})]})]}),(0,ep.jsxs)(tY.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:()=>o(!1),disabled:s,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:H,disabled:s||!g.url,children:s?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):"Create Webhook"})]})]})}),(0,ep.jsx)(tY.Dialog,{open:x,onOpenChange:e=>{e||(w(null),N(UE),E(!1),_(!1)),y(e)},children:(0,ep.jsxs)(tY.DialogContent,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsx)(tY.DialogTitle,{children:"Edit Webhook"}),(0,ep.jsx)(tY.DialogDescription,{children:"Update the webhook configuration."})]}),(0,ep.jsxs)("div",{className:"space-y-4 py-2",children:[(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{children:"Type"}),(0,ep.jsx)("div",{className:"flex items-center h-9 px-3 rounded-md border border-border bg-muted text-sm text-muted-foreground",children:"HTTP"})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsxs)(e8,{htmlFor:"edit-webhook-url",children:["URL ",(0,ep.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,ep.jsx)(eI.Input,{id:"edit-webhook-url",type:"url",placeholder:"https://example.com/webhook",value:j.url,onChange:e=>N(t=>({...t,url:e.target.value}))})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{children:"Method"}),(0,ep.jsxs)(tR.Select,{value:j.http_config.method,onValueChange:e=>N(t=>({...t,http_config:{...t.http_config,method:e}})),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"POST",children:"POST"}),(0,ep.jsx)(tR.SelectItem,{value:"GET",children:"GET"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{htmlFor:"edit-webhook-timeout",children:"Timeout (seconds)"}),(0,ep.jsx)(eI.Input,{id:"edit-webhook-timeout",type:"number",min:1,max:300,value:j.http_config.timeout_seconds,onChange:e=>N(t=>({...t,http_config:{...t.http_config,timeout_seconds:parseInt(e.target.value)||30}}))})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{htmlFor:"edit-webhook-secret",children:"Secret"}),(0,ep.jsxs)("div",{className:"relative",children:[(0,ep.jsx)(eI.Input,{id:"edit-webhook-secret",type:k?"text":"password",placeholder:"Leave blank to keep existing",value:j.secret,disabled:C,onChange:e=>N(t=>({...t,secret:e.target.value})),className:"pr-10"}),(0,ep.jsx)("button",{type:"button",onClick:()=>E(e=>!e),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:k?(0,ep.jsx)(UN,{className:"w-4 h-4"}):(0,ep.jsx)(eH,{className:"w-4 h-4"})})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,ep.jsx)(m2.Checkbox,{id:"edit-clear-secret",checked:C,onCheckedChange:e=>{_(!!e),e&&N(e=>({...e,secret:""}))}}),(0,ep.jsx)(e8,{htmlFor:"edit-clear-secret",className:"text-xs text-muted-foreground cursor-pointer",children:"Clear existing secret"})]})]}),(0,ep.jsx)(US,{label:"Custom Headers",pairs:j.http_config.headers,onChange:e=>N(t=>({...t,http_config:{...t.http_config,headers:e}}))}),(0,ep.jsx)(US,{label:"Query Parameters",pairs:j.http_config.params,onChange:e=>N(t=>({...t,http_config:{...t.http_config,params:e}}))}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)(e8,{children:"Event Types"}),(0,ep.jsx)("div",{className:"space-y-2",children:Uk.map(e=>(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(m2.Checkbox,{id:`edit-event-${e}`,checked:j.event_types.includes(e),onCheckedChange:()=>N(t=>({...t,event_types:t.event_types.includes(e)?t.event_types.filter(t=>t!==e):[...t.event_types,e]}))}),(0,ep.jsx)(e8,{htmlFor:`edit-event-${e}`,className:"font-mono text-sm cursor-pointer",children:e})]},e))})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsx)(tI.Switch,{id:"edit-webhook-enabled",checked:j.enabled,onCheckedChange:e=>N(t=>({...t,enabled:e}))}),(0,ep.jsx)(e8,{htmlFor:"edit-webhook-enabled",children:"Enabled"})]})]}),(0,ep.jsxs)(tY.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:()=>y(!1),disabled:S,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:Y,disabled:S||!j.url,children:S?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})}),(0,ep.jsx)(tY.Dialog,{open:!!d,onOpenChange:e=>{e||h(null)},children:(0,ep.jsxs)(tY.DialogContent,{className:"max-w-md",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsx)(tY.DialogTitle,{children:"Delete Webhook"}),(0,ep.jsx)(tY.DialogDescription,{children:"Are you sure you want to delete this webhook? This action cannot be undone and all pending deliveries will be cancelled."})]}),d&&(0,ep.jsx)("div",{className:"py-2",children:(0,ep.jsx)("p",{className:"font-mono text-sm truncate text-muted-foreground bg-muted px-3 py-2 rounded-md border border-border",children:d.url})}),(0,ep.jsxs)(tY.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),(0,ep.jsx)(eL.Button,{variant:"destructive",onClick:()=>d&&W(d.id),disabled:!!c,children:c?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Deleting..."]}):"Delete Webhook"})]})]})}),(0,ep.jsx)(tY.Dialog,{open:A,onOpenChange:e=>{e||(L([]),z(null)),O(e)},children:(0,ep.jsxs)(tY.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsx)(tY.DialogTitle,{children:"Webhook Deliveries"}),M&&(0,ep.jsx)(tY.DialogDescription,{className:"font-mono text-xs truncate",children:M.url})]}),I?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)(tH.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):D.length>0?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-8 pl-3 pr-0"}),(0,ep.jsx)(eJ,{children:"Status"}),(0,ep.jsx)(eJ,{children:"HTTP"}),(0,ep.jsx)(eJ,{className:"text-center",children:"Attempts"}),(0,ep.jsx)(eJ,{children:"Event"}),(0,ep.jsx)(eJ,{children:"Created At"})]})}),(0,ep.jsx)(eZ,{children:D.map(e=>(0,ep.jsx)(UT,{delivery:e,formatDate:X},e.id))})]})}),B&&(0,ep.jsx)("div",{className:"flex justify-center pt-2",children:(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",onClick:$,disabled:F,children:[F&&(0,ep.jsx)(tH.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Load more"]})})]}):(0,ep.jsx)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:"No deliveries yet for this webhook."})]})})]}):null}var UO=["axis"],UM=(0,em.forwardRef)((e,t)=>em.createElement(Rk,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:UO,tooltipPayloadSearcher:Eu,categoricalChartProps:e,ref:t})),UP=em,UD=["children"],UL=(0,em.createContext)({data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0});function UI(e){var{children:t}=e,n=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,UD);return em.createElement(UL.Provider,{value:n},t)}var UR=(e,t,n,r)=>P1(e,"xAxis",t,r),UB=(e,t,n,r)=>P0(e,"xAxis",t,r),Uz=(e,t,n,r)=>P1(e,"yAxis",n,r),UF=(e,t,n,r)=>P0(e,"yAxis",n,r),UV=ke([_A,UR,Uz,UB,UF],(e,t,n,r,i)=>Cq(e,"xAxis")?C2(t,r,!1):C2(n,i,!1));function UU(e){return"line"===e.type}var UH=ke([MM,(e,t,n,r,i)=>i],(e,t)=>e.filter(UU).find(e=>e.id===t)),UW=ke([_A,UR,Uz,UB,UF,UH,UV,OC],(e,t,n,r,i,a,o,s)=>{var l,{chartData:c,dataStartIndex:u,dataEndIndex:d}=s;if(null!=a&&null!=t&&null!=n&&null!=r&&null!=i&&0!==r.length&&0!==i.length&&null!=o&&("horizontal"===e||"vertical"===e)){var{dataKey:h,data:f}=a;if(null!=(l=null!=f&&f.length>0?f:null==c?void 0:c.slice(u,d+1)))return function(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,dataKey:o,bandSize:s,displayedData:l}=e;return l.map((e,l)=>{var c=CX(e,o);if("horizontal"===t)return{x:CJ({axis:n,ticks:i,bandSize:s,entry:e,index:l}),y:null==c?null:r.scale(c),value:c,payload:e};var u=null==c?null:n.scale(c),d=CJ({axis:r,ticks:a,bandSize:s,entry:e,index:l});return null==u||null==d?null:{x:u,y:d,value:c,payload:e}}).filter(Boolean)}({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:h,bandSize:o,displayedData:l})}}),UY=e.i(7328);function UG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U$(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?UG(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):UG(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function UX(){return(UX=Object.assign.bind()).apply(null,arguments)}function Uq(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var UK=(e,t,n,r,i)=>{var a=n-r;return k4(ec||(ec=Uq(["M ",",",""])),e,t)+k4(eu||(eu=Uq(["L ",",",""])),e+n,t)+k4(ed||(ed=Uq(["L ",",",""])),e+n-a/2,t+i)+k4(eh||(eh=Uq(["L ",",",""])),e+n-a/2-r,t+i)+k4(ef||(ef=Uq(["L ",","," Z"])),e,t)},UZ={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},UQ=e=>{var t=Rw(e,UZ),{x:n,y:r,upperWidth:i,lowerWidth:a,height:o,className:s}=t,{animationEasing:l,animationDuration:c,animationBegin:u,isUpdateAnimationActive:d}=t,h=(0,em.useRef)(null),[f,p]=(0,em.useState)(-1),g=(0,em.useRef)(i),v=(0,em.useRef)(a),x=(0,em.useRef)(o),y=(0,em.useRef)(n),b=(0,em.useRef)(r),w=z_(e,"trapezoid-");if((0,em.useEffect)(()=>{if(h.current&&h.current.getTotalLength)try{var e=h.current.getTotalLength();e&&p(e)}catch(e){}},[]),n!==+n||r!==+r||i!==+i||a!==+a||o!==+o||0===i&&0===a||0===o)return null;var j=(0,_u.clsx)("recharts-trapezoid",s);if(!d)return em.createElement("g",null,em.createElement("path",UX({},IG(t),{className:j,d:UK(n,r,i,a,o)})));var N=g.current,k=v.current,E=x.current,C=y.current,_=b.current,S="0px ".concat(-1===f?1:f,"px"),T="".concat(f,"px 0px"),A=zD(["strokeDasharray"],c,l);return em.createElement(zQ,{animationId:w,key:w,canBegin:f>0,duration:c,easing:l,isActive:d,begin:u},e=>{var s=Ea(N,i,e),l=Ea(k,a,e),c=Ea(E,o,e),u=Ea(C,n,e),d=Ea(_,r,e);h.current&&(g.current=s,v.current=l,x.current=c,y.current=u,b.current=d);var f=e>0?{transition:A,strokeDasharray:T}:{strokeDasharray:S};return em.createElement("path",UX({},IG(t),{className:j,d:UK(u,d,s,l,c),ref:h,style:U$(U$({},f),t.style)}))})};let UJ=Math.cos,U0=Math.sin,U1=Math.sqrt,U2=Math.PI,U5=2*U2;U1(3);let U3={draw(e,t){let n=U1(t/U2);e.moveTo(n,0),e.arc(0,0,n,0,U5)}},U4=U1(1/3),U6=2*U4,U8=U0(U2/10)/U0(7*U2/10),U7=U0(U5/10)*U8,U9=-UJ(U5/10)*U8,He=U1(3);U1(3);let Ht=U1(3)/2,Hn=1/U1(12),Hr=(Hn/2+1)*3;var Hi=["type","size","sizeType"];function Ha(){return(Ha=Object.assign.bind()).apply(null,arguments)}function Ho(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ho(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ho(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Hl={symbolCircle:U3,symbolCross:{draw(e,t){let n=U1(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},symbolDiamond:{draw(e,t){let n=U1(t/U6),r=n*U4;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},symbolSquare:{draw(e,t){let n=U1(t),r=-n/2;e.rect(r,r,n,n)}},symbolStar:{draw(e,t){let n=U1(.8908130915292852*t),r=U7*n,i=U9*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=U5*t/5,o=UJ(a),s=U0(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},symbolTriangle:{draw(e,t){let n=-U1(t/(3*He));e.moveTo(0,2*n),e.lineTo(-He*n,-n),e.lineTo(He*n,-n),e.closePath()}},symbolWye:{draw(e,t){let n=U1(t/Hr),r=n/2,i=n*Hn,a=n*Hn+n,o=-r;e.moveTo(r,i),e.lineTo(r,a),e.lineTo(o,a),e.lineTo(-.5*r-Ht*i,Ht*r+-.5*i),e.lineTo(-.5*r-Ht*a,Ht*r+-.5*a),e.lineTo(-.5*o-Ht*a,Ht*o+-.5*a),e.lineTo(-.5*r+Ht*i,-.5*i-Ht*r),e.lineTo(-.5*r+Ht*a,-.5*a-Ht*r),e.lineTo(-.5*o+Ht*a,-.5*a-Ht*o),e.closePath()}}},Hc=Math.PI/180,Hu=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,i=Hs(Hs({},function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Hi)),{},{type:t,size:n,sizeType:r}),a="circle";"string"==typeof t&&(a=t);var{className:o,cx:s,cy:l}=i,c=IG(i);return k9(s)&&k9(l)&&k9(n)?em.createElement("path",Ha({},c,{className:(0,_u.clsx)("recharts-symbols",o),transform:"translate(".concat(s,", ").concat(l,")"),d:(()=>{var e,t=(e=a,Hl["symbol".concat(Es(e))]||U3),i=(function(e,t){let n=null,r=RL(i);function i(){let i;if(n||(n=i=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return e="function"==typeof e?e:CB(e||U3),t="function"==typeof t?t:CB(void 0===t?64:+t),i.type=function(t){return arguments.length?(e="function"==typeof t?t:CB(t),i):e},i.size=function(e){return arguments.length?(t="function"==typeof e?e:CB(+e),i):t},i.context=function(e){return arguments.length?(n=null==e?null:e,i):n},i})().type(t).size(((e,t,n)=>{if("area"===t)return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":var r=18*Hc;return 1.25*e*e*(Math.tan(r)-Math.tan(2*r)*Math.tan(r)**2);case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}})(n,r,a))();if(null!==i)return i})()})):null};Hu.registerSymbol=(e,t)=>{Hl["symbol".concat(Es(e))]=t};var Hd=["option","shapeType","activeClassName"];function Hh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hh(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hh(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Hp(e){var{shapeType:t,elementProps:n}=e;switch(t){case"rectangle":return em.createElement(Vd,n);case"trapezoid":return em.createElement(UQ,n);case"sector":return em.createElement(Vx,n);case"symbols":if("symbols"===t)return em.createElement(Hu,n);break;case"curve":return em.createElement(Bn,n);default:return null}}function Hm(e){var t,{option:n,shapeType:r,activeClassName:i="recharts-active-shape"}=e,a=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Hd);if((0,em.isValidElement)(n))t=(0,em.cloneElement)(n,Hf(Hf({},a),(0,em.isValidElement)(n)?n.props:n));else if("function"==typeof n)t=n(a,a.index);else if((0,UY.default)(n)&&"boolean"!=typeof n){var o=Hf(Hf({},a),n);t=em.createElement(Hp,{shapeType:r,elementProps:o})}else t=em.createElement(Hp,{shapeType:r,elementProps:a});return a.isActive?em.createElement(Ba,{className:i},t):t}var Hg=["id"],Hv=["type","layout","connectNulls","needClip","shape"],Hx=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function Hy(){return(Hy=Object.assign.bind()).apply(null,arguments)}function Hb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hw(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hb(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hb(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Hj(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var HN=UP.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:l,tooltipType:c,id:u}=e,d={dataDefinedOnItem:n,positions:void 0,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:C3(o,t),hide:s,type:c,color:r,unit:l,graphicalItemId:u}};return UP.createElement(zh,{tooltipEntrySettings:d})}),Hk=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function HE(e){var{clipPathId:t,points:n,props:r}=e,{dot:i,dataKey:a,needClip:o}=r,{id:s}=r,l=IW(Hj(r,Hg));return UP.createElement(zs,{points:n,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:a,baseProps:l,needClip:o,clipPathId:t})}function HC(e){var{showLabels:t,children:n,points:r}=e,i=(0,UP.useMemo)(()=>null==r?void 0:r.map(e=>{var t,n,r={x:null!=(t=e.x)?t:0,y:null!=(n=e.y)?n:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Hw(Hw({},r),{},{value:e.value,payload:e.payload,viewBox:r,parentViewBox:void 0,fill:void 0})}),[r]);return UP.createElement(B4,{value:t?i:void 0},n)}function H_(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:i,props:a}=e,{type:o,layout:s,connectNulls:l,needClip:c,shape:u}=a,d=Hw(Hw({},IG(Hj(a,Hv))),{},{fill:"none",className:"recharts-line-curve",clipPath:c?"url(#clipPath-".concat(t,")"):void 0,points:r,type:o,layout:s,connectNulls:l,strokeDasharray:null!=i?i:a.strokeDasharray});return UP.createElement(UP.Fragment,null,(null==r?void 0:r.length)>1&&UP.createElement(Hm,Hy({shapeType:"curve",option:u},d,{pathRef:n})),UP.createElement(HE,{points:r,clipPathId:t,props:a}))}function HS(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:i,longestAnimatedLengthRef:a}=e,{points:o,strokeDasharray:s,isAnimationActive:l,animationBegin:c,animationDuration:u,animationEasing:d,animateNewValues:h,width:f,height:p,onAnimationEnd:g,onAnimationStart:v}=n,x=i.current,y=z_(o,"recharts-line-"),b=(0,UP.useRef)(y),[w,j]=(0,UP.useState)(!1),N=(0,UP.useCallback)(()=>{"function"==typeof g&&g(),j(!1)},[g]),k=(0,UP.useCallback)(()=>{"function"==typeof v&&v(),j(!0)},[v]),E=function(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch(e){return 0}}(r.current),C=(0,UP.useRef)(0);b.current!==y&&(C.current=a.current,b.current=y);var _=C.current;return UP.createElement(HC,{points:o,showLabels:!w},n.children,UP.createElement(zQ,{animationId:y,begin:c,duration:u,isActive:l,easing:d,onAnimationEnd:N,onAnimationStart:k,key:y},e=>{var c,u=Math.min(Ea(_,E+_,e),E);if(c=l?s?((e,t,n)=>{var r=n.reduce((e,t)=>e+t);if(!r)return Hk(t,e);for(var i=Math.floor(e/r),a=e%r,o=t-e,s=[],l=0,c=0;l<n.length;c+=n[l],++l)if(c+n[l]>a){s=[...n.slice(0,l),a-c];break}var u=s.length%2==0?[0,o]:[o];return[...function(e,t){for(var n=e.length%2!=0?[...e,0]:e,r=[],i=0;i<t;++i)r=[...r,...n];return r}(n,i),...s,...u].map(e=>"".concat(e,"px")).join(", ")})(u,E,"".concat(s).split(/[,\s]+/gim).map(e=>parseFloat(e))):Hk(E,u):null==s?void 0:String(s),e>0&&E>0&&(i.current=o,a.current=Math.max(a.current,u)),x){var d=x.length/o.length,g=1===e?o:o.map((t,n)=>{var r=Math.floor(n*d);if(x[r]){var i=x[r];return Hw(Hw({},t),{},{x:Ea(i.x,t.x,e),y:Ea(i.y,t.y,e)})}return h?Hw(Hw({},t),{},{x:Ea(2*f,t.x,e),y:Ea(p/2,t.y,e)}):Hw(Hw({},t),{},{x:t.x,y:t.y})});return i.current=g,UP.createElement(H_,{props:n,points:g,clipPathId:t,pathRef:r,strokeDasharray:c})}return UP.createElement(H_,{props:n,points:o,clipPathId:t,pathRef:r,strokeDasharray:c})}),UP.createElement(B7,{label:n.label}))}function HT(e){var{clipPathId:t,props:n}=e,r=(0,UP.useRef)(null),i=(0,UP.useRef)(0),a=(0,UP.useRef)(null);return UP.createElement(HS,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:i,pathRef:a})}var HA=(e,t)=>{var n,r;return{x:null!=(n=e.x)?n:void 0,y:null!=(r=e.y)?r:void 0,value:e.value,errorVal:CX(e.payload,t)}};class HO extends UP.Component{render(){var{hide:e,dot:t,points:n,className:r,xAxisId:i,yAxisId:a,top:o,left:s,width:l,height:c,id:u,needClip:d,zIndex:h}=this.props;if(e)return null;var f=(0,_u.clsx)("recharts-line",r),{r:p,strokeWidth:g}=zJ(t),v=zt(t),x=2*p+g,y=d?"url(#clipPath-".concat(v?"":"dots-").concat(u,")"):void 0;return UP.createElement(BR,{zIndex:h},UP.createElement(Ba,{className:f},d&&UP.createElement("defs",null,UP.createElement(zp,{clipPathId:u,xAxisId:i,yAxisId:a}),!v&&UP.createElement("clipPath",{id:"clipPath-dots-".concat(u)},UP.createElement("rect",{x:s-x/2,y:o-x/2,width:l+x,height:c+x}))),UP.createElement(UI,{xAxisId:i,yAxisId:a,data:n,dataPointFormatter:HA,errorBarOffset:0},UP.createElement(HT,{props:this.props,clipPathId:u}))),UP.createElement(zd,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:y}))}}var HM={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:O1.line,type:"linear"};function HP(e){var t=Rw(e,HM),{activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:s,dot:l,hide:c,isAnimationActive:u,label:d,legendType:h,xAxisId:f,yAxisId:p,id:g}=t,v=Hj(t,Hx),{needClip:x}=zf(f,p),y=CD(Rm),b=CD(_A),w=_s(),j=CD(e=>UW(e,f,p,w,g));if("horizontal"!==b&&"vertical"!==b||null==j||null==y)return null;var{height:N,width:k,x:E,y:C}=y;return UP.createElement(HO,Hy({},v,{id:g,connectNulls:s,dot:l,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:c,label:d,legendType:h,xAxisId:f,yAxisId:p,points:j,layout:b,height:N,width:k,left:E,top:C,needClip:x}))}var HD=UP.memo(function(e){var t=Rw(e,HM),n=_s();return UP.createElement(zA,{id:t.id,type:"line"},e=>UP.createElement(UP.Fragment,null,UP.createElement(zC,{legendPayload:(e=>{var{dataKey:t,name:n,stroke:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:C3(n,t),payload:e}]})(t)}),UP.createElement(HN,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),UP.createElement(zO,{type:"line",id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),UP.createElement(HP,Hy({},t,{id:e}))))},IL);HD.displayName="Line";let HL=[{value:"all",label:"All actions"},{value:"retain",label:"Retain"},{value:"recall",label:"Recall"},{value:"reflect",label:"Reflect"},{value:"create_bank",label:"Create Bank"},{value:"update_bank",label:"Update Bank"},{value:"delete_bank",label:"Delete Bank"},{value:"clear_memories",label:"Clear Memories"},{value:"consolidation",label:"Consolidation"},{value:"batch_retain",label:"Batch Retain"},{value:"create_mental_model",label:"Create Mental Model"},{value:"refresh_mental_model",label:"Refresh Mental Model"},{value:"delete_mental_model",label:"Delete Mental Model"},{value:"create_directive",label:"Create Directive"},{value:"delete_directive",label:"Delete Directive"},{value:"file_convert_retain",label:"File Convert & Retain"},{value:"webhook_delivery",label:"Webhook Delivery"}],HI=[{value:"all",label:"All transports"},{value:"http",label:"HTTP"},{value:"mcp",label:"MCP"},{value:"system",label:"System"}],HR=[{value:"1d",label:"Today"},{value:"7d",label:"Last 7 days"},{value:"30d",label:"Last 30 days"}];function HB(e,t){if(!e||!t)return"—";let n=new Date(e).getTime(),r=new Date(t).getTime()-n;return r<1e3?`${r}ms`:r<6e4?`${(r/1e3).toFixed(1)}s`:`${(r/6e4).toFixed(1)}m`}function Hz(e){return e?new Date(e).toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"—"}function HF({transport:e}){let t={http:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",mcp:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",system:"bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-300"};return(0,ep.jsx)("span",{className:`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${t[e]||t.system}`,children:e})}function HV({bankId:e}){let[t,n]=(0,em.useState)("7d"),[r,i]=(0,em.useState)(null),[a,o]=(0,em.useState)([]),[s,l]=(0,em.useState)("day"),[c,u]=(0,em.useState)(!1),d=(0,em.useCallback)(async(n=t,i=r)=>{u(!0);try{let t=await eD.client.getAuditLogStats(e,{period:n,action:i||void 0});o(t.buckets||[]),l(t.trunc||"day")}catch(e){console.error("Error loading audit stats:",e)}finally{u(!1)}},[e,t,r]);(0,em.useEffect)(()=>{d()},[e]);let h=a.map(e=>{var t;let n;return{time:(t=e.time,n=new Date(t),"hour"===s?n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):n.toLocaleDateString(void 0,{month:"short",day:"numeric"})),total:e.total}});return(0,ep.jsxs)(m7,{children:[(0,ep.jsxs)(m9,{className:"pb-2 flex flex-row items-center justify-between space-y-0 gap-3",children:[(0,ep.jsx)(ge,{className:"text-sm font-semibold",children:"Request Volume"}),(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsxs)(tR.Select,{value:r||"all",onValueChange:e=>{let n="all"===e?null:e;i(n),d(t,n)},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-[160px] h-8 text-xs",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsx)(tR.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:HL.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e.value,children:e.label},e.value))})]}),HR.map(e=>(0,ep.jsx)(eL.Button,{variant:t===e.value?"default":"outline",size:"sm",className:"h-8 text-xs",onClick:()=>{n(e.value),d(e.value,r)},children:e.label},e.value))]})]}),(0,ep.jsx)(gn,{children:(0,ep.jsx)("div",{className:"h-[120px]",children:c?(0,ep.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading..."}):0===h.length?(0,ep.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"No data for this period"}):(0,ep.jsx)(_E,{width:"100%",height:"100%",children:(0,ep.jsxs)(UM,{data:h,margin:{top:5,right:5,bottom:0,left:5},children:[(0,ep.jsx)(Fz,{dataKey:"time",tick:{fontSize:10},axisLine:!1,tickLine:!1,className:"text-muted-foreground"}),(0,ep.jsx)(VM,{contentStyle:{backgroundColor:"var(--popover)",border:"1px solid var(--border)",borderRadius:"6px",fontSize:"12px",padding:"4px 8px"}}),(0,ep.jsx)(HD,{type:"monotone",dataKey:"total",stroke:"var(--primary)",strokeWidth:2,dot:!1,activeDot:{r:3}})]})})})})]})}function HU(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(0),[a,o]=(0,em.useState)(null),[s,l]=(0,em.useState)(null),[c,u]=(0,em.useState)("all"),[d]=(0,em.useState)(20),[h,f]=(0,em.useState)(0),[p,g]=(0,em.useState)(!1),[v,x]=(0,em.useState)(null),[y,b]=(0,em.useState)(!1),w=(0,em.useCallback)(e=>{if("all"===e)return{};let t=new Date,n=new Date;return"1h"===e?n.setHours(t.getHours()-1):"1d"===e?n.setDate(t.getDate()-1):"7d"===e?n.setDate(t.getDate()-7):"30d"===e&&n.setDate(t.getDate()-30),{start_date:n.toISOString()}},[]),j=(0,em.useCallback)(async(t=a,r=s,o=c,l=h)=>{if(e){g(!0);try{let a=w(o),s=await eD.client.listAuditLogs(e,{action:t||void 0,transport:r||void 0,start_date:a.start_date,end_date:a.end_date,limit:d,offset:l});n(s.items||[]),i(s.total||0)}catch(e){console.error("Error loading audit logs:",e)}finally{g(!1)}}},[e,a,s,c,h,d,w]),N=e=>{f(e),j(a,s,c,e)};(0,em.useEffect)(()=>{e&&j(a,s,c,h)},[e]);let k=Math.ceil(r/d),E=Math.floor(h/d)+1;return e?(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(HV,{bankId:e}),(0,ep.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,ep.jsxs)(tR.Select,{value:a||"all",onValueChange:e=>{let t="all"===e?null:e;o(t),f(0),j(t,s,c,0)},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-[180px]",children:(0,ep.jsx)(tR.SelectValue,{placeholder:"All actions"})}),(0,ep.jsx)(tR.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:HL.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e.value,children:e.label},e.value))})]}),(0,ep.jsxs)(tR.Select,{value:s||"all",onValueChange:e=>{let t="all"===e?null:e;l(t),f(0),j(a,t,c,0)},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-[160px]",children:(0,ep.jsx)(tR.SelectValue,{placeholder:"All transports"})}),(0,ep.jsx)(tR.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:HI.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e.value,children:e.label},e.value))})]}),(0,ep.jsxs)(tR.Select,{value:c,onValueChange:e=>{u(e),f(0),j(a,s,e,0)},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-[150px]",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{position:"popper",children:[(0,ep.jsx)(tR.SelectItem,{value:"all",children:"All time"}),(0,ep.jsx)(tR.SelectItem,{value:"1h",children:"Last hour"}),(0,ep.jsx)(tR.SelectItem,{value:"1d",children:"Last 24 hours"}),(0,ep.jsx)(tR.SelectItem,{value:"7d",children:"Last 7 days"}),(0,ep.jsx)(tR.SelectItem,{value:"30d",children:"Last 30 days"})]})]}),(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",onClick:()=>j(a,s,c,h),disabled:p,children:[(0,ep.jsx)(eW,{className:`w-4 h-4 mr-1 ${p?"animate-spin":""}`}),"Refresh"]}),(0,ep.jsxs)("span",{className:"text-sm text-muted-foreground ml-auto",children:[r," ",1===r?"entry":"entries"]})]}),(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-[200px]",children:"Time"}),(0,ep.jsx)(eJ,{children:"Action"}),(0,ep.jsx)(eJ,{className:"w-[100px]",children:"Transport"}),(0,ep.jsx)(eJ,{className:"w-[100px]",children:"Duration"})]})}),(0,ep.jsx)(eZ,{children:0===t.length?(0,ep.jsx)(eQ,{children:(0,ep.jsx)(e0,{colSpan:4,className:"text-center text-muted-foreground py-8",children:p?"Loading...":"No audit logs found"})}):t.map(e=>(0,ep.jsxs)(eQ,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>{x(e),b(!0)},children:[(0,ep.jsx)(e0,{className:"text-sm font-mono",children:Hz(e.started_at)}),(0,ep.jsx)(e0,{className:"font-medium",children:e.action}),(0,ep.jsx)(e0,{children:(0,ep.jsx)(HF,{transport:e.transport})}),(0,ep.jsx)(e0,{className:"text-sm text-muted-foreground font-mono",children:HB(e.started_at,e.ended_at)})]},e.id))})]}),k>1&&(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("span",{className:"text-sm text-muted-foreground",children:["Page ",E," of ",k]}),(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",onClick:()=>N(Math.max(0,h-d)),disabled:0===h,children:[(0,ep.jsx)(eS,{className:"w-4 h-4 mr-1"}),"Previous"]}),(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",onClick:()=>N(h+d),disabled:h+d>=r,children:["Next",(0,ep.jsx)(eT.ChevronRight,{className:"w-4 h-4 ml-1"})]})]})]}),(0,ep.jsx)(tY.Dialog,{open:y,onOpenChange:b,children:(0,ep.jsxs)(tY.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[(0,ep.jsx)(tY.DialogHeader,{children:(0,ep.jsxs)(tY.DialogTitle,{children:["Audit Log: ",v?.action]})}),v&&(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Action:"})," ",(0,ep.jsx)("span",{className:"font-medium",children:v.action})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Transport:"})," ",(0,ep.jsx)(HF,{transport:v.transport})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Started:"})," ",(0,ep.jsx)("span",{className:"font-mono",children:Hz(v.started_at)})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Duration:"})," ",(0,ep.jsx)("span",{className:"font-mono",children:HB(v.started_at,v.ended_at)})]})]}),v.request&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h4",{className:"text-sm font-semibold mb-2",children:"Request"}),(0,ep.jsx)("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto max-h-[200px] overflow-y-auto",children:JSON.stringify(v.request,null,2)})]}),v.response&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h4",{className:"text-sm font-semibold mb-2",children:"Response"}),(0,ep.jsx)("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto max-h-[200px] overflow-y-auto",children:JSON.stringify(v.response,null,2)})]}),v.metadata&&Object.keys(v.metadata).length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h4",{className:"text-sm font-semibold mb-2",children:"Metadata"}),(0,ep.jsx)("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto",children:JSON.stringify(v.metadata,null,2)})]})]})]})})]}):null}let HH=(0,eN.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);var tH=tH;e.s(["default",0,function(){(0,eg.useParams)();let e=(0,eg.useRouter)(),t=(0,eg.useSearchParams)(),{features:n}=(0,ew.useFeatures)(),{currentBank:r,setCurrentBank:i,loadBanks:a}=(0,ey.useBank)(),o=t.get("view")||"profile",s=t.get("subTab")||"world",l=t.get("bankConfigTab")||"general",c=n?.observations??!1,u=n?.bank_config_api??!1,[d,h]=(0,em.useState)(!1),[f,p]=(0,em.useState)(!1),[g,v]=(0,em.useState)(!1),[x,y]=(0,em.useState)(!1),[b,w]=(0,em.useState)(!1),[j,N]=(0,em.useState)(!1),[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(!1),S=t=>{r&&e.push((0,eb.bankRoute)(r,`?view=data&subTab=${t}`))},T=t=>{r&&e.push((0,eb.bankRoute)(r,`?view=profile&bankConfigTab=${t}`))},A=async()=>{if(r){p(!0);try{await eD.client.deleteBank(r),h(!1),i(null),await a(),e.push("/")}catch(e){}finally{p(!1)}}},O=async()=>{if(r){y(!0);try{let e=await eD.client.clearObservations(r);v(!1),ev.toast.success("Success",{description:e.message||"Observations cleared successfully"})}catch(e){}finally{y(!1)}}},M=async()=>{if(r){_(!0);try{await eD.client.resetBankConfig(r),E(!1)}catch{}finally{_(!1)}}},P=async()=>{if(r){w(!0);try{await eD.client.triggerConsolidation(r)}catch(e){}finally{w(!1)}}},D=async()=>{if(r){N(!0);try{let e=await eD.client.recoverConsolidation(r);ev.toast.success(`Recovered ${e.retried_count} failed ${1===e.retried_count?"memory":"memories"} for re-consolidation`)}catch(e){}finally{N(!1)}}};return(0,ep.jsxs)("div",{className:"min-h-screen bg-background flex flex-col",children:[(0,ep.jsx)(ex.BankSelector,{}),(0,ep.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[(0,ep.jsx)(eP,{currentTab:o,onTabChange:t=>{r&&e.push((0,eb.bankRoute)(r,`?view=${t}`))}}),(0,ep.jsx)("main",{className:"flex-1 overflow-y-auto",children:(0,ep.jsxs)("div",{className:"p-6",children:["profile"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex justify-between items-start mb-6",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Bank Configuration"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Manage bank settings, profile, and operations."})]}),(0,ep.jsxs)(p5,{children:[(0,ep.jsx)(p4,{asChild:!0,children:(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",children:["Actions",(0,ep.jsx)(mH,{className:"w-4 h-4 ml-2"})]})}),(0,ep.jsxs)(ml,{align:"end",className:"w-48",children:[(0,ep.jsxs)(mc,{onClick:async()=>{if(r)try{let e=await eD.client.exportBankTemplate(r),t=JSON.stringify(e,null,2);await navigator.clipboard.writeText(t),ev.toast.success("Template copied to clipboard")}catch{ev.toast.error("Failed to export template")}},children:[(0,ep.jsx)(HH,{className:"w-4 h-4 mr-2"}),"Export Template"]}),(0,ep.jsx)(mu,{}),(0,ep.jsxs)(mc,{onClick:P,disabled:b||!c,title:c?void 0:"Observations feature is not enabled",children:[b?(0,ep.jsx)(tH.default,{className:"w-4 h-4 mr-2 animate-spin"}):(0,ep.jsx)(gi,{className:"w-4 h-4 mr-2"}),b?"Consolidating...":"Run Consolidation",!c&&(0,ep.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ep.jsxs)(mc,{onClick:D,disabled:j||!c,title:c?void 0:"Observations feature is not enabled",children:[j?(0,ep.jsx)(tH.default,{className:"w-4 h-4 mr-2 animate-spin"}):(0,ep.jsx)(Uh,{className:"w-4 h-4 mr-2"}),j?"Recovering...":"Recover Consolidation",!c&&(0,ep.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ep.jsxs)(mc,{onClick:()=>v(!0),disabled:!c,className:"text-amber-600 dark:text-amber-400 focus:text-amber-700 dark:focus:text-amber-300",title:c?void 0:"Observations feature is not enabled",children:[(0,ep.jsx)(mV,{className:"w-4 h-4 mr-2"}),"Clear Observations",!c&&(0,ep.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ep.jsx)(mu,{}),(0,ep.jsxs)(mc,{onClick:()=>E(!0),disabled:!u,className:"text-amber-600 dark:text-amber-400 focus:text-amber-700 dark:focus:text-amber-300",title:u?void 0:"Bank Config API is disabled",children:[(0,ep.jsx)(Uh,{className:"w-4 h-4 mr-2"}),"Reset Configuration",!u&&(0,ep.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ep.jsx)(mu,{}),(0,ep.jsxs)(mc,{onClick:()=>h(!0),className:"text-red-600 dark:text-red-400 focus:text-red-700 dark:focus:text-red-300",children:[(0,ep.jsx)(mV,{className:"w-4 h-4 mr-2"}),"Delete Bank"]})]})]})]}),(0,ep.jsx)("div",{className:"mb-6 border-b border-border",children:(0,ep.jsxs)("div",{className:"flex gap-1",children:[(0,ep.jsxs)("button",{onClick:()=>T("general"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"general"===l?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["General","general"===l&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),u&&(0,ep.jsxs)("button",{onClick:()=>T("configuration"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"configuration"===l?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Configuration","configuration"===l&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>T("webhooks"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"webhooks"===l?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Webhooks","webhooks"===l&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>T("audit-logs"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"audit-logs"===l?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Audit Logs","audit-logs"===l&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]})]})}),(0,ep.jsxs)("div",{children:["general"===l&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Overview statistics and background operations for this memory bank."}),(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(Ud,{}),(0,ep.jsx)(Ug,{}),(0,ep.jsx)(jd,{hideReflectFields:!0})]})]}),"configuration"===l&&u&&(0,ep.jsx)("div",{className:"space-y-6",children:(0,ep.jsx)(jM,{})}),"webhooks"===l&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Manage webhook endpoints to receive event notifications from this memory bank."}),(0,ep.jsx)(UA,{})]}),"audit-logs"===l&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"View audit trail of all operations performed on this memory bank."}),(0,ep.jsx)(HU,{})]})]})]}),"recall"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Recall"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"Analyze memory recall with detailed trace information and retrieval methods."}),(0,ep.jsx)(js,{})]}),"reflect"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Reflect"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"Run an agentic loop that autonomously gathers evidence and reasons through the lens of the bank's disposition to generate contextual responses."}),(0,ep.jsx)(ja,{})]}),"data"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Memories"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"View and explore different types of memories stored in this memory bank."}),(0,ep.jsx)("div",{className:"mb-6 border-b border-border",children:(0,ep.jsxs)("div",{className:"flex gap-1",children:[(0,ep.jsxs)("button",{onClick:()=>S("world"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"world"===s?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["World Facts","world"===s&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>S("experience"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"experience"===s?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Experience","experience"===s&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>S("observations"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"observations"===s?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Observations",!c&&(0,ep.jsx)("span",{className:"ml-2 text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"Off"}),"observations"===s&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>S("mental-models"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"mental-models"===s?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Mental Models","mental-models"===s&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]})]})}),(0,ep.jsxs)("div",{children:["world"===s&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Objective facts about the world received from external sources."}),(0,ep.jsx)(fF,{factType:"world"},"world")]}),"experience"===s&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"The bank's own actions, interactions, and first-person experiences."}),(0,ep.jsx)(fF,{factType:"experience"},"experience")]}),"observations"===s&&(c?(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Consolidated knowledge synthesized from facts — patterns, preferences, and learnings that emerge from accumulated evidence."}),(0,ep.jsx)(fF,{factType:"observation"},"observations")]}):(0,ep.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,ep.jsx)("div",{className:"text-muted-foreground mb-2",children:(0,ep.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ep.jsx)("path",{d:"M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2Z"}),(0,ep.jsx)("path",{d:"M12 8v4"}),(0,ep.jsx)("path",{d:"M12 16h.01"})]})}),(0,ep.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-1",children:"Observations Not Enabled"}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground max-w-md",children:["Observations consolidation is disabled on this server. Set"," ",(0,ep.jsx)("code",{className:"px-1 py-0.5 bg-muted rounded text-xs",children:"HINDSIGHT_API_ENABLE_OBSERVATIONS=true"})," ","to enable."]})]})),"mental-models"===s&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"User-curated summaries generated from queries — reusable knowledge snapshots that can be refreshed as memories evolve."}),(0,ep.jsx)(Ux,{},"mental-models")]})]})]}),"documents"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Documents"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"Manage documents and retain new memories."}),(0,ep.jsx)(m0,{})]}),"entities"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Entities"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"Explore entities (people, organizations, places) mentioned in memories."}),(0,ep.jsx)(m1,{})]})]})})]}),(0,ep.jsx)(mv,{open:d,onOpenChange:h,children:(0,ep.jsxs)(mD,{children:[(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mR,{children:"Delete Memory Bank"}),(0,ep.jsx)(mB,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to delete the memory bank"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:r}),"?"]}),(0,ep.jsx)("p",{className:"text-red-600 dark:text-red-400 font-medium",children:"This action cannot be undone. All memories, entities, documents, and the bank profile will be permanently deleted."})]})})]}),(0,ep.jsxs)(mI,{children:[(0,ep.jsx)(mF,{disabled:f,children:"Cancel"}),(0,ep.jsx)(mz,{onClick:A,disabled:f,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:f?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Deleting..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(mV,{className:"w-4 h-4 mr-2"}),"Delete Bank"]})})]})]})}),(0,ep.jsx)(mv,{open:k,onOpenChange:E,children:(0,ep.jsxs)(mD,{children:[(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mR,{children:"Reset Configuration"}),(0,ep.jsx)(mB,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to reset all configuration overrides for"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:r}),"?"]}),(0,ep.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:"All per-bank settings (retain, observations, reflect) will revert to server defaults. This does not affect memories, entities, or the bank profile."})]})})]}),(0,ep.jsxs)(mI,{children:[(0,ep.jsx)(mF,{disabled:C,children:"Cancel"}),(0,ep.jsx)(mz,{onClick:M,disabled:C,children:C?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Resetting..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(Uh,{className:"w-4 h-4 mr-2"}),"Reset Configuration"]})})]})]})}),(0,ep.jsx)(mv,{open:g,onOpenChange:v,children:(0,ep.jsxs)(mD,{children:[(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mR,{children:"Clear Observations"}),(0,ep.jsx)(mB,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to clear all observations for"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:r}),"?"]}),(0,ep.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:"This will delete all consolidated knowledge. Observations will be regenerated the next time consolidation runs."})]})})]}),(0,ep.jsxs)(mI,{children:[(0,ep.jsx)(mF,{disabled:x,children:"Cancel"}),(0,ep.jsx)(mz,{onClick:O,disabled:x,className:"bg-amber-500 text-white hover:bg-amber-600",children:x?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Clearing..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(mV,{className:"w-4 h-4 mr-2"}),"Clear Observations"]})})]})]})})]})}],37578)}]);
8
+ ${z.trim()}`:z.trim();await eD.client.updateDirective(d,t.id,{content:e})}else await eD.client.createDirective(d,{name:ec,content:z.trim()});F(""),W(!0),setTimeout(()=>W(!1),3e3)}catch(e){}finally{U(!1)}}},eh=async()=>{if(d&&h){S(!0),k("answer");try{let e=T.split(",").map(e=>e.trim()).filter(e=>e.length>0),t=R.split(",").map(e=>e.trim()).filter(e=>e.length>0),n=await eD.client.reflect({bank_id:d,query:h,budget:p,max_tokens:v,include_facts:y,include_tool_calls:w,...e.length>0&&{tags:e,tags_match:O},...P.length>0&&{fact_types:P},...L&&{exclude_mental_models:!0},...t.length>0&&{exclude_mental_model_ids:t}});C(n)}catch(e){}finally{S(!1)}}};return d?(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(m7,{children:(0,ep.jsxs)(gn,{className:"pt-6",children:[(0,ep.jsxs)("div",{className:"flex gap-3",children:[(0,ep.jsxs)("div",{className:"flex-1 relative",children:[(0,ep.jsx)(ek,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,ep.jsx)(eI.Input,{type:"text",value:h,onChange:e=>f(e.target.value),placeholder:"What would you like to reflect on?",className:"pl-10 h-12 text-lg",onKeyDown:e=>"Enter"===e.key&&eh()})]}),(0,ep.jsx)(eL.Button,{onClick:eh,disabled:_||!h,className:"h-12 px-8",children:_?"Reflecting...":"Reflect"})]}),(0,ep.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Budget:"}),(0,ep.jsxs)(tR.Select,{value:p,onValueChange:e=>g(e),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-24 h-8",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"low",children:"Low"}),(0,ep.jsx)(tR.SelectItem,{value:"mid",children:"Mid"}),(0,ep.jsx)(tR.SelectItem,{value:"high",children:"High"})]})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-sm text-muted-foreground",children:"Tokens:"}),(0,ep.jsx)(eI.Input,{type:"number",value:v,onChange:e=>x(parseInt(e.target.value)||4096),className:"w-24 h-8"})]}),(0,ep.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(m2.Checkbox,{checked:y,onCheckedChange:e=>b(e)}),(0,ep.jsx)("span",{className:"text-sm",children:"Include Source"})]}),(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(m2.Checkbox,{checked:w,onCheckedChange:e=>j(e)}),(0,ep.jsx)("span",{className:"text-sm",children:"Include Tools"})]})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-4 mt-4 pt-4 border-t",children:[(0,ep.jsx)(tB,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("div",{className:"flex-1 max-w-md",children:(0,ep.jsx)(eI.Input,{type:"text",value:T,onChange:e=>A(e.target.value),placeholder:"Filter by tags (comma-separated)",className:"h-8"})}),(0,ep.jsxs)(tR.Select,{value:O,onValueChange:e=>M(e),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-40 h-8",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"any",children:"Any (incl. untagged)"}),(0,ep.jsx)(tR.SelectItem,{value:"all",children:"All (incl. untagged)"}),(0,ep.jsx)(tR.SelectItem,{value:"any_strict",children:"Any (strict)"}),(0,ep.jsx)(tR.SelectItem,{value:"all_strict",children:"All (strict)"})]})]})]}),(0,ep.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,ep.jsx)(m6,{value:P,onChange:D}),(0,ep.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(m2.Checkbox,{checked:L,onCheckedChange:e=>I(e)}),(0,ep.jsx)("span",{className:"text-sm",children:"Exclude mental models"})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-sm text-muted-foreground",children:"Exclude IDs:"}),(0,ep.jsx)(eI.Input,{type:"text",value:R,onChange:e=>B(e.target.value),placeholder:"model-a, model-b",className:"h-8 w-48"})]})]})]})}),_&&(0,ep.jsx)(m7,{children:(0,ep.jsxs)(gn,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mb-4"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Reflecting on memories..."})]})}),!_&&E&&(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[E.usage&&(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Input tokens:"}),(0,ep.jsx)("span",{className:"font-semibold",children:E.usage.input_tokens?.toLocaleString()})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Output tokens:"}),(0,ep.jsx)("span",{className:"font-semibold",children:E.usage.output_tokens?.toLocaleString()})]})]}),E.trace?.tool_calls&&(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Tool calls:"}),(0,ep.jsx)("span",{className:"font-semibold",children:E.trace.tool_calls.length}),(0,ep.jsxs)("span",{className:"text-muted-foreground",children:["(",E.trace.tool_calls.reduce((e,t)=>e+t.duration_ms,0),"ms)"]})]}),E.trace?.llm_calls&&(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"LLM calls:"}),(0,ep.jsx)("span",{className:"font-semibold",children:E.trace.llm_calls.length}),(0,ep.jsxs)("span",{className:"text-muted-foreground",children:["(",E.trace.llm_calls.reduce((e,t)=>e+t.duration_ms,0),"ms)"]})]}),(0,ep.jsx)("div",{className:"flex-1"}),(0,ep.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:["answer","trace","json"].map(e=>(0,ep.jsx)("button",{onClick:()=>k(e),className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${N===e?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"answer"===e?"Answer":"trace"===e?"Trace":"JSON"},e))})]}),"answer"===N&&(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsxs)(m7,{children:[(0,ep.jsx)(m9,{children:(0,ep.jsx)(ge,{children:"Answer"})}),(0,ep.jsx)(gn,{children:(0,ep.jsx)("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:(0,ep.jsx)(bv,{remarkPlugins:[wX],children:E.text})})})]}),(0,ep.jsxs)(m7,{className:"border-blue-200 dark:border-blue-800",children:[(0,ep.jsxs)(m9,{className:"py-4",children:[(0,ep.jsxs)(ge,{className:"flex items-center gap-2 text-base",children:[(0,ep.jsx)(ga,{className:"w-4 h-4"}),"Add Directive"]}),(0,ep.jsx)(gt,{className:"text-xs",children:"Hard rules injected into prompts that the agent must follow"})]}),(0,ep.jsx)(gn,{className:"pt-0",children:H?(0,ep.jsxs)("div",{className:"flex items-center gap-2 text-green-600 dark:text-green-400",children:[(0,ep.jsx)("span",{className:"text-lg",children:"✓"}),(0,ep.jsxs)("span",{className:"text-sm font-medium",children:["Directive saved to ",ec]})]}):(0,ep.jsxs)("div",{className:"flex gap-3",children:[(0,ep.jsx)(gl.Textarea,{value:z,onChange:e=>F(e.target.value),placeholder:"e.g., Always respond in formal English...",className:"flex-1 min-h-[60px] resize-none",onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&ed()}}),(0,ep.jsx)(eL.Button,{onClick:ed,disabled:V||!z.trim(),className:"self-end",children:V?"Saving...":"Save"})]})})]})]}),"trace"===N&&(0,ep.jsxs)("div",{className:"space-y-4",children:[E.observations_created&&E.observations_created.length>0&&(0,ep.jsxs)(m7,{className:"border-emerald-200 dark:border-emerald-800",children:[(0,ep.jsxs)(m9,{className:"bg-emerald-50 dark:bg-emerald-950 py-3",children:[(0,ep.jsxs)(ge,{className:"flex items-center gap-2 text-base",children:[(0,ep.jsx)(gi,{className:"w-4 h-4 text-emerald-600"}),"Observations Created (",E.observations_created.length,")"]}),(0,ep.jsx)(gt,{className:"text-xs",children:"New observations learned during this reflection"})]}),(0,ep.jsx)(gn,{className:"pt-4",children:(0,ep.jsx)("div",{className:"space-y-2",children:E.observations_created.map((e,t)=>(0,ep.jsxs)("div",{className:"p-3 bg-emerald-50 dark:bg-emerald-950/50 rounded-lg border border-emerald-200 dark:border-emerald-800",children:[(0,ep.jsx)("div",{className:"font-medium text-sm text-emerald-900 dark:text-emerald-100",children:e.name}),(0,ep.jsx)("div",{className:"text-xs text-emerald-700 dark:text-emerald-300 mt-1",children:e.description}),(0,ep.jsxs)("div",{className:"text-[10px] text-muted-foreground mt-2 font-mono",children:["ID: ",e.id]})]},t))})})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,ep.jsxs)(m7,{className:"h-fit",children:[(0,ep.jsxs)(m9,{className:"pb-3",children:[(0,ep.jsx)(ge,{className:"text-base",children:"Execution Trace"}),(0,ep.jsxs)(gt,{className:"text-xs",children:[E.iterations||0," iteration",1!==(E.iterations||0)?"s":""," •"," ",(E.trace?.llm_calls?.reduce((e,t)=>e+t.duration_ms,0)||0)+(E.trace?.tool_calls?.reduce((e,t)=>e+t.duration_ms,0)||0),"ms total"]})]}),(0,ep.jsx)(gn,{children:w?E.trace?.llm_calls&&E.trace.llm_calls.length>0||E.trace?.tool_calls&&E.trace.tool_calls.length>0?(0,ep.jsx)("div",{className:"max-h-[500px] overflow-y-auto pr-2",children:(e=E.trace?.llm_calls||[],t=E.trace?.tool_calls||[],n=[],e.forEach((r,i)=>{let a=t.filter(e=>e.iteration===i+1),o=i===e.length-1,s=r.scope.includes("final")||o&&0===a.length,l=s?e.length:i+1;n.push({type:"llm",llm:r,iteration:l,isFinal:s}),a.length>0&&n.push({type:"tools",tools:a,iteration:i+1})}),n.map((e,t)=>(0,ep.jsxs)("div",{className:"relative",children:[t<n.length-1&&(0,ep.jsx)("div",{className:"absolute left-3 top-6 bottom-0 w-0.5 bg-border"}),"llm"===e.type?(0,ep.jsxs)("div",{className:"flex items-start gap-3 pb-3",children:[(0,ep.jsx)("div",{className:`w-6 h-6 rounded-full flex items-center justify-center flex-shrink-0 ${e.isFinal?"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400":"bg-primary/10 text-primary"}`,children:e.isFinal?(0,ep.jsx)(tV.Check,{className:"w-3.5 h-3.5",strokeWidth:2.5}):(0,ep.jsx)("span",{className:"text-[10px] font-semibold",children:e.iteration})}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)("span",{className:"font-medium text-sm",children:e.isFinal?"Response generated":"Agent decided"}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[(0,ep.jsx)(eG,{className:"w-3 h-3"}),e.llm.duration_ms,"ms"]})]}),(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:e.isFinal?"Final answer":"Called tools below"})]})]}):(0,ep.jsxs)("div",{className:"flex items-start gap-3 pb-3",children:[(0,ep.jsx)("div",{className:"w-6 h-6 rounded-full flex items-center justify-center bg-blue-500/15 text-blue-600 dark:text-blue-400 flex-shrink-0",children:(0,ep.jsx)(gs,{className:"w-3 h-3",fill:"currentColor"})}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground",children:["Executing ",e.tools?.length," tool",e.tools?.length!==1?"s":""]}),e.tools?.map((e,t)=>(0,ep.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-muted/50",children:[(0,ep.jsx)("span",{className:"font-medium text-sm text-foreground",children:e.tool}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[(0,ep.jsx)(eG,{className:"w-3 h-3"}),e.duration_ms,"ms"]})]}),(0,ep.jsxs)("div",{className:"p-2 space-y-2",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-[10px] font-semibold text-muted-foreground mb-1",children:"Input:"}),(0,ep.jsx)("div",{className:"bg-muted p-1.5 rounded text-xs overflow-auto max-h-32",children:(0,ep.jsx)(gQ,{src:e.input,collapsed:1,theme:"default"})})]}),e.output&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-[10px] font-semibold text-muted-foreground mb-1",children:"Output:"}),(0,ep.jsx)("div",{className:"bg-muted p-1.5 rounded text-xs overflow-auto max-h-32",children:(0,ep.jsx)(gQ,{src:e.output,collapsed:1,theme:"default"})})]})]})]},t))]})]})]},t)))}):(0,ep.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,ep.jsx)(gr.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"font-medium text-sm text-foreground",children:"No operations"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"No LLM or tool calls were made during this reflection."})]})]}):(0,ep.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,ep.jsx)(gr.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"font-medium text-sm text-foreground",children:"Not included"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:'Enable "Include Tool Calls" to see trace.'})]})]})})]}),(0,ep.jsxs)(m7,{className:"h-fit",children:[(0,ep.jsxs)(m9,{className:"pb-3",children:[(0,ep.jsx)(ge,{className:"text-base",children:"Based On"}),(0,ep.jsxs)(gt,{className:"text-xs",children:[(E.based_on?.memories?.length||0)+(E.based_on?.observations?.filter(e=>"directive"!==e.subtype)?.length||0)+(E.based_on?.directives?.length||0)," ","items used"]})]}),(0,ep.jsx)(gn,{children:y?E.based_on?.memories&&E.based_on.memories.length>0||E.based_on?.mental_models&&E.based_on.mental_models.length>0||E.based_on?.directives&&E.based_on.directives.length>0||E.based_on?.observations&&E.based_on.observations.length>0?(i=(r=E.based_on?.memories||[]).filter(e=>"world"===e.type),a=r.filter(e=>"experience"===e.type),o=E.based_on?.mental_models||[],s=(E.based_on?.observations||[]).filter(e=>"directive"!==e.subtype),c=[{id:"directives",label:"Directives",count:(l=E.based_on?.directives||[]).length},{id:"mental_models",label:"Mental Models",count:o.length},{id:"observations",label:"Observations",count:s.length},{id:"world",label:"World",count:i.length},{id:"experience",label:"Experience",count:a.length}],u=(()=>{switch(es){case"directives":return l;case"mental_models":return o;case"observations":return s;case"world":return i;case"experience":return a;default:return[]}})(),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"flex items-center gap-1 bg-muted rounded-lg p-1 mb-4",children:c.map(e=>(0,ep.jsxs)("button",{onClick:()=>el(e.id),className:`flex-1 px-3 py-1.5 rounded-md text-sm font-medium transition-all ${es===e.id?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[e.label," (",e.count,")"]},e.id))}),u.length>0?(0,ep.jsx)("div",{className:"max-h-[400px] overflow-y-auto pr-2 space-y-3",children:u.map((e,t)=>{let n,r;return(0,ep.jsx)("div",{className:`p-4 bg-muted/50 rounded-lg border border-border/50 ${"directives"!==es?"cursor-pointer hover:bg-muted/80 transition-colors":""}`,onClick:()=>{"directives"!==es&&("observations"===es?eu(e):"mental_models"===es?eo(e.id):G(e.id))},children:"directives"===es?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"font-medium text-sm",children:e.name}),e.content&&(0,ep.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:e.content})]}):"observations"===es?(0,ep.jsx)("div",{className:"font-medium text-sm",children:e.name}):"mental_models"===es?(r=(n=e.text?.indexOf(": ")??-1)>0?e.text.slice(0,n):e.id,(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"font-medium text-sm",children:r}),(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground",children:e.id})]})):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("p",{className:"text-sm text-foreground leading-relaxed",children:e.text}),e.context&&(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mt-2",children:e.context})]})},e.id||t)})}):(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground text-center py-4",children:["No ",es," items"]})]})):(0,ep.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-amber-50 dark:bg-amber-950 border border-amber-200 dark:border-amber-800 rounded-lg",children:[(0,ep.jsx)(gr.Info,{className:"w-4 h-4 text-amber-600 dark:text-amber-400 mt-0.5 flex-shrink-0"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"font-medium text-sm text-amber-900 dark:text-amber-100",children:"No facts found"}),(0,ep.jsx)("p",{className:"text-xs text-amber-700 dark:text-amber-300 mt-0.5",children:"No memories were used to generate this answer."})]})]}):(0,ep.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,ep.jsx)(gr.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"font-medium text-sm text-foreground",children:"Not included"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:'Enable "Include Source" to see memories.'})]})]})})]})]})]}),"json"===N&&(0,ep.jsxs)(m7,{children:[(0,ep.jsx)(m9,{children:(0,ep.jsx)(ge,{className:"text-lg",children:"Raw Response"})}),(0,ep.jsx)(gn,{children:(0,ep.jsx)("div",{className:"bg-muted p-4 rounded-lg overflow-auto max-h-[600px]",children:(0,ep.jsx)(gQ,{src:E,collapsed:2,theme:"default"})})})]})]}),!_&&!E&&(0,ep.jsx)(m7,{className:"border-dashed",children:(0,ep.jsxs)(gn,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(ek,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ready to Reflect"}),(0,ep.jsx)("p",{className:"text-muted-foreground text-center max-w-md",children:"Enter a question above to query the memory bank and generate a disposition-aware response."})]})}),(0,ep.jsx)(t0,{memoryId:Y,onClose:()=>G(null)}),$&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,ep.jsxs)("div",{className:"p-6",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(go,{className:"w-5 h-5"}),(0,ep.jsx)("h2",{className:"text-lg font-semibold",children:"Directive"})]}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"icon",onClick:()=>{X(null),K(null)},children:(0,ep.jsx)(tU.X,{className:"w-4 h-4"})})]}),Z?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Name"}),(0,ep.jsx)("p",{className:"mt-1 font-medium",children:q?.name||$.name})]}),q?.description&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Description"}),(0,ep.jsx)("p",{className:"mt-1 text-sm",children:q.description})]}),q?.tags&&q.tags.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Tags"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-1",children:q.tags.map(e=>(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground flex items-center gap-1",children:[(0,ep.jsx)(tB,{className:"w-2.5 h-2.5"}),e]},e))})]}),(q?.content||$.content)&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Content"}),(0,ep.jsx)("div",{className:"p-3 bg-muted rounded-lg",children:(0,ep.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:q?.content||$.content})})]}),(0,ep.jsxs)("div",{className:"pt-2 border-t",children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),(0,ep.jsx)("p",{className:"mt-1 font-mono text-xs text-muted-foreground",children:$.id})]})]})]})}),J&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,ep.jsxs)("div",{className:"p-6",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(gi,{className:"w-5 h-5"}),(0,ep.jsx)("h2",{className:"text-lg font-semibold",children:"Observation"})]}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"icon",onClick:()=>{ee(null),en(null)},children:(0,ep.jsx)(tU.X,{className:"w-4 h-4"})})]}),er?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Text"}),(0,ep.jsx)("div",{className:"mt-1 prose prose-sm max-w-none dark:prose-invert",children:(0,ep.jsx)(bv,{remarkPlugins:[wX],children:et?.text||J.text})})]}),et?.tags&&et.tags.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Tags"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-1",children:et.tags.map(e=>(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground flex items-center gap-1",children:[(0,ep.jsx)(tB,{className:"w-2.5 h-2.5"}),e]},e))})]}),et?.source_memories&&et.source_memories.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:["Source Memories (",et.source_memories.length,")"]}),(0,ep.jsx)("div",{className:"space-y-2",children:et.source_memories.map((e,t)=>(0,ep.jsx)("div",{className:"p-3 bg-muted rounded-lg",children:(0,ep.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:e.text||("string"==typeof e?e:"")})},t))})]}),(0,ep.jsxs)("div",{className:"pt-2 border-t",children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),(0,ep.jsx)("p",{className:"mt-1 font-mono text-xs text-muted-foreground",children:J.id})]})]})]})}),(0,ep.jsx)(w9,{mentalModelId:ea,onClose:()=>eo(null)})]}):(0,ep.jsx)(m7,{className:"border-dashed",children:(0,ep.jsxs)(gn,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(eE,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("h3",{className:"text-xl font-semibold mb-2",children:"No Bank Selected"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Select a memory bank to start reflecting."})]})})}let jo=(0,eN.default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);function js(){let e,t,n,r,i,a,o,s,l,c,u,d,h,f,{currentBank:p}=(0,ey.useBank)(),[g,v]=(0,em.useState)(""),[x,y]=(0,em.useState)(["world"]),[b,w]=(0,em.useState)("mid"),[j,N]=(0,em.useState)(4096),[k,E]=(0,em.useState)(""),[C,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(!1),[A,O]=(0,em.useState)(""),[M,P]=(0,em.useState)("any"),[D,L]=(0,em.useState)(null),[I,R]=(0,em.useState)(null),[B,z]=(0,em.useState)(null),[F,V]=(0,em.useState)(null),[U,H]=(0,em.useState)(null),[W,Y]=(0,em.useState)(!1),[G,$]=(0,em.useState)("results"),[X,q]=(0,em.useState)(null),[K,Z]=(0,em.useState)(new Set),[Q,J]=(0,em.useState)(new Set),ee=e=>{Z(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},et=e=>{J(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},en=e=>{let t=e.id||e.node_id;q(D?.find(e=>e.id===t||e.node_id===t)||e)},er=async()=>{if(!p)return void ev.toast.error("Validation error",{description:"Please select a memory bank first"});if(g){if(0===x.length)return void ev.toast.error("Validation error",{description:"Please select at least one type (World, Experience, or Observations)"});Y(!0);try{let e=A.split(",").map(e=>e.trim()).filter(e=>e.length>0),t={bank_id:p,query:g,types:x,budget:b,max_tokens:j,trace:!0,include:{entities:S?{max_tokens:500}:null,chunks:C?{max_tokens:8192}:null},...k&&{query_timestamp:k},...e.length>0&&{tags:e,tags_match:M}},n=await eD.client.recall(t);L(n.results||[]),R(n.entities||null),z(n.chunks||null),V(n.observations||null),H(n.trace||null),$("results")}catch(e){}finally{Y(!1)}}};return p?(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(m7,{children:(0,ep.jsxs)(gn,{className:"pt-6",children:[(0,ep.jsxs)("div",{className:"flex gap-3",children:[(0,ep.jsxs)("div",{className:"flex-1 relative",children:[(0,ep.jsx)(ej.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,ep.jsx)(eI.Input,{type:"text",value:g,onChange:e=>v(e.target.value),placeholder:"What would you like to recall?",className:"pl-10 h-12 text-lg",onKeyDown:e=>"Enter"===e.key&&er()})]}),(0,ep.jsx)(eL.Button,{onClick:er,disabled:W||!g,className:"h-12 px-8",children:W?"Searching...":"Recall"})]}),(0,ep.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,ep.jsx)(m6,{value:x,onChange:y,label:"Types:"}),(0,ep.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(gJ,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsxs)(tR.Select,{value:b,onValueChange:e=>w(e),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-24 h-8",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"low",children:"Low"}),(0,ep.jsx)(tR.SelectItem,{value:"mid",children:"Mid"}),(0,ep.jsx)(tR.SelectItem,{value:"high",children:"High"})]})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-sm text-muted-foreground",children:"Tokens:"}),(0,ep.jsx)(eI.Input,{type:"number",value:j,onChange:e=>N(parseInt(e.target.value)),className:"w-24 h-8"})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(eG,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)(eI.Input,{type:"datetime-local",value:k,onChange:e=>E(e.target.value),className:"h-8",placeholder:"Query date"})]}),(0,ep.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(m2.Checkbox,{checked:C,onCheckedChange:e=>_(e)}),(0,ep.jsx)(eC.FileText,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("span",{className:"text-sm",children:"Chunks"})]}),(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(m2.Checkbox,{checked:S,onCheckedChange:e=>T(e)}),(0,ep.jsx)(e_,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("span",{className:"text-sm",children:"Entities"})]})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-4 mt-4 pt-4 border-t",children:[(0,ep.jsx)(tB,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("div",{className:"flex-1 max-w-md",children:(0,ep.jsx)(eI.Input,{type:"text",value:A,onChange:e=>O(e.target.value),placeholder:"Filter by tags (comma-separated)",className:"h-8"})}),(0,ep.jsxs)(tR.Select,{value:M,onValueChange:e=>P(e),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-40 h-8",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"any",children:"Any (incl. untagged)"}),(0,ep.jsx)(tR.SelectItem,{value:"all",children:"All (incl. untagged)"}),(0,ep.jsx)(tR.SelectItem,{value:"any_strict",children:"Any (strict)"}),(0,ep.jsx)(tR.SelectItem,{value:"all_strict",children:"All (strict)"})]})]})]})]})}),W&&(0,ep.jsx)(m7,{children:(0,ep.jsxs)(gn,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mb-4"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Searching memories..."})]})}),!W&&D&&(0,ep.jsxs)("div",{className:"space-y-4",children:[U?.summary&&(0,ep.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Results:"}),(0,ep.jsx)("span",{className:"font-semibold",children:D.length})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Duration:"}),(0,ep.jsxs)("span",{className:"font-semibold",children:[U.summary.total_duration_seconds?.toFixed(2),"s"]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Nodes visited:"}),(0,ep.jsx)("span",{className:"font-semibold",children:U.summary.total_nodes_visited})]}),(0,ep.jsx)("div",{className:"flex-1"}),(0,ep.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:["results","trace","json"].map(e=>(0,ep.jsx)("button",{onClick:()=>$(e),className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${G===e?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"results"===e?"Results":"trace"===e?"Trace":"JSON"},e))})]}),"results"===G&&(0,ep.jsxs)("div",{className:"space-y-4",children:[F&&F.length>0&&(0,ep.jsxs)(m7,{className:"border-orange-500/30 bg-orange-500/5",children:[(0,ep.jsx)(m9,{className:"py-3",children:(0,ep.jsxs)(ge,{className:"text-base flex items-center gap-2",children:[(0,ep.jsx)(eE,{className:"h-4 w-4 text-orange-500"}),(0,ep.jsx)("span",{children:"Observations"}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",F.length,")"]})]})}),(0,ep.jsx)(gn,{className:"pt-0 space-y-2",children:F.map((e,t)=>(0,ep.jsxs)("div",{className:"p-3 bg-background rounded-lg border border-orange-500/20",children:[(0,ep.jsx)("p",{className:"text-sm text-foreground",children:e.text}),(0,ep.jsxs)("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[(0,ep.jsx)("span",{className:"px-2 py-0.5 rounded bg-orange-500/10 text-orange-600",children:"Observation"}),(0,ep.jsxs)("span",{children:["Proof count: ",e.proof_count||1]}),(0,ep.jsxs)("span",{children:["Relevance: ",(e.relevance||0).toFixed(3)]})]})]},e.id||t))})]}),(0,ep.jsx)("div",{className:"space-y-3",children:0!==D.length||F&&0!==F.length?D.map((e,t)=>{let n=U?.visits?.find(t=>t.node_id===e.id),r=n?n.weights.final_weight:e.score||0;return(0,ep.jsx)(m7,{className:"cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>q(e),children:(0,ep.jsx)(gn,{className:"py-4",children:(0,ep.jsxs)("div",{className:"flex items-start gap-4",children:[(0,ep.jsx)("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center",children:(0,ep.jsx)("span",{className:"text-sm font-semibold text-primary",children:t+1})}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-foreground",children:e.text}),(0,ep.jsxs)("div",{className:"flex items-center gap-4 mt-2 text-xs text-muted-foreground",children:[(0,ep.jsx)("span",{className:"px-2 py-0.5 rounded bg-muted capitalize",children:e.type||"world"}),e.context&&(0,ep.jsx)("span",{className:"truncate max-w-xs",children:e.context}),e.occurred_start&&(0,ep.jsx)("span",{children:new Date(e.occurred_start).toLocaleDateString()})]})]}),(0,ep.jsxs)("div",{className:"flex-shrink-0 text-right",children:[(0,ep.jsx)("div",{className:"text-sm font-semibold",children:(r??0).toFixed(3)}),(0,ep.jsx)("div",{className:"text-xs text-muted-foreground",children:"score"})]}),(0,ep.jsx)(eT.ChevronRight,{className:"h-5 w-5 text-muted-foreground flex-shrink-0"})]})})},t)}):(0,ep.jsx)(m7,{children:(0,ep.jsxs)(gn,{className:"flex flex-col items-center justify-center py-12",children:[(0,ep.jsx)(ej.Search,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"No memories found for this query."})]})})})]}),"trace"===G&&U&&(0,ep.jsxs)("div",{className:"space-y-4",children:[U.retrieval_results&&U.retrieval_results.length>0&&(e={},U.retrieval_results.forEach(t=>{let n=t.fact_type||"all";e[n]||(e[n]=[]),e[n].push(t)}),t=Object.keys(e),(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"text-xs font-medium text-muted-foreground mb-3 flex items-center gap-2",children:[(0,ep.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,ep.jsx)("span",{children:"PARALLEL RETRIEVAL"}),(0,ep.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,ep.jsx)("div",{className:"space-y-2",children:t.map((t,n)=>{let r=e[t],i=`lane-${t}`,a=K.has(i),o=r.reduce((e,t)=>e+(t.results?.length||0),0),s=Math.max(...r.map(e=>e.duration_seconds||0)),l={world:{bg:"bg-blue-500/10",text:"text-blue-500",border:"border-blue-500/30"},experience:{bg:"bg-green-500/10",text:"text-green-500",border:"border-green-500/30"},opinion:{bg:"bg-purple-500/10",text:"text-purple-500",border:"border-purple-500/30"},all:{bg:"bg-gray-500/10",text:"text-gray-500",border:"border-gray-500/30"}},c=l[t]||l.all;return(0,ep.jsx)(m7,{className:`transition-colors ${a?"border-primary":c.border}`,children:(0,ep.jsxs)(gn,{className:"py-3 px-4",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-3 cursor-pointer",onClick:()=>ee(i),children:[(0,ep.jsx)("div",{className:`w-8 h-8 rounded-lg ${c.bg} flex items-center justify-center`,children:(0,ep.jsx)("span",{className:`text-sm font-bold ${c.text} capitalize`,children:t.charAt(0).toUpperCase()})}),(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-semibold text-foreground capitalize",children:t}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:[r.length," methods"]})]}),(0,ep.jsx)("div",{className:"flex gap-1.5 mt-1",children:r.map((e,t)=>(0,ep.jsxs)("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-muted text-muted-foreground capitalize",children:[e.method_name,": ",e.results?.length||0]},t))})]}),(0,ep.jsxs)("div",{className:"text-right",children:[(0,ep.jsx)("div",{className:"text-2xl font-bold text-foreground",children:o}),(0,ep.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:[s.toFixed(2),"s"]})]}),a?(0,ep.jsx)(mW.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ep.jsx)(eT.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]}),a&&(0,ep.jsx)("div",{className:"mt-4 pt-4 border-t border-border",children:(0,ep.jsx)("div",{className:`grid gap-3 ${1===r.length?"grid-cols-1":2===r.length?"grid-cols-2":3===r.length?"grid-cols-3":"grid-cols-4"}`,children:r.map((e,t)=>{let n,r,a,o,s=`${i}-method-${t}`,l=K.has(s),c=e.results||[];return(0,ep.jsxs)("div",{className:"flex flex-col",children:[(0,ep.jsxs)("div",{className:`p-3 rounded-lg cursor-pointer transition-colors ${l?"bg-primary/10 border border-primary":"bg-muted/50 hover:bg-muted"}`,onClick:e=>{e.stopPropagation(),ee(s)},children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-medium text-sm text-foreground capitalize",children:e.method_name}),"temporal"===e.method_name&&e.metadata?.constraint&&(0,ep.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[(0,ep.jsx)(eR,{className:"h-3 w-3"}),e.metadata.constraint.start?new Date(e.metadata.constraint.start).toLocaleDateString():"any"," → ",e.metadata.constraint.end?new Date(e.metadata.constraint.end).toLocaleDateString():"any"]})]}),l?(0,ep.jsx)(mW.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,ep.jsx)(eT.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),(0,ep.jsxs)("div",{className:"flex items-end justify-between",children:[(0,ep.jsx)("div",{className:"text-2xl font-bold text-foreground",children:c.length}),(0,ep.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:[e.duration_seconds?.toFixed(2),"s"]})]})]}),l&&c.length>0&&(n=`results-${s}`,a=(r=Q.has(n))?c:c.slice(0,5),o=c.length>5,(0,ep.jsxs)("div",{className:"mt-2 space-y-1.5 max-h-[300px] overflow-y-auto",children:[a.map((e,t)=>(0,ep.jsx)("div",{className:"p-2 bg-background rounded cursor-pointer hover:bg-muted/50 transition-colors border border-border",onClick:t=>{t.stopPropagation(),en(e)},children:(0,ep.jsxs)("div",{className:"flex items-start gap-2",children:[(0,ep.jsx)("span",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:t+1}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-xs text-foreground line-clamp-2",children:e.text}),(0,ep.jsx)("div",{className:"flex items-center gap-2 mt-1",children:(0,ep.jsx)("span",{className:"text-[10px] text-muted-foreground",children:(e.score||e.similarity||0).toFixed(4)})})]})]})},t)),o&&(0,ep.jsx)("button",{className:"w-full text-[10px] text-primary hover:text-primary/80 py-1.5 hover:bg-muted/50 rounded transition-colors",onClick:e=>{e.stopPropagation(),et(n)},children:r?"Show less":`View all ${c.length} results`})]}))]},s)})})})]})},i)})}),(0,ep.jsx)("div",{className:"flex justify-center py-2",children:(0,ep.jsx)("div",{className:"flex items-center gap-2",children:t.map((e,t)=>{let n={world:"bg-blue-500",experience:"bg-green-500",opinion:"bg-purple-500",all:"bg-gray-500"};return(0,ep.jsx)("div",{className:"flex flex-col items-center",children:(0,ep.jsx)("div",{className:`w-1 h-4 ${n[e]||n.all} rounded-full opacity-50`})},t)})})}),(0,ep.jsx)("div",{className:"flex justify-center",children:(0,ep.jsx)(jo,{className:"h-5 w-5 text-muted-foreground/50"})})]})),U.rrf_merged&&(n="rrf-merge",r=K.has(n),(0,ep.jsxs)("div",{children:[(0,ep.jsx)(m7,{className:`cursor-pointer transition-colors ${r?"border-primary":"hover:border-primary/50"}`,onClick:()=>ee(n),children:(0,ep.jsx)(gn,{className:"py-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-purple-500/10 flex items-center justify-center",children:(0,ep.jsx)("span",{className:"text-sm font-bold text-purple-500",children:"∪"})}),(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:"RRF Fusion"}),(0,ep.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:"merge"})]}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:"Reciprocal Rank Fusion of all retrieval results"})]}),(0,ep.jsx)("div",{className:"text-2xl font-bold text-foreground",children:U.rrf_merged.length}),r?(0,ep.jsx)(mW.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ep.jsx)(eT.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]})})}),r&&U.rrf_merged.length>0&&(i="results-rrf",o=(a=Q.has(i))?U.rrf_merged:U.rrf_merged.slice(0,5),s=U.rrf_merged.length>5,(0,ep.jsxs)("div",{className:"ml-6 mt-2 space-y-2 border-l-2 border-muted pl-4 max-h-[400px] overflow-y-auto",children:[o.map((e,t)=>(0,ep.jsx)("div",{className:"p-3 bg-muted/30 rounded-lg cursor-pointer hover:bg-muted/50 transition-colors",onClick:t=>{t.stopPropagation(),en(e)},children:(0,ep.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ep.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:t+1}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:e.text}),(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground mt-1",children:["RRF Score: ",(e.rrf_score||e.score||0).toFixed(4)]})]})]})},t)),s&&(0,ep.jsx)("button",{className:"w-full text-xs text-primary hover:text-primary/80 py-2 hover:bg-muted/50 rounded transition-colors",onClick:e=>{e.stopPropagation(),et(i)},children:a?"Show less":`View all ${U.rrf_merged.length} results`})]})),(0,ep.jsx)("div",{className:"flex justify-center py-2",children:(0,ep.jsx)(jo,{className:"h-4 w-4 text-muted-foreground/50"})})]})),U.reranked&&(l="reranking",c=K.has(l),(0,ep.jsxs)("div",{children:[(0,ep.jsx)(m7,{className:`cursor-pointer transition-colors ${c?"border-primary":"hover:border-primary/50"}`,onClick:()=>ee(l),children:(0,ep.jsx)(gn,{className:"py-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-amber-500/10 flex items-center justify-center",children:(0,ep.jsx)("span",{className:"text-sm font-bold text-amber-500",children:"⚡"})}),(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:"Combined Scoring"}),(0,ep.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:"rerank"})]}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:(0,ep.jsx)("span",{className:"font-mono text-xs",children:"ce × recency_boost(±10%) × temporal_boost(±10%)"})})]}),(0,ep.jsx)("div",{className:"text-2xl font-bold text-foreground",children:U.reranked.length}),c?(0,ep.jsx)(mW.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ep.jsx)(eT.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]})})}),c&&U.reranked.length>0&&(u="results-rerank",h=(d=Q.has(u))?U.reranked:U.reranked.slice(0,5),f=U.reranked.length>5,(0,ep.jsxs)("div",{className:"ml-6 mt-2 space-y-2 border-l-2 border-muted pl-4 max-h-[400px] overflow-y-auto",children:[h.map((e,t)=>{let n=e.score_components||{};return(0,ep.jsx)("div",{className:"p-3 bg-muted/30 rounded-lg cursor-pointer hover:bg-muted/50 transition-colors",onClick:t=>{t.stopPropagation(),en(e)},children:(0,ep.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ep.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:t+1}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:e.text}),(0,ep.jsxs)("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mt-2 text-[10px] text-muted-foreground font-mono",children:[(0,ep.jsxs)("span",{className:"font-semibold text-foreground",children:["= ",(e.rerank_score||e.score||0).toFixed(4)]}),void 0!==n.cross_encoder_score_normalized&&(0,ep.jsxs)("span",{title:"Cross-encoder score (primary relevance signal)",children:["CE: ",n.cross_encoder_score_normalized.toFixed(3)]}),void 0!==n.temporal&&.5!==n.temporal&&(0,ep.jsxs)("span",{title:"Temporal proximity boost (±10% — only active for temporal queries)",children:["Tmp: ",n.temporal.toFixed(3)]}),void 0!==n.recency&&(0,ep.jsxs)("span",{title:"Recency boost (±10% — based on memory age)",children:["Rec: ",n.recency.toFixed(3)]})]})]})]})},t)}),f&&(0,ep.jsx)("button",{className:"w-full text-xs text-primary hover:text-primary/80 py-2 hover:bg-muted/50 rounded transition-colors",onClick:e=>{e.stopPropagation(),et(u)},children:d?"Show less":`View all ${U.reranked.length} results`})]})),(0,ep.jsx)("div",{className:"flex justify-center py-2",children:(0,ep.jsx)(jo,{className:"h-4 w-4 text-muted-foreground/50"})})]})),(0,ep.jsx)(m7,{className:"border-primary bg-primary/5",children:(0,ep.jsx)(gn,{className:"py-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-primary/20 flex items-center justify-center",children:(0,ep.jsx)("span",{className:"text-sm font-bold text-primary",children:"✓"})}),(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:"Final Results"}),(0,ep.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-primary/20 text-primary",children:"output"})]}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:"Top results after all processing steps"})]}),(0,ep.jsx)("div",{className:"text-2xl font-bold text-primary",children:D?.length||0})]})})})]}),"json"===G&&(0,ep.jsxs)(m7,{children:[(0,ep.jsx)(m9,{children:(0,ep.jsx)(ge,{className:"text-lg",children:"Raw Response"})}),(0,ep.jsx)(gn,{children:(0,ep.jsx)("div",{className:"bg-muted p-4 rounded-lg overflow-auto max-h-[600px]",children:(0,ep.jsx)(gQ,{src:{results:D,...I&&{entities:I},...B&&{chunks:B},...F&&{observations:F},trace:U},collapsed:2,theme:"default"})})})]})]}),!W&&!D&&(0,ep.jsx)(m7,{className:"border-dashed",children:(0,ep.jsxs)(gn,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(ej.Search,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ready to Recall"}),(0,ep.jsx)("p",{className:"text-muted-foreground text-center max-w-md",children:"Enter a query above to search through your memories. Use filters to narrow down by fact type, budget, and more."})]})}),X&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,ep.jsx)(t1,{memory:X,onClose:()=>q(null),inPanel:!0,bankId:p||void 0})})]}):(0,ep.jsx)(m7,{className:"border-dashed",children:(0,ep.jsxs)(gn,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(eE,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("h3",{className:"text-xl font-semibold mb-2",children:"No Bank Selected"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Select a memory bank to start recalling."})]})})}let jl=(0,eN.default)("target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);var jc=e.i(82458),jc=jc,tH=tH;let ju={skepticism:{label:"Skepticism",shortLabel:"S",description:"How skeptical vs trusting when forming observations",lowLabel:"Trusting",highLabel:"Skeptical"},literalism:{label:"Literalism",shortLabel:"L",description:"How literally to interpret information when forming observations",lowLabel:"Flexible",highLabel:"Literal"},empathy:{label:"Empathy",shortLabel:"E",description:"How much to consider emotional context when forming observations",lowLabel:"Detached",highLabel:"Empathetic"}};function jd({hideReflectFields:e=!1}){let t=(0,eg.useRouter)(),{currentBank:n,setCurrentBank:r,loadBanks:i}=(0,ey.useBank)(),{features:a}=(0,ew.useFeatures)();a?.observations;let[o,s]=(0,em.useState)(null),[l,c]=(0,em.useState)(null),[u,d]=(0,em.useState)([]),[h,f]=(0,em.useState)(0),[p,g]=(0,em.useState)([]),[v,x]=(0,em.useState)(0),[y,b]=(0,em.useState)(!1),[w,j]=(0,em.useState)(!1),[N,k]=(0,em.useState)(!1),[E,C]=(0,em.useState)(!1),[_,S]=(0,em.useState)(null),[T,A]=(0,em.useState)(null),[O,M]=(0,em.useState)(!1),[P,D]=(0,em.useState)(!1),[L,I]=(0,em.useState)(!1),[R,B]=(0,em.useState)(!1),[z,F]=(0,em.useState)(!1),[V,U]=(0,em.useState)(!1),[H,W]=(0,em.useState)(null),[Y]=(0,em.useState)(10),[G,$]=(0,em.useState)(0),[X,q]=(0,em.useState)(null),K=async(e=H,t=G)=>{if(n)try{let r=await eD.client.listOperations(n,{status:e||void 0,limit:Y,offset:t});d(r.operations||[]),f(r.total||0)}catch(e){console.error("Error loading operations:",e)}},Z=async(e=!1)=>{if(n){if(e){try{let[e,t,r]=await Promise.all([eD.client.getBankStats(n),eD.client.listDirectives(n),eD.client.listMentalModels(n)]);c(e),g(t.items||[]),x(r.items?.length||0)}catch(e){console.error("Error refreshing stats:",e)}return}b(!0);try{let[e,t,r,i]=await Promise.all([eD.client.getBankProfile(n),eD.client.getBankStats(n),eD.client.listDirectives(n),eD.client.listMentalModels(n)]);s(e),c(t),g(r.items||[]),x(i.items?.length||0),await K()}catch(e){}finally{b(!1)}}},Q=async()=>{if(n){I(!0);try{await eD.client.deleteBank(n),D(!1),r(null),await i(),t.push("/")}catch(e){}finally{I(!1)}}},J=async()=>{if(n){F(!0);try{let e=await eD.client.clearObservations(n);B(!1),await Z(),ev.toast.success("Success",{description:e.message||"Observations cleared successfully"})}catch(e){}finally{F(!1)}}},ee=async()=>{if(n&&T){M(!0);try{await eD.client.deleteDirective(n,T.id),g(e=>e.filter(e=>e.id!==T.id)),_?.id===T.id&&S(null),A(null)}catch(e){}finally{M(!1)}}};return((0,em.useEffect)(()=>{if(n){Z();let e=setInterval(()=>Z(!0),5e3);return()=>clearInterval(e)}},[n]),(0,em.useEffect)(()=>{let e=e=>{"Escape"===e.key&&S(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),n)?y&&!o?(0,ep.jsx)(m7,{children:(0,ep.jsxs)(gn,{className:"text-center py-10",children:[(0,ep.jsx)(eG,{className:"w-12 h-12 mx-auto mb-3 text-muted-foreground animate-pulse"}),(0,ep.jsx)("div",{className:"text-lg text-muted-foreground",children:"Loading profile..."})]})}):(0,ep.jsxs)("div",{className:"space-y-6",children:[!e&&(0,ep.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,ep.jsxs)(m7,{children:[(0,ep.jsx)(m9,{className:"pb-2",children:(0,ep.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)(ge,{className:"flex items-center gap-2 text-lg",children:[(0,ep.jsx)(gi,{className:"w-5 h-5 text-primary"}),"Disposition Profile"]}),(0,ep.jsx)(gt,{children:"Traits that shape the reasoning and perspective"})]}),(0,ep.jsx)(eL.Button,{onClick:()=>j(!0),variant:"ghost",size:"sm",children:(0,ep.jsx)(mU,{className:"h-4 w-4"})})]})}),(0,ep.jsx)(gn,{children:o&&(0,ep.jsx)("div",{className:"space-y-4",children:Object.keys(ju).map(e=>(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:ju[e].label}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:ju[e].description})]}),(0,ep.jsxs)("span",{className:"text-sm font-bold text-primary",children:[o.disposition[e],"/5"]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:ju[e].lowLabel}),(0,ep.jsx)("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden",children:(0,ep.jsx)("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${(o.disposition[e]-1)/4*100}%`}})}),(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:ju[e].highLabel})]})]},e))})})]}),(0,ep.jsxs)(m7,{children:[(0,ep.jsx)(m9,{className:"pb-2",children:(0,ep.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)(ge,{className:"flex items-center gap-2 text-lg",children:[(0,ep.jsx)(jl,{className:"w-5 h-5 text-primary"}),"Mission"]}),(0,ep.jsx)(gt,{children:"Affects how observations, reflect, and mental models are created"})]}),(0,ep.jsx)(eL.Button,{onClick:()=>k(!0),variant:"ghost",size:"sm",children:(0,ep.jsx)(mU,{className:"h-4 w-4"})})]})}),(0,ep.jsx)(gn,{children:(0,ep.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap leading-relaxed",children:o?.mission||"No mission set. Set a mission to derive structural mental models and personalize reflect responses."})})]})]}),(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,ep.jsx)(jc.default,{className:"w-5 h-5 text-rose-500"}),"Directives"]}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:"Hard rules that must be followed during reflect"})]}),(0,ep.jsxs)(eL.Button,{onClick:()=>C(!0),variant:"outline",size:"sm",className:"h-8",children:[(0,ep.jsx)(fz.Plus,{className:"w-4 h-4 mr-1"}),"Add"]})]}),p.length>0?(0,ep.jsx)("div",{className:"grid grid-cols-2 gap-3",children:p.map(e=>(0,ep.jsx)(m7,{className:`cursor-pointer transition-colors border-rose-500/30 ${_?.id===e.id?"bg-rose-500/10 border-rose-500":"hover:bg-rose-500/5"}`,onClick:()=>S(e),children:(0,ep.jsx)(gn,{className:"p-3",children:(0,ep.jsxs)("div",{className:"flex items-start gap-2",children:[(0,ep.jsx)(jc.default,{className:"w-4 h-4 text-rose-500 shrink-0 mt-0.5"}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("span",{className:"font-medium text-sm text-foreground",children:e.name}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 mt-1",children:e.content}),e.tags&&e.tags.length>0&&(0,ep.jsxs)("div",{className:"flex items-center gap-1 mt-2 flex-wrap",children:[(0,ep.jsx)(tB,{className:"w-3 h-3 text-muted-foreground"}),e.tags.map(e=>(0,ep.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:e},e))]})]})]})})},e.id))}):(0,ep.jsxs)("div",{className:"p-6 border border-dashed border-rose-500/30 rounded-lg text-center",children:[(0,ep.jsx)(jc.default,{className:"w-6 h-6 mx-auto mb-2 text-rose-500/50"}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:"No directives yet. Directives are hard rules that must be followed during reflect."})]})]}),(0,ep.jsx)(mv,{open:P,onOpenChange:D,children:(0,ep.jsxs)(mD,{children:[(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mR,{children:"Delete Memory Bank"}),(0,ep.jsx)(mB,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to delete the memory bank"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:n}),"?"]}),(0,ep.jsx)("p",{className:"text-red-600 dark:text-red-400 font-medium",children:"This action cannot be undone. All memories, entities, documents, and the bank profile will be permanently deleted."}),l&&(0,ep.jsxs)("p",{children:["This will delete ",l.total_nodes," memories, ",l.total_documents," ","documents, and ",l.total_links," links."]})]})})]}),(0,ep.jsxs)(mI,{children:[(0,ep.jsx)(mF,{disabled:L,children:"Cancel"}),(0,ep.jsx)(mz,{onClick:Q,disabled:L,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:L?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eW,{className:"w-4 h-4 mr-2 animate-spin"}),"Deleting..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(mV,{className:"w-4 h-4 mr-2"}),"Delete Bank"]})})]})]})}),(0,ep.jsx)(mv,{open:R,onOpenChange:B,children:(0,ep.jsxs)(mD,{children:[(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mR,{children:"Clear Observations"}),(0,ep.jsx)(mB,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to clear all observations for"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:n}),"?"]}),(0,ep.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:"This will delete all consolidated knowledge. Observations will be regenerated the next time consolidation runs."}),l&&l.total_observations>0&&(0,ep.jsxs)("p",{children:["This will delete ",l.total_observations," observations."]})]})})]}),(0,ep.jsxs)(mI,{children:[(0,ep.jsx)(mF,{disabled:z,children:"Cancel"}),(0,ep.jsx)(mz,{onClick:J,disabled:z,className:"bg-amber-500 text-white hover:bg-amber-600",children:z?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Clearing..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(mV,{className:"w-4 h-4 mr-2"}),"Clear Observations"]})})]})]})}),(0,ep.jsx)(jp,{open:E,mode:"create",onClose:()=>C(!1),onCreated:e=>{g(t=>[e,...t]),C(!1)}}),(0,ep.jsx)(mv,{open:!!T,onOpenChange:e=>!e&&A(null),children:(0,ep.jsxs)(mD,{children:[(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mR,{children:"Delete Directive"}),(0,ep.jsxs)(mB,{children:["Are you sure you want to delete"," ",(0,ep.jsxs)("span",{className:"font-semibold",children:['"',T?.name,'"']}),"?",(0,ep.jsx)("br",{}),(0,ep.jsx)("br",{}),(0,ep.jsx)("span",{className:"text-destructive font-semibold",children:"This action cannot be undone."})]})]}),(0,ep.jsxs)(mI,{className:"flex-row justify-end space-x-2",children:[(0,ep.jsx)(mF,{className:"mt-0",children:"Cancel"}),(0,ep.jsxs)(mz,{onClick:ee,disabled:O,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[O?(0,ep.jsx)(tH.default,{className:"w-4 h-4 animate-spin mr-1"}):null,"Delete"]})]})]})}),_&&(0,ep.jsx)(jm,{directive:_,onClose:()=>S(null),onDelete:()=>A({id:_.id,name:_.name}),onUpdated:e=>{g(t=>t.map(t=>t.id===e.id?e:t)),S(e)}}),w&&o&&(0,ep.jsx)(jh,{disposition:o.disposition,onClose:()=>j(!1),onSaved:async()=>{await Z(),j(!1)}}),N&&o&&(0,ep.jsx)(jf,{mission:o.mission||"",onClose:()=>k(!1),onSaved:async()=>{await Z(),k(!1)}})]}):(0,ep.jsx)(m7,{children:(0,ep.jsxs)(gn,{className:"p-10 text-center",children:[(0,ep.jsx)("h3",{className:"text-xl font-semibold mb-2 text-card-foreground",children:"No Bank Selected"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Please select a memory bank from the dropdown above to view its profile."})]})})}function jh({disposition:e,onClose:t,onSaved:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)(!1),[o,s]=(0,em.useState)(e),l=async()=>{if(r){a(!0);try{await eD.client.updateBankConfig(r,{disposition_skepticism:o.skepticism,disposition_literalism:o.literalism,disposition_empathy:o.empathy}),n()}catch(e){}finally{a(!1)}}};return(0,ep.jsx)(tY.Dialog,{open:!0,onOpenChange:t,children:(0,ep.jsxs)(tY.DialogContent,{className:"max-w-xl",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsx)(tY.DialogTitle,{children:"Edit Disposition Traits"}),(0,ep.jsx)(tY.DialogDescription,{children:"Traits that shape the reasoning and perspective"})]}),(0,ep.jsx)("div",{className:"space-y-4 py-4",children:Object.keys(ju).map(e=>(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:ju[e].label}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:ju[e].description})]}),(0,ep.jsxs)("span",{className:"text-sm font-bold text-primary",children:[o[e],"/5"]})]}),(0,ep.jsxs)("div",{className:"flex justify-between text-[10px] text-muted-foreground",children:[(0,ep.jsx)("span",{children:ju[e].lowLabel}),(0,ep.jsx)("span",{children:ju[e].highLabel})]}),(0,ep.jsx)("input",{type:"range",min:"1",max:"5",step:"1",value:o[e],onChange:t=>s(n=>({...n,[e]:parseInt(t.target.value)})),className:"w-full h-2 bg-muted rounded-lg appearance-none cursor-pointer accent-primary"})]},e))}),(0,ep.jsxs)(tY.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{onClick:t,variant:"outline",disabled:i,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:l,disabled:i,children:i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eW,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})})}function jf({mission:e,onClose:t,onSaved:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)(!1),[o,s]=(0,em.useState)(e),l=async()=>{if(r){a(!0);try{await eD.client.updateBankConfig(r,{reflect_mission:o||null}),n()}catch(e){}finally{a(!1)}}};return(0,ep.jsx)(tY.Dialog,{open:!0,onOpenChange:t,children:(0,ep.jsxs)(tY.DialogContent,{className:"max-w-xl",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsx)(tY.DialogTitle,{children:"Edit Mission"}),(0,ep.jsx)(tY.DialogDescription,{children:"Affects how observations, reflect, and mental models are created"})]}),(0,ep.jsx)("div",{className:"space-y-2 py-4",children:(0,ep.jsx)(gl.Textarea,{value:o,onChange:e=>s(e.target.value),placeholder:"e.g., I am a PM for the engineering team. I help coordinate sprints and track project progress...",rows:8,className:"resize-none"})}),(0,ep.jsxs)(tY.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{onClick:t,variant:"outline",disabled:i,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:l,disabled:i,children:i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eW,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})})}function jp({open:e,mode:t,directive:n,onClose:r,onCreated:i,onSaved:a}){let{currentBank:o}=(0,ey.useBank)(),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)({name:"",content:"",tags:""});(0,em.useEffect)(()=>{"edit"===t&&n?u({name:n.name,content:n.content,tags:(n.tags||[]).join(", ")}):"create"===t&&u({name:"",content:"",tags:""})},[e,t,n]);let d=async()=>{if(o&&c.name.trim()&&c.content.trim()){l(!0);try{let e=c.tags.split(",").map(e=>e.trim()).filter(e=>e.length>0);if("create"===t){let t=await eD.client.createDirective(o,{name:c.name.trim(),content:c.content.trim(),tags:e.length>0?e:void 0});u({name:"",content:"",tags:""}),i?.(t)}else if(n){let t=await eD.client.updateDirective(o,n.id,{name:c.name.trim(),content:c.content.trim(),tags:e});a?.(t),r()}}catch(e){}finally{l(!1)}}},h=()=>{"create"===t&&u({name:"",content:"",tags:""}),r()};return(0,ep.jsx)(tY.Dialog,{open:e,onOpenChange:e=>!e&&h(),children:(0,ep.jsxs)(tY.DialogContent,{className:"sm:max-w-lg",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsxs)(tY.DialogTitle,{className:"flex items-center gap-2",children:[(0,ep.jsx)(jc.default,{className:"w-5 h-5 text-rose-500"}),"create"===t?"Create":"Edit"," Directive"]}),(0,ep.jsx)(tY.DialogDescription,{children:"Directives are hard rules that must be followed during reflect."})]}),(0,ep.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Name *"}),(0,ep.jsx)(eI.Input,{value:c.name,onChange:e=>u({...c,name:e.target.value}),placeholder:"e.g., Competitor Policy"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Rule *"}),(0,ep.jsx)(gl.Textarea,{value:c.content,onChange:e=>u({...c,content:e.target.value}),placeholder:"e.g., Never mention competitor products directly.",className:"min-h-[120px]"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("label",{className:"text-sm font-medium text-foreground",children:["Tags ",(0,ep.jsx)("span",{className:"text-muted-foreground font-normal",children:"(optional)"})]}),(0,ep.jsx)(eI.Input,{value:c.tags,onChange:e=>u({...c,tags:e.target.value}),placeholder:"e.g., project-x, team-alpha (comma-separated)"})]})]}),(0,ep.jsxs)(tY.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:h,disabled:s,children:"Cancel"}),(0,ep.jsxs)(eL.Button,{onClick:d,disabled:s||!c.name.trim()||!c.content.trim(),className:"bg-rose-500 hover:bg-rose-600",children:[s?(0,ep.jsx)(tH.default,{className:"w-4 h-4 animate-spin mr-1"}):null,"create"===t?"Create":"Save"]})]})]})})}function jm({directive:e,onClose:t,onDelete:n,onUpdated:r}){let[i,a]=(0,em.useState)(!1);return(0,ep.jsxs)("div",{className:"fixed right-0 top-0 h-screen w-1/2 bg-card border-l-2 border-rose-500 shadow-2xl z-50 overflow-y-auto animate-in slide-in-from-right duration-300 ease-out",children:[(0,ep.jsxs)("div",{className:"p-6",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-start mb-8 pb-5 border-b border-border",children:[(0,ep.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ep.jsx)(jc.default,{className:"w-5 h-5 text-rose-500"}),(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("h3",{className:"text-xl font-bold text-foreground",children:e.name}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",onClick:()=>a(!0),className:"h-7 w-7 p-0",children:(0,ep.jsx)(mU,{className:"h-3.5 w-3.5"})})]}),(0,ep.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-rose-500/10 text-rose-600 dark:text-rose-400",children:"directive"})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",onClick:n,className:"h-8 w-8 p-0 text-muted-foreground hover:text-rose-500",children:(0,ep.jsx)(mV,{className:"h-4 w-4"})}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",onClick:t,className:"h-8 w-8 p-0",children:(0,ep.jsx)(tU.X,{className:"h-4 w-4"})})]})]}),(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Rule"}),(0,ep.jsx)("div",{className:"prose prose-base dark:prose-invert max-w-none",children:(0,ep.jsx)(bv,{remarkPlugins:[wX],children:e.content})})]}),e.tags&&e.tags.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Tags"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-2",children:e.tags.map(e=>(0,ep.jsx)("span",{className:"px-2 py-1 rounded bg-muted text-muted-foreground text-sm",children:e},e))})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:"ID"}),(0,ep.jsx)("code",{className:"text-sm font-mono break-all text-muted-foreground",children:e.id})]})]})]}),(0,ep.jsx)(jp,{open:i,mode:"edit",directive:e,onClose:()=>a(!1),onSaved:r})]})}let jg=(0,e4.cva)("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),jv=em.forwardRef(({className:e,variant:t,...n},r)=>(0,ep.jsx)("div",{ref:r,role:"alert",className:(0,eO.cn)(jg({variant:t}),e),...n}));jv.displayName="Alert",em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("h5",{ref:n,className:(0,eO.cn)("mb-1 font-medium leading-none tracking-tight",e),...t})).displayName="AlertTitle";let jx=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("text-sm [&_p]:leading-relaxed",e),...t}));jx.displayName="AlertDescription";var tH=tH;let jy=(0,eN.default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),jb=[{value:"HARM_CATEGORY_HARASSMENT",label:"Harassment"},{value:"HARM_CATEGORY_HATE_SPEECH",label:"Hate Speech"},{value:"HARM_CATEGORY_SEXUALLY_EXPLICIT",label:"Sexually Explicit"},{value:"HARM_CATEGORY_DANGEROUS_CONTENT",label:"Dangerous Content"}],jw=[{value:"HARM_BLOCK_THRESHOLD_UNSPECIFIED",label:"Unspecified (use Gemini default)"},{value:"OFF",label:"Off (filter disabled)"},{value:"BLOCK_NONE",label:"Block none"},{value:"BLOCK_LOW_AND_ABOVE",label:"Block low & above"},{value:"BLOCK_MEDIUM_AND_ABOVE",label:"Block medium & above"},{value:"BLOCK_ONLY_HIGH",label:"Block only high"}],jj=jb.map(e=>({category:e.value,threshold:"BLOCK_NONE"})),jN=[{label:"Core",tools:["retain","sync_retain","recall","reflect"]},{label:"Bank management",tools:["list_banks","create_bank","get_bank","get_bank_stats","update_bank","delete_bank","clear_memories"]},{label:"Mental models",tools:["list_mental_models","get_mental_model","create_mental_model","update_mental_model","delete_mental_model","refresh_mental_model"]},{label:"Directives",tools:["list_directives","create_directive","delete_directive"]},{label:"Memories",tools:["list_memories","get_memory"]},{label:"Documents",tools:["list_documents","get_document","delete_document"]},{label:"Operations",tools:["list_operations","get_operation","cancel_operation"]},{label:"Tags",tools:["list_tags"]}],jk=jN.flatMap(e=>e.tools);function jE(e){return Array.isArray(e)?e:e&&"object"==typeof e&&Array.isArray(e.attributes)?e.attributes:null}function jC(e){return{retain_chunk_size:e.retain_chunk_size??null,retain_extraction_mode:e.retain_extraction_mode??null,retain_mission:e.retain_mission??null,retain_custom_instructions:e.retain_custom_instructions??null,entities_allow_free_form:e.entities_allow_free_form??null,entity_labels:jE(e.entity_labels)}}function j_(e){return{retain_default_strategy:e.retain_default_strategy??null,retain_strategies:e.retain_strategies??null}}function jS(e){return{enable_observations:e.enable_observations??null,consolidation_llm_batch_size:e.consolidation_llm_batch_size??null,consolidation_source_facts_max_tokens:e.consolidation_source_facts_max_tokens??null,consolidation_source_facts_max_tokens_per_observation:e.consolidation_source_facts_max_tokens_per_observation??null,observations_mission:e.observations_mission??null,max_observations_per_scope:e.max_observations_per_scope??null}}function jT(e){return{mcp_enabled_tools:e.mcp_enabled_tools??null}}function jA(e){return{llm_gemini_safety_settings:e.llm_gemini_safety_settings??null}}let jO={reflect_mission:"",disposition_skepticism:3,disposition_literalism:3,disposition_empathy:3};function jM(){let{currentBank:e}=(0,ey.useBank)(),{features:t}=(0,ew.useFeatures)(),n=t?.bank_config_api??!0,[r,i]=(0,em.useState)(!0),[a,o]=(0,em.useState)({}),[s,l]=(0,em.useState)(jO),[c,u]=(0,em.useState)(jC({})),[d,h]=(0,em.useState)(j_({})),[f,p]=(0,em.useState)(jS({})),[g,v]=(0,em.useState)(jO),[x,y]=(0,em.useState)(jT({})),[b,w]=(0,em.useState)(jA({})),[j,N]=(0,em.useState)(!1),[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(!1),[A,O]=(0,em.useState)(!1),[M,P]=(0,em.useState)(null),[D,L]=(0,em.useState)(null),[I,R]=(0,em.useState)(null),[B,z]=(0,em.useState)(null),[F,V]=(0,em.useState)(null),U=(0,em.useMemo)(()=>JSON.stringify(c)!==JSON.stringify(jC(a))||JSON.stringify(d)!==JSON.stringify(j_(a)),[c,d,a]),H=(0,em.useMemo)(()=>JSON.stringify(f)!==JSON.stringify(jS(a)),[f,a]),W=(0,em.useMemo)(()=>JSON.stringify(g)!==JSON.stringify(s),[g,s]),Y=(0,em.useMemo)(()=>JSON.stringify(x)!==JSON.stringify(jT(a)),[x,a]),G=(0,em.useMemo)(()=>JSON.stringify(b)!==JSON.stringify(jA(a)),[b,a]);(0,em.useEffect)(()=>{e&&$()},[e]);let $=async()=>{if(e){i(!0);try{let[t,n]=await Promise.all([eD.client.getBankConfig(e),eD.client.getBankProfile(e)]),r=t.config,i={reflect_mission:n.mission??"",disposition_skepticism:r.disposition_skepticism??n.disposition?.skepticism??3,disposition_literalism:r.disposition_literalism??n.disposition?.literalism??3,disposition_empathy:r.disposition_empathy??n.disposition?.empathy??3};o(r),l(i),u(jC(r)),h(j_(r)),p(jS(r)),v(i),y(jT(r)),w(jA(r))}catch(e){console.error("Failed to load bank data:",e)}finally{i(!1)}}},X=async()=>{if(e){N(!0),P(null);try{let t={...c,...d};await eD.client.updateBankConfig(e,t),o(e=>({...e,...t}))}catch(e){P(e.message||"Failed to save retain settings")}finally{N(!1)}}},q=async()=>{if(e){E(!0),L(null);try{await eD.client.updateBankConfig(e,f),o(e=>({...e,...f}))}catch(e){L(e.message||"Failed to save observations settings")}finally{E(!1)}}},K=async()=>{if(e){_(!0),R(null);try{await eD.client.updateBankConfig(e,{reflect_mission:g.reflect_mission||null,disposition_skepticism:g.disposition_skepticism,disposition_literalism:g.disposition_literalism,disposition_empathy:g.disposition_empathy}),l(g)}catch(e){R(e.message||"Failed to save reflect settings")}finally{_(!1)}}},Z=async()=>{if(e){T(!0),z(null);try{await eD.client.updateBankConfig(e,x),o(e=>({...e,...x}))}catch(e){z(e.message||"Failed to save MCP settings")}finally{T(!1)}}},Q=async()=>{if(e){O(!0),V(null);try{await eD.client.updateBankConfig(e,b),o(e=>({...e,...b}))}catch(e){V(e.message||"Failed to save Gemini settings")}finally{O(!1)}}};return e?n?r?(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)(tH.default,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,ep.jsx)(ep.Fragment,{children:(0,ep.jsxs)("div",{className:"space-y-8",children:[(0,ep.jsxs)(jz,{title:"Retain",description:"Default extraction settings and named strategies. Pass a strategy name on retain requests to override defaults per-item.",error:M,dirty:U,saving:j,onSave:X,children:[(0,ep.jsx)(jF,{label:"Default strategy",description:"Applied automatically when no strategy is specified on a request.",children:(0,ep.jsxs)(tR.Select,{value:d.retain_default_strategy??"__none__",onValueChange:e=>h(t=>({...t,retain_default_strategy:"__none__"===e?null:e})),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-full",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"__none__",children:(0,ep.jsx)("span",{className:"text-muted-foreground italic",children:"Default"})}),Object.keys(d.retain_strategies??{}).map(e=>(0,ep.jsx)(tR.SelectItem,{value:e,children:e},e))]})]})}),(0,ep.jsx)(jR,{defaultValues:c,onDefaultChange:e=>u(t=>({...t,...e})),strategies:d.retain_strategies,onStrategiesChange:e=>h(t=>({...t,retain_strategies:e}))})]}),(0,ep.jsxs)(jz,{title:"Observations",description:"Control how facts are synthesized into durable observations",error:D,dirty:H,saving:k,onSave:q,children:[(0,ep.jsx)(jF,{label:"Enable Observations",description:"Enable automatic consolidation of facts into observations",children:(0,ep.jsx)("div",{className:"flex justify-end",children:(0,ep.jsx)(tI.Switch,{checked:f.enable_observations??!1,onCheckedChange:e=>p(t=>({...t,enable_observations:e}))})})}),(0,ep.jsx)(jV,{label:"Mission",description:"What this bank should synthesise into durable observations. Replaces the built-in consolidation rules — leave blank to use the server default.",value:f.observations_mission??"",onChange:e=>p(t=>({...t,observations_mission:e||null})),placeholder:"e.g. Observations are stable facts about people and projects. Always include preferences, skills, and recurring patterns. Ignore one-off events and ephemeral state.",rows:3}),(0,ep.jsx)(jF,{label:"LLM Batch Size",description:"Number of facts sent to the LLM in a single consolidation call. Higher values reduce LLM calls at the cost of larger prompts. Leave blank to use the server default.",children:(0,ep.jsx)(eI.Input,{type:"number",min:1,max:64,value:f.consolidation_llm_batch_size??"",onChange:e=>p(t=>({...t,consolidation_llm_batch_size:e.target.value?parseInt(e.target.value,10):null})),placeholder:"Server default"})}),(0,ep.jsx)(jF,{label:"Source Facts Max Tokens",description:"Total token budget for source facts included with observations during consolidation. -1 = unlimited.",children:(0,ep.jsx)(eI.Input,{type:"number",min:-1,value:f.consolidation_source_facts_max_tokens??"",onChange:e=>p(t=>({...t,consolidation_source_facts_max_tokens:e.target.value?parseInt(e.target.value,10):null})),placeholder:"Server default"})}),(0,ep.jsx)(jF,{label:"Source Facts Max Tokens Per Observation",description:"Per-observation token cap for source facts during consolidation. Each observation gets at most this many tokens of source facts. -1 = unlimited.",children:(0,ep.jsx)(eI.Input,{type:"number",min:-1,value:f.consolidation_source_facts_max_tokens_per_observation??"",onChange:e=>p(t=>({...t,consolidation_source_facts_max_tokens_per_observation:e.target.value?parseInt(e.target.value,10):null})),placeholder:"Server default"})}),(0,ep.jsx)(jF,{label:"Max Observations Per Scope",description:"Maximum number of observations allowed per tag scope. When the limit is reached, only updates and deletes are allowed. Observations with no tags are not subject to this limit. -1 = unlimited.",children:(0,ep.jsx)(eI.Input,{type:"number",min:-1,value:f.max_observations_per_scope??"",onChange:e=>p(t=>({...t,max_observations_per_scope:e.target.value?parseInt(e.target.value,10):null})),placeholder:"Server default"})})]}),(0,ep.jsxs)(jz,{title:"Reflect",description:"Shape how the bank reasons and responds in reflect operations",error:I,dirty:W,saving:C,onSave:K,children:[(0,ep.jsx)(jV,{label:"Mission",description:"Agent identity and purpose. Used as framing context in reflect.",value:g.reflect_mission,onChange:e=>v(t=>({...t,reflect_mission:e})),placeholder:"e.g. You are a senior engineering assistant. Always ground answers in documented decisions and rationale. Ignore speculation. Be direct and precise.",rows:3}),(0,ep.jsx)(jU,{label:"Skepticism",description:"How skeptical vs trusting when evaluating claims",lowLabel:"Trusting",highLabel:"Skeptical",value:g.disposition_skepticism,onChange:e=>v(t=>({...t,disposition_skepticism:e}))}),(0,ep.jsx)(jU,{label:"Literalism",description:"How literally to interpret information",lowLabel:"Flexible",highLabel:"Literal",value:g.disposition_literalism,onChange:e=>v(t=>({...t,disposition_literalism:e}))}),(0,ep.jsx)(jU,{label:"Empathy",description:"How much to weight emotional context",lowLabel:"Detached",highLabel:"Empathetic",value:g.disposition_empathy,onChange:e=>v(t=>({...t,disposition_empathy:e}))})]}),(0,ep.jsxs)(jz,{title:"MCP Tools",description:"Restrict which MCP tools this bank exposes to agents",error:B,dirty:Y,saving:S,onSave:Z,children:[(0,ep.jsx)(jF,{label:"Restrict tools",description:"When off, all tools are available. When on, only the selected tools can be invoked for this bank.",children:(0,ep.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,ep.jsx)(tI.Switch,{checked:null!==x.mcp_enabled_tools,onCheckedChange:e=>y({mcp_enabled_tools:e?[...jk]:null})}),(0,ep.jsx)(e8,{className:"text-xs text-muted-foreground",children:null!==x.mcp_enabled_tools?"Enabled":"Disabled"})]})}),null!==x.mcp_enabled_tools&&(0,ep.jsx)(jB,{selected:x.mcp_enabled_tools,onChange:e=>y({mcp_enabled_tools:e})})]}),(0,ep.jsx)(jz,{title:"Models",description:"Provider-specific model settings",error:F,dirty:G,saving:A,onSave:Q,children:(0,ep.jsxs)("div",{className:"px-6 py-4 space-y-4",children:[(0,ep.jsx)("p",{className:"text-sm font-semibold",children:"Gemini / Vertex AI"}),(0,ep.jsxs)("div",{className:"pl-4 border-l-2 border-border/40 space-y-4",children:[(0,ep.jsx)(jF,{label:"Safety settings",description:(0,ep.jsxs)(ep.Fragment,{children:["When off, Gemini's default safety thresholds are used. When on, configure thresholds per harm category."," ",(0,ep.jsx)("a",{href:"https://ai.google.dev/gemini-api/docs/safety-settings",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground transition-colors",children:"Learn more"})]}),children:(0,ep.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,ep.jsx)(tI.Switch,{checked:null!==b.llm_gemini_safety_settings,onCheckedChange:e=>w({llm_gemini_safety_settings:e?[...jj]:null})}),(0,ep.jsx)(e8,{className:"text-xs text-muted-foreground",children:null!==b.llm_gemini_safety_settings?"Custom":"Default"})]})}),null!==b.llm_gemini_safety_settings&&(0,ep.jsx)(jW,{value:b.llm_gemini_safety_settings,onChange:e=>w({llm_gemini_safety_settings:e})})]})]})})]})}):(0,ep.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 gap-3 text-center",children:[(0,ep.jsx)("p",{className:"text-base font-medium text-foreground",children:"Bank configuration is disabled"}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground max-w-sm",children:["Set"," ",(0,ep.jsx)("code",{className:"font-mono text-xs bg-muted px-1 py-0.5 rounded",children:"HINDSIGHT_API_ENABLE_BANK_CONFIG_API=true"})," ","to enable per-bank configuration."]})]}):(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)("p",{className:"text-muted-foreground",children:"No bank selected"})})}let jP=["concise","verbose","verbatim","chunks","custom"],jD="__inherit__";function jL({values:e,onChange:t,isOverride:n=!1}){let r=e.retain_extraction_mode??(n?jD:""),i="custom"===e.retain_extraction_mode;return(0,ep.jsxs)("div",{className:"divide-y divide-border/40",children:[(0,ep.jsx)(jF,{label:"Extraction Mode",description:"How aggressively to extract facts. concise = selective, verbose = capture everything, verbatim = store chunks as-is (still extract entities/time), chunks = no LLM, custom = write your own rules.",children:(0,ep.jsxs)(tR.Select,{value:r,onValueChange:e=>t({retain_extraction_mode:e===jD?null:e||null}),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-full",children:(0,ep.jsx)(tR.SelectValue,{placeholder:n?"Inherited from default":void 0})}),(0,ep.jsxs)(tR.SelectContent,{children:[n&&(0,ep.jsx)(tR.SelectItem,{value:jD,children:(0,ep.jsx)("span",{className:"text-muted-foreground italic",children:"inherited"})}),jP.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e,children:e},e))]})]})}),(0,ep.jsx)(jF,{label:"Chunk Size",description:"Size of text chunks for processing (characters)",children:(0,ep.jsx)(eI.Input,{type:"number",min:500,max:8e3,value:e.retain_chunk_size??"",onChange:e=>t({retain_chunk_size:e.target.value?parseFloat(e.target.value):null}),placeholder:n?"Inherited from default":void 0})}),(0,ep.jsx)(jV,{label:"Mission",description:"What this bank should pay attention to during extraction. Steers the LLM without replacing the extraction rules.",value:e.retain_mission??"",onChange:e=>t({retain_mission:e||null}),placeholder:n?"Inherited from default":"e.g. Always include technical decisions, API design choices, and architectural trade-offs.",rows:3}),i&&(0,ep.jsx)(jV,{label:"Custom Extraction Prompt",description:"Replaces the built-in extraction rules entirely. Only active when Extraction Mode is set to custom.",value:e.retain_custom_instructions??"",onChange:e=>t({retain_custom_instructions:e||null}),rows:5}),(0,ep.jsx)(jF,{label:"Free Form Entities",description:"Extract regular named entities (people, places, concepts) alongside entity labels. Disable to restrict extraction to entity labels only.",children:(0,ep.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,ep.jsx)(e8,{className:"text-sm text-muted-foreground cursor-pointer select-none",children:e.entities_allow_free_form??!0?"Enabled":"Disabled"}),(0,ep.jsx)(tI.Switch,{checked:e.entities_allow_free_form??!0,onCheckedChange:e=>t({entities_allow_free_form:e})})]})}),(0,ep.jsx)(jH,{value:e.entity_labels??[],onChange:e=>t({entity_labels:e.length>0?e:null})})]})}function jI(e){return e?Object.entries(e).map(([e,t],n)=>({id:n,name:e,values:{retain_extraction_mode:t.retain_extraction_mode??null,retain_chunk_size:t.retain_chunk_size??null,retain_mission:t.retain_mission??null,retain_custom_instructions:t.retain_custom_instructions??null,entities_allow_free_form:t.entities_allow_free_form??null,entity_labels:jE(t.entity_labels)}})):[]}function jR({defaultValues:e,onDefaultChange:t,strategies:n,onStrategiesChange:r}){let[i,a]=(0,em.useState)(()=>jI(n)),[o,s]=(0,em.useState)("default"),[l,c]=(0,em.useState)(null),u=(0,em.useRef)(!1),d=JSON.stringify(n);(0,em.useEffect)(()=>{if(u.current){u.current=!1;return}a(jI(n))},[d]);let h=e=>{u.current=!0,a(e),r(function(e){let t={};for(let n of e){if(!n.name.trim())continue;let e={};null!==n.values.retain_extraction_mode&&(e.retain_extraction_mode=n.values.retain_extraction_mode),null!==n.values.retain_chunk_size&&(e.retain_chunk_size=n.values.retain_chunk_size),n.values.retain_mission&&(e.retain_mission=n.values.retain_mission),n.values.retain_custom_instructions&&(e.retain_custom_instructions=n.values.retain_custom_instructions),null!==n.values.entities_allow_free_form&&(e.entities_allow_free_form=n.values.entities_allow_free_form),null!==n.values.entity_labels&&(e.entity_labels=n.values.entity_labels),t[n.name.trim()]=e}return Object.keys(t).length>0?t:null}(e))},f=(e,t)=>{h(i.map(n=>n.id===e?{...n,...t}:n))},p="default"!==o?i.find(e=>e.id===o):null;return(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"border-b border-border px-6 flex items-stretch gap-1 flex-wrap",children:[(0,ep.jsx)("button",{type:"button",onClick:()=>s("default"),className:`relative py-3 px-4 text-sm font-semibold transition-colors border-b-2 -mb-px ${"default"===o?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,children:"Default"}),i.map(e=>(0,ep.jsxs)("div",{className:`relative flex items-center gap-2 py-3 px-4 text-sm font-semibold transition-colors border-b-2 -mb-px cursor-pointer ${o===e.id?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,onClick:()=>s(e.id),children:[(0,ep.jsx)("span",{className:"font-mono",children:e.name||(0,ep.jsx)("span",{className:"italic font-normal opacity-50",children:"unnamed"})}),(0,ep.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),c(e)},className:"opacity-40 hover:opacity-100 hover:text-destructive transition-opacity text-base leading-none",children:"×"})]},e.id)),(0,ep.jsxs)("button",{type:"button",onClick:()=>{let e=Date.now();h([...i,{id:e,name:"",values:{retain_extraction_mode:null,retain_chunk_size:null,retain_mission:null,retain_custom_instructions:null,entities_allow_free_form:null,entity_labels:null}}]),s(e)},className:"py-3 px-3 text-sm text-muted-foreground hover:text-primary transition-colors flex items-center gap-1.5",children:[(0,ep.jsx)(fz.Plus,{className:"h-3.5 w-3.5"}),"Add strategy"]})]}),(0,ep.jsx)("div",{children:"default"===o?(0,ep.jsx)(jL,{values:e,onChange:t}):p?(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"px-6 py-3 flex items-center gap-3 border-b border-border/40",children:[(0,ep.jsx)("label",{className:"text-xs text-muted-foreground shrink-0",children:"Name"}),(0,ep.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,ep.jsx)(eI.Input,{value:p.name,onChange:e=>f(p.id,{name:e.target.value}),placeholder:"strategy name (e.g. fast)",className:`h-7 text-xs font-mono max-w-[200px] ${!p.name.trim()?"border-destructive focus-visible:ring-destructive":""}`}),!p.name.trim()&&(0,ep.jsx)("p",{className:"text-xs text-destructive",children:"Name is required"})]})]}),(0,ep.jsx)(jL,{values:p.values,onChange:e=>f(p.id,{values:{...p.values,...e}}),isOverride:!0})]}):null}),(0,ep.jsx)(mv,{open:null!==l,onOpenChange:e=>{e||c(null)},children:(0,ep.jsxs)(mD,{children:[(0,ep.jsxs)(mL,{children:[(0,ep.jsxs)(mR,{children:["Delete strategy “",l?.name||"unnamed","”?"]}),(0,ep.jsx)(mB,{children:"This will remove the strategy and all its overrides. This cannot be undone."})]}),(0,ep.jsxs)(mI,{children:[(0,ep.jsx)(mF,{children:"Cancel"}),(0,ep.jsx)(mz,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{if(l){var e;e=l.id,h(i.filter(t=>t.id!==e)),o===e&&s("default"),c(null)}},children:"Delete"})]})]})})]})}function jB({selected:e,onChange:t}){let n=new Set(e),r=jk.every(e=>n.has(e)),i=0===e.length;return(0,ep.jsxs)("div",{className:"px-6 py-4 space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground",children:[e.length," of ",jk.length," tools enabled"]}),(0,ep.jsx)("button",{type:"button",onClick:()=>{t(r?[]:[...jk])},className:"text-xs text-primary hover:underline",children:r?"Deselect all":"Select all"})]}),(0,ep.jsx)("div",{className:"space-y-4",children:jN.map(e=>{let r=e.tools.filter(e=>n.has(e)).length===e.tools.length;return(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,ep.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:e.label}),(0,ep.jsx)("button",{type:"button",onClick:()=>{let i=new Set(n);r?e.tools.forEach(e=>i.delete(e)):e.tools.forEach(e=>i.add(e)),t(jk.filter(e=>i.has(e)))},className:"text-xs text-primary hover:underline",children:r?"Deselect":"Select all"})]}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-2",children:e.tools.map(e=>{let r=n.has(e);return(0,ep.jsx)("button",{type:"button",onClick:()=>{let r;(r=new Set(n)).has(e)?r.delete(e):r.add(e),t(jk.filter(e=>r.has(e)))},className:`px-2.5 py-1 rounded text-xs font-mono transition-colors border ${r?"bg-primary text-primary-foreground border-primary":"bg-muted/30 text-muted-foreground border-border/40 hover:border-primary/40"}`,children:e},e)})})]},e.label)})}),i&&(0,ep.jsx)("p",{className:"text-xs text-destructive",children:"Warning: no tools selected — agents will be blocked from all MCP calls for this bank."})]})}function jz({title:e,description:t,children:n,error:r,dirty:i,saving:a,onSave:o}){return(0,ep.jsxs)("section",{className:"space-y-3",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h2",{className:"text-lg font-semibold",children:e}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:t})]}),(0,ep.jsxs)(m7,{className:"bg-muted/20 border-border/40",children:[(0,ep.jsx)("div",{className:"divide-y divide-border/40",children:n}),r&&(0,ep.jsx)("div",{className:"px-6 pb-2 pt-2",children:(0,ep.jsxs)(jv,{variant:"destructive",children:[(0,ep.jsx)(jy,{className:"h-4 w-4"}),(0,ep.jsx)(jx,{children:r})]})}),(0,ep.jsx)("div",{className:"px-6 py-4 flex justify-end border-t border-border/40",children:(0,ep.jsx)(eL.Button,{size:"sm",disabled:!i||a,onClick:o,children:a?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.default,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):"Save changes"})})]})]})}function jF({label:e,description:t,children:n}){return(0,ep.jsx)("div",{className:"px-6 py-4",children:(0,ep.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsx)("p",{className:"text-sm font-medium",children:e}),t&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]}),(0,ep.jsx)("div",{className:"md:w-64 shrink-0",children:n})]})})}function jV({label:e,description:t,value:n,onChange:r,placeholder:i,rows:a}){return(0,ep.jsx)("div",{className:"px-6 py-4",children:(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm font-medium",children:e}),t&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]}),(0,ep.jsx)(gl.Textarea,{value:n,onChange:e=>r(e.target.value),placeholder:i,rows:a??3,className:"font-mono text-sm"})]})})}function jU({label:e,description:t,lowLabel:n,highLabel:r,value:i,onChange:a}){return(0,ep.jsx)("div",{className:"px-6 py-4",children:(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm font-medium",children:e}),t&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[n&&(0,ep.jsx)("span",{className:"text-xs text-muted-foreground w-16 text-right shrink-0",children:n}),(0,ep.jsx)("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(e=>(0,ep.jsx)("button",{type:"button",onClick:()=>a(e),className:`w-4 h-4 rounded-full transition-colors hover:opacity-80 ${e<=i?"bg-primary":"bg-muted"}`},e))}),r&&(0,ep.jsx)("span",{className:"text-xs text-muted-foreground w-20 shrink-0",children:r}),(0,ep.jsxs)("span",{className:"text-xs font-mono text-muted-foreground ml-1 shrink-0",children:[i,"/5"]})]})]})})}function jH({value:e,onChange:t}){let[n,r]=(0,em.useState)({}),i=(n,r)=>{t(e.map((e,t)=>t===n?{...e,...r}:e))},a=(t,n,r)=>{let a=e[t].values.map((e,t)=>t===n?{...e,...r}:e);i(t,{values:a})};return(0,ep.jsxs)("div",{className:"px-6 py-4 space-y-3",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm font-medium",children:"Entity Labels"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Classification labels extracted at retain time. Leave empty to disable."})]}),e.length>0&&(0,ep.jsxs)("span",{className:"text-xs bg-primary/10 text-primary px-2 py-0.5 rounded-full shrink-0",children:[e.length," group",1!==e.length?"s":""]})]}),0===e.length&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No entity labels defined."}),(0,ep.jsx)("div",{className:"space-y-2",children:e.map((o,s)=>{let l=n[s]??!1,c="text"===o.type,u=!c;return(0,ep.jsxs)("div",{className:"border border-border/50 rounded-md bg-background",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2",children:[(0,ep.jsx)("button",{type:"button",onClick:()=>r(e=>({...e,[s]:!l})),className:"text-muted-foreground hover:text-foreground shrink-0",disabled:c,children:l&&u?(0,ep.jsx)(mW.ChevronDown,{className:"h-4 w-4"}):(0,ep.jsx)(eT.ChevronRight,{className:`h-4 w-4 ${c?"opacity-30":""}`})}),(0,ep.jsx)(eI.Input,{placeholder:"key (e.g. pedagogy)",value:o.key,onChange:e=>i(s,{key:e.target.value}),className:"h-8 text-xs font-mono w-36 shrink-0"}),(0,ep.jsx)(eI.Input,{placeholder:c?"description / examples":"description",value:o.description,onChange:e=>i(s,{description:e.target.value}),className:"h-8 text-xs flex-1 min-w-0"}),(0,ep.jsxs)(tR.Select,{value:o.type,onValueChange:e=>i(s,{type:e,..."text"===e?{values:[]}:{}}),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"h-8 text-xs w-32 shrink-0",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"value",className:"text-xs",children:"Single value"}),(0,ep.jsx)(tR.SelectItem,{value:"multi-values",className:"text-xs",children:"Multi-values"}),(0,ep.jsx)(tR.SelectItem,{value:"text",className:"text-xs",children:"Free text"})]})]}),(0,ep.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0 cursor-pointer select-none",children:[(0,ep.jsx)(m2.Checkbox,{checked:o.tag,onCheckedChange:e=>i(s,{tag:!!e}),className:"h-4 w-4"}),"tag"]}),(0,ep.jsx)("button",{type:"button",onClick:()=>{t(e.filter((e,t)=>t!==s)),r(e=>{let t={...e};return delete t[s],t})},className:"text-muted-foreground hover:text-destructive shrink-0",children:(0,ep.jsx)(mV,{className:"h-3.5 w-3.5"})})]}),l&&u&&(0,ep.jsxs)("div",{className:"px-3 pb-3 space-y-1 border-t border-border/30 pt-2",children:[0===o.values.length&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground italic pl-5",children:"No values yet."}),o.values.map((t,n)=>(0,ep.jsxs)("div",{className:"flex items-center gap-2 pl-5",children:[(0,ep.jsx)(eI.Input,{placeholder:"value",value:t.value,onChange:e=>a(s,n,{value:e.target.value}),className:"h-8 text-xs font-mono w-32 shrink-0"}),(0,ep.jsx)(eI.Input,{placeholder:"description",value:t.description,onChange:e=>a(s,n,{description:e.target.value}),className:"h-8 text-xs flex-1 min-w-0"}),(0,ep.jsx)("button",{type:"button",onClick:()=>{i(s,{values:e[s].values.filter((e,t)=>t!==n)})},className:"text-muted-foreground hover:text-destructive shrink-0",children:(0,ep.jsx)(mV,{className:"h-3.5 w-3.5"})})]},n)),(0,ep.jsxs)("button",{type:"button",onClick:()=>{i(s,{values:[...e[s].values,{value:"",description:""}]})},className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground pl-5 mt-1",children:[(0,ep.jsx)(fz.Plus,{className:"h-3 w-3"}),"Add value"]})]})]},s)})}),(0,ep.jsxs)("button",{type:"button",onClick:()=>{let n=[...e,{key:"",description:"",type:"value",optional:!0,tag:!1,values:[]}];t(n),r(e=>({...e,[n.length-1]:!0}))},className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground",children:[(0,ep.jsx)(fz.Plus,{className:"h-3.5 w-3.5"}),"Add attribute"]})]})}function jW({value:e,onChange:t}){let n=t=>e.find(e=>e.category===t)?.threshold??"BLOCK_MEDIUM_AND_ABOVE";return(0,ep.jsxs)("div",{className:"px-6 py-4 space-y-3",children:[(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground",children:['Set the blocking threshold for each harm category. "Off" disables the filter entirely (default for Gemini 2.5+). Lower thresholds block more content.'," ",(0,ep.jsx)("a",{href:"https://ai.google.dev/gemini-api/docs/safety-settings",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground transition-colors",children:"Learn more"})]}),(0,ep.jsx)("div",{className:"space-y-2",children:jb.map(e=>(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,ep.jsx)("span",{className:"text-sm",children:e.label}),(0,ep.jsxs)(tR.Select,{value:n(e.value),onValueChange:r=>{var i;return i=e.value,void t(jb.map(e=>({category:e.value,threshold:e.value===i?r:n(e.value)})))},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-48 h-8 text-xs",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsx)(tR.SelectContent,{children:jw.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e.value,className:"text-xs",children:e.label},e.value))})]})]},e.value))})]})}let jY=(0,eN.default)("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]),jG=(0,eN.default)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),j$=(0,eN.default)("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);var jX=e.i(23287),jX=jX;let jq=(0,eN.default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),jK=(0,eN.default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.i(34471);var jZ=Symbol.for("immer-nothing"),jQ=Symbol.for("immer-draftable"),jJ=Symbol.for("immer-state");function j0(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var j1=Object,j2=j1.getPrototypeOf,j5="constructor",j3="prototype",j4="configurable",j6="enumerable",j8="writable",j7="value",j9=e=>!!e&&!!e[jJ];function Ne(e){return!!e&&(Nr(e)||Nc(e)||!!e[jQ]||!!e[j5]?.[jQ]||Nu(e)||Nd(e))}var Nt=j1[j3][j5].toString(),Nn=new WeakMap;function Nr(e){if(!e||!Nh(e))return!1;let t=j2(e);if(null===t||t===j1[j3])return!0;let n=j1.hasOwnProperty.call(t,j5)&&t[j5];if(n===Object)return!0;if(!Nf(n))return!1;let r=Nn.get(n);return void 0===r&&(r=Function.toString.call(n),Nn.set(n,r)),r===Nt}function Ni(e,t,n=!0){0===Na(e)?(n?Reflect.ownKeys(e):j1.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Na(e){let t=e[jJ];return t?t.type_:Nc(e)?1:Nu(e)?2:3*!!Nd(e)}var No=(e,t,n=Na(e))=>2===n?e.has(t):j1[j3].hasOwnProperty.call(e,t),Ns=(e,t,n=Na(e))=>2===n?e.get(t):e[t],Nl=(e,t,n,r=Na(e))=>{2===r?e.set(t,n):3===r?e.add(n):e[t]=n},Nc=Array.isArray,Nu=e=>e instanceof Map,Nd=e=>e instanceof Set,Nh=e=>"object"==typeof e,Nf=e=>"function"==typeof e,Np=e=>e.modified_?e.copy_:e.base_;function Nm(e,t){if(Nu(e))return new Map(e);if(Nd(e))return new Set(e);if(Nc(e))return Array[j3].slice.call(e);let n=Nr(e);if(!0!==t&&("class_only"!==t||n)){let t=j2(e);if(null!==t&&n)return{...e};let r=j1.create(t);return j1.assign(r,e)}{let t=j1.getOwnPropertyDescriptors(e);delete t[jJ];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];!1===a[j8]&&(a[j8]=!0,a[j4]=!0),(a.get||a.set)&&(t[i]={[j4]:!0,[j8]:!0,[j6]:a[j6],[j7]:e[i]})}return j1.create(j2(e),t)}}function Ng(e,t=!1){return Nx(e)||j9(e)||!Ne(e)||(Na(e)>1&&j1.defineProperties(e,{set:Nv,add:Nv,clear:Nv,delete:Nv}),j1.freeze(e),t&&Ni(e,(e,t)=>{Ng(t,!0)},!1)),e}var Nv={[j7]:function(){j0(2)}};function Nx(e){return!(null!==e&&Nh(e))||j1.isFrozen(e)}var Ny="MapSet",Nb="Patches",Nw="ArrayMethods",Nj={};function NN(e){let t=Nj[e];return t||j0(0,e),t}var Nk=e=>!!Nj[e];function NE(e,t){t&&(e.patchPlugin_=NN(Nb),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function NC(e){N_(e),e.drafts_.forEach(NT),e.drafts_=null}function N_(e){e===I&&(I=e.parent_)}var NS=e=>I={drafts_:[],parent_:I,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Nk(Ny)?NN(Ny):void 0,arrayMethodsPlugin_:Nk(Nw)?NN(Nw):void 0};function NT(e){let t=e[jJ];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function NA(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(void 0!==e&&e!==n){n[jJ].modified_&&(NC(t),j0(4)),Ne(e)&&(e=NO(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[jJ].base_,e,t)}else e=NO(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ng(t,n)}(t,e,!0),NC(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==jZ?e:void 0}function NO(e,t){if(Nx(t))return t;let n=t[jJ];if(!n)return NR(t,e.handledSet_,e);if(!NP(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);NI(n,e)}return n.copy_}function NM(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var NP=(e,t)=>e.scope_===t,ND=[];function NL(e,t,n,r){let i=e.copy_||e.base_,a=e.type_;if(void 0!==r&&Ns(i,r,a)===t)return void Nl(i,r,n,a);if(!e.draftLocations_){let t=e.draftLocations_=new Map;Ni(i,(e,n)=>{if(j9(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}for(let r of e.draftLocations_.get(t)??ND)Nl(i,r,n,a)}function NI(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}NM(e)}}function NR(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||j9(e)||t.has(e)||!Ne(e)||Nx(e)||(t.add(e),Ni(e,(r,i)=>{if(j9(i)){let t=i[jJ];NP(t,n)&&(Nl(e,r,Np(t),e.type_),NM(t))}else Ne(i)&&NR(i,t,n)})),e}var NB={get(e,t){let n;if(t===jJ)return e;let r=e.scope_.arrayMethodsPlugin_,i=1===e.type_&&"string"==typeof t;if(i&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);let a=e.copy_||e.base_;if(!No(a,t,e.type_)){var o;let n;return o=e,(n=NV(a,t))?j7 in n?n[j7]:n.get?.call(o.draft_):void 0}let s=a[t];if(e.finalized_||!Ne(s)||i&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Number.isInteger(n=+t)&&String(n)===t)return s;if(s===NF(e.base_,t)){NH(e);let n=1===e.type_?+t:t,r=NW(e.scope_,s,e,n);return e.copy_[n]=r}return s},has:(e,t)=>t in(e.copy_||e.base_),ownKeys:e=>Reflect.ownKeys(e.copy_||e.base_),set(e,t,n){let r=NV(e.copy_||e.base_,t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=NF(e.copy_||e.base_,t),i=r?.[jJ];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if((n===r?0!==n||1/n==1/r:n!=n&&r!=r)&&(void 0!==n||No(e.base_,t,e.type_)))return!0;NH(e),NU(e)}return!!(e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t]))||(e.copy_[t]=n,e.assigned_.set(t,!0),!function(e,t,n){let{scope_:r}=e;if(j9(n)){let i=n[jJ];NP(i,r)&&i.callbacks_.push(function(){NH(e),NL(e,n,Np(i),t)})}else Ne(n)&&e.callbacks_.push(function(){let i=e.copy_||e.base_;3===e.type_?i.has(n)&&NR(n,r.handledSet_,r):Ns(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&NR(Ns(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n),!0)},deleteProperty:(e,t)=>(NH(e),void 0!==NF(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),NU(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){let n=e.copy_||e.base_,r=Reflect.getOwnPropertyDescriptor(n,t);return r?{[j8]:!0,[j4]:1!==e.type_||"length"!==t,[j6]:r[j6],[j7]:n[t]}:r},defineProperty(){j0(11)},getPrototypeOf:e=>j2(e.base_),setPrototypeOf(){j0(12)}},Nz={};for(let e in NB){let t=NB[e];Nz[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function NF(e,t){let n=e[jJ];return(n?n.copy_||n.base_:e)[t]}function NV(e,t){if(!(t in e))return;let n=j2(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=j2(n)}}function NU(e){!e.modified_&&(e.modified_=!0,e.parent_&&NU(e.parent_))}function NH(e){e.copy_||(e.assigned_=new Map,e.copy_=Nm(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function NW(e,t,n,r){let[i,a]=Nu(t)?NN(Ny).proxyMap_(t,n):Nd(t)?NN(Ny).proxySet_(t,n):function(e,t){let n=Nc(e),r={type_:+!!n,scope_:t?t.scope_:I,modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=NB;n&&(i=[r],a=Nz);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}(t,n);if((n?.scope_??I).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&void 0!==r)n.callbacks_.push(function(e){if(!a||!NP(a,e))return;e.mapSetPlugin_?.fixSetContents(a);let t=Np(a);NL(n,a.draft_??a,t,r),NI(a,e)});else a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)});return i}function NY(e){return j9(e)||j0(10,e),function e(t){let n;if(!Ne(t)||Nx(t))return t;let r=t[jJ],i=!0;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=Nm(t,r.scope_.immer_.useStrictShallowCopy_),i=r.scope_.immer_.shouldUseStrictIteration()}else n=Nm(t,!0);return Ni(n,(t,r)=>{Nl(n,t,e(r))},i),r&&(r.finalized_=!1),n}(e)}Nz.deleteProperty=function(e,t){return Nz.set.call(this,e,t,void 0)},Nz.set=function(e,t,n){return NB.set.call(this,e[0],t,n,e[0])};var NG=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{let r;if(Nf(e)&&!Nf(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}if(Nf(t)||j0(6),void 0===n||Nf(n)||j0(7),Ne(e)){let i=NS(this),a=NW(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?NC(i):N_(i)}return NE(i,n),NA(r,i)}if(e&&Nh(e))j0(1,e);else{if(void 0===(r=t(e))&&(r=e),r===jZ&&(r=void 0),this.autoFreeze_&&Ng(r,!0),n){let t=[],i=[];NN(Nb).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}},this.produceWithPatches=(e,t)=>{let n,r;return Nf(e)?(t,...n)=>this.produceWithPatches(t,t=>e(t,...n)):[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},(e=>"boolean"==typeof e)(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),(e=>"boolean"==typeof e)(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),(e=>"boolean"==typeof e)(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Ne(e)||j0(8),j9(e)&&(e=NY(e));let t=NS(this),n=NW(t,e,void 0);return n[jJ].isManual_=!0,N_(t),n}finishDraft(e,t){let n=e&&e[jJ];n&&n.isManual_||j0(9);let{scope_:r}=n;return NE(r,t),NA(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=NN(Nb).applyPatches_;return j9(e)?r(e,t):this.produce(e,e=>r(e,t))}}().produce,N$=e=>Array.isArray(e)?e:[e],NX=0,Nq=class{revision=NX;_value;_lastValue;_isEqual=NK;constructor(e,t=NK){this._value=this._lastValue=e,this._isEqual=t}get value(){return this._value}set value(e){this.value!==e&&(this._value=e,this.revision=++NX)}};function NK(e,t){return e===t}function NZ(e){return e instanceof Nq||console.warn("Not a valid cell! ",e),e.value}var NQ=(e,t)=>!1;function NJ(){return function(e=NK){return new Nq(null,e)}(NQ)}var N0=e=>{let t=e.collectionTag;null===t&&(t=e.collectionTag=NJ()),NZ(t)};Symbol();var N1=0,N2=Object.getPrototypeOf({}),N5=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy(this,N3);tag=NJ();tags={};children={};collectionTag=null;id=N1++},N3={get:(e,t)=>(function(){let{value:n}=e,r=Reflect.get(n,t);if("symbol"==typeof t||t in N2)return r;if("object"==typeof r&&null!==r){var i;let n=e.children[t];return void 0===n&&(n=e.children[t]=Array.isArray(i=r)?new N4(i):new N5(i)),n.tag&&NZ(n.tag),n.proxy}{let n=e.tags[t];return void 0===n&&((n=e.tags[t]=NJ()).value=r),NZ(n),r}})(),ownKeys:e=>(N0(e),Reflect.ownKeys(e.value)),getOwnPropertyDescriptor:(e,t)=>Reflect.getOwnPropertyDescriptor(e.value,t),has:(e,t)=>Reflect.has(e.value,t)},N4=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy([this],N6);tag=NJ();tags={};children={};collectionTag=null;id=N1++},N6={get:([e],t)=>("length"===t&&N0(e),N3.get(e,t)),ownKeys:([e])=>N3.ownKeys(e),getOwnPropertyDescriptor:([e],t)=>N3.getOwnPropertyDescriptor(e,t),has:([e],t)=>N3.has(e,t)},N8="u">typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function N7(){return{s:0,v:void 0,o:null,p:null}}function N9(e,t={}){let n,r=N7(),{resultEqualityCheck:i}=t,a=0;function o(){let t,o=r,{length:s}=arguments;for(let e=0;e<s;e++){let t=arguments[e];if("function"==typeof t||"object"==typeof t&&null!==t){let e=o.o;null===e&&(o.o=e=new WeakMap);let n=e.get(t);void 0===n?(o=N7(),e.set(t,o)):o=n}else{let e=o.p;null===e&&(o.p=e=new Map);let n=e.get(t);void 0===n?(o=N7(),e.set(t,o)):o=n}}let l=o;if(1===o.s)t=o.v;else if(t=e.apply(null,arguments),a++,i){let e=n?.deref?.()??n;null!=e&&i(e,t)&&(t=e,0!==a&&a--),n="object"==typeof t&&null!==t||"function"==typeof t?new N8(t):t}return l.s=1,l.v=t,t}return o.clearCache=()=>{r=N7(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}var ke=function(e,...t){let n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r,i=0,a=0,o={},s=e.pop();"object"==typeof s&&(o=s,s=e.pop()),function(e,t=`expected a function, instead received ${typeof e}`){if("function"!=typeof e)throw TypeError(t)}(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);let{memoize:l,memoizeOptions:c=[],argsMemoize:u=N9,argsMemoizeOptions:d=[],devModeChecks:h={}}={...n,...o},f=N$(c),p=N$(d),g=(!function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(e=>"function"==typeof e)){let n=e.map(e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e).join(", ");throw TypeError(`${t}[${n}]`)}}(t=Array.isArray(e[0])?e[0]:e,"createSelector expects all input-selectors to be functions, but received the following types: "),t),v=l(function(){return i++,s.apply(null,arguments)},...f);return Object.assign(u(function(){a++;let e=function(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}(g,arguments);return r=v.apply(null,e)},...p),{resultFunc:s,memoizedResultFunc:v,dependencies:g,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>r,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:l,argsMemoize:u})};return Object.assign(r,{withTypes:()=>r}),r}(N9),kt=Object.assign((e,t=ke)=>{!function(e,t=`expected an object, instead received ${typeof e}`){if("object"!=typeof e)throw TypeError(t)}(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>kt});function kn(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var kr="function"==typeof Symbol&&Symbol.observable||"@@observable",ki=()=>Math.random().toString(36).substring(7).split("").join("."),ka={INIT:`@@redux/INIT${ki()}`,REPLACE:`@@redux/REPLACE${ki()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${ki()}`};function ko(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function ks(e){let t,n=Object.keys(e),r={};for(let t=0;t<n.length;t++){let i=n[t];"function"==typeof e[i]&&(r[i]=e[i])}let i=Object.keys(r);try{Object.keys(r).forEach(e=>{let t=r[e];if(void 0===t(void 0,{type:ka.INIT}))throw Error(kn(12));if(void 0===t(void 0,{type:ka.PROBE_UNKNOWN_ACTION()}))throw Error(kn(13))})}catch(e){t=e}return function(e={},n){if(t)throw t;let a=!1,o={};for(let t=0;t<i.length;t++){let s=i[t],l=r[s],c=e[s],u=l(c,n);if(void 0===u)throw n&&n.type,Error(kn(14));o[s]=u,a=a||u!==c}return(a=a||i.length!==Object.keys(e).length)?o:e}}function kl(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function kc(e){return ko(e)&&"type"in e&&"string"==typeof e.type}function ku(e){return({dispatch:t,getState:n})=>r=>i=>"function"==typeof i?i(t,n,e):r(i)}var kd=ku(),kh="u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!=arguments.length)return"object"==typeof arguments[0]?kl:kl.apply(null,arguments)};function kf(e,t){function n(...r){if(t){let n=t(...r);if(!n)throw Error(k2(0));return{type:e,payload:n.payload,..."meta"in n&&{meta:n.meta},..."error"in n&&{error:n.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>kc(t)&&t.type===e,n}"u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var kp=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function km(e){return Ne(e)?NG(e,()=>{}):e}function kg(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var kv="RTK_autoBatch",kx=()=>e=>({payload:e,meta:{[kv]:!0}}),ky=e=>t=>{setTimeout(t,e)},kb=(e={type:"raf"})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,l="tick"===e.type?queueMicrotask:"raf"===e.type?"u">typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:ky(10):"callback"===e.type?e.queueNotification:ky(e.timeout),c=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return(a=!(i=!e?.meta?.[kv]))&&!o&&(o=!0,l(c)),r.dispatch(e)}finally{i=!0}}})};function kw(e){let t,n={},r=[],i={addCase(e,t){let r="string"==typeof e?e:e.type;if(!r)throw Error(k2(28));if(r in n)throw Error(k2(29));return n[r]=t,i},addAsyncThunk:(e,t)=>(t.pending&&(n[e.pending.type]=t.pending),t.rejected&&(n[e.rejected.type]=t.rejected),t.fulfilled&&(n[e.fulfilled.type]=t.fulfilled),t.settled&&r.push({matcher:e.settled,reducer:t.settled}),i),addMatcher:(e,t)=>(r.push({matcher:e,reducer:t}),i),addDefaultCase:e=>(t=e,i)};return e(i),[n,r,t]}var kj=Symbol.for("rtk-slice-createasyncthunk"),kN=((c=kN||{}).reducer="reducer",c.reducerWithPrepare="reducerWithPrepare",c.asyncThunk="asyncThunk",c),kk=function({creators:e}={}){let t=e?.asyncThunk?.[kj];return function(e){let n,{name:r,reducerPath:i=r}=e;if(!r)throw Error(k2(11));let a=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},o=Object.keys(a),s={},l={},c={},u=[],d={addCase(e,t){let n="string"==typeof e?e:e.type;if(!n)throw Error(k2(12));if(n in l)throw Error(k2(13));return l[n]=t,d},addMatcher:(e,t)=>(u.push({matcher:e,reducer:t}),d),exposeAction:(e,t)=>(c[e]=t,d),exposeCaseReducer:(e,t)=>(s[e]=t,d)};function h(){let[t={},n=[],r]="function"==typeof e.extraReducers?kw(e.extraReducers):[e.extraReducers],i={...t,...l};return function(e,t){let n,[r,i,a]=kw(t);if("function"==typeof e)n=()=>km(e());else{let t=km(e);n=()=>t}function o(e=n(),t){let s=[r[t.type],...i.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return 0===s.filter(e=>!!e).length&&(s=[a]),s.reduce((e,n)=>{if(n)if(j9(e)){let r=n(e,t);return void 0===r?e:r}else{if(Ne(e))return NG(e,e=>n(e,t));let r=n(e,t);if(void 0===r){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}return e},e)}return o.getInitialState=n,o}(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of u)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}o.forEach(n=>{let i=a[n],o={reducerName:n,type:`${r}/${n}`,createNotation:"function"==typeof e.reducers};"asyncThunk"===i._reducerDefinitionType?function({type:e,reducerName:t},n,r,i){if(!i)throw Error(k2(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:l,settled:c,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),l&&r.addCase(d.rejected,l),c&&r.addMatcher(d.settled,c),r.exposeCaseReducer(t,{fulfilled:o||kE,pending:s||kE,rejected:l||kE,settled:c||kE})}(o,i,d,t):function({type:e,reducerName:t,createNotation:n},r,i){let a,o;if("reducer"in r){if(n&&"reducerWithPrepare"!==r._reducerDefinitionType)throw Error(k2(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?kf(e,o):kf(e))}(o,i,d)});let f=e=>e,p=new Map,g=new WeakMap;function v(e,t){return n||(n=h()),n(e,t)}function x(){return n||(n=h()),n.getInitialState()}function y(t,n=!1){function r(e){let i=e[t];return void 0===i&&n&&(i=kg(g,r,x)),i}function i(t=f){let r=kg(p,n,()=>new WeakMap);return kg(r,t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=function(e,t,n,r){function i(a,...o){let s=t(a);return void 0===s&&r&&(s=n()),e(s,...o)}return i.unwrapped=e,i}(a,t,()=>kg(g,t,x),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let b={name:r,reducer:v,actions:c,caseReducers:s,getInitialState:x,...y(i),injectInto(e,{reducerPath:t,...n}={}){let r=t??i;return e.inject({reducerPath:r,reducer:v},n),{...b,...y(r,!0)}}};return b}}();function kE(){}var kC="listener",k_="completed",kS="cancelled",kT=`task-${kS}`,kA=`task-${k_}`,kO=`${kC}-${kS}`,kM=`${kC}-${k_}`,kP=class{constructor(e){this.code=e,this.message=`task ${kS} (reason: ${e})`}name="TaskAbortError";message},kD=(e,t)=>{if("function"!=typeof e)throw TypeError(k2(32))},kL=()=>{},kI=(e,t=kL)=>(e.catch(t),e),kR=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),kB=e=>{if(e.aborted)throw new kP(e.reason)};function kz(e,t){let n=kL;return new Promise((r,i)=>{let a=()=>i(new kP(e.reason));e.aborted?a():(n=kR(e,a),t.finally(()=>n()).then(r,i))}).finally(()=>{n=kL})}var kF=async(e,t)=>{try{await Promise.resolve();let t=await e();return{status:"ok",value:t}}catch(e){return{status:e instanceof kP?"cancelled":"rejected",error:e}}finally{t?.()}},kV=e=>t=>kI(kz(e,t).then(t=>(kB(e),t))),kU=e=>{let t=kV(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:kH}=Object,kW={},kY="listenerMiddleware",kG=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=kf(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(i);else throw Error(k2(21));return kD(a,"options.listener"),{predicate:i,type:t,effect:a}},k$=kH(e=>{let{type:t,predicate:n,effect:r}=kG(e);return{id:((e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t})(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(k2(22))}}},{withTypes:()=>k$}),kX=(e,t)=>{let{type:n,effect:r,predicate:i}=kG(t);return Array.from(e.values()).find(e=>("string"==typeof n?e.type===n:e.predicate===i)&&e.effect===r)},kq=e=>{e.pending.forEach(e=>{e.abort(kO)})},kK=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},kZ=kH(kf(`${kY}/add`),{withTypes:()=>kZ}),kQ=kf(`${kY}/removeAll`),kJ=kH(kf(`${kY}/remove`),{withTypes:()=>kJ}),k0=(...e)=>{console.error(`${kY}/error`,...e)},k1=(e={})=>{let t=new Map,n=new Map,{extra:r,onError:i=k0}=e;kD(i,"onError");let a=e=>{var n;return(n=kX(t,e)??k$(e)).unsubscribe=()=>t.delete(n.id),t.set(n.id,n),e=>{n.unsubscribe(),e?.cancelActive&&kq(n)}};kH(a,{withTypes:()=>a});let o=e=>{let n=kX(t,e);return n&&(n.unsubscribe(),e.cancelActive&&kq(n)),!!n};kH(o,{withTypes:()=>o});let s=async(e,o,s,l)=>{var c,u;let d,h=new AbortController,f=(c=h.signal,d=async(e,t)=>{kB(c);let n=()=>{},r=[new Promise((t,r)=>{let i=a({predicate:e,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});n=()=>{i(),r()}})];null!=t&&r.push(new Promise(e=>setTimeout(e,t,null)));try{let e=await kz(c,Promise.race(r));return kB(c),e}finally{n()}},(e,t)=>kI(d(e,t))),p=[];try{let i;e.pending.add(h),i=n.get(e)??0,n.set(e,i+1),await Promise.resolve(e.effect(o,kH({},s,{getOriginalState:l,condition:(e,t)=>f(e,t).then(Boolean),take:f,delay:kU(h.signal),pause:kV(h.signal),extra:r,signal:h.signal,fork:(u=h.signal,(e,t)=>{kD(e,"taskExecutor");let n=new AbortController;kR(u,()=>n.abort(u.reason));let r=kF(async()=>{kB(u),kB(n.signal);let t=await e({pause:kV(n.signal),delay:kU(n.signal),signal:n.signal});return kB(n.signal),t},()=>n.abort(kA));return t?.autoJoin&&p.push(r.catch(kL)),{result:kV(u)(r),cancel(){n.abort(kT)}}}),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==h&&(e.abort(kO),n.delete(e))})},cancel:()=>{h.abort(kO),e.pending.delete(h)},throwIfCancelled:()=>{kB(h.signal)}})))}catch(e){e instanceof kP||kK(i,e,{raisedBy:"effect"})}finally{let t;await Promise.all(p),h.abort(kM),1===(t=n.get(e)??1)?n.delete(e):n.set(e,t-1),e.pending.delete(h)}},l=()=>{for(let e of n.keys())kq(e);t.clear()};return{middleware:e=>n=>r=>{let c;if(!kc(r))return n(r);if(kZ.match(r))return a(r.payload);if(kQ.match(r))return void l();if(kJ.match(r))return o(r.payload);let u=e.getState(),d=()=>{if(u===kW)throw Error(k2(23));return u};try{if(c=n(r),t.size>0){let n=e.getState();for(let a of Array.from(t.values())){let t=!1;try{t=a.predicate(r,n,u)}catch(e){t=!1,kK(i,e,{raisedBy:"predicate"})}t&&s(a,r,e,d)}}}finally{u=kW}return c},startListening:a,stopListening:o,clearListeners:l}};function k2(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}Symbol.for("rtk-state-proxy-original");var k5=e.i(92068);function k3(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function k4(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.reduce((e,t,r)=>{var i=n[r-1];return"string"==typeof i?e+i+t:void 0!==i?e+k3(i)+t:e+t},"")}var k6=e=>0===e?0:e>0?1:-1,k8=e=>"number"==typeof e&&e!=+e,k7=e=>"string"==typeof e&&e.indexOf("%")===e.length-1,k9=e=>("number"==typeof e||e instanceof Number)&&!k8(e),Ee=e=>k9(e)||"string"==typeof e,Et=0,En=e=>{var t=++Et;return"".concat(e||"").concat(t)},Er=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!k9(e)&&"string"!=typeof e)return r;if(k7(e)){if(null==t)return r;var a=e.indexOf("%");n=t*parseFloat(e.slice(0,a))/100}else n=+e;return k8(n)&&(n=r),i&&null!=t&&n>t&&(n=t),n},Ei=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(n[String(e[r])])return!0;else n[String(e[r])]=!0;return!1};function Ea(e,t,n){return k9(e)&&k9(t)?k3(e+n*(t-e)):t}function Eo(e,t,n){if(e&&e.length)return e.find(e=>e&&("function"==typeof t?t(e):(0,k5.default)(e,t))===n)}var Es=e=>null==e?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function El(e){return null!=e}function Ec(){}function Eu(e,t){if(t){var n=Number.parseInt(t,10);if(!k8(n))return null==e?void 0:e[n]}}var Ed=kk({name:"options",initialState:{chartName:"",tooltipPayloadSearcher:void 0,eventEmitter:void 0,defaultTooltipEventType:"axis"},reducers:{createEventEmitter:e=>{null==e.eventEmitter&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),Eh=Ed.reducer,{createEventEmitter:Ef}=Ed.actions,Ep=(e.i(13027),{notify(){},get:()=>[]}),Em="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Eg="u">typeof navigator&&"ReactNative"===navigator.product,Ev=Em||Eg?em.useLayoutEffect:em.useEffect;function Ex(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}var Ey=Symbol.for("react-redux-context"),Eb="u">typeof globalThis?globalThis:{},Ew=function(){if(!em.createContext)return{};let e=Eb[Ey]??=new Map,t=e.get(em.createContext);return t||(t=em.createContext(null),e.set(em.createContext,t)),t}(),Ej=function(e){let{children:t,context:n,serverState:r,store:i}=e,a=em.useMemo(()=>{let e=function(e){let t,n=Ep,r=0,i=!1;function a(){l.onStateChange&&l.onStateChange()}function o(){if(r++,!t){let r,i;t=e.subscribe(a),r=null,i=null,n={clear(){r=null,i=null},notify(){let e=r;for(;e;)e.callback(),e=e.next},get(){let e=[],t=r;for(;t;)e.push(t),t=t.next;return e},subscribe(e){let t=!0,n=i={callback:e,next:null,prev:i};return n.prev?n.prev.next=n:r=n,function(){t&&null!==r&&(t=!1,n.next?n.next.prev=n.prev:i=n.prev,n.prev?n.prev.next=n.next:r=n.next)}}}}}function s(){r--,t&&0===r&&(t(),t=void 0,n.clear(),n=Ep)}let l={addNestedSub:function(e){o();let t=n.subscribe(e),r=!1;return()=>{r||(r=!0,t(),s())}},notifyNestedSubs:function(){n.notify()},handleChangeWrapper:a,isSubscribed:function(){return i},trySubscribe:function(){i||(i=!0,o())},tryUnsubscribe:function(){i&&(i=!1,s())},getListeners:()=>n};return l}(i);return{store:i,subscription:e,getServerState:r?()=>r:void 0}},[i,r]),o=em.useMemo(()=>i.getState(),[i]);return Ev(()=>{let{subscription:e}=a;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),o!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[a,o]),em.createElement((n||Ew).Provider,{value:a},t)};function EN(e=Ew){return function(){return em.useContext(e)}}var Ek=EN(),EE=Symbol.for("immer-nothing"),EC=Symbol.for("immer-draftable"),E_=Symbol.for("immer-state");function ES(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ET=Object.getPrototypeOf;function EA(e){return!!e&&!!e[E_]}function EO(e){return!!e&&(ED(e)||Array.isArray(e)||!!e[EC]||!!e.constructor?.[EC]||Ez(e)||EF(e))}var EM=Object.prototype.constructor.toString(),EP=new WeakMap;function ED(e){if(!e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);if(null===t||t===Object.prototype)return!0;let n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if("function"!=typeof n)return!1;let r=EP.get(n);return void 0===r&&(r=Function.toString.call(n),EP.set(n,r)),r===EM}function EL(e,t,n=!0){0===EI(e)?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function EI(e){let t=e[E_];return t?t.type_:Array.isArray(e)?1:Ez(e)?2:3*!!EF(e)}function ER(e,t){return 2===EI(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function EB(e,t,n){let r=EI(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function Ez(e){return e instanceof Map}function EF(e){return e instanceof Set}function EV(e){return e.copy_||e.base_}function EU(e,t){if(Ez(e))return new Map(e);if(EF(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let n=ED(e);if(!0!==t&&("class_only"!==t||n)){let t=ET(e);return null!==t&&n?{...e}:Object.assign(Object.create(t),e)}{let t=Object.getOwnPropertyDescriptors(e);delete t[E_];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(ET(e),t)}}function EH(e,t=!1){return EY(e)||EA(e)||!EO(e)||(EI(e)>1&&Object.defineProperties(e,{set:EW,add:EW,clear:EW,delete:EW}),Object.freeze(e),t&&Object.values(e).forEach(e=>EH(e,!0))),e}var EW={value:function(){ES(2)}};function EY(e){return null===e||"object"!=typeof e||Object.isFrozen(e)}var EG={};function E$(e){let t=EG[e];return t||ES(0,e),t}function EX(e,t){t&&(E$("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Eq(e){EK(e),e.drafts_.forEach(EQ),e.drafts_=null}function EK(e){e===R&&(R=e.parent_)}function EZ(e){return R={drafts_:[],parent_:R,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function EQ(e){let t=e[E_];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function EJ(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];return void 0!==e&&e!==n?(n[E_].modified_&&(Eq(t),ES(4)),EO(e)&&(e=E0(t,e),t.parent_||E2(t,e)),t.patches_&&E$("Patches").generateReplacementPatches_(n[E_].base_,e,t.patches_,t.inversePatches_)):e=E0(t,n,[]),Eq(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==EE?e:void 0}function E0(e,t,n){if(EY(t))return t;let r=e.immer_.shouldUseStrictIteration(),i=t[E_];if(!i)return EL(t,(r,a)=>E1(e,i,t,r,a,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return E2(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;let t=i.copy_,a=t,o=!1;3===i.type_&&(a=new Set(t),t.clear(),o=!0),EL(a,(r,a)=>E1(e,i,t,r,a,n,o),r),E2(e,t,!1),n&&e.patches_&&E$("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function E1(e,t,n,r,i,a,o){if(null==i||"object"!=typeof i&&!o)return;let s=EY(i);if(!s||o){if(EA(i)){let o=E0(e,i,a&&t&&3!==t.type_&&!ER(t.assigned_,r)?a.concat(r):void 0);if(EB(n,r,o),!EA(o))return;e.canAutoFreeze_=!1}else o&&n.add(i);if(EO(i)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&s)return;E0(e,i),(!t||!t.scope_.parent_)&&"symbol"!=typeof r&&(Ez(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&E2(e,i)}}}function E2(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&EH(t,n)}var E5={get(e,t){if(t===E_)return e;let n=EV(e);if(!ER(n,t)){var r;let i;return r=e,(i=E6(n,t))?"value"in i?i.value:i.get?.call(r.draft_):void 0}let i=n[t];return e.finalized_||!EO(i)?i:i===E4(e.base_,t)?(E7(e),e.copy_[t]=Ce(i,e)):i},has:(e,t)=>t in EV(e),ownKeys:e=>Reflect.ownKeys(EV(e)),set(e,t,n){let r=E6(EV(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=E4(EV(e),t),i=r?.[E_];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if((n===r?0!==n||1/n==1/r:n!=n&&r!=r)&&(void 0!==n||ER(e.base_,t)))return!0;E7(e),E8(e)}return!!(e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t]))||(e.copy_[t]=n,e.assigned_[t]=!0,!0)},deleteProperty:(e,t)=>(void 0!==E4(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,E7(e),E8(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){let n=EV(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){ES(11)},getPrototypeOf:e=>ET(e.base_),setPrototypeOf(){ES(12)}},E3={};function E4(e,t){let n=e[E_];return(n?EV(n):e)[t]}function E6(e,t){if(!(t in e))return;let n=ET(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=ET(n)}}function E8(e){!e.modified_&&(e.modified_=!0,e.parent_&&E8(e.parent_))}function E7(e){e.copy_||(e.copy_=EU(e.base_,e.scope_.immer_.useStrictShallowCopy_))}EL(E5,(e,t)=>{E3[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),E3.deleteProperty=function(e,t){return E3.set.call(this,e,t,void 0)},E3.set=function(e,t,n){return E5.set.call(this,e[0],t,n,e[0])};var E9=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,t,n)=>{let r;if("function"==typeof e&&"function"!=typeof t){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}if("function"!=typeof t&&ES(6),void 0!==n&&"function"!=typeof n&&ES(7),EO(e)){let i=EZ(this),a=Ce(e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Eq(i):EK(i)}return EX(i,n),EJ(r,i)}if(e&&"object"==typeof e)ES(1,e);else{if(void 0===(r=t(e))&&(r=e),r===EE&&(r=void 0),this.autoFreeze_&&EH(r,!0),n){let t=[],i=[];E$("Patches").generateReplacementPatches_(e,r,t,i),n(t,i)}return r}},this.produceWithPatches=(e,t)=>{let n,r;return"function"==typeof e?(t,...n)=>this.produceWithPatches(t,t=>e(t,...n)):[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),"boolean"==typeof e?.useStrictIteration&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){var t;EO(e)||ES(8),EA(e)&&(EA(t=e)||ES(10,t),e=function e(t){let n;if(!EO(t)||EY(t))return t;let r=t[E_],i=!0;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=EU(t,r.scope_.immer_.useStrictShallowCopy_),i=r.scope_.immer_.shouldUseStrictIteration()}else n=EU(t,!0);return EL(n,(t,r)=>{EB(n,t,e(r))},i),r&&(r.finalized_=!1),n}(t));let n=EZ(this),r=Ce(e,void 0);return r[E_].isManual_=!0,EK(n),r}finishDraft(e,t){let n=e&&e[E_];n&&n.isManual_||ES(9);let{scope_:r}=n;return EX(r,t),EJ(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=E$("Patches").applyPatches_;return EA(e)?r(e,t):this.produce(e,e=>r(e,t))}};function Ce(e,t){let n=Ez(e)?E$("MapSet").proxyMap_(e,t):EF(e)?E$("MapSet").proxySet_(e,t):function(e,t){let n=Array.isArray(e),r={type_:+!!n,scope_:t?t.scope_:R,modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=r,a=E5;n&&(i=[r],a=E3);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,s}(e,t);return(t?t.scope_:R).drafts_.push(n),n}new E9().produce;var Ct={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},Cn=kk({name:"tooltip",initialState:{itemInteraction:{click:Ct,hover:Ct},axisInteraction:{click:Ct,hover:Ct},keyboardInteraction:Ct,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:kx()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NY(e).tooltipItemPayloads.indexOf(n);i>-1&&(e.tooltipItemPayloads[i]=r)},prepare:kx()},removeTooltipEntrySettings:{reducer(e,t){var n=NY(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:kx()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:Cr,replaceTooltipEntrySettings:Ci,removeTooltipEntrySettings:Ca,setTooltipSettingsState:Co,setActiveMouseOverItemIndex:Cs,mouseLeaveItem:Cl,mouseLeaveChart:Cc,setActiveClickItemIndex:Cu,setMouseOverAxisIndex:Cd,setMouseClickAxisIndex:Ch,setSyncInteraction:Cf,setKeyboardInteraction:Cp}=Cn.actions,Cm=Cn.reducer,Cg=kk({name:"chartData",initialState:{chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},reducers:{setChartData(e,t){if(e.chartData=t.payload,null==t.payload){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;null!=n&&(e.dataStartIndex=n),null!=r&&(e.dataEndIndex=r)}}}),{setChartData:Cv,setDataStartEndIndexes:Cx,setComputedData:Cy}=Cg.actions,Cb=Cg.reducer,Cw=kk({name:"chartLayout",initialState:{layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,i,a;e.margin.top=null!=(n=t.payload.top)?n:0,e.margin.right=null!=(r=t.payload.right)?r:0,e.margin.bottom=null!=(i=t.payload.bottom)?i:0,e.margin.left=null!=(a=t.payload.left)?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:Cj,setLayout:CN,setChartSize:Ck,setScale:CE}=Cw.actions,CC=Cw.reducer,C_=e.i(30224),CS=(0,em.createContext)(null),CT=e=>e,CA=()=>{var e=(0,em.useContext)(CS);return e?e.store.dispatch:CT},CO=()=>{},CM=()=>CO,CP=(e,t)=>e===t;function CD(e){var t=(0,em.useContext)(CS);return(0,C_.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:CM,t?t.store.getState:CO,t?t.store.getState:CO,t?e:CO,CP)}var CL=e.i(42342),CI=e=>e.legend.settings;function CR(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function CB(e){return function(){return e}}function Cz(e,t){if((i=e.length)>1)for(var n,r,i,a=1,o=e[t[0]],s=o.length;a<i;++a)for(r=o,o=e[t[a]],n=0;n<s;++n)o[n][1]+=o[n][0]=isNaN(r[n][1])?r[n][0]:r[n][1]}function CF(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function CV(e,t){return e[t]}function CU(e){let t=[];return t.key=e,t}function CH(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function CW(e){return Number.isFinite(e)}function CY(e){return"number"==typeof e&&e>0&&Number.isFinite(e)}function CG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function C$(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?CG(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CG(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function CX(e,t,n){return null==e||null==t?n:Ee(t)?(0,k5.default)(e,t,n):"function"==typeof t?t(e):n}ke([e=>e.legend.payload,CI],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?(0,CL.default)(r,n):r}),Array.prototype.slice;var Cq=(e,t)=>"horizontal"===e&&"xAxis"===t||"vertical"===e&&"yAxis"===t||"centric"===e&&"angleAxis"===t||"radial"===e&&"radiusAxis"===t,CK=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},CZ=(e,t,n)=>{if(!e)return null;var{duplicateDomain:r,type:i,range:a,scale:o,realScaleType:s,isCategorical:l,categoricalDomain:c,tickCount:u,ticks:d,niceTicks:h,axisType:f}=e;if(!o)return null;var p="scaleBand"===s&&o.bandwidth?o.bandwidth()/2:2,g=(t||n)&&"category"===i&&o.bandwidth?o.bandwidth()/p:0;return(g="angleAxis"===f&&a&&a.length>=2?2*k6(a[0]-a[1])*g:g,t&&(d||h))?(d||h||[]).map((e,t)=>({coordinate:o(r?r.indexOf(e):e)+g,value:e,offset:g,index:t})).filter(e=>!k8(e.coordinate)):l&&c?c.map((e,t)=>({coordinate:o(e)+g,value:e,index:t,offset:g})):o.ticks&&!n&&null!=u?o.ticks(u).map((e,t)=>({coordinate:o(e)+g,value:e,offset:g,index:t})):o.domain().map((e,t)=>({coordinate:o(e)+g,value:r?r[e]:e,index:t,offset:g}))},CQ={sign:e=>{var t,n=e.length;if(!(n<=0)){var r=null==(t=e[0])?void 0:t.length;if(null!=r&&!(r<=0))for(var i=0;i<r;++i)for(var a=0,o=0,s=0;s<n;++s){var l=e[s],c=null==l?void 0:l[i];if(null!=c){var u=c[1],d=c[0],h=k8(u)?d:u;h>=0?(c[0]=a,c[1]=a+h,a=u):(c[0]=o,c[1]=o+h,o=u)}}}},expand:function(e,t){if((r=e.length)>0){for(var n,r,i,a=0,o=e[0].length;a<o;++a){for(i=n=0;n<r;++n)i+=e[n][a][1]||0;if(i)for(n=0;n<r;++n)e[n][a][1]/=i}Cz(e,t)}},none:Cz,silhouette:function(e,t){if((n=e.length)>0){for(var n,r=0,i=e[t[0]],a=i.length;r<a;++r){for(var o=0,s=0;o<n;++o)s+=e[o][r][1]||0;i[r][1]+=i[r][0]=-s/2}Cz(e,t)}},wiggle:function(e,t){if((i=e.length)>0&&(r=(n=e[t[0]]).length)>0){for(var n,r,i,a=0,o=1;o<r;++o){for(var s=0,l=0,c=0;s<i;++s){for(var u=e[t[s]],d=u[o][1]||0,h=(d-(u[o-1][1]||0))/2,f=0;f<s;++f){var p=e[t[f]];h+=(p[o][1]||0)-(p[o-1][1]||0)}l+=d,c+=h*d}n[o-1][1]+=n[o-1][0]=a,l&&(a-=c/l)}n[o-1][1]+=n[o-1][0]=a,Cz(e,t)}},positive:e=>{var t,n=e.length;if(!(n<=0)){var r=null==(t=e[0])?void 0:t.length;if(null!=r&&!(r<=0))for(var i=0;i<r;++i)for(var a=0,o=0;o<n;++o){var s=e[o],l=null==s?void 0:s[i];if(null!=l){var c=k8(l[1])?l[0]:l[1];c>=0?(l[0]=a,l[1]=a+c,a=l[1]):(l[0]=0,l[1]=0)}}}}};function CJ(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:a,dataKey:o}=e;if("category"===t.type){if(!t.allowDuplicatedCategory&&t.dataKey&&null!=i[t.dataKey]){var s=Eo(n,"value",i[t.dataKey]);if(s)return s.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var l=CX(i,null==o?t.dataKey:o);return null==l?null:t.scale(l)}var C0=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,C1=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,C2=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=(0,CL.default)(t,e=>e.coordinate),a=1/0,o=1,s=i.length;o<s;o++){var l=i[o],c=i[o-1];a=Math.min(((null==l?void 0:l.coordinate)||0)-((null==c?void 0:c.coordinate)||0),a)}return a===1/0?0:a}return n?void 0:0};function C5(e){var{tooltipEntrySettings:t,dataKey:n,payload:r,value:i,name:a}=e;return C$(C$({},t),{},{dataKey:n,payload:r,value:i,name:a})}function C3(e,t){return e?String(e):"string"==typeof t?t:void 0}var C4=e=>e.layout.width,C6=e=>e.layout.height,C8=e=>e.layout.scale,C7=e=>e.layout.margin,C9=ke(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),_e=ke(e=>e.cartesianAxis.yAxis,e=>Object.values(e));function _t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_t(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_t(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var _r=ke([C4,C6,C7,e=>e.brush.height,function(e){return _e(e).reduce((e,t)=>"left"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return _e(e).reduce((e,t)=>"right"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return C9(e).reduce((e,t)=>"top"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},function(e){return C9(e).reduce((e,t)=>"bottom"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},CI,e=>e.legend.size],(e,t,n,r,i,a,o,s,l,c)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=_n(_n({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),h=d.bottom;d.bottom+=r;var f=e-(d=((e,t,n)=>{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:s}=t;if(("vertical"===s||"horizontal"===s&&"middle"===o)&&"center"!==a&&k9(e[a]))return C$(C$({},e),{},{[a]:e[a]+(r||0)});if(("horizontal"===s||"vertical"===s&&"center"===a)&&"middle"!==o&&k9(e[o]))return C$(C$({},e),{},{[o]:e[o]+(i||0)})}return e})(d,l,c)).left-d.right,p=t-d.top-d.bottom;return _n(_n({brushBottom:h},d),{},{width:Math.max(f,0),height:Math.max(p,0)})}),_i=ke(_r,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),_a=ke(C4,C6,(e,t)=>({x:0,y:0,width:e,height:t})),_o=(0,em.createContext)(null),_s=()=>null!=(0,em.useContext)(_o),_l=e=>e.brush,_c=ke([_l,_r,C7],(e,t,n)=>({height:e.height,x:k9(e.x)?e.x:t.left,y:k9(e.y)?e.y:t.top+t.height+t.brushBottom-((null==n?void 0:n.bottom)||0),width:k9(e.width)?e.width:t.width})),_u=e.i(7670),_d=e.i(58723),_h=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];if("u">typeof console&&console.warn&&(void 0===t&&console.warn("LogUtils requires an error message argument"),!e))if(void 0===t)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;console.warn(t.replace(/%s/g,()=>r[a++]))}},_f=(e,t,n)=>{var{width:r="100%",height:i="100%",aspect:a,maxHeight:o}=n,s=k7(r)?e:Number(r),l=k7(i)?t:Number(i);return a&&a>0&&(s?l=s/a:l&&(s=l*a),o&&null!=l&&l>o&&(l=o)),{calculatedWidth:s,calculatedHeight:l}},_p={width:0,height:0,overflow:"visible"},_m={width:0,overflowX:"visible"},_g={height:0,overflowY:"visible"},_v={};function _x(){return(_x=Object.assign.bind()).apply(null,arguments)}function _y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_y(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_y(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var _w=(0,em.createContext)({width:-1,height:-1});function _j(e){var{children:t,width:n,height:r}=e,i=(0,em.useMemo)(()=>({width:n,height:r}),[n,r]);return CY(i.width)&&CY(i.height)?em.createElement(_w.Provider,{value:i},t):null}var _N=()=>(0,em.useContext)(_w),_k=(0,em.forwardRef)((e,t)=>{var{aspect:n,initialDimension:r={width:-1,height:-1},width:i,height:a,minWidth:o=0,minHeight:s,maxHeight:l,children:c,debounce:u=0,id:d,className:h,onResize:f,style:p={}}=e,g=(0,em.useRef)(null),v=(0,em.useRef)();v.current=f,(0,em.useImperativeHandle)(t,()=>g.current);var[x,y]=(0,em.useState)({containerWidth:r.width,containerHeight:r.height}),b=(0,em.useCallback)((e,t)=>{y(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,em.useEffect)(()=>{if(null==g.current||"u"<typeof ResizeObserver)return Ec;var e=e=>{var t,{width:n,height:r}=e[0].contentRect;b(n,r),null==(t=v.current)||t.call(v,n,r)};u>0&&(e=(0,_d.default)(e,u,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),{width:n,height:r}=g.current.getBoundingClientRect();return b(n,r),t.observe(g.current),()=>{t.disconnect()}},[b,u]);var{containerWidth:w,containerHeight:j}=x;_h(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:N,calculatedHeight:k}=_f(w,j,{width:i,height:a,aspect:n,maxHeight:l});return _h(null!=N&&N>0||null!=k&&k>0,"The width(%s) and height(%s) of chart should be greater than 0,\n please check the style of container, or the props width(%s) and height(%s),\n or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the\n height and width.",N,k,i,a,o,s,n),em.createElement("div",{id:d?"".concat(d):void 0,className:(0,_u.clsx)("recharts-responsive-container",h),style:_b(_b({},p),{},{width:i,height:a,minWidth:o,minHeight:s,maxHeight:l}),ref:g},em.createElement("div",{style:(e=>{var{width:t,height:n}=e,r=k7(t),i=k7(n);return r&&i?_p:r?_m:i?_g:_v})({width:i,height:a})},em.createElement(_j,{width:N,height:k},c)))}),_E=(0,em.forwardRef)((e,t)=>{var n=_N();if(CY(n.width)&&CY(n.height))return e.children;var{width:r,height:i}=function(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return void 0===i&&void 0===a?(i="100%",a="100%"):void 0===i?i=r&&r>0?void 0:"100%":void 0===a&&(a=r&&r>0?void 0:"100%"),{width:i,height:a}}({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=_f(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return k9(a)&&k9(o)?em.createElement(_j,{width:a,height:o},e.children):em.createElement(_k,_x({},e,{width:r,height:i,ref:t}))});function _C(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var __=()=>{var e,t=_s(),n=CD(_i),r=CD(_c),i=null==(e=CD(_l))?void 0:e.padding;return t&&r&&i?{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}:n},_S={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},_T=()=>{var e;return null!=(e=CD(_r))?e:_S},_A=e=>e.layout.layoutType,_O=e=>{var t=CA(),n=_s(),{width:r,height:i}=e,a=_N(),o=r,s=i;return a&&(o=a.width>0?a.width:r,s=a.height>0?a.height:i),(0,em.useEffect)(()=>{!n&&CY(o)&&CY(s)&&t(Ck({width:o,height:s}))},[t,n,o,s]),null},_M=e.i(66814);function _P(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function _D(e,t){switch(arguments.length){case 0:break;case 1:"function"==typeof e?this.interpolator(e):this.range(e);break;default:this.domain(e),"function"==typeof t?this.interpolator(t):this.range(t)}return this}e.s([],25212),e.i(25212),e.s([],67155),e.i(67155);class _L extends Map{constructor(e,t=_R){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(const[t,n]of e)this.set(t,n)}get(e){return super.get(_I(this,e))}has(e){return super.has(_I(this,e))}set(e,t){return super.set(function({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}(this,e),t)}delete(e){return super.delete(function({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}(this,e))}}function _I({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function _R(e){return null!==e&&"object"==typeof e?e.valueOf():e}let _B=Symbol("implicit");function _z(){var e=new _L,t=[],n=[],r=_B;function i(i){let a=e.get(i);if(void 0===a){if(r!==_B)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();for(let r of(t=[],e=new _L,n))e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return _z(t,n).unknown(r)},_P.apply(i,arguments),i}function _F(){var e,t,n=_z().unknown(void 0),r=n.domain,i=n.range,a=0,o=1,s=!1,l=0,c=0,u=.5;function d(){var n=r().length,d=o<a,h=d?o:a,f=d?a:o;e=(f-h)/Math.max(1,n-l+2*c),s&&(e=Math.floor(e)),h+=(f-h-e*(n-l))*u,t=e*(1-l),s&&(h=Math.round(h),t=Math.round(t));var p=(function(e,t,n){e*=1,t*=1,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((t-e)/n)),a=Array(i);++r<i;)a[r]=e+r*n;return a})(n).map(function(t){return h+e*t});return i(d?p.reverse():p)}return delete n.unknown,n.domain=function(e){return arguments.length?(r(e),d()):r()},n.range=function(e){return arguments.length?([a,o]=e,a*=1,o*=1,d()):[a,o]},n.rangeRound=function(e){return[a,o]=e,a*=1,o*=1,s=!0,d()},n.bandwidth=function(){return t},n.step=function(){return e},n.round=function(e){return arguments.length?(s=!!e,d()):s},n.padding=function(e){return arguments.length?(l=Math.min(1,c=+e),d()):l},n.paddingInner=function(e){return arguments.length?(l=Math.min(1,e),d()):l},n.paddingOuter=function(e){return arguments.length?(c=+e,d()):c},n.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),d()):u},n.copy=function(){return _F(r(),[a,o]).round(s).paddingInner(l).paddingOuter(c).align(u)},_P.apply(d(),arguments)}function _V(){return function e(t){var n=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return e(n())},t}(_F.apply(null,arguments).paddingInner(1))}let _U=Math.sqrt(50),_H=Math.sqrt(10),_W=Math.sqrt(2);function _Y(e,t,n){let r,i,a,o=(t-e)/Math.max(0,n),s=Math.floor(Math.log10(o)),l=o/Math.pow(10,s),c=l>=_U?10:l>=_H?5:l>=_W?2:1;return(s<0?(r=Math.round(e*(a=Math.pow(10,-s)/c)),i=Math.round(t*a),r/a<e&&++r,i/a>t&&--i,a=-a):(r=Math.round(e/(a=Math.pow(10,s)*c)),i=Math.round(t/a),r*a<e&&++r,i*a>t&&--i),i<r&&.5<=n&&n<2)?_Y(e,t,2*n):[r,i,a]}function _G(e,t,n){if(t*=1,e*=1,!((n*=1)>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?_Y(t,e,n):_Y(e,t,n);if(!(a>=i))return[];let s=a-i+1,l=Array(s);if(r)if(o<0)for(let e=0;e<s;++e)l[e]=-((a-e)/o);else for(let e=0;e<s;++e)l[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)l[e]=-((i+e)/o);else for(let e=0;e<s;++e)l[e]=(i+e)*o;return l}function _$(e,t,n){return _Y(e*=1,t*=1,n*=1)[2]}function _X(e,t,n){t*=1,e*=1,n*=1;let r=t<e,i=r?_$(t,e,n):_$(e,t,n);return(r?-1:1)*(i<0?-(1/i):i)}function _q(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function _K(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function _Z(e){let t,n,r;function i(e,r,a=0,o=e.length){if(a<o){if(0!==t(r,r))return o;do{let t=a+o>>>1;0>n(e[t],r)?a=t+1:o=t}while(a<o)}return a}return 2!==e.length?(t=_q,n=(t,n)=>_q(e(t),n),r=(t,n)=>e(t)-n):(t=e===_q||e===_K?e:_Q,n=e,r=e),{left:i,center:function(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o},right:function(e,r,i=0,a=e.length){if(i<a){if(0!==t(r,r))return a;do{let t=i+a>>>1;0>=n(e[t],r)?i=t+1:a=t}while(i<a)}return i}}}function _Q(){return 0}function _J(e){return null===e?NaN:+e}let _0=_Z(_q),_1=_0.right;function _2(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function _5(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function _3(){}_0.left,_Z(_J).center;var _4="\\s*([+-]?\\d+)\\s*",_6="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_8="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_7=/^#([0-9a-f]{3,8})$/,_9=RegExp(`^rgb\\(${_4},${_4},${_4}\\)$`),Se=RegExp(`^rgb\\(${_8},${_8},${_8}\\)$`),St=RegExp(`^rgba\\(${_4},${_4},${_4},${_6}\\)$`),Sn=RegExp(`^rgba\\(${_8},${_8},${_8},${_6}\\)$`),Sr=RegExp(`^hsl\\(${_6},${_8},${_8}\\)$`),Si=RegExp(`^hsla\\(${_6},${_8},${_8},${_6}\\)$`),Sa={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32};function So(){return this.rgb().formatHex()}function Ss(){return this.rgb().formatRgb()}function Sl(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=_7.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?Sc(t):3===n?new Sh(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?Su(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?Su(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=_9.exec(e))?new Sh(t[1],t[2],t[3],1):(t=Se.exec(e))?new Sh(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=St.exec(e))?Su(t[1],t[2],t[3],t[4]):(t=Sn.exec(e))?Su(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Sr.exec(e))?Sx(t[1],t[2]/100,t[3]/100,1):(t=Si.exec(e))?Sx(t[1],t[2]/100,t[3]/100,t[4]):Sa.hasOwnProperty(e)?Sc(Sa[e]):"transparent"===e?new Sh(NaN,NaN,NaN,0):null}function Sc(e){return new Sh(e>>16&255,e>>8&255,255&e,1)}function Su(e,t,n,r){return r<=0&&(e=t=n=NaN),new Sh(e,t,n,r)}function Sd(e,t,n,r){var i;return 1==arguments.length?((i=e)instanceof _3||(i=Sl(i)),i)?new Sh((i=i.rgb()).r,i.g,i.b,i.opacity):new Sh:new Sh(e,t,n,null==r?1:r)}function Sh(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Sf(){return`#${Sv(this.r)}${Sv(this.g)}${Sv(this.b)}`}function Sp(){let e=Sm(this.opacity);return`${1===e?"rgb(":"rgba("}${Sg(this.r)}, ${Sg(this.g)}, ${Sg(this.b)}${1===e?")":`, ${e})`}`}function Sm(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Sg(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Sv(e){return((e=Sg(e))<16?"0":"")+e.toString(16)}function Sx(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Sb(e,t,n,r)}function Sy(e){if(e instanceof Sb)return new Sb(e.h,e.s,e.l,e.opacity);if(e instanceof _3||(e=Sl(e)),!e)return new Sb;if(e instanceof Sb)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,l=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=l<.5?a+i:2-a-i,o*=60):s=l>0&&l<1?0:o,new Sb(o,s,l,e.opacity)}function Sb(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Sw(e){return(e=(e||0)%360)<0?e+360:e}function Sj(e){return Math.max(0,Math.min(1,e||0))}function SN(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}function Sk(e,t,n,r,i){var a=e*e,o=a*e;return((1-3*e+3*a-o)*t+(4-6*a+3*o)*n+(1+3*e+3*a-3*o)*r+o*i)/6}_2(_3,Sl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:So,formatHex:So,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Sy(this).formatHsl()},formatRgb:Ss,toString:Ss}),_2(Sh,Sd,_5(_3,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new Sh(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new Sh(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Sh(Sg(this.r),Sg(this.g),Sg(this.b),Sm(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Sf,formatHex:Sf,formatHex8:function(){return`#${Sv(this.r)}${Sv(this.g)}${Sv(this.b)}${Sv((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:Sp,toString:Sp})),_2(Sb,function(e,t,n,r){return 1==arguments.length?Sy(e):new Sb(e,t,n,null==r?1:r)},_5(_3,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new Sb(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new Sb(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Sh(SN(e>=240?e-240:e+120,i,r),SN(e,i,r),SN(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Sb(Sw(this.h),Sj(this.s),Sj(this.l),Sm(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Sm(this.opacity);return`${1===e?"hsl(":"hsla("}${Sw(this.h)}, ${100*Sj(this.s)}%, ${100*Sj(this.l)}%${1===e?")":`, ${e})`}`}}));let SE=e=>()=>e;function SC(e,t){var n=t-e;return n?function(t){return e+t*n}:SE(isNaN(e)?t:e)}let S_=function e(t){var n,r=1==(n=+t)?SC:function(e,t){var r,i,a;return t-e?(r=e,i=t,r=Math.pow(r,a=n),i=Math.pow(i,a)-r,a=1/a,function(e){return Math.pow(r+e*i,a)}):SE(isNaN(e)?t:e)};function i(e,t){var n=r((e=Sd(e)).r,(t=Sd(t)).r),i=r(e.g,t.g),a=r(e.b,t.b),o=SC(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return i.gamma=e,i}(1);function SS(e){return function(t){var n,r,i=t.length,a=Array(i),o=Array(i),s=Array(i);for(n=0;n<i;++n)r=Sd(t[n]),a[n]=r.r||0,o[n]=r.g||0,s[n]=r.b||0;return a=e(a),o=e(o),s=e(s),r.opacity=1,function(e){return r.r=a(e),r.g=o(e),r.b=s(e),r+""}}}function ST(e,t){return e*=1,t*=1,function(n){return e*(1-n)+t*n}}SS(function(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],a=e[r+1],o=r>0?e[r-1]:2*i-a,s=r<t-1?e[r+2]:2*a-i;return Sk((n-r/t)*t,o,i,a,s)}}),SS(function(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),i=e[(r+t-1)%t],a=e[r%t],o=e[(r+1)%t],s=e[(r+2)%t];return Sk((n-r/t)*t,i,a,o,s)}});var SA=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,SO=RegExp(SA.source,"g");function SM(e,t){var n,r,i=typeof t;return null==t||"boolean"===i?SE(t):("number"===i?ST:"string"===i?(r=Sl(t))?(t=r,S_):function(e,t){var n,r,i,a,o,s=SA.lastIndex=SO.lastIndex=0,l=-1,c=[],u=[];for(e+="",t+="";(i=SA.exec(e))&&(a=SO.exec(t));)(o=a.index)>s&&(o=t.slice(s,o),c[l]?c[l]+=o:c[++l]=o),(i=i[0])===(a=a[0])?c[l]?c[l]+=a:c[++l]=a:(c[++l]=null,u.push({i:l,x:ST(i,a)})),s=SO.lastIndex;return s<t.length&&(o=t.slice(s),c[l]?c[l]+=o:c[++l]=o),c.length<2?u[0]?(n=u[0].x,function(e){return n(e)+""}):(r=t,function(){return r}):(t=u.length,function(e){for(var n,r=0;r<t;++r)c[(n=u[r]).i]=n.x(e);return c.join("")})}:t instanceof Sl?S_:t instanceof Date?function(e,t){var n=new Date;return e*=1,t*=1,function(r){return n.setTime(e*(1-r)+t*r),n}}:!ArrayBuffer.isView(n=t)||n instanceof DataView?Array.isArray(t)?function(e,t){var n,r=t?t.length:0,i=e?Math.min(r,e.length):0,a=Array(i),o=Array(r);for(n=0;n<i;++n)a[n]=SM(e[n],t[n]);for(;n<r;++n)o[n]=t[n];return function(e){for(n=0;n<i;++n)o[n]=a[n](e);return o}}:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?function(e,t){var n,r={},i={};for(n in(null===e||"object"!=typeof e)&&(e={}),(null===t||"object"!=typeof t)&&(t={}),t)n in e?r[n]=SM(e[n],t[n]):i[n]=t[n];return function(e){for(n in r)i[n]=r[n](e);return i}}:ST:function(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(n=0;n<r;++n)i[n]=e[n]*(1-a)+t[n]*a;return i}})(e,t)}function SP(e,t){return e*=1,t*=1,function(n){return Math.round(e*(1-n)+t*n)}}function SD(e){return+e}var SL=[0,1];function SI(e){return e}function SR(e,t){var n;return(t-=e*=1)?function(n){return(n-e)/t}:(n=isNaN(t)?NaN:.5,function(){return n})}function SB(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=SR(i,r),a=n(o,a)):(r=SR(r,i),a=n(a,o)),function(e){return a(r(e))}}function Sz(e,t,n){var r=Math.min(e.length,t.length)-1,i=Array(r),a=Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=SR(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=_1(e,t,1,r)-1;return a[n](i[n](t))}}function SF(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function SV(){var e,t,n,r,i,a,o=SL,s=SL,l=SM,c=SI;function u(){var e,t,n,l=Math.min(o.length,s.length);return c!==SI&&(e=o[0],t=o[l-1],e>t&&(n=e,e=t,t=n),c=function(n){return Math.max(e,Math.min(t,n))}),r=l>2?Sz:SB,i=a=null,d}function d(t){return null==t||isNaN(t*=1)?n:(i||(i=r(o.map(e),s,l)))(e(c(t)))}return d.invert=function(n){return c(t((a||(a=r(s,o.map(e),ST)))(n)))},d.domain=function(e){return arguments.length?(o=Array.from(e,SD),u()):o.slice()},d.range=function(e){return arguments.length?(s=Array.from(e),u()):s.slice()},d.rangeRound=function(e){return s=Array.from(e),l=SP,u()},d.clamp=function(e){return arguments.length?(c=!!e||SI,u()):c!==SI},d.interpolate=function(e){return arguments.length?(l=e,u()):l},d.unknown=function(e){return arguments.length?(n=e,d):n},function(n,r){return e=n,t=r,u()}}function SU(){return SV()(SI,SI)}function SH(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function SW(e){return(e=SH(Math.abs(e)))?e[1]:NaN}var SY=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function SG(e){var t;if(!(t=SY.exec(e)))throw Error("invalid format: "+e);return new S$({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function S$(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function SX(e,t){var n=SH(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+Array(i-r.length+2).join("0")}SG.prototype=S$.prototype,S$.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};let Sq={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>SX(100*e,t),r:SX,s:function(e,t){var n=SH(e,t);if(!n)return e+"";var r=n[0],i=n[1],a=i-(B=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+Array(1-a).join("0")+SH(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function SK(e){return e}var SZ=Array.prototype.map,SQ=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function SJ(e,t,n,r){var i,a,o=_X(e,t,n);switch((r=SG(null==r?",f":r)).type){case"s":var s=Math.max(Math.abs(e),Math.abs(t));return null!=r.precision||isNaN(a=Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(SW(s)/3)))-SW(Math.abs(o))))||(r.precision=a),V(r,s);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(a=Math.max(0,SW(Math.abs(Math.max(Math.abs(e),Math.abs(t)))-(i=Math.abs(i=o)))-SW(i))+1)||(r.precision=a-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(a=Math.max(0,-SW(Math.abs(o))))||(r.precision=a-("%"===r.type)*2)}return F(r)}function S0(e){var t=e.domain;return e.ticks=function(e){var n=t();return _G(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var r=t();return SJ(r[0],r[r.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var r,i,a=t(),o=0,s=a.length-1,l=a[o],c=a[s],u=10;for(c<l&&(i=l,l=c,c=i,i=o,o=s,s=i);u-- >0;){if((i=_$(l,c,n))===r)return a[o]=l,a[s]=c,t(a);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else if(i<0)l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i;else break;r=i}return e},e}function S1(){var e=SU();return e.copy=function(){return SF(e,S1())},_P.apply(e,arguments),S0(e)}function S2(e){var t;function n(e){return null==e||isNaN(e*=1)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,SD),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return S2(e).unknown(t)},e=arguments.length?Array.from(e,SD):[0,1],S0(n)}function S5(e,t){e=e.slice();var n,r=0,i=e.length-1,a=e[r],o=e[i];return o<a&&(n=r,r=i,i=n,n=a,a=o,o=n),e[r]=t.floor(a),e[i]=t.ceil(o),e}function S3(e){return Math.log(e)}function S4(e){return Math.exp(e)}function S6(e){return-Math.log(-e)}function S8(e){return-Math.exp(-e)}function S7(e){return isFinite(e)?+("1e"+e):e<0?0:e}function S9(e){return(t,n)=>-e(-t,n)}function Te(e){let t,n,r=e(S3,S4),i=r.domain,a=10;function o(){var o,s;return t=(o=a)===Math.E?Math.log:10===o&&Math.log10||2===o&&Math.log2||(o=Math.log(o),e=>Math.log(e)/o),n=10===(s=a)?S7:s===Math.E?Math.exp:e=>Math.pow(s,e),i()[0]<0?(t=S9(t),n=S9(n),e(S6,S8)):e(S3,S4),r}return r.base=function(e){return arguments.length?(a=+e,o()):a},r.domain=function(e){return arguments.length?(i(e),o()):i()},r.ticks=e=>{let r,o,s=i(),l=s[0],c=s[s.length-1],u=c<l;u&&([l,c]=[c,l]);let d=t(l),h=t(c),f=null==e?10:+e,p=[];if(!(a%1)&&h-d<f){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(r=1;r<a;++r)if(!((o=d<0?r/n(-d):r*n(d))<l)){if(o>c)break;p.push(o)}}else for(;d<=h;++d)for(r=a-1;r>=1;--r)if(!((o=d>0?r/n(-d):r*n(d))<l)){if(o>c)break;p.push(o)}2*p.length<f&&(p=_G(l,c,f))}else p=_G(d,h,Math.min(h-d,f)).map(n);return u?p.reverse():p},r.tickFormat=(e,i)=>{if(null==e&&(e=10),null==i&&(i=10===a?"s":","),"function"!=typeof i&&(a%1||null!=(i=SG(i)).precision||(i.trim=!0),i=F(i)),e===1/0)return i;let o=Math.max(1,a*e/r.ticks().length);return e=>{let r=e/n(Math.round(t(e)));return r*a<a-.5&&(r*=a),r<=o?i(e):""}},r.nice=()=>i(S5(i(),{floor:e=>n(Math.floor(t(e))),ceil:e=>n(Math.ceil(t(e)))})),r}function Tt(){let e=Te(SV()).domain([1,10]);return e.copy=()=>SF(e,Tt()).base(e.base()),_P.apply(e,arguments),e}function Tn(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Tr(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Ti(e){var t=1,n=e(Tn(1),Tr(t));return n.constant=function(n){return arguments.length?e(Tn(t=+n),Tr(t)):t},S0(n)}function Ta(){var e=Ti(SV());return e.copy=function(){return SF(e,Ta()).constant(e.constant())},_P.apply(e,arguments)}function To(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Ts(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Tl(e){return e<0?-e*e:e*e}function Tc(e){var t=e(SI,SI),n=1;return t.exponent=function(t){return arguments.length?1==(n=+t)?e(SI,SI):.5===n?e(Ts,Tl):e(To(n),To(1/n)):n},S0(t)}function Tu(){var e=Tc(SV());return e.copy=function(){return SF(e,Tu()).exponent(e.exponent())},_P.apply(e,arguments),e}function Td(){return Tu.apply(null,arguments).exponent(.5)}function Th(e){return Math.sign(e)*e*e}function Tf(){var e,t=SU(),n=[0,1],r=!1;function i(n){var i,a=Math.sign(i=t(n))*Math.sqrt(Math.abs(i));return isNaN(a)?e:r?Math.round(a):a}return i.invert=function(e){return t.invert(Th(e))},i.domain=function(e){return arguments.length?(t.domain(e),i):t.domain()},i.range=function(e){return arguments.length?(t.range((n=Array.from(e,SD)).map(Th)),i):n.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(r=!!e,i):r},i.clamp=function(e){return arguments.length?(t.clamp(e),i):t.clamp()},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return Tf(t.domain(),n).round(r).clamp(t.clamp()).unknown(e)},_P.apply(i,arguments),S0(i)}function Tp(e,t){let n;if(void 0===t)for(let t of e)null!=t&&(n<t||void 0===n&&t>=t)&&(n=t);else{let r=-1;for(let i of e)null!=(i=t(i,++r,e))&&(n<i||void 0===n&&i>=i)&&(n=i)}return n}function Tm(e,t){let n;if(void 0===t)for(let t of e)null!=t&&(n>t||void 0===n&&t>=t)&&(n=t);else{let r=-1;for(let i of e)null!=(i=t(i,++r,e))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function Tg(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(e<t?-1:+(e>t))}function Tv(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Tx(){var e,t=[],n=[],r=[];function i(){var e=0,i=Math.max(1,n.length);for(r=Array(i-1);++e<i;)r[e-1]=function(e,t,n=_J){if(!(!(r=e.length)||isNaN(t*=1))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(n(e[a+1],a+1,e)-o)*(i-a)}}(t,e/i);return a}function a(t){return null==t||isNaN(t*=1)?e:n[_1(r,t)]}return a.invertExtent=function(e){var i=n.indexOf(e);return i<0?[NaN,NaN]:[i>0?r[i-1]:t[0],i<r.length?r[i]:t[t.length-1]]},a.domain=function(e){if(!arguments.length)return t.slice();for(let n of(t=[],e))null==n||isNaN(n*=1)||t.push(n);return t.sort(_q),i()},a.range=function(e){return arguments.length?(n=Array.from(e),i()):n.slice()},a.unknown=function(t){return arguments.length?(e=t,a):e},a.quantiles=function(){return r.slice()},a.copy=function(){return Tx().domain(t).range(n).unknown(e)},_P.apply(a,arguments)}function Ty(){var e,t=0,n=1,r=1,i=[.5],a=[0,1];function o(t){return null!=t&&t<=t?a[_1(i,t,0,r)]:e}function s(){var e=-1;for(i=Array(r);++e<r;)i[e]=((e+1)*n-(e-r)*t)/(r+1);return o}return o.domain=function(e){return arguments.length?([t,n]=e,t*=1,n*=1,s()):[t,n]},o.range=function(e){return arguments.length?(r=(a=Array.from(e)).length-1,s()):a.slice()},o.invertExtent=function(e){var o=a.indexOf(e);return o<0?[NaN,NaN]:o<1?[t,i[0]]:o>=r?[i[r-1],n]:[i[o-1],i[o]]},o.unknown=function(t){return arguments.length&&(e=t),o},o.thresholds=function(){return i.slice()},o.copy=function(){return Ty().domain([t,n]).range(a).unknown(e)},_P.apply(S0(o),arguments)}function Tb(){var e,t=[.5],n=[0,1],r=1;function i(i){return null!=i&&i<=i?n[_1(t,i,0,r)]:e}return i.domain=function(e){return arguments.length?(r=Math.min((t=Array.from(e)).length,n.length-1),i):t.slice()},i.range=function(e){return arguments.length?(n=Array.from(e),r=Math.min(t.length,n.length-1),i):n.slice()},i.invertExtent=function(e){var r=n.indexOf(e);return[t[r-1],t[r]]},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return Tb().domain(t).range(n).unknown(e)},_P.apply(i,arguments)}F=(z=function(e){var t,n,r,i=void 0===e.grouping||void 0===e.thousands?SK:(t=SZ.call(e.grouping,Number),n=e.thousands+"",function(e,r){for(var i=e.length,a=[],o=0,s=t[0],l=0;i>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),a.push(e.substring(i-=s,i+s)),!((l+=s+1)>r));)s=t[o=(o+1)%t.length];return a.reverse().join(n)}),a=void 0===e.currency?"":e.currency[0]+"",o=void 0===e.currency?"":e.currency[1]+"",s=void 0===e.decimal?".":e.decimal+"",l=void 0===e.numerals?SK:(r=SZ.call(e.numerals,String),function(e){return e.replace(/[0-9]/g,function(e){return r[+e]})}),c=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"−":e.minus+"",d=void 0===e.nan?"NaN":e.nan+"";function h(e){var t=(e=SG(e)).fill,n=e.align,r=e.sign,h=e.symbol,f=e.zero,p=e.width,g=e.comma,v=e.precision,x=e.trim,y=e.type;"n"===y?(g=!0,y="g"):Sq[y]||(void 0===v&&(v=12),x=!0,y="g"),(f||"0"===t&&"="===n)&&(f=!0,t="0",n="=");var b="$"===h?a:"#"===h&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===h?o:/[%p]/.test(y)?c:"",j=Sq[y],N=/[defgprs%]/.test(y);function k(e){var a,o,c,h=b,k=w;if("c"===y)k=j(e)+k,e="";else{var E=(e*=1)<0||1/e<0;if(e=isNaN(e)?d:j(Math.abs(e),v),x&&(e=function(e){e:for(var t,n=e.length,r=1,i=-1;r<n;++r)switch(e[r]){case".":i=t=r;break;case"0":0===i&&(i=r),t=r;break;default:if(!+e[r])break e;i>0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),E&&0==+e&&"+"!==r&&(E=!1),h=(E?"("===r?r:u:"-"===r||"("===r?"":r)+h,k=("s"===y?SQ[8+B/3]:"")+k+(E&&"("===r?")":""),N){for(a=-1,o=e.length;++a<o;)if(48>(c=e.charCodeAt(a))||c>57){k=(46===c?s+e.slice(a+1):e.slice(a))+k,e=e.slice(0,a);break}}}g&&!f&&(e=i(e,1/0));var C=h.length+e.length+k.length,_=C<p?Array(p-C+1).join(t):"";switch(g&&f&&(e=i(_+e,_.length?p-k.length:1/0),_=""),n){case"<":e=h+e+k+_;break;case"=":e=h+_+e+k;break;case"^":e=_.slice(0,C=_.length>>1)+h+e+k+_.slice(C);break;default:e=_+h+e+k}return l(e)}return v=void 0===v?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),k.toString=function(){return e+""},k}return{format:h,formatPrefix:function(e,t){var n=h(((e=SG(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(SW(t)/3))),i=Math.pow(10,-r),a=SQ[8+r/3];return function(e){return n(i*e)+a}}}}({thousands:",",grouping:[3],currency:["$",""]})).format,V=z.formatPrefix;let Tw=new Date,Tj=new Date;function TN(e,t,n,r){function i(t){return e(t=0==arguments.length?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t<n-e?t:n},i.offset=(e,n)=>(t(e=new Date(+e),null==n?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o,s=[];if(n=i.ceil(n),a=null==a?1:Math.floor(a),!(n<r)||!(a>0))return s;do s.push(o=new Date(+n)),t(n,a),e(n);while(o<n&&n<r)return s},i.filter=n=>TN(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(Tw.setTime(+t),Tj.setTime(+r),e(Tw),e(Tj),Math.floor(n(Tw,Tj))),i.every=e=>isFinite(e=Math.floor(e))&&e>0?e>1?i.filter(r?t=>r(t)%e==0:t=>i.count(0,t)%e==0):i:null),i}let Tk=TN(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Tk.every=e=>isFinite(e=Math.floor(e))&&e>0?TN(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}):null,Tk.range;let TE=TN(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());TE.every=e=>isFinite(e=Math.floor(e))&&e>0?TN(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}):null,TE.range;let TC=TN(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());TC.range;let T_=TN(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());T_.range;function TS(e){return TN(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+7*t)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/6048e5)}let TT=TS(0),TA=TS(1),TO=TS(2),TM=TS(3),TP=TS(4),TD=TS(5),TL=TS(6);function TI(e){return TN(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)},(e,t)=>(t-e)/6048e5)}TT.range,TA.range,TO.range,TM.range,TP.range,TD.range,TL.range;let TR=TI(0),TB=TI(1),Tz=TI(2),TF=TI(3),TV=TI(4),TU=TI(5),TH=TI(6);TR.range,TB.range,Tz.range,TF.range,TV.range,TU.range,TH.range;let TW=TN(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1);TW.range;let TY=TN(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1);TY.range;let TG=TN(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5));TG.range;let T$=TN(e=>{e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds()-6e4*e.getMinutes())},(e,t)=>{e.setTime(+e+36e5*t)},(e,t)=>(t-e)/36e5,e=>e.getHours());T$.range;let TX=TN(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+36e5*t)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours());TX.range;let Tq=TN(e=>{e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds())},(e,t)=>{e.setTime(+e+6e4*t)},(e,t)=>(t-e)/6e4,e=>e.getMinutes());Tq.range;let TK=TN(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+6e4*t)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes());TK.range;let TZ=TN(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+1e3*t)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds());TZ.range;let TQ=TN(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);function TJ(e,t,n,r,i,a){let o=[[TZ,1,1e3],[TZ,5,5e3],[TZ,15,15e3],[TZ,30,3e4],[a,1,6e4],[a,5,3e5],[a,15,9e5],[a,30,18e5],[i,1,36e5],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,864e5],[r,2,1728e5],[n,1,6048e5],[t,1,2592e6],[t,3,7776e6],[e,1,31536e6]];function s(t,n,r){let i=Math.abs(n-t)/r,a=_Z(([,,e])=>e).right(o,i);if(a===o.length)return e.every(_X(t/31536e6,n/31536e6,r));if(0===a)return TQ.every(Math.max(_X(t,n,r),1));let[s,l]=o[i/o[a-1][2]<o[a][2]/i?a-1:a];return s.every(l)}return[function(e,t,n){let r=t<e;r&&([e,t]=[t,e]);let i=n&&"function"==typeof n.range?n:s(e,t,n),a=i?i.range(e,+t+1):[];return r?a.reverse():a},s]}TQ.every=e=>isFinite(e=Math.floor(e))&&e>0?e>1?TN(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):TQ:null,TQ.range;let[T0,T1]=TJ(TE,T_,TR,TG,TX,TK),[T2,T5]=TJ(Tk,TC,TT,TW,T$,Tq);function T3(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function T4(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function T6(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}var T8={"-":"",_:" ",0:"0"},T7=/^\s*\d+/,T9=/^%/,Ae=/[\\^$*+?|[\]().{}]/g;function At(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",a=i.length;return r+(a<n?Array(n-a+1).join(t)+i:i)}function An(e){return e.replace(Ae,"\\$&")}function Ar(e){return RegExp("^(?:"+e.map(An).join("|")+")","i")}function Ai(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function Aa(e,t,n){var r=T7.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Ao(e,t,n){var r=T7.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function As(e,t,n){var r=T7.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Al(e,t,n){var r=T7.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function Ac(e,t,n){var r=T7.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Au(e,t,n){var r=T7.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function Ad(e,t,n){var r=T7.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Ah(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Af(e,t,n){var r=T7.exec(t.slice(n,n+1));return r?(e.q=3*r[0]-3,n+r[0].length):-1}function Ap(e,t,n){var r=T7.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Am(e,t,n){var r=T7.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Ag(e,t,n){var r=T7.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Av(e,t,n){var r=T7.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Ax(e,t,n){var r=T7.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Ay(e,t,n){var r=T7.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Ab(e,t,n){var r=T7.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Aw(e,t,n){var r=T7.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Aj(e,t,n){var r=T9.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function AN(e,t,n){var r=T7.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Ak(e,t,n){var r=T7.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function AE(e,t){return At(e.getDate(),t,2)}function AC(e,t){return At(e.getHours(),t,2)}function A_(e,t){return At(e.getHours()%12||12,t,2)}function AS(e,t){return At(1+TW.count(Tk(e),e),t,3)}function AT(e,t){return At(e.getMilliseconds(),t,3)}function AA(e,t){return AT(e,t)+"000"}function AO(e,t){return At(e.getMonth()+1,t,2)}function AM(e,t){return At(e.getMinutes(),t,2)}function AP(e,t){return At(e.getSeconds(),t,2)}function AD(e){var t=e.getDay();return 0===t?7:t}function AL(e,t){return At(TT.count(Tk(e)-1,e),t,2)}function AI(e){var t=e.getDay();return t>=4||0===t?TP(e):TP.ceil(e)}function AR(e,t){return e=AI(e),At(TP.count(Tk(e),e)+(4===Tk(e).getDay()),t,2)}function AB(e){return e.getDay()}function Az(e,t){return At(TA.count(Tk(e)-1,e),t,2)}function AF(e,t){return At(e.getFullYear()%100,t,2)}function AV(e,t){return At((e=AI(e)).getFullYear()%100,t,2)}function AU(e,t){return At(e.getFullYear()%1e4,t,4)}function AH(e,t){var n=e.getDay();return At((e=n>=4||0===n?TP(e):TP.ceil(e)).getFullYear()%1e4,t,4)}function AW(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+At(t/60|0,"0",2)+At(t%60,"0",2)}function AY(e,t){return At(e.getUTCDate(),t,2)}function AG(e,t){return At(e.getUTCHours(),t,2)}function A$(e,t){return At(e.getUTCHours()%12||12,t,2)}function AX(e,t){return At(1+TY.count(TE(e),e),t,3)}function Aq(e,t){return At(e.getUTCMilliseconds(),t,3)}function AK(e,t){return Aq(e,t)+"000"}function AZ(e,t){return At(e.getUTCMonth()+1,t,2)}function AQ(e,t){return At(e.getUTCMinutes(),t,2)}function AJ(e,t){return At(e.getUTCSeconds(),t,2)}function A0(e){var t=e.getUTCDay();return 0===t?7:t}function A1(e,t){return At(TR.count(TE(e)-1,e),t,2)}function A2(e){var t=e.getUTCDay();return t>=4||0===t?TV(e):TV.ceil(e)}function A5(e,t){return e=A2(e),At(TV.count(TE(e),e)+(4===TE(e).getUTCDay()),t,2)}function A3(e){return e.getUTCDay()}function A4(e,t){return At(TB.count(TE(e)-1,e),t,2)}function A6(e,t){return At(e.getUTCFullYear()%100,t,2)}function A8(e,t){return At((e=A2(e)).getUTCFullYear()%100,t,2)}function A7(e,t){return At(e.getUTCFullYear()%1e4,t,4)}function A9(e,t){var n=e.getUTCDay();return At((e=n>=4||0===n?TV(e):TV.ceil(e)).getUTCFullYear()%1e4,t,4)}function Oe(){return"+0000"}function Ot(){return"%"}function On(e){return+e}function Or(e){return Math.floor(e/1e3)}function Oi(e){return new Date(e)}function Oa(e){return e instanceof Date?+e:+new Date(+e)}function Oo(e,t,n,r,i,a,o,s,l,c){var u=SU(),d=u.invert,h=u.domain,f=c(".%L"),p=c(":%S"),g=c("%I:%M"),v=c("%I %p"),x=c("%a %d"),y=c("%b %d"),b=c("%B"),w=c("%Y");function j(e){return(l(e)<e?f:s(e)<e?p:o(e)<e?g:a(e)<e?v:r(e)<e?i(e)<e?x:y:n(e)<e?b:w)(e)}return u.invert=function(e){return new Date(d(e))},u.domain=function(e){return arguments.length?h(Array.from(e,Oa)):h().map(Oi)},u.ticks=function(t){var n=h();return e(n[0],n[n.length-1],null==t?10:t)},u.tickFormat=function(e,t){return null==t?j:c(t)},u.nice=function(e){var n=h();return e&&"function"==typeof e.range||(e=t(n[0],n[n.length-1],null==e?10:e)),e?h(S5(n,e)):u},u.copy=function(){return SF(u,Oo(e,t,n,r,i,a,o,s,l,c))},u}function Os(){return _P.apply(Oo(T2,T5,Tk,TC,TT,TW,T$,Tq,TZ,H).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Ol(){return _P.apply(Oo(T0,T1,TE,T_,TR,TY,TX,TK,TZ,W).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Oc(){var e,t,n,r,i,a=0,o=1,s=SI,l=!1;function c(t){return null==t||isNaN(t*=1)?i:s(0===n?.5:(t=(r(t)-e)*n,l?Math.max(0,Math.min(1,t)):t))}function u(e){return function(t){var n,r;return arguments.length?([n,r]=t,s=e(n,r),c):[s(0),s(1)]}}return c.domain=function(i){return arguments.length?([a,o]=i,e=r(a*=1),t=r(o*=1),n=e===t?0:1/(t-e),c):[a,o]},c.clamp=function(e){return arguments.length?(l=!!e,c):l},c.interpolator=function(e){return arguments.length?(s=e,c):s},c.range=u(SM),c.rangeRound=u(SP),c.unknown=function(e){return arguments.length?(i=e,c):i},function(i){return r=i,e=i(a),t=i(o),n=e===t?0:1/(t-e),c}}function Ou(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Od(){var e=S0(Oc()(SI));return e.copy=function(){return Ou(e,Od())},_D.apply(e,arguments)}function Oh(){var e=Te(Oc()).domain([1,10]);return e.copy=function(){return Ou(e,Oh()).base(e.base())},_D.apply(e,arguments)}function Of(){var e=Ti(Oc());return e.copy=function(){return Ou(e,Of()).constant(e.constant())},_D.apply(e,arguments)}function Op(){var e=Tc(Oc());return e.copy=function(){return Ou(e,Op()).exponent(e.exponent())},_D.apply(e,arguments)}function Om(){return Op.apply(null,arguments).exponent(.5)}function Og(){var e=[],t=SI;function n(n){if(null!=n&&!isNaN(n*=1))return t((_1(e,n,1)-1)/(e.length-1))}return n.domain=function(t){if(!arguments.length)return e.slice();for(let n of(e=[],t))null==n||isNaN(n*=1)||e.push(n);return e.sort(_q),n},n.interpolator=function(e){return arguments.length?(t=e,n):t},n.range=function(){return e.map((n,r)=>t(r/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(n,r)=>(function(e,t){if(!(!(n=(e=Float64Array.from(function*(e,t){if(void 0===t)for(let t of e)null!=t&&(t*=1)>=t&&(yield t);else{let n=-1;for(let r of e)null!=(r=t(r,++n,e))&&(r*=1)>=r&&(yield r)}}(e,void 0))).length)||isNaN(t*=1))){if(t<=0||n<2)return Tm(e);if(t>=1)return Tp(e);var n,r=(n-1)*t,i=Math.floor(r),a=Tp((function e(t,n,r=0,i=1/0,a){if(n=Math.floor(n),r=Math.floor(Math.max(0,r)),i=Math.floor(Math.min(t.length-1,i)),!(r<=n&&n<=i))return t;for(a=void 0===a?Tg:function(e=_q){if(e===_q)return Tg;if("function"!=typeof e)throw TypeError("compare is not a function");return(t,n)=>{let r=e(t,n);return r||0===r?r:(0===e(n,n))-(0===e(t,t))}}(a);i>r;){if(i-r>600){let o=i-r+1,s=n-r+1,l=Math.log(o),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(o-c)/o)*(s-o/2<0?-1:1),d=Math.max(r,Math.floor(n-s*c/o+u)),h=Math.min(i,Math.floor(n+(o-s)*c/o+u));e(t,n,d,h,a)}let o=t[n],s=r,l=i;for(Tv(t,r,n),a(t[i],o)>0&&Tv(t,r,i);s<l;){for(Tv(t,s,l),++s,--l;0>a(t[s],o);)++s;for(;a(t[l],o)>0;)--l}0===a(t[r],o)?Tv(t,r,l):Tv(t,++l,i),l<=n&&(r=l+1),n<=l&&(i=l-1)}return t})(e,i).subarray(0,i+1));return a+(Tm(e.subarray(i+1))-a)*(r-i)}})(e,r/t))},n.copy=function(){return Og(t).domain(e)},_D.apply(n,arguments)}function Ov(){var e,t,n,r,i,a,o,s=0,l=.5,c=1,u=1,d=SI,h=!1;function f(e){return isNaN(e*=1)?o:(e=.5+((e=+a(e))-t)*(u*e<u*t?r:i),d(h?Math.max(0,Math.min(1,e)):e))}function p(e){return function(t){var n,r,i;return arguments.length?([n,r,i]=t,d=function(e,t){void 0===t&&(t=e,e=SM);for(var n=0,r=t.length-1,i=t[0],a=Array(r<0?0:r);n<r;)a[n]=e(i,i=t[++n]);return function(e){var t=Math.max(0,Math.min(r-1,Math.floor(e*=r)));return a[t](e-t)}}(e,[n,r,i]),f):[d(0),d(.5),d(1)]}}return f.domain=function(o){return arguments.length?([s,l,c]=o,e=a(s*=1),t=a(l*=1),n=a(c*=1),r=e===t?0:.5/(t-e),i=t===n?0:.5/(n-t),u=t<e?-1:1,f):[s,l,c]},f.clamp=function(e){return arguments.length?(h=!!e,f):h},f.interpolator=function(e){return arguments.length?(d=e,f):d},f.range=p(SM),f.rangeRound=p(SP),f.unknown=function(e){return arguments.length?(o=e,f):o},function(o){return a=o,e=o(s),t=o(l),n=o(c),r=e===t?0:.5/(t-e),i=t===n?0:.5/(n-t),u=t<e?-1:1,f}}function Ox(){var e=S0(Ov()(SI));return e.copy=function(){return Ou(e,Ox())},_D.apply(e,arguments)}function Oy(){var e=Te(Ov()).domain([.1,1,10]);return e.copy=function(){return Ou(e,Oy()).base(e.base())},_D.apply(e,arguments)}function Ob(){var e=Ti(Ov());return e.copy=function(){return Ou(e,Ob()).constant(e.constant())},_D.apply(e,arguments)}function Ow(){var e=Tc(Ov());return e.copy=function(){return Ou(e,Ow()).exponent(e.exponent())},_D.apply(e,arguments)}function Oj(){return Ow.apply(null,arguments).exponent(.5)}H=(U=function(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,o=e.shortDays,s=e.months,l=e.shortMonths,c=Ar(i),u=Ai(i),d=Ar(a),h=Ai(a),f=Ar(o),p=Ai(o),g=Ar(s),v=Ai(s),x=Ar(l),y=Ai(l),b={a:function(e){return o[e.getDay()]},A:function(e){return a[e.getDay()]},b:function(e){return l[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:null,d:AE,e:AE,f:AA,g:AV,G:AH,H:AC,I:A_,j:AS,L:AT,m:AO,M:AM,p:function(e){return i[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:On,s:Or,S:AP,u:AD,U:AL,V:AR,w:AB,W:Az,x:null,X:null,y:AF,Y:AU,Z:AW,"%":Ot},w={a:function(e){return o[e.getUTCDay()]},A:function(e){return a[e.getUTCDay()]},b:function(e){return l[e.getUTCMonth()]},B:function(e){return s[e.getUTCMonth()]},c:null,d:AY,e:AY,f:AK,g:A8,G:A9,H:AG,I:A$,j:AX,L:Aq,m:AZ,M:AQ,p:function(e){return i[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:On,s:Or,S:AJ,u:A0,U:A1,V:A5,w:A3,W:A4,x:null,X:null,y:A6,Y:A7,Z:Oe,"%":Ot},j={a:function(e,t,n){var r=f.exec(t.slice(n));return r?(e.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=h.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(e,t,n){var r=x.exec(t.slice(n));return r?(e.m=y.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(e,t,n){var r=g.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(e,n,r){return E(e,t,n,r)},d:Am,e:Am,f:Aw,g:Ad,G:Au,H:Av,I:Av,j:Ag,L:Ab,m:Ap,M:Ax,p:function(e,t,n){var r=c.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1},q:Af,Q:AN,s:Ak,S:Ay,u:Ao,U:As,V:Al,w:Aa,W:Ac,x:function(e,t,r){return E(e,n,t,r)},X:function(e,t,n){return E(e,r,t,n)},y:Ad,Y:Au,Z:Ah,"%":Aj};function N(e,t){return function(n){var r,i,a,o=[],s=-1,l=0,c=e.length;for(n instanceof Date||(n=new Date(+n));++s<c;)37===e.charCodeAt(s)&&(o.push(e.slice(l,s)),null!=(i=T8[r=e.charAt(++s)])?r=e.charAt(++s):i="e"===r?" ":"0",(a=t[r])&&(r=a(n,i)),o.push(r),l=s+1);return o.push(e.slice(l,s)),o.join("")}}function k(e,t){return function(n){var r,i,a=T6(1900,void 0,1);if(E(a,e,n+="",0)!=n.length)return null;if("Q"in a)return new Date(a.Q);if("s"in a)return new Date(1e3*a.s+("L"in a?a.L:0));if(!t||"Z"in a||(a.Z=0),"p"in a&&(a.H=a.H%12+12*a.p),void 0===a.m&&(a.m="q"in a?a.q:0),"V"in a){if(a.V<1||a.V>53)return null;"w"in a||(a.w=1),"Z"in a?(r=(i=(r=T4(T6(a.y,0,1))).getUTCDay())>4||0===i?TB.ceil(r):TB(r),r=TY.offset(r,(a.V-1)*7),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(r=(i=(r=T3(T6(a.y,0,1))).getDay())>4||0===i?TA.ceil(r):TA(r),r=TW.offset(r,(a.V-1)*7),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:+("W"in a)),i="Z"in a?T4(T6(a.y,0,1)).getUTCDay():T3(T6(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,T4(a)):T3(a)}}function E(e,t,n,r){for(var i,a,o=0,s=t.length,l=n.length;o<s;){if(r>=l)return -1;if(37===(i=t.charCodeAt(o++))){if(!(a=j[(i=t.charAt(o++))in T8?t.charAt(o++):i])||(r=a(e,n,r))<0)return -1}else if(i!=n.charCodeAt(r++))return -1}return r}return b.x=N(n,b),b.X=N(r,b),b.c=N(t,b),w.x=N(n,w),w.X=N(r,w),w.c=N(t,w),{format:function(e){var t=N(e+="",b);return t.toString=function(){return e},t},parse:function(e){var t=k(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=N(e+="",w);return t.toString=function(){return e},t},utcParse:function(e){var t=k(e+="",!0);return t.toString=function(){return e},t}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]})).format,U.parse,W=U.utcFormat,U.utcParse,e.s(["scaleBand",0,_F,"scaleDiverging",0,Ox,"scaleDivergingLog",0,Oy,"scaleDivergingPow",0,Ow,"scaleDivergingSqrt",0,Oj,"scaleDivergingSymlog",0,Ob,"scaleIdentity",0,S2,"scaleImplicit",0,_B,"scaleLinear",0,S1,"scaleLog",0,Tt,"scaleOrdinal",0,_z,"scalePoint",0,_V,"scalePow",0,Tu,"scaleQuantile",0,Tx,"scaleQuantize",0,Ty,"scaleRadial",0,Tf,"scaleSequential",0,Od,"scaleSequentialLog",0,Oh,"scaleSequentialPow",0,Op,"scaleSequentialQuantile",0,Og,"scaleSequentialSqrt",0,Om,"scaleSequentialSymlog",0,Of,"scaleSqrt",0,Td,"scaleSymlog",0,Ta,"scaleThreshold",0,Tb,"scaleTime",0,Os,"scaleUtc",0,Ol,"tickFormat",0,SJ],29061),e.i(29061),e.s(["scaleBand",0,_F,"scaleDiverging",0,Ox,"scaleDivergingLog",0,Oy,"scaleDivergingPow",0,Ow,"scaleDivergingSqrt",0,Oj,"scaleDivergingSymlog",0,Ob,"scaleIdentity",0,S2,"scaleImplicit",0,_B,"scaleLinear",0,S1,"scaleLog",0,Tt,"scaleOrdinal",0,_z,"scalePoint",0,_V,"scalePow",0,Tu,"scaleQuantile",0,Tx,"scaleQuantize",0,Ty,"scaleRadial",0,Tf,"scaleSequential",0,Od,"scaleSequentialLog",0,Oh,"scaleSequentialPow",0,Op,"scaleSequentialQuantile",0,Og,"scaleSequentialSqrt",0,Om,"scaleSequentialSymlog",0,Of,"scaleSqrt",0,Td,"scaleSymlog",0,Ta,"scaleThreshold",0,Tb,"scaleTime",0,Os,"scaleUtc",0,Ol,"tickFormat",0,SJ],79357);var ON=e.i(79357),Ok=e=>e.chartData,OE=ke([Ok],e=>{var t=null!=e.chartData?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),OC=(e,t,n,r)=>r?OE(e):Ok(e);function O_(e){if(Array.isArray(e)&&2===e.length){var[t,n]=e;if(CW(t)&&CW(n))return!0}return!1}function OS(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function OT(e,t){if(t&&"function"!=typeof e&&Array.isArray(e)&&2===e.length){var n,r,[i,a]=e;if(CW(i))n=i;else if("function"==typeof i)return;if(CW(a))r=a;else if("function"==typeof a)return;var o=[n,r];if(O_(o))return o}}var OA=e.i(51655),OO=e=>e,OM={},OP=e=>function t(){let n;return 0==arguments.length||1==arguments.length&&(n=arguments.length<=0?void 0:arguments[0],n===OM)?t:e(...arguments)},OD=(e,t)=>1===e?t:OP(function(){for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];var a=r.filter(e=>e!==OM).length;return a>=e?t(...r):OD(e-a,OP(function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return t(...r.map(e=>e===OM?n.shift():e),...n)}))}),OL=(e,t)=>{for(var n=[],r=e;r<t;++r)n[r-e]=r;return n},OI=OD((a=(e,t)=>Array.isArray(t)?t.map(e):Object.keys(t).map(e=>t[e]).map(e)).length,a),OR=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(!t.length)return OO;var r=t.reverse(),i=r[0],a=r.slice(1);return function(){return a.reduce((e,t)=>t(e),i(...arguments))}};function OB(e){return 0===e?1:Math.floor(new OA.default(e).abs().log(10).toNumber())+1}function Oz(e,t,n){for(var r=new OA.default(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var OF=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},OV=(e,t,n)=>{if(e.lte(0))return new OA.default(0);var r=OB(e.toNumber()),i=new OA.default(10).pow(r),a=e.div(i),o=1!==r?.05:.1,s=new OA.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return new OA.default(t?s.toNumber():Math.ceil(s.toNumber()))},OU=function(e,t,n,r){var i,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new OA.default(0),tickMin:new OA.default(0),tickMax:new OA.default(0)};var o=OV(new OA.default(t).sub(e).div(n-1),r,a),s=Math.ceil((i=e<=0&&t>=0?new OA.default(0):(i=new OA.default(e).add(t).div(2)).sub(new OA.default(i).mod(o))).sub(e).div(o).toNumber()),l=Math.ceil(new OA.default(t).sub(i).div(o).toNumber()),c=s+l+1;return c>n?OU(e,t,n,r,a+1):(c<n&&(l=t>0?l+(n-c):l,s=t>0?s:s+(n-c)),{step:o,tickMin:i.sub(new OA.default(s).mul(o)),tickMax:i.add(new OA.default(l).mul(o))})},OH=function(e){var[t,n]=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=Math.max(r,2),[o,s]=OF([t,n]);if(o===-1/0||s===1/0){var l=s===1/0?[o,...OL(0,r-1).map(()=>1/0)]:[...OL(0,r-1).map(()=>-1/0),s];return t>n?l.reverse():l}if(o===s){var c=new OA.default(1),u=new OA.default(o);if(!u.isint()&&i){var d=Math.abs(o);d<1?(c=new OA.default(10).pow(OB(o)-1),u=new OA.default(Math.floor(u.div(c).toNumber())).mul(c)):d>1&&(u=new OA.default(Math.floor(o)))}else 0===o?u=new OA.default(Math.floor((r-1)/2)):i||(u=new OA.default(Math.floor(o)));var h=Math.floor((r-1)/2);return OR(OI(e=>u.add(new OA.default(e-h).mul(c)).toNumber()),OL)(0,r)}var{step:f,tickMin:p,tickMax:g}=OU(o,s,a,i,0),v=Oz(p,g.add(new OA.default(.1).mul(f)),f);return t>n?v.reverse():v},OW=function(e,t){var[n,r]=e,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],[a,o]=OF([n,r]);if(a===-1/0||o===1/0)return[n,r];if(a===o)return[a];var s=Math.max(t,2),l=OV(new OA.default(o).sub(a).div(s-1),i,0),c=[...Oz(new OA.default(a),new OA.default(o),l),o];return!1===i&&(c=c.map(e=>Math.round(e))),n>r?c.reverse():c},OY=e=>e.rootProps.stackOffset,OG=e=>e.rootProps.reverseStackOrder,O$=e=>e.options.chartName,OX=e=>e.rootProps.syncId,Oq=e=>e.rootProps.syncMethod,OK=e=>e.options.eventEmitter;function OZ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function OQ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?OZ(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OZ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var OJ=Math.PI/180,O0=(e,t,n,r)=>({x:e+Math.cos(-OJ*r)*n,y:t+Math.sin(-OJ*r)*n}),O1={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},O2={allowDecimals:!1,allowDuplicatedCategory:!0,angleAxisId:0,axisLine:!0,axisLineType:"polygon",cx:0,cy:0,orientation:"outer",reversed:!1,scale:"auto",tick:!0,tickLine:!0,tickSize:8,type:"category",zIndex:O1.axis},O5={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,angle:0,axisLine:!0,includeHidden:!1,hide:!1,label:!1,orientation:"right",radiusAxisId:0,reversed:!1,scale:"auto",stroke:"#ccc",tick:!0,tickCount:5,type:"number",zIndex:O1.axis},O3=(e,t)=>{if(e&&t)return null!=e&&e.reversed?[t[1],t[0]]:t},O4={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:O2.angleAxisId,includeHidden:!1,name:void 0,reversed:O2.reversed,scale:O2.scale,tick:O2.tick,tickCount:void 0,ticks:void 0,type:O2.type,unit:void 0},O6={allowDataOverflow:O5.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:O5.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:O5.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:O5.scale,tick:O5.tick,tickCount:O5.tickCount,ticks:void 0,type:O5.type,unit:void 0},O8={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:O2.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:O2.angleAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:O2.scale,tick:O2.tick,tickCount:void 0,ticks:void 0,type:"number",unit:void 0},O7={allowDataOverflow:O5.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:O5.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:O5.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:O5.scale,tick:O5.tick,tickCount:O5.tickCount,ticks:void 0,type:"category",unit:void 0},O9=(e,t)=>null!=e.polarAxis.angleAxis[t]?e.polarAxis.angleAxis[t]:"radial"===e.layout.layoutType?O8:O4,Me=(e,t)=>null!=e.polarAxis.radiusAxis[t]?e.polarAxis.radiusAxis[t]:"radial"===e.layout.layoutType?O7:O6,Mt=e=>e.polarOptions,Mn=ke([C4,C6,_r],function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,right:0,bottom:0,left:0,width:0,height:0,brushBottom:0};return Math.min(Math.abs(e-(n.left||0)-(n.right||0)),Math.abs(t-(n.top||0)-(n.bottom||0)))/2}),Mr=ke([Mt,Mn],(e,t)=>{if(null!=e)return Er(e.innerRadius,t,0)}),Mi=ke([Mt,Mn],(e,t)=>{if(null!=e)return Er(e.outerRadius,t,.8*t)}),Ma=ke([Mt],e=>{if(null==e)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]});ke([O9,Ma],O3);var Mo=ke([Mn,Mr,Mi],(e,t,n)=>{if(null!=e&&null!=t&&null!=n)return[t,n]});ke([Me,Mo],O3);var Ms=ke([_A,Mt,Mr,Mi,C4,C6],(e,t,n,r,i,a)=>{if(("centric"===e||"radial"===e)&&null!=t&&null!=n&&null!=r){var{cx:o,cy:s,startAngle:l,endAngle:c}=t;return{cx:Er(o,i,i/2),cy:Er(s,a,a/2),innerRadius:n,outerRadius:r,startAngle:l,endAngle:c,clockWise:!1}}}),Ml=(e,t)=>t,Mc=(e,t,n)=>n;function Mu(e){return null==e?void 0:e.id}function Md(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=n,o=new Map;return e.forEach(e=>{var t,n=null!=(t=e.data)?t:r;if(null!=n&&0!==n.length){var s=Mu(e);n.forEach((t,n)=>{var r,l=null==a||i?n:String(CX(t,a,null)),c=CX(t,e.dataKey,0);Object.assign(r=o.has(l)?o.get(l):{},{[s]:c}),o.set(l,r)})}}),Array.from(o.values())}function Mh(e){return"stackId"in e&&null!=e.stackId&&null!=e.dataKey}var Mf=(e,t)=>e===t||null!=e&&null!=t&&e[0]===t[0]&&e[1]===t[1];function Mp(e,t){return!!(Array.isArray(e)&&Array.isArray(t))&&0===e.length&&0===t.length||e===t}var Mm=e=>{var t=_A(e);return"horizontal"===t?"xAxis":"vertical"===t?"yAxis":"centric"===t?"angleAxis":"radiusAxis"},Mg=e=>e.tooltip.settings.axisId;function Mv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Mx(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Mv(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mv(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var My=[0,"auto"],Mb={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"bottom",padding:{left:0,right:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"category",unit:void 0},Mw=(e,t)=>e.cartesianAxis.xAxis[t],Mj=(e,t)=>{var n=Mw(e,t);return null==n?Mb:n},MN={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:My,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:60},Mk=(e,t)=>e.cartesianAxis.yAxis[t],ME=(e,t)=>{var n=Mk(e,t);return null==n?MN:n},MC={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},M_=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return null==n?MC:n},MS=(e,t,n)=>{switch(t){case"xAxis":return Mj(e,n);case"yAxis":return ME(e,n);case"zAxis":return M_(e,n);case"angleAxis":return O9(e,n);case"radiusAxis":return Me(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},MT=(e,t,n)=>{switch(t){case"xAxis":return Mj(e,n);case"yAxis":return ME(e,n);case"angleAxis":return O9(e,n);case"radiusAxis":return Me(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},MA=e=>e.graphicalItems.cartesianItems.some(e=>"bar"===e.type)||e.graphicalItems.polarItems.some(e=>"radialBar"===e.type);function MO(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var MM=e=>e.graphicalItems.cartesianItems,MP=ke([Ml,Mc],MO),MD=(e,t,n)=>e.filter(n).filter(e=>(null==t?void 0:t.includeHidden)===!0||!e.hide),ML=ke([MM,MS,MP],MD,{memoizeOptions:{resultEqualityCheck:Mp}}),MI=ke([ML],e=>e.filter(e=>"area"===e.type||"bar"===e.type).filter(Mh)),MR=e=>e.filter(e=>!("stackId"in e)||void 0===e.stackId),MB=ke([ML],MR),Mz=e=>e.map(e=>e.data).filter(Boolean).flat(1),MF=ke([ML],Mz,{memoizeOptions:{resultEqualityCheck:Mp}}),MV=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},MU=ke([MF,OC],MV),MH=(e,t,n)=>(null==t?void 0:t.dataKey)!=null?e.map(e=>({value:CX(e,t.dataKey)})):n.length>0?n.map(e=>e.dataKey).flatMap(t=>e.map(e=>({value:CX(e,t)}))):e.map(e=>({value:e})),MW=ke([MU,MS,ML],MH);function MY(e,t){switch(e){case"xAxis":return"x"===t.direction;case"yAxis":return"y"===t.direction;default:return!1}}function MG(e){if(Ee(e)||e instanceof Date){var t=Number(e);if(CW(t))return t}}function M$(e){if(Array.isArray(e)){var t=[MG(e[0]),MG(e[1])];return O_(t)?t:void 0}var n=MG(e);if(null!=n)return[n,n]}function MX(e){return e.map(MG).filter(El)}var Mq=e=>{var t=Mm(e),n=Mg(e);return MT(e,t,n)},MK=ke([Mq],e=>null==e?void 0:e.dataKey),MZ=ke([MI,OC,Mq],Md),MQ=(e,t,n,r)=>Object.fromEntries(Object.entries(t.reduce((e,t)=>{if(null==t.stackId)return e;var n=e[t.stackId];return null==n&&(n=[]),n.push(t),e[t.stackId]=n,e},{})).map(t=>{var i,a,o,[s,l]=t,c=r?[...l].reverse():l,u=c.map(Mu);return[s,{stackedData:(a=null!=(i=CQ[n])?i:Cz,(o=(function(){var e=CB([]),t=CF,n=Cz,r=CV;function i(i){var a,o,s=Array.from(e.apply(this,arguments),CU),l=s.length,c=-1;for(let e of i)for(a=0,++c;a<l;++a)(s[a][c]=[0,+r(e,s[a].key,c,i)]).data=e;for(a=0,o=CR(t(s));a<l;++a)s[o[a]].index=a;return n(s,o),s}return i.keys=function(t){return arguments.length?(e="function"==typeof t?t:CB(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r="function"==typeof e?e:CB(+e),i):r},i.order=function(e){return arguments.length?(t=null==e?CF:"function"==typeof e?e:CB(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=null==e?Cz:e,i):n},i})().keys(u).value((e,t)=>Number(CX(e,t,0))).order(CF).offset(a)(e)).forEach((t,n)=>{t.forEach((t,r)=>{var i=CX(e[r],u[n],0);Array.isArray(i)&&2===i.length&&k9(i[0])&&k9(i[1])&&(t[0]=i[0],t[1]=i[1])})}),o),graphicalItems:c}]})),MJ=ke([MZ,MI,OY,OG],MQ),M0=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(null==r&&"zAxis"!==n){var o=((e,t,n)=>{if(null!=e){let r;return[(r=Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,s=o.reduce((e,r)=>{var i,a=[Math.min(...i=CH(r,t,n).flat(2).filter(k9)),Math.max(...i)];return CW(a[0])&&CW(a[1])?[Math.min(e[0],a[0]),Math.max(e[1],a[1])]:e},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))[0]===1/0?0:r[0],r[1]===-1/0?0:r[1]]}})(e,i,a);if(null==o||0!==o[0]||0!==o[1])return o}},M1=ke([MS],e=>e.allowDataOverflow),M2=e=>{var t;if(null==e||!("domain"in e))return My;if(null!=e.domain)return e.domain;if("ticks"in e&&null!=e.ticks){if("number"===e.type){var n=MX(e.ticks);return[Math.min(...n),Math.max(...n)]}if("category"===e.type)return e.ticks.map(String)}return null!=(t=null==e?void 0:e.domain)?t:My},M5=ke([MS],M2),M3=ke([M5,M1],OT),M4=ke([MJ,Ok,Ml,M3],M0,{memoizeOptions:{resultEqualityCheck:Mf}}),M6=e=>e.errorBars,M8=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.filter(Boolean);if(0!==r.length){var i=r.flat();return[Math.min(...i),Math.max(...i)]}},M7=(e,t,n,r,i)=>{var a,o;if(n.length>0&&e.forEach(e=>{n.forEach(n=>{var s,l,c=null==(s=r[n.id])?void 0:s.filter(e=>MY(i,e)),u=CX(e,null!=(l=t.dataKey)?l:n.dataKey),d=!(!c||"number"!=typeof u||k8(u))&&c.length?MX(c.flatMap(t=>{var n,r,i=CX(e,t.dataKey);if(Array.isArray(i)?[n,r]=i:n=r=i,CW(n)&&CW(r))return[u-n,u+r]})):[];if(d.length>=2){var h=Math.min(...d),f=Math.max(...d);(null==a||h<a)&&(a=h),(null==o||f>o)&&(o=f)}var p=M$(u);null!=p&&(a=null==a?p[0]:Math.min(a,p[0]),o=null==o?p[1]:Math.max(o,p[1]))})}),(null==t?void 0:t.dataKey)!=null&&e.forEach(e=>{var n=M$(CX(e,t.dataKey));null!=n&&(a=null==a?n[0]:Math.min(a,n[0]),o=null==o?n[1]:Math.max(o,n[1]))}),CW(a)&&CW(o))return[a,o]},M9=ke([MU,MS,MB,M6,Ml],M7,{memoizeOptions:{resultEqualityCheck:Mf}});function Pe(e){var{value:t}=e;if(Ee(t)||t instanceof Date)return t}var Pt=e=>e.referenceElements.dots,Pn=(e,t,n)=>e.filter(e=>"extendDomain"===e.ifOverflow).filter(e=>"xAxis"===t?e.xAxisId===n:e.yAxisId===n),Pr=ke([Pt,Ml,Mc],Pn),Pi=e=>e.referenceElements.areas,Pa=ke([Pi,Ml,Mc],Pn),Po=e=>e.referenceElements.lines,Ps=ke([Po,Ml,Mc],Pn),Pl=(e,t)=>{if(null!=e){var n=MX(e.map(e=>"xAxis"===t?e.x:e.y));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},Pc=ke(Pr,Ml,Pl),Pu=(e,t)=>{if(null!=e){var n=MX(e.flatMap(e=>["xAxis"===t?e.x1:e.y1,"xAxis"===t?e.x2:e.y2]));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},Pd=ke([Pa,Ml],Pu),Ph=(e,t)=>{if(null!=e){var n=e.flatMap(e=>"xAxis"===t?function(e){if(null!=e.x)return MX([e.x]);var t,n=null==(t=e.segment)?void 0:t.map(e=>e.x);return null==n||0===n.length?[]:MX(n)}(e):function(e){if(null!=e.y)return MX([e.y]);var t,n=null==(t=e.segment)?void 0:t.map(e=>e.y);return null==n||0===n.length?[]:MX(n)}(e));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},Pf=ke([Ps,Ml],Ph),Pp=ke(Pc,Pf,Pd,(e,t,n)=>M8(e,n,t)),Pm=(e,t,n,r,i,a,o,s)=>null!=n?n:function(e,t,n){if(n||null!=t){if("function"==typeof e&&null!=t)try{var r=e(t,n);if(O_(r))return OS(r,t,n)}catch(e){}if(Array.isArray(e)&&2===e.length){var i,a,[o,s]=e;if("auto"===o)null!=t&&(i=Math.min(...t));else if(k9(o))i=o;else if("function"==typeof o)try{null!=t&&(i=o(null==t?void 0:t[0]))}catch(e){}else if("string"==typeof o&&C0.test(o)){var l=C0.exec(o);if(null==l||null==l[1]||null==t)i=void 0;else{var c=+l[1];i=t[0]-c}}else i=null==t?void 0:t[0];if("auto"===s)null!=t&&(a=Math.max(...t));else if(k9(s))a=s;else if("function"==typeof s)try{null!=t&&(a=s(null==t?void 0:t[1]))}catch(e){}else if("string"==typeof s&&C1.test(s)){var u=C1.exec(s);if(null==u||null==u[1]||null==t)a=void 0;else{var d=+u[1];a=t[1]+d}}else a=null==t?void 0:t[1];var h=[i,a];if(O_(h))return null==t?h:OS(h,t,n)}}}(t,"vertical"===o&&"xAxis"===s||"horizontal"===o&&"yAxis"===s?M8(r,a,i):M8(a,i),e.allowDataOverflow),Pg=ke([MS,M5,M3,M4,M9,Pp,_A,Ml],Pm,{memoizeOptions:{resultEqualityCheck:Mf}}),Pv=[0,1],Px=(e,t,n,r,i,a,o)=>{if(null!=e&&null!=n&&0!==n.length||void 0!==o){var s,l,{dataKey:c,type:u}=e,d=Cq(t,a);return d&&null==c?(0,_M.default)(0,null!=(l=null==n?void 0:n.length)?l:0):"category"===u?(s=r.map(Pe).filter(e=>null!=e),d&&(null==e.dataKey||e.allowDuplicatedCategory&&Ei(s))?(0,_M.default)(0,r.length):e.allowDuplicatedCategory?s:Array.from(new Set(s))):"expand"===i?Pv:o}},Py=ke([MS,_A,MU,MW,OY,Ml,Pg],Px),Pb=(e,t,n,r,i)=>{if(null!=e){var{scale:a,type:o}=e;if("auto"===a)return"radial"===t&&"radiusAxis"===i?"band":"radial"===t&&"angleAxis"===i?"linear":"category"===o&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?"point":"category"===o?"band":"linear";if("string"==typeof a){var s="scale".concat(Es(a));return s in ON?s:"point"}}},Pw=ke([MS,_A,MA,O$,Ml],Pb);function Pj(e,t,n,r){if(null!=n&&null!=r){if("function"==typeof e.scale)return e.scale.copy().domain(n).range(r);var i=function(e){if(null!=e){if(e in ON)return ON[e]();var t="scale".concat(Es(e));if(t in ON)return ON[t]()}}(t);if(null!=i){var a=i.domain(n).range(r);return(e=>{var t=e.domain();if(t&&!(t.length<=2)){var n=t.length,r=e.range(),i=Math.min(r[0],r[1])-1e-4,a=Math.max(r[0],r[1])+1e-4,o=e(t[0]),s=e(t[n-1]);(o<i||o>a||s<i||s>a)&&e.domain([t[0],t[n-1]])}})(a),a}}}var PN=(e,t,n)=>{var r=M2(t);if("auto"===n||"linear"===n){if(null!=t&&t.tickCount&&Array.isArray(r)&&("auto"===r[0]||"auto"===r[1])&&O_(e))return OH(e,t.tickCount,t.allowDecimals);if(null!=t&&t.tickCount&&"number"===t.type&&O_(e))return OW(e,t.tickCount,t.allowDecimals)}},Pk=ke([Py,MT,Pw],PN),PE=(e,t,n,r)=>"angleAxis"!==r&&(null==e?void 0:e.type)==="number"&&O_(t)&&Array.isArray(n)&&n.length>0?[Math.min(t[0],n[0]),Math.max(t[1],n[n.length-1])]:t,PC=ke([MS,Py,Pk,Ml],PE),P_=ke(MW,MS,(e,t)=>{if(t&&"number"===t.type){var n=1/0,r=Array.from(MX(e.map(e=>e.value))).sort((e,t)=>e-t),i=r[0],a=r[r.length-1];if(null==i||null==a)return 1/0;var o=a-i;if(0===o)return 1/0;for(var s=0;s<r.length-1;s++){var l=r[s],c=r[s+1];null!=l&&null!=c&&(n=Math.min(n,c-l))}return n/o}}),PS=ke(P_,_A,e=>e.rootProps.barCategoryGap,_r,(e,t,n,r,i)=>i,(e,t,n,r,i)=>{if(!CW(e))return 0;var a="vertical"===t?r.height:r.width;if("gap"===i)return e*a/2;if("no-gap"===i){var o=Er(n,e*a),s=e*a/2;return s-o-(s-o)/a*o}return 0}),PT=ke(Mj,(e,t,n)=>{var r=Mj(e,t);return null==r||"string"!=typeof r.padding?0:PS(e,"xAxis",t,n,r.padding)},(e,t)=>{if(null==e)return{left:0,right:0};var n,r,{padding:i}=e;return"string"==typeof i?{left:t,right:t}:{left:(null!=(n=i.left)?n:0)+t,right:(null!=(r=i.right)?r:0)+t}}),PA=ke(ME,(e,t,n)=>{var r=ME(e,t);return null==r||"string"!=typeof r.padding?0:PS(e,"yAxis",t,n,r.padding)},(e,t)=>{if(null==e)return{top:0,bottom:0};var n,r,{padding:i}=e;return"string"==typeof i?{top:t,bottom:t}:{top:(null!=(n=i.top)?n:0)+t,bottom:(null!=(r=i.bottom)?r:0)+t}}),PO=ke([_r,PT,_c,_l,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:a}=r;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),PM=ke([_r,_A,PA,_c,_l,(e,t,n)=>n],(e,t,n,r,i,a)=>{var{padding:o}=i;return a?[r.height-o.bottom,o.top]:"horizontal"===t?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),PP=(e,t,n,r)=>{var i;switch(t){case"xAxis":return PO(e,n,r);case"yAxis":return PM(e,n,r);case"zAxis":return null==(i=M_(e,n))?void 0:i.range;case"angleAxis":return Ma(e);case"radiusAxis":return Mo(e,n);default:return}},PD=ke([MS,PP],O3),PL=ke([MS,Pw,PC,PD],Pj);function PI(e,t){return e.id<t.id?-1:+(e.id>t.id)}ke([ML,M6,Ml],(e,t,n)=>e.flatMap(e=>t[e.id]).filter(Boolean).filter(e=>MY(n,e)));var PR=(e,t)=>t,PB=(e,t,n)=>n,Pz=ke(C9,PR,PB,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(PI)),PF=ke(_e,PR,PB,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(PI)),PV=(e,t)=>({width:e.width,height:t.height}),PU=ke(_r,Mj,PV),PH=ke(C6,_r,Pz,PR,PB,(e,t,n,r,i)=>{var a,o={};return n.forEach(n=>{var s=PV(t,n);null==a&&(a=((e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}})(t,r,e));var l="top"===r&&!i||"bottom"===r&&i;o[n.id]=a-Number(l)*s.height,a+=(l?-1:1)*s.height}),o}),PW=ke(C4,_r,PF,PR,PB,(e,t,n,r,i)=>{var a,o={};return n.forEach(n=>{var s={width:"number"==typeof n.width?n.width:60,height:t.height};null==a&&(a=((e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}})(t,r,e));var l="left"===r&&!i||"right"===r&&i;o[n.id]=a-Number(l)*s.width,a+=(l?-1:1)*s.width}),o}),PY=ke([_r,Mj,(e,t)=>{var n=Mj(e,t);if(null!=n)return PH(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(null!=t){var i=null==n?void 0:n[r];return null==i?{x:e.left,y:0}:{x:e.left,y:i}}}),PG=ke([_r,ME,(e,t)=>{var n=ME(e,t);if(null!=n)return PW(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(null!=t){var i=null==n?void 0:n[r];return null==i?{x:0,y:e.top}:{x:i,y:e.top}}}),P$=ke(_r,ME,(e,t)=>({width:"number"==typeof t.width?t.width:60,height:e.height})),PX=(e,t,n,r)=>{if(null!=n){var{allowDuplicatedCategory:i,type:a,dataKey:o}=n,s=Cq(e,r),l=t.map(e=>e.value);if(o&&s&&"category"===a&&i&&Ei(l))return l}},Pq=ke([_A,MW,MS,Ml],PX),PK=(e,t,n,r)=>{if(null!=n&&null!=n.dataKey){var{type:i,scale:a}=n;if(Cq(e,r)&&("number"===i||"auto"!==a))return t.map(e=>e.value)}},PZ=ke([_A,MW,MT,Ml],PK),PQ=ke([_A,(e,t,n)=>{switch(t){case"xAxis":return Mj(e,n);case"yAxis":return ME(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},Pw,PL,Pq,PZ,PP,Pk,Ml],(e,t,n,r,i,a,o,s,l)=>{if(null!=t){var c=Cq(e,l);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:l,categoricalDomain:a,duplicateDomain:i,isCategorical:c,niceTicks:s,range:o,realScaleType:n,scale:r}}}),PJ=ke([_A,MT,Pw,PL,Pk,PP,Pq,PZ,Ml],(e,t,n,r,i,a,o,s,l)=>{if(null!=t&&null!=r){var c=Cq(e,l),{type:u,ticks:d,tickCount:h}=t,f="scaleBand"===n&&"function"==typeof r.bandwidth?r.bandwidth()/2:2,p="category"===u&&r.bandwidth?r.bandwidth()/f:0;p="angleAxis"===l&&null!=a&&a.length>=2?2*k6(a[0]-a[1])*p:p;var g=d||i;return g?g.map((e,t)=>({index:t,coordinate:r(o?o.indexOf(e):e)+p,value:e,offset:p})).filter(e=>CW(e.coordinate)):c&&s?s.map((e,t)=>({coordinate:r(e)+p,value:e,index:t,offset:p})).filter(e=>CW(e.coordinate)):r.ticks?r.ticks(h).map(e=>({coordinate:r(e)+p,value:e,offset:p})):r.domain().map((e,t)=>({coordinate:r(e)+p,value:o?o[e]:e,index:t,offset:p}))}}),P0=ke([_A,MT,PL,PP,Pq,PZ,Ml],(e,t,n,r,i,a,o)=>{if(null!=t&&null!=n&&null!=r&&r[0]!==r[1]){var s=Cq(e,o),{tickCount:l}=t,c=0;return(c="angleAxis"===o&&(null==r?void 0:r.length)>=2?2*k6(r[0]-r[1])*c:c,s&&a)?a.map((e,t)=>({coordinate:n(e)+c,value:e,index:t,offset:c})):n.ticks?n.ticks(l).map(e=>({coordinate:n(e)+c,value:e,offset:c})):n.domain().map((e,t)=>({coordinate:n(e)+c,value:i?i[e]:e,index:t,offset:c}))}}),P1=ke(MS,PL,(e,t)=>{if(null!=e&&null!=t)return Mx(Mx({},e),{},{scale:t})}),P2=ke([MS,Pw,Py,PD],Pj);ke((e,t,n)=>M_(e,n),P2,(e,t)=>{if(null!=e&&null!=t)return Mx(Mx({},e),{},{scale:t})});var P5=ke([_A,C9,_e],(e,t,n)=>{switch(e){case"horizontal":return t.some(e=>e.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(e=>e.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),P3=e=>e.options.defaultTooltipEventType,P4=e=>e.options.validateTooltipEventTypes;function P6(e,t,n){if(null==e)return t;var r=e?"axis":"item";return null==n?t:n.includes(r)?r:t}function P8(e,t){return P6(t,P3(e),P4(e))}var P7=(e,t)=>{var n,r=Number(t);if(!k8(r)&&null!=t)return r>=0?null==e||null==(n=e[r])?void 0:n.value:void 0};function P9(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function De(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?P9(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P9(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Dt=(e,t,n,r)=>{if(null==t)return Ct;var i,a,o,s=(i=e,a=t,o=n,"axis"===a?"click"===o?i.axisInteraction.click:i.axisInteraction.hover:"click"===o?i.itemInteraction.click:i.itemInteraction.hover);if(null==s)return Ct;if(s.active)return s;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&null!=e.syncInteraction.index)return e.syncInteraction;var l=!0===e.settings.active;if(null!=s.index){if(l)return De(De({},s),{},{active:!0})}else if(null!=r)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return De(De({},Ct),{},{coordinate:s.coordinate})},Dn=(e,t,n,r)=>{var i=null==e?void 0:e.index;if(null==i)return null;var a=Number(i);if(!CW(a))return i;var o=Infinity;t.length>0&&(o=t.length-1);var s=Math.max(0,Math.min(a,o)),l=t[s];return null==l?String(s):!function(e,t,n){if(null==n||null==t)return!0;var r=CX(e,t);return!(null!=r&&O_(n))||function(e,t){var n=function(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}(e),r=t[0],i=t[1];if(void 0===n)return!1;var a=Math.min(r,i),o=Math.max(r,i);return n>=a&&n<=o}(r,n)}(l,n,r)?null:String(s)},Dr=(e,t,n,r,i,a,o,s)=>{if(null!=a&&null!=s){var l=o[0],c=null==l?void 0:s(l.positions,a);if(null!=c)return c;var u=null==i?void 0:i[Number(a)];if(u)if("horizontal"===n)return{x:u.coordinate,y:(r.top+t)/2};else return{x:(r.left+e)/2,y:u.coordinate}}},Di=(e,t,n,r)=>{if("axis"===t)return e.tooltipItemPayloads;if(0===e.tooltipItemPayloads.length)return[];if(null==(i="hover"===n?e.itemInteraction.hover.graphicalItemId:e.itemInteraction.click.graphicalItemId)&&null!=r){var i,a=e.tooltipItemPayloads[0];return null!=a?[a]:[]}return e.tooltipItemPayloads.filter(e=>{var t;return(null==(t=e.settings)?void 0:t.graphicalItemId)===i})},Da=e=>e.options.tooltipPayloadSearcher,Do=e=>e.tooltip;function Ds(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Dl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ds(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ds(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Dc=(e,t,n,r,i,a,o)=>{if(null!=t&&null!=a){var{chartData:s,computedData:l,dataStartIndex:c,dataEndIndex:u}=n;return e.reduce((e,n)=>{var d,h,f,{dataDefinedOnItem:p,settings:g}=n,v=null!=p?p:s,x=Array.isArray(v)?CH(v,c,u):v,y=null!=(d=null==g?void 0:g.dataKey)?d:r,b=null==g?void 0:g.nameKey;return Array.isArray(h=r&&Array.isArray(x)&&!Array.isArray(x[0])&&"axis"===o?Eo(x,r,i):a(x,t,l,b))?h.forEach(t=>{var n=Dl(Dl({},g),{},{name:t.name,unit:t.unit,color:void 0,fill:void 0});e.push(C5({tooltipEntrySettings:n,dataKey:t.dataKey,payload:t.payload,value:CX(t.payload,t.dataKey),name:t.name}))}):e.push(C5({tooltipEntrySettings:g,dataKey:y,payload:h,value:CX(h,y),name:null!=(f=CX(h,b))?f:null==g?void 0:g.name})),e},[])}},Du=ke([Mq,_A,MA,O$,Mm],Pb),Dd=ke([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),Dh=ke([Mm,Mg],MO),Df=ke([Dd,Mq,Dh],MD,{memoizeOptions:{resultEqualityCheck:Mp}}),Dp=ke([Df],e=>e.filter(Mh)),Dm=ke([Df],Mz,{memoizeOptions:{resultEqualityCheck:Mp}}),Dg=ke([Dm,Ok],MV),Dv=ke([Dp,Ok,Mq],Md),Dx=ke([Dg,Mq,Df],MH),Dy=ke([Mq],M2),Db=ke([Mq],e=>e.allowDataOverflow),Dw=ke([Dy,Db],OT),Dj=ke([Df],e=>e.filter(Mh)),DN=ke([Dv,Dj,OY,OG],MQ),Dk=ke([DN,Ok,Mm,Dw],M0),DE=ke([Df],MR),DC=ke([Dg,Mq,DE,M6,Mm],M7,{memoizeOptions:{resultEqualityCheck:Mf}}),D_=ke([Pt,Mm,Mg],Pn),DS=ke([D_,Mm],Pl),DT=ke([Pi,Mm,Mg],Pn),DA=ke([DT,Mm],Pu),DO=ke([Po,Mm,Mg],Pn),DM=ke([DO,Mm],Ph),DP=ke([DS,DM,DA],M8),DD=ke([Mq,Dy,Dw,Dk,DC,DP,_A,Mm],Pm),DL=ke([Mq,_A,Dg,Dx,OY,Mm,DD],Px),DI=ke([DL,Mq,Du],PN),DR=ke([Mq,DL,DI,Mm],PE),DB=e=>{var t=Mm(e),n=Mg(e);return PP(e,t,n,!1)},Dz=ke([Mq,DB],O3),DF=ke([Mq,Du,DR,Dz],Pj),DV=ke([_A,Dx,Mq,Mm],PX),DU=ke([_A,Dx,Mq,Mm],PK),DH=ke([_A,Mq,Du,DF,DB,DV,DU,Mm],(e,t,n,r,i,a,o,s)=>{if(t){var{type:l}=t,c=Cq(e,s);if(r){var u="scaleBand"===n&&r.bandwidth?r.bandwidth()/2:2,d="category"===l&&r.bandwidth?r.bandwidth()/u:0;return(d="angleAxis"===s&&null!=i&&(null==i?void 0:i.length)>=2?2*k6(i[0]-i[1])*d:d,c&&o)?o.map((e,t)=>({coordinate:r(e)+d,value:e,index:t,offset:d})):r.domain().map((e,t)=>({coordinate:r(e)+d,value:a?a[e]:e,index:t,offset:d}))}}}),DW=ke([P3,P4,e=>e.tooltip.settings],(e,t,n)=>P6(n.shared,e,t)),DY=e=>e.tooltip.settings.trigger,DG=e=>e.tooltip.settings.defaultIndex,D$=ke([Do,DW,DY,DG],Dt),DX=ke([D$,Dg,MK,DL],Dn),Dq=ke([DH,DX],P7),DK=ke([D$],e=>{if(e)return e.dataKey});ke([D$],e=>{if(e)return e.graphicalItemId});var DZ=ke([Do,DW,DY,DG],Di),DQ=ke([C4,C6,_A,_r,DH,DG,DZ,Da],Dr),DJ=ke([D$,DQ],(e,t)=>null!=e&&e.coordinate?e.coordinate:t),D0=ke([D$],e=>{var t;return null!=(t=null==e?void 0:e.active)&&t}),D1=ke([DZ,DX,Ok,MK,Dq,Da,DW],Dc),D2=ke([D1],e=>{if(null!=e)return Array.from(new Set(e.map(e=>e.payload).filter(e=>null!=e)))});function D5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function D3(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D5(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D5(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var D4=(e,t,n,r,i)=>{var a=null!=(d=null==t?void 0:t.length)?d:0;if(a<=1||null==e)return 0;if("angleAxis"===r&&null!=i&&1e-6>=Math.abs(Math.abs(i[1]-i[0])-360))for(var o=0;o<a;o++){var s=o>0?null==(h=n[o-1])?void 0:h.coordinate:null==(f=n[a-1])?void 0:f.coordinate,l=null==(p=n[o])?void 0:p.coordinate,c=o>=a-1?null==(g=n[0])?void 0:g.coordinate:null==(v=n[o+1])?void 0:v.coordinate,u=void 0;if(null!=s&&null!=l&&null!=c)if(k6(l-s)!==k6(c-l)){var d,h,f,p,g,v,x,y=[];if(k6(c-l)===k6(i[1]-i[0])){u=c;var b=l+i[1]-i[0];y[0]=Math.min(b,(b+s)/2),y[1]=Math.max(b,(b+s)/2)}else{u=s;var w=c+i[1]-i[0];y[0]=Math.min(l,(w+l)/2),y[1]=Math.max(l,(w+l)/2)}var j=[Math.min(l,(u+l)/2),Math.max(l,(u+l)/2)];if(e>j[0]&&e<=j[1]||e>=y[0]&&e<=y[1])return null==(x=n[o])?void 0:x.index}else{var N,k=Math.min(s,c),E=Math.max(s,c);if(e>(k+l)/2&&e<=(E+l)/2)return null==(N=n[o])?void 0:N.index}}else if(t)for(var C=0;C<a;C++){var _=t[C];if(null!=_){var S=t[C+1],T=t[C-1];if(0===C&&null!=S&&e<=(_.coordinate+S.coordinate)/2||C===a-1&&null!=T&&e>(_.coordinate+T.coordinate)/2||C>0&&C<a-1&&null!=T&&null!=S&&e>(_.coordinate+T.coordinate)/2&&e<=(_.coordinate+S.coordinate)/2)return _.index}}return -1},D6=(e,t)=>t,D8=(e,t,n)=>n,D7=(e,t,n,r)=>r,D9=ke(DH,e=>(0,CL.default)(e,e=>e.coordinate)),Le=ke([Do,D6,D8,D7],Dt),Lt=ke([Le,Dg,MK,DL],Dn),Ln=ke([Do,D6,D8,D7],Di),Lr=ke([C4,C6,_A,_r,DH,D7,Ln,Da],Dr),Li=ke([Le,Lr],(e,t)=>{var n;return null!=(n=e.coordinate)?n:t}),La=ke([DH,Lt],P7),Lo=ke([Ln,Lt,Ok,MK,La,Da,D6],Dc),Ls=ke([Le,Lt],(e,t)=>({isActive:e.active&&null!=t,activeIndex:t})),Ll=ke([(e,t)=>t,_A,Ms,Mm,Dz,DH,D9,_r],(e,t,n,r,i,a,o,s)=>{if(e&&t&&r&&i&&a){if("horizontal"===t||"vertical"===t){if(!e||!r||!i||!a)return;if(function(e,t){var{chartX:n,chartY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}(e,s)){var l=D4("horizontal"===t?e.chartX:"vertical"===t?e.chartY:void 0,o,a,r,i),c=((e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if("horizontal"===e)return{x:i.coordinate,y:r.chartY};if("vertical"===e)return{x:r.chartX,y:i.coordinate}}return{x:0,y:0}})(t,a,l,e);return{activeIndex:String(l),activeCoordinate:c}}return}if(e&&r&&i&&a&&n){var u=((e,t)=>{var n,{chartX:r,chartY:i}=e,{radius:a,angle:o}=((e,t)=>{var{x:n,y:r}=e,{cx:i,cy:a}=t,o=((e,t)=>{var{x:n,y:r}=e,{x:i,y:a}=t;return Math.sqrt((n-i)**2+(r-a)**2)})({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var s=Math.acos((n-i)/o);return r>a&&(s=2*Math.PI-s),{radius:o,angle:180*s/Math.PI,angleInRadian:s}})({x:r,y:i},t),{innerRadius:s,outerRadius:l}=t;if(a<s||a>l||0===a)return null;var{startAngle:c,endAngle:u}=(e=>{var{startAngle:t,endAngle:n}=e,r=Math.min(Math.floor(t/360),Math.floor(n/360));return{startAngle:t-360*r,endAngle:n-360*r}})(t),d=o;if(c<=u){for(;d>u;)d-=360;for(;d<c;)d+=360;n=d>=c&&d<=u}else{for(;d>c;)d-=360;for(;d<u;)d+=360;n=d>=u&&d<=c}return n?OQ(OQ({},t),{},{radius:a,angle:((e,t)=>{var{startAngle:n,endAngle:r}=t;return e+360*Math.min(Math.floor(n/360),Math.floor(r/360))})(d,t)}):null})(e,n);if(u){var d=D4("centric"===t?u.angle:u.radius,o,a,r,i),h=((e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if("centric"===e){var a=i.coordinate,{radius:o}=r;return D3(D3(D3({},r),O0(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,{angle:l}=r;return D3(D3(D3({},r),O0(r.cx,r.cy,s,l)),{},{angle:l,radius:s})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}})(t,a,d,u);return{activeIndex:String(d),activeCoordinate:h}}return}}}),Lc=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},Lu=kf("mouseClick"),Ld=k1();Ld.startListening({actionCreator:Lu,effect:(e,t)=>{var n=e.payload,r=Ll(t.getState(),Lc(n));(null==r?void 0:r.activeIndex)!=null&&t.dispatch(Ch({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var Lh=kf("mouseMove"),Lf=k1(),Lp=null;function Lm(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":"children"===e&&"object"==typeof t&&null!==t?"<<CHILDREN>>":t}function Lg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Lv(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Lg(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lg(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}Lf.startListening({actionCreator:Lh,effect:(e,t)=>{var n=e.payload;null!==Lp&&cancelAnimationFrame(Lp);var r=Lc(n);Lp=requestAnimationFrame(()=>{var e=t.getState();if("axis"===P8(e,e.tooltip.settings.shared)){var n=Ll(e,r);(null==n?void 0:n.activeIndex)!=null?t.dispatch(Cd({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate})):t.dispatch(Cc())}Lp=null})}});var Lx=kk({name:"cartesianAxis",initialState:{xAxis:{},yAxis:{},zAxis:{}},reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:kx()},replaceXAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;void 0!==e.xAxis[n.id]&&(n.id!==r.id&&delete e.xAxis[n.id],e.xAxis[r.id]=r)},prepare:kx()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:kx()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:kx()},replaceYAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;void 0!==e.yAxis[n.id]&&(n.id!==r.id&&delete e.yAxis[n.id],e.yAxis[r.id]=r)},prepare:kx()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:kx()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:kx()},replaceZAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;void 0!==e.zAxis[n.id]&&(n.id!==r.id&&delete e.zAxis[n.id],e.zAxis[r.id]=r)},prepare:kx()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:kx()},updateYAxisWidth(e,t){var{id:n,width:r}=t.payload,i=e.yAxis[n];if(i){var a=i.widthHistory||[];if(3===a.length&&a[0]===a[2]&&r===a[1]&&r!==i.width&&1>=Math.abs(r-a[0]))return;var o=[...a,r].slice(-3);e.yAxis[n]=Lv(Lv({},e.yAxis[n]),{},{width:r,widthHistory:o})}}}}),{addXAxis:Ly,replaceXAxis:Lb,removeXAxis:Lw,addYAxis:Lj,replaceYAxis:LN,removeYAxis:Lk,addZAxis:LE,replaceZAxis:LC,removeZAxis:L_,updateYAxisWidth:LS}=Lx.actions,LT=Lx.reducer,LA=kk({name:"graphicalItems",initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:kx()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NY(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:kx()},removeCartesianGraphicalItem:{reducer(e,t){var n=NY(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:kx()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:kx()},removePolarGraphicalItem:{reducer(e,t){var n=NY(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:kx()}}}),{addCartesianGraphicalItem:LO,replaceCartesianGraphicalItem:LM,removeCartesianGraphicalItem:LP,addPolarGraphicalItem:LD,removePolarGraphicalItem:LL}=LA.actions,LI=LA.reducer,LR=kk({name:"referenceElements",initialState:{dots:[],areas:[],lines:[]},reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=NY(e).dots.findIndex(e=>e===t.payload);-1!==n&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=NY(e).areas.findIndex(e=>e===t.payload);-1!==n&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=NY(e).lines.findIndex(e=>e===t.payload);-1!==n&&e.lines.splice(n,1)}}}),{addDot:LB,removeDot:Lz,addArea:LF,removeArea:LV,addLine:LU,removeLine:LH}=LR.actions,LW=LR.reducer,LY={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},LG=kk({name:"brush",initialState:LY,reducers:{setBrushSettings:(e,t)=>null==t.payload?LY:t.payload}}),{setBrushSettings:L$}=LG.actions,LX=LG.reducer,Lq=kk({name:"legend",initialState:{settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:kx()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NY(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:kx()},removeLegendPayload:{reducer(e,t){var n=NY(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:kx()}}}),{setLegendSize:LK,setLegendSettings:LZ,addLegendPayload:LQ,replaceLegendPayload:LJ,removeLegendPayload:L0}=Lq.actions,L1=Lq.reducer,L2={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},L5=kk({name:"rootProps",initialState:L2,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=null!=(n=t.payload.barGap)?n:L2.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),L3=L5.reducer,{updateOptions:L4}=L5.actions,L6=kk({name:"polarAxis",initialState:{radiusAxis:{},angleAxis:{}},reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:L8,removeRadiusAxis:L7,addAngleAxis:L9,removeAngleAxis:Ie}=L6.actions,It=L6.reducer,In=kk({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(e,t)=>t.payload}}),{updatePolarOptions:Ir}=In.actions,Ii=In.reducer,Ia=kf("keyDown"),Io=kf("focus"),Is=k1();Is.startListening({actionCreator:Ia,effect:(e,t)=>{var n=t.getState();if(!1===n.rootProps.accessibilityLayer)return;var{keyboardInteraction:r}=n.tooltip,i=e.payload;if("ArrowRight"===i||"ArrowLeft"===i||"Enter"===i){var a=Dn(r,Dg(n),MK(n),DL(n)),o=null==a?-1:Number(a);if(Number.isFinite(o)&&!(o<0)){var s=DH(n);if("Enter"===i){var l=Lr(n,"axis","hover",String(r.index));t.dispatch(Cp({active:!r.active,activeIndex:r.index,activeCoordinate:l}));return}var c=o+("ArrowRight"===i?1:-1)*("left-to-right"===P5(n)?1:-1);if(null!=s&&!(c>=s.length)&&!(c<0)){var u=Lr(n,"axis","hover",String(c));t.dispatch(Cp({active:!0,activeIndex:c.toString(),activeCoordinate:u}))}}}}}),Is.startListening({actionCreator:Io,effect:(e,t)=>{var n=t.getState();if(!1!==n.rootProps.accessibilityLayer){var{keyboardInteraction:r}=n.tooltip;if(!r.active&&null==r.index){var i=Lr(n,"axis","hover",String("0"));t.dispatch(Cp({active:!0,activeIndex:"0",activeCoordinate:i}))}}}});var Il=kf("externalEvent"),Ic=k1(),Iu=new Map;Ic.startListening({actionCreator:Il,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(null!=n){r.persist();var i=r.type,a=Iu.get(i);void 0!==a&&cancelAnimationFrame(a);var o=requestAnimationFrame(()=>{try{var e=t.getState(),a={activeCoordinate:DJ(e),activeDataKey:DK(e),activeIndex:DX(e),activeLabel:Dq(e),activeTooltipIndex:DX(e),isTooltipActive:D0(e)};n(a,r)}finally{Iu.delete(i)}});Iu.set(i,o)}}});var Id=ke([Do],e=>e.tooltipItemPayloads),Ih=ke([Id,Da,(e,t)=>t,(e,t,n)=>n],(e,t,n,r)=>{var i=e.find(e=>e.settings.graphicalItemId===r);if(null!=i){var{positions:a}=i;if(null!=a)return t(a,n)}}),If=kf("touchMove"),Ip=k1();Ip.startListening({actionCreator:If,effect:(e,t)=>{var n=e.payload;if(null!=n.touches&&0!==n.touches.length){var r=t.getState(),i=P8(r,r.tooltip.settings.shared);if("axis"===i){var a=n.touches[0];if(null==a)return;var o=Ll(r,Lc({clientX:a.clientX,clientY:a.clientY,currentTarget:n.currentTarget}));(null==o?void 0:o.activeIndex)!=null&&t.dispatch(Cd({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if("item"===i){var s,l=n.touches[0];if(null==document.elementFromPoint||null==l)return;var c=document.elementFromPoint(l.clientX,l.clientY);if(!c||!c.getAttribute)return;var u=c.getAttribute("data-recharts-item-index"),d=null!=(s=c.getAttribute("data-recharts-item-id"))?s:void 0,h=Df(r).find(e=>e.id===d);if(null==u||null==h||null==d)return;var{dataKey:f}=h,p=Ih(r,u,d);t.dispatch(Cs({activeDataKey:f,activeIndex:u,activeCoordinate:p,activeGraphicalItemId:d}))}}}});var Im=kk({name:"errorBars",initialState:{},reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(e=>e.dataKey===r.dataKey&&e.direction===r.direction?i:e))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(e=>e.dataKey!==r.dataKey||e.direction!==r.direction))}}}),{addErrorBar:Ig,replaceErrorBar:Iv,removeErrorBar:Ix}=Im.actions,Iy=Im.reducer,Ib={devToolsEnabled:!0,isSsr:!("u">typeof window&&window.document&&window.document.createElement&&window.setTimeout)};function Iw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ij(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Iw(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Iw(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var IN={zIndexMap:Object.values(O1).reduce((e,t)=>Ij(Ij({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),{})},Ik=new Set(Object.values(O1)),IE=kk({name:"zIndex",initialState:IN,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:kx()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!Ik.has(n)&&delete e.zIndexMap[n])},prepare:kx()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=r:e.zIndexMap[n].element=r:e.zIndexMap[n]={consumers:0,element:i?void 0:r,panoramaElement:i?r:void 0}},prepare:kx()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:kx()}}}),{registerZIndexPortal:IC,unregisterZIndexPortal:I_,registerZIndexPortalElement:IS,unregisterZIndexPortalElement:IT}=IE.actions,IA=ks({brush:LX,cartesianAxis:LT,chartData:Cb,errorBars:Iy,graphicalItems:LI,layout:CC,legend:L1,options:Eh,polarAxis:It,polarOptions:Ii,referenceElements:LW,rootProps:L3,tooltip:Cm,zIndex:IE.reducer}),IO=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Chart";return function(e){let t,n,r,i=function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new kp;return t&&("boolean"==typeof t?a.push(kd):a.push(ku(t.extraArgument))),a},{reducer:a,middleware:o,devTools:s=!0,duplicateMiddlewareCheck:l=!0,preloadedState:c,enhancers:u}=e||{};if("function"==typeof a)t=a;else if(ko(a))t=ks(a);else throw Error(k2(1));n="function"==typeof o?o(i):i();let d=kl;s&&(d=kh({trace:!1,..."object"==typeof s&&s}));let h=(r=function(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(kn(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=kl(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}(...n),function(e){let{autoBatch:t=!0}=e??{},n=new kp(r);return t&&n.push(kb("object"==typeof t?t:void 0)),n});return function e(t,n,r){if("function"!=typeof t)throw Error(kn(2));if("function"==typeof n&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw Error(kn(0));if("function"==typeof n&&void 0===r&&(r=n,n=void 0),void 0!==r){if("function"!=typeof r)throw Error(kn(1));return r(e)(t,n)}let i=t,a=n,o=new Map,s=o,l=0,c=!1;function u(){s===o&&(s=new Map,o.forEach((e,t)=>{s.set(t,e)}))}function d(){if(c)throw Error(kn(3));return a}function h(e){if("function"!=typeof e)throw Error(kn(4));if(c)throw Error(kn(5));let t=!0;u();let n=l++;return s.set(n,e),function(){if(t){if(c)throw Error(kn(6));t=!1,u(),s.delete(n),o=null}}}function f(e){if(!ko(e))throw Error(kn(7));if(void 0===e.type)throw Error(kn(8));if("string"!=typeof e.type)throw Error(kn(17));if(c)throw Error(kn(9));try{c=!0,a=i(a,e)}finally{c=!1}return(o=s).forEach(e=>{e()}),e}return f({type:ka.INIT}),{dispatch:f,subscribe:h,getState:d,replaceReducer:function(e){if("function"!=typeof e)throw Error(kn(10));i=e,f({type:ka.REPLACE})},[kr]:function(){return{subscribe(e){if("object"!=typeof e||null===e)throw Error(kn(11));function t(){e.next&&e.next(d())}return t(),{unsubscribe:h(t)}},[kr](){return this}}}}}(t,c,d(..."function"==typeof u?u(h):h()))}({reducer:IA,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes("es6")}).concat([Ld.middleware,Lf.middleware,Is.middleware,Ic.middleware,Ip.middleware]),enhancers:e=>{var t=e;return"function"==typeof e&&(t=e()),t.concat(kb({type:"raf"}))},devTools:Ib.devToolsEnabled&&{serialize:{replacer:Lm},name:"recharts-".concat(t)}})};function IM(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=_s(),a=(0,em.useRef)(null);return i?n:(null==a.current&&(a.current=IO(t,r)),em.createElement(Ej,{context:CS,store:a.current},n))}var IP=e=>{var{chartData:t}=e,n=CA(),r=_s();return(0,em.useEffect)(()=>r?()=>{}:(n(Cv(t)),()=>{n(Cv(void 0))}),[t,n,r]),null},ID=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function IL(e,t){for(var n of new Set([...Object.keys(e),...Object.keys(t)]))if(ID.has(n)){if(null==e[n]&&null==t[n])continue;if(!function(e,t){if(Ex(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Ex(e[n[r]],t[n[r]]))return!1;return!0}(e[n],t[n]))return!1}else{var r,i;if(r=e[n],i=t[n],(null!=r||null!=i)&&("number"==typeof r&&"number"==typeof i?r!==i&&(r==r||i==i):r!==i))return!1}return!0}var II=(0,em.memo)(function(e){var{layout:t,margin:n}=e,r=CA(),i=_s();return(0,em.useEffect)(()=>{i||(r(CN(t)),r(Cj(n)))},[r,i,t,n]),null},IL);function IR(e){var t=CA();return(0,em.useEffect)(()=>{t(L4(e))},[t,e]),null}var IB=()=>{var e;return null==(e=CD(e=>e.rootProps.accessibilityLayer))||e},Iz=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function IF(e){return"string"==typeof e&&Iz.includes(e)}var IV=new Set(["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"]);function IU(e){return"string"==typeof e&&IV.has(e)}function IH(e){return"string"==typeof e&&e.startsWith("data-")}function IW(e){if("object"!=typeof e||null===e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(IU(n)||IH(n))&&(t[n]=e[n]);return t}function IY(e){return null==e?null:(0,em.isValidElement)(e)&&"object"==typeof e.props&&null!==e.props?IW(e.props):"object"!=typeof e||Array.isArray(e)?null:IW(e)}function IG(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(IU(n)||IH(n)||IF(n))&&(t[n]=e[n]);return t}var I$=["children","width","height","viewBox","className","style","title","desc"];function IX(){return(IX=Object.assign.bind()).apply(null,arguments)}var Iq=(0,em.forwardRef)((e,t)=>{var{children:n,width:r,height:i,viewBox:a,className:o,style:s,title:l,desc:c}=e,u=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,I$),d=a||{width:r,height:i,x:0,y:0},h=(0,_u.clsx)("recharts-surface",o);return em.createElement("svg",IX({},IG(u),{className:h,width:r,height:i,style:s,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height),ref:t}),em.createElement("title",null,l),em.createElement("desc",null,c),n)}),IK=ke(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(null!=t){var r=e[t];if(null!=r)return n?r.panoramaElement:r.element}}),IZ=ke(e=>e.zIndex.zIndexMap,e=>Array.from(new Set(Object.keys(e).map(e=>parseInt(e,10)).concat(Object.values(O1)))).sort((e,t)=>e-t),{memoizeOptions:{resultEqualityCheck:function(e,t){if(e.length===t.length){for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return!1}}});function IQ(e){var{zIndex:t,isPanorama:n}=e,r=(0,em.useRef)(null),i=CA();return(0,em.useLayoutEffect)(()=>(r.current&&i(IS({zIndex:t,element:r.current,isPanorama:n})),()=>{i(IT({zIndex:t,isPanorama:n}))}),[i,t,n]),em.createElement("g",{tabIndex:-1,ref:r})}function IJ(e){var{children:t,isPanorama:n}=e,r=CD(IZ);if(!r||0===r.length)return t;var i=r.filter(e=>e<0),a=r.filter(e=>e>0);return em.createElement(em.Fragment,null,i.map(e=>em.createElement(IQ,{key:e,zIndex:e,isPanorama:n})),t,a.map(e=>em.createElement(IQ,{key:e,zIndex:e,isPanorama:n})))}var I0=["children"];function I1(){return(I1=Object.assign.bind()).apply(null,arguments)}var I2={width:"100%",height:"100%",display:"block"},I5=(0,em.forwardRef)((e,t)=>{var n,r,i=CD(C4),a=CD(C6),o=IB();if(!CY(i)||!CY(a))return null;var{children:s,otherAttributes:l,title:c,desc:u}=e;return null!=l&&(n="number"==typeof l.tabIndex?l.tabIndex:o?0:void 0,r="string"==typeof l.role?l.role:o?"application":void 0),em.createElement(Iq,I1({},l,{title:c,desc:u,role:r,tabIndex:n,width:i,height:a,style:I2,ref:t}),s)}),I3=e=>{var{children:t}=e,n=CD(_c);if(!n)return null;var{width:r,height:i,y:a,x:o}=n;return em.createElement(Iq,{width:r,height:i,x:o,y:a},t)},I4=(0,em.forwardRef)((e,t)=>{var{children:n}=e,r=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,I0);return _s()?em.createElement(I3,null,em.createElement(IJ,{isPanorama:!0},n)):em.createElement(I5,I1({ref:t},r),em.createElement(IJ,{isPanorama:!1},n))}),I6=new(e.i(29942)).default,I8="recharts.syncEvent.tooltip",I7="recharts.syncEvent.brush";function I9(e){return e.tooltip.syncInteraction}var Re=["x","y"];function Rt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Rn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rt(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Rr=(0,em.createContext)(null),Ri=(0,em.createContext)(null);function Ra(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ro(){return(Ro=Object.assign.bind()).apply(null,arguments)}var Rs=()=>{var e,t,n,r,i,a,o,s,l,c,u,d;return e=CA(),(0,em.useEffect)(()=>{e(Ef())},[e]),t=CD(OX),n=CD(OK),r=CA(),i=CD(Oq),a=CD(DH),o=CD(_A),s=__(),l=CD(e=>e.rootProps.className),(0,em.useEffect)(()=>{if(null==t)return Ec;var e=(e,l,c)=>{if(n!==c&&t===e){if("index"===i){if(s&&null!=l&&null!=(u=l.payload)&&u.coordinate&&l.payload.sourceViewBox){var u,d,h=l.payload.coordinate,{x:f,y:p}=h,g=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(h,Re),{x:v,y:x,width:y,height:b}=l.payload.sourceViewBox,w=Rn(Rn({},g),{},{x:s.x+(y?(f-v)/y:0)*s.width,y:s.y+(b?(p-x)/b:0)*s.height});r(Rn(Rn({},l),{},{payload:Rn(Rn({},l.payload),{},{coordinate:w})}))}else r(l);return}if(null!=a){if("function"==typeof i){var j=i(a,{activeTooltipIndex:null==l.payload.index?void 0:Number(l.payload.index),isTooltipActive:l.payload.active,activeIndex:null==l.payload.index?void 0:Number(l.payload.index),activeLabel:l.payload.label,activeDataKey:l.payload.dataKey,activeCoordinate:l.payload.coordinate});d=a[j]}else"value"===i&&(d=a.find(e=>String(e.value)===l.payload.label));var{coordinate:N}=l.payload;if(null==d||!1===l.payload.active||null==N||null==s)return void r(Cf({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));var{x:k,y:E}=N,C=Math.min(k,s.x+s.width),_=Math.min(E,s.y+s.height),S={x:"horizontal"===o?d.coordinate:C,y:"horizontal"===o?_:d.coordinate};r(Cf({active:l.payload.active,coordinate:S,dataKey:l.payload.dataKey,index:String(d.index),label:l.payload.label,sourceViewBox:l.payload.sourceViewBox,graphicalItemId:l.payload.graphicalItemId}))}}};return I6.on(I8,e),()=>{I6.off(I8,e)}},[l,r,n,t,i,a,o,s]),c=CD(OX),u=CD(OK),d=CA(),(0,em.useEffect)(()=>{if(null==c)return Ec;var e=(e,t,n)=>{u!==n&&c===e&&d(Cx(t))};return I6.on(I7,e),()=>{I6.off(I7,e)}},[d,u,c]),null};function Rl(e){if("number"==typeof e)return e;if("string"==typeof e){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var Rc=(0,em.forwardRef)((e,t)=>{var n,r,i=(0,em.useRef)(null),[a,o]=(0,em.useState)({containerWidth:Rl(null==(n=e.style)?void 0:n.width),containerHeight:Rl(null==(r=e.style)?void 0:r.height)}),s=(0,em.useCallback)((e,t)=>{o(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),l=(0,em.useCallback)(e=>{if("function"==typeof t&&t(e),null!=e&&"u">typeof ResizeObserver){var{width:n,height:r}=e.getBoundingClientRect();s(n,r);var a=new ResizeObserver(e=>{var{width:t,height:n}=e[0].contentRect;s(t,n)});a.observe(e),i.current=a}},[t,s]);return(0,em.useEffect)(()=>()=>{var e=i.current;null!=e&&e.disconnect()},[s]),em.createElement(em.Fragment,null,em.createElement(_O,{width:a.containerWidth,height:a.containerHeight}),em.createElement("div",Ro({ref:l},e)))}),Ru=(0,em.forwardRef)((e,t)=>{var{width:n,height:r}=e,[i,a]=(0,em.useState)({containerWidth:Rl(n),containerHeight:Rl(r)}),o=(0,em.useCallback)((e,t)=>{a(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),s=(0,em.useCallback)(e=>{if("function"==typeof t&&t(e),null!=e){var{width:n,height:r}=e.getBoundingClientRect();o(n,r)}},[t,o]);return em.createElement(em.Fragment,null,em.createElement(_O,{width:i.containerWidth,height:i.containerHeight}),em.createElement("div",Ro({ref:s},e)))}),Rd=(0,em.forwardRef)((e,t)=>{var{width:n,height:r}=e;return em.createElement(em.Fragment,null,em.createElement(_O,{width:n,height:r}),em.createElement("div",Ro({ref:t},e)))}),Rh=(0,em.forwardRef)((e,t)=>{var{width:n,height:r}=e;return k7(n)||k7(r)?em.createElement(Ru,Ro({},e,{ref:t})):em.createElement(Rd,Ro({},e,{ref:t}))}),Rf=(0,em.forwardRef)((e,t)=>{var{children:n,className:r,height:i,onClick:a,onContextMenu:o,onDoubleClick:s,onMouseDown:l,onMouseEnter:c,onMouseLeave:u,onMouseMove:d,onMouseUp:h,onTouchEnd:f,onTouchMove:p,onTouchStart:g,style:v,width:x,responsive:y,dispatchTouchEvents:b=!0}=e,w=(0,em.useRef)(null),j=CA(),[N,k]=(0,em.useState)(null),[E,C]=(0,em.useState)(null),_=function(){var e=CA(),[t,n]=(0,em.useState)(null),r=CD(C8);return(0,em.useEffect)(()=>{if(null!=t){var n=t.getBoundingClientRect().width/t.offsetWidth;CW(n)&&n!==r&&e(CE(n))}},[t,e,r]),n}(),S=_N(),T=(null==S?void 0:S.width)>0?S.width:x,A=(null==S?void 0:S.height)>0?S.height:i,O=(0,em.useCallback)(e=>{_(e),"function"==typeof t&&t(e),k(e),C(e),null!=e&&(w.current=e)},[_,t,k,C]),M=(0,em.useCallback)(e=>{j(Lu(e)),j(Il({handler:a,reactEvent:e}))},[j,a]),P=(0,em.useCallback)(e=>{j(Lh(e)),j(Il({handler:c,reactEvent:e}))},[j,c]),D=(0,em.useCallback)(e=>{j(Cc()),j(Il({handler:u,reactEvent:e}))},[j,u]),L=(0,em.useCallback)(e=>{j(Lh(e)),j(Il({handler:d,reactEvent:e}))},[j,d]),I=(0,em.useCallback)(()=>{j(Io())},[j]),R=(0,em.useCallback)(e=>{j(Ia(e.key))},[j]),B=(0,em.useCallback)(e=>{j(Il({handler:o,reactEvent:e}))},[j,o]),z=(0,em.useCallback)(e=>{j(Il({handler:s,reactEvent:e}))},[j,s]),F=(0,em.useCallback)(e=>{j(Il({handler:l,reactEvent:e}))},[j,l]),V=(0,em.useCallback)(e=>{j(Il({handler:h,reactEvent:e}))},[j,h]),U=(0,em.useCallback)(e=>{j(Il({handler:g,reactEvent:e}))},[j,g]),H=(0,em.useCallback)(e=>{b&&j(If(e)),j(Il({handler:p,reactEvent:e}))},[j,b,p]),W=(0,em.useCallback)(e=>{j(Il({handler:f,reactEvent:e}))},[j,f]);return em.createElement(Rr.Provider,{value:N},em.createElement(Ri.Provider,{value:E},em.createElement(!0===y?Rc:Rh,{width:null!=T?T:null==v?void 0:v.width,height:null!=A?A:null==v?void 0:v.height,className:(0,_u.clsx)("recharts-wrapper",r),style:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ra(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ra(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({position:"relative",cursor:"default",width:T,height:A},v),onClick:M,onContextMenu:B,onDoubleClick:z,onFocus:I,onKeyDown:R,onMouseDown:F,onMouseEnter:P,onMouseLeave:D,onMouseMove:L,onMouseUp:V,onTouchEnd:W,onTouchMove:H,onTouchStart:U,ref:O},em.createElement(Rs,null),n)))}),Rp=ke([_r],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),Rm=ke([Rp,C4,C6],(e,t,n)=>{if(e&&null!=t&&null!=n)return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),Rg=(0,em.createContext)(void 0),Rv=e=>{var{children:t}=e,[n]=(0,em.useState)("".concat(En("recharts"),"-clip")),r=CD(Rm);if(null==r)return null;var{x:i,y:a,width:o,height:s}=r;return em.createElement(Rg.Provider,{value:n},em.createElement("defs",null,em.createElement("clipPath",{id:n},em.createElement("rect",{x:i,y:a,height:s,width:o}))),t)},Rx=["width","height","responsive","children","className","style","compact","title","desc"],Ry=(0,em.forwardRef)((e,t)=>{var{width:n,height:r,responsive:i,children:a,className:o,style:s,compact:l,title:c,desc:u}=e,d=IW(function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Rx));return l?em.createElement(em.Fragment,null,em.createElement(_O,{width:n,height:r}),em.createElement(I4,{otherAttributes:d,title:c,desc:u},a)):em.createElement(Rf,{className:o,style:s,width:n,height:r,responsive:null!=i&&i,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},em.createElement(I4,{otherAttributes:d,title:c,desc:u,ref:t},em.createElement(Rv,null,a)))});function Rb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Rw(e,t){var n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rb(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rb(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},e);return Object.keys(t).reduce((e,n)=>(void 0===e[n]&&void 0!==t[n]&&(e[n]=t[n]),e),n)}function Rj(){return(Rj=Object.assign.bind()).apply(null,arguments)}var RN={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:{top:5,right:5,bottom:5,left:5},responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},Rk=(0,em.forwardRef)(function(e,t){var n,r=Rw(e.categoricalChartProps,RN),{chartName:i,defaultTooltipEventType:a,validateTooltipEventTypes:o,tooltipPayloadSearcher:s,categoricalChartProps:l}=e;return em.createElement(IM,{preloadedState:{options:{chartName:i,defaultTooltipEventType:a,validateTooltipEventTypes:o,tooltipPayloadSearcher:s,eventEmitter:void 0}},reduxStoreName:null!=(n=l.id)?n:i},em.createElement(IP,{chartData:l.data}),em.createElement(II,{layout:r.layout,margin:r.margin}),em.createElement(IR,{baseValue:r.baseValue,accessibilityLayer:r.accessibilityLayer,barCategoryGap:r.barCategoryGap,maxBarSize:r.maxBarSize,stackOffset:r.stackOffset,barGap:r.barGap,barSize:r.barSize,syncId:r.syncId,syncMethod:r.syncMethod,className:r.className,reverseStackOrder:r.reverseStackOrder}),em.createElement(Ry,Rj({},r,{ref:t})))}),RE=["axis"],RC=(0,em.forwardRef)((e,t)=>em.createElement(Rk,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:RE,tooltipPayloadSearcher:Eu,categoricalChartProps:e,ref:t})),R_=em;function RS(e){this._context=e}function RT(e){return new RS(e)}RS.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};let RA=Math.PI,RO=2*RA,RM=RO-1e-6;function RP(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}class RD{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?RP:function(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return RP;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e*=1,t*=1,n*=1,r*=1,(i*=1)<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,l=r-t,c=a-e,u=o-t,d=c*c+u*u;if(null===this._x1)this._append`M${this._x1=e},${this._y1=t}`;else if(d>1e-6)if(Math.abs(u*s-l*c)>1e-6&&i){let h=n-a,f=r-o,p=s*s+l*l,g=Math.sqrt(p),v=Math.sqrt(d),x=i*Math.tan((RA-Math.acos((p+d-(h*h+f*f))/(2*g*v)))/2),y=x/v,b=x/g;Math.abs(y-1)>1e-6&&this._append`L${e+y*c},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*h>c*f)},${this._x1=e+b*s},${this._y1=t+b*l}`}else this._append`L${this._x1=e},${this._y1=t}`}arc(e,t,n,r,i,a){if(e*=1,t*=1,n*=1,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),l=e+o,c=t+s,u=1^a,d=a?r-i:i-r;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>1e-6||Math.abs(this._y1-c)>1e-6)&&this._append`L${l},${c}`,n&&(d<0&&(d=d%RO+RO),d>RM?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=l},${this._y1=c}`:d>1e-6&&this._append`A${n},${n},0,${+(d>=RA)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n*=1}v${+r}h${-n}Z`}toString(){return this._}}function RL(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(null==n)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new RD(t)}function RI(e){return e[0]}function RR(e){return e[1]}function RB(e,t){var n=CB(!0),r=null,i=RT,a=null,o=RL(s);function s(s){var l,c,u,d=(s=CR(s)).length,h=!1;for(null==r&&(a=i(u=o())),l=0;l<=d;++l)!(l<d&&n(c=s[l],l,s))===h&&((h=!h)?a.lineStart():a.lineEnd()),h&&a.point(+e(c,l,s),+t(c,l,s));if(u)return a=null,u+""||null}return e="function"==typeof e?e:void 0===e?RI:CB(e),t="function"==typeof t?t:void 0===t?RR:CB(t),s.x=function(t){return arguments.length?(e="function"==typeof t?t:CB(+t),s):e},s.y=function(e){return arguments.length?(t="function"==typeof e?e:CB(+e),s):t},s.defined=function(e){return arguments.length?(n="function"==typeof e?e:CB(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,null!=r&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(null==e?r=a=null:a=i(r=e),s):r},s}function Rz(e,t,n){var r=null,i=CB(!0),a=null,o=RT,s=null,l=RL(c);function c(c){var u,d,h,f,p,g=(c=CR(c)).length,v=!1,x=Array(g),y=Array(g);for(null==a&&(s=o(p=l())),u=0;u<=g;++u){if(!(u<g&&i(f=c[u],u,c))===v)if(v=!v)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),h=u-1;h>=d;--h)s.point(x[h],y[h]);s.lineEnd(),s.areaEnd()}v&&(x[u]=+e(f,u,c),y[u]=+t(f,u,c),s.point(r?+r(f,u,c):x[u],n?+n(f,u,c):y[u]))}if(p)return s=null,p+""||null}function u(){return RB().defined(i).curve(o).context(a)}return e="function"==typeof e?e:void 0===e?RI:CB(+e),t="function"==typeof t?t:void 0===t?CB(0):CB(+t),n="function"==typeof n?n:void 0===n?RR:CB(+n),c.x=function(t){return arguments.length?(e="function"==typeof t?t:CB(+t),r=null,c):e},c.x0=function(t){return arguments.length?(e="function"==typeof t?t:CB(+t),c):e},c.x1=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:CB(+e),c):r},c.y=function(e){return arguments.length?(t="function"==typeof e?e:CB(+e),n=null,c):t},c.y0=function(e){return arguments.length?(t="function"==typeof e?e:CB(+e),c):t},c.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:CB(+e),c):n},c.lineX0=c.lineY0=function(){return u().x(e).y(t)},c.lineY1=function(){return u().x(e).y(n)},c.lineX1=function(){return u().x(r).y(t)},c.defined=function(e){return arguments.length?(i="function"==typeof e?e:CB(!!e),c):i},c.curve=function(e){return arguments.length?(o=e,null!=a&&(s=o(a)),c):o},c.context=function(e){return arguments.length?(null==e?a=s=null:s=o(a=e),c):a},c}function RF(){}function RV(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function RU(e){this._context=e}function RH(e){this._context=e}function RW(e){this._context=e}RD.prototype,RU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:RV(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:RV(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},RH.prototype={areaStart:RF,areaEnd:RF,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:RV(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},RW.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:RV(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};class RY{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}}function RG(e){this._context=e}RG.prototype={areaStart:RF,areaEnd:RF,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e*=1,t*=1,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function R$(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0);return((a<0?-1:1)+(o<0?-1:1))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs((a*i+o*r)/(r+i)))||0}function RX(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Rq(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function RK(e){this._context=e}function RZ(e){this._context=new RQ(e)}function RQ(e){this._context=e}function RJ(e){this._context=e}function R0(e){var t,n,r=e.length-1,i=Array(r),a=Array(r),o=Array(r);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<r-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[r-1]=2,a[r-1]=7,o[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=i[t]/a[t-1],a[t]-=n,o[t]-=n*o[t-1];for(i[r-1]=o[r-1]/a[r-1],t=r-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(t=0,a[r-1]=(e[r]+i[r-1])/2;t<r-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function R1(e,t){this._context=e,this._t=t}RK.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Rq(this,this._t0,RX(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(t*=1,(e*=1)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Rq(this,RX(this,n=R$(this,e,t)),n);break;default:Rq(this,this._t0,n=R$(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(RZ.prototype=Object.create(RK.prototype)).point=function(e,t){RK.prototype.point.call(this,t,e)},RQ.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}},RJ.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),2===n)this._context.lineTo(e[1],t[1]);else for(var r=R0(e),i=R0(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}},R1.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};var R2=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,R5=(e,t)=>{if(!e||"function"==typeof e||"boolean"==typeof e)return null;var n=e;if((0,em.isValidElement)(e)&&(n=e.props),"object"!=typeof n&&"function"!=typeof n)return null;var r={};return Object.keys(n).forEach(e=>{IF(e)&&(r[e]=t||(t=>n[e](n,t)))}),r};function R3(){return(R3=Object.assign.bind()).apply(null,arguments)}function R4(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function R6(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R4(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R4(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var R8={curveBasisClosed:function(e){return new RH(e)},curveBasisOpen:function(e){return new RW(e)},curveBasis:function(e){return new RU(e)},curveBumpX:function(e){return new RY(e,!0)},curveBumpY:function(e){return new RY(e,!1)},curveLinearClosed:function(e){return new RG(e)},curveLinear:RT,curveMonotoneX:function(e){return new RK(e)},curveMonotoneY:function(e){return new RZ(e)},curveNatural:function(e){return new RJ(e)},curveStep:function(e){return new R1(e,.5)},curveStepAfter:function(e){return new R1(e,1)},curveStepBefore:function(e){return new R1(e,0)}},R7=e=>CW(e.x)&&CW(e.y),R9=e=>null!=e.base&&R7(e.base)&&R7(e),Be=e=>e.x,Bt=e=>e.y,Bn=e=>{var{className:t,points:n,path:r,pathRef:i}=e,a=CD(_A);if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},s=n&&n.length?(e=>{var{type:t="linear",points:n=[],baseLine:r,layout:i,connectNulls:a=!1}=e,o=((e,t)=>{if("function"==typeof e)return e;var n="curve".concat(Es(e));return("curveMonotone"===n||"curveBump"===n)&&t?R8["".concat(n).concat("vertical"===t?"Y":"X")]:R8[n]||RT})(t,i),s=a?n.filter(R7):n;if(Array.isArray(r)){var l=n.map((e,t)=>R6(R6({},e),{},{base:r[t]}));return("vertical"===i?Rz().y(Bt).x1(Be).x0(e=>e.base.x):Rz().x(Be).y1(Bt).y0(e=>e.base.y)).defined(R9).curve(o)(a?l.filter(R9):l)}return("vertical"===i&&k9(r)?Rz().y(Bt).x1(Be).x0(r):k9(r)?Rz().x(Be).y1(Bt).y0(r):RB().x(Be).y(Bt)).defined(R7).curve(o)(s)})(o):r;return em.createElement("path",R3({},IW(e),R5(e),{className:(0,_u.clsx)("recharts-curve",t),d:null===s?void 0:s,ref:i}))},Br=["children","className"];function Bi(){return(Bi=Object.assign.bind()).apply(null,arguments)}var Ba=em.forwardRef((e,t)=>{var{children:n,className:r}=e,i=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Br),a=(0,_u.clsx)("recharts-layer",r);return em.createElement("g",Bi({className:a},IG(i),{ref:t}),n)}),Bo=e.i(4178);function Bs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var Bl=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bs(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bs(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},{cacheSize:2e3,enableCache:!0}),Bc=new class{constructor(e){!function(e,t,n){var r;(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"cache",new Map),this.maxSize=e}get(e){var t=this.cache.get(e);return void 0!==t&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;null!=n&&this.cache.delete(n)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}}(Bl.cacheSize),Bu={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},Bd="recharts_measurement_span",Bh=(e,t)=>{try{var n=document.getElementById(Bd);n||((n=document.createElement("span")).setAttribute("id",Bd),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,Bu,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch(e){return{width:0,height:0}}},Bf=function(e){var t,n,r,i,a,o,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e||Ib.isSsr)return{width:0,height:0};if(!Bl.enableCache)return Bh(e,s);var l=(t=s.fontSize||"",n=s.fontFamily||"",r=s.fontWeight||"",i=s.fontStyle||"",a=s.letterSpacing||"",o=s.textTransform||"","".concat(e,"|").concat(t,"|").concat(n,"|").concat(r,"|").concat(i,"|").concat(a,"|").concat(o)),c=Bc.get(l);if(c)return c;var u=Bh(e,s);return Bc.set(l,u),u},Bp=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Bm=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Bg=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,Bv=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Bx={cm:96/2.54,mm:96/25.4,pt:96/72,pc:16,in:96,Q:96/101.6,px:1},By=["cm","mm","pt","pc","in","Q","px"];class Bb{static parse(e){var t,[,n,r]=null!=(t=Bv.exec(e))?t:[];return null==n?Bb.NaN:new Bb(parseFloat(n),null!=r?r:"")}constructor(e,t){this.num=e,this.unit=t,this.num=e,this.unit=t,k8(e)&&(this.unit=""),""===t||Bg.test(t)||(this.num=NaN,this.unit=""),function(e){return By.includes(e)}(t)&&(this.num=function(e,t){return e*Bx[t]}(e,t),this.unit="px")}add(e){return this.unit!==e.unit?new Bb(NaN,""):new Bb(this.num+e.num,this.unit)}subtract(e){return this.unit!==e.unit?new Bb(NaN,""):new Bb(this.num-e.num,this.unit)}multiply(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new Bb(NaN,""):new Bb(this.num*e.num,this.unit||e.unit)}divide(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new Bb(NaN,""):new Bb(this.num/e.num,this.unit||e.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return k8(this.num)}}function Bw(e){if(null==e||e.includes("NaN"))return"NaN";for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,a]=null!=(n=Bp.exec(t))?n:[],o=Bb.parse(null!=r?r:""),s=Bb.parse(null!=a?a:""),l="*"===i?o.multiply(s):o.divide(s);if(l.isNaN())return"NaN";t=t.replace(Bp,l.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var c,[,u,d,h]=null!=(c=Bm.exec(t))?c:[],f=Bb.parse(null!=u?u:""),p=Bb.parse(null!=h?h:""),g="+"===d?f.add(p):f.subtract(p);if(g.isNaN())return"NaN";t=t.replace(Bm,g.toString())}return t}u="NaN",d=new Bb(NaN,""),(u="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(u,"string"))?s:s+"")in Bb?Object.defineProperty(Bb,u,{value:d,enumerable:!0,configurable:!0,writable:!0}):Bb[u]=d;var Bj=/\(([^()]*)\)/;function BN(e){var t=function(e){try{var t;return t=e.replace(/\s+/g,""),t=function(e){for(var t,n=e;null!=(t=Bj.exec(n));){var[,r]=t;n=n.replace(Bj,Bw(r))}return n}(t),t=Bw(t)}catch(e){return"NaN"}}(e.slice(5,-1));return"NaN"===t?"":t}var Bk=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],BE=["dx","dy","angle","className","breakAll"];function BC(){return(BC=Object.assign.bind()).apply(null,arguments)}function B_(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var BS=/[ \f\n\r\t\v\u2028\u2029]+/,BT=e=>{var{children:t,breakAll:n,style:r}=e;try{var i=[];null!=t&&(i=n?t.toString().split(""):t.toString().split(BS));var a=i.map(e=>({word:e,width:Bf(e,r).width})),o=n?0:Bf(" ",r).width;return{wordsWithComputedWidth:a,spaceWidth:o}}catch(e){return null}},BA=(e,t,n,r)=>e.reduce((e,i)=>{var{word:a,width:o}=i,s=e[e.length-1];return s&&null!=o&&(null==t||r||s.width+o+n<Number(t))?(s.words.push(a),s.width+=o+n):e.push({words:[a],width:o}),e},[]),BO=e=>e.reduce((e,t)=>e.width>t.width?e:t),BM=(e,t,n,r,i,a,o,s)=>{var l=BT({breakAll:n,style:r,children:e.slice(0,t)+"…"});if(!l)return[!1,[]];var c=BA(l.wordsWithComputedWidth,a,o,s);return[c.length>i||BO(c).width>Number(a),c]},BP=e=>[{words:null==e?[]:e.toString().split(BS),width:void 0}],BD="#808080",BL={angle:0,breakAll:!1,capHeight:"0.71em",fill:BD,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},BI=(0,em.forwardRef)((e,t)=>{var n,r=Rw(e,BL),{x:i,y:a,lineHeight:o,capHeight:s,fill:l,scaleToFit:c,textAnchor:u,verticalAnchor:d}=r,h=B_(r,Bk),f=(0,em.useMemo)(()=>(e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:o}=e;if((t||n)&&!Ib.isSsr){var s=BT({breakAll:a,children:r,style:i});if(!s)return BP(r);var{wordsWithComputedWidth:l,spaceWidth:c}=s;return((e,t,n,r,i)=>{var a,{maxLines:o,children:s,style:l,breakAll:c}=e,u=k9(o),d=String(s),h=BA(t,r,n,i);if(!u||i||!(h.length>o||BO(h).width>Number(r)))return h;for(var f=0,p=d.length-1,g=0;f<=p&&g<=d.length-1;){var v=Math.floor((f+p)/2),[x,y]=BM(d,v-1,c,l,o,r,n,i),[b]=BM(d,v,c,l,o,r,n,i);if(x||b||(f=v+1),x&&b&&(p=v-1),!x&&b){a=y;break}g++}return a||h})({breakAll:a,children:r,maxLines:o,style:i},l,c,t,!!n)}return BP(r)})({breakAll:h.breakAll,children:h.children,maxLines:h.maxLines,scaleToFit:c,style:h.style,width:h.width}),[h.breakAll,h.children,h.maxLines,c,h.style,h.width]),{dx:p,dy:g,angle:v,className:x,breakAll:y}=h,b=B_(h,BE);if(!Ee(i)||!Ee(a)||0===f.length)return null;var w=Number(i)+(k9(p)?p:0),j=Number(a)+(k9(g)?g:0);if(!CW(w)||!CW(j))return null;switch(d){case"start":n=BN("calc(".concat(s,")"));break;case"middle":n=BN("calc(".concat((f.length-1)/2," * -").concat(o," + (").concat(s," / 2))"));break;default:n=BN("calc(".concat(f.length-1," * -").concat(o,")"))}var N=[];if(c){var k=f[0].width,{width:E}=h;N.push("scale(".concat(k9(E)&&k9(k)?E/k:1,")"))}return v&&N.push("rotate(".concat(v,", ").concat(w,", ").concat(j,")")),N.length&&(b.transform=N.join(" ")),em.createElement("text",BC({},IG(b),{ref:t,x:w,y:j,className:(0,_u.clsx)("recharts-text",x),textAnchor:u,fill:l.includes("url")?BD:l}),f.map((e,t)=>{var r=e.words.join(y?"":" ");return em.createElement("tspan",{x:w,dy:0===t?n:o,key:"".concat(r,"-").concat(t)},r)}))});function BR(e){var{zIndex:t,children:n}=e,r=void 0!==CD(_A)&&void 0!==t&&0!==t,i=_s(),a=CA();(0,em.useLayoutEffect)(()=>r?(a(IC({zIndex:t})),()=>{a(I_({zIndex:t}))}):Ec,[a,t,r]);var o=CD(e=>IK(e,t,i));return r?o?(0,e1.createPortal)(n,o):null:n}BI.displayName="Text";var BB=["labelRef"],Bz=["content"];function BF(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function BV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function BU(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?BV(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):BV(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function BH(){return(BH=Object.assign.bind()).apply(null,arguments)}var BW=(0,em.createContext)(null),BY=e=>{var{x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o,children:s}=e,l=(0,em.useMemo)(()=>({x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o}),[t,n,r,i,a,o]);return em.createElement(BW.Provider,{value:l},s)},BG=()=>{var e=(0,em.useContext)(BW),t=__();return e||_C(t)},B$=(0,em.createContext)(null),BX=e=>null!=e&&"function"==typeof e,Bq=e=>"cx"in e&&k9(e.cx),BK={angle:0,offset:5,zIndex:O1.label,position:"middle",textBreakAll:!1};function BZ(e){var t,n,r,i,a,o,s=Rw(e,BK),{viewBox:l,position:c,value:u,children:d,content:h,className:f="",textBreakAll:p,labelRef:g}=s,v=(t=(0,em.useContext)(B$),n=CD(Ms),t||n),x=BG();if(!(i=null==l?"center"===c?x:null!=v?v:x:Bq(l)?l:_C(l))||null==u&&null==d&&!(0,em.isValidElement)(h)&&"function"!=typeof h)return null;var y=BU(BU({},s),{},{viewBox:i});if((0,em.isValidElement)(h)){var{labelRef:b}=y,w=BF(y,BB);return(0,em.cloneElement)(h,w)}if("function"==typeof h){var{content:j}=y,N=BF(y,Bz);if(a=(0,em.createElement)(h,N),(0,em.isValidElement)(a))return a}else a=(e=>{var{value:t,formatter:n}=e,r=null==e.children?t:e.children;return"function"==typeof n?n(r):r})(s);var k=IG(s);if(Bq(i)){if("insideStart"===c||"insideEnd"===c||"end"===c)return((e,t,n,r,i)=>{var a,o,{offset:s,className:l}=e,{cx:c,cy:u,innerRadius:d,outerRadius:h,startAngle:f,endAngle:p,clockWise:g}=i,v=(d+h)/2,x=k6(p-f)*Math.min(Math.abs(p-f),360),y=x>=0?1:-1;switch(t){case"insideStart":a=f+y*s,o=g;break;case"insideEnd":a=p-y*s,o=!g;break;case"end":a=p+y*s,o=g;break;default:throw Error("Unsupported position ".concat(t))}o=x<=0?o:!o;var b=O0(c,u,v,a),w=O0(c,u,v,a+(o?1:-1)*359),j="M".concat(b.x,",").concat(b.y,"\n A").concat(v,",").concat(v,",0,1,").concat(+!o,",\n ").concat(w.x,",").concat(w.y),N=null==e.id?En("recharts-radial-line-"):e.id;return em.createElement("text",BH({},r,{dominantBaseline:"central",className:(0,_u.clsx)("recharts-radial-bar-label",l)}),em.createElement("defs",null,em.createElement("path",{id:N,d:j})),em.createElement("textPath",{xlinkHref:"#".concat(N)},n))})(s,c,a,k,i);o=((e,t,n)=>{var{cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:s,endAngle:l}=e,c=(s+l)/2;if("outside"===n){var{x:u,y:d}=O0(r,i,o+t,c);return{x:u,y:d,textAnchor:u>=r?"start":"end",verticalAnchor:"middle"}}if("center"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if("centerTop"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if("centerBottom"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var{x:h,y:f}=O0(r,i,(a+o)/2,c);return{x:h,y:f,textAnchor:"middle",verticalAnchor:"middle"}})(i,s.offset,s.position)}else o=((e,t)=>{var n,{parentViewBox:r,offset:i,position:a}=e;null==r||Bq(r)||(n=r);var{x:o,y:s,upperWidth:l,lowerWidth:c,height:u}=t,d=o+(l-c)/2,h=(o+d)/2,f=(l+c)/2,p=u>=0?1:-1,g=p*i,v=p>0?"end":"start",x=p>0?"start":"end",y=l>=0?1:-1,b=y*i,w=y>0?"end":"start",j=y>0?"start":"end";if("top"===a)return BU(BU({},{x:o+l/2,y:s-g,textAnchor:"middle",verticalAnchor:v}),n?{height:Math.max(s-n.y,0),width:l}:{});if("bottom"===a)return BU(BU({},{x:d+c/2,y:s+u+g,textAnchor:"middle",verticalAnchor:x}),n?{height:Math.max(n.y+n.height-(s+u),0),width:c}:{});if("left"===a){var N={x:h-b,y:s+u/2,textAnchor:w,verticalAnchor:"middle"};return BU(BU({},N),n?{width:Math.max(N.x-n.x,0),height:u}:{})}if("right"===a){var k={x:h+f+b,y:s+u/2,textAnchor:j,verticalAnchor:"middle"};return BU(BU({},k),n?{width:Math.max(n.x+n.width-k.x,0),height:u}:{})}var E=n?{width:f,height:u}:{};return"insideLeft"===a?BU({x:h+b,y:s+u/2,textAnchor:j,verticalAnchor:"middle"},E):"insideRight"===a?BU({x:h+f-b,y:s+u/2,textAnchor:w,verticalAnchor:"middle"},E):"insideTop"===a?BU({x:o+l/2,y:s+g,textAnchor:"middle",verticalAnchor:x},E):"insideBottom"===a?BU({x:d+c/2,y:s+u-g,textAnchor:"middle",verticalAnchor:v},E):"insideTopLeft"===a?BU({x:o+b,y:s+g,textAnchor:j,verticalAnchor:x},E):"insideTopRight"===a?BU({x:o+l-b,y:s+g,textAnchor:w,verticalAnchor:x},E):"insideBottomLeft"===a?BU({x:d+b,y:s+u-g,textAnchor:j,verticalAnchor:v},E):"insideBottomRight"===a?BU({x:d+c-b,y:s+u-g,textAnchor:w,verticalAnchor:v},E):a&&"object"==typeof a&&(k9(a.x)||k7(a.x))&&(k9(a.y)||k7(a.y))?BU({x:o+Er(a.x,f),y:s+Er(a.y,u),textAnchor:"end",verticalAnchor:"end"},E):BU({x:o+l/2,y:s+u/2,textAnchor:"middle",verticalAnchor:"middle"},E)})(s,i);return em.createElement(BR,{zIndex:s.zIndex},em.createElement(BI,BH({ref:g,className:(0,_u.clsx)("recharts-label",f)},k,o,{textAnchor:"start"===(r=k.textAnchor)||"middle"===r||"end"===r||"inherit"===r?k.textAnchor:o.textAnchor,breakAll:p}),a))}function BQ(e){var{label:t,labelRef:n}=e;return((e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return!0===e?em.createElement(BZ,BH({key:"label-implicit"},r)):Ee(e)?em.createElement(BZ,BH({key:"label-implicit",value:e},r)):(0,em.isValidElement)(e)?e.type===BZ?(0,em.cloneElement)(e,BU({key:"label-implicit"},r)):em.createElement(BZ,BH({key:"label-implicit",content:e},r)):BX(e)?em.createElement(BZ,BH({key:"label-implicit",content:e},r)):e&&"object"==typeof e?em.createElement(BZ,BH({},e,{key:"label-implicit"},r)):null})(t,BG(),n)||null}BZ.displayName="Label";var BJ=["valueAccessor"],B0=["dataKey","clockWise","id","textBreakAll","zIndex"];function B1(){return(B1=Object.assign.bind()).apply(null,arguments)}function B2(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var B5=e=>Array.isArray(e.value)?(0,Bo.default)(e.value):e.value,B3=(0,em.createContext)(void 0),B4=B3.Provider,B6=(0,em.createContext)(void 0);function B8(e){var{valueAccessor:t=B5}=e,n=B2(e,BJ),{dataKey:r,clockWise:i,id:a,textBreakAll:o,zIndex:s}=n,l=B2(n,B0),c=(0,em.useContext)(B3),u=(0,em.useContext)(B6),d=c||u;return d&&d.length?em.createElement(BR,{zIndex:null!=s?s:O1.label},em.createElement(Ba,{className:"recharts-label-list"},d.map((e,i)=>{var s,c=null==r?t(e,i):CX(e&&e.payload,r),u=null==a?{}:{id:"".concat(a,"-").concat(i)};return em.createElement(BZ,B1({key:"label-".concat(i)},IG(e),l,u,{fill:null!=(s=n.fill)?s:e.fill,parentViewBox:e.parentViewBox,value:c,textBreakAll:o,viewBox:e.viewBox,index:i,zIndex:0}))}))):null}function B7(e){var{label:t}=e;return t?!0===t?em.createElement(B8,{key:"labelList-implicit"}):em.isValidElement(t)||BX(t)?em.createElement(B8,{key:"labelList-implicit",content:t}):"object"==typeof t?em.createElement(B8,B1({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function B9(){return(B9=Object.assign.bind()).apply(null,arguments)}B6.Provider,B8.displayName="LabelList";var ze=e=>{var{cx:t,cy:n,r,className:i}=e,a=(0,_u.clsx)("recharts-dot",i);return k9(t)&&k9(n)&&k9(r)?em.createElement("circle",B9({},IW(e),R5(e),{className:a,cx:t,cy:n,r:r})):null},zt=(e.i(79684),e=>!e||"object"!=typeof e||!("clipDot"in e)||!!e.clipDot),zn=["points"];function zr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zr(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function za(){return(za=Object.assign.bind()).apply(null,arguments)}function zo(e){var{option:t,dotProps:n,className:r}=e;if((0,em.isValidElement)(t))return(0,em.cloneElement)(t,n);if("function"==typeof t)return t(n);var i=(0,_u.clsx)(r,"boolean"!=typeof t?t.className:""),a=null!=n?n:{},{points:o}=a,s=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(a,zn);return em.createElement(ze,za({},s,{className:i}))}function zs(e){var{points:t,dot:n,className:r,dotClassName:i,dataKey:a,baseProps:o,needClip:s,clipPathId:l,zIndex:c=O1.scatter}=e;if(null==t||!n&&1!==t.length)return null;var u=zt(n),d=null==n?null:(0,em.isValidElement)(n)?IG(n.props):"object"!=typeof n||Array.isArray(n)?null:IG(n),h=t.map((e,r)=>{var s,l,c=zi(zi(zi({r:3},o),d),{},{index:r,cx:null!=(s=e.x)?s:void 0,cy:null!=(l=e.y)?l:void 0,dataKey:a,value:e.value,payload:e.payload,points:t});return em.createElement(zo,{key:"dot-".concat(r),option:n,dotProps:c,className:i})}),f={};return s&&null!=l&&(f.clipPath="url(#clipPath-".concat(u?"":"dots-").concat(l,")")),em.createElement(BR,{zIndex:c},em.createElement(Ba,za({className:r},f),h))}function zl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zl(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var zu=e=>{var t,{point:n,childIndex:r,mainColor:i,activeDot:a,dataKey:o,clipPath:s}=e;if(!1===a||null==n.x||null==n.y)return null;var l=zc(zc(zc({},{index:r,dataKey:o,cx:n.x,cy:n.y,r:4,fill:null!=i?i:"none",strokeWidth:2,stroke:"#fff",payload:n.payload,value:n.value}),IY(a)),R5(a));return t=(0,em.isValidElement)(a)?(0,em.cloneElement)(a,l):"function"==typeof a?a(l):em.createElement(ze,l),em.createElement(Ba,{className:"recharts-active-dot",clipPath:s},t)};function zd(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:a,zIndex:o=O1.activeDot}=e,s=CD(DX),l=CD(D2);if(null==t||null==l)return null;var c=t.find(e=>l.includes(e.payload));return null==c?null:em.createElement(BR,{zIndex:o},em.createElement(zu,{point:c,childIndex:Number(s),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}function zh(e){var{tooltipEntrySettings:t}=e,n=CA(),r=_s(),i=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{r||(null===i.current?n(Cr(t)):i.current!==t&&n(Ci({prev:i.current,next:t})),i.current=t)},[t,n,r]),(0,em.useLayoutEffect)(()=>()=>{i.current&&(n(Ca(i.current)),i.current=null)},[n]),null}function zf(e,t){var n,r,i=CD(t=>Mj(t,e)),a=CD(e=>ME(e,t)),o=null!=(n=null==i?void 0:i.allowDataOverflow)?n:Mb.allowDataOverflow,s=null!=(r=null==a?void 0:a.allowDataOverflow)?r:MN.allowDataOverflow;return{needClip:o||s,needClipX:o,needClipY:s}}function zp(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=CD(Rm),{needClipX:a,needClipY:o,needClip:s}=zf(t,n);if(!s||!i)return null;var{x:l,y:c,width:u,height:d}=i;return em.createElement("clipPath",{id:"clipPath-".concat(r)},em.createElement("rect",{x:a?l:l-u/2,y:o?c:c-d/2,width:a?u:2*u,height:o?d:2*d}))}function zm(e,t){var n,r;return null!=(n=null==(r=e.graphicalItems.cartesianItems.find(e=>e.id===t))?void 0:r.xAxisId)?n:0}function zg(e,t){var n,r;return null!=(n=null==(r=e.graphicalItems.cartesianItems.find(e=>e.id===t))?void 0:r.yAxisId)?n:0}var zv=(e,t,n)=>P1(e,"xAxis",zm(e,t),n),zx=(e,t,n)=>P0(e,"xAxis",zm(e,t),n),zy=(e,t,n)=>P1(e,"yAxis",zg(e,t),n),zb=(e,t,n)=>P0(e,"yAxis",zg(e,t),n),zw=ke([_A,zv,zy,zx,zb],(e,t,n,r,i)=>Cq(e,"xAxis")?C2(t,r,!1):C2(n,i,!1)),zj=ke([MM,(e,t)=>t],(e,t)=>e.filter(e=>"area"===e.type).find(e=>e.id===t)),zN=e=>Cq(_A(e),"xAxis")?"yAxis":"xAxis",zk=ke([zj,(e,t,n)=>MJ(e,zN(e),"yAxis"===zN(e)?zg(e,t):zm(e,t),n)],(e,t)=>{if(null!=e&&null!=t){var n,{stackId:r}=e,i=Mu(e);if(null!=r&&null!=i){var a=null==(n=t[r])?void 0:n.stackedData,o=null==a?void 0:a.find(e=>e.key===i);if(null!=o)return o.map(e=>[e[0],e[1]])}}}),zE=ke([_A,zv,zy,zx,zb,zk,(e,t,n)=>n?OE(e):Ok(e),zw,zj,e=>e.rootProps.baseValue],(e,t,n,r,i,a,o,s,l,c)=>{var u,{chartData:d,dataStartIndex:h,dataEndIndex:f}=o;if(null!=l&&("horizontal"===e||"vertical"===e)&&null!=t&&null!=n&&null!=r&&null!=i&&0!==r.length&&0!==i.length&&null!=s){var{data:p}=l;if(null!=(u=p&&p.length>0?p:null==d?void 0:d.slice(h,f+1)))return function(e){var t,{areaSettings:{connectNulls:n,baseValue:r,dataKey:i},stackedData:a,layout:o,chartBaseValue:s,xAxis:l,yAxis:c,displayedData:u,dataStartIndex:d,xAxisTicks:h,yAxisTicks:f,bandSize:p}=e,g=a&&a.length,v=((e,t,n,r,i)=>{var a=null!=n?n:t;if(k9(a))return a;var o="horizontal"===e?i:r,s=o.scale.domain();if("number"===o.type){var l=Math.max(s[0],s[1]),c=Math.min(s[0],s[1]);return"dataMin"===a?c:"dataMax"===a||l<0?l:Math.max(Math.min(s[0],s[1]),0)}return"dataMin"===a?s[0]:"dataMax"===a?s[1]:s[0]})(o,s,r,l,c),x="horizontal"===o,y=!1,b=u.map((e,t)=>{if(g)s=a[d+t];else{var r,o,s,u=CX(e,i);Array.isArray(u)?(s=u,y=!0):s=[v,u]}var b=null!=(r=null==(o=s)?void 0:o[1])?r:null,w=null==b||g&&!n&&null==CX(e,i);return x?{x:CJ({axis:l,ticks:h,bandSize:p,entry:e,index:t}),y:w?null:c.scale(b),value:s,payload:e}:{x:w?null:l.scale(b),y:CJ({axis:c,ticks:f,bandSize:p,entry:e,index:t}),value:s,payload:e}});return t=g||y?b.map(e=>{var t=Array.isArray(e.value)?e.value[0]:null;return x?{x:e.x,y:null!=t&&null!=e.y?c.scale(t):null,payload:e.payload}:{x:null!=t?l.scale(t):null,y:e.y,payload:e.payload}}):x?c.scale(v):l.scale(v),{points:b,baseLine:t,isRange:y}}({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:h,areaSettings:l,stackedData:a,displayedData:u,chartBaseValue:c,bandSize:s})}});function zC(e){var{legendPayload:t}=e,n=CA(),r=_s(),i=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{r||(null===i.current?n(LQ(t)):i.current!==t&&n(LJ({prev:i.current,next:t})),i.current=t)},[n,r,t]),(0,em.useLayoutEffect)(()=>()=>{i.current&&(n(L0(i.current)),i.current=null)},[n]),null}function z_(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"animation-",n=(0,em.useRef)(En(t)),r=(0,em.useRef)(e);return r.current!==e&&(n.current=En(t),r.current=e),n.current}var zS=null!=(Y=em["useId".toString()])?Y:()=>{var[e]=em.useState(()=>En("uid-"));return e},zT=(0,em.createContext)(void 0),zA=e=>{var t,n,{id:r,type:i,children:a}=e,o=(t="recharts-".concat(i),n=zS(),r||(t?"".concat(t,"-").concat(n):n));return em.createElement(zT.Provider,{value:o},a(o))},zO=(0,em.memo)(e=>{var t=CA(),n=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{null===n.current?t(LO(e)):n.current!==e&&t(LM({prev:n.current,next:e})),n.current=e},[t,e]),(0,em.useLayoutEffect)(()=>()=>{n.current&&(t(LP(n.current)),n.current=null)},[t]),null});function zM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zP(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zM(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zM(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var zD=(e,t,n)=>e.map(e=>"".concat(e.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase()))," ").concat(t,"ms ").concat(n)).join(","),zL=(e,t)=>Object.keys(t).reduce((n,r)=>zP(zP({},n),{},{[r]:e(r,t[r])}),{});function zI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zR(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zI(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zI(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var zB=(e,t,n)=>e+(t-e)*n,zz=e=>{var{from:t,to:n}=e;return t!==n},zF=(e,t,n)=>{var r=zL((t,n)=>{if(zz(n)){var[r,i]=e(n.from,n.to,n.velocity);return zR(zR({},n),{},{from:r,velocity:i})}return n},t);return n<1?zL((e,t)=>zz(t)&&null!=r[e]?zR(zR({},t),{},{velocity:zB(t.velocity,r[e].velocity,n),from:zB(t.from,r[e].from,n)}):t,t):zF(e,r,n-1)},zV=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],zU=(e,t)=>e.map((e,n)=>e*t**n).reduce((e,t)=>e+t),zH=(e,t)=>n=>zU(zV(e,t),n),zW=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(1===t.length)switch(t[0]){case"linear":return[0,0,1,1];case"ease":return[.25,.1,.25,1];case"ease-in":return[.42,0,1,1];case"ease-out":return[.42,0,.58,1];case"ease-in-out":return[0,0,.58,1];default:var r=(e=>{var t,n=e.split("(");if(2!==n.length||"cubic-bezier"!==n[0])return null;var r=null==(t=n[1])||null==(t=t.split(")")[0])?void 0:t.split(",");if(null==r||4!==r.length)return null;var i=r.map(e=>parseFloat(e));return[i[0],i[1],i[2],i[3]]})(t[0]);if(r)return r}return 4===t.length?t:[0,0,1,1]},zY=function(){return((e,t,n,r)=>{var i=zH(e,n),a=zH(t,r),o=t=>zU([...zV(e,n).map((e,t)=>e*t).slice(1),0],t),s=e=>e>1?1:e<0?0:e,l=e=>{for(var t=e>1?1:e,n=t,r=0;r<8;++r){var l=i(n)-t,c=o(n);if(1e-4>Math.abs(l-t)||c<1e-4)break;n=s(n-l/c)}return a(n)};return l.isStepper=!1,l})(...zW(...arguments))},zG=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{stiff:t=100,damping:n=8,dt:r=17}=e,i=(e,i,a)=>{var o=a+(-(e-i)*t-a*n)*r/1e3,s=a*r/1e3+e;return 1e-4>Math.abs(s-i)&&1e-4>Math.abs(o)?[i,0]:[s,o]};return i.isStepper=!0,i.dt=r,i};class z${setTimeout(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=performance.now(),r=null,i=a=>{a-n>=t?e(a):"function"==typeof requestAnimationFrame&&(r=requestAnimationFrame(i))};return r=requestAnimationFrame(i),()=>{null!=r&&cancelAnimationFrame(r)}}}var zX=(0,em.createContext)(function(){var e,t,n,r,i;return e=new z$,t=()=>null,n=!1,r=null,i=a=>{if(!n){if(Array.isArray(a)){if(!a.length)return;var[o,...s]=a;if("number"==typeof o){r=e.setTimeout(i.bind(null,s),o);return}i(o),r=e.setTimeout(i.bind(null,s));return}"string"==typeof a&&t(a),"object"==typeof a&&t(a),"function"==typeof a&&a()}},{stop:()=>{n=!0},start:e=>{n=!1,r&&(r(),r=null),i(e)},subscribe:e=>(t=e,()=>{t=()=>null}),getTimeoutController:()=>e}}),zq={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},zK={t:0},zZ={t:1};function zQ(e){var t,n,r,i=Rw(e,zq),{isActive:a,canBegin:o,duration:s,easing:l,begin:c,onAnimationEnd:u,onAnimationStart:d,children:h}=i,f="auto"===a?!Ib.isSsr:a,p=(t=i.animationId,n=i.animationManager,r=(0,em.useContext)(zX),(0,em.useMemo)(()=>null!=n?n:r(t),[t,n,r])),[g,v]=(0,em.useState)(f?zK:zZ),x=(0,em.useRef)(null);return(0,em.useEffect)(()=>{f||v(zZ)},[f]),(0,em.useEffect)(()=>{if(!f||!o)return Ec;var e=((e,t,n,r,i,a)=>{var o,s,l,c,u,d,h,f,p=[Object.keys(e),Object.keys(t)].reduce((e,t)=>e.filter(e=>t.includes(e)));return null==n?()=>(i(zR(zR({},e),t)),()=>{}):!0===n.isStepper?(s=p.reduce((n,r)=>zR(zR({},n),{},{[r]:{from:e[r],velocity:0,to:t[r]}}),{}),l=null,c=r=>{o||(o=r);var u=(r-o)/n.dt;s=zF(n,s,u),i(zR(zR(zR({},e),t),zL((e,t)=>t.from,s))),o=r,Object.values(s).filter(zz).length&&(l=a.setTimeout(c))},()=>(l=a.setTimeout(c),()=>{var e;null==(e=l)||e()})):(d=null,h=p.reduce((n,r)=>{var i=e[r],a=t[r];return null==i||null==a?n:zR(zR({},n),{},{[r]:[i,a]})},{}),f=o=>{u||(u=o);var s=(o-u)/r,l=zL((e,t)=>zB(...t,n(s)),h);if(i(zR(zR(zR({},e),t),l)),s<1)d=a.setTimeout(f);else{var c=zL((e,t)=>zB(...t,n(1)),h);i(zR(zR(zR({},e),t),c))}},()=>(d=a.setTimeout(f),()=>{var e;null==(e=d)||e()}))})(zK,zZ,(e=>{if("string"==typeof e)switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return zY(e);case"spring":return zG();default:if("cubic-bezier"===e.split("(")[0])return zY(e)}return"function"==typeof e?e:null})(l),s,v,p.getTimeoutController());return p.start([d,c,()=>{x.current=e()},s,u]),()=>{p.stop(),x.current&&x.current(),u()}},[f,o,s,l,c,d,u,p]),h(g.t)}function zJ(e){var t=IY(e);if(null!=t){var{r:n,strokeWidth:r}=t,i=Number(n),a=Number(r);return(Number.isNaN(i)||i<0)&&(i=3),(Number.isNaN(a)||a<0)&&(a=2),{r:i,strokeWidth:a}}return{r:3,strokeWidth:2}}var z0=["id"],z1=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function z2(){return(z2=Object.assign.bind()).apply(null,arguments)}function z5(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function z3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function z4(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?z3(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z3(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function z6(e,t){return e&&"none"!==e?e:t}var z8=R_.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:l,tooltipType:c,id:u}=e,d={dataDefinedOnItem:n,positions:void 0,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:C3(o,t),hide:s,type:c,color:z6(r,a),unit:l,graphicalItemId:u}};return R_.createElement(zh,{tooltipEntrySettings:d})});function z7(e){var{clipPathId:t,points:n,props:r}=e,{needClip:i,dot:a,dataKey:o}=r,s=IW(r);return R_.createElement(zs,{points:n,dot:a,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:s,needClip:i,clipPathId:t})}function z9(e){var{showLabels:t,children:n,points:r}=e,i=r.map(e=>{var t,n,r={x:null!=(t=e.x)?t:0,y:null!=(n=e.y)?n:0,width:0,lowerWidth:0,upperWidth:0,height:0};return z4(z4({},r),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:r,fill:void 0})});return R_.createElement(B4,{value:t?i:void 0},n)}function Fe(e){var{points:t,baseLine:n,needClip:r,clipPathId:i,props:a}=e,{layout:o,type:s,stroke:l,connectNulls:c,isRange:u}=a,{id:d}=a,h=z5(a,z0),f=IW(h),p=IG(h);return R_.createElement(R_.Fragment,null,(null==t?void 0:t.length)>1&&R_.createElement(Ba,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},R_.createElement(Bn,z2({},p,{id:d,points:t,connectNulls:c,type:s,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),"none"!==l&&R_.createElement(Bn,z2({},f,{className:"recharts-area-curve",layout:o,type:s,connectNulls:c,fill:"none",points:t})),"none"!==l&&u&&R_.createElement(Bn,z2({},f,{className:"recharts-area-curve",layout:o,type:s,connectNulls:c,fill:"none",points:n}))),R_.createElement(z7,{points:t,props:h,clipPathId:i}))}function Ft(e){var t,n,{alpha:r,baseLine:i,points:a,strokeWidth:o}=e,s=null==(t=a[0])?void 0:t.y,l=null==(n=a[a.length-1])?void 0:n.y;if(!CW(s)||!CW(l))return null;var c=r*Math.abs(s-l),u=Math.max(...a.map(e=>e.x||0));return(k9(i)?u=Math.max(i,u):i&&Array.isArray(i)&&i.length&&(u=Math.max(...i.map(e=>e.x||0),u)),k9(u))?R_.createElement("rect",{x:0,y:s<l?s:s-c,width:u+(o?parseInt("".concat(o),10):1),height:Math.floor(c)}):null}function Fn(e){var t,n,{alpha:r,baseLine:i,points:a,strokeWidth:o}=e,s=null==(t=a[0])?void 0:t.x,l=null==(n=a[a.length-1])?void 0:n.x;if(!CW(s)||!CW(l))return null;var c=r*Math.abs(s-l),u=Math.max(...a.map(e=>e.y||0));return(k9(i)?u=Math.max(i,u):i&&Array.isArray(i)&&i.length&&(u=Math.max(...i.map(e=>e.y||0),u)),k9(u))?R_.createElement("rect",{x:s<l?s:s-c,y:0,width:c,height:Math.floor(u+(o?parseInt("".concat(o),10):1))}):null}function Fr(e){var{alpha:t,layout:n,points:r,baseLine:i,strokeWidth:a}=e;return"vertical"===n?R_.createElement(Ft,{alpha:t,points:r,baseLine:i,strokeWidth:a}):R_.createElement(Fn,{alpha:t,points:r,baseLine:i,strokeWidth:a})}function Fi(e){var{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a}=e,{points:o,baseLine:s,isAnimationActive:l,animationBegin:c,animationDuration:u,animationEasing:d,onAnimationStart:h,onAnimationEnd:f}=r,p=z_((0,R_.useMemo)(()=>({points:o,baseLine:s}),[o,s]),"recharts-area-"),g=(()=>{var e=CD(_A);if("horizontal"===e||"vertical"===e)return e})(),[v,x]=(0,R_.useState)(!1),y=(0,R_.useCallback)(()=>{"function"==typeof f&&f(),x(!1)},[f]),b=(0,R_.useCallback)(()=>{"function"==typeof h&&h(),x(!0)},[h]);if(null==g)return null;var w=i.current,j=a.current;return R_.createElement(z9,{showLabels:!v,points:o},r.children,R_.createElement(zQ,{animationId:p,begin:c,duration:u,isActive:l,easing:d,onAnimationEnd:y,onAnimationStart:b,key:p},e=>{if(w){var c,u=w.length/o.length,d=1===e?o:o.map((t,n)=>{var r=Math.floor(n*u);if(w[r]){var i=w[r];return z4(z4({},t),{},{x:Ea(i.x,t.x,e),y:Ea(i.y,t.y,e)})}return t});if(k9(s))c=Ea(j,s,e);else c=null==s||k8(s)?Ea(j,0,e):s.map((t,n)=>{var r=Math.floor(n*u);if(Array.isArray(j)&&j[r]){var i=j[r];return z4(z4({},t),{},{x:Ea(i.x,t.x,e),y:Ea(i.y,t.y,e)})}return t});return e>0&&(i.current=d,a.current=c),R_.createElement(Fe,{points:d,baseLine:c,needClip:t,clipPathId:n,props:r})}return e>0&&(i.current=o,a.current=s),R_.createElement(Ba,null,l&&R_.createElement("defs",null,R_.createElement("clipPath",{id:"animationClipPath-".concat(n)},R_.createElement(Fr,{alpha:e,points:o,baseLine:s,layout:g,strokeWidth:r.strokeWidth}))),R_.createElement(Ba,{clipPath:"url(#animationClipPath-".concat(n,")")},R_.createElement(Fe,{points:o,baseLine:s,needClip:t,clipPathId:n,props:r})))}),R_.createElement(B7,{label:r.label}))}function Fa(e){var{needClip:t,clipPathId:n,props:r}=e,i=(0,R_.useRef)(null),a=(0,R_.useRef)();return R_.createElement(Fi,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}class Fo extends R_.PureComponent{render(){var{hide:e,dot:t,points:n,className:r,top:i,left:a,needClip:o,xAxisId:s,yAxisId:l,width:c,height:u,id:d,baseLine:h,zIndex:f}=this.props;if(e)return null;var p=(0,_u.clsx)("recharts-area",r),{r:g,strokeWidth:v}=zJ(t),x=zt(t),y=2*g+v,b=o?"url(#clipPath-".concat(x?"":"dots-").concat(d,")"):void 0;return R_.createElement(BR,{zIndex:f},R_.createElement(Ba,{className:p},o&&R_.createElement("defs",null,R_.createElement(zp,{clipPathId:d,xAxisId:s,yAxisId:l}),!x&&R_.createElement("clipPath",{id:"clipPath-dots-".concat(d)},R_.createElement("rect",{x:a-y/2,y:i-y/2,width:c+y,height:u+y}))),R_.createElement(Fa,{needClip:o,clipPathId:d,props:this.props})),R_.createElement(zd,{points:n,mainColor:z6(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:b}),this.props.isRange&&Array.isArray(h)&&R_.createElement(zd,{points:h,mainColor:z6(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:b}))}}var Fs={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:O1.area};function Fl(e){var t,n=Rw(e,Fs),{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:s,dot:l,fill:c,fillOpacity:u,hide:d,isAnimationActive:h,legendType:f,stroke:p,xAxisId:g,yAxisId:v}=n,x=z5(n,z1),y=CD(_A),b=CD(O$),{needClip:w}=zf(g,v),j=_s(),{points:N,isRange:k,baseLine:E}=null!=(t=CD(t=>zE(t,e.id,j)))?t:{},C=CD(Rm);if("horizontal"!==y&&"vertical"!==y||null==C||"AreaChart"!==b&&"ComposedChart"!==b)return null;var{height:_,width:S,x:T,y:A}=C;return N&&N.length?R_.createElement(Fo,z2({},x,{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,baseLine:E,connectNulls:s,dot:l,fill:c,fillOpacity:u,height:_,hide:d,layout:y,isAnimationActive:"auto"===h?!Ib.isSsr:h,isRange:k,legendType:f,needClip:w,points:N,stroke:p,width:S,left:T,top:A,xAxisId:g,yAxisId:v})):null}var Fc=R_.memo(function(e){var t=Rw(e,Fs),n=_s();return R_.createElement(zA,{id:t.id,type:"area"},e=>{var r;return R_.createElement(R_.Fragment,null,R_.createElement(zC,{legendPayload:(e=>{var{dataKey:t,name:n,stroke:r,fill:i,legendType:a,hide:o}=e;return[{inactive:o,dataKey:t,type:a,color:z6(r,i),value:C3(n,t),payload:e}]})(t)}),R_.createElement(z8,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),R_.createElement(zO,{type:"area",id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:null==(r=t.stackId)?void 0:String(r),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),R_.createElement(Fl,z2({},t,{id:e})))})},IL);Fc.displayName="Area";class Fu{static create(e){return new Fu(e)}constructor(e){this.scale=e}get domain(){return this.scale.domain}get range(){return this.scale.range}get rangeMin(){return this.range()[0]}get rangeMax(){return this.range()[1]}get bandwidth(){return this.scale.bandwidth}apply(e){var{bandAware:t,position:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(void 0!==e){if(n)switch(n){case"start":default:return this.scale(e);case"middle":var r=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+r;case"end":var i=this.bandwidth?this.bandwidth():0;return this.scale(e)+i}if(t){var a=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+a}return this.scale(e)}}isInRange(e){var t=this.range(),n=t[0],r=t[t.length-1];return n<=r?e>=n&&e<=r:e>=r&&e<=n}}(h="symbol"==typeof(l=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(h="EPS","string"))?l:l+"")in Fu?Object.defineProperty(Fu,h,{value:1e-4,enumerable:!0,configurable:!0,writable:!0}):Fu[h]=1e-4;var Fd=function(e){var{width:t,height:n}=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(r%180+180)%180*Math.PI/180,a=Math.atan(n/t);return Math.abs(i>a&&i<Math.PI-a?n/Math.sin(i):t/Math.cos(i))};function Fh(e,t){if(t<1)return[];if(1===t)return e;for(var n=[],r=0;r<e.length;r+=t){var i=e[r];void 0!==i&&n.push(i)}return n}function Ff(e,t,n,r,i){if(e*t<e*r||e*t>e*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function Fp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Fm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fp(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fp(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Fg(e,t,n){var r,{tick:i,ticks:a,viewBox:o,minTickGap:s,orientation:l,interval:c,tickFormatter:u,unit:d,angle:h}=e;if(!a||!a.length||!i)return[];if(k9(c)||Ib.isSsr)return null!=(r=Fh(a,(k9(c)?c:0)+1))?r:[];var f="top"===l||"bottom"===l?"width":"height",p=d&&"width"===f?Bf(d,{fontSize:t,letterSpacing:n}):{width:0,height:0},g=(e,r)=>{var i,a="function"==typeof u?u(e.value,r):e.value;return"width"===f?(i=Bf(a,{fontSize:t,letterSpacing:n}),Fd({width:i.width+p.width,height:i.height+p.height},h)):Bf(a,{fontSize:t,letterSpacing:n})[f]},v=a.length>=2?k6(a[1].coordinate-a[0].coordinate):1,x=function(e,t,n){var r="width"===n,{x:i,y:a,width:o,height:s}=e;return 1===t?{start:r?i:a,end:r?i+o:a+s}:{start:r?i+o:a+s,end:r?i:a}}(o,v,f);return"equidistantPreserveStart"===c?function(e,t,n,r,i){for(var a,o=(r||[]).slice(),{start:s,end:l}=t,c=0,u=1,d=s;u<=o.length;)if(a=function(){var t,a=null==r?void 0:r[c];if(void 0===a)return{v:Fh(r,u)};var o=c,h=()=>(void 0===t&&(t=n(a,o)),t),f=a.coordinate,p=0===c||Ff(e,f,h,d,l);p||(c=0,d=s,u+=1),p&&(d=f+e*(h()/2+i),c+=u)}())return a.v;return[]}(v,x,g,a,s):"equidistantPreserveEnd"===c?function(e,t,n,r,i){var a=(r||[]).slice().length;if(0===a)return[];for(var{start:o,end:s}=t,l=1;l<=a;l++){for(var c=(a-1)%l,u=o,d=!0,h=c;h<a&&!function(){var t,a=r[h],o=h,l=()=>(void 0===t&&(t=n(a,o)),t),f=a.coordinate,p=h===c||Ff(e,f,l,u,s);if(!p)return d=!1,1;p&&(u=f+e*(l()/2+i))}();h+=l);if(d){for(var f=[],p=c;p<a;p+=l)f.push(r[p]);return f}}return[]}(v,x,g,a,s):("preserveStart"===c||"preserveStartEnd"===c?function(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,{start:l,end:c}=t;if(a){var u=r[s-1],d=n(u,s-1),h=e*(u.coordinate+e*d/2-c);o[s-1]=u=Fm(Fm({},u),{},{tickCoord:h>0?u.coordinate-h*e:u.coordinate}),null!=u.tickCoord&&Ff(e,u.tickCoord,()=>d,l,c)&&(c=u.tickCoord-e*(d/2+i),o[s-1]=Fm(Fm({},u),{},{isShow:!0}))}for(var f=a?s-1:s,p=function(t){var r,a=o[t],s=()=>(void 0===r&&(r=n(a,t)),r);if(0===t){var u=e*(a.coordinate-e*s()/2-l);o[t]=a=Fm(Fm({},a),{},{tickCoord:u<0?a.coordinate-u*e:a.coordinate})}else o[t]=a=Fm(Fm({},a),{},{tickCoord:a.coordinate});null!=a.tickCoord&&Ff(e,a.tickCoord,s,l,c)&&(l=a.tickCoord+e*(s()/2+i),o[t]=Fm(Fm({},a),{},{isShow:!0}))},g=0;g<f;g++)p(g);return o}(v,x,g,a,s,"preserveStartEnd"===c):function(e,t,n,r,i){for(var a=(r||[]).slice(),o=a.length,{start:s}=t,{end:l}=t,c=function(t){var r,c=a[t],u=()=>(void 0===r&&(r=n(c,t)),r);if(t===o-1){var d=e*(c.coordinate+e*u()/2-l);a[t]=c=Fm(Fm({},c),{},{tickCoord:d>0?c.coordinate-d*e:c.coordinate})}else a[t]=c=Fm(Fm({},c),{},{tickCoord:c.coordinate});null!=c.tickCoord&&Ff(e,c.tickCoord,u,s,l)&&(l=c.tickCoord-e*(u()/2+i),a[t]=Fm(Fm({},c),{},{isShow:!0}))},u=o-1;u>=0;u--)c(u);return a}(v,x,g,a,s)).filter(e=>e.isShow)}var Fv=["axisLine","width","height","className","hide","ticks","axisType"];function Fx(){return(Fx=Object.assign.bind()).apply(null,arguments)}function Fy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Fb(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fy(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fy(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Fw={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:O1.axis};function Fj(e){var{x:t,y:n,width:r,height:i,orientation:a,mirror:o,axisLine:s,otherSvgProps:l}=e;if(!s)return null;var c=Fb(Fb(Fb({},l),IW(s)),{},{fill:"none"});if("top"===a||"bottom"===a){var u=+("top"===a&&!o||"bottom"===a&&o);c=Fb(Fb({},c),{},{x1:t,y1:n+u*i,x2:t+r,y2:n+u*i})}else{var d=+("left"===a&&!o||"right"===a&&o);c=Fb(Fb({},c),{},{x1:t+d*r,y1:n,x2:t+d*r,y2:n+i})}return em.createElement("line",Fx({},c,{className:(0,_u.clsx)("recharts-cartesian-axis-line",(0,k5.default)(s,"className"))}))}function FN(e){var t,{option:n,tickProps:r,value:i}=e,a=(0,_u.clsx)(r.className,"recharts-cartesian-axis-tick-value");if(em.isValidElement(n))t=em.cloneElement(n,Fb(Fb({},r),{},{className:a}));else if("function"==typeof n)t=n(Fb(Fb({},r),{},{className:a}));else{var o="recharts-cartesian-axis-tick-value";"boolean"!=typeof n&&(o=(0,_u.clsx)(o,null==n?void 0:n.className)),t=em.createElement(BI,Fx({},r,{className:o}),i)}return t}var Fk=(0,em.forwardRef)((e,t)=>{var{ticks:n=[],tick:r,tickLine:i,stroke:a,tickFormatter:o,unit:s,padding:l,tickTextProps:c,orientation:u,mirror:d,x:h,y:f,width:p,height:g,tickSize:v,tickMargin:x,fontSize:y,letterSpacing:b,getTicksConfig:w,events:j,axisType:N}=e,k=Fg(Fb(Fb({},w),{},{ticks:n}),y,b),E=function(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}(u,d),C=function(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}(u,d),_=IW(w),S=IY(r),T={};"object"==typeof i&&(T=i);var A=Fb(Fb({},_),{},{fill:"none"},T),O=k.map(e=>Fb({entry:e},function(e,t,n,r,i,a,o,s,l){var c,u,d,h,f,p,g=s?-1:1,v=e.tickSize||o,x=k9(e.tickCoord)?e.tickCoord:e.coordinate;switch(a){case"top":c=u=e.coordinate,p=(d=(h=n+!s*i)-g*v)-g*l,f=x;break;case"left":d=h=e.coordinate,f=(c=(u=t+!s*r)-g*v)-g*l,p=x;break;case"right":d=h=e.coordinate,f=(c=(u=t+s*r)+g*v)+g*l,p=x;break;default:c=u=e.coordinate,p=(d=(h=n+s*i)+g*v)+g*l,f=x}return{line:{x1:c,y1:d,x2:u,y2:h},tick:{x:f,y:p}}}(e,h,f,p,g,u,v,d,x))),M=O.map(e=>{var{entry:t,line:n}=e;return em.createElement(Ba,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(t.value,"-").concat(t.coordinate,"-").concat(t.tickCoord)},i&&em.createElement("line",Fx({},A,n,{className:(0,_u.clsx)("recharts-cartesian-axis-tick-line",(0,k5.default)(i,"className"))})))}),P=O.map((e,t)=>{var{entry:n,tick:i}=e,u=Fb(Fb(Fb(Fb({textAnchor:E,verticalAnchor:C},_),{},{stroke:"none",fill:a},S),i),{},{index:t,payload:n,visibleTicksCount:k.length,tickFormatter:o,padding:l},c);return em.createElement(Ba,Fx({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(n.value,"-").concat(n.coordinate,"-").concat(n.tickCoord)},((e,t,n)=>{if(null===e||"object"!=typeof e&&"function"!=typeof e)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];IF(i)&&"function"==typeof a&&(r||(r={}),r[i]=e=>(a(t,n,e),null))}),r})(j,n,t)),r&&em.createElement(FN,{option:r,tickProps:u,value:"".concat("function"==typeof o?o(n.value,t):n.value).concat(s||"")}))});return em.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(N,"-ticks")},P.length>0&&em.createElement(BR,{zIndex:O1.label},em.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(N,"-tick-labels"),ref:t},P)),M.length>0&&em.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(N,"-tick-lines")},M))}),FE=(0,em.forwardRef)((e,t)=>{var{axisLine:n,width:r,height:i,className:a,hide:o,ticks:s,axisType:l}=e,c=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Fv),[u,d]=(0,em.useState)(""),[h,f]=(0,em.useState)(""),p=(0,em.useRef)(null);(0,em.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>{var t;return(e=>{var{ticks:t,label:n,labelGapWithTick:r=5,tickSize:i=0,tickMargin:a=0}=e,o=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.width>o&&(o=t.width)}});var s=n?n.getBoundingClientRect().width:0;return Math.round(o+(i+a)+s+(n?r:0))}return 0})({ticks:p.current,label:null==(t=e.labelRef)?void 0:t.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var g=(0,em.useCallback)(e=>{if(e){var t=e.getElementsByClassName("recharts-cartesian-axis-tick-value");p.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),i=r.fontSize,a=r.letterSpacing;(i!==u||a!==h)&&(d(i),f(a))}}},[u,h]);return o||null!=r&&r<=0||null!=i&&i<=0?null:em.createElement(BR,{zIndex:e.zIndex},em.createElement(Ba,{className:(0,_u.clsx)("recharts-cartesian-axis",a)},em.createElement(Fj,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:IW(e)}),em.createElement(Fk,{ref:g,axisType:l,events:c,fontSize:u,getTicksConfig:e,height:e.height,letterSpacing:h,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:s,unit:e.unit,width:e.width,x:e.x,y:e.y}),em.createElement(BY,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},em.createElement(BQ,{label:e.label,labelRef:e.labelRef}),e.children)))}),FC=em.forwardRef((e,t)=>{var n=Rw(e,Fw);return em.createElement(FE,Fx({},n,{ref:t}))});FC.displayName="CartesianAxis";var F_=["domain","range"],FS=["domain","range"];function FT(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function FA(e,t){return e===t||!!(Array.isArray(e)&&2===e.length&&Array.isArray(t))&&2===t.length&&e[0]===t[0]&&e[1]===t[1]}function FO(e,t){if(e===t)return!0;var{domain:n,range:r}=e,i=FT(e,F_),{domain:a,range:o}=t,s=FT(t,FS);return!!FA(n,a)&&!!FA(r,o)&&IL(i,s)}var FM=["dangerouslySetInnerHTML","ticks","scale"],FP=["id","scale"];function FD(){return(FD=Object.assign.bind()).apply(null,arguments)}function FL(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function FI(e){var t=CA(),n=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{null===n.current?t(Ly(e)):n.current!==e&&t(Lb({prev:n.current,next:e})),n.current=e},[e,t]),(0,em.useLayoutEffect)(()=>()=>{n.current&&(t(Lw(n.current)),n.current=null)},[t]),null}var FR=e=>{var{xAxisId:t,className:n}=e,r=CD(_a),i=_s(),a="xAxis",o=CD(e=>PJ(e,a,t,i)),s=CD(e=>PU(e,t)),l=CD(e=>PY(e,t)),c=CD(e=>Mw(e,t));if(null==s||null==l||null==c)return null;var{dangerouslySetInnerHTML:u,ticks:d,scale:h}=e,f=FL(e,FM),{id:p,scale:g}=c,v=FL(c,FP);return em.createElement(FC,FD({},f,v,{x:l.x,y:l.y,width:s.width,height:s.height,className:(0,_u.clsx)("recharts-".concat(a," ").concat(a),n),viewBox:r,ticks:o,axisType:a}))},FB={allowDataOverflow:Mb.allowDataOverflow,allowDecimals:Mb.allowDecimals,allowDuplicatedCategory:Mb.allowDuplicatedCategory,angle:Mb.angle,axisLine:Fw.axisLine,height:Mb.height,hide:!1,includeHidden:Mb.includeHidden,interval:Mb.interval,minTickGap:Mb.minTickGap,mirror:Mb.mirror,orientation:Mb.orientation,padding:Mb.padding,reversed:Mb.reversed,scale:Mb.scale,tick:Mb.tick,tickCount:Mb.tickCount,tickLine:Fw.tickLine,tickSize:Fw.tickSize,type:Mb.type,xAxisId:0},Fz=em.memo(e=>{var t=Rw(e,FB);return em.createElement(em.Fragment,null,em.createElement(FI,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit}),em.createElement(FR,t))},FO);Fz.displayName="XAxis";var FF=["dangerouslySetInnerHTML","ticks","scale"],FV=["id","scale"];function FU(){return(FU=Object.assign.bind()).apply(null,arguments)}function FH(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function FW(e){var t=CA(),n=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{null===n.current?t(Lj(e)):n.current!==e&&t(LN({prev:n.current,next:e})),n.current=e},[e,t]),(0,em.useLayoutEffect)(()=>()=>{n.current&&(t(Lk(n.current)),n.current=null)},[t]),null}var FY=e=>{var{yAxisId:t,className:n,width:r,label:i}=e,a=(0,em.useRef)(null),o=(0,em.useRef)(null),s=CD(_a),l=_s(),c=CA(),u="yAxis",d=CD(e=>P$(e,t)),h=CD(e=>PG(e,t)),f=CD(e=>PJ(e,u,t,l)),p=CD(e=>Mk(e,t));if((0,em.useLayoutEffect)(()=>{if(!("auto"!==r||!d||BX(i)||(0,em.isValidElement)(i))&&null!=p){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(d.width)!==Math.round(n)&&c(LS({id:t,width:n}))}}},[f,d,c,i,t,r,p]),null==d||null==h||null==p)return null;var{dangerouslySetInnerHTML:g,ticks:v,scale:x}=e,y=FH(e,FF),{id:b,scale:w}=p,j=FH(p,FV);return em.createElement(FC,FU({},y,j,{ref:a,labelRef:o,x:h.x,y:h.y,tickTextProps:"auto"===r?{width:void 0}:{width:r},width:d.width,height:d.height,className:(0,_u.clsx)("recharts-".concat(u," ").concat(u),n),viewBox:s,ticks:f,axisType:u}))},FG={allowDataOverflow:MN.allowDataOverflow,allowDecimals:MN.allowDecimals,allowDuplicatedCategory:MN.allowDuplicatedCategory,angle:MN.angle,axisLine:Fw.axisLine,hide:!1,includeHidden:MN.includeHidden,interval:MN.interval,minTickGap:MN.minTickGap,mirror:MN.mirror,orientation:MN.orientation,padding:MN.padding,reversed:MN.reversed,scale:MN.scale,tick:MN.tick,tickCount:MN.tickCount,tickLine:Fw.tickLine,tickSize:Fw.tickSize,type:MN.type,width:MN.width,yAxisId:0},F$=em.memo(e=>{var t=Rw(e,FG);return em.createElement(em.Fragment,null,em.createElement(FW,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter}),em.createElement(FY,t))},FO);function FX(){return(FX=Object.assign.bind()).apply(null,arguments)}function Fq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function FK(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fq(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fq(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function FZ(e){return Array.isArray(e)&&Ee(e[0])&&Ee(e[1])?e.join(" ~ "):e}F$.displayName="YAxis";var FQ=e=>{var{separator:t=" : ",contentStyle:n={},itemStyle:r={},labelStyle:i={},payload:a,formatter:o,itemSorter:s,wrapperClassName:l,labelClassName:c,label:u,labelFormatter:d,accessibilityLayer:h=!1}=e,f=FK({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},n),p=FK({margin:0},i),g=null!=u,v=g?u:"",x=(0,_u.clsx)("recharts-default-tooltip",l),y=(0,_u.clsx)("recharts-tooltip-label",c);return g&&d&&null!=a&&(v=d(u,a)),em.createElement("div",FX({className:x,style:f},h?{role:"status","aria-live":"assertive"}:{}),em.createElement("p",{className:y,style:p},em.isValidElement(v)?v:"".concat(v)),(()=>{if(a&&a.length){var e=(s?(0,CL.default)(a,s):a).map((e,n)=>{if("none"===e.type)return null;var i=e.formatter||o||FZ,{value:s,name:l}=e,c=s,u=l,d=i(s,l,e,n,a);if(Array.isArray(d))[c,u]=d;else{if(null==d)return null;c=d}var h=FK({display:"block",paddingTop:4,paddingBottom:4,color:e.color||"#000"},r);return em.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(n),style:h},Ee(u)?em.createElement("span",{className:"recharts-tooltip-item-name"},u):null,Ee(u)?em.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,em.createElement("span",{className:"recharts-tooltip-item-value"},c),em.createElement("span",{className:"recharts-tooltip-item-unit"},e.unit||""))});return em.createElement("ul",{className:"recharts-tooltip-item-list",style:{padding:0,margin:0}},e)}return null})())},FJ=em,F0="recharts-tooltip-wrapper",F1={visibility:"hidden"};function F2(e){var{allowEscapeViewBox:t,coordinate:n,key:r,offsetTopLeft:i,position:a,reverseDirection:o,tooltipDimension:s,viewBox:l,viewBoxDimension:c}=e;if(a&&k9(a[r]))return a[r];var u=n[r]-s-(i>0?i:0),d=n[r]+i;if(t[r])return o[r]?u:d;var h=l[r];return null==h?0:o[r]?u<h?Math.max(d,h):Math.max(u,h):null==c?0:d+s>h+c?Math.max(u,h):Math.max(d,h)}function F5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function F3(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F5(Object(n),!0).forEach(function(t){F4(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F5(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function F4(e,t,n){var r;return(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class F6 extends FJ.PureComponent{constructor(){super(...arguments),F4(this,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}),F4(this,"handleKeyDown",e=>{if("Escape"===e.key){var t,n,r,i;this.setState({dismissed:!0,dismissedAtCoordinate:{x:null!=(t=null==(n=this.props.coordinate)?void 0:n.x)?t:0,y:null!=(r=null==(i=this.props.coordinate)?void 0:i.y)?r:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var e,t;this.state.dismissed&&((null==(e=this.props.coordinate)?void 0:e.x)!==this.state.dismissedAtCoordinate.x||(null==(t=this.props.coordinate)?void 0:t.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:e,allowEscapeViewBox:t,animationDuration:n,animationEasing:r,children:i,coordinate:a,hasPayload:o,isAnimationActive:s,offset:l,position:c,reverseDirection:u,useTranslate3d:d,viewBox:h,wrapperStyle:f,lastBoundingBox:p,innerRef:g,hasPortalFromProps:v}=this.props,{cssClasses:x,cssProperties:y}=function(e){var t,n,r,{allowEscapeViewBox:i,coordinate:a,offsetTopLeft:o,position:s,reverseDirection:l,tooltipBox:c,useTranslate3d:u,viewBox:d}=e;return{cssProperties:t=c.height>0&&c.width>0&&a?function(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}({translateX:n=F2({allowEscapeViewBox:i,coordinate:a,key:"x",offsetTopLeft:o,position:s,reverseDirection:l,tooltipDimension:c.width,viewBox:d,viewBoxDimension:d.width}),translateY:r=F2({allowEscapeViewBox:i,coordinate:a,key:"y",offsetTopLeft:o,position:s,reverseDirection:l,tooltipDimension:c.height,viewBox:d,viewBoxDimension:d.height}),useTranslate3d:u}):F1,cssClasses:function(e){var{coordinate:t,translateX:n,translateY:r}=e;return(0,_u.clsx)(F0,{["".concat(F0,"-right")]:k9(n)&&t&&k9(t.x)&&n>=t.x,["".concat(F0,"-left")]:k9(n)&&t&&k9(t.x)&&n<t.x,["".concat(F0,"-bottom")]:k9(r)&&t&&k9(t.y)&&r>=t.y,["".concat(F0,"-top")]:k9(r)&&t&&k9(t.y)&&r<t.y})}({translateX:n,translateY:r,coordinate:a})}}({allowEscapeViewBox:t,coordinate:a,offsetTopLeft:l,position:c,reverseDirection:u,tooltipBox:{height:p.height,width:p.width},useTranslate3d:d,viewBox:h}),b=v?{}:F3(F3({transition:s&&e?"transform ".concat(n,"ms ").concat(r):void 0},y),{},{pointerEvents:"none",visibility:!this.state.dismissed&&e&&o?"visible":"hidden",position:"absolute",top:0,left:0}),w=F3(F3({},b),{},{visibility:!this.state.dismissed&&e&&o?"visible":"hidden"},f);return FJ.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:x,style:w,ref:g},i)}}var F8=e.i(92809),F7=["x","y","top","left","width","height","className"];function F9(){return(F9=Object.assign.bind()).apply(null,arguments)}function Ve(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var Vt=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:a=0,height:o=0,className:s}=e,l=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ve(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ve(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({x:t,y:n,top:r,left:i,width:a,height:o},function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,F7));return k9(t)&&k9(n)&&k9(a)&&k9(o)&&k9(r)&&k9(i)?em.createElement("path",F9({},IG(l),{className:(0,_u.clsx)("recharts-cross",s),d:"M".concat(t,",").concat(r,"v").concat(o,"M").concat(i,",").concat(n,"h").concat(a)})):null},Vn=["radius"],Vr=["radius"];function Vi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Va(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vi(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vo(){return(Vo=Object.assign.bind()).apply(null,arguments)}function Vs(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Vl(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Vc=(e,t,n,r,i)=>{var a,o=k3(n),s=k3(r),l=Math.min(Math.abs(o)/2,Math.abs(s)/2),c=s>=0?1:-1,u=o>=0?1:-1,d=+(s>=0&&o>=0||s<0&&o<0);if(l>0&&i instanceof Array){for(var h=[0,0,0,0],f=0;f<4;f++)h[f]=i[f]>l?l:i[f];a=k4(G||(G=Vl(["M",",",""])),e,t+c*h[0]),h[0]>0&&(a+=k4($||($=Vl(["A ",",",",0,0,",",",",",""])),h[0],h[0],d,e+u*h[0],t)),a+=k4(X||(X=Vl(["L ",",",""])),e+n-u*h[1],t),h[1]>0&&(a+=k4(q||(q=Vl(["A ",",",",0,0,",",\n ",",",""])),h[1],h[1],d,e+n,t+c*h[1])),a+=k4(K||(K=Vl(["L ",",",""])),e+n,t+r-c*h[2]),h[2]>0&&(a+=k4(Z||(Z=Vl(["A ",",",",0,0,",",\n ",",",""])),h[2],h[2],d,e+n-u*h[2],t+r)),a+=k4(Q||(Q=Vl(["L ",",",""])),e+u*h[3],t+r),h[3]>0&&(a+=k4(J||(J=Vl(["A ",",",",0,0,",",\n ",",",""])),h[3],h[3],d,e,t+r-c*h[3])),a+="Z"}else if(l>0&&i===+i&&i>0){var p=Math.min(l,i);a=k4(ee||(ee=Vl(["M ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",","," Z"])),e,t+c*p,p,p,d,e+u*p,t,e+n-u*p,t,p,p,d,e+n,t+c*p,e+n,t+r-c*p,p,p,d,e+n-u*p,t+r,e+u*p,t+r,p,p,d,e,t+r-c*p)}else a=k4(et||(et=Vl(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return a},Vu={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Vd=e=>{var t=Rw(e,Vu),n=(0,em.useRef)(null),[r,i]=(0,em.useState)(-1);(0,em.useEffect)(()=>{if(n.current&&n.current.getTotalLength)try{var e=n.current.getTotalLength();e&&i(e)}catch(e){}},[]);var{x:a,y:o,width:s,height:l,radius:c,className:u}=t,{animationEasing:d,animationDuration:h,animationBegin:f,isAnimationActive:p,isUpdateAnimationActive:g}=t,v=(0,em.useRef)(s),x=(0,em.useRef)(l),y=(0,em.useRef)(a),b=(0,em.useRef)(o),w=z_((0,em.useMemo)(()=>({x:a,y:o,width:s,height:l,radius:c}),[a,o,s,l,c]),"rectangle-");if(a!==+a||o!==+o||s!==+s||l!==+l||0===s||0===l)return null;var j=(0,_u.clsx)("recharts-rectangle",u);if(!g){var N=IG(t),{radius:k}=N,E=Vs(N,Vn);return em.createElement("path",Vo({},E,{x:k3(a),y:k3(o),width:k3(s),height:k3(l),radius:"number"==typeof c?c:void 0,className:j,d:Vc(a,o,s,l,c)}))}var C=v.current,_=x.current,S=y.current,T=b.current,A="0px ".concat(-1===r?1:r,"px"),O="".concat(r,"px 0px"),M=zD(["strokeDasharray"],h,"string"==typeof d?d:Vu.animationEasing);return em.createElement(zQ,{animationId:w,key:w,canBegin:r>0,duration:h,easing:d,isActive:g,begin:f},e=>{var r,i=Ea(C,s,e),u=Ea(_,l,e),d=Ea(S,a,e),h=Ea(T,o,e);n.current&&(v.current=i,x.current=u,y.current=d,b.current=h),r=p?e>0?{transition:M,strokeDasharray:O}:{strokeDasharray:A}:{strokeDasharray:O};var f=IG(t),{radius:g}=f,w=Vs(f,Vr);return em.createElement("path",Vo({},w,{radius:"number"==typeof c?c:void 0,className:j,d:Vc(d,h,i,u,c),ref:n,style:Va(Va({},r),t.style)}))})};function Vh(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:a}=e;return{points:[O0(t,n,r,i),O0(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}function Vf(){return(Vf=Object.assign.bind()).apply(null,arguments)}function Vp(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Vm=e=>{var{cx:t,cy:n,radius:r,angle:i,sign:a,isExternal:o,cornerRadius:s,cornerIsExternal:l}=e,c=s*(o?1:-1)+r,u=Math.asin(s/c)/OJ,d=l?i:i+a*u,h=O0(t,n,c,d);return{center:h,circleTangency:O0(t,n,r,d),lineTangency:O0(t,n,c*Math.cos(u*OJ),l?i-a*u:i),theta:u}},Vg=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:a,endAngle:o}=e,s=k6(o-a)*Math.min(Math.abs(o-a),359.999),l=a+s,c=O0(t,n,i,a),u=O0(t,n,i,l),d=k4(en||(en=Vp(["M ",",","\n A ",",",",0,\n ",",",",\n ",",","\n "])),c.x,c.y,i,i,+(Math.abs(s)>180),+(a>l),u.x,u.y);if(r>0){var h=O0(t,n,r,a),f=O0(t,n,r,l);d+=k4(er||(er=Vp(["L ",",","\n A ",",",",0,\n ",",",",\n ",","," Z"])),f.x,f.y,r,r,+(Math.abs(s)>180),+(a<=l),h.x,h.y)}else d+=k4(ei||(ei=Vp(["L ",","," Z"])),t,n);return d},Vv={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Vx=e=>{var t,n=Rw(e,Vv),{cx:r,cy:i,innerRadius:a,outerRadius:o,cornerRadius:s,forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d,className:h}=n;if(o<a||u===d)return null;var f=(0,_u.clsx)("recharts-sector",h),p=o-a,g=Er(s,p,0,!0);return t=g>0&&360>Math.abs(u-d)?(e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:a,forceCornerRadius:o,cornerIsExternal:s,startAngle:l,endAngle:c}=e,u=k6(c-l),{circleTangency:d,lineTangency:h,theta:f}=Vm({cx:t,cy:n,radius:i,angle:l,sign:u,cornerRadius:a,cornerIsExternal:s}),{circleTangency:p,lineTangency:g,theta:v}=Vm({cx:t,cy:n,radius:i,angle:c,sign:-u,cornerRadius:a,cornerIsExternal:s}),x=s?Math.abs(l-c):Math.abs(l-c)-f-v;if(x<0)return o?k4(ea||(ea=Vp(["M ",",","\n a",",",",0,0,1,",",0\n a",",",",0,0,1,",",0\n "])),h.x,h.y,a,a,2*a,a,a,-(2*a)):Vg({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:l,endAngle:c});var y=k4(eo||(eo=Vp(["M ",",","\n A",",",",0,0,",",",",","\n A",",",",0,",",",",",",","\n A",",",",0,0,",",",",","\n "])),h.x,h.y,a,a,+(u<0),d.x,d.y,i,i,+(x>180),+(u<0),p.x,p.y,a,a,+(u<0),g.x,g.y);if(r>0){var{circleTangency:b,lineTangency:w,theta:j}=Vm({cx:t,cy:n,radius:r,angle:l,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),{circleTangency:N,lineTangency:k,theta:E}=Vm({cx:t,cy:n,radius:r,angle:c,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),C=s?Math.abs(l-c):Math.abs(l-c)-j-E;if(C<0&&0===a)return"".concat(y,"L").concat(t,",").concat(n,"Z");y+=k4(es||(es=Vp(["L",",","\n A",",",",0,0,",",",",","\n A",",",",0,",",",",",",","\n A",",",",0,0,",",",",","Z"])),k.x,k.y,a,a,+(u<0),N.x,N.y,r,r,+(C>180),+(u>0),b.x,b.y,a,a,+(u<0),w.x,w.y)}else y+=k4(el||(el=Vp(["L",",","Z"])),t,n);return y})({cx:r,cy:i,innerRadius:a,outerRadius:o,cornerRadius:Math.min(g,p/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):Vg({cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:u,endAngle:d}),em.createElement("path",Vf({},IG(n),{className:f,d:t}))};function Vy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Vb(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vy(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vy(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vw(){return(Vw=Object.assign.bind()).apply(null,arguments)}function Vj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function VN(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vj(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vj(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vk(e){var{cursor:t,cursorComp:n,cursorProps:r}=e;return(0,em.isValidElement)(t)?(0,em.cloneElement)(t,r):(0,em.createElement)(n,r)}function VE(e){var t,n,r,i,a,{coordinate:o,payload:s,index:l,offset:c,tooltipAxisBandSize:u,layout:d,cursor:h,tooltipEventType:f,chartName:p}=e;if(!h||!o||"ScatterChart"!==p&&"axis"!==f)return null;if("ScatterChart"===p)r=o,i=Vt,a=O1.cursorLine;else if("BarChart"===p)t=u/2,r={stroke:"none",fill:"#ccc",x:"horizontal"===d?o.x-t:c.left+.5,y:"horizontal"===d?c.top+.5:o.y-t,width:"horizontal"===d?u:c.width-1,height:"horizontal"===d?c.height-1:u},i=Vd,a=O1.cursorRectangle;else if("radial"===d&&R2(o)){var{cx:g,cy:v,radius:x,startAngle:y,endAngle:b}=Vh(o);r={cx:g,cy:v,startAngle:y,endAngle:b,innerRadius:x,outerRadius:x},i=Vx,a=O1.cursorLine}else r={points:function(e,t,n){if("horizontal"===e)return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if("vertical"===e)return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(R2(t)){if("centric"===e){var{cx:r,cy:i,innerRadius:a,outerRadius:o,angle:s}=t,l=O0(r,i,a,s),c=O0(r,i,o,s);return[{x:l.x,y:l.y},{x:c.x,y:c.y}]}return Vh(t)}}(d,o,c)},i=Bn,a=O1.cursorLine;var w="object"==typeof h&&"className"in h?h.className:void 0,j=VN(VN(VN(VN({stroke:"#ccc",pointerEvents:"none"},c),r),IY(h)),{},{payload:s,payloadIndex:l,className:(0,_u.clsx)("recharts-tooltip-cursor",w)});return em.createElement(BR,{zIndex:null!=(n=e.zIndex)?n:a},em.createElement(Vk,{cursor:h,cursorComp:i,cursorProps:j}))}function VC(e){var t,n,r,i=(t=CD(Mq),n=CD(DH),r=CD(DF),t&&r?C2(Vb(Vb({},t),{},{scale:r}),n):C2(void 0,n)),a=_T(),o=CD(_A),s=CD(O$);return null==i||null==a||null==o||null==s?null:em.createElement(VE,Vw({},e,{offset:a,layout:o,tooltipAxisBandSize:i,chartName:s}))}function V_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function VS(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V_(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function VT(e){return e.dataKey}var VA=[],VO={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function VM(e){var t,n,r,i,a,o,s,l,c,u,d,h=Rw(e,VO),{active:f,allowEscapeViewBox:p,animationDuration:g,animationEasing:v,content:x,filterNull:y,isAnimationActive:b,offset:w,payloadUniqBy:j,position:N,reverseDirection:k,useTranslate3d:E,wrapperStyle:C,cursor:_,shared:S,trigger:T,defaultIndex:A,portal:O,axisId:M}=h,P=CA(),D="number"==typeof A?String(A):A;(0,em.useEffect)(()=>{P(Co({shared:S,trigger:T,axisId:M,active:f,defaultIndex:D}))},[P,S,T,M,f,D]);var L=__(),I=IB(),R=CD(e=>P8(e,S)),{activeIndex:B,isActive:z}=null!=(u=CD(e=>Ls(e,R,T,D)))?u:{},F=CD(e=>Lo(e,R,T,D)),V=CD(e=>La(e,R,T,D)),U=CD(e=>Li(e,R,T,D)),H=(0,em.useContext)(Rr),W=null!=(d=null!=f?f:z)&&d,[Y,G]=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],[t,n]=(0,em.useState)({height:0,left:0,top:0,width:0}),r=(0,em.useCallback)(e=>{if(null!=e){var r=e.getBoundingClientRect(),i={height:r.height,left:r.left,top:r.top,width:r.width};(Math.abs(i.height-t.height)>1||Math.abs(i.left-t.left)>1||Math.abs(i.top-t.top)>1||Math.abs(i.width-t.width)>1)&&n({height:i.height,left:i.left,top:i.top,width:i.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,r]}([F,W]),$="axis"===R?V:void 0;t=CD(e=>((e,t,n)=>{if(null!=t){var r=Do(e);return"axis"===t?"hover"===n?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:"hover"===n?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}})(e,R,T)),n=CD(OK),r=CD(OX),i=CD(Oq),o=null==(a=CD(I9))?void 0:a.active,s=__(),(0,em.useEffect)(()=>{if(!o&&null!=r&&null!=n){var e=Cf({active:W,coordinate:U,dataKey:t,index:B,label:"number"==typeof $?String($):$,sourceViewBox:s,graphicalItemId:void 0});I6.emit(I8,r,e,n)}},[o,U,t,B,$,n,r,i,W,s]);var X=null!=O?O:H;if(null==X||null==L||null==R)return null;var q=null!=F?F:VA;W||(q=VA),y&&q.length&&(l=q.filter(e=>null!=e.value&&(!0!==e.hide||h.includeHidden)),q=!0===j?(0,F8.default)(l,VT):"function"==typeof j?(0,F8.default)(l,j):l);var K=q.length>0,Z=em.createElement(F6,{allowEscapeViewBox:p,animationDuration:g,animationEasing:v,isAnimationActive:b,active:W,coordinate:U,hasPayload:K,offset:w,position:N,reverseDirection:k,useTranslate3d:E,viewBox:L,wrapperStyle:C,lastBoundingBox:Y,innerRef:G,hasPortalFromProps:!!O},(c=VS(VS({},h),{},{payload:q,label:$,active:W,activeIndex:B,coordinate:U,accessibilityLayer:I}),em.isValidElement(x)?em.cloneElement(x,c):"function"==typeof x?em.createElement(x,c):em.createElement(FQ,c)));return em.createElement(em.Fragment,null,(0,e1.createPortal)(Z,X),W&&em.createElement(VC,{cursor:_,tooltipEventType:R,coordinate:U,payload:q,index:B}))}var VP=["x1","y1","x2","y2","key"],VD=["offset"],VL=["xAxisId","yAxisId"],VI=["xAxisId","yAxisId"];function VR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function VB(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?VR(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VR(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vz(){return(Vz=Object.assign.bind()).apply(null,arguments)}function VF(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var VV=e=>{var{fill:t}=e;if(!t||"none"===t)return null;var{fillOpacity:n,x:r,y:i,width:a,height:o,ry:s}=e;return em.createElement("rect",{x:r,y:i,ry:s,width:a,height:o,stroke:"none",fill:t,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function VU(e){var{option:t,lineItemProps:n}=e;if(em.isValidElement(t))r=em.cloneElement(t,n);else if("function"==typeof t)r=t(n);else{var r,i,{x1:a,y1:o,x2:s,y2:l,key:c}=n,u=null!=(i=IW(VF(n,VP)))?i:{},{offset:d}=u,h=VF(u,VD);r=em.createElement("line",Vz({},h,{x1:a,y1:o,x2:s,y2:l,fill:"none",key:c}))}return r}function VH(e){var{x:t,width:n,horizontal:r=!0,horizontalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=VF(e,VL),l=i.map((e,i)=>{var a=VB(VB({},s),{},{x1:t,y1:e,x2:t+n,y2:e,key:"line-".concat(i),index:i});return em.createElement(VU,{key:"line-".concat(i),option:r,lineItemProps:a})});return em.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function VW(e){var{y:t,height:n,vertical:r=!0,verticalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=VF(e,VI),l=i.map((e,i)=>{var a=VB(VB({},s),{},{x1:e,y1:t,x2:e,y2:t+n,key:"line-".concat(i),index:i});return em.createElement(VU,{option:r,lineItemProps:a,key:"line-".concat(i)})});return em.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function VY(e){var{horizontalFill:t,fillOpacity:n,x:r,y:i,width:a,height:o,horizontalPoints:s,horizontal:l=!0}=e;if(!l||!t||!t.length||null==s)return null;var c=s.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==c[0]&&c.unshift(0);var u=c.map((e,s)=>{var l=c[s+1]?c[s+1]-e:i+o-e;if(l<=0)return null;var u=s%t.length;return em.createElement("rect",{key:"react-".concat(s),y:e,x:r,height:l,width:a,stroke:"none",fill:t[u],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return em.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},u)}function VG(e){var{vertical:t=!0,verticalFill:n,fillOpacity:r,x:i,y:a,width:o,height:s,verticalPoints:l}=e;if(!t||!n||!n.length)return null;var c=l.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==c[0]&&c.unshift(0);var u=c.map((e,t)=>{var l=c[t+1]?c[t+1]-e:i+o-e;if(l<=0)return null;var u=t%n.length;return em.createElement("rect",{key:"react-".concat(t),x:e,y:a,width:l,height:s,stroke:"none",fill:n[u],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return em.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},u)}var V$=(e,t)=>{var{xAxis:n,width:r,height:i,offset:a}=e;return CK(Fg(VB(VB(VB({},Fw),n),{},{ticks:CZ(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},VX=(e,t)=>{var{yAxis:n,width:r,height:i,offset:a}=e;return CK(Fg(VB(VB(VB({},Fw),n),{},{ticks:CZ(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},Vq={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:O1.grid};function VK(e){var t=CD(C4),n=CD(C6),r=_T(),i=VB(VB({},Rw(e,Vq)),{},{x:k9(e.x)?e.x:r.left,y:k9(e.y)?e.y:r.top,width:k9(e.width)?e.width:r.width,height:k9(e.height)?e.height:r.height}),{xAxisId:a,yAxisId:o,x:s,y:l,width:c,height:u,syncWithTicks:d,horizontalValues:h,verticalValues:f}=i,p=_s(),g=CD(e=>PQ(e,"xAxis",a,p)),v=CD(e=>PQ(e,"yAxis",o,p));if(!CY(c)||!CY(u)||!k9(s)||!k9(l))return null;var x=i.verticalCoordinatesGenerator||V$,y=i.horizontalCoordinatesGenerator||VX,{horizontalPoints:b,verticalPoints:w}=i;if((!b||!b.length)&&"function"==typeof y){var j=h&&h.length,N=y({yAxis:v?VB(VB({},v),{},{ticks:j?h:v.ticks}):void 0,width:null!=t?t:c,height:null!=n?n:u,offset:r},!!j||d);_h(Array.isArray(N),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof N,"]")),Array.isArray(N)&&(b=N)}if((!w||!w.length)&&"function"==typeof x){var k=f&&f.length,E=x({xAxis:g?VB(VB({},g),{},{ticks:k?f:g.ticks}):void 0,width:null!=t?t:c,height:null!=n?n:u,offset:r},!!k||d);_h(Array.isArray(E),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof E,"]")),Array.isArray(E)&&(w=E)}return em.createElement(BR,{zIndex:i.zIndex},em.createElement("g",{className:"recharts-cartesian-grid"},em.createElement(VV,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),em.createElement(VY,Vz({},i,{horizontalPoints:b})),em.createElement(VG,Vz({},i,{verticalPoints:w})),em.createElement(VH,Vz({},i,{offset:r,horizontalPoints:b,xAxis:g,yAxis:v})),em.createElement(VW,Vz({},i,{offset:r,verticalPoints:w,xAxis:g,yAxis:v}))))}VK.displayName="CartesianGrid";let VZ=["1h","12h","1d","7d","30d","90d"],VQ={created_at:{short:"Ingested",long:"When records were ingested"},mentioned_at:{short:"Mentioned",long:"When facts were mentioned (event time)"},occurred_start:{short:"Occurred",long:"When the underlying event started"}},VJ=["created_at","mentioned_at","occurred_start"],V0="#8b5cf6",V1="#ec4899",V2="#6366f1",V5="var(--chart-5)",V3="var(--muted-foreground)",V4={world:{label:"World",color:V0},experience:{label:"Experience",color:V1},observation:{label:"Observations",color:V2}};function V6(e){if(e<1e3)return e.toString();if(e<1e6){let t=e/1e3;return`${t>=10?t.toFixed(0):t.toFixed(1).replace(/\.0$/,"")}k`}if(e<1e9){let t=e/1e6;return`${t>=10?t.toFixed(0):t.toFixed(1).replace(/\.0$/,"")}M`}let t=e/1e9;return`${t>=10?t.toFixed(0):t.toFixed(1).replace(/\.0$/,"")}B`}function V8({value:e,className:t}){return(0,ep.jsx)("span",{className:t,title:e.toLocaleString(),children:V6(e)})}function V7({active:e,payload:t,label:n,valueLabel:r}){return e&&t&&0!==t.length?(0,ep.jsxs)("div",{className:"rounded-lg border border-border/60 bg-popover/95 backdrop-blur-sm px-3 py-2 shadow-md",children:[null!=n&&(0,ep.jsx)("div",{className:"text-[11px] font-medium text-foreground mb-1.5",children:n}),(0,ep.jsx)("div",{className:"space-y-1",children:t.map((e,t)=>(0,ep.jsxs)("div",{className:"flex items-center gap-2 text-[11px]",children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px]",style:{backgroundColor:e.color||e.payload?.fill}}),(0,ep.jsx)("span",{className:"text-muted-foreground",children:e.name||r||"Value"}),(0,ep.jsx)("span",{className:"ml-auto pl-3 font-semibold tabular-nums text-foreground",children:(e.value??0).toLocaleString()})]},t))})]}):null}function V9({children:e}){return(0,ep.jsx)("h3",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.08em] mb-3",children:e})}function Ue(e){if(!e)return"Never";let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let n=Math.floor(t/60);if(n<24)return`${n}h ago`;let r=Math.floor(n/24);return`${r}d ago`}function Ut(e){return new Date(/[+Z-]$/.test(e)||/[+-]\d\d:?\d\d$/.test(e)?e:`${e}Z`)}function Un({done:e,total:t,doneColor:n}){let r=Math.round(100*(t>0?e/t:0));return(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:[(0,ep.jsx)("span",{className:"tabular-nums font-semibold text-foreground text-sm",children:e.toLocaleString()}),(0,ep.jsxs)("span",{className:"text-muted-foreground",children:[" / ",t.toLocaleString()]})]}),(0,ep.jsxs)("span",{className:"text-xs font-semibold tabular-nums text-foreground",children:[r,"%"]})]}),(0,ep.jsx)("div",{className:"h-1.5 w-full rounded-full bg-muted overflow-hidden",children:(0,ep.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${r}%`,backgroundColor:n}})})]})}function Ur({title:e,items:t,emptyLabel:n}){let r=t.reduce((e,t)=>e+t.value,0);return(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)("h4",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.08em]",children:e}),(0,ep.jsx)(V8,{value:r,className:"text-xs text-muted-foreground tabular-nums"})]}),0===r?(0,ep.jsx)("div",{className:"text-xs text-muted-foreground py-2",children:n}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"h-1.5 flex w-full rounded-full overflow-hidden bg-muted",children:t.filter(e=>e.value>0).map(e=>(0,ep.jsx)("div",{className:"h-full",style:{width:`${e.value/r*100}%`,backgroundColor:e.color},title:`${e.name}: ${e.value.toLocaleString()}`},e.name))}),(0,ep.jsx)("div",{className:"grid grid-cols-3 gap-3 text-sm",children:t.map(e=>(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px]",style:{backgroundColor:e.color}}),(0,ep.jsx)("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-medium",children:e.name})]}),(0,ep.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,ep.jsx)(V8,{value:e.value,className:"text-base font-semibold tabular-nums"}),(0,ep.jsx)("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:r>0?`${(e.value/r*100).toFixed(0)}%`:"0%"})]})]},e.name))})]})]})}function Ui({icon:e,label:t,value:n}){return(0,ep.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,ep.jsx)("div",{className:"p-2 rounded-md bg-muted",children:(0,ep.jsx)(e,{className:"w-4 h-4 text-muted-foreground"})}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:t}),(0,ep.jsx)(V8,{value:n,className:"text-2xl font-semibold text-foreground leading-tight tabular-nums block"})]})]})}let Ua=["completed","processing","pending","failed","cancelled"],Uo={completed:"#10b981",processing:"#3b82f6",pending:"#f59e0b",failed:"#ef4444",cancelled:"#6b7280"},Us={completed:"completed",processing:"processing",pending:"pending",failed:"failed",cancelled:"cancelled"};function Ul({byStatus:e}){let t=Ua.map(t=>({status:t,label:Us[t],value:e[t]||0,color:Uo[t]}));for(let[n,r]of Object.entries(e))Ua.includes(n)||t.push({status:n,label:n,value:r,color:V3});let n=t.reduce((e,t)=>e+t.value,0),r=t.filter(e=>e.value>0);return(0,ep.jsxs)(m7,{children:[(0,ep.jsxs)(m9,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,ep.jsxs)(ge,{className:"text-sm font-semibold flex items-center gap-2",children:[(0,ep.jsx)(j$,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Operations"]}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[(0,ep.jsx)(V8,{value:n})," total"]})]}),(0,ep.jsx)(gn,{children:0===n?(0,ep.jsx)("div",{className:"h-[100px] flex items-center justify-center text-sm text-muted-foreground",children:"No operations yet"}):(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsx)("div",{className:"h-1.5 flex w-full rounded-full overflow-hidden bg-muted",children:r.map(e=>(0,ep.jsx)("div",{className:"h-full",style:{width:`${e.value/n*100}%`,backgroundColor:e.color},title:`${e.label}: ${e.value.toLocaleString()}`},e.status))}),(0,ep.jsx)("div",{className:"space-y-1.5",children:r.map(e=>(0,ep.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px] flex-shrink-0",style:{backgroundColor:e.color}}),(0,ep.jsx)("span",{className:"text-muted-foreground flex-1",children:e.label}),(0,ep.jsx)(V8,{value:e.value,className:"font-semibold tabular-nums text-foreground"}),(0,ep.jsxs)("span",{className:"text-[10px] text-muted-foreground tabular-nums w-9 text-right",children:[(e.value/n*100).toFixed(0),"%"]})]},e.status))})]})})]})}function Uc({done:e,pending:t,failed:n,total:r,lastConsolidatedAt:i}){let[a,o]=(0,em.useState)(!1),s=n>0;return(0,ep.jsxs)(m7,{children:[(0,ep.jsx)(m9,{className:"pb-2",children:(0,ep.jsx)(ge,{className:"text-sm font-semibold",children:"Consolidation"})}),(0,ep.jsxs)(gn,{className:"space-y-4",children:[(0,ep.jsx)(Un,{done:e,total:r,doneColor:V5}),(0,ep.jsxs)("div",{className:"grid grid-cols-4 gap-3 pt-1",children:[(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jX.default,{className:"w-3 h-3 text-emerald-500"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Done"})]}),(0,ep.jsx)(V8,{value:e,className:"text-base font-semibold tabular-nums text-foreground block"})]}),(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jy,{className:"w-3 h-3 text-amber-500"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Pending"})]}),(0,ep.jsx)(V8,{value:t,className:"text-base font-semibold tabular-nums text-foreground block"})]}),(0,ep.jsxs)("button",{type:"button",onClick:()=>s&&o(!0),disabled:!s,className:`text-left space-y-0.5 rounded-md -mx-1 px-1 py-0.5 transition-colors ${s?"cursor-pointer hover:bg-red-500/10 focus:outline-none focus:ring-2 focus:ring-red-500/40":"cursor-default"}`,title:s?"View failed memories":void 0,children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jq,{className:`w-3 h-3 ${s?"text-red-600 dark:text-red-400":"text-muted-foreground/50"}`}),(0,ep.jsx)("span",{className:`text-[10px] uppercase tracking-wider font-medium ${s?"text-red-600 dark:text-red-400":"text-muted-foreground"}`,children:"Failed"})]}),(0,ep.jsxs)("span",{className:`text-base font-semibold tabular-nums block ${s?"text-red-600 dark:text-red-400":"text-foreground"}`,children:[(0,ep.jsx)(V8,{value:n}),s&&(0,ep.jsx)(jK,{className:"inline w-3 h-3 ml-1 opacity-70"})]})]}),(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eG,{className:"w-3 h-3 text-muted-foreground"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Last"})]}),(0,ep.jsx)("span",{className:"text-base font-semibold text-foreground block leading-tight",children:Ue(i)})]})]})]}),(0,ep.jsx)(Uu,{open:a,onOpenChange:o})]})}function Uu({open:e,onOpenChange:t}){let{currentBank:n}=(0,ey.useBank)(),[r,i]=(0,em.useState)([]),[a,o]=(0,em.useState)(0),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)(!1),[d,h]=(0,em.useState)(0);(0,em.useEffect)(()=>{if(!e||!n)return;let t=!1;return l(!0),eD.client.listMemories(n,{consolidationState:"failed",limit:200}).then(e=>{t||(i(e.items),o(e.total))}).catch(()=>{}).finally(()=>{t||l(!1)}),()=>{t=!0}},[e,n,d]);let f=async()=>{if(n){u(!0);try{let e=await eD.client.recoverConsolidation(n);e.retried_count>0&&await eD.client.triggerConsolidation(n),ev.toast.success(`Queued ${e.retried_count} memor${1===e.retried_count?"y":"ies"} for re-consolidation`),h(e=>e+1)}catch{}finally{u(!1)}}};return(0,ep.jsx)(tY.Dialog,{open:e,onOpenChange:t,children:(0,ep.jsxs)(tY.DialogContent,{className:"max-w-4xl max-h-[80vh] flex flex-col",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsxs)(tY.DialogTitle,{className:"flex items-center gap-2",children:[(0,ep.jsx)(jq,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),"Failed consolidations"]}),(0,ep.jsx)(tY.DialogDescription,{children:"Source memories whose consolidation permanently failed. Recovery resets them so they are retried on the next consolidation run."})]}),(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-2 py-2",children:[(0,ep.jsx)("span",{className:"text-sm text-muted-foreground",children:s?"Loading…":`${a} failed`}),(0,ep.jsxs)(eL.Button,{size:"sm",onClick:f,disabled:c||s||0===a,children:[(0,ep.jsx)(eW,{className:`w-3.5 h-3.5 mr-1.5 ${c?"animate-spin":""}`}),"Recover all"]})]}),(0,ep.jsx)("div",{className:"flex-1 min-h-0 overflow-auto border border-border rounded-md",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-[140px]",children:"Failed at"}),(0,ep.jsx)(eJ,{className:"w-[100px]",children:"Type"}),(0,ep.jsx)(eJ,{children:"Text"})]})}),(0,ep.jsxs)(eZ,{children:[0===r.length&&!s&&(0,ep.jsx)(eQ,{children:(0,ep.jsx)(e0,{colSpan:3,className:"text-center text-muted-foreground py-8",children:"No failed consolidations."})}),r.map(e=>(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(e0,{className:"text-xs text-muted-foreground whitespace-nowrap",children:Ue(e.consolidation_failed_at)}),(0,ep.jsx)(e0,{className:"text-xs capitalize",children:e.fact_type}),(0,ep.jsxs)(e0,{className:"text-sm",children:[(0,ep.jsx)("div",{className:"line-clamp-2",children:e.text}),e.context&&(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:e.context})]})]},e.id))]})]})})]})})}function Ud({models:e,lastConsolidatedAt:t}){let n=e.length,r=t?new Date(t).getTime():0,i=e.filter(e=>!r||!!e.last_refreshed_at&&new Date(e.last_refreshed_at).getTime()>=r).length,a=n-i;return(0,ep.jsxs)(m7,{children:[(0,ep.jsx)(m9,{className:"pb-2",children:(0,ep.jsxs)(ge,{className:"text-sm font-semibold flex items-center gap-2",children:[(0,ep.jsx)(gi,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Mental Models"]})}),(0,ep.jsx)(gn,{className:"space-y-4",children:0===n?(0,ep.jsx)("div",{className:"text-sm text-muted-foreground py-4",children:"No mental models"}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(Un,{done:i,total:n,doneColor:V5}),(0,ep.jsxs)("div",{className:"grid grid-cols-3 gap-3 pt-1",children:[(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jX.default,{className:"w-3 h-3 text-emerald-500"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Up to date"})]}),(0,ep.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:i})]}),(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jy,{className:"w-3 h-3 text-amber-500"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Stale"})]}),(0,ep.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:a})]}),(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(gi,{className:"w-3 h-3 text-muted-foreground"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Total"})]}),(0,ep.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:n})]})]})]})})]})}let Uh={fontSize:11,fill:V3,fontWeight:500};function Uf(){let{currentBank:e}=(0,ey.useBank)(),{features:t}=(0,ew.useFeatures)(),n=t?.observations??!1,[r,i]=(0,em.useState)(null),[a,o]=(0,em.useState)([]),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)("7d"),[d,h]=(0,em.useState)("created_at"),[f,p]=(0,em.useState)({trunc:"day",buckets:[]}),[g,v]=(0,em.useState)({world:!0,experience:!0,observation:!0}),x=async()=>{if(e){l(!0);try{let[t,n]=await Promise.all([eD.client.getBankStats(e),eD.client.listMentalModels(e)]);i(t),o(n.items||[])}catch(e){console.error("Error loading bank stats:",e)}finally{l(!1)}}},y=async()=>{if(e)try{let t=await eD.client.getMemoriesTimeseries(e,c,d);p({trunc:t.trunc,buckets:t.buckets||[]})}catch(e){console.error("Error loading memories timeseries:",e)}};if((0,em.useEffect)(()=>{if(e){x();let e=setInterval(x,5e3);return()=>clearInterval(e)}},[e]),(0,em.useEffect)(()=>{if(e){y();let e=setInterval(y,5e3);return()=>clearInterval(e)}},[e,c,d]),s&&!r)return(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)(eG,{className:"w-12 h-12 mx-auto mb-3 text-muted-foreground animate-pulse"})});if(!r)return null;let b=n?["world","experience","observation"]:["world","experience"],w=f.buckets.map(e=>{var t,n,r,i;let a,o;return{...e,label:(t=e.time,n=f.trunc,a=Ut(t),"day"===n?a.toLocaleDateString(void 0,{month:"short",day:"numeric"}):a.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})),tooltipLabel:(r=e.time,i=f.trunc,o=Ut(r),"day"===i?o.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):o.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}))}}),j=w.reduce((e,t)=>e+b.reduce((e,n)=>e+(g[n]&&t[n]||0),0),0),N=Math.max(0,r.total_nodes-r.pending_consolidation);return(0,ep.jsxs)("div",{className:"space-y-8",children:[(0,ep.jsxs)("section",{children:[(0,ep.jsx)(V9,{children:"Memory store"}),(0,ep.jsx)(m7,{children:(0,ep.jsxs)(gn,{className:"p-0",children:[(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 md:divide-x divide-y md:divide-y-0 divide-border/60",children:[(0,ep.jsx)(Ui,{icon:eE,label:"Memories",value:r.total_nodes}),(0,ep.jsx)(Ui,{icon:jG,label:"Documents",value:r.total_documents}),(0,ep.jsx)(Ui,{icon:jY,label:"Links",value:r.total_links})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 md:divide-x divide-y md:divide-y-0 divide-border/60 border-t border-border/60",children:[(0,ep.jsx)("div",{className:"p-5",children:(0,ep.jsx)(Ur,{title:"Memory composition",items:[{name:"World",value:r.nodes_by_fact_type?.world||0,color:V0},{name:"Experience",value:r.nodes_by_fact_type?.experience||0,color:V1},...n?[{name:"Observations",value:r.total_observations||0,color:V2}]:[]],emptyLabel:"No memories yet"})}),(0,ep.jsx)("div",{className:"p-5",children:(0,ep.jsx)(Ur,{title:"Link types",items:[{name:"Temporal",value:r.links_by_link_type?.temporal||0,color:"#009296"},{name:"Semantic",value:r.links_by_link_type?.semantic||0,color:"#0074d9"},{name:"Entity",value:r.links_by_link_type?.entity||0,color:"#f59e0b"}],emptyLabel:"No links yet"})})]})]})})]}),(0,ep.jsxs)("section",{children:[(0,ep.jsx)(V9,{children:"Consolidation"}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ep.jsx)(Uc,{done:N,pending:r.pending_consolidation,failed:r.failed_consolidation??0,total:r.total_nodes,lastConsolidatedAt:r.last_consolidated_at}),(0,ep.jsx)(Ud,{models:a,lastConsolidatedAt:r.last_consolidated_at})]})]}),(0,ep.jsxs)("section",{children:[(0,ep.jsx)(V9,{children:"Activity"}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,ep.jsxs)(m7,{className:"lg:col-span-2",children:[(0,ep.jsxs)(m9,{className:"pb-2 space-y-2",children:[(0,ep.jsxs)("div",{className:"flex flex-row items-center justify-between",children:[(0,ep.jsxs)(ge,{className:"text-sm font-semibold",children:["Memories by ",VQ[d].short.toLowerCase()," time"]}),(0,ep.jsx)("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:VZ.map(e=>(0,ep.jsx)("button",{onClick:()=>u(e),className:`px-2 py-0.5 text-[11px] font-medium rounded transition-colors tabular-nums ${c===e?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:e},e))})]}),(0,ep.jsx)("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5 w-fit",children:VJ.map(e=>(0,ep.jsx)("button",{onClick:()=>h(e),title:VQ[e].long,className:`px-2 py-0.5 text-[11px] font-medium rounded transition-colors ${d===e?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:VQ[e].short},e))}),(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)("div",{className:"flex items-center gap-1.5",children:b.map(e=>{let t=V4[e],n=g[e];return(0,ep.jsxs)("button",{onClick:()=>v(t=>({...t,[e]:!t[e]})),className:`flex items-center gap-1.5 px-2 py-0.5 rounded-md text-[11px] font-medium transition-all ${n?"bg-muted text-foreground":"bg-transparent text-muted-foreground/60 hover:text-muted-foreground"}`,children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px] transition-opacity",style:{backgroundColor:t.color,opacity:n?1:.3}}),t.label]},e)})}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[(0,ep.jsx)(V8,{value:j})," total"]})]})]}),(0,ep.jsx)(gn,{children:0===w.length||0===j?(0,ep.jsx)("div",{className:"h-[180px] flex items-center justify-center text-sm text-muted-foreground",children:"No memories ingested in this period"}):(0,ep.jsx)("div",{className:"h-[180px]",children:(0,ep.jsx)(_E,{width:"100%",height:"100%",children:(0,ep.jsxs)(RC,{data:w,margin:{top:8,right:8,bottom:0,left:-10},children:[(0,ep.jsx)("defs",{children:b.map(e=>(0,ep.jsxs)("linearGradient",{id:`grad-${e}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,ep.jsx)("stop",{offset:"0%",stopColor:V4[e].color,stopOpacity:.35}),(0,ep.jsx)("stop",{offset:"100%",stopColor:V4[e].color,stopOpacity:0})]},e))}),(0,ep.jsx)(VK,{vertical:!1,stroke:"var(--border)",strokeOpacity:.5,strokeDasharray:"2 4"}),(0,ep.jsx)(Fz,{dataKey:"label",tick:Uh,axisLine:!1,tickLine:!1,dy:4,minTickGap:20}),(0,ep.jsx)(F$,{tick:Uh,axisLine:!1,tickLine:!1,width:40,allowDecimals:!1,tickFormatter:e=>V6(e)}),(0,ep.jsx)(VM,{content:(0,ep.jsx)(V7,{}),labelFormatter:(e,t)=>t?.[0]?.payload?.tooltipLabel||"",cursor:{stroke:V3,strokeWidth:1,strokeDasharray:"3 3"}}),b.map(e=>g[e]?(0,ep.jsx)(Fc,{type:"monotone",dataKey:e,name:V4[e].label,stackId:"a",stroke:V4[e].color,strokeWidth:2,fill:`url(#grad-${e})`,isAnimationActive:!1},e):null)]})})})})]}),(0,ep.jsx)(Ul,{byStatus:r.operations_by_status||{}})]})]})]})}var tH=tH;let Up=(0,eN.default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),Um=(0,eN.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),Ug=(0,eN.default)("ban",[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),Uv=[{value:"all",label:"All types"},{value:"retain",label:"Retain"},{value:"consolidation",label:"Consolidation"},{value:"refresh_mental_model",label:"Mental Model Refresh"},{value:"file_convert_retain",label:"File Convert & Retain"},{value:"webhook_delivery",label:"Webhook Delivery"}];function Ux(){let e,t,n,{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)([]),[o,s]=(0,em.useState)(0),[l,c]=(0,em.useState)(null),[u,d]=(0,em.useState)(null),[h]=(0,em.useState)(10),[f,p]=(0,em.useState)(0),[g,v]=(0,em.useState)(null),[x,y]=(0,em.useState)(null),[b,w]=(0,em.useState)(!1),[j,N]=(0,em.useState)(null),[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(!1),[A,O]=(0,em.useState)(null),M=(0,em.useCallback)(async(e=l,t=f,n=u)=>{if(r){w(!0);try{let i=await eD.client.listOperations(r,{status:e||void 0,type:n||void 0,limit:h,offset:t,excludeParents:!0});a(i.operations||[]),s(i.total||0)}catch(e){console.error("Error loading operations:",e)}finally{w(!1)}}},[r,l,f,u,h]),P=e=>{p(e),M(l,e,u)},D=async e=>{if(r){v(e);try{await eD.client.cancelOperation(r,e),await M()}catch(e){}finally{v(null)}}},L=async e=>{if(r){y(e);try{await eD.client.retryOperation(r,e),await M()}catch(e){}finally{y(null)}}},I=async e=>{if(r){_(!0),E(!0),O(null);try{let t=await eD.client.getOperationStatus(r,e);N(t)}catch(e){console.error("Error loading operation details:",e),N({error:"Failed to load operation details"})}finally{_(!1)}}},R=async()=>{if(r&&j?.operation_id){T(!0);try{let e=j.operation_id,t=await eD.client.getOperationStatus(r,e,{includePayload:!0});N(t),O(e)}catch(e){console.error("Error loading raw payload:",e)}finally{T(!1)}}};return((0,em.useEffect)(()=>{if(r){M(l,f,u);let e=setInterval(()=>M(l,f,u),5e3);return()=>clearInterval(e)}},[r,l,f,u]),r)?(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("h3",{className:"text-lg font-semibold",children:"Background Operations"}),(0,ep.jsx)("button",{onClick:()=>M(),className:"p-1 rounded hover:bg-muted transition-colors",title:"Refresh operations",disabled:b,children:(0,ep.jsx)(eW,{className:`w-4 h-4 text-muted-foreground hover:text-foreground ${b?"animate-spin":""}`})})]}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground",children:[o," operation",1!==o?"s":"",l?` (${l})`:""]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsxs)(tR.Select,{value:u??"all",onValueChange:e=>{var t;d(t="all"===e?null:e),p(0),M(l,0,t)},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"h-9 w-[180px] text-sm",children:(0,ep.jsx)(tR.SelectValue,{placeholder:"All types"})}),(0,ep.jsx)(tR.SelectContent,{children:Uv.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e.value,children:(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{children:e.label}),"all"!==e.value&&(0,ep.jsx)("div",{className:"text-xs text-muted-foreground font-mono",children:e.value})]})},e.value))})]}),(0,ep.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:[{value:null,label:"All"},{value:"pending",label:"Pending"},{value:"processing",label:"Processing"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"},{value:"cancelled",label:"Cancelled"}].map(e=>(0,ep.jsx)("button",{onClick:()=>{var t;c(t=e.value),p(0),M(t,0,u)},className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${l===e.value?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:e.label},e.value??"all"))})]})]}),(0,ep.jsx)("div",{children:i.length>0?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-[100px]",children:"ID"}),(0,ep.jsx)(eJ,{children:"Type"}),(0,ep.jsx)(eJ,{children:"Created"}),(0,ep.jsx)(eJ,{children:"Status"}),(0,ep.jsx)(eJ,{className:"w-[80px]"})]})}),(0,ep.jsx)(eZ,{children:i.map(e=>(0,ep.jsxs)(eQ,{className:`cursor-pointer hover:bg-muted/50 ${"failed"===e.status?"bg-red-500/5":""}`,onClick:()=>I(e.id),children:[(0,ep.jsx)(e0,{className:"font-mono text-xs text-muted-foreground",children:e.id.substring(0,8)}),(0,ep.jsx)(e0,{className:"font-medium",children:e.task_type}),(0,ep.jsx)(e0,{className:"text-sm text-muted-foreground",children:new Date(e.created_at).toLocaleString()}),(0,ep.jsxs)(e0,{children:["pending"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,ep.jsx)(eG,{className:"w-3 h-3"}),"pending"]}),"processing"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/20",children:[(0,ep.jsx)(tH.default,{className:"w-3 h-3 animate-spin"}),"processing"]}),"failed"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",title:e.error_message??void 0,children:[(0,ep.jsx)(jy,{className:"w-3 h-3"}),"failed"]}),"completed"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ep.jsx)(eY,{className:"w-3 h-3"}),"completed"]}),"cancelled"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-gray-500/10 text-gray-600 dark:text-gray-400 border border-gray-500/20",children:[(0,ep.jsx)(Ug,{className:"w-3 h-3"}),"cancelled"]})]}),(0,ep.jsxs)(e0,{children:["pending"===e.status&&(0,ep.jsxs)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-red-600 dark:hover:text-red-400",onClick:t=>{t.stopPropagation(),D(e.id)},disabled:g===e.id,children:[g===e.id?(0,ep.jsx)(tH.default,{className:"w-3 h-3 animate-spin"}):(0,ep.jsx)(tU.X,{className:"w-3 h-3 mr-1"}),g===e.id?"":"Cancel"]}),("failed"===e.status||"cancelled"===e.status)&&(0,ep.jsxs)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-blue-600 dark:hover:text-blue-400",onClick:t=>{t.stopPropagation(),L(e.id)},disabled:x===e.id,children:[x===e.id?(0,ep.jsx)(tH.default,{className:"w-3 h-3 animate-spin"}):(0,ep.jsx)(Up,{className:"w-3 h-3 mr-1"}),x===e.id?"":"Retry"]})]})]},e.id))})]})}),o>h&&(0,ep.jsxs)("div",{className:"flex items-center justify-between mt-4 pt-4 border-t",children:[(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Showing ",f+1,"-",Math.min(f+h,o)," of"," ",o]}),(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>P(Math.max(0,f-h)),disabled:0===f,children:"Previous"}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>P(f+h),disabled:f+h>=o,children:"Next"})]})]})]}):(0,ep.jsxs)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:["No ",l?`${l} `:"","operations"]})}),(0,ep.jsx)(tY.Dialog,{open:k,onOpenChange:E,children:(0,ep.jsxs)(tY.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsx)(tY.DialogTitle,{children:"Operation Details"}),(0,ep.jsx)(tY.DialogDescription,{children:j?.operation_id&&(0,ep.jsx)("span",{className:"font-mono text-xs",children:j.operation_id})})]}),C?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)(tH.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):j?(0,ep.jsx)("div",{className:"space-y-4",children:j.error?(0,ep.jsx)("div",{className:"text-red-600 dark:text-red-400",children:j.error}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Status"}),(0,ep.jsxs)("div",{className:"mt-1",children:["pending"===j.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,ep.jsx)(eG,{className:"w-3 h-3"}),"pending"]}),"processing"===j.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/20",children:[(0,ep.jsx)(tH.default,{className:"w-3 h-3 animate-spin"}),"processing"]}),"failed"===j.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,ep.jsx)(jy,{className:"w-3 h-3"}),"failed"]}),"completed"===j.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ep.jsx)(eY,{className:"w-3 h-3"}),"completed"]}),"cancelled"===j.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-gray-500/10 text-gray-600 dark:text-gray-400 border border-gray-500/20",children:[(0,ep.jsx)(Ug,{className:"w-3 h-3"}),"cancelled"]})]})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Type"}),(0,ep.jsx)("div",{className:"mt-1 font-mono text-sm",children:j.operation_type})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Created"}),(0,ep.jsx)("div",{className:"mt-1 text-sm",children:j.created_at?new Date(j.created_at).toLocaleString():"N/A"})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Updated"}),(0,ep.jsx)("div",{className:"mt-1 text-sm",children:j.updated_at?new Date(j.updated_at).toLocaleString():"N/A"})]}),j.completed_at&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Completed"}),(0,ep.jsx)("div",{className:"mt-1 text-sm",children:new Date(j.completed_at).toLocaleString()})]}),j.result_metadata?.items_count!==void 0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Total Items"}),(0,ep.jsx)("div",{className:"mt-1 text-sm",children:j.result_metadata.items_count})]})]}),("pending"===j.status||"failed"===j.status||"cancelled"===j.status)&&(0,ep.jsxs)("div",{className:"flex gap-2",children:["pending"===j.status&&(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>D(j.operation_id),disabled:g===j.operation_id,children:[g===j.operation_id?(0,ep.jsx)(tH.default,{className:"w-3 h-3 animate-spin mr-1"}):(0,ep.jsx)(tU.X,{className:"w-3 h-3 mr-1"}),"Cancel"]}),("failed"===j.status||"cancelled"===j.status)&&(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>L(j.operation_id),disabled:x===j.operation_id,children:[x===j.operation_id?(0,ep.jsx)(tH.default,{className:"w-3 h-3 animate-spin mr-1"}):(0,ep.jsx)(Up,{className:"w-3 h-3 mr-1"}),"Retry"]})]}),j.result_metadata&&Object.keys(j.result_metadata).length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Metadata"}),(0,ep.jsx)("pre",{className:"rounded-lg border bg-muted/30 p-3 text-xs font-mono overflow-x-auto max-h-96 whitespace-pre-wrap break-words",children:JSON.stringify(j.result_metadata,null,2)})]}),j.error_message&&(0,ep.jsxs)("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-3",children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-red-600 dark:text-red-400 mb-1",children:"Error"}),(0,ep.jsx)("div",{className:"text-sm text-red-600/80 dark:text-red-400/80 font-mono",children:j.error_message})]}),j.child_operations&&j.child_operations.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"text-sm font-medium text-muted-foreground mb-2",children:["Sub-batches (",j.result_metadata?.num_sub_batches||j.child_operations.length,")"]}),(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-[60px]",children:"Index"}),(0,ep.jsx)(eJ,{className:"w-[100px]",children:"ID"}),(0,ep.jsx)(eJ,{className:"w-[80px]",children:"Items"}),(0,ep.jsx)(eJ,{children:"Status"})]})}),(0,ep.jsx)(eZ,{children:j.child_operations.map(e=>(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(e0,{className:"text-sm",children:e.sub_batch_index}),(0,ep.jsx)(e0,{className:"font-mono text-xs text-muted-foreground",children:e.operation_id.substring(0,8)}),(0,ep.jsx)(e0,{className:"text-sm",children:e.items_count}),(0,ep.jsxs)(e0,{children:["pending"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400",children:[(0,ep.jsx)(eG,{className:"w-3 h-3"}),"pending"]}),"processing"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400",children:[(0,ep.jsx)(tH.default,{className:"w-3 h-3 animate-spin"}),"processing"]}),"failed"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400",title:e.error_message??void 0,children:[(0,ep.jsx)(jy,{className:"w-3 h-3"}),"failed"]}),"completed"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",children:[(0,ep.jsx)(eY,{className:"w-3 h-3"}),"completed"]}),"cancelled"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-gray-500/10 text-gray-600 dark:text-gray-400",children:[(0,ep.jsx)(Ug,{className:"w-3 h-3"}),"cancelled"]})]})]},e.operation_id))})]})]}),(e=A===j.operation_id,t=!!j.task_payload,n=!!j.result_metadata?.is_parent,(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Raw payload"}),!e&&(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:R,disabled:S,children:[S?(0,ep.jsx)(tH.default,{className:"w-3 h-3 mr-1 animate-spin"}):(0,ep.jsx)(Um,{className:"w-3 h-3 mr-1"}),"Load raw"]})]}),t?(0,ep.jsx)("pre",{className:"rounded-lg border bg-muted/30 p-3 text-xs font-mono overflow-x-auto max-h-96 whitespace-pre-wrap break-words",children:JSON.stringify(j.task_payload,null,2)}):e?(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:n?"This is a parent operation — the raw payload is stored on each sub-batch. Open a child operation to inspect its payload.":"No raw payload stored for this operation."}):(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Shows the full parameters the operation was submitted with (may be large)."})]}))]})}):null]})})]}):null}var tH=tH;let Uy=(0,eN.default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);function Ub(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(!1),[a,o]=(0,em.useState)("files"),[s,l]=(0,em.useState)(""),[c,u]=(0,em.useState)(1),[d,h]=(0,em.useState)(!1),[f,p]=(0,em.useState)(null),[g,v]=(0,em.useState)(null),[x,y]=(0,em.useState)([]),[b,w]=(0,em.useState)("any"),[j,N]=(0,em.useState)(!1),[k,E]=(0,em.useState)(null),[C,_]=(0,em.useState)(null),[S,T]=(0,em.useState)(!1),A=t.filter(e=>{if(!s)return!0;let t=s.toLowerCase();return e.id.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.source_query.toLowerCase().includes(t)||e.content.toLowerCase().includes(t)}),O=async()=>{if(e){i(!0);try{let t=await eD.client.listMentalModels(e,x.length>0?x:void 0,x.length>0?b:void 0);n(t.items||[])}catch(e){console.error("Error loading mental models:",e)}finally{i(!1)}}},[M,P]=(0,em.useState)(new Set),D=async t=>{if(!e)return;let r=t.last_refreshed_at;P(e=>new Set(e).add(t.id));try{await eD.client.refreshMentalModel(e,t.id);for(let i=0;i<120;i++){await new Promise(e=>setTimeout(e,1e3));let i=await eD.client.getMentalModel(e,t.id);if(i.last_refreshed_at!==r){n(e=>e.map(e=>e.id===t.id?i:e)),f?.id===t.id&&p(i),ev.toast.success("Mental model refreshed");return}}ev.toast.error("Refresh timeout")}catch{}finally{P(e=>{let n=new Set(e);return n.delete(t.id),n})}},L=async()=>{if(e&&C){T(!0);try{await eD.client.deleteMentalModel(e,C.id),n(e=>e.filter(e=>e.id!==C.id)),f?.id===C.id&&p(null),_(null)}catch(e){}finally{T(!1)}}};if((0,em.useEffect)(()=>{e&&O()},[e,x,b]),(0,em.useEffect)(()=>{let e=e=>{"Escape"===e.key&&p(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),(0,em.useEffect)(()=>{u(1)},[s,x,b]),!e)return(0,ep.jsx)(m7,{children:(0,ep.jsx)(gn,{className:"p-10 text-center",children:(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Select a memory bank to view mental models."})})});let I=Math.ceil(A.length/100),R=(c-1)*100,B=R+100,z=A.slice(R,B);return(0,ep.jsxs)("div",{children:[r?(0,ep.jsxs)("div",{className:"text-center py-12",children:[(0,ep.jsx)(eW,{className:"w-8 h-8 mx-auto mb-3 text-muted-foreground animate-spin"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Loading..."})]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"mb-4 flex items-center gap-3 flex-wrap",children:[(0,ep.jsx)(eI.Input,{type:"text",value:s,onChange:e=>l(e.target.value),placeholder:"Filter mental models by name, query, or content...",className:"w-80 h-9"}),(0,ep.jsx)(fR,{value:x,onChange:y,fetchSuggestions:async t=>{if(!e)return[];let n=t?`${t}*`:void 0;return(await eD.client.listTags(e,n,20,"mental_models")).items.map(e=>e.tag)},matchMode:b,onMatchModeChange:w,className:"flex-1 min-w-[260px]"}),(0,ep.jsxs)(eL.Button,{onClick:()=>h(!0),size:"sm",children:[(0,ep.jsx)(fz.Plus,{className:"w-4 h-4 mr-2"}),"Add Mental Model"]})]}),(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:s||x.length>0?`${A.length} of ${t.length} mental models`:`${t.length} mental model${1!==t.length?"s":""}`}),(0,ep.jsx)("div",{className:"flex items-center gap-3",children:(0,ep.jsxs)("div",{className:"flex items-center gap-2 bg-muted rounded-lg p-1",children:[(0,ep.jsxs)("button",{onClick:()=>o("files"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"files"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(jG,{className:"w-4 h-4"}),"List"]}),(0,ep.jsxs)("button",{onClick:()=>o("dashboard"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"dashboard"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(Uy,{className:"w-4 h-4"}),"Dashboard"]})]})})]}),A.length>0?(0,ep.jsxs)(ep.Fragment,{children:["dashboard"===a&&(0,ep.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:z.map(e=>(0,ep.jsx)(m7,{className:`cursor-pointer transition-all hover:shadow-md hover:border-primary/50 ${f?.id===e.id?"border-primary shadow-md":""}`,onClick:()=>p(e),children:(0,ep.jsxs)(gn,{className:"p-4",children:[(0,ep.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("h3",{className:"font-semibold text-foreground mb-1 truncate",children:e.name}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground truncate",children:e.id}),(0,ep.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium flex-shrink-0 ${e.trigger?.refresh_after_consolidation?"bg-green-500/10 text-green-600 dark:text-green-400":"bg-slate-500/10 text-slate-600 dark:text-slate-400"}`,children:e.trigger?.refresh_after_consolidation?"Auto Refresh":"Manual"})]})]}),(0,ep.jsx)(Uw,{m:e,refreshing:M.has(e.id),onEdit:e=>{E(e),N(!0)},onRefresh:D,onDelete:e=>_({id:e.id,name:e.name}),triggerClassName:"h-7 w-7 ml-2 flex-shrink-0"})]}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:e.source_query}),(0,ep.jsxs)("div",{className:"relative mb-3 border-t border-border pt-3 max-h-40 overflow-hidden",children:[(0,ep.jsx)(wq,{children:e.content}),(0,ep.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-card to-transparent"})]}),(0,ep.jsxs)("div",{className:"flex items-center justify-between text-xs border-t border-border pt-3",children:[(0,ep.jsx)("div",{className:"flex items-center gap-2",children:e.tags.length>0&&(0,ep.jsxs)("div",{className:"flex gap-1",children:[e.tags.slice(0,2).map(e=>(0,ep.jsx)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-blue-500/10 text-blue-600 dark:text-blue-400",children:e},e)),e.tags.length>2&&(0,ep.jsxs)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-muted text-muted-foreground",children:["+",e.tags.length-2]})]})}),(0,ep.jsx)("div",{className:"text-muted-foreground",title:wJ(e.last_refreshed_at),children:wQ(e.last_refreshed_at)})]})]})},e.id))}),"files"===a&&(0,ep.jsx)(Uk,{mentalModels:A,selectedId:g,onSelect:v,onOpenDetail:p,refreshingIds:M,onEdit:e=>{E(e),N(!0)},onRefresh:D,onDelete:e=>_({id:e.id,name:e.name})}),"files"!==a&&I>1&&(0,ep.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t",children:[(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground",children:[R+1,"-",Math.min(B,A.length)," of"," ",A.length]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>u(1),disabled:1===c,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eF,{className:"h-3 w-3"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>u(e=>Math.max(1,e-1)),disabled:1===c,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eS,{className:"h-3 w-3"})}),(0,ep.jsxs)("span",{className:"text-xs px-2",children:[c," / ",I]}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>u(e=>Math.min(I,e+1)),disabled:c===I,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eT.ChevronRight,{className:"h-3 w-3"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>u(I),disabled:c===I,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eV,{className:"h-3 w-3"})})]})]})]}):(0,ep.jsxs)("div",{className:"p-6 border border-dashed border-border rounded-lg text-center",children:[(0,ep.jsx)(ek,{className:"w-6 h-6 mx-auto mb-2 text-muted-foreground"}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:s?"No mental models match your filter":"No mental models yet. Create a mental model to generate and save a summary from your memories."})]})]}),(0,ep.jsx)(Uj,{open:d,onClose:()=>h(!1),onCreated:()=>{h(!1),O()}}),(0,ep.jsx)(mv,{open:!!C,onOpenChange:e=>!e&&_(null),children:(0,ep.jsxs)(mD,{children:[(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mR,{children:"Delete Mental Model"}),(0,ep.jsxs)(mB,{children:["Are you sure you want to delete"," ",(0,ep.jsxs)("span",{className:"font-semibold",children:['"',C?.name,'"']}),"?",(0,ep.jsx)("br",{}),(0,ep.jsx)("br",{}),(0,ep.jsx)("span",{className:"text-destructive font-semibold",children:"This action cannot be undone."})]})]}),(0,ep.jsxs)(mI,{className:"flex-row justify-end space-x-2",children:[(0,ep.jsx)(mF,{className:"mt-0",children:"Cancel"}),(0,ep.jsxs)(mz,{onClick:L,disabled:S,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[S?(0,ep.jsx)(tH.default,{className:"w-4 h-4 animate-spin mr-1"}):null,"Delete"]})]})]})}),(0,ep.jsx)(w9,{mentalModelId:f?.id??null,onClose:()=>p(null),onDelete:e=>_({id:e.id,name:e.name}),onEdit:e=>{E(e),N(!0)},onRefreshed:e=>{n(t=>t.map(t=>t.id===e.id?e:t)),p(e)}}),k&&(0,ep.jsx)(UN,{open:j,mentalModel:k,onClose:()=>{N(!1),E(null)},onUpdated:e=>{n(t=>t.map(t=>t.id===e.id?e:t)),p(e),N(!1),E(null)}})]})}function Uw({m:e,refreshing:t,onEdit:n,onRefresh:r,onDelete:i,triggerClassName:a}){return(0,ep.jsxs)(p5,{children:[(0,ep.jsx)(p4,{asChild:!0,children:(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",className:`p-0 text-muted-foreground ${a??"h-8 w-8"}`,onClick:e=>e.stopPropagation(),"aria-label":"Actions",children:(0,ep.jsx)(mH,{className:"h-4 w-4"})})}),(0,ep.jsxs)(ml,{align:"end",onClick:e=>e.stopPropagation(),children:[(0,ep.jsxs)(mc,{onClick:()=>n(e),children:[(0,ep.jsx)(mU,{className:"h-4 w-4 mr-2"}),"Edit"]}),(0,ep.jsxs)(mc,{onClick:()=>r(e),disabled:t,children:[(0,ep.jsx)(eW,{className:`h-4 w-4 mr-2 ${t?"animate-spin":""}`}),"Refresh Manually"]}),(0,ep.jsx)(mu,{}),(0,ep.jsxs)(mc,{onClick:()=>i(e),className:"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400 focus:bg-red-500/10",children:[(0,ep.jsx)(mV,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})}function Uj({open:e,onClose:t,onCreated:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)(!1),[o,s]=(0,em.useState)({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),l=async()=>{if(r&&o.name.trim()&&o.sourceQuery.trim()){a(!0);try{let e,t=o.tags.split(",").map(e=>e.trim()).filter(e=>e.length>0),i=parseInt(o.maxTokens)||2048,a=o.excludeMentalModelIds.split(",").map(e=>e.trim()).filter(e=>e.length>0);if(o.tagGroups.trim())try{e=JSON.parse(o.tagGroups.trim())}catch{ev.toast.error("Invalid JSON in Tag Groups field");return}let l=o.recallMaxTokens.trim()?parseInt(o.recallMaxTokens,10):void 0,c=o.recallChunksMaxTokens.trim()?parseInt(o.recallChunksMaxTokens,10):void 0,u="true"===o.includeChunks||"false"!==o.includeChunks&&void 0;await eD.client.createMentalModel(r,{id:o.id.trim()||void 0,name:o.name.trim(),source_query:o.sourceQuery.trim(),tags:t.length>0?t:void 0,max_tokens:i,trigger:{mode:o.mode,refresh_after_consolidation:o.autoRefresh,fact_types:o.factTypes.length>0?o.factTypes:void 0,exclude_mental_models:o.excludeMentalModels||void 0,exclude_mental_model_ids:a.length>0?a:void 0,tags_match:o.tagsMatch||void 0,tag_groups:e,include_chunks:u,recall_max_tokens:l,recall_chunks_max_tokens:c}}),s({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),n()}catch(e){}finally{a(!1)}}};return(0,ep.jsx)(tY.Dialog,{open:e,onOpenChange:e=>{e||(s({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),t())},children:(0,ep.jsxs)(tY.DialogContent,{className:"sm:max-w-2xl max-h-[90vh] flex flex-col",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsx)(tY.DialogTitle,{children:"Create Mental Model"}),(0,ep.jsx)(tY.DialogDescription,{children:"Create a mental model by running a query. The content will be auto-generated and can be refreshed later."})]}),(0,ep.jsxs)(t$.Tabs,{defaultValue:"general",className:"py-2 flex-1 flex flex-col min-h-0 overflow-hidden",children:[(0,ep.jsxs)(t$.TabsList,{className:"w-full",children:[(0,ep.jsx)(t$.TabsTrigger,{value:"general",className:"flex-1",children:"General"}),(0,ep.jsx)(t$.TabsTrigger,{value:"options",className:"flex-1",children:"Options"})]}),(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto mt-2 pr-1",children:[(0,ep.jsxs)(t$.TabsContent,{value:"general",className:"space-y-4 pt-4",children:[(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"ID"}),(0,ep.jsx)(eI.Input,{value:o.id,onChange:e=>s({...o,id:e.target.value}),placeholder:"e.g., team-communication"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Name *"}),(0,ep.jsx)(eI.Input,{value:o.name,onChange:e=>s({...o,name:e.target.value}),placeholder:"e.g., Team Communication Preferences"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Source Query *"}),(0,ep.jsx)(eI.Input,{value:o.sourceQuery,onChange:e=>s({...o,sourceQuery:e.target.value}),placeholder:"e.g., How does the team prefer to communicate?"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Max Tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:o.maxTokens,onChange:e=>s({...o,maxTokens:e.target.value}),placeholder:"2048",min:"256",max:"8192"})]})]}),(0,ep.jsxs)(t$.TabsContent,{value:"options",className:"space-y-6 pt-4",children:[(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Refresh"}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(m2.Checkbox,{id:"auto-refresh",checked:o.autoRefresh,onCheckedChange:e=>s({...o,autoRefresh:!0===e})}),(0,ep.jsx)("label",{htmlFor:"auto-refresh",className:"text-sm font-medium text-foreground cursor-pointer",children:"Auto-refresh after consolidation"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Refresh mode"}),(0,ep.jsxs)(tR.Select,{value:o.mode,onValueChange:e=>s({...o,mode:e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"full",children:"Full — regenerate from scratch each refresh"}),(0,ep.jsx)(tR.SelectItem,{value:"delta",children:"Delta — surgical edits, preserve unchanged content"})]})]}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Delta mode applies minimal changes to the existing content. Falls back to a full rewrite on the first refresh and whenever the source query changes."})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Other Mental Models"}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(m2.Checkbox,{id:"exclude-mental-models",checked:o.excludeMentalModels,onCheckedChange:e=>s({...o,excludeMentalModels:!0===e})}),(0,ep.jsx)("label",{htmlFor:"exclude-mental-models",className:"text-sm font-medium text-foreground cursor-pointer",children:"Exclude all mental models"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Exclude Mental Model IDs"}),(0,ep.jsx)(eI.Input,{value:o.excludeMentalModelIds,onChange:e=>s({...o,excludeMentalModelIds:e.target.value}),placeholder:"e.g., model-a, model-b (comma-separated)"})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Tags"}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tags"}),(0,ep.jsx)(eI.Input,{value:o.tags,onChange:e=>s({...o,tags:e.target.value}),placeholder:"e.g., project-x, team-alpha (comma-separated)"}),(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Tags scope the model during reflect ",(0,ep.jsx)("strong",{children:"and"})," filter source memories during refresh (default ",(0,ep.jsx)("code",{children:"all_strict"}),": only memories carrying every listed tag are read). If no memories have these tags yet, refresh will produce empty content — backfill tags on memories, or adjust ",(0,ep.jsx)("em",{children:"Tags Match"})," /"," ",(0,ep.jsx)("em",{children:"Tag Groups"})," below."]})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tags Match"}),(0,ep.jsxs)(tR.Select,{value:o.tagsMatch,onValueChange:e=>s({...o,tagsMatch:"default"===e?"":e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{placeholder:"Default (all_strict when tags set)"})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"default",children:"Default (all_strict when tags set)"}),(0,ep.jsx)(tR.SelectItem,{value:"any",children:"any — OR matching, includes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"all",children:"all — AND matching, includes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"any_strict",children:"any_strict — OR matching, excludes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"all_strict",children:"all_strict — AND matching, excludes untagged"})]})]}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Controls how the model's tags filter memories during refresh."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tag Groups (JSON)"}),(0,ep.jsx)(gl.Textarea,{value:o.tagGroups,onChange:e=>s({...o,tagGroups:e.target.value}),placeholder:'e.g., [{"or": [{"tags": ["user:alice"], "match": "all_strict"}, {"tags": ["shared"]}]}]',rows:3,className:"font-mono text-xs"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Compound boolean tag expressions for refresh filtering. Overrides flat tags when set."})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Recall"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Override how the internal recall behaves when this model refreshes. Leave blank to inherit the bank/global default."}),(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Fact Types"}),(0,ep.jsx)(m8,{value:o.factTypes,onChange:e=>s({...o,factTypes:e})}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Leave empty to include all types."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Include chunks"}),(0,ep.jsxs)(tR.Select,{value:o.includeChunks||"default",onValueChange:e=>s({...o,includeChunks:"default"===e?"":e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"default",children:"Default (inherit)"}),(0,ep.jsx)(tR.SelectItem,{value:"true",children:"Yes — include raw chunk text"}),(0,ep.jsx)(tR.SelectItem,{value:"false",children:"No — skip chunks (smaller prompt)"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Recall max tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:o.recallMaxTokens,onChange:e=>s({...o,recallMaxTokens:e.target.value}),placeholder:"Default (inherit)",min:"0"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Token budget for facts returned by recall."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Recall chunks max tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:o.recallChunksMaxTokens,onChange:e=>s({...o,recallChunksMaxTokens:e.target.value}),placeholder:"Default (inherit)",min:"0"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Token budget for raw chunk text returned by recall."})]})]})]})]})]}),(0,ep.jsxs)(tY.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:t,disabled:i,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:l,disabled:i||!o.name.trim()||!o.sourceQuery.trim(),children:i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.default,{className:"w-4 h-4 animate-spin mr-1"}),"Generating..."]}):"Create"})]})]})})}function UN({open:e,mentalModel:t,onClose:n,onUpdated:r}){let{currentBank:i}=(0,ey.useBank)(),[a,o]=(0,em.useState)(!1),s=()=>({name:t.name,sourceQuery:t.source_query,maxTokens:String(t.max_tokens||2048),tags:t.tags.join(", "),autoRefresh:t.trigger?.refresh_after_consolidation||!1,mode:t.trigger?.mode||"full",factTypes:t.trigger?.fact_types||[],excludeMentalModels:t.trigger?.exclude_mental_models||!1,excludeMentalModelIds:(t.trigger?.exclude_mental_model_ids||[]).join(", "),tagsMatch:t.trigger?.tags_match||"",tagGroups:t.trigger?.tag_groups?JSON.stringify(t.trigger.tag_groups,null,2):"",includeChunks:t.trigger?.include_chunks===!0?"true":t.trigger?.include_chunks===!1?"false":"",recallMaxTokens:t.trigger?.recall_max_tokens!=null?String(t.trigger.recall_max_tokens):"",recallChunksMaxTokens:t.trigger?.recall_chunks_max_tokens!=null?String(t.trigger.recall_chunks_max_tokens):""}),[l,c]=(0,em.useState)(s);(0,em.useEffect)(()=>{e&&c(s())},[e,t]);let u=async()=>{if(i&&l.name.trim()&&l.sourceQuery.trim()){o(!0);try{let e,a=l.tags.split(",").map(e=>e.trim()).filter(e=>e.length>0),o=parseInt(l.maxTokens)||2048,s=l.excludeMentalModelIds.split(",").map(e=>e.trim()).filter(e=>e.length>0);if(l.tagGroups.trim())try{e=JSON.parse(l.tagGroups.trim())}catch{ev.toast.error("Invalid JSON in Tag Groups field");return}let c=l.recallMaxTokens.trim()?parseInt(l.recallMaxTokens,10):void 0,u=l.recallChunksMaxTokens.trim()?parseInt(l.recallChunksMaxTokens,10):void 0,d="true"===l.includeChunks||"false"!==l.includeChunks&&void 0,h=await eD.client.updateMentalModel(i,t.id,{name:l.name.trim(),source_query:l.sourceQuery.trim(),tags:a.length>0?a:void 0,max_tokens:o,trigger:{mode:l.mode,refresh_after_consolidation:l.autoRefresh,fact_types:l.factTypes.length>0?l.factTypes:void 0,exclude_mental_models:l.excludeMentalModels||void 0,exclude_mental_model_ids:s.length>0?s:void 0,tags_match:l.tagsMatch||void 0,tag_groups:e,include_chunks:d,recall_max_tokens:c,recall_chunks_max_tokens:u}});r(h),n()}catch(e){}finally{o(!1)}}};return(0,ep.jsx)(tY.Dialog,{open:e,onOpenChange:e=>!e&&n(),children:(0,ep.jsxs)(tY.DialogContent,{className:"sm:max-w-2xl max-h-[90vh] flex flex-col",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsx)(tY.DialogTitle,{children:"Update Mental Model"}),(0,ep.jsx)(tY.DialogDescription,{children:"Update the mental model configuration. Changes will take effect immediately."})]}),(0,ep.jsxs)(t$.Tabs,{defaultValue:"general",className:"py-2 flex-1 flex flex-col min-h-0 overflow-hidden",children:[(0,ep.jsxs)(t$.TabsList,{className:"w-full",children:[(0,ep.jsx)(t$.TabsTrigger,{value:"general",className:"flex-1",children:"General"}),(0,ep.jsx)(t$.TabsTrigger,{value:"options",className:"flex-1",children:"Options"})]}),(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto mt-2 pr-1",children:[(0,ep.jsxs)(t$.TabsContent,{value:"general",className:"space-y-4 pt-4",children:[(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),(0,ep.jsx)(eI.Input,{value:t.id,disabled:!0,className:"bg-muted"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Name *"}),(0,ep.jsx)(eI.Input,{value:l.name,onChange:e=>c({...l,name:e.target.value}),placeholder:"e.g., Team Communication Preferences"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Source Query *"}),(0,ep.jsx)(eI.Input,{value:l.sourceQuery,onChange:e=>c({...l,sourceQuery:e.target.value}),placeholder:"e.g., How does the team prefer to communicate?"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Max Tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:l.maxTokens,onChange:e=>c({...l,maxTokens:e.target.value}),placeholder:"2048",min:"256",max:"8192"})]})]}),(0,ep.jsxs)(t$.TabsContent,{value:"options",className:"space-y-6 pt-4",children:[(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Refresh"}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(m2.Checkbox,{id:"update-auto-refresh",checked:l.autoRefresh,onCheckedChange:e=>c({...l,autoRefresh:!0===e})}),(0,ep.jsx)("label",{htmlFor:"update-auto-refresh",className:"text-sm font-medium text-foreground cursor-pointer",children:"Auto-refresh after consolidation"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Refresh mode"}),(0,ep.jsxs)(tR.Select,{value:l.mode,onValueChange:e=>c({...l,mode:e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"full",children:"Full — regenerate from scratch each refresh"}),(0,ep.jsx)(tR.SelectItem,{value:"delta",children:"Delta — surgical edits, preserve unchanged content"})]})]}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Delta mode applies minimal changes to the existing content. Falls back to a full rewrite on the first refresh and whenever the source query changes."})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Other Mental Models"}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(m2.Checkbox,{id:"update-exclude-mental-models",checked:l.excludeMentalModels,onCheckedChange:e=>c({...l,excludeMentalModels:!0===e})}),(0,ep.jsx)("label",{htmlFor:"update-exclude-mental-models",className:"text-sm font-medium text-foreground cursor-pointer",children:"Exclude all mental models"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Exclude Mental Model IDs"}),(0,ep.jsx)(eI.Input,{value:l.excludeMentalModelIds,onChange:e=>c({...l,excludeMentalModelIds:e.target.value}),placeholder:"e.g., model-a, model-b (comma-separated)"})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Tags"}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tags"}),(0,ep.jsx)(eI.Input,{value:l.tags,onChange:e=>c({...l,tags:e.target.value}),placeholder:"e.g., project-x, team-alpha (comma-separated)"}),(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Tags scope the model during reflect ",(0,ep.jsx)("strong",{children:"and"})," filter source memories during refresh (default ",(0,ep.jsx)("code",{children:"all_strict"}),": only memories carrying every listed tag are read). If no memories have these tags yet, refresh will produce empty content — backfill tags on memories, or adjust ",(0,ep.jsx)("em",{children:"Tags Match"})," /"," ",(0,ep.jsx)("em",{children:"Tag Groups"})," below."]})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tags Match"}),(0,ep.jsxs)(tR.Select,{value:l.tagsMatch||"default",onValueChange:e=>c({...l,tagsMatch:"default"===e?"":e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{placeholder:"Default (all_strict when tags set)"})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"default",children:"Default (all_strict when tags set)"}),(0,ep.jsx)(tR.SelectItem,{value:"any",children:"any — OR matching, includes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"all",children:"all — AND matching, includes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"any_strict",children:"any_strict — OR matching, excludes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"all_strict",children:"all_strict — AND matching, excludes untagged"})]})]}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Controls how the model's tags filter memories during refresh."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tag Groups (JSON)"}),(0,ep.jsx)(gl.Textarea,{value:l.tagGroups,onChange:e=>c({...l,tagGroups:e.target.value}),placeholder:'e.g., [{"or": [{"tags": ["user:alice"], "match": "all_strict"}, {"tags": ["shared"]}]}]',rows:3,className:"font-mono text-xs"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Compound boolean tag expressions for refresh filtering. Overrides flat tags when set."})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Recall"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Override how the internal recall behaves when this model refreshes. Leave blank to inherit the bank/global default."}),(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Fact Types"}),(0,ep.jsx)(m8,{value:l.factTypes,onChange:e=>c({...l,factTypes:e})}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Leave empty to include all types."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Include chunks"}),(0,ep.jsxs)(tR.Select,{value:l.includeChunks||"default",onValueChange:e=>c({...l,includeChunks:"default"===e?"":e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"default",children:"Default (inherit)"}),(0,ep.jsx)(tR.SelectItem,{value:"true",children:"Yes — include raw chunk text"}),(0,ep.jsx)(tR.SelectItem,{value:"false",children:"No — skip chunks (smaller prompt)"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Recall max tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:l.recallMaxTokens,onChange:e=>c({...l,recallMaxTokens:e.target.value}),placeholder:"Default (inherit)",min:"0"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Token budget for facts returned by recall."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Recall chunks max tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:l.recallChunksMaxTokens,onChange:e=>c({...l,recallChunksMaxTokens:e.target.value}),placeholder:"Default (inherit)",min:"0"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Token budget for raw chunk text returned by recall."})]})]})]})]})]}),(0,ep.jsxs)(tY.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:n,disabled:a,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:u,disabled:a||!l.name.trim()||!l.sourceQuery.trim(),children:a?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.default,{className:"w-4 h-4 animate-spin mr-1"}),"Updating..."]}):"Update"})]})]})})}function Uk({mentalModels:e,selectedId:t,onSelect:n,onOpenDetail:r,refreshingIds:i,onEdit:a,onRefresh:o,onDelete:s}){let l=t&&e.some(e=>e.id===t)?t:e[0]?.id??null,c=e.find(e=>e.id===l)??null;return(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-[320px_1fr] gap-0 overflow-hidden min-h-[600px]",children:[(0,ep.jsx)("aside",{className:"border-r border-border bg-muted/30 overflow-y-auto max-h-[calc(100vh-260px)]",children:(0,ep.jsx)("ul",{className:"py-1",children:e.map(e=>{let t=e.id===l;return(0,ep.jsx)("li",{children:(0,ep.jsxs)("button",{onClick:()=>n(e.id),className:`w-full flex items-start gap-2 px-3 py-2 text-left transition-colors border-l-2 ${t?"bg-primary/10 border-primary text-foreground":"border-transparent text-muted-foreground hover:bg-muted hover:text-foreground"}`,title:`${e.name}
9
+ ${e.source_query}`,children:[(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5 flex-shrink-0 mt-0.5"}),(0,ep.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:`truncate text-sm font-medium ${t?"text-foreground":""}`,children:e.name}),(0,ep.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground flex-shrink-0",title:wJ(e.last_refreshed_at),children:wQ(e.last_refreshed_at)})]}),e.source_query&&(0,ep.jsx)("div",{className:"text-xs text-muted-foreground/80 truncate italic mt-0.5",children:e.source_query})]})]})},e.id)})})}),(0,ep.jsx)("section",{className:"overflow-y-auto max-h-[calc(100vh-260px)]",children:c?(0,ep.jsxs)("article",{className:"p-6",children:[(0,ep.jsx)("header",{className:"mb-4 pb-4 border-b border-border",children:(0,ep.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,ep.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ep.jsx)("h2",{className:"text-xl font-semibold text-foreground",children:c.name}),c.source_query&&(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground mt-1 italic",children:["“",c.source_query,"”"]}),(0,ep.jsxs)("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[(0,ep.jsxs)("span",{title:wJ(c.last_refreshed_at),children:["Refreshed ",wQ(c.last_refreshed_at)]}),c.tags.length>0&&(0,ep.jsx)("div",{className:"flex gap-1",children:c.tags.map(e=>(0,ep.jsx)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-blue-500/10 text-blue-600 dark:text-blue-400",children:e},e))})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>r(c),children:"Open"}),(0,ep.jsx)(Uw,{m:c,refreshing:i.has(c.id),onEdit:a,onRefresh:o,onDelete:s})]})]})}),c.content?(0,ep.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:(0,ep.jsx)(wq,{children:c.content})}):(0,ep.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"No content yet. Refresh this mental model to generate content."})]}):(0,ep.jsxs)("div",{className:"p-10 text-center text-muted-foreground",children:[(0,ep.jsx)(eC.FileText,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),(0,ep.jsx)("p",{className:"text-sm",children:"Select a mental model to view its content."})]})})]})}let UE=(0,eN.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var tH=tH;let UC=["consolidation.completed","retain.completed"],U_={url:"",secret:"",event_types:["consolidation.completed"],enabled:!0,http_config:{method:"POST",timeout_seconds:30,headers:[],params:[]}};function US(e){return Object.fromEntries(e.filter(e=>e.key.trim()).map(e=>[e.key,e.value]))}function UT(e){return{method:e.method,timeout_seconds:e.timeout_seconds,headers:US(e.headers),params:US(e.params)}}function UA({label:e,pairs:t,onChange:n}){let r=(e,r,i)=>{n(t.map((t,n)=>n===e?{...t,[r]:i}:t))};return(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)(e8,{children:e}),(0,ep.jsxs)(eL.Button,{type:"button",variant:"ghost",size:"sm",className:"h-6 text-xs px-2",onClick:()=>n([...t,{key:"",value:""}]),children:[(0,ep.jsx)(fz.Plus,{className:"w-3 h-3 mr-1"}),"Add"]})]}),t.length>0&&(0,ep.jsx)("div",{className:"space-y-1.5",children:t.map((e,i)=>(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(eI.Input,{placeholder:"Key",value:e.key,onChange:e=>r(i,"key",e.target.value),className:"h-8 text-sm flex-1"}),(0,ep.jsx)(eI.Input,{placeholder:"Value",value:e.value,onChange:e=>r(i,"value",e.target.value),className:"h-8 text-sm flex-1"}),(0,ep.jsx)("button",{type:"button",onClick:()=>n(t.filter((e,t)=>t!==i)),className:"text-muted-foreground hover:text-foreground shrink-0",children:(0,ep.jsx)(tU.X,{className:"w-4 h-4"})})]},i))})]})}function UO({delivery:e,formatDate:t}){var n;let[r,i]=(0,em.useState)(!1),a=e.last_response_body||e.last_error;return(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)(eQ,{className:a?"cursor-pointer hover:bg-muted/40":void 0,onClick:()=>a&&i(e=>!e),children:[(0,ep.jsx)(e0,{className:"w-8 pl-3 pr-0",children:a?r?(0,ep.jsx)(mW.ChevronDown,{className:"w-4 h-4 text-muted-foreground"}):(0,ep.jsx)(eT.ChevronRight,{className:"w-4 h-4 text-muted-foreground"}):(0,ep.jsx)("span",{className:"w-4 h-4 inline-block"})}),(0,ep.jsx)(e0,{children:"completed"===(n=e.status)?(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ep.jsx)(eY,{className:"w-3 h-3"}),"delivered"]}):"pending"===n?(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,ep.jsx)(eG,{className:"w-3 h-3"}),"pending"]}):"failed"===n?(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,ep.jsx)(jy,{className:"w-3 h-3"}),"failed"]}):(0,ep.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground border border-border",children:n})}),(0,ep.jsx)(e0,{children:null!=e.last_response_status?(0,ep.jsx)("span",{className:`font-mono text-xs px-1.5 py-0.5 rounded border ${e.last_response_status>=200&&e.last_response_status<300?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20"}`,children:e.last_response_status}):(0,ep.jsx)("span",{className:"text-muted-foreground text-xs",children:"—"})}),(0,ep.jsx)(e0,{className:"text-center text-sm",children:e.attempts}),(0,ep.jsx)(e0,{className:"font-mono text-xs text-muted-foreground",children:e.event_type}),(0,ep.jsx)(e0,{className:"text-xs text-muted-foreground whitespace-nowrap",children:t(e.created_at)})]}),r&&a&&(0,ep.jsx)(eQ,{className:"bg-muted/20 hover:bg-muted/20",children:(0,ep.jsx)(e0,{colSpan:6,className:"px-4 py-3",children:(0,ep.jsxs)("div",{className:"space-y-3",children:[e.last_error&&(0,ep.jsxs)("div",{className:"space-y-1",children:[(0,ep.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Error"}),(0,ep.jsx)("p",{className:"font-mono text-xs text-red-600 dark:text-red-400 break-all",children:e.last_error})]}),e.last_response_body&&(0,ep.jsxs)("div",{className:"space-y-1",children:[(0,ep.jsxs)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:["Response Body",e.last_attempt_at&&(0,ep.jsxs)("span",{className:"ml-2 normal-case font-normal",children:["· ",t(e.last_attempt_at)]})]}),(0,ep.jsx)("pre",{className:"font-mono text-xs bg-background rounded p-2 overflow-x-auto whitespace-pre-wrap break-all max-h-40 overflow-y-auto border border-border",children:e.last_response_body})]})]})})})]})}function UM(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(!1),[a,o]=(0,em.useState)(!1),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)(null),[d,h]=(0,em.useState)(null),[f,p]=(0,em.useState)(!1),[g,v]=(0,em.useState)(U_),[x,y]=(0,em.useState)(!1),[b,w]=(0,em.useState)(null),[j,N]=(0,em.useState)(U_),[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(!1),[A,O]=(0,em.useState)(!1),[M,P]=(0,em.useState)(null),[D,L]=(0,em.useState)([]),[I,R]=(0,em.useState)(!1),[B,z]=(0,em.useState)(null),[F,V]=(0,em.useState)(!1),U=async()=>{if(e){i(!0);try{let t=await eD.client.listWebhooks(e);n(t.items||[])}catch(e){console.error("Error loading webhooks:",e)}finally{i(!1)}}};(0,em.useEffect)(()=>{e&&U()},[e]);let H=async()=>{if(e&&g.url){l(!0);try{await eD.client.createWebhook(e,{url:g.url,secret:g.secret||void 0,event_types:g.event_types.length>0?g.event_types:void 0,enabled:g.enabled,http_config:UT(g.http_config)}),o(!1),v(U_),p(!1),await U()}catch(e){}finally{l(!1)}}},W=async t=>{if(e){u(t),h(null);try{await eD.client.deleteWebhook(e,t),await U()}catch(e){}finally{u(null)}}},Y=async()=>{if(e&&b&&j.url){T(!0);try{let t={url:j.url,event_types:j.event_types,enabled:j.enabled,http_config:UT(j.http_config)};C?t.secret=null:j.secret&&(t.secret=j.secret),await eD.client.updateWebhook(e,b.id,t),y(!1),await U()}catch{}finally{T(!1)}}},G=async t=>{if(e){P(t),O(!0),L([]),z(null),R(!0);try{let n=await eD.client.listWebhookDeliveries(e,t.id,50);L(n.items||[]),z(n.next_cursor??null)}catch(e){console.error("Error loading deliveries:",e)}finally{R(!1)}}},$=async()=>{if(e&&M&&B){V(!0);try{let t=await eD.client.listWebhookDeliveries(e,M.id,50,B);L(e=>[...e,...t.items||[]]),z(t.next_cursor??null)}catch(e){console.error("Error loading more deliveries:",e)}finally{V(!1)}}},X=e=>e?new Date(e).toLocaleString():"N/A";return e?(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("h3",{className:"text-lg font-semibold",children:"Webhooks"}),(0,ep.jsx)("button",{onClick:()=>U(),className:"p-1 rounded hover:bg-muted transition-colors",title:"Refresh webhooks",disabled:r,children:(0,ep.jsx)(eW,{className:`w-4 h-4 text-muted-foreground hover:text-foreground ${r?"animate-spin":""}`})})]}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground",children:[t.length," webhook",1!==t.length?"s":""]})]}),(0,ep.jsxs)(eL.Button,{size:"sm",onClick:()=>o(!0),children:[(0,ep.jsx)(fz.Plus,{className:"w-4 h-4 mr-2"}),"Add Webhook"]})]}),t.length>0?(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{children:"URL"}),(0,ep.jsx)(eJ,{children:"Method"}),(0,ep.jsx)(eJ,{children:"Event Types"}),(0,ep.jsx)(eJ,{children:"Status"}),(0,ep.jsx)(eJ,{children:"Created At"}),(0,ep.jsx)(eJ,{className:"w-[120px]"})]})}),(0,ep.jsx)(eZ,{children:t.map(e=>(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(e0,{className:"font-mono text-sm max-w-[300px] truncate",children:(0,ep.jsx)("span",{title:e.url,children:e.url})}),(0,ep.jsx)(e0,{children:(0,ep.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-mono font-medium bg-muted text-muted-foreground border border-border",children:e.http_config?.method||"POST"})}),(0,ep.jsx)(e0,{children:(0,ep.jsx)("div",{className:"flex flex-wrap gap-1",children:e.event_types.length>0?e.event_types.map(e=>(0,ep.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/20",children:e},e)):(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:"All events"})})}),(0,ep.jsx)(e0,{children:e.enabled?(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ep.jsx)(eY,{className:"w-3 h-3"}),"Enabled"]}):(0,ep.jsx)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground border border-border",children:"Disabled"})}),(0,ep.jsx)(e0,{className:"text-sm text-muted-foreground",children:X(e.created_at)}),(0,ep.jsx)(e0,{children:(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsxs)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>G(e),title:"View deliveries",children:[(0,ep.jsx)(eH,{className:"w-3 h-3 mr-1"}),"Deliveries"]}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{let t;return w(e),void(N((t=e.http_config??{method:"POST",timeout_seconds:30,headers:{},params:{}},{url:e.url,secret:"",event_types:e.event_types,enabled:e.enabled,http_config:{method:t.method,timeout_seconds:t.timeout_seconds,headers:Object.entries(t.headers??{}).map(([e,t])=>({key:e,value:t})),params:Object.entries(t.params??{}).map(([e,t])=>({key:e,value:t}))}})),E(!1),_(!1),y(!0))},title:"Edit webhook",children:(0,ep.jsx)(mU,{className:"w-3 h-3"})}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-red-600 dark:hover:text-red-400",onClick:()=>h(e),disabled:c===e.id,title:"Delete webhook",children:c===e.id?(0,ep.jsx)(tH.default,{className:"w-3 h-3 animate-spin"}):(0,ep.jsx)(mV,{className:"w-3 h-3"})})]})})]},e.id))})]})}):(0,ep.jsx)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:"No webhooks configured. Add a webhook to receive event notifications."}),(0,ep.jsx)(tY.Dialog,{open:a,onOpenChange:e=>{e||(v(U_),p(!1)),o(e)},children:(0,ep.jsxs)(tY.DialogContent,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsx)(tY.DialogTitle,{children:"Add Webhook"}),(0,ep.jsx)(tY.DialogDescription,{children:"Configure a webhook endpoint to receive event notifications."})]}),(0,ep.jsxs)("div",{className:"space-y-4 py-2",children:[(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{children:"Type"}),(0,ep.jsx)("div",{className:"flex items-center h-9 px-3 rounded-md border border-border bg-muted text-sm text-muted-foreground",children:"HTTP"})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsxs)(e8,{htmlFor:"webhook-url",children:["URL ",(0,ep.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,ep.jsx)(eI.Input,{id:"webhook-url",type:"url",placeholder:"https://example.com/webhook",value:g.url,onChange:e=>v(t=>({...t,url:e.target.value}))})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{children:"Method"}),(0,ep.jsxs)(tR.Select,{value:g.http_config.method,onValueChange:e=>v(t=>({...t,http_config:{...t.http_config,method:e}})),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"POST",children:"POST"}),(0,ep.jsx)(tR.SelectItem,{value:"GET",children:"GET"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{htmlFor:"webhook-timeout",children:"Timeout (seconds)"}),(0,ep.jsx)(eI.Input,{id:"webhook-timeout",type:"number",min:1,max:300,value:g.http_config.timeout_seconds,onChange:e=>v(t=>({...t,http_config:{...t.http_config,timeout_seconds:parseInt(e.target.value)||30}}))})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsxs)(e8,{htmlFor:"webhook-secret",children:["Secret ",(0,ep.jsx)("span",{className:"text-muted-foreground text-xs",children:"(optional)"})]}),(0,ep.jsxs)("div",{className:"relative",children:[(0,ep.jsx)(eI.Input,{id:"webhook-secret",type:f?"text":"password",placeholder:"Signing secret",value:g.secret,onChange:e=>v(t=>({...t,secret:e.target.value})),className:"pr-10"}),(0,ep.jsx)("button",{type:"button",onClick:()=>p(e=>!e),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:f?(0,ep.jsx)(UE,{className:"w-4 h-4"}):(0,ep.jsx)(eH,{className:"w-4 h-4"})})]})]}),(0,ep.jsx)(UA,{label:"Custom Headers",pairs:g.http_config.headers,onChange:e=>v(t=>({...t,http_config:{...t.http_config,headers:e}}))}),(0,ep.jsx)(UA,{label:"Query Parameters",pairs:g.http_config.params,onChange:e=>v(t=>({...t,http_config:{...t.http_config,params:e}}))}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)(e8,{children:"Event Types"}),(0,ep.jsx)("div",{className:"space-y-2",children:UC.map(e=>(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(m2.Checkbox,{id:`event-${e}`,checked:g.event_types.includes(e),onCheckedChange:()=>{v(t=>({...t,event_types:t.event_types.includes(e)?t.event_types.filter(t=>t!==e):[...t.event_types,e]}))}}),(0,ep.jsx)(e8,{htmlFor:`event-${e}`,className:"font-mono text-sm cursor-pointer",children:e})]},e))})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsx)(tI.Switch,{id:"webhook-enabled",checked:g.enabled,onCheckedChange:e=>v(t=>({...t,enabled:e}))}),(0,ep.jsx)(e8,{htmlFor:"webhook-enabled",children:"Enabled"})]})]}),(0,ep.jsxs)(tY.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:()=>o(!1),disabled:s,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:H,disabled:s||!g.url,children:s?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):"Create Webhook"})]})]})}),(0,ep.jsx)(tY.Dialog,{open:x,onOpenChange:e=>{e||(w(null),N(U_),E(!1),_(!1)),y(e)},children:(0,ep.jsxs)(tY.DialogContent,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsx)(tY.DialogTitle,{children:"Edit Webhook"}),(0,ep.jsx)(tY.DialogDescription,{children:"Update the webhook configuration."})]}),(0,ep.jsxs)("div",{className:"space-y-4 py-2",children:[(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{children:"Type"}),(0,ep.jsx)("div",{className:"flex items-center h-9 px-3 rounded-md border border-border bg-muted text-sm text-muted-foreground",children:"HTTP"})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsxs)(e8,{htmlFor:"edit-webhook-url",children:["URL ",(0,ep.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,ep.jsx)(eI.Input,{id:"edit-webhook-url",type:"url",placeholder:"https://example.com/webhook",value:j.url,onChange:e=>N(t=>({...t,url:e.target.value}))})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{children:"Method"}),(0,ep.jsxs)(tR.Select,{value:j.http_config.method,onValueChange:e=>N(t=>({...t,http_config:{...t.http_config,method:e}})),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"POST",children:"POST"}),(0,ep.jsx)(tR.SelectItem,{value:"GET",children:"GET"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{htmlFor:"edit-webhook-timeout",children:"Timeout (seconds)"}),(0,ep.jsx)(eI.Input,{id:"edit-webhook-timeout",type:"number",min:1,max:300,value:j.http_config.timeout_seconds,onChange:e=>N(t=>({...t,http_config:{...t.http_config,timeout_seconds:parseInt(e.target.value)||30}}))})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{htmlFor:"edit-webhook-secret",children:"Secret"}),(0,ep.jsxs)("div",{className:"relative",children:[(0,ep.jsx)(eI.Input,{id:"edit-webhook-secret",type:k?"text":"password",placeholder:"Leave blank to keep existing",value:j.secret,disabled:C,onChange:e=>N(t=>({...t,secret:e.target.value})),className:"pr-10"}),(0,ep.jsx)("button",{type:"button",onClick:()=>E(e=>!e),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:k?(0,ep.jsx)(UE,{className:"w-4 h-4"}):(0,ep.jsx)(eH,{className:"w-4 h-4"})})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,ep.jsx)(m2.Checkbox,{id:"edit-clear-secret",checked:C,onCheckedChange:e=>{_(!!e),e&&N(e=>({...e,secret:""}))}}),(0,ep.jsx)(e8,{htmlFor:"edit-clear-secret",className:"text-xs text-muted-foreground cursor-pointer",children:"Clear existing secret"})]})]}),(0,ep.jsx)(UA,{label:"Custom Headers",pairs:j.http_config.headers,onChange:e=>N(t=>({...t,http_config:{...t.http_config,headers:e}}))}),(0,ep.jsx)(UA,{label:"Query Parameters",pairs:j.http_config.params,onChange:e=>N(t=>({...t,http_config:{...t.http_config,params:e}}))}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)(e8,{children:"Event Types"}),(0,ep.jsx)("div",{className:"space-y-2",children:UC.map(e=>(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(m2.Checkbox,{id:`edit-event-${e}`,checked:j.event_types.includes(e),onCheckedChange:()=>N(t=>({...t,event_types:t.event_types.includes(e)?t.event_types.filter(t=>t!==e):[...t.event_types,e]}))}),(0,ep.jsx)(e8,{htmlFor:`edit-event-${e}`,className:"font-mono text-sm cursor-pointer",children:e})]},e))})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsx)(tI.Switch,{id:"edit-webhook-enabled",checked:j.enabled,onCheckedChange:e=>N(t=>({...t,enabled:e}))}),(0,ep.jsx)(e8,{htmlFor:"edit-webhook-enabled",children:"Enabled"})]})]}),(0,ep.jsxs)(tY.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:()=>y(!1),disabled:S,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:Y,disabled:S||!j.url,children:S?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})}),(0,ep.jsx)(tY.Dialog,{open:!!d,onOpenChange:e=>{e||h(null)},children:(0,ep.jsxs)(tY.DialogContent,{className:"max-w-md",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsx)(tY.DialogTitle,{children:"Delete Webhook"}),(0,ep.jsx)(tY.DialogDescription,{children:"Are you sure you want to delete this webhook? This action cannot be undone and all pending deliveries will be cancelled."})]}),d&&(0,ep.jsx)("div",{className:"py-2",children:(0,ep.jsx)("p",{className:"font-mono text-sm truncate text-muted-foreground bg-muted px-3 py-2 rounded-md border border-border",children:d.url})}),(0,ep.jsxs)(tY.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),(0,ep.jsx)(eL.Button,{variant:"destructive",onClick:()=>d&&W(d.id),disabled:!!c,children:c?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Deleting..."]}):"Delete Webhook"})]})]})}),(0,ep.jsx)(tY.Dialog,{open:A,onOpenChange:e=>{e||(L([]),z(null)),O(e)},children:(0,ep.jsxs)(tY.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[(0,ep.jsxs)(tY.DialogHeader,{children:[(0,ep.jsx)(tY.DialogTitle,{children:"Webhook Deliveries"}),M&&(0,ep.jsx)(tY.DialogDescription,{className:"font-mono text-xs truncate",children:M.url})]}),I?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)(tH.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):D.length>0?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-8 pl-3 pr-0"}),(0,ep.jsx)(eJ,{children:"Status"}),(0,ep.jsx)(eJ,{children:"HTTP"}),(0,ep.jsx)(eJ,{className:"text-center",children:"Attempts"}),(0,ep.jsx)(eJ,{children:"Event"}),(0,ep.jsx)(eJ,{children:"Created At"})]})}),(0,ep.jsx)(eZ,{children:D.map(e=>(0,ep.jsx)(UO,{delivery:e,formatDate:X},e.id))})]})}),B&&(0,ep.jsx)("div",{className:"flex justify-center pt-2",children:(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",onClick:$,disabled:F,children:[F&&(0,ep.jsx)(tH.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Load more"]})})]}):(0,ep.jsx)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:"No deliveries yet for this webhook."})]})})]}):null}var UP=["axis"],UD=(0,em.forwardRef)((e,t)=>em.createElement(Rk,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:UP,tooltipPayloadSearcher:Eu,categoricalChartProps:e,ref:t})),UL=em,UI=["children"],UR=(0,em.createContext)({data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0});function UB(e){var{children:t}=e,n=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,UI);return em.createElement(UR.Provider,{value:n},t)}var Uz=(e,t,n,r)=>P1(e,"xAxis",t,r),UF=(e,t,n,r)=>P0(e,"xAxis",t,r),UV=(e,t,n,r)=>P1(e,"yAxis",n,r),UU=(e,t,n,r)=>P0(e,"yAxis",n,r),UH=ke([_A,Uz,UV,UF,UU],(e,t,n,r,i)=>Cq(e,"xAxis")?C2(t,r,!1):C2(n,i,!1));function UW(e){return"line"===e.type}var UY=ke([MM,(e,t,n,r,i)=>i],(e,t)=>e.filter(UW).find(e=>e.id===t)),UG=ke([_A,Uz,UV,UF,UU,UY,UH,OC],(e,t,n,r,i,a,o,s)=>{var l,{chartData:c,dataStartIndex:u,dataEndIndex:d}=s;if(null!=a&&null!=t&&null!=n&&null!=r&&null!=i&&0!==r.length&&0!==i.length&&null!=o&&("horizontal"===e||"vertical"===e)){var{dataKey:h,data:f}=a;if(null!=(l=null!=f&&f.length>0?f:null==c?void 0:c.slice(u,d+1)))return function(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,dataKey:o,bandSize:s,displayedData:l}=e;return l.map((e,l)=>{var c=CX(e,o);if("horizontal"===t)return{x:CJ({axis:n,ticks:i,bandSize:s,entry:e,index:l}),y:null==c?null:r.scale(c),value:c,payload:e};var u=null==c?null:n.scale(c),d=CJ({axis:r,ticks:a,bandSize:s,entry:e,index:l});return null==u||null==d?null:{x:u,y:d,value:c,payload:e}}).filter(Boolean)}({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:h,bandSize:o,displayedData:l})}}),U$=e.i(7328);function UX(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Uq(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?UX(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):UX(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function UK(){return(UK=Object.assign.bind()).apply(null,arguments)}function UZ(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var UQ=(e,t,n,r,i)=>{var a=n-r;return k4(ec||(ec=UZ(["M ",",",""])),e,t)+k4(eu||(eu=UZ(["L ",",",""])),e+n,t)+k4(ed||(ed=UZ(["L ",",",""])),e+n-a/2,t+i)+k4(eh||(eh=UZ(["L ",",",""])),e+n-a/2-r,t+i)+k4(ef||(ef=UZ(["L ",","," Z"])),e,t)},UJ={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},U0=e=>{var t=Rw(e,UJ),{x:n,y:r,upperWidth:i,lowerWidth:a,height:o,className:s}=t,{animationEasing:l,animationDuration:c,animationBegin:u,isUpdateAnimationActive:d}=t,h=(0,em.useRef)(null),[f,p]=(0,em.useState)(-1),g=(0,em.useRef)(i),v=(0,em.useRef)(a),x=(0,em.useRef)(o),y=(0,em.useRef)(n),b=(0,em.useRef)(r),w=z_(e,"trapezoid-");if((0,em.useEffect)(()=>{if(h.current&&h.current.getTotalLength)try{var e=h.current.getTotalLength();e&&p(e)}catch(e){}},[]),n!==+n||r!==+r||i!==+i||a!==+a||o!==+o||0===i&&0===a||0===o)return null;var j=(0,_u.clsx)("recharts-trapezoid",s);if(!d)return em.createElement("g",null,em.createElement("path",UK({},IG(t),{className:j,d:UQ(n,r,i,a,o)})));var N=g.current,k=v.current,E=x.current,C=y.current,_=b.current,S="0px ".concat(-1===f?1:f,"px"),T="".concat(f,"px 0px"),A=zD(["strokeDasharray"],c,l);return em.createElement(zQ,{animationId:w,key:w,canBegin:f>0,duration:c,easing:l,isActive:d,begin:u},e=>{var s=Ea(N,i,e),l=Ea(k,a,e),c=Ea(E,o,e),u=Ea(C,n,e),d=Ea(_,r,e);h.current&&(g.current=s,v.current=l,x.current=c,y.current=u,b.current=d);var f=e>0?{transition:A,strokeDasharray:T}:{strokeDasharray:S};return em.createElement("path",UK({},IG(t),{className:j,d:UQ(u,d,s,l,c),ref:h,style:Uq(Uq({},f),t.style)}))})};let U1=Math.cos,U2=Math.sin,U5=Math.sqrt,U3=Math.PI,U4=2*U3;U5(3);let U6={draw(e,t){let n=U5(t/U3);e.moveTo(n,0),e.arc(0,0,n,0,U4)}},U8=U5(1/3),U7=2*U8,U9=U2(U3/10)/U2(7*U3/10),He=U2(U4/10)*U9,Ht=-U1(U4/10)*U9,Hn=U5(3);U5(3);let Hr=U5(3)/2,Hi=1/U5(12),Ha=(Hi/2+1)*3;var Ho=["type","size","sizeType"];function Hs(){return(Hs=Object.assign.bind()).apply(null,arguments)}function Hl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hl(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Hu={symbolCircle:U6,symbolCross:{draw(e,t){let n=U5(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},symbolDiamond:{draw(e,t){let n=U5(t/U7),r=n*U8;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},symbolSquare:{draw(e,t){let n=U5(t),r=-n/2;e.rect(r,r,n,n)}},symbolStar:{draw(e,t){let n=U5(.8908130915292852*t),r=He*n,i=Ht*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=U4*t/5,o=U1(a),s=U2(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},symbolTriangle:{draw(e,t){let n=-U5(t/(3*Hn));e.moveTo(0,2*n),e.lineTo(-Hn*n,-n),e.lineTo(Hn*n,-n),e.closePath()}},symbolWye:{draw(e,t){let n=U5(t/Ha),r=n/2,i=n*Hi,a=n*Hi+n,o=-r;e.moveTo(r,i),e.lineTo(r,a),e.lineTo(o,a),e.lineTo(-.5*r-Hr*i,Hr*r+-.5*i),e.lineTo(-.5*r-Hr*a,Hr*r+-.5*a),e.lineTo(-.5*o-Hr*a,Hr*o+-.5*a),e.lineTo(-.5*r+Hr*i,-.5*i-Hr*r),e.lineTo(-.5*r+Hr*a,-.5*a-Hr*r),e.lineTo(-.5*o+Hr*a,-.5*a-Hr*o),e.closePath()}}},Hd=Math.PI/180,Hh=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,i=Hc(Hc({},function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Ho)),{},{type:t,size:n,sizeType:r}),a="circle";"string"==typeof t&&(a=t);var{className:o,cx:s,cy:l}=i,c=IG(i);return k9(s)&&k9(l)&&k9(n)?em.createElement("path",Hs({},c,{className:(0,_u.clsx)("recharts-symbols",o),transform:"translate(".concat(s,", ").concat(l,")"),d:(()=>{var e,t=(e=a,Hu["symbol".concat(Es(e))]||U6),i=(function(e,t){let n=null,r=RL(i);function i(){let i;if(n||(n=i=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return e="function"==typeof e?e:CB(e||U6),t="function"==typeof t?t:CB(void 0===t?64:+t),i.type=function(t){return arguments.length?(e="function"==typeof t?t:CB(t),i):e},i.size=function(e){return arguments.length?(t="function"==typeof e?e:CB(+e),i):t},i.context=function(e){return arguments.length?(n=null==e?null:e,i):n},i})().type(t).size(((e,t,n)=>{if("area"===t)return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":var r=18*Hd;return 1.25*e*e*(Math.tan(r)-Math.tan(2*r)*Math.tan(r)**2);case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}})(n,r,a))();if(null!==i)return i})()})):null};Hh.registerSymbol=(e,t)=>{Hu["symbol".concat(Es(e))]=t};var Hf=["option","shapeType","activeClassName"];function Hp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hp(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hp(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Hg(e){var{shapeType:t,elementProps:n}=e;switch(t){case"rectangle":return em.createElement(Vd,n);case"trapezoid":return em.createElement(U0,n);case"sector":return em.createElement(Vx,n);case"symbols":if("symbols"===t)return em.createElement(Hh,n);break;case"curve":return em.createElement(Bn,n);default:return null}}function Hv(e){var t,{option:n,shapeType:r,activeClassName:i="recharts-active-shape"}=e,a=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Hf);if((0,em.isValidElement)(n))t=(0,em.cloneElement)(n,Hm(Hm({},a),(0,em.isValidElement)(n)?n.props:n));else if("function"==typeof n)t=n(a,a.index);else if((0,U$.default)(n)&&"boolean"!=typeof n){var o=Hm(Hm({},a),n);t=em.createElement(Hg,{shapeType:r,elementProps:o})}else t=em.createElement(Hg,{shapeType:r,elementProps:a});return a.isActive?em.createElement(Ba,{className:i},t):t}var Hx=["id"],Hy=["type","layout","connectNulls","needClip","shape"],Hb=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function Hw(){return(Hw=Object.assign.bind()).apply(null,arguments)}function Hj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function HN(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hj(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hj(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Hk(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var HE=UL.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:l,tooltipType:c,id:u}=e,d={dataDefinedOnItem:n,positions:void 0,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:C3(o,t),hide:s,type:c,color:r,unit:l,graphicalItemId:u}};return UL.createElement(zh,{tooltipEntrySettings:d})}),HC=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function H_(e){var{clipPathId:t,points:n,props:r}=e,{dot:i,dataKey:a,needClip:o}=r,{id:s}=r,l=IW(Hk(r,Hx));return UL.createElement(zs,{points:n,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:a,baseProps:l,needClip:o,clipPathId:t})}function HS(e){var{showLabels:t,children:n,points:r}=e,i=(0,UL.useMemo)(()=>null==r?void 0:r.map(e=>{var t,n,r={x:null!=(t=e.x)?t:0,y:null!=(n=e.y)?n:0,width:0,lowerWidth:0,upperWidth:0,height:0};return HN(HN({},r),{},{value:e.value,payload:e.payload,viewBox:r,parentViewBox:void 0,fill:void 0})}),[r]);return UL.createElement(B4,{value:t?i:void 0},n)}function HT(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:i,props:a}=e,{type:o,layout:s,connectNulls:l,needClip:c,shape:u}=a,d=HN(HN({},IG(Hk(a,Hy))),{},{fill:"none",className:"recharts-line-curve",clipPath:c?"url(#clipPath-".concat(t,")"):void 0,points:r,type:o,layout:s,connectNulls:l,strokeDasharray:null!=i?i:a.strokeDasharray});return UL.createElement(UL.Fragment,null,(null==r?void 0:r.length)>1&&UL.createElement(Hv,Hw({shapeType:"curve",option:u},d,{pathRef:n})),UL.createElement(H_,{points:r,clipPathId:t,props:a}))}function HA(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:i,longestAnimatedLengthRef:a}=e,{points:o,strokeDasharray:s,isAnimationActive:l,animationBegin:c,animationDuration:u,animationEasing:d,animateNewValues:h,width:f,height:p,onAnimationEnd:g,onAnimationStart:v}=n,x=i.current,y=z_(o,"recharts-line-"),b=(0,UL.useRef)(y),[w,j]=(0,UL.useState)(!1),N=(0,UL.useCallback)(()=>{"function"==typeof g&&g(),j(!1)},[g]),k=(0,UL.useCallback)(()=>{"function"==typeof v&&v(),j(!0)},[v]),E=function(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch(e){return 0}}(r.current),C=(0,UL.useRef)(0);b.current!==y&&(C.current=a.current,b.current=y);var _=C.current;return UL.createElement(HS,{points:o,showLabels:!w},n.children,UL.createElement(zQ,{animationId:y,begin:c,duration:u,isActive:l,easing:d,onAnimationEnd:N,onAnimationStart:k,key:y},e=>{var c,u=Math.min(Ea(_,E+_,e),E);if(c=l?s?((e,t,n)=>{var r=n.reduce((e,t)=>e+t);if(!r)return HC(t,e);for(var i=Math.floor(e/r),a=e%r,o=t-e,s=[],l=0,c=0;l<n.length;c+=n[l],++l)if(c+n[l]>a){s=[...n.slice(0,l),a-c];break}var u=s.length%2==0?[0,o]:[o];return[...function(e,t){for(var n=e.length%2!=0?[...e,0]:e,r=[],i=0;i<t;++i)r=[...r,...n];return r}(n,i),...s,...u].map(e=>"".concat(e,"px")).join(", ")})(u,E,"".concat(s).split(/[,\s]+/gim).map(e=>parseFloat(e))):HC(E,u):null==s?void 0:String(s),e>0&&E>0&&(i.current=o,a.current=Math.max(a.current,u)),x){var d=x.length/o.length,g=1===e?o:o.map((t,n)=>{var r=Math.floor(n*d);if(x[r]){var i=x[r];return HN(HN({},t),{},{x:Ea(i.x,t.x,e),y:Ea(i.y,t.y,e)})}return h?HN(HN({},t),{},{x:Ea(2*f,t.x,e),y:Ea(p/2,t.y,e)}):HN(HN({},t),{},{x:t.x,y:t.y})});return i.current=g,UL.createElement(HT,{props:n,points:g,clipPathId:t,pathRef:r,strokeDasharray:c})}return UL.createElement(HT,{props:n,points:o,clipPathId:t,pathRef:r,strokeDasharray:c})}),UL.createElement(B7,{label:n.label}))}function HO(e){var{clipPathId:t,props:n}=e,r=(0,UL.useRef)(null),i=(0,UL.useRef)(0),a=(0,UL.useRef)(null);return UL.createElement(HA,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:i,pathRef:a})}var HM=(e,t)=>{var n,r;return{x:null!=(n=e.x)?n:void 0,y:null!=(r=e.y)?r:void 0,value:e.value,errorVal:CX(e.payload,t)}};class HP extends UL.Component{render(){var{hide:e,dot:t,points:n,className:r,xAxisId:i,yAxisId:a,top:o,left:s,width:l,height:c,id:u,needClip:d,zIndex:h}=this.props;if(e)return null;var f=(0,_u.clsx)("recharts-line",r),{r:p,strokeWidth:g}=zJ(t),v=zt(t),x=2*p+g,y=d?"url(#clipPath-".concat(v?"":"dots-").concat(u,")"):void 0;return UL.createElement(BR,{zIndex:h},UL.createElement(Ba,{className:f},d&&UL.createElement("defs",null,UL.createElement(zp,{clipPathId:u,xAxisId:i,yAxisId:a}),!v&&UL.createElement("clipPath",{id:"clipPath-dots-".concat(u)},UL.createElement("rect",{x:s-x/2,y:o-x/2,width:l+x,height:c+x}))),UL.createElement(UB,{xAxisId:i,yAxisId:a,data:n,dataPointFormatter:HM,errorBarOffset:0},UL.createElement(HO,{props:this.props,clipPathId:u}))),UL.createElement(zd,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:y}))}}var HD={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:O1.line,type:"linear"};function HL(e){var t=Rw(e,HD),{activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:s,dot:l,hide:c,isAnimationActive:u,label:d,legendType:h,xAxisId:f,yAxisId:p,id:g}=t,v=Hk(t,Hb),{needClip:x}=zf(f,p),y=CD(Rm),b=CD(_A),w=_s(),j=CD(e=>UG(e,f,p,w,g));if("horizontal"!==b&&"vertical"!==b||null==j||null==y)return null;var{height:N,width:k,x:E,y:C}=y;return UL.createElement(HP,Hw({},v,{id:g,connectNulls:s,dot:l,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:c,label:d,legendType:h,xAxisId:f,yAxisId:p,points:j,layout:b,height:N,width:k,left:E,top:C,needClip:x}))}var HI=UL.memo(function(e){var t=Rw(e,HD),n=_s();return UL.createElement(zA,{id:t.id,type:"line"},e=>UL.createElement(UL.Fragment,null,UL.createElement(zC,{legendPayload:(e=>{var{dataKey:t,name:n,stroke:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:C3(n,t),payload:e}]})(t)}),UL.createElement(HE,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),UL.createElement(zO,{type:"line",id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),UL.createElement(HL,Hw({},t,{id:e}))))},IL);HI.displayName="Line";let HR=[{value:"all",label:"All actions"},{value:"retain",label:"Retain"},{value:"recall",label:"Recall"},{value:"reflect",label:"Reflect"},{value:"create_bank",label:"Create Bank"},{value:"update_bank",label:"Update Bank"},{value:"delete_bank",label:"Delete Bank"},{value:"clear_memories",label:"Clear Memories"},{value:"consolidation",label:"Consolidation"},{value:"batch_retain",label:"Batch Retain"},{value:"create_mental_model",label:"Create Mental Model"},{value:"refresh_mental_model",label:"Refresh Mental Model"},{value:"delete_mental_model",label:"Delete Mental Model"},{value:"create_directive",label:"Create Directive"},{value:"delete_directive",label:"Delete Directive"},{value:"file_convert_retain",label:"File Convert & Retain"},{value:"webhook_delivery",label:"Webhook Delivery"}],HB=[{value:"all",label:"All transports"},{value:"http",label:"HTTP"},{value:"mcp",label:"MCP"},{value:"system",label:"System"}],Hz=[{value:"1d",label:"Today"},{value:"7d",label:"Last 7 days"},{value:"30d",label:"Last 30 days"}];function HF(e,t){if(!e||!t)return"—";let n=new Date(e).getTime(),r=new Date(t).getTime()-n;return r<1e3?`${r}ms`:r<6e4?`${(r/1e3).toFixed(1)}s`:`${(r/6e4).toFixed(1)}m`}function HV(e){return e?new Date(e).toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"—"}function HU({transport:e}){let t={http:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",mcp:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",system:"bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-300"};return(0,ep.jsx)("span",{className:`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${t[e]||t.system}`,children:e})}function HH({bankId:e}){let[t,n]=(0,em.useState)("7d"),[r,i]=(0,em.useState)(null),[a,o]=(0,em.useState)([]),[s,l]=(0,em.useState)("day"),[c,u]=(0,em.useState)(!1),d=(0,em.useCallback)(async(n=t,i=r)=>{u(!0);try{let t=await eD.client.getAuditLogStats(e,{period:n,action:i||void 0});o(t.buckets||[]),l(t.trunc||"day")}catch(e){console.error("Error loading audit stats:",e)}finally{u(!1)}},[e,t,r]);(0,em.useEffect)(()=>{d()},[e]);let h=a.map(e=>{var t;let n;return{time:(t=e.time,n=new Date(t),"hour"===s?n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):n.toLocaleDateString(void 0,{month:"short",day:"numeric"})),total:e.total}});return(0,ep.jsxs)(m7,{children:[(0,ep.jsxs)(m9,{className:"pb-2 flex flex-row items-center justify-between space-y-0 gap-3",children:[(0,ep.jsx)(ge,{className:"text-sm font-semibold",children:"Request Volume"}),(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsxs)(tR.Select,{value:r||"all",onValueChange:e=>{let n="all"===e?null:e;i(n),d(t,n)},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-[160px] h-8 text-xs",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsx)(tR.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:HR.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e.value,children:e.label},e.value))})]}),Hz.map(e=>(0,ep.jsx)(eL.Button,{variant:t===e.value?"default":"outline",size:"sm",className:"h-8 text-xs",onClick:()=>{n(e.value),d(e.value,r)},children:e.label},e.value))]})]}),(0,ep.jsx)(gn,{children:(0,ep.jsx)("div",{className:"h-[120px]",children:c?(0,ep.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading..."}):0===h.length?(0,ep.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"No data for this period"}):(0,ep.jsx)(_E,{width:"100%",height:"100%",children:(0,ep.jsxs)(UD,{data:h,margin:{top:5,right:5,bottom:0,left:5},children:[(0,ep.jsx)(Fz,{dataKey:"time",tick:{fontSize:10},axisLine:!1,tickLine:!1,className:"text-muted-foreground"}),(0,ep.jsx)(VM,{contentStyle:{backgroundColor:"var(--popover)",border:"1px solid var(--border)",borderRadius:"6px",fontSize:"12px",padding:"4px 8px"}}),(0,ep.jsx)(HI,{type:"monotone",dataKey:"total",stroke:"var(--primary)",strokeWidth:2,dot:!1,activeDot:{r:3}})]})})})})]})}function HW(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(0),[a,o]=(0,em.useState)(null),[s,l]=(0,em.useState)(null),[c,u]=(0,em.useState)("all"),[d]=(0,em.useState)(20),[h,f]=(0,em.useState)(0),[p,g]=(0,em.useState)(!1),[v,x]=(0,em.useState)(null),[y,b]=(0,em.useState)(!1),w=(0,em.useCallback)(e=>{if("all"===e)return{};let t=new Date,n=new Date;return"1h"===e?n.setHours(t.getHours()-1):"1d"===e?n.setDate(t.getDate()-1):"7d"===e?n.setDate(t.getDate()-7):"30d"===e&&n.setDate(t.getDate()-30),{start_date:n.toISOString()}},[]),j=(0,em.useCallback)(async(t=a,r=s,o=c,l=h)=>{if(e){g(!0);try{let a=w(o),s=await eD.client.listAuditLogs(e,{action:t||void 0,transport:r||void 0,start_date:a.start_date,end_date:a.end_date,limit:d,offset:l});n(s.items||[]),i(s.total||0)}catch(e){console.error("Error loading audit logs:",e)}finally{g(!1)}}},[e,a,s,c,h,d,w]),N=e=>{f(e),j(a,s,c,e)};(0,em.useEffect)(()=>{e&&j(a,s,c,h)},[e]);let k=Math.ceil(r/d),E=Math.floor(h/d)+1;return e?(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(HH,{bankId:e}),(0,ep.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,ep.jsxs)(tR.Select,{value:a||"all",onValueChange:e=>{let t="all"===e?null:e;o(t),f(0),j(t,s,c,0)},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-[180px]",children:(0,ep.jsx)(tR.SelectValue,{placeholder:"All actions"})}),(0,ep.jsx)(tR.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:HR.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e.value,children:e.label},e.value))})]}),(0,ep.jsxs)(tR.Select,{value:s||"all",onValueChange:e=>{let t="all"===e?null:e;l(t),f(0),j(a,t,c,0)},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-[160px]",children:(0,ep.jsx)(tR.SelectValue,{placeholder:"All transports"})}),(0,ep.jsx)(tR.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:HB.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e.value,children:e.label},e.value))})]}),(0,ep.jsxs)(tR.Select,{value:c,onValueChange:e=>{u(e),f(0),j(a,s,e,0)},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-[150px]",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{position:"popper",children:[(0,ep.jsx)(tR.SelectItem,{value:"all",children:"All time"}),(0,ep.jsx)(tR.SelectItem,{value:"1h",children:"Last hour"}),(0,ep.jsx)(tR.SelectItem,{value:"1d",children:"Last 24 hours"}),(0,ep.jsx)(tR.SelectItem,{value:"7d",children:"Last 7 days"}),(0,ep.jsx)(tR.SelectItem,{value:"30d",children:"Last 30 days"})]})]}),(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",onClick:()=>j(a,s,c,h),disabled:p,children:[(0,ep.jsx)(eW,{className:`w-4 h-4 mr-1 ${p?"animate-spin":""}`}),"Refresh"]}),(0,ep.jsxs)("span",{className:"text-sm text-muted-foreground ml-auto",children:[r," ",1===r?"entry":"entries"]})]}),(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-[200px]",children:"Time"}),(0,ep.jsx)(eJ,{children:"Action"}),(0,ep.jsx)(eJ,{className:"w-[100px]",children:"Transport"}),(0,ep.jsx)(eJ,{className:"w-[100px]",children:"Duration"})]})}),(0,ep.jsx)(eZ,{children:0===t.length?(0,ep.jsx)(eQ,{children:(0,ep.jsx)(e0,{colSpan:4,className:"text-center text-muted-foreground py-8",children:p?"Loading...":"No audit logs found"})}):t.map(e=>(0,ep.jsxs)(eQ,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>{x(e),b(!0)},children:[(0,ep.jsx)(e0,{className:"text-sm font-mono",children:HV(e.started_at)}),(0,ep.jsx)(e0,{className:"font-medium",children:e.action}),(0,ep.jsx)(e0,{children:(0,ep.jsx)(HU,{transport:e.transport})}),(0,ep.jsx)(e0,{className:"text-sm text-muted-foreground font-mono",children:HF(e.started_at,e.ended_at)})]},e.id))})]}),k>1&&(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("span",{className:"text-sm text-muted-foreground",children:["Page ",E," of ",k]}),(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",onClick:()=>N(Math.max(0,h-d)),disabled:0===h,children:[(0,ep.jsx)(eS,{className:"w-4 h-4 mr-1"}),"Previous"]}),(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",onClick:()=>N(h+d),disabled:h+d>=r,children:["Next",(0,ep.jsx)(eT.ChevronRight,{className:"w-4 h-4 ml-1"})]})]})]}),(0,ep.jsx)(tY.Dialog,{open:y,onOpenChange:b,children:(0,ep.jsxs)(tY.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[(0,ep.jsx)(tY.DialogHeader,{children:(0,ep.jsxs)(tY.DialogTitle,{children:["Audit Log: ",v?.action]})}),v&&(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Action:"})," ",(0,ep.jsx)("span",{className:"font-medium",children:v.action})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Transport:"})," ",(0,ep.jsx)(HU,{transport:v.transport})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Started:"})," ",(0,ep.jsx)("span",{className:"font-mono",children:HV(v.started_at)})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Duration:"})," ",(0,ep.jsx)("span",{className:"font-mono",children:HF(v.started_at,v.ended_at)})]})]}),v.request&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h4",{className:"text-sm font-semibold mb-2",children:"Request"}),(0,ep.jsx)("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto max-h-[200px] overflow-y-auto",children:JSON.stringify(v.request,null,2)})]}),v.response&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h4",{className:"text-sm font-semibold mb-2",children:"Response"}),(0,ep.jsx)("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto max-h-[200px] overflow-y-auto",children:JSON.stringify(v.response,null,2)})]}),v.metadata&&Object.keys(v.metadata).length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h4",{className:"text-sm font-semibold mb-2",children:"Metadata"}),(0,ep.jsx)("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto",children:JSON.stringify(v.metadata,null,2)})]})]})]})})]}):null}let HY=(0,eN.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);var tH=tH;e.s(["default",0,function(){(0,eg.useParams)();let e=(0,eg.useRouter)(),t=(0,eg.useSearchParams)(),{features:n}=(0,ew.useFeatures)(),{currentBank:r,setCurrentBank:i,loadBanks:a}=(0,ey.useBank)(),o=t.get("view")||"profile",s=t.get("subTab")||"world",l=t.get("bankConfigTab")||"general",c=n?.observations??!1,u=n?.bank_config_api??!1,[d,h]=(0,em.useState)(!1),[f,p]=(0,em.useState)(!1),[g,v]=(0,em.useState)(!1),[x,y]=(0,em.useState)(!1),[b,w]=(0,em.useState)(!1),[j,N]=(0,em.useState)(!1),[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(!1),S=t=>{r&&e.push((0,eb.bankRoute)(r,`?view=data&subTab=${t}`))},T=t=>{r&&e.push((0,eb.bankRoute)(r,`?view=profile&bankConfigTab=${t}`))},A=async()=>{if(r){p(!0);try{await eD.client.deleteBank(r),h(!1),i(null),await a(),e.push("/")}catch(e){}finally{p(!1)}}},O=async()=>{if(r){y(!0);try{let e=await eD.client.clearObservations(r);v(!1),ev.toast.success("Success",{description:e.message||"Observations cleared successfully"})}catch(e){}finally{y(!1)}}},M=async()=>{if(r){_(!0);try{await eD.client.resetBankConfig(r),E(!1)}catch{}finally{_(!1)}}},P=async()=>{if(r){w(!0);try{await eD.client.triggerConsolidation(r)}catch(e){}finally{w(!1)}}},D=async()=>{if(r){N(!0);try{let e=await eD.client.recoverConsolidation(r);ev.toast.success(`Recovered ${e.retried_count} failed ${1===e.retried_count?"memory":"memories"} for re-consolidation`)}catch(e){}finally{N(!1)}}};return(0,ep.jsxs)("div",{className:"min-h-screen bg-background flex flex-col",children:[(0,ep.jsx)(ex.BankSelector,{}),(0,ep.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[(0,ep.jsx)(eP,{currentTab:o,onTabChange:t=>{r&&e.push((0,eb.bankRoute)(r,`?view=${t}`))}}),(0,ep.jsx)("main",{className:"flex-1 overflow-y-auto",children:(0,ep.jsxs)("div",{className:"p-6",children:["profile"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex justify-between items-start mb-6",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Bank Configuration"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Manage bank settings, profile, and operations."})]}),(0,ep.jsxs)(p5,{children:[(0,ep.jsx)(p4,{asChild:!0,children:(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",children:["Actions",(0,ep.jsx)(mH,{className:"w-4 h-4 ml-2"})]})}),(0,ep.jsxs)(ml,{align:"end",className:"w-48",children:[(0,ep.jsxs)(mc,{onClick:async()=>{if(r)try{let e=await eD.client.exportBankTemplate(r),t=JSON.stringify(e,null,2);await navigator.clipboard.writeText(t),ev.toast.success("Template copied to clipboard")}catch{ev.toast.error("Failed to export template")}},children:[(0,ep.jsx)(HY,{className:"w-4 h-4 mr-2"}),"Export Template"]}),(0,ep.jsx)(mu,{}),(0,ep.jsxs)(mc,{onClick:P,disabled:b||!c,title:c?void 0:"Observations feature is not enabled",children:[b?(0,ep.jsx)(tH.default,{className:"w-4 h-4 mr-2 animate-spin"}):(0,ep.jsx)(gi,{className:"w-4 h-4 mr-2"}),b?"Consolidating...":"Run Consolidation",!c&&(0,ep.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ep.jsxs)(mc,{onClick:D,disabled:j||!c,title:c?void 0:"Observations feature is not enabled",children:[j?(0,ep.jsx)(tH.default,{className:"w-4 h-4 mr-2 animate-spin"}):(0,ep.jsx)(Up,{className:"w-4 h-4 mr-2"}),j?"Recovering...":"Recover Consolidation",!c&&(0,ep.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ep.jsxs)(mc,{onClick:()=>v(!0),disabled:!c,className:"text-amber-600 dark:text-amber-400 focus:text-amber-700 dark:focus:text-amber-300",title:c?void 0:"Observations feature is not enabled",children:[(0,ep.jsx)(mV,{className:"w-4 h-4 mr-2"}),"Clear Observations",!c&&(0,ep.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ep.jsx)(mu,{}),(0,ep.jsxs)(mc,{onClick:()=>E(!0),disabled:!u,className:"text-amber-600 dark:text-amber-400 focus:text-amber-700 dark:focus:text-amber-300",title:u?void 0:"Bank Config API is disabled",children:[(0,ep.jsx)(Up,{className:"w-4 h-4 mr-2"}),"Reset Configuration",!u&&(0,ep.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ep.jsx)(mu,{}),(0,ep.jsxs)(mc,{onClick:()=>h(!0),className:"text-red-600 dark:text-red-400 focus:text-red-700 dark:focus:text-red-300",children:[(0,ep.jsx)(mV,{className:"w-4 h-4 mr-2"}),"Delete Bank"]})]})]})]}),(0,ep.jsx)("div",{className:"mb-6 border-b border-border",children:(0,ep.jsxs)("div",{className:"flex gap-1",children:[(0,ep.jsxs)("button",{onClick:()=>T("general"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"general"===l?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["General","general"===l&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),u&&(0,ep.jsxs)("button",{onClick:()=>T("configuration"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"configuration"===l?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Configuration","configuration"===l&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>T("webhooks"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"webhooks"===l?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Webhooks","webhooks"===l&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>T("audit-logs"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"audit-logs"===l?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Audit Logs","audit-logs"===l&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]})]})}),(0,ep.jsxs)("div",{children:["general"===l&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Overview statistics and background operations for this memory bank."}),(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(Uf,{}),(0,ep.jsx)(Ux,{}),(0,ep.jsx)(jd,{hideReflectFields:!0})]})]}),"configuration"===l&&u&&(0,ep.jsx)("div",{className:"space-y-6",children:(0,ep.jsx)(jM,{})}),"webhooks"===l&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Manage webhook endpoints to receive event notifications from this memory bank."}),(0,ep.jsx)(UM,{})]}),"audit-logs"===l&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"View audit trail of all operations performed on this memory bank."}),(0,ep.jsx)(HW,{})]})]})]}),"recall"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Recall"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"Analyze memory recall with detailed trace information and retrieval methods."}),(0,ep.jsx)(js,{})]}),"reflect"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Reflect"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"Run an agentic loop that autonomously gathers evidence and reasons through the lens of the bank's disposition to generate contextual responses."}),(0,ep.jsx)(ja,{})]}),"data"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Memories"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"View and explore different types of memories stored in this memory bank."}),(0,ep.jsx)("div",{className:"mb-6 border-b border-border",children:(0,ep.jsxs)("div",{className:"flex gap-1",children:[(0,ep.jsxs)("button",{onClick:()=>S("world"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"world"===s?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["World Facts","world"===s&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>S("experience"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"experience"===s?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Experience","experience"===s&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>S("observations"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"observations"===s?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Observations",!c&&(0,ep.jsx)("span",{className:"ml-2 text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"Off"}),"observations"===s&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>S("mental-models"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"mental-models"===s?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Mental Models","mental-models"===s&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]})]})}),(0,ep.jsxs)("div",{children:["world"===s&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Objective facts about the world received from external sources."}),(0,ep.jsx)(fF,{factType:"world"},"world")]}),"experience"===s&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"The bank's own actions, interactions, and first-person experiences."}),(0,ep.jsx)(fF,{factType:"experience"},"experience")]}),"observations"===s&&(c?(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Consolidated knowledge synthesized from facts — patterns, preferences, and learnings that emerge from accumulated evidence."}),(0,ep.jsx)(fF,{factType:"observation"},"observations")]}):(0,ep.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,ep.jsx)("div",{className:"text-muted-foreground mb-2",children:(0,ep.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ep.jsx)("path",{d:"M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2Z"}),(0,ep.jsx)("path",{d:"M12 8v4"}),(0,ep.jsx)("path",{d:"M12 16h.01"})]})}),(0,ep.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-1",children:"Observations Not Enabled"}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground max-w-md",children:["Observations consolidation is disabled on this server. Set"," ",(0,ep.jsx)("code",{className:"px-1 py-0.5 bg-muted rounded text-xs",children:"HINDSIGHT_API_ENABLE_OBSERVATIONS=true"})," ","to enable."]})]})),"mental-models"===s&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"User-curated summaries generated from queries — reusable knowledge snapshots that can be refreshed as memories evolve."}),(0,ep.jsx)(Ub,{},"mental-models")]})]})]}),"documents"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Documents"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"Manage documents and retain new memories."}),(0,ep.jsx)(m0,{})]}),"entities"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Entities"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"Explore entities (people, organizations, places) mentioned in memories."}),(0,ep.jsx)(m1,{})]})]})})]}),(0,ep.jsx)(mv,{open:d,onOpenChange:h,children:(0,ep.jsxs)(mD,{children:[(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mR,{children:"Delete Memory Bank"}),(0,ep.jsx)(mB,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to delete the memory bank"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:r}),"?"]}),(0,ep.jsx)("p",{className:"text-red-600 dark:text-red-400 font-medium",children:"This action cannot be undone. All memories, entities, documents, and the bank profile will be permanently deleted."})]})})]}),(0,ep.jsxs)(mI,{children:[(0,ep.jsx)(mF,{disabled:f,children:"Cancel"}),(0,ep.jsx)(mz,{onClick:A,disabled:f,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:f?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Deleting..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(mV,{className:"w-4 h-4 mr-2"}),"Delete Bank"]})})]})]})}),(0,ep.jsx)(mv,{open:k,onOpenChange:E,children:(0,ep.jsxs)(mD,{children:[(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mR,{children:"Reset Configuration"}),(0,ep.jsx)(mB,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to reset all configuration overrides for"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:r}),"?"]}),(0,ep.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:"All per-bank settings (retain, observations, reflect) will revert to server defaults. This does not affect memories, entities, or the bank profile."})]})})]}),(0,ep.jsxs)(mI,{children:[(0,ep.jsx)(mF,{disabled:C,children:"Cancel"}),(0,ep.jsx)(mz,{onClick:M,disabled:C,children:C?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Resetting..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(Up,{className:"w-4 h-4 mr-2"}),"Reset Configuration"]})})]})]})}),(0,ep.jsx)(mv,{open:g,onOpenChange:v,children:(0,ep.jsxs)(mD,{children:[(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mR,{children:"Clear Observations"}),(0,ep.jsx)(mB,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to clear all observations for"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:r}),"?"]}),(0,ep.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:"This will delete all consolidated knowledge. Observations will be regenerated the next time consolidation runs."})]})})]}),(0,ep.jsxs)(mI,{children:[(0,ep.jsx)(mF,{disabled:x,children:"Cancel"}),(0,ep.jsx)(mz,{onClick:O,disabled:x,className:"bg-amber-500 text-white hover:bg-amber-600",children:x?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Clearing..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(mV,{className:"w-4 h-4 mr-2"}),"Clear Observations"]})})]})]})})]})}],37578)}]);